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 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_showNetlist
 
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 onShowNetlist (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
 
std::shared_ptr< 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 292 of file sim_plot_frame.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 120 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, 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, SIM_PLOT_FRAME_BASE::m_showNetlist, 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(), onShowNetlist(), onSimFinished(), onSimReport(), onSimStarted(), onSimulate(), onSimUpdate(), onTune(), KIWAY::Player(), KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), setSubWindowsSashSize(), and updateNetlistExporter().

121  : SIM_PLOT_FRAME_BASE( aParent ), m_lastSimPlot( nullptr )
122 {
123  SetKiway( this, aKiway );
124  m_signalsIconColorList = NULL;
125 
127 
128  if( m_schematicFrame == NULL )
129  throw std::runtime_error( "There is no schematic window" );
130 
131  // Give an icon
132  wxIcon icon;
133  icon.CopyFromBitmap( KiBitmap( simulator_xpm ) );
134  SetIcon( icon );
135 
136  // Get the previous size and position of windows:
137  LoadSettings( config() );
138 
140 
141  if( !m_simulator )
142  {
143  throw std::runtime_error( "Could not create simulator instance" );
144  return;
145  }
146 
147  m_simulator->Init();
148 
149  if( m_savedWorkbooksPath.IsEmpty() )
150  {
152  }
153 
154  m_reporter = new SIM_THREAD_REPORTER( this );
155  m_simulator->SetReporter( m_reporter );
156 
158 
159  Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SIM_PLOT_FRAME::onClose ), NULL, this );
160  Connect( EVT_SIM_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onSimUpdate ), NULL, this );
161  Connect( EVT_SIM_REPORT, wxCommandEventHandler( SIM_PLOT_FRAME::onSimReport ), NULL, this );
162  Connect( EVT_SIM_STARTED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimStarted ), NULL, this );
163  Connect( EVT_SIM_FINISHED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimFinished ), NULL, this );
164  Connect( EVT_SIM_CURSOR_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onCursorUpdate ), NULL, this );
165 
166  // Toolbar buttons
167  m_toolSimulate = m_toolBar->AddTool( ID_SIM_RUN, _( "Run/Stop Simulation" ),
168  KiBitmap( sim_run_xpm ), _( "Run Simulation" ), wxITEM_NORMAL );
169  m_toolAddSignals = m_toolBar->AddTool( ID_SIM_ADD_SIGNALS, _( "Add Signals" ),
170  KiBitmap( sim_add_signal_xpm ), _( "Add signals to plot" ), wxITEM_NORMAL );
171  m_toolProbe = m_toolBar->AddTool( ID_SIM_PROBE, _( "Probe" ),
172  KiBitmap( sim_probe_xpm ), _( "Probe signals on the schematic" ), wxITEM_NORMAL );
173  m_toolTune = m_toolBar->AddTool( ID_SIM_TUNE, _( "Tune" ),
174  KiBitmap( sim_tune_xpm ), _( "Tune component values" ), wxITEM_NORMAL );
175  m_toolSettings = m_toolBar->AddTool( wxID_ANY, _( "Settings" ),
176  KiBitmap( sim_settings_xpm ), _( "Simulation settings" ), wxITEM_NORMAL );
177 
178  Connect( m_toolSimulate->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
179  wxCommandEventHandler( SIM_PLOT_FRAME::onSimulate ), NULL, this );
180  Connect( m_toolAddSignals->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
181  wxCommandEventHandler( SIM_PLOT_FRAME::onAddSignal ), NULL, this );
182  Connect( m_toolProbe->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
183  wxCommandEventHandler( SIM_PLOT_FRAME::onProbe ), NULL, this );
184  Connect( m_toolTune->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
185  wxCommandEventHandler( SIM_PLOT_FRAME::onTune ), NULL, this );
186  Connect( m_toolSettings->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
187  wxCommandEventHandler( SIM_PLOT_FRAME::onSettings ), NULL, this );
188 
189  // Bind toolbar buttons event to existing menu event handlers, so they behave the same
190  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSimulate, this, m_runSimulation->GetId() );
191  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onAddSignal, this, m_addSignals->GetId() );
192  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onProbe, this, m_probeSignals->GetId() );
193  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onTune, this, m_tuneValue->GetId() );
194  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onShowNetlist, this, m_showNetlist->GetId() );
195  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSettings, this, m_settings->GetId() );
196 
197  m_toolBar->Realize();
198  m_plotNotebook->SetPageText( 0, _( "Welcome!" ) );
199 
200  // the settings dialog will be created later, on demand.
201  // if created in the ctor, for some obscure reason, there is an issue
202  // on Windows: when open it, the simulator frame is sent to the background.
203  // instead of being behind the dialog frame (as it does)
204  m_settingsDlg = NULL;
205 
206  SetSize( ConvertDialogToPixels( wxSize( 400, 300 ) ) );
207 
208  // resize the subwindows size. At least on Windows, calling wxSafeYield before
209  // resizing the subwindows forces the wxSplitWindows size events automatically generated
210  // by wxWidgets to be executed before our resize code.
211  // Otherwise, the changes made by setSubWindowsSashSize are overwritten by one these
212  // events
213  wxSafeYield();
215 }
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 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
std::shared_ptr< SPICE_SIMULATOR > m_simulator
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
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)
void onShowNetlist(wxCommandEvent &event)
wxToolBarToolBase * m_toolAddSignals
static std::shared_ptr< SPICE_SIMULATOR > CreateInstance(const std::string &aName)
Creates a simulator instance of particular type (currently only ngspice is handled) ...
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
void onSettings(wxCommandEvent &event)
void onClose(wxCloseEvent &aEvent)
wxToolBarToolBase * m_toolTune
wxToolBarToolBase * m_toolSettings
SIM_PLOT_FRAME::~SIM_PLOT_FRAME ( )

Definition at line 218 of file sim_plot_frame.cpp.

References m_reporter, m_settingsDlg, m_signalsIconColorList, and m_simulator.

219 {
220  m_simulator->SetReporter( nullptr );
221  delete m_reporter;
222  delete m_signalsIconColorList;
223 
224  if( m_settingsDlg )
225  m_settingsDlg->Destroy();
226 }
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
SIM_THREAD_REPORTER * m_reporter
std::shared_ptr< 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 346 of file sim_plot_frame.cpp.

References addPlot(), and SPT_CURRENT.

Referenced by DIALOG_SIGNAL_LIST::addSelectionToPlotFrame().

347 {
348  addPlot( aDeviceName, SPT_CURRENT, aParam );
349 }
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 693 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().

694 {
695  wxMenu* menu = NULL;
696  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
697 
698  if( item ) // This menu exists, do nothing
699  return;
700 
701  menu = new wxMenu;
702 
703  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
704  _( "Icons in Menus" ), wxEmptyString,
705  wxITEM_CHECK ) );
706  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
707 
708  AddMenuItem( MasterMenu, menu,
710  _( "Icons Options" ),
711  _( "Select show icons in menus and icons sizes" ),
712  KiBitmap( icon_xpm ) );
713 }
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 409 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().

