28 #include <wx/stc/stc.h> 53 #include <wx/filedlg.h> 59 int res = (int) aFirst | (
int) aSecond;
75 wxCommandEvent*
event =
new wxCommandEvent( EVT_SIM_REPORT );
76 event->SetString( aText );
88 wxCommandEvent*
event =
nullptr;
93 event =
new wxCommandEvent( EVT_SIM_FINISHED );
97 event =
new wxCommandEvent( EVT_SIM_STARTED );
115 m_lastSimPlot( nullptr ),
117 m_simFinished( false )
125 throw std::runtime_error(
"There is no schematic window" );
136 throw std::runtime_error(
"Could not create simulator instance" );
216 #ifndef wxHAS_NATIVE_TABART 218 m_workbook->SetArtProvider(
new wxAuiSimpleTabArt() );
297 if(
project.m_SchematicSettings )
298 project.m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile();
337 bool readOnly =
false;
338 bool unsaved =
false;
340 if( filename.IsOk() && filename.FileExists() )
341 readOnly = !filename.IsFileWritable();
348 title = wxT(
"*" ) + filename.GetName();
350 title = filename.GetName();
353 title += wxS(
" " ) +
_(
"[Read Only]" );
356 title += wxS(
" " ) +
_(
"[Unsaved]" );
358 title += wxT(
" \u2014 " ) +
_(
"Spice Simulator" );
412 for(
int ii = 0; bm_list[ii].m_MenuId; ++ii )
414 wxMenuItem* item =
m_mainMenu->FindItem( bm_list[ii].m_MenuId );
419 wxMenu* menu = item->GetMenu();
422 wxMenuItemList& mlist = menu->GetMenuItems();
423 int mpos = mlist.IndexOf( item );
428 menu->Remove( item );
432 menu->Insert( mpos, item );
457 "Unknown simulation type" );
467 if( aSimCommand.IsEmpty() )
503 Pgm().GetCommonSettings()->m_Input.scroll_modifier_zoom != 0 );
505 plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel );
511 plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel );
514 wxString pageTitle(
m_simulator->TypeToName( simType,
true ) );
554 return t->GetComponentName() == componentName;
579 if( item == aSymbol )
613 dynamic_cast<SIM_PLOT_PANEL*>( curPage ) );
637 m_simConsole->AppendText(
_(
"Error: simulation type not defined!\n" ) );
643 m_simConsole->AppendText(
_(
"Error: simulation type doesn't support plotting!\n" ) );
651 if( !plotPanel || plotPanel->
GetType() != simType )
657 wxASSERT( plotPanel );
662 bool updated =
false;
677 updated =
updatePlot( aName, aType, aParam, plotPanel );
694 wxASSERT( plotPanel->
TraceShown( aPlotName ) );
699 wxCommandEvent
dummy;
717 wxString spiceVector =
m_exporter->ComponentToVector( aName, aType, aParam );
721 plotTitle +=
" (mag)";
723 plotTitle +=
" (phase)";
734 wxString xAxisName(
m_simulator->GetXAxis( simType ) );
736 if( xAxisName.IsEmpty() )
739 auto data_x =
m_simulator->GetMagPlot( (
const char*) xAxisName.c_str() );
740 unsigned int size = data_x.size();
745 std::vector<double> data_y;
752 "Cannot set both AC_PHASE and AC_MAG bits" );
755 data_y =
m_simulator->GetMagPlot( (
const char*) spiceVector.c_str() );
757 data_y =
m_simulator->GetPhasePlot( (
const char*) spiceVector.c_str() );
759 wxASSERT_MSG(
false,
"Plot type missing AC_PHASE or AC_MAG bit" );
766 data_y =
m_simulator->GetMagPlot( (
const char*) spiceVector.c_str() );
770 wxASSERT_MSG(
false,
"Unhandled plot type" );
774 if( data_y.size() != size )
791 size_t outer = ( size_t )( ( source2.
m_vend - v ) / source2.
m_vincrement ).ToDouble();
792 size_t inner = data_x.size() / ( outer + 1 );
794 wxASSERT( data_x.size() % ( outer + 1 ) == 0 );
796 for(
size_t idx = 0; idx <= outer; idx++ )
801 std::vector<double> sub_x( data_x.begin() + offset,
802 data_x.begin() + offset + inner );
803 std::vector<double> sub_y( data_y.begin() + offset,
804 data_y.begin() + offset + inner );
817 m_workbook->
AddTrace( aPlotPanel, plotTitle, aName, size, data_x.data(), data_y.data(), aType,
833 wxSize size =
m_signals->GetClientSize();
834 m_signals->AppendColumn(
_(
"Signal" ), wxLIST_FORMAT_LEFT, size.x );
840 const int isize = bmDC.GetCharHeight();
849 wxBitmap bitmap( isize, isize );
850 bmDC.SelectObject( bitmap );
851 wxColour tcolor = trace.second->GetPen().GetColour();
853 wxColour bgColor =
m_signals->wxWindow::GetBackgroundColour();
854 bmDC.SetPen( wxPen( bgColor ) );
855 bmDC.SetBrush( wxBrush( bgColor ) );
856 bmDC.DrawRectangle( 0, 0, isize, isize );
858 bmDC.SetPen( wxPen( tcolor ) );
859 bmDC.SetBrush( wxBrush( tcolor ) );
860 bmDC.DrawRectangle( 0, isize / 4 + 1, isize, isize / 2 );
862 bmDC.SelectObject( wxNullBitmap );
864 bitmap.SetMask(
new wxMask( bitmap, *wxBLACK ) );
870 bmDC.SetBrush( wxNullBrush );
871 bmDC.SetPen( wxNullPen );
882 for(
const auto& trace : plotPanel->
GetTraces() )
884 m_signals->InsertItem( imgidx, trace.first, imgidx );
892 const auto& spiceItems =
m_exporter->GetSpiceItems();
896 const wxString& ref = (*it)->GetComponentName();
898 if( std::find_if( spiceItems.begin(), spiceItems.end(), [&](
const SPICE_ITEM& item )
900 return item.m_refName == ref;
901 }) == spiceItems.end() )
921 std::string command(
"alter @" + tuner->GetSpiceName()
922 +
"=" + tuner->GetValue().ToSpiceString() );
933 wxTextFile file( aPath );
935 #define DISPLAY_LOAD_ERROR( fmt ) DisplayErrorMessage( this, wxString::Format( _( fmt ), \ 936 file.GetCurrentLine()+1 ) ) 943 if( !file.GetFirstLine().ToLong( &plotsCount ) )
951 for(
long i = 0; i < plotsCount; ++i )
953 long plotType, tracesCount;
955 if( !file.GetNextLine().ToLong( &plotType ) )
970 wxThread::This()->Sleep( 50 );
974 if( !file.GetNextLine().ToLong( &tracesCount ) )
982 for(
long j = 0; j < tracesCount; ++j )
985 wxString
name, param;
987 if( !file.GetNextLine().ToLong( &traceType ) )
995 name = file.GetNextLine();
1005 param = file.GetNextLine();
1007 if( param.IsEmpty() )
1021 wxFileName filename( aPath );
1022 filename.MakeRelativeTo(
Prj().GetProjectPath() );
1025 m_simulator->Settings()->SetWorkbookFilename( filename.GetFullPath() );
1035 wxFileName filename = aPath;
1038 wxTextFile file( filename.GetFullPath() );
1054 for(
size_t i = 0; i <
m_workbook->GetPageCount(); i++ )
1067 const SIM_PLOT_PANEL* plotPanel = dynamic_cast<const SIM_PLOT_PANEL*>( basePanel );
1077 for(
const auto& trace : plotPanel->
GetTraces() )
1080 file.AddLine( trace.second->GetName() );
1081 file.AddLine( trace.second->GetParam() );
1085 bool res = file.Write();
1091 filename.MakeRelativeTo(
Prj().GetProjectPath() );
1092 m_simulator->Settings()->SetWorkbookFilename( filename.GetFullPath() );
1102 wxFileName filename =
m_simulator->Settings()->GetWorkbookFilename();
1104 if( filename.GetName().IsEmpty() )
1108 filename.SetName(
_(
"noname" ) );
1113 filename.SetName(
Prj().GetProjectName() );
1118 return filename.GetFullName();
1126 path.Normalize( wxPATH_NORM_ALL,
Prj().GetProjectPath() );
1127 return path.GetPath();
1140 wxASSERT_MSG(
false,
"Unhandled simulation type" );
1157 wxFileDialog openDlg(
this,
_(
"Open simulation workbook" ),
getDefaultPath(),
"",
1160 if( openDlg.ShowModal() == wxID_CANCEL )
1172 wxString filename =
m_simulator->Settings()->GetWorkbookFilename();
1174 if( filename.IsEmpty() )
1186 wxFileDialog saveAsDlg(
this,
_(
"Save Simulation Workbook As" ),
getDefaultPath(),
1188 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1190 if( saveAsDlg.ShowModal() == wxID_CANCEL )
1202 wxFileDialog saveDlg(
this,
_(
"Save Plot as Image" ),
"",
"",
PngFileWildcard(),
1203 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1205 if( saveDlg.ShowModal() == wxID_CANCEL )
1217 const wxChar SEPARATOR =
';';
1219 wxFileDialog saveDlg(
this,
_(
"Save Plot Data" ),
"",
"",
CsvFileWildcard(),
1220 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1222 if( saveDlg.ShowModal() == wxID_CANCEL )
1225 wxFFile out( saveDlg.GetPath(),
"wb" );
1226 bool timeWritten =
false;
1230 const TRACE* trace = t.second;
1236 for(
double v : trace->
GetDataX() )
1239 out.Write(
"\r\n" );
1245 for(
double v : trace->
GetDataY() )
1248 out.Write(
"\r\n" );
1281 plot->ShowGrid( !
plot->IsGridShown() );
1289 event.Check(
plot ?
plot->IsGridShown() : false );
1298 plot->ShowLegend( !
plot->IsLegendShown() );
1305 event.Check(
plot ?
plot->IsLegendShown() : false );
1314 plot->SetDottedCurrentPhase( !
plot->GetDottedCurrentPhase() );
1322 event.Check(
plot ?
plot->GetDottedCurrentPhase() : false );
1334 for(
size_t page = 0; page <
m_workbook->GetPageCount(); page++ )
1336 wxWindow* curPage =
m_workbook->GetPage( page );
1340 SIM_PLOT_PANEL* panel = dynamic_cast<SIM_PLOT_PANEL*>( curPage );
1387 wxCommandEvent
dummy;
1396 wxCommandEvent
dummy;
1411 if( idx != wxNOT_FOUND )
1418 int idx =
event.GetIndex();
1420 if( idx != wxNOT_FOUND )
1425 if( idx != wxNOT_FOUND )
1427 const wxString& netName =
m_signals->GetItemText( idx, 0 );
1471 if(
m_workbook->GetPageIndex( plotPanelWindow ) != wxNOT_FOUND )
1476 wxString oldCommand;
1478 if(
m_workbook->GetPageIndex( plotPanelWindow ) != wxNOT_FOUND )
1481 oldCommand = wxString();
1489 if( !plotPanelWindow
1490 || ( plotPanelWindow && plotPanelWindow->
GetType() != newSimType )
1491 || ( newSimType ==
ST_DC 1492 && oldCommand.Lower().GetChar( 4 ) != newCommand.Lower().GetChar( 4 ) ) )
1509 wxCHECK_RET(
m_simFinished,
"No simulation results available" );
1526 wxCHECK_RET(
m_simFinished,
"No simulation results available" );
1538 wxCHECK_RET(
m_simFinished,
"No simulation results available" );
1558 void onClose( wxCloseEvent& evt )
1560 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL ) );
1563 NETLIST_VIEW_DIALOG( wxWindow* parent, wxString source) :
1565 wxDefaultPosition, wxDefaultSize,
1566 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
1568 wxStyledTextCtrl*
text =
new wxStyledTextCtrl(
this, wxID_ANY );
1569 text->SetMinSize( wxSize( 600, 400 ) );
1571 text->SetMarginWidth( MARGIN_LINE_NUMBERS, 50 );
1572 text->StyleSetForeground( wxSTC_STYLE_LINENUMBER, wxColour( 75, 75, 75 ) );
1573 text->StyleSetBackground( wxSTC_STYLE_LINENUMBER, wxColour( 220, 220, 220 ) );
1574 text->SetMarginType( MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER );
1578 for(
size_t i = 0; i < wxSTC_STYLE_MAX; ++i )
1579 text->StyleSetFont( i, fixedFont );
1581 text->StyleClearAll();
1583 text->SetWrapMode( wxSTC_WRAP_WORD );
1585 text->SetText( source );
1587 text->SetLexer( wxSTC_LEX_SPICE );
1589 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
1590 sizer->Add(
text, 1, wxEXPAND );
1593 Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ),
1596 finishDialogSettings();
1603 NETLIST_VIEW_DIALOG dlg(
this,
m_simulator->GetNetlist() );
1612 wxFileName filename =
m_simulator->Settings()->GetWorkbookFilename();
1614 if( filename.GetName().IsEmpty() )
1617 filename.SetFullName( wxT(
"noname.wbk" ) );
1619 filename.SetFullName(
Prj().GetProjectName() + wxT(
".wbk" ) );
1622 wxString fullFilename = filename.GetFullName();
1623 wxString msg =
_(
"Save changes to '%s' before closing?" );
1651 wxSize size =
m_cursors->GetClientSize();
1662 m_cursors->AppendColumn(
_(
"Signal" ), wxLIST_FORMAT_LEFT, size.x / 2 );
1663 const long X_COL =
m_cursors->AppendColumn( plotPanel->
GetLabelX(), wxLIST_FORMAT_LEFT,
1670 if( !labelY2.IsEmpty() )
1671 labelY = labelY1 +
" / " + labelY2;
1675 const long Y_COL =
m_cursors->AppendColumn( labelY, wxLIST_FORMAT_LEFT, size.x / 4 );
1680 for(
const auto& trace : plotPanel->
GetTraces() )
1686 long iconColor =
m_signals->FindItem( -1, trace.first );
1688 const wxRealPoint coords =
cursor->GetCoords();
1689 long idx =
m_cursors->InsertItem( itemidx++, trace.first, iconColor );
1700 SetCursor( wxCURSOR_ARROWWAIT );
1707 SetCursor( wxCURSOR_ARROW );
1716 if( !plotPanelWindow || plotPanelWindow->
GetType() != simType )
1725 SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( plotPanelWindow );
1726 wxCHECK_RET( plotPanel,
"not a SIM_PLOT_PANEL" );
1735 std::vector<struct TRACE_DESC> traceInfo;
1738 for(
auto& trace : plotPanel->
GetTraces() )
1740 struct TRACE_DESC placeholder;
1741 placeholder.m_name = trace.second->GetName();
1742 placeholder.m_type = trace.second->GetType();
1743 placeholder.m_param = trace.second->GetParam();
1745 traceInfo.push_back( placeholder );
1748 for(
auto& trace : traceInfo )
1750 if( !
updatePlot( trace.m_name, trace.m_type, trace.m_param, plotPanel ) )
1758 else if( simType ==
ST_OP )
1760 m_simConsole->AppendText(
_(
"\n\nSimulation results:\n\n" ) );
1765 std::vector<double> val_list =
m_simulator->GetRealPlot( vec, 1 );
1767 if( val_list.size() == 0 )
1770 double val = val_list.at( 0 );
1771 wxString outLine, signal;
1774 const size_t tab = 25;
1775 size_t padding = ( signal.length() < tab ) ? ( tab - signal.length() ) : 1;
1777 outLine.Printf( wxT(
"%s%s" ),
1778 ( signal + wxT(
":" ) ).Pad( padding, wxUniChar(
' ' ) ),
1781 outLine.Append( type ==
SPT_CURRENT ?
"A\n" :
"V\n" );
1826 m_signal( aSignal ),
1827 m_plotFrame( aPlotFrame )
1850 switch( aEvent.GetId() )
1853 m_plotFrame->removePlot( m_signal );
1857 plot->EnableCursor( m_signal,
true );
1861 plot->EnableCursor( m_signal,
false );
Field Reference of part, i.e. "IC21".
void onAddSignal(wxCommandEvent &event)
#define ID_MENU_PROBE_SIGNALS
EE_TYPE OfType(KICAD_T aType) const
void ZoomOut(const wxPoint ¢erPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
bool saveWorkbook(const wxString &aPath)
Save plot settings to a file.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
wxString ToSpiceString() const
Return string value in Spice format (e.g.
void SetKiway(wxWindow *aDest, KIWAY *aKiway)
It is only used for debugging, since "this" is not a wxWindow*.
wxToolBarToolBase * m_toolProbe
void setIconsForMenuItems()
Give icons to menuitems of the main menubar.
void onSimStarted(wxCommandEvent &aEvent)
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
void RemoveTuner(TUNER_SLIDER *aTuner, bool aErase=true)
Remove an existing tuner.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
bool GetPlotBgOpt() const
wxImageList * m_signalsIconColorList
SIM_PLOT_TYPE operator|(SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond)
void onPlotChanged(wxAuiNotebookEvent &event) override
void onPlotDragged(wxAuiNotebookEvent &event) override
SIM_PLOT_FRAME * m_parent
wxMenuItem * m_boardAdapter
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void EnableMouseWheelPan(bool enabled)
Enable/disable trackpad friendly panning (2-axis scroll wheel)
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void menuWhiteBackground(wxCommandEvent &event) override
void SetSimCommand(SIM_PANEL_BASE *aPlotPanel, const wxString &aSimCommand)
void onSignalDblClick(wxMouseEvent &event) override
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
bool SetSimCommand(const wxString &aCommand)
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
mpWindow * GetPlotWin() const
This file is part of the common library.
wxSplitterWindow * m_splitterSignals
void onPlotClosed(wxAuiNotebookEvent &event) override
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
SIM_PANEL_BASE * NewPlotPanel(wxString aSimCommand)
Create a new plot panel for a given simulation type and adds it to the main notebook.
int m_splitterPlotAndConsoleSashPosition
void menuZoomFit(wxCommandEvent &event) override
virtual PROJECT_FILE & GetProjectFile() const
Structure to represent a schematic symbol in the Spice simulation.
void initWorkbook()
Load the currently active workbook stored in the project settings.
wxFont GetMonospacedUIFont()
bool AddPage(wxWindow *aPage, const wxString &aCaption, bool aSelect=false, const wxBitmap &aBitmap=wxNullBitmap)
const std::vector< double > & GetDataX() const
bool canCloseWindow(wxCloseEvent &aEvent) override
std::list< TUNER_SLIDER * > m_tuners
static TOOL_ACTION cancelInteractive
void doCloseWindow() override
Class SIM_PLOT_FRAME_BASE.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void menuNewPlot(wxCommandEvent &aEvent) override
void applyTuners()
Apply component values specified using tuner sliders to the current netlist.
SIM_PLOT_PANEL * GetCurrentPlot() const
Return the currently opened plot panel (or NULL if there is none).
wxString getDefaultPath()
Return the default path to be used in file browser dialog.
void AddVoltagePlot(const wxString &aNetName)
Add a voltage plot for a given net name.
void AddCurrentPlot(const wxString &aDeviceName, const wxString &aParam)
Add a current plot for a particular device.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
std::shared_ptr< SPICE_SIMULATOR_SETTINGS > & GetSimulatorSettings()
Schematic editor (Eeschema) main window.
wxString CsvFileWildcard()
wxString getDefaultFilename()
Return the default filename (with extension) to be used in file browser dialog.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
bool DeleteAllPages() override
void onWorkbookModified(wxCommandEvent &event)
void onSimUpdate(wxCommandEvent &aEvent)
bool updatePlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam, SIM_PLOT_PANEL *aPlotPanel)
Update plot in a particular SIM_PLOT_PANEL.
void menuOpenWorkbook(wxCommandEvent &event) override
void menuShowGrid(wxCommandEvent &event) override
wxMenuItem * m_showNetlist
void menuZoomIn(wxCommandEvent &event) override
void UpdateTunerValue(SCH_SYMBOL *aSymbol, int aId, const wxString &aValue)
Safely update a field of the associated symbol without dereferencing the symbol.
A pure virtual class used to derive REPORTER objects from.
void menuZoomOut(wxCommandEvent &event) override
SIM_THREAD_REPORTER * m_reporter
List of currently displayed tuners.
void OnSimStateChange(SPICE_SIMULATOR *aObject, SIM_STATE aNewState) override
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
std::shared_ptr< SPICE_SIMULATOR > m_simulator
void menuProbeUpdate(wxUpdateUIEvent &event) override
The backing store for a PROJECT, in JSON format.
wxString GetLabelY1() const
wxSplitterWindow * m_splitterTuneValues
static bool IsPlottable(SIM_TYPE aSimType)
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Return simulation type basing on a simulation command directive.
wxMenuItem * m_probeSignals
void AddTuner(SCH_SYMBOL *aSymbol)
Add a tuner for a symbol.
void menuSaveCsv(wxCommandEvent &event) override
void onPlotClose(wxAuiNotebookEvent &event) override
void StartSimulation(const wxString &aSimCommand=wxEmptyString)
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
SCH_EDIT_FRAME * m_schematicFrame
void UpdateAll()
Refresh display.
bool AddTrace(SIM_PLOT_PANEL *aPlotPanel, const wxString &aTitle, const wxString &aName, int aPoints, const double *aX, const double *aY, SIM_PLOT_TYPE aType, const wxString &aParam)
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const wxString & GetSimCommand() const
void setSubWindowsSashSize()
Stores the common settings that are saved and loaded for each window / frame.
wxString ToString() const
Return string value as when converting double to string (e.g.
SIM_PLOT_PANEL * m_lastSimPlot
imagelists used to add a small colored icon to signal names and cursors name, the same color as the c...
wxString GetLabelX() const
virtual void SetText(const wxString &aText)
void AddBitmapToMenuItem(wxMenuItem *aMenu, const wxBitmap &aImage)
Add a bitmap to a menuitem.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
#define ID_MENU_SHOW_NETLIST
wxString GetLabelY2() const
static TOOL_ACTION simTune
static void FillDefaultColorList(bool aWhiteBg)
Fills m_colorList by a default set of colors.
void removePlot(const wxString &aPlotName)
Remove a plot with a specific title.
< Helper class to handle Spice way of expressing values (e.g. 10.5 Meg) Helper class to recognize Spi...
wxString getCurrentSimCommand() const
wxSplitterWindow * m_splitterLeftRight
void ZoomIn(const wxPoint ¢erPoint=wxDefaultPosition)
Zoom into current view and refresh display.
wxMenuItem * m_runSimulation
#define ID_MENU_TUNE_SIGNALS
void onSimReport(wxCommandEvent &aEvent)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SIM_TYPE
< Possible simulation types
void menuTuneUpdate(wxUpdateUIEvent &event) override
void onSimFinished(wxCommandEvent &aEvent)
Interface to receive simulation updates from SPICE_SIMULATOR class.
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
void onShowNetlist(wxCommandEvent &event)
SIM_THREAD_REPORTER(SIM_PLOT_FRAME *aParent)
void menuShowLegendUpdate(wxUpdateUIEvent &event) override
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
void menuSaveWorkbookAs(wxCommandEvent &event) override
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
wxToolBarToolBase * m_toolAddSignals
Subclass of SIM_PLOT_FRAME_BASE, which is generated by wxFormBuilder.
SIM_PANEL_BASE * getCurrentPlotWindow() const
Return the currently opened plot panel (or NULL if there is none).
int m_splitterTuneValuesSashPosition
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
static std::shared_ptr< SPICE_SIMULATOR > CreateInstance(const std::string &aName)
void onSignalRClick(wxListEvent &event) override
void ResetScales()
Update trace line style.
void onWorkbookClrModified(wxCommandEvent &event)
#define ID_MENU_SHOW_LEGEND
void menuAddSignalsUpdate(wxUpdateUIEvent &event) override
void menuShowLegend(wxCommandEvent &event) override
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
void onTune(wxCommandEvent &event)
wxToolBarToolBase * m_toolSimulate
wxString UnescapeString(const wxString &aSource)
void menuSaveImage(wxCommandEvent &event) override
#define ID_MENU_SET_SIMUL
wxString PngFileWildcard()
Implementing SIM_PLOT_FRAME_BASE.
bool loadWorkbook(const wxString &aPath)
Load plot settings from a file.
void SetNetlistExporter(NETLIST_EXPORTER_PSPICE_SIM *aExporter)
static wxString GetSpiceField(SPICE_FIELD aField, SCH_SYMBOL *aSymbol, unsigned aCtl)
Retrieve either the requested field value or the default value.
const wxString & GetSimCommand(const SIM_PANEL_BASE *aPlotPanel)
void onCursorUpdate(wxCommandEvent &aEvent)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
bool DeleteTrace(SIM_PLOT_PANEL *aPlotPanel, const wxString &aName)
#define DISPLAY_LOAD_ERROR(fmt)
DIALOG_SIM_SETTINGS * m_settingsDlg
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
const wxString What() const
void UpdatePlotColors()
Update plot colors
#define ID_MENU_ADD_SIGNAL
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
void updateNetlistExporter()
Reload the current schematic for the netlist exporter.
void onSimulate(wxCommandEvent &event)
void onProbe(wxCommandEvent &event)
#define ID_MENU_SHOW_GRID
BITMAPS
A list of all bitmap identifiers.
void menuSimulateUpdate(wxUpdateUIEvent &event) override
void updateSignalList()
Update the list of currently plotted signals.
wxMenuItem * m_addSignals
SIM_WORKBOOK * m_workbook
SIM_PLOT_TYPE getXAxisType(SIM_TYPE aType) const
Return X axis for a given simulation type.
int GetNetlistOptions() const
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
unsigned int m_plotNumber
int m_splitterSignalsSashPosition
void updateTitle()
Set the main window title bar text.
void menuShowDotted(wxCommandEvent &event) override
wxDEFINE_EVENT(EVT_SIM_UPDATE, wxCommandEvent)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
const std::vector< double > & GetDataY() const
int m_splitterLeftRightSashPosition
void menuShowDottedUpdate(wxUpdateUIEvent &event) override
static TOOL_ACTION simProbe
virtual const wxString GetProjectName() const
Return the short name of the project.
const NETLIST_EXPORTER_PSPICE_SIM * GetExporter() const
Return the netlist exporter object used for simulations.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
Custom widget to handle quick component values modification and simulation on the fly.
wxString WorkbookFileWildcard()
bool SaveScreenshot(const wxString &filename, wxBitmapType type=wxBITMAP_TYPE_BMP, wxSize imageSize=wxDefaultSize, bool fit=false)
Draw the window on a wxBitmap, then save it to a file.
const std::map< wxString, TRACE * > & GetTraces() const
wxSplitterWindow * m_splitterPlotAndConsole
void menuShowGridUpdate(wxUpdateUIEvent &event) override
const std::string WorkbookFileExtension
bool HasMessage() const override
Returns true if the reporter client is non-empty.
void menuSaveWorkbook(wxCommandEvent &event) override
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
wxTextCtrl * m_simConsole
Class is responsible for providing colors for traces on simulation plot.
void addPlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
Add a new plot to the current panel.
virtual const wxString & GetText() const
Return the string associated with the text object.
void onSettings(wxCommandEvent &event)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
wxToolBarToolBase * m_toolTune
bool TraceShown(const wxString &aName) const
Cursor attached to a trace to follow its values:
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
Special netlist exporter flavor that allows one to override simulation commands.
void updateTuners()
Filter out tuners for components that do not exist anymore.
Hold a translatable error message and may be used when throwing exceptions containing a translated er...
wxToolBarToolBase * m_toolSettings
SIM_PLOT_FRAME(KIWAY *aKiway, wxWindow *aParent)