diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 0ca4940433..b0046bd400 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -342,7 +342,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo return; PAD dummy( *aPad ); - dummy.SetSize( wxSize( dummySize.x, dummySize.y ) ); + dummy.SetSize( VECTOR2I( dummySize.x, dummySize.y ) ); dummy.TransformShapeToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE ); clearance = { 0, 0 }; } @@ -503,7 +503,7 @@ void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aCo // NPTH pads are not drawn on layers if the shape size and pos is the same as their hole: if( aSkipNPTHPadsWihNoCopper && ( pad->GetAttribute() == PAD_ATTRIB::NPTH ) ) { - if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == wxPoint( 0, 0 ) ) + if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == VECTOR2I( 0, 0 ) ) { switch( pad->GetShape() ) { diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 64f6af0239..63badb2bb9 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -43,7 +43,7 @@ BASE_SCREEN::BASE_SCREEN( EDA_ITEM* aParent, KICAD_T aType ) : } -void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU ) +void BASE_SCREEN::InitDataPoints( const VECTOR2I& aPageSizeIU ) { if( m_Center ) { diff --git a/common/dialogs/dialog_grid_settings.cpp b/common/dialogs/dialog_grid_settings.cpp index 4c23800e6c..6259f41d7c 100644 --- a/common/dialogs/dialog_grid_settings.cpp +++ b/common/dialogs/dialog_grid_settings.cpp @@ -119,7 +119,7 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow() GRID_SETTINGS& gridCfg = cfg->m_Window.grid; gridCfg.last_size_idx = m_currentGridCtrl->GetSelection(); - m_parent->SetGridOrigin( wxPoint( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) ); + m_parent->SetGridOrigin( VECTOR2I( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) ); gridCfg.user_grid_x = m_parent->StringFromValue( m_userGridX.GetValue(), true ); gridCfg.user_grid_y = m_parent->StringFromValue( m_userGridY.GetValue(), true ); gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection(); diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 3bb1fe774d..5ed87509d8 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -74,7 +74,7 @@ static const wxString pageFmts[] = }; DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, - const wxSize& aMaxUserSizeMils ) : + const VECTOR2I& aMaxUserSizeMils ) : DIALOG_PAGES_SETTINGS_BASE( aParent ), m_parent( aParent ), m_screen( m_parent->GetScreen() ), @@ -745,7 +745,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() wxASSERT( i != arrayDim(papers) ); // dialog UI match the above list? VECTOR2I sz = pageInfo.GetSizeMils(); - m_layout_size = wxSize( sz.x, sz.y ); + m_layout_size = VECTOR2I( sz.x, sz.y ); // swap sizes to match orientation bool isPortrait = (bool) m_orientationComboBox->GetSelection(); @@ -753,7 +753,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() if( ( isPortrait && m_layout_size.x >= m_layout_size.y ) || ( !isPortrait && m_layout_size.x < m_layout_size.y ) ) { - m_layout_size.Set( m_layout_size.y, m_layout_size.x ); + std::swap( m_layout_size.x, m_layout_size.y ); } } } @@ -767,7 +767,7 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog() // Prepare to painless double -> int conversion. customSizeX = Clamp( double( INT_MIN ), customSizeX, double( INT_MAX ) ); customSizeY = Clamp( double( INT_MIN ), customSizeY, double( INT_MAX ) ); - m_layout_size = wxSize( KiROUND( customSizeX ), KiROUND( customSizeY ) ); + m_layout_size = VECTOR2I( KiROUND( customSizeX ), KiROUND( customSizeY ) ); } diff --git a/common/dialogs/panel_image_editor.cpp b/common/dialogs/panel_image_editor.cpp index 472dc58600..33d2a2a5a9 100644 --- a/common/dialogs/panel_image_editor.cpp +++ b/common/dialogs/panel_image_editor.cpp @@ -73,7 +73,7 @@ bool PANEL_IMAGE_EDITOR::CheckValues() } // Test value correctness - wxSize psize = m_workingImage->GetSizePixels(); + VECTOR2I psize = m_workingImage->GetSizePixels(); int size_min = (int) std::min( ( psize.x * tmp ), ( psize.y * tmp ) ); if( size_min < MIN_SIZE ) // if the size is too small, the image will be hard to locate @@ -115,7 +115,7 @@ void PANEL_IMAGE_EDITOR::OnRedrawPanel( wxPaintEvent& event ) double scale = 1.0 / m_workingImage->GetScalingFactor(); dc.SetUserScale( scale, scale ); - m_workingImage->DrawBitmap( &dc, wxPoint( 0, 0 ) ); + m_workingImage->DrawBitmap( &dc, VECTOR2I( 0, 0 ) ); } diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 2096b1217d..74681723e7 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -349,7 +350,7 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent ) wxSize clientSize = GetClientSize(); WX_INFOBAR* infobar = GetParentEDAFrame() ? GetParentEDAFrame()->GetInfoBar() : nullptr; - if( VECTOR2I( clientSize ) == m_gal->GetScreenPixelSize() ) + if( ToVECTOR2I( clientSize ) == m_gal->GetScreenPixelSize() ) return; clientSize.x = std::max( 10, clientSize.x ); @@ -365,7 +366,7 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent ) if( m_view ) { if( infobar && infobar->IsLocked() ) - m_view->SetCenter( bottom - m_view->ToWorld( clientSize, false ) / 2.0 ); + m_view->SetCenter( bottom - m_view->ToWorld( ToVECTOR2I(clientSize), false ) / 2.0 ); m_view->MarkTargetDirty( KIGFX::TARGET_CACHED ); m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); diff --git a/common/drawing_sheet/ds_data_item.cpp b/common/drawing_sheet/ds_data_item.cpp index a5f32790b0..936536a500 100644 --- a/common/drawing_sheet/ds_data_item.cpp +++ b/common/drawing_sheet/ds_data_item.cpp @@ -552,7 +552,7 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE pensize = aCollector ? aCollector->GetDefaultPenSize() : 1; SetConstrainedTextSize(); - wxSize textsize; + VECTOR2I textsize; textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); textsize.y = KiROUND( m_ConstrainedTextSize.y * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); @@ -688,7 +688,7 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize() // EDA_TEXT::GetTextBox() // but this function uses integers // So, to avoid truncations with our unit in mm, use microns. - wxSize size_micron; + VECTOR2I size_micron; #define FSCALE 1000.0 int linewidth = 0; size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE ); diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 4e75a3510e..cd65cb286e 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -951,8 +952,8 @@ void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos ) for( wxWindow* dialog : findDialogs() ) { - dialogScreenRects.emplace_back( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ), - dialog->GetSize() ); + dialogScreenRects.emplace_back( ToVECTOR2D( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ) ), + ToVECTOR2D( dialog->GetSize() ) ); } // Center if we're behind an obscuring dialog, or within 10% of its edge diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 9b327f4e40..b3eb6bae13 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -540,7 +540,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const // Creates bounding box (rectangle) for horizontal, left and top justified text. The // bounding box will be moved later according to the actual text options - wxSize textsize = wxSize( extents.x, extents.y ); + VECTOR2I textsize = VECTOR2I( extents.x, extents.y ); VECTOR2I pos = drawPos; if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() ) diff --git a/common/eda_units.cpp b/common/eda_units.cpp index f6623be6f5..93c2bb0251 100644 --- a/common/eda_units.cpp +++ b/common/eda_units.cpp @@ -169,14 +169,6 @@ std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale, i } -std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale, - const wxPoint& aPoint ) -{ - return FormatInternalUnits( aIuScale, aPoint.x ) + " " - + FormatInternalUnits( aIuScale, aPoint.y ); -} - - std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const VECTOR2I& aPoint ) { @@ -185,12 +177,6 @@ std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale, } -std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const wxSize& aSize ) -{ - return FormatInternalUnits( aIuScale, aSize.GetWidth() ) + " " - + FormatInternalUnits( aIuScale, aSize.GetHeight() ); -} - #define IU_TO_MM( x, scale ) ( x / scale.IU_PER_MM ) #define IU_TO_IN( x, scale ) ( x / scale.IU_PER_MILS / 1000 ) #define IU_TO_MILS( x, scale ) ( x / scale.IU_PER_MILS ) diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index f00944d34e..43ed561ac5 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include // for KiROUND #include #include @@ -1363,7 +1364,7 @@ CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent, #endif SetSize( aParent->GetClientSize() ); - m_screenSize = VECTOR2I( aParent->GetClientSize() ); + m_screenSize = ToVECTOR2I( aParent->GetClientSize() ); // Allocate memory for pixel storage allocateBitmaps(); diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 3663707c3a..53feae8a82 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include // for KiROUND @@ -323,7 +324,7 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent, #endif SetSize( aParent->GetClientSize() ); - m_screenSize = VECTOR2I( GetNativePixelSize() ); + m_screenSize = ToVECTOR2I( GetNativePixelSize() ); // Grid color settings are different in Cairo and OpenGL SetGridColor( COLOR4D( 0.8, 0.8, 0.8, 0.1 ) ); diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 935698ed95..00898d7372 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -237,7 +238,7 @@ void GRCSegm( wxDC* DC, const VECTOR2I& A, const VECTOR2I& B, int width, const C start += org; end += org; - DC->DrawLine( (wxPoint) start, (wxPoint) end ); + DC->DrawLine( ToWxPoint( start ), ToWxPoint( end ) ); // first rounded end end.x = 0; @@ -246,9 +247,9 @@ void GRCSegm( wxDC* DC, const VECTOR2I& A, const VECTOR2I& B, int width, const C end += org; if( !mirrored ) - DC->DrawArc( (wxPoint) end, (wxPoint) start, (wxPoint) org ); + DC->DrawArc( ToWxPoint(end ), ToWxPoint(start ), ToWxPoint(org ) ); else - DC->DrawArc( (wxPoint) start, (wxPoint) end, (wxPoint) org ); + DC->DrawArc( ToWxPoint(start ), ToWxPoint(end ), ToWxPoint(org ) ); // second edge start.x = len; @@ -256,7 +257,7 @@ void GRCSegm( wxDC* DC, const VECTOR2I& A, const VECTOR2I& B, int width, const C RotatePoint( start, angle ); start += org; - DC->DrawLine( (wxPoint) start, (wxPoint) end ); + DC->DrawLine( ToWxPoint( start ), ToWxPoint( end ) ); // second rounded end end.x = len; diff --git a/common/page_info.cpp b/common/page_info.cpp index c9bca156ad..0d3b01a9ec 100644 --- a/common/page_info.cpp +++ b/common/page_info.cpp @@ -64,7 +64,7 @@ const wxChar PAGE_INFO::Custom[] = wxT( "User" ); // also see: wx/defs.h // local readability macro for millimeter wxSize -#define MMsize( x, y ) wxSize( EDA_UNIT_UTILS::Mm2mils( x ), EDA_UNIT_UTILS::Mm2mils( y ) ) +#define MMsize( x, y ) VECTOR2I( EDA_UNIT_UTILS::Mm2mils( x ), EDA_UNIT_UTILS::Mm2mils( y ) ) // All MUST be defined as landscape. const PAGE_INFO PAGE_INFO::pageA5( MMsize( 210, 148 ), wxT( "A5" ), wxPAPER_A5 ); @@ -74,19 +74,20 @@ const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), const PAGE_INFO PAGE_INFO::pageA1( MMsize( 841, 594 ), wxT( "A1" ), PAPER_A1 ); const PAGE_INFO PAGE_INFO::pageA0( MMsize( 1189, 841 ), wxT( "A0" ), PAPER_A0 ); -const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ), wxPAPER_LETTER ); -const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ), wxPAPER_TABLOID ); -const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ), wxPAPER_CSHEET ); -const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ), wxPAPER_DSHEET ); -const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ), wxPAPER_ESHEET ); +const PAGE_INFO PAGE_INFO::pageA( VECTOR2I( 11000, 8500 ), wxT( "A" ), wxPAPER_LETTER ); +const PAGE_INFO PAGE_INFO::pageB( VECTOR2I( 17000, 11000 ), wxT( "B" ), wxPAPER_TABLOID ); +const PAGE_INFO PAGE_INFO::pageC( VECTOR2I( 22000, 17000 ), wxT( "C" ), wxPAPER_CSHEET ); +const PAGE_INFO PAGE_INFO::pageD( VECTOR2I( 34000, 22000 ), wxT( "D" ), wxPAPER_DSHEET ); +const PAGE_INFO PAGE_INFO::pageE( VECTOR2I( 44000, 34000 ), wxT( "E" ), wxPAPER_ESHEET ); -const PAGE_INFO PAGE_INFO::pageGERBER( wxSize( 32000, 32000 ), wxT( "GERBER" ), wxPAPER_NONE ); -const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), Custom, wxPAPER_NONE ); +const PAGE_INFO PAGE_INFO::pageGERBER( VECTOR2I( 32000, 32000 ), wxT( "GERBER" ), wxPAPER_NONE ); +const PAGE_INFO PAGE_INFO::pageUser( VECTOR2I( 17000, 11000 ), Custom, wxPAPER_NONE ); // US paper sizes -const PAGE_INFO PAGE_INFO::pageUSLetter( wxSize( 11000, 8500 ), wxT( "USLetter" ), wxPAPER_LETTER ); -const PAGE_INFO PAGE_INFO::pageUSLegal( wxSize( 14000, 8500 ), wxT( "USLegal" ), wxPAPER_LEGAL ); -const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedger" ), wxPAPER_TABLOID ); +const PAGE_INFO PAGE_INFO::pageUSLetter( VECTOR2I( 11000, 8500 ), wxT( "USLetter" ), wxPAPER_LETTER ); +const PAGE_INFO PAGE_INFO::pageUSLegal( VECTOR2I( 14000, 8500 ), wxT( "USLegal" ), wxPAPER_LEGAL ); +const PAGE_INFO PAGE_INFO::pageUSLedger( VECTOR2I( 17000, 11000 ), wxT( "USLedger" ), + wxPAPER_TABLOID ); // Custom paper size for next instantiation of type "User" int PAGE_INFO::s_user_width = 17000; @@ -100,7 +101,7 @@ inline void PAGE_INFO::updatePortrait() } -PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSize aPaperId ) : +PAGE_INFO::PAGE_INFO( const VECTOR2I& aSizeMils, const wxString& aType, wxPaperSize aPaperId ) : m_type( aType ), m_size( aSizeMils ), m_paper_id( aPaperId ) { updatePortrait(); @@ -170,7 +171,7 @@ bool PAGE_INFO::SetType( const wxString& aType, bool aIsPortrait ) if( aIsPortrait ) { // all private PAGE_INFOs are landscape, must swap x and y - m_size = wxSize( m_size.y, m_size.x ); + m_size = VECTOR2I( m_size.y, m_size.x ); updatePortrait(); } @@ -189,7 +190,7 @@ void PAGE_INFO::SetPortrait( bool aIsPortrait ) if( m_portrait != aIsPortrait ) { // swap x and y in m_size - m_size = wxSize( m_size.y, m_size.x ); + m_size = VECTOR2I( m_size.y, m_size.x ); m_portrait = aIsPortrait; diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index 312a35af41..f75699048c 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -740,8 +740,8 @@ void PLOTTER::Text( const VECTOR2I& aPos, // Stroke callback [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 ) { - MoveTo( (wxPoint) aPt1 ); - LineTo( (wxPoint) aPt2 ); + MoveTo( aPt1 ); + LineTo( aPt2 ); PenFinish(); }, // Polygon callback diff --git a/common/plugins/altium/altium_parser.h b/common/plugins/altium/altium_parser.h index f4e4286f06..8b41321598 100644 --- a/common/plugins/altium/altium_parser.h +++ b/common/plugins/altium/altium_parser.h @@ -185,14 +185,14 @@ public: return -ReadKicadUnit(); } - VECTOR2I ReadVector2I() + VECTOR2I ReadVector2IPos() { int32_t x = ReadKicadUnitX(); int32_t y = ReadKicadUnitY(); return { x, y }; } - wxSize ReadWxSize() + VECTOR2I ReadVector2ISize() { int32_t x = ReadKicadUnit(); int32_t y = ReadKicadUnit(); diff --git a/common/plugins/cadstar/cadstar_archive_parser.cpp b/common/plugins/cadstar/cadstar_archive_parser.cpp index 62b3119449..b4b56005b5 100644 --- a/common/plugins/cadstar/cadstar_archive_parser.cpp +++ b/common/plugins/cadstar/cadstar_archive_parser.cpp @@ -1147,7 +1147,7 @@ void CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::Parse( XNODE* aNode, PARSER_CON THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxT( "ATTRLOC" ) ); } - if( !Position.IsFullySpecified() ) + if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE ) THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "ATTRLOC" ) ); } @@ -1396,7 +1396,7 @@ void CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::Parse( XNODE* aNode, PARSER_CONTEXT* } } - if( !Position.IsFullySpecified() ) + if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE ) THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "TEXTLOC" ) ); } diff --git a/common/plugins/cadstar/cadstar_archive_parser.h b/common/plugins/cadstar/cadstar_archive_parser.h index 324262207a..533d9b878d 100644 --- a/common/plugins/cadstar/cadstar_archive_parser.h +++ b/common/plugins/cadstar/cadstar_archive_parser.h @@ -398,10 +398,10 @@ public: /** * @brief Represents a point in x,y coordinates */ - struct POINT : wxPoint, PARSER + struct POINT : VECTOR2I, PARSER { - POINT() : wxPoint( UNDEFINED_VALUE, UNDEFINED_VALUE ) {} - POINT( int aX, int aY ) : wxPoint( aX, aY ) {} + POINT() : VECTOR2I( UNDEFINED_VALUE, UNDEFINED_VALUE ) {} + POINT( int aX, int aY ) : VECTOR2I( aX, aY ) {} void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override; }; diff --git a/common/plugins/eagle/eagle_parser.cpp b/common/plugins/eagle/eagle_parser.cpp index 61120ee7d5..afb83b14de 100644 --- a/common/plugins/eagle/eagle_parser.cpp +++ b/common/plugins/eagle/eagle_parser.cpp @@ -679,9 +679,9 @@ ETEXT::ETEXT( wxXmlNode* aText ) } -wxSize ETEXT::ConvertSize() const +VECTOR2I ETEXT::ConvertSize() const { - wxSize textsize; + VECTOR2I textsize; if( font ) { @@ -689,20 +689,20 @@ wxSize ETEXT::ConvertSize() const if( fontName == "vector" ) { - textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() ); + textsize = VECTOR2I( size.ToSchUnits(), size.ToSchUnits() ); } else if( fontName == "fixed" ) { - textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() * 0.80 ); + textsize = VECTOR2I( size.ToSchUnits(), size.ToSchUnits() * 0.80 ); } else { - textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() ); + textsize = VECTOR2I( size.ToSchUnits(), size.ToSchUnits() ); } } else { - textsize = wxSize( size.ToSchUnits() * 0.85, size.ToSchUnits() ); + textsize = VECTOR2I( size.ToSchUnits() * 0.85, size.ToSchUnits() ); } return textsize; diff --git a/common/plugins/eagle/eagle_parser.h b/common/plugins/eagle/eagle_parser.h index 30457f86b4..0de7fc74c4 100644 --- a/common/plugins/eagle/eagle_parser.h +++ b/common/plugins/eagle/eagle_parser.h @@ -668,7 +668,7 @@ struct ETEXT ETEXT( wxXmlNode* aText ); /// Calculate text size based on font type and size - wxSize ConvertSize() const; + VECTOR2I ConvertSize() const; }; diff --git a/common/status_popup.cpp b/common/status_popup.cpp index 4951c76c67..a3ff2f1736 100644 --- a/common/status_popup.cpp +++ b/common/status_popup.cpp @@ -28,6 +28,7 @@ */ #include +#include #include #include @@ -83,7 +84,7 @@ void STATUS_POPUP::PopupFor( int aMsecs ) void STATUS_POPUP::Move( const VECTOR2I& aWhere ) { - SetPosition( wxPoint( aWhere.x, aWhere.y ) ); + SetPosition( ToWxPoint( aWhere ) ); } diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 3eabff709b..f9976fd87d 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -300,7 +301,7 @@ int COMMON_TOOLS::doZoomFit( ZOOM_FIT_TYPE_T aFitType ) view->SetScale( 1.0 ); // The best scale will be determined later, but this initial // value ensures all view parameters are up to date (especially // at init time) - VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false ); + VECTOR2D screenSize = view->ToWorld( ToVECTOR2I( canvas->GetClientSize() ), false ); // Currently "Zoom to Objects" is only supported in Eeschema & Pcbnew. Support for other // programs in the suite can be added as needed. @@ -371,7 +372,7 @@ int COMMON_TOOLS::CenterContents( const TOOL_EVENT& aEvent ) getView()->SetCenter( bBox.Centre() ); // Take scrollbars into account - VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() ); + VECTOR2D scrollbarSize = VECTOR2D( ToVECTOR2D( canvas->GetSize() - canvas->GetClientSize() ) ); VECTOR2D worldScrollbarSize = getView()->ToWorld( scrollbarSize, false ); getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 ); diff --git a/common/tool/grid_helper.cpp b/common/tool/grid_helper.cpp index 39844a6db3..7b6f99c228 100644 --- a/common/tool/grid_helper.cpp +++ b/common/tool/grid_helper.cpp @@ -77,7 +77,7 @@ void GRID_HELPER::SetAuxAxes( bool aEnable, const VECTOR2I& aOrigin ) if( aEnable ) { m_auxAxis = aOrigin; - m_viewAxis.SetPosition( wxPoint( aOrigin ) ); + m_viewAxis.SetPosition( aOrigin ); m_toolMgr->GetView()->SetVisible( &m_viewAxis, true ); } else diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 1f2f0ae374..6bee705127 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -34,6 +34,8 @@ #include #include +#include + #include #include #include @@ -304,7 +306,7 @@ VECTOR2D TOOL_MANAGER::GetMousePosition() const if( m_viewControls ) return m_viewControls->GetMousePosition(); else - return wxGetMousePosition(); + return ToVECTOR2D( wxGetMousePosition() ); } @@ -313,7 +315,7 @@ VECTOR2D TOOL_MANAGER::GetCursorPosition() const if( m_viewControls ) return m_viewControls->GetCursorPosition(); else - return wxGetMousePosition(); + return ToVECTOR2D( wxGetMousePosition() ); } diff --git a/common/tool/zoom_tool.cpp b/common/tool/zoom_tool.cpp index 50bee386e8..421da19e78 100644 --- a/common/tool/zoom_tool.cpp +++ b/common/tool/zoom_tool.cpp @@ -24,6 +24,7 @@ #include #include #include +#include ZOOM_TOOL::ZOOM_TOOL() : @@ -140,7 +141,7 @@ bool ZOOM_TOOL::selectRegion() } else { - VECTOR2D sSize = view->ToWorld( canvas->GetClientSize(), false ); + VECTOR2D sSize = view->ToWorld( ToVECTOR2I( canvas->GetClientSize() ), false ); VECTOR2D vSize = selectionBox.GetSize(); double scale; double ratio = std::max( fabs( vSize.x / sSize.x ), fabs( vSize.y / sSize.y ) ); diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index d9bea07d5b..36271d4e62 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -455,7 +455,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam if( footprint ) { footprint->SetParent( (EDA_ITEM*) GetBoard() ); - footprint->SetPosition( wxPoint( 0, 0 ) ); + footprint->SetPosition( VECTOR2I( 0, 0 ) ); return footprint; } diff --git a/eeschema/dialogs/dialog_eeschema_page_settings.cpp b/eeschema/dialogs/dialog_eeschema_page_settings.cpp index 1c68cf4e55..fa2c13adc9 100644 --- a/eeschema/dialogs/dialog_eeschema_page_settings.cpp +++ b/eeschema/dialogs/dialog_eeschema_page_settings.cpp @@ -27,7 +27,7 @@ #include DIALOG_EESCHEMA_PAGE_SETTINGS::DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, - wxSize aMaxUserSizeMils ) : + VECTOR2I aMaxUserSizeMils ) : DIALOG_PAGES_SETTINGS( aParent, schIUScale.IU_PER_MILS, aMaxUserSizeMils ) { } diff --git a/eeschema/dialogs/dialog_eeschema_page_settings.h b/eeschema/dialogs/dialog_eeschema_page_settings.h index 06f41bb6fa..c87f85a43b 100644 --- a/eeschema/dialogs/dialog_eeschema_page_settings.h +++ b/eeschema/dialogs/dialog_eeschema_page_settings.h @@ -26,7 +26,7 @@ class DIALOG_EESCHEMA_PAGE_SETTINGS : public DIALOG_PAGES_SETTINGS { public: - DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, wxSize aMaxUserSizeMils ); + DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, VECTOR2I aMaxUserSizeMils ); virtual ~DIALOG_EESCHEMA_PAGE_SETTINGS(); private: diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 3e6163137a..09b62341e2 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -618,7 +618,7 @@ void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent ) m_parent->SetCurrentSheet( sheet ); m_parent->DisplayCurrentSheet(); - m_parent->RedrawScreen( (wxPoint) m_parent->GetScreen()->m_ScrollCenter, false ); + m_parent->RedrawScreen( m_parent->GetScreen()->m_ScrollCenter, false ); } m_parent->FocusOnItem( item ); diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp index 3e0e0e94ac..d17783a148 100644 --- a/eeschema/dialogs/dialog_field_properties.cpp +++ b/eeschema/dialogs/dialog_field_properties.cpp @@ -379,7 +379,7 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataFromWindow() } } - m_position = wxPoint( m_posX.GetValue(), m_posY.GetValue() ); + m_position = VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ); m_size = m_textSize.GetValue(); if( m_fontCtrl->HaveFontSelection() ) @@ -416,7 +416,7 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataFromWindow() void DIALOG_FIELD_PROPERTIES::updateText( EDA_TEXT* aText ) { if( aText->GetTextWidth() != m_size ) - aText->SetTextSize( wxSize( m_size, m_size ) ); + aText->SetTextSize( VECTOR2I( m_size, m_size ) ); aText->SetVisible( m_isVisible ); aText->SetTextAngle( m_isVertical ? ANGLE_VERTICAL : ANGLE_HORIZONTAL ); diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp index 1a18a27880..aebf596ec4 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -255,7 +255,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS if( EDA_TEXT* eda_text = dynamic_cast( aItem ) ) { if( !m_textSize.IsIndeterminate() ) - eda_text->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); + eda_text->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) ); if( m_setTextColor->GetValue() ) eda_text->SetTextColor( m_textColorSwatch->GetSwatchColor() ); diff --git a/eeschema/dialogs/dialog_label_properties.cpp b/eeschema/dialogs/dialog_label_properties.cpp index cf84c01e42..bd0279ec57 100644 --- a/eeschema/dialogs/dialog_label_properties.cpp +++ b/eeschema/dialogs/dialog_label_properties.cpp @@ -527,7 +527,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow() if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T ) static_cast( m_currentLabel )->SetPinLength( m_textSize.GetValue() ); else if( m_currentLabel->GetTextWidth() != m_textSize.GetValue() ) - m_currentLabel->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); + m_currentLabel->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) ); if( m_bold->IsChecked() != m_currentLabel->IsBold() ) { @@ -616,7 +616,7 @@ void DIALOG_LABEL_PROPERTIES::OnAddField( wxCommandEvent& event ) fieldName = SCH_LABEL_BASE::GetDefaultFieldName( fieldName, true ); } - SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_currentLabel, fieldName ); + SCH_FIELD newField( VECTOR2I( 0, 0 ), fieldID, m_currentLabel, fieldName ); if( m_fields->size() > 0 ) { diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index 89ac73e932..1f262fa878 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -399,13 +399,13 @@ public: break; case COL_POSX: - pin->SetPosition( wxPoint( m_frame->ValueFromString( value ), - pin->GetPosition().y ) ); + pin->SetPosition( VECTOR2I( m_frame->ValueFromString( value ), + pin->GetPosition().y ) ); break; case COL_POSY: - pin->SetPosition( wxPoint( pin->GetPosition().x, - -m_frame->ValueFromString( value ) ) ); + pin->SetPosition( VECTOR2I( pin->GetPosition().x, + -m_frame->ValueFromString( value ) ) ); break; case COL_VISIBLE: diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index a3e9402e1f..2236fd548c 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -537,8 +537,8 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event ) int fieldID = (int) m_fields->size(); LIB_FIELD newField( m_libEntry, fieldID ); - newField.SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ), - schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); + newField.SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ), + schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); m_fields->push_back( newField ); diff --git a/eeschema/dialogs/dialog_lib_text_properties.cpp b/eeschema/dialogs/dialog_lib_text_properties.cpp index 03422a97ae..de45874c37 100644 --- a/eeschema/dialogs/dialog_lib_text_properties.cpp +++ b/eeschema/dialogs/dialog_lib_text_properties.cpp @@ -229,7 +229,7 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow() } if( m_textSize.GetValue() != m_graphicText->GetTextWidth() ) - m_graphicText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); + m_graphicText->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) ); if( m_horizontal->IsChecked() ) m_graphicText->SetTextAngle( ANGLE_HORIZONTAL ); diff --git a/eeschema/dialogs/dialog_lib_textbox_properties.cpp b/eeschema/dialogs/dialog_lib_textbox_properties.cpp index 86586ca0c0..ae385a1262 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties.cpp +++ b/eeschema/dialogs/dialog_lib_textbox_properties.cpp @@ -260,7 +260,7 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow() m_currentText->SetText( text ); if( m_currentText->GetTextWidth() != m_textSize.GetValue() ) - m_currentText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); + m_currentText->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) ); if( m_fontCtrl->HaveFontSelection() ) { diff --git a/eeschema/dialogs/dialog_pin_properties.cpp b/eeschema/dialogs/dialog_pin_properties.cpp index f409f6d6a9..73b9d0b7fa 100644 --- a/eeschema/dialogs/dialog_pin_properties.cpp +++ b/eeschema/dialogs/dialog_pin_properties.cpp @@ -334,7 +334,7 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow() if( !DIALOG_SHIM::TransferDataFromWindow() ) return false; - wxPoint newPos( m_posX.GetValue(), -m_posY.GetValue() ); + VECTOR2I newPos( m_posX.GetValue(), -m_posY.GetValue() ); const int standard_grid = 50; diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index e9f6f3f651..504d25a222 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -432,7 +433,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen ) // Change scale factor and offset to print the whole page. bool printReference = cfg->m_Printing.title_block; - pageSizeIU = aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); + pageSizeIU = ToWxSize( aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ) ); FitThisSizeToPaper( pageSizeIU ); fitRect = GetLogicalPaperRect(); diff --git a/eeschema/dialogs/dialog_sheet_pin_properties.cpp b/eeschema/dialogs/dialog_sheet_pin_properties.cpp index 8ddc21fff3..bdd596c5bc 100644 --- a/eeschema/dialogs/dialog_sheet_pin_properties.cpp +++ b/eeschema/dialogs/dialog_sheet_pin_properties.cpp @@ -165,7 +165,7 @@ bool DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow() // Currently, eeschema uses only the text width as text size, // and expects text width = text height - m_sheetPin->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); + m_sheetPin->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) ); m_sheetPin->SetTextColor( m_textColorSwatch->GetSwatchColor() ); diff --git a/eeschema/dialogs/dialog_sheet_properties.cpp b/eeschema/dialogs/dialog_sheet_properties.cpp index 79b33ae733..0555037be7 100644 --- a/eeschema/dialogs/dialog_sheet_properties.cpp +++ b/eeschema/dialogs/dialog_sheet_properties.cpp @@ -50,7 +50,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S m_clearAnnotationNewItems( aClearAnnotationNewItems ), m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ), m_dummySheet( *aSheet ), - m_dummySheetNameField( wxDefaultPosition, SHEETNAME, &m_dummySheet ) + m_dummySheetNameField( VECTOR2I( -1, -1 ), SHEETNAME, &m_dummySheet ) { m_sheet = aSheet; m_fields = new FIELDS_GRID_TABLE( this, aParent, m_grid, m_sheet ); @@ -709,7 +709,7 @@ void DIALOG_SHEET_PROPERTIES::OnAddField( wxCommandEvent& event ) return; int fieldID = m_fields->size(); - SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet, + SCH_FIELD newField( VECTOR2I( 0, 0 ), fieldID, m_sheet, SCH_SHEET::GetDefaultFieldName( fieldID ) ); newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() ); diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index e550ca5f11..3bfc313e96 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -448,7 +448,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow() { if( defined.count( templateFieldname.m_Name ) <= 0 ) { - SCH_FIELD field( wxPoint( 0, 0 ), -1, m_symbol, templateFieldname.m_Name ); + SCH_FIELD field( VECTOR2I( 0, 0 ), -1, m_symbol, templateFieldname.m_Name ); field.SetVisible( templateFieldname.m_Visible ); m_fields->push_back( field ); } @@ -938,11 +938,11 @@ void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event ) SCHEMATIC_SETTINGS& settings = m_symbol->Schematic()->Settings(); int fieldID = (int) m_fields->size(); - SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_symbol, + SCH_FIELD newField( VECTOR2I( 0, 0 ), fieldID, m_symbol, TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID, DO_TRANSLATE ) ); newField.SetTextAngle( m_fields->at( REFERENCE_FIELD ).GetTextAngle() ); - newField.SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); + newField.SetTextSize( VECTOR2I( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); m_fields->push_back( newField ); diff --git a/eeschema/dialogs/dialog_text_properties.cpp b/eeschema/dialogs/dialog_text_properties.cpp index 009d9097a5..7909b54f2c 100644 --- a/eeschema/dialogs/dialog_text_properties.cpp +++ b/eeschema/dialogs/dialog_text_properties.cpp @@ -503,7 +503,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow() } if( m_currentText->GetTextWidth() != m_textSize.GetValue() ) - m_currentText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); + m_currentText->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) ); if( m_fontCtrl->HaveFontSelection() ) { diff --git a/eeschema/dialogs/panel_eeschema_color_settings.cpp b/eeschema/dialogs/panel_eeschema_color_settings.cpp index d9de2c4c81..d227ed49ff 100644 --- a/eeschema/dialogs/panel_eeschema_color_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_color_settings.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -429,7 +430,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems() SCH_SHEET* s = new SCH_SHEET( /* aParent */ nullptr, /* aPosition */ MILS_POINT( 4000, 1300 ), - /* aSize */ wxSize( schIUScale.MilsToIU( 800 ), schIUScale.MilsToIU( 1300 ) ) ); + /* aSize */ VECTOR2I( schIUScale.MilsToIU( 800 ), schIUScale.MilsToIU( 1300 ) ) ); s->GetFields().at( SHEETNAME ).SetText( wxT( "SHEET" ) ); s->GetFields().at( SHEETFILENAME ).SetText( _( "/path/to/sheet" ) ); s->AutoplaceFields( nullptr, false ); @@ -498,7 +499,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview() KIGFX::VIEW* view = m_preview->GetView(); view->SetScale( 1.0 ); - VECTOR2D screenSize = view->ToWorld( m_preview->GetClientSize(), false ); + VECTOR2D screenSize = view->ToWorld( ToVECTOR2D( m_preview->GetClientSize() ), false ); VECTOR2I psize( m_page->GetWidthIU( schIUScale.IU_PER_MILS ), m_page->GetHeightIU( schIUScale.IU_PER_MILS ) ); double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ), diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index 61462793ee..c3140cc1b1 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -403,7 +403,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob, plotter->SetPageSettings( pageInfo ); plotter->SetColorMode( !aSvgJob->m_blackAndWhite ); - wxPoint plot_offset; + VECTOR2I plot_offset; const double scale = 1.0; // Currently, plot units are in decimil diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index e136448bb8..9f39d7fb0e 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -329,7 +329,7 @@ int ERC_TESTER::TestConflictingBusAliases() std::shared_ptr ercItem = ERC_ITEM::Create( ERCE_BUS_ALIAS_CONFLICT ); ercItem->SetErrorMessage( msg ); - SCH_MARKER* marker = new SCH_MARKER( ercItem, wxPoint() ); + SCH_MARKER* marker = new SCH_MARKER( ercItem, VECTOR2I() ); test->GetParent()->Append( marker ); ++err_count; diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index bbfead86bb..c0e2d156db 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -758,8 +758,8 @@ void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue break; case FDC_TEXT_SIZE: - field.SetTextSize( wxSize( m_frame->ValueFromString( value ), - m_frame->ValueFromString( value ) ) ); + field.SetTextSize( VECTOR2I( m_frame->ValueFromString( value ), + m_frame->ValueFromString( value ) ) ); break; case FDC_ORIENTATION: diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index e3c92aaaa8..28626e287d 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -382,8 +382,8 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos wxDC* DC = aSettings->GetPrintDC(); KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false ); - wxSize pinNameSize( m_nameTextSize, m_nameTextSize ); - wxSize pinNumSize( m_numTextSize, m_numTextSize ); + VECTOR2I pinNameSize( m_nameTextSize, m_nameTextSize ); + VECTOR2I pinNumSize( m_numTextSize, m_numTextSize ); int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ), aSettings->GetDefaultPenWidth() ); @@ -607,7 +607,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT break; } - GRPrintText( DC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify, + GRPrintText( DC, txtpos, color, typeName, orient, VECTOR2I( textSize, textSize ), hjustify, GR_TEXT_V_ALIGN_CENTER, pensize, false, false, font ); } @@ -1061,7 +1061,7 @@ void LIB_PIN::ChangeLength( int aLength ) break; } - wxPoint offset = wxPoint( offsetX, offsetY ); + VECTOR2I offset = VECTOR2I( offsetX, offsetY ); Offset( offset ); m_length = aLength; @@ -1359,9 +1359,9 @@ BITMAPS LIB_PIN::GetMenuImage() const wxString LIB_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const { - // This code previously checked "m_name.IsEmpty()" to choose the correct + // This code previously checked "m_name.IsEmpty()" to choose the correct // formatting path, but that check fails if the pin is called "~" which is - // the default for an empty pin name. Instead we get the final display string + // the default for an empty pin name. Instead we get the final display string // that will be shown and check if it's empty. wxString shownName = UnescapeString( GetShownName() ); diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index c1fe980033..af023cb0dc 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -41,8 +41,8 @@ LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) : LIB_ITEM( LIB_TEXT_T, aParent ), EDA_TEXT( schIUScale, wxEmptyString ) { - SetTextSize( wxSize( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), - schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) ); + SetTextSize( VECTOR2I( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), + schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) ); } diff --git a/eeschema/lib_textbox.cpp b/eeschema/lib_textbox.cpp index ea21f48d7a..6d84504c47 100644 --- a/eeschema/lib_textbox.cpp +++ b/eeschema/lib_textbox.cpp @@ -47,7 +47,8 @@ LIB_TEXTBOX::LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth, FILL_T aFillType, LIB_SHAPE( aParent, SHAPE_T::RECT, aLineWidth, aFillType, LIB_TEXTBOX_T ), EDA_TEXT( schIUScale, text ) { - SetTextSize( wxSize( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) ); + SetTextSize( VECTOR2I( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), + schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) ); SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); SetVertJustify( GR_TEXT_V_ALIGN_TOP ); SetMultilineAllowed( true ); diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 22e9f63130..51d414433b 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -152,7 +152,7 @@ const PAGE_INFO& SCH_BASE_FRAME::GetPageSettings () const } -const wxSize SCH_BASE_FRAME::GetPageSizeIU() const +const VECTOR2I SCH_BASE_FRAME::GetPageSizeIU() const { // GetSizeIU is compile time dependent: return GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 2b7b5f3445..cb5132c9af 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -118,7 +118,7 @@ public: void SetPageSettings( const PAGE_INFO& aPageSettings ) override; const PAGE_INFO& GetPageSettings () const override; - const wxSize GetPageSizeIU() const override; + const VECTOR2I GetPageSizeIU() const override; const VECTOR2I& GetGridOrigin() const override { diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index 9276bebe22..e819a0935b 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -68,8 +68,8 @@ public: VECTOR2I GetEnd() const; - wxSize GetSize() const { return m_size; } - void SetSize( const wxSize& aSize ) { m_size = aSize; } + VECTOR2I GetSize() const { return m_size; } + void SetSize( const VECTOR2I& aSize ) { m_size = aSize; } void SetPenWidth( int aWidth ); @@ -133,7 +133,7 @@ private: protected: VECTOR2I m_pos; - wxSize m_size; + VECTOR2I m_size; bool m_isDanglingStart; bool m_isDanglingEnd; STROKE_PARAMS m_stroke; diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index eeb1905ca2..464b1a4e89 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -2036,7 +2036,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet() { // Set zoom to last used in this screen GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel ); - RedrawScreen( (wxPoint) GetScreen()->m_ScrollCenter, false ); + RedrawScreen( GetScreen()->m_ScrollCenter, false ); } updateTitle(); diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index b9187e9d0e..66a903592f 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -171,7 +171,7 @@ static LIB_SYMBOL* dummy() LIB_TEXT* text = new LIB_TEXT( symbol ); - text->SetTextSize( wxSize( schIUScale.MilsToIU( 150 ), schIUScale.MilsToIU( 150 ) ) ); + text->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 150 ), schIUScale.MilsToIU( 150 ) ) ); text->SetText( wxString( wxT( "??" ) ) ); symbol->AddDrawItem( square ); diff --git a/eeschema/sch_plotter.cpp b/eeschema/sch_plotter.cpp index 6d8bda244b..389beebb2d 100644 --- a/eeschema/sch_plotter.cpp +++ b/eeschema/sch_plotter.cpp @@ -218,9 +218,9 @@ void SCH_PLOTTER::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, if( aPlotSettings.m_useBackgroundColor && aPlotter->GetColorMode() ) { aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() ); - wxPoint end( aPlotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), - aPlotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); - aPlotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); + VECTOR2I end( aPlotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), + aPlotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); + aPlotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); } if( aPlotSettings.m_plotDrawingSheet ) @@ -278,7 +278,7 @@ void SCH_PLOTTER::setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, aPlotter->SetPageSettings( plotPage ); // Currently, plot units are in decimil - aPlotter->SetViewport( wxPoint( 0, 0 ), schIUScale.IU_PER_MILS/10, scale, false ); + aPlotter->SetViewport( VECTOR2I( 0, 0 ), schIUScale.IU_PER_MILS / 10, scale, false ); } @@ -340,7 +340,7 @@ void SCH_PLOTTER::createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings, double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); double scale = std::min( scalex, scaley ); - wxPoint plot_offset; + VECTOR2I plot_offset; try { @@ -406,7 +406,7 @@ void SCH_PLOTTER::createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings, bool SCH_PLOTTER::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, RENDER_SETTINGS* aRenderSettings, - const PAGE_INFO& aPageInfo, const wxPoint& aPlot0ffset, + const PAGE_INFO& aPageInfo, const VECTOR2I& aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS& aPlotSettings ) { PS_PLOTTER* plotter = new PS_PLOTTER(); @@ -434,9 +434,9 @@ bool SCH_PLOTTER::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen { plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); - wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), - plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); - plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); + VECTOR2I end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), + plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); + plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); } if( aPlotSettings.m_plotDrawingSheet ) @@ -588,7 +588,7 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree plotter->SetRenderSettings( aRenderSettings ); plotter->SetPageSettings( plotPage ); plotter->SetColorMode( aPlotSettings.m_blackAndWhite ? false : true ); - wxPoint plot_offset; + VECTOR2I plot_offset; double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); @@ -613,9 +613,9 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree if( aPlotSettings.m_useBackgroundColor && plotter->GetColorMode() ) { plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); - wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), - plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); - plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); + VECTOR2I end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), + plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); + plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); } if( aPlotSettings.m_plotDrawingSheet ) @@ -690,7 +690,7 @@ void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_SETTINGS& aPlotSettings, double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils(); // Calculate offsets - wxPoint plotOffset; + VECTOR2I plotOffset; wxString msg; if( aPlotSettings.m_HPGLPlotOrigin == HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER ) @@ -759,11 +759,11 @@ void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_SETTINGS& aPlotSettings, } -bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName, +bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, - const wxPoint& aPlot0ffset, + const VECTOR2I& aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS& aPlotSettings ) { @@ -817,7 +817,7 @@ bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName, wxString sheetName = m_schematic->CurrentSheet().Last()->GetName(); wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable(); - PlotDrawingSheet( plotter, &m_schematic->Prj(), + PlotDrawingSheet( plotter, &m_schematic->Prj(), aScreen->GetTitleBlock(), aPageInfo, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(), @@ -868,7 +868,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings, m_schematic->SetSheetNumberAndCount(); SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen(); - wxPoint plot_offset; + VECTOR2I plot_offset; wxString msg; try @@ -941,7 +941,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings, bool SCH_PLOTTER::plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen, - RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset, + RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset, double aScale, const SCH_PLOT_SETTINGS& aPlotSettings ) { aRenderSettings->LoadColors( m_colorSettings ); @@ -976,7 +976,7 @@ bool SCH_PLOTTER::plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScree wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable(); COLOR4D color = plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ); - PlotDrawingSheet( plotter, &m_schematic->Prj(), + PlotDrawingSheet( plotter, &m_schematic->Prj(), aScreen->GetTitleBlock(), pageInfo, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(), diff --git a/eeschema/sch_plotter.h b/eeschema/sch_plotter.h index 9519b0619d..d91f041e15 100644 --- a/eeschema/sch_plotter.h +++ b/eeschema/sch_plotter.h @@ -161,7 +161,7 @@ protected: void createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter ); bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen, - RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset, + RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset, double aScale, const SCH_PLOT_SETTINGS& aPlotSettings ); @@ -170,7 +170,7 @@ protected: REPORTER* aReporter ); bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, - const wxPoint& aPlot0ffset, double aScale, + const VECTOR2I& aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS& aPlotSettings ); // PS @@ -178,7 +178,7 @@ protected: REPORTER* aReporter ); bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, - const wxPoint& aPlot0ffset, double aScale, + const VECTOR2I& aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS& aPlotSettings ); // SVG diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index b41ebe25ba..4048bc463b 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -481,7 +481,7 @@ ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR( const std::map& aProps location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); - size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ), - ReadKiCadUnitFrac( aProps, "YSIZE" ) ); + size = VECTOR2I( ReadKiCadUnitFrac( aProps, "XSIZE" ), + ReadKiCadUnitFrac( aProps, "YSIZE" ) ); isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false ); diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index 1239e1c493..97ca4cdbfb 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -465,7 +465,7 @@ struct ASCH_HARNESS_CONNECTOR int OwnerPartID; // always -1, can be safely ignored I think VECTOR2I Location; - wxSize Size; + VECTOR2I Size; int AreaColor; int Color; @@ -539,7 +539,7 @@ struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE struct ASCH_SHEET_SYMBOL { VECTOR2I location; - wxSize size; + VECTOR2I size; bool isSolid; diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index 3596bbc620..80368ad8f2 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -1865,7 +1865,7 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessEntry( const std::map& a sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); VECTOR2I pos = sheetIt->second->GetPosition(); - wxSize size = sheetIt->second->GetSize(); + VECTOR2I size = sheetIt->second->GetSize(); switch( elem.Side ) { @@ -2051,7 +2051,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map& aPr //sheetPin->SetPosition( getKiCadPoint( term.Position ) ); VECTOR2I pos = sheetIt->second->GetPosition(); - wxSize size = sheetIt->second->GetSize(); + VECTOR2I size = sheetIt->second->GetSize(); switch( elem.side ) { diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 6eb5e95768..ba2a6c745f 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -218,11 +218,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh // When exporting to pdf, CADSTAR applies a margin of 3% of the longest dimension (height // or width) to all 4 sides (top, bottom, left right). For the import, we are also rounding // the margin to the nearest grid, ensuring all items remain on the grid. - wxSize targetSheetSize = (wxSize)sheetBoundingBox.GetSize(); + VECTOR2I targetSheetSize = sheetBoundingBox.GetSize(); int longestSide = std::max( targetSheetSize.x, targetSheetSize.y ); int margin = ( (double) longestSide * 0.03 ); margin = roundToNearestGrid( margin ); - targetSheetSize.IncBy( margin * 2, margin * 2 ); + targetSheetSize += margin * 2; // Update page size always PAGE_INFO pageInfo = sheet->GetScreen()->GetPageSettings(); @@ -232,7 +232,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh // Set the new sheet size. sheet->GetScreen()->SetPageSettings( pageInfo ); - wxSize pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); + VECTOR2I pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 ); VECTOR2I itemsCentre = sheetBoundingBox.Centre(); @@ -282,7 +282,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets() for( LAYER_ID sheetID : orphanSheets ) { VECTOR2I pos( x * schIUScale.MilsToIU( 1000 ), y * schIUScale.MilsToIU( 1000 ) ); - wxSize siz( schIUScale.MilsToIU( 1000 ), schIUScale.MilsToIU( 1000 ) ); + VECTOR2I siz( schIUScale.MilsToIU( 1000 ), schIUScale.MilsToIU( 1000 ) ); loadSheetAndChildSheets( sheetID, pos, siz, rootPath ); @@ -663,7 +663,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances() SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL; netLabel->SetPosition( getKiCadPoint( (VECTOR2I)sym.Origin + terminalPosOffset ) ); netLabel->SetText( "***UNKNOWN NET****" ); // This should be later updated when we load the netlist - netLabel->SetTextSize( wxSize( schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( 50 ) ) ); + netLabel->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( 50 ) ) ); SYMDEF_SCM symbolDef = Library.SymbolDefinitions.at( sym.SymdefID ); @@ -923,7 +923,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() VECTOR2I size = getKiCadPoint( busTerm.SecondPoint ) - getKiCadPoint( busTerm.FirstPoint ); - busEntry->SetSize( wxSize( size.x, size.y ) ); + busEntry->SetSize( VECTOR2I( size.x, size.y ) ); m_sheetMap.at( bus.LayerID )->GetScreen()->Append( busEntry ); @@ -945,7 +945,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() } else { - label->SetTextSize( wxSize( SMALL_LABEL_SIZE, SMALL_LABEL_SIZE ) ); + label->SetTextSize( VECTOR2I( SMALL_LABEL_SIZE, SMALL_LABEL_SIZE ) ); } netlabels.insert( { busTerm.ID, label } ); @@ -1024,7 +1024,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() && SCH_SHEET::ClassOf( sheetPin->GetParent() ) ) { SCH_SHEET* parentSheet = static_cast( sheetPin->GetParent() ); - wxSize sheetSize = parentSheet->GetSize(); + VECTOR2I sheetSize = parentSheet->GetSize(); VECTOR2I sheetPosition = parentSheet->GetPosition(); int leftSide = sheetPosition.x; @@ -1652,7 +1652,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices( const std::vector& aCadstarVertices, - wxPoint aSymbolOrigin, + VECTOR2I aSymbolOrigin, LIB_SYMBOL* aSymbol, int aGateNumber, int aLineThickness ) @@ -1726,7 +1726,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices( const std::vect void CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute( - const ATTRIBUTE_LOCATION& aCadstarAttrLoc, wxPoint aSymbolOrigin, LIB_FIELD* aKiCadField ) + const ATTRIBUTE_LOCATION& aCadstarAttrLoc, VECTOR2I aSymbolOrigin, LIB_FIELD* aKiCadField ) { aKiCadField->SetTextPos( getKiCadLibraryPoint( aCadstarAttrLoc.Position, aSymbolOrigin ) ); @@ -2180,7 +2180,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( LAYER_ID SCH_SHEET* sheet = new SCH_SHEET( /* aParent */ aParentSheet.Last(), /* aPosition */ aPosition, - /* aSize */ wxSize( aSheetSize ) ); + /* aSize */ VECTOR2I( aSheetSize ) ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); SCH_SHEET_PATH instance( aParentSheet ); @@ -2251,7 +2251,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets( LAYER_ID aCadstarSheetID, // In KiCad you can only draw rectangular shapes whereas in Cadstar arbitrary shapes // are allowed. We will calculate the extents of the Cadstar shape and draw a rectangle - std::pair blockExtents; + std::pair blockExtents; if( block.Figures.size() > 0 ) { @@ -2790,7 +2790,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT setAlignment( aKiCadTextItem, textAlignment ); BOX2I bb = textEdaItem->GetBoundingBox(); int off = static_cast( aKiCadTextItem )->GetTextOffset(); - wxPoint pos; + VECTOR2I pos; // Change the anchor point of the text item to make it match the same bounding box // And correct the error introduced by the text offsetting in KiCad @@ -3002,7 +3002,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int } -std::pair +std::pair CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure ) { VECTOR2I upperLeft( Assignments.Settings.DesignLimit.x, 0 ); @@ -3046,7 +3046,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure VECTOR2I size = lowerRightKiCad - upperLeftKiCad; - return { upperLeftKiCad, wxSize( abs( size.x ), abs( size.y ) ) }; + return { upperLeftKiCad, VECTOR2I( abs( size.x ), abs( size.y ) ) }; } @@ -3097,7 +3097,7 @@ VECTOR2I CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const VECTOR2I& aPoint, if( !aRotation.IsZero() ) RotatePoint( retVal, aTransformCentre, aRotation ); - if( aMoveVector != wxPoint{ 0, 0 } ) + if( aMoveVector != VECTOR2I{ 0, 0 } ) retVal += aMoveVector; return retVal; diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h index 5b140be9a5..e071458faf 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h @@ -143,11 +143,11 @@ private: const GATE_ID& aGateID, LIB_SYMBOL* aSymbol ); void loadLibrarySymbolShapeVertices( const std::vector& aCadstarVertices, - wxPoint aSymbolOrigin, LIB_SYMBOL* aSymbol, + VECTOR2I aSymbolOrigin, LIB_SYMBOL* aSymbol, int aGateNumber, int aLineThickness ); void applyToLibraryFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc, - wxPoint aSymbolOrigin, LIB_FIELD* aKiCadField ); + VECTOR2I aSymbolOrigin, LIB_FIELD* aKiCadField ); //Helper Functions for loading symbols in schematic SCH_SYMBOL* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_SYMBOL& aKiCadPart, @@ -231,7 +231,7 @@ private: void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber ); - std::pair getFigureExtentsKiCad( const FIGURE& aCadstarFigure ); + std::pair getFigureExtentsKiCad( const FIGURE& aCadstarFigure ); VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint ); diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp index ff22e1e526..cc8f5a05bb 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp @@ -390,7 +390,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse( XNODE* aNode, PARSER_ THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() ); } - if( !Position.IsFullySpecified() ) + if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE ) THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() ); } @@ -435,7 +435,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMDEF_SCM::Parse( XNODE* aNode, PARSER_CONTEXT } } - if( !Stub && !Origin.IsFullySpecified() ) + if( !Stub && ( Origin.x == UNDEFINED_VALUE || Origin.y == UNDEFINED_VALUE ) ) THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() ); } @@ -668,7 +668,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SIGNALREFERENCELINK::Parse( XNODE* aNode, PARSE THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() ); } - if( !Position.IsFullySpecified() ) + if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE ) THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() ); } @@ -813,7 +813,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SIGLOC::Parse( XNODE* aNode, PARSER_CONTEXT* aC THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() ); } - if( !Position.IsFullySpecified() ) + if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE ) THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() ); } diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index 77f8b505db..e108d0bd48 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -758,7 +758,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) // Calculate the already placed items bounding box and the page size to determine // placement for the new symbols - wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); + VECTOR2I pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); BOX2I sheetBbox = getSheetBbox( m_rootSheet ); VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() ); int maxY = sheetBbox.GetY(); @@ -792,7 +792,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) newCmpPosition.x += cmpBbox.GetWidth(); maxY = std::max( maxY, posY ); - if( newCmpPosition.x >= pageSizeIU.GetWidth() ) // reached the page boundary? + if( newCmpPosition.x >= pageSizeIU.x ) // reached the page boundary? newCmpPosition = VECTOR2I( sheetBbox.GetLeft(), maxY ); // then start a new row // Add the global net labels to recreate the implicit connections @@ -964,7 +964,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) targetSheetSize += VECTOR2I( schIUScale.MilsToIU( 1500 ), schIUScale.MilsToIU( 1500 ) ); // Get current Eeschema sheet size. - wxSize pageSizeIU = screen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); + VECTOR2I pageSizeIU = screen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); PAGE_INFO pageInfo = screen->GetPageSettings(); // Increase if necessary @@ -1074,8 +1074,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosY += rowSpacing; @@ -1117,8 +1117,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosY += rowSpacing; @@ -1160,8 +1160,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosX += columnSpacing; @@ -1203,8 +1203,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosX += columnSpacing; @@ -1338,8 +1338,8 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n { label->SetPosition( firstWire.A ); label->SetText( escapeName( netName ) ); - label->SetTextSize( wxSize( schIUScale.MilsToIU( 40 ), - schIUScale.MilsToIU( 40 ) ) ); + label->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 40 ), + schIUScale.MilsToIU( 40 ) ) ); if( firstWire.B.x > firstWire.A.x ) label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); @@ -1503,8 +1503,8 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aN bool global = m_netCounts[aNetName] > 1; std::unique_ptr label; - wxSize textSize = wxSize( KiROUND( elabel.size.ToSchUnits() * 0.7 ), - KiROUND( elabel.size.ToSchUnits() * 0.7 ) ); + VECTOR2I textSize = VECTOR2I( KiROUND( elabel.size.ToSchUnits() * 0.7 ), + KiROUND( elabel.size.ToSchUnits() * 0.7 ) ); if( global ) label = std::make_unique(); @@ -2443,8 +2443,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& LIB_TEXT* legendText = new LIB_TEXT( nullptr ); legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosY -= rowSpacing; @@ -2484,8 +2484,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& LIB_TEXT* legendText = new LIB_TEXT( nullptr ); legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosY -= rowSpacing; @@ -2525,8 +2525,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& LIB_TEXT* legendText = new LIB_TEXT( nullptr ); legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosX += columnSpacing; @@ -2566,8 +2566,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& LIB_TEXT* legendText = new LIB_TEXT( nullptr ); legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) ); legendText->SetText( wxString( legendChar ) ); - legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), - schIUScale.MilsToIU( 100 ) ) ); + legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ), + schIUScale.MilsToIU( 100 ) ) ); aItems.push_back( legendText ); legendChar++; legendPosX += columnSpacing; @@ -3366,8 +3366,8 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN* SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL; netLabel->SetPosition( aSymbol->GetPinPhysicalPosition( pin ) ); netLabel->SetText( extractNetName( pin->GetName() ) ); - netLabel->SetTextSize( wxSize( schIUScale.MilsToIU( 40 ), - schIUScale.MilsToIU( 40 ) ) ); + netLabel->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 40 ), + schIUScale.MilsToIU( 40 ) ) ); switch( pin->GetOrientation() ) { diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 57f17c2bea..0c69975c7f 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -579,9 +579,9 @@ void SCH_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText, bool aConvertOverbarSynta case T_size: { - wxSize sz; - sz.SetHeight( parseInternalUnits( "text height" ) ); - sz.SetWidth( parseInternalUnits( "text width" ) ); + VECTOR2I sz; + sz.y = parseInternalUnits( "text height" ); + sz.x = parseInternalUnits( "text width" ); aText->SetTextSize( sz ); NeedRIGHT(); break; @@ -1946,7 +1946,7 @@ SCH_FIELD* SCH_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent ) // Empty property values are valid. wxString value = FromUTF8(); - std::unique_ptr field = std::make_unique( wxDefaultPosition, -1, + std::unique_ptr field = std::make_unique( VECTOR2I(-1,-1), -1, aParent, name ); field->SetText( value ); @@ -3020,9 +3020,9 @@ SCH_SHEET* SCH_SEXPR_PARSER::parseSheet() case T_size: { - wxSize size; - size.SetWidth( parseInternalUnits( "sheet width" ) ); - size.SetHeight( parseInternalUnits( "sheet height" ) ); + VECTOR2I size; + size.x = parseInternalUnits( "sheet width" ); + size.y = parseInternalUnits( "sheet height" ); sheet->SetSize( size ); NeedRIGHT(); break; @@ -3297,10 +3297,10 @@ SCH_BUS_WIRE_ENTRY* SCH_SEXPR_PARSER::parseBusEntry() case T_size: { - wxSize size; + VECTOR2I size; - size.SetWidth( parseInternalUnits( "bus entry height" ) ); - size.SetHeight( parseInternalUnits( "bus entry width" ) ); + size.x = parseInternalUnits( "bus entry height" ); + size.y = parseInternalUnits( "bus entry width" ); busEntry->SetSize( size ); NeedRIGHT(); break; diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.h b/eeschema/sch_plugins/kicad/sch_sexpr_parser.h index a307b4eb71..6c5837b2ba 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.h +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.h @@ -143,9 +143,9 @@ private: return parseInternalUnits( GetTokenText( aToken ) ); } - inline wxPoint parseXY() + inline VECTOR2I parseXY() { - wxPoint xy; + VECTOR2I xy; xy.x = parseInternalUnits( "X coordinate" ); xy.y = parseInternalUnits( "Y coordinate" ); diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 770bd989d9..5a3bbd6e59 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -976,9 +976,9 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel ) EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSheet->GetPosition().y ).c_str(), EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, - aSheet->GetSize().GetWidth() ).c_str(), + aSheet->GetSize().x ).c_str(), EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, - aSheet->GetSize().GetHeight() ).c_str() ); + aSheet->GetSize().y ).c_str() ); if( aSheet->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO ) m_out->Print( 0, " (fields_autoplaced)" ); @@ -1159,9 +1159,9 @@ void SCH_SEXPR_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry, int aNestLev EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aBusEntry->GetPosition().y ).c_str(), EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, - aBusEntry->GetSize().GetWidth() ).c_str(), + aBusEntry->GetSize().x ).c_str(), EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, - aBusEntry->GetSize().GetHeight() ).c_str() ); + aBusEntry->GetSize().y ).c_str() ); aBusEntry->GetStroke().Format( m_out, schIUScale, aNestLevel + 1 ); diff --git a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp index 47088163fc..b0f5fbf866 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp @@ -569,7 +569,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr& aSymbol, pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); field->SetPosition( pos ); - wxSize textSize; + VECTOR2I textSize; textSize.x = textSize.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); field->SetTextSize( textSize ); @@ -882,7 +882,7 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr& aSymbo center.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); text->SetPosition( center ); - wxSize size; + VECTOR2I size; size.x = size.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); text->SetTextSize( size ); diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 6fafe624ce..05b0a27973 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -546,10 +546,10 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader ) position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); sheet->SetPosition( position ); - wxSize size; + VECTOR2I size; - size.SetWidth( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ) ); - size.SetHeight( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ) ); + size.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); + size.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); sheet->SetSize( size ); } else if( strCompare( "U", line, &line ) ) // Sheet UUID. @@ -575,7 +575,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader ) SCH_FIELD& field = sheet->GetFields()[ fieldId ]; field.SetText( text ); - field.SetTextSize( wxSize( size, size ) ); + field.SetTextSize( VECTOR2I( size, size ) ); } else // Sheet pin. { @@ -620,7 +620,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader ) size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); - sheetPin->SetTextSize( wxSize( size, size ) ); + sheetPin->SetTextSize( VECTOR2I( size, size ) ); sheet->AddPin( sheetPin.release() ); } @@ -910,7 +910,7 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader ) line = aReader.ReadLine(); VECTOR2I pos; - wxSize size; + VECTOR2I size; pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); @@ -1009,7 +1009,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader ) int size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); - text->SetTextSize( wxSize( size, size ) ); + text->SetTextSize( VECTOR2I( size, size ) ); // Parse the global and hierarchical label type. if( text->Type() == SCH_HIER_LABEL_T || text->Type() == SCH_GLOBAL_LABEL_T ) @@ -1329,7 +1329,7 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader ) field.SetText( text ); field.SetTextPos( pos ); field.SetVisible( !attributes ); - field.SetTextSize( wxSize( size, size ) ); + field.SetTextSize( VECTOR2I( size, size ) ); if( orientation == 'H' ) field.SetTextAngle( ANGLE_HORIZONTAL ); diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 6bbd6554a4..a0a0fc44cd 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -74,7 +74,7 @@ const wxString SCH_SHEET::GetDefaultFieldName( int aFieldNdx, bool aTranslated ) } -SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, wxSize aSize, +SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, VECTOR2I aSize, FIELDS_AUTOPLACED aAutoplaceFields ) : SCH_ITEM( aParent, SCH_SHEET_T ) { @@ -912,7 +912,7 @@ void SCH_SHEET::SetPosition( const VECTOR2I& aPosition ) } -void SCH_SHEET::Resize( const wxSize& aSize ) +void SCH_SHEET::Resize( const VECTOR2I& aSize ) { if( aSize == m_size ) return; diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 7a4a06ab26..8d899b6325 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -57,7 +57,7 @@ class SCH_SHEET : public SCH_ITEM { public: SCH_SHEET( EDA_ITEM* aParent = nullptr, const VECTOR2I& aPos = VECTOR2I( 0, 0 ), - wxSize aSize = wxSize( schIUScale.MilsToIU( MIN_SHEET_WIDTH ), + VECTOR2I aSize = VECTOR2I( schIUScale.MilsToIU( MIN_SHEET_WIDTH ), schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ), FIELDS_AUTOPLACED aAutoplaceFields = FIELDS_AUTOPLACED_AUTO ); @@ -105,8 +105,8 @@ public: SCH_SCREEN* GetScreen() const { return m_screen; } - wxSize GetSize() const { return m_size; } - void SetSize( const wxSize& aSize ) { m_size = aSize; } + VECTOR2I GetSize() const { return m_size; } + void SetSize( const VECTOR2I& aSize ) { m_size = aSize; } int GetBorderWidth() const { return m_borderWidth; } void SetBorderWidth( int aWidth ) { m_borderWidth = aWidth; } @@ -329,7 +329,7 @@ public: * * @param[in] aSize The new size for this sheet. */ - void Resize( const wxSize& aSize ); + void Resize( const VECTOR2I& aSize ); void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override; @@ -498,7 +498,7 @@ private: std::vector m_fields; VECTOR2I m_pos; // The position of the sheet. - wxSize m_size; // The size of the sheet. + VECTOR2I m_size; // The size of the sheet. int m_borderWidth; KIGFX::COLOR4D m_borderColor; KIGFX::COLOR4D m_backgroundColor; diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index d8d2f85ca7..a551b5a975 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -90,7 +90,7 @@ static LIB_SYMBOL* dummy() LIB_TEXT* text = new LIB_TEXT( symbol ); - text->SetTextSize( wxSize( schIUScale.MilsToIU( 150 ), schIUScale.MilsToIU( 150 ) ) ); + text->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 150 ), schIUScale.MilsToIU( 150 ) ) ); text->SetText( wxString( wxT( "??" ) ) ); symbol->AddDrawItem( square ); diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 471b5c69dc..e1aed19317 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -542,10 +543,10 @@ bool SCH_EDIT_FRAME::EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHi void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard() { - wxRect DrawArea; + wxRect drawArea; BASE_SCREEN* screen = GetScreen(); - DrawArea.SetSize( GetPageSizeIU() ); + drawArea.SetSize( ToWxSize( GetPageSizeIU() ) ); // Calculate a reasonable dc size, in pixels, and the dc scale to fit // the drawings into the dc size @@ -554,7 +555,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard() double inch2Iu = 1000.0 * schIUScale.IU_PER_MILS; double scale = ppi / inch2Iu; - wxSize dcsize = DrawArea.GetSize(); + wxSize dcsize = drawArea.GetSize(); int maxdim = std::max( dcsize.x, dcsize.y ); diff --git a/eeschema/sim/sim_model.cpp b/eeschema/sim/sim_model.cpp index ad9b333d65..c5f0d3d251 100644 --- a/eeschema/sim/sim_model.cpp +++ b/eeschema/sim/sim_model.cpp @@ -666,7 +666,7 @@ void SIM_MODEL::SetFieldValue( std::vector& aFields, const wxString& aFieldNa wxASSERT( aFields.size() >= 1 ); SCH_ITEM* parent = static_cast( aFields.at( 0 ).GetParent() ); - aFields.emplace_back( wxPoint(), aFields.size(), parent, aFieldName ); + aFields.emplace_back( VECTOR2I(), aFields.size(), parent, aFieldName ); } else if constexpr( std::is_same::value ) { diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index b99ef721ec..909319a402 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -1441,7 +1441,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol ) libField.SetText( field.GetText() ); libField.SetAttributes( field ); - libField.SetPosition( wxPoint( pos.x, -pos.y ) ); + libField.SetPosition( VECTOR2I( pos.x, -pos.y ) ); fullSetOfFields.emplace_back( std::move( libField ) ); } diff --git a/eeschema/symbol_editor/symbol_editor_plotter.cpp b/eeschema/symbol_editor/symbol_editor_plotter.cpp index 811cca9113..916fa73aac 100644 --- a/eeschema/symbol_editor/symbol_editor_plotter.cpp +++ b/eeschema/symbol_editor/symbol_editor_plotter.cpp @@ -63,7 +63,7 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName, VECTOR2I a { constexpr bool background = true; TRANSFORM temp; // Uses default transform - wxPoint plotPos; + VECTOR2I plotPos; plotPos.x = aOffset.x; plotPos.y = aOffset.y; @@ -89,13 +89,13 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings ) if( !m_symbol ) return; - wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); + VECTOR2I pagesize = GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); /* Plot item centered to the page * In symbol_editor, the symbol is centered at 0,0 coordinates. * So we must plot it with an offset = pagesize/2. */ - wxPoint plot_offset; + VECTOR2I plot_offset; plot_offset.x = pagesize.x / 2; plot_offset.y = pagesize.y / 2; diff --git a/eeschema/tools/backannotate.cpp b/eeschema/tools/backannotate.cpp index 15556d0ba7..c309f69ef4 100644 --- a/eeschema/tools/backannotate.cpp +++ b/eeschema/tools/backannotate.cpp @@ -573,7 +573,7 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin, SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings(); SCH_LABEL* label = new SCH_LABEL( driver->GetPosition(), aNewName ); label->SetParent( &m_frame->Schematic() ); - label->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); + label->SetTextSize( VECTOR2I( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); label->SetTextSpinStyle( spin ); label->SetFlags( IS_NEW ); diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index 9cf16a6818..21df957ef9 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -981,7 +981,7 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid ) const VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition(); VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition(); VECTOR2I sheetNewPos = sheet->GetPosition(); - wxSize sheetNewSize = sheet->GetSize(); + VECTOR2I sheetNewSize = sheet->GetSize(); gridHelper.SetSnap( aSnapToGrid ); @@ -1004,25 +1004,25 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid ) const || isModified( m_editPoints->Point( RECT_BOTLEFT ) ) ) { sheetNewPos = topLeft; - sheetNewSize = wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ); + sheetNewSize = VECTOR2I( botRight.x - topLeft.x, botRight.y - topLeft.y ); } else if( isModified( m_editPoints->Line( RECT_TOP ) ) ) { sheetNewPos = VECTOR2I( sheet->GetPosition().x, topLeft.y ); - sheetNewSize = wxSize( sheet->GetSize().x, botRight.y - topLeft.y ); + sheetNewSize = VECTOR2I( sheet->GetSize().x, botRight.y - topLeft.y ); } else if( isModified( m_editPoints->Line( RECT_LEFT ) ) ) { sheetNewPos = VECTOR2I( topLeft.x, sheet->GetPosition().y ); - sheetNewSize = wxSize( botRight.x - topLeft.x, sheet->GetSize().y ); + sheetNewSize = VECTOR2I( botRight.x - topLeft.x, sheet->GetSize().y ); } else if( isModified( m_editPoints->Line( RECT_BOT ) ) ) { - sheetNewSize = wxSize( sheet->GetSize().x, botRight.y - topLeft.y ); + sheetNewSize = VECTOR2I( sheet->GetSize().x, botRight.y - topLeft.y ); } else if( isModified( m_editPoints->Line( RECT_RIGHT ) ) ) { - sheetNewSize = wxSize( botRight.x - topLeft.x, sheet->GetSize().y ); + sheetNewSize = VECTOR2I( botRight.x - topLeft.x, sheet->GetSize().y ); } for( unsigned i = 0; i < m_editPoints->LinesSize(); ++i ) @@ -1049,8 +1049,8 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid ) const case SHEET_SIDE::BOTTOM: pin->Move( VECTOR2I( sheet->GetPosition().x - sheetNewPos.x, 0 ) ); break; - case SHEET_SIDE::UNDEFINED: - break; + case SHEET_SIDE::UNDEFINED: + break; } } diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index edfdd9e32e..24e177387e 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -745,8 +745,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); - cursorPos = static_cast( aEvent.HasPosition() ? aEvent.Position() - : controls->GetMousePosition() ); + cursorPos = aEvent.HasPosition() ? aEvent.Position() : controls->GetMousePosition(); m_frame->PushTool( aEvent ); @@ -998,7 +997,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType } textItem->SetTextSpinStyle( m_lastTextOrientation ); - textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); + textItem->SetTextSize( VECTOR2I( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); textItem->SetFlags( IS_NEW | IS_MOVING ); if( !labelItem ) @@ -1087,7 +1086,7 @@ SCH_SHEET_PIN* SCH_DRAWING_TOOLS::createSheetPin( SCH_SHEET* aSheet, SCH_HIERLAB sheetPin = new SCH_SHEET_PIN( aSheet, VECTOR2I( 0, 0 ), text ); sheetPin->SetFlags( IS_NEW ); - sheetPin->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); + sheetPin->SetTextSize( VECTOR2I( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); sheetPin->SetShape( m_lastSheetPinType ); if( !aLabel ) @@ -1352,8 +1351,8 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) labelItem->SetBold( m_lastTextBold ); labelItem->SetItalic( m_lastTextItalic ); labelItem->SetTextSpinStyle( m_lastTextOrientation ); - labelItem->SetTextSize( wxSize( sch_settings.m_DefaultTextSize, - sch_settings.m_DefaultTextSize ) ); + labelItem->SetTextSize( VECTOR2I( sch_settings.m_DefaultTextSize, + sch_settings.m_DefaultTextSize ) ); labelItem->SetFlags( IS_NEW | IS_MOVING ); labelItem->SetText( netName ); item = labelItem; @@ -1603,8 +1602,8 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) textbox->SetBold( m_lastTextBold ); textbox->SetItalic( m_lastTextItalic ); - textbox->SetTextSize( wxSize( sch_settings.m_DefaultTextSize, - sch_settings.m_DefaultTextSize ) ); + textbox->SetTextSize( VECTOR2I( sch_settings.m_DefaultTextSize, + sch_settings.m_DefaultTextSize ) ); textbox->SetTextAngle( m_lastTextAngle ); textbox->SetHorizJustify( m_lastTextJust ); textbox->SetStroke( m_lastTextboxStroke ); @@ -1909,7 +1908,7 @@ void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos ) size.y = std::max( size.y, schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ); VECTOR2I grid = m_frame->GetNearestGridPosition( pos + size ); - aSheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) ); + aSheet->Resize( VECTOR2I( grid.x - pos.x, grid.y - pos.y ) ); } diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 67db7b17b4..4d035b1979 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -178,8 +178,8 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent ) undoCmd.PushItem( wrapper ); m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS, false, false ); - DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_EESCHEMA_MILS, - MAX_PAGE_SIZE_EESCHEMA_MILS ) ); + DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, VECTOR2I( MAX_PAGE_SIZE_EESCHEMA_MILS, + MAX_PAGE_SIZE_EESCHEMA_MILS ) ); dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName ); if( dlg.ShowModal() == wxID_OK ) @@ -1513,7 +1513,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent ) catch( IO_ERROR& ) { // If it wasn't content, then paste as text object. - SCH_TEXT* text_item = new SCH_TEXT( wxPoint( 0, 0 ), content ); + SCH_TEXT* text_item = new SCH_TEXT( VECTOR2I( 0, 0 ), content ); text_item->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); // Left alignment tempScreen->Append( text_item ); } diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 35042add79..70e66b1816 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -394,7 +394,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const VECTO m_frame->AddToScreen( m_busUnfold.entry, m_frame->GetScreen() ); m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->GetEnd(), aNet ); - m_busUnfold.label->SetTextSize( wxSize( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) ); + m_busUnfold.label->SetTextSize( VECTOR2I( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) ); m_busUnfold.label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); m_busUnfold.label->SetParent( m_frame->GetScreen() ); m_busUnfold.label->SetFlags( IS_NEW | IS_MOVING ); @@ -629,7 +629,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType, if( !m_wires.empty() ) segment = m_wires.back(); - wxPoint contextMenuPos; + VECTOR2I contextMenuPos; // Main loop: keep receiving events while( TOOL_EVENT* evt = Wait() ) @@ -852,7 +852,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType, // Erase and redraw if necessary if( flipX != m_busUnfold.flipX || flipY != m_busUnfold.flipY ) { - wxSize size = entry->GetSize(); + VECTOR2I size = entry->GetSize(); int ySign = flipY ? -1 : 1; int xSign = flipX ? -1 : 1; @@ -975,7 +975,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType, if( !segment ) m_toolMgr->VetoContextMenuMouseWarp(); - contextMenuPos = (wxPoint) cursorPos; + contextMenuPos = cursorPos; m_menu.ShowContextMenu( m_selectionTool->GetSelection() ); } else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE ) diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 30479b6780..e9f1b603fc 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -1658,7 +1658,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent ) doMoveItem( sheet, tl_gridpt ); VECTOR2I newSize = (VECTOR2I) sheet->GetSize() - tl_gridpt + br_gridpt; - sheet->SetSize( wxSize( newSize.x, newSize.y ) ); + sheet->SetSize( VECTOR2I( newSize.x, newSize.y ) ); updateItem( sheet, true ); for( SCH_SHEET_PIN* pin : sheet->GetPins() ) diff --git a/eeschema/tools/symbol_editor_drawing_tools.cpp b/eeschema/tools/symbol_editor_drawing_tools.cpp index 6aecd804f6..6ccb8c2be6 100644 --- a/eeschema/tools/symbol_editor_drawing_tools.cpp +++ b/eeschema/tools/symbol_editor_drawing_tools.cpp @@ -222,8 +222,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) text->SetConvert( m_frame->GetConvert() ); text->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) ); - text->SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ), - schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); + text->SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ), + schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); text->SetTextAngle( m_lastTextAngle ); DIALOG_LIB_TEXT_PROPERTIES dlg( m_frame, text ); @@ -432,8 +432,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) textbox->SetBold( m_lastTextBold ); textbox->SetItalic( m_lastTextItalic ); - textbox->SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ), - schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); + textbox->SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ), + schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); textbox->SetTextAngle( m_lastTextAngle ); textbox->SetHorizJustify( m_lastTextJust ); diff --git a/eeschema/tools/symbol_editor_pin_tool.cpp b/eeschema/tools/symbol_editor_pin_tool.cpp index 22f8a3f466..a977c0fee7 100644 --- a/eeschema/tools/symbol_editor_pin_tool.cpp +++ b/eeschema/tools/symbol_editor_pin_tool.cpp @@ -418,7 +418,7 @@ int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent ) LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin ) { LIB_PIN* pin = (LIB_PIN*) aSourcePin->Clone(); - wxPoint step; + VECTOR2I step; pin->ClearFlags(); pin->SetFlags( IS_NEW ); diff --git a/eeschema/widgets/symbol_preview_widget.cpp b/eeschema/widgets/symbol_preview_widget.cpp index 3c2204a6e9..54a6096454 100644 --- a/eeschema/widgets/symbol_preview_widget.cpp +++ b/eeschema/widgets/symbol_preview_widget.cpp @@ -20,6 +20,7 @@ #include "symbol_preview_widget.h" #include #include +#include #include #include #include @@ -152,7 +153,7 @@ void SYMBOL_PREVIEW_WIDGET::fitOnDrawArea() // Calculate the drawing area size, in internal units, for a scaling factor = 1.0 view->SetScale( 1.0 ); - VECTOR2D clientSize = view->ToWorld( m_preview->GetClientSize(), false ); + VECTOR2D clientSize = view->ToWorld( ToVECTOR2D( m_preview->GetClientSize() ), false ); // Calculate the draw scale to fit the drawing area double scale = std::min( fabs( clientSize.x / m_itemBBox.GetWidth() ), fabs( clientSize.y / m_itemBBox.GetHeight() ) ); diff --git a/gerbview/dcode.h b/gerbview/dcode.h index 94b3ba18a1..6ddf1b86ea 100644 --- a/gerbview/dcode.h +++ b/gerbview/dcode.h @@ -187,11 +187,11 @@ public: int GetShapeDim( GERBER_DRAW_ITEM* aParent ); public: - wxSize m_Size; ///< Horizontal and vertical dimensions. + VECTOR2I m_Size; ///< Horizontal and vertical dimensions. APERTURE_T m_ApertType; ///< Aperture type ( Line, rectangle, circle, ///< oval poly, macro ) int m_Num_Dcode; ///< D code value ( >= 10 ) - wxSize m_Drill; ///< dimension of the hole (if any) (drill file) + VECTOR2I m_Drill; ///< dimension of the hole (if any) (drill file) APERTURE_DEF_HOLETYPE m_DrillShape; ///< shape of the hole (0 = no hole, round = 1, ///< rect = 2). EDA_ANGLE m_Rotation; ///< shape rotation diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 67dbd9c07b..18f49851fa 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -164,14 +164,14 @@ extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, APERTURE_T aAperture, int Dcode_index, const VECTOR2I& aPos, - wxSize aSize, + VECTOR2I aSize, bool aLayerNegative ); extern void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const VECTOR2I& aStart, const VECTOR2I& aEnd, - wxSize aPenSize, + VECTOR2I aPenSize, bool aLayerNegative ); extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, @@ -179,7 +179,7 @@ extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, const VECTOR2I& aStart, const VECTOR2I& aEnd, const VECTOR2I& aRelCenter, - wxSize aPenSize, + VECTOR2I aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative ); diff --git a/gerbview/gerber_draw_item.h b/gerbview/gerber_draw_item.h index c8d6583e75..96aa20a6a2 100644 --- a/gerbview/gerber_draw_item.h +++ b/gerbview/gerber_draw_item.h @@ -236,7 +236,7 @@ public: VECTOR2I m_ArcCentre; // for arcs only: Center of arc SHAPE_POLY_SET m_ShapeAsPolygon; // Polygon shape data from G36 to G37 coordinates // or for complex shapes which are converted to polygon - wxSize m_Size; // Flashed shapes: size of the shape + VECTOR2I m_Size; // Flashed shapes: size of the shape // Lines : m_Size.x = m_Size.y = line width bool m_Flashed; // True for flashed items int m_DCode; // DCode used to draw this item. diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 6952439db5..c70eb6a2a5 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -850,7 +850,7 @@ const PAGE_INFO& GERBVIEW_FRAME::GetPageSettings() const } -const wxSize GERBVIEW_FRAME::GetPageSizeIU() const +const VECTOR2I GERBVIEW_FRAME::GetPageSizeIU() const { // this function is only needed because EDA_DRAW_FRAME is not compiled // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 2c32036a1a..e34a3bb937 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -428,7 +428,7 @@ public: void SetPageSettings( const PAGE_INFO& aPageSettings ) override; const PAGE_INFO& GetPageSettings() const override; - const wxSize GetPageSizeIU() const override; + const VECTOR2I GetPageSizeIU() const override; const VECTOR2I& GetGridOrigin() const override { return m_grid_origin; } void SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; } diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index f53b62dbcf..f472a0831b 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -100,7 +100,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, APERTURE_T aAperture, int Dcode_index, const VECTOR2I& aPos, - wxSize aSize, + VECTOR2I aSize, bool aLayerNegative ) { aGbrItem->m_Size = aSize; @@ -154,7 +154,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const VECTOR2I& aStart, const VECTOR2I& aEnd, - wxSize aPenSize, + VECTOR2I aPenSize, bool aLayerNegative ) { aGbrItem->m_Flashed = false; @@ -200,7 +200,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, * @param aLayerNegative set to true if the current layer is negative. */ void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const VECTOR2I& aStart, - const VECTOR2I& aEnd, const VECTOR2I& aRelCenter, wxSize aPenSize, + const VECTOR2I& aEnd, const VECTOR2I& aRelCenter, VECTOR2I aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative ) { VECTOR2I center, delta; @@ -336,7 +336,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const VECTOR2I& aStart, con aGbrItem->SetLayerPolarity( aLayerNegative ); - fillArcGBRITEM( &dummyGbrItem, 0, aStart, aEnd, rel_center, wxSize( 0, 0 ), + fillArcGBRITEM( &dummyGbrItem, 0, aStart, aEnd, rel_center, VECTOR2I( 0, 0 ), aClockwise, aMultiquadrant, aLayerNegative ); aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict ); @@ -556,7 +556,7 @@ bool GERBER_FILE_IMAGE::Execute_G_Command( char*& text, int G_command ) bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande ) { - wxSize size( 15, 15 ); + VECTOR2I size( 15, 15 ); APERTURE_T aperture = APT_CIRCLE; GERBER_DRAW_ITEM* gbritem; diff --git a/include/base_screen.h b/include/base_screen.h index 5fe42874c8..f4a7de2a02 100644 --- a/include/base_screen.h +++ b/include/base_screen.h @@ -42,7 +42,7 @@ class BASE_SCREEN : public EDA_ITEM public: BASE_SCREEN( EDA_ITEM* aParent, KICAD_T aType = SCREEN_T ); - BASE_SCREEN( const wxSize& aPageSizeIU, KICAD_T aType = SCREEN_T ) : + BASE_SCREEN( const VECTOR2I& aPageSizeIU, KICAD_T aType = SCREEN_T ) : BASE_SCREEN( nullptr, aType ) { InitDataPoints( aPageSizeIU ); @@ -54,7 +54,7 @@ public: ~BASE_SCREEN() override { } - void InitDataPoints( const wxSize& aPageSizeInternalUnits ); + void InitDataPoints( const VECTOR2I& aPageSizeInternalUnits ); void SetContentModified( bool aModified = true ) { m_flagModified = aModified; } bool IsContentModified() const { return m_flagModified; } diff --git a/include/bitmap_base.h b/include/bitmap_base.h index fc9681f58d..558f18d86d 100644 --- a/include/bitmap_base.h +++ b/include/bitmap_base.h @@ -109,12 +109,12 @@ public: /** * @return the size in pixels of the image */ - wxSize GetSizePixels() const + VECTOR2I GetSizePixels() const { if( m_image ) - return wxSize( m_image->GetWidth(), m_image->GetHeight() ); + return VECTOR2I( m_image->GetWidth(), m_image->GetHeight() ); else - return wxSize( 0, 0 ); + return VECTOR2I( 0, 0 ); } /** diff --git a/include/board_design_settings.h b/include/board_design_settings.h index 363b906ae9..404b4c7a1d 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -610,7 +610,7 @@ public: /** * Return the default text size from the layer class for the given layer. */ - wxSize GetTextSize( PCB_LAYER_ID aLayer ) const; + VECTOR2I GetTextSize( PCB_LAYER_ID aLayer ) const; /** * Return the default text thickness from the layer class for the given layer. @@ -697,7 +697,7 @@ public: // Arrays of default values for the various layer classes. int m_LineThickness[ LAYER_CLASS_COUNT ]; - wxSize m_TextSize[ LAYER_CLASS_COUNT ]; + VECTOR2I m_TextSize[LAYER_CLASS_COUNT]; int m_TextThickness[ LAYER_CLASS_COUNT ]; bool m_TextItalic[ LAYER_CLASS_COUNT ]; bool m_TextUpright[ LAYER_CLASS_COUNT ]; diff --git a/include/dialogs/dialog_page_settings.h b/include/dialogs/dialog_page_settings.h index 5704fe264c..c500f34423 100644 --- a/include/dialogs/dialog_page_settings.h +++ b/include/dialogs/dialog_page_settings.h @@ -36,7 +36,7 @@ class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE { public: DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, - const wxSize& aMaxUserSizeMils ); + const VECTOR2I& aMaxUserSizeMils ); virtual ~DIALOG_PAGES_SETTINGS(); const wxString GetWksFileName() @@ -121,8 +121,8 @@ protected: bool m_initialized; bool m_localPrjConfigChanged; /// the page layuout filename was changed wxBitmap* m_pageBitmap; /// Temporary bitmap for the drawing sheet example. - wxSize m_layout_size; /// Logical drawing sheet size. - wxSize m_maxPageSizeMils; /// The max page size allowed by the caller frame + VECTOR2I m_layout_size; /// Logical drawing sheet size. + VECTOR2I m_maxPageSizeMils; /// The max page size allowed by the caller frame PAGE_INFO m_pageInfo; /// Temporary page info. bool m_customFmt; /// true if the page selection is custom TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions). diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h index 2f4d10301e..10b0e0de9c 100644 --- a/include/eda_draw_frame.h +++ b/include/eda_draw_frame.h @@ -112,7 +112,7 @@ public: * Works off of GetPageSettings() to return the size of the paper page in * the internal units of this particular view. */ - virtual const wxSize GetPageSizeIU() const = 0; + virtual const VECTOR2I GetPageSizeIU() const = 0; /** * For those frames that support polar coordinates. diff --git a/include/eda_units.h b/include/eda_units.h index 75e4642151..89546f0911 100644 --- a/include/eda_units.h +++ b/include/eda_units.h @@ -116,8 +116,6 @@ namespace EDA_UNIT_UTILS * @return A std::string object containing the converted value. */ std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, int aValue ); - std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const wxPoint& aPoint ); - std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const wxSize& aSize ); std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const VECTOR2I& aPoint ); constexpr inline int Mils2IU( const EDA_IU_SCALE& aIuScale, int mils ) diff --git a/include/origin_viewitem.h b/include/origin_viewitem.h index 9c8afb3bcf..6098a1c6bf 100644 --- a/include/origin_viewitem.h +++ b/include/origin_viewitem.h @@ -109,14 +109,9 @@ public: m_end = aPosition; } - inline void SetEndPosition( const wxPoint& aPosition ) + inline const VECTOR2I GetEndPosition() const { - m_end = VECTOR2D( aPosition ); - } - - inline const wxPoint GetEndPosition() const - { - return wxPoint( m_end.x, m_end.y ); + return VECTOR2I( m_end.x, m_end.y ); } inline void SetSize( int aSize ) diff --git a/include/page_info.h b/include/page_info.h index 7857326587..cbd2340aa9 100644 --- a/include/page_info.h +++ b/include/page_info.h @@ -159,9 +159,9 @@ public: * variable being passed. Note, this constexpr variable changes depending * on application, hence why it is passed. */ - const wxSize GetSizeIU( double aIUScale ) const + const VECTOR2I GetSizeIU( double aIUScale ) const { - return wxSize( GetWidthIU( aIUScale ), GetHeightIU( aIUScale ) ); + return VECTOR2I( GetWidthIU( aIUScale ), GetHeightIU( aIUScale ) ); } /** @@ -198,7 +198,7 @@ public: protected: // only the class implementation(s) may use this constructor - PAGE_INFO( const wxSize& aSizeMils, const wxString& aName, wxPaperSize aPaperId ); + PAGE_INFO( const VECTOR2I& aSizeMils, const wxString& aName, wxPaperSize aPaperId ); private: // standard pre-defined sizes diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 0a51db4630..5b8b16d60a 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -128,7 +128,7 @@ public: virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) override; const PAGE_INFO& GetPageSettings() const override; - const wxSize GetPageSizeIU() const override; + const VECTOR2I GetPageSizeIU() const override; const VECTOR2I& GetGridOrigin() const override; void SetGridOrigin( const VECTOR2I& aPoint ) override; diff --git a/include/pcb_screen.h b/include/pcb_screen.h index d4f78be676..22636a7fdf 100644 --- a/include/pcb_screen.h +++ b/include/pcb_screen.h @@ -37,7 +37,7 @@ public: /** * @param aPageSizeIU is the size of the initial paper page in internal units. */ - PCB_SCREEN( const wxSize& aPageSizeIU ); + PCB_SCREEN( const VECTOR2I& aPageSizeIU ); PCB_LAYER_ID m_Active_Layer; PCB_LAYER_ID m_Route_Layer_TOP; diff --git a/include/plotters/gbr_plotter_apertures.h b/include/plotters/gbr_plotter_apertures.h index 1673d3ca12..f37d782403 100644 --- a/include/plotters/gbr_plotter_apertures.h +++ b/include/plotters/gbr_plotter_apertures.h @@ -73,7 +73,7 @@ public: // only one parameter: rotation }; - void SetSize( const wxSize& aSize ) + void SetSize( const VECTOR2I& aSize ) { m_Size = aSize; } diff --git a/libs/kimath/include/geometry/shape.h b/libs/kimath/include/geometry/shape.h index b6767b101d..d8462722ca 100644 --- a/libs/kimath/include/geometry/shape.h +++ b/libs/kimath/include/geometry/shape.h @@ -32,6 +32,7 @@ #include #include #include +#include class SHAPE_LINE_CHAIN; diff --git a/libs/kimath/include/math/vector2d.h b/libs/kimath/include/math/vector2d.h index 79a804e714..6f5156e027 100644 --- a/libs/kimath/include/math/vector2d.h +++ b/libs/kimath/include/math/vector2d.h @@ -35,10 +35,6 @@ #include -#ifdef WX_COMPATIBILITY -#include -#endif - /** * Traits class for VECTOR2. */ @@ -84,14 +80,6 @@ public: /// Construct a 2D-vector with x, y = 0 VECTOR2(); -#ifdef WX_COMPATIBILITY - /// Constructor with a wxPoint as argument - VECTOR2( const wxPoint& aPoint ); - - /// Constructor with a wxSize as argument - VECTOR2( const wxSize& aSize ); -#endif - /// Construct a vector with given components x, y VECTOR2( T x, T y ); @@ -117,26 +105,6 @@ public: return VECTOR2( (CastedType) x, (CastedType) y ); } - /** - * Implement the cast to wxPoint. - * - * @return the vector cast to wxPoint. - */ - explicit operator wxPoint() const - { - return wxPoint( x, y ); - } - - /** - * Implement the cast to wxPoint. - * - * @return the vector cast to wxPoint. - */ - explicit operator wxSize() const - { - return wxSize( x, y ); - } - // virtual ~VECTOR2(); /** @@ -258,29 +226,11 @@ public: // ---------------------- template -VECTOR2::VECTOR2() +VECTOR2::VECTOR2() : x{}, y{} { - x = y = 0.0; } -#ifdef WX_COMPATIBILITY -template -VECTOR2::VECTOR2( const wxPoint& aPoint ) -{ - x = T( aPoint.x ); - y = T( aPoint.y ); -} - - -template -VECTOR2::VECTOR2( const wxSize& aSize ) -{ - x = T( aSize.x ); - y = T( aSize.y ); -} -#endif - template VECTOR2::VECTOR2( T aX, T aY ) { diff --git a/libs/kimath/include/math/vector2wx.h b/libs/kimath/include/math/vector2wx.h new file mode 100644 index 0000000000..0f0f1dfd81 --- /dev/null +++ b/libs/kimath/include/math/vector2wx.h @@ -0,0 +1,60 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef VECTOR2WX_H_ +#define VECTOR2WX_H_ + +#include +#include "vector2d.h" + +inline VECTOR2I ToVECTOR2I(const wxSize& aSize) +{ + return { aSize.x, aSize.y }; +} + +inline VECTOR2I ToVECTOR2I( const wxPoint & aSize ) +{ + return { aSize.x, aSize.y }; +} + +inline VECTOR2D ToVECTOR2D( const wxPoint& aPoint ) +{ + return VECTOR2D( aPoint.x, aPoint.y ); +} + +inline VECTOR2D ToVECTOR2D( const wxSize& aPoint ) +{ + return VECTOR2D( aPoint.x, aPoint.y ); +} + +inline wxPoint ToWxPoint( const VECTOR2I& aSize ) +{ + return wxPoint( aSize.x, aSize.y ); +} + +inline wxSize ToWxSize( const VECTOR2I& aSize ) +{ + return wxSize( aSize.x, aSize.y ); +} + +#endif \ No newline at end of file diff --git a/libs/kimath/src/trigo.cpp b/libs/kimath/src/trigo.cpp index b9c40ba087..804a0deeaa 100644 --- a/libs/kimath/src/trigo.cpp +++ b/libs/kimath/src/trigo.cpp @@ -232,20 +232,6 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, const EDA_ANGLE& angle ) } -void RotatePoint( wxPoint* point, const wxPoint& centre, const EDA_ANGLE& angle ) -{ - int ox, oy; - - ox = point->x - centre.x; - oy = point->y - centre.y; - - RotatePoint( &ox, &oy, angle ); - - point->x = ox + centre.x; - point->y = oy + centre.y; -} - - void RotatePoint( double* pX, double* pY, double cx, double cy, const EDA_ANGLE& angle ) { double ox, oy; diff --git a/pagelayout_editor/dialogs/design_inspector.cpp b/pagelayout_editor/dialogs/design_inspector.cpp index 79e4e33ae2..90bb7d6fa3 100644 --- a/pagelayout_editor/dialogs/design_inspector.cpp +++ b/pagelayout_editor/dialogs/design_inspector.cpp @@ -228,7 +228,7 @@ void DIALOG_INSPECTOR::ReCreateDesignList() // Display page format name. GetGridList()->SetCellValue( row, COL_COMMENT, page_info.GetType() ); GetGridList()->SetCellValue( row, COL_REPEAT_NUMBER, "-" ); - wxSize page_sizeIU = m_editorFrame->GetPageSizeIU(); + VECTOR2I page_sizeIU = m_editorFrame->GetPageSizeIU(); GetGridList()->SetCellValue( row, COL_TEXTSTRING, wxString::Format( _( "Size: %.1fx%.1fmm" ), drawSheetIUScale.IUTomm( page_sizeIU.x ), diff --git a/pagelayout_editor/dialogs/dialogs_for_printing.cpp b/pagelayout_editor/dialogs/dialogs_for_printing.cpp index 5a4f9eddf1..ab3c40b305 100644 --- a/pagelayout_editor/dialogs/dialogs_for_printing.cpp +++ b/pagelayout_editor/dialogs/dialogs_for_printing.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "invoke_pl_editor_dialog.h" #include "pl_editor_frame.h" @@ -168,7 +169,7 @@ void PLEDITOR_PRINTOUT::PrintPage( int aPageNum ) old_org = screen->m_DrawOrg; // Change scale factor and offset to print the whole page. - pageSizeIU = m_parent->GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS ); + pageSizeIU = ToWxSize( m_parent->GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS ) ); FitThisSizeToPaper( pageSizeIU ); fitRect = GetLogicalPaperRect(); diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 5b9c949d9a..80d38c889d 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -121,7 +121,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_acceptedExts.emplace( DrawingSheetFileExtension, nullptr ); DragAcceptFiles( true ); - wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS ); + VECTOR2I pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS ); SetScreen( new BASE_SCREEN( pageSizeIU ) ); setupTools(); @@ -595,7 +595,7 @@ const PAGE_INFO& PL_EDITOR_FRAME::GetPageSettings() const } -const wxSize PL_EDITOR_FRAME::GetPageSizeIU() const +const VECTOR2I PL_EDITOR_FRAME::GetPageSizeIU() const { // this function is only needed because EDA_DRAW_FRAME is not compiled // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index a1fc80f4d0..e185540491 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -102,7 +102,7 @@ public: void SetPageSettings(const PAGE_INFO&) override; const PAGE_INFO& GetPageSettings () const override; - const wxSize GetPageSizeIU() const override; + const VECTOR2I GetPageSizeIU() const override; PL_DRAW_PANEL_GAL* GetCanvas() const override; SELECTION& GetCurrentSelection() override; diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp index 40f83b673e..55615b0588 100644 --- a/pagelayout_editor/tools/pl_editor_control.cpp +++ b/pagelayout_editor/tools/pl_editor_control.cpp @@ -90,8 +90,8 @@ int PL_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent ) m_frame->SaveCopyInUndoList(); DIALOG_PAGES_SETTINGS dlg( m_frame, drawSheetIUScale.IU_PER_MILS, - wxSize( MAX_PAGE_SIZE_EESCHEMA_MILS, - MAX_PAGE_SIZE_EESCHEMA_MILS ) ); + VECTOR2I( MAX_PAGE_SIZE_EESCHEMA_MILS, + MAX_PAGE_SIZE_EESCHEMA_MILS ) ); dlg.SetWksFileName( m_frame->GetCurrentFileName() ); dlg.EnableWksFileNamePicker( false ); diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index bb4d88cc38..8ee7e5e9ac 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -74,15 +74,15 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: m_DefaultFPTextItems.emplace_back( wxT( "${REFERENCE}" ), true, F_Fab ); m_LineThickness[ LAYER_CLASS_SILK ] = pcbIUScale.mmToIU( DEFAULT_SILK_LINE_WIDTH ); - m_TextSize[ LAYER_CLASS_SILK ] = wxSize( pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ), - pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ) ); + m_TextSize[ LAYER_CLASS_SILK ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ), + pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ) ); m_TextThickness[ LAYER_CLASS_SILK ] = pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH ); m_TextItalic[ LAYER_CLASS_SILK ] = false; m_TextUpright[ LAYER_CLASS_SILK ] = false; m_LineThickness[ LAYER_CLASS_COPPER ] = pcbIUScale.mmToIU( DEFAULT_COPPER_LINE_WIDTH ); - m_TextSize[ LAYER_CLASS_COPPER ] = wxSize( pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ), - pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ) ); + m_TextSize[ LAYER_CLASS_COPPER ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ), + pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ) ); m_TextThickness[ LAYER_CLASS_COPPER ] = pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_WIDTH ); m_TextItalic[ LAYER_CLASS_COPPER ] = false; m_TextUpright[ LAYER_CLASS_COPPER ] = false; @@ -90,29 +90,29 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: // Edges & Courtyards; text properties aren't used but better to have them holding // reasonable values than not. m_LineThickness[ LAYER_CLASS_EDGES ] = pcbIUScale.mmToIU( DEFAULT_EDGE_WIDTH ); - m_TextSize[ LAYER_CLASS_EDGES ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), - pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); + m_TextSize[ LAYER_CLASS_EDGES ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), + pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); m_TextThickness[ LAYER_CLASS_EDGES ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ); m_TextItalic[ LAYER_CLASS_EDGES ] = false; m_TextUpright[ LAYER_CLASS_EDGES ] = false; m_LineThickness[ LAYER_CLASS_COURTYARD ] = pcbIUScale.mmToIU( DEFAULT_COURTYARD_WIDTH ); - m_TextSize[ LAYER_CLASS_COURTYARD ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), - pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); + m_TextSize[ LAYER_CLASS_COURTYARD ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), + pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); m_TextThickness[ LAYER_CLASS_COURTYARD ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ); m_TextItalic[ LAYER_CLASS_COURTYARD ] = false; m_TextUpright[ LAYER_CLASS_COURTYARD ] = false; m_LineThickness[ LAYER_CLASS_FAB ] = pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ); - m_TextSize[ LAYER_CLASS_FAB ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), - pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); + m_TextSize[LAYER_CLASS_FAB] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), + pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); m_TextThickness[ LAYER_CLASS_FAB ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ); m_TextItalic[ LAYER_CLASS_FAB ] = false; m_TextUpright[ LAYER_CLASS_FAB ] = false; m_LineThickness[ LAYER_CLASS_OTHERS ] = pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ); - m_TextSize[ LAYER_CLASS_OTHERS ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), - pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); + m_TextSize[ LAYER_CLASS_OTHERS ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), + pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) ); m_TextThickness[ LAYER_CLASS_OTHERS ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ); m_TextItalic[ LAYER_CLASS_OTHERS ] = false; m_TextUpright[ LAYER_CLASS_OTHERS ] = false; @@ -725,15 +725,15 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: if( aJson.contains( "width" ) && aJson.contains( "height" ) && aJson.contains( "drill" ) ) { - wxSize sz; - sz.SetWidth( pcbIUScale.mmToIU( aJson["width"].get() ) ); - sz.SetHeight( pcbIUScale.mmToIU( aJson["height"].get() ) ); + VECTOR2I sz; + sz.x = pcbIUScale.mmToIU( aJson["width"].get() ); + sz.y = pcbIUScale.mmToIU( aJson["height"].get() ); m_Pad_Master->SetSize( sz ); int drill = pcbIUScale.mmToIU( aJson["drill"].get() ); - m_Pad_Master->SetDrillSize( wxSize( drill, drill ) ); + m_Pad_Master->SetDrillSize( VECTOR2I( drill, drill ) ); } }, {} ) ); @@ -1245,7 +1245,7 @@ int BOARD_DESIGN_SETTINGS::GetLineThickness( PCB_LAYER_ID aLayer ) const } -wxSize BOARD_DESIGN_SETTINGS::GetTextSize( PCB_LAYER_ID aLayer ) const +VECTOR2I BOARD_DESIGN_SETTINGS::GetTextSize( PCB_LAYER_ID aLayer ) const { return m_TextSize[ GetLayerClass( aLayer ) ]; } diff --git a/pcbnew/convert_shape_list_to_polygon.cpp b/pcbnew/convert_shape_list_to_polygon.cpp index 4ac30a086e..d07ea3f609 100644 --- a/pcbnew/convert_shape_list_to_polygon.cpp +++ b/pcbnew/convert_shape_list_to_polygon.cpp @@ -693,7 +693,7 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE aOutlines.RemoveAllContours(); aOutlines.NewOutline(); - wxPoint corner; + VECTOR2I corner; aOutlines.Append( bbbox.GetOrigin() ); corner.x = bbbox.GetOrigin().x; diff --git a/pcbnew/dialogs/dialog_dimension_properties.cpp b/pcbnew/dialogs/dialog_dimension_properties.cpp index dd13119fa1..c4fc30c21f 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.cpp +++ b/pcbnew/dialogs/dialog_dimension_properties.cpp @@ -414,7 +414,7 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE* if( tpm == DIM_TEXT_POSITION::MANUAL ) { - wxPoint pos( m_textPosX.GetValue(), m_textPosY.GetValue() ); + VECTOR2I pos( m_textPosX.GetValue(), m_textPosY.GetValue() ); text.SetPosition( pos ); } diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp index 41833cbebb..6ac799838f 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties.cpp @@ -514,7 +514,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow() } // Set Footprint Position - wxPoint pos( m_posX.GetValue(), m_posY.GetValue() ); + VECTOR2I pos( m_posX.GetValue(), m_posY.GetValue() ); m_footprint->SetPosition( pos ); m_footprint->SetLocked( m_cbLocked->GetValue() ); diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index dda9b4f0db..5b04d9a023 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -343,10 +343,10 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B if( edaText ) { if( !m_textWidth.IsIndeterminate() ) - edaText->SetTextSize( wxSize( m_textWidth.GetValue(), edaText->GetTextSize().y ) ); + edaText->SetTextSize( VECTOR2I( m_textWidth.GetValue(), edaText->GetTextSize().y ) ); if( !m_textHeight.IsIndeterminate() ) - edaText->SetTextSize( wxSize( edaText->GetTextSize().x, m_textHeight.GetValue() ) ); + edaText->SetTextSize( VECTOR2I( edaText->GetTextSize().x, m_textHeight.GetValue() ) ); if( !m_thickness.IsIndeterminate() ) edaText->SetTextThickness( m_thickness.GetValue() ); diff --git a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp index 9a22195840..2314ef7514 100644 --- a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp @@ -428,7 +428,7 @@ void DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonAdd( wxCommandEvent& event ) if( m_currPoints.size() == 0 || row >= (int) m_currPoints.size() ) m_currPoints.emplace_back( 0, 0 ); else - m_currPoints.insert( m_currPoints.begin() + row, wxPoint( 0, 0 ) ); + m_currPoints.insert( m_currPoints.begin() + row, VECTOR2I( 0, 0 ) ); Validate(); TransferDataToWindow(); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 6b746df62e..6eac14d276 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -537,7 +537,7 @@ void DIALOG_PAD_PROPERTIES::initValues() m_sizeX.ChangeValue( m_dummyPad->GetSize().x ); m_sizeY.ChangeValue( m_dummyPad->GetSize().y ); - m_offsetShapeOpt->SetValue( m_dummyPad->GetOffset() != wxPoint() ); + m_offsetShapeOpt->SetValue( m_dummyPad->GetOffset() != VECTOR2I() ); m_offsetX.ChangeValue( m_dummyPad->GetOffset().x ); m_offsetY.ChangeValue( m_dummyPad->GetOffset().y ); @@ -1759,28 +1759,28 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad ) case 3: aPad->SetZoneConnection( ZONE_CONNECTION::NONE ); break; } - aPad->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) ); + aPad->SetPosition( VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ) ); if( m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_CIRCLE ) { aPad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); - aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeX.GetValue() ) ); + aPad->SetDrillSize( VECTOR2I( m_holeX.GetValue(), m_holeX.GetValue() ) ); } else { aPad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); - aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeY.GetValue() ) ); + aPad->SetDrillSize( VECTOR2I( m_holeX.GetValue(), m_holeY.GetValue() ) ); } if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) - aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) ); + aPad->SetSize( VECTOR2I( m_sizeX.GetValue(), m_sizeX.GetValue() ) ); else - aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeY.GetValue() ) ); + aPad->SetSize( VECTOR2I( m_sizeX.GetValue(), m_sizeY.GetValue() ) ); // For a trapezoid, test delta value (be sure delta is not too large for pad size) // remember DeltaSize.x is the Y size variation bool error = false; - wxSize delta( 0, 0 ); + VECTOR2I delta( 0, 0 ); if( aPad->GetShape() == PAD_SHAPE::TRAPEZOID ) { @@ -1818,9 +1818,9 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad ) aPad->SetDelta( delta ); if( m_offsetShapeOpt->GetValue() ) - aPad->SetOffset( wxPoint( m_offsetX.GetValue(), m_offsetY.GetValue() ) ); + aPad->SetOffset( VECTOR2I( m_offsetX.GetValue(), m_offsetY.GetValue() ) ); else - aPad->SetOffset( wxPoint() ); + aPad->SetOffset( VECTOR2I() ); // Read pad length die if( m_padToDieOpt->GetValue() ) @@ -1870,7 +1870,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad ) // diameter is acceptable, and is used in Gerber files as flashed area // reference if( aPad->GetAnchorPadShape() == PAD_SHAPE::CIRCLE ) - aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) ); + aPad->SetSize( VECTOR2I( m_sizeX.GetValue(), m_sizeX.GetValue() ) ); } // Define the way the clearance area is defined in zones. Since all non-custom pad @@ -1893,7 +1893,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad ) // and are intended to be used in virtual edge board connectors // However we can accept a non null offset, // mainly to allow complex pads build from a set of basic pad shapes - aPad->SetDrillSize( wxSize( 0, 0 ) ); + aPad->SetDrillSize( VECTOR2I( 0, 0 ) ); break; case PAD_ATTRIB::NPTH: diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 697632836e..b9b1d6c6c6 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -428,9 +428,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow() m_italic->IsChecked() ) ); } - m_edaText->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) ); + m_edaText->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) ); m_edaText->SetTextThickness( m_thickness.GetValue() ); - m_edaText->SetTextPos( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) ); + m_edaText->SetTextPos( VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ) ); if( m_fpText ) m_fpText->SetLocalCoord(); diff --git a/pcbnew/dialogs/dialog_textbox_properties.cpp b/pcbnew/dialogs/dialog_textbox_properties.cpp index 618b2324ab..3c07bb7791 100644 --- a/pcbnew/dialogs/dialog_textbox_properties.cpp +++ b/pcbnew/dialogs/dialog_textbox_properties.cpp @@ -340,7 +340,7 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow() m_italic->IsChecked() ) ); } - m_edaText->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) ); + m_edaText->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) ); m_edaText->SetTextThickness( m_thickness.GetValue() ); if( m_fpTextBox ) diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 73b87184d5..dbcf0cc062 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -539,16 +539,16 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() PCB_TRACK* t = static_cast( item ); if( !m_trackStartX.IsIndeterminate() ) - t->SetStart( wxPoint( m_trackStartX.GetValue(), t->GetStart().y ) ); + t->SetStart( VECTOR2I( m_trackStartX.GetValue(), t->GetStart().y ) ); if( !m_trackStartY.IsIndeterminate() ) - t->SetStart( wxPoint( t->GetStart().x, m_trackStartY.GetValue() ) ); + t->SetStart( VECTOR2I( t->GetStart().x, m_trackStartY.GetValue() ) ); if( !m_trackEndX.IsIndeterminate() ) - t->SetEnd( wxPoint( m_trackEndX.GetValue(), t->GetEnd().y ) ); + t->SetEnd( VECTOR2I( m_trackEndX.GetValue(), t->GetEnd().y ) ); if( !m_trackEndY.IsIndeterminate() ) - t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) ); + t->SetEnd( VECTOR2I( t->GetEnd().x, m_trackEndY.GetValue() ) ); if( m_trackNetclass->IsChecked() ) t->SetWidth( t->GetEffectiveNetClass()->GetTrackWidth() ); @@ -572,10 +572,10 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() PCB_VIA* v = static_cast( item ); if( !m_viaX.IsIndeterminate() ) - v->SetPosition( wxPoint( m_viaX.GetValue(), v->GetPosition().y ) ); + v->SetPosition( VECTOR2I( m_viaX.GetValue(), v->GetPosition().y ) ); if( !m_viaY.IsIndeterminate() ) - v->SetPosition( wxPoint( v->GetPosition().x, m_viaY.GetValue() ) ); + v->SetPosition( VECTOR2I( v->GetPosition().x, m_viaY.GetValue() ) ); if( m_viaNotFree->Get3StateValue() != wxCHK_UNDETERMINED ) v->SetIsFree( !m_viaNotFree->GetValue() ); diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_defaults.cpp index e9f2b3ac37..f7c2be3df4 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults.cpp +++ b/pcbnew/dialogs/panel_fp_editor_defaults.cpp @@ -359,7 +359,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow() if( i == ROW_EDGES || i == ROW_COURTYARD ) continue; - cfg.m_TextSize[ i ] = wxSize( m_graphicsGrid->GetUnitValue( i, COL_TEXT_WIDTH ), + cfg.m_TextSize[i] = VECTOR2I( m_graphicsGrid->GetUnitValue( i, COL_TEXT_WIDTH ), m_graphicsGrid->GetUnitValue( i, COL_TEXT_HEIGHT ) ); cfg.m_TextThickness[ i ] = m_graphicsGrid->GetUnitValue( i, COL_TEXT_THICKNESS ); diff --git a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp index 72aeb8661e..f0cf7e4684 100644 --- a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp +++ b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -553,7 +554,7 @@ void PANEL_PCBNEW_COLOR_SETTINGS::zoomFitPreview() BOX2I defaultBox = m_preview->GetDefaultViewBBox(); view->SetScale( 1.0 ); - VECTOR2D screenSize = view->ToWorld( m_preview->GetClientSize(), false ); + VECTOR2D screenSize = view->ToWorld( ToVECTOR2D( m_preview->GetClientSize() ), false ); if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 ) bBox = defaultBox; diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp index f44d7423af..b21c569c11 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp @@ -211,8 +211,8 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow() if( i == ROW_EDGES || i == ROW_COURTYARD ) continue; - m_BrdSettings->m_TextSize[ i ] = wxSize( m_grid->GetUnitValue( i, COL_TEXT_WIDTH ), - m_grid->GetUnitValue( i, COL_TEXT_HEIGHT ) ); + m_BrdSettings->m_TextSize[ i ] = VECTOR2I( m_grid->GetUnitValue( i, COL_TEXT_WIDTH ), + m_grid->GetUnitValue( i, COL_TEXT_HEIGHT ) ); m_BrdSettings->m_TextThickness[ i ] = m_grid->GetUnitValue( i, COL_TEXT_THICKNESS ); m_BrdSettings->m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_ITALIC ) ); diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index b11213b524..13ff0593b3 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -908,7 +908,6 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones() for( auto it = smoothed_polys[ia].IterateWithHoles(); it; it++ ) { VECTOR2I currentVertex = *it; - wxPoint pt( currentVertex.x, currentVertex.y ); if( smoothed_polys[ia2].Contains( currentVertex ) ) { @@ -916,7 +915,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones() drce->SetItems( zoneA, zoneB ); drce->SetViolatingRule( constraint.GetParentRule() ); - reportViolation( drce, pt, layer ); + reportViolation( drce, currentVertex, layer ); } } @@ -924,7 +923,6 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones() for( auto it = smoothed_polys[ia2].IterateWithHoles(); it; it++ ) { VECTOR2I currentVertex = *it; - wxPoint pt( currentVertex.x, currentVertex.y ); if( smoothed_polys[ia].Contains( currentVertex ) ) { @@ -932,7 +930,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones() drce->SetItems( zoneB, zoneA ); drce->SetViolatingRule( constraint.GetParentRule() ); - reportViolation( drce, pt, layer ); + reportViolation( drce, currentVertex, layer ); } } } diff --git a/pcbnew/drc/drc_test_provider_schematic_parity.cpp b/pcbnew/drc/drc_test_provider_schematic_parity.cpp index 5c97717708..6696c40d23 100644 --- a/pcbnew/drc/drc_test_provider_schematic_parity.cpp +++ b/pcbnew/drc/drc_test_provider_schematic_parity.cpp @@ -120,7 +120,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist ) std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_MISSING_FOOTPRINT ); drcItem->SetErrorMessage( msg ); - reportViolation( drcItem, wxPoint(), UNDEFINED_LAYER ); + reportViolation( drcItem, VECTOR2I(), UNDEFINED_LAYER ); } else { diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 4ecda8c78a..ab1009ad9f 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -111,7 +111,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ case PLOT_FORMAT::SVG: { PAGE_INFO pageA4( wxT( "A4" ) ); - wxSize pageSizeIU = pageA4.GetSizeIU( pcbIUScale.IU_PER_MILS ); + VECTOR2I pageSizeIU = pageA4.GetSizeIU( pcbIUScale.IU_PER_MILS ); // Reserve a 10 mm margin around the page. int margin = pcbIUScale.mmToIU( 10 ); @@ -267,7 +267,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ // Plot title "Info" wxString Text = wxT( "Drill Map:" ); plotter->Text( VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, ANGLE_HORIZONTAL, - wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), + VECTOR2I( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false, false, nullptr /* stroke font */ ); diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 90439f947a..022faa5eae 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -307,7 +307,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName ) SetMsgPanel( footprint ); PlaceFootprint( footprint ); - footprint->SetPosition( wxPoint( 0, 0 ) ); + footprint->SetPosition( VECTOR2I( 0, 0 ) ); GetBoard()->BuildListOfNets(); UpdateView(); @@ -1010,7 +1010,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) commit.Add( newFootprint ); viewControls->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false ); pcbframe->PlaceFootprint( newFootprint ); - newFootprint->SetPosition( wxPoint( 0, 0 ) ); + newFootprint->SetPosition( VECTOR2I( 0, 0 ) ); viewControls->SetCrossHairCursorPosition( cursorPos, false ); const_cast( newFootprint->m_Uuid ) = KIID(); commit.Push( wxT( "Insert footprint" ) ); @@ -1294,7 +1294,7 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, b footprint->SetAttributes( footprintTranslated ); PCB_LAYER_ID txt_layer; - wxPoint default_pos; + VECTOR2I default_pos; BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); footprint->Reference().SetText( settings.m_DefaultFPTextItems[0].m_Text ); diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index ff9bc9c511..549b547aed 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -885,7 +885,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent ) viewControls->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false ); pcbframe->PlaceFootprint( newFootprint ); - newFootprint->SetPosition( wxPoint( 0, 0 ) ); + newFootprint->SetPosition( VECTOR2I( 0, 0 ) ); viewControls->SetCrossHairCursorPosition( cursorPos, false ); commit.Push( wxT( "Insert footprint" ) ); diff --git a/pcbnew/footprint_wizard_frame_functions.cpp b/pcbnew/footprint_wizard_frame_functions.cpp index 2e3f071472..e57497eaee 100644 --- a/pcbnew/footprint_wizard_frame_functions.cpp +++ b/pcbnew/footprint_wizard_frame_functions.cpp @@ -114,7 +114,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() { // Add the object to board GetBoard()->Add( footprint, ADD_MODE::APPEND ); - footprint->SetPosition( wxPoint( 0, 0 ) ); + footprint->SetPosition( VECTOR2I( 0, 0 ) ); } updateView(); diff --git a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp index d73dd4f85f..c1075888f2 100644 --- a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp +++ b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp @@ -40,10 +40,10 @@ GRAPHICS_IMPORTER_PCBNEW::GRAPHICS_IMPORTER_PCBNEW() } -wxPoint GRAPHICS_IMPORTER_PCBNEW::MapCoordinate( const VECTOR2D& aCoordinate ) +VECTOR2I GRAPHICS_IMPORTER_PCBNEW::MapCoordinate( const VECTOR2D& aCoordinate ) { VECTOR2D coord = ( aCoordinate + GetImportOffsetMM() ) * ImportScalingFactor(); - return wxPoint( KiROUND( coord.x ), KiROUND( coord.y ) ); + return VECTOR2I( KiROUND( coord.x ), KiROUND( coord.y ) ); } diff --git a/pcbnew/import_gfx/graphics_importer_pcbnew.h b/pcbnew/import_gfx/graphics_importer_pcbnew.h index ed83139ea4..1a027070a6 100644 --- a/pcbnew/import_gfx/graphics_importer_pcbnew.h +++ b/pcbnew/import_gfx/graphics_importer_pcbnew.h @@ -83,7 +83,7 @@ public: * * @param aCoordinate is the imported coordinate in mm. */ - wxPoint MapCoordinate( const VECTOR2D& aCoordinate ); + VECTOR2I MapCoordinate( const VECTOR2D& aCoordinate ); /** * If aLineWidth < 0, the default line thickness value is returned. diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 4a8c1058f4..4f2ef57546 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -143,7 +143,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint ) GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false ); PlaceFootprint( newFootprint ); - newFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not yet be initialized + newFootprint->SetPosition( VECTOR2I( 0, 0 ) ); // cursor in GAL may not yet be initialized // Put it on FRONT layer, // because this is the default in Footprint Editor, and in libs diff --git a/pcbnew/microwave/microwave_footprint.cpp b/pcbnew/microwave/microwave_footprint.cpp index e7b625a896..22eb135c1f 100644 --- a/pcbnew/microwave/microwave_footprint.cpp +++ b/pcbnew/microwave/microwave_footprint.cpp @@ -140,7 +140,7 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint pad->SetNumber( wxT( "1" ) ); pad = *( it + 1 ); pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 ); - pad->SetSize( wxSize( pad->GetSize().x, gap_size ) ); + pad->SetSize( VECTOR2I( pad->GetSize().x, gap_size ) ); pad->SetY( pad->GetPos0().y + pad->GetPosition().y ); break; @@ -153,13 +153,13 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint std::vector polyPoints; polyPoints.reserve( numPoints ); - polyPoints.emplace_back( wxPoint( 0, 0 ) ); + polyPoints.emplace_back( VECTOR2I( 0, 0 ) ); EDA_ANGLE theta = -angle / 2; for( int ii = 1; ii < numPoints - 1; ii++ ) { - wxPoint pt( 0, -gap_size ); + VECTOR2I pt( 0, -gap_size ); RotatePoint( &pt.x, &pt.y, theta ); polyPoints.push_back( pt ); @@ -198,9 +198,9 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue, if( aTextSize > 0 ) { - footprint->Reference().SetTextSize( wxSize( aTextSize, aTextSize ) ); + footprint->Reference().SetTextSize( VECTOR2I( aTextSize, aTextSize ) ); footprint->Reference().SetTextThickness( aTextSize / 5 ); - footprint->Value().SetTextSize( wxSize( aTextSize, aTextSize ) ); + footprint->Value().SetTextSize( VECTOR2I( aTextSize, aTextSize ) ); footprint->Value().SetTextThickness( aTextSize / 5 ); } @@ -215,7 +215,7 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue, footprint->Add( pad, ADD_MODE::INSERT ); int tw = editFrame.GetDesignSettings().GetCurrentTrackWidth(); - pad->SetSize( wxSize( tw, tw ) ); + pad->SetSize( VECTOR2I( tw, tw ) ); pad->SetPosition( footprint->GetPosition() ); pad->SetShape( PAD_SHAPE::RECT ); diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index d6f153a249..fd7b68a046 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -357,7 +357,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& PAD* pad; PCB_EDIT_FRAME* editFrame = getEditFrame(); - wxPoint pt = aInductorPattern.m_End - aInductorPattern.m_Start; + VECTOR2I pt = aInductorPattern.m_End - aInductorPattern.m_Start; int min_len = KiROUND( EuclideanNorm( pt ) ); aInductorPattern.m_Length = min_len; diff --git a/pcbnew/microwave/microwave_polygon.cpp b/pcbnew/microwave/microwave_polygon.cpp index d44e289022..fe31ad7462 100644 --- a/pcbnew/microwave/microwave_polygon.cpp +++ b/pcbnew/microwave/microwave_polygon.cpp @@ -352,7 +352,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape() polyPoints.reserve( g_PolyEdges.size() + 2 ); // Init start point coord: - polyPoints.emplace_back( wxPoint( offset.x, 0 ) ); + polyPoints.emplace_back( VECTOR2I( offset.x, 0 ) ); VECTOR2I last_coordinate; @@ -366,7 +366,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape() // finish the polygonal shape if( last_coordinate.y != 0 ) - polyPoints.emplace_back( wxPoint( last_coordinate.x, 0 ) ); + polyPoints.emplace_back( VECTOR2I( last_coordinate.x, 0 ) ); switch( g_PolyShapeType ) { diff --git a/pcbnew/microwave/microwave_tool.h b/pcbnew/microwave/microwave_tool.h index 681274e3c3..8df7edd1e8 100644 --- a/pcbnew/microwave/microwave_tool.h +++ b/pcbnew/microwave/microwave_tool.h @@ -43,10 +43,10 @@ enum class MICROWAVE_FOOTPRINT_SHAPE struct MICROWAVE_INDUCTOR_PATTERN { public: - wxPoint m_Start; - wxPoint m_End; - int m_Length; // full length trace. - int m_Width; // Trace width. + VECTOR2I m_Start; + VECTOR2I m_End; + int m_Length; // full length trace. + int m_Width; // Trace width. }; diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index 0b11981bf0..6d60b69ba2 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -120,10 +120,10 @@ VECTOR2I BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition() else { // Position new components in the center of the page when the board is empty. - wxSize pageSize = m_board->GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ); + VECTOR2I pageSize = m_board->GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ); - bestPosition.x = pageSize.GetWidth() / 2; - bestPosition.y = pageSize.GetHeight() / 2; + bestPosition.x = pageSize.x / 2; + bestPosition.y = pageSize.y / 2; } return bestPosition; diff --git a/pcbnew/pad_custom_shape_functions.cpp b/pcbnew/pad_custom_shape_functions.cpp index 04fbc2ad30..c4b4bd37bd 100644 --- a/pcbnew/pad_custom_shape_functions.cpp +++ b/pcbnew/pad_custom_shape_functions.cpp @@ -125,7 +125,7 @@ void PAD::AddPrimitiveCircle( const VECTOR2I& aCenter, int aRadius, int aThickne PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::CIRCLE ); item->SetFilled( aFilled ); item->SetStart( aCenter ); - item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) ); + item->SetEnd( VECTOR2I( aCenter.x + aRadius, aCenter.y ) ); item->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) ); item->SetParent( this ); m_editPrimitives.emplace_back( item ); @@ -243,7 +243,7 @@ void PAD::MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, ERROR_LOC aE default: case PAD_SHAPE::CIRCLE: - TransformCircleToPolygon( *aMergedPolygon, wxPoint( 0, 0 ), GetSize().x / 2, maxError, + TransformCircleToPolygon( *aMergedPolygon, VECTOR2I( 0, 0 ), GetSize().x / 2, maxError, aErrorLoc ); break; } diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index c3d8aa8089..1ecb47056a 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -235,7 +236,7 @@ void PCB_BASE_FRAME::AddFootprintToBoard( FOOTPRINT* aFootprint ) GetBoard()->Add( aFootprint, ADD_MODE::APPEND ); aFootprint->SetFlags( IS_NEW ); - aFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet + aFootprint->SetPosition( VECTOR2I( 0, 0 ) ); // cursor in GAL may not be initialized yet // Put it on FRONT layer (note that it might be stored flipped if the lib is an archive // built from a board) @@ -367,8 +368,8 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector aItems, PCB_LAYER_ID for( wxWindow* dialog : findDialogs() ) { wxPoint dialogPos = GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ); - SHAPE_POLY_SET dialogPoly( BOX2D( view->ToWorld( dialogPos, true ), - view->ToWorld( dialog->GetSize(), false ) ) ); + SHAPE_POLY_SET dialogPoly( BOX2D( view->ToWorld( ToVECTOR2D( dialogPos ), true ), + view->ToWorld( ToVECTOR2D( dialog->GetSize() ), false ) ) ); try { @@ -581,7 +582,7 @@ const PAGE_INFO& PCB_BASE_FRAME::GetPageSettings() const } -const wxSize PCB_BASE_FRAME::GetPageSizeIU() const +const VECTOR2I PCB_BASE_FRAME::GetPageSizeIU() const { // this function is only needed because EDA_DRAW_FRAME is not compiled // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route @@ -684,7 +685,7 @@ BOX2I PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const if( area.GetWidth() == 0 && area.GetHeight() == 0 ) { - wxSize pageSize = GetPageSizeIU(); + VECTOR2I pageSize = GetPageSizeIU(); if( m_showBorderAndTitleBlock ) { diff --git a/pcbnew/pcb_dimension.h b/pcbnew/pcb_dimension.h index c737f1f7bb..6299607a5b 100644 --- a/pcbnew/pcb_dimension.h +++ b/pcbnew/pcb_dimension.h @@ -192,7 +192,7 @@ public: void SetLayer( PCB_LAYER_ID aLayer ) override; - void SetTextSize( const wxSize& aTextSize ) + void SetTextSize( const VECTOR2I& aTextSize ) { m_text.SetTextSize( aTextSize ); } diff --git a/pcbnew/pcb_screen.cpp b/pcbnew/pcb_screen.cpp index 08c617ba32..fa074ddd88 100644 --- a/pcbnew/pcb_screen.cpp +++ b/pcbnew/pcb_screen.cpp @@ -28,7 +28,7 @@ #include -PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) : +PCB_SCREEN::PCB_SCREEN( const VECTOR2I& aPageSizeIU ) : BASE_SCREEN( aPageSizeIU ) { m_Active_Layer = F_Cu; // default active layer = front layer diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 0d8bdc5ee0..254ec75a4d 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -434,7 +434,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, // Be sure the anchor pad is not bigger than the deflated shape because this // anchor will be added to the pad shape when plotting the pad. So now the // polygonal shape is built, we can clamp the anchor size - dummy.SetSize( wxSize( 0,0 ) ); + dummy.SetSize( VECTOR2I( 0, 0 ) ); itemplotter.PlotPad( &dummy, color, padPlotMode ); } @@ -488,7 +488,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, // Be sure the anchor pad is not bigger than the deflated shape because this // anchor will be added to the pad shape when plotting the pad. // So we set the anchor size to 0 - dummy.SetSize( wxSize( 0,0 ) ); + dummy.SetSize( VECTOR2I( 0, 0 ) ); dummy.SetPosition( pad->GetPosition() ); dummy.SetOrientation( pad->GetOrientation() ); @@ -1008,8 +1008,8 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard, const PAGE_INFO& pageInfo = aBoard->GetPageSettings(); const PAGE_INFO* sheet_info; double paperscale; // Page-to-paper ratio - wxSize paperSizeIU; - wxSize pageSizeIU( pageInfo.GetSizeIU( pcbIUScale.IU_PER_MILS ) ); + VECTOR2I paperSizeIU; + VECTOR2I pageSizeIU( pageInfo.GetSizeIU( pcbIUScale.IU_PER_MILS ) ); bool autocenter = false; // Special options: to fit the sheet to an A4 sheet replace the paper size. However there diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 80403192a4..545cab9642 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -1155,8 +1155,8 @@ void BRDITEMS_PLOTTER::PlotDrillMarks() if( via ) { plotOneDrillMark( PAD_DRILL_SHAPE_CIRCLE, via->GetStart(), - wxSize( via->GetDrillValue(), 0 ), - wxSize( via->GetWidth(), 0 ), ANGLE_0, smallDrill ); + VECTOR2I( via->GetDrillValue(), 0 ), VECTOR2I( via->GetWidth(), 0 ), + ANGLE_0, smallDrill ); } } diff --git a/pcbnew/plugins/altium/altium_parser_pcb.cpp b/pcbnew/plugins/altium/altium_parser_pcb.cpp index 7f838fcc61..c70ffe1e02 100644 --- a/pcbnew/plugins/altium/altium_parser_pcb.cpp +++ b/pcbnew/plugins/altium/altium_parser_pcb.cpp @@ -586,7 +586,7 @@ AARC6::AARC6( ALTIUM_PARSER& aReader ) subpolyindex = aReader.Read(); component = aReader.Read(); aReader.Skip( 4 ); - center = aReader.ReadVector2I(); + center = aReader.ReadVector2IPos(); radius = aReader.ReadKicadUnit(); startangle = aReader.Read(); endangle = aReader.Read(); @@ -706,10 +706,10 @@ APAD6::APAD6( ALTIUM_PARSER& aReader ) component = aReader.Read(); aReader.Skip( 4 ); - position = aReader.ReadVector2I(); - topsize = aReader.ReadWxSize(); - midsize = aReader.ReadWxSize(); - botsize = aReader.ReadWxSize(); + position = aReader.ReadVector2IPos(); + topsize = aReader.ReadVector2ISize(); + midsize = aReader.ReadVector2ISize(); + botsize = aReader.ReadVector2ISize(); holesize = aReader.ReadKicadUnit(); topshape = static_cast( aReader.Read() ); @@ -813,7 +813,7 @@ AVIA6::AVIA6( ALTIUM_PARSER& aReader ) net = aReader.Read(); aReader.Skip( 8 ); - position = aReader.ReadVector2I(); + position = aReader.ReadVector2IPos(); diameter = aReader.ReadKicadUnit(); holesize = aReader.ReadKicadUnit(); @@ -859,8 +859,8 @@ ATRACK6::ATRACK6( ALTIUM_PARSER& aReader ) subpolyindex = aReader.Read(); component = aReader.Read(); aReader.Skip( 4 ); - start = aReader.ReadVector2I(); - end = aReader.ReadVector2I(); + start = aReader.ReadVector2IPos(); + end = aReader.ReadVector2IPos(); width = aReader.ReadKicadUnit(); if( aReader.GetRemainingSubrecordBytes() >= 13 ) @@ -893,7 +893,7 @@ ATEXT6::ATEXT6( ALTIUM_PARSER& aReader, std::map& aStringTab aReader.Skip( 6 ); component = aReader.Read(); aReader.Skip( 4 ); - position = aReader.ReadVector2I(); + position = aReader.ReadVector2IPos(); height = aReader.ReadKicadUnit(); aReader.Skip( 2 ); rotation = aReader.Read(); @@ -963,8 +963,8 @@ AFILL6::AFILL6( ALTIUM_PARSER& aReader ) aReader.Skip( 2 ); component = aReader.Read(); aReader.Skip( 4 ); - pos1 = aReader.ReadVector2I(); - pos2 = aReader.ReadVector2I(); + pos1 = aReader.ReadVector2IPos(); + pos2 = aReader.ReadVector2IPos(); rotation = aReader.Read(); if( aReader.GetRemainingSubrecordBytes() >= 10 ) @@ -1060,8 +1060,8 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices ) if( aExtendedVertices ) { bool isRound = aReader.Read() != 0; - VECTOR2I position = aReader.ReadVector2I(); - VECTOR2I center = aReader.ReadVector2I(); + VECTOR2I position = aReader.ReadVector2IPos(); + VECTOR2I center = aReader.ReadVector2IPos(); int32_t radius = aReader.ReadKicadUnit(); double angle1 = aReader.Read(); double angle2 = aReader.Read(); diff --git a/pcbnew/plugins/altium/altium_parser_pcb.h b/pcbnew/plugins/altium/altium_parser_pcb.h index 031c4a4b2d..dd79ba633e 100644 --- a/pcbnew/plugins/altium/altium_parser_pcb.h +++ b/pcbnew/plugins/altium/altium_parser_pcb.h @@ -600,9 +600,9 @@ struct APAD6 uint16_t component; VECTOR2I position; - wxSize topsize; - wxSize midsize; - wxSize botsize; + VECTOR2I topsize; + VECTOR2I midsize; + VECTOR2I botsize; uint32_t holesize; ALTIUM_PAD_SHAPE topshape; diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index 4398e26610..13ce47a776 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -1316,7 +1316,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) : DIM_UNITS_FORMAT::BARE_SUFFIX ); dimension->Text().SetTextThickness( aElem.textlinewidth ); - dimension->Text().SetTextSize( wxSize( aElem.textheight, aElem.textheight ) ); + dimension->Text().SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) ); dimension->Text().SetItalic( aElem.textitalic ); #if 0 // we don't currently support bold; map to thicker text @@ -1403,7 +1403,7 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem) dimension->Text().SetPosition( aElem.textPoint.at( 0 ) ); dimension->Text().SetTextThickness( aElem.textlinewidth ); - dimension->Text().SetTextSize( wxSize( aElem.textheight, aElem.textheight ) ); + dimension->Text().SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) ); dimension->Text().SetItalic( aElem.textitalic ); #if 0 // we don't currently support bold; map to thicker text @@ -1495,7 +1495,7 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem ) text->SetText( aElem.textformat ); text->SetPosition( aElem.textPoint.at( 0 ) ); text->SetLayer( klayer ); - text->SetTextSize( wxSize( aElem.textheight, aElem.textheight ) ); // TODO: parse text width + text->SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) ); // TODO: parse text width text->SetTextThickness( aElem.textlinewidth ); text->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); text->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); @@ -2449,7 +2449,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con if( !aElem.sizeAndShape || aElem.sizeAndShape->holeshape == ALTIUM_PAD_HOLE_SHAPE::ROUND ) { pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); - pad->SetDrillSize( wxSize( aElem.holesize, aElem.holesize ) ); + pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); } else { @@ -2465,7 +2465,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con aElem.name ); pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); - pad->SetDrillSize( wxSize( aElem.holesize, aElem.holesize ) ); // Workaround + pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); // Workaround // TODO: elem.sizeAndShape->slotsize was 0 in testfile. Either use holesize in // this case or rect holes have a different id break; @@ -2479,11 +2479,11 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con if( slotRotation.IsHorizontal() ) { - pad->SetDrillSize( wxSize( aElem.sizeAndShape->slotsize, aElem.holesize ) ); + pad->SetDrillSize( VECTOR2I( aElem.sizeAndShape->slotsize, aElem.holesize ) ); } else if( slotRotation.IsVertical() ) { - pad->SetDrillSize( wxSize( aElem.holesize, aElem.sizeAndShape->slotsize ) ); + pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.sizeAndShape->slotsize ) ); } else { @@ -2505,7 +2505,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con aElem.sizeAndShape->holeshape ); pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); - pad->SetDrillSize( wxSize( aElem.holesize, aElem.holesize ) ); // Workaround + pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); // Workaround break; } } @@ -3180,11 +3180,11 @@ void ALTIUM_PCB::ConvertTexts6ToEdaTextSettings( const ATEXT6& aElem, EDA_TEXT* if( aElem.fonttype == ALTIUM_TEXT_TYPE::TRUETYPE ) { // TODO: why is this required? Somehow, truetype size is calculated differently - aEdaText->SetTextSize( wxSize( aElem.height / 2, aElem.height / 2 ) ); + aEdaText->SetTextSize( VECTOR2I( aElem.height / 2, aElem.height / 2 ) ); } else { - aEdaText->SetTextSize( wxSize( aElem.height, aElem.height ) ); // TODO: parse text width + aEdaText->SetTextSize( VECTOR2I( aElem.height, aElem.height ) ); // TODO: parse text width } aEdaText->SetTextThickness( aElem.strokewidth ); diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 531ea312f1..3f2d162bfd 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -1189,7 +1189,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, if( editedPadOutline.Contains( { 0, 0 } ) ) { pad->SetAnchorPadShape( PAD_SHAPE::RECT ); - pad->SetSize( wxSize( { 4, 4 } ) ); + pad->SetSize( VECTOR2I( { 4, 4 } ) ); pad->SetShape( PAD_SHAPE::CUSTOM ); pad->AddPrimitive( padShape ); padOffset = { 0, 0 }; diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp index 872f27600f..c48aede3df 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp @@ -1596,7 +1596,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::SYMDEF_PCB::Parse( XNODE* aNode, PARSER_CONTEXT } } - if( !Stub && !Origin.IsFullySpecified() ) + if( !Stub && ( Origin.x == UNDEFINED_VALUE || Origin.y == UNDEFINED_VALUE ) ) THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() ); } diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 4510fe19dd..2885904e06 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -275,11 +275,11 @@ void EAGLE_PLUGIN::checkpoint() } -wxSize inline EAGLE_PLUGIN::kicad_fontz( const ECOORD& d, int aTextThickness ) const +VECTOR2I inline EAGLE_PLUGIN::kicad_fontsize( const ECOORD& d, int aTextThickness ) const { // Eagle includes stroke thickness in the text size, KiCAD does not int kz = d.ToPcbUnits(); - return wxSize( kz - aTextThickness, kz - aTextThickness ); + return VECTOR2I( kz - aTextThickness, kz - aTextThickness ); } @@ -693,7 +693,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default int textThickness = KiROUND( t.size.ToPcbUnits() * ratio / 100 ); pcbtxt->SetTextThickness( textThickness ); - pcbtxt->SetTextSize( kicad_fontz( t.size, textThickness ) ); + pcbtxt->SetTextSize( kicad_fontsize( t.size, textThickness ) ); int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; @@ -931,14 +931,14 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) VECTOR2I pt1( kicad_x( d.x1 ), kicad_y( d.y1 ) ); VECTOR2I pt2( kicad_x( d.x2 ), kicad_y( d.y2 ) ); VECTOR2I pt3( kicad_x( d.x3 ), kicad_y( d.y3 ) ); - wxSize textSize = designSettings.GetTextSize( layer ); + VECTOR2I textSize = designSettings.GetTextSize( layer ); int textThickness = designSettings.GetLineThickness( layer ); if( d.textsize ) { double ratio = 8; // DTD says 8 is default textThickness = KiROUND( d.textsize->ToPcbUnits() * ratio / 100 ); - textSize = kicad_fontz( *d.textsize, textThickness ); + textSize = kicad_fontsize( *d.textsize, textThickness ); } if( layer != UNDEFINED_LAYER ) @@ -1609,7 +1609,7 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE aFPText->SetTextThickness( textThickness ); if( a.size ) { - fontz = kicad_fontz( *a.size, textThickness ); + fontz = kicad_fontsize( *a.size, textThickness ); aFPText->SetTextSize( fontz ); } @@ -1864,7 +1864,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ) else if( aFootprint->GetLayer() == B_Cu && m_rules->psBottom != EPAD::UNDEF ) shape = m_rules->psBottom; - pad->SetDrillSize( wxSize( eagleDrillz, eagleDrillz ) ); + pad->SetDrillSize( VECTOR2I( eagleDrillz, eagleDrillz ) ); pad->SetLayerSet( LSET::AllCuMask() ); if( eagleDrillz < m_min_hole ) @@ -1912,7 +1912,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ) if( e.diameter && e.diameter->value > 0 ) { int diameter = e.diameter->ToPcbUnits(); - pad->SetSize( wxSize( diameter, diameter ) ); + pad->SetSize( VECTOR2I( diameter, diameter ) ); } else { @@ -1920,7 +1920,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ) double annulus = drillz * m_rules->rvPadTop; // copper annulus, eagle "restring" annulus = eagleClamp( m_rules->rlMinPadTop, annulus, m_rules->rlMaxPadTop ); int diameter = KiROUND( drillz + 2 * annulus ); - pad->SetSize( wxSize( KiROUND( diameter ), KiROUND( diameter ) ) ); + pad->SetSize( VECTOR2I( KiROUND( diameter ), KiROUND( diameter ) ) ); } if( pad->GetShape() == PAD_SHAPE::OVAL ) @@ -1998,7 +1998,7 @@ void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const int textThickness = KiROUND( t.size.ToPcbUnits() * ratio / 100 ); textItem->SetTextThickness( textThickness ); - textItem->SetTextSize( kicad_fontz( t.size, textThickness ) ); + textItem->SetTextSize( kicad_fontsize( t.size, textThickness ) ); int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default @@ -2371,7 +2371,7 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC pad->SetPosition( padpos + aFootprint->GetPosition() ); } - wxSize sz( e.drill.ToPcbUnits(), e.drill.ToPcbUnits() ); + VECTOR2I sz( e.drill.ToPcbUnits(), e.drill.ToPcbUnits() ); pad->SetDrillSize( sz ); pad->SetSize( sz ); @@ -2397,7 +2397,7 @@ void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const pad->SetShape( PAD_SHAPE::RECT ); pad->SetAttribute( PAD_ATTRIB::SMD ); - wxSize padSize( e.dx.ToPcbUnits(), e.dy.ToPcbUnits() ); + VECTOR2I padSize( e.dx.ToPcbUnits(), e.dy.ToPcbUnits() ); pad->SetSize( padSize ); pad->SetLayer( layer ); diff --git a/pcbnew/plugins/eagle/eagle_plugin.h b/pcbnew/plugins/eagle/eagle_plugin.h index f396b03964..420741ae0c 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.h +++ b/pcbnew/plugins/eagle/eagle_plugin.h @@ -189,7 +189,7 @@ private: int kicad_x( const ECOORD& x ) const { return x.ToPcbUnits(); } /// create a font size (fontz) from an eagle font size scalar and KiCad font thickness - wxSize kicad_fontz( const ECOORD& d, int aTextThickness ) const; + VECTOR2I kicad_fontsize( const ECOORD& d, int aTextThickness ) const; /** * Generate mapping between Eagle and KiCad layers. diff --git a/pcbnew/plugins/fabmaster/import_fabmaster.cpp b/pcbnew/plugins/fabmaster/import_fabmaster.cpp index 1c5403d1c8..f8df9c0e6d 100644 --- a/pcbnew/plugins/fabmaster/import_fabmaster.cpp +++ b/pcbnew/plugins/fabmaster/import_fabmaster.cpp @@ -1999,7 +1999,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) fpID.Parse( key, true ); fp->SetFPID( fpID ); - fp->SetPosition( wxPoint( src->x, src->y ) ); + fp->SetPosition( VECTOR2I( src->x, src->y ) ); fp->SetOrientationDegrees( -src->rotate ); // KiCad netlisting requires parts to have non-digit + digit annotation. @@ -2039,12 +2039,12 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) if( src->mirror ) { txt->SetLayer( FlipLayer( layer ) ); - txt->SetTextPos( wxPoint( lsrc->start_x, 2 * src->y - ( lsrc->start_y - lsrc->height / 2 ) ) ); + txt->SetTextPos( VECTOR2I( lsrc->start_x, 2 * src->y - ( lsrc->start_y - lsrc->height / 2 ) ) ); } else { txt->SetLayer( layer ); - txt->SetTextPos( wxPoint( lsrc->start_x, lsrc->start_y - lsrc->height / 2 ) ); + txt->SetTextPos( VECTOR2I( lsrc->start_x, lsrc->start_y - lsrc->height / 2 ) ); } txt->SetText( lsrc->text ); @@ -2097,14 +2097,14 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) if( src->mirror ) { line->SetLayer( FlipLayer( layer ) ); - line->SetStart( wxPoint( lsrc->start_x, 2 * src->y - lsrc->start_y ) ); - line->SetEnd( wxPoint( lsrc->end_x, 2 * src->y - lsrc->end_y ) ); + line->SetStart( VECTOR2I( lsrc->start_x, 2 * src->y - lsrc->start_y ) ); + line->SetEnd( VECTOR2I( lsrc->end_x, 2 * src->y - lsrc->end_y ) ); } else { line->SetLayer( layer ); - line->SetStart( wxPoint( lsrc->start_x, lsrc->start_y ) ); - line->SetEnd( wxPoint( lsrc->end_x, lsrc->end_y ) ); + line->SetStart( VECTOR2I( lsrc->start_x, lsrc->start_y ) ); + line->SetEnd( VECTOR2I( lsrc->end_x, lsrc->end_y ) ); } line->SetStroke( STROKE_PARAMS( lsrc->width, PLOT_DASH_TYPE::SOLID ) ); @@ -2123,8 +2123,8 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) FP_SHAPE* circle = new FP_SHAPE( fp, SHAPE_T::CIRCLE ); circle->SetLayer( layer ); - circle->SetCenter( wxPoint( lsrc->center_x, lsrc->center_y ) ); - circle->SetEnd( wxPoint( lsrc->end_x, lsrc->end_y ) ); + circle->SetCenter( VECTOR2I( lsrc->center_x, lsrc->center_y ) ); + circle->SetEnd( VECTOR2I( lsrc->end_x, lsrc->end_y ) ); circle->SetWidth( lsrc->width ); circle->SetLocalCoord(); @@ -2169,14 +2169,14 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) if( src->mirror ) { rect->SetLayer( FlipLayer( layer ) ); - rect->SetStart( wxPoint( lsrc->start_x, 2 * src->y - lsrc->start_y ) ); - rect->SetEnd( wxPoint( lsrc->end_x, 2 * src->y - lsrc->end_y ) ); + rect->SetStart( VECTOR2I( lsrc->start_x, 2 * src->y - lsrc->start_y ) ); + rect->SetEnd( VECTOR2I( lsrc->end_x, 2 * src->y - lsrc->end_y ) ); } else { rect->SetLayer( layer ); - rect->SetStart( wxPoint( lsrc->start_x, lsrc->start_y ) ); - rect->SetEnd( wxPoint( lsrc->end_x, lsrc->end_y ) ); + rect->SetStart( VECTOR2I( lsrc->start_x, lsrc->start_y ) ); + rect->SetEnd( VECTOR2I( lsrc->end_x, lsrc->end_y ) ); } rect->SetStroke( defaultStroke ); @@ -2195,12 +2195,12 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) if( src->mirror ) { txt->SetLayer( FlipLayer( layer ) ); - txt->SetTextPos( wxPoint( lsrc->start_x, 2 * src->y - ( lsrc->start_y - lsrc->height / 2 ) ) ); + txt->SetTextPos( VECTOR2I( lsrc->start_x, 2 * src->y - ( lsrc->start_y - lsrc->height / 2 ) ) ); } else { txt->SetLayer( layer ); - txt->SetTextPos( wxPoint( lsrc->start_x, lsrc->start_y - lsrc->height / 2 ) ); + txt->SetTextPos( VECTOR2I( lsrc->start_x, lsrc->start_y - lsrc->height / 2 ) ); } txt->SetText( lsrc->text ); @@ -2274,7 +2274,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) // is fully hidden by the custom pad int pad_size = std::min( pad.width, pad.height ); - newpad->SetSize( wxSize( pad_size / 2, pad_size / 2 ) ); + newpad->SetSize( VECTOR2I( pad_size / 2, pad_size / 2 ) ); std::string custom_name = pad.custom_name + "_" + pin->refdes + "_" + pin->pin_number; auto custom_it = pad_shapes.find( custom_name ); @@ -2371,7 +2371,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) } } else - newpad->SetSize( wxSize( pad.width, pad.height ) ); + newpad->SetSize( VECTOR2I( pad.width, pad.height ) ); if( pad.drill ) { @@ -2391,7 +2391,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) else newpad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); - newpad->SetDrillSize( wxSize( pad.drill_size_x, pad.drill_size_y ) ); + newpad->SetDrillSize( VECTOR2I( pad.drill_size_x, pad.drill_size_y ) ); } else { @@ -2481,7 +2481,7 @@ bool FABMASTER::loadVias( BOARD* aBoard ) PCB_VIA* new_via = new PCB_VIA( aBoard ); - new_via->SetPosition( wxPoint( via->x, via->y ) ); + new_via->SetPosition( VECTOR2I( via->x, via->y ) ); if( net_it != netinfo.end() ) new_via->SetNet( net_it->second ); @@ -2549,8 +2549,8 @@ bool FABMASTER::loadEtch( BOARD* aBoard, const std::unique_ptr PCB_TRACK* trk = new PCB_TRACK( aBoard ); trk->SetLayer( layer ); - trk->SetStart( wxPoint( src->start_x, src->start_y ) ); - trk->SetEnd( wxPoint( src->end_x, src->end_y ) ); + trk->SetStart( VECTOR2I( src->start_x, src->start_y ) ); + trk->SetEnd( VECTOR2I( src->end_x, src->end_y ) ); trk->SetWidth( src->width ); if( net_it != netinfo.end() ) @@ -2790,8 +2790,8 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptrSetLayer( layer ); - line->SetStart( wxPoint( src->start_x, src->start_y ) ); - line->SetEnd( wxPoint( src->end_x, src->end_y ) ); + line->SetStart( VECTOR2I( src->start_x, src->start_y ) ); + line->SetEnd( VECTOR2I( src->end_x, src->end_y ) ); line->SetStroke( STROKE_PARAMS( src->width, PLOT_DASH_TYPE::SOLID ) ); if( line->GetWidth() == 0 ) @@ -2807,8 +2807,8 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptrSetLayer( layer ); - circle->SetCenter( wxPoint( lsrc->center_x, lsrc->center_y ) ); - circle->SetEnd( wxPoint( lsrc->end_x, lsrc->end_y ) ); + circle->SetCenter( VECTOR2I( lsrc->center_x, lsrc->center_y ) ); + circle->SetEnd( VECTOR2I( lsrc->end_x, lsrc->end_y ) ); circle->SetWidth( lsrc->width ); if( lsrc->width == 0 ) @@ -2841,8 +2841,8 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptrSetLayer( layer ); - rect->SetStart( wxPoint( src->start_x, src->start_y ) ); - rect->SetEnd( wxPoint( src->end_x, src->end_y ) ); + rect->SetStart( VECTOR2I( src->start_x, src->start_y ) ); + rect->SetEnd( VECTOR2I( src->end_x, src->end_y ) ); rect->SetStroke( defaultStroke ); aBoard->Add( rect, ADD_MODE::APPEND ); @@ -2854,7 +2854,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptrSetLayer( layer ); - txt->SetTextPos( wxPoint( src->start_x, src->start_y - src->height / 2 ) ); + txt->SetTextPos( VECTOR2I( src->start_x, src->start_y - src->height / 2 ) ); txt->SetText( src->text ); txt->SetItalic( src->ital ); txt->SetTextThickness( src->thickness ); @@ -2925,8 +2925,8 @@ bool FABMASTER::loadGraphics( BOARD* aBoard ) PCB_SHAPE* line = new PCB_SHAPE( aBoard, SHAPE_T::SEGMENT ); line->SetLayer( layer ); - line->SetStart( wxPoint( src->start_x, src->start_y ) ); - line->SetEnd( wxPoint( src->end_x, src->end_y ) ); + line->SetStart( VECTOR2I( src->start_x, src->start_y ) ); + line->SetEnd( VECTOR2I( src->end_x, src->end_y ) ); line->SetStroke( STROKE_PARAMS( src->width, PLOT_DASH_TYPE::SOLID ) ); aBoard->Add( line, ADD_MODE::APPEND ); @@ -2939,8 +2939,8 @@ bool FABMASTER::loadGraphics( BOARD* aBoard ) PCB_SHAPE* circle = new PCB_SHAPE( aBoard, SHAPE_T::CIRCLE ); circle->SetLayer( layer ); - circle->SetCenter( wxPoint( src->center_x, src->center_y ) ); - circle->SetEnd( wxPoint( src->end_x, src->end_y ) ); + circle->SetCenter( VECTOR2I( src->center_x, src->center_y ) ); + circle->SetEnd( VECTOR2I( src->end_x, src->end_y ) ); circle->SetWidth( src->width ); aBoard->Add( circle, ADD_MODE::APPEND ); @@ -2967,8 +2967,8 @@ bool FABMASTER::loadGraphics( BOARD* aBoard ) PCB_SHAPE* rect = new PCB_SHAPE( aBoard, SHAPE_T::RECT ); rect->SetLayer( layer ); - rect->SetStart( wxPoint( src->start_x, src->start_y ) ); - rect->SetEnd( wxPoint( src->end_x, src->end_y ) ); + rect->SetStart( VECTOR2I( src->start_x, src->start_y ) ); + rect->SetEnd( VECTOR2I( src->end_x, src->end_y ) ); rect->SetStroke( STROKE_PARAMS( 0 ) ); rect->SetFilled( true ); aBoard->Add( rect, ADD_MODE::APPEND ); @@ -2981,7 +2981,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard ) PCB_TEXT* txt = new PCB_TEXT( aBoard ); txt->SetLayer( layer ); - txt->SetTextPos( wxPoint( src->start_x, src->start_y - src->height / 2 ) ); + txt->SetTextPos( VECTOR2I( src->start_x, src->start_y - src->height / 2 ) ); txt->SetText( src->text ); txt->SetItalic( src->ital ); txt->SetTextThickness( src->thickness ); diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index a41af4292c..ee17211f06 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -415,7 +415,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) footprint->Reference().SetTextPos( textPos ); footprint->Reference().SetPos0( textPos ); - footprint->Reference().SetTextSize( wxSize( twsize, thsize ) ); + footprint->Reference().SetTextSize( VECTOR2I( twsize, thsize ) ); footprint->Reference().SetTextThickness( thickness ); // gEDA/pcb shows only one of value/reference/description at a time. Which @@ -592,7 +592,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) VECTOR2I padPos( ( x1 + x2 ) / 2, ( y1 + y2 ) / 2 ); - pad->SetSize( wxSize( KiROUND( EuclideanNorm( delta ) ) + width, width ) ); + pad->SetSize( VECTOR2I( KiROUND( EuclideanNorm( delta ) ) + width, width ) ); // Set the relative position before adjusting the absolute position pad->SetPos0( padPos ); @@ -657,7 +657,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) int padSize = parseInt( parameters[4], conv_unit ); - pad->SetSize( wxSize( padSize, padSize ) ); + pad->SetSize( VECTOR2I( padSize, padSize ) ); int drillSize = 0; @@ -684,7 +684,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) drillSize = parseInt( parameters[5], conv_unit ); } - pad->SetDrillSize( wxSize( drillSize, drillSize ) ); + pad->SetDrillSize( VECTOR2I( drillSize, drillSize ) ); // Set the relative position before adjusting the absolute position pad->SetPos0( padPos ); diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index b367a8d8c1..a6dd1d2b76 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -425,9 +425,9 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText ) case T_size: { - wxSize sz; - sz.SetHeight( parseBoardUnits( "text height" ) ); - sz.SetWidth( parseBoardUnits( "text width" ) ); + VECTOR2I sz; + sz.y = parseBoardUnits( "text height" ); + sz.x = parseBoardUnits( "text width" ); aText->SetTextSize( sz ); NeedRIGHT(); @@ -517,7 +517,7 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText ) { const double defaultTextSize = 1.524 * pcbIUScale.IU_PER_MM; - aText->SetTextSize( wxSize( defaultTextSize, defaultTextSize ) ); + aText->SetTextSize( VECTOR2I( defaultTextSize, defaultTextSize ) ); } } @@ -2074,9 +2074,9 @@ void PCB_PARSER::parseSetup() case T_pad_size: { - wxSize sz; - sz.SetWidth( parseBoardUnits( "master pad width" ) ); - sz.SetHeight( parseBoardUnits( "master pad height" ) ); + VECTOR2I sz; + sz.x = parseBoardUnits( "master pad width" ); + sz.y = parseBoardUnits( "master pad height" ); bds.m_Pad_Master->SetSize( sz ); m_board->m_LegacyDesignSettingsLoaded = true; NeedRIGHT(); @@ -2086,7 +2086,7 @@ void PCB_PARSER::parseSetup() case T_pad_drill: { int drillSize = parseBoardUnits( T_pad_drill ); - bds.m_Pad_Master->SetDrillSize( wxSize( drillSize, drillSize ) ); + bds.m_Pad_Master->SetDrillSize( VECTOR2I( drillSize, drillSize ) ); m_board->m_LegacyDesignSettingsLoaded = true; NeedRIGHT(); break; @@ -4697,9 +4697,9 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) case T_rect_delta: { - wxSize delta; - delta.SetWidth( parseBoardUnits( "rectangle delta width" ) ); - delta.SetHeight( parseBoardUnits( "rectangle delta height" ) ); + VECTOR2I delta; + delta.x = parseBoardUnits( "rectangle delta width" ); + delta.y = parseBoardUnits( "rectangle delta height" ); pad->SetDelta( delta ); NeedRIGHT(); break; @@ -4757,7 +4757,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) && ( pad->GetAttribute() != PAD_ATTRIB::CONN ) ) pad->SetDrillSize( drillSize ); else - pad->SetDrillSize( wxSize( 0, 0 ) ); + pad->SetDrillSize( VECTOR2I( 0, 0 ) ); break; } diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index b8a8bfcfe0..975d1eaee6 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -999,7 +999,7 @@ void LEGACY_PLUGIN::loadSETUP() BIU x = biuParse( line + SZ( "TextPcbSize" ), &data ); BIU y = biuParse( data ); - bds.m_TextSize[ LAYER_CLASS_COPPER ] = wxSize( x, y ); + bds.m_TextSize[ LAYER_CLASS_COPPER ] = VECTOR2I( x, y ); } else if( TESTLINE( "EdgeModWidth" ) ) { @@ -1018,20 +1018,20 @@ void LEGACY_PLUGIN::loadSETUP() BIU x = biuParse( line + SZ( "TextModSize" ), &data ); BIU y = biuParse( data ); - bds.m_TextSize[ LAYER_CLASS_SILK ] = wxSize( x, y ); - bds.m_TextSize[ LAYER_CLASS_OTHERS ] = wxSize( x, y ); + bds.m_TextSize[LAYER_CLASS_SILK] = VECTOR2I( x, y ); + bds.m_TextSize[LAYER_CLASS_OTHERS] = VECTOR2I( x, y ); } else if( TESTLINE( "PadSize" ) ) { BIU x = biuParse( line + SZ( "PadSize" ), &data ); BIU y = biuParse( data ); - bds.m_Pad_Master->SetSize( wxSize( x, y ) ); + bds.m_Pad_Master->SetSize( VECTOR2I( x, y ) ); } else if( TESTLINE( "PadDrill" ) ) { BIU tmp = biuParse( line + SZ( "PadDrill" ) ); - bds.m_Pad_Master->SetDrillSize( wxSize( tmp, tmp ) ); + bds.m_Pad_Master->SetDrillSize( VECTOR2I( tmp, tmp ) ); } else if( TESTLINE( "Pad2MaskClearance" ) ) { @@ -1372,8 +1372,8 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) pad->SetNumber( padNumber ); pad->SetShape( static_cast( padshape ) ); - pad->SetSize( wxSize( size_x, size_y ) ); - pad->SetDelta( wxSize( delta_x, delta_y ) ); + pad->SetSize( VECTOR2I( size_x, size_y ) ); + pad->SetDelta( VECTOR2I( delta_x, delta_y ) ); pad->SetOrientation( orient ); } else if( TESTLINE( "Dr" ) ) // (Dr)ill @@ -1404,7 +1404,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) pad->SetDrillShape( drShape ); pad->SetOffset( VECTOR2I( offs_x, offs_y ) ); - pad->SetDrillSize( wxSize( drill_x, drill_y ) ); + pad->SetDrillSize( VECTOR2I( drill_x, drill_y ) ); } else if( TESTLINE( "At" ) ) // (At)tribute { @@ -1710,7 +1710,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText ) aText->SetType( static_cast( type ) ); aText->SetPos0( VECTOR2I( pos0_x, pos0_y ) ); - aText->SetTextSize( wxSize( size0_x, size0_y ) ); + aText->SetTextSize( VECTOR2I( size0_x, size0_y ) ); orient -= ( static_cast( aText->GetParentFootprint() ) )->GetOrientation(); @@ -2024,7 +2024,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT() } else if( TESTLINE( "Po" ) ) { - wxSize size; + VECTOR2I size; BIU pos_x = biuParse( line + SZ( "Po" ), &data ); BIU pos_y = biuParse( data, &data ); @@ -2675,7 +2675,7 @@ void LEGACY_PLUGIN::loadDIMENSION() char* mirror = strtok_r( (char*) data, delims, (char**) &data ); dim->Text().SetTextPos( VECTOR2I( pos_x, pos_y ) ); - dim->Text().SetTextSize( wxSize( width, height ) ); + dim->Text().SetTextSize( VECTOR2I( width, height ) ); dim->Text().SetMirrored( mirror && *mirror == '0' ); dim->Text().SetTextThickness( thickn ); dim->Text().SetTextAngle( orient ); diff --git a/pcbnew/plugins/pcad/pcad2kicad_common.cpp b/pcbnew/plugins/pcad/pcad2kicad_common.cpp index 49199fc8e2..ad7a78c7a8 100644 --- a/pcbnew/plugins/pcad/pcad2kicad_common.cpp +++ b/pcbnew/plugins/pcad/pcad2kicad_common.cpp @@ -543,15 +543,15 @@ void CorrectTextPosition( TTEXTVALUE* aValue ) void SetTextSizeFromStrokeFontHeight( EDA_TEXT* aText, int aTextHeight ) { - aText->SetTextSize( wxSize( KiROUND( aTextHeight * STROKE_WIDTH_TO_SIZE ), - KiROUND( aTextHeight * STROKE_HEIGHT_TO_SIZE ) ) ); + aText->SetTextSize( VECTOR2I( KiROUND( aTextHeight * STROKE_WIDTH_TO_SIZE ), + KiROUND( aTextHeight * STROKE_HEIGHT_TO_SIZE ) ) ); } void SetTextSizeFromTrueTypeFontHeight( EDA_TEXT* aText, int aTextHeight ) { - aText->SetTextSize( wxSize( KiROUND( aTextHeight * TRUETYPE_WIDTH_TO_SIZE ), - KiROUND( aTextHeight * TRUETYPE_HEIGHT_TO_SIZE ) ) ); + aText->SetTextSize( VECTOR2I( KiROUND( aTextHeight * TRUETYPE_WIDTH_TO_SIZE ), + KiROUND( aTextHeight * TRUETYPE_HEIGHT_TO_SIZE ) ) ); } diff --git a/pcbnew/plugins/pcad/pcb_cutout.cpp b/pcbnew/plugins/pcad/pcb_cutout.cpp index edff2a527b..aa99ab2ee8 100644 --- a/pcbnew/plugins/pcad/pcb_cutout.cpp +++ b/pcbnew/plugins/pcad/pcb_cutout.cpp @@ -31,6 +31,7 @@ #include +#include #include namespace PCAD2KICAD { diff --git a/pcbnew/plugins/pcad/pcb_pad.cpp b/pcbnew/plugins/pcad/pcb_pad.cpp index 3311a1772a..c31cce7d0b 100644 --- a/pcbnew/plugins/pcad/pcb_pad.cpp +++ b/pcbnew/plugins/pcad/pcb_pad.cpp @@ -210,8 +210,8 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation, pad->SetAttribute( PAD_ATTRIB::NPTH ); pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); - pad->SetDrillSize( wxSize( m_Hole, m_Hole ) ); - pad->SetSize( wxSize( m_Hole, m_Hole ) ); + pad->SetDrillSize( VECTOR2I( m_Hole, m_Hole ) ); + pad->SetSize( VECTOR2I( m_Hole, m_Hole ) ); // Mounting Hole: Solder Mask Margin from Top Layer Width size. // Used the default zone clearance (simplify) diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 38a19a95d2..870c954e4e 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1789,9 +1789,9 @@ void PNS_KICAD_IFACE::UpdateItem( PNS::ITEM* aItem ) PNS::ARC* arc = static_cast( aItem ); PCB_ARC* arc_board = static_cast( board_item ); const SHAPE_ARC* arc_shape = static_cast( arc->Shape() ); - arc_board->SetStart( wxPoint( arc_shape->GetP0() ) ); - arc_board->SetEnd( wxPoint( arc_shape->GetP1() ) ); - arc_board->SetMid( wxPoint( arc_shape->GetArcMid() ) ); + arc_board->SetStart( VECTOR2I( arc_shape->GetP0() ) ); + arc_board->SetEnd( VECTOR2I( arc_shape->GetP1() ) ); + arc_board->SetMid( VECTOR2I( arc_shape->GetArcMid() ) ); arc_board->SetWidth( arc->Width() ); break; } @@ -1801,8 +1801,8 @@ void PNS_KICAD_IFACE::UpdateItem( PNS::ITEM* aItem ) PNS::SEGMENT* seg = static_cast( aItem ); PCB_TRACK* track = static_cast( board_item ); const SEG& s = seg->Seg(); - track->SetStart( wxPoint( s.A.x, s.A.y ) ); - track->SetEnd( wxPoint( s.B.x, s.B.y ) ); + track->SetStart( VECTOR2I( s.A.x, s.A.y ) ); + track->SetEnd( VECTOR2I( s.B.x, s.B.y ) ); track->SetWidth( seg->Width() ); break; } @@ -1811,7 +1811,7 @@ void PNS_KICAD_IFACE::UpdateItem( PNS::ITEM* aItem ) { PCB_VIA* via_board = static_cast( board_item ); PNS::VIA* via = static_cast( aItem ); - via_board->SetPosition( wxPoint( via->Pos().x, via->Pos().y ) ); + via_board->SetPosition( VECTOR2I( via->Pos().x, via->Pos().y ) ); via_board->SetWidth( via->Diameter() ); via_board->SetDrill( via->Drill() ); via_board->SetNetCode( via->Net() > 0 ? via->Net() : 0 ); @@ -1866,8 +1866,8 @@ void PNS_KICAD_IFACE::AddItem( PNS::ITEM* aItem ) PNS::SEGMENT* seg = static_cast( aItem ); PCB_TRACK* track = new PCB_TRACK( m_board ); const SEG& s = seg->Seg(); - track->SetStart( wxPoint( s.A.x, s.A.y ) ); - track->SetEnd( wxPoint( s.B.x, s.B.y ) ); + track->SetStart( VECTOR2I( s.A.x, s.A.y ) ); + track->SetEnd( VECTOR2I( s.B.x, s.B.y ) ); track->SetWidth( seg->Width() ); track->SetLayer( ToLAYER_ID( seg->Layers().Start() ) ); track->SetNetCode( seg->Net() > 0 ? seg->Net() : 0 ); @@ -1879,7 +1879,7 @@ void PNS_KICAD_IFACE::AddItem( PNS::ITEM* aItem ) { PCB_VIA* via_board = new PCB_VIA( m_board ); PNS::VIA* via = static_cast( aItem ); - via_board->SetPosition( wxPoint( via->Pos().x, via->Pos().y ) ); + via_board->SetPosition( VECTOR2I( via->Pos().x, via->Pos().y ) ); via_board->SetWidth( via->Diameter() ); via_board->SetDrill( via->Drill() ); via_board->SetNetCode( via->Net() > 0 ? via->Net() : 0 ); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 223ada6c8e..1254432155 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -41,6 +41,7 @@ using namespace std::placeholders; #include #include #include +#include #include #include #include @@ -978,7 +979,7 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) // ask the user for a target layer if( selectLayer ) { - wxPoint endPoint = (wxPoint) view()->ToScreen( m_endSnapPoint ); + wxPoint endPoint = ToWxPoint( view()->ToScreen( m_endSnapPoint ) ); endPoint = frame()->GetCanvas()->ClientToScreen( endPoint ); // Build the list of not allowed layer for the target layer diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 72cdf6f0dd..9dda497113 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -689,7 +689,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) EDA_ANGLE angle = pad->GetOrientation() - aFootprint->GetOrientation(); pin->SetRotation( angle.Normalize().AsDegrees() ); - wxPoint pos( pad->GetPos0() ); + VECTOR2I pos( pad->GetPos0() ); pin->SetVertex( mapPt( pos ) ); } @@ -1039,12 +1039,12 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) for( int ii = 0; ii < outline.PointCount(); ii++ ) { - wxPoint pos( outline.CPoint( ii ).x, outline.CPoint( ii ).y ); + VECTOR2I pos( outline.CPoint( ii ).x, outline.CPoint( ii ).y ); path->AppendPoint( mapPt( pos ) ); } // Close polygon: - wxPoint pos0( outline.CPoint( 0 ).x, outline.CPoint( 0 ).y ); + VECTOR2I pos0( outline.CPoint( 0 ).x, outline.CPoint( 0 ).y ); path->AppendPoint( mapPt( pos0 ) ); // Generate holes as keepout: @@ -1062,12 +1062,12 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) for( int jj = 0; jj < hole.PointCount(); jj++ ) { - wxPoint pos( hole.CPoint( jj ).x, hole.CPoint( jj ).y ); + VECTOR2I pos( hole.CPoint( jj ).x, hole.CPoint( jj ).y ); poly_ko->AppendPoint( mapPt( pos ) ); } // Close polygon: - wxPoint pos( hole.CPoint( 0 ).x, hole.CPoint( 0 ).y ); + VECTOR2I pos( hole.CPoint( 0 ).x, hole.CPoint( 0 ).y ); poly_ko->AppendPoint( mapPt( pos ) ); } } @@ -1260,12 +1260,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // Handle the main outlines SHAPE_POLY_SET::ITERATOR iterator; - wxPoint startpoint; + VECTOR2I startpoint; bool is_first_point = true; for( iterator = zone->IterateWithHoles(); iterator; iterator++ ) { - wxPoint point( iterator->x, iterator->y ); + VECTOR2I point( iterator->x, iterator->y ); if( is_first_point ) { @@ -1310,7 +1310,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) wxASSERT( window ); wxASSERT( cutout ); - wxPoint point(iterator->x, iterator->y ); + VECTOR2I point( iterator->x, iterator->y ); if( is_first_point ) { @@ -1370,12 +1370,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // Handle the main outlines SHAPE_POLY_SET::ITERATOR iterator; - bool is_first_point = true; - wxPoint startpoint; + bool is_first_point = true; + VECTOR2I startpoint; for( iterator = zone->IterateWithHoles(); iterator; iterator++ ) { - wxPoint point( iterator->x, iterator->y ); + VECTOR2I point( iterator->x, iterator->y ); if( is_first_point ) { @@ -1417,7 +1417,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) wxASSERT( window ); wxASSERT( cutout ); - wxPoint point(iterator->x, iterator->y ); + VECTOR2I point( iterator->x, iterator->y ); if( is_first_point ) { diff --git a/pcbnew/specctra_import_export/specctra_import.cpp b/pcbnew/specctra_import_export/specctra_import.cpp index 73dcac2b93..84bc810361 100644 --- a/pcbnew/specctra_import_export/specctra_import.cpp +++ b/pcbnew/specctra_import_export/specctra_import.cpp @@ -141,10 +141,10 @@ static int scale( double distance, UNIT_RES* aResolution ) * @param aResolution - The amount to scale the point. * @return wxPoint - The KiCad coordinate system point. */ -static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) +static VECTOR2I mapPt( const POINT& aPoint, UNIT_RES* aResolution ) { - wxPoint ret( scale( aPoint.x, aResolution ), - -scale( aPoint.y, aResolution ) ); // negate y + VECTOR2I ret( scale( aPoint.x, aResolution ), + -scale( aPoint.y, aResolution ) ); // negate y return ret; } @@ -399,7 +399,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) UNIT_RES* resolution = place->GetUnits(); wxASSERT( resolution ); - wxPoint newPos = mapPt( place->vertex, resolution ); + VECTOR2I newPos = mapPt( place->vertex, resolution ); footprint->SetPosition( newPos ); if( place->side == T_front ) diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index 9b444adafa..ddc75e25d5 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -295,8 +295,8 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent ) undoCmd.PushItem( wrapper ); m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS ); - DIALOG_PAGES_SETTINGS dlg( m_frame, pcbIUScale.IU_PER_MILS, wxSize( MAX_PAGE_SIZE_PCBNEW_MILS, - MAX_PAGE_SIZE_PCBNEW_MILS ) ); + DIALOG_PAGES_SETTINGS dlg( m_frame, pcbIUScale.IU_PER_MILS, VECTOR2I( MAX_PAGE_SIZE_PCBNEW_MILS, + MAX_PAGE_SIZE_PCBNEW_MILS ) ); dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName ); if( dlg.ShowModal() == wxID_OK ) @@ -1415,9 +1415,9 @@ int BOARD_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent ) // If the new zone is on the same layer(s) as the initial zone, // offset it a bit so it can more easily be picked. if( oldZone->GetIsRuleArea() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) ) - newZone->Move( wxPoint( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) ); + newZone->Move( VECTOR2I( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) ); else if( !oldZone->GetIsRuleArea() && zoneSettings.m_Layers.test( oldZone->GetLayer() ) ) - newZone->Move( wxPoint( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) ); + newZone->Move( VECTOR2I( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) ); commit.Add( newZone.release() ); commit.Push( _( "Duplicate zone" ) ); @@ -1567,7 +1567,7 @@ int BOARD_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent ) void BOARD_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame, EDA_ITEM* originViewItem, const VECTOR2D& aPosition ) { - aFrame->GetDesignSettings().SetAuxOrigin( wxPoint( aPosition ) ); + aFrame->GetDesignSettings().SetAuxOrigin( VECTOR2I( aPosition ) ); originViewItem->SetPosition( aPosition ); aView->MarkDirty(); aFrame->OnModify(); diff --git a/pcbnew/tools/drawing_stackup_table_tool.cpp b/pcbnew/tools/drawing_stackup_table_tool.cpp index d61f6ccf2e..d8681e8661 100644 --- a/pcbnew/tools/drawing_stackup_table_tool.cpp +++ b/pcbnew/tools/drawing_stackup_table_tool.cpp @@ -206,10 +206,10 @@ std::vector DRAWING_TOOL::DrawSpecificationStackup( const VECTOR2I& // Style : Header std::unique_ptr headStyle = std::make_unique( footprint ); headStyle->SetLayer( Eco1_User ); - headStyle->SetTextSize( wxSize( pcbIUScale.mmToIU( 1.5 ), pcbIUScale.mmToIU( 1.5 ) ) ); + headStyle->SetTextSize( VECTOR2I( pcbIUScale.mmToIU( 1.5 ), pcbIUScale.mmToIU( 1.5 ) ) ); headStyle->SetTextThickness( pcbIUScale.mmToIU( 0.3 ) ); headStyle->SetItalic( false ); - headStyle->SetTextPos( wxPoint( 0, 0 ) ); + headStyle->SetTextPos( VECTOR2I( 0, 0 ) ); headStyle->SetText( _( "Layer" ) ); headStyle->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); headStyle->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); @@ -217,10 +217,10 @@ std::vector DRAWING_TOOL::DrawSpecificationStackup( const VECTOR2I& // Style : data std::unique_ptr dataStyle = std::make_unique( footprint ); dataStyle->SetLayer( Eco1_User ); - dataStyle->SetTextSize( wxSize( pcbIUScale.mmToIU( 1.5 ), pcbIUScale.mmToIU( 1.5 ) ) ); + dataStyle->SetTextSize( VECTOR2I( pcbIUScale.mmToIU( 1.5 ), pcbIUScale.mmToIU( 1.5 ) ) ); dataStyle->SetTextThickness( pcbIUScale.mmToIU( 0.1 ) ); dataStyle->SetItalic( false ); - dataStyle->SetTextPos( wxPoint( 0, 0 ) ); + dataStyle->SetTextPos( VECTOR2I( 0, 0 ) ); dataStyle->SetText( _( "Layer" ) ); dataStyle->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); dataStyle->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); @@ -373,10 +373,10 @@ std::vector DRAWING_TOOL::DrawBoardCharacteristics( const VECTOR2I& std::unique_ptr headStyle = std::make_unique( static_cast( m_frame->GetModel() ) ); headStyle->SetLayer( Eco1_User ); - headStyle->SetTextSize( wxSize( pcbIUScale.mmToIU( 2.0 ), pcbIUScale.mmToIU( 2.0 ) ) ); + headStyle->SetTextSize( VECTOR2I( pcbIUScale.mmToIU( 2.0 ), pcbIUScale.mmToIU( 2.0 ) ) ); headStyle->SetTextThickness( pcbIUScale.mmToIU( 0.4 ) ); headStyle->SetItalic( false ); - headStyle->SetTextPos( wxPoint( 0, 0 ) ); + headStyle->SetTextPos( VECTOR2I( 0, 0 ) ); headStyle->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); headStyle->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); @@ -384,10 +384,10 @@ std::vector DRAWING_TOOL::DrawBoardCharacteristics( const VECTOR2I& std::unique_ptr dataStyle = std::make_unique( static_cast( m_frame->GetModel() ) ); dataStyle->SetLayer( Eco1_User ); - dataStyle->SetTextSize( wxSize( pcbIUScale.mmToIU( 1.5 ), pcbIUScale.mmToIU( 1.5 ) ) ); + dataStyle->SetTextSize( VECTOR2I( pcbIUScale.mmToIU( 1.5 ), pcbIUScale.mmToIU( 1.5 ) ) ); dataStyle->SetTextThickness( pcbIUScale.mmToIU( 0.2 ) ); dataStyle->SetItalic( false ); - dataStyle->SetTextPos( wxPoint( 0, 0 ) ); + dataStyle->SetTextPos( VECTOR2I( 0, 0 ) ); dataStyle->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); dataStyle->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); diff --git a/pcbnew/tools/footprint_editor_control.cpp b/pcbnew/tools/footprint_editor_control.cpp index 83f3a38837..2f585ec621 100644 --- a/pcbnew/tools/footprint_editor_control.cpp +++ b/pcbnew/tools/footprint_editor_control.cpp @@ -158,7 +158,7 @@ int FOOTPRINT_EDITOR_CONTROL::NewFootprint( const TOOL_EVENT& aEvent ) // Initialize data relative to nets and netclasses (for a new footprint the defaults are // used). This is mandatory to handle and draw pads. board()->BuildListOfNets(); - newFootprint->SetPosition( wxPoint( 0, 0 ) ); + newFootprint->SetPosition( VECTOR2I( 0, 0 ) ); newFootprint->ClearFlags(); m_frame->Zoom_Automatique( false ); @@ -218,7 +218,7 @@ int FOOTPRINT_EDITOR_CONTROL::CreateFootprint( const TOOL_EVENT& aEvent ) // Initialize data relative to nets and netclasses (for a new footprint the defaults // are used). This is mandatory to handle and draw pads. board()->BuildListOfNets(); - newFootprint->SetPosition( wxPoint( 0, 0 ) ); + newFootprint->SetPosition( VECTOR2I( 0, 0 ) ); newFootprint->ClearFlags(); m_frame->Zoom_Automatique( false ); diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index 5045741060..e4aa4710c6 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -380,14 +380,14 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) // the mouse move and search pads that are on the line. int distance = ( cursorPos - oldCursorPos ).EuclideanNorm(); // Search will be made every 0.1 mm: - int segments = distance / int( 0.1 * pcbIUScale.IU_PER_MM ) + 1; - const wxPoint line_step( ( cursorPos - oldCursorPos ) / segments ); + int segments = distance / int( 0.1 * pcbIUScale.IU_PER_MM ) + 1; + const VECTOR2I line_step( ( cursorPos - oldCursorPos ) / segments ); collector.Empty(); for( int j = 0; j < segments; ++j ) { - wxPoint testpoint( cursorPos.x - j * line_step.x, cursorPos.y - j * line_step.y ); + VECTOR2I testpoint( cursorPos.x - j * line_step.x, cursorPos.y - j * line_step.y ); collector.Collect( board(), { PCB_PAD_T }, testpoint, guide ); for( int i = 0; i < collector.GetCount(); ++i ) @@ -527,7 +527,7 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent ) { pad->SetAttribute( PAD_ATTRIB::PTH ); pad->SetShape( PAD_SHAPE::CIRCLE ); - pad->SetSize( wxSize( pad->GetSizeX(), pad->GetSizeX() ) ); + pad->SetSize( VECTOR2I( pad->GetSizeX(), pad->GetSizeX() ) ); pad->SetLayerSet( PAD::PTHMask() ); } diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 7494ab067d..e620daa9ff 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -504,7 +504,7 @@ int PCB_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent ) void PCB_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame, EDA_ITEM* originViewItem, const VECTOR2D& aPoint ) { - aFrame->GetDesignSettings().SetGridOrigin( wxPoint( aPoint ) ); + aFrame->GetDesignSettings().SetGridOrigin( VECTOR2I( aPoint ) ); aView->GetGAL()->SetGridOrigin( aPoint ); originViewItem->SetPosition( aPoint ); aView->MarkDirty(); diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 0a441febaf..4091f06320 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -343,8 +343,8 @@ VECTOR2I PCB_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& a { if( nearest->Distance( aOrigin ) <= snapRange ) { - m_viewSnapPoint.SetPosition( wxPoint( nearest->pos ) ); - m_viewSnapLine.SetPosition( wxPoint( nearest->pos ) ); + m_viewSnapPoint.SetPosition( nearest->pos ); + m_viewSnapLine.SetPosition( nearest->pos ); m_toolMgr->GetView()->SetVisible( &m_viewSnapLine, false ); if( m_toolMgr->GetView()->IsVisible( &m_viewSnapPoint ) ) diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 71f8c8ea36..ce4d680c55 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -1311,7 +1311,7 @@ void PCB_POINT_EDITOR::updateItem() const VECTOR2I end = m_editPoints->Point( 0 ).GetPosition(); int diameter = (int) EuclideanNorm( end - pad->GetPosition() ) * 2; - pad->SetSize( wxSize( diameter, diameter ) ); + pad->SetSize( VECTOR2I( diameter, diameter ) ); break; } @@ -1354,7 +1354,7 @@ void PCB_POINT_EDITOR::updateItem() const dist[3] = botLeft.y - center.y; } - wxSize padSize( dist[0] + dist[2], dist[1] + dist[3] ); + VECTOR2I padSize( dist[0] + dist[2], dist[1] + dist[3] ); VECTOR2I deltaOffset( padSize.x / 2 - dist[2], padSize.y / 2 - dist[3] ); if( pad->GetOrientation() == ANGLE_90 || pad->GetOrientation() == ANGLE_270 ) @@ -1387,7 +1387,7 @@ void PCB_POINT_EDITOR::updateItem() const bottom = botLeft.y; } - wxSize padSize( abs( right - left ), abs( bottom - top ) ); + VECTOR2I padSize( abs( right - left ), abs( bottom - top ) ); if( pad->GetOrientation() == ANGLE_90 || pad->GetOrientation() == ANGLE_270 ) std::swap( padSize.x, padSize.y ); diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 7e523be6e7..b6a26bd576 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -67,6 +67,7 @@ using namespace std::placeholders; #include #include #include +#include class SELECT_MENU : public ACTION_MENU @@ -1826,7 +1827,7 @@ void PCB_SELECTION_TOOL::zoomFitSelection() BOX2I selectionBox = m_selection.GetBoundingBox(); KIGFX::VIEW* view = getView(); - VECTOR2D screenSize = view->ToWorld( m_frame->GetCanvas()->GetClientSize(), false ); + VECTOR2D screenSize = view->ToWorld( ToVECTOR2D( m_frame->GetCanvas()->GetClientSize() ), false ); screenSize.x = std::max( 10.0, screenSize.x ); screenSize.y = std::max( 10.0, screenSize.y ); @@ -1872,7 +1873,7 @@ void PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox ) #ifndef DEFAULT_PCBNEW_CODE // Do the scaled zoom auto bbSize = bbox.Inflate( KiROUND( bbox.GetWidth() * 0.2 ) ).GetSize(); - auto screenSize = view->ToWorld( m_frame->GetCanvas()->GetClientSize(), false ); + VECTOR2D screenSize = view->ToWorld( ToVECTOR2D( m_frame->GetCanvas()->GetClientSize() ), false ); // This code tries to come up with a zoom factor that doesn't simply zoom in // to the cross probed component, but instead shows a reasonable amount of the @@ -2775,7 +2776,7 @@ bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const } -int PCB_SELECTION_TOOL::hitTestDistance( const wxPoint& aWhere, BOARD_ITEM* aItem, +int PCB_SELECTION_TOOL::hitTestDistance( const VECTOR2I& aWhere, BOARD_ITEM* aItem, int aMaxDistance ) const { BOX2D viewportD = getView()->GetViewport(); @@ -2902,7 +2903,7 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector std::set preferred; std::set rejected; - wxPoint where( aWhere.x, aWhere.y ); + VECTOR2I where( aWhere.x, aWhere.y ); const RENDER_SETTINGS* settings = getView()->GetPainter()->GetSettings(); PCB_LAYER_ID activeLayer = m_frame->GetActiveLayer(); diff --git a/pcbnew/tools/pcb_selection_tool.h b/pcbnew/tools/pcb_selection_tool.h index 2789860420..a8a690d251 100644 --- a/pcbnew/tools/pcb_selection_tool.h +++ b/pcbnew/tools/pcb_selection_tool.h @@ -395,7 +395,7 @@ private: /** * @return the distance from \a wWhere to \a aItem, up to and including \a aMaxDistance. */ - int hitTestDistance( const wxPoint& aWhere, BOARD_ITEM* aItem, int aMaxDistance ) const; + int hitTestDistance( const VECTOR2I& aWhere, BOARD_ITEM* aItem, int aMaxDistance ) const; /** * Event handler to update the selection VIEW_ITEM. diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index 93f8218562..0cb993f356 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -660,13 +660,13 @@ bool TRACKS_CLEANER::mergeCollinearSegments( PCB_TRACK* aSeg1, PCB_TRACK* aSeg2 // our replacement track is still connected for( auto& pt : pts ) { - if( !dummy_seg.IsPointOnEnds( wxPoint( pt.x, pt.y ) ) ) + if( !dummy_seg.IsPointOnEnds( VECTOR2I( pt.x, pt.y ) ) ) { if( ( VECTOR2I( dummy_seg.GetStart() ) - pt ).SquaredEuclideanNorm() < ( VECTOR2I( dummy_seg.GetEnd() ) - pt ).SquaredEuclideanNorm() ) - dummy_seg.SetStart( wxPoint( pt.x, pt.y ) ); + dummy_seg.SetStart( VECTOR2I( pt.x, pt.y ) ); else - dummy_seg.SetEnd( wxPoint( pt.x, pt.y ) ); + dummy_seg.SetEnd( VECTOR2I( pt.x, pt.y ) ); } } diff --git a/qa/qa_utils/eda_item_test_utils.h b/qa/qa_utils/eda_item_test_utils.h index 66272c38f7..1e0a7e81ac 100644 --- a/qa/qa_utils/eda_item_test_utils.h +++ b/qa/qa_utils/eda_item_test_utils.h @@ -30,7 +30,7 @@ template -static void IterateOverPositionsAndReferences( T* aItem, void ( *aCallback )( T*, wxPoint ) ) +static void IterateOverPositionsAndReferences( T* aItem, void ( *aCallback )( T*, VECTOR2I ) ) { constexpr int XSTEP = static_cast( schIUScale.mmToIU( 100 ) ); constexpr int YSTEP = static_cast( schIUScale.mmToIU( 50 ) ); @@ -50,8 +50,8 @@ static void IterateOverPositionsAndReferences( T* aItem, void ( *aCallback )( T* BOOST_TEST_CONTEXT( wxString::Format( "Position: %d %d, Reference: %d %d", posX, posY, refX, refY ) ) { - aItem->SetPosition( wxPoint( posX, posY ) ); - aCallback( aItem, wxPoint( refX, refY ) ); + aItem->SetPosition( VECTOR2I( posX, posY ) ); + aCallback( aItem, VECTOR2I( refX, refY ) ); } } } diff --git a/qa/unittests/common/test_bitmap_base.cpp b/qa/unittests/common/test_bitmap_base.cpp index 51c17ea281..4873b7ed08 100644 --- a/qa/unittests/common/test_bitmap_base.cpp +++ b/qa/unittests/common/test_bitmap_base.cpp @@ -58,7 +58,7 @@ static const std::vector png_data_4tile = { // }; ///< 4tile is an 8x8 image -static const wxSize size_4tile{ 8, 8 }; +static const VECTOR2I size_4tile{ 8, 8 }; static const KIGFX::COLOR4D col_red{ 1.0, 0.0, 0.0, 1.0 }; static const KIGFX::COLOR4D col_green{ 0.0, 1.0, 0.0, 1.0 }; @@ -162,8 +162,8 @@ BOOST_AUTO_TEST_CASE( BasicProps ) BOOST_CHECK( img.GetSize() == size_4tile * 10 ); const BOX2I bb = img.GetBoundingBox(); - BOOST_CHECK( bb.GetPosition() == wxPoint( -40, -40 ) ); - BOOST_CHECK( bb.GetEnd() == wxPoint( 40, 40 ) ); + BOOST_CHECK( bb.GetPosition() == VECTOR2I( -40, -40 ) ); + BOOST_CHECK( bb.GetEnd() == VECTOR2I( 40, 40 ) ); } diff --git a/qa/unittests/common/test_format_units.cpp b/qa/unittests/common/test_format_units.cpp index a14f757ce3..022621aebe 100644 --- a/qa/unittests/common/test_format_units.cpp +++ b/qa/unittests/common/test_format_units.cpp @@ -44,7 +44,7 @@ BOOST_FIXTURE_TEST_SUITE( UnitConversion, UnitFixture ) /** * Check formatting the point */ -BOOST_AUTO_TEST_CASE( wxPointUnitFormat ) +BOOST_AUTO_TEST_CASE( VECTOR2IUnitFormat ) { LOCALE_IO toggle; @@ -56,11 +56,11 @@ BOOST_AUTO_TEST_CASE( wxPointUnitFormat ) const EDA_IU_SCALE& iuScale = pcbIUScale; #endif - std::string str = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, wxPoint( 123456, 52525252 ) ); - std::string strZero = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, wxPoint( 0, 0 ) ); - std::string strNeg = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, wxPoint( -123456, -52525252 ) ); - std::string strOddNeg = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, wxPoint( -350000, -0 ) ); - std::string strMax = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, wxPoint( std::numeric_limits::min(), std::numeric_limits::max() ) ); + std::string str = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, VECTOR2I( 123456, 52525252 ) ); + std::string strZero = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, VECTOR2I( 0, 0 ) ); + std::string strNeg = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, VECTOR2I( -123456, -52525252 ) ); + std::string strOddNeg = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, VECTOR2I( -350000, -0 ) ); + std::string strMax = EDA_UNIT_UTILS::FormatInternalUnits( iuScale, VECTOR2I( std::numeric_limits::min(), std::numeric_limits::max() ) ); BOOST_CHECK_EQUAL( strZero, "0 0" ); diff --git a/qa/unittests/eeschema/test_ee_item.cpp b/qa/unittests/eeschema/test_ee_item.cpp index d026c6c11e..229b4f9180 100644 --- a/qa/unittests/eeschema/test_ee_item.cpp +++ b/qa/unittests/eeschema/test_ee_item.cpp @@ -65,8 +65,8 @@ public: m_pin( &m_symbol ), m_ercItem( ERC_ITEM::Create( ERCE_DRIVER_CONFLICT ) ) { - m_sheet.SetPosition( wxPoint( schIUScale.mmToIU( 5 ), schIUScale.mmToIU( 10 ) ) ); - m_sheet.SetSize( wxSize( schIUScale.mmToIU( 50 ), schIUScale.mmToIU( 100 ) ) ); + m_sheet.SetPosition( VECTOR2I( schIUScale.mmToIU( 5 ), schIUScale.mmToIU( 10 ) ) ); + m_sheet.SetSize( VECTOR2I( schIUScale.mmToIU( 50 ), schIUScale.mmToIU( 100 ) ) ); } EDA_ITEM* Instantiate( KICAD_T aType ) @@ -79,7 +79,7 @@ public: switch( aType ) { - case SCH_MARKER_T: return new SCH_MARKER( m_ercItem, wxPoint( 0, 0 ) ); + case SCH_MARKER_T: return new SCH_MARKER( m_ercItem, VECTOR2I( 0, 0 ) ); case SCH_JUNCTION_T: return new SCH_JUNCTION(); case SCH_NO_CONNECT_T: return new SCH_NO_CONNECT(); case SCH_BUS_WIRE_ENTRY_T: return new SCH_BUS_WIRE_ENTRY(); @@ -87,20 +87,20 @@ public: case SCH_LINE_T: return new SCH_LINE(); case SCH_SHAPE_T: return new SCH_SHAPE( SHAPE_T::ARC ); case SCH_BITMAP_T: return new SCH_BITMAP(); - case SCH_TEXT_T: return new SCH_TEXT( wxPoint( 0, 0 ), "test text" ); + case SCH_TEXT_T: return new SCH_TEXT( VECTOR2I( 0, 0 ), "test text" ); case SCH_TEXTBOX_T: return new SCH_TEXTBOX( 0, FILL_T::NO_FILL, "test textbox" ); - case SCH_LABEL_T: return new SCH_LABEL( wxPoint( 0, 0 ), "test label" ); - case SCH_DIRECTIVE_LABEL_T: return new SCH_DIRECTIVE_LABEL( wxPoint( 0, 0 ) ); + case SCH_LABEL_T: return new SCH_LABEL( VECTOR2I( 0, 0 ), "test label" ); + case SCH_DIRECTIVE_LABEL_T: return new SCH_DIRECTIVE_LABEL( VECTOR2I( 0, 0 ) ); case SCH_GLOBAL_LABEL_T: return new SCH_GLOBALLABEL(); case SCH_HIER_LABEL_T: return new SCH_HIERLABEL(); - case SCH_FIELD_T: return new SCH_FIELD( wxPoint( 0, 0 ), 0, nullptr ); + case SCH_FIELD_T: return new SCH_FIELD( VECTOR2I( 0, 0 ), 0, nullptr ); case SCH_SYMBOL_T: return new SCH_SYMBOL(); case SCH_SHEET_PIN_T: // XXX: m_sheet pins currently have to have their initial positions calculated manually. return new SCH_SHEET_PIN( &m_sheet, - wxPoint( m_sheet.GetPosition().x, - m_sheet.GetPosition().y + schIUScale.mmToIU( 40 ) ), + VECTOR2I( m_sheet.GetPosition().x, + m_sheet.GetPosition().y + schIUScale.mmToIU( 40 ) ), "test aPin" ); case SCH_SHEET_T: return new SCH_SHEET(); @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE( Move ) { IterateOverPositionsAndReferences( item.get(), - []( EDA_ITEM* aOriginalItem, wxPoint aRef ) + []( EDA_ITEM* aOriginalItem, VECTOR2I aRef ) { auto item = std::unique_ptr( aOriginalItem->Clone() ); VECTOR2I originalPos = item->GetPosition(); @@ -237,7 +237,7 @@ BOOST_AUTO_TEST_CASE( Rotate ) { IterateOverPositionsAndReferences( item.get(), - []( EDA_ITEM* aOriginalItem, wxPoint aRef ) + []( EDA_ITEM* aOriginalItem, VECTOR2I aRef ) { auto item = std::unique_ptr( aOriginalItem->Clone() ); @@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE( MirrorHorizontally ) { IterateOverPositionsAndReferences( item.get(), - []( EDA_ITEM* aOriginalItem, wxPoint aRef ) + []( EDA_ITEM* aOriginalItem, VECTOR2I aRef ) { auto item = std::unique_ptr( aOriginalItem->Clone() ); @@ -328,7 +328,7 @@ BOOST_AUTO_TEST_CASE( MirrorVertically ) { IterateOverPositionsAndReferences( item.get(), - []( EDA_ITEM* aOriginalItem, wxPoint aRef ) + []( EDA_ITEM* aOriginalItem, VECTOR2I aRef ) { auto item = std::unique_ptr( aOriginalItem->Clone() ); diff --git a/qa/unittests/eeschema/test_sch_pin.cpp b/qa/unittests/eeschema/test_sch_pin.cpp index acf2489b9c..1ecde8f746 100644 --- a/qa/unittests/eeschema/test_sch_pin.cpp +++ b/qa/unittests/eeschema/test_sch_pin.cpp @@ -43,11 +43,11 @@ public: m_lib_pin->SetNumber( "42" ); m_lib_pin->SetName( "pinname" ); m_lib_pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT ); - m_lib_pin->SetPosition( wxPoint( 1, -2 ) ); // local coord system is upside-down + m_lib_pin->SetPosition( VECTOR2I( 1, -2 ) ); // local coord system is upside-down SCH_SHEET_PATH path; - m_parent_symbol = new SCH_SYMBOL( *m_parent_part, m_parent_part->GetLibId(), - &path, 0, 0, wxPoint( 1, 2 ) ); + m_parent_symbol = new SCH_SYMBOL( *m_parent_part, m_parent_part->GetLibId(), &path, 0, 0, + VECTOR2I( 1, 2 ) ); m_parent_symbol->SetRef( &path, "U2" ); m_parent_symbol->UpdatePins(); @@ -81,8 +81,8 @@ BOOST_AUTO_TEST_CASE( DefaultProperties ) BOOST_CHECK_EQUAL( m_sch_pin->GetParentSymbol(), m_parent_symbol ); // Note: local coord system is upside-down; schematic coord system is not. - BOOST_CHECK_EQUAL( m_sch_pin->GetLocalPosition(), wxPoint( 1, -2 ) ); - BOOST_CHECK_EQUAL( m_sch_pin->GetPosition(), wxPoint( 2, 4 ) ); + BOOST_CHECK_EQUAL( m_sch_pin->GetLocalPosition(), VECTOR2I( 1, -2 ) ); + BOOST_CHECK_EQUAL( m_sch_pin->GetPosition(), VECTOR2I( 2, 4 ) ); BOOST_CHECK_EQUAL( m_sch_pin->IsVisible(), m_lib_pin->IsVisible() ); BOOST_CHECK_EQUAL( m_sch_pin->GetName(), m_lib_pin->GetName() ); @@ -160,8 +160,8 @@ BOOST_AUTO_TEST_CASE( PinNumberingPower ) // and update symbol from library... SCH_SHEET_PATH path; delete m_parent_symbol; - m_parent_symbol = new SCH_SYMBOL( *m_parent_part, m_parent_part->GetLibId(), - &path, 0, 0, wxPoint( 1, 2 ) ); + m_parent_symbol = new SCH_SYMBOL( *m_parent_part, m_parent_part->GetLibId(), &path, 0, 0, + VECTOR2I( 1, 2 ) ); m_parent_symbol->SetRef( &path, "U2" ); m_parent_symbol->UpdatePins(); diff --git a/qa/unittests/eeschema/test_sch_sheet.cpp b/qa/unittests/eeschema/test_sch_sheet.cpp index c6fed03a58..d1feda5d41 100644 --- a/qa/unittests/eeschema/test_sch_sheet.cpp +++ b/qa/unittests/eeschema/test_sch_sheet.cpp @@ -79,7 +79,7 @@ BOOST_FIXTURE_TEST_SUITE( SchSheet, TEST_SCH_SHEET_FIXTURE ) */ BOOST_AUTO_TEST_CASE( Default ) { - BOOST_CHECK_EQUAL( m_csheet.GetPosition(), wxPoint( 0, 0 ) ); + BOOST_CHECK_EQUAL( m_csheet.GetPosition(), VECTOR2I( 0, 0 ) ); BOOST_CHECK_EQUAL( m_sheet.GetParent(), nullptr ); BOOST_CHECK_EQUAL( m_sheet.CountSheets(), 1 ); @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE( SchematicParent ) */ BOOST_AUTO_TEST_CASE( AddPins ) { - const wxPoint pinPos{ 42, 13 }; + const VECTOR2I pinPos{ 42, 13 }; // we should catch null insertions CHECK_WX_ASSERT( m_sheet.AddPin( nullptr ) ); @@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE( PinRenumbering ) { for( int i = 0; i < 5; ++i ) { - SCH_SHEET_PIN* pin = new SCH_SHEET_PIN( &m_sheet, wxPoint{ i, i }, "name" ); + SCH_SHEET_PIN* pin = new SCH_SHEET_PIN( &m_sheet, VECTOR2I{ i, i }, "name" ); // set the pins to have the same number going in pin->SetNumber( 2 ); @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE( PinRenumbering ) struct TEST_END_CONN_PIN { std::string m_pin_name; - wxPoint m_pos; + VECTOR2I m_pos; }; @@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE( EndconnectionPoints ) // And check the connection getter { - std::vector expectedConnections; + std::vector expectedConnections; // we want to see every pin that we just added for( const auto& pin : pin_defs ) diff --git a/qa/unittests/eeschema/test_sch_sheet_path.cpp b/qa/unittests/eeschema/test_sch_sheet_path.cpp index 8aa1faea07..b85ec0a007 100644 --- a/qa/unittests/eeschema/test_sch_sheet_path.cpp +++ b/qa/unittests/eeschema/test_sch_sheet_path.cpp @@ -44,7 +44,7 @@ public: { for( unsigned i = 0; i < 4; ++i ) { - m_sheets.emplace_back( nullptr, wxPoint( i, i ) ); + m_sheets.emplace_back( nullptr, VECTOR2I( i, i ) ); std::ostringstream ss; ss << "Sheet" << i; diff --git a/qa/unittests/pcbnew/test_board_item.cpp b/qa/unittests/pcbnew/test_board_item.cpp index 18104e588d..1e81c99046 100644 --- a/qa/unittests/pcbnew/test_board_item.cpp +++ b/qa/unittests/pcbnew/test_board_item.cpp @@ -95,10 +95,10 @@ public: { FP_ZONE* fpZone = new FP_ZONE( &m_footprint ); - fpZone->AppendCorner( wxPoint( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); - fpZone->AppendCorner( wxPoint( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); - fpZone->AppendCorner( wxPoint( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); - fpZone->AppendCorner( wxPoint( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); + fpZone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); + fpZone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); + fpZone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); + fpZone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); return fpZone; } @@ -106,7 +106,7 @@ public: case PCB_TRACE_T: return new PCB_TRACK( &m_board ); case PCB_VIA_T: return new PCB_VIA( &m_board ); case PCB_ARC_T: return new PCB_ARC( &m_board ); - case PCB_MARKER_T: return new PCB_MARKER( m_drcItem, wxPoint( 0, 0 ) ); + case PCB_MARKER_T: return new PCB_MARKER( m_drcItem, VECTOR2I( 0, 0 ) ); case PCB_DIM_ALIGNED_T: return new PCB_DIM_ALIGNED( &m_board, PCB_DIM_ALIGNED_T ); case PCB_DIM_LEADER_T: return new PCB_DIM_LEADER( &m_board ); case PCB_DIM_CENTER_T: return new PCB_DIM_CENTER( &m_board ); @@ -117,10 +117,10 @@ public: { ZONE* zone = new ZONE( &m_board ); - zone->AppendCorner( wxPoint( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); - zone->AppendCorner( wxPoint( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); - zone->AppendCorner( wxPoint( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); - zone->AppendCorner( wxPoint( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); + zone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); + zone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( -100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); + zone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( 50 ) ), -1 ); + zone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( 100 ), pcbIUScale.mmToIU( -50 ) ), -1 ); return zone; } @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE( Move ) { IterateOverPositionsAndReferences( item.get(), - []( BOARD_ITEM* aOriginalItem, wxPoint aRef ) + []( BOARD_ITEM* aOriginalItem, VECTOR2I aRef ) { FP_SHAPE* originalFpShape = dynamic_cast( aOriginalItem ); @@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE( Rotate ) IterateOverPositionsAndReferences( item.get(), - []( BOARD_ITEM* aOriginalItem, wxPoint aRef ) + []( BOARD_ITEM* aOriginalItem, VECTOR2I aRef ) { FP_SHAPE* originalFpShape = dynamic_cast( aOriginalItem ); @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE( FlipLeftRight ) { IterateOverPositionsAndReferences( item.get(), - []( BOARD_ITEM* aOriginalItem, wxPoint aRef ) + []( BOARD_ITEM* aOriginalItem, VECTOR2I aRef ) { FP_SHAPE* originalFpShape = dynamic_cast( aOriginalItem ); @@ -340,7 +340,7 @@ BOOST_AUTO_TEST_CASE( FlipUpDown ) { IterateOverPositionsAndReferences( item.get(), - []( BOARD_ITEM* aOriginalItem, wxPoint aRef ) + []( BOARD_ITEM* aOriginalItem, VECTOR2I aRef ) { FP_SHAPE* originalFpShape = dynamic_cast( aOriginalItem ); diff --git a/qa/unittests/pcbnew/test_zone_filler.cpp b/qa/unittests/pcbnew/test_zone_filler.cpp index 7842481af1..407abb4cbb 100644 --- a/qa/unittests/pcbnew/test_zone_filler.cpp +++ b/qa/unittests/pcbnew/test_zone_filler.cpp @@ -62,7 +62,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE ) for( PAD* pad : m_board->Footprints()[0]->Pads() ) { if( pad->GetNumber() == "2" || pad->GetNumber() == "4" || pad->GetNumber() == "6" ) - pad->SetSize( pad->GetSize() + wxSize( delta, delta ) ); + pad->SetSize( pad->GetSize() + VECTOR2I( delta, delta ) ); } int ii = 0; @@ -83,7 +83,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE ) else if( ii == 12 ) { arc12 = track->m_Uuid; - track->Move( wxPoint( -delta, -delta ) ); + track->Move( VECTOR2I( -delta, -delta ) ); } } }