KiCad PCB EDA Suite
SIM_PLOT_FRAME Class Reference

Implementing SIM_PLOT_FRAME_BASE. More...

#include <sim_plot_frame.h>

Inheritance diagram for SIM_PLOT_FRAME:
SIM_PLOT_FRAME_BASE KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER

Classes

struct  PLOT_INFO
 
class  SIGNAL_CONTEXT_MENU
 

Public Member Functions

 SIM_PLOT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 Constructor. More...
 
 ~SIM_PLOT_FRAME ()
 
void StartSimulation ()
 
void StopSimulation ()
 
bool IsSimulationRunning ()
 
SIM_PLOT_PANELNewPlotPanel (SIM_TYPE aSimType)
 Creates a new plot panel for a given simulation type and adds it to the main notebook. More...
 
void AddVoltagePlot (const wxString &aNetName)
 Adds a voltage plot for a given net name. More...
 
void AddCurrentPlot (const wxString &aDeviceName, const wxString &aParam)
 Adds a current plot for a particular device. More...
 
void AddTuner (SCH_COMPONENT *aComponent)
 Adds a tuner for a component. More...
 
void RemoveTuner (TUNER_SLIDER *aTuner, bool aErase=true)
 Removes an existing tuner. More...
 
SIM_PLOT_PANELCurrentPlot () const
 Returns the currently opened plot panel (or NULL if there is none). More...
 
void m_splitterLeftRightOnIdle (wxIdleEvent &)
 
void m_splitterPlotAndConsoleOnIdle (wxIdleEvent &)
 
void m_splitterSignalsOnIdle (wxIdleEvent &)
 
void m_splitterTuneValuesOnIdle (wxIdleEvent &)
 
VTBL_ENTRY bool OpenProjectFiles (const std::vector< wxString > &aFileList, int aCtl=0)
 Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList. More...
 
VTBL_ENTRY bool ImportFile (const wxString &aFileName, int aFileType)
 Function ImportFile load the given filename but sets the path to the current project path. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
virtual int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
 Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mechanism or a file. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
virtual void ReCreateMenuBar ()
 Function ReCreateMenuBar Creates recreates the menu bar. More...
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedLanguage ()
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
virtual int GetIconScale ()
 Function GetIconScale. More...
 
virtual void SetIconScale (int aScale)
 Function SetIconScale. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Protected Attributes

wxMenuBar * m_mainMenu
 
wxMenu * m_fileMenu
 
wxMenu * m_simulationMenu
 
wxMenuItem * m_runSimulation
 
wxMenuItem * m_addSignals
 
wxMenuItem * m_probeSignals
 
wxMenuItem * m_tuneValue
 
wxMenuItem * m_settings
 
wxMenu * m_viewMenu
 
wxBoxSizer * m_sizerMain
 
wxToolBar * m_toolBar
 
wxSplitterWindow * m_splitterLeftRight
 
wxPanel * m_panelLeft
 
wxBoxSizer * m_sizer11
 
wxSplitterWindow * m_splitterPlotAndConsole
 
wxPanel * m_plotPanel
 
wxBoxSizer * m_sizerPlot
 
wxAuiNotebook * m_plotNotebook
 
wxPanel * m_welcomePanel
 
wxBoxSizer * m_sizer8
 
wxStaticText * m_staticText2
 
wxPanel * m_panelConsole
 
wxBoxSizer * m_sizerConsole
 
wxTextCtrl * m_simConsole
 
wxPanel * m_sidePanel
 
wxBoxSizer * m_sideSizer
 
wxSplitterWindow * m_splitterSignals
 
wxPanel * m_panelSignals
 
wxListView * m_signals
 
wxPanel * m_panelCursorsAndTune
 
wxSplitterWindow * m_splitterTuneValues
 
wxPanel * m_panelCursors
 
wxListCtrl * m_cursors
 
wxPanel * m_tunePanel
 
wxStaticBoxSizer * m_tuneSizerStb
 
wxBoxSizer * m_tuneSizer
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Types

typedef std::map< wxString, TRACE_DESCTRACE_MAP
 

Private Member Functions

void LoadSettings (wxConfigBase *aCfg) override
 Function LoadSettings loads common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Function SaveSettings saves common frame parameters to a configuration data file. More...
 
void addPlot (const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
 Adds a new plot to the current panel. More...
 
void removePlot (const wxString &aPlotName, bool aErase=true)
 Removes a plot with a specific title. More...
 
void updateNetlistExporter ()
 Reloads the current schematic for the netlist exporter. More...
 
bool updatePlot (const TRACE_DESC &aDescriptor, SIM_PLOT_PANEL *aPanel)
 Updates plot in a particular SIM_PLOT_PANEL. More...
 
void updateSignalList ()
 Updates the list of currently plotted signals. More...
 
void updateCursors ()
 Updates the cursor values list. More...
 
void updateTuners ()
 Filters out tuners for components that do not exist anymore. More...
 
void applyTuners ()
 Applies component values specified using tunder sliders to the current netlist. More...
 
bool loadWorkbook (const wxString &aPath)
 Loads plot settings from a file. More...
 
bool saveWorkbook (const wxString &aPath)
 Saves plot settings to a file. More...
 
SIM_PLOT_TYPE GetXAxisType (SIM_TYPE aType) const
 Returns X axis for a given simulation type. More...
 
void menuNewPlot (wxCommandEvent &aEvent) override
 
void menuOpenWorkbook (wxCommandEvent &event) override
 
void menuSaveWorkbook (wxCommandEvent &event) override
 
void menuExit (wxCommandEvent &event) override
 
void menuSaveImage (wxCommandEvent &event) override
 
void menuSaveCsv (wxCommandEvent &event) override
 
void menuZoomIn (wxCommandEvent &event) override
 
void menuZoomOut (wxCommandEvent &event) override
 
void menuZoomFit (wxCommandEvent &event) override
 
void menuShowGrid (wxCommandEvent &event) override
 
void menuShowGridUpdate (wxUpdateUIEvent &event) override
 
void menuShowLegend (wxCommandEvent &event) override
 
void menuShowLegendUpdate (wxUpdateUIEvent &event) override
 
void onPlotChanged (wxAuiNotebookEvent &event) override
 
void onPlotClose (wxAuiNotebookEvent &event) override
 
void onSignalDblClick (wxMouseEvent &event) override
 
void onSignalRClick (wxListEvent &event) override
 
void onSimulate (wxCommandEvent &event)
 
void onSettings (wxCommandEvent &event)
 
void onAddSignal (wxCommandEvent &event)
 
void onProbe (wxCommandEvent &event)
 
void onTune (wxCommandEvent &event)
 
void onClose (wxCloseEvent &aEvent)
 
void onCursorUpdate (wxCommandEvent &aEvent)
 
void onSimUpdate (wxCommandEvent &aEvent)
 
void onSimReport (wxCommandEvent &aEvent)
 
void onSimStarted (wxCommandEvent &aEvent)
 
void onSimFinished (wxCommandEvent &aEvent)
 
void setSubWindowsSashSize ()
 

Private Attributes

wxToolBarToolBase * m_toolSimulate
 
wxToolBarToolBase * m_toolAddSignals
 
wxToolBarToolBase * m_toolProbe
 
wxToolBarToolBase * m_toolTune
 
wxToolBarToolBase * m_toolSettings
 
SCH_EDIT_FRAMEm_schematicFrame
 
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIMm_exporter
 
SPICE_SIMULATORm_simulator
 
SIM_THREAD_REPORTERm_reporter
 
std::map< SIM_PLOT_PANEL *, PLOT_INFOm_plots
 

Map of plot panels and associated data

More...
 
std::list< TUNER_SLIDER * > m_tuners
 

List of currently displayed tuners

More...
 
DIALOG_SIM_SETTINGSm_settingsDlg
 
SIM_PLOT_PANELm_lastSimPlot
 

Panel that was used as the most recent one for simulations

More...
 
wxImageList * m_signalsIconColorList
 

imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the corresponding signal traces

More...
 
int m_splitterLeftRightSashPosition
 
int m_splitterPlotAndConsoleSashPosition
 
int m_splitterSignalsSashPosition
 
int m_splitterTuneValuesSashPosition
 

Static Private Attributes

static wxString m_savedWorkbooksPath
 

A string to store the path of saved workbooks during a session

More...
 

Detailed Description

Implementing SIM_PLOT_FRAME_BASE.

Definition at line 109 of file sim_plot_frame.h.

Member Typedef Documentation

typedef std::map<wxString, TRACE_DESC> SIM_PLOT_FRAME::TRACE_MAP
private

Definition at line 291 of file sim_plot_frame.h.

Constructor & Destructor Documentation

SIM_PLOT_FRAME::SIM_PLOT_FRAME ( KIWAY aKiway,
wxWindow *  aParent 
)

Constructor.

Definition at line 114 of file sim_plot_frame.cpp.

References EDA_BASE_FRAME::config(), SPICE_SIMULATOR::CreateInstance(), FRAME_SCH, PROJECT::GetProjectPath(), ID_SIM_ADD_SIGNALS, ID_SIM_PROBE, ID_SIM_RUN, ID_SIM_TUNE, SPICE_SIMULATOR::Init(), KiBitmap(), KIWAY_HOLDER::Kiway(), LoadSettings(), SIM_PLOT_FRAME_BASE::m_addSignals, SIM_PLOT_FRAME_BASE::m_plotNotebook, SIM_PLOT_FRAME_BASE::m_probeSignals, m_reporter, SIM_PLOT_FRAME_BASE::m_runSimulation, m_savedWorkbooksPath, m_schematicFrame, SIM_PLOT_FRAME_BASE::m_settings, m_settingsDlg, m_signalsIconColorList, m_simulator, m_toolAddSignals, SIM_PLOT_FRAME_BASE::m_toolBar, m_toolProbe, m_toolSettings, m_toolSimulate, m_toolTune, SIM_PLOT_FRAME_BASE::m_tuneValue, onAddSignal(), onClose(), onCursorUpdate(), onProbe(), onSettings(), onSimFinished(), onSimReport(), onSimStarted(), onSimulate(), onSimUpdate(), onTune(), KIWAY::Player(), KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), SPICE_SIMULATOR::SetReporter(), setSubWindowsSashSize(), and updateNetlistExporter().

115  : SIM_PLOT_FRAME_BASE( aParent ), m_lastSimPlot( nullptr )
116 {
117  SetKiway( this, aKiway );
118  m_signalsIconColorList = NULL;
119 
121 
122  if( m_schematicFrame == NULL )
123  throw std::runtime_error( "There is no schematic window" );
124 
125  // Give an icon
126  wxIcon icon;
127  icon.CopyFromBitmap( KiBitmap( simulator_xpm ) );
128  SetIcon( icon );
129 
130  // Get the previous size and position of windows:
131  LoadSettings( config() );
132 
134 
135  if( !m_simulator )
136  {
137  throw std::runtime_error( "Could not create simulator instance" );
138  return;
139  }
140 
141  m_simulator->Init();
142 
143  if( m_savedWorkbooksPath.IsEmpty() )
144  {
146  }
147 
148  m_reporter = new SIM_THREAD_REPORTER( this );
150 
152 
153  Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SIM_PLOT_FRAME::onClose ), NULL, this );
154  Connect( EVT_SIM_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onSimUpdate ), NULL, this );
155  Connect( EVT_SIM_REPORT, wxCommandEventHandler( SIM_PLOT_FRAME::onSimReport ), NULL, this );
156  Connect( EVT_SIM_STARTED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimStarted ), NULL, this );
157  Connect( EVT_SIM_FINISHED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimFinished ), NULL, this );
158  Connect( EVT_SIM_CURSOR_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onCursorUpdate ), NULL, this );
159 
160  // Toolbar buttons
161  m_toolSimulate = m_toolBar->AddTool( ID_SIM_RUN, _( "Run/Stop Simulation" ),
162  KiBitmap( sim_run_xpm ), _( "Run Simulation" ), wxITEM_NORMAL );
163  m_toolAddSignals = m_toolBar->AddTool( ID_SIM_ADD_SIGNALS, _( "Add Signals" ),
164  KiBitmap( sim_add_signal_xpm ), _( "Add signals to plot" ), wxITEM_NORMAL );
165  m_toolProbe = m_toolBar->AddTool( ID_SIM_PROBE, _( "Probe" ),
166  KiBitmap( sim_probe_xpm ), _( "Probe signals on the schematic" ), wxITEM_NORMAL );
167  m_toolTune = m_toolBar->AddTool( ID_SIM_TUNE, _( "Tune" ),
168  KiBitmap( sim_tune_xpm ), _( "Tune component values" ), wxITEM_NORMAL );
169  m_toolSettings = m_toolBar->AddTool( wxID_ANY, _( "Settings" ),
170  KiBitmap( sim_settings_xpm ), _( "Simulation settings" ), wxITEM_NORMAL );
171 
172  Connect( m_toolSimulate->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
173  wxCommandEventHandler( SIM_PLOT_FRAME::onSimulate ), NULL, this );
174  Connect( m_toolAddSignals->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
175  wxCommandEventHandler( SIM_PLOT_FRAME::onAddSignal ), NULL, this );
176  Connect( m_toolProbe->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
177  wxCommandEventHandler( SIM_PLOT_FRAME::onProbe ), NULL, this );
178  Connect( m_toolTune->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
179  wxCommandEventHandler( SIM_PLOT_FRAME::onTune ), NULL, this );
180  Connect( m_toolSettings->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
181  wxCommandEventHandler( SIM_PLOT_FRAME::onSettings ), NULL, this );
182 
183  // Bind toolbar buttons event to existing menu event handlers, so they behave the same
184  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSimulate, this, m_runSimulation->GetId() );
185  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onAddSignal, this, m_addSignals->GetId() );
186  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onProbe, this, m_probeSignals->GetId() );
187  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onTune, this, m_tuneValue->GetId() );
188  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSettings, this, m_settings->GetId() );
189 
190  m_toolBar->Realize();
191  m_plotNotebook->SetPageText( 0, _( "Welcome!" ) );
192 
193  // the settings dialog will be created later, on demand.
194  // if created in the ctor, for some obscure reason, there is an issue
195  // on Windows: when open it, the simulator frame is sent to the background.
196  // instead of being behind the dialog frame (as it does)
197  m_settingsDlg = NULL;
198 
199  SetSize( ConvertDialogToPixels( wxSize( 400, 300 ) ) );
200 
201  // resize the subwindows size. At least on Windows, calling wxSafeYield before
202  // resizing the subwindows forces the wxSplitWindows size events automatically generated
203  // by wxWidgets to be executed before our resize code.
204  // Otherwise, the changes made by setSubWindowsSashSize are overwritten by one these
205  // events
206  wxSafeYield();
208 }
void onAddSignal(wxCommandEvent &event)
void SetKiway(wxWindow *aDest, KIWAY *aKiway)
Function SetKiway.
wxToolBarToolBase * m_toolProbe
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
void onSimStarted(wxCommandEvent &aEvent)
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
virtual void SetReporter(SPICE_REPORTER *aReporter)
Sets a SPICE_REPORTER object to receive the simulation log.
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
Schematic editor (Eeschema) main window.
void onSimUpdate(wxCommandEvent &aEvent)
SIM_THREAD_REPORTER * m_reporter
wxAuiNotebook * m_plotNotebook
SCH_EDIT_FRAME * m_schematicFrame
void setSubWindowsSashSize()
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
virtual void Init()=0
Intializes the simulator
SIM_PLOT_PANEL * m_lastSimPlot
Panel that was used as the most recent one for simulations
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
wxMenuItem * m_runSimulation
void onSimReport(wxCommandEvent &aEvent)
void onSimFinished(wxCommandEvent &aEvent)
wxToolBarToolBase * m_toolAddSignals
SPICE_SIMULATOR * m_simulator
void onTune(wxCommandEvent &event)
wxToolBarToolBase * m_toolSimulate
static wxString m_savedWorkbooksPath
A string to store the path of saved workbooks during a session
void onCursorUpdate(wxCommandEvent &aEvent)
DIALOG_SIM_SETTINGS * m_settingsDlg
void updateNetlistExporter()
Reloads the current schematic for the netlist exporter.
void onSimulate(wxCommandEvent &event)
void onProbe(wxCommandEvent &event)
SIM_PLOT_FRAME_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Spice Simulator"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString &name=wxT("SIM_PLOT_FRAME"))
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:100
static SPICE_SIMULATOR * CreateInstance(const std::string &aName)
Creates a simulator instance of particular type (currently only ngspice is handled) ...
void onSettings(wxCommandEvent &event)
void onClose(wxCloseEvent &aEvent)
wxToolBarToolBase * m_toolTune
wxToolBarToolBase * m_toolSettings
SIM_PLOT_FRAME::~SIM_PLOT_FRAME ( )

