KiCad PCB EDA Suite
KICAD_MANAGER_FRAME Class Reference

The main KiCad project manager frame. More...

#include <kicad_manager_frame.h>

Inheritance diagram for KICAD_MANAGER_FRAME:
EDA_BASE_FRAME TOOLS_HOLDER KIWAY_HOLDER

Public Types

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

Public Member Functions

 KICAD_MANAGER_FRAME (wxWindow *parent, const wxString &title, const wxPoint &pos, const wxSize &size)
 
 ~KICAD_MANAGER_FRAME ()
 
void OnCloseWindow (wxCloseEvent &Event)
 
void OnSize (wxSizeEvent &event)
 
void OnArchiveFiles (wxCommandEvent &event)
 
void OnUnarchiveFiles (wxCommandEvent &event)
 
void OnOpenFileInTextEditor (wxCommandEvent &event)
 
void OnBrowseInFileExplorer (wxCommandEvent &event)
 
void OnFileHistory (wxCommandEvent &event)
 
void OnClearFileHistory (wxCommandEvent &aEvent)
 
void OnExit (wxCommandEvent &event)
 
void ReCreateMenuBar () override
 Recreates the menu bar. More...
 
void RecreateBaseHToolbar ()
 (Re)Create the horizontal toolbar More...
 
void RecreateLauncher ()
 
wxString GetCurrentFileName () const override
 Get the full filename + path of the currently opened file in the frame. More...
 
void OnImportEagleFiles (wxCommandEvent &event)
 Open dialog to import Eagle schematic and board files. More...
 
void PrintMsg (const wxString &aText)
 Displays aText in the text panel. More...
 
void PrintPrjInfo ()
 Prints the current working directory name and the project name on the text panel. More...
 
void ClearMsg ()
 Erase the text panel. More...
 
void RefreshProjectTree ()
 
void CreateNewProject (const wxFileName &aProjectFileName)
 Creates a new project by setting up and initial project, schematic, and board files. More...
 
bool CloseProject (bool aSave)
 Closes the project, and saves it if aSave is true;. More...
 
void LoadProject (const wxFileName &aProjectFileName)
 
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...
 
void ShowChangedLanguage () override
 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...
 
void OnChangeWatchedPaths (wxCommandEvent &aEvent)
 Called by sending a event with id = ID_INIT_WATCHED_PATHS rebuild the list of watched paths. More...
 
void SyncToolbars () override
 Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
void InstallPreferences (PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
 Function InstallPreferences Allow a frame to load its preference panels (if any) into the preferences dialog. More...
 
void SetProjectFileName (const wxString &aFullProjectProFileName)
 
const wxString GetProjectFileName () const
 
bool IsProjectActive ()
 
const wxString SchFileName ()
 
const wxString SchLegacyFileName ()
 
const wxString PcbFileName ()
 
const wxString PcbLegacyFileName ()
 
void ReCreateTreePrj ()
 
wxWindow * GetToolCanvas () const override
 Canvas access. More...
 
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 OnMove (wxMoveEvent &aEvent)
 
void OnMaximize (wxMaximizeEvent &aEvent)
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void OnKicadAbout (wxCommandEvent &event)
 
void OnPreferences (wxCommandEvent &event)
 
WX_INFOBARGetInfoBar ()
 
void LoadWindowSettings (WINDOW_SETTINGS *aCfg)
 Loads window settings from the given settings object Normally called by LoadSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
void SaveWindowSettings (WINDOW_SETTINGS *aCfg)
 Saves window settings to the given settings object Normally called by SaveSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
virtual WINDOW_SETTINGSGetWindowSettings (APP_SETTINGS_BASE *aCfg)
 Returns a pointer to the window settings for this frame. 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
 
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 ProjectChanged ()
 Notification event that the project has changed. More...
 
const wxString & GetAboutTitle () const
 
void SetShutdownBlockReason (const wxString &reason)
 Sets the block reason why the window/application is preventing OS shutdown. More...
 
void RemoveShutdownBlockReason ()
 Removes any shutdown block reason set. More...
 
bool SupportsShutdownBlockReason ()
 Whether or not the window supports setting a shutdown block reason. More...
 
virtual bool IsContentModified ()
 Get if the contents of the frame have been modified since the last save. More...
 
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...
 
int GetUndoCommandCount () const
 
int GetRedoCommandCount () const
 
int GetMaxUndoItems () const
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void PushTool (const std::string &actionName)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const std::string &actionName)
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
virtual void DisplayToolMsg (const wxString &msg)
 
bool GetDoImmediateActions () const
 Indicates that hotkeys should perform an immediate action even if another tool is currently active. More...
 
bool GetDragSelects () const
 Indicates that a drag should draw a selection rectangle, even when started over an item. More...
 
bool GetMoveWarpsCursor () const
 Indicates that a move operation should warp the mouse pointer to the origin of the move object. More...
 
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...
 

Protected Member Functions

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

Static Protected Member Functions

static wxString GetBackupSuffix ()
 
static wxString GetAutoSaveFilePrefix ()
 

Protected Attributes

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
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
TOOL_DISPATCHERm_toolDispatcher
 
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 Member Functions

APP_SETTINGS_BASEconfig () const override
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
KICAD_SETTINGSkicadSettings () const
 
const SEARCH_STACKsys_search () override
 Return a SEARCH_STACK pertaining to entire program. More...
 
wxString help_name () override
 
void language_change (wxCommandEvent &event)
 

Private Attributes

TREE_PROJECT_FRAMEm_leftWin
 
ACTION_TOOLBARm_launcher
 
wxTextCtrl * m_messagesBox
 
ACTION_TOOLBARm_mainToolBar
 
int m_leftWinWidth
 
bool m_active_project
 

Detailed Description

The main KiCad project manager frame.

It is not a KIWAY_PLAYER.

Definition at line 78 of file kicad_manager_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 556 of file eda_base_frame.h.

Constructor & Destructor Documentation

◆ KICAD_MANAGER_FRAME()

KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME ( wxWindow *  parent,
const wxString &  title,
const wxPoint pos,
const wxSize &  size 
)

◆ ~KICAD_MANAGER_FRAME()

KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME ( )

Definition at line 177 of file kicad_manager_frame.cpp.

