Fix formatting and overzealous renaming for FILL_TYPE

This commit is contained in:
Ian McInerney 2020-10-15 09:48:02 +01:00
parent b8453d1b6b
commit 5f4b0eb0fb
10 changed files with 31 additions and 49 deletions

View File

@ -29,7 +29,7 @@
#include <general.h>
#include <lib_item.h>
const int FILL_TYPEab[3] = { 'N', 'F', 'f' };
const int fill_tab[3] = { 'N', 'F', 'f' };
LIB_ITEM::LIB_ITEM( KICAD_T aType,

View File

@ -42,7 +42,7 @@ class MSG_PANEL_ITEM;
using KIGFX::RENDER_SETTINGS;
extern const int FILL_TYPEab[];
extern const int fill_tab[];
#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in internal units

View File

@ -35,12 +35,11 @@
#include <transform.h>
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) :
LIB_ITEM( LIB_RECTANGLE_T, aParent )
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) : LIB_ITEM( LIB_RECTANGLE_T, aParent )
{
m_Width = 0;
m_Width = 0;
m_Fill = FILL_TYPE::NO_FILL;
m_isFillable = true;
m_isFillable = true;
}

View File

@ -513,17 +513,10 @@ void SCH_SEXPR_PARSER::parseFill( FILL_PARAMS& aFill )
switch( token )
{
case T_none:
aFill.m_FillType = FILL_TYPE::NO_FILL;
break;
case T_outline:
aFill.m_FillType = FILL_TYPE::FILLED_SHAPE;
break;
case T_background:
aFill.m_FillType = FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
break;
default:
Expecting( "none, outline, or background" );
case T_none: aFill.m_FillType = FILL_TYPE::NO_FILL; break;
case T_outline: aFill.m_FillType = FILL_TYPE::FILLED_SHAPE; break;
case T_background: aFill.m_FillType = FILL_TYPE::FILLED_WITH_BG_BODYCOLOR; break;
default: Expecting( "none, outline, or background" );
}
NeedRIGHT();

View File

@ -82,16 +82,10 @@ static void formatFill( const LIB_ITEM* aItem, OUTPUTFORMATTER& aFormatter, int
switch( aItem->GetFillMode() )
{
case FILL_TYPE::FILLED_SHAPE:
fillType = "outline";
break;
case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR:
fillType = "background";
break;
case FILL_TYPE::NO_FILL:
KI_FALLTHROUGH;
default:
fillType = "none";
case FILL_TYPE::FILLED_SHAPE: fillType = "outline"; break;
case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR: fillType = "background"; break;
case FILL_TYPE::NO_FILL: KI_FALLTHROUGH;
default: fillType = "none";
}
aFormatter.Print( aNestLevel, "(fill (type %s))", fillType );

View File

@ -3207,14 +3207,10 @@ FILL_TYPE SCH_LEGACY_PLUGIN_CACHE::parseFillMode( LINE_READER& aReader, const ch
{
switch ( parseChar( aReader, aLine, aOutput ) )
{
case 'F':
return FILL_TYPE::FILLED_SHAPE;
case 'f':
return FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
case 'N':
return FILL_TYPE::NO_FILL;
default:
SCH_PARSE_ERROR( "invalid fill type, expected f, F, or N", aReader, aLine );
case 'F': return FILL_TYPE::FILLED_SHAPE;
case 'f': return FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
case 'N': return FILL_TYPE::NO_FILL;
default: SCH_PARSE_ERROR( "invalid fill type, expected f, F, or N", aReader, aLine );
}
// This will never be reached but quiets the compiler warnings
@ -3944,7 +3940,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveArc( LIB_ARC* aArc,
aFormatter.Print( 0, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
Iu2Mils( aArc->GetPosition().x ), Iu2Mils( aArc->GetPosition().y ),
Iu2Mils( aArc->GetRadius() ), x1, x2, aArc->GetUnit(), aArc->GetConvert(),
Iu2Mils( aArc->GetWidth() ), FILL_TYPEab[ static_cast<int>( aArc->GetFillMode() ) ],
Iu2Mils( aArc->GetWidth() ), fill_tab[ static_cast<int>( aArc->GetFillMode() ) ],
Iu2Mils( aArc->GetStart().x ), Iu2Mils( aArc->GetStart().y ),
Iu2Mils( aArc->GetEnd().x ), Iu2Mils( aArc->GetEnd().y ) );
}
@ -3961,7 +3957,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveBezier( LIB_BEZIER* aBezier,
for( const auto& pt : aBezier->GetPoints() )
aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) );
aFormatter.Print( 0, " %c\n", FILL_TYPEab[static_cast<int>( aBezier->GetFillMode() )] );
aFormatter.Print( 0, " %c\n", fill_tab[static_cast<int>( aBezier->GetFillMode() )] );
}
@ -3973,7 +3969,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveCircle( LIB_CIRCLE* aCircle,
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n",
Iu2Mils( aCircle->GetPosition().x ), Iu2Mils( aCircle->GetPosition().y ),
Iu2Mils( aCircle->GetRadius() ), aCircle->GetUnit(), aCircle->GetConvert(),
Iu2Mils( aCircle->GetWidth() ), FILL_TYPEab[static_cast<int>( aCircle->GetFillMode() )] );
Iu2Mils( aCircle->GetWidth() ), fill_tab[static_cast<int>( aCircle->GetFillMode() )] );
}
@ -4160,7 +4156,7 @@ void SCH_LEGACY_PLUGIN_CACHE::savePolyLine( LIB_POLYLINE* aPolyLine,
aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) );
}
aFormatter.Print( 0, " %c\n", FILL_TYPEab[static_cast<int>( aPolyLine->GetFillMode() )] );
aFormatter.Print( 0, " %c\n", fill_tab[static_cast<int>( aPolyLine->GetFillMode() )] );
}
@ -4175,7 +4171,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveRectangle( LIB_RECTANGLE* aRectangle,
Iu2Mils( aRectangle->GetPosition().y ),
Iu2Mils( aRectangle->GetEnd().x ), Iu2Mils( aRectangle->GetEnd().y ),
aRectangle->GetUnit(), aRectangle->GetConvert(),
Iu2Mils( aRectangle->GetWidth() ), FILL_TYPEab[static_cast<int>( aRectangle->GetFillMode() )] );
Iu2Mils( aRectangle->GetWidth() ), fill_tab[static_cast<int>( aRectangle->GetFillMode() )] );
}