Definition at line 211 of file sim_plot_frame.cpp.

References m_reporter, m_settingsDlg, m_signalsIconColorList, m_simulator, and SPICE_SIMULATOR::SetReporter().

212 {
213  m_simulator->SetReporter( nullptr );
214  delete m_reporter;
215  delete m_signalsIconColorList;
216 
217  if( m_settingsDlg )
218  m_settingsDlg->Destroy();
219 }
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
virtual void SetReporter(SPICE_REPORTER *aReporter)
Sets a SPICE_REPORTER object to receive the simulation log.
SIM_THREAD_REPORTER * m_reporter
SPICE_SIMULATOR * m_simulator
DIALOG_SIM_SETTINGS * m_settingsDlg

Member Function Documentation

void SIM_PLOT_FRAME::AddCurrentPlot ( const wxString &  aDeviceName,
const wxString &  aParam 
)

Adds a current plot for a particular device.

Parameters
aDeviceNameis the device name (e.g. R1, C1).
aParamis the current type (e.g. I, Ic, Id).

Definition at line 339 of file sim_plot_frame.cpp.

References addPlot(), and SPT_CURRENT.

Referenced by DIALOG_SIGNAL_LIST::addSelectionToPlotFrame().

340 {
341  addPlot( aDeviceName, SPT_CURRENT, aParam );
342 }
void addPlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
Adds a new plot to the current panel.
void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu.

Parameters
MasterMenuThe main menu. The sub menu list will be accessible from the menu item with id ID_KICAD_SELECT_ICONS_OPTIONS

Definition at line 677 of file eda_base_frame.cpp.

References AddMenuItem(), ID_KICAD_SELECT_ICONS_IN_MENUS, ID_KICAD_SELECT_ICONS_OPTIONS, KiBitmap(), and Pgm().

Referenced by EDA_BASE_FRAME::GetMruPath(), preparePreferencesMenu(), PL_EDITOR_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), and GERBVIEW_FRAME::ReCreateMenuBar().

678 {
679  wxMenu* menu = NULL;
680  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
681 
682  if( item ) // This menu exists, do nothing
683  return;
684 
685  menu = new wxMenu;
686 
687  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
688  _( "Icons in Menus" ), wxEmptyString,
689  wxITEM_CHECK ) );
690  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
691 
692  AddMenuItem( MasterMenu, menu,
694  _( "Icons Options" ),
695  _( "Select show icons in menus and icons sizes" ),
696  KiBitmap( icon_xpm ) );
697 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void SIM_PLOT_FRAME::addPlot ( const wxString &  aName,
SIM_PLOT_TYPE  aType,
const wxString &  aParam 
)
private

Adds a new plot to the current panel.

Parameters
aNameis the device/net name.
aTypedescribes the type of plot.
aParamis the parameter for the device/net (e.g. I, Id, V).

Definition at line 402 of file sim_plot_frame.cpp.

References CurrentPlot(), TRACE_DESC::GetType(), SIM_PLOT_PANEL::GetType(), GetXAxisType(), SIM_PLOT_PANEL::IsPlottable(), m_exporter, NewPlotPanel(), SPT_AC_MAG, SPT_AC_PHASE, SPT_LIN_FREQUENCY, SPT_LOG_FREQUENCY, updatePlot(), and updateSignalList().

Referenced by AddCurrentPlot(), AddVoltagePlot(), and loadWorkbook().

403 {
404  SIM_TYPE simType = m_exporter->GetSimType();
405 
406  if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
407  return; // TODO else write out in console?
408 
409  // Create a new plot if the current one displays a different type
410  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
411 
412  if( !plotPanel || plotPanel->GetType() != simType )
413  plotPanel = NewPlotPanel( simType );
414 
415  TRACE_DESC descriptor( *m_exporter, aName, aType, aParam );
416 
417  bool updated = false;
418  SIM_PLOT_TYPE xAxisType = GetXAxisType( simType );
419 
420  if( xAxisType == SPT_LIN_FREQUENCY || xAxisType == SPT_LOG_FREQUENCY )
421  {
422  int baseType = descriptor.GetType() & ~( SPT_AC_MAG | SPT_AC_PHASE );
423 
424  // Add two plots: magnitude & phase
425  TRACE_DESC mag_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_MAG ) );
426  TRACE_DESC phase_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_PHASE ) );
427 
428  updated |= updatePlot( mag_desc, plotPanel );
429  updated |= updatePlot( phase_desc, plotPanel );
430  }
431  else
432  {
433  updated = updatePlot( descriptor, plotPanel );
434  }
435 
436  if( updated )
437  {
439  }
440 }
SIM_PLOT_TYPE GetXAxisType(SIM_TYPE aType) const
Returns X axis for a given simulation type.
static bool IsPlottable(SIM_TYPE aSimType)
Trace descriptor class
bool updatePlot(const TRACE_DESC &aDescriptor, SIM_PLOT_PANEL *aPanel)
Updates plot in a particular SIM_PLOT_PANEL.
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
SIM_TYPE GetType() const
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
void updateSignalList()
Updates the list of currently plotted signals.
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:35
SIM_PLOT_PANEL * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
void SIM_PLOT_FRAME::AddTuner ( SCH_COMPONENT aComponent)

Adds a tuner for a component.

Definition at line 345 of file sim_plot_frame.cpp.

References CurrentPlot(), SCH_COMPONENT::GetField(), NETLIST_EXPORTER_PSPICE::GetSpiceField(), EDA_TEXT::GetText(), SIM_PLOT_FRAME_BASE::m_tunePanel, m_tuners, SIM_PLOT_FRAME_BASE::m_tuneSizer, REFERENCE, SF_PRIMITIVE, SP_CAPACITOR, SP_INDUCTOR, and SP_RESISTOR.

Referenced by SCH_EDIT_FRAME::OnLeftClick().

346 {
347  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
348 
349  if( !plotPanel )
350  return;
351 
352  // For now limit the tuner tool to RLC components
353  char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aComponent, 0 )[0];
354 
355  if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR && primitiveType != SP_INDUCTOR )
356  return;
357 
358  const wxString& componentName = aComponent->GetField( REFERENCE )->GetText();
359 
360  // Do not add multiple instances for the same component
361  auto tunerIt = std::find_if( m_tuners.begin(), m_tuners.end(), [&]( const TUNER_SLIDER* t )
362  {
363  return t->GetComponentName() == componentName;
364  }
365  );
366 
367  if( tunerIt != m_tuners.end() )
368  return; // We already have it
369 
370  try
371  {
372  TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_tunePanel, aComponent );
373  m_tuneSizer->Add( tuner );
374  m_tuners.push_back( tuner );
375  m_tunePanel->Layout();
376  }
377  catch( ... )
378  {
379  // Sorry, no bonus
380  }
381 }
std::list< TUNER_SLIDER * > m_tuners
List of currently displayed tuners
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
static wxString GetSpiceField(SPICE_FIELD aField, SCH_COMPONENT *aComponent, unsigned aCtl)
Retrieves either the requested field value or the default value.
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
Custom widget to handle quick component values modification and simulation on the fly...
Definition: tuner_slider.h:40
void SIM_PLOT_FRAME::AddVoltagePlot ( const wxString &  aNetName)

Adds a voltage plot for a given net name.

Parameters
aNetNameis the net name for which a voltage plot should be created.

Definition at line 333 of file sim_plot_frame.cpp.

References addPlot(), and SPT_VOLTAGE.

Referenced by DIALOG_SIGNAL_LIST::addSelectionToPlotFrame(), and SCH_EDIT_FRAME::OnLeftClick().

334 {
335  addPlot( aNetName, SPT_VOLTAGE, "V" );
336 }
void addPlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
Adds a new plot to the current panel.
void SIM_PLOT_FRAME::applyTuners ( )
private

Applies component values specified using tunder sliders to the current netlist.

Todo:
no ngspice hardcoding

Definition at line 643 of file sim_plot_frame.cpp.

References SPICE_SIMULATOR::Command(), m_simulator, and m_tuners.

Referenced by onSimUpdate(), and StartSimulation().

644 {
645  for( auto& tuner : m_tuners )
646  {
648  std::string command( "alter @" + tuner->GetSpiceName()
649  + "=" + tuner->GetValue().ToSpiceString() );
650 
651  m_simulator->Command( command );
652  }
653 }
std::list< TUNER_SLIDER * > m_tuners
List of currently displayed tuners
virtual bool Command(const std::string &aCmd)=0
Executes a Spice command as if it was typed into console.
SPICE_SIMULATOR * m_simulator
void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
inherited

Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input.

If an auto save file exists for aFileName, the user is prompted if they wish to replace file aFileName with the auto saved file. If the user chooses to replace the file, the backup file of aFileName is removed, aFileName is renamed to the backup file name, and the auto save file is renamed to aFileName. If user chooses to keep the existing version of aFileName, the auto save file is removed.

Parameters
aFileNameA wxFileName object containing the file name to check.
aBackupFileExtensionA wxString object containing the backup file extension used to create the backup file name.

Definition at line 582 of file eda_base_frame.cpp.

References AUTOSAVE_PREFIX_FILENAME, Format(), GetChars(), Pgm(), and traceAutoSave.

Referenced by EDA_BASE_FRAME::GetMruPath(), and PCB_EDIT_FRAME::OpenProjectFiles().

584 {
585  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
586  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
587 
588  wxFileName autoSaveFileName = aFileName;
589 
590  // Check for auto save file.
591  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
592 
593  wxLogTrace( traceAutoSave,
594  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
595 
596  if( !autoSaveFileName.FileExists() )
597  return;
598 
599  wxString msg = wxString::Format( _(
600  "Well this is potentially embarrassing!\n"
601  "It appears that the last time you were editing the file\n"
602  "\"%s\"\n"
603  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
604  GetChars( aFileName.GetFullName() )
605  );
606 
607  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
608 
609  // Make a backup of the current file, delete the file, and rename the auto save file to
610  // the file name.
611  if( response == wxYES )
612  {
613  // Get the backup file name.
614  wxFileName backupFileName = aFileName;
615  backupFileName.SetExt( aBackupFileExtension );
616 
617  // If an old backup file exists, delete it. If an old copy of the file exists, rename
618  // it to the backup file name
619  if( aFileName.FileExists() )
620  {
621  // Remove the old file backup file.
622  if( backupFileName.FileExists() )
623  wxRemoveFile( backupFileName.GetFullPath() );
624 
625  // Rename the old file to the backup file name.
626  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
627  {
628  msg.Printf( _( "Could not create backup file \"%s\"" ),
629  GetChars( backupFileName.GetFullPath() ) );
630  wxMessageBox( msg );
631  }
632  }
633 
634  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
635  {
636  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
637  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
638  }
639  }
640  else
641  {
642  wxLogTrace( traceAutoSave,
643  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
644 
645  // Remove the auto save file when using the previous file as is.
646  wxRemoveFile( autoSaveFileName.GetFullPath() );
647  }
648 }
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
#define AUTOSAVE_PREFIX_FILENAME
Prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash...
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
const wxChar traceAutoSave[]
Flag to enable auto save feature debug tracing.
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited
wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, unless m_configFrameName contains a base name. this is the case of frames which can be shown in normal or modal mode. This is needed because we want only one base name prefix, regardless the mode used.

Definition at line 266 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

Referenced by EDA_BASE_FRAME::LoadSettings(), EDA_DRAW_FRAME::LoadSettings(), EDA_BASE_FRAME::SaveSettings(), and EDA_DRAW_FRAME::SaveSettings().

267  {
268  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
269  return baseCfgName;
270  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited
bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

Function doAutoSave should be overridden by the derived class to handle the auto save feature.

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 235 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), and EDA_BASE_FRAME::onAutoSaveTimer().

236 {
237  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
238 }
void EDA_BASE_FRAME::ExportHotkeyConfigToFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 757 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), and Prj().

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), and EDA_BASE_FRAME::SaveProjectSettings().

759 {
760  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
761  wxString mask = wxT( "*." ) + ext;
762 
763 #if 0
764  wxString path = wxPathOnly( Prj().GetProjectFullName() );
765 #else
766  wxString path = GetMruPath();
767 #endif
768  wxFileName fn( aDefaultShortname );
769  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
770 
771  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
772  path,
773  fn.GetFullPath(),
774  ext,
775  mask,
776  this,
777  wxFD_SAVE,
778  true );
779 
780  if( filename.IsEmpty() )
781  return;
782 
783  WriteHotkeyConfig( aDescList, &filename );
784  SetMruPath( wxFileName( filename ).GetPath() );
785 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:270
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 225 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

Referenced by DIALOG_GENERALOPTIONS::init(), and SCH_EDIT_FRAME::OnPreferencesOptions().

225 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
wxFileHistory *  aFileHistory = NULL 
)
inherited

Function GetFileFromHistory fetches the file name from the file history list.

and removes the selected file, if this file does not exists Note also the menu is updated, if wxFileHistory::UseMenu was called at init time

Parameters
cmdIdThe command ID associated with the aFileHistory object.
typePlease document me!
aFileHistoryThe wxFileHistory in use. If null, the main application file history is used
Returns
a wxString containing the selected filename

Definition at line 404 of file eda_base_frame.cpp.

References Format(), GetChars(), KIFACE_I::GetFileHistory(), and Kiface().

