From c7d04c3d08692221fcc886dae1b38c3155d10334 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 3 Mar 2015 15:53:47 +0100 Subject: [PATCH] Code cleaning: Remove EDA_BASE_FRAME::m_FrameName member which is a duplicate of wxFrame name. --- common/basicframe.cpp | 32 +++++++++++-------- common/draw_frame.cpp | 20 +++++++----- common/hotkeys_basic.cpp | 4 +-- cvpcb/class_DisplayFootprintsFrame.cpp | 1 - cvpcb/cvframe.cpp | 1 - eeschema/libeditframe.cpp | 1 - eeschema/schframe.cpp | 1 - eeschema/viewlib_frame.cpp | 1 - gerbview/gerbview_frame.cpp | 1 - include/wxstruct.h | 7 ++-- kicad/mainframe.cpp | 1 - pagelayout_editor/pl_editor_frame.cpp | 1 - pcbnew/basepcbframe.cpp | 44 ++++++++++++++------------ pcbnew/footprint_wizard_frame.cpp | 1 - pcbnew/moduleframe.cpp | 1 - pcbnew/modview_frame.cpp | 1 - pcbnew/pcbframe.cpp | 1 - 17 files changed, 58 insertions(+), 61 deletions(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index ca0bcb6b65..69c65d7f84 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -226,24 +226,26 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) { int maximized = 0; - wxString text = m_FrameName + wxT( "Pos_x" ); + wxString baseCfgName = GetName(); + + wxString text = baseCfgName + wxT( "Pos_x" ); aCfg->Read( text, &m_FramePos.x ); - text = m_FrameName + wxT( "Pos_y" ); + text = baseCfgName + wxT( "Pos_y" ); aCfg->Read( text, &m_FramePos.y ); - text = m_FrameName + wxT( "Size_x" ); + text = baseCfgName + wxT( "Size_x" ); aCfg->Read( text, &m_FrameSize.x, 600 ); - text = m_FrameName + wxT( "Size_y" ); + text = baseCfgName + wxT( "Size_y" ); aCfg->Read( text, &m_FrameSize.y, 400 ); - text = m_FrameName + wxT( "Maximized" ); + text = baseCfgName + wxT( "Maximized" ); aCfg->Read( text, &maximized, 0 ); if( m_hasAutoSave ) { - text = m_FrameName + entryAutoSaveInterval; + text = baseCfgName + entryAutoSaveInterval; aCfg->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL ); } @@ -261,7 +263,7 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) if( maximized ) Maximize(); - aCfg->Read( m_FrameName + entryPerspective, &m_perspective ); + aCfg->Read( baseCfgName + entryPerspective, &m_perspective ); } @@ -272,27 +274,29 @@ void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg ) if( IsIconized() ) return; + wxString baseCfgName = GetName(); + m_FrameSize = GetSize(); m_FramePos = GetPosition(); - text = m_FrameName + wxT( "Pos_x" ); + text = baseCfgName + wxT( "Pos_x" ); aCfg->Write( text, (long) m_FramePos.x ); - text = m_FrameName + wxT( "Pos_y" ); + text = baseCfgName + wxT( "Pos_y" ); aCfg->Write( text, (long) m_FramePos.y ); - text = m_FrameName + wxT( "Size_x" ); + text = baseCfgName + wxT( "Size_x" ); aCfg->Write( text, (long) m_FrameSize.x ); - text = m_FrameName + wxT( "Size_y" ); + text = baseCfgName + wxT( "Size_y" ); aCfg->Write( text, (long) m_FrameSize.y ); - text = m_FrameName + wxT( "Maximized" ); + text = baseCfgName + wxT( "Maximized" ); aCfg->Write( text, IsMaximized() ); if( m_hasAutoSave ) { - text = m_FrameName + entryAutoSaveInterval; + text = baseCfgName + entryAutoSaveInterval; aCfg->Write( text, m_autoSaveInterval ); } @@ -303,7 +307,7 @@ void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg ) // printf( "perspective(%s): %s\n", // TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) ); - aCfg->Write( m_FrameName + entryPerspective, perspective ); + aCfg->Write( baseCfgName + entryPerspective, perspective ); } diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 63d84ed9c0..ef5d6fae04 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -642,17 +642,19 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::LoadSettings( aCfg ); - aCfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 ); + wxString baseCfgName = GetName(); + + aCfg->Read( baseCfgName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 ); bool btmp; - if( aCfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) ) + if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); int itmp; - if( aCfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) ) + if( aCfg->Read( baseCfgName + GridColorEntryKeyword, &itmp ) ) SetGridColor( ColorFromInt( itmp ) ); - aCfg->Read( m_FrameName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); + aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); // m_LastGridSizeId is an offset, expected to be >= 0 if( m_LastGridSizeId < 0 ) @@ -664,10 +666,12 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::SaveSettings( aCfg ); - aCfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape ); - aCfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() ); - aCfg->Write( m_FrameName + GridColorEntryKeyword, ( long ) GetGridColor() ); - aCfg->Write( m_FrameName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId ); + wxString baseCfgName = GetName(); + + aCfg->Write( baseCfgName + CursorShapeEntryKeyword, m_cursorShape ); + aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() ); + aCfg->Write( baseCfgName + GridColorEntryKeyword, ( long ) GetGridColor() ); + aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId ); } diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index 0b5a53d343..311ceb175c 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -534,7 +534,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, } else { - wxFileName fn( m_FrameName ); + wxFileName fn( GetName() ); fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT ); wxConfigBase* config = GetNewConfig( fn.GetFullPath() ); config->Write( HOTKEYS_CONFIG_KEY, msg ); @@ -604,7 +604,7 @@ void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescL */ int EDA_BASE_FRAME::ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList ) { - ::ReadHotkeyConfig( m_FrameName, aDescList ); + ::ReadHotkeyConfig( GetName(), aDescList ); return 1; } diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 07b1721ebe..625ef1a913 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -76,7 +76,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ) { - m_FrameName = FOOTPRINTVIEWER_FRAME_NAME; m_showAxis = true; // true to draw axis. // Give an icon diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 12b1067f7c..a48f980526 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -104,7 +104,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ) { - m_FrameName = CVPCB_MAINFRAME_NAME; m_compListBox = NULL; m_footprintListBox = NULL; m_libListBox = NULL; diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 7e5c073d4a..d344c9c040 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -184,7 +184,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : { wxASSERT( aParent ); - m_FrameName = GetLibEditFrameName(); m_showAxis = true; // true to draw axis m_configPath = wxT( "LibraryEditor" ); SetShowDeMorgan( false ); diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index f22cedcb0e..9e802aa6b4 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -307,7 +307,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ), m_item_to_repeat( 0 ) { - m_FrameName = SCH_EDIT_FRAME_NAME; m_showAxis = false; // true to show axis m_showBorderAndTitleBlock = true; // true to show sheet references m_CurrentSheet = new SCH_SHEET_PATH; diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 33c2d69cc8..cd8b8ba0c5 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -92,7 +92,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); - m_FrameName = GetLibViewerFrameName(); m_configPath = wxT( "LibraryViewer" ); // Give an icon diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 6f1261bd91..e2d46afc26 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -76,7 +76,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): PAGE_INFO pageInfo( wxT( "GERBER" ) ); SetPageSettings( pageInfo ); - m_FrameName = GERBVIEW_FRAME_NAME; m_show_layer_manager_tools = true; m_showAxis = true; // true to show X and Y axis on screen diff --git a/include/wxstruct.h b/include/wxstruct.h index 0a1fa481f0..6ce0a79265 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr * Copyright (C) 2011-2015 Wayne Stambaugh * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * @@ -118,8 +118,7 @@ protected: wxSize m_FrameSize; wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar - wxString m_FrameName; ///< name used for writing and reading setup - ///< It is "SchematicFrame", "PcbFrame" .... + wxString m_AboutTitle; ///< Name of program displayed in About. wxAuiManager m_auimgr; @@ -197,8 +196,6 @@ public: int GetAutoSaveInterval() const { return m_autoSaveInterval; } - wxString GetName() const { return m_FrameName; } - bool IsType( FRAME_T aType ) const { return m_Ident == aType; } void GetKicadHelp( wxCommandEvent& event ); diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index ee67564e4b..6205c3cd5c 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -52,7 +52,6 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, { m_leftWinWidth = 60; m_manager_Hokeys_Descr = NULL; - m_FrameName = KICAD_MANAGER_FRAME_NAME; // Create the status line (bottom of the frame static const int dims[3] = { -1, -1, 100 }; diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index be1abd7552..e418191708 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -54,7 +54,6 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME ) { - m_FrameName = PL_EDITOR_FRAME_NAME; m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1 // when the screen shows a 1:1 image // obviously depends on the monitor, diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index d97a46719d..8e539bfff8 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -752,23 +752,25 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) (m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000; - aCfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 ); - aCfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); + wxString baseCfgName = GetName(); + + aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 ); + aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); long itmp; - aCfg->Read( m_FrameName + UserGridUnitsEntry, &itmp, ( long )INCHES ); + aCfg->Read( baseCfgName + UserGridUnitsEntry, &itmp, ( long )INCHES ); m_UserGridUnit = (EDA_UNITS_T) itmp; - aCfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true ); - aCfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true ); - aCfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true ); - aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true ); + aCfg->Read( baseCfgName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true ); + aCfg->Read( baseCfgName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true ); + aCfg->Read( baseCfgName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true ); + aCfg->Read( baseCfgName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true ); - aCfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0); + aCfg->Read( baseCfgName + FastGrid1Entry, &itmp, ( long )0); m_FastGrid1 = itmp; - aCfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0); + aCfg->Read( baseCfgName + FastGrid2Entry, &itmp, ( long )0); m_FastGrid2 = itmp; - aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true ); + aCfg->Read( baseCfgName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true ); } @@ -776,16 +778,18 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::SaveSettings( aCfg ); - aCfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x ); - aCfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y ); - aCfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnit ); - aCfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill ); - aCfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill ); - aCfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum ); - aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill ); - aCfg->Write( m_FrameName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill ); - aCfg->Write( m_FrameName + FastGrid1Entry, ( long )m_FastGrid1 ); - aCfg->Write( m_FrameName + FastGrid2Entry, ( long )m_FastGrid2 ); + wxString baseCfgName = GetName(); + + aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x ); + aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y ); + aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )m_UserGridUnit ); + aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill ); + aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill ); + aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum ); + aCfg->Write( baseCfgName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill ); + aCfg->Write( baseCfgName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill ); + aCfg->Write( baseCfgName + FastGrid1Entry, ( long )m_FastGrid1 ); + aCfg->Write( baseCfgName + FastGrid2Entry, ( long )m_FastGrid2 ); } diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 98334bdf5e..b57988b4bf 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -129,7 +129,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); - m_FrameName = FOOTPRINT_WIZARD_FRAME_NAME; m_configPath = wxT( "FootprintWizard" ); m_showAxis = true; // true to draw axis. diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 800b648ca3..4c268b1f6d 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -199,7 +199,6 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ) { - m_FrameName = GetFootprintEditorFrameName(); m_showBorderAndTitleBlock = false; // true to show the frame references m_showAxis = true; // true to show X and Y axis on screen m_showGridAxis = true; // show the grid origin axis diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index f73f688f8a..189ff36bc1 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -113,7 +113,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ) SetModal( true ); - m_FrameName = GetFootprintViewerFrameName(); m_configPath = wxT( "FootprintViewer" ); m_showAxis = true; // true to draw axis. diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 73218f21cf..b74dc527ca 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -305,7 +305,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PCB_EDIT_FRAME_NAME ) { - m_FrameName = PCB_EDIT_FRAME_NAME; m_showBorderAndTitleBlock = true; // true to display sheet references m_showAxis = false; // true to display X and Y axis m_showOriginAxis = true;