Add Property Inspector support for dimension objects.

Includes changing the class hierarchy so that dimension objects inherit
from PCB_TEXT rather than containing a PCB_TEXT member variable.
This commit is contained in:
Jeff Young 2023-03-04 23:15:43 +00:00
parent 610e787ada
commit 23accffc6d
19 changed files with 476 additions and 228 deletions

View File

@ -145,7 +145,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner )
{
addText( &aDimension->Text(), aContainer, aDimension );
addText( aDimension, aContainer, aDimension );
const int linewidth = aDimension->GetLineThickness();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2023 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -227,16 +227,14 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
m_cbSuppressZeroes->SetValue( m_dimension->GetSuppressZeroes() );
PCB_TEXT& text = m_dimension->Text();
m_fontCtrl->SetFontSelection( m_dimension->GetFont() );
m_fontCtrl->SetFontSelection( text.GetFont() );
m_textWidth.SetValue( m_dimension->GetTextSize().x );
m_textHeight.SetValue( m_dimension->GetTextSize().y );
m_textThickness.SetValue( m_dimension->GetTextThickness() );
m_textWidth.SetValue( text.GetTextSize().x );
m_textHeight.SetValue( text.GetTextSize().y );
m_textThickness.SetValue( text.GetTextThickness() );
m_textPosX.SetValue( text.GetTextPos().x );
m_textPosY.SetValue( text.GetTextPos().y );
m_textPosX.SetValue( m_dimension->GetTextPos().x );
m_textPosY.SetValue( m_dimension->GetTextPos().y );
m_cbTextPositionMode->SetSelection( static_cast<int>( m_dimension->GetTextPositionMode() ) );
if( m_dimension->GetTextPositionMode() != DIM_TEXT_POSITION::MANUAL )
@ -245,22 +243,22 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
m_txtTextPosY->Disable();
}
EDA_ANGLE orientation = text.GetTextAngle();
EDA_ANGLE orientation = m_dimension->GetTextAngle();
m_orientation.SetAngleValue( orientation.Normalize180() );
m_cbTextOrientation->Enable( !m_dimension->GetKeepTextAligned() );
m_cbKeepAligned->SetValue( m_dimension->GetKeepTextAligned() );
m_bold->Check( text.IsBold() );
m_italic->Check( text.IsItalic() );
m_bold->Check( m_dimension->IsBold() );
m_italic->Check( m_dimension->IsItalic() );
switch ( text.GetHorizJustify() )
switch ( m_dimension->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
}
m_mirrored->Check( text.IsMirrored() );
m_mirrored->Check( m_dimension->IsMirrored() );
m_lineThickness.SetValue( m_dimension->GetLineThickness() );
m_arrowLength.SetValue( m_dimension->GetArrowLength() );
@ -407,38 +405,36 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE*
aTarget->SetPrecision( m_cbPrecision->GetSelection() );
aTarget->SetSuppressZeroes( m_cbSuppressZeroes->GetValue() );
PCB_TEXT& text = aTarget->Text();
DIM_TEXT_POSITION tpm = static_cast<DIM_TEXT_POSITION>( m_cbTextPositionMode->GetSelection() );
aTarget->SetTextPositionMode( tpm );
if( tpm == DIM_TEXT_POSITION::MANUAL )
{
VECTOR2I pos( m_textPosX.GetValue(), m_textPosY.GetValue() );
text.SetPosition( pos );
aTarget->SetTextPos( pos );
}
aTarget->SetKeepTextAligned( m_cbKeepAligned->GetValue() );
text.SetTextAngle( m_orientation.GetAngleValue().Normalize() );
text.SetTextWidth( m_textWidth.GetValue() );
text.SetTextHeight( m_textHeight.GetValue() );
text.SetTextThickness( m_textThickness.GetValue() );
aTarget->SetTextAngle( m_orientation.GetAngleValue().Normalize() );
aTarget->SetTextWidth( m_textWidth.GetValue() );
aTarget->SetTextHeight( m_textHeight.GetValue() );
aTarget->SetTextThickness( m_textThickness.GetValue() );
if( m_fontCtrl->HaveFontSelection() )
text.SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(), m_italic->IsChecked() ) );
aTarget->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(), m_italic->IsChecked() ) );
text.SetBold( m_bold->IsChecked() );
text.SetItalic( m_italic->IsChecked() );
aTarget->SetBold( m_bold->IsChecked() );
aTarget->SetItalic( m_italic->IsChecked() );
if( m_alignLeft->IsChecked() )
text.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
aTarget->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
else if( m_alignCenter->IsChecked() )
text.SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
aTarget->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
else
text.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
aTarget->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
text.SetMirrored( m_mirrored->IsChecked() );
aTarget->SetMirrored( m_mirrored->IsChecked() );
aTarget->SetLineThickness( m_lineThickness.GetValue() );
aTarget->SetArrowLength( m_arrowLength.GetValue() );
@ -457,5 +453,5 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE*
void DIALOG_DIMENSION_PROPERTIES::updatePreviewText()
{
updateDimensionFromDialog( m_previewDimension );
m_staticTextPreview->SetLabel( m_previewDimension->Text().GetShownText() );
m_staticTextPreview->SetLabel( m_previewDimension->GetShownText() );
}

View File

