Properties: Add grouping and sorting by creation order

This commit is contained in:
Jon Evans 2022-11-27 22:40:14 -05:00
parent 64f315c649
commit b2b3f5752f
10 changed files with 247 additions and 110 deletions

View File

@ -1022,43 +1022,57 @@ static struct EDA_TEXT_DESC
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDA_TEXT );
const wxString textProps = _( "Text Properties" );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, wxString>( _HKI( "Text" ),
&EDA_TEXT::SetText,
&EDA_TEXT::GetText ) );
&EDA_TEXT::GetText ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, wxString>( _HKI( "Hyperlink" ),
&EDA_TEXT::SetHyperlink,
&EDA_TEXT::GetHyperlink ) );
&EDA_TEXT::GetHyperlink ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Thickness" ),
&EDA_TEXT::SetTextThickness,
&EDA_TEXT::GetTextThickness,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Italic" ),
&EDA_TEXT::SetItalic,
&EDA_TEXT::IsItalic ) );
&EDA_TEXT::IsItalic ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Bold" ),
&EDA_TEXT::SetBold, &EDA_TEXT::IsBold ) );
&EDA_TEXT::SetBold, &EDA_TEXT::IsBold ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Mirrored" ),
&EDA_TEXT::SetMirrored,
&EDA_TEXT::IsMirrored ) );
&EDA_TEXT::IsMirrored ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Visible" ),
&EDA_TEXT::SetVisible,
&EDA_TEXT::IsVisible ) );
&EDA_TEXT::IsVisible ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Width" ),
&EDA_TEXT::SetTextWidth,
&EDA_TEXT::GetTextWidth,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Height" ),
&EDA_TEXT::SetTextHeight,
&EDA_TEXT::GetTextHeight,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
textProps );
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
GR_TEXT_H_ALIGN_T>( _HKI( "Horizontal Justification" ),
&EDA_TEXT::SetHorizJustify,
&EDA_TEXT::GetHorizJustify ) );
&EDA_TEXT::GetHorizJustify ),
textProps );
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
GR_TEXT_V_ALIGN_T>( _HKI( "Vertical Justification" ),
&EDA_TEXT::SetVertJustify,
&EDA_TEXT::GetVertJustify ) );
&EDA_TEXT::GetVertJustify ),
textProps );
}
} _EDA_TEXT_DESC;

View File