410 {
411  SIM_TYPE simType = m_exporter->GetSimType();
412 
413  if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
414  return; // TODO else write out in console?
415 
416  // Create a new plot if the current one displays a different type
417  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
418 
419  if( !plotPanel || plotPanel->GetType() != simType )
420  plotPanel = NewPlotPanel( simType );
421 
422  TRACE_DESC descriptor( *m_exporter, aName, aType, aParam );
423 
424  bool updated = false;
425  SIM_PLOT_TYPE xAxisType = GetXAxisType( simType );
426 
427  if( xAxisType == SPT_LIN_FREQUENCY || xAxisType == SPT_LOG_FREQUENCY )
428  {
429  int baseType = descriptor.GetType() & ~( SPT_AC_MAG | SPT_AC_PHASE );
430 
431  // Add two plots: magnitude & phase
432  TRACE_DESC mag_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_MAG ) );
433  TRACE_DESC phase_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_PHASE ) );
434 
435  updated |= updatePlot( mag_desc, plotPanel );
436  updated |= updatePlot( phase_desc, plotPanel );
437  }
438  else
439  {
440  updated = updatePlot( descriptor, plotPanel );
441  }
442 
443  if( updated )
444  {
446  }
447 }
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 352 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().

353 {
354  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
355 
356  if( !plotPanel )
357  return;
358 
359  // For now limit the tuner tool to RLC components
360  char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aComponent, 0 )[0];
361 
362  if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR && primitiveType != SP_INDUCTOR )
363  return;
364 
365  const wxString& componentName = aComponent->GetField( REFERENCE )->GetText();
366 
367  // Do not add multiple instances for the same component
368  auto tunerIt = std::find_if( m_tuners.begin(), m_tuners.end(), [&]( const TUNER_SLIDER* t )
369  {
370  return t->GetComponentName() == componentName;
371  }
372  );
373 
374  if( tunerIt != m_tuners.end() )
375  return; // We already have it
376 
377  try
378  {
379  TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_tunePanel, aComponent );
380  m_tuneSizer->Add( tuner );
381  m_tuners.push_back( tuner );
382  m_tunePanel->Layout();
383  }
384  catch( ... )
385  {
386  // Sorry, no bonus
387  }
388 }
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 340 of file sim_plot_frame.cpp.

References addPlot(), and SPT_VOLTAGE.

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

341 {
342  addPlot( aNetName, SPT_VOLTAGE, "V" );
343 }
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 650 of file sim_plot_frame.cpp.

References m_simulator, and m_tuners.

Referenced by onSimUpdate(), and StartSimulation().

651 {
652  for( auto& tuner : m_tuners )
653  {
655  std::string command( "alter @" + tuner->GetSpiceName()
656  + "=" + tuner->GetValue().ToSpiceString() );
657 
658  m_simulator->Command( command );
659  }
660 }
std::list< TUNER_SLIDER * > m_tuners
List of currently displayed tuners
std::shared_ptr< 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 598 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().