Referenced by GERBVIEW_FRAME::OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), PL_EDITOR_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), GERBVIEW_FRAME::OnGbrFileHistory(), GERBVIEW_FRAME::OnJobFileHistory(), GERBVIEW_FRAME::OnZipFileHistory(), and EDA_BASE_FRAME::SaveProjectSettings().

406 {
407  wxFileHistory* fileHistory = aFileHistory;
408 
409  if( !fileHistory )
410  fileHistory = &Kiface().GetFileHistory();
411 
412  int baseId = fileHistory->GetBaseId();
413 
414  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
415 
416  unsigned i = cmdId - baseId;
417 
418  if( i < fileHistory->GetCount() )
419  {
420  wxString fn = fileHistory->GetHistoryFile( i );
421 
422  if( wxFileName::FileExists( fn ) )
423  return fn;
424  else
425  {
426  wxString msg = wxString::Format(
427  _( "File \"%s\" was not found." ),
428  GetChars( fn ) );
429 
430  wxMessageBox( msg );
431 
432  fileHistory->RemoveFileFromHistory( i );
433  }
434  }
435 
436  return wxEmptyString;
437 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual int EDA_BASE_FRAME::GetIconScale ( )
inlinevirtualinherited

Function GetIconScale.

Return the desired scaling for toolbar/menubar icons in fourths (e.g. 4 is unity). A negative number indicates autoscale based on font size.

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 459 of file eda_base_frame.h.

Referenced by get_scale_factor(), and FOOTPRINT_EDIT_FRAME::GetIconScale().

459 { return -1; }
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 531 of file eda_base_frame.cpp.

References ShowAboutDialog().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

532 {
533  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
534  ShowAboutDialog( this );
535 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 518 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

519 {
520  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
521  {
522  wxString msg;
523  msg.Printf( _( "Could not launch the default browser.\n"
524  "For information on how to help the KiCad project, visit %s" ),
526  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
527  }
528 }
#define URL_GET_INVOLVED
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 440 of file eda_base_frame.cpp.

References DIM, Format(), GetAssociatedDocument(), GetChars(), EDA_BASE_FRAME::help_name(), SearchHelpFileFullPath(), and EDA_BASE_FRAME::sys_search().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

441 {
442  const SEARCH_STACK& search = sys_search();
443 
444  /* We have to get document for beginners,
445  * or the full specific doc
446  * if event id is wxID_INDEX, we want the document for beginners.
447  * else the specific doc file (its name is in Kiface().GetHelpFileName())
448  * The document for beginners is the same for all KiCad utilities
449  */
450  if( event.GetId() == wxID_INDEX )
451  {
452  // List of possible names for Getting Started in KiCad
453  const wxChar* names[2] = {
454  wxT( "getting_started_in_kicad" ),
455  wxT( "Getting_Started_in_KiCad" )
456  };
457 
458  wxString helpFile;
459  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
460  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
461  for( unsigned ii = 0; ii < DIM( names ); ii++ )
462  {
463  helpFile = SearchHelpFileFullPath( search, names[ii] );
464 
465  if( !helpFile.IsEmpty() )
466  break;
467  }
468 
469  if( !helpFile )
470  {
471  wxString msg = wxString::Format( _(
472  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
473  wxMessageBox( msg );
474  }
475  else
476  {
477  GetAssociatedDocument( this, helpFile );
478  }
479 
480  return;
481  }
482 
483  wxString base_name = help_name();
484  wxString helpFile = SearchHelpFileFullPath( search, base_name );
485 
486  if( !helpFile )
487  {
488  wxString msg = wxString::Format( _(
489  "Help file \"%s\" could not be found." ),
490  GetChars( base_name )
491  );
492  wxMessageBox( msg );
493  }
494  else
495  {
496  GetAssociatedDocument( this, helpFile );
497  }
498 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:86
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
virtual const SEARCH_STACK & sys_search()
Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_M...
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSStack, const wxString &aBaseName)
Function SearchHelpFileFullPath returns the help file&#39;s full path.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual wxString help_name()
SIM_PLOT_TYPE SIM_PLOT_FRAME::GetXAxisType ( SIM_TYPE  aType) const
private

Returns X axis for a given simulation type.

Todo:
SPT_LOG_FREQUENCY

Definition at line 762 of file sim_plot_frame.cpp.

References SPT_LIN_FREQUENCY, SPT_SWEEP, SPT_TIME, ST_AC, ST_DC, and ST_TRANSIENT.

Referenced by addPlot().

763 {
764  switch( aType )
765  {
766  case ST_AC:
767  return SPT_LIN_FREQUENCY;
769 
770  case ST_DC:
771  return SPT_SWEEP;
772 
773  case ST_TRANSIENT:
774  return SPT_TIME;
775 
776  default:
777  wxASSERT_MSG( false, "Unhandled simulation type" );
778  return (SIM_PLOT_TYPE) 0;
779  }
780 }
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:35
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 380 of file eda_base_frame.cpp.

References KIFACE_I::GetHelpFileName(), and Kiface().

Referenced by EDA_BASE_FRAME::GetKicadHelp(), and EDA_BASE_FRAME::isAutoSaveRequired().

381 {
382  return Kiface().GetHelpFileName();
383 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
const wxString & GetHelpFileName() const
Function GetHelpFileName returns just the basename portion of the current help file.
Definition: kiface_i.h:121
VTBL_ENTRY bool KIWAY_PLAYER::ImportFile ( const wxString &  aFileName,
int  aFileType 
)
inlineinherited

Function ImportFile load the given filename but sets the path to the current project path.

Parameters
fullfilepath of file to be imported.
aFileTypeenum value for filetype

Definition at line 188 of file kiway_player.h.

References VTBL_ENTRY.

189  {
190  // overload me for your wxFrame type.
191 
192  return false;
193  }
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 728 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, and EDA_FILE_SELECTOR().

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), and EDA_BASE_FRAME::SaveProjectSettings().

730 {
731  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
732  wxString mask = wxT( "*." ) + ext;
733 
734 
735  wxString path = GetMruPath();
736  wxFileName fn( aDefaultShortname );
737  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
738 
739  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
740  path,
741  fn.GetFullPath(),
742  ext,
743  mask,
744  this,
745  wxFD_OPEN,
746  true );
747 
748  if( filename.IsEmpty() )
749  return;
750 
751  ReadHotkeyConfigFile( filename, aDescList );
752  WriteHotkeyConfig( aDescList );
753  SetMruPath( wxFileName( filename ).GetPath() );
754 }
void SetMruPath(const wxString &aPath)
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current ho...
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
virtual bool EDA_BASE_FRAME::isAutoSaveRequired ( ) const
inlineprotectedvirtualinherited

Function autoSaveRequired returns the auto save status of the application.

Override this function if your derived frame supports automatic file saving.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 181 of file eda_base_frame.h.

References EDA_BASE_FRAME::config(), EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::EDA_BASE_FRAME(), EDA_BASE_FRAME::help_name(), EDA_BASE_FRAME::ProcessEvent(), EDA_BASE_FRAME::SetAutoSaveInterval(), EDA_BASE_FRAME::sys_search(), and EDA_BASE_FRAME::~EDA_BASE_FRAME().

Referenced by EDA_BASE_FRAME::ProcessEvent().

181 { return false; }
bool KIWAY_PLAYER::IsDismissed ( )
protectedinherited

Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal().

IOW, it will return true if the dialog is not modal or if it is modal and has been dismissed.

Definition at line 158 of file kiway_player.cpp.

References KIWAY_PLAYER::m_modal_loop.

Referenced by LIB_VIEW_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

159 {
160  return !m_modal_loop;
161 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:260
bool SIM_PLOT_FRAME::IsSimulationRunning ( )

Definition at line 308 of file sim_plot_frame.cpp.

References SPICE_SIMULATOR::IsRunning(), and m_simulator.

Referenced by loadWorkbook(), onClose(), onSimFinished(), onSimulate(), and onSimUpdate().

309 {
310  return m_simulator ? m_simulator->IsRunning() : false;
311 }
virtual bool IsRunning()=0
Checks if simulation is running at the moment.
SPICE_SIMULATOR * m_simulator
bool EDA_BASE_FRAME::IsWritable ( const wxFileName &  aFileName)
inherited

Function IsWritable checks if aFileName can be written.

The function performs a number of tests on aFileName to verify that it can be saved. If aFileName defines a path with no file name, them the path is tested for user write permission. If aFileName defines a file name that does not exist in the path, the path is tested for user write permission. If aFileName defines a file that already exits, the file name is tested for user write permissions.

Note
The file name path must be set or an assertion will be raised on debug builds and return false on release builds.
Parameters
aFileNameThe full path and/or file name of the file to test.
Returns
False if aFileName cannot be written.

Definition at line 538 of file eda_base_frame.cpp.

References GetChars().

Referenced by SCH_EDIT_FRAME::doAutoSave(), EDA_BASE_FRAME::GetMruPath(), SCH_EDIT_FRAME::SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), CVPCB_MAINFRAME::SaveProjectFile(), and SCH_EDIT_FRAME::SaveProjectSettings().

539 {
540  wxString msg;
541  wxFileName fn = aFileName;
542 
543  // Check for absence of a file path with a file name. Unfortunately KiCad
544  // uses paths relative to the current project path without the ./ part which
545  // confuses wxFileName. Making the file name path absolute may be less than
546  // elegant but it solves the problem.
547  if( fn.GetPath().IsEmpty() && fn.HasName() )
548  fn.MakeAbsolute();
549 
550  wxCHECK_MSG( fn.IsOk(), false,
551  wxT( "File name object is invalid. Bad programmer!" ) );
552  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
553  wxT( "File name object path <" ) + fn.GetFullPath() +
554  wxT( "> is not set. Bad programmer!" ) );
555 
556  if( fn.IsDir() && !fn.IsDirWritable() )
557  {
558  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
559  GetChars( fn.GetPath() ) );
560  }
561  else if( !fn.FileExists() && !fn.IsDirWritable() )
562  {
563  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
564  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
565  }
566  else if( fn.FileExists() && !fn.IsFileWritable() )
567  {
568  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
569  GetChars( fn.GetFullPath() ) );
570  }
571 
572  if( !msg.IsEmpty() )
573  {
574  wxMessageBox( msg );
575  return false;
576  }
577 
578  return true;
579 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), and KIWAY_HOLDER::SetKiway().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), FOOTPRINT_EDIT_FRAME::GetIconScale(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 179 of file kiway_player.cpp.

References KIWAY_PLAYER::KiwayMailIn().

180 {
181  // logging support
182  KiwayMailIn( aEvent ); // call the virtual, override in derived.
183 }
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
void KIWAY_PLAYER::KiwayMailIn ( KIWAY_EXPRESS aEvent)
virtualinherited

Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

Merely override it in derived classes.

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 73 of file kiway_player.cpp.

Referenced by KIWAY_PLAYER::kiway_express(), and KIWAY::ProcessEvent().

74 {
75  // override this in derived classes.
76 }
void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

Function language_change is an event handler called on a language menu selection.

Definition at line 186 of file kiway_player.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::SetLanguage().

187 {
188  int id = event.GetId();
189 
190  // tell all the KIWAY_PLAYERs about the language change.
191  Kiway().SetLanguage( id );
192 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs...
Definition: kiway.cpp:395
void SIM_PLOT_FRAME::LoadSettings ( wxConfigBase *  aCfg)
overrideprivatevirtual

Function LoadSettings loads common frame parameters from a configuration file.

Don't forget to call the base method or your frames won't remember their positions and sizes.

Reimplemented from EDA_BASE_FRAME.

Definition at line 239 of file sim_plot_frame.cpp.

References CURSORS_PANEL_HEIGHT_ENTRY, EDA_BASE_FRAME::LoadSettings(), EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, m_splitterLeftRightSashPosition, m_splitterPlotAndConsoleSashPosition, m_splitterSignalsSashPosition, m_splitterTuneValuesSashPosition, PLOT_PANEL_HEIGHT_ENTRY, PLOT_PANEL_WIDTH_ENTRY, SIGNALS_PANEL_HEIGHT_ENTRY, wxPoint::x, and wxPoint::y.

Referenced by SIM_PLOT_FRAME().

240 {
241  // Read main frame size and position:
243  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
244 
245  // Read subwindows sizes (should be > 0 )
250 }
#define SIGNALS_PANEL_HEIGHT_ENTRY
int m_splitterPlotAndConsoleSashPosition
#define PLOT_PANEL_WIDTH_ENTRY
#define CURSORS_PANEL_HEIGHT_ENTRY
virtual void LoadSettings(wxConfigBase *aCfg)
Function LoadSettings loads common frame parameters from a configuration file.
int m_splitterTuneValuesSashPosition
#define PLOT_PANEL_HEIGHT_ENTRY
int m_splitterSignalsSashPosition
int m_splitterLeftRightSashPosition
bool SIM_PLOT_FRAME::loadWorkbook ( const wxString &  aPath)
private

Loads plot settings from a file.

Parameters
aPathis the file name.
Returns
True if successful.

Definition at line 656 of file sim_plot_frame.cpp.

References addPlot(), IsSimulationRunning(), SIM_PLOT_FRAME_BASE::m_plotNotebook, m_plots, name, NewPlotPanel(), and StartSimulation().

Referenced by menuOpenWorkbook().

657 {
658  m_plots.clear();
659  m_plotNotebook->DeleteAllPages();
660 
661  wxTextFile file( aPath );
662 
663  if( !file.Open() )
664  return false;
665 
666  long plotsCount;
667 
668  if( !file.GetFirstLine().ToLong( &plotsCount ) ) // GetFirstLine instead of GetNextLine
669  return false;
670 
671  for( long i = 0; i < plotsCount; ++i )
672  {
673  long plotType, tracesCount;
674 
675  if( !file.GetNextLine().ToLong( &plotType ) )
676  return false;
677 
678  SIM_PLOT_PANEL* plotPanel = NewPlotPanel( (SIM_TYPE) plotType );
679  m_plots[plotPanel].m_simCommand = file.GetNextLine();
680  StartSimulation();
681 
682  // Perform simulation, so plots can be added with values
683  do
684  {
685  wxThread::This()->Sleep( 50 );
686  }
687  while( IsSimulationRunning() );
688 
689  if( !file.GetNextLine().ToLong( &tracesCount ) )
690  return false;
691 
692  for( long j = 0; j < tracesCount; ++j )
693  {
694  long traceType;
695  wxString name, param;
696 
697  if( !file.GetNextLine().ToLong( &traceType ) )
698  return false;
699 
700  name = file.GetNextLine();
701  param = file.GetNextLine();
702 
703  if( name.IsEmpty() || param.IsEmpty() )
704  return false;
705 
706  addPlot( name, (SIM_PLOT_TYPE) traceType, param );
707  }
708  }
709 
710  return true;
711 }
wxAuiNotebook * m_plotNotebook
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
bool IsSimulationRunning()
const char * name
Definition: DXF_plotter.cpp:61
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:35
void addPlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
Adds a new plot to the current panel.
SIM_PLOT_PANEL * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
void SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 109 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

110  {
111  m_splitterLeftRight->SetSashPosition( 700 );
112  m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this );
113  }
void m_splitterLeftRightOnIdle(wxIdleEvent &)
wxSplitterWindow * m_splitterLeftRight
void SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 115 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

116  {
117  m_splitterPlotAndConsole->SetSashPosition( 500 );
118  m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
119  }
void m_splitterPlotAndConsoleOnIdle(wxIdleEvent &)
wxSplitterWindow * m_splitterPlotAndConsole
void SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 121 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

122  {
123  m_splitterSignals->SetSashPosition( 0 );
124  m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this );
125  }
wxSplitterWindow * m_splitterSignals
void m_splitterSignalsOnIdle(wxIdleEvent &)
void SIM_PLOT_FRAME_BASE::m_splitterTuneValuesOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 127 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