@ -28,11 +28,6 @@
static wxString EMPTY_STRING( wxEmptyString );
const PROPERTY_MANAGER::PROPERTY_GROUP PROPERTY_MANAGER::DEFAULT_GROUP = {
0,
_( "Other Properties" )
};
void PROPERTY_MANAGER::RegisterType( TYPE_ID aType, const wxString& aName )
{
@ -85,6 +80,36 @@ const PROPERTY_LIST& PROPERTY_MANAGER::GetProperties( TYPE_ID aType ) const
}
const PROPERTY_DISPLAY_ORDER& PROPERTY_MANAGER::GetDisplayOrder( TYPE_ID aType ) const
{
if( m_dirty )
const_cast<PROPERTY_MANAGER*>( this )->Rebuild();
static const PROPERTY_DISPLAY_ORDER empty;
auto it = m_classes.find( aType );
if( it == m_classes.end() )
return empty;
return it->second.m_displayOrder;
}
const std::vector<wxString>& PROPERTY_MANAGER::GetGroupDisplayOrder( TYPE_ID aType ) const
{
if( m_dirty )
const_cast<PROPERTY_MANAGER*>( this )->Rebuild();
static const std::vector<wxString> empty;
auto it = m_classes.find( aType );
if( it == m_classes.end() )
return empty;
return it->second.m_groupDisplayOrder;
}
const void* PROPERTY_MANAGER::TypeCast( const void* aSource, TYPE_ID aBase, TYPE_ID aTarget ) const
{
if( aBase == aTarget )
@ -105,34 +130,32 @@ const void* PROPERTY_MANAGER::TypeCast( const void* aSource, TYPE_ID aBase, TYPE
}
void PROPERTY_MANAGER::AddProperty( PROPERTY_BASE* aProperty, const PROPERTY_GROUP& aGroup )
void PROPERTY_MANAGER::AddProperty( PROPERTY_BASE* aProperty, const wxString& aGroup )
{
const wxString& name = aProperty->Name();
TYPE_ID hash = aProperty->OwnerHash();
CLASS_DESC& classDesc = getClass( hash );
classDesc.m_ownProperties.emplace( name, aProperty );
if( aGroup.id > DEFAULT_GROUP.id && aGroup.id < classDesc.m_groups.size() )
aProperty->SetGroup( aGroup.id );
aProperty->SetGroup( aGroup );
if( !classDesc.m_groups.count( aGroup ) )
{
classDesc.m_groupDisplayOrder.emplace_back( aGroup );
classDesc.m_groups.insert( aGroup );
}
m_dirty = true;
}
void PROPERTY_MANAGER::ReplaceProperty( size_t aBase, const wxString& aName, PROPERTY_BASE* aNew )
void PROPERTY_MANAGER::ReplaceProperty( size_t aBase, const wxString& aName, PROPERTY_BASE* aNew,
const wxString& aGroup )
{
wxASSERT( aBase == aNew->BaseHash() || IsOfType( aNew->OwnerHash(), aBase ) );
CLASS_DESC& classDesc = getClass( aNew->OwnerHash() );
classDesc.m_replaced.insert( std::make_pair( aBase, aName ) );
AddProperty( aNew );
}
const PROPERTY_MANAGER::PROPERTY_GROUP& PROPERTY_MANAGER::AddPropertyGroup( TYPE_ID aOwner,
const wxString& aName )
{
CLASS_DESC& desc = getClass( aOwner );
return desc.m_groups.emplace_back( PROPERTY_GROUP( { desc.m_groups.size(), aName } ) );
AddProperty( aNew, aGroup );
}
@ -203,29 +226,41 @@ void PROPERTY_MANAGER::CLASS_DESC::rebuild()
{
PROPERTY_SET replaced( m_replaced );
m_allProperties.clear();
collectPropsRecur( m_allProperties, replaced );
collectPropsRecur( m_allProperties, replaced, m_displayOrder );
// We need to keep properties sorted to be able to use std::set_* functions
sort( m_allProperties.begin(), m_allProperties.end() );
}
void PROPERTY_MANAGER::CLASS_DESC::collectPropsRecur( PROPERTY_LIST& aResult,
PROPERTY_SET& aReplaced ) const
PROPERTY_SET& aReplaced,
PROPERTY_DISPLAY_ORDER& aDisplayOrder ) const
{
for( const std::pair<size_t, wxString>& replacedEntry : m_replaced )
aReplaced.emplace( replacedEntry );
/*
* We want to insert our own properties in forward order, but earlier than anything already in
* the list (which will have been added by a subclass of us)
*/
int displayOrderStart = aResult.empty() ? 0 :
aDisplayOrder[ aResult[0] ] - m_ownProperties.size();
int idx = 0;
for( const std::pair<const wxString, std::unique_ptr<PROPERTY_BASE>>& prop : m_ownProperties )
{
PROPERTY_BASE* property = prop.second.get();
// Do not store replaced properties
if( aReplaced.count( std::make_pair( property->OwnerHash(), property->Name() ) ) == 0 )
{
aDisplayOrder[property] = displayOrderStart + idx++;
aResult.push_back( property );
}
}
for( const std::reference_wrapper<CLASS_DESC>& base : m_bases )
base.get().collectPropsRecur( aResult, aReplaced );
base.get().collectPropsRecur( aResult, aReplaced, aDisplayOrder );
}

View File

