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 TOOLS_HOLDER KIWAY_HOLDER

Classes

struct  PLOT_INFO
 
class  SIGNAL_CONTEXT_MENU
 

Public Types

enum  UNDO_REDO_LIST { UNDO_LIST, REDO_LIST }
 Function ClearUndoORRedoList (virtual). More...
 
enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

 SIM_PLOT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 Constructor. More...
 
 ~SIM_PLOT_FRAME ()
 
void StartSimulation (const wxString &aSimCommand=wxEmptyString)
 
void StopSimulation ()
 
bool IsSimulationRunning ()
 
SIM_PANEL_BASENewPlotPanel (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...
 
wxWindow * GetToolCanvas () const override
 Canvas access. 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 void ParseArgs (wxCmdLineParser &aParser)
 Handles command-line arguments in a frame-specific way. 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 () const override
 Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame In modal mode, the caller that created the frame is responsible to Destroy() this frame after closing. More...
 
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)
 
virtual void ToggleUserUnits ()
 
SETTINGS_MANAGERGetSettingsManager () const
 
virtual int GetSeverity (int aErrorCode) const
 
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 OnMenuEvent (wxMenuEvent &event)
 The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't captured by the menus themselves. More...
 
virtual void RegisterUIUpdateHandler (const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions) override
 Register an action's update conditions with the UI layer to allow the UI to appropriately display the state of its controls. More...
 
virtual void RegisterUIUpdateHandler (int aID, const ACTION_CONDITIONS &aConditions)
 Register a UI update handler for the control with ID aID. More...
 
virtual void UnregisterUIUpdateHandler (const TOOL_ACTION &aAction) override
 Unregister a UI handler for an action that was registered using RegisterUIUpdateHandler. More...
 
virtual void UnregisterUIUpdateHandler (int aID)
 Unregister a UI handler for a given ID that was registered using RegisterUIUpdateHandler. More...
 
virtual void OnMove (wxMoveEvent &aEvent)
 
void OnMaximize (wxMaximizeEvent &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)
 
WX_INFOBARGetInfoBar ()
 
void ShowInfoBarError (const wxString &aErrorMsg)
 
void ShowInfoBarWarning (const wxString &aWarningMsg)
 
void ShowInfoBarMsg (const wxString &aMsg)
 
virtual APP_SETTINGS_BASEconfig () const
 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 LoadWindowState (const wxString &aFileName)
 
virtual void LoadWindowState (const WINDOW_STATE &aState)
 Load frame state info from a configuration file. More...
 
void LoadWindowSettings (const 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 () override
 
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=nullptr)
 Fetches the file name from the file history list. More...
 
void ClearFileHistory (FILE_HISTORY *aFileHistory=nullptr)
 Removes all files from the file history. More...
 
void UpdateFileHistory (const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
 Update the list of recently opened files. More...
 
FILE_HISTORYGetFileHistory ()
 Get the frame's main file history. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
virtual wxString GetCurrentFileName () const
 Get the full filename + path of the currently opened file in the frame. More...
 
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 ShowChangedLanguage ()
 Redraw the menus and what not in current language. More...
 
void CommonSettingsChanged (bool aEnvVarsChanged, bool aTextVarsChanged) override
 Notification event that some of the common (suite-wide) settings have changed. More...
 
virtual void ProjectChanged ()
 Notification event that the project has changed. More...
 
const wxString & GetAboutTitle () const
 
virtual bool IsContentModified ()
 Get if the contents of the frame have been modified since the last save. More...
 
wxSize GetWindowSize ()
 Get the undecorated window size that can be used for restoring the window size. More...
 
virtual void ClearUndoORRedoList (UNDO_REDO_LIST aList, int aItemCount=-1)
 
virtual void ClearUndoRedoList ()
 Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are deleted by ClearUndoORRedoList() according to their status. More...
 
virtual void PushCommandToUndoList (PICKED_ITEMS_LIST *aItem)
 Function PushCommandToUndoList add a command to undo in undo list delete the very old commands when the max count of undo commands is reached ( using ClearUndoORRedoList) More...
 
virtual void PushCommandToRedoList (PICKED_ITEMS_LIST *aItem)
 Function PushCommandToRedoList add a command to redo in redo list delete the very old commands when the max count of redo commands is reached ( using ClearUndoORRedoList) More...
 
virtual PICKED_ITEMS_LISTPopCommandFromUndoList ()
 PopCommandFromUndoList return the last command to undo and remove it from list nothing is deleted. More...
 
virtual PICKED_ITEMS_LISTPopCommandFromRedoList ()
 PopCommandFromRedoList return the last command to undo and remove it from list nothing is deleted. More...
 
virtual int GetUndoCommandCount () const
 
virtual int GetRedoCommandCount () const
 
int GetMaxUndoItems () const
 
bool NonUserClose (bool aForce)
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual SELECTIONGetCurrentSelection ()
 Get the current selection from the canvas area. 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...
 
virtual void RefreshCanvas ()
 
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...
 

Static Public Member Functions

static void HandleUpdateUIEvent (wxUpdateUIEvent &aEvent, EDA_BASE_FRAME *aFrame, ACTION_CONDITIONS aCond)
 Handles events generated when the UI is trying to figure out the current state of the UI controls related to TOOL_ACTIONS (e.g. 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 bool canCloseWindow (wxCloseEvent &aCloseEvent)
 
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...
 
virtual void setupUIConditions ()
 Setup the UI conditions for the various actions and their controls in this frame. 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_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
 
wxPoint m_NormalFramePos
 
wxSize m_NormalFrameSize
 
wxString m_AboutTitle
 
wxAuiManager m_auimgr
 
wxString m_perspective
 
WX_INFOBARm_infoBar
 
wxString m_configName
 
SETTINGS_MANAGERm_settingsManager
 
FILE_HISTORYm_fileHistory
 
bool m_hasAutoSave
 
bool m_autoSaveState
 
int m_autoSaveInterval
 
wxTimer * m_autoSaveTimer
 
bool m_FlagModified
 
bool m_FlagSave
 
int m_UndoRedoCountMax
 
UNDO_REDO_CONTAINER m_undoList
 
UNDO_REDO_CONTAINER m_redoList
 
wxString m_mruPath
 
EDA_UNITS m_userUnits
 
std::map< int, UIUpdateHandlerm_uiUpdateMap
 
bool m_isClosing
 
bool m_isNonUserClose
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
TOOL_DISPATCHERm_toolDispatcher
 
SELECTION m_dummySelection
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
bool m_dragSelects
 
bool m_moveWarpsCursor
 

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...
 
SIM_PANEL_BASEcurrentPlotWindow () const
 Returns the currently opened plot panel (or NULL if there is none). 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 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 doCloseWindow () override
 
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_PANEL_BASE *, 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...
 
SIM_PANEL_BASEm_welcomePanel
 

Info panel

More...
 
int m_splitterLeftRightSashPosition
 
int m_splitterPlotAndConsoleSashPosition
 
int m_splitterSignalsSashPosition
 
int m_splitterTuneValuesSashPosition
 
bool m_plotUseWhiteBg
 
unsigned int m_plotNumber
 
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 125 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 357 of file sim_plot_frame.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 42 of file kiway_holder.h.

◆ UNDO_REDO_LIST

Function ClearUndoORRedoList (virtual).

this function must remove the aItemCount old commands from aList and delete commands, pickers and picked items if needed Because picked items must be deleted only if they are not in use, this is a virtual pure function that must be created for SCH_SCREEN and PCB_SCREEN

Parameters
aList= the UNDO_REDO_CONTAINER of commands
aItemCount= number of old commands to delete. -1 to remove all old commands this will empty the list of commands. Commands are deleted from the older to the last.
Enumerator
UNDO_LIST 
REDO_LIST 

Definition at line 607 of file eda_base_frame.h.

Constructor & Destructor Documentation

◆ SIM_PLOT_FRAME()

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

Constructor.

Definition at line 121 of file sim_plot_frame.cpp.

122  : SIM_PLOT_FRAME_BASE( aParent ),
123  m_lastSimPlot( nullptr ),
124  m_welcomePanel( nullptr ),
125  m_plotNumber( 0 )
126 {
127  SetKiway( this, aKiway );
129 
131 
132  if( m_schematicFrame == NULL )
133  throw std::runtime_error( "There is no schematic window" );
134 
135  // Give an icon
136  wxIcon icon;
137  icon.CopyFromBitmap( KiBitmap( simulator_xpm ) );
138  SetIcon( icon );
139 
140  // Get the previous size and position of windows:
141  LoadSettings( config() );
142 
143  // Prepare the color list to plot traces
145 
146  // Give icons to menuitems
148 
150 
151  if( !m_simulator )
152  {
153  throw std::runtime_error( "Could not create simulator instance" );
154  return;
155  }
156 
157  m_simulator->Init();
158 
159  if( m_savedWorkbooksPath.IsEmpty() )
160  {
162  }
163 
164  m_reporter = new SIM_THREAD_REPORTER( this );
165  m_simulator->SetReporter( m_reporter );
166 
168 
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 
209  m_plotNotebook->AddPage( m_welcomePanel, _( "Welcome!" ), 1, true );
210 
211  // the settings dialog will be created later, on demand.
212  // if created in the ctor, for some obscure reason, there is an issue
213  // on Windows: when open it, the simulator frame is sent to the background.
214  // instead of being behind the dialog frame (as it does)
216 
217  // resize the subwindows size. At least on Windows, calling wxSafeYield before
218  // resizing the subwindows forces the wxSplitWindows size events automatically generated
219  // by wxWidgets to be executed before our resize code.
220  // Otherwise, the changes made by setSubWindowsSashSize are overwritten by one these
221  // events
222  wxSafeYield();
224 
225  // Ensure the window is on top
226  Raise();
227 }
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 ...
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
Schematic editor (Eeschema) main window.
void onSimUpdate(wxCommandEvent &aEvent)
SIM_THREAD_REPORTER * m_reporter
std::shared_ptr< SPICE_SIMULATOR > m_simulator
SIM_PANEL_BASE * m_welcomePanel
Info panel
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:124
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:343
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"))
unsigned int m_plotNumber
const BITMAP_OPAQUE sim_run_xpm[1]
Definition: sim_run.cpp:35
const BITMAP_OPAQUE sim_settings_xpm[1]
void onSettings(wxCommandEvent &event)
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, m_welcomePanel, NULL, onAddSignal(), 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, ST_UNKNOWN, and updateNetlistExporter().

◆ ~SIM_PLOT_FRAME()

SIM_PLOT_FRAME::~SIM_PLOT_FRAME ( )

Definition at line 230 of file sim_plot_frame.cpp.

231 {
232  m_simulator->SetReporter( nullptr );
233  delete m_reporter;
234  delete m_signalsIconColorList;
235 
236  if( m_settingsDlg )
237  m_settingsDlg->Destroy();
238 }
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 520 of file sim_plot_frame.cpp.

521 {
522  addPlot( aDeviceName, SPT_CURRENT, aParam );
523 }
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 592 of file sim_plot_frame.cpp.

593 {
594  SIM_TYPE simType = m_exporter->GetSimType();
595 
596  if( simType == ST_UNKNOWN )
597  {
598  m_simConsole->AppendText( _( "Error: simulation type not defined!\n" ) );
599  m_simConsole->SetInsertionPointEnd();
600  return;
601  }
602  else if( !SIM_PANEL_BASE::IsPlottable( simType ) )
603  {
604  m_simConsole->AppendText( _( "Error: simulation type doesn't support plotting!\n" ) );
605  m_simConsole->SetInsertionPointEnd();
606  return;
607  }
608 
609  // Create a new plot if the current one displays a different type
610  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
611 
612  if( !plotPanel || plotPanel->GetType() != simType )
613  plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( NewPlotPanel( simType ) );
614 
615  wxASSERT( plotPanel );
616 
617  if( !plotPanel ) // Something is wrong
618  return;
619 
620  TRACE_DESC descriptor( *m_exporter, aName, aType, aParam );
621 
622  bool updated = false;
623  SIM_PLOT_TYPE xAxisType = GetXAxisType( simType );
624 
625  if( xAxisType == SPT_LIN_FREQUENCY || xAxisType == SPT_LOG_FREQUENCY )
626  {
627  int baseType = descriptor.GetType() & ~( SPT_AC_MAG | SPT_AC_PHASE );
628 
629  // Add two plots: magnitude & phase
630  TRACE_DESC mag_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_MAG ) );
631  TRACE_DESC phase_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_PHASE ) );
632 
633  updated |= updatePlot( mag_desc, plotPanel );
634  updated |= updatePlot( phase_desc, plotPanel );
635  }
636  else
637  {
638  updated = updatePlot( descriptor, plotPanel );
639  }
640 
641  if( updated )
642  {
644  }
645 }
SIM_PANEL_BASE * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
Trace descriptor class
bool updatePlot(const TRACE_DESC &aDescriptor, SIM_PLOT_PANEL *aPanel)
Updates plot in a particular SIM_PLOT_PANEL.
static bool IsPlottable(SIM_TYPE aSimType)
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
SIM_TYPE GetType() const
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_PLOT_TYPE
Possible plot types
Definition: sim_types.h:44

References _, CurrentPlot(), SIM_PANEL_BASE::GetType(), TRACE_DESC::GetType(), GetXAxisType(), SIM_PANEL_BASE::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 372 of file eda_base_frame.cpp.

373 {
374  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
375  ACTION_MENU* helpMenu = new ACTION_MENU( false, commonControl );
376 
377  helpMenu->Add( ACTIONS::help );
378  helpMenu->Add( ACTIONS::gettingStarted );
379  helpMenu->Add( ACTIONS::listHotKeys );
380  helpMenu->Add( ACTIONS::getInvolved );
381  helpMenu->Add( ACTIONS::reportBug );
382 
383  helpMenu->AppendSeparator();
384  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
385 
386  aMenuBar->Append( helpMenu, _( "&Help" ) );
387 }
static TOOL_ACTION listHotKeys
Definition: actions.h:175
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:43
static TOOL_ACTION reportBug
Definition: actions.h:177
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:84
COMMON_CONTROL.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:50
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION help
Definition: actions.h:174
static TOOL_ACTION getInvolved
Definition: actions.h:176
static TOOL_ACTION gettingStarted
Definition: actions.h:173

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