128  {
129  m_splitterTuneValues->SetSashPosition( 0 );
130  m_splitterTuneValues->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterTuneValuesOnIdle ), NULL, this );
131  }
wxSplitterWindow * m_splitterTuneValues
void m_splitterTuneValuesOnIdle(wxIdleEvent &)
void SIM_PLOT_FRAME::menuExit ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 237 of file sim_plot_frame.h.

238  {
239  Close();
240  }
void SIM_PLOT_FRAME::menuNewPlot ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 783 of file sim_plot_frame.cpp.

References CurrentPlot(), SIM_PLOT_PANEL::IsPlottable(), m_exporter, m_plots, and NewPlotPanel().

784 {
785  SIM_TYPE type = m_exporter->GetSimType();
786 
787  if( SIM_PLOT_PANEL::IsPlottable( type ) )
788  {
789  SIM_PLOT_PANEL* prevPlot = CurrentPlot();
790  SIM_PLOT_PANEL* newPlot = NewPlotPanel( type );
791 
792  // If the previous plot had the same type, copy the simulation command
793  if( prevPlot )
794  m_plots[newPlot].m_simCommand = m_plots[prevPlot].m_simCommand;
795  }
796 }
static bool IsPlottable(SIM_TYPE aSimType)
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
SIM_PLOT_PANEL * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
void SIM_PLOT_FRAME::menuOpenWorkbook ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 799 of file sim_plot_frame.cpp.

References DisplayError(), loadWorkbook(), m_savedWorkbooksPath, and WorkbookFileWildcard().

800 {
801  wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "",
802  WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
803 
804  if( openDlg.ShowModal() == wxID_CANCEL )
805  return;
806 
807  m_savedWorkbooksPath = openDlg.GetDirectory();
808 
809  if( !loadWorkbook( openDlg.GetPath() ) )
810  DisplayError( this, _( "There was an error while opening the workbook file" ) );
811 }
bool loadWorkbook(const wxString &aPath)
Loads plot settings from a file.
static wxString m_savedWorkbooksPath
A string to store the path of saved workbooks during a session
wxString WorkbookFileWildcard()
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:241
void SIM_PLOT_FRAME::menuSaveCsv ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 847 of file sim_plot_frame.cpp.

References CsvFileWildcard(), CurrentPlot(), Format(), TRACE::GetDataX(), TRACE::GetDataY(), SIM_PLOT_PANEL::GetTraces(), and trace.

848 {
849  if( !CurrentPlot() )
850  return;
851 
852  const wxChar SEPARATOR = ';';
853 
854  wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "",
855  CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
856 
857  if( saveDlg.ShowModal() == wxID_CANCEL )
858  return;
859 
860  wxFile out( saveDlg.GetPath(), wxFile::write );
861  bool timeWritten = false;
862 
863  for( const auto& t : CurrentPlot()->GetTraces() )
864  {
865  const TRACE* trace = t.second;
866 
867  if( !timeWritten )
868  {
869  out.Write( wxString::Format( "Time%c", SEPARATOR ) );
870 
871  for( double v : trace->GetDataX() )
872  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
873 
874  out.Write( "\r\n" );
875  timeWritten = true;
876  }
877 
878  out.Write( wxString::Format( "%s%c", t.first, SEPARATOR ) );
879 
880  for( double v : trace->GetDataY() )
881  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
882 
883  out.Write( "\r\n" );
884  }
885 
886  out.Close();
887 }
long trace
Definition: solve.cpp:232
const std::vector< double > & GetDataY() const
wxString CsvFileWildcard()
const std::map< wxString, TRACE * > & GetTraces() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
const std::vector< double > & GetDataX() const
void SIM_PLOT_FRAME::menuSaveImage ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 832 of file sim_plot_frame.cpp.

References CurrentPlot(), PngFileWildcard(), and mpWindow::SaveScreenshot().

833 {
834  if( !CurrentPlot() )
835  return;
836 
837  wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "",
838  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
839 
840  if( saveDlg.ShowModal() == wxID_CANCEL )
841  return;
842 
843  CurrentPlot()->SaveScreenshot( saveDlg.GetPath(), wxBITMAP_TYPE_PNG );
844 }
wxString PngFileWildcard()
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
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.
Definition: mathplot.cpp:3044
void SIM_PLOT_FRAME::menuSaveWorkbook ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 814 of file sim_plot_frame.cpp.

References CurrentPlot(), DisplayError(), m_savedWorkbooksPath, saveWorkbook(), and WorkbookFileWildcard().

