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 The 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;
39class UPDATE_MANAGER;
40
45{
46public:
47 KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
48 const wxPoint& pos, const wxSize& size );
49
51
52 void OnIdle( wxIdleEvent& event );
53
54 bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
55 void doCloseWindow() override;
56 void OnSize( wxSizeEvent& event ) override;
57
58 void UnarchiveFiles();
60 void RestoreCommitFromHistory( const wxString& aHash );
61 void ToggleLocalHistory();
62 bool HistoryPanelShown();
63
64 void OnOpenFileInTextEditor( wxCommandEvent& event );
65 void OnEditAdvancedCfg( wxCommandEvent& event );
66
67 void OnFileHistory( wxCommandEvent& event );
68 void OnClearFileHistory( wxCommandEvent& aEvent );
69 void OnExit( wxCommandEvent& event );
70
75 wxStatusBar* OnCreateStatusBar( int number, long style, wxWindowID id,
76 const wxString& name ) override;
77
81 void HideTabsIfNeeded();
82
83 wxString GetCurrentFileName() const override
84 {
85 return GetProjectFileName();
86 }
87
98 void ImportNonKiCadProject( const wxString& aWindowTitle, const wxString& aFilesWildcard,
99 const std::vector<std::string>& aSchFileExtensions,
100 const std::vector<std::string>& aPcbFileExtensions,
101 int aSchFileType, int aPcbFileType );
102
106 void OnImportAltiumProjectFiles( wxCommandEvent& event );
107
111 void OnImportCadstarArchiveFiles( wxCommandEvent& event );
112
116 void OnImportEagleFiles( wxCommandEvent& event );
117
121 void OnImportEasyEdaFiles( wxCommandEvent& event );
122
126 void OnImportEasyEdaProFiles( wxCommandEvent& event );
127
131 void PrintPrjInfo();
132
133 void RefreshProjectTree();
134
146 void CreateNewProject( const wxFileName& aProjectFileName, bool aCreateStubFiles = true );
147
151 bool CloseProject( bool aSave );
152 void LoadProject( const wxFileName& aProjectFileName );
153
154 void OpenJobsFile( const wxFileName& aFileName, bool aCreate = false,
155 bool aResaveProjectPreferences = true );
156
157
158 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
159
160 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
161
162 void ShowChangedLanguage() override;
163 void CommonSettingsChanged( int aFlags ) override;
164 void ProjectChanged() override;
165
170 void OnChangeWatchedPaths( wxCommandEvent& aEvent );
171
172 const wxString GetProjectFileName() const;
173
174 bool IsProjectActive();
175 // read only accessors
176 const wxString SchFileName();
177 const wxString SchLegacyFileName();
178 const wxString PcbFileName();
179 const wxString PcbLegacyFileName();
180
181 void ReCreateTreePrj();
182
190 void SaveOpenJobSetsToLocalSettings( bool aIsExplicitUserSave = false );
191
192 wxWindow* GetToolCanvas() const override;
193
194 std::shared_ptr<PLUGIN_CONTENT_MANAGER> GetPcm() { return m_pcm; };
195
196 void SetPcmButton( BITMAP_BUTTON* aButton );
197
198 void CreatePCM(); // creates the PLUGIN_CONTENT_MANAGER
199
200 // Used only on Windows: stores the info message about file watcher
202
203 DECLARE_EVENT_TABLE()
204
205protected:
206 virtual void setupUIConditions() override;
207
208 void doReCreateMenuBar() override;
209
211
212 void onNotebookPageCloseRequest( wxAuiNotebookEvent& evt );
213
214 void onNotebookPageCountChanged( wxAuiNotebookEvent& evt );
215
216private:
217 void setupTools();
219
220 void DoWithAcceptedFiles() override;
221
222 APP_SETTINGS_BASE* config() const override;
223
225
226 const SEARCH_STACK& sys_search() override;
227
228 wxString help_name() override;
229
230 void language_change( wxCommandEvent& event );
231
233
234private:
239
242 wxAuiNotebook* m_notebook;
245
250};
251
252
253// The C++ project manager includes a single PROJECT in its link image.
254class PROJECT;
255extern PROJECT& Prj();
256
257#endif
const char * name
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.
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
The base frame for deriving all KiCad main window classes.
EDA_BASE_FRAME(wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, KIWAY *aKiway, const EDA_IU_SCALE &aIuScale)
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
void language_change(wxCommandEvent &event)
void SetPcmButton(BITMAP_BUTTON *aButton)
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
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()
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
void OnImportAltiumProjectFiles(wxCommandEvent &event)
Open dialog to import Altium project files.
const wxString GetProjectFileName() const
KICAD_SETTINGS * kicadSettings() const
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 OpenJobsFile(const wxFileName &aFileName, bool aCreate=false, bool aResaveProjectPreferences=true)
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 RestoreCommitFromHistory(const wxString &aHash)
void DoWithAcceptedFiles() override
Execute action on accepted dropped file.
void OnOpenFileInTextEditor(wxCommandEvent &event)
APP_SETTINGS_BASE * config() const override
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
const wxString PcbLegacyFileName()
void OnEditAdvancedCfg(wxCommandEvent &event)
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;.
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void onNotebookPageCloseRequest(wxAuiNotebookEvent &evt)
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void OnIdle(wxIdleEvent &event)
void PrintPrjInfo()
Prints the current working directory name and the project name on the text panel.
void SaveOpenJobSetsToLocalSettings(bool aIsExplicitUserSave=false)
void onNotebookPageCountChanged(wxAuiNotebookEvent &evt)
LOCAL_HISTORY_PANE * m_historyPane
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
void HideTabsIfNeeded()
Hides the tabs for Editor notebook if there is only 1 page.
wxString help_name() override
std::unique_ptr< UPDATE_MANAGER > m_updateManager
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Main class of Plugin and Content Manager subsystem.
Definition pcm.h:106
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.
Container for project specific data.
Definition project.h:66
Look for files in a number of paths.
STL class.
STL namespace.