-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwxcapoc_editmatrix.cpp
48 lines (41 loc) · 1.66 KB
/
wxcapoc_editmatrix.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
*
* Copyright (c) 2019 Mateusz 'mteg' Golicz
*
* Distributed under Apache License version 2.0
*
*/
#include "capengine.h"
#include "caprenderer_ancientgl.h"
#include "capdebug.h"
#include "wxcapoc.h"
#include "wxcapoc_editmatrix.h"
#include <wx/valnum.h>
wxCapoc_EditMatrix::wxCapoc_EditMatrix(capAffineMatrix *m, wxString title) : wxDialog(NULL, -1, title, wxDefaultPosition, wxSize(250, 230), wxWS_EX_VALIDATE_RECURSIVELY | wxDEFAULT_DIALOG_STYLE) {
auto *b_box = new wxBoxSizer(wxHORIZONTAL);
auto *v_box = new wxBoxSizer(wxVERTICAL);
int row, col;
const wxString rowLabels[3] = {wxT("x"), wxT("y"), wxT("z")};
this->m = m;
auto *coeff_sizer = new wxGridSizer(5, 5, 5);
for(row = 0; row<3; row++)
{
coeff_sizer->Add(new wxStaticText(this, wxID_ANY, rowLabels[row]));
for(col = 0; col<4; col++)
{
wxTextCtrl *cc = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT);
cc->SetValidator(wxFloatingPointValidator <float> (&m->m[col*4+row]));
coeff_sizer->Add(cc);
}
}
okButton = new wxButton(this, wxID_OK, wxT("OK"));
cancelButton = new wxButton(this, wxID_CANCEL, wxT("Cancel"));
b_box->Add(okButton, 1); b_box->Add(cancelButton, 1);
composeCheckbox = new wxCheckBox(this, wxID_ANY, wxT("Compose with current transform"));
v_box->Add(coeff_sizer, 1, wxEXPAND | wxALIGN_CENTER | wxTOP | wxBOTTOM, 10);
v_box->Add(composeCheckbox, 0, wxEXPAND | wxALIGN_CENTER, 10);
v_box->Add(b_box, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 10);
SetSizerAndFit(v_box);
v_box->SetSizeHints(this);
SetAutoLayout(true);
}