Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere

This commit is contained in:
Marek Roszko 2023-02-18 22:40:07 -05:00
parent bc8f81b14d
commit aacc9746e3
180 changed files with 695 additions and 700 deletions

View File

@ -342,7 +342,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
return; return;
PAD dummy( *aPad ); 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 ); dummy.TransformShapeToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
clearance = { 0, 0 }; 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: // 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( 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() ) switch( pad->GetShape() )
{ {

View File

@ -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 ) if( m_Center )
{ {

View File

@ -119,7 +119,7 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
GRID_SETTINGS& gridCfg = cfg->m_Window.grid; GRID_SETTINGS& gridCfg = cfg->m_Window.grid;
gridCfg.last_size_idx = m_currentGridCtrl->GetSelection(); 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_x = m_parent->StringFromValue( m_userGridX.GetValue(), true );
gridCfg.user_grid_y = m_parent->StringFromValue( m_userGridY.GetValue(), true ); gridCfg.user_grid_y = m_parent->StringFromValue( m_userGridY.GetValue(), true );
gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection(); gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection();

View File

@ -74,7 +74,7 @@ static const wxString pageFmts[] =
}; };
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils,
const wxSize& aMaxUserSizeMils ) : const VECTOR2I& aMaxUserSizeMils ) :
DIALOG_PAGES_SETTINGS_BASE( aParent ), DIALOG_PAGES_SETTINGS_BASE( aParent ),
m_parent( aParent ), m_parent( aParent ),
m_screen( m_parent->GetScreen() ), m_screen( m_parent->GetScreen() ),
@ -745,7 +745,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
wxASSERT( i != arrayDim(papers) ); // dialog UI match the above list? wxASSERT( i != arrayDim(papers) ); // dialog UI match the above list?
VECTOR2I sz = pageInfo.GetSizeMils(); 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 // swap sizes to match orientation
bool isPortrait = (bool) m_orientationComboBox->GetSelection(); 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 ) || if( ( isPortrait && m_layout_size.x >= m_layout_size.y ) ||
( !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. // Prepare to painless double -> int conversion.
customSizeX = Clamp( double( INT_MIN ), customSizeX, double( INT_MAX ) ); customSizeX = Clamp( double( INT_MIN ), customSizeX, double( INT_MAX ) );
customSizeY = Clamp( double( INT_MIN ), customSizeY, 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 ) );
} }

View File

@ -73,7 +73,7 @@ bool PANEL_IMAGE_EDITOR::CheckValues()
} }
// Test value correctness // 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 ) ); 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 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(); double scale = 1.0 / m_workingImage->GetScalingFactor();
dc.SetUserScale( scale, scale ); dc.SetUserScale( scale, scale );
m_workingImage->DrawBitmap( &dc, wxPoint( 0, 0 ) ); m_workingImage->DrawBitmap( &dc, VECTOR2I( 0, 0 ) );
} }

View File

@ -41,6 +41,7 @@
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <gal/opengl/opengl_gal.h> #include <gal/opengl/opengl_gal.h>
#include <gal/cairo/cairo_gal.h> #include <gal/cairo/cairo_gal.h>
#include <math/vector2wx.h>
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
@ -349,7 +350,7 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
wxSize clientSize = GetClientSize(); wxSize clientSize = GetClientSize();
WX_INFOBAR* infobar = GetParentEDAFrame() ? GetParentEDAFrame()->GetInfoBar() : nullptr; WX_INFOBAR* infobar = GetParentEDAFrame() ? GetParentEDAFrame()->GetInfoBar() : nullptr;
if( VECTOR2I( clientSize ) == m_gal->GetScreenPixelSize() ) if( ToVECTOR2I( clientSize ) == m_gal->GetScreenPixelSize() )
return; return;
clientSize.x = std::max( 10, clientSize.x ); clientSize.x = std::max( 10, clientSize.x );
@ -365,7 +366,7 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
if( m_view ) if( m_view )
{ {
if( infobar && infobar->IsLocked() ) 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_CACHED );
m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

View File

@ -552,7 +552,7 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
pensize = aCollector ? aCollector->GetDefaultPenSize() : 1; pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
SetConstrainedTextSize(); SetConstrainedTextSize();
wxSize textsize; VECTOR2I textsize;
textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
textsize.y = KiROUND( m_ConstrainedTextSize.y * 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() // EDA_TEXT::GetTextBox()
// but this function uses integers // but this function uses integers
// So, to avoid truncations with our unit in mm, use microns. // So, to avoid truncations with our unit in mm, use microns.
wxSize size_micron; VECTOR2I size_micron;
#define FSCALE 1000.0 #define FSCALE 1000.0
int linewidth = 0; int linewidth = 0;
size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE ); size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );

View File

@ -34,6 +34,7 @@
#include <kiface_base.h> #include <kiface_base.h>
#include <lockfile.h> #include <lockfile.h>
#include <macros.h> #include <macros.h>
#include <math/vector2wx.h>
#include <page_info.h> #include <page_info.h>
#include <paths.h> #include <paths.h>
#include <pgm_base.h> #include <pgm_base.h>
@ -951,8 +952,8 @@ void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos )
for( wxWindow* dialog : findDialogs() ) for( wxWindow* dialog : findDialogs() )
{ {
dialogScreenRects.emplace_back( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ), dialogScreenRects.emplace_back( ToVECTOR2D( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ) ),
dialog->GetSize() ); ToVECTOR2D( dialog->GetSize() ) );
} }
// Center if we're behind an obscuring dialog, or within 10% of its edge // Center if we're behind an obscuring dialog, or within 10% of its edge

View File

@ -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 // Creates bounding box (rectangle) for horizontal, left and top justified text. The
// bounding box will be moved later according to the actual text options // 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; VECTOR2I pos = drawPos;
if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() ) if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() )

View File

@ -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, std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale,
const VECTOR2I& aPoint ) 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_MM( x, scale ) ( x / scale.IU_PER_MM )
#define IU_TO_IN( x, scale ) ( x / scale.IU_PER_MILS / 1000 ) #define IU_TO_IN( x, scale ) ( x / scale.IU_PER_MILS / 1000 )
#define IU_TO_MILS( x, scale ) ( x / scale.IU_PER_MILS ) #define IU_TO_MILS( x, scale ) ( x / scale.IU_PER_MILS )

View File

@ -34,6 +34,7 @@
#include <gal/cairo/cairo_compositor.h> #include <gal/cairo/cairo_compositor.h>
#include <gal/definitions.h> #include <gal/definitions.h>
#include <geometry/shape_poly_set.h> #include <geometry/shape_poly_set.h>
#include <math/vector2wx.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
#include <trigo.h> #include <trigo.h>
#include <bitmap_base.h> #include <bitmap_base.h>
@ -1363,7 +1364,7 @@ CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
#endif #endif
SetSize( aParent->GetClientSize() ); SetSize( aParent->GetClientSize() );
m_screenSize = VECTOR2I( aParent->GetClientSize() ); m_screenSize = ToVECTOR2I( aParent->GetClientSize() );
// Allocate memory for pixel storage // Allocate memory for pixel storage
allocateBitmaps(); allocateBitmaps();

View File

@ -38,6 +38,7 @@
#include <gal/definitions.h> #include <gal/definitions.h>
#include <gl_context_mgr.h> #include <gl_context_mgr.h>
#include <geometry/shape_poly_set.h> #include <geometry/shape_poly_set.h>
#include <math/vector2wx.h>
#include <bitmap_base.h> #include <bitmap_base.h>
#include <bezier_curves.h> #include <bezier_curves.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
@ -323,7 +324,7 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
#endif #endif
SetSize( aParent->GetClientSize() ); SetSize( aParent->GetClientSize() );
m_screenSize = VECTOR2I( GetNativePixelSize() ); m_screenSize = ToVECTOR2I( GetNativePixelSize() );
// Grid color settings are different in Cairo and OpenGL // Grid color settings are different in Cairo and OpenGL
SetGridColor( COLOR4D( 0.8, 0.8, 0.8, 0.1 ) ); SetGridColor( COLOR4D( 0.8, 0.8, 0.8, 0.1 ) );

View File

