2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2013-10-14 15:29:16 +00:00
|
|
|
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
2023-03-13 16:03:48 +00:00
|
|
|
* Copyright (C) 2010-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-13 19:56:32 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +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 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2011-10-13 19:56:32 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2011-10-13 19:56:32 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-10-13 19:56:32 +00:00
|
|
|
*/
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2021-03-29 13:04:41 +00:00
|
|
|
#ifndef __PCB_EDIT_FRAME_H__
|
|
|
|
#define __PCB_EDIT_FRAME_H__
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2017-08-24 15:56:15 +00:00
|
|
|
#include "pcb_base_edit_frame.h"
|
|
|
|
#include "zones.h"
|
2020-04-21 01:44:17 +00:00
|
|
|
#include <mail_type.h>
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2018-08-15 09:26:32 +00:00
|
|
|
class ACTION_PLUGIN;
|
2008-01-01 11:58:14 +00:00
|
|
|
class PCB_SCREEN;
|
|
|
|
class BOARD;
|
2016-08-17 15:24:04 +00:00
|
|
|
class BOARD_COMMIT;
|
2016-05-13 15:31:54 +00:00
|
|
|
class BOARD_ITEM_CONTAINER;
|
2023-03-13 16:03:48 +00:00
|
|
|
class DIALOG_BOOK_REPORTER;
|
2020-11-13 15:15:52 +00:00
|
|
|
class FOOTPRINT;
|
2021-06-11 21:07:02 +00:00
|
|
|
class PCB_TRACK;
|
|
|
|
class PCB_VIA;
|
2020-11-12 22:30:02 +00:00
|
|
|
class PAD;
|
2011-09-07 19:41:04 +00:00
|
|
|
class PCB_TARGET;
|
2020-09-24 01:05:46 +00:00
|
|
|
class PCB_GROUP;
|
2021-06-11 16:59:28 +00:00
|
|
|
class PCB_DIMENSION_BASE;
|
2008-01-01 11:58:14 +00:00
|
|
|
class DRC;
|
2021-08-27 17:15:51 +00:00
|
|
|
class DIALOG_FIND;
|
2018-02-22 15:25:31 +00:00
|
|
|
class DIALOG_PLOT;
|
2020-11-11 23:05:59 +00:00
|
|
|
class ZONE;
|
2009-02-04 15:25:03 +00:00
|
|
|
class GENERAL_COLLECTOR;
|
|
|
|
class GENERAL_COLLECTORS_GUIDE;
|
2020-08-13 23:09:17 +00:00
|
|
|
class SELECTION;
|
2020-11-14 18:11:28 +00:00
|
|
|
class PCB_MARKER;
|
2011-09-20 13:57:40 +00:00
|
|
|
class BOARD_ITEM;
|
2012-05-04 17:44:42 +00:00
|
|
|
class PCB_LAYER_BOX_SELECTOR;
|
2013-04-25 16:29:35 +00:00
|
|
|
class NETLIST;
|
|
|
|
class REPORTER;
|
2014-03-16 17:40:23 +00:00
|
|
|
struct PARSE_ERROR;
|
2016-09-21 02:58:20 +00:00
|
|
|
class IO_ERROR;
|
2013-05-20 14:49:20 +00:00
|
|
|
class FP_LIB_TABLE;
|
2019-04-18 02:10:56 +00:00
|
|
|
class BOARD_NETLIST_UPDATER;
|
2019-06-03 13:49:17 +00:00
|
|
|
class ACTION_MENU;
|
2021-03-29 13:04:41 +00:00
|
|
|
class TOOL_ACTION;
|
2023-10-30 06:34:45 +00:00
|
|
|
class STRING_UTF8_MAP;
|
2021-03-29 13:04:41 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
enum LAST_PATH_TYPE : unsigned int;
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2021-09-14 22:45:14 +00:00
|
|
|
namespace PCB { struct IFACE; } // KIFACE is in pcbnew.cpp
|
* 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
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* The main frame for Pcbnew.
|
2011-09-26 20:32:56 +00:00
|
|
|
*
|
2011-09-30 18:15:37 +00:00
|
|
|
* See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
|
2009-11-23 20:18:47 +00:00
|
|
|
*/
|
2014-07-09 11:50:27 +00:00
|
|
|
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
|
2008-01-01 11:58:14 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-11-25 15:50:03 +00:00
|
|
|
virtual ~PCB_EDIT_FRAME();
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2016-01-29 10:21:13 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Load the footprints for each #SCH_COMPONENT in \a aNetlist from the list of libraries.
|
2016-01-29 10:21:13 +00:00
|
|
|
*
|
|
|
|
* @param aNetlist is the netlist of components to load the footprints into.
|
|
|
|
* @param aReporter is the #REPORTER object to report to.
|
|
|
|
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
|
|
|
|
* occurs while reading footprint library files.
|
|
|
|
*/
|
2018-09-17 09:54:49 +00:00
|
|
|
void LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter );
|
2016-01-29 10:21:13 +00:00
|
|
|
|
2019-05-26 22:22:03 +00:00
|
|
|
void OnQuit( wxCommandEvent& event );
|
|
|
|
|
2019-12-19 15:34:01 +00:00
|
|
|
/**
|
|
|
|
* Get if the current board has been modified but not saved.
|
|
|
|
*
|
|
|
|
* @return true if the any changes have not been saved
|
|
|
|
*/
|
2021-05-27 23:07:48 +00:00
|
|
|
bool IsContentModified() const override;
|
2019-12-19 15:34:01 +00:00
|
|
|
|
2020-08-09 18:49:26 +00:00
|
|
|
/**
|
|
|
|
* Synchronize the environment variables from KiCad's environment into the Python interpreter.
|
|
|
|
*/
|
|
|
|
void PythonSyncEnvironmentVariables();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Synchronize the project name from KiCad's environment into the Python interpreter.
|
|
|
|
*/
|
|
|
|
void PythonSyncProjectName();
|
|
|
|
|
2017-08-27 06:04:12 +00:00
|
|
|
/**
|
|
|
|
* Update the layer manager and other widgets from the board setup
|
|
|
|
* (layer and items visibility, colors ...)
|
|
|
|
*/
|
|
|
|
void UpdateUserInterface();
|
|
|
|
|
2021-04-08 02:39:30 +00:00
|
|
|
void HardRedraw() override;
|
|
|
|
|
2022-12-26 16:23:44 +00:00
|
|
|
/**
|
|
|
|
* Rebuilds board connectivity, refreshes canvas.
|
|
|
|
*/
|
|
|
|
void RebuildAndRefresh();
|
|
|
|
|
2014-01-08 14:18:51 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER
|
|
|
|
* (currently 4242).
|
|
|
|
*
|
|
|
|
* This is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
|
|
|
|
*
|
|
|
|
* @param cmdline is the received command from socket.
|
2014-01-08 14:18:51 +00:00
|
|
|
*/
|
2019-06-03 13:49:17 +00:00
|
|
|
void ExecuteRemoteCommand( const char* cmdline ) override;
|
2014-01-08 14:18:51 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
|
2014-04-21 06:51:33 +00:00
|
|
|
|
2022-01-16 20:29:03 +00:00
|
|
|
/**
|
|
|
|
* Used to find items by selection synchronization spec string.
|
|
|
|
*/
|
|
|
|
std::vector<BOARD_ITEM*> FindItemsFromSyncSelection( std::string syncStr );
|
|
|
|
|
2022-09-14 02:59:57 +00:00
|
|
|
/**
|
|
|
|
* @return the name of the wxAuiPaneInfo managing the Search panel
|
|
|
|
*/
|
|
|
|
static const wxString SearchPaneName() { return wxT( "Search" ); }
|
|
|
|
|
2021-08-27 17:15:51 +00:00
|
|
|
/**
|
|
|
|
* Show the Find dialog.
|
|
|
|
*/
|
|
|
|
void ShowFindDialog();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find the next item using our existing search parameters.
|
|
|
|
*/
|
2023-01-26 14:36:41 +00:00
|
|
|
void FindNext( bool reverse = false );
|
2021-08-27 17:15:51 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2018-04-28 15:22:25 +00:00
|
|
|
* Open a dialog frame to create plot and drill files relative to the current board.
|
2010-01-01 13:30:39 +00:00
|
|
|
*/
|
2019-06-04 20:59:59 +00:00
|
|
|
void ToPlotter( int aID );
|
2010-01-01 13:30:39 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Show the Export to SVG file dialog.
|
2011-08-26 17:01:17 +00:00
|
|
|
*/
|
2018-06-13 12:20:29 +00:00
|
|
|
void ExportSVG( wxCommandEvent& event );
|
2010-11-17 21:47:27 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// User interface update command event handlers.
|
2011-03-01 19:26:17 +00:00
|
|
|
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
|
2020-02-04 08:40:25 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
bool LayerManagerShown();
|
2020-02-04 08:40:25 +00:00
|
|
|
bool PropertiesShown();
|
2024-03-04 23:00:26 +00:00
|
|
|
bool NetInspectorShown();
|
2020-02-04 08:40:25 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
|
2020-10-10 18:29:41 +00:00
|
|
|
void OnUpdateSelectAutoWidth( wxUpdateUIEvent& aEvent );
|
2019-07-08 23:43:08 +00:00
|
|
|
|
|
|
|
void RunEeschema();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aShowNetclass,
|
|
|
|
bool aShowEdit );
|
|
|
|
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aShowNetclass, bool aShowEdit );
|
2016-01-22 12:30:44 +00:00
|
|
|
|
2022-01-20 09:43:40 +00:00
|
|
|
/**
|
|
|
|
* Return the angle used for rotate operations.
|
|
|
|
*/
|
|
|
|
EDA_ANGLE GetRotationAngle() const override;
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-02-01 21:23:27 +00:00
|
|
|
* @return the color of the grid
|
|
|
|
*/
|
2019-06-03 13:49:17 +00:00
|
|
|
COLOR4D GetGridColor() override;
|
2010-02-01 21:23:27 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2021-07-26 17:28:37 +00:00
|
|
|
* @param[in] aColor the new color of the grid.
|
2010-02-01 21:23:27 +00:00
|
|
|
*/
|
2021-07-26 17:28:37 +00:00
|
|
|
void SetGridColor( const COLOR4D& aColor ) override;
|
2015-07-28 08:30:06 +00:00
|
|
|
|
2018-08-15 09:26:32 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Return true if button visibility action plugin setting was set to true
|
2018-08-15 09:26:32 +00:00
|
|
|
* or it is unset and plugin defaults to true.
|
|
|
|
*/
|
2021-08-29 23:33:08 +00:00
|
|
|
static bool GetActionPluginButtonVisible( const wxString& aPluginPath, bool aPluginDefault );
|
2018-08-15 09:26:32 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Return ordered list of plugins in sequence in which they should appear on toolbar or
|
|
|
|
* in settings
|
2018-08-15 09:26:32 +00:00
|
|
|
*/
|
2021-08-29 23:33:08 +00:00
|
|
|
static std::vector<ACTION_PLUGIN*> GetOrderedActionPlugins();
|
2018-08-15 09:26:32 +00:00
|
|
|
|
2023-03-04 19:25:07 +00:00
|
|
|
void SaveProjectLocalSettings() override;
|
2010-04-23 14:46:00 +00:00
|
|
|
|
|
|
|
/**
|
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
|
|
|
* Load the current project's file configuration settings which are pertinent
|
|
|
|
* to this PCB_EDIT_FRAME instance.
|
2010-04-23 14:46:00 +00:00
|
|
|
*
|
|
|
|
* @return always returns true.
|
|
|
|
*/
|
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
|
|
|
bool LoadProjectSettings();
|
2010-04-23 14:46:00 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
2010-04-23 14:46:00 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
2015-07-02 14:09:51 +00:00
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
/**
|
2019-08-03 03:03:03 +00:00
|
|
|
* Get the last path for a particular type.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
|
|
|
* @return the absolute path and file name of the last file successfully read.
|
2009-10-21 19:16:25 +00:00
|
|
|
*/
|
2019-08-03 03:03:03 +00:00
|
|
|
wxString GetLastPath( LAST_PATH_TYPE aType );
|
2010-04-23 14:46:00 +00:00
|
|
|
|
|
|
|
/**
|
2019-08-03 03:03:03 +00:00
|
|
|
* Set the path of the last file successfully read.
|
2010-04-23 14:46:00 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @note the file path is converted to a path relative to the project file path. If
|
2010-04-23 14:46:00 +00:00
|
|
|
* the path cannot be made relative, than m_lastNetListRead is set to and empty
|
|
|
|
* string. This could happen when the net list file is on a different drive than
|
|
|
|
* the project file. The advantage of relative paths is that is more likely to
|
|
|
|
* work when opening the same project from both Windows and Linux.
|
|
|
|
*
|
2019-08-03 03:03:03 +00:00
|
|
|
* @param aLastPath - The last file with full path successfully read.
|
2010-04-23 14:46:00 +00:00
|
|
|
*/
|
2019-08-03 03:03:03 +00:00
|
|
|
void SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath );
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
/**
|
2023-04-15 09:54:53 +00:00
|
|
|
* If aCreateMarkers then create DRC exclusion markers from the serialized data. If false,
|
|
|
|
* then use the serialized data to set exclusion flags on existing markers.
|
2020-02-28 00:05:40 +00:00
|
|
|
*/
|
2023-04-15 09:54:53 +00:00
|
|
|
void ResolveDRCExclusions( bool aCreateMarkers );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
|
|
|
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
|
2009-01-15 08:12:03 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateHToolbar() override;
|
|
|
|
void ReCreateAuxiliaryToolbar() override;
|
|
|
|
void ReCreateVToolbar() override;
|
2018-02-03 22:55:13 +00:00
|
|
|
void ReCreateOptToolbar() override;
|
2021-03-27 21:49:38 +00:00
|
|
|
void UpdateToolbarControlSizes() override;
|
2013-09-02 15:26:52 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Recreate the layer box by clearing the old list and building a new one from the new
|
|
|
|
* layer names and colors.
|
|
|
|
*
|
|
|
|
* @param aForceResizeToolbar true to resize the parent toolbar false if not needed (mainly
|
|
|
|
* in parent toolbar creation, or when the layers names are not
|
|
|
|
* modified)
|
2013-09-02 15:26:52 +00:00
|
|
|
*/
|
|
|
|
void ReCreateLayerBox( bool aForceResizeToolbar = true );
|
2008-04-29 13:35:26 +00:00
|
|
|
|
2014-09-28 14:44:47 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Must be called after a board change to set the modified flag.
|
|
|
|
*
|
|
|
|
* Reload the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
|
2011-08-26 17:01:17 +00:00
|
|
|
* to update auxiliary information.
|
2010-05-01 12:46:33 +00:00
|
|
|
*/
|
2019-06-03 13:49:17 +00:00
|
|
|
void OnModify() override;
|
2010-05-01 12:46:33 +00:00
|
|
|
|
2014-03-21 10:17:47 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Change the currently active layer to \a aLayer and also update the #APPEARANCE_CONTROLS.
|
2014-03-21 10:17:47 +00:00
|
|
|
*/
|
2019-06-03 13:49:17 +00:00
|
|
|
void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
|
2014-03-21 10:17:47 +00:00
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
void OnDisplayOptionsChanged() override;
|
|
|
|
|
2010-01-21 20:53:01 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Test whether a given element category is visible. Keep this as an inline function.
|
|
|
|
*
|
2011-09-20 13:57:40 +00:00
|
|
|
* @param aElement is from the enum by the same name
|
2010-01-30 20:17:56 +00:00
|
|
|
* @return bool - true if the element is visible.
|
2017-03-13 03:19:33 +00:00
|
|
|
* @see enum GAL_LAYER_ID
|
2010-01-30 20:17:56 +00:00
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
bool IsElementVisible( GAL_LAYER_ID aElement ) const;
|
2010-01-30 20:17:56 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Change the visibility of an element category.
|
|
|
|
*
|
|
|
|
* @param aElement is from the enum by the same name.
|
|
|
|
* @param aNewState The new visibility state of the element category.
|
|
|
|
* @see enum PCB_LAYER_ID.
|
2010-01-30 20:17:56 +00:00
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
|
2010-01-30 20:17:56 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
2019-05-30 12:25:08 +00:00
|
|
|
void ActivateGalCanvas() override;
|
2013-11-25 15:50:03 +00:00
|
|
|
|
2020-10-16 11:20:37 +00:00
|
|
|
void ShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString );
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2019-07-28 22:39:24 +00:00
|
|
|
void PrepareLayerIndicator( bool aForceRebuild = false );
|
2009-09-27 11:00:21 +00:00
|
|
|
|
2019-06-04 21:29:51 +00:00
|
|
|
void ToggleLayersManager();
|
2024-03-04 23:00:26 +00:00
|
|
|
|
|
|
|
void ToggleNetInspector();
|
|
|
|
|
2022-09-14 02:59:57 +00:00
|
|
|
void ToggleSearch();
|
2012-02-15 10:41:16 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create an ASCII footprint position file.
|
|
|
|
*
|
|
|
|
* @param aFullFileName the full file name of the file to create.
|
|
|
|
* @param aUnitsMM false to use inches, true to use mm in coordinates.
|
2021-07-20 08:23:21 +00:00
|
|
|
* @param aOnlySMD true to force only footprints flagged smd to be in the list
|
|
|
|
* @param aNoTHItems true to include only footprints with no TH pads no matter
|
|
|
|
* the footprint flag
|
2023-08-04 18:02:10 +00:00
|
|
|
* @param aExcludeDNP true to exclude footprints flagged DNP
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aTopSide true to list footprints on front (top) side.
|
|
|
|
* @param aBottomSide true to list footprints on back (bottom) side, if \a aTopSide and
|
|
|
|
* \a aTopSide are true, list footprints on both sides.
|
|
|
|
* @param aFormatCSV true to use a comma separated file (CSV) format; default = false
|
2021-07-20 08:23:21 +00:00
|
|
|
* @param aUseAuxOrigin true to use auxiliary axis as an origin for the position data
|
2022-08-02 09:22:12 +00:00
|
|
|
* @param aNegateBottomX true to negate X coordinates for bottom side of the placement file
|
2021-01-27 22:15:38 +00:00
|
|
|
* @return the number of footprints found on aSide side or -1 if the file could not be created.
|
2012-02-15 10:41:16 +00:00
|
|
|
*/
|
2021-07-20 08:23:21 +00:00
|
|
|
int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM, bool aOnlySMD,
|
2023-08-04 18:02:10 +00:00
|
|
|
bool aNoTHItems, bool aExcludeDNP, bool aTopSide, bool aBottomSide,
|
2022-08-02 09:22:12 +00:00
|
|
|
bool aFormatCSV, bool aUseAuxOrigin, bool aNegateBottomX );
|
2012-02-15 10:41:16 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Call #DoGenFootprintsReport to create a footprint report file
|
2012-02-15 10:41:16 +00:00
|
|
|
*/
|
|
|
|
void GenFootprintsReport( wxCommandEvent& event );
|
|
|
|
|
2023-06-12 18:12:39 +00:00
|
|
|
/**
|
|
|
|
* Create and IPC2581 output file
|
|
|
|
*/
|
|
|
|
void GenIPC2581File( wxCommandEvent& event );
|
|
|
|
|
2012-02-15 10:41:16 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create an ASCII footprint report file giving some infos on footprints and board outlines.
|
|
|
|
*
|
|
|
|
* @param aFullFilename the full file name of the file to create
|
|
|
|
* @param aUnitsMM false to use inches, true to use mm in coordinates
|
2012-02-15 10:41:16 +00:00
|
|
|
* @return true if OK, false if error
|
|
|
|
*/
|
|
|
|
bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
|
|
|
|
|
2013-09-13 09:49:55 +00:00
|
|
|
void GenD356File( wxCommandEvent& event );
|
2009-01-15 08:12:03 +00:00
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
void OnFileHistory( wxCommandEvent& event );
|
2020-02-25 15:46:56 +00:00
|
|
|
void OnClearFileHistory( wxCommandEvent& aEvent );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Call #Files_io_from_id with the wxCommandEvent id.
|
|
|
|
*
|
2015-03-17 07:34:02 +00:00
|
|
|
* @param event is the command event handler.
|
2011-08-26 17:01:17 +00:00
|
|
|
*/
|
2009-11-23 20:18:47 +00:00
|
|
|
void Files_io( wxCommandEvent& event );
|
2010-05-17 20:35:46 +00:00
|
|
|
|
2015-03-17 07:34:02 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Read and write board files according to \a aId.
|
|
|
|
*
|
|
|
|
* Valid event IDs are:
|
|
|
|
* - ID_LOAD_FILE
|
|
|
|
* - ID_MENU_RECOVER_BOARD_AUTOSAVE
|
|
|
|
* - ID_NEW_BOARD
|
|
|
|
* - ID_SAVE_BOARD
|
|
|
|
* - ID_COPY_BOARD_AS
|
|
|
|
* - ID_SAVE_BOARD_AS
|
|
|
|
*
|
|
|
|
* @param aId is an event ID coming from file command events:
|
2015-03-17 07:34:02 +00:00
|
|
|
*/
|
2018-08-11 20:46:03 +00:00
|
|
|
bool Files_io_from_id( int aId );
|
2015-03-17 07:34:02 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Load a KiCad board (.kicad_pcb) from \a aFileName.
|
2010-05-17 20:35:46 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aFileSet hold the BOARD file to load, a vector of one element.
|
|
|
|
* @param aCtl KICTL_ bits, one to indicate that an append of the board file
|
|
|
|
* \a aFileName to the currently loaded file is desired.
|
|
|
|
* @see #KIWAY_PLAYER for bit defines.
|
* 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
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @return false if file load fails, otherwise true.
|
2010-05-30 09:46:37 +00:00
|
|
|
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
|
2010-05-17 20:35:46 +00:00
|
|
|
bool aForceFileDialog = false );
|
* 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
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
|
2010-01-21 07:41:30 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/**
|
2021-03-29 13:04:41 +00:00
|
|
|
* Write the board data structures to \a a aFileName.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
|
|
|
* Create a backup when requested and update flags (modified and saved flags).
|
2011-08-26 17:01:17 +00:00
|
|
|
*
|
|
|
|
* @param aFileName The file name to write or wxEmptyString to prompt user for
|
|
|
|
* file name.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param addToHistory controls whether or not to add the saved file to the recent file list
|
2020-07-05 15:02:48 +00:00
|
|
|
* @param aChangeProject is true if the project should be changed to the new board filename
|
2011-08-26 17:01:17 +00:00
|
|
|
* @return True if file was saved successfully.
|
|
|
|
*/
|
2020-07-05 15:02:48 +00:00
|
|
|
bool SavePcbFile( const wxString& aFileName, bool addToHistory = true,
|
|
|
|
bool aChangeProject = true );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2015-02-14 12:43:11 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Write the board data structures to \a aFileName.
|
2015-02-14 12:43:11 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* Unlike SavePcbFile, does not make anything else (no backup, broad filename change, no
|
|
|
|
* flag changes ...). Used under a project mgr to save under a new name the current board.
|
2015-02-14 12:43:11 +00:00
|
|
|
* When not under a project mgr, the full SavePcbFile is used.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2015-02-14 12:43:11 +00:00
|
|
|
* @param aFileName The file name to write.
|
2020-09-22 00:00:51 +00:00
|
|
|
* @param aCreateProject will create an empty project alongside the board file
|
2015-02-14 12:43:11 +00:00
|
|
|
* @return True if file was saved successfully.
|
|
|
|
*/
|
2020-09-22 00:00:51 +00:00
|
|
|
bool SavePcbCopy( const wxString& aFileName, bool aCreateProject = false );
|
2009-03-30 15:36:41 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Delete all and reinitialize the current board.
|
|
|
|
*
|
2023-06-05 09:32:11 +00:00
|
|
|
* @param doAskAboutUnsavedChanges true to prompt user if existing board contains unsaved
|
|
|
|
* changes, false to re-initialize silently.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aFinal if true, we are clearing the board to exit, so don't run more events.
|
2009-08-06 15:42:09 +00:00
|
|
|
*/
|
2023-06-05 09:32:11 +00:00
|
|
|
bool Clear_Pcb( bool doAskAboutUnsavedChanges, bool aFinal = false );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc PCB_BASE_FRAME::SetBoard()
|
2021-11-25 16:19:03 +00:00
|
|
|
void SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr ) override
|
2021-11-25 03:04:16 +00:00
|
|
|
{
|
2021-11-25 16:19:03 +00:00
|
|
|
SetBoard( aBoard, true, aReporter );
|
2021-11-25 03:04:16 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 16:19:03 +00:00
|
|
|
void SetBoard( BOARD* aBoard, bool aBuildConnectivity, PROGRESS_REPORTER* aReporter = nullptr );
|
2013-11-25 15:50:03 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc PCB_BASE_FRAME::GetModel()
|
2016-05-13 15:31:54 +00:00
|
|
|
BOARD_ITEM_CONTAINER* GetModel() const override;
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc PCB_BASE_FRAME::SetPageSettings()
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
|
2014-09-08 12:06:38 +00:00
|
|
|
|
2009-03-30 15:36:41 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Recreates a .cmp file from the current loaded board.
|
|
|
|
*
|
|
|
|
* This is the same as created by CvPcb and can be used if this file is lost.
|
2009-03-30 15:36:41 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );
|
2009-03-30 15:36:41 +00:00
|
|
|
|
2012-01-06 19:00:59 +00:00
|
|
|
/**
|
2020-10-21 03:48:06 +00:00
|
|
|
* Save footprints in a library:
|
2017-08-26 12:04:56 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aStoreInNewLib true to save footprints in a existing library. Existing footprints
|
|
|
|
* will be kept or updated. This library should be in fp lib table,
|
|
|
|
* and is type is .pretty. False to save footprints in a new library.
|
|
|
|
* If it is an existing lib, previous footprints will be removed.
|
|
|
|
*
|
|
|
|
* @param aLibName optional library name to create, stops dialog call. Must be called with
|
|
|
|
* \a aStoreInNewLib as true.
|
2015-09-28 08:46:00 +00:00
|
|
|
*/
|
2020-11-09 16:45:36 +00:00
|
|
|
void ExportFootprintsToLibrary( bool aStoreInNewLib, const wxString& aLibName = wxEmptyString,
|
2021-07-19 23:56:05 +00:00
|
|
|
wxString* aLibPath = nullptr );
|
2012-01-06 19:00:59 +00:00
|
|
|
|
2009-03-30 15:36:41 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a BOM file from the current loaded board.
|
2009-03-30 15:36:41 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void RecreateBOMFileFromBoard( wxCommandEvent& aEvent );
|
2009-01-15 08:12:03 +00:00
|
|
|
|
2011-11-10 15:55:05 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a file in GenCAD 1.4 format from the current board.
|
2011-11-10 15:55:05 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void ExportToGenCAD( wxCommandEvent& event );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2010-04-19 06:21:56 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Export the current BOARD to a VRML file.
|
2010-04-19 06:21:56 +00:00
|
|
|
*/
|
|
|
|
void OnExportVRML( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
2021-03-29 13:04:41 +00:00
|
|
|
* Create the file(s) exporting current BOARD to a VRML file.
|
2013-03-28 16:51:22 +00:00
|
|
|
*
|
|
|
|
* @note When copying 3D shapes files, the new filename is build from the full path
|
|
|
|
* name, changing the separators by underscore. This is needed because files
|
|
|
|
* with the same shortname can exist in different directories
|
|
|
|
* @note ExportVRML_File generates coordinates in board units (BIU) inside the file.
|
|
|
|
* @todo Use mm inside the file. A general scale transform is applied to the whole
|
|
|
|
* file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML
|
|
|
|
* unit in meters.
|
2014-12-20 16:13:51 +00:00
|
|
|
* @note For 3D models built by a 3D modeler, the unit is 0,1 inches. A specific scale
|
2013-03-28 16:51:22 +00:00
|
|
|
* is applied to 3D models to convert them to internal units.
|
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aFullFileName the full filename of the file to create
|
|
|
|
* @param aMMtoWRMLunit the VRML scaling factor: 1.0 to export in mm. 0.001 for meters
|
|
|
|
* @param aExport3DFiles true to copy 3D shapes in the subir a3D_Subdir
|
2014-10-17 23:28:12 +00:00
|
|
|
* @param aUseRelativePaths set to true to use relative paths instead of absolute paths
|
|
|
|
* in the board VRML file URLs.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param a3D_Subdir sub directory where 3D shapes files are copied. This is only used
|
|
|
|
* when aExport3DFiles == true.
|
|
|
|
* @param aXRef X value of PCB (0,0) reference point.
|
|
|
|
* @param aYRef Y value of PCB (0,0) reference point.
|
2010-04-19 06:21:56 +00:00
|
|
|
* @return true if Ok.
|
|
|
|
*/
|
2021-01-27 22:15:38 +00:00
|
|
|
bool ExportVRML_File( const wxString& aFullFileName, double aMMtoWRMLunit,
|
2024-03-04 15:05:53 +00:00
|
|
|
bool aIncludeUnspecified, bool aIncludeDNP,
|
2021-03-18 18:53:36 +00:00
|
|
|
bool aExport3DFiles, bool aUseRelativePaths,
|
2021-01-27 22:15:38 +00:00
|
|
|
const wxString& a3D_Subdir, double aXRef, double aYRef );
|
2010-04-19 06:21:56 +00:00
|
|
|
|
2014-01-02 09:26:03 +00:00
|
|
|
/**
|
2021-03-29 13:04:41 +00:00
|
|
|
* Export the current BOARD to a IDFv3 board and lib files.
|
2014-01-02 09:26:03 +00:00
|
|
|
*/
|
2016-07-19 17:35:25 +00:00
|
|
|
void OnExportIDF3( wxCommandEvent& event );
|
|
|
|
|
2019-04-08 00:09:07 +00:00
|
|
|
/**
|
2021-03-29 13:04:41 +00:00
|
|
|
* Export the current BOARD to a Hyperlynx HYP file.
|
2019-04-08 00:09:07 +00:00
|
|
|
*/
|
|
|
|
void OnExportHyperlynx( wxCommandEvent& event );
|
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
/**
|
2021-03-29 13:04:41 +00:00
|
|
|
* Create an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file.
|
2016-07-19 17:35:25 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aPcb a pointer to the board to be exported to IDF.
|
|
|
|
* @param aFullFileName the full filename of the export file.
|
|
|
|
* @param aUseThou set to true if the desired IDF unit is thou (mil).
|
|
|
|
* @param aXRef the board Reference Point in mm, X value.
|
|
|
|
* @param aYRef the board Reference Point in mm, Y value.
|
|
|
|
* @return true if OK.
|
2016-07-19 17:35:25 +00:00
|
|
|
*/
|
|
|
|
bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
|
|
|
|
bool aUseThou, double aXRef, double aYRef );
|
2014-01-02 09:26:03 +00:00
|
|
|
|
2016-09-19 07:40:36 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Export the current BOARD to a STEP assembly.
|
2016-09-19 07:40:36 +00:00
|
|
|
*/
|
|
|
|
void OnExportSTEP( wxCommandEvent& event );
|
|
|
|
|
2014-03-27 17:45:05 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Export the current BOARD to a specctra dsn file.
|
|
|
|
*
|
|
|
|
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the specification.
|
|
|
|
*
|
2014-03-27 17:45:05 +00:00
|
|
|
* @return true if OK
|
2008-01-21 22:16:45 +00:00
|
|
|
*/
|
2014-03-27 17:45:05 +00:00
|
|
|
bool ExportSpecctraFile( const wxString& aFullFilename );
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2019-04-15 22:54:47 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and
|
|
|
|
* tracks in an existing and loaded #BOARD.
|
|
|
|
*
|
|
|
|
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the specification.
|
2019-04-15 22:54:47 +00:00
|
|
|
*/
|
|
|
|
bool ImportSpecctraSession( const wxString& aFullFilename );
|
|
|
|
|
2018-06-22 13:05:11 +00:00
|
|
|
// Footprint editing (see also PCB_BASE_FRAME)
|
2020-11-13 15:15:52 +00:00
|
|
|
void ShowFootprintPropertiesDialog( FOOTPRINT* aFootprint );
|
2012-09-11 07:33:17 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
int ShowExchangeFootprintsDialog( FOOTPRINT* aFootprint, bool aUpdateMode, bool aSelectedMode );
|
2009-08-06 07:11:04 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Replace \a aExisting footprint by \a aNew footprint using the \a Existing footprint
|
|
|
|
* settings (position, orientation, pad netnames ...).
|
|
|
|
*
|
|
|
|
* The \a aExisting footprint is deleted or put in undo list.
|
|
|
|
*
|
|
|
|
* @param aExisting footprint to replace.
|
|
|
|
* @param aNew footprint to put.
|
|
|
|
* @param aCommit commit that should store the changes.
|
2009-08-06 07:11:04 +00:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit,
|
2020-10-14 23:37:26 +00:00
|
|
|
bool deleteExtraTexts = true, bool resetTextLayers = true,
|
|
|
|
bool resetTextEffects = true, bool resetFabricationAttrs = true,
|
2021-12-25 17:32:04 +00:00
|
|
|
bool reset3DModels = true, bool* aUpdated = nullptr );
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Install the corresponding dialog editor for the given item.
|
|
|
|
*
|
|
|
|
* @param aDC the current device context.
|
|
|
|
* @param aItem a pointer to the BOARD_ITEM to edit.
|
2010-08-10 18:34:26 +00:00
|
|
|
*/
|
2019-05-28 23:23:58 +00:00
|
|
|
void OnEditItemRequest( BOARD_ITEM* aItem ) override;
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2021-12-09 18:14:11 +00:00
|
|
|
/**
|
|
|
|
* Change the active layer in the editor
|
|
|
|
*
|
|
|
|
* @param layer New layer to make active
|
|
|
|
*/
|
|
|
|
void SwitchLayer( PCB_LAYER_ID layer ) override;
|
2011-09-15 17:58:35 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Modify one track segment width or one via diameter (using DRC control).
|
|
|
|
*
|
|
|
|
* Basic routine used by other routines when editing tracks or vias.
|
|
|
|
* Note that casting this to boolean will allow you to determine whether any action
|
|
|
|
* happened.
|
|
|
|
*
|
2023-10-21 18:10:38 +00:00
|
|
|
* @param aItem the track segment or via to modify.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aItemsListPicker the list picker to use for an undo command (can be NULL).
|
2023-10-21 18:10:38 +00:00
|
|
|
* @param aUseDesignRules true to use design rules value, false to use current designSettings
|
|
|
|
* value.
|
2009-08-08 06:07:08 +00:00
|
|
|
*/
|
2023-10-21 18:10:38 +00:00
|
|
|
void SetTrackSegmentWidth( PCB_TRACK* aItem, PICKED_ITEMS_LIST* aItemsListPicker,
|
2023-10-21 17:19:17 +00:00
|
|
|
bool aUseDesignRules );
|
2009-08-08 06:07:08 +00:00
|
|
|
|
|
|
|
|
2008-01-05 13:37:51 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Edit params (layer, clearance, ...) for a zone outline.
|
2008-01-05 13:37:51 +00:00
|
|
|
*/
|
2020-11-11 23:05:59 +00:00
|
|
|
void Edit_Zone_Params( ZONE* zone_container );
|
2008-01-05 13:37:51 +00:00
|
|
|
|
2019-05-30 09:16:05 +00:00
|
|
|
// Properties dialogs
|
2019-05-28 23:23:58 +00:00
|
|
|
void ShowTargetOptionsDialog( PCB_TARGET* aTarget );
|
|
|
|
void InstallNetlistFrame();
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2019-03-27 22:37:26 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aNetlist a #NETLIST owned by the caller. This function fills it in.
|
2021-01-30 16:30:35 +00:00
|
|
|
* @param aAnnotateMessage a message to be shown if annotation must be performed. If empty,
|
|
|
|
* annotation will be skipped.
|
2019-03-27 22:37:26 +00:00
|
|
|
* @return true if a netlist was fetched.
|
|
|
|
*/
|
2021-01-30 16:30:35 +00:00
|
|
|
bool FetchNetlistFromSchematic( NETLIST& aNetlist, const wxString& aAnnotateMessage );
|
2019-03-27 22:37:26 +00:00
|
|
|
|
2020-08-09 16:13:17 +00:00
|
|
|
/**
|
|
|
|
* Test if standalone mode.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2022-07-24 17:42:50 +00:00
|
|
|
* @return 0 if in standalone, -1 if Eeschema cannot be opened,
|
|
|
|
* -2 if the schematic cannot be opened and 1 if OK.
|
|
|
|
* If OK, opens Eeschema, and opens the schematic for this project
|
2020-08-09 16:13:17 +00:00
|
|
|
*/
|
2023-10-21 18:10:38 +00:00
|
|
|
int TestStandalone();
|
2020-04-21 01:44:17 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Read a netlist from a file into a #NETLIST object.
|
2013-04-25 16:29:35 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aFilename is the netlist to load.
|
|
|
|
* @param aNetlist is the object to populate with data.
|
|
|
|
* @param aReporter is a #REPORTER object to display messages.
|
|
|
|
* @return true if the netlist was read successfully.
|
2019-04-18 02:10:56 +00:00
|
|
|
*/
|
2021-07-27 12:22:27 +00:00
|
|
|
bool ReadNetlistFromFile( const wxString& aFilename, NETLIST& aNetlist, REPORTER& aReporter );
|
2019-04-18 02:10:56 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Called after netlist is updated.
|
|
|
|
*
|
|
|
|
* @param aUpdater is the updater object that was run.
|
|
|
|
* @param aRunDragCommand is set to true if the drag command was invoked by this call.
|
2019-04-18 02:10:56 +00:00
|
|
|
*/
|
|
|
|
void OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aRunDragCommand );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2022-07-19 15:00:35 +00:00
|
|
|
/**
|
|
|
|
* Send a message to the schematic editor to try to find schematic counterparts
|
|
|
|
* of specified PCB items and select them.
|
|
|
|
*
|
|
|
|
* @param aItems are the items to try to select on schematic.
|
|
|
|
* @param aFocusItem set to item to select and focus on even if selection can't be
|
|
|
|
* represented in Schematic editor fully.
|
2022-09-14 02:59:57 +00:00
|
|
|
* @param aForce select elements in Schematic editor whether or not the user has
|
2022-07-19 15:00:35 +00:00
|
|
|
* the select option chosen.
|
|
|
|
*/
|
|
|
|
void SendSelectItemsToSch( const std::deque<EDA_ITEM*>& aItems, EDA_ITEM* aFocusItem,
|
|
|
|
bool aForce );
|
|
|
|
|
2008-01-01 11:58:14 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Send a message to the schematic editor so that it may move its cursor
|
2022-07-19 15:00:35 +00:00
|
|
|
* to an item with the same reference as the \a aSyncItem and highlight it.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2022-07-19 15:00:35 +00:00
|
|
|
* @param aSyncItem The object whose reference is used to highlight in Eeschema.
|
2008-01-01 11:58:14 +00:00
|
|
|
*/
|
2022-07-19 15:00:35 +00:00
|
|
|
void SendCrossProbeItem( BOARD_ITEM* aSyncItem );
|
2008-01-01 11:58:14 +00:00
|
|
|
|
2018-01-06 20:50:49 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Send a net name to Eeschema for highlighting.
|
2018-01-06 20:50:49 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aNetName is the name of a net, or empty string to clear highlight.
|
2018-01-06 20:50:49 +00:00
|
|
|
*/
|
|
|
|
void SendCrossProbeNetName( const wxString& aNetName );
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void ShowChangedLanguage() override;
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Set the main window title bar text.
|
|
|
|
*
|
2011-08-26 17:01:17 +00:00
|
|
|
* If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
|
|
|
|
* application name appended with no file. Otherwise, the title is set to the full path
|
|
|
|
* and file name and read only is appended to the title if the user does not have write
|
|
|
|
* access to the file.
|
|
|
|
*/
|
|
|
|
void UpdateTitle();
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
/**
|
|
|
|
* Called after the preferences dialog is run.
|
|
|
|
*/
|
2020-07-17 20:04:14 +00:00
|
|
|
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2021-03-22 04:50:42 +00:00
|
|
|
/**
|
|
|
|
* Called when light/dark theme is changed.
|
|
|
|
*/
|
|
|
|
void ThemeChanged() override;
|
|
|
|
|
2020-08-09 18:49:26 +00:00
|
|
|
void ProjectChanged() override;
|
|
|
|
|
2020-05-16 23:08:01 +00:00
|
|
|
wxString GetCurrentFileName() const override;
|
|
|
|
|
2020-08-13 23:09:17 +00:00
|
|
|
SELECTION& GetCurrentSelection() override;
|
|
|
|
|
2021-03-29 13:04:41 +00:00
|
|
|
TOOL_ACTION* GetExportNetlistAction() { return m_exportNetlistAction; }
|
|
|
|
|
2023-03-13 16:03:48 +00:00
|
|
|
DIALOG_BOOK_REPORTER* GetInspectDrcErrorDialog();
|
|
|
|
|
|
|
|
DIALOG_BOOK_REPORTER* GetInspectConstraintsDialog();
|
|
|
|
|
|
|
|
DIALOG_BOOK_REPORTER* GetInspectClearanceDialog();
|
|
|
|
|
|
|
|
DIALOG_BOOK_REPORTER* GetFootprintDiffDialog();
|
|
|
|
|
2008-01-01 11:58:14 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2021-03-29 13:04:41 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Store the previous layer toolbar icon state information
|
|
|
|
*/
|
|
|
|
struct LAYER_TOOLBAR_ICON_VALUES
|
|
|
|
{
|
|
|
|
int previous_requested_scale;
|
|
|
|
COLOR4D previous_Route_Layer_TOP_color;
|
|
|
|
COLOR4D previous_Route_Layer_BOTTOM_color;
|
|
|
|
COLOR4D previous_background_color;
|
|
|
|
|
|
|
|
LAYER_TOOLBAR_ICON_VALUES()
|
|
|
|
: previous_requested_scale( 0 ),
|
|
|
|
previous_Route_Layer_TOP_color( COLOR4D::UNSPECIFIED ),
|
|
|
|
previous_Route_Layer_BOTTOM_color( COLOR4D::UNSPECIFIED ),
|
|
|
|
previous_background_color( COLOR4D::UNSPECIFIED )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
LAYER_TOOLBAR_ICON_VALUES m_prevIconVal;
|
|
|
|
|
2022-12-16 21:37:32 +00:00
|
|
|
void doReCreateMenuBar() override;
|
|
|
|
|
2021-03-29 13:04:41 +00:00
|
|
|
// The Tool Framework initialization
|
|
|
|
void setupTools();
|
|
|
|
void setupUIConditions() override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Switch currently used canvas (Cairo / OpenGL).
|
|
|
|
*
|
|
|
|
* It also reinit the layers manager that slightly changes with canvases
|
|
|
|
*/
|
|
|
|
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill action menu with all registered action plugins
|
|
|
|
*/
|
|
|
|
void buildActionPluginMenus( ACTION_MENU* aActionMenu );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Append action plugin buttons to main toolbar
|
|
|
|
*/
|
|
|
|
void AddActionPluginTools();
|
|
|
|
|
2021-06-25 07:52:23 +00:00
|
|
|
/**
|
|
|
|
* Execute action plugin's Run() method and updates undo buffer.
|
2021-03-29 13:04:41 +00:00
|
|
|
*
|
2021-06-25 07:52:23 +00:00
|
|
|
* @param aActionPlugin action plugin
|
|
|
|
*/
|
|
|
|
void RunActionPlugin( ACTION_PLUGIN* aActionPlugin );
|
2021-03-29 13:04:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Launched by the menu when an action is called.
|
|
|
|
*
|
|
|
|
* @param aEvent sent by wx
|
|
|
|
*/
|
|
|
|
void OnActionPluginMenu( wxCommandEvent& aEvent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Launched by the button when an action is called.
|
|
|
|
*
|
|
|
|
* @param aEvent sent by wx
|
|
|
|
*/
|
|
|
|
void OnActionPluginButton( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the state of the GUI after a new board is loaded or created.
|
|
|
|
*/
|
|
|
|
void onBoardLoaded();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform auto save when the board has been modified and not saved within the
|
|
|
|
* auto save interval.
|
|
|
|
*
|
|
|
|
* @return true if the auto save was successful.
|
|
|
|
*/
|
|
|
|
bool doAutoSave() override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the given filename but sets the path to the current project path.
|
|
|
|
*
|
|
|
|
* @param full file path of file to be imported.
|
|
|
|
* @param aFileType PCB_FILE_T value for file type
|
|
|
|
*/
|
2023-10-30 06:34:45 +00:00
|
|
|
bool importFile( const wxString& aFileName, int aFileType,
|
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2021-03-29 13:04:41 +00:00
|
|
|
|
|
|
|
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
|
|
|
void doCloseWindow() override;
|
|
|
|
|
|
|
|
// protected so that PCB::IFACE::CreateWindow() is the only factory.
|
|
|
|
PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
|
|
|
|
|
|
|
void onSize( wxSizeEvent& aEvent );
|
|
|
|
|
2024-03-14 13:43:30 +00:00
|
|
|
int inferLegacyEdgeClearance( BOARD* aBoard, bool aShowUserMsg = true );
|
2021-03-29 13:04:41 +00:00
|
|
|
|
2021-10-24 10:14:54 +00:00
|
|
|
void redrawNetnames( wxTimerEvent& aEvent );
|
|
|
|
|
2023-03-04 19:25:07 +00:00
|
|
|
void saveProjectSettings() override;
|
|
|
|
|
2023-03-13 16:03:48 +00:00
|
|
|
void onCloseModelessBookReporterDialogs( wxCommandEvent& aEvent );
|
|
|
|
|
2021-03-29 13:04:41 +00:00
|
|
|
public:
|
2023-03-13 16:03:48 +00:00
|
|
|
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
|
2021-03-29 13:04:41 +00:00
|
|
|
|
2023-04-09 21:59:01 +00:00
|
|
|
wxChoice* m_SelTrackWidthBox; // a choice box to display and select current track width
|
|
|
|
wxChoice* m_SelViaSizeBox; // a choice box to display and select current via diameter
|
2021-03-29 13:04:41 +00:00
|
|
|
|
|
|
|
bool m_show_layer_manager_tools;
|
2022-09-14 02:59:57 +00:00
|
|
|
bool m_show_search;
|
2024-03-04 23:00:26 +00:00
|
|
|
bool m_show_net_inspector;
|
2021-03-29 13:04:41 +00:00
|
|
|
|
2023-03-13 16:03:48 +00:00
|
|
|
bool m_ZoneFillsDirty; // Board has been modified since last zone fill.
|
2021-03-29 13:04:41 +00:00
|
|
|
|
2023-03-13 16:03:48 +00:00
|
|
|
bool m_probingSchToPcb; // Recursion guard when synchronizing selection from schematic
|
2022-01-16 20:29:03 +00:00
|
|
|
|
2021-03-29 13:04:41 +00:00
|
|
|
private:
|
|
|
|
friend struct PCB::IFACE;
|
|
|
|
friend class APPEARANCE_CONTROLS;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The export board netlist tool action object.
|
|
|
|
*
|
|
|
|
* This is created at runtime rather than declared statically so it doesn't show up in
|
|
|
|
* the list of assignable hot keys since it's only available as an advanced configuration
|
|
|
|
* option.
|
|
|
|
*/
|
|
|
|
TOOL_ACTION* m_exportNetlistAction;
|
2021-08-27 17:15:51 +00:00
|
|
|
|
|
|
|
DIALOG_FIND* m_findDialog;
|
2023-03-13 16:03:48 +00:00
|
|
|
DIALOG_BOOK_REPORTER* m_inspectDrcErrorDlg;
|
|
|
|
DIALOG_BOOK_REPORTER* m_inspectClearanceDlg;
|
|
|
|
DIALOG_BOOK_REPORTER* m_inspectConstraintsDlg;
|
|
|
|
DIALOG_BOOK_REPORTER* m_footprintDiffDlg;
|
2021-12-05 20:15:18 +00:00
|
|
|
|
2023-10-30 06:34:45 +00:00
|
|
|
const STRING_UTF8_MAP* m_importProperties; // Properties used for non-KiCad import.
|
|
|
|
|
2021-10-24 10:14:54 +00:00
|
|
|
/**
|
|
|
|
* Keep track of viewport so that track net labels can be adjusted when it changes.
|
|
|
|
*/
|
|
|
|
BOX2D m_lastViewport;
|
|
|
|
wxTimer m_redrawNetnamesTimer;
|
|
|
|
|
|
|
|
wxTimer* m_eventCounterTimer;
|
2008-01-01 11:58:14 +00:00
|
|
|
};
|
|
|
|
|
2021-03-29 13:04:41 +00:00
|
|
|
#endif // __PCB_EDIT_FRAME_H__
|