Referenced by EDA_3D_VIEWER::CreateMenuBar(), LIB_VIEW_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), PL_EDITOR_FRAME::ReCreateMenuBar(), CVPCB_MAINFRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_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 526 of file sim_plot_frame.cpp.

527 {
528  SIM_PANEL_BASE* plotPanel = currentPlotWindow();
529 
530  if( !plotPanel || plotPanel == m_welcomePanel )
531  return;
532 
533  // For now limit the tuner tool to RLC components
534  char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aComponent, 0 )[0];
535 
536  if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR && primitiveType != SP_INDUCTOR )
537  return;
538 
539  const wxString componentName = aComponent->GetField( REFERENCE )->GetText();
540 
541  // Do not add multiple instances for the same component
542  auto tunerIt = std::find_if( m_tuners.begin(), m_tuners.end(), [&]( const TUNER_SLIDER* t )
543  {
544  return t->GetComponentName() == componentName;
545  }
546  );
547 
548  if( tunerIt != m_tuners.end() )
549  return; // We already have it
550 
551  try
552  {
553  TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_tunePanel, aComponent );
554  m_tuneSizer->Add( tuner );
555  m_tuners.push_back( tuner );
556  m_tunePanel->Layout();
557  }
558  catch( const KI_PARAM_ERROR& e )
559  {
560  // Sorry, no bonus
561  DisplayError( nullptr, e.What() );
562  }
563 }
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
SIM_PANEL_BASE * m_welcomePanel
Info panel
Field Reference of part, i.e. "IC21".
SIM_PANEL_BASE * currentPlotWindow() const
Returns the currently opened plot panel (or NULL if there is none).
SCH_FIELD * GetField(int aFieldNdx)
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.
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:127
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 currentPlotWindow(), 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, m_welcomePanel, 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 514 of file sim_plot_frame.cpp.

515 {
516  addPlot( aNetName, SPT_VOLTAGE, "V" );
517 }
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 886 of file sim_plot_frame.cpp.

887 {
888  for( auto& tuner : m_tuners )
889  {
891  std::string command( "alter @" + tuner->GetSpiceName()
892  + "=" + tuner->GetValue().ToSpiceString() );
893 
894  m_simulator->Command( command );
895  }
896 }
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().

◆ canCloseWindow()

virtual bool EDA_BASE_FRAME::canCloseWindow ( wxCloseEvent &  aCloseEvent)
inlineprotectedvirtualinherited

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inherited

Definition at line 948 of file eda_base_frame.cpp.

949 {
950  SetUserUnits( aUnits );
952 
953  wxCommandEvent e( UNITS_CHANGED );
954  ProcessEventLocally( e );
955 }
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 846 of file eda_base_frame.cpp.

