Naming conventions and file order.
This commit is contained in:
parent
79f94c096e
commit
0dd65d9cd1
|
@ -447,21 +447,21 @@ void LIB_PART::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
|||
{
|
||||
for( LIB_ITEM& drawItem : m_drawings )
|
||||
{
|
||||
if( drawItem.m_Fill != FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( drawItem.m_fill != FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
continue;
|
||||
|
||||
// Do not draw items not attached to the current part
|
||||
if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
|
||||
if( aMulti && drawItem.m_unit && ( drawItem.m_unit != aMulti ) )
|
||||
continue;
|
||||
|
||||
if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
|
||||
if( aConvert && drawItem.m_convert && ( drawItem.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
if( drawItem.Type() == LIB_FIELD_T )
|
||||
continue;
|
||||
|
||||
// Now, draw only the background for items with
|
||||
// m_Fill == FILLED_WITH_BG_BODYCOLOR:
|
||||
// m_fill == FILLED_WITH_BG_BODYCOLOR:
|
||||
drawItem.Print( aSettings, aOffset, (void*) false, aOpts.transform );
|
||||
}
|
||||
}
|
||||
|
@ -469,10 +469,10 @@ void LIB_PART::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
|||
for( LIB_ITEM& drawItem : m_drawings )
|
||||
{
|
||||
// Do not draw items not attached to the current part
|
||||
if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
|
||||
if( aMulti && drawItem.m_unit && ( drawItem.m_unit != aMulti ) )
|
||||
continue;
|
||||
|
||||
if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
|
||||
if( aConvert && drawItem.m_convert && ( drawItem.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
if( drawItem.Type() == LIB_FIELD_T )
|
||||
|
@ -496,7 +496,7 @@ void LIB_PART::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
|||
}
|
||||
else
|
||||
{
|
||||
bool forceNoFill = drawItem.m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
bool forceNoFill = drawItem.m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
drawItem.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform );
|
||||
}
|
||||
}
|
||||
|
@ -520,13 +520,13 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint&
|
|||
if( item.Type() == LIB_FIELD_T )
|
||||
continue;
|
||||
|
||||
if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
|
||||
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
|
||||
continue;
|
||||
|
||||
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
|
||||
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
if( item.m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( item.m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
item.Plot( aPlotter, aOffset, fill, aTransform );
|
||||
}
|
||||
|
||||
|
@ -537,13 +537,13 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint&
|
|||
if( item.Type() == LIB_FIELD_T )
|
||||
continue;
|
||||
|
||||
if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
|
||||
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
|
||||
continue;
|
||||
|
||||
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
|
||||
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
item.Plot( aPlotter, aOffset, fill && ( item.m_Fill != FILL_TYPE::FILLED_WITH_BG_BODYCOLOR ),
|
||||
item.Plot( aPlotter, aOffset, fill && ( item.m_fill != FILL_TYPE::FILLED_WITH_BG_BODYCOLOR ),
|
||||
aTransform );
|
||||
}
|
||||
}
|
||||
|
@ -562,10 +562,10 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
|||
if( item.Type() != LIB_FIELD_T )
|
||||
continue;
|
||||
|
||||
if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
|
||||
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
|
||||
continue;
|
||||
|
||||
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
|
||||
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
LIB_FIELD& field = (LIB_FIELD&) item;
|
||||
|
@ -655,17 +655,17 @@ void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert )
|
|||
/* Notes:
|
||||
* when aUnit == 0: no unit filtering
|
||||
* when aConvert == 0: no convert (shape selection) filtering
|
||||
* when .m_Unit == 0, the body item is common to units
|
||||
* when .m_Convert == 0, the body item is common to shapes
|
||||
* when m_unit == 0, the body item is common to units
|
||||
* when m_convert == 0, the body item is common to shapes
|
||||
*/
|
||||
for( LIB_ITEM& item : m_drawings[ LIB_PIN_T ] )
|
||||
{
|
||||
// Unit filtering:
|
||||
if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
|
||||
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
|
||||
continue;
|
||||
|
||||
// Shape filtering:
|
||||
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
|
||||
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
aList.push_back( (LIB_PIN*) &item );
|
||||
|
@ -765,11 +765,15 @@ const EDA_RECT LIB_PART::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
|||
|
||||
for( const LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
|
||||
&& ( aUnit != item.m_Unit ) ) )
|
||||
if( item.m_unit > 0
|
||||
&& m_unitCount > 1
|
||||
&& aUnit > 0
|
||||
&& aUnit != item.m_unit )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
|
||||
if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
|
||||
continue;
|
||||
|
||||
if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
|
||||
|
@ -806,11 +810,15 @@ const EDA_RECT LIB_PART::GetBodyBoundingBox( int aUnit, int aConvert ) const
|
|||
|
||||
for( const LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
|
||||
&& ( aUnit != item.m_Unit ) ) )
|
||||
if( item.m_unit > 0
|
||||
&& m_unitCount > 1
|
||||
&& aUnit > 0
|
||||
&& aUnit != item.m_unit )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
|
||||
if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
|
||||
continue;
|
||||
|
||||
if( item.Type() == LIB_FIELD_T )
|
||||
|
@ -971,7 +979,7 @@ bool LIB_PART::HasConversion() const
|
|||
{
|
||||
for( const LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( item.m_Convert > LIB_ITEM::LIB_CONVERT::BASE )
|
||||
if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -979,7 +987,7 @@ bool LIB_PART::HasConversion() const
|
|||
{
|
||||
for( const LIB_ITEM& item : parent->GetDrawItems() )
|
||||
{
|
||||
if( item.m_Convert > LIB_ITEM::LIB_CONVERT::BASE )
|
||||
if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1007,10 +1015,12 @@ LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
|
|||
{
|
||||
for( LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( ( aUnit && item.m_Unit && ( aUnit != item.m_Unit) )
|
||||
|| ( aConvert && item.m_Convert && ( aConvert != item.m_Convert ) )
|
||||
|| ( ( item.Type() != aType ) && ( aType != TYPE_NOT_INIT ) ) )
|
||||
if( ( aUnit && item.m_unit && aUnit != item.m_unit )
|
||||
|| ( aConvert && item.m_convert && aConvert != item.m_convert )
|
||||
|| ( item.Type() != aType && aType != TYPE_NOT_INIT ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( item.HitTest( aPoint ) )
|
||||
return &item;
|
||||
|
@ -1068,7 +1078,7 @@ void LIB_PART::SetUnitCount( int aCount, bool aDuplicateDrawItems )
|
|||
|
||||
while( i != m_drawings.end() )
|
||||
{
|
||||
if( i->m_Unit > aCount )
|
||||
if( i->m_unit > aCount )
|
||||
i = m_drawings.erase( i );
|
||||
else
|
||||
++i;
|
||||
|
@ -1085,13 +1095,13 @@ void LIB_PART::SetUnitCount( int aCount, bool aDuplicateDrawItems )
|
|||
|
||||
for( LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( item.m_Unit != 1 )
|
||||
if( item.m_unit != 1 )
|
||||
continue;
|
||||
|
||||
for( int j = prevCount + 1; j <= aCount; j++ )
|
||||
{
|
||||
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
|
||||
newItem->m_Unit = j;
|
||||
newItem->m_unit = j;
|
||||
tmp.push_back( newItem );
|
||||
}
|
||||
}
|
||||
|
@ -1131,10 +1141,10 @@ void LIB_PART::SetConversion( bool aSetConvert, bool aDuplicatePins )
|
|||
if( item.Type() != LIB_PIN_T )
|
||||
continue;
|
||||
|
||||
if( item.m_Convert == 1 )
|
||||
if( item.m_convert == 1 )
|
||||
{
|
||||
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
|
||||
newItem->m_Convert = 2;
|
||||
newItem->m_convert = 2;
|
||||
tmp.push_back( newItem );
|
||||
}
|
||||
}
|
||||
|
@ -1152,7 +1162,7 @@ void LIB_PART::SetConversion( bool aSetConvert, bool aDuplicatePins )
|
|||
|
||||
while( i != m_drawings.end() )
|
||||
{
|
||||
if( i->m_Convert > 1 )
|
||||
if( i->m_convert > 1 )
|
||||
i = m_drawings.erase( i );
|
||||
else
|
||||
++i;
|
||||
|
|
|
@ -255,12 +255,12 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent )
|
|||
|
||||
aComponent->SetConvert( aComponent->GetConvert() + 1 );
|
||||
|
||||
// ensure m_Convert = 1 or 2
|
||||
// ensure m_convert = 1 or 2
|
||||
// 1 = shape 1 = not converted
|
||||
// 2 = shape 2 = first converted shape
|
||||
// > 2 is not used but could be used for more shapes
|
||||
// like multiple shapes for a programmable component
|
||||
// When m_Convert = val max, return to the first shape
|
||||
// When m_convert = val max, return to the first shape
|
||||
if( aComponent->GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN )
|
||||
aComponent->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ LIB_ARC::LIB_ARC( LIB_PART* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
|
|||
m_t1 = 0;
|
||||
m_t2 = 0;
|
||||
m_Width = 0;
|
||||
m_Fill = FILL_TYPE::NO_FILL;
|
||||
m_fill = FILL_TYPE::NO_FILL;
|
||||
m_isFillable = true;
|
||||
m_editState = 0;
|
||||
}
|
||||
|
@ -261,13 +261,13 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
|
||||
aTransform.MapAngles( &t1, &t2 );
|
||||
|
||||
if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( aFill && m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
{
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||
aPlotter->Arc( pos, -t2, -t1, m_Radius, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||
}
|
||||
|
||||
bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
bool already_filled = m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
int pen_size = GetPenWidth();
|
||||
|
||||
if( !already_filled || pen_size > 0 )
|
||||
|
@ -275,8 +275,8 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
aPlotter->Arc(
|
||||
pos, -t2, -t1, m_Radius, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
|
||||
aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? FILL_TYPE::NO_FILL : m_fill,
|
||||
pen_size );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ void LIB_ARC::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
|
|||
bool forceNoFill = static_cast<bool>( aData );
|
||||
int penWidth = GetPenWidth();
|
||||
|
||||
if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
if( forceNoFill && m_fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
|
@ -317,7 +317,7 @@ void LIB_ARC::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
|
|||
std::swap( pos1.y, pos2.y );
|
||||
}
|
||||
|
||||
if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
|
||||
if( forceNoFill || m_fill == FILL_TYPE::NO_FILL )
|
||||
{
|
||||
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
|
||||
|
||||
|
@ -325,7 +325,7 @@ void LIB_ARC::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
|
|||
}
|
||||
else
|
||||
{
|
||||
if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
|
||||
GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, penWidth, color, color );
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
|
||||
LIB_ITEM( LIB_BEZIER_T, aParent )
|
||||
{
|
||||
m_Fill = FILL_TYPE::NO_FILL;
|
||||
m_fill = FILL_TYPE::NO_FILL;
|
||||
m_Width = 0;
|
||||
m_isFillable = true;
|
||||
}
|
||||
|
@ -173,13 +173,13 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
cornerList.push_back( pos );
|
||||
}
|
||||
|
||||
if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( aFill && m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
{
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||
aPlotter->PlotPoly( cornerList, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||
}
|
||||
|
||||
bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
bool already_filled = m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
int pen_size = GetPenWidth();
|
||||
|
||||
if( !already_filled || pen_size > 0 )
|
||||
|
@ -187,7 +187,7 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
aPlotter->PlotPoly( cornerList, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
|
||||
aPlotter->PlotPoly( cornerList, already_filled ? FILL_TYPE::NO_FILL : m_fill, pen_size );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ void LIB_BEZIER::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
bool forceNoFill = static_cast<bool>( aData );
|
||||
int penWidth = GetPenWidth();
|
||||
|
||||
if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
if( forceNoFill && m_fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
return;
|
||||
|
||||
std::vector<wxPoint> PolyPointsTraslated;
|
||||
|
@ -223,7 +223,7 @@ void LIB_BEZIER::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
for( wxPoint& point : m_PolyPoints )
|
||||
PolyPointsTraslated.push_back( aTransform.TransformCoordinate( point ) + aOffset );
|
||||
|
||||
if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
|
||||
if( forceNoFill || m_fill == FILL_TYPE::NO_FILL )
|
||||
{
|
||||
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
|
||||
|
||||
|
@ -232,7 +232,7 @@ void LIB_BEZIER::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
}
|
||||
else
|
||||
{
|
||||
if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
|
||||
GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, penWidth,
|
||||
|
|
|
@ -40,7 +40,7 @@ LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
|
|||
LIB_ITEM( LIB_CIRCLE_T, aParent )
|
||||
{
|
||||
m_Width = 0;
|
||||
m_Fill = FILL_TYPE::NO_FILL;
|
||||
m_fill = FILL_TYPE::NO_FILL;
|
||||
m_isFillable = true;
|
||||
}
|
||||
|
||||
|
@ -164,13 +164,13 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
{
|
||||
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||
|
||||
if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( aFill && m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
{
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||
aPlotter->Circle( pos, GetRadius() * 2, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||
}
|
||||
|
||||
bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
bool already_filled = m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
int pen_size = GetPenWidth();
|
||||
|
||||
if( !already_filled || pen_size > 0 )
|
||||
|
@ -178,8 +178,8 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
aPlotter->Circle(
|
||||
pos, GetRadius() * 2, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
|
||||
aPlotter->Circle( pos, GetRadius() * 2, already_filled ? FILL_TYPE::NO_FILL : m_fill,
|
||||
pen_size );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,14 +200,14 @@ void LIB_CIRCLE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
bool forceNoFill = static_cast<bool>( aData );
|
||||
int penWidth = GetPenWidth();
|
||||
|
||||
if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
if( forceNoFill && m_fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||
|
||||
if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
|
||||
if( forceNoFill || m_fill == FILL_TYPE::NO_FILL )
|
||||
{
|
||||
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
|
||||
|
||||
|
@ -215,7 +215,7 @@ void LIB_CIRCLE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
}
|
||||
else
|
||||
{
|
||||
if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
|
||||
GRFilledCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), 0, color, color );
|
||||
|
|
|
@ -36,12 +36,12 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType,
|
|||
LIB_PART* aComponent,
|
||||
int aUnit,
|
||||
int aConvert,
|
||||
FILL_TYPE aFillType ) :
|
||||
FILL_TYPE aFillType ) :
|
||||
EDA_ITEM( aType )
|
||||
{
|
||||
m_Unit = aUnit;
|
||||
m_Convert = aConvert;
|
||||
m_Fill = aFillType;
|
||||
m_unit = aUnit;
|
||||
m_convert = aConvert;
|
||||
m_fill = aFillType;
|
||||
m_parent = (EDA_ITEM*) aComponent;
|
||||
m_isFillable = false;
|
||||
}
|
||||
|
@ -53,16 +53,16 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
|||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), GetTypeName() ) );
|
||||
|
||||
if( m_Unit == 0 )
|
||||
if( m_unit == 0 )
|
||||
msg = _( "All" );
|
||||
else
|
||||
msg.Printf( wxT( "%d" ), m_Unit );
|
||||
msg.Printf( wxT( "%d" ), m_unit );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg ) );
|
||||
|
||||
if( m_Convert == LIB_ITEM::LIB_CONVERT::BASE )
|
||||
if( m_convert == LIB_ITEM::LIB_CONVERT::BASE )
|
||||
msg = _( "no" );
|
||||
else if( m_Convert == LIB_ITEM::LIB_CONVERT::DEMORGAN )
|
||||
else if( m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN )
|
||||
msg = _( "yes" );
|
||||
else
|
||||
msg = wxT( "?" );
|
||||
|
@ -77,14 +77,14 @@ int LIB_ITEM::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareF
|
|||
return Type() - aOther.Type();
|
||||
|
||||
// When comparing unit LIB_ITEM objects, we ignore the unit number.
|
||||
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_Unit != aOther.m_Unit )
|
||||
return m_Unit - aOther.m_Unit;
|
||||
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_unit != aOther.m_unit )
|
||||
return m_unit - aOther.m_unit;
|
||||
|
||||
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_Convert != aOther.m_Convert )
|
||||
return m_Convert - m_Convert;
|
||||
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_convert != aOther.m_convert )
|
||||
return m_convert - m_convert;
|
||||
|
||||
if( m_Fill != aOther.m_Fill )
|
||||
return static_cast<int>( m_Fill ) - static_cast<int>( aOther.m_Fill );
|
||||
if( m_fill != aOther.m_fill )
|
||||
return static_cast<int>( m_fill ) - static_cast<int>( aOther.m_fill );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -98,12 +98,12 @@ bool LIB_ITEM::operator==( const LIB_ITEM& aOther ) const
|
|||
|
||||
bool LIB_ITEM::operator<( const LIB_ITEM& aOther ) const
|
||||
{
|
||||
int result = m_Convert - aOther.m_Convert;
|
||||
int result = m_convert - aOther.m_convert;
|
||||
|
||||
if( result != 0 )
|
||||
return result < 0;
|
||||
|
||||
result = m_Unit - aOther.m_Unit;
|
||||
result = m_unit - aOther.m_unit;
|
||||
|
||||
if( result != 0 )
|
||||
return result < 0;
|
||||
|
|
|
@ -61,41 +61,9 @@ typedef std::vector< LIB_PIN* > LIB_PINS;
|
|||
*/
|
||||
class LIB_ITEM : public EDA_ITEM
|
||||
{
|
||||
/**
|
||||
* Print the item to \a aDC.
|
||||
*
|
||||
* @param aOffset A reference to a wxPoint object containing the offset where to draw
|
||||
* from the object's current position.
|
||||
* @param aData A pointer to any object specific data required to perform the draw.
|
||||
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
|
||||
*/
|
||||
virtual void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||
const TRANSFORM& aTransform ) = 0;
|
||||
|
||||
friend class LIB_PART;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Unit identification for multiple parts per package. Set to 0 if the item is common
|
||||
* to all units.
|
||||
*/
|
||||
int m_Unit;
|
||||
|
||||
/**
|
||||
* Shape identification for alternate body styles. Set 0 if the item is common to all
|
||||
* body styles. This is typially used for representing DeMorgan variants in KiCad.
|
||||
*/
|
||||
int m_Convert;
|
||||
|
||||
/**
|
||||
* The body fill type. This has meaning only for some items. For a list of fill types
|
||||
* see #FILL_TYPE.
|
||||
*/
|
||||
FILL_TYPE m_Fill;
|
||||
bool m_isFillable;
|
||||
|
||||
public:
|
||||
|
||||
LIB_ITEM( KICAD_T aType, LIB_PART* aComponent = NULL, int aUnit = 0, int aConvert = 0,
|
||||
FILL_TYPE aFillType = FILL_TYPE::NO_FILL );
|
||||
|
||||
|
@ -103,7 +71,6 @@ public:
|
|||
|
||||
virtual ~LIB_ITEM() { }
|
||||
|
||||
|
||||
// Define the enums for basic
|
||||
enum LIB_CONVERT : int { BASE = 1, DEMORGAN = 2 };
|
||||
|
||||
|
@ -163,7 +130,6 @@ public:
|
|||
*/
|
||||
virtual void CalcEdit( const wxPoint& aPosition ) {}
|
||||
|
||||
|
||||
/**
|
||||
* Draw an item
|
||||
*
|
||||
|
@ -292,21 +258,20 @@ public:
|
|||
*/
|
||||
bool IsFillable() const { return m_isFillable; }
|
||||
|
||||
void SetUnit( int aUnit ) { m_Unit = aUnit; }
|
||||
int GetUnit() const { return m_Unit; }
|
||||
void SetUnit( int aUnit ) { m_unit = aUnit; }
|
||||
int GetUnit() const { return m_unit; }
|
||||
|
||||
void SetConvert( int aConvert ) { m_Convert = aConvert; }
|
||||
int GetConvert() const { return m_Convert; }
|
||||
void SetConvert( int aConvert ) { m_convert = aConvert; }
|
||||
int GetConvert() const { return m_convert; }
|
||||
|
||||
void SetFillMode( FILL_TYPE aFillMode ) { m_Fill = aFillMode; }
|
||||
FILL_TYPE GetFillMode() const { return m_Fill; }
|
||||
void SetFillMode( FILL_TYPE aFillMode ) { m_fill = aFillMode; }
|
||||
FILL_TYPE GetFillMode() const { return m_fill; }
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Provide the draw object specific comparison called by the == and < operators.
|
||||
*
|
||||
|
@ -329,6 +294,37 @@ protected:
|
|||
*/
|
||||
virtual int compare( const LIB_ITEM& aOther,
|
||||
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const;
|
||||
|
||||
/**
|
||||
* Print the item to \a aDC.
|
||||
*
|
||||
* @param aOffset A reference to a wxPoint object containing the offset where to draw
|
||||
* from the object's current position.
|
||||
* @param aData A pointer to any object specific data required to perform the draw.
|
||||
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
|
||||
*/
|
||||
virtual void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||
const TRANSFORM& aTransform ) = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Unit identification for multiple parts per package. Set to 0 if the item is common
|
||||
* to all units.
|
||||
*/
|
||||
int m_unit;
|
||||
|
||||
/**
|
||||
* Shape identification for alternate body styles. Set 0 if the item is common to all
|
||||
* body styles. This is typially used for representing DeMorgan variants in KiCad.
|
||||
*/
|
||||
int m_convert;
|
||||
|
||||
/**
|
||||
* The body fill type. This has meaning only for some items. For a list of fill types
|
||||
* see #FILL_TYPE.
|
||||
*/
|
||||
FILL_TYPE m_fill;
|
||||
bool m_isFillable;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
|
||||
LIB_ITEM( LIB_POLYLINE_T, aParent )
|
||||
{
|
||||
m_Fill = FILL_TYPE::NO_FILL;
|
||||
m_fill = FILL_TYPE::NO_FILL;
|
||||
m_Width = 0;
|
||||
m_isFillable = true;
|
||||
}
|
||||
|
@ -132,13 +132,13 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
cornerList.push_back( pos );
|
||||
}
|
||||
|
||||
if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( aFill && m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
{
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||
aPlotter->PlotPoly( cornerList, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||
}
|
||||
|
||||
bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
bool already_filled = m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
int pen_size = GetPenWidth();
|
||||
|
||||
if( !already_filled || pen_size > 0 )
|
||||
|
@ -146,7 +146,7 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
aPlotter->PlotPoly( cornerList, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
|
||||
aPlotter->PlotPoly( cornerList, already_filled ? FILL_TYPE::NO_FILL : m_fill, pen_size );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ void LIB_POLYLINE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffs
|
|||
bool forceNoFill = static_cast<bool>( aData );
|
||||
int penWidth = GetPenWidth();
|
||||
|
||||
if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
if( forceNoFill && m_fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
|
@ -209,7 +209,7 @@ void LIB_POLYLINE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffs
|
|||
for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
|
||||
buffer[ii] = aTransform.TransformCoordinate( m_PolyPoints[ii] ) + aOffset;
|
||||
|
||||
if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
|
||||
if( forceNoFill || m_fill == FILL_TYPE::NO_FILL )
|
||||
{
|
||||
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
|
||||
|
||||
|
@ -217,7 +217,7 @@ void LIB_POLYLINE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffs
|
|||
}
|
||||
else
|
||||
{
|
||||
if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
|
||||
GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, true, penWidth, color, color );
|
||||
|
@ -235,7 +235,7 @@ bool LIB_POLYLINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
for( wxPoint pt : m_PolyPoints )
|
||||
shape.Append( DefaultTransform.TransformCoordinate( pt ) );
|
||||
|
||||
if( m_Fill != FILL_TYPE::NO_FILL && m_PolyPoints.size() > 2 )
|
||||
if( m_fill != FILL_TYPE::NO_FILL && m_PolyPoints.size() > 2 )
|
||||
{
|
||||
shape.SetClosed( true );
|
||||
return shape.PointInside( aPosition, delta );
|
||||
|
@ -266,7 +266,7 @@ bool LIB_POLYLINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccurac
|
|||
sel.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||
|
||||
// Only test closing segment if the polyline is filled
|
||||
int count = m_Fill == FILL_TYPE::NO_FILL ? m_PolyPoints.size() - 1 : m_PolyPoints.size();
|
||||
int count = m_fill == FILL_TYPE::NO_FILL ? m_PolyPoints.size() - 1 : m_PolyPoints.size();
|
||||
|
||||
for( int ii = 0; ii < count; ii++ )
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) : LIB_ITEM( LIB_RECTANGLE_T, aParent )
|
||||
{
|
||||
m_Width = 0;
|
||||
m_Fill = FILL_TYPE::NO_FILL;
|
||||
m_fill = FILL_TYPE::NO_FILL;
|
||||
m_isFillable = true;
|
||||
}
|
||||
|
||||
|
@ -129,13 +129,13 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||
wxPoint end = aTransform.TransformCoordinate( m_End ) + aOffset;
|
||||
|
||||
if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( aFill && m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
{
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||
aPlotter->Rect( pos, end, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||
}
|
||||
|
||||
bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
bool already_filled = m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
|
||||
int pen_size = GetPenWidth();
|
||||
|
||||
if( !already_filled || pen_size > 0 )
|
||||
|
@ -143,7 +143,7 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
aPlotter->Rect( pos, end, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
|
||||
aPlotter->Rect( pos, end, already_filled ? FILL_TYPE::NO_FILL : m_fill, pen_size );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ void LIB_RECTANGLE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOff
|
|||
bool forceNoFill = static_cast<bool>( aData );
|
||||
int penWidth = GetPenWidth();
|
||||
|
||||
if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
if( forceNoFill && m_fill != FILL_TYPE::NO_FILL && penWidth == 0 )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
|
@ -172,14 +172,14 @@ void LIB_RECTANGLE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOff
|
|||
wxPoint pt1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||
wxPoint pt2 = aTransform.TransformCoordinate( m_End ) + aOffset;
|
||||
|
||||
if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
|
||||
if( forceNoFill || m_fill == FILL_TYPE::NO_FILL )
|
||||
{
|
||||
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
|
||||
GRRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
|
||||
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
|
||||
GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color, color );
|
||||
|
|
|
@ -78,8 +78,8 @@ EDA_ITEM* LIB_TEXT::Clone() const
|
|||
{
|
||||
LIB_TEXT* newitem = new LIB_TEXT( nullptr );
|
||||
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_unit = m_unit;
|
||||
newitem->m_convert = m_convert;
|
||||
newitem->m_flags = m_flags;
|
||||
|
||||
newitem->SetText( GetText() );
|
||||
|
|
Loading…
Reference in New Issue