600 {
601  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
602  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
603 
604  wxFileName autoSaveFileName = aFileName;
605 
606  // Check for auto save file.
607  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
608 
609  wxLogTrace( traceAutoSave,
610  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
611 
612  if( !autoSaveFileName.FileExists() )
613  return;
614 
615  wxString msg = wxString::Format( _(
616  "Well this is potentially embarrassing!\n"
617  "It appears that the last time you were editing the file\n"
618  "\"%s\"\n"
619  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
620  GetChars( aFileName.GetFullName() )
621  );
622 
623  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
624 
625  // Make a backup of the current file, delete the file, and rename the auto save file to
626  // the file name.
627  if( response == wxYES )
628  {
629  // Get the backup file name.
630  wxFileName backupFileName = aFileName;
631  backupFileName.SetExt( aBackupFileExtension );
632 
633  // If an old backup file exists, delete it. If an old copy of the file exists, rename
634  // it to the backup file name
635  if( aFileName.FileExists() )
636  {
637  // Remove the old file backup file.
638  if( backupFileName.FileExists() )
639  wxRemoveFile( backupFileName.GetFullPath() );
640 
641  // Rename the old file to the backup file name.
642  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
643  {
644  msg.Printf( _( "Could not create backup file \"%s\"" ),
645  GetChars( backupFileName.GetFullPath() ) );
646  wxMessageBox( msg );
647  }
648  }
649 
650  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
651  {
652  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
653  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
654  }
655  }
656  else
657  {
658  wxLogTrace( traceAutoSave,
659  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
660 
661  // Remove the auto save file when using the previous file as is.
662  wxRemoveFile( autoSaveFileName.GetFullPath() );
663  }
664 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
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
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 260 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().

261  {
262  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
263  return baseCfgName;
264  }
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 251 of file eda_base_frame.cpp.

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

252 {
253  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
254 }
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 219 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

219 { 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 420 of file eda_base_frame.cpp.

References Format(), GetChars(), KIFACE_I::GetFileHistory(), i, 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().

422 {
423  wxFileHistory* fileHistory = aFileHistory;
424 
425  if( !fileHistory )
426  fileHistory = &Kiface().GetFileHistory();
427 
428  int baseId = fileHistory->GetBaseId();
429 
430  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
431 
432  unsigned i = cmdId - baseId;
433 
434  if( i < fileHistory->GetCount() )
435  {
436  wxString fn = fileHistory->GetHistoryFile( i );
437 
438  if( wxFileName::FileExists( fn ) )
439  return fn;
440  else
441  {
442  wxString msg = wxString::Format(
443  _( "File \"%s\" was not found." ),
444  GetChars( fn ) );
445 
446  wxMessageBox( msg );
447 
448  fileHistory->RemoveFileFromHistory( i );
449  }
450  }
451 
452  return wxEmptyString;
453 }
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
size_t i
Definition: json11.cpp:597
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 453 of file eda_base_frame.h.

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

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

Definition at line 547 of file eda_base_frame.cpp.

References ShowAboutDialog().

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

548 {
549  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
550  ShowAboutDialog( this );
551 }
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 534 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

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

535 {
536  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
537  {
538  wxString msg;
539  msg.Printf( _( "Could not launch the default browser.\n"
540  "For information on how to help the KiCad project, visit %s" ),
542  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
543  }
544 }
#define URL_GET_INVOLVED
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 456 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().

457 {
458  const SEARCH_STACK& search = sys_search();
459 
460  /* We have to get document for beginners,
461  * or the full specific doc
462  * if event id is wxID_INDEX, we want the document for beginners.
463  * else the specific doc file (its name is in Kiface().GetHelpFileName())
464  * The document for beginners is the same for all KiCad utilities
465  */
466  if( event.GetId() == wxID_INDEX )
467  {
468  // List of possible names for Getting Started in KiCad
469  const wxChar* names[2] = {
470  wxT( "getting_started_in_kicad" ),
471  wxT( "Getting_Started_in_KiCad" )
472  };
473 
474  wxString helpFile;
475  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
476  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
477  for( unsigned ii = 0; ii < DIM( names ); ii++ )
478  {
479  helpFile = SearchHelpFileFullPath( search, names[ii] );
480 
481  if( !helpFile.IsEmpty() )
482  break;
483  }
484 
485  if( !helpFile )
486  {
487  wxString msg = wxString::Format( _(
488  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
489  wxMessageBox( msg );
490  }
491  else
492  {
493  GetAssociatedDocument( this, helpFile );
494  }
495 
496  return;
497  }
498 
499  wxString base_name = help_name();
500  wxString helpFile = SearchHelpFileFullPath( search, base_name );
501 
502  if( !helpFile )
503  {
504  wxString msg = wxString::Format( _(
505  "Help file \"%s\" could not be found." ),
506  GetChars( base_name )
507  );
508  wxMessageBox( msg );
509  }
510  else
511  {
512  GetAssociatedDocument( this, helpFile );
513  }
514 }
#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:87
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 769 of file sim_plot_frame.cpp.

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

Referenced by addPlot().

770 {
771  switch( aType )
772  {
773  case ST_AC:
774  return SPT_LIN_FREQUENCY;
776 
777  case ST_DC:
778  return SPT_SWEEP;
779 
780  case ST_TRANSIENT:
781  return SPT_TIME;
782 
783  default:
784  wxASSERT_MSG( false, "Unhandled simulation type" );
785  return (SIM_PLOT_TYPE) 0;
786  }
787 }
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 396 of file eda_base_frame.cpp.

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

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

397 {
398  return Kiface().GetHelpFileName();
399 }
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
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 175 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().

175 { 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:248
bool SIM_PLOT_FRAME::IsSimulationRunning ( )

Definition at line 315 of file sim_plot_frame.cpp.

References m_simulator.

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

316 {
317  return m_simulator ? m_simulator->IsRunning() : false;
318 }
std::shared_ptr< 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 554 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().

555 {
556  wxString msg;
557  wxFileName fn = aFileName;
558 
559  // Check for absence of a file path with a file name. Unfortunately KiCad
560  // uses paths relative to the current project path without the ./ part which
561  // confuses wxFileName. Making the file name path absolute may be less than
562  // elegant but it solves the problem.
563  if( fn.GetPath().IsEmpty() && fn.HasName() )
564  fn.MakeAbsolute();
565 
566  wxCHECK_MSG( fn.IsOk(), false,
567  wxT( "File name object is invalid. Bad programmer!" ) );
568  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
569  wxT( "File name object path <" ) + fn.GetFullPath() +
570  wxT( "> is not set. Bad programmer!" ) );
571 
572  if( fn.IsDir() && !fn.IsDirWritable() )
573  {
574  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
575  GetChars( fn.GetPath() ) );
576  }
577  else if( !fn.FileExists() && !fn.IsDirWritable() )
578  {
579  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
580  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
581  }
582  else if( fn.FileExists() && !fn.IsFileWritable() )
583  {
584  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
585  GetChars( fn.GetFullPath() ) );
586  }
587 
588  if( !msg.IsEmpty() )
589  {
590  wxMessageBox( msg );
591  return false;
592  }
593 
594  return true;
595 }
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_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), 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(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_CHOOSE_COMPONENT::OnIdle(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), 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_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_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 246 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().

247 {
248  // Read main frame size and position:
250  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
251 
252  // Read subwindows sizes (should be > 0 )
257 }
#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 663 of file sim_plot_frame.cpp.

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

Referenced by menuOpenWorkbook().

664 {
665  m_plots.clear();
666  m_plotNotebook->DeleteAllPages();
667 
668  wxTextFile file( aPath );
669 
670  if( !file.Open() )
671  return false;
672 
673  long plotsCount;
674 
675  if( !file.GetFirstLine().ToLong( &plotsCount ) ) // GetFirstLine instead of GetNextLine
676  return false;
677 
678  for( long i = 0; i < plotsCount; ++i )
679  {
680  long plotType, tracesCount;
681 
682  if( !file.GetNextLine().ToLong( &plotType ) )
683  return false;
684 
685  SIM_PLOT_PANEL* plotPanel = NewPlotPanel( (SIM_TYPE) plotType );
686  m_plots[plotPanel].m_simCommand = file.GetNextLine();
687  StartSimulation();
688 
689  // Perform simulation, so plots can be added with values
690  do
691  {
692  wxThread::This()->Sleep( 50 );
693  }
694  while( IsSimulationRunning() );
695 
696  if( !file.GetNextLine().ToLong( &tracesCount ) )
697  return false;
698 
699  for( long j = 0; j < tracesCount; ++j )
700  {
701  long traceType;
702  wxString name, param;
703 
704  if( !file.GetNextLine().ToLong( &traceType ) )
705  return false;
706 
707  name = file.GetNextLine();
708  param = file.GetNextLine();
709 
710  if( name.IsEmpty() || param.IsEmpty() )
711  return false;
712 
713  addPlot( name, (SIM_PLOT_TYPE) traceType, param );
714  }
715  }
716 
717  return true;
718 }
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
size_t i
Definition: json11.cpp:597
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 113 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

114  {
115  m_splitterLeftRight->SetSashPosition( 700 );
116  m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this );
117  }
void m_splitterLeftRightOnIdle(wxIdleEvent &)
wxSplitterWindow * m_splitterLeftRight
void SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 119 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

120  {
121  m_splitterPlotAndConsole->SetSashPosition( 500 );
122  m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
123  }
void m_splitterPlotAndConsoleOnIdle(wxIdleEvent &)
wxSplitterWindow * m_splitterPlotAndConsole
void SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 125 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

126  {
127  m_splitterSignals->SetSashPosition( 0 );
128  m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this );
129  }
wxSplitterWindow * m_splitterSignals
void m_splitterSignalsOnIdle(wxIdleEvent &)
void SIM_PLOT_FRAME_BASE::m_splitterTuneValuesOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 131 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

132  {
133  m_splitterTuneValues->SetSashPosition( 0 );
134  m_splitterTuneValues->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterTuneValuesOnIdle ), NULL, this );
135  }
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 790 of file sim_plot_frame.cpp.

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

791 {
792  SIM_TYPE type = m_exporter->GetSimType();
793 
794  if( SIM_PLOT_PANEL::IsPlottable( type ) )
795  {
796  SIM_PLOT_PANEL* prevPlot = CurrentPlot();
797  SIM_PLOT_PANEL* newPlot = NewPlotPanel( type );
798 
799  // If the previous plot had the same type, copy the simulation command
800  if( prevPlot )
801  m_plots[newPlot].m_simCommand = m_plots[prevPlot].m_simCommand;
802  }
803 }
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 806 of file sim_plot_frame.cpp.

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

807 {
808  wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "",
809  WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
810 
811  if( openDlg.ShowModal() == wxID_CANCEL )
812  return;
813 
814  m_savedWorkbooksPath = openDlg.GetDirectory();
815 
816  if( !loadWorkbook( openDlg.GetPath() ) )
817  DisplayError( this, _( "There was an error while opening the workbook file" ) );
818 }
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:185
void SIM_PLOT_FRAME::menuSaveCsv ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 854 of file sim_plot_frame.cpp.

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

855 {
856  if( !CurrentPlot() )
857  return;
858 
859  const wxChar SEPARATOR = ';';
860 
861  wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "",
862  CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
863 
864  if( saveDlg.ShowModal() == wxID_CANCEL )
865  return;
866 
867  wxFile out( saveDlg.GetPath(), wxFile::write );
868  bool timeWritten = false;
869 
870  for( const auto& t : CurrentPlot()->GetTraces() )
871  {
872  const TRACE* trace = t.second;
873 
874  if( !timeWritten )
875  {
876  out.Write( wxString::Format( "Time%c", SEPARATOR ) );
877 
878  for( double v : trace->GetDataX() )
879  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
880 
881  out.Write( "\r\n" );
882  timeWritten = true;
883  }
884 
885  out.Write( wxString::Format( "%s%c", t.first, SEPARATOR ) );
886 
887  for( double v : trace->GetDataY() )
888  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
889 
890  out.Write( "\r\n" );
891  }
892 
893  out.Close();
894 }
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 839 of file sim_plot_frame.cpp.

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

840 {
841  if( !CurrentPlot() )
842  return;
843 
844  wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "",
845  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
846 
847  if( saveDlg.ShowModal() == wxID_CANCEL )
848  return;
849 
850  CurrentPlot()->SaveScreenshot( saveDlg.GetPath(), wxBITMAP_TYPE_PNG );
851 }
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 821 of file sim_plot_frame.cpp.

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

822 {
823  if( !CurrentPlot() )
824  return;
825 
826  wxFileDialog saveDlg( this, _( "Save Simulation Workbook" ), m_savedWorkbooksPath, "",
827  WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
828 
829  if( saveDlg.ShowModal() == wxID_CANCEL )
830  return;
831 
832  m_savedWorkbooksPath = saveDlg.GetDirectory();
833 
834  if( !saveWorkbook( saveDlg.GetPath() ) )
835  DisplayError( this, _( "There was an error while saving the workbook file" ) );
836 }
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:185
void SIM_PLOT_FRAME::menuShowGrid ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 918 of file sim_plot_frame.cpp.

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

919 {
920  SIM_PLOT_PANEL* plot = CurrentPlot();
921 
922  if( plot )
923  plot->ShowGrid( !plot->IsGridShown() );
924 }
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 927 of file sim_plot_frame.cpp.

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

928 {
929  SIM_PLOT_PANEL* plot = CurrentPlot();
930 
931  event.Check( plot ? plot->IsGridShown() : false );
932 }
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 935 of file sim_plot_frame.cpp.

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

936 {
937  SIM_PLOT_PANEL* plot = CurrentPlot();
938 
939  if( plot )
940  plot->ShowLegend( !plot->IsLegendShown() );
941 }
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 944 of file sim_plot_frame.cpp.

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

945 {
946  SIM_PLOT_PANEL* plot = CurrentPlot();
947  event.Check( plot ? plot->IsLegendShown() : false );
948 }
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 911 of file sim_plot_frame.cpp.

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

912 {
913  if( CurrentPlot() )
914  CurrentPlot()->Fit();
915 }
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 897 of file sim_plot_frame.cpp.

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

898 {
899  if( CurrentPlot() )
900  CurrentPlot()->ZoomIn();
901 }
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 904 of file sim_plot_frame.cpp.

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

905 {
906  if( CurrentPlot() )
907  CurrentPlot()->ZoomOut();
908 }
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 321 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().

322 {
323  SIM_PLOT_PANEL* plotPanel = new SIM_PLOT_PANEL( aSimType, m_plotNotebook, wxID_ANY );
324 
325  if( m_welcomePanel )
326  {
327  m_plotNotebook->DeletePage( 0 );
328  m_welcomePanel = nullptr;
329  }
330 
331  m_plotNotebook->AddPage( plotPanel, wxString::Format( wxT( "Plot%u" ),
332  (unsigned int) m_plotNotebook->GetPageCount() + 1 ), true );
333 
334  m_plots[plotPanel] = PLOT_INFO();
335 
336  return plotPanel;
337 }
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 1050 of file sim_plot_frame.cpp.

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

Referenced by SIM_PLOT_FRAME().

1051 {
1052  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1053 
1054  if( !plotPanel || !m_exporter || plotPanel->GetType() != m_exporter->GetSimType() )
1055  {
1056  DisplayInfoMessage( this, _( "You need to run simulation first." ) );
1057  return;
1058  }
1059 
1060  DIALOG_SIGNAL_LIST dialog( this, m_exporter.get() );
1061  dialog.ShowModal();
1062 }
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:216
void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 244 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().

245 {
246  if( !doAutoSave() )
247  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
248 }
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 1135 of file sim_plot_frame.cpp.

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

Referenced by onShowNetlist(), and SIM_PLOT_FRAME().

1136 {
1137  SaveSettings( config() );
1138 
1139  if( IsSimulationRunning() )
1140  m_simulator->Stop();
1141 
1142  Destroy();
1143 }
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
std::shared_ptr< SPICE_SIMULATOR > m_simulator
bool IsSimulationRunning()
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
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 1146 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().

1147 {
1148  wxSize size = m_cursors->GetClientSize();
1149  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1150  m_cursors->ClearAll();
1151 
1152  if( !plotPanel )
1153  return;
1154 
1156  m_cursors->SetImageList(m_signalsIconColorList, wxIMAGE_LIST_SMALL);
1157 
1158  // Fill the signals listctrl
1159  m_cursors->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x / 2 );
1160  const long X_COL = m_cursors->AppendColumn( plotPanel->GetLabelX(), wxLIST_FORMAT_LEFT, size.x / 4 );
1161 
1162  wxString labelY1 = plotPanel->GetLabelY1();
1163  wxString labelY2 = plotPanel->GetLabelY2();
1164  wxString labelY;
1165 
1166  if( !labelY2.IsEmpty() )
1167  labelY = labelY1 + " / " + labelY2;
1168  else
1169  labelY = labelY1;
1170 
1171  const long Y_COL = m_cursors->AppendColumn( labelY, wxLIST_FORMAT_LEFT, size.x / 4 );
1172 
1173  // Update cursor values
1174  int itemidx = 0;
1175  for( const auto& trace : plotPanel->GetTraces() )
1176  {
1177  if( CURSOR* cursor = trace.second->GetCursor() )
1178  {
1179  // Find the right icon color in list.
1180  // It is the icon used in m_signals list for the same trace
1181  long iconColor = m_signals->FindItem( -1, trace.first );
1182 
1183  const wxRealPoint coords = cursor->GetCoords();
1184  long idx = m_cursors->InsertItem( itemidx++, trace.first, iconColor );
1185  m_cursors->SetItem( idx, X_COL, SPICE_VALUE( coords.x ).ToSpiceString() );
1186  m_cursors->SetItem( idx, Y_COL, SPICE_VALUE( coords.y ).ToSpiceString() );
1187  }
1188  }
1189 }
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 969 of file sim_plot_frame.cpp.

References updateCursors(), and updateSignalList().

970 {
972  updateCursors();
973 }
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 951 of file sim_plot_frame.cpp.

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

952 {
953  int idx = event.GetSelection();
954 
955  if( idx == wxNOT_FOUND )
956  return;
957 
958  SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( m_plotNotebook->GetPage( idx ) );
959 
960  if( !plotPanel )
961  return;
962 
963  m_plots.erase( plotPanel );
965  updateCursors();
966 }
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 1065 of file sim_plot_frame.cpp.

References ID_SIM_PROBE, and m_schematicFrame.

Referenced by SIM_PLOT_FRAME().

1066 {
1067  if( m_schematicFrame == NULL )
1068  return;
1069 
1070  wxQueueEvent( m_schematicFrame, new wxCommandEvent( wxEVT_TOOL, ID_SIM_PROBE ) );
1071  m_schematicFrame->Raise();
1072 }
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 517 of file eda_base_frame.cpp.

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

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

518 {
519  // Ask for the current editor and instruct GetEditorName() to not show
520  // unless we pass false as argument.
521  wxString editorname = Pgm().GetEditorName( false );
522 
523  // Ask the user to select a new editor, but suggest the current one as the default.
524  editorname = Pgm().AskUserForPreferredEditor( editorname );
525 
526  // If we have a new editor name request it to be copied to m_editor_name and saved
527  // to the preferences file. If the user cancelled the dialog then the previous
528  // value will be retained.
529  if( !editorname.IsEmpty() )
530  Pgm().SetEditorName( editorname );
531 }
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 1013 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().

1014 {
1015  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1016 
1017  // Initial processing is required to e.g. display a list of power sources
1019 
1020  if( !m_exporter->ProcessNetlist( NET_ALL_FLAGS ) )
1021  {
1022  DisplayError( this, _( "There were errors during netlist export, aborted." ) );
1023  return;
1024  }
1025 
1026  if( !m_settingsDlg )
1027  m_settingsDlg = new DIALOG_SIM_SETTINGS( this );
1028 
1029  if( plotPanel )
1030  m_settingsDlg->SetSimCommand( m_plots[plotPanel].m_simCommand );
1031 
1033 
1034  if( m_settingsDlg->ShowModal() == wxID_OK )
1035  {
1036  wxString newCommand = m_settingsDlg->GetSimCommand();
1037  SIM_TYPE newSimType = NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( newCommand );
1038 
1039  // If it is a new simulation type, open a new plot
1040  if( !plotPanel || ( plotPanel && plotPanel->GetType() != newSimType ) )
1041  {
1042  plotPanel = NewPlotPanel( newSimType );
1043  }
1044 
1045  m_plots[plotPanel].m_simCommand = newCommand;
1046  }
1047 }
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:185
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::onShowNetlist ( wxCommandEvent &  event)
private

Definition at line 1084 of file sim_plot_frame.cpp.

References m_schematicFrame, m_simulator, and onClose().

Referenced by SIM_PLOT_FRAME().

1085 {
1086  class NETLIST_VIEW_DIALOG : public wxDialog
1087  {
1088  public:
1089  enum
1090  {
1091  MARGIN_LINE_NUMBERS
1092  };
1093 
1094  void onClose( wxCloseEvent& evt )
1095  {
1096  EndModal( GetReturnCode() );
1097  }
1098 
1099  NETLIST_VIEW_DIALOG(wxWindow* parent, wxString source) :
1100  wxDialog(parent, wxID_ANY, "SPICE Netlist",
1101  wxDefaultPosition, wxSize(1500,900),
1102  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
1103  {
1104  wxStyledTextCtrl* text = new wxStyledTextCtrl( this, wxID_ANY );
1105 
1106  text->SetMarginWidth( MARGIN_LINE_NUMBERS, 50 );
1107  text->StyleSetForeground( wxSTC_STYLE_LINENUMBER, wxColour( 75, 75, 75 ) );
1108  text->StyleSetBackground( wxSTC_STYLE_LINENUMBER, wxColour( 220, 220, 220 ) );
1109  text->SetMarginType( MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER );
1110 
1111  text->SetWrapMode( wxSTC_WRAP_WORD );
1112 
1113  text->SetText( source );
1114 
1115  text->StyleClearAll();
1116  text->SetLexer( wxSTC_LEX_SPICE );
1117 
1118  wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
1119  sizer->Add( text, 1, wxEXPAND );
1120  SetSizer( sizer );
1121 
1122  Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ), NULL,
1123  this );
1124  }
1125  };
1126 
1127  if( m_schematicFrame == NULL || m_simulator == NULL )
1128  return;
1129 
1130  NETLIST_VIEW_DIALOG dlg( this, m_simulator->GetNetlist() );
1131  dlg.ShowModal();
1132 }
std::shared_ptr< SPICE_SIMULATOR > m_simulator
SCH_EDIT_FRAME * m_schematicFrame
void onClose(wxCloseEvent &aEvent)
void SIM_PLOT_FRAME::onSignalDblClick ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 976 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_signals, and removePlot().

977 {
978  // Remove signal from the plot panel when double clicked
979  long idx = m_signals->GetFocusedItem();
980 
981  if( idx != wxNOT_FOUND )
982  removePlot( m_signals->GetItemText( idx, 0 ) );
983 }
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 986 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_signals.

987 {
988  int idx = event.GetIndex();
989 
990  if( idx != wxNOT_FOUND )
991  m_signals->Select( idx );
992 
993  idx = m_signals->GetFirstSelected();
994 
995  if( idx != wxNOT_FOUND )
996  {
997  const wxString& netName = m_signals->GetItemText( idx, 0 );
998  SIGNAL_CONTEXT_MENU ctxMenu( netName, this );
999  m_signals->PopupMenu( &ctxMenu );
1000  }
1001 }
void SIM_PLOT_FRAME::onSimFinished ( wxCommandEvent &  aEvent)
private
Todo:
do not make it hardcoded for ngspice

Definition at line 1199 of file sim_plot_frame.cpp.

References 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().

1200 {
1201  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_run_xpm ) );
1202  SetCursor( wxCURSOR_ARROW );
1203 
1204  SIM_TYPE simType = m_exporter->GetSimType();
1205 
1206  if( simType == ST_UNKNOWN )
1207  return;
1208 
1209  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1210 
1211  if( !plotPanel || plotPanel->GetType() != simType )
1212  plotPanel = NewPlotPanel( simType );
1213 
1214  if( IsSimulationRunning() )
1215  return;
1216 
1217  // If there are any signals plotted, update them
1218  if( SIM_PLOT_PANEL::IsPlottable( simType ) )
1219  {
1220  TRACE_MAP& traceMap = m_plots[plotPanel].m_traces;
1221 
1222  for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */)
1223  {
1224  if( !updatePlot( it->second, plotPanel ) )
1225  {
1226  removePlot( it->first, false );
1227  it = traceMap.erase( it ); // remove a plot that does not exist anymore
1228  }
1229  else
1230  {
1231  ++it;
1232  }
1233  }
1234 
1235  updateSignalList();
1236  plotPanel->UpdateAll();
1237  plotPanel->ResetScales();
1238  }
1239  else
1240  {
1242  for( const auto& net : m_exporter->GetNetIndexMap() )
1243  {
1244  int node = net.second;
1245 
1246  if( node > 0 )
1247  m_simulator->Command( wxString::Format( "print v(%d)", node ).ToStdString() );
1248  }
1249  }
1250 }
static bool IsPlottable(SIM_TYPE aSimType)
std::shared_ptr< SPICE_SIMULATOR > m_simulator
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
void ResetScales()
Resets scale ranges to fit the current traces
bool IsSimulationRunning()
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 1275 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_simConsole.

