Always update geometry on dimension property change
Anything that changes the text may also need to change the geometry, as the text might cause knockouts of the dimension lines. Resolves several avenues for the property manager to make changes that 'forget' to update aspects of dimensions.
This commit is contained in:
parent
af74d2a746
commit
882c766493
|
@ -194,7 +194,7 @@ void PCB_DIMENSION_BASE::ClearRenderCache()
|
||||||
if( !m_inClearRenderCache )
|
if( !m_inClearRenderCache )
|
||||||
{
|
{
|
||||||
m_inClearRenderCache = true;
|
m_inClearRenderCache = true;
|
||||||
updateText();
|
Update();
|
||||||
m_inClearRenderCache = false;
|
m_inClearRenderCache = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ void PCB_DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_DIMENSION_BASE::SetTextAngleDegreesProp( double aDegrees )
|
void PCB_DIMENSION_BASE::ChangeTextAngleDegrees( double aDegrees )
|
||||||
{
|
{
|
||||||
SetTextAngleDegrees( aDegrees );
|
SetTextAngleDegrees( aDegrees );
|
||||||
// Create or repair any knockouts
|
// Create or repair any knockouts
|
||||||
|
@ -321,7 +321,7 @@ void PCB_DIMENSION_BASE::SetTextAngleDegreesProp( double aDegrees )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_DIMENSION_BASE::SetKeepTextAlignedProp( bool aKeepAligned )
|
void PCB_DIMENSION_BASE::ChangeKeepTextAligned( bool aKeepAligned )
|
||||||
{
|
{
|
||||||
SetKeepTextAligned( aKeepAligned );
|
SetKeepTextAligned( aKeepAligned );
|
||||||
// Re-align the text and repair any knockouts
|
// Re-align the text and repair any knockouts
|
||||||
|
@ -1509,12 +1509,12 @@ static struct DIMENSION_DESC
|
||||||
};
|
};
|
||||||
|
|
||||||
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, bool>( _HKI( "Keep Aligned with Dimension" ),
|
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, bool>( _HKI( "Keep Aligned with Dimension" ),
|
||||||
&PCB_DIMENSION_BASE::SetKeepTextAlignedProp,
|
&PCB_DIMENSION_BASE::ChangeKeepTextAligned,
|
||||||
&PCB_DIMENSION_BASE::GetKeepTextAligned ),
|
&PCB_DIMENSION_BASE::GetKeepTextAligned ),
|
||||||
groupText );
|
groupText );
|
||||||
|
|
||||||
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, double>( _HKI( "Orientation" ),
|
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, double>( _HKI( "Orientation" ),
|
||||||
&PCB_DIMENSION_BASE::SetTextAngleDegreesProp,
|
&PCB_DIMENSION_BASE::ChangeTextAngleDegrees,
|
||||||
&PCB_DIMENSION_BASE::GetTextAngleDegreesProp,
|
&PCB_DIMENSION_BASE::GetTextAngleDegreesProp,
|
||||||
PROPERTY_DISPLAY::PT_DEGREE ),
|
PROPERTY_DISPLAY::PT_DEGREE ),
|
||||||
groupText )
|
groupText )
|
||||||
|
|
|
@ -135,7 +135,7 @@ public:
|
||||||
{
|
{
|
||||||
SetOverrideTextEnabled( true );
|
SetOverrideTextEnabled( true );
|
||||||
SetOverrideText( aValue );
|
SetOverrideText( aValue );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetMeasuredValue() const { return m_measuredValue; }
|
int GetMeasuredValue() const { return m_measuredValue; }
|
||||||
|
@ -150,17 +150,21 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the dimension's cached text and geometry.
|
* Update the dimension's cached text and geometry.
|
||||||
|
*
|
||||||
|
* Call this whenever you change something in the geometry
|
||||||
|
* definition, or the text (which can affect geometry, e.g. by
|
||||||
|
* a knockout of a crossbar line or similar)
|
||||||
*/
|
*/
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
// Calls updateText internally
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
updateText();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateUnits()
|
void UpdateUnits()
|
||||||
{
|
{
|
||||||
SetUnitsMode( GetUnitsMode() );
|
SetUnitsMode( GetUnitsMode() );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetPrefix() const { return m_prefix; }
|
wxString GetPrefix() const { return m_prefix; }
|
||||||
|
@ -169,7 +173,7 @@ public:
|
||||||
void ChangePrefix( const wxString& aPrefix )
|
void ChangePrefix( const wxString& aPrefix )
|
||||||
{
|
{
|
||||||
SetPrefix( aPrefix );
|
SetPrefix( aPrefix );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetSuffix() const { return m_suffix; }
|
wxString GetSuffix() const { return m_suffix; }
|
||||||
|
@ -178,7 +182,7 @@ public:
|
||||||
void ChangeSuffix( const wxString& aSuffix )
|
void ChangeSuffix( const wxString& aSuffix )
|
||||||
{
|
{
|
||||||
SetSuffix( aSuffix );
|
SetSuffix( aSuffix );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_UNITS GetUnits() const { return m_units; }
|
EDA_UNITS GetUnits() const { return m_units; }
|
||||||
|
@ -190,7 +194,7 @@ public:
|
||||||
void ChangeUnitsMode( DIM_UNITS_MODE aMode )
|
void ChangeUnitsMode( DIM_UNITS_MODE aMode )
|
||||||
{
|
{
|
||||||
SetUnitsMode( aMode );
|
SetUnitsMode( aMode );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAutoUnits( bool aAuto = true ) { m_autoUnits = aAuto; }
|
void SetAutoUnits( bool aAuto = true ) { m_autoUnits = aAuto; }
|
||||||
|
@ -201,7 +205,7 @@ public:
|
||||||
void ChangeUnitsFormat( const DIM_UNITS_FORMAT aFormat )
|
void ChangeUnitsFormat( const DIM_UNITS_FORMAT aFormat )
|
||||||
{
|
{
|
||||||
SetUnitsFormat( aFormat );
|
SetUnitsFormat( aFormat );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
DIM_PRECISION GetPrecision() const { return m_precision; }
|
DIM_PRECISION GetPrecision() const { return m_precision; }
|
||||||
|
@ -210,7 +214,7 @@ public:
|
||||||
void ChangePrecision( DIM_PRECISION aPrecision )
|
void ChangePrecision( DIM_PRECISION aPrecision )
|
||||||
{
|
{
|
||||||
SetPrecision( aPrecision );
|
SetPrecision( aPrecision );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetSuppressZeroes() const { return m_suppressZeroes; }
|
bool GetSuppressZeroes() const { return m_suppressZeroes; }
|
||||||
|
@ -219,15 +223,15 @@ public:
|
||||||
void ChangeSuppressZeroes( bool aSuppress )
|
void ChangeSuppressZeroes( bool aSuppress )
|
||||||
{
|
{
|
||||||
SetSuppressZeroes( aSuppress );
|
SetSuppressZeroes( aSuppress );
|
||||||
updateText();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetKeepTextAligned() const { return m_keepTextAligned; }
|
bool GetKeepTextAligned() const { return m_keepTextAligned; }
|
||||||
void SetKeepTextAligned( bool aKeepAligned ) { m_keepTextAligned = aKeepAligned; }
|
void SetKeepTextAligned( bool aKeepAligned ) { m_keepTextAligned = aKeepAligned; }
|
||||||
|
|
||||||
double GetTextAngleDegreesProp() const { return GetTextAngleDegrees(); }
|
double GetTextAngleDegreesProp() const { return GetTextAngleDegrees(); }
|
||||||
void SetTextAngleDegreesProp( double aDegrees );
|
void ChangeTextAngleDegrees( double aDegrees );
|
||||||
void SetKeepTextAlignedProp( bool aKeepAligned );
|
void ChangeKeepTextAligned( bool aKeepAligned );
|
||||||
|
|
||||||
void SetTextPositionMode( DIM_TEXT_POSITION aMode ) { m_textPosition = aMode; }
|
void SetTextPositionMode( DIM_TEXT_POSITION aMode ) { m_textPosition = aMode; }
|
||||||
DIM_TEXT_POSITION GetTextPositionMode() const { return m_textPosition; }
|
DIM_TEXT_POSITION GetTextPositionMode() const { return m_textPosition; }
|
||||||
|
@ -299,6 +303,9 @@ protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the text field value from the current geometry (called by updateGeometry normally).
|
* Update the text field value from the current geometry (called by updateGeometry normally).
|
||||||
|
*
|
||||||
|
* If you change the text, you should call updateGeometry which will call this,
|
||||||
|
* and also handle any text-dependent geoemtry handling (like a knockout)
|
||||||
*/
|
*/
|
||||||
virtual void updateText();
|
virtual void updateText();
|
||||||
|
|
||||||
|
@ -410,7 +417,7 @@ public:
|
||||||
void ChangeHeight( int aHeight )
|
void ChangeHeight( int aHeight )
|
||||||
{
|
{
|
||||||
SetHeight( aHeight );
|
SetHeight( aHeight );
|
||||||
updateGeometry();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,7 +433,7 @@ public:
|
||||||
void ChangeExtensionHeight( int aHeight )
|
void ChangeExtensionHeight( int aHeight )
|
||||||
{
|
{
|
||||||
SetExtensionHeight( aHeight );
|
SetExtensionHeight( aHeight );
|
||||||
updateGeometry();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -557,7 +564,7 @@ public:
|
||||||
void ChangeLeaderLength( int aLength )
|
void ChangeLeaderLength( int aLength )
|
||||||
{
|
{
|
||||||
SetLeaderLength( aLength );
|
SetLeaderLength( aLength );
|
||||||
updateGeometry();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the point (c).
|
// Returns the point (c).
|
||||||
|
@ -620,7 +627,7 @@ public:
|
||||||
void ChangeTextBorder( DIM_TEXT_BORDER aBorder )
|
void ChangeTextBorder( DIM_TEXT_BORDER aBorder )
|
||||||
{
|
{
|
||||||
SetTextBorder( aBorder );
|
SetTextBorder( aBorder );
|
||||||
updateGeometry();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||||
|
|
Loading…
Reference in New Issue