From ef1c63169e29795afd5acea18755f36ed5333945 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 14 Dec 2011 11:25:42 -0600 Subject: [PATCH] fix EDA_ITEM::Show() prototype bug, fix KICAD_PLUGIN::Save() problem with netclasses. --- 3d-viewer/3d_struct.h | 15 ++++++++++++-- common/base_screen.cpp | 2 +- common/base_struct.cpp | 10 ++++------ eeschema/class_libentry.h | 9 ++++++++- eeschema/class_netlist_object.cpp | 4 +++- eeschema/class_netlist_object.h | 2 +- eeschema/lib_draw_item.h | 4 ++++ eeschema/lib_pin.cpp | 2 +- eeschema/lib_pin.h | 2 +- eeschema/lib_text.cpp | 2 +- eeschema/sch_bitmap.cpp | 2 +- eeschema/sch_bitmap.h | 2 +- eeschema/sch_bus_entry.h | 4 ++++ eeschema/sch_component.cpp | 10 +++++----- eeschema/sch_component.h | 19 +++++------------- eeschema/sch_field.h | 4 ++++ eeschema/sch_junction.cpp | 2 +- eeschema/sch_junction.h | 2 +- eeschema/sch_line.h | 2 +- eeschema/sch_marker.cpp | 9 +-------- eeschema/sch_marker.h | 9 ++++----- eeschema/sch_no_connect.h | 4 ++++ eeschema/sch_polyline.h | 4 ++++ eeschema/sch_sheet.cpp | 4 ++-- eeschema/sch_sheet.h | 10 ++-------- eeschema/sch_sheet_pin.cpp | 2 +- eeschema/sch_text.cpp | 2 +- eeschema/sch_text.h | 2 +- gerbview/class_gerber_draw_item.cpp | 2 +- gerbview/class_gerber_draw_item.h | 13 ++---------- include/base_struct.h | 4 +++- include/block_commande.h | 4 ++++ include/class_base_screen.h | 17 ++++------------ pcbnew/class_board.cpp | 27 ++++++++----------------- pcbnew/class_board.h | 11 +--------- pcbnew/class_dimension.h | 5 +++++ pcbnew/class_drawsegment.cpp | 9 +-------- pcbnew/class_drawsegment.h | 2 +- pcbnew/class_edge_mod.cpp | 9 +-------- pcbnew/class_edge_mod.h | 11 +--------- pcbnew/class_marker_pcb.h | 5 ++++- pcbnew/class_mire.h | 4 ++++ pcbnew/class_module.cpp | 9 +-------- pcbnew/class_module.h | 11 +--------- pcbnew/class_netclass.cpp | 2 +- pcbnew/class_netclass.h | 11 +--------- pcbnew/class_pad.cpp | 9 +-------- pcbnew/class_pad.h | 11 +--------- pcbnew/class_pcb_text.cpp | 9 +-------- pcbnew/class_pcb_text.h | 9 +-------- pcbnew/class_text_mod.cpp | 10 +--------- pcbnew/class_text_mod.h | 17 ++++------------ pcbnew/class_track.cpp | 4 ++-- pcbnew/class_track.h | 21 ++----------------- pcbnew/class_zone.h | 4 ++++ pcbnew/files.cpp | 31 +++++++++++++---------------- pcbnew/kicad_plugin.cpp | 6 +++--- 57 files changed, 158 insertions(+), 274 deletions(-) diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index cab00a947a..b27178e339 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -80,6 +80,10 @@ public: S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; } void SetMaterial(); + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; @@ -131,6 +135,10 @@ public: int ReadAppearance( FILE* file, int* LineNum ); int ReadGeometry( FILE* file, int* LineNum ); void Set_Object_Coords( std::vector< S3D_Vertex >& aVertices ); + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; @@ -150,6 +158,10 @@ public: Struct3D_Shape* Back() const { return (Struct3D_Shape*) Pback; } int ReadData( FILE* file, int* LineNum ); + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; @@ -185,5 +197,4 @@ public: void SetToolTip( const wxString& text ); }; - -#endif /* STRUCT_3D_H */ +#endif // STRUCT_3D_H diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 295f5ef3c9..2d0b8c5c60 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -516,7 +516,7 @@ void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem ) #if defined(DEBUG) -void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) +void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const { EDA_ITEM* item = m_drawList; diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 5064b742bf..c02cbef1b4 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -215,7 +215,6 @@ bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const #if defined(DEBUG) - // A function that should have been in wxWidgets std::ostream& operator<<( std::ostream& out, const wxSize& size ) { @@ -232,14 +231,14 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt ) } -void EDA_ITEM::Show( int nestLevel, std::ostream& os ) const +void EDA_ITEM::ShowDummy( std::ostream& os ) const { // XML output: wxString s = GetClass(); - NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">" - << " Need ::Show() override for this class " - << "\n"; + os << '<' << s.Lower().mb_str() << ">" + << " Need ::Show() override for this class " + << "\n"; } @@ -253,7 +252,6 @@ std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os ) return os; } - #endif diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 71ae5d17ef..a66a0d0bbb 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -167,6 +167,10 @@ public: } bool operator==( const LIB_ALIAS* aAlias ) const { return this == aAlias; } + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; extern bool operator<( const LIB_ALIAS& aItem1, const LIB_ALIAS& aItem2 ); @@ -672,7 +676,10 @@ public: bool ShowPinNumbers() { return m_showPinNumbers; } bool operator==( const LIB_COMPONENT* aComponent ) const { return this == aComponent; } + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; - #endif // CLASS_LIBENTRY_H diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp index 389c83a1db..b45889af9b 100644 --- a/eeschema/class_netlist_object.cpp +++ b/eeschema/class_netlist_object.cpp @@ -94,7 +94,7 @@ const char* ShowType( NETLIST_ITEM_T aType ) } -void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) +void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) const { wxString path = m_SheetList.PathHumanReadable(); @@ -114,8 +114,10 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) switch( m_Type ) { case NET_PIN: + /* GetRef() needs to be const out << " " << ((SCH_COMPONENT*)m_Link)->GetRef(&m_SheetList).mb_str() << "\n"; + */ if( m_Comp ) m_Comp->Show( 1, out ); diff --git a/eeschema/class_netlist_object.h b/eeschema/class_netlist_object.h index 47ee1d9891..9550067e28 100644 --- a/eeschema/class_netlist_object.h +++ b/eeschema/class_netlist_object.h @@ -142,7 +142,7 @@ public: */ #if defined(DEBUG) - void Show( std::ostream& out, int ndx ); + void Show( std::ostream& out, int ndx ) const; // override #endif NETLIST_OBJECT(); diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h index a3fbcd96fe..7e6dbd0de3 100644 --- a/eeschema/lib_draw_item.h +++ b/eeschema/lib_draw_item.h @@ -416,6 +416,10 @@ public: FILL_T GetFillMode() const { return m_Fill; } +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif + protected: /** diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 5e7b2c9e7a..6396785708 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -2163,7 +2163,7 @@ bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* #if defined(DEBUG) -void LIB_PIN::Show( int nestLevel, std::ostream& os ) +void LIB_PIN::Show( int nestLevel, std::ostream& os ) const { NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << " num=\"" << GetNumberString().mb_str() diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index a9e9ece060..d99fbd93ad 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -134,7 +134,7 @@ public: } #if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ); // virtual override + void Show( int nestLevel, std::ostream& os ) const; // virtual override #endif /** diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 26aaac1ab2..838fad628a 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -123,7 +123,7 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg ) } else { - cnt = sscanf( line + 2, "%d %d %d %d %d %d %d %s %s %d %c %c", + cnt = sscanf( line + 2, "%lf %d %d %d %d %d %d %s %s %d %c %c", &angle, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Attributs, &m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify, &vjustify ); diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index 573a829076..a3ef919b93 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -251,7 +251,7 @@ bool SCH_BITMAP::IsSelectStateChanged( const wxRect& aRect ) #if defined(DEBUG) -void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) +void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const { // XML output: wxString s = GetClass(); diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index 85399938ad..f6223a79e8 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -161,7 +161,7 @@ public: virtual BITMAP_DEF GetMenuImage() const { return image_xpm; } #if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ); + void Show( int nestLevel, std::ostream& os ) const; // override #endif private: diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index fafb03eff3..b2faf2242a 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -148,6 +148,10 @@ public: virtual BITMAP_DEF GetMenuImage() const { return add_entry_xpm; } +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif + private: virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index a3bcb2fd08..7a4c82b3e8 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -380,7 +380,7 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath, } -wxString SCH_COMPONENT::GetPath( SCH_SHEET_PATH* sheet ) +wxString SCH_COMPONENT::GetPath( const SCH_SHEET_PATH* sheet ) const { wxCHECK_MSG( sheet != NULL, wxEmptyString, wxT( "Cannot get component path with invalid sheet object." ) ); @@ -392,7 +392,7 @@ wxString SCH_COMPONENT::GetPath( SCH_SHEET_PATH* sheet ) } -const wxString SCH_COMPONENT::GetRef( SCH_SHEET_PATH* sheet ) +const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet ) { wxString path = GetPath( sheet ); wxString h_path, h_ref; @@ -435,7 +435,7 @@ const wxString SCH_COMPONENT::GetRef( SCH_SHEET_PATH* sheet ) * i.e starts by letter * returns true if OK */ -bool SCH_COMPONENT::IsReferenceStringValid( const wxString & aReferenceString ) +bool SCH_COMPONENT::IsReferenceStringValid( const wxString& aReferenceString ) { wxString text = aReferenceString; bool ok = true; @@ -454,7 +454,7 @@ bool SCH_COMPONENT::IsReferenceStringValid( const wxString & aReferenceString ) } -void SCH_COMPONENT::SetRef( SCH_SHEET_PATH* sheet, const wxString& ref ) +void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref ) { wxString path = GetPath( sheet ); @@ -929,7 +929,7 @@ wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& aPoint ) #if defined(DEBUG) -void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) +void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) const { // for now, make it look like XML: NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index c3ea06a82d..e9abf6226d 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -287,7 +287,7 @@ public: virtual void SwapData( SCH_ITEM* aItem ); // returns a unique ID, in the form of a path. - wxString GetPath( SCH_SHEET_PATH* sheet ); + wxString GetPath( const SCH_SHEET_PATH* sheet ) const; /** * Function IsReferenceStringValid (static) @@ -297,18 +297,18 @@ public: * @param aReferenceString = the reference string to validate * @return true if OK */ - static bool IsReferenceStringValid( const wxString &aReferenceString ); + static bool IsReferenceStringValid( const wxString& aReferenceString ); /** * Function GetRef * returns the reference, for the given sheet path. */ - const wxString GetRef( SCH_SHEET_PATH* sheet ); + const wxString GetRef( const SCH_SHEET_PATH* sheet ); /** * Set the reference, for the given sheet path. */ - void SetRef( SCH_SHEET_PATH* sheet, const wxString& ref ); + void SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref ); /** * Function AddHierarchicalReference @@ -407,16 +407,7 @@ public: virtual bool IsReplaceable() const { return true; } #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // override #endif private: diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 1e4beed139..992900b677 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -219,6 +219,10 @@ public: */ virtual bool IsReplaceable() const { return true; } +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif + private: virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 6006ea0dd1..e39c97bc63 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -203,7 +203,7 @@ void SCH_JUNCTION::GetNetListItem( vector& aNetListItems, #if defined(DEBUG) -void SCH_JUNCTION::Show( int nestLevel, std::ostream& os ) +void SCH_JUNCTION::Show( int nestLevel, std::ostream& os ) const { // XML output: wxString s = GetClass(); diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index 7557f01fe3..f9ecc6f2fe 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -122,7 +122,7 @@ public: SCH_SHEET_PATH* aSheetPath ); #if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ); + void Show( int nestLevel, std::ostream& os ) const; // override #endif private: diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 7a2d511e1d..bb1a748173 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -173,7 +173,7 @@ public: virtual bool operator <( const SCH_ITEM& aItem ) const; #if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ) const; + void Show( int nestLevel, std::ostream& os ) const; // override #endif private: diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index 8f5683dd0e..64dd15a1ad 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -63,14 +63,7 @@ EDA_ITEM* SCH_MARKER::doClone() const #if defined(DEBUG) -/** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ -void SCH_MARKER::Show( int nestLevel, std::ostream& os ) +void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const { // for now, make it look like XML: NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 055d7df26d..82dae0c9c7 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -28,8 +28,8 @@ * @brief SCH_MARKER class definition. */ -#ifndef _TYPE_SCH_MARKER_H_ -#define _TYPE_SCH_MARKER_H_ +#ifndef TYPE_SCH_MARKER_H_ +#define TYPE_SCH_MARKER_H_ #include "sch_item_struct.h" #include "class_marker_base.h" @@ -128,8 +128,7 @@ public: virtual BITMAP_DEF GetMenuImage() const { return erc_xpm; } #if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // override #endif virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; @@ -138,4 +137,4 @@ public: virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; } }; -#endif /* _TYPE_SCH_MARKER_H_ */ +#endif // TYPE_SCH_MARKER_H_ diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index 20ce9abf80..ef32dc5eeb 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -126,6 +126,10 @@ public: virtual void GetNetListItem( vector& aNetListItems, SCH_SHEET_PATH* aSheetPath ); +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif + private: virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; diff --git a/eeschema/sch_polyline.h b/eeschema/sch_polyline.h index 162c489000..082c88678b 100644 --- a/eeschema/sch_polyline.h +++ b/eeschema/sch_polyline.h @@ -154,6 +154,10 @@ public: return m_points[ aIndex ]; } +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif + private: virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 23f672185d..bba80bbf37 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1207,7 +1207,7 @@ void SCH_SHEET::doPlot( PLOTTER* aPlotter ) #if defined(DEBUG) -void SCH_SHEET::Show( int nestLevel, std::ostream& os ) +void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const { // XML output: wxString s = GetClass(); @@ -1216,7 +1216,7 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os ) << TO_UTF8( m_name ) << '"' << ">\n"; // show all the pins, and check the linked list integrity - BOOST_FOREACH( SCH_SHEET_PIN& label, m_pins ) + BOOST_FOREACH( const SCH_SHEET_PIN& label, m_pins ) { label.Show( nestLevel + 1, os ); } diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 204b0bfb2b..b9955d6caa 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -170,10 +170,7 @@ public: virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); #if defined(DEBUG) - - // comment inherited by Doxygen from Base_Struct - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // override #endif /** @@ -633,10 +630,7 @@ public: SCH_SHEET_PATH* aSheetPath ); #if defined(DEBUG) - - // comment inherited by Doxygen from Base_Struct - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // override #endif protected: diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index 1dfde15e0f..dd13af2fd1 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -531,7 +531,7 @@ bool SCH_SHEET_PIN::doHitTest( const wxPoint& aPoint, int aAccuracy ) const #if defined(DEBUG) -void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os ) +void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os ) const { // XML output: wxString s = GetClass(); diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index a2e4fcc124..1e45f9a6b3 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -732,7 +732,7 @@ void SCH_TEXT::doPlot( PLOTTER* aPlotter ) #if defined(DEBUG) -void SCH_TEXT::Show( int nestLevel, std::ostream& os ) +void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const { // XML output: wxString s = GetClass(); diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 7ed820a04f..f1cbe31d80 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -239,7 +239,7 @@ public: SCH_SHEET_PATH* aSheetPath ); #if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ); + void Show( int nestLevel, std::ostream& os ) const; // override #endif private: diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index b7bda2184c..5cc92c8793 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -633,7 +633,7 @@ bool GERBER_DRAW_ITEM::HitTest( EDA_RECT& aRefArea ) #if defined(DEBUG) -void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) +void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const { NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index 42beff5ae6..3f32925cfe 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -270,7 +270,6 @@ public: return wxT( "GERBER_DRAW_ITEM" ); } - /** * Function Save. * currently: no nothing, but must be defined to meet requirements @@ -279,17 +278,9 @@ public: bool Save( FILE* aFile ) const; #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - virtual void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // override #endif + }; #endif /* CLASS_GERBER_DRAW_ITEM_H */ diff --git a/include/base_struct.h b/include/base_struct.h index 4092c766ee..a4c392296a 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -705,8 +705,10 @@ public: * of nesting of this object within the overall tree. * @param os The ostream& to output to. */ - virtual void Show( int nestLevel, std::ostream& os ) const; + virtual void Show( int nestLevel, std::ostream& os ) const = 0; + // pure virtual so compiler warns if somebody mucks up a derived declaration + void ShowDummy( std::ostream& os ) const; ///< call this if you are a lazy developer /** * Function NestedSpace diff --git a/include/block_commande.h b/include/block_commande.h index b4f2e699a6..6e3efd0489 100644 --- a/include/block_commande.h +++ b/include/block_commande.h @@ -143,6 +143,10 @@ public: * and clears the selected item list. */ void Clear(); + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const {} // override +#endif }; diff --git a/include/class_base_screen.h b/include/class_base_screen.h index 772d037e46..04c004fa37 100644 --- a/include/class_base_screen.h +++ b/include/class_base_screen.h @@ -28,8 +28,8 @@ * @brief BASE_SCREEN class implementation. */ -#ifndef __CLASS_BASE_SCREEN_H__ -#define __CLASS_BASE_SCREEN_H__ +#ifndef CLASS_BASE_SCREEN_H_ +#define CLASS_BASE_SCREEN_H_ #include "base_struct.h" #include "class_undoredo_container.h" @@ -469,18 +469,9 @@ public: } #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; -#endif /* #ifndef __CLASS_BASE_SCREEN_H__ */ +#endif // CLASS_BASE_SCREEN_H_ diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 0775a2c134..7340ddca7f 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2150,57 +2150,46 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS #if defined(DEBUG) -void BOARD::Show( int nestLevel, std::ostream& os ) +void BOARD::Show( int nestLevel, std::ostream& os ) const { BOARD_ITEM* p; // for now, make it look like XML: - NestedSpace( nestLevel, - os ) << '<' << GetClass().Lower().mb_str() << ">\n"; + NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; // specialization of the output: NestedSpace( nestLevel + 1, os ) << "\n"; p = m_Modules; - for( ; p; p = p->Next() ) p->Show( nestLevel + 2, os ); - NestedSpace( nestLevel + 1, os ) << "\n"; NestedSpace( nestLevel + 1, os ) << "\n"; p = m_Drawings; - for( ; p; p = p->Next() ) p->Show( nestLevel + 2, os ); - NestedSpace( nestLevel + 1, os ) << "\n"; NestedSpace( nestLevel + 1, os ) << "\n"; p = m_Track; - for( ; p; p = p->Next() ) p->Show( nestLevel + 2, os ); - NestedSpace( nestLevel + 1, os ) << "\n"; NestedSpace( nestLevel + 1, os ) << "\n"; p = m_Zone; - for( ; p; p = p->Next() ) p->Show( nestLevel + 2, os ); - NestedSpace( nestLevel + 1, os ) << "\n"; - /* - * NestedSpace( nestLevel+1, os ) << "\n"; - * for( ZONE_CONTAINERS::iterator i=m_ZoneDescriptorList.begin(); - * i!=m_ZoneDescriptorList.end(); ++i ) - * (*i)->Show( nestLevel+2, os ); - * NestedSpace( nestLevel+1, os ) << "\n"; - */ + NestedSpace( nestLevel+1, os ) << "\n"; + for( ZONE_CONTAINERS::const_iterator it = m_ZoneDescriptorList.begin(); + it != m_ZoneDescriptorList.end(); ++it ) + (*it)->Show( nestLevel+2, os ); + + NestedSpace( nestLevel+1, os ) << "\n"; p = (BOARD_ITEM*) m_Son; - for( ; p; p = p->Next() ) { p->Show( nestLevel + 1, os ); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 50a0922f52..6f110e9f6e 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -881,16 +881,7 @@ public: } #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 608c372709..cb1a717e41 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -155,6 +155,11 @@ public: virtual wxString GetSelectMenuText() const; virtual BITMAP_DEF GetMenuImage() const { return add_dimension_xpm; } + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif + }; #endif // DIMENSION_H_ diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index f4128e223f..316cbb7e95 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -501,14 +501,7 @@ wxString DRAWSEGMENT::GetSelectMenuText() const #if defined(DEBUG) -/** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ -void DRAWSEGMENT::Show( int nestLevel, std::ostream& os ) +void DRAWSEGMENT::Show( int nestLevel, std::ostream& os ) const { NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 24f4db2ebb..5dc55ed5c2 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -245,7 +245,7 @@ public: virtual BITMAP_DEF GetMenuImage() const { return add_dashed_line_xpm; } #if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ); + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 5deb6e6890..b930dc0bcc 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -248,14 +248,7 @@ wxString EDGE_MODULE::GetSelectMenuText() const #if defined(DEBUG) -/** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ -void EDGE_MODULE::Show( int nestLevel, std::ostream& os ) +void EDGE_MODULE::Show( int nestLevel, std::ostream& os ) const { wxString shape = ShowShape( (STROKE_T) m_Shape ); diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index ed84a1d29b..3e580e6478 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -81,16 +81,7 @@ public: virtual BITMAP_DEF GetMenuImage() const { return show_mod_edge_xpm; } #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - virtual void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index 40254cfb21..2dc9584051 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -118,7 +118,10 @@ public: virtual wxString GetSelectMenuText() const; virtual BITMAP_DEF GetMenuImage() const { return drc_xpm; } + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; - #endif // CLASS_MARKER_PCB_H diff --git a/pcbnew/class_mire.h b/pcbnew/class_mire.h index 6fcc5e41c5..13bbd94c05 100644 --- a/pcbnew/class_mire.h +++ b/pcbnew/class_mire.h @@ -112,6 +112,10 @@ public: virtual wxString GetSelectMenuText() const; virtual BITMAP_DEF GetMenuImage() const { return add_mires_xpm; } + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 84a04f5661..3edb8e708a 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -565,14 +565,7 @@ wxString MODULE::GetSelectMenuText() const #if defined(DEBUG) -/** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ -void MODULE::Show( int nestLevel, std::ostream& os ) +void MODULE::Show( int nestLevel, std::ostream& os ) const { BOARD* board = GetBoard(); diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index da5204895b..aeecd6bac8 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -375,16 +375,7 @@ public: virtual BITMAP_DEF GetMenuImage() const { return module_xpm; } #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - virtual void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; diff --git a/pcbnew/class_netclass.cpp b/pcbnew/class_netclass.cpp index e41cc31855..213137d188 100644 --- a/pcbnew/class_netclass.cpp +++ b/pcbnew/class_netclass.cpp @@ -263,7 +263,7 @@ void BOARD::SynchronizeNetsAndNetClasses() #if defined(DEBUG) -void NETCLASS::Show( int nestLevel, std::ostream& os ) +void NETCLASS::Show( int nestLevel, std::ostream& os ) const { // for now, make it look like XML: //NestedSpace( nestLevel, os ) diff --git a/pcbnew/class_netclass.h b/pcbnew/class_netclass.h index 6a45c5a27d..e6c224d0f8 100644 --- a/pcbnew/class_netclass.h +++ b/pcbnew/class_netclass.h @@ -213,16 +213,7 @@ public: bool ReadDescr( LINE_READER* aReader ); #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index ccf302a071..be61d5d6e1 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -721,14 +721,7 @@ wxString D_PAD::GetSelectMenuText() const #if defined(DEBUG) -/** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ -void D_PAD::Show( int nestLevel, std::ostream& os ) +void D_PAD::Show( int nestLevel, std::ostream& os ) const { char padname[5] = { m_Padname[0], m_Padname[1], m_Padname[2], m_Padname[3], 0 }; diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 6df7e577a8..2229510fb5 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -447,16 +447,7 @@ public: wxString ShowPadAttr() const; #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - virtual void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 8e250b521a..71b5ea812c 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -161,14 +161,7 @@ wxString TEXTE_PCB::GetSelectMenuText() const #if defined(DEBUG) -/** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ -void TEXTE_PCB::Show( int nestLevel, std::ostream& os ) +void TEXTE_PCB::Show( int nestLevel, std::ostream& os ) const { // for now, make it look like XML: NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 7f96b1f79f..329978609e 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -138,14 +138,7 @@ public: virtual EDA_RECT GetBoundingBox() const { return GetTextBox(); }; #if defined(DEBUG) - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - virtual void Show( int nestLevel, std::ostream& os ); + void Show( int nestLevel, std::ostream& os ) const; #endif }; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 89e2df97ed..07a4abdf04 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -454,14 +454,7 @@ wxString TEXTE_MODULE::GetSelectMenuText() const #if defined(DEBUG) -/** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ -void TEXTE_MODULE::Show( int nestLevel, std::ostream& os ) +void TEXTE_MODULE::Show( int nestLevel, std::ostream& os ) const { // for now, make it look like XML: NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << @@ -471,5 +464,4 @@ void TEXTE_MODULE::Show( int nestLevel, std::ostream& os ) // << ">\n"; } - #endif diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index d86e810ae6..3d2039c258 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -4,8 +4,8 @@ */ -#ifndef TEXT_MODULE_H -#define TEXT_MODULE_H +#ifndef TEXT_MODULE_H_ +#define TEXT_MODULE_H_ #include "class_board_item.h" @@ -188,17 +188,8 @@ public: virtual BITMAP_DEF GetMenuImage() const { return footprint_text_xpm; } #if defined(DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - virtual void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; -#endif // TEXT_MODULE_H +#endif // TEXT_MODULE_H_ diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 82489c7184..9991be6405 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -1569,7 +1569,7 @@ wxString TRACK::GetSelectMenuText() const #if defined(DEBUG) -void TRACK::Show( int nestLevel, std::ostream& os ) +void TRACK::Show( int nestLevel, std::ostream& os ) const { NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << @@ -1589,7 +1589,7 @@ void TRACK::Show( int nestLevel, std::ostream& os ) } -void SEGVIA::Show( int nestLevel, std::ostream& os ) +void SEGVIA::Show( int nestLevel, std::ostream& os ) const { const char* cp; diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 79bedb55fc..eef20010ac 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -386,15 +386,7 @@ public: #if defined (DEBUG) - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload /** * Function ShowState @@ -497,16 +489,7 @@ public: virtual BITMAP_DEF GetMenuImage() const { return via_sketch_xpm; } #if defined (DEBUG) - - /** - * Function Show - * is used to output the object tree, currently for debugging only. - * @param nestLevel An aid to prettier tree indenting, and is the level - * of nesting of this object within the overall tree. - * @param os The ostream& to output to. - */ - void Show( int nestLevel, std::ostream& os ); - + void Show( int nestLevel, std::ostream& os ) const; // overload #endif }; diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 1ae4dd1a40..7ab84cd33c 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -496,6 +496,10 @@ public: virtual wxString GetSelectMenuText() const; virtual BITMAP_DEF GetMenuImage() const { return add_zone_xpm; } + +#if defined(DEBUG) + void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override +#endif }; diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index c7f8b0b563..4fb5381946 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -446,8 +446,21 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF } } -#if !defined(USE_NEW_PCBNEW_SAVE) +#if defined(USE_NEW_PCBNEW_SAVE) + try + { + IO_MGR::Save( IO_MGR::KICAD, pcbFileName.GetFullPath(), GetBoard(), NULL ); + } + catch( IO_ERROR ioe ) + { + wxString msg = wxString::Format( _( "Error loading board.\n%s" ), + ioe.errorText.GetData() ); + wxMessageBox( msg, _( "Save Board File" ), wxICON_ERROR ); + saveok = false; + } + +#else // Create the file FILE* dest; dest = wxFopen( pcbFileName.GetFullPath(), wxT( "wt" ) ); @@ -468,22 +481,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF fclose( dest ); } -#else - - try - { - IO_MGR::Save( IO_MGR::KICAD, pcbFileName.GetFullPath(), GetBoard(), NULL ); // overload - } - catch( IO_ERROR ioe ) - { - wxString msg = wxString::Format( _( "Error loading board.\n%s" ), - ioe.errorText.GetData() ); - - wxMessageBox( msg, _( "Save Board File" ), wxICON_ERROR ); - - saveok = false; - } - #endif /* Display the file names: */ diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 2928f0110c..63b17f7c62 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -191,6 +191,9 @@ BOARD* KICAD_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPER m_reader = &reader; // member function accessibility + m_board->m_Status_Pcb = 0; + m_board->m_NetClasses.Clear(); + init( aProperties ); checkVersion(); @@ -2567,9 +2570,6 @@ void KICAD_PLUGIN::init( PROPERTIES* aProperties ) #else diskToBiu = 1.0; // BIUs are deci-mils #endif - - m_board->m_Status_Pcb = 0; - m_board->m_NetClasses.Clear(); }