@ -132,11 +132,35 @@ void PROPERTIES_PANEL::update( const SELECTION& aSelection )
const PROPERTY_LIST& allProperties = propMgr.GetProperties( *types.begin() );
copy( allProperties.begin(), allProperties.end(), inserter( commonProps, commonProps.begin() ) );
PROPERTY_DISPLAY_ORDER displayOrder = propMgr.GetDisplayOrder( *types.begin() );
std::vector<wxString> groupDisplayOrder = propMgr.GetGroupDisplayOrder( *types.begin() );
std::set<wxString> groups( groupDisplayOrder.begin(), groupDisplayOrder.end() );
std::map<wxPGProperty*, int> pgPropOrders;
std::map<wxString, std::vector<wxPGProperty*>> pgPropGroups;
// Get all possible properties
for( const auto& type : types )
{
const PROPERTY_LIST& itemProps = propMgr.GetProperties( type );
const PROPERTY_DISPLAY_ORDER& itemDisplayOrder = propMgr.GetDisplayOrder( type );
copy( itemDisplayOrder.begin(), itemDisplayOrder.end(),
inserter( displayOrder, displayOrder.begin() ) );
const std::vector<wxString>& itemGroups = propMgr.GetGroupDisplayOrder( type );
for( const wxString& group : itemGroups )
{
if( !groups.count( group ) )
{
groupDisplayOrder.emplace_back( group );
groups.insert( group );
}
}
for( auto it = commonProps.begin(); it != commonProps.end(); /* ++it in the loop */ )
{
if( !binary_search( itemProps.begin(), itemProps.end(), *it ) )
@ -202,12 +226,37 @@ void PROPERTIES_PANEL::update( const SELECTION& aSelection )
if( pgProp )
{
pgProp->SetValue( commonVal );
m_grid->Append( pgProp );
m_displayed.push_back( property );
wxASSERT( displayOrder.count( property ) );
pgPropOrders[pgProp] = displayOrder[property];
pgPropGroups[property->Group()].emplace_back( pgProp );
}
}
}
const wxString unspecifiedGroupCaption = _( "Basic Properties" );
for( const wxString& groupName : groupDisplayOrder )
{
wxASSERT( pgPropGroups.count( groupName ) );
std::vector<wxPGProperty*>& properties = pgPropGroups[groupName];
auto groupItem = new wxPropertyCategory( groupName == wxEmptyString ?
unspecifiedGroupCaption : groupName );
m_grid->Append( groupItem );
std::sort( properties.begin(), properties.end(),
[&]( wxPGProperty*& aFirst, wxPGProperty*& aSecond )
{
return pgPropOrders[aFirst] < pgPropOrders[aSecond];
} );
for( wxPGProperty* property : properties )
m_grid->Append( property );
}
RecalculateSplitterPos();
}

View File

@ -184,7 +184,6 @@ PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
m_display( aDisplay ),
m_coordType( aCoordType ),
m_isInternal( false ),
m_groupId( -1 ),
m_availFunc( [](INSPECTABLE*)->bool { return true; } )
{
}
@ -268,8 +267,8 @@ PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
void SetIsInternal( bool aIsInternal ) { m_isInternal = aIsInternal; }
bool IsInternal() const { return m_isInternal; }
void SetGroup( int aGroup ) { m_groupId = aGroup; }
int Group() const { return m_groupId; }
wxString Group() const { return m_group; }
void SetGroup( const wxString& aGroup ) { m_group = aGroup; }
protected:
template<typename T>
@ -302,7 +301,8 @@ private:
/// Internal properties are hidden from the GUI
bool m_isInternal;
int m_groupId;
/// Optional group identifier
wxString m_group;
std::function<bool(INSPECTABLE*)> m_availFunc; ///< Eval to determine if prop is available

View File