@ -332,9 +332,6 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem );
PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( aItem );
if( dimension )
edaText = &dimension->Text();
if( m_setToSpecifiedValues->GetValue() )
{
if( m_LayerCtrl->GetLayerSelection() != UNDEFINED_LAYER )

View File

@ -4,7 +4,7 @@
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -42,7 +42,7 @@ static const EDA_ANGLE s_arrowAngle( 27.5, DEGREES_T );
PCB_DIMENSION_BASE::PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) :
BOARD_ITEM( aParent, aType ),
PCB_TEXT( aParent, aType ),
m_overrideTextEnabled( false ),
m_units( EDA_UNITS::INCHES ),
m_autoUnits( false ),
@ -54,20 +54,13 @@ PCB_DIMENSION_BASE::PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) :
m_extensionOffset( 0 ),
m_textPosition( DIM_TEXT_POSITION::OUTSIDE ),
m_keepTextAligned( true ),
m_text( aParent ),
m_measuredValue( 0 )
m_measuredValue( 0 ),
m_inClearRenderCache( false )
{
m_layer = Dwgs_User;
}
void PCB_DIMENSION_BASE::SetParent( EDA_ITEM* aParent )
{
BOARD_ITEM::SetParent( aParent );
m_text.SetParent( aParent );
}
void PCB_DIMENSION_BASE::updateText()
{
wxString text = m_overrideTextEnabled ? m_valueString : GetValueText();
@ -89,7 +82,23 @@ void PCB_DIMENSION_BASE::updateText()
text.Prepend( m_prefix );
text.Append( m_suffix );
m_text.SetText( text );
SetText( text );
}
void PCB_DIMENSION_BASE::ClearRenderCache()
{
PCB_TEXT::ClearRenderCache();
// We use EDA_TEXT::ClearRenderCache() as a signal that the properties of the EDA_TEXT
// have changed and we may need to update the dimension text
if( !m_inClearRenderCache )
{
m_inClearRenderCache = true;
updateText();
m_inClearRenderCache = false;
}
}
@ -193,29 +202,9 @@ void PCB_DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode )
}
void PCB_DIMENSION_BASE::SetText( const wxString& aNewText )
{
m_valueString = aNewText;
updateText();
}
const wxString PCB_DIMENSION_BASE::GetText() const
{
return m_text.GetText();
}
void PCB_DIMENSION_BASE::SetLayer( PCB_LAYER_ID aLayer )
{
m_layer = aLayer;
m_text.SetLayer( aLayer );
}
void PCB_DIMENSION_BASE::Move( const VECTOR2I& offset )
{
m_text.Offset( offset );
PCB_TEXT::Offset( offset );
m_start += offset;
m_end += offset;
@ -226,15 +215,15 @@ void PCB_DIMENSION_BASE::Move( const VECTOR2I& offset )
void PCB_DIMENSION_BASE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
{
EDA_ANGLE newAngle = m_text.GetTextAngle() + aAngle;
EDA_ANGLE newAngle = GetTextAngle() + aAngle;
newAngle.Normalize();
m_text.SetTextAngle( newAngle );
SetTextAngle( newAngle );
VECTOR2I pt = m_text.GetTextPos();
VECTOR2I pt = GetTextPos();
RotatePoint( pt, aRotCentre, aAngle );
m_text.SetTextPos( pt );
SetTextPos( pt );
RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( m_end, aRotCentre, aAngle );
@ -254,7 +243,7 @@ void PCB_DIMENSION_BASE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
void PCB_DIMENSION_BASE::Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight )
{
int axis = aMirrorLeftRight ? axis_pos.x : axis_pos.y;
VECTOR2I newPos = m_text.GetTextPos();
VECTOR2I newPos = GetTextPos();
#define INVERT( pos ) ( ( pos ) = axis - ( ( pos ) - axis ) )
if( aMirrorLeftRight )
@ -262,10 +251,10 @@ void PCB_DIMENSION_BASE::Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight
else
INVERT( newPos.y );
m_text.SetTextPos( newPos );
SetTextPos( newPos );
// invert angle
m_text.SetTextAngle( -m_text.GetTextAngle() );
SetTextAngle( -GetTextAngle() );
if( aMirrorLeftRight )
{
@ -279,7 +268,7 @@ void PCB_DIMENSION_BASE::Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight
}
if( ( GetLayerSet() & LSET::SideSpecificMask() ).any() )
m_text.SetMirrored( !m_text.IsMirrored() );
SetMirrored( !IsMirrored() );
Update();
}
@ -293,7 +282,7 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
wxCHECK_RET( m_parent != nullptr, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) );
aList.emplace_back( _( "Dimension" ), m_text.GetShownText() );
aList.emplace_back( _( "Dimension" ), GetShownText() );
aList.emplace_back( _( "Prefix" ), GetPrefix() );
@ -326,13 +315,10 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
aList.emplace_back( _( "Units" ), EDA_UNIT_UTILS::GetLabel( GetUnits() ) );
aList.emplace_back( _( "Font" ), m_text.GetFont() ? m_text.GetFont()->GetName() : _( "Default" ) );
aList.emplace_back( _( "Text Thickness" ),
unitsProvider.MessageTextFromValue( m_text.GetTextThickness() ) );
aList.emplace_back( _( "Text Width" ),
unitsProvider.MessageTextFromValue( m_text.GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ),
unitsProvider.MessageTextFromValue( m_text.GetTextHeight() ) );
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
aList.emplace_back( _( "Text Thickness" ), unitsProvider.MessageTextFromValue( GetTextThickness() ) );
aList.emplace_back( _( "Text Width" ), unitsProvider.MessageTextFromValue( GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ), unitsProvider.MessageTextFromValue( GetTextHeight() ) );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
@ -370,7 +356,7 @@ std::shared_ptr<SHAPE> PCB_DIMENSION_BASE::GetEffectiveShape( PCB_LAYER_ID aLaye
{
std::shared_ptr<SHAPE_COMPOUND> effectiveShape = std::make_shared<SHAPE_COMPOUND>();
effectiveShape->AddShape( Text().GetEffectiveTextShape()->Clone() );
effectiveShape->AddShape( GetEffectiveTextShape()->Clone() );
for( const std::shared_ptr<SHAPE>& shape : GetShapes() )
effectiveShape->AddShape( shape->Clone() );
@ -381,7 +367,7 @@ std::shared_ptr<SHAPE> PCB_DIMENSION_BASE::GetEffectiveShape( PCB_LAYER_ID aLaye
bool PCB_DIMENSION_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
if( m_text.TextHitTest( aPosition ) )
if( TextHitTest( aPosition ) )
return true;
int dist_max = aAccuracy + ( m_lineThickness / 2 );
@ -420,7 +406,7 @@ const BOX2I PCB_DIMENSION_BASE::GetBoundingBox() const
BOX2I bBox;
int xmin, xmax, ymin, ymax;
bBox = m_text.GetTextBox();
bBox = GetTextBox();
xmin = bBox.GetX();
xmax = bBox.GetRight();
ymin = bBox.GetY();
@ -459,7 +445,7 @@ const BOX2I PCB_DIMENSION_BASE::ViewBBox() const
{
BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
VECTOR2I( GetBoundingBox().GetSize() ) );
dimBBox.Merge( m_text.ViewBBox() );
dimBBox.Merge( PCB_TEXT::ViewBBox() );
return dimBBox;
}
@ -639,8 +625,7 @@ void PCB_DIM_ALIGNED::updateGeometry()
// Now that we have the text updated, we can determine how to draw the crossbar.
// First we need to create an appropriate bounding polygon to collide with
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
- m_text.GetEffectiveTextPenWidth() );
BOX2I textBox = GetTextBox().Inflate( GetTextWidth() / 2, - GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;
polyBox.NewOutline();
@ -648,7 +633,7 @@ void PCB_DIM_ALIGNED::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
polyBox.Rotate( GetTextAngle(), textBox.GetCenter() );
// The ideal crossbar, if the text doesn't collide
SEG crossbar( m_crossBarStart, m_crossBarEnd );
@ -688,7 +673,7 @@ void PCB_DIM_ALIGNED::updateText()
if( m_textPosition == DIM_TEXT_POSITION::OUTSIDE )
{
int textOffsetDistance = m_text.GetEffectiveTextPenWidth() + m_text.GetTextHeight();
int textOffsetDistance = GetEffectiveTextPenWidth() + GetTextHeight();
EDA_ANGLE rotation;
if( crossbarCenter.x == 0 )
@ -702,11 +687,11 @@ void PCB_DIM_ALIGNED::updateText()
RotatePoint( textOffset, rotation );
textOffset = crossbarCenter + textOffset.Resize( textOffsetDistance );
m_text.SetTextPos( m_crossBarStart + textOffset );
SetTextPos( m_crossBarStart + textOffset );
}
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
{
m_text.SetTextPos( m_crossBarStart + crossbarCenter );
SetTextPos( m_crossBarStart + crossbarCenter );
}
if( m_keepTextAligned )
@ -717,7 +702,7 @@ void PCB_DIM_ALIGNED::updateText()
if( textAngle > ANGLE_90 && textAngle <= ANGLE_270 )
textAngle -= ANGLE_180;
m_text.SetTextAngle( textAngle );
SetTextAngle( textAngle );
}
PCB_DIMENSION_BASE::updateText();
@ -822,8 +807,7 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
// Now that we have the text updated, we can determine how to draw the crossbar.
// First we need to create an appropriate bounding polygon to collide with
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
m_text.GetEffectiveTextPenWidth() );
BOX2I textBox = GetTextBox().Inflate( GetTextWidth() / 2, GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;
polyBox.NewOutline();
@ -831,7 +815,7 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
polyBox.Rotate( GetTextAngle(), textBox.GetCenter() );
// The ideal crossbar, if the text doesn't collide
SEG crossbar( m_crossBarStart, m_crossBarEnd );
@ -872,7 +856,7 @@ void PCB_DIM_ORTHOGONAL::updateText()
if( m_textPosition == DIM_TEXT_POSITION::OUTSIDE )
{
int textOffsetDistance = m_text.GetEffectiveTextPenWidth() + m_text.GetTextHeight();
int textOffsetDistance = GetEffectiveTextPenWidth() + GetTextHeight();
VECTOR2I textOffset;
@ -883,22 +867,22 @@ void PCB_DIM_ORTHOGONAL::updateText()
textOffset += crossbarCenter;
m_text.SetTextPos( m_crossBarStart + textOffset );
SetTextPos( m_crossBarStart + textOffset );
}
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
{
m_text.SetTextPos( m_crossBarStart + crossbarCenter );
SetTextPos( m_crossBarStart + crossbarCenter );
}
if( m_keepTextAligned )
{
if( abs( crossbarCenter.x ) > abs( crossbarCenter.y ) )
m_text.SetTextAngle( ANGLE_HORIZONTAL );
SetTextAngle( ANGLE_HORIZONTAL );
else
m_text.SetTextAngle( ANGLE_VERTICAL );
SetTextAngle( ANGLE_VERTICAL );
}
PCB_DIMENSION_BASE::updateText();
PCB_DIM_ALIGNED::updateText();
}
@ -959,7 +943,7 @@ PCB_DIM_LEADER::PCB_DIM_LEADER( BOARD_ITEM* aParent, bool aInFP ) :
m_overrideTextEnabled = true;
m_keepTextAligned = false;
SetText( _( "Leader" ) );
SetOverrideText( _( "Leader" ) );
}
@ -996,8 +980,7 @@ void PCB_DIM_LEADER::updateGeometry()
// Now that we have the text updated, we can determine how to draw the second line
// First we need to create an appropriate bounding polygon to collide with
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
m_text.GetEffectiveTextPenWidth() * 2 );
BOX2I textBox = GetTextBox().Inflate( GetTextWidth() / 2, GetEffectiveTextPenWidth() * 2 );
SHAPE_POLY_SET polyBox;
polyBox.NewOutline();
@ -1005,20 +988,20 @@ void PCB_DIM_LEADER::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
polyBox.Rotate( GetTextAngle(), textBox.GetCenter() );
VECTOR2I firstLine( m_end - m_start );
VECTOR2I start( m_start );
start += firstLine.Resize( m_extensionOffset );
SEG arrowSeg( m_start, m_end );
SEG textSeg( m_end, m_text.GetPosition() );
SEG textSeg( m_end, GetTextPos() );
OPT_VECTOR2I arrowSegEnd;
OPT_VECTOR2I textSegEnd;
if( m_textBorder == DIM_TEXT_BORDER::CIRCLE )
{
double penWidth = m_text.GetEffectiveTextPenWidth() / 2.0;
double penWidth = GetEffectiveTextPenWidth() / 2.0;
double radius = ( textBox.GetWidth() / 2.0 ) - penWidth;
CIRCLE circle( textBox.GetCenter(), radius );
@ -1060,7 +1043,7 @@ void PCB_DIM_LEADER::updateGeometry()
case DIM_TEXT_BORDER::CIRCLE:
{
double penWidth = m_text.GetEffectiveTextPenWidth() / 2.0;
double penWidth = GetEffectiveTextPenWidth() / 2.0;
double radius = ( textBox.GetWidth() / 2.0 ) - penWidth;
m_shapes.emplace_back( new SHAPE_CIRCLE( textBox.GetCenter(), radius ) );
@ -1077,9 +1060,26 @@ void PCB_DIM_LEADER::updateGeometry()
}
void PCB_DIM_LEADER::ClearRenderCache()
{
PCB_DIMENSION_BASE::ClearRenderCache();
// We use EDA_TEXT::ClearRenderCache() as a signal that the properties of the EDA_TEXT
// have changed and we may need to update the dimension text
if( !m_inClearRenderCache )
{
m_inClearRenderCache = true;
updateText();
updateGeometry();
m_inClearRenderCache = false;
}
}
void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
aList.emplace_back( _( "Leader" ), m_text.GetShownText() );
aList.emplace_back( _( "Leader" ), GetShownText() );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
@ -1143,7 +1143,7 @@ void PCB_DIM_RADIAL::updateText()
{
if( m_keepTextAligned )
{
VECTOR2I textLine( Text().GetPosition() - GetKnee() );
VECTOR2I textLine( GetTextPos() - GetKnee() );
EDA_ANGLE textAngle = FULL_CIRCLE - EDA_ANGLE( textLine );
textAngle.Normalize();
@ -1154,7 +1154,7 @@ void PCB_DIM_RADIAL::updateText()
// Round to nearest degree
textAngle = EDA_ANGLE( KiROUND( textAngle.AsDegrees() ), DEGREES_T );
m_text.SetTextAngle( textAngle );
SetTextAngle( textAngle );
}
PCB_DIMENSION_BASE::updateText();
@ -1185,8 +1185,7 @@ void PCB_DIM_RADIAL::updateGeometry()
// Now that we have the text updated, we can determine how to draw the second line
// First we need to create an appropriate bounding polygon to collide with
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
m_text.GetEffectiveTextPenWidth() );
BOX2I textBox = GetTextBox().Inflate( GetTextWidth() / 2, GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;
polyBox.NewOutline();
@ -1194,13 +1193,13 @@ void PCB_DIM_RADIAL::updateGeometry()
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( m_text.GetTextAngle(), textBox.GetCenter() );
polyBox.Rotate( GetTextAngle(), textBox.GetCenter() );
VECTOR2I radial( m_end - m_start );
radial = radial.Resize( m_leaderLength );
SEG arrowSeg( m_end, m_end + radial );
SEG textSeg( arrowSeg.B, m_text.GetPosition() );
SEG textSeg( arrowSeg.B, GetTextPos() );
OPT_VECTOR2I arrowSegEnd = segPolyIntersection( polyBox, arrowSeg );
OPT_VECTOR2I textSegEnd = segPolyIntersection( polyBox, textSeg );
@ -1297,14 +1296,228 @@ static struct DIMENSION_DESC
{
DIMENSION_DESC()
{
ENUM_MAP<DIM_UNITS_FORMAT>::Instance()
.Map( DIM_UNITS_FORMAT::NO_SUFFIX, _HKI( "1234.0" ) )
.Map( DIM_UNITS_FORMAT::BARE_SUFFIX, _HKI( "1234.0 mm" ) )
.Map( DIM_UNITS_FORMAT::PAREN_SUFFIX, _HKI( "1234.0 (mm)" ) );
ENUM_MAP<DIM_UNITS_MODE>::Instance()
.Map( DIM_UNITS_MODE::INCHES, _HKI( "Inches" ) )
.Map( DIM_UNITS_MODE::MILS, _HKI( "Mils" ) )
.Map( DIM_UNITS_MODE::MILLIMETRES, _HKI( "Millimeters" ) )
.Map( DIM_UNITS_MODE::AUTOMATIC, _HKI( "Automatic" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIMENSION_BASE );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIMENSION_BASE, PCB_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIMENSION_BASE, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIMENSION_BASE, EDA_TEXT> );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIMENSION_BASE ), TYPE_HASH( PCB_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIMENSION_BASE ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIMENSION_BASE ), TYPE_HASH( EDA_TEXT ) );
const wxString groupDimension = _HKI( "Dimension Properties" );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Prefix" ),
&PCB_DIMENSION_BASE::ChangePrefix, &PCB_DIMENSION_BASE::GetPrefix ),
groupDimension );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Suffix" ),
&PCB_DIMENSION_BASE::ChangeSuffix, &PCB_DIMENSION_BASE::GetSuffix ),
groupDimension );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, wxString>( _HKI( "Override Text" ),
&PCB_DIMENSION_BASE::SetOverrideText, &PCB_DIMENSION_BASE::GetOverrideText ),
&PCB_DIMENSION_BASE::ChangeOverrideText, &PCB_DIMENSION_BASE::GetOverrideText ),
groupDimension );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_DIMENSION_BASE, DIM_UNITS_MODE>( _HKI( "Units" ),
&PCB_DIMENSION_BASE::ChangeUnitsMode, &PCB_DIMENSION_BASE::GetUnitsMode ),
groupDimension );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_DIMENSION_BASE, DIM_UNITS_FORMAT>( _HKI( "Units Format" ),
&PCB_DIMENSION_BASE::ChangeUnitsFormat, &PCB_DIMENSION_BASE::GetUnitsFormat ),
groupDimension );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, int>( _HKI( "Precision" ),
&PCB_DIMENSION_BASE::ChangePrecision, &PCB_DIMENSION_BASE::GetPrecision ),
groupDimension );
propMgr.AddProperty( new PROPERTY<PCB_DIMENSION_BASE, bool>( _HKI( "Suppress Trailing Zeroes" ),
&PCB_DIMENSION_BASE::ChangeSuppressZeroes, &PCB_DIMENSION_BASE::GetSuppressZeroes ),
groupDimension );
}
} _DIMENSION_DESC;
ENUM_TO_WXANY( DIM_UNITS_FORMAT )
ENUM_TO_WXANY( DIM_UNITS_MODE )
static struct ALIGNED_DIMENSION_DESC
{
ALIGNED_DIMENSION_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIM_ALIGNED );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ALIGNED, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ALIGNED, EDA_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ALIGNED, PCB_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ALIGNED, PCB_DIMENSION_BASE> );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( PCB_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( PCB_DIMENSION_BASE ) );
const wxString groupDimension = _HKI( "Dimension Properties" );
propMgr.AddProperty( new PROPERTY<PCB_DIM_ALIGNED, int>( _HKI( "Crossbar Height" ),
&PCB_DIM_ALIGNED::ChangeHeight, &PCB_DIM_ALIGNED::GetHeight,
PROPERTY_DISPLAY::PT_SIZE ),
groupDimension );
propMgr.AddProperty( new PROPERTY<PCB_DIM_ALIGNED, int>( _HKI( "Extension Line Overshoot" ),
&PCB_DIM_ALIGNED::ChangeExtensionHeight, &PCB_DIM_ALIGNED::GetExtensionHeight,
PROPERTY_DISPLAY::PT_SIZE ),
groupDimension );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} ALIGNED_DIMENSION_DESC;
static struct ORTHOGONAL_DIMENSION_DESC
{
ORTHOGONAL_DIMENSION_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIM_ORTHOGONAL );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ORTHOGONAL, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ORTHOGONAL, EDA_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ORTHOGONAL, PCB_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ORTHOGONAL, PCB_DIMENSION_BASE> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_ORTHOGONAL, PCB_DIM_ALIGNED> );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( EDA_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( PCB_TEXT ) );
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 ),
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} ORTHOGONAL_DIMENSION_DESC;
static struct RADIAL_DIMENSION_DESC
{
RADIAL_DIMENSION_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIM_RADIAL );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_RADIAL, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_RADIAL, EDA_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_RADIAL, PCB_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_RADIAL, PCB_DIMENSION_BASE> );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( EDA_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( PCB_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( PCB_DIMENSION_BASE ) );
const wxString groupDimension = _HKI( "Dimension Properties" );
propMgr.AddProperty( new PROPERTY<PCB_DIM_RADIAL, int>( _HKI( "Leader Length" ),
&PCB_DIM_RADIAL::ChangeLeaderLength, &PCB_DIM_RADIAL::GetLeaderLength,
PROPERTY_DISPLAY::PT_SIZE ),
groupDimension );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} RADIAL_DIMENSION_DESC;
static struct LEADER_DIMENSION_DESC
{
LEADER_DIMENSION_DESC()
{
ENUM_MAP<DIM_TEXT_BORDER>::Instance()
.Map( DIM_TEXT_BORDER::NONE, _HKI( "None" ) )
.Map( DIM_TEXT_BORDER::RECTANGLE, _HKI( "Rectangle" ) )
.Map( DIM_TEXT_BORDER::CIRCLE, _HKI( "Circle" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIM_LEADER );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_LEADER, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_LEADER, EDA_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_LEADER, PCB_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_LEADER, PCB_DIMENSION_BASE> );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( PCB_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( PCB_DIMENSION_BASE ) );
const wxString groupDimension = _HKI( "Dimension Properties" );
propMgr.AddProperty( new PROPERTY_ENUM<PCB_DIM_LEADER, DIM_TEXT_BORDER>( _HKI( "Text Frame" ),
&PCB_DIM_LEADER::ChangeTextBorder, &PCB_DIM_LEADER::GetTextBorder ),
groupDimension );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} LEADER_DIMENSION_DESC;
ENUM_TO_WXANY( DIM_TEXT_BORDER )
static struct CENTER_DIMENSION_DESC
{
CENTER_DIMENSION_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIM_CENTER );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_CENTER, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_CENTER, EDA_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_CENTER, PCB_TEXT> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_DIM_CENTER, PCB_DIMENSION_BASE> );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( PCB_TEXT ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( PCB_DIMENSION_BASE ) );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Visible" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
}
} CENTER_DIMENSION_DESC;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -92,7 +92,7 @@ enum class DIM_TEXT_BORDER
* - "crossbar" refers to the perpendicular line (usually with arrows at each end) between feature
* lines on linear dimensions
*/
class PCB_DIMENSION_BASE : public BOARD_ITEM
class PCB_DIMENSION_BASE : public PCB_TEXT
{
public:
PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T );
@ -111,8 +111,6 @@ public:
return false;
}
void SetParent( EDA_ITEM* aParent ) override;
/**
* The dimension's origin is the first feature point for the dimension. Every dimension has
* one or more feature points, so every dimension has at least an origin.
@ -133,6 +131,13 @@ public:
wxString GetOverrideText() const { return m_valueString; }
void SetOverrideText( const wxString& aValue ) { m_valueString = aValue; }
void ChangeOverrideText( const wxString& aValue )
{
SetOverrideTextEnabled( true );
SetOverrideText( aValue );
updateText();
}
int GetMeasuredValue() const { return m_measuredValue; }
// KiCad normally calculates the measured value but some importers need to set it.
@ -155,26 +160,62 @@ public:
wxString GetPrefix() const { return m_prefix; }
void SetPrefix( const wxString& aPrefix );
void ChangePrefix( const wxString& aPrefix )
{
SetPrefix( aPrefix );
updateText();
}
wxString GetSuffix() const { return m_suffix; }
void SetSuffix( const wxString& aSuffix );
void ChangeSuffix( const wxString& aSuffix )
{
SetSuffix( aSuffix );
updateText();
}
EDA_UNITS GetUnits() const { return m_units; }
void SetUnits( EDA_UNITS aUnits );
DIM_UNITS_MODE GetUnitsMode() const;
void SetUnitsMode( DIM_UNITS_MODE aMode );
void ChangeUnitsMode( DIM_UNITS_MODE aMode )
{
SetUnitsMode( aMode );
updateText();
}
void SetAutoUnits( bool aAuto = true ) { m_autoUnits = aAuto; }
DIM_UNITS_FORMAT GetUnitsFormat() const { return m_unitsFormat; }
void SetUnitsFormat( const DIM_UNITS_FORMAT aFormat ) { m_unitsFormat = aFormat; }
void ChangeUnitsFormat( const DIM_UNITS_FORMAT aFormat )
{
SetUnitsFormat( aFormat );
updateText();
}
int GetPrecision() const { return m_precision; }
void SetPrecision( int aPrecision ) { m_precision = aPrecision; }
void ChangePrecision( int aPrecision )
{
SetPrecision( aPrecision );
updateText();
}
bool GetSuppressZeroes() const { return m_suppressZeroes; }
void SetSuppressZeroes( bool aSuppress ) { m_suppressZeroes = aSuppress; }
void ChangeSuppressZeroes( bool aSuppress )
{
SetSuppressZeroes( aSuppress );
updateText();
}
bool GetKeepTextAligned() const { return m_keepTextAligned; }
void SetKeepTextAligned( bool aKeepAligned ) { m_keepTextAligned = aKeepAligned; }
@ -190,30 +231,6 @@ public:
int GetLineThickness() const { return m_lineThickness; }
void SetLineThickness( int aWidth ) { m_lineThickness = aWidth; }
void SetLayer( PCB_LAYER_ID aLayer ) override;
void SetTextSize( const VECTOR2I& aTextSize )
{
m_text.SetTextSize( aTextSize );
}
/**
* Set the override text - has no effect if m_overrideValue == false.
*
* @param aNewText is the text to use as the value.
*/
void SetText( const wxString& aNewText );
/**
* Retrieve the value text or override text, not including prefix or suffix.
*
* @return the value portion of the dimension text (either overridden or not).
*/
const wxString GetText() const;
PCB_TEXT& Text() { return m_text; }
const PCB_TEXT& Text() const { return m_text; }
/**
* @return a list of line segments that make up this dimension (for drawing, plotting, etc).
*/
@ -249,6 +266,8 @@ public:
const BOX2I ViewBBox() const override;
void ClearRenderCache() override;
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth = false ) const override;
@ -303,13 +322,14 @@ protected:
bool m_keepTextAligned; ///< Calculate text orientation to match dimension
// Internal
PCB_TEXT m_text; ///< The actual text object
int m_measuredValue; ///< value of PCB dimensions
VECTOR2I m_start;
VECTOR2I m_end;
///< Internal cache of drawn shapes
std::vector<std::shared_ptr<SHAPE>> m_shapes;
bool m_inClearRenderCache; ///< re-entrancy guard
};
@ -374,6 +394,12 @@ public:
void SetHeight( int aHeight ) { m_height = aHeight; }
int GetHeight() const { return m_height; }
void ChangeHeight( int aHeight )
{
SetHeight( aHeight );
updateGeometry();
}
/**
* Update the stored height basing on points coordinates.
*
@ -384,6 +410,12 @@ public:
void SetExtensionHeight( int aHeight ) { m_extensionHeight = aHeight; }
int GetExtensionHeight() const { return m_extensionHeight; }
void ChangeExtensionHeight( int aHeight )
{
SetExtensionHeight( aHeight );
updateGeometry();
}
/**
* Return the angle of the crossbar.
*
@ -511,6 +543,12 @@ public:
void SetLeaderLength( int aLength ) { m_leaderLength = aLength; }
int GetLeaderLength() const { return m_leaderLength; }
void ChangeLeaderLength( int aLength )
{
SetLeaderLength( aLength );
updateGeometry();
}
// Returns the point (c).
VECTOR2I GetKnee() const;
@ -566,9 +604,17 @@ public:
return wxT( "PCB_DIM_LEADER" );
}
void SetTextBorder( DIM_TEXT_BORDER aFrame ) { m_textBorder = aFrame; }
void SetTextBorder( DIM_TEXT_BORDER aBorder ) { m_textBorder = aBorder; }
DIM_TEXT_BORDER GetTextBorder() const { return m_textBorder; }
void ChangeTextBorder( DIM_TEXT_BORDER aBorder )
{
SetTextBorder( aBorder );
updateGeometry();
}
void ClearRenderCache() override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
protected:

View File

@ -2560,9 +2560,8 @@ void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer )
}
// Draw text
const PCB_TEXT& text = aDimension->Text();
wxString resolvedText = text.GetShownText();
TEXT_ATTRIBUTES attrs = text.GetAttributes();
wxString resolvedText = aDimension->GetShownText();
TEXT_ATTRIBUTES attrs = aDimension->GetAttributes();
if( m_gal->IsFlippedX() && !( aDimension->GetLayerSet() & LSET::SideSpecificMask() ).any() )
attrs.m_Mirrored = !attrs.m_Mirrored;
@ -2570,12 +2569,12 @@ void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer )
if( outline_mode )
attrs.m_StrokeWidth = m_pcbSettings.m_outlineWidth;
else
attrs.m_StrokeWidth = getLineThickness( text.GetEffectiveTextPenWidth() );
attrs.m_StrokeWidth = getLineThickness( aDimension->GetEffectiveTextPenWidth() );
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
if( text.GetFont() && text.GetFont()->IsOutline() )
cache = text.GetRenderCache( text.GetFont(), resolvedText );
if( aDimension->GetFont() && aDimension->GetFont()->IsOutline() )
cache = aDimension->GetRenderCache( aDimension->GetFont(), resolvedText );
if( cache )
{
@ -2584,7 +2583,7 @@ void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer )
}
else
{
strokeText( resolvedText, text.GetTextPos(), attrs );
strokeText( resolvedText, aDimension->GetTextPos(), attrs );
}
}

View File

@ -35,13 +35,12 @@
#include <trigo.h>
#include <string_utils.h>
#include <geometry/shape_compound.h>
#include <geometry/shape_rect.h>
#include <callback_gal.h>
#include <convert_basic_shapes_to_polygon.h>
PCB_TEXT::PCB_TEXT( BOARD_ITEM* parent ) :
BOARD_ITEM( parent, PCB_TEXT_T ),
PCB_TEXT::PCB_TEXT( BOARD_ITEM* parent, KICAD_T idtype ) :
BOARD_ITEM( parent, idtype ),
EDA_TEXT( pcbIUScale )
{
SetMultilineAllowed( true );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -36,7 +36,7 @@ class MSG_PANEL_ITEM;
class PCB_TEXT : public BOARD_ITEM, public EDA_TEXT
{
public:
PCB_TEXT( BOARD_ITEM* parent );
PCB_TEXT( BOARD_ITEM* parent, KICAD_T idtype = PCB_TEXT_T );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.

View File

@ -484,7 +484,7 @@ void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim )
// the white items are not seen on a white paper or screen
m_plotter->SetColor( color != WHITE ? color : LIGHTGRAY);
PlotPcbText( &aDim->Text(), aDim->GetLayer(), false );
PlotPcbText( aDim, aDim->GetLayer(), false );
for( const std::shared_ptr<SHAPE>& shape : aDim->GetShapes() )
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1315,15 +1315,15 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
dimension->SetUnitsFormat( aElem.textsuffix.IsEmpty() ? DIM_UNITS_FORMAT::NO_SUFFIX
: DIM_UNITS_FORMAT::BARE_SUFFIX );
dimension->Text().SetTextThickness( aElem.textlinewidth );
dimension->Text().SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) );
dimension->Text().SetItalic( aElem.textitalic );
dimension->SetTextThickness( aElem.textlinewidth );
dimension->SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) );
dimension->SetItalic( aElem.textitalic );
#if 0 // we don't currently support bold; map to thicker text
dimension->Text().SetBold( aElem.textbold );
#else
if( aElem.textbold )
dimension->Text().SetTextThickness( dimension->Text().GetTextThickness() * BOLD_FACTOR );
dimension->SetTextThickness( dimension->GetTextThickness() * BOLD_FACTOR );
#endif
switch( aElem.textunit )
@ -1401,26 +1401,26 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem)
return;
}
dimension->Text().SetPosition( aElem.textPoint.at( 0 ) );
dimension->Text().SetTextThickness( aElem.textlinewidth );
dimension->Text().SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) );
dimension->Text().SetItalic( aElem.textitalic );
dimension->SetTextPos( aElem.textPoint.at( 0 ) );
dimension->SetTextThickness( aElem.textlinewidth );
dimension->SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) );
dimension->SetItalic( aElem.textitalic );
#if 0 // we don't currently support bold; map to thicker text
dimension->Text().SetBold( aElem.textbold );
dimension->SetBold( aElem.textbold );
#else
if( aElem.textbold )
dimension->Text().SetTextThickness( dimension->Text().GetTextThickness() * BOLD_FACTOR );
dimension->SetTextThickness( dimension->GetTextThickness() * BOLD_FACTOR );
#endif
// It's unclear exactly how Altium figures it's text positioning, but this gets us reasonably
// close.
dimension->Text().SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
dimension->Text().SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
dimension->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
dimension->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
int yAdjust = dimension->Text().GetCenter().y - dimension->Text().GetPosition().y;
dimension->Text().Move( VECTOR2I( 0, yAdjust + aElem.textgap ) );
dimension->Text().SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
int yAdjust = dimension->GetTextBox().GetCenter().y - dimension->GetTextPos().y;
dimension->SetTextPos( dimension->GetTextPos() + VECTOR2I( 0, yAdjust + aElem.textgap ) );
dimension->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2021 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -1555,16 +1555,16 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions()
endPoint.y );
leaderDim->SetEnd( getKiCadPoint( endPoint ) );
leaderDim->Text().SetTextPos( getKiCadPoint( txtPoint ) );
leaderDim->SetText( ParseTextFields( csDim.Text.Text, &m_context ) );
leaderDim->SetTextPos( getKiCadPoint( txtPoint ) );
leaderDim->SetOverrideText( ParseTextFields( csDim.Text.Text, &m_context ) );
leaderDim->SetPrefix( wxEmptyString );
leaderDim->SetSuffix( wxEmptyString );
leaderDim->SetUnitsFormat( DIM_UNITS_FORMAT::NO_SUFFIX );
if( orientX == 1 )
leaderDim->Text().SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
leaderDim->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else
leaderDim->Text().SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
leaderDim->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
leaderDim->SetExtensionOffset( 0 );
}
@ -3635,7 +3635,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings( const DIMENSION& aCads
aKiCadDim->SetExtensionOffset( getKiCadLength( aCadstarDim.ExtensionLineParams.Offset ) );
aKiCadDim->SetLineThickness( getKiCadLength( linecode.Width ) );
applyTextCode( &aKiCadDim->Text(), aCadstarDim.Text.TextCodeID );
applyTextCode( aKiCadDim, aCadstarDim.Text.TextCodeID );
// Find prefix and suffix:
wxString prefix = wxEmptyString;

View File

@ -957,9 +957,9 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
dimension->SetStart( pt1 );
dimension->SetEnd( pt2 );
dimension->Text().SetPosition( pt3 );
dimension->Text().SetTextSize( textSize );
dimension->Text().SetTextThickness( textThickness );
dimension->SetTextPos( pt3 );
dimension->SetTextSize( textSize );
dimension->SetTextThickness( textThickness );
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
dimension->SetUnits( EDA_UNITS::MILLIMETRES );
}
@ -973,10 +973,10 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
leader->SetStart( pt1 );
leader->SetEnd( pt2 );
leader->Text().SetPosition( pt3 );
leader->Text().SetTextSize( textSize );
leader->Text().SetTextThickness( textThickness );
leader->SetText( wxEmptyString );
leader->SetTextPos( pt3 );
leader->SetTextSize( textSize );
leader->SetTextThickness( textThickness );
leader->SetOverrideText( wxEmptyString );
leader->SetLineThickness( designSettings.GetLineThickness( layer ) );
}
else // horizontal, vertical, <default>, diameter
@ -1009,8 +1009,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
// The origin and end are assumed to always be in this order from eagle
dimension->SetStart( pt1 );
dimension->SetEnd( pt2 );
dimension->Text().SetTextSize( textSize );
dimension->Text().SetTextThickness( textThickness );
dimension->SetTextSize( textSize );
dimension->SetTextThickness( textThickness );
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
dimension->SetUnits( EDA_UNITS::MILLIMETRES );

View File

@ -3216,13 +3216,11 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
case T_gr_text:
{
PCB_TEXT* text = parsePCB_TEXT();
dim->Text() = *text;
// The text is part of the dim and shares its uuid
const_cast<KIID&>( dim->Text().m_Uuid ) = dim->m_Uuid;
dim->EDA_TEXT::operator=( *text );
// Fetch other dim properties out of the text item
dim->Text().SetTextPos( text->GetTextPos() );
dim->SetTextPos( text->GetTextPos() );
if( isLegacyDimension )
{

View File

@ -810,7 +810,7 @@ void PCB_PLUGIN::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel )
if( !center )
{
Format( &aDimension->Text(), aNestLevel + 1 );
format( static_cast<const PCB_TEXT*>( aDimension ), aNestLevel + 1 );
m_out->Print( aNestLevel + 1, "(format (prefix %s) (suffix %s) (units %d) (units_format %d) (precision %d)",
m_out->Quotew( aDimension->GetPrefix() ).c_str(),

View File

@ -2674,11 +2674,11 @@ void LEGACY_PLUGIN::loadDIMENSION()
EDA_ANGLE orient = degParse( data, &data );
char* mirror = strtok_r( (char*) data, delims, (char**) &data );
dim->Text().SetTextPos( VECTOR2I( pos_x, pos_y ) );
dim->Text().SetTextSize( VECTOR2I( width, height ) );
dim->Text().SetMirrored( mirror && *mirror == '0' );
dim->Text().SetTextThickness( thickn );
dim->Text().SetTextAngle( orient );
dim->SetTextPos( VECTOR2I( pos_x, pos_y ) );
dim->SetTextSize( VECTOR2I( width, height ) );
dim->SetMirrored( mirror && *mirror == '0' );
dim->SetTextThickness( thickn );
dim->SetTextAngle( orient );
}
else if( TESTLINE( "Sb" ) )
{

View File

@ -1247,7 +1247,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
else if( originalEvent.IsAction( &PCB_ACTIONS::drawLeader ) )
{
dimension = new PCB_DIM_LEADER( m_frame->GetModel(), m_isFootprintEditor );
dimension->Text().SetPosition( cursorPos );
dimension->SetTextPos( cursorPos );
}
else
{
@ -1257,9 +1257,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
t = dimension->Type();
dimension->SetLayer( layer );
dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->Text().SetTextThickness( boardSettings.GetTextThickness( layer ) );
dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) );
dimension->SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->SetTextThickness( boardSettings.GetTextThickness( layer ) );
dimension->SetItalic( boardSettings.GetTextItalic( layer ) );
dimension->SetLineThickness( boardSettings.GetLineThickness( layer ) );
dimension->SetArrowLength( boardSettings.m_DimensionArrowLength );
dimension->SetExtensionOffset( boardSettings.m_DimensionExtensionOffset );
@ -1364,7 +1364,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
if( radialDim->GetEnd().x < radialDim->GetStart().x )
textOffset = -textOffset;
radialDim->Text().SetPosition( radialDim->GetKnee() + textOffset );
radialDim->SetTextPos( radialDim->GetKnee() + textOffset );
}
else if( t == PCB_DIM_LEADER_T || t == PCB_FP_DIM_LEADER_T )
{
@ -1373,7 +1373,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
if( dimension->GetEnd().x < dimension->GetStart().x )
textOffset = -textOffset;
dimension->Text().SetPosition( dimension->GetEnd() + textOffset );
dimension->SetTextPos( dimension->GetEnd() + textOffset );
}
dimension->Update();
@ -1447,9 +1447,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
}
dimension->SetLayer( layer );
dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->Text().SetTextThickness( boardSettings.GetTextThickness( layer ) );
dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) );
dimension->SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->SetTextThickness( boardSettings.GetTextThickness( layer ) );
dimension->SetItalic( boardSettings.GetTextItalic( layer ) );
dimension->SetLineThickness( boardSettings.GetLineThickness( layer ) );
dimension->Update();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -845,7 +845,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
addAnchor( radialDim->GetStart(), CORNER | SNAPPABLE, aItem );
addAnchor( radialDim->GetEnd(), CORNER | SNAPPABLE, aItem );
addAnchor( radialDim->GetKnee(), CORNER | SNAPPABLE, aItem );
addAnchor( radialDim->Text().GetPosition(), CORNER | SNAPPABLE, aItem );
addAnchor( radialDim->GetTextPos(), CORNER | SNAPPABLE, aItem );
break;
}
@ -858,7 +858,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
const PCB_DIM_LEADER* leader = static_cast<const PCB_DIM_LEADER*>( aItem );
addAnchor( leader->GetStart(), CORNER | SNAPPABLE, aItem );
addAnchor( leader->GetEnd(), CORNER | SNAPPABLE, aItem );
addAnchor( leader->Text().GetPosition(), CORNER | SNAPPABLE, aItem );
addAnchor( leader->GetTextPos(), CORNER | SNAPPABLE, aItem );
break;
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2021 CERN
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -326,7 +326,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
points->AddPoint( dimension->GetStart() );
points->AddPoint( dimension->GetEnd() );
points->AddPoint( dimension->Text().GetPosition() );
points->AddPoint( dimension->GetTextPos() );
points->AddPoint( dimension->GetCrossbarStart() );
points->AddPoint( dimension->GetCrossbarEnd() );
@ -371,7 +371,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
points->AddPoint( dimension->GetStart() );
points->AddPoint( dimension->GetEnd() );
points->AddPoint( dimension->Text().GetPosition() );
points->AddPoint( dimension->GetTextPos() );
points->AddPoint( dimension->GetKnee() );
points->Point( DIM_START ).SetSnapConstraint( ALL_LAYERS );
@ -395,7 +395,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
points->AddPoint( dimension->GetStart() );
points->AddPoint( dimension->GetEnd() );
points->AddPoint( dimension->Text().GetPosition() );
points->AddPoint( dimension->GetTextPos() );
points->Point( DIM_START ).SetSnapConstraint( ALL_LAYERS );
points->Point( DIM_END ).SetSnapConstraint( ALL_LAYERS );
@ -1492,7 +1492,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
// Force manual mode if we weren't already in it
dimension->SetTextPositionMode( DIM_TEXT_POSITION::MANUAL );
dimension->Text().SetPosition( m_editedPoint->GetPosition() );
dimension->SetTextPos( m_editedPoint->GetPosition() );
dimension->Update();
}
@ -1557,7 +1557,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
// Force manual mode if we weren't already in it
dimension->SetTextPositionMode( DIM_TEXT_POSITION::MANUAL );
dimension->Text().SetPosition( VECTOR2I( m_editedPoint->GetPosition() ) );
dimension->SetTextPos( VECTOR2I( m_editedPoint->GetPosition() ) );
}
dimension->Update();
@ -1601,7 +1601,7 @@ void PCB_POINT_EDITOR::updateItem() const
dimension->Update();
VECTOR2I kneeDelta = dimension->GetKnee() - oldKnee;
dimension->Text().SetPosition( dimension->Text().GetPosition() + kneeDelta );
dimension->SetTextPos( dimension->GetTextPos() + kneeDelta );
dimension->Update();
m_editPoints->Point( DIM_KNEE ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_START ),
@ -1617,12 +1617,12 @@ void PCB_POINT_EDITOR::updateItem() const
dimension->Update();
VECTOR2I kneeDelta = dimension->GetKnee() - oldKnee;
dimension->Text().SetPosition( dimension->Text().GetPosition() + kneeDelta );
dimension->SetTextPos( dimension->GetTextPos() + kneeDelta );
dimension->Update();
}
else if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
{
dimension->Text().SetPosition( m_editedPoint->GetPosition() );
dimension->SetTextPos( m_editedPoint->GetPosition() );
dimension->Update();
}
@ -1644,11 +1644,11 @@ void PCB_POINT_EDITOR::updateItem() const
VECTOR2I delta = newPoint - dimension->GetEnd();
dimension->SetEnd( newPoint );
dimension->Text().SetPosition( dimension->Text().GetPosition() + delta );
dimension->SetTextPos( dimension->GetTextPos() + delta );
}
else if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
{
dimension->Text().SetPosition( (VECTOR2I) m_editedPoint->GetPosition() );
dimension->SetTextPos( (VECTOR2I) m_editedPoint->GetPosition() );
}
dimension->Update();
@ -1915,7 +1915,7 @@ void PCB_POINT_EDITOR::updatePoints()
m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->GetTextPos() );
m_editPoints->Point( DIM_CROSSBARSTART ).SetPosition( dimension->GetCrossbarStart() );
m_editPoints->Point( DIM_CROSSBAREND ).SetPosition( dimension->GetCrossbarEnd() );
break;
@ -1938,7 +1938,7 @@ void PCB_POINT_EDITOR::updatePoints()
m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->GetTextPos() );
m_editPoints->Point( DIM_KNEE ).SetPosition( dimension->GetKnee() );
break;
}
@ -1950,7 +1950,7 @@ void PCB_POINT_EDITOR::updatePoints()
m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->GetTextPos() );
break;
}