Avoid duplicating similar options in print and plot headers
This commit is contained in:
parent
0d78ca8b1a
commit
31bad5baaa
|
@ -309,7 +309,7 @@ void DIALOG_PLOT::init_Dialog()
|
|||
m_plotInvisibleText->SetValue( m_plotOpts.GetPlotInvisibleText() );
|
||||
|
||||
// Options to plot pads and vias holes
|
||||
m_drillShapeOpt->SetSelection( m_plotOpts.GetDrillMarksType() );
|
||||
m_drillShapeOpt->SetSelection( (int)m_plotOpts.GetDrillMarksType() );
|
||||
|
||||
// Scale option
|
||||
m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
|
||||
|
@ -767,7 +767,6 @@ static bool setInt( int* aResult, int aValue, int aMin, int aMax )
|
|||
void DIALOG_PLOT::applyPlotSettings()
|
||||
{
|
||||
REPORTER& reporter = m_messagesPanel->Reporter();
|
||||
int sel;
|
||||
PCB_PLOT_PARAMS tempOptions;
|
||||
|
||||
tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
|
||||
|
@ -779,8 +778,8 @@ void DIALOG_PLOT::applyPlotSettings()
|
|||
tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
|
||||
tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
|
||||
|
||||
sel = m_drillShapeOpt->GetSelection();
|
||||
tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>( sel ) );
|
||||
int sel = m_drillShapeOpt->GetSelection();
|
||||
tempOptions.SetDrillMarksType( static_cast<DRILL_MARKS>( sel ) );
|
||||
|
||||
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
|
||||
tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
|
||||
|
|
|
@ -180,7 +180,7 @@ bool DIALOG_PRINT_PCBNEW::TransferDataToWindow()
|
|||
onColorModeClicked( dummy );
|
||||
|
||||
// Options to plot pads and vias holes
|
||||
m_drillMarksChoice->SetSelection( settings()->m_DrillMarks );
|
||||
m_drillMarksChoice->SetSelection( (int)settings()->m_DrillMarks );
|
||||
|
||||
// Print all layers one one page or separately
|
||||
m_checkboxPagePerLayer->SetValue( settings()->m_Pagination
|
||||
|
@ -423,8 +423,7 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
|
|||
|
||||
settings()->m_AsItemCheckboxes = m_checkAsItems->GetValue();
|
||||
|
||||
settings()->m_DrillMarks =
|
||||
(PCBNEW_PRINTOUT_SETTINGS::DRILL_MARK_SHAPE_T) m_drillMarksChoice->GetSelection();
|
||||
settings()->m_DrillMarks = static_cast<DRILL_MARKS>( m_drillMarksChoice->GetSelection() );
|
||||
|
||||
if( m_checkboxPagePerLayer->GetValue() )
|
||||
{
|
||||
|
|
|
@ -119,7 +119,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
|
|||
m_subtractMaskFromSilk = false;
|
||||
m_format = PLOT_FORMAT::GERBER;
|
||||
m_mirror = false;
|
||||
m_drillMarks = SMALL_DRILL_SHAPE;
|
||||
m_drillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
|
||||
m_autoScale = false;
|
||||
m_scale = 1.0;
|
||||
m_scaleSelection = 1;
|
||||
|
@ -238,7 +238,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
|
|||
printBool( m_subtractMaskFromSilk ) );
|
||||
aFormatter->Print( aNestLevel+1, "(outputformat %d)\n", static_cast<int>( m_format ) );
|
||||
aFormatter->Print( aNestLevel+1, "(mirror %s)\n", printBool( m_mirror ) );
|
||||
aFormatter->Print( aNestLevel+1, "(drillshape %d)\n", m_drillMarks );
|
||||
aFormatter->Print( aNestLevel+1, "(drillshape %d)\n", (int)m_drillMarks );
|
||||
aFormatter->Print( aNestLevel+1, "(scaleselection %d)\n", m_scaleSelection );
|
||||
aFormatter->Print( aNestLevel+1, "(outputdirectory \"%s\")",
|
||||
(const char*) m_outputDirectory.utf8_str() );
|
||||
|
@ -603,8 +603,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
|
|||
break;
|
||||
|
||||
case T_drillshape:
|
||||
aPcbPlotParams->m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>
|
||||
( parseInt( 0, 2 ) );
|
||||
aPcbPlotParams->m_drillMarks = static_cast<DRILL_MARKS> ( parseInt( 0, 2 ) );
|
||||
break;
|
||||
|
||||
case T_scaleselection:
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <plotters/plotter.h>
|
||||
#include <layer_ids.h>
|
||||
#include <plotprint_opts.h>
|
||||
|
||||
class COLOR_SETTINGS;
|
||||
class PCB_PLOT_PARAMS_PARSER;
|
||||
|
@ -35,12 +36,6 @@ class PCB_PLOT_PARAMS_PARSER;
|
|||
class PCB_PLOT_PARAMS
|
||||
{
|
||||
public:
|
||||
enum DrillMarksType {
|
||||
NO_DRILL_SHAPE = 0,
|
||||
SMALL_DRILL_SHAPE = 1,
|
||||
FULL_DRILL_SHAPE = 2
|
||||
};
|
||||
|
||||
PCB_PLOT_PARAMS();
|
||||
|
||||
void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
|
||||
|
@ -82,8 +77,8 @@ public:
|
|||
void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFplotUnits = aUnit; }
|
||||
DXF_UNITS GetDXFPlotUnits() const { return m_DXFplotUnits; }
|
||||
|
||||
void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; }
|
||||
DrillMarksType GetDrillMarksType() const { return m_drillMarks; }
|
||||
void SetDrillMarksType( DRILL_MARKS aVal ) { m_drillMarks = aVal; }
|
||||
DRILL_MARKS GetDrillMarksType() const { return m_drillMarks; }
|
||||
|
||||
void SetScale( double aVal ) { m_scale = aVal; }
|
||||
double GetScale() const { return m_scale; }
|
||||
|
@ -230,7 +225,7 @@ private:
|
|||
PLOT_FORMAT m_format;
|
||||
|
||||
/// Holes can be not plotted, have a small mark or plotted in actual size
|
||||
DrillMarksType m_drillMarks;
|
||||
DRILL_MARKS m_drillMarks;
|
||||
|
||||
/// Choose how represent text with PS, PDF and DXF drivers
|
||||
PLOT_TEXT_MODE m_textMode;
|
||||
|
|
|
@ -38,9 +38,9 @@ bool PCB_PLOT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOpti
|
|||
|
||||
// Adding drill marks, for copper layers
|
||||
if( ( aSvgPlotOptions.m_printMaskLayer & LSET::AllCuMask() ).any() )
|
||||
plot_opts.SetDrillMarksType( PCB_PLOT_PARAMS::FULL_DRILL_SHAPE );
|
||||
plot_opts.SetDrillMarksType( DRILL_MARKS::FULL_DRILL_SHAPE );
|
||||
else
|
||||
plot_opts.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
|
||||
plot_opts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
|
||||
|
||||
plot_opts.SetSkipPlotNPTH_Pads( false );
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob )
|
|||
|
||||
plotOpts.SetSubtractMaskFromSilk( aGerberJob->m_subtractSolderMaskFromSilk );
|
||||
// Always disable plot pad holes
|
||||
plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
|
||||
plotOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
|
||||
|
||||
plotOpts.SetDisableGerberMacros( aGerberJob->m_disableApertureMacros );
|
||||
plotOpts.SetUseGerberX2format( aGerberJob->m_useX2Format );
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo )
|
||||
: BOARD_PRINTOUT_SETTINGS( aPageInfo )
|
||||
{
|
||||
m_DrillMarks = SMALL_DRILL_SHAPE;
|
||||
m_DrillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
|
||||
m_Pagination = ALL_LAYERS;
|
||||
m_PrintEdgeCutsOnAllPages = true;
|
||||
m_AsItemCheckboxes = false;
|
||||
|
@ -50,7 +50,7 @@ void PCBNEW_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig )
|
|||
|
||||
if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
|
||||
{
|
||||
m_DrillMarks = static_cast<DRILL_MARK_SHAPE_T>( cfg->m_Plot.pads_drill_mode );
|
||||
m_DrillMarks = static_cast<DRILL_MARKS>( cfg->m_Plot.pads_drill_mode );
|
||||
m_Pagination = static_cast<PAGINATION_T>( cfg->m_Plot.all_layers_on_one_page );
|
||||
m_PrintEdgeCutsOnAllPages = cfg->m_Plot.edgecut_on_all_layers;
|
||||
m_Mirror = cfg->m_Plot.mirror;
|
||||
|
@ -64,7 +64,7 @@ void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
|
|||
|
||||
if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
|
||||
{
|
||||
cfg->m_Plot.pads_drill_mode = m_DrillMarks;
|
||||
cfg->m_Plot.pads_drill_mode = (int)m_DrillMarks;
|
||||
cfg->m_Plot.all_layers_on_one_page = m_Pagination;
|
||||
cfg->m_Plot.edgecut_on_all_layers = m_PrintEdgeCutsOnAllPages;
|
||||
cfg->m_Plot.mirror = m_Mirror;
|
||||
|
@ -219,7 +219,7 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
|
|||
aView.SetLayerVisible( layer, true );
|
||||
}
|
||||
|
||||
if( m_pcbnewSettings.m_DrillMarks != PCBNEW_PRINTOUT_SETTINGS::NO_DRILL_SHAPE )
|
||||
if( m_pcbnewSettings.m_DrillMarks != DRILL_MARKS::NO_DRILL_SHAPE )
|
||||
{
|
||||
// Enable hole layers to draw drill marks
|
||||
for( int layer : { LAYER_PAD_PLATEDHOLES, LAYER_NON_PLATEDHOLES, LAYER_VIA_HOLES } )
|
||||
|
@ -239,11 +239,11 @@ void PCBNEW_PRINTOUT::setupPainter( KIGFX::PAINTER& aPainter )
|
|||
|
||||
switch( m_pcbnewSettings.m_DrillMarks )
|
||||
{
|
||||
case PCBNEW_PRINTOUT_SETTINGS::NO_DRILL_SHAPE:
|
||||
case DRILL_MARKS::NO_DRILL_SHAPE:
|
||||
painter.SetDrillMarks( false, 0 );
|
||||
break;
|
||||
|
||||
case PCBNEW_PRINTOUT_SETTINGS::SMALL_DRILL_SHAPE:
|
||||
case DRILL_MARKS::SMALL_DRILL_SHAPE:
|
||||
painter.SetDrillMarks( false, pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) );
|
||||
|
||||
painter.GetSettings()->SetLayerColor( LAYER_PAD_PLATEDHOLES, COLOR4D::BLACK );
|
||||
|
@ -251,7 +251,7 @@ void PCBNEW_PRINTOUT::setupPainter( KIGFX::PAINTER& aPainter )
|
|||
painter.GetSettings()->SetLayerColor( LAYER_VIA_HOLES, COLOR4D::BLACK );
|
||||
break;
|
||||
|
||||
case PCBNEW_PRINTOUT_SETTINGS::FULL_DRILL_SHAPE:
|
||||
case DRILL_MARKS::FULL_DRILL_SHAPE:
|
||||
painter.SetDrillMarks( true );
|
||||
|
||||
painter.GetSettings()->SetLayerColor( LAYER_PAD_PLATEDHOLES, COLOR4D::BLACK );
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <board_printout.h>
|
||||
#include <pcb_painter.h>
|
||||
#include <plotprint_opts.h>
|
||||
|
||||
class BOARD;
|
||||
|
||||
|
@ -30,11 +31,7 @@ struct PCBNEW_PRINTOUT_SETTINGS : BOARD_PRINTOUT_SETTINGS
|
|||
{
|
||||
PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
|
||||
|
||||
enum DRILL_MARK_SHAPE_T {
|
||||
NO_DRILL_SHAPE,
|
||||
SMALL_DRILL_SHAPE,
|
||||
FULL_DRILL_SHAPE
|
||||
} m_DrillMarks;
|
||||
enum DRILL_MARKS m_DrillMarks;
|
||||
|
||||
enum PAGINATION_T {
|
||||
LAYER_PER_PAGE,
|
||||
|
|
|
@ -148,7 +148,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
|
|||
plotOpt.SetSkipPlotNPTH_Pads( false );
|
||||
|
||||
// Disable plot pad holes
|
||||
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
|
||||
plotOpt.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
|
||||
|
||||
// Plot solder mask:
|
||||
if( soldermask_min_thickness == 0 )
|
||||
|
@ -173,7 +173,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
|
|||
plotOpt.SetSkipPlotNPTH_Pads( false );
|
||||
|
||||
// Disable plot pad holes
|
||||
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
|
||||
plotOpt.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
|
||||
|
||||
if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
|
||||
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
|
||||
|
@ -204,7 +204,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
|
|||
aPlotter->SetLayerPolarity( false );
|
||||
|
||||
// Disable plot pad holes
|
||||
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
|
||||
plotOpt.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
|
||||
|
||||
// Plot the mask
|
||||
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
|
||||
|
@ -226,7 +226,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
|
|||
case F_Fab:
|
||||
case B_Fab:
|
||||
plotOpt.SetSkipPlotNPTH_Pads( false );
|
||||
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
|
||||
plotOpt.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
|
||||
|
||||
if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
|
||||
// PlotLayerOutlines() is designed only for DXF plotters.
|
||||
|
@ -239,7 +239,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
|
|||
|
||||
default:
|
||||
plotOpt.SetSkipPlotNPTH_Pads( false );
|
||||
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
|
||||
plotOpt.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
|
||||
|
||||
if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
|
||||
// PlotLayerOutlines() is designed only for DXF plotters.
|
||||
|
@ -373,7 +373,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
|||
pad->SetSize( padPlotsSize );
|
||||
|
||||
if( aPlotOpt.GetSkipPlotNPTH_Pads() &&
|
||||
( aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::NO_DRILL_SHAPE ) &&
|
||||
( aPlotOpt.GetDrillMarksType() == DRILL_MARKS::NO_DRILL_SHAPE ) &&
|
||||
( pad->GetSize() == pad->GetDrillSize() ) &&
|
||||
( pad->GetAttribute() == PAD_ATTRIB::NPTH ) )
|
||||
{
|
||||
|
@ -693,7 +693,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
|||
aPlotter->EndBlock( nullptr );
|
||||
|
||||
// Adding drill marks, if required and if the plotter is able to plot them:
|
||||
if( aPlotOpt.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
|
||||
if( aPlotOpt.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE )
|
||||
itemplotter.PlotDrillMarks();
|
||||
}
|
||||
|
||||
|
@ -735,9 +735,9 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
|||
}
|
||||
|
||||
// Plot pad holes
|
||||
if( aPlotOpt.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
|
||||
if( aPlotOpt.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE )
|
||||
{
|
||||
int smallDrill = ( aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
|
||||
int smallDrill = ( aPlotOpt.GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE )
|
||||
? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) :
|
||||
INT_MAX;
|
||||
|
||||
|
|
|
@ -1126,7 +1126,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
|
|||
{
|
||||
/* If small drills marks were requested prepare a clamp value to pass
|
||||
to the helper function */
|
||||
int smallDrill = GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE
|
||||
int smallDrill = GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE
|
||||
? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) : 0;
|
||||
|
||||
/* In the filled trace mode drill marks are drawn white-on-black to scrape
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PLOTPRINT_H
|
||||
#define PLOTPRINT_H
|
||||
|
||||
/**
|
||||
* Plots and prints can show holes in pads and vias
|
||||
* 3 options are available:
|
||||
* - no hole
|
||||
* - small holes with a fixed size
|
||||
* - holes using the actual size
|
||||
*/
|
||||
enum class DRILL_MARKS
|
||||
{
|
||||
NO_DRILL_SHAPE,
|
||||
SMALL_DRILL_SHAPE,
|
||||
FULL_DRILL_SHAPE
|
||||
};
|
||||
|
||||
#endif /* PLOTPRINT_H */
|
Loading…
Reference in New Issue