2011-02-26 08:35:22 +00:00
|
|
|
/**
|
|
|
|
* @file eeschema_config.cpp
|
|
|
|
*/
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "gestfich.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "wxEeschemaStruct.h"
|
|
|
|
|
|
|
|
#include "eeschema_id.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "general.h"
|
2010-12-31 19:47:39 +00:00
|
|
|
#include "netlist_control.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
2010-03-20 19:57:59 +00:00
|
|
|
#include "libeditframe.h"
|
2009-10-27 19:30:32 +00:00
|
|
|
#include "eeschema_config.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "worksheet.h"
|
2007-09-06 11:52:26 +00:00
|
|
|
#include "hotkeys.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_sheet.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
#include "dialog_hotkeys_editor.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-12-02 21:41:56 +00:00
|
|
|
#include "dialogs/dialog_color_config.h"
|
2010-11-19 16:28:46 +00:00
|
|
|
#include "dialogs/dialog_eeschema_config.h"
|
|
|
|
#include "dialogs/dialog_eeschema_options.h"
|
2011-12-13 15:37:33 +00:00
|
|
|
#include "dialogs/dialog_schematic_find.h"
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
#define HOTKEY_FILENAME wxT( "eeschema" )
|
2007-09-10 04:51:01 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
|
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
DIALOG_EESCHEMA_CONFIG CfgFrame( (SCH_EDIT_FRAME *)GetParent(), this );
|
2010-11-19 16:28:46 +00:00
|
|
|
|
|
|
|
CfgFrame.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-02 21:41:56 +00:00
|
|
|
void LIB_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
DIALOG_COLOR_CONFIG dlg( this );
|
|
|
|
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
wxFileName fn;
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_EDIT_FRAME* schFrame = ( SCH_EDIT_FRAME* ) GetParent();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
2010-03-20 19:57:59 +00:00
|
|
|
case ID_CONFIG_SAVE:
|
2011-08-18 19:25:12 +00:00
|
|
|
schFrame->SaveProjectFile();
|
2010-03-20 19:57:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CONFIG_READ:
|
|
|
|
{
|
2011-01-20 16:34:57 +00:00
|
|
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
2010-03-20 19:57:59 +00:00
|
|
|
fn.SetExt( ProjectFileExtension );
|
|
|
|
|
|
|
|
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
|
|
|
|
fn.GetFullName(), ProjectFileWildcard,
|
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
break;
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
schFrame->LoadProjectFile( dlg.GetPath(), true );
|
2010-03-20 19:57:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
/* Hotkey IDs */
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
|
|
|
|
InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr );
|
2010-03-20 19:57:59 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
|
|
|
|
ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr );
|
2010-03-20 19:57:59 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
|
|
|
|
ImportHotkeyConfigFromFile( s_Eeschema_Hokeys_Descr );
|
2010-03-20 19:57:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
|
|
|
|
// Display current hotkey list for LibEdit.
|
|
|
|
DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-11-19 16:28:46 +00:00
|
|
|
DisplayError( this, wxT( "LIB_EDIT_FRAME::Process_Config error" ) );
|
2010-03-20 19:57:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent )
|
2010-12-02 21:41:56 +00:00
|
|
|
{
|
|
|
|
DIALOG_COLOR_CONFIG dlg( this );
|
|
|
|
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
|
2010-11-19 16:28:46 +00:00
|
|
|
{
|
|
|
|
DIALOG_EESCHEMA_CONFIG CfgFrame( this, this );
|
|
|
|
|
|
|
|
CfgFrame.ShowModal();
|
|
|
|
}
|
|
|
|
|
2010-03-20 19:57:59 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
|
2010-03-20 19:57:59 +00:00
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
wxFileName fn;
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
case ID_CONFIG_SAVE:
|
2011-08-18 19:25:12 +00:00
|
|
|
SaveProjectFile();
|
2008-02-26 19:19:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CONFIG_READ:
|
|
|
|
{
|
2011-01-20 16:34:57 +00:00
|
|
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( ProjectFileExtension );
|
|
|
|
|
|
|
|
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
|
|
|
|
fn.GetFullName(), ProjectFileWildcard,
|
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2008-02-26 19:19:54 +00:00
|
|
|
break;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
LoadProjectFile( dlg.GetPath(), true );
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
break;
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-10-27 13:48:24 +00:00
|
|
|
|
|
|
|
/* Hotkey IDs */
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
|
|
|
|
ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr );
|
2008-02-26 19:19:54 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
|
|
|
|
ImportHotkeyConfigFromFile( s_Eeschema_Hokeys_Descr );
|
2008-02-26 19:19:54 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
|
|
|
|
InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr );
|
2008-02-26 19:19:54 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
|
|
|
|
// Display current hotkey list for eeschema.
|
2008-02-26 19:19:54 +00:00
|
|
|
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-12-08 20:12:46 +00:00
|
|
|
DisplayError( this, wxT( "SCH_EDIT_FRAME::Process_Config error" ) );
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
|
2009-12-01 15:14:18 +00:00
|
|
|
{
|
|
|
|
wxArrayString units;
|
2010-12-08 20:12:46 +00:00
|
|
|
GRIDS grid_list;
|
2009-12-01 15:14:18 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
GetScreen()->GetGrids( grid_list );
|
2009-12-01 15:14:18 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
DIALOG_EESCHEMA_OPTIONS dlg( this );
|
2010-06-17 16:30:10 +00:00
|
|
|
|
2009-12-01 15:14:18 +00:00
|
|
|
units.Add( GetUnitsLabel( INCHES ) );
|
2010-07-12 14:07:09 +00:00
|
|
|
units.Add( GetUnitsLabel( MILLIMETRES ) );
|
2009-12-01 15:14:18 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
dlg.SetUnits( units, g_UserUnit );
|
2011-02-05 02:21:11 +00:00
|
|
|
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
|
2009-12-01 15:14:18 +00:00
|
|
|
dlg.SetLineWidth( g_DrawDefaultLineThickness );
|
|
|
|
dlg.SetTextSize( g_DefaultTextLabelSize );
|
|
|
|
dlg.SetRepeatHorizontal( g_RepeatStep.x );
|
|
|
|
dlg.SetRepeatVertical( g_RepeatStep.y );
|
|
|
|
dlg.SetRepeatLabel( g_RepeatDeltaLabel );
|
2011-10-15 13:25:57 +00:00
|
|
|
dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 );
|
2010-02-01 21:23:27 +00:00
|
|
|
dlg.SetShowGrid( IsGridVisible() );
|
2011-12-09 16:37:11 +00:00
|
|
|
dlg.SetShowHiddenPins( m_showAllPins );
|
2009-12-01 15:14:18 +00:00
|
|
|
dlg.SetEnableAutoPan( DrawPanel->m_AutoPAN_Enable );
|
2010-02-12 17:15:47 +00:00
|
|
|
dlg.SetEnableHVBusOrientation( g_HVLines );
|
2009-12-01 15:14:18 +00:00
|
|
|
dlg.SetShowPageLimits( g_ShowPageLimits );
|
|
|
|
dlg.Layout();
|
|
|
|
dlg.Fit();
|
|
|
|
dlg.SetMinSize( dlg.GetSize() );
|
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
const TEMPLATE_FIELDNAMES& tfnames = m_TemplateFieldNames.GetTemplateFieldNames();
|
|
|
|
|
|
|
|
for( unsigned i=0; i<tfnames.size(); ++i )
|
|
|
|
{
|
2011-02-28 18:36:19 +00:00
|
|
|
D(printf("dlg.SetFieldName(%d, '%s')\n", i, TO_UTF8( tfnames[i].m_Name) );)
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
dlg.SetFieldName( i, tfnames[i].m_Name );
|
|
|
|
}
|
|
|
|
|
2009-12-01 15:14:18 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
2011-09-06 19:42:46 +00:00
|
|
|
g_UserUnit = (EDA_UNITS_T)dlg.GetUnitsSelection();
|
2010-06-17 16:30:10 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
|
2010-06-17 16:30:10 +00:00
|
|
|
|
2009-12-01 15:14:18 +00:00
|
|
|
g_DrawDefaultLineThickness = dlg.GetLineWidth();
|
|
|
|
g_DefaultTextLabelSize = dlg.GetTextSize();
|
|
|
|
g_RepeatStep.x = dlg.GetRepeatHorizontal();
|
|
|
|
g_RepeatStep.y = dlg.GetRepeatVertical();
|
|
|
|
g_RepeatDeltaLabel = dlg.GetRepeatLabel();
|
2011-10-15 13:25:57 +00:00
|
|
|
SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 );
|
2010-02-01 21:23:27 +00:00
|
|
|
SetGridVisibility( dlg.GetShowGrid() );
|
2011-12-09 16:37:11 +00:00
|
|
|
m_showAllPins = dlg.GetShowHiddenPins();
|
2009-12-01 15:14:18 +00:00
|
|
|
DrawPanel->m_AutoPAN_Enable = dlg.GetEnableAutoPan();
|
2010-02-12 19:15:58 +00:00
|
|
|
g_HVLines = dlg.GetEnableHVBusOrientation();
|
2009-12-01 15:14:18 +00:00
|
|
|
g_ShowPageLimits = dlg.GetShowPageLimits();
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
wxString templateFieldName;
|
|
|
|
|
|
|
|
// @todo this will change when the template field editor is redone to
|
|
|
|
// look like the component field property editor, showing visibility and value also
|
|
|
|
|
|
|
|
DeleteAllTemplateFieldNames();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
for( int i=0; i<8; ++i ) // no. fields in this dialog window
|
|
|
|
{
|
|
|
|
templateFieldName = dlg.GetFieldName( i );
|
|
|
|
|
|
|
|
if( !templateFieldName.IsEmpty() )
|
|
|
|
{
|
|
|
|
TEMPLATE_FIELDNAME fld( dlg.GetFieldName( i ) );
|
|
|
|
|
|
|
|
// @todo set visibility and value also from a better editor
|
|
|
|
|
|
|
|
AddTemplateFieldName( fld );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-01 15:14:18 +00:00
|
|
|
DrawPanel->Refresh( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
++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& SCH_EDIT_FRAME::GetProjectFileParameters()
|
2009-04-29 17:09:00 +00:00
|
|
|
{
|
2009-05-21 17:42:42 +00:00
|
|
|
if( !m_projectFileParams.empty() )
|
2009-04-29 17:09:00 +00:00
|
|
|
return m_projectFileParams;
|
|
|
|
|
2011-02-26 08:35:22 +00:00
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),
|
2011-12-09 16:37:11 +00:00
|
|
|
&m_userLibraryPath ) );
|
2009-05-21 17:42:42 +00:00
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
|
2011-12-09 16:37:11 +00:00
|
|
|
&m_componentLibFiles,
|
2009-05-21 17:42:42 +00:00
|
|
|
GROUPLIB ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "NetFmt" ),
|
2011-12-09 16:37:11 +00:00
|
|
|
&m_netListFormat,
|
2009-05-21 17:42:42 +00:00
|
|
|
NET_TYPE_PCBNEW,
|
|
|
|
NET_TYPE_PCBNEW,
|
|
|
|
NET_TYPE_CUSTOM_MAX ) );
|
2009-04-29 17:09:00 +00:00
|
|
|
|
|
|
|
/* NOTE: Left as global until supporting code can be fixed. */
|
2009-05-21 17:42:42 +00:00
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLSpd" ),
|
|
|
|
&g_HPGL_Pen_Descr.m_Pen_Speed,
|
|
|
|
20, 2, 45 ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLDm" ),
|
|
|
|
&g_HPGL_Pen_Descr.m_Pen_Diam,
|
|
|
|
15, 1, 150 ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ),
|
|
|
|
&g_HPGL_Pen_Descr.m_Pen_Num,
|
|
|
|
1, 1, 8 ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ),
|
|
|
|
&g_Sheet_A4.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A4" ),
|
|
|
|
&g_Sheet_A4.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A3" ),
|
|
|
|
&g_Sheet_A3.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A3" ),
|
|
|
|
&g_Sheet_A3.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A2" ),
|
|
|
|
&g_Sheet_A2.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A2" ),
|
|
|
|
&g_Sheet_A2.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A1" ),
|
|
|
|
&g_Sheet_A1.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A1" ),
|
|
|
|
&g_Sheet_A1.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A0" ),
|
|
|
|
&g_Sheet_A0.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A0" ),
|
|
|
|
&g_Sheet_A0.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A" ),
|
|
|
|
&g_Sheet_A.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A" ),
|
|
|
|
&g_Sheet_A.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_B" ),
|
|
|
|
&g_Sheet_B.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_B" ),
|
|
|
|
&g_Sheet_B.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_C" ),
|
|
|
|
&g_Sheet_C.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_C" ),
|
|
|
|
&g_Sheet_C.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_D" ),
|
|
|
|
&g_Sheet_D.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_D" ),
|
|
|
|
&g_Sheet_D.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_E" ),
|
|
|
|
&g_Sheet_E.m_Offset.x ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ),
|
|
|
|
&g_Sheet_E.m_Offset.y ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
|
|
|
|
&g_RepeatStep.x,
|
|
|
|
0, -1000, +1000 ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_Y" ),
|
|
|
|
&g_RepeatStep.y,
|
|
|
|
100, -1000, +1000 ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptLab" ),
|
|
|
|
&g_RepeatDeltaLabel,
|
|
|
|
1, -10, +10 ) );
|
|
|
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ),
|
|
|
|
&g_DefaultTextLabelSize,
|
|
|
|
DEFAULT_SIZE_TEXT, 0,
|
|
|
|
1000 ) );
|
2009-04-29 17:09:00 +00:00
|
|
|
|
|
|
|
return m_projectFileParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceReread )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn;
|
2011-08-18 19:25:12 +00:00
|
|
|
bool IsRead = true;
|
2011-12-09 16:37:11 +00:00
|
|
|
wxArrayString liblist_tmp = m_componentLibFiles;
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
if( aFileName.IsEmpty() )
|
2011-01-20 16:34:57 +00:00
|
|
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
2008-02-26 19:19:54 +00:00
|
|
|
else
|
2011-08-18 19:25:12 +00:00
|
|
|
fn = aFileName;
|
2010-02-02 15:01:09 +00:00
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
m_componentLibFiles.Clear();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
/* Change the schematic file extension (.sch) to the project file
|
|
|
|
* extension (.pro). */
|
|
|
|
fn.SetExt( ProjectFileExtension );
|
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
wxGetApp().RemoveLibraryPath( m_userLibraryPath );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
if( !wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP,
|
|
|
|
GetProjectFileParameters(),
|
2011-08-18 19:25:12 +00:00
|
|
|
!aForceReread ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2011-12-09 16:37:11 +00:00
|
|
|
m_componentLibFiles = liblist_tmp;
|
2011-08-18 19:25:12 +00:00
|
|
|
IsRead = false;
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
|
2009-04-09 18:39:39 +00:00
|
|
|
/* User library path takes precedent over default library search paths. */
|
2011-12-09 16:37:11 +00:00
|
|
|
wxGetApp().InsertLibraryPath( m_userLibraryPath, 1 );
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
/* If the list is void, force loading the library "power.lib" that is
|
2009-11-03 13:26:31 +00:00
|
|
|
* the "standard" library for power symbols.
|
|
|
|
*/
|
2011-12-09 16:37:11 +00:00
|
|
|
if( m_componentLibFiles.GetCount() == 0 )
|
|
|
|
m_componentLibFiles.Add( wxT( "power" ) );
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
LoadLibraries();
|
2011-02-05 02:21:11 +00:00
|
|
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
return IsRead;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
void SCH_EDIT_FRAME::SaveProjectFile()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn;
|
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
fn = g_RootSheet->GetScreen()->GetFileName(); /*ConfigFileName*/
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( ProjectFileExtension );
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
if( !IsWritable( fn ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
return;
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
|
2009-04-29 17:09:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-02 07:26:49 +00:00
|
|
|
static const wxString DefaultDrawLineWidthEntry( wxT( "DefaultDrawLineWidth" ) );
|
2009-04-29 17:09:00 +00:00
|
|
|
static const wxString ShowHiddenPinsEntry( wxT( "ShowHiddenPins" ) );
|
2009-05-01 18:06:03 +00:00
|
|
|
static const wxString HorzVertLinesOnlyEntry( wxT( "HorizVertLinesOnly" ) );
|
2010-02-02 15:01:09 +00:00
|
|
|
static const wxString PreviewFramePositionXEntry( wxT( "PreviewFramePositionX" ) );
|
|
|
|
static const wxString PreviewFramePositionYEntry( wxT( "PreviewFramePositionY" ) );
|
|
|
|
static const wxString PreviewFrameWidthEntry( wxT( "PreviewFrameWidth" ) );
|
|
|
|
static const wxString PreviewFrameHeightEntry( wxT( "PreviewFrameHeight" ) );
|
|
|
|
static const wxString PrintDialogPositionXEntry( wxT( "PrintDialogPositionX" ) );
|
|
|
|
static const wxString PrintDialogPositionYEntry( wxT( "PrintDialogPositionY" ) );
|
|
|
|
static const wxString PrintDialogWidthEntry( wxT( "PrintDialogWidth" ) );
|
|
|
|
static const wxString PrintDialogHeightEntry( wxT( "PrintDialogHeight" ) );
|
2010-03-16 18:22:59 +00:00
|
|
|
static const wxString FindDialogPositionXEntry( wxT( "FindDialogPositionX" ) );
|
|
|
|
static const wxString FindDialogPositionYEntry( wxT( "FindDialogPositionY" ) );
|
|
|
|
static const wxString FindDialogWidthEntry( wxT( "FindDialogWidth" ) );
|
|
|
|
static const wxString FindDialogHeightEntry( wxT( "FindDialogHeight" ) );
|
|
|
|
static const wxString FindReplaceFlagsEntry( wxT( "LastFindReplaceFlags" ) );
|
|
|
|
static const wxString FindStringEntry( wxT( "LastFindString" ) );
|
|
|
|
static const wxString ReplaceStringEntry( wxT( "LastReplaceString" ) );
|
|
|
|
static const wxString FindStringHistoryEntry( wxT( "FindStringHistoryList%d" ) );
|
|
|
|
static const wxString ReplaceStringHistoryEntry( wxT( "ReplaceStringHistoryList%d" ) );
|
2010-06-17 16:30:10 +00:00
|
|
|
static const wxString FieldNamesEntry( wxT( "FieldNames" ) );
|
2010-07-14 13:24:36 +00:00
|
|
|
static const wxString SpiceNetNamesEntry( wxT( "SpiceUseNetNames" ) );
|
|
|
|
static const wxString SimulatorCommandEntry( wxT( "SimCmdLine" ) );
|
2009-04-29 17:09:00 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
|
2009-04-29 17:09:00 +00:00
|
|
|
{
|
2009-05-21 17:42:42 +00:00
|
|
|
if( !m_configSettings.empty() )
|
2009-04-29 17:09:00 +00:00
|
|
|
return m_configSettings;
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_INT( wxT( "Unite" ),
|
2010-12-20 16:42:34 +00:00
|
|
|
(int*)&g_UserUnit, 0 ) );
|
2009-05-21 17:42:42 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_WIRE],
|
|
|
|
GREEN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBus" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_BUS],
|
|
|
|
BLUE ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConn" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_JUNCTION],
|
|
|
|
GREEN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLlab" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_LOCLABEL],
|
|
|
|
BLACK ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHlab" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_HIERLABEL],
|
|
|
|
BROWN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGbllab" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_GLOBLABEL],
|
|
|
|
RED ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinF" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_PINFUN],
|
|
|
|
MAGENTA ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColPinN" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_PINNUM],
|
|
|
|
RED ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPNam" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_PINNAM],
|
|
|
|
CYAN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorField" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_FIELDS],
|
|
|
|
MAGENTA ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRef" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_REFERENCEPART],
|
|
|
|
CYAN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValue" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_VALUEPART],
|
|
|
|
CYAN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNote" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_NOTES],
|
|
|
|
LIGHTBLUE ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBody" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_DEVICE],
|
|
|
|
RED ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBg" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_DEVICE_BACKGROUND],
|
|
|
|
LIGHTYELLOW ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetN" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_NETNAM],
|
|
|
|
DARKGRAY ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPin" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_PIN],
|
|
|
|
RED ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheet" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_SHEET],
|
|
|
|
MAGENTA ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
|
|
|
|
wxT( "ColorSheetFileName" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_SHEETFILENAME],
|
|
|
|
BROWN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetName" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_SHEETNAME],
|
|
|
|
CYAN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLab" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_SHEETLABEL],
|
|
|
|
BROWN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoCo" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_NOCONNECT],
|
|
|
|
BLUE ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcW" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_ERC_WARN],
|
|
|
|
GREEN ) );
|
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_ERC_ERR],
|
|
|
|
RED ) );
|
2010-12-20 16:42:34 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ),
|
|
|
|
&g_LayerDescr.LayerColor[LAYER_GRID],
|
|
|
|
DARKGRAY ) );
|
2010-11-29 15:05:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintMonochrome" ),
|
2010-12-20 16:42:34 +00:00
|
|
|
&m_printMonochrome, true ) );
|
2010-11-29 15:05:01 +00:00
|
|
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintSheetReferenceAndTitleBlock" ),
|
2010-12-20 16:42:34 +00:00
|
|
|
&m_printSheetReference, true ) );
|
2010-02-02 15:01:09 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
return m_configSettings;
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::LoadSettings()
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2009-04-29 17:09:00 +00:00
|
|
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
|
|
|
|
2010-02-02 15:01:09 +00:00
|
|
|
long tmp;
|
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_DRAW_FRAME::LoadSettings();
|
2009-04-29 17:09:00 +00:00
|
|
|
|
|
|
|
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
// This is required until someone gets rid of the global variable g_LayerDescription().
|
2010-12-20 16:42:34 +00:00
|
|
|
m_GridColor = g_LayerDescr.LayerColor[LAYER_GRID];
|
|
|
|
|
|
|
|
g_DrawDefaultLineThickness = cfg->Read( DefaultDrawLineWidthEntry,(long) 6 );
|
2011-12-09 16:37:11 +00:00
|
|
|
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
|
2009-05-01 18:06:03 +00:00
|
|
|
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
/* Load print preview window session settings. */
|
2010-02-02 15:01:09 +00:00
|
|
|
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
|
|
|
|
m_previewPosition.x = (int) tmp;
|
|
|
|
cfg->Read( PreviewFramePositionYEntry, &tmp, -1 );
|
|
|
|
m_previewPosition.y = (int) tmp;
|
|
|
|
cfg->Read( PreviewFrameWidthEntry, &tmp, -1 );
|
|
|
|
m_previewSize.SetWidth( (int) tmp );
|
|
|
|
cfg->Read( PreviewFrameHeightEntry, &tmp, -1 );
|
|
|
|
m_previewSize.SetHeight( (int) tmp );
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/* Load print dialog session settings. */
|
2010-02-02 15:01:09 +00:00
|
|
|
cfg->Read( PrintDialogPositionXEntry, &tmp, -1 );
|
|
|
|
m_printDialogPosition.x = (int) tmp;
|
|
|
|
cfg->Read( PrintDialogPositionYEntry, &tmp, -1 );
|
|
|
|
m_printDialogPosition.y = (int) tmp;
|
|
|
|
cfg->Read( PrintDialogWidthEntry, &tmp, -1 );
|
|
|
|
m_printDialogSize.SetWidth( (int) tmp );
|
|
|
|
cfg->Read( PrintDialogHeightEntry, &tmp, -1 );
|
|
|
|
m_printDialogSize.SetHeight( (int) tmp );
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
// Load netlists options:
|
|
|
|
cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false );
|
2011-06-15 18:44:24 +00:00
|
|
|
cfg->Read( SimulatorCommandEntry, &m_simulatorCommand );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/* Load find dialog session setting. */
|
|
|
|
cfg->Read( FindDialogPositionXEntry, &tmp, -1 );
|
|
|
|
m_findDialogPosition.x = (int) tmp;
|
|
|
|
cfg->Read( FindDialogPositionYEntry, &tmp, -1 );
|
|
|
|
m_findDialogPosition.y = (int) tmp;
|
|
|
|
cfg->Read( FindDialogWidthEntry, &tmp, -1 );
|
|
|
|
m_findDialogSize.SetWidth( (int) tmp );
|
|
|
|
cfg->Read( FindDialogHeightEntry, &tmp, -1 );
|
|
|
|
m_findDialogSize.SetHeight( (int) tmp );
|
|
|
|
wxASSERT_MSG( m_findReplaceData,
|
|
|
|
wxT( "Find dialog data settings object not created. Bad programmer!" ) );
|
|
|
|
cfg->Read( FindReplaceFlagsEntry, &tmp, (long) wxFR_DOWN );
|
2011-12-13 15:37:33 +00:00
|
|
|
m_findReplaceData->SetFlags( (wxUint32) tmp & ~FR_REPLACE_ITEM_FOUND );
|
2010-03-16 18:22:59 +00:00
|
|
|
m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) );
|
|
|
|
m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, wxEmptyString ) );
|
|
|
|
|
|
|
|
/* Load the find and replace string history list. */
|
|
|
|
for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ )
|
|
|
|
{
|
|
|
|
wxString tmpHistory;
|
|
|
|
wxString entry;
|
|
|
|
entry.Printf( FindStringHistoryEntry, i );
|
|
|
|
tmpHistory = cfg->Read( entry, wxEmptyString );
|
|
|
|
|
|
|
|
if( !tmpHistory.IsEmpty() )
|
|
|
|
m_findStringHistoryList.Add( tmpHistory );
|
|
|
|
|
|
|
|
entry.Printf( ReplaceStringHistoryEntry, i );
|
|
|
|
tmpHistory = cfg->Read( entry, wxEmptyString );
|
|
|
|
|
|
|
|
if( !tmpHistory.IsEmpty() )
|
|
|
|
m_replaceStringHistoryList.Add( tmpHistory );
|
|
|
|
}
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
wxString templateFieldNames = cfg->Read( FieldNamesEntry, wxEmptyString );
|
|
|
|
|
|
|
|
if( !templateFieldNames.IsEmpty() )
|
|
|
|
{
|
2011-02-28 18:36:19 +00:00
|
|
|
TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
|
2010-06-17 16:30:10 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
m_TemplateFieldNames.Parse( &lexer );
|
|
|
|
}
|
2011-01-05 21:13:47 +00:00
|
|
|
catch( IO_ERROR& e )
|
2010-06-17 16:30:10 +00:00
|
|
|
{
|
|
|
|
// @todo show error msg
|
2010-12-20 16:42:34 +00:00
|
|
|
D( printf( "templatefieldnames parsing error: '%s'\n",
|
2011-02-28 18:36:19 +00:00
|
|
|
TO_UTF8( e.errorText ) ); )
|
2010-06-17 16:30:10 +00:00
|
|
|
}
|
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::SaveSettings()
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2009-04-29 17:09:00 +00:00
|
|
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
|
|
|
|
|
|
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_DRAW_FRAME::SaveSettings();
|
2009-04-29 17:09:00 +00:00
|
|
|
|
|
|
|
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
|
|
|
|
|
2009-06-02 07:26:49 +00:00
|
|
|
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
|
2011-12-09 16:37:11 +00:00
|
|
|
cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
|
2009-05-01 18:06:03 +00:00
|
|
|
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
|
2010-02-02 15:01:09 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/* Save print preview window session settings. */
|
2010-02-02 15:01:09 +00:00
|
|
|
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
|
|
|
|
cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y );
|
|
|
|
cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() );
|
|
|
|
cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() );
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/* Save print dialog session settings. */
|
2010-02-02 15:01:09 +00:00
|
|
|
cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x );
|
|
|
|
cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y );
|
|
|
|
cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() );
|
|
|
|
cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() );
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
// Save netlists options:
|
|
|
|
cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames );
|
2011-06-15 18:44:24 +00:00
|
|
|
cfg->Write( SimulatorCommandEntry, m_simulatorCommand );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/* Save find dialog session setting. */
|
|
|
|
cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x );
|
|
|
|
cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y );
|
|
|
|
cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() );
|
|
|
|
cfg->Write( FindDialogHeightEntry, m_findDialogSize.GetHeight() );
|
|
|
|
wxASSERT_MSG( m_findReplaceData,
|
|
|
|
wxT( "Find dialog data settings object not created. Bad programmer!" ) );
|
2011-12-13 15:37:33 +00:00
|
|
|
cfg->Write( FindReplaceFlagsEntry,
|
|
|
|
(long) m_findReplaceData->GetFlags() & ~FR_REPLACE_ITEM_FOUND );
|
2010-03-16 18:22:59 +00:00
|
|
|
cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() );
|
|
|
|
cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() );
|
|
|
|
|
|
|
|
/* Save the find and replace string history list. */
|
|
|
|
size_t i;
|
|
|
|
wxString tmpHistory;
|
2010-06-17 16:30:10 +00:00
|
|
|
wxString entry; // invoke constructor outside of any loops
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
for ( i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
|
|
|
|
{
|
|
|
|
entry.Printf( FindStringHistoryEntry, i );
|
|
|
|
cfg->Write( entry, m_findStringHistoryList[ i ] );
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
|
|
|
|
{
|
|
|
|
entry.Printf( ReplaceStringHistoryEntry, i );
|
|
|
|
cfg->Write( entry, m_replaceStringHistoryList[ i ] );
|
|
|
|
}
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
// Save template fieldnames
|
2010-08-09 02:03:16 +00:00
|
|
|
STRING_FORMATTER sf;
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
m_TemplateFieldNames.Format( &sf, 0 );
|
|
|
|
|
2011-08-16 15:36:25 +00:00
|
|
|
D(printf("saving formatted template fieldnames:'%s'\n", sf.GetString().c_str() );)
|
|
|
|
|
2011-02-28 18:36:19 +00:00
|
|
|
wxString record = FROM_UTF8( sf.GetString().c_str() );
|
2010-06-17 16:30:10 +00:00
|
|
|
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
|
|
|
|
record.Replace( wxT(" "), wxT(" "), true ); // double space to single
|
|
|
|
|
|
|
|
cfg->Write( FieldNamesEntry, record );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|