Simplified SIM_PLOT_FRAME layout Removed unnecessary panels & sizers, changed wxAuiNotebook to wxNotebook

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:26 +02:00
parent 433f934dc1
commit fa4ba69661
4 changed files with 609 additions and 977 deletions

View File

@ -128,7 +128,7 @@ void SIM_PLOT_FRAME::StopSimulation()
void SIM_PLOT_FRAME::NewPlotPanel()
{
SIM_PLOT_PANEL* plot = new SIM_PLOT_PANEL( this, wxID_ANY );
SIM_PLOT_PANEL* plot = new SIM_PLOT_PANEL( m_plotNotebook, wxID_ANY );
m_plotNotebook->AddPage( plot,
wxString::Format( wxT( "Plot%lu" ), m_plotNotebook->GetPageCount() + 1 ), true );

View File

@ -63,45 +63,28 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
m_panel31 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_panel61 = new wxPanel( m_panel31, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel61->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_panel61->SetMinSize( wxSize( 300,-1 ) );
m_plotNotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxVERTICAL );
bSizer5->Add( m_plotNotebook, 4, wxEXPAND | wxALL, 5 );
m_plotNotebook = new wxAuiNotebook( m_panel61, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE );
m_plotNotebook->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
bSizer6->Add( m_plotNotebook, 1, wxEXPAND, 5 );
m_panel61->SetSizer( bSizer6 );
m_panel61->Layout();
bSizer6->Fit( m_panel61 );
bSizer5->Add( m_panel61, 3, wxEXPAND | wxALL, 5 );
m_panel7 = new wxPanel( m_panel31, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
m_staticText2 = new wxStaticText( m_panel7, wxID_ANY, _("Signals"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Signals"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
m_staticText2->Wrap( -1 );
bSizer7->Add( m_staticText2, 0, wxALL|wxEXPAND, 5 );
m_signals = new wxListBox( m_panel7, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT );
m_signals = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT );
bSizer7->Add( m_signals, 1, wxALL|wxEXPAND, 5 );
m_staticText21 = new wxStaticText( m_panel7, wxID_ANY, _("Cursors"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText21 = new wxStaticText( this, wxID_ANY, _("Cursors"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText21->Wrap( -1 );
bSizer7->Add( m_staticText21, 0, wxALL, 5 );
m_cursors = new wxListCtrl( m_panel7, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL );
m_cursors = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL );
bSizer7->Add( m_cursors, 1, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
@ -109,44 +92,28 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_simulateBtn = new wxButton( m_panel7, wxID_ANY, _("Simulate"), wxDefaultPosition, wxDefaultSize, 0 );
m_simulateBtn = new wxButton( this, wxID_ANY, _("Simulate"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_simulateBtn, 0, wxALL, 5 );
m_probeBtn = new wxButton( m_panel7, wxID_ANY, _("Probe"), wxDefaultPosition, wxDefaultSize, 0 );
m_probeBtn = new wxButton( this, wxID_ANY, _("Probe"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_probeBtn, 0, wxALL|wxEXPAND, 5 );
m_tuneBtn = new wxButton( m_panel7, wxID_ANY, _("Tune"), wxDefaultPosition, wxDefaultSize, 0 );
m_tuneBtn = new wxButton( this, wxID_ANY, _("Tune"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_tuneBtn, 0, wxALL|wxEXPAND, 5 );
bSizer7->Add( fgSizer1, 0, wxALL|wxEXPAND, 5 );
m_panel7->SetSizer( bSizer7 );
m_panel7->Layout();
bSizer7->Fit( m_panel7 );
bSizer5->Add( m_panel7, 0, wxALL|wxEXPAND, 5 );
bSizer5->Add( bSizer7, 1, wxEXPAND, 5 );
m_panel31->SetSizer( bSizer5 );
m_panel31->Layout();
bSizer5->Fit( m_panel31 );
bSizer1->Add( m_panel31, 3, wxEXPAND | wxALL, 5 );
bSizer1->Add( bSizer5, 3, wxEXPAND, 5 );
m_panel3 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
m_simConsole = new wxRichTextCtrl( m_panel3, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS );
m_simConsole = new wxRichTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS );
m_simConsole->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizer3->Add( m_simConsole, 1, wxEXPAND | wxALL, 5 );
m_panel3->SetSizer( bSizer3 );
m_panel3->Layout();
bSizer3->Fit( m_panel3 );
bSizer1->Add( m_panel3, 1, wxEXPAND | wxALL, 5 );
bSizer1->Add( m_simConsole, 1, wxEXPAND | wxALL, 5 );
this->SetSizer( bSizer1 );
@ -164,9 +131,9 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
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_plotNotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotChanged ), NULL, this );
m_signals->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this );
m_signals->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::onSignalRClick ), NULL, this );
m_cursors->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::onCursorsUpdate ), 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_tuneBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onTune ), NULL, this );
@ -184,9 +151,9 @@ SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE()
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_plotNotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotChanged ), NULL, this );
m_signals->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this );
m_signals->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::onSignalRClick ), NULL, this );
m_cursors->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::onCursorsUpdate ), 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_tuneBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onTune ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -23,13 +23,12 @@ class KIWAY_PLAYER;
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/aui/auibook.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/notebook.h>
#include <wx/stattext.h>
#include <wx/listbox.h>
#include <wx/listctrl.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/richtext/richtextctrl.h>
#include <wx/frame.h>
@ -47,10 +46,7 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
wxMenuBar* m_mainMenu;
wxMenu* m_fileMenu;
wxMenu* m_viewMenu;
wxPanel* m_panel31;
wxPanel* m_panel61;
wxAuiNotebook* m_plotNotebook;
wxPanel* m_panel7;
wxNotebook* m_plotNotebook;
wxStaticText* m_staticText2;
wxListBox* m_signals;
wxStaticText* m_staticText21;
@ -58,7 +54,6 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
wxButton* m_simulateBtn;
wxButton* m_probeBtn;
wxButton* m_tuneBtn;
wxPanel* m_panel3;
wxRichTextCtrl* m_simConsole;
// Virtual event handlers, overide them in your derived class
@ -71,9 +66,9 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
virtual void menuZoomFit( wxCommandEvent& event ) { event.Skip(); }
virtual void menuShowGrid( wxCommandEvent& event ) { event.Skip(); }
virtual void menuShowGridState( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onPlotChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void onSignalDblClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onSignalRClick( wxMouseEvent& event ) { event.Skip(); }
virtual void onCursorsUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onSimulate( wxCommandEvent& event ) { event.Skip(); }
virtual void onPlaceProbe( wxCommandEvent& event ) { event.Skip(); }
virtual void onTune( wxCommandEvent& event ) { event.Skip(); }