847 {
848  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
849 
850  wxFileName autoSaveFileName = aFileName;
851 
852  // Check for auto save file.
853  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
854 
855  wxLogTrace( traceAutoSave,
856  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
857 
858  if( !autoSaveFileName.FileExists() )
859  return;
860 
861  wxString msg = wxString::Format( _(
862  "Well this is potentially embarrassing!\n"
863  "It appears that the last time you were editing the file\n"
864  "\"%s\"\n"
865  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
866  GetChars( aFileName.GetFullName() )
867  );
868 
869  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
870 
871  // Make a backup of the current file, delete the file, and rename the auto save file to
872  // the file name.
873  if( response == wxYES )
874  {
875  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
876  {
877  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
878  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
879  }
880  }
881  else
882  {
883  wxLogTrace( traceAutoSave,
884  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
885 
886  // Remove the auto save file when using the previous file as is.
887  wxRemoveFile( autoSaveFileName.GetFullPath() );
888  }
889 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
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:153
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:201
#define _(s)
Definition: 3d_actions.cpp:33

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

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

◆ ClearFileHistory()

void EDA_BASE_FRAME::ClearFileHistory ( FILE_HISTORY aFileHistory = nullptr)
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 743 of file eda_base_frame.cpp.

744 {
745  if( !aFileHistory )
746  aFileHistory = m_fileHistory;
747 
748  wxASSERT( aFileHistory );
749 
750  aFileHistory->ClearFileHistory();
751 
752  // Update the menubar to update the file history menu
753  if( GetMenuBar() )
754  {
755  ReCreateMenuBar();
756  GetMenuBar()->Refresh();
757  }
758 }
void ClearFileHistory()
Clear all entries from the file history.
FILE_HISTORY * m_fileHistory
virtual void ReCreateMenuBar()
Recreates the menu bar.

References FILE_HISTORY::ClearFileHistory(), EDA_BASE_FRAME::m_fileHistory, and EDA_BASE_FRAME::ReCreateMenuBar().

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

◆ ClearUndoORRedoList()

virtual void EDA_BASE_FRAME::ClearUndoORRedoList ( UNDO_REDO_LIST  aList,
int  aItemCount = -1 
)
inlinevirtualinherited

◆ ClearUndoRedoList()

◆ CommonSettingsChanged()

void EDA_BASE_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged,
bool  aTextVarsChanged 
)
overridevirtualinherited

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

Update menus, toolbars, local variables, etc.

Reimplemented from TOOLS_HOLDER.

Reimplemented in PCB_EDIT_FRAME, PCB_BASE_FRAME, FOOTPRINT_EDIT_FRAME, KICAD_MANAGER_FRAME, FOOTPRINT_VIEWER_FRAME, PL_EDITOR_FRAME, and EDA_DRAW_FRAME.

Definition at line 400 of file eda_base_frame.cpp.

401 {
402  TOOLS_HOLDER::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
403 
404  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
405 
406  if( m_fileHistory )
407  {
408  int historySize = settings->m_System.file_history_size;
409  m_fileHistory->SetMaxFiles( (unsigned) std::max( 0, historySize ) );
410  }
411 
412  if( GetMenuBar() )
413  {
414  // For icons in menus, icon scaling & hotkeys
415  ReCreateMenuBar();
416  GetMenuBar()->Refresh();
417  }
418 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
void SetMaxFiles(size_t aMaxFiles)
Update the number of files that will be contained inside the file history.
Definition: filehistory.cpp:85
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Notification event that some of the common (suite-wide) settings have changed.
FILE_HISTORY * m_fileHistory
virtual void ReCreateMenuBar()
Recreates the menu bar.

References TOOLS_HOLDER::CommonSettingsChanged(), COMMON_SETTINGS::SYSTEM::file_history_size, EDA_BASE_FRAME::m_fileHistory, COMMON_SETTINGS::m_System, Pgm(), EDA_BASE_FRAME::ReCreateMenuBar(), and FILE_HISTORY::SetMaxFiles().

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

◆ config()

APP_SETTINGS_BASE * EDA_BASE_FRAME::config ( ) const
virtualinherited

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

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 642 of file eda_base_frame.cpp.

643 {
644  // KICAD_MANAGER_FRAME overrides this
645  return Kiface().KifaceSettings();
646 }
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:103
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

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

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ActivateGalCanvas(), BM2CMP_FRAME::BM2CMP_FRAME(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), FOOTPRINT_WIZARD_FRAME::doCloseWindow(), doCloseWindow(), SCH_BASE_FRAME::eeconfig(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), DISPLAY_FOOTPRINTS_FRAME::GetAutoZoom(), GRID_MENU::GRID_MENU(), COMMON_TOOLS::GridFast1(), COMMON_TOOLS::GridFast2(), EDA_DRAW_FRAME::IsGridVisible(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), SCH_BASE_FRAME::libeditconfig(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), EDA_DRAW_FRAME::OnUpdateSelectZoom(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), DISPLAY_FOOTPRINTS_FRAME::SetAutoZoom(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetGridVisibility(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), LIB_VIEW_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), LIB_EDIT_FRAME::setupTools(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), SIM_PLOT_FRAME(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_GRID_SETTINGS::TransferDataToWindow(), ZOOM_MENU::update(), GRID_MENU::update(), EDA_DRAW_FRAME::UpdateGridSelectBox(), EDA_DRAW_FRAME::UpdateZoomSelectBox(), EDA_BASE_FRAME::windowClosing(), ZOOM_MENU::ZOOM_MENU(), and BM2CMP_FRAME::~BM2CMP_FRAME().

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineoverridevirtualinherited
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.

Reimplemented from TOOLS_HOLDER.

Definition at line 423 of file eda_base_frame.h.

424  {
425  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
426  return baseCfgName;
427  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by EDA_BASE_FRAME::SaveWindowSettings().

◆ CurrentPlot()

SIM_PLOT_PANEL * SIM_PLOT_FRAME::CurrentPlot ( ) const

Returns the currently opened plot panel (or NULL if there is none).

Definition at line 576 of file sim_plot_frame.cpp.

577 {
578  SIM_PANEL_BASE* curPage = currentPlotWindow();
579 
580  return ( ( !curPage || curPage->GetType() == ST_UNKNOWN ) ?
581  nullptr :
582  dynamic_cast<SIM_PLOT_PANEL*>( curPage ) );
583 }
SIM_PANEL_BASE * currentPlotWindow() const
Returns the currently opened plot panel (or NULL if there is none).
SIM_TYPE GetType() const

References currentPlotWindow(), SIM_PANEL_BASE::GetType(), and ST_UNKNOWN.

Referenced by addPlot(), menuNewPlot(), menuSaveCsv(), menuSaveImage(), menuSaveWorkbook(), menuShowDotted(), menuShowDottedUpdate(), menuShowGrid(), menuShowGridUpdate(), menuShowLegend(), menuShowLegendUpdate(), menuZoomFit(), menuZoomIn(), menuZoomOut(), onAddSignal(), onCursorUpdate(), onSimUpdate(), removePlot(), SIM_PLOT_FRAME::SIGNAL_CONTEXT_MENU::SIGNAL_CONTEXT_MENU(), and updateSignalList().

◆ currentPlotWindow()

SIM_PANEL_BASE* SIM_PLOT_FRAME::currentPlotWindow ( ) const
inlineprivate

Returns the currently opened plot panel (or NULL if there is none).

Definition at line 221 of file sim_plot_frame.h.

222  {
223  return dynamic_cast<SIM_PANEL_BASE*>( m_plotNotebook->GetCurrentPage() );
224  }
wxAuiNotebook * m_plotNotebook

References SIM_PLOT_FRAME_BASE::m_plotNotebook.

Referenced by AddTuner(), CurrentPlot(), onSettings(), onSimFinished(), and StartSimulation().

◆ CurrentToolName()

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

Definition at line 99 of file tools_holder.cpp.

100 {
101  if( m_toolStack.empty() )
102  return ACTIONS::selectionTool.GetName();
103  else
104  return m_toolStack.back();
105 }
std::vector< std::string > m_toolStack
Definition: tools_holder.h:56
static TOOL_ACTION selectionTool
Definition: actions.h:149

References TOOLS_HOLDER::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 161 of file kiway_player.cpp.

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

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_VIEWER_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint(), LIB_VIEW_FRAME::FinishModal(), and LIB_VIEW_FRAME::OnCloseWindow().

◆ DisplayToolMsg()

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

Reimplemented in EDA_DRAW_FRAME.

Definition at line 122 of file tools_holder.h.

122 {};

Referenced by TOOLS_HOLDER::PopTool(), and TOOLS_HOLDER::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 263 of file eda_base_frame.cpp.

264 {
265  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
266 }

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ doCloseWindow()

void SIM_PLOT_FRAME::doCloseWindow ( )
overrideprivatevirtual

Reimplemented from EDA_BASE_FRAME.

Definition at line 1411 of file sim_plot_frame.cpp.

1412 {
1413  SaveSettings( config() );
1414 
1415  if( IsSimulationRunning() )
1416  m_simulator->Stop();
1417 
1418  // Cancel a running simProbe or simTune tool
1420 
1421  Destroy();
1422 }
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
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:140
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.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:78

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

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

386 {
387  m_colorList.clear();
388 
389  if( aWhiteBg )
390  {
391  m_colorList.emplace_back( 255, 255, 255 ); // Bg color
392  m_colorList.emplace_back( 0, 0, 0 ); // Fg color (texts)
393  m_colorList.emplace_back( 130, 130, 130 ); // Axis color
394  m_colorList.emplace_back( 0, 0, 0 ); // cursors color
395  }
396  else
397  {
398  m_colorList.emplace_back( 0, 0, 0 ); // Bg color
399  m_colorList.emplace_back( 255, 255, 255 ); // Fg color (texts)
400  m_colorList.emplace_back( 130, 130, 130 ); // Axis color
401  m_colorList.emplace_back( 255, 255, 255 ); // cursors color
402  }
403 
404  // Add a list of color for traces, starting at index SIM_TRACE_COLOR
405  m_colorList.emplace_back( 0xE4, 0x1A, 0x1C );
406  m_colorList.emplace_back( 0x37, 0x7E, 0xB8 );
407  m_colorList.emplace_back( 0x4D, 0xAF, 0x4A );
408  m_colorList.emplace_back( 0x98, 0x4E, 0xA3 );
409  m_colorList.emplace_back( 0xFF, 0x7F, 0x00 );
410  m_colorList.emplace_back( 0xFF, 0xFF, 0x33 );
411  m_colorList.emplace_back( 0xA6, 0x56, 0x28 );
412  m_colorList.emplace_back( 0xF7, 0x81, 0xBF );
413  m_colorList.emplace_back( 0x66, 0xC2, 0xA5 );
414  m_colorList.emplace_back( 0xFC, 0x8D, 0x62 );
415  m_colorList.emplace_back( 0x8D, 0xA0, 0xCB );
416  m_colorList.emplace_back( 0xE7, 0x8A, 0xC3 );
417  m_colorList.emplace_back( 0xA6, 0xD8, 0x54 );
418  m_colorList.emplace_back( 0xFF, 0xD9, 0x2F );
419  m_colorList.emplace_back( 0xE5, 0xC4, 0x94 );
420  m_colorList.emplace_back( 0xB3, 0xB3, 0xB3 );
421 
422 }
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 573 of file eda_base_frame.h.

573 { return m_AboutTitle; }
wxString m_AboutTitle

References EDA_BASE_FRAME::m_AboutTitle.

Referenced by DIALOG_ABOUT::DIALOG_ABOUT(), and COMMON_CONTROL::ReportBug().

◆ GetAutoSaveFilePrefix()

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

Definition at line 195 of file eda_base_frame.h.

196  {
197  return wxT( "_autosave-" );
198  }

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

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 334 of file eda_base_frame.h.

334 { 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 187 of file eda_base_frame.h.

188  {
189  return wxT( "-bak" );
190  }

◆ GetCurrentFileName()

virtual wxString EDA_BASE_FRAME::GetCurrentFileName ( ) const
inlinevirtualinherited

Get the full filename + path of the currently opened file in the frame.

If no file is open, an empty string is returned.

Returns
the filename and full path to the open file

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, PL_EDITOR_FRAME, and KICAD_MANAGER_FRAME.

Definition at line 504 of file eda_base_frame.h.

504 { return wxEmptyString; }

Referenced by EDA_BASE_FRAME::SaveSettings().

◆ GetCurrentSelection()

virtual SELECTION& TOOLS_HOLDER::GetCurrentSelection ( )
inlinevirtualinherited

Get the current selection from the canvas area.

Returns
the current selection

Reimplemented in PCB_EDIT_FRAME, GERBVIEW_FRAME, SCH_EDIT_FRAME, LIB_EDIT_FRAME, LIB_VIEW_FRAME, DISPLAY_FOOTPRINTS_FRAME, PL_EDITOR_FRAME, FOOTPRINT_EDIT_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 104 of file tools_holder.h.

105  {
106  return m_dummySelection;
107  }
SELECTION m_dummySelection
Definition: tools_holder.h:54

References TOOLS_HOLDER::m_dummySelection.

Referenced by EDA_BASE_FRAME::HandleUpdateUIEvent(), and ACTION_MANAGER::RunHotKey().

◆ GetDoImmediateActions()

bool TOOLS_HOLDER::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 128 of file tools_holder.h.

128 { return m_immediateActions; }
bool m_immediateActions
Definition: tools_holder.h:63

References TOOLS_HOLDER::m_immediateActions.

◆ GetDragSelects()

bool TOOLS_HOLDER::GetDragSelects ( ) const
inlineinherited

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

Definition at line 134 of file tools_holder.h.

134 { return m_dragSelects; }
bool m_dragSelects
Definition: tools_holder.h:67

References TOOLS_HOLDER::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 586 of file sim_plot_frame.cpp.

587 {
588  return m_exporter.get();
589 }
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 = nullptr 
)
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 703 of file eda_base_frame.cpp.

705 {
706  if( !aFileHistory )
707  aFileHistory = m_fileHistory;
708 
709  wxASSERT( aFileHistory );
710 
711  int baseId = aFileHistory->GetBaseId();
712 
713  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) aFileHistory->GetCount() );
714 
715  unsigned i = cmdId - baseId;
716 
717  if( i < aFileHistory->GetCount() )
718  {
719  wxString fn = aFileHistory->GetHistoryFile( i );
720 
721  if( wxFileName::FileExists( fn ) )
722  return fn;
723  else
724  {
725  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
726  wxMessageBox( msg );
727 
728  aFileHistory->RemoveFileFromHistory( i );
729  }
730  }
731 
732  // Update the menubar to update the file history menu
733  if( GetMenuBar() )
734  {
735  ReCreateMenuBar();
736  GetMenuBar()->Refresh();
737  }
738 
739  return wxEmptyString;
740 }
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:201
#define _(s)
Definition: 3d_actions.cpp:33
FILE_HISTORY * m_fileHistory
virtual void ReCreateMenuBar()
Recreates the menu bar.

References _, Format(), EDA_BASE_FRAME::m_fileHistory, and EDA_BASE_FRAME::ReCreateMenuBar().

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

◆ GetFileHistory()

FILE_HISTORY& EDA_BASE_FRAME::GetFileHistory ( )
inlineinherited

Get the frame's main file history.

Returns
the main file history

Definition at line 489 of file eda_base_frame.h.

490  {
491  return *m_fileHistory;
492  }
FILE_HISTORY * m_fileHistory

References EDA_BASE_FRAME::m_fileHistory.

Referenced by KICAD_MANAGER_FRAME::ReCreateMenuBar(), PL_EDITOR_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

◆ GetInfoBar()

◆ GetMaxUndoItems()

int EDA_BASE_FRAME::GetMaxUndoItems ( ) const
inlineinherited

Definition at line 652 of file eda_base_frame.h.

652 { return m_UndoRedoCountMax; }

References EDA_BASE_FRAME::m_UndoRedoCountMax.

Referenced by EDA_DRAW_FRAME::SaveSettings().

◆ GetMoveWarpsCursor()

bool TOOLS_HOLDER::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 140 of file tools_holder.h.

140 { return m_moveWarpsCursor; }
bool m_moveWarpsCursor
Definition: tools_holder.h:68

References TOOLS_HOLDER::m_moveWarpsCursor.

Referenced by EDIT_TOOL::doMoveSelection(), LIB_MOVE_TOOL::Main(), and SCH_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 184 of file sim_plot_frame.h.

184 { 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 375 of file sim_plot_frame.cpp.

376 {
377  // return the wxColor selected in color list or BLACK is not in list
378  if( aColorId >= 0 && aColorId < (int)m_colorList.size() )
379  return m_colorList[aColorId];
380 
381  return wxColor( 0, 0, 0 );
382 }
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 195 of file sim_plot_frame.h.

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

◆ GetRedoCommandCount()

virtual int EDA_BASE_FRAME::GetRedoCommandCount ( ) const
inlinevirtualinherited

◆ GetSettingsManager()

◆ GetSeverity()

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

Reimplemented in PCB_BASE_FRAME.

Definition at line 263 of file eda_base_frame.h.

References RPT_SEVERITY_UNDEFINED.

Referenced by RC_TREE_MODEL::GetValue().

◆ GetToolCanvas()

wxWindow* SIM_PLOT_FRAME::GetToolCanvas ( ) const
inlineoverridevirtual

Canvas access.

Implements TOOLS_HOLDER.

Definition at line 204 of file sim_plot_frame.h.

204 { return nullptr; }

◆ GetToolManager()

TOOL_MANAGER* TOOLS_HOLDER::GetToolManager ( ) const
inlineinherited

Return the MVC controller.

Definition at line 78 of file tools_holder.h.

78 { return m_toolManager; }
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:50

References TOOLS_HOLDER::m_toolManager.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), LIB_CONTROL::AddSymbolToSchematic(), APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), BOARD_COMMIT::BOARD_COMMIT(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), TOOLS_HOLDER::CommonSettingsChanged(), DIALOG_ERC::deleteAllMarkers(), DIALOG_DRC::deleteAllMarkers(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), doCloseWindow(), DRAWING_TOOL::DrawVia(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), GERBVIEW_FRAME::GERBVIEW_FRAME(), FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), KICAD_MANAGER_FRAME::InstallPreferences(), PL_EDITOR_FRAME::InstallPreferences(), FOOTPRINT_EDIT_FRAME::InstallPreferences(), LIB_EDIT_FRAME::InstallPreferences(), GERBVIEW_FRAME::InstallPreferences(), SCH_EDIT_FRAME::InstallPreferences(), PCB_EDIT_FRAME::InstallPreferences(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), LIB_EDIT_FRAME::LoadPart(), PCB_EDIT_FRAME::LoadProjectSettings(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_DRC::OnActivateDlg(), DIALOG_DRC::OnCancelClick(), DIALOG_INSPECTOR::onCellClicked(), SYMBOL_TREE_PANE::onComponentSelected(), DIALOG_DRC::OnDeleteOneClick(), DIALOG_ERC::OnERCItemSelected(), KICAD_MANAGER_FRAME::OnIdle(), FOOTPRINTS_LISTBOX::OnLeftDClick(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onNetContextMenu(), onProbe(), DIALOG_PLOT::onRunDRC(), DIALOG_DRC::OnRunDRCClick(), HIERARCHY_NAVIG_DLG::onSelectSheetPath(), SCH_EDIT_FRAME::onSize(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), onTune(), PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER(), DIALOG_PLOT::Plot(), TOOLS_HOLDER::PopTool(), SCH_EDIT_FRAME::PutDataInPreviousState(), PL_EDITOR_FRAME::RollbackFromUndo(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), PCB_EDIT_FRAME::SaveProjectSettings(), FOOTPRINT_EDIT_FRAME::SaveSettings(), EDA_3D_VIEWER::SaveSettings(), DIALOG_FIND::search(), CVPCB_MAINFRAME::setupEventHandlers(), APPEARANCE_CONTROLS::showNetclass(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataToWindow(), DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), EDA_DRAW_FRAME::UpdateMsgPanel(), NET_GRID_TABLE::updateNetVisibility(), 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().

◆ GetUndoCommandCount()

virtual int EDA_BASE_FRAME::GetUndoCommandCount ( ) const
inlinevirtualinherited

◆ GetUserUnits()

EDA_UNITS EDA_BASE_FRAME::GetUserUnits ( ) const
inlineinherited

Return the user units currently in use.

Definition at line 247 of file eda_base_frame.h.

248  {
249  return m_userUnits;
250  }
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(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), GERBER_FILE_IMAGE::DisplayImageInfo(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::GenFootprintsReport(), PANEL_MODEDIT_DEFAULTS::getGridValue(), PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue(), LIB_CIRCLE::GetMsgPanelInfo(), LIB_RECTANGLE::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), SCH_PIN::GetMsgPanelInfo(), LIB_ARC::GetMsgPanelInfo(), MARKER_PCB::GetMsgPanelInfo(), LIB_POLYLINE::GetMsgPanelInfo(), LIB_BEZIER::GetMsgPanelInfo(), TEXTE_PCB::GetMsgPanelInfo(), WS_DRAW_ITEM_BASE::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), SCH_BITMAP::GetMsgPanelInfo(), LIB_FIELD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), DRAWSEGMENT::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), GetUserUnits(), RC_TREE_MODEL::GetValue(), GRID_MENU::GRID_MENU(), SELECTION_TOOL::highlightInternal(), PCB_INSPECTION_TOOL::InspectClearance(), GERBVIEW_FRAME::Liste_D_Codes(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), PANEL_SETUP_BOARD_STACKUP::onThicknessChange(), DIALOG_SELECT_NET_FROM_LIST::onUnitsChanged(), UNIT_BINDER::onUnitsChanged(), PANEL_SETUP_BOARD_STACKUP::onUpdateThicknessValue(), PANEL_PREV_3D::PANEL_PREV_3D(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), POSITION_RELATIVE_TOOL::PositionRelative(), DRC_TOOL::RunTests(), COMMON_TOOLS::ToggleUnits(), PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup(), PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), PANEL_GERBVIEW_SETTINGS::TransferDataToWindow(), PANEL_EDIT_OPTIONS::TransferDataToWindow(), PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow(), SELECTION_TOOL::unhighlightInternal(), UNIT_BINDER::UNIT_BINDER(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), EDITOR_CONDITIONS::unitsFunc(), GRID_MENU::update(), VIA_SIZE_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), GERBVIEW_FRAME::updateDCodeSelectBox(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), EDA_DRAW_FRAME::UpdateGridSelectBox(), PNS_TUNE_STATUS_POPUP::UpdateStatus(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_EDIT_FRAME::UpdateTrackWidthSelectBox(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), DRC_TOOL::userUnits(), and PANEL_SETUP_TRACKS_AND_VIAS::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 278 of file sim_plot_frame.cpp.

279 {
280  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
281  wxASSERT( cfg );
282 
283  return cfg ? &cfg->m_Simulator.window : nullptr;
284 }

◆ GetWindowSize()

wxSize EDA_BASE_FRAME::GetWindowSize ( )
inherited

Get the undecorated window size that can be used for restoring the window size.

This is needed for GTK, since the normal wxWidgets GetSize() call will return a window size that includes the window decorations added by the window manager.

Returns
the undecorated window size

Definition at line 980 of file eda_base_frame.cpp.

981 {
982 #ifdef __WXGTK__
983  // GTK includes the window decorations in the normal GetSize call,
984  // so we have to use a GTK-specific sizing call that returns the
985  // non-decorated window size.
986  int width = 0;
987  int height = 0;
988  GTKDoGetSize( &width, &height );
989 
990  wxSize winSize( width, height );
991 #else
992  wxSize winSize = GetSize();
993 #endif
994 
995  return winSize;
996 }

Referenced by EDA_BASE_FRAME::OnMaximize(), and EDA_BASE_FRAME::SaveWindowSettings().

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

1009 {
1010  switch( aType )
1011  {
1012  case ST_AC:
1013  return SPT_LIN_FREQUENCY;
1015 
1016  case ST_DC:
1017  return SPT_SWEEP;
1018 
1019  case ST_TRANSIENT:
1020  return SPT_TIME;
1021 
1022  default:
1023  wxASSERT_MSG( false, "Unhandled simulation type" );
1024  return (SIM_PLOT_TYPE) 0;
1025  }
1026 }
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:44

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

Referenced by addPlot().

◆ HandleUpdateUIEvent()

void EDA_BASE_FRAME::HandleUpdateUIEvent ( wxUpdateUIEvent &  aEvent,
EDA_BASE_FRAME aFrame,
ACTION_CONDITIONS  aCond 
)
staticinherited

Handles events generated when the UI is trying to figure out the current state of the UI controls related to TOOL_ACTIONS (e.g.

enabled, checked, etc.).

Parameters
aEventis the wxUpdateUIEvent to be processed.
aFrameis the frame to get the selection from
aCondare the UI SELECTION_CONDITIONS used

Definition at line 311 of file eda_base_frame.cpp.

313 {
314  bool checkRes = false;
315  bool enableRes = true;
316  bool showRes = true;
317  SELECTION& selection = aFrame->GetCurrentSelection();
318 
319  try
320  {
321  checkRes = aCond.checkCondition( selection );
322  enableRes = aCond.enableCondition( selection );
323  showRes = aCond.showCondition( selection );
324  }
325  catch( std::exception& )
326  {
327  // Something broke with the conditions, just skip the event.
328  aEvent.Skip();
329  return;
330  }
331 
332  aEvent.Enable( enableRes );
333  aEvent.Show( showRes );
334 
335  bool canCheck = true;
336 
337  // wxMenuItems don't want to be checked unless they actually are checkable, so we have to check to
338  // see if they can be and can't just universally apply a check in this event.
339  if( auto menu = dynamic_cast<wxMenu*>( aEvent.GetEventObject() ) )
340  canCheck = menu->FindItem( aEvent.GetId() )->IsCheckable();
341 
342  if( canCheck )
343  aEvent.Check( checkRes );
344 }
SELECTION_CONDITION showCondition
Returns true if the UI control should be shown.
SELECTION_CONDITION enableCondition
Returns true if the UI control should be enabled.
SELECTION_CONDITION checkCondition
Returns true if the UI control should be checked.
virtual SELECTION & GetCurrentSelection()
Get the current selection from the canvas area.
Definition: tools_holder.h:104

References ACTION_CONDITIONS::checkCondition, ACTION_CONDITIONS::enableCondition, TOOLS_HOLDER::GetCurrentSelection(), and ACTION_CONDITIONS::showCondition.

Referenced by EDA_BASE_FRAME::RegisterUIUpdateHandler().

◆ help_name()

wxString EDA_BASE_FRAME::help_name ( )
virtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 655 of file eda_base_frame.cpp.

656 {
657  return Kiface().GetHelpFileName();
658 }
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 PCB_EDIT_FRAME, SCH_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, FOOTPRINT_EDIT_FRAME, PL_EDITOR_FRAME, and KICAD_MANAGER_FRAME.

Definition at line 369 of file eda_base_frame.h.

369 { }

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

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

Definition at line 892 of file eda_base_frame.cpp.

893 {
894  // This function should be overridden in child classes
895  return false;
896 }

Referenced by EDITOR_CONDITIONS::contentModifiedFunc().

◆ IsCurrentTool()

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

Definition at line 108 of file tools_holder.cpp.

109 {
110  if( m_toolStack.empty() )
111  return &aAction == &ACTIONS::selectionTool;
112  else
113  return m_toolStack.back() == aAction.GetName();
114 }
std::vector< std::string > m_toolStack
Definition: tools_holder.h:56
static TOOL_ACTION selectionTool
Definition: actions.h:149
const std::string & GetName() const
Returns name of the action.
Definition: tool_action.h:75

References TOOL_ACTION::GetName(), TOOLS_HOLDER::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(), EDIT_TOOL::Init(), and EDITOR_CONDITIONS::toolFunc().

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

156 {
157  return !m_modal_loop;
158 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:202

References KIWAY_PLAYER::m_modal_loop.

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

◆ IsModal()

bool KIWAY_PLAYER::IsModal ( ) const
inlineoverridevirtualinherited

Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame In modal mode, the caller that created the frame is responsible to Destroy() this frame after closing.

Reimplemented from EDA_BASE_FRAME.

Definition at line 176 of file kiway_player.h.

176 { return m_modal; }

References KIWAY_PLAYER::m_modal.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), LIB_CONTROL::AddSymbolToSchematic(), FOOTPRINT_VIEWER_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::doCloseWindow(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), LIB_VIEW_FRAME::OnCloseWindow(), and KIWAY_PLAYER::ShowModal().

◆ IsSimulationRunning()

bool SIM_PLOT_FRAME::IsSimulationRunning ( )

Definition at line 471 of file sim_plot_frame.cpp.

472 {
473  return m_simulator ? m_simulator->IsRunning() : false;
474 }
std::shared_ptr< SPICE_SIMULATOR > m_simulator

References m_simulator.

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

◆ IsType()

bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited

Definition at line 336 of file eda_base_frame.h.

336 { 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_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), 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(), COMMON_TOOLS::doZoomFit(), LIB_CONTROL::DuplicateSymbol(), LIB_CONTROL::EditSymbol(), LIB_CONTROL::ExportSymbol(), MODULE::GetMsgPanelInfo(), LIB_CONTROL::Init(), DIALOG_EDIT_ONE_FIELD::init(), SELECTION_TOOL::Init(), DIALOG_PAD_PROPERTIES::initValues(), LIB_CONTROL::OnDeMorgan(), PCB_LAYER_WIDGET::OnLayerVisible(), APPEARANCE_CONTROLS::onObjectVisibilityChanged(), PCB_LAYER_WIDGET::OnRenderEnable(), PCBNEW_CONTROL::Paste(), LIB_CONTROL::PinLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), LIB_CONTROL::Revert(), EE_INSPECTION_TOOL::RunERC(), LIB_CONTROL::Save(), LIB_CONTROL::ShowComponentTree(), EE_INSPECTION_TOOL::ShowDatasheet(), and LIB_CONTROL::UnpinLibrary().

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