815 {
816  if( !CurrentPlot() )
817  return;
818 
819  wxFileDialog saveDlg( this, _( "Save Simulation Workbook" ), m_savedWorkbooksPath, "",
820  WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
821 
822  if( saveDlg.ShowModal() == wxID_CANCEL )
823  return;
824 
825  m_savedWorkbooksPath = saveDlg.GetDirectory();
826 
827  if( !saveWorkbook( saveDlg.GetPath() ) )
828  DisplayError( this, _( "There was an error while saving the workbook file" ) );
829 }
bool saveWorkbook(const wxString &aPath)
Saves plot settings to a file.
static wxString m_savedWorkbooksPath
A string to store the path of saved workbooks during a session
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
wxString WorkbookFileWildcard()
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:241
void SIM_PLOT_FRAME::menuShowGrid ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 911 of file sim_plot_frame.cpp.

References CurrentPlot(), SIM_PLOT_PANEL::IsGridShown(), and SIM_PLOT_PANEL::ShowGrid().

912 {
913  SIM_PLOT_PANEL* plot = CurrentPlot();
914 
915  if( plot )
916  plot->ShowGrid( !plot->IsGridShown() );
917 }
bool IsGridShown() const
void ShowGrid(bool aEnable)
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::menuShowGridUpdate ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 920 of file sim_plot_frame.cpp.

References CurrentPlot(), and SIM_PLOT_PANEL::IsGridShown().

921 {
922  SIM_PLOT_PANEL* plot = CurrentPlot();
923 
924  event.Check( plot ? plot->IsGridShown() : false );
925 }
bool IsGridShown() const
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::menuShowLegend ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 928 of file sim_plot_frame.cpp.

References CurrentPlot(), SIM_PLOT_PANEL::IsLegendShown(), and SIM_PLOT_PANEL::ShowLegend().

929 {
930  SIM_PLOT_PANEL* plot = CurrentPlot();
931 
932  if( plot )
933  plot->ShowLegend( !plot->IsLegendShown() );
934 }
void ShowLegend(bool aEnable)
bool IsLegendShown() const
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::menuShowLegendUpdate ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 937 of file sim_plot_frame.cpp.

References CurrentPlot(), and SIM_PLOT_PANEL::IsLegendShown().

938 {
939  SIM_PLOT_PANEL* plot = CurrentPlot();
940  event.Check( plot ? plot->IsLegendShown() : false );
941 }
bool IsLegendShown() const
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::menuZoomFit ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 904 of file sim_plot_frame.cpp.

References CurrentPlot(), and mpWindow::Fit().

905 {
906  if( CurrentPlot() )
907  CurrentPlot()->Fit();
908 }
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::menuZoomIn ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 890 of file sim_plot_frame.cpp.

References CurrentPlot(), and mpWindow::ZoomIn().

891 {
892  if( CurrentPlot() )
893  CurrentPlot()->ZoomIn();
894 }
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2249
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::menuZoomOut ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 897 of file sim_plot_frame.cpp.

References CurrentPlot(), and mpWindow::ZoomOut().

898 {
899  if( CurrentPlot() )
900  CurrentPlot()->ZoomOut();
901 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2306
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
SIM_PLOT_PANEL * SIM_PLOT_FRAME::NewPlotPanel ( SIM_TYPE  aSimType)

Creates a new plot panel for a given simulation type and adds it to the main notebook.

Parameters
aSimTypeis requested simulation type.
Returns
The new plot panel.

Definition at line 314 of file sim_plot_frame.cpp.

References Format(), SIM_PLOT_FRAME_BASE::m_plotNotebook, m_plots, and SIM_PLOT_FRAME_BASE::m_welcomePanel.

Referenced by addPlot(), loadWorkbook(), menuNewPlot(), onSettings(), and onSimFinished().

315 {
316  SIM_PLOT_PANEL* plotPanel = new SIM_PLOT_PANEL( aSimType, m_plotNotebook, wxID_ANY );
317 
318  if( m_welcomePanel )
319  {
320  m_plotNotebook->DeletePage( 0 );
321  m_welcomePanel = nullptr;
322  }
323 
324  m_plotNotebook->AddPage( plotPanel, wxString::Format( wxT( "Plot%u" ),
325  (unsigned int) m_plotNotebook->GetPageCount() + 1 ), true );
326 
327  m_plots[plotPanel] = PLOT_INFO();
328 
329  return plotPanel;
330 }
wxAuiNotebook * m_plotNotebook
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void SIM_PLOT_FRAME::onAddSignal ( wxCommandEvent &  event)
private

Definition at line 1043 of file sim_plot_frame.cpp.

References CurrentPlot(), DisplayInfoMessage(), SIM_PLOT_PANEL::GetType(), and m_exporter.

Referenced by SIM_PLOT_FRAME().

1044 {
1045  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1046 
1047  if( !plotPanel || !m_exporter || plotPanel->GetType() != m_exporter->GetSimType() )
1048  {
1049  DisplayInfoMessage( this, _( "You need to run simulation first." ) );
1050  return;
1051  }
1052 
1053  DIALOG_SIGNAL_LIST dialog( this, m_exporter.get() );
1054  dialog.ShowModal();
1055 }
SIM_TYPE GetType() const
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:272
void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 228 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::m_autoSaveInterval, and EDA_BASE_FRAME::m_autoSaveTimer.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

229 {
230  if( !doAutoSave() )
231  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
232 }
virtual bool doAutoSave()
Function doAutoSave should be overridden by the derived class to handle the auto save feature...
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
int m_autoSaveInterval
The auto save interval time in seconds.
void KIWAY_PLAYER::OnChangeIconsOptions ( wxCommandEvent &  event)
overrideprotectedvirtualinherited

Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection.

Reimplemented from EDA_BASE_FRAME.

Definition at line 195 of file kiway_player.cpp.

References KIWAY_HOLDER::Kiway(), EDA_BASE_FRAME::OnChangeIconsOptions(), and KIWAY::ShowChangedIcons().

196 {
199 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
virtual void OnChangeIconsOptions(wxCommandEvent &event)
Function OnChangeIconsOptions Selects the current icons options in menus (or toolbars) in Kicad (the ...
VTBL_ENTRY void ShowChangedIcons()
Function ShowChangedIcons Calls ShowChangedIcons() on all KIWAY_PLAYERs.
Definition: kiway.cpp:431
void SIM_PLOT_FRAME::onClose ( wxCloseEvent &  aEvent)
private

Definition at line 1078 of file sim_plot_frame.cpp.

References EDA_BASE_FRAME::config(), KIWAY_PLAYER::Destroy(), IsSimulationRunning(), m_simulator, SaveSettings(), and SPICE_SIMULATOR::Stop().

Referenced by SIM_PLOT_FRAME().

1079 {
1080  SaveSettings( config() );
1081 
1082  if( IsSimulationRunning() )
1083  m_simulator->Stop();
1084 
1085  Destroy();
1086 }
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
bool IsSimulationRunning()
SPICE_SIMULATOR * m_simulator
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual bool Stop()=0
Halts the simulation.
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
void SIM_PLOT_FRAME::onCursorUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 1089 of file sim_plot_frame.cpp.

References CurrentPlot(), SIM_PLOT_PANEL::GetLabelX(), SIM_PLOT_PANEL::GetLabelY1(), SIM_PLOT_PANEL::GetLabelY2(), SIM_PLOT_PANEL::GetTraces(), SIM_PLOT_FRAME_BASE::m_cursors, SIM_PLOT_FRAME_BASE::m_signals, m_signalsIconColorList, SPICE_VALUE::ToSpiceString(), and trace.

Referenced by SIM_PLOT_FRAME().

1090 {
1091  wxSize size = m_cursors->GetClientSize();
1092  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1093  m_cursors->ClearAll();
1094 
1095  if( !plotPanel )
1096  return;
1097 
1099  m_cursors->SetImageList(m_signalsIconColorList, wxIMAGE_LIST_SMALL);
1100 
1101  // Fill the signals listctrl
1102  m_cursors->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x / 2 );
1103  const long X_COL = m_cursors->AppendColumn( plotPanel->GetLabelX(), wxLIST_FORMAT_LEFT, size.x / 4 );
1104 
1105  wxString labelY1 = plotPanel->GetLabelY1();
1106  wxString labelY2 = plotPanel->GetLabelY2();
1107  wxString labelY;
1108 
1109  if( !labelY2.IsEmpty() )
1110  labelY = labelY1 + " / " + labelY2;
1111  else
1112  labelY = labelY1;
1113 
1114  const long Y_COL = m_cursors->AppendColumn( labelY, wxLIST_FORMAT_LEFT, size.x / 4 );
1115 
1116  // Update cursor values
1117  int itemidx = 0;
1118  for( const auto& trace : plotPanel->GetTraces() )
1119  {
1120  if( CURSOR* cursor = trace.second->GetCursor() )
1121  {
1122  // Find the right icon color in list.
1123  // It is the icon used in m_signals list for the same trace
1124  long iconColor = m_signals->FindItem( -1, trace.first );
1125 
1126  const wxRealPoint coords = cursor->GetCoords();
1127  long idx = m_cursors->InsertItem( itemidx++, trace.first, iconColor );
1128  m_cursors->SetItem( idx, X_COL, SPICE_VALUE( coords.x ).ToSpiceString() );
1129  m_cursors->SetItem( idx, Y_COL, SPICE_VALUE( coords.y ).ToSpiceString() );
1130  }
1131  }
1132 }
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
long trace
Definition: solve.cpp:232
wxString ToSpiceString() const
Returns string value in Spice format (e.g.
wxString GetLabelX() const
wxString GetLabelY2() const
const std::map< wxString, TRACE * > & GetTraces() const
wxString GetLabelY1() const
Helper class to handle Spice way of expressing values (e.g. 10.5 Meg)
Definition: spice_value.h:32
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
Cursor attached to a trace to follow its values:
void SIM_PLOT_FRAME::onPlotChanged ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 962 of file sim_plot_frame.cpp.

References updateCursors(), and updateSignalList().

963 {
965  updateCursors();
966 }
void updateCursors()
Updates the cursor values list.
void updateSignalList()
Updates the list of currently plotted signals.
void SIM_PLOT_FRAME::onPlotClose ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 944 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_plotNotebook, m_plots, updateCursors(), and updateSignalList().

945 {
946  int idx = event.GetSelection();
947 
948  if( idx == wxNOT_FOUND )
949  return;
950 
951  SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( m_plotNotebook->GetPage( idx ) );
952 
953  if( !plotPanel )
954  return;
955 
956  m_plots.erase( plotPanel );
958  updateCursors();
959 }
void updateCursors()
Updates the cursor values list.
wxAuiNotebook * m_plotNotebook
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
void updateSignalList()
Updates the list of currently plotted signals.
void SIM_PLOT_FRAME::onProbe ( wxCommandEvent &  event)
private

Definition at line 1058 of file sim_plot_frame.cpp.

References ID_SIM_PROBE, and m_schematicFrame.

Referenced by SIM_PLOT_FRAME().

1059 {
1060  if( m_schematicFrame == NULL )
1061  return;
1062 
1063  wxQueueEvent( m_schematicFrame, new wxCommandEvent( wxEVT_TOOL, ID_SIM_PROBE ) );
1064  m_schematicFrame->Raise();
1065 }
SCH_EDIT_FRAME * m_schematicFrame
void EDA_BASE_FRAME::OnSelectPreferredEditor ( wxCommandEvent &  event)
virtualinherited

Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ...

) The full filename editor is saved in configuration (global params)

Definition at line 501 of file eda_base_frame.cpp.

References PGM_BASE::AskUserForPreferredEditor(), PGM_BASE::GetEditorName(), Pgm(), and PGM_BASE::SetEditorName().

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

502 {
503  // Ask for the current editor and instruct GetEditorName() to not show
504  // unless we pass false as argument.
505  wxString editorname = Pgm().GetEditorName( false );
506 
507  // Ask the user to select a new editor, but suggest the current one as the default.
508  editorname = Pgm().AskUserForPreferredEditor( editorname );
509 
510  // If we have a new editor name request it to be copied to m_editor_name and saved
511  // to the preferences file. If the user cancelled the dialog then the previous
512  // value will be retained.
513  if( !editorname.IsEmpty() )
514  Pgm().SetEditorName( editorname );
515 }
VTBL_ENTRY void SetEditorName(const wxString &aFileName)
Definition: pgm_base.cpp:330
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
VTBL_ENTRY const wxString AskUserForPreferredEditor(const wxString &aDefaultEditor=wxEmptyString)
Shows a dialog that instructs the user to select a new preferred editor.
Definition: pgm_base.cpp:375
VTBL_ENTRY const wxString & GetEditorName(bool aCanShowFileChooser=true)
Return the preferred editor name.
Definition: pgm_base.cpp:338
void SIM_PLOT_FRAME::onSettings ( wxCommandEvent &  event)
private

Definition at line 1006 of file sim_plot_frame.cpp.

References NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType(), CurrentPlot(), DisplayError(), DIALOG_SIM_SETTINGS::GetSimCommand(), SIM_PLOT_PANEL::GetType(), m_exporter, m_plots, m_settingsDlg, NET_ALL_FLAGS, NewPlotPanel(), DIALOG_SIM_SETTINGS::SetNetlistExporter(), DIALOG_SIM_SETTINGS::SetSimCommand(), DIALOG_SIM_SETTINGS::ShowModal(), and updateNetlistExporter().

Referenced by SIM_PLOT_FRAME().

1007 {
1008  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1009 
1010  // Initial processing is required to e.g. display a list of power sources
1012 
1013  if( !m_exporter->ProcessNetlist( NET_ALL_FLAGS ) )
1014  {
1015  DisplayError( this, _( "There were errors during netlist export, aborted." ) );
1016  return;
1017  }
1018 
1019  if( !m_settingsDlg )
1020  m_settingsDlg = new DIALOG_SIM_SETTINGS( this );
1021 
1022  if( plotPanel )
1023  m_settingsDlg->SetSimCommand( m_plots[plotPanel].m_simCommand );
1024 
1026 
1027  if( m_settingsDlg->ShowModal() == wxID_OK )
1028  {
1029  wxString newCommand = m_settingsDlg->GetSimCommand();
1030  SIM_TYPE newSimType = NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( newCommand );
1031 
1032  // If it is a new simulation type, open a new plot
1033  if( !plotPanel || ( plotPanel && plotPanel->GetType() != newSimType ) )
1034  {
1035  plotPanel = NewPlotPanel( newSimType );
1036  }
1037 
1038  m_plots[plotPanel].m_simCommand = newCommand;
1039  }
1040 }
bool SetSimCommand(const wxString &aCommand)
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Returns simulation type basing on a simulation command directive.
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
SIM_TYPE GetType() const
void SetNetlistExporter(NETLIST_EXPORTER_PSPICE_SIM *aExporter)
DIALOG_SIM_SETTINGS * m_settingsDlg
const wxString & GetSimCommand() const
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
void updateNetlistExporter()
Reloads the current schematic for the netlist exporter.
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:241
SIM_PLOT_PANEL * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
void SIM_PLOT_FRAME::onSignalDblClick ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 969 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_signals, and removePlot().

970 {
971  // Remove signal from the plot panel when double clicked
972  long idx = m_signals->GetFocusedItem();
973 
974  if( idx != wxNOT_FOUND )
975  removePlot( m_signals->GetItemText( idx, 0 ) );
976 }
void removePlot(const wxString &aPlotName, bool aErase=true)
Removes a plot with a specific title.
void SIM_PLOT_FRAME::onSignalRClick ( wxListEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 979 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_signals.

980 {
981  int idx = event.GetIndex();
982 
983  if( idx != wxNOT_FOUND )
984  m_signals->Select( idx );
985 
986  idx = m_signals->GetFirstSelected();
987 
988  if( idx != wxNOT_FOUND )
989  {
990  const wxString& netName = m_signals->GetItemText( idx, 0 );
991  SIGNAL_CONTEXT_MENU ctxMenu( netName, this );
992  m_signals->PopupMenu( &ctxMenu );
993  }
994 }
void SIM_PLOT_FRAME::onSimFinished ( wxCommandEvent &  aEvent)
private
Todo:
do not make it hardcoded for ngspice

Definition at line 1142 of file sim_plot_frame.cpp.

References SPICE_SIMULATOR::Command(), CurrentPlot(), Format(), SIM_PLOT_PANEL::GetType(), ID_SIM_RUN, SIM_PLOT_PANEL::IsPlottable(), IsSimulationRunning(), KiBitmap(), m_exporter, m_plots, m_simulator, SIM_PLOT_FRAME_BASE::m_toolBar, NewPlotPanel(), removePlot(), SIM_PLOT_PANEL::ResetScales(), ST_UNKNOWN, mpWindow::UpdateAll(), updatePlot(), and updateSignalList().

Referenced by SIM_PLOT_FRAME().

1143 {
1144  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_run_xpm ) );
1145  SetCursor( wxCURSOR_ARROW );
1146 
1147  SIM_TYPE simType = m_exporter->GetSimType();
1148 
1149  if( simType == ST_UNKNOWN )
1150  return;
1151 
1152  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1153 
1154  if( !plotPanel || plotPanel->GetType() != simType )
1155  plotPanel = NewPlotPanel( simType );
1156 
1157  if( IsSimulationRunning() )
1158  return;
1159 
1160  // If there are any signals plotted, update them
1161  if( SIM_PLOT_PANEL::IsPlottable( simType ) )
1162  {
1163  TRACE_MAP& traceMap = m_plots[plotPanel].m_traces;
1164 
1165  for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */)
1166  {
1167  if( !updatePlot( it->second, plotPanel ) )
1168  {
1169  removePlot( it->first, false );
1170  it = traceMap.erase( it ); // remove a plot that does not exist anymore
1171  }
1172  else
1173  {
1174  ++it;
1175  }
1176  }
1177 
1178  updateSignalList();
1179  plotPanel->UpdateAll();
1180  plotPanel->ResetScales();
1181  }
1182  else
1183  {
1185  for( const auto& net : m_exporter->GetNetIndexMap() )
1186  {
1187  int node = net.second;
1188 
1189  if( node > 0 )
1190  m_simulator->Command( wxString::Format( "print v(%d)", node ).ToStdString() );
1191  }
1192  }
1193 }
static bool IsPlottable(SIM_TYPE aSimType)
bool updatePlot(const TRACE_DESC &aDescriptor, SIM_PLOT_PANEL *aPanel)
Updates plot in a particular SIM_PLOT_PANEL.
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
virtual bool Command(const std::string &aCmd)=0
Executes a Spice command as if it was typed into console.
void ResetScales()
Resets scale ranges to fit the current traces
bool IsSimulationRunning()
SPICE_SIMULATOR * m_simulator
SIM_TYPE GetType() const
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void updateSignalList()
Updates the list of currently plotted signals.
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
std::map< wxString, TRACE_DESC > TRACE_MAP
void removePlot(const wxString &aPlotName, bool aErase=true)
Removes a plot with a specific title.
SIM_PLOT_PANEL * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
void SIM_PLOT_FRAME::onSimReport ( wxCommandEvent &  aEvent)
private

Definition at line 1218 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_simConsole.

Referenced by SIM_PLOT_FRAME().

1219 {
1220  m_simConsole->AppendText( aEvent.GetString() + "\n" );
1221  m_simConsole->SetInsertionPointEnd();
1222 }
void SIM_PLOT_FRAME::onSimStarted ( wxCommandEvent &  aEvent)
private

Definition at line 1135 of file sim_plot_frame.cpp.

References ID_SIM_RUN, KiBitmap(), and SIM_PLOT_FRAME_BASE::m_toolBar.

Referenced by SIM_PLOT_FRAME().

1136 {
1137  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_stop_xpm ) );
1138  SetCursor( wxCURSOR_ARROWWAIT );
1139 }
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void SIM_PLOT_FRAME::onSimulate ( wxCommandEvent &  event)
private

Definition at line 997 of file sim_plot_frame.cpp.

References IsSimulationRunning(), StartSimulation(), and StopSimulation().

Referenced by SIM_PLOT_FRAME().

998 {
999  if( IsSimulationRunning() )
1000  StopSimulation();
1001  else
1002  StartSimulation();
1003 }
bool IsSimulationRunning()
void SIM_PLOT_FRAME::onSimUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 1196 of file sim_plot_frame.cpp.

References applyTuners(), CurrentPlot(), IsSimulationRunning(), m_lastSimPlot, SIM_PLOT_FRAME_BASE::m_simConsole, m_simulator, SPICE_SIMULATOR::Run(), StartSimulation(), and StopSimulation().

Referenced by SIM_PLOT_FRAME().

1197 {
1198  if( IsSimulationRunning() )
1199  StopSimulation();
1200 
1201  if( CurrentPlot() != m_lastSimPlot )
1202  {
1203  // We need to rerun simulation, as the simulator currently stores
1204  // results for another plot
1205  StartSimulation();
1206  }
1207  else
1208  {
1209  // Incremental update
1210  m_simConsole->Clear();
1211  // Do not export netlist, it is already stored in the simulator
1212  applyTuners();
1213  m_simulator->Run();
1214  }
1215 }
void applyTuners()
Applies component values specified using tunder sliders to the current netlist.
SIM_PLOT_PANEL * m_lastSimPlot
Panel that was used as the most recent one for simulations
bool IsSimulationRunning()
SPICE_SIMULATOR * m_simulator
virtual bool Run()=0
Executes the simulation with currently loaded netlist.
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::onTune ( wxCommandEvent &  event)
private

Definition at line 1068 of file sim_plot_frame.cpp.

References ID_SIM_TUNE, and m_schematicFrame.

Referenced by SIM_PLOT_FRAME().

1069 {
1070  if( m_schematicFrame == NULL )
1071  return;
1072 
1073  wxQueueEvent( m_schematicFrame, new wxCommandEvent( wxEVT_TOOL, ID_SIM_TUNE ) );
1074  m_schematicFrame->Raise();
1075 }
SCH_EDIT_FRAME * m_schematicFrame
VTBL_ENTRY bool KIWAY_PLAYER::OpenProjectFiles ( const std::vector< wxString > &  aFileList,
int  aCtl = 0 
)
inlineinherited

Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList.

This is generalized in the direction of worst case. In a typical case aFileList will only hold a single file, like "myboard.kicad_pcb", because any KIWAY_PLAYER is only in one KIWAY and the KIWAY owns the PROJECT. Therefore opening files from multiple projects into the same KIWAY_PLAYER is precluded.

Each derived class should handle this in a way specific to its needs. No filename prompting is done inside here for any file or project. There should be no need to call this with aFileList which is empty. However, calling it with a single filename which does not exist should indicate to the implementor that a new session is being started and that the given name is the desired name for the data file at time of save.

This function does not support "appending". Use a different function for that. Any prior project data tree should be cleared before loading the new stuff.

Therefore, one of the first things an implementation should do is test for existence of the first file in the list, and if it does not exist, treat it as a new session, possibly with a UI notification to that effect.

After loading the window should update its Title as part of this operation. If the KIWAY_PLAYER needs to, it can load the *.pro file as part of this operation.

If the KIWAY_PLAYER cannot load any of the file(s) in the list, then it should say why through some GUI interface, and return false.

Parameters
aFileListincludes files that this frame should open according to the knowledge in the derived wxFrame. In almost every case, the list will have only a single file in it.
aCtlis a set of bit flags ORed together from the set of KICTL_* #defined above.
Returns
bool - true if all requested files were opened OK, else false.

Definition at line 170 of file kiway_player.h.

Referenced by SCH_EDIT_FRAME::doUpdatePcb(), PGM_SINGLE_TOP::MacOpenFile(), SCH_EDIT_FRAME::OnOpenPcbnew(), PGM_SINGLE_TOP::OnPgmInit(), PCB_EDIT_FRAME::OnUpdatePCBFromSch(), KICAD_MANAGER_FRAME::RunEeschema(), and KICAD_MANAGER_FRAME::RunPcbNew().

171  {
172  // overload me for your wxFrame type.
173 
174  // Any overload should probably do this also:
175  // Prj().MaybeLoadProjectSettings();
176 
177  // Then update the window title.
178 
179  return false;
180  }
bool EDA_BASE_FRAME::PostCommandMenuEvent ( int  evt_type)
inherited

Function PostCommandMenuEvent.

Post a menu event to the frame, which can be used to trigger actions bound to menu items.

Definition at line 651 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::GetMruPath(), FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), and FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem().

652 {
653  if( evt_type != 0 )
654  {
655  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
656  evt.SetEventObject( this );
657  evt.SetId( evt_type );
658  wxPostEvent( this, evt );
659  return true;
660  }
661 
662  return false;
663 }
void EDA_BASE_FRAME::PrintMsg ( const wxString &  text)
inherited

Definition at line 386 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::IsType().

