Properties: Rename methods to better reflect their purposes

(cherry picked from commit 65193487a6)
This commit is contained in:
Jon Evans 2023-03-26 19:43:16 -04:00
parent 97b273905a
commit 23b03fd6ab
6 changed files with 24 additions and 24 deletions

View File

@ -394,7 +394,7 @@ static struct EDA_ITEM_DESC
propMgr.AddProperty( new PROPERTY_ENUM<EDA_ITEM, KICAD_T>( wxS( "Type" ),
NO_SETTER( EDA_ITEM, KICAD_T ), &EDA_ITEM::Type ) )
.SetIsInternal();
.SetIsHiddenFromPropertiesManager();
}
} _EDA_ITEM_DESC;

View File

@ -205,7 +205,7 @@ void PROPERTIES_PANEL::rebuildProperties( const SELECTION& aSelection )
// Find a set of properties that is common to all selected items
for( PROPERTY_BASE* property : commonProps )
{
if( property->IsInternal() )
if( property->IsHiddenFromPropertiesManager() )
continue;
if( propMgr.IsAvailableFor( TYPE_HASH( *firstItem ), property, firstItem ) )

View File

@ -185,8 +185,8 @@ PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
m_name( aName ),
m_display( aDisplay ),
m_coordType( aCoordType ),
m_isInternal( false ),
m_isDeprecated( false ),
m_hideFromPropertiesManager( false ),
m_hideFromRulesEditor( false ),
m_availFunc( [](INSPECTABLE*)->bool { return true; } ),
m_writeableFunc( [](INSPECTABLE*)->bool { return true; } ),
m_validator( NullValidator )
@ -279,17 +279,17 @@ PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
return *this;
}
bool IsInternal() const { return m_isInternal; }
PROPERTY_BASE& SetIsInternal( bool aIsInternal = true )
bool IsHiddenFromPropertiesManager() const { return m_hideFromPropertiesManager; }
PROPERTY_BASE& SetIsHiddenFromPropertiesManager( bool aHide = true )
{
m_isInternal = aIsInternal;
m_hideFromPropertiesManager = aHide;
return *this;
}
bool IsDeprecated() const { return m_isDeprecated; }
PROPERTY_BASE& SetIsDeprecated( bool aIsDeprecated = true )
bool IsHiddenFromRulesEditor() const { return m_hideFromRulesEditor; }
PROPERTY_BASE& SetIsHiddenFromRulesEditor( bool aHide = true )
{
m_isDeprecated = aIsDeprecated;
m_hideFromRulesEditor = aHide;
return *this;
}
@ -369,11 +369,11 @@ private:
/// The coordinate type controls how distances are mapped to the user coordinate system
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType;
/// Internal properties are hidden from the GUI but not from the rules editor autocomplete
bool m_isInternal;
/// Some properties should not be shown in the Properties Manager GUI
bool m_hideFromPropertiesManager;
/// Deprecated properties are hidden from the GUI and rules editor autocomplete
bool m_isDeprecated;
/// Some properties should not be shown in the Custom Rules editor autocomplete
bool m_hideFromRulesEditor;
/// Optional group identifier
wxString m_group;

View File

@ -171,26 +171,26 @@ static struct BOARD_CONNECTED_ITEM_DESC
auto netCode = new PROPERTY_ENUM<BOARD_CONNECTED_ITEM, int>( _HKI( "Net" ),
&BOARD_CONNECTED_ITEM::SetNetCode, &BOARD_CONNECTED_ITEM::GetNetCode );
netCode->SetIsDeprecated(); // Not really, but hide from rule editor suggestions
netCode->SetIsHiddenFromRulesEditor();
propMgr.AddProperty( netCode );
auto netClass = new PROPERTY<BOARD_CONNECTED_ITEM, wxString>( _HKI( "Net Class" ),
NO_SETTER( BOARD_CONNECTED_ITEM, wxString ),
&BOARD_CONNECTED_ITEM::GetNetClassName );
netClass->SetIsDeprecated(); // Not really, but hide from rule editor suggestions
netClass->SetIsHiddenFromRulesEditor();
propMgr.AddProperty( netClass );
// Compatibility alias for DRC engine
auto oldNetClass = new PROPERTY<BOARD_CONNECTED_ITEM, wxString>( _HKI( "NetClass" ),
NO_SETTER( BOARD_CONNECTED_ITEM, wxString ),
&BOARD_CONNECTED_ITEM::GetNetClassName );
oldNetClass->SetIsInternal();
oldNetClass->SetIsHiddenFromPropertiesManager();
propMgr.AddProperty( oldNetClass );
// Used only in DRC engine
auto oldNetName = new PROPERTY<BOARD_CONNECTED_ITEM, wxString>( _HKI( "NetName" ),
NO_SETTER( BOARD_CONNECTED_ITEM, wxString ), &BOARD_CONNECTED_ITEM::GetNetname );
oldNetName->SetIsInternal();
oldNetName->SetIsHiddenFromPropertiesManager();
propMgr.AddProperty( oldNetName );
}
} _BOARD_CONNECTED_ITEM_DESC;

View File

@ -442,10 +442,10 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
for( PROPERTY_BASE* prop : props )
{
// TODO: It would be nice to replace IsDeprecated with a property nickname
// TODO: It would be nice to replace IsHiddenFromRulesEditor with a nickname
// system, so that two different properies don't need to be created. This is
// a bigger change than I want to make right now, though.
if( prop->IsDeprecated() )
if( prop->IsHiddenFromRulesEditor() )
continue;
wxString ref( prop->Name() );

View File

@ -1414,13 +1414,13 @@ static struct ZONE_DESC
reinterpret_cast<int (ZONE::*)() const>( &ZONE::GetX ),
PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_X_COORD );
posX->SetIsInternal( true );
posX->SetIsHiddenFromPropertiesManager();
auto posY = new PROPERTY<ZONE, int>( _HKI( "Position Y" ), NO_SETTER( ZONE, int ),
reinterpret_cast<int (ZONE::*)() const>( &ZONE::GetY ),
PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_Y_COORD );
posY->SetIsInternal( true );
posY->SetIsHiddenFromPropertiesManager();
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position X" ), posX );
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position Y" ), posY );
@ -1443,13 +1443,13 @@ static struct ZONE_DESC
return false;
};
// Layer property is internal because it only holds a single layer and zones actually use
// Layer property is hidden because it only holds a single layer and zones actually use
// a layer set
propMgr.ReplaceProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Layer" ),
new PROPERTY_ENUM<ZONE, PCB_LAYER_ID>( _HKI( "Layer" ),
&ZONE::SetLayer,
&ZONE::GetLayer ) )
.SetIsInternal();
.SetIsHiddenFromPropertiesManager();
propMgr.OverrideAvailability( TYPE_HASH( ZONE ), TYPE_HASH( BOARD_CONNECTED_ITEM ),
_HKI( "Net" ), isCopperZone );