diff --git a/common/drawing_sheet/ds_data_item.cpp b/common/drawing_sheet/ds_data_item.cpp index 5fe5534bb3..9079b2b194 100644 --- a/common/drawing_sheet/ds_data_item.cpp +++ b/common/drawing_sheet/ds_data_item.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 1992-2013 Jean-Pierre Charras . - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -580,8 +580,10 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE if( j > 0 && !IsInsidePage( j ) ) continue; - text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosIU( j ), textsize, pensize, - m_Font, m_Italic, m_Bold, m_TextColor ); + text = new DS_DRAW_ITEM_TEXT( aCollector->GetIuScale(), this, j, m_FullText, + GetStartPosIU( j ), textsize, pensize, m_Font, m_Italic, + m_Bold, m_TextColor ); + text->SetFlags( itemFlags[ j ] ); m_drawItems.push_back( text ); @@ -677,36 +679,6 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize() if( m_ConstrainedTextSize.y == 0 ) m_ConstrainedTextSize.y = DS_DATA_MODEL::GetTheInstance().m_DefaultTextSize.y; - - if( m_BoundingBoxSize.x || m_BoundingBoxSize.y ) - { - // to know the X and Y size of the line, we should use - // EDA_TEXT::GetTextBox() - // but this function uses integers - // So, to avoid truncations with our unit in mm, use microns. - VECTOR2I size_micron; - #define FSCALE 1000.0 - int linewidth = 0; - size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE ); - size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE ); - DS_DRAW_ITEM_TEXT dummy( this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron, linewidth, - m_Font, m_Italic, m_Bold, m_TextColor ); - dummy.SetMultilineAllowed( true ); - dummy.SetHorizJustify( m_Hjustify ) ; - dummy.SetVertJustify( m_Vjustify ); - dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) ); - - BOX2I rect = dummy.GetTextBox(); - VECTOR2D size; - size.x = rect.GetWidth() / FSCALE; - size.y = rect.GetHeight() / FSCALE; - - if( m_BoundingBoxSize.x && size.x > m_BoundingBoxSize.x ) - m_ConstrainedTextSize.x *= m_BoundingBoxSize.x / size.x; - - if( m_BoundingBoxSize.y && size.y > m_BoundingBoxSize.y ) - m_ConstrainedTextSize.y *= m_BoundingBoxSize.y / size.y; - } } diff --git a/common/drawing_sheet/ds_draw_item.cpp b/common/drawing_sheet/ds_draw_item.cpp index d939b6238a..13ac6d4980 100644 --- a/common/drawing_sheet/ds_draw_item.cpp +++ b/common/drawing_sheet/ds_draw_item.cpp @@ -536,7 +536,7 @@ void DS_DRAW_ITEM_LIST::BuildDrawItemsList( const PAGE_INFO& aPageInfo, if( model.GetCount() == 0 && !model.VoidListAllowed() ) model.LoadDrawingSheet(); - model.SetupDrawEnvironment( aPageInfo, m_milsToIu ); + model.SetupDrawEnvironment( aPageInfo, GetMilsToIUfactor() ); for( DS_DATA_ITEM* wsItem : model.GetItems() ) { diff --git a/common/drawing_sheet/ds_proxy_view_item.cpp b/common/drawing_sheet/ds_proxy_view_item.cpp index c53c2086c0..b518d4f884 100644 --- a/common/drawing_sheet/ds_proxy_view_item.cpp +++ b/common/drawing_sheet/ds_proxy_view_item.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2013-2020 CERN - * Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -34,11 +34,11 @@ using namespace KIGFX; -DS_PROXY_VIEW_ITEM::DS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO* aPageInfo, +DS_PROXY_VIEW_ITEM::DS_PROXY_VIEW_ITEM( const EDA_IU_SCALE& aIuScale, const PAGE_INFO* aPageInfo, const PROJECT* aProject, const TITLE_BLOCK* aTitleBlock, const std::map* aProperties ) : EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type - m_mils2IUscalefactor( aMils2IUscalefactor ), + m_iuScale( aIuScale ), m_titleBlock( aTitleBlock ), m_pageInfo( aPageInfo ), m_pageNumber( "1" ), @@ -56,11 +56,11 @@ const BOX2I DS_PROXY_VIEW_ITEM::ViewBBox() const { BOX2I bbox; - if( m_pageInfo != NULL ) + if( m_pageInfo ) { bbox.SetOrigin( VECTOR2I( 0, 0 ) ); - bbox.SetEnd( VECTOR2I( m_pageInfo->GetWidthMils() * m_mils2IUscalefactor, - m_pageInfo->GetHeightMils() * m_mils2IUscalefactor ) ); + bbox.SetEnd( VECTOR2I( m_iuScale.MilsToIU( m_pageInfo->GetWidthMils() ), + m_iuScale.MilsToIU( m_pageInfo->GetHeightMils() ) ) ); } else { @@ -81,9 +81,6 @@ void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, wxString sheetPath( m_sheetPath.c_str(), wxConvUTF8 ); aDrawList->SetDefaultPenSize( (int) settings->GetDrawingSheetLineWidth() ); - // Adjust the scaling factor: drawing sheet item coordinates and sizes are stored in mils, - // and must be scaled to the same units as the caller - aDrawList->SetMilsToIUfactor( m_mils2IUscalefactor ); aDrawList->SetIsFirstPage( m_isFirstPage ); aDrawList->SetPageNumber( m_pageNumber ); aDrawList->SetSheetCount( m_sheetCount ); @@ -102,7 +99,7 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const { GAL* gal = aView->GetGAL(); RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings(); - DS_DRAW_ITEM_LIST drawList; + DS_DRAW_ITEM_LIST drawList( m_iuScale ); buildDrawList( aView, m_properties, &drawList ); @@ -112,7 +109,7 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const if( flipped ) { gal->Save(); - gal->Translate( VECTOR2D( m_pageInfo->GetWidthMils() * m_mils2IUscalefactor, 0 ) ); + gal->Translate( VECTOR2D( m_iuScale.MilsToIU( m_pageInfo->GetWidthMils() ), 0 ) ); gal->Scale( VECTOR2D( -1.0, 1.0 ) ); } @@ -136,7 +133,7 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const // Draw gray line that outlines the sheet size if( settings->GetShowPageLimits() ) - ws_painter.DrawBorder( m_pageInfo, m_mils2IUscalefactor ); + ws_painter.DrawBorder( m_pageInfo, m_iuScale.IU_PER_MILS ); if( flipped ) gal->Restore(); @@ -153,7 +150,7 @@ void DS_PROXY_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const bool DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const VECTOR2I& aPosition ) { int accuracy = (int) aView->ToWorld( 5.0 ); // five pixels at current zoom - DS_DRAW_ITEM_LIST drawList; + DS_DRAW_ITEM_LIST drawList( m_iuScale ); buildDrawList( aView, m_properties, &drawList ); diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 213b1b9bf4..5e96c44e4b 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -982,10 +982,10 @@ void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPage const wxString& aPageNumber, double aMils2Iu, const PROJECT* aProject, const wxString& aSheetLayer, bool aIsFirstPage ) { - DS_DRAW_ITEM_LIST drawList; + DS_DRAW_ITEM_LIST drawList( unityScale ); drawList.SetDefaultPenSize( aSettings->GetDefaultPenWidth() ); - drawList.SetMilsToIUfactor( aMils2Iu ); + drawList.SetPlotterMilsToIUfactor( aMils2Iu ); drawList.SetPageNumber( aPageNumber ); drawList.SetSheetCount( aSheetCount ); drawList.SetFileName( aFileName ); diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 46174625b1..609f699f04 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -356,13 +356,22 @@ void EDA_TEXT::SetLineSpacing( double aLineSpacing ) } -void EDA_TEXT::SetTextSize( const VECTOR2I& aNewSize ) +void EDA_TEXT::SetTextSize( VECTOR2I aNewSize ) { - int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS ); - int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS ); + if( m_IuScale.get().IU_PER_MM != unityScale.IU_PER_MM ) + { + // Plotting uses unityScale and independently scales the text. If we clamp here we'll + // clamp to *really* small values. + + int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS ); + int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS ); + + aNewSize = VECTOR2I( alg::clamp( min, aNewSize.x, max ), + alg::clamp( min, aNewSize.y, max ) ); + } + + m_attributes.m_Size = aNewSize; - m_attributes.m_Size = VECTOR2I( alg::clamp( min, aNewSize.x, max ), - alg::clamp( min, aNewSize.y, max ) ); ClearRenderCache(); m_bounding_box_cache_valid = false; } diff --git a/common/plotters/common_plot_functions.cpp b/common/plotters/common_plot_functions.cpp index 8d75e77000..e7a902d287 100644 --- a/common/plotters/common_plot_functions.cpp +++ b/common/plotters/common_plot_functions.cpp @@ -65,14 +65,14 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL if( plotColor == COLOR4D::UNSPECIFIED ) plotColor = COLOR4D( RED ); - DS_DRAW_ITEM_LIST drawList; + DS_DRAW_ITEM_LIST drawList( unityScale ); // Print only a short filename, if aFilename is the full filename wxFileName fn( aFilename ); // Prepare plot parameters drawList.SetDefaultPenSize( PLOTTER::USE_DEFAULT_LINE_WIDTH ); - drawList.SetMilsToIUfactor( iusPerMil ); + drawList.SetPlotterMilsToIUfactor( iusPerMil ); drawList.SetPageNumber( aSheetNumber ); drawList.SetSheetCount( aSheetCount ); drawList.SetFileName( fn.GetFullName() ); // Print only the short filename diff --git a/eeschema/dialogs/panel_eeschema_color_settings.cpp b/eeschema/dialogs/panel_eeschema_color_settings.cpp index 509e326bfb..626c9bf2fa 100644 --- a/eeschema/dialogs/panel_eeschema_color_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_color_settings.cpp @@ -250,8 +250,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems() m_page->SetHeightMils( 5000 ); m_page->SetWidthMils( 6000 ); - m_drawingSheet = new DS_PROXY_VIEW_ITEM( (int) schIUScale.IU_PER_MILS, m_page, nullptr, - m_titleBlock, nullptr ); + m_drawingSheet = new DS_PROXY_VIEW_ITEM( schIUScale, m_page, nullptr, m_titleBlock, nullptr ); m_drawingSheet->SetColorLayer( LAYER_SCHEMATIC_DRAWINGSHEET ); m_drawingSheet->SetPageBorderColorLayer( LAYER_SCHEMATIC_PAGE_LIMITS ); view->Add( m_drawingSheet ); diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index df0a030271..c844583db3 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -170,7 +170,7 @@ int ERC_TESTER::TestDuplicateSheetNames( bool aCreateMarker ) void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet ) { - DS_DRAW_ITEM_LIST wsItems; + DS_DRAW_ITEM_LIST wsItems( schIUScale ); auto unresolved = [this]( wxString str ) { @@ -180,7 +180,6 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet ) if( aDrawingSheet ) { - wsItems.SetMilsToIUfactor( schIUScale.IU_PER_MILS ); wsItems.SetPageNumber( wxS( "1" ) ); wsItems.SetSheetCount( 1 ); wsItems.SetFileName( wxS( "dummyFilename" ) ); diff --git a/eeschema/sch_view.cpp b/eeschema/sch_view.cpp index 6f4f82d0a6..c308cc50d7 100644 --- a/eeschema/sch_view.cpp +++ b/eeschema/sch_view.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013-2018 CERN - * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors. * * @author Tomasz Wlostowski * @author Maciej Suminski @@ -95,8 +95,7 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen ) for( SCH_ITEM* item : aScreen->Items() ) Add( item ); - m_drawingSheet.reset( new DS_PROXY_VIEW_ITEM( static_cast( schIUScale.IU_PER_MILS ), - &aScreen->GetPageSettings(), + m_drawingSheet.reset( new DS_PROXY_VIEW_ITEM( schIUScale, &aScreen->GetPageSettings(), &aScreen->Schematic()->Prj(), &aScreen->GetTitleBlock(), aScreen->Schematic()->GetProperties() ) ); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index c70eb6a2a5..05e0d0073d 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -826,9 +826,8 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) GERBVIEW_DRAW_PANEL_GAL* drawPanel = static_cast( GetCanvas() ); // Prepare drawing-sheet template - DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( gerbIUScale.IU_PER_MILS, - &GetPageSettings(), &Prj(), - &GetTitleBlock(), nullptr ); + DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( gerbIUScale, &GetPageSettings(), + &Prj(), &GetTitleBlock(), nullptr ); if( GetScreen() ) { diff --git a/include/drawing_sheet/ds_draw_item.h b/include/drawing_sheet/ds_draw_item.h index b815ae71ba..fa9b9a2ddd 100644 --- a/include/drawing_sheet/ds_draw_item.h +++ b/include/drawing_sheet/ds_draw_item.h @@ -310,12 +310,13 @@ private: class DS_DRAW_ITEM_TEXT : public DS_DRAW_ITEM_BASE, public EDA_TEXT { public: - DS_DRAW_ITEM_TEXT( DS_DATA_ITEM* aPeer, int aIndex, const wxString& aText, const VECTOR2I& aPos, - const VECTOR2I& aSize, int aPenWidth, KIFONT::FONT* aFont, + DS_DRAW_ITEM_TEXT( const EDA_IU_SCALE& aIuScale, DS_DATA_ITEM* aPeer, int aIndex, + const wxString& aText, const VECTOR2I& aPos, const VECTOR2I& aSize, + int aPenWidth, KIFONT::FONT* aFont, bool aItalic = false, bool aBold = false, const KIGFX::COLOR4D& aColor = KIGFX::COLOR4D::UNSPECIFIED ) : DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T), - EDA_TEXT( drawSheetIUScale, aText ) + EDA_TEXT( aIuScale, aText ) { SetTextPos( aPos ); SetTextSize( aSize ); @@ -394,10 +395,11 @@ private: class DS_DRAW_ITEM_LIST { public: - DS_DRAW_ITEM_LIST() + DS_DRAW_ITEM_LIST( const EDA_IU_SCALE& aIuScale ) : + m_iuScale( aIuScale ) { m_idx = 0; - m_milsToIu = 1.0; + m_plotterMilsToIu = 0.0; m_penSize = 1; m_pageNumber = "1"; m_sheetCount = 1; @@ -455,14 +457,25 @@ public: int GetDefaultPenSize() const { return m_penSize; } /** - * Set the scalar to convert pages units (mils) to draw/plot units + * Set the scalar to convert pages units (mils) to plot units. */ - void SetMilsToIUfactor( double aMils2Iu ) { m_milsToIu = aMils2Iu; } + void SetPlotterMilsToIUfactor( double aMils2Iu ) { m_plotterMilsToIu = aMils2Iu; } /** - * Get the scalar to convert pages units (mils) to draw/plot units + * Get the scalar to convert pages units (mils) to draw/plot units. + * + * This will be controlled by EITHER the parent frame's EDA_IU_SCALE or the plotter's + * mils-to-iu factor. */ - double GetMilsToIUfactor() { return m_milsToIu; } + double GetMilsToIUfactor() + { + if( m_plotterMilsToIu > 0.0 ) + return m_plotterMilsToIu; + else + return m_iuScale.IU_PER_MILS; + } + + const EDA_IU_SCALE& GetIuScale() const { return m_iuScale; } /** * Set the value of the sheet number. @@ -520,7 +533,6 @@ public: * * Before calling this function, some parameters should be initialized by calling: * SetPenSize( aPenWidth ); - * SetMilsToIUfactor( aMils2Iu ); * SetSheetNumber( aSheetNumber ); * SetSheetCount( aSheetCount ); * SetFileName( aFileName ); @@ -544,9 +556,10 @@ public: protected: std::vector m_graphicList; // Items to draw/plot + const EDA_IU_SCALE& m_iuScale; // IU scale for drawing + double m_plotterMilsToIu; // IU scale for plotting + unsigned m_idx; // for GetFirst, GetNext functions - double m_milsToIu; // the scalar to convert pages units ( mils) - // to draw/plot units. int m_penSize; // The default line width for drawings. // used when an item has a pen size = 0 bool m_isFirstPage; ///< Is this the first page or not. diff --git a/include/drawing_sheet/ds_proxy_view_item.h b/include/drawing_sheet/ds_proxy_view_item.h index 4aef062789..3f118ab788 100644 --- a/include/drawing_sheet/ds_proxy_view_item.h +++ b/include/drawing_sheet/ds_proxy_view_item.h @@ -47,8 +47,8 @@ class GAL; class DS_PROXY_VIEW_ITEM : public EDA_ITEM { public: - DS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject, - const TITLE_BLOCK* aTitleBlock, + DS_PROXY_VIEW_ITEM( const EDA_IU_SCALE& aIuScale, const PAGE_INFO* aPageInfo, + const PROJECT* aProject, const TITLE_BLOCK* aTitleBlock, const std::map* aProperties ); /** @@ -128,27 +128,25 @@ protected: DS_DRAW_ITEM_LIST* aDrawList ) const; protected: - /// the factor between mils (units used in drawing sheet and internal units) - /// it is the value IU_PER_MILS used in the caller - int m_mils2IUscalefactor; + const EDA_IU_SCALE& m_iuScale; - std::string m_fileName; - std::string m_sheetName; - std::string m_sheetPath; - const TITLE_BLOCK* m_titleBlock; - const PAGE_INFO* m_pageInfo; - std::string m_pageNumber; - int m_sheetCount; - bool m_isFirstPage; - const PROJECT* m_project; + std::string m_fileName; + std::string m_sheetName; + std::string m_sheetPath; + const TITLE_BLOCK* m_titleBlock; + const PAGE_INFO* m_pageInfo; + std::string m_pageNumber; + int m_sheetCount; + bool m_isFirstPage; + const PROJECT* m_project; const std::map* m_properties; /// Layer that is used for drawing sheet color (LAYER_DRAWINGSHEET is always used for visibility) - int m_colorLayer; + int m_colorLayer; /// Layer that is used for page border color - int m_pageBorderColorLayer; + int m_pageBorderColorLayer; }; #endif /* DS_PROXY_VIEW_ITEM_H */ diff --git a/include/eda_text.h b/include/eda_text.h index 781552a4d3..fcc5c4e668 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -200,7 +200,7 @@ public: void SetLineSpacing( double aLineSpacing ); double GetLineSpacing() const { return m_attributes.m_LineSpacing; } - void SetTextSize( const VECTOR2I& aNewSize ); + void SetTextSize( VECTOR2I aNewSize ); VECTOR2I GetTextSize() const { return m_attributes.m_Size; } void SetTextWidth( int aWidth ); @@ -389,7 +389,7 @@ private: wxString m_shown_text; // Cache of unescaped text for efficient access bool m_shown_text_has_text_var_refs; - std::reference_wrapper m_IuScale; + std::reference_wrapper m_IuScale; mutable wxString m_render_cache_text; mutable const KIFONT::FONT* m_render_cache_font; diff --git a/pagelayout_editor/pl_draw_panel_gal.cpp b/pagelayout_editor/pl_draw_panel_gal.cpp index ef6f254e44..e8cbe033ac 100644 --- a/pagelayout_editor/pl_draw_panel_gal.cpp +++ b/pagelayout_editor/pl_draw_panel_gal.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -97,11 +97,10 @@ void PL_DRAW_PANEL_GAL::DisplayDrawingSheet() // To show the formatted texts instead of raw texts in drawing sheet editor, we need // a dummy DS_DRAW_ITEM_LIST. - DS_DRAW_ITEM_LIST dummy; + DS_DRAW_ITEM_LIST dummy( drawSheetIUScale ); dummy.SetPaperFormat( m_edaFrame->GetPageSettings().GetType() ); dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() ); dummy.SetProject( &m_edaFrame->Prj() ); - dummy.SetMilsToIUfactor( drawSheetIUScale.IU_PER_MILS ); for( DS_DATA_ITEM* dataItem : model.GetItems() ) dataItem->SyncDrawItems( &dummy, m_view ); diff --git a/pagelayout_editor/pl_editor_layout.cpp b/pagelayout_editor/pl_editor_layout.cpp index 66b7adaddd..046d041862 100644 --- a/pagelayout_editor/pl_editor_layout.cpp +++ b/pagelayout_editor/pl_editor_layout.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 CERN - * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Jean-Pierre Charras, jp.charras at wanadoo.fr * * This program is free software; you can redistribute it and/or @@ -26,7 +26,8 @@ #include #include "pl_editor_layout.h" -PL_EDITOR_LAYOUT::PL_EDITOR_LAYOUT() +PL_EDITOR_LAYOUT::PL_EDITOR_LAYOUT() : + m_drawItemList( drawSheetIUScale ) { PAGE_INFO pageInfo( wxT( "A4" ) ); SetPageSettings( pageInfo ); diff --git a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp index f0cf7e4684..1067f13337 100644 --- a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp +++ b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp @@ -504,8 +504,8 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems() m_preview->UpdateColors(); m_preview->DisplayBoard( m_preview->GetBoard() ); - DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( (int) pcbIUScale.IU_PER_MILS, m_page, - nullptr, m_titleBlock, nullptr ); + DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( pcbIUScale, m_page, nullptr, + m_titleBlock, nullptr ); drawingSheet->SetIsFirstPage( true ); drawingSheet->SetColorLayer( LAYER_DRAWINGSHEET ); drawingSheet->SetPageBorderColorLayer( LAYER_PAGE_LIMITS ); diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index 3093933037..b4fd1b50a0 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -299,12 +299,11 @@ void DRC_TEST_PROVIDER_MISC::testTextVars() } ); DS_PROXY_VIEW_ITEM* drawingSheet = m_drcEngine->GetDrawingSheet(); - DS_DRAW_ITEM_LIST drawItems; + DS_DRAW_ITEM_LIST drawItems( pcbIUScale ); if( !drawingSheet || m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) ) return; - drawItems.SetMilsToIUfactor( pcbIUScale.IU_PER_MILS ); drawItems.SetPageNumber( wxT( "1" ) ); drawItems.SetSheetCount( 1 ); drawItems.SetFileName( wxT( "dummyFilename" ) ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 764b5720d4..b1d7366ad3 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -583,7 +583,7 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) PCB_BASE_FRAME::SetPageSettings( aPageSettings ); // Prepare drawing-sheet template - DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( pcbIUScale.IU_PER_MILS, + DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( pcbIUScale, &m_pcb->GetPageSettings(), m_pcb->GetProject(), &m_pcb->GetTitleBlock(),