Change more enums over to scoped enums

This commit is contained in:
Mark Roszko 2019-12-28 00:55:11 +00:00 committed by Ian McInerney
parent a860ac5066
commit 19ceb11ae7
95 changed files with 1006 additions and 800 deletions

View File

@ -289,16 +289,16 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// ADD VIAS and THT // ADD VIAS and THT
if( track->Type() == PCB_VIA_T ) if( track->Type() == PCB_VIA_T )
{ {
const VIA *via = static_cast< const VIA*>( track ); const VIA* via = static_cast<const VIA*>( track );
const VIATYPE_T viatype = via->GetViaType(); const VIATYPE viatype = via->GetViaType();
const float holediameter = via->GetDrillValue() * BiuTo3Dunits(); const float holediameter = via->GetDrillValue() * BiuTo3Dunits();
const float thickness = GetCopperThickness3DU(); const float thickness = GetCopperThickness3DU();
const float hole_inner_radius = ( holediameter / 2.0f ); const float hole_inner_radius = ( holediameter / 2.0f );
const SFVEC2F via_center( via->GetStart().x * m_biuTo3Dunits, const SFVEC2F via_center(
-via->GetStart().y * m_biuTo3Dunits ); via->GetStart().x * m_biuTo3Dunits, -via->GetStart().y * m_biuTo3Dunits );
if( viatype != VIA_THROUGH ) if( viatype != VIATYPE::THROUGH )
{ {
// Add hole objects // Add hole objects
@ -374,9 +374,9 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
if( track->Type() == PCB_VIA_T ) if( track->Type() == PCB_VIA_T )
{ {
const VIA *via = static_cast< const VIA*>( track ); const VIA *via = static_cast< const VIA*>( track );
const VIATYPE_T viatype = via->GetViaType(); const VIATYPE viatype = via->GetViaType();
if( viatype != VIA_THROUGH ) if( viatype != VIATYPE::THROUGH )
{ {
// Add VIA hole contourns // Add VIA hole contourns

View File

@ -1000,7 +1000,8 @@ void C3D_RENDER_RAYTRACING::insert3DViaHole( const VIA* aVia )
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) ) if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
objPtr->SetColor( ConvertSRGBToLinear( (SFVEC3F)m_settings.m_CopperColor ) ); objPtr->SetColor( ConvertSRGBToLinear( (SFVEC3F)m_settings.m_CopperColor ) );
else else
objPtr->SetColor( ConvertSRGBToLinear( m_settings.GetItemColor( LAYER_VIAS + aVia->GetViaType() ) ) ); objPtr->SetColor( ConvertSRGBToLinear(
m_settings.GetItemColor( LAYER_VIAS + static_cast<int>( aVia->GetViaType() ) ) ) );
m_object_container.Add( objPtr ); m_object_container.Add( objPtr );
} }

View File

@ -136,11 +136,11 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_
if( IsType( scanTypes ) ) if( IsType( scanTypes ) )
{ {
if( SEARCH_QUIT == inspector( this, testData ) ) if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -95,18 +95,23 @@ static const struct
}; };
static const char* getDXFLineType( PlotDashType aType ) static const char* getDXFLineType( PLOT_DASH_TYPE aType )
{ {
switch( aType ) switch( aType )
{ {
case PLOTDASHTYPE_SOLID: return "CONTINUOUS"; case PLOT_DASH_TYPE::DEFAULT:
case PLOTDASHTYPE_DASH: return "DASHED"; case PLOT_DASH_TYPE::SOLID:
case PLOTDASHTYPE_DOT: return "DOTTED"; return "CONTINUOUS";
case PLOTDASHTYPE_DASHDOT: return "DASHDOT"; case PLOT_DASH_TYPE::DASH:
return "DASHED";
case PLOT_DASH_TYPE::DOT:
return "DOTTED";
case PLOT_DASH_TYPE::DASHDOT:
return "DASHDOT";
default:
wxFAIL_MSG( "Unhandled PLOT_DASH_TYPE" );
return "CONTINUOUS";
} }
wxFAIL_MSG( "Unhandled PlotDashType" );
return "CONTINUOUS";
} }
@ -589,10 +594,11 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
if( penLastpos != pos && plume == 'D' ) if( penLastpos != pos && plume == 'D' )
{ {
wxASSERT( m_currentLineType >= 0 && m_currentLineType < 4 ); wxASSERT( m_currentLineType >= PLOT_DASH_TYPE::FIRST_TYPE
&& m_currentLineType <= PLOT_DASH_TYPE::LAST_TYPE );
// DXF LINE // DXF LINE
wxString cname = getDXFColorName( m_currentColor ); wxString cname = getDXFColorName( m_currentColor );
const char *lname = getDXFLineType( (PlotDashType) m_currentLineType ); const char* lname = getDXFLineType( static_cast<PLOT_DASH_TYPE>( m_currentLineType ) );
fprintf( outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n", fprintf( outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
TO_UTF8( cname ), lname, TO_UTF8( cname ), lname,
pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y ); pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
@ -601,10 +607,10 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
} }
void DXF_PLOTTER::SetDash( int dashed ) void DXF_PLOTTER::SetDash( PLOT_DASH_TYPE aDashed )
{ {
wxASSERT( dashed >= 0 && dashed < 4 ); wxASSERT( aDashed >= PLOT_DASH_TYPE::FIRST_TYPE && aDashed <= PLOT_DASH_TYPE::LAST_TYPE );
m_currentLineType = dashed; m_currentLineType = aDashed;
} }

View File

@ -421,19 +421,19 @@ void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
/** /**
* HPGL supports dashed lines * HPGL supports dashed lines
*/ */
void HPGL_PLOTTER::SetDash( int dashed ) void HPGL_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
switch( dashed ) switch( dashed )
{ {
case PLOTDASHTYPE_DASH: case PLOT_DASH_TYPE::DASH:
fprintf( outputFile, "LT -2 4 1;\n" ); fprintf( outputFile, "LT -2 4 1;\n" );
break; break;
case PLOTDASHTYPE_DOT: case PLOT_DASH_TYPE::DOT:
fprintf( outputFile, "LT -1 2 1;\n" ); fprintf( outputFile, "LT -1 2 1;\n" );
break; break;
case PLOTDASHTYPE_DASHDOT: case PLOT_DASH_TYPE::DASHDOT:
fprintf( outputFile, "LT -4 6 1;\n" ); fprintf( outputFile, "LT -4 6 1;\n" );
break; break;
default: default:

View File

@ -131,20 +131,20 @@ void PDF_PLOTTER::emitSetRGBColor( double r, double g, double b )
/** /**
* PDF supports dashed lines * PDF supports dashed lines
*/ */
void PDF_PLOTTER::SetDash( int dashed ) void PDF_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
{ {
wxASSERT( workFile ); wxASSERT( workFile );
switch( dashed ) switch( dashed )
{ {
case PLOTDASHTYPE_DASH: case PLOT_DASH_TYPE::DASH:
fprintf( workFile, "[%d %d] 0 d\n", fprintf( workFile, "[%d %d] 0 d\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU() ); (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
break; break;
case PLOTDASHTYPE_DOT: case PLOT_DASH_TYPE::DOT:
fprintf( workFile, "[%d %d] 0 d\n", fprintf( workFile, "[%d %d] 0 d\n",
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
break; break;
case PLOTDASHTYPE_DASHDOT: case PLOT_DASH_TYPE::DASHDOT:
fprintf( workFile, "[%d %d %d %d] 0 d\n", fprintf( workFile, "[%d %d %d %d] 0 d\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU(), (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );

View File

@ -553,19 +553,19 @@ void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
/** /**
* Postscript supports dashed lines * Postscript supports dashed lines
*/ */
void PS_PLOTTER::SetDash( int dashed ) void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
{ {
switch( dashed ) switch( dashed )
{ {
case PLOTDASHTYPE_DASH: case PLOT_DASH_TYPE::DASH:
fprintf( outputFile, "[%d %d] 0 setdash\n", fprintf( outputFile, "[%d %d] 0 setdash\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU() ); (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
break; break;
case PLOTDASHTYPE_DOT: case PLOT_DASH_TYPE::DOT:
fprintf( outputFile, "[%d %d] 0 setdash\n", fprintf( outputFile, "[%d %d] 0 setdash\n",
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
break; break;
case PLOTDASHTYPE_DASHDOT: case PLOT_DASH_TYPE::DASHDOT:
fprintf( outputFile, "[%d %d %d %d] 0 setdash\n", fprintf( outputFile, "[%d %d %d %d] 0 setdash\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU(), (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
@ -999,7 +999,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
// Draw the native postscript text (if requested) // Draw the native postscript text (if requested)
// Currently: does not work: disable it // Currently: does not work: disable it
bool use_native = false; // = m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed; bool use_native = false; // = m_textMode == PLOT_TEXT_MODE::NATIVE && !aMultilineAllowed;
if( use_native ) if( use_native )
{ {
@ -1046,7 +1046,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
} }
// Draw the hidden postscript text (if requested) // Draw the hidden postscript text (if requested)
if( m_textMode == PLOTTEXTMODE_PHANTOM ) if( m_textMode == PLOT_TEXT_MODE::PHANTOM )
{ {
fputsPostscriptString( outputFile, aText ); fputsPostscriptString( outputFile, aText );
DPOINT pos_dev = userToDeviceCoordinates( aPos ); DPOINT pos_dev = userToDeviceCoordinates( aPos );

View File

@ -166,11 +166,11 @@ static wxString XmlEsc( const wxString& aStr, bool isAttribute = false )
SVG_PLOTTER::SVG_PLOTTER() SVG_PLOTTER::SVG_PLOTTER()
{ {
m_graphics_changed = true; m_graphics_changed = true;
SetTextMode( PLOTTEXTMODE_STROKE ); SetTextMode( PLOT_TEXT_MODE::STROKE );
m_fillMode = NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR m_fillMode = NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
m_pen_rgb_color = 0; // current color value (black) m_pen_rgb_color = 0; // current color value (black)
m_brush_rgb_color = 0; // current color value (black) m_brush_rgb_color = 0; // current color value (black)
m_dashed = false; m_dashed = PLOT_DASH_TYPE::SOLID;
} }
@ -238,19 +238,23 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
m_pen_rgb_color, pen_w ); m_pen_rgb_color, pen_w );
fputs( "stroke-linecap:round; stroke-linejoin:round;", outputFile ); fputs( "stroke-linecap:round; stroke-linejoin:round;", outputFile );
//set any extra attributes for non-solid lines
switch( m_dashed ) switch( m_dashed )
{ {
case PLOTDASHTYPE_DASH: case PLOT_DASH_TYPE::DASH:
fprintf( outputFile, "stroke-dasharray:%g,%g;", fprintf( outputFile, "stroke-dasharray:%g,%g;", GetDashMarkLenIU(), GetDashGapLenIU() );
GetDashMarkLenIU(), GetDashGapLenIU() );
break; break;
case PLOTDASHTYPE_DOT: case PLOT_DASH_TYPE::DOT:
fprintf( outputFile, "stroke-dasharray:%g,%g;", fprintf( outputFile, "stroke-dasharray:%g,%g;", GetDotMarkLenIU(), GetDashGapLenIU() );
GetDotMarkLenIU(), GetDashGapLenIU() );
break; break;
case PLOTDASHTYPE_DASHDOT: case PLOT_DASH_TYPE::DASHDOT:
fprintf( outputFile, "stroke-dasharray:%g,%g,%g,%g;", fprintf( outputFile, "stroke-dasharray:%g,%g,%g,%g;", GetDashMarkLenIU(), GetDashGapLenIU(),
GetDashMarkLenIU(), GetDashGapLenIU(), GetDotMarkLenIU(), GetDashGapLenIU() ); GetDotMarkLenIU(), GetDashGapLenIU() );
break;
case PLOT_DASH_TYPE::DEFAULT:
case PLOT_DASH_TYPE::SOLID:
default:
//do nothing
break; break;
} }
@ -337,7 +341,7 @@ void SVG_PLOTTER::emitSetRGBColor( double r, double g, double b )
/** /**
* SVG supports dashed lines * SVG supports dashed lines
*/ */
void SVG_PLOTTER::SetDash( int dashed ) void SVG_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
{ {
if( m_dashed != dashed ) if( m_dashed != dashed )
{ {

View File

@ -34,23 +34,29 @@
#include <wx/filename.h> #include <wx/filename.h>
wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat )
wxString GetDefaultPlotExtension( PlotFormat aFormat )
{ {
switch( aFormat ) switch( aFormat )
{ {
case PLOT_FORMAT_DXF: return DXF_PLOTTER::GetDefaultFileExtension(); case PLOT_FORMAT::DXF:
case PLOT_FORMAT_POST: return PS_PLOTTER::GetDefaultFileExtension(); return DXF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_PDF: return PDF_PLOTTER::GetDefaultFileExtension(); case PLOT_FORMAT::POST:
case PLOT_FORMAT_HPGL: return HPGL_PLOTTER::GetDefaultFileExtension(); return PS_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_GERBER: return GERBER_PLOTTER::GetDefaultFileExtension(); case PLOT_FORMAT::PDF:
case PLOT_FORMAT_SVG: return SVG_PLOTTER::GetDefaultFileExtension(); return PDF_PLOTTER::GetDefaultFileExtension();
default: wxASSERT( false ); return wxEmptyString; case PLOT_FORMAT::HPGL:
return HPGL_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::GERBER:
return GERBER_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::SVG:
return SVG_PLOTTER::GetDefaultFileExtension();
default:
wxASSERT( false );
return wxEmptyString;
} }
} }
void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
const PAGE_INFO& aPageInfo, int aSheetNumber, int aNumberOfSheets, const PAGE_INFO& aPageInfo, int aSheetNumber, int aNumberOfSheets,
const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor ) const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor )

View File

@ -1003,12 +1003,12 @@ SEARCH_RESULT LIB_PART::Visit( INSPECTOR aInspector, void* aTestData, const KICA
{ {
if( item.IsType( aFilterTypes ) ) if( item.IsType( aFilterTypes ) )
{ {
if( aInspector( &item, aTestData ) == SEARCH_QUIT ) if( aInspector( &item, aTestData ) == SEARCH_RESULT::QUIT )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -56,7 +56,7 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataToWindow()
{ {
m_width.SetValue( m_line->GetPenSize() ); m_width.SetValue( m_line->GetPenSize() );
setColor( m_line->GetLineColor() ); setColor( m_line->GetLineColor() );
m_lineStyle->SetSelection( m_line->GetLineStyle() ); m_lineStyle->SetSelection( static_cast<int>( m_line->GetLineStyle() ) );
return true; return true;
} }
@ -103,7 +103,7 @@ void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event )
{ {
m_width.SetValue( m_line->GetDefaultWidth() ); m_width.SetValue( m_line->GetDefaultWidth() );
setColor( m_line->GetDefaultColor() ); setColor( m_line->GetDefaultColor() );
m_lineStyle->SetSelection( m_line->GetDefaultStyle() ); m_lineStyle->SetSelection( static_cast<int>( m_line->GetDefaultStyle() ) );
Refresh(); Refresh();
} }

View File

@ -62,12 +62,12 @@ void SCH_EDIT_FRAME::PlotSchematic()
} }
DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) : DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent )
DIALOG_PLOT_SCHEMATIC_BASE( parent ), : DIALOG_PLOT_SCHEMATIC_BASE( parent ),
m_parent( parent ), m_parent( parent ),
m_plotFormat( PLOT_FORMAT_UNDEFINED ), m_plotFormat( PLOT_FORMAT::UNDEFINED ),
m_defaultLineWidth( parent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ), m_defaultLineWidth( parent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
m_penWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true ) m_penWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true )
{ {
m_config = Kiface().KifaceSettings(); m_config = Kiface().KifaceSettings();
m_configChanged = false; m_configChanged = false;
@ -112,17 +112,27 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
m_HPGLPenSize *= IU_PER_MM; m_HPGLPenSize *= IU_PER_MM;
// Switch to the last save plot format // Switch to the last save plot format
long plotfmt; int plotfmt;
m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 ); m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
switch( plotfmt ) switch( static_cast<PLOT_FORMAT>( plotfmt ) )
{ {
default: default:
case PLOT_FORMAT_POST: m_plotFormatOpt->SetSelection( 0 ); break; case PLOT_FORMAT::POST:
case PLOT_FORMAT_PDF: m_plotFormatOpt->SetSelection( 1 ); break; m_plotFormatOpt->SetSelection( 0 );
case PLOT_FORMAT_SVG: m_plotFormatOpt->SetSelection( 2 ); break; break;
case PLOT_FORMAT_DXF: m_plotFormatOpt->SetSelection( 3 ); break; case PLOT_FORMAT::PDF:
case PLOT_FORMAT_HPGL: m_plotFormatOpt->SetSelection( 4 ); break; m_plotFormatOpt->SetSelection( 1 );
break;
case PLOT_FORMAT::SVG:
m_plotFormatOpt->SetSelection( 2 );
break;
case PLOT_FORMAT::DXF:
m_plotFormatOpt->SetSelection( 3 );
break;
case PLOT_FORMAT::HPGL:
m_plotFormatOpt->SetSelection( 4 );
break;
} }
// Set the default line width (pen width which should be used for // Set the default line width (pen width which should be used for
@ -179,23 +189,28 @@ void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& even
} }
PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat() PLOT_FORMAT DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat()
{ {
switch( m_plotFormatOpt->GetSelection() ) switch( m_plotFormatOpt->GetSelection() )
{ {
default: default:
case 0: return PLOT_FORMAT_POST; case 0:
case 1: return PLOT_FORMAT_PDF; return PLOT_FORMAT::POST;
case 2: return PLOT_FORMAT_SVG; case 1:
case 3: return PLOT_FORMAT_DXF; return PLOT_FORMAT::PDF;
case 4: return PLOT_FORMAT_HPGL; case 2:
return PLOT_FORMAT::SVG;
case 3:
return PLOT_FORMAT::DXF;
case 4:
return PLOT_FORMAT::HPGL;
} }
} }
void DIALOG_PLOT_SCHEMATIC::OnPageSizeSelected( wxCommandEvent& event ) void DIALOG_PLOT_SCHEMATIC::OnPageSizeSelected( wxCommandEvent& event )
{ {
if( GetPlotFileFormat() == PLOT_FORMAT_HPGL ) if( GetPlotFileFormat() == PLOT_FORMAT::HPGL )
m_HPGLPaperSizeSelect = m_paperSizeOption->GetSelection(); m_HPGLPaperSizeSelect = m_paperSizeOption->GetSelection();
else else
m_pageSizeSelect = m_paperSizeOption->GetSelection(); m_pageSizeSelect = m_paperSizeOption->GetSelection();
@ -204,7 +219,7 @@ void DIALOG_PLOT_SCHEMATIC::OnPageSizeSelected( wxCommandEvent& event )
void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event ) void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
{ {
PlotFormat fmt = GetPlotFileFormat(); PLOT_FORMAT fmt = GetPlotFileFormat();
if( fmt != m_plotFormat ) if( fmt != m_plotFormat )
{ {
@ -215,7 +230,7 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
int selection; int selection;
if( fmt == PLOT_FORMAT_HPGL ) if( fmt == PLOT_FORMAT::HPGL )
{ {
paperSizes.push_back( _( "A4" ) ); paperSizes.push_back( _( "A4" ) );
paperSizes.push_back( _( "A3" ) ); paperSizes.push_back( _( "A3" ) );
@ -241,12 +256,12 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
m_paperSizeOption->Set( paperSizes ); m_paperSizeOption->Set( paperSizes );
m_paperSizeOption->SetSelection( selection ); m_paperSizeOption->SetSelection( selection );
m_defaultLineWidth.Enable( fmt == PLOT_FORMAT_POST || fmt == PLOT_FORMAT_PDF m_defaultLineWidth.Enable(
|| fmt == PLOT_FORMAT_SVG ); fmt == PLOT_FORMAT::POST || fmt == PLOT_FORMAT::PDF || fmt == PLOT_FORMAT::SVG );
m_plotOriginTitle->Enable( fmt == PLOT_FORMAT_HPGL ); m_plotOriginTitle->Enable( fmt == PLOT_FORMAT::HPGL );
m_plotOriginOpt->Enable( fmt == PLOT_FORMAT_HPGL ); m_plotOriginOpt->Enable( fmt == PLOT_FORMAT::HPGL );
m_penWidth.Enable( fmt == PLOT_FORMAT_HPGL ); m_penWidth.Enable( fmt == PLOT_FORMAT::HPGL );
} }
} }
@ -296,11 +311,21 @@ void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
switch( GetPlotFileFormat() ) switch( GetPlotFileFormat() )
{ {
default: default:
case PLOT_FORMAT_POST: createPSFile( aPlotAll, getPlotFrameRef() ); break; case PLOT_FORMAT::POST:
case PLOT_FORMAT_DXF: CreateDXFFile( aPlotAll, getPlotFrameRef() ); break; createPSFile( aPlotAll, getPlotFrameRef() );
case PLOT_FORMAT_PDF: createPDFFile( aPlotAll, getPlotFrameRef() ); break; break;
case PLOT_FORMAT_SVG: createSVGFile( aPlotAll, getPlotFrameRef() ); break; case PLOT_FORMAT::DXF:
case PLOT_FORMAT_HPGL: createHPGLFile( aPlotAll, getPlotFrameRef() ); break; CreateDXFFile( aPlotAll, getPlotFrameRef() );
break;
case PLOT_FORMAT::PDF:
createPDFFile( aPlotAll, getPlotFrameRef() );
break;
case PLOT_FORMAT::SVG:
createSVGFile( aPlotAll, getPlotFrameRef() );
break;
case PLOT_FORMAT::HPGL:
createHPGLFile( aPlotAll, getPlotFrameRef() );
break;
} }
} }

View File

@ -48,8 +48,8 @@ class DIALOG_PLOT_SCHEMATIC : public DIALOG_PLOT_SCHEMATIC_BASE
private: private:
SCH_EDIT_FRAME* m_parent; SCH_EDIT_FRAME* m_parent;
wxConfigBase* m_config; wxConfigBase* m_config;
bool m_configChanged; // true if a project config param has changed bool m_configChanged; // true if a project config param has changed
PlotFormat m_plotFormat; PLOT_FORMAT m_plotFormat;
static int m_pageSizeSelect; // Static to keep last option for some format static int m_pageSizeSelect; // Static to keep last option for some format
static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
double m_HPGLPenSize; // for HPGL format only: pen size double m_HPGLPenSize; // for HPGL format only: pen size
@ -86,7 +86,7 @@ private:
*/ */
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override; void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
PlotFormat GetPlotFileFormat(); PLOT_FORMAT GetPlotFileFormat();
bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); } bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); }
void setPlotFrameRef( bool aPlot) {m_PlotFrameRefOpt->SetValue( aPlot ); } void setPlotFrameRef( bool aPlot) {m_PlotFrameRefOpt->SetValue( aPlot ); }

View File

@ -80,16 +80,16 @@ SEARCH_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
LIB_ITEM* lib_item = dynamic_cast<LIB_ITEM*>( aItem ); LIB_ITEM* lib_item = dynamic_cast<LIB_ITEM*>( aItem );
if( m_Unit && lib_item && lib_item->GetUnit() && lib_item->GetUnit() != m_Unit ) if( m_Unit && lib_item && lib_item->GetUnit() && lib_item->GetUnit() != m_Unit )
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
if( m_Convert && lib_item && lib_item->GetConvert() && lib_item->GetConvert() != m_Convert ) if( m_Convert && lib_item && lib_item->GetConvert() && lib_item->GetConvert() != m_Convert )
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }
if( aItem->HitTest( m_RefPos, m_Threshold ) ) if( aItem->HitTest( m_RefPos, m_Threshold ) )
Append( aItem ); Append( aItem );
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }
@ -150,7 +150,7 @@ SEARCH_RESULT EE_TYPE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* testData )
// the scanList, so therefore we can collect anything given to us here. // the scanList, so therefore we can collect anything given to us here.
Append( aItem ); Append( aItem );
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -1615,8 +1615,8 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
// If caller wants to inspect component type or and component children types. // If caller wants to inspect component type or and component children types.
if( stype == SCH_LOCATE_ANY_T || stype == Type() ) if( stype == SCH_LOCATE_ANY_T || stype == Type() )
{ {
if( SEARCH_QUIT == aInspector( this, aTestData ) ) if( SEARCH_RESULT::QUIT == aInspector( this, aTestData ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
if( stype == SCH_LOCATE_ANY_T || stype == SCH_FIELD_T ) if( stype == SCH_LOCATE_ANY_T || stype == SCH_FIELD_T )
@ -1624,46 +1624,46 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
// Test the bounding boxes of fields if they are visible and not empty. // Test the bounding boxes of fields if they are visible and not empty.
for( int ii = 0; ii < GetFieldCount(); ii++ ) for( int ii = 0; ii < GetFieldCount(); ii++ )
{ {
if( SEARCH_QUIT == aInspector( GetField( ii ), (void*) this ) ) if( SEARCH_RESULT::QUIT == aInspector( GetField( ii ), (void*) this ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
} }
if( stype == SCH_FIELD_LOCATE_REFERENCE_T ) if( stype == SCH_FIELD_LOCATE_REFERENCE_T )
{ {
if( SEARCH_QUIT == aInspector( GetField( REFERENCE ), (void*) this ) ) if( SEARCH_RESULT::QUIT == aInspector( GetField( REFERENCE ), (void*) this ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
if( stype == SCH_FIELD_LOCATE_VALUE_T ) if( stype == SCH_FIELD_LOCATE_VALUE_T )
{ {
if( SEARCH_QUIT == aInspector( GetField( VALUE ), (void*) this ) ) if( SEARCH_RESULT::QUIT == aInspector( GetField( VALUE ), (void*) this ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
if( stype == SCH_FIELD_LOCATE_FOOTPRINT_T ) if( stype == SCH_FIELD_LOCATE_FOOTPRINT_T )
{ {
if( SEARCH_QUIT == aInspector( GetField( FOOTPRINT ), (void*) this ) ) if( SEARCH_RESULT::QUIT == aInspector( GetField( FOOTPRINT ), (void*) this ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
if( stype == SCH_FIELD_LOCATE_DATASHEET_T ) if( stype == SCH_FIELD_LOCATE_DATASHEET_T )
{ {
if( SEARCH_QUIT == aInspector( GetField( DATASHEET ), (void*) this ) ) if( SEARCH_RESULT::QUIT == aInspector( GetField( DATASHEET ), (void*) this ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
if( stype == SCH_LOCATE_ANY_T || stype == SCH_PIN_T ) if( stype == SCH_LOCATE_ANY_T || stype == SCH_PIN_T )
{ {
for( SCH_PIN& pin : m_pins ) for( SCH_PIN& pin : m_pins )
{ {
if( SEARCH_QUIT == aInspector( &pin, (void*) this ) ) if( SEARCH_RESULT::QUIT == aInspector( &pin, (void*) this ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
} }
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -1255,7 +1255,7 @@ SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( LINE_READER& aReader )
else if( buf == T_STYLE ) else if( buf == T_STYLE )
{ {
parseUnquotedString( buf, aReader, line, &line ); parseUnquotedString( buf, aReader, line, &line );
int style = SCH_LINE::GetLineStyleInternalId( buf ); PLOT_DASH_TYPE style = SCH_LINE::GetLineStyleByName( buf );
wire->SetLineStyle( style ); wire->SetLineStyle( style );
} }
else // should be the color parameter. else // should be the color parameter.

View File

@ -41,30 +41,35 @@
#include <sch_view.h> #include <sch_view.h>
static wxPenStyle getwxPenStyle( PlotDashType aType ) static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType )
{ {
switch( aType ) switch( aType )
{ {
case PLOTDASHTYPE_SOLID: return wxPENSTYLE_SOLID; case PLOT_DASH_TYPE::DEFAULT:
case PLOTDASHTYPE_DASH: return wxPENSTYLE_SHORT_DASH; case PLOT_DASH_TYPE::SOLID:
case PLOTDASHTYPE_DOT: return wxPENSTYLE_DOT; return wxPENSTYLE_SOLID;
case PLOTDASHTYPE_DASHDOT: return wxPENSTYLE_DOT_DASH; case PLOT_DASH_TYPE::DASH:
return wxPENSTYLE_SHORT_DASH;
case PLOT_DASH_TYPE::DOT:
return wxPENSTYLE_DOT;
case PLOT_DASH_TYPE::DASHDOT:
return wxPENSTYLE_DOT_DASH;
default:
wxFAIL_MSG( "Unhandled PlotDashType" );
return wxPENSTYLE_SOLID;
} }
wxFAIL_MSG( "Unhandled PlotDashType" );
return wxPENSTYLE_SOLID;
} }
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) : SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
SCH_ITEM( NULL, SCH_LINE_T ) SCH_ITEM( NULL, SCH_LINE_T )
{ {
m_start = pos; m_start = pos;
m_end = pos; m_end = pos;
m_startIsDangling = m_endIsDangling = false; m_startIsDangling = m_endIsDangling = false;
m_size = 0; m_size = 0;
m_style = -1; m_style = PLOT_DASH_TYPE::DEFAULT;
m_color = COLOR4D::UNSPECIFIED; m_color = COLOR4D::UNSPECIFIED;
switch( layer ) switch( layer )
{ {
@ -101,51 +106,38 @@ EDA_ITEM* SCH_LINE::Clone() const
return new SCH_LINE( *this ); return new SCH_LINE( *this );
} }
static const char* style_names[] =
{ /*
"solid", "dashed", "dotted", "dash_dot", nullptr * Conversion between PLOT_DASH_TYPE values and style names displayed
*/
const std::map<PLOT_DASH_TYPE, const char*> lineStyleNames{
{ PLOT_DASH_TYPE::SOLID, "solid" },
{ PLOT_DASH_TYPE::DASH, "dashed" },
{ PLOT_DASH_TYPE::DASHDOT, "dash_dot" },
{ PLOT_DASH_TYPE::DOT, "dotted" },
}; };
const char* SCH_LINE::GetLineStyleName( int aStyle )
const char* SCH_LINE::GetLineStyleName( PLOT_DASH_TYPE aStyle )
{ {
const char * styleName = style_names[1]; auto resultIt = lineStyleNames.find( aStyle );
switch( aStyle ) //legacy behavior is to default to dash if there is no name
{ return resultIt == lineStyleNames.end() ? lineStyleNames.find( PLOT_DASH_TYPE::DASH )->second :
case PLOTDASHTYPE_SOLID: resultIt->second;
styleName = style_names[0];
break;
default:
case PLOTDASHTYPE_DASH:
styleName = style_names[1];
break;
case PLOTDASHTYPE_DOT:
styleName = style_names[2];
break;
case PLOTDASHTYPE_DASHDOT:
styleName = style_names[3];
break;
}
return styleName;
} }
int SCH_LINE::GetLineStyleInternalId( const wxString& aStyleName ) PLOT_DASH_TYPE SCH_LINE::GetLineStyleByName( const wxString& aStyleName )
{ {
int id = -1; // Default style id PLOT_DASH_TYPE id = PLOT_DASH_TYPE::DEFAULT; // Default style id
for( int ii = 0; style_names[ii] != nullptr; ii++ ) //find the name by value
{ auto resultIt = std::find_if( lineStyleNames.begin(), lineStyleNames.end(),
if( aStyleName == style_names[ii] ) [aStyleName]( const auto& it ) { return it.second == aStyleName; } );
{
id = ii; if( resultIt != lineStyleNames.end() )
break; id = resultIt->first;
}
}
return id; return id;
} }
@ -268,27 +260,33 @@ COLOR4D SCH_LINE::GetLineColor() const
return m_color; return m_color;
} }
int SCH_LINE::GetDefaultStyle() const PLOT_DASH_TYPE SCH_LINE::GetDefaultStyle() const
{ {
if( IsGraphicLine() ) if( IsGraphicLine() )
return PLOTDASHTYPE_DASH; return PLOT_DASH_TYPE::DASH;
return PLOTDASHTYPE_SOLID; return PLOT_DASH_TYPE::SOLID;
} }
void SCH_LINE::SetLineStyle( const int aStyle ) void SCH_LINE::SetLineStyle( const int aStyleId )
{
SetLineStyle( static_cast<PLOT_DASH_TYPE>( aStyleId ) );
}
void SCH_LINE::SetLineStyle( const PLOT_DASH_TYPE aStyle )
{ {
if( aStyle == GetDefaultStyle() ) if( aStyle == GetDefaultStyle() )
m_style = -1; m_style = PLOT_DASH_TYPE::DEFAULT;
else else
m_style = aStyle; m_style = aStyle;
} }
int SCH_LINE::GetLineStyle() const PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
{ {
if( m_style >= 0 ) if( m_style != PLOT_DASH_TYPE::DEFAULT )
return m_style; return m_style;
return GetDefaultStyle(); return GetDefaultStyle();
@ -332,7 +330,7 @@ void SCH_LINE::Print( wxDC* DC, const wxPoint& offset )
wxPoint end = m_end; wxPoint end = m_end;
GRLine( nullptr, DC, start.x, start.y, end.x, end.y, width, color, GRLine( nullptr, DC, start.x, start.y, end.x, end.y, width, color,
getwxPenStyle( (PlotDashType) GetLineStyle() ) ); getwxPenStyle( (PLOT_DASH_TYPE) GetLineStyle() ) );
} }
@ -776,7 +774,7 @@ void SCH_LINE::Plot( PLOTTER* aPlotter )
aPlotter->MoveTo( m_start ); aPlotter->MoveTo( m_start );
aPlotter->FinishTo( m_end ); aPlotter->FinishTo( m_end );
aPlotter->SetDash( 0 ); aPlotter->SetDash( PLOT_DASH_TYPE::SOLID );
} }

View File

@ -25,6 +25,7 @@
#ifndef _SCH_LINE_H_ #ifndef _SCH_LINE_H_
#define _SCH_LINE_H_ #define _SCH_LINE_H_
#include <plotter.h>
#include <sch_item.h> #include <sch_item.h>
class NETLIST_OBJECT_LIST; class NETLIST_OBJECT_LIST;
@ -41,7 +42,7 @@ class SCH_LINE : public SCH_ITEM
wxPoint m_start; ///< Line start point wxPoint m_start; ///< Line start point
wxPoint m_end; ///< Line end point wxPoint m_end; ///< Line end point
int m_size; ///< Line pensize int m_size; ///< Line pensize
int m_style; ///< Line style PLOT_DASH_TYPE m_style; ///< Line style
COLOR4D m_color; ///< Line color COLOR4D m_color; ///< Line color
public: public:
@ -102,18 +103,19 @@ public:
wxPoint GetEndPoint() const { return m_end; } wxPoint GetEndPoint() const { return m_end; }
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; } void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
int GetDefaultStyle() const; PLOT_DASH_TYPE GetDefaultStyle() const;
void SetLineStyle( const int aStyle ); void SetLineStyle( const PLOT_DASH_TYPE aStyle );
int GetLineStyle() const; void SetLineStyle( const int aStyleId );
PLOT_DASH_TYPE GetLineStyle() const;
/// @return the style name from the style id /// @return the style name from the style id
/// (mainly to write it in .sch file /// (mainly to write it in .sch file
static const char* GetLineStyleName( int aStyle ); static const char* GetLineStyleName( PLOT_DASH_TYPE aStyle );
/// @return the style id from the style name /// @return the style id from the style name
/// (mainly to read style from .sch file /// (mainly to read style from .sch file
static int GetLineStyleInternalId( const wxString& aStyleName ); static PLOT_DASH_TYPE GetLineStyleByName( const wxString& aStyleName );
void SetLineColor( const COLOR4D aColor ); void SetLineColor( const COLOR4D aColor );

View File

@ -1118,7 +1118,7 @@ void SCH_PAINTER::draw( SCH_LINE *aLine, int aLayer )
m_gal->SetStrokeColor( color ); m_gal->SetStrokeColor( color );
m_gal->SetLineWidth( width ); m_gal->SetLineWidth( width );
if( aLine->GetLineStyle() <= PLOTDASHTYPE_SOLID || drawingShadows ) if( aLine->GetLineStyle() <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
{ {
m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() ); m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() );
} }
@ -1136,13 +1136,13 @@ void SCH_PAINTER::draw( SCH_LINE *aLine, int aLayer )
switch( aLine->GetLineStyle() ) switch( aLine->GetLineStyle() )
{ {
default: default:
case PLOTDASHTYPE_DASH: case PLOT_DASH_TYPE::DASH:
strokes[0] = strokes[2] = DASH_MARK_LEN( width ); strokes[0] = strokes[2] = DASH_MARK_LEN( width );
break; break;
case PLOTDASHTYPE_DOT: case PLOT_DASH_TYPE::DOT:
strokes[0] = strokes[2] = DOT_MARK_LEN( width ); strokes[0] = strokes[2] = DOT_MARK_LEN( width );
break; break;
case PLOTDASHTYPE_DASHDOT: case PLOT_DASH_TYPE::DASHDOT:
strokes[0] = DASH_MARK_LEN( width ); strokes[0] = DASH_MARK_LEN( width );
strokes[2] = DOT_MARK_LEN( width ); strokes[2] = DOT_MARK_LEN( width );
break; break;

View File

@ -827,8 +827,8 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA
// If caller wants to inspect my type // If caller wants to inspect my type
if( stype == SCH_LOCATE_ANY_T || stype == Type() ) if( stype == SCH_LOCATE_ANY_T || stype == Type() )
{ {
if( SEARCH_QUIT == aInspector( this, NULL ) ) if( SEARCH_RESULT::QUIT == aInspector( this, NULL ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
if( stype == SCH_LOCATE_ANY_T || stype == SCH_SHEET_PIN_T ) if( stype == SCH_LOCATE_ANY_T || stype == SCH_SHEET_PIN_T )
@ -836,13 +836,13 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA
// Test the sheet labels. // Test the sheet labels.
for( size_t i = 0; i < m_pins.size(); i++ ) for( size_t i = 0; i < m_pins.size(); i++ )
{ {
if( SEARCH_QUIT == aInspector( &m_pins[ i ], this ) ) if( SEARCH_RESULT::QUIT == aInspector( &m_pins[i], this ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
} }
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -987,7 +987,7 @@ void EE_SELECTION_TOOL::RebuildSelection()
select( item ); select( item );
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
EDA_ITEM::IterateForward( start, inspector, nullptr, EE_COLLECTOR::AllItems ); EDA_ITEM::IterateForward( start, inspector, nullptr, EE_COLLECTOR::AllItems );

View File

@ -148,7 +148,7 @@ int SCH_EDITOR_CONTROL::UpdateFind( const TOOL_EVENT& aEvent )
else if( item->IsBrightened() ) else if( item->IsBrightened() )
m_selectionTool->UnbrightenItem( item ); m_selectionTool->UnbrightenItem( item );
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
EDA_ITEM* start = m_frame->GetScreen()->GetDrawItems(); EDA_ITEM* start = m_frame->GetScreen()->GetDrawItems();
@ -184,17 +184,17 @@ EDA_ITEM* nextMatch( SCH_SCREEN* aScreen, EDA_ITEM* after, wxFindReplaceData* da
if( after == item ) if( after == item )
after = nullptr; after = nullptr;
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }
if( ( data == &g_markersOnly && item->Type() == SCH_MARKER_T ) if( ( data == &g_markersOnly && item->Type() == SCH_MARKER_T )
|| item->Matches( *data, nullptr ) ) || item->Matches( *data, nullptr ) )
{ {
found = item; found = item;
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
EDA_ITEM::IterateForward( aScreen->GetDrawItems(), inspector, nullptr, EE_COLLECTOR::AllItems ); EDA_ITEM::IterateForward( aScreen->GetDrawItems(), inspector, nullptr, EE_COLLECTOR::AllItems );

View File

@ -81,7 +81,7 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const
SEARCH_RESULT GBR_LAYOUT::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) SEARCH_RESULT GBR_LAYOUT::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{ {
KICAD_T stype; KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE; SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
const KICAD_T* p = scanTypes; const KICAD_T* p = scanTypes;
bool done = false; bool done = false;
@ -105,7 +105,7 @@ SEARCH_RESULT GBR_LAYOUT::Visit( INSPECTOR inspector, void* testData, const KICA
result = gerber->Visit( inspector, testData, p ); result = gerber->Visit( inspector, testData, p );
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
} }
@ -117,7 +117,7 @@ SEARCH_RESULT GBR_LAYOUT::Visit( INSPECTOR inspector, void* testData, const KICA
break; break;
} }
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
} }

View File

@ -42,7 +42,7 @@ SEARCH_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
if( testItem->HitTest( m_RefPos ) ) if( testItem->HitTest( m_RefPos ) )
Append( testItem ); Append( testItem );
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -947,11 +947,11 @@ SEARCH_RESULT GERBER_DRAW_ITEM::Visit( INSPECTOR inspector, void* testData, cons
// If caller wants to inspect my type // If caller wants to inspect my type
if( stype == Type() ) if( stype == Type() )
{ {
if( SEARCH_QUIT == inspector( this, testData ) ) if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -393,7 +393,7 @@ void GERBER_FILE_IMAGE::RemoveAttribute( X2_ATTRIBUTE& aAttribute )
SEARCH_RESULT GERBER_FILE_IMAGE::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) SEARCH_RESULT GERBER_FILE_IMAGE::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{ {
KICAD_T stype; KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE; SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
const KICAD_T* p = scanTypes; const KICAD_T* p = scanTypes;
bool done = false; bool done = false;
@ -422,7 +422,7 @@ SEARCH_RESULT GERBER_FILE_IMAGE::Visit( INSPECTOR inspector, void* testData, con
break; break;
} }
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
} }

View File

@ -51,9 +51,10 @@ enum FILL_T {
}; };
enum SEARCH_RESULT { enum class SEARCH_RESULT
SEARCH_QUIT, {
SEARCH_CONTINUE QUIT,
CONTINUE
}; };
@ -423,11 +424,11 @@ public:
{ {
for( EDA_ITEM* p = listStart; p; p = p->Pnext ) for( EDA_ITEM* p = listStart; p; p = p->Pnext )
{ {
if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) ) if( SEARCH_RESULT::QUIT == p->Visit( inspector, testData, scanTypes ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }
/** /**
@ -443,32 +444,33 @@ public:
{ {
for( auto it : aList ) for( auto it : aList )
{ {
if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes ) == SEARCH_QUIT ) if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
return SEARCH_QUIT; == SEARCH_RESULT::QUIT )
return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }
/** /**
* @copydoc SEARCH_RESULT IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) * @copydoc SEARCH_RESULT IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )
* *
* This changes first parameter to avoid the DList and use std::vector instead * This changes first parameter to avoid the DList and use std::vector instead
*/ */
template <class T> template <class T>
static SEARCH_RESULT IterateForward( static SEARCH_RESULT IterateForward(
std::vector<T>& aList, INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) std::vector<T>& aList, INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{ {
for( auto it : aList ) for( auto it : aList )
{ {
if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes ) if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
== SEARCH_QUIT ) == SEARCH_RESULT::QUIT )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.

View File

@ -185,7 +185,7 @@ public:
bool m_MicroViasAllowed; ///< true to allow micro vias bool m_MicroViasAllowed; ///< true to allow micro vias
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
VIATYPE_T m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA) VIATYPE m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
bool m_RequireCourtyards; ///< require courtyard definitions in footprints bool m_RequireCourtyards; ///< require courtyard definitions in footprints
bool m_ProhibitOverlappingCourtyards; ///< check for overlapping courtyards in DRC bool m_ProhibitOverlappingCourtyards; ///< check for overlapping courtyards in DRC

View File

@ -83,7 +83,10 @@ public:
virtual ~COLLECTOR() {} virtual ~COLLECTOR() {}
virtual SEARCH_RESULT Inspect( EDA_ITEM* aItem, void* aTestData ) { return SEARCH_QUIT; }; virtual SEARCH_RESULT Inspect( EDA_ITEM* aItem, void* aTestData )
{
return SEARCH_RESULT::QUIT;
};
using ITER = std::vector<EDA_ITEM*>::iterator; using ITER = std::vector<EDA_ITEM*>::iterator;
using CITER = std::vector<EDA_ITEM*>::const_iterator; using CITER = std::vector<EDA_ITEM*>::const_iterator;

View File

@ -47,16 +47,17 @@ class GBR_NETLIST_METADATA;
* is the set of supported output plot formats. They should be kept in order * is the set of supported output plot formats. They should be kept in order
* of the radio buttons in the plot panel/windows. * of the radio buttons in the plot panel/windows.
*/ */
enum PlotFormat { enum class PLOT_FORMAT
PLOT_FORMAT_UNDEFINED = -1, {
PLOT_FIRST_FORMAT = 0, UNDEFINED = -1,
PLOT_FORMAT_HPGL = PLOT_FIRST_FORMAT, FIRST_FORMAT = 0,
PLOT_FORMAT_GERBER, HPGL = FIRST_FORMAT,
PLOT_FORMAT_POST, GERBER,
PLOT_FORMAT_DXF, POST,
PLOT_FORMAT_PDF, DXF,
PLOT_FORMAT_SVG, PDF,
PLOT_LAST_FORMAT = PLOT_FORMAT_SVG SVG,
LAST_FORMAT = SVG
}; };
/** /**
@ -71,21 +72,26 @@ enum PlotFormat {
* This is recognized by the DXF driver too, where NATIVE emits * This is recognized by the DXF driver too, where NATIVE emits
* TEXT entities instead of stroking the text * TEXT entities instead of stroking the text
*/ */
enum PlotTextMode { enum class PLOT_TEXT_MODE
PLOTTEXTMODE_STROKE, {
PLOTTEXTMODE_NATIVE, STROKE,
PLOTTEXTMODE_PHANTOM, NATIVE,
PLOTTEXTMODE_DEFAULT PHANTOM,
DEFAULT
}; };
/** /**
* Enum for choosing dashed line type * Enum for choosing dashed line type
*/ */
enum PlotDashType { enum class PLOT_DASH_TYPE
PLOTDASHTYPE_SOLID, {
PLOTDASHTYPE_DASH, DEFAULT = -1,
PLOTDASHTYPE_DOT, SOLID = 0,
PLOTDASHTYPE_DASHDOT, FIRST_TYPE = SOLID,
DASH,
DOT,
DASHDOT,
LAST_TYPE = DASHDOT
}; };
/** /**
@ -110,7 +116,7 @@ public:
* now is required since some things are only done with some output devices * now is required since some things are only done with some output devices
* (like drill marks, emitted only for postscript * (like drill marks, emitted only for postscript
*/ */
virtual PlotFormat GetPlotterType() const = 0; virtual PLOT_FORMAT GetPlotterType() const = 0;
virtual bool StartPlot() = 0; virtual bool StartPlot() = 0;
virtual bool EndPlot() = 0; virtual bool EndPlot() = 0;
@ -156,7 +162,7 @@ public:
virtual void SetColor( COLOR4D color ) = 0; virtual void SetColor( COLOR4D color ) = 0;
virtual void SetDash( int dashed ) = 0; virtual void SetDash( PLOT_DASH_TYPE dashed ) = 0;
virtual void SetCreator( const wxString& aCreator ) virtual void SetCreator( const wxString& aCreator )
{ {
@ -449,7 +455,7 @@ public:
* Change the current text mode. See the PlotTextMode * Change the current text mode. See the PlotTextMode
* explanation at the beginning of the file * explanation at the beginning of the file
*/ */
virtual void SetTextMode( PlotTextMode mode ) virtual void SetTextMode( PLOT_TEXT_MODE mode )
{ {
// NOP for most plotters. // NOP for most plotters.
} }
@ -602,9 +608,9 @@ class HPGL_PLOTTER : public PLOTTER
public: public:
HPGL_PLOTTER(); HPGL_PLOTTER();
virtual PlotFormat GetPlotterType() const override virtual PLOT_FORMAT GetPlotterType() const override
{ {
return PLOT_FORMAT_HPGL; return PLOT_FORMAT::HPGL;
} }
static wxString GetDefaultFileExtension() static wxString GetDefaultFileExtension()
@ -623,7 +629,7 @@ public:
} }
virtual void SetDefaultLineWidth( int width ) override {} virtual void SetDefaultLineWidth( int width ) override {}
virtual void SetDash( int dashed ) override; virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetColor( COLOR4D color ) override {} virtual void SetColor( COLOR4D color ) override {}
@ -688,17 +694,16 @@ protected:
class PSLIKE_PLOTTER : public PLOTTER class PSLIKE_PLOTTER : public PLOTTER
{ {
public: public:
PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ), PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ), m_textMode( PLOT_TEXT_MODE::PHANTOM )
m_textMode( PLOTTEXTMODE_PHANTOM )
{ {
} }
/** /**
* PS and PDF fully implement native text (for the Latin-1 subset) * PS and PDF fully implement native text (for the Latin-1 subset)
*/ */
virtual void SetTextMode( PlotTextMode mode ) override virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
{ {
if( mode != PLOTTEXTMODE_DEFAULT ) if( mode != PLOT_TEXT_MODE::DEFAULT )
m_textMode = mode; m_textMode = mode;
} }
@ -775,7 +780,7 @@ protected:
double plotScaleAdjX, plotScaleAdjY; double plotScaleAdjX, plotScaleAdjY;
/// How to draw text /// How to draw text
PlotTextMode m_textMode; PLOT_TEXT_MODE m_textMode;
}; };
@ -786,7 +791,7 @@ public:
{ {
// The phantom plot in postscript is an hack and reportedly // The phantom plot in postscript is an hack and reportedly
// crashes Adobe's own postscript interpreter! // crashes Adobe's own postscript interpreter!
m_textMode = PLOTTEXTMODE_STROKE; m_textMode = PLOT_TEXT_MODE::STROKE;
} }
static wxString GetDefaultFileExtension() static wxString GetDefaultFileExtension()
@ -794,15 +799,15 @@ public:
return wxString( wxT( "ps" ) ); return wxString( wxT( "ps" ) );
} }
virtual PlotFormat GetPlotterType() const override virtual PLOT_FORMAT GetPlotterType() const override
{ {
return PLOT_FORMAT_POST; return PLOT_FORMAT::POST;
} }
virtual bool StartPlot() override; virtual bool StartPlot() override;
virtual bool EndPlot() override; virtual bool EndPlot() override;
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override; virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
virtual void SetDash( int dashed ) override; virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
@ -847,9 +852,9 @@ public:
pageTreeHandle = 0; pageTreeHandle = 0;
} }
virtual PlotFormat GetPlotterType() const override virtual PLOT_FORMAT GetPlotterType() const override
{ {
return PLOT_FORMAT_PDF; return PLOT_FORMAT::PDF;
} }
static wxString GetDefaultFileExtension() static wxString GetDefaultFileExtension()
@ -872,7 +877,7 @@ public:
virtual void StartPage(); virtual void StartPage();
virtual void ClosePage(); virtual void ClosePage();
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override; virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
virtual void SetDash( int dashed ) override; virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
/** PDF can have multiple pages, so SetPageSettings can be called /** PDF can have multiple pages, so SetPageSettings can be called
* with the outputFile open (but not inside a page stream!) */ * with the outputFile open (but not inside a page stream!) */
@ -936,16 +941,16 @@ public:
return wxString( wxT( "svg" ) ); return wxString( wxT( "svg" ) );
} }
virtual PlotFormat GetPlotterType() const override virtual PLOT_FORMAT GetPlotterType() const override
{ {
return PLOT_FORMAT_SVG; return PLOT_FORMAT::SVG;
} }
virtual void SetColor( COLOR4D color ) override; virtual void SetColor( COLOR4D color ) override;
virtual bool StartPlot() override; virtual bool StartPlot() override;
virtual bool EndPlot() override; virtual bool EndPlot() override;
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override; virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
virtual void SetDash( int dashed ) override; virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
@ -1010,10 +1015,7 @@ protected:
bool m_graphics_changed; // true if a pen/brush parameter is modified bool m_graphics_changed; // true if a pen/brush parameter is modified
// color, pen size, fil mode ... // color, pen size, fil mode ...
// the new SVG stype must be output on file // the new SVG stype must be output on file
int m_dashed; // 0 = plot solid line style PLOT_DASH_TYPE m_dashed; // plot line style
// 1 = plot dashed line style
// 2 = plot dotted line style
// 3 = plot dash-dot line style
/** /**
* function emitSetRGBColor() * function emitSetRGBColor()
@ -1141,9 +1143,9 @@ class GERBER_PLOTTER : public PLOTTER
public: public:
GERBER_PLOTTER(); GERBER_PLOTTER();
virtual PlotFormat GetPlotterType() const override virtual PLOT_FORMAT GetPlotterType() const override
{ {
return PLOT_FORMAT_GERBER; return PLOT_FORMAT::GERBER;
} }
static wxString GetDefaultFileExtension() static wxString GetDefaultFileExtension()
@ -1162,7 +1164,10 @@ public:
virtual void SetDefaultLineWidth( int width ) override; virtual void SetDefaultLineWidth( int width ) override;
// RS274X has no dashing, nor colours // RS274X has no dashing, nor colours
virtual void SetDash( int dashed ) override {} virtual void SetDash( PLOT_DASH_TYPE dashed ) override
{
}
virtual void SetColor( COLOR4D color ) override {} virtual void SetColor( COLOR4D color ) override {}
// Currently, aScale and aMirror are not used in gerber plotter // Currently, aScale and aMirror are not used in gerber plotter
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
@ -1389,13 +1394,13 @@ public:
{ {
textAsLines = true; textAsLines = true;
m_currentColor = COLOR4D::BLACK; m_currentColor = COLOR4D::BLACK;
m_currentLineType = 0; m_currentLineType = PLOT_DASH_TYPE::SOLID;
SetUnits( DXF_UNITS::INCHES ); SetUnits( DXF_UNITS::INCHES );
} }
virtual PlotFormat GetPlotterType() const override virtual PLOT_FORMAT GetPlotterType() const override
{ {
return PLOT_FORMAT_DXF; return PLOT_FORMAT::DXF;
} }
static wxString GetDefaultFileExtension() static wxString GetDefaultFileExtension()
@ -1406,10 +1411,10 @@ public:
/** /**
* DXF handles NATIVE text emitting TEXT entities * DXF handles NATIVE text emitting TEXT entities
*/ */
virtual void SetTextMode( PlotTextMode mode ) override virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
{ {
if( mode != PLOTTEXTMODE_DEFAULT ) if( mode != PLOT_TEXT_MODE::DEFAULT )
textAsLines = ( mode != PLOTTEXTMODE_NATIVE ); textAsLines = ( mode != PLOT_TEXT_MODE::NATIVE );
} }
virtual bool StartPlot() override; virtual bool StartPlot() override;
@ -1427,7 +1432,7 @@ public:
defaultPenWidth = 0; defaultPenWidth = 0;
} }
virtual void SetDash( int dashed ) override; virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetColor( COLOR4D color ) override; virtual void SetColor( COLOR4D color ) override;
@ -1524,7 +1529,7 @@ public:
protected: protected:
bool textAsLines; bool textAsLines;
COLOR4D m_currentColor; COLOR4D m_currentColor;
int m_currentLineType; PLOT_DASH_TYPE m_currentLineType;
DXF_UNITS m_plotUnits; DXF_UNITS m_plotUnits;
double m_unitScalingFactor; double m_unitScalingFactor;
@ -1541,7 +1546,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
/** Returns the default plot extension for a format /** Returns the default plot extension for a format
*/ */
wxString GetDefaultPlotExtension( PlotFormat aFormat ); wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat );
#endif // PLOT_COMMON_H_ #endif // PLOT_COMMON_H_

View File

@ -434,7 +434,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_visibleElements = ~( 1 << GAL_LAYER_INDEX( LAYER_MOD_TEXT_INVISIBLE ) ); m_visibleElements = ~( 1 << GAL_LAYER_INDEX( LAYER_MOD_TEXT_INVISIBLE ) );
SetCopperLayerCount( 2 ); // Default design is a double sided board SetCopperLayerCount( 2 ); // Default design is a double sided board
m_CurrentViaType = VIA_THROUGH; m_CurrentViaType = VIATYPE::THROUGH;
// if true, when creating a new track starting on an existing track, use this track width // if true, when creating a new track starting on an existing track, use this track width
m_UseConnectedTrackWidth = false; m_UseConnectedTrackWidth = false;

View File

@ -28,9 +28,13 @@
#define BOARD_ITEM_CONTAINER_H #define BOARD_ITEM_CONTAINER_H
#include <class_board_item.h> #include <class_board_item.h>
#include <zone_settings.h> #include <zone_settings.h>
enum ADD_MODE { ADD_INSERT, ADD_APPEND }; enum class ADD_MODE
{
INSERT,
APPEND
};
/** /**
* @brief Abstract interface for BOARD_ITEMs capable of storing other items inside. * @brief Abstract interface for BOARD_ITEMs capable of storing other items inside.
@ -49,7 +53,7 @@ public:
* @brief Adds an item to the container. * @brief Adds an item to the container.
* @param aMode decides whether the item is added in the beginning or at the end of the list. * @param aMode decides whether the item is added in the beginning or at the end of the list.
*/ */
virtual void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_INSERT ) = 0; virtual void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) = 0;
/** /**
* @brief Removes an item from the container. * @brief Removes an item from the container.

View File

@ -216,7 +216,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
// aMoveVector was snapshotted, don't need "data". // aMoveVector was snapshotted, don't need "data".
brd_item->Move( aMoveVector ); brd_item->Move( aMoveVector );
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
Visit( inspector, NULL, top_level_board_stuff ); Visit( inspector, NULL, top_level_board_stuff );
@ -234,7 +234,7 @@ TRACKS BOARD::TracksInNet( int aNetCode )
if( t->GetNetCode() == aNetCode ) if( t->GetNetCode() == aNetCode )
ret.push_back( t ); ret.push_back( t );
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
// visit this BOARD's TRACKs and VIAs with above TRACK INSPECTOR which // visit this BOARD's TRACKs and VIAs with above TRACK INSPECTOR which
@ -556,7 +556,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
return; return;
} }
if( aMode == ADD_APPEND ) if( aMode == ADD_MODE::APPEND )
m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) ); m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) );
else else
m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) ); m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) );
@ -564,7 +564,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
if( aMode == ADD_APPEND ) if( aMode == ADD_MODE::APPEND )
m_modules.push_back( (MODULE*) aBoardItem ); m_modules.push_back( (MODULE*) aBoardItem );
else else
m_modules.push_front( (MODULE*) aBoardItem ); m_modules.push_front( (MODULE*) aBoardItem );
@ -575,7 +575,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
case PCB_LINE_T: case PCB_LINE_T:
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_TARGET_T: case PCB_TARGET_T:
if( aMode == ADD_APPEND ) if( aMode == ADD_MODE::APPEND )
m_drawings.push_back( aBoardItem ); m_drawings.push_back( aBoardItem );
else else
m_drawings.push_front( aBoardItem ); m_drawings.push_front( aBoardItem );
@ -852,7 +852,7 @@ void BOARD::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aLis
SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{ {
KICAD_T stype; KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE; SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
const KICAD_T* p = scanTypes; const KICAD_T* p = scanTypes;
bool done = false; bool done = false;
@ -992,7 +992,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
{ {
result = m_markers[i]->Visit( inspector, testData, p ); result = m_markers[i]->Visit( inspector, testData, p );
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
} }
@ -1006,7 +1006,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
{ {
result = m_ZoneDescriptorList[i]->Visit( inspector, testData, p ); result = m_ZoneDescriptorList[i]->Visit( inspector, testData, p );
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
} }
@ -1018,7 +1018,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
break; break;
} }
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
} }
@ -1061,10 +1061,10 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
if( aReference == module->GetReference() ) if( aReference == module->GetReference() )
{ {
found = module; found = module;
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
// visit this BOARD with the above inspector // visit this BOARD with the above inspector

View File

@ -265,7 +265,7 @@ public:
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; } void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; } int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_INSERT ) override; void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
void Remove( BOARD_ITEM* aBoardItem ) override; void Remove( BOARD_ITEM* aBoardItem ) override;

View File

@ -62,7 +62,7 @@ MODULE::MODULE( BOARD* parent ) :
m_LocalSolderMaskMargin = 0; m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0; m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0; m_LocalSolderPasteMarginRatio = 0.0;
m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use zone setting by default m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use zone setting by default
m_ThermalWidth = 0; // Use zone setting by default m_ThermalWidth = 0; // Use zone setting by default
m_ThermalGap = 0; // Use zone setting by default m_ThermalGap = 0; // Use zone setting by default
@ -280,21 +280,21 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
// no break // no break
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
if( aMode == ADD_APPEND ) if( aMode == ADD_MODE::APPEND )
m_drawings.push_back( aBoardItem ); m_drawings.push_back( aBoardItem );
else else
m_drawings.push_front( aBoardItem ); m_drawings.push_front( aBoardItem );
break; break;
case PCB_PAD_T: case PCB_PAD_T:
if( aMode == ADD_APPEND ) if( aMode == ADD_MODE::APPEND )
m_pads.push_back( static_cast<D_PAD*>( aBoardItem ) ); m_pads.push_back( static_cast<D_PAD*>( aBoardItem ) );
else else
m_pads.push_front( static_cast<D_PAD*>( aBoardItem ) ); m_pads.push_front( static_cast<D_PAD*>( aBoardItem ) );
break; break;
case PCB_MODULE_ZONE_AREA_T: case PCB_MODULE_ZONE_AREA_T:
if( aMode == ADD_APPEND ) if( aMode == ADD_MODE::APPEND )
m_fp_zones.push_back( static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) ); m_fp_zones.push_back( static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) );
else else
m_fp_zones.insert( m_fp_zones.begin(), static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) ); m_fp_zones.insert( m_fp_zones.begin(), static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) );
@ -803,7 +803,7 @@ void MODULE::Add3DModel( MODULE_3D_SETTINGS* a3DModel )
SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{ {
KICAD_T stype; KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE; SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
const KICAD_T* p = scanTypes; const KICAD_T* p = scanTypes;
bool done = false; bool done = false;
@ -835,12 +835,12 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
result = inspector( m_Reference, testData ); result = inspector( m_Reference, testData );
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
result = inspector( m_Value, testData ); result = inspector( m_Value, testData );
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
// m_Drawings can hold TYPETEXTMODULE also, so fall thru // m_Drawings can hold TYPETEXTMODULE also, so fall thru
@ -871,7 +871,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
break; break;
} }
if( result == SEARCH_QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
} }

View File

@ -126,7 +126,7 @@ public:
} }
///> @copydoc BOARD_ITEM_CONTAINER::Add() ///> @copydoc BOARD_ITEM_CONTAINER::Add()
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_INSERT ) override; void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
///> @copydoc BOARD_ITEM_CONTAINER::Remove() ///> @copydoc BOARD_ITEM_CONTAINER::Remove()
void Remove( BOARD_ITEM* aItem ) override; void Remove( BOARD_ITEM* aItem ) override;
@ -243,8 +243,15 @@ public:
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; } double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; } void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; } void SetZoneConnection( ZONE_CONNECTION aType )
ZoneConnection GetZoneConnection() const { return m_ZoneConnection; } {
m_ZoneConnection = aType;
}
ZONE_CONNECTION GetZoneConnection() const
{
return m_ZoneConnection;
}
void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; } void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
int GetThermalWidth() const { return m_ThermalWidth; } int GetThermalWidth() const { return m_ThermalWidth; }
@ -692,7 +699,7 @@ private:
int m_ModuleStatus; // For autoplace: flags (LOCKED, AUTOPLACED) int m_ModuleStatus; // For autoplace: flags (LOCKED, AUTOPLACED)
EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation. EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation.
ZoneConnection m_ZoneConnection; ZONE_CONNECTION m_ZoneConnection;
int m_ThermalWidth; int m_ThermalWidth;
int m_ThermalGap; int m_ThermalGap;
int m_LocalClearance; int m_LocalClearance;

View File

@ -84,7 +84,7 @@ D_PAD::D_PAD( MODULE* parent ) :
m_padChamferRectScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size m_padChamferRectScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use parent setting by default m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
m_ThermalWidth = 0; // Use parent setting by default m_ThermalWidth = 0; // Use parent setting by default
m_ThermalGap = 0; // Use parent setting by default m_ThermalGap = 0; // Use parent setting by default
@ -714,11 +714,11 @@ wxSize D_PAD::GetSolderPasteMargin() const
} }
ZoneConnection D_PAD::GetZoneConnection() const ZONE_CONNECTION D_PAD::GetZoneConnection() const
{ {
MODULE* module = GetParent(); MODULE* module = GetParent();
if( m_ZoneConnection == PAD_ZONE_CONN_INHERITED && module ) if( m_ZoneConnection == ZONE_CONNECTION::INHERITED && module )
return module->GetZoneConnection(); return module->GetZoneConnection();
else else
return m_ZoneConnection; return m_ZoneConnection;

View File

@ -520,9 +520,17 @@ public:
*/ */
wxSize GetSolderPasteMargin() const; wxSize GetSolderPasteMargin() const;
void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; } void SetZoneConnection( ZONE_CONNECTION aType )
ZoneConnection GetZoneConnection() const; {
ZoneConnection GetLocalZoneConnection() const { return m_ZoneConnection; } m_ZoneConnection = aType;
}
ZONE_CONNECTION GetZoneConnection() const;
ZONE_CONNECTION GetLocalZoneConnection() const
{
return m_ZoneConnection;
}
void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; } void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
int GetThermalWidth() const; int GetThermalWidth() const;
@ -930,7 +938,7 @@ private: // Private variable members:
double m_LocalSolderPasteMarginRatio; ///< Local solder mask margin ratio value of pad size double m_LocalSolderPasteMarginRatio; ///< Local solder mask margin ratio value of pad size
///< The final margin is the sum of these 2 values ///< The final margin is the sum of these 2 values
/// how the connection to zone is made: no connection, thermal relief ... /// how the connection to zone is made: no connection, thermal relief ...
ZoneConnection m_ZoneConnection; ZONE_CONNECTION m_ZoneConnection;
int m_ThermalWidth; int m_ThermalWidth;
int m_ThermalGap; int m_ThermalGap;

View File

@ -71,10 +71,9 @@ EDA_ITEM* TRACK::Clone() const
} }
VIA::VIA( BOARD_ITEM* aParent ) : VIA::VIA( BOARD_ITEM* aParent ) : TRACK( aParent, PCB_VIA_T )
TRACK( aParent, PCB_VIA_T )
{ {
SetViaType( VIA_THROUGH ); SetViaType( VIATYPE::THROUGH );
m_BottomLayer = B_Cu; m_BottomLayer = B_Cu;
SetDrillDefault(); SetDrillDefault();
} }
@ -89,14 +88,14 @@ EDA_ITEM* VIA::Clone() const
wxString VIA::GetSelectMenuText( EDA_UNITS aUnits ) const wxString VIA::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
wxString format; wxString format;
BOARD* board = GetBoard(); BOARD* board = GetBoard();
switch( GetViaType() ) switch( GetViaType() )
{ {
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
format = _( "Blind/Buried Via %s %s on %s - %s" ); format = _( "Blind/Buried Via %s %s on %s - %s" );
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
format = _( "Micro Via %s %s on %s - %s" ); format = _( "Micro Via %s %s on %s - %s" );
break; break;
// else say nothing about normal (through) vias // else say nothing about normal (through) vias
@ -111,20 +110,13 @@ wxString VIA::GetSelectMenuText( EDA_UNITS aUnits ) const
PCB_LAYER_ID topLayer; PCB_LAYER_ID topLayer;
PCB_LAYER_ID botLayer; PCB_LAYER_ID botLayer;
LayerPair( &topLayer, &botLayer ); LayerPair( &topLayer, &botLayer );
return wxString::Format( format.GetData(), return wxString::Format( format.GetData(), MessageTextFromValue( aUnits, m_Width ),
MessageTextFromValue( aUnits, m_Width ), GetNetnameMsg(), board->GetLayerName( topLayer ), board->GetLayerName( botLayer ) );
GetNetnameMsg(),
board->GetLayerName( topLayer ),
board->GetLayerName( botLayer ) );
} }
else else
{ {
return wxString::Format( format.GetData(), return wxString::Format( format.GetData(), MessageTextFromValue( aUnits, m_Width ),
MessageTextFromValue( aUnits, m_Width ), GetNetnameMsg(), wxT( "??" ), wxT( "??" ) );
GetNetnameMsg(),
wxT( "??" ),
wxT( "??" ) );
} }
} }
@ -145,13 +137,13 @@ int TRACK::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
int VIA::GetDrillValue() const int VIA::GetDrillValue() const
{ {
if( m_Drill > 0 ) // Use the specific value. if( m_Drill > 0 ) // Use the specific value.
return m_Drill; return m_Drill;
// Use the default value from the Netclass // Use the default value from the Netclass
NETCLASSPTR netclass = GetNetClass(); NETCLASSPTR netclass = GetNetClass();
if( GetViaType() == VIA_MICROVIA ) if( GetViaType() == VIATYPE::MICROVIA )
return netclass->GetuViaDrill(); return netclass->GetuViaDrill();
return netclass->GetViaDrill(); return netclass->GetViaDrill();
@ -264,13 +256,13 @@ void VIA::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
m_End.y = aCentre.y - ( m_End.y - aCentre.y ); m_End.y = aCentre.y - ( m_End.y - aCentre.y );
} }
if( GetViaType() != VIA_THROUGH ) if( GetViaType() != VIATYPE::THROUGH )
{ {
int copperLayerCount = GetBoard()->GetCopperLayerCount(); int copperLayerCount = GetBoard()->GetCopperLayerCount();
PCB_LAYER_ID top_layer; PCB_LAYER_ID top_layer;
PCB_LAYER_ID bottom_layer; PCB_LAYER_ID bottom_layer;
LayerPair( &top_layer, &bottom_layer ); LayerPair( &top_layer, &bottom_layer );
top_layer = FlipLayer( top_layer, copperLayerCount ); top_layer = FlipLayer( top_layer, copperLayerCount );
bottom_layer = FlipLayer( bottom_layer, copperLayerCount ); bottom_layer = FlipLayer( bottom_layer, copperLayerCount );
SetLayerPair( top_layer, bottom_layer ); SetLayerPair( top_layer, bottom_layer );
} }
@ -285,11 +277,11 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
// If caller wants to inspect my type // If caller wants to inspect my type
if( stype == Type() ) if( stype == Type() )
{ {
if( SEARCH_QUIT == inspector( this, testData ) ) if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }
@ -310,7 +302,7 @@ bool VIA::IsOnLayer( PCB_LAYER_ID layer_number ) const
LSET VIA::GetLayerSet() const LSET VIA::GetLayerSet() const
{ {
if( GetViaType() == VIA_THROUGH ) if( GetViaType() == VIATYPE::THROUGH )
return LSET::AllCuMask(); return LSET::AllCuMask();
// VIA_BLIND_BURIED or VIA_MICRVIA: // VIA_BLIND_BURIED or VIA_MICRVIA:
@ -320,7 +312,7 @@ LSET VIA::GetLayerSet() const
wxASSERT( m_Layer <= m_BottomLayer ); wxASSERT( m_Layer <= m_BottomLayer );
// PCB_LAYER_IDs are numbered from front to back, this is top to bottom. // PCB_LAYER_IDs are numbered from front to back, this is top to bottom.
for( LAYER_NUM id = m_Layer; id <= m_BottomLayer; ++id ) for( LAYER_NUM id = m_Layer; id <= m_BottomLayer; ++id )
{ {
layermask.set( id ); layermask.set( id );
} }
@ -355,7 +347,7 @@ void VIA::LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const
PCB_LAYER_ID t_layer = F_Cu; PCB_LAYER_ID t_layer = F_Cu;
PCB_LAYER_ID b_layer = B_Cu; PCB_LAYER_ID b_layer = B_Cu;
if( GetViaType() != VIA_THROUGH ) if( GetViaType() != VIATYPE::THROUGH )
{ {
b_layer = m_BottomLayer; b_layer = m_BottomLayer;
t_layer = m_Layer; t_layer = m_Layer;
@ -386,9 +378,9 @@ PCB_LAYER_ID VIA::BottomLayer() const
void VIA::SanitizeLayers() void VIA::SanitizeLayers()
{ {
if( GetViaType() == VIA_THROUGH ) if( GetViaType() == VIATYPE::THROUGH )
{ {
m_Layer = F_Cu; m_Layer = F_Cu;
m_BottomLayer = B_Cu; m_BottomLayer = B_Cu;
} }
@ -527,18 +519,19 @@ const BOX2I TRACK::ViewBBox() const
void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset ) void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{ {
int radius; int radius;
int fillvia = 0; int fillvia = 0;
PCB_SCREEN* screen = aFrame->GetScreen(); PCB_SCREEN* screen = aFrame->GetScreen();
auto& displ_opts = aFrame->GetDisplayOptions(); auto& displ_opts = aFrame->GetDisplayOptions();
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
COLOR4D color = aFrame->Settings().Colors().GetItemColor( LAYER_VIAS + GetViaType() ); COLOR4D color = aFrame->Settings().Colors().GetItemColor(
LAYER_VIAS + static_cast<int>( GetViaType() ) );
if( displ_opts.m_DisplayViaFill == FILLED ) if( displ_opts.m_DisplayViaFill == FILLED )
fillvia = 1; fillvia = 1;
if( !brd->IsElementVisible( LAYER_VIAS + GetViaType() ) ) if( !brd->IsElementVisible( LAYER_VIAS + static_cast<int>( GetViaType() ) ) )
return; return;
// Only draw the via if at least one of the layers it crosses is being displayed // Only draw the via if at least one of the layers it crosses is being displayed
if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() ) if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
@ -612,7 +605,7 @@ void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
// for Micro Vias, draw a partial cross : X on component layer, or + on copper layer // for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
// (so we can see 2 superimposed microvias ): // (so we can see 2 superimposed microvias ):
if( GetViaType() == VIA_MICROVIA ) if( GetViaType() == VIATYPE::MICROVIA )
{ {
int ax, ay, bx, by; int ax, ay, bx, by;
@ -642,7 +635,7 @@ void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
// for Buried Vias, draw a partial line : orient depending on layer pair // for Buried Vias, draw a partial line : orient depending on layer pair
// (so we can see superimposed buried vias ): // (so we can see superimposed buried vias ):
if( GetViaType() == VIA_BLIND_BURIED ) if( GetViaType() == VIATYPE::BLIND_BURIED )
{ {
int ax = 0, ay = radius, bx = 0, by = drill_radius; int ax = 0, ay = radius, bx = 0, by = drill_radius;
PCB_LAYER_ID layer_top, layer_bottom; PCB_LAYER_ID layer_top, layer_bottom;
@ -703,18 +696,18 @@ void VIA::ViewGetLayers( int aLayers[], int& aCount ) const
// Just show it on common via & via holes layers // Just show it on common via & via holes layers
switch( GetViaType() ) switch( GetViaType() )
{ {
case VIA_THROUGH: case VIATYPE::THROUGH:
aLayers[2] = LAYER_VIA_THROUGH; aLayers[2] = LAYER_VIA_THROUGH;
break; break;
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
aLayers[2] = LAYER_VIA_BBLIND; aLayers[2] = LAYER_VIA_BBLIND;
aLayers[3] = m_Layer; aLayers[3] = m_Layer;
aLayers[4] = m_BottomLayer; aLayers[4] = m_BottomLayer;
aCount += 2; aCount += 2;
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
aLayers[2] = LAYER_VIA_MICROVIA; aLayers[2] = LAYER_VIA_MICROVIA;
break; break;
@ -743,19 +736,19 @@ unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{ {
switch( m_ViaType ) switch( m_ViaType )
{ {
case VIA_THROUGH: case VIATYPE::THROUGH:
if( !aView->IsLayerVisible( LAYER_VIA_THROUGH ) ) if( !aView->IsLayerVisible( LAYER_VIA_THROUGH ) )
return HIDE; return HIDE;
break; break;
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
if( !aView->IsLayerVisible( LAYER_VIA_BBLIND ) ) if( !aView->IsLayerVisible( LAYER_VIA_BBLIND ) )
return HIDE; return HIDE;
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
if( !aView->IsLayerVisible( LAYER_VIA_MICROVIA ) ) if( !aView->IsLayerVisible( LAYER_VIA_MICROVIA ) )
return HIDE; return HIDE;
@ -920,22 +913,22 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aL
switch( GetViaType() ) switch( GetViaType() )
{ {
default: default:
case VIA_NOT_DEFINED: case VIATYPE::NOT_DEFINED:
msg = wxT( "???" ); // Not used yet, does not exist currently msg = wxT( "???" ); // Not used yet, does not exist currently
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from
// the near neighbor inner layer only // the near neighbor inner layer only
break; break;
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
msg = _( "Blind/Buried Via" ); // from inner or external to inner msg = _( "Blind/Buried Via" ); // from inner or external to inner
// or external layer (no restriction) // or external layer (no restriction)
break; break;
case VIA_THROUGH: case VIATYPE::THROUGH:
msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only ) msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only )
break; break;
} }
@ -978,7 +971,7 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aL
if( net ) if( net )
{ {
if( GetViaType() == VIA_MICROVIA ) if( GetViaType() == VIATYPE::MICROVIA )
drill_class_value = net->GetMicroViaDrillSize(); drill_class_value = net->GetMicroViaDrillSize();
else else
drill_class_value = net->GetViaDrillSize(); drill_class_value = net->GetViaDrillSize();

View File

@ -57,13 +57,13 @@ enum ENDPOINT_T {
// Via types // Via types
// Note that this enum must be synchronized to GAL_LAYER_ID // Note that this enum must be synchronized to GAL_LAYER_ID
enum VIATYPE_T enum class VIATYPE
{ {
VIA_THROUGH = 3, /* Always a through hole via */ THROUGH = 3, /* Always a through hole via */
VIA_BLIND_BURIED = 2, /* this via can be on internal layers */ BLIND_BURIED = 2, /* this via can be on internal layers */
VIA_MICROVIA = 1, /* this via which connect from an external layer MICROVIA = 1, /* this via which connect from an external layer
* to the near neighbor internal layer */ * to the near neighbor internal layer */
VIA_NOT_DEFINED = 0 /* not yet used */ NOT_DEFINED = 0 /* not yet used */
}; };
#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter. #define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
@ -343,8 +343,15 @@ public:
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif #endif
VIATYPE_T GetViaType() const { return m_ViaType; } VIATYPE GetViaType() const
void SetViaType( VIATYPE_T aViaType ) { m_ViaType = aViaType; } {
return m_ViaType;
}
void SetViaType( VIATYPE aViaType )
{
m_ViaType = aViaType;
}
/** /**
* Function SetDrill * Function SetDrill
@ -387,11 +394,11 @@ protected:
private: private:
/// The bottom layer of the via (the top layer is in m_Layer) /// The bottom layer of the via (the top layer is in m_Layer)
PCB_LAYER_ID m_BottomLayer; PCB_LAYER_ID m_BottomLayer;
VIATYPE_T m_ViaType; // Type of via VIATYPE m_ViaType; // Type of via
int m_Drill; // for vias: via drill (- 1 for default value) int m_Drill; // for vias: via drill (- 1 for default value)
}; };

View File

@ -863,9 +863,9 @@ void ZONE_CONTAINER::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight )
} }
ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const
{ {
if( aPad == NULL || aPad->GetZoneConnection() == PAD_ZONE_CONN_INHERITED ) if( aPad == NULL || aPad->GetZoneConnection() == ZONE_CONNECTION::INHERITED )
return m_PadConnection; return m_PadConnection;
else else
return aPad->GetZoneConnection(); return aPad->GetZoneConnection();

View File

@ -176,8 +176,12 @@ public:
int GetZoneClearance() const { return m_ZoneClearance; } int GetZoneClearance() const { return m_ZoneClearance; }
void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; } void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const; ZONE_CONNECTION GetPadConnection( D_PAD* aPad = NULL ) const;
void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
void SetPadConnection( ZONE_CONNECTION aPadConnection )
{
m_PadConnection = aPadConnection;
}
int GetMinThickness() const { return m_ZoneMinThickness; } int GetMinThickness() const { return m_ZoneMinThickness; }
void SetMinThickness( int aMinThickness ) void SetMinThickness( int aMinThickness )
@ -736,7 +740,7 @@ protected:
bool m_doNotAllowVias; bool m_doNotAllowVias;
bool m_doNotAllowTracks; bool m_doNotAllowTracks;
ZoneConnection m_PadConnection; ZONE_CONNECTION m_PadConnection;
int m_ZoneClearance; ///< Clearance value in internal units. int m_ZoneClearance; ///< Clearance value in internal units.
int m_ZoneMinThickness; ///< Minimum thickness value in filled areas. int m_ZoneMinThickness; ///< Minimum thickness value in filled areas.
bool m_FilledPolysUseThickness; ///< outline of filled polygons have thickness. bool m_FilledPolysUseThickness; ///< outline of filled polygons have thickness.

View File

@ -378,9 +378,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
{ {
auto type = via->GetViaType(); auto type = via->GetViaType();
if( ( m_Guide->IgnoreThroughVias() && type == VIA_THROUGH ) || if( ( m_Guide->IgnoreThroughVias() && type == VIATYPE::THROUGH )
( m_Guide->IgnoreBlindBuriedVias() && type == VIA_BLIND_BURIED ) || || ( m_Guide->IgnoreBlindBuriedVias() && type == VIATYPE::BLIND_BURIED )
( m_Guide->IgnoreMicroVias() && type == VIA_MICROVIA ) ) || ( m_Guide->IgnoreMicroVias() && type == VIATYPE::MICROVIA ) )
{ {
goto exit; goto exit;
} }
@ -472,7 +472,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
} }
exit: exit:
return SEARCH_CONTINUE; // always when collecting return SEARCH_RESULT::CONTINUE; // always when collecting
} }
@ -512,7 +512,7 @@ SEARCH_RESULT PCB_TYPE_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
// the scanList, so therefore we can collect anything given to us here. // the scanList, so therefore we can collect anything given to us here.
Append( testItem ); Append( testItem );
return SEARCH_CONTINUE; // always when collecting return SEARCH_RESULT::CONTINUE; // always when collecting
} }
@ -536,7 +536,7 @@ SEARCH_RESULT PCB_LAYER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
else if( item->GetLayer() == m_layer_id ) else if( item->GetLayer() == m_layer_id )
Append( testItem ); Append( testItem );
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
} }

View File

@ -143,9 +143,9 @@ void DIALOG_BOARD_STATISTICS::refreshItemsTypes()
m_padsTypes.push_back( padsType_t( PAD_ATTRIB_HOLE_NOT_PLATED, _( "NPTH:" ) ) ); m_padsTypes.push_back( padsType_t( PAD_ATTRIB_HOLE_NOT_PLATED, _( "NPTH:" ) ) );
m_viasTypes.clear(); m_viasTypes.clear();
m_viasTypes.push_back( viasType_t( VIA_THROUGH, _( "Through vias:" ) ) ); m_viasTypes.push_back( viasType_t( VIATYPE::THROUGH, _( "Through vias:" ) ) );
m_viasTypes.push_back( viasType_t( VIA_BLIND_BURIED, _( "Blind/buried:" ) ) ); m_viasTypes.push_back( viasType_t( VIATYPE::BLIND_BURIED, _( "Blind/buried:" ) ) );
m_viasTypes.push_back( viasType_t( VIA_MICROVIA, _( "Micro vias:" ) ) ); m_viasTypes.push_back( viasType_t( VIATYPE::MICROVIA, _( "Micro vias:" ) ) );
// If there not enough rows in grids, append some // If there not enough rows in grids, append some
int appendRows = m_componentsTypes.size() + 2 - m_gridComponents->GetNumberRows(); int appendRows = m_componentsTypes.size() + 2 - m_gridComponents->GetNumberRows();

View File

@ -65,7 +65,7 @@ public:
}; };
using padsType_t = typeContainer_t<PAD_ATTR_T>; using padsType_t = typeContainer_t<PAD_ATTR_T>;
using viasType_t = typeContainer_t<VIATYPE_T>; using viasType_t = typeContainer_t<VIATYPE>;
/** /**
* Struct holds information about component type (such as SMD, THT, * Struct holds information about component type (such as SMD, THT,

View File

@ -161,10 +161,18 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
switch( m_settings.GetPadConnection() ) switch( m_settings.GetPadConnection() )
{ {
default: default:
case PAD_ZONE_CONN_THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break; case ZONE_CONNECTION::THERMAL:
case PAD_ZONE_CONN_THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break; m_PadInZoneOpt->SetSelection( 1 );
case PAD_ZONE_CONN_NONE: m_PadInZoneOpt->SetSelection( 3 ); break; break;
case PAD_ZONE_CONN_FULL: m_PadInZoneOpt->SetSelection( 0 ); break; case ZONE_CONNECTION::THT_THERMAL:
m_PadInZoneOpt->SetSelection( 2 );
break;
case ZONE_CONNECTION::NONE:
m_PadInZoneOpt->SetSelection( 3 );
break;
case ZONE_CONNECTION::FULL:
m_PadInZoneOpt->SetSelection( 0 );
break;
} }
// Do not enable/disable antipad clearance and spoke width. They might be needed if // Do not enable/disable antipad clearance and spoke width. They might be needed if
@ -323,10 +331,18 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
switch( m_PadInZoneOpt->GetSelection() ) switch( m_PadInZoneOpt->GetSelection() )
{ {
case 3: m_settings.SetPadConnection( PAD_ZONE_CONN_NONE ); break; case 3:
case 2: m_settings.SetPadConnection( PAD_ZONE_CONN_THT_THERMAL ); break; m_settings.SetPadConnection( ZONE_CONNECTION::NONE );
case 1: m_settings.SetPadConnection( PAD_ZONE_CONN_THERMAL ); break; break;
case 0: m_settings.SetPadConnection( PAD_ZONE_CONN_FULL ); break; case 2:
m_settings.SetPadConnection( ZONE_CONNECTION::THT_THERMAL );
break;
case 1:
m_settings.SetPadConnection( ZONE_CONNECTION::THERMAL );
break;
case 0:
m_settings.SetPadConnection( ZONE_CONNECTION::FULL );
break;
} }
switch( m_OutlineAppearanceCtrl->GetSelection() ) switch( m_OutlineAppearanceCtrl->GetSelection() )

View File

@ -337,10 +337,18 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
switch( m_footprint->GetZoneConnection() ) switch( m_footprint->GetZoneConnection() )
{ {
default: default:
case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break; case ZONE_CONNECTION::INHERITED:
case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break; m_ZoneConnectionChoice->SetSelection( 0 );
case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break; break;
case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break; case ZONE_CONNECTION::FULL:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case ZONE_CONNECTION::THERMAL:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case ZONE_CONNECTION::NONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
} }
// 3D Settings // 3D Settings
@ -651,7 +659,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
while( i < m_texts->size() ) while( i < m_texts->size() )
{ {
auto newText = new TEXTE_MODULE( m_texts->at( i++ ) ); auto newText = new TEXTE_MODULE( m_texts->at( i++ ) );
m_footprint->Add( newText, ADD_APPEND ); m_footprint->Add( newText, ADD_MODE::APPEND );
view->Add( newText ); view->Add( newText );
} }
@ -677,10 +685,18 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
switch( m_ZoneConnectionChoice->GetSelection() ) switch( m_ZoneConnectionChoice->GetSelection() )
{ {
default: default:
case 0: m_footprint->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break; case 0:
case 1: m_footprint->SetZoneConnection( PAD_ZONE_CONN_FULL ); break; m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED );
case 2: m_footprint->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break; break;
case 3: m_footprint->SetZoneConnection( PAD_ZONE_CONN_NONE ); break; case 1:
m_footprint->SetZoneConnection( ZONE_CONNECTION::FULL );
break;
case 2:
m_footprint->SetZoneConnection( ZONE_CONNECTION::THERMAL );
break;
case 3:
m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE );
break;
} }
// Set Module Position // Set Module Position

View File

@ -265,10 +265,18 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
switch( m_footprint->GetZoneConnection() ) switch( m_footprint->GetZoneConnection() )
{ {
default: default:
case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break; case ZONE_CONNECTION::INHERITED:
case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break; m_ZoneConnectionChoice->SetSelection( 0 );
case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break; break;
case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break; case ZONE_CONNECTION::FULL:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case ZONE_CONNECTION::THERMAL:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case ZONE_CONNECTION::NONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
} }
// 3D Settings // 3D Settings
@ -614,7 +622,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
while( i < m_texts->size() ) while( i < m_texts->size() )
{ {
auto newText = new TEXTE_MODULE( m_texts->at( i++ ) ); auto newText = new TEXTE_MODULE( m_texts->at( i++ ) );
m_footprint->Add( newText, ADD_APPEND ); m_footprint->Add( newText, ADD_MODE::APPEND );
view->Add( newText ); view->Add( newText );
} }
@ -653,10 +661,18 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
switch( m_ZoneConnectionChoice->GetSelection() ) switch( m_ZoneConnectionChoice->GetSelection() )
{ {
default: default:
case 0: m_footprint->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break; case 0:
case 1: m_footprint->SetZoneConnection( PAD_ZONE_CONN_FULL ); break; m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED );
case 2: m_footprint->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break; break;
case 3: m_footprint->SetZoneConnection( PAD_ZONE_CONN_NONE ); break; case 1:
m_footprint->SetZoneConnection( ZONE_CONNECTION::FULL );
break;
case 2:
m_footprint->SetZoneConnection( ZONE_CONNECTION::THERMAL );
break;
case 3:
m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE );
break;
} }
std::list<MODULE_3D_SETTINGS>* draw3D = &m_footprint->Models(); std::list<MODULE_3D_SETTINGS>* draw3D = &m_footprint->Models();

View File

@ -312,7 +312,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
plot_opts.SetSkipPlotNPTH_Pads( false ); plot_opts.SetSkipPlotNPTH_Pads( false );
plot_opts.SetMirror( m_printMirror ); plot_opts.SetMirror( m_printMirror );
plot_opts.SetFormat( PLOT_FORMAT_SVG ); plot_opts.SetFormat( PLOT_FORMAT::SVG );
PAGE_INFO pageInfo = m_board->GetPageSettings(); PAGE_INFO pageInfo = m_board->GetPageSettings();
wxPoint axisorigin = m_board->GetAuxOrigin(); wxPoint axisorigin = m_board->GetAuxOrigin();

View File

@ -183,15 +183,15 @@ void DIALOG_GENDRILL::InitDisplayParams()
{ {
switch( via->GetViaType() ) switch( via->GetViaType() )
{ {
case VIA_THROUGH: case VIATYPE::THROUGH:
m_throughViasCount++; m_throughViasCount++;
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
m_microViasCount++; m_microViasCount++;
break; break;
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
m_blindOrBuriedViasCount++; m_blindOrBuriedViasCount++;
break; break;
@ -370,10 +370,10 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
m_pcbEditFrame->ClearMsgPanel(); m_pcbEditFrame->ClearMsgPanel();
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox ); WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
const PlotFormat filefmt[6] = const PLOT_FORMAT filefmt[6] = {
{ // Keep these format ids in the same order than m_Choice_Drill_Map choices // Keep these format ids in the same order than m_Choice_Drill_Map choices
PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER, PLOT_FORMAT::HPGL, PLOT_FORMAT::POST, PLOT_FORMAT::GERBER, PLOT_FORMAT::DXF,
PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF PLOT_FORMAT::SVG, PLOT_FORMAT::PDF
}; };
unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection(); unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection();

View File

@ -676,10 +676,18 @@ void DIALOG_PAD_PROPERTIES::initValues()
switch( m_dummyPad->GetLocalZoneConnection() ) switch( m_dummyPad->GetLocalZoneConnection() )
{ {
default: default:
case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break; case ZONE_CONNECTION::INHERITED:
case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break; m_ZoneConnectionChoice->SetSelection( 0 );
case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break; break;
case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break; case ZONE_CONNECTION::FULL:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case ZONE_CONNECTION::THERMAL:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case ZONE_CONNECTION::NONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
} }
if( m_dummyPad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL ) if( m_dummyPad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
@ -1578,10 +1586,18 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
switch( m_ZoneConnectionChoice->GetSelection() ) switch( m_ZoneConnectionChoice->GetSelection() )
{ {
default: default:
case 0: aPad->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break; case 0:
case 1: aPad->SetZoneConnection( PAD_ZONE_CONN_FULL ); break; aPad->SetZoneConnection( ZONE_CONNECTION::INHERITED );
case 2: aPad->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break; break;
case 3: aPad->SetZoneConnection( PAD_ZONE_CONN_NONE ); break; case 1:
aPad->SetZoneConnection( ZONE_CONNECTION::FULL );
break;
case 2:
aPad->SetZoneConnection( ZONE_CONNECTION::THERMAL );
break;
case 3:
aPad->SetZoneConnection( ZONE_CONNECTION::NONE );
break;
} }
aPad->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) ); aPad->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );

View File

@ -93,12 +93,24 @@ void DIALOG_PLOT::init_Dialog()
switch( m_plotOpts.GetFormat() ) switch( m_plotOpts.GetFormat() )
{ {
default: default:
case PLOT_FORMAT_GERBER: m_plotFormatOpt->SetSelection( 0 ); break; case PLOT_FORMAT::GERBER:
case PLOT_FORMAT_POST: m_plotFormatOpt->SetSelection( 1 ); break; m_plotFormatOpt->SetSelection( 0 );
case PLOT_FORMAT_SVG: m_plotFormatOpt->SetSelection( 2 ); break; break;
case PLOT_FORMAT_DXF: m_plotFormatOpt->SetSelection( 3 ); break; case PLOT_FORMAT::POST:
case PLOT_FORMAT_HPGL: m_plotFormatOpt->SetSelection( 4 ); break; m_plotFormatOpt->SetSelection( 1 );
case PLOT_FORMAT_PDF: m_plotFormatOpt->SetSelection( 5 ); break; break;
case PLOT_FORMAT::SVG:
m_plotFormatOpt->SetSelection( 2 );
break;
case PLOT_FORMAT::DXF:
m_plotFormatOpt->SetSelection( 3 );
break;
case PLOT_FORMAT::HPGL:
m_plotFormatOpt->SetSelection( 4 );
break;
case PLOT_FORMAT::PDF:
m_plotFormatOpt->SetSelection( 5 );
break;
} }
// Set units and value for HPGL pen size (this param is in mils). // Set units and value for HPGL pen size (this param is in mils).
@ -187,7 +199,7 @@ void DIALOG_PLOT::init_Dialog()
m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() ); m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() );
// DXF text mode // DXF text mode
m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() == PLOTTEXTMODE_DEFAULT ); m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() == PLOT_TEXT_MODE::DEFAULT );
// DXF units selection // DXF units selection
m_DXF_plotUnits->SetSelection( static_cast<int>( m_plotOpts.GetDXFPlotUnits() ) ); m_DXF_plotUnits->SetSelection( static_cast<int>( m_plotOpts.GetDXFPlotUnits() ) );
@ -357,20 +369,13 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
} }
PlotFormat DIALOG_PLOT::getPlotFormat() PLOT_FORMAT DIALOG_PLOT::getPlotFormat()
{ {
// plot format id's are ordered like displayed in m_plotFormatOpt // plot format id's are ordered like displayed in m_plotFormatOpt
static const PlotFormat plotFmt[] = static const PLOT_FORMAT plotFmt[] = { PLOT_FORMAT::GERBER, PLOT_FORMAT::POST, PLOT_FORMAT::SVG,
{ PLOT_FORMAT::DXF, PLOT_FORMAT::HPGL, PLOT_FORMAT::PDF };
PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST,
PLOT_FORMAT_SVG,
PLOT_FORMAT_DXF,
PLOT_FORMAT_HPGL,
PLOT_FORMAT_PDF
};
return plotFmt[ m_plotFormatOpt->GetSelection() ]; return plotFmt[m_plotFormatOpt->GetSelection()];
} }
@ -379,12 +384,12 @@ PlotFormat DIALOG_PLOT::getPlotFormat()
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
{ {
// this option exist only in DXF format: // this option exist only in DXF format:
m_DXF_plotModeOpt->Enable( getPlotFormat() == PLOT_FORMAT_DXF ); m_DXF_plotModeOpt->Enable( getPlotFormat() == PLOT_FORMAT::DXF );
switch( getPlotFormat() ) switch( getPlotFormat() )
{ {
case PLOT_FORMAT_PDF: case PLOT_FORMAT::PDF:
case PLOT_FORMAT_SVG: case PLOT_FORMAT::SVG:
m_drillShapeOpt->Enable( true ); m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false ); m_plotModeOpt->Enable( false );
setPlotModeChoiceSelection( FILLED ); setPlotModeChoiceSelection( FILLED );
@ -409,7 +414,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT::POST:
m_drillShapeOpt->Enable( true ); m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true ); m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true ); m_plotMirrorOpt->Enable( true );
@ -431,7 +436,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT::GERBER:
m_drillShapeOpt->Enable( false ); m_drillShapeOpt->Enable( false );
m_drillShapeOpt->SetSelection( 0 ); m_drillShapeOpt->SetSelection( 0 );
m_plotModeOpt->Enable( false ); m_plotModeOpt->Enable( false );
@ -458,7 +463,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break; break;
case PLOT_FORMAT_HPGL: case PLOT_FORMAT::HPGL:
m_drillShapeOpt->Enable( true ); m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true ); m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true ); m_plotMirrorOpt->Enable( true );
@ -481,7 +486,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break; break;
case PLOT_FORMAT_DXF: case PLOT_FORMAT::DXF:
m_drillShapeOpt->Enable( true ); m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false ); m_plotModeOpt->Enable( false );
setPlotModeChoiceSelection( FILLED ); setPlotModeChoiceSelection( FILLED );
@ -509,7 +514,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
OnChangeDXFPlotMode( event ); OnChangeDXFPlotMode( event );
break; break;
case PLOT_FORMAT_UNDEFINED: case PLOT_FORMAT::UNDEFINED:
break; break;
} }
@ -589,11 +594,11 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() ); tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option
tempOptions.SetTextMode( PLOTTEXTMODE_DEFAULT ); tempOptions.SetTextMode( PLOT_TEXT_MODE::DEFAULT );
else else
tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? PLOT_TEXT_MODE::DEFAULT :
PLOTTEXTMODE_DEFAULT : PLOTTEXTMODE_NATIVE ); PLOT_TEXT_MODE::NATIVE );
// Update settings from text fields. Rewrite values back to the fields, // Update settings from text fields. Rewrite values back to the fields,
// since the values may have been constrained by the setters. // since the values may have been constrained by the setters.
@ -603,7 +608,7 @@ void DIALOG_PLOT::applyPlotSettings()
// However, due to issues when converting this value from or to mm // However, due to issues when converting this value from or to mm
// that can slightly change the value, update this param only if it // that can slightly change the value, update this param only if it
// is in use // is in use
if( getPlotFormat() == PLOT_FORMAT_HPGL ) if( getPlotFormat() == PLOT_FORMAT::HPGL )
{ {
if( !tempOptions.SetHPGLPenDiameter( m_defaultPenSize.GetValue() / IU_PER_MILS ) ) if( !tempOptions.SetHPGLPenDiameter( m_defaultPenSize.GetValue() / IU_PER_MILS ) )
{ {
@ -784,7 +789,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
* the default scale adjust is initialized to 0 and saved in program * the default scale adjust is initialized to 0 and saved in program
* settings resulting in a divide by zero fault. * settings resulting in a divide by zero fault.
*/ */
if( getPlotFormat() == PLOT_FORMAT_POST ) if( getPlotFormat() == PLOT_FORMAT::POST )
{ {
if( m_XScaleAdjust != 0.0 ) if( m_XScaleAdjust != 0.0 )
m_plotOpts.SetFineScaleAdjustX( m_XScaleAdjust ); m_plotOpts.SetFineScaleAdjustX( m_XScaleAdjust );
@ -831,7 +836,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Use Gerber Extensions based on layer number // Use Gerber Extensions based on layer number
// (See http://en.wikipedia.org/wiki/Gerber_File) // (See http://en.wikipedia.org/wiki/Gerber_File)
if( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER && m_useGerberExtensions->GetValue() ) if( m_plotOpts.GetFormat() == PLOT_FORMAT::GERBER && m_useGerberExtensions->GetValue() )
file_ext = GetGerberProtelExtension( layer ); file_ext = GetGerberProtelExtension( layer );
BuildPlotFileName( &fn, outputDir.GetPath(), board->GetLayerName( layer ), file_ext ); BuildPlotFileName( &fn, outputDir.GetPath(), board->GetLayerName( layer ), file_ext );
@ -863,7 +868,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
wxSafeYield(); // displays report message. wxSafeYield(); // displays report message.
} }
if( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER && m_plotOpts.GetCreateGerberJobFile() ) if( m_plotOpts.GetFormat() == PLOT_FORMAT::GERBER && m_plotOpts.GetCreateGerberJobFile() )
{ {
// Pick the basename from the board file // Pick the basename from the board file
wxFileName fn( boardFilename ); wxFileName fn( boardFilename );

View File

@ -79,7 +79,7 @@ private:
void init_Dialog(); // main initialization void init_Dialog(); // main initialization
void reInitDialog(); // initialization after calling drill dialog void reInitDialog(); // initialization after calling drill dialog
void applyPlotSettings(); void applyPlotSettings();
PlotFormat getPlotFormat(); PLOT_FORMAT getPlotFormat();
void setPlotModeChoiceSelection( EDA_DRAW_MODE_T aPlotMode ) void setPlotModeChoiceSelection( EDA_DRAW_MODE_T aPlotMode )
{ {

View File

@ -53,7 +53,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
{ {
wxASSERT( !m_items.Empty() ); wxASSERT( !m_items.Empty() );
VIATYPE_T viaType = VIA_NOT_DEFINED; VIATYPE viaType = VIATYPE::NOT_DEFINED;
m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() ); m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
@ -165,7 +165,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
m_viaDrill.SetValue( INDETERMINATE ); m_viaDrill.SetValue( INDETERMINATE );
if( viaType != v->GetViaType() ) if( viaType != v->GetViaType() )
viaType = VIA_NOT_DEFINED; viaType = VIATYPE::NOT_DEFINED;
if( m_ViaStartLayer->GetLayerSelection() != v->TopLayer() ) if( m_ViaStartLayer->GetLayerSelection() != v->TopLayer() )
m_ViaStartLayer->SetLayerSelection( UNDEFINED_LAYER ); m_ViaStartLayer->SetLayerSelection( UNDEFINED_LAYER );
@ -226,14 +226,22 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
switch( viaType ) switch( viaType )
{ {
case VIA_THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break; case VIATYPE::THROUGH:
case VIA_MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break; m_ViaTypeChoice->SetSelection( 0 );
case VIA_BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break; break;
case VIA_NOT_DEFINED: m_ViaTypeChoice->SetSelection( 3 ); break; case VIATYPE::MICROVIA:
m_ViaTypeChoice->SetSelection( 1 );
break;
case VIATYPE::BLIND_BURIED:
m_ViaTypeChoice->SetSelection( 2 );
break;
case VIATYPE::NOT_DEFINED:
m_ViaTypeChoice->SetSelection( 3 );
break;
} }
m_ViaStartLayer->Enable( viaType != VIA_THROUGH ); m_ViaStartLayer->Enable( viaType != VIATYPE::THROUGH );
m_ViaEndLayer->Enable( viaType != VIA_THROUGH ); m_ViaEndLayer->Enable( viaType != VIATYPE::THROUGH );
} }
else else
{ {
@ -453,9 +461,16 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
switch( m_ViaTypeChoice->GetSelection() ) switch( m_ViaTypeChoice->GetSelection() )
{ {
default: default:
case 0: v->SetViaType( VIA_THROUGH ); v->SanitizeLayers(); break; case 0:
case 1: v->SetViaType( VIA_MICROVIA ); break; v->SetViaType( VIATYPE::THROUGH );
case 2: v->SetViaType( VIA_BLIND_BURIED ); break; v->SanitizeLayers();
break;
case 1:
v->SetViaType( VIATYPE::MICROVIA );
break;
case 2:
v->SetViaType( VIATYPE::BLIND_BURIED );
break;
} }
} }
@ -478,13 +493,13 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
wxFAIL_MSG("Unhandled via type"); wxFAIL_MSG("Unhandled via type");
// fall through // fall through
case VIA_THROUGH: case VIATYPE::THROUGH:
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
v->SetWidth( v->GetNetClass()->GetViaDiameter() ); v->SetWidth( v->GetNetClass()->GetViaDiameter() );
v->SetDrill( v->GetNetClass()->GetViaDrill() ); v->SetDrill( v->GetNetClass()->GetViaDrill() );
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
v->SetWidth( v->GetNetClass()->GetuViaDiameter() ); v->SetWidth( v->GetNetClass()->GetuViaDiameter() );
v->SetDrill( v->GetNetClass()->GetuViaDrill() ); v->SetDrill( v->GetNetClass()->GetuViaDrill() );
break; break;

View File

@ -503,7 +503,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( width <= 0 ) if( width <= 0 )
width = m_board->GetDesignSettings().GetLineThickness( layer ); width = m_board->GetDesignSettings().GetLineThickness( layer );
m_board->Add( dseg, ADD_APPEND ); m_board->Add( dseg, ADD_MODE::APPEND );
if( !w.curve ) if( !w.curve )
{ {
@ -537,7 +537,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER ) if( layer != UNDEFINED_LAYER )
{ {
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board ); TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
m_board->Add( pcbtxt, ADD_APPEND ); m_board->Add( pcbtxt, ADD_MODE::APPEND );
pcbtxt->SetLayer( layer ); pcbtxt->SetLayer( layer );
pcbtxt->SetTimeStamp( EagleTimeStamp( gr ) ); pcbtxt->SetTimeStamp( EagleTimeStamp( gr ) );
@ -645,7 +645,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER ) // unsupported layer if( layer != UNDEFINED_LAYER ) // unsupported layer
{ {
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_APPEND ); m_board->Add( dseg, ADD_MODE::APPEND );
int width = c.width.ToPcbUnits(); int width = c.width.ToPcbUnits();
int radius = c.radius.ToPcbUnits(); int radius = c.radius.ToPcbUnits();
@ -679,7 +679,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
{ {
// use a "netcode = 0" type ZONE: // use a "netcode = 0" type ZONE:
ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
m_board->Add( zone, ADD_APPEND ); m_board->Add( zone, ADD_MODE::APPEND );
zone->SetTimeStamp( EagleTimeStamp( gr ) ); zone->SetTimeStamp( EagleTimeStamp( gr ) );
zone->SetLayer( layer ); zone->SetLayer( layer );
@ -711,7 +711,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
// Use m_hole_count to gen up a unique name. // Use m_hole_count to gen up a unique name.
MODULE* module = new MODULE( m_board ); MODULE* module = new MODULE( m_board );
m_board->Add( module, ADD_APPEND ); m_board->Add( module, ADD_MODE::APPEND );
module->SetReference( wxString::Format( "@HOLE%d", m_hole_count++ ) ); module->SetReference( wxString::Format( "@HOLE%d", m_hole_count++ ) );
module->Reference().SetVisible( false ); module->Reference().SetVisible( false );
@ -738,7 +738,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
{ {
const BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings(); const BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
DIMENSION* dimension = new DIMENSION( m_board ); DIMENSION* dimension = new DIMENSION( m_board );
m_board->Add( dimension, ADD_APPEND ); m_board->Add( dimension, ADD_MODE::APPEND );
if( d.dimensionType ) if( d.dimensionType )
{ {
@ -919,7 +919,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
// copy constructor to clone the template // copy constructor to clone the template
MODULE* m = new MODULE( *mi->second ); MODULE* m = new MODULE( *mi->second );
m_board->Add( m, ADD_APPEND ); m_board->Add( m, ADD_MODE::APPEND );
// update the nets within the pads of the clone // update the nets within the pads of the clone
for( auto pad : m->Pads() ) for( auto pad : m->Pads() )
@ -1127,7 +1127,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
// use a "netcode = 0" type ZONE: // use a "netcode = 0" type ZONE:
zone = new ZONE_CONTAINER( m_board ); zone = new ZONE_CONTAINER( m_board );
zone->SetTimeStamp( EagleTimeStamp( aPolyNode ) ); zone->SetTimeStamp( EagleTimeStamp( aPolyNode ) );
m_board->Add( zone, ADD_APPEND ); m_board->Add( zone, ADD_MODE::APPEND );
if( p.layer == EAGLE_LAYER::TRESTRICT ) // front layer keepout if( p.layer == EAGLE_LAYER::TRESTRICT ) // front layer keepout
zone->SetLayer( F_Cu ); zone->SetLayer( F_Cu );
@ -1239,7 +1239,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
// missing == yes per DTD. // missing == yes per DTD.
bool thermals = !p.thermals || *p.thermals; bool thermals = !p.thermals || *p.thermals;
zone->SetPadConnection( thermals ? PAD_ZONE_CONN_THERMAL : PAD_ZONE_CONN_FULL ); zone->SetPadConnection( thermals ? ZONE_CONNECTION::THERMAL : ZONE_CONNECTION::FULL );
if( thermals ) if( thermals )
{ {
@ -2035,7 +2035,7 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, D_PAD* aPad ) cons
// Solid connection to copper zones // Solid connection to copper zones
if( aEaglePad.thermals && !*aEaglePad.thermals ) if( aEaglePad.thermals && !*aEaglePad.thermals )
aPad->SetZoneConnection( PAD_ZONE_CONN_FULL ); aPad->SetZoneConnection( ZONE_CONNECTION::FULL );
MODULE* module = aPad->GetParent(); MODULE* module = aPad->GetParent();
wxCHECK( module, /* void */ ); wxCHECK( module, /* void */ );
@ -2216,11 +2216,11 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
m_min_via_hole = drillz; m_min_via_hole = drillz;
if( layer_front_most == F_Cu && layer_back_most == B_Cu ) if( layer_front_most == F_Cu && layer_back_most == B_Cu )
via->SetViaType( VIA_THROUGH ); via->SetViaType( VIATYPE::THROUGH );
else if( layer_front_most == F_Cu || layer_back_most == B_Cu ) else if( layer_front_most == F_Cu || layer_back_most == B_Cu )
via->SetViaType( VIA_MICROVIA ); via->SetViaType( VIATYPE::MICROVIA );
else else
via->SetViaType( VIA_BLIND_BURIED ); via->SetViaType( VIATYPE::BLIND_BURIED );
via->SetTimeStamp( EagleTimeStamp( netItem ) ); via->SetTimeStamp( EagleTimeStamp( netItem ) );

View File

@ -58,7 +58,7 @@ int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
// Micro vias have a size only defined in their netclass // Micro vias have a size only defined in their netclass
// (no specific values defined by a table of specific value) // (no specific values defined by a table of specific value)
// Ensure the netclass is accessible: // Ensure the netclass is accessible:
if( via->GetViaType() == VIA_MICROVIA && net == NULL ) if( via->GetViaType() == VIATYPE::MICROVIA && net == NULL )
net = aTrackItem->GetNet(); net = aTrackItem->GetNet();
// Get the draill value, regardless it is default or specific // Get the draill value, regardless it is default or specific
@ -75,7 +75,7 @@ int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
new_drill = GetDesignSettings().GetCurrentViaDrill(); new_drill = GetDesignSettings().GetCurrentViaDrill();
} }
if( via->GetViaType() == VIA_MICROVIA ) if( via->GetViaType() == VIATYPE::MICROVIA )
{ {
if( net ) if( net )
{ {

View File

@ -55,69 +55,68 @@ inline double diameter_in_mm( double ius )
} }
bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat )
PlotFormat aFormat )
{ {
// Remark: // Remark:
// Hole list must be created before calling this function, by buildHolesList(), // Hole list must be created before calling this function, by buildHolesList(),
// for the right holes set (PTH, NPTH, buried/blind vias ...) // for the right holes set (PTH, NPTH, buried/blind vias ...)
double scale = 1.0; double scale = 1.0;
wxPoint offset; wxPoint offset;
PLOTTER* plotter = NULL; PLOTTER* plotter = NULL;
PAGE_INFO dummy( PAGE_INFO::A4, false ); PAGE_INFO dummy( PAGE_INFO::A4, false );
PCB_PLOT_PARAMS plot_opts; // starts plotting with default options PCB_PLOT_PARAMS plot_opts; // starts plotting with default options
LOCALE_IO toggle; // use standard C notation for float numbers LOCALE_IO toggle; // use standard C notation for float numbers
const PAGE_INFO& page_info = m_pageInfo ? *m_pageInfo : dummy; const PAGE_INFO& page_info = m_pageInfo ? *m_pageInfo : dummy;
// Calculate dimensions and center of PCB // Calculate dimensions and center of PCB
EDA_RECT bbbox = m_pcb->GetBoardEdgesBoundingBox(); EDA_RECT bbbox = m_pcb->GetBoardEdgesBoundingBox();
// Calculate the scale for the format type, scale 1 in HPGL, drawing on // Calculate the scale for the format type, scale 1 in HPGL, drawing on
// an A4 sheet in PS, + text description of symbols // an A4 sheet in PS, + text description of symbols
switch( aFormat ) switch( aFormat )
{ {
case PLOT_FORMAT_GERBER: case PLOT_FORMAT::GERBER:
offset = GetOffset(); offset = GetOffset();
plotter = new GERBER_PLOTTER(); plotter = new GERBER_PLOTTER();
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false ); plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
break; break;
case PLOT_FORMAT_HPGL: // Scale for HPGL format. case PLOT_FORMAT::HPGL: // Scale for HPGL format.
{ {
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER; HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter; plotter = hpgl_plotter;
hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() ); hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() ); hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
plotter->SetPageSettings( page_info ); plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false ); plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
} }
break; break;
default: default:
wxASSERT( false ); wxASSERT( false );
// fall through // fall through
case PLOT_FORMAT_PDF: case PLOT_FORMAT::PDF:
case PLOT_FORMAT_POST: case PLOT_FORMAT::POST:
{ {
PAGE_INFO pageA4( wxT( "A4" ) ); PAGE_INFO pageA4( wxT( "A4" ) );
wxSize pageSizeIU = pageA4.GetSizeIU(); wxSize pageSizeIU = pageA4.GetSizeIU();
// Reserve a margin around the page. // Reserve a margin around the page.
int margin = KiROUND( 20 * IU_PER_MM ); int margin = KiROUND( 20 * IU_PER_MM );
// Calculate a scaling factor to print the board on the sheet // Calculate a scaling factor to print the board on the sheet
double Xscale = double( pageSizeIU.x - ( 2 * margin ) ) / bbbox.GetWidth(); double Xscale = double( pageSizeIU.x - ( 2 * margin ) ) / bbbox.GetWidth();
// We should print the list of drill sizes, so reserve room for it // We should print the list of drill sizes, so reserve room for it
// 60% height for board 40% height for list // 60% height for board 40% height for list
int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 ); int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 );
double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight(); double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight();
scale = std::min( Xscale, Yscale ); scale = std::min( Xscale, Yscale );
@ -126,22 +125,20 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
// So the scale is clipped at 3.0; // So the scale is clipped at 3.0;
scale = std::min( scale, 3.0 ); scale = std::min( scale, 3.0 );
offset.x = KiROUND( double( bbbox.Centre().x ) - offset.x = KiROUND( double( bbbox.Centre().x ) - ( pageSizeIU.x / 2.0 ) / scale );
( pageSizeIU.x / 2.0 ) / scale ); offset.y = KiROUND( double( bbbox.Centre().y ) - ( ypagesize_for_board / 2.0 ) / scale );
offset.y = KiROUND( double( bbbox.Centre().y ) -
( ypagesize_for_board / 2.0 ) / scale );
if( aFormat == PLOT_FORMAT_PDF ) if( aFormat == PLOT_FORMAT::PDF )
plotter = new PDF_PLOTTER; plotter = new PDF_PLOTTER;
else else
plotter = new PS_PLOTTER; plotter = new PS_PLOTTER;
plotter->SetPageSettings( pageA4 ); plotter->SetPageSettings( pageA4 );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false ); plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
} }
break; break;
case PLOT_FORMAT_DXF: case PLOT_FORMAT::DXF:
{ {
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER; DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
@ -152,25 +149,25 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
plotter = dxf_plotter; plotter = dxf_plotter;
plotter->SetPageSettings( page_info ); plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false ); plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
} }
break; break;
case PLOT_FORMAT_SVG: case PLOT_FORMAT::SVG:
{ {
SVG_PLOTTER* svg_plotter = new SVG_PLOTTER; SVG_PLOTTER* svg_plotter = new SVG_PLOTTER;
plotter = svg_plotter; plotter = svg_plotter;
plotter->SetPageSettings( page_info ); plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false ); plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
} }
break; break;
} }
plotter->SetCreator( wxT( "PCBNEW" ) ); plotter->SetCreator( wxT( "PCBNEW" ) );
plotter->SetDefaultLineWidth( 5 * IU_PER_MILS ); plotter->SetDefaultLineWidth( 5 * IU_PER_MILS );
plotter->SetColorMode( false ); plotter->SetColorMode( false );
if( ! plotter->OpenFile( aFullFileName ) ) if( !plotter->OpenFile( aFullFileName ) )
{ {
delete plotter; delete plotter;
return false; return false;
@ -196,18 +193,18 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
case PCB_TARGET_T: case PCB_TARGET_T:
case PCB_MARKER_T: // do not draw case PCB_MARKER_T: // do not draw
default: default:
break; break;
} }
} }
int x, y; int x, y;
int plotX, plotY, TextWidth; int plotX, plotY, TextWidth;
int intervalle = 0; int intervalle = 0;
char line[1024]; char line[1024];
wxString msg; wxString msg;
int textmarginaftersymbol = KiROUND( 2 * IU_PER_MM ); int textmarginaftersymbol = KiROUND( 2 * IU_PER_MM );
// Set Drill Symbols width // Set Drill Symbols width
plotter->SetDefaultLineWidth( 0.2 * IU_PER_MM / scale ); plotter->SetDefaultLineWidth( 0.2 * IU_PER_MM / scale );
@ -217,23 +214,21 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
plotDrillMarks( plotter ); plotDrillMarks( plotter );
// Print a list of symbols used. // Print a list of symbols used.
int charSize = 3 * IU_PER_MM; // text size in IUs int charSize = 3 * IU_PER_MM; // text size in IUs
double charScale = 1.0 / scale; // real scale will be 1/scale, double charScale = 1.0 / scale; // real scale will be 1/scale,
// because the global plot scale is scale // because the global plot scale is scale
TextWidth = KiROUND( (charSize * charScale) / 10.0 ); // Set text width (thickness) TextWidth = KiROUND( ( charSize * charScale ) / 10.0 ); // Set text width (thickness)
intervalle = KiROUND( charSize * charScale ) + TextWidth; intervalle = KiROUND( charSize * charScale ) + TextWidth;
// Trace information. // Trace information.
plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale ); plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
plotY = bbbox.GetBottom() + intervalle; plotY = bbbox.GetBottom() + intervalle;
// Plot title "Info" // Plot title "Info"
wxString Text = wxT( "Drill Map:" ); wxString Text = wxT( "Drill Map:" );
plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0, plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0,
wxSize( KiROUND( charSize * charScale ), wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
KiROUND( charSize * charScale ) ), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ ) for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
{ {
@ -250,15 +245,13 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
plotter->Marker( wxPoint( x, y ), plot_diam, ii ); plotter->Marker( wxPoint( x, y ), plot_diam, ii );
// List the diameter of each drill in mm and inches. // List the diameter of each drill in mm and inches.
sprintf( line, "%2.2fmm / %2.3f\" ", sprintf( line, "%2.2fmm / %2.3f\" ", diameter_in_mm( tool.m_Diameter ),
diameter_in_mm( tool.m_Diameter ), diameter_in_inches( tool.m_Diameter ) );
diameter_in_inches( tool.m_Diameter ) );
msg = FROM_UTF8( line ); msg = FROM_UTF8( line );
// Now list how many holes and ovals are associated with each drill. // Now list how many holes and ovals are associated with each drill.
if( ( tool.m_TotalCount == 1 ) if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
&& ( tool.m_OvalCount == 0 ) )
sprintf( line, "(1 hole)" ); sprintf( line, "(1 hole)" );
else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 ) else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 )
sprintf( line, "(1 slot)" ); sprintf( line, "(1 slot)" );
@ -267,9 +260,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
else if( tool.m_OvalCount == 1 ) else if( tool.m_OvalCount == 1 )
sprintf( line, "(%d holes + 1 slot)", tool.m_TotalCount - 1 ); sprintf( line, "(%d holes + 1 slot)", tool.m_TotalCount - 1 );
else // if ( toolm_OvalCount > 1 ) else // if ( toolm_OvalCount > 1 )
sprintf( line, "(%d holes + %d slots)", sprintf( line, "(%d holes + %d slots)", tool.m_TotalCount - tool.m_OvalCount,
tool.m_TotalCount - tool.m_OvalCount, tool.m_OvalCount );
tool.m_OvalCount );
msg += FROM_UTF8( line ); msg += FROM_UTF8( line );
@ -277,10 +269,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
msg += wxT( " (not plated)" ); msg += wxT( " (not plated)" );
plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0, plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0,
wxSize( KiROUND( charSize * charScale ), wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
KiROUND( charSize * charScale ) ), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 ); intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );

View File

@ -146,7 +146,7 @@ protected:
std::vector<HOLE_INFO> m_holeListBuffer; // Buffer containing holes std::vector<HOLE_INFO> m_holeListBuffer; // Buffer containing holes
std::vector<DRILL_TOOL> m_toolListBuffer; // Buffer containing tools std::vector<DRILL_TOOL> m_toolListBuffer; // Buffer containing tools
PlotFormat m_mapFileFmt; // the format of the map drill file, PLOT_FORMAT m_mapFileFmt; // the format of the map drill file,
// if this map is needed // if this map is needed
const PAGE_INFO* m_pageInfo; // the page info used to plot drill maps const PAGE_INFO* m_pageInfo; // the page info used to plot drill maps
// If NULL, use a A4 page format // If NULL, use a A4 page format
@ -154,13 +154,13 @@ protected:
// Use derived classes to build a fully initialized GENDRILL_WRITER_BASE class. // Use derived classes to build a fully initialized GENDRILL_WRITER_BASE class.
GENDRILL_WRITER_BASE( BOARD* aPcb ) GENDRILL_WRITER_BASE( BOARD* aPcb )
{ {
m_pcb = aPcb; m_pcb = aPcb;
m_conversionUnits = 1.0; m_conversionUnits = 1.0;
m_unitsMetric = true; m_unitsMetric = true;
m_mapFileFmt = PLOT_FORMAT_PDF; m_mapFileFmt = PLOT_FORMAT::PDF;
m_pageInfo = NULL; m_pageInfo = NULL;
m_merge_PTH_NPTH = false; m_merge_PTH_NPTH = false;
m_zeroFormat = DECIMAL_FORMAT; m_zeroFormat = DECIMAL_FORMAT;
} }
public: public:
@ -195,7 +195,10 @@ public:
* PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF * PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
* the most useful are PLOT_FORMAT_PDF and PLOT_FORMAT_POST * the most useful are PLOT_FORMAT_PDF and PLOT_FORMAT_POST
*/ */
void SetMapFileFormat( PlotFormat aMapFmt ) { m_mapFileFmt = aMapFmt; } void SetMapFileFormat( PLOT_FORMAT aMapFmt )
{
m_mapFileFmt = aMapFmt;
}
/** /**
* Function CreateMapFilesSet * Function CreateMapFilesSet
@ -273,7 +276,7 @@ protected:
* @param aFullFileName : the full filename of the map file to create, * @param aFullFileName : the full filename of the map file to create,
* @param aFormat : one of the supported plot formats (see enum PlotFormat ) * @param aFormat : one of the supported plot formats (see enum PlotFormat )
*/ */
bool genDrillMapFile( const wxString& aFullFileName, PlotFormat aFormat ); bool genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat );
/** /**
* Function BuildHolesList * Function BuildHolesList

View File

@ -931,7 +931,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
getCurFootprintName() ); getCurFootprintName() );
if( footprint ) if( footprint )
GetBoard()->Add( footprint, ADD_APPEND ); GetBoard()->Add( footprint, ADD_MODE::APPEND );
Update3DView( true ); Update3DView( true );

View File

@ -110,7 +110,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
if( module ) if( module )
{ {
// Add the object to board // Add the object to board
GetBoard()->Add( module, ADD_APPEND ); GetBoard()->Add( module, ADD_MODE::APPEND );
module->SetPosition( wxPoint( 0, 0 ) ); module->SetPosition( wxPoint( 0, 0 ) );
} }
else else

View File

@ -1107,7 +1107,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(clearance %s)\n", m_out->Print( aNestLevel+1, "(clearance %s)\n",
FormatInternalUnits( aModule->GetLocalClearance() ).c_str() ); FormatInternalUnits( aModule->GetLocalClearance() ).c_str() );
if( aModule->GetZoneConnection() != PAD_ZONE_CONN_INHERITED ) if( aModule->GetZoneConnection() != ZONE_CONNECTION::INHERITED )
m_out->Print( aNestLevel+1, "(zone_connect %d)\n", aModule->GetZoneConnection() ); m_out->Print( aNestLevel+1, "(zone_connect %d)\n", aModule->GetZoneConnection() );
if( aModule->GetThermalWidth() != 0 ) if( aModule->GetThermalWidth() != 0 )
@ -1430,7 +1430,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
if( aPad->GetLocalClearance() != 0 ) if( aPad->GetLocalClearance() != 0 )
StrPrintf( &output, " (clearance %s)", FormatInternalUnits( aPad->GetLocalClearance() ).c_str() ); StrPrintf( &output, " (clearance %s)", FormatInternalUnits( aPad->GetLocalClearance() ).c_str() );
if( aPad->GetZoneConnection() != PAD_ZONE_CONN_INHERITED ) if( aPad->GetZoneConnection() != ZONE_CONNECTION::INHERITED )
StrPrintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() ); StrPrintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() );
if( aPad->GetThermalWidth() != 0 ) if( aPad->GetThermalWidth() != 0 )
@ -1659,14 +1659,14 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const
switch( via->GetViaType() ) switch( via->GetViaType() )
{ {
case VIA_THROUGH: // Default shape not saved. case VIATYPE::THROUGH: // Default shape not saved.
break; break;
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
m_out->Print( 0, " blind" ); m_out->Print( 0, " blind" );
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
m_out->Print( 0, " micro" ); m_out->Print( 0, " micro" );
break; break;
@ -1755,18 +1755,18 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
switch( aZone->GetPadConnection() ) switch( aZone->GetPadConnection() )
{ {
default: default:
case PAD_ZONE_CONN_THERMAL: // Default option not saved or loaded. case ZONE_CONNECTION::THERMAL: // Default option not saved or loaded.
break; break;
case PAD_ZONE_CONN_THT_THERMAL: case ZONE_CONNECTION::THT_THERMAL:
m_out->Print( 0, " thru_hole_only" ); m_out->Print( 0, " thru_hole_only" );
break; break;
case PAD_ZONE_CONN_FULL: case ZONE_CONNECTION::FULL:
m_out->Print( 0, " yes" ); m_out->Print( 0, " yes" );
break; break;
case PAD_ZONE_CONN_NONE: case ZONE_CONNECTION::NONE:
m_out->Print( 0, " no" ); m_out->Print( 0, " no" );
break; break;
} }

View File

@ -451,7 +451,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend )
module->SetFPID( fpid ); module->SetFPID( fpid );
loadMODULE( module.get() ); loadMODULE( module.get() );
m_board->Add( module.release(), ADD_APPEND ); m_board->Add( module.release(), ADD_MODE::APPEND );
} }
else if( TESTLINE( "$DRAWSEGMENT" ) ) else if( TESTLINE( "$DRAWSEGMENT" ) )
@ -1383,7 +1383,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
else if( TESTLINE( ".ZoneConnection" ) ) else if( TESTLINE( ".ZoneConnection" ) )
{ {
int tmp = intParse( line + SZ( ".ZoneConnection" ) ); int tmp = intParse( line + SZ( ".ZoneConnection" ) );
aModule->SetZoneConnection( (ZoneConnection)tmp ); aModule->SetZoneConnection( (ZONE_CONNECTION) tmp );
} }
else if( TESTLINE( ".ThermalWidth" ) ) else if( TESTLINE( ".ThermalWidth" ) )
@ -1618,7 +1618,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
else if( TESTLINE( ".ZoneConnection" ) ) else if( TESTLINE( ".ZoneConnection" ) )
{ {
int tmp = intParse( line + SZ( ".ZoneConnection" ) ); int tmp = intParse( line + SZ( ".ZoneConnection" ) );
pad->SetZoneConnection( (ZoneConnection)tmp ); pad->SetZoneConnection( (ZONE_CONNECTION) tmp );
} }
else if( TESTLINE( ".ThermalWidth" ) ) else if( TESTLINE( ".ThermalWidth" ) )
@ -2047,7 +2047,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
else if( TESTLINE( "$EndDRAWSEGMENT" ) ) else if( TESTLINE( "$EndDRAWSEGMENT" ) )
{ {
m_board->Add( dseg.release(), ADD_APPEND ); m_board->Add( dseg.release(), ADD_MODE::APPEND );
return; // preferred exit return; // preferred exit
} }
} }
@ -2147,7 +2147,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
// maybe someday a constructor that takes all this data in one call? // maybe someday a constructor that takes all this data in one call?
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board ); TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
m_board->Add( pcbtxt, ADD_APPEND ); m_board->Add( pcbtxt, ADD_MODE::APPEND );
char* line; char* line;
char* saveptr; char* saveptr;
@ -2258,7 +2258,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
assert( TESTLINE( "Po" ) ); assert( TESTLINE( "Po" ) );
VIATYPE_T viatype = static_cast<VIATYPE_T>( intParse( line + SZ( "Po" ), &data )); VIATYPE viatype = static_cast<VIATYPE>( intParse( line + SZ( "Po" ), &data ) );
BIU start_x = biuParse( data, &data ); BIU start_x = biuParse( data, &data );
BIU start_y = biuParse( data, &data ); BIU start_y = biuParse( data, &data );
BIU end_x = biuParse( data, &data ); BIU end_x = biuParse( data, &data );
@ -2350,7 +2350,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
else else
via->SetDrill( drill ); via->SetDrill( drill );
if( via->GetViaType() == VIA_THROUGH ) if( via->GetViaType() == VIATYPE::THROUGH )
via->SetLayerPair( F_Cu, B_Cu ); via->SetLayerPair( F_Cu, B_Cu );
else else
{ {
@ -2672,17 +2672,25 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
BIU clearance = biuParse( line + SZ( "ZClearance" ), &data ); BIU clearance = biuParse( line + SZ( "ZClearance" ), &data );
char* padoption = strtok_r( (char*) data, delims, &saveptr ); // data: " I" char* padoption = strtok_r( (char*) data, delims, &saveptr ); // data: " I"
ZoneConnection popt; ZONE_CONNECTION popt;
switch( *padoption ) switch( *padoption )
{ {
case 'I': popt = PAD_ZONE_CONN_FULL; break; case 'I':
case 'T': popt = PAD_ZONE_CONN_THERMAL; break; popt = ZONE_CONNECTION::FULL;
case 'H': popt = PAD_ZONE_CONN_THT_THERMAL; break; break;
case 'X': popt = PAD_ZONE_CONN_NONE; break; case 'T':
popt = ZONE_CONNECTION::THERMAL;
break;
case 'H':
popt = ZONE_CONNECTION::THT_THERMAL;
break;
case 'X':
popt = ZONE_CONNECTION::NONE;
break;
default: default:
m_error.Printf( _( "Bad ZClearance padoption for CZONE_CONTAINER \"%s\"" ), m_error.Printf( _( "Bad ZClearance padoption for CZONE_CONTAINER \"%s\"" ),
zc->GetNetname().GetData() ); zc->GetNetname().GetData() );
THROW_IO_ERROR( m_error ); THROW_IO_ERROR( m_error );
} }
@ -2796,7 +2804,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
if( TESTLINE( "$endCOTATION" ) ) if( TESTLINE( "$endCOTATION" ) )
{ {
m_board->Add( dim.release(), ADD_APPEND ); m_board->Add( dim.release(), ADD_MODE::APPEND );
return; // preferred exit return; // preferred exit
} }
@ -3009,7 +3017,7 @@ void LEGACY_PLUGIN::loadPCB_TARGET()
PCB_TARGET* t = new PCB_TARGET( m_board, shape, leg_layer2new( m_cu_count, layer_num ), PCB_TARGET* t = new PCB_TARGET( m_board, shape, leg_layer2new( m_cu_count, layer_num ),
wxPoint( pos_x, pos_y ), size, width ); wxPoint( pos_x, pos_y ), size, width );
m_board->Add( t, ADD_APPEND ); m_board->Add( t, ADD_MODE::APPEND );
t->SetTimeStamp( timestamp ); t->SetTimeStamp( timestamp );
} }

View File

@ -70,7 +70,7 @@ MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue,
{ {
D_PAD* pad = new D_PAD( module ); D_PAD* pad = new D_PAD( module );
module->Add( pad, ADD_INSERT ); module->Add( pad, ADD_MODE::INSERT );
int tw = GetDesignSettings().GetCurrentTrackWidth(); int tw = GetDesignSettings().GetCurrentTrackWidth();
pad->SetSize( wxSize( tw, tw ) ); pad->SetSize( wxSize( tw, tw ) );
@ -484,7 +484,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
edge->SetShape( S_POLYGON ); edge->SetShape( S_POLYGON );
edge->SetLayer( F_Cu ); edge->SetLayer( F_Cu );
module->Add( edge, ADD_INSERT ); module->Add( edge, ADD_MODE::INSERT );
// Get the corner buffer of the polygonal edge // Get the corner buffer of the polygonal edge
std::vector<wxPoint> polyPoints; std::vector<wxPoint> polyPoints;

View File

@ -179,7 +179,7 @@ void PCB_ARC::AddToBoard()
{ {
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_APPEND ); m_board->Add( dseg, ADD_MODE::APPEND );
dseg->SetShape( IsCircle() ? S_CIRCLE : S_ARC ); dseg->SetShape( IsCircle() ? S_CIRCLE : S_ARC );
dseg->SetTimeStamp( m_timestamp ); dseg->SetTimeStamp( m_timestamp );

View File

@ -153,7 +153,7 @@ void PCB_LINE::AddToBoard()
else else
{ {
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_APPEND ); m_board->Add( dseg, ADD_MODE::APPEND );
dseg->SetTimeStamp( m_timestamp ); dseg->SetTimeStamp( m_timestamp );
dseg->SetLayer( m_KiCadLayer ); dseg->SetLayer( m_KiCadLayer );

View File

@ -512,7 +512,7 @@ void PCB_MODULE::AddToBoard()
(double) -m_rotation ); (double) -m_rotation );
MODULE* module = new MODULE( m_board ); MODULE* module = new MODULE( m_board );
m_board->Add( module, ADD_APPEND ); m_board->Add( module, ADD_MODE::APPEND );
module->SetPosition( wxPoint( m_positionX, m_positionY ) ); module->SetPosition( wxPoint( m_positionX, m_positionY ) );
module->SetLayer( m_mirror ? B_Cu : F_Cu ); module->SetLayer( m_mirror ? B_Cu : F_Cu );

View File

@ -349,7 +349,7 @@ void PCB_PAD::AddToBoard()
via->SetEnd( wxPoint( m_positionX, m_positionY ) ); via->SetEnd( wxPoint( m_positionX, m_positionY ) );
via->SetWidth( height ); via->SetWidth( height );
via->SetViaType( VIA_THROUGH ); via->SetViaType( VIATYPE::THROUGH );
via->SetLayerPair( F_Cu, B_Cu ); via->SetLayerPair( F_Cu, B_Cu );
via->SetDrill( m_hole ); via->SetDrill( m_hole );
@ -360,7 +360,7 @@ void PCB_PAD::AddToBoard()
else // pad else // pad
{ {
MODULE* module = new MODULE( m_board ); MODULE* module = new MODULE( m_board );
m_board->Add( module, ADD_APPEND ); m_board->Add( module, ADD_MODE::APPEND );
m_name.text = m_defaultPinDes; m_name.text = m_defaultPinDes;

View File

@ -187,7 +187,7 @@ void PCB_POLYGON::AddToBoard()
if( m_outline.GetCount() > 0 ) if( m_outline.GetCount() > 0 )
{ {
ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
m_board->Add( zone, ADD_APPEND ); m_board->Add( zone, ADD_MODE::APPEND );
zone->SetTimeStamp( m_timestamp ); zone->SetTimeStamp( m_timestamp );
zone->SetLayer( m_KiCadLayer ); zone->SetLayer( m_KiCadLayer );

View File

@ -106,7 +106,7 @@ void PCB_TEXT::AddToBoard()
m_name.textRotation = m_rotation; m_name.textRotation = m_rotation;
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board ); TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
m_board->Add( pcbtxt, ADD_APPEND ); m_board->Add( pcbtxt, ADD_MODE::APPEND );
pcbtxt->SetText( m_name.text ); pcbtxt->SetText( m_name.text );

View File

@ -180,7 +180,7 @@ void PCB_BASE_FRAME::AddModuleToBoard( MODULE* module )
{ {
if( module ) if( module )
{ {
GetBoard()->Add( module, ADD_APPEND ); GetBoard()->Add( module, ADD_MODE::APPEND );
module->SetFlags( IS_NEW ); module->SetFlags( IS_NEW );

View File

@ -909,11 +909,21 @@ void PCB_EDIT_FRAME::ToPlotter( int aID )
switch( aID ) switch( aID )
{ {
case ID_GEN_PLOT_GERBER: plotSettings.SetFormat( PLOT_FORMAT_GERBER ); break; case ID_GEN_PLOT_GERBER:
case ID_GEN_PLOT_DXF: plotSettings.SetFormat( PLOT_FORMAT_DXF ); break; plotSettings.SetFormat( PLOT_FORMAT::GERBER );
case ID_GEN_PLOT_HPGL: plotSettings.SetFormat( PLOT_FORMAT_HPGL ); break; break;
case ID_GEN_PLOT_PDF: plotSettings.SetFormat( PLOT_FORMAT_PDF ); break; case ID_GEN_PLOT_DXF:
case ID_GEN_PLOT_PS: plotSettings.SetFormat( PLOT_FORMAT_POST ); break; plotSettings.SetFormat( PLOT_FORMAT::DXF );
break;
case ID_GEN_PLOT_HPGL:
plotSettings.SetFormat( PLOT_FORMAT::HPGL );
break;
case ID_GEN_PLOT_PDF:
plotSettings.SetFormat( PLOT_FORMAT::PDF );
break;
case ID_GEN_PLOT_PS:
plotSettings.SetFormat( PLOT_FORMAT::POST );
break;
case ID_GEN_PLOT: /* keep the previous setup */ break; case ID_GEN_PLOT: /* keep the previous setup */ break;
default: default:
wxFAIL_MSG( "ToPlotter(): unexpected plot type" ); break; wxFAIL_MSG( "ToPlotter(): unexpected plot type" ); break;

View File

@ -535,15 +535,15 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
switch( aVia->GetViaType() ) switch( aVia->GetViaType() )
{ {
case VIA_THROUGH: case VIATYPE::THROUGH:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH]; sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH];
break; break;
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_BBLIND]; sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_BBLIND];
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_MICROVIA]; sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_MICROVIA];
break; break;
@ -567,7 +567,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
m_gal->SetFillColor( color ); m_gal->SetFillColor( color );
} }
if( aVia->GetViaType() == VIA_BLIND_BURIED && aLayer != LAYER_VIAS_HOLES ) if( aVia->GetViaType() == VIATYPE::BLIND_BURIED && aLayer != LAYER_VIAS_HOLES )
{ {
// Outer circles of blind/buried vias are drawn in a special way to indicate the // Outer circles of blind/buried vias are drawn in a special way to indicate the
// top and bottom layers // top and bottom layers

View File

@ -567,35 +567,35 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
case T_gr_curve: case T_gr_curve:
case T_gr_line: case T_gr_line:
case T_gr_poly: case T_gr_poly:
m_board->Add( parseDRAWSEGMENT(), ADD_APPEND ); m_board->Add( parseDRAWSEGMENT(), ADD_MODE::APPEND );
break; break;
case T_gr_text: case T_gr_text:
m_board->Add( parseTEXTE_PCB(), ADD_APPEND ); m_board->Add( parseTEXTE_PCB(), ADD_MODE::APPEND );
break; break;
case T_dimension: case T_dimension:
m_board->Add( parseDIMENSION(), ADD_APPEND ); m_board->Add( parseDIMENSION(), ADD_MODE::APPEND );
break; break;
case T_module: case T_module:
m_board->Add( parseMODULE(), ADD_APPEND ); m_board->Add( parseMODULE(), ADD_MODE::APPEND );
break; break;
case T_segment: case T_segment:
m_board->Add( parseTRACK(), ADD_INSERT ); m_board->Add( parseTRACK(), ADD_MODE::INSERT );
break; break;
case T_via: case T_via:
m_board->Add( parseVIA(), ADD_INSERT ); m_board->Add( parseVIA(), ADD_MODE::INSERT );
break; break;
case T_zone: case T_zone:
m_board->Add( parseZONE_CONTAINER( m_board ), ADD_APPEND ); m_board->Add( parseZONE_CONTAINER( m_board ), ADD_MODE::APPEND );
break; break;
case T_target: case T_target:
m_board->Add( parsePCB_TARGET(), ADD_APPEND ); m_board->Add( parsePCB_TARGET(), ADD_MODE::APPEND );
break; break;
default: default:
@ -647,7 +647,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
VIA* via = (VIA*) segm; VIA* via = (VIA*) segm;
PCB_LAYER_ID top_layer, bottom_layer; PCB_LAYER_ID top_layer, bottom_layer;
if( via->GetViaType() == VIA_THROUGH ) if( via->GetViaType() == VIATYPE::THROUGH )
continue; continue;
via->LayerPair( &top_layer, &bottom_layer ); via->LayerPair( &top_layer, &bottom_layer );
@ -2444,7 +2444,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
break; break;
case T_zone_connect: case T_zone_connect:
module->SetZoneConnection( (ZoneConnection) parseInt( "zone connection value" ) ); module->SetZoneConnection( (ZONE_CONNECTION) parseInt( "zone connection value" ) );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -2524,7 +2524,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
RotatePoint( &pt, module->GetOrientation() ); RotatePoint( &pt, module->GetOrientation() );
pad->SetPosition( pt + module->GetPosition() ); pad->SetPosition( pt + module->GetPosition() );
module->Add( pad, ADD_APPEND ); module->Add( pad, ADD_MODE::APPEND );
} }
break; break;
@ -2535,7 +2535,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
case T_zone: case T_zone:
{ {
ZONE_CONTAINER* zone = parseZONE_CONTAINER( module.get() ); ZONE_CONTAINER* zone = parseZONE_CONTAINER( module.get() );
module->Add( zone, ADD_APPEND ); module->Add( zone, ADD_MODE::APPEND );
} }
break; break;
@ -3065,7 +3065,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
break; break;
case T_zone_connect: case T_zone_connect:
pad->SetZoneConnection( (ZoneConnection) parseInt( "zone connection value" ) ); pad->SetZoneConnection( (ZONE_CONNECTION) parseInt( "zone connection value" ) );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -3361,11 +3361,11 @@ VIA* PCB_PARSER::parseVIA()
switch( token ) switch( token )
{ {
case T_blind: case T_blind:
via->SetViaType( VIA_BLIND_BURIED ); via->SetViaType( VIATYPE::BLIND_BURIED );
break; break;
case T_micro: case T_micro:
via->SetViaType( VIA_MICROVIA ); via->SetViaType( VIATYPE::MICROVIA );
break; break;
case T_at: case T_at:
@ -3536,15 +3536,15 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
switch( token ) switch( token )
{ {
case T_yes: case T_yes:
zone->SetPadConnection( PAD_ZONE_CONN_FULL ); zone->SetPadConnection( ZONE_CONNECTION::FULL );
break; break;
case T_no: case T_no:
zone->SetPadConnection( PAD_ZONE_CONN_NONE ); zone->SetPadConnection( ZONE_CONNECTION::NONE );
break; break;
case T_thru_hole_only: case T_thru_hole_only:
zone->SetPadConnection( PAD_ZONE_CONN_THT_THERMAL ); zone->SetPadConnection( ZONE_CONNECTION::THT_THERMAL );
break; break;
case T_clearance: case T_clearance:

View File

@ -115,7 +115,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_plotInvisibleText = false; m_plotInvisibleText = false;
m_plotPadsOnSilkLayer = false; m_plotPadsOnSilkLayer = false;
m_subtractMaskFromSilk = false; m_subtractMaskFromSilk = false;
m_format = PLOT_FORMAT_GERBER; m_format = PLOT_FORMAT::GERBER;
m_mirror = false; m_mirror = false;
m_drillMarks = SMALL_DRILL_SHAPE; m_drillMarks = SMALL_DRILL_SHAPE;
m_autoScale = false; m_autoScale = false;
@ -124,9 +124,9 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_fineScaleAdjustX = 1.0; m_fineScaleAdjustX = 1.0;
m_fineScaleAdjustY = 1.0; m_fineScaleAdjustY = 1.0;
m_widthAdjust = 0.; m_widthAdjust = 0.;
m_outputDirectory.clear();
m_color = BLACK; m_color = BLACK;
m_textMode = PLOTTEXTMODE_DEFAULT; m_textMode = PLOT_TEXT_MODE::DEFAULT;
m_outputDirectory.clear();
m_layerSelection = LSET( 7, F_SilkS, B_SilkS, F_Mask, B_Mask, m_layerSelection = LSET( 7, F_SilkS, B_SilkS, F_Mask, B_Mask,
F_Paste, B_Paste, Edge_Cuts ) F_Paste, B_Paste, Edge_Cuts )
| LSET::AllCuMask(); | LSET::AllCuMask();
@ -505,8 +505,9 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
break; break;
case T_outputformat: case T_outputformat:
aPcbPlotParams->m_format = static_cast<PlotFormat>( aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
parseInt( PLOT_FIRST_FORMAT, PLOT_LAST_FORMAT ) ); parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
break; break;
case T_mirror: case T_mirror:

View File

@ -66,13 +66,13 @@ private:
DXF_PLOTTER::DXF_UNITS m_DXFplotUnits; DXF_PLOTTER::DXF_UNITS m_DXFplotUnits;
/// Plot format type (chooses the driver to be used) /// Plot format type (chooses the driver to be used)
PlotFormat m_format; PLOT_FORMAT m_format;
/// Holes can be not plotted, have a small mark or plotted in actual size /// Holes can be not plotted, have a small mark or plotted in actual size
DrillMarksType m_drillMarks; DrillMarksType m_drillMarks;
/// Choose how represent text with PS, PDF and DXF drivers /// Choose how represent text with PS, PDF and DXF drivers
PlotTextMode m_textMode; PLOT_TEXT_MODE m_textMode;
/// The default line width (used to draw items having no defined width) /// The default line width (used to draw items having no defined width)
int m_lineWidth; int m_lineWidth;
@ -192,8 +192,15 @@ public:
void SetColor( COLOR4D aVal ) { m_color = aVal; } void SetColor( COLOR4D aVal ) { m_color = aVal; }
COLOR4D GetColor() const { return m_color; } COLOR4D GetColor() const { return m_color; }
void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; } void SetTextMode( PLOT_TEXT_MODE aVal )
PlotTextMode GetTextMode() const { return m_textMode; } {
m_textMode = aVal;
}
PLOT_TEXT_MODE GetTextMode() const
{
return m_textMode;
}
void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; } void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; }
EDA_DRAW_MODE_T GetPlotMode() const { return m_plotMode; } EDA_DRAW_MODE_T GetPlotMode() const { return m_plotMode; }
@ -252,8 +259,15 @@ public:
void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; } void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; } bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
void SetFormat( PlotFormat aFormat ) { m_format = aFormat; } void SetFormat( PLOT_FORMAT aFormat )
PlotFormat GetFormat() const { return m_format; } {
m_format = aFormat;
}
PLOT_FORMAT GetFormat() const
{
return m_format;
}
void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; } void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
wxString GetOutputDirectory() const { return m_outputDirectory; } wxString GetOutputDirectory() const { return m_outputDirectory; }

View File

@ -433,9 +433,8 @@ void PLOT_CONTROLLER::ClosePlot()
} }
bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix, bool PLOT_CONTROLLER::OpenPlotfile(
PlotFormat aFormat, const wxString& aSuffix, PLOT_FORMAT aFormat, const wxString& aSheetDesc )
const wxString &aSheetDesc )
{ {
LOCALE_IO toggle; LOCALE_IO toggle;
@ -462,8 +461,8 @@ bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix,
// Gerber format can use specific file ext, depending on layers // Gerber format can use specific file ext, depending on layers
// (now not a good practice, because the official file ext is .gbr) // (now not a good practice, because the official file ext is .gbr)
if( GetPlotOptions().GetFormat() == PLOT_FORMAT_GERBER && if( GetPlotOptions().GetFormat() == PLOT_FORMAT::GERBER
GetPlotOptions().GetUseGerberProtelExtensions() ) && GetPlotOptions().GetUseGerberProtelExtensions() )
fileExt = GetGerberProtelExtension( GetLayer() ); fileExt = GetGerberProtelExtension( GetLayer() );
// Build plot filenames from the board name and layer names: // Build plot filenames from the board name and layer names:

View File

@ -94,7 +94,7 @@ public:
*/ */
int getFineWidthAdj() int getFineWidthAdj()
{ {
if( GetFormat() == PLOT_FORMAT_POST ) if( GetFormat() == PLOT_FORMAT::POST )
return GetWidthAdjust(); return GetWidthAdjust();
else else
return 0; return 0;

View File

@ -167,7 +167,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
{ {
// Skip NPTH pads on copper layers ( only if hole size == pad size ): // Skip NPTH pads on copper layers ( only if hole size == pad size ):
// Drill mark will be plotted if drill mark is SMALL_DRILL_SHAPE or FULL_DRILL_SHAPE // Drill mark will be plotted if drill mark is SMALL_DRILL_SHAPE or FULL_DRILL_SHAPE
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
{ {
plotOpt.SetSkipPlotNPTH_Pads( false ); plotOpt.SetSkipPlotNPTH_Pads( false );
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
@ -191,7 +191,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
// Plot solder mask: // Plot solder mask:
if( soldermask_min_thickness == 0 ) if( soldermask_min_thickness == 0 )
{ {
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
else else
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
@ -210,7 +210,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
// Disable plot pad holes // Disable plot pad holes
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
else else
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
@ -218,7 +218,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
case F_SilkS: case F_SilkS:
case B_SilkS: case B_SilkS:
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetDXFPlotPolygonMode() ) if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
// PlotLayerOutlines() is designed only for DXF plotters. // PlotLayerOutlines() is designed only for DXF plotters.
// and must not be used for other plot formats // and must not be used for other plot formats
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
@ -226,8 +226,8 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt );
// Gerber: Subtract soldermask from silkscreen if enabled // Gerber: Subtract soldermask from silkscreen if enabled
if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER if( aPlotter->GetPlotterType() == PLOT_FORMAT::GERBER
&& plotOpt.GetSubtractMaskFromSilk() ) && plotOpt.GetSubtractMaskFromSilk() )
{ {
if( aLayer == F_SilkS ) if( aLayer == F_SilkS )
layer_mask = LSET( F_Mask ); layer_mask = LSET( F_Mask );
@ -261,7 +261,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
plotOpt.SetSkipPlotNPTH_Pads( false ); plotOpt.SetSkipPlotNPTH_Pads( false );
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetDXFPlotPolygonMode() ) if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
// PlotLayerOutlines() is designed only for DXF plotters. // PlotLayerOutlines() is designed only for DXF plotters.
// and must not be used for other plot formats // and must not be used for other plot formats
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
@ -273,7 +273,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
plotOpt.SetSkipPlotNPTH_Pads( false ); plotOpt.SetSkipPlotNPTH_Pads( false );
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF && plotOpt.GetDXFPlotPolygonMode() ) if( plotOpt.GetFormat() == PLOT_FORMAT::DXF && plotOpt.GetDXFPlotPolygonMode() )
// PlotLayerOutlines() is designed only for DXF plotters. // PlotLayerOutlines() is designed only for DXF plotters.
// and must not be used for other plot formats // and must not be used for other plot formats
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
@ -526,7 +526,8 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
gbr_metadata.SetNetName( Via->GetNetname() ); gbr_metadata.SetNetName( Via->GetNetname() );
COLOR4D color = aBoard->Colors().GetItemColor( LAYER_VIAS + Via->GetViaType() ); COLOR4D color =
aBoard->Colors().GetItemColor( LAYER_VIAS + static_cast<int>( Via->GetViaType() ) );
// Set plot color (change WHITE to LIGHTGRAY because the white items are not seen on a // Set plot color (change WHITE to LIGHTGRAY because the white items are not seen on a
// white paper or screen // white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY); aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
@ -1039,7 +1040,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
switch( aPlotOpts->GetFormat() ) switch( aPlotOpts->GetFormat() )
{ {
case PLOT_FORMAT_DXF: case PLOT_FORMAT::DXF:
DXF_PLOTTER* DXF_plotter; DXF_PLOTTER* DXF_plotter;
DXF_plotter = new DXF_PLOTTER(); DXF_plotter = new DXF_PLOTTER();
DXF_plotter->SetUnits( DXF_plotter->SetUnits(
@ -1048,7 +1049,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter = DXF_plotter; plotter = DXF_plotter;
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT::POST:
PS_PLOTTER* PS_plotter; PS_PLOTTER* PS_plotter;
PS_plotter = new PS_PLOTTER(); PS_plotter = new PS_PLOTTER();
PS_plotter->SetScaleAdjust( aPlotOpts->GetFineScaleAdjustX(), PS_plotter->SetScaleAdjust( aPlotOpts->GetFineScaleAdjustX(),
@ -1056,11 +1057,11 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter = PS_plotter; plotter = PS_plotter;
break; break;
case PLOT_FORMAT_PDF: case PLOT_FORMAT::PDF:
plotter = new PDF_PLOTTER(); plotter = new PDF_PLOTTER();
break; break;
case PLOT_FORMAT_HPGL: case PLOT_FORMAT::HPGL:
HPGL_PLOTTER* HPGL_plotter; HPGL_PLOTTER* HPGL_plotter;
HPGL_plotter = new HPGL_PLOTTER(); HPGL_plotter = new HPGL_PLOTTER();
@ -1069,11 +1070,11 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter = HPGL_plotter; plotter = HPGL_plotter;
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT::GERBER:
plotter = new GERBER_PLOTTER(); plotter = new GERBER_PLOTTER();
break; break;
case PLOT_FORMAT_SVG: case PLOT_FORMAT::SVG:
plotter = new SVG_PLOTTER(); plotter = new SVG_PLOTTER();
break; break;
@ -1097,7 +1098,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter->ClearHeaderLinesList(); plotter->ClearHeaderLinesList();
// For the Gerber "file function" attribute, set the layer number // For the Gerber "file function" attribute, set the layer number
if( plotter->GetPlotterType() == PLOT_FORMAT_GERBER ) if( plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
{ {
bool useX2mode = plotOpts.GetUseGerberX2format(); bool useX2mode = plotOpts.GetUseGerberX2format();

View File

@ -76,8 +76,7 @@ public:
* @param aFormat is the plot file format identifier * @param aFormat is the plot file format identifier
* @param aSheetDesc * @param aSheetDesc
*/ */
bool OpenPlotfile( const wxString &aSuffix, PlotFormat aFormat, bool OpenPlotfile( const wxString& aSuffix, PLOT_FORMAT aFormat, const wxString& aSheetDesc );
const wxString &aSheetDesc );
/** Plot a single layer on the current plotfile /** Plot a single layer on the current plotfile
* m_plotLayer is the layer to plot * m_plotLayer is the layer to plot

View File

@ -37,16 +37,15 @@ class ITEM;
class SIZES_SETTINGS { class SIZES_SETTINGS {
public: public:
SIZES_SETTINGS() : SIZES_SETTINGS()
m_trackWidth( 155000 ), : m_trackWidth( 155000 ),
m_diffPairWidth( 125000 ), m_diffPairWidth( 125000 ),
m_diffPairGap( 180000 ), m_diffPairGap( 180000 ),
m_diffPairViaGap( 180000 ), m_diffPairViaGap( 180000 ),
m_viaDiameter( 600000 ), m_viaDiameter( 600000 ),
m_viaDrill( 250000 ), m_viaDrill( 250000 ),
m_diffPairViaGapSameAsTraceGap( true ), m_diffPairViaGapSameAsTraceGap( true ),
m_viaType( VIA_THROUGH ) m_viaType( VIATYPE::THROUGH ){};
{};
~SIZES_SETTINGS() {}; ~SIZES_SETTINGS() {};
@ -93,8 +92,15 @@ public:
int GetLayerTop() const; int GetLayerTop() const;
int GetLayerBottom() const; int GetLayerBottom() const;
void SetViaType( VIATYPE_T aViaType ) { m_viaType = aViaType; } void SetViaType( VIATYPE aViaType )
VIATYPE_T ViaType() const { return m_viaType; } {
m_viaType = aViaType;
}
VIATYPE ViaType() const
{
return m_viaType;
}
private: private:
@ -109,7 +115,7 @@ private:
bool m_diffPairViaGapSameAsTraceGap; bool m_diffPairViaGapSameAsTraceGap;
VIATYPE_T m_viaType; VIATYPE m_viaType;
std::map<int, int> m_layerPairs; std::map<int, int> m_layerPairs;
}; };

View File

@ -50,14 +50,14 @@ public:
VIA() : VIA() :
ITEM( VIA_T ) ITEM( VIA_T )
{ {
m_diameter = 2; // Dummy value m_diameter = 2; // Dummy value
m_drill = 0; m_drill = 0;
m_viaType = VIA_THROUGH; m_viaType = VIATYPE::THROUGH;
} }
VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aDiameter, int aDrill, int aNet = -1,
int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) : VIATYPE aViaType = VIATYPE::THROUGH )
ITEM( VIA_T ) : ITEM( VIA_T )
{ {
SetNet( aNet ); SetNet( aNet );
SetLayers( aLayers ); SetLayers( aLayers );
@ -68,7 +68,7 @@ public:
m_viaType = aViaType; m_viaType = aViaType;
//If we're a through-board via, use all layers regardless of the set passed //If we're a through-board via, use all layers regardless of the set passed
if( aViaType == VIA_THROUGH ) if( aViaType == VIATYPE::THROUGH )
{ {
LAYER_RANGE allLayers( 0, MAX_CU_LAYERS - 1 ); LAYER_RANGE allLayers( 0, MAX_CU_LAYERS - 1 );
SetLayers( allLayers ); SetLayers( allLayers );
@ -107,12 +107,12 @@ public:
m_shape.SetCenter( aPos ); m_shape.SetCenter( aPos );
} }
VIATYPE_T ViaType() const VIATYPE ViaType() const
{ {
return m_viaType; return m_viaType;
} }
void SetViaType( VIATYPE_T aViaType ) void SetViaType( VIATYPE aViaType )
{ {
m_viaType = aViaType; m_viaType = aViaType;
} }
@ -168,11 +168,11 @@ public:
const VIA_HANDLE MakeHandle() const; const VIA_HANDLE MakeHandle() const;
private: private:
int m_diameter; int m_diameter;
int m_drill; int m_drill;
VECTOR2I m_pos; VECTOR2I m_pos;
SHAPE_CIRCLE m_shape; SHAPE_CIRCLE m_shape;
VIATYPE_T m_viaType; VIATYPE m_viaType;
}; };
} }

View File

@ -501,16 +501,19 @@ void ROUTER_TOOL::switchLayerOnViaPlacement()
} }
static VIATYPE_T getViaTypeFromFlags( int aFlags ) static VIATYPE getViaTypeFromFlags( int aFlags )
{ {
switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK ) switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK )
{ {
case VIA_ACTION_FLAGS::VIA: return VIA_THROUGH; case VIA_ACTION_FLAGS::VIA:
case VIA_ACTION_FLAGS::BLIND_VIA: return VIA_BLIND_BURIED; return VIATYPE::THROUGH;
case VIA_ACTION_FLAGS::MICROVIA: return VIA_MICROVIA; case VIA_ACTION_FLAGS::BLIND_VIA:
return VIATYPE::BLIND_BURIED;
case VIA_ACTION_FLAGS::MICROVIA:
return VIATYPE::MICROVIA;
default: default:
wxASSERT_MSG( false, "Unhandled via type" ); wxASSERT_MSG( false, "Unhandled via type" );
return VIA_THROUGH; return VIATYPE::THROUGH;
} }
} }
@ -519,13 +522,13 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
{ {
const int actViaFlags = aEvent.Parameter<intptr_t>(); const int actViaFlags = aEvent.Parameter<intptr_t>();
VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags ); VIATYPE viaType = getViaTypeFromFlags( actViaFlags );
const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER; const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
BOARD_DESIGN_SETTINGS& bds = board()->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = board()->GetDesignSettings();
const int layerCount = bds.GetCopperLayerCount(); const int layerCount = bds.GetCopperLayerCount();
int currentLayer = m_router->GetCurrentLayer(); int currentLayer = m_router->GetCurrentLayer();
PCB_LAYER_ID pairTop = frame()->GetScreen()->m_Route_Layer_TOP; PCB_LAYER_ID pairTop = frame()->GetScreen()->m_Route_Layer_TOP;
PCB_LAYER_ID pairBottom = frame()->GetScreen()->m_Route_Layer_BOTTOM; PCB_LAYER_ID pairBottom = frame()->GetScreen()->m_Route_Layer_BOTTOM;
@ -538,8 +541,8 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
{ {
wxPoint dlgPosition = wxGetMousePosition(); wxPoint dlgPosition = wxGetMousePosition();
targetLayer = frame()->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ), targetLayer = frame()->SelectLayer(
LSET::AllNonCuMask(), dlgPosition ); static_cast<PCB_LAYER_ID>( currentLayer ), LSET::AllNonCuMask(), dlgPosition );
// Reset the cursor to the position where the event occured // Reset the cursor to the position where the event occured
controls()->SetCursorPosition( aEvent.HasPosition() ? aEvent.Position() : dlgPosition ); controls()->SetCursorPosition( aEvent.HasPosition() ? aEvent.Position() : dlgPosition );
@ -551,44 +554,48 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
if( !m_router->IsPlacingVia() ) if( !m_router->IsPlacingVia() )
{ {
// Cannot place microvias or blind vias if not allowed (obvious) // Cannot place microvias or blind vias if not allowed (obvious)
if( ( viaType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) ) if( ( viaType == VIATYPE::BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
{ {
DisplayError( frame(), _( "Blind/buried vias have to be enabled in Board Setup > Design Rules > Constraints." ) ); DisplayError( frame(),
_( "Blind/buried vias have to be enabled in Board Setup > Design Rules > Constraints." ) );
return false; return false;
} }
if( ( viaType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) ) if( ( viaType == VIATYPE::MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
{ {
DisplayError( frame(), _( "Microvias have to be enabled in Board Setup > Design Rules > Constraints." ) ); DisplayError( frame(),
_( "Microvias have to be enabled in Board Setup > Design Rules > Constraints." ) );
return false; return false;
} }
// Can only place through vias on 2-layer boards // Can only place through vias on 2-layer boards
if( ( viaType != VIA_THROUGH ) && ( layerCount <= 2 ) ) if( ( viaType != VIATYPE::THROUGH ) && ( layerCount <= 2 ) )
{ {
DisplayError( frame(), _( "Only through vias are allowed on 2 layer boards." ) ); DisplayError( frame(), _( "Only through vias are allowed on 2 layer boards." ) );
return false; return false;
} }
// Can only place microvias if we're on an outer layer, or directly adjacent to one // Can only place microvias if we're on an outer layer, or directly adjacent to one
if( ( viaType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount - 2 ) ) if( ( viaType == VIATYPE::MICROVIA ) && ( currentLayer > In1_Cu )
&& ( currentLayer < layerCount - 2 ) )
{ {
DisplayError( frame(), _( "Microvias can be placed only between the outer layers " \ DisplayError( frame(), _( "Microvias can be placed only between the outer layers "
"(F.Cu/B.Cu) and the ones directly adjacent to them." ) ); "(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
return false; return false;
} }
} }
// Convert blind/buried via to a through hole one, if it goes through all layers // Convert blind/buried via to a through hole one, if it goes through all layers
if( viaType == VIA_BLIND_BURIED && ( ( targetLayer == B_Cu && currentLayer == F_Cu ) if( viaType == VIATYPE::BLIND_BURIED
|| ( targetLayer == F_Cu && currentLayer == B_Cu ) ) ) && ( ( targetLayer == B_Cu && currentLayer == F_Cu )
|| ( targetLayer == F_Cu && currentLayer == B_Cu ) ) )
{ {
viaType = VIA_THROUGH; viaType = VIATYPE::THROUGH;
} }
switch( viaType ) switch( viaType )
{ {
case VIA_THROUGH: case VIATYPE::THROUGH:
sizes.SetViaDiameter( bds.GetCurrentViaSize() ); sizes.SetViaDiameter( bds.GetCurrentViaSize() );
sizes.SetViaDrill( bds.GetCurrentViaDrill() ); sizes.SetViaDrill( bds.GetCurrentViaDrill() );
@ -604,11 +611,12 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
} }
break; break;
case VIA_MICROVIA: case VIATYPE::MICROVIA:
sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() ); sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() ); sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
wxASSERT_MSG( !selectLayer, "Unexpected select layer for microvia (microvia layers are implicit)" ); wxASSERT_MSG( !selectLayer,
"Unexpected select layer for microvia (microvia layers are implicit)" );
if( currentLayer == F_Cu || currentLayer == In1_Cu ) if( currentLayer == F_Cu || currentLayer == In1_Cu )
{ {
@ -622,11 +630,12 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
} }
else else
{ {
wxASSERT_MSG( false, "Invalid layer pair for microvia (must be on or adjacent to an outer layer)" ); wxASSERT_MSG( false,
"Invalid layer pair for microvia (must be on or adjacent to an outer layer)" );
} }
break; break;
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
sizes.SetViaDiameter( bds.GetCurrentViaSize() ); sizes.SetViaDiameter( bds.GetCurrentViaSize() );
sizes.SetViaDrill( bds.GetCurrentViaDrill() ); sizes.SetViaDrill( bds.GetCurrentViaDrill() );

View File

@ -231,7 +231,7 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
via = new ::VIA( sessionBoard ); via = new ::VIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) ); via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrill( drill_diam_iu ); via->SetDrill( drill_diam_iu );
via->SetViaType( VIA_THROUGH ); via->SetViaType( VIATYPE::THROUGH );
via->SetWidth( viaDiam ); via->SetWidth( viaDiam );
via->SetLayerPair( F_Cu, B_Cu ); via->SetLayerPair( F_Cu, B_Cu );
} }
@ -249,7 +249,7 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
via = new ::VIA( sessionBoard ); via = new ::VIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) ); via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrill( drill_diam_iu ); via->SetDrill( drill_diam_iu );
via->SetViaType( VIA_THROUGH ); via->SetViaType( VIATYPE::THROUGH );
via->SetWidth( viaDiam ); via->SetWidth( viaDiam );
via->SetLayerPair( F_Cu, B_Cu ); via->SetLayerPair( F_Cu, B_Cu );
} }
@ -294,9 +294,9 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
if( (topLayerNdx==0 && botLayerNdx==1) if( (topLayerNdx==0 && botLayerNdx==1)
|| (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1)) || (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
via->SetViaType( VIA_MICROVIA ); via->SetViaType( VIATYPE::MICROVIA );
else else
via->SetViaType( VIA_BLIND_BURIED ); via->SetViaType( VIATYPE::BLIND_BURIED );
via->SetWidth( viaDiam ); via->SetWidth( viaDiam );

View File

@ -19,7 +19,7 @@
""" """
Add a BOARD_ITEM to this BOARD_ITEM_CONTAINER, clear the thisown to prevent Add a BOARD_ITEM to this BOARD_ITEM_CONTAINER, clear the thisown to prevent
python from deleting the object in the garbage collector python from deleting the object in the garbage collector
Add(BOARD_ITEM_CONTAINER self, BOARD_ITEM aItem, ADD_MODE aMode=ADD_INSERT) Add(BOARD_ITEM_CONTAINER self, BOARD_ITEM aItem, BOARD_ADD_MODE aMode=BOARD_ADD_MODE::INSERT)
Add(BOARD_ITEM_CONTAINER self, BOARD_ITEM aItem) Add(BOARD_ITEM_CONTAINER self, BOARD_ITEM aItem)
""" """
item.thisown=0 item.thisown=0

View File

@ -123,7 +123,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
change = true; change = true;
} }
int via_type = GetDesignSettings().m_CurrentViaType; int via_type = static_cast<int>( GetDesignSettings().m_CurrentViaType );
via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type ); via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type );
if( m_prevIconVal.previous_via_color != via_color ) if( m_prevIconVal.previous_via_color != via_color )

View File

@ -1838,11 +1838,11 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
// Adjust the actual via layer pair // Adjust the actual via layer pair
switch( via->GetViaType() ) switch( via->GetViaType() )
{ {
case VIA_BLIND_BURIED: case VIATYPE::BLIND_BURIED:
via->SetLayerPair( first_layer, last_layer ); via->SetLayerPair( first_layer, last_layer );
break; break;
case VIA_MICROVIA: // from external to the near neighbor inner layer case VIATYPE::MICROVIA: // from external to the near neighbor inner layer
{ {
PCB_LAYER_ID last_inner_layer = PCB_LAYER_ID last_inner_layer =
ToLAYER_ID( ( m_board->GetCopperLayerCount() - 2 ) ); ToLAYER_ID( ( m_board->GetCopperLayerCount() - 2 ) );

View File

@ -722,7 +722,7 @@ void DRC::testDrilledHoles()
for( TRACK* track : m_pcb->Tracks() ) for( TRACK* track : m_pcb->Tracks() )
{ {
VIA* via = dynamic_cast<VIA*>( track ); VIA* via = dynamic_cast<VIA*>( track );
if( via && via->GetViaType() == VIA_THROUGH ) if( via && via->GetViaType() == VIATYPE::THROUGH )
{ {
hole.m_location = via->GetPosition(); hole.m_location = via->GetPosition();
hole.m_drillRadius = via->GetDrillValue() / 2; hole.m_drillRadius = via->GetDrillValue() / 2;

View File

@ -170,7 +170,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
wxPoint refviaPos = refvia->GetPosition(); wxPoint refviaPos = refvia->GetPosition();
// test if the via size is smaller than minimum // test if the via size is smaller than minimum
if( refvia->GetViaType() == VIA_MICROVIA ) if( refvia->GetViaType() == VIATYPE::MICROVIA )
{ {
if( refvia->GetWidth() < dsnSettings.m_MicroViasMinSize ) if( refvia->GetWidth() < dsnSettings.m_MicroViasMinSize )
{ {
@ -219,7 +219,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
} }
// test if the type of via is allowed due to design rules // test if the type of via is allowed due to design rules
if( refvia->GetViaType() == VIA_MICROVIA && !dsnSettings.m_MicroViasAllowed ) if( refvia->GetViaType() == VIATYPE::MICROVIA && !dsnSettings.m_MicroViasAllowed )
{ {
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_MICRO_VIA_NOT_ALLOWED ); markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_MICRO_VIA_NOT_ALLOWED );
@ -228,7 +228,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
} }
// test if the type of via is allowed due to design rules // test if the type of via is allowed due to design rules
if( refvia->GetViaType() == VIA_BLIND_BURIED && !dsnSettings.m_BlindBuriedViaAllowed ) if( refvia->GetViaType() == VIATYPE::BLIND_BURIED && !dsnSettings.m_BlindBuriedViaAllowed )
{ {
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_BURIED_VIA_NOT_ALLOWED ); markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_BURIED_VIA_NOT_ALLOWED );
@ -239,7 +239,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// For microvias: test if they are blind vias and only between 2 layers // For microvias: test if they are blind vias and only between 2 layers
// because they are used for very small drill size and are drill by laser // because they are used for very small drill size and are drill by laser
// and **only one layer** can be drilled // and **only one layer** can be drilled
if( refvia->GetViaType() == VIA_MICROVIA ) if( refvia->GetViaType() == VIATYPE::MICROVIA )
{ {
PCB_LAYER_ID layer1, layer2; PCB_LAYER_ID layer1, layer2;
bool err = true; bool err = true;
@ -704,15 +704,15 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
DRAWSEGMENT* test_edge = dynamic_cast<DRAWSEGMENT*>( item ); DRAWSEGMENT* test_edge = dynamic_cast<DRAWSEGMENT*>( item );
if( !test_edge || test_edge->GetLayer() != Edge_Cuts ) if( !test_edge || test_edge->GetLayer() != Edge_Cuts )
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
if( test_edge->HitTest((wxPoint) pt, w_dist ) ) if( test_edge->HitTest((wxPoint) pt, w_dist ) )
{ {
edge = test_edge; edge = test_edge;
return SEARCH_QUIT; return SEARCH_RESULT::QUIT;
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
// Best-efforts search for edge segment // Best-efforts search for edge segment

View File

@ -528,7 +528,7 @@ int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent )
int new_width; int new_width;
int new_drill; int new_drill;
if( via->GetViaType() == VIA_MICROVIA ) if( via->GetViaType() == VIATYPE::MICROVIA )
{ {
auto net = via->GetNet(); auto net = via->GetNet();

View File

@ -137,7 +137,7 @@ int GLOBAL_EDIT_TOOL::SwapLayers( const TOOL_EVENT& aEvent )
VIA* via = (VIA*) segm; VIA* via = (VIA*) segm;
PCB_LAYER_ID top_layer, bottom_layer; PCB_LAYER_ID top_layer, bottom_layer;
if( via->GetViaType() == VIA_THROUGH ) if( via->GetViaType() == VIATYPE::THROUGH )
continue; continue;
via->LayerPair( &top_layer, &bottom_layer ); via->LayerPair( &top_layer, &bottom_layer );

View File

@ -1314,12 +1314,12 @@ void SELECTION_TOOL::RebuildSelection()
// Flags on module children might be set only because the parent is selected. // Flags on module children might be set only because the parent is selected.
if( parent && parent->Type() == PCB_MODULE_T && parent->IsSelected() ) if( parent && parent->Type() == PCB_MODULE_T && parent->IsSelected() )
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
highlight( (BOARD_ITEM*) item, SELECTED, &m_selection ); highlight( (BOARD_ITEM*) item, SELECTED, &m_selection );
} }
return SEARCH_CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
board()->Visit( inspector, nullptr, m_editModules ? GENERAL_COLLECTOR::ModuleItems board()->Visit( inspector, nullptr, m_editModules ? GENERAL_COLLECTOR::ModuleItems
@ -1533,24 +1533,24 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
// Check if appropriate element layer is visible // Check if appropriate element layer is visible
switch( via->GetViaType() ) switch( via->GetViaType() )
{ {
case VIA_THROUGH: case VIATYPE::THROUGH:
if( !board()->IsElementVisible( LAYER_VIA_THROUGH ) ) if( !board()->IsElementVisible( LAYER_VIA_THROUGH ) )
return false;
break;
case VIA_BLIND_BURIED:
if( !board()->IsElementVisible( LAYER_VIA_BBLIND ) )
return false;
break;
case VIA_MICROVIA:
if( !board()->IsElementVisible( LAYER_VIA_MICROVIA ) )
return false;
break;
default:
wxFAIL;
return false; return false;
break;
case VIATYPE::BLIND_BURIED:
if( !board()->IsElementVisible( LAYER_VIA_BBLIND ) )
return false;
break;
case VIATYPE::MICROVIA:
if( !board()->IsElementVisible( LAYER_VIA_MICROVIA ) )
return false;
break;
default:
wxFAIL;
return false;
} }
// For vias it is enough if only one of its layers is visible // For vias it is enough if only one of its layers is visible

View File

@ -346,14 +346,14 @@ bool ZONE_FILLER::Fill( const std::vector<ZONE_CONTAINER*>& aZones, bool aCheck
bool hasThermalConnection( D_PAD* pad, const ZONE_CONTAINER* aZone ) bool hasThermalConnection( D_PAD* pad, const ZONE_CONTAINER* aZone )
{ {
// Rejects non-standard pads with tht-only thermal reliefs // Rejects non-standard pads with tht-only thermal reliefs
if( aZone->GetPadConnection( pad ) == PAD_ZONE_CONN_THT_THERMAL if( aZone->GetPadConnection( pad ) == ZONE_CONNECTION::THT_THERMAL
&& pad->GetAttribute() != PAD_ATTRIB_STANDARD ) && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
{ {
return false; return false;
} }
if( aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THERMAL if( aZone->GetPadConnection( pad ) != ZONE_CONNECTION::THERMAL
&& aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THT_THERMAL ) && aZone->GetPadConnection( pad ) != ZONE_CONNECTION::THT_THERMAL )
{ {
return false; return false;
} }
@ -550,9 +550,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, SHAPE_
pad = &dummypad; pad = &dummypad;
} }
if( pad->GetNetCode() != aZone->GetNetCode() if( pad->GetNetCode() != aZone->GetNetCode() || pad->GetNetCode() <= 0
|| pad->GetNetCode() <= 0 || aZone->GetPadConnection( pad ) == ZONE_CONNECTION::NONE )
|| aZone->GetPadConnection( pad ) == PAD_ZONE_CONN_NONE )
{ {
int gap = std::max( zone_clearance, pad->GetClearance() ); int gap = std::max( zone_clearance, pad->GetClearance() );
EDA_RECT item_boundingbox = pad->GetBoundingBox(); EDA_RECT item_boundingbox = pad->GetBoundingBox();

View File

@ -66,7 +66,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
// thickness of the copper bridge in thermal reliefs: // thickness of the copper bridge in thermal reliefs:
m_ThermalReliefCopperBridge = Mils2iu( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL ); m_ThermalReliefCopperBridge = Mils2iu( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL );
m_PadConnection = PAD_ZONE_CONN_THERMAL; // How pads are covered by copper in zone m_PadConnection = ZONE_CONNECTION::THERMAL; // How pads are covered by copper in zone
m_Zone_45_Only = false; m_Zone_45_Only = false;

View File

@ -97,7 +97,7 @@ public:
private: private:
int m_cornerSmoothingType; ///< Corner smoothing type int m_cornerSmoothingType; ///< Corner smoothing type
unsigned int m_cornerRadius; ///< Corner chamfer distance / fillet radius unsigned int m_cornerRadius; ///< Corner chamfer distance / fillet radius
ZoneConnection m_PadConnection; ZONE_CONNECTION m_PadConnection;
/* A zone outline can be a keepout zone. /* A zone outline can be a keepout zone.
* It will be never filled, and DRC should test for pads, tracks and vias * It will be never filled, and DRC should test for pads, tracks and vias
@ -152,8 +152,15 @@ public:
unsigned int GetCornerRadius() const { return m_cornerRadius; } unsigned int GetCornerRadius() const { return m_cornerRadius; }
ZoneConnection GetPadConnection() const { return m_PadConnection; } ZONE_CONNECTION GetPadConnection() const
void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; } {
return m_PadConnection;
}
void SetPadConnection( ZONE_CONNECTION aPadConnection )
{
m_PadConnection = aPadConnection;
}
/** /**
* Accessors to parameters used in Keepout zones: * Accessors to parameters used in Keepout zones:

View File

@ -47,12 +47,13 @@
// ZONE_EXPORT_VALUES // ZONE_EXPORT_VALUES
/// How pads are covered by copper in zone /// How pads are covered by copper in zone
enum ZoneConnection { enum class ZONE_CONNECTION
PAD_ZONE_CONN_INHERITED = -1, {
PAD_ZONE_CONN_NONE, ///< Pads are not covered INHERITED = -1,
PAD_ZONE_CONN_THERMAL, ///< Use thermal relief for pads NONE, ///< Pads are not covered
PAD_ZONE_CONN_FULL, ///< pads are covered by copper THERMAL, ///< Use thermal relief for pads
PAD_ZONE_CONN_THT_THERMAL ///< Thermal relief only for THT pads FULL, ///< pads are covered by copper
THT_THERMAL ///< Thermal relief only for THT pads
}; };
class ZONE_CONTAINER; class ZONE_CONTAINER;