From 59d02cf1a4fb9392888b14215fcd57dce29cb9a2 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 22 Dec 2015 12:58:26 +0100 Subject: [PATCH] Minor fixes: * fix minor coding style issues. * remove unused member in modview_frame. * use different frame names in ctor of modview_frame and viewlib_frame depending on the fact they are built modal or not modal (allowing identifications when calling wxFindWindowByName) * change questionnable code in class_libentry.cpp. * remove unused code in class_treeproject_item.cpp --- eeschema/class_libentry.cpp | 10 +++++----- eeschema/viewlib_frame.cpp | 7 ++++++- kicad/class_treeproject_item.cpp | 5 +---- pcbnew/footprint_wizard_frame.cpp | 2 +- pcbnew/loadcmp.cpp | 4 ++-- pcbnew/moduleframe.cpp | 3 ++- pcbnew/modview_frame.cpp | 15 ++++++++++++--- pcbnew/modview_frame.h | 2 -- pcbnew/pcbnew.cpp | 2 +- 9 files changed, 30 insertions(+), 20 deletions(-) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 8941a05d70..0c65285d09 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -537,7 +537,7 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD LIB_ITEMS::iterator i; - for( i = drawings.begin(); i < drawings.end(); i++ ) + for( i = drawings.begin(); i != drawings.end(); i++ ) { if( *i == aItem ) { @@ -1222,7 +1222,7 @@ void LIB_PART::deleteAllFields() { LIB_ITEMS::iterator it; - for( it = drawings.begin(); it!=drawings.end(); /* deleting */ ) + for( it = drawings.begin(); it != drawings.end(); /* deleting */ ) { if( it->Type() != LIB_FIELD_T ) { @@ -1709,7 +1709,7 @@ wxArrayString LIB_PART::GetAliasNames( bool aIncludeRoot ) const LIB_ALIASES::const_iterator it; - for( it=m_aliases.begin(); itIsRoot() ) continue; @@ -1756,7 +1756,7 @@ void LIB_PART::SetAliases( const wxArrayString& aAliasList ) // Remove names in the current component that are not in the new alias list. LIB_ALIASES::iterator it; - for( it = m_aliases.begin(); it < m_aliases.end(); it++ ) + for( it = m_aliases.begin(); it != m_aliases.end(); it++ ) { int index = aAliasList.Index( (*it)->GetName(), false ); @@ -1778,7 +1778,7 @@ void LIB_PART::RemoveAlias( const wxString& aName ) LIB_ALIASES::iterator it; - for( it = m_aliases.begin(); it < m_aliases.end(); it++ ) + for( it = m_aliases.begin(); it != m_aliases.end(); it++ ) { if( Cmp_KEEPCASE( aName, (*it)->GetName() ) == 0 ) { diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index ddcefa9754..aae94ad25d 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -93,6 +93,7 @@ END_EVENT_TABLE() */ #define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" ) +#define LIB_VIEW_FRAME_NAME_MODAL wxT( "ViewlibFrameModal" ) LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, PART_LIB* aLibrary ) : @@ -105,13 +106,17 @@ 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, - LIB_VIEW_FRAME_NAME ) + aFrameType == FRAME_SCH_VIEWER_MODAL ? + LIB_VIEW_FRAME_NAME_MODAL : LIB_VIEW_FRAME_NAME ) { wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL ); if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); + // Force the frame name used in config. the lib viewer frame has a name + // depending on aFrameType (needed to identify the frame by wxWidgets), + // but only one configuration is preferable. m_configFrameName = LIB_VIEW_FRAME_NAME; // Give an icon diff --git a/kicad/class_treeproject_item.cpp b/kicad/class_treeproject_item.cpp index 8a6e135a8a..cdf2c71fd5 100644 --- a/kicad/class_treeproject_item.cpp +++ b/kicad/class_treeproject_item.cpp @@ -224,12 +224,9 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe ) OpenPDF( fullFileName ); break; -/* No, use a text editor. Netlists can only be handled sanely now from within - eeschema's launcher for the *.kiface, NOT THE EXE which is now gone. case TREE_NET: - frame->Execute( m_parent, CVPCB_EXE, fullFileName ); + // Nothing to do ( can be read only by Pcbnew, or by a text editor) break; -*/ case TREE_TXT: { diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index ff4009ef18..aefeb0f43c 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -99,7 +99,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, #endif FOOTPRINT_WIZARD_FRAME_NAME ) { - wxASSERT( aFrameType==FRAME_PCB_FOOTPRINT_WIZARD_MODAL ); + wxASSERT( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD_MODAL ); // This frame is always show modal: SetModal( true ); diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 3bf97109ac..907275a355 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -196,13 +196,13 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, return NULL; } - if( dlg.IsKeyword() ) // Selection by keywords + if( dlg.IsKeyword() ) // Selection by keywords { allowWildSeach = false; keys = moduleName; moduleName = SelectFootprint( this, libName, wxEmptyString, keys, aTable ); - if( moduleName.IsEmpty() ) // Cancel command + if( moduleName.IsEmpty() ) // Cancel command { m_canvas->MoveCursorToCrossHair(); return NULL; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 9a9f259514..c1e1ac6809 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -740,7 +740,8 @@ void FOOTPRINT_EDIT_FRAME::OnModify() EDA_3D_FRAME* draw3DFrame = Get3DViewerFrame(); if( draw3DFrame ) - draw3DFrame->ReloadRequest();} + draw3DFrame->ReloadRequest(); +} void FOOTPRINT_EDIT_FRAME::updateTitle() diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index c03d541cc4..93c9c6f9d3 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -113,7 +113,8 @@ END_EVENT_TABLE() */ -#define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) +#define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) +#define FOOTPRINT_VIEWER_FRAME_NAME_MODAL wxT( "ModViewFrameModal" ) FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) : @@ -126,14 +127,22 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT : #endif KICAD_DEFAULT_DRAWFRAME_STYLE, - FOOTPRINT_VIEWER_FRAME_NAME ) + + aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ? + FOOTPRINT_VIEWER_FRAME_NAME_MODAL + : FOOTPRINT_VIEWER_FRAME_NAME ) { - wxASSERT( aFrameType==FRAME_PCB_MODULE_VIEWER || aFrameType==FRAME_PCB_MODULE_VIEWER_MODAL ); + wxASSERT( aFrameType==FRAME_PCB_MODULE_VIEWER || + aFrameType==FRAME_PCB_MODULE_VIEWER_MODAL ); if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ) SetModal( true ); + // Force the frame name used in config. the footprint viewer frame has a name + // depending on aFrameType (needed to identify the frame by wxWidgets), + // but only one configuration is preferable. m_configFrameName = FOOTPRINT_VIEWER_FRAME_NAME; + m_showAxis = true; // true to draw axis. // Give an icon diff --git a/pcbnew/modview_frame.h b/pcbnew/modview_frame.h index cd472d6b12..f0cf28d551 100644 --- a/pcbnew/modview_frame.h +++ b/pcbnew/modview_frame.h @@ -67,8 +67,6 @@ private: wxListBox* m_libList; // The list of libs names wxListBox* m_footprintList; // The list of footprint names - wxString m_configPath; // subpath for configuration - const wxString getCurNickname(); void setCurNickname( const wxString& aNickname ); diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index cbac2a5732..86cea725a1 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -148,7 +148,7 @@ static struct IFACE : public KIFACE_I break; default: - ; + break; } return frame;