kicad/eeschema/sim/simulator_frame_base.cpp

315 lines
14 KiB
C++
Raw Normal View History

2016-08-11 12:41:01 +00:00
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
2016-08-11 12:41:01 +00:00
// http://www.wxformbuilder.org/
//
2018-07-29 15:27:11 +00:00
// PLEASE DO *NOT* EDIT THIS FILE!
2016-08-11 12:41:01 +00:00
///////////////////////////////////////////////////////////////////////////
2023-01-01 23:37:24 +00:00
#include "tool/action_toolbar.h"
#include "widgets/wx_grid.h"
2023-01-01 23:37:24 +00:00
#include "simulator_frame_base.h"
2016-08-11 12:41:01 +00:00
///////////////////////////////////////////////////////////////////////////
SIMULATOR_FRAME_BASE::SIMULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : KIWAY_PLAYER( parent, id, title, pos, size, style, name )
2016-08-11 12:41:01 +00:00
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
m_sizerMain = new wxBoxSizer( wxVERTICAL );
2023-01-01 23:37:24 +00:00
m_toolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE|wxAUI_TB_HORZ_LAYOUT|wxAUI_TB_PLAIN_BACKGROUND );
m_toolBar->Realize();
m_sizerMain->Add( m_toolBar, 0, wxEXPAND, 5 );
m_splitterLeftRight = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterLeftRight->SetSashGravity( 0.7 );
m_splitterLeftRight->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this );
m_splitterLeftRight->SetMinimumPaneSize( 50 );
m_panelLeft = new wxPanel( m_splitterLeftRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelLeft->SetMinSize( wxSize( 300,-1 ) );
m_sizer11 = new wxBoxSizer( wxVERTICAL );
m_splitterPlotAndConsole = new wxSplitterWindow( m_panelLeft, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE );
m_splitterPlotAndConsole->SetSashGravity( 0.8 );
m_splitterPlotAndConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
m_splitterPlotAndConsole->SetMinimumPaneSize( 50 );
m_plotPanel = new wxPanel( m_splitterPlotAndConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_plotPanel->SetMinSize( wxSize( -1,200 ) );
m_sizerPlot = new wxBoxSizer( wxHORIZONTAL );
m_plotNotebook = new SIM_NOTEBOOK( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_MIDDLE_CLICK_CLOSE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TOP );
m_plotNotebook->SetMinSize( wxSize( 200,200 ) );
m_sizerPlot->Add( m_plotNotebook, 1, wxEXPAND, 5 );
m_plotPanel->SetSizer( m_sizerPlot );
2016-08-11 12:42:01 +00:00
m_plotPanel->Layout();
m_sizerPlot->Fit( m_plotPanel );
m_panelConsole = new wxPanel( m_splitterPlotAndConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelConsole->SetMinSize( wxSize( -1,100 ) );
m_sizerConsole = new wxBoxSizer( wxVERTICAL );
m_simConsole = new wxTextCtrl( m_panelConsole, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY );
m_simConsole->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_simConsole->SetMinSize( wxSize( -1,100 ) );
m_sizerConsole->Add( m_simConsole, 1, wxEXPAND, 5 );
m_panelConsole->SetSizer( m_sizerConsole );
m_panelConsole->Layout();
m_sizerConsole->Fit( m_panelConsole );
m_splitterPlotAndConsole->SplitHorizontally( m_plotPanel, m_panelConsole, 500 );
m_sizer11->Add( m_splitterPlotAndConsole, 1, wxEXPAND, 5 );
m_panelLeft->SetSizer( m_sizer11 );
m_panelLeft->Layout();
m_sizer11->Fit( m_panelLeft );
m_sidePanel = new wxPanel( m_splitterLeftRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_sidePanel->SetMinSize( wxSize( 200,-1 ) );
2016-08-11 12:42:01 +00:00
m_sideSizer = new wxBoxSizer( wxVERTICAL );
m_splitterSignals = new wxSplitterWindow( m_sidePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE );
2023-02-11 20:39:50 +00:00
m_splitterSignals->SetSashGravity( 0.5 );
m_splitterSignals->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this );
m_splitterSignals->SetMinimumPaneSize( 20 );
m_panelSignals = new wxPanel( m_splitterSignals, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelSignals->SetMinSize( wxSize( -1,100 ) );
2023-02-11 20:39:50 +00:00
wxBoxSizer* bSizerSignals;
bSizerSignals = new wxBoxSizer( wxVERTICAL );
m_filter = new wxSearchCtrl( m_panelSignals, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
#ifndef __WXMAC__
m_filter->ShowSearchButton( true );
#endif
m_filter->ShowCancelButton( true );
2023-02-11 20:39:50 +00:00
bSizerSignals->Add( m_filter, 0, wxEXPAND, 5 );
m_signalsGrid = new WX_GRID( m_panelSignals, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_signalsGrid->CreateGrid( 0, 5 );
m_signalsGrid->EnableEditing( true );
m_signalsGrid->EnableGridLines( true );
m_signalsGrid->EnableDragGridSize( false );
m_signalsGrid->SetMargins( 0, 0 );
// Columns
m_signalsGrid->SetColSize( 0, 207 );
m_signalsGrid->SetColSize( 1, 33 );
m_signalsGrid->SetColSize( 2, 38 );
m_signalsGrid->SetColSize( 3, 55 );
m_signalsGrid->SetColSize( 4, 55 );
m_signalsGrid->EnableDragColMove( false );
m_signalsGrid->EnableDragColSize( true );
m_signalsGrid->SetColLabelValue( 0, _("Signal") );
m_signalsGrid->SetColLabelValue( 1, _("Plot") );
m_signalsGrid->SetColLabelValue( 2, _("Color") );
m_signalsGrid->SetColLabelValue( 3, _("Cursor 1") );
m_signalsGrid->SetColLabelValue( 4, _("Cursor 2") );
m_signalsGrid->SetColLabelSize( -1 );
m_signalsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_signalsGrid->EnableDragRowSize( true );
m_signalsGrid->SetRowLabelSize( 0 );
m_signalsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_signalsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
2023-02-11 20:39:50 +00:00
bSizerSignals->Add( m_signalsGrid, 1, wxEXPAND, 5 );
2023-02-11 20:39:50 +00:00
m_panelSignals->SetSizer( bSizerSignals );
m_panelSignals->Layout();
2023-02-11 20:39:50 +00:00
bSizerSignals->Fit( m_panelSignals );
m_panelCMT = new wxPanel( m_splitterSignals, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelCMT->SetMinSize( wxSize( -1,300 ) );
2023-02-11 20:39:50 +00:00
wxBoxSizer* bSizerCMT;
bSizerCMT = new wxBoxSizer( wxVERTICAL );
2023-02-11 20:39:50 +00:00
m_splitterCursors = new wxSplitterWindow( m_panelCMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterCursors->SetSashGravity( 0.2 );
m_splitterCursors->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterCursorsOnIdle ), NULL, this );
2023-02-11 20:39:50 +00:00
m_splitterCursors->SetMinimumPaneSize( 20 );
2023-02-11 20:39:50 +00:00
m_panelCursors = new wxPanel( m_splitterCursors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelCursors->SetMinSize( wxSize( -1,60 ) );
2023-02-11 20:39:50 +00:00
wxBoxSizer* bSizerCursors;
bSizerCursors = new wxBoxSizer( wxVERTICAL );
m_cursorsGrid = new WX_GRID( m_panelCursors, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_cursorsGrid->CreateGrid( 0, 4 );
m_cursorsGrid->EnableEditing( true );
m_cursorsGrid->EnableGridLines( true );
m_cursorsGrid->EnableDragGridSize( false );
m_cursorsGrid->SetMargins( 0, 0 );
// Columns
m_cursorsGrid->SetColSize( 0, 45 );
m_cursorsGrid->SetColSize( 1, 162 );
2023-02-11 20:39:50 +00:00
m_cursorsGrid->SetColSize( 2, 90 );
m_cursorsGrid->SetColSize( 3, 90 );
m_cursorsGrid->EnableDragColMove( false );
m_cursorsGrid->EnableDragColSize( true );
m_cursorsGrid->SetColLabelValue( 0, _("Cursor") );
m_cursorsGrid->SetColLabelValue( 1, _("Signal") );
m_cursorsGrid->SetColLabelValue( 2, _("Time") );
m_cursorsGrid->SetColLabelValue( 3, _("Value") );
m_cursorsGrid->SetColLabelSize( -1 );
m_cursorsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_cursorsGrid->EnableDragRowSize( true );
m_cursorsGrid->SetRowLabelSize( 0 );
m_cursorsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_cursorsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
2023-02-11 20:39:50 +00:00
bSizerCursors->Add( m_cursorsGrid, 1, wxEXPAND, 5 );
2023-02-11 20:39:50 +00:00
m_panelCursors->SetSizer( bSizerCursors );
m_panelCursors->Layout();
2023-02-11 20:39:50 +00:00
bSizerCursors->Fit( m_panelCursors );
m_panelMT = new wxPanel( m_splitterCursors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelMT->SetMinSize( wxSize( -1,100 ) );
wxBoxSizer* bSizerMT;
bSizerMT = new wxBoxSizer( wxVERTICAL );
m_splitterMeasurements = new wxSplitterWindow( m_panelMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterMeasurements->SetSashGravity( 0.2 );
m_splitterMeasurements->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterMeasurementsOnIdle ), NULL, this );
2023-02-11 20:39:50 +00:00
m_splitterMeasurements->SetMinimumPaneSize( 20 );
m_panelMeasurements = new wxPanel( m_splitterMeasurements, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelMeasurements->SetMinSize( wxSize( -1,20 ) );
wxBoxSizer* bSizerMeasurements;
bSizerMeasurements = new wxBoxSizer( wxVERTICAL );
m_measurementsGrid = new WX_GRID( m_panelMeasurements, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_measurementsGrid->CreateGrid( 1, 3 );
2023-02-11 20:39:50 +00:00
m_measurementsGrid->EnableEditing( true );
m_measurementsGrid->EnableGridLines( true );
m_measurementsGrid->EnableDragGridSize( false );
m_measurementsGrid->SetMargins( 0, 0 );
// Columns
m_measurementsGrid->SetColSize( 0, 297 );
m_measurementsGrid->SetColSize( 1, 90 );
m_measurementsGrid->SetColSize( 2, 0 );
2023-02-11 20:39:50 +00:00
m_measurementsGrid->EnableDragColMove( false );
m_measurementsGrid->EnableDragColSize( true );
m_measurementsGrid->SetColLabelValue( 0, _("Measurement") );
m_measurementsGrid->SetColLabelValue( 1, _("Value") );
m_measurementsGrid->SetColLabelValue( 2, _("Format") );
2023-02-11 20:39:50 +00:00
m_measurementsGrid->SetColLabelSize( -1 );
m_measurementsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_measurementsGrid->EnableDragRowSize( true );
m_measurementsGrid->SetRowLabelSize( 0 );
m_measurementsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_measurementsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerMeasurements->Add( m_measurementsGrid, 1, wxEXPAND, 5 );
2023-02-11 20:39:50 +00:00
m_panelMeasurements->SetSizer( bSizerMeasurements );
m_panelMeasurements->Layout();
bSizerMeasurements->Fit( m_panelMeasurements );
m_panelTuners = new wxPanel( m_splitterMeasurements, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelTuners->SetMinSize( wxSize( -1,100 ) );
2023-02-11 20:39:50 +00:00
m_sizerTuners = new wxBoxSizer( wxHORIZONTAL );
2023-02-11 20:39:50 +00:00
m_panelTuners->SetSizer( m_sizerTuners );
m_panelTuners->Layout();
m_sizerTuners->Fit( m_panelTuners );
m_splitterMeasurements->SplitHorizontally( m_panelMeasurements, m_panelTuners, 0 );
bSizerMT->Add( m_splitterMeasurements, 1, wxEXPAND, 5 );
2023-02-11 20:39:50 +00:00
m_panelMT->SetSizer( bSizerMT );
m_panelMT->Layout();
bSizerMT->Fit( m_panelMT );
m_splitterCursors->SplitHorizontally( m_panelCursors, m_panelMT, 0 );
bSizerCMT->Add( m_splitterCursors, 1, wxEXPAND, 5 );
2023-02-11 20:39:50 +00:00
m_panelCMT->SetSizer( bSizerCMT );
m_panelCMT->Layout();
bSizerCMT->Fit( m_panelCMT );
m_splitterSignals->SplitHorizontally( m_panelSignals, m_panelCMT, 0 );
m_sideSizer->Add( m_splitterSignals, 1, wxEXPAND, 5 );
2016-08-11 12:42:01 +00:00
m_sidePanel->SetSizer( m_sideSizer );
m_sidePanel->Layout();
m_sideSizer->Fit( m_sidePanel );
m_splitterLeftRight->SplitVertically( m_panelLeft, m_sidePanel, 700 );
m_sizerMain->Add( m_splitterLeftRight, 1, wxEXPAND, 5 );
this->SetSizer( m_sizerMain );
2016-08-11 12:41:01 +00:00
this->Layout();
m_sizerMain->Fit( this );
2016-08-11 12:41:01 +00:00
this->Centre( wxBOTH );
2016-08-11 12:41:01 +00:00
// Connect Events
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClosed ), NULL, this );
m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onMeasurementsGridCellChanged ), NULL, this );
2016-08-11 12:41:01 +00:00
}
SIMULATOR_FRAME_BASE::~SIMULATOR_FRAME_BASE()
2016-08-11 12:41:01 +00:00
{
2016-08-11 12:41:01 +00:00
// Disconnect Events
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClosed ), NULL, this );
m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onMeasurementsGridCellChanged ), NULL, this );
2016-08-11 12:41:01 +00:00
}