803 {
804  wxString msg;
805  wxFileName fn = aFileName;
806 
807  // Check for absence of a file path with a file name. Unfortunately KiCad
808  // uses paths relative to the current project path without the ./ part which
809  // confuses wxFileName. Making the file name path absolute may be less than
810  // elegant but it solves the problem.
811  if( fn.GetPath().IsEmpty() && fn.HasName() )
812  fn.MakeAbsolute();
813 
814  wxCHECK_MSG( fn.IsOk(), false,
815  wxT( "File name object is invalid. Bad programmer!" ) );
816  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
817  wxT( "File name object path <" ) + fn.GetFullPath() +
818  wxT( "> is not set. Bad programmer!" ) );
819 
820  if( fn.IsDir() && !fn.IsDirWritable() )
821  {
822  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
823  GetChars( fn.GetPath() ) );
824  }
825  else if( !fn.FileExists() && !fn.IsDirWritable() )
826  {
827  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
828  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
829  }
830  else if( fn.FileExists() && !fn.IsFileWritable() )
831  {
832  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
833  GetChars( fn.GetFullPath() ) );
834  }
835 
836  if( !msg.IsEmpty() )
837  {
838  wxMessageBox( msg );
839  return false;
840  }
841 
842  return true;
843 }
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:153
#define _(s)
Definition: 3d_actions.cpp:33

References _, and GetChars().

Referenced by SCH_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::SaveEEFile(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), and SCH_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(), SCH_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), 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(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithLibEdit(), BACK_ANNOTATE::FetchNetlistFromPCB(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), PCB_EDIT_FRAME::importFile(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), 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(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDITOR_CONTROL::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), 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(), SCH_EDIT_FRAME::SetCrossProbeConnection(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), LIB_CONTROL::UpdateSymbolInSchematic(), 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 176 of file kiway_player.cpp.

177 {
178  // logging support
179  KiwayMailIn( aEvent ); // call the virtual, override in derived.
180 }
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, PCB_EDIT_FRAME, SCH_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 70 of file kiway_player.cpp.

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

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

184 {
185  int id = event.GetId();
186 
187  // tell all the KIWAY_PLAYERs about the language change.
188  Kiway().SetLanguage( id );
189 }
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:445

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

260 {
261  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
262  wxASSERT( cfg );
263 
264  if( cfg )
265  {
267 
268  // Read subwindows sizes (should be > 0 )
269  m_splitterLeftRightSashPosition = cfg->m_Simulator.plot_panel_width;
270  m_splitterPlotAndConsoleSashPosition = cfg->m_Simulator.plot_panel_height;
271  m_splitterSignalsSashPosition = cfg->m_Simulator.signal_panel_height;
272  m_splitterTuneValuesSashPosition = cfg->m_Simulator.cursors_panel_height;
273  m_plotUseWhiteBg = cfg->m_Simulator.white_background;
274  }
275 }
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(), m_plotUseWhiteBg, m_splitterLeftRightSashPosition, m_splitterPlotAndConsoleSashPosition, m_splitterSignalsSashPosition, and m_splitterTuneValuesSashPosition.

Referenced by SIM_PLOT_FRAME().

◆ LoadWindowSettings()

void EDA_BASE_FRAME::LoadWindowSettings ( const 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 536 of file eda_base_frame.cpp.

537 {
538  LoadWindowState( aCfg->state );
539 
540  if( m_hasAutoSave )
541  m_autoSaveInterval = Pgm().GetCommonSettings()->m_System.autosave_interval;
542 
543  m_perspective = aCfg->perspective;
544  m_mruPath = aCfg->mru_path;
545 
546  TOOLS_HOLDER::CommonSettingsChanged( false, false );
547 }
wxString mru_path
Definition: app_settings.h:84
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
wxString m_mruPath
void LoadWindowState(const wxString &aFileName)
wxString m_perspective
wxString perspective
Definition: app_settings.h:85
WINDOW_STATE state
Definition: app_settings.h:83
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Notification event that some of the common (suite-wide) settings have changed.

References TOOLS_HOLDER::CommonSettingsChanged(), EDA_BASE_FRAME::LoadWindowState(), EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_hasAutoSave, EDA_BASE_FRAME::m_mruPath, EDA_BASE_FRAME::m_perspective, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, Pgm(), and WINDOW_SETTINGS::state.

Referenced by EDA_BASE_FRAME::LoadSettings().

◆ LoadWindowState() [1/2]

void EDA_BASE_FRAME::LoadWindowState ( const wxString &  aFileName)
inherited

Definition at line 421 of file eda_base_frame.cpp.

422 {
423  if( !Pgm().GetCommonSettings()->m_Session.remember_open_files )
424  return;
425 
426  const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName );
427 
428  if( state != nullptr )
429  {
430  LoadWindowState( state->window );
431  }
432 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:147
void LoadWindowState(const wxString &aFileName)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
struct WINDOW_STATE window
const PROJECT_FILE_STATE * GetFileState(const wxString &aFileName)

References PROJECT_LOCAL_SETTINGS::GetFileState(), PROJECT::GetLocalSettings(), Pgm(), KIWAY_HOLDER::Prj(), and PROJECT_FILE_STATE::window.

Referenced by KICAD_MANAGER_FRAME::LoadProject(), PCB_EDIT_FRAME::LoadProjectSettings(), EDA_BASE_FRAME::LoadWindowSettings(), and SCH_EDIT_FRAME::OpenProjectFiles().

◆ LoadWindowState() [2/2]

void EDA_BASE_FRAME::LoadWindowState ( const WINDOW_STATE aState)
virtualinherited

Load frame state info from a configuration file.

Definition at line 435 of file eda_base_frame.cpp.

436 {
437  m_FramePos.x = aState.pos_x;
438  m_FramePos.y = aState.pos_y;
439  m_FrameSize.x = aState.size_x;
440  m_FrameSize.y = aState.size_y;
441 
442  wxLogTrace( traceDisplayLocation, "Config position (%d, %d) with size (%d, %d)",
444 
445  // Ensure minimum size is set if the stored config was zero-initialized
447  {
450 
451  wxLogTrace( traceDisplayLocation, "Using minimum size (%d, %d)", m_FrameSize.x, m_FrameSize.y );
452  }
453 
454  wxLogTrace( traceDisplayLocation, "Number of displays: %d", wxDisplay::GetCount() );
455 
456  if( aState.display >= wxDisplay::GetCount() )
457  {
458  wxLogTrace( traceDisplayLocation, "Previous display not found" );
459 
460  // If it isn't attached, use the first display
461  // Warning wxDisplay has 2 ctor variants. the parameter needs a type:
462  const unsigned int index = 0;
463  wxDisplay display( index );
464  wxRect clientSize = display.GetGeometry();
465 
466  m_FramePos = wxDefaultPosition;
467 
468  // Ensure the window fits on the display, since the other one could have been larger
469  if( m_FrameSize.x > clientSize.width )
470  m_FrameSize.x = clientSize.width;
471 
472  if( m_FrameSize.y > clientSize.height )
473  m_FrameSize.y = clientSize.height;
474  }
475  else
476  {
477  wxPoint upperRight( m_FramePos.x + m_FrameSize.x, m_FramePos.y );
478  wxPoint upperLeft( m_FramePos.x, m_FramePos.y );
479 
480  wxDisplay display( aState.display );
481  wxRect clientSize = display.GetClientArea();
482 
483  // The percentage size (represented in decimal) of the region around the screen's border where
484  // an upper corner is not allowed
485 #define SCREEN_BORDER_REGION 0.10
486 
487  int yLim = clientSize.y + ( clientSize.height * ( 1.0 - SCREEN_BORDER_REGION ) );
488  int xLimLeft = clientSize.x + ( clientSize.width * SCREEN_BORDER_REGION );
489  int xLimRight = clientSize.x + ( clientSize.width * ( 1.0 - SCREEN_BORDER_REGION ) );
490 
491  if( upperLeft.x > xLimRight || // Upper left corner too close to right edge of screen
492  upperRight.x < xLimLeft || // Upper right corner too close to left edge of screen
493  upperRight.y > yLim ) // Upper corner too close to the bottom of the screen
494  {
495  m_FramePos = wxDefaultPosition;
496  wxLogTrace( traceDisplayLocation, "Resetting to default position" );
497  }
498  }
499 
500  // Ensure Window title bar is visible
501 #if defined( __WXOSX__ )
502  // for macOSX, the window must be below system (macOSX) toolbar
503  int Ypos_min = 20;
504 #else
505  int Ypos_min = 0;
506 #endif
507  if( m_FramePos.y < Ypos_min )
508  m_FramePos.y = Ypos_min;
509 
510  wxLogTrace( traceDisplayLocation, "Final window position (%d, %d) with size (%d, %d)",
512 
513  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
514 
515  // Center the window if we reset to default
516  if( m_FramePos.x == -1 )
517  {
518  wxLogTrace( traceDisplayLocation, "Centering window" );
519  Center();
520  m_FramePos = GetPosition();
521  }
522 
523  // Record the frame sizes in an un-maximized state
526 
527  // Maximize if we were maximized before
528  if( aState.maximized )
529  {
530  wxLogTrace( traceDisplayLocation, "Maximizing window" );
531  Maximize();
532  }
533 }
const wxChar *const traceDisplayLocation
Flag to enable debug output of display positioning logic.
wxSize m_NormalFrameSize
#define SCREEN_BORDER_REGION
static const int s_minsize_x
static const int s_minsize_y
unsigned int display
Definition: app_settings.h:75
wxPoint m_NormalFramePos

References PCAD2KICAD::Center, WINDOW_STATE::display, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_BASE_FRAME::m_NormalFramePos, EDA_BASE_FRAME::m_NormalFrameSize, WINDOW_STATE::maximized, WINDOW_STATE::pos_x, WINDOW_STATE::pos_y, s_minsize_x, s_minsize_y, SCREEN_BORDER_REGION, WINDOW_STATE::size_x, WINDOW_STATE::size_y, traceDisplayLocation, wxPoint::x, and wxPoint::y.

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

900 {
901  m_plots.clear();
902  m_plotNotebook->DeleteAllPages();
903 
904  wxTextFile file( aPath );
905 
906  if( !file.Open() )
907  return false;
908 
909  long plotsCount;
910 
911  if( !file.GetFirstLine().ToLong( &plotsCount ) ) // GetFirstLine instead of GetNextLine
912  return false;
913 
914  for( long i = 0; i < plotsCount; ++i )
915  {
916  long plotType, tracesCount;
917 
918  if( !file.GetNextLine().ToLong( &plotType ) )
919  return false;
920 
921  SIM_PANEL_BASE* plotPanel = NewPlotPanel( (SIM_TYPE) plotType );
922  m_plots[plotPanel].m_simCommand = file.GetNextLine();
923  StartSimulation( m_plots[plotPanel].m_simCommand );
924 
925  // Perform simulation, so plots can be added with values
926  do
927  {
928  wxThread::This()->Sleep( 50 );
929  }
930  while( IsSimulationRunning() );
931 
932  if( !file.GetNextLine().ToLong( &tracesCount ) )
933  return false;
934 
935  for( long j = 0; j < tracesCount; ++j )
936  {
937  long traceType;
938  wxString name, param;
939 
940  if( !file.GetNextLine().ToLong( &traceType ) )
941  return false;
942 
943  name = file.GetNextLine();
944  param = file.GetNextLine();
945 
946  if( name.IsEmpty() || param.IsEmpty() )
947  return false;
948 
949  addPlot( name, (SIM_PLOT_TYPE) traceType, param );
950  }
951  }
952 
953  return true;
954 }
SIM_PANEL_BASE * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
std::map< SIM_PANEL_BASE *, PLOT_INFO > m_plots
Map of plot panels and associated data
void StartSimulation(const wxString &aSimCommand=wxEmptyString)
wxAuiNotebook * m_plotNotebook
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:44
void addPlot(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam)
Adds a new plot to the current panel.

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 123 of file sim_plot_frame_base.h.

124  {
125  m_splitterLeftRight->SetSashPosition( 700 );
126  m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this );
127  }
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 129 of file sim_plot_frame_base.h.

130  {
131  m_splitterPlotAndConsole->SetSashPosition( 500 );
132  m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
133  }
#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 135 of file sim_plot_frame_base.h.

136  {
137  m_splitterSignals->SetSashPosition( 0 );
138  m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this );
139  }
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 141 of file sim_plot_frame_base.h.

142  {
143  m_splitterTuneValues->SetSashPosition( 0 );
144  m_splitterTuneValues->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterTuneValuesOnIdle ), NULL, this );
145  }
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 295 of file sim_plot_frame.h.

