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

View File

@ -1000,7 +1000,8 @@ void C3D_RENDER_RAYTRACING::insert3DViaHole( const VIA* aVia )
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
objPtr->SetColor( ConvertSRGBToLinear( (SFVEC3F)m_settings.m_CopperColor ) );
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 );
}

View File

@ -136,11 +136,11 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_
if( IsType( scanTypes ) )
{
if( SEARCH_QUIT == inspector( this, testData ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
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 )
{
case PLOTDASHTYPE_SOLID: return "CONTINUOUS";
case PLOTDASHTYPE_DASH: return "DASHED";
case PLOTDASHTYPE_DOT: return "DOTTED";
case PLOTDASHTYPE_DASHDOT: return "DASHDOT";
case PLOT_DASH_TYPE::DEFAULT:
case PLOT_DASH_TYPE::SOLID:
return "CONTINUOUS";
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' )
{
wxASSERT( m_currentLineType >= 0 && m_currentLineType < 4 );
wxASSERT( m_currentLineType >= PLOT_DASH_TYPE::FIRST_TYPE
&& m_currentLineType <= PLOT_DASH_TYPE::LAST_TYPE );
// DXF LINE
wxString cname = getDXFColorName( m_currentColor );
const char *lname = getDXFLineType( (PlotDashType) m_currentLineType );
wxString cname = getDXFColorName( m_currentColor );
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",
TO_UTF8( cname ), lname,
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 );
m_currentLineType = dashed;
wxASSERT( aDashed >= PLOT_DASH_TYPE::FIRST_TYPE && aDashed <= PLOT_DASH_TYPE::LAST_TYPE );
m_currentLineType = aDashed;
}

View File

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

View File

@ -131,20 +131,20 @@ void PDF_PLOTTER::emitSetRGBColor( double r, double g, double b )
/**
* PDF supports dashed lines
*/
void PDF_PLOTTER::SetDash( int dashed )
void PDF_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
{
wxASSERT( workFile );
switch( dashed )
{
case PLOTDASHTYPE_DASH:
case PLOT_DASH_TYPE::DASH:
fprintf( workFile, "[%d %d] 0 d\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
break;
case PLOTDASHTYPE_DOT:
case PLOT_DASH_TYPE::DOT:
fprintf( workFile, "[%d %d] 0 d\n",
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
break;
case PLOTDASHTYPE_DASHDOT:
case PLOT_DASH_TYPE::DASHDOT:
fprintf( workFile, "[%d %d %d %d] 0 d\n",
(int) GetDashMarkLenIU(), (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
*/
void PS_PLOTTER::SetDash( int dashed )
void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
{
switch( dashed )
{
case PLOTDASHTYPE_DASH:
case PLOT_DASH_TYPE::DASH:
fprintf( outputFile, "[%d %d] 0 setdash\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
break;
case PLOTDASHTYPE_DOT:
case PLOT_DASH_TYPE::DOT:
fprintf( outputFile, "[%d %d] 0 setdash\n",
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
break;
case PLOTDASHTYPE_DASHDOT:
case PLOT_DASH_TYPE::DASHDOT:
fprintf( outputFile, "[%d %d %d %d] 0 setdash\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
@ -999,7 +999,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
// Draw the native postscript text (if requested)
// 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 )
{
@ -1046,7 +1046,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
}
// Draw the hidden postscript text (if requested)
if( m_textMode == PLOTTEXTMODE_PHANTOM )
if( m_textMode == PLOT_TEXT_MODE::PHANTOM )
{
fputsPostscriptString( outputFile, aText );
DPOINT pos_dev = userToDeviceCoordinates( aPos );

View File

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

View File

@ -34,23 +34,29 @@
#include <wx/filename.h>
wxString GetDefaultPlotExtension( PlotFormat aFormat )
wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat )
{
switch( aFormat )
{
case PLOT_FORMAT_DXF: return DXF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_POST: return PS_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_PDF: return PDF_PLOTTER::GetDefaultFileExtension();
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;
case PLOT_FORMAT::DXF:
return DXF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::POST:
return PS_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::PDF:
return PDF_PLOTTER::GetDefaultFileExtension();
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,
const PAGE_INFO& aPageInfo, int aSheetNumber, int aNumberOfSheets,
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( aInspector( &item, aTestData ) == SEARCH_QUIT )
return SEARCH_QUIT;
if( aInspector( &item, aTestData ) == SEARCH_RESULT::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() );
setColor( m_line->GetLineColor() );
m_lineStyle->SetSelection( m_line->GetLineStyle() );
m_lineStyle->SetSelection( static_cast<int>( m_line->GetLineStyle() ) );
return true;
}
@ -103,7 +103,7 @@ void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event )
{
m_width.SetValue( m_line->GetDefaultWidth() );
setColor( m_line->GetDefaultColor() );
m_lineStyle->SetSelection( m_line->GetDefaultStyle() );
m_lineStyle->SetSelection( static_cast<int>( m_line->GetDefaultStyle() ) );
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_BASE( parent ),
m_parent( parent ),
m_plotFormat( PLOT_FORMAT_UNDEFINED ),
m_defaultLineWidth( parent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
m_penWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true )
DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent )
: DIALOG_PLOT_SCHEMATIC_BASE( parent ),
m_parent( parent ),
m_plotFormat( PLOT_FORMAT::UNDEFINED ),
m_defaultLineWidth( parent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
m_penWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true )
{
m_config = Kiface().KifaceSettings();
m_configChanged = false;
@ -112,17 +112,27 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
m_HPGLPenSize *= IU_PER_MM;
// Switch to the last save plot format
long plotfmt;
int plotfmt;
m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
switch( plotfmt )
switch( static_cast<PLOT_FORMAT>( plotfmt ) )
{
default:
case PLOT_FORMAT_POST: m_plotFormatOpt->SetSelection( 0 ); break;
case PLOT_FORMAT_PDF: 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;
case PLOT_FORMAT::POST:
m_plotFormatOpt->SetSelection( 0 );
break;
case PLOT_FORMAT::PDF:
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
@ -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() )
{
default:
case 0: return PLOT_FORMAT_POST;
case 1: return PLOT_FORMAT_PDF;
case 2: return PLOT_FORMAT_SVG;
case 3: return PLOT_FORMAT_DXF;
case 4: return PLOT_FORMAT_HPGL;
default:
case 0:
return PLOT_FORMAT::POST;
case 1:
return PLOT_FORMAT::PDF;
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 )
{
if( GetPlotFileFormat() == PLOT_FORMAT_HPGL )
if( GetPlotFileFormat() == PLOT_FORMAT::HPGL )
m_HPGLPaperSizeSelect = m_paperSizeOption->GetSelection();
else
m_pageSizeSelect = m_paperSizeOption->GetSelection();
@ -204,7 +219,7 @@ void DIALOG_PLOT_SCHEMATIC::OnPageSizeSelected( wxCommandEvent& event )
void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
{
PlotFormat fmt = GetPlotFileFormat();
PLOT_FORMAT fmt = GetPlotFileFormat();
if( fmt != m_plotFormat )
{
@ -215,7 +230,7 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
int selection;
if( fmt == PLOT_FORMAT_HPGL )
if( fmt == PLOT_FORMAT::HPGL )
{
paperSizes.push_back( _( "A4" ) );
paperSizes.push_back( _( "A3" ) );
@ -241,12 +256,12 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
m_paperSizeOption->Set( paperSizes );
m_paperSizeOption->SetSelection( selection );
m_defaultLineWidth.Enable( fmt == PLOT_FORMAT_POST || fmt == PLOT_FORMAT_PDF
|| fmt == PLOT_FORMAT_SVG );
m_defaultLineWidth.Enable(
fmt == PLOT_FORMAT::POST || fmt == PLOT_FORMAT::PDF || fmt == PLOT_FORMAT::SVG );
m_plotOriginTitle->Enable( fmt == PLOT_FORMAT_HPGL );
m_plotOriginOpt->Enable( fmt == PLOT_FORMAT_HPGL );
m_penWidth.Enable( fmt == PLOT_FORMAT_HPGL );
m_plotOriginTitle->Enable( fmt == PLOT_FORMAT::HPGL );
m_plotOriginOpt->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() )
{
default:
case PLOT_FORMAT_POST: createPSFile( aPlotAll, getPlotFrameRef() ); break;
case PLOT_FORMAT_DXF: 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;
case PLOT_FORMAT::POST:
createPSFile( aPlotAll, getPlotFrameRef() );
break;
case PLOT_FORMAT::DXF:
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:
SCH_EDIT_FRAME* m_parent;
wxConfigBase* m_config;
bool m_configChanged; // true if a project config param has changed
PlotFormat m_plotFormat;
bool m_configChanged; // true if a project config param has changed
PLOT_FORMAT m_plotFormat;
static int m_pageSizeSelect; // Static to keep last option for some format
static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
double m_HPGLPenSize; // for HPGL format only: pen size
@ -86,7 +86,7 @@ private:
*/
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
PlotFormat GetPlotFileFormat();
PLOT_FORMAT GetPlotFileFormat();
bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); }
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 );
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 )
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
}
if( aItem->HitTest( m_RefPos, m_Threshold ) )
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.
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( stype == SCH_LOCATE_ANY_T || stype == Type() )
{
if( SEARCH_QUIT == aInspector( this, aTestData ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( this, aTestData ) )
return SEARCH_RESULT::QUIT;
}
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.
for( int ii = 0; ii < GetFieldCount(); ii++ )
{
if( SEARCH_QUIT == aInspector( GetField( ii ), (void*) this ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( GetField( ii ), (void*) this ) )
return SEARCH_RESULT::QUIT;
}
}
if( stype == SCH_FIELD_LOCATE_REFERENCE_T )
{
if( SEARCH_QUIT == aInspector( GetField( REFERENCE ), (void*) this ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( GetField( REFERENCE ), (void*) this ) )
return SEARCH_RESULT::QUIT;
}
if( stype == SCH_FIELD_LOCATE_VALUE_T )
{
if( SEARCH_QUIT == aInspector( GetField( VALUE ), (void*) this ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( GetField( VALUE ), (void*) this ) )
return SEARCH_RESULT::QUIT;
}
if( stype == SCH_FIELD_LOCATE_FOOTPRINT_T )
{
if( SEARCH_QUIT == aInspector( GetField( FOOTPRINT ), (void*) this ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( GetField( FOOTPRINT ), (void*) this ) )
return SEARCH_RESULT::QUIT;
}
if( stype == SCH_FIELD_LOCATE_DATASHEET_T )
{
if( SEARCH_QUIT == aInspector( GetField( DATASHEET ), (void*) this ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( GetField( DATASHEET ), (void*) this ) )
return SEARCH_RESULT::QUIT;
}
if( stype == SCH_LOCATE_ANY_T || stype == SCH_PIN_T )
{
for( SCH_PIN& pin : m_pins )
{
if( SEARCH_QUIT == aInspector( &pin, (void*) this ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( &pin, (void*) this ) )
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 )
{
parseUnquotedString( buf, aReader, line, &line );
int style = SCH_LINE::GetLineStyleInternalId( buf );
PLOT_DASH_TYPE style = SCH_LINE::GetLineStyleByName( buf );
wire->SetLineStyle( style );
}
else // should be the color parameter.

View File

@ -41,30 +41,35 @@
#include <sch_view.h>
static wxPenStyle getwxPenStyle( PlotDashType aType )
static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType )
{
switch( aType )
{
case PLOTDASHTYPE_SOLID: return wxPENSTYLE_SOLID;
case PLOTDASHTYPE_DASH: return wxPENSTYLE_SHORT_DASH;
case PLOTDASHTYPE_DOT: return wxPENSTYLE_DOT;
case PLOTDASHTYPE_DASHDOT: return wxPENSTYLE_DOT_DASH;
case PLOT_DASH_TYPE::DEFAULT:
case PLOT_DASH_TYPE::SOLID:
return wxPENSTYLE_SOLID;
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_ITEM( NULL, SCH_LINE_T )
{
m_start = pos;
m_end = pos;
m_start = pos;
m_end = pos;
m_startIsDangling = m_endIsDangling = false;
m_size = 0;
m_style = -1;
m_color = COLOR4D::UNSPECIFIED;
m_size = 0;
m_style = PLOT_DASH_TYPE::DEFAULT;
m_color = COLOR4D::UNSPECIFIED;
switch( layer )
{
@ -101,51 +106,38 @@ EDA_ITEM* SCH_LINE::Clone() const
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 )
{
case PLOTDASHTYPE_SOLID:
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;
//legacy behavior is to default to dash if there is no name
return resultIt == lineStyleNames.end() ? lineStyleNames.find( PLOT_DASH_TYPE::DASH )->second :
resultIt->second;
}
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++ )
{
if( aStyleName == style_names[ii] )
{
id = ii;
break;
}
}
//find the name by value
auto resultIt = std::find_if( lineStyleNames.begin(), lineStyleNames.end(),
[aStyleName]( const auto& it ) { return it.second == aStyleName; } );
if( resultIt != lineStyleNames.end() )
id = resultIt->first;
return id;
}
@ -268,27 +260,33 @@ COLOR4D SCH_LINE::GetLineColor() const
return m_color;
}
int SCH_LINE::GetDefaultStyle() const
PLOT_DASH_TYPE SCH_LINE::GetDefaultStyle() const
{
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() )
m_style = -1;
m_style = PLOT_DASH_TYPE::DEFAULT;
else
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 GetDefaultStyle();
@ -332,7 +330,7 @@ void SCH_LINE::Print( wxDC* DC, const wxPoint& offset )
wxPoint end = m_end;
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->FinishTo( m_end );
aPlotter->SetDash( 0 );
aPlotter->SetDash( PLOT_DASH_TYPE::SOLID );
}

View File

@ -25,6 +25,7 @@
#ifndef _SCH_LINE_H_
#define _SCH_LINE_H_
#include <plotter.h>
#include <sch_item.h>
class NETLIST_OBJECT_LIST;
@ -41,7 +42,7 @@ class SCH_LINE : public SCH_ITEM
wxPoint m_start; ///< Line start point
wxPoint m_end; ///< Line end point
int m_size; ///< Line pensize
int m_style; ///< Line style
PLOT_DASH_TYPE m_style; ///< Line style
COLOR4D m_color; ///< Line color
public:
@ -102,18 +103,19 @@ public:
wxPoint GetEndPoint() const { return m_end; }
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
int GetDefaultStyle() const;
PLOT_DASH_TYPE GetDefaultStyle() const;
void SetLineStyle( const int aStyle );
int GetLineStyle() const;
void SetLineStyle( const PLOT_DASH_TYPE aStyle );
void SetLineStyle( const int aStyleId );
PLOT_DASH_TYPE GetLineStyle() const;
/// @return the style name from the style id
/// (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
/// (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 );

View File

@ -1118,7 +1118,7 @@ void SCH_PAINTER::draw( SCH_LINE *aLine, int aLayer )
m_gal->SetStrokeColor( color );
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() );
}
@ -1136,13 +1136,13 @@ void SCH_PAINTER::draw( SCH_LINE *aLine, int aLayer )
switch( aLine->GetLineStyle() )
{
default:
case PLOTDASHTYPE_DASH:
case PLOT_DASH_TYPE::DASH:
strokes[0] = strokes[2] = DASH_MARK_LEN( width );
break;
case PLOTDASHTYPE_DOT:
case PLOT_DASH_TYPE::DOT:
strokes[0] = strokes[2] = DOT_MARK_LEN( width );
break;
case PLOTDASHTYPE_DASHDOT:
case PLOT_DASH_TYPE::DASHDOT:
strokes[0] = DASH_MARK_LEN( width );
strokes[2] = DOT_MARK_LEN( width );
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( stype == SCH_LOCATE_ANY_T || stype == Type() )
{
if( SEARCH_QUIT == aInspector( this, NULL ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( this, NULL ) )
return SEARCH_RESULT::QUIT;
}
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.
for( size_t i = 0; i < m_pins.size(); i++ )
{
if( SEARCH_QUIT == aInspector( &m_pins[ i ], this ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == aInspector( &m_pins[i], this ) )
return SEARCH_RESULT::QUIT;
}
}
}
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
}

View File

@ -987,7 +987,7 @@ void EE_SELECTION_TOOL::RebuildSelection()
select( item );
}
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
};
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() )
m_selectionTool->UnbrightenItem( item );
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
};
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 )
after = nullptr;
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
}
if( ( data == &g_markersOnly && item->Type() == SCH_MARKER_T )
|| item->Matches( *data, nullptr ) )
{
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 );

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

View File

@ -42,7 +42,7 @@ SEARCH_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
if( testItem->HitTest( m_RefPos ) )
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( stype == Type() )
{
if( SEARCH_QUIT == inspector( this, testData ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
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[] )
{
KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE;
SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
const KICAD_T* p = scanTypes;
bool done = false;
@ -422,7 +422,7 @@ SEARCH_RESULT GERBER_FILE_IMAGE::Visit( INSPECTOR inspector, void* testData, con
break;
}
if( result == SEARCH_QUIT )
if( result == SEARCH_RESULT::QUIT )
break;
}

View File

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

View File

@ -185,7 +185,7 @@ public:
bool m_MicroViasAllowed; ///< true to allow micro 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_ProhibitOverlappingCourtyards; ///< check for overlapping courtyards in DRC

View File

@ -83,7 +83,10 @@ public:
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 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
* of the radio buttons in the plot panel/windows.
*/
enum PlotFormat {
PLOT_FORMAT_UNDEFINED = -1,
PLOT_FIRST_FORMAT = 0,
PLOT_FORMAT_HPGL = PLOT_FIRST_FORMAT,
PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST,
PLOT_FORMAT_DXF,
PLOT_FORMAT_PDF,
PLOT_FORMAT_SVG,
PLOT_LAST_FORMAT = PLOT_FORMAT_SVG
enum class PLOT_FORMAT
{
UNDEFINED = -1,
FIRST_FORMAT = 0,
HPGL = FIRST_FORMAT,
GERBER,
POST,
DXF,
PDF,
SVG,
LAST_FORMAT = SVG
};
/**
@ -71,21 +72,26 @@ enum PlotFormat {
* This is recognized by the DXF driver too, where NATIVE emits
* TEXT entities instead of stroking the text
*/
enum PlotTextMode {
PLOTTEXTMODE_STROKE,
PLOTTEXTMODE_NATIVE,
PLOTTEXTMODE_PHANTOM,
PLOTTEXTMODE_DEFAULT
enum class PLOT_TEXT_MODE
{
STROKE,
NATIVE,
PHANTOM,
DEFAULT
};
/**
* Enum for choosing dashed line type
*/
enum PlotDashType {
PLOTDASHTYPE_SOLID,
PLOTDASHTYPE_DASH,
PLOTDASHTYPE_DOT,
PLOTDASHTYPE_DASHDOT,
enum class PLOT_DASH_TYPE
{
DEFAULT = -1,
SOLID = 0,
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
* (like drill marks, emitted only for postscript
*/
virtual PlotFormat GetPlotterType() const = 0;
virtual PLOT_FORMAT GetPlotterType() const = 0;
virtual bool StartPlot() = 0;
virtual bool EndPlot() = 0;
@ -156,7 +162,7 @@ public:
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 )
{
@ -449,7 +455,7 @@ public:
* Change the current text mode. See the PlotTextMode
* explanation at the beginning of the file
*/
virtual void SetTextMode( PlotTextMode mode )
virtual void SetTextMode( PLOT_TEXT_MODE mode )
{
// NOP for most plotters.
}
@ -602,9 +608,9 @@ class HPGL_PLOTTER : public PLOTTER
public:
HPGL_PLOTTER();
virtual PlotFormat GetPlotterType() const override
virtual PLOT_FORMAT GetPlotterType() const override
{
return PLOT_FORMAT_HPGL;
return PLOT_FORMAT::HPGL;
}
static wxString GetDefaultFileExtension()
@ -623,7 +629,7 @@ public:
}
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 {}
@ -688,17 +694,16 @@ protected:
class PSLIKE_PLOTTER : public PLOTTER
{
public:
PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ),
m_textMode( PLOTTEXTMODE_PHANTOM )
PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ), m_textMode( PLOT_TEXT_MODE::PHANTOM )
{
}
/**
* 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;
}
@ -775,7 +780,7 @@ protected:
double plotScaleAdjX, plotScaleAdjY;
/// 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
// crashes Adobe's own postscript interpreter!
m_textMode = PLOTTEXTMODE_STROKE;
m_textMode = PLOT_TEXT_MODE::STROKE;
}
static wxString GetDefaultFileExtension()
@ -794,15 +799,15 @@ public:
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 EndPlot() 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,
double aScale, bool aMirror ) override;
@ -847,9 +852,9 @@ public:
pageTreeHandle = 0;
}
virtual PlotFormat GetPlotterType() const override
virtual PLOT_FORMAT GetPlotterType() const override
{
return PLOT_FORMAT_PDF;
return PLOT_FORMAT::PDF;
}
static wxString GetDefaultFileExtension()
@ -872,7 +877,7 @@ public:
virtual void StartPage();
virtual void ClosePage();
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
* with the outputFile open (but not inside a page stream!) */
@ -936,16 +941,16 @@ public:
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 bool StartPlot() override;
virtual bool EndPlot() 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,
double aScale, bool aMirror ) override;
@ -1010,10 +1015,7 @@ protected:
bool m_graphics_changed; // true if a pen/brush parameter is modified
// color, pen size, fil mode ...
// the new SVG stype must be output on file
int m_dashed; // 0 = plot solid line style
// 1 = plot dashed line style
// 2 = plot dotted line style
// 3 = plot dash-dot line style
PLOT_DASH_TYPE m_dashed; // plot line style
/**
* function emitSetRGBColor()
@ -1141,9 +1143,9 @@ class GERBER_PLOTTER : public PLOTTER
public:
GERBER_PLOTTER();
virtual PlotFormat GetPlotterType() const override
virtual PLOT_FORMAT GetPlotterType() const override
{
return PLOT_FORMAT_GERBER;
return PLOT_FORMAT::GERBER;
}
static wxString GetDefaultFileExtension()
@ -1162,7 +1164,10 @@ public:
virtual void SetDefaultLineWidth( int width ) override;
// 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 {}
// Currently, aScale and aMirror are not used in gerber plotter
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
@ -1389,13 +1394,13 @@ public:
{
textAsLines = true;
m_currentColor = COLOR4D::BLACK;
m_currentLineType = 0;
m_currentLineType = PLOT_DASH_TYPE::SOLID;
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()
@ -1406,10 +1411,10 @@ public:
/**
* 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 )
textAsLines = ( mode != PLOTTEXTMODE_NATIVE );
if( mode != PLOT_TEXT_MODE::DEFAULT )
textAsLines = ( mode != PLOT_TEXT_MODE::NATIVE );
}
virtual bool StartPlot() override;
@ -1427,7 +1432,7 @@ public:
defaultPenWidth = 0;
}
virtual void SetDash( int dashed ) override;
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetColor( COLOR4D color ) override;
@ -1524,7 +1529,7 @@ public:
protected:
bool textAsLines;
COLOR4D m_currentColor;
int m_currentLineType;
PLOT_DASH_TYPE m_currentLineType;
DXF_UNITS m_plotUnits;
double m_unitScalingFactor;
@ -1541,7 +1546,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
/** Returns the default plot extension for a format
*/
wxString GetDefaultPlotExtension( PlotFormat aFormat );
wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat );
#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 ) );
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
m_UseConnectedTrackWidth = false;

View File

@ -28,9 +28,13 @@
#define BOARD_ITEM_CONTAINER_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.
@ -49,7 +53,7 @@ public:
* @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.
*/
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.

View File

@ -216,7 +216,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
// aMoveVector was snapshotted, don't need "data".
brd_item->Move( aMoveVector );
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
};
Visit( inspector, NULL, top_level_board_stuff );
@ -234,7 +234,7 @@ TRACKS BOARD::TracksInNet( int aNetCode )
if( t->GetNetCode() == aNetCode )
ret.push_back( t );
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
};
// 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;
}
if( aMode == ADD_APPEND )
if( aMode == ADD_MODE::APPEND )
m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) );
else
m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) );
@ -564,7 +564,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
break;
case PCB_MODULE_T:
if( aMode == ADD_APPEND )
if( aMode == ADD_MODE::APPEND )
m_modules.push_back( (MODULE*) aBoardItem );
else
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_TEXT_T:
case PCB_TARGET_T:
if( aMode == ADD_APPEND )
if( aMode == ADD_MODE::APPEND )
m_drawings.push_back( aBoardItem );
else
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[] )
{
KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE;
SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
const KICAD_T* p = scanTypes;
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 );
if( result == SEARCH_QUIT )
if( result == SEARCH_RESULT::QUIT )
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 );
if( result == SEARCH_QUIT )
if( result == SEARCH_RESULT::QUIT )
break;
}
@ -1018,7 +1018,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
break;
}
if( result == SEARCH_QUIT )
if( result == SEARCH_RESULT::QUIT )
break;
}
@ -1061,10 +1061,10 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
if( aReference == module->GetReference() )
{
found = module;
return SEARCH_QUIT;
return SEARCH_RESULT::QUIT;
}
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
};
// visit this BOARD with the above inspector

View File

@ -265,7 +265,7 @@ public:
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
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;

View File

@ -62,7 +62,7 @@ MODULE::MODULE( BOARD* parent ) :
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 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_ThermalGap = 0; // Use zone setting by default
@ -280,21 +280,21 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
// no break
case PCB_MODULE_EDGE_T:
if( aMode == ADD_APPEND )
if( aMode == ADD_MODE::APPEND )
m_drawings.push_back( aBoardItem );
else
m_drawings.push_front( aBoardItem );
break;
case PCB_PAD_T:
if( aMode == ADD_APPEND )
if( aMode == ADD_MODE::APPEND )
m_pads.push_back( static_cast<D_PAD*>( aBoardItem ) );
else
m_pads.push_front( static_cast<D_PAD*>( aBoardItem ) );
break;
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 ) );
else
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[] )
{
KICAD_T stype;
SEARCH_RESULT result = SEARCH_CONTINUE;
SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
const KICAD_T* p = scanTypes;
bool done = false;
@ -835,12 +835,12 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
case PCB_MODULE_TEXT_T:
result = inspector( m_Reference, testData );
if( result == SEARCH_QUIT )
if( result == SEARCH_RESULT::QUIT )
break;
result = inspector( m_Value, testData );
if( result == SEARCH_QUIT )
if( result == SEARCH_RESULT::QUIT )
break;
// 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;
}
if( result == SEARCH_QUIT )
if( result == SEARCH_RESULT::QUIT )
break;
}

View File

@ -126,7 +126,7 @@ public:
}
///> @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()
void Remove( BOARD_ITEM* aItem ) override;
@ -243,8 +243,15 @@ public:
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; }
ZoneConnection GetZoneConnection() const { return m_ZoneConnection; }
void SetZoneConnection( ZONE_CONNECTION aType )
{
m_ZoneConnection = aType;
}
ZONE_CONNECTION GetZoneConnection() const
{
return m_ZoneConnection;
}
void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
int GetThermalWidth() const { return m_ThermalWidth; }
@ -692,7 +699,7 @@ private:
int m_ModuleStatus; // For autoplace: flags (LOCKED, AUTOPLACED)
EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation.
ZoneConnection m_ZoneConnection;
ZONE_CONNECTION m_ZoneConnection;
int m_ThermalWidth;
int m_ThermalGap;
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_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_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();
if( m_ZoneConnection == PAD_ZONE_CONN_INHERITED && module )
if( m_ZoneConnection == ZONE_CONNECTION::INHERITED && module )
return module->GetZoneConnection();
else
return m_ZoneConnection;

View File

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

View File

@ -71,10 +71,9 @@ EDA_ITEM* TRACK::Clone() const
}
VIA::VIA( BOARD_ITEM* aParent ) :
TRACK( aParent, PCB_VIA_T )
VIA::VIA( BOARD_ITEM* aParent ) : TRACK( aParent, PCB_VIA_T )
{
SetViaType( VIA_THROUGH );
SetViaType( VIATYPE::THROUGH );
m_BottomLayer = B_Cu;
SetDrillDefault();
}
@ -89,14 +88,14 @@ EDA_ITEM* VIA::Clone() const
wxString VIA::GetSelectMenuText( EDA_UNITS aUnits ) const
{
wxString format;
BOARD* board = GetBoard();
BOARD* board = GetBoard();
switch( GetViaType() )
{
case VIA_BLIND_BURIED:
case VIATYPE::BLIND_BURIED:
format = _( "Blind/Buried Via %s %s on %s - %s" );
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
format = _( "Micro Via %s %s on %s - %s" );
break;
// 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 botLayer;
LayerPair( &topLayer, &botLayer );
return wxString::Format( format.GetData(),
MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(),
board->GetLayerName( topLayer ),
board->GetLayerName( botLayer ) );
return wxString::Format( format.GetData(), MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(), board->GetLayerName( topLayer ), board->GetLayerName( botLayer ) );
}
else
{
return wxString::Format( format.GetData(),
MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(),
wxT( "??" ),
wxT( "??" ) );
return wxString::Format( format.GetData(), MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(), wxT( "??" ), wxT( "??" ) );
}
}
@ -145,13 +137,13 @@ int TRACK::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
int VIA::GetDrillValue() const
{
if( m_Drill > 0 ) // Use the specific value.
if( m_Drill > 0 ) // Use the specific value.
return m_Drill;
// Use the default value from the Netclass
NETCLASSPTR netclass = GetNetClass();
if( GetViaType() == VIA_MICROVIA )
if( GetViaType() == VIATYPE::MICROVIA )
return netclass->GetuViaDrill();
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 );
}
if( GetViaType() != VIA_THROUGH )
if( GetViaType() != VIATYPE::THROUGH )
{
int copperLayerCount = GetBoard()->GetCopperLayerCount();
int copperLayerCount = GetBoard()->GetCopperLayerCount();
PCB_LAYER_ID top_layer;
PCB_LAYER_ID 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 );
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( stype == Type() )
{
if( SEARCH_QUIT == inspector( this, testData ) )
return SEARCH_QUIT;
if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
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
{
if( GetViaType() == VIA_THROUGH )
if( GetViaType() == VIATYPE::THROUGH )
return LSET::AllCuMask();
// VIA_BLIND_BURIED or VIA_MICRVIA:
@ -320,7 +312,7 @@ LSET VIA::GetLayerSet() const
wxASSERT( m_Layer <= m_BottomLayer );
// 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 );
}
@ -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 b_layer = B_Cu;
if( GetViaType() != VIA_THROUGH )
if( GetViaType() != VIATYPE::THROUGH )
{
b_layer = m_BottomLayer;
t_layer = m_Layer;
@ -386,9 +378,9 @@ PCB_LAYER_ID VIA::BottomLayer() const
void VIA::SanitizeLayers()
{
if( GetViaType() == VIA_THROUGH )
if( GetViaType() == VIATYPE::THROUGH )
{
m_Layer = F_Cu;
m_Layer = F_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 )
{
int radius;
int fillvia = 0;
PCB_SCREEN* screen = aFrame->GetScreen();
auto& displ_opts = aFrame->GetDisplayOptions();
BOARD* brd = GetBoard();
COLOR4D color = aFrame->Settings().Colors().GetItemColor( LAYER_VIAS + GetViaType() );
int radius;
int fillvia = 0;
PCB_SCREEN* screen = aFrame->GetScreen();
auto& displ_opts = aFrame->GetDisplayOptions();
BOARD* brd = GetBoard();
COLOR4D color = aFrame->Settings().Colors().GetItemColor(
LAYER_VIAS + static_cast<int>( GetViaType() ) );
if( displ_opts.m_DisplayViaFill == FILLED )
fillvia = 1;
if( !brd->IsElementVisible( LAYER_VIAS + GetViaType() ) )
return;
if( !brd->IsElementVisible( LAYER_VIAS + static_cast<int>( GetViaType() ) ) )
return;
// Only draw the via if at least one of the layers it crosses is being displayed
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
// (so we can see 2 superimposed microvias ):
if( GetViaType() == VIA_MICROVIA )
if( GetViaType() == VIATYPE::MICROVIA )
{
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
// (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;
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
switch( GetViaType() )
{
case VIA_THROUGH:
case VIATYPE::THROUGH:
aLayers[2] = LAYER_VIA_THROUGH;
break;
case VIA_BLIND_BURIED:
case VIATYPE::BLIND_BURIED:
aLayers[2] = LAYER_VIA_BBLIND;
aLayers[3] = m_Layer;
aLayers[4] = m_BottomLayer;
aCount += 2;
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
aLayers[2] = LAYER_VIA_MICROVIA;
break;
@ -743,19 +736,19 @@ unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
switch( m_ViaType )
{
case VIA_THROUGH:
case VIATYPE::THROUGH:
if( !aView->IsLayerVisible( LAYER_VIA_THROUGH ) )
return HIDE;
break;
case VIA_BLIND_BURIED:
case VIATYPE::BLIND_BURIED:
if( !aView->IsLayerVisible( LAYER_VIA_BBLIND ) )
return HIDE;
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
if( !aView->IsLayerVisible( LAYER_VIA_MICROVIA ) )
return HIDE;
@ -920,22 +913,22 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aL
switch( GetViaType() )
{
default:
case VIA_NOT_DEFINED:
msg = wxT( "???" ); // Not used yet, does not exist currently
case VIATYPE::NOT_DEFINED:
msg = wxT( "???" ); // Not used yet, does not exist currently
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from
// the near neighbor inner layer only
// the near neighbor inner layer only
break;
case VIA_BLIND_BURIED:
msg = _( "Blind/Buried Via" ); // from inner or external to inner
// or external layer (no restriction)
case VIATYPE::BLIND_BURIED:
msg = _( "Blind/Buried Via" ); // from inner or external to inner
// or external layer (no restriction)
break;
case VIA_THROUGH:
msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only )
case VIATYPE::THROUGH:
msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only )
break;
}
@ -978,7 +971,7 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aL
if( net )
{
if( GetViaType() == VIA_MICROVIA )
if( GetViaType() == VIATYPE::MICROVIA )
drill_class_value = net->GetMicroViaDrillSize();
else
drill_class_value = net->GetViaDrillSize();

View File

@ -57,13 +57,13 @@ enum ENDPOINT_T {
// Via types
// 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 */
VIA_BLIND_BURIED = 2, /* this via can be on internal layers */
VIA_MICROVIA = 1, /* this via which connect from an external layer
THROUGH = 3, /* Always a through hole via */
BLIND_BURIED = 2, /* this via can be on internal layers */
MICROVIA = 1, /* this via which connect from an external 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.
@ -343,8 +343,15 @@ public:
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif
VIATYPE_T GetViaType() const { return m_ViaType; }
void SetViaType( VIATYPE_T aViaType ) { m_ViaType = aViaType; }
VIATYPE GetViaType() const
{
return m_ViaType;
}
void SetViaType( VIATYPE aViaType )
{
m_ViaType = aViaType;
}
/**
* Function SetDrill
@ -387,11 +394,11 @@ protected:
private:
/// 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;
else
return aPad->GetZoneConnection();

View File

@ -176,8 +176,12 @@ public:
int GetZoneClearance() const { return m_ZoneClearance; }
void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const;
void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
ZONE_CONNECTION GetPadConnection( D_PAD* aPad = NULL ) const;
void SetPadConnection( ZONE_CONNECTION aPadConnection )
{
m_PadConnection = aPadConnection;
}
int GetMinThickness() const { return m_ZoneMinThickness; }
void SetMinThickness( int aMinThickness )
@ -736,7 +740,7 @@ protected:
bool m_doNotAllowVias;
bool m_doNotAllowTracks;
ZoneConnection m_PadConnection;
ZONE_CONNECTION m_PadConnection;
int m_ZoneClearance; ///< Clearance value in internal units.
int m_ZoneMinThickness; ///< Minimum thickness value in filled areas.
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();
if( ( m_Guide->IgnoreThroughVias() && type == VIA_THROUGH ) ||
( m_Guide->IgnoreBlindBuriedVias() && type == VIA_BLIND_BURIED ) ||
( m_Guide->IgnoreMicroVias() && type == VIA_MICROVIA ) )
if( ( m_Guide->IgnoreThroughVias() && type == VIATYPE::THROUGH )
|| ( m_Guide->IgnoreBlindBuriedVias() && type == VIATYPE::BLIND_BURIED )
|| ( m_Guide->IgnoreMicroVias() && type == VIATYPE::MICROVIA ) )
{
goto exit;
}
@ -472,7 +472,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
}
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.
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 )
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_viasTypes.clear();
m_viasTypes.push_back( viasType_t( VIA_THROUGH, _( "Through vias:" ) ) );
m_viasTypes.push_back( viasType_t( VIA_BLIND_BURIED, _( "Blind/buried:" ) ) );
m_viasTypes.push_back( viasType_t( VIA_MICROVIA, _( "Micro vias:" ) ) );
m_viasTypes.push_back( viasType_t( VIATYPE::THROUGH, _( "Through vias:" ) ) );
m_viasTypes.push_back( viasType_t( VIATYPE::BLIND_BURIED, _( "Blind/buried:" ) ) );
m_viasTypes.push_back( viasType_t( VIATYPE::MICROVIA, _( "Micro vias:" ) ) );
// If there not enough rows in grids, append some
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 viasType_t = typeContainer_t<VIATYPE_T>;
using viasType_t = typeContainer_t<VIATYPE>;
/**
* 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() )
{
default:
case PAD_ZONE_CONN_THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break;
case PAD_ZONE_CONN_THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break;
case PAD_ZONE_CONN_NONE: m_PadInZoneOpt->SetSelection( 3 ); break;
case PAD_ZONE_CONN_FULL: m_PadInZoneOpt->SetSelection( 0 ); break;
case ZONE_CONNECTION::THERMAL:
m_PadInZoneOpt->SetSelection( 1 );
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
@ -323,10 +331,18 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
switch( m_PadInZoneOpt->GetSelection() )
{
case 3: m_settings.SetPadConnection( PAD_ZONE_CONN_NONE ); break;
case 2: m_settings.SetPadConnection( PAD_ZONE_CONN_THT_THERMAL ); break;
case 1: m_settings.SetPadConnection( PAD_ZONE_CONN_THERMAL ); break;
case 0: m_settings.SetPadConnection( PAD_ZONE_CONN_FULL ); break;
case 3:
m_settings.SetPadConnection( ZONE_CONNECTION::NONE );
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() )

View File

@ -337,10 +337,18 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
switch( m_footprint->GetZoneConnection() )
{
default:
case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
case ZONE_CONNECTION::INHERITED:
m_ZoneConnectionChoice->SetSelection( 0 );
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
@ -651,7 +659,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
while( i < m_texts->size() )
{
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 );
}
@ -677,10 +685,18 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
switch( m_ZoneConnectionChoice->GetSelection() )
{
default:
case 0: m_footprint->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break;
case 1: m_footprint->SetZoneConnection( PAD_ZONE_CONN_FULL ); break;
case 2: m_footprint->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break;
case 3: m_footprint->SetZoneConnection( PAD_ZONE_CONN_NONE ); break;
case 0:
m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED );
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

View File

@ -265,10 +265,18 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
switch( m_footprint->GetZoneConnection() )
{
default:
case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
case ZONE_CONNECTION::INHERITED:
m_ZoneConnectionChoice->SetSelection( 0 );
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
@ -614,7 +622,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
while( i < m_texts->size() )
{
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 );
}
@ -653,10 +661,18 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
switch( m_ZoneConnectionChoice->GetSelection() )
{
default:
case 0: m_footprint->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break;
case 1: m_footprint->SetZoneConnection( PAD_ZONE_CONN_FULL ); break;
case 2: m_footprint->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break;
case 3: m_footprint->SetZoneConnection( PAD_ZONE_CONN_NONE ); break;
case 0:
m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED );
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();

View File

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

View File

@ -183,15 +183,15 @@ void DIALOG_GENDRILL::InitDisplayParams()
{
switch( via->GetViaType() )
{
case VIA_THROUGH:
case VIATYPE::THROUGH:
m_throughViasCount++;
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
m_microViasCount++;
break;
case VIA_BLIND_BURIED:
case VIATYPE::BLIND_BURIED:
m_blindOrBuriedViasCount++;
break;
@ -370,10 +370,10 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
m_pcbEditFrame->ClearMsgPanel();
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
const PlotFormat filefmt[6] =
{ // 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_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
const PLOT_FORMAT filefmt[6] = {
// 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::DXF,
PLOT_FORMAT::SVG, PLOT_FORMAT::PDF
};
unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection();

View File

@ -676,10 +676,18 @@ void DIALOG_PAD_PROPERTIES::initValues()
switch( m_dummyPad->GetLocalZoneConnection() )
{
default:
case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
case ZONE_CONNECTION::INHERITED:
m_ZoneConnectionChoice->SetSelection( 0 );
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 )
@ -1578,10 +1586,18 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
switch( m_ZoneConnectionChoice->GetSelection() )
{
default:
case 0: aPad->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break;
case 1: aPad->SetZoneConnection( PAD_ZONE_CONN_FULL ); break;
case 2: aPad->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break;
case 3: aPad->SetZoneConnection( PAD_ZONE_CONN_NONE ); break;
case 0:
aPad->SetZoneConnection( ZONE_CONNECTION::INHERITED );
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() ) );

View File

@ -93,12 +93,24 @@ void DIALOG_PLOT::init_Dialog()
switch( m_plotOpts.GetFormat() )
{
default:
case PLOT_FORMAT_GERBER: m_plotFormatOpt->SetSelection( 0 ); break;
case PLOT_FORMAT_POST: 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;
case PLOT_FORMAT_PDF: m_plotFormatOpt->SetSelection( 5 ); break;
case PLOT_FORMAT::GERBER:
m_plotFormatOpt->SetSelection( 0 );
break;
case PLOT_FORMAT::POST:
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;
case PLOT_FORMAT::PDF:
m_plotFormatOpt->SetSelection( 5 );
break;
}
// 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() );
// 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
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
static const PlotFormat plotFmt[] =
{
PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST,
PLOT_FORMAT_SVG,
PLOT_FORMAT_DXF,
PLOT_FORMAT_HPGL,
PLOT_FORMAT_PDF
};
static const PLOT_FORMAT plotFmt[] = { 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 )
{
// 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() )
{
case PLOT_FORMAT_PDF:
case PLOT_FORMAT_SVG:
case PLOT_FORMAT::PDF:
case PLOT_FORMAT::SVG:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false );
setPlotModeChoiceSelection( FILLED );
@ -409,7 +414,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break;
case PLOT_FORMAT_POST:
case PLOT_FORMAT::POST:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true );
@ -431,7 +436,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break;
case PLOT_FORMAT_GERBER:
case PLOT_FORMAT::GERBER:
m_drillShapeOpt->Enable( false );
m_drillShapeOpt->SetSelection( 0 );
m_plotModeOpt->Enable( false );
@ -458,7 +463,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break;
case PLOT_FORMAT_HPGL:
case PLOT_FORMAT::HPGL:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true );
@ -481,7 +486,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_PlotOptionsSizer->Hide( m_SizerDXF_options );
break;
case PLOT_FORMAT_DXF:
case PLOT_FORMAT::DXF:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false );
setPlotModeChoiceSelection( FILLED );
@ -509,7 +514,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
OnChangeDXFPlotMode( event );
break;
case PLOT_FORMAT_UNDEFINED:
case PLOT_FORMAT::UNDEFINED:
break;
}
@ -589,11 +594,11 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option
tempOptions.SetTextMode( PLOTTEXTMODE_DEFAULT );
if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option
tempOptions.SetTextMode( PLOT_TEXT_MODE::DEFAULT );
else
tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ?
PLOTTEXTMODE_DEFAULT : PLOTTEXTMODE_NATIVE );
tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? PLOT_TEXT_MODE::DEFAULT :
PLOT_TEXT_MODE::NATIVE );
// Update settings from text fields. Rewrite values back to the fields,
// 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
// that can slightly change the value, update this param only if it
// is in use
if( getPlotFormat() == PLOT_FORMAT_HPGL )
if( getPlotFormat() == PLOT_FORMAT::HPGL )
{
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
* settings resulting in a divide by zero fault.
*/
if( getPlotFormat() == PLOT_FORMAT_POST )
if( getPlotFormat() == PLOT_FORMAT::POST )
{
if( m_XScaleAdjust != 0.0 )
m_plotOpts.SetFineScaleAdjustX( m_XScaleAdjust );
@ -831,7 +836,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Use Gerber Extensions based on layer number
// (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 );
BuildPlotFileName( &fn, outputDir.GetPath(), board->GetLayerName( layer ), file_ext );
@ -863,7 +868,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
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
wxFileName fn( boardFilename );

View File

@ -79,7 +79,7 @@ private:
void init_Dialog(); // main initialization
void reInitDialog(); // initialization after calling drill dialog
void applyPlotSettings();
PlotFormat getPlotFormat();
PLOT_FORMAT getPlotFormat();
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() );
VIATYPE_T viaType = VIA_NOT_DEFINED;
VIATYPE viaType = VIATYPE::NOT_DEFINED;
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 );
if( viaType != v->GetViaType() )
viaType = VIA_NOT_DEFINED;
viaType = VIATYPE::NOT_DEFINED;
if( m_ViaStartLayer->GetLayerSelection() != v->TopLayer() )
m_ViaStartLayer->SetLayerSelection( UNDEFINED_LAYER );
@ -226,14 +226,22 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
switch( viaType )
{
case VIA_THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break;
case VIA_MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break;
case VIA_BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break;
case VIA_NOT_DEFINED: m_ViaTypeChoice->SetSelection( 3 ); break;
case VIATYPE::THROUGH:
m_ViaTypeChoice->SetSelection( 0 );
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_ViaEndLayer->Enable( viaType != VIA_THROUGH );
m_ViaStartLayer->Enable( viaType != VIATYPE::THROUGH );
m_ViaEndLayer->Enable( viaType != VIATYPE::THROUGH );
}
else
{
@ -453,9 +461,16 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
switch( m_ViaTypeChoice->GetSelection() )
{
default:
case 0: v->SetViaType( VIA_THROUGH ); v->SanitizeLayers(); break;
case 1: v->SetViaType( VIA_MICROVIA ); break;
case 2: v->SetViaType( VIA_BLIND_BURIED ); break;
case 0:
v->SetViaType( VIATYPE::THROUGH );
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");
// fall through
case VIA_THROUGH:
case VIA_BLIND_BURIED:
case VIATYPE::THROUGH:
case VIATYPE::BLIND_BURIED:
v->SetWidth( v->GetNetClass()->GetViaDiameter() );
v->SetDrill( v->GetNetClass()->GetViaDrill() );
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
v->SetWidth( v->GetNetClass()->GetuViaDiameter() );
v->SetDrill( v->GetNetClass()->GetuViaDrill() );
break;

View File

@ -503,7 +503,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( width <= 0 )
width = m_board->GetDesignSettings().GetLineThickness( layer );
m_board->Add( dseg, ADD_APPEND );
m_board->Add( dseg, ADD_MODE::APPEND );
if( !w.curve )
{
@ -537,7 +537,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER )
{
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->SetTimeStamp( EagleTimeStamp( gr ) );
@ -645,7 +645,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER ) // unsupported layer
{
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 radius = c.radius.ToPcbUnits();
@ -679,7 +679,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
{
// use a "netcode = 0" type ZONE:
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->SetLayer( layer );
@ -711,7 +711,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
// Use m_hole_count to gen up a unique name.
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->Reference().SetVisible( false );
@ -738,7 +738,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
{
const BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
DIMENSION* dimension = new DIMENSION( m_board );
m_board->Add( dimension, ADD_APPEND );
m_board->Add( dimension, ADD_MODE::APPEND );
if( d.dimensionType )
{
@ -919,7 +919,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
// copy constructor to clone the template
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
for( auto pad : m->Pads() )
@ -1127,7 +1127,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
// use a "netcode = 0" type ZONE:
zone = new ZONE_CONTAINER( m_board );
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
zone->SetLayer( F_Cu );
@ -1239,7 +1239,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
// missing == yes per DTD.
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 )
{
@ -2035,7 +2035,7 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, D_PAD* aPad ) cons
// Solid connection to copper zones
if( aEaglePad.thermals && !*aEaglePad.thermals )
aPad->SetZoneConnection( PAD_ZONE_CONN_FULL );
aPad->SetZoneConnection( ZONE_CONNECTION::FULL );
MODULE* module = aPad->GetParent();
wxCHECK( module, /* void */ );
@ -2216,11 +2216,11 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
m_min_via_hole = drillz;
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 )
via->SetViaType( VIA_MICROVIA );
via->SetViaType( VIATYPE::MICROVIA );
else
via->SetViaType( VIA_BLIND_BURIED );
via->SetViaType( VIATYPE::BLIND_BURIED );
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
// (no specific values defined by a table of specific value)
// Ensure the netclass is accessible:
if( via->GetViaType() == VIA_MICROVIA && net == NULL )
if( via->GetViaType() == VIATYPE::MICROVIA && net == NULL )
net = aTrackItem->GetNet();
// 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();
}
if( via->GetViaType() == VIA_MICROVIA )
if( via->GetViaType() == VIATYPE::MICROVIA )
{
if( net )
{

View File

@ -55,69 +55,68 @@ inline double diameter_in_mm( double ius )
}
bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
PlotFormat aFormat )
bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat )
{
// Remark:
// Hole list must be created before calling this function, by buildHolesList(),
// for the right holes set (PTH, NPTH, buried/blind vias ...)
double scale = 1.0;
wxPoint offset;
PLOTTER* plotter = NULL;
double scale = 1.0;
wxPoint offset;
PLOTTER* plotter = NULL;
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
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
// an A4 sheet in PS, + text description of symbols
switch( aFormat )
{
case PLOT_FORMAT_GERBER:
case PLOT_FORMAT::GERBER:
offset = GetOffset();
plotter = new GERBER_PLOTTER();
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
break;
case PLOT_FORMAT_HPGL: // Scale for HPGL format.
case PLOT_FORMAT::HPGL: // Scale for HPGL format.
{
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter;
plotter = hpgl_plotter;
hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
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:
wxASSERT( false );
// fall through
case PLOT_FORMAT_PDF:
case PLOT_FORMAT_POST:
case PLOT_FORMAT::PDF:
case PLOT_FORMAT::POST:
{
PAGE_INFO pageA4( wxT( "A4" ) );
wxSize pageSizeIU = pageA4.GetSizeIU();
PAGE_INFO pageA4( wxT( "A4" ) );
wxSize pageSizeIU = pageA4.GetSizeIU();
// 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
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
// 60% height for board 40% height for list
int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 );
double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight();
int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 );
double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight();
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;
scale = std::min( scale, 3.0 );
offset.x = KiROUND( double( bbbox.Centre().x ) -
( pageSizeIU.x / 2.0 ) / scale );
offset.y = KiROUND( double( bbbox.Centre().y ) -
( ypagesize_for_board / 2.0 ) / scale );
offset.x = KiROUND( double( bbbox.Centre().x ) - ( pageSizeIU.x / 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;
else
plotter = new PS_PLOTTER;
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;
@ -152,25 +149,25 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
plotter = dxf_plotter;
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;
plotter = svg_plotter;
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->SetDefaultLineWidth( 5 * IU_PER_MILS );
plotter->SetColorMode( false );
if( ! plotter->OpenFile( aFullFileName ) )
if( !plotter->OpenFile( aFullFileName ) )
{
delete plotter;
return false;
@ -196,18 +193,18 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
case PCB_DIMENSION_T:
case PCB_TARGET_T:
case PCB_MARKER_T: // do not draw
case PCB_MARKER_T: // do not draw
default:
break;
}
}
int x, y;
int plotX, plotY, TextWidth;
int intervalle = 0;
char line[1024];
wxString msg;
int textmarginaftersymbol = KiROUND( 2 * IU_PER_MM );
int x, y;
int plotX, plotY, TextWidth;
int intervalle = 0;
char line[1024];
wxString msg;
int textmarginaftersymbol = KiROUND( 2 * IU_PER_MM );
// Set Drill Symbols width
plotter->SetDefaultLineWidth( 0.2 * IU_PER_MM / scale );
@ -217,23 +214,21 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
plotDrillMarks( plotter );
// Print a list of symbols used.
int charSize = 3 * IU_PER_MM; // text size in IUs
double charScale = 1.0 / scale; // real scale will be 1/scale,
// because the global plot scale is scale
TextWidth = KiROUND( (charSize * charScale) / 10.0 ); // Set text width (thickness)
intervalle = KiROUND( charSize * charScale ) + TextWidth;
int charSize = 3 * IU_PER_MM; // text size in IUs
double charScale = 1.0 / scale; // real scale will be 1/scale,
// because the global plot scale is scale
TextWidth = KiROUND( ( charSize * charScale ) / 10.0 ); // Set text width (thickness)
intervalle = KiROUND( charSize * charScale ) + TextWidth;
// Trace information.
plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
plotY = bbbox.GetBottom() + intervalle;
plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
plotY = bbbox.GetBottom() + intervalle;
// Plot title "Info"
wxString Text = wxT( "Drill Map:" );
plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0,
wxSize( KiROUND( charSize * charScale ),
KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
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 );
// List the diameter of each drill in mm and inches.
sprintf( line, "%2.2fmm / %2.3f\" ",
diameter_in_mm( tool.m_Diameter ),
diameter_in_inches( tool.m_Diameter ) );
sprintf( line, "%2.2fmm / %2.3f\" ", diameter_in_mm( tool.m_Diameter ),
diameter_in_inches( tool.m_Diameter ) );
msg = FROM_UTF8( line );
// Now list how many holes and ovals are associated with each drill.
if( ( tool.m_TotalCount == 1 )
&& ( tool.m_OvalCount == 0 ) )
if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
sprintf( line, "(1 hole)" );
else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 )
sprintf( line, "(1 slot)" );
@ -267,9 +260,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
else if( tool.m_OvalCount == 1 )
sprintf( line, "(%d holes + 1 slot)", tool.m_TotalCount - 1 );
else // if ( toolm_OvalCount > 1 )
sprintf( line, "(%d holes + %d slots)",
tool.m_TotalCount - tool.m_OvalCount,
tool.m_OvalCount );
sprintf( line, "(%d holes + %d slots)", tool.m_TotalCount - tool.m_OvalCount,
tool.m_OvalCount );
msg += FROM_UTF8( line );
@ -277,10 +269,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName,
msg += wxT( " (not plated)" );
plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0,
wxSize( KiROUND( charSize * charScale ),
KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
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<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
const PAGE_INFO* m_pageInfo; // the page info used to plot drill maps
// If NULL, use a A4 page format
@ -154,13 +154,13 @@ protected:
// Use derived classes to build a fully initialized GENDRILL_WRITER_BASE class.
GENDRILL_WRITER_BASE( BOARD* aPcb )
{
m_pcb = aPcb;
m_pcb = aPcb;
m_conversionUnits = 1.0;
m_unitsMetric = true;
m_mapFileFmt = PLOT_FORMAT_PDF;
m_pageInfo = NULL;
m_merge_PTH_NPTH = false;
m_zeroFormat = DECIMAL_FORMAT;
m_unitsMetric = true;
m_mapFileFmt = PLOT_FORMAT::PDF;
m_pageInfo = NULL;
m_merge_PTH_NPTH = false;
m_zeroFormat = DECIMAL_FORMAT;
}
public:
@ -195,7 +195,10 @@ public:
* PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
* 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
@ -273,7 +276,7 @@ protected:
* @param aFullFileName : the full filename of the map file to create,
* @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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -179,7 +179,7 @@ void PCB_ARC::AddToBoard()
{
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->SetTimeStamp( m_timestamp );

View File

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

View File

@ -512,7 +512,7 @@ void PCB_MODULE::AddToBoard()
(double) -m_rotation );
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->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->SetWidth( height );
via->SetViaType( VIA_THROUGH );
via->SetViaType( VIATYPE::THROUGH );
via->SetLayerPair( F_Cu, B_Cu );
via->SetDrill( m_hole );
@ -360,7 +360,7 @@ void PCB_PAD::AddToBoard()
else // pad
{
MODULE* module = new MODULE( m_board );
m_board->Add( module, ADD_APPEND );
m_board->Add( module, ADD_MODE::APPEND );
m_name.text = m_defaultPinDes;

View File

@ -187,7 +187,7 @@ void PCB_POLYGON::AddToBoard()
if( m_outline.GetCount() > 0 )
{
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->SetLayer( m_KiCadLayer );

View File

@ -106,7 +106,7 @@ void PCB_TEXT::AddToBoard()
m_name.textRotation = m_rotation;
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 );

View File

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

View File

@ -909,11 +909,21 @@ void PCB_EDIT_FRAME::ToPlotter( int aID )
switch( aID )
{
case ID_GEN_PLOT_GERBER: plotSettings.SetFormat( PLOT_FORMAT_GERBER ); break;
case ID_GEN_PLOT_DXF: 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_GERBER:
plotSettings.SetFormat( PLOT_FORMAT::GERBER );
break;
case ID_GEN_PLOT_DXF:
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;
default:
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() )
{
case VIA_THROUGH:
case VIATYPE::THROUGH:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH];
break;
case VIA_BLIND_BURIED:
case VIATYPE::BLIND_BURIED:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_BBLIND];
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_MICROVIA];
break;
@ -567,7 +567,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
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
// top and bottom layers

View File

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

View File

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

View File

@ -66,13 +66,13 @@ private:
DXF_PLOTTER::DXF_UNITS m_DXFplotUnits;
/// 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
DrillMarksType m_drillMarks;
/// 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)
int m_lineWidth;
@ -192,8 +192,15 @@ public:
void SetColor( COLOR4D aVal ) { m_color = aVal; }
COLOR4D GetColor() const { return m_color; }
void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
PlotTextMode GetTextMode() const { return m_textMode; }
void SetTextMode( PLOT_TEXT_MODE aVal )
{
m_textMode = aVal;
}
PLOT_TEXT_MODE GetTextMode() const
{
return m_textMode;
}
void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; }
EDA_DRAW_MODE_T GetPlotMode() const { return m_plotMode; }
@ -252,8 +259,15 @@ public:
void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
void SetFormat( PlotFormat aFormat ) { m_format = aFormat; }
PlotFormat GetFormat() const { return m_format; }
void SetFormat( PLOT_FORMAT aFormat )
{
m_format = aFormat;
}
PLOT_FORMAT GetFormat() const
{
return m_format;
}
void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
wxString GetOutputDirectory() const { return m_outputDirectory; }

View File

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

View File

@ -94,7 +94,7 @@ public:
*/
int getFineWidthAdj()
{
if( GetFormat() == PLOT_FORMAT_POST )
if( GetFormat() == PLOT_FORMAT::POST )
return GetWidthAdjust();
else
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 ):
// 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 );
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
@ -191,7 +191,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
// Plot solder mask:
if( soldermask_min_thickness == 0 )
{
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF )
if( plotOpt.GetFormat() == PLOT_FORMAT::DXF )
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
else
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
@ -210,7 +210,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
// Disable plot pad holes
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 );
else
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
@ -218,7 +218,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
case F_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.
// and must not be used for other plot formats
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 );
// Gerber: Subtract soldermask from silkscreen if enabled
if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER
&& plotOpt.GetSubtractMaskFromSilk() )
if( aPlotter->GetPlotterType() == PLOT_FORMAT::GERBER
&& plotOpt.GetSubtractMaskFromSilk() )
{
if( aLayer == F_SilkS )
layer_mask = LSET( F_Mask );
@ -261,7 +261,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
plotOpt.SetSkipPlotNPTH_Pads( false );
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.
// and must not be used for other plot formats
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.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.
// and must not be used for other plot formats
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
@ -526,7 +526,8 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
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
// white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
@ -1039,7 +1040,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
switch( aPlotOpts->GetFormat() )
{
case PLOT_FORMAT_DXF:
case PLOT_FORMAT::DXF:
DXF_PLOTTER* DXF_plotter;
DXF_plotter = new DXF_PLOTTER();
DXF_plotter->SetUnits(
@ -1048,7 +1049,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter = DXF_plotter;
break;
case PLOT_FORMAT_POST:
case PLOT_FORMAT::POST:
PS_PLOTTER* PS_plotter;
PS_plotter = new PS_PLOTTER();
PS_plotter->SetScaleAdjust( aPlotOpts->GetFineScaleAdjustX(),
@ -1056,11 +1057,11 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter = PS_plotter;
break;
case PLOT_FORMAT_PDF:
case PLOT_FORMAT::PDF:
plotter = new PDF_PLOTTER();
break;
case PLOT_FORMAT_HPGL:
case PLOT_FORMAT::HPGL:
HPGL_PLOTTER* HPGL_plotter;
HPGL_plotter = new HPGL_PLOTTER();
@ -1069,11 +1070,11 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter = HPGL_plotter;
break;
case PLOT_FORMAT_GERBER:
case PLOT_FORMAT::GERBER:
plotter = new GERBER_PLOTTER();
break;
case PLOT_FORMAT_SVG:
case PLOT_FORMAT::SVG:
plotter = new SVG_PLOTTER();
break;
@ -1097,7 +1098,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
plotter->ClearHeaderLinesList();
// 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();

View File

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

View File

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

View File

@ -50,14 +50,14 @@ public:
VIA() :
ITEM( VIA_T )
{
m_diameter = 2; // Dummy value
m_drill = 0;
m_viaType = VIA_THROUGH;
m_diameter = 2; // Dummy value
m_drill = 0;
m_viaType = VIATYPE::THROUGH;
}
VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) :
ITEM( VIA_T )
VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aDiameter, int aDrill, int aNet = -1,
VIATYPE aViaType = VIATYPE::THROUGH )
: ITEM( VIA_T )
{
SetNet( aNet );
SetLayers( aLayers );
@ -68,7 +68,7 @@ public:
m_viaType = aViaType;
//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 );
SetLayers( allLayers );
@ -107,12 +107,12 @@ public:
m_shape.SetCenter( aPos );
}
VIATYPE_T ViaType() const
VIATYPE ViaType() const
{
return m_viaType;
}
void SetViaType( VIATYPE_T aViaType )
void SetViaType( VIATYPE aViaType )
{
m_viaType = aViaType;
}
@ -168,11 +168,11 @@ public:
const VIA_HANDLE MakeHandle() const;
private:
int m_diameter;
int m_drill;
VECTOR2I m_pos;
int m_diameter;
int m_drill;
VECTOR2I m_pos;
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 )
{
case VIA_ACTION_FLAGS::VIA: return VIA_THROUGH;
case VIA_ACTION_FLAGS::BLIND_VIA: return VIA_BLIND_BURIED;
case VIA_ACTION_FLAGS::MICROVIA: return VIA_MICROVIA;
case VIA_ACTION_FLAGS::VIA:
return VIATYPE::THROUGH;
case VIA_ACTION_FLAGS::BLIND_VIA:
return VIATYPE::BLIND_BURIED;
case VIA_ACTION_FLAGS::MICROVIA:
return VIATYPE::MICROVIA;
default:
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>();
VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags );
VIATYPE viaType = getViaTypeFromFlags( actViaFlags );
const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
BOARD_DESIGN_SETTINGS& bds = board()->GetDesignSettings();
const int layerCount = bds.GetCopperLayerCount();
int currentLayer = m_router->GetCurrentLayer();
const int layerCount = bds.GetCopperLayerCount();
int currentLayer = m_router->GetCurrentLayer();
PCB_LAYER_ID pairTop = frame()->GetScreen()->m_Route_Layer_TOP;
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();
targetLayer = frame()->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ),
LSET::AllNonCuMask(), dlgPosition );
targetLayer = frame()->SelectLayer(
static_cast<PCB_LAYER_ID>( currentLayer ), LSET::AllNonCuMask(), dlgPosition );
// Reset the cursor to the position where the event occured
controls()->SetCursorPosition( aEvent.HasPosition() ? aEvent.Position() : dlgPosition );
@ -551,44 +554,48 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
if( !m_router->IsPlacingVia() )
{
// 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;
}
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;
}
// 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." ) );
return false;
}
// 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." ) );
return false;
}
}
// 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 )
|| ( targetLayer == F_Cu && currentLayer == B_Cu ) ) )
if( viaType == VIATYPE::BLIND_BURIED
&& ( ( targetLayer == B_Cu && currentLayer == F_Cu )
|| ( targetLayer == F_Cu && currentLayer == B_Cu ) ) )
{
viaType = VIA_THROUGH;
viaType = VIATYPE::THROUGH;
}
switch( viaType )
{
case VIA_THROUGH:
case VIATYPE::THROUGH:
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
sizes.SetViaDrill( bds.GetCurrentViaDrill() );
@ -604,11 +611,12 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
}
break;
case VIA_MICROVIA:
case VIATYPE::MICROVIA:
sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
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 )
{
@ -622,11 +630,12 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
}
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;
case VIA_BLIND_BURIED:
case VIATYPE::BLIND_BURIED:
sizes.SetViaDiameter( bds.GetCurrentViaSize() );
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->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrill( drill_diam_iu );
via->SetViaType( VIA_THROUGH );
via->SetViaType( VIATYPE::THROUGH );
via->SetWidth( viaDiam );
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->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrill( drill_diam_iu );
via->SetViaType( VIA_THROUGH );
via->SetViaType( VIATYPE::THROUGH );
via->SetWidth( viaDiam );
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)
|| (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
via->SetViaType( VIA_MICROVIA );
via->SetViaType( VIATYPE::MICROVIA );
else
via->SetViaType( VIA_BLIND_BURIED );
via->SetViaType( VIATYPE::BLIND_BURIED );
via->SetWidth( viaDiam );

View File

@ -19,7 +19,7 @@
"""
Add a BOARD_ITEM to this BOARD_ITEM_CONTAINER, clear the thisown to prevent
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)
"""
item.thisown=0

View File

@ -123,7 +123,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
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 );
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
switch( via->GetViaType() )
{
case VIA_BLIND_BURIED:
case VIATYPE::BLIND_BURIED:
via->SetLayerPair( first_layer, last_layer );
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 =
ToLAYER_ID( ( m_board->GetCopperLayerCount() - 2 ) );

View File

@ -722,7 +722,7 @@ void DRC::testDrilledHoles()
for( TRACK* track : m_pcb->Tracks() )
{
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_drillRadius = via->GetDrillValue() / 2;

View File

@ -170,7 +170,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
wxPoint refviaPos = refvia->GetPosition();
// 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 )
{
@ -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
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 );
@ -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
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 );
@ -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
// because they are used for very small drill size and are drill by laser
// and **only one layer** can be drilled
if( refvia->GetViaType() == VIA_MICROVIA )
if( refvia->GetViaType() == VIATYPE::MICROVIA )
{
PCB_LAYER_ID layer1, layer2;
bool err = true;
@ -704,15 +704,15 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
DRAWSEGMENT* test_edge = dynamic_cast<DRAWSEGMENT*>( item );
if( !test_edge || test_edge->GetLayer() != Edge_Cuts )
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
if( test_edge->HitTest((wxPoint) pt, w_dist ) )
{
edge = test_edge;
return SEARCH_QUIT;
return SEARCH_RESULT::QUIT;
}
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
};
// 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_drill;
if( via->GetViaType() == VIA_MICROVIA )
if( via->GetViaType() == VIATYPE::MICROVIA )
{
auto net = via->GetNet();

View File

@ -137,7 +137,7 @@ int GLOBAL_EDIT_TOOL::SwapLayers( const TOOL_EVENT& aEvent )
VIA* via = (VIA*) segm;
PCB_LAYER_ID top_layer, bottom_layer;
if( via->GetViaType() == VIA_THROUGH )
if( via->GetViaType() == VIATYPE::THROUGH )
continue;
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.
if( parent && parent->Type() == PCB_MODULE_T && parent->IsSelected() )
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
highlight( (BOARD_ITEM*) item, SELECTED, &m_selection );
}
return SEARCH_CONTINUE;
return SEARCH_RESULT::CONTINUE;
};
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
switch( via->GetViaType() )
{
case 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;
case VIATYPE::THROUGH:
if( !board()->IsElementVisible( LAYER_VIA_THROUGH ) )
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

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

View File

@ -66,7 +66,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
// thickness of the copper bridge in thermal reliefs:
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;

View File

@ -97,7 +97,7 @@ public:
private:
int m_cornerSmoothingType; ///< Corner smoothing type
unsigned int m_cornerRadius; ///< Corner chamfer distance / fillet radius
ZoneConnection m_PadConnection;
ZONE_CONNECTION m_PadConnection;
/* A zone outline can be a keepout zone.
* 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; }
ZoneConnection GetPadConnection() const { return m_PadConnection; }
void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
ZONE_CONNECTION GetPadConnection() const
{
return m_PadConnection;
}
void SetPadConnection( ZONE_CONNECTION aPadConnection )
{
m_PadConnection = aPadConnection;
}
/**
* Accessors to parameters used in Keepout zones:

View File

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