From 8e4ae1968f447866476d2e6adb620b767efc2fe5 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Thu, 11 Aug 2016 14:42:01 +0200 Subject: [PATCH] sim: working on improved UX [wip] --- eeschema/sim/sim_plot_frame.cpp | 25 ++++++++++------- eeschema/sim/sim_plot_frame_base.cpp | 40 +++++++++++++--------------- eeschema/sim/sim_plot_frame_base.fbp | 16 +++++------ eeschema/sim/sim_plot_frame_base.h | 6 +++-- eeschema/sim/sim_plot_panel.cpp | 6 ++--- 5 files changed, 50 insertions(+), 43 deletions(-) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 83b006870b..aa5337cb32 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -137,14 +137,12 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) GetSize( &w, &h ); - printf("%d %d\n", w, h); - m_toolBar->Realize(); - Layout(); - m_splitterConsole->SetSashPosition( w * 0.8 ); - m_splitterPlot->SetSashPosition( h *0.8 ); + m_splitterPlot->SetSashPosition( h * 0.8 ); + + Layout(); } @@ -182,7 +180,7 @@ void SIM_PLOT_FRAME::StartSimulation() m_welcomePanel->Show(false); m_plotNotebook->Show(true); - m_plotNotebook->Raise(); + m_plotNotebook->Fit(); Layout(); } @@ -252,9 +250,12 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent ) try { - TUNER_SLIDER* tuner = new TUNER_SLIDER( this, aComponent ); - m_tuneSizer->Add( tuner ); + TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_sidePanel, aComponent ); + m_tuneSizer->Add( tuner , 0, wxALL, 5 ); tunerList.push_back( tuner ); + m_sidePanel->Layout(); + m_sideSizer->Fit( m_sidePanel ); + m_splitterPlot->Layout(); Layout(); } catch( ... ) @@ -318,7 +319,13 @@ void SIM_PLOT_FRAME::addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const if( updated ) { updateSignalList(); + plotPanel->Layout(); plotPanel->Fit(); + m_plotPanel->Layout(); + //m_sideSizer->Fit( m_sidePanel ); + m_splitterPlot->Layout(); + Layout(); + } } @@ -799,7 +806,7 @@ void SIM_PLOT_FRAME::onSimUpdate( wxCommandEvent& aEvent ) + "=" + tuner->GetValue().ToSpiceString() ); m_simulator->Command( command ); - printf("CMD: %s\n", command.c_str() ); +// printf("CMD: %s\n", command.c_str() ); } } diff --git a/eeschema/sim/sim_plot_frame_base.cpp b/eeschema/sim/sim_plot_frame_base.cpp index 840c618200..fa87e39ade 100644 --- a/eeschema/sim/sim_plot_frame_base.cpp +++ b/eeschema/sim/sim_plot_frame_base.cpp @@ -121,18 +121,18 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const m_splitterConsole->SetSashGravity( 0.8 ); m_splitterConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterConsoleOnIdle ), NULL, this ); - m_panel4 = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_plotPanel = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer5; bSizer5 = new wxBoxSizer( wxHORIZONTAL ); - m_plotNotebook = new wxNotebook( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_plotNotebook = new wxNotebook( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_plotNotebook->Hide(); m_plotNotebook->SetMinSize( wxSize( 400,-1 ) ); bSizer5->Add( m_plotNotebook, 3, wxEXPAND | wxALL, 5 ); - m_welcomePanel = new wxPanel( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_welcomePanel = new wxPanel( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxVERTICAL ); @@ -168,9 +168,9 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const bSizer5->Add( m_welcomePanel, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_panel4->SetSizer( bSizer5 ); - m_panel4->Layout(); - bSizer5->Fit( m_panel4 ); + m_plotPanel->SetSizer( bSizer5 ); + m_plotPanel->Layout(); + bSizer5->Fit( m_plotPanel ); m_panel5 = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer13; bSizer13 = new wxBoxSizer( wxVERTICAL ); @@ -184,37 +184,35 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const m_panel5->SetSizer( bSizer13 ); m_panel5->Layout(); bSizer13->Fit( m_panel5 ); - m_splitterConsole->SplitHorizontally( m_panel4, m_panel5, 0 ); + m_splitterConsole->SplitHorizontally( m_plotPanel, m_panel5, 0 ); bSizer11->Add( m_splitterConsole, 1, wxEXPAND, 5 ); m_panel2->SetSizer( bSizer11 ); m_panel2->Layout(); bSizer11->Fit( m_panel2 ); - m_panel31 = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer7; - bSizer7 = new wxBoxSizer( wxVERTICAL ); + m_sidePanel = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_sideSizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizer1; - sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_panel31, wxID_ANY, _("Signals") ), wxVERTICAL ); + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_sidePanel, wxID_ANY, _("Signals") ), wxVERTICAL ); m_signals = new wxListBox( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT ); sbSizer1->Add( m_signals, 1, wxALL|wxEXPAND, 5 ); - bSizer7->Add( sbSizer1, 1, wxEXPAND, 5 ); + m_sideSizer->Add( sbSizer1, 1, wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer3; - sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panel31, wxID_ANY, _("Cursors") ), wxVERTICAL ); + sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_sidePanel, wxID_ANY, _("Cursors") ), wxVERTICAL ); m_cursors = new wxListCtrl( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL ); sbSizer3->Add( m_cursors, 1, wxALL|wxEXPAND, 5 ); - bSizer7->Add( sbSizer3, 1, wxEXPAND, 5 ); + m_sideSizer->Add( sbSizer3, 1, wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizer4; - sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panel31, wxID_ANY, _("Tune") ), wxVERTICAL ); + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_sidePanel, wxID_ANY, _("Tune") ), wxVERTICAL ); m_tuneSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -222,13 +220,13 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const sbSizer4->Add( m_tuneSizer, 1, wxEXPAND, 5 ); - bSizer7->Add( sbSizer4, 1, wxEXPAND, 5 ); + m_sideSizer->Add( sbSizer4, 1, wxEXPAND, 5 ); - m_panel31->SetSizer( bSizer7 ); - m_panel31->Layout(); - bSizer7->Fit( m_panel31 ); - m_splitterPlot->SplitVertically( m_panel2, m_panel31, 0 ); + m_sidePanel->SetSizer( m_sideSizer ); + m_sidePanel->Layout(); + m_sideSizer->Fit( m_sidePanel ); + m_splitterPlot->SplitVertically( m_panel2, m_sidePanel, 0 ); bSizer1->Add( m_splitterPlot, 1, wxEXPAND, 5 ); diff --git a/eeschema/sim/sim_plot_frame_base.fbp b/eeschema/sim/sim_plot_frame_base.fbp index d9ef495e76..0a08ebd1b8 100644 --- a/eeschema/sim/sim_plot_frame_base.fbp +++ b/eeschema/sim/sim_plot_frame_base.fbp @@ -675,7 +675,7 @@ 5 wxEXPAND 1 - + 1 1 1 @@ -1361,7 +1361,7 @@ 0 1 - m_panel31 + m_sidePanel 1 @@ -1400,11 +1400,11 @@ - + - bSizer7 + m_sideSizer wxVERTICAL - none + protected 5 wxEXPAND @@ -1626,17 +1626,17 @@ - + 5 wxEXPAND 1 - + wxID_ANY Tune sbSizer4 wxVERTICAL - none + protected 5 diff --git a/eeschema/sim/sim_plot_frame_base.h b/eeschema/sim/sim_plot_frame_base.h index d7e7573721..5a6da6d9e1 100644 --- a/eeschema/sim/sim_plot_frame_base.h +++ b/eeschema/sim/sim_plot_frame_base.h @@ -54,15 +54,17 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER wxSplitterWindow* m_splitterPlot; wxPanel* m_panel2; wxSplitterWindow* m_splitterConsole; - wxPanel* m_panel4; + wxPanel* m_plotPanel; wxNotebook* m_plotNotebook; wxPanel* m_welcomePanel; wxStaticText* m_staticText2; wxPanel* m_panel5; wxTextCtrl* m_simConsole; - wxPanel* m_panel31; + wxPanel* m_sidePanel; + wxBoxSizer* m_sideSizer; wxListBox* m_signals; wxListCtrl* m_cursors; + wxStaticBoxSizer* sbSizer4; wxBoxSizer* m_tuneSizer; // Virtual event handlers, overide them in your derived class diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp index f2cfec4e77..97c130ad18 100644 --- a/eeschema/sim/sim_plot_panel.cpp +++ b/eeschema/sim/sim_plot_panel.cpp @@ -105,7 +105,6 @@ public: const wxString getLabel( int n ) { - printf("%.10f\n", m_labeledTicks[n] ); return formatSI ( m_labeledTicks[n], wxT("Hz"), 2 ); } }; @@ -119,7 +118,6 @@ public: const wxString getLabel( int n ) { - printf("%.10f\n", m_labeledTicks[n] ); return formatSI ( m_labeledTicks[n], wxT("Hz"), 2 ); } }; @@ -305,7 +303,7 @@ SIM_PLOT_PANEL::SIM_PLOT_PANEL( SIM_TYPE aType, wxWindow* parent, wxWindowID id, switch( m_type ) { case ST_AC: - m_axis_x = new FREQUENCY_LIN_SCALE( wxT( "Frequency" ), mpALIGN_BOTTOM ); + m_axis_x = new FREQUENCY_LOG_SCALE( wxT( "Frequency" ), mpALIGN_BOTTOM ); m_axis_y1 = new GAIN_SCALE( wxT( "Gain" ), mpALIGN_LEFT ); m_axis_y2 = new PHASE_SCALE( wxT( "Phase" ), mpALIGN_RIGHT ); m_axis_y2->SetMasterScale(m_axis_y1); @@ -354,7 +352,9 @@ SIM_PLOT_PANEL::SIM_PLOT_PANEL( SIM_TYPE aType, wxWindow* parent, wxWindowID id, m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH ); AddLayer( m_legend ); m_topLevel.push_back( m_legend ); + SetColourTheme(*wxBLACK, *wxWHITE, grey); + EnableDoubleBuffer(true); UpdateAll(); }