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 KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL, SCREEN }
 

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 OnExit (wxCommandEvent &event)
 
void ReCreateMenuBar () override
 Recreates the menu bar. More...
 
void RecreateBaseHToolbar ()
 (Re)Create the horizontal toolbar More...
 
void RecreateLauncher ()
 
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 projet 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...
 
void LoadProject (const wxFileName &aProjectFileName)
 
void LoadSettings (wxConfigBase *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *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) 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 wahtched 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 wxString SchFileName ()
 
const wxString PcbFileName ()
 
const wxString PcbLegacyFileName ()
 
void ReCreateTreePrj ()
 
EDA_UNITS GetUserUnits () const
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS aUnits)
 
void ChangeUserUnits (EDA_UNITS aUnits)
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void PushTool (const std::string &actionName)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const std::string &actionName)
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
virtual void DisplayToolMsg (const wxString &msg)
 
bool GetDoImmediateActions () const
 Indicates that hotkeys should perform an immediate action even if another tool is currently active. More...
 
bool GetDragSelects () const
 Indicates that a drag should draw a selection rectangle, even when started over an item. More...
 
bool GetMoveWarpsCursor () const
 Indicates that a move operation should warp the mouse pointer to the origin of the move object. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Override the default process event handler to implement the auto save feature. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
void OnMenuOpen (wxMenuEvent &event)
 Workaround some issues in wxWidgets where the menu events aren't captured by the menus themselves. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void OnKicadAbout (wxCommandEvent &event)
 
void OnPreferences (wxCommandEvent &event)
 
wxString ConfigBaseName ()
 
virtual void SaveProjectSettings (bool aAskForSave)
 Save changes to the project settings to the project (.pro) file. More...
 
void ImportHotkeyConfigFromFile (std::map< std::string, TOOL_ACTION * > aActionMap, const wxString &aDefaultShortname)
 Prompt the user for a hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=NULL)
 Fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
 Update the list of recently opened files. 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 RefreshCanvas ()
 Notification to refresh the drawing canvas (if any). More...
 
const wxString & GetAboutTitle () const
 
void SetShutdownBlockReason (const wxString &reason)
 Sets the block reason why the window/application is preventing OS shutdown. More...
 
void RemoveShutdownBlockReason ()
 Removes any shutdown block reason set. More...
 
bool SupportsShutdownBlockReason ()
 Whether or not the window supports setting a shutdown block reason. More...
 
virtual bool IsContentModified ()
 Get if the contents of the frame have been modified since the last save. More...
 
HOLDER_TYPE GetType ()
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

void 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
 
wxString m_AboutTitle
 
wxAuiManager m_auimgr
 
wxString m_configName
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
bool m_dragSelects
 
bool m_moveWarpsCursor
 
bool m_hasAutoSave
 
bool m_autoSaveState
 
int m_autoSaveInterval
 
wxTimer * m_autoSaveTimer
 
wxString m_perspective
 
wxString m_mruPath
 
EDA_UNITS m_userUnits
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Member Functions

wxConfigBase * config () override
 Returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
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 73 of file kicad_manager_frame.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 
SCREEN 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ 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 167 of file kicad_manager_frame.cpp.

168 {
169  // Ensure there are no active tools
170  if( m_toolManager )
172 
173  delete m_actions;
174  delete m_toolManager;
175 
176  m_auimgr.UnInit();
177 
178  // Since the file menu contains file history menus, we must ensure that the menu
179  // destructor is called before the file history objects are deleted since their destructor
180  // unregisters the menu from the history.
181  wxMenu* fileMenu = GetMenuBar()->Remove( 0 );
182  delete fileMenu;
183 }
ACTIONS * m_actions
wxAuiManager m_auimgr
void DeactivateTool()
Function DeactivateTool() Deactivates the currently active tool.
TOOL_MANAGER * m_toolManager

References TOOL_MANAGER::DeactivateTool(), EDA_BASE_FRAME::m_actions, EDA_BASE_FRAME::m_auimgr, and EDA_BASE_FRAME::m_toolManager.

Member Function Documentation

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 412 of file eda_base_frame.cpp.

413 {
414  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
415  ACTION_MENU* helpMenu = new ACTION_MENU( false );
416 
417  helpMenu->SetTool( commonControl );
418 
419  helpMenu->Add( ACTIONS::help );
420  helpMenu->Add( ACTIONS::gettingStarted );
421  helpMenu->Add( ACTIONS::listHotKeys );
422  helpMenu->Add( ACTIONS::getInvolved );
423 
424  helpMenu->AppendSeparator();
425  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
426 
427  aMenuBar->Append( helpMenu, _( "&Help" ) );
428 }
static TOOL_ACTION listHotKeys
Definition: actions.h:167
ACTION_MENU.
Definition: action_menu.h:43
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:84
COMMON_CONTROL.
#define _(s)
Definition: 3d_actions.cpp:31
static TOOL_ACTION help
Definition: actions.h:166
TOOL_MANAGER * m_toolManager
static TOOL_ACTION getInvolved
Definition: actions.h:168
static TOOL_ACTION gettingStarted
Definition: actions.h:165

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

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

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inlineinherited

Definition at line 221 of file eda_base_frame.h.

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

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

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

◆ CheckForAutoSaveFile()

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

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

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

Parameters
aFileNameA wxFileName object containing the file name to check.

Definition at line 735 of file eda_base_frame.cpp.

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

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

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

◆ ClearMsg()

void KICAD_MANAGER_FRAME::ClearMsg ( )

Erase the text panel.

Definition at line 489 of file kicad_manager_frame.cpp.

490 {
491  m_messagesBox->Clear();
492 }

References m_messagesBox.

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

◆ CommonSettingsChanged()

void KICAD_MANAGER_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged)
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 481 of file kicad_manager_frame.cpp.

482 {
483  int historySize;
484  Pgm().CommonSettings()->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE );
485  PgmTop().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) );
486 }
FILE_HISTORY & GetFileHistory()
Definition: pgm_kicad.h:57
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:98
#define FILE_HISTORY_SIZE_KEY
Definition: pgm_base.h:53
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
void SetMaxFiles(size_t aMaxFiles)
Update the number of files that will be contained inside the file history.
Definition: filehistory.cpp:42
#define DEFAULT_FILE_HISTORY_SIZE
IDs range for menuitems file history: The default range file history size is 9 (compatible with defau...
Definition: id.h:69

References DEFAULT_FILE_HISTORY_SIZE, FILE_HISTORY_SIZE_KEY, PGM_KICAD::GetFileHistory(), Pgm(), PgmTop(), and FILE_HISTORY::SetMaxFiles().

◆ config()

wxConfigBase * KICAD_MANAGER_FRAME::config ( )
overrideprivatevirtual

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

Reimplemented from EDA_BASE_FRAME.

Definition at line 186 of file kicad_manager_frame.cpp.

187 {
188  wxConfigBase* ret = PgmTop().PgmSettings();
189  wxASSERT( ret );
190  return ret;
191 }
wxConfigBase * PgmSettings()
Definition: pgm_kicad.h:59
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72

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

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited
Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, except for frames shown in multiple modes in which case the m_configName must be set to the base name so that a single config can be used.

Definition at line 345 of file eda_base_frame.h.

346  {
347  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
348  return baseCfgName;
349  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by DISPLAY_FOOTPRINTS_FRAME::LoadSettings(), FOOTPRINT_VIEWER_FRAME::LoadSettings(), EDA_BASE_FRAME::LoadSettings(), EDA_DRAW_FRAME::LoadSettings(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), EDA_BASE_FRAME::SaveSettings(), EDA_DRAW_FRAME::SaveSettings(), and ACTION_MANAGER::UpdateHotKeys().

◆ 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 356 of file kicad_manager_frame.cpp.

357 {
358  wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(),
359  "Project folder must exist and be writable to create a new project." );
360 
361  // Init project filename. This clears all elements from the project object.
362  SetProjectFileName( aProjectFileName.GetFullPath() );
363 
364  // Copy kicad.pro file from template folder.
365  if( !aProjectFileName.FileExists() )
366  {
367  wxString srcFileName = sys_search().FindValidPath( "kicad.pro" );
368 
369  // Create a minimal project (.pro) file if the template project file could not be copied.
370  if( !wxFileName::FileExists( srcFileName )
371  || !wxCopyFile( srcFileName, aProjectFileName.GetFullPath() ) )
372  {
374  }
375  }
376 
377  // Ensure a "stub" for a schematic root sheet and a board exist.
378  // It will avoid messages from the schematic editor or the board editor to create a new file
379  // And forces the user to create main files under the right name for the project manager
380  wxFileName fn( aProjectFileName.GetFullPath() );
381  fn.SetExt( SchematicFileExtension );
382 
383  // If a <project>.sch file does not exist, create a "stub" file ( minimal schematic file )
384  if( !fn.FileExists() )
385  {
386  wxFile file( fn.GetFullPath(), wxFile::write );
387 
388  if( file.IsOpened() )
389  file.Write( wxT( "EESchema Schematic File Version 2\n"
390  "EELAYER 25 0\nEELAYER END\n$EndSCHEMATC\n" ) );
391 
392  // wxFile dtor will close the file
393  }
394 
395  // If a <project>.kicad_pcb or <project>.brd file does not exist,
396  // create a .kicad_pcb "stub" file
397  fn.SetExt( KiCadPcbFileExtension );
398  wxFileName leg_fn( fn );
399  leg_fn.SetExt( LegacyPcbFileExtension );
400 
401  if( !fn.FileExists() && !leg_fn.FileExists() )
402  {
403  wxFile file( fn.GetFullPath(), wxFile::write );
404 
405  if( file.IsOpened() )
406  file.Write( wxT( "(kicad_pcb (version 4) (host kicad \"dummy file\") )\n" ) );
407 
408  // wxFile dtor will close the file
409  }
410 }
wxString FindValidPath(const wxString &aFileName) const
Definition: search_stack.h:73
const std::string LegacyPcbFileExtension
std::vector< PARAM_CFG * > s_KicadManagerParams
const std::string KiCadPcbFileExtension
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const std::string SchematicFileExtension
VTBL_ENTRY void ConfigSave(const SEARCH_STACK &aSList, const wxString &aGroupName, const std::vector< PARAM_CFG * > &aParams, const wxString &aFileName=wxEmptyString)
Function ConfigSave saves the current "project" parameters into the wxConfigBase* derivative.
Definition: project.cpp:323
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
void SetProjectFileName(const wxString &aFullProjectProFileName)
const SEARCH_STACK & sys_search() override
Return a SEARCH_STACK pertaining to entire program.
#define GeneralGroupName

References PROJECT::ConfigSave(), SEARCH_STACK::FindValidPath(), GeneralGroupName, KiCadPcbFileExtension, LegacyPcbFileExtension, PgmTop(), KIWAY_HOLDER::Prj(), s_KicadManagerParams, SchematicFileExtension, SetProjectFileName(), and sys_search().

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

◆ CurrentToolName()

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

Definition at line 267 of file eda_base_frame.cpp.

268 {
269  if( m_toolStack.empty() )
270  return ACTIONS::selectionTool.GetName();
271  else
272  return m_toolStack.back();
273 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:143

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

◆ DisplayToolMsg()

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

Reimplemented in EDA_DRAW_FRAME.

Definition at line 245 of file eda_base_frame.h.

245 {};

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

◆ doAutoSave()

bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

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

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 350 of file eda_base_frame.cpp.

351 {
352  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
353 }

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 475 of file eda_base_frame.h.

475 { return m_AboutTitle; }
wxString m_AboutTitle

References EDA_BASE_FRAME::m_AboutTitle.

Referenced by DIALOG_ABOUT::DIALOG_ABOUT().

◆ GetAutoSaveFilePrefix()

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

Definition at line 167 of file eda_base_frame.h.

168  {
169  return wxT( "_autosave-" );
170  }

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

290 { 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 159 of file eda_base_frame.h.

160  {
161  return wxT( "-bak" );
162  }

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

◆ GetDoImmediateActions()

bool EDA_BASE_FRAME::GetDoImmediateActions ( ) const
inlineinherited

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

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

Definition at line 251 of file eda_base_frame.h.

251 { return m_immediateActions; }

References EDA_BASE_FRAME::m_immediateActions.

◆ GetDragSelects()

bool EDA_BASE_FRAME::GetDragSelects ( ) const
inlineinherited

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

Definition at line 257 of file eda_base_frame.h.

257 { return m_dragSelects; }

References EDA_BASE_FRAME::m_dragSelects.

Referenced by EE_SELECTION_TOOL::Main().

◆ GetFileFromHistory()

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

Fetches the file name from the file history list.

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

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

Definition at line 622 of file eda_base_frame.cpp.

624 {
625  FILE_HISTORY* fileHistory = aFileHistory;
626 
627  if( !fileHistory )
628  fileHistory = &Kiface().GetFileHistory();
629 
630  int baseId = fileHistory->GetBaseId();
631 
632  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
633 
634  unsigned i = cmdId - baseId;
635 
636  if( i < fileHistory->GetCount() )
637  {
638  wxString fn = fileHistory->GetHistoryFile( i );
639 
640  if( wxFileName::FileExists( fn ) )
641  return fn;
642  else
643  {
644  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
645  wxMessageBox( msg );
646 
647  fileHistory->RemoveFileFromHistory( i );
648  }
649  }
650 
651  return wxEmptyString;
652 }
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:40
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123

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

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

◆ GetMoveWarpsCursor()

bool EDA_BASE_FRAME::GetMoveWarpsCursor ( ) const
inlineinherited

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

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

Definition at line 263 of file eda_base_frame.h.

263 { return m_moveWarpsCursor; }

References EDA_BASE_FRAME::m_moveWarpsCursor.

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

◆ GetMruPath()

wxString EDA_BASE_FRAME::GetMruPath ( ) const
inlineinherited

◆ GetProjectFileName()

const wxString KICAD_MANAGER_FRAME::GetProjectFileName ( )

Definition at line 214 of file kicad_manager_frame.cpp.

215 {
216  return Prj().GetProjectFullName();
217 }
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:96

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

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

◆ GetToolManager()

TOOL_MANAGER* EDA_BASE_FRAME::GetToolManager ( ) const
inlineinherited

Return the MVC controller.

Definition at line 230 of file eda_base_frame.h.

230 { return m_toolManager; }
TOOL_MANAGER * m_toolManager

References EDA_BASE_FRAME::m_toolManager.

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

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

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

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and GERBVIEW_FRAME::SaveSettings().

◆ GetUserUnits()

EDA_UNITS EDA_BASE_FRAME::GetUserUnits ( ) const
inlineinherited

Return the user units currently in use.

Definition at line 211 of file eda_base_frame.h.

212  {
213  return m_userUnits;
214  }
EDA_UNITS m_userUnits

References EDA_BASE_FRAME::m_userUnits.

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

◆ help_name()

wxString KICAD_MANAGER_FRAME::help_name ( )
overrideprivatevirtual

Reimplemented from EDA_BASE_FRAME.

Definition at line 259 of file kicad_manager_frame.cpp.

260 {
261  return PgmTop().GetHelpFileName();
262 }
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
wxString GetHelpFileName()
Definition: pgm_kicad.h:63

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 509 of file kicad_manager_frame.cpp.

511 {
512  aHotkeysPanel->AddHotKeys( GetToolManager() );
513 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.

References PANEL_HOTKEYS_EDITOR::AddHotKeys(), and EDA_BASE_FRAME::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 182 of file eda_base_frame.h.

182 { return false; }

Referenced by EDA_BASE_FRAME::ProcessEvent().

◆ IsContentModified()

bool EDA_BASE_FRAME::IsContentModified ( )
virtualinherited

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

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

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

Definition at line 798 of file eda_base_frame.cpp.

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

◆ IsCurrentTool()

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

Definition at line 276 of file eda_base_frame.cpp.

277 {
278  if( m_toolStack.empty() )
279  return &aAction == &ACTIONS::selectionTool;
280  else
281  return m_toolStack.back() == aAction.GetName();
282 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:143
const std::string & GetName() const
Function GetName() Returns name of the action.
Definition: tool_action.h:78

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

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

◆ IsType()

bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited

Definition at line 292 of file eda_base_frame.h.

292 { return m_Ident == aType; }

References EDA_BASE_FRAME::m_Ident.

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

◆ IsWritable()

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

Checks if aFileName can be written.

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

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

Definition at line 691 of file eda_base_frame.cpp.

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

References _, and GetChars().

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

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

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

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 56 of file kiway_holder.h.

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

References KIWAY_HOLDER::m_kiway.

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

◆ language_change()

void KICAD_MANAGER_FRAME::language_change ( wxCommandEvent &  event)
private

Definition at line 461 of file kicad_manager_frame.cpp.

462 {
463  int id = event.GetId();
464  Kiway().SetLanguage( id );
465 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs.
Definition: kiway.cpp:435

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

◆ LoadProject()

void KICAD_MANAGER_FRAME::LoadProject ( const wxFileName &  aProjectFileName)

Definition at line 315 of file kicad_manager_frame.cpp.

316 {
317  // The project file should be valid by the time we get here or something has gone wrong.
318  if( !aProjectFileName.Exists() )
319  return;
320 
321  // Any open KIFACE's must be closed if they are not part of the new project.
322  // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.)
323  // User is prompted here to close those KIWAY_PLAYERs:
324  if( !Kiway().PlayersClose( false ) )
325  return;
326 
327  // Save the project file for the currently loaded project.
328  if( m_active_project )
330 
331  m_active_project = true;
332  ClearMsg();
333  SetProjectFileName( aProjectFileName.GetFullPath() );
335 
336  if( aProjectFileName.IsDirWritable() )
337  SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. Why?
338 
339  UpdateFileHistory( aProjectFileName.GetFullPath(), &PgmTop().GetFileHistory() );
340 
342 
343  SyncToolbars();
344 
345  // Rebuild the list of watched paths.
346  // however this is possible only when the main loop event handler is running,
347  // so we use it to run the rebuild function.
348  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS );
349 
350  wxPostEvent( this, cmd );
351 
352  PrintPrjInfo();
353 }
VTBL_ENTRY bool PlayersClose(bool doForce)
Function PlayersClose calls the KIWAY_PLAYER::Close( bool force ) function on all the windows and if ...
Definition: kiway.cpp:414
FILE_HISTORY & GetFileHistory()
Definition: pgm_kicad.h:57
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
void SetMruPath(const wxString &aPath)
std::vector< PARAM_CFG * > s_KicadManagerParams
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
Update the list of recently opened files.
VTBL_ENTRY bool ConfigLoad(const SEARCH_STACK &aSearchS, const wxString &aGroupName, const std::vector< PARAM_CFG * > &aParams, const wxString &aForeignConfigFileName=wxEmptyString)
Function ConfigLoad reads a subset of parameters from the "project" file.
Definition: project.cpp:358
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.
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
void SetProjectFileName(const wxString &aFullProjectProFileName)
void ClearMsg()
Erase the text panel.
void PrintPrjInfo()
Prints the current working directory name and the projet name on the text panel.
TREE_PROJECT_FRAME * m_leftWin
#define GeneralGroupName

References ClearMsg(), PROJECT::ConfigLoad(), GeneralGroupName, PGM_KICAD::GetFileHistory(), PROJECT::GetProjectPath(), ID_INIT_WATCHED_PATHS, KIWAY_HOLDER::Kiway(), m_active_project, m_leftWin, PgmTop(), KIWAY::PlayersClose(), PrintPrjInfo(), KIWAY_HOLDER::Prj(), TREE_PROJECT_FRAME::ReCreateTreePrj(), s_KicadManagerParams, 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 ( wxConfigBase *  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 495 of file kicad_manager_frame.cpp.

496 {
498  aCfg->Read( TREE_FRAME_WIDTH_ENTRY, &m_leftWinWidth );
499 }
virtual void LoadSettings(wxConfigBase *aCfg)
Load common frame parameters from a configuration file.
#define TREE_FRAME_WIDTH_ENTRY

References EDA_BASE_FRAME::LoadSettings(), m_leftWinWidth, and TREE_FRAME_WIDTH_ENTRY.

◆ OnArchiveFiles()

void KICAD_MANAGER_FRAME::OnArchiveFiles ( wxCommandEvent &  event)

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

134 {
135  // List of file extensions to save.
136  static const wxChar* extensionList[] = {
137  wxT( "*.pro" ),
138  wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.dcm" ), // Schematic related files
139  wxT( "*.cmp" ),
140  wxT( "*.brd" ), wxT( "*.kicad_pcb" ), // Brd files
141  wxT( "*.mod" ), wxT( "*.kicad_mod" ), // fp files
142  wxT( "*.gb?" ), wxT( "*.gbrjob" ), // Gerber files
143  wxT( "*.gko" ), wxT( "*.gm1" ),
144  wxT( "*.gm2" ), wxT( "*.g?" ),
145  wxT( "*.gp1" ), wxT( "*.gp2" ),
146  wxT( "*.gpb" ), wxT( "*.gpt" ),
147  wxT( "*.gt?" ),
148  wxT( "*.pos" ), wxT( "*.drl" ), wxT( "*.nc" ), wxT( "*.xnc" ), // Fab files
149  wxT( "*.d356" ), wxT( "*.rpt" ),
150  wxT( "*.stp" ), wxT( "*.step" ), // 3d files
151  wxT( "*.wrl" ),
152  wxT( "*.net" ), wxT( "*.py" ),
153  wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.kicad_wks" ),
154  wxT( "fp-lib-table" ), wxT( "sym-lib-table" )
155  };
156 
157  wxString msg;
158  wxFileName fileName = GetProjectFileName();
159  wxString oldCwd = wxGetCwd();
160 
161  fileName.SetExt( wxT( "zip" ) );
162 
163  wxFileDialog dlg( this, _( "Archive Project Files" ),
164  fileName.GetPath(), fileName.GetFullName(),
165  ZipFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
166 
167  if( dlg.ShowModal() == wxID_CANCEL )
168  return;
169 
170  wxFileName zip = dlg.GetPath();
171 
172  wxString currdirname = fileName.GetPathWithSep();
173  wxDir dir( currdirname );
174 
175  if( !dir.IsOpened() ) // wxWidgets display a error message on issue.
176  return;
177 
178  wxSetWorkingDirectory( currdirname );
179 
180  // Prepare the zip file
181  wxString zipfilename = zip.GetFullPath();
182 
183  wxFFileOutputStream ostream( zipfilename );
184 
185  if( !ostream.IsOk() ) // issue to create the file. Perhaps not writable dir
186  {
187  wxMessageBox( wxString::Format( _( "Unable to create zip archive file \"%s\"" ),
188  zipfilename ) );
189  return;
190  }
191 
192  wxZipOutputStream zipstream( ostream );
193 
194  // Build list of filenames to put in zip archive
195  wxString currFilename;
196 
197  wxArrayString files;
198 
199  for( unsigned ii = 0; ii < arrayDim( extensionList ); ii++ )
200  wxDir::GetAllFiles( currdirname, &files, extensionList[ii] );
201 
202  files.Sort();
203 
204  int zipBytesCnt = 0;
205 
206  for( unsigned ii = 0; ii < files.GetCount(); ii++ )
207  {
208  wxFileSystem fsfile;
209 
210  wxFileName curr_fn( files[ii] );
211  curr_fn.MakeRelativeTo( currdirname );
212  currFilename = curr_fn.GetFullPath();
213 
214  msg.Printf( _( "Archive file \"%s\"" ), GetChars( currFilename ) );
215  PrintMsg( msg );
216 
217  // Read input file and add it to the zip file:
218  wxFSFile* infile = fsfile.OpenFile( currFilename );
219 
220  if( infile )
221  {
222  zipstream.PutNextEntry( currFilename, infile->GetModificationTime() );
223  infile->GetStream()->Read( zipstream );
224  zipstream.CloseEntry();
225  int zippedsize = zipstream.GetSize() - zipBytesCnt;
226  zipBytesCnt = zipstream.GetSize();
227  PrintMsg( wxT(" ") );
228  msg.Printf( _( "(%lu bytes, compressed %d bytes)\n" ),
229  (unsigned long)infile->GetStream()->GetSize(), zippedsize );
230  PrintMsg( msg );
231  delete infile;
232  }
233  else
234  PrintMsg( _( " >>Error\n" ) );
235  }
236 
237  zipBytesCnt = ostream.GetSize();
238 
239  if( zipstream.Close() )
240  {
241  msg.Printf( _( "\nZip archive \"%s\" created (%d bytes)" ),
242  GetChars( zipfilename ), zipBytesCnt );
243  PrintMsg( msg );
244  PrintMsg( wxT( "\n** end **\n" ) );
245  }
246  else
247  {
248  msg.Printf( wxT( "Unable to create archive \"%s\", abort\n" ),
249  GetChars( zipfilename ) );
250  PrintMsg( msg );
251  }
252 
253  wxSetWorkingDirectory( oldCwd );
254 }
static const std::vector< std::string > extensionList
wxString ZipFileWildcard()
void PrintMsg(const wxString &aText)
Displays aText in the text panel.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
const wxString GetProjectFileName()
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31

References _, arrayDim(), extensionList, Format(), GetChars(), GetProjectFileName(), PrintMsg(), and ZipFileWildcard().

◆ onAutoSaveTimer()

void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Handle the auto save timer event.

Definition at line 343 of file eda_base_frame.cpp.

344 {
345  if( !doAutoSave() )
346  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
347 }
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 434 of file kicad_manager_frame.cpp.

435 {
436  // open project directory in host OS's file explorer
437  wxString project_dir = Prj().GetProjectPath();
438 
439 #ifdef __WXMAC__
440  wxString msg;
441 
442  // Quote in case there are spaces in the path.
443  msg.Printf( "open \"%s\"", project_dir );
444 
445  system( msg.c_str() );
446 #else
447  // Quote in case there are spaces in the path.
448  AddDelimiterString( project_dir );
449 
450  wxLaunchDefaultApplication( project_dir );
451 #endif
452 }
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void AddDelimiterString(wxString &string)
Function AddDelimiterString Add un " to the start and the end of string (if not already done).
Definition: gestfich.cpp:42

References AddDelimiterString(), PROJECT::GetProjectPath(), 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 wahtched paths.

Definition at line 1125 of file tree_project_frame.cpp.

1126 {
1128 }
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 356 of file eda_base_frame.cpp.

357 {
358  wxLogTrace( kicadTraceKeyEvent, "EDA_BASE_FRAME::OnCharHook %s", dump( event ) );
359  // Key events can be filtered here.
360  // Currently no filtering is made.
361  event.Skip();
362 }
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.

◆ OnCloseWindow()

void KICAD_MANAGER_FRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 280 of file kicad_manager_frame.cpp.

281 {
282  if( Kiway().PlayersClose( false ) )
283  {
284  int px, py;
285 
286  if( !GetProjectFileName().empty() )
287  UpdateFileHistory( GetProjectFileName(), &PgmTop().GetFileHistory() );
288 
289  if( !IsIconized() ) // save main frame position and size
290  {
291  GetPosition( &px, &py );
292  m_FramePos.x = px;
293  m_FramePos.y = py;
294 
295  GetSize( &px, &py );
296  m_FrameSize.x = px;
297  m_FrameSize.y = py;
298  }
299 
300  Event.SetCanVeto( true );
301 
302  m_leftWin->Show( false );
303 
304  Destroy();
305  }
306 }
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
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
Update the list of recently opened files.
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
const wxString GetProjectFileName()
static bool empty(const wxTextEntryBase *aCtrl)
TREE_PROJECT_FRAME * m_leftWin

References empty(), GetProjectFileName(), KIWAY_HOLDER::Kiway(), EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, m_leftWin, PgmTop(), EDA_BASE_FRAME::UpdateFileHistory(), wxPoint::x, and wxPoint::y.

◆ OnExit()

void KICAD_MANAGER_FRAME::OnExit ( wxCommandEvent &  event)

Definition at line 309 of file kicad_manager_frame.cpp.

310 {
311  Close( true );
312 }

◆ OnFileHistory()

void KICAD_MANAGER_FRAME::OnFileHistory ( wxCommandEvent &  event)

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

48 {
49  wxFileName projFileName = GetFileFromHistory( event.GetId(), _( "KiCad project file" ),
50  &PgmTop().GetFileHistory() );
51  if( !projFileName.FileExists() )
52  return;
53 
54  LoadProject( projFileName );
55 }
FILE_HISTORY & GetFileHistory()
Definition: pgm_kicad.h:57
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=NULL)
Fetches the file name from the file history list.
#define _(s)
Definition: 3d_actions.cpp:31
void LoadProject(const wxFileName &aProjectFileName)

References _, EDA_BASE_FRAME::GetFileFromHistory(), PGM_KICAD::GetFileHistory(), LoadProject(), and PgmTop().

◆ OnImportEagleFiles()

void KICAD_MANAGER_FRAME::OnImportEagleFiles ( wxCommandEvent &  event)

Open dialog to import Eagle schematic and board files.

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

54 {
55  // Close other windows.
56  if( !Kiway().PlayersClose( false ) )
57  return;
58 
59 
60  wxString title = _( "Import Eagle Project Files" );
61  int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
62  wxString default_dir = GetMruPath();
63 
64  ClearMsg();
65 
66  wxFileDialog schdlg( this, title, default_dir, wxEmptyString,
67  EagleFilesWildcard(), style );
68 
69  if( schdlg.ShowModal() == wxID_CANCEL )
70  return;
71 
72 
73  wxFileName sch( schdlg.GetPath() );
74 
75  sch.SetExt( SchematicFileExtension );
76 
77  wxFileName pro = sch;
78 
79  pro.SetExt( ProjectFileExtension );
80 
81  wxString protitle = _( "KiCad Project Destination" );
82 
83  // Don't use wxFileDialog here. On GTK builds, the default path is returned unless a
84  // file is actually selected.
85  wxDirDialog prodlg( this, protitle, pro.GetPath(), wxDD_DEFAULT_STYLE );
86 
87  if( prodlg.ShowModal() == wxID_CANCEL )
88  return;
89 
90  pro.SetPath( prodlg.GetPath() );
91 
92  // Check if the project directory is empty
93  wxDir directory( pro.GetPath() );
94 
95  if( directory.HasFiles() )
96  {
97  wxString msg = _( "The selected directory is not empty. We recommend you "
98  "create projects in their own clean directory.\n\nDo you "
99  "want to create a new empty directory for the project?" );
100 
101  KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING );
102  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
103 
104  if( dlg.ShowModal() == wxID_YES )
105  {
106  // Append a new directory with the same name of the project file
107  // and try to create it
108  pro.AppendDir( pro.GetName() );
109 
110  if( !wxMkdir( pro.GetPath() ) )
111  // There was a problem, undo
112  pro.RemoveLastDir();
113  }
114  }
115 
116  wxFileName pcb( sch );
117  pro.SetExt( ProjectFileExtension ); // enforce extension
118  pcb.SetExt( LegacyPcbFileExtension ); // enforce extension
119 
120  if( !pro.IsAbsolute() )
121  pro.MakeAbsolute();
122 
123  SetProjectFileName( pro.GetFullPath() );
124  wxString prj_filename = GetProjectFileName();
125 
126  if( sch.FileExists() )
127  {
128  KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, false );
129 
130  if( !schframe )
131  {
132  try // SCH frame was not available, try to start it
133  {
134  schframe = Kiway().Player( FRAME_SCH, true );
135  }
136  catch( const IO_ERROR& err )
137  {
138  wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(),
139  _( "KiCad Error" ), wxOK | wxICON_ERROR, this );
140  return;
141  }
142  }
143 
144  std::string packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE,
145  TO_UTF8( sch.GetFullPath() ) );
146  schframe->Kiway().ExpressMail( FRAME_SCH, MAIL_IMPORT_FILE, packet, this );
147 
148  if( !schframe->IsShown() ) // the frame exists, (created by the dialog field editor)
149  // but no project loaded.
150  {
151  schframe->Show( true );
152  }
153 
154  if( schframe->IsIconized() )
155  schframe->Iconize( false );
156 
157  schframe->Raise();
158  }
159 
160 
161  if( pcb.FileExists() )
162  {
163  KIWAY_PLAYER* pcbframe = Kiway().Player( FRAME_PCB_EDITOR, false );
164 
165  if( !pcbframe )
166  {
167  try // PCB frame was not available, try to start it
168  {
169  pcbframe = Kiway().Player( FRAME_PCB_EDITOR, true );
170  }
171  catch( const IO_ERROR& err )
172  {
173  wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ),
174  wxOK | wxICON_ERROR, this );
175  return;
176  }
177  }
178 
179  // a pcb frame can be already existing, but not yet used.
180  // this is the case when running the footprint editor, or the footprint viewer first
181  // if the frame is not visible, the board is not yet loaded
182  if( !pcbframe->IsVisible() )
183  {
184  pcbframe->Show( true );
185  }
186 
187  std::string packet = StrPrintf( "%d\n%s", IO_MGR::EAGLE,
188  TO_UTF8( pcb.GetFullPath() ) );
189  pcbframe->Kiway().ExpressMail( FRAME_PCB_EDITOR, MAIL_IMPORT_FILE, packet, this );
190 
191  // On Windows, Raise() does not bring the window on screen, when iconized
192  if( pcbframe->IsIconized() )
193  pcbframe->Iconize( false );
194 
195  pcbframe->Raise();
196  }
197 
198  ReCreateTreePrj();
199  m_active_project = true;
200 }
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
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
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
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:341
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
const std::string SchematicFileExtension
const wxString GetProjectFileName()
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:427
Import a different format file.
Definition: mail_type.h:44
#define _(s)
Definition: 3d_actions.cpp:31
wxString EagleFilesWildcard()
void ClearMsg()
Erase the text panel.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

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