@ -23,6 +23,7 @@
#include <trigo.h> #include <trigo.h>
#include <eda_item.h> #include <eda_item.h>
#include <wx/graphics.h> #include <wx/graphics.h>
#include <math/vector2wx.h>
#include <algorithm> #include <algorithm>
@ -237,7 +238,7 @@ void GRCSegm( wxDC* DC, const VECTOR2I& A, const VECTOR2I& B, int width, const C
start += org; start += org;
end += org; end += org;
DC->DrawLine( (wxPoint) start, (wxPoint) end ); DC->DrawLine( ToWxPoint( start ), ToWxPoint( end ) );
// first rounded end // first rounded end
end.x = 0; end.x = 0;
@ -246,9 +247,9 @@ void GRCSegm( wxDC* DC, const VECTOR2I& A, const VECTOR2I& B, int width, const C
end += org; end += org;
if( !mirrored ) if( !mirrored )
DC->DrawArc( (wxPoint) end, (wxPoint) start, (wxPoint) org ); DC->DrawArc( ToWxPoint(end ), ToWxPoint(start ), ToWxPoint(org ) );
else else
DC->DrawArc( (wxPoint) start, (wxPoint) end, (wxPoint) org ); DC->DrawArc( ToWxPoint(start ), ToWxPoint(end ), ToWxPoint(org ) );
// second edge // second edge
start.x = len; start.x = len;
@ -256,7 +257,7 @@ void GRCSegm( wxDC* DC, const VECTOR2I& A, const VECTOR2I& B, int width, const C
RotatePoint( start, angle ); RotatePoint( start, angle );
start += org; start += org;
DC->DrawLine( (wxPoint) start, (wxPoint) end ); DC->DrawLine( ToWxPoint( start ), ToWxPoint( end ) );
// second rounded end // second rounded end
end.x = len; end.x = len;

View File

@ -64,7 +64,7 @@ const wxChar PAGE_INFO::Custom[] = wxT( "User" );
// also see: wx/defs.h // also see: wx/defs.h
// local readability macro for millimeter wxSize // 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. // All MUST be defined as landscape.
const PAGE_INFO PAGE_INFO::pageA5( MMsize( 210, 148 ), wxT( "A5" ), wxPAPER_A5 ); 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::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::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::pageA( VECTOR2I( 11000, 8500 ), wxT( "A" ), wxPAPER_LETTER );
const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ), wxPAPER_TABLOID ); const PAGE_INFO PAGE_INFO::pageB( VECTOR2I( 17000, 11000 ), wxT( "B" ), wxPAPER_TABLOID );
const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ), wxPAPER_CSHEET ); const PAGE_INFO PAGE_INFO::pageC( VECTOR2I( 22000, 17000 ), wxT( "C" ), wxPAPER_CSHEET );
const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ), wxPAPER_DSHEET ); const PAGE_INFO PAGE_INFO::pageD( VECTOR2I( 34000, 22000 ), wxT( "D" ), wxPAPER_DSHEET );
const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ), wxPAPER_ESHEET ); 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::pageGERBER( VECTOR2I( 32000, 32000 ), wxT( "GERBER" ), wxPAPER_NONE );
const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), Custom, wxPAPER_NONE ); const PAGE_INFO PAGE_INFO::pageUser( VECTOR2I( 17000, 11000 ), Custom, wxPAPER_NONE );
// US paper sizes // US paper sizes
const PAGE_INFO PAGE_INFO::pageUSLetter( wxSize( 11000, 8500 ), wxT( "USLetter" ), wxPAPER_LETTER ); const PAGE_INFO PAGE_INFO::pageUSLetter( VECTOR2I( 11000, 8500 ), wxT( "USLetter" ), wxPAPER_LETTER );
const PAGE_INFO PAGE_INFO::pageUSLegal( wxSize( 14000, 8500 ), wxT( "USLegal" ), wxPAPER_LEGAL ); const PAGE_INFO PAGE_INFO::pageUSLegal( VECTOR2I( 14000, 8500 ), wxT( "USLegal" ), wxPAPER_LEGAL );
const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedger" ), wxPAPER_TABLOID ); const PAGE_INFO PAGE_INFO::pageUSLedger( VECTOR2I( 17000, 11000 ), wxT( "USLedger" ),
wxPAPER_TABLOID );
// Custom paper size for next instantiation of type "User" // Custom paper size for next instantiation of type "User"
int PAGE_INFO::s_user_width = 17000; 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 ) m_type( aType ), m_size( aSizeMils ), m_paper_id( aPaperId )
{ {
updatePortrait(); updatePortrait();
@ -170,7 +171,7 @@ bool PAGE_INFO::SetType( const wxString& aType, bool aIsPortrait )
if( aIsPortrait ) if( aIsPortrait )
{ {
// all private PAGE_INFOs are landscape, must swap x and y // 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(); updatePortrait();
} }
@ -189,7 +190,7 @@ void PAGE_INFO::SetPortrait( bool aIsPortrait )
if( m_portrait != aIsPortrait ) if( m_portrait != aIsPortrait )
{ {
// swap x and y in m_size // 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; m_portrait = aIsPortrait;

View File

@ -740,8 +740,8 @@ void PLOTTER::Text( const VECTOR2I& aPos,
// Stroke callback // Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 ) [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{ {
MoveTo( (wxPoint) aPt1 ); MoveTo( aPt1 );
LineTo( (wxPoint) aPt2 ); LineTo( aPt2 );
PenFinish(); PenFinish();
}, },
// Polygon callback // Polygon callback

View File

@ -185,14 +185,14 @@ public:
return -ReadKicadUnit(); return -ReadKicadUnit();
} }
VECTOR2I ReadVector2I() VECTOR2I ReadVector2IPos()
{ {
int32_t x = ReadKicadUnitX(); int32_t x = ReadKicadUnitX();
int32_t y = ReadKicadUnitY(); int32_t y = ReadKicadUnitY();
return { x, y }; return { x, y };
} }
wxSize ReadWxSize() VECTOR2I ReadVector2ISize()
{ {
int32_t x = ReadKicadUnit(); int32_t x = ReadKicadUnit();
int32_t y = ReadKicadUnit(); int32_t y = ReadKicadUnit();

View File

@ -1147,7 +1147,7 @@ void CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::Parse( XNODE* aNode, PARSER_CON
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxT( "ATTRLOC" ) ); 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" ) ); 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" ) ); THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "TEXTLOC" ) );
} }

View File

@ -398,10 +398,10 @@ public:
/** /**
* @brief Represents a point in x,y coordinates * @brief Represents a point in x,y coordinates
*/ */
struct POINT : wxPoint, PARSER struct POINT : VECTOR2I, PARSER
{ {
POINT() : wxPoint( UNDEFINED_VALUE, UNDEFINED_VALUE ) {} POINT() : VECTOR2I( UNDEFINED_VALUE, UNDEFINED_VALUE ) {}
POINT( int aX, int aY ) : wxPoint( aX, aY ) {} POINT( int aX, int aY ) : VECTOR2I( aX, aY ) {}
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override; void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
}; };

View File

@ -679,9 +679,9 @@ ETEXT::ETEXT( wxXmlNode* aText )
} }
wxSize ETEXT::ConvertSize() const VECTOR2I ETEXT::ConvertSize() const
{ {
wxSize textsize; VECTOR2I textsize;
if( font ) if( font )
{ {
@ -689,20 +689,20 @@ wxSize ETEXT::ConvertSize() const
if( fontName == "vector" ) if( fontName == "vector" )
{ {
textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() ); textsize = VECTOR2I( size.ToSchUnits(), size.ToSchUnits() );
} }
else if( fontName == "fixed" ) else if( fontName == "fixed" )
{ {
textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() * 0.80 ); textsize = VECTOR2I( size.ToSchUnits(), size.ToSchUnits() * 0.80 );
} }
else else
{ {
textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() ); textsize = VECTOR2I( size.ToSchUnits(), size.ToSchUnits() );
} }
} }
else else
{ {
textsize = wxSize( size.ToSchUnits() * 0.85, size.ToSchUnits() ); textsize = VECTOR2I( size.ToSchUnits() * 0.85, size.ToSchUnits() );
} }
return textsize; return textsize;

View File

@ -668,7 +668,7 @@ struct ETEXT
ETEXT( wxXmlNode* aText ); ETEXT( wxXmlNode* aText );
/// Calculate text size based on font type and size /// Calculate text size based on font type and size
wxSize ConvertSize() const; VECTOR2I ConvertSize() const;
}; };

View File

@ -28,6 +28,7 @@
*/ */
#include <wx/settings.h> #include <wx/settings.h>
#include <math/vector2wx.h>
#include <status_popup.h> #include <status_popup.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
@ -83,7 +84,7 @@ void STATUS_POPUP::PopupFor( int aMsecs )
void STATUS_POPUP::Move( const VECTOR2I& aWhere ) void STATUS_POPUP::Move( const VECTOR2I& aWhere )
{ {
SetPosition( wxPoint( aWhere.x, aWhere.y ) ); SetPosition( ToWxPoint( aWhere ) );
} }

View File

@ -32,6 +32,7 @@
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <id.h> #include <id.h>
#include <math/vector2wx.h>
#include <kiface_base.h> #include <kiface_base.h>
#include <settings/app_settings.h> #include <settings/app_settings.h>
#include <tool/actions.h> #include <tool/actions.h>
@ -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 view->SetScale( 1.0 ); // The best scale will be determined later, but this initial
// value ensures all view parameters are up to date (especially // value ensures all view parameters are up to date (especially
// at init time) // 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 // Currently "Zoom to Objects" is only supported in Eeschema & Pcbnew. Support for other
// programs in the suite can be added as needed. // 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() ); getView()->SetCenter( bBox.Centre() );
// Take scrollbars into account // 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 ); VECTOR2D worldScrollbarSize = getView()->ToWorld( scrollbarSize, false );
getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 ); getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 );

View File

@ -77,7 +77,7 @@ void GRID_HELPER::SetAuxAxes( bool aEnable, const VECTOR2I& aOrigin )
if( aEnable ) if( aEnable )
{ {
m_auxAxis = aOrigin; m_auxAxis = aOrigin;
m_viewAxis.SetPosition( wxPoint( aOrigin ) ); m_viewAxis.SetPosition( aOrigin );
m_toolMgr->GetView()->SetVisible( &m_viewAxis, true ); m_toolMgr->GetView()->SetVisible( &m_viewAxis, true );
} }
else else

View File

@ -34,6 +34,8 @@
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
#include <wx/app.h> #include <wx/app.h>
#include <math/vector2wx.h>
#include <view/view.h> #include <view/view.h>
#include <eda_base_frame.h> #include <eda_base_frame.h>
#include <tool/tool_base.h> #include <tool/tool_base.h>
@ -304,7 +306,7 @@ VECTOR2D TOOL_MANAGER::GetMousePosition() const
if( m_viewControls ) if( m_viewControls )
return m_viewControls->GetMousePosition(); return m_viewControls->GetMousePosition();
else else
return wxGetMousePosition(); return ToVECTOR2D( wxGetMousePosition() );
} }
@ -313,7 +315,7 @@ VECTOR2D TOOL_MANAGER::GetCursorPosition() const
if( m_viewControls ) if( m_viewControls )
return m_viewControls->GetCursorPosition(); return m_viewControls->GetCursorPosition();
else else
return wxGetMousePosition(); return ToVECTOR2D( wxGetMousePosition() );
} }

View File

@ -24,6 +24,7 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/zoom_tool.h> #include <tool/zoom_tool.h>
#include <view/view.h> #include <view/view.h>
#include <math/vector2wx.h>
ZOOM_TOOL::ZOOM_TOOL() : ZOOM_TOOL::ZOOM_TOOL() :
@ -140,7 +141,7 @@ bool ZOOM_TOOL::selectRegion()
} }
else else
{ {
VECTOR2D sSize = view->ToWorld( canvas->GetClientSize(), false ); VECTOR2D sSize = view->ToWorld( ToVECTOR2I( canvas->GetClientSize() ), false );
VECTOR2D vSize = selectionBox.GetSize(); VECTOR2D vSize = selectionBox.GetSize();
double scale; double scale;
double ratio = std::max( fabs( vSize.x / sSize.x ), fabs( vSize.y / sSize.y ) ); double ratio = std::max( fabs( vSize.x / sSize.x ), fabs( vSize.y / sSize.y ) );

View File

@ -455,7 +455,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
if( footprint ) if( footprint )
{ {
footprint->SetParent( (EDA_ITEM*) GetBoard() ); footprint->SetParent( (EDA_ITEM*) GetBoard() );
footprint->SetPosition( wxPoint( 0, 0 ) ); footprint->SetPosition( VECTOR2I( 0, 0 ) );
return footprint; return footprint;
} }

View File

@ -27,7 +27,7 @@
#include <eeschema_settings.h> #include <eeschema_settings.h>
DIALOG_EESCHEMA_PAGE_SETTINGS::DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, 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 ) DIALOG_PAGES_SETTINGS( aParent, schIUScale.IU_PER_MILS, aMaxUserSizeMils )
{ {
} }

View File

@ -26,7 +26,7 @@
class DIALOG_EESCHEMA_PAGE_SETTINGS : public DIALOG_PAGES_SETTINGS class DIALOG_EESCHEMA_PAGE_SETTINGS : public DIALOG_PAGES_SETTINGS
{ {
public: 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(); virtual ~DIALOG_EESCHEMA_PAGE_SETTINGS();
private: private:

View File

@ -618,7 +618,7 @@ void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent )
m_parent->SetCurrentSheet( sheet ); m_parent->SetCurrentSheet( sheet );
m_parent->DisplayCurrentSheet(); 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 ); m_parent->FocusOnItem( item );

View File

@ -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(); m_size = m_textSize.GetValue();
if( m_fontCtrl->HaveFontSelection() ) if( m_fontCtrl->HaveFontSelection() )
@ -416,7 +416,7 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataFromWindow()
void DIALOG_FIELD_PROPERTIES::updateText( EDA_TEXT* aText ) void DIALOG_FIELD_PROPERTIES::updateText( EDA_TEXT* aText )
{ {
if( aText->GetTextWidth() != m_size ) if( aText->GetTextWidth() != m_size )
aText->SetTextSize( wxSize( m_size, m_size ) ); aText->SetTextSize( VECTOR2I( m_size, m_size ) );
aText->SetVisible( m_isVisible ); aText->SetVisible( m_isVisible );
aText->SetTextAngle( m_isVertical ? ANGLE_VERTICAL : ANGLE_HORIZONTAL ); aText->SetTextAngle( m_isVertical ? ANGLE_VERTICAL : ANGLE_HORIZONTAL );

View File

@ -255,7 +255,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
if( EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( aItem ) ) if( EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( aItem ) )
{ {
if( !m_textSize.IsIndeterminate() ) 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() ) if( m_setTextColor->GetValue() )
eda_text->SetTextColor( m_textColorSwatch->GetSwatchColor() ); eda_text->SetTextColor( m_textColorSwatch->GetSwatchColor() );

View File

@ -527,7 +527,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T ) if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
static_cast<SCH_DIRECTIVE_LABEL*>( m_currentLabel )->SetPinLength( m_textSize.GetValue() ); static_cast<SCH_DIRECTIVE_LABEL*>( m_currentLabel )->SetPinLength( m_textSize.GetValue() );
else if( m_currentLabel->GetTextWidth() != 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() ) 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 ); 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 ) if( m_fields->size() > 0 )
{ {

View File

@ -399,13 +399,13 @@ public:
break; break;
case COL_POSX: case COL_POSX:
pin->SetPosition( wxPoint( m_frame->ValueFromString( value ), pin->SetPosition( VECTOR2I( m_frame->ValueFromString( value ),
pin->GetPosition().y ) ); pin->GetPosition().y ) );
break; break;
case COL_POSY: case COL_POSY:
pin->SetPosition( wxPoint( pin->GetPosition().x, pin->SetPosition( VECTOR2I( pin->GetPosition().x,
-m_frame->ValueFromString( value ) ) ); -m_frame->ValueFromString( value ) ) );
break; break;
case COL_VISIBLE: case COL_VISIBLE:

View File

@ -537,8 +537,8 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
int fieldID = (int) m_fields->size(); int fieldID = (int) m_fields->size();
LIB_FIELD newField( m_libEntry, fieldID ); LIB_FIELD newField( m_libEntry, fieldID );
newField.SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ), newField.SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );
m_fields->push_back( newField ); m_fields->push_back( newField );

View File

@ -229,7 +229,7 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
} }
if( m_textSize.GetValue() != m_graphicText->GetTextWidth() ) 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() ) if( m_horizontal->IsChecked() )
m_graphicText->SetTextAngle( ANGLE_HORIZONTAL ); m_graphicText->SetTextAngle( ANGLE_HORIZONTAL );

View File

@ -260,7 +260,7 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow()
m_currentText->SetText( text ); m_currentText->SetText( text );
if( m_currentText->GetTextWidth() != m_textSize.GetValue() ) 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() ) if( m_fontCtrl->HaveFontSelection() )
{ {

View File

@ -334,7 +334,7 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
if( !DIALOG_SHIM::TransferDataFromWindow() ) if( !DIALOG_SHIM::TransferDataFromWindow() )
return false; return false;
wxPoint newPos( m_posX.GetValue(), -m_posY.GetValue() ); VECTOR2I newPos( m_posX.GetValue(), -m_posY.GetValue() );
const int standard_grid = 50; const int standard_grid = 50;

View File

@ -27,6 +27,7 @@
#include <sch_screen.h> #include <sch_screen.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <base_units.h> #include <base_units.h>
#include <math/vector2wx.h>
#include <settings/color_settings.h> #include <settings/color_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <sch_sheet.h> #include <sch_sheet.h>
@ -432,7 +433,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
// Change scale factor and offset to print the whole page. // Change scale factor and offset to print the whole page.
bool printReference = cfg->m_Printing.title_block; 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 ); FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect(); fitRect = GetLogicalPaperRect();

View File

@ -165,7 +165,7 @@ bool DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow()
// Currently, eeschema uses only the text width as text size, // Currently, eeschema uses only the text width as text size,
// and expects text width = text height // 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() ); m_sheetPin->SetTextColor( m_textColorSwatch->GetSwatchColor() );

View File

@ -50,7 +50,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
m_clearAnnotationNewItems( aClearAnnotationNewItems ), m_clearAnnotationNewItems( aClearAnnotationNewItems ),
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ), m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
m_dummySheet( *aSheet ), m_dummySheet( *aSheet ),
m_dummySheetNameField( wxDefaultPosition, SHEETNAME, &m_dummySheet ) m_dummySheetNameField( VECTOR2I( -1, -1 ), SHEETNAME, &m_dummySheet )
{ {
m_sheet = aSheet; m_sheet = aSheet;
m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_grid, m_sheet ); m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_grid, m_sheet );
@ -709,7 +709,7 @@ void DIALOG_SHEET_PROPERTIES::OnAddField( wxCommandEvent& event )
return; return;
int fieldID = m_fields->size(); 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 ) ); SCH_SHEET::GetDefaultFieldName( fieldID ) );
newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() ); newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() );

View File

@ -448,7 +448,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
{ {
if( defined.count( templateFieldname.m_Name ) <= 0 ) 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 ); field.SetVisible( templateFieldname.m_Visible );
m_fields->push_back( field ); m_fields->push_back( field );
} }
@ -938,11 +938,11 @@ void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
SCHEMATIC_SETTINGS& settings = m_symbol->Schematic()->Settings(); SCHEMATIC_SETTINGS& settings = m_symbol->Schematic()->Settings();
int fieldID = (int) m_fields->size(); 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 ) ); TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID, DO_TRANSLATE ) );
newField.SetTextAngle( m_fields->at( REFERENCE_FIELD ).GetTextAngle() ); 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 ); m_fields->push_back( newField );

View File

