2013-01-18 10:42:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 CERN (www.cern.ch)
|
2020-04-16 16:43:50 +00:00
|
|
|
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-01-18 10:42:23 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifndef KICAD_H
|
|
|
|
#define KICAD_H
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2013-01-18 10:42:23 +00:00
|
|
|
#include <wx/process.h>
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <eda_base_frame.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <kiway_player.h>
|
2016-02-24 21:36:52 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
class TREEPROJECTFILES;
|
|
|
|
class TREE_PROJECT_FRAME;
|
2019-06-09 21:57:23 +00:00
|
|
|
class ACTION_TOOLBAR;
|
2020-01-13 01:44:19 +00:00
|
|
|
class KICAD_SETTINGS;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2020-06-03 20:13:01 +00:00
|
|
|
// Identify the type of files handled by KiCad manager
|
2012-08-29 12:40:09 +00:00
|
|
|
//
|
|
|
|
// When changing this enum please verify (and perhaps update)
|
|
|
|
// TREE_PROJECT_FRAME::GetFileExt(),
|
|
|
|
// s_AllowedExtensionsToList[]
|
|
|
|
|
|
|
|
enum TreeFileType {
|
2019-07-17 10:57:12 +00:00
|
|
|
TREE_ROOT = 0,
|
2020-07-07 00:14:27 +00:00
|
|
|
TREE_LEGACY_PROJECT, // Legacy project file (.pro)
|
|
|
|
TREE_JSON_PROJECT, // JSON formatted project file (.kicad_pro)
|
2020-05-12 11:53:45 +00:00
|
|
|
TREE_LEGACY_SCHEMATIC, // Schematic file (.sch)
|
2020-07-07 00:14:27 +00:00
|
|
|
TREE_SEXPR_SCHEMATIC, // Schematic file (.kicad_sch)
|
2013-07-19 18:27:22 +00:00
|
|
|
TREE_LEGACY_PCB, // board file (.brd) legacy format
|
2020-05-12 11:53:45 +00:00
|
|
|
TREE_SEXPR_PCB, // board file (.kicad_brd) new s expression format
|
2013-07-19 18:27:22 +00:00
|
|
|
TREE_GERBER, // Gerber file (.pho, .g*)
|
2020-07-23 12:07:26 +00:00
|
|
|
TREE_GERBER_JOB_FILE, // Gerber file (.gbrjob)
|
2015-06-24 19:30:35 +00:00
|
|
|
TREE_HTML, // HTML file (.htm, *.html)
|
2013-07-19 18:27:22 +00:00
|
|
|
TREE_PDF, // PDF file (.pdf)
|
|
|
|
TREE_TXT, // ascii text file (.txt)
|
|
|
|
TREE_NET, // netlist file (.net)
|
2012-08-29 12:40:09 +00:00
|
|
|
TREE_UNKNOWN,
|
|
|
|
TREE_DIRECTORY,
|
2013-07-19 18:27:22 +00:00
|
|
|
TREE_CMP_LINK, // cmp/footprint link file (.cmp)
|
|
|
|
TREE_REPORT, // report file (.rpt)
|
2020-06-03 20:13:01 +00:00
|
|
|
TREE_FP_PLACE, // footprints position (place) file (.pos)
|
2013-07-19 18:27:22 +00:00
|
|
|
TREE_DRILL, // Excellon drill file (.drl)
|
2019-03-27 15:46:51 +00:00
|
|
|
TREE_DRILL_NC, // Similar Excellon drill file (.nc)
|
|
|
|
TREE_DRILL_XNC, // Similar Excellon drill file (.xnc)
|
2013-07-19 18:27:22 +00:00
|
|
|
TREE_SVG, // SVG file (.svg)
|
|
|
|
TREE_PAGE_LAYOUT_DESCR, // Page layout and title block descr file (.kicad_wks)
|
2014-10-21 16:34:51 +00:00
|
|
|
TREE_FOOTPRINT_FILE, // footprint file (.kicad_mod)
|
|
|
|
TREE_SCHEMATIC_LIBFILE, // schematic library file (.lib)
|
2020-06-03 20:13:01 +00:00
|
|
|
TREE_SEXPR_SYMBOL_LIB_FILE, // s-expression symbol library file (.kicad_sym)
|
2012-08-29 12:40:09 +00:00
|
|
|
TREE_MAX
|
|
|
|
};
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
/**
|
2017-08-31 15:15:20 +00:00
|
|
|
* The main KiCad project manager frame. It is not a KIWAY_PLAYER.
|
2007-10-31 17:47:44 +00:00
|
|
|
*/
|
2019-06-08 22:14:57 +00:00
|
|
|
class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
public:
|
|
|
|
KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
|
2017-08-31 15:15:20 +00:00
|
|
|
const wxPoint& pos, const wxSize& size );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2011-04-17 13:54:17 +00:00
|
|
|
~KICAD_MANAGER_FRAME();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
|
|
|
void OnSize( wxSizeEvent& event );
|
2011-08-19 15:08:41 +00:00
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
void OnArchiveFiles( wxCommandEvent& event );
|
|
|
|
void OnUnarchiveFiles( wxCommandEvent& event );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
void OnOpenFileInTextEditor( wxCommandEvent& event );
|
2018-06-11 10:10:00 +00:00
|
|
|
void OnBrowseInFileExplorer( wxCommandEvent& event );
|
2010-07-11 16:24:44 +00:00
|
|
|
|
|
|
|
void OnFileHistory( wxCommandEvent& event );
|
2020-02-25 15:46:56 +00:00
|
|
|
void OnClearFileHistory( wxCommandEvent& aEvent );
|
2010-07-11 16:24:44 +00:00
|
|
|
void OnExit( wxCommandEvent& event );
|
2015-03-02 17:29:18 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateMenuBar() override;
|
2010-07-11 16:24:44 +00:00
|
|
|
void RecreateBaseHToolbar();
|
2019-06-10 14:23:37 +00:00
|
|
|
void RecreateLauncher();
|
2011-08-19 15:08:41 +00:00
|
|
|
|
2020-05-16 23:08:01 +00:00
|
|
|
wxString GetCurrentFileName() const override
|
|
|
|
{
|
|
|
|
return GetProjectFileName();
|
|
|
|
}
|
|
|
|
|
2017-10-03 10:23:52 +00:00
|
|
|
/**
|
2017-10-03 10:30:23 +00:00
|
|
|
* Open dialog to import Eagle schematic and board files.
|
2017-10-03 10:23:52 +00:00
|
|
|
*/
|
2017-08-24 15:56:15 +00:00
|
|
|
void OnImportEagleFiles( wxCommandEvent& event );
|
|
|
|
|
2011-08-19 15:08:41 +00:00
|
|
|
/**
|
2017-08-31 15:15:20 +00:00
|
|
|
* Displays \a aText in the text panel.
|
2011-08-19 15:08:41 +00:00
|
|
|
*
|
|
|
|
* @param aText The text to display.
|
|
|
|
*/
|
|
|
|
void PrintMsg( const wxString& aText );
|
|
|
|
|
2014-02-01 18:27:18 +00:00
|
|
|
/**
|
2020-06-03 20:13:01 +00:00
|
|
|
* Prints the current working directory name and the project name on the text panel.
|
2014-02-01 18:27:18 +00:00
|
|
|
*/
|
|
|
|
void PrintPrjInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Erase the text panel.
|
|
|
|
*/
|
2010-07-11 16:24:44 +00:00
|
|
|
void ClearMsg();
|
2014-02-01 18:27:18 +00:00
|
|
|
|
2019-06-09 13:12:44 +00:00
|
|
|
void RefreshProjectTree();
|
2010-07-11 16:24:44 +00:00
|
|
|
|
2020-02-25 15:46:56 +00:00
|
|
|
/**
|
2017-09-01 19:31:03 +00:00
|
|
|
* Creates a new project by setting up and initial project, schematic, and board files.
|
|
|
|
*
|
|
|
|
* The project file is copied from the kicad.pro template file if possible. Otherwise,
|
|
|
|
* a minimal project file is created from an empty project. A minimal schematic and
|
|
|
|
* board file are created to prevent the schematic and board editors from complaining.
|
|
|
|
* If any of these files already exist, they are not overwritten.
|
|
|
|
*
|
|
|
|
* @param aProjectFileName is the absolute path of the project file name.
|
|
|
|
*/
|
2017-08-31 15:15:20 +00:00
|
|
|
void CreateNewProject( const wxFileName& aProjectFileName );
|
|
|
|
void LoadProject( const wxFileName& aProjectFileName );
|
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
2011-08-19 15:08:41 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2019-05-17 00:29:55 +00:00
|
|
|
void ShowChangedLanguage() override;
|
2020-07-17 20:04:14 +00:00
|
|
|
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
|
2018-08-20 13:46:38 +00:00
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
/**
|
|
|
|
* Called by sending a event with id = ID_INIT_WATCHED_PATHS
|
2020-06-03 20:13:01 +00:00
|
|
|
* rebuild the list of watched paths
|
2013-01-01 14:06:49 +00:00
|
|
|
*/
|
2017-08-31 15:15:20 +00:00
|
|
|
void OnChangeWatchedPaths( wxCommandEvent& aEvent );
|
2015-07-29 18:06:45 +00:00
|
|
|
|
2019-06-10 14:35:01 +00:00
|
|
|
void SyncToolbars() override;
|
2013-01-01 14:06:49 +00:00
|
|
|
|
2019-06-12 12:43:24 +00:00
|
|
|
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
|
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
void SetProjectFileName( const wxString& aFullProjectProFileName );
|
2020-05-16 23:08:01 +00:00
|
|
|
const wxString GetProjectFileName() const;
|
2014-07-07 19:49:14 +00:00
|
|
|
|
|
|
|
// read only accessors
|
|
|
|
const wxString SchFileName();
|
2020-04-16 16:43:50 +00:00
|
|
|
const wxString SchLegacyFileName();
|
2014-07-07 19:49:14 +00:00
|
|
|
const wxString PcbFileName();
|
2014-07-09 00:52:46 +00:00
|
|
|
const wxString PcbLegacyFileName();
|
|
|
|
|
|
|
|
void ReCreateTreePrj();
|
|
|
|
|
2020-03-24 01:01:23 +00:00
|
|
|
wxWindow* GetToolCanvas() const override;
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2014-07-07 19:49:14 +00:00
|
|
|
|
|
|
|
private:
|
2020-04-12 23:09:17 +00:00
|
|
|
APP_SETTINGS_BASE* config() const override;
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
const SEARCH_STACK& sys_search() override;
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
wxString help_name() override;
|
2014-07-07 19:49:14 +00:00
|
|
|
|
|
|
|
void language_change( wxCommandEvent& event );
|
2015-08-03 20:56:37 +00:00
|
|
|
|
2019-05-17 00:29:55 +00:00
|
|
|
private:
|
2019-06-10 14:23:37 +00:00
|
|
|
TREE_PROJECT_FRAME* m_leftWin;
|
|
|
|
ACTION_TOOLBAR* m_launcher;
|
|
|
|
wxTextCtrl* m_messagesBox;
|
|
|
|
ACTION_TOOLBAR* m_mainToolBar;
|
2011-08-19 15:08:41 +00:00
|
|
|
|
2019-06-10 14:23:37 +00:00
|
|
|
int m_leftWinWidth;
|
|
|
|
bool m_active_project;
|
2007-10-31 17:47:44 +00:00
|
|
|
};
|
|
|
|
|
2019-06-10 14:23:37 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// The C++ project manager includes a single PROJECT in its link image.
|
|
|
|
class PROJECT;
|
|
|
|
extern PROJECT& Prj();
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|