diff --git a/common/plotters/plotter_dxf.h b/common/plotters/plotter_dxf.h index dbf43c161f..9c6188c388 100644 --- a/common/plotters/plotter_dxf.h +++ b/common/plotters/plotter_dxf.h @@ -119,13 +119,6 @@ public: void* aData = NULL ) override; - // Must be in the same order as the drop-down list in the plot dialog inside pcbnew - enum class DXF_UNITS - { - INCHES = 0, - MILLIMETERS = 1 - }; - /** * Set the units to use for plotting the DXF file. * diff --git a/include/plotter.h b/include/plotter.h index 66db2e9304..e795195a3c 100644 --- a/include/plotter.h +++ b/include/plotter.h @@ -48,6 +48,16 @@ class GBR_NETLIST_METADATA; using KIGFX::RENDER_SETTINGS; + +// Must be in the same order as the drop-down list in the plot dialog inside pcbnew +// Units (inch/mm for DXF plotter +enum class DXF_UNITS +{ + INCHES = 0, + MILLIMETERS = 1 +}; + + /** * The set of supported output plot formats. * diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index ca1bba4838..ed4d3dc1bd 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -196,7 +196,7 @@ void DIALOG_PLOT::init_Dialog() m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() == PLOT_TEXT_MODE::DEFAULT ); // DXF units selection - m_DXF_plotUnits->SetSelection( static_cast( m_plotOpts.GetDXFPlotUnits() ) ); + m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCHES ? 0 : 1); // Plot mirror option m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() ); @@ -641,7 +641,7 @@ void DIALOG_PLOT::applyPlotSettings() tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() ); sel = m_DXF_plotUnits->GetSelection(); - tempOptions.SetDXFPlotUnits( static_cast( sel ) ); + tempOptions.SetDXFPlotUnits( sel == 0 ? DXF_UNITS::INCHES : DXF_UNITS::MILLIMETERS ); tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() ); diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index eede821d6d..8dac54aad2 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -160,9 +160,9 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER; if( m_unitsMetric ) - dxf_plotter->SetUnits( DXF_PLOTTER::DXF_UNITS::MILLIMETERS ); + dxf_plotter->SetUnits( DXF_UNITS::MILLIMETERS ); else - dxf_plotter->SetUnits( DXF_PLOTTER::DXF_UNITS::INCHES ); + dxf_plotter->SetUnits( DXF_UNITS::INCHES ); plotter = dxf_plotter; plotter->SetPageSettings( page_info ); diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 8eef01eb45..803804a248 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -111,7 +111,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() m_plotViaOnMaskLayer = false; m_plotMode = FILLED; m_DXFplotPolygonMode = true; - m_DXFplotUnits = DXF_PLOTTER::DXF_UNITS::INCHES; + m_DXFplotUnits = DXF_UNITS::INCHES; m_useAuxOrigin = false; m_HPGLPenNum = 1; m_HPGLPenSpeed = 20; // this param is always in cm/s diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index b6a17ea3d0..a3a86de3da 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -64,7 +64,7 @@ private: /** * DXF format: Units to use when plotting the DXF */ - DXF_PLOTTER::DXF_UNITS m_DXFplotUnits; + DXF_UNITS m_DXFplotUnits; /// Plot format type (chooses the driver to be used) PLOT_FORMAT m_format; @@ -229,12 +229,12 @@ public: void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; } bool GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; } - void SetDXFPlotUnits( DXF_PLOTTER::DXF_UNITS aUnit ) + void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFplotUnits = aUnit; } - DXF_PLOTTER::DXF_UNITS GetDXFPlotUnits() const + DXF_UNITS GetDXFPlotUnits() const { return m_DXFplotUnits; } diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index dae00943f6..22eccee177 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -1029,8 +1029,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer, case PLOT_FORMAT::DXF: DXF_PLOTTER* DXF_plotter; DXF_plotter = new DXF_PLOTTER(); - DXF_plotter->SetUnits( - static_cast( aPlotOpts->GetDXFPlotUnits() ) ); + DXF_plotter->SetUnits( aPlotOpts->GetDXFPlotUnits() ); plotter = DXF_plotter; break;