Simulation commands moved from eeschema menu to SIM_PLOT_FRAME buttons
This commit is contained in:
parent
751a335503
commit
0d764741f9
|
@ -256,8 +256,7 @@ enum id_eeschema_frm
|
||||||
ID_UPDATE_PCB_FROM_SCH,
|
ID_UPDATE_PCB_FROM_SCH,
|
||||||
ID_UPDATE_SCH_FROM_PCB,
|
ID_UPDATE_SCH_FROM_PCB,
|
||||||
|
|
||||||
ID_SIM_RUN,
|
ID_SIM_SHOW,
|
||||||
ID_SIM_STOP,
|
|
||||||
ID_SIM_ADD_PROBE
|
ID_SIM_ADD_PROBE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -422,25 +422,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Import and export settings" ),
|
_( "Import and export settings" ),
|
||||||
KiBitmap( save_setup_xpm ) );
|
KiBitmap( save_setup_xpm ) );
|
||||||
|
|
||||||
|
|
||||||
wxMenu* simMenu = new wxMenu;
|
|
||||||
|
|
||||||
AddMenuItem( simMenu,
|
|
||||||
ID_SIM_RUN,
|
|
||||||
_("Run simulation"), _( "Run simulation" ),
|
|
||||||
KiBitmap( pcbnew_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( simMenu,
|
|
||||||
ID_SIM_STOP,
|
|
||||||
_( "Stop simulation" ), _( "Stop simulation" ),
|
|
||||||
KiBitmap( pcbnew_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( simMenu,
|
|
||||||
ID_SIM_ADD_PROBE,
|
|
||||||
_( "Add probe" ), _( "Add probe" ),
|
|
||||||
KiBitmap( pcbnew_xpm ) );
|
|
||||||
|
|
||||||
|
|
||||||
// Menu Tools:
|
// Menu Tools:
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
wxMenu* toolsMenu = new wxMenu;
|
||||||
|
|
||||||
|
@ -511,6 +492,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Run CvPcb" ),
|
_( "Run CvPcb" ),
|
||||||
KiBitmap( cvpcb_xpm ) );
|
KiBitmap( cvpcb_xpm ) );
|
||||||
|
|
||||||
|
toolsMenu->AppendSeparator();
|
||||||
|
|
||||||
|
// Simulator
|
||||||
|
AddMenuItem( toolsMenu,
|
||||||
|
ID_SIM_SHOW,
|
||||||
|
_("Simula&te"), _( "Simulate the circuit" ),
|
||||||
|
wxNullBitmap );
|
||||||
|
|
||||||
// Help Menu:
|
// Help Menu:
|
||||||
wxMenu* helpMenu = new wxMenu;
|
wxMenu* helpMenu = new wxMenu;
|
||||||
|
|
||||||
|
@ -545,7 +534,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
menuBar->Append( placeMenu, _( "&Place" ) );
|
menuBar->Append( placeMenu, _( "&Place" ) );
|
||||||
menuBar->Append( preferencesMenu, _( "P&references" ) );
|
menuBar->Append( preferencesMenu, _( "P&references" ) );
|
||||||
menuBar->Append( simMenu, _( "&Simulate" ) );
|
|
||||||
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
||||||
menuBar->Append( helpMenu, _( "&Help" ) );
|
menuBar->Append( helpMenu, _( "&Help" ) );
|
||||||
|
|
||||||
|
|
|
@ -264,8 +264,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_TOOL( ID_GET_ERC, SCH_EDIT_FRAME::OnErc )
|
EVT_TOOL( ID_GET_ERC, SCH_EDIT_FRAME::OnErc )
|
||||||
EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist )
|
EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist )
|
||||||
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, SCH_EDIT_FRAME::OnUpdatePCB )
|
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, SCH_EDIT_FRAME::OnUpdatePCB )
|
||||||
EVT_TOOL( ID_SIM_RUN, SCH_EDIT_FRAME::OnSimulationRun )
|
EVT_TOOL( ID_SIM_SHOW, SCH_EDIT_FRAME::OnSimulate )
|
||||||
EVT_TOOL( ID_SIM_STOP, SCH_EDIT_FRAME::OnSimulationStop )
|
|
||||||
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
|
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
|
||||||
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
|
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
|
||||||
EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
|
EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
|
||||||
|
@ -281,6 +280,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_TOOL( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnSelectTool )
|
EVT_TOOL( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnSelectTool )
|
||||||
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||||
SCH_EDIT_FRAME::OnSelectTool )
|
SCH_EDIT_FRAME::OnSelectTool )
|
||||||
|
|
||||||
EVT_TOOL( ID_SIM_ADD_PROBE, SCH_EDIT_FRAME::OnSelectTool )
|
EVT_TOOL( ID_SIM_ADD_PROBE, SCH_EDIT_FRAME::OnSelectTool )
|
||||||
|
|
||||||
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
|
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
|
||||||
|
|
|
@ -813,8 +813,7 @@ private:
|
||||||
void OnErc( wxCommandEvent& event );
|
void OnErc( wxCommandEvent& event );
|
||||||
void OnCreateNetlist( wxCommandEvent& event );
|
void OnCreateNetlist( wxCommandEvent& event );
|
||||||
void OnUpdatePCB( wxCommandEvent& event );
|
void OnUpdatePCB( wxCommandEvent& event );
|
||||||
void OnSimulationRun( wxCommandEvent& event );
|
void OnSimulate( wxCommandEvent& event );
|
||||||
void OnSimulationStop( wxCommandEvent& event );
|
|
||||||
void OnCreateBillOfMaterials( wxCommandEvent& event );
|
void OnCreateBillOfMaterials( wxCommandEvent& event );
|
||||||
void OnFindItems( wxCommandEvent& event );
|
void OnFindItems( wxCommandEvent& event );
|
||||||
void OnFindDialogClose( wxFindDialogEvent& event );
|
void OnFindDialogClose( wxFindDialogEvent& event );
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <schframe.h>
|
#include <schframe.h>
|
||||||
|
#include <eeschema_id.h>
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
|
|
||||||
#include <netlist_exporter_kicad.h>
|
#include <netlist_exporter_kicad.h>
|
||||||
|
@ -35,11 +36,6 @@
|
||||||
#include "sim_plot_panel.h"
|
#include "sim_plot_panel.h"
|
||||||
#include "spice_simulator.h"
|
#include "spice_simulator.h"
|
||||||
|
|
||||||
#ifdef KICAD_SCRIPTING
|
|
||||||
#include <python_scripting.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class SIM_THREAD_REPORTER : public REPORTER
|
class SIM_THREAD_REPORTER : public REPORTER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -229,6 +225,40 @@ void SIM_PLOT_FRAME::AddVoltagePlot( const wxString& aNetName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SIM_PLOT_FRAME::isSimulationRunning()
|
||||||
|
{
|
||||||
|
wxCriticalSectionLocker lock( m_simThreadCS );
|
||||||
|
|
||||||
|
return ( m_simThread != NULL );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SIM_PLOT_FRAME::onSimulate( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if( isSimulationRunning() )
|
||||||
|
{
|
||||||
|
StopSimulation();
|
||||||
|
m_simulateBtn->SetLabel( wxT( "Simulate" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartSimulation();
|
||||||
|
m_simulateBtn->SetLabel( wxT( "Stop" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SIM_PLOT_FRAME::onPlaceProbe( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if( m_schematicFrame == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxCommandEvent* placeProbe = new wxCommandEvent( wxEVT_TOOL, ID_SIM_ADD_PROBE );
|
||||||
|
wxQueueEvent( m_schematicFrame, placeProbe );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SIM_PLOT_FRAME::onClose( wxCloseEvent& aEvent )
|
void SIM_PLOT_FRAME::onClose( wxCloseEvent& aEvent )
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,10 +63,19 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
|
||||||
void AddVoltagePlot( const wxString& aNetName );
|
void AddVoltagePlot( const wxString& aNetName );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void onClose( wxCloseEvent& aEvent );
|
bool isSimulationRunning();
|
||||||
virtual void onNewPlot( wxCommandEvent& aEvent ) { NewPlot(); }
|
|
||||||
virtual void onSimReport( wxThreadEvent& aEvent );
|
void onNewPlot( wxCommandEvent& aEvent ) override
|
||||||
virtual void onSimFinished( wxThreadEvent& aEvent );
|
{
|
||||||
|
NewPlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSimulate( wxCommandEvent& event ) override;
|
||||||
|
void onPlaceProbe( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
|
void onClose( wxCloseEvent& aEvent );
|
||||||
|
void onSimReport( wxThreadEvent& aEvent );
|
||||||
|
void onSimFinished( wxThreadEvent& aEvent );
|
||||||
|
|
||||||
SCH_EDIT_FRAME* m_schematicFrame;
|
SCH_EDIT_FRAME* m_schematicFrame;
|
||||||
NETLIST_EXPORTER_PSPICE* m_exporter;
|
NETLIST_EXPORTER_PSPICE* m_exporter;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <schframe.h>
|
#include <schframe.h>
|
||||||
#include "sim_plot_frame.h"
|
#include "sim_plot_frame.h"
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnSimulationRun( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnSimulate( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, true );
|
SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, true );
|
||||||
simFrame->Show( true );
|
simFrame->Show( true );
|
||||||
|
@ -36,14 +36,7 @@ void SCH_EDIT_FRAME::OnSimulationRun( wxCommandEvent& event )
|
||||||
simFrame->Iconize( false );
|
simFrame->Iconize( false );
|
||||||
|
|
||||||
simFrame->Raise();
|
simFrame->Raise();
|
||||||
|
|
||||||
simFrame->SetSchFrame( this );
|
simFrame->SetSchFrame( this );
|
||||||
simFrame->StartSimulation();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnSimulationStop( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue