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-2020 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 <eda_base_frame.h>
31 #include <kiway_player.h>
32 
33 class TREEPROJECTFILES;
34 class TREE_PROJECT_FRAME;
35 class ACTION_TOOLBAR;
36 class KICAD_SETTINGS;
37 
38 // Identify the type of files handled by Kicad manager
39 //
40 // When changing this enum please verify (and perhaps update)
41 // TREE_PROJECT_FRAME::GetFileExt(),
42 // s_AllowedExtensionsToList[]
43 
45  TREE_ROOT = 0,
47  TREE_LEGACY_SCHEMATIC, // Schematic file (.sch)
48  TREE_SEXPR_SCHEMATIC, // Schematic file (.sch)
49  TREE_LEGACY_PCB, // board file (.brd) legacy format
50  TREE_SEXPR_PCB, // board file (.kicad_brd) new s expression format
51  TREE_GERBER, // Gerber file (.pho, .g*)
52  TREE_HTML, // HTML file (.htm, *.html)
53  TREE_PDF, // PDF file (.pdf)
54  TREE_TXT, // ascii text file (.txt)
55  TREE_NET, // netlist file (.net)
58  TREE_CMP_LINK, // cmp/footprint link file (.cmp)
59  TREE_REPORT, // report file (.rpt)
60  TREE_FP_PLACE, // fooprints position (place) file (.pos)
61  TREE_DRILL, // Excellon drill file (.drl)
62  TREE_DRILL_NC, // Similar Excellon drill file (.nc)
63  TREE_DRILL_XNC, // Similar Excellon drill file (.xnc)
64  TREE_SVG, // SVG file (.svg)
65  TREE_PAGE_LAYOUT_DESCR, // Page layout and title block descr file (.kicad_wks)
66  TREE_FOOTPRINT_FILE, // footprint file (.kicad_mod)
67  TREE_SCHEMATIC_LIBFILE, // schematic library file (.lib)
69 };
70 
71 
76 {
77 public:
78  KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
79  const wxPoint& pos, const wxSize& size );
80 
82 
83  void OnCloseWindow( wxCloseEvent& Event );
84  void OnSize( wxSizeEvent& event );
85 
86  void OnArchiveFiles( wxCommandEvent& event );
87  void OnUnarchiveFiles( wxCommandEvent& event );
88 
89  void OnOpenFileInTextEditor( wxCommandEvent& event );
90  void OnBrowseInFileExplorer( wxCommandEvent& event );
91 
92  void OnFileHistory( wxCommandEvent& event );
93  void OnClearFileHistory( wxCommandEvent& aEvent );
94  void OnExit( wxCommandEvent& event );
95 
96  void ReCreateMenuBar() override;
97  void RecreateBaseHToolbar();
98  void RecreateLauncher();
99 
100  wxString GetCurrentFileName() const override
101  {
102  return GetProjectFileName();
103  }
104 
108  void OnImportEagleFiles( wxCommandEvent& event );
109 
115  void PrintMsg( const wxString& aText );
116 
120  void PrintPrjInfo();
121 
125  void ClearMsg();
126 
127  void RefreshProjectTree();
128 
139  void CreateNewProject( const wxFileName& aProjectFileName );
140  void LoadProject( const wxFileName& aProjectFileName );
141 
142 
143  void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
144 
145  void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
146 
147  void ShowChangedLanguage() override;
148  void CommonSettingsChanged( bool aEnvVarsChanged ) override;
149 
154  void OnChangeWatchedPaths( wxCommandEvent& aEvent );
155 
156  void SyncToolbars() override;
157 
158  void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
159 
160  void SetProjectFileName( const wxString& aFullProjectProFileName );
161  const wxString GetProjectFileName() const;
162 
163  // read only accessors
164  const wxString SchFileName();
165  const wxString SchLegacyFileName();
166  const wxString PcbFileName();
167  const wxString PcbLegacyFileName();
168 
169  void ReCreateTreePrj();
170 
171  wxWindow* GetToolCanvas() const override;
172 
173  DECLARE_EVENT_TABLE()
174 
175 private:
176  APP_SETTINGS_BASE* config() const override;
177 
178  const SEARCH_STACK& sys_search() override;
179 
180  wxString help_name() override;
181 
182  void language_change( wxCommandEvent& event );
183 
184 private:
187  wxTextCtrl* m_messagesBox;
189 
192 };
193 
194 
195 // The C++ project manager includes a single PROJECT in its link image.
196 class PROJECT;
197 extern PROJECT& Prj();
198 
199 #endif
void OnBrowseInFileExplorer(wxCommandEvent &event)
ACTION_TOOLBAR.
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
PROJECT holds project specific data.
Definition: project.h:59
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...
void OnClearFileHistory(wxCommandEvent &aEvent)
TREEPROJECTFILES This is the class to show (as a tree) the files in the project directory.
wxWindow * GetToolCanvas() const override
Canvas access.
void OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
void OnOpenFileInTextEditor(wxCommandEvent &event)
const wxString SchLegacyFileName()
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
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:73
void PrintMsg(const wxString &aText)
Displays aText in the text panel.
TREE_PROJECT_FRAME Window to display the tree files.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
TreeFileType
wxString help_name() override
Base window classes and related definitions.
void OnChangeWatchedPaths(wxCommandEvent &aEvent)
Called by sending a event with id = ID_INIT_WATCHED_PATHS rebuild the list of wahtched paths.
void RecreateBaseHToolbar()
(Re)Create the horizontal toolbar
void OnArchiveFiles(wxCommandEvent &event)
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void SetProjectFileName(const wxString &aFullProjectProFileName)
KICAD_MANAGER_FRAME(wxWindow *parent, const wxString &title, const wxPoint &pos, const wxSize &size)
void OnCloseWindow(wxCloseEvent &Event)
ACTION_TOOLBAR * m_launcher
const wxString PcbLegacyFileName()
void ReCreateMenuBar() override
Recreates the menu bar.
void OnSize(wxSizeEvent &event)
The base frame for deriving all KiCad main window classes.
const wxString PcbFileName()
void LoadProject(const wxFileName &aProjectFileName)
void OnUnarchiveFiles(wxCommandEvent &event)
void CreateNewProject(const wxFileName &aProjectFileName)
Creates a new project by setting up and initial project, schematic, and board files.
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
const SEARCH_STACK & sys_search() override
Return a SEARCH_STACK pertaining to entire program.
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
The main KiCad project manager frame.