296  {
297  Close();
298  }

◆ menuNewPlot()

void SIM_PLOT_FRAME::menuNewPlot ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1029 of file sim_plot_frame.cpp.

1030 {
1031  SIM_TYPE type = m_exporter->GetSimType();
1032 
1033  if( SIM_PANEL_BASE::IsPlottable( type ) )
1034  {
1035  SIM_PLOT_PANEL* prevPlot = CurrentPlot();
1036  SIM_PLOT_PANEL* newPlot = dynamic_cast<SIM_PLOT_PANEL*>( NewPlotPanel( type ) );
1037 
1038  // If the previous plot had the same type, copy the simulation command
1039  if( prevPlot )
1040  m_plots[newPlot].m_simCommand = m_plots[prevPlot].m_simCommand;
1041  }
1042 }
SIM_PANEL_BASE * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
std::map< SIM_PANEL_BASE *, PLOT_INFO > m_plots
Map of plot panels and associated data
static bool IsPlottable(SIM_TYPE aSimType)
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).

References CurrentPlot(), SIM_PANEL_BASE::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 1045 of file sim_plot_frame.cpp.

1046 {
1047  wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "",
1048  WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1049 
1050  if( openDlg.ShowModal() == wxID_CANCEL )
1051  return;
1052 
1053  m_savedWorkbooksPath = openDlg.GetDirectory();
1054 
1055  if( !loadWorkbook( openDlg.GetPath() ) )
1056  DisplayError( this, _( "There was an error while opening the workbook file" ) );
1057 }
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 1093 of file sim_plot_frame.cpp.

1094 {
1095  if( !CurrentPlot() )
1096  return;
1097 
1098  const wxChar SEPARATOR = ';';
1099 
1100  wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "",
1101  CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1102 
1103  if( saveDlg.ShowModal() == wxID_CANCEL )
1104  return;
1105 
1106  wxFile out( saveDlg.GetPath(), wxFile::write );
1107  bool timeWritten = false;
1108 
1109  for( const auto& t : CurrentPlot()->GetTraces() )
1110  {
1111  const TRACE* trace = t.second;
1112 
1113  if( !timeWritten )
1114  {
1115  out.Write( wxString::Format( "Time%c", SEPARATOR ) );
1116 
1117  for( double v : trace->GetDataX() )
1118  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
1119 
1120  out.Write( "\r\n" );
1121  timeWritten = true;
1122  }
1123 
1124  out.Write( wxString::Format( "%s%c", t.first, SEPARATOR ) );
1125 
1126  for( double v : trace->GetDataY() )
1127  out.Write( wxString::Format( "%f%c", v, SEPARATOR ) );
1128 
1129  out.Write( "\r\n" );
1130  }
1131 
1132  out.Close();
1133 }
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:201
#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 1078 of file sim_plot_frame.cpp.

1079 {
1080  if( !CurrentPlot() )
1081  return;
1082 
1083  wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "",
1084  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1085 
1086  if( saveDlg.ShowModal() == wxID_CANCEL )
1087  return;
1088 
1089  CurrentPlot()->GetPlotWin()->SaveScreenshot( saveDlg.GetPath(), wxBITMAP_TYPE_PNG );
1090 }
mpWindow * GetPlotWin() const
Getter for math plot window
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:2943

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

◆ menuSaveWorkbook()

void SIM_PLOT_FRAME::menuSaveWorkbook ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1060 of file sim_plot_frame.cpp.

1061 {
1062  if( !CurrentPlot() )
1063  return;
1064 
1065  wxFileDialog saveDlg( this, _( "Save Simulation Workbook" ), m_savedWorkbooksPath, "",
1066  WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1067 
1068  if( saveDlg.ShowModal() == wxID_CANCEL )
1069  return;
1070 
1071  m_savedWorkbooksPath = saveDlg.GetDirectory();
1072 
1073  if( !saveWorkbook( saveDlg.GetPath() ) )
1074  DisplayError( this, _( "There was an error while saving the workbook file" ) );
1075 }
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 1190 of file sim_plot_frame.cpp.

1191 {
1192  SIM_PLOT_PANEL* plot = CurrentPlot();
1193 
1194  if( plot )
1195  plot->SetDottedCurrentPhase( !plot->GetDottedCurrentPhase() );
1196 }
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 1199 of file sim_plot_frame.cpp.

1200 {
1201  SIM_PLOT_PANEL* plot = CurrentPlot();
1202 
1203  event.Check( plot ? plot->GetDottedCurrentPhase() : false );
1204 }
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 1157 of file sim_plot_frame.cpp.

1158 {
1159  SIM_PLOT_PANEL* plot = CurrentPlot();
1160 
1161  if( plot )
1162  plot->ShowGrid( !plot->IsGridShown() );
1163 }
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 1166 of file sim_plot_frame.cpp.

1167 {
1168  SIM_PLOT_PANEL* plot = CurrentPlot();
1169 
1170  event.Check( plot ? plot->IsGridShown() : false );
1171 }
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 1174 of file sim_plot_frame.cpp.

1175 {
1176  SIM_PLOT_PANEL* plot = CurrentPlot();
1177 
1178  if( plot )
1179  plot->ShowLegend( !plot->IsLegendShown() );
1180 }
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 1183 of file sim_plot_frame.cpp.

1184 {
1185  SIM_PLOT_PANEL* plot = CurrentPlot();
1186  event.Check( plot ? plot->IsLegendShown() : false );
1187 }
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 312 of file sim_plot_frame.h.

313  {
314  event.Check( m_plotUseWhiteBg );
315  }

References m_plotUseWhiteBg.

◆ menuWhiteBackground()

void SIM_PLOT_FRAME::menuWhiteBackground ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1207 of file sim_plot_frame.cpp.

1208 {
1210 
1211  // Rebuild the color list to plot traces
1213 
1214  // Now send changes to all SIM_PLOT_PANEL
1215  for( size_t page = 0; page < m_plotNotebook->GetPageCount(); page++ )
1216  {
1217  wxWindow* curPage = m_plotNotebook->GetPage( page );
1218 
1219  if( curPage == m_welcomePanel )
1220  continue;
1221 
1222  static_cast<SIM_PLOT_PANEL*>( curPage )->UpdatePlotColors();
1223  }
1224 }
bool GetPlotBgOpt() const
SIM_PANEL_BASE * m_welcomePanel
Info panel
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 m_welcomePanel.

◆ menuZoomFit()

void SIM_PLOT_FRAME::menuZoomFit ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1150 of file sim_plot_frame.cpp.

1151 {
1152  if( CurrentPlot() )
1153  CurrentPlot()->GetPlotWin()->Fit();
1154 }
mpWindow * GetPlotWin() const
Getter for math plot window
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:1977
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuZoomIn()

void SIM_PLOT_FRAME::menuZoomIn ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1136 of file sim_plot_frame.cpp.

1137 {
1138  if( CurrentPlot() )
1139  CurrentPlot()->GetPlotWin()->ZoomIn();
1140 }
mpWindow * GetPlotWin() const
Getter for math plot window
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2182
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ menuZoomOut()

void SIM_PLOT_FRAME::menuZoomOut ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1143 of file sim_plot_frame.cpp.

1144 {
1145  if( CurrentPlot() )
1146  CurrentPlot()->GetPlotWin()->ZoomOut();
1147 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2239
mpWindow * GetPlotWin() const
Getter for math plot window
SIM_PLOT_PANEL * CurrentPlot() const
Returns the currently opened plot panel (or NULL if there is none).

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

◆ NewPlotPanel()

SIM_PANEL_BASE * 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 477 of file sim_plot_frame.cpp.

478 {
479  SIM_PANEL_BASE* plotPanel;
480 
481  if( SIM_PANEL_BASE::IsPlottable( aSimType ) )
482  {
483  SIM_PLOT_PANEL* panel;
484  panel = new SIM_PLOT_PANEL( aSimType, m_plotNotebook, this, wxID_ANY );
485 
487  Pgm().GetCommonSettings()->m_Input.scroll_modifier_zoom != 0 );
488 
489  plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel );
490  }
491  else
492  {
493  SIM_NOPLOT_PANEL* panel;
494  panel = new SIM_NOPLOT_PANEL( aSimType, m_plotNotebook, wxID_ANY );
495  plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel );
496  }
497 
498  if( m_welcomePanel )
499  {
500  m_plotNotebook->DeletePage( 0 );
501  m_welcomePanel = nullptr;
502  }
503 
504  wxString pageTitle( m_simulator->TypeToName( aSimType, true ) );
505  pageTitle.Prepend( wxString::Format( _( "Plot%u - " ), (unsigned int) ++m_plotNumber ) );
506 
507  m_plotNotebook->AddPage( dynamic_cast<wxWindow*>( plotPanel ), pageTitle, true );
508  m_plots[plotPanel] = PLOT_INFO();
509 
510  return plotPanel;
511 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
void EnableMouseWheelPan(bool enabled)
Enable/disable trackpad friendly panning (2-axis scroll wheel)
Definition: mathplot.h:1217
mpWindow * GetPlotWin() const
Getter for math plot window
std::map< SIM_PANEL_BASE *, PLOT_INFO > m_plots
Map of plot panels and associated data
std::shared_ptr< SPICE_SIMULATOR > m_simulator
SIM_PANEL_BASE * m_welcomePanel
Info panel
static bool IsPlottable(SIM_TYPE aSimType)
wxAuiNotebook * m_plotNotebook
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:201
#define _(s)
Definition: 3d_actions.cpp:33
unsigned int m_plotNumber

References _, mpWindow::EnableMouseWheelPan(), Format(), SIM_PLOT_PANEL::GetPlotWin(), SIM_PANEL_BASE::IsPlottable(), SIM_PLOT_FRAME_BASE::m_plotNotebook, m_plotNumber, m_plots, m_simulator, m_welcomePanel, and Pgm().

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

◆ NonUserClose()

bool EDA_BASE_FRAME::NonUserClose ( bool  aForce)
inlineinherited

Definition at line 654 of file eda_base_frame.h.

655  {
656  m_isNonUserClose = true;
657  return Close( aForce );
658  }

References EDA_BASE_FRAME::m_isNonUserClose.

Referenced by KIWAY::PlayerClose().

◆ onAddSignal()

void SIM_PLOT_FRAME::onAddSignal ( wxCommandEvent &  event)
private

Definition at line 1326 of file sim_plot_frame.cpp.

1327 {
1328  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1329 
1330  if( !plotPanel || !m_exporter || plotPanel->GetType() != m_exporter->GetSimType() )
1331  {
1332  DisplayInfoMessage( this, _( "You need to run plot-providing simulation first." ) );
1333  return;
1334  }
1335 
1336  DIALOG_SIGNAL_LIST dialog( this, m_exporter.get() );
1337  dialog.ShowModal();
1338 }
SIM_TYPE GetType() const
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).
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_PANEL_BASE::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 256 of file eda_base_frame.cpp.

257 {
258  if( !doAutoSave() )
259  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
260 }
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 269 of file eda_base_frame.cpp.

270 {
271  wxLogTrace( kicadTraceKeyEvent, "EDA_BASE_FRAME::OnCharHook %s", dump( event ) );
272  // Key events can be filtered here.
273  // Currently no filtering is made.
274  event.Skip();
275 }
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.

◆ onCursorUpdate()

void SIM_PLOT_FRAME::onCursorUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 1425 of file sim_plot_frame.cpp.

1426 {
1427  wxSize size = m_cursors->GetClientSize();
1428  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
1429  m_cursors->ClearAll();
1430 
1431  if( !plotPanel )
1432  return;
1433 
1435  m_cursors->SetImageList(m_signalsIconColorList, wxIMAGE_LIST_SMALL);
1436 
1437  // Fill the signals listctrl
1438  m_cursors->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x / 2 );
1439  const long X_COL = m_cursors->AppendColumn( plotPanel->GetLabelX(), wxLIST_FORMAT_LEFT, size.x / 4 );
1440 
1441  wxString labelY1 = plotPanel->GetLabelY1();
1442  wxString labelY2 = plotPanel->GetLabelY2();
1443  wxString labelY;
1444 
1445  if( !labelY2.IsEmpty() )
1446  labelY = labelY1 + " / " + labelY2;
1447  else
1448  labelY = labelY1;
1449 
1450  const long Y_COL = m_cursors->AppendColumn( labelY, wxLIST_FORMAT_LEFT, size.x / 4 );
1451 
1452  // Update cursor values
1453  int itemidx = 0;
1454 
1455  for( const auto& trace : plotPanel->GetTraces() )
1456  {
1457  if( CURSOR* cursor = trace.second->GetCursor() )
1458  {
1459  // Find the right icon color in list.
1460  // It is the icon used in m_signals list for the same trace
1461  long iconColor = m_signals->FindItem( -1, trace.first );
1462 
1463  const wxRealPoint coords = cursor->GetCoords();
1464  long idx = m_cursors->InsertItem( itemidx++, trace.first, iconColor );
1465  m_cursors->SetItem( idx, X_COL, SPICE_VALUE( coords.x ).ToSpiceString() );
1466  m_cursors->SetItem( idx, Y_COL, SPICE_VALUE( coords.y ).ToSpiceString() );
1467  }
1468  }
1469 }
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 onPlotChanged(), onPlotClose(), removePlot(), and SIM_PLOT_FRAME().

◆ OnKicadAbout()

void EDA_BASE_FRAME::OnKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 761 of file eda_base_frame.cpp.

762 {
763  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
764  ShowAboutDialog( this );
765 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
The base frame for deriving all KiCad main window classes.

References ShowAboutDialog().

◆ OnMaximize()

void EDA_BASE_FRAME::OnMaximize ( wxMaximizeEvent &  aEvent)
inherited

Definition at line 958 of file eda_base_frame.cpp.

959 {
960  // When we maximize the window, we want to save the old information
961  // so that we can add it to the settings on next window load.
962  // Contrary to the documentation, this event seems to be generated
963  // when the window is also being unmaximized on OSX, so we only
964  // capture the size information when we maximize the window when on OSX.
965 #ifdef __WXOSX__
966  if( !IsMaximized() )
967 #endif
968  {
970  m_NormalFramePos = GetPosition();
971  wxLogTrace( traceDisplayLocation, "Maximizing window - Saving position (%d, %d) with size (%d, %d)",
973  }
974 
975  // Skip event to actually maximize the window
976  aEvent.Skip();
977 }
const wxChar *const traceDisplayLocation
Flag to enable debug output of display positioning logic.
wxSize m_NormalFrameSize
wxSize GetWindowSize()
Get the undecorated window size that can be used for restoring the window size.
wxPoint m_NormalFramePos

References EDA_BASE_FRAME::GetWindowSize(), EDA_BASE_FRAME::m_NormalFramePos, EDA_BASE_FRAME::m_NormalFrameSize, traceDisplayLocation, wxPoint::x, and wxPoint::y.

◆ OnMenuEvent()

void EDA_BASE_FRAME::OnMenuEvent ( wxMenuEvent &  event)
inherited

The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't captured by the menus themselves.

Definition at line 278 of file eda_base_frame.cpp.

279 {
280  if( !m_toolDispatcher )
281  aEvent.Skip();
282  else
284 }
virtual void DispatchWxEvent(wxEvent &aEvent)
Processes wxEvents (mostly UI events), translates them to TOOL_EVENTs, and makes tools handle those.
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:52

References TOOL_DISPATCHER::DispatchWxEvent(), and TOOLS_HOLDER::m_toolDispatcher.

◆ OnMove()

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

Reimplemented in EDA_DRAW_FRAME.

Definition at line 325 of file eda_base_frame.h.

326  {
327  aEvent.Skip();
328  }

◆ onPlotChanged()

void SIM_PLOT_FRAME::onPlotChanged ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1244 of file sim_plot_frame.cpp.

1245 {
1246  updateSignalList();
1247  wxCommandEvent dummy;
1248  onCursorUpdate( dummy );
1249 }
void onCursorUpdate(wxCommandEvent &aEvent)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
void updateSignalList()
Updates the list of currently plotted signals.

References dummy(), onCursorUpdate(), and updateSignalList().

◆ onPlotClose()

void SIM_PLOT_FRAME::onPlotClose ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1227 of file sim_plot_frame.cpp.

1228 {
1229  int idx = event.GetSelection();
1230 
1231  if( idx == wxNOT_FOUND )
1232  return;
1233 
1234  SIM_PANEL_BASE* plotPanel =
1235  dynamic_cast<SIM_PANEL_BASE*>( m_plotNotebook->GetPage( idx ) );
1236 
1237  m_plots.erase( plotPanel );
1238  updateSignalList();
1239  wxCommandEvent dummy;
1240  onCursorUpdate( dummy );
1241 }
std::map< SIM_PANEL_BASE *, PLOT_INFO > m_plots
Map of plot panels and associated data
wxAuiNotebook * m_plotNotebook
void onCursorUpdate(wxCommandEvent &aEvent)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
void updateSignalList()
Updates the list of currently plotted signals.

References dummy(), SIM_PLOT_FRAME_BASE::m_plotNotebook, m_plots, onCursorUpdate(), and updateSignalList().

◆ OnPreferences()

void EDA_BASE_FRAME::OnPreferences ( wxCommandEvent &  event)
inherited

Definition at line 768 of file eda_base_frame.cpp.

769 {
770  PAGED_DIALOG dlg( this, _( "Preferences" ), true );
771  wxTreebook* book = dlg.GetTreebook();
772 
773  book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
774 
775  book->AddPage( new PANEL_MOUSE_SETTINGS( &dlg, book ), _( "Mouse and Touchpad" ) );
776 
777  PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
778  book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
779 
780  for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
781  {
782  KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
783 
784  if( frame )
785  frame->InstallPreferences( &dlg, hotkeysPanel );
786  }
787 
788  // The Kicad manager frame is not a player so we have to add it by hand
789  wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
790 
791  if( manager )
792  static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
793 
794  for( size_t i = 0; i < book->GetPageCount(); ++i )
795  book->GetPage( i )->Layout();
796 
797  if( dlg.ShowModal() == wxID_OK )
798  dlg.Kiway().CommonSettingsChanged( false, false );
799 }
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:343
#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 1341 of file sim_plot_frame.cpp.

1342 {
1343  if( m_schematicFrame == NULL )
1344  return;
1345 
1347  m_schematicFrame->Raise();
1348 }
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
SCH_EDIT_FRAME * m_schematicFrame
#define NULL
static TOOL_ACTION simProbe
Definition: ee_actions.h:210
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:78

References TOOLS_HOLDER::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 1289 of file sim_plot_frame.cpp.

1290 {
1291  SIM_PANEL_BASE* plotPanelWindow = currentPlotWindow();
1292 
1293  // Initial processing is required to e.g. display a list of power sources
1295 
1296  if( !m_exporter->ProcessNetlist( NET_ALL_FLAGS ) )
1297  {
1298  DisplayError( this, _( "There were errors during netlist export, aborted." ) );
1299  return;
1300  }
1301 
1302  if( !m_settingsDlg )
1303  m_settingsDlg = new DIALOG_SIM_SETTINGS( this );
1304 
1305  if( plotPanelWindow != m_welcomePanel )
1306  m_settingsDlg->SetSimCommand( m_plots[plotPanelWindow].m_simCommand );
1307 
1309 
1310  if( m_settingsDlg->ShowModal() == wxID_OK )
1311  {
1312  wxString newCommand = m_settingsDlg->GetSimCommand();
1313  SIM_TYPE newSimType = NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( newCommand );
1314 
1315  // If it is a new simulation type, open a new plot
1316  if( !plotPanelWindow || ( plotPanelWindow && plotPanelWindow->GetType() != newSimType ) )
1317  {
1318  plotPanelWindow = NewPlotPanel( newSimType );
1319  }
1320 
1321  m_plots[plotPanelWindow].m_simCommand = newCommand;
1322  }
1323 }
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)
SIM_PANEL_BASE * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
std::map< SIM_PANEL_BASE *, PLOT_INFO > m_plots
Map of plot panels and associated data
SIM_PANEL_BASE * m_welcomePanel
Info panel
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Returns simulation type basing on a simulation command directive.
const wxString & GetSimCommand() const
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
SIM_PANEL_BASE * currentPlotWindow() const
Returns the currently opened plot panel (or NULL if there is none).
void SetNetlistExporter(NETLIST_EXPORTER_PSPICE_SIM *aExporter)
SIM_TYPE GetType() const
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

References _, NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType(), currentPlotWindow(), DisplayError(), DIALOG_SIM_SETTINGS::GetSimCommand(), SIM_PANEL_BASE::GetType(), m_exporter, m_plots, m_settingsDlg, m_welcomePanel, 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 1360 of file sim_plot_frame.cpp.

1361 {
1362  class NETLIST_VIEW_DIALOG : public wxDialog
1363  {
1364  public:
1365  enum
1366  {
1367  MARGIN_LINE_NUMBERS
1368  };
1369 
1370  void onClose( wxCloseEvent& evt )
1371  {
1372  EndModal( GetReturnCode() );
1373  }
1374 
1375  NETLIST_VIEW_DIALOG(wxWindow* parent, wxString source) :
1376  wxDialog(parent, wxID_ANY, "SPICE Netlist",
1377  wxDefaultPosition, wxSize(1500,900),
1378  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
1379  {
1380  wxStyledTextCtrl* text = new wxStyledTextCtrl( this, wxID_ANY );
1381 
1382  text->SetMarginWidth( MARGIN_LINE_NUMBERS, 50 );
1383  text->StyleSetForeground( wxSTC_STYLE_LINENUMBER, wxColour( 75, 75, 75 ) );
1384  text->StyleSetBackground( wxSTC_STYLE_LINENUMBER, wxColour( 220, 220, 220 ) );
1385  text->SetMarginType( MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER );
1386 
1387  text->SetWrapMode( wxSTC_WRAP_WORD );
1388 
1389  text->SetText( source );
1390 
1391  text->StyleClearAll();
1392  text->SetLexer( wxSTC_LEX_SPICE );
1393 
1394  wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
1395  sizer->Add( text, 1, wxEXPAND );
1396  SetSizer( sizer );
1397 
1398  Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ), NULL,
1399  this );
1400  }
1401  };
1402 
1403  if( m_schematicFrame == NULL || m_simulator == NULL )
1404  return;
1405 
1406  NETLIST_VIEW_DIALOG dlg( this, m_simulator->GetNetlist() );
1407  dlg.ShowModal();
1408 }
std::shared_ptr< SPICE_SIMULATOR > m_simulator
SCH_EDIT_FRAME * m_schematicFrame
#define NULL

References m_schematicFrame, m_simulator, and NULL.

Referenced by SIM_PLOT_FRAME().

◆ onSignalDblClick()

void SIM_PLOT_FRAME::onSignalDblClick ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from SIM_PLOT_FRAME_BASE.

Definition at line 1252 of file sim_plot_frame.cpp.

1253 {
1254  // Remove signal from the plot panel when double clicked
1255  long idx = m_signals->GetFocusedItem();
1256 
1257  if( idx != wxNOT_FOUND )
1258  removePlot( m_signals->GetItemText( idx, 0 ) );
1259 }
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 1262 of file sim_plot_frame.cpp.

1263 {
1264  int idx = event.GetIndex();
1265 
1266  if( idx != wxNOT_FOUND )
1267  m_signals->Select( idx );
1268 
1269  idx = m_signals->GetFirstSelected();
1270 
1271  if( idx != wxNOT_FOUND )
1272  {
1273  const wxString& netName = m_signals->GetItemText( idx, 0 );
1274  SIGNAL_CONTEXT_MENU ctxMenu( netName, this );
1275  m_signals->PopupMenu( &ctxMenu );
1276  }
1277 }

References SIM_PLOT_FRAME_BASE::m_signals.

◆ onSimFinished()

void SIM_PLOT_FRAME::onSimFinished ( wxCommandEvent &  aEvent)
private

Definition at line 1479 of file sim_plot_frame.cpp.

1480 {
1481  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_run_xpm ) );
1482  SetCursor( wxCURSOR_ARROW );
1483 
1484  SIM_TYPE simType = m_exporter->GetSimType();
1485 
1486  if( simType == ST_UNKNOWN )
1487  return;
1488 
1489  SIM_PANEL_BASE* plotPanelWindow = currentPlotWindow();
1490 
1491  if( !plotPanelWindow || plotPanelWindow->GetType() != simType )
1492  plotPanelWindow = NewPlotPanel( simType );
1493 
1494  if( IsSimulationRunning() )
1495  return;
1496 
1497  // If there are any signals plotted, update them
1498  if( SIM_PANEL_BASE::IsPlottable( simType ) )
1499  {
1500  TRACE_MAP& traceMap = m_plots[plotPanelWindow].m_traces;
1501  SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( plotPanelWindow );
1502 
1503  wxCHECK_RET( plotPanel, "not a SIM_PLOT_PANEL" );
1504 
1505  for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */)
1506  {
1507  if( !updatePlot( it->second, plotPanel ) )
1508  {
1509  removePlot( it->first, false );
1510  it = traceMap.erase( it ); // remove a plot that does not exist anymore
1511  }
1512  else
1513  {
1514  ++it;
1515  }
1516  }
1517 
1518  updateSignalList();
1519  plotPanel->GetPlotWin()->UpdateAll();
1520  plotPanel->ResetScales();
1521  }
1522  else if( simType == ST_OP )
1523  {
1524  m_simConsole->AppendText( _( "\n\nSimulation results:\n\n" ) );
1525  m_simConsole->SetInsertionPointEnd();
1526 
1527  for( const auto& vec : m_simulator->AllPlots() )
1528  {
1529  double val = m_simulator->GetRealPlot( vec, 1 ).at( 0 );
1530 
1531  wxString outLine, signal;
1532  SIM_PLOT_TYPE type = m_exporter->VectorToSignal( vec, signal );
1533 
1534  const size_t tab = 25; //characters
1535  size_t padding = ( signal.length() < tab ) ? ( tab - signal.length() ) : 1;
1536 
1537  outLine.Printf( wxT( "%s%s" ), ( signal + wxT( ":" ) ).Pad( padding, wxUniChar( ' ' ) ),
1538  SPICE_VALUE( val ).ToSpiceString() );
1539 
1540  outLine.Append( type == SPT_CURRENT ? "A\n" : "V\n" );
1541 
1542  m_simConsole->AppendText( outLine );
1543  m_simConsole->SetInsertionPointEnd();
1544 
1545  // @todo display calculated values on the schematic
1546  }
1547  }
1548 }
mpWindow * GetPlotWin() const
Getter for math plot window
SIM_PANEL_BASE * NewPlotPanel(SIM_TYPE aSimType)
Creates a new plot panel for a given simulation type and adds it to the main notebook.
std::map< SIM_PANEL_BASE *, PLOT_INFO > m_plots
Map of plot panels and associated data
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.
static bool IsPlottable(SIM_TYPE aSimType)
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2713
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
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
SIM_PANEL_BASE * currentPlotWindow() const
Returns the currently opened plot panel (or NULL if there is none).
void ResetScales()
Resets scale ranges to fit the current traces
bool IsSimulationRunning()
SIM_TYPE GetType() const
std::unique_ptr< NETLIST_EXPORTER_PSPICE_SIM > m_exporter
#define _(s)
Definition: 3d_actions.cpp:33
void updateSignalList()
Updates the list of currently plotted signals.
const BITMAP_OPAQUE sim_run_xpm[1]
Definition: sim_run.cpp:35
std::map< wxString, TRACE_DESC > TRACE_MAP
void removePlot(const wxString &aPlotName, bool aErase=true)
Removes a plot with a specific title.
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:44

References _, currentPlotWindow(), SIM_PLOT_PANEL::GetPlotWin(), SIM_PANEL_BASE::GetType(), ID_SIM_RUN, SIM_PANEL_BASE::IsPlottable(), IsSimulationRunning(), KiBitmap(), m_exporter, m_plots, SIM_PLOT_FRAME_BASE::m_simConsole, m_simulator, SIM_PLOT_FRAME_BASE::m_toolBar, NewPlotPanel(), removePlot(), SIM_PLOT_PANEL::ResetScales(), sim_run_xpm, SPT_CURRENT, ST_OP, ST_UNKNOWN, mpWindow::UpdateAll(), updatePlot(), and updateSignalList().

Referenced by SIM_PLOT_FRAME().

◆ onSimReport()

void SIM_PLOT_FRAME::onSimReport ( wxCommandEvent &  aEvent)
private

Definition at line 1573 of file sim_plot_frame.cpp.

1574 {
1575  m_simConsole->AppendText( aEvent.GetString() + "\n" );
1576  m_simConsole->SetInsertionPointEnd();
1577 }

References SIM_PLOT_FRAME_BASE::m_simConsole.

Referenced by SIM_PLOT_FRAME().

◆ onSimStarted()

void SIM_PLOT_FRAME::onSimStarted ( wxCommandEvent &  aEvent)
private

Definition at line 1472 of file sim_plot_frame.cpp.

1473 {
1474  m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_stop_xpm ) );
1475  SetCursor( wxCURSOR_ARROWWAIT );
1476 }
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 1280 of file sim_plot_frame.cpp.

1281 {
1282  if( IsSimulationRunning() )
1283  StopSimulation();
1284  else
1285  StartSimulation();
1286 }
void StartSimulation(const wxString &aSimCommand=wxEmptyString)
bool IsSimulationRunning()

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

Referenced by SIM_PLOT_FRAME().

◆ onSimUpdate()

void SIM_PLOT_FRAME::onSimUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 1551 of file sim_plot_frame.cpp.

1552 {
1553  if( IsSimulationRunning() )
1554  StopSimulation();
1555 
1556  if( CurrentPlot() != m_lastSimPlot )
1557  {
1558  // We need to rerun simulation, as the simulator currently stores
1559  // results for another plot
1560  StartSimulation();
1561  }
1562  else
1563  {
1564  // Incremental update
1565  m_simConsole->Clear();
1566  // Do not export netlist, it is already stored in the simulator
1567  applyTuners();
1568  m_simulator->Run();
1569  }
1570 }
void applyTuners()
Applies component values specified using tunder sliders to the current netlist.
std::shared_ptr< SPICE_SIMULATOR > m_simulator
void StartSimulation(const wxString &aSimCommand=wxEmptyString)
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 1351 of file sim_plot_frame.cpp.

1352 {
1353  if( m_schematicFrame == NULL )
1354  return;
1355 
1357  m_schematicFrame->Raise();
1358 }
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
SCH_EDIT_FRAME * m_schematicFrame
#define NULL
static TOOL_ACTION simTune
Definition: ee_actions.h:211
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:78

References TOOLS_HOLDER::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, BM2CMP_FRAME, and PL_EDITOR_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 BACK_ANNOTATE::FetchNetlistFromPCB(), PGM_TEST_FRAME::MacOpenFile(), PGM_SINGLE_TOP::MacOpenFile(), PGM_MOCK_EESCHEMA_FRAME::MacOpenFile(), SCH_EDIT_FRAME::OnOpenPcbnew(), PGM_SINGLE_TOP::OnPgmInit(), SCH_EDIT_FRAME::OnUpdatePCB(), PCB_EDIT_FRAME::RunEeschema(), and PCB_EDIT_FRAME::TestStandalone().

◆ ParseArgs()

virtual void KIWAY_PLAYER::ParseArgs ( wxCmdLineParser &  aParser)
inlinevirtualinherited

Handles command-line arguments in a frame-specific way.

The given argument parser has already been initialized with the command line and any options/switches that are handled by the top-level launcher before passing control to the child frame.

Parameters
aParseris the argument parser created by the top-level launcher.

Definition at line 138 of file kiway_player.h.

139  {
140  WXUNUSED( aParser );
141  }

Referenced by PGM_SINGLE_TOP::OnPgmInit().

◆ PopCommandFromRedoList()

PICKED_ITEMS_LIST * EDA_BASE_FRAME::PopCommandFromRedoList ( )
virtualinherited

PopCommandFromRedoList return the last command to undo and remove it from list nothing is deleted.

Definition at line 942 of file eda_base_frame.cpp.

943 {
944  return m_redoList.PopCommand();
945 }
PICKED_ITEMS_LIST * PopCommand()
UNDO_REDO_CONTAINER m_redoList

References EDA_BASE_FRAME::m_redoList, and UNDO_REDO_CONTAINER::PopCommand().

Referenced by LIB_EDIT_FRAME::GetComponentFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), and SCH_EDITOR_CONTROL::Redo().

◆ PopCommandFromUndoList()

◆ PopTool()

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

Definition at line 61 of file tools_holder.cpp.

62 {
63  // Push/pop events can get out of order (such as when they're generated by the Simulator
64  // frame but not processed until the mouse is back in the Schematic frame), so make sure
65  // we're popping the right stack frame.
66 
67  for( int i = (int) m_toolStack.size() - 1; i >= 0; --i )
68  {
69  if( m_toolStack[ i ] == actionName )
70  {
71  m_toolStack.erase( m_toolStack.begin() + i );
72 
73  // If there's something underneath us, and it's now the top of the stack, then
74  // re-activate it
75  if( ( --i ) >= 0 && i == (int)m_toolStack.size() - 1 )
76  {
77  std::string back = m_toolStack[ i ];
79 
80  if( action )
81  {
82  // Pop the action as running it will push it back onto the stack
83  m_toolStack.pop_back();
84 
85  TOOL_EVENT evt = action->MakeEvent();
86  evt.SetHasPosition( false );
87  GetToolManager()->PostEvent( evt );
88  }
89  }
90  else
92 
93  return;
94  }
95  }
96 }
virtual void DisplayToolMsg(const wxString &msg)
Definition: tools_holder.h:122
TOOL_ACTION * FindAction(const std::string &aActionName) const
Finds an action with a given name (if there is one available).
TOOL_EVENT.
Definition: tool_event.h:171
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:50
std::vector< std::string > m_toolStack
Definition: tools_holder.h:56
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:199
Represents a single user action.
Definition: tool_action.h:44
TOOL_EVENT MakeEvent() const
Returns the event associated with the action (i.e.
Definition: tool_action.h:113
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:78
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:273
static TOOL_ACTION selectionTool
Definition: actions.h:149
void SetHasPosition(bool aHasPosition)
Definition: tool_event.h:261

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

Referenced by EDIT_TOOL::copyToClipboard(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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 661 of file eda_base_frame.cpp.

662 {
663  SetStatusText( text );
664 }

◆ 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:173

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), 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_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), PCB_EDIT_FRAME::doAutoSave(), PCB_BASE_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), DIALOG_EXPORT_SVG::ExportSVGFile(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedSymbol(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), 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::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), EDA_BASE_FRAME::LoadWindowState(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), 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(), PROPERTIES_FRAME::onScintillaCharAdded(), DIALOG_LABEL_EDITOR::onScintillaCharAdded(), DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded(), 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(), FOOTPRINT_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_PLOT::Plot(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), SCH_EDIT_FRAME::PrintPage(), EDA_DRAW_FRAME::PrintWorkSheet(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), PCB_INSPECTION_TOOL::reportCopperClearance(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), DRC_TOOL::RunTests(), 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(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), EDA_BASE_FRAME::SaveSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and SCH_EDIT_FRAME::~SCH_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 198 of file eda_base_frame.cpp.

199 {
200 #ifdef __WXMAC__
201  // Apple in its infinite wisdom will raise a disabled window before even passing
202  // us the event, so we have no way to stop it. Instead, we have to catch an
203  // improperly ordered disabled window and quasi-modal dialog here and reorder
204  // them.
205  if( !IsEnabled() && IsActive() )
206  {
207  wxWindow* dlg = findQuasiModalDialog();
208  if( dlg )
209  dlg->Raise();
210  }
211 #endif
212 
213  if( !wxFrame::ProcessEvent( aEvent ) )
214  return false;
215 
216  if( IsShown() && m_hasAutoSave && IsActive() &&
218  {
219  if( !m_autoSaveState )
220  {
221  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
222  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
223  m_autoSaveState = true;
224  }
225  else if( m_autoSaveTimer->IsRunning() )
226  {
227  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
228  m_autoSaveTimer->Stop();
229  m_autoSaveState = false;
230  }
231  }
232 
233  return true;
234 }
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().

◆ ProjectChanged()

virtual void EDA_BASE_FRAME::ProjectChanged ( )
inlinevirtualinherited

Notification event that the project has changed.

Reimplemented in PCB_EDIT_FRAME, and KICAD_MANAGER_FRAME.

Definition at line 571 of file eda_base_frame.h.

571 {}

Referenced by KIWAY::ProjectChanged().

◆ PushCommandToRedoList()

void EDA_BASE_FRAME::PushCommandToRedoList ( PICKED_ITEMS_LIST aItem)
virtualinherited

Function PushCommandToRedoList add a command to redo in redo list delete the very old commands when the max count of redo commands is reached ( using ClearUndoORRedoList)

Definition at line 921 of file eda_base_frame.cpp.

922 {
923  m_redoList.PushCommand( aNewitem );
924 
925  // Delete the extra items, if count max reached
926  if( m_UndoRedoCountMax > 0 )
927  {
928  int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax;
929 
930  if( extraitems > 0 )
931  ClearUndoORRedoList( REDO_LIST, extraitems );
932  }
933 }
virtual int GetRedoCommandCount() const
virtual void ClearUndoORRedoList(UNDO_REDO_LIST aList, int aItemCount=-1)
void PushCommand(PICKED_ITEMS_LIST *aCommand)
UNDO_REDO_CONTAINER m_redoList

References EDA_BASE_FRAME::ClearUndoORRedoList(), EDA_BASE_FRAME::GetRedoCommandCount(), EDA_BASE_FRAME::m_redoList, EDA_BASE_FRAME::m_UndoRedoCountMax, UNDO_REDO_CONTAINER::PushCommand(), and EDA_BASE_FRAME::REDO_LIST.

Referenced by LIB_EDIT_FRAME::GetComponentFromUndoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), and SCH_EDITOR_CONTROL::Undo().