View File

@ -68,10 +68,10 @@ private:
void setTransitions() override;
private:
double m_lastTextAngle;
double m_lastTextAngle;
FILL_TYPE m_lastFillStyle;
bool m_drawSpecificConvert;
bool m_drawSpecificUnit;
bool m_drawSpecificConvert;
bool m_drawSpecificUnit;
};
#endif /* LIB_DRAWING_TOOLS_H */

View File

@ -1193,7 +1193,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates()
zone->SetLocalClearance( getKiCadLength( csTemplate.Pouring.AdditionalIsolation ) );
if( csTemplate.Pouring.FillType == TEMPLATE::POURING::COPPER_FILL_TYPEYPE::HATCHED )
if( csTemplate.Pouring.FillType == TEMPLATE::POURING::COPPER_FILL_TYPE::HATCHED )
{
zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
zone->SetHatchGap( getKiCadHatchCodeGap( csTemplate.Pouring.HatchCodeID ) );

View File

@ -1396,7 +1396,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Parse( XNODE* aNode )
LayerID = GetXmlAttributeIDString( aNode, 1 );
wxString subTypeStr = GetXmlAttributeIDString( aNode, 2 );
std::map<wxString, SUBTYPE> subTypeMap = {
std::map<wxString, SUBTYPE> subTypeMap = {
{ wxT( "DIMENSION_ORTHOGONAL" ), SUBTYPE::ORTHOGONAL },
{ wxT( "DIMENSION_DIRECT" ), SUBTYPE::DIRECT },
{ wxT( "DIMENSION_ANGLED" ), SUBTYPE::ANGLED },
@ -2143,11 +2143,11 @@ void CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::POURING::Parse( XNODE* aNode )
}
else if( cNodeName == wxT( "FILLED" ) )
{
FillType = COPPER_FILL_TYPEYPE::FILLED;
FillType = COPPER_FILL_TYPE::FILLED;
}
else if( cNodeName == wxT( "HATCHCODEREF" ) )
{
FillType = COPPER_FILL_TYPEYPE::HATCHED;
FillType = COPPER_FILL_TYPE::HATCHED;
HatchCodeID = GetXmlAttributeIDString( cNode, 0 );
}
else

View File

@ -1005,7 +1005,7 @@ public:
{
struct POURING
{
enum class COPPER_FILL_TYPEYPE
enum class COPPER_FILL_TYPE
{
FILLED,
HATCHED ///< This is a user defined HATCHCODE_ID
@ -1062,7 +1062,7 @@ public:
bool TargetForAutorouting = false; ///< true when subnode "AUTOROUTETARGET" is present
RELIEF_TYPE ReliefType = RELIEF_TYPE::CROSS; ///< See RELIEF_TYPE
COPPER_FILL_TYPEYPE FillType = COPPER_FILL_TYPEYPE::FILLED; ///< Assume solid fill
COPPER_FILL_TYPE FillType = COPPER_FILL_TYPE::FILLED; ///< Assume solid fill
HATCHCODE_ID HatchCodeID = wxEmptyString; ///< Only for FillType = HATCHED
void Parse( XNODE* aNode );