178 {
179  // Shutdown all running tools
180  if( m_toolManager )
182 
183  delete m_actions;
184  delete m_toolManager;
185  delete m_toolDispatcher;
186 
187  m_auimgr.UnInit();
188 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
wxAuiManager m_auimgr
ACTIONS * m_actions
Definition: tools_holder.h:49
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:50
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48

References TOOLS_HOLDER::m_actions, EDA_BASE_FRAME::m_auimgr, TOOLS_HOLDER::m_toolDispatcher, TOOLS_HOLDER::m_toolManager, and TOOL_MANAGER::ShutdownAllTools().

Member Function Documentation

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 298 of file eda_base_frame.cpp.

299 {
300  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
301  ACTION_MENU* helpMenu = new ACTION_MENU( false );
302 
303  helpMenu->SetTool( commonControl );
304 
305  helpMenu->Add( ACTIONS::help );
306  helpMenu->Add( ACTIONS::gettingStarted );
307  helpMenu->Add( ACTIONS::listHotKeys );
308  helpMenu->Add( ACTIONS::getInvolved );
309  helpMenu->Add( ACTIONS::reportBug );
310 
311  helpMenu->AppendSeparator();
312  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
313 
314  aMenuBar->Append( helpMenu, _( "&Help" ) );
315 }
static TOOL_ACTION listHotKeys
Definition: actions.h:172
ACTION_MENU.
Definition: action_menu.h:44
static TOOL_ACTION reportBug
Definition: actions.h:174
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:84
COMMON_CONTROL.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION help
Definition: actions.h:171
static TOOL_ACTION getInvolved
Definition: actions.h:173
static TOOL_ACTION gettingStarted
Definition: actions.h:170

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

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inherited

Definition at line 831 of file eda_base_frame.cpp.

832 {
833  SetUserUnits( aUnits );
835 
836  wxCommandEvent e( UNITS_CHANGED );
837  ProcessEventLocally( e );
838 }
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 729 of file eda_base_frame.cpp.

730 {
731  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
732 
733  wxFileName autoSaveFileName = aFileName;
734 
735  // Check for auto save file.
736  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
737 
738  wxLogTrace( traceAutoSave,
739  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
740 
741  if( !autoSaveFileName.FileExists() )
742  return;
743 
744  wxString msg = wxString::Format( _(
745  "Well this is potentially embarrassing!\n"
746  "It appears that the last time you were editing the file\n"
747  "\"%s\"\n"
748  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
749  GetChars( aFileName.GetFullName() )
750  );
751 
752  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
753 
754  // Make a backup of the current file, delete the file, and rename the auto save file to
755  // the file name.
756  if( response == wxYES )
757  {
758  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
759  {
760  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
761  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
762  }
763  }
764  else
765  {
766  wxLogTrace( traceAutoSave,
767  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
768 
769  // Remove the auto save file when using the previous file as is.
770  wxRemoveFile( autoSaveFileName.GetFullPath() );
771  }
772 }
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:205
#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 626 of file eda_base_frame.cpp.

627 {
628  if( !aFileHistory )
629  aFileHistory = m_fileHistory;
630 
631  wxASSERT( aFileHistory );
632 
633  aFileHistory->ClearFileHistory();
634 
635  // Update the menubar to update the file history menu
636  if( GetMenuBar() )
637  {
638  ReCreateMenuBar();
639  GetMenuBar()->Refresh();
640  }
641 }
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(), OnClearFileHistory(), PL_EDITOR_FRAME::OnClearFileHistory(), PCB_EDIT_FRAME::OnClearFileHistory(), SCH_EDIT_FRAME::OnClearFileHistory(), GERBVIEW_FRAME::OnClearGbrFileHistory(), GERBVIEW_FRAME::OnClearJobFileHistory(), and GERBVIEW_FRAME::OnClearZipFileHistory().

◆ ClearMsg()

void KICAD_MANAGER_FRAME::ClearMsg ( )

Erase the text panel.

Definition at line 567 of file kicad_manager_frame.cpp.

568 {
569  m_messagesBox->Clear();
570 }

References m_messagesBox.

Referenced by CloseProject(), KICAD_MANAGER_CONTROL::NewFromTemplate(), and OnImportEagleFiles().

◆ ClearUndoORRedoList()

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

◆ ClearUndoRedoList()

◆ CloseProject()

bool KICAD_MANAGER_FRAME::CloseProject ( bool  aSave)

Closes the project, and saves it if aSave is true;.

Definition at line 352 of file kicad_manager_frame.cpp.

353 {
354 
355  if( !Kiway().PlayersClose( false ) )
356  return false;
357 
358  // Save the project file for the currently loaded project.
359  if( m_active_project )
360  {
361  SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
362 
364 
365  if( aSave )
366  {
367  mgr.SaveProject();
368  }
369 
370  m_active_project = false;
371  mgr.UnloadProject( &Prj() );
372 
373  // TODO(JE): Remove this if apps are refactored to not assume Prj() always works
374  // Need to create a project early for now (it can have an empty path for the moment)
375  mgr.LoadProject( "" );
376  }
377 
378  ClearMsg();
379 
381 
382  return true;
383 }
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
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Calls BackupProject if a new backup is needed according to the current backup policy.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void EmptyTreePrj()
Delete all m_TreeProject entries.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.
bool SaveProject(const wxString &aFullPath=wxEmptyString)
Saves a loaded project.
static REPORTER & GetInstance()
Definition: reporter.cpp:105
void ClearMsg()
Erase the text panel.
TREE_PROJECT_FRAME * m_leftWin

References ClearMsg(), TREE_PROJECT_FRAME::EmptyTreePrj(), NULL_REPORTER::GetInstance(), KIWAY_HOLDER::Kiway(), SETTINGS_MANAGER::LoadProject(), m_active_project, m_leftWin, Pgm(), KIWAY_HOLDER::Prj(), SETTINGS_MANAGER::SaveProject(), SETTINGS_MANAGER::TriggerBackupIfNeeded(), and SETTINGS_MANAGER::UnloadProject().

Referenced by KICAD_MANAGER_CONTROL::CloseProject(), LoadProject(), and OnCloseWindow().

◆ CommonSettingsChanged()

void KICAD_MANAGER_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged,
bool  aTextVarsChanged 
)
overridevirtual

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

Update menus, toolbars, local variables, etc.

Reimplemented from EDA_BASE_FRAME.

Definition at line 560 of file kicad_manager_frame.cpp.

561 {
562  int historySize = Pgm().GetCommonSettings()->m_System.file_history_size;
563  GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) );
564 }
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
FILE_HISTORY & GetFileHistory()
Get the frame's main file history.

References EDA_BASE_FRAME::GetFileHistory(), Pgm(), and FILE_HISTORY::SetMaxFiles().

◆ config()

APP_SETTINGS_BASE * KICAD_MANAGER_FRAME::config ( ) const
overrideprivatevirtual

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

Reimplemented from EDA_BASE_FRAME.

Definition at line 197 of file kicad_manager_frame.cpp.

198 {
200  wxASSERT( ret );
201  return ret;
202 }
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
APP_SETTINGS_BASE * PgmSettings()
Definition: pgm_kicad.h:56

References PGM_KICAD::PgmSettings(), and PgmTop().

Referenced by kicadSettings().

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

349  {
350  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
351  return baseCfgName;
352  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by EDA_BASE_FRAME::SaveWindowSettings().

◆ CreateNewProject()

void KICAD_MANAGER_FRAME::CreateNewProject ( const wxFileName &  aProjectFileName)

Creates a new project by setting up and initial project, schematic, and board files.

The project file is copied from the kicad.pro template file if possible. Otherwise, a minimal project file is created from an empty project. A minimal schematic and board file are created to prevent the schematic and board editors from complaining. If any of these files already exist, they are not overwritten.

Parameters
aProjectFileNameis the absolute path of the project file name.

Definition at line 424 of file kicad_manager_frame.cpp.

425 {
426  wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(),
427  "Project folder must exist and be writable to create a new project." );
428 
429  // Init project filename. This clears all elements from the project object.
430  SetProjectFileName( aProjectFileName.GetFullPath() );
431 
432  // If the project is legacy, convert it
433  if( !aProjectFileName.FileExists() )
434  {
435  wxFileName legacyPro( aProjectFileName );
436  legacyPro.SetExt( LegacyProjectFileExtension );
437 
438  if( legacyPro.FileExists() )
439  {
440  GetSettingsManager()->LoadProject( legacyPro.GetFullPath() );
442 
443  wxRemoveFile( legacyPro.GetFullPath() );
444  }
445  else
446  {
447  // Copy template project file from template folder.
448  wxString srcFileName = sys_search().FindValidPath( "kicad.kicad_pro" );
449 
450  wxFileName destFileName( aProjectFileName );
451  destFileName.SetExt( ProjectFileExtension );
452 
453  // Create a minimal project file if the template project file could not be copied
454  if( !wxFileName::FileExists( srcFileName )
455  || !wxCopyFile( srcFileName, destFileName.GetFullPath() ) )
456  {
457  wxFile file( destFileName.GetFullPath(), wxFile::write );
458 
459  if( file.IsOpened() )
460  file.Write( wxT( "{\n}\n") );
461  // wxFile dtor will close the file
462  }
463  }
464  }
465 
466  // Ensure a "stub" for a schematic root sheet and a board exist.
467  // It will avoid messages from the schematic editor or the board editor to create a new file
468  // And forces the user to create main files under the right name for the project manager
469  wxFileName fn( aProjectFileName.GetFullPath() );
470  fn.SetExt( KiCadSchematicFileExtension );
471 
472  // If a <project>.kicad_sch file does not exist, create a "stub" file ( minimal schematic file )
473  if( !fn.FileExists() )
474  {
475  wxFile file( fn.GetFullPath(), wxFile::write );
476 
477  if( file.IsOpened() )
478  file.Write( wxT( "(kicad_sch (version 20200310) (host eeschema \"unknown\")\n"
479  "( page \"A4\")\n (lib_symbols)\n"
480  " (symbol_instances)\n)\n" ) );
481 
482 
483  // wxFile dtor will close the file
484  }
485 
486  // If a <project>.kicad_pcb or <project>.brd file does not exist,
487  // create a .kicad_pcb "stub" file
488  fn.SetExt( KiCadPcbFileExtension );
489  wxFileName leg_fn( fn );
490  leg_fn.SetExt( LegacyPcbFileExtension );
491 
492  if( !fn.FileExists() && !leg_fn.FileExists() )
493  {
494  wxFile file( fn.GetFullPath(), wxFile::write );
495 
496  if( file.IsOpened() )
497  file.Write( wxT( "(kicad_pcb (version 4) (host kicad \"dummy file\") )\n" ) );
498 
499  // wxFile dtor will close the file
500  }
501 
502  UpdateFileHistory( aProjectFileName.GetFullPath() );
503 }
wxString FindValidPath(const wxString &aFileName) const
Definition: search_stack.h:73
SETTINGS_MANAGER * GetSettingsManager() const
const std::string ProjectFileExtension
const std::string LegacyPcbFileExtension
const std::string KiCadPcbFileExtension
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
const std::string LegacyProjectFileExtension
void SetProjectFileName(const wxString &aFullProjectProFileName)
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
bool SaveProject(const wxString &aFullPath=wxEmptyString)
Saves a loaded project.
const std::string KiCadSchematicFileExtension
const SEARCH_STACK & sys_search() override
Return a SEARCH_STACK pertaining to entire program.

References SEARCH_STACK::FindValidPath(), EDA_BASE_FRAME::GetSettingsManager(), KiCadPcbFileExtension, KiCadSchematicFileExtension, LegacyPcbFileExtension, LegacyProjectFileExtension, SETTINGS_MANAGER::LoadProject(), ProjectFileExtension, SETTINGS_MANAGER::SaveProject(), SetProjectFileName(), sys_search(), and EDA_BASE_FRAME::UpdateFileHistory().

Referenced by KICAD_MANAGER_CONTROL::NewFromTemplate(), KICAD_MANAGER_CONTROL::NewProject(), and KICAD_MANAGER_CONTROL::SaveProjectAs().

◆ 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:52
static TOOL_ACTION selectionTool
Definition: actions.h:147

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

Referenced by TOOL_MANAGER::processEvent().

◆ DisplayToolMsg()

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

Reimplemented in EDA_DRAW_FRAME.

Definition at line 89 of file tools_holder.h.

89 {};

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

270 {
271  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
272 }

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 504 of file eda_base_frame.h.

504 { 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 176 of file eda_base_frame.h.

177  {
178  return wxT( "_autosave-" );
179  }

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

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 270 of file eda_base_frame.h.

270 { 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 168 of file eda_base_frame.h.

169  {
170  return wxT( "-bak" );
171  }

◆ GetCurrentFileName()

wxString KICAD_MANAGER_FRAME::GetCurrentFileName ( ) const
inlineoverridevirtual

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 from EDA_BASE_FRAME.

Definition at line 103 of file kicad_manager_frame.h.

104  {
105  return GetProjectFileName();
106  }
const wxString GetProjectFileName() const

References GetProjectFileName().

◆ 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 95 of file tools_holder.h.

95 { return m_immediateActions; }
bool m_immediateActions
Definition: tools_holder.h:59

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 101 of file tools_holder.h.

101 { return m_dragSelects; }
bool m_dragSelects
Definition: tools_holder.h:63

References TOOLS_HOLDER::m_dragSelects.

Referenced by EE_SELECTION_TOOL::Main().

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

588 {
589  if( !aFileHistory )
590  aFileHistory = m_fileHistory;
591 
592  wxASSERT( aFileHistory );
593 
594  int baseId = aFileHistory->GetBaseId();
595 
596  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) aFileHistory->GetCount() );
597 
598  unsigned i = cmdId - baseId;
599 
600  if( i < aFileHistory->GetCount() )
601  {
602  wxString fn = aFileHistory->GetHistoryFile( i );
603 
604  if( wxFileName::FileExists( fn ) )
605  return fn;
606  else
607  {
608  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
609  wxMessageBox( msg );
610 
611  aFileHistory->RemoveFileFromHistory( i );
612  }
613  }
614 
615  // Update the menubar to update the file history menu
616  if( GetMenuBar() )
617  {
618  ReCreateMenuBar();
619  GetMenuBar()->Refresh();
620  }
621 
622  return wxEmptyString;
623 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
FILE_HISTORY * 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(), 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 414 of file eda_base_frame.h.

415  {
416  return *m_fileHistory;
417  }
FILE_HISTORY * m_fileHistory

References EDA_BASE_FRAME::m_fileHistory.

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

◆ GetInfoBar()

WX_INFOBAR* EDA_BASE_FRAME::GetInfoBar ( )
inlineinherited

Definition at line 288 of file eda_base_frame.h.

288 { return m_infoBar; }
WX_INFOBAR * m_infoBar

References EDA_BASE_FRAME::m_infoBar.

Referenced by PAD_TOOL::EditPad(), and SCH_EDIT_TOOL::RefreshSymbolFromLibrary().

◆ GetMaxUndoItems()

int EDA_BASE_FRAME::GetMaxUndoItems ( ) const
inlineinherited

Definition at line 601 of file eda_base_frame.h.

601 { 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 107 of file tools_holder.h.

107 { return m_moveWarpsCursor; }
bool m_moveWarpsCursor
Definition: tools_holder.h:64

References TOOLS_HOLDER::m_moveWarpsCursor.

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

◆ GetMruPath()

wxString EDA_BASE_FRAME::GetMruPath ( ) const
inlineinherited

◆ GetProjectFileName()

const wxString KICAD_MANAGER_FRAME::GetProjectFileName ( ) const

Definition at line 231 of file kicad_manager_frame.cpp.

232 {
233  return m_active_project ? Prj().GetProjectFullName() : wxString( wxEmptyString );
234 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:117

References PROJECT::GetProjectFullName(), m_active_project, and KIWAY_HOLDER::Prj().

Referenced by TREE_PROJECT_FRAME::AddItemToTreeProject(), TREE_PROJECT_FRAME::FileWatcherReset(), TREE_PROJECT_FRAME::findSubdirTreeItem(), GetCurrentFileName(), OnArchiveFiles(), TREE_PROJECT_FRAME::OnCreateNewDirectory(), OnImportEagleFiles(), TREE_PROJECT_FRAME::OnOpenDirectory(), PcbFileName(), PcbLegacyFileName(), PrintPrjInfo(), TREE_PROJECT_FRAME::ReCreateTreePrj(), SchFileName(), and SchLegacyFileName().

◆ GetRedoCommandCount()

◆ GetSettingsManager()

◆ GetSeverity()

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

Reimplemented in PCB_BASE_FRAME.

Definition at line 236 of file eda_base_frame.h.

References RPT_SEVERITY_UNDEFINED.

Referenced by RC_TREE_MODEL::GetValue().

◆ GetToolCanvas()

wxWindow * KICAD_MANAGER_FRAME::GetToolCanvas ( ) const
overridevirtual

Canvas access.

Implements TOOLS_HOLDER.

Definition at line 191 of file kicad_manager_frame.cpp.

192 {
193  return m_leftWin;
194 }
TREE_PROJECT_FRAME * m_leftWin

References m_leftWin.

◆ GetToolManager()

TOOL_MANAGER* TOOLS_HOLDER::GetToolManager ( ) const
inlineinherited

Return the MVC controller.

Definition at line 74 of file tools_holder.h.

74 { return m_toolManager; }
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48

References TOOLS_HOLDER::m_toolManager.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), LIB_CONTROL::AddSymbolToSchematic(), BOARD_COMMIT::BOARD_COMMIT(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), 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_TRACKS_AND_VIAS::doCleanup(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), 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(), 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_INSPECTOR::onCellClicked(), SIM_PLOT_FRAME::onClose(), SYMBOL_TREE_PANE::onComponentSelected(), DIALOG_DRC::OnDeleteOneClick(), DIALOG_ERC::OnERCItemSelected(), FOOTPRINTS_LISTBOX::OnLeftDClick(), SIM_PLOT_FRAME::onProbe(), DIALOG_PLOT::onRunDRC(), HIERARCHY_NAVIG_DLG::onSelectSheetPath(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), SIM_PLOT_FRAME::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(), EDA_3D_VIEWER::SaveSettings(), DIALOG_FIND::search(), CVPCB_MAINFRAME::setupEventHandlers(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), PANEL_SETUP_RULES::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(), 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()

◆ GetUserUnits()

EDA_UNITS EDA_BASE_FRAME::GetUserUnits ( ) const
inlineinherited

Return the user units currently in use.

Definition at line 220 of file eda_base_frame.h.

221  {
222  return m_userUnits;
223  }
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::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(), LIB_ARC::GetMsgPanelInfo(), LIB_POLYLINE::GetMsgPanelInfo(), MARKER_PCB::GetMsgPanelInfo(), LIB_BEZIER::GetMsgPanelInfo(), TEXTE_PCB::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), WS_DRAW_ITEM_BASE::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(), LIB_PIN::getMsgPanelInfoBase(), GetUserUnits(), RC_TREE_MODEL::GetValue(), GRID_MENU::GRID_MENU(), 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(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), DRC_ITEM::ShowHtml(), DISPLAY_FOOTPRINTS_FRAME::SyncToolbars(), FOOTPRINT_VIEWER_FRAME::SyncToolbars(), FOOTPRINT_EDIT_FRAME::SyncToolbars(), LIB_EDIT_FRAME::SyncToolbars(), GERBVIEW_FRAME::SyncToolbars(), SCH_EDIT_FRAME::SyncToolbars(), PCB_EDIT_FRAME::SyncToolbars(), 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(), UNIT_BINDER::UNIT_BINDER(), GRID_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), GERBVIEW_FRAME::updateDCodeSelectBox(), 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::userUnits(), userUnits(), and PANEL_SETUP_TRACKS_AND_VIAS::validateData().

◆ GetWindowSettings()

WINDOW_SETTINGS * EDA_BASE_FRAME::GetWindowSettings ( APP_SETTINGS_BASE aCfg)
virtualinherited

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 in SIM_PLOT_FRAME, FOOTPRINT_WIZARD_FRAME, FOOTPRINT_VIEWER_FRAME, LIB_VIEW_FRAME, and DISPLAY_FOOTPRINTS_FRAME.

Definition at line 537 of file eda_base_frame.cpp.

538 {
539  return &aCfg->m_Window;
540 }
WINDOW_SETTINGS m_Window
Definition: app_settings.h:154

References APP_SETTINGS_BASE::m_Window.

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

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

864 {
865 #ifdef __WXGTK__
866  // GTK includes the window decorations in the normal GetSize call,
867  // so we have to use a GTK-specific sizing call that returns the
868  // non-decorated window size.
869  int width = 0;
870  int height = 0;
871  GTKDoGetSize( &width, &height );
872 
873  wxSize winSize( width, height );
874 #else
875  wxSize winSize = GetSize();
876 #endif
877 
878  return winSize;
879 }

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

◆ help_name()

wxString KICAD_MANAGER_FRAME::help_name ( )
overrideprivatevirtual

Reimplemented from EDA_BASE_FRAME.

Definition at line 285 of file kicad_manager_frame.cpp.

286 {
287  return PgmTop().GetHelpFileName();
288 }
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
wxString GetHelpFileName()
Definition: pgm_kicad.h:60

References PGM_KICAD::GetHelpFileName(), and PgmTop().

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

void KICAD_MANAGER_FRAME::InstallPreferences ( PAGED_DIALOG ,
PANEL_HOTKEYS_EDITOR  
)
overridevirtual

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 from EDA_BASE_FRAME.

Definition at line 597 of file kicad_manager_frame.cpp.

599 {
600  aHotkeysPanel->AddHotKeys( GetToolManager() );
601 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74

References PANEL_HOTKEYS_EDITOR::AddHotKeys(), and TOOLS_HOLDER::GetToolManager().

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

191 { 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 775 of file eda_base_frame.cpp.

776 {
777  // This function should be overridden in child classes
778  return false;
779 }

◆ 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:52
static TOOL_ACTION selectionTool
Definition: actions.h:147
const std::string & GetName() const
Function GetName() Returns name of the action.
Definition: tool_action.h:78

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(), DISPLAY_FOOTPRINTS_FRAME::SyncToolbars(), FOOTPRINT_VIEWER_FRAME::SyncToolbars(), and LIB_EDIT_FRAME::SyncToolbars().

◆ IsProjectActive()

bool KICAD_MANAGER_FRAME::IsProjectActive ( )

Definition at line 611 of file kicad_manager_frame.cpp.

612 {
613  return m_active_project;
614 }

References m_active_project.

Referenced by KICAD_MANAGER_CONTROL::Execute().

◆ IsType()

bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited

Definition at line 272 of file eda_base_frame.h.

272 { 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(), 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(), PICKER_TOOL::Main(), LIB_CONTROL::OnDeMorgan(), PCB_LAYER_WIDGET::OnLayerVisible(), 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(), LIB_CONTROL::UnpinLibrary(), and COMMON_TOOLS::ZoomFitScreen().

◆ IsWritable()

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

Checks if aFileName can be written.

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

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

Definition at line 685 of file eda_base_frame.cpp.

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

◆ kicadSettings()

KICAD_SETTINGS * KICAD_MANAGER_FRAME::kicadSettings ( ) const
private

Definition at line 205 of file kicad_manager_frame.cpp.

206 {
207  KICAD_SETTINGS* ret = dynamic_cast<KICAD_SETTINGS*>( config() );
208  wxASSERT( ret );
209  return ret;
210 }
APP_SETTINGS_BASE * config() const override
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

References config().

Referenced by OnCloseWindow().

◆ 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(), 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(), language_change(), KIWAY_PLAYER::language_change(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), 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(), OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), KIWAY_HOLDER::Prj(), 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::SIM_PLOT_FRAME(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ language_change()

void KICAD_MANAGER_FRAME::language_change ( wxCommandEvent &  event)
private

Definition at line 540 of file kicad_manager_frame.cpp.

541 {
542  int id = event.GetId();
543  Kiway().SetLanguage( id );
544 }
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:440

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

◆ LoadProject()

void KICAD_MANAGER_FRAME::LoadProject ( const wxFileName &  aProjectFileName)

Definition at line 386 of file kicad_manager_frame.cpp.

387 {
388  // The project file should be valid by the time we get here or something has gone wrong.
389  if( !aProjectFileName.Exists() )
390  return;
391 
392  // Any open KIFACE's must be closed if they are not part of the new project.
393  // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.)
394  // User is prompted here to close those KIWAY_PLAYERs:
395  CloseProject( true );
396 
397  m_active_project = true;
398 
399  Pgm().GetSettingsManager().LoadProject( aProjectFileName.GetFullPath() );
400  SetProjectFileName( Prj().GetProjectFullName() );
401 
402  if( aProjectFileName.IsDirWritable() )
403  SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. Why?
404 
405  UpdateFileHistory( Prj().GetProjectFullName() );
406 
408 
409  SyncToolbars();
410 
411  // Rebuild the list of watched paths.
412  // however this is possible only when the main loop event handler is running,
413  // so we use it to run the rebuild function.
414  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS );
415 
416  wxPostEvent( this, cmd );
417 
418  PrintPrjInfo();
419 
420  KIPLATFORM::APP::RegisterApplicationRestart( aProjectFileName.GetFullPath() );
421 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
void SetMruPath(const wxString &aPath)
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:123
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void ReCreateTreePrj()
Create or modify the tree showing project file names.
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
void SetProjectFileName(const wxString &aFullProjectProFileName)
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
void PrintPrjInfo()
Prints the current working directory name and the project name on the text panel.
TREE_PROJECT_FRAME * m_leftWin
bool RegisterApplicationRestart(const wxString &aCommandLine)
Registers the application for restart with the OS with the given command line string to pass as args.
Definition: gtk/app.cpp:26

References CloseProject(), PROJECT::GetProjectPath(), ID_INIT_WATCHED_PATHS, m_active_project, m_leftWin, Pgm(), PrintPrjInfo(), KIWAY_HOLDER::Prj(), TREE_PROJECT_FRAME::ReCreateTreePrj(), KIPLATFORM::APP::RegisterApplicationRestart(), EDA_BASE_FRAME::SetMruPath(), SetProjectFileName(), SyncToolbars(), and EDA_BASE_FRAME::UpdateFileHistory().

Referenced by TREEPROJECT_ITEM::Activate(), PGM_KICAD::MacOpenFile(), KICAD_MANAGER_CONTROL::NewFromTemplate(), KICAD_MANAGER_CONTROL::NewProject(), OnFileHistory(), PGM_KICAD::OnPgmInit(), TREE_PROJECT_FRAME::OnSwitchToSelectedProject(), KICAD_MANAGER_CONTROL::OpenProject(), and KICAD_MANAGER_CONTROL::SaveProjectAs().

◆ LoadSettings()

void KICAD_MANAGER_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 573 of file kicad_manager_frame.cpp.

574 {
576 
577  auto settings = dynamic_cast<KICAD_SETTINGS*>( aCfg );
578 
579  wxCHECK( settings, /*void*/);
580 
581  m_leftWinWidth = settings->m_LeftWinWidth;
582 }
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.

References EDA_BASE_FRAME::LoadSettings(), and m_leftWinWidth.

◆ LoadWindowSettings()

void EDA_BASE_FRAME::LoadWindowSettings ( WINDOW_SETTINGS aCfg)
inherited

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

Definition at line 349 of file eda_base_frame.cpp.

350 {
351  m_FramePos.x = aCfg->pos_x;
352  m_FramePos.y = aCfg->pos_y;
353  m_FrameSize.x = aCfg->size_x;
354  m_FrameSize.y = aCfg->size_y;
355 
356  wxLogTrace( traceDisplayLocation, "Config position (%d, %d) with size (%d, %d)",
358 
359  // Ensure minimum size is set if the stored config was zero-initialized
361  {
364 
365  wxLogTrace( traceDisplayLocation, "Using minimum size (%d, %d)", m_FrameSize.x, m_FrameSize.y );
366  }
367 
368  wxLogTrace( traceDisplayLocation, "Number of displays: %d", wxDisplay::GetCount() );
369 
370  if( aCfg->display >= wxDisplay::GetCount() )
371  {
372  wxLogTrace( traceDisplayLocation, "Previous display not found" );
373 
374  // If it isn't attached, use the first display
375  // Warning wxDisplay has 2 ctor variants. the parameter needs a type:
376  const unsigned int index = 0;
377  wxDisplay display( index );
378  wxRect clientSize = display.GetClientArea();
379 
380  wxLogDebug( "Client size (%d, %d)", clientSize.width, clientSize.height );
381 
382  m_FramePos = wxDefaultPosition;
383 
384  // Ensure the window fits on the display, since the other one could have been larger
385  if( m_FrameSize.x > clientSize.width )
386  m_FrameSize.x = clientSize.width;
387 
388  if( m_FrameSize.y > clientSize.height )
389  m_FrameSize.y = clientSize.height;
390  }
391  else
392  {
393  wxPoint upperRight( m_FramePos.x + m_FrameSize.x, m_FramePos.y );
394  wxPoint upperLeft( m_FramePos.x, m_FramePos.y );
395 
396  wxDisplay display( aCfg->display );
397  wxRect clientSize = display.GetClientArea();
398 
399 // The percentage size (represented in decimal) of the region around the screen's border where
400 // an upper corner is not allowed
401 #define SCREEN_BORDER_REGION 0.10
402 
403  int yLim = clientSize.y + ( clientSize.height * ( 1.0 - SCREEN_BORDER_REGION ) );
404  int xLimLeft = clientSize.x + ( clientSize.width * SCREEN_BORDER_REGION );
405  int xLimRight = clientSize.x + ( clientSize.width * ( 1.0 - SCREEN_BORDER_REGION ) );
406 
407  if( upperLeft.x > xLimRight || // Upper left corner too close to right edge of screen
408  upperRight.x < xLimLeft || // Upper right corner too close to left edge of screen
409  upperRight.y > yLim ) // Upper corner too close to the bottom of the screen
410  {
411  m_FramePos = wxDefaultPosition;
412  wxLogTrace( traceDisplayLocation, "Resetting to default position" );
413  }
414  }
415 
416  // Ensure Window title bar is visible
417 #if defined( __WXOSX__ )
418  // for macOSX, the window must be below system (macOSX) toolbar
419  int Ypos_min = 20;
420 #else
421  int Ypos_min = 0;
422 #endif
423  if( m_FramePos.y < Ypos_min )
424  m_FramePos.y = Ypos_min;
425 
426  wxLogTrace( traceDisplayLocation, "Final window position (%d, %d) with size (%d, %d)",
428 
429  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
430 
431  // Center the window if we reset to default
432  if( m_FramePos.x == -1 )
433  {
434  wxLogTrace( traceDisplayLocation, "Centering window" );
435  Center();
436  m_FramePos = GetPosition();
437  }
438 
439  // Record the frame sizes in an un-maximized state
442 
443  // Maximize if we were maximized before
444  if( aCfg->maximized )
445  {
446  wxLogTrace( traceDisplayLocation, "Maximizing window" );
447  Maximize();
448  }
449 
450  if( m_hasAutoSave )
451  m_autoSaveInterval = Pgm().GetCommonSettings()->m_System.autosave_interval;
452 
453  m_perspective = aCfg->perspective;
454  m_mruPath = aCfg->mru_path;
455 
456  TOOLS_HOLDER::CommonSettingsChanged( false, false );
457 }
wxString mru_path
Definition: app_settings.h:71
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.
wxString m_perspective
wxSize m_NormalFrameSize
#define SCREEN_BORDER_REGION
wxString perspective
Definition: app_settings.h:74
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Notification event that some of the common (suite-wide) settings have changed.
static const int s_minsize_x
static const int s_minsize_y
wxPoint m_NormalFramePos
unsigned int display
Definition: app_settings.h:77

References PCAD2KICAD::Center, TOOLS_HOLDER::CommonSettingsChanged(), WINDOW_SETTINGS::display, 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, EDA_BASE_FRAME::m_perspective, WINDOW_SETTINGS::maximized, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, Pgm(), WINDOW_SETTINGS::pos_x, WINDOW_SETTINGS::pos_y, s_minsize_x, s_minsize_y, SCREEN_BORDER_REGION, WINDOW_SETTINGS::size_x, WINDOW_SETTINGS::size_y, traceDisplayLocation, wxPoint::x, and wxPoint::y.

Referenced by EDA_BASE_FRAME::LoadSettings().

◆ OnArchiveFiles()

void KICAD_MANAGER_FRAME::OnArchiveFiles ( wxCommandEvent &  event)

Definition at line 107 of file kicad/files-io.cpp.

108 {
109  wxFileName fileName = GetProjectFileName();
110 
111  fileName.SetExt( ArchiveFileExtension );
112 
113  wxFileDialog dlg( this, _( "Archive Project Files" ),
114  fileName.GetPath(), fileName.GetFullName(),
115  ZipFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
116 
117  if( dlg.ShowModal() == wxID_CANCEL )
118  return;
119 
120  wxFileName zipFile = dlg.GetPath();
121 
122  wxString currdirname = fileName.GetPathWithSep();
123  wxDir dir( currdirname );
124 
125  if( !dir.IsOpened() ) // wxWidgets display a error message on issue.
126  return;
127 
129 
130  PROJECT_ARCHIVER archiver;
131 
132  archiver.Archive( currdirname, zipFile.GetFullPath(), reporter );
133 }
const wxString GetProjectFileName() const
bool Archive(const wxString &aSrcDir, const wxString &aDestFile, REPORTER &aReporter, bool aVerbose=true)
Creates an archive of the project.
wxString ZipFileWildcard()
WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:131
#define _(s)
Definition: 3d_actions.cpp:33
const std::string ArchiveFileExtension

References _, PROJECT_ARCHIVER::Archive(), ArchiveFileExtension, GetProjectFileName(), m_messagesBox, and ZipFileWildcard().

◆ onAutoSaveTimer()

void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Handle the auto save timer event.

Definition at line 262 of file eda_base_frame.cpp.

263 {
264  if( !doAutoSave() )
265  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
266 }
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().

◆ OnBrowseInFileExplorer()

void KICAD_MANAGER_FRAME::OnBrowseInFileExplorer ( wxCommandEvent &  event)

Definition at line 527 of file kicad_manager_frame.cpp.

528 {
529  // open project directory in host OS's file explorer
530  LaunchExternal( Prj().GetProjectPath() );
531 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void LaunchExternal(const wxString &aPath)
Launches the given file or folder in the host OS.
Definition: launch_ext.cpp:26

References LaunchExternal(), and KIWAY_HOLDER::Prj().

◆ OnChangeWatchedPaths()

void KICAD_MANAGER_FRAME::OnChangeWatchedPaths ( wxCommandEvent &  aEvent)

Called by sending a event with id = ID_INIT_WATCHED_PATHS rebuild the list of watched paths.

Definition at line 1249 of file tree_project_frame.cpp.

1250 {
1252 }
void FileWatcherReset()
Reinit the watched paths Should be called after opening a new project to rebuild the list of watched ...
TREE_PROJECT_FRAME * m_leftWin

References TREE_PROJECT_FRAME::FileWatcherReset(), and m_leftWin.

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

276 {
277  wxLogTrace( kicadTraceKeyEvent, "EDA_BASE_FRAME::OnCharHook %s", dump( event ) );
278  // Key events can be filtered here.
279  // Currently no filtering is made.
280  event.Skip();
281 }
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.

◆ OnClearFileHistory()

void KICAD_MANAGER_FRAME::OnClearFileHistory ( wxCommandEvent &  aEvent)

Definition at line 50 of file kicad/files-io.cpp.

51 {
53 }
void ClearFileHistory(FILE_HISTORY *aFileHistory=nullptr)
Removes all files from the file history.

References EDA_BASE_FRAME::ClearFileHistory().

◆ OnCloseWindow()

void KICAD_MANAGER_FRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 306 of file kicad_manager_frame.cpp.

307 {
308 #ifdef _WINDOWS_
309  // For some obscure reason, on Windows, when killing Kicad from the Windows task manager
310  // if a editor frame (schematic, library, board editor or fp editor) is open and has
311  // some edition to save, OnCloseWindow is run twice *at the same time*, creating race
312  // conditions between OnCloseWindow() code.
313  // Therefore I added (JPC) a ugly hack to discard the second call (unwanted) during
314  // execution of the first call (only one call is right).
315  // Note also if there is no change made in editors, this behavior does not happen.
316  static std::atomic<unsigned int> lock_close_event( 0 );
317 
318  if( ++lock_close_event > 1 ) // Skip extra calls
319  {
320  return;
321  }
322 #endif
323 
324  if( Kiway().PlayersClose( false ) )
325  {
326  Event.SetCanVeto( true );
327 
328  // Save the list of open projects before closing the project
329  KICAD_SETTINGS* settings = kicadSettings();
331 
332  // Ensure the project is closed before destruction.
333  CloseProject( true );
334 
335  m_leftWin->Show( false );
336 
337  Destroy();
338  }
339 
340 #ifdef _WINDOWS_
341  lock_close_event = 0; // Reenable event management
342 #endif
343 }
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
SETTINGS_MANAGER * GetSettingsManager() const
KICAD_SETTINGS * kicadSettings() const
std::vector< wxString > m_OpenProjects
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
std::vector< wxString > GetOpenProjects() const
TREE_PROJECT_FRAME * m_leftWin

References CloseProject(), SETTINGS_MANAGER::GetOpenProjects(), EDA_BASE_FRAME::GetSettingsManager(), kicadSettings(), KIWAY_HOLDER::Kiway(), m_leftWin, and KICAD_SETTINGS::m_OpenProjects.

◆ OnExit()

void KICAD_MANAGER_FRAME::OnExit ( wxCommandEvent &  event)

Definition at line 346 of file kicad_manager_frame.cpp.

347 {
348  Close( true );
349 }

◆ OnFileHistory()

void KICAD_MANAGER_FRAME::OnFileHistory ( wxCommandEvent &  event)

Definition at line 40 of file kicad/files-io.cpp.

41 {
42  wxFileName projFileName = GetFileFromHistory( event.GetId(), _( "KiCad project file" ) );
43  if( !projFileName.FileExists() )
44  return;
45 
46  LoadProject( projFileName );
47 }
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetches the file name from the file history list.
#define _(s)
Definition: 3d_actions.cpp:33
void LoadProject(const wxFileName &aProjectFileName)

References _, EDA_BASE_FRAME::GetFileFromHistory(), and LoadProject().

◆ OnImportEagleFiles()

void KICAD_MANAGER_FRAME::OnImportEagleFiles ( wxCommandEvent &  event)

Open dialog to import Eagle schematic and board files.

Definition at line 49 of file kicad/import_project.cpp.

50 {
51  // Close other windows.
52  if( !Kiway().PlayersClose( false ) )
53  return;
54 
55 
56  wxString title = _( "Import Eagle Project Files" );
57  int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
58  wxString default_dir = GetMruPath();
59 
60  ClearMsg();
61 
62  wxFileDialog schdlg( this, title, default_dir, wxEmptyString,
63  EagleFilesWildcard(), style );
64 
65  if( schdlg.ShowModal() == wxID_CANCEL )
66  return;
67 
68 
69  wxFileName sch( schdlg.GetPath() );
70 
71  sch.SetExt( LegacySchematicFileExtension );
72 
73  wxFileName pro = sch;
74 
75  pro.SetExt( ProjectFileExtension );
76 
77  wxString protitle = _( "KiCad Project Destination" );
78 
79  // Don't use wxFileDialog here. On GTK builds, the default path is returned unless a
80  // file is actually selected.
81  wxDirDialog prodlg( this, protitle, pro.GetPath(), wxDD_DEFAULT_STYLE );
82 
83  if( prodlg.ShowModal() == wxID_CANCEL )
84  return;
85 
86  pro.SetPath( prodlg.GetPath() );
87 
88  // Check if the project directory is empty
89  wxDir directory( pro.GetPath() );
90 
91  if( directory.HasFiles() )
92  {
93  wxString msg = _( "The selected directory is not empty. We recommend you "
94  "create projects in their own clean directory.\n\nDo you "
95  "want to create a new empty directory for the project?" );
96 
97  KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING );
98  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
99 
100  if( dlg.ShowModal() == wxID_YES )
101  {
102  // Append a new directory with the same name of the project file
103  // and try to create it
104  pro.AppendDir( pro.GetName() );
105 
106  if( !wxMkdir( pro.GetPath() ) )
107  // There was a problem, undo
108  pro.RemoveLastDir();
109  }
110  }
111 
112  wxFileName pcb( sch );
113  std::string packet;
114  pro.SetExt( ProjectFileExtension );
115  pcb.SetExt( LegacyPcbFileExtension ); // enforce extension
116 
117  if( !pro.IsAbsolute() )
118  pro.MakeAbsolute();
119 
120  SetProjectFileName( pro.GetFullPath() );
121  wxString prj_filename = GetProjectFileName();
122 
123  if( sch.FileExists() )
124  {
125  KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, true );
126 
127  packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE, TO_UTF8( sch.GetFullPath() ) );
128  schframe->Kiway().ExpressMail( FRAME_SCH, MAIL_IMPORT_FILE, packet, this );
129 
130  if( !schframe->IsShown() )
131  schframe->Show( true );
132 
133  // On Windows, Raise() does not bring the window on screen, when iconized
134  if( schframe->IsIconized() )
135  schframe->Iconize( false );
136 
137  schframe->Raise();
138  }
139 
140  if( pcb.FileExists() )
141  {
142  KIWAY_PLAYER* pcbframe = Kiway().Player( FRAME_PCB_EDITOR, true );
143 
144  if( !pcbframe->IsVisible() )
145  pcbframe->Show( true );
146 
147  packet = StrPrintf( "%d\n%s", IO_MGR::EAGLE, TO_UTF8( pcb.GetFullPath() ) );
148  pcbframe->Kiway().ExpressMail( FRAME_PCB_EDITOR, MAIL_IMPORT_FILE, packet, this );
149 
150  // On Windows, Raise() does not bring the window on screen, when iconized
151  if( pcbframe->IsIconized() )
152  pcbframe->Iconize( false );
153 
154  pcbframe->Raise();
155  }
156 
157  ReCreateTreePrj();
158  m_active_project = true;
159 }
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
const wxString GetProjectFileName() const
int StrPrintf(std::string *aResult, const char *aFormat,...)
Function StrPrintf is like sprintf() but the output is appended to a std::string instead of to a char...
Definition: richio.cpp:74
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:44
const std::string ProjectFileExtension
const std::string LegacyPcbFileExtension
wxString GetMruPath() const
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:342
const std::string LegacySchematicFileExtension
void SetProjectFileName(const wxString &aFullProjectProFileName)
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:432
#define _(s)
Definition: 3d_actions.cpp:33
#define TO_UTF8(wxstring)
wxString EagleFilesWildcard()
void ClearMsg()
Erase the text panel.

References _, ClearMsg(), KIDIALOG::DoNotShowCheckbox(), IO_MGR::EAGLE, EagleFilesWildcard(), KIWAY::ExpressMail(), FRAME_PCB_EDITOR, FRAME_SCH, EDA_BASE_FRAME::GetMruPath(), GetProjectFileName(), KIWAY_HOLDER::Kiway(), LegacyPcbFileExtension, LegacySchematicFileExtension, m_active_project, MAIL_IMPORT_FILE, KIWAY::Player(), ProjectFileExtension, ReCreateTreePrj(), SetProjectFileName(), KIDIALOG::ShowModal(), numEval::StrPrintf(), and TO_UTF8.

◆ OnKicadAbout()

void EDA_BASE_FRAME::OnKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 644 of file eda_base_frame.cpp.

645 {
646  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
647  ShowAboutDialog( this );
648 }
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 841 of file eda_base_frame.cpp.

842 {
843  // When we maximize the window, we want to save the old information
844  // so that we can add it to the settings on next window load.
845  // Contrary to the documentation, this event seems to be generated
846  // when the window is also being unmaximized on OSX, so we only
847  // capture the size information when we maximize the window when on OSX.
848 #ifdef __WXOSX__
849  if( !IsMaximized() )
850 #endif
851  {
853  m_NormalFramePos = GetPosition();
854  wxLogTrace( traceDisplayLocation, "Maximizing window - Saving position (%d, %d) with size (%d, %d)",
856  }
857 
858  // Skip event to actually maximize the window
859  aEvent.Skip();
860 }
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 284 of file eda_base_frame.cpp.

285 {
286  if( !m_toolDispatcher )
287  aEvent.Skip();
288  else
290 }
virtual void DispatchWxEvent(wxEvent &aEvent)
Function DispatchWxEvent() Processes wxEvents (mostly UI events), translates them to TOOL_EVENTs,...
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:50

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

262  {
263  aEvent.Skip();
264  }

◆ OnOpenFileInTextEditor()

void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor ( wxCommandEvent &  event)

Definition at line 506 of file kicad_manager_frame.cpp.

507 {
508  // show all files in file dialog (in Kicad all files are editable texts):
509  wxString wildcard = AllFilesWildcard();
510 
511  wxString default_dir = Prj().GetProjectPath();
512 
513  wxFileDialog dlg( this, _( "Load File to Edit" ), default_dir,
514  wxEmptyString, wildcard, wxFD_OPEN );
515 
516  if( dlg.ShowModal() == wxID_CANCEL )
517  return;
518 
519  wxString filename = wxT( "\"" );
520  filename += dlg.GetPath() + wxT( "\"" );
521 
522  if( !dlg.GetPath().IsEmpty() && !Pgm().GetEditorName().IsEmpty() )
524 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:123
wxString AllFilesWildcard()
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION openTextEditor

References _, AllFilesWildcard(), PROJECT::GetProjectPath(), TOOLS_HOLDER::m_toolManager, KICAD_MANAGER_ACTIONS::openTextEditor, Pgm(), KIWAY_HOLDER::Prj(), and TOOL_MANAGER::RunAction().

◆ OnPreferences()

void EDA_BASE_FRAME::OnPreferences ( wxCommandEvent &  event)
inherited

Definition at line 651 of file eda_base_frame.cpp.

652 {
653  PAGED_DIALOG dlg( this, _( "Preferences" ), true );
654  wxTreebook* book = dlg.GetTreebook();
655 
656  book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
657 
658  book->AddPage( new PANEL_MOUSE_SETTINGS( &dlg, book ), _( "Mouse and Touchpad" ) );
659 
660  PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
661  book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
662 
663  for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
664  {
665  KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
666 
667  if( frame )
668  frame->InstallPreferences( &dlg, hotkeysPanel );
669  }
670 
671  // The Kicad manager frame is not a player so we have to add it by hand
672  wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
673 
674  if( manager )
675  static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
676 
677  for( size_t i = 0; i < book->GetPageCount(); ++i )
678  book->GetPage( i )->Layout();
679 
680  if( dlg.ShowModal() == wxID_OK )
681  dlg.Kiway().CommonSettingsChanged( false, false );
682 }
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:342
#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().

◆ OnSize()

void KICAD_MANAGER_FRAME::OnSize ( wxSizeEvent &  event)

Definition at line 297 of file kicad_manager_frame.cpp.

298 {
299  if( m_auimgr.GetManagedWindow() )
300  m_auimgr.Update();
301 
302  event.Skip();
303 }
wxAuiManager m_auimgr

References EDA_BASE_FRAME::m_auimgr.

◆ OnUnarchiveFiles()

void KICAD_MANAGER_FRAME::OnUnarchiveFiles ( wxCommandEvent &  event)

Definition at line 56 of file kicad/files-io.cpp.

57 {
58  wxFileName fn = Prj().GetProjectFullName();
59 
60  fn.SetExt( ArchiveFileExtension );
61 
62  wxFileDialog zipfiledlg( this, _( "Unzip Project" ), fn.GetPath(),
63  fn.GetFullName(), ZipFileWildcard(),
64  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
65 
66  if( zipfiledlg.ShowModal() == wxID_CANCEL )
67  return;
68 
69  wxString msg = wxString::Format( _( "\nOpen \"%s\"\n" ), zipfiledlg.GetPath() );
70  PrintMsg( msg );
71 
72  wxDirDialog dirDlg( this, _( "Target Directory" ), fn.GetPath(), wxDD_DEFAULT_STYLE );
73 
74  if( dirDlg.ShowModal() == wxID_CANCEL )
75  return;
76 
77  wxString unzipDir = dirDlg.GetPath() + wxT( "/" );
78  msg.Printf( _( "Unzipping project in \"%s\"\n" ), unzipDir );
79  PrintMsg( msg );
80 
81  if( unzipDir == Prj().GetProjectPath() )
82  {
83  if( !Kiway().PlayersClose( false ) )
84  return;
85  }
86 
88 
89  PROJECT_ARCHIVER archiver;
90 
91  archiver.Unarchive( zipfiledlg.GetPath(), unzipDir, reporter );
92 
93  if( unzipDir == Prj().GetProjectPath() )
94  {
95  wxString prjPath = Prj().GetProjectFullName();
96 
97  SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
98 
99  mgr.UnloadProject( &Prj(), false );
100  mgr.LoadProject( prjPath );
101 
103  }
104 }
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
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
wxString ZipFileWildcard()
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:123
WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:131
bool Unarchive(const wxString &aSrcFile, const wxString &aDestDir, REPORTER &aReporter)
Extracts an archive of the current project over existing files Warning: this will overwrite files in ...
void PrintMsg(const wxString &aText)
Displays aText in the text panel.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:117
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.
const std::string ArchiveFileExtension

References _, ArchiveFileExtension, Format(), PROJECT::GetProjectFullName(), PROJECT::GetProjectPath(), KIWAY_HOLDER::Kiway(), SETTINGS_MANAGER::LoadProject(), m_messagesBox, Pgm(), PrintMsg(), KIWAY_HOLDER::Prj(), RefreshProjectTree(), PROJECT_ARCHIVER::Unarchive(), SETTINGS_MANAGER::UnloadProject(), and ZipFileWildcard().

◆ PcbFileName()

const wxString KICAD_MANAGER_FRAME::PcbFileName ( )

Definition at line 255 of file kicad_manager_frame.cpp.

256 {
257  wxFileName fn( GetProjectFileName() );
258 
259  fn.SetExt( PcbFileExtension );
260  return fn.GetFullPath();
261 }
const wxString GetProjectFileName() const
#define PcbFileExtension

References GetProjectFileName(), and PcbFileExtension.

Referenced by TREEPROJECT_ITEM::Activate(), and KICAD_MANAGER_CONTROL::ShowPlayer().

◆ PcbLegacyFileName()

const wxString KICAD_MANAGER_FRAME::PcbLegacyFileName ( )

Definition at line 264 of file kicad_manager_frame.cpp.

265 {
266  wxFileName fn( GetProjectFileName() );
267 
268  fn.SetExt( LegacyPcbFileExtension );
269  return fn.GetFullPath();
270 }
const wxString GetProjectFileName() const
const std::string LegacyPcbFileExtension

References GetProjectFileName(), and LegacyPcbFileExtension.

Referenced by TREEPROJECT_ITEM::Activate(), and KICAD_MANAGER_CONTROL::ShowPlayer().

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

826 {
827  return m_redoList.PopCommand();
828 }
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()

PICKED_ITEMS_LIST * EDA_BASE_FRAME::PopCommandFromUndoList ( )
virtualinherited

◆ 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:89
TOOL_ACTION * FindAction(const std::string &aActionName) const
Function FindAction() 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:48
std::vector< std::string > m_toolStack
Definition: tools_holder.h:52
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:194
TOOL_ACTION.
Definition: tool_action.h:46
TOOL_EVENT MakeEvent() const
Function MakeEvent() Returns the event associated with the action (i.e.
Definition: tool_action.h:107
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74
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:268
static TOOL_ACTION selectionTool
Definition: actions.h:147
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 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 KICAD_MANAGER_FRAME::PrintMsg ( const wxString &  aText)

Displays aText in the text panel.

Parameters
aTextThe text to display.

Definition at line 291 of file kicad_manager_frame.cpp.

292 {
293  m_messagesBox->AppendText( aText );
294 }

References m_messagesBox.

Referenced by KICAD_MANAGER_CONTROL::Execute(), TERMINATE_HANDLER::OnTerminate(), OnUnarchiveFiles(), and PrintPrjInfo().

◆ PrintPrjInfo()

void KICAD_MANAGER_FRAME::PrintPrjInfo ( )

Prints the current working directory name and the project name on the text panel.

Definition at line 604 of file kicad_manager_frame.cpp.

605 {
606  wxString msg = wxString::Format( _( "Project name:\n%s\n" ),
608  PrintMsg( msg );
609 }
const wxString GetProjectFileName() const
void PrintMsg(const wxString &aText)
Displays aText in the text panel.
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:205
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), GetChars(), GetProjectFileName(), and PrintMsg().

Referenced by LoadProject(), and ShowChangedLanguage().

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

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(), 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(), 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(), 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(), LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), DRC::LoadRules(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), PCB_BASE_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), 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(), 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(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), 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::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and 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 204 of file eda_base_frame.cpp.

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

Definition at line 502 of file eda_base_frame.h.

502 {}

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

805 {
806  m_redoList.PushCommand( aNewitem );
807 
808  // Delete the extra items, if count max reached
809  if( m_UndoRedoCountMax > 0 )
810  {
811  int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax;
812 
813  if( extraitems > 0 )
814  ClearUndoORRedoList( REDO_LIST, extraitems );
815  }
816 }
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 789 of file eda_base_frame.cpp.

790 {
791  m_undoList.PushCommand( aNewitem );
792 
793  // Delete the extra items, if count max reached
794  if( m_UndoRedoCountMax > 0 )
795  {
796  int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax;
797 
798  if( extraitems > 0 )
799  ClearUndoORRedoList( UNDO_LIST, extraitems );
800  }
801 }
UNDO_REDO_CONTAINER m_undoList
int GetUndoCommandCount() const
virtual void ClearUndoORRedoList(UNDO_REDO_LIST aList, int aItemCount=-1)
void PushCommand(PICKED_ITEMS_LIST *aCommand)

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:89
TOOL_ACTION * FindAction(const std::string &aActionName) const
Function FindAction() 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:48
std::vector< std::string > m_toolStack
Definition: tools_holder.h:52
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:194
TOOL_ACTION.
Definition: tool_action.h:46

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

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

◆ RecreateBaseHToolbar()

void KICAD_MANAGER_FRAME::RecreateBaseHToolbar ( )

(Re)Create the horizontal toolbar

Definition at line 175 of file kicad/menubar.cpp.

176 {
177  if( m_mainToolBar )
179  else
180  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
181  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
182 
183  // New
187 
189  m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
190  KiScaledBitmap( zip_xpm, this ),
191  _( "Archive all project files" ) );
192 
193  m_mainToolBar->AddTool( ID_READ_ZIP_ARCHIVE, wxEmptyString,
194  KiScaledBitmap( unzip_xpm, this ),
195  _( "Unarchive project files from zip archive" ) );
196 
199 
201  m_mainToolBar->AddTool( ID_BROWSE_IN_FILE_EXPLORER, wxEmptyString,
203 #ifdef __APPLE__
204  _( "Reveal project folder in Finder" ) );
205 #else
206  _( "Open project directory in file explorer" ) );
207 #endif
208 
209  // Create m_mainToolBar
210  m_mainToolBar->Realize();
211 }
static TOOL_ACTION newProject
ACTION_TOOLBAR.
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false)
Function Add() Adds a TOOL_ACTION-based button to the toolbar.
const BITMAP_OPAQUE directory_browser_xpm[1]
const BITMAP_OPAQUE zip_xpm[1]
Definition: zip.cpp:60
static TOOL_ACTION newFromTemplate
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, wxWindow *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
static TOOL_ACTION openProject
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
ACTION_TOOLBAR * m_mainToolBar
const BITMAP_OPAQUE unzip_xpm[1]
Definition: unzip.cpp:61
void ClearToolbar()
Clear the toolbar and remove all associated menus.

References _, ACTION_TOOLBAR::Add(), ACTION_TOOLBAR::AddScaledSeparator(), ACTION_TOOLBAR::ClearToolbar(), directory_browser_xpm, ID_BROWSE_IN_FILE_EXPLORER, ID_H_TOOLBAR, ID_READ_ZIP_ARCHIVE, ID_SAVE_AND_ZIP_FILES, EDA_BASE_FRAME::KICAD_AUI_TB_STYLE, KiScaledBitmap(), m_mainToolBar, KICAD_MANAGER_ACTIONS::newFromTemplate, KICAD_MANAGER_ACTIONS::newProject, KICAD_MANAGER_ACTIONS::openProject, unzip_xpm, zip_xpm, and ACTIONS::zoomRedraw.

Referenced by ShowChangedLanguage().

◆ RecreateLauncher()

void KICAD_MANAGER_FRAME::RecreateLauncher ( )

Definition at line 214 of file kicad/menubar.cpp.

215 {
216  if( m_launcher )
217  m_launcher->Clear();
218  else
219  m_launcher = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
220  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
221 
222  // Add tools. Note these KICAD_MANAGER_ACTIONS are defined with a bitmap
223  // suitable for menus. The icans will be changed later.
226 
230 
236 
237  // Now set big icons for these tools:
241  KiScaledBitmap( icon_libedit_xpm, this ) );
243  KiScaledBitmap( icon_pcbnew_xpm, this ) );
245  KiScaledBitmap( icon_modedit_xpm, this ) );
254 
255  // Create mlauncher
256  m_launcher->Realize();
257 
258  // And update the visual tools state:
259  SyncToolbars();
260 }
ACTION_TOOLBAR.
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
static TOOL_ACTION showCalculator
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false)
Function Add() Adds a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION viewGerbers
const BITMAP_OPAQUE icon_pcbcalculator_xpm[1]
const BITMAP_OPAQUE icon_bitmap2component_xpm[1]
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, wxWindow *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
static TOOL_ACTION convertImage
const BITMAP_OPAQUE icon_eeschema_xpm[1]
static TOOL_ACTION editSchematic
const BITMAP_OPAQUE icon_pagelayout_editor_xpm[1]
static TOOL_ACTION editFootprints
static TOOL_ACTION editWorksheet
const BITMAP_OPAQUE icon_gerbview_xpm[1]
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
const BITMAP_OPAQUE icon_modedit_xpm[1]
const BITMAP_OPAQUE icon_libedit_xpm[1]
static TOOL_ACTION editPCB
ACTION_TOOLBAR * m_launcher
void SetToolBitmap(const TOOL_ACTION &aAction, const wxBitmap &aBitmap)
Function SetToolBitmap() Updates the bitmap of a particular tool.
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
const BITMAP_OPAQUE icon_pcbnew_xpm[1]
Definition: icon_pcbnew.cpp:49
static TOOL_ACTION editSymbols

References ACTION_TOOLBAR::Add(), ACTION_TOOLBAR::AddScaledSeparator(), KICAD_MANAGER_ACTIONS::convertImage, KICAD_MANAGER_ACTIONS::editFootprints, KICAD_MANAGER_ACTIONS::editPCB, KICAD_MANAGER_ACTIONS::editSchematic, KICAD_MANAGER_ACTIONS::editSymbols, KICAD_MANAGER_ACTIONS::editWorksheet, icon_bitmap2component_xpm, icon_eeschema_xpm, icon_gerbview_xpm, icon_libedit_xpm, icon_modedit_xpm, icon_pagelayout_editor_xpm, icon_pcbcalculator_xpm, icon_pcbnew_xpm, ID_H_TOOLBAR, EDA_BASE_FRAME::KICAD_AUI_TB_STYLE, KiScaledBitmap(), m_launcher, ACTION_TOOLBAR::SetToolBitmap(), KICAD_MANAGER_ACTIONS::showCalculator, SyncToolbars(), and KICAD_MANAGER_ACTIONS::viewGerbers.

Referenced by ShowChangedLanguage().

◆ ReCreateMenuBar()

void KICAD_MANAGER_FRAME::ReCreateMenuBar ( )
overridevirtual

Recreates the menu bar.

Needed when the language is changed

Reimplemented from EDA_BASE_FRAME.

Definition at line 40 of file kicad/menubar.cpp.

41 {
43  // wxWidgets handles the Mac Application menu behind the scenes, but that means
44  // we always have to start from scratch with a new wxMenuBar.
45  wxMenuBar* oldMenuBar = GetMenuBar();
46  WX_MENUBAR* menuBar = new WX_MENUBAR();
47 
48  //-- File menu -----------------------------------------------------------
49  //
50  CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, controlTool );
51  FILE_HISTORY& fileHistory = GetFileHistory();
52 
53  fileHistory.SetClearText( _( "Clear Recent Projects" ) );
54 
55  static ACTION_MENU* openRecentMenu;
56 
57  // Create the menu if it does not exist. Adding a file to/from the history
58  // will automatically refresh the menu.
59  if( !openRecentMenu )
60  {
61  openRecentMenu = new ACTION_MENU( false );
62  openRecentMenu->SetTool( controlTool );
63  openRecentMenu->SetTitle( _( "Open Recent" ) );
64  openRecentMenu->SetIcon( recent_xpm );
65 
66  fileHistory.UseMenu( openRecentMenu );
67  fileHistory.AddFilesToMenu();
68  }
69 
74  fileMenu->AddMenu( openRecentMenu,
75  FILE_HISTORY::FileHistoryNotEmpty( fileHistory ) );
76 
77  fileMenu->AddSeparator();
79 
80  fileMenu->AddSeparator();
82  _( "Import EAGLE Project..." ),
83  _( "Import EAGLE CAD XML schematic and board" ),
85 
86  fileMenu->AddSeparator();
87  fileMenu->AddItem( ID_SAVE_AND_ZIP_FILES,
88  _( "&Archive Project..." ),
89  _( "Archive all needed project files into zip archive" ),
91 
92  fileMenu->AddItem( ID_READ_ZIP_ARCHIVE,
93  _( "&Unarchive Project..." ),
94  _( "Unarchive project files from zip archive" ),
96 
97  fileMenu->AddSeparator();
98  fileMenu->AddQuitOrClose( nullptr, "KiCad" );
99 
100  fileMenu->Resolve();
101 
102  //-- View menu -----------------------------------------------------------
103  //
104  CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, controlTool );
105 
107 
108  viewMenu->AddSeparator();
111  _( "Browse Project Files" ), _( "Open project directory in file browser" ),
113 
114 #ifdef __APPLE__
115  viewMenu->AddSeparator();
116 #endif
117 
118  viewMenu->Resolve();
119 
120  //-- Tools menu -----------------------------------------------
121  //
122  CONDITIONAL_MENU* toolsMenu = new CONDITIONAL_MENU( false, controlTool );
123 
128 
129  toolsMenu->AddSeparator();
134 
135  toolsMenu->AddSeparator();
137  _( "Edit Local File..." ), _( "Edit local file in text editor" ),
139 
140  toolsMenu->Resolve();
141 
142  //-- Preferences menu -----------------------------------------------
143  //
144  CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, controlTool );
145 
149  prefsMenu->AddItem( wxID_PREFERENCES,
150  _( "Preferences...\tCTRL+," ),
151  _( "Show preferences for all open tools" ),
153 
154  prefsMenu->AddSeparator();
155  AddMenuLanguageList( prefsMenu, controlTool );
156 
157  prefsMenu->Resolve();
158 
159  //-- Menubar -------------------------------------------------------------
160  //
161  menuBar->Append( fileMenu, _( "&File" ) );
162  menuBar->Append( viewMenu, _( "&View" ) );
163  menuBar->Append( toolsMenu, _( "&Tools" ) );
164  menuBar->Append( prefsMenu, _( "&Preferences" ) );
165  AddStandardHelpMenu( menuBar );
166 
167  SetMenuBar( menuBar );
168  delete oldMenuBar;
169 }
const BITMAP_OPAQUE browse_files_xpm[1]
void AddFilesToMenu() override
Add the files to all registered menus.
Definition: filehistory.h:98
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
static TOOL_ACTION newProject
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
ACTION_MENU.
Definition: action_menu.h:44
static TOOL_ACTION showCalculator
void SetClearText(wxString aClearText)
Set the text displayed on the menu item that clears the entire menu.
Definition: filehistory.h:123
const BITMAP_OPAQUE directory_browser_xpm[1]
const BITMAP_OPAQUE zip_xpm[1]
Definition: zip.cpp:60
static TOOL_ACTION viewGerbers
static TOOL_ACTION showSymbolLibTable
Definition: actions.h:168
static TOOL_ACTION newFromTemplate
KICAD_MANAGER_CONTROL.
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:45
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:42
static TOOL_ACTION convertImage
const BITMAP_OPAQUE recent_xpm[1]
Definition: recent.cpp:68
static TOOL_ACTION closeProject
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
static TOOL_ACTION editSchematic
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:169
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:70
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
static TOOL_ACTION editFootprints
static TOOL_ACTION editWorksheet
void Resolve()
Function Resolve()
const BITMAP_OPAQUE import_project_xpm[1]
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
void AddQuitOrClose(KIFACE_I *aKiface, wxString aAppname="")
Functions AddQuitOrClose()
static TOOL_ACTION editPCB
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:88
FILE_HISTORY & GetFileHistory()
Get the frame's main file history.
static SELECTION_CONDITION FileHistoryNotEmpty(const FILE_HISTORY &aHistory)
Create a SELECTION_CONDITION that can be used to enable a menu item when the file history has items i...
static TOOL_ACTION openProject
void AddMenuLanguageList(CONDITIONAL_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
static TOOL_ACTION saveAs
Definition: actions.h:55
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
const BITMAP_OPAQUE preference_xpm[1]
Definition: preference.cpp:66
static TOOL_ACTION editSymbols
static TOOL_ACTION configurePaths
Definition: actions.h:167
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION openTextEditor
const BITMAP_OPAQUE unzip_xpm[1]
Definition: unzip.cpp:61

References _, FILE_HISTORY::AddFilesToMenu(), CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), AddMenuLanguageList(), CONDITIONAL_MENU::AddQuitOrClose(), CONDITIONAL_MENU::AddSeparator(), EDA_BASE_FRAME::AddStandardHelpMenu(), browse_files_xpm, KICAD_MANAGER_ACTIONS::closeProject, ACTIONS::configurePaths, KICAD_MANAGER_ACTIONS::convertImage, directory_browser_xpm, KICAD_MANAGER_ACTIONS::editFootprints, KICAD_MANAGER_ACTIONS::editPCB, KICAD_MANAGER_ACTIONS::editSchematic, KICAD_MANAGER_ACTIONS::editSymbols, KICAD_MANAGER_ACTIONS::editWorksheet, FILE_HISTORY::FileHistoryNotEmpty(), EDA_BASE_FRAME::GetFileHistory(), TOOL_MANAGER::GetTool(), ID_BROWSE_IN_FILE_EXPLORER, ID_EDIT_LOCAL_FILE_IN_TEXT_EDITOR, ID_IMPORT_EAGLE_PROJECT, ID_READ_ZIP_ARCHIVE, ID_SAVE_AND_ZIP_FILES, import_project_xpm, TOOLS_HOLDER::m_toolManager, KICAD_MANAGER_ACTIONS::newFromTemplate, KICAD_MANAGER_ACTIONS::newProject, KICAD_MANAGER_ACTIONS::openProject, KICAD_MANAGER_ACTIONS::openTextEditor, preference_xpm, recent_xpm, CONDITIONAL_MENU::Resolve(), ACTIONS::saveAs, FILE_HISTORY::SetClearText(), ACTION_MENU::SetIcon(), ACTION_MENU::SetTitle(), ACTION_MENU::SetTool(), SELECTION_CONDITIONS::ShowAlways(), KICAD_MANAGER_ACTIONS::showCalculator, ACTIONS::showFootprintLibTable, ACTIONS::showSymbolLibTable, unzip_xpm, KICAD_MANAGER_ACTIONS::viewGerbers, zip_xpm, and ACTIONS::zoomRedraw.

