Tailor inspector text properties for dimension objects.

This commit is contained in:
Jeff Young 2023-05-25 15:58:31 +01:00
parent 5114d3b8c3
commit 50da4e483e
3 changed files with 89 additions and 20 deletions

View File

@ -26,7 +26,7 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
gbSizerLeader->SetFlexibleDirection( wxBOTH );
gbSizerLeader->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lblLeaderValue = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblLeaderValue = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblLeaderValue->Wrap( -1 );
gbSizerLeader->Add( m_lblLeaderValue, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -124,7 +124,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Value:</property>
<property name="label">Text:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@ -1337,28 +1337,52 @@ static struct DIMENSION_DESC
const wxString groupDimension = _HKI( "Dimension Properties" );
auto isLeader =
[]( INSPECTABLE* aItem ) -> bool
{
return dynamic_cast<PCB_DIM_LEADER*>( aItem ) != nullptr;
};
auto isNotLeader =
[]( INSPECTABLE* aItem ) -> bool
{
return dynamic_cast<PCB_DIM_LEADER*>( aItem ) == nullptr;
};
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Prefix" ),
&PCB_DIMENSION_BASE::ChangePrefix, &PCB_DIMENSION_BASE::GetPrefix ),
groupDimension );
groupDimension )
.SetAvailableFunc( isNotLeader );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Suffix" ),
&PCB_DIMENSION_BASE::ChangeSuffix, &PCB_DIMENSION_BASE::GetSuffix ),
groupDimension );
groupDimension )
.SetAvailableFunc( isNotLeader );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Override Text" ),
&PCB_DIMENSION_BASE::ChangeOverrideText, &PCB_DIMENSION_BASE::GetOverrideText ),
groupDimension );
groupDimension )
.SetAvailableFunc( isNotLeader );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Text" ),
&PCB_DIMENSION_BASE::ChangeOverrideText, &PCB_DIMENSION_BASE::GetOverrideText ),
groupDimension )
.SetAvailableFunc( isLeader );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_DIMENSION_BASE, DIM_UNITS_MODE>( _HKI( "Units" ),
&PCB_DIMENSION_BASE::ChangeUnitsMode, &PCB_DIMENSION_BASE::GetUnitsMode ),
groupDimension );
groupDimension )
.SetAvailableFunc( isNotLeader );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_DIMENSION_BASE, DIM_UNITS_FORMAT>( _HKI( "Units Format" ),
&PCB_DIMENSION_BASE::ChangeUnitsFormat, &PCB_DIMENSION_BASE::GetUnitsFormat ),
groupDimension );
groupDimension )
.SetAvailableFunc( isNotLeader );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_DIMENSION_BASE, DIM_PRECISION>( _HKI( "Precision" ),
&PCB_DIMENSION_BASE::ChangePrecision, &PCB_DIMENSION_BASE::GetPrecision ),
groupDimension );
groupDimension )
.SetAvailableFunc( isNotLeader );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, bool>( _HKI( "Suppress Trailing Zeroes" ),
&PCB_DIMENSION_BASE::ChangeSuppressZeroes, &PCB_DIMENSION_BASE::GetSuppressZeroes ),
groupDimension );
groupDimension )
.SetAvailableFunc( isNotLeader );
}
} _DIMENSION_DESC;
@ -1397,11 +1421,20 @@ static struct ALIGNED_DIMENSION_DESC
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
_HKI( "Text" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Vertical Justification" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} ALIGNED_DIMENSION_DESC;
@ -1423,15 +1456,24 @@ static struct ORTHOGONAL_DIMENSION_DESC
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( PCB_DIMENSION_BASE ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( PCB_DIM_ALIGNED ) );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Text" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Vertical Justification" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} ORTHOGONAL_DIMENSION_DESC;
@ -1458,15 +1500,24 @@ static struct RADIAL_DIMENSION_DESC
PROPERTY_DISPLAY::PT_SIZE ),
groupDimension );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Text" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Vertical Justification" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} RADIAL_DIMENSION_DESC;
@ -1501,11 +1552,20 @@ static struct LEADER_DIMENSION_DESC
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
_HKI( "Text" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Vertical Justification" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} LEADER_DIMENSION_DESC;
@ -1532,11 +1592,20 @@ static struct CENTER_DIMENSION_DESC
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
_HKI( "Text" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Vertical Justification" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} CENTER_DIMENSION_DESC;