@ -28,6 +28,7 @@
#include <wx/string.h>
#include <list>
#include <map>
#include <unordered_map>
#include <set>
@ -46,6 +47,8 @@ using PROPERTY_LIST = std::vector<PROPERTY_BASE*>;
using PROPERTY_SET = std::set<std::pair<size_t, wxString>>;
using PROPERTY_DISPLAY_ORDER = std::map<PROPERTY_BASE*, int>;
/**
* Provide class metadata. Each class handled by PROPERTY_MANAGER
* needs to be described using AddProperty(), AddTypeCast() and InheritsAfter() methods.
@ -104,6 +107,10 @@ public:
*/
const PROPERTY_LIST& GetProperties( TYPE_ID aType ) const;
const PROPERTY_DISPLAY_ORDER& GetDisplayOrder( TYPE_ID aType ) const;
const std::vector<wxString>& GetGroupDisplayOrder( TYPE_ID aType ) const;
/**
* Cast a type to another type. Used for correct type-casting of types with
* multi-inheritance. Requires registration of an appropriate converter (AddTypeCast).
@ -122,24 +129,17 @@ public:
return const_cast<void*>( TypeCast( (const void*) aSource, aBase, aTarget ) );
}
/**
* Defines a grouping of properties in the editor
*/
struct PROPERTY_GROUP
{
size_t id; ///< Controls the display order of the group (lowest first)
wxString name; ///< Header to display in the properties manager
};
static const PROPERTY_GROUP DEFAULT_GROUP;
/**
* Register a property.
* Properties for a given item will be shown in the order they are added.
* If a group name is supplied, the group will be created if it does not yet exists.
* Groups will likewise be shown in the order they are added (so, groups first added by a base
* class will appear before those of a child class).
*
* @param aProperty is the property to register.
* @param aGroup is the group to place the property in
* @param aGroup is an optional grouping key for the property
*/
void AddProperty( PROPERTY_BASE* aProperty, const PROPERTY_GROUP& aGroup = DEFAULT_GROUP );
void AddProperty( PROPERTY_BASE* aProperty, const wxString& aGroup = wxEmptyString );
/**
* Replace an existing property for a specific type.
@ -150,8 +150,10 @@ public:
* @param aBase is the base class type the delivers the original property.
* @param aName is the name of the replaced property.
* @param aNew is the property replacing the inherited one.
* @param aGroup is the group to set for the replaced property.
*/
void ReplaceProperty( size_t aBase, const wxString& aName, PROPERTY_BASE* aNew );
void ReplaceProperty( size_t aBase, const wxString& aName, PROPERTY_BASE* aNew,
const wxString& aGroup = wxEmptyString );
/**
* Register a type converter. Required prior TypeCast() usage.
@ -205,13 +207,6 @@ public:
std::vector<TYPE_ID> GetMatchingClasses( PROPERTY_BASE* aProperty );
/**
* Defines a named group of properties belonging to a certain class
* @param aOwner is the class type that delivers the properties in the group
* @param aName will be shown as the group name in the properties manager
*/
const PROPERTY_GROUP& AddPropertyGroup( TYPE_ID aOwner, const wxString& aName );
private:
PROPERTY_MANAGER() :
m_dirty( false ),
@ -226,7 +221,8 @@ private:
CLASS_DESC( TYPE_ID aId )
: m_id( aId )
{
m_groups.emplace_back( DEFAULT_GROUP );
m_groupDisplayOrder.emplace_back( wxEmptyString );
m_groups.insert( wxEmptyString );
}
///< Unique type identifier (obtained using TYPE_HASH)
@ -244,7 +240,11 @@ private:
///< All properties (both unique to the type and inherited)
std::vector<PROPERTY_BASE*> m_allProperties;
std::vector<PROPERTY_GROUP> m_groups;
PROPERTY_DISPLAY_ORDER m_displayOrder;
std::vector<wxString> m_groupDisplayOrder;
std::set<wxString> m_groups;
///< Replaced properties (TYPE_ID / name)
PROPERTY_SET m_replaced;
@ -254,7 +254,8 @@ private:
///< Traverses the class inheritance hierarchy bottom-to-top, gathering
///< all properties available to a type
void collectPropsRecur( PROPERTY_LIST& aResult, PROPERTY_SET& aReplaced ) const;
void collectPropsRecur( PROPERTY_LIST& aResult, PROPERTY_SET& aReplaced,
PROPERTY_DISPLAY_ORDER& aDisplayOrder ) const;
};
///< Returns metadata for a specific type

View File

