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 Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL, SCREEN }
 

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...
 
const NETLIST_EXPORTER_PSPICE_SIMGetExporter () const
 Returns the netlist exporter object used for simulations. More...
 
bool GetPlotBgOpt () const
 
wxColor GetPlotColor (int aColorId)
 
int GetPlotColorCount ()
 
void LoadSettings (APP_SETTINGS_BASE *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (APP_SETTINGS_BASE *aCfg) override
 Saves common frame parameters to a configuration data file. More...
 
WINDOW_SETTINGSGetWindowSettings (APP_SETTINGS_BASE *aCfg) override
 Returns a pointer to the window settings for this frame. More...
 
void m_splitterLeftRightOnIdle (wxIdleEvent &)
 
void m_splitterPlotAndConsoleOnIdle (wxIdleEvent &)
 
void m_splitterSignalsOnIdle (wxIdleEvent &)
 
void m_splitterTuneValuesOnIdle (wxIdleEvent &)
 
virtual 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...
 
virtual 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 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)
 
EDA_UNITS GetUserUnits () const
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS aUnits)
 
void ChangeUserUnits (EDA_UNITS aUnits)
 
SETTINGS_MANAGERGetSettingsManager () const
 
virtual int GetSeverity (int aErrorCode) const
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void PushTool (const std::string &actionName)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const std::string &actionName)
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
virtual void DisplayToolMsg (const wxString &msg)
 
bool GetDoImmediateActions () const
 Indicates that hotkeys should perform an immediate action even if another tool is currently active. More...
 
bool GetDragSelects () const
 Indicates that a drag should draw a selection rectangle, even when started over an item. More...
 
bool GetMoveWarpsCursor () const
 Indicates that a move operation should warp the mouse pointer to the origin of the move object. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Override the default process event handler to implement the auto save feature. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
void OnMenuOpen (wxMenuEvent &event)
 Workaround some issues in wxWidgets where the menu events aren't captured by the menus themselves. More...
 
virtual void OnMove (wxMoveEvent &aEvent)
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
virtual const SEARCH_STACKsys_search ()
 Return a SEARCH_STACK pertaining to entire program. More...
 
virtual wxString help_name ()
 
void OnKicadAbout (wxCommandEvent &event)
 
void OnPreferences (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
virtual APP_SETTINGS_BASEconfig ()
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual void InstallPreferences (PAGED_DIALOG *, PANEL_HOTKEYS_EDITOR *)
 Function InstallPreferences Allow a frame to load its preference panels (if any) into the preferences dialog. More...
 
void LoadWindowSettings (WINDOW_SETTINGS *aCfg)
 Loads window settings from the given settings object Normally called by LoadSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
void SaveWindowSettings (WINDOW_SETTINGS *aCfg)
 Saves window settings to the given settings object Normally called by SaveSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
wxString ConfigBaseName ()
 
virtual void SaveProjectSettings ()
 Save changes to the project settings to the project (.pro) file. More...
 
void ImportHotkeyConfigFromFile (std::map< std::string, TOOL_ACTION * > aActionMap, const wxString &aDefaultShortname)
 Prompt the user for a hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=NULL)
 Fetches the file name from the file history list. More...
 
void ClearFileHistory (FILE_HISTORY *aFileHistory=NULL)
 Removes all files from the file history. More...
 
void UpdateFileHistory (const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
 Update the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
virtual void ReCreateMenuBar ()
 Recreates the menu bar. More...
 
void AddStandardHelpMenu (wxMenuBar *aMenuBar)
 Adds the standard KiCad help menu to the menubar. More...
 
bool IsWritable (const wxFileName &aFileName)
 Checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName)
 Check if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void UpdateStatusBar ()
 Update the status bar information. More...
 
virtual void SyncToolbars ()
 Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
virtual void ShowChangedLanguage ()
 Redraw the menus and what not in current language. More...
 
virtual void CommonSettingsChanged (bool aEnvVarsChanged)
 Notification event that some of the common (suite-wide) settings have changed. More...
 
virtual void RefreshCanvas ()
 Notification to refresh the drawing canvas (if any). More...
 
const wxString & GetAboutTitle () const
 
void SetShutdownBlockReason (const wxString &reason)
 Sets the block reason why the window/application is preventing OS shutdown. More...
 
void RemoveShutdownBlockReason ()
 Removes any shutdown block reason set. More...
 
bool SupportsShutdownBlockReason ()
 Whether or not the window supports setting a shutdown block reason. More...
 
virtual bool IsContentModified ()
 Get if the contents of the frame have been modified since the last save. More...
 
HOLDER_TYPE GetType ()
 
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

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 onAutoSaveTimer (wxTimerEvent &aEvent)
 Handle the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Return the auto save status of the application. More...
 
virtual bool doAutoSave ()
 This should be overridden by the derived class to handle the auto save feature. More...
 
virtual void unitsChangeRefresh ()
 Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 

Static Protected Member Functions

static wxString GetBackupSuffix ()
 
static wxString GetAutoSaveFilePrefix ()
 

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_staticTextInfo
 
wxPanel * m_panelConsole
 
wxBoxSizer * m_sizerConsole
 
wxTextCtrl * m_simConsole
 
wxPanel * m_sidePanel
 
wxBoxSizer * m_sideSizer
 
wxSplitterWindow * m_splitterSignals
 
wxPanel * m_panelSignals
 
wxStaticText * m_staticTextSignals
 
wxListView * m_signals
 
wxPanel * m_panelCursorsAndTune
 
wxSplitterWindow * m_splitterTuneValues
 
wxPanel * m_panelCursors
 
wxStaticText * m_staticTextCursors
 
wxListCtrl * m_cursors
 
wxPanel * m_tunePanel
 
wxStaticText * m_staticTextTune
 
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
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_AboutTitle
 
wxAuiManager m_auimgr
 
wxString m_configName
 
SETTINGS_MANAGERm_settingsManager
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
bool m_dragSelects
 
bool m_moveWarpsCursor
 
bool m_hasAutoSave
 
bool m_autoSaveState
 
int m_autoSaveInterval
 
wxTimer * m_autoSaveTimer
 
wxString m_perspective
 
wxString m_mruPath
 
EDA_UNITS m_userUnits
 

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 setIconsForMenuItems ()
 Give icons to menuitems of the main menubar. More...
 
void fillDefaultColorList (bool aWhiteBg)
 Fills m_colorList by a default set of colors. 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 menuShowDotted (wxCommandEvent &event) override
 
void menuShowDottedUpdate (wxUpdateUIEvent &event) override
 
void menuWhiteBackground (wxCommandEvent &event) override
 
void menuShowWhiteBackgroundUpdate (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
 
bool m_plotUseWhiteBg
 
std::vector< wxColour > m_colorList
 

The color list to draw traces, bg, fg, axis...

More...
 

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 121 of file sim_plot_frame.h.

Member Typedef Documentation

◆ TRACE_MAP

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

Definition at line 347 of file sim_plot_frame.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 
SCREEN 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ SIM_PLOT_FRAME()

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

Constructor.

Definition at line 120 of file sim_plot_frame.cpp.

121  : SIM_PLOT_FRAME_BASE( aParent ), m_lastSimPlot( nullptr )
122 {
123  SetKiway( this, aKiway );
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  // Gives a minimal size
137  SetSizeHints( 500, 400, -1, -1, -1, -1 );
138 
139  // Get the previous size and position of windows:
140  LoadSettings( config() );
141 
142  // Prepare the color list to plot traces
144 
145  // Give icons to menuitems
147 
149 
150  if( !m_simulator )
151  {
152  throw std::runtime_error( "Could not create simulator instance" );
153  return;
154  }
155 
156  m_simulator->Init();
157 
158  if( m_savedWorkbooksPath.IsEmpty() )
159  {
161  }
162 
163  m_reporter = new SIM_THREAD_REPORTER( this );
164  m_simulator->SetReporter( m_reporter );
165 
167 
168  Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SIM_PLOT_FRAME::onClose ), NULL, this );
169  Connect( EVT_SIM_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onSimUpdate ), NULL, this );
170  Connect( EVT_SIM_REPORT, wxCommandEventHandler( SIM_PLOT_FRAME::onSimReport ), NULL, this );
171  Connect( EVT_SIM_STARTED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimStarted ), NULL, this );
172  Connect( EVT_SIM_FINISHED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimFinished ), NULL, this );
173  Connect( EVT_SIM_CURSOR_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onCursorUpdate ), NULL, this );
174 
175  // Toolbar buttons
176  m_toolSimulate = m_toolBar->AddTool( ID_SIM_RUN, _( "Run/Stop Simulation" ),
177  KiBitmap( sim_run_xpm ), _( "Run Simulation" ), wxITEM_NORMAL );
178  m_toolAddSignals = m_toolBar->AddTool( ID_SIM_ADD_SIGNALS, _( "Add Signals" ),
179  KiBitmap( sim_add_signal_xpm ), _( "Add signals to plot" ), wxITEM_NORMAL );
180  m_toolProbe = m_toolBar->AddTool( ID_SIM_PROBE, _( "Probe" ),
181  KiBitmap( sim_probe_xpm ), _( "Probe signals on the schematic" ), wxITEM_NORMAL );
182  m_toolTune = m_toolBar->AddTool( ID_SIM_TUNE, _( "Tune" ),
183  KiBitmap( sim_tune_xpm ), _( "Tune component values" ), wxITEM_NORMAL );
184  m_toolSettings = m_toolBar->AddTool( wxID_ANY, _( "Settings" ),
185  KiBitmap( sim_settings_xpm ), _( "Simulation settings" ), wxITEM_NORMAL );
186 
187  Connect( m_toolSimulate->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
188  wxCommandEventHandler( SIM_PLOT_FRAME::onSimulate ), NULL, this );
189  Connect( m_toolAddSignals->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
190  wxCommandEventHandler( SIM_PLOT_FRAME::onAddSignal ), NULL, this );
191  Connect( m_toolProbe->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
192  wxCommandEventHandler( SIM_PLOT_FRAME::onProbe ), NULL, this );
193  Connect( m_toolTune->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
194  wxCommandEventHandler( SIM_PLOT_FRAME::onTune ), NULL, this );
195  Connect( m_toolSettings->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
196  wxCommandEventHandler( SIM_PLOT_FRAME::onSettings ), NULL, this );
197 
198  // Bind toolbar buttons event to existing menu event handlers, so they behave the same
199  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSimulate, this, m_runSimulation->GetId() );
200  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onAddSignal, this, m_addSignals->GetId() );
201  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onProbe, this, m_probeSignals->GetId() );
202  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onTune, this, m_tuneValue->GetId() );
203  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onShowNetlist, this, m_showNetlist->GetId() );
204  Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSettings, this, m_settings->GetId() );
205 
206  m_toolBar->Realize();
207  m_plotNotebook->SetPageText( 0, _( "Welcome!" ) );
208 
209  // the settings dialog will be created later, on demand.
210  // if created in the ctor, for some obscure reason, there is an issue
211  // on Windows: when open it, the simulator frame is sent to the background.
212  // instead of being behind the dialog frame (as it does)
214 
215  // resize the subwindows size. At least on Windows, calling wxSafeYield before
216  // resizing the subwindows forces the wxSplitWindows size events automatically generated
217  // by wxWidgets to be executed before our resize code.
218  // Otherwise, the changes made by setSubWindowsSashSize are overwritten by one these
219  // events
220  wxSafeYield();
222 }
const BITMAP_OPAQUE simulator_xpm[1]
Definition: simulator.cpp:52
void onAddSignal(wxCommandEvent &event)
void SetKiway(wxWindow *aDest, KIWAY *aKiway)
Function SetKiway.
wxToolBarToolBase * m_toolProbe
void setIconsForMenuItems()
Give icons to menuitems of the main menubar.
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_holder.h:56
bool GetPlotBgOpt() const
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
Schematic editor (Eeschema) main window.
void onSimUpdate(wxCommandEvent &aEvent)
SIM_THREAD_REPORTER * m_reporter
std::shared_ptr< SPICE_SIMULATOR > m_simulator
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
wxAuiNotebook * m_plotNotebook
SCH_EDIT_FRAME * m_schematicFrame
void setSubWindowsSashSize()
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
const BITMAP_OPAQUE sim_add_signal_xpm[1]
SIM_PLOT_PANEL * m_lastSimPlot
Panel that was used as the most recent one for simulations
#define NULL
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:341
wxMenuItem * m_runSimulation
void onSimReport(wxCommandEvent &aEvent)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void onSimFinished(wxCommandEvent &aEvent)
void fillDefaultColorList(bool aWhiteBg)
Fills m_colorList by a default set of colors.
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
const BITMAP_OPAQUE sim_probe_xpm[1]
Definition: sim_probe.cpp:52
void updateNetlistExporter()
Reloads the current schematic for the netlist exporter.
void onSimulate(wxCommandEvent &event)
const BITMAP_OPAQUE sim_tune_xpm[1]
Definition: sim_tune.cpp:39
void onProbe(wxCommandEvent &event)
#define _(s)
Definition: 3d_actions.cpp:33
SIM_PLOT_FRAME_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Spice Simulator"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(564, 531), long style=wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString &name=wxT("SIM_PLOT_FRAME"))
const BITMAP_OPAQUE sim_run_xpm[1]
Definition: sim_run.cpp:35
const BITMAP_OPAQUE sim_settings_xpm[1]
virtual APP_SETTINGS_BASE * config()
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void onSettings(wxCommandEvent &event)
void onClose(wxCloseEvent &aEvent)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
wxToolBarToolBase * m_toolTune
wxToolBarToolBase * m_toolSettings

References _, EDA_BASE_FRAME::config(), SPICE_SIMULATOR::CreateInstance(), fillDefaultColorList(), FRAME_SCH, GetPlotBgOpt(), 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, NULL, onAddSignal(), onClose(), onCursorUpdate(), onProbe(), onSettings(), onShowNetlist(), onSimFinished(), onSimReport(), onSimStarted(), onSimulate(), onSimUpdate(), onTune(), KIWAY::Player(), KIWAY_HOLDER::Prj(), setIconsForMenuItems(), KIWAY_HOLDER::SetKiway(), setSubWindowsSashSize(), sim_add_signal_xpm, sim_probe_xpm, sim_run_xpm, sim_settings_xpm, sim_tune_xpm, simulator_xpm, and updateNetlistExporter().

◆ ~SIM_PLOT_FRAME()

SIM_PLOT_FRAME::~SIM_PLOT_FRAME ( )

Definition at line 225 of file sim_plot_frame.cpp.

226 {
227  m_simulator->SetReporter( nullptr );
228  delete m_reporter;
229  delete m_signalsIconColorList;
230 
231  if( m_settingsDlg )
232  m_settingsDlg->Destroy();
233 }
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

References m_reporter, m_settingsDlg, m_signalsIconColorList, and m_simulator.

Member Function Documentation

◆ AddCurrentPlot()

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 488 of file sim_plot_frame.cpp.

489 {
490  addPlot( aDeviceName, SPT_CURRENT, aParam );
491 }
void addPlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
Adds a new plot to the current panel.

References addPlot(), and SPT_CURRENT.

Referenced by DIALOG_SIGNAL_LIST::addSignalToPlotFrame().

◆ addPlot()

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 558 of file sim_plot_frame.cpp.

559 {
560  SIM_TYPE simType = m_exporter->GetSimType();
561 
562  if( simType == ST_UNKNOWN )
563  {
564  m_simConsole->AppendText( _( "Error: simulation type not defined!\n" ) );
565  m_simConsole->SetInsertionPointEnd();
566  return;
567  }
568  else if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
569  {
570  m_simConsole->AppendText( _( "Error: simulation type doesn't support plotting!\n" ) );
571  m_simConsole->SetInsertionPointEnd();
572  return;
573  }
574 
575  // Create a new plot if the current one displays a different type
576  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
577 
578  if( !plotPanel || plotPanel->GetType() != simType )
579  plotPanel = NewPlotPanel( simType );
580 
581  TRACE_DESC descriptor( *m_exporter, aName, aType, aParam );
582 
583  bool updated = false;
584  SIM_PLOT_TYPE xAxisType = GetXAxisType( simType );
585 
586  if( xAxisType == SPT_LIN_FREQUENCY || xAxisType == SPT_LOG_FREQUENCY )
587  {
588  int baseType = descriptor.GetType() & ~( SPT_AC_MAG | SPT_AC_PHASE );
589 
590  // Add two plots: magnitude & phase
591  TRACE_DESC mag_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_MAG ) );
592  TRACE_DESC phase_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_PHASE ) );
593 
594  updated |= updatePlot( mag_desc, plotPanel );
595  updated |= updatePlot( phase_desc, plotPanel );
596  }
597  else
598  {
599  updated = updatePlot( descriptor, plotPanel );
600  }
601 
602  if( updated )
603  {
605  }
606 }
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_PLOT_TYPE GetXAxisType(SIM_TYPE aType) const
Returns X axis for a given simulation type.
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
#define _(s)
Definition: 3d_actions.cpp:33
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_TYPE GetType() const
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.

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

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

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 397 of file eda_base_frame.cpp.

398 {
399  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
400  ACTION_MENU* helpMenu = new ACTION_MENU( false );
401 
402  helpMenu->SetTool( commonControl );
403 
404  helpMenu->Add( ACTIONS::help );
405  helpMenu->Add( ACTIONS::gettingStarted );
406  helpMenu->Add( ACTIONS::listHotKeys );
407  helpMenu->Add( ACTIONS::getInvolved );
408 
409  helpMenu->AppendSeparator();
410  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
411 
412  aMenuBar->Append( helpMenu, _( "&Help" ) );
413 }
static TOOL_ACTION listHotKeys
Definition: actions.h:171
ACTION_MENU.
Definition: action_menu.h:43
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:84
COMMON_CONTROL.
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION help
Definition: actions.h:170
TOOL_MANAGER * m_toolManager
static TOOL_ACTION getInvolved
Definition: actions.h:172
static TOOL_ACTION gettingStarted
Definition: actions.h:169

References _, about_xpm, ACTIONS::getInvolved, ACTIONS::gettingStarted, TOOL_MANAGER::GetTool(), ACTIONS::help, ACTIONS::listHotKeys, and EDA_BASE_FRAME::m_toolManager.

Referenced by EDA_3D_VIEWER::CreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), LIB_VIEW_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), CVPCB_MAINFRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

◆ AddTuner()

void SIM_PLOT_FRAME::AddTuner ( SCH_COMPONENT aComponent)

Adds a tuner for a component.

Definition at line 494 of file sim_plot_frame.cpp.

495 {
496  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
497 
498  if( !plotPanel )
499  return;
500 
501  // For now limit the tuner tool to RLC components
502  char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aComponent, 0 )[0];
503 
504  if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR && primitiveType != SP_INDUCTOR )
505  return;
506 
507  const wxString componentName = aComponent->GetField( REFERENCE )->GetText();
508 
509  // Do not add multiple instances for the same component
510  auto tunerIt = std::find_if( m_tuners.begin(), m_tuners.end(), [&]( const TUNER_SLIDER* t )
511  {
512  return t->GetComponentName() == componentName;
513  }
514  );
515 
516  if( tunerIt != m_tuners.end() )
517  return; // We already have it
518 
519  try
520  {
521  TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_tunePanel, aComponent );
522  m_tuneSizer->Add( tuner );
523  m_tuners.push_back( tuner );
524  m_tunePanel->Layout();
525  }
526  catch( const KI_PARAM_ERROR& e )
527  {
528  // Sorry, no bonus
529  DisplayError( nullptr, e.What() );
530  }
531 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
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 What() const
Definition: ki_exception.h:58
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
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123
KI_PARAM_ERROR is a class used to hold a translatable error message and may be used when throwing exc...
Definition: ki_exception.h:45

References CurrentPlot(), DisplayError(), 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, SP_RESISTOR, and KI_PARAM_ERROR::What().

◆ AddVoltagePlot()

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 482 of file sim_plot_frame.cpp.

483 {
484  addPlot( aNetName, SPT_VOLTAGE, "V" );
485 }
void addPlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
Adds a new plot to the current panel.

References addPlot(), and SPT_VOLTAGE.

Referenced by DIALOG_SIGNAL_LIST::addSelectionToPlotFrame(), and DIALOG_SIGNAL_LIST::addSignalToPlotFrame().

◆ applyTuners()

void SIM_PLOT_FRAME::applyTuners ( )
private

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

Todo:
no ngspice hardcoding

Definition at line 852 of file sim_plot_frame.cpp.

853 {
854  for( auto& tuner : m_tuners )
855  {
857  std::string command( "alter @" + tuner->GetSpiceName()
858  + "=" + tuner->GetValue().ToSpiceString() );
859 
860  m_simulator->Command( command );
861  }
862 }
std::list< TUNER_SLIDER * > m_tuners
List of currently displayed tuners
std::shared_ptr< SPICE_SIMULATOR > m_simulator

References m_simulator, and m_tuners.

Referenced by onSimUpdate(), and StartSimulation().

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inlineinherited

Definition at line 225 of file eda_base_frame.h.

226  {
227  SetUserUnits( aUnits );
229  }
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void SetUserUnits(EDA_UNITS aUnits)

References EDA_BASE_FRAME::SetUserUnits(), and EDA_BASE_FRAME::unitsChangeRefresh().

Referenced by COMMON_TOOLS::ImperialUnits(), COMMON_TOOLS::MetricUnits(), and COMMON_TOOLS::ToggleUnits().

◆ CheckForAutoSaveFile()

void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName)
inherited

Check 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.

Definition at line 735 of file eda_base_frame.cpp.

736 {
737  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
738 
739  wxFileName autoSaveFileName = aFileName;
740 
741  // Check for auto save file.
742  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
743 
744  wxLogTrace( traceAutoSave,
745  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
746 
747  if( !autoSaveFileName.FileExists() )
748  return;
749 
750  wxString msg = wxString::Format( _(
751  "Well this is potentially embarrassing!\n"
752  "It appears that the last time you were editing the file\n"
753  "\"%s\"\n"
754  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
755  GetChars( aFileName.GetFullName() )
756  );
757 
758  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
759 
760  // Make a backup of the current file, delete the file, and rename the auto save file to
761  // the file name.
762  if( response == wxYES )
763  {
764  // Get the backup file name.
765  wxFileName backupFileName = aFileName;
766  backupFileName.SetExt( aFileName.GetExt() + GetBackupSuffix() );
767 
768  // If an old backup file exists, delete it. If an old copy of the file exists, rename
769  // it to the backup file name
770  if( aFileName.FileExists() )
771  {
772  // Rename the old file to the backup file name.
773  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath(), true ) )
774  {
775  msg.Printf( _( "Could not create backup file \"%s\"" ),
776  GetChars( backupFileName.GetFullPath() ) );
777  wxMessageBox( msg );
778  }
779  }
780 
781  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
782  {
783  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
784  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
785  }
786  }
787  else
788  {
789  wxLogTrace( traceAutoSave,
790  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
791 
792  // Remove the auto save file when using the previous file as is.
793  wxRemoveFile( autoSaveFileName.GetFullPath() );
794  }
795 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
static wxString GetBackupSuffix()
static wxString GetAutoSaveFilePrefix()
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:101
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
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), EDA_BASE_FRAME::GetBackupSuffix(), GetChars(), Pgm(), and traceAutoSave.

Referenced by SCH_EDIT_FRAME::OpenProjectFiles(), and PCB_EDIT_FRAME::OpenProjectFiles().

◆ ClearFileHistory()

void EDA_BASE_FRAME::ClearFileHistory ( FILE_HISTORY aFileHistory = NULL)
inherited

Removes all files from the file history.

Parameters
aFileHistoryThe FILE_HISTORY in use. If null, the main application file history is used

Definition at line 643 of file eda_base_frame.cpp.

644 {
645  if( !aFileHistory )
646  aFileHistory = &Kiface().GetFileHistory();
647 
648  aFileHistory->ClearFileHistory();
649 }
void ClearFileHistory()
Clear all entries from the file history.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:125

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

Referenced by GERBVIEW_FRAME::OnClearDrlFileHistory(), KICAD_MANAGER_FRAME::OnClearFileHistory(), PCB_EDIT_FRAME::OnClearFileHistory(), SCH_EDIT_FRAME::OnClearFileHistory(), GERBVIEW_FRAME::OnClearGbrFileHistory(), GERBVIEW_FRAME::OnClearJobFileHistory(), and GERBVIEW_FRAME::OnClearZipFileHistory().

◆ CommonSettingsChanged()

void EDA_BASE_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged)
virtualinherited

Notification event that some of the common (suite-wide) settings have changed.

Update menus, toolbars, local variables, etc.

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, PCB_BASE_FRAME, FOOTPRINT_EDIT_FRAME, EDA_3D_VIEWER, KICAD_MANAGER_FRAME, FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME, and LIB_VIEW_FRAME.

Definition at line 426 of file eda_base_frame.cpp.

427 {
428  if( GetToolManager() )
430 
431  if( GetMenuBar() )
432  {
433  // For icons in menus, icon scaling & hotkeys
434  ReCreateMenuBar();
435  GetMenuBar()->Refresh();
436  }
437 
438  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
439 
443 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
void UpdateHotKeys(bool aFullUpdate)
Function UpdateHotKeys() Optionally reads the hotkey config files and then rebuilds the internal hotk...
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:193
virtual void ReCreateMenuBar()
Recreates the menu bar.

References TOOL_MANAGER::GetActionManager(), EDA_BASE_FRAME::GetToolManager(), COMMON_SETTINGS::INPUT::immediate_actions, EDA_BASE_FRAME::m_dragSelects, EDA_BASE_FRAME::m_immediateActions, COMMON_SETTINGS::m_Input, EDA_BASE_FRAME::m_moveWarpsCursor, Pgm(), COMMON_SETTINGS::INPUT::prefer_select_to_drag, EDA_BASE_FRAME::ReCreateMenuBar(), ACTION_MANAGER::UpdateHotKeys(), and COMMON_SETTINGS::INPUT::warp_mouse_on_move.

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged(), EDA_3D_VIEWER::CommonSettingsChanged(), and KIWAY::CommonSettingsChanged().

◆ config()

APP_SETTINGS_BASE * EDA_BASE_FRAME::config ( )
virtualinherited

Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 572 of file eda_base_frame.cpp.

573 {
574  // KICAD_MANAGER_FRAME overrides this
576  //wxASSERT( ret );
577  return ret;
578 }
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:103
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:75
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

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

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), SCH_EDIT_FRAME::SaveProject(), SIM_PLOT_FRAME(), EDA_BASE_FRAME::windowClosing(), and BM2CMP_FRAME::~BM2CMP_FRAME().

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited
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, except for frames shown in multiple modes in which case the m_configName must be set to the base name so that a single config can be used.

Definition at line 379 of file eda_base_frame.h.

380  {
381  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
382  return baseCfgName;
383  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by EDA_DRAW_FRAME::LoadSettings(), EDA_BASE_FRAME::SaveWindowSettings(), and ACTION_MANAGER::UpdateHotKeys().

◆ CurrentPlot()

SIM_PLOT_PANEL * SIM_PLOT_FRAME::CurrentPlot ( ) const

◆ CurrentToolName()

std::string EDA_BASE_FRAME::CurrentToolName ( ) const
inherited

Definition at line 252 of file eda_base_frame.cpp.

253 {
254  if( m_toolStack.empty() )
255  return ACTIONS::selectionTool.GetName();
256  else
257  return m_toolStack.back();
258 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:146

References EDA_BASE_FRAME::m_toolStack, and ACTIONS::selectionTool.

Referenced by TOOL_MANAGER::processEvent().

◆ Destroy()

◆ DismissModal()

void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
inherited

Definition at line 160 of file kiway_player.cpp.

161 {
162  m_modal_ret_val = aRetVal;
163  m_modal_string = aResult;
164 
165  if( m_modal_loop )
166  {
167  m_modal_loop->Exit();
168  m_modal_loop = 0; // this marks it as dismissed.
169  }
170 
171  Show( false );
172 }
bool m_modal_ret_val
Definition: kiway_player.h:192
wxString m_modal_string
Definition: kiway_player.h:191
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:189

References KIWAY_PLAYER::m_modal_loop, KIWAY_PLAYER::m_modal_ret_val, and KIWAY_PLAYER::m_modal_string.

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

◆ DisplayToolMsg()

virtual void EDA_BASE_FRAME::DisplayToolMsg ( const wxString &  msg)
inlinevirtualinherited

Reimplemented in EDA_DRAW_FRAME.

Definition at line 253 of file eda_base_frame.h.

253 {};

Referenced by EDA_BASE_FRAME::PopTool(), and EDA_BASE_FRAME::PushTool().

◆ doAutoSave()

bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

This 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 335 of file eda_base_frame.cpp.

336 {
337  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
338 }

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ fillDefaultColorList()

void SIM_PLOT_FRAME::fillDefaultColorList ( bool  aWhiteBg)
private

Fills m_colorList by a default set of colors.

Parameters
aWhiteBg= true to use a white (or clear) background false to use a dark background

Definition at line 375 of file sim_plot_frame.cpp.

376 {
377  m_colorList.clear();
378 
379  if( aWhiteBg )
380  {
381  m_colorList.emplace_back( 255, 255, 255 ); // Bg color
382  m_colorList.emplace_back( 0, 0, 0 ); // Fg color (texts)
383  m_colorList.emplace_back( 130, 130, 130 ); // Axis color
384  m_colorList.emplace_back( 0, 0, 0 ); // cursors color
385  }
386  else
387  {
388  m_colorList.emplace_back( 0, 0, 0 ); // Bg color
389  m_colorList.emplace_back( 255, 255, 255 ); // Fg color (texts)
390  m_colorList.emplace_back( 130, 130, 130 ); // Axis color
391  m_colorList.emplace_back( 255, 255, 255 ); // cursors color
392  }
393 
394  // Add a list of color for traces, starting at index SIM_TRACE_COLOR
395  m_colorList.emplace_back( 0xE4, 0x1A, 0x1C );
396  m_colorList.emplace_back( 0x37, 0x7E, 0xB8 );
397  m_colorList.emplace_back( 0x4D, 0xAF, 0x4A );
398  m_colorList.emplace_back( 0x98, 0x4E, 0xA3 );
399  m_colorList.emplace_back( 0xFF, 0x7F, 0x00 );
400  m_colorList.emplace_back( 0xFF, 0xFF, 0x33 );
401  m_colorList.emplace_back( 0xA6, 0x56, 0x28 );
402  m_colorList.emplace_back( 0xF7, 0x81, 0xBF );
403  m_colorList.emplace_back( 0x66, 0xC2, 0xA5 );
404  m_colorList.emplace_back( 0xFC, 0x8D, 0x62 );
405  m_colorList.emplace_back( 0x8D, 0xA0, 0xCB );
406  m_colorList.emplace_back( 0xE7, 0x8A, 0xC3 );
407  m_colorList.emplace_back( 0xA6, 0xD8, 0x54 );
408  m_colorList.emplace_back( 0xFF, 0xD9, 0x2F );
409  m_colorList.emplace_back( 0xE5, 0xC4, 0x94 );
410  m_colorList.emplace_back( 0xB3, 0xB3, 0xB3 );
411 
412 }
std::vector< wxColour > m_colorList
The color list to draw traces, bg, fg, axis...

References m_colorList.

Referenced by menuWhiteBackground(), and SIM_PLOT_FRAME().

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 517 of file eda_base_frame.h.

517 { return m_AboutTitle; }
wxString m_AboutTitle

References EDA_BASE_FRAME::m_AboutTitle.

Referenced by DIALOG_ABOUT::DIALOG_ABOUT().

◆ GetAutoSaveFilePrefix()

static wxString EDA_BASE_FRAME::GetAutoSaveFilePrefix ( )
inlinestaticprotectedinherited
Returns
the string to prepend to a file name for automatic save.

Definition at line 171 of file eda_base_frame.h.

172  {
173  return wxT( "_autosave-" );
174  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), SCH_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::Files_io_from_id(), SCH_EDIT_FRAME::OnCloseWindow(), PCB_EDIT_FRAME::OnExportSTEP(), SCH_EDIT_FRAME::SaveEEFile(), and PCB_EDIT_FRAME::SavePcbFile().

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 303 of file eda_base_frame.h.

303 { return m_autoSaveInterval; }

References EDA_BASE_FRAME::m_autoSaveInterval.

◆ GetBackupSuffix()

static wxString EDA_BASE_FRAME::GetBackupSuffix ( )
inlinestaticprotectedinherited
Returns
the suffix to be appended to the file extension on backup

Definition at line 163 of file eda_base_frame.h.

164  {
165  return wxT( "-bak" );
166  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), PCB_EDIT_FRAME::createBackupFile(), PCB_EDIT_FRAME::Files_io_from_id(), and SCH_EDIT_FRAME::SaveEEFile().

◆ GetDoImmediateActions()

bool EDA_BASE_FRAME::GetDoImmediateActions ( ) const
inlineinherited

Indicates that hotkeys should perform an immediate action even if another tool is currently active.

If false, the first hotkey should select the relevant tool.

Definition at line 259 of file eda_base_frame.h.

259 { return m_immediateActions; }

References EDA_BASE_FRAME::m_immediateActions.

◆ GetDragSelects()

bool EDA_BASE_FRAME::GetDragSelects ( ) const
inlineinherited

Indicates that a drag should draw a selection rectangle, even when started over an item.

Definition at line 265 of file eda_base_frame.h.

265 { return m_dragSelects; }

References EDA_BASE_FRAME::m_dragSelects.

Referenced by EE_SELECTION_TOOL::Main().

◆ GetExporter()

const NETLIST_EXPORTER_PSPICE_SIM * SIM_PLOT_FRAME::GetExporter ( ) const

Returns the netlist exporter object used for simulations.

Definition at line 552 of file sim_plot_frame.cpp.

553 {
554  return m_exporter.get();
555 }
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter

References m_exporter.

Referenced by TUNER_SLIDER::TUNER_SLIDER().

◆ GetFileFromHistory()

wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
FILE_HISTORY aFileHistory = NULL 
)
inherited

Fetches the file name from the file history list.

This removes the selected file, if this file does not exist. The menu is also updated, if FILE_HISTORY::UseMenu was called at init time

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

Definition at line 610 of file eda_base_frame.cpp.

612 {
613  FILE_HISTORY* fileHistory = aFileHistory;
614 
615  if( !fileHistory )
616  fileHistory = &Kiface().GetFileHistory();
617 
618  int baseId = fileHistory->GetBaseId();
619 
620  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
621 
622  unsigned i = cmdId - baseId;
623 
624  if( i < fileHistory->GetCount() )
625  {
626  wxString fn = fileHistory->GetHistoryFile( i );
627 
628  if( wxFileName::FileExists( fn ) )
629  return fn;
630  else
631  {
632  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
633  wxMessageBox( msg );
634 
635  fileHistory->RemoveFileFromHistory( i );
636  }
637  }
638 
639  return wxEmptyString;
640 }
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:42
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
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
#define _(s)
Definition: 3d_actions.cpp:33
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:125

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

Referenced by GERBVIEW_FRAME::OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), GERBVIEW_FRAME::OnGbrFileHistory(), GERBVIEW_FRAME::OnJobFileHistory(), SCH_EDIT_FRAME::OnLoadFile(), and GERBVIEW_FRAME::OnZipFileHistory().

◆ GetMoveWarpsCursor()

bool EDA_BASE_FRAME::GetMoveWarpsCursor ( ) const
inlineinherited

Indicates that a move operation should warp the mouse pointer to the origin of the move object.

This improves snapping, but some users are alergic to mouse warping.

Definition at line 271 of file eda_base_frame.h.

271 { return m_moveWarpsCursor; }

References EDA_BASE_FRAME::m_moveWarpsCursor.

Referenced by SCH_MOVE_TOOL::Main(), and LIB_MOVE_TOOL::Main().

◆ GetMruPath()

◆ GetPlotBgOpt()

bool SIM_PLOT_FRAME::GetPlotBgOpt ( ) const
inline
Returns
the current background option for plotting. false for drak bg, true for clear bg

Definition at line 180 of file sim_plot_frame.h.

180 { return m_plotUseWhiteBg; }

References m_plotUseWhiteBg.

Referenced by menuWhiteBackground(), and SIM_PLOT_FRAME().

◆ GetPlotColor()

wxColor SIM_PLOT_FRAME::GetPlotColor ( int  aColorId)
Returns
the wxColor selected in color list.
Parameters
aColorIdis the index in color list

Definition at line 365 of file sim_plot_frame.cpp.

366 {
367  // return the wxColor selected in color list or BLACK is not in list
368  if( aColorId >= 0 && aColorId < (int)m_colorList.size() )
369  return m_colorList[aColorId];
370 
371  return wxColor( 0, 0, 0 );
372 }
std::vector< wxColour > m_colorList
The color list to draw traces, bg, fg, axis...

References m_colorList.

Referenced by SIM_PLOT_PANEL::GetPlotColor().

◆ GetPlotColorCount()

int SIM_PLOT_FRAME::GetPlotColorCount ( )
inline
Returns
the count of colors in color list

Definition at line 191 of file sim_plot_frame.h.

191 { return m_colorList.size(); }
std::vector< wxColour > m_colorList
The color list to draw traces, bg, fg, axis...

References m_colorList.

Referenced by SIM_PLOT_PANEL::generateColor().

◆ GetSettingsManager()

SETTINGS_MANAGER* EDA_BASE_FRAME::GetSettingsManager ( ) const
inlineinherited

Definition at line 231 of file eda_base_frame.h.

231 { return m_settingsManager; }
SETTINGS_MANAGER * m_settingsManager

References EDA_BASE_FRAME::m_settingsManager.

Referenced by GERBVIEW_FRAME::applyDisplaySettingsToGAL().

◆ GetSeverity()

virtual int EDA_BASE_FRAME::GetSeverity ( int  aErrorCode) const
inlinevirtualinherited

Reimplemented in PCB_EDIT_FRAME.

Definition at line 233 of file eda_base_frame.h.

References RPT_SEVERITY_UNDEFINED.

Referenced by RC_TREE_MODEL::GetValue().

◆ GetToolManager()

TOOL_MANAGER* EDA_BASE_FRAME::GetToolManager ( ) const
inlineinherited

Return the MVC controller.

Definition at line 238 of file eda_base_frame.h.

238 { return m_toolManager; }
TOOL_MANAGER * m_toolManager

References EDA_BASE_FRAME::m_toolManager.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), LIB_CONTROL::AddSymbolToSchematic(), BOARD_COMMIT::BOARD_COMMIT(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), EDA_BASE_FRAME::CommonSettingsChanged(), DIALOG_ERC::deleteAllMarkers(), DIALOG_DRC::deleteAllMarkers(), DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), GERBVIEW_FRAME::GERBVIEW_FRAME(), FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), KICAD_MANAGER_FRAME::InstallPreferences(), FOOTPRINT_EDIT_FRAME::InstallPreferences(), LIB_EDIT_FRAME::InstallPreferences(), GERBVIEW_FRAME::InstallPreferences(), PCB_EDIT_FRAME::InstallPreferences(), SCH_EDIT_FRAME::InstallPreferences(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), onClose(), SYMBOL_TREE_PANE::onComponentSelected(), DIALOG_DRC::OnDeleteOneClick(), DIALOG_ERC::OnERCItemSelected(), FOOTPRINTS_LISTBOX::OnLeftDClick(), onProbe(), DIALOG_PLOT::onRunDRC(), HIERARCHY_NAVIG_DLG::onSelectSheetPath(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), onTune(), DIALOG_PLOT::Plot(), EDA_BASE_FRAME::PopTool(), SCH_EDIT_FRAME::PutDataInPreviousState(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), DIALOG_FIND::search(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), CVPCB_MAINFRAME::setupEventHandlers(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), EDA_DRAW_FRAME::UpdateMsgPanel(), DIALOG_NETLIST::~DIALOG_NETLIST(), and DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:82

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

EDA_UNITS EDA_BASE_FRAME::GetUserUnits ( ) const
inlineinherited

Return the user units currently in use.

Definition at line 215 of file eda_base_frame.h.

216  {
217  return m_userUnits;
218  }
EDA_UNITS m_userUnits

References EDA_BASE_FRAME::m_userUnits.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS::AppendDiffPairs(), PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth(), PANEL_SETUP_TRACKS_AND_VIAS::AppendViaSize(), PCB_EDIT_FRAME::Create_MuWaveComponent(), MWAVE::CreateMicrowaveInductor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), GERBER_FILE_IMAGE::DisplayImageInfo(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), LIB_EDIT_TOOL::editGraphicProperties(), LIB_PIN_TOOL::EditPinProperties(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::GenFootprintsReport(), PANEL_MODEDIT_DEFAULTS::getGridValue(), PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue(), PANEL_SETUP_NETCLASSES::getNetclassValue(), GetUserUnits(), GRID_MENU::GRID_MENU(), PCB_INSPECTION_TOOL::highlightNet(), GERBVIEW_FRAME::Liste_D_Codes(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), PANEL_SETUP_BOARD_STACKUP::onThicknessChange(), PANEL_SETUP_BOARD_STACKUP::onUpdateThicknessValue(), PANEL_PREV_3D::PANEL_PREV_3D(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), POSITION_RELATIVE_TOOL::PositionRelative(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), CONNECTION_SUBGRAPH::ResolveDrivers(), DISPLAY_FOOTPRINTS_FRAME::SyncToolbars(), FOOTPRINT_EDIT_FRAME::SyncToolbars(), LIB_EDIT_FRAME::SyncToolbars(), GERBVIEW_FRAME::SyncToolbars(), PCB_EDIT_FRAME::SyncToolbars(), SCH_EDIT_FRAME::SyncToolbars(), DRC::testDrilledHoles(), DRC::testUnconnected(), COMMON_TOOLS::ToggleUnits(), PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup(), PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), PANEL_MODEDIT_SETTINGS::TransferDataToWindow(), PANEL_GERBVIEW_SETTINGS::TransferDataToWindow(), PANEL_PCBNEW_SETTINGS::TransferDataToWindow(), PANEL_SETUP_NETCLASSES::TransferDataToWindow(), UNIT_BINDER::UNIT_BINDER(), GRID_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), GERBVIEW_FRAME::updateDCodeSelectBox(), GERBVIEW_FRAME::updateGridSelectBox(), PCB_BASE_FRAME::UpdateGridSelectBox(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PNS_TUNE_STATUS_POPUP::UpdateStatus(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_EDIT_FRAME::UpdateTrackWidthSelectBox(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), DRC::userUnits(), PANEL_SETUP_TRACKS_AND_VIAS::validateData(), and PANEL_SETUP_NETCLASSES::validateData().

◆ GetWindowSettings()

WINDOW_SETTINGS * SIM_PLOT_FRAME::GetWindowSettings ( APP_SETTINGS_BASE aCfg)
overridevirtual

Returns a pointer to the window settings for this frame.

By default, points to aCfg->m_Window for top-level frames.

Parameters
aCfgis this frame's config object

Reimplemented from EDA_BASE_FRAME.

Definition at line 269 of file sim_plot_frame.cpp.

270 {
271  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
272  wxASSERT( cfg );
273  return &cfg->m_Simulator.window;
274 }

◆ GetXAxisType()

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 971 of file sim_plot_frame.cpp.

972 {
973  switch( aType )
974  {
975  case ST_AC:
976  return SPT_LIN_FREQUENCY;
978 
979  case ST_DC:
980  return SPT_SWEEP;
981 
982  case ST_TRANSIENT:
983  return SPT_TIME;
984 
985  default:
986  wxASSERT_MSG( false, "Unhandled simulation type" );
987  return (SIM_PLOT_TYPE) 0;
988  }
989 }
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:35

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

Referenced by addPlot().

◆ help_name()

wxString EDA_BASE_FRAME::help_name ( )
virtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 587 of file eda_base_frame.cpp.

588 {
589  return Kiface().GetHelpFileName();
590 }
const wxString & GetHelpFileName() const
Function GetHelpFileName returns just the basename portion of the current help file.
Definition: kiface_i.h:123
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

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

Referenced by COMMON_CONTROL::ShowHelp().

◆ ImportHotkeyConfigFromFile()

void EDA_BASE_FRAME::ImportHotkeyConfigFromFile ( std::map< std::string, TOOL_ACTION * >  aActionMap,
const wxString &  aDefaultShortname 
)
inherited

Prompt the user for a hotkey file to read, and read it.

Parameters
aActionMap= current hotkey map (over which the imported hotkeys will be applied)
aDefaultShortname= a default short name (extension not needed) like eechema, kicad...

◆ InstallPreferences()

virtual void EDA_BASE_FRAME::InstallPreferences ( PAGED_DIALOG ,
PANEL_HOTKEYS_EDITOR  
)
inlinevirtualinherited

Function InstallPreferences Allow a frame to load its preference panels (if any) into the preferences dialog.

Parameters
aParenta paged dialog into which the preference panels should be installed

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

Definition at line 332 of file eda_base_frame.h.

332 { }

Referenced by EDA_BASE_FRAME::OnPreferences().

◆ isAutoSaveRequired()

virtual bool EDA_BASE_FRAME::isAutoSaveRequired ( ) const
inlineprotectedvirtualinherited

Return 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 186 of file eda_base_frame.h.

186 { return false; }

Referenced by EDA_BASE_FRAME::ProcessEvent().

◆ IsContentModified()

bool EDA_BASE_FRAME::IsContentModified ( )
virtualinherited

Get if the contents of the frame have been modified since the last save.

Returns
true if the contents of the frame have not been saved

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

Definition at line 798 of file eda_base_frame.cpp.

799 {
800  // This function should be overridden in child classes
801  return false;
802 }

◆ IsCurrentTool()

bool EDA_BASE_FRAME::IsCurrentTool ( const TOOL_ACTION aAction) const
inherited

Definition at line 261 of file eda_base_frame.cpp.

262 {
263  if( m_toolStack.empty() )
264  return &aAction == &ACTIONS::selectionTool;
265  else
266  return m_toolStack.back() == aAction.GetName();
267 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:146
const std::string & GetName() const
Function GetName() Returns name of the action.
Definition: tool_action.h:78

References TOOL_ACTION::GetName(), EDA_BASE_FRAME::m_toolStack, and ACTIONS::selectionTool.

Referenced by PCB_INSPECTION_TOOL::HighlightNetTool(), SCH_EDIT_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), DISPLAY_FOOTPRINTS_FRAME::SyncToolbars(), and LIB_EDIT_FRAME::SyncToolbars().

◆ IsDismissed()

bool KIWAY_PLAYER::IsDismissed ( )
inherited

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 154 of file kiway_player.cpp.

155 {
156  return !m_modal_loop;
157 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:189

References KIWAY_PLAYER::m_modal_loop.

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

◆ IsModal()

◆ IsSimulationRunning()

bool SIM_PLOT_FRAME::IsSimulationRunning ( )

Definition at line 454 of file sim_plot_frame.cpp.

455 {
456  return m_simulator ? m_simulator->IsRunning() : false;
457 }
std::shared_ptr< SPICE_SIMULATOR > m_simulator

References m_simulator.

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

◆ IsType()

bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited

Definition at line 305 of file eda_base_frame.h.

305 { return m_Ident == aType; }

References EDA_BASE_FRAME::m_Ident.

Referenced by LIB_CONTROL::AddLibrary(), PCBNEW_CONTROL::AddLibrary(), LIB_CONTROL::AddSymbol(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), BOARD_COMMIT::BOARD_COMMIT(), EDA_3D_VIEWER::CreateMenuBar(), LIB_CONTROL::CutCopyDelete(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), KIGFX::SCH_VIEW::DisplaySheet(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), LIB_CONTROL::DuplicateSymbol(), LIB_CONTROL::EditSymbol(), LIB_CONTROL::ExportSymbol(), LIB_CONTROL::Init(), DIALOG_EDIT_ONE_FIELD::init(), SELECTION_TOOL::Init(), DIALOG_PAD_PROPERTIES::initValues(), PICKER_TOOL::Main(), LIB_CONTROL::OnDeMorgan(), PCB_LAYER_WIDGET::OnRenderEnable(), PCBNEW_CONTROL::Paste(), LIB_CONTROL::PinLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), LIB_CONTROL::Revert(), EE_INSPECTION_TOOL::RunERC(), LIB_CONTROL::Save(), PCBNEW_CONTROL::Show3DViewer(), LIB_CONTROL::ShowComponentTree(), EE_INSPECTION_TOOL::ShowDatasheet(), LIB_CONTROL::UnpinLibrary(), and COMMON_TOOLS::ZoomFitScreen().

◆ IsWritable()

bool EDA_BASE_FRAME::IsWritable ( const wxFileName &  aFileName)
inherited

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 691 of file eda_base_frame.cpp.

692 {
693  wxString msg;
694  wxFileName fn = aFileName;
695 
696  // Check for absence of a file path with a file name. Unfortunately KiCad
697  // uses paths relative to the current project path without the ./ part which
698  // confuses wxFileName. Making the file name path absolute may be less than
699  // elegant but it solves the problem.
700  if( fn.GetPath().IsEmpty() && fn.HasName() )
701  fn.MakeAbsolute();
702 
703  wxCHECK_MSG( fn.IsOk(), false,
704  wxT( "File name object is invalid. Bad programmer!" ) );
705  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
706  wxT( "File name object path <" ) + fn.GetFullPath() +
707  wxT( "> is not set. Bad programmer!" ) );
708 
709  if( fn.IsDir() && !fn.IsDirWritable() )
710  {
711  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
712  GetChars( fn.GetPath() ) );
713  }
714  else if( !fn.FileExists() && !fn.IsDirWritable() )
715  {
716  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
717  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
718  }
719  else if( fn.FileExists() && !fn.IsFileWritable() )
720  {
721  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
722  GetChars( fn.GetFullPath() ) );
723  }
724 
725  if( !msg.IsEmpty() )
726  {
727  wxMessageBox( msg );
728  return false;
729  }
730 
731  return true;
732 }
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:101
#define _(s)
Definition: 3d_actions.cpp:33

References _, and GetChars().

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

◆ Kiway()

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 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:81

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithLibEdit(), BACK_ANNOTATE::FetchNetlistFromPCB(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::InitSheet(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadSheetFromFile(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), KIWAY_HOLDER::Prj(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SIM_PLOT_FRAME(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), LIB_MANAGER::UpdatePart(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ kiway_express()

void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 175 of file kiway_player.cpp.

176 {
177  // logging support
178  KiwayMailIn( aEvent ); // call the virtual, override in derived.
179 }
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

References KIWAY_PLAYER::KiwayMailIn().

◆ KiwayMailIn()

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 LIB_EDIT_FRAME, FOOTPRINT_EDIT_FRAME, SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 69 of file kiway_player.cpp.

70 {
71  // override this in derived classes.
72 }

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

◆ language_change()

void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

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

Definition at line 182 of file kiway_player.cpp.

183 {
184  int id = event.GetId();
185 
186  // tell all the KIWAY_PLAYERs about the language change.
187  Kiway().SetLanguage( id );
188 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs.
Definition: kiway.cpp:435

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

◆ LoadSettings()

void SIM_PLOT_FRAME::LoadSettings ( APP_SETTINGS_BASE aCfg)
overridevirtual

Load 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 251 of file sim_plot_frame.cpp.

252 {
253  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
254  wxASSERT( cfg );
255 
257 
258  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
259 
260  // Read subwindows sizes (should be > 0 )
261  m_splitterLeftRightSashPosition = cfg->m_Simulator.plot_panel_width;
262  m_splitterPlotAndConsoleSashPosition = cfg->m_Simulator.plot_panel_height;
263  m_splitterSignalsSashPosition = cfg->m_Simulator.signal_panel_height;
264  m_splitterTuneValuesSashPosition = cfg->m_Simulator.cursors_panel_height;
265  m_plotUseWhiteBg = cfg->m_Simulator.white_background;
266 }
int m_splitterPlotAndConsoleSashPosition
int m_splitterTuneValuesSashPosition
int m_splitterSignalsSashPosition
int m_splitterLeftRightSashPosition
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.

References EDA_BASE_FRAME::LoadSettings(), EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, m_plotUseWhiteBg, m_splitterLeftRightSashPosition, m_splitterPlotAndConsoleSashPosition, m_splitterSignalsSashPosition, m_splitterTuneValuesSashPosition, wxPoint::x, and wxPoint::y.

Referenced by SIM_PLOT_FRAME().

◆ LoadWindowSettings()

void EDA_BASE_FRAME::LoadWindowSettings ( WINDOW_SETTINGS aCfg)
inherited

Loads window settings from the given settings object Normally called by LoadSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window.

Definition at line 446 of file eda_base_frame.cpp.

447 {
448  m_FramePos.x = aCfg->pos_x;
449  m_FramePos.y = aCfg->pos_y;
450  m_FrameSize.x = aCfg->size_x;
451  m_FrameSize.y = aCfg->size_y;
452 
453  // Ensure minimum size is set if the stored config was zero-initialized
455  {
458  }
459 
460  // Ensure window isn't bigger than can be displayed
461  int displayIndex = wxDisplay::GetFromPoint( m_FramePos );
462 
463  if( displayIndex == wxNOT_FOUND )
464  displayIndex = 0;
465 
466  wxDisplay display( displayIndex );
467  wxRect clientSize = display.GetClientArea();
468 
469  // The window may have been saved on a display that is no longer present.
470  // First, check the window origin and move it if it's off the chosen display
471 
472  if( m_FramePos.x >= clientSize.x + clientSize.width ||
473  m_FramePos.y >= clientSize.y + clientSize.height )
474  m_FramePos = wxDefaultPosition;
475 
476  // Now, fix up the size if needed
477 
478  if( m_FrameSize.x + m_FramePos.x > clientSize.x + clientSize.width )
479  {
480  m_FrameSize.x = clientSize.width;
481  m_FramePos.x = 0;
482  }
483 
484  if( m_FrameSize.y + m_FramePos.y > clientSize.y + clientSize.height )
485  {
486  m_FrameSize.y = clientSize.height;
487  m_FramePos.y = 0;
488  }
489 
490  if( m_hasAutoSave )
491  m_autoSaveInterval = Pgm().GetCommonSettings()->m_System.autosave_interval;
492 
493  // Ensure Window title bar is visible
494 #if defined( __WXMAC__ )
495  // for macOSX, the window must be below system (macOSX) toolbar
496  // Ypos_min = GetMBarHeight(); seems no more exist in new API (subject to change)
497  int Ypos_min = 20;
498 #else
499  int Ypos_min = 0;
500 #endif
501  if( m_FramePos.y < Ypos_min )
502  {
503  if( m_FrameSize.y + ( Ypos_min - m_FramePos.y ) > clientSize.height)
504  m_FrameSize.y = clientSize.height - Ypos_min;
505 
506  m_FramePos.y = Ypos_min;
507  }
508 
509  if( aCfg->maximized )
510  Maximize();
511 
512  m_perspective = aCfg->perspective;
513  m_mruPath = aCfg->mru_path;
514 
515  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
516 
520 }
wxString mru_path
Definition: app_settings.h:55
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
wxString m_mruPath
wxString m_perspective
wxString perspective
Definition: app_settings.h:58
static const int s_minsize_x
static const int s_minsize_y

References COMMON_SETTINGS::INPUT::immediate_actions, EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_dragSelects, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_BASE_FRAME::m_hasAutoSave, EDA_BASE_FRAME::m_immediateActions, COMMON_SETTINGS::m_Input, EDA_BASE_FRAME::m_moveWarpsCursor, EDA_BASE_FRAME::m_mruPath, EDA_BASE_FRAME::m_perspective, WINDOW_SETTINGS::maximized, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, Pgm(), WINDOW_SETTINGS::pos_x, WINDOW_SETTINGS::pos_y, COMMON_SETTINGS::INPUT::prefer_select_to_drag, s_minsize_x, s_minsize_y, WINDOW_SETTINGS::size_x, WINDOW_SETTINGS::size_y, COMMON_SETTINGS::INPUT::warp_mouse_on_move, wxPoint::x, and wxPoint::y.

Referenced by EDA_BASE_FRAME::LoadSettings().

◆ loadWorkbook()

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 865 of file sim_plot_frame.cpp.

866 {
867  m_plots.clear();
868  m_plotNotebook->DeleteAllPages();
869 
870  wxTextFile file( aPath );
871 
872  if( !file.Open() )
873  return false;
874 
875  long plotsCount;
876 
877  if( !file.GetFirstLine().ToLong( &plotsCount ) ) // GetFirstLine instead of GetNextLine
878  return false;
879 
880  for( long i = 0; i < plotsCount; ++i )
881  {
882  long plotType, tracesCount;
883 
884  if( !file.GetNextLine().ToLong( &plotType ) )
885  return false;
886 
887  SIM_PLOT_PANEL* plotPanel = NewPlotPanel( (SIM_TYPE) plotType );
888  m_plots[plotPanel].m_simCommand = file.GetNextLine();
889  StartSimulation();
890 
891  // Perform simulation, so plots can be added with values
892  do
893  {
894  wxThread::This()->Sleep( 50 );
895  }
896  while( IsSimulationRunning() );
897 
898  if( !file.GetNextLine().ToLong( &tracesCount ) )
899  return false;
900 
901  for( long j = 0; j < tracesCount; ++j )
902  {
903  long traceType;
904  wxString name, param;
905 
906  if( !file.GetNextLine().ToLong( &traceType ) )
907  return false;
908 
909  name = file.GetNextLine();
910  param = file.GetNextLine();
911 
912  if( name.IsEmpty() || param.IsEmpty() )
913  return false;
914 
915  addPlot( name, (SIM_PLOT_TYPE) traceType, param );
916  }
917  }
918 
919  return true;
920 }
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:60
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.

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

Referenced by menuOpenWorkbook().

◆ m_splitterLeftRightOnIdle()

void SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 128 of file sim_plot_frame_base.h.

129  {
130  m_splitterLeftRight->SetSashPosition( 700 );
131  m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this );
132  }
void m_splitterLeftRightOnIdle(wxIdleEvent &)
#define NULL
wxSplitterWindow * m_splitterLeftRight

References SIM_PLOT_FRAME_BASE::m_splitterLeftRight, and NULL.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

◆ m_splitterPlotAndConsoleOnIdle()

void SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 134 of file sim_plot_frame_base.h.

135  {
136  m_splitterPlotAndConsole->SetSashPosition( 500 );
137  m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
138  }
#define NULL
void m_splitterPlotAndConsoleOnIdle(wxIdleEvent &)
wxSplitterWindow * m_splitterPlotAndConsole

References SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsole, and NULL.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

◆ m_splitterSignalsOnIdle()

void SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 140 of file sim_plot_frame_base.h.

141  {
142  m_splitterSignals->SetSashPosition( 0 );
143  m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this );
144  }
wxSplitterWindow * m_splitterSignals
void m_splitterSignalsOnIdle(wxIdleEvent &)
#define NULL

References SIM_PLOT_FRAME_BASE::m_splitterSignals, and NULL.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

◆ m_splitterTuneValuesOnIdle()

void SIM_PLOT_FRAME_BASE::m_splitterTuneValuesOnIdle ( wxIdleEvent &  )
inlineinherited

Definition at line 146 of file sim_plot_frame_base.h.

147  {
148  m_splitterTuneValues->SetSashPosition( 0 );
149  m_splitterTuneValues->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterTuneValuesOnIdle ), NULL, this );
150  }
wxSplitterWindow * m_splitterTuneValues
#define NULL
void m_splitterTuneValuesOnIdle(wxIdleEvent &)

References SIM_PLOT_FRAME_BASE::m_splitterTuneValues, and NULL.

Referenced by SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE().

◆ menuExit()

void SIM_PLOT_FRAME::menuExit ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 285 of file sim_plot_frame.h.

286  {
287  Close();
288  }

◆ menuNewPlot()

void SIM_PLOT_FRAME::menuNewPlot ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 992 of file sim_plot_frame.cpp.

993 {
994  SIM_TYPE type = m_exporter->GetSimType();
995 
996  if( SIM_PLOT_PANEL::IsPlottable( type ) )
997  {
998  SIM_PLOT_PANEL* prevPlot = CurrentPlot();
999  SIM_PLOT_PANEL* newPlot = NewPlotPanel( type );
1000 
1001  // If the previous plot had the same type, copy the simulation command
1002  if( prevPlot )
1003  m_plots[newPlot].m_simCommand = m_plots[prevPlot].m_simCommand;
1004  }
1005 }
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.

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

◆ menuOpenWorkbook()

void SIM_PLOT_FRAME::menuOpenWorkbook ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1008 of file sim_plot_frame.cpp.

1009 {
1010  wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "",
1011  WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1012 
1013  if( openDlg.ShowModal() == wxID_CANCEL )
1014  return;
1015 
1016  m_savedWorkbooksPath = openDlg.GetDirectory();
1017 
1018  if( !loadWorkbook( openDlg.GetPath() ) )
1019  DisplayError( this, _( "There was an error while opening the workbook file" ) );
1020 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
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
#define _(s)
Definition: 3d_actions.cpp:33
wxString WorkbookFileWildcard()

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

◆ menuSaveCsv()

void SIM_PLOT_FRAME::menuSaveCsv ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1056 of file sim_plot_frame.cpp.

1057 {
1058  if( !CurrentPlot() )
1059  return;
1060 
1061  const wxChar SEPARATOR = ';';
1062 
1063  wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "",
1064  CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1065 
1066  if( saveDlg.ShowModal() == wxID_CANCEL )
1067  return;
1068 
1069  wxFile out( saveDlg.GetPath(), wxFile::write );
1070  bool timeWritten = false;
1071 
1072  for( const auto& t : CurrentPlot()->GetTraces() )
1073  {
1074  const TRACE* trace = t.second;
1075 
1076  if( !timeWritten )
1077  {
1078  out.Write( wxString::Format( "Time%c", SEPARATOR ) );
1079 
1080  for( double v : trace->GetDataX() )
1081  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
1082 
1083  out.Write( "\r\n" );
1084  timeWritten = true;
1085  }
1086 
1087  out.Write( wxString::Format( "%s%c", t.first, SEPARATOR ) );
1088 
1089  for( double v : trace->GetDataY() )
1090  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
1091 
1092  out.Write( "\r\n" );
1093  }
1094 
1095  out.Close();
1096 }
const std::vector< double > & GetDataX() const
wxString CsvFileWildcard()
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
#define _(s)
Definition: 3d_actions.cpp:33
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
const std::vector< double > & GetDataY() const
const std::map< wxString, TRACE * > & GetTraces() const

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

◆ menuSaveImage()

void SIM_PLOT_FRAME::menuSaveImage ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1041 of file sim_plot_frame.cpp.

1042 {
1043  if( !CurrentPlot() )
1044  return;
1045 
1046  wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "",
1047  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1048 
1049  if( saveDlg.ShowModal() == wxID_CANCEL )
1050  return;
1051 
1052  CurrentPlot()->SaveScreenshot( saveDlg.GetPath(), wxBITMAP_TYPE_PNG );
1053 }
wxString PngFileWildcard()
#define _(s)
Definition: 3d_actions.cpp:33
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:3066

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

◆ menuSaveWorkbook()

void SIM_PLOT_FRAME::menuSaveWorkbook ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1023 of file sim_plot_frame.cpp.

1024 {
1025  if( !CurrentPlot() )
1026  return;
1027 
1028  wxFileDialog saveDlg( this, _( "Save Simulation Workbook" ), m_savedWorkbooksPath, "",
1029  WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1030 
1031  if( saveDlg.ShowModal() == wxID_CANCEL )
1032  return;
1033 
1034  m_savedWorkbooksPath = saveDlg.GetDirectory();
1035 
1036  if( !saveWorkbook( saveDlg.GetPath() ) )
1037  DisplayError( this, _( "There was an error while saving the workbook file" ) );
1038 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
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
#define _(s)
Definition: 3d_actions.cpp:33
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
wxString WorkbookFileWildcard()

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

◆ menuShowDotted()

void SIM_PLOT_FRAME::menuShowDotted ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1153 of file sim_plot_frame.cpp.

1154 {
1155  SIM_PLOT_PANEL* plot = CurrentPlot();
1156 
1157  if( plot )
1158  plot->SetDottedCurrentPhase( !plot->GetDottedCurrentPhase() );
1159 }
bool GetDottedCurrentPhase() const
void SetDottedCurrentPhase(bool aEnable)
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

References CurrentPlot(), SIM_PLOT_PANEL::GetDottedCurrentPhase(), and SIM_PLOT_PANEL::SetDottedCurrentPhase().

◆ menuShowDottedUpdate()

void SIM_PLOT_FRAME::menuShowDottedUpdate ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1162 of file sim_plot_frame.cpp.

1163 {
1164  SIM_PLOT_PANEL* plot = CurrentPlot();
1165 
1166  event.Check( plot ? plot->GetDottedCurrentPhase() : false );
1167 }
bool GetDottedCurrentPhase() const
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuShowGrid()

void SIM_PLOT_FRAME::menuShowGrid ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1120 of file sim_plot_frame.cpp.

1121 {
1122  SIM_PLOT_PANEL* plot = CurrentPlot();
1123 
1124  if( plot )
1125  plot->ShowGrid( !plot->IsGridShown() );
1126 }
bool IsGridShown() const
void ShowGrid(bool aEnable)
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuShowGridUpdate()

void SIM_PLOT_FRAME::menuShowGridUpdate ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1129 of file sim_plot_frame.cpp.

1130 {
1131  SIM_PLOT_PANEL* plot = CurrentPlot();
1132 
1133  event.Check( plot ? plot->IsGridShown() : false );
1134 }
bool IsGridShown() const
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuShowLegend()

void SIM_PLOT_FRAME::menuShowLegend ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1137 of file sim_plot_frame.cpp.

1138 {
1139  SIM_PLOT_PANEL* plot = CurrentPlot();
1140 
1141  if( plot )
1142  plot->ShowLegend( !plot->IsLegendShown() );
1143 }
bool IsLegendShown() const
void ShowLegend(bool aEnable)
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuShowLegendUpdate()

void SIM_PLOT_FRAME::menuShowLegendUpdate ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1146 of file sim_plot_frame.cpp.

1147 {
1148  SIM_PLOT_PANEL* plot = CurrentPlot();
1149  event.Check( plot ? plot->IsLegendShown() : false );
1150 }
bool IsLegendShown() const
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuShowWhiteBackgroundUpdate()

void SIM_PLOT_FRAME::menuShowWhiteBackgroundUpdate ( wxUpdateUIEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 302 of file sim_plot_frame.h.

303  {
304  event.Check( m_plotUseWhiteBg );
305  }

References m_plotUseWhiteBg.

◆ menuWhiteBackground()

void SIM_PLOT_FRAME::menuWhiteBackground ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1170 of file sim_plot_frame.cpp.

1171 {
1173 
1174  // Rebuild the color list to plot traces
1176 
1177  // Now send changes to all SIM_PLOT_PANEL
1178  for( size_t page = 0; page < m_plotNotebook->GetPageCount(); page++ )
1179  {
1180  wxWindow* curPage = m_plotNotebook->GetPage( page );
1181 
1182  if( curPage == m_welcomePanel )
1183  continue;
1184 
1185  static_cast<SIM_PLOT_PANEL*>( curPage )->UpdatePlotColors();
1186  }
1187 }
bool GetPlotBgOpt() const
wxAuiNotebook * m_plotNotebook
void fillDefaultColorList(bool aWhiteBg)
Fills m_colorList by a default set of colors.

References fillDefaultColorList(), GetPlotBgOpt(), SIM_PLOT_FRAME_BASE::m_plotNotebook, m_plotUseWhiteBg, and SIM_PLOT_FRAME_BASE::m_welcomePanel.

◆ menuZoomFit()

void SIM_PLOT_FRAME::menuZoomFit ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1113 of file sim_plot_frame.cpp.

1114 {
1115  if( CurrentPlot() )
1116  CurrentPlot()->Fit();
1117 }
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2014
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuZoomIn()

void SIM_PLOT_FRAME::menuZoomIn ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1099 of file sim_plot_frame.cpp.

1100 {
1101  if( CurrentPlot() )
1102  CurrentPlot()->ZoomIn();
1103 }
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2259
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuZoomOut()

void SIM_PLOT_FRAME::menuZoomOut ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1106 of file sim_plot_frame.cpp.

1107 {
1108  if( CurrentPlot() )
1109  CurrentPlot()->ZoomOut();
1110 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2322
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ NewPlotPanel()

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 460 of file sim_plot_frame.cpp.

461 {
462  SIM_PLOT_PANEL* plotPanel = new SIM_PLOT_PANEL( aSimType, m_plotNotebook, this, wxID_ANY );
463 
464  plotPanel->EnableMouseWheelPan(
466 
467  if( m_welcomePanel )
468  {
469  m_plotNotebook->DeletePage( 0 );
470  m_welcomePanel = nullptr;
471  }
472 
473  m_plotNotebook->AddPage( plotPanel, wxString::Format( _( "Plot%u" ),
474  (unsigned int) m_plotNotebook->GetPageCount() + 1 ), true );
475 
476  m_plots[plotPanel] = PLOT_INFO();
477 
478  return plotPanel;
479 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
void EnableMouseWheelPan(bool enabled)
Enable/disable trackpad friendly panning (2-axis scroll wheel)
Definition: mathplot.h:1215
wxAuiNotebook * m_plotNotebook
SCH_EDIT_FRAME * m_schematicFrame
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
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
#define _(s)
Definition: 3d_actions.cpp:33
virtual bool IsMousewheelPanEnabled() const
Function IsMousewheelPanEnabled()

References _, mpWindow::EnableMouseWheelPan(), Format(), SCH_BASE_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW_CONTROLS::IsMousewheelPanEnabled(), SIM_PLOT_FRAME_BASE::m_plotNotebook, m_plots, m_schematicFrame, and SIM_PLOT_FRAME_BASE::m_welcomePanel.

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

◆ onAddSignal()

void SIM_PLOT_FRAME::onAddSignal ( wxCommandEvent &  event)
private

Definition at line 1289 of file sim_plot_frame.cpp.

1290 {
1291  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1292 
1293  if( !plotPanel || !m_exporter || plotPanel->GetType() != m_exporter->GetSimType() )
1294  {
1295  DisplayInfoMessage( this, _( "You need to run simulation first." ) );
1296  return;
1297  }
1298 
1299  DIALOG_SIGNAL_LIST dialog( this, m_exporter.get() );
1300  dialog.ShowModal();
1301 }
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
#define _(s)
Definition: 3d_actions.cpp:33
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
SIM_TYPE GetType() const
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:267

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

Referenced by SIM_PLOT_FRAME().

◆ onAutoSaveTimer()

void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Handle the auto save timer event.

Definition at line 328 of file eda_base_frame.cpp.

329 {
330  if( !doAutoSave() )
331  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
332 }
virtual bool doAutoSave()
This should be overridden by the derived class to handle the auto save feature.
wxTimer * m_autoSaveTimer

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

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

◆ OnCharHook()

void EDA_BASE_FRAME::OnCharHook ( wxKeyEvent &  event)
virtualinherited

Capture the key event before it is sent to the GUI.

The basic frame does not capture this event. Editor frames should override this event function to capture and filter these keys when they are used as hotkeys, and skip it if the key is not used as hotkey (otherwise the key events will be not sent to menus).

Reimplemented in FOOTPRINT_VIEWER_FRAME.

Definition at line 341 of file eda_base_frame.cpp.

342 {
343  wxLogTrace( kicadTraceKeyEvent, "EDA_BASE_FRAME::OnCharHook %s", dump( event ) );
344  // Key events can be filtered here.
345  // Currently no filtering is made.
346  event.Skip();
347 }
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.

References dump(), and kicadTraceKeyEvent.

◆ onClose()

void SIM_PLOT_FRAME::onClose ( wxCloseEvent &  aEvent)
private

Definition at line 1374 of file sim_plot_frame.cpp.

1375 {
1376  SaveSettings( config() );
1377 
1378  if( IsSimulationRunning() )
1379  m_simulator->Stop();
1380 
1381  // Cancel a running simProbe or simTune tool
1383 
1384  Destroy();
1385 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
std::shared_ptr< SPICE_SIMULATOR > m_simulator
SCH_EDIT_FRAME * m_schematicFrame
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
bool IsSimulationRunning()
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual APP_SETTINGS_BASE * config()
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

References ACTIONS::cancelInteractive, EDA_BASE_FRAME::config(), KIWAY_PLAYER::Destroy(), EDA_BASE_FRAME::GetToolManager(), IsSimulationRunning(), m_schematicFrame, m_simulator, TOOL_MANAGER::RunAction(), and SaveSettings().

Referenced by onShowNetlist(), and SIM_PLOT_FRAME().

◆ onCursorUpdate()

void SIM_PLOT_FRAME::onCursorUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 1388 of file sim_plot_frame.cpp.

1389 {
1390  wxSize size = m_cursors->GetClientSize();
1391  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1392  m_cursors->ClearAll();
1393 
1394  if( !plotPanel )
1395  return;
1396 
1398  m_cursors->SetImageList(m_signalsIconColorList, wxIMAGE_LIST_SMALL);
1399 
1400  // Fill the signals listctrl
1401  m_cursors->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x / 2 );
1402  const long X_COL = m_cursors->AppendColumn( plotPanel->GetLabelX(), wxLIST_FORMAT_LEFT, size.x / 4 );
1403 
1404  wxString labelY1 = plotPanel->GetLabelY1();
1405  wxString labelY2 = plotPanel->GetLabelY2();
1406  wxString labelY;
1407 
1408  if( !labelY2.IsEmpty() )
1409  labelY = labelY1 + " / " + labelY2;
1410  else
1411  labelY = labelY1;
1412 
1413  const long Y_COL = m_cursors->AppendColumn( labelY, wxLIST_FORMAT_LEFT, size.x / 4 );
1414 
1415  // Update cursor values
1416  int itemidx = 0;
1417  for( const auto& trace : plotPanel->GetTraces() )
1418  {
1419  if( CURSOR* cursor = trace.second->GetCursor() )
1420  {
1421  // Find the right icon color in list.
1422  // It is the icon used in m_signals list for the same trace
1423  long iconColor = m_signals->FindItem( -1, trace.first );
1424 
1425  const wxRealPoint coords = cursor->GetCoords();
1426  long idx = m_cursors->InsertItem( itemidx++, trace.first, iconColor );
1427  m_cursors->SetItem( idx, X_COL, SPICE_VALUE( coords.x ).ToSpiceString() );
1428  m_cursors->SetItem( idx, Y_COL, SPICE_VALUE( coords.y ).ToSpiceString() );
1429  }
1430  }
1431 }
wxString ToSpiceString() const
Returns string value in Spice format (e.g.
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
wxString GetLabelY1() const
wxString GetLabelX() const
wxString GetLabelY2() const
Helper class to handle Spice way of expressing values (e.g. 10.5 Meg)
Definition: spice_value.h:32
#define _(s)
Definition: 3d_actions.cpp:33
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
const std::map< wxString, TRACE * > & GetTraces() const
Cursor attached to a trace to follow its values:

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, and SPICE_VALUE::ToSpiceString().

Referenced by SIM_PLOT_FRAME().

◆ OnKicadAbout()

void EDA_BASE_FRAME::OnKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 652 of file eda_base_frame.cpp.

653 {
654  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
655  ShowAboutDialog( this );
656 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
The base frame for deriving all KiCad main window classes.

References ShowAboutDialog().

◆ OnMenuOpen()

void EDA_BASE_FRAME::OnMenuOpen ( wxMenuEvent &  event)
inherited

Workaround some issues in wxWidgets where the menu events aren't captured by the menus themselves.

Definition at line 350 of file eda_base_frame.cpp.

351 {
352  //
353  // wxWidgets has several issues that we have to work around:
354  //
355  // 1) wxWidgets 3.0.x Windows has a bug where wxEVT_MENU_OPEN and wxEVT_MENU_HIGHLIGHT
356  // events are not captured by the ACTON_MENU menus. So we forward them here.
357  // (FWIW, this one is fixed in wxWidgets 3.1.x.)
358  //
359  // 2) wxWidgets doesn't pass the menu pointer for wxEVT_MENU_HIGHLIGHT events. So we
360  // store the menu pointer from the wxEVT_MENU_OPEN call.
361  //
362  // 3) wxWidgets has no way to tell whether a command is from a menu selection or a
363  // hotkey. So we keep track of menu highlighting so we can differentiate.
364  //
365 
366  static ACTION_MENU* currentMenu;
367 
368  if( event.GetEventType() == wxEVT_MENU_OPEN )
369  {
370  currentMenu = dynamic_cast<ACTION_MENU*>( event.GetMenu() );
371 
372  if( currentMenu )
373  currentMenu->OnMenuEvent( event );
374  }
375  else if( event.GetEventType() == wxEVT_MENU_HIGHLIGHT )
376  {
377  if( currentMenu )
378  currentMenu->OnMenuEvent( event );
379  }
380  else if( event.GetEventType() == wxEVT_MENU_CLOSE )
381  {
382  if( currentMenu )
383  currentMenu->OnMenuEvent( event );
384 
385  currentMenu = nullptr;
386  }
387 
388  event.Skip();
389 }
ACTION_MENU.
Definition: action_menu.h:43
void OnMenuEvent(wxMenuEvent &aEvent)

References ACTION_MENU::OnMenuEvent().

◆ OnMove()

virtual void EDA_BASE_FRAME::OnMove ( wxMoveEvent &  aEvent)
inlinevirtualinherited

Reimplemented in EDA_DRAW_FRAME.

Definition at line 296 of file eda_base_frame.h.

297  {
298  aEvent.Skip();
299  }

◆ onPlotChanged()

void SIM_PLOT_FRAME::onPlotChanged ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1208 of file sim_plot_frame.cpp.

1209 {
1210  updateSignalList();
1211  updateCursors();
1212 }
void updateCursors()
Updates the cursor values list.
void updateSignalList()
Updates the list of currently plotted signals.

References updateCursors(), and updateSignalList().

◆ onPlotClose()

void SIM_PLOT_FRAME::onPlotClose ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1190 of file sim_plot_frame.cpp.

1191 {
1192  int idx = event.GetSelection();
1193 
1194  if( idx == wxNOT_FOUND )
1195  return;
1196 
1197  SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( m_plotNotebook->GetPage( idx ) );
1198 
1199  if( !plotPanel )
1200  return;
1201 
1202  m_plots.erase( plotPanel );
1203  updateSignalList();
1204  updateCursors();
1205 }
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.

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

◆ OnPreferences()

void EDA_BASE_FRAME::OnPreferences ( wxCommandEvent &  event)
inherited

Definition at line 659 of file eda_base_frame.cpp.

660 {
661  PAGED_DIALOG dlg( this, _( "Preferences" ) );
662  wxTreebook* book = dlg.GetTreebook();
663 
664  book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
665 
666  PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
667  book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
668 
669  for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
670  {
671  KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
672 
673  if( frame )
674  frame->InstallPreferences( &dlg, hotkeysPanel );
675  }
676 
677  // The Kicad manager frame is not a player so we have to add it by hand
678  wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
679 
680  if( manager )
681  static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
682 
683  for( int i = 0; i < book->GetPageCount(); ++i )
684  book->GetPage( i )->Layout();
685 
686  if( dlg.ShowModal() == wxID_OK )
687  dlg.Kiway().CommonSettingsChanged( false );
688 }
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:59
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
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:341
#define KICAD_MANAGER_FRAME_NAME
#define _(s)
Definition: 3d_actions.cpp:33
virtual void InstallPreferences(PAGED_DIALOG *, PANEL_HOTKEYS_EDITOR *)
Function InstallPreferences Allow a frame to load its preference panels (if any) into the preferences...

References _, KIWAY::CommonSettingsChanged(), PAGED_DIALOG::GetTreebook(), EDA_BASE_FRAME::InstallPreferences(), KICAD_MANAGER_FRAME_NAME, KIWAY_HOLDER::Kiway(), KIWAY_PLAYER_COUNT, and KIWAY::Player().

◆ onProbe()

void SIM_PLOT_FRAME::onProbe ( wxCommandEvent &  event)
private

Definition at line 1304 of file sim_plot_frame.cpp.

1305 {
1306  if( m_schematicFrame == NULL )
1307  return;
1308 
1310  m_schematicFrame->Raise();
1311 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
SCH_EDIT_FRAME * m_schematicFrame
#define NULL
static TOOL_ACTION simProbe
Definition: ee_actions.h:198

References EDA_BASE_FRAME::GetToolManager(), m_schematicFrame, NULL, TOOL_MANAGER::RunAction(), and EE_ACTIONS::simProbe.

Referenced by SIM_PLOT_FRAME().

◆ onSettings()

void SIM_PLOT_FRAME::onSettings ( wxCommandEvent &  event)
private

Definition at line 1252 of file sim_plot_frame.cpp.

1253 {
1254  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1255 
1256  // Initial processing is required to e.g. display a list of power sources
1258 
1259  if( !m_exporter->ProcessNetlist( NET_ALL_FLAGS ) )
1260  {
1261  DisplayError( this, _( "There were errors during netlist export, aborted." ) );
1262  return;
1263  }
1264 
1265  if( !m_settingsDlg )
1266  m_settingsDlg = new DIALOG_SIM_SETTINGS( this );
1267 
1268  if( plotPanel )
1269  m_settingsDlg->SetSimCommand( m_plots[plotPanel].m_simCommand );
1270 
1272 
1273  if( m_settingsDlg->ShowModal() == wxID_OK )
1274  {
1275  wxString newCommand = m_settingsDlg->GetSimCommand();
1276  SIM_TYPE newSimType = NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( newCommand );
1277 
1278  // If it is a new simulation type, open a new plot
1279  if( !plotPanel || ( plotPanel && plotPanel->GetType() != newSimType ) )
1280  {
1281  plotPanel = NewPlotPanel( newSimType );
1282  }
1283 
1284  m_plots[plotPanel].m_simCommand = newCommand;
1285  }
1286 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
bool SetSimCommand(const wxString &aCommand)
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Returns simulation type basing on a simulation command directive.
const wxString & GetSimCommand() const
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
void SetNetlistExporter(NETLIST_EXPORTER_PSPICE_SIM *aExporter)
DIALOG_SIM_SETTINGS * m_settingsDlg
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
void updateNetlistExporter()
Reloads the current schematic for the netlist exporter.
#define _(s)
Definition: 3d_actions.cpp:33
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
SIM_TYPE GetType() const
SIM_PLOT_PANEL * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.

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

◆ onShowNetlist()

void SIM_PLOT_FRAME::onShowNetlist ( wxCommandEvent &  event)
private

Definition at line 1323 of file sim_plot_frame.cpp.

1324 {
1325  class NETLIST_VIEW_DIALOG : public wxDialog
1326  {
1327  public:
1328  enum
1329  {
1330  MARGIN_LINE_NUMBERS
1331  };
1332 
1333  void onClose( wxCloseEvent& evt )
1334  {
1335  EndModal( GetReturnCode() );
1336  }
1337 
1338  NETLIST_VIEW_DIALOG(wxWindow* parent, wxString source) :
1339  wxDialog(parent, wxID_ANY, "SPICE Netlist",
1340  wxDefaultPosition, wxSize(1500,900),
1341  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
1342  {
1343  wxStyledTextCtrl* text = new wxStyledTextCtrl( this, wxID_ANY );
1344 
1345  text->SetMarginWidth( MARGIN_LINE_NUMBERS, 50 );
1346  text->StyleSetForeground( wxSTC_STYLE_LINENUMBER, wxColour( 75, 75, 75 ) );
1347  text->StyleSetBackground( wxSTC_STYLE_LINENUMBER, wxColour( 220, 220, 220 ) );
1348  text->SetMarginType( MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER );
1349 
1350  text->SetWrapMode( wxSTC_WRAP_WORD );
1351 
1352  text->SetText( source );
1353 
1354  text->StyleClearAll();
1355  text->SetLexer( wxSTC_LEX_SPICE );
1356 
1357  wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
1358  sizer->Add( text, 1, wxEXPAND );
1359  SetSizer( sizer );
1360 
1361  Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ), NULL,
1362  this );
1363  }
1364  };
1365 
1366  if( m_schematicFrame == NULL || m_simulator == NULL )
1367  return;
1368 
1369  NETLIST_VIEW_DIALOG dlg( this, m_simulator->GetNetlist() );
1370  dlg.ShowModal();
1371 }
std::shared_ptr< SPICE_SIMULATOR > m_simulator
SCH_EDIT_FRAME * m_schematicFrame
#define NULL
void onClose(wxCloseEvent &aEvent)

References m_schematicFrame, m_simulator, NULL, and onClose().

Referenced by SIM_PLOT_FRAME().

◆ onSignalDblClick()

void SIM_PLOT_FRAME::onSignalDblClick ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1215 of file sim_plot_frame.cpp.

1216 {
1217  // Remove signal from the plot panel when double clicked
1218  long idx = m_signals->GetFocusedItem();
1219 
1220  if( idx != wxNOT_FOUND )
1221  removePlot( m_signals->GetItemText( idx, 0 ) );
1222 }
void removePlot(const wxString &aPlotName, bool aErase=true)
Removes a plot with a specific title.

References SIM_PLOT_FRAME_BASE::m_signals, and removePlot().

◆ onSignalRClick()

void SIM_PLOT_FRAME::onSignalRClick ( wxListEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1225 of file sim_plot_frame.cpp.

1226 {
1227  int idx = event.GetIndex();
1228 
1229  if( idx != wxNOT_FOUND )
1230  m_signals->Select( idx );
1231 
1232  idx = m_signals->GetFirstSelected();
1233 
1234  if( idx != wxNOT_FOUND )
1235  {
1236  const wxString& netName = m_signals->GetItemText( idx, 0 );
1237  SIGNAL_CONTEXT_MENU ctxMenu( netName, this );
1238  m_signals->PopupMenu( &ctxMenu );
1239  }
1240 }

References SIM_PLOT_FRAME_BASE::m_signals.

◆ onSimFinished()

void SIM_PLOT_FRAME::onSimFinished ( wxCommandEvent &  aEvent)
private
Todo:
do not make it hardcoded for ngspice

Definition at line 1441 of file sim_plot_frame.cpp.

1442 {
1443  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_run_xpm ) );
1444  SetCursor( wxCURSOR_ARROW );
1445 
1446  SIM_TYPE simType = m_exporter->GetSimType();
1447 
1448  if( simType == ST_UNKNOWN )
1449  return;
1450 
1451  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1452 
1453  if( !plotPanel || plotPanel->GetType() != simType )
1454  plotPanel = NewPlotPanel( simType );
1455 
1456  if( IsSimulationRunning() )
1457  return;
1458 
1459  // If there are any signals plotted, update them
1460  if( SIM_PLOT_PANEL::IsPlottable( simType ) )
1461  {
1462  TRACE_MAP& traceMap = m_plots[plotPanel].m_traces;
1463 
1464  for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */)
1465  {
1466  if( !updatePlot( it->second, plotPanel ) )
1467  {
1468  removePlot( it->first, false );
1469  it = traceMap.erase( it ); // remove a plot that does not exist anymore
1470  }
1471  else
1472  {
1473  ++it;
1474  }
1475  }
1476 
1477  updateSignalList();
1478  plotPanel->UpdateAll();
1479  plotPanel->ResetScales();
1480  }
1481  else
1482  {
1484  for( const auto& net : m_exporter->GetNetIndexMap() )
1485  {
1486  int node = net.second;
1487 
1488  if( node > 0 )
1489  m_simulator->Command( wxString::Format( "print v(%d)", node ).ToStdString() );
1490  }
1491  }
1492 }
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:2836
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
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()
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.
const BITMAP_OPAQUE sim_run_xpm[1]
Definition: sim_run.cpp:35
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).
std::map< wxString, TRACE_DESC > TRACE_MAP
SIM_TYPE GetType() const
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.

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(), sim_run_xpm, ST_UNKNOWN, mpWindow::UpdateAll(), updatePlot(), and updateSignalList().

Referenced by SIM_PLOT_FRAME().

◆ onSimReport()

void SIM_PLOT_FRAME::onSimReport ( wxCommandEvent &  aEvent)
private

Definition at line 1517 of file sim_plot_frame.cpp.

1518 {
1519  m_simConsole->AppendText( aEvent.GetString() + "\n" );
1520  m_simConsole->SetInsertionPointEnd();
1521 }

References SIM_PLOT_FRAME_BASE::m_simConsole.

Referenced by SIM_PLOT_FRAME().

◆ onSimStarted()

void SIM_PLOT_FRAME::onSimStarted ( wxCommandEvent &  aEvent)
private

Definition at line 1434 of file sim_plot_frame.cpp.

1435 {
1436  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_stop_xpm ) );
1437  SetCursor( wxCURSOR_ARROWWAIT );
1438 }
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
const BITMAP_OPAQUE sim_stop_xpm[1]
Definition: sim_stop.cpp:20

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

Referenced by SIM_PLOT_FRAME().

◆ onSimulate()

void SIM_PLOT_FRAME::onSimulate ( wxCommandEvent &  event)
private

Definition at line 1243 of file sim_plot_frame.cpp.

1244 {
1245  if( IsSimulationRunning() )
1246  StopSimulation();
1247  else
1248  StartSimulation();
1249 }
bool IsSimulationRunning()

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

Referenced by SIM_PLOT_FRAME().

◆ onSimUpdate()

void SIM_PLOT_FRAME::onSimUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 1495 of file sim_plot_frame.cpp.

1496 {
1497  if( IsSimulationRunning() )
1498  StopSimulation();
1499 
1500  if( CurrentPlot() != m_lastSimPlot )
1501  {
1502  // We need to rerun simulation, as the simulator currently stores
1503  // results for another plot
1504  StartSimulation();
1505  }
1506  else
1507  {
1508  // Incremental update
1509  m_simConsole->Clear();
1510  // Do not export netlist, it is already stored in the simulator
1511  applyTuners();
1512  m_simulator->Run();
1513  }
1514 }
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).

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

Referenced by SIM_PLOT_FRAME().

◆ onTune()

void SIM_PLOT_FRAME::onTune ( wxCommandEvent &  event)
private

Definition at line 1314 of file sim_plot_frame.cpp.

1315 {
1316  if( m_schematicFrame == NULL )
1317  return;
1318 
1320  m_schematicFrame->Raise();
1321 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
SCH_EDIT_FRAME * m_schematicFrame
#define NULL
static TOOL_ACTION simTune
Definition: ee_actions.h:199

References EDA_BASE_FRAME::GetToolManager(), m_schematicFrame, NULL, TOOL_MANAGER::RunAction(), and EE_ACTIONS::simTune.

Referenced by SIM_PLOT_FRAME().

◆ OpenProjectFiles()

virtual bool KIWAY_PLAYER::OpenProjectFiles ( const std::vector< wxString > &  aFileList,
int  aCtl = 0 
)
inlinevirtualinherited

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.

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, FOOTPRINT_EDIT_FRAME, GERBVIEW_FRAME, CVPCB_MAINFRAME, and BM2CMP_FRAME.

Definition at line 118 of file kiway_player.h.

119  {
120  // overload me for your wxFrame type.
121 
122  // Any overload should probably do this also:
123  // Prj().MaybeLoadProjectSettings();
124 
125  // Then update the window title.
126 
127  return false;
128  }

Referenced by PCB_EDIT_FRAME::FetchNetlistFromSchematic(), PGM_SINGLE_TOP::MacOpenFile(), PGM_TEST_FRAME::MacOpenFile(), PGM_MOCK_EESCHEMA_FRAME::MacOpenFile(), SCH_EDIT_FRAME::OnOpenPcbnew(), PGM_SINGLE_TOP::OnPgmInit(), SCH_EDIT_FRAME::OnUpdatePCB(), and PCB_EDIT_FRAME::RunEeschema().

◆ PopTool()

void EDA_BASE_FRAME::PopTool ( const std::string &  actionName)
virtualinherited

Definition at line 214 of file eda_base_frame.cpp.

215 {
216  // Push/pop events can get out of order (such as when they're generated by the Simulator
217  // frame but not processed until the mouse is back in the Schematic frame), so make sure
218  // we're popping the right stack frame.
219 
220  for( int i = m_toolStack.size() - 1; i >= 0; --i )
221  {
222  if( m_toolStack[ i ] == actionName )
223  {
224  m_toolStack.erase( m_toolStack.begin() + i );
225 
226  // If there's something underneath us, and it's now the top of the stack, then
227  // re-activate it
228  if( ( --i ) >= 0 && i == (int)m_toolStack.size() - 1 )
229  {
230  std::string back = m_toolStack[ i ];
232 
233  if( action )
234  {
235  // Pop the action as running it will push it back onto the stack
236  m_toolStack.pop_back();
237 
238  TOOL_EVENT evt = action->MakeEvent();
239  evt.SetHasPosition( false );
240  GetToolManager()->PostEvent( evt );
241  }
242  }
243  else
245 
246  return;
247  }
248  }
249 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
TOOL_ACTION * FindAction(const std::string &aActionName) const
Function FindAction() Finds an action with a given name (if there is one available).
virtual void DisplayToolMsg(const wxString &msg)
TOOL_EVENT.
Definition: tool_event.h:171
std::vector< std::string > m_toolStack
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:193
TOOL_ACTION.
Definition: tool_action.h:46
TOOL_EVENT MakeEvent() const
Function MakeEvent() Returns the event associated with the action (i.e.
Definition: tool_action.h:107
TOOL_MANAGER * m_toolManager
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267
static TOOL_ACTION selectionTool
Definition: actions.h:146
void SetHasPosition(bool aHasPosition)
Definition: tool_event.h:261

References EDA_BASE_FRAME::DisplayToolMsg(), ACTION_MANAGER::FindAction(), TOOL_MANAGER::GetActionManager(), EDA_BASE_FRAME::GetToolManager(), EDA_BASE_FRAME::m_toolManager, EDA_BASE_FRAME::m_toolStack, TOOL_ACTION::MakeEvent(), TOOL_MANAGER::PostEvent(), ACTIONS::selectionTool, and TOOL_EVENT::SetHasPosition().

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ PrintMsg()

void EDA_BASE_FRAME::PrintMsg ( const wxString &  text)
inherited

Definition at line 593 of file eda_base_frame.cpp.

594 {
595  SetStatusText( text );
596 }

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

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

Definition at line 35 of file kiway_holder.cpp.

36 {
37  return Kiway().Prj();
38 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:171

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), LIB_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), 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_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PCB_EDIT_FRAME::doAutoSave(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedSymbol(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectFile(), CVPCB_MAINFRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), MODULE_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), SCH_DRAWING_TOOLS::PlaceComponent(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Print(), SCH_EDIT_FRAME::PrintPage(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ ProcessEvent()

bool EDA_BASE_FRAME::ProcessEvent ( wxEvent &  aEvent)
overrideinherited

Override 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 270 of file eda_base_frame.cpp.

271 {
272 #ifdef __WXMAC__
273  // Apple in its infinite wisdom will raise a disabled window before even passing
274  // us the event, so we have no way to stop it. Instead, we have to catch an
275  // improperly ordered disabled window and quasi-modal dialog here and reorder
276  // them.
277  if( !IsEnabled() && IsActive() )
278  {
279  wxWindow* dlg = findQuasiModalDialog();
280  if( dlg )
281  dlg->Raise();
282  }
283 #endif
284 
285  if( !wxFrame::ProcessEvent( aEvent ) )
286  return false;
287 
288  if( IsShown() && m_hasAutoSave && IsActive() &&
290  {
291  if( !m_autoSaveState )
292  {
293  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
294  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
295  m_autoSaveState = true;
296  }
297  else if( m_autoSaveTimer->IsRunning() )
298  {
299  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
300  m_autoSaveTimer->Stop();
301  m_autoSaveState = false;
302  }
303  }
304 
305  return true;
306 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
virtual bool isAutoSaveRequired() const
Return the auto save status of the application.
wxTimer * m_autoSaveTimer
wxWindow * findQuasiModalDialog()

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 COMMON_TOOLS::GridProperties(), LIB_VIEW_FRAME::onSelectNextSymbol(), LIB_VIEW_FRAME::onSelectPreviousSymbol(), KIWAY::ProcessEvent(), and LIB_VIEW_FRAME::ReCreateListCmp().

◆ PushTool()

void EDA_BASE_FRAME::PushTool ( const std::string &  actionName)
virtualinherited

NB: the definition of "tool" is different at the user level.

The implementation uses a single TOOL_BASE derived class to implement several user "tools", such as rectangle and circle, or wire and bus. So each user-level tool is actually a TOOL_ACTION.

Definition at line 197 of file eda_base_frame.cpp.

198 {
199  m_toolStack.push_back( actionName );
200 
201  // Human cognitive stacking is very shallow; deeper tool stacks just get annoying
202  if( m_toolStack.size() > 3 )
203  m_toolStack.erase( m_toolStack.begin() );
204 
205  TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
206 
207  if( action )
208  DisplayToolMsg( action->GetLabel() );
209  else
210  DisplayToolMsg( actionName );
211 }
TOOL_ACTION * FindAction(const std::string &aActionName) const
Function FindAction() Finds an action with a given name (if there is one available).
virtual void DisplayToolMsg(const wxString &msg)
wxString GetLabel() const
Definition: tool_action.cpp:69
std::vector< std::string > m_toolStack
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:193
TOOL_ACTION.
Definition: tool_action.h:46
TOOL_MANAGER * m_toolManager

References EDA_BASE_FRAME::DisplayToolMsg(), ACTION_MANAGER::FindAction(), TOOL_MANAGER::GetActionManager(), TOOL_ACTION::GetLabel(), EDA_BASE_FRAME::m_toolManager, and EDA_BASE_FRAME::m_toolStack.

Referenced by PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ ReCreateMenuBar()

void EDA_BASE_FRAME::ReCreateMenuBar ( )
virtualinherited

◆ RefreshCanvas()

virtual void EDA_BASE_FRAME::RefreshCanvas ( )
inlinevirtualinherited

Notification to refresh the drawing canvas (if any).

Reimplemented in EDA_DRAW_FRAME.

Definition at line 515 of file eda_base_frame.h.

515 { };

◆ removePlot()

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 609 of file sim_plot_frame.cpp.

610 {
611  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
612 
613  if( !plotPanel )
614  return;
615 
616  if( aErase )
617  {
618  auto& traceMap = m_plots[plotPanel].m_traces;
619  auto traceIt = traceMap.find( aPlotName );
620  wxASSERT( traceIt != traceMap.end() );
621  traceMap.erase( traceIt );
622  }
623 
624  wxASSERT( plotPanel->TraceShown( aPlotName ) );
625  plotPanel->DeleteTrace( aPlotName );
626  plotPanel->Fit();
627 
629  updateCursors();
630 }
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:2014
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).
bool TraceShown(const wxString &aName) const

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

Referenced by onSignalDblClick(), and onSimFinished().

◆ RemoveShutdownBlockReason()

void EDA_BASE_FRAME::RemoveShutdownBlockReason ( )
inherited

Removes any shutdown block reason set.

Definition at line 169 of file eda_base_frame.cpp.

170 {
171 #if defined( _WIN32 )
172  // Windows: Destroys any block reason that may have existed
173  ShutdownBlockReasonDestroy( GetHandle() );
174 #endif
175 }

Referenced by EDA_BASE_FRAME::~EDA_BASE_FRAME().

◆ RemoveTuner()

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 534 of file sim_plot_frame.cpp.

535 {
536  if( aErase )
537  m_tuners.remove( aTuner );
538 
539  aTuner->Destroy();
540  m_tunePanel->Layout();
541 }
std::list< TUNER_SLIDER * > m_tuners
List of currently displayed tuners

References SIM_PLOT_FRAME_BASE::m_tunePanel, and m_tuners.

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

◆ SaveProjectSettings()

virtual void EDA_BASE_FRAME::SaveProjectSettings ( )
inlinevirtualinherited

Save 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 392 of file eda_base_frame.h.

392 {};

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

◆ SaveSettings()

void SIM_PLOT_FRAME::SaveSettings ( APP_SETTINGS_BASE aCfg)
overridevirtual

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 236 of file sim_plot_frame.cpp.

237 {
238  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
239  wxASSERT( cfg );
240 
242 
243  cfg->m_Simulator.plot_panel_width = m_splitterLeftRight->GetSashPosition();
244  cfg->m_Simulator.plot_panel_height = m_splitterPlotAndConsole->GetSashPosition();
245  cfg->m_Simulator.signal_panel_height = m_splitterSignals->GetSashPosition();
246  cfg->m_Simulator.cursors_panel_height = m_splitterTuneValues->GetSashPosition();
247  cfg->m_Simulator.white_background = m_plotUseWhiteBg;
248 }
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Saves common frame parameters to a configuration data file.
wxSplitterWindow * m_splitterSignals
wxSplitterWindow * m_splitterTuneValues
wxSplitterWindow * m_splitterLeftRight
wxSplitterWindow * m_splitterPlotAndConsole

References m_plotUseWhiteBg, SIM_PLOT_FRAME_BASE::m_splitterLeftRight, SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsole, SIM_PLOT_FRAME_BASE::m_splitterSignals, SIM_PLOT_FRAME_BASE::m_splitterTuneValues, and EDA_BASE_FRAME::SaveSettings().

Referenced by onClose().

◆ SaveWindowSettings()

void EDA_BASE_FRAME::SaveWindowSettings ( WINDOW_SETTINGS aCfg)
inherited

Saves window settings to the given settings object Normally called by SaveSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window.

Definition at line 523 of file eda_base_frame.cpp.

524 {
525  wxString text;
526 
527  if( IsIconized() )
528  return;
529 
530  wxString baseCfgName = ConfigBaseName();
531 
532  m_FrameSize = GetSize();
533  m_FramePos = GetPosition();
534 
535  aCfg->pos_x = m_FramePos.x;
536  aCfg->pos_y = m_FramePos.y;
537  aCfg->size_x = m_FrameSize.x;
538  aCfg->size_y = m_FrameSize.y;
539  aCfg->maximized = IsMaximized();
540 
541  // TODO(JE) should auto-save in common settings be overwritten by every app?
542  if( m_hasAutoSave )
543  Pgm().GetCommonSettings()->m_System.autosave_interval = m_autoSaveInterval;
544 
545  // Once this is fully implemented, wxAuiManager will be used to maintain
546  // the persistance of the main frame and all it's managed windows and
547  // all of the legacy frame persistence position code can be removed.
548  aCfg->perspective = m_auimgr.SavePerspective().ToStdString();
549 
550  aCfg->mru_path = m_mruPath;
551 }
wxString mru_path
Definition: app_settings.h:55
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
wxString m_mruPath
wxString ConfigBaseName()
wxAuiManager m_auimgr
wxString perspective
Definition: app_settings.h:58

References EDA_BASE_FRAME::ConfigBaseName(), EDA_BASE_FRAME::m_auimgr, EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_BASE_FRAME::m_hasAutoSave, EDA_BASE_FRAME::m_mruPath, WINDOW_SETTINGS::maximized, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, Pgm(), WINDOW_SETTINGS::pos_x, WINDOW_SETTINGS::pos_y, WINDOW_SETTINGS::size_x, WINDOW_SETTINGS::size_y, wxPoint::x, and wxPoint::y.

Referenced by EDA_BASE_FRAME::SaveSettings().

◆ saveWorkbook()

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 923 of file sim_plot_frame.cpp.

924 {
925 
926  wxString savePath = aPath;
927 
928  if( !savePath.Lower().EndsWith(".wbk"))
929  {
930  savePath += ".wbk";
931  };
932 
933 
934  wxTextFile file( savePath );
935 
936  if( file.Exists() )
937  {
938  if( !file.Open() )
939  return false;
940 
941  file.Clear();
942  }
943  else
944  {
945  file.Create();
946  }
947 
948  file.AddLine( wxString::Format( "%lu", m_plots.size() ) );
949 
950  for( const auto& plot : m_plots )
951  {
952  file.AddLine( wxString::Format( "%d", plot.first->GetType() ) );
953  file.AddLine( plot.second.m_simCommand );
954  file.AddLine( wxString::Format( "%lu", plot.second.m_traces.size() ) );
955 
956  for( const auto& trace : plot.second.m_traces )
957  {
958  file.AddLine( wxString::Format( "%d", trace.second.GetType() ) );
959  file.AddLine( trace.second.GetName() );
960  file.AddLine( trace.second.GetParam() );
961  }
962  }
963 
964  bool res = file.Write();
965  file.Close();
966 
967  return res;
968 }
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

References Format(), and m_plots.

Referenced by menuSaveWorkbook().

◆ SetAutoSaveInterval()

void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 309 of file eda_base_frame.cpp.

310 {
311  m_autoSaveInterval = aInterval;
312 
313  if( m_autoSaveTimer->IsRunning() )
314  {
315  if( m_autoSaveInterval > 0 )
316  {
317  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
318  }
319  else
320  {
321  m_autoSaveTimer->Stop();
322  m_autoSaveState = false;
323  }
324  }
325 }
wxTimer * m_autoSaveTimer

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

Referenced by EDA_DRAW_FRAME::CommonSettingsChanged().

◆ setIconsForMenuItems()

void SIM_PLOT_FRAME::setIconsForMenuItems ( )
private

Give icons to menuitems of the main menubar.

Definition at line 285 of file sim_plot_frame.cpp.

286 {
287  // Give icons to menuitems of the main menubar
288  BM_MENU_INIT_ITEM bm_list[]
289  {
290  // File menu:
291  { wxID_NEW, simulator_xpm },
292  { wxID_OPEN,directory_browser_xpm },
293  { wxID_SAVE, directory_xpm},
296  { wxID_CLOSE, exit_xpm},
297 
298  // simulator menu:
305 
306  // View menu
307  { wxID_ZOOM_IN, zoom_in_xpm},
308  { wxID_ZOOM_OUT, zoom_out_xpm},
309  { wxID_ZOOM_FIT, zoom_fit_in_page_xpm},
314 
315  { 0, nullptr } // Sentinel
316  };
317 
318  // wxMenuItems are already created and attached to the m_mainMenu wxMenuBar.
319  // A problem is the fact setting bitmaps in wxMenuItems after they are attached
320  // to a wxMenu do not work in all cases.
321  // So the trick is:
322  // Remove the wxMenuItem from its wxMenu
323  // Set the bitmap
324  // Insert the modified wxMenuItem to its previous place
325  for( int ii = 0; bm_list[ii].m_MenuId; ++ii )
326  {
327  wxMenuItem* item = m_mainMenu->FindItem( bm_list[ii].m_MenuId );
328 
329  if( !item || !bm_list[ii].m_Bitmap)
330  continue;
331 
332  wxMenu* menu = item->GetMenu();
333  // Calculate the initial index of item inside the wxMenu parent
334  wxMenuItemList& mlist = menu->GetMenuItems();
335  int mpos = mlist.IndexOf( item );
336 
337  if( mpos >= 0 ) // Should be always the case
338  {
339  // Modify the bitmap
340  menu->Remove( item );
341  AddBitmapToMenuItem( item, KiBitmap( bm_list[ii].m_Bitmap ) );
342  // Insert item to its the initial index
343  menu->Insert( mpos, item );
344  }
345  }
346 }
const BITMAP_OPAQUE simulator_xpm[1]
Definition: simulator.cpp:52
#define ID_MENU_PROBE_SIGNALS
const BITMAP_OPAQUE swap_layer_xpm[1]
Definition: swap_layer.cpp:33
#define ID_SAVE_AS_IMAGE
const BITMAP_OPAQUE add_dashed_line_xpm[1]
const BITMAP_OPAQUE directory_browser_xpm[1]
const BITMAP_OPAQUE text_xpm[1]
Definition: text.cpp:27
const BITMAP_OPAQUE zoom_fit_in_page_xpm[1]
#define ID_MENU_WHITE_BG
#define ID_SAVE_AS_CSV
const BITMAP_OPAQUE zoom_out_xpm[1]
Definition: zoom_out.cpp:58
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
const BITMAP_OPAQUE sim_add_signal_xpm[1]
void AddBitmapToMenuItem(wxMenuItem *aMenu, const wxBitmap &aImage)
Add a bitmap to a menuitem.
Definition: bitmap.cpp:223
#define ID_MENU_SHOW_NETLIST
#define ID_MENU_TUNE_SIGNALS
const BITMAP_OPAQUE exit_xpm[1]
Definition: exit.cpp:63
const BITMAP_OPAQUE grid_xpm[1]
Definition: grid.cpp:21
const BITMAP_OPAQUE export_xpm[1]
Definition: export.cpp:75
#define ID_MENU_SHOW_LEGEND
#define ID_MENU_SET_SIMUL
const BITMAP_OPAQUE directory_xpm[1]
Definition: directory.cpp:30
const BITMAP_OPAQUE sim_probe_xpm[1]
Definition: sim_probe.cpp:52
#define ID_MENU_ADD_SIGNAL
const BITMAP_OPAQUE sim_tune_xpm[1]
Definition: sim_tune.cpp:39
#define ID_MENU_SHOW_GRID
#define ID_MENU_DOTTED
const BITMAP_OPAQUE netlist_xpm[1]
const BITMAP_OPAQUE sim_run_xpm[1]
Definition: sim_run.cpp:35
const BITMAP_OPAQUE sim_settings_xpm[1]
#define ID_MENU_RUN_SIM
const BITMAP_OPAQUE zoom_in_xpm[1]
Definition: zoom_in.cpp:59

References add_dashed_line_xpm, AddBitmapToMenuItem(), directory_browser_xpm, directory_xpm, exit_xpm, export_xpm, grid_xpm, ID_MENU_ADD_SIGNAL, ID_MENU_DOTTED, ID_MENU_PROBE_SIGNALS, ID_MENU_RUN_SIM, ID_MENU_SET_SIMUL, ID_MENU_SHOW_GRID, ID_MENU_SHOW_LEGEND, ID_MENU_SHOW_NETLIST, ID_MENU_TUNE_SIGNALS, ID_MENU_WHITE_BG, ID_SAVE_AS_CSV, ID_SAVE_AS_IMAGE, KiBitmap(), SIM_PLOT_FRAME_BASE::m_mainMenu, netlist_xpm, sim_add_signal_xpm, sim_probe_xpm, sim_run_xpm, sim_settings_xpm, sim_tune_xpm, simulator_xpm, swap_layer_xpm, text_xpm, zoom_fit_in_page_xpm, zoom_in_xpm, and zoom_out_xpm.

Referenced by SIM_PLOT_FRAME().

◆ SetKiway()

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 42 of file kiway_holder.cpp.

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

References KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), InvokePcbLibTableEditor(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME().

◆ SetModal()

void KIWAY_PLAYER::SetModal ( bool  aIsModal)
inlineinherited

Definition at line 164 of file kiway_player.h.

164 { m_modal = aIsModal; }

References KIWAY_PLAYER::m_modal.

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

◆ SetMruPath()

void EDA_BASE_FRAME::SetMruPath ( const wxString &  aPath)
inlineinherited

Definition at line 440 of file eda_base_frame.h.

440 { m_mruPath = aPath; }
wxString m_mruPath

References EDA_BASE_FRAME::m_mruPath.

Referenced by PANEL_HOTKEYS_EDITOR::ImportHotKeys(), and KICAD_MANAGER_FRAME::LoadProject().

◆ SetShutdownBlockReason()

void EDA_BASE_FRAME::SetShutdownBlockReason ( const wxString &  reason)
inherited

Sets the block reason why the window/application is preventing OS shutdown.

This should be set far ahead of any close event.

This is mainly intended for Windows platforms where this is a native feature.

Definition at line 178 of file eda_base_frame.cpp.

179 {
180 #if defined( _WIN32 )
181  // Windows: sets up the pretty message on the shutdown page on why it's being "blocked"
182  // This is used in conjunction with handling WM_QUERYENDSESSION (wxCloseEvent)
183  // ShutdownBlockReasonCreate does not block by itself
184 
185  ShutdownBlockReasonDestroy( GetHandle() ); // Destroys any existing or nonexisting reason
186 
187  if( !ShutdownBlockReasonCreate( GetHandle(), aReason.wc_str() ) )
188  {
189  // Nothing bad happens if this fails, at worst it uses a generic application is preventing shutdown message
190  wxLogDebug( wxT( "ShutdownBlockReasonCreate failed to set reason: %s" ), aReason );
191  }
192 #endif
193 }

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), and SCH_EDIT_FRAME::OpenProjectFiles().

◆ setSubWindowsSashSize()

void SIM_PLOT_FRAME::setSubWindowsSashSize ( )
private

Definition at line 349 of file sim_plot_frame.cpp.

350 {
353 
356 
359 
362 }
wxSplitterWindow * m_splitterSignals
int m_splitterPlotAndConsoleSashPosition
wxSplitterWindow * m_splitterTuneValues
wxSplitterWindow * m_splitterLeftRight
int m_splitterTuneValuesSashPosition
int m_splitterSignalsSashPosition
int m_splitterLeftRightSashPosition
wxSplitterWindow * m_splitterPlotAndConsole

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

◆ SetUserUnits()

◆ ShowChangedLanguage()

void EDA_BASE_FRAME::ShowChangedLanguage ( )
virtualinherited

◆ ShowModal()

bool KIWAY_PLAYER::ShowModal ( wxString *  aResult = NULL,
wxWindow *  aResultantFocusWindow = NULL 
)
virtualinherited

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.

Reimplemented in FOOTPRINT_VIEWER_FRAME, and LIB_VIEW_FRAME.

Definition at line 75 of file kiway_player.cpp.

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

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 FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ StartSimulation()

void SIM_PLOT_FRAME::StartSimulation ( )

Definition at line 415 of file sim_plot_frame.cpp.

416 {
417  STRING_FORMATTER formatter;
418  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
419 
420  if( !m_settingsDlg )
421  m_settingsDlg = new DIALOG_SIM_SETTINGS( this );
422 
423  m_simConsole->Clear();
425 
426  if( plotPanel )
427  m_exporter->SetSimCommand( m_plots[plotPanel].m_simCommand );
428 
429  if( !m_exporter->Format( &formatter, m_settingsDlg->GetNetlistOptions() ) )
430  {
431  DisplayError( this, _( "There were errors during netlist export, aborted." ) );
432  return;
433  }
434 
435  if( m_exporter->GetSimType() == ST_UNKNOWN )
436  {
437  DisplayInfoMessage( this, _( "You need to select the simulation settings first." ) );
438  return;
439  }
440 
441  m_simulator->LoadNetlist( formatter.GetString() );
442  updateTuners();
443  applyTuners();
444  m_simulator->Run();
445 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
void applyTuners()
Applies component values specified using tunder sliders to the current netlist.
std::shared_ptr< SPICE_SIMULATOR > m_simulator
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.
#define _(s)
Definition: 3d_actions.cpp:33
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)
Display an informational message box with aMessage.
Definition: confirm.cpp:267
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
void updateTuners()
Filters out tuners for components that do not exist anymore.

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

◆ StopSimulation()

void SIM_PLOT_FRAME::StopSimulation ( )

Definition at line 448 of file sim_plot_frame.cpp.

449 {
450  m_simulator->Stop();
451 }
std::shared_ptr< SPICE_SIMULATOR > m_simulator

References m_simulator.

Referenced by onSimulate(), and onSimUpdate().

◆ SupportsShutdownBlockReason()

bool EDA_BASE_FRAME::SupportsShutdownBlockReason ( )
inherited

Whether or not the window supports setting a shutdown block reason.

Definition at line 159 of file eda_base_frame.cpp.

160 {
161 #if defined( _WIN32 )
162  return true;
163 #else
164  return false;
165 #endif
166 }

Referenced by FOOTPRINT_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnCloseWindow(), and EDA_BASE_FRAME::~EDA_BASE_FRAME().

◆ SyncToolbars()

virtual void EDA_BASE_FRAME::SyncToolbars ( )
inlinevirtualinherited

Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, CVPCB_MAINFRAME, FOOTPRINT_EDIT_FRAME, EDA_3D_VIEWER, KICAD_MANAGER_FRAME, LIB_VIEW_FRAME, and DISPLAY_FOOTPRINTS_FRAME.

Definition at line 499 of file eda_base_frame.h.

499 { };

Referenced by EDA_DRAW_FRAME::RecreateToolbars(), PCB_BASE_EDIT_FRAME::SetGridVisibility(), and TOOL_MANAGER::UpdateUI().

◆ sys_search()

const SEARCH_STACK & EDA_BASE_FRAME::sys_search ( )
virtualinherited

Return a SEARCH_STACK pertaining to entire program.

This is overloaded in KICAD_MANAGER_FRAME

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 581 of file eda_base_frame.cpp.

582 {
583  return Kiface().KifaceSearch();
584 }
SEARCH_STACK & KifaceSearch()
Only for DSO specific 'non-library' files.
Definition: kiface_i.h:129
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

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

Referenced by COMMON_CONTROL::ShowHelp().

◆ ToolStackIsEmpty()

◆ unitsChangeRefresh()

virtual void EDA_BASE_FRAME::unitsChangeRefresh ( )
inlineprotectedvirtualinherited

Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them.

The default version only updates the status bar. Don't forget to call the default in your derived class or the status bar will not get updated properly.

Reimplemented in PCB_BASE_EDIT_FRAME, GERBVIEW_FRAME, EDA_DRAW_FRAME, and PCB_BASE_FRAME.

Definition at line 201 of file eda_base_frame.h.

201 { }

Referenced by EDA_BASE_FRAME::ChangeUserUnits().

◆ updateCursors()

void SIM_PLOT_FRAME::updateCursors ( )
private

Updates the cursor values list.

Definition at line 820 of file sim_plot_frame.cpp.

821 {
822  wxQueueEvent( this, new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
823 }

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

◆ UpdateFileHistory()

void EDA_BASE_FRAME::UpdateFileHistory ( const wxString &  FullFileName,
FILE_HISTORY aFileHistory = NULL 
)
inherited

Update the list of recently opened files.

The menu is also updated, if FILE_HISTORY::UseMenu was called at init time.

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

Definition at line 599 of file eda_base_frame.cpp.

600 {
601  FILE_HISTORY* fileHistory = aFileHistory;
602 
603  if( !fileHistory )
604  fileHistory = &Kiface().GetFileHistory();
605 
606  fileHistory->AddFileToHistory( FullFileName );
607 }
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:42
void AddFileToHistory(const wxString &aFile) override
Adds a file to the history.
Definition: filehistory.cpp:94
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:125

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

Referenced by SCH_EDIT_FRAME::importFile(), GERBVIEW_FRAME::LoadExcellonFiles(), GERBVIEW_FRAME::LoadGerberJobFile(), GERBVIEW_FRAME::loadListOfGerberAndDrillFiles(), KICAD_MANAGER_FRAME::LoadProject(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::SavePcbFile(), and GERBVIEW_FRAME::unarchiveFiles().

◆ updateNetlistExporter()

void SIM_PLOT_FRAME::updateNetlistExporter ( )
private

Reloads the current schematic for the netlist exporter.

Definition at line 633 of file sim_plot_frame.cpp.

634 {
636 }
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 one to override simulation commands.

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

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

◆ updatePlot()

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 639 of file sim_plot_frame.cpp.

640 {
641  SIM_TYPE simType = m_exporter->GetSimType();
642  wxString spiceVector = m_exporter->GetSpiceVector( aDescriptor.GetName(),
643  aDescriptor.GetType(), aDescriptor.GetParam() );
644 
645  if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
646  {
647  // There is no plot to be shown
648  m_simulator->Command( wxString::Format( "print %s", spiceVector ).ToStdString() );
649 
650  return false;
651  }
652 
653  // First, handle the x axis
654  wxString xAxisName( m_simulator->GetXAxis( simType ) );
655 
656  if( xAxisName.IsEmpty() )
657  return false;
658 
659  auto data_x = m_simulator->GetMagPlot( (const char*) xAxisName.c_str() );
660  unsigned int size = data_x.size();
661 
662  if( data_x.empty() )
663  return false;
664 
665  SIM_PLOT_TYPE plotType = aDescriptor.GetType();
666  std::vector<double> data_y;
667 
668  // Now, Y axis data
669  switch( m_exporter->GetSimType() )
670  {
671  case ST_AC:
672  {
673  wxASSERT_MSG( !( ( plotType & SPT_AC_MAG ) && ( plotType & SPT_AC_PHASE ) ),
674  "Cannot set both AC_PHASE and AC_MAG bits" );
675 
676  if( plotType & SPT_AC_MAG )
677  data_y = m_simulator->GetMagPlot( (const char*) spiceVector.c_str() );
678  else if( plotType & SPT_AC_PHASE )
679  data_y = m_simulator->GetPhasePlot( (const char*) spiceVector.c_str() );
680  else
681  wxASSERT_MSG( false, "Plot type missing AC_PHASE or AC_MAG bit" );
682  }
683  break;
684 
685  case ST_NOISE:
686  case ST_DC:
687  case ST_TRANSIENT:
688  {
689  data_y = m_simulator->GetMagPlot( (const char*) spiceVector.c_str() );
690  }
691  break;
692 
693  default:
694  wxASSERT_MSG( false, "Unhandled plot type" );
695  return false;
696  }
697 
698  if( data_y.size() != size )
699  return false;
700 
701  // If we did a two-source DC analysis, we need to split the resulting vector and add traces
702  // for each input step
703  SPICE_DC_PARAMS source1, source2;
704 
705  if( m_exporter->GetSimType() == ST_DC &&
706  m_exporter->ParseDCCommand( m_exporter->GetUsedSimCommand(), &source1, &source2 ) )
707  {
708  if( !source2.m_source.IsEmpty() )
709  {
710  // Source 1 is the inner loop, so lets add traces for each Source 2 (outer loop) step
711  SPICE_VALUE v = source2.m_vstart;
712  wxString name;
713 
714  size_t offset = 0;
715  size_t outer = ( size_t )( ( source2.m_vend - v ) / source2.m_vincrement ).ToDouble();
716  size_t inner = data_x.size() / ( outer + 1 );
717 
718  wxASSERT( data_x.size() % ( outer + 1 ) == 0 );
719 
720  for( size_t idx = 0; idx <= outer; idx++ )
721  {
722  name = wxString::Format( "%s (%s = %s V)", aDescriptor.GetTitle(),
723  source2.m_source, v.ToString() );
724 
725  std::vector<double> sub_x( data_x.begin() + offset,
726  data_x.begin() + offset + inner );
727  std::vector<double> sub_y( data_y.begin() + offset,
728  data_y.begin() + offset + inner );
729 
730  if( aPanel->AddTrace( name, inner,
731  sub_x.data(), sub_y.data(), aDescriptor.GetType() ) )
732  {
733  m_plots[aPanel].m_traces.insert( std::make_pair( name, aDescriptor ) );
734  }
735 
736  v = v + source2.m_vincrement;
737  offset += inner;
738  }
739 
740  return true;
741  }
742  }
743 
744  if( aPanel->AddTrace( aDescriptor.GetTitle(), size,
745  data_x.data(), data_y.data(), aDescriptor.GetType() ) )
746  {
747  m_plots[aPanel].m_traces.insert( std::make_pair( aDescriptor.GetTitle(), aDescriptor ) );
748  }
749 
750  return true;
751 }
const wxString & GetTitle() const
static bool IsPlottable(SIM_TYPE aSimType)
SIM_PLOT_TYPE GetType() const
std::shared_ptr< SPICE_SIMULATOR > m_simulator
const wxString & GetParam() const
wxString ToString() const
Returns string value as when converting double to string (e.g.
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
Helper class to handle Spice way of expressing values (e.g. 10.5 Meg)
Definition: spice_value.h:32
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)
const wxString & GetName() const
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
const char * name
Definition: DXF_plotter.cpp:60
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_TYPE
Possible plot types
Definition: sim_types.h:35

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, SPICE_DC_PARAMS::m_source, SPICE_DC_PARAMS::m_vend, SPICE_DC_PARAMS::m_vincrement, SPICE_DC_PARAMS::m_vstart, name, SPT_AC_MAG, SPT_AC_PHASE, ST_AC, ST_DC, ST_NOISE, ST_TRANSIENT, and SPICE_VALUE::ToString().

Referenced by addPlot(), and onSimFinished().

◆ updateSignalList()

void SIM_PLOT_FRAME::updateSignalList ( )
private

Updates the list of currently plotted signals.

Definition at line 754 of file sim_plot_frame.cpp.

755 {
756  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
757 
758  if( !plotPanel )
759  return;
760 
761  m_signals->ClearAll();
762 
763  wxSize size = m_signals->GetClientSize();
764  m_signals->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x );
765 
766  // Build an image list, to show the color of the corresponding trace
767  // in the plot panel
768  // This image list is used for trace and cursor lists
769  wxMemoryDC bmDC;
770  const int isize = bmDC.GetCharHeight();
771 
773  m_signalsIconColorList = new wxImageList( isize, isize, false );
774  else
775  m_signalsIconColorList->RemoveAll();
776 
777  for( const auto& trace : CurrentPlot()->GetTraces() )
778  {
779  wxBitmap bitmap( isize, isize );
780  bmDC.SelectObject( bitmap );
781  wxColour tcolor = trace.second->GetTraceColour();
782 
783  wxColour bgColor = m_signals->wxWindow::GetBackgroundColour();
784  bmDC.SetPen( wxPen( bgColor ) );
785  bmDC.SetBrush( wxBrush( bgColor ) );
786  bmDC.DrawRectangle( 0, 0, isize, isize ); // because bmDC.Clear() does not work in wxGTK
787 
788  bmDC.SetPen( wxPen( tcolor ) );
789  bmDC.SetBrush( wxBrush( tcolor ) );
790  bmDC.DrawRectangle( 0, isize / 4 + 1, isize, isize / 2 );
791 
792  bmDC.SelectObject( wxNullBitmap ); // Needed to initialize bitmap
793 
794  bitmap.SetMask( new wxMask( bitmap, *wxBLACK ) );
795  m_signalsIconColorList->Add( bitmap );
796  }
797 
798  if( bmDC.IsOk() )
799  {
800  bmDC.SetBrush( wxNullBrush );
801  bmDC.SetPen( wxNullPen );
802  }
803 
804  m_signals->SetImageList( m_signalsIconColorList, wxIMAGE_LIST_SMALL );
805 
806  // Fill the signals listctrl. Keep the order of names and
807  // the order of icon color identical, because the icons
808  // are also used in cursor list, and the color index is
809  // calculated from the trace name index
810  int imgidx = 0;
811 
812  for( const auto& trace : m_plots[plotPanel].m_traces )
813  {
814  m_signals->InsertItem( imgidx, trace.first, imgidx );
815  imgidx++;
816  }
817 }
wxImageList * m_signalsIconColorList
imagelists uset to add a small coloured icon to signal names and cursors name, the same color as the ...
std::map< SIM_PLOT_PANEL *, PLOT_INFO > m_plots
Map of plot panels and associated data
#define NULL
#define _(s)
Definition: 3d_actions.cpp:33
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

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

◆ UpdateStatusBar()

virtual void EDA_BASE_FRAME::UpdateStatusBar ( )
inlinevirtualinherited

Update the status bar information.

The status bar can draw itself. This is not a drawing function per se, but rather updates lines of text held by the components within the status bar which is owned by the wxFrame.

Reimplemented in EDA_DRAW_FRAME, GERBVIEW_FRAME, PCB_BASE_FRAME, and SCH_BASE_FRAME.

Definition at line 493 of file eda_base_frame.h.

493 { }

Referenced by TOOL_MANAGER::UpdateUI().

◆ updateTuners()

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 826 of file sim_plot_frame.cpp.

827 {
828  const auto& spiceItems = m_exporter->GetSpiceItems();
829 
830  for( auto it = m_tuners.begin(); it != m_tuners.end(); /* iteration inside the loop */ )
831  {
832  const wxString& ref = (*it)->GetComponentName();
833 
834  if( std::find_if( spiceItems.begin(), spiceItems.end(), [&]( const SPICE_ITEM& item )
835  {
836  return item.m_refName == ref;
837  }) == spiceItems.end() )
838  {
839  // The component does not exist anymore, remove the associated tuner
840  TUNER_SLIDER* tuner = *it;
841  it = m_tuners.erase( it );
842  RemoveTuner( tuner, false );