2011-10-13 20:13:11 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-01-11 17:22:45 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras
|
2011-10-13 20:13:11 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file cvframe.cpp
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <build_version.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 <pgm_base.h>
|
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <macros.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <eda_doc.h>
|
|
|
|
#include <eda_dde.h>
|
|
|
|
#include <gestfich.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <html_messagebox.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
|
|
|
#include <fp_lib_table.h>
|
|
|
|
#include <netlist_reader.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
|
|
|
#include <cvpcb_mainframe.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <cvpcb.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <cvstruct.h>
|
2013-10-13 21:33:58 +00:00
|
|
|
#include <invoke_pcb_dialog.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_DisplayFootprintsFrame.h>
|
|
|
|
#include <cvpcb_id.h>
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#define FRAME_MIN_SIZE_X 450
|
|
|
|
#define FRAME_MIN_SIZE_Y 300
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// option key to close CvPcb after saving files
|
2009-04-23 15:02:18 +00:00
|
|
|
static const wxString KeepCvpcbOpenEntry( wxT( "KeepCvpcbOpen" ) );
|
|
|
|
static const wxString FootprintDocFileEntry( wxT( "footprints_doc_file" ) );
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
|
2011-08-24 19:44:05 +00:00
|
|
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, CVPCB_MAINFRAME::LoadNetList )
|
|
|
|
|
|
|
|
// Menu events
|
|
|
|
EVT_MENU( ID_LOAD_PROJECT, CVPCB_MAINFRAME::LoadNetList )
|
|
|
|
EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::SaveQuitCvpcb )
|
|
|
|
EVT_MENU( wxID_SAVEAS, CVPCB_MAINFRAME::SaveQuitCvpcb )
|
|
|
|
EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
|
|
|
|
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
|
|
|
|
EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
|
|
|
|
EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile )
|
|
|
|
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
|
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
|
|
|
|
EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit )
|
|
|
|
EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST, CVPCB_MAINFRAME::LoadNetList )
|
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 )
|
|
|
|
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
|
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_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
|
|
|
|
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 )
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
// Frame events
|
|
|
|
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
|
|
|
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
|
|
|
|
|
|
|
EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
|
|
|
|
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 ) :
|
2014-04-19 18:47:20 +00:00
|
|
|
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), 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;
|
2009-04-23 15:02:18 +00:00
|
|
|
m_isEESchemaNetlist = false;
|
|
|
|
m_KeepCvpcbOpen = false;
|
|
|
|
m_undefinedComponentCnt = 0;
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = false;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
m_NetlistFileExtension = wxT( "net" );
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
/* Name of the document footprint list
|
|
|
|
* usually located in share/modules/footprints_doc
|
|
|
|
* this is of the responsibility to users to create this file
|
|
|
|
* if they want to have a list of footprints
|
|
|
|
*/
|
2009-11-05 19:26:52 +00:00
|
|
|
m_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME;
|
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
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( m_FrameSize.x < FRAME_MIN_SIZE_X )
|
|
|
|
m_FrameSize.x = FRAME_MIN_SIZE_X;
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
|
|
|
|
m_FrameSize.y = FRAME_MIN_SIZE_Y;
|
|
|
|
|
2009-11-07 14:36:54 +00:00
|
|
|
// Set minimal frame width and height
|
|
|
|
SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );
|
|
|
|
|
2014-08-13 19:26:31 +00:00
|
|
|
// Frame size and position
|
2009-11-07 14:36:54 +00:00
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
// create the status bar
|
2009-08-07 04:44:42 +00:00
|
|
|
static const int dims[3] = { -1, -1, 250 };
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
CreateStatusBar( 3 );
|
|
|
|
SetStatusWidths( 3, dims );
|
2009-08-07 04:44:42 +00:00
|
|
|
|
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
|
|
|
|
2015-01-11 17:22:45 +00:00
|
|
|
UpdateTitle();
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2011-09-15 18:25:44 +00:00
|
|
|
EDA_PANEINFO horiz;
|
|
|
|
horiz.HorizontalToolbarPane();
|
|
|
|
|
|
|
|
EDA_PANEINFO info;
|
|
|
|
info.InfoToolbarPane();
|
|
|
|
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
if( m_mainToolBar )
|
|
|
|
m_auimgr.AddPane( m_mainToolBar,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_compListBox )
|
|
|
|
m_auimgr.AddPane( m_compListBox,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_libListBox)
|
|
|
|
m_auimgr.AddPane( m_libListBox,
|
|
|
|
wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
|
2013-05-31 17:33:46 +00:00
|
|
|
Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_footprintListBox )
|
|
|
|
m_auimgr.AddPane( m_footprintListBox,
|
|
|
|
wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
|
2013-05-31 17:33:46 +00:00
|
|
|
Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
|
|
|
m_auimgr.Update();
|
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
|
|
|
{
|
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 );
|
|
|
|
|
|
|
|
aCfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
|
|
|
|
aCfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
2014-08-13 19:26:31 +00:00
|
|
|
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
* 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 );
|
|
|
|
|
|
|
|
aCfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
|
|
|
aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
int state = 0;
|
|
|
|
|
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
|
|
|
state |= FOOTPRINTS_LISTBOX::BY_COMPONENT;
|
|
|
|
|
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
|
|
|
state |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT;
|
|
|
|
|
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
|
|
|
state |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
|
|
|
|
* 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
|
|
|
aCfg->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
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::OnQuit( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
Close( true );
|
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
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
int diag;
|
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
if( m_modified )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2012-03-08 17:47:23 +00:00
|
|
|
wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
|
|
|
|
int ii = DisplayExitDialog( this, msg );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
switch( ii )
|
|
|
|
{
|
|
|
|
case wxID_CANCEL:
|
|
|
|
Event.Veto();
|
|
|
|
return;
|
|
|
|
|
|
|
|
case wxID_NO:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_YES:
|
2012-02-11 09:04:26 +00:00
|
|
|
diag = SaveCmpLinkFile( m_NetlistFileName.GetFullPath() );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( diag > 0 )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2009-04-23 15:02:18 +00:00
|
|
|
m_modified = false;
|
2011-08-24 19:44:05 +00:00
|
|
|
}
|
2007-12-04 18:23:38 +00:00
|
|
|
else if( diag == 0 )
|
|
|
|
{
|
2012-02-11 09:04:26 +00:00
|
|
|
if( !IsOK( this, _( "Problem when saving file, exit anyway ?" ) ) )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2008-10-29 23:57:35 +00:00
|
|
|
Event.Veto();
|
2008-10-26 12:11:11 +00:00
|
|
|
return;
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( m_NetlistFileName.IsOk() )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2011-03-17 19:14:45 +00:00
|
|
|
UpdateFileHistory( m_NetlistFileName.GetFullPath() );
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
// Close module display frame
|
2014-03-21 11:50:04 +00:00
|
|
|
if( GetFpViewerFrame() )
|
|
|
|
GetFpViewerFrame()->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
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
Destroy();
|
|
|
|
return;
|
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
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
long selection = m_compListBox->GetFirstSelected();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( selection < 0 )
|
2013-06-09 16:36:54 +00:00
|
|
|
selection = -1; // We will start to 0 for the first search , if no item selected
|
2008-10-29 23:57:35 +00:00
|
|
|
|
2013-06-09 16:36:54 +00:00
|
|
|
for( unsigned jj = selection+1; jj < 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
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( wxNOT_FOUND, false ); // Remove all selections
|
|
|
|
m_compListBox->SetSelection( jj );
|
2011-10-12 13:09:12 +00:00
|
|
|
SendMessageToEESCHEMA();
|
2009-04-23 15:02:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
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
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
int selection = m_compListBox->GetFirstSelected();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( selection < 0 )
|
2014-07-05 20:42:59 +00:00
|
|
|
selection = m_compListBox->GetCount();
|
2013-06-09 16:36:54 +00:00
|
|
|
else
|
2014-07-05 20:42:59 +00:00
|
|
|
while( m_compListBox->GetNextSelected( selection ) >= 0 )
|
|
|
|
selection = m_compListBox->GetNextSelected( selection );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2013-06-09 16:36:54 +00:00
|
|
|
for( int kk = selection-1; kk >= 0; kk-- )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2013-09-08 18:31:21 +00:00
|
|
|
if( m_netlist.GetComponent( kk )->GetFPID().empty() )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( wxNOT_FOUND, false ); // Remove all selections
|
|
|
|
m_compListBox->SetSelection( kk );
|
2011-10-12 13:09:12 +00:00
|
|
|
SendMessageToEESCHEMA();
|
2009-04-23 15:02:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2015-01-11 17:22:45 +00:00
|
|
|
wxString fullFilename;
|
|
|
|
|
|
|
|
if( aEvent.GetId() != wxID_SAVEAS )
|
|
|
|
fullFilename = m_NetlistFileName.GetFullPath();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2015-01-11 17:22:45 +00:00
|
|
|
if( SaveCmpLinkFile( fullFilename ) > 0 )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2009-04-23 15:02:18 +00:00
|
|
|
m_modified = false;
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
if( !m_KeepCvpcbOpen )
|
2011-08-04 11:23:19 +00:00
|
|
|
Close( true );
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
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::DelAssociations( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
wxString Line;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
if( IsOK( this, _( "Delete selections" ) ) )
|
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = true;
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( 0 );
|
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
|
|
|
{
|
2013-09-08 18:31:21 +00:00
|
|
|
FPID fpid;
|
|
|
|
|
|
|
|
m_netlist.GetComponent( i )->SetFPID( fpid );
|
2007-12-04 18:23:38 +00:00
|
|
|
SetNewPkg( wxEmptyString );
|
|
|
|
}
|
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = false;
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( 0 );
|
2013-04-25 16:29:35 +00:00
|
|
|
m_undefinedComponentCnt = m_netlist.GetCount();
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
int id = event.GetId();
|
* 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
|
|
|
wxFileName newFileName;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
if( id >= wxID_FILE1 && id <= wxID_FILE9 )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
|
|
|
newFileName = GetFileFromHistory( id, _( "Netlist" ) );
|
|
|
|
}
|
|
|
|
else
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2010-05-17 20:35:46 +00:00
|
|
|
wxFileDialog dlg( this, _( "Open Net List" ), wxGetCwd(),
|
|
|
|
wxEmptyString, NetlistFileWildcard,
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
newFileName = dlg.GetPath();
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( newFileName == m_NetlistFileName )
|
|
|
|
return;
|
|
|
|
|
* 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
|
|
|
OpenProjectFiles( std::vector<wxString>( 1, newFileName.GetFullPath() ) );
|
|
|
|
}
|
|
|
|
|
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
|
|
|
bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
|
|
|
{
|
2015-01-01 15:46:11 +00:00
|
|
|
if( aFileSet.size() != 1 ) // Unexpected comand
|
|
|
|
return false;
|
|
|
|
|
|
|
|
m_NetlistFileName = aFileSet[0];
|
2014-03-20 06:24:33 +00:00
|
|
|
|
2015-01-01 15:46:11 +00:00
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
{
|
|
|
|
// PROJECT::SetProjectFullName() is an impactful function. It should only be
|
|
|
|
// called under carefully considered circumstances.
|
|
|
|
|
|
|
|
// The calling code should know not to ask me here to change projects unless
|
|
|
|
// it knows what consequences that will have on other KIFACEs running and using
|
|
|
|
// this same PROJECT. It can be very harmful if that calling code is stupid.
|
|
|
|
//
|
|
|
|
// In Cvpcb, we call SetProjectFullName only in Single mode, i.e. it is not
|
|
|
|
// called from a project
|
|
|
|
wxFileName pro = m_NetlistFileName;
|
|
|
|
pro.SetExt( ProjectFileExtension );
|
|
|
|
Prj().SetProjectFullName( pro.GetFullPath() );
|
* 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
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2015-01-04 10:50:45 +00:00
|
|
|
ReadNetListAndLinkFiles();
|
|
|
|
|
|
|
|
UpdateTitle();
|
|
|
|
|
|
|
|
// Resize the components list box. This is needed in case the
|
|
|
|
// contents have shrunk compared to the previous netlist.
|
|
|
|
m_compListBox->UpdateWidth();
|
|
|
|
|
|
|
|
// OSX need it since some objects are "rebuild" just make aware AUI
|
|
|
|
// Fixes #1258081
|
|
|
|
m_auimgr.Update();
|
|
|
|
|
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 )
|
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
bool tableChanged = false;
|
2014-05-09 18:35:48 +00:00
|
|
|
int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
|
2013-09-14 20:33:22 +00:00
|
|
|
|
|
|
|
if( r & 1 )
|
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName();
|
|
|
|
|
2013-11-12 01:05:23 +00:00
|
|
|
try
|
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
GFootprintTable.Save( fileName );
|
2013-11-12 01:05:23 +00:00
|
|
|
tableChanged = true;
|
|
|
|
}
|
* 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
|
|
|
catch( const IO_ERROR& ioe )
|
2013-11-12 01:05:23 +00:00
|
|
|
{
|
2014-08-13 19:26:31 +00:00
|
|
|
wxString msg = wxString::Format(
|
|
|
|
_( "Error occurred saving the global footprint library table:\n'%s'\n%s" ),
|
2014-03-21 01:24:35 +00:00
|
|
|
GetChars( fileName ),
|
|
|
|
GetChars( ioe.errorText )
|
|
|
|
);
|
2013-11-12 01:05:23 +00:00
|
|
|
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
|
|
|
}
|
2013-09-14 20:33:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( r & 2 )
|
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
wxString fileName = Prj().FootprintLibTblName();
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2013-11-12 01:05:23 +00:00
|
|
|
try
|
|
|
|
{
|
2014-05-09 18:35:48 +00:00
|
|
|
Prj().PcbFootprintLibs()->Save( fileName );
|
2013-11-12 01:05:23 +00:00
|
|
|
tableChanged = true;
|
|
|
|
}
|
2014-03-21 01:24:35 +00:00
|
|
|
catch( const IO_ERROR& ioe )
|
2013-11-12 01:05:23 +00:00
|
|
|
{
|
2014-08-13 19:26:31 +00:00
|
|
|
wxString msg = wxString::Format(
|
|
|
|
_( "Error occurred saving the project footprint library table:\n'%s'\n%s" ),
|
2014-03-21 01:24:35 +00:00
|
|
|
GetChars( fileName ),
|
|
|
|
GetChars( ioe.errorText )
|
|
|
|
);
|
2013-11-12 01:05:23 +00:00
|
|
|
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
|
|
|
}
|
2013-09-14 20:33:22 +00:00
|
|
|
}
|
2013-11-12 01:05:23 +00:00
|
|
|
|
|
|
|
if( tableChanged )
|
2013-12-18 16:36:07 +00:00
|
|
|
{
|
2013-11-12 01:05:23 +00:00
|
|
|
BuildLIBRARY_LISTBOX();
|
2014-05-09 18:35:48 +00:00
|
|
|
m_footprints.ReadFootprintFiles( Prj().PcbFootprintLibs() );
|
2013-12-18 16:36:07 +00:00
|
|
|
}
|
2013-09-14 20:33:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
|
|
|
m_KeepCvpcbOpen = event.IsChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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();
|
2014-03-21 11:50:04 +00:00
|
|
|
GetFpViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
|
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
|
|
|
GetAssociatedDocument( this, m_DocModulesFileName, &Kiface().KifaceSearch() );
|
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::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;
|
|
|
|
COMPONENT* component = NULL;
|
|
|
|
int filter = FOOTPRINTS_LISTBOX::UNFILTERED;
|
2011-12-18 20:22:16 +00:00
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
|
|
|
filter |= FOOTPRINTS_LISTBOX::BY_COMPONENT;
|
2011-12-18 20:22:16 +00:00
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
|
|
|
filter |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT;
|
2011-12-18 20:22:16 +00:00
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
|
|
|
filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
component = GetSelectedComponent();
|
2014-07-05 20:42:59 +00:00
|
|
|
libraryName = m_libListBox->GetSelectedLibrary();
|
|
|
|
m_footprintListBox->SetFootprints( m_footprints, libraryName, component, filter );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2014-02-27 00:57:18 +00:00
|
|
|
// Tell AuiMgr that objects are changed !
|
2014-03-21 11:50:04 +00:00
|
|
|
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
|
|
|
|
// (could be not the case when starting CvPcb
|
|
|
|
m_auimgr.Update();
|
2014-02-27 00:57:18 +00:00
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
if( component == NULL )
|
2007-12-04 18:23:38 +00:00
|
|
|
return;
|
2011-12-14 20:23:32 +00:00
|
|
|
|
|
|
|
// Preview of the already assigned footprint.
|
2013-06-06 15:37:48 +00:00
|
|
|
// Find the footprint that was already chosen for this component and select it,
|
2013-06-08 16:06:26 +00:00
|
|
|
// 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.
|
2014-07-05 20:42:59 +00:00
|
|
|
if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
|
2011-12-14 20:23:32 +00:00
|
|
|
{
|
2013-09-14 20:33:22 +00:00
|
|
|
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
|
2011-12-14 20:23:32 +00:00
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
bool found = false;
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
|
2011-12-18 20:22:16 +00:00
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
wxString footprintName;
|
2014-07-05 20:42:59 +00:00
|
|
|
wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
|
2012-05-25 06:58:52 +00:00
|
|
|
msg.Trim( true );
|
|
|
|
msg.Trim( false );
|
|
|
|
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
|
|
|
|
|
|
|
if( module.Cmp( footprintName ) == 0 )
|
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
m_footprintListBox->SetSelection( ii, true );
|
2012-05-25 06:58:52 +00:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
2011-12-18 20:22:16 +00:00
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
if( !found )
|
2011-12-18 20:22:16 +00:00
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
int ii = m_footprintListBox->GetSelection();
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
if ( ii >= 0 )
|
2014-07-05 20:42:59 +00:00
|
|
|
m_footprintListBox->SetSelection( ii, false );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2014-03-21 11:50:04 +00:00
|
|
|
if( GetFpViewerFrame() )
|
2012-05-25 06:58:52 +00:00
|
|
|
{
|
|
|
|
CreateScreenCmp();
|
|
|
|
}
|
2011-12-18 20:22:16 +00:00
|
|
|
}
|
2011-12-14 20:23:32 +00:00
|
|
|
}
|
|
|
|
|
2011-10-12 13:09:12 +00:00
|
|
|
SendMessageToEESCHEMA();
|
2010-11-07 20:06:07 +00:00
|
|
|
DisplayStatus();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
wxListEvent l_event;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
OnSelectComponent( l_event );
|
|
|
|
}
|
2009-04-23 15:02:18 +00:00
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
|
|
|
event.Check( m_KeepCvpcbOpen );
|
|
|
|
}
|
2010-11-07 20:06:07 +00:00
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DisplayStatus()
|
2010-11-07 20:06:07 +00:00
|
|
|
{
|
2013-06-06 15:37:48 +00:00
|
|
|
wxString msg;
|
|
|
|
COMPONENT* component;
|
2011-08-04 11:23:19 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox )
|
2013-06-08 16:06:26 +00:00
|
|
|
{
|
|
|
|
msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
|
|
|
|
m_undefinedComponentCnt );
|
|
|
|
SetStatusText( msg, 0 );
|
2010-11-07 20:06:07 +00:00
|
|
|
|
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
|
|
|
component = GetSelectedComponent();
|
2013-06-06 15:37:48 +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];
|
|
|
|
}
|
|
|
|
|
|
|
|
msg = _( "Filter list: " ) + msg;
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
2013-06-08 16:06:26 +00:00
|
|
|
SetStatusText( msg, 1 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-05 20:42:59 +00:00
|
|
|
wxString footprintName = m_footprintListBox->GetSelectedFootprint();
|
2013-12-09 18:09:58 +00:00
|
|
|
|
2013-12-12 16:01:03 +00:00
|
|
|
FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );
|
2013-06-08 16:06:26 +00:00
|
|
|
|
2013-06-09 16:36:54 +00:00
|
|
|
if( module ) // can be NULL if no netlist loaded
|
2013-06-08 16:06:26 +00:00
|
|
|
{
|
2013-12-12 16:01:03 +00:00
|
|
|
msg = _( "Description: " ) + module->GetDoc();
|
2013-06-08 16:06:26 +00:00
|
|
|
SetStatusText( msg, 0 );
|
|
|
|
|
2013-12-12 16:01:03 +00:00
|
|
|
msg = _( "Key words: " ) + module->GetKeywords();
|
2013-06-08 16:06:26 +00:00
|
|
|
SetStatusText( msg, 1 );
|
|
|
|
}
|
2010-11-07 20:06:07 +00:00
|
|
|
}
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
msg.Empty();
|
2015-01-11 18:35:02 +00:00
|
|
|
wxString filters;
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
if( m_footprintListBox )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2013-06-06 15:37:48 +00:00
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
2015-01-11 18:35:02 +00:00
|
|
|
filters = _( "key words" );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
|
|
|
{
|
2015-01-11 18:35:02 +00:00
|
|
|
if( !filters.IsEmpty() )
|
|
|
|
filters += wxT( "+" );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2015-01-11 18:35:02 +00:00
|
|
|
filters += _( "pin count" );
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
|
|
|
{
|
2015-01-11 18:35:02 +00:00
|
|
|
if( !filters.IsEmpty() )
|
|
|
|
filters += wxT( "+" );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2015-01-11 18:35:02 +00:00
|
|
|
filters += _( "library" );
|
2013-06-06 15:37:48 +00:00
|
|
|
}
|
|
|
|
|
2015-01-11 18:35:02 +00:00
|
|
|
if( filters.IsEmpty() )
|
2013-06-06 15:37:48 +00:00
|
|
|
msg = _( "No filtering" );
|
|
|
|
else
|
2015-01-11 18:35:02 +00:00
|
|
|
msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
|
2013-06-06 15:37:48 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
msg << wxT( ": " ) << m_footprintListBox->GetCount();
|
2013-06-06 15:37:48 +00:00
|
|
|
|
|
|
|
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
|
|
|
{
|
2014-05-09 18:35:48 +00:00
|
|
|
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
|
* 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;
|
|
|
|
}
|
|
|
|
|
* 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
|
|
|
m_footprints.ReadFootprintFiles( fptbl );
|
2011-02-22 17:59:46 +00:00
|
|
|
|
2013-12-09 18:09:58 +00:00
|
|
|
if( m_footprints.GetErrorCount() )
|
2011-02-22 17:59:46 +00:00
|
|
|
{
|
2013-12-09 18:09:58 +00:00
|
|
|
m_footprints.DisplayErrors( this );
|
2011-02-22 17:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::UpdateTitle()
|
|
|
|
{
|
* 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
|
|
|
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
|
2015-01-11 17:22:45 +00:00
|
|
|
PROJECT& prj = Prj();
|
|
|
|
wxFileName fn = prj.GetProjectFullName();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2015-01-11 18:35:02 +00:00
|
|
|
if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2015-01-11 17:22:45 +00:00
|
|
|
title += wxString::Format( _("Project: '%s' (netlist: '%s')"),
|
|
|
|
GetChars( fn.GetFullPath() ),
|
|
|
|
GetChars( m_NetlistFileName.GetFullName() )
|
|
|
|
);
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2015-01-11 17:22:45 +00:00
|
|
|
if( !fn.IsFileWritable() )
|
2011-08-24 19:44:05 +00:00
|
|
|
title += _( " [Read Only]" );
|
|
|
|
}
|
|
|
|
else
|
2015-01-11 17:22:45 +00:00
|
|
|
title += _( "[no project]" );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
SetTitle( title );
|
|
|
|
}
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2011-10-12 13:09:12 +00:00
|
|
|
void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
|
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
if( m_netlist.IsEmpty() )
|
2011-10-12 13:09:12 +00:00
|
|
|
return;
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
int selection = m_compListBox->GetSelection();
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2011-12-14 20:23:32 +00:00
|
|
|
if ( selection < 0 )
|
|
|
|
selection = 0;
|
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
|
|
|
|
2014-04-22 15:16:19 +00:00
|
|
|
COMPONENT* component = m_netlist.GetComponent( selection );
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2014-04-22 15:16:19 +00:00
|
|
|
std::string 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
|
|
|
|
|
|
|
|
|
|
|
int CVPCB_MAINFRAME::ReadSchematicNetlist()
|
|
|
|
{
|
|
|
|
wxBusyCursor dummy; // Shows an hourglass while loading.
|
|
|
|
NETLIST_READER* netlistReader;
|
|
|
|
wxString msg;
|
|
|
|
wxString compFootprintLinkFileName;
|
|
|
|
wxFileName fn = m_NetlistFileName;
|
|
|
|
|
2015-03-14 16:47:25 +00:00
|
|
|
// Ensure the netlist file exists, and wran the user if not:
|
|
|
|
if( ! wxFileExists( m_NetlistFileName.GetFullPath() ) )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "Unable to find netlist file:\n'%s'\n\nPlease, create it" ),
|
|
|
|
GetChars( m_NetlistFileName.GetFullPath() ) );
|
|
|
|
wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
// Load the footprint association file if it has already been created.
|
|
|
|
fn.SetExt( ComponentFileExtension );
|
|
|
|
|
|
|
|
if( fn.FileExists() && fn.IsFileReadable() )
|
|
|
|
compFootprintLinkFileName = fn.GetFullPath();
|
|
|
|
|
|
|
|
m_netlist.Clear();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
netlistReader = NETLIST_READER::GetNetlistReader( &m_netlist,
|
|
|
|
m_NetlistFileName.GetFullPath(),
|
|
|
|
compFootprintLinkFileName );
|
2013-05-25 10:41:24 +00:00
|
|
|
if( netlistReader != NULL )
|
|
|
|
{
|
|
|
|
std::auto_ptr< NETLIST_READER > nlr( netlistReader );
|
|
|
|
netlistReader->LoadNetlist();
|
|
|
|
}
|
|
|
|
else
|
2013-09-14 20:33:22 +00:00
|
|
|
wxMessageBox( _( "Unknown netlist format." ), wxEmptyString, wxOK | wxICON_ERROR );
|
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
|
|
|
{
|
|
|
|
msg = wxString::Format( _( "Error loading netlist.\n%s" ), ioe.errorText.GetData() );
|
|
|
|
wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
|
|
|
|
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++ )
|
|
|
|
{
|
2013-09-08 18:31:21 +00:00
|
|
|
if( m_netlist.GetComponent( ii )->GetFPID().GetFootprintName() == std::string( "$noname" ) )
|
|
|
|
m_netlist.GetComponent( ii )->SetFPID( FPID( wxEmptyString ) );
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sort components by reference:
|
|
|
|
m_netlist.SortByReference();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-06 15:37:48 +00:00
|
|
|
// File header.
|
* 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
|
|
|
static char headerLinkFile[] = "Cmp-Mod V01";
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
|
|
|
{
|
|
|
|
COMPONENT* component;
|
|
|
|
FILE* outputFile;
|
|
|
|
wxFileName fn( aFullFileName );
|
* 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
|
|
|
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
outputFile = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
|
|
|
|
|
|
|
if( outputFile == NULL )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
int retval = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The header is:
|
|
|
|
* Cmp-Mod V01 Created by CvPcb (2012-02-08 BZR 3403)-testing date = 10/02/2012 20:45:59
|
|
|
|
* and write block per component like:
|
|
|
|
* BeginCmp
|
|
|
|
* TimeStamp = /322D3011;
|
|
|
|
* Reference = BUS1;
|
|
|
|
* ValeurCmp = BUSPC;
|
|
|
|
* IdModule = BUS_PC;
|
|
|
|
* EndCmp
|
|
|
|
*/
|
* 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
|
|
|
retval |= fprintf( outputFile, "%s", headerLinkFile );
|
|
|
|
retval |= fprintf( outputFile, " Created by %s", TO_UTF8( title ) );
|
2013-04-26 15:11:52 +00:00
|
|
|
retval |= fprintf( outputFile, " date = %s\n", TO_UTF8( DateAndTime() ) );
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
|
|
|
{
|
|
|
|
component = m_netlist.GetComponent( i );
|
|
|
|
retval |= fprintf( outputFile, "\nBeginCmp\n" );
|
|
|
|
retval |= fprintf( outputFile, "TimeStamp = %s;\n", TO_UTF8( component->GetTimeStamp() ) );
|
|
|
|
retval |= fprintf( outputFile, "Reference = %s;\n", TO_UTF8( component->GetReference() ) );
|
|
|
|
retval |= fprintf( outputFile, "ValeurCmp = %s;\n", TO_UTF8( component->GetValue() ) );
|
2013-09-08 18:31:21 +00:00
|
|
|
retval |= fprintf( outputFile, "IdModule = %s;\n", component->GetFPID().Format().c_str() );
|
2013-04-26 15:11:52 +00:00
|
|
|
retval |= fprintf( outputFile, "EndCmp\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
retval |= fprintf( outputFile, "\nEndListe\n" );
|
|
|
|
fclose( outputFile );
|
|
|
|
return retval >= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::CreateScreenCmp()
|
|
|
|
{
|
2014-03-21 11:50:04 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame();
|
|
|
|
|
|
|
|
if( !fpframe )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2014-03-21 11:50:04 +00:00
|
|
|
fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this );
|
|
|
|
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.
|
2014-03-21 11:50:04 +00:00
|
|
|
fpframe->Raise(); // Make sure that is visible.
|
|
|
|
Raise(); // .. but still we want the focus.
|
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
|
|
|
}
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL,
|
2014-08-13 19:26:31 +00:00
|
|
|
FOOTPRINTS_LISTBOX::UNFILTERED );
|
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
|
|
|
}
|
|
|
|
|
2014-05-09 18:35:48 +00:00
|
|
|
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFpViewerFrame()
|
|
|
|
{
|
|
|
|
// returns the Footprint Viewer frame, if exists, or NULL
|
|
|
|
return (DISPLAY_FOOTPRINTS_FRAME*) wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
|
|
|
|
}
|