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 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 
37 // Identify the type of files handled by Kicad manager
38 //
39 // When changing this enum please verify (and perhaps update)
40 // TREE_PROJECT_FRAME::GetFileExt(),
41 // s_AllowedExtensionsToList[]
42 
44  TREE_ROOT = 0,
46  TREE_SCHEMA, // Schematic file (.sch)
47  TREE_LEGACY_PCB, // board file (.brd) legacy format
48  TREE_SEXP_PCB, // board file (.kicad_brd) new s expression format
49  TREE_GERBER, // Gerber file (.pho, .g*)
50  TREE_HTML, // HTML file (.htm, *.html)
51  TREE_PDF, // PDF file (.pdf)
52  TREE_TXT, // ascii text file (.txt)
53  TREE_NET, // netlist file (.net)
56  TREE_CMP_LINK, // cmp/footprint link file (.cmp)
57  TREE_REPORT, // report file (.rpt)
58  TREE_FP_PLACE, // fooprints position (place) file (.pos)
59  TREE_DRILL, // Excellon drill file (.drl)
60  TREE_DRILL_NC, // Similar Excellon drill file (.nc)
61  TREE_DRILL_XNC, // Similar Excellon drill file (.xnc)
62  TREE_SVG, // SVG file (.svg)
63  TREE_PAGE_LAYOUT_DESCR, // Page layout and title block descr file (.kicad_wks)
64  TREE_FOOTPRINT_FILE, // footprint file (.kicad_mod)
65  TREE_SCHEMATIC_LIBFILE, // schematic library file (.lib)
67 };
68 
69 
74 {
75 public:
76  KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
77  const wxPoint& pos, const wxSize& size );
78 
80 
81  void OnCloseWindow( wxCloseEvent& Event );
82  void OnSize( wxSizeEvent& event );
83 
84  void OnArchiveFiles( wxCommandEvent& event );
85  void OnUnarchiveFiles( wxCommandEvent& event );
86 
87  void OnOpenFileInTextEditor( wxCommandEvent& event );
88  void OnBrowseInFileExplorer( wxCommandEvent& event );
89 
90  void OnFileHistory( wxCommandEvent& event );
91  void OnExit( wxCommandEvent& event );
92 
93  void ReCreateMenuBar() override;
94  void RecreateBaseHToolbar();
95  void RecreateLauncher();
96 
100  void OnImportEagleFiles( wxCommandEvent& event );
101 
107  void PrintMsg( const wxString& aText );
108 
112  void PrintPrjInfo();
113 
117  void ClearMsg();
118 
119  void RefreshProjectTree();
120 
131  void CreateNewProject( const wxFileName& aProjectFileName );
132  void LoadProject( const wxFileName& aProjectFileName );
133 
134 
135  void LoadSettings( wxConfigBase* aCfg ) override;
136 
137  void SaveSettings( wxConfigBase* aCfg ) override;
138 
139  void ShowChangedLanguage() override;
140  void CommonSettingsChanged( bool aEnvVarsChanged ) override;
141 
146  void OnChangeWatchedPaths( wxCommandEvent& aEvent );
147 
148  void SyncToolbars() override;
149 
150  void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
151 
152  void SetProjectFileName( const wxString& aFullProjectProFileName );
153  const wxString GetProjectFileName();
154 
155  // read only accessors
156  const wxString SchFileName();
157  const wxString PcbFileName();
158  const wxString PcbLegacyFileName();
159 
160  void ReCreateTreePrj();
161 
162  DECLARE_EVENT_TABLE()
163 
164 private:
165  wxConfigBase* config() override;
166 
167  const SEARCH_STACK& sys_search() override;
168 
169  wxString help_name() override;
170 
171  void language_change( wxCommandEvent& event );
172 
173 private:
176  wxTextCtrl* m_messagesBox;
178 
181 };
182 
183 
184 // The C++ project manager includes a single PROJECT in its link image.
185 class PROJECT;
186 extern PROJECT& Prj();
187 
188 #endif
void OnBrowseInFileExplorer(wxCommandEvent &event)
Class ACTION_TOOLBAR.
void language_change(wxCommandEvent &event)
Class PROJECT holds project specific data.
Definition: project.h:58
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 LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
Class TREEPROJECTFILES This is the class to show (as a tree) the files in the project directory.
void OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
void OnOpenFileInTextEditor(wxCommandEvent &event)
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
void OnFileHistory(wxCommandEvent &event)
const wxString SchFileName()
void PrintMsg(const wxString &aText)
Displays aText in the text panel.
class TREE_PROJECT_FRAME Window to display the tree files
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.
const wxString GetProjectFileName()
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)
void SaveSettings(wxConfigBase *aCfg) override
Saves common frame parameters to a configuration data file.
The base frame for deriving all KiCad main window classes.
const wxString PcbFileName()
PROJECT & Prj()
Definition: kicad.cpp:297
void LoadProject(const wxFileName &aProjectFileName)
wxConfigBase * config() override
Returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void OnUnarchiveFiles(wxCommandEvent &event)
void CreateNewProject(const wxFileName &aProjectFileName)
Creates a new project by setting up and initial project, schematic, and board files.
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.