@ -2857,43 +2857,62 @@ static struct FOOTPRINT_DESC
layer->SetChoices( fpLayers );
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ), layer );
const wxString groupFootprint = _( "Footprint Properties" );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Reference" ),
&FOOTPRINT::SetReference, &FOOTPRINT::GetReferenceAsString ) );
&FOOTPRINT::SetReference, &FOOTPRINT::GetReferenceAsString ),
groupFootprint );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Value" ),
&FOOTPRINT::SetValue, &FOOTPRINT::GetValueAsString ) );
&FOOTPRINT::SetValue, &FOOTPRINT::GetValueAsString ),
groupFootprint );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, double>( _HKI( "Orientation" ),
&FOOTPRINT::SetOrientationDegrees, &FOOTPRINT::GetOrientationDegrees,
PROPERTY_DISPLAY::PT_DEGREE ) );
PROPERTY_DISPLAY::PT_DEGREE ),
groupFootprint );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Library link" ),
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetFPIDAsString ) );
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetFPIDAsString ),
groupFootprint );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Description" ),
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetDescription ) );
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetDescription ),
groupFootprint );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Keywords" ),
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetKeywords ) );
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetKeywords ),
groupFootprint );
const wxString groupAttributes = _( "Fabrication Attributes" );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, bool>( _HKI( "Not in schematic" ),
&FOOTPRINT::SetBoardOnly, &FOOTPRINT::IsBoardOnly ) );
&FOOTPRINT::SetBoardOnly, &FOOTPRINT::IsBoardOnly ), groupAttributes );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, bool>( _HKI( "Exclude from position files" ),
&FOOTPRINT::SetExcludedFromPosFiles, &FOOTPRINT::IsExcludedFromPosFiles ) );
&FOOTPRINT::SetExcludedFromPosFiles, &FOOTPRINT::IsExcludedFromPosFiles ),
groupAttributes );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, bool>( _HKI( "Exclude from BOM" ),
&FOOTPRINT::SetExcludedFromBOM, &FOOTPRINT::IsExcludedFromBOM ) );
&FOOTPRINT::SetExcludedFromBOM, &FOOTPRINT::IsExcludedFromBOM ),
groupAttributes );
const wxString groupOverrides = _( "Overrides" );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, bool>(
_HKI( "Exempt from courtyard requirement" ),
&FOOTPRINT::SetAllowMissingCourtyard, &FOOTPRINT::AllowMissingCourtyard ) );
&FOOTPRINT::SetAllowMissingCourtyard, &FOOTPRINT::AllowMissingCourtyard ),
groupOverrides );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, int>( _HKI( "Clearance Override" ),
&FOOTPRINT::SetLocalClearance, &FOOTPRINT::GetLocalClearance,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
groupOverrides );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, int>( _HKI( "Solderpaste Margin Override" ),
&FOOTPRINT::SetLocalSolderPasteMargin, &FOOTPRINT::GetLocalSolderPasteMargin,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
groupOverrides );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, double>(
_HKI( "Solderpaste Margin Ratio Override" ),
&FOOTPRINT::SetLocalSolderPasteMarginRatio,
&FOOTPRINT::GetLocalSolderPasteMarginRatio ) );
&FOOTPRINT::GetLocalSolderPasteMarginRatio ),
groupOverrides );
propMgr.AddProperty( new PROPERTY_ENUM<FOOTPRINT, ZONE_CONNECTION>(
_HKI( "Zone Connection Style" ),
&FOOTPRINT::SetZoneConnection, &FOOTPRINT::GetZoneConnection ) );
&FOOTPRINT::SetZoneConnection, &FOOTPRINT::GetZoneConnection ),
groupOverrides );
}
} _FOOTPRINT_DESC;

View File

@ -1722,31 +1722,33 @@ static struct PAD_DESC
REGISTER_TYPE( PAD );
propMgr.InheritsAfter( TYPE_HASH( PAD ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
const wxString groupPad = _( "Pad Properties" );
auto padType = new PROPERTY_ENUM<PAD, PAD_ATTRIB>( _HKI( "Pad Type" ),
&PAD::SetAttribute, &PAD::GetAttribute );
propMgr.AddProperty( padType );
propMgr.AddProperty( padType, groupPad );
auto shape = new PROPERTY_ENUM<PAD, PAD_SHAPE>( _HKI( "Shape" ),
&PAD::SetShape, &PAD::GetShape );
propMgr.AddProperty( shape );
propMgr.AddProperty( shape, groupPad );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Parent" ),
NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ) );
NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ), groupPad );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pad Number" ),
&PAD::SetNumber, &PAD::GetNumber ) );
&PAD::SetNumber, &PAD::GetNumber ), groupPad);
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Name" ),
NO_SETTER( PAD, wxString ), &PAD::GetPinFunction ) );
NO_SETTER( PAD, wxString ), &PAD::GetPinFunction ), groupPad );
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Type" ),
NO_SETTER( PAD, wxString ), &PAD::GetPinType ) );
NO_SETTER( PAD, wxString ), &PAD::GetPinType ), groupPad);
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Orientation" ),
&PAD::SetOrientationDegrees, &PAD::GetOrientationDegrees,
PROPERTY_DISPLAY::PT_DEGREE ) );
PROPERTY_DISPLAY::PT_DEGREE ), groupPad );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Size X" ),
&PAD::SetSizeX, &PAD::GetSizeX,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupPad );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Size Y" ),
&PAD::SetSizeY, &PAD::GetSizeY,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupPad );
auto roundRadiusRatio = new PROPERTY<PAD, double>( _HKI( "Round Radius Ratio" ),
&PAD::SetRoundRectRadiusRatio, &PAD::GetRoundRectRadiusRatio );
@ -1755,43 +1757,47 @@ static struct PAD_DESC
{
return aItem->Get( shape ) == static_cast<int>( PAD_SHAPE::ROUNDRECT );
} );
propMgr.AddProperty( roundRadiusRatio );
propMgr.AddProperty( roundRadiusRatio, groupPad );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Hole Size X" ),
&PAD::SetDrillSizeX, &PAD::GetDrillSizeX,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupPad );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Hole Size Y" ),
&PAD::SetDrillSizeY, &PAD::GetDrillSizeY,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupPad );
propMgr.AddProperty( new PROPERTY_ENUM<PAD, PAD_PROP>( _HKI( "Fabrication Property" ),
&PAD::SetProperty, &PAD::GetProperty ) );
&PAD::SetProperty, &PAD::GetProperty ), groupPad );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Pad To Die Length" ),
&PAD::SetPadToDieLength, &PAD::GetPadToDieLength,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupPad );
const wxString groupOverrides = _( "Overrides" );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Clearance Override" ),
&PAD::SetLocalClearance, &PAD::GetLocalClearance,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Soldermask Margin Override" ),
&PAD::SetLocalSolderMaskMargin, &PAD::GetLocalSolderMaskMargin,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Solderpaste Margin Override" ),
&PAD::SetLocalSolderPasteMargin, &PAD::GetLocalSolderPasteMargin,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Solderpaste Margin Ratio Override" ),
&PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ) );
&PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ),
groupOverrides );
propMgr.AddProperty( new PROPERTY_ENUM<PAD, ZONE_CONNECTION>(
_HKI( "Zone Connection Style" ),
&PAD::SetZoneConnection, &PAD::GetZoneConnection ) );
&PAD::SetZoneConnection, &PAD::GetZoneConnection ), groupOverrides );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Thermal Relief Spoke Width" ),
&PAD::SetThermalSpokeWidth, &PAD::GetThermalSpokeWidth,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
propMgr.AddProperty( new PROPERTY<PAD, double>( _HKI( "Thermal Relief Spoke Angle" ),
&PAD::SetThermalSpokeAngleDegrees, &PAD::GetThermalSpokeAngleDegrees,
PROPERTY_DISPLAY::PT_DEGREE ) );
PROPERTY_DISPLAY::PT_DEGREE ), groupOverrides );
propMgr.AddProperty( new PROPERTY<PAD, int>( _HKI( "Thermal Relief Gap" ),
&PAD::SetThermalGap, &PAD::GetThermalGap,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
// TODO delta, drill shape offset, layer set
}

View File

@ -1300,8 +1300,11 @@ static struct DIMENSION_DESC
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIMENSION_BASE );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIMENSION_BASE ), TYPE_HASH( BOARD_ITEM ) );
// TODO: add dimension properties:
//propMgr.AddProperty( new PROPERTY<DIMENSION, int>( _HKI( "Height" ),
//&DIMENSION::SetHeight, &DIMENSION::GetHeight, PROPERTY_DISPLAY::SIZE ) );
const wxString groupDimension = _( "Dimension Properties" );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Override Text" ),
&PCB_DIMENSION_BASE::SetOverrideText, &PCB_DIMENSION_BASE::GetOverrideText ),
groupDimension );
}
} _DIMENSION_DESC;

