KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2023 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#include <kiway_player.h>
29
30class ACTION_TOOLBAR;
31class BITMAP_BUTTON;
32class EDA_BASE_FRAME;
33class KICAD_SETTINGS;
36class PROJECT_TREE;
38class UPDATE_MANAGER;
39
44{
45public:
46 KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
47 const wxPoint& pos, const wxSize& size );
48
50
51 void OnIdle( wxIdleEvent& event );
52
53 bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
54 void doCloseWindow() override;
55 void OnSize( wxSizeEvent& event ) override;
56
57 void OnArchiveFiles( wxCommandEvent& event );
58 void OnUnarchiveFiles( wxCommandEvent& event );
59
60 void OnOpenFileInTextEditor( wxCommandEvent& event );
61 void OnBrowseInFileExplorer( wxCommandEvent& event );
62
63 void OnFileHistory( wxCommandEvent& event );
64 void OnClearFileHistory( wxCommandEvent& aEvent );
65 void OnExit( wxCommandEvent& event );
66
71 wxStatusBar* OnCreateStatusBar( int number, long style, wxWindowID id,
72 const wxString& name ) override;
73
78
79 wxString GetCurrentFileName() const override
80 {
81 return GetProjectFileName();
82 }
83
94 void ImportNonKiCadProject( const wxString& aWindowTitle, const wxString& aFilesWildcard,
95 const std::vector<std::string>& aSchFileExtensions,
96 const std::vector<std::string>& aPcbFileExtensions,
97 int aSchFileType, int aPcbFileType );
98
102 void OnImportCadstarArchiveFiles( wxCommandEvent& event );
103
107 void OnImportEagleFiles( wxCommandEvent& event );
108
112 void OnImportEasyEdaFiles( wxCommandEvent& event );
113
117 void OnImportEasyEdaProFiles( wxCommandEvent& event );
118
122 void PrintPrjInfo();
123
124 void RefreshProjectTree();
125
137 void CreateNewProject( const wxFileName& aProjectFileName, bool aCreateStubFiles = true );
138
142 bool CloseProject( bool aSave );
143 void LoadProject( const wxFileName& aProjectFileName );
144
145 void OpenJobsFile( const wxFileName& aFileName, bool aCreate = false );
146
147
148 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
149
150 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
151
152 void ShowChangedLanguage() override;
153 void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
154 void ProjectChanged() override;
155
160 void OnChangeWatchedPaths( wxCommandEvent& aEvent );
161
162 const wxString GetProjectFileName() const;
163
164 bool IsProjectActive();
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 std::shared_ptr<PLUGIN_CONTENT_MANAGER> GetPcm() { return m_pcm; };
176
177 void SetPcmButton( BITMAP_BUTTON* aButton );
178
179 void CreatePCM(); // creates the PLUGIN_CONTENT_MANAGER
180
181 // Used only on Windows: stores the info message about file watcher
183
184 DECLARE_EVENT_TABLE()
185
186protected:
187 virtual void setupUIConditions() override;
188
189 void doReCreateMenuBar() override;
190
192
193 void onNotebookPageCloseRequest( wxAuiNotebookEvent& evt );
194
195private:
196 void setupTools();
198
199 void DoWithAcceptedFiles() override;
200
201 APP_SETTINGS_BASE* config() const override;
202
204
205 const SEARCH_STACK& sys_search() override;
206
207 wxString help_name() override;
208
209 void language_change( wxCommandEvent& event );
210
212
216
218 wxAuiNotebook* m_notebook;
222
227};
228
229
230// The C++ project manager includes a single PROJECT in its link image.
231class PROJECT;
232extern PROJECT& Prj();
233
234#endif
const char * name
Definition: DXF_plotter.cpp:57
Define the structure of a toolbar with buttons that invoke ACTIONs.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
The base frame for deriving all KiCad main window classes.
The main KiCad project manager frame.
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
void language_change(wxCommandEvent &event)
void SetPcmButton(BITMAP_BUTTON *aButton)
void doCloseWindow() override
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
void OnUnarchiveFiles(wxCommandEvent &event)
const SEARCH_STACK & sys_search() override
Return a SEARCH_STACK pertaining to entire program.
void OnImportEasyEdaProFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Pro schematic and board files.
void ProjectChanged() override
Notification event that the project has changed.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const wxString SchLegacyFileName()
void OpenJobsFile(const wxFileName &aFileName, bool aCreate=false)
void RecreateBaseLeftToolbar()
(Re)Create the left vertical toolbar
wxWindow * GetToolCanvas() const override
Canvas access.
void OnImportEasyEdaFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Std schematic and board files.
PROJECT_TREE_PANE * m_leftWin
const wxString GetProjectFileName() const
void OnBrowseInFileExplorer(wxCommandEvent &event)
KICAD_SETTINGS * kicadSettings() const
const wxString SchFileName()
void OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
wxStatusBar * OnCreateStatusBar(int number, long style, wxWindowID id, const wxString &name) override
Create the status line (like a wxStatusBar).
void OnExit(wxCommandEvent &event)
void OnChangeWatchedPaths(wxCommandEvent &aEvent)
Called by sending a event with id = ID_INIT_WATCHED_PATHS rebuild the list of watched paths.
void LoadProject(const wxFileName &aProjectFileName)
std::shared_ptr< PLUGIN_CONTENT_MANAGER > GetPcm()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void OnSize(wxSizeEvent &event) override
virtual void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void OnFileHistory(wxCommandEvent &event)
void DoWithAcceptedFiles() override
Execute action on accepted dropped file.
void OnOpenFileInTextEditor(wxCommandEvent &event)
APP_SETTINGS_BASE * config() const override
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
const wxString PcbLegacyFileName()
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void onNotebookPageCloseRequest(wxAuiNotebookEvent &evt)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void OnIdle(wxIdleEvent &event)
void PrintPrjInfo()
Prints the current working directory name and the project name on the text panel.
ACTION_TOOLBAR * m_mainToolBar
void OnArchiveFiles(wxCommandEvent &event)
void OnClearFileHistory(wxCommandEvent &aEvent)
void OnImportCadstarArchiveFiles(wxCommandEvent &event)
Open dialog to import CADSTAR Schematic and PCB Archive files.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void ImportNonKiCadProject(const wxString &aWindowTitle, const wxString &aFilesWildcard, const std::vector< std::string > &aSchFileExtensions, const std::vector< std::string > &aPcbFileExtensions, int aSchFileType, int aPcbFileType)
Creates a project and imports a non-KiCad Schematic and PCB.
BITMAP_BUTTON * m_pcmButton
void doReCreateMenuBar() override
PANEL_KICAD_LAUNCHER * m_launcher
wxString help_name() override
const wxString PcbFileName()
std::unique_ptr< UPDATE_MANAGER > m_updateManager
wxAuiNotebook * m_notebook
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Main class of Plugin and Content Manager subsystem.
Definition: pcm.h:105
PROJECT_TREE_PANE Window to display the tree files.
PROJECT_TREE This is the class to show (as a tree) the files in the project directory.
Definition: project_tree.h:43
Container for project specific data.
Definition: project.h:64
Look for files in a number of paths.
Definition: search_stack.h:43
STL namespace.