2013-05-28 16:54:59 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-01-25 16:46:49 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-05-28 16:54:59 +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.
|
2013-05-28 16:54:59 +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.
|
2013-05-28 16:54:59 +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/>.
|
2013-05-28 16:54:59 +00:00
|
|
|
*/
|
|
|
|
|
2018-01-29 20:58:58 +00:00
|
|
|
#ifndef FOOTPRINT_EDIT_FRAME_H
|
|
|
|
#define FOOTPRINT_EDIT_FRAME_H
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <pcb_base_frame.h>
|
2014-07-09 11:50:27 +00:00
|
|
|
#include <pcb_base_edit_frame.h>
|
2023-12-19 17:39:26 +00:00
|
|
|
#include <pcb_io/pcb_io_mgr.h>
|
2018-07-29 15:33:58 +00:00
|
|
|
#include <fp_tree_synchronizing_adapter.h>
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2019-11-03 17:14:21 +00:00
|
|
|
class PCB_LAYER_BOX_SELECTOR;
|
2013-05-28 16:54:59 +00:00
|
|
|
class FP_LIB_TABLE;
|
2018-07-29 15:33:58 +00:00
|
|
|
class FOOTPRINT_TREE_PANE;
|
2020-10-31 01:27:16 +00:00
|
|
|
class SYMBOL_LIBRARY_MANAGER;
|
2020-01-13 01:44:19 +00:00
|
|
|
class FOOTPRINT_EDITOR_SETTINGS;
|
2022-04-19 18:09:19 +00:00
|
|
|
class EDA_LIST_DIALOG;
|
2013-05-28 16:54:59 +00:00
|
|
|
|
2021-09-14 22:45:14 +00:00
|
|
|
namespace PCB { struct IFACE; } // A KIFACE coded 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
|
|
|
|
2013-05-28 16:54:59 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
|
2010-08-10 18:34:26 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-08-26 17:01:17 +00:00
|
|
|
~FOOTPRINT_EDIT_FRAME();
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2012-09-12 09:53:11 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* @return the frame name used when creating the frame used to get a reference to this
|
|
|
|
* frame, if exists
|
2012-09-12 09:53:11 +00:00
|
|
|
*/
|
|
|
|
static const wxChar* GetFootprintEditorFrameName();
|
|
|
|
|
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;
|
2020-08-13 23:09:17 +00:00
|
|
|
SELECTION& GetCurrentSelection() override;
|
2016-05-13 15:31:54 +00:00
|
|
|
|
2019-12-19 15:34:01 +00:00
|
|
|
/**
|
|
|
|
* Get if any footprints or libraries have 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
|
|
|
|
2018-08-25 15:12:08 +00:00
|
|
|
bool IsCurrentFPFromBoard() const;
|
|
|
|
|
2021-12-22 14:27:38 +00:00
|
|
|
bool CanCloseFPFromBoard( bool doClose );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
FOOTPRINT_EDITOR_SETTINGS* GetSettings();
|
|
|
|
|
2022-01-20 09:43:40 +00:00
|
|
|
/**
|
|
|
|
* Return the angle used for rotate operations.
|
|
|
|
*/
|
|
|
|
EDA_ANGLE GetRotationAngle() const override;
|
|
|
|
|
2020-12-17 03:07:35 +00:00
|
|
|
APP_SETTINGS_BASE* config() const override;
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& GetDesignSettings() const override;
|
2012-02-02 17:45:37 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
const PCB_PLOT_PARAMS& GetPlotSettings() const override;
|
|
|
|
void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) override;
|
2012-04-05 18:27:56 +00:00
|
|
|
|
2020-05-22 18:27:05 +00:00
|
|
|
MAGNETIC_SETTINGS* GetMagneticItemsSettings() override;
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
|
|
|
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2021-09-07 20:34:10 +00:00
|
|
|
COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
|
2020-05-06 01:45:48 +00:00
|
|
|
|
2020-09-25 07:31:56 +00:00
|
|
|
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
|
2018-02-13 21:19:41 +00:00
|
|
|
|
2020-08-24 02:01:14 +00:00
|
|
|
bool canCloseWindow( wxCloseEvent& Event ) override;
|
|
|
|
void doCloseWindow() override;
|
2020-11-10 20:31:52 +00:00
|
|
|
void CloseFootprintEditor( wxCommandEvent& Event );
|
2019-06-25 04:44:34 +00:00
|
|
|
void OnExitKiCad( wxCommandEvent& aEvent );
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2018-08-11 11:16:41 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Switch the currently used canvas (Cairo / OpenGL).
|
|
|
|
*
|
|
|
|
* It also reinitializes the layer manager that slightly changes with canvases.
|
2018-08-11 11:16:41 +00:00
|
|
|
*/
|
2019-05-28 13:51:47 +00:00
|
|
|
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
|
2018-08-11 11:16:41 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Update the layer manager and other widgets from the board setup (layer and items
|
|
|
|
* visibility, colors ...).
|
2018-08-11 11:16:41 +00:00
|
|
|
*/
|
|
|
|
void UpdateUserInterface();
|
|
|
|
|
2023-01-25 16:46:49 +00:00
|
|
|
///< @copydoc EDADRAW_FRAME::UpdateMsgPanel
|
|
|
|
void UpdateMsgPanel() override;
|
|
|
|
|
2019-04-11 01:23:34 +00:00
|
|
|
/**
|
|
|
|
* Refresh the library tree and redraw the window
|
|
|
|
*/
|
|
|
|
void HardRedraw() override;
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/**
|
2018-11-09 13:32:13 +00:00
|
|
|
* Create the main horizontal toolbar for the footprint editor.
|
2011-08-26 17:01:17 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateHToolbar() override;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
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;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2019-11-03 17:14:21 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Re create the layer Box by clearing the old list, and building a new one from the new
|
|
|
|
* layers names and layer colors..
|
|
|
|
*
|
|
|
|
* @param aForceResizeToolbar true to resize the parent toolbar or false if not needed
|
|
|
|
* (mainly in parent toolbar creation or when the layers names
|
|
|
|
* are not modified).
|
2019-11-03 17:14:21 +00:00
|
|
|
*/
|
|
|
|
void ReCreateLayerBox( bool aForceResizeToolbar = true );
|
|
|
|
|
|
|
|
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
|
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
void SelectLayer( wxCommandEvent& event );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
// The Tool Framework initialization, for GAL mode
|
2015-05-19 16:39:05 +00:00
|
|
|
void setupTools();
|
|
|
|
|
2018-11-09 13:32:13 +00:00
|
|
|
void OnSaveFootprintAsPng( wxCommandEvent& event );
|
|
|
|
|
2021-12-10 00:27:03 +00:00
|
|
|
bool IsSearchTreeShown() const;
|
2019-06-06 11:45:28 +00:00
|
|
|
void ToggleSearchTree();
|
2024-05-04 20:17:26 +00:00
|
|
|
void FocusSearchTreeInput();
|
2021-10-30 22:21:15 +00:00
|
|
|
void ToggleLayersManager();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2012-10-07 15:37:25 +00:00
|
|
|
/**
|
2018-11-09 13:32:13 +00:00
|
|
|
* Save a library to a new name and/or library type.
|
2012-10-07 15:37:25 +00:00
|
|
|
*
|
2023-12-27 00:25:41 +00:00
|
|
|
* @see #PCB_IO::FootprintSave and #IO_BASE::LibraryCreate
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2013-05-28 16:54:59 +00:00
|
|
|
* @note Saving as a new library type requires the plug-in to support saving libraries
|
2012-10-07 15:37:25 +00:00
|
|
|
*/
|
2018-07-29 15:33:58 +00:00
|
|
|
bool SaveLibraryAs( const wxString& aLibraryPath );
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2020-11-10 20:31:52 +00:00
|
|
|
void OnUpdateLoadFootprintFromBoard( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateSaveFootprintToBoard( wxUpdateUIEvent& aEvent );
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc PCB_BASE_EDIT_FRAME::OnEditItemRequest()
|
2019-05-28 23:23:58 +00:00
|
|
|
void OnEditItemRequest( BOARD_ITEM* aItem ) override;
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2018-11-09 13:32:13 +00:00
|
|
|
* Called from the main toolbar to load a footprint from board mainly to edit it.
|
2010-08-10 18:34:26 +00:00
|
|
|
*/
|
2022-01-10 14:03:30 +00:00
|
|
|
void OnLoadFootprintFromBoard( wxCommandEvent& event );
|
2020-11-10 20:11:53 +00:00
|
|
|
|
2022-01-10 14:03:30 +00:00
|
|
|
void OnSaveFootprintToBoard( wxCommandEvent& event );
|
2018-10-15 14:28:53 +00:00
|
|
|
|
2020-11-10 20:31:52 +00:00
|
|
|
void LoadFootprintFromLibrary( LIB_ID aFPID );
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Return the adapter object that provides the stored data.
|
2018-07-29 15:33:58 +00:00
|
|
|
*/
|
2020-11-07 14:31:50 +00:00
|
|
|
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& GetLibTreeAdapter() { return m_adapter; }
|
2018-07-29 15:33:58 +00:00
|
|
|
|
2015-01-28 10:00:48 +00:00
|
|
|
/**
|
2018-11-09 13:32:13 +00:00
|
|
|
* Save in an existing library a given footprint.
|
|
|
|
*
|
2020-11-08 21:29:04 +00:00
|
|
|
* @param aFootprint = the given footprint
|
2015-01-28 10:00:48 +00:00
|
|
|
* @return : true if OK, false if abort
|
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
bool SaveFootprint( FOOTPRINT* aFootprint );
|
2022-04-21 10:57:15 +00:00
|
|
|
bool DuplicateFootprint( FOOTPRINT* aFootprint );
|
2020-11-13 15:15:52 +00:00
|
|
|
bool SaveFootprintAs( FOOTPRINT* aFootprint );
|
2018-08-25 15:12:08 +00:00
|
|
|
bool SaveFootprintToBoard( bool aAddNew );
|
2020-11-13 15:15:52 +00:00
|
|
|
bool SaveFootprintInLibrary( FOOTPRINT* aFootprint, const wxString& aLibraryName );
|
2018-10-03 21:44:17 +00:00
|
|
|
bool RevertFootprint();
|
2015-01-28 10:00:48 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Must be called after a footprint change in order to set the "modify" flag of the
|
|
|
|
* current screen and prepare, if needed the refresh of the 3D frame showing the footprint.
|
|
|
|
*
|
|
|
|
* Do not forget to call the basic OnModify function to update auxiliary info.
|
2010-08-10 18:34:26 +00:00
|
|
|
*/
|
2019-05-27 09:06:34 +00:00
|
|
|
void OnModify() override;
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2018-11-09 13:32:13 +00:00
|
|
|
* Delete all and reinitialize the current board.
|
|
|
|
*
|
2023-06-05 09:32:11 +00:00
|
|
|
* @param doAskAboutUnsavedChanges = true to prompt user for confirmation if existing board
|
|
|
|
* contains unsaved changes, false to re-initialize silently
|
2010-08-10 18:34:26 +00:00
|
|
|
*/
|
2023-06-05 09:32:11 +00:00
|
|
|
bool Clear_Pcb( bool doAskAboutUnsavedChanges );
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2019-06-05 19:15:57 +00:00
|
|
|
/// Return the LIB_ID of the part or library selected in the footprint tree.
|
|
|
|
LIB_ID GetTreeFPID() const;
|
2018-07-29 15:33:58 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
LIB_TREE_NODE* GetCurrentTreeNode() const;
|
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
/// Return the LIB_ID of the part being edited.
|
2018-09-13 23:39:40 +00:00
|
|
|
LIB_ID GetLoadedFPID() const;
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2019-06-05 19:15:57 +00:00
|
|
|
/// Return the LIB_ID of the part selected in the footprint tree, or the loaded part if
|
|
|
|
/// there is no selection in the tree.
|
|
|
|
LIB_ID GetTargetFPID() const;
|
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
void ClearModify();
|
|
|
|
|
2010-12-29 17:47:32 +00:00
|
|
|
/**
|
|
|
|
* Create a file containing only one footprint.
|
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
void ExportFootprint( FOOTPRINT* aFootprint );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-10 18:34:26 +00:00
|
|
|
/**
|
|
|
|
* Read a file containing only one footprint.
|
2018-11-09 13:32:13 +00:00
|
|
|
*
|
2020-11-10 20:31:52 +00:00
|
|
|
* The import function can also read gpcb footprint file, in Newlib format.
|
2010-08-10 18:34:26 +00:00
|
|
|
* (One footprint per file, Newlib files have no special ext.)
|
|
|
|
*/
|
2021-01-27 22:15:38 +00:00
|
|
|
FOOTPRINT* ImportFootprint( const wxString& aName = wxT( "" ) );
|
2017-10-19 21:15:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2020-11-10 20:31:52 +00:00
|
|
|
* Load a footprint from the main board into the Footprint Editor.
|
2018-11-09 13:32:13 +00:00
|
|
|
*
|
2020-11-10 20:31:52 +00:00
|
|
|
* @param aFootprint = the footprint to load. If NULL, the user will be asked for a
|
|
|
|
* footprint reference.
|
|
|
|
* @return true if a footprint is loaded.
|
2010-08-10 18:34:26 +00:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
bool LoadFootprintFromBoard( FOOTPRINT* aFootprint );
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2020-10-21 03:48:06 +00:00
|
|
|
* Display the list of footprints currently existing on the BOARD.
|
2018-11-09 13:32:13 +00:00
|
|
|
*
|
2020-11-10 20:31:52 +00:00
|
|
|
* @return the selected footprint or nullptr
|
2010-08-10 18:34:26 +00:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* SelectFootprintFromBoard( BOARD* aPcb );
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2012-11-19 16:19:38 +00:00
|
|
|
/**
|
2020-11-10 20:31:52 +00:00
|
|
|
* Delete the given footprint from its library.
|
2012-11-19 16:19:38 +00:00
|
|
|
*/
|
2020-11-10 20:31:52 +00:00
|
|
|
bool DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool aConfirm );
|
2010-08-10 18:34:26 +00:00
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
/**
|
|
|
|
* @return the color of the grid
|
|
|
|
*/
|
2019-05-27 09:06:34 +00:00
|
|
|
COLOR4D GetGridColor() override;
|
2013-04-11 18:29:56 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc PCB_BASE_FRAME::SetActiveLayer()
|
2017-03-13 03:19:33 +00:00
|
|
|
void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
|
2014-07-09 09:59:23 +00:00
|
|
|
|
2021-01-19 19:45:50 +00:00
|
|
|
void OnDisplayOptionsChanged() override;
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
2019-05-30 12:25:08 +00:00
|
|
|
void ActivateGalCanvas() override;
|
2014-07-09 09:22:43 +00:00
|
|
|
|
2017-10-19 21:15:48 +00:00
|
|
|
/**
|
2018-11-09 13:32:13 +00:00
|
|
|
* Load a KiCad board (.kicad_pcb) from \a aFileName.
|
2017-10-19 21:15:48 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aFileSet is the BOARD file to load, a vector of one element.
|
|
|
|
* @param aCtl is the 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.
|
|
|
|
* @return false if file load fails, otherwise true.
|
2017-10-19 21:15:48 +00:00
|
|
|
*/
|
|
|
|
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
|
|
|
|
|
2018-09-25 14:23:38 +00:00
|
|
|
/**
|
2020-11-10 20:31:52 +00:00
|
|
|
* Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board,
|
2018-09-25 14:23:38 +00:00
|
|
|
* NOT to the user's PCB.
|
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
void AddFootprintToBoard( FOOTPRINT* aFootprint ) override;
|
2018-09-25 14:23:38 +00:00
|
|
|
|
2023-05-31 20:37:58 +00:00
|
|
|
/**
|
|
|
|
* Override from PCB_BASE_FRAME which reloads the footprint from the library without
|
|
|
|
* setting the footprint watcher
|
|
|
|
*/
|
|
|
|
void ReloadFootprint( FOOTPRINT* aFootprint ) override;
|
|
|
|
|
2018-08-04 11:59:04 +00:00
|
|
|
/**
|
|
|
|
* Update visible items after a language change.
|
|
|
|
*/
|
|
|
|
void ShowChangedLanguage() override;
|
|
|
|
|
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;
|
2017-10-19 21:15:48 +00:00
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
/**
|
|
|
|
* Synchronize the footprint library tree to the current state of the footprint library
|
|
|
|
* table.
|
|
|
|
*/
|
|
|
|
void SyncLibraryTree( bool aProgress );
|
2020-02-07 17:06:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Filter, sort, and redisplay the library tree. Does NOT synchronize it with libraries
|
|
|
|
* in disk.
|
|
|
|
*/
|
|
|
|
void RegenerateLibraryTree();
|
|
|
|
|
2021-03-17 14:53:27 +00:00
|
|
|
/**
|
|
|
|
* Redisplay the library tree. Used after changing modified states, descriptions, etc.
|
|
|
|
*/
|
2020-11-10 20:11:53 +00:00
|
|
|
void RefreshLibraryTree();
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
/**
|
|
|
|
* Update a single node in the library tree.
|
|
|
|
*/
|
|
|
|
void UpdateLibraryTree( const wxDataViewItem& treeItem, FOOTPRINT* aFootprint );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Reload displayed items and sets view.
|
2020-11-10 20:11:53 +00:00
|
|
|
void UpdateView();
|
|
|
|
|
2021-02-20 14:36:28 +00:00
|
|
|
void UpdateTitle();
|
|
|
|
|
2019-06-06 11:45:28 +00:00
|
|
|
void FocusOnLibID( const LIB_ID& aLibID );
|
2018-08-06 18:33:28 +00:00
|
|
|
|
2018-08-19 16:53:01 +00:00
|
|
|
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
2018-05-12 08:44:31 +00:00
|
|
|
|
2010-08-10 18:34:26 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2012-11-19 16:19:38 +00:00
|
|
|
|
|
|
|
protected:
|
* 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
|
|
|
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
|
2021-11-21 20:32:39 +00:00
|
|
|
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
* 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
|
|
|
|
2023-10-26 15:58:14 +00:00
|
|
|
/**
|
|
|
|
* Determines the Canvas type to load (with prompt if required) and initializes m_canvasType
|
|
|
|
*/
|
|
|
|
void resolveCanvasType() override;
|
|
|
|
|
2018-07-30 13:18:37 +00:00
|
|
|
/**
|
|
|
|
* Make sure the footprint info list is loaded (with a progress dialog) and then initialize
|
|
|
|
* the footprint library tree.
|
|
|
|
*/
|
|
|
|
void initLibraryTree();
|
|
|
|
|
2014-06-11 05:18:41 +00:00
|
|
|
void restoreLastFootprint();
|
|
|
|
void retainLastFootprint();
|
2015-01-07 19:07:15 +00:00
|
|
|
|
2022-12-16 21:37:32 +00:00
|
|
|
/**
|
|
|
|
* @brief (Re)Create the menubar for the Footprint Editor frame
|
|
|
|
*/
|
|
|
|
void doReCreateMenuBar() override;
|
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
/**
|
|
|
|
* Run the Footprint Properties dialog and handle changes made in it.
|
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
void editFootprintProperties( FOOTPRINT* aFootprint );
|
2020-08-13 23:09:17 +00:00
|
|
|
|
|
|
|
void setupUIConditions() override;
|
2021-01-27 22:15:38 +00:00
|
|
|
|
2021-10-01 21:45:49 +00:00
|
|
|
void centerItemIdleHandler( wxIdleEvent& aEvent );
|
|
|
|
|
2021-07-29 15:02:25 +00:00
|
|
|
protected:
|
|
|
|
PCB_LAYER_BOX_SELECTOR* m_selLayerBox; // a combo box to display and select active layer
|
|
|
|
FOOTPRINT_EDITOR_SETTINGS* m_editorSettings;
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
private:
|
|
|
|
friend struct PCB::IFACE;
|
|
|
|
|
|
|
|
FOOTPRINT_TREE_PANE* m_treePane;
|
2021-10-01 21:45:49 +00:00
|
|
|
LIB_ID m_centerItemOnIdle;
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> m_adapter;
|
|
|
|
|
2021-10-30 22:21:15 +00:00
|
|
|
bool m_show_layer_manager_tools;
|
|
|
|
|
2022-11-12 13:39:21 +00:00
|
|
|
std::unique_ptr<FOOTPRINT> m_originalFootprintCopy;
|
2021-01-27 22:15:38 +00:00
|
|
|
wxString m_footprintNameWhenLoaded;
|
2021-01-31 14:08:05 +00:00
|
|
|
std::map<KIID, KIID> m_boardFootprintUuids;
|
2010-08-10 18:34:26 +00:00
|
|
|
};
|
|
|
|
|
2018-01-29 20:58:58 +00:00
|
|
|
#endif // FOOTPRINT_EDIT_FRAME_H
|