sim: working on improved UX [wip]

This commit is contained in:
Tomasz Wlostowski 2016-08-11 14:42:01 +02:00 committed by Maciej Suminski
parent 2bcd8af25c
commit 8e4ae1968f
5 changed files with 50 additions and 43 deletions

View File

@ -137,14 +137,12 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent )
GetSize( &w, &h ); GetSize( &w, &h );
printf("%d %d\n", w, h);
m_toolBar->Realize(); m_toolBar->Realize();
Layout();
m_splitterConsole->SetSashPosition( w * 0.8 ); 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_welcomePanel->Show(false);
m_plotNotebook->Show(true); m_plotNotebook->Show(true);
m_plotNotebook->Raise(); m_plotNotebook->Fit();
Layout(); Layout();
} }
@ -252,9 +250,12 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent )
try try
{ {
TUNER_SLIDER* tuner = new TUNER_SLIDER( this, aComponent ); TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_sidePanel, aComponent );
m_tuneSizer->Add( tuner ); m_tuneSizer->Add( tuner , 0, wxALL, 5 );
tunerList.push_back( tuner ); tunerList.push_back( tuner );
m_sidePanel->Layout();
m_sideSizer->Fit( m_sidePanel );
m_splitterPlot->Layout();
Layout(); Layout();
} }
catch( ... ) catch( ... )
@ -318,7 +319,13 @@ void SIM_PLOT_FRAME::addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const
if( updated ) if( updated )
{ {
updateSignalList(); updateSignalList();
plotPanel->Layout();
plotPanel->Fit(); 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() ); + "=" + tuner->GetValue().ToSpiceString() );
m_simulator->Command( command ); m_simulator->Command( command );
printf("CMD: %s\n", command.c_str() ); // printf("CMD: %s\n", command.c_str() );
} }
} }

View File

@ -121,18 +121,18 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_splitterConsole->SetSashGravity( 0.8 ); m_splitterConsole->SetSashGravity( 0.8 );
m_splitterConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterConsoleOnIdle ), NULL, this ); 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; wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL ); 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->Hide();
m_plotNotebook->SetMinSize( wxSize( 400,-1 ) ); m_plotNotebook->SetMinSize( wxSize( 400,-1 ) );
bSizer5->Add( m_plotNotebook, 3, wxEXPAND | wxALL, 5 ); 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; wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL ); 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 ); bSizer5->Add( m_welcomePanel, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_panel4->SetSizer( bSizer5 ); m_plotPanel->SetSizer( bSizer5 );
m_panel4->Layout(); m_plotPanel->Layout();
bSizer5->Fit( m_panel4 ); bSizer5->Fit( m_plotPanel );
m_panel5 = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel5 = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer13; wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxVERTICAL ); 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->SetSizer( bSizer13 );
m_panel5->Layout(); m_panel5->Layout();
bSizer13->Fit( m_panel5 ); 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 ); bSizer11->Add( m_splitterConsole, 1, wxEXPAND, 5 );
m_panel2->SetSizer( bSizer11 ); m_panel2->SetSizer( bSizer11 );
m_panel2->Layout(); m_panel2->Layout();
bSizer11->Fit( m_panel2 ); bSizer11->Fit( m_panel2 );
m_panel31 = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_sidePanel = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer7; m_sideSizer = new wxBoxSizer( wxVERTICAL );
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1; 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 ); m_signals = new wxListBox( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT );
sbSizer1->Add( m_signals, 1, wxALL|wxEXPAND, 5 ); sbSizer1->Add( m_signals, 1, wxALL|wxEXPAND, 5 );
bSizer7->Add( sbSizer1, 1, wxEXPAND, 5 ); m_sideSizer->Add( sbSizer1, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer3; 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 ); 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 ); 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_sidePanel, wxID_ANY, _("Tune") ), wxVERTICAL );
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panel31, wxID_ANY, _("Tune") ), wxVERTICAL );
m_tuneSizer = new wxBoxSizer( wxHORIZONTAL ); 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 ); 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_sidePanel->SetSizer( m_sideSizer );
m_panel31->Layout(); m_sidePanel->Layout();
bSizer7->Fit( m_panel31 ); m_sideSizer->Fit( m_sidePanel );
m_splitterPlot->SplitVertically( m_panel2, m_panel31, 0 ); m_splitterPlot->SplitVertically( m_panel2, m_sidePanel, 0 );
bSizer1->Add( m_splitterPlot, 1, wxEXPAND, 5 ); bSizer1->Add( m_splitterPlot, 1, wxEXPAND, 5 );

View File

@ -675,7 +675,7 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxSplitterWindow" expanded="1"> <object class="wxSplitterWindow" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -1361,7 +1361,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_panel31</property> <property name="name">m_sidePanel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -1400,11 +1400,11 @@
<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="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer7</property> <property name="name">m_sideSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
@ -1626,17 +1626,17 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Tune</property> <property name="label">Tune</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbSizer4</property> <property name="name">sbSizer4</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">protected</property>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>

View File

@ -54,15 +54,17 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
wxSplitterWindow* m_splitterPlot; wxSplitterWindow* m_splitterPlot;
wxPanel* m_panel2; wxPanel* m_panel2;
wxSplitterWindow* m_splitterConsole; wxSplitterWindow* m_splitterConsole;
wxPanel* m_panel4; wxPanel* m_plotPanel;
wxNotebook* m_plotNotebook; wxNotebook* m_plotNotebook;
wxPanel* m_welcomePanel; wxPanel* m_welcomePanel;
wxStaticText* m_staticText2; wxStaticText* m_staticText2;
wxPanel* m_panel5; wxPanel* m_panel5;
wxTextCtrl* m_simConsole; wxTextCtrl* m_simConsole;
wxPanel* m_panel31; wxPanel* m_sidePanel;
wxBoxSizer* m_sideSizer;
wxListBox* m_signals; wxListBox* m_signals;
wxListCtrl* m_cursors; wxListCtrl* m_cursors;
wxStaticBoxSizer* sbSizer4;
wxBoxSizer* m_tuneSizer; wxBoxSizer* m_tuneSizer;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class

View File

@ -105,7 +105,6 @@ public:
const wxString getLabel( int n ) const wxString getLabel( int n )
{ {
printf("%.10f\n", m_labeledTicks[n] );
return formatSI ( m_labeledTicks[n], wxT("Hz"), 2 ); return formatSI ( m_labeledTicks[n], wxT("Hz"), 2 );
} }
}; };
@ -119,7 +118,6 @@ public:
const wxString getLabel( int n ) const wxString getLabel( int n )
{ {
printf("%.10f\n", m_labeledTicks[n] );
return formatSI ( m_labeledTicks[n], wxT("Hz"), 2 ); 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 ) switch( m_type )
{ {
case ST_AC: 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_y1 = new GAIN_SCALE( wxT( "Gain" ), mpALIGN_LEFT );
m_axis_y2 = new PHASE_SCALE( wxT( "Phase" ), mpALIGN_RIGHT ); m_axis_y2 = new PHASE_SCALE( wxT( "Phase" ), mpALIGN_RIGHT );
m_axis_y2->SetMasterScale(m_axis_y1); 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 ); m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH );
AddLayer( m_legend ); AddLayer( m_legend );
m_topLevel.push_back( m_legend ); m_topLevel.push_back( m_legend );
SetColourTheme(*wxBLACK, *wxWHITE, grey);
EnableDoubleBuffer(true);
UpdateAll(); UpdateAll();
} }