18 #pragma implementation
24 #include "wx/canvas/canorderdlg.h"
28 const int ORDER_LIST_SELECT = wxID_HIGHEST + 5108 ;
30 const int ORDER_BUTTON_OK = wxID_HIGHEST + 5101 ;
31 const int ORDER_BUTTON_CANCEL = wxID_HIGHEST + 5102 ;
33 const int ORDER_BUTTON_UP = wxID_HIGHEST + 5103 ;
35 const int ORDER_BUTTON_DOWN = wxID_HIGHEST + 5104 ;
37 const int ORDER_BUTTON_SHOW = wxID_HIGHEST + 5106 ;
39 const int ORDER_UPDATE_DIALOG = wxID_HIGHEST + 5107 ;
66 wxDialog( parent, ORDER_UPDATE_DIALOG, title, wxPoint( 0, 0 ), wxSize( 200, 500 ), style, name )
74 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer( wxHORIZONTAL );
75 itemDialog1->SetSizer( itemBoxSizer2 );
77 wxString* m_listboxStrings = NULL;
78 m_listbox =
new a2dDragListBox( itemDialog1, ORDER_LIST_SELECT, wxDefaultPosition, wxSize( 100, 500 ), 0, m_listboxStrings, wxLB_SINGLE | wxLB_NEEDED_SB );
79 m_listbox->SetHelpText( _(
"Select a layer and press up or down button" ) );
80 m_listbox->SetToolTip( _(
"Select a layer and press up or down button" ) );
81 itemBoxSizer2->Add( m_listbox, 1, wxGROW | wxALL, 0 );
83 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer( wxVERTICAL );
84 itemBoxSizer2->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 0 );
86 m_buttonOK =
new wxButton( itemDialog1, ORDER_BUTTON_OK, _(
"Hide" ), wxDefaultPosition, wxSize( 55, 22 ), 0 );
87 itemBoxSizer4->Add( m_buttonOK, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0 );
89 m_buttonCANCEL =
new wxButton( itemDialog1, ORDER_BUTTON_CANCEL, _(
"Cancel" ), wxDefaultPosition, wxSize( 55, 22 ), 0 );
90 itemBoxSizer4->Add( m_buttonCANCEL, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0 );
92 itemBoxSizer4->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
94 m_buttonUP =
new wxButton( itemDialog1, ORDER_BUTTON_UP, _(
"Up" ), wxDefaultPosition, wxSize( 55, 22 ), 0 );
95 itemBoxSizer4->Add( m_buttonUP, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0 );
97 m_buttonDOWN =
new wxButton( itemDialog1, ORDER_BUTTON_DOWN, _(
"Down" ), wxDefaultPosition, wxSize( 55, 22 ), 0 );
98 itemBoxSizer4->Add( m_buttonDOWN, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0 );
100 m_buttonSHOW =
new wxButton( itemDialog1, ORDER_BUTTON_SHOW, _(
"Apply" ), wxDefaultPosition, wxSize( 55, 22 ), 0 );
101 itemBoxSizer4->Add( m_buttonSHOW, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0 );
103 GetSizer()->Fit(
this );
104 GetSizer()->SetSizeHints(
this );
122 m_layersetup = layersetup;
127 for ( j = 0; j < wxMAXLAYER; j++ )
130 if ( layerinfo != wxNullLayerInfo )
134 wxSnprintf( _buf,
sizeof( _buf ), wxT(
"%04d %s" ), j, layerinfo->
GetName().c_str() );
135 m_listbox->Append( _buf );
141 wxSnprintf( _buf,
sizeof( _buf ), wxT(
"%04d ND %s" ), j, layerinfo->
GetName().c_str() );
142 m_listbox->Append( _buf );
148 void a2dLayerOrderDialog::OnActivateView(
a2dViewEvent& viewevent )
173 for (
int i = 0; i < wxMAXLAYER; i++ )
175 layernr = m_listbox->GetString( i ).Left( 4 );
177 if ( layerinfo != wxNullLayerInfo )
184 SetEvtHandlerEnabled(
false );
186 ProcessEvent( changedlayers );
187 SetEvtHandlerEnabled(
true );
192 int selection = m_listbox->GetSelection();
193 m_listbox->SetSelection( selection, FALSE );
201 int selection = m_listbox->GetSelection();
202 m_listbox->SetSelection( selection, FALSE );
209 wxCommandEvent a = wxCommandEvent();
225 int selection = m_listbox->GetSelection();
226 if ( selection == -1 )
227 ( void )wxMessageBox( _T(
"You must select a layer first" ), _T(
"a2dLayerOrderDialog" ), wxICON_INFORMATION | wxOK );
230 if ( selection != 0 )
232 if ( selection == wxMAXLAYER - 1 ) m_buttonDOWN->Enable( TRUE );
234 wxString selected = m_listbox->GetString( m_listbox->GetSelection() - 1 );
236 m_listbox->SetString( selection - 1, m_listbox->GetString( selection ) );
237 m_listbox->SetString( selection, selected );
238 m_listbox->Show( TRUE );
241 m_listbox->SetSelection( selection, FALSE );
242 m_listbox->SetSelection( selection - 1, TRUE );
243 if ( selection == 1 )
244 m_buttonUP->Enable( FALSE );
248 ( void )wxMessageBox( _T(
"layer is allready at the highest possible order" ), _T(
"a2dLayerOrderDialog" ), wxICON_INFORMATION | wxOK );
255 int selection = m_listbox->GetSelection();
257 if ( selection == -1 )
258 ( void )wxMessageBox( _T(
"You must select a layer first" ), _T(
"a2dLayerOrderDialog" ), wxICON_INFORMATION | wxOK );
261 if ( selection != wxMAXLAYER - 1 )
263 if ( selection == 0 ) m_buttonUP->Enable( TRUE );
265 wxString selected = m_listbox->GetString( m_listbox->GetSelection() + 1 );
267 m_listbox->SetString( selection + 1, m_listbox->GetString( selection ) );
268 m_listbox->SetString( selection, selected );
269 m_listbox->Show( TRUE );
272 m_listbox->SetSelection( selection, FALSE );
273 m_listbox->SetSelection( selection + 1, TRUE );
275 if ( selection == wxMAXLAYER - 2 ) m_buttonDOWN->Enable( FALSE );
279 ( void )wxMessageBox( _T(
"layer is allready at the lowest possible order" ), _T(
"a2dLayerOrderDialog" ), wxICON_INFORMATION | wxOK );
286 int selection = m_listbox->GetSelection();
287 m_buttonUP->Enable( selection != 0 );
288 m_buttonDOWN->Enable( selection != wxMAXLAYER - 1 );
293 void a2dLayerOrderDialog::OnComEvent(
a2dComEvent& event )
295 if ( GetEvtHandlerEnabled() )
300 if ( doc && doc == m_layersetup->
GetRoot() )
306 if ( doc && doc == m_layersetup->
GetRoot() )
313 Init( m_layersetup );
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
#define EVT_CHANGED_DOCUMENT(func)
event sent to a2dDocumentCommandProcessor when the current document has changed in the a2dDocumentCom...
void SetLayer(wxUint16 layer, bool setStyleOfLayer=false)
#define EVT_ACTIVATE_VIEW(func)
event sent to view and document manager
View on a a2dCanvasDocument.
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
void CmUp(wxCommandEvent &)
Move selected layer to a heigher layersetting if UP-button is pressed.
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
a2dView event, to report events in the a2dView class
std::vector< a2dLayerInfoPtr > & GetLayerIndex()
return array index on Layer
void CmOk(wxCommandEvent &)
Close window if OK-button is pressed.
void CmListBox(wxCommandEvent &)
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
static const a2dSignal sig_layersetupChanged
layer info changed id sent around when m_layersetup is changed.
void StoreOrder()
store current order to layer setup
void OnCloseWindow(wxCloseEvent &event)
Close window if EXIT-button is pressed.
void CmDown(wxCommandEvent &)
Move selected layer to a lower layersetting if the DOWN-button is pressed.
static const a2dSignal sig_layersetupChanged
layer info changed id sent around when m_layersetup is changed.
virtual wxString GetName() const
Get name for layer.
layer settings for a a2dCanvasDocument Holds layers settings classes
void CmShow(wxCommandEvent &)
Show new layerorder if the SHOW-button is pressed.
GUI listbox with copy feature.
void SetPending(bool pending)
next to base sets m_indexed false
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
static const a2dSignal sig_changedLayerInfo
when one layer its a2dLayerInfo has changed ( e.g. visible or order of rendering ) ...
contains the layer properties for one layer,
holds the central a2dCentralCanvasCommandProcessor which is
static const a2dSignal sig_changedLayers
when more layers changed ( rerendering view is needed).
void CmCancel(wxCommandEvent &)
Close window if CANCEL-button is pressed.
a2dDocviewGlobal * a2dDocviewGlobals
a global pointer to get to global instance of important classes.
void Init(a2dLayers *layersetup)
initialize with this layer setup
void SetOrder(wxUint16 order)
set drawing order for layer
Definition of class for dialog to specify the layerorder.
a2dDocumentCommandProcessor * GetDocviewCommandProcessor() const
Gets a2dDocumentCommandProcessor pointer.
std::vector< a2dLayerInfoPtr > & GetOrderIndex()
return array index on Order
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
all headers of the canvas module
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
~a2dLayerOrderDialog()
destructor.
Contain one drawing as hierarchical tree of a2dCanvasObject's.