Referenced by SIM_PLOT_FRAME().

1276 {
1277  m_simConsole->AppendText( aEvent.GetString() + "\n" );
1278  m_simConsole->SetInsertionPointEnd();
1279 }
void SIM_PLOT_FRAME::onSimStarted ( wxCommandEvent &  aEvent)
private

Definition at line 1192 of file sim_plot_frame.cpp.

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

Referenced by SIM_PLOT_FRAME().

1193 {
1194  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_stop_xpm ) );
1195  SetCursor( wxCURSOR_ARROWWAIT );
1196 }
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 1004 of file sim_plot_frame.cpp.

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

Referenced by SIM_PLOT_FRAME().

1005 {
1006  if( IsSimulationRunning() )
1007  StopSimulation();
1008  else
1009  StartSimulation();
1010 }
bool IsSimulationRunning()
void SIM_PLOT_FRAME::onSimUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 1253 of file sim_plot_frame.cpp.

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

Referenced by SIM_PLOT_FRAME().

1254 {
1255  if( IsSimulationRunning() )
1256  StopSimulation();
1257 
1258  if( CurrentPlot() != m_lastSimPlot )
1259  {
1260  // We need to rerun simulation, as the simulator currently stores
1261  // results for another plot
1262  StartSimulation();
1263  }
1264  else
1265  {
1266  // Incremental update
1267  m_simConsole->Clear();
1268  // Do not export netlist, it is already stored in the simulator
1269  applyTuners();
1270  m_simulator->Run();
1271  }
1272 }
void applyTuners()
Applies component values specified using tunder sliders to the current netlist.
std::shared_ptr< SPICE_SIMULATOR > m_simulator
SIM_PLOT_PANEL * m_lastSimPlot
Panel that was used as the most recent one for simulations
bool IsSimulationRunning()
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 1075 of file sim_plot_frame.cpp.

