diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 2b5d3b9dce..fb084f4ac9 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -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( _HKI( "Text" ), &EDA_TEXT::SetText, - &EDA_TEXT::GetText ) ); + &EDA_TEXT::GetText ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Hyperlink" ), &EDA_TEXT::SetHyperlink, - &EDA_TEXT::GetHyperlink ) ); + &EDA_TEXT::GetHyperlink ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Thickness" ), &EDA_TEXT::SetTextThickness, &EDA_TEXT::GetTextThickness, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Italic" ), &EDA_TEXT::SetItalic, - &EDA_TEXT::IsItalic ) ); + &EDA_TEXT::IsItalic ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Bold" ), - &EDA_TEXT::SetBold, &EDA_TEXT::IsBold ) ); + &EDA_TEXT::SetBold, &EDA_TEXT::IsBold ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Mirrored" ), &EDA_TEXT::SetMirrored, - &EDA_TEXT::IsMirrored ) ); + &EDA_TEXT::IsMirrored ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Visible" ), &EDA_TEXT::SetVisible, - &EDA_TEXT::IsVisible ) ); + &EDA_TEXT::IsVisible ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Width" ), &EDA_TEXT::SetTextWidth, &EDA_TEXT::GetTextWidth, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + textProps ); propMgr.AddProperty( new PROPERTY( _HKI( "Height" ), &EDA_TEXT::SetTextHeight, &EDA_TEXT::GetTextHeight, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + textProps ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Horizontal Justification" ), &EDA_TEXT::SetHorizJustify, - &EDA_TEXT::GetHorizJustify ) ); + &EDA_TEXT::GetHorizJustify ), + textProps ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Vertical Justification" ), &EDA_TEXT::SetVertJustify, - &EDA_TEXT::GetVertJustify ) ); + &EDA_TEXT::GetVertJustify ), + textProps ); } } _EDA_TEXT_DESC; diff --git a/common/properties/property_mgr.cpp b/common/properties/property_mgr.cpp index 7a9c2ce406..af01ef9dce 100644 --- a/common/properties/property_mgr.cpp +++ b/common/properties/property_mgr.cpp @@ -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( 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& PROPERTY_MANAGER::GetGroupDisplayOrder( TYPE_ID aType ) const +{ + if( m_dirty ) + const_cast( this )->Rebuild(); + + static const std::vector 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& 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>& 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& base : m_bases ) - base.get().collectPropsRecur( aResult, aReplaced ); + base.get().collectPropsRecur( aResult, aReplaced, aDisplayOrder ); } diff --git a/common/widgets/properties_panel.cpp b/common/widgets/properties_panel.cpp index 448699bc1c..d4bb227d7f 100644 --- a/common/widgets/properties_panel.cpp +++ b/common/widgets/properties_panel.cpp @@ -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 groupDisplayOrder = propMgr.GetGroupDisplayOrder( *types.begin() ); + std::set groups( groupDisplayOrder.begin(), groupDisplayOrder.end() ); + + std::map pgPropOrders; + std::map> 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& 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& 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(); } diff --git a/include/properties/property.h b/include/properties/property.h index 7fce210bbc..b048934fdb 100644 --- a/include/properties/property.h +++ b/include/properties/property.h @@ -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 @@ -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 m_availFunc; ///< Eval to determine if prop is available diff --git a/include/properties/property_mgr.h b/include/properties/property_mgr.h index df8ae410cc..b04f9c26c9 100644 --- a/include/properties/property_mgr.h +++ b/include/properties/property_mgr.h @@ -28,6 +28,7 @@ #include +#include #include #include #include @@ -46,6 +47,8 @@ using PROPERTY_LIST = std::vector; using PROPERTY_SET = std::set>; +using PROPERTY_DISPLAY_ORDER = std::map; + /** * 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& 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( 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 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 m_allProperties; - std::vector m_groups; + PROPERTY_DISPLAY_ORDER m_displayOrder; + + std::vector m_groupDisplayOrder; + + std::set 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 diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index bbce5f8882..4de96c959c 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -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( _HKI( "Reference" ), - &FOOTPRINT::SetReference, &FOOTPRINT::GetReferenceAsString ) ); + &FOOTPRINT::SetReference, &FOOTPRINT::GetReferenceAsString ), + groupFootprint ); propMgr.AddProperty( new PROPERTY( _HKI( "Value" ), - &FOOTPRINT::SetValue, &FOOTPRINT::GetValueAsString ) ); + &FOOTPRINT::SetValue, &FOOTPRINT::GetValueAsString ), + groupFootprint ); propMgr.AddProperty( new PROPERTY( _HKI( "Orientation" ), &FOOTPRINT::SetOrientationDegrees, &FOOTPRINT::GetOrientationDegrees, - PROPERTY_DISPLAY::PT_DEGREE ) ); + PROPERTY_DISPLAY::PT_DEGREE ), + groupFootprint ); propMgr.AddProperty( new PROPERTY( _HKI( "Library link" ), - NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetFPIDAsString ) ); + NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetFPIDAsString ), + groupFootprint ); propMgr.AddProperty( new PROPERTY( _HKI( "Description" ), - NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetDescription ) ); + NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetDescription ), + groupFootprint ); propMgr.AddProperty( new PROPERTY( _HKI( "Keywords" ), - NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetKeywords ) ); + NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetKeywords ), + groupFootprint ); + + const wxString groupAttributes = _( "Fabrication Attributes" ); propMgr.AddProperty( new PROPERTY( _HKI( "Not in schematic" ), - &FOOTPRINT::SetBoardOnly, &FOOTPRINT::IsBoardOnly ) ); + &FOOTPRINT::SetBoardOnly, &FOOTPRINT::IsBoardOnly ), groupAttributes ); propMgr.AddProperty( new PROPERTY( _HKI( "Exclude from position files" ), - &FOOTPRINT::SetExcludedFromPosFiles, &FOOTPRINT::IsExcludedFromPosFiles ) ); + &FOOTPRINT::SetExcludedFromPosFiles, &FOOTPRINT::IsExcludedFromPosFiles ), + groupAttributes ); propMgr.AddProperty( new PROPERTY( _HKI( "Exclude from BOM" ), - &FOOTPRINT::SetExcludedFromBOM, &FOOTPRINT::IsExcludedFromBOM ) ); + &FOOTPRINT::SetExcludedFromBOM, &FOOTPRINT::IsExcludedFromBOM ), + groupAttributes ); + + const wxString groupOverrides = _( "Overrides" ); + propMgr.AddProperty( new PROPERTY( _HKI( "Exempt from courtyard requirement" ), - &FOOTPRINT::SetAllowMissingCourtyard, &FOOTPRINT::AllowMissingCourtyard ) ); - + &FOOTPRINT::SetAllowMissingCourtyard, &FOOTPRINT::AllowMissingCourtyard ), + groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Clearance Override" ), &FOOTPRINT::SetLocalClearance, &FOOTPRINT::GetLocalClearance, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Override" ), &FOOTPRINT::SetLocalSolderPasteMargin, &FOOTPRINT::GetLocalSolderPasteMargin, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Ratio Override" ), &FOOTPRINT::SetLocalSolderPasteMarginRatio, - &FOOTPRINT::GetLocalSolderPasteMarginRatio ) ); + &FOOTPRINT::GetLocalSolderPasteMarginRatio ), + groupOverrides ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Zone Connection Style" ), - &FOOTPRINT::SetZoneConnection, &FOOTPRINT::GetZoneConnection ) ); + &FOOTPRINT::SetZoneConnection, &FOOTPRINT::GetZoneConnection ), + groupOverrides ); } } _FOOTPRINT_DESC; diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index b9fcf11164..05f755ea16 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -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( _HKI( "Pad Type" ), &PAD::SetAttribute, &PAD::GetAttribute ); - propMgr.AddProperty( padType ); + propMgr.AddProperty( padType, groupPad ); auto shape = new PROPERTY_ENUM( _HKI( "Shape" ), &PAD::SetShape, &PAD::GetShape ); - propMgr.AddProperty( shape ); + propMgr.AddProperty( shape, groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Parent" ), - NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ) ); + NO_SETTER( PAD, wxString ), &PAD::GetParentAsString ), groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Pad Number" ), - &PAD::SetNumber, &PAD::GetNumber ) ); + &PAD::SetNumber, &PAD::GetNumber ), groupPad); propMgr.AddProperty( new PROPERTY( _HKI( "Pin Name" ), - NO_SETTER( PAD, wxString ), &PAD::GetPinFunction ) ); + NO_SETTER( PAD, wxString ), &PAD::GetPinFunction ), groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Pin Type" ), - NO_SETTER( PAD, wxString ), &PAD::GetPinType ) ); + NO_SETTER( PAD, wxString ), &PAD::GetPinType ), groupPad); propMgr.AddProperty( new PROPERTY( _HKI( "Orientation" ), &PAD::SetOrientationDegrees, &PAD::GetOrientationDegrees, - PROPERTY_DISPLAY::PT_DEGREE ) ); + PROPERTY_DISPLAY::PT_DEGREE ), groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Size X" ), &PAD::SetSizeX, &PAD::GetSizeX, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Size Y" ), &PAD::SetSizeY, &PAD::GetSizeY, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupPad ); auto roundRadiusRatio = new PROPERTY( _HKI( "Round Radius Ratio" ), &PAD::SetRoundRectRadiusRatio, &PAD::GetRoundRectRadiusRatio ); @@ -1755,43 +1757,47 @@ static struct PAD_DESC { return aItem->Get( shape ) == static_cast( PAD_SHAPE::ROUNDRECT ); } ); - propMgr.AddProperty( roundRadiusRatio ); + propMgr.AddProperty( roundRadiusRatio, groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Hole Size X" ), &PAD::SetDrillSizeX, &PAD::GetDrillSizeX, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupPad ); propMgr.AddProperty( new PROPERTY( _HKI( "Hole Size Y" ), &PAD::SetDrillSizeY, &PAD::GetDrillSizeY, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupPad ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Fabrication Property" ), - &PAD::SetProperty, &PAD::GetProperty ) ); + &PAD::SetProperty, &PAD::GetProperty ), groupPad ); propMgr.AddProperty( new PROPERTY( _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( _HKI( "Clearance Override" ), &PAD::SetLocalClearance, &PAD::GetLocalClearance, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Soldermask Margin Override" ), &PAD::SetLocalSolderMaskMargin, &PAD::GetLocalSolderMaskMargin, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Override" ), &PAD::SetLocalSolderPasteMargin, &PAD::GetLocalSolderPasteMargin, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Solderpaste Margin Ratio Override" ), - &PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ) ); + &PAD::SetLocalSolderPasteMarginRatio, &PAD::GetLocalSolderPasteMarginRatio ), + groupOverrides ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Zone Connection Style" ), - &PAD::SetZoneConnection, &PAD::GetZoneConnection ) ); + &PAD::SetZoneConnection, &PAD::GetZoneConnection ), groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Spoke Width" ), &PAD::SetThermalSpokeWidth, &PAD::GetThermalSpokeWidth, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Spoke Angle" ), &PAD::SetThermalSpokeAngleDegrees, &PAD::GetThermalSpokeAngleDegrees, - PROPERTY_DISPLAY::PT_DEGREE ) ); + PROPERTY_DISPLAY::PT_DEGREE ), groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Gap" ), &PAD::SetThermalGap, &PAD::GetThermalGap, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), groupOverrides ); // TODO delta, drill shape offset, layer set } diff --git a/pcbnew/pcb_dimension.cpp b/pcbnew/pcb_dimension.cpp index 6f77edd281..246ee5a065 100644 --- a/pcbnew/pcb_dimension.cpp +++ b/pcbnew/pcb_dimension.cpp @@ -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( _HKI( "Height" ), - //&DIMENSION::SetHeight, &DIMENSION::GetHeight, PROPERTY_DISPLAY::SIZE ) ); + + const wxString groupDimension = _( "Dimension Properties" ); + + propMgr.AddProperty( new PROPERTY( _HKI( "Override Text" ), + &PCB_DIMENSION_BASE::SetOverrideText, &PCB_DIMENSION_BASE::GetOverrideText ), + groupDimension ); } } _DIMENSION_DESC; diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index 52ded06aa2..3b81b770f8 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -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( _HKI( "Diameter" ), &PCB_VIA::SetWidth, &PCB_VIA::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) ); propMgr.AddProperty( new PROPERTY( _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( _HKI( "Layer Top" ), - &PCB_VIA::SetLayer, &PCB_VIA::GetLayer ) ); + &PCB_VIA::SetLayer, &PCB_VIA::GetLayer ), groupVia ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Layer Bottom" ), - &PCB_VIA::SetBottomLayer, &PCB_VIA::BottomLayer ) ); + &PCB_VIA::SetBottomLayer, &PCB_VIA::BottomLayer ), groupVia ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Via Type" ), - &PCB_VIA::SetViaType, &PCB_VIA::GetViaType ) ); + &PCB_VIA::SetViaType, &PCB_VIA::GetViaType ), groupVia ); } } _TRACK_VIA_DESC; diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 980451a54a..6f992cfa47 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -1374,20 +1374,28 @@ static struct ZONE_DESC propMgr.AddProperty( new PROPERTY( _HKI( "Name" ), &ZONE::SetZoneName, &ZONE::GetZoneName ) ); + + const wxString groupOverrides = _( "Overrides" ); + propMgr.AddProperty( new PROPERTY( _HKI( "Clearance Override" ), &ZONE::SetLocalClearance, &ZONE::GetLocalClearance, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Min Width" ), &ZONE::SetMinThickness, &ZONE::GetMinThickness, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + groupOverrides ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Pad Connections" ), - &ZONE::SetPadConnection, &ZONE::GetPadConnection ) ); + &ZONE::SetPadConnection, &ZONE::GetPadConnection ), + groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Gap" ), &ZONE::SetThermalReliefGap, &ZONE::GetThermalReliefGap, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + groupOverrides ); propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Relief Spoke Width" ), &ZONE::SetThermalReliefSpokeWidth, &ZONE::GetThermalReliefSpokeWidth, - PROPERTY_DISPLAY::PT_SIZE ) ); + PROPERTY_DISPLAY::PT_SIZE ), + groupOverrides ); } } _ZONE_DESC;