23 #include "wx/canvas/transdlg.h"
28 #define ID_scalex 10006
29 #define ID_scaley 10004
30 #define ID_TEXTCTRL3 10013
31 #define ID_vertical 10010
32 #define ID_horizontal 10009
33 #define ID_rotateangle 10014
34 #define ID_clockwise 10011
35 #define ID_counterclockwise 10012
37 #define ID_apply 10016
49 EVT_BUTTON( ID_hide, a2dTransDlg::OnHideClick )
50 EVT_BUTTON( ID_apply, a2dTransDlg::OnApplyClick )
57 a2dTransDlg::a2dTransDlg()
62 a2dTransDlg::a2dTransDlg( wxWindow* parent,
bool modal, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
66 Create( parent,
id, caption, pos, size, style );
73 bool a2dTransDlg::Create( wxWindow* parent, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
75 SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
76 wxDialog::Create( parent,
id, caption, pos, size, style );
81 GetSizer()->SetSizeHints(
this );
107 m_rotateangle = NULL;
109 m_counterclockwise = NULL;
118 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer( wxVERTICAL );
119 itemDialog1->SetSizer( itemBoxSizer2 );
121 wxStaticBox* itemStaticBoxSizer3Static =
new wxStaticBox( itemDialog1, wxID_ANY, _(
"Move (x,y)" ) );
122 wxStaticBoxSizer* itemStaticBoxSizer3 =
new wxStaticBoxSizer( itemStaticBoxSizer3Static, wxVERTICAL );
123 itemBoxSizer2->Add( itemStaticBoxSizer3, 0, wxALIGN_LEFT | wxALL, 2 );
125 m_x =
new wxTextCtrl( itemDialog1, ID_x, _(
"0" ), wxDefaultPosition, wxDefaultSize, 0 );
126 m_x->SetHelpText( _(
"Move by x" ) );
128 m_x->SetToolTip( _(
"Move by x" ) );
129 m_x->SetName( _T(
"x" ) );
130 itemStaticBoxSizer3->Add( m_x, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 2 );
132 m_y =
new wxTextCtrl( itemDialog1, ID_y, _(
"0" ), wxDefaultPosition, wxDefaultSize, 0 );
133 m_y->SetHelpText( _(
"Move by y" ) );
135 m_y->SetToolTip( _(
"Move by y" ) );
136 m_y->SetName( _T(
"y" ) );
137 itemStaticBoxSizer3->Add( m_y, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 2 );
139 wxStaticBox* itemStaticBoxSizer6Static =
new wxStaticBox( itemDialog1, wxID_ANY, _(
"Scale (x,y)" ) );
140 wxStaticBoxSizer* itemStaticBoxSizer6 =
new wxStaticBoxSizer( itemStaticBoxSizer6Static, wxVERTICAL );
141 itemBoxSizer2->Add( itemStaticBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
143 m_scalex =
new wxTextCtrl( itemDialog1, ID_scalex, _(
"1" ), wxDefaultPosition, wxDefaultSize, 0 );
144 m_scalex->SetHelpText( _(
"Scale in x with this value" ) );
146 m_scalex->SetToolTip( _(
"Scale in x with this value" ) );
147 m_scalex->SetName( _T(
"scalex" ) );
148 itemStaticBoxSizer6->Add( m_scalex, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 2 );
150 m_scaley =
new wxTextCtrl( itemDialog1, ID_scaley, _(
"1" ), wxDefaultPosition, wxDefaultSize, 0 );
151 m_scaley->SetHelpText( _(
"Scale in y with this value" ) );
153 m_scaley->SetToolTip( _(
"Scale in y with this value" ) );
154 m_scaley->SetName( _T(
"scaley" ) );
155 itemStaticBoxSizer6->Add( m_scaley, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 2 );
157 wxStaticBox* itemStaticBoxSizer9Static =
new wxStaticBox( itemDialog1, wxID_ANY, _(
"Mirror" ) );
158 wxStaticBoxSizer* itemStaticBoxSizer9 =
new wxStaticBoxSizer( itemStaticBoxSizer9Static, wxVERTICAL );
159 itemBoxSizer2->Add( itemStaticBoxSizer9, 0, wxALIGN_LEFT | wxALL, 2 );
161 m_vertical =
new wxCheckBox( itemDialog1, ID_vertical, _(
"Vertical" ), wxDefaultPosition, wxDefaultSize, 0 );
162 m_vertical->SetValue(
false );
163 m_vertical->SetHelpText( _(
"Mirror on vertical axis" ) );
165 m_vertical->SetToolTip( _(
"Mirror on vertical axis" ) );
166 m_vertical->SetName( _T(
"vertical" ) );
167 itemStaticBoxSizer9->Add( m_vertical, 0, wxALIGN_LEFT | wxALL, 2 );
169 m_horizontal =
new wxCheckBox( itemDialog1, ID_horizontal, _(
"Horizontal" ), wxDefaultPosition, wxDefaultSize, 0 );
170 m_horizontal->SetValue(
false );
171 m_horizontal->SetHelpText( _(
"Mirror the object on horizontal" ) );
173 m_horizontal->SetToolTip( _(
"Mirror the object on horizontal" ) );
174 m_horizontal->SetName( _T(
"horizontal" ) );
175 itemStaticBoxSizer9->Add( m_horizontal, 0, wxALIGN_LEFT | wxALL, 2 );
177 wxStaticBox* itemStaticBoxSizer12Static =
new wxStaticBox( itemDialog1, wxID_ANY, _(
"Rotate" ) );
178 wxStaticBoxSizer* itemStaticBoxSizer12 =
new wxStaticBoxSizer( itemStaticBoxSizer12Static, wxVERTICAL );
179 itemBoxSizer2->Add( itemStaticBoxSizer12, 0, wxALIGN_LEFT | wxALL, 2 );
181 m_rotateangle =
new wxTextCtrl( itemDialog1, ID_rotateangle, _(
"0" ), wxDefaultPosition, wxDefaultSize, 0 );
182 m_rotateangle->SetHelpText( _(
"Rotate object by this angle" ) );
184 m_rotateangle->SetToolTip( _(
"Rotate object by this angle" ) );
185 m_rotateangle->SetName( _T(
"rotateangle" ) );
186 itemStaticBoxSizer12->Add( m_rotateangle, 0, wxALIGN_LEFT | wxALL, 2 );
188 m_clockwise =
new wxRadioButton( itemDialog1, ID_clockwise, _(
"Clockwise" ), wxDefaultPosition, wxDefaultSize, 0 );
189 m_clockwise->SetValue(
true );
190 m_clockwise->SetHelpText( _(
"Rotate clockwise" ) );
192 m_clockwise->SetToolTip( _(
"Rotate clockwise" ) );
193 m_clockwise->SetName( _T(
"clockwise" ) );
194 itemStaticBoxSizer12->Add( m_clockwise, 0, wxALIGN_LEFT | wxALL, 2 );
196 m_counterclockwise =
new wxRadioButton( itemDialog1, ID_counterclockwise, _(
"Counter clockwise" ), wxDefaultPosition, wxDefaultSize, 0 );
197 m_counterclockwise->SetValue(
false );
198 m_counterclockwise->SetHelpText( _(
"Rotate clockwise" ) );
200 m_counterclockwise->SetToolTip( _(
"Rotate clockwise" ) );
201 m_counterclockwise->SetName( _T(
"counterclockwise" ) );
202 itemStaticBoxSizer12->Add( m_counterclockwise, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 2 );
204 wxBoxSizer* itemBoxSizer16 =
new wxBoxSizer( wxHORIZONTAL );
205 itemBoxSizer2->Add( itemBoxSizer16, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
209 m_hide =
new wxButton( itemDialog1, ID_hide, _(
"Hide" ), wxDefaultPosition, wxSize( 50, -1 ), 0 );
210 m_hide->SetHelpText( _(
"Hide this dialog" ) );
212 m_hide->SetToolTip( _(
"Hide this dialog" ) );
213 m_hide->SetName( _T(
"hide" ) );
214 itemBoxSizer16->Add( m_hide, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
216 m_apply =
new wxButton( itemDialog1, ID_apply, _(
"Apply" ), wxDefaultPosition, wxSize( 50, -1 ), 0 );
217 m_apply->SetHelpText( _(
"Apply transform" ) );
219 m_apply->SetToolTip( _(
"Apply transform" ) );
220 m_apply->SetName( _T(
"apply" ) );
221 itemBoxSizer16->Add( m_apply, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
225 m_hide =
new wxButton( itemDialog1, ID_hide, _(
"Cancel" ), wxDefaultPosition, wxSize( 50, -1 ), 0 );
226 m_hide->SetHelpText( _(
"Cancel this action" ) );
228 m_hide->SetToolTip( _(
"Cancel this dialog" ) );
229 m_hide->SetName( _T(
"hide" ) );
231 itemBoxSizer16->Add( m_hide, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
232 m_apply =
new wxButton( itemDialog1, ID_apply, _(
"Oke" ), wxDefaultPosition, wxSize( 50, -1 ), 0 );
233 m_apply->SetHelpText( _(
"Apply transform" ) );
235 m_apply->SetToolTip( _(
"Apply transform" ) );
236 m_apply->SetName( _T(
"apply" ) );
237 itemBoxSizer16->Add( m_apply, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
256 EndModal( wxID_CANCEL );
268 m_lworld.
Mirror( m_vertical->GetValue(), m_horizontal->GetValue() );
271 m_x->GetValue().ToDouble( &x );
273 m_y->GetValue().ToDouble( &y );
277 m_rotateangle->GetValue().ToDouble( &rotate );
278 if ( m_clockwise->GetValue() )
280 m_lworld = m_lworld.
Rotate( rotate, 0, 0 );
283 m_scalex->GetValue().ToDouble( &scalex );
285 m_scaley->GetValue().ToDouble( &scaley );
286 m_lworld.
Scale( scalex, scaley, x, y );
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
a2dAffineMatrix & Mirror(bool y=true, bool x=false)
mirror a matrix in x, y
bool Rotate(double angle)
Rotate clockwise by the given number of degrees:
a2dCanvasObject is the base class for Canvas Objects.
a2dAffineMatrix a2dIDENTITY_MATRIX
global a2dAffineMatrix to set/pass the identity matrix.
void OnApplyClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_apply
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
~a2dTransDlg()
Destructor.
void Init()
Initialises member variables.
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_TRANSFORM_IDNAME, const wxString &caption=SYMBOL_TRANSFORM_TITLE, const wxPoint &pos=SYMBOL_TRANSFORM_POSITION, const wxSize &size=SYMBOL_TRANSFORM_SIZE, long style=SYMBOL_TRANSFORM_STYLE)
Creation.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
void OnHideClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_hide
static bool ShowToolTips()
Should we show tooltips?
a2dCommandProcessor * GetCommandProcessor() const
Returns a pointer to the command processor associated with this document.
void CreateControls()
Creates the controls and sizers.
a2dTransDlg()
Constructors.
bool Scale(double scale)
Scale by scale (isotropic scaling i.e. the same in x and y):
bool Translate(double x, double y)
Translate by dx, dy:
a2dDrawing * GetDrawing() const
get drawing via top object
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
all headers of the canvas module