Properties meta-data for pcbnew classes

This commit is contained in:
Maciej Suminski 2020-02-02 19:40:14 +01:00 committed by Tomasz Wlostowski
parent cbd5004fd4
commit a289056a9e
18 changed files with 487 additions and 3 deletions

View File

@ -735,3 +735,77 @@ const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngl
return bbox;
}
static struct EDA_ITEM_DESC
{
EDA_ITEM_DESC()
{
ENUM_MAP<KICAD_T>::Instance()
.Map( NOT_USED, _( "<not used>" ) )
//.Map( EOT, _( "<EOT>" ) )
.Map( TYPE_NOT_INIT, _( "<type not init>" ) ) // == EOT
.Map( SCREEN_T, _( "Screen" ) )
.Map( PCB_MODULE_T, _( "Footprint" ) )
.Map( PCB_PAD_T, _( "Pad" ) )
.Map( PCB_LINE_T, _( "Line" ) )
.Map( PCB_TEXT_T, _( "Board Text" ) )
.Map( PCB_MODULE_TEXT_T, _( "Footprint Text" ) )
.Map( PCB_MODULE_EDGE_T, _( "Footprint Graphics" ) )
.Map( PCB_TRACE_T, _( "Track" ) )
.Map( PCB_VIA_T, _( "Via" ) )
.Map( PCB_MARKER_T, _( "Board Marker" ) )
.Map( PCB_DIMENSION_T, _( "Dimension" ) )
.Map( PCB_TARGET_T, _( "Target" ) )
.Map( PCB_ZONE_AREA_T, _( "Zone" ) )
.Map( PCB_ITEM_LIST_T, _( "Item List" ) )
.Map( PCB_NETINFO_T, _( "Net Info" ) )
.Map( SCH_MARKER_T, _( "Schematic Marker" ) )
.Map( SCH_JUNCTION_T, _( "Junction" ) )
.Map( SCH_NO_CONNECT_T, _( "No-Connect Flag" ) )
.Map( SCH_BUS_WIRE_ENTRY_T, _( "Wire Entry" ) )
.Map( SCH_BUS_BUS_ENTRY_T, _( "Bus Entry" ) )
.Map( SCH_LINE_T, _( "Graphic Line" ) )
.Map( SCH_BITMAP_T, _( "Bitmap" ) )
.Map( SCH_TEXT_T, _( "Schematic Text" ) )
.Map( SCH_LABEL_T, _( "Net Label" ) )
.Map( SCH_GLOBAL_LABEL_T, _( "Global Label" ) )
.Map( SCH_HIER_LABEL_T, _( "Hierarchical Label" ) )
.Map( SCH_FIELD_T, _( "Schematic Field" ) )
.Map( SCH_COMPONENT_T, _( "Component" ) )
.Map( SCH_SHEET_PIN_T, _( "Sheet Pin" ) )
.Map( SCH_SHEET_T, _( "Sheet" ) )
.Map( SCH_FIELD_LOCATE_REFERENCE_T, _( "Field Locate Reference" ) )
.Map( SCH_FIELD_LOCATE_VALUE_T, _( "Field Locate Value" ) )
.Map( SCH_FIELD_LOCATE_FOOTPRINT_T, _( "Field Locate Footprint" ) )
.Map( SCH_SCREEN_T, _( "SCH Screen" ) )
.Map( LIB_PART_T, _( "Symbol" ) )
.Map( LIB_ALIAS_T, _( "Alias" ) )
.Map( LIB_ARC_T, _( "Arc" ) )
.Map( LIB_CIRCLE_T, _( "Circle" ) )
.Map( LIB_TEXT_T, _( "Symbol Text" ) )
.Map( LIB_RECTANGLE_T, _( "Rectangle" ) )
.Map( LIB_POLYLINE_T, _( "Polyline" ) )
.Map( LIB_BEZIER_T, _( "Bezier" ) )
.Map( LIB_PIN_T, _( "Pin" ) )
.Map( LIB_FIELD_T, _( "Symbol Field" ) )
.Map( GERBER_LAYOUT_T, _( "Gerber Layout" ) )
.Map( GERBER_DRAW_ITEM_T, _( "Draw Item" ) )
.Map( GERBER_IMAGE_T, _( "Image" ) )
.Map( MAX_STRUCT_TYPE_ID, _( "<max struct type>" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDA_ITEM );
propMgr.AddProperty( new PROPERTY_ENUM<EDA_ITEM, KICAD_T>( "Type",
NO_SETTER( EDA_ITEM, KICAD_T ), &EDA_ITEM::Type ) );
}
} _EDA_ITEM_DESC;
ENUM_TO_WXANY( KICAD_T );

View File

@ -610,3 +610,45 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
&aCornerBuffer );
}
}
static struct EDA_TEXT_DESC
{
EDA_TEXT_DESC()
{
ENUM_MAP<EDA_TEXT_HJUSTIFY_T>::Instance()
.Map( GR_TEXT_HJUSTIFY_LEFT, _( "Left" ) )
.Map( GR_TEXT_HJUSTIFY_CENTER, _( "Center" ) )
.Map( GR_TEXT_HJUSTIFY_RIGHT, _( "Right" ) );
ENUM_MAP<EDA_TEXT_VJUSTIFY_T>::Instance()
.Map( GR_TEXT_VJUSTIFY_TOP, _( "Top" ) )
.Map( GR_TEXT_VJUSTIFY_CENTER, _( "Center" ) )
.Map( GR_TEXT_VJUSTIFY_BOTTOM, _( "Bottom" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDA_TEXT );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, wxString>( _( "Text" ),
&EDA_TEXT::SetText, &EDA_TEXT::GetText ) );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _( "Thickness" ),
&EDA_TEXT::SetThickness, &EDA_TEXT::GetThickness, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _( "Italic" ),
&EDA_TEXT::SetItalic, &EDA_TEXT::IsItalic ) );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _( "Bold" ),
&EDA_TEXT::SetBold, &EDA_TEXT::IsBold ) );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _( "Mirrored" ),
&EDA_TEXT::SetMirrored, &EDA_TEXT::IsMirrored ) );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _( "Visible" ),
&EDA_TEXT::SetVisible, &EDA_TEXT::IsVisible ) );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _( "Width" ),
&EDA_TEXT::SetTextWidth, &EDA_TEXT::GetTextWidth, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _( "Height" ),
&EDA_TEXT::SetTextHeight, &EDA_TEXT::GetTextHeight, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT, EDA_TEXT_HJUSTIFY_T>( _( "Horizontal Justification" ),
&EDA_TEXT::SetHorizJustify, &EDA_TEXT::GetHorizJustify ) );
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT, EDA_TEXT_VJUSTIFY_T>( _( "Vertical Justification" ),
&EDA_TEXT::SetVertJustify, &EDA_TEXT::GetVertJustify ) );
}
} _EDA_TEXT_DESC;
ENUM_TO_WXANY( EDA_TEXT_HJUSTIFY_T )
ENUM_TO_WXANY( EDA_TEXT_VJUSTIFY_T )