◆ OnKicadAbout()

void EDA_BASE_FRAME::OnKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 655 of file eda_base_frame.cpp.

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

References ShowAboutDialog().

◆ OnMenuOpen()

void EDA_BASE_FRAME::OnMenuOpen ( wxMenuEvent &  event)
inherited

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

Definition at line 365 of file eda_base_frame.cpp.

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

References ACTION_MENU::OnMenuEvent().

◆ OnOpenFileInTextEditor()

void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor ( wxCommandEvent &  event)

Definition at line 413 of file kicad_manager_frame.cpp.

414 {
415  // show all files in file dialog (in Kicad all files are editable texts):
416  wxString wildcard = AllFilesWildcard();
417 
418  wxString default_dir = Prj().GetProjectPath();
419 
420  wxFileDialog dlg( this, _( "Load File to Edit" ), default_dir,
421  wxEmptyString, wildcard, wxFD_OPEN );
422 
423  if( dlg.ShowModal() == wxID_CANCEL )
424  return;
425 
426  wxString filename = wxT( "\"" );
427  filename += dlg.GetPath() + wxT( "\"" );
428 
429  if( !dlg.GetPath().IsEmpty() && !Pgm().GetEditorName().IsEmpty() )
431 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:98
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
wxString AllFilesWildcard()
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define _(s)
Definition: 3d_actions.cpp:31
TOOL_MANAGER * m_toolManager
static TOOL_ACTION openTextEditor

References _, AllFilesWildcard(), PROJECT::GetProjectPath(), EDA_BASE_FRAME::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 662 of file eda_base_frame.cpp.

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

272 {
273  if( m_auimgr.GetManagedWindow() )
274  m_auimgr.Update();
275 
276  event.Skip();
277 }
wxAuiManager m_auimgr

References EDA_BASE_FRAME::m_auimgr.

◆ OnUnarchiveFiles()

void KICAD_MANAGER_FRAME::OnUnarchiveFiles ( wxCommandEvent &  event)

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

59 {
60  wxFileName fn = GetProjectFileName();
61 
62  fn.SetExt( ZipFileExtension );
63 
64  wxFileDialog zipfiledlg( this, _( "Unzip Project" ), fn.GetPath(),
65  fn.GetFullName(), ZipFileWildcard(),
66  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
67 
68  if( zipfiledlg.ShowModal() == wxID_CANCEL )
69  return;
70 
71  wxString msg = wxString::Format( _( "\nOpen \"%s\"\n" ), GetChars( zipfiledlg.GetPath() ) );
72  PrintMsg( msg );
73 
74  wxDirDialog dirDlg( this, _( "Target Directory" ), fn.GetPath(),
75  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
76 
77  if( dirDlg.ShowModal() == wxID_CANCEL )
78  return;
79 
80  wxString unzipDir = dirDlg.GetPath() + wxT( "/" );
81  msg.Printf( _( "Unzipping project in \"%s\"\n" ), GetChars( unzipDir ) );
82  PrintMsg( msg );
83 
84  wxFileSystem zipfilesys;
85 
86  zipfilesys.AddHandler( new wxZipFSHandler );
87  auto path = wxURI( zipfiledlg.GetPath() + wxT( "#zip:" ) ).BuildURI();
88  zipfilesys.ChangePathTo( path, true );
89 
90  wxFSFile* zipfile = NULL;
91  wxString localfilename = zipfilesys.FindFirst( wxFileSelectorDefaultWildcardStr, wxFILE );
92 
93  while( !localfilename.IsEmpty() )
94  {
95  zipfile = zipfilesys.OpenFile( localfilename );
96  if( !zipfile )
97  {
98  DisplayError( this, wxT( "Zip file read error" ) );
99  break;
100  }
101 
102  wxFileName uzfn = localfilename.AfterLast( ':' );
103  uzfn.MakeAbsolute( unzipDir );
104  wxString unzipfilename = uzfn.GetFullPath();
105 
106  msg.Printf( _( "Extract file \"%s\"" ), GetChars( unzipfilename ) );
107  PrintMsg( msg );
108 
109  wxInputStream* stream = zipfile->GetStream();
110  wxFFileOutputStream* ofile = new wxFFileOutputStream( unzipfilename );
111 
112  if( ofile->Ok() )
113  {
114  ofile->Write( *stream );
115  PrintMsg( _( " OK\n" ) );
116  }
117  else
118  PrintMsg( _( " *ERROR*\n" ) );
119 
120  delete ofile;
121  delete zipfile;
122 
123  localfilename = zipfilesys.FindNext();
124  }
125 
126  PrintMsg( wxT( "** end **\n" ) );
127 
128  if( unzipDir == Prj().GetProjectPath() )
130 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:236
wxString ZipFileWildcard()
#define NULL
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.
#define ZipFileExtension
const wxString GetProjectFileName()
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31

References _, DisplayError(), Format(), GetChars(), GetProjectFileName(), NULL, PrintMsg(), KIWAY_HOLDER::Prj(), RefreshProjectTree(), ZipFileExtension, and ZipFileWildcard().

◆ PcbFileName()

const wxString KICAD_MANAGER_FRAME::PcbFileName ( )

Definition at line 229 of file kicad_manager_frame.cpp.

230 {
231  wxFileName fn( GetProjectFileName() );
232 
233  fn.SetExt( PcbFileExtension );
234  return fn.GetFullPath();
235 }
#define PcbFileExtension
const wxString GetProjectFileName()

References GetProjectFileName(), and PcbFileExtension.

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

◆ PcbLegacyFileName()

const wxString KICAD_MANAGER_FRAME::PcbLegacyFileName ( )

Definition at line 238 of file kicad_manager_frame.cpp.

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

References GetProjectFileName(), and LegacyPcbFileExtension.

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

◆ PopTool()

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

Definition at line 229 of file eda_base_frame.cpp.

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

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

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

◆ PrintMsg()

void KICAD_MANAGER_FRAME::PrintMsg ( const wxString &  aText)

Displays aText in the text panel.

Parameters
aTextThe text to display.

Definition at line 265 of file kicad_manager_frame.cpp.

266 {
267  m_messagesBox->AppendText( aText );
268 }

References m_messagesBox.

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

◆ PrintPrjInfo()

void KICAD_MANAGER_FRAME::PrintPrjInfo ( )

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

Definition at line 519 of file kicad_manager_frame.cpp.

520 {
521  wxString msg = wxString::Format( _( "Project name:\n%s\n" ),
523  PrintMsg( msg );
524 }
void PrintMsg(const wxString &aText)
Displays aText in the text panel.
const wxString GetProjectFileName()
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31

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:171

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

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

◆ ProcessEvent()

bool EDA_BASE_FRAME::ProcessEvent ( wxEvent &  aEvent)
overrideinherited

Override the default process event handler to implement the auto save feature.

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

Definition at line 285 of file eda_base_frame.cpp.

286 {
287 #ifdef __WXMAC__
288  // Apple in its infinite wisdom will raise a disabled window before even passing
289  // us the event, so we have no way to stop it. Instead, we have to catch an
290  // improperly ordered disabled window and quasi-modal dialog here and reorder
291  // them.
292  if( !IsEnabled() && IsActive() )
293  {
294  wxWindow* dlg = findQuasiModalDialog();
295  if( dlg )
296  dlg->Raise();
297  }
298 #endif
299 
300  if( !wxFrame::ProcessEvent( aEvent ) )
301  return false;
302 
303  if( IsShown() && m_hasAutoSave && IsActive() &&
305  {
306  if( !m_autoSaveState )
307  {
308  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
309  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
310  m_autoSaveState = true;
311  }
312  else if( m_autoSaveTimer->IsRunning() )
313  {
314  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
315  m_autoSaveTimer->Stop();
316  m_autoSaveState = false;
317  }
318  }
319 
320  return true;
321 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
virtual bool isAutoSaveRequired() const
Return the auto save status of the application.
wxTimer * m_autoSaveTimer
wxWindow * findQuasiModalDialog()

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

Referenced by COMMON_TOOLS::GridProperties(), LIB_VIEW_FRAME::onSelectNextSymbol(), LIB_VIEW_FRAME::onSelectPreviousSymbol(), KIWAY::ProcessEvent(), and LIB_VIEW_FRAME::ReCreateListCmp().

◆ PushTool()

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

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

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

Definition at line 212 of file eda_base_frame.cpp.

213 {
214  m_toolStack.push_back( actionName );
215 
216  // Human cognitive stacking is very shallow; deeper tool stacks just get annoying
217  if( m_toolStack.size() > 3 )
218  m_toolStack.erase( m_toolStack.begin() );
219 
220  TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
221 
222  if( action )
223  DisplayToolMsg( action->GetLabel() );
224  else
225  DisplayToolMsg( actionName );
226 }
TOOL_ACTION * FindAction(const std::string &aActionName) const
Function FindAction() Finds an action with a given name (if there is one available).
virtual void DisplayToolMsg(const wxString &msg)
wxString GetLabel() const
Definition: tool_action.cpp:69
std::vector< std::string > m_toolStack
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:163
TOOL_ACTION.
Definition: tool_action.h:46
TOOL_MANAGER * m_toolManager

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

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

◆ RecreateBaseHToolbar()

void KICAD_MANAGER_FRAME::RecreateBaseHToolbar ( )

(Re)Create the horizontal toolbar

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

168 {
169  if( m_mainToolBar )
170  m_mainToolBar->Clear();
171  else
172  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
173  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
174 
175  // New
179 
181  m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
182  KiScaledBitmap( zip_xpm, this ),
183  _( "Archive all project files" ) );
184 
185  m_mainToolBar->AddTool( ID_READ_ZIP_ARCHIVE, wxEmptyString,
186  KiScaledBitmap( unzip_xpm, this ),
187  _( "Unarchive project files from zip archive" ) );
188 
191 
193  m_mainToolBar->AddTool( ID_BROWSE_IN_FILE_EXPLORER, wxEmptyString,
195 #ifdef __APPLE__
196  _( "Reveal project directory in Finder" ) );
197 #else
198  _( "Open project directory in file explorer" ) );
199 #endif
200 
201  // Create m_mainToolBar
202  m_mainToolBar->Realize();
203 }
static TOOL_ACTION newProject
ACTION_TOOLBAR.
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, EDA_BASE_FRAME *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:31
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
Definition: bitmap.cpp:167
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

References _, ACTION_TOOLBAR::Add(), 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(), KiScaledSeparator(), 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 206 of file kicad/menubar.cpp.

207 {
208  if( m_launcher )
209  m_launcher->Clear();
210  else
211  m_launcher = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
212  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
213 
214  // Add tools. Note these KICAD_MANAGER_ACTIONS are defined with a bitmap
215  // suitable for menus. The icans will be changed later.
218 
219  KiScaledSeparator( m_launcher, this );
222 
223  KiScaledSeparator( m_launcher, this );
228 
229  // Now set big icons for these tools:
233  KiScaledBitmap( icon_libedit_xpm, this ) );
235  KiScaledBitmap( icon_pcbnew_xpm, this ) );
237  KiScaledBitmap( icon_modedit_xpm, this ) );
246 
247  // Create mlauncher
248  m_launcher->Realize();
249 
250  // And update the visual tools state:
251  SyncToolbars();
252 }
ACTION_TOOLBAR.
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, EDA_BASE_FRAME *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.
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
Definition: bitmap.cpp:167
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(), 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(), KiScaledSeparator(), 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 39 of file kicad/menubar.cpp.

40 {
42  // wxWidgets handles the Mac Application menu behind the scenes, but that means
43  // we always have to start from scratch with a new wxMenuBar.
44  wxMenuBar* oldMenuBar = GetMenuBar();
45  wxMenuBar* menuBar = new wxMenuBar();
46 
47  //-- File menu -----------------------------------------------------------
48  //
49  CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, controlTool );
50  FILE_HISTORY& fileHistory = PgmTop().GetFileHistory();
51  static FILE_HISTORY_MENU* openRecentMenu;
52 
53  // Create the menu if it does not exist. Adding a file to/from the history
54  // will automatically refresh the menu.
55  if( !openRecentMenu )
56  {
57  openRecentMenu = new FILE_HISTORY_MENU( fileHistory, _( "Clear Recent Projects" ) );
58  openRecentMenu->SetTool( controlTool );
59  openRecentMenu->SetTitle( _( "Open Recent" ) );
60  openRecentMenu->SetIcon( recent_xpm );
61  }
62 
66  fileMenu->AddMenu( openRecentMenu,
67  FILE_HISTORY::FileHistoryNotEmpty( fileHistory ) );
68 
69  fileMenu->AddSeparator();
71 
72  fileMenu->AddSeparator();
74  _( "Import EAGLE Project..." ),
75  _( "Import EAGLE CAD XML schematic and board" ),
77 
78  fileMenu->AddSeparator();
79  fileMenu->AddItem( ID_SAVE_AND_ZIP_FILES,
80  _( "&Archive Project..." ),
81  _( "Archive all needed project files into zip archive" ),
83 
84  fileMenu->AddItem( ID_READ_ZIP_ARCHIVE,
85  _( "&Unarchive Project..." ),
86  _( "Unarchive project files from zip archive" ),
88 
89  fileMenu->AddSeparator();
90  fileMenu->AddQuitOrClose( nullptr, "KiCad" );
91 
92  fileMenu->Resolve();
93 
94  //-- View menu -----------------------------------------------------------
95  //
96  CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, controlTool );
97 
99 
100  viewMenu->AddSeparator();
103  _( "Browse Project Files" ), _( "Open project directory in file browser" ),
105 
106 #ifdef __APPLE__
107  viewMenu->AddSeparator();
108 #endif
109 
110  viewMenu->Resolve();
111 
112  //-- Tools menu -----------------------------------------------
113  //
114  CONDITIONAL_MENU* toolsMenu = new CONDITIONAL_MENU( false, controlTool );
115 
120 
121  toolsMenu->AddSeparator();
126 
127  toolsMenu->AddSeparator();
129  _( "Edit Local File..." ), _( "Edit local file in text editor" ),
131 
132  toolsMenu->Resolve();
133 
134  //-- Preferences menu -----------------------------------------------
135  //
136  CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, controlTool );
137 
141  prefsMenu->AddItem( wxID_PREFERENCES,
142  _( "Preferences...\tCTRL+," ),
143  _( "Show preferences for all open tools" ),
145 
146  prefsMenu->AddSeparator();
147  AddMenuLanguageList( prefsMenu, controlTool );
148 
149  prefsMenu->Resolve();
150 
151  //-- Menubar -------------------------------------------------------------
152  //
153  menuBar->Append( fileMenu, _( "&File" ) );
154  menuBar->Append( viewMenu, _( "&View" ) );
155  menuBar->Append( toolsMenu, _( "&Tools" ) );
156  menuBar->Append( prefsMenu, _( "&Preferences" ) );
157  AddStandardHelpMenu( menuBar );
158 
159  SetMenuBar( menuBar );
160  delete oldMenuBar;
161 }
const BITMAP_OPAQUE browse_files_xpm[1]
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()
FILE_HISTORY & GetFileHistory()
Definition: pgm_kicad.h:57
static TOOL_ACTION showCalculator
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:163
static TOOL_ACTION newFromTemplate
This class implements a menu container for a file history.
Definition: filehistory.h:86
KICAD_MANAGER_CONTROL.
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:40
static TOOL_ACTION convertImage
const BITMAP_OPAQUE recent_xpm[1]
Definition: recent.cpp:68
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:164
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:68
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]
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
void AddQuitOrClose(KIFACE_I *aKiface, wxString aAppname="")
Functions AddQuitOrClose()
static TOOL_ACTION editPCB
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:86
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...
Definition: filehistory.cpp:73
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:31
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
TOOL_MANAGER * m_toolManager
const BITMAP_OPAQUE preference_xpm[1]
Definition: preference.cpp:66
static TOOL_ACTION editSymbols
static TOOL_ACTION configurePaths
Definition: actions.h:162
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 _, CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), AddMenuLanguageList(), CONDITIONAL_MENU::AddQuitOrClose(), CONDITIONAL_MENU::AddSeparator(), EDA_BASE_FRAME::AddStandardHelpMenu(), browse_files_xpm, 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(), PGM_KICAD::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, EDA_BASE_FRAME::m_toolManager, KICAD_MANAGER_ACTIONS::newFromTemplate, KICAD_MANAGER_ACTIONS::newProject, KICAD_MANAGER_ACTIONS::openProject, KICAD_MANAGER_ACTIONS::openTextEditor, PgmTop(), preference_xpm, recent_xpm, CONDITIONAL_MENU::Resolve(), ACTIONS::saveAs, 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 247 of file kicad_manager_frame.cpp.

248 {
250 }
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 EDA_BASE_FRAME::RefreshCanvas ( )
inlinevirtualinherited

Notification to refresh the drawing canvas (if any).

Reimplemented in EDA_DRAW_FRAME.

Definition at line 473 of file eda_base_frame.h.

473 { };

Referenced by TOOL_MANAGER::ProcessEvent().

◆ RefreshProjectTree()

void KICAD_MANAGER_FRAME::RefreshProjectTree ( )

Definition at line 455 of file kicad_manager_frame.cpp.

456 {
458 }
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 184 of file eda_base_frame.cpp.

185 {
186 #if defined( _WIN32 )
187  // Windows: Destroys any block reason that may have existed
188  ShutdownBlockReasonDestroy( GetHandle() );
189 #endif
190 }

Referenced by EDA_BASE_FRAME::~EDA_BASE_FRAME().

◆ SaveProjectSettings()

virtual void EDA_BASE_FRAME::SaveProjectSettings ( bool  aAskForSave)
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 358 of file eda_base_frame.h.

358 {};

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

◆ SaveSettings()

void KICAD_MANAGER_FRAME::SaveSettings ( wxConfigBase *  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 502 of file kicad_manager_frame.cpp.

503 {
505  aCfg->Write( TREE_FRAME_WIDTH_ENTRY, m_leftWin->GetSize().x );
506 }
virtual void SaveSettings(wxConfigBase *aCfg)
Saves common frame parameters to a configuration data file.
#define TREE_FRAME_WIDTH_ENTRY
TREE_PROJECT_FRAME * m_leftWin

References m_leftWin, EDA_BASE_FRAME::SaveSettings(), and TREE_FRAME_WIDTH_ENTRY.

◆ SchFileName()

const wxString KICAD_MANAGER_FRAME::SchFileName ( )

Definition at line 220 of file kicad_manager_frame.cpp.

221 {
222  wxFileName fn( GetProjectFileName() );
223 
224  fn.SetExt( SchematicFileExtension );
225  return fn.GetFullPath();
226 }
const std::string SchematicFileExtension
const wxString GetProjectFileName()

References GetProjectFileName(), and SchematicFileExtension.

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

◆ SetAutoSaveInterval()

void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 324 of file eda_base_frame.cpp.

325 {
326  m_autoSaveInterval = aInterval;
327 
328  if( m_autoSaveTimer->IsRunning() )
329  {
330  if( m_autoSaveInterval > 0 )
331  {
332  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
333  }
334  else
335  {
336  m_autoSaveTimer->Stop();
337  m_autoSaveState = false;
338  }
339  }
340 }
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(), 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 398 of file eda_base_frame.h.

398 { 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 194 of file kicad_manager_frame.cpp.

195 {
196  // ensure file name is absolute:
197  wxFileName fn( aFullProjectProFileName );
198 
199  if( !fn.IsAbsolute() )
200  fn.MakeAbsolute();
201 
202  Prj().SetProjectFullName( fn.GetFullPath() );
203 
204  SetTitle( wxString( "KiCad " ) + GetBuildVersion() );
205  wxString title = GetTitle() + " " + fn.GetFullPath();
206 
207  if( !fn.IsDirWritable() )
208  title += _( " [Read Only]" );
209 
210  SetTitle( title );
211 }
wxString GetBuildVersion()
Function GetBuildVersion Return the build version string.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
VTBL_ENTRY void SetProjectFullName(const wxString &aFullPathAndName)
Function SetProjectFullName sets the: 1) full directory, 2) basename, and 3) extension of the project...
Definition: project.cpp:64
#define _(s)
Definition: 3d_actions.cpp:31

References _, GetBuildVersion(), KIWAY_HOLDER::Prj(), and PROJECT::SetProjectFullName().

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

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

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), 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 468 of file kicad_manager_frame.cpp.

469 {
470  // call my base class
472 
473  // tooltips in toolbars
476 
477  PrintPrjInfo();
478 }
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 projet 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 174 of file eda_base_frame.cpp.

175 {
176 #if defined( _WIN32 )
177  return true;
178 #else
179  return false;
180 #endif
181 }

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

◆ SyncToolbars()

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 255 of file kicad/menubar.cpp.

References KICAD_MANAGER_ACTIONS::editFootprints, KICAD_MANAGER_ACTIONS::editPCB, KICAD_MANAGER_ACTIONS::editSchematic, KICAD_MANAGER_ACTIONS::editSymbols, 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 253 of file kicad_manager_frame.cpp.

254 {
255  return PgmTop().SysSearch();
256 }
SEARCH_STACK & SysSearch()
Definition: pgm_kicad.h:61
PGM_KICAD & PgmTop()
Definition: kicad.cpp:72

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

Referenced by CreateNewProject().

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

197 { }

Referenced by EDA_BASE_FRAME::ChangeUserUnits().

◆ UpdateFileHistory()

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

Update the list of recently opened files.

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

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

Definition at line 611 of file eda_base_frame.cpp.

612 {
613  FILE_HISTORY* fileHistory = aFileHistory;
614 
615  if( !fileHistory )
616  fileHistory = &Kiface().GetFileHistory();
617 
618  fileHistory->AddFileToHistory( FullFileName );
619 }
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:40
void AddFileToHistory(const wxString &aFile) override
Adds a file to the history.
Definition: filehistory.cpp:53
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123

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

Referenced by SCH_EDIT_FRAME::importFile(), GERBVIEW_FRAME::LoadExcellonFiles(), GERBVIEW_FRAME::LoadGerberJobFile(), GERBVIEW_FRAME::loadListOfGerberAndDrillFiles(), LoadProject(), OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::SavePcbFile(), 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, SCH_BASE_FRAME, and PCB_BASE_FRAME.

Definition at line 451 of file eda_base_frame.h.

451 { }

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

Definition at line 180 of file kicad_manager_frame.h.

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

◆ 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 EDA_BASE_FRAME::m_dragSelects
protectedinherited

◆ 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 EDA_BASE_FRAME::m_immediateActions
protectedinherited

◆ m_launcher

ACTION_TOOLBAR* KICAD_MANAGER_FRAME::m_launcher
private

Definition at line 175 of file kicad_manager_frame.h.

Referenced by RecreateLauncher(), and SyncToolbars().

◆ m_leftWin

TREE_PROJECT_FRAME* KICAD_MANAGER_FRAME::m_leftWin
private

◆ m_leftWinWidth

int KICAD_MANAGER_FRAME::m_leftWinWidth
private

Definition at line 179 of file kicad_manager_frame.h.

Referenced by LoadSettings().

◆ m_mainToolBar

ACTION_TOOLBAR* KICAD_MANAGER_FRAME::m_mainToolBar
private

Definition at line 177 of file kicad_manager_frame.h.

Referenced by RecreateBaseHToolbar().

◆ m_messagesBox

wxTextCtrl* KICAD_MANAGER_FRAME::m_messagesBox
private

Definition at line 176 of file kicad_manager_frame.h.

Referenced by ClearMsg(), and PrintMsg().

◆ m_moveWarpsCursor

bool EDA_BASE_FRAME::m_moveWarpsCursor
protectedinherited

◆ m_mruPath

◆ m_perspective

wxString EDA_BASE_FRAME::m_perspective
protectedinherited

Definition at line 147 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::LoadSettings().

◆ m_toolManager

TOOL_MANAGER* EDA_BASE_FRAME::m_toolManager
protectedinherited

Definition at line 129 of file eda_base_frame.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(), SCH_EDIT_FRAME::ConvertTextType(), 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(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), EDA_BASE_FRAME::GetToolManager(), SCH_EDIT_FRAME::importFile(), PCB_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::KiwayMailIn(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::LoadOneLibraryPartAux(), LIB_EDIT_FRAME::LoadOneSymbol(), GERBVIEW_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnExportBody(), LIB_EDIT_FRAME::OnImportBody(), OnOpenFileInTextEditor(), EDA_DRAW_FRAME::OnSelectGrid(), LIB_EDIT_FRAME::OnSelectUnit(), EDA_DRAW_FRAME::OnSelectZoom(), SCH_EDIT_FRAME::OpenProjectFiles(), EDA_BASE_FRAME::PopTool(), EDA_BASE_FRAME::PushTool(), SCH_EDIT_FRAME::PutDataInPreviousState(), ReCreateMenuBar(), LIB_VIEW_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), CVPCB_MAINFRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), 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(), SCH_BASE_FRAME::SetScreen(), LIB_VIEW_FRAME::SetSelectedComponent(), FOOTPRINT_EDIT_FRAME::setupTools(), LIB_VIEW_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), LIB_EDIT_FRAME::setupTools(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), PCB_BASE_EDIT_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_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), and ~KICAD_MANAGER_FRAME().

◆ m_toolStack

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

◆ m_userUnits


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