diff --git a/eeschema/dialogs/dialog_pin_properties.cpp b/eeschema/dialogs/dialog_pin_properties.cpp index 66c8788774..224abd68b5 100644 --- a/eeschema/dialogs/dialog_pin_properties.cpp +++ b/eeschema/dialogs/dialog_pin_properties.cpp @@ -378,10 +378,10 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) SYMBOL_EDIT_FRAME* symbolEditor = (SYMBOL_EDIT_FRAME*) GetParent(); // Calculate a suitable scale to fit the available draw area - EDA_RECT bBox = m_dummyPin->GetBoundingBox( true, true, false ); - double xscale = (double) dc_size.x / bBox.GetWidth(); - double yscale = (double) dc_size.y / bBox.GetHeight(); - double scale = std::min( xscale, yscale ); + BOX2I bBox = m_dummyPin->GetBoundingBox( true, true, false ); + double xscale = (double) dc_size.x / bBox.GetWidth(); + double yscale = (double) dc_size.y / bBox.GetHeight(); + double scale = std::min( xscale, yscale ); // Give a 7% margin (each side) and limit to no more than 100% zoom scale = std::min( scale * 0.85, 1.0 ); diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 7255c96d6b..41be728d55 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1107,9 +1107,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector #include -class EDA_RECT; class LINE_READER; class OUTPUTFORMATTER; class SYMBOL_LIB; diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 77baa0996f..1de70fc103 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -156,7 +156,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh SCH_SHEET* sheet = sheetPair.second; // Calculate the new sheet size. - EDA_RECT sheetBoundingBox; + BOX2I sheetBoundingBox; for( SCH_ITEM* item : sheet->GetScreen()->Items() ) { diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 7edb97bacf..448731a04a 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -407,7 +407,7 @@ BITMAPS SCH_TEXT::GetMenuImage() const bool SCH_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { - EDA_RECT bBox = GetBoundingBox(); + BOX2I bBox = GetBoundingBox(); bBox.Inflate( aAccuracy ); return bBox.Contains( aPosition ); } diff --git a/eeschema/sch_textbox.cpp b/eeschema/sch_textbox.cpp index ab8ee61612..2f191f3e7d 100644 --- a/eeschema/sch_textbox.cpp +++ b/eeschema/sch_textbox.cpp @@ -299,7 +299,7 @@ wxString SCH_TEXTBOX::GetShownText( int aDepth ) const bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { - EDA_RECT rect = GetBoundingBox(); + BOX2I rect = GetBoundingBox(); rect.Inflate( aAccuracy ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 1dbe44fe34..126bb28077 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -1241,9 +1241,7 @@ const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) con } else { - EDA_RECT boundingBox = m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert ); - return BOX2I( boundingBox.GetOrigin(), VECTOR2I( boundingBox.GetWidth(), - boundingBox.GetHeight() ) ); + return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert ); } } diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp index c18e343cc0..88cdd74110 100644 --- a/eeschema/symbol_viewer_frame.cpp +++ b/eeschema/symbol_viewer_frame.cpp @@ -933,18 +933,16 @@ const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) c if( !symbol ) { - return BOX2I( VECTOR2I(-200, -200), VECTOR2I( 400, 400 ) ); + return BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ); } else { - std::shared_ptr< LIB_SYMBOL > tmp; + std::shared_ptr tmp = symbol->IsAlias() ? symbol->GetParent().lock() + : symbol->SharedPtr(); - tmp = ( symbol->IsAlias() ) ? symbol->GetParent().lock() : symbol->SharedPtr(); + wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) ); - wxCHECK( tmp, BOX2I( VECTOR2I(-200, -200), VECTOR2I( 400, 400 ) ) ); - - EDA_RECT bbox = tmp->GetUnitBoundingBox( m_unit, m_convert ); - return BOX2I( bbox.GetOrigin(), VECTOR2I( bbox.GetWidth(), bbox.GetHeight() ) ); + return tmp->GetUnitBoundingBox( m_unit, m_convert ); } } diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index e10e1d46be..226e33f85f 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -1299,7 +1299,7 @@ bool EE_SELECTION_TOOL::selectMultiple() } } - EDA_RECT selectionRect( area.GetOrigin(), wxSize( width, height ) ); + BOX2I selectionRect( area.GetOrigin(), VECTOR2I( width, height ) ); selectionRect.Normalize(); bool anyAdded = false; @@ -1495,11 +1495,12 @@ int EE_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent ) } -void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( EDA_RECT bbox ) +void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox ) { - if( bbox.GetWidth() == 0 ) + if( aBBox.GetWidth() == 0 ) return; + BOX2I bbox = aBBox; bbox.Normalize(); VECTOR2I bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize(); diff --git a/eeschema/tools/ee_selection_tool.h b/eeschema/tools/ee_selection_tool.h index 8b56e12b82..66d072d9e6 100644 --- a/eeschema/tools/ee_selection_tool.h +++ b/eeschema/tools/ee_selection_tool.h @@ -74,7 +74,7 @@ public: void OnIdle( wxIdleEvent& aEvent ); ///< Zoom the screen to fit the bounding box for cross probing/selection sync. - void ZoomFitCrossProbeBBox( EDA_RECT bbox ); + void ZoomFitCrossProbeBBox( const BOX2I& aBBox ); /** * @return the set of currently selected items. diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index bf4518a932..e23f43d51c 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -350,7 +350,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer ) #if 0 // Bbox arc Debugging only m_gal->SetIsFill( false ); m_gal->SetIsStroke( true ); - EDA_RECT box = aItem->GetBoundingBox(); + BOX2I box = aItem->GetBoundingBox(); m_gal->SetLineWidth( 5 ); m_gal->SetStrokeColor( COLOR4D(0.9, 0.9, 0, 0.4) ); // box coordinates are already in AB position. diff --git a/include/collector.h b/include/collector.h index 6743922518..8eaee8ef66 100644 --- a/include/collector.h +++ b/include/collector.h @@ -28,7 +28,6 @@ #include #include #include // SEARCH_RESULT -#include class EDA_ITEM; @@ -213,8 +212,6 @@ public: void SetRefPos( const VECTOR2I& aRefPos ) { m_refPos = aRefPos; } - const EDA_RECT& GetBoundingBox() const { return m_refBox; } - /** * Count the number of items matching \a aType. * @@ -247,7 +244,6 @@ protected: INSPECTOR_FUNC m_inspector; VECTOR2I m_refPos; // Reference pos used to generate the collection. - EDA_RECT m_refBox; // Selection rect used to generate the collection. }; #endif // COLLECTOR_H diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 6b8656f714..c319b52d12 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -1636,14 +1636,15 @@ void PCB_SELECTION_TOOL::zoomFitSelection() } -void PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox( EDA_RECT bbox ) +void PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox ) { // Should recalculate the view to zoom in on the bbox. - auto view = getView(); + KIGFX::VIEW* view = getView(); - if( bbox.GetWidth() == 0 ) + if( aBBox.GetWidth() == 0 ) return; + BOX2I bbox = aBBox; bbox.Normalize(); //#define DEFAULT_PCBNEW_CODE // Un-comment for normal full zoom KiCad algorithm diff --git a/pcbnew/tools/pcb_selection_tool.h b/pcbnew/tools/pcb_selection_tool.h index 9f5241e471..1ec8602280 100644 --- a/pcbnew/tools/pcb_selection_tool.h +++ b/pcbnew/tools/pcb_selection_tool.h @@ -160,7 +160,7 @@ public: void zoomFitSelection(); ///< Zoom the screen to fit the bounding box for cross probing/selection sync. - void ZoomFitCrossProbeBBox( EDA_RECT bbox ); + void ZoomFitCrossProbeBBox( const BOX2I& bbox ); /** * Enter the group at the head of the current selection.