2013-04-25 16:29:35 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-28 08:51:28 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2021-06-08 19:39:47 +00:00
|
|
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-04-25 16:29:35 +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
|
|
|
|
*/
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
#ifndef _CVPCB_MAINFRAME_H_
|
|
|
|
#define _CVPCB_MAINFRAME_H_
|
|
|
|
|
* 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
|
|
|
#include <config_params.h>
|
2019-08-09 21:05:16 +00:00
|
|
|
#include <kiway_player.h>
|
2019-11-17 12:58:38 +00:00
|
|
|
#include <netlist_reader/pcb_netlist.h>
|
2011-02-05 16:15:48 +00:00
|
|
|
|
2019-07-18 21:47:01 +00:00
|
|
|
#include <auto_associate.h>
|
2019-07-24 20:56:17 +00:00
|
|
|
#include <cvpcb_association.h>
|
2019-07-18 21:47:01 +00:00
|
|
|
#include <listboxes.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2019-08-09 21:05:16 +00:00
|
|
|
/* Forward declarations */
|
|
|
|
class ACTION_TOOLBAR;
|
|
|
|
class ACTION_MENU;
|
|
|
|
class TOOL_DISPATCHER;
|
2011-12-16 13:32:23 +00:00
|
|
|
class wxAuiToolBar;
|
2021-06-03 22:32:32 +00:00
|
|
|
class wxStaticText;
|
2011-02-05 16:15:48 +00:00
|
|
|
class DISPLAY_FOOTPRINTS_FRAME;
|
|
|
|
|
* 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
|
|
|
namespace CV { struct IFACE; }
|
2011-02-05 16:15:48 +00:00
|
|
|
|
2019-07-26 18:58:20 +00:00
|
|
|
// The undo/redo list is composed of vectors of associations
|
|
|
|
typedef std::vector< CVPCB_ASSOCIATION > CVPCB_UNDO_REDO_ENTRIES;
|
|
|
|
|
|
|
|
// The undo list is a vector of undo entries
|
|
|
|
typedef std::vector< CVPCB_UNDO_REDO_ENTRIES > CVPCB_UNDO_REDO_LIST;
|
|
|
|
|
2019-08-09 19:37:41 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
/**
|
2011-08-29 19:50:05 +00:00
|
|
|
* The CvPcb application main window.
|
2011-02-05 16:15:48 +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
|
|
|
class CVPCB_MAINFRAME : public KIWAY_PLAYER
|
2011-02-05 16:15:48 +00:00
|
|
|
{
|
2011-08-24 19:44:05 +00:00
|
|
|
public:
|
2011-02-05 16:15:48 +00:00
|
|
|
~CVPCB_MAINFRAME();
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ) override;
|
* 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-25 17:06:49 +00:00
|
|
|
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
|
2015-06-07 18:18:45 +00:00
|
|
|
|
2019-07-18 21:47:01 +00:00
|
|
|
/**
|
|
|
|
* The action to apply to a footprint filter when it is modified.
|
|
|
|
*/
|
|
|
|
enum CVPCB_FILTER_ACTION
|
|
|
|
{
|
|
|
|
FILTER_DISABLE, ///< Turn off the filter
|
|
|
|
FILTER_ENABLE, ///< Turn on the filter
|
|
|
|
FILTER_TOGGLE ///< Toggle the filter state
|
|
|
|
};
|
|
|
|
|
2019-08-08 22:11:59 +00:00
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* The type of the controls present in the application.
|
2019-08-08 22:11:59 +00:00
|
|
|
*/
|
|
|
|
enum CONTROL_TYPE
|
|
|
|
{
|
|
|
|
CONTROL_NONE, ///< No controls have focus
|
|
|
|
CONTROL_LIBRARY, ///< Library listbox
|
|
|
|
CONTROL_COMPONENT, ///< Component listbox
|
|
|
|
CONTROL_FOOTPRINT ///< Footprint listbox
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Directions to rotate the focus through the listboxes is.
|
2019-08-08 22:11:59 +00:00
|
|
|
*/
|
|
|
|
enum FOCUS_DIR
|
|
|
|
{
|
|
|
|
CHANGE_FOCUS_RIGHT,
|
|
|
|
CHANGE_FOCUS_LEFT
|
|
|
|
};
|
|
|
|
|
2019-08-08 21:10:37 +00:00
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Directions to move when selecting items.
|
2019-08-08 21:10:37 +00:00
|
|
|
*/
|
|
|
|
enum ITEM_DIR
|
|
|
|
{
|
|
|
|
ITEM_NEXT, ///< The next item
|
|
|
|
ITEM_PREV ///< The previous item
|
|
|
|
};
|
|
|
|
|
2019-12-19 15:34:01 +00:00
|
|
|
/**
|
|
|
|
* Get if the current associations 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
|
|
|
{
|
|
|
|
return m_modified;
|
|
|
|
}
|
|
|
|
|
2014-03-21 11:50:04 +00:00
|
|
|
/**
|
|
|
|
* @return a pointer on the Footprint Viewer frame, if exists, or NULL
|
|
|
|
*/
|
2020-03-24 01:01:23 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME* GetFootprintViewerFrame() const;
|
|
|
|
|
|
|
|
wxWindow* GetToolCanvas() const override;
|
2014-03-21 11:50:04 +00:00
|
|
|
|
2019-08-08 22:11:59 +00:00
|
|
|
/**
|
|
|
|
* Find out which control currently has focus.
|
|
|
|
*
|
2021-06-08 19:39:47 +00:00
|
|
|
* @return the control that currently has focus
|
2019-08-08 22:11:59 +00:00
|
|
|
*/
|
2021-03-06 09:27:41 +00:00
|
|
|
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const;
|
2019-08-08 22:11:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the focus to a specific control.
|
|
|
|
*
|
2021-06-08 19:39:47 +00:00
|
|
|
* @param aControl the control to set focus to
|
2019-08-08 22:11:59 +00:00
|
|
|
*/
|
|
|
|
void SetFocusedControl( CVPCB_MAINFRAME::CONTROL_TYPE aControl );
|
|
|
|
|
2011-12-18 20:22:16 +00:00
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Called when clicking on a component in component list window:
|
2013-04-25 16:29:35 +00:00
|
|
|
* * Updates the filtered footprint list, if the filtered list option is selected
|
2011-12-18 20:22:16 +00:00
|
|
|
* * Updates the current selected footprint in footprint list
|
|
|
|
* * Updates the footprint shown in footprint display window (if opened)
|
|
|
|
*/
|
2019-08-10 09:17:42 +00:00
|
|
|
void OnSelectComponent( wxListEvent& event );
|
2016-02-25 09:52:29 +00:00
|
|
|
|
2019-08-10 09:17:42 +00:00
|
|
|
/*
|
|
|
|
* Functions to rebuild the toolbars and menubars
|
|
|
|
*/
|
|
|
|
void ReCreateHToolbar();
|
|
|
|
void ReCreateMenuBar() override;
|
|
|
|
|
|
|
|
void ShowChangedLanguage() override;
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Called by the automatic association button
|
|
|
|
* Read *.equ files to try to find corresponding footprint
|
|
|
|
* for each component that is not already linked to a footprint ( a "free"
|
|
|
|
* component )
|
|
|
|
* format of a line:
|
|
|
|
* 'cmp_ref' 'footprint_name'
|
|
|
|
*/
|
2019-07-18 21:47:01 +00:00
|
|
|
void AutomaticFootprintMatching();
|
2011-08-29 19:50:05 +00:00
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
/**
|
2019-07-18 21:47:01 +00:00
|
|
|
* Set a filter criteria to either on/off or toggle the criteria.
|
|
|
|
*
|
|
|
|
* @param aFilter The filter to modify
|
|
|
|
* @param aAction What action (on, off or toggle) to take
|
2011-08-24 19:44:05 +00:00
|
|
|
*/
|
2021-06-08 19:39:47 +00:00
|
|
|
void SetFootprintFilter( FOOTPRINTS_LISTBOX::FP_FILTER_T aFilter,
|
|
|
|
CVPCB_MAINFRAME::CVPCB_FILTER_ACTION aAction );
|
2011-02-05 16:15:48 +00:00
|
|
|
|
2019-07-26 18:58:20 +00:00
|
|
|
/**
|
|
|
|
* Undo the most recent associations that were performed.
|
|
|
|
*/
|
|
|
|
void UndoAssociation();
|
|
|
|
|
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Redo the most recently undone association.
|
2019-07-26 18:58:20 +00:00
|
|
|
*/
|
|
|
|
void RedoAssociation();
|
|
|
|
|
2020-07-29 23:50:25 +00:00
|
|
|
int GetUndoCommandCount() const override
|
|
|
|
{
|
|
|
|
return m_undoList.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetRedoCommandCount() const override
|
|
|
|
{
|
|
|
|
return m_redoList.size();
|
|
|
|
}
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
/**
|
2019-07-24 20:56:17 +00:00
|
|
|
* Associate a footprint with a specific component in the list.
|
2017-06-10 12:05:30 +00:00
|
|
|
*
|
2019-07-26 18:58:20 +00:00
|
|
|
* Associations can be chained into a single undo/redo step by setting aNewEntry to false
|
|
|
|
* for every association other than the first one. This will create a new list entry for
|
|
|
|
* the first association, and add the subsequent associations to that list.
|
|
|
|
*
|
2019-07-24 20:56:17 +00:00
|
|
|
* @param aAssociation is the association to perform
|
2019-07-26 18:58:20 +00:00
|
|
|
* @param aNewEntry specifies if this association should be a new entry in the undo list
|
|
|
|
* @param aAddUndoItem specifies if an undo item should be created for this association
|
2017-06-10 12:05:30 +00:00
|
|
|
*/
|
2019-07-26 18:58:20 +00:00
|
|
|
void AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation, bool aNewEntry = true,
|
2021-06-08 19:39:47 +00:00
|
|
|
bool aAddUndoItem = true );
|
2017-06-10 12:05:30 +00:00
|
|
|
|
2019-08-10 09:17:42 +00:00
|
|
|
/*
|
|
|
|
* Functions to build the listboxes and their contents
|
|
|
|
*/
|
2021-03-29 10:46:05 +00:00
|
|
|
void BuildSymbolsListBox();
|
|
|
|
void BuildFootprintsListBox();
|
|
|
|
void BuildLibrariesListBox();
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Save the edits that the user has done by sending them back to Eeschema via the kiway.
|
|
|
|
*
|
2018-03-24 18:28:35 +00:00
|
|
|
* Optionally saves the schematic to disk as well.
|
2011-08-24 19:44:05 +00:00
|
|
|
*/
|
2018-08-11 20:46:03 +00:00
|
|
|
bool SaveFootprintAssociation( bool doSaveSchematic );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
2011-02-21 18:27:47 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Update the information displayed on the status bar at bottom of the main frame.
|
2013-06-08 16:06:26 +00:00
|
|
|
*
|
|
|
|
* When the library or component list controls have the focus, the footprint assignment
|
|
|
|
* status of the components is displayed in the first status bar pane and the list of
|
|
|
|
* filters for the selected component is displayed in the second status bar pane. When
|
|
|
|
* the footprint list control has the focus, the description of the selected footprint is
|
|
|
|
* displayed in the first status bar pane and the key words for the selected footprint are
|
|
|
|
* displayed in the second status bar pane. The third status bar pane always displays the
|
|
|
|
* current footprint list filtering.
|
2011-02-05 16:15:48 +00:00
|
|
|
*/
|
2019-08-10 09:17:42 +00:00
|
|
|
void DisplayStatus();
|
2011-02-05 16:15:48 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Read the list of footprint (*.mod files) and generate the list of footprints.
|
|
|
|
*
|
|
|
|
* For each footprint the following items are stored:
|
|
|
|
* - the footprint name
|
|
|
|
* - documentation string
|
|
|
|
* - associated keywords
|
|
|
|
*
|
2011-02-05 16:15:48 +00:00
|
|
|
* @return true if libraries are found, false otherwise.
|
|
|
|
*/
|
2019-08-10 09:17:42 +00:00
|
|
|
bool LoadFootprintFiles();
|
2011-02-05 16:15:48 +00:00
|
|
|
|
2011-10-12 13:09:12 +00:00
|
|
|
/**
|
2012-01-23 04:33:36 +00:00
|
|
|
* Send a remote command to Eeschema via a socket,
|
2021-06-08 19:39:47 +00:00
|
|
|
*
|
|
|
|
* Commands are:
|
|
|
|
* $PART: "reference" put cursor on component anchor
|
|
|
|
*
|
|
|
|
* @param aClearHighligntOnly use true if the message to send is only "clear highlight"
|
|
|
|
* (used when exiting CvPcb)
|
2011-10-12 13:09:12 +00:00
|
|
|
*/
|
2018-12-29 08:39:08 +00:00
|
|
|
void SendMessageToEESCHEMA( bool aClearHighligntOnly = false );
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2019-08-08 21:10:37 +00:00
|
|
|
/**
|
|
|
|
* Get the selected component from the component listbox.
|
|
|
|
*
|
|
|
|
* @return the selected component
|
|
|
|
*/
|
2013-06-06 15:37:48 +00:00
|
|
|
COMPONENT* GetSelectedComponent();
|
|
|
|
|
2019-07-24 20:56:17 +00:00
|
|
|
/**
|
2019-08-08 21:10:37 +00:00
|
|
|
* Set the currently selected component in the components listbox
|
|
|
|
*
|
|
|
|
* @param aIndex the index of the component to select, -1 to clear selection
|
|
|
|
* @param aSkipUpdate skips running the OnSelectComponent event to update the other windows
|
|
|
|
*/
|
|
|
|
void SetSelectedComponent( int aIndex, bool aSkipUpdate = false );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Criteria to use to identify sets of components
|
|
|
|
*/
|
|
|
|
enum CRITERIA
|
|
|
|
{
|
|
|
|
ALL_COMPONENTS, ///< All components
|
|
|
|
SEL_COMPONENTS, ///< Selected components
|
|
|
|
NA_COMPONENTS, ///< Not associated components
|
2019-09-18 07:57:26 +00:00
|
|
|
ASSOC_COMPONENTS ///< Associated components
|
2019-08-08 21:10:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the indices for all the components meeting the specified criteria in the components
|
2021-06-08 19:39:47 +00:00
|
|
|
* listbox.
|
2019-07-24 20:56:17 +00:00
|
|
|
*
|
2019-08-08 21:10:37 +00:00
|
|
|
* @param aCriteria is the criteria to use for finding the indices
|
2019-07-24 20:56:17 +00:00
|
|
|
* @return a vector containing all the indices
|
|
|
|
*/
|
2019-08-08 21:10:37 +00:00
|
|
|
std::vector<unsigned int> GetComponentIndices(
|
|
|
|
CVPCB_MAINFRAME::CRITERIA aCriteria = CVPCB_MAINFRAME::ALL_COMPONENTS );
|
2019-07-24 20:56:17 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
/**
|
2016-11-20 23:35:08 +00:00
|
|
|
* @return the LIB_ID of the selected footprint in footprint listview
|
2016-02-25 09:52:29 +00:00
|
|
|
* or a empty string if no selection
|
|
|
|
*/
|
2018-04-12 11:02:01 +00:00
|
|
|
wxString GetSelectedFootprint();
|
|
|
|
|
2022-07-25 12:29:18 +00:00
|
|
|
void RefreshFootprintViewer();
|
|
|
|
|
2018-04-12 11:02:01 +00:00
|
|
|
void SetStatusText( const wxString& aText, int aNumber = 0 ) override;
|
2016-02-25 09:52:29 +00:00
|
|
|
|
2021-06-08 19:39:47 +00:00
|
|
|
protected:
|
|
|
|
CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
|
|
|
|
|
|
|
|
void setupUIConditions() override;
|
|
|
|
|
2022-07-25 08:12:42 +00:00
|
|
|
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
|
|
|
void doCloseWindow() override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the netlist file built on the fly by Eeschema and loads footprint libraries from
|
|
|
|
* fp lib tables.
|
|
|
|
*
|
|
|
|
* @param aNetlist is the netlist from Eeschema in KiCad s-expr format.
|
|
|
|
* (see CVPCB_MAINFRAME::KiwayMailIn() to know how to get this netlist)
|
|
|
|
*/
|
|
|
|
bool readNetListAndFpFiles( const std::string& aNetlist );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read the netlist (.net) file built on the fly by Eeschema.
|
|
|
|
*
|
|
|
|
* @param aNetlist is the netlist buffer filled by Eeschema, in KiCad s-expr format.
|
|
|
|
* It is the same netlist as the .net file created by Eeschema.
|
|
|
|
* (This method is called by readNetListAndFpFiles)
|
|
|
|
*/
|
|
|
|
int readSchematicNetlist( const std::string& aNetlist );
|
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
private:
|
2021-09-27 11:40:07 +00:00
|
|
|
wxString formatSymbolDesc( int idx, const wxString& aReference, const wxString& aValue,
|
|
|
|
const wxString& aFootprint );
|
|
|
|
|
2019-07-18 21:47:01 +00:00
|
|
|
/**
|
|
|
|
* Setup the tool system for the CVPCB main frame.
|
|
|
|
*/
|
|
|
|
void setupTools();
|
2015-01-13 08:05:43 +00:00
|
|
|
|
2019-08-08 22:11:59 +00:00
|
|
|
/**
|
|
|
|
* Setup event handlers
|
|
|
|
*/
|
|
|
|
void setupEventHandlers();
|
|
|
|
|
2022-07-25 08:12:42 +00:00
|
|
|
void onTextFilterChanged( wxCommandEvent& event );
|
|
|
|
|
2022-07-25 12:29:18 +00:00
|
|
|
void updateFootprintViewerOnIdle( wxIdleEvent& aEvent );
|
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Read the .equ files and populate the list of equivalents.
|
|
|
|
*
|
2015-01-13 08:05:43 +00:00
|
|
|
* @param aList the list to populate
|
|
|
|
* @param aErrorMessages is a pointer to a wxString to store error messages
|
|
|
|
* (can be NULL)
|
|
|
|
* @return the error count ( 0 = no error)
|
|
|
|
*/
|
2021-06-08 19:39:47 +00:00
|
|
|
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
|
|
|
|
wxString* aErrorMessages = nullptr );
|
2015-01-13 08:05:43 +00:00
|
|
|
|
2021-03-29 10:46:05 +00:00
|
|
|
void refreshAfterSymbolSearch( COMPONENT* aSymbol );
|
2016-02-24 16:30:35 +00:00
|
|
|
|
2021-06-08 19:39:47 +00:00
|
|
|
public:
|
2021-08-06 11:40:30 +00:00
|
|
|
FOOTPRINT_LIST* m_FootprintsList;
|
2021-06-08 19:39:47 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-06 11:40:30 +00:00
|
|
|
bool m_modified;
|
|
|
|
bool m_skipComponentSelect; // skip component selection event during
|
|
|
|
// automatic selection/deletion of associations
|
2021-06-08 19:39:47 +00:00
|
|
|
|
2021-08-06 11:40:30 +00:00
|
|
|
bool m_initialized; // true after creating widgets.
|
|
|
|
bool m_cannotClose; // true when the cvpcb frame cannot be closed
|
|
|
|
// (mainly during reading a netlist sent by Eeschema)
|
2021-06-08 19:39:47 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend struct CV::IFACE;
|
|
|
|
|
|
|
|
NETLIST m_netlist;
|
|
|
|
int m_filteringOptions;
|
|
|
|
ACTION_TOOLBAR* m_mainToolBar;
|
|
|
|
FOOTPRINTS_LISTBOX* m_footprintListBox;
|
|
|
|
LIBRARY_LISTBOX* m_librariesListBox;
|
2022-07-24 12:26:19 +00:00
|
|
|
SYMBOLS_LISTBOX* m_symbolsListBox;
|
2021-06-08 19:39:47 +00:00
|
|
|
wxTextCtrl* m_tcFilterString;
|
|
|
|
wxStaticText* m_statusLine1;
|
|
|
|
wxStaticText* m_statusLine2;
|
|
|
|
wxStaticText* m_statusLine3;
|
|
|
|
wxButton* m_saveAndContinue;
|
|
|
|
|
2022-07-24 12:26:19 +00:00
|
|
|
TOOL_DISPATCHER* m_toolDispatcher;
|
2019-08-08 22:11:59 +00:00
|
|
|
|
2019-07-18 21:47:01 +00:00
|
|
|
// Context menus for the list boxes
|
2022-07-24 12:26:19 +00:00
|
|
|
ACTION_MENU* m_footprintContextMenu;
|
|
|
|
ACTION_MENU* m_symbolsContextMenu;
|
2019-07-18 21:47:01 +00:00
|
|
|
|
2022-07-24 12:26:19 +00:00
|
|
|
CVPCB_UNDO_REDO_LIST m_undoList;
|
|
|
|
CVPCB_UNDO_REDO_LIST m_redoList;
|
2022-07-25 12:29:18 +00:00
|
|
|
|
|
|
|
bool m_viewerPendingUpdate;
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //#ifndef _CVPCB_MAINFRAME_H_
|