References ID_SIM_TUNE, and m_schematicFrame.

Referenced by SIM_PLOT_FRAME().

1076 {
1077  if( m_schematicFrame == NULL )
1078  return;
1079 
1080  wxQueueEvent( m_schematicFrame, new wxCommandEvent( wxEVT_TOOL, ID_SIM_TUNE ) );
1081  m_schematicFrame->Raise();
1082 }
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.

References VTBL_ENTRY.

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 667 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().

668 {
669  if( evt_type != 0 )
670  {
671  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
672  evt.SetEventObject( this );
673  evt.SetId( evt_type );
674  wxPostEvent( this, evt );
675  return true;
676  }
677 
678  return false;
679 }
void EDA_BASE_FRAME::PrintMsg ( const wxString &  text)
inherited

Definition at line 402 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::IsType().

403 {
404  SetStatusText( text );
405 }
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(), PCB_EDIT_FRAME::importFile(), SCH_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(), DIALOG_CHOOSE_COMPONENT::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), 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(), 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(), 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(), 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 186 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::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(), GERBVIEW_CONTROL::SwitchUnits(), and PCBNEW_CONTROL::SwitchUnits().

187 {
188 #ifdef __WXMAC__
189  // Apple in its infinite wisdom will raise a disabled window before even passing
190  // us the event, so we have no way to stop it. Instead, we have to catch an
191  // improperly ordered disabled window and quasi-modal dialog here and reorder
192  // them.
193  if( !IsEnabled() && IsActive() )
194  {
195  wxWindow* dlg = findQuasiModalDialog();
196  if( dlg )
197  dlg->Raise();
198  }
199 #endif
200 
201  if( !wxFrame::ProcessEvent( aEvent ) )
202  return false;
203 
204  if( IsShown() && m_hasAutoSave && IsActive() &&
206  {
207  if( !m_autoSaveState )
208  {
209  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
210  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
211  m_autoSaveState = true;
212  }
213  else if( m_autoSaveTimer->IsRunning() )
214  {
215  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
216  m_autoSaveTimer->Stop();
217  m_autoSaveState = false;
218  }
219  }
220 
221  return true;
222 }
bool m_autoSaveState
Flag to indicate the last auto save state.
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
wxWindow * findQuasiModalDialog()
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.
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 450 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().

451 {
452  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
453 
454  if( !plotPanel )
455  return;
456 
457  if( aErase )
458  {
459  auto& traceMap = m_plots[plotPanel].m_traces;
460  auto traceIt = traceMap.find( aPlotName );
461  wxASSERT( traceIt != traceMap.end() );
462  traceMap.erase( traceIt );
463  }
464 
465  wxASSERT( plotPanel->TraceShown( aPlotName ) );
466  plotPanel->DeleteTrace( aPlotName );
467  plotPanel->Fit();
468 
470  updateCursors();
471 }
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 391 of file sim_plot_frame.cpp.

References SIM_PLOT_FRAME_BASE::m_tunePanel, and m_tuners.

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

392 {
393  if( aErase )
394  m_tuners.remove( aTuner );
395 
396  aTuner->Destroy();
397  m_tunePanel->Layout();
398 }
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 274 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().

274 {};
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 233 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().

234 {
235  // Save main frame size and position:
237 
238  // Save subwindows sizes
239  aCfg->Write( PLOT_PANEL_WIDTH_ENTRY, m_splitterLeftRight->GetSashPosition() );
240  aCfg->Write( PLOT_PANEL_HEIGHT_ENTRY, m_splitterPlotAndConsole->GetSashPosition() );
241  aCfg->Write( SIGNALS_PANEL_HEIGHT_ENTRY, m_splitterSignals->GetSashPosition() );
242  aCfg->Write( CURSORS_PANEL_HEIGHT_ENTRY, m_splitterTuneValues->GetSashPosition() );
243 }
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 721 of file sim_plot_frame.cpp.

References Format(), m_plots, and trace.

Referenced by menuSaveWorkbook().

722 {
723 
724  wxString savePath = aPath;
725 
726  if( !savePath.Lower().EndsWith(".wbk"))
727  {
728  savePath += ".wbk";
729  };
730 
731 
732  wxTextFile file( savePath );
733 
734  if( file.Exists() )
735  {
736  if( !file.Open() )
737  return false;
738 
739  file.Clear();
740  }
741  else
742  {
743  file.Create();
744  }
745 
746  file.AddLine( wxString::Format( "%lu", m_plots.size() ) );
747 
748  for( const auto& plot : m_plots )
749  {
750  file.AddLine( wxString::Format( "%d", plot.first->GetType() ) );
751  file.AddLine( plot.second.m_simCommand );
752  file.AddLine( wxString::Format( "%lu", plot.second.m_traces.size() ) );
753 
754  for( const auto& trace : plot.second.m_traces )
755  {
756  file.AddLine( wxString::Format( "%d", trace.second.GetType() ) );
757  file.AddLine( trace.second.GetName() );
758  file.AddLine( trace.second.GetParam() );
759  }
760  }
761 
762  bool res = file.Write();
763  file.Close();
764 
765  return res;
766 }
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 225 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().

226 {
227  m_autoSaveInterval = aInterval;
228 
229  if( m_autoSaveTimer->IsRunning() )
230  {
231  if( m_autoSaveInterval > 0 )
232  {
233  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
234  }
235  else
236  {
237  m_autoSaveTimer->Stop();
238  m_autoSaveState = false;
239  }
240  }
241 }
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 460 of file eda_base_frame.h.

460 {}
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 218 of file kiway_player.h.

Referenced by LIB_VIEW_FRAME::LIB_VIEW_FRAME().

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

Definition at line 361 of file eda_base_frame.h.

Referenced by KICAD_MANAGER_FRAME::LoadProject().

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

Definition at line 260 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().

261 {
264 
267 
270 
273 }
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 269 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::ReCreateMenuBar().

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

270 {
271  ReCreateMenuBar();
272  GetMenuBar()->Refresh();
273 }
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, GERBVIEW_FRAME, PCB_BASE_FRAME, and CVPCB_MAINFRAME.

Definition at line 262 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::ReCreateMenuBar().

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

263 {
264  ReCreateMenuBar();
265  GetMenuBar()->Refresh();
266 }
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(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), FOOTPRINT_VIEWER_FRAME::ShowModal(), 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 another 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:251
#define WX_EVENT_LOOP
Definition: kiway_player.h:91
wxWindow * m_modal_resultant_parent
Definition: kiway_player.h:249
wxString m_modal_string
Definition: kiway_player.h:250
bool IsModal()
Definition: kiway_player.h:217
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:248
void SIM_PLOT_FRAME::StartSimulation ( )

Definition at line 276 of file sim_plot_frame.cpp.

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

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

277 {
278  STRING_FORMATTER formatter;
279  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
280 
281  if( !m_settingsDlg )
282  m_settingsDlg = new DIALOG_SIM_SETTINGS( this );
283 
284  m_simConsole->Clear();
286 
287  if( plotPanel )
288  m_exporter->SetSimCommand( m_plots[plotPanel].m_simCommand );
289 
290  if( !m_exporter->Format( &formatter, m_settingsDlg->GetNetlistOptions() ) )
291  {
292  DisplayError( this, _( "There were errors during netlist export, aborted." ) );
293  return;
294  }
295 
296  if( m_exporter->GetSimType() == ST_UNKNOWN )
297  {
298  DisplayInfoMessage( this, _( "You need to select the simulation settings first." ) );
299  return;
300  }
301 
302  m_simulator->LoadNetlist( formatter.GetString() );
303  updateTuners();
304  applyTuners();
305  m_simulator->Run();
306 }
void applyTuners()
Applies component values specified using tunder sliders to the current netlist.
std::shared_ptr< SPICE_SIMULATOR > m_simulator
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
DIALOG_SIM_SETTINGS * m_settingsDlg
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:216
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:185
void updateTuners()
Filters out tuners for components that do not exist anymore.
void SIM_PLOT_FRAME::StopSimulation ( )

Definition at line 309 of file sim_plot_frame.cpp.

References m_simulator.

Referenced by onSimulate(), and onSimUpdate().

310 {
311  m_simulator->Stop();
312 }
std::shared_ptr< SPICE_SIMULATOR > m_simulator
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 390 of file eda_base_frame.cpp.

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

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

391 {
392  return Kiface().KifaceSearch();
393 }
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 618 of file sim_plot_frame.cpp.

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

619 {
620  wxQueueEvent( this, new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
621 }
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 408 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().

410 {
411  wxFileHistory* fileHistory = aFileHistory;
412 
413  if( !fileHistory )
414  fileHistory = &Kiface().GetFileHistory();
415 
416  fileHistory->AddFileToHistory( FullFileName );
417 }
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 474 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().

475 {
477 }
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 480 of file sim_plot_frame.cpp.

References SIM_PLOT_PANEL::AddTrace(), Format(), TRACE_DESC::GetName(), TRACE_DESC::GetParam(), TRACE_DESC::GetTitle(), TRACE_DESC::GetType(), 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().

481 {
482  SIM_TYPE simType = m_exporter->GetSimType();
483  wxString spiceVector = m_exporter->GetSpiceVector( aDescriptor.GetName(),
484  aDescriptor.GetType(), aDescriptor.GetParam() );
485 
486  if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
487  {
488  // There is no plot to be shown
489  m_simulator->Command( wxString::Format( "print %s", spiceVector ).ToStdString() );
490 
491  return false;
492  }
493 
494  // First, handle the x axis
495  wxString xAxisName( m_simulator->GetXAxis( simType ) );
496 
497  if( xAxisName.IsEmpty() )
498  return false;
499 
500  auto data_x = m_simulator->GetMagPlot( (const char*) xAxisName.c_str() );
501  unsigned int size = data_x.size();
502 
503  if( data_x.empty() )
504  return false;
505 
506  SIM_PLOT_TYPE plotType = aDescriptor.GetType();
507  std::vector<double> data_y;
508 
509  // Now, Y axis data
510  switch( m_exporter->GetSimType() )
511  {
512  case ST_AC:
513  {
514  wxASSERT_MSG( !( ( plotType & SPT_AC_MAG ) && ( plotType & SPT_AC_PHASE ) ),
515  "Cannot set both AC_PHASE and AC_MAG bits" );
516 
517  if( plotType & SPT_AC_MAG )
518  data_y = m_simulator->GetMagPlot( (const char*) spiceVector.c_str() );
519  else if( plotType & SPT_AC_PHASE )
520  data_y = m_simulator->GetPhasePlot( (const char*) spiceVector.c_str() );
521  else
522  wxASSERT_MSG( false, "Plot type missing AC_PHASE or AC_MAG bit" );
523  }
524  break;
525 
526  case ST_NOISE:
527  case ST_DC:
528  case ST_TRANSIENT:
529  {
530  data_y = m_simulator->GetMagPlot( (const char*) spiceVector.c_str() );
531  }
532  break;
533 
534  default:
535  wxASSERT_MSG( false, "Unhandled plot type" );
536  return false;
537  }
538 
539  if( data_y.size() != size )
540  return false;
541 
542  if( aPanel->AddTrace( aDescriptor.GetTitle(), size,
543  data_x.data(), data_y.data(), aDescriptor.GetType() ) )
544  {
545  m_plots[aPanel].m_traces.insert( std::make_pair( aDescriptor.GetTitle(), aDescriptor ) );
546  }
547 
548  return true;
549 }
const wxString & GetName() const
static bool IsPlottable(SIM_TYPE aSimType)
SIM_PLOT_TYPE GetType() const
const wxString & GetParam() const
std::shared_ptr< SPICE_SIMULATOR > m_simulator
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 AddTrace(const wxString &aName, int aPoints, const double *aX, const double *aY, SIM_PLOT_TYPE aFlags)
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
void SIM_PLOT_FRAME::updateSignalList ( )
private

Updates the list of currently plotted signals.

Definition at line 552 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().

553 {
554  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
555 
556  if( !plotPanel )
557  return;
558 
559  m_signals->ClearAll();
560 
561  wxSize size = m_signals->GetClientSize();
562  m_signals->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x );
563 
564  // Build an image list, to show the color of the corresponding trace
565  // in the plot panel
566  // This image list is used for trace and cursor lists
567  wxMemoryDC bmDC;
568  const int isize = bmDC.GetCharHeight();
569 
570  if( m_signalsIconColorList == NULL )
571  m_signalsIconColorList = new wxImageList( isize, isize, false );
572  else
573  m_signalsIconColorList->RemoveAll();
574 
575  for( const auto& trace : CurrentPlot()->GetTraces() )
576  {
577  wxBitmap bitmap( isize, isize );
578  bmDC.SelectObject( bitmap );
579  wxColour tcolor = trace.second->GetTraceColour();
580 
581  wxColour bgColor = m_signals->wxWindow::GetBackgroundColour();
582  bmDC.SetPen( wxPen( bgColor ) );
583  bmDC.SetBrush( wxBrush( bgColor ) );
584  bmDC.DrawRectangle( 0, 0, isize, isize ); // because bmDC.Clear() does not work in wxGTK
585 
586  bmDC.SetPen( wxPen( tcolor ) );
587  bmDC.SetBrush( wxBrush( tcolor ) );
588  bmDC.DrawRectangle( 0, isize / 4 + 1, isize, isize / 2 );
589 
590  bmDC.SelectObject( wxNullBitmap ); // Needed to initialize bitmap
591 
592  bitmap.SetMask( new wxMask( bitmap, *wxBLACK ) );
593  m_signalsIconColorList->Add( bitmap );
594  }
595 
596  if( bmDC.IsOk() )
597  {
598  bmDC.SetBrush( wxNullBrush );
599  bmDC.SetPen( wxNullPen );
600  }
601 
602  m_signals->SetImageList( m_signalsIconColorList, wxIMAGE_LIST_SMALL );
603 
604  // Fill the signals listctrl. Keep the order of names and
605  // the order of icon color identical, because the icons
606  // are also used in cursor list, and the color index is
607  // calculated from the trace name index
608  int imgidx = 0;
609 
610  for( const auto& trace : m_plots[plotPanel].m_traces )
611  {
612  m_signals->InsertItem( imgidx, trace.first, imgidx );
613  imgidx++;
614  }
615 }
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 624 of file sim_plot_frame.cpp.

References m_exporter, m_tuners, and RemoveTuner().

Referenced by StartSimulation().

625 {
626  const auto& spiceItems = m_exporter->GetSpiceItems();
627 
628  for( auto it = m_tuners.begin(); it != m_tuners.end(); /* iteration inside the loop */ )
629  {
630  const wxString& ref = (*it)->GetComponentName();
631 
632  if( std::find_if( spiceItems.begin(), spiceItems.end(), [&]( const SPICE_ITEM& item )
633  {
634  return item.m_refName == ref;
635  }) == spiceItems.end() )
636  {
637  // The component does not exist anymore, remove the associated tuner
638  TUNER_SLIDER* tuner = *it;
639  it = m_tuners.erase( it );
640  RemoveTuner( tuner, false );
641  }
642  else
643  {
644  ++it;
645  }
646  }
647 }
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:206
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 141 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 136 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 50 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 146 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 132 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME(), and EDA_BASE_FRAME::findQuasiModalDialog().

SIM_PLOT_PANEL* SIM_PLOT_FRAME::m_lastSimPlot
private

Panel that was used as the most recent one for simulations

Definition at line 336 of file sim_plot_frame.h.

Referenced by onSimUpdate().

wxMenuBar* SIM_PLOT_FRAME_BASE::m_mainMenu
protectedinherited

Definition at line 49 of file sim_plot_frame_base.h.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

wxAuiToolBar* EDA_BASE_FRAME::m_mainToolBar
protectedinherited

Standard horizontal Toolbar.

Definition at line 139 of file eda_base_frame.h.

Referenced by PCB_EDIT_FRAME::createPopUpMenuForFpPads(), EDA_BASE_FRAME::EDA_BASE_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDA_DRAW_FRAME::GetToolbarTool(), EDA_DRAW_FRAME::GetToolToggled(), KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME(), LIB_EDIT_FRAME::LIB_EDIT_FRAME(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnUpdateDeMorganConvert(), LIB_EDIT_FRAME::OnUpdateDeMorganNormal(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool(), LIB_EDIT_FRAME::OnUpdateSelectTool(), SCH_EDIT_FRAME::OnUpdateSelectTool(), PCB_EDIT_FRAME::OnUpdateVerticalToolbar(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), PCB_EDIT_FRAME::PrepareLayerIndicator(), LIB_EDIT_FRAME::Process_Special_Functions(), KICAD_MANAGER_FRAME::RecreateBaseHToolbar(), DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_EDIT_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar(), PL_EDITOR_FRAME::ReCreateHToolbar(), FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar(), GERBVIEW_FRAME::ReCreateHToolbar(), SCH_EDIT_FRAME::ReCreateHToolbar(), LIB_EDIT_FRAME::ReCreateHToolbar(), PCB_EDIT_FRAME::ReCreateHToolbar(), PCB_EDIT_FRAME::ReCreateLayerBox(), EDA_3D_VIEWER::ReCreateMainToolbar(), GERBVIEW_FRAME::ReCreateOptToolbar(), GERBVIEW_FRAME::ReCreateVToolbar(), SCH_EDIT_FRAME::RedrawActiveWindow(), and EDA_3D_VIEWER::RenderEngineChanged().

bool KIWAY_PLAYER::m_modal
protectedinherited

Definition at line 247 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 249 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 250 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 71 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 81 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 79 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 62 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 77 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 157 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 65 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 290 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 343 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
wxMenuItem* SIM_PLOT_FRAME_BASE::m_settings
protectedinherited
DIALOG_SIM_SETTINGS* SIM_PLOT_FRAME::m_settingsDlg
private

Definition at line 313 of file sim_plot_frame.h.

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

wxMenuItem* SIM_PLOT_FRAME_BASE::m_showNetlist
protectedinherited
wxPanel* SIM_PLOT_FRAME_BASE::m_sidePanel
protectedinherited

Definition at line 74 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 75 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 340 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 51 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 63 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 69 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 72 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 59 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 66 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 346 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 347 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 348 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 349 of file sim_plot_frame.h.

Referenced by LoadSettings(), and setSubWindowsSashSize().

wxStaticText* SIM_PLOT_FRAME_BASE::m_staticText2
protectedinherited

Definition at line 70 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 282 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 283 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxToolBarToolBase* SIM_PLOT_FRAME::m_toolSettings
private

Definition at line 285 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxToolBarToolBase* SIM_PLOT_FRAME::m_toolSimulate
private

Definition at line 281 of file sim_plot_frame.h.

Referenced by SIM_PLOT_FRAME().

wxToolBarToolBase* SIM_PLOT_FRAME::m_toolTune
private

Definition at line 284 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 307 of file sim_plot_frame.h.

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

wxBoxSizer* SIM_PLOT_FRAME_BASE::m_tuneSizer
protectedinherited

Definition at line 85 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 84 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 58 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: