2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-01 07:19:31 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2017-11-12 00:31:38 +00:00
|
|
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
|
|
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-13 19:56:32 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file pcbnew_config.cpp
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <kiface_i.h>
|
|
|
|
#include <project.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
2014-08-12 08:17:16 +00:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
|
|
|
#include <gestfich.h>
|
|
|
|
#include <xnode.h>
|
2014-12-23 13:01:59 +00:00
|
|
|
#include <common.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <macros.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2018-02-02 20:57:12 +00:00
|
|
|
#include <board_design_settings.h>
|
2018-01-28 18:12:26 +00:00
|
|
|
#include <plotter.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <worksheet.h>
|
|
|
|
#include <dialog_hotkeys_editor.h>
|
2012-10-15 22:30:01 +00:00
|
|
|
#include <fp_lib_table.h>
|
2013-07-19 18:27:22 +00:00
|
|
|
#include <worksheet_shape_builder.h>
|
2012-12-08 23:58:03 +00:00
|
|
|
|
2013-05-20 14:49:20 +00:00
|
|
|
#include <class_board.h>
|
2014-07-21 10:54:58 +00:00
|
|
|
#include <class_module.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbplot.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <hotkeys.h>
|
2018-01-31 12:37:36 +00:00
|
|
|
#include <footprint_viewer_frame.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-10-13 21:33:58 +00:00
|
|
|
#include <invoke_pcb_dialog.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_mask_clearance.h>
|
|
|
|
#include <dialog_general_options.h>
|
2012-02-16 20:03:33 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2016-12-02 17:58:12 +00:00
|
|
|
#include <view/view.h>
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-10-15 22:30:01 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
wxFileName fn;
|
2008-02-19 00:35:45 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
2009-10-18 23:22:26 +00:00
|
|
|
case ID_PCB_LAYERS_SETUP:
|
2014-06-24 16:17:18 +00:00
|
|
|
if( InvokeLayerSetup( this, GetBoard() ) )
|
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID cur_layer = GetActiveLayer();
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2015-02-01 07:19:31 +00:00
|
|
|
// If after showing the dialog the user has removed the active layer,
|
|
|
|
// then select a new active layer (front copper layer).
|
2014-06-24 16:17:18 +00:00
|
|
|
if( !GetBoard()->GetEnabledLayers()[ cur_layer ] )
|
|
|
|
cur_layer = F_Cu;
|
|
|
|
|
2014-07-09 09:50:27 +00:00
|
|
|
SetActiveLayer( cur_layer );
|
2014-06-24 16:17:18 +00:00
|
|
|
OnModify();
|
|
|
|
ReCreateLayerBox();
|
|
|
|
ReFillLayerWidget();
|
2014-08-12 08:17:16 +00:00
|
|
|
|
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() );
|
2017-09-28 17:00:24 +00:00
|
|
|
|
|
|
|
GetCanvas()->Refresh();
|
2014-06-24 16:17:18 +00:00
|
|
|
}
|
2009-10-18 23:22:26 +00:00
|
|
|
break;
|
2009-09-17 17:48:40 +00:00
|
|
|
|
2015-03-30 16:42:39 +00:00
|
|
|
case ID_PCB_LIB_WIZARD:
|
2012-10-15 22:30:01 +00:00
|
|
|
case ID_PCB_LIB_TABLE_EDIT:
|
2013-05-20 14:49:20 +00:00
|
|
|
{
|
2014-01-27 07:23:02 +00:00
|
|
|
bool tableChanged = false;
|
2015-03-30 16:42:39 +00:00
|
|
|
int r = 0;
|
|
|
|
|
|
|
|
if( id == ID_PCB_LIB_TABLE_EDIT )
|
|
|
|
r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
|
|
|
|
else
|
|
|
|
r = InvokeFootprintWizard( this, &GFootprintTable, Prj().PcbFootprintLibs() );
|
2014-01-27 07:23:02 +00:00
|
|
|
|
|
|
|
if( r & 1 )
|
2013-10-13 16:29:20 +00:00
|
|
|
{
|
2014-01-27 07:23:02 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() );
|
* 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
|
|
|
|
|
|
|
GFootprintTable.Format( &sf, 0 );
|
2014-01-27 07:23:02 +00:00
|
|
|
tableChanged = true;
|
|
|
|
}
|
2014-03-21 01:24:35 +00:00
|
|
|
catch( const IO_ERROR& ioe )
|
2014-01-27 07:23:02 +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
|
|
|
wxString msg = wxString::Format( _(
|
|
|
|
"Error occurred saving the global footprint library "
|
|
|
|
"table:\n\n%s" ),
|
2016-09-14 22:36:45 +00:00
|
|
|
GetChars( ioe.What().GetData() )
|
* 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-27 07:23:02 +00:00
|
|
|
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
|
|
|
}
|
2013-10-13 16:29:20 +00:00
|
|
|
}
|
2013-01-21 03:12:16 +00:00
|
|
|
|
2014-01-27 07:23:02 +00:00
|
|
|
// If no board file is defined, do not save the project specific library table. It
|
|
|
|
// is kept in memory and created in the path when the new board is saved.
|
|
|
|
if( (r & 2) && !GetBoard()->GetFileName().IsEmpty() )
|
2013-10-13 16:29:20 +00:00
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
wxString tblName = Prj().FootprintLibTblName();
|
2014-01-27 07:23:02 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2014-05-09 18:35:48 +00:00
|
|
|
Prj().PcbFootprintLibs()->Save( tblName );
|
2014-01-27 07:23:02 +00:00
|
|
|
tableChanged = true;
|
|
|
|
}
|
2014-03-21 01:24:35 +00:00
|
|
|
catch( const IO_ERROR& ioe )
|
2014-01-27 07:23:02 +00:00
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
wxString msg = wxString::Format( _(
|
|
|
|
"Error occurred saving project specific footprint library "
|
|
|
|
"table:\n\n%s" ),
|
2016-09-14 22:36:45 +00:00
|
|
|
GetChars( ioe.What() )
|
2014-03-21 01:24:35 +00:00
|
|
|
);
|
2014-01-27 07:23:02 +00:00
|
|
|
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
|
|
|
}
|
2013-10-13 16:29:20 +00:00
|
|
|
}
|
2014-01-27 07:23:02 +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
|
|
|
FOOTPRINT_VIEWER_FRAME* viewer;
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
if( tableChanged && (viewer = (FOOTPRINT_VIEWER_FRAME*)Kiway().Player( FRAME_PCB_MODULE_VIEWER, false )) != NULL )
|
2013-10-13 16:29:20 +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
|
|
|
viewer->ReCreateLibraryList();
|
2013-10-13 16:29:20 +00:00
|
|
|
}
|
2012-10-15 22:30:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2015-08-20 07:14:44 +00:00
|
|
|
case ID_PCB_3DSHAPELIB_WIZARD:
|
|
|
|
#ifdef BUILD_GITHUB_PLUGIN
|
|
|
|
Invoke3DShapeLibsDownloaderWizard( this );
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
case ID_PCB_MASK_CLEARANCE:
|
|
|
|
{
|
|
|
|
DIALOG_PADS_MASK_CLEARANCE dlg( this );
|
2014-07-21 10:54:58 +00:00
|
|
|
|
|
|
|
if( dlg.ShowModal() == 1 && IsGalCanvasActive() )
|
|
|
|
{
|
|
|
|
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
|
2016-12-02 17:58:12 +00:00
|
|
|
GetGalCanvas()->GetView()->Update( module );
|
2014-07-21 10:54:58 +00:00
|
|
|
|
|
|
|
GetGalCanvas()->Refresh();
|
|
|
|
}
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-04-04 18:05:55 +00:00
|
|
|
case wxID_PREFERENCES:
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
2012-04-11 18:54:20 +00:00
|
|
|
DIALOG_GENERALOPTIONS dlg( this );
|
2009-10-30 17:58:15 +00:00
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-02-19 00:35:45 +00:00
|
|
|
case ID_PCB_PAD_SETUP:
|
2009-12-19 19:24:49 +00:00
|
|
|
InstallPadOptionsFrame( NULL );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CONFIG_SAVE:
|
2013-07-19 18:27:22 +00:00
|
|
|
SaveProjectSettings( true );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CONFIG_READ:
|
2014-03-21 01:24:35 +00:00
|
|
|
{
|
|
|
|
fn = GetBoard()->GetFileName();
|
|
|
|
fn.SetExt( ProjectFileExtension );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2014-03-21 01:24:35 +00:00
|
|
|
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
|
2017-11-12 00:31:38 +00:00
|
|
|
fn.GetFullName(), ProjectFileWildcard(),
|
2014-03-21 01:24:35 +00:00
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2014-03-21 01:24:35 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
break;
|
2008-02-19 00:35:45 +00:00
|
|
|
|
2014-03-21 01:24:35 +00:00
|
|
|
if( !wxFileExists( dlg.GetPath() ) )
|
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString msg = wxString::Format( _(
|
|
|
|
"File %s not found" ),
|
|
|
|
GetChars( dlg.GetPath() )
|
|
|
|
);
|
2014-03-21 01:24:35 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2013-12-16 21:40:03 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString pro_file = dlg.GetPath();
|
|
|
|
|
|
|
|
Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_PCB, GetProjectFileParameters(), pro_file );
|
2014-03-21 01:24:35 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
break;
|
2008-02-19 00:35:45 +00:00
|
|
|
|
2012-02-29 15:25:38 +00:00
|
|
|
// Hotkey IDs
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
|
2018-02-14 22:07:59 +00:00
|
|
|
ExportHotkeyConfigToFile( g_Board_Editor_Hotkeys_Descr, wxT( "pcbnew" ) );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
|
2018-02-14 22:07:59 +00:00
|
|
|
ImportHotkeyConfigFromFile( g_Board_Editor_Hotkeys_Descr, wxT( "pcbnew" ) );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
|
2018-02-14 22:07:59 +00:00
|
|
|
InstallHotkeyFrame( this, g_Board_Editor_Hotkeys_Descr );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
|
2011-09-30 18:15:37 +00:00
|
|
|
// Display current hotkey list for Pcbnew.
|
2018-02-14 22:07:59 +00:00
|
|
|
DisplayHotkeyList( this, g_Board_Editor_Hotkeys_Descr );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2017-08-01 11:12:59 +00:00
|
|
|
DisplayErrorMessage( this, "Unkown ID in Process Config",
|
|
|
|
wxString::Format( "PCB_EDIT_FRAME::Process_Config received ID %d", id ) );
|
2017-07-20 14:06:41 +00:00
|
|
|
break;
|
2008-02-19 00:35:45 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
bool PCB_EDIT_FRAME::LoadProjectSettings()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxLogDebug( wxT( "Loading project '%s' settings." ),
|
|
|
|
GetChars( Prj().GetProjectFullName() ) );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
bool rc = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_PCB, GetProjectFileParameters() );
|
2013-10-13 16:29:20 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
// Load the page layout decr file, from the filename stored in
|
|
|
|
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
|
2014-12-31 12:31:19 +00:00
|
|
|
// If empty, or not existing, the default descr is loaded
|
2013-07-19 18:27:22 +00:00
|
|
|
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
2014-12-31 12:31:19 +00:00
|
|
|
wxString pg_fullfilename = WORKSHEET_LAYOUT::MakeFullFileName(
|
|
|
|
BASE_SCREEN::m_PageLayoutDescrFileName,
|
|
|
|
Prj().GetProjectPath() );
|
2014-12-23 13:01:59 +00:00
|
|
|
|
|
|
|
pglayout.SetPageLayout( pg_fullfilename );
|
2013-05-20 14:49:20 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
return rc;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-19 00:35:45 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxFileName fn = Prj().GetProjectFullName();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
if( aAskForSave )
|
|
|
|
{
|
|
|
|
wxFileDialog dlg( this, _( "Save Project File" ),
|
|
|
|
fn.GetPath(), fn.GetFullName(),
|
2017-11-12 00:31:38 +00:00
|
|
|
ProjectFileWildcard(), wxFD_SAVE | wxFD_CHANGE_DIR );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
2008-02-19 00:35:45 +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
|
|
|
fn = dlg.GetPath();
|
2013-07-19 18:27:22 +00:00
|
|
|
}
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString pro_name = fn.GetFullPath();
|
|
|
|
|
|
|
|
Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_PCB, GetProjectFileParameters(), pro_name );
|
2010-04-23 14:46:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
|
2010-04-23 14:46:00 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
PARAM_CFG_ARRAY pca;
|
|
|
|
|
|
|
|
// This one cannot be cached because some settings are going to/from the BOARD,
|
|
|
|
// so pointers into that cannot be saved for long.
|
2010-04-23 14:46:00 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
|
|
|
|
&BASE_SCREEN::m_PageLayoutDescrFileName ) );
|
|
|
|
|
2014-01-27 07:23:02 +00:00
|
|
|
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
GetBoard()->GetDesignSettings().AppendConfigs( &pca );
|
|
|
|
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
return pca;
|
2010-04-23 14:46:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
|
2010-04-23 14:46:00 +00:00
|
|
|
{
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
if( m_configParams.empty() )
|
2014-06-24 16:17:18 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
// Units used in dialogs and toolbars
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
|
2014-06-24 16:17:18 +00:00
|
|
|
(int*)&g_UserUnit, MILLIMETRES ) );
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayPolarCood, false ) );
|
2014-06-24 16:17:18 +00:00
|
|
|
// Display options and modes:
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayPcbTrackFill, true ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
(int*) &displ_opts->m_ShowTrackClearanceMode,
|
2017-10-30 17:21:07 +00:00
|
|
|
PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayPadFill, true ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayViaFill, true ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayPadIsol, true ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayPadNum, true ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ),
|
2015-02-02 08:06:39 +00:00
|
|
|
&displ_opts->m_DisplayModEdgeFill, FILLED ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ),
|
2015-02-02 08:06:39 +00:00
|
|
|
&displ_opts->m_DisplayModTextFill, FILLED ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ),
|
2015-02-02 08:06:39 +00:00
|
|
|
&displ_opts->m_DisplayDrawItemsFill, FILLED ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_DisplayZonesMode, 0, 0, 2 ) );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
|
|
|
// layer colors:
|
2017-08-04 07:45:10 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
|
|
|
|
// Miscellaneous:
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &m_rotationAngle,
|
2014-06-24 16:17:18 +00:00
|
|
|
900, 1, 900 ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ),
|
2015-01-10 10:27:49 +00:00
|
|
|
&displ_opts->m_MaxLinksShowed,
|
2014-06-24 16:17:18 +00:00
|
|
|
3, 0, 15 ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
|
|
|
|
//FIXMEd
|
|
|
|
/* m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ),
|
2014-06-24 16:17:18 +00:00
|
|
|
&g_TwoSegmentTrackBuild, true ) );
|
2017-08-04 12:43:02 +00:00
|
|
|
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" )
|
|
|
|
, &g_Segments_45_Only, true ) );*/
|
2014-06-24 16:17:18 +00:00
|
|
|
}
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
return m_configParams;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|