Simulation frame displays a list of cursors and their values
This commit is contained in:
parent
c4e67c088d
commit
433f934dc1
|
@ -253,6 +253,29 @@ void SIM_PLOT_FRAME::onSignalRClick( wxMouseEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::onCursorsUpdate( wxUpdateUIEvent& event )
|
||||
{
|
||||
wxSize size = m_cursors->GetClientSize();
|
||||
m_cursors->ClearAll();
|
||||
|
||||
const long SIGNAL_COL = m_cursors->AppendColumn( wxT( "Signal" ), wxLIST_FORMAT_LEFT, size.x / 2 );
|
||||
const long X_COL = m_cursors->AppendColumn( CurrentPlot()->GetLabelX(), wxLIST_FORMAT_LEFT, size.x / 4 );
|
||||
const long Y_COL = m_cursors->AppendColumn( CurrentPlot()->GetLabelY(), wxLIST_FORMAT_LEFT, size.x / 4 );
|
||||
|
||||
// Update cursor values
|
||||
for( const auto& trace : CurrentPlot()->GetTraces() )
|
||||
{
|
||||
if( CURSOR* cursor = trace.second->GetCursor() )
|
||||
{
|
||||
const wxRealPoint coords = cursor->GetCoords();
|
||||
long idx = m_cursors->InsertItem( SIGNAL_COL, trace.first );
|
||||
m_cursors->SetItem( idx, X_COL, wxString::Format( "%f", coords.x ) );
|
||||
m_cursors->SetItem( idx, Y_COL, wxString::Format( "%f", coords.y ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::onSimulate( wxCommandEvent& event )
|
||||
{
|
||||
if( isSimulationRunning() )
|
||||
|
@ -303,15 +326,12 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
// If there are any signals plotted, update them
|
||||
for( unsigned int i = 0; i < m_plotNotebook->GetPageCount(); ++i )
|
||||
{
|
||||
SIM_PLOT_PANEL* plotPanel = static_cast<SIM_PLOT_PANEL*>( m_plotNotebook->GetPage( i ) );
|
||||
SIM_PLOT_PANEL* plotPanel = CurrentPlot();
|
||||
|
||||
for( const auto& trace : plotPanel->GetTraces() )
|
||||
updatePlot( trace.second->GetSpiceName(), trace.second->GetName(), plotPanel );
|
||||
|
||||
plotPanel->UpdateAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
|
|||
// Event handlers
|
||||
void onSignalDblClick( wxCommandEvent& event ) override;
|
||||
void onSignalRClick( wxMouseEvent& event ) override;
|
||||
void onCursorsUpdate( wxUpdateUIEvent& event ) override;
|
||||
|
||||
void onSimulate( wxCommandEvent& event ) override;
|
||||
void onPlaceProbe( wxCommandEvent& event ) override;
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
|
|||
|
||||
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 ) );
|
||||
|
||||
wxBoxSizer* bSizer6;
|
||||
bSizer6 = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -96,6 +97,13 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
|
|||
m_signals = new wxListBox( m_panel7, 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->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 );
|
||||
bSizer7->Add( m_cursors, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 1, 0, 0, 0 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
|
@ -117,7 +125,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
|
|||
m_panel7->SetSizer( bSizer7 );
|
||||
m_panel7->Layout();
|
||||
bSizer7->Fit( m_panel7 );
|
||||
bSizer5->Add( m_panel7, 1, wxEXPAND | wxALL, 5 );
|
||||
bSizer5->Add( m_panel7, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panel31->SetSizer( bSizer5 );
|
||||
|
@ -158,6 +166,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
|
|||
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_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 );
|
||||
|
@ -177,6 +186,7 @@ SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE()
|
|||
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_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 );
|
||||
|
|
|
@ -281,11 +281,11 @@
|
|||
<property name="name">bSizer1</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">3</property>
|
||||
<object class="wxPanel" expanded="0">
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -359,7 +359,7 @@
|
|||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer5</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
|
@ -401,7 +401,7 @@
|
|||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="minimum_size">300,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_panel61</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
@ -542,11 +542,11 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxPanel" expanded="0">
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -620,7 +620,7 @@
|
|||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer7</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
|
@ -796,6 +796,194 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Cursors</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText21</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxListCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cursors</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnListBeginDrag"></event>
|
||||
<event name="OnListBeginLabelEdit"></event>
|
||||
<event name="OnListBeginRDrag"></event>
|
||||
<event name="OnListCacheHint"></event>
|
||||
<event name="OnListColBeginDrag"></event>
|
||||
<event name="OnListColClick"></event>
|
||||
<event name="OnListColDragging"></event>
|
||||
<event name="OnListColEndDrag"></event>
|
||||
<event name="OnListColRightClick"></event>
|
||||
<event name="OnListDeleteAllItems"></event>
|
||||
<event name="OnListDeleteItem"></event>
|
||||
<event name="OnListEndLabelEdit"></event>
|
||||
<event name="OnListInsertItem"></event>
|
||||
<event name="OnListItemActivated"></event>
|
||||
<event name="OnListItemDeselected"></event>
|
||||
<event name="OnListItemFocused"></event>
|
||||
<event name="OnListItemMiddleClick"></event>
|
||||
<event name="OnListItemRightClick"></event>
|
||||
<event name="OnListItemSelected"></event>
|
||||
<event name="OnListKeyDown"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI">onCursorsUpdate</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
|
@ -1084,7 +1272,7 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
|
|
|
@ -28,6 +28,7 @@ class KIWAY_PLAYER;
|
|||
#include <wx/panel.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/richtext/richtextctrl.h>
|
||||
#include <wx/frame.h>
|
||||
|
@ -52,6 +53,8 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
|
|||
wxPanel* m_panel7;
|
||||
wxStaticText* m_staticText2;
|
||||
wxListBox* m_signals;
|
||||
wxStaticText* m_staticText21;
|
||||
wxListCtrl* m_cursors;
|
||||
wxButton* m_simulateBtn;
|
||||
wxButton* m_probeBtn;
|
||||
wxButton* m_tuneBtn;
|
||||
|
@ -70,6 +73,7 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
|
|||
virtual void menuShowGridState( wxUpdateUIEvent& 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(); }
|
||||
|
|
|
@ -148,6 +148,16 @@ public:
|
|||
|
||||
~SIM_PLOT_PANEL();
|
||||
|
||||
const wxString& GetLabelX() const
|
||||
{
|
||||
return m_axis_x->GetName();
|
||||
}
|
||||
|
||||
const wxString& GetLabelY() const
|
||||
{
|
||||
return m_axis_y->GetName();
|
||||
}
|
||||
|
||||
bool AddTrace( const wxString& aSpiceName, const wxString& aName, int aPoints,
|
||||
const double* aT, const double* aY, int aFlags );
|
||||
|
||||
|
|
Loading…
Reference in New Issue