◆ ReCreateTreePrj()

void KICAD_MANAGER_FRAME::ReCreateTreePrj ( )

Definition at line 273 of file kicad_manager_frame.cpp.

274 {
276 }
void ReCreateTreePrj()
Create or modify the tree showing project file names.
TREE_PROJECT_FRAME * m_leftWin

References m_leftWin, and TREE_PROJECT_FRAME::ReCreateTreePrj().

Referenced by OnImportEagleFiles().

◆ RefreshCanvas()

virtual void TOOLS_HOLDER::RefreshCanvas ( )
inlinevirtualinherited

Reimplemented in EDA_DRAW_FRAME.

Definition at line 119 of file tools_holder.h.

119 { }

Referenced by TOOL_MANAGER::ProcessEvent().

◆ RefreshProjectTree()

void KICAD_MANAGER_FRAME::RefreshProjectTree ( )

Definition at line 534 of file kicad_manager_frame.cpp.

535 {
537 }
void ReCreateTreePrj()
Create or modify the tree showing project file names.
TREE_PROJECT_FRAME * m_leftWin

References m_leftWin, and TREE_PROJECT_FRAME::ReCreateTreePrj().

Referenced by OnUnarchiveFiles(), and KICAD_MANAGER_CONTROL::Refresh().

◆ RemoveShutdownBlockReason()

void EDA_BASE_FRAME::RemoveShutdownBlockReason ( )
inherited

Removes any shutdown block reason set.

Definition at line 177 of file eda_base_frame.cpp.

178 {
179 #if defined( _WIN32 )
180  // Windows: Destroys any block reason that may have existed
181  ShutdownBlockReasonDestroy( GetHandle() );
182 #endif
183 }

Referenced by EDA_BASE_FRAME::~EDA_BASE_FRAME().

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

361 {};

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

◆ SaveSettings()

void KICAD_MANAGER_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 585 of file kicad_manager_frame.cpp.

586 {
588 
589  auto settings = dynamic_cast<KICAD_SETTINGS*>( aCfg );
590 
591  wxCHECK( settings, /*void*/);
592 
593  settings->m_LeftWinWidth = m_leftWin->GetSize().x;
594 }
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Saves common frame parameters to a configuration data file.
TREE_PROJECT_FRAME * m_leftWin

References m_leftWin, and EDA_BASE_FRAME::SaveSettings().

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

461 {
462  wxString text;
463 
464  if( IsIconized() )
465  return;
466 
467  wxString baseCfgName = ConfigBaseName();
468 
469  // If the window is maximized, we use the saved window size from before it was maximized
470  if( IsMaximized() )
471  {
474  }
475  else
476  {
478  m_FramePos = GetPosition();
479  }
480 
481  aCfg->pos_x = m_FramePos.x;
482  aCfg->pos_y = m_FramePos.y;
483  aCfg->size_x = m_FrameSize.x;
484  aCfg->size_y = m_FrameSize.y;
485  aCfg->maximized = IsMaximized();
486  aCfg->display = wxDisplay::GetFromWindow( this );
487 
488  wxLogTrace( traceDisplayLocation, "Saving window maximized: %s", IsMaximized() ? "true" : "false" );
489  wxLogTrace( traceDisplayLocation, "Saving config position (%d, %d) with size (%d, %d)",
491 
492  // TODO(JE) should auto-save in common settings be overwritten by every app?
493  if( m_hasAutoSave )
494  Pgm().GetCommonSettings()->m_System.autosave_interval = m_autoSaveInterval;
495 
496  // Once this is fully implemented, wxAuiManager will be used to maintain
497  // the persistance of the main frame and all it's managed windows and
498  // all of the legacy frame persistence position code can be removed.
499  aCfg->perspective = m_auimgr.SavePerspective().ToStdString();
500 
501  aCfg->mru_path = m_mruPath;
502 }
wxString mru_path
Definition: app_settings.h:71
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:74
wxSize GetWindowSize()
Get the undecorated window size that can be used for restoring the window size.
wxString ConfigBaseName() override
wxPoint m_NormalFramePos
unsigned int display
Definition: app_settings.h:77

References EDA_BASE_FRAME::ConfigBaseName(), WINDOW_SETTINGS::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_SETTINGS::maximized, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, Pgm(), WINDOW_SETTINGS::pos_x, WINDOW_SETTINGS::pos_y, WINDOW_SETTINGS::size_x, WINDOW_SETTINGS::size_y, traceDisplayLocation, wxPoint::x, and wxPoint::y.

Referenced by EDA_BASE_FRAME::SaveSettings().

◆ SchFileName()

const wxString KICAD_MANAGER_FRAME::SchFileName ( )

Definition at line 237 of file kicad_manager_frame.cpp.

238 {
239  wxFileName fn( GetProjectFileName() );
240 
241  fn.SetExt( KiCadSchematicFileExtension );
242  return fn.GetFullPath();
243 }
const wxString GetProjectFileName() const
const std::string KiCadSchematicFileExtension

References GetProjectFileName(), and KiCadSchematicFileExtension.

Referenced by TREEPROJECT_ITEM::Activate(), and KICAD_MANAGER_CONTROL::ShowPlayer().

◆ SchLegacyFileName()

const wxString KICAD_MANAGER_FRAME::SchLegacyFileName ( )

Definition at line 246 of file kicad_manager_frame.cpp.

247 {
248  wxFileName fn( GetProjectFileName() );
249 
250  fn.SetExt( LegacySchematicFileExtension );
251  return fn.GetFullPath();
252 }
const wxString GetProjectFileName() const
const std::string LegacySchematicFileExtension

References GetProjectFileName(), and LegacySchematicFileExtension.

Referenced by TREEPROJECT_ITEM::Activate(), and KICAD_MANAGER_CONTROL::ShowPlayer().

◆ SetAutoSaveInterval()

void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 243 of file eda_base_frame.cpp.

244 {
245  m_autoSaveInterval = aInterval;
246 
247  if( m_autoSaveTimer->IsRunning() )
248  {
249  if( m_autoSaveInterval > 0 )
250  {
251  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
252  }
253  else
254  {
255  m_autoSaveTimer->Stop();
256  m_autoSaveState = false;
257  }
258  }
259 }
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().

◆ SetKiway()

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

Function SetKiway.

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

Definition at line 42 of file kiway_holder.cpp.

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

References KIWAY_HOLDER::m_kiway, and name.

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

◆ SetMruPath()

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

Definition at line 419 of file eda_base_frame.h.

419 { m_mruPath = aPath; }
wxString m_mruPath

References EDA_BASE_FRAME::m_mruPath.

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

◆ SetProjectFileName()

void KICAD_MANAGER_FRAME::SetProjectFileName ( const wxString &  aFullProjectProFileName)

Definition at line 213 of file kicad_manager_frame.cpp.

214 {
215  // ensure file name is absolute:
216  wxFileName fn( aFullProjectProFileName );
217 
218  if( !fn.IsAbsolute() )
219  fn.MakeAbsolute();
220 
221  SetTitle( wxString( "KiCad " ) + GetBuildVersion() );
222  wxString title = GetTitle() + " " + fn.GetFullPath();
223 
224  if( !fn.IsDirWritable() )
225  title += _( " [Read Only]" );
226 
227  SetTitle( title );
228 }
wxString GetBuildVersion()
Get the full KiCad version string.
#define _(s)
Definition: 3d_actions.cpp:33

References _, and GetBuildVersion().

Referenced by CreateNewProject(), LoadProject(), and OnImportEagleFiles().

◆ SetShutdownBlockReason()

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

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

This should be set far ahead of any close event.

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

Definition at line 186 of file eda_base_frame.cpp.

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

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

◆ SetUserUnits()

◆ ShowChangedLanguage()

void KICAD_MANAGER_FRAME::ShowChangedLanguage ( )
overridevirtual

Redraw the menus and what not in current language.

Reimplemented from EDA_BASE_FRAME.

Definition at line 547 of file kicad_manager_frame.cpp.

548 {
549  // call my base class
551 
552  // tooltips in toolbars
555 
556  PrintPrjInfo();
557 }
void RecreateBaseHToolbar()
(Re)Create the horizontal toolbar
virtual void ShowChangedLanguage()
Redraw the menus and what not in current language.
void PrintPrjInfo()
Prints the current working directory name and the project name on the text panel.

References PrintPrjInfo(), RecreateBaseHToolbar(), RecreateLauncher(), and EDA_BASE_FRAME::ShowChangedLanguage().

◆ SupportsShutdownBlockReason()

bool EDA_BASE_FRAME::SupportsShutdownBlockReason ( )
inherited

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

Definition at line 167 of file eda_base_frame.cpp.

168 {
169 #if defined( _WIN32 )
170  return true;
171 #else
172  return false;
173 #endif
174 }

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

◆ SyncToolbars()

void KICAD_MANAGER_FRAME::SyncToolbars ( )
overridevirtual

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

Reimplemented from EDA_BASE_FRAME.

Definition at line 263 of file kicad/menubar.cpp.

264 {
267  m_launcher->Refresh();
268 }
static TOOL_ACTION editSchematic
static TOOL_ACTION editPCB
ACTION_TOOLBAR * m_launcher
void Toggle(const TOOL_ACTION &aAction, bool aState)
Applies the default toggle action.

References KICAD_MANAGER_ACTIONS::editPCB, KICAD_MANAGER_ACTIONS::editSchematic, m_active_project, m_launcher, and ACTION_TOOLBAR::Toggle().

Referenced by LoadProject(), and RecreateLauncher().

◆ sys_search()

const SEARCH_STACK & KICAD_MANAGER_FRAME::sys_search ( )
overrideprivatevirtual

Return a SEARCH_STACK pertaining to entire program.

This is overloaded in KICAD_MANAGER_FRAME

Reimplemented from EDA_BASE_FRAME.

Definition at line 279 of file kicad_manager_frame.cpp.

280 {
281  return PgmTop().SysSearch();
282 }
SEARCH_STACK & SysSearch()
Definition: pgm_kicad.h:58
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72

References PgmTop(), and PGM_KICAD::SysSearch().

Referenced by CreateNewProject().

◆ ToggleUserUnits()

virtual void EDA_BASE_FRAME::ToggleUserUnits ( )
inlinevirtualinherited

Reimplemented in EDA_DRAW_FRAME.

Definition at line 232 of file eda_base_frame.h.

232 { }

Referenced by DIALOG_SHIM::OnCharHook().

◆ ToolStackIsEmpty()

◆ unitsChangeRefresh()

virtual void EDA_BASE_FRAME::unitsChangeRefresh ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PCB_BASE_EDIT_FRAME, GERBVIEW_FRAME, EDA_DRAW_FRAME, and PCB_BASE_FRAME.

Definition at line 206 of file eda_base_frame.h.

206 { }

Referenced by EDA_BASE_FRAME::ChangeUserUnits().

◆ UpdateFileHistory()

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

Update the list of recently opened files.

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

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

Definition at line 568 of file eda_base_frame.cpp.

569 {
570  if( !aFileHistory )
571  aFileHistory = m_fileHistory;
572 
573  wxASSERT( aFileHistory );
574 
575  aFileHistory->AddFileToHistory( FullFileName );
576 
577  // Update the menubar to update the file history menu
578  if( GetMenuBar() )
579  {
580  ReCreateMenuBar();
581  GetMenuBar()->Refresh();
582  }
583 }
void AddFileToHistory(const wxString &aFile) override
Adds a file to the history.
Definition: filehistory.cpp:96
FILE_HISTORY * m_fileHistory
virtual void ReCreateMenuBar()
Recreates the menu bar.

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

Referenced by CreateNewProject(), SCH_EDIT_FRAME::importFile(), GERBVIEW_FRAME::LoadExcellonFiles(), GERBVIEW_FRAME::LoadGerberJobFile(), GERBVIEW_FRAME::loadListOfGerberAndDrillFiles(), PL_EDITOR_FRAME::LoadPageLayoutDescrFile(), LoadProject(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), EDA_BASE_FRAME::SaveSettings(), and GERBVIEW_FRAME::unarchiveFiles().

◆ UpdateStatusBar()

virtual void EDA_BASE_FRAME::UpdateStatusBar ( )
inlinevirtualinherited

Update the status bar information.

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

Reimplemented in EDA_DRAW_FRAME, GERBVIEW_FRAME, PCB_BASE_FRAME, SCH_BASE_FRAME, and PL_EDITOR_FRAME.

Definition at line 480 of file eda_base_frame.h.

480 { }

Referenced by TOOL_MANAGER::UpdateUI().

Member Data Documentation

◆ KICAD_AUI_TB_STYLE

◆ m_AboutTitle

wxString EDA_BASE_FRAME::m_AboutTitle
protectedinherited

◆ m_actions

◆ m_active_project

bool KICAD_MANAGER_FRAME::m_active_project
private

◆ m_auimgr

◆ m_autoSaveInterval

◆ m_autoSaveState

bool EDA_BASE_FRAME::m_autoSaveState
protectedinherited

◆ m_autoSaveTimer

wxTimer* EDA_BASE_FRAME::m_autoSaveTimer
protectedinherited

◆ m_configName

wxString EDA_BASE_FRAME::m_configName
protectedinherited

◆ m_dragSelects

bool TOOLS_HOLDER::m_dragSelects
protectedinherited

◆ m_fileHistory

◆ m_FlagModified

bool EDA_BASE_FRAME::m_FlagModified
protectedinherited

Definition at line 151 of file eda_base_frame.h.

◆ m_FlagSave

bool EDA_BASE_FRAME::m_FlagSave
protectedinherited

Definition at line 152 of file eda_base_frame.h.

◆ m_FramePos

◆ m_FrameSize

◆ m_hasAutoSave

bool EDA_BASE_FRAME::m_hasAutoSave
protectedinherited

◆ m_Ident

FRAME_T EDA_BASE_FRAME::m_Ident
protectedinherited

◆ m_immediateActions

bool TOOLS_HOLDER::m_immediateActions
protectedinherited

◆ m_infoBar

◆ m_launcher

ACTION_TOOLBAR* KICAD_MANAGER_FRAME::m_launcher
private

Definition at line 197 of file kicad_manager_frame.h.

Referenced by RecreateLauncher(), and SyncToolbars().

◆ m_leftWin

◆ m_leftWinWidth

int KICAD_MANAGER_FRAME::m_leftWinWidth
private

Definition at line 201 of file kicad_manager_frame.h.

Referenced by LoadSettings().

◆ m_mainToolBar

ACTION_TOOLBAR* KICAD_MANAGER_FRAME::m_mainToolBar
private

Definition at line 199 of file kicad_manager_frame.h.

Referenced by RecreateBaseHToolbar().

◆ m_messagesBox

wxTextCtrl* KICAD_MANAGER_FRAME::m_messagesBox
private

Definition at line 198 of file kicad_manager_frame.h.

Referenced by ClearMsg(), OnArchiveFiles(), OnUnarchiveFiles(), and PrintMsg().

◆ m_moveWarpsCursor

bool TOOLS_HOLDER::m_moveWarpsCursor
protectedinherited

◆ m_mruPath

◆ m_NormalFramePos

wxPoint EDA_BASE_FRAME::m_NormalFramePos
protectedinherited

◆ m_NormalFrameSize

wxSize EDA_BASE_FRAME::m_NormalFrameSize
protectedinherited

◆ m_perspective

wxString EDA_BASE_FRAME::m_perspective
protectedinherited

Definition at line 135 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::LoadWindowSettings().

◆ m_redoList

◆ m_settingsManager

SETTINGS_MANAGER* EDA_BASE_FRAME::m_settingsManager
protectedinherited

Definition at line 142 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::GetSettingsManager().

◆ m_toolDispatcher

◆ m_toolManager

TOOL_MANAGER* TOOLS_HOLDER::m_toolManager
protectedinherited

Definition at line 48 of file tools_holder.h.

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ActivateGalCanvas(), SCH_EDIT_FRAME::AddJunction(), EDA_BASE_FRAME::AddStandardHelpMenu(), EDA_DRAW_FRAME::AddStandardSubMenus(), SCH_EDIT_FRAME::AppendSchematic(), GERBVIEW_FRAME::Clear_DrawLayers(), SCH_EDIT_FRAME::ConvertPart(), EDA_3D_VIEWER::CreateMenuBar(), LIB_EDIT_FRAME::CreateNewPart(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), LIB_VIEW_FRAME::DClickOnCmpList(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_FRAME::DisplayCurrentSheet(), LIB_EDIT_FRAME::emptyScreen(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), TOOLS_HOLDER::GetToolManager(), PL_EDITOR_FRAME::HardRedraw(), LIB_EDIT_FRAME::HardRedraw(), SCH_EDIT_FRAME::importFile(), PCB_BASE_FRAME::InstallPadOptionsFrame(), SCH_EDIT_FRAME::KiwayMailIn(), PCB_EDIT_FRAME::KiwayMailIn(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::LoadOneLibraryPartAux(), LIB_EDIT_FRAME::LoadOneSymbol(), SCH_EDIT_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnExportBody(), LIB_EDIT_FRAME::OnImportBody(), PL_EDITOR_FRAME::OnNewPageLayout(), OnOpenFileInTextEditor(), EDA_DRAW_FRAME::OnSelectGrid(), LIB_EDIT_FRAME::OnSelectUnit(), EDA_DRAW_FRAME::OnSelectZoom(), SCH_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), SCH_EDIT_FRAME::PutDataInPreviousState(), LIB_VIEW_FRAME::ReCreateMenuBar(), 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(), PCB_EDIT_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateVToolbar(), CVPCB_MAINFRAME::refreshAfterComponentSearch(), SCH_BASE_FRAME::RefreshSelection(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), LIB_EDIT_FRAME::RollbackPartFromUndo(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_EDIT_FRAME::saveLibrary(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_FRAME::SetActiveLayer(), PCB_BASE_EDIT_FRAME::SetBoard(), LIB_EDIT_FRAME::SetCurPart(), LIB_VIEW_FRAME::SetSelectedComponent(), 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(), PCB_BASE_FRAME::unitsChangeRefresh(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), EDA_DRAW_FRAME::Zoom_Automatique(), CVPCB_MAINFRAME::~CVPCB_MAINFRAME(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), EDA_DRAW_FRAME::~EDA_DRAW_FRAME(), FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), GERBVIEW_FRAME::~GERBVIEW_FRAME(), ~KICAD_MANAGER_FRAME(), LIB_EDIT_FRAME::~LIB_EDIT_FRAME(), LIB_VIEW_FRAME::~LIB_VIEW_FRAME(), PL_EDITOR_FRAME::~PL_EDITOR_FRAME(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ m_toolStack

std::vector<std::string> TOOLS_HOLDER::m_toolStack
protectedinherited

◆ m_undoList

◆ m_UndoRedoCountMax

int EDA_BASE_FRAME::m_UndoRedoCountMax
protectedinherited

◆ m_userUnits


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