2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2012 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>
|
|
|
|
#include <appl_wxstruct.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <gestfich.h>
|
|
|
|
#include <xnode.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <pcbcommon.h>
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <class_board_design_settings.h>
|
|
|
|
#include <plot_common.h>
|
|
|
|
#include <worksheet.h>
|
|
|
|
#include <dialog_hotkeys_editor.h>
|
2012-10-15 22:30:01 +00:00
|
|
|
#include <fp_lib_table.h>
|
2013-01-21 03:12:16 +00:00
|
|
|
#include <fp_lib_table_lexer.h>
|
2012-12-08 23:58:03 +00:00
|
|
|
|
2013-05-20 14:49:20 +00:00
|
|
|
#include <class_board.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbplot.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <hotkeys.h>
|
|
|
|
#include <pcbnew_config.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
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>
|
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 )
|
|
|
|
{
|
2010-01-27 20:07:50 +00:00
|
|
|
case ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
|
2011-03-03 19:08:13 +00:00
|
|
|
m_show_layer_manager_tools = ! m_show_layer_manager_tools;
|
|
|
|
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
|
|
|
|
m_auimgr.Update();
|
|
|
|
|
|
|
|
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
|
|
|
m_show_layer_manager_tools ?
|
|
|
|
_("Hide &Layers Manager" ) : _("Show &Layers Manager" ));
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2009-10-18 23:22:26 +00:00
|
|
|
case ID_PCB_LAYERS_SETUP:
|
2010-11-18 21:16:28 +00:00
|
|
|
InstallDialogLayerSetup();
|
2009-10-18 23:22:26 +00:00
|
|
|
break;
|
2009-09-17 17:48:40 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
case ID_CONFIG_REQ:
|
2011-03-03 19:08:13 +00:00
|
|
|
InstallConfigFrame();
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2012-10-15 22:30:01 +00:00
|
|
|
case ID_PCB_LIB_TABLE_EDIT:
|
2013-05-20 14:49:20 +00:00
|
|
|
{
|
|
|
|
int r = InvokePcbLibTableEditor( this, m_globalFootprintTable, m_footprintLibTable );
|
2013-01-21 03:12:16 +00:00
|
|
|
|
2013-05-20 14:49:20 +00:00
|
|
|
if( r & 1 )
|
|
|
|
{
|
|
|
|
FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() );
|
|
|
|
m_globalFootprintTable->Format( &sf, 0 );
|
2012-10-15 22:30:01 +00:00
|
|
|
|
2013-05-20 14:49:20 +00:00
|
|
|
}
|
2013-01-21 03:12:16 +00:00
|
|
|
|
2013-05-20 14:49:20 +00:00
|
|
|
if( r & 2 )
|
|
|
|
{
|
|
|
|
wxFileName fn = GetBoard()->GetFileName();
|
|
|
|
fn.SetName( FP_LIB_TABLE::GetFileName() );
|
|
|
|
fn.SetExt( wxEmptyString );
|
2013-01-21 03:12:16 +00:00
|
|
|
|
2013-05-20 14:49:20 +00:00
|
|
|
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
|
|
|
|
m_footprintLibTable->Format( &sf, 0 );
|
2013-01-21 03:12:16 +00:00
|
|
|
|
2012-10-15 22:30:01 +00:00
|
|
|
}
|
2013-05-20 14:49:20 +00:00
|
|
|
}
|
|
|
|
|
2012-10-15 22:30:01 +00:00
|
|
|
break;
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
case ID_PCB_MASK_CLEARANCE:
|
|
|
|
{
|
|
|
|
DIALOG_PADS_MASK_CLEARANCE dlg( this );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
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:
|
2010-04-23 14:46:00 +00:00
|
|
|
SaveProjectSettings();
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CONFIG_READ:
|
2012-02-29 15:25:38 +00:00
|
|
|
{
|
2012-08-29 16:59:50 +00:00
|
|
|
fn = GetBoard()->GetFileName();
|
2012-02-29 15:25:38 +00:00
|
|
|
fn.SetExt( ProjectFileExtension );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2012-02-29 15:25:38 +00:00
|
|
|
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
|
|
|
|
fn.GetFullName(), ProjectFileWildcard,
|
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2012-02-29 15:25:38 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
break;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2012-02-29 15:25:38 +00:00
|
|
|
if( !wxFileExists( dlg.GetPath() ) )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "File %s not found" ), GetChars( dlg.GetPath() ) );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2008-02-19 00:35:45 +00:00
|
|
|
|
2012-02-29 15:25:38 +00:00
|
|
|
LoadProjectSettings( dlg.GetPath() );
|
|
|
|
}
|
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:
|
2010-11-24 15:10:33 +00:00
|
|
|
ExportHotkeyConfigToFile( g_Board_Editor_Hokeys_Descr );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
|
2010-11-24 15:10:33 +00:00
|
|
|
ImportHotkeyConfigFromFile( g_Board_Editor_Hokeys_Descr );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
|
2010-11-24 15:10:33 +00:00
|
|
|
InstallHotkeyFrame( this, g_Board_Editor_Hokeys_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.
|
2010-11-24 15:10:33 +00:00
|
|
|
DisplayHotkeyList( this, g_Board_Editor_Hokeys_Descr );
|
2008-02-19 00:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2012-02-29 15:25:38 +00:00
|
|
|
// Macros IDs
|
2011-09-07 09:27:02 +00:00
|
|
|
case ID_PREFRENCES_MACROS_SAVE:
|
|
|
|
SaveMacros();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PREFRENCES_MACROS_READ:
|
|
|
|
ReadMacros();
|
|
|
|
break;
|
|
|
|
|
2008-02-19 00:35:45 +00:00
|
|
|
default:
|
2011-03-03 19:08:13 +00:00
|
|
|
DisplayError( this, wxT( "PCB_EDIT_FRAME::Process_Config error" ) );
|
2008-02-19 00:35:45 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-04-23 14:46:00 +00:00
|
|
|
wxFileName fn = aProjectFileName;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( fn.GetExt() != ProjectFileExtension )
|
|
|
|
fn.SetExt( ProjectFileExtension );
|
|
|
|
|
2009-04-09 18:39:39 +00:00
|
|
|
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
|
2007-06-05 12:10:51 +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
|
|
|
// Initialize default values.
|
2011-09-27 20:43:18 +00:00
|
|
|
g_LibraryNames.Clear();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-03-03 19:08:13 +00:00
|
|
|
wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
2007-06-05 12:10:51 +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
|
|
|
// User library path takes precedent over default library search paths.
|
2009-04-09 18:39:39 +00:00
|
|
|
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
// Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate
|
|
|
|
// what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings
|
|
|
|
// have no control over what is visible (see PCB_EDIT_FRAME::GetProjectFileParameters())
|
|
|
|
// this is recklessly turning on things the user may not want to see.
|
|
|
|
#if 0
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
/* Reset the items visibility flag when loading a new configuration because it could
|
2012-02-06 05:44:19 +00:00
|
|
|
* create SERIOUS mistakes for the user if board items are not visible after loading
|
2011-09-26 20:32:56 +00:00
|
|
|
* a board. Grid and ratsnest can be left to their previous state.
|
2009-10-10 01:25:53 +00:00
|
|
|
*/
|
2010-04-23 14:46:00 +00:00
|
|
|
bool showGrid = IsElementVisible( GRID_VISIBLE );
|
|
|
|
bool showRats = IsElementVisible( RATSNEST_VISIBLE );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
SetVisibleAlls();
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
SetElementVisibility( GRID_VISIBLE, showGrid );
|
|
|
|
SetElementVisibility( RATSNEST_VISIBLE, showRats );
|
2012-02-06 05:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-20 14:49:20 +00:00
|
|
|
loadFootprintLibTable();
|
|
|
|
|
2011-03-03 19:08:13 +00:00
|
|
|
return true;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-19 00:35:45 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::SaveProjectSettings()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn;
|
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
fn = GetBoard()->GetFileName();
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( ProjectFileExtension );
|
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(), fn.GetFullName(),
|
|
|
|
ProjectFileWildcard, wxFD_SAVE | wxFD_CHANGE_DIR );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2008-02-19 00:35:45 +00:00
|
|
|
return;
|
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, GetProjectFileParameters() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
++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
|
|
|
{
|
++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 pca;
|
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
|
|
|
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
|
2010-04-23 14:46:00 +00:00
|
|
|
GROUPLIB ) );
|
++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
|
|
|
pca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
|
2011-09-27 20:43:18 +00:00
|
|
|
&g_LibraryNames,
|
2010-04-23 14:46:00 +00:00
|
|
|
GROUPLIB ) );
|
2012-02-19 04:02:19 +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
|
|
|
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
&m_lastNetListRead ) );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-02-02 17:39:59 +00:00
|
|
|
pca.push_back( new PARAM_CFG_BOOL( wxT( "UseCmpFile" ),
|
|
|
|
&m_useCmpFileForFpNames, true ) );
|
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
|
|
|
{
|
|
|
|
if( !m_configSettings.empty() )
|
|
|
|
return m_configSettings;
|
|
|
|
|
2011-03-03 19:08:13 +00:00
|
|
|
// Units used in dialogs and toolbars
|
2011-09-24 18:33:28 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
|
|
|
|
(int*)&g_UserUnit, MILLIMETRES ) );
|
2011-03-03 19:08:13 +00:00
|
|
|
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ),
|
|
|
|
&DisplayOpt.DisplayPolarCood, false ) );
|
|
|
|
// Display options and modes:
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ViaHoleDisplayMode" ),
|
2011-09-24 18:33:28 +00:00
|
|
|
(int*) &DisplayOpt.m_DisplayViaMode,
|
2010-04-23 14:46:00 +00:00
|
|
|
VIA_SPECIAL_HOLE_SHOW, VIA_HOLE_NOT_SHOW,
|
|
|
|
OPT_VIA_HOLE_END - 1 ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ),
|
|
|
|
&DisplayOpt.DisplayNetNamesMode, 3, 0, 3 ) );
|
2011-03-03 19:08:13 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ),
|
|
|
|
&DisplayOpt.DisplayPcbTrackFill, true ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ),
|
2011-09-24 18:33:28 +00:00
|
|
|
(int*) &DisplayOpt.ShowTrackClearanceMode,
|
2010-04-23 14:46:00 +00:00
|
|
|
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ),
|
2011-03-03 19:08:13 +00:00
|
|
|
&DisplayOpt.DisplayPadFill, true ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ),
|
2011-03-03 19:08:13 +00:00
|
|
|
&DisplayOpt.DisplayViaFill, true ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ),
|
2011-03-03 19:08:13 +00:00
|
|
|
&DisplayOpt.DisplayPadIsol, true ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ),
|
2011-03-03 19:08:13 +00:00
|
|
|
&DisplayOpt.DisplayPadNum, true ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffC" ),
|
|
|
|
&DisplayOpt.DisplayModEdge, FILLED, 0, 2 ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffT" ),
|
|
|
|
&DisplayOpt.DisplayModText, FILLED, 0, 2 ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbAffT" ),
|
|
|
|
&DisplayOpt.DisplayDrawItems, FILLED, 0, 2 ) );
|
2013-03-29 10:14:32 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ),
|
|
|
|
&DisplayOpt.DisplayZonesMode, 0, 0, 2 ) );
|
2011-03-03 19:08:13 +00:00
|
|
|
|
|
|
|
// Colors:
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer0Ex" ), LOC_COLOR( 0 ),
|
2010-04-23 14:46:00 +00:00
|
|
|
GREEN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer1Ex" ), LOC_COLOR( 1 ),
|
2010-04-23 14:46:00 +00:00
|
|
|
BLUE ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer2Ex" ), LOC_COLOR( 2 ),
|
2010-04-23 14:46:00 +00:00
|
|
|
LIGHTGRAY ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer3Ex" ), LOC_COLOR( 3 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
MAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer4Ex" ), LOC_COLOR( 4 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
RED ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer5Ex" ), LOC_COLOR( 5 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
MAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer6Ex" ), LOC_COLOR( 6 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
BROWN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer7Ex" ), LOC_COLOR( 7 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
MAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer8Ex" ), LOC_COLOR( 8 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
LIGHTGRAY ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer9Ex" ), LOC_COLOR( 9 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
BLUE ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer10Ex" ), LOC_COLOR( 10 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
GREEN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer11Ex" ), LOC_COLOR( 11 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
CYAN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer12Ex" ), LOC_COLOR( 12 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
LIGHTRED ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer13Ex" ), LOC_COLOR( 13 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
LIGHTMAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer14Ex" ), LOC_COLOR( 14 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
YELLOW ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer15Ex" ), LOC_COLOR( 15 ),
|
2010-04-23 14:46:00 +00:00
|
|
|
RED ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer16Ex" ), LOC_COLOR( 16 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
BLUE ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer17Ex" ), LOC_COLOR( 17 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
MAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer18Ex" ), LOC_COLOR( 18 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
LIGHTCYAN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer19Ex" ), LOC_COLOR( 19 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
RED ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer20Ex" ), LOC_COLOR( 20 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
MAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer21Ex" ), LOC_COLOR( 21 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
CYAN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer22Ex" ), LOC_COLOR( 22 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
BROWN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer23Ex" ), LOC_COLOR( 23 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
MAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer24Ex" ), LOC_COLOR( 24 ),
|
2010-04-23 14:46:00 +00:00
|
|
|
LIGHTGRAY ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer25Ex" ), LOC_COLOR( 25 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
BLUE ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer26Ex" ), LOC_COLOR( 26 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
GREEN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer27Ex" ), LOC_COLOR( 27 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
YELLOW ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer28Ex" ), LOC_COLOR( 28 ),
|
2010-04-23 14:46:00 +00:00
|
|
|
YELLOW ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer29Ex" ), LOC_COLOR( 29 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
LIGHTMAGENTA ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer30Ex" ), LOC_COLOR( 30 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
YELLOW ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer31Ex" ), LOC_COLOR( 31 ),
|
2012-09-02 12:06:47 +00:00
|
|
|
LIGHTGRAY ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( MOD_TEXT_FR_VISIBLE ),
|
|
|
|
LIGHTGRAY ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( MOD_TEXT_BK_VISIBLE ),
|
|
|
|
BLUE ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( MOD_TEXT_INVISIBLE ),
|
|
|
|
DARKGRAY ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( ANCHOR_VISIBLE ), BLUE ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( PAD_BK_VISIBLE ), GREEN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( PAD_FR_VISIBLE ), RED ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( VIA_THROUGH_VISIBLE ),
|
|
|
|
LIGHTGRAY ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( VIA_BBLIND_VISIBLE ),
|
|
|
|
BROWN ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( VIA_MICROVIA_VISIBLE ),
|
|
|
|
CYAN ) );
|
2013-04-07 16:20:46 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ),
|
|
|
|
ITEM_COLOR( NON_PLATED_VISIBLE ),
|
|
|
|
YELLOW ) );
|
2013-04-04 21:35:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ),
|
2010-04-23 14:46:00 +00:00
|
|
|
ITEM_COLOR( RATSNEST_VISIBLE ),
|
|
|
|
WHITE ) );
|
2011-03-03 19:08:13 +00:00
|
|
|
|
|
|
|
// Miscellaneous:
|
2011-09-07 09:27:02 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &g_RotationAngle,
|
|
|
|
900, 450, 900 ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &g_MaxLinksShowed,
|
|
|
|
3, 0, 15 ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowMRa" ),
|
2011-03-03 19:08:13 +00:00
|
|
|
&g_Show_Module_Ratsnest, true ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ),
|
2011-03-03 19:08:13 +00:00
|
|
|
&g_TwoSegmentTrackBuild, true ) );
|
2013-03-27 18:32:12 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ), &g_Segments_45_Only,
|
2011-09-07 19:41:04 +00:00
|
|
|
true ) );
|
2010-04-23 14:46:00 +00:00
|
|
|
return m_configSettings;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2011-09-07 09:27:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
void PCB_EDIT_FRAME::SaveMacros()
|
|
|
|
{
|
|
|
|
wxXmlDocument xml;
|
|
|
|
wxXmlProperty *macrosProp, *hkProp, *xProp, *yProp;
|
|
|
|
wxString str, hkStr, xStr, yStr;
|
|
|
|
|
2012-09-12 17:28:55 +00:00
|
|
|
wxFileName fn = GetBoard()->GetFileName();
|
2011-09-07 09:27:02 +00:00
|
|
|
fn.SetExt( MacrosFileExtension );
|
|
|
|
|
|
|
|
wxFileDialog dlg( this, _( "Save Macros File" ), fn.GetPath(), fn.GetFullName(),
|
|
|
|
MacrosFileWildcard, wxFD_SAVE | wxFD_CHANGE_DIR );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
2012-09-12 17:28:55 +00:00
|
|
|
XNODE *rootNode = new XNODE( wxXML_ELEMENT_NODE, wxT( "macrosrootnode" ), wxEmptyString );
|
2011-09-07 09:27:02 +00:00
|
|
|
xml.SetRoot( rootNode );
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
for( int number = 9; number >= 0; number-- )
|
2011-09-07 09:27:02 +00:00
|
|
|
{
|
2011-09-07 19:41:04 +00:00
|
|
|
str.Printf( wxT( "%d" ), number );
|
|
|
|
macrosProp = new wxXmlProperty( wxT( "number" ), str );
|
2011-09-07 09:27:02 +00:00
|
|
|
|
2012-09-12 17:28:55 +00:00
|
|
|
XNODE * macrosNode = new XNODE( rootNode, wxXML_ELEMENT_NODE,
|
|
|
|
wxT( "macros" ), wxEmptyString,
|
|
|
|
macrosProp );
|
2011-09-07 09:27:02 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
for( std::list<MACROS_RECORD>::reverse_iterator i = m_Macros[number].m_Record.rbegin();
|
|
|
|
i != m_Macros[number].m_Record.rend();
|
|
|
|
i++ )
|
2011-09-07 09:27:02 +00:00
|
|
|
{
|
2011-09-07 19:41:04 +00:00
|
|
|
hkStr.Printf( wxT( "%d" ), i->m_HotkeyCode );
|
|
|
|
xStr.Printf( wxT( "%d" ), i->m_Position.x );
|
|
|
|
yStr.Printf( wxT( "%d" ), i->m_Position.y );
|
2011-09-07 09:27:02 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
yProp = new wxXmlProperty( wxT( "y" ), yStr );
|
|
|
|
xProp = new wxXmlProperty( wxT( "x" ), xStr, yProp );
|
|
|
|
hkProp = new wxXmlProperty( wxT( "hkcode" ), hkStr, xProp );
|
2011-09-07 09:27:02 +00:00
|
|
|
|
2012-09-12 17:28:55 +00:00
|
|
|
new XNODE( macrosNode, wxXML_ELEMENT_NODE, wxT( "hotkey" ),
|
|
|
|
wxEmptyString, hkProp );
|
2011-09-07 09:27:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
xml.SetFileEncoding( wxT( "UTF-8" ) );
|
2011-09-07 19:41:04 +00:00
|
|
|
xml.Save( dlg.GetFilename() );
|
2011-09-07 09:27:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_EDIT_FRAME::ReadMacros()
|
|
|
|
{
|
|
|
|
wxString str;
|
|
|
|
wxFileName fn;
|
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
fn = GetBoard()->GetFileName();
|
2011-09-07 09:27:02 +00:00
|
|
|
fn.SetExt( MacrosFileExtension );
|
|
|
|
|
|
|
|
wxFileDialog dlg( this, _( "Read Macros File" ), fn.GetPath(),
|
|
|
|
fn.GetFullName(), MacrosFileWildcard,
|
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( !wxFileExists( dlg.GetPath() ) )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "File %s not found" ), GetChars( dlg.GetPath() ) );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxXmlDocument xml;
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
xml.SetFileEncoding( wxT( "UTF-8" ) );
|
|
|
|
|
2011-09-07 09:27:02 +00:00
|
|
|
if( !xml.Load( dlg.GetFilename() ) )
|
|
|
|
return;
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
XNODE *macrosNode = (XNODE*) xml.GetRoot()->GetChildren();
|
2011-09-07 09:27:02 +00:00
|
|
|
|
|
|
|
while( macrosNode )
|
|
|
|
{
|
|
|
|
int number = -1;
|
|
|
|
|
|
|
|
if( macrosNode->GetName() == wxT( "macros" ) )
|
|
|
|
{
|
2011-09-07 19:41:04 +00:00
|
|
|
number = wxAtoi( macrosNode->GetAttribute( wxT( "number" ), wxT( "-1" ) ) );
|
2011-09-07 09:27:02 +00:00
|
|
|
|
|
|
|
if( number >= 0 && number < 10 )
|
|
|
|
{
|
|
|
|
m_Macros[number].m_Record.clear();
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
XNODE *hotkeyNode = (XNODE*) macrosNode->GetChildren();
|
|
|
|
|
2011-09-07 09:27:02 +00:00
|
|
|
while( hotkeyNode )
|
|
|
|
{
|
|
|
|
if( hotkeyNode->GetName() == wxT( "hotkey" ) )
|
|
|
|
{
|
2011-09-07 19:41:04 +00:00
|
|
|
int x = wxAtoi( hotkeyNode->GetAttribute( wxT( "x" ), wxT( "0" ) ) );
|
|
|
|
int y = wxAtoi( hotkeyNode->GetAttribute( wxT( "y" ), wxT( "0" ) ) );
|
|
|
|
int hk = wxAtoi( hotkeyNode->GetAttribute( wxT( "hkcode" ), wxT( "0" ) ) );
|
2011-09-07 09:27:02 +00:00
|
|
|
|
|
|
|
MACROS_RECORD macros_record;
|
|
|
|
macros_record.m_HotkeyCode = hk;
|
|
|
|
macros_record.m_Position.x = x;
|
|
|
|
macros_record.m_Position.y = y;
|
2011-09-07 19:41:04 +00:00
|
|
|
m_Macros[number].m_Record.push_back( macros_record );
|
2011-09-07 09:27:02 +00:00
|
|
|
}
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
hotkeyNode = (XNODE*) hotkeyNode->GetNext();
|
2011-09-07 09:27:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
macrosNode = (XNODE*) macrosNode->GetNext();
|
2011-09-07 09:27:02 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-20 14:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
void PCB_EDIT_FRAME::loadFootprintLibTable()
|
|
|
|
{
|
|
|
|
delete m_footprintLibTable;
|
|
|
|
|
|
|
|
wxFileName fn = GetBoard()->GetFileName();
|
|
|
|
fn.SetName( FP_LIB_TABLE::GetFileName() );
|
|
|
|
fn.SetExt( wxEmptyString );
|
|
|
|
|
|
|
|
// Check if a project footprint table is defined and load it. If no project footprint
|
|
|
|
// table is defined, then the global library table is the footprint library table.
|
|
|
|
|
|
|
|
m_footprintLibTable = new FP_LIB_TABLE( m_globalFootprintTable );
|
|
|
|
|
|
|
|
if( fn.FileExists() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
FILE_LINE_READER reader( fn.GetFullPath() );
|
|
|
|
FP_LIB_TABLE_LEXER lexer( &reader );
|
|
|
|
m_footprintLibTable->Parse( &lexer );
|
|
|
|
}
|
|
|
|
catch( IO_ERROR ioe )
|
|
|
|
{
|
|
|
|
DisplayError( this, ioe.errorText );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|