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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef KICAD_H
22#define KICAD_H
23
24#include <kiway_player.h>
25
26class ACTION_TOOLBAR;
27class BITMAP_BUTTON;
28class EDA_BASE_FRAME;
29class KICAD_SETTINGS;
32class PROJECT_TREE;
35class GIT_COMMIT_PANE;
36class UPDATE_MANAGER;
37
42{
43public:
44 KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
45 const wxPoint& pos, const wxSize& size );
46
48
49 void OnIdle( wxIdleEvent& event );
50
51 bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
52 void doCloseWindow() override;
53 void OnSize( wxSizeEvent& event ) override;
54
55 void UnarchiveFiles();
57 void RestoreCommitFromHistory( const wxString& aHash );
58 void ToggleLocalHistory();
59 bool HistoryPanelShown();
60
62 bool GitCommitPaneShown();
63
65 void ShowGitHistory();
66
67 void OnOpenFileInTextEditor( wxCommandEvent& event );
68 void OnEditAdvancedCfg( wxCommandEvent& event );
69
72 void OnCompareProjectBranches( wxCommandEvent& event );
73
74 void OnFileHistory( wxCommandEvent& event );
75 void OnClearFileHistory( wxCommandEvent& aEvent );
76 void OnExit( wxCommandEvent& event );
77
82 wxStatusBar* OnCreateStatusBar( int number, long style, wxWindowID id,
83 const wxString& name ) override;
84
88 void HideTabsIfNeeded();
89
90 wxString GetCurrentFileName() const override;
91
102 void ImportNonKiCadProject( const wxString& aWindowTitle, const wxString& aFilesWildcard,
103 const std::vector<std::string>& aSchFileExtensions,
104 const std::vector<std::string>& aPcbFileExtensions,
105 int aSchFileType, int aPcbFileType );
106
110 void OnImportAltiumProjectFiles( wxCommandEvent& event );
111
115 void OnImportCadstarArchiveFiles( wxCommandEvent& event );
116
120 void OnImportEagleFiles( wxCommandEvent& event );
121
125 void OnImportEasyEdaFiles( wxCommandEvent& event );
126
130 void OnImportEasyEdaProFiles( wxCommandEvent& event );
131
135 void OnImportPadsProjectFiles( wxCommandEvent& event );
136 void OnImportPcadProjectFiles( wxCommandEvent& event );
137
141 void OnImportGedaFiles( wxCommandEvent& event );
142
146 void OnImportDipTraceFiles( wxCommandEvent& event );
147
151 void OnImportEasyPcFiles( wxCommandEvent& event );
152 void OnImportTarget3001Files( wxCommandEvent& event );
153
157 void OnImportOrcadFiles( wxCommandEvent& event );
158
162 void PrintPrjInfo();
163
164 void RefreshProjectTree();
165
177 void CreateNewProject( const wxFileName& aProjectFileName, bool aCreateStubFiles = true );
178
182 bool CloseProject( bool aSave );
183
189 bool LoadProject( const wxFileName& aProjectFileName );
190
191 void OpenJobsFile( const wxFileName& aFileName, bool aCreate = false,
192 bool aResaveProjectPreferences = true );
193
194
195 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
196
197 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
198
199 void ShowChangedLanguage() override;
200 void CommonSettingsChanged( int aFlags ) override;
201 void ProjectChanged() override;
202
203 void PreloadAllLibraries();
204
209 void OnChangeWatchedPaths( wxCommandEvent& aEvent );
210
211 const wxString GetProjectFileName() const;
212
213 bool IsProjectActive();
214 // read only accessors
215 const wxString SchFileName();
216 const wxString SchLegacyFileName();
217 const wxString PcbFileName();
218 const wxString PcbLegacyFileName();
219
220 void ReCreateTreePrj();
221
229 void SaveOpenJobSetsToLocalSettings( bool aIsExplicitUserSave = false );
230
231 wxWindow* GetToolCanvas() const override;
232
233 std::shared_ptr<PLUGIN_CONTENT_MANAGER> GetPcm() { return m_pcm; };
234
235 void SetPcmButton( BITMAP_BUTTON* aButton );
236
237 void CreatePCM(); // creates the PLUGIN_CONTENT_MANAGER
238
239 // Used only on Windows: stores the info message about file watcher
241
242 DECLARE_EVENT_TABLE()
243
244protected:
245 virtual void setupUIConditions() override;
246
247 void doReCreateMenuBar() override;
248
250
251 void onNotebookPageCloseRequest( wxAuiNotebookEvent& evt );
252
253 void onNotebookPageCountChanged( wxAuiNotebookEvent& evt );
254
255private:
256 void setupTools();
258
259 void DoWithAcceptedFiles() override;
260
261 APP_SETTINGS_BASE* config() const override;
262
264
265 const SEARCH_STACK& sys_search() override;
266
267 wxString help_name() override;
268
270
273
274private:
281
285 wxAuiNotebook* m_notebook;
288
293};
294
295
296// The C++ project manager includes a single PROJECT in its link image.
297class PROJECT;
298extern PROJECT& Prj();
299
300#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)
Docked panel for committing: the branch to commit to, a summary and description, the commit options,...
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
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.
void reloadProjectSettings()
Reread the project and local settings files after a history restore rewrote them.
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.
void OnImportPadsProjectFiles(wxCommandEvent &event)
Open dialog to import PADS Logic schematic and PCB files.
void OnImportEasyPcFiles(wxCommandEvent &event)
Open dialog to import an Easy-PC / DesignSpark PCB project, schematic or board.
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.
std::shared_ptr< PLUGIN_CONTENT_MANAGER > GetPcm()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void OnSize(wxSizeEvent &event) override
GIT_COMMIT_PANE * m_gitCommitPane
virtual void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void OnFileHistory(wxCommandEvent &event)
PROJECT_TREE_PANE * m_projectTreePane
void OnImportGedaFiles(wxCommandEvent &event)
Open dialog to import gEDA/gaf schematic and PCB files.
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.
void OnImportOrcadFiles(wxCommandEvent &event)
Open dialog to import an OrCAD schematic file.
const wxString PcbLegacyFileName()
void OnEditAdvancedCfg(wxCommandEvent &event)
void OnImportPcadProjectFiles(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 ShowGitHistory()
Open the advanced Git window on its History page, run through the docked panel.
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 OnImportDipTraceFiles(wxCommandEvent &event)
Open dialog to import DipTrace schematic and board files.
void SaveOpenJobSetsToLocalSettings(bool aIsExplicitUserSave=false)
bool LoadProject(const wxFileName &aProjectFileName)
Loads a new project.
bool m_restoredFromHistory
Set after restore to mark editors dirty.
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 OnImportTarget3001Files(wxCommandEvent &event)
void OnCompareProjectBranches(wxCommandEvent &event)
Open DIALOG_GIT_MR_REVIEW so the user can pick two refs and review the changed-file list between them...
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:107
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:63
Look for files in a number of paths.
STL class.
STL namespace.