@ -503,7 +503,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
} }
if( m_currentText->GetTextWidth() != m_textSize.GetValue() ) 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() ) if( m_fontCtrl->HaveFontSelection() )
{ {

View File

@ -24,6 +24,7 @@
#include <gal/gal_display_options.h> #include <gal/gal_display_options.h>
#include <layer_ids.h> #include <layer_ids.h>
#include <lib_shape.h> #include <lib_shape.h>
#include <math/vector2wx.h>
#include <page_info.h> #include <page_info.h>
#include <panel_eeschema_color_settings.h> #include <panel_eeschema_color_settings.h>
#include <pgm_base.h> #include <pgm_base.h>
@ -429,7 +430,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
SCH_SHEET* s = new SCH_SHEET( SCH_SHEET* s = new SCH_SHEET(
/* aParent */ nullptr, /* aParent */ nullptr,
/* aPosition */ MILS_POINT( 4000, 1300 ), /* 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( SHEETNAME ).SetText( wxT( "SHEET" ) );
s->GetFields().at( SHEETFILENAME ).SetText( _( "/path/to/sheet" ) ); s->GetFields().at( SHEETFILENAME ).SetText( _( "/path/to/sheet" ) );
s->AutoplaceFields( nullptr, false ); s->AutoplaceFields( nullptr, false );
@ -498,7 +499,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview()
KIGFX::VIEW* view = m_preview->GetView(); KIGFX::VIEW* view = m_preview->GetView();
view->SetScale( 1.0 ); 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 ) ); 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 ), double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),

View File

@ -403,7 +403,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( !aSvgJob->m_blackAndWhite ); plotter->SetColorMode( !aSvgJob->m_blackAndWhite );
wxPoint plot_offset; VECTOR2I plot_offset;
const double scale = 1.0; const double scale = 1.0;
// Currently, plot units are in decimil // Currently, plot units are in decimil

View File

@ -329,7 +329,7 @@ int ERC_TESTER::TestConflictingBusAliases()
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_ALIAS_CONFLICT ); std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_ALIAS_CONFLICT );
ercItem->SetErrorMessage( msg ); ercItem->SetErrorMessage( msg );
SCH_MARKER* marker = new SCH_MARKER( ercItem, wxPoint() ); SCH_MARKER* marker = new SCH_MARKER( ercItem, VECTOR2I() );
test->GetParent()->Append( marker ); test->GetParent()->Append( marker );
++err_count; ++err_count;

View File

@ -758,8 +758,8 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
break; break;
case FDC_TEXT_SIZE: case FDC_TEXT_SIZE:
field.SetTextSize( wxSize( m_frame->ValueFromString( value ), field.SetTextSize( VECTOR2I( m_frame->ValueFromString( value ),
m_frame->ValueFromString( value ) ) ); m_frame->ValueFromString( value ) ) );
break; break;
case FDC_ORIENTATION: case FDC_ORIENTATION:

View File

@ -382,8 +382,8 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false ); KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
wxSize pinNameSize( m_nameTextSize, m_nameTextSize ); VECTOR2I pinNameSize( m_nameTextSize, m_nameTextSize );
wxSize pinNumSize( m_numTextSize, m_numTextSize ); VECTOR2I pinNumSize( m_numTextSize, m_numTextSize );
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ), int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
aSettings->GetDefaultPenWidth() ); aSettings->GetDefaultPenWidth() );
@ -607,7 +607,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
break; 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 ); GR_TEXT_V_ALIGN_CENTER, pensize, false, false, font );
} }
@ -1061,7 +1061,7 @@ void LIB_PIN::ChangeLength( int aLength )
break; break;
} }
wxPoint offset = wxPoint( offsetX, offsetY ); VECTOR2I offset = VECTOR2I( offsetX, offsetY );
Offset( offset ); Offset( offset );
m_length = aLength; m_length = aLength;
@ -1359,9 +1359,9 @@ BITMAPS LIB_PIN::GetMenuImage() const
wxString LIB_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) 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 // 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. // that will be shown and check if it's empty.
wxString shownName = UnescapeString( GetShownName() ); wxString shownName = UnescapeString( GetShownName() );

View File

@ -41,8 +41,8 @@ LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) :
LIB_ITEM( LIB_TEXT_T, aParent ), LIB_ITEM( LIB_TEXT_T, aParent ),
EDA_TEXT( schIUScale, wxEmptyString ) EDA_TEXT( schIUScale, wxEmptyString )
{ {
SetTextSize( wxSize( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), SetTextSize( VECTOR2I( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ),
schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) ); schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) );
} }

View File

@ -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 ), LIB_SHAPE( aParent, SHAPE_T::RECT, aLineWidth, aFillType, LIB_TEXTBOX_T ),
EDA_TEXT( schIUScale, text ) 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 ); SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
SetVertJustify( GR_TEXT_V_ALIGN_TOP ); SetVertJustify( GR_TEXT_V_ALIGN_TOP );
SetMultilineAllowed( true ); SetMultilineAllowed( true );

View File

@ -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: // GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ); return GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );

View File

@ -118,7 +118,7 @@ public:
void SetPageSettings( const PAGE_INFO& aPageSettings ) override; void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
const PAGE_INFO& GetPageSettings () const override; const PAGE_INFO& GetPageSettings () const override;
const wxSize GetPageSizeIU() const override; const VECTOR2I GetPageSizeIU() const override;
const VECTOR2I& GetGridOrigin() const override const VECTOR2I& GetGridOrigin() const override
{ {

View File

@ -68,8 +68,8 @@ public:
VECTOR2I GetEnd() const; VECTOR2I GetEnd() const;
wxSize GetSize() const { return m_size; } VECTOR2I GetSize() const { return m_size; }
void SetSize( const wxSize& aSize ) { m_size = aSize; } void SetSize( const VECTOR2I& aSize ) { m_size = aSize; }
void SetPenWidth( int aWidth ); void SetPenWidth( int aWidth );
@ -133,7 +133,7 @@ private:
protected: protected:
VECTOR2I m_pos; VECTOR2I m_pos;
wxSize m_size; VECTOR2I m_size;
bool m_isDanglingStart; bool m_isDanglingStart;
bool m_isDanglingEnd; bool m_isDanglingEnd;
STROKE_PARAMS m_stroke; STROKE_PARAMS m_stroke;

View File

@ -2036,7 +2036,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
{ {
// Set zoom to last used in this screen // Set zoom to last used in this screen
GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel ); GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
RedrawScreen( (wxPoint) GetScreen()->m_ScrollCenter, false ); RedrawScreen( GetScreen()->m_ScrollCenter, false );
} }
updateTitle(); updateTitle();

View File

@ -171,7 +171,7 @@ static LIB_SYMBOL* dummy()
LIB_TEXT* text = new LIB_TEXT( symbol ); 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( "??" ) ) ); text->SetText( wxString( wxT( "??" ) ) );
symbol->AddDrawItem( square ); symbol->AddDrawItem( square );

View File

@ -218,9 +218,9 @@ void SCH_PLOTTER::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
if( aPlotSettings.m_useBackgroundColor && aPlotter->GetColorMode() ) if( aPlotSettings.m_useBackgroundColor && aPlotter->GetColorMode() )
{ {
aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() ); aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
wxPoint end( aPlotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), VECTOR2I end( aPlotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
aPlotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); aPlotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) );
aPlotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); aPlotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
} }
if( aPlotSettings.m_plotDrawingSheet ) if( aPlotSettings.m_plotDrawingSheet )
@ -278,7 +278,7 @@ void SCH_PLOTTER::setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
aPlotter->SetPageSettings( plotPage ); aPlotter->SetPageSettings( plotPage );
// Currently, plot units are in decimil // 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 scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = std::min( scalex, scaley ); double scale = std::min( scalex, scaley );
wxPoint plot_offset; VECTOR2I plot_offset;
try try
{ {
@ -406,7 +406,7 @@ void SCH_PLOTTER::createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
bool SCH_PLOTTER::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, bool SCH_PLOTTER::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, RENDER_SETTINGS* aRenderSettings,
const PAGE_INFO& aPageInfo, const wxPoint& aPlot0ffset, const PAGE_INFO& aPageInfo, const VECTOR2I& aPlot0ffset,
double aScale, const SCH_PLOT_SETTINGS& aPlotSettings ) double aScale, const SCH_PLOT_SETTINGS& aPlotSettings )
{ {
PS_PLOTTER* plotter = new PS_PLOTTER(); 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 ) ); plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), VECTOR2I end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) );
plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
} }
if( aPlotSettings.m_plotDrawingSheet ) if( aPlotSettings.m_plotDrawingSheet )
@ -588,7 +588,7 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree
plotter->SetRenderSettings( aRenderSettings ); plotter->SetRenderSettings( aRenderSettings );
plotter->SetPageSettings( plotPage ); plotter->SetPageSettings( plotPage );
plotter->SetColorMode( aPlotSettings.m_blackAndWhite ? false : true ); plotter->SetColorMode( aPlotSettings.m_blackAndWhite ? false : true );
wxPoint plot_offset; VECTOR2I plot_offset;
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); 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() ) if( aPlotSettings.m_useBackgroundColor && plotter->GetColorMode() )
{ {
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), VECTOR2I end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) );
plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
} }
if( aPlotSettings.m_plotDrawingSheet ) 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(); double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
// Calculate offsets // Calculate offsets
wxPoint plotOffset; VECTOR2I plotOffset;
wxString msg; wxString msg;
if( aPlotSettings.m_HPGLPlotOrigin == HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER ) 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, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo, const PAGE_INFO& aPageInfo,
RENDER_SETTINGS* aRenderSettings, RENDER_SETTINGS* aRenderSettings,
const wxPoint& aPlot0ffset, const VECTOR2I& aPlot0ffset,
double aScale, double aScale,
const SCH_PLOT_SETTINGS& aPlotSettings ) const SCH_PLOT_SETTINGS& aPlotSettings )
{ {
@ -817,7 +817,7 @@ bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName,
wxString sheetName = m_schematic->CurrentSheet().Last()->GetName(); wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable(); wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
PlotDrawingSheet( plotter, &m_schematic->Prj(), PlotDrawingSheet( plotter, &m_schematic->Prj(),
aScreen->GetTitleBlock(), aScreen->GetTitleBlock(),
aPageInfo, aPageInfo,
aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(), aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
@ -868,7 +868,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
m_schematic->SetSheetNumberAndCount(); m_schematic->SetSheetNumberAndCount();
SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen(); SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen();
wxPoint plot_offset; VECTOR2I plot_offset;
wxString msg; wxString msg;
try try
@ -941,7 +941,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
bool SCH_PLOTTER::plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen, 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 ) double aScale, const SCH_PLOT_SETTINGS& aPlotSettings )
{ {
aRenderSettings->LoadColors( m_colorSettings ); aRenderSettings->LoadColors( m_colorSettings );
@ -976,7 +976,7 @@ bool SCH_PLOTTER::plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScree
wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable(); wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
COLOR4D color = plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ); COLOR4D color = plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET );
PlotDrawingSheet( plotter, &m_schematic->Prj(), PlotDrawingSheet( plotter, &m_schematic->Prj(),
aScreen->GetTitleBlock(), aScreen->GetTitleBlock(),
pageInfo, pageInfo,
aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(), aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),

View File

@ -161,7 +161,7 @@ protected:
void createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings, void createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
REPORTER* aReporter ); REPORTER* aReporter );
bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen, 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 ); double aScale, const SCH_PLOT_SETTINGS& aPlotSettings );
@ -170,7 +170,7 @@ protected:
REPORTER* aReporter ); REPORTER* aReporter );
bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
const wxPoint& aPlot0ffset, double aScale, const VECTOR2I& aPlot0ffset, double aScale,
const SCH_PLOT_SETTINGS& aPlotSettings ); const SCH_PLOT_SETTINGS& aPlotSettings );
// PS // PS
@ -178,7 +178,7 @@ protected:
REPORTER* aReporter ); REPORTER* aReporter );
bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
const wxPoint& aPlot0ffset, double aScale, const VECTOR2I& aPlot0ffset, double aScale,
const SCH_PLOT_SETTINGS& aPlotSettings ); const SCH_PLOT_SETTINGS& aPlotSettings );
// SVG // SVG

View File

@ -481,7 +481,7 @@ ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxStrin
Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
Size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) ); Size = VECTOR2I( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) );
Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 ); AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
@ -569,8 +569,8 @@ ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ), size = VECTOR2I( ReadKiCadUnitFrac( aProps, "XSIZE" ),
ReadKiCadUnitFrac( aProps, "YSIZE" ) ); ReadKiCadUnitFrac( aProps, "YSIZE" ) );
isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false ); isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );

View File

@ -465,7 +465,7 @@ struct ASCH_HARNESS_CONNECTOR
int OwnerPartID; // always -1, can be safely ignored I think int OwnerPartID; // always -1, can be safely ignored I think
VECTOR2I Location; VECTOR2I Location;
wxSize Size; VECTOR2I Size;
int AreaColor; int AreaColor;
int Color; int Color;
@ -539,7 +539,7 @@ struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE
struct ASCH_SHEET_SYMBOL struct ASCH_SHEET_SYMBOL
{ {
VECTOR2I location; VECTOR2I location;
wxSize size; VECTOR2I size;
bool isSolid; bool isSolid;

View File

@ -1865,7 +1865,7 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessEntry( const std::map<wxString, wxString>& a
sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
VECTOR2I pos = sheetIt->second->GetPosition(); VECTOR2I pos = sheetIt->second->GetPosition();
wxSize size = sheetIt->second->GetSize(); VECTOR2I size = sheetIt->second->GetSize();
switch( elem.Side ) switch( elem.Side )
{ {
@ -2051,7 +2051,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
//sheetPin->SetPosition( getKiCadPoint( term.Position ) ); //sheetPin->SetPosition( getKiCadPoint( term.Position ) );
VECTOR2I pos = sheetIt->second->GetPosition(); VECTOR2I pos = sheetIt->second->GetPosition();
wxSize size = sheetIt->second->GetSize(); VECTOR2I size = sheetIt->second->GetSize();
switch( elem.side ) switch( elem.side )
{ {

View File

@ -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 // 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 // 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. // 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 longestSide = std::max( targetSheetSize.x, targetSheetSize.y );
int margin = ( (double) longestSide * 0.03 ); int margin = ( (double) longestSide * 0.03 );
margin = roundToNearestGrid( margin ); margin = roundToNearestGrid( margin );
targetSheetSize.IncBy( margin * 2, margin * 2 ); targetSheetSize += margin * 2;
// Update page size always // Update page size always
PAGE_INFO pageInfo = sheet->GetScreen()->GetPageSettings(); 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. // Set the new sheet size.
sheet->GetScreen()->SetPageSettings( pageInfo ); 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 sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
VECTOR2I itemsCentre = sheetBoundingBox.Centre(); VECTOR2I itemsCentre = sheetBoundingBox.Centre();
@ -282,7 +282,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets()
for( LAYER_ID sheetID : orphanSheets ) for( LAYER_ID sheetID : orphanSheets )
{ {
VECTOR2I pos( x * schIUScale.MilsToIU( 1000 ), y * schIUScale.MilsToIU( 1000 ) ); 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 ); loadSheetAndChildSheets( sheetID, pos, siz, rootPath );
@ -663,7 +663,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL; SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL;
netLabel->SetPosition( getKiCadPoint( (VECTOR2I)sym.Origin + terminalPosOffset ) ); netLabel->SetPosition( getKiCadPoint( (VECTOR2I)sym.Origin + terminalPosOffset ) );
netLabel->SetText( "***UNKNOWN NET****" ); // This should be later updated when we load the netlist 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 ); SYMDEF_SCM symbolDef = Library.SymbolDefinitions.at( sym.SymdefID );
@ -923,7 +923,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
VECTOR2I size = VECTOR2I size =
getKiCadPoint( busTerm.SecondPoint ) - getKiCadPoint( busTerm.FirstPoint ); 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 ); m_sheetMap.at( bus.LayerID )->GetScreen()->Append( busEntry );
@ -945,7 +945,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
} }
else else
{ {
label->SetTextSize( wxSize( SMALL_LABEL_SIZE, SMALL_LABEL_SIZE ) ); label->SetTextSize( VECTOR2I( SMALL_LABEL_SIZE, SMALL_LABEL_SIZE ) );
} }
netlabels.insert( { busTerm.ID, label } ); netlabels.insert( { busTerm.ID, label } );
@ -1024,7 +1024,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
&& SCH_SHEET::ClassOf( sheetPin->GetParent() ) ) && SCH_SHEET::ClassOf( sheetPin->GetParent() ) )
{ {
SCH_SHEET* parentSheet = static_cast<SCH_SHEET*>( sheetPin->GetParent() ); SCH_SHEET* parentSheet = static_cast<SCH_SHEET*>( sheetPin->GetParent() );
wxSize sheetSize = parentSheet->GetSize(); VECTOR2I sheetSize = parentSheet->GetSize();
VECTOR2I sheetPosition = parentSheet->GetPosition(); VECTOR2I sheetPosition = parentSheet->GetPosition();
int leftSide = sheetPosition.x; 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<VERTEX>& aCadstarVertices, void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices( const std::vector<VERTEX>& aCadstarVertices,
wxPoint aSymbolOrigin, VECTOR2I aSymbolOrigin,
LIB_SYMBOL* aSymbol, LIB_SYMBOL* aSymbol,
int aGateNumber, int aGateNumber,
int aLineThickness ) int aLineThickness )
@ -1726,7 +1726,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices( const std::vect
void CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute( 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 ) ); aKiCadField->SetTextPos( getKiCadLibraryPoint( aCadstarAttrLoc.Position, aSymbolOrigin ) );
@ -2180,7 +2180,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( LAYER_ID
SCH_SHEET* sheet = new SCH_SHEET( SCH_SHEET* sheet = new SCH_SHEET(
/* aParent */ aParentSheet.Last(), /* aParent */ aParentSheet.Last(),
/* aPosition */ aPosition, /* aPosition */ aPosition,
/* aSize */ wxSize( aSheetSize ) ); /* aSize */ VECTOR2I( aSheetSize ) );
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
SCH_SHEET_PATH instance( aParentSheet ); 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 // 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 // are allowed. We will calculate the extents of the Cadstar shape and draw a rectangle
std::pair<VECTOR2I, wxSize> blockExtents; std::pair<VECTOR2I, VECTOR2I> blockExtents;
if( block.Figures.size() > 0 ) if( block.Figures.size() > 0 )
{ {
@ -2790,7 +2790,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT
setAlignment( aKiCadTextItem, textAlignment ); setAlignment( aKiCadTextItem, textAlignment );
BOX2I bb = textEdaItem->GetBoundingBox(); BOX2I bb = textEdaItem->GetBoundingBox();
int off = static_cast<SCH_TEXT*>( aKiCadTextItem )->GetTextOffset(); int off = static_cast<SCH_TEXT*>( aKiCadTextItem )->GetTextOffset();
wxPoint pos; VECTOR2I pos;
// Change the anchor point of the text item to make it match the same bounding box // 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 // 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<VECTOR2I, wxSize> std::pair<VECTOR2I, VECTOR2I>
CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure ) CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure )
{ {
VECTOR2I upperLeft( Assignments.Settings.DesignLimit.x, 0 ); VECTOR2I upperLeft( Assignments.Settings.DesignLimit.x, 0 );
@ -3046,7 +3046,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure
VECTOR2I size = lowerRightKiCad - upperLeftKiCad; 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() ) if( !aRotation.IsZero() )
RotatePoint( retVal, aTransformCentre, aRotation ); RotatePoint( retVal, aTransformCentre, aRotation );
if( aMoveVector != wxPoint{ 0, 0 } ) if( aMoveVector != VECTOR2I{ 0, 0 } )
retVal += aMoveVector; retVal += aMoveVector;
return retVal; return retVal;

View File

@ -143,11 +143,11 @@ private:
const GATE_ID& aGateID, LIB_SYMBOL* aSymbol ); const GATE_ID& aGateID, LIB_SYMBOL* aSymbol );
void loadLibrarySymbolShapeVertices( const std::vector<VERTEX>& aCadstarVertices, void loadLibrarySymbolShapeVertices( const std::vector<VERTEX>& aCadstarVertices,
wxPoint aSymbolOrigin, LIB_SYMBOL* aSymbol, VECTOR2I aSymbolOrigin, LIB_SYMBOL* aSymbol,
int aGateNumber, int aLineThickness ); int aGateNumber, int aLineThickness );
void applyToLibraryFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc, void applyToLibraryFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
wxPoint aSymbolOrigin, LIB_FIELD* aKiCadField ); VECTOR2I aSymbolOrigin, LIB_FIELD* aKiCadField );
//Helper Functions for loading symbols in schematic //Helper Functions for loading symbols in schematic
SCH_SYMBOL* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_SYMBOL& aKiCadPart, SCH_SYMBOL* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_SYMBOL& aKiCadPart,
@ -231,7 +231,7 @@ private:
void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber ); void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber );
std::pair<VECTOR2I, wxSize> getFigureExtentsKiCad( const FIGURE& aCadstarFigure ); std::pair<VECTOR2I, VECTOR2I> getFigureExtentsKiCad( const FIGURE& aCadstarFigure );
VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint ); VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint );

View File

@ -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() ); 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() ); 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() ); 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() ); 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() ); 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() ); 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() ); THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() );
} }

View File

@ -758,7 +758,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
// Calculate the already placed items bounding box and the page size to determine // Calculate the already placed items bounding box and the page size to determine
// placement for the new symbols // 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 ); BOX2I sheetBbox = getSheetBbox( m_rootSheet );
VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() ); VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() );
int maxY = sheetBbox.GetY(); int maxY = sheetBbox.GetY();
@ -792,7 +792,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
newCmpPosition.x += cmpBbox.GetWidth(); newCmpPosition.x += cmpBbox.GetWidth();
maxY = std::max( maxY, posY ); 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 newCmpPosition = VECTOR2I( sheetBbox.GetLeft(), maxY ); // then start a new row
// Add the global net labels to recreate the implicit connections // 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 ) ); targetSheetSize += VECTOR2I( schIUScale.MilsToIU( 1500 ), schIUScale.MilsToIU( 1500 ) );
// Get current Eeschema sheet size. // 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(); PAGE_INFO pageInfo = screen->GetPageSettings();
// Increase if necessary // Increase if necessary
@ -1074,8 +1074,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_ITEM*>&
legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosY += rowSpacing; legendPosY += rowSpacing;
@ -1117,8 +1117,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_ITEM*>&
legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosY += rowSpacing; legendPosY += rowSpacing;
@ -1160,8 +1160,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_ITEM*>&
legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosX += columnSpacing; legendPosX += columnSpacing;
@ -1203,8 +1203,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_ITEM*>&
legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); legendText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); legendText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosX += columnSpacing; legendPosX += columnSpacing;
@ -1338,8 +1338,8 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n
{ {
label->SetPosition( firstWire.A ); label->SetPosition( firstWire.A );
label->SetText( escapeName( netName ) ); label->SetText( escapeName( netName ) );
label->SetTextSize( wxSize( schIUScale.MilsToIU( 40 ), label->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 40 ),
schIUScale.MilsToIU( 40 ) ) ); schIUScale.MilsToIU( 40 ) ) );
if( firstWire.B.x > firstWire.A.x ) if( firstWire.B.x > firstWire.A.x )
label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); 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; bool global = m_netCounts[aNetName] > 1;
std::unique_ptr<SCH_TEXT> label; std::unique_ptr<SCH_TEXT> label;
wxSize textSize = wxSize( KiROUND( elabel.size.ToSchUnits() * 0.7 ), VECTOR2I textSize = VECTOR2I( KiROUND( elabel.size.ToSchUnits() * 0.7 ),
KiROUND( elabel.size.ToSchUnits() * 0.7 ) ); KiROUND( elabel.size.ToSchUnits() * 0.7 ) );
if( global ) if( global )
label = std::make_unique<SCH_GLOBALLABEL>(); label = std::make_unique<SCH_GLOBALLABEL>();
@ -2443,8 +2443,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosY -= rowSpacing; legendPosY -= rowSpacing;
@ -2484,8 +2484,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosY -= rowSpacing; legendPosY -= rowSpacing;
@ -2525,8 +2525,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) ); legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosX += columnSpacing; legendPosX += columnSpacing;
@ -2566,8 +2566,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) ); legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), legendText->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 90 ),
schIUScale.MilsToIU( 100 ) ) ); schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
legendChar++; legendChar++;
legendPosX += columnSpacing; legendPosX += columnSpacing;
@ -3366,8 +3366,8 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN*
SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL; SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL;
netLabel->SetPosition( aSymbol->GetPinPhysicalPosition( pin ) ); netLabel->SetPosition( aSymbol->GetPinPhysicalPosition( pin ) );
netLabel->SetText( extractNetName( pin->GetName() ) ); netLabel->SetText( extractNetName( pin->GetName() ) );
netLabel->SetTextSize( wxSize( schIUScale.MilsToIU( 40 ), netLabel->SetTextSize( VECTOR2I( schIUScale.MilsToIU( 40 ),
schIUScale.MilsToIU( 40 ) ) ); schIUScale.MilsToIU( 40 ) ) );
switch( pin->GetOrientation() ) switch( pin->GetOrientation() )
{ {

View File

@ -579,9 +579,9 @@ void SCH_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText, bool aConvertOverbarSynta
case T_size: case T_size:
{ {
wxSize sz; VECTOR2I sz;
sz.SetHeight( parseInternalUnits( "text height" ) ); sz.y = parseInternalUnits( "text height" );
sz.SetWidth( parseInternalUnits( "text width" ) ); sz.x = parseInternalUnits( "text width" );
aText->SetTextSize( sz ); aText->SetTextSize( sz );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -1946,7 +1946,7 @@ SCH_FIELD* SCH_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent )
// Empty property values are valid. // Empty property values are valid.
wxString value = FromUTF8(); wxString value = FromUTF8();
std::unique_ptr<SCH_FIELD> field = std::make_unique<SCH_FIELD>( wxDefaultPosition, -1, std::unique_ptr<SCH_FIELD> field = std::make_unique<SCH_FIELD>( VECTOR2I(-1,-1), -1,
aParent, name ); aParent, name );
field->SetText( value ); field->SetText( value );
@ -3020,9 +3020,9 @@ SCH_SHEET* SCH_SEXPR_PARSER::parseSheet()
case T_size: case T_size:
{ {
wxSize size; VECTOR2I size;
size.SetWidth( parseInternalUnits( "sheet width" ) ); size.x = parseInternalUnits( "sheet width" );
size.SetHeight( parseInternalUnits( "sheet height" ) ); size.y = parseInternalUnits( "sheet height" );
sheet->SetSize( size ); sheet->SetSize( size );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -3297,10 +3297,10 @@ SCH_BUS_WIRE_ENTRY* SCH_SEXPR_PARSER::parseBusEntry()
case T_size: case T_size:
{ {
wxSize size; VECTOR2I size;
size.SetWidth( parseInternalUnits( "bus entry height" ) ); size.x = parseInternalUnits( "bus entry height" );
size.SetHeight( parseInternalUnits( "bus entry width" ) ); size.y = parseInternalUnits( "bus entry width" );
busEntry->SetSize( size ); busEntry->SetSize( size );
NeedRIGHT(); NeedRIGHT();
break; break;

View File

@ -143,9 +143,9 @@ private:
return parseInternalUnits( GetTokenText( aToken ) ); return parseInternalUnits( GetTokenText( aToken ) );
} }
inline wxPoint parseXY() inline VECTOR2I parseXY()
{ {
wxPoint xy; VECTOR2I xy;
xy.x = parseInternalUnits( "X coordinate" ); xy.x = parseInternalUnits( "X coordinate" );
xy.y = parseInternalUnits( "Y coordinate" ); xy.y = parseInternalUnits( "Y coordinate" );

View File

@ -976,9 +976,9 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, EDA_UNIT_UTILS::FormatInternalUnits( schIUScale,
aSheet->GetPosition().y ).c_str(), aSheet->GetPosition().y ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, EDA_UNIT_UTILS::FormatInternalUnits( schIUScale,
aSheet->GetSize().GetWidth() ).c_str(), aSheet->GetSize().x ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, EDA_UNIT_UTILS::FormatInternalUnits( schIUScale,
aSheet->GetSize().GetHeight() ).c_str() ); aSheet->GetSize().y ).c_str() );
if( aSheet->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO ) if( aSheet->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
m_out->Print( 0, " (fields_autoplaced)" ); 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, EDA_UNIT_UTILS::FormatInternalUnits( schIUScale,
aBusEntry->GetPosition().y ).c_str(), aBusEntry->GetPosition().y ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, EDA_UNIT_UTILS::FormatInternalUnits( schIUScale,
aBusEntry->GetSize().GetWidth() ).c_str(), aBusEntry->GetSize().x ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, EDA_UNIT_UTILS::FormatInternalUnits( schIUScale,
aBusEntry->GetSize().GetHeight() ).c_str() ); aBusEntry->GetSize().y ).c_str() );
aBusEntry->GetStroke().Format( m_out, schIUScale, aNestLevel + 1 ); aBusEntry->GetStroke().Format( m_out, schIUScale, aNestLevel + 1 );

View File

@ -569,7 +569,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_SYMBOL>& aSymbol,
pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
field->SetPosition( pos ); field->SetPosition( pos );
wxSize textSize; VECTOR2I textSize;
textSize.x = textSize.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); textSize.x = textSize.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
field->SetTextSize( textSize ); field->SetTextSize( textSize );
@ -882,7 +882,7 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_SYMBOL>& aSymbo
center.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); center.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
text->SetPosition( center ); text->SetPosition( center );
wxSize size; VECTOR2I size;
size.x = size.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); size.x = size.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
text->SetTextSize( size ); text->SetTextSize( size );

View File

@ -546,10 +546,10 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
sheet->SetPosition( position ); sheet->SetPosition( position );
wxSize size; VECTOR2I size;
size.SetWidth( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ) ); size.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
size.SetHeight( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ) ); size.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
sheet->SetSize( size ); sheet->SetSize( size );
} }
else if( strCompare( "U", line, &line ) ) // Sheet UUID. 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 ]; SCH_FIELD& field = sheet->GetFields()[ fieldId ];
field.SetText( text ); field.SetText( text );
field.SetTextSize( wxSize( size, size ) ); field.SetTextSize( VECTOR2I( size, size ) );
} }
else // Sheet pin. else // Sheet pin.
{ {
@ -620,7 +620,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
sheetPin->SetTextSize( wxSize( size, size ) ); sheetPin->SetTextSize( VECTOR2I( size, size ) );
sheet->AddPin( sheetPin.release() ); sheet->AddPin( sheetPin.release() );
} }
@ -910,7 +910,7 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader )
line = aReader.ReadLine(); line = aReader.ReadLine();
VECTOR2I pos; VECTOR2I pos;
wxSize size; VECTOR2I size;
pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) ); pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pos.y = 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 ) ); 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. // Parse the global and hierarchical label type.
if( text->Type() == SCH_HIER_LABEL_T || text->Type() == SCH_GLOBAL_LABEL_T ) 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.SetText( text );
field.SetTextPos( pos ); field.SetTextPos( pos );
field.SetVisible( !attributes ); field.SetVisible( !attributes );
field.SetTextSize( wxSize( size, size ) ); field.SetTextSize( VECTOR2I( size, size ) );
if( orientation == 'H' ) if( orientation == 'H' )
field.SetTextAngle( ANGLE_HORIZONTAL ); field.SetTextAngle( ANGLE_HORIZONTAL );

View File

@ -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 ) : FIELDS_AUTOPLACED aAutoplaceFields ) :
SCH_ITEM( aParent, SCH_SHEET_T ) 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 ) if( aSize == m_size )
return; return;

View File

@ -57,7 +57,7 @@ class SCH_SHEET : public SCH_ITEM
{ {
public: public:
SCH_SHEET( EDA_ITEM* aParent = nullptr, const VECTOR2I& aPos = VECTOR2I( 0, 0 ), 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 ) ), schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ),
FIELDS_AUTOPLACED aAutoplaceFields = FIELDS_AUTOPLACED_AUTO ); FIELDS_AUTOPLACED aAutoplaceFields = FIELDS_AUTOPLACED_AUTO );
@ -105,8 +105,8 @@ public:
SCH_SCREEN* GetScreen() const { return m_screen; } SCH_SCREEN* GetScreen() const { return m_screen; }
wxSize GetSize() const { return m_size; } VECTOR2I GetSize() const { return m_size; }
void SetSize( const wxSize& aSize ) { m_size = aSize; } void SetSize( const VECTOR2I& aSize ) { m_size = aSize; }
int GetBorderWidth() const { return m_borderWidth; } int GetBorderWidth() const { return m_borderWidth; }
void SetBorderWidth( int aWidth ) { m_borderWidth = aWidth; } void SetBorderWidth( int aWidth ) { m_borderWidth = aWidth; }
@ -329,7 +329,7 @@ public:
* *
* @param[in] aSize The new size for this sheet. * @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; void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
@ -498,7 +498,7 @@ private:
std::vector<SCH_FIELD> m_fields; std::vector<SCH_FIELD> m_fields;
VECTOR2I m_pos; // The position of the sheet. 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; int m_borderWidth;
KIGFX::COLOR4D m_borderColor; KIGFX::COLOR4D m_borderColor;
KIGFX::COLOR4D m_backgroundColor; KIGFX::COLOR4D m_backgroundColor;

View File

@ -90,7 +90,7 @@ static LIB_SYMBOL* dummy()
LIB_TEXT* text = new LIB_TEXT( symbol ); 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( "??" ) ) ); text->SetText( wxString( wxT( "??" ) ) );
symbol->AddDrawItem( square ); symbol->AddDrawItem( square );

View File

@ -26,6 +26,7 @@
#include <confirm.h> #include <confirm.h>
#include <kiface_base.h> #include <kiface_base.h>
#include <project.h> #include <project.h>
#include <math/vector2wx.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
@ -542,10 +543,10 @@ bool SCH_EDIT_FRAME::EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHi
void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard() void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
{ {
wxRect DrawArea; wxRect drawArea;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
DrawArea.SetSize( GetPageSizeIU() ); drawArea.SetSize( ToWxSize( GetPageSizeIU() ) );
// Calculate a reasonable dc size, in pixels, and the dc scale to fit // Calculate a reasonable dc size, in pixels, and the dc scale to fit
// the drawings into the dc size // the drawings into the dc size
@ -554,7 +555,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
double inch2Iu = 1000.0 * schIUScale.IU_PER_MILS; double inch2Iu = 1000.0 * schIUScale.IU_PER_MILS;
double scale = ppi / inch2Iu; double scale = ppi / inch2Iu;
wxSize dcsize = DrawArea.GetSize(); wxSize dcsize = drawArea.GetSize();
int maxdim = std::max( dcsize.x, dcsize.y ); int maxdim = std::max( dcsize.x, dcsize.y );

View File

@ -666,7 +666,7 @@ void SIM_MODEL::SetFieldValue( std::vector<T>& aFields, const wxString& aFieldNa
wxASSERT( aFields.size() >= 1 ); wxASSERT( aFields.size() >= 1 );
SCH_ITEM* parent = static_cast<SCH_ITEM*>( aFields.at( 0 ).GetParent() ); SCH_ITEM* parent = static_cast<SCH_ITEM*>( 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<T, LIB_FIELD>::value ) else if constexpr( std::is_same<T, LIB_FIELD>::value )
{ {

View File

@ -1441,7 +1441,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
libField.SetText( field.GetText() ); libField.SetText( field.GetText() );
libField.SetAttributes( field ); libField.SetAttributes( field );
libField.SetPosition( wxPoint( pos.x, -pos.y ) ); libField.SetPosition( VECTOR2I( pos.x, -pos.y ) );
fullSetOfFields.emplace_back( std::move( libField ) ); fullSetOfFields.emplace_back( std::move( libField ) );
} }

View File

@ -63,7 +63,7 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName, VECTOR2I a
{ {
constexpr bool background = true; constexpr bool background = true;
TRANSFORM temp; // Uses default transform TRANSFORM temp; // Uses default transform
wxPoint plotPos; VECTOR2I plotPos;
plotPos.x = aOffset.x; plotPos.x = aOffset.x;
plotPos.y = aOffset.y; plotPos.y = aOffset.y;
@ -89,13 +89,13 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
if( !m_symbol ) if( !m_symbol )
return; 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 /* Plot item centered to the page
* In symbol_editor, the symbol is centered at 0,0 coordinates. * In symbol_editor, the symbol is centered at 0,0 coordinates.
* So we must plot it with an offset = pagesize/2. * So we must plot it with an offset = pagesize/2.
*/ */
wxPoint plot_offset; VECTOR2I plot_offset;
plot_offset.x = pagesize.x / 2; plot_offset.x = pagesize.x / 2;
plot_offset.y = pagesize.y / 2; plot_offset.y = pagesize.y / 2;

View File

@ -573,7 +573,7 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin,
SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings(); SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
SCH_LABEL* label = new SCH_LABEL( driver->GetPosition(), aNewName ); SCH_LABEL* label = new SCH_LABEL( driver->GetPosition(), aNewName );
label->SetParent( &m_frame->Schematic() ); 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->SetTextSpinStyle( spin );
label->SetFlags( IS_NEW ); label->SetFlags( IS_NEW );

View File

@ -981,7 +981,7 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid ) const
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition(); VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition(); VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
VECTOR2I sheetNewPos = sheet->GetPosition(); VECTOR2I sheetNewPos = sheet->GetPosition();
wxSize sheetNewSize = sheet->GetSize(); VECTOR2I sheetNewSize = sheet->GetSize();
gridHelper.SetSnap( aSnapToGrid ); gridHelper.SetSnap( aSnapToGrid );
@ -1004,25 +1004,25 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid ) const
|| isModified( m_editPoints->Point( RECT_BOTLEFT ) ) ) || isModified( m_editPoints->Point( RECT_BOTLEFT ) ) )
{ {
sheetNewPos = topLeft; 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 ) ) ) else if( isModified( m_editPoints->Line( RECT_TOP ) ) )
{ {
sheetNewPos = VECTOR2I( sheet->GetPosition().x, topLeft.y ); 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 ) ) ) else if( isModified( m_editPoints->Line( RECT_LEFT ) ) )
{ {
sheetNewPos = VECTOR2I( topLeft.x, sheet->GetPosition().y ); 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 ) ) ) 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 ) ) ) 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 ) 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: case SHEET_SIDE::BOTTOM:
pin->Move( VECTOR2I( sheet->GetPosition().x - sheetNewPos.x, 0 ) ); pin->Move( VECTOR2I( sheet->GetPosition().x - sheetNewPos.x, 0 ) );
break; break;
case SHEET_SIDE::UNDEFINED: case SHEET_SIDE::UNDEFINED:
break; break;
} }
} }

View File

@ -745,8 +745,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
cursorPos = static_cast<wxPoint>( aEvent.HasPosition() ? aEvent.Position() cursorPos = aEvent.HasPosition() ? aEvent.Position() : controls->GetMousePosition();
: controls->GetMousePosition() );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -998,7 +997,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
} }
textItem->SetTextSpinStyle( m_lastTextOrientation ); 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 ); textItem->SetFlags( IS_NEW | IS_MOVING );
if( !labelItem ) 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 = new SCH_SHEET_PIN( aSheet, VECTOR2I( 0, 0 ), text );
sheetPin->SetFlags( IS_NEW ); 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 ); sheetPin->SetShape( m_lastSheetPinType );
if( !aLabel ) if( !aLabel )
@ -1352,8 +1351,8 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
labelItem->SetBold( m_lastTextBold ); labelItem->SetBold( m_lastTextBold );
labelItem->SetItalic( m_lastTextItalic ); labelItem->SetItalic( m_lastTextItalic );
labelItem->SetTextSpinStyle( m_lastTextOrientation ); labelItem->SetTextSpinStyle( m_lastTextOrientation );
labelItem->SetTextSize( wxSize( sch_settings.m_DefaultTextSize, labelItem->SetTextSize( VECTOR2I( sch_settings.m_DefaultTextSize,
sch_settings.m_DefaultTextSize ) ); sch_settings.m_DefaultTextSize ) );
labelItem->SetFlags( IS_NEW | IS_MOVING ); labelItem->SetFlags( IS_NEW | IS_MOVING );
labelItem->SetText( netName ); labelItem->SetText( netName );
item = labelItem; item = labelItem;
@ -1603,8 +1602,8 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
textbox->SetBold( m_lastTextBold ); textbox->SetBold( m_lastTextBold );
textbox->SetItalic( m_lastTextItalic ); textbox->SetItalic( m_lastTextItalic );
textbox->SetTextSize( wxSize( sch_settings.m_DefaultTextSize, textbox->SetTextSize( VECTOR2I( sch_settings.m_DefaultTextSize,
sch_settings.m_DefaultTextSize ) ); sch_settings.m_DefaultTextSize ) );
textbox->SetTextAngle( m_lastTextAngle ); textbox->SetTextAngle( m_lastTextAngle );
textbox->SetHorizJustify( m_lastTextJust ); textbox->SetHorizJustify( m_lastTextJust );
textbox->SetStroke( m_lastTextboxStroke ); 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 ) ); size.y = std::max( size.y, schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) );
VECTOR2I grid = m_frame->GetNearestGridPosition( pos + size ); 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 ) );
} }

View File

@ -178,8 +178,8 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
undoCmd.PushItem( wrapper ); undoCmd.PushItem( wrapper );
m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS, false, false ); m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS, false, false );
DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_EESCHEMA_MILS, DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, VECTOR2I( MAX_PAGE_SIZE_EESCHEMA_MILS,
MAX_PAGE_SIZE_EESCHEMA_MILS ) ); MAX_PAGE_SIZE_EESCHEMA_MILS ) );
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName ); dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
@ -1513,7 +1513,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
catch( IO_ERROR& ) catch( IO_ERROR& )
{ {
// If it wasn't content, then paste as text object. // 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 text_item->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); // Left alignment
tempScreen->Append( text_item ); tempScreen->Append( text_item );
} }

View File

@ -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_frame->AddToScreen( m_busUnfold.entry, m_frame->GetScreen() );
m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->GetEnd(), aNet ); 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->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
m_busUnfold.label->SetParent( m_frame->GetScreen() ); m_busUnfold.label->SetParent( m_frame->GetScreen() );
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVING ); 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() ) if( !m_wires.empty() )
segment = m_wires.back(); segment = m_wires.back();
wxPoint contextMenuPos; VECTOR2I contextMenuPos;
// Main loop: keep receiving events // Main loop: keep receiving events
while( TOOL_EVENT* evt = Wait() ) 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 // Erase and redraw if necessary
if( flipX != m_busUnfold.flipX || flipY != m_busUnfold.flipY ) if( flipX != m_busUnfold.flipX || flipY != m_busUnfold.flipY )
{ {
wxSize size = entry->GetSize(); VECTOR2I size = entry->GetSize();
int ySign = flipY ? -1 : 1; int ySign = flipY ? -1 : 1;
int xSign = flipX ? -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 ) if( !segment )
m_toolMgr->VetoContextMenuMouseWarp(); m_toolMgr->VetoContextMenuMouseWarp();
contextMenuPos = (wxPoint) cursorPos; contextMenuPos = cursorPos;
m_menu.ShowContextMenu( m_selectionTool->GetSelection() ); m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
} }
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE ) else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )

View File

@ -1658,7 +1658,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
doMoveItem( sheet, tl_gridpt ); doMoveItem( sheet, tl_gridpt );
VECTOR2I newSize = (VECTOR2I) sheet->GetSize() - tl_gridpt + br_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 ); updateItem( sheet, true );
for( SCH_SHEET_PIN* pin : sheet->GetPins() ) for( SCH_SHEET_PIN* pin : sheet->GetPins() )

View File

@ -222,8 +222,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
text->SetConvert( m_frame->GetConvert() ); text->SetConvert( m_frame->GetConvert() );
text->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) ); text->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ), text->SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );
text->SetTextAngle( m_lastTextAngle ); text->SetTextAngle( m_lastTextAngle );
DIALOG_LIB_TEXT_PROPERTIES dlg( m_frame, text ); 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->SetBold( m_lastTextBold );
textbox->SetItalic( m_lastTextItalic ); textbox->SetItalic( m_lastTextItalic );
textbox->SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ), textbox->SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) ); schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );
textbox->SetTextAngle( m_lastTextAngle ); textbox->SetTextAngle( m_lastTextAngle );
textbox->SetHorizJustify( m_lastTextJust ); textbox->SetHorizJustify( m_lastTextJust );

View File

@ -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* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin )
{ {
LIB_PIN* pin = (LIB_PIN*) aSourcePin->Clone(); LIB_PIN* pin = (LIB_PIN*) aSourcePin->Clone();
wxPoint step; VECTOR2I step;
pin->ClearFlags(); pin->ClearFlags();
pin->SetFlags( IS_NEW ); pin->SetFlags( IS_NEW );

View File

@ -20,6 +20,7 @@
#include "symbol_preview_widget.h" #include "symbol_preview_widget.h"
#include <sch_view.h> #include <sch_view.h>
#include <gal/gal_display_options.h> #include <gal/gal_display_options.h>
#include <math/vector2wx.h>
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <sch_preview_panel.h> #include <sch_preview_panel.h>
#include <pgm_base.h> #include <pgm_base.h>
@ -152,7 +153,7 @@ void SYMBOL_PREVIEW_WIDGET::fitOnDrawArea()
// Calculate the drawing area size, in internal units, for a scaling factor = 1.0 // Calculate the drawing area size, in internal units, for a scaling factor = 1.0
view->SetScale( 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 // Calculate the draw scale to fit the drawing area
double scale = std::min( fabs( clientSize.x / m_itemBBox.GetWidth() ), double scale = std::min( fabs( clientSize.x / m_itemBBox.GetWidth() ),
fabs( clientSize.y / m_itemBBox.GetHeight() ) ); fabs( clientSize.y / m_itemBBox.GetHeight() ) );

View File

@ -187,11 +187,11 @@ public:
int GetShapeDim( GERBER_DRAW_ITEM* aParent ); int GetShapeDim( GERBER_DRAW_ITEM* aParent );
public: public:
wxSize m_Size; ///< Horizontal and vertical dimensions. VECTOR2I m_Size; ///< Horizontal and vertical dimensions.
APERTURE_T m_ApertType; ///< Aperture type ( Line, rectangle, circle, APERTURE_T m_ApertType; ///< Aperture type ( Line, rectangle, circle,
///< oval poly, macro ) ///< oval poly, macro )
int m_Num_Dcode; ///< D code value ( >= 10 ) 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, APERTURE_DEF_HOLETYPE m_DrillShape; ///< shape of the hole (0 = no hole, round = 1,
///< rect = 2). ///< rect = 2).
EDA_ANGLE m_Rotation; ///< shape rotation EDA_ANGLE m_Rotation; ///< shape rotation

View File

@ -164,14 +164,14 @@ extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture, APERTURE_T aAperture,
int Dcode_index, int Dcode_index,
const VECTOR2I& aPos, const VECTOR2I& aPos,
wxSize aSize, VECTOR2I aSize,
bool aLayerNegative ); bool aLayerNegative );
extern void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, extern void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index, int Dcode_index,
const VECTOR2I& aStart, const VECTOR2I& aStart,
const VECTOR2I& aEnd, const VECTOR2I& aEnd,
wxSize aPenSize, VECTOR2I aPenSize,
bool aLayerNegative ); bool aLayerNegative );
extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
@ -179,7 +179,7 @@ extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
const VECTOR2I& aStart, const VECTOR2I& aStart,
const VECTOR2I& aEnd, const VECTOR2I& aEnd,
const VECTOR2I& aRelCenter, const VECTOR2I& aRelCenter,
wxSize aPenSize, VECTOR2I aPenSize,
bool aClockwise, bool aClockwise,
bool aMultiquadrant, bool aMultiquadrant,
bool aLayerNegative ); bool aLayerNegative );

View File

@ -236,7 +236,7 @@ public:
VECTOR2I m_ArcCentre; // for arcs only: Center of arc VECTOR2I m_ArcCentre; // for arcs only: Center of arc
SHAPE_POLY_SET m_ShapeAsPolygon; // Polygon shape data from G36 to G37 coordinates SHAPE_POLY_SET m_ShapeAsPolygon; // Polygon shape data from G36 to G37 coordinates
// or for complex shapes which are converted to polygon // 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 // Lines : m_Size.x = m_Size.y = line width
bool m_Flashed; // True for flashed items bool m_Flashed; // True for flashed items
int m_DCode; // DCode used to draw this item. int m_DCode; // DCode used to draw this item.

View File

@ -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 // this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route

View File

@ -428,7 +428,7 @@ public:
void SetPageSettings( const PAGE_INFO& aPageSettings ) override; void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
const PAGE_INFO& GetPageSettings() const 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; } const VECTOR2I& GetGridOrigin() const override { return m_grid_origin; }
void SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; } void SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; }

View File

@ -100,7 +100,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture, APERTURE_T aAperture,
int Dcode_index, int Dcode_index,
const VECTOR2I& aPos, const VECTOR2I& aPos,
wxSize aSize, VECTOR2I aSize,
bool aLayerNegative ) bool aLayerNegative )
{ {
aGbrItem->m_Size = aSize; aGbrItem->m_Size = aSize;
@ -154,7 +154,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index, int Dcode_index,
const VECTOR2I& aStart, const VECTOR2I& aStart,
const VECTOR2I& aEnd, const VECTOR2I& aEnd,
wxSize aPenSize, VECTOR2I aPenSize,
bool aLayerNegative ) bool aLayerNegative )
{ {
aGbrItem->m_Flashed = false; 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. * @param aLayerNegative set to true if the current layer is negative.
*/ */
void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const VECTOR2I& aStart, 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 ) bool aClockwise, bool aMultiquadrant, bool aLayerNegative )
{ {
VECTOR2I center, delta; VECTOR2I center, delta;
@ -336,7 +336,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const VECTOR2I& aStart, con
aGbrItem->SetLayerPolarity( aLayerNegative ); 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 ); aClockwise, aMultiquadrant, aLayerNegative );
aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict ); 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 ) 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; APERTURE_T aperture = APT_CIRCLE;
GERBER_DRAW_ITEM* gbritem; GERBER_DRAW_ITEM* gbritem;

View File

@ -42,7 +42,7 @@ class BASE_SCREEN : public EDA_ITEM
public: public:
BASE_SCREEN( EDA_ITEM* aParent, KICAD_T aType = SCREEN_T ); 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 ) BASE_SCREEN( nullptr, aType )
{ {
InitDataPoints( aPageSizeIU ); InitDataPoints( aPageSizeIU );
@ -54,7 +54,7 @@ public:
~BASE_SCREEN() override { } ~BASE_SCREEN() override { }
void InitDataPoints( const wxSize& aPageSizeInternalUnits ); void InitDataPoints( const VECTOR2I& aPageSizeInternalUnits );
void SetContentModified( bool aModified = true ) { m_flagModified = aModified; } void SetContentModified( bool aModified = true ) { m_flagModified = aModified; }
bool IsContentModified() const { return m_flagModified; } bool IsContentModified() const { return m_flagModified; }

View File

@ -109,12 +109,12 @@ public:
/** /**
* @return the size in pixels of the image * @return the size in pixels of the image
*/ */
wxSize GetSizePixels() const VECTOR2I GetSizePixels() const
{ {
if( m_image ) if( m_image )
return wxSize( m_image->GetWidth(), m_image->GetHeight() ); return VECTOR2I( m_image->GetWidth(), m_image->GetHeight() );
else else
return wxSize( 0, 0 ); return VECTOR2I( 0, 0 );
} }
/** /**

View File

@ -610,7 +610,7 @@ public:
/** /**
* Return the default text size from the layer class for the given layer. * 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. * 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. // Arrays of default values for the various layer classes.
int m_LineThickness[ LAYER_CLASS_COUNT ]; int m_LineThickness[ LAYER_CLASS_COUNT ];
wxSize m_TextSize[ LAYER_CLASS_COUNT ]; VECTOR2I m_TextSize[LAYER_CLASS_COUNT];
int m_TextThickness[ LAYER_CLASS_COUNT ]; int m_TextThickness[ LAYER_CLASS_COUNT ];
bool m_TextItalic[ LAYER_CLASS_COUNT ]; bool m_TextItalic[ LAYER_CLASS_COUNT ];
bool m_TextUpright[ LAYER_CLASS_COUNT ]; bool m_TextUpright[ LAYER_CLASS_COUNT ];

View File

@ -36,7 +36,7 @@ class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
{ {
public: public:
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils, DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils,
const wxSize& aMaxUserSizeMils ); const VECTOR2I& aMaxUserSizeMils );
virtual ~DIALOG_PAGES_SETTINGS(); virtual ~DIALOG_PAGES_SETTINGS();
const wxString GetWksFileName() const wxString GetWksFileName()
@ -121,8 +121,8 @@ protected:
bool m_initialized; bool m_initialized;
bool m_localPrjConfigChanged; /// the page layuout filename was changed bool m_localPrjConfigChanged; /// the page layuout filename was changed
wxBitmap* m_pageBitmap; /// Temporary bitmap for the drawing sheet example. wxBitmap* m_pageBitmap; /// Temporary bitmap for the drawing sheet example.
wxSize m_layout_size; /// Logical drawing sheet size. VECTOR2I m_layout_size; /// Logical drawing sheet size.
wxSize m_maxPageSizeMils; /// The max page size allowed by the caller frame VECTOR2I m_maxPageSizeMils; /// The max page size allowed by the caller frame
PAGE_INFO m_pageInfo; /// Temporary page info. PAGE_INFO m_pageInfo; /// Temporary page info.
bool m_customFmt; /// true if the page selection is custom bool m_customFmt; /// true if the page selection is custom
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions). TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions).

View File

@ -112,7 +112,7 @@ public:
* Works off of GetPageSettings() to return the size of the paper page in * Works off of GetPageSettings() to return the size of the paper page in
* the internal units of this particular view. * 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. * For those frames that support polar coordinates.

View File

@ -116,8 +116,6 @@ namespace EDA_UNIT_UTILS
* @return A std::string object containing the converted value. * @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, 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 ); std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const VECTOR2I& aPoint );
constexpr inline int Mils2IU( const EDA_IU_SCALE& aIuScale, int mils ) constexpr inline int Mils2IU( const EDA_IU_SCALE& aIuScale, int mils )

View File

@ -109,14 +109,9 @@ public:
m_end = aPosition; m_end = aPosition;
} }
inline void SetEndPosition( const wxPoint& aPosition ) inline const VECTOR2I GetEndPosition() const
{ {
m_end = VECTOR2D( aPosition ); return VECTOR2I( m_end.x, m_end.y );
}
inline const wxPoint GetEndPosition() const
{
return wxPoint( m_end.x, m_end.y );
} }
inline void SetSize( int aSize ) inline void SetSize( int aSize )

View File

@ -159,9 +159,9 @@ public:
* variable being passed. Note, this constexpr variable changes depending * variable being passed. Note, this constexpr variable changes depending
* on application, hence why it is passed. * 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: protected:
// only the class implementation(s) may use this constructor // 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: private:
// standard pre-defined sizes // standard pre-defined sizes

View File

@ -128,7 +128,7 @@ public:
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) override; virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
const PAGE_INFO& GetPageSettings() const override; const PAGE_INFO& GetPageSettings() const override;
const wxSize GetPageSizeIU() const override; const VECTOR2I GetPageSizeIU() const override;
const VECTOR2I& GetGridOrigin() const override; const VECTOR2I& GetGridOrigin() const override;
void SetGridOrigin( const VECTOR2I& aPoint ) override; void SetGridOrigin( const VECTOR2I& aPoint ) override;

View File

@ -37,7 +37,7 @@ public:
/** /**
* @param aPageSizeIU is the size of the initial paper page in internal units. * @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_Active_Layer;
PCB_LAYER_ID m_Route_Layer_TOP; PCB_LAYER_ID m_Route_Layer_TOP;

Some files were not shown because too many files have changed in this diff Show More