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,
46  TREE_LEGACY_PROJECT, // Legacy project file (.pro)
47  TREE_JSON_PROJECT, // JSON formatted project file (.kicad_pro)
48  TREE_LEGACY_SCHEMATIC, // Schematic file (.sch)
49  TREE_SEXPR_SCHEMATIC, // Schematic file (.kicad_sch)
50  TREE_LEGACY_PCB, // board file (.brd) legacy format
51  TREE_SEXPR_PCB, // board file (.kicad_brd) new s expression format
52  TREE_GERBER, // Gerber file (.pho, .g*)
53  TREE_HTML, // HTML file (.htm, *.html)
54  TREE_PDF, // PDF file (.pdf)
55  TREE_TXT, // ascii text file (.txt)
56  TREE_NET, // netlist file (.net)
59  TREE_CMP_LINK, // cmp/footprint link file (.cmp)
60  TREE_REPORT, // report file (.rpt)
61  TREE_FP_PLACE, // footprints position (place) file (.pos)
62  TREE_DRILL, // Excellon drill file (.drl)
63  TREE_DRILL_NC, // Similar Excellon drill file (.nc)
64  TREE_DRILL_XNC, // Similar Excellon drill file (.xnc)
65  TREE_SVG, // SVG file (.svg)
66  TREE_PAGE_LAYOUT_DESCR, // Page layout and title block descr file (.kicad_wks)
67  TREE_FOOTPRINT_FILE, // footprint file (.kicad_mod)
68  TREE_SCHEMATIC_LIBFILE, // schematic library file (.lib)
69  TREE_SEXPR_SYMBOL_LIB_FILE, // s-expression symbol library file (.kicad_sym)
71 };
72 
73 
78 {
79 public:
80  KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
81  const wxPoint& pos, const wxSize& size );
82 
84 
85  void OnCloseWindow( wxCloseEvent& Event );
86  void OnSize( wxSizeEvent& event );
87 
88  void OnArchiveFiles( wxCommandEvent& event );
89  void OnUnarchiveFiles( wxCommandEvent& event );
90 
91  void OnOpenFileInTextEditor( wxCommandEvent& event );
92  void OnBrowseInFileExplorer( wxCommandEvent& event );
93 
94  void OnFileHistory( wxCommandEvent& event );
95  void OnClearFileHistory( wxCommandEvent& aEvent );
96  void OnExit( wxCommandEvent& event );
97 
98  void ReCreateMenuBar() override;
99  void RecreateBaseHToolbar();
100  void RecreateLauncher();
101 
102  wxString GetCurrentFileName() const override
103  {
104  return GetProjectFileName();
105  }
106 
110  void OnImportEagleFiles( wxCommandEvent& event );
111 
117  void PrintMsg( const wxString& aText );
118 
122  void PrintPrjInfo();
123 
127  void ClearMsg();
128 
129  void RefreshProjectTree();
130 
141  void CreateNewProject( const wxFileName& aProjectFileName );
142  void LoadProject( const wxFileName& aProjectFileName );
143 
144 
145  void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
146 
147  void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
148 
149  void ShowChangedLanguage() override;
150  void CommonSettingsChanged( bool aEnvVarsChanged ) override;
151 
156  void OnChangeWatchedPaths( wxCommandEvent& aEvent );
157 
158  void SyncToolbars() override;
159 
160  void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
161 
162  void SetProjectFileName( const wxString& aFullProjectProFileName );
163  const wxString GetProjectFileName() const;
164 
165  // read only accessors
166  const wxString SchFileName();
167  const wxString SchLegacyFileName();
168  const wxString PcbFileName();
169  const wxString PcbLegacyFileName();
170 
171  void ReCreateTreePrj();
172 
173  wxWindow* GetToolCanvas() const override;
174 
175  DECLARE_EVENT_TABLE()
176 
177 private:
178  APP_SETTINGS_BASE* config() const override;
179 
180  const SEARCH_STACK& sys_search() override;
181 
182  wxString help_name() override;
183 
184  void language_change( wxCommandEvent& event );
185 
186 private:
189  wxTextCtrl* m_messagesBox;
191 
194 };
195 
196 
197 // The C++ project manager includes a single PROJECT in its link image.
198 class PROJECT;
199 extern PROJECT& Prj();
200 
201 #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:61
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:91
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 watched 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 project name on the text panel.
TREE_PROJECT_FRAME * m_leftWin
The main KiCad project manager frame.