wxArt2D
strucdlg.cpp
1 /*! \file editor/src/strucdlg.cpp
2  \author Klaas Holwerda
3 
4  Copyright: 2000-2004 (c) Klaas Holwerda
5 
6  Licence: wxWidgets Licence
7 
8  RCS-ID: $Id: strucdlg.cpp,v 1.28 2009/10/05 20:03:12 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 
22 #include "wx/canvas/strucdlg.h"
23 #include "wx/canvas/canmod.h"
24 
25 BEGIN_EVENT_TABLE( a2dCanvasObjectsDialog, wxDialog )
26  EVT_CLOSE( a2dCanvasObjectsDialog::OnCloseWindow )
27  EVT_LISTBOX( STRUCT_ID_LISTBOX, a2dCanvasObjectsDialog::OnStructIdListboxSelected )
28  EVT_LISTBOX_DCLICK( STRUCT_ID_LISTBOX, a2dCanvasObjectsDialog::OnStructIdListboxDoubleClicked )
29  EVT_BUTTON( STRUCT_ID_HIDE, a2dCanvasObjectsDialog::OnStructIdHideClick )
30  EVT_BUTTON( STRUCT_ID_APPLY, a2dCanvasObjectsDialog::OnStructIdApplyClick )
31  //EVT_CHANGED_DOCUMENT( a2dCanvasObjectsDialog::OnChangedDocument )
32  EVT_DO( a2dCanvasObjectsDialog::OnDoEvent )
34 END_EVENT_TABLE()
35 
36 
37 a2dCanvasObjectsDialog::a2dCanvasObjectsDialog( wxWindow* parent, a2dDrawing* drawing, bool structOnly, bool modal, long style,
38  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size )
39 {
40  m_modal = modal;
41  Create( parent, id, caption, pos, size, style );
42 /*
43  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_CHANGED_DOCUMENT, this );
44  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_DO, this );
45  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_UNDO, this );
46  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_REDO, this );
47  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( a2dEVT_COM_EVENT, this );
48 */
49  m_drawing = drawing;
50 
51  m_structureSet.clear();
52 
53  Init( drawing );
54 
55  Centre( wxBOTH );
56 
57  // set the first structure as default and give it the focus
58  if ( m_structureSet.size() )
59  m_listbox->SetSelection( 0, true );
60  m_object = NULL;
61 }
62 
63 a2dCanvasObjectsDialog::a2dCanvasObjectsDialog( wxWindow* parent, a2dCanvasObjectList* total, bool modal, long style,
64  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size )
65 {
66  m_modal = modal;
67  Create( parent, id, caption, pos, size, style );
68 /*
69  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_CHANGED_DOCUMENT, this );
70  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_DO, this );
71  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_UNDO, this );
72  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( wxEVT_REDO, this );
73  a2dDocviewGlobals->GetDocviewCommandProcessor()->ConnectEvent( a2dEVT_COM_EVENT, this );
74 */
75  m_drawing = NULL;
76 
77  m_structureSet.clear();
78 
79  Init( total );
80 
81  Centre( wxBOTH );
82 
83  // set the first structure as default and give it the focus
84  if ( m_structureSet.size() )
85  m_listbox->SetSelection( 0, true );
86  m_object = NULL;
87 }
88 
89 bool a2dCanvasObjectsDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
90 {
91  m_object = NULL;
92 
93  m_listbox = NULL;
94  m_hide = NULL;
95  m_Apply = NULL;
96  SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
97  wxDialog::Create( parent, id, caption, pos, size, style );
98 
99  a2dCanvasObjectsDialog* itemDialog1 = this;
100 
101  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
102  itemDialog1->SetSizer( itemBoxSizer2 );
103 
104  m_numberObjects = new wxStaticText( itemDialog1, STRUCT_ID_STATIC, _( "Number of objects:" ), wxDefaultPosition, wxDefaultSize, 0 );
105  m_numberObjects->SetHelpText( _( "Displays number of objects in list" ) );
106  if ( ShowToolTips() )
107  m_numberObjects->SetToolTip( _( "Displays number of objects in list" ) );
108  itemBoxSizer2->Add( m_numberObjects, 0, wxALIGN_CENTER_HORIZONTAL | wxALL , 5 );
109 
110  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxHORIZONTAL );
111  itemBoxSizer2->Add( itemBoxSizer4, 1, wxGROW | wxALL, 1 );
112 
113  wxString* m_listboxStrings = NULL;
114  m_listbox = new wxListBox( itemDialog1, STRUCT_ID_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_listboxStrings, wxLB_SINGLE | wxLB_NEEDED_SB );
115  m_listbox->SetHelpText( _( "list of objects to choose from, Double click to choose." ) );
116  if ( ShowToolTips() )
117  m_listbox->SetToolTip( _( "list of objects to choose from, Double click to choose." ) );
118  itemBoxSizer4->Add( m_listbox, 1, wxGROW | wxALL, 1 );
119 
120  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxHORIZONTAL );
121  itemBoxSizer2->Add( itemBoxSizer6, 0, wxGROW | wxALL, 1 );
122 
123  if ( m_modal )
124  {
125  m_hide = new wxButton( itemDialog1, STRUCT_ID_HIDE, _( "Ok" ), wxDefaultPosition, wxDefaultSize, 0 );
126  m_Apply = new wxButton( itemDialog1, STRUCT_ID_APPLY, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
127  }
128  else
129  {
130  m_hide = new wxButton( itemDialog1, STRUCT_ID_HIDE, _( "Hide" ), wxDefaultPosition, wxDefaultSize, 0 );
131  m_Apply = new wxButton( itemDialog1, STRUCT_ID_APPLY, _( "Apply" ), wxDefaultPosition, wxDefaultSize, 0 );
132  }
133 
134  m_hide->SetHelpText( _( "Hide this dialog" ) );
135  if ( ShowToolTips() )
136  m_hide->SetToolTip( _( "Hide this dialog" ) );
137  itemBoxSizer6->Add( m_hide, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
138 
139  m_Apply->SetHelpText( _( "Set this object as top in canvas" ) );
140  if ( ShowToolTips() )
141  m_Apply->SetToolTip( _( "Set this object as top in canvas" ) );
142  itemBoxSizer6->Add( m_Apply, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
143 
144  GetSizer()->Fit( this );
145  GetSizer()->SetSizeHints( this );
146  Centre();
147  return TRUE;
148 }
149 
150 a2dCanvasObjectsDialog::~a2dCanvasObjectsDialog()
151 {
152 /*
153  a2dDocviewGlobals->GetDocviewCommandProcessor()->DisconnectEvent( wxEVT_CHANGED_DOCUMENT, this );
154  a2dDocviewGlobals->GetDocviewCommandProcessor()->DisconnectEvent( wxEVT_ACTIVATE_VIEW, this );
155  a2dDocviewGlobals->GetDocviewCommandProcessor()->DisconnectEvent( wxEVT_DO, this );
156  a2dDocviewGlobals->GetDocviewCommandProcessor()->DisconnectEvent( wxEVT_UNDO, this );
157  a2dDocviewGlobals->GetDocviewCommandProcessor()->DisconnectEvent( wxEVT_REDO, this );
158  a2dDocviewGlobals->GetDocviewCommandProcessor()->DisconnectEvent( a2dEVT_COM_EVENT, this );
159 */
160 }
161 
163 {
164  m_listbox->Clear();
165 
166  s_a2dCanvasObjectSorter = &NameSorter;
167  for( a2dCanvasObjectList::iterator iter = objects->begin(); iter != objects->end(); ++iter )
168  {
169  a2dCanvasObject* obj = *iter;
170  if ( m_structureSet.find( obj ) == m_structureSet.end() )
171  m_structureSet.insert( obj );
172  }
173 
174  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
175  {
176  a2dCanvasObject* obj = *iter;
177  if ( obj == m_drawing->GetRootObject() )
178  {
179  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
180  }
181  else
182  m_listbox->Append( obj->GetName() );
183  }
184 
185  wxString mess = wxT( "" );
186  mess.Printf( _( "Number of structures: %ld" ), m_structureSet.size() - 1 );
187  m_numberObjects->SetLabel( mess );
188 
189  // set the first structure as default and give it the focus
190  if ( m_structureSet.size() )
191  m_listbox->SetSelection( 0, true );
192  m_object = NULL;
193 }
194 
196 {
197  s_a2dCanvasObjectSorter = &NameSorter;
198  m_structureSet.clear();
199  if ( drawing->GetDrawingId() == a2dDrawing::sm_cameleonrefs )
200  {
201  a2dCanvasObjectList::iterator rootchild = drawing->GetRootObject()->GetChildObjectList()->begin();
202  while ( rootchild != drawing->GetRootObject()->GetChildObjectList()->end() )
203  {
204  a2dCameleonSymbolicRef* ref = wxDynamicCast( (*rootchild).Get(), a2dCameleonSymbolicRef );
205  if ( ref && ref->GetCameleon() )
206  {
207  a2dLayout* layout = ref->GetCameleon()->GetAppearance<a2dDiagram>();
208  if ( layout )
209  {
210  if ( m_structureSet.find( layout ) == m_structureSet.end() )
211  m_structureSet.insert( layout );
212  }
213  }
214  rootchild++;
215  }
216 
217  m_listbox->Clear();
218  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
219  {
220  a2dCanvasObject* obj = *iter;
221  if ( obj->GetHighLight() )
222  {
223  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
224  }
225  else
226  m_listbox->Append( obj->GetName() );
227  }
228  }
229  else
230  {
232  collector.SetWithChilds( true );
233  collector.SortOn( a2dWalker_CollectCanvasObjectsSet::onName );
234  collector.SetSkipNotRenderedInDrawing( true );
235  collector.Start( drawing->GetRootObject() );
236 
237  m_structureSet = collector.m_found;
238  m_listbox->Clear();
239 
240  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
241  {
242  a2dCanvasObject* obj = *iter;
243  if ( obj == m_drawing->GetRootObject() )
244  {
245  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
246  }
247  else
248  m_listbox->Append( obj->GetName() );
249  }
250  }
251 
252  wxString mess = wxT( "" );
253  mess.Printf( _( "Number of structures: %ld" ), m_structureSet.size() - 1 );
254  m_numberObjects->SetLabel( mess );
255 
256  // set the first structure as default and give it the focus
257  if ( m_structureSet.size() )
258  m_listbox->SetSelection( 0, true );
259  m_object = NULL;
260 }
261 
262 void a2dCanvasObjectsDialog::InitCameleons( a2dDrawing* drawing, const wxString& appearanceClassName )
263 {
264  s_a2dCanvasObjectSorter = &NameSorter;
265  m_structureSet.clear();
266  a2dCanvasObjectList::iterator rootchild = drawing->GetRootObject()->GetChildObjectList()->begin();
267  while ( rootchild != drawing->GetRootObject()->GetChildObjectList()->end() )
268  {
269  a2dCameleon* ref = wxDynamicCast( (*rootchild).Get(), a2dCameleon );
270  if ( ref )
271  {
272  a2dAppear* appearance = ref->GetAppearanceByClassName( appearanceClassName );
273  if ( appearance )
274  {
275  if ( m_structureSet.find( appearance ) == m_structureSet.end() )
276  m_structureSet.insert( appearance );
277  }
278  }
279  rootchild++;
280  }
281 
282  m_listbox->Clear();
283  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
284  {
285  a2dCanvasObject* obj = *iter;
286  if ( obj->GetHighLight() )
287  {
288  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
289  }
290  else
291  m_listbox->Append( obj->GetName() );
292  }
293 
294  wxString mess = wxT( "" );
295  mess.Printf( _( "Number of structures: %ld" ), m_structureSet.size() - 1 );
296  m_numberObjects->SetLabel( mess );
297 
298  // set the first structure as default and give it the focus
299  if ( m_structureSet.size() )
300  m_listbox->SetSelection( 0, true );
301  m_object = NULL;
302 }
303 
305 {
306  event.Skip();
307 }
308 
309 void a2dCanvasObjectsDialog::OnStructIdHideClick( wxCommandEvent& event )
310 {
311  if ( IsModal() )
312  {
313  CmApply();
314  EndModal( wxID_OK );
315  }
316  else
317  {
318  CmApply();
319  SetReturnCode( wxID_OK );
320  Show( false );
321  }
322 }
323 
324 void a2dCanvasObjectsDialog::OnStructIdApplyClick( wxCommandEvent& event )
325 {
326  if ( IsModal() )
327  {
328  EndModal( wxID_CANCEL );
329  return;
330  }
331 }
332 
334 {
335  CmApply();
336 }
337 
338 void a2dCanvasObjectsDialog::CmApply()
339 {
340  wxString buf;
341  buf = m_listbox->GetStringSelection();
342  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
343  {
344  a2dCanvasObject* obj = *iter;
345  wxString name = obj->GetName();
346  if ( !name.Cmp( buf ) )
347  {
348  m_object = obj;
349  break;
350  }
351  else if ( name + wxT( "=>top" ) == buf )
352  {
353  m_object = obj;
354  break;
355  }
356  }
357  if ( m_drawing->GetDrawingId() == a2dDrawing::sm_cameleonrefs )
358  {
359  m_object = wxStaticCast( m_object, a2dDiagram )->GetDrawing()->GetRootObject();
360  }
361 
363  if ( !drawingPart )
364  return;
365 
366  a2dCanvasObject* top = drawingPart->GetShowObject();
367 
368  a2dCommand_SetShowObject* command = new a2dCommand_SetShowObject( drawingPart, a2dCommand_SetShowObject::Args().canvasobject( m_object ) );
369  drawingPart->GetDrawing()->GetCommandProcessor()->Submit( command, false );
370  drawingPart->GetDrawing()->GetCanvasCommandProcessor()->ZoomOut();
371 }
372 
374 {
375  return m_object;
376 }
377 
378 void a2dCanvasObjectsDialog::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
379 {
380  if ( IsModal() )
381  EndModal( wxID_OK );
382  else
383  {
384  SetReturnCode( wxID_OK );
385  Show( false );
386  }
387 }
388 
389 /*
390 void a2dCanvasObjectsDialog::OnChangedDocument( a2dCommandEvent& event )
391 {
392  if ( !m_drawing )
393  return;
394 
395  a2dCanvasDocument* doc = ( a2dCanvasDocument* ) event.GetDocument();
396  if ( !IsModal() && doc )
397  {
398  m_drawing = doc;
399  Init( doc );
400  }
401 }
402 */
403 
405 {
406  if ( !m_drawing )
407  return;
408 
409  if ( event.GetId() == a2dDrawingPart::sig_changedShowObject )
410  {
411  a2dCanvasObject* newtop = wxStaticCast( event.GetProperty()->GetRefObject(), a2dCanvasObject );
412  }
413  else
414  event.Skip();
415 }
416 
417 void a2dCanvasObjectsDialog::OnDoEvent( a2dCommandProcessorEvent& event )
418 {
419  if ( !m_drawing )
420  return;
421 
422  if ( event.GetCommand()->GetCommandId() == &a2dCommand_SetShowObject::Id )
423  {
424  Init( m_drawing );
425  }
426  else if ( event.GetCommand()->GetCommandId() == &a2dCommand_NewGroup::Id )
427  {
428  Init( m_drawing );
429  }
430  else
431  event.Skip();
432 }
433 
434 //----------------------------------------------------------------------------
435 // a2dCanvasObjectsChooseDialog
436 //----------------------------------------------------------------------------
437 
438 BEGIN_EVENT_TABLE( a2dCanvasObjectsChooseDialog, wxDialog )
439  EVT_CLOSE( a2dCanvasObjectsChooseDialog::OnCloseWindow )
440  EVT_LISTBOX( CHOOSE_ID_LISTBOX, a2dCanvasObjectsChooseDialog::OnStructIdListboxSelected )
441  EVT_LISTBOX_DCLICK( CHOOSE_ID_LISTBOX, a2dCanvasObjectsChooseDialog::OnStructIdListboxDoubleClicked )
442  EVT_BUTTON( CHOOSE_ID_HIDE, a2dCanvasObjectsChooseDialog::OnStructIdHideClick )
443  EVT_BUTTON( CHOOSE_ID_APPLY, a2dCanvasObjectsChooseDialog::OnStructIdApplyClick )
444 END_EVENT_TABLE()
445 
446 
447 a2dCanvasObjectsChooseDialog::a2dCanvasObjectsChooseDialog( wxWindow* parent, a2dDrawing* drawing, bool structOnly, long style,
448  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size )
449 {
450  Create( parent, id, caption, pos, size, style );
451  m_drawing = drawing;
452 
453  m_structureSet.clear();
454 
455  Init( drawing );
456 
457  Centre( wxBOTH );
458 
459  // set the first structure as default and give it the focus
460  if ( m_structureSet.size() )
461  m_listbox->SetSelection( 0, true );
462  m_object = NULL;
463 }
464 
465 a2dCanvasObjectsChooseDialog::a2dCanvasObjectsChooseDialog( wxWindow* parent, a2dCanvasObjectList* total, const wxString& appearancename, long style,
466  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size )
467 {
468  Create( parent, id, caption, pos, size, style );
469  m_drawing = NULL;
470 
471  m_structureSet.clear();
472 
473  InitCameleons( total, appearancename );
474 
475  Centre( wxBOTH );
476 
477  // set the first structure as default and give it the focus
478  if ( m_structureSet.size() )
479  m_listbox->SetSelection( 0, true );
480  m_object = NULL;
481 }
482 
483 a2dCanvasObjectsChooseDialog::a2dCanvasObjectsChooseDialog( wxWindow* parent, a2dCanvasObjectList* total, long style,
484  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size )
485 {
486  Create( parent, id, caption, pos, size, style );
487  m_drawing = NULL;
488 
489  m_structureSet.clear();
490 
491  Init( total );
492 
493  Centre( wxBOTH );
494 
495  // set the first structure as default and give it the focus
496  if ( m_structureSet.size() )
497  m_listbox->SetSelection( 0, true );
498  m_object = NULL;
499 }
500 
501 bool a2dCanvasObjectsChooseDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
502 {
503  m_object = NULL;
504 
505  m_listbox = NULL;
506  m_hide = NULL;
507  m_Apply = NULL;
508  SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
509  wxDialog::Create( parent, id, caption, pos, size, style );
510 
511  a2dCanvasObjectsChooseDialog* itemDialog1 = this;
512 
513  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
514  itemDialog1->SetSizer( itemBoxSizer2 );
515 
516  m_numberObjects = new wxStaticText( itemDialog1, CHOOSE_ID_STATIC, _( "Number of objects:" ), wxDefaultPosition, wxDefaultSize, 0 );
517  m_numberObjects->SetHelpText( _( "Displays number of objects in list" ) );
518  if ( ShowToolTips() )
519  m_numberObjects->SetToolTip( _( "Displays number of objects in list" ) );
520  itemBoxSizer2->Add( m_numberObjects, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
521 
522  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxHORIZONTAL );
523  itemBoxSizer2->Add( itemBoxSizer4, 1, wxGROW | wxALL, 1 );
524 
525  wxString* m_listboxStrings = NULL;
526  m_listbox = new wxListBox( itemDialog1, CHOOSE_ID_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_listboxStrings, wxLB_SINGLE | wxLB_NEEDED_SB );
527  m_listbox->SetHelpText( _( "list of objects to choose from, Double click to choose." ) );
528  if ( ShowToolTips() )
529  m_listbox->SetToolTip( _( "list of objects to choose from, Double click to choose." ) );
530  itemBoxSizer4->Add( m_listbox, 1, wxGROW | wxALL, 1 );
531 
532  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxHORIZONTAL );
533  itemBoxSizer2->Add( itemBoxSizer6, 0, wxGROW | wxALL, 1 );
534 
535  m_hide = new wxButton( itemDialog1, CHOOSE_ID_HIDE, _( "Ok" ), wxDefaultPosition, wxDefaultSize, 0 );
536  m_Apply = new wxButton( itemDialog1, CHOOSE_ID_APPLY, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
537 
538  m_hide->SetHelpText( _( "Hide this dialog" ) );
539  if ( ShowToolTips() )
540  m_hide->SetToolTip( _( "Hide this dialog" ) );
541  itemBoxSizer6->Add( m_hide, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
542 
543  m_Apply->SetHelpText( _( "Set this object as top in canvas" ) );
544  if ( ShowToolTips() )
545  m_Apply->SetToolTip( _( "Set this object as top in canvas" ) );
546  itemBoxSizer6->Add( m_Apply, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
547 
548  //GetSizer()->Fit( this );
549  //GetSizer()->SetSizeHints( this );
550  Centre();
551  return TRUE;
552 }
553 
554 a2dCanvasObjectsChooseDialog::~a2dCanvasObjectsChooseDialog()
555 {
556 }
557 
558 void a2dCanvasObjectsChooseDialog::InitCameleons( a2dCanvasObjectList* total, const wxString& appearanceClassName )
559 {
560  s_a2dCanvasObjectSorter = &NameSorter;
561  m_structureSet.clear();
562  a2dCanvasObjectList::iterator rootchild = total->begin();
563  while ( rootchild != total->end() )
564  {
565  a2dCameleon* ref = wxDynamicCast( (*rootchild).Get(), a2dCameleon );
566  if ( ref )
567  {
568  if ( appearanceClassName.IsEmpty() )
569  {
570  if ( m_structureSet.find( ref ) == m_structureSet.end() )
571  m_structureSet.insert( ref );
572  }
573  else
574  {
575  a2dAppear* appearance = ref->GetAppearanceByClassName( appearanceClassName );
576  if ( appearance )
577  {
578  if ( m_structureSet.find( appearance ) == m_structureSet.end() )
579  m_structureSet.insert( appearance );
580  }
581  }
582  }
583  rootchild++;
584  }
585 
586  m_listbox->Clear();
587  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
588  {
589  a2dCanvasObject* obj = *iter;
590  if ( obj->GetHighLight() )
591  {
592  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
593  }
594  else
595  m_listbox->Append( obj->GetName() );
596  }
597 
598  wxString mess = wxT( "" );
599  mess.Printf( _( "Number of structures: %ld" ), m_structureSet.size() - 1 );
600  m_numberObjects->SetLabel( mess );
601 
602  // set the first structure as default and give it the focus
603  if ( m_structureSet.size() )
604  m_listbox->SetSelection( 0, true );
605  m_object = NULL;
606 }
607 
609 {
610  m_listbox->Clear();
611 
612  s_a2dCanvasObjectSorter = &NameSorter;
613  for( a2dCanvasObjectList::iterator iter = objects->begin(); iter != objects->end(); ++iter )
614  {
615  a2dCanvasObjectList::value_type obj = *iter;
616  a2dCanvasObjectsSet::iterator iterf = m_structureSet.find( obj );
617  if ( iterf == m_structureSet.end() )
618  m_structureSet.insert( obj );
619  }
620 
621  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
622  {
623  a2dCanvasObject* obj = *iter;
624  if ( m_drawing && obj == m_drawing->GetRootObject() )
625  {
626  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
627  }
628  else
629  m_listbox->Append( obj->GetName() );
630  }
631 
632  wxString mess = wxT( "" );
633  mess.Printf( _( "Number of structures: %ld" ), m_structureSet.size() - 1 );
634  m_numberObjects->SetLabel( mess );
635 
636  // set the first structure as default and give it the focus
637  if ( m_structureSet.size() )
638  m_listbox->SetSelection( 0, true );
639  m_object = NULL;
640 }
641 
643 {
644  s_a2dCanvasObjectSorter = &NameSorter;
645  m_structureSet.clear();
646  if ( drawing->GetDrawingId() == a2dDrawing::sm_cameleonrefs )
647  {
648  a2dCanvasObjectList::iterator rootchild = drawing->GetRootObject()->GetChildObjectList()->begin();
649  while ( rootchild != drawing->GetRootObject()->GetChildObjectList()->end() )
650  {
651  a2dCameleon* ref = wxDynamicCast( (*rootchild).Get(), a2dCameleon );
652  if ( ref )
653  {
654  a2dLayout* layout = ref->GetAppearance<a2dDiagram>();
655  if ( layout )
656  {
657  if ( m_structureSet.find( layout ) == m_structureSet.end() )
658  m_structureSet.insert( layout );
659  }
660  }
661  rootchild++;
662  }
663 
664  m_listbox->Clear();
665  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
666  {
667  a2dCanvasObject* obj = *iter;
668  if ( obj->GetHighLight() )
669  {
670  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
671  }
672  else
673  m_listbox->Append( obj->GetName() );
674  }
675  }
676  else
677  {
679  collector.SetWithChilds( true );
680  collector.SortOn( a2dWalker_CollectCanvasObjectsSet::onName );
681  collector.SetSkipNotRenderedInDrawing( true );
682  collector.Start( drawing->GetRootObject() );
683 
684  m_structureSet = collector.m_found;
685  m_listbox->Clear();
686 
687  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
688  {
689  a2dCanvasObject* obj = *iter;
690  if ( obj == m_drawing->GetRootObject() )
691  {
692  m_listbox->Append( obj->GetName() + wxT( "=>top" ) );
693  }
694  else
695  m_listbox->Append( obj->GetName() );
696  }
697  }
698 
699  wxString mess = wxT( "" );
700  mess.Printf( _( "Number of structures: %ld" ), m_structureSet.size() - 1 );
701  m_numberObjects->SetLabel( mess );
702 
703  // set the first structure as default and give it the focus
704  if ( m_structureSet.size() )
705  m_listbox->SetSelection( 0, true );
706  m_object = NULL;
707 }
708 
710 {
711  event.Skip();
712 }
713 
715 {
716  CmApply();
717  EndModal( wxID_OK );
718 }
719 
721 {
722  EndModal( wxID_CANCEL );
723 }
724 
726 {
727  CmApply();
728 }
729 
730 void a2dCanvasObjectsChooseDialog::CmApply()
731 {
732  wxString buf;
733  buf = m_listbox->GetStringSelection();
734  for( a2dCanvasObjectsSet::iterator iter = m_structureSet.begin(); iter != m_structureSet.end(); ++iter )
735  {
736  a2dCanvasObject* obj = *iter;
737  wxString name = obj->GetName();
738  if ( !name.Cmp( buf ) )
739  {
740  m_object = obj;
741  break;
742  }
743  else if ( name + wxT( "=>top" ) == buf )
744  {
745  m_object = obj;
746  break;
747  }
748  }
749 }
750 
752 {
753  return m_object;
754 }
755 
756 void a2dCanvasObjectsChooseDialog::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
757 {
758  if ( IsModal() )
759  EndModal( wxID_OK );
760  else
761  {
762  SetReturnCode( wxID_OK );
763  Show( false );
764  }
765 }
766 
767 const int BRUSH_BUTTON_OK = wxID_HIGHEST + 5801 ;
768 const int BRUSH_BUTTON_CANCEL = wxID_HIGHEST + 5802 ;
769 
770 BEGIN_EVENT_TABLE( CanvasFillDialog, wxDialog )
771  EVT_BUTTON ( BRUSH_BUTTON_OK, CanvasFillDialog::CmOk )
772  EVT_BUTTON ( BRUSH_BUTTON_CANCEL , CanvasFillDialog::CmCancel )
773  EVT_CLOSE ( CanvasFillDialog::OnCloseWindow )
774 END_EVENT_TABLE()
775 
776 CanvasFillDialog::CanvasFillDialog( wxFrame* parent ):
777  wxDialog( parent, -1, _T( "choose style" ), wxDefaultPosition, wxDefaultSize, ( wxCAPTION ), _T( "style dialog" ) )
778 {
779  m_parent = parent;
780 
781  wxString choices[] =
782  {
783  _T( "Transparent (no fill)" ),
784  _T( "Solid" ),
785  _T( "Backward diagonal hatch" ),
786  _T( "Cross-diagonal hatch" ),
787  _T( "Forward diagonal hatch" ),
788  _T( "Cross hatch" ),
789  _T( "Horizontal hatch" ),
790  _T( "Vertical hatch" ),
791  _T( "wxSTIPPLE" ),
792  _T( "wxSTIPPLE_MASK_OPAQUE" ),
793  _T( "wxSTIPPLE_MASK_OPAQUE_TRANSPARENT" ),
794  _T( "wxGRADIENT_FILL_XY_LINEAR" ),
795  _T( "wxGRADIENT_FILL_XY_RADIAL" ),
796  _T( "wxGRADIENT_FILL_XY_DROP" )
797  };
798 
799  m_choice = new wxChoice( this, -1, wxDefaultPosition, wxDefaultSize, 14, choices );
800  m_choice->SetSelection( 1 );
801  m_button1 = new wxButton( this, BRUSH_BUTTON_OK, _T( "Ok" ), wxDefaultPosition, wxSize( 55, 20 ) );
802  m_button2 = new wxButton( this, BRUSH_BUTTON_CANCEL, _T( "Cancel" ), wxDefaultPosition, wxSize( 55, 20 ) );
803 
804  wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
805  sizer->Add( m_choice, 1, wxEXPAND | wxALL, 1 );
806 
807  wxBoxSizer* sizerb = new wxBoxSizer( wxHORIZONTAL );
808  sizerb->Add( m_button1, 0, wxALL, 1 );
809  sizerb->Add( m_button2, 0, wxALL, 1 );
810 
811  sizer->Add( sizerb, 0, wxALIGN_CENTER );
812 
813  SetAutoLayout( true );
814 
815  sizer->SetSizeHints( this );
816  sizer->Fit( this );
817 
818  SetSizer( sizer );
819 
820  Layout();
821 
822 }
823 
824 void CanvasFillDialog::CmCancel( wxCommandEvent& )
825 {
826  EndModal( wxID_CANCEL );
827 }
828 
829 void CanvasFillDialog::CmOk( wxCommandEvent& )
830 {
831  switch( m_choice->GetSelection() )
832  {
833  case 0: m_style=a2dFILL_TRANSPARENT;
834  break;
835  case 1: m_style=a2dFILL_SOLID;
836  break;
837  case 2: m_style=a2dFILL_BDIAGONAL_HATCH;
838  break;
839  case 3: m_style=a2dFILL_CROSSDIAG_HATCH;
840  break;
841  case 4: m_style=a2dFILL_FDIAGONAL_HATCH;
842  break;
843  case 5: m_style=a2dFILL_CROSS_HATCH;
844  break;
845  case 6: m_style=a2dFILL_HORIZONTAL_HATCH;
846  break;
847  case 7: m_style=a2dFILL_VERTICAL_HATCH;
848  break;
849  case 8: m_style=a2dFILL_STIPPLE;
850  break;
851  case 9: m_style=a2dFILL_STIPPLE_MASK_OPAQUE;
852  break;
854  break;
855  case 11: m_style=a2dFILL_GRADIENT_FILL_XY_LINEAR;
856  break;
857  case 12: m_style=a2dFILL_GRADIENT_FILL_XY_RADIAL;
858  break;
859  case 13: m_style=a2dFILL_GRADIENT_FILL_XY_DROP;
860  break;
861  default: m_style=a2dFILL_SOLID;
862  }
863  EndModal( wxID_OK );
864 }
865 
866 void CanvasFillDialog::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
867 {
868  EndModal( wxID_CANCEL );
869 }
870 
871 const int PEN_BUTTON_OK = wxID_HIGHEST + 5901 ;
872 const int PEN_BUTTON_CANCEL = wxID_HIGHEST + 5902 ;
873 
874 BEGIN_EVENT_TABLE( PenDialog, wxDialog )
875  EVT_BUTTON ( PEN_BUTTON_OK, PenDialog::CmOk )
876  EVT_BUTTON ( PEN_BUTTON_CANCEL , PenDialog::CmCancel )
877  EVT_CLOSE ( PenDialog::OnCloseWindow )
878 END_EVENT_TABLE()
879 
880 PenDialog::PenDialog( wxFrame* parent ):
881  wxDialog( parent, -1, _T( "choose style" ), wxDefaultPosition, wxDefaultSize, ( wxDEFAULT_DIALOG_STYLE ), _T( "style dialog" ) )
882 {
883  m_parent = parent;
884 
885  wxString choices[] =
886  {
887  _T( "Solid style." ),
888  _T( "No pen is used." ),
889  _T( "Dotted style." ),
890  _T( "Long dashed style." ),
891  _T( "Short dashed style." ),
892  _T( "Dot and dash style." ),
893  _T( "Use the stipple bitmap." ),
894  _T( "Backward diagonal hatch." ),
895  _T( "Cross-diagonal hatch." ),
896  _T( "Forward diagonal hatch." ),
897  _T( "Cross hatch." ),
898  _T( "Horizontal hatch." ),
899  _T( "Vertical hatch." )
900  };
901 
902  m_choice = new wxChoice( this, -1, wxDefaultPosition, wxDefaultSize, 13, choices );
903  m_choice->SetSelection( 1 );
904  m_button1 = new wxButton( this, PEN_BUTTON_OK, _T( "Ok" ), wxDefaultPosition, wxSize( 55, 20 ) );
905  m_button2 = new wxButton( this, PEN_BUTTON_CANCEL, _T( "Cancel" ), wxDefaultPosition, wxSize( 55, 20 ) );
906 
907  wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
908  sizer->Add( m_choice, 1, wxEXPAND | wxALL, 1 );
909 
910  wxBoxSizer* sizerb = new wxBoxSizer( wxHORIZONTAL );
911  sizerb->Add( m_button1, 0, wxALL, 1 );
912  sizerb->Add( m_button2, 0, wxALL, 1 );
913 
914  sizer->Add( sizerb, 0, wxALIGN_CENTER );
915 
916  SetAutoLayout( true );
917 
918  sizer->SetSizeHints( this );
919  sizer->Fit( this );
920 
921  SetSizer( sizer );
922 
923 
924 }
925 
926 void PenDialog::CmCancel( wxCommandEvent& )
927 {
928  EndModal( wxID_CANCEL );
929 }
930 
931 void PenDialog::CmOk( wxCommandEvent& )
932 {
933  switch( m_choice->GetSelection() )
934  {
935  case 0: m_style=a2dSTROKE_SOLID;
936  break;
937  case 1: m_style=a2dSTROKE_TRANSPARENT;
938  break;
939  case 2: m_style=a2dSTROKE_DOT;
940  break;
941  case 3: m_style=a2dSTROKE_LONG_DASH;
942  break;
943  case 4: m_style=a2dSTROKE_SHORT_DASH;
944  break;
945  case 5: m_style=a2dSTROKE_DOT_DASH;
946  break;
947  case 6: m_style=a2dSTROKE_BDIAGONAL_HATCH;
948  break;
949  case 7: m_style=a2dSTROKE_CROSSDIAG_HATCH;
950  break;
951  case 8: m_style=a2dSTROKE_FDIAGONAL_HATCH;
952  break;
953  case 9: m_style=a2dSTROKE_CROSS_HATCH;
954  break;
955  case 10: m_style=a2dSTROKE_HORIZONTAL_HATCH;
956  break;
957  case 11: m_style=a2dSTROKE_VERTICAL_HATCH;
958  break;
959  default: m_style=a2dSTROKE_SOLID;
960  }
961  EndModal( wxID_OK );
962 }
963 
964 void PenDialog::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
965 {
966  EndModal( wxID_CANCEL );
967 }
968 
969 
970 const int LOGICALFUNCTION_BUTTON_OK = wxID_HIGHEST + 5801 ;
971 const int LOGICALFUNCTION_BUTTON_CANCEL = wxID_HIGHEST + 5802 ;
972 
973 BEGIN_EVENT_TABLE( LogicalFunction, wxDialog )
974  EVT_BUTTON ( LOGICALFUNCTION_BUTTON_OK, LogicalFunction::CmOk )
975  EVT_BUTTON ( LOGICALFUNCTION_BUTTON_CANCEL , LogicalFunction::CmCancel )
976  EVT_CLOSE ( LogicalFunction::OnCloseWindow )
977 END_EVENT_TABLE()
978 
979 LogicalFunction::LogicalFunction( wxFrame* parent ):
980  wxDialog( parent, -1, _T( "choose style" ), wxDefaultPosition, wxDefaultSize, ( wxDEFAULT_DIALOG_STYLE ), _T( "style dialog" ) )
981 {
982  m_parent = parent;
983 
984  wxString choices[] =
985  {
986  _T( "wxCLEAR" ),
987  _T( "wxXOR" ),
988  _T( "wxINVERT" ),
989  _T( "wxOR_REVERSE" ),
990  _T( "wxAND_REVERSE" ),
991  _T( "wxCOPY" ),
992  _T( "wxAND" ),
993  _T( "wxAND_INVERT" ),
994  _T( "wxNO_OP" ),
995  _T( "wxNOR" ),
996  _T( "wxEQUIV" ),
997  _T( "wxSRC_INVERT" ),
998  _T( "wxOR_INVERT" ),
999  _T( "wxNAND" ),
1000  _T( "wxOR" ),
1001  _T( "wxSET" )
1002  };
1003 
1004  m_choice = new wxChoice( this, -1, wxDefaultPosition, wxDefaultSize, 16, choices );
1005  m_choice->SetSelection( 1 );
1006  m_button1 = new wxButton( this, LOGICALFUNCTION_BUTTON_OK, _T( "Ok" ), wxDefaultPosition, wxSize( 55, 20 ) );
1007  m_button2 = new wxButton( this, LOGICALFUNCTION_BUTTON_CANCEL, _T( "Cancel" ), wxDefaultPosition, wxSize( 55, 20 ) );
1008 
1009  wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
1010  sizer->Add( m_choice, 1, wxEXPAND | wxALL, 1 );
1011 
1012  wxBoxSizer* sizerb = new wxBoxSizer( wxHORIZONTAL );
1013  sizerb->Add( m_button1, 0, wxALL, 1 );
1014  sizerb->Add( m_button2, 0, wxALL, 1 );
1015 
1016  sizer->Add( sizerb, 0, wxALIGN_CENTER );
1017 
1018  SetAutoLayout( true );
1019 
1020  sizer->SetSizeHints( this );
1021  sizer->Fit( this );
1022 
1023  SetSizer( sizer );
1024 
1025 
1026 }
1027 
1028 void LogicalFunction::CmCancel( wxCommandEvent& )
1029 {
1030  EndModal( wxID_CANCEL );
1031 }
1032 
1033 void LogicalFunction::CmOk( wxCommandEvent& )
1034 {
1035  m_function = m_choice->GetSelection();
1036  switch( m_choice->GetSelection() )
1037  {
1038  case 0: m_function=wxCLEAR;
1039  break;
1040  case 1: m_function=wxXOR;
1041  break;
1042  case 2: m_function=wxINVERT;
1043  break;
1044  case 3: m_function=wxOR_REVERSE;
1045  break;
1046  case 4: m_function=wxAND_REVERSE;
1047  break;
1048  case 5: m_function=wxCOPY;
1049  break;
1050  case 6: m_function=wxAND;
1051  break;
1052  case 7: m_function=wxAND_INVERT;
1053  break;
1054  case 8: m_function=wxNO_OP;
1055  break;
1056  case 9: m_function=wxNOR;
1057  break;
1058  case 10: m_function=wxEQUIV;
1059  break;
1060  case 11: m_function=wxSRC_INVERT;
1061  break;
1062  case 12: m_function=wxOR_INVERT;
1063  break;
1064  case 13: m_function=wxNAND;
1065  break;
1066  case 14: m_function=wxOR;
1067  break;
1068  case 15: m_function=wxSET;
1069  break;
1070  default: m_function=wxCOPY;
1071  }
1072  EndModal( wxID_OK );
1073 }
1074 
1075 void LogicalFunction::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
1076 {
1077  EndModal( wxID_CANCEL );
1078 }
1079 
1080 
1081 
1082 #define PAT_COLLUMNS 6
1083 #define PAT_ROWS 6
1084 #define PAT_ROWS_VIS 6
1085 
1086 #define PD_PANEL1_X 0
1087 #define PD_PANEL1_Y 0
1088 #define PD_PANEL1_W (PAT_COLLUMNS*40 + 20)
1089 #define PD_PANEL1_H (PAT_ROWS_VIS*40 )
1090 
1091 #define PD_BUTTON_W 32
1092 #define PD_BUTTON_H 32
1093 
1094 BEGIN_EVENT_TABLE( PatternDialog, wxDialog )
1095  EVT_CUSTOM_RANGE( wxEVT_COMMAND_BUTTON_CLICKED, 800, 800 + NR_PATTERNS, PatternDialog::Cm_P_BitB )
1096 
1097  EVT_CLOSE ( PatternDialog::OnCloseWindow )
1098  EVT_ACTIVATE ( PatternDialog::OnActivate )
1099 
1100 END_EVENT_TABLE()
1101 
1102 
1103 
1104 // the contructor calls it's parent
1105 PatternDialog::PatternDialog( wxWindow* parent, FillPatterns* fills, const wxString& title, long style, const wxString& name ):
1106  wxDialog( parent, -1, title, wxPoint( 0, 0 ), wxSize( PD_PANEL1_W, PD_PANEL1_H ), style, name )
1107 {
1108  m_parent = parent;
1109 
1110  m_choosen = 0;
1111 
1112  m_panel1 = new wxPanel( this, -1, wxPoint( PD_PANEL1_X, PD_PANEL1_Y ), wxSize( PD_PANEL1_W, PD_PANEL1_H ) );
1113  m_scroll = new wxScrolledWindow( m_panel1, -1, wxPoint( PD_PANEL1_X, PD_PANEL1_Y ), wxSize( PD_PANEL1_W, PD_PANEL1_H ), wxVSCROLL, _T( "scrolledWindow" ) );
1114  m_scroll->SetScrollbars( 40, 40, 6, 12 );
1115 
1116 
1117  for ( int i = 0; i < NR_PATTERNS; i++ )
1118  {
1119  wxMemoryDC dcmemtemp2;
1120  wxColour white( _T( "WHITE" ) );
1121  wxColour black( _T( "BLACK" ) );
1122 
1123  wxBitmap* help = new wxBitmap( 32, 32, -1 );
1124 
1125  dcmemtemp2.SelectObject( *help );
1126  wxBrush brushbitm( *fills->GetPattern( i ) );
1127  dcmemtemp2.SetBrush( brushbitm );
1128 
1129  //convert monogrome to color bitmap
1130  //in WinNt any monochrome bitmapbrush is drawn to the dest. dc back and fore ground colors
1131  dcmemtemp2.SetTextForeground( white );
1132  dcmemtemp2.SetTextBackground( black );
1133  dcmemtemp2.DrawRectangle( 0, 0, 32, 32 );
1134  dcmemtemp2.SelectObject( wxNullBitmap );
1135  m_patternbut[i] = new wxBitmapButton( m_scroll, 800 + i, *help,
1136  wxPoint( ( ( i % PAT_COLLUMNS ) * 40 ), ( ( i / PAT_ROWS ) * 40 ) ) );
1137  delete help;
1138  }
1139  Fit();
1140  Center( wxBOTH );
1141 }
1142 
1143 // free used memory
1144 PatternDialog::~PatternDialog()
1145 {
1146 }
1147 
1148 wxColour* PatternDialog::ltowxc( long colour )
1149 {
1150  unsigned char red, green, blue;
1151 
1152  blue = colour / 65536;
1153  green = ( colour % 65536 ) / 256;
1154  red = colour % 256;
1155 
1156  return new wxColour( red, green, blue );
1157 }
1158 
1159 void PatternDialog::Cm_P_BitB( wxEvent& event )
1160 {
1161  m_choosen = event.GetId() - 800;
1162  EndModal( m_choosen );
1163 }
1164 
1165 void PatternDialog::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
1166 {
1167 }
1168 
1169 void PatternDialog::OnActivate( wxActivateEvent& WXUNUSED( event ) )
1170 {
1171 
1172 }
1173 
1174 FillPatterns::FillPatterns()
1175 {
1176  wxString file;
1177  for ( int i = 0; i < NR_PATTERNS; i++ )
1178  {
1179  file.Printf( wxT( "pat%-2.2d.bmp" ), i + 1 );
1180 
1181  //m_fillbitmaps[i] = new wxBitmap(32,32,-1);
1182  file = a2dGlobals->GetIconPathList().FindValidPath( file );
1183 
1184  wxImage image;
1185 
1186  if ( ! image.LoadFile( file, wxBITMAP_TYPE_BMP ) )
1187  a2dGeneralGlobals->ReportErrorF( a2dError_FileCouldNotOpen, _( "CVG : invalid bitmap %s" ), file.c_str() );
1188 
1189  m_fillbitmaps[i] = new wxBitmap( image );
1190 
1191  //set mask to monochrome bitmap based on color bitmap
1192 
1193  wxColour white( wxT( "WHITE" ) );
1194  wxColour black( wxT( "BLACK" ) );
1195 
1196  wxMask* monochrome_mask = new wxMask( *m_fillbitmaps[i], black );
1197  m_fillbitmaps[i]->SetMask( monochrome_mask );
1198  }
1199 
1200 }
1201 
1202 FillPatterns::~FillPatterns()
1203 {
1204  for ( int i = 0; i < NR_PATTERNS; i++ )
1205  delete m_fillbitmaps[i];
1206 }
1207 
1208 wxBitmap* FillPatterns::GetPattern( short patternnr )
1209 {
1210  return m_fillbitmaps[patternnr];
1211 }
1212 
1213 
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_A2DCHOOSE_IDNAME, const wxString &caption=SYMBOL_A2DCHOOSE_TITLE, const wxPoint &pos=SYMBOL_A2DCHOOSE_POSITION, const wxSize &size=SYMBOL_A2DCHOOSE_SIZE, long style=SYMBOL_A2DCHOOSE_STYLE)
Creation.
Definition: strucdlg.cpp:501
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Definition: gen.h:75
diagram is an appearance for a2dCameleon
Definition: cameleon.h:382
a2dCanvasObject * GetCanvasObject()
Pointer to object selected.
Definition: strucdlg.cpp:751
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
Definition: gen.cpp:1310
a2dDrawingId GetDrawingId()
set special id to differentiate drawings
Definition: drawing.h:721
wxString FindValidPath(const wxString &filename, bool reportError=true)
Find the first full path for which the file exists.
Definition: gen.cpp:4486
choose a fill pattern
Definition: strucdlg.h:299
a2dCanvasObject * GetCanvasObject()
Pointer to object selected.
Definition: strucdlg.cpp:373
a2dCommand * GetCommand()
the command ( if there was one ) that did it.
Definition: comevt.h:759
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
Definition: drawing.h:521
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
Definition: comevt.h:795
Base class for adding to the list of appearances in a a2dCameleon.
Definition: cameleon.h:217
const a2dError a2dError_FileCouldNotOpen
a2dGlobal * a2dGlobals
global a2dCanvasGlobal to have easy access to global settings
Definition: artglob.cpp:34
a2dPathList & GetIconPathList()
Path for Icons and small bitmaps.
Definition: artglob.h:155
to choose fill
Definition: strucdlg.h:213
a2dCameleonSymbolicRef
Definition: cameleon.h:874
object to show several appearance views on what it contains
Definition: cameleon.h:630
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
static bool ShowToolTips()
Should we show tooltips?
Definition: strucdlg.h:184
static const a2dCommandId Id
Print the current document or view.
Definition: drawing.h:2715
virtual a2dObject * GetRefObject() const
when a2dProperty, return its value else assert
Definition: gen.cpp:1976
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
Definition: canobj.cpp:2551
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
Definition: canglob.h:1262
void OnComEvent(a2dComEvent &event)
document changed
Definition: strucdlg.cpp:404
void OnStructIdApplyClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for CHOOSE_ID_APPLY
Definition: strucdlg.cpp:720
void SetWithChilds(bool check)
if set, objects must have childs
Definition: algos.h:441
void Init(a2dCanvasObjectList *objects)
take over object to show from objects
Definition: strucdlg.cpp:162
void OnStructIdListboxDoubleClicked(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event handler for STRUCT_ID_LISTBOX
Definition: strucdlg.cpp:333
void Init(a2dCanvasObjectList *objects)
take over object to show from objects
Definition: strucdlg.cpp:608
static const a2dSignal sig_changedShowObject
Definition: drawer.h:1513
a2dCanvasObject * m_object
Pointer to the choosen object.
Definition: strucdlg.h:112
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
Definition: gen.h:564
const a2dCommandId * GetCommandId()
a specific id for this command.
Definition: comevt.h:179
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Definition: gen.h:123
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
Definition: drawer.h:680
a2dCanvasObject * m_object
Pointer to the choosen object.
Definition: strucdlg.h:207
a2dCameleon * GetCameleon()
get referenced a2dCameleon
Definition: cameleon.cpp:1888
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
Definition: comevt.cpp:1148
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
Definition: strucdlg.cpp:756
int m_choosen
the choosen pattern.
Definition: strucdlg.h:331
Tappear * GetAppearance(bool autoCreate=false)
Get a specific a2dAppear derived class instance from here.
Definition: cameleon.h:666
collect a2dCanvasObject&#39;s in a hierarchy of a a2dCanvasDocument
Definition: algos.h:408
static bool ShowToolTips()
Should we show tooltips?
Definition: strucdlg.h:89
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
Definition: comevt.cpp:842
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_A2DCANVASOBJECTSDIALOG_IDNAME, const wxString &caption=SYMBOL_A2DCANVASOBJECTSDIALOG_TITLE, const wxPoint &pos=SYMBOL_A2DCANVASOBJECTSDIALOG_POSITION, const wxSize &size=SYMBOL_A2DCANVASOBJECTSDIALOG_SIZE, long style=SYMBOL_A2DCANVASOBJECTSDIALOG_STYLE)
Creation.
Definition: strucdlg.cpp:89
to choose the way drawing is done ( not yet implemented ).
Definition: strucdlg.h:259
void OnStructIdApplyClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for STRUCT_ID_APPLY
Definition: strucdlg.cpp:324
a2dCanvasObjectsSet m_structureSet
Pointer to object list.
Definition: strucdlg.h:109
for choosing a a2dCanvasObject from a list.
bool NameSorter(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on name
Definition: algos.cpp:585
void Cm_P_BitB(wxEvent &event)
Get chosen pattern.
Definition: strucdlg.cpp:1159
a2dCommandProcessor * GetCommandProcessor() const
Returns a pointer to the command processor associated with this document.
Definition: drawing.h:549
a2dCanvasObjectsSet m_found
objects found
Definition: algos.h:448
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
Definition: drawing.cpp:375
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
Definition: strucdlg.cpp:378
Event sent to a2dCommandProcessor.
Definition: comevt.h:701
void OnStructIdListboxSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for STRUCT_ID_LISTBOX
Definition: strucdlg.cpp:304
see a2dComEvent
Definition: gen.h:371
pen dialog fro choosing a stroke.
Definition: strucdlg.h:236
a2dDrawing * GetDrawing() const
get drawing via top object
Definition: drawer.cpp:726
void OnStructIdHideClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for STRUCT_ID_HIDE
Definition: strucdlg.cpp:309
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
Definition: canglob.cpp:1234
all headers of the canvas module
void OnCloseWindow(wxCloseEvent &event)
Close window if EXIT-button is pressed.
Definition: strucdlg.cpp:1165
void OnStructIdListboxDoubleClicked(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event handler for CHOOSE_ID_LISTBOX
Definition: strucdlg.cpp:725
void OnStructIdHideClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for CHOOSE_ID_HIDE
Definition: strucdlg.cpp:714
void OnStructIdListboxSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for CHOOSE_ID_LISTBOX
Definition: strucdlg.cpp:709
a2dAppear * GetAppearanceByClassName(const wxString &appearranceClassName) const
get appearance by its Classname
Definition: cameleon.cpp:1305
Contain one drawing as hierarchical tree of a2dCanvasObject&#39;s.
Definition: drawing.h:434
a2dCanvasObjectsSet m_structureSet
Pointer to object list.
Definition: strucdlg.h:204
strucdlg.cpp Source File -- Sun Oct 12 2014 17:04:24 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation