23 #include <wx/platform.h>
24 #include <wx/clipbrd.h>
30 #define GROUPDLG_HSIZE 400
31 #define GROUPDLG_VSIZE 400
33 const int GROUP_BUTTON_OK = wxNewId();
34 const int GROUP_BUTTON_CANCEL = wxNewId();
35 const int GROUP_BUTTON_ADD_A = wxNewId();
36 const int GROUP_BUTTON_REMOVE_A = wxNewId();
37 const int GROUP_BUTTON_CLR_A = wxNewId();
38 const int GROUP_BUTTON_ADD_B = wxNewId();
39 const int GROUP_BUTTON_REMOVE_B = wxNewId();
40 const int GROUP_BUTTON_CLR_B = wxNewId();
41 const int GROUP_BUTTON_ADD_D = wxNewId();
42 const int GROUP_BUTTON_REMOVE_D = wxNewId();
44 const int ID_LISTBOX = wxNewId();
45 const int ID_CHECKBOX1 = wxNewId();
46 const int ID_CHECKBOX2 = wxNewId();
47 const int ID_CHECKBOX3 = wxNewId();
48 const int ID_TEXTCTRL = wxNewId();
52 EVT_BUTTON ( GROUP_BUTTON_CANCEL,
a2dGroupDlg::CmCancel )
53 EVT_BUTTON ( GROUP_BUTTON_ADD_A,
a2dGroupDlg::CmAdd_A )
54 EVT_BUTTON ( GROUP_BUTTON_REMOVE_A,
a2dGroupDlg::CmRemove_A )
55 EVT_BUTTON ( GROUP_BUTTON_CLR_A,
a2dGroupDlg::CmClear_A )
56 EVT_BUTTON ( GROUP_BUTTON_ADD_B,
a2dGroupDlg::CmAdd_B )
57 EVT_BUTTON ( GROUP_BUTTON_REMOVE_B,
a2dGroupDlg::CmRemove_B )
58 EVT_BUTTON ( GROUP_BUTTON_CLR_B,
a2dGroupDlg::CmClear_B )
59 EVT_BUTTON ( GROUP_BUTTON_ADD_D,
a2dGroupDlg::CmAdd_D )
60 EVT_BUTTON ( GROUP_BUTTON_REMOVE_D,
a2dGroupDlg::CmRemove_D )
65 wxDialog( parent, -1, title, wxDefaultPosition, wxSize( GROUPDLG_HSIZE, GROUPDLG_VSIZE ), style, name )
67 m_habitat = m_habitat;
76 wxSizer* item0 =
new wxBoxSizer( wxVERTICAL );
78 wxSizer* item1 =
new wxBoxSizer( wxHORIZONTAL );
80 wxStaticBox* item3 =
new wxStaticBox(
this, -1, _(
"layers" ) );
81 wxSizer* item2 =
new wxStaticBoxSizer( item3, wxVERTICAL );
83 m_listbox_main =
new wxListCtrl(
this, ID_LISTBOX, wxDefaultPosition, wxSize( 40, -1 ), wxLC_REPORT | wxLC_NO_HEADER );
84 item2->Add( m_listbox_main, 1, wxEXPAND | wxALL );
85 m_listbox_main->InsertColumn( 0, _T(
"Layers" ) );
87 item1->Add( item2, 1, wxGROW | wxALL, 0 );
89 wxSizer* item5 =
new wxBoxSizer( wxVERTICAL );
91 wxStaticBox* item7 =
new wxStaticBox(
this, -1, _(
"group A" ) );
92 wxSizer* item6 =
new wxStaticBoxSizer( item7, wxHORIZONTAL );
94 wxSizer* item8 =
new wxBoxSizer( wxVERTICAL );
96 wxButton* item9 =
new wxButton(
this, GROUP_BUTTON_ADD_A, _(
"add >>" ), wxDefaultPosition, wxDefaultSize, 0 );
97 item8->Add( item9, 0, wxALIGN_CENTRE | wxALL, 2 );
99 wxButton* item10 =
new wxButton(
this, GROUP_BUTTON_REMOVE_A, _(
"<< remove" ), wxDefaultPosition, wxDefaultSize, 0 );
100 item8->Add( item10, 0, wxALIGN_CENTRE | wxALL, 2 );
102 wxButton* item11 =
new wxButton(
this, GROUP_BUTTON_CLR_A, _(
"clear" ), wxDefaultPosition, wxDefaultSize, 0 );
103 item8->Add( item11, 0, wxALIGN_CENTRE | wxALL, 2 );
105 m_onlyselect_A =
new wxCheckBox(
this, ID_CHECKBOX1, _(
"selected" ), wxDefaultPosition, wxDefaultSize, 0 );
106 item8->Add( m_onlyselect_A, 0, wxALIGN_CENTRE | wxALL, 2 );
108 item6->Add( item8, 0, wxALIGN_CENTRE | wxALL, 0 );
110 m_listbox_a =
new wxListCtrl(
this, ID_LISTBOX, wxDefaultPosition, wxSize( 40, 100 ), wxLC_REPORT | wxLC_NO_HEADER );
111 item6->Add( m_listbox_a, 1, wxEXPAND | wxALL );
112 m_listbox_a->InsertColumn( 0, _T(
"Group A" ) );
114 item5->Add( item6, 1, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 0 );
116 wxStaticBox* item15 =
new wxStaticBox(
this, -1, _(
"group B" ) );
117 wxSizer* item14 =
new wxStaticBoxSizer( item15, wxHORIZONTAL );
119 wxSizer* item16 =
new wxBoxSizer( wxVERTICAL );
121 wxButton* item17 =
new wxButton(
this, GROUP_BUTTON_ADD_B, _(
"add >>" ), wxDefaultPosition, wxDefaultSize, 0 );
122 item16->Add( item17, 0, wxALIGN_CENTRE | wxALL, 2 );
124 wxButton* item18 =
new wxButton(
this, GROUP_BUTTON_REMOVE_B, _(
"<< remove" ), wxDefaultPosition, wxDefaultSize, 0 );
125 item16->Add( item18, 0, wxALIGN_CENTRE | wxALL, 2 );
127 wxButton* item19 =
new wxButton(
this, GROUP_BUTTON_CLR_B, _(
"clear" ), wxDefaultPosition, wxDefaultSize, 0 );
128 item16->Add( item19, 0, wxALIGN_CENTRE | wxALL, 2 );
130 m_onlyselect_B =
new wxCheckBox(
this, ID_CHECKBOX1, _(
"selected" ), wxDefaultPosition, wxDefaultSize, 0 );
131 item16->Add( m_onlyselect_B, 0, wxALIGN_CENTRE | wxALL, 2 );
133 item14->Add( item16, 0, wxALIGN_CENTRE | wxALL, 0 );
135 m_listbox_b =
new wxListCtrl(
this, ID_LISTBOX, wxDefaultPosition, wxSize( 40, 100 ), wxLC_REPORT | wxLC_NO_HEADER );
136 item14->Add( m_listbox_b, 1, wxGROW | wxALIGN_CENTER_HORIZONTAL | wxALL );
137 m_listbox_b->InsertColumn( 0, _T(
"Group B" ) );
139 item5->Add( item14, 1, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 0 );
141 wxStaticBox* item23 =
new wxStaticBox(
this, -1, _(
"Destination" ) );
142 wxSizer* item22 =
new wxStaticBoxSizer( item23, wxHORIZONTAL );
144 wxSizer* item24 =
new wxBoxSizer( wxVERTICAL );
146 wxButton* item25 =
new wxButton(
this, GROUP_BUTTON_ADD_D, _(
"Set Target >>" ), wxDefaultPosition, wxDefaultSize, 0 );
147 item24->Add( item25, 0, wxALIGN_CENTRE | wxALL, 2 );
149 m_clearTarget =
new wxCheckBox(
this, ID_CHECKBOX3, _(
"Clear" ), wxDefaultPosition, wxDefaultSize, 0 );
150 item24->Add( m_clearTarget, 0, wxALIGN_CENTRE | wxALL, 2 );
152 item22->Add( item24, 0, wxALIGN_CENTRE | wxALL, 0 );
154 m_destination =
new wxTextCtrl(
this, ID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize( 40, -1 ), 0 );
155 item22->Add( m_destination, 1, wxALIGN_CENTRE | wxALL, 0 );
157 item5->Add( item22, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 0 );
159 item1->Add( item5, 1, wxGROW | wxALIGN_CENTER_HORIZONTAL | wxALL, 0 );
161 item0->Add( item1, 1, wxGROW | wxALIGN_CENTER_VERTICAL, 0 );
163 wxSizer* item28 =
new wxBoxSizer( wxHORIZONTAL );
165 wxButton* item29 =
new wxButton(
this, GROUP_BUTTON_OK, _(
"OK" ), wxDefaultPosition, wxDefaultSize, 0 );
166 item28->Add( item29, 0, wxALIGN_CENTRE, 0 );
168 wxButton* item30 =
new wxButton(
this, GROUP_BUTTON_CANCEL, _(
"Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
169 item28->Add( item30, 0, wxALIGN_CENTRE, 0 );
171 item0->Add( item28, 0, wxALIGN_CENTRE, 0 );
175 m_listbox_main->SetColumnWidth( 0, wxLIST_AUTOSIZE );
176 m_listbox_a->SetColumnWidth( 0, wxLIST_AUTOSIZE );
177 m_listbox_b->SetColumnWidth( 0, wxLIST_AUTOSIZE );
178 m_listbox_main->SetColumnWidth( 0, 200 );
179 m_listbox_a->SetColumnWidth( 0, 200 );
180 m_listbox_b->SetColumnWidth( 0, 200 );
182 SetAutoLayout(
true );
184 item0->SetSizeHints(
this );
188 a2dGroupDlg::~a2dGroupDlg()
200 void a2dGroupDlg::Init()
216 for (
int i = 0; i < wxMAXLAYER; i++ )
220 layerLine.Printf( _T(
"%04d %s" ), i, lobj->
GetName().c_str() );
221 m_listbox_main->InsertItem( i, layerLine );
223 m_listbox_main->SetItemTextColour( i, *wxRED );
226 itemCol.SetText( layerLine );
227 itemCol.SetImage( -1 );
228 itemCol.SetData( i );
231 a2dLayerGroup::iterator iter = wxSTD find( groupa.begin(), groupa.end(), i );
232 if ( iter != groupa.end() )
233 m_listbox_a->InsertItem( itemCol );
234 iter = wxSTD find( groupb.begin(), groupb.end(), i );
235 if ( iter != groupb.end() )
236 m_listbox_b->InsertItem( itemCol );
240 m_destination->SetValue( layerLine );
249 void a2dGroupDlg::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
255 void a2dGroupDlg::CmAdd_A( wxCommandEvent& )
260 selcount = m_listbox_main->GetSelectedItemCount();
262 if ( selcount == 0 )
return;
267 item = m_listbox_main->GetNextItem( item,
269 wxLIST_STATE_SELECTED );
273 buf = m_listbox_main->GetItemText( item );
274 if ( m_listbox_a->FindItem( -1, buf ) == -1 )
277 itemCol.SetText( buf );
278 itemCol.SetImage( -1 );
279 itemCol.SetData( item );
280 m_listbox_a->InsertItem( itemCol );
283 m_listbox_a->SetColumnWidth( 0, wxLIST_AUTOSIZE );
284 m_listbox_a->SetColumnWidth( 0, 200 );
288 void a2dGroupDlg::CmAdd_B( wxCommandEvent& )
293 selcount = m_listbox_main->GetSelectedItemCount();
295 if ( selcount == 0 )
return;
300 item = m_listbox_main->GetNextItem( item,
302 wxLIST_STATE_SELECTED );
306 buf = m_listbox_main->GetItemText( item );
307 if ( m_listbox_b->FindItem( -1, buf ) == -1 )
310 itemCol.SetText( buf );
311 itemCol.SetImage( -1 );
312 itemCol.SetData( item );
313 m_listbox_b->InsertItem( itemCol );
316 m_listbox_b->SetColumnWidth( 0, wxLIST_AUTOSIZE );
317 m_listbox_b->SetColumnWidth( 0, 200 );
321 void a2dGroupDlg::CmAdd_D( wxCommandEvent& )
325 long item = m_listbox_main->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
329 buf = m_listbox_main->GetItemText( item );
337 m_destination->SetValue( buf );
339 m_listbox_main->SetItemState( item, 0, wxLIST_STATE_SELECTED );
342 void a2dGroupDlg::CmRemove_A( wxCommandEvent& )
347 item = m_listbox_a->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
351 m_listbox_a->DeleteItem( item );
355 void a2dGroupDlg::CmRemove_B( wxCommandEvent& )
360 item = m_listbox_b->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
364 m_listbox_b->DeleteItem( item );
368 void a2dGroupDlg::CmRemove_D( wxCommandEvent& )
370 m_destination->SetValue( wxEmptyString );
373 void a2dGroupDlg::CmClear_A( wxCommandEvent& )
375 m_listbox_a->DeleteAllItems();
378 void a2dGroupDlg::CmClear_B( wxCommandEvent& )
380 m_listbox_b->DeleteAllItems();
384 void a2dGroupDlg::CmOk( wxCommandEvent& )
396 item = m_listbox_a->GetNextItem( item );
399 groupa.push_back( m_listbox_a->GetItemData( item ) );
406 item = m_listbox_b->GetNextItem( item );
409 groupb.push_back( m_listbox_b->GetItemData( item ) );
422 void a2dGroupDlg::CmCancel( wxCommandEvent& )
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
a2dLayerGroup & GetGroupA()
return group A layers
bool GetAvailable()
are there objects on this layer
bool GetSelectedOnlyB() const
get selectedOnlyB in group operations
void SetSelectedOnlyB(bool selectedOnlyB)
set selectedOnlyB in group operations
std::vector< a2dLayerInfoPtr > & GetLayerIndex()
return array index on Layer
wxUint16 GetTarget()
get target layer in operation
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
bool GetClearTarget() const
get clear of target in group operations
virtual wxString GetName() const
Get name for layer.
void SetClearTarget(bool clearTarget)
set clear of target in group operations
void SetGroupA(const a2dLayerGroup &groupA)
sets operand A in layer operation
Definition of class for dialog to set groups for boolean operations.
void SetTarget(wxUint16 target)
set target layer in operation
contains the layer properties for one layer,
defines common settinsg for a habitat for a set of a2dCameleons.
holds a list of layers numbers
void SetGroupB(const a2dLayerGroup &groupB)
sets operand B in layer operation
a2dDrawing * GetDrawing() const
get drawing via top object
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
a2dLayerGroup & GetGroupB()
return group B layers
void SetSelectedOnlyA(bool selectedOnlyA)
set selectedOnlyA in group operations
bool GetSelectedOnlyA() const
get selectedOnlyA in group operations
general canvas module declarations and classes