Remove useless or not working code used in Load/Save config.

This commit is contained in:
jean-pierre charras 2015-08-31 08:43:33 +02:00
parent 4e94d522a6
commit f7f7e3e918
10 changed files with 32 additions and 61 deletions

View File

@ -227,7 +227,7 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
{
int maximized = 0;
wxString baseCfgName = GetName();
wxString baseCfgName = ConfigBaseName();
wxString text = baseCfgName + wxT( "Pos_x" );
aCfg->Read( text, &m_FramePos.x );
@ -275,7 +275,7 @@ void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
if( IsIconized() )
return;
wxString baseCfgName = GetName();
wxString baseCfgName = ConfigBaseName();
m_FrameSize = GetSize();
m_FramePos = GetPosition();

View File

@ -658,7 +658,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
wxString baseCfgName = GetName();
wxString baseCfgName = ConfigBaseName();
aCfg->Read( baseCfgName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
@ -685,7 +685,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_BASE_FRAME::SaveSettings( aCfg );
wxString baseCfgName = GetName();
wxString baseCfgName = ConfigBaseName();
aCfg->Write( baseCfgName + CursorShapeEntryKeyword, m_cursorShape );
aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );

View File

@ -738,8 +738,6 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
wxConfigPathChanger cpc( aCfg, m_configPath );
SetGridColor( GetLayerColor( LAYER_GRID ) );
SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) );
@ -765,8 +763,6 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::SaveSettings( aCfg );
wxConfigPathChanger cpc( aCfg, m_configPath );
aCfg->Write( lastLibExportPathEntry, m_lastLibExportPath );
aCfg->Write( lastLibImportPathEntry, m_lastLibImportPath );
aCfg->Write( DefaultPinLengthEntry, (long) GetDefaultPinLength() );

View File

@ -179,12 +179,11 @@ END_EVENT_TABLE()
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() )
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
{
wxASSERT( aParent );
m_showAxis = true; // true to draw axis
m_configPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false );
m_drawSpecificConvert = true;
m_drawSpecificUnit = false;
@ -304,11 +303,6 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
m_tempCopyComponent = NULL;
}
const wxChar* LIB_EDIT_FRAME::GetLibEditFrameName()
{
return LIB_EDIT_FRAME_NAME;
}
void LIB_EDIT_FRAME::SetDrawItem( LIB_ITEM* drawItem )
{

View File

@ -56,7 +56,6 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
wxComboBox* m_partSelectBox; ///< a Box to select a part to edit (if any)
wxComboBox* m_aliasSelectBox; ///< a box to select the alias to edit (if any)
wxString m_configPath;
wxString m_lastLibImportPath;
wxString m_lastLibExportPath;
@ -134,13 +133,6 @@ public:
~LIB_EDIT_FRAME();
/**
* Function GetLibEditFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetLibEditFrameName();
/** The current library being edited, or NULL if none. */
PART_LIB* GetCurLib();

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -105,14 +105,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT :
#endif
KICAD_DEFAULT_DRAWFRAME_STYLE,
GetLibViewerFrameName() )
LIB_VIEW_FRAME_NAME )
{
wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL );
if( aFrameType == FRAME_SCH_VIEWER_MODAL )
SetModal( true );
m_configPath = wxT( "LibraryViewer" );
m_configFrameName = LIB_VIEW_FRAME_NAME;
// Give an icon
wxIcon icon;
@ -243,12 +243,6 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
}
const wxChar* LIB_VIEW_FRAME::GetLibViewerFrameName()
{
return LIB_VIEW_FRAME_NAME;
}
void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( !IsModal() )
@ -549,8 +543,6 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
SetGridColor( GetLayerColor( LAYER_GRID ) );
SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) );
wxConfigPathChanger cpc( aCfg, m_configPath );
aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
@ -567,8 +559,6 @@ void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::SaveSettings( aCfg );
wxConfigPathChanger cpc( aCfg, m_configPath );
if( m_libListWidth && m_libList )
{
m_libListWidth = m_libList->GetSize().x;

View File

@ -61,13 +61,6 @@ public:
~LIB_VIEW_FRAME();
/**
* Function GetLibViewerFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetLibViewerFrameName();
void OnSize( wxSizeEvent& event );
/**
@ -179,8 +172,6 @@ private:
bool m_listPowerCmpOnly;
wxArrayString m_allowedLibs;
wxString m_configPath; // subpath for configuration
// TODO(hzeller): looks like these members were chosen to be static to survive different
// instances of this browser and communicate it to the next instance. This looks like an
// ugly hack, and should be solved differently.

View File

@ -129,6 +129,9 @@ protected:
wxPoint m_FramePos;
wxSize m_FrameSize;
wxString m_configFrameName; ///< prefix used in config to identify some params (frame size...)
///< if empty, the frame name defined in CTOR is used
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
wxString m_AboutTitle; ///< Name of program displayed in About.
@ -248,6 +251,23 @@ public:
*/
virtual void SaveSettings( wxConfigBase* aCfg );
/**
* Function ConfigBaseName
* @return a base name prefix used in Load/Save settings to build
* the full name of keys used in config.
* This is usually the name of the frame set by CTOR, unless m_configFrameName
* contains a base name.
* this is the case of frames which can be shown in normal or modal mode.
* This is needed because we want only one base name prefix,
* regardless the mode used.
*/
wxString ConfigBaseName()
{
wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
return baseCfgName;
}
/**
* Function SaveProjectSettings
* saves changes to the project settings to the project (.pro) file.

View File

@ -126,14 +126,14 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT :
#endif
KICAD_DEFAULT_DRAWFRAME_STYLE,
GetFootprintViewerFrameName() )
FOOTPRINT_VIEWER_FRAME_NAME )
{
wxASSERT( aFrameType==FRAME_PCB_MODULE_VIEWER || aFrameType==FRAME_PCB_MODULE_VIEWER_MODAL );
if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL )
SetModal( true );
m_configPath = wxT( "FootprintViewer" );
m_configFrameName = FOOTPRINT_VIEWER_FRAME_NAME;
m_showAxis = true; // true to draw axis.
// Give an icon
@ -288,11 +288,6 @@ FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
}
const wxChar* FOOTPRINT_VIEWER_FRAME::GetFootprintViewerFrameName()
{
return FOOTPRINT_VIEWER_FRAME_NAME;
}
void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
{

View File

@ -52,13 +52,6 @@ protected:
public:
~FOOTPRINT_VIEWER_FRAME();
/**
* Function GetFootprintViewerFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetFootprintViewerFrameName();
virtual EDA_COLOR_T GetGridColor() const;
/**