View File

@ -100,6 +100,18 @@ public:
virtual wxPoint GetPosition() const = 0;
int GetX() const
{
wxPoint p = GetPosition();
return p.x;
}
int GetY() const
{
wxPoint p = GetPosition();
return p.y;
}
/**
* Function GetCenter()
*
@ -112,6 +124,18 @@ public:
virtual void SetPosition( const wxPoint& aPos ) = 0;
void SetX( int aX )
{
wxPoint p( aX, GetY() );
SetPosition( p );
}
void SetY( int aY )
{
wxPoint p( GetX(), aY );
SetPosition( p );
}
/**
* Function IsConnected()
* Returns information if the object is derived from BOARD_CONNECTED_ITEM.
@ -329,4 +353,8 @@ protected:
static wxString LayerMaskDescribe( const BOARD* aBoard, LSET aMask );
};
#ifndef SWIG
DECLARE_ENUM_TO_WXANY( PCB_LAYER_ID );
#endif
#endif /* BOARD_ITEM_STRUCT_H */

View File

@ -33,6 +33,8 @@
#include <vector>
#include <bitset>
#include <math/box2.h>
#include <inspectable.h>
namespace KIGFX
{
@ -80,8 +82,7 @@ enum VIEW_VISIBILITY_FLAGS {
* VIEW_ITEM objects are never owned by a VIEW. A single VIEW_ITEM can belong to any number of
* static VIEWs, but only one dynamic VIEW due to storage of only one VIEW reference.
*/
class VIEW_ITEM
class VIEW_ITEM : public INSPECTABLE
{
public:
VIEW_ITEM() : m_viewPrivData( nullptr )

View File

@ -197,3 +197,15 @@ wxString BOARD_CONNECTED_ITEM::GetNetClassName() const
{
return m_netinfo->GetClassName();
}
static struct BOARD_CONNECTED_ITEM_DESC
{
BOARD_CONNECTED_ITEM_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( BOARD_CONNECTED_ITEM );
propMgr.InheritsAfter( TYPE_HASH( BOARD_CONNECTED_ITEM ), TYPE_HASH( BOARD_ITEM ) );
//propMgr.AddProperty( new PROPERTY<BOARD_CONNECTED_ITEM, NETINFO_ITEM*>( "Net", &BOARD_CONNECTED_ITEM::SetNet, &BOARD_CONNECTED_ITEM::GetNet ) );
}
} _BOARD_CONNECTED_ITEM_DESC;

View File

@ -134,11 +134,85 @@ void BOARD_ITEM::DeleteStructure()
void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
{
}
void BOARD_ITEM::TransformShapeWithClearanceToPolygon(
SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aError, bool ignoreLineWidth ) const
{
wxASSERT_MSG( false, "Called TransformShapeWithClearanceToPolygon() on unsupported BOARD_ITEM." );
};
static struct BOARD_ITEM_DESC
{
BOARD_ITEM_DESC()
{
ENUM_MAP<PCB_LAYER_ID>::Instance()
.Map( F_Cu, LSET::Name( F_Cu ) )
.Map( In1_Cu, LSET::Name( In1_Cu ) )
.Map( In2_Cu, LSET::Name( In2_Cu ) )
.Map( In3_Cu, LSET::Name( In3_Cu ) )
.Map( In4_Cu, LSET::Name( In4_Cu ) )
.Map( In5_Cu, LSET::Name( In5_Cu ) )
.Map( In6_Cu, LSET::Name( In6_Cu ) )
.Map( In7_Cu, LSET::Name( In7_Cu ) )
.Map( In8_Cu, LSET::Name( In8_Cu ) )
.Map( In9_Cu, LSET::Name( In9_Cu ) )
.Map( In10_Cu, LSET::Name( In10_Cu ) )
.Map( In11_Cu, LSET::Name( In11_Cu ) )
.Map( In12_Cu, LSET::Name( In12_Cu ) )
.Map( In13_Cu, LSET::Name( In13_Cu ) )
.Map( In14_Cu, LSET::Name( In14_Cu ) )
.Map( In15_Cu, LSET::Name( In15_Cu ) )
.Map( In16_Cu, LSET::Name( In16_Cu ) )
.Map( In17_Cu, LSET::Name( In17_Cu ) )
.Map( In18_Cu, LSET::Name( In18_Cu ) )
.Map( In19_Cu, LSET::Name( In19_Cu ) )
.Map( In20_Cu, LSET::Name( In20_Cu ) )
.Map( In21_Cu, LSET::Name( In21_Cu ) )
.Map( In22_Cu, LSET::Name( In22_Cu ) )
.Map( In23_Cu, LSET::Name( In23_Cu ) )
.Map( In24_Cu, LSET::Name( In24_Cu ) )
.Map( In25_Cu, LSET::Name( In25_Cu ) )
.Map( In26_Cu, LSET::Name( In26_Cu ) )
.Map( In27_Cu, LSET::Name( In27_Cu ) )
.Map( In28_Cu, LSET::Name( In28_Cu ) )
.Map( In29_Cu, LSET::Name( In29_Cu ) )
.Map( In30_Cu, LSET::Name( In30_Cu ) )
.Map( B_Cu, LSET::Name( B_Cu ) )
.Map( B_Adhes, LSET::Name( B_Adhes ) )
.Map( F_Adhes, LSET::Name( F_Adhes ) )
.Map( B_Paste, LSET::Name( B_Paste ) )
.Map( F_Paste, LSET::Name( F_Paste ) )
.Map( B_SilkS, LSET::Name( B_SilkS ) )
.Map( F_SilkS, LSET::Name( F_SilkS ) )
.Map( B_Mask, LSET::Name( B_Mask ) )
.Map( F_Mask, LSET::Name( F_Mask ) )
.Map( Dwgs_User, LSET::Name( Dwgs_User ) )
.Map( Cmts_User, LSET::Name( Cmts_User ) )
.Map( Eco1_User, LSET::Name( Eco1_User ) )
.Map( Eco2_User, LSET::Name( Eco2_User ) )
.Map( Edge_Cuts, LSET::Name( Edge_Cuts ) )
.Map( Margin, LSET::Name( Margin ) )
.Map( B_CrtYd, LSET::Name( B_CrtYd ) )
.Map( F_CrtYd, LSET::Name( F_CrtYd ) )
.Map( B_Fab, LSET::Name( B_Fab ) )
.Map( F_Fab, LSET::Name( F_Fab ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( BOARD_ITEM );
propMgr.InheritsAfter( TYPE_HASH( BOARD_ITEM ), TYPE_HASH( EDA_ITEM ) );
propMgr.AddProperty( new PROPERTY<BOARD_ITEM, int>( _( "Position X" ),
&BOARD_ITEM::SetX, &BOARD_ITEM::GetX, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<BOARD_ITEM, int>( _( "Position Y" ),
&BOARD_ITEM::SetY, &BOARD_ITEM::GetY, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY_ENUM<BOARD_ITEM, PCB_LAYER_ID>( _( "Layer" ),
&BOARD_ITEM::SetLayer, &BOARD_ITEM::GetLayer ) );
propMgr.AddProperty( new PROPERTY<BOARD_ITEM, bool>( _( "Locked" ),
&BOARD_ITEM::SetLocked, &BOARD_ITEM::IsLocked ) );
}
} _BOARD_ITEM_DESC;
IMPLEMENT_ENUM_TO_WXANY( PCB_LAYER_ID )

View File

@ -483,9 +483,23 @@ EDA_ITEM* DIMENSION::Clone() const
return new DIMENSION( *this );
}
void DIMENSION::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_DIMENSION_T );
std::swap( *((DIMENSION*) this), *((DIMENSION*) aImage) );
}
static struct DIMENSION_DESC
{
DIMENSION_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( DIMENSION );
propMgr.InheritsAfter( TYPE_HASH( DIMENSION ), TYPE_HASH( BOARD_ITEM ) );
//propMgr.AddProperty( new PROPERTY<DIMENSION, int>( "Height",
//&DIMENSION::SetHeight, &DIMENSION::GetHeight, PROPERTY_DISPLAY::DISTANCE ) );
}
} _DIMENSION_DESC;

View File

@ -1176,3 +1176,26 @@ void DRAWSEGMENT::SwapData( BOARD_ITEM* aImage )
std::swap( m_BezierPoints, image->m_BezierPoints );
std::swap( m_Poly, image->m_Poly );
}
static struct DRAWSEGMENT_DESC
{
DRAWSEGMENT_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( DRAWSEGMENT );
propMgr.InheritsAfter( TYPE_HASH( DRAWSEGMENT ), TYPE_HASH( BOARD_ITEM ) );
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, int>( _( "Thickness" ),
&DRAWSEGMENT::SetWidth, &DRAWSEGMENT::GetWidth, PROPERTY_DISPLAY::DISTANCE ) );
// TODO show certain properties depending on the shape
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, double>( _( "Angle" ),
&DRAWSEGMENT::SetAngle, &DRAWSEGMENT::GetAngle, PROPERTY_DISPLAY::DECIDEGREE ) );
// TODO or may have different names (arcs)
// TODO type?
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, int>( _( "End X" ),
&DRAWSEGMENT::SetEndX, &DRAWSEGMENT::GetEndX, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, int>( _( "End Y" ),
&DRAWSEGMENT::SetEndY, &DRAWSEGMENT::GetEndY, PROPERTY_DISPLAY::DISTANCE ) );
}
} _DRAWSEGMENT_DESC;

View File

@ -129,6 +129,8 @@ public:
* returns the starting point of the graphic
*/
const wxPoint& GetStart() const { return m_Start; }
int GetStartY() { return m_Start.y; }
int GetStartX() { return m_Start.x; }
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
void SetStartY( int y ) { m_Start.y = y; }
void SetStartX( int x ) { m_Start.x = x; }
@ -138,6 +140,8 @@ public:
* returns the ending point of the graphic
*/
const wxPoint& GetEnd() const { return m_End; }
int GetEndY() { return m_End.y; }
int GetEndX() { return m_End.x; }
void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; }
void SetEndY( int y ) { m_End.y = y; }
void SetEndX( int x ) { m_End.x = x; }

View File

@ -291,6 +291,7 @@ void EDGE_MODULE::Move( const wxPoint& aMoveVector )
SetDrawCoord();
}
unsigned int EDGE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
const int HIDE = std::numeric_limits<unsigned int>::max();
@ -308,3 +309,14 @@ unsigned int EDGE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
// Other layers are shown without any conditions
return 0;
}
static struct EDGE_MODULE_DESC
{
EDGE_MODULE_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDGE_MODULE );
propMgr.InheritsAfter( TYPE_HASH( EDGE_MODULE ), TYPE_HASH( DRAWSEGMENT ) );
}
} _EDGE_MODULE_DESC;

View File

@ -1514,3 +1514,35 @@ bool MODULE::HasNonSMDPins() const
return false;
}
static struct MODULE_DESC
{
MODULE_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( MODULE );
propMgr.AddTypeCast( new TYPE_CAST<MODULE, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<MODULE, BOARD_ITEM_CONTAINER> );
propMgr.InheritsAfter( TYPE_HASH( MODULE ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( MODULE ), TYPE_HASH( BOARD_ITEM_CONTAINER ) );
propMgr.AddProperty( new PROPERTY<MODULE, wxString>( _( "Reference" ),
&MODULE::SetReference, &MODULE::GetReference ) );
propMgr.AddProperty( new PROPERTY<MODULE, wxString>( _( "Value" ),
&MODULE::SetValue, &MODULE::GetValue ) );
propMgr.AddProperty( new PROPERTY<MODULE, double>( _( "Orientation" ),
&MODULE::SetOrientationDegrees, &MODULE::GetOrientationDegrees, PROPERTY_DISPLAY::DEGREE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Local Clearance" ),
&MODULE::SetLocalClearance, &MODULE::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Local Solderpaste Margin" ),
&MODULE::SetLocalSolderPasteMargin, &MODULE::GetLocalSolderPasteMargin, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, double>( _( "Local Solderpaste Margin Ratio" ),
&MODULE::SetLocalSolderPasteMarginRatio, &MODULE::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Thermal Width" ),
&MODULE::SetThermalWidth, &MODULE::GetThermalWidth, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Thermal Gap" ),
&MODULE::SetThermalGap, &MODULE::GetThermalGap, PROPERTY_DISPLAY::DISTANCE ) );
// TODO zone connection, FPID?
}
} _MODULE_DESC;

View File

@ -1187,3 +1187,51 @@ void D_PAD::SwapData( BOARD_ITEM* aImage )
std::swap( *((MODULE*) this), *((MODULE*) aImage) );
}
static struct PAD_DESC
{
PAD_DESC()
{
ENUM_MAP<PAD_SHAPE_T>::Instance()
.Map( PAD_SHAPE_RECT, _( "Rectangle" ) )
.Map( PAD_SHAPE_OVAL, _( "Oval" ) )
.Map( PAD_SHAPE_TRAPEZOID, _( "Trapezoid" ) )
.Map( PAD_SHAPE_ROUNDRECT, _( "Rounded Rectangular" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( D_PAD );
propMgr.InheritsAfter( TYPE_HASH( D_PAD ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
auto shape = new PROPERTY_ENUM<D_PAD, PAD_SHAPE_T>( _( "Shape" ), &D_PAD::SetShape, &D_PAD::GetShape );
propMgr.AddProperty( shape );
propMgr.AddProperty( new PROPERTY<D_PAD, wxString>( _( "Name" ), &D_PAD::SetName, &D_PAD::GetName ) );
propMgr.AddProperty( new PROPERTY<D_PAD, double>( _( "Orientation" ),
&D_PAD::SetOrientationDegrees, &D_PAD::GetOrientationDegrees, PROPERTY_DISPLAY::DEGREE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Pad To Die Length" ),
&D_PAD::SetPadToDieLength, &D_PAD::GetPadToDieLength, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Local Soldermask Margin" ),
&D_PAD::SetLocalSolderMaskMargin, &D_PAD::GetLocalSolderMaskMargin, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Local Solderpaste Margin" ),
&D_PAD::SetLocalSolderPasteMargin, &D_PAD::GetLocalSolderPasteMargin, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, double>( _( "Local Solderpaste Margin Ratio" ),
&D_PAD::SetLocalSolderPasteMarginRatio, &D_PAD::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Width" ),
&D_PAD::SetThermalWidth, &D_PAD::GetThermalWidth, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Gap" ),
&D_PAD::SetThermalGap, &D_PAD::GetThermalGap, PROPERTY_DISPLAY::DISTANCE ) );
auto roundRadiusRatio = new PROPERTY<D_PAD, double>( _( "Round Radius Ratio" ),
&D_PAD::SetRoundRectRadiusRatio, &D_PAD::GetRoundRectRadiusRatio );
roundRadiusRatio->SetAvailableFunc( [=](INSPECTABLE* aItem)->bool
{ return aItem->Get( shape ) == PAD_SHAPE_ROUNDRECT; } );
propMgr.AddProperty( roundRadiusRatio );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Local Clearance" ),
&D_PAD::SetLocalClearance, &D_PAD::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) );
// TODO delta, size, drill size, dirill shape offset, layerset, zone connection
}
} _PAD_DESC;
ENUM_TO_WXANY( PAD_SHAPE_T );

View File

@ -142,3 +142,23 @@ void PCB_TARGET::SwapData( BOARD_ITEM* aImage )
std::swap( *((PCB_TARGET*) this), *((PCB_TARGET*) aImage) );
}
static struct PCB_TARGET_DESC
{
PCB_TARGET_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_TARGET );
propMgr.InheritsAfter( TYPE_HASH( PCB_TARGET ), TYPE_HASH( BOARD_ITEM ) );
propMgr.AddProperty( new PROPERTY<PCB_TARGET, int>( _( "Size" ),
&PCB_TARGET::SetSize, &PCB_TARGET::GetSize, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<PCB_TARGET, int>( _( "Width" ),
&PCB_TARGET::SetWidth, &PCB_TARGET::GetWidth, PROPERTY_DISPLAY::DISTANCE ) );
auto shape = new PROPERTY<PCB_TARGET, int>( _( "Shape" ),
&PCB_TARGET::SetShape, &PCB_TARGET::GetShape );
// TODO change the integer to an enum?
//shape->SetValues( { { 0, _( "Cross" ) }, { 1, ( "Plus" ) } } );
propMgr.AddProperty( shape );
}
} _PCB_TARGET_DESC;

View File

@ -217,3 +217,15 @@ void TEXTE_PCB::SwapData( BOARD_ITEM* aImage )
}
static struct TEXTE_PCB_DESC
{
TEXTE_PCB_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( TEXTE_PCB );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_PCB, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_PCB, EDA_TEXT> );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_PCB ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_PCB ), TYPE_HASH( EDA_TEXT ) );
}
} _TEXTE_PCB_DESC;

View File

@ -451,3 +451,17 @@ wxString TEXTE_MODULE::GetShownText( int aDepth ) const
return text;
}
static struct TEXTE_MODULE_DESC
{
TEXTE_MODULE_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( TEXTE_MODULE );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_MODULE, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_MODULE, EDA_TEXT> );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_MODULE ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_MODULE ), TYPE_HASH( EDA_TEXT ) );
}
} _TEXTE_MODULE_DESC;

View File

@ -976,3 +976,52 @@ wxString TRACK::ShowState( int stateBits )
}
#endif
static struct TRACK_VIA_DESC
{
TRACK_VIA_DESC()
{
ENUM_MAP<VIATYPE>::Instance()
.Map( VIATYPE::THROUGH, _( "Through" ) )
.Map( VIATYPE::BLIND_BURIED, _( "Blind/Buried" ) )
.Map( VIATYPE::MICROVIA, _( "Microvia" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
// Track
REGISTER_TYPE( TRACK );
propMgr.InheritsAfter( TYPE_HASH( TRACK ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
propMgr.AddProperty( new PROPERTY<TRACK, int>( _( "Width" ),
&TRACK::SetWidth, &TRACK::GetWidth, PROPERTY_DISPLAY::DISTANCE ) );
//propMgr.AddProperty( new PROPERTY<TRACK, int>( _( "Origin X" ),
//&TRACK::SetX, &TRACK::GetX, PROPERTY_DISPLAY::DISTANCE ) );
//propMgr.AddProperty( new PROPERTY<TRACK, int>( _( "Origin Y" ),
//&TRACK::SetY, &TRACK::GetY, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<TRACK, int>( _( "End X" ),
&TRACK::SetEndX, &TRACK::GetEndX, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<TRACK, int>( _( "End Y" ),
&TRACK::SetEndY, &TRACK::GetEndY, PROPERTY_DISPLAY::DISTANCE ) );
// Via
REGISTER_TYPE( VIA );
propMgr.InheritsAfter( TYPE_HASH( VIA ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
// TODO layerset for vias?
// TODO rename width to radius
// TODO test drill, use getdrillvalue?
//propMgr.AddProperty( new PROPERTY<VIA, int>( _( "Radius" ),
//&VIA::SetWidth, &VIA::GetWidth, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<VIA, int>( "Drill",
&VIA::SetDrill, &VIA::GetDrillValue, PROPERTY_DISPLAY::DISTANCE ) );
//propMgr.AddProperty( new PROPERTY_ENUM<VIA, PCB_LAYER_ID>( _( "Layer Top" ),
//&VIA::SetLayer, &VIA::GetLayer ) );
propMgr.AddProperty( new PROPERTY_ENUM<VIA, PCB_LAYER_ID>( _( "Layer Bottom" ),
&VIA::SetBottomLayer, &VIA::BottomLayer ) );
propMgr.AddProperty( new PROPERTY_ENUM<VIA, VIATYPE>( _( "Via Type" ),
&VIA::SetViaType, &VIA::GetViaType ) );
}
} _TRACK_VIA_DESC;
ENUM_TO_WXANY( VIATYPE );

View File

@ -117,6 +117,11 @@ public:
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
const wxPoint& GetStart() const { return m_Start; }
void SetEndX( int aX ) { m_End.x = aX; }
void SetEndY( int aY ) { m_End.y = aY; }
int GetEndX() const { return m_End.x; }
int GetEndY() const { return m_End.x; }
/// Return the selected endpoint (start or end)
const wxPoint& GetEndPoint( ENDPOINT_T aEndPoint ) const

View File

@ -1374,3 +1374,23 @@ unsigned int MODULE_ZONE_CONTAINER::ViewGetLOD( int aLayer, KIGFX::VIEW* aView )
// Other layers are shown without any conditions
return 0;
}
static struct ZONE_CONTAINER_DESC
{
ZONE_CONTAINER_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( ZONE_CONTAINER );
propMgr.InheritsAfter( TYPE_HASH( ZONE_CONTAINER ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Clearance" ),
&ZONE_CONTAINER::SetZoneClearance, &ZONE_CONTAINER::GetZoneClearance, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, unsigned>( _( "Priority" ),
&ZONE_CONTAINER::SetPriority, &ZONE_CONTAINER::GetPriority ) );
//propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, bool>( "Filled",
//&ZONE_CONTAINER::SetIsFilled, &ZONE_CONTAINER::IsFilled ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Min Thickness" ),
&ZONE_CONTAINER::SetMinThickness, &ZONE_CONTAINER::GetMinThickness, PROPERTY_DISPLAY::DISTANCE ) );
// TODO pad connection, thermal relief gap, thermal relief copper bridge
}
} _ZONE_CONTAINER_DESC;