Browse Source

Commonize page_info by simply making the Iu scale a parameter on call.

7.0
Marek Roszko 3 years ago
parent
commit
bf964d8678
  1. 1
      3d-viewer/dialogs/panel_3D_raytracing_options.cpp
  2. 2
      common/CMakeLists.txt
  3. 1
      common/page_info.cpp
  4. 1
      eeschema/CMakeLists.txt
  5. 1
      eeschema/dialogs/dialog_annotate.cpp
  6. 1
      eeschema/dialogs/dialog_lib_edit_pin_table.cpp
  7. 15
      eeschema/dialogs/dialog_plot_schematic.cpp
  8. 2
      eeschema/dialogs/dialog_print_using_printer.cpp
  9. 2
      eeschema/dialogs/panel_eeschema_color_settings.cpp
  10. 1
      eeschema/lib_pin.cpp
  11. 1
      eeschema/lib_textbox.cpp
  12. 2
      eeschema/sch_base_frame.cpp
  13. 4
      eeschema/sch_edit_frame.cpp
  14. 1
      eeschema/sch_field.cpp
  15. 1
      eeschema/sch_label.cpp
  16. 1
      eeschema/sch_line.cpp
  17. 1
      eeschema/sch_pin.cpp
  18. 2
      eeschema/sch_plugins/altium/sch_altium_plugin.cpp
  19. 2
      eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
  20. 6
      eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp
  21. 1
      eeschema/sch_plugins/kicad/sch_sexpr_lib_plugin_cache.cpp
  22. 1
      eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp
  23. 1
      eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp
  24. 1
      eeschema/sch_plugins/kicad/sch_sexpr_plugin_common.cpp
  25. 2
      eeschema/sch_screen.cpp
  26. 1
      eeschema/sch_text.cpp
  27. 1
      eeschema/sch_textbox.cpp
  28. 4
      eeschema/sch_view.cpp
  29. 6
      eeschema/symbol_editor/symbol_editor_plotter.cpp
  30. 1
      gerbview/CMakeLists.txt
  31. 1
      gerbview/gerber_draw_item.cpp
  32. 7
      gerbview/gerbview_frame.cpp
  33. 38
      include/page_info.h
  34. 1
      pagelayout_editor/CMakeLists.txt
  35. 2
      pagelayout_editor/dialogs/dialogs_for_printing.cpp
  36. 10
      pagelayout_editor/pl_editor_frame.cpp
  37. 1
      pcbnew/dialogs/dialog_export_vrml.cpp
  38. 2
      pcbnew/exporters/gen_drill_report_files.cpp
  39. 2
      pcbnew/footprint_edit_frame.cpp
  40. 1
      pcbnew/footprint_preview_panel.cpp
  41. 1
      pcbnew/import_gfx/dialog_import_gfx.cpp
  42. 3
      pcbnew/netlist_reader/board_netlist_updater.cpp
  43. 4
      pcbnew/pcb_base_frame.cpp
  44. 2
      pcbnew/pcb_edit_frame.cpp
  45. 4
      pcbnew/plot_board_layers.cpp
  46. 4
      pcbnew/plugins/altium/altium_pcb.cpp

1
3d-viewer/dialogs/panel_3D_raytracing_options.cpp

@ -25,6 +25,7 @@
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <eda_3d_viewer_settings.h>
#include <base_units.h>
#include "panel_3D_raytracing_options.h"

2
common/CMakeLists.txt

@ -344,6 +344,7 @@ set( COMMON_SRCS
netclass.cpp
observable.cpp
origin_transforms.cpp
page_info.cpp
paths.cpp
printout.cpp
project.cpp
@ -507,7 +508,6 @@ set( PCB_COMMON_SRCS
eda_shape.cpp
fp_lib_table.cpp
hash_eda.cpp
page_info.cpp
pg_properties.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_base_frame.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_expr_evaluator.cpp

1
common/page_info.cpp

@ -26,6 +26,7 @@
#include <common.h>
#include <page_info.h>
#include <macros.h>
#include <base_units.h> // for Mm2mils
// late arriving wxPAPER_A0, wxPAPER_A1

1
eeschema/CMakeLists.txt

@ -322,7 +322,6 @@ set( EESCHEMA_COMMON_SRCS
${CMAKE_SOURCE_DIR}/common/base_units.cpp
${CMAKE_SOURCE_DIR}/common/eda_shape.cpp
${CMAKE_SOURCE_DIR}/common/eda_text.cpp
${CMAKE_SOURCE_DIR}/common/page_info.cpp
)

1
eeschema/dialogs/dialog_annotate.cpp

@ -24,6 +24,7 @@
#include <sch_edit_frame.h>
#include <base_units.h>
#include <bitmaps.h>
#include <confirm.h>
#include <dialog_annotate_base.h>

1
eeschema/dialogs/dialog_lib_edit_pin_table.cpp

@ -26,6 +26,7 @@
#include "lib_pin.h"
#include "pin_numbers.h"
#include "pgm_base.h"
#include <base_units.h>
#include <bitmaps.h>
#include <confirm.h>
#include <symbol_edit_frame.h>

15
eeschema/dialogs/dialog_plot_schematic.cpp

@ -657,8 +657,8 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFiles( bool aPlotAll, bool aPlotFrameRef,
if( getPlotOriginAndUnits() == HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER )
{
plotOffset.x = plotPage.GetWidthIU() / 2;
plotOffset.y = -plotPage.GetHeightIU() / 2;
plotOffset.x = plotPage.GetWidthIU( IU_PER_MILS ) / 2;
plotOffset.y = -plotPage.GetHeightIU( IU_PER_MILS ) / 2;
}
try
@ -899,8 +899,8 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScr
if( m_plotBackgroundColor->GetValue() && aPlotter->GetColorMode() )
{
aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
wxPoint end( aPlotter->PageSettings().GetWidthIU(),
aPlotter->PageSettings().GetHeightIU() );
wxPoint end( aPlotter->PageSettings().GetWidthIU( IU_PER_MILS ),
aPlotter->PageSettings().GetHeightIU( IU_PER_MILS ) );
aPlotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
}
@ -1093,7 +1093,8 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(), plotter->PageSettings().GetHeightIU() );
wxPoint end( plotter->PageSettings().GetWidthIU( IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( IU_PER_MILS ) );
plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
}
@ -1225,8 +1226,8 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(),
plotter->PageSettings().GetHeightIU() );
wxPoint end( plotter->PageSettings().GetWidthIU( IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( IU_PER_MILS ) );
plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
}

2
eeschema/dialogs/dialog_print_using_printer.cpp

@ -423,7 +423,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
// Change scale factor and offset to print the whole page.
bool printReference = cfg->m_Printing.title_block;
pageSizeIU = aScreen->GetPageSettings().GetSizeIU();
pageSizeIU = aScreen->GetPageSettings().GetSizeIU( IU_PER_MILS );
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect();

2
eeschema/dialogs/panel_eeschema_color_settings.cpp

@ -501,7 +501,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview()
view->SetScale( 1.0 );
VECTOR2D screenSize = view->ToWorld( m_preview->GetClientSize(), false );
VECTOR2I psize( m_page->GetWidthIU(), m_page->GetHeightIU() );
VECTOR2I psize( m_page->GetWidthIU( IU_PER_MILS ), m_page->GetHeightIU( IU_PER_MILS ) );
double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),
fabs( psize.y / screenSize.y ) );

1
eeschema/lib_pin.cpp

@ -23,6 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_units.h>
#include <pgm_base.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>

1
eeschema/lib_textbox.cpp

@ -21,6 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_units.h>
#include <pgm_base.h>
#include <sch_edit_frame.h>
#include <plotters/plotter.h>

2
eeschema/sch_base_frame.cpp

@ -151,7 +151,7 @@ const PAGE_INFO& SCH_BASE_FRAME::GetPageSettings () const
const wxSize SCH_BASE_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU();
return GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
}

4
eeschema/sch_edit_frame.cpp

@ -1670,8 +1670,8 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
if( aIncludeAllVisible )
{
// Get the whole page size and return that
int sizeX = GetScreen()->GetPageSettings().GetWidthIU();
int sizeY = GetScreen()->GetPageSettings().GetHeightIU();
int sizeX = GetScreen()->GetPageSettings().GetWidthIU( IU_PER_MILS );
int sizeY = GetScreen()->GetPageSettings().GetHeightIU( IU_PER_MILS );
bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
}
else

1
eeschema/sch_field.cpp

@ -32,6 +32,7 @@
#include <wx/log.h>
#include <wx/menu.h>
#include <base_units.h>
#include <common.h> // for ExpandTextVars
#include <eda_item.h>
#include <sch_edit_frame.h>

1
eeschema/sch_label.cpp

@ -23,6 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_units.h>
#include <pgm_base.h>
#include <sch_edit_frame.h>
#include <plotters/plotter.h>

1
eeschema/sch_line.cpp

@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_units.h>
#include <bitmaps.h>
#include <string_utils.h>
#include <core/mirror.h>

1
eeschema/sch_pin.cpp

@ -19,6 +19,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <base_units.h>
#include <lib_pin.h>
#include <sch_symbol.h>
#include <sch_pin.h>

2
eeschema/sch_plugins/altium/sch_altium_plugin.cpp

@ -2429,7 +2429,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheet( const std::map<wxString, wxString>& aPropert
m_currentSheet->GetScreen()->SetPageSettings( pageInfo );
m_sheetOffset = { 0, pageInfo.GetHeightIU() };
m_sheetOffset = { 0, pageInfo.GetHeightIU( IU_PER_MILS ) };
}

2
eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp

@ -232,7 +232,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
// Set the new sheet size.
sheet->GetScreen()->SetPageSettings( pageInfo );
wxSize pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU();
wxSize pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
VECTOR2I itemsCentre = sheetBoundingBox.Centre();

6
eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp

@ -755,7 +755,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
// Calculate the already placed items bounding box and the page size to determine
// placement for the new symbols
wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU();
wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
EDA_RECT sheetBbox = getSheetBbox( m_rootSheet );
VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() );
int maxY = sheetBbox.GetY();
@ -940,7 +940,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
targetSheetSize += VECTOR2I( Mils2iu( 1500 ), Mils2iu( 1500 ) );
// Get current Eeschema sheet size.
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
PAGE_INFO pageInfo = m_currentSheet->GetScreen()->GetPageSettings();
// Increase if necessary
@ -953,7 +953,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
// Set the new sheet size.
m_currentSheet->GetScreen()->SetPageSettings( pageInfo );
pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
VECTOR2I itemsCentre = sheetBoundingBox.Centre();

1
eeschema/sch_plugins/kicad/sch_sexpr_lib_plugin_cache.cpp

@ -19,6 +19,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <base_units.h>
#include <lib_field.h>
#include <lib_shape.h>
#include <lib_symbol.h>

1
eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp

@ -34,6 +34,7 @@
#include <wx/mstream.h>
#include <wx/tokenzr.h>
#include <base_units.h>
#include <lib_id.h>
#include <lib_shape.h>
#include <lib_pin.h>

1
eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp

@ -29,6 +29,7 @@
#include <wx/log.h>
#include <wx/mstream.h>
#include <advanced_config.h>
#include <base_units.h>
#include <trace_helpers.h>
#include <locale_io.h>
#include <sch_bitmap.h>

1
eeschema/sch_plugins/kicad/sch_sexpr_plugin_common.cpp

@ -18,6 +18,7 @@
*/
#include <advanced_config.h>
#include <base_units.h>
#include <macros.h>
#include <schematic_lexer.h>
#include "sch_sexpr_plugin_common.h"

2
eeschema/sch_screen.cpp

@ -73,7 +73,7 @@ SCH_SCREEN::SCH_SCREEN( EDA_ITEM* aParent ) :
// Suitable for schematic only. For symbol_editor and viewlib, must be set to true
m_Center = false;
InitDataPoints( m_paper.GetSizeIU() );
InitDataPoints( m_paper.GetSizeIU( IU_PER_MILS ) );
}

1
eeschema/sch_text.cpp

@ -23,6 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_units.h>
#include <pgm_base.h>
#include <sch_edit_frame.h>
#include <plotters/plotter.h>

1
eeschema/sch_textbox.cpp

@ -21,6 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_units.h>
#include <pgm_base.h>
#include <sch_edit_frame.h>
#include <plotters/plotter.h>

4
eeschema/sch_view.cpp

@ -82,8 +82,8 @@ void SCH_VIEW::SetScale( double aScale, VECTOR2D aAnchor )
void SCH_VIEW::ResizeSheetWorkingArea( const SCH_SCREEN* aScreen )
{
const PAGE_INFO& page_info = aScreen->GetPageSettings();
double max_size_x = page_info.GetWidthIU() * 3.0;
double max_size_y = page_info.GetHeightIU() * 3.0;
double max_size_x = page_info.GetWidthIU( IU_PER_MILS ) * 3.0;
double max_size_y = page_info.GetHeightIU( IU_PER_MILS ) * 3.0;
m_boundary.SetOrigin( -max_size_x / 4, -max_size_y / 4 );
m_boundary.SetSize( max_size_x, max_size_y );
}

6
eeschema/symbol_editor/symbol_editor_plotter.cpp

@ -65,8 +65,8 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
TRANSFORM temp; // Uses default transform
wxPoint plotPos;
plotPos.x = pageInfo.GetWidthIU() / 2;
plotPos.y = pageInfo.GetHeightIU() / 2;
plotPos.x = pageInfo.GetWidthIU( IU_PER_MILS ) / 2;
plotPos.y = pageInfo.GetHeightIU( IU_PER_MILS ) / 2;
m_symbol->Plot( plotter, GetUnit(), GetConvert(), background, plotPos, temp );
@ -89,7 +89,7 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
if( !m_symbol )
return;
wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU();
wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
/* Plot item centered to the page
* In symbol_editor, the symbol is centered at 0,0 coordinates.

1
gerbview/CMakeLists.txt

@ -77,7 +77,6 @@ set( GERBVIEW_EXTRA_SRCS
${CMAKE_SOURCE_DIR}/common/eda_text.cpp
${CMAKE_SOURCE_DIR}/common/widgets/layer_box_selector.cpp
${CMAKE_SOURCE_DIR}/common/lset.cpp
${CMAKE_SOURCE_DIR}/common/page_info.cpp
)
if( WIN32 )

1
gerbview/gerber_draw_item.cpp

@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <base_units.h>
#include <trigo.h>
#include <bitmaps.h>
#include <eda_text.h>

7
gerbview/gerbview_frame.cpp

@ -19,6 +19,7 @@
*/
#include <kiface_base.h>
#include <base_units.h>
#include <pgm_base.h>
#include <bitmaps.h>
#include <wildcards_and_files_ext.h>
@ -120,7 +121,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
SetVisibleLayers( LSET::AllLayersMask() ); // All draw layers visible.
SetScreen( new BASE_SCREEN( GetPageSettings().GetSizeIU() ) );
SetScreen( new BASE_SCREEN( GetPageSettings().GetSizeIU( IU_PER_MILS ) ) );
// Create the PCB_LAYER_WIDGET *after* SetLayout():
m_LayersManager = new GERBER_LAYER_WIDGET( this, GetCanvas() );
@ -821,7 +822,7 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
m_paper = aPageSettings;
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( IU_PER_MILS ) );
GERBVIEW_DRAW_PANEL_GAL* drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetCanvas() );
@ -854,7 +855,7 @@ const wxSize GERBVIEW_FRAME::GetPageSizeIU() const
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return GetPageSettings().GetSizeIU();
return GetPageSettings().GetSizeIU( IU_PER_MILS );
}

38
include/page_info.h

@ -31,9 +31,9 @@
#define PAGE_INFO_H
#include <wx/string.h>
#include <math/vector2d.h>
#include <richio.h> // for OUTPUTFORMATTER and IO_ERROR
#include <base_units.h> // for IU_PER_MILS
/// Min and max page sizes for clamping, in mils.
#define MIN_PAGE_SIZE_MILS 1000
@ -134,13 +134,35 @@ public:
const VECTOR2I& GetSizeMils() const { return m_size; }
// Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA,
// and either deci-mils or nanometers in PCBNew.
#if defined(PCBNEW) || defined(EESCHEMA) || defined(GERBVIEW) || defined(PL_EDITOR)
int GetWidthIU() const { return IU_PER_MILS * GetWidthMils(); }
int GetHeightIU() const { return IU_PER_MILS * GetHeightMils(); }
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#endif
/**
* Gets the page width in IU
*
* @param aIUScale The IU scale, this is most likely always going to be IU_PER_MILS
* variable being passed. Note, this constexpr variable changes depending
* on application, hence why it is passed.
*/
int GetWidthIU( double aIUScale ) const { return aIUScale * GetWidthMils(); }
/**
* Gets the page height in IU
*
* @param aIUScale The IU scale, this is most likely always going to be IU_PER_MILS
* variable being passed. Note, this constexpr variable changes depending
* on application, hence why it is passed.
*/
int GetHeightIU( double aIUScale ) const { return aIUScale * GetHeightMils(); }
/**
* Gets the page size in internal units
*
* @param aIUScale The IU scale, this is most likely always going to be IU_PER_MILS
* variable being passed. Note, this constexpr variable changes depending
* on application, hence why it is passed.
*/
const wxSize GetSizeIU( double aIUScale ) const
{
return wxSize( GetWidthIU( aIUScale ), GetHeightIU( aIUScale ) );
}
/**
* Set the width of Custom page in mils for any custom page constructed or made via

1
pagelayout_editor/CMakeLists.txt

@ -49,7 +49,6 @@ set( PL_EDITOR_EXTRA_SRCS
${CMAKE_SOURCE_DIR}/common/base_units.cpp
${CMAKE_SOURCE_DIR}/common/eda_text.cpp
${CMAKE_SOURCE_DIR}/common/dialogs/panel_gal_display_options.cpp
${CMAKE_SOURCE_DIR}/common/page_info.cpp
)
if( WIN32 )

2
pagelayout_editor/dialogs/dialogs_for_printing.cpp

@ -169,7 +169,7 @@ void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
// Change scale factor and offset to print the whole page.
pageSizeIU = m_parent->GetPageSettings().GetSizeIU();
pageSizeIU = m_parent->GetPageSettings().GetSizeIU( IU_PER_MILS );
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect();

10
pagelayout_editor/pl_editor_frame.cpp

@ -114,7 +114,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
LoadSettings( config() );
wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU();
wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU( IU_PER_MILS );
SetScreen( new BASE_SCREEN( pageSizeIU ) );
setupTools();
@ -467,7 +467,7 @@ void PL_EDITOR_FRAME::ToPrinter( bool doPreview )
const BOX2I PL_EDITOR_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
{
BOX2I rv( VECTOR2I( 0, 0 ), GetPageLayout().GetPageSettings().GetSizeIU() );
BOX2I rv( VECTOR2I( 0, 0 ), GetPageLayout().GetPageSettings().GetSizeIU( IU_PER_MILS ) );
return rv;
}
@ -563,7 +563,7 @@ void PL_EDITOR_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
m_pageLayout.SetPageSettings( aPageSettings );
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( IU_PER_MILS ) );
}
@ -578,7 +578,7 @@ const wxSize PL_EDITOR_FRAME::GetPageSizeIU() const
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return m_pageLayout.GetPageSettings().GetSizeIU();
return m_pageLayout.GetPageSettings().GetSizeIU( IU_PER_MILS );
}
@ -928,7 +928,7 @@ bool PL_EDITOR_FRAME::GetPageNumberOption() const
#if 1
void PL_EDITOR_FRAME::UpdateMsgPanelInfo()
{
VECTOR2D size = GetPageSettings().GetSizeIU();
VECTOR2D size = GetPageSettings().GetSizeIU( IU_PER_MILS );
std::vector<MSG_PANEL_ITEM> msgItems;
msgItems.emplace_back( _( "Page Width" ), MessageTextFromValue( GetUserUnits(), size.x ) );

1
pcbnew/dialogs/dialog_export_vrml.cpp

@ -28,6 +28,7 @@
#include <wx/dir.h>
#include <base_units.h>
#include <board.h>
#include <confirm.h>
#include <kiface_base.h>

2
pcbnew/exporters/gen_drill_report_files.cpp

@ -112,7 +112,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
case PLOT_FORMAT::SVG:
{
PAGE_INFO pageA4( wxT( "A4" ) );
wxSize pageSizeIU = pageA4.GetSizeIU();
wxSize pageSizeIU = pageA4.GetSizeIU( IU_PER_MILS );
// Reserve a 10 mm margin around the page.
int margin = Millimeter2iu( 10 );

2
pcbnew/footprint_edit_frame.cpp

@ -160,7 +160,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// In Footprint Editor, set the default paper size to A4 for plot/print
SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( IU_PER_MILS ) ) );
// Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools();

1
pcbnew/footprint_preview_panel.cpp

@ -23,6 +23,7 @@
#include <utility>
#include "pcbnew_settings.h"
#include <base_units.h>
#include <board.h>
#include <footprint.h>
#include <eda_draw_frame.h>

1
pcbnew/import_gfx/dialog_import_gfx.cpp

@ -25,6 +25,7 @@
#include <dialogs/html_message_box.h>
#include "dialog_import_gfx.h"
#include <base_units.h>
#include <kiface_base.h>
#include <locale_io.h>
#include <pcb_layer_box_selector.h>

3
pcbnew/netlist_reader/board_netlist_updater.cpp

@ -29,6 +29,7 @@
#include <common.h> // for PAGE_INFO
#include <base_units.h>
#include <board.h>
#include <netinfo.h>
#include <footprint.h>
@ -119,7 +120,7 @@ wxPoint BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition()
else
{
// Position new components in the center of the page when the board is empty.
wxSize pageSize = m_board->GetPageSettings().GetSizeIU();
wxSize pageSize = m_board->GetPageSettings().GetSizeIU( IU_PER_MILS );
bestPosition.x = pageSize.GetWidth() / 2;
bestPosition.y = pageSize.GetHeight() / 2;

4
pcbnew/pcb_base_frame.cpp

@ -528,7 +528,7 @@ void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
m_pcb->SetPageSettings( aPageSettings );
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( IU_PER_MILS ) );
}
@ -543,7 +543,7 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return m_pcb->GetPageSettings().GetSizeIU();
return m_pcb->GetPageSettings().GetSizeIU( IU_PER_MILS );
}

2
pcbnew/pcb_edit_frame.cpp

@ -228,7 +228,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// initialize parameters in m_LayersManager
LoadSettings( config() );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( IU_PER_MILS ) ) );
// PCB drawings start in the upper left corner.
GetScreen()->m_Center = false;

4
pcbnew/plot_board_layers.cpp

@ -973,7 +973,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
const PAGE_INFO* sheet_info;
double paperscale; // Page-to-paper ratio
wxSize paperSizeIU;
wxSize pageSizeIU( pageInfo.GetSizeIU() );
wxSize pageSizeIU( pageInfo.GetSizeIU( IU_PER_MILS ) );
bool autocenter = false;
// Special options: to fit the sheet to an A4 sheet replace the paper size. However there
@ -984,7 +984,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
if( aPlotOpts->GetA4Output() )
{
sheet_info = &pageA4;
paperSizeIU = pageA4.GetSizeIU();
paperSizeIU = pageA4.GetSizeIU( IU_PER_MILS );
paperscale = (double) paperSizeIU.x / pageSizeIU.x;
autocenter = true;
}

4
pcbnew/plugins/altium/altium_pcb.cpp

@ -638,8 +638,8 @@ void ALTIUM_PCB::Parse( const ALTIUM_COMPOUND_FILE& altiumPcbFi
// center board
EDA_RECT bbbox = m_board->GetBoardEdgesBoundingBox();
int w = m_board->GetPageSettings().GetWidthIU();
int h = m_board->GetPageSettings().GetHeightIU();
int w = m_board->GetPageSettings().GetWidthIU( IU_PER_MILS );
int h = m_board->GetPageSettings().GetHeightIU( IU_PER_MILS );
int desired_x = ( w - bbbox.GetWidth() ) / 2;
int desired_y = ( h - bbbox.GetHeight() ) / 2;

Loading…
Cancel
Save