387 {
388  SetStatusText( text );
389 }
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), DIALOG_FOOTPRINT_FP_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), LIB_EDIT_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_FOOTPRINT_FP_EDITOR::Edit3DShapeFileName(), DIALOG_FOOTPRINT_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), FOOTPRINT_EDIT_FRAME::getLibPath(), LIB_EDIT_FRAME::getLibraryFileName(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_EDITOR_CONTROL::PlaceModule(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), EDA_3D_VIEWER::takeScreenshot(), updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), and DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
bool EDA_BASE_FRAME::ProcessEvent ( wxEvent &  aEvent)
overrideinherited

Function ProcessEvent overrides the default process event handler to implement the auto save feature.

Warning
If you override this function in a derived class, make sure you call down to this or the auto save feature will be disabled.

Definition at line 176 of file eda_base_frame.cpp.

References findQuasiModalDialog(), EDA_BASE_FRAME::isAutoSaveRequired(), EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_autoSaveState, EDA_BASE_FRAME::m_autoSaveTimer, EDA_BASE_FRAME::m_hasAutoSave, and traceAutoSave.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), LIB_VIEW_FRAME::onSelectNextSymbol(), LIB_VIEW_FRAME::onSelectPreviousSymbol(), KIWAY::ProcessEvent(), LIB_VIEW_FRAME::ReCreateListCmp(), and PCBNEW_CONTROL::SwitchUnits().

177 {
178  if( !IsEnabled() && IsActive() )
179  {
180  DIALOG_SHIM* dlg = findQuasiModalDialog( GetChildren() );
181  if( dlg )
182  dlg->Raise();
183  }
184 
185  if( !wxFrame::ProcessEvent( aEvent ) )
186  return false;
187 
188  if( IsShown() && m_hasAutoSave && IsActive() &&
190  {
191  if( !m_autoSaveState )
192  {
193  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
194  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
195  m_autoSaveState = true;
196  }
197  else if( m_autoSaveTimer->IsRunning() )
198  {
199  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
200  m_autoSaveTimer->Stop();
201  m_autoSaveState = false;
202  }
203  }
204 
205  return true;
206 }
bool m_autoSaveState
Flag to indicate the last auto save state.
DIALOG_SHIM * findQuasiModalDialog(wxWindowList &aList)
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:70
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
virtual bool isAutoSaveRequired() const
Function autoSaveRequired returns the auto save status of the application.
bool m_hasAutoSave
Flag to indicate if this frame supports auto save.
int m_autoSaveInterval
The auto save interval time in seconds.
const wxChar traceAutoSave[]
Flag to enable auto save feature debug tracing.
int EDA_BASE_FRAME::ReadHotkeyConfig ( struct EDA_HOTKEY_CONFIG aDescList)
inherited

Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys.

Parameters
aDescList= current hotkey list descr. to initialize.

Definition at line 649 of file hotkeys_basic.cpp.

References ReadHotkeyConfig().

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

650 {
651  ::ReadHotkeyConfig( GetName(), aDescList );
652  return 1;
653 }
int ReadHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys...
int EDA_BASE_FRAME::ReadHotkeyConfigFile ( const wxString &  aFilename,
struct EDA_HOTKEY_CONFIG aDescList 
)
inherited

Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys.

Parameters
aFilename= file name to read.
aDescList= current hotkey list descr. to initialize.

Definition at line 594 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, and ParseHotkeyConfig().

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

596 {
597  wxFileName fn( aFilename );
598  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
599 
600  wxFile cfgfile( fn.GetFullPath() );
601 
602  if( !cfgfile.IsOpened() ) // There is a problem to open file
603  return 0;
604 
605  // get length
606  cfgfile.SeekEnd();
607  wxFileOffset size = cfgfile.Tell();
608  cfgfile.Seek( 0 );
609 
610  // read data
611  std::vector<char> buffer( size );
612  cfgfile.Read( buffer.data(), size );
613  wxString data( buffer.data(), wxConvUTF8 );
614 
615  // parse
616  ParseHotkeyConfig( data, aDescList );
617 
618  // cleanup
619  cfgfile.Close();
620  return 1;
621 }
void ParseHotkeyConfig(const wxString &data, struct EDA_HOTKEY_CONFIG *aDescList)
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
void EDA_BASE_FRAME::ReCreateMenuBar ( void  )
virtualinherited
void SIM_PLOT_FRAME::removePlot ( const wxString &  aPlotName,
bool  aErase = true 
)
private

Removes a plot with a specific title.

Parameters
aPlotNameis the full plot title (e.g. I(Net-C1-Pad1)).
aErasedecides if plot should be removed from corresponding TRACE_MAP (see m_plots).

Definition at line 443 of file sim_plot_frame.cpp.

References CurrentPlot(), SIM_PLOT_PANEL::DeleteTrace(), mpWindow::Fit(), m_plots, SIM_PLOT_PANEL::TraceShown(), updateCursors(), and updateSignalList().

Referenced by SIM_PLOT_FRAME::SIGNAL_CONTEXT_MENU::onMenuEvent(), onSignalDblClick(), and onSimFinished().

444 {
445  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
446 
447  if( !plotPanel )
448  return;
449 
450  if( aErase )
451  {
452  auto& traceMap = m_plots[plotPanel].m_traces;
453  auto traceIt = traceMap.find( aPlotName );
454  wxASSERT( traceIt != traceMap.end() );
455  traceMap.erase( traceIt );
456  }
457 
458  wxASSERT( plotPanel->TraceShown( aPlotName ) );
459  plotPanel->DeleteTrace( aPlotName );
460  plotPanel->Fit();
461 
463  updateCursors();
464 }
bool TraceShown(const wxString &aName) const
void updateCursors()
Updates the cursor values list.
bool DeleteTrace(const wxString &aName)
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
void updateSignalList()
Updates the list of currently plotted signals.
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::RemoveTuner ( TUNER_SLIDER aTuner,
bool  aErase = true 
)

Removes an existing tuner.

Parameters
aTuneris the tuner to be removed.
aErasedecides whether the tuner should be also removed from the tuners list. Otherwise it is removed only from the SIM_PLOT_FRAME pane.

Definition at line 384 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_tunePanel, and m_tuners.

Referenced by TUNER_SLIDER::onClose(), and updateTuners().

385 {
386  if( aErase )
387  m_tuners.remove( aTuner );
388 
389  aTuner->Destroy();
390  m_tunePanel->Layout();
391 }
std::list< TUNER_SLIDER * > m_tuners
List of currently displayed tuners
virtual void EDA_BASE_FRAME::SaveProjectSettings ( bool  aAskForSave)
inlinevirtualinherited

Function SaveProjectSettings saves changes to the project settings to the project (.pro) file.

The method is virtual so you can override it to call the suitable save method. The base method do nothing

Parameters
aAskForSave= true to open a dialog before saving the settings

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 280 of file eda_base_frame.h.

References EDA_BASE_FRAME::ExportHotkeyConfigToFile(), EDA_BASE_FRAME::GetFileFromHistory(), EDA_BASE_FRAME::ImportHotkeyConfigFromFile(), EDA_BASE_FRAME::OnSelectPreferredEditor(), EDA_BASE_FRAME::ReadHotkeyConfig(), EDA_BASE_FRAME::ReadHotkeyConfigFile(), EDA_BASE_FRAME::UpdateFileHistory(), and EDA_BASE_FRAME::WriteHotkeyConfig().

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick(), SCH_EDIT_FRAME::OnPreferencesOptions(), and SCH_EDIT_FRAME::Process_Config().

280 {};
void SIM_PLOT_FRAME::SaveSettings ( wxConfigBase *  aCfg)
overrideprivatevirtual

Function SaveSettings saves common frame parameters to a configuration data file.

Don't forget to call the base class's SaveSettings() from your derived SaveSettings() otherwise the frames won't remember their positions and sizes.

Reimplemented from EDA_BASE_FRAME.

Definition at line 226 of file sim_plot_frame.cpp.

References CURSORS_PANEL_HEIGHT_ENTRY, SIM_PLOT_FRAME_BASE::m_splitterLeftRight, SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsole, SIM_PLOT_FRAME_BASE::m_splitterSignals, SIM_PLOT_FRAME_BASE::m_splitterTuneValues, PLOT_PANEL_HEIGHT_ENTRY, PLOT_PANEL_WIDTH_ENTRY, EDA_BASE_FRAME::SaveSettings(), and SIGNALS_PANEL_HEIGHT_ENTRY.

Referenced by onClose().

227 {
228  // Save main frame size and position:
230 
231  // Save subwindows sizes
232  aCfg->Write( PLOT_PANEL_WIDTH_ENTRY, m_splitterLeftRight->GetSashPosition() );
233  aCfg->Write( PLOT_PANEL_HEIGHT_ENTRY, m_splitterPlotAndConsole->GetSashPosition() );
234  aCfg->Write( SIGNALS_PANEL_HEIGHT_ENTRY, m_splitterSignals->GetSashPosition() );
235  aCfg->Write( CURSORS_PANEL_HEIGHT_ENTRY, m_splitterTuneValues->GetSashPosition() );
236 }
wxSplitterWindow * m_splitterSignals
#define SIGNALS_PANEL_HEIGHT_ENTRY
virtual void SaveSettings(wxConfigBase *aCfg)
Function SaveSettings saves common frame parameters to a configuration data file. ...
wxSplitterWindow * m_splitterTuneValues
#define PLOT_PANEL_WIDTH_ENTRY
wxSplitterWindow * m_splitterLeftRight
#define CURSORS_PANEL_HEIGHT_ENTRY
#define PLOT_PANEL_HEIGHT_ENTRY
wxSplitterWindow * m_splitterPlotAndConsole
bool SIM_PLOT_FRAME::saveWorkbook ( const wxString &  aPath)
private

Saves plot settings to a file.

Parameters
aPathis the file name.
Returns
True if successful.

Definition at line 714 of file sim_plot_frame.cpp.

References Format(), m_plots, and trace.

Referenced by menuSaveWorkbook().

715 {
716 
717  wxString savePath = aPath;
718 
719  if( !savePath.Lower().EndsWith(".wbk"))
720  {
721  savePath += ".wbk";
722  };
723 
724 
725  wxTextFile file( savePath );
726 
727  if( file.Exists() )
728  {
729  if( !file.Open() )
730  return false;
731 
732  file.Clear();
733  }
734  else
735  {
736  file.Create();
737  }
738 
739  file.AddLine( wxString::Format( "%lu", m_plots.size() ) );
740 
741  for( const auto& plot : m_plots )
742  {
743  file.AddLine( wxString::Format( "%d", plot.first->GetType() ) );
744  file.AddLine( plot.second.m_simCommand );
745  file.AddLine( wxString::Format( "%lu", plot.second.m_traces.size() ) );
746 
747  for( const auto& trace : plot.second.m_traces )
748  {
749  file.AddLine( wxString::Format( "%d", trace.second.GetType() ) );
750  file.AddLine( trace.second.GetName() );
751  file.AddLine( trace.second.GetParam() );
752  }
753  }
754 
755  bool res = file.Write();
756  file.Close();
757 
758  return res;
759 }
long trace
Definition: solve.cpp:232
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 209 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_autoSaveState, and EDA_BASE_FRAME::m_autoSaveTimer.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), DIALOG_GENERALOPTIONS::OnOkClick(), and SCH_EDIT_FRAME::OnPreferencesOptions().

210 {
211  m_autoSaveInterval = aInterval;
212 
213  if( m_autoSaveTimer->IsRunning() )
214  {
215  if( m_autoSaveInterval > 0 )
216  {
217  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
218  }
219  else
220  {
221  m_autoSaveTimer->Stop();
222  m_autoSaveState = false;
223  }
224  }
225 }
bool m_autoSaveState
Flag to indicate the last auto save state.
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
int m_autoSaveInterval
The auto save interval time in seconds.
virtual void EDA_BASE_FRAME::SetIconScale ( int  aScale)
inlinevirtualinherited

Function SetIconScale.

Modify the scale of icons in the window; should refresh them and save the setting.

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, GERBVIEW_FRAME, and LIB_EDIT_FRAME.

Definition at line 466 of file eda_base_frame.h.

466 {}
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
Definition: DXF_plotter.cpp:61
void KIWAY_PLAYER::SetModal ( bool  aIsModal)
inlineprotectedinherited

Definition at line 230 of file kiway_player.h.

Referenced by LIB_VIEW_FRAME::LIB_VIEW_FRAME().

230 { m_modal = aIsModal; }
void EDA_BASE_FRAME::SetMruPath ( const wxString &  aPath)
inlineinherited

Definition at line 367 of file eda_base_frame.h.

Referenced by KICAD_MANAGER_FRAME::LoadProject().

367 { m_mruPath = aPath; }
wxString m_mruPath
Most recently used path.
void SIM_PLOT_FRAME::setSubWindowsSashSize ( )
private

Definition at line 253 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_splitterLeftRight, m_splitterLeftRightSashPosition, SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsole, m_splitterPlotAndConsoleSashPosition, SIM_PLOT_FRAME_BASE::m_splitterSignals, m_splitterSignalsSashPosition, SIM_PLOT_FRAME_BASE::m_splitterTuneValues, and m_splitterTuneValuesSashPosition.

Referenced by SIM_PLOT_FRAME().

254 {
257 
260 
263 
266 }
wxSplitterWindow * m_splitterSignals
int m_splitterPlotAndConsoleSashPosition
wxSplitterWindow * m_splitterTuneValues
wxSplitterWindow * m_splitterLeftRight
int m_splitterTuneValuesSashPosition
int m_splitterSignalsSashPosition
int m_splitterLeftRightSashPosition
wxSplitterWindow * m_splitterPlotAndConsole
void EDA_BASE_FRAME::ShowChangedIcons ( )
virtualinherited

Function ShowChangedIcons redraws items menus after a icon was changed option.

Definition at line 253 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::ReCreateMenuBar().

Referenced by EDA_BASE_FRAME::GetMruPath(), and KIWAY::ShowChangedIcons().

254 {
255  ReCreateMenuBar();
256  GetMenuBar()->Refresh();
257 }
virtual void ReCreateMenuBar()
Function ReCreateMenuBar Creates recreates the menu bar.
void EDA_BASE_FRAME::ShowChangedLanguage ( )
virtualinherited

Function ShowChangedLanguage redraws the menus and what not in current language.

Reimplemented in PCB_EDIT_FRAME, and GERBVIEW_FRAME.

Definition at line 246 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::ReCreateMenuBar().

Referenced by EDA_BASE_FRAME::GetMruPath(), KIWAY::SetLanguage(), GERBVIEW_FRAME::ShowChangedLanguage(), and PCB_EDIT_FRAME::ShowChangedLanguage().

247 {
248  ReCreateMenuBar();
249  GetMenuBar()->Refresh();
250 }
virtual void ReCreateMenuBar()
Function ReCreateMenuBar Creates recreates the menu bar.
bool KIWAY_PLAYER::ShowModal ( wxString *  aResult = NULL,
wxWindow *  aResultantFocusWindow = NULL 
)
inherited

Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal().

