From 64925bfc4f18fdf530b34be54f399756df09a7e5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 18 Jan 2015 18:28:14 +0100 Subject: [PATCH] Very minor fixes: add missing const return type to some GetBoundingBox() declarations. Change few functions names to better names in some places (like GetName() to GetPinName() ) --- common/class_bitmap_base.cpp | 2 +- eeschema/class_libentry.cpp | 4 ++-- eeschema/class_libentry.h | 4 ++-- eeschema/dialogs/dialog_lib_edit_pin.cpp | 4 ++-- eeschema/dialogs/dialog_lib_edit_pin.h | 10 +++++----- eeschema/pinedit.cpp | 13 ++++++------- include/class_bitmap_base.h | 4 ++-- pagelayout_editor/class_pl_editor_layout.h | 2 +- polygon/PolyLine.cpp | 4 ++-- polygon/PolyLine.h | 4 ++-- 10 files changed, 25 insertions(+), 26 deletions(-) diff --git a/common/class_bitmap_base.cpp b/common/class_bitmap_base.cpp index 68d80e7612..134ebe5299 100644 --- a/common/class_bitmap_base.cpp +++ b/common/class_bitmap_base.cpp @@ -197,7 +197,7 @@ bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg ) } -EDA_RECT BITMAP_BASE::GetBoundingBox() const +const EDA_RECT BITMAP_BASE::GetBoundingBox() const { EDA_RECT rect; diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index f55b74c21a..93970d4f0f 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -1055,7 +1055,7 @@ bool LIB_PART::LoadFootprints( LINE_READER& aLineReader, wxString& aErrorMsg ) } -EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const +const EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const { EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); @@ -1080,7 +1080,7 @@ EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const } -EDA_RECT LIB_PART::GetBodyBoundingBox( int aUnit, int aConvert ) const +const EDA_RECT LIB_PART::GetBodyBoundingBox( int aUnit, int aConvert ) const { EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index fc88c91ced..21374863df 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -296,7 +296,7 @@ public: * if aConvert == 0 Convert is non used * Invisible fields are not taken in account **/ - EDA_RECT GetBoundingBox( int aUnit, int aConvert ) const; + const EDA_RECT GetBoundingBox( int aUnit, int aConvert ) const; /** * Function GetBodyBoundingBox @@ -307,7 +307,7 @@ public: * if aConvert == 0 Convert is non used * Fields are not taken in account **/ - EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert ) const; + const EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert ) const; /** * Function SaveDateAndTime diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp index 41b8e9d561..1c99632449 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp @@ -118,14 +118,14 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) if( ! IsShown() ) // do nothing at init time return; - int pinNameSize = ValueFromString( g_UserUnit, GetNameTextSize() ); + int pinNameSize = ValueFromString( g_UserUnit, GetPinNameTextSize() ); int pinNumSize = ValueFromString( g_UserUnit, GetPadNameTextSize()); int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); int pinLength = ValueFromString( g_UserUnit, GetLength() ); int pinShape = LIB_PIN::GetStyleCode( GetStyle() ); int pinType = GetElectricalType(); - m_dummyPin->SetName( GetName() ); + m_dummyPin->SetName( GetPinName() ); m_dummyPin->SetNameTextSize( pinNameSize ); m_dummyPin->SetNumber( GetPadName() ); m_dummyPin->SetNumberTextSize( pinNumSize ); diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h index 6ec6d95b73..948a32ad6d 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin.h +++ b/eeschema/dialogs/dialog_lib_edit_pin.h @@ -71,19 +71,19 @@ public: void SetStyle( int style ) { m_choiceStyle->SetSelection( style ); } int GetStyle( void ) { return m_choiceStyle->GetSelection(); } - void SetName( const wxString& name ) { m_textPinName->SetValue( name ); } - wxString GetName( void ) { return m_textPinName->GetValue(); } + void SetPinName( const wxString& name ) { m_textPinName->SetValue( name ); } + wxString GetPinName( void ) { return m_textPinName->GetValue(); } - void SetNameTextSize( const wxString& size ) + void SetPinNameTextSize( const wxString& size ) { m_textPinNameTextSize->SetValue( size ); } - wxString GetNameTextSize( void ) + wxString GetPinNameTextSize( void ) { return m_textPinNameTextSize->GetValue(); } - void SetNameTextSizeUnits( const wxString& units ) + void SetPinNameTextSizeUnits( const wxString& units ) { m_staticNameTextSizeUnits->SetLabel( units ); } diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index f7b585310e..0977a59dd2 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -1,7 +1,7 @@ /* * 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) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2011 Wayne Stambaugh * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * @@ -110,9 +110,9 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(), LIB_PIN::GetElectricalTypeSymbols() ); dlg.SetElectricalType( pin->GetType() ); - dlg.SetName( pin->GetName() ); - dlg.SetNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) ); - dlg.SetNameTextSizeUnits( units ); + dlg.SetPinName( pin->GetName() ); + dlg.SetPinNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) ); + dlg.SetPinNameTextSizeUnits( units ); dlg.SetPadName( pin->GetNumberString() ); dlg.SetPadNameTextSize( StringFromValue( g_UserUnit, pin->GetNumberTextSize() ) ); @@ -132,7 +132,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) dlg.Layout(); dlg.Fit(); dlg.SetMinSize( dlg.GetSize() ); - // dlg.SetLastSizeAndPosition(); // done in DIALOG_SHIM::Show() if( dlg.ShowModal() == wxID_CANCEL ) { @@ -145,7 +144,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) } // Save the pin properties to use for the next new pin. - LastPinNameSize = ValueFromString( g_UserUnit, dlg.GetNameTextSize() ); + LastPinNameSize = ValueFromString( g_UserUnit, dlg.GetPinNameTextSize() ); LastPinNumSize = ValueFromString( g_UserUnit, dlg.GetPadNameTextSize() ); LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); LastPinLength = ValueFromString( g_UserUnit, dlg.GetLength() ); @@ -156,7 +155,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) LastPinVisible = dlg.GetVisible(); pin->EnableEditMode( true, m_editPinsPerPartOrConvert ); - pin->SetName( dlg.GetName() ); + pin->SetName( dlg.GetPinName() ); pin->SetNameTextSize( GetLastPinNameSize() ); pin->SetNumber( dlg.GetPadName() ); pin->SetNumberTextSize( GetLastPinNumSize() ); diff --git a/include/class_bitmap_base.h b/include/class_bitmap_base.h index db07c41d6c..53c5b835ce 100644 --- a/include/class_bitmap_base.h +++ b/include/class_bitmap_base.h @@ -140,9 +140,9 @@ public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); * schematic coordinate system. It is OK to overestimate the size * by a few counts. */ - EDA_RECT GetBoundingBox() const; + const EDA_RECT GetBoundingBox() const; - void DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos ); + void DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos ); /** * Function ReadImageFile diff --git a/pagelayout_editor/class_pl_editor_layout.h b/pagelayout_editor/class_pl_editor_layout.h index cbd26ca3d2..db04fcc3ce 100644 --- a/pagelayout_editor/class_pl_editor_layout.h +++ b/pagelayout_editor/class_pl_editor_layout.h @@ -84,7 +84,7 @@ public: * may be called soon after ComputeBoundingBox() to return the same EDA_RECT, * as long as the CLASS_PL_EDITOR_LAYOUT has not changed. */ - EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override + const EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; } diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index e207f35282..4563b236a7 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -611,7 +611,7 @@ int CPolyLine::GetEndContour( int ic ) } -EDA_RECT CPolyLine::GetBoundingBox() +const EDA_RECT CPolyLine::GetBoundingBox() { int xmin = INT_MAX; int ymin = INT_MAX; @@ -634,7 +634,7 @@ EDA_RECT CPolyLine::GetBoundingBox() } -EDA_RECT CPolyLine::GetBoundingBox( int icont ) +const EDA_RECT CPolyLine::GetBoundingBox( int icont ) { int xmin = INT_MAX; int ymin = INT_MAX; diff --git a/polygon/PolyLine.h b/polygon/PolyLine.h index 8abf92461e..6e70e506bc 100644 --- a/polygon/PolyLine.h +++ b/polygon/PolyLine.h @@ -355,14 +355,14 @@ public: /** * @return the full bounding box of polygons */ - EDA_RECT GetBoundingBox(); + const EDA_RECT GetBoundingBox(); /** * @return the bounding box of a given polygon * @param icont = the index of the polygon contour * (0 = main contour, 1 ... n = other contours, usually holes) */ - EDA_RECT GetBoundingBox( int icont ); + const EDA_RECT GetBoundingBox( int icont ); void Copy( const CPolyLine* src ); bool TestPointInside( int x, int y );