24 #include <wx/statline.h>
28 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
29 #include <wx/msw/msvcrt.h>
36 #define LPD_PATTERNBOX_W 50
38 #define LPD_PATTERNBOX_W 30
41 const int LAY_BUTTON_HIDE = wxID_HIGHEST + 4801 ;
43 const int LAY_BUTTON_CANCEL = wxID_HIGHEST + 4802 ;
45 const int LAY_BUTTON_VISIBLE = wxID_HIGHEST + 4803 ;
47 const int LAY_BUTTON_OUTLINE = wxID_HIGHEST + 5961 ;
49 const int LAY_BUTTON_READ = wxID_HIGHEST + 4804 ;
51 const int LAY_BUTTON_SELECT = wxID_HIGHEST + 4805 ;
53 const int LAY_BUTTON_PREV = wxID_HIGHEST + 4806 ;
55 const int LAY_BUTTON_NEXT = wxID_HIGHEST + 4807 ;
57 const int LAY_EDIT_NAME = wxID_HIGHEST + 4808 ;
59 const int LAY_BUTTON_RESTORE = wxID_HIGHEST + 4812 ;
61 const int LAY_BUTTON_SAVETOFILE = wxID_HIGHEST + 4813 ;
63 const int LAY_BUTTON_LOADFROMFILE = wxID_HIGHEST + 4814 ;
65 const int LAY_BUTTON_SORT = wxID_HIGHEST + 4815 ;
67 const int ID_AVAILABLE = wxID_HIGHEST + 5000;
68 const int ID_LAYERNAME = wxID_HIGHEST + 5100;
69 const int ID_VISIBLE = wxID_HIGHEST + 5200;
70 const int ID_SELECTABLE = wxID_HIGHEST + 5300;
71 const int ID_READ = wxID_HIGHEST + 5400;
72 const int ID_OUTLINE = wxID_HIGHEST + 5450;
73 const int ID_LAYERFILLCOLOR = wxID_HIGHEST + 5500;
74 const int ID_LAYERSTROKECOLOR = wxID_HIGHEST + 5600;
75 const int ID_LAYERPATTERN = wxID_HIGHEST + 5700;
76 const int ID_INMAP = wxID_HIGHEST + 5800;
77 const int ID_OUTMAP = wxID_HIGHEST + 5900;
78 const int ID_NUMBER = wxID_HIGHEST + 5950;
79 const int ID_AvailableTimer = wxID_HIGHEST + 5960;
82 #define CHECKTIME 3000
113 EVT_CUSTOM_RANGE( wxEVT_COMMAND_TEXT_ENTER, ID_LAYERNAME, ID_LAYERNAME + 9,
LayerPropertiesDialog::Cm_LayerName )
115 EVT_CUSTOM_RANGE( wxEVT_COMMAND_BUTTON_CLICKED, ID_NUMBER, ID_NUMBER + 9,
LayerPropertiesDialog::Cm_NumberBox )
117 EVT_CUSTOM_RANGE( wxEVT_COMMAND_CHECKBOX_CLICKED , ID_VISIBLE, ID_VISIBLE + 9,
LayerPropertiesDialog::Cm_VisibleBox )
118 EVT_CUSTOM_RANGE( wxEVT_COMMAND_CHECKBOX_CLICKED , ID_SELECTABLE, ID_SELECTABLE + 9,
LayerPropertiesDialog::Cm_SelectBox )
119 EVT_CUSTOM_RANGE( wxEVT_COMMAND_CHECKBOX_CLICKED , ID_READ, ID_READ + 9,
LayerPropertiesDialog::Cm_ReadBox )
120 EVT_CUSTOM_RANGE( wxEVT_COMMAND_CHECKBOX_CLICKED , ID_OUTLINE, ID_OUTLINE + 9,
LayerPropertiesDialog::Cm_OutLineBox )
122 EVT_CUSTOM_RANGE( wxEVT_COMMAND_BUTTON_CLICKED, ID_LAYERFILLCOLOR, ID_LAYERFILLCOLOR + 9,
LayerPropertiesDialog::Cm_F_BitB )
123 EVT_CUSTOM_RANGE( wxEVT_COMMAND_BUTTON_CLICKED, ID_LAYERSTROKECOLOR, ID_LAYERSTROKECOLOR + 9,
LayerPropertiesDialog::Cm_B_BitB )
124 EVT_CUSTOM_RANGE( wxEVT_COMMAND_BUTTON_CLICKED, ID_LAYERPATTERN, ID_LAYERPATTERN + 9,
LayerPropertiesDialog::Cm_P_BitB )
126 EVT_CUSTOM_RANGE( wxEVT_COMMAND_TEXT_ENTER , ID_INMAP, ID_INMAP + 9,
LayerPropertiesDialog::Cm_InMap )
127 EVT_CUSTOM_RANGE( wxEVT_COMMAND_TEXT_ENTER , ID_OUTMAP, ID_OUTMAP + 9,
LayerPropertiesDialog::Cm_OutMap )
142 return m_controlslayersetup->GetOrderIndex()[i];
144 return m_controlslayersetup->GetLayerIndex()[i];
147 a2dLayerInfo* LayerPropertiesDialog::GetDocLayerInfo(
int i )
158 LayerPropertiesDialog::LayerPropertiesDialog(
a2dHabitat* habitat, wxFrame* parent,
a2dLayers* layersetup,
const wxString& title,
long style,
const wxString& name ):
159 wxDialog( parent, -1, title, wxDefaultPosition, wxDefaultSize, style, name )
174 SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
176 m_dialogLastUpdate = wxDateTime::Now();
182 m_brush =
new wxBrush();
187 m_cdata =
new wxColourData();
188 m_cdata->SetChooseFull(
true );
192 style_noresize = ( wxCAPTION );
194 style_noresize = ( wxSYSTEM_MENU | wxCAPTION );
198 m_cd =
new wxColourDialog(
this, m_cdata );
200 wxFlexGridSizer* alllayerline =
new wxFlexGridSizer( 11 );
201 alllayerline->AddGrowableCol( 1 );
202 wxSizer* all =
new wxBoxSizer( wxVERTICAL );
203 all->Add( alllayerline, 0, wxGROW );
205 m_numberlabel =
new wxStaticText(
this, -1, _T(
"Nr" ) );
206 alllayerline->Add( m_numberlabel, 0, wxALIGN_CENTRE );
207 m_namelabel =
new wxStaticText(
this, -1, _T(
"Name" ) );
208 alllayerline->Add( m_namelabel, 0, wxALIGN_CENTRE | wxALL, 2 );
209 m_visiblelabel =
new wxStaticText(
this, -1, _T(
"Vis" ) );
210 alllayerline->Add( m_visiblelabel, 0, wxALIGN_CENTRE | wxALL, 2 );
211 m_selectablelabel =
new wxStaticText(
this, -1, _T(
"Sel" ) );
212 alllayerline->Add( m_selectablelabel, 0, wxALIGN_CENTRE | wxALL, 2 );
213 m_outlinelabel =
new wxStaticText(
this, -1, _T(
"OutL" ) );
214 alllayerline->Add( m_outlinelabel, 0, wxALIGN_CENTRE | wxALL, 2 );
215 m_readlayerlabel =
new wxStaticText(
this, -1, _T(
"Read" ) );
216 alllayerline->Add( m_readlayerlabel, 0, wxALIGN_CENTRE | wxALL, 2 );
217 m_filllabel =
new wxStaticText(
this, -1, _T(
"Fill" ) );
218 alllayerline->Add( m_filllabel, 0, wxALIGN_CENTRE | wxALL, 2 );
219 m_borderlabel =
new wxStaticText(
this, -1, _T(
"Stroke" ) );
220 alllayerline->Add( m_borderlabel, 0, wxALIGN_CENTRE | wxALL, 2 );
221 m_patternlabel =
new wxStaticText(
this, -1, _T(
"Pattern" ) );
222 alllayerline->Add( m_patternlabel, 0, wxALIGN_CENTRE | wxALL, 2 );
223 m_mappinglabel =
new wxStaticText(
this, -1, _T(
"inMap" ) );
224 alllayerline->Add( m_mappinglabel, 0, wxALIGN_CENTRE | wxALL, 2 );
225 m_mappinglabel =
new wxStaticText(
this, -1, _T(
"outMap" ) );
226 alllayerline->Add( m_mappinglabel, 0, wxALIGN_CENTRE | wxALL, 2 );
229 for (
int i = 0; i < 10; i++ )
233 nrbuf.Printf( _T(
"%03d" ), i + 1 );
235 m_numberbox[i] =
new wxButton(
this, ID_NUMBER + i, nrbuf, wxDefaultPosition, wxSize( 25, 20 ), wxBU_EXACTFIT );
236 alllayerline->Add( m_numberbox[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTRE | wxGROW );
238 m_namebox[i] =
new wxTextCtrl(
this, ID_LAYERNAME + i, _T(
"" ), wxDefaultPosition, wxSize( 50, 20 ), wxTE_PROCESS_ENTER );
239 alllayerline->Add( m_namebox[i], 0, wxALIGN_CENTRE | wxALL | wxGROW, 0 );
240 m_namebox[i]->SetToolTip( _(
"Layer name" ) );
242 m_visiblebox[i] =
new wxCheckBox(
this, ID_VISIBLE + i, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
243 alllayerline->Add( m_visiblebox[i], 0, wxALIGN_CENTRE | wxALL, 1 );
245 m_selectablebox[i] =
new wxCheckBox(
this, ID_SELECTABLE + i, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
246 alllayerline->Add( m_selectablebox[i], 0, wxALIGN_CENTRE | wxALL, 1 );
248 m_outlinebox[i] =
new wxCheckBox(
this, ID_OUTLINE + i, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
249 alllayerline->Add( m_outlinebox[i], 0, wxALIGN_CENTRE | wxALL, 1 );
251 m_readlayerbox[i] =
new wxCheckBox(
this, ID_READ + i, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
252 alllayerline->Add( m_readlayerbox[i], 0, wxALIGN_CENTRE | wxALL, 1 );
254 m_fillbut[i] =
new wxButton(
this, ID_LAYERFILLCOLOR + i, _T(
"" ), wxDefaultPosition, wxSize( 20, 20 ), wxSIMPLE_BORDER );
255 alllayerline->Add( m_fillbut[i], 0, wxALIGN_CENTRE | wxALL, 1 );
257 m_borderbut[i] =
new wxButton(
this, ID_LAYERSTROKECOLOR + i, _T(
"" ), wxDefaultPosition, wxSize( 20, 20 ), wxSIMPLE_BORDER );
258 alllayerline->Add( m_borderbut[i], 0, wxALIGN_CENTRE | wxALL, 1 );
260 m_p_bitm[i] =
new wxBitmap( LPD_PATTERNBOX_W, LPD_B_H, -1 );
261 m_patternbut[i] =
new wxBitmapButton(
this, ID_LAYERPATTERN + i, *m_p_bitm[i], wxDefaultPosition, wxSize( 40, 20 ), wxSIMPLE_BORDER );
262 alllayerline->Add( m_patternbut[i], 0, wxALIGN_CENTRE | wxALL, 1 );
265 m_gdsinmap[i] =
new wxTextCtrl(
this, ID_INMAP + i, _T(
"" ), wxDefaultPosition, wxSize( 30, -1 ), wxTE_PROCESS_ENTER );
266 alllayerline->Add( m_gdsinmap[i], 0, wxALIGN_CENTRE | wxALL, 1 );
268 m_gdsoutmap[i] =
new wxTextCtrl(
this, ID_OUTMAP + i, _T(
"" ), wxDefaultPosition, wxSize( 30, -1 ), wxTE_PROCESS_ENTER );
269 alllayerline->Add( m_gdsoutmap[i], 0, wxALIGN_CENTRE | wxALL, 1 );
272 wxStaticBox* item1 =
new wxStaticBox(
this, -1, _T(
"" ) );
273 wxSizer* botline =
new wxStaticBoxSizer( item1, wxVERTICAL );
275 wxSizer* botline1 =
new wxBoxSizer( wxHORIZONTAL );
276 botline->Add( botline1 );
278 m_buttonSORT =
new wxButton(
this, LAY_BUTTON_SORT, _T(
"Sort Order" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
279 botline1->Add( m_buttonSORT, 0, wxALIGN_CENTRE | wxALL, 0 );
281 m_buttonVISIBLE =
new wxButton(
this, LAY_BUTTON_VISIBLE, _T(
"Hide All" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
282 botline1->Add( m_buttonVISIBLE, 0, wxALIGN_CENTRE | wxALL, 0 );
283 m_buttonSELECT =
new wxButton(
this, LAY_BUTTON_SELECT, _T(
"None Selectable" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
284 botline1->Add( m_buttonSELECT, 0, wxALIGN_CENTRE | wxALL, 0 );
285 m_buttonREAD =
new wxButton(
this, LAY_BUTTON_READ, _T(
"Read Non" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
286 botline1->Add( m_buttonREAD, 0, wxALIGN_CENTRE | wxALL, 0 );
287 m_buttonOutLine =
new wxButton(
this, LAY_BUTTON_OUTLINE, _T(
"OutLine" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
288 botline1->Add( m_buttonOutLine, 0, wxALIGN_CENTRE | wxALL, 0 );
290 botline->Add(
new wxStaticLine(
this, -1, wxDefaultPosition, wxSize( 200, 2 ), wxLI_HORIZONTAL ) , 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 2 );
292 wxSizer* botline2 =
new wxBoxSizer( wxHORIZONTAL );
293 botline->Add( botline2 );
295 m_buttonHIDE =
new wxButton(
this, LAY_BUTTON_HIDE, _T(
"Hide" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
296 botline2->Add( m_buttonHIDE, 0, wxALIGN_CENTRE | wxALL, 0 );
297 m_buttonCANCEL =
new wxButton(
this, LAY_BUTTON_CANCEL, _T(
"Cancel" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
298 botline2->Add( m_buttonCANCEL, 0, wxALIGN_CENTRE | wxALL, 0 );
300 botline2->Add(
new wxStaticLine(
this, -1, wxDefaultPosition, wxSize( 2, 20 ), wxLI_VERTICAL ) , 0, wxALIGN_CENTRE | wxALL, 2 );
302 m_buttonPREV =
new wxButton(
this, LAY_BUTTON_PREV, _T(
"< Previous" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
303 botline2->Add( m_buttonPREV, 0, wxALIGN_CENTRE | wxALL, 0 );
304 m_buttonNEXT =
new wxButton(
this, LAY_BUTTON_NEXT, _T(
"Next >" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
305 botline2->Add( m_buttonNEXT, 0, wxALIGN_CENTRE | wxALL, 0 );
306 m_buttonRESTORE =
new wxButton(
this, LAY_BUTTON_RESTORE, _T(
"Restore" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
308 wxSizer* botline3 =
new wxBoxSizer( wxHORIZONTAL );
309 botline->Add( botline3 );
310 botline3->Add( m_buttonRESTORE, 0, wxALIGN_CENTRE | wxALL, 0 );
311 m_buttonSAVETOFILE =
new wxButton(
this, LAY_BUTTON_SAVETOFILE, _T(
"Save File" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
312 botline3->Add( m_buttonSAVETOFILE, 0, wxALIGN_CENTRE | wxALL, 0 );
313 m_buttonLOADFROMFILE =
new wxButton(
this, LAY_BUTTON_LOADFROMFILE, _T(
"Load File" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
314 botline3->Add( m_buttonLOADFROMFILE, 0, wxALIGN_CENTRE | wxALL, 0 );
321 SetAutoLayout(
true );
323 all->SetSizeHints(
this );
335 if ( drawingPart && layersetup )
341 Init( m_habitat->GetLayerSetup() );
348 LayerPropertiesDialog::~LayerPropertiesDialog()
358 delete m_fillpatterns;
364 for (
int i = 0; i < 10; i++ )
370 void LayerPropertiesDialog::Init(
a2dLayers* layersetup )
377 m_layersetup = layersetup;
379 m_buttonPREV->Enable();
380 m_buttonNEXT->Enable();
382 if ( m_startvalue <= 0 )
383 m_buttonPREV->Disable();
385 if ( m_startvalue + 10 >= wxMAXLAYER - 1 )
386 m_buttonNEXT->Disable();
388 FillControls( m_startvalue );
391 void LayerPropertiesDialog::OnComEvent(
a2dComEvent& event )
393 if ( GetEvtHandlerEnabled() )
406 a2dObject*
object =
property->GetRefObjectNA();
411 if ( layerinfo->GetStroke() != stroke )
413 FillControls( m_startvalue );
418 if ( layerinfo->GetFill() != fill )
420 FillControls( m_startvalue );
422 else if ( property->GetId() == a2dCanvasObject::PROPID_Layer )
424 layerinfo->
SetLayer( property->GetUint16() );
425 FillControls( m_startvalue );
438 FillControls( m_startvalue );
440 else if ( event.GetId() == a2dHabitat::sig_changedLayer )
443 FillControls( m_startvalue );
469 if ( GetEvtHandlerEnabled() )
481 void LayerPropertiesDialog::FillControls(
int start )
486 int All_Hided =
true;
488 int All_Outline =
true;
490 int currentInsertLayer = m_habitat->
GetLayer();
492 for (
int i = start; i < start + 10; i++ )
495 int x = i - m_startvalue;
501 buf.Printf( wxT(
"%i" ), layerinfo->
GetLayer() );
502 m_numberbox[x]->SetBackgroundColour( currentInsertLayer == i ? wxColour( 184, 232, 241 ) : wxColour( 255, 255, 255 ) );
503 m_numberbox[x]->SetForegroundColour( available ? wxColour( 255, 0, 0 ) : wxColour( 0, 0, 0 ) );
504 m_numberbox[x]->SetLabel( buf );
506 m_namebox[x]->SetBackgroundColour( currentInsertLayer == i ? wxColour( 184, 232, 241 ) : wxColour( 255, 255, 255 ) );
507 m_namebox[x]->SetForegroundColour( available ? wxColour( 255, 0, 0 ) : wxColour( 0, 0, 0 ) );
508 m_namebox[x]->SetValue( layerinfo->
GetName() );
509 m_namebox[x]->SetToolTip( layerinfo->
GetFeature() );
514 m_visiblebox[x]->SetValue( layerinfo->
GetVisible() ?
true : false );
515 m_selectablebox[x]->SetValue( layerinfo->
GetSelectable() ?
true : false );
519 m_outlinebox[x]->SetValue( !layerinfo->GetFill().
GetFilling() ?
true : false );
522 m_readlayerbox[x]->SetValue(
false );
526 m_readlayerbox[x]->SetValue(
true );
531 m_fillbut[x]->SetBackgroundColour( kleurtje );
535 m_borderbut[x]->SetBackgroundColour( kleurtje );
539 int w = m_patternbut[x]->GetBitmapLabel().GetWidth();
540 int h = m_patternbut[x]->GetBitmapLabel().GetHeight();
547 m_patternbut[x]->SetBitmapLabel( drawer->
GetBuffer() );
548 m_patternbut[x]->Refresh(
true );
554 m_gdsinmap[x]->SetValue( buf );
557 m_gdsoutmap[x]->SetValue( buf );
559 m_fillbut[x]->Refresh();
560 m_borderbut[x]->Refresh();
561 m_patternbut[x]->Refresh();
566 m_buttonVISIBLE->SetLabel( _T(
"Show All" ) );
567 m_buttonSELECT->SetLabel( _T(
"All Selectable" ) );
571 m_buttonSORT->SetLabel( _T(
"Sort Layer" ) );
573 m_buttonSORT->SetLabel( _T(
"Sort Order" ) );
576 m_buttonOutLine->SetLabel( _T(
"Outline All" ) );
578 m_buttonOutLine->SetLabel( _T(
"Outline Non" ) );
581 m_buttonREAD->SetLabel( _T(
"Read All" ) );
589 bool changed =
false;
591 SetEvtHandlerEnabled(
false );
596 for ( i = start; i < start + nrLayers; i++ )
598 int x = i - m_startvalue;
602 layerinfo->
SetName( m_namebox[x]->GetValue() );
603 layerinfo->
SetVisible( (
bool )m_visiblebox[x]->GetValue() );
604 layerinfo->
SetSelectable( (
bool )m_selectablebox[x]->GetValue() );
605 layerinfo->
SetRead( (
bool )( m_readlayerbox[x]->GetValue() ) );
607 layerinfo->
SetFillColour( m_fillbut[x]->GetBackgroundColour() );
612 a2dFill pfill = layerinfo->GetFill();
613 pfill.SetStipple( *( m_fillpatterns->GetPattern(
m_patterns[x] ) ) );
614 pfill.
SetColour( m_fillbut[x]->GetBackgroundColour() );
615 pfill.
SetColour2( m_fillbut[x]->GetBackgroundColour() );
624 m_gdsinmap[x]->GetValue().ToLong( &t );
626 m_gdsoutmap[x]->GetValue().ToLong( &t );
668 if ( &layerinfo->GetFill().GetStipple() != &layerinfodoc->GetFill().GetStipple() )
671 layerinfodoc->
SetFill( layerinfo->GetFill() );
691 ProcessEvent( changedlayer );
694 SetEvtHandlerEnabled(
true );
697 void LayerPropertiesDialog::CmHide( wxCommandEvent& )
711 void LayerPropertiesDialog::CmCancel( wxCommandEvent& event )
716 FillControls( m_startvalue );
722 void LayerPropertiesDialog::CmRestore( wxCommandEvent& WXUNUSED( event ) )
727 FillControls( m_startvalue );
737 SetEvtHandlerEnabled(
false );
739 SetEvtHandlerEnabled(
true );
744 wxString fullname = _(
"Mywxart2dlayers.cvg" );
746 wxString* layerfiledir =
a2dGeneralGlobals->GetVariablesHash().GetVariableString( wxT(
"lastLayerFileSavePath" ) );
749 layerfiledir =
a2dGeneralGlobals->GetVariablesHash().GetVariableString( wxT(
"layerFileSavePath" ) );
751 wxFileDialog fileDialog(
this,
752 _(
"Choose layer file to load" ),
753 layerfiledir ? *layerfiledir : wxT(
"" ),
756 wxFD_SAVE | wxFD_OVERWRITE_PROMPT
759 if ( fileDialog.ShowModal() != wxID_OK )
762 fullname = fileDialog.GetPath();
764 a2dGeneralGlobals->GetVariablesHash().SetVariableString( wxT(
"lastLayerFileSavePath" ), wxPathOnly( fullname ) );
766 SetEvtHandlerEnabled(
false );
768 SetCursor( wxCURSOR_WAIT );
769 m_layersetup->SaveLayers( fullname );
771 SetEvtHandlerEnabled(
true );
772 SetCursor( wxCURSOR_ARROW );
779 wxString* path =
a2dGeneralGlobals->GetVariablesHash().GetVariableString( wxT(
"lastLayerFileSavePath" ) );
781 wxFileDialog fileDialog(
this,
782 _(
"Choose layer file to load" ),
783 path ? *path : wxT(
"" ),
786 wxFD_OPEN | wxFD_FILE_MUST_EXIST
789 if ( fileDialog.ShowModal() != wxID_OK )
792 fullname = fileDialog.GetPath();
794 a2dGeneralGlobals->GetVariablesHash().SetVariableString( wxT(
"lastLayerFileSavePath" ), wxPathOnly( fullname ) );
796 SetCursor( wxCURSOR_WAIT );
797 #if wxART2D_USE_CVGIO
811 wxFAIL_MSG( wxT(
"wxART2D_USE_CVGIO is needed to load object from a file CVG file" ) );
812 #endif //wxART2D_USE_CVGIO
815 SetEvtHandlerEnabled(
false );
817 SetEvtHandlerEnabled(
true );
818 FillControls( m_startvalue );
819 SetCursor( wxCURSOR_ARROW );
823 void LayerPropertiesDialog::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
838 buf = m_buttonSORT->GetLabel();
839 if ( buf == wxT(
"Sort Layer" ) )
844 FillControls( m_startvalue );
847 void LayerPropertiesDialog::CmVisible( wxCommandEvent& )
851 buf = m_buttonVISIBLE->GetLabel();
852 if ( buf == wxT(
"Hide All" ) )
855 m_buttonVISIBLE->SetLabel( wxT(
"Show All" ) );
860 m_buttonVISIBLE->SetLabel( wxT(
"Hide All" ) );
863 m_controlslayersetup->SetAll_Layers_Visible( onoff );
865 m_layersetup->SetAll_Layers_Visible( onoff );
866 FillControls( m_startvalue );
869 void LayerPropertiesDialog::CmRead( wxCommandEvent& )
873 buf = m_buttonREAD->GetLabel();
874 if ( buf == wxT(
"Read Non" ) )
877 m_buttonREAD->SetLabel( _T(
"Read All" ) );
882 m_buttonREAD->SetLabel( wxT(
"Read Non" ) );
885 m_controlslayersetup->SetAll_Layers_Read( onoff );
886 m_layersetup->SetAll_Layers_Read( onoff );
888 FillControls( m_startvalue );
891 void LayerPropertiesDialog::CmOutLine( wxCommandEvent& )
895 buf = m_buttonOutLine->GetLabel();
896 if ( buf == wxT(
"Outline Non" ) )
899 m_buttonOutLine->SetLabel( _T(
"Outline All" ) );
904 m_buttonOutLine->SetLabel( wxT(
"Outline Non" ) );
907 m_controlslayersetup->SetAll_Layers_Outline( onoff );
908 m_layersetup->SetAll_Layers_Outline( onoff );
910 FillControls( m_startvalue );
913 void LayerPropertiesDialog::CmSelect( wxCommandEvent& )
917 buf = m_buttonSELECT->GetLabel();
918 if ( buf == wxT(
"All Selectable" ) )
921 m_buttonSELECT->SetLabel( _T(
"None Selectable" ) );
926 m_buttonSELECT->SetLabel( _T(
"All Selectable" ) );
929 m_controlslayersetup->SetAll_Layers_Selectable( onoff );
930 m_layersetup->SetAll_Layers_Selectable( onoff );
932 FillControls( m_startvalue );
935 void LayerPropertiesDialog::CmPrev( wxCommandEvent& )
937 m_buttonNEXT->Enable();
938 if ( m_startvalue - 10 >= 0 )
941 FillControls( m_startvalue );
944 if ( m_startvalue <= 0 )
945 m_buttonPREV->Disable();
951 void LayerPropertiesDialog::CmNext( wxCommandEvent& )
953 m_buttonPREV->Enable();
954 if ( m_startvalue + 10 < wxMAXLAYER )
957 FillControls( m_startvalue );
960 if ( m_startvalue + 10 >= wxMAXLAYER - 1 )
961 m_buttonNEXT->Disable();
967 void LayerPropertiesDialog::Cm_F_BitB( wxEvent& event )
969 if ( m_cd->ShowModal() == wxID_OK )
972 *m_cdata = m_cd->GetColourData();
973 col = m_cdata->GetColour();
974 int x =
event.GetId() - ID_LAYERFILLCOLOR;
975 int i = x + m_startvalue;
982 if ( col != layerinfodoc->GetFill().
GetColour() )
987 FillControls( m_startvalue );
994 void LayerPropertiesDialog::Cm_B_BitB( wxEvent& event )
996 if ( m_cd->ShowModal() == wxID_OK )
999 *m_cdata = m_cd->GetColourData();
1000 col = m_cdata->GetColour();
1002 int x =
event.GetId() - ID_LAYERSTROKECOLOR;
1003 int i = x + m_startvalue;
1008 if ( col != layerinfodoc->GetStroke().
GetColour() )
1013 FillControls( m_startvalue );
1020 void LayerPropertiesDialog::Cm_P_BitB( wxEvent& event )
1023 int x =
event.GetId() - ID_LAYERPATTERN;
1024 int i = x + m_startvalue;
1026 PatternDialog patternDialog(
this, m_fillpatterns, wxT(
"Patterns" ), ( wxSYSTEM_MENU | wxCAPTION ) );
1027 int choosen = patternDialog.ShowModal();
1028 patternDialog.Close();
1030 wxBitmap pat = *( m_fillpatterns->GetPattern( choosen ) );
1036 if ( choosen != 0 && choosen != 1 )
1049 pfill.SetStyle( style );
1068 layerinfodoc->
SetFill( layerinfo->GetFill() );
1070 FillControls( m_startvalue );
1077 void LayerPropertiesDialog::Cm_LayerName( wxEvent& event )
1079 int x =
event.GetId() - ID_LAYERNAME;
1080 int i = x + m_startvalue;
1083 layerinfo->
SetName( m_namebox[x]->GetValue() );
1084 layerinfodoc->
SetName( m_namebox[x]->GetValue() );
1088 void LayerPropertiesDialog::Cm_InMap( wxEvent& event )
1090 int x =
event.GetId() - ID_INMAP;
1091 int i = x + m_startvalue;
1095 m_gdsinmap[x]->GetValue().ToLong( &t );
1101 void LayerPropertiesDialog::Cm_OutMap( wxEvent& event )
1103 int x =
event.GetId() - ID_OUTMAP;
1104 int i = x + m_startvalue;
1106 m_gdsoutmap[x]->GetValue().ToLong( &t );
1114 void LayerPropertiesDialog::Cm_NumberBox( wxEvent& event )
1117 int dlayer =
event.GetId() - ID_NUMBER;
1119 int currentInsertLayer = m_habitat->
GetLayer();
1121 if ( currentInsertLayer != m_startvalue + dlayer )
1123 int oldinstlayer = currentInsertLayer-m_startvalue;
1124 m_numberbox[ oldinstlayer ]->SetBackgroundColour( *wxWHITE );
1125 m_namebox[ oldinstlayer ]->SetBackgroundColour( *wxWHITE );
1126 m_numberbox[ oldinstlayer ]->Refresh();
1127 m_namebox[ oldinstlayer ]->Refresh();
1129 m_habitat->
SetLayer( m_startvalue + dlayer,
true );
1131 m_numberbox[ dlayer ]->SetBackgroundColour( wxColour( 184, 232, 241 ) );
1132 m_namebox[ dlayer ]->SetBackgroundColour( wxColour( 184, 232, 241 ) );
1133 m_numberbox[ dlayer ]->Refresh();
1134 m_namebox[ dlayer ]->Refresh();
1138 void LayerPropertiesDialog::Cm_VisibleBox( wxEvent& event )
1140 int x =
event.GetId() - ID_VISIBLE;
1141 int i = x + m_startvalue;
1144 layerinfo->
SetVisible( (
bool )m_visiblebox[ x ]->GetValue() );
1155 layers->SetVisible( i, layerinfo->
GetVisible() );
1161 void LayerPropertiesDialog::Cm_OutLineBox( wxEvent& event )
1164 int x =
event.GetId() - ID_OUTLINE;
1165 int i = m_startvalue + x;
1168 a2dFill fill = layerinfo->GetFill();
1169 fill.
SetFilling( ! (
bool )m_outlinebox[ x ]->GetValue() );
1181 layerinfodoc->
SetFill( fill );
1186 void LayerPropertiesDialog::Cm_SelectBox( wxEvent& event )
1189 int x =
event.GetId() - ID_SELECTABLE;
1190 int i = m_startvalue + x;
1193 layerinfo->
SetSelectable( (
bool )m_selectablebox[ x ]->GetValue() );
1207 void LayerPropertiesDialog::Cm_ReadBox( wxEvent& event )
1210 int x =
event.GetId() - ID_READ;
1211 int i = m_startvalue + x;
1214 layerinfo->
SetRead( (
bool )m_readlayerbox[ x ]->GetValue() );
1228 void LayerPropertiesDialog::OnChar( wxKeyEvent& event )
1230 if ( event.GetKeyCode() == WXK_RETURN )
1233 else if ( event.GetKeyCode() == WXK_PAGEDOWN )
1235 wxCommandEvent eventc;
1238 else if ( event.GetKeyCode() == WXK_PAGEUP )
1240 wxCommandEvent eventc;
1253 void LayerPropertiesDialog::OnCharHook( wxKeyEvent& event )
1255 if ( event.GetKeyCode() == WXK_RETURN )
1259 else if ( event.GetKeyCode() == WXK_PAGEDOWN )
1261 wxCommandEvent eventc;
1264 else if ( event.GetKeyCode() == WXK_PAGEUP )
1266 wxCommandEvent eventc;
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
(In) Visible property that can be added to Docview Objects.
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Base class for all types of strokes, understood by a2dDrawer2D classes.
wxUint16 GetLayer() const
layer set for new objects.
static const a2dSignal sm_changedProperty
void SetSelectable(bool status)
set layer selectable
a2dSmrtPtr< a2dLayers > m_controlslayersetup
changed local setup which is shown in dialog and compared with the controlled external setup ...
void SetLayer(wxUint16 layer, bool setStyleOfLayer=false)
const wxString & GetFeature() const
this layer is part of a group of layers to present a feature ( metalized via etc. )...
wxColour GetColour2() const
return colour 2
void CmLoadFromFile(wxCommandEvent &event)
load layers settings in dialog from file
bool GetAvailable()
are there objects on this layer
dialog for defining style on an a2dCanvasObject
void SignalChange()
sent a sig_changedLayerInfo to a2dDrawing
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
virtual void SetName(const wxString &name)
Set name for layer.
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
wxColour GetStrokeColour() const
get first colour of stroke
void Update(unsigned int how=(a2dCANVIEW_UPDATE_ALL|a2dCANVIEW_UPDATE_BLIT), wxObject *hintObject=NULL)
see OnUpdate
This class implements drawing functions for wxDC based drawing.
void StoreControls(unsigned int start, unsigned int nrLayers=10)
get the values from the controls and store them
void CmSort(wxCommandEvent &)
sort order
wxColour GetColour() const
return colour 1
std::vector< a2dLayerInfoPtr > & GetLayerIndex()
return array index on Layer
wxBitmap GetBuffer() const
return buffer as a bitmap
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
bool GetVisible()
is the layer visible
static const a2dSignal sig_layersetupChanged
layer info changed id sent around when m_layersetup is changed.
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
int GetOutMapping()
mapping of internal layer index to external layer index
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
a2dFillStyle
Filling styles for a2dFill.
static const a2dSignal sig_changedLayer
when an object is removed from a layer,
layer dialog for changing layer settings.
void SetVisible(bool status)
set layer visible
void SetRead(bool status)
read this layer from input files
bool GetSelectable()
can objects on this layer be selected
virtual wxString GetName() const
Get name for layer.
int GetInMapping()
mapping of external file layer to internal layer index
static const a2dSignal sig_changedActiveDrawing
when active drawing is set, this signal is send to the drawing.
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
wxColour GetFillColour() const
get first colour of fill
void SetStrokeColour(const wxColour &colour)
set first colour of stroke
void SetPending(bool pending)
next to base sets m_indexed false
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
void CmSaveToFile(wxCommandEvent &event)
save layers settings in dialog to file
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
wxUint16 GetLayer() const
Returns the layer index where this object is drawn upon.
void SetColour(const wxColour &col)
set colour used for gradient and wxSTIPPLE_MASK_OPAQUE filling.
contains the layer properties for one layer,
void SetInMapping(wxUint16 layer)
read this layer from the given layer in input files
defines common settinsg for a habitat for a set of a2dCameleons.
void SetFillColour(const wxColour &colour)
set first colour of fill
bool LoadLayers(const wxString &filename)
save layers to a file
Dialog for displaying/editing layers and properties of layers.
bool GetFilling() const
if true, filling is on else filling is transparent.
static const a2dSignal sig_changedLayers
when more layers changed ( rerendering view is needed).
virtual void BeginDraw()
start to draw on this context (used to initialize a specific drawer)
void SetStroke(const wxColour &strokecolor, double width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
void SetOutMapping(wxUint16 layer)
write this layer from the given layer to output files
property to hold a a2dStroke type variable to be associated with a a2dObject
wxColour GetColour() const
return colour
Event sent to a2dCommandProcessor.
std::vector< a2dLayerInfoPtr > & GetOrderIndex()
return array index on Order
void SetLayerSetup(a2dLayers *layersetup)
set the layersettings for the canvas.
void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
a2dDrawing * GetDrawing() const
get drawing via top object
void SetFilling(bool OnOff)
int m_patterns[10]
the choosen pattern.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
all headers of the canvas module
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
property to hold a a2dFill type variable to be associated with a a2dObject
void SetColour2(const wxColour &col)
set colour 2 used for gradient and wxSTIPPLE_MASK_OPAQUE filling.
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
virtual void EndDraw()
end drawing on this context (used to reset a specific drawer)
bool GetRead()
does this layer need to be read in from a file.