That is, behavior is similar to a modal dialog window. Not all KIWAY_PLAYERs use this interface, so don't call this unless the implementation knows how to call DismissModal() on a button click or double click or some special event which ends the modal behavior.

Parameters
aResultif not NULL, indicates a place to put a resultant string.
aResultantFocusWindowif not NULL, indicates what window to pass focus to on return.
Returns
bool - true if frame implementation called KIWAY_PLAYER::DismissModal() with aRetVal of true.

Definition at line 79 of file kiway_player.cpp.

References KIWAY_PLAYER::IsModal(), KIWAY_PLAYER::m_modal_loop, KIWAY_PLAYER::m_modal_resultant_parent, KIWAY_PLAYER::m_modal_ret_val, KIWAY_PLAYER::m_modal_string, and WX_EVENT_LOOP.

Referenced by DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), PCB_BASE_FRAME::SelectFootprintFromLibBrowser(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

80 {
81  wxASSERT_MSG( IsModal(), wxT( "ShowModal() shouldn't be called on non-modal frame" ) );
82 
83  /*
84  This function has a nice interface but a necessarily unsightly implementation.
85  Now the implementation is encapsulated, localizing future changes.
86 
87  It works in tandem with DismissModal(). But only ShowModal() is in the
88  vtable and therefore cross-module capable.
89  */
90 
91  // This is an exception safe way to zero a pointer before returning.
92  // Yes, even though DismissModal() clears this first normally, this is
93  // here in case there's an exception before the dialog is dismissed.
94  struct NULLER
95  {
96  void*& m_what;
97  NULLER( void*& aPtr ) : m_what( aPtr ) {}
98  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
99  } clear_this( (void*&) m_modal_loop );
100 
101 
102  m_modal_resultant_parent = aResultantFocusWindow;
103 
104  Show( true );
105  Raise(); // Needed on some Window managers to always display the frame
106 
107  SetFocus();
108 
109  {
110  // We have to disable all frames but the the modal one.
111  // wxWindowDisabler does that, but it also disables all top level windows
112  // We do not want to disable top level windows which are child of the modal one,
113  // if they are enabled.
114  // An example is an aui toolbar which was moved
115  // or a dialog or an other frame or miniframe opened by the modal one.
116  wxWindowList wlist = GetChildren();
117  std::vector<wxWindow*> enabledTopLevelWindows;
118 
119  for( unsigned ii = 0; ii < wlist.size(); ii++ )
120  if( wlist[ii]->IsTopLevel() && wlist[ii]->IsEnabled() )
121  enabledTopLevelWindows.push_back( wlist[ii] );
122 
123  // exception safe way to disable all top level windows except the modal one,
124  // re-enables only those that were disabled on exit
125  wxWindowDisabler toggle( this );
126 
127  for( unsigned ii = 0; ii < enabledTopLevelWindows.size(); ii++ )
128  enabledTopLevelWindows[ii]->Enable( true );
129 
130  WX_EVENT_LOOP event_loop;
131  m_modal_loop = &event_loop;
132  event_loop.Run();
133 
134  } // End of scope for some variables.
135  // End nesting before setting focus below.
136 
137  if( aResult )
138  *aResult = m_modal_string;
139 
140  if( aResultantFocusWindow )
141  {
142  aResultantFocusWindow->Raise();
143 
144  // have the final say, after wxWindowDisabler reenables my parent and
145  // the events settle down, set the focus
146  wxSafeYield();
147  aResultantFocusWindow->SetFocus();
148  }
149 
150  return m_modal_ret_val;
151 }
bool m_modal_ret_val
Definition: kiway_player.h:263
#define WX_EVENT_LOOP
Definition: kiway_player.h:91
wxWindow * m_modal_resultant_parent
Definition: kiway_player.h:261
wxString m_modal_string
Definition: kiway_player.h:262
bool IsModal()
Definition: kiway_player.h:229
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:260
void SIM_PLOT_FRAME::StartSimulation ( )

Definition at line 269 of file sim_plot_frame.cpp.

References applyTuners(), CurrentPlot(), DisplayError(), DisplayInfoMessage(), DIALOG_SIM_SETTINGS::GetNetlistOptions(), STRING_FORMATTER::GetString(), SPICE_SIMULATOR::LoadNetlist(), m_exporter, m_plots, m_settingsDlg, SIM_PLOT_FRAME_BASE::m_simConsole, m_simulator, SPICE_SIMULATOR::Run(), ST_UNKNOWN, updateNetlistExporter(), and updateTuners().

Referenced by loadWorkbook(), onSimulate(), and onSimUpdate().

270 {
271  STRING_FORMATTER formatter;
272  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
273 
274  if( !m_settingsDlg )
275  m_settingsDlg = new DIALOG_SIM_SETTINGS( this );
276 
277  m_simConsole->Clear();
279 
280  if( plotPanel )
281  m_exporter->SetSimCommand( m_plots[plotPanel].m_simCommand );
282 
283  if( !m_exporter->Format( &formatter, m_settingsDlg->GetNetlistOptions() ) )
284  {
285  DisplayError( this, _( "There were errors during netlist export, aborted." ) );
286  return;
287  }
288 
289  if( m_exporter->GetSimType() == ST_UNKNOWN )
290  {
291  DisplayInfoMessage( this, _( "You need to select the simulation settings first." ) );
292  return;
293  }
294 
295  m_simulator->LoadNetlist( formatter.GetString() );
296  updateTuners();
297  applyTuners();
298  m_simulator->Run();
299 }
void applyTuners()
Applies component values specified using tunder sliders to the current netlist.
int GetNetlistOptions() const
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
const std::string & GetString()
Definition: richio.h:475
SPICE_SIMULATOR * m_simulator
virtual bool LoadNetlist(const std::string &aNetlist)=0
DIALOG_SIM_SETTINGS * m_settingsDlg
virtual bool Run()=0
Executes the simulation with currently loaded netlist.
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
void updateNetlistExporter()
Reloads the current schematic for the netlist exporter.
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:272
Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:241
void updateTuners()
Filters out tuners for components that do not exist anymore.
void SIM_PLOT_FRAME::StopSimulation ( )

Definition at line 302 of file sim_plot_frame.cpp.

References m_simulator, and SPICE_SIMULATOR::Stop().

Referenced by onSimulate(), and onSimUpdate().

303 {
304  m_simulator->Stop();
305 }
SPICE_SIMULATOR * m_simulator
virtual bool Stop()=0
Halts the simulation.
const SEARCH_STACK & EDA_BASE_FRAME::sys_search ( )
protectedvirtualinherited

Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 374 of file eda_base_frame.cpp.

References Kiface(), and KIFACE_I::KifaceSearch().

Referenced by EDA_BASE_FRAME::GetKicadHelp(), and EDA_BASE_FRAME::isAutoSaveRequired().

375 {
376  return Kiface().KifaceSearch();
377 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
SEARCH_STACK & KifaceSearch()
Only for DSO specific &#39;non-library&#39; files.
Definition: kiface_i.h:127
void SIM_PLOT_FRAME::updateCursors ( )
private

Updates the cursor values list.

Definition at line 611 of file sim_plot_frame.cpp.

Referenced by onPlotChanged(), onPlotClose(), and removePlot().

612 {
613  wxQueueEvent( this, new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
614 }
void EDA_BASE_FRAME::UpdateFileHistory ( const wxString &  FullFileName,
wxFileHistory *  aFileHistory = NULL 
)
inherited

Function UpdateFileHistory Updates the list of recently opened files.

Note also the menu is updated, if wxFileHistory::UseMenu was called at init time

Parameters
FullFileNameThe full file name including the path.
aFileHistoryThe wxFileHistory in use. If NULL, the main application file history is used.

Definition at line 392 of file eda_base_frame.cpp.

References KIFACE_I::GetFileHistory(), and Kiface().

Referenced by SCH_EDIT_FRAME::ImportFile(), GERBVIEW_FRAME::LoadExcellonFiles(), GERBVIEW_FRAME::loadListOfGerberFiles(), PL_EDITOR_FRAME::LoadPageLayoutDescrFile(), KICAD_MANAGER_FRAME::LoadProject(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::SavePcbFile(), EDA_BASE_FRAME::SaveProjectSettings(), and GERBVIEW_FRAME::unarchiveFiles().

394 {
395  wxFileHistory* fileHistory = aFileHistory;
396 
397  if( !fileHistory )
398  fileHistory = &Kiface().GetFileHistory();
399 
400  fileHistory->AddFileToHistory( FullFileName );
401 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
void SIM_PLOT_FRAME::updateNetlistExporter ( )
private

Reloads the current schematic for the netlist exporter.

Definition at line 467 of file sim_plot_frame.cpp.

References SCH_EDIT_FRAME::BuildNetListBase(), m_exporter, m_schematicFrame, and KIWAY_HOLDER::Prj().

Referenced by onSettings(), SIM_PLOT_FRAME(), and StartSimulation().

468 {
470 }
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
Create a flat list which stores all connected objects.
SCH_EDIT_FRAME * m_schematicFrame
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
Special netlist exporter flavor that allows to override simulation commands.
bool SIM_PLOT_FRAME::updatePlot ( const TRACE_DESC aDescriptor,
SIM_PLOT_PANEL aPanel 
)
private

Updates plot in a particular SIM_PLOT_PANEL.

If the panel does not contain the plot, it will be added.

Parameters
aDescriptorcontains the plot description.
aPanelis the panel that should receive the update.
Returns
True if a plot was successfully added/updated.

Definition at line 473 of file sim_plot_frame.cpp.

References SIM_PLOT_PANEL::AddTrace(), SPICE_SIMULATOR::Command(), Format(), SPICE_SIMULATOR::GetMagPlot(), TRACE_DESC::GetName(), TRACE_DESC::GetParam(), SPICE_SIMULATOR::GetPhasePlot(), TRACE_DESC::GetTitle(), TRACE_DESC::GetType(), SPICE_SIMULATOR::GetXAxis(), SIM_PLOT_PANEL::IsPlottable(), m_exporter, m_plots, m_simulator, SPT_AC_MAG, SPT_AC_PHASE, ST_AC, ST_DC, ST_NOISE, and ST_TRANSIENT.

Referenced by addPlot(), and onSimFinished().

474 {
475  SIM_TYPE simType = m_exporter->GetSimType();
476  wxString spiceVector = m_exporter->GetSpiceVector( aDescriptor.GetName(),
477  aDescriptor.GetType(), aDescriptor.GetParam() );
478 
479  if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
480  {
481  // There is no plot to be shown
482  m_simulator->Command( wxString::Format( "print %s", spiceVector ).ToStdString() );
483 
484  return false;
485  }
486 
487  // First, handle the x axis
488  wxString xAxisName( m_simulator->GetXAxis( simType ) );
489 
490  if( xAxisName.IsEmpty() )
491  return false;
492 
493  auto data_x = m_simulator->GetMagPlot( (const char*) xAxisName.c_str() );
494  unsigned int size = data_x.size();
495 
496  if( data_x.empty() )
497  return false;
498 
499  SIM_PLOT_TYPE plotType = aDescriptor.GetType();
500  std::vector<double> data_y;
501 
502  // Now, Y axis data
503  switch( m_exporter->GetSimType() )
504  {
505  case ST_AC:
506  {
507  wxASSERT_MSG( !( ( plotType & SPT_AC_MAG ) && ( plotType & SPT_AC_PHASE ) ),
508  "Cannot set both AC_PHASE and AC_MAG bits" );
509 
510  if( plotType & SPT_AC_MAG )
511  data_y = m_simulator->GetMagPlot( (const char*) spiceVector.c_str() );
512  else if( plotType & SPT_AC_PHASE )
513  data_y = m_simulator->GetPhasePlot( (const char*) spiceVector.c_str() );
514  else
515  wxASSERT_MSG( false, "Plot type missing AC_PHASE or AC_MAG bit" );
516  }
517  break;
518 
519  case ST_NOISE:
520  case ST_DC:
521  case ST_TRANSIENT:
522  {
523  data_y = m_simulator->GetMagPlot( (const char*) spiceVector.c_str() );
524  }
525  break;
526 
527  default:
528  wxASSERT_MSG( false, "Unhandled plot type" );
529  return false;
530  }
531 
532  if( data_y.size() != size )
533  return false;
534 
535  if( aPanel->AddTrace( aDescriptor.GetTitle(), size,
536  data_x.data(), data_y.data(), aDescriptor.GetType() ) )
537  {
538  m_plots[aPanel].m_traces.insert( std::make_pair( aDescriptor.GetTitle(), aDescriptor ) );
539  }
540 
541  return true;
542 }
virtual std::string GetXAxis(SIM_TYPE aType) const =0
Returns X axis name for a given simulation type
const wxString & GetName() const
virtual std::vector< double > GetPhasePlot(const std::string &aName, int aMaxLen=-1)=0
Returns a requested vector with phase values.
static bool IsPlottable(SIM_TYPE aSimType)
SIM_PLOT_TYPE GetType() const
const wxString & GetParam() const
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
virtual bool Command(const std::string &aCmd)=0
Executes a Spice command as if it was typed into console.
bool AddTrace(const wxString &aName, int aPoints, const double *aX, const double *aY, SIM_PLOT_TYPE aFlags)
SPICE_SIMULATOR * m_simulator
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
const wxString & GetTitle() const
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:35
virtual std::vector< double > GetMagPlot(const std::string &aName, int aMaxLen=-1)=0
Returns a requested vector with magnitude values.
void SIM_PLOT_FRAME::updateSignalList ( )
private

Updates the list of currently plotted signals.

Definition at line 545 of file sim_plot_frame.cpp.

References CurrentPlot(), m_plots, SIM_PLOT_FRAME_BASE::m_signals, m_signalsIconColorList, and trace.

Referenced by addPlot(), onPlotChanged(), onPlotClose(), onSimFinished(), and removePlot().

546 {
547  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
548 
549  if( !plotPanel )
550  return;
551 
552  m_signals->ClearAll();
553 
554  wxSize size = m_signals->GetClientSize();
555  m_signals->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x );
556 
557  // Build an image list, to show the color of the corresponding trace
558  // in the plot panel
559  // This image list is used for trace and cursor lists
560  wxMemoryDC bmDC;
561  const int isize = bmDC.GetCharHeight();
562 
563  if( m_signalsIconColorList == NULL )
564  m_signalsIconColorList = new wxImageList( isize, isize, false );
565  else
566  m_signalsIconColorList->RemoveAll();
567 
568  for( const auto& trace : CurrentPlot()->GetTraces() )
569  {
570  wxBitmap bitmap( isize, isize );
571  bmDC.SelectObject( bitmap );
572  wxColour tcolor = trace.second->GetTraceColour();
573 
574  wxColour bgColor = m_signals->wxWindow::GetBackgroundColour();
575  bmDC.SetPen( wxPen( bgColor ) );
576  bmDC.SetBrush( wxBrush( bgColor ) );
577  bmDC.DrawRectangle( 0, 0, isize, isize ); // because bmDC.Clear() does not work in wxGTK
578 
579  bmDC.SetPen( wxPen( tcolor ) );
580  bmDC.SetBrush( wxBrush( tcolor ) );
581  bmDC.DrawRectangle( 0, isize / 4 + 1, isize, isize / 2 );
582 
583  bmDC.SelectObject( wxNullBitmap ); // Needed to initialize bitmap
584 
585  bitmap.SetMask( new wxMask( bitmap, *wxBLACK ) );
586  m_signalsIconColorList->Add( bitmap );
587  }
588 
589  if( bmDC.IsOk() )
590  {
591  bmDC.SetBrush( wxNullBrush );
592  bmDC.SetPen( wxNullPen );
593  }
594 
595  m_signals->SetImageList( m_signalsIconColorList, wxIMAGE_LIST_SMALL );
596 
597  // Fill the signals listctrl. Keep the order of names and
598  // the order of icon color identical, because the icons
599  // are also used in cursor list, and the color index is
600  // calculated from the trace name index
601  int imgidx = 0;
602 
603  for( const auto& trace : m_plots[plotPanel].m_traces )
604  {
605  m_signals->InsertItem( imgidx, trace.first, imgidx );
606  imgidx++;
607  }
608 }
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
long trace
Definition: solve.cpp:232
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
void SIM_PLOT_FRAME::updateTuners ( )
private

Filters out tuners for components that do not exist anymore.

Decisions are based on the current NETLIST_EXPORTER data.

Definition at line 617 of file sim_plot_frame.cpp.

References m_exporter, m_tuners, and RemoveTuner().

Referenced by StartSimulation().

618 {
619  const auto& spiceItems = m_exporter->GetSpiceItems();
620 
621  for( auto it = m_tuners.begin(); it != m_tuners.end(); /* iteration inside the loop */ )
622  {
623  const wxString& ref = (*it)->GetComponentName();
624 
625  if( std::find_if( spiceItems.begin(), spiceItems.end(), [&]( const SPICE_ITEM& item )
626  {
627  return item.m_refName == ref;
628  }) == spiceItems.end() )
629  {
630  // The component does not exist anymore, remove the associated tuner
631  TUNER_SLIDER* tuner = *it;
632  it = m_tuners.erase( it );
633  RemoveTuner( tuner, false );
634  }
635  else
636  {
637  ++it;
638  }
639  }
640 }
void RemoveTuner(TUNER_SLIDER *aTuner, bool aErase=true)
Removes an existing tuner.
Structure to represent a schematic component in the Spice simulation.
std::list< TUNER_SLIDER * > m_tuners
List of currently displayed tuners
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
Custom widget to handle quick component values modification and simulation on the fly...
Definition: tuner_slider.h:40
int EDA_BASE_FRAME::WriteHotkeyConfig ( struct EDA_HOTKEY_CONFIG aDescList,
wxString *  aFullFileName = NULL 
)
virtualinherited

Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mechanism or a file.

Parameters
aDescList= pointer to the current hotkey list.
aFullFileName= a wxString pointer to a full file name. if NULL, use the standard wxConfig mechanism (default) the output format is: shortcut "key" "function" lines starting with # are comments

Reimplemented in EDA_DRAW_FRAME.

Definition at line 528 of file hotkeys_basic.cpp.

References AddDelimiterString(), DEFAULT_HOTKEY_FILENAME_EXT, GetChars(), GetNewConfig(), HOTKEYS_CONFIG_KEY, KeyNameFromKeyCode(), EDA_HOTKEY_CONFIG::m_HK_InfoList, EDA_HOTKEY::m_InfoMsg, EDA_HOTKEY::m_KeyCode, EDA_HOTKEY_CONFIG::m_SectionTag, EDA_HOTKEY_CONFIG::m_Title, and TO_UTF8.

Referenced by EDA_BASE_FRAME::SaveProjectSettings(), HOTKEYS_EDITOR_DIALOG::TransferDataFromWindow(), and EDA_DRAW_FRAME::WriteHotkeyConfig().

530 {
531  wxString msg;
532  wxString keyname, infokey;
533 
534  msg = wxT( "$hotkey list\n" );
535 
536  // Print the current hotkey list
537  EDA_HOTKEY** list;
538 
539  for( ; aDescList->m_HK_InfoList != nullptr; aDescList++ )
540  {
541  if( aDescList->m_Title )
542  {
543  msg += wxT( "# " );
544  msg += *aDescList->m_Title;
545  msg += wxT( "\n" );
546  }
547 
548  msg += *aDescList->m_SectionTag;
549  msg += wxT( "\n" );
550 
551  list = aDescList->m_HK_InfoList;
552 
553  for( ; *list != nullptr; list++ )
554  {
555  EDA_HOTKEY* hk_decr = *list;
556  msg += wxT( "shortcut " );
557  keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
558  AddDelimiterString( keyname );
559  infokey = hk_decr->m_InfoMsg;
560  AddDelimiterString( infokey );
561  msg += keyname + wxT( ": " ) + infokey + wxT( "\n" );
562  }
563  }
564 
565  msg += wxT( "$Endlist\n" );
566 
567  if( aFullFileName )
568  {
569  FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) );
570 
571  if( file )
572  {
573  fputs( TO_UTF8( msg ), file );
574  fclose( file );
575  }
576  else
577  {
578  msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );
579  return 0;
580  }
581  }
582  else
583  {
584  wxFileName fn( GetName() );
585  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
586  std::unique_ptr<wxConfigBase> config( GetNewConfig( fn.GetFullPath() ) );
587  config->Write( HOTKEYS_CONFIG_KEY, msg );
588  }
589 
590  return 1;
591 }
EDA_HOTKEY ** m_HK_InfoList
Definition: hotkeys_basic.h:91
wxConfigBase * GetNewConfig(const wxString &aProgName)
Function GetNewConfig.
Definition: common.cpp:205
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
#define HOTKEYS_CONFIG_KEY
void AddDelimiterString(wxString &string)
Function AddDelimiterString Add un " to the start and the end of string (if not already done)...
Definition: gestfich.cpp:44
wxString * m_SectionTag
Definition: hotkeys_basic.h:90
wxString m_InfoMsg
Definition: hotkeys_basic.h:64
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
wxString * m_Title
Definition: hotkeys_basic.h:92
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Function KeyNameFromKeyCode return the key name from the key code Only some wxWidgets key values are ...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34

Member Data Documentation

wxString EDA_BASE_FRAME::m_AboutTitle
protectedinherited

Name of program displayed in About.

Definition at line 147 of file eda_base_frame.h.

wxMenuItem* SIM_PLOT_FRAME_BASE::m_addSignals
protectedinherited
bool EDA_BASE_FRAME::m_autoSaveState
protectedinherited
wxTimer* EDA_BASE_FRAME::m_autoSaveTimer
protectedinherited
wxString EDA_BASE_FRAME::m_configFrameName
protectedinherited

prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used

Definition at line 142 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::ConfigBaseName(), and LIB_VIEW_FRAME::LIB_VIEW_FRAME().

wxListCtrl* SIM_PLOT_FRAME_BASE::m_cursors
protectedinherited
std::unique_ptr<NETLIST_EXPORTER_PSPICE_SIM> SIM_PLOT_FRAME::m_exporter
private
wxMenu* SIM_PLOT_FRAME_BASE::m_fileMenu
protectedinherited

Definition at line 47 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

bool EDA_BASE_FRAME::m_hasAutoSave
protectedinherited

Flag to indicate if this frame supports auto save.

Definition at line 152 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME(), EDA_BASE_FRAME::LoadSettings(), EDA_BASE_FRAME::ProcessEvent(), and EDA_BASE_FRAME::SaveSettings().

FRAME_T EDA_BASE_FRAME::m_Ident
protectedinherited

Id Type (pcb, schematic, library..)

Definition at line 138 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

SIM_PLOT_PANEL* SIM_PLOT_FRAME::m_lastSimPlot
private

Panel that was used as the most recent one for simulations

Definition at line 335 of file sim_plot_frame.h.

Referenced by onSimUpdate().

wxMenuBar* SIM_PLOT_FRAME_BASE::m_mainMenu
protectedinherited

Definition at line 46 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

bool KIWAY_PLAYER::m_modal
protectedinherited

Definition at line 259 of file kiway_player.h.

WX_EVENT_LOOP* KIWAY_PLAYER::m_modal_loop
protectedinherited
wxWindow* KIWAY_PLAYER::m_modal_resultant_parent
protectedinherited

Definition at line 261 of file kiway_player.h.

Referenced by KIWAY_PLAYER::ShowModal().

bool KIWAY_PLAYER::m_modal_ret_val
protectedinherited
wxString KIWAY_PLAYER::m_modal_string
protectedinherited

Definition at line 262 of file kiway_player.h.

Referenced by KIWAY_PLAYER::DismissModal(), and KIWAY_PLAYER::ShowModal().

wxPanel* SIM_PLOT_FRAME_BASE::m_panelConsole
protectedinherited

Definition at line 67 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxPanel* SIM_PLOT_FRAME_BASE::m_panelCursors
protectedinherited

Definition at line 77 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxPanel* SIM_PLOT_FRAME_BASE::m_panelCursorsAndTune
protectedinherited

Definition at line 75 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxPanel* SIM_PLOT_FRAME_BASE::m_panelLeft
protectedinherited

Definition at line 58 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxPanel* SIM_PLOT_FRAME_BASE::m_panelSignals
protectedinherited

Definition at line 73 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxString EDA_BASE_FRAME::m_perspective
protectedinherited

wxAuiManager perspective.

Definition at line 163 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::LoadSettings().

wxAuiNotebook* SIM_PLOT_FRAME_BASE::m_plotNotebook
protectedinherited
wxPanel* SIM_PLOT_FRAME_BASE::m_plotPanel
protectedinherited

Definition at line 61 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

std::map<SIM_PLOT_PANEL*, PLOT_INFO> SIM_PLOT_FRAME::m_plots
private
wxMenuItem* SIM_PLOT_FRAME_BASE::m_probeSignals
protectedinherited
SIM_THREAD_REPORTER* SIM_PLOT_FRAME::m_reporter
private

Definition at line 289 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME(), and ~SIM_PLOT_FRAME().

wxMenuItem* SIM_PLOT_FRAME_BASE::m_runSimulation
protectedinherited
wxString SIM_PLOT_FRAME::m_savedWorkbooksPath
staticprivate

A string to store the path of saved workbooks during a session

Definition at line 342 of file sim_plot_frame.h.

Referenced by menuOpenWorkbook(), menuSaveWorkbook(), SIM_PLOT_FRAME(), and TRACE_DESC::TRACE_DESC().

SCH_EDIT_FRAME* SIM_PLOT_FRAME::m_schematicFrame
private

Definition at line 286 of file sim_plot_frame.h.

Referenced by onProbe(), onTune(), SIM_PLOT_FRAME(), and updateNetlistExporter().

wxMenuItem* SIM_PLOT_FRAME_BASE::m_settings
protectedinherited
DIALOG_SIM_SETTINGS* SIM_PLOT_FRAME::m_settingsDlg
private

Definition at line 312 of file sim_plot_frame.h.

Referenced by onSettings(), SIM_PLOT_FRAME(), StartSimulation(), and ~SIM_PLOT_FRAME().

wxPanel* SIM_PLOT_FRAME_BASE::m_sidePanel
protectedinherited

Definition at line 70 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_sideSizer
protectedinherited

Definition at line 71 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxListView* SIM_PLOT_FRAME_BASE::m_signals
protectedinherited
wxImageList* SIM_PLOT_FRAME::m_signalsIconColorList
private

imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the corresponding signal traces

Definition at line 339 of file sim_plot_frame.h.

Referenced by onCursorUpdate(), SIM_PLOT_FRAME(), updateSignalList(), and ~SIM_PLOT_FRAME().

wxTextCtrl* SIM_PLOT_FRAME_BASE::m_simConsole
protectedinherited
wxMenu* SIM_PLOT_FRAME_BASE::m_simulationMenu
protectedinherited

Definition at line 48 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_sizer11
protectedinherited

Definition at line 59 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_sizer8
protectedinherited

Definition at line 65 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_sizerConsole
protectedinherited

Definition at line 68 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_sizerMain
protectedinherited

Definition at line 55 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_sizerPlot
protectedinherited

Definition at line 62 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxSplitterWindow* SIM_PLOT_FRAME_BASE::m_splitterLeftRight
protectedinherited
int SIM_PLOT_FRAME::m_splitterLeftRightSashPosition
private

Definition at line 345 of file sim_plot_frame.h.

Referenced by LoadSettings(), and setSubWindowsSashSize().

wxSplitterWindow* SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsole
protectedinherited
int SIM_PLOT_FRAME::m_splitterPlotAndConsoleSashPosition
private

Definition at line 346 of file sim_plot_frame.h.

Referenced by LoadSettings(), and setSubWindowsSashSize().

wxSplitterWindow* SIM_PLOT_FRAME_BASE::m_splitterSignals
protectedinherited
int SIM_PLOT_FRAME::m_splitterSignalsSashPosition
private

Definition at line 347 of file sim_plot_frame.h.

Referenced by LoadSettings(), and setSubWindowsSashSize().

wxSplitterWindow* SIM_PLOT_FRAME_BASE::m_splitterTuneValues
protectedinherited
int SIM_PLOT_FRAME::m_splitterTuneValuesSashPosition
private

Definition at line 348 of file sim_plot_frame.h.

Referenced by LoadSettings(), and setSubWindowsSashSize().

wxStaticText* SIM_PLOT_FRAME_BASE::m_staticText2
protectedinherited

Definition at line 66 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxToolBarToolBase* SIM_PLOT_FRAME::m_toolAddSignals
private

Definition at line 281 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxToolBar* SIM_PLOT_FRAME_BASE::m_toolBar
protectedinherited
wxToolBarToolBase* SIM_PLOT_FRAME::m_toolProbe
private

Definition at line 282 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxToolBarToolBase* SIM_PLOT_FRAME::m_toolSettings
private

Definition at line 284 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxToolBarToolBase* SIM_PLOT_FRAME::m_toolSimulate
private

Definition at line 280 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxToolBarToolBase* SIM_PLOT_FRAME::m_toolTune
private

Definition at line 283 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxPanel* SIM_PLOT_FRAME_BASE::m_tunePanel
protectedinherited
std::list<TUNER_SLIDER*> SIM_PLOT_FRAME::m_tuners
private

List of currently displayed tuners

Definition at line 306 of file sim_plot_frame.h.

Referenced by AddTuner(), applyTuners(), RemoveTuner(), and updateTuners().

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_tuneSizer
protectedinherited

Definition at line 81 of file sim_plot_frame_base.h.

Referenced by AddTuner(), and SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxStaticBoxSizer* SIM_PLOT_FRAME_BASE::m_tuneSizerStb
protectedinherited

Definition at line 80 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxMenuItem* SIM_PLOT_FRAME_BASE::m_tuneValue
protectedinherited
wxMenu* SIM_PLOT_FRAME_BASE::m_viewMenu
protectedinherited

Definition at line 54 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxPanel* SIM_PLOT_FRAME_BASE::m_welcomePanel
protectedinherited

The documentation for this class was generated from the following files: