Menu event handlers for simulation plot frame

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:22 +02:00
parent 51906625ee
commit 24bccb00d6
7 changed files with 145 additions and 56 deletions

View File

@ -129,6 +129,7 @@ void SIM_PLOT_FRAME::StopSimulation()
void SIM_PLOT_FRAME::NewPlotPanel() void SIM_PLOT_FRAME::NewPlotPanel()
{ {
SIM_PLOT_PANEL* plot = new SIM_PLOT_PANEL( this, wxID_ANY ); SIM_PLOT_PANEL* plot = new SIM_PLOT_PANEL( this, wxID_ANY );
m_plotNotebook->AddPage( plot, m_plotNotebook->AddPage( plot,
wxString::Format( wxT( "Plot%lu" ), m_plotNotebook->GetPageCount() + 1 ), true ); wxString::Format( wxT( "Plot%lu" ), m_plotNotebook->GetPageCount() + 1 ), true );
} }
@ -183,6 +184,38 @@ int SIM_PLOT_FRAME::getNodeNumber( const wxString& aNetName )
} }
void SIM_PLOT_FRAME::menuZoomIn( wxCommandEvent& event )
{
currentPlot()->ZoomIn();
}
void SIM_PLOT_FRAME::menuZoomOut( wxCommandEvent& event )
{
currentPlot()->ZoomOut();
}
void SIM_PLOT_FRAME::menuZoomFit( wxCommandEvent& event )
{
currentPlot()->Fit();
}
void SIM_PLOT_FRAME::menuShowGrid( wxCommandEvent& event )
{
currentPlot()->ShowGrid( !currentPlot()->IsGridShown() );
}
void SIM_PLOT_FRAME::menuShowGridState( wxUpdateUIEvent& event )
{
SIM_PLOT_PANEL* plotPanel = currentPlot();
event.Check( plotPanel ? plotPanel->IsGridShown() : false );
}
void SIM_PLOT_FRAME::onSignalDblClick( wxCommandEvent& event ) void SIM_PLOT_FRAME::onSignalDblClick( wxCommandEvent& event )
{ {
int idx = m_signals->GetSelection(); int idx = m_signals->GetSelection();

View File

@ -80,11 +80,24 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
*/ */
int getNodeNumber( const wxString& aNetName ); int getNodeNumber( const wxString& aNetName );
void onNewPlot( wxCommandEvent& aEvent ) override // Menu handlers
void menuNewPlot( wxCommandEvent& aEvent ) override
{ {
NewPlotPanel(); NewPlotPanel();
} }
void menuExit( wxCommandEvent& event ) override
{
Close();
}
void menuZoomIn( wxCommandEvent& event ) override;
void menuZoomOut( wxCommandEvent& event ) override;
void menuZoomFit( wxCommandEvent& event ) override;
void menuShowGrid( wxCommandEvent& event ) override;
void menuShowGridState( wxUpdateUIEvent& event ) override;
// Event handlers
void onSignalDblClick( wxCommandEvent& event ) override; void onSignalDblClick( wxCommandEvent& event ) override;
void onSimulate( wxCommandEvent& event ) override; void onSimulate( wxCommandEvent& event ) override;
void onPlaceProbe( wxCommandEvent& event ) override; void onPlaceProbe( wxCommandEvent& event ) override;

View File

@ -13,52 +13,52 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
m_menubar1 = new wxMenuBar( 0 ); m_mainMenu = new wxMenuBar( 0 );
m_menu1 = new wxMenu(); m_fileMenu = new wxMenu();
wxMenuItem* m_menuItem7; wxMenuItem* m_menuItem7;
m_menuItem7 = new wxMenuItem( m_menu1, wxID_ANY, wxString( _("New Plot") ) , wxEmptyString, wxITEM_NORMAL ); m_menuItem7 = new wxMenuItem( m_fileMenu, wxID_NEW, wxString( _("New Plot") ) , wxEmptyString, wxITEM_NORMAL );
m_menu1->Append( m_menuItem7 ); m_fileMenu->Append( m_menuItem7 );
m_menu1->AppendSeparator(); m_fileMenu->AppendSeparator();
wxMenuItem* m_menuItem8; wxMenuItem* m_menuItem8;
m_menuItem8 = new wxMenuItem( m_menu1, wxID_ANY, wxString( _("Open Workbook") ) , wxEmptyString, wxITEM_NORMAL ); m_menuItem8 = new wxMenuItem( m_fileMenu, wxID_OPEN, wxString( _("Open Workbook") ) , wxEmptyString, wxITEM_NORMAL );
m_menu1->Append( m_menuItem8 ); m_fileMenu->Append( m_menuItem8 );
wxMenuItem* m_menuItem2; wxMenuItem* m_menuItem2;
m_menuItem2 = new wxMenuItem( m_menu1, wxID_ANY, wxString( _("Save Workbook") ) , wxEmptyString, wxITEM_NORMAL ); m_menuItem2 = new wxMenuItem( m_fileMenu, wxID_SAVE, wxString( _("Save Workbook") ) , wxEmptyString, wxITEM_NORMAL );
m_menu1->Append( m_menuItem2 ); m_fileMenu->Append( m_menuItem2 );
m_menu1->AppendSeparator(); m_fileMenu->AppendSeparator();
wxMenuItem* m_menuItem1; wxMenuItem* m_menuItem1;
m_menuItem1 = new wxMenuItem( m_menu1, wxID_ANY, wxString( _("Exit Simulation") ) , wxEmptyString, wxITEM_NORMAL ); m_menuItem1 = new wxMenuItem( m_fileMenu, wxID_CLOSE, wxString( _("Exit Simulation") ) , wxEmptyString, wxITEM_NORMAL );
m_menu1->Append( m_menuItem1 ); m_fileMenu->Append( m_menuItem1 );
m_menubar1->Append( m_menu1, _("File") ); m_mainMenu->Append( m_fileMenu, _("File") );
m_menu2 = new wxMenu(); m_viewMenu = new wxMenu();
wxMenuItem* m_menuItem3; wxMenuItem* m_menuItem3;
m_menuItem3 = new wxMenuItem( m_menu2, wxID_ANY, wxString( _("Zoom In") ) , wxEmptyString, wxITEM_NORMAL ); m_menuItem3 = new wxMenuItem( m_viewMenu, wxID_ZOOM_IN, wxString( _("Zoom In") ) , wxEmptyString, wxITEM_NORMAL );
m_menu2->Append( m_menuItem3 ); m_viewMenu->Append( m_menuItem3 );
wxMenuItem* m_menuItem4; wxMenuItem* m_menuItem4;
m_menuItem4 = new wxMenuItem( m_menu2, wxID_ANY, wxString( _("Zoom Out") ) , wxEmptyString, wxITEM_NORMAL ); m_menuItem4 = new wxMenuItem( m_viewMenu, wxID_ZOOM_OUT, wxString( _("Zoom Out") ) , wxEmptyString, wxITEM_NORMAL );
m_menu2->Append( m_menuItem4 ); m_viewMenu->Append( m_menuItem4 );
wxMenuItem* m_menuItem5; wxMenuItem* m_menuItem5;
m_menuItem5 = new wxMenuItem( m_menu2, wxID_ANY, wxString( _("Fit on Screen") ) , wxEmptyString, wxITEM_NORMAL ); m_menuItem5 = new wxMenuItem( m_viewMenu, wxID_ZOOM_FIT, wxString( _("Fit on Screen") ) , wxEmptyString, wxITEM_NORMAL );
m_menu2->Append( m_menuItem5 ); m_viewMenu->Append( m_menuItem5 );
m_menu2->AppendSeparator(); m_viewMenu->AppendSeparator();
wxMenuItem* m_menuItem6; wxMenuItem* m_menuShowGrid;
m_menuItem6 = new wxMenuItem( m_menu2, wxID_ANY, wxString( _("Show grid") ) , wxEmptyString, wxITEM_CHECK ); m_menuShowGrid = new wxMenuItem( m_viewMenu, wxID_ANY, wxString( _("Show grid") ) , wxEmptyString, wxITEM_CHECK );
m_menu2->Append( m_menuItem6 ); m_viewMenu->Append( m_menuShowGrid );
m_menubar1->Append( m_menu2, _("View") ); m_mainMenu->Append( m_viewMenu, _("View") );
this->SetMenuBar( m_menubar1 ); this->SetMenuBar( m_mainMenu );
wxBoxSizer* bSizer1; wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL ); bSizer1 = new wxBoxSizer( wxVERTICAL );
@ -154,7 +154,15 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
this->Connect( m_menuItem7->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onNewPlot ) ); this->Connect( m_menuItem7->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuNewPlot ) );
this->Connect( m_menuItem8->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuOpenWorkbook ) );
this->Connect( m_menuItem2->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuSaveWorkbook ) );
this->Connect( m_menuItem1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuExit ) );
this->Connect( m_menuItem3->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomIn ) );
this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomOut ) );
this->Connect( m_menuItem5->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomFit ) );
this->Connect( m_menuShowGrid->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuShowGrid ) );
this->Connect( m_menuShowGrid->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowGridState ) );
m_signals->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this ); m_signals->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this );
m_simulateBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSimulate ), NULL, this ); m_simulateBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSimulate ), NULL, this );
m_probeBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onPlaceProbe ), NULL, this ); m_probeBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onPlaceProbe ), NULL, this );
@ -164,7 +172,15 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE() SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onNewPlot ) ); this->Disconnect( wxID_NEW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuNewPlot ) );
this->Disconnect( wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuOpenWorkbook ) );
this->Disconnect( wxID_SAVE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuSaveWorkbook ) );
this->Disconnect( wxID_CLOSE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuExit ) );
this->Disconnect( wxID_ZOOM_IN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomIn ) );
this->Disconnect( wxID_ZOOM_OUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomOut ) );
this->Disconnect( wxID_ZOOM_FIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomFit ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuShowGrid ) );
this->Disconnect( wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowGridState ) );
m_signals->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this ); m_signals->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this );
m_simulateBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSimulate ), NULL, this ); m_simulateBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSimulate ), NULL, this );
m_probeBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onPlaceProbe ), NULL, this ); m_probeBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onPlaceProbe ), NULL, this );

View File

@ -88,7 +88,7 @@
<event name="OnSetFocus"></event> <event name="OnSetFocus"></event>
<event name="OnSize"></event> <event name="OnSize"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="wxMenuBar" expanded="0"> <object class="wxMenuBar" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -100,7 +100,7 @@
<property name="label">MyMenuBar</property> <property name="label">MyMenuBar</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_menubar1</property> <property name="name">m_mainMenu</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
@ -133,23 +133,23 @@
<event name="OnSetFocus"></event> <event name="OnSetFocus"></event>
<event name="OnSize"></event> <event name="OnSize"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="wxMenu" expanded="0"> <object class="wxMenu" expanded="1">
<property name="label">File</property> <property name="label">File</property>
<property name="name">m_menu1</property> <property name="name">m_fileMenu</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="wxMenuItem" expanded="0"> <object class="wxMenuItem" expanded="0">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="checked">0</property> <property name="checked">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_NEW</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">New Plot</property> <property name="label">New Plot</property>
<property name="name">m_menuItem7</property> <property name="name">m_menuItem7</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">onNewPlot</event> <event name="OnMenuSelection">menuNewPlot</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
<object class="separator" expanded="0"> <object class="separator" expanded="0">
@ -161,14 +161,14 @@
<property name="checked">0</property> <property name="checked">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_OPEN</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">Open Workbook</property> <property name="label">Open Workbook</property>
<property name="name">m_menuItem8</property> <property name="name">m_menuItem8</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event> <event name="OnMenuSelection">menuOpenWorkbook</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
<object class="wxMenuItem" expanded="0"> <object class="wxMenuItem" expanded="0">
@ -176,14 +176,14 @@
<property name="checked">0</property> <property name="checked">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_SAVE</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">Save Workbook</property> <property name="label">Save Workbook</property>
<property name="name">m_menuItem2</property> <property name="name">m_menuItem2</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event> <event name="OnMenuSelection">menuSaveWorkbook</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
<object class="separator" expanded="0"> <object class="separator" expanded="0">
@ -195,34 +195,34 @@
<property name="checked">0</property> <property name="checked">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_CLOSE</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">Exit Simulation</property> <property name="label">Exit Simulation</property>
<property name="name">m_menuItem1</property> <property name="name">m_menuItem1</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event> <event name="OnMenuSelection">menuExit</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="wxMenu" expanded="0"> <object class="wxMenu" expanded="1">
<property name="label">View</property> <property name="label">View</property>
<property name="name">m_menu2</property> <property name="name">m_viewMenu</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="wxMenuItem" expanded="0"> <object class="wxMenuItem" expanded="0">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="checked">0</property> <property name="checked">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ZOOM_IN</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">Zoom In</property> <property name="label">Zoom In</property>
<property name="name">m_menuItem3</property> <property name="name">m_menuItem3</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event> <event name="OnMenuSelection">menuZoomIn</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
<object class="wxMenuItem" expanded="0"> <object class="wxMenuItem" expanded="0">
@ -230,14 +230,14 @@
<property name="checked">0</property> <property name="checked">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ZOOM_OUT</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">Zoom Out</property> <property name="label">Zoom Out</property>
<property name="name">m_menuItem4</property> <property name="name">m_menuItem4</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event> <event name="OnMenuSelection">menuZoomOut</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
<object class="wxMenuItem" expanded="0"> <object class="wxMenuItem" expanded="0">
@ -245,14 +245,14 @@
<property name="checked">0</property> <property name="checked">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ZOOM_FIT</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">Fit on Screen</property> <property name="label">Fit on Screen</property>
<property name="name">m_menuItem5</property> <property name="name">m_menuItem5</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event> <event name="OnMenuSelection">menuZoomFit</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
<object class="separator" expanded="0"> <object class="separator" expanded="0">
@ -267,12 +267,12 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="kind">wxITEM_CHECK</property> <property name="kind">wxITEM_CHECK</property>
<property name="label">Show grid</property> <property name="label">Show grid</property>
<property name="name">m_menuItem6</property> <property name="name">m_menuShowGrid</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
<property name="unchecked_bitmap"></property> <property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event> <event name="OnMenuSelection">menuShowGrid</event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI">menuShowGridState</event>
</object> </object>
</object> </object>
</object> </object>

View File

@ -43,9 +43,9 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
private: private:
protected: protected:
wxMenuBar* m_menubar1; wxMenuBar* m_mainMenu;
wxMenu* m_menu1; wxMenu* m_fileMenu;
wxMenu* m_menu2; wxMenu* m_viewMenu;
wxPanel* m_panel31; wxPanel* m_panel31;
wxPanel* m_panel61; wxPanel* m_panel61;
wxAuiNotebook* m_plotNotebook; wxAuiNotebook* m_plotNotebook;
@ -61,7 +61,15 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
wxRichTextCtrl* m_simConsole; wxRichTextCtrl* m_simConsole;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void onNewPlot( wxCommandEvent& event ) { event.Skip(); } virtual void menuNewPlot( wxCommandEvent& event ) { event.Skip(); }
virtual void menuOpenWorkbook( wxCommandEvent& event ) { event.Skip(); }
virtual void menuSaveWorkbook( wxCommandEvent& event ) { event.Skip(); }
virtual void menuExit( wxCommandEvent& event ) { event.Skip(); }
virtual void menuZoomIn( wxCommandEvent& event ) { event.Skip(); }
virtual void menuZoomOut( wxCommandEvent& event ) { event.Skip(); }
virtual void menuZoomFit( wxCommandEvent& event ) { event.Skip(); }
virtual void menuShowGrid( wxCommandEvent& event ) { event.Skip(); }
virtual void menuShowGridState( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onSignalDblClick( wxCommandEvent& event ) { event.Skip(); } virtual void onSignalDblClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onSimulate( wxCommandEvent& event ) { event.Skip(); } virtual void onSimulate( wxCommandEvent& event ) { event.Skip(); }
virtual void onPlaceProbe( wxCommandEvent& event ) { event.Skip(); } virtual void onPlaceProbe( wxCommandEvent& event ) { event.Skip(); }

View File

@ -99,6 +99,21 @@ void SIM_PLOT_PANEL::DeleteTraces()
} }
void SIM_PLOT_PANEL::ShowGrid( bool aEnable )
{
m_axis_x->SetTicks( !aEnable );
m_axis_y->SetTicks( !aEnable );
UpdateAll();
}
bool SIM_PLOT_PANEL::IsGridShown() const
{
assert( m_axis_x->GetTicks() == m_axis_y->GetTicks() );
return !m_axis_x->GetTicks();
}
wxColour SIM_PLOT_PANEL::generateColor() wxColour SIM_PLOT_PANEL::generateColor()
{ {
/// @todo have a look at: /// @todo have a look at:

View File

@ -65,6 +65,10 @@ public:
return m_traces; return m_traces;
} }
void ShowGrid( bool aEnable = true );
bool IsGridShown() const;
private: private:
wxColour generateColor(); wxColour generateColor();