KiCad PCB EDA Suite
kicad_manager_frame.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013 CERN (www.cern.ch)
5  * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef KICAD_H
26 #define KICAD_H
27 
28 
29 #include <wx/process.h>
30 #include <kiway_player.h>
31 
32 class PROJECT_TREE;
33 class PROJECT_TREE_PANE;
34 class ACTION_TOOLBAR;
35 class KICAD_SETTINGS;
36 class EDA_BASE_FRAME;
38 
43 {
44 public:
45  KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
46  const wxPoint& pos, const wxSize& size );
47 
49 
50  void OnIdle( wxIdleEvent& event );
51 
52  bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
53  void doCloseWindow() override;
54  void OnSize( wxSizeEvent& event ) override;
55 
56  void OnArchiveFiles( wxCommandEvent& event );
57  void OnUnarchiveFiles( wxCommandEvent& event );
58 
59  void OnOpenFileInTextEditor( wxCommandEvent& event );
60  void OnBrowseInFileExplorer( wxCommandEvent& event );
61 
62  void OnFileHistory( wxCommandEvent& event );
63  void OnClearFileHistory( wxCommandEvent& aEvent );
64  void OnExit( wxCommandEvent& event );
65 
66  void ReCreateMenuBar() override;
67  void RecreateBaseHToolbar();
68 
69  wxString GetCurrentFileName() const override
70  {
71  return GetProjectFileName();
72  }
73 
84  void ImportNonKiCadProject( const wxString& aWindowTitle, const wxString& aFilesWildcard,
85  const wxString& aSchFileExtension,
86  const wxString& aPcbFileExtension, int aSchFileType,
87  int aPcbFileType );
88 
92  void OnImportCadstarArchiveFiles( wxCommandEvent& event );
93 
97  void OnImportEagleFiles( wxCommandEvent& event );
98 
102  void PrintPrjInfo();
103 
104  void RefreshProjectTree();
105 
117  void CreateNewProject( const wxFileName& aProjectFileName, bool aCreateStubFiles = true );
118 
122  bool CloseProject( bool aSave );
123  void LoadProject( const wxFileName& aProjectFileName );
124 
125 
126  void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
127 
128  void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
129 
130  void ShowChangedLanguage() override;
131  void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
132  void ProjectChanged() override;
133 
138  void OnChangeWatchedPaths( wxCommandEvent& aEvent );
139 
140  void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
141 
142  const wxString GetProjectFileName() const;
143 
144  bool IsProjectActive();
145  // read only accessors
146  const wxString SchFileName();
147  const wxString SchLegacyFileName();
148  const wxString PcbFileName();
149  const wxString PcbLegacyFileName();
150 
151  void ReCreateTreePrj();
152 
153  wxWindow* GetToolCanvas() const override;
154 
155  DECLARE_EVENT_TABLE()
156 
157 protected:
158  virtual void setupUIConditions() override;
159 
160 private:
161  void setupTools();
162  void setupActions();
163 
164  APP_SETTINGS_BASE* config() const override;
165 
166  KICAD_SETTINGS* kicadSettings() const;
167 
168  const SEARCH_STACK& sys_search() override;
169 
170  wxString help_name() override;
171 
172  void language_change( wxCommandEvent& event );
173 
175 
176 private:
180 
183 };
184 
185 
186 // The C++ project manager includes a single PROJECT in its link image.
187 class PROJECT;
188 extern PROJECT& Prj();
189 
190 #endif
void OnBrowseInFileExplorer(wxCommandEvent &event)
Define the structure of a toolbar with buttons that invoke ACTIONs.
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void language_change(wxCommandEvent &event)
const wxString GetProjectFileName() const
Container for project specific data.
Definition: project.h:62
void InstallPreferences(PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
Allow a frame to load its preference panels (if any) into the preferences dialog.
void OnClearFileHistory(wxCommandEvent &aEvent)
void doCloseWindow() override
void OnIdle(wxIdleEvent &event)
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
PANEL_KICAD_LAUNCHER * m_launcher
wxWindow * GetToolCanvas() const override
Canvas access.
void OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
virtual void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void OnOpenFileInTextEditor(wxCommandEvent &event)
const wxString SchLegacyFileName()
KICAD_SETTINGS * kicadSettings() const
Look for files in a number of paths.
Definition: search_stack.h:41
PROJECT_TREE_PANE * m_leftWin
void ImportNonKiCadProject(const wxString &aWindowTitle, const wxString &aFilesWildcard, const wxString &aSchFileExtension, const wxString &aPcbFileExtension, int aSchFileType, int aPcbFileType)
Creates a project and imports a non-KiCad Schematic and PCB.
PROJECT_TREE_PANE Window to display the tree files.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void OnImportCadstarArchiveFiles(wxCommandEvent &event)
Open dialog to import CADSTAR Schematic and PCB Archive files.
void OnFileHistory(wxCommandEvent &event)
const wxString SchFileName()
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxString help_name() override
void OnChangeWatchedPaths(wxCommandEvent &aEvent)
Called by sending a event with id = ID_INIT_WATCHED_PATHS rebuild the list of watched paths.
void RecreateBaseHToolbar()
(Re)Create the horizontal toolbar
void ProjectChanged() override
Notification event that the project has changed.
void OnArchiveFiles(wxCommandEvent &event)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
KICAD_MANAGER_FRAME(wxWindow *parent, const wxString &title, const wxPoint &pos, const wxSize &size)
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
const wxString PcbLegacyFileName()
void ReCreateMenuBar() override
Recreates the menu bar.
The base frame for deriving all KiCad main window classes.
const wxString PcbFileName()
void LoadProject(const wxFileName &aProjectFileName)
void OnUnarchiveFiles(wxCommandEvent &event)
APP_SETTINGS_BASE * config() const override
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void OnExit(wxCommandEvent &event)
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
ACTION_TOOLBAR * m_mainToolBar
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
const SEARCH_STACK & sys_search() override
Return a SEARCH_STACK pertaining to entire program.
void PrintPrjInfo()
Prints the current working directory name and the project name on the text panel.
The main KiCad project manager frame.
void OnSize(wxSizeEvent &event) override
PROJECT_TREE This is the class to show (as a tree) the files in the project directory.
Definition: project_tree.h:38