View File

@ -1281,18 +1281,20 @@ static struct TRACK_VIA_DESC
// TODO layerset for vias?
// TODO test drill, use getdrillvalue?
const wxString groupVia = _( "Via Properties" );
propMgr.ReplaceProperty( TYPE_HASH( PCB_TRACK ), _HKI( "Width" ),
new PROPERTY<PCB_VIA, int, PCB_TRACK>( _HKI( "Diameter" ),
&PCB_VIA::SetWidth, &PCB_VIA::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<PCB_VIA, int>( _HKI( "Hole" ),
&PCB_VIA::SetDrill, &PCB_VIA::GetDrillValue, PROPERTY_DISPLAY::PT_SIZE ) );
&PCB_VIA::SetDrill, &PCB_VIA::GetDrillValue, PROPERTY_DISPLAY::PT_SIZE ), groupVia );
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ),
new PROPERTY_ENUM<PCB_VIA, PCB_LAYER_ID, BOARD_ITEM>( _HKI( "Layer Top" ),
&PCB_VIA::SetLayer, &PCB_VIA::GetLayer ) );
&PCB_VIA::SetLayer, &PCB_VIA::GetLayer ), groupVia );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_VIA, PCB_LAYER_ID>( _HKI( "Layer Bottom" ),
&PCB_VIA::SetBottomLayer, &PCB_VIA::BottomLayer ) );
&PCB_VIA::SetBottomLayer, &PCB_VIA::BottomLayer ), groupVia );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_VIA, VIATYPE>( _HKI( "Via Type" ),
&PCB_VIA::SetViaType, &PCB_VIA::GetViaType ) );
&PCB_VIA::SetViaType, &PCB_VIA::GetViaType ), groupVia );
}
} _TRACK_VIA_DESC;

View File

@ -1374,20 +1374,28 @@ static struct ZONE_DESC
propMgr.AddProperty( new PROPERTY<ZONE, wxString>( _HKI( "Name" ),
&ZONE::SetZoneName, &ZONE::GetZoneName ) );
const wxString groupOverrides = _( "Overrides" );
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Clearance Override" ),
&ZONE::SetLocalClearance, &ZONE::GetLocalClearance,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
groupOverrides );
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Min Width" ),
&ZONE::SetMinThickness, &ZONE::GetMinThickness,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
groupOverrides );
propMgr.AddProperty( new PROPERTY_ENUM<ZONE, ZONE_CONNECTION>( _HKI( "Pad Connections" ),
&ZONE::SetPadConnection, &ZONE::GetPadConnection ) );
&ZONE::SetPadConnection, &ZONE::GetPadConnection ),
groupOverrides );
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Thermal Relief Gap" ),
&ZONE::SetThermalReliefGap, &ZONE::GetThermalReliefGap,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
groupOverrides );
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Thermal Relief Spoke Width" ),
&ZONE::SetThermalReliefSpokeWidth, &ZONE::GetThermalReliefSpokeWidth,
PROPERTY_DISPLAY::PT_SIZE ) );
PROPERTY_DISPLAY::PT_SIZE ),
groupOverrides );
}
} _ZONE_DESC;