◆ PushCommandToUndoList()

void EDA_BASE_FRAME::PushCommandToUndoList ( PICKED_ITEMS_LIST aItem)
virtualinherited

Function PushCommandToUndoList add a command to undo in undo list delete the very old commands when the max count of undo commands is reached ( using ClearUndoORRedoList)

Definition at line 906 of file eda_base_frame.cpp.

907 {
908  m_undoList.PushCommand( aNewitem );
909 
910  // Delete the extra items, if count max reached
911  if( m_UndoRedoCountMax > 0 )
912  {
913  int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax;
914 
915  if( extraitems > 0 )
916  ClearUndoORRedoList( UNDO_LIST, extraitems );
917  }
918 }
UNDO_REDO_CONTAINER m_undoList
virtual void ClearUndoORRedoList(UNDO_REDO_LIST aList, int aItemCount=-1)
void PushCommand(PICKED_ITEMS_LIST *aCommand)
virtual int GetUndoCommandCount() const

References EDA_BASE_FRAME::ClearUndoORRedoList(), EDA_BASE_FRAME::GetUndoCommandCount(), EDA_BASE_FRAME::m_undoList, EDA_BASE_FRAME::m_UndoRedoCountMax, UNDO_REDO_CONTAINER::PushCommand(), and EDA_BASE_FRAME::UNDO_LIST.

Referenced by LIB_EDIT_FRAME::GetComponentFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), SCH_EDITOR_CONTROL::Redo(), PL_EDITOR_FRAME::SaveCopyInUndoList(), LIB_EDIT_FRAME::SaveCopyInUndoList(), and SCH_EDIT_FRAME::SaveCopyInUndoList().

◆ PushTool()

void TOOLS_HOLDER::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 44 of file tools_holder.cpp.

45 {
46  m_toolStack.push_back( actionName );
47 
48  // Human cognitive stacking is very shallow; deeper tool stacks just get annoying
49  if( m_toolStack.size() > 3 )
50  m_toolStack.erase( m_toolStack.begin() );
51 
52  TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
53 
54  if( action )
55  DisplayToolMsg( action->GetLabel() );
56  else
57  DisplayToolMsg( actionName );
58 }
virtual void DisplayToolMsg(const wxString &msg)
Definition: tools_holder.h:122
TOOL_ACTION * FindAction(const std::string &aActionName) const
Finds an action with a given name (if there is one available).
wxString GetLabel() const
Definition: tool_action.cpp:69
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:50
std::vector< std::string > m_toolStack
Definition: tools_holder.h:56
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:199
Represents a single user action.
Definition: tool_action.h:44

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

Referenced by EDIT_TOOL::copyToClipboard(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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()

◆ RefreshCanvas()

virtual void TOOLS_HOLDER::RefreshCanvas ( )
inlinevirtualinherited

Reimplemented in EDA_DRAW_FRAME.

Definition at line 152 of file tools_holder.h.

152 { }

Referenced by TOOL_MANAGER::ProcessEvent().

◆ RegisterUIUpdateHandler() [1/2]

virtual void EDA_BASE_FRAME::RegisterUIUpdateHandler ( const TOOL_ACTION aAction,
const ACTION_CONDITIONS aConditions 
)
inlineoverridevirtualinherited

Register an action's update conditions with the UI layer to allow the UI to appropriately display the state of its controls.

Parameters
aActionis the action to register
aConditionsare the UI conditions to use for the control states

Reimplemented from TOOLS_HOLDER.

Definition at line 288 of file eda_base_frame.h.

290  {
291  RegisterUIUpdateHandler( aAction.GetUIId(), aConditions );
292  }
int GetUIId() const
Definition: tool_action.h:102
virtual void RegisterUIUpdateHandler(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions) override
Register an action's update conditions with the UI layer to allow the UI to appropriately display the...

References TOOL_ACTION::GetUIId().

Referenced by KICAD_MANAGER_FRAME::ReCreateMenuBar(), PL_EDITOR_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::setupUIConditions(), EDA_3D_VIEWER::setupUIConditions(), KICAD_MANAGER_FRAME::setupUIConditions(), EDA_BASE_FRAME::setupUIConditions(), and LIB_EDIT_FRAME::setupUIConditions().

◆ RegisterUIUpdateHandler() [2/2]

void EDA_BASE_FRAME::RegisterUIUpdateHandler ( int  aID,
const ACTION_CONDITIONS aConditions 
)
virtualinherited

Register a UI update handler for the control with ID aID.

Parameters
aIDis the control ID to register the handler for
aConditionsare the UI conditions to use for the control states

Definition at line 287 of file eda_base_frame.cpp.

288 {
290  std::placeholders::_1,
291  this,
292  aConditions );
293 
294  m_uiUpdateMap[aID] = evtFunc;
295 
296  Bind( wxEVT_UPDATE_UI, evtFunc, aID );
297 }
static void HandleUpdateUIEvent(wxUpdateUIEvent &aEvent, EDA_BASE_FRAME *aFrame, ACTION_CONDITIONS aCond)
Handles events generated when the UI is trying to figure out the current state of the UI controls rel...
std::function< void(wxUpdateUIEvent &) > UIUpdateHandler
This is the handler functor for the update UI events.
std::map< int, UIUpdateHandler > m_uiUpdateMap

References EDA_BASE_FRAME::HandleUpdateUIEvent(), and EDA_BASE_FRAME::m_uiUpdateMap.

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

649 {
650  SIM_PLOT_PANEL* plotPanel = CurrentPlot();
651 
652  if( !plotPanel )
653  return;
654 
655  if( aErase )
656  {
657  auto& traceMap = m_plots[plotPanel].m_traces;
658  auto traceIt = traceMap.find( aPlotName );
659  wxASSERT( traceIt != traceMap.end() );
660  traceMap.erase( traceIt );
661  }
662 
663  wxASSERT( plotPanel->TraceShown( aPlotName ) );
664  plotPanel->DeleteTrace( aPlotName );
665  plotPanel->GetPlotWin()->Fit();
666 
668  wxCommandEvent dummy;
670 }
mpWindow * GetPlotWin() const
Getter for math plot window
std::map< SIM_PANEL_BASE *, PLOT_INFO > m_plots
Map of plot panels and associated data
bool DeleteTrace(const wxString &aName)
void onCursorUpdate(wxCommandEvent &aEvent)
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:1977
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
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(), dummy(), mpWindow::Fit(), SIM_PLOT_PANEL::GetPlotWin(), m_plots, onCursorUpdate(), SIM_PLOT_PANEL::TraceShown(), and updateSignalList().

Referenced by onSignalDblClick(), and onSimFinished().

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

567 {
568  if( aErase )
569  m_tuners.remove( aTuner );
570 
571  aTuner->Destroy();
572  m_tunePanel->Layout();
573 }
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 436 of file eda_base_frame.h.

436 {};

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

242 {
243  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
244  wxASSERT( cfg );
245 
246  if( cfg )
247  {
249 
250  cfg->m_Simulator.plot_panel_width = m_splitterLeftRight->GetSashPosition();
251  cfg->m_Simulator.plot_panel_height = m_splitterPlotAndConsole->GetSashPosition();
252  cfg->m_Simulator.signal_panel_height = m_splitterSignals->GetSashPosition();
253  cfg->m_Simulator.cursors_panel_height = m_splitterTuneValues->GetSashPosition();
254  cfg->m_Simulator.white_background = m_plotUseWhiteBg;
255  }
256 }
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 doCloseWindow().

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

551 {
552  wxString text;
553 
554  if( IsIconized() )
555  return;
556 
557  wxString baseCfgName = ConfigBaseName();
558 
559  // If the window is maximized, we use the saved window size from before it was maximized
560  if( IsMaximized() )
561  {
564  }
565  else
566  {
568  m_FramePos = GetPosition();
569  }
570 
571  aCfg->state.pos_x = m_FramePos.x;
572  aCfg->state.pos_y = m_FramePos.y;
573  aCfg->state.size_x = m_FrameSize.x;
574  aCfg->state.size_y = m_FrameSize.y;
575  aCfg->state.maximized = IsMaximized();
576  aCfg->state.display = wxDisplay::GetFromWindow( this );
577 
578  wxLogTrace( traceDisplayLocation, "Saving window maximized: %s", IsMaximized() ? "true" : "false" );
579  wxLogTrace( traceDisplayLocation, "Saving config position (%d, %d) with size (%d, %d)",
581 
582  // TODO(JE) should auto-save in common settings be overwritten by every app?
583  if( m_hasAutoSave )
584  Pgm().GetCommonSettings()->m_System.autosave_interval = m_autoSaveInterval;
585 
586  // Once this is fully implemented, wxAuiManager will be used to maintain
587  // the persistance of the main frame and all it's managed windows and
588  // all of the legacy frame persistence position code can be removed.
589  aCfg->perspective = m_auimgr.SavePerspective().ToStdString();
590 
591  aCfg->mru_path = m_mruPath;
592 }
wxString mru_path
Definition: app_settings.h:84
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
wxString m_mruPath
const wxChar *const traceDisplayLocation
Flag to enable debug output of display positioning logic.
wxAuiManager m_auimgr
wxSize m_NormalFrameSize
wxString perspective
Definition: app_settings.h:85
wxSize GetWindowSize()
Get the undecorated window size that can be used for restoring the window size.
wxString ConfigBaseName() override
WINDOW_STATE state
Definition: app_settings.h:83
unsigned int display
Definition: app_settings.h:75
wxPoint m_NormalFramePos

References EDA_BASE_FRAME::ConfigBaseName(), WINDOW_STATE::display, EDA_BASE_FRAME::GetWindowSize(), 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, EDA_BASE_FRAME::m_NormalFramePos, EDA_BASE_FRAME::m_NormalFrameSize, WINDOW_STATE::maximized, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, Pgm(), WINDOW_STATE::pos_x, WINDOW_STATE::pos_y, WINDOW_STATE::size_x, WINDOW_STATE::size_y, WINDOW_SETTINGS::state, traceDisplayLocation, 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 957 of file sim_plot_frame.cpp.

958 {
959 
960  wxString savePath = aPath;
961 
962  if( !savePath.Lower().EndsWith(".wbk"))
963  {
964  savePath += ".wbk";
965  };
966 
967 
968  wxTextFile file( savePath );
969 
970  if( file.Exists() )
971  {
972  if( !file.Open() )
973  return false;
974 
975  file.Clear();
976  }
977  else
978  {
979  file.Create();
980  }
981 
982  file.AddLine( wxString::Format( "%llu", m_plots.size() ) );
983 
984  for( const auto& plot : m_plots )
985  {
986  if( plot.first )
987  {
988  file.AddLine( wxString::Format( "%d", plot.first->GetType() ) );
989  file.AddLine( plot.second.m_simCommand );
990  file.AddLine( wxString::Format( "%llu", plot.second.m_traces.size() ) );
991 
992  for( const auto& trace : plot.second.m_traces )
993  {
994  file.AddLine( wxString::Format( "%d", trace.second.GetType() ) );
995  file.AddLine( trace.second.GetName() );
996  file.AddLine( trace.second.GetParam() );
997  }
998  }
999  }
1000 
1001  bool res = file.Write();
1002  file.Close();
1003 
1004  return res;
1005 }
std::map< SIM_PANEL_BASE *, 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:201

References Format(), and m_plots.

Referenced by menuSaveWorkbook().

◆ SetAutoSaveInterval()

void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 237 of file eda_base_frame.cpp.

238 {
239  m_autoSaveInterval = aInterval;
240 
241  if( m_autoSaveTimer->IsRunning() )
242  {
243  if( m_autoSaveInterval > 0 )
244  {
245  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
246  }
247  else
248  {
249  m_autoSaveTimer->Stop();
250  m_autoSaveState = false;
251  }
252  }
253 }
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 295 of file sim_plot_frame.cpp.

296 {
297  // Give icons to menuitems of the main menubar
298  BM_MENU_INIT_ITEM bm_list[]
299  {
300  // File menu:
301  { wxID_NEW, simulator_xpm },
302  { wxID_OPEN,directory_browser_xpm },
303  { wxID_SAVE, directory_xpm},
306  { wxID_CLOSE, exit_xpm},
307 
308  // simulator menu:
315 
316  // View menu
317  { wxID_ZOOM_IN, zoom_in_xpm},
318  { wxID_ZOOM_OUT, zoom_out_xpm},
319  { wxID_ZOOM_FIT, zoom_fit_in_page_xpm},
324 
325  { 0, nullptr } // Sentinel
326  };
327 
328  // wxMenuItems are already created and attached to the m_mainMenu wxMenuBar.
329  // A problem is the fact setting bitmaps in wxMenuItems after they are attached
330  // to a wxMenu do not work in all cases.
331  // So the trick is:
332  // Remove the wxMenuItem from its wxMenu
333  // Set the bitmap
334  // Insert the modified wxMenuItem to its previous place
335  for( int ii = 0; bm_list[ii].m_MenuId; ++ii )
336  {
337  wxMenuItem* item = m_mainMenu->FindItem( bm_list[ii].m_MenuId );
338 
339  if( !item || !bm_list[ii].m_Bitmap)
340  continue;
341 
342  wxMenu* menu = item->GetMenu();
343