2011-10-13 20:13:11 +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
|
2019-06-15 16:05:33 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
2019-06-20 22:27:58 +00:00
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-13 20:13:11 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2017-06-13 23:47:05 +00:00
|
|
|
* @file cvpcb_mainframe.cpp
|
2011-10-13 20:13:11 +00:00
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <build_version.h>
|
2015-06-07 18:18:45 +00:00
|
|
|
#include <kiway_express.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 <kiface_i.h>
|
2018-05-01 20:46:05 +00:00
|
|
|
#include <kiface_ids.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <macros.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <eda_dde.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <html_messagebox.h>
|
|
|
|
#include <fp_lib_table.h>
|
|
|
|
#include <netlist_reader.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2018-02-10 13:32:57 +00:00
|
|
|
#include <widgets/progress_reporter.h>
|
2018-03-07 13:05:12 +00:00
|
|
|
#include <3d_cache/3d_cache.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <dialog_configure_paths.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <cvpcb.h>
|
2018-01-28 08:51:28 +00:00
|
|
|
#include <listboxes.h>
|
2018-07-17 21:14:02 +00:00
|
|
|
#include <wx/statline.h>
|
2013-10-13 21:33:58 +00:00
|
|
|
#include <invoke_pcb_dialog.h>
|
2018-01-28 08:51:28 +00:00
|
|
|
#include <display_footprints_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <cvpcb_id.h>
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <cvpcb_mainframe.h>
|
|
|
|
|
2018-02-11 17:55:14 +00:00
|
|
|
wxSize const FRAME_MIN_SIZE_DU( 350, 250 );
|
|
|
|
wxSize const FRAME_DEFAULT_SIZE_DU( 450, 300 );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2016-05-12 19:45:47 +00:00
|
|
|
///@{
|
|
|
|
/// \ingroup config
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2016-05-12 19:45:47 +00:00
|
|
|
static const wxString FilterFootprintEntry = "FilterFootprint";
|
|
|
|
///@}
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2015-06-07 18:18:45 +00:00
|
|
|
BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
// Menu events
|
2019-02-15 04:50:50 +00:00
|
|
|
EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::OnSaveAndContinue )
|
2011-08-24 19:44:05 +00:00
|
|
|
EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
|
|
|
|
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
|
|
|
|
EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
|
2015-03-29 21:22:53 +00:00
|
|
|
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
|
2015-01-11 17:22:45 +00:00
|
|
|
EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList )
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
// Toolbar events
|
2014-08-13 19:26:31 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable )
|
2011-08-24 19:44:05 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
|
|
|
|
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
|
|
|
|
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
|
2019-06-20 22:27:58 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_DEL_ALL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAllAssociations )
|
|
|
|
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATION, CVPCB_MAINFRAME::DelAssociation )
|
|
|
|
EVT_TOOL( ID_CVPCB_CUT_ASSOCIATION, CVPCB_MAINFRAME::CutAssociation )
|
|
|
|
EVT_TOOL( ID_CVPCB_COPY_ASSOCIATION, CVPCB_MAINFRAME::CopyAssociation )
|
|
|
|
EVT_TOOL( ID_CVPCB_PASTE_ASSOCIATION, CVPCB_MAINFRAME::PasteAssociation )
|
2015-01-13 08:05:43 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
|
2011-08-24 19:44:05 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
2012-03-15 18:20:22 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
2013-05-31 17:33:46 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
2016-02-24 16:30:35 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME,
|
2016-02-25 13:57:59 +00:00
|
|
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
2016-02-25 14:38:08 +00:00
|
|
|
EVT_TEXT( ID_CVPCB_FILTER_TEXT_EDIT, CVPCB_MAINFRAME::OnEnterFilteringText )
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
// Button events
|
|
|
|
EVT_BUTTON( wxID_OK, CVPCB_MAINFRAME::OnOK )
|
|
|
|
EVT_BUTTON( wxID_CANCEL, CVPCB_MAINFRAME::OnCancel )
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
// Frame events
|
|
|
|
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
|
|
|
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
|
|
|
|
2019-06-20 22:13:36 +00:00
|
|
|
// Handle the escape key
|
|
|
|
EVT_TOOL( ID_CVPCB_ESCAPE_KEY, CVPCB_MAINFRAME::OnEscapeKey )
|
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
// UI event handlers
|
2019-06-15 16:05:33 +00:00
|
|
|
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords )
|
|
|
|
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnFilterFPbyPinCount )
|
|
|
|
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnFilterFPbyLibrary )
|
2016-02-25 10:35:27 +00:00
|
|
|
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, CVPCB_MAINFRAME::OnFilterFPbyKeyName )
|
2016-02-25 09:52:29 +00:00
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2012-09-12 09:53:11 +00:00
|
|
|
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
|
|
|
|
|
* 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
|
|
|
|
|
|
|
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
2018-04-04 18:22:28 +00:00
|
|
|
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
|
* 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
|
|
|
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox = NULL;
|
|
|
|
m_footprintListBox = NULL;
|
|
|
|
m_libListBox = NULL;
|
2013-06-06 15:37:48 +00:00
|
|
|
m_mainToolBar = NULL;
|
|
|
|
m_modified = false;
|
2021-08-06 18:22:03 +00:00
|
|
|
m_cannotClose = false;
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = false;
|
2016-02-25 09:52:29 +00:00
|
|
|
m_filteringOptions = 0;
|
2016-02-25 13:57:59 +00:00
|
|
|
m_tcFilterString = NULL;
|
2017-03-23 00:59:25 +00:00
|
|
|
m_FootprintsList = FOOTPRINT_LIST::GetInstance( Kiway() );
|
2018-03-25 23:52:02 +00:00
|
|
|
m_initialized = false;
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
// Give an icon
|
2011-09-09 19:30:59 +00:00
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
|
|
|
|
SetIcon( icon );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
SetAutoLayout( true );
|
2007-12-04 18:23:38 +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
|
|
|
LoadSettings( config() );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2018-01-07 05:15:48 +00:00
|
|
|
wxSize const frame_min( ConvertDialogToPixels( FRAME_MIN_SIZE_DU ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2018-01-07 05:15:48 +00:00
|
|
|
SetSizeHints( frame_min );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2018-02-11 17:55:14 +00:00
|
|
|
// Frame size and position
|
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
ReCreateMenuBar();
|
2007-05-06 16:03:28 +00:00
|
|
|
ReCreateHToolbar();
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
// Create list of available modules and components of the schematic
|
2007-12-04 18:23:38 +00:00
|
|
|
BuildCmpListBox();
|
2009-08-20 11:44:06 +00:00
|
|
|
BuildFOOTPRINTS_LISTBOX();
|
2013-05-31 17:33:46 +00:00
|
|
|
BuildLIBRARY_LISTBOX();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
m_auimgr.SetManagedWindow( this );
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
|
2011-09-15 18:25:44 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_libListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
|
|
|
|
.Caption( _( "Footprint Libraries" ) )
|
|
|
|
.BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
|
2011-09-15 18:25:44 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_compListBox, EDA_PANE().Palette().Name( "Components" ).Center().Layer(0)
|
|
|
|
.Caption( _( "Symbol : Footprint Assignments" ) ) );
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
|
|
|
|
.Caption( _( "Filtered Footprints" ) )
|
|
|
|
.BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2018-04-18 21:26:18 +00:00
|
|
|
// Build the bottom panel, to display 2 status texts and the buttons:
|
2018-03-24 18:28:35 +00:00
|
|
|
auto bottomPanel = new wxPanel( this );
|
2018-04-18 07:25:14 +00:00
|
|
|
auto panelSizer = new wxBoxSizer( wxVERTICAL );
|
2018-07-17 21:14:02 +00:00
|
|
|
|
2019-05-27 23:21:22 +00:00
|
|
|
wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
|
2018-07-17 21:14:02 +00:00
|
|
|
fgSizerStatus->SetFlexibleDirection( wxBOTH );
|
|
|
|
fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
2018-03-24 18:28:35 +00:00
|
|
|
|
|
|
|
m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
|
2018-07-18 16:59:05 +00:00
|
|
|
fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
|
2018-03-24 18:28:35 +00:00
|
|
|
|
|
|
|
m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
|
2019-05-27 23:21:22 +00:00
|
|
|
fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
|
|
|
|
|
|
|
|
m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
|
|
|
|
fgSizerStatus->Add( m_statusLine3, 0, wxBOTTOM, 3 );
|
2018-07-17 21:14:02 +00:00
|
|
|
|
2018-07-18 16:59:05 +00:00
|
|
|
panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
|
2018-07-17 21:14:02 +00:00
|
|
|
|
|
|
|
wxStaticLine* staticline1 = new wxStaticLine( bottomPanel );
|
|
|
|
panelSizer->Add( staticline1, 0, wxEXPAND, 5 );
|
|
|
|
|
|
|
|
wxFont statusFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
2018-07-18 16:59:05 +00:00
|
|
|
statusFont.SetSymbolicSize( wxFONTSIZE_SMALL );
|
2018-07-17 21:14:02 +00:00
|
|
|
m_statusLine1->SetFont( statusFont );
|
2018-04-18 21:26:18 +00:00
|
|
|
m_statusLine2->SetFont( statusFont );
|
2019-05-27 23:21:22 +00:00
|
|
|
m_statusLine3->SetFont( statusFont );
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2018-04-18 07:25:14 +00:00
|
|
|
// Add buttons:
|
|
|
|
auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
auto sdbSizer = new wxStdDialogButtonSizer();
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2019-02-15 04:50:50 +00:00
|
|
|
m_saveAndContinue = new wxButton( bottomPanel, ID_SAVE_PROJECT,
|
2018-04-18 21:26:18 +00:00
|
|
|
_( "Apply, Save Schematic && Continue" ) );
|
2018-07-17 21:14:02 +00:00
|
|
|
buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2018-04-18 07:25:14 +00:00
|
|
|
auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
|
|
|
|
sdbSizer->AddButton( sdbSizerOK );
|
|
|
|
auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
|
|
|
|
sdbSizer->AddButton( sdbSizerCancel );
|
|
|
|
sdbSizer->Realize();
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2018-04-18 21:26:18 +00:00
|
|
|
buttonsSizer->Add( sdbSizer, 0, 0, 5 );
|
2018-07-17 21:14:02 +00:00
|
|
|
panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
|
2018-03-24 18:28:35 +00:00
|
|
|
|
|
|
|
bottomPanel->SetSizer( panelSizer );
|
|
|
|
bottomPanel->Fit();
|
|
|
|
|
2018-04-18 07:25:14 +00:00
|
|
|
sdbSizerOK->SetDefault();
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2009-11-02 22:24:55 +00:00
|
|
|
m_auimgr.Update();
|
2018-03-25 23:52:02 +00:00
|
|
|
m_initialized = true;
|
2018-03-24 18:28:35 +00:00
|
|
|
|
|
|
|
// Connect Events
|
2019-06-15 16:05:33 +00:00
|
|
|
m_saveAndContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
|
|
|
|
wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ),
|
|
|
|
NULL, this );
|
|
|
|
m_footprintListBox->Connect( wxEVT_RIGHT_DOWN,
|
|
|
|
wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ),
|
|
|
|
NULL, this );
|
|
|
|
m_compListBox->Connect( wxEVT_RIGHT_DOWN,
|
|
|
|
wxMouseEventHandler( CVPCB_MAINFRAME::OnComponentRightClick ),
|
|
|
|
NULL, this );
|
2019-06-20 22:13:36 +00:00
|
|
|
|
|
|
|
// Add an accelerator to make escape close the window
|
|
|
|
wxAcceleratorEntry entries[1];
|
|
|
|
entries[0].Set( wxACCEL_NORMAL, WXK_ESCAPE, ID_CVPCB_ESCAPE_KEY );
|
|
|
|
wxAcceleratorTable accel( 1, entries );
|
|
|
|
SetAcceleratorTable( accel );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-03-24 18:28:35 +00:00
|
|
|
// Disconnect Events
|
2019-06-15 16:05:33 +00:00
|
|
|
m_saveAndContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
|
|
|
|
wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ),
|
|
|
|
NULL, this );
|
|
|
|
m_footprintListBox->Disconnect( wxEVT_RIGHT_DOWN,
|
|
|
|
wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ),
|
|
|
|
NULL, this );
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2009-11-02 22:24:55 +00:00
|
|
|
m_auimgr.UnInit();
|
2009-04-23 15:02:18 +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
|
|
|
void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
|
2009-04-23 15:02:18 +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
|
|
|
EDA_BASE_FRAME::LoadSettings( aCfg );
|
|
|
|
|
2018-02-11 17:55:14 +00:00
|
|
|
wxSize const frame_default( ConvertDialogToPixels( FRAME_DEFAULT_SIZE_DU ) );
|
|
|
|
|
|
|
|
if( m_FrameSize == wxDefaultSize )
|
|
|
|
m_FrameSize = frame_default;
|
|
|
|
|
2016-05-12 19:45:47 +00:00
|
|
|
aCfg->Read( FilterFootprintEntry, &m_filteringOptions, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
|
* 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-04-23 15:02:18 +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
|
|
|
void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg )
|
|
|
|
{
|
|
|
|
EDA_BASE_FRAME::SaveSettings( aCfg );
|
|
|
|
|
2016-05-12 19:45:47 +00:00
|
|
|
aCfg->Write( FilterFootprintEntry, m_filteringOptions );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnSize( wxSizeEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
event.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-23 15:02:18 +00:00
|
|
|
if( m_modified )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2019-06-15 16:05:33 +00:00
|
|
|
if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
|
|
|
|
"Save before exit?" ),
|
2018-08-11 20:46:03 +00:00
|
|
|
[&]()->bool { return SaveFootprintAssociation( false ); } ) )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
|
|
|
Event.Veto();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
// Close module display frame
|
2016-01-06 07:36:08 +00:00
|
|
|
if( GetFootprintViewerFrame() )
|
|
|
|
GetFootprintViewerFrame()->Close( true );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
m_modified = false;
|
2014-01-29 17:01:42 +00:00
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
// clear highlight symbol in schematic:
|
|
|
|
SendMessageToEESCHEMA( true );
|
|
|
|
|
2021-08-06 18:22:03 +00:00
|
|
|
|
|
|
|
if( m_cannotClose )
|
|
|
|
return;
|
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
// Delete window
|
2007-12-04 18:23:38 +00:00
|
|
|
Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-08 16:06:26 +00:00
|
|
|
void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2013-06-08 16:06:26 +00:00
|
|
|
wxWindow* hasFocus = wxWindow::FindFocus();
|
|
|
|
|
|
|
|
if( aMoveRight )
|
2009-08-20 11:44:06 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
if( hasFocus == m_libListBox )
|
|
|
|
m_compListBox->SetFocus();
|
|
|
|
else if( hasFocus == m_compListBox )
|
|
|
|
m_footprintListBox->SetFocus();
|
|
|
|
else if( hasFocus == m_footprintListBox )
|
|
|
|
m_libListBox->SetFocus();
|
2013-06-08 16:06:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
if( hasFocus == m_libListBox )
|
|
|
|
m_footprintListBox->SetFocus();
|
|
|
|
else if( hasFocus == m_compListBox )
|
|
|
|
m_libListBox->SetFocus();
|
|
|
|
else if( hasFocus == m_footprintListBox )
|
|
|
|
m_compListBox->SetFocus();
|
2009-08-20 11:44:06 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
if( m_netlist.IsEmpty() )
|
2009-04-23 15:02:18 +00:00
|
|
|
return;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
int first_selected = m_compListBox->GetFirstSelected();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2015-07-01 10:55:41 +00:00
|
|
|
if( first_selected < 0 )
|
|
|
|
first_selected = -1; // We will start to 0 for the first search , if no item selected
|
2008-10-29 23:57:35 +00:00
|
|
|
|
2015-07-01 10:55:41 +00:00
|
|
|
int candidate = -1;
|
|
|
|
|
2018-03-26 06:24:09 +00:00
|
|
|
for( int jj = first_selected+1; jj < (int)m_netlist.GetCount(); jj++ )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2013-09-08 18:31:21 +00:00
|
|
|
if( m_netlist.GetComponent( jj )->GetFPID().empty() )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2015-07-01 10:55:41 +00:00
|
|
|
candidate = jj;
|
|
|
|
break;
|
2009-04-23 15:02:18 +00:00
|
|
|
}
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
2015-07-01 10:55:41 +00:00
|
|
|
|
|
|
|
if( candidate >= 0 )
|
|
|
|
{
|
|
|
|
m_compListBox->DeselectAll();
|
|
|
|
m_compListBox->SetSelection( candidate );
|
|
|
|
SendMessageToEESCHEMA();
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
if( m_netlist.IsEmpty() )
|
2009-04-23 15:02:18 +00:00
|
|
|
return;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2015-07-01 10:55:41 +00:00
|
|
|
int first_selected = m_compListBox->GetFirstSelected();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2015-07-01 10:55:41 +00:00
|
|
|
if( first_selected < 0 )
|
|
|
|
first_selected = m_compListBox->GetCount();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2015-07-01 10:55:41 +00:00
|
|
|
int candidate = -1;
|
|
|
|
|
|
|
|
for( int jj = first_selected-1; jj >= 0; jj-- )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2015-07-01 10:55:41 +00:00
|
|
|
if( m_netlist.GetComponent( jj )->GetFPID().empty() )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2015-07-01 10:55:41 +00:00
|
|
|
candidate = jj;
|
|
|
|
break;
|
2009-04-23 15:02:18 +00:00
|
|
|
}
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
2015-07-01 10:55:41 +00:00
|
|
|
|
|
|
|
if( candidate >= 0 )
|
|
|
|
{
|
|
|
|
m_compListBox->DeselectAll();
|
|
|
|
m_compListBox->SetSelection( candidate );
|
|
|
|
SendMessageToEESCHEMA();
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-20 22:13:36 +00:00
|
|
|
void CVPCB_MAINFRAME::OnEscapeKey( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
Close( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-03-24 18:28:35 +00:00
|
|
|
SaveFootprintAssociation( false );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2015-06-07 18:18:45 +00:00
|
|
|
m_modified = false;
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
Close( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::OnSaveAndContinue( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
SaveFootprintAssociation( true );
|
|
|
|
|
|
|
|
m_modified = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::OnCancel( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
// Throw away modifications on a Cancel
|
|
|
|
m_modified = false;
|
|
|
|
|
|
|
|
Close( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
Close( false );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2019-06-20 22:27:58 +00:00
|
|
|
void CVPCB_MAINFRAME::CutAssociation( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2019-06-20 22:27:58 +00:00
|
|
|
int itmIdx = m_compListBox->GetFirstSelected();
|
|
|
|
|
|
|
|
if( itmIdx == -1 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( m_netlist.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
COMPONENT* component = m_netlist.GetComponent( itmIdx );
|
|
|
|
|
|
|
|
if( component && component->GetFPID().IsValid() )
|
|
|
|
{
|
|
|
|
m_clipboardBuffer = component->GetFPID().Format().wx_str();
|
|
|
|
|
|
|
|
SetNewPkg( wxEmptyString, itmIdx );
|
|
|
|
m_compListBox->RefreshItem( itmIdx );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::CopyAssociation( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int itmIdx = m_compListBox->GetFirstSelected();
|
|
|
|
|
|
|
|
if( itmIdx == -1 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( m_netlist.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
COMPONENT* component = m_netlist.GetComponent( itmIdx );
|
|
|
|
|
|
|
|
if( component && component->GetFPID().IsValid() )
|
|
|
|
m_clipboardBuffer = component->GetFPID().Format().wx_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::PasteAssociation( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( m_clipboardBuffer.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
int itmIdx = m_compListBox->GetFirstSelected();
|
|
|
|
|
|
|
|
while( itmIdx != -1 )
|
|
|
|
{
|
|
|
|
SetNewPkg( m_clipboardBuffer, itmIdx );
|
|
|
|
m_compListBox->RefreshItem( itmIdx );
|
|
|
|
|
|
|
|
itmIdx = m_compListBox->GetNextSelected( itmIdx );
|
|
|
|
}
|
|
|
|
|
|
|
|
DisplayStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::DelAssociation( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int itmIdx = m_compListBox->GetFirstSelected();
|
|
|
|
|
|
|
|
while( itmIdx != -1 )
|
|
|
|
{
|
|
|
|
SetNewPkg( wxEmptyString, itmIdx );
|
|
|
|
m_compListBox->RefreshItem( itmIdx );
|
|
|
|
|
|
|
|
itmIdx = m_compListBox->GetNextSelected( itmIdx );
|
|
|
|
}
|
|
|
|
|
|
|
|
DisplayStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::DelAllAssociations( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( IsOK( this, _( "Delete all footprint assocations?" ) ) )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = true;
|
2015-07-01 10:55:41 +00:00
|
|
|
|
|
|
|
// Remove all selections to avoid issues when setting the fpids
|
|
|
|
m_compListBox->DeselectAll();
|
2009-05-06 11:55:36 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2016-11-20 23:35:08 +00:00
|
|
|
LIB_ID fpid;
|
2013-09-08 18:31:21 +00:00
|
|
|
|
|
|
|
m_netlist.GetComponent( i )->SetFPID( fpid );
|
2007-12-04 18:23:38 +00:00
|
|
|
SetNewPkg( wxEmptyString );
|
|
|
|
}
|
|
|
|
|
2015-07-01 10:55:41 +00:00
|
|
|
// Remove all selections after setting the fpids
|
|
|
|
m_compListBox->DeselectAll();
|
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = false;
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( 0 );
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2010-11-07 20:06:07 +00:00
|
|
|
DisplayStatus();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
|
|
|
{
|
2015-01-01 15:46:11 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-14 20:33:22 +00:00
|
|
|
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
|
|
|
{
|
2018-08-06 18:33:28 +00:00
|
|
|
KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
|
|
|
|
kiface->CreateWindow( this, DIALOG_PCB_LIBRARY_TABLE, &Kiway() );
|
2018-05-01 20:46:05 +00:00
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
wxBusyCursor dummy;
|
|
|
|
BuildLIBRARY_LISTBOX();
|
|
|
|
m_FootprintsList->ReadFootprintFiles( Prj().PcbFootprintLibs( Kiway() ) );
|
2013-09-14 20:33:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
CreateScreenCmp();
|
2016-01-06 07:36:08 +00:00
|
|
|
GetFootprintViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-17 21:14:02 +00:00
|
|
|
void CVPCB_MAINFRAME::OnComponentRightClick( wxMouseEvent& event )
|
|
|
|
{
|
|
|
|
wxMenu menu;
|
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ),
|
2019-06-20 22:27:58 +00:00
|
|
|
_( "Show the assigned footprint in the footprint viewer" ) );
|
|
|
|
|
|
|
|
menu.Append( ID_CVPCB_CUT_ASSOCIATION, _( "Cut Footprint Association" ),
|
|
|
|
_( "Cut the assigned footprint" ) );
|
|
|
|
menu.Append( ID_CVPCB_COPY_ASSOCIATION, _( "Copy Footprint Association" ),
|
|
|
|
_( "Copy the assigned footprint" ) );
|
|
|
|
menu.Append( ID_CVPCB_PASTE_ASSOCIATION, _( "Paste Footprint Association" ),
|
|
|
|
_( "Paste a footprint assignment" ) );
|
|
|
|
|
|
|
|
menu.Append( ID_CVPCB_DEL_ASSOCIATION, _( "Delete Footprint Association" ),
|
|
|
|
_( "Delete the assigned footprint" ) );
|
2018-07-17 21:14:02 +00:00
|
|
|
|
|
|
|
PopupMenu( &menu );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-22 13:51:30 +00:00
|
|
|
void CVPCB_MAINFRAME::OnFootprintRightClick( wxMouseEvent& event )
|
|
|
|
{
|
|
|
|
wxMenu menu;
|
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ),
|
|
|
|
_( "Show the current footprint in the footprint viewer" ) );
|
2018-05-22 13:51:30 +00:00
|
|
|
|
|
|
|
PopupMenu( &menu );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
if( m_skipComponentSelect )
|
|
|
|
return;
|
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
wxString libraryName;
|
2016-02-24 16:30:35 +00:00
|
|
|
COMPONENT* component = GetSelectedComponent();
|
|
|
|
libraryName = m_libListBox->GetSelectedLibrary();
|
2016-02-25 09:52:29 +00:00
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
|
2016-02-25 13:57:59 +00:00
|
|
|
m_currentSearchPattern, m_filteringOptions);
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2018-09-22 15:20:45 +00:00
|
|
|
if( component && component->GetFPID().IsValid() )
|
|
|
|
m_footprintListBox->SetSelectedFootprint( component->GetFPID() );
|
|
|
|
else
|
|
|
|
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
|
2018-07-01 15:22:33 +00:00
|
|
|
|
2016-02-25 13:57:59 +00:00
|
|
|
refreshAfterComponentSearch (component);
|
2016-02-24 16:30:35 +00:00
|
|
|
}
|
2014-02-27 00:57:18 +00:00
|
|
|
|
2011-12-14 20:23:32 +00:00
|
|
|
|
2016-02-25 13:57:59 +00:00
|
|
|
void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
|
2016-02-24 16:30:35 +00:00
|
|
|
{
|
2016-02-25 09:52:29 +00:00
|
|
|
// Tell AuiMgr that objects are changed !
|
|
|
|
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
|
|
|
|
// (could be not the case when starting CvPcb
|
|
|
|
m_auimgr.Update();
|
2016-02-24 16:30:35 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
if( component == NULL )
|
2018-03-24 18:28:35 +00:00
|
|
|
{
|
|
|
|
DisplayStatus();
|
2016-02-25 09:52:29 +00:00
|
|
|
return;
|
2018-03-24 18:28:35 +00:00
|
|
|
}
|
2016-02-24 16:30:35 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
// Preview of the already assigned footprint.
|
|
|
|
// Find the footprint that was already chosen for this component and select it,
|
|
|
|
// but only if the selection is made from the component list or the library list.
|
|
|
|
// If the selection is made from the footprint list, do not change the current
|
|
|
|
// selected footprint.
|
|
|
|
if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
|
|
|
|
{
|
|
|
|
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
|
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
|
2012-05-25 06:58:52 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
wxString footprintName;
|
|
|
|
wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
|
|
|
|
msg.Trim( true );
|
|
|
|
msg.Trim( false );
|
|
|
|
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
2016-02-24 16:30:35 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
if( module.Cmp( footprintName ) == 0 )
|
2012-05-25 06:58:52 +00:00
|
|
|
{
|
2016-02-25 09:52:29 +00:00
|
|
|
m_footprintListBox->SetSelection( ii, true );
|
|
|
|
break;
|
2012-05-25 06:58:52 +00:00
|
|
|
}
|
2016-02-25 09:52:29 +00:00
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
if( GetFootprintViewerFrame() )
|
|
|
|
CreateScreenCmp();
|
2016-02-25 09:52:29 +00:00
|
|
|
}
|
2011-12-14 20:23:32 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
SendMessageToEESCHEMA();
|
|
|
|
DisplayStatus();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2019-06-15 16:05:33 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2016-02-25 09:52:29 +00:00
|
|
|
int option = 0;
|
|
|
|
|
|
|
|
switch( event.GetId() )
|
|
|
|
{
|
|
|
|
case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST:
|
|
|
|
option = FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST:
|
|
|
|
option = FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST:
|
|
|
|
option = FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME:
|
2016-02-25 13:57:59 +00:00
|
|
|
m_currentSearchPattern = m_tcFilterString->GetValue();
|
2016-02-25 09:52:29 +00:00
|
|
|
option = FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( event.IsChecked() )
|
|
|
|
m_filteringOptions |= option;
|
|
|
|
else
|
|
|
|
m_filteringOptions &= ~option;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
wxListEvent l_event;
|
2007-12-04 18:23:38 +00:00
|
|
|
OnSelectComponent( l_event );
|
|
|
|
}
|
2009-04-23 15:02:18 +00:00
|
|
|
|
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
void CVPCB_MAINFRAME::OnFilterFPbyKeywords( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::OnFilterFPbyPinCount( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::OnFilterFPbyLibrary( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::OnFilterFPbyKeyName( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME );
|
2009-04-23 15:02:18 +00:00
|
|
|
}
|
2010-11-07 20:06:07 +00:00
|
|
|
|
|
|
|
|
2016-02-25 13:57:59 +00:00
|
|
|
void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
// Called when changing the filter string in main toolbar.
|
|
|
|
// If the option FOOTPRINTS_LISTBOX::FILTERING_BY_NAME is set, update the list of
|
|
|
|
// available footprints which match the filter
|
|
|
|
|
|
|
|
m_currentSearchPattern = m_tcFilterString->GetValue();
|
|
|
|
|
|
|
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) == 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
OnSelectFilteringFootprint( aEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DisplayStatus()
|
2010-11-07 20:06:07 +00:00
|
|
|
{
|
2018-03-25 23:52:02 +00:00
|
|
|
if( !m_initialized )
|
|
|
|
return;
|
2011-08-04 11:23:19 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
wxString filters, msg;
|
|
|
|
COMPONENT* component = GetSelectedComponent();
|
2010-11-07 20:06:07 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD ) )
|
|
|
|
{
|
2013-06-08 16:06:26 +00:00
|
|
|
msg.Empty();
|
2010-11-07 20:06:07 +00:00
|
|
|
|
2013-06-08 16:06:26 +00:00
|
|
|
if( component )
|
2013-06-06 15:37:48 +00:00
|
|
|
{
|
2013-06-08 16:06:26 +00:00
|
|
|
for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
if( msg.IsEmpty() )
|
|
|
|
msg += component->GetFootprintFilters()[ii];
|
|
|
|
else
|
|
|
|
msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
|
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
filters += _( "key words" ) + wxString::Format( wxT( " (%s)" ), msg );
|
2013-06-08 16:06:26 +00:00
|
|
|
}
|
2018-03-24 18:28:35 +00:00
|
|
|
|
|
|
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
|
2013-06-08 16:06:26 +00:00
|
|
|
{
|
2018-03-24 18:28:35 +00:00
|
|
|
msg.Empty();
|
2013-12-09 18:09:58 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( component )
|
2018-03-26 18:55:59 +00:00
|
|
|
msg = wxString::Format( wxT( "%i" ), component->GetPinCount() );
|
2013-06-08 16:06:26 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( !filters.IsEmpty() )
|
|
|
|
filters += wxT( ", " );
|
2013-06-08 16:06:26 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
filters += _( "pin count" ) + wxString::Format( wxT( " (%s)" ), msg );
|
2010-11-07 20:06:07 +00:00
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2018-03-24 18:28:35 +00:00
|
|
|
msg = m_libListBox->GetSelectedLibrary();
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( !filters.IsEmpty() )
|
|
|
|
filters += wxT( ", " );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
filters += _( "library" ) + wxString::Format( wxT( " (%s)" ), msg );
|
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) )
|
|
|
|
{
|
|
|
|
if( !filters.IsEmpty() )
|
|
|
|
filters += wxT( ", " );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
filters += _( "search text" );
|
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( filters.IsEmpty() )
|
|
|
|
msg = _( "No filtering" );
|
|
|
|
else
|
|
|
|
msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
|
|
|
|
|
|
|
|
msg << wxT( ": " ) << m_footprintListBox->GetCount();
|
|
|
|
|
2018-04-12 11:02:01 +00:00
|
|
|
SetStatusText( msg );
|
2016-02-24 16:30:35 +00:00
|
|
|
|
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
msg.Empty();
|
|
|
|
wxString footprintName = GetSelectedFootprint();
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
if( module ) // can be NULL if no netlist loaded
|
|
|
|
{
|
|
|
|
msg = wxString::Format( _( "Description: %s; Key words: %s" ),
|
2018-07-27 20:47:51 +00:00
|
|
|
module->GetDescription(),
|
2018-03-24 18:28:35 +00:00
|
|
|
module->GetKeywords() );
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
2018-03-24 18:28:35 +00:00
|
|
|
|
2018-04-12 11:02:01 +00:00
|
|
|
SetStatusText( msg, 1 );
|
2019-05-27 23:21:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
msg.Empty();
|
|
|
|
|
|
|
|
if( module ) // can be NULL if no netlist loaded
|
|
|
|
{
|
|
|
|
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
|
|
|
|
|
|
|
|
wxString modLib = module->GetLibNickname();
|
|
|
|
|
|
|
|
if( fptbl->HasLibrary( modLib ) )
|
|
|
|
{
|
|
|
|
msg = wxString::Format( _( "Library location: %s" ),
|
|
|
|
fptbl->GetFullURI( modLib ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetStatusText( msg, 2 );
|
2010-11-07 20:06:07 +00:00
|
|
|
}
|
2011-02-22 17:59:46 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
|
|
|
|
bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
2011-02-22 17:59:46 +00:00
|
|
|
{
|
2017-03-23 00:59:25 +00:00
|
|
|
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
|
* 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
|
|
|
|
2014-01-17 20:26:27 +00:00
|
|
|
// Check if there are footprint libraries in the footprint library table.
|
* 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
|
|
|
if( !fptbl || !fptbl->GetLogicalLibs().size() )
|
2011-02-22 17:59:46 +00:00
|
|
|
{
|
2014-01-17 20:26:27 +00:00
|
|
|
wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
|
|
|
|
"library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
|
2011-02-22 17:59:46 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-02-10 13:32:57 +00:00
|
|
|
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
|
2016-04-08 16:45:11 +00:00
|
|
|
|
2018-02-10 13:32:57 +00:00
|
|
|
m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
|
2011-02-22 17:59:46 +00:00
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
if( m_FootprintsList->GetErrorCount() )
|
2011-02-22 17:59:46 +00:00
|
|
|
{
|
2017-03-23 00:59:25 +00:00
|
|
|
m_FootprintsList->DisplayErrors( this );
|
2011-02-22 17:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
|
2011-10-12 13:09:12 +00:00
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
if( m_netlist.IsEmpty() )
|
2011-10-12 13:09:12 +00:00
|
|
|
return;
|
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
// clear highlight of previously selected components (if any):
|
|
|
|
// Selecting a non existing symbol clears any previously highlighted symbols
|
2018-12-31 12:54:26 +00:00
|
|
|
std::string packet = "$CLEAR: \"HIGHLIGHTED\"";
|
2018-12-29 08:39:08 +00:00
|
|
|
|
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
SendCommand( MSG_TO_SCH, packet.c_str() );
|
|
|
|
else
|
|
|
|
Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
|
|
|
|
|
|
|
|
if( aClearHighligntOnly )
|
|
|
|
return;
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
int selection = m_compListBox->GetSelection();
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
if ( selection < 0 ) // Nothing selected
|
|
|
|
return;
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
if( m_netlist.GetComponent( selection ) == NULL )
|
2011-12-14 20:23:32 +00:00
|
|
|
return;
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
// Now highlight the selected component:
|
2014-04-22 15:16:19 +00:00
|
|
|
COMPONENT* component = m_netlist.GetComponent( selection );
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2014-04-22 15:16:19 +00:00
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
SendCommand( MSG_TO_SCH, packet.c_str() );
|
|
|
|
else
|
|
|
|
Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
|
2011-10-12 13:09:12 +00:00
|
|
|
}
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
|
2015-06-07 18:18:45 +00:00
|
|
|
int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2015-06-07 18:18:45 +00:00
|
|
|
STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
|
|
|
|
KICAD_NETLIST_READER netrdr( strrdr, &m_netlist );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
m_netlist.Clear();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2015-06-07 18:18:45 +00:00
|
|
|
netrdr.LoadNetlist();
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
2014-04-09 13:33:04 +00:00
|
|
|
catch( const IO_ERROR& ioe )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2019-06-15 16:05:33 +00:00
|
|
|
wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
|
|
|
|
ioe.What().GetData() );
|
2018-03-24 18:28:35 +00:00
|
|
|
wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
|
2013-04-26 15:11:52 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We also remove footprint name if it is "$noname" because this is a dummy name,
|
|
|
|
// not the actual name of the footprint.
|
|
|
|
for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
|
|
|
|
{
|
2016-11-20 23:35:08 +00:00
|
|
|
if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
|
2017-07-25 19:14:31 +00:00
|
|
|
m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sort components by reference:
|
|
|
|
m_netlist.SortByReference();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::CreateScreenCmp()
|
|
|
|
{
|
2016-01-06 07:36:08 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFootprintViewerFrame();
|
2014-03-21 11:50:04 +00:00
|
|
|
|
|
|
|
if( !fpframe )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2018-07-01 14:48:35 +00:00
|
|
|
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) Kiway().Player( FRAME_CVPCB_DISPLAY, true, this );
|
2014-03-21 11:50:04 +00:00
|
|
|
fpframe->Show( true );
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-21 11:50:04 +00:00
|
|
|
if( fpframe->IsIconized() )
|
|
|
|
fpframe->Iconize( false );
|
2014-02-07 18:36:12 +00:00
|
|
|
|
|
|
|
// The display footprint window might be buried under some other
|
|
|
|
// windows, so CreateScreenCmp() on an existing window would not
|
|
|
|
// show any difference, leaving the user confused.
|
|
|
|
// So we want to put it to front, second after our CVPCB_MAINFRAME.
|
|
|
|
// We do this by a little dance of bringing it to front then the main
|
|
|
|
// frame back.
|
2019-04-11 11:32:44 +00:00
|
|
|
wxWindow* focus = FindFocus();
|
|
|
|
|
2014-03-21 11:50:04 +00:00
|
|
|
fpframe->Raise(); // Make sure that is visible.
|
|
|
|
Raise(); // .. but still we want the focus.
|
2019-04-11 11:32:44 +00:00
|
|
|
|
2019-05-10 18:59:44 +00:00
|
|
|
if( focus )
|
|
|
|
focus->SetFocus();
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
2014-03-21 11:50:04 +00:00
|
|
|
fpframe->InitDisplay();
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
|
|
|
|
{
|
|
|
|
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_footprintListBox == NULL )
|
2013-06-06 15:37:48 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_footprintListBox = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST,
|
2014-08-13 19:26:31 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize );
|
2014-07-05 20:42:59 +00:00
|
|
|
m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(),
|
2014-08-13 19:26:31 +00:00
|
|
|
wxFONTFAMILY_MODERN,
|
|
|
|
wxFONTSTYLE_NORMAL,
|
|
|
|
wxFONTWEIGHT_NORMAL ) );
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, NULL,
|
2019-06-15 16:05:33 +00:00
|
|
|
wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
|
2013-06-06 15:37:48 +00:00
|
|
|
DisplayStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::BuildCmpListBox()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
COMPONENT* component;
|
|
|
|
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_compListBox == NULL )
|
2013-06-06 15:37:48 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST,
|
2014-08-13 19:26:31 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize );
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetFont( wxFont( guiFont.GetPointSize(),
|
2014-08-13 19:26:31 +00:00
|
|
|
wxFONTFAMILY_MODERN,
|
|
|
|
wxFONTSTYLE_NORMAL,
|
|
|
|
wxFONTWEIGHT_NORMAL ) );
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->m_ComponentList.Clear();
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
|
|
|
{
|
|
|
|
component = m_netlist.GetComponent( i );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
|
2013-06-06 15:37:48 +00:00
|
|
|
GetChars( component->GetReference() ),
|
|
|
|
GetChars( component->GetValue() ),
|
2013-09-08 18:31:21 +00:00
|
|
|
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->m_ComponentList.Add( msg );
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_compListBox->m_ComponentList.Count() )
|
2013-09-14 20:33:22 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
|
|
|
|
m_compListBox->SetSelection( 0, true );
|
|
|
|
m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );
|
2014-11-12 10:46:40 +00:00
|
|
|
m_compListBox->UpdateWidth();
|
2013-09-14 20:33:22 +00:00
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
|
|
|
|
{
|
|
|
|
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_libListBox == NULL )
|
2013-06-06 15:37:48 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_libListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST,
|
2014-08-13 19:26:31 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize );
|
2014-07-05 20:42:59 +00:00
|
|
|
m_libListBox->SetFont( wxFont( guiFont.GetPointSize(),
|
2014-08-13 19:26:31 +00:00
|
|
|
wxFONTFAMILY_MODERN,
|
|
|
|
wxFONTSTYLE_NORMAL,
|
|
|
|
wxFONTWEIGHT_NORMAL ) );
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
|
2014-05-09 18:35:48 +00:00
|
|
|
|
|
|
|
if( tbl )
|
2013-09-14 20:33:22 +00:00
|
|
|
{
|
|
|
|
wxArrayString libNames;
|
|
|
|
|
2014-05-09 18:35:48 +00:00
|
|
|
std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
|
2013-09-14 20:33:22 +00:00
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
|
|
|
|
libNames.Add( libNickNames[ii] );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
m_libListBox->SetLibraryList( libNames );
|
2013-09-14 20:33:22 +00:00
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
|
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
int selection = m_compListBox->GetSelection();
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
if( selection >= 0 && selection < (int) m_netlist.GetCount() )
|
|
|
|
return m_netlist.GetComponent( selection );
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-03-21 11:50:04 +00:00
|
|
|
|
|
|
|
|
2016-01-06 07:36:08 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFootprintViewerFrame()
|
2014-03-21 11:50:04 +00:00
|
|
|
{
|
|
|
|
// returns the Footprint Viewer frame, if exists, or NULL
|
2015-12-21 11:52:00 +00:00
|
|
|
return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>
|
|
|
|
( wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ) );
|
2014-03-21 11:50:04 +00:00
|
|
|
}
|
2015-03-29 21:22:53 +00:00
|
|
|
|
2018-04-12 11:02:01 +00:00
|
|
|
|
|
|
|
wxString CVPCB_MAINFRAME::GetSelectedFootprint()
|
2016-02-25 09:52:29 +00:00
|
|
|
{
|
2016-11-20 23:35:08 +00:00
|
|
|
// returns the LIB_ID of the selected footprint in footprint listview
|
2016-02-25 09:52:29 +00:00
|
|
|
// or a empty string
|
|
|
|
return m_footprintListBox->GetSelectedFootprint();
|
|
|
|
}
|
|
|
|
|
2015-03-29 21:22:53 +00:00
|
|
|
|
2018-04-12 11:02:01 +00:00
|
|
|
void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
|
|
|
|
{
|
2019-05-27 23:21:22 +00:00
|
|
|
wxASSERT( aNumber < 3 );
|
2018-04-12 11:02:01 +00:00
|
|
|
|
2019-05-27 23:21:22 +00:00
|
|
|
if( aNumber == 2 )
|
|
|
|
m_statusLine3->SetLabel( aText );
|
|
|
|
else if( aNumber == 1 )
|
2018-04-12 11:02:01 +00:00
|
|
|
m_statusLine2->SetLabel( aText );
|
|
|
|
else
|
|
|
|
m_statusLine1->SetLabel( aText );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-29 21:22:53 +00:00
|
|
|
void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent )
|
|
|
|
{
|
2018-05-14 17:34:18 +00:00
|
|
|
DIALOG_CONFIGURE_PATHS dlg( this, Prj().Get3DCacheManager()->GetResolver() );
|
|
|
|
dlg.ShowModal();
|
2015-03-29 21:22:53 +00:00
|
|
|
}
|
2015-06-07 18:18:45 +00:00
|
|
|
|
|
|
|
|
2018-02-03 22:55:13 +00:00
|
|
|
void CVPCB_MAINFRAME::ShowChangedLanguage()
|
|
|
|
{
|
|
|
|
EDA_BASE_FRAME::ShowChangedLanguage();
|
|
|
|
ReCreateHToolbar();
|
|
|
|
DisplayStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-07 18:18:45 +00:00
|
|
|
void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
|
|
|
{
|
|
|
|
const std::string& payload = mail.GetPayload();
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
//DBG(printf( "%s: %s\n", __func__, payload.c_str() );)
|
2015-06-07 18:18:45 +00:00
|
|
|
|
|
|
|
switch( mail.Command() )
|
|
|
|
{
|
|
|
|
case MAIL_EESCHEMA_NETLIST:
|
2021-08-06 18:22:03 +00:00
|
|
|
// Disable Close events during ReadNetListAndFpFiles() to avoid crash when updating
|
|
|
|
// widgets:
|
|
|
|
m_cannotClose = true;
|
2017-06-15 09:28:36 +00:00
|
|
|
ReadNetListAndFpFiles( payload );
|
2021-08-06 18:22:03 +00:00
|
|
|
m_cannotClose = false;
|
2015-06-07 18:18:45 +00:00
|
|
|
/* @todo
|
|
|
|
Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
|
2018-03-24 18:28:35 +00:00
|
|
|
case MAIL_STATUS:
|
2018-04-12 11:02:01 +00:00
|
|
|
SetStatusText( payload, 1 );
|
2018-03-24 18:28:35 +00:00
|
|
|
break;
|
|
|
|
|
2015-06-07 18:18:45 +00:00
|
|
|
default:
|
|
|
|
; // ignore most
|
|
|
|
}
|
|
|
|
}
|