wxArt2D
styledialg.cpp
1 /*! \file editor/src/styledialg.cpp
2  \author Probably Klaas Holwerda
3 
4  Copyright: 2001-2004 (C) Probably Klaas Holwerda
5 
6  Licence: wxWidgets Licence
7 
8  RCS-ID: $Id: styledialg.cpp,v 1.60 2009/09/10 17:04:09 titato Exp $
9 */
10 
11 #include "a2dprec.h"
12 
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16 
17 #ifndef WX_PRECOMP
18 #include "wx/wx.h"
19 #endif
20 
21 // Include private header
22 #include "wx/canvas/styledialg.h"
23 #include "wx/canvas/edit.h"
24 #include "wx/canvas/drawer.h"
25 #include "wx/canvas/polygon.h"
26 #include "wx/artbase/dcdrawer.h"
27 
28 #include <wx/gbsizer.h>
29 #include <wx/odcombo.h>
30 #include <wx/tglbtn.h>
31 
32 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
33 #include <wx/msw/msvcrt.h>
34 #endif
35 
36 BEGIN_EVENT_TABLE( a2dStyleDialog, wxDialog )
37 
38  EVT_SPINCTRL( ID_RED, a2dStyleDialog::SetColor )
39  EVT_SPINCTRL( ID_GREEN, a2dStyleDialog::SetColor )
40  EVT_SPINCTRL( ID_BLUE, a2dStyleDialog::SetColor )
41  EVT_TEXT ( ID_RED, a2dStyleDialog::OnSpinCtrlText )
42  EVT_TEXT ( ID_GREEN, a2dStyleDialog::OnSpinCtrlText )
43  EVT_TEXT ( ID_BLUE, a2dStyleDialog::OnSpinCtrlText )
44  EVT_RADIOBOX( ID_COLOURS, a2dStyleDialog::ColorSelect )
45  EVT_COMMAND_SCROLL( ID_SLIDER_RED, a2dStyleDialog::OnSliderUpdate )
46  EVT_COMMAND_SCROLL( ID_SLIDER_GREEN, a2dStyleDialog::OnSliderUpdate )
47  EVT_COMMAND_SCROLL( ID_SLIDER_BLUE, a2dStyleDialog::OnSliderUpdate )
48  EVT_BUTTON ( ID_FILLCOLOR, a2dStyleDialog::OnColourBitmap )
49  EVT_BUTTON ( ID_STROKECOLOR, a2dStyleDialog::OnColourBitmap )
50  EVT_BUTTON ( ID_STIPPLEBITMAP, a2dStyleDialog::OnStippleBitmap )
51  EVT_CHOICE ( ID_FILLSTYLE, a2dStyleDialog::OnFillStyle )
52  EVT_CHOICE ( ID_STROKESTYLE, a2dStyleDialog::OnStrokeStyle )
53  EVT_TEXT ( ID_PIXELWIDTH, a2dStyleDialog::OnPixelWidth )
54  EVT_SPINCTRL( ID_PIXELWIDTH, a2dStyleDialog::OnPixelWidthSpin )
55  EVT_CHECKBOX( ID_PIXELSTROKE, a2dStyleDialog::OnPixelStroke )
56  EVT_CLOSE ( a2dStyleDialog::OnCloseWindow )
57  EVT_COM_EVENT( a2dStyleDialog::OnComEvent )
58  EVT_DO( a2dStyleDialog::OnDoEvent )
59  EVT_UNDO( a2dStyleDialog::OnUndoEvent )
60  EVT_SIZE( a2dStyleDialog::OnSize )
61  EVT_BUTTON ( ID_MODEL_BUTTON_OK, a2dStyleDialog::CmOk )
62  EVT_IDLE ( a2dStyleDialog::OnIdle )
63 END_EVENT_TABLE()
64 
65 a2dStyleDialog::a2dStyleDialog( a2dHabitat* habitat, wxWindow* parent, long style, bool modal, bool setCentralStyle ):
66  wxDialog( parent, -1, _T( "style dialog" ), wxDefaultPosition, wxDefaultSize, style, _T( "style dialog" ) )
67 {
68  m_habitat = habitat;
69  a2dCanvasGlobals->ConnectEvent( a2dEVT_COM_EVENT, this );
70 
71  m_fillpatterns = new FillPatterns();
72 
73  m_fillpatternmono = *m_fillpatterns->GetPattern( 0 );
74 
75  // no standard colours
76  // set extra part of dialog true
77  m_cdata = new wxColourData();
78  m_cdata->SetChooseFull( true );
79  // make colour dialog
80  m_cd = new wxColourDialog( this, m_cdata );
81 
82  m_fillstippleb = wxBitmap( 34, 34, -1 );
83 
84  // the three colors which can be changed in the dialog sliders
85  m_colorFill1 = wxColour( 0, 255, 255 );
86  m_colorFill2 = wxColour( 0, 255, 0 );
87  m_colorStroke = wxColour( 0, 0, 255 );
88 
89  //set the current color to be changeable
90  m_color = &m_colorFill1;
91 
92  //make for every type of style a template to be modified.
93  m_oneColFill = a2dFill( m_colorFill1, a2dFILL_SOLID );
94  m_PattFill = a2dFill( m_fillpatternmono );
95  m_hatchTwoColFill = a2dFill( m_colorFill1, m_colorFill2, a2dFILL_TWOCOL_BDIAGONAL_HATCH );
96  m_linGrad = a2dFill( m_colorFill1, m_colorFill2, a2dFILL_GRADIENT_FILL_XY_LINEAR );
97  m_radGrad = a2dFill( m_colorFill1, m_colorFill2, a2dFILL_GRADIENT_FILL_XY_RADIAL );
98  m_dropGrad = a2dFill( m_colorFill1, m_colorFill2, a2dFILL_GRADIENT_FILL_XY_RADIAL );
99  m_oneColStroke = a2dStroke( m_colorStroke, 1.0, a2dSTROKE_SOLID );
100  m_pattStroke = a2dStroke( m_fillpatternmono );
101 
102  //set the actual current/initial templates
103  m_fill = m_oneColFill;
104  m_stroke = m_oneColStroke;
105 
106  wxBoxSizer* item0 = new wxBoxSizer( wxVERTICAL );
107 
108  wxBoxSizer* item4 = new wxBoxSizer( wxVERTICAL );
109 
110  wxBoxSizer* item5 = new wxBoxSizer( wxHORIZONTAL );
111 
112  wxBoxSizer* item6 = new wxBoxSizer( wxVERTICAL );
113 
114  wxBoxSizer* item7 = new wxBoxSizer( wxHORIZONTAL );
115 
116  SetEvtHandlerEnabled( false );
117  m_spinred = new wxSpinCtrl( this, ID_RED, _T( "125" ), wxDefaultPosition, wxSize( 50, -1 ), wxSP_ARROW_KEYS, 0, 255, 122 );
118  item7->Add( m_spinred, 0, wxALIGN_CENTRE | wxALL, 2 );
119 
120  m_sliderred = new wxSlider( this, ID_SLIDER_RED, 125, 0, 255, wxDefaultPosition, wxSize( 120, -1 ), 0 );
121 
122  item7->Add( m_sliderred, 0, wxALIGN_CENTRE | wxALL, 2 );
123 
124  item6->Add( item7, 0, wxALIGN_CENTER, 2 );
125 
126  wxBoxSizer* item10 = new wxBoxSizer( wxHORIZONTAL );
127 
128  m_spingreen = new wxSpinCtrl( this, ID_GREEN, _T( "125" ), wxDefaultPosition, wxSize( 50, -1 ), wxSP_ARROW_KEYS, 0, 255, 122 );
129  item10->Add( m_spingreen, 0, wxALIGN_CENTRE | wxALL, 2 );
130 
131  m_slidergreen = new wxSlider( this, ID_SLIDER_GREEN, 125, 0, 255, wxDefaultPosition, wxSize( 120, -1 ), 0 );
132  item10->Add( m_slidergreen, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT | wxBOTTOM, 2 );
133 
134  item6->Add( item10, 0, wxALIGN_CENTRE, 2 );
135 
136  wxBoxSizer* item13 = new wxBoxSizer( wxHORIZONTAL );
137 
138  m_spinblue = new wxSpinCtrl( this, ID_BLUE, _T( "125" ), wxDefaultPosition, wxSize( 50, -1 ), wxSP_ARROW_KEYS, 0, 255, 122 );
139  item13->Add( m_spinblue, 0, wxALIGN_CENTRE | wxALL, 2 );
140 
141  m_sliderblue = new wxSlider( this, ID_SLIDER_BLUE, 125, 0, 255, wxDefaultPosition, wxSize( 120, -1 ), 0 );
142  item13->Add( m_sliderblue, 0, wxALIGN_CENTRE | wxALL, 2 );
143 
144  item6->Add( item13, 0, wxALIGN_CENTRE, 2 );
145 
146  wxBoxSizer* item63 = new wxBoxSizer( wxHORIZONTAL );
147  wxString strs18[] =
148  {
149  _T( "Stroke" ),
150  _T( "Fill 1" ),
151  _T( "Fill2" )
152  };
153  wxRadioBox* item18 = new wxRadioBox( this, ID_COLOURS, _T( "Colours" ), wxDefaultPosition, wxDefaultSize, 3, strs18, 1, wxRA_SPECIFY_ROWS );
154  item18->SetSelection( 1 );
155  item63->Add( item18, 0, wxALIGN_CENTRE );
156  item6->Add( item63, 0, wxALIGN_CENTRE, 2 );
157 
158  wxBoxSizer* item32 = new wxBoxSizer( wxHORIZONTAL );
159 
160  wxStaticText* item33 = new wxStaticText( this, -1, _T( "stipple bitmap" ), wxDefaultPosition, wxSize( 60, -1 ), 0 );
161  item33->SetForegroundColour( *wxRED );
162  item33->SetBackgroundColour( *wxLIGHT_GREY );
163  item32->Add( item33, 0, wxALIGN_CENTRE | wxALL, 2 );
164  m_fillstipple = new wxBitmapButton( this, ID_STIPPLEBITMAP, m_fillstippleb, wxDefaultPosition, wxSize( 34, 34 ) );
165  item32->Add( m_fillstipple, 0, wxALIGN_CENTRE | wxALL, 2 );
166  item6->Add( item32, 0, wxALIGN_LEFT, 2 );
167 
168  item5->Add( item6, 1, wxGROW | wxALIGN_CENTER_HORIZONTAL, 2 );
169 
170  m_colourfillshow = new wxBitmapButton( this, ID_FILLCOLOR, wxBitmap( 100, 150 ), wxDefaultPosition, wxDefaultSize );
171  item5->Add( m_colourfillshow, 0, wxALIGN_RIGHT | wxGROW, 1 );
172 
173  m_colourstrokeshow = new wxBitmapButton( this, ID_STROKECOLOR, wxBitmap( 10, 150 ), wxDefaultPosition, wxDefaultSize );
174  item5->Add( m_colourstrokeshow, 0, wxALIGN_RIGHT | wxGROW, 1 );
175 
176  item4->Add( item5, 0, wxEXPAND | wxALIGN_RIGHT, 2 );
177 
178  item0->Add( item4, 0, wxALIGN_CENTER_VERTICAL, 2 );
179 
180 
181  //fill style line
182  wxBoxSizer* item21 = new wxBoxSizer( wxVERTICAL );
183 
184  wxBoxSizer* item22 = new wxBoxSizer( wxHORIZONTAL );
185 
186  wxStaticText* item23 = new wxStaticText( this, ID_TEXT, _T( "Fill Style" ), wxDefaultPosition, wxSize( 60, -1 ), wxST_NO_AUTORESIZE );
187  item23->SetForegroundColour( *wxRED );
188  item23->SetBackgroundColour( *wxLIGHT_GREY );
189  item22->Add( item23, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT, 1 );
190 
191  wxString fillstyles[] =
192  {
193  _T( "Transparent (no fill)" ),
194  _T( "Solid" ),
195  _T( "Backward diagonal hatch" ),
196  _T( "Cross-diagonal hatch" ),
197  _T( "Forward diagonal hatch" ),
198  _T( "Cross hatch" ),
199  _T( "Horizontal hatch" ),
200  _T( "Vertical hatch" ),
201  _T( "Two Colour Backward diagonal hatch" ),
202  _T( "Two Colour Cross-diagonal hatch" ),
203  _T( "Two Colour Forward diagonal hatch" ),
204  _T( "Two Colour Cross hatch" ),
205  _T( "Two Colour Horizontal hatch" ),
206  _T( "Two Colour Vertical hatch" ),
207  _T( "wxSTIPPLE" ),
208  _T( "wxSTIPPLE_MASK_OPAQUE" ),
209  _T( "wxSTIPPLE_MASK_OPAQUE_TRANSPARENT" ),
210  _T( "wxGRADIENT_FILL_XY_LINEAR" ),
211  _T( "wxGRADIENT_FILL_XY_RADIAL" ),
212  _T( "wxGRADIENT_FILL_XY_DROP" ),
213  _T( "Inherit" ),
214  _T( "Layer" )
215  };
216 
217  m_fillstyles = new wxChoice( this, ID_FILLSTYLE, wxDefaultPosition, wxSize( 70, -1 ), 22, fillstyles, 0 );
218  item22->Add( m_fillstyles, 1, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
219 
220  item21->Add( item22, 0, wxEXPAND );
221 
222  wxBoxSizer* item25 = new wxBoxSizer( wxHORIZONTAL );
223 
224  wxStaticText* item26 = new wxStaticText( this, ID_TEXT, _T( "stroke width" ), wxDefaultPosition, wxSize( 60, -1 ), wxST_NO_AUTORESIZE );
225  item26->SetForegroundColour( *wxRED );
226  item26->SetBackgroundColour( *wxLIGHT_GREY );
227  item25->Add( item26, 0, wxALIGN_LEFT | wxLEFT, 1 );
228 
229  m_pixelwidth = new wxSpinCtrl( this, ID_PIXELWIDTH, _T( "0" ), wxDefaultPosition, wxSize( 60, -1 ), wxSP_ARROW_KEYS, 0, 1000, 0 );
230  item25->Add( m_pixelwidth, 0, wxEXPAND );
231 
232  m_pixelstroke = new wxCheckBox( this, ID_PIXELSTROKE, _T( "Pixel stroke" ), wxDefaultPosition, wxDefaultSize, 0 );
233  item25->Add( m_pixelstroke, 0, wxALIGN_RIGHT | wxALL, 1 );
234 
235  item21->Add( item25, 0, wxEXPAND );
236 
237  item0->Add( item21, 0, wxEXPAND );
238 
239  wxBoxSizer* item29 = new wxBoxSizer( wxHORIZONTAL );
240 
241  wxStaticText* item30 = new wxStaticText( this, ID_TEXT, _T( "StrokeStyle" ), wxDefaultPosition, wxSize( 60, -1 ), wxST_NO_AUTORESIZE );
242  item30->SetForegroundColour( *wxRED );
243  item30->SetBackgroundColour( *wxLIGHT_GREY );
244  item29->Add( item30, 0, wxALIGN_LEFT | wxLEFT, 1 );
245 
246  wxString strokestyles[] =
247  {
248  _T( "Transparent" ),
249  _T( "Solid style" ),
250  _T( "Dotted style" ),
251  _T( "Long dashed style" ),
252  _T( "Short dashed style" ),
253  _T( "Dot and dash style" ),
254  _T( "User defined dash style" ),
255  _T( "Backward diagonal hatch" ),
256  _T( "Cross-diagonal hatch" ),
257  _T( "Forward diagonal hatch" ),
258  _T( "Cross hatch" ),
259  _T( "Horizontal hatch" ),
260  _T( "Vertical hatch" ),
261  _T( "wxSTIPPLE" ),
262  _T( "wxSTIPPLE_MASK_OPAQUE" ),
263 
264  _T( "wxSTIPPLE_MASK_OPAQUE_TRANSPARENT" ),
265  _T( "a2dSTROKE_OBJECTS" ),
266  _T( "Inherit" ),
267  _T( "Layer" ),
268  };
269 
270  m_strokestyles = new wxChoice( this, ID_STROKESTYLE, wxDefaultPosition, wxSize( 70, -1 ), 19, strokestyles, 0 );
271  item29->Add( m_strokestyles, 1, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
272 
273  item0->Add( item29, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL, 2 );
274 
275  if ( modal )
276  {
277  item0->Add( new wxButton( this, ID_MODEL_BUTTON_OK, _T( "Ok" ), wxDefaultPosition, wxSize( 55, 20 ) ) );
278  m_modal = true;
279  }
280  else
281  {
282  m_modal = false;
283  }
284 
285  SetEvtHandlerEnabled( true );
286  SetAutoLayout( true );
287  SetSizer( item0 );
288  item0->Fit( this );
289  item0->SetSizeHints( this );
290 
291  m_skipspinevent = false;
292  m_doSentCommand = true;
293 
294  m_needsUpdate = true;
295  m_fillCommand = false;
296  m_strokeCommand = false;
297  m_setCentralStyle = setCentralStyle;
298 }
299 
300 
301 a2dStyleDialog::~a2dStyleDialog()
302 {
303  a2dCanvasGlobals->DisconnectEvent( a2dEVT_COM_EVENT, this );
304  delete m_fillpatterns;
305  delete m_cdata;
306  delete m_cd;
307 }
308 
309 void a2dStyleDialog::SetColor( wxSpinEvent& spinevent )
310 {
311  unsigned char m_colorR = m_color->Red();
312  unsigned char m_colorG = m_color->Green();
313  unsigned char m_colorB = m_color->Blue();
314 
315  switch ( spinevent.GetId() )
316  {
317  case ID_RED:
318  {
319  m_color->Set( spinevent.GetPosition(), m_colorG, m_colorB );
320  }
321  break;
322  case ID_GREEN:
323  {
324  m_color->Set( m_colorR, spinevent.GetPosition(), m_colorB );
325  }
326  break;
327  case ID_BLUE:
328  {
329  m_color->Set( m_colorR, m_colorG, spinevent.GetPosition() );
330  }
331  break;
332  default:
333  break;
334  }
335 
336  m_needsUpdate = true;
337 
338  if ( m_color == &m_colorStroke )
339  SentStyle( false, true );
340  else
341  SentStyle( true, false );
342 }
343 
344 void a2dStyleDialog::OnPixelWidth( wxCommandEvent& WXUNUSED( event ) )
345 {
346  m_stroke.SetWidth( m_pixelwidth->GetValue() );
347  SentStyle( false, true );
348 }
349 
350 void a2dStyleDialog::OnPixelWidthSpin( wxSpinEvent& WXUNUSED( event ) )
351 {
352  m_stroke.SetWidth( m_pixelwidth->GetValue() );
353  SentStyle( false, true );
354 }
355 
356 void a2dStyleDialog::OnPixelStroke( wxCommandEvent& WXUNUSED( event ) )
357 {
358  m_stroke.SetPixelStroke( m_pixelstroke->GetValue() );
359  SentStyle( false, true );
360 }
361 
362 
363 void a2dStyleDialog::OnSpinCtrlText( wxCommandEvent& event )
364 {
365  if ( m_skipspinevent == true )
366  {
367  m_skipspinevent = false;
368  return;
369  }
370 
371  unsigned char m_colorR = m_color->Red();
372  unsigned char m_colorG = m_color->Green();
373  unsigned char m_colorB = m_color->Blue();
374 
375  switch ( event.GetId() )
376  {
377  case ID_RED:
378  {
379  m_color->Set( m_spinred->GetValue(), m_colorG, m_colorB );
380  }
381  break;
382  case ID_GREEN:
383  {
384  m_color->Set( m_colorR, m_spingreen->GetValue(), m_colorB );
385  }
386  break;
387  case ID_BLUE:
388  {
389  m_color->Set( m_colorR, m_colorG, m_spinblue->GetValue() );
390  }
391  break;
392  default:
393  break;
394  }
395 
396  m_needsUpdate = true;
397 
398  if ( m_color == &m_colorStroke )
399  SentStyle( false, true );
400  else
401  SentStyle( true, false );
402 }
403 
404 void a2dStyleDialog::OnSliderUpdate( wxScrollEvent& event )
405 {
406  unsigned char m_colorR = m_color->Red();
407  unsigned char m_colorG = m_color->Green();
408  unsigned char m_colorB = m_color->Blue();
409 
410  switch ( event.GetId() )
411  {
412  case ID_SLIDER_RED:
413  {
414  m_color->Set( m_sliderred->GetValue(), m_colorG, m_colorB );
415  }
416  break;
417  case ID_SLIDER_GREEN:
418  {
419  m_color->Set( m_colorR, m_slidergreen->GetValue(), m_colorB );
420  }
421  break;
422  case ID_SLIDER_BLUE:
423  {
424  m_color->Set( m_colorR, m_colorG, m_sliderblue->GetValue() );
425  }
426  break;
427  default:
428  break;
429  }
430 
431  m_needsUpdate = true;
432 
433  if ( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE )
434  {
435  if ( m_color == &m_colorStroke )
436  SentStyle( false, true );
437  else
438  SentStyle( true, false );
439  }
440 }
441 
442 
443 void a2dStyleDialog::ColorSelect( wxCommandEvent& event )
444 {
445 
446  switch ( event.GetInt() )
447  {
448  case 0:
449  {
450  m_color = &m_colorStroke;
451  }
452  break;
453  case 1:
454  {
455  m_color = &m_colorFill1;
456  }
457  break;
458  case 2:
459  {
460  m_color = &m_colorFill2;
461  }
462  break;
463  default:
464  break;
465  }
466 
467  m_needsUpdate = true;
468 
469  if ( m_color == &m_colorStroke )
470  SentStyle( false, true );
471  else
472  SentStyle( true, false );
473 }
474 
475 
476 void a2dStyleDialog::OnColourBitmap( wxCommandEvent& event )
477 {
478  if ( m_cd->ShowModal() == wxID_OK )
479  {
480  *m_cdata = m_cd->GetColourData();
481  if ( event.GetId() == ID_STROKECOLOR )
482  m_colorStroke = m_cdata->GetColour();
483  else if ( event.GetId() == ID_FILLCOLOR )
484  *m_color = m_cdata->GetColour();
485  }
486 
487  m_needsUpdate = true;
488 
489  if ( m_color == &m_colorStroke )
490  SentStyle( false, true );
491  else
492  SentStyle( true, false );
493 }
494 
495 
496 void a2dStyleDialog::OnStippleBitmap( wxCommandEvent& WXUNUSED( event ) )
497 {
498  PatternDialog pattern( this, m_fillpatterns, _T( "Patterns" ), ( wxDEFAULT_DIALOG_STYLE ) );
499  int choosen = pattern.ShowModal();
500 
501  m_fillpatternmono = *m_fillpatterns->GetPattern( choosen );
502 
503  m_needsUpdate = true;
504  SentStyle( true, false );
505 }
506 
507 void a2dStyleDialog::OnStrokeStyle( wxCommandEvent& event )
508 {
509  a2dStrokeStyle strokestyle = a2dSTROKE_SOLID;
510 
511  switch( event.GetInt() )
512  {
513  case 0: strokestyle = a2dSTROKE_TRANSPARENT;
514  break;
515  case 1: strokestyle = a2dSTROKE_SOLID;
516  break;
517  case 2: strokestyle = a2dSTROKE_DOT;
518  break;
519  case 3: strokestyle = a2dSTROKE_LONG_DASH;
520  break;
521  case 4: strokestyle = a2dSTROKE_SHORT_DASH;
522  break;
523  case 5: strokestyle = a2dSTROKE_DOT_DASH;
524  break;
525  case 6: strokestyle = a2dSTROKE_USER_DASH;
526  break;
527  case 7: strokestyle = a2dSTROKE_BDIAGONAL_HATCH;
528  break;
529  case 8: strokestyle = a2dSTROKE_CROSSDIAG_HATCH;
530  break;
531  case 9: strokestyle = a2dSTROKE_FDIAGONAL_HATCH;
532  break;
533  case 10: strokestyle = a2dSTROKE_CROSS_HATCH;
534  break;
535  case 11: strokestyle = a2dSTROKE_HORIZONTAL_HATCH;
536  break;
537  case 12: strokestyle = a2dSTROKE_VERTICAL_HATCH;
538  break;
539  case 13: strokestyle = a2dSTROKE_STIPPLE ;
540  break;
541  case 14: strokestyle = a2dSTROKE_STIPPLE_MASK_OPAQUE;
542  break;
543  case 15: strokestyle = a2dSTROKE_STIPPLE_MASK_OPAQUE_TRANSPARENT;
544  break;
545  case 16: strokestyle = a2dSTROKE_OBJECTS;
546  break;
547  case 17: strokestyle = a2dSTROKE_INHERIT;
548  break;
549  case 18: strokestyle = a2dSTROKE_LAYER;
550  break;
551 
552  default: strokestyle = a2dSTROKE_SOLID;
553  }
554 
555  if ( strokestyle != m_stroke.GetStyle() )
556  {
557  if ( strokestyle == a2dSTROKE_LAYER )
558  {
559  m_stroke = *a2dNullSTROKE;
560  }
561  else if ( strokestyle == a2dSTROKE_INHERIT )
562  {
563  m_stroke = *a2dINHERIT_STROKE;
564  }
565  else if ( strokestyle == a2dSTROKE_STIPPLE_MASK_OPAQUE )
566  {
567  m_pattStroke.SetStyle( a2dSTROKE_STIPPLE_MASK_OPAQUE );
568  m_stroke = m_pattStroke;
569  }
570  else if ( strokestyle == a2dSTROKE_STIPPLE_MASK_OPAQUE_TRANSPARENT )
571  {
572  m_pattStroke.SetStyle( a2dSTROKE_STIPPLE_MASK_OPAQUE_TRANSPARENT );
573  m_stroke = m_pattStroke;
574  }
575  else if ( strokestyle == a2dSTROKE_STIPPLE )
576  {
577  m_pattStroke.SetStyle( a2dSTROKE_STIPPLE );
578  m_stroke = m_pattStroke;
579  }
580  else
581  m_stroke.SetStyle( strokestyle );
582  }
583 
584  m_needsUpdate = true;
585  SentStyle( false, true );
586 }
587 
588 void a2dStyleDialog::OnFillStyle( wxCommandEvent& event )
589 {
590 
591  a2dFillStyle fillstyle = a2dFILL_SOLID;
592  switch( event.GetInt() )
593  {
594  case 0: fillstyle = a2dFILL_TRANSPARENT;
595  break;
596  case 1: fillstyle = a2dFILL_SOLID;
597  break;
598  case 2: fillstyle = a2dFILL_BDIAGONAL_HATCH;
599  break;
600  case 3: fillstyle = a2dFILL_CROSSDIAG_HATCH;
601  break;
602  case 4: fillstyle = a2dFILL_FDIAGONAL_HATCH;
603  break;
604  case 5: fillstyle = a2dFILL_CROSS_HATCH;
605  break;
606  case 6: fillstyle = a2dFILL_HORIZONTAL_HATCH;
607  break;
608  case 7: fillstyle = a2dFILL_VERTICAL_HATCH;
609  break;
610  case 8: fillstyle = a2dFILL_TWOCOL_BDIAGONAL_HATCH;
611  break;
612  case 9: fillstyle = a2dFILL_TWOCOL_CROSSDIAG_HATCH;
613  break;
614  case 10: fillstyle = a2dFILL_TWOCOL_FDIAGONAL_HATCH;
615  break;
616  case 11: fillstyle = a2dFILL_TWOCOL_CROSS_HATCH;
617  break;
618  case 12: fillstyle = a2dFILL_TWOCOL_HORIZONTAL_HATCH;
619  break;
620  case 13: fillstyle = a2dFILL_TWOCOL_VERTICAL_HATCH;
621  break;
622  case 14: fillstyle = a2dFILL_STIPPLE;
623  break;
624  case 15: fillstyle = a2dFILL_STIPPLE_MASK_OPAQUE;
625  break;
626  case 16: fillstyle = a2dFILL_STIPPLE_MASK_OPAQUE_TRANSPARENT;
627  break;
628  case 17: fillstyle = a2dFILL_GRADIENT_FILL_XY_LINEAR;
629  break;
630  case 18: fillstyle = a2dFILL_GRADIENT_FILL_XY_RADIAL;
631  break;
632  case 19: fillstyle = a2dFILL_GRADIENT_FILL_XY_DROP;
633  break;
634  case 20: fillstyle = a2dFILL_INHERIT;
635  break;
636  case 21: fillstyle = a2dFILL_LAYER;
637  break;
638  default: fillstyle = a2dFILL_SOLID;
639  }
640 
641  //if the new style does not fit the current fill type,
642  //we release the current one, and replace it with the template fill that does
643  //fit the new fill style.
644  //Colours for the fill will be set from the old fill when possible.
645  if ( fillstyle != m_fill.GetStyle() )
646  {
647  if ( fillstyle == a2dFILL_LAYER )
648  {
649  m_fill = *a2dNullFILL;
650  }
651  else if ( fillstyle == a2dFILL_INHERIT )
652  {
653  m_fill = *a2dINHERIT_FILL;
654  }
655  else if ( fillstyle == a2dFILL_STIPPLE_MASK_OPAQUE )
656  {
657  m_PattFill.SetStyle( a2dFILL_STIPPLE_MASK_OPAQUE );
658  m_fill = m_PattFill;
659  }
660  else if ( fillstyle == a2dFILL_STIPPLE_MASK_OPAQUE_TRANSPARENT )
661  {
662  m_PattFill.SetStyle( a2dFILL_STIPPLE_MASK_OPAQUE_TRANSPARENT );
663  m_fill = m_PattFill;
664  }
665  else if ( fillstyle == a2dFILL_STIPPLE )
666  {
667  m_PattFill.SetStyle( a2dFILL_STIPPLE );
668  m_fill = m_PattFill;
669  }
670  else if ( fillstyle == a2dFILL_GRADIENT_FILL_XY_LINEAR )
671  {
672  m_fill = m_linGrad;
673  }
674  else if ( fillstyle == a2dFILL_GRADIENT_FILL_XY_RADIAL )
675  {
676  m_fill = m_radGrad;
677  }
678  else if ( fillstyle == a2dFILL_GRADIENT_FILL_XY_DROP )
679  {
680  m_fill = m_dropGrad;
681  }
682  else if ( fillstyle >= a2dFIRST_TWOCOL_HATCH && fillstyle <= a2dLAST_TWOCOL_HATCH )
683  {
684  m_hatchTwoColFill.SetStyle( fillstyle );
685  m_fill = m_hatchTwoColFill;
686  }
687  else if ( fillstyle >= a2dFIRST_HATCH && fillstyle <= a2dLAST_HATCH )
688  {
689  m_oneColFill.SetStyle( fillstyle );
690  m_fill = m_oneColFill;
691  }
692  else
693  {
694  m_oneColFill.SetStyle( fillstyle );
695  m_fill = m_oneColFill;
696  }
697  }
698 
699  m_needsUpdate = true;
700  SentStyle( true, false );
701 }
702 
703 
704 void a2dStyleDialog::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
705 {
706  if ( m_modal )
707  EndModal( wxID_OK );
708  else
709  {
710  SetReturnCode( wxID_OK );
711  Show( false );
712  }
713 }
714 
715 void a2dStyleDialog::OnIdle( wxIdleEvent& WXUNUSED( idleEvent ) )
716 {
717  if ( m_needsUpdate )
718  {
719  m_needsUpdate = false;
720 
721  unsigned char m_colorR = m_color->Red();
722  unsigned char m_colorG = m_color->Green();
723  unsigned char m_colorB = m_color->Blue();
724 
725  m_sliderred->SetValue( m_colorR );
726  m_slidergreen->SetValue( m_colorG );
727  m_sliderblue->SetValue( m_colorB );
728 
729  //this SetValue generates an event which leads to extra SentStyle calls, not wanted
730  //solved by setting skip flag.
731  m_skipspinevent = true;
732  m_spinred->SetValue( m_colorR );
733  m_skipspinevent = true;
734  m_spingreen->SetValue( m_colorG );
735  m_skipspinevent = true;
736  m_spinblue->SetValue( m_colorB );
737 
738  m_pixelwidth->SetValue( ( int ) m_stroke.GetWidth() );
739  m_pixelstroke->SetValue( m_stroke.GetPixelStroke() );
740 
741  //adjust all colors for all possible styles to the current situation
742  m_oneColFill.SetColour( m_colorFill1 );
743  m_PattFill.SetColour( m_colorFill1 );
744  m_PattFill.SetColour2( m_colorFill2 );
745  m_linGrad.SetColour( m_colorFill1 );
746  m_linGrad.SetColour2( m_colorFill2 );
747  m_radGrad.SetColour( m_colorFill1 );
748  m_radGrad.SetColour2( m_colorFill2 );
749  m_dropGrad.SetColour( m_colorFill1 );
750  m_dropGrad.SetColour2( m_colorFill2 );
751  m_oneColStroke.SetColour( m_colorStroke );
752  m_pattStroke.SetColour( m_colorStroke );
753  m_hatchTwoColFill.SetColour( m_colorFill1 );
754  m_hatchTwoColFill.SetColour2( m_colorFill2 );
755 
756  m_fillstipple->Enable( false );
757  int style;
758  int curstyle = m_fill.GetStyle();
759  switch( curstyle )
760  {
761  case a2dFILL_TRANSPARENT: style = 0;
762  break;
763  case a2dFILL_SOLID: style = 1;
764  break;
765  case a2dFILL_BDIAGONAL_HATCH: style = 2;
766  break;
767  case a2dFILL_CROSSDIAG_HATCH: style = 3;
768  break;
769  case a2dFILL_FDIAGONAL_HATCH: style = 4;
770  break;
771  case a2dFILL_CROSS_HATCH: style = 5;
772  break;
773  case a2dFILL_HORIZONTAL_HATCH: style = 6;
774  break;
775  case a2dFILL_VERTICAL_HATCH: style = 7;
776  break;
777  case a2dFILL_TWOCOL_BDIAGONAL_HATCH: style = 8;
778  break;
779  case a2dFILL_TWOCOL_CROSSDIAG_HATCH: style = 9;
780  break;
781  case a2dFILL_TWOCOL_FDIAGONAL_HATCH: style = 10;
782  break;
783  case a2dFILL_TWOCOL_CROSS_HATCH: style = 11;
784  break;
785  case a2dFILL_TWOCOL_HORIZONTAL_HATCH: style = 12;
786  break;
787  case a2dFILL_TWOCOL_VERTICAL_HATCH: style = 13;
788  break;
789  case a2dFILL_STIPPLE: style = 14;
790  m_fillstipple->Enable( true );
791  break;
792  case a2dFILL_STIPPLE_MASK_OPAQUE: style = 15;
793  m_fillstipple->Enable( true );
794  break;
796  m_fillstipple->Enable( true );
797  break;
798  case a2dFILL_GRADIENT_FILL_XY_LINEAR: style = 17;
799  break;
800  case a2dFILL_GRADIENT_FILL_XY_RADIAL: style = 18;
801  break;
802  case a2dFILL_GRADIENT_FILL_XY_DROP: style = 19;
803  break;
804  case a2dFILL_INHERIT: style = 20;
805  break;
806  case a2dFILL_LAYER: style = 21;
807  break;
808  default: style = 0;
809  }
810  m_fillstyles->SetSelection( style );
811 
812  int strokestyle = 0;
813  switch( m_stroke.GetStyle() )
814  {
815  case a2dSTROKE_TRANSPARENT: strokestyle = 0;
816  break;
817  case a2dSTROKE_SOLID: strokestyle = 1;
818  break;
819  case a2dSTROKE_DOT: strokestyle = 2;
820  break;
821  case a2dSTROKE_LONG_DASH: strokestyle = 3;
822  break;
823  case a2dSTROKE_SHORT_DASH: strokestyle = 4;
824  break;
825  case a2dSTROKE_DOT_DASH: strokestyle = 5;
826  break;
827  case a2dSTROKE_USER_DASH: strokestyle = 6;
828  break;
829  case a2dSTROKE_BDIAGONAL_HATCH: strokestyle = 7;
830  break;
831  case a2dSTROKE_CROSSDIAG_HATCH: strokestyle = 8;
832  break;
833  case a2dSTROKE_FDIAGONAL_HATCH: strokestyle = 9;
834  break;
835  case a2dSTROKE_CROSS_HATCH: strokestyle = 10;
836  break;
837  case a2dSTROKE_HORIZONTAL_HATCH: strokestyle = 11;
838  break;
839  case a2dSTROKE_VERTICAL_HATCH: strokestyle = 12;
840  break;
841  case a2dSTROKE_STIPPLE: strokestyle = 13;
842  break;
843  case a2dSTROKE_STIPPLE_MASK_OPAQUE: strokestyle = 14;
844  break;
845  case a2dSTROKE_STIPPLE_MASK_OPAQUE_TRANSPARENT: strokestyle = 15;
846  break;
847  case a2dSTROKE_OBJECTS: style = 16;
848  break;
849  case a2dSTROKE_INHERIT: style = 17;
850  break;
851  case a2dSTROKE_LAYER: style = 18;
852  break;
853  default: strokestyle = 0;
854  }
855 
856  m_strokestyles->SetSelection( strokestyle );
857 
858  // fill the bitmap button again.
859  wxMemoryDC dcmemtemp;
860  dcmemtemp.SelectObject( m_fillstippleb );
861  wxBrush brush;
862  brush.SetColour( *wxBLACK );
863  dcmemtemp.SetBackground( brush );
864  dcmemtemp.Clear();
865  dcmemtemp.SetPen( *wxTRANSPARENT_PEN );
866 
867  dcmemtemp.SetTextBackground( m_PattFill.GetColour2() );
868  dcmemtemp.SetTextForeground( m_PattFill.GetColour() );
869  wxBrush brushbitm( m_fillpatternmono );
870  dcmemtemp.SetBrush( brushbitm );
871 
872  dcmemtemp.DrawRectangle( 0, 0, 32, 32 );
873  dcmemtemp.SelectObject( wxNullBitmap );
874  m_fillstipple->SetBitmapLabel( m_fillstippleb );
875  m_fillstipple->Refresh( true );
876 
877  /*
878  dcmemtemp.SelectObject( m_fillstippleb );
879  dcmemtemp.SetTextBackground( *wxBLACK );
880  dcmemtemp.SetTextForeground( m_colorFill1 );
881  dcmemtemp.DrawBitmap( m_fillpatternmono, 1, 1 );
882  dcmemtemp.SelectObject(wxNullBitmap);
883  */
884  if ( m_fill.GetStyle() == a2dFILL_STIPPLE_MASK_OPAQUE )
885  {
886  m_PattFill.SetStipple( m_fillpatternmono );
887  m_PattFill.SetStyle( a2dFILL_STIPPLE_MASK_OPAQUE );
888  m_fill = m_PattFill;
889  }
890  else if ( m_fill.GetStyle() == a2dFILL_STIPPLE_MASK_OPAQUE_TRANSPARENT )
891  {
892  m_PattFill.SetStipple( m_fillpatternmono );
893  m_PattFill.SetStyle( a2dFILL_STIPPLE_MASK_OPAQUE_TRANSPARENT );
894  m_fill = m_PattFill;
895  }
896  else if ( m_fill.GetStyle() == a2dFILL_STIPPLE )
897  {
898  //if ( m_fillpatternmono.GetDepth() == 1)
899  {
900  wxBitmap fillpattern = wxBitmap( 32, 32, -1 );
901  // adjust the colors of the filling bitmap to the colours of the pattern fill.
902  wxMemoryDC dcmemtemp2;
903  dcmemtemp2.SelectObject( fillpattern );
904 
905  wxBrush brush;
906  brush.SetColour( *wxBLACK );
907  dcmemtemp2.SetBackground( brush );
908  dcmemtemp2.Clear();
909  dcmemtemp2.SetPen( *wxTRANSPARENT_PEN );
910 
911  dcmemtemp2.SetTextBackground( m_PattFill.GetColour2() );
912  dcmemtemp2.SetTextForeground( m_PattFill.GetColour() );
913  wxBrush brushbitm( m_fillpatternmono );
914  dcmemtemp2.SetBrush( brushbitm );
915 
916  dcmemtemp2.DrawRectangle( 0, 0, 32, 32 );
917  dcmemtemp2.SelectObject( wxNullBitmap );
918  m_PattFill.SetStipple( fillpattern );
919  }
920  //else
921  // m_PattFill->SetStipple( m_fillpatternmono );
922  m_PattFill.SetStyle( a2dFILL_STIPPLE );
923  m_fill = m_PattFill;
924  }
925  else if ( m_fill.GetType() == a2dFILL_HATCH_TWO_COLOUR )
926  {
927  m_fill = m_hatchTwoColFill;
928  }
929  else if ( m_fill.GetType() == a2dFILL_GRADIENT_FILL_LINEAR )
930  {
931  m_fill = m_linGrad;
932  }
933  else if ( m_fill.GetType() == a2dFILL_GRADIENT_FILL_RADIAL )
934  {
935  m_fill = m_radGrad;
936  }
937  else if ( m_fill.GetType() == a2dFILL_GRADIENT_FILL_RADIAL )
938  {
939  m_fill = m_radGrad;
940  }
941  {
942  //update the bitmap to show fill and stroke properties
943  int w = m_colourfillshow->GetBitmapLabel().GetWidth();
944  int h = m_colourfillshow->GetBitmapLabel().GetHeight();
945  a2dMemDcDrawer* drawer = new a2dMemDcDrawer( w, h );
946  drawer->BeginDraw();
947  drawer->SetDrawerFill( m_fill );
948  drawer->DrawRoundedRectangle( 0, 0, w, h, 0 );
949  drawer->EndDraw();
950  m_colourfillshow->SetBitmapLabel( drawer->GetBuffer() );
951  m_colourfillshow->Refresh( true );
952  delete drawer;
953 
954  }
955 
956  int w = m_colourstrokeshow->GetBitmapLabel().GetWidth();
957  int h = m_colourstrokeshow->GetBitmapLabel().GetHeight();
958  a2dMemDcDrawer* drawer2 = new a2dMemDcDrawer( w, h );
959  drawer2->BeginDraw();
960  a2dStroke f = a2dStroke( m_colorStroke, ( int ) w, m_stroke.GetStyle() );
961  drawer2->SetDrawerStroke( f );
962  drawer2->DrawLine( w / 2, 0, w / 2, h );
963  drawer2->EndDraw();
964  m_colourstrokeshow->SetBitmapLabel( drawer2->GetBuffer() );
965  m_colourstrokeshow->Refresh( true );
966  delete drawer2;
967  }
968 
969  if ( m_fillCommand )
970  {
971  m_fillCommand = false;
972  m_habitat->SetFill( m_fill );
973  }
974  if ( m_strokeCommand )
975  {
976  m_strokeCommand = false;
977  m_habitat->SetStroke( m_stroke );
978  }
979 }
980 
981 void a2dStyleDialog::SentStyle( bool fill, bool stroke )
982 {
983  m_fill.SetColour( m_colorFill1 );
984  m_fill.SetColour2( m_colorFill2 );
985  m_stroke.SetColour( m_colorStroke );
986 
987  if ( !m_doSentCommand )
988  return;
989 
990  if ( !m_setCentralStyle )
991  return;
992 
993  m_fillCommand = fill;
994  m_strokeCommand = stroke;
995 }
996 
997 void a2dStyleDialog::OnComEvent( a2dComEvent& event )
998 {
999  a2dSignal comId = event.GetId();
1000 
1001  m_doSentCommand = false;
1002 
1003  if ( event.GetId() == a2dRecursiveEditTool::sig_toolStartEditObject )
1004  {
1005  a2dObjectEditTool* tool = wxDynamicCast( event.GetEventObject(), a2dObjectEditTool );
1006  if ( tool && tool->GetActive() && tool->GetDrawingPart() )
1007  {
1008  SetFill( tool->GetOriginal()->GetFill() );
1009  SetStroke( tool->GetOriginal()->GetStroke() );
1010  }
1011  }
1012  if ( event.GetId() == a2dComEvent::sm_changedProperty )
1013  {
1014  a2dNamedProperty* property = event.GetProperty();
1015  a2dObject* object = property->GetRefObjectNA();
1016 
1017  if ( 0 != wxDynamicCast( property, a2dStrokeProperty ) )
1018  {
1019  a2dStroke stroke = ( ( a2dStrokeProperty* )property )->GetValue();
1020  SetStroke( stroke );
1021  }
1022  else if ( 0 != wxDynamicCast( property, a2dFillProperty ) )
1023  {
1024  a2dFill fill = ( ( a2dFillProperty* )property )->GetValue();
1025  SetFill( fill );
1026  }
1027  else
1028  event.Skip();
1029  }
1030 
1031 
1032  if ( comId == a2dHabitat::sig_changedFill ||
1033  comId == a2dHabitat::sig_changedStroke ||
1034  comId == a2dHabitat::sig_changedLayer
1035  )
1036  {
1037  a2dFill f = m_habitat->GetFill();
1038  if ( ! GetFill().IsSameAs( f ) )
1039  SetFill( f );
1040  a2dStroke s = m_habitat->GetStroke();
1041  if ( ! GetStroke().IsSameAs( s ) )
1042  SetStroke( s );
1043  }
1044 
1045  if ( event.GetId() == a2dCanvasGlobal::sig_changedActiveDrawing )
1046  {
1048  if ( part && part->GetDrawing() )
1049  {
1050  part->GetDrawing()->DisconnectEvent( a2dEVT_COM_EVENT, this );
1051  part->GetDrawing()->ConnectEvent( a2dEVT_COM_EVENT, this );
1052  }
1053  }
1054 
1055  m_doSentCommand = true;
1056 }
1057 
1058 void a2dStyleDialog::OnUndoEvent( a2dCommandProcessorEvent& WXUNUSED( event ) )
1059 {
1060 }
1061 
1062 void a2dStyleDialog::OnDoEvent( a2dCommandProcessorEvent& WXUNUSED( event ) )
1063 {
1064 }
1065 
1066 // Size the subwindows when the frame is resized
1067 void a2dStyleDialog::OnSize( wxSizeEvent& WXUNUSED( event ) )
1068 {
1069  Layout();
1070 }
1071 
1072 void a2dStyleDialog::CmOk( wxCommandEvent& WXUNUSED( event ) )
1073 {
1074  if ( m_modal )
1075  EndModal( wxID_OK );
1076  else
1077  {
1078  SetReturnCode( wxID_OK );
1079  Show( false );
1080  }
1081 }
1082 
1083 void a2dStyleDialog::SetFill( const a2dFill& fill )
1084 {
1085  m_fill = fill;
1086  m_colorFill1 = m_fill.GetColour();
1087  m_colorFill2 = m_fill.GetColour2();
1088 
1089  m_needsUpdate = true;
1090 }
1091 
1092 void a2dStyleDialog::SetStroke( const a2dStroke& stroke )
1093 {
1094  m_stroke = stroke;
1095  m_colorStroke = m_stroke.GetColour();
1096 
1097  m_needsUpdate = true;
1098 }
1099 
1100 
1101 
1102 
1103 //===========================================================================
1104 // a2dCustomColors
1105 //===========================================================================
1106 
1107 a2dCustomColors::a2dCustomColors()
1108 {
1109  Init();
1110 }
1111 
1112 void a2dCustomColors::Init()
1113 {
1114  for(int i=0; i < wxColourData::NUM_CUSTOM; i++)
1115  {
1116  m_Color[i] = *wxWHITE;
1117  }
1118 }
1119 
1120 void a2dCustomColors::Set(const wxColourData &colData)
1121 {
1122  for(int i=0; i < wxColourData::NUM_CUSTOM; i++)
1123  {
1124  m_Color[i] = colData.GetCustomColour(i);
1125  }
1126 }
1127 
1128 void a2dCustomColors::Get(wxColourData *pColData) const
1129 {
1130  for(int i=0; i < wxColourData::NUM_CUSTOM; i++)
1131  {
1132  pColData->SetCustomColour(i, m_Color[i]);
1133  }
1134 }
1135 
1136 void a2dCustomColors::Set(int i, const wxColour &color)
1137 {
1138  wxASSERT(i < wxColourData::NUM_CUSTOM);
1139  m_Color[i] = color;
1140 }
1141 
1142 wxColour a2dCustomColors::Get(int i) const
1143 {
1144  wxASSERT(i < wxColourData::NUM_CUSTOM);
1145  return m_Color[i];
1146 }
1147 
1148 bool a2dCustomColors::operator==(const a2dCustomColors& rhs)
1149 {
1150  for(int i=0; i < wxColourData::NUM_CUSTOM; i++)
1151  {
1152  if(m_Color[i] != rhs.m_Color[i]) return false;
1153  }
1154  return true;
1155 }
1156 
1157 bool a2dCustomColors::operator!=(const a2dCustomColors& rhs)
1158 {
1159  return !(*this==rhs);
1160 }
1161 
1162 
1163 // XPM images:
1164 //------------
1165 #include "../../art/resources/JoinMiter.xpm" // JoinMiter_xpm
1166 #include "../../art/resources/JoinBevel.xpm" // JoinBevel_xpm
1167 #include "../../art/resources/JoinRound.xpm" // JoinRound_xpm
1168 #include "../../art/resources/JoinMiterPressed.xpm" // JoinMiterPressed_xpm
1169 #include "../../art/resources/JoinBevelPressed.xpm" // JoinBevelPressed_xpm
1170 #include "../../art/resources/JoinRoundPressed.xpm" // JoinRoundPressed_xpm
1171 #include "../../art/resources/JoinMiterDisabled.xpm" // JoinMiterDisabled_xpm
1172 #include "../../art/resources/JoinBevelDisabled.xpm" // JoinBevelDisabled_xpm
1173 #include "../../art/resources/JoinRoundDisabled.xpm" // JoinRoundDisabled_xpm
1174 #include "../../art/resources/CapButt.xpm" // CapButt_xpm
1175 #include "../../art/resources/CapProjecting.xpm" // CapProjecting_xpm
1176 #include "../../art/resources/CapRound.xpm" // CapRound_xpm
1177 #include "../../art/resources/CapButtPressed.xpm" // CapButtPressed_xpm
1178 #include "../../art/resources/CapProjectingPressed.xpm" // CapProjectingPressed_xpm
1179 #include "../../art/resources/CapRoundPressed.xpm" // CapRoundPressed_xpm
1180 #include "../../art/resources/CapButtDisabled.xpm" // CapButtDisabled_xpm
1181 #include "../../art/resources/CapProjectingDisabled.xpm" // CapProjectingDisabled_xpm
1182 #include "../../art/resources/CapRoundDisabled.xpm" // CapRoundDisabled_xpm
1183 
1184 
1185 //===========================================================================
1186 // ColorComboBox
1187 //===========================================================================
1188 const wxArrayString a2dColorComboBox::TChoices(bool bAllowTransparent)
1189 {
1190  if(bAllowTransparent)
1191 {
1192  const int TNumChoices = 2;
1193  const wxString TChoices[TNumChoices] = { _("Transparent"), _("Select Color...") }; //<de>_("Transparent"), _("Farbe wählen...")
1194  return wxArrayString(TNumChoices, TChoices);
1195 }
1196  else
1197  {
1198  const int TNumChoices = 1;
1199  const wxString TChoices[TNumChoices] = { _("Select Color...") }; //<de>_("Farbe wählen...")
1200  return wxArrayString(TNumChoices, TChoices);
1201  }
1202 }
1203 
1204 //--------------------------------------------------------
1205 // Event Table:
1206 //--------------------------------------------------------
1207 BEGIN_EVENT_TABLE( a2dColorComboBox, wxOwnerDrawnComboBox )
1208  EVT_COMBOBOX(wxID_ANY, a2dColorComboBox::OnSelected )
1209 END_EVENT_TABLE()
1210 //--------------------------------------------------------
1211 
1212 a2dColorComboBox::a2dColorComboBox(wxWindow *parent, wxWindowID id, bool bAllowTransparent, a2dCustomColors *pCustCol, const wxSize &size)
1213  : wxOwnerDrawnComboBox(parent, id, wxEmptyString, wxDefaultPosition, size, TChoices(bAllowTransparent), wxCB_READONLY), m_bAllowTransparent(bAllowTransparent), m_pCustomColors(pCustCol), m_Color(*wxBLACK)
1214 {
1215  SetSelection(-1);
1216 }
1217 
1218 void a2dColorComboBox::SetColor(const wxColour &color)
1219 {
1220  m_Color = color;
1221  if(m_bAllowTransparent)
1222  SetSelection((m_Color == wxTransparentColour) ? 0 : 1);
1223  else
1224  SetSelection((m_Color == wxTransparentColour) ? -1 : 0);
1225 }
1226 
1227 void a2dColorComboBox::OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const
1228 {
1229  if( !(flags & wxODCB_PAINTING_CONTROL) )
1230  {
1231  dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1232  }
1233  else
1234  {
1235  if ( m_Color == wxTransparentColour )
1236  dc.DrawLabel(GetString(0), rect, wxALIGN_CENTER);
1237  else
1238  {
1239  dc.SetPen(*wxBLACK_PEN);
1240  dc.SetBrush(wxBrush(m_Color));
1241  dc.DrawRectangle(rect.x+3, rect.y+3, rect.width-6, rect.height-6);
1242  }
1243  }
1244 }
1245 
1246 wxCoord a2dColorComboBox::OnMeasureItem(size_t item) const
1247 {
1248  return wxOwnerDrawnComboBox::GetClientSize().GetHeight();
1249 }
1250 
1251 void a2dColorComboBox::OnSelected(wxCommandEvent& event)
1252 {
1253  switch(event.GetSelection())
1254  {
1255  case 0: if(m_bAllowTransparent) m_Color = wxTransparentColour;
1256  else SelectColor();
1257  break;
1258 
1259  case 1: SelectColor();
1260  break;
1261  }
1262 
1263  event.Skip();
1264 }
1265 
1266 void a2dColorComboBox::SelectColor()
1267 {
1268  wxColourData cData;
1269  cData.SetChooseFull(true);
1270  if(m_pCustomColors) m_pCustomColors->Get(&cData); // set custom colors to dialog
1271  cData.SetColour(m_Color); // set selected color to dialog
1272  wxColourDialog cDlg(this, &cData);
1273  cDlg.Center();
1274  if(cDlg.ShowModal() == wxID_OK)
1275  {
1276  cData = cDlg.GetColourData();
1277  if(m_pCustomColors) m_pCustomColors->Set(cData); // get custom colors from dialog
1278  m_Color = cData.GetColour(); // get selected color from dialog
1279  }
1280 }
1281 
1282 
1283 //===========================================================================
1284 // a2dStrokeStyleComboBox
1285 //===========================================================================
1286 const wxArrayString a2dStrokeStyleComboBox::TChoices(bool bAllowLayerStyle)
1287 {
1288  const int TNumChoices = 5;
1289  const wxString TChoices[TNumChoices] = { wxT("Solid"), wxT("Dot"), wxT("Long Dash"), wxT("Dot Dash"), _("No Line") }; //<de>_("keine Linie")
1290  wxArrayString choices(TNumChoices, TChoices);
1291 
1292  if(bAllowLayerStyle) choices.Add(_("Layer")); //<de>_("Layer")
1293 
1294  return choices;
1295 }
1296 
1297 //--------------------------------------------------------
1298 // Event Table:
1299 //--------------------------------------------------------
1300 BEGIN_EVENT_TABLE( a2dStrokeStyleComboBox, wxOwnerDrawnComboBox )
1301  EVT_COMBOBOX(wxID_ANY, a2dStrokeStyleComboBox::OnSelected)
1302 END_EVENT_TABLE()
1303 //--------------------------------------------------------
1304 
1305 a2dStrokeStyleComboBox::a2dStrokeStyleComboBox(wxWindow *parent, wxWindowID id, bool bAllowLayerStyle, const wxSize &size)
1306  : wxOwnerDrawnComboBox(parent, id, wxEmptyString, wxDefaultPosition, size, TChoices(bAllowLayerStyle), wxCB_READONLY),
1307  m_bAllowLayerStyle(bAllowLayerStyle), m_Style(a2dSTROKE_SOLID)
1308 {
1309  SetSelection(-1);
1310 }
1311 
1312 void a2dStrokeStyleComboBox::SetStyle(const a2dStrokeStyle &style)
1313 {
1314  m_Style = style;
1315  int iSel = -1;
1316  switch(m_Style)
1317  {
1318  case a2dSTROKE_SOLID: iSel = 0;
1319  break;
1320  case a2dSTROKE_DOT: iSel = 1;
1321  break;
1322  case a2dSTROKE_LONG_DASH: iSel = 2;
1323  break;
1324  case a2dSTROKE_DOT_DASH: iSel = 3;
1325  break;
1326  case a2dSTROKE_TRANSPARENT: iSel = 4;
1327  break;
1328  case a2dSTROKE_LAYER:
1329  case a2dSTROKE_NULLSTROKE: if(m_bAllowLayerStyle) iSel = 5;
1330  break;
1331  }
1332  SetSelection(iSel);
1333 }
1334 
1335 void a2dStrokeStyleComboBox::OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const
1336 {
1337  wxPenStyle penStyle = wxPENSTYLE_INVALID;
1338  switch(item)
1339  {
1340  case 0: penStyle = wxPENSTYLE_SOLID;
1341  break;
1342  case 1: penStyle = wxPENSTYLE_DOT;
1343  break;
1344  case 2: penStyle = wxPENSTYLE_LONG_DASH;
1345  break;
1346  case 3: penStyle = wxPENSTYLE_DOT_DASH;
1347  break;
1348  case 4: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1349  return;
1350  case 5: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1351  return;
1352  }
1353  wxPen pen(dc.GetTextForeground(), 3, penStyle);
1354  pen.SetCap(wxCAP_BUTT);
1355  dc.SetPen(pen);
1356  dc.DrawLine(rect.x+5, rect.y+rect.height/2, rect.x+rect.width-5, rect.y+rect.height/2);
1357 }
1358 
1359 wxCoord a2dStrokeStyleComboBox::OnMeasureItem(size_t item) const
1360 {
1361  return wxOwnerDrawnComboBox::GetClientSize().GetHeight();
1362 }
1363 
1364 void a2dStrokeStyleComboBox::OnSelected(wxCommandEvent& event)
1365 {
1366  switch(event.GetSelection())
1367  {
1368  case 0: m_Style = a2dSTROKE_SOLID;
1369  break;
1370  case 1: m_Style = a2dSTROKE_DOT;
1371  break;
1372  case 2: m_Style = a2dSTROKE_LONG_DASH;
1373  break;
1374  case 3: m_Style = a2dSTROKE_DOT_DASH;
1375  break;
1376  case 4: m_Style = a2dSTROKE_TRANSPARENT;
1377  break;
1378  case 5: m_Style = a2dSTROKE_LAYER;
1379  break;
1380  }
1381 
1382  event.Skip();
1383 }
1384 
1385 
1386 //===========================================================================
1387 // a2dFillComboBox
1388 //===========================================================================
1389 const wxArrayString a2dFillComboBox::TChoices(bool bAllowLayerStyle)
1390 {
1391  const int TNumChoices = 2;
1392  const wxString TChoices[TNumChoices] = { _("Transparent"), _("Select Color...") }; //<de>_("Transparent"), _("Farbe wählen...")
1393  wxArrayString choices(TNumChoices, TChoices);
1394 
1395  if(bAllowLayerStyle) choices.Add(_("Layer")); //<de>_("Layer")
1396 
1397  return choices;
1398 }
1399 
1400 //--------------------------------------------------------
1401 // Event Table:
1402 //--------------------------------------------------------
1403 BEGIN_EVENT_TABLE( a2dFillComboBox, wxOwnerDrawnComboBox )
1404  EVT_COMBOBOX(wxID_ANY, a2dFillComboBox::OnSelected)
1405 END_EVENT_TABLE()
1406 //--------------------------------------------------------
1407 
1408 a2dFillComboBox::a2dFillComboBox(wxWindow *parent, wxWindowID id, bool bAllowLayerStyle, a2dCustomColors *pCustCol, const wxSize &size)
1409  : wxOwnerDrawnComboBox(parent, id, wxEmptyString, wxDefaultPosition, size, TChoices(bAllowLayerStyle), wxCB_READONLY),
1410  m_bAllowLayerStyle(bAllowLayerStyle), m_pCustomColors(pCustCol), m_Fill()
1411 {
1412  SetSelection(-1);
1413 }
1414 
1415 void a2dFillComboBox::SetFill(const a2dFill &fill)
1416 {
1417  m_Fill = fill;
1418  int iSel = -1;
1419  switch(m_Fill.GetStyle())
1420  {
1421  case a2dFILL_TRANSPARENT: iSel = 0;
1422  break;
1423  case a2dFILL_SOLID: iSel = 1;
1424  break;
1425  case a2dFILL_LAYER:
1426  case a2dFILL_NULLFILL: if(m_bAllowLayerStyle) iSel = 2;
1427  break;
1428  }
1429  SetSelection(iSel);
1430 }
1431 
1432 void a2dFillComboBox::OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const
1433 {
1434  if( !(flags & wxODCB_PAINTING_CONTROL) )
1435  {
1436  dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1437  }
1438  else
1439  {
1440  switch(item)
1441  {
1442  case 0: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1443  break;
1444 
1445  case 1: dc.SetPen(*wxBLACK_PEN);
1446  dc.SetBrush(wxBrush(m_Fill.GetColour()));
1447  dc.DrawRectangle(rect.x+3, rect.y+3, rect.width-6, rect.height-6);
1448  break;
1449 
1450  case 2: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1451  break;
1452  }
1453  }
1454 }
1455 
1456 wxCoord a2dFillComboBox::OnMeasureItem(size_t item) const
1457 {
1458  return wxOwnerDrawnComboBox::GetClientSize().GetHeight();
1459 }
1460 
1461 void a2dFillComboBox::OnSelected(wxCommandEvent& event)
1462 {
1463  switch(event.GetSelection())
1464  {
1465  case 0: m_Fill = *a2dTRANSPARENT_FILL;
1466  break;
1467 
1468  case 1: SelectColor();
1469  break;
1470 
1471  case 2: m_Fill = *a2dNullFILL;
1472  break;
1473  }
1474 
1475  event.Skip();
1476 }
1477 
1478 void a2dFillComboBox::SelectColor()
1479 {
1480  wxColourData cData;
1481  cData.SetChooseFull(true);
1482  if(m_pCustomColors) m_pCustomColors->Get(&cData); // set custom colors to dialog
1483  cData.SetColour(m_Fill.GetColour()); // set selected color to dialog
1484  wxColourDialog cDlg(this, &cData);
1485  cDlg.Center();
1486  if(cDlg.ShowModal() == wxID_OK)
1487  {
1488  cData = cDlg.GetColourData();
1489  if(m_pCustomColors) m_pCustomColors->Set(cData); // get custom colors from dialog
1490  m_Fill.SetStyle(a2dFILL_SOLID);
1491  m_Fill.SetColour(cData.GetColour()); // get selected color from dialog
1492  }
1493 }
1494 
1495 
1496 //===========================================================================
1497 // a2dDialogStyle
1498 //===========================================================================
1499 
1500 enum
1501 {
1502  ID_STROKESTYLE_BOX = wxID_HIGHEST + 1,
1503  ID_JOINMITER_BT,
1504  ID_JOINBEVEL_BT,
1505  ID_JOINROUND_BT,
1506  ID_STROKECOLOR_BOX,
1507  ID_CAPBUTT_BT,
1508  ID_CAPPROJECTING_BT,
1509  ID_CAPROUND_BT,
1510  ID_STROKEWIDTH_CTRL,
1511  ID_FILL_BOX,
1512 };
1513 
1514 //--------------------------------------------------------
1515 // Event Table:
1516 //--------------------------------------------------------
1517 BEGIN_EVENT_TABLE( a2dDialogStyle, wxDialog )
1518  EVT_INIT_DIALOG(a2dDialogStyle::OnInitDialog)
1519  EVT_COMBOBOX(ID_STROKESTYLE_BOX, a2dDialogStyle::OnStrokeStyle)
1520  EVT_TOGGLEBUTTON(ID_JOINMITER_BT, a2dDialogStyle::OnJoin)
1521  EVT_TOGGLEBUTTON(ID_JOINBEVEL_BT, a2dDialogStyle::OnJoin)
1522  EVT_TOGGLEBUTTON(ID_JOINROUND_BT, a2dDialogStyle::OnJoin)
1523  EVT_TOGGLEBUTTON(ID_CAPBUTT_BT, a2dDialogStyle::OnCap)
1524  EVT_TOGGLEBUTTON(ID_CAPPROJECTING_BT, a2dDialogStyle::OnCap)
1525  EVT_TOGGLEBUTTON(ID_CAPROUND_BT, a2dDialogStyle::OnCap)
1526  EVT_BUTTON(wxID_OK, a2dDialogStyle::OnOk)
1527 END_EVENT_TABLE()
1528 //--------------------------------------------------------
1529 
1530 a2dDialogStyle::a2dDialogStyle(wxWindow *parent, bool bGlobal, bool bFill, bool bAllowLayerStyle)
1531  : m_bFill(bFill), m_UnitsScale(1), m_CustomColors(), m_ExtStroke(), m_ExtFill()
1532 {
1533  wxString DlgTitel = (bGlobal) ? _("Global Line and Filling") : _("Line and Filling"); //<de>_("Globale Linie und Füllung") : _("Linie und Füllung");
1534  wxDialog::Create(parent, wxID_ANY, DlgTitel, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
1535  CreateControls(bAllowLayerStyle);
1536  if(GetSizer()) GetSizer()->SetSizeHints(this);
1537  Centre();
1538 }
1539 
1540 void a2dDialogStyle::CreateControls(bool bAllowLayerStyle)
1541 {
1542  wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL);
1543  this->SetSizer(pTopSizer);
1544 
1545  //----------------------------
1546  // line:
1547  //----------------------------
1548  wxStaticBox* pStaticBoxLine = new wxStaticBox(this, wxID_ANY, _("Line")); //<de>_("Linie"));
1549  wxStaticBoxSizer* pStaticBoxSizerLine = new wxStaticBoxSizer(pStaticBoxLine, wxVERTICAL);
1550  pTopSizer->Add(pStaticBoxSizerLine, 0, wxGROW|wxALL, 5);
1551 
1552  wxGridBagSizer* pGridBagSizerLine = new wxGridBagSizer(0, 0);
1553  pGridBagSizerLine->SetEmptyCellSize(wxSize(10, 10));
1554  pStaticBoxSizerLine->Add(pGridBagSizerLine, 0, wxALIGN_LEFT|wxALL, 5);
1555 
1556  wxStaticText* pStrokeStyleTxt = new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _("Style:"), wxDefaultPosition, wxDefaultSize, 0); //<de>_("Art:")
1557  pGridBagSizerLine->Add(pStrokeStyleTxt, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1558 
1559  m_pSrokeStyleBox = new a2dStrokeStyleComboBox(pStaticBoxSizerLine->GetStaticBox(), ID_STROKESTYLE_BOX, bAllowLayerStyle);
1560  pGridBagSizerLine->Add(m_pSrokeStyleBox, wxGBPosition(0, 1), wxGBSpan(1, 1), wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1561 
1562  wxStaticText* pStrokeJoinTxt = new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _("Corners:"), wxDefaultPosition, wxDefaultSize, 0); //<de>_("Ecken:")
1563  pGridBagSizerLine->Add(pStrokeJoinTxt, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1564 
1565  wxBoxSizer* pStrokeJoinSizer = new wxBoxSizer(wxHORIZONTAL);
1566  pGridBagSizerLine->Add(pStrokeJoinSizer, wxGBPosition(0, 3), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
1567 
1568  m_pJoinMiterBt = new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_JOINMITER_BT, wxBitmap(JoinMiter_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1569  m_pJoinMiterBt->SetBitmapDisabled(wxBitmap(JoinMiterDisabled_xpm));
1570  pStrokeJoinSizer->Add(m_pJoinMiterBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1571 
1572  m_pJoinBevelBt = new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_JOINBEVEL_BT, wxBitmap(JoinBevel_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1573  m_pJoinBevelBt->SetBitmapDisabled(wxBitmap(JoinBevelDisabled_xpm));
1574  pStrokeJoinSizer->Add(m_pJoinBevelBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1575 
1576  m_pJoinRoundBt = new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_JOINROUND_BT, wxBitmap(JoinRound_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1577  m_pJoinRoundBt->SetBitmapDisabled(wxBitmap(JoinRoundDisabled_xpm));
1578  pStrokeJoinSizer->Add(m_pJoinRoundBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1579 
1580  wxStaticText* pStrokeColorTxt = new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _("Color:"), wxDefaultPosition, wxDefaultSize, 0); //<de>_("Farbe:")
1581  pGridBagSizerLine->Add(pStrokeColorTxt, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1582 
1583  m_pStrokeColorBox = new a2dColorComboBox(pStaticBoxSizerLine->GetStaticBox(), ID_STROKECOLOR_BOX, false, &m_CustomColors);
1584  pGridBagSizerLine->Add(m_pStrokeColorBox, wxGBPosition(1, 1), wxGBSpan(1, 1), wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1585 
1586  wxStaticText* pStrokeCapTxt = new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _("Caps:"), wxDefaultPosition, wxDefaultSize, 0); //<de>_("Abschlüsse:")
1587  pGridBagSizerLine->Add(pStrokeCapTxt, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1588 
1589  wxBoxSizer* pStrokeCapSizer = new wxBoxSizer(wxHORIZONTAL);
1590  pGridBagSizerLine->Add(pStrokeCapSizer, wxGBPosition(1, 3), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
1591 
1592  m_pCapButtBt = new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_CAPBUTT_BT, wxBitmap(CapButt_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1593  m_pCapButtBt->SetBitmapDisabled(wxBitmap(CapButtDisabled_xpm));
1594  pStrokeCapSizer->Add(m_pCapButtBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1595 
1596  m_pCapProjectingBt = new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_CAPPROJECTING_BT, wxBitmap(CapProjecting_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1597  m_pCapProjectingBt->SetBitmapDisabled(wxBitmap(CapProjectingDisabled_xpm));
1598  pStrokeCapSizer->Add(m_pCapProjectingBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1599 
1600  m_pCapRoundBt = new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_CAPROUND_BT, wxBitmap(CapRound_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1601  m_pCapRoundBt->SetBitmapDisabled(wxBitmap(CapRoundDisabled_xpm));
1602  pStrokeCapSizer->Add(m_pCapRoundBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1603 
1604  wxBoxSizer* pStrokeWidthSizer = new wxBoxSizer(wxHORIZONTAL);
1605  pGridBagSizerLine->Add(pStrokeWidthSizer, wxGBPosition(2, 0), wxGBSpan(1, 2), wxGROW|wxALIGN_CENTER_VERTICAL, 5);
1606 
1607  wxStaticText* pStrokeWidthTxt = new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _("Line width (mm):"), wxDefaultPosition, wxDefaultSize, 0); //<de>_("Strichstärke (mm):")
1608  pStrokeWidthSizer->Add(pStrokeWidthTxt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1609 
1610  m_pStrokeWidthCtrl = new wxSpinCtrlDouble(pStaticBoxSizerLine->GetStaticBox(), ID_STROKEWIDTH_CTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0.1, 5.0, 0.2, 0.1);
1611  m_pStrokeWidthCtrl->SetDigits(1);
1612  m_pStrokeWidthCtrl->SetValue(wxT(""));
1613  pStrokeWidthSizer->Add(m_pStrokeWidthCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1614 
1615  pStaticBoxSizerLine->Layout();
1616 
1617  //----------------------------
1618  // fill:
1619  //----------------------------
1620  wxStaticBox* pStaticBoxFill = new wxStaticBox(this, wxID_ANY, _("Filling")); //<de>_("Füllung")
1621  wxStaticBoxSizer* pStaticBoxSizerFill = new wxStaticBoxSizer(pStaticBoxFill, wxVERTICAL);
1622  pTopSizer->Add(pStaticBoxSizerFill, 0, wxGROW|wxALL, 5);
1623 
1624  wxBoxSizer* pFillColorSizer = new wxBoxSizer(wxHORIZONTAL);
1625  pFillColorSizer->SetMinSize( pStrokeWidthSizer->GetSize() ); // at least same width as left 'line attributes' column
1626  pStaticBoxSizerFill->Add(pFillColorSizer, 0, wxALIGN_LEFT|wxALL, 5);
1627 
1628  wxStaticText* pFillColorTxt = new wxStaticText( pStaticBoxSizerFill->GetStaticBox(), wxID_STATIC, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 ); //<de>_("Farbe:")
1629  pFillColorSizer->Add(pFillColorTxt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1630 
1631  m_pFillBox = new a2dFillComboBox(pStaticBoxSizerFill->GetStaticBox(), ID_FILL_BOX, bAllowLayerStyle, &m_CustomColors);
1632  if(!m_bFill) m_pFillBox->Disable();
1633  pFillColorSizer->Add(m_pFillBox, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1634 
1635  //----------------------------
1636  // dialog buttons:
1637  //----------------------------
1638  wxStdDialogButtonSizer* pStdDlgBtSizer = new wxStdDialogButtonSizer;
1639 
1640  pTopSizer->Add(pStdDlgBtSizer, 0, wxGROW|wxALL, 5);
1641  wxButton* pOkButton = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
1642  pOkButton->SetDefault();
1643  pStdDlgBtSizer->AddButton(pOkButton);
1644 
1645  wxButton* pCancelButton = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); //<de>_("&Abbrechen")
1646  pStdDlgBtSizer->AddButton(pCancelButton);
1647 
1648  pStdDlgBtSizer->Realize();
1649 }
1650 
1651 void a2dDialogStyle::OnInitDialog(wxInitDialogEvent& event)
1652 {
1653  // -- set default stroke properties --
1654  a2dStroke defaultStroke(*wxBLACK, 0.3, a2dSTROKE_SOLID);
1655  defaultStroke.SetJoin(wxJOIN_MITER);
1656  defaultStroke.SetCap(wxCAP_BUTT);
1657  m_ExtStroke.SetDefault(defaultStroke);
1658  //------------------------------------
1659 
1660  UpdateStrokeData(false);
1661 
1662  if(m_bFill && m_ExtFill.IsValid())
1663  m_pFillBox->SetFill(m_ExtFill.Get());
1664 }
1665 
1666 void a2dDialogStyle::UpdateStrokeData(bool bGetFromDlg)
1667 {
1668  if(bGetFromDlg)
1669  {
1670  if(m_pSrokeStyleBox->IsStyleSelected())
1671  m_ExtStroke.SetStyle(m_pSrokeStyleBox->GetStyle());
1672 
1673  if(m_pStrokeColorBox->IsColorSelected())
1674  m_ExtStroke.SetColor(m_pStrokeColorBox->GetColor());
1675 
1676 #if defined(__WXMSW__)
1677  if(!m_pStrokeWidthCtrl->GetText()->GetValue().IsEmpty())
1678 #else
1679  if( m_pStrokeWidthCtrl->GetValue() )
1680 #endif
1681  m_ExtStroke.SetWidth(m_pStrokeWidthCtrl->GetValue() / m_UnitsScale);
1682 
1683  if(m_pJoinMiterBt->GetValue()) m_ExtStroke.SetJoin(wxJOIN_MITER);
1684  else if(m_pJoinBevelBt->GetValue()) m_ExtStroke.SetJoin(wxJOIN_BEVEL);
1685  else if(m_pJoinRoundBt->GetValue()) m_ExtStroke.SetJoin(wxJOIN_ROUND);
1686 
1687  if(m_pCapButtBt->GetValue()) m_ExtStroke.SetCap(wxCAP_BUTT);
1688  else if(m_pCapProjectingBt->GetValue()) m_ExtStroke.SetCap(wxCAP_PROJECTING);
1689  else if(m_pCapRoundBt->GetValue()) m_ExtStroke.SetCap(wxCAP_ROUND);
1690  }
1691  else
1692  {
1693  if(m_ExtStroke.IsStyleValid())
1694  m_pSrokeStyleBox->SetStyle(m_ExtStroke.GetStyle());
1695 
1696  if(m_ExtStroke.HasEditableStyle())
1697  {
1698  m_pStrokeColorBox->Enable();
1699  if(m_ExtStroke.IsColorValid())
1700  m_pStrokeColorBox->SetColor(m_ExtStroke.GetColor());
1701 
1702  m_pStrokeWidthCtrl->Enable();
1703  if(m_ExtStroke.IsWidthValid())
1704  m_pStrokeWidthCtrl->SetValue(m_ExtStroke.GetWidth() * m_UnitsScale);
1705 
1706  m_pJoinMiterBt->Enable();
1707  m_pJoinBevelBt->Enable();
1708  m_pJoinRoundBt->Enable();
1709  if(m_ExtStroke.IsJoinValid())
1710  SetJoin(m_ExtStroke.GetJoin());
1711 
1712  m_pCapButtBt->Enable();
1713  m_pCapProjectingBt->Enable();
1714  m_pCapRoundBt->Enable();
1715  if(m_ExtStroke.IsCapValid())
1716  SetCap(m_ExtStroke.GetCap());
1717  }
1718  else
1719  {
1720  m_pStrokeColorBox->Disable();
1721  m_pStrokeColorBox->SetSelection(-1);
1722 
1723  m_pStrokeWidthCtrl->Disable();
1724  m_pStrokeWidthCtrl->SetValue(wxT(""));
1725 
1726  m_pJoinMiterBt->Disable();
1727  m_pJoinMiterBt->SetValue(false);
1728  m_pJoinBevelBt->Disable();
1729  m_pJoinBevelBt->SetValue(false);
1730  m_pJoinRoundBt->Disable();
1731  m_pJoinRoundBt->SetValue(false);
1732 
1733  m_pCapButtBt->Disable();
1734  m_pCapButtBt->SetValue(false);
1735  m_pCapProjectingBt->Disable();
1736  m_pCapProjectingBt->SetValue(false);
1737  m_pCapRoundBt->Disable();
1738  m_pCapRoundBt->SetValue(false);
1739  }
1740  }
1741 }
1742 
1743 void a2dDialogStyle::OnStrokeStyle(wxCommandEvent& event)
1744 {
1745  UpdateStrokeData(true);
1746 
1747  if( m_ExtStroke.HasEditableStyle() && !m_ExtStroke.IsInitialised() )
1748  { // initialise stroke with default properties
1749  a2dStroke defaultStroke = m_ExtStroke.GetDefault();
1750  defaultStroke.SetStyle(m_ExtStroke.GetStyle());
1751  m_ExtStroke.Set(defaultStroke);
1752  }
1753 
1754  UpdateStrokeData(false);
1755 }
1756 
1757 void a2dDialogStyle::OnJoin(wxCommandEvent& event)
1758 {
1759  switch(event.GetId())
1760  {
1761  case ID_JOINMITER_BT: SetJoin(wxJOIN_MITER);
1762  break;
1763  case ID_JOINBEVEL_BT: SetJoin(wxJOIN_BEVEL);
1764  break;
1765  case ID_JOINROUND_BT: SetJoin(wxJOIN_ROUND);
1766  break;
1767  };
1768 }
1769 
1770 void a2dDialogStyle::SetJoin(wxPenJoin join)
1771 {
1772  switch(join)
1773  {
1774  case wxJOIN_MITER:
1775  m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiterPressed_xpm));
1776  m_pJoinMiterBt->SetValue(true);
1777  m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevel_xpm));
1778  m_pJoinBevelBt->SetValue(false);
1779  m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRound_xpm));
1780  m_pJoinRoundBt->SetValue(false);
1781  break;
1782 
1783  case wxJOIN_BEVEL:
1784  m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiter_xpm));
1785  m_pJoinMiterBt->SetValue(false);
1786  m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevelPressed_xpm));
1787  m_pJoinBevelBt->SetValue(true);
1788  m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRound_xpm));
1789  m_pJoinRoundBt->SetValue(false);
1790  break;
1791 
1792  case wxJOIN_ROUND:
1793  m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiter_xpm));
1794  m_pJoinMiterBt->SetValue(false);
1795  m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevel_xpm));
1796  m_pJoinBevelBt->SetValue(false);
1797  m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRoundPressed_xpm));
1798  m_pJoinRoundBt->SetValue(true);
1799  break;
1800 
1801  default:
1802  m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiter_xpm));
1803  m_pJoinMiterBt->SetValue(false);
1804  m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevel_xpm));
1805  m_pJoinBevelBt->SetValue(false);
1806  m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRound_xpm));
1807  m_pJoinRoundBt->SetValue(false);
1808  break;
1809  };
1810 }
1811 
1812 void a2dDialogStyle::OnCap(wxCommandEvent& event)
1813 {
1814  switch(event.GetId())
1815  {
1816  case ID_CAPBUTT_BT: SetCap(wxCAP_BUTT);
1817  break;
1818  case ID_CAPPROJECTING_BT: SetCap(wxCAP_PROJECTING);
1819  break;
1820  case ID_CAPROUND_BT: SetCap(wxCAP_ROUND);
1821  break;
1822  };
1823 }
1824 
1825 void a2dDialogStyle::SetCap(wxPenCap cap)
1826 {
1827  switch(cap)
1828  {
1829  case wxCAP_BUTT:
1830  m_pCapButtBt->SetBitmap(wxBitmap(CapButtPressed_xpm));
1831  m_pCapButtBt->SetValue(true);
1832  m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjecting_xpm));
1833  m_pCapProjectingBt->SetValue(false);
1834  m_pCapRoundBt->SetBitmap(wxBitmap(CapRound_xpm));
1835  m_pCapRoundBt->SetValue(false);
1836  break;
1837 
1838  case wxCAP_PROJECTING:
1839  m_pCapButtBt->SetBitmap(wxBitmap(CapButt_xpm));
1840  m_pCapButtBt->SetValue(false);
1841  m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjectingPressed_xpm));
1842  m_pCapProjectingBt->SetValue(true);
1843  m_pCapRoundBt->SetBitmap(wxBitmap(CapRound_xpm));
1844  m_pCapRoundBt->SetValue(false);
1845  break;
1846 
1847  case wxCAP_ROUND:
1848  m_pCapButtBt->SetBitmap(wxBitmap(CapButt_xpm));
1849  m_pCapButtBt->SetValue(false);
1850  m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjecting_xpm));
1851  m_pCapProjectingBt->SetValue(false);
1852  m_pCapRoundBt->SetBitmap(wxBitmap(CapRoundPressed_xpm));
1853  m_pCapRoundBt->SetValue(true);
1854  break;
1855 
1856  default:
1857  m_pCapButtBt->SetBitmap(wxBitmap(CapButt_xpm));
1858  m_pCapButtBt->SetValue(false);
1859  m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjecting_xpm));
1860  m_pCapProjectingBt->SetValue(false);
1861  m_pCapRoundBt->SetBitmap(wxBitmap(CapRound_xpm));
1862  m_pCapRoundBt->SetValue(false);
1863  break;
1864  };
1865 }
1866 
1867 void a2dDialogStyle::OnOk(wxCommandEvent& event)
1868 {
1869  //------------------------------------------------------------
1870  wxFocusEvent evt; // Hack to update value in case of pressing Enter in the spin control,
1871 #if defined(__WXMSW__)
1872  m_pStrokeWidthCtrl->OnTextLostFocus(evt); // because wxWidgets(2.9.4) updates its value only when losing focus.
1873 #endif
1874  //------------------------------------
1875  UpdateStrokeData(true);
1876 
1877  if(m_bFill && m_pFillBox->IsFillSelected())
1878  m_ExtFill.Set(m_pFillBox->GetFill());
1879 
1880  EndModal(wxID_OK);
1881 }
1882 
1883 wxUint32 a2dSetExtFill( a2dExtFill& returned, a2dCanvasObjectList* objects, a2dCanvasObjectFlagsMask mask, a2dLayers* layersetup )
1884 {
1885  int nr = 0;
1886  forEachIn( a2dCanvasObjectList, objects )
1887  {
1888  a2dCanvasObject* obj = *iter;
1889  a2dPolylineL* pline = wxDynamicCast( obj, a2dPolylineL );
1890  a2dSLine* line = wxDynamicCast( obj, a2dSLine );
1891 
1892  if ( obj->GetFixedStyle() || obj->GetRelease() || !obj->CheckMask( mask ) || pline || line )
1893  continue;
1894 
1895  //if ( obj->GetFill().IsSameAs( *a2dTRANSPARENT_FILL ) )
1896  // continue;
1897 
1898  //if ( obj->GetFill().IsSameAs( *a2dNullFILL ) )
1899  // continue;
1900 
1901  obj->SetBin2( true );
1902 
1903  a2dFill fill = obj->GetFill();
1904  if ( (fill == *a2dNullFILL) && layersetup ) //layer like?
1905  fill = layersetup->GetFill( obj->GetLayer() );
1906 
1907 
1908  if ( !nr )
1909  returned.Set( fill );
1910  else
1911  returned.Mix( fill );
1912  nr++;
1913  }
1914  return nr;
1915 }
1916 
1917 wxUint32 a2dSetExtStroke( a2dExtStroke& returned, a2dCanvasObjectList* objects, a2dCanvasObjectFlagsMask mask, a2dLayers* layersetup )
1918 {
1919  int nr = 0;
1920  forEachIn( a2dCanvasObjectList, objects )
1921  {
1922  a2dCanvasObject* obj = *iter;
1923 
1924  //optional can be resolved with SetFixedStyle() on certain ta wires (TaPin.cpp)
1925  //we do not want Tawire for Taco's to change in style, other ta wires are okay.
1926  //a2dWirePolylineL* wire = wxDynamicCast( obj, a2dWirePolylineL );
1927  //if ( wire )
1928  // continue;
1929 
1930  if ( obj->GetFixedStyle() || obj->GetRelease() || !obj->CheckMask( mask ) )
1931  continue;
1932 
1933  //if ( obj->GetStroke().IsSameAs( *a2dTRANSPARENT_STROKE ) )
1934  // continue;
1935 
1936  //if ( obj->GetStroke().IsSameAs( *a2dNullSTROKE ) )
1937  // continue;
1938 
1939  obj->SetBin2( true );
1940 
1941  a2dStroke stroke = obj->GetStroke();
1942  if ( (stroke == *a2dNullSTROKE) && layersetup ) //layer like?
1943  stroke = layersetup->GetStroke( obj->GetLayer() );
1944 
1945  if ( !nr )
1946  returned.Set( stroke );
1947  else
1948  returned.Mix( stroke );
1949  nr++;
1950  }
1951  return nr;
1952 }
1953 
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
(In) Visible property that can be added to Docview Objects.
Definition: gen.h:1785
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Definition: gen.h:75
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
static const a2dSignal sig_changedFill
when active drawing is set, this signal is send to the drawing.
Definition: canglob.h:1187
bool GetActive()
is the tool active?
Definition: tools.h:497
static const a2dSignal sm_changedProperty
Definition: gen.h:381
void DrawLine(double x1, double y1, double x2, double y2)
Draw line in world coordinates.
Definition: dcdrawer.cpp:1709
const a2dFill * a2dINHERIT_FILL
global a2dFill stock object for INHERTED from parent object filling
wxColour GetColour2() const
return colour 2
Definition: stylebase.cpp:4969
choose a fill pattern
Definition: strucdlg.h:299
dialog for defining style on an a2dCanvasObject
void SetPixelStroke(bool pixelstroke)
set pixelstoke flag, stroke width is defined in pixels else in worldcoordinates
Definition: stylebase.cpp:6316
Ref Counted base object.
Definition: gen.h:1045
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
Definition: comevt.h:795
a2dDrawingPart * GetDrawingPart()
Access to the tool controllers drawer.
Definition: tools.h:632
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
Definition: gen.cpp:876
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
Definition: drawer2d.cpp:565
void SetStroke(const a2dStroke &stroke)
used for new objects etc. to set the stroke
Definition: canglob.cpp:939
bool GetPixelStroke() const
if the width is pixels or not.
Definition: stylebase.cpp:6335
This class implements drawing functions for wxDC based drawing.
Definition: dcdrawer.h:203
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
wxColour GetColour() const
return colour 1
Definition: stylebase.cpp:6131
wxBitmap GetBuffer() const
return buffer as a bitmap
Definition: dcdrawer.h:220
void OnCloseWindow(wxCloseEvent &event)
Close window.
Definition: styledialg.cpp:704
void SetFill(const a2dFill &fill)
used for new objects etc. to set the fill
Definition: canglob.cpp:955
bool m_doSentCommand
When canvas event, this is set to prevent sending commands.
Definition: styledialg.h:178
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
Definition: canglob.h:1262
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
Definition: candefs.h:152
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
Definition: drawer2d.cpp:621
a2dFillStyle
Filling styles for a2dFill.
Definition: stylebase.h:91
general style dialog to edit a2dCanvasObject style
Definition: styledialg.h:60
void SetWidth(float width)
Set width of stroke in world coordinates.
Definition: stylebase.cpp:6262
wxColourDialog * m_cd
color dialog for color bitmap button sample
Definition: styledialg.h:161
void SetColour(const wxColour &col)
set colour used for gradient and wxSTROKE_MASK_OPAQUE filling.
Definition: stylebase.cpp:6112
#define forEachIn(listtype, list)
easy iteration for a2dlist
Definition: a2dlist.h:111
static const a2dSignal sig_changedActiveDrawing
when active drawing is set, this signal is send to the drawing.
Definition: canglob.h:1292
const a2dStroke & GetStroke() const
get the current stroke
Definition: canglob.h:797
polyline defined with list of points.
Definition: polygon.h:332
a2dCanvasObject * GetOriginal()
object to draw or edit
Definition: sttool.h:220
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
Definition: gen.h:564
static const a2dSignal sig_toolStartEditObject
when starting editing an object, this event is sent to tool
Definition: edit.h:83
a2dSLine
Definition: canprim.h:987
Contains graphical drawing context specific classes. a2dDcDrawer and derived classes are used for dra...
wxUint16 GetLayer() const
Returns the layer index where this object is drawn upon.
Definition: canobj.h:2368
void SetColour(const wxColour &col)
set colour used for gradient and wxSTIPPLE_MASK_OPAQUE filling.
Definition: stylebase.cpp:4988
const a2dStroke * a2dINHERIT_STROKE
global a2dStroke stock object for INHERTED from parent object stroking
bool CheckMask(a2dCanvasObjectFlagsMask mask) const
Compares all flags in object to the given mask and return true is the same.
Definition: canobj.cpp:2665
const a2dFill * a2dNullFILL
global a2dFill stock object for defining NO filling
This tool is for editing a single object.
Definition: edit.h:73
defines common settinsg for a habitat for a set of a2dCameleons.
Definition: canglob.h:439
const a2dStroke * a2dNullSTROKE
global a2dStroke stock object for NO stroking
bool GetFixedStyle() const
Get object fixed style setting.
Definition: canobj.h:1590
const a2dFill & GetFill() const
get the current fill
Definition: canglob.h:804
virtual void BeginDraw()
start to draw on this context (used to initialize a specific drawer)
Definition: dcdrawer.cpp:2438
wxColourData * m_cdata
colour data for colour dialog
Definition: styledialg.h:158
property to hold a a2dStroke type variable to be associated with a a2dObject
Definition: styleprop.h:98
bool GetRelease() const
get release flag
Definition: gen.h:1350
editing tool for a2dCanvasObject&#39;s
wxColour * m_color
the color that is under modification
Definition: styledialg.h:136
wxColour GetColour() const
return colour
Definition: stylebase.cpp:5012
Event sent to a2dCommandProcessor.
Definition: comevt.h:701
see a2dComEvent
Definition: gen.h:371
all polygon and polyline a2dCanvasObject are here.
void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
Definition: dcdrawer.cpp:1730
a2dDrawing * GetDrawing() const
get drawing via top object
Definition: drawer.cpp:726
float GetWidth() const
Definition: stylebase.cpp:6281
the a2dDrawingPart is a a2dView specially designed for displaying parts of a a2dDrawing. It uses a a2dDrawer2D to actually redraw things from the document, by giving that a2dDrawer2D as drawing context to the document, and telling the document to redraw a certain rectangular area. At that last is what this class is for. It optimizes the areas to be redrawn after object in the document were changed. To do that it combines redraw areas to a minimal set of redrawing areas. All the administration for this and the way things will be redrawn is from this view.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
Definition: canglob.cpp:1234
#define EVT_UNDO(func)
event sent from a2DocumentCommandProcessor when a command is undone
Definition: comevt.h:797
a2dStrokeStyle
stroke styles for a2dStroke
Definition: stylebase.h:298
property to hold a a2dFill type variable to be associated with a a2dObject
Definition: styleprop.h:44
void SetColour2(const wxColour &col)
set colour 2 used for gradient and wxSTIPPLE_MASK_OPAQUE filling.
Definition: stylebase.cpp:4949
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
Definition: gen.cpp:902
virtual void EndDraw()
end drawing on this context (used to reset a specific drawer)
Definition: dcdrawer.cpp:2475
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
styledialg.cpp Source File -- Sun Oct 12 2014 17:04:26 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation