Browse Source

Make auto text thickness active.

revert-0c36e162
Jeff Young 8 months ago
parent
commit
5371312c6f
  1. 16
      common/eda_text.cpp
  2. 4
      eeschema/sch_textbox.cpp
  3. 11
      include/eda_text.h
  4. 71
      pcbnew/dialogs/dialog_tablecell_properties.cpp
  5. 3
      pcbnew/dialogs/dialog_tablecell_properties.h
  6. 14
      pcbnew/dialogs/dialog_tablecell_properties_base.cpp
  7. 6
      pcbnew/dialogs/dialog_tablecell_properties_base.fbp
  8. 5
      pcbnew/dialogs/dialog_tablecell_properties_base.h
  9. 51
      pcbnew/dialogs/dialog_text_properties.cpp
  10. 3
      pcbnew/dialogs/dialog_text_properties.h
  11. 14
      pcbnew/dialogs/dialog_text_properties_base.cpp
  12. 6
      pcbnew/dialogs/dialog_text_properties_base.fbp
  13. 5
      pcbnew/dialogs/dialog_text_properties_base.h
  14. 47
      pcbnew/dialogs/dialog_textbox_properties.cpp
  15. 3
      pcbnew/dialogs/dialog_textbox_properties.h
  16. 14
      pcbnew/dialogs/dialog_textbox_properties_base.cpp
  17. 6
      pcbnew/dialogs/dialog_textbox_properties_base.fbp
  18. 5
      pcbnew/dialogs/dialog_textbox_properties_base.h
  19. 38
      pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp
  20. 7
      pcbnew/pcb_tablecell.cpp
  21. 19
      pcbnew/pcb_text.cpp
  22. 7
      pcbnew/pcb_textbox.cpp

16
common/eda_text.cpp

@ -289,6 +289,13 @@ void EDA_TEXT::SetTextThickness( int aWidth )
}
void EDA_TEXT::SetAutoThickness( bool aAuto )
{
if( GetAutoThickness() != aAuto )
SetTextThickness( aAuto ? 0 : GetEffectiveTextPenWidth() );
}
void EDA_TEXT::SetTextAngle( const EDA_ANGLE& aAngle )
{
m_attributes.m_Angle = aAngle;
@ -1041,7 +1048,7 @@ bool EDA_TEXT::IsDefaultFormatting() const
return ( !IsMirrored()
&& GetHorizJustify() == GR_TEXT_H_ALIGN_CENTER
&& GetVertJustify() == GR_TEXT_V_ALIGN_CENTER
&& GetTextThickness() == 0
&& GetAutoThickness()
&& !IsItalic()
&& !IsBold()
&& !IsMultilineAllowed()
@ -1070,7 +1077,7 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aControlBits ) const
FormatDouble2Str( GetLineSpacing() ).c_str() );
}
if( GetTextThickness() )
if( !GetAutoThickness() )
{
aFormatter->Print( "(thickness %s)",
EDA_UNIT_UTILS::FormatInternalUnits( m_IuScale, GetTextThickness() ).c_str() );
@ -1357,8 +1364,11 @@ static struct EDA_TEXT_DESC
textProps )
.SetIsHiddenFromRulesEditor();
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Auto Thickness" ),
&EDA_TEXT::SetAutoThickness, &EDA_TEXT::GetAutoThickness ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Thickness" ),
&EDA_TEXT::SetTextThickness, &EDA_TEXT::GetTextThickness,
&EDA_TEXT::SetTextThickness, &EDA_TEXT::GetTextThicknessProperty,
PROPERTY_DISPLAY::PT_SIZE ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Italic" ),

4
eeschema/sch_textbox.cpp

@ -305,8 +305,8 @@ wxString SCH_TEXTBOX::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtr
else
colWidth = abs( size.x ) - ( GetMarginLeft() + GetMarginRight() );
getDrawFont()->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(),
IsItalic() );
getDrawFont()->LinebreakText( text, colWidth, GetTextSize(), GetEffectiveTextPenWidth(),
IsBold(), IsItalic() );
return text;
}

11
include/eda_text.h

@ -125,6 +125,17 @@ public:
void SetTextThickness( int aWidth );
int GetTextThickness() const { return m_attributes.m_StrokeWidth; };
int GetTextThicknessProperty() const
{
if( GetAutoThickness() )
return GetEffectiveTextPenWidth();
else
return GetTextThickness();
}
void SetAutoThickness( bool aAuto );
bool GetAutoThickness() const { return GetTextThickness() == 0; };
/**
* The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
*/

71
pcbnew/dialogs/dialog_tablecell_properties.cpp

@ -115,8 +115,8 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_italic->SetIsCheckButton();
m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
m_adjustTextThickness->SetIsRadioButton();
m_adjustTextThickness->SetBitmap( KiBitmapBundle( BITMAPS::edit_cmp_symb_links ) );
m_autoTextThickness->SetIsCheckButton();
m_autoTextThickness->SetBitmap( KiBitmapBundle( BITMAPS::edit_cmp_symb_links ) );
SetupStandardButtons();
Layout();
@ -152,16 +152,20 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
bool firstCell = true;
GR_TEXT_H_ALIGN_T hAlign = GR_TEXT_H_ALIGN_INDETERMINATE;
GR_TEXT_V_ALIGN_T vAlign = GR_TEXT_V_ALIGN_INDETERMINATE;
int textThickness = 0;
int effectivePenWidth = 0;
for( PCB_TABLECELL* cell : m_cells )
{
m_cellTextCtrl->SetValue( cell->GetText() );
if( firstCell )
{
m_cellTextCtrl->SetValue( cell->GetText() );
m_fontCtrl->SetFontSelection( cell->GetFont() );
m_textWidth.SetValue( cell->GetTextWidth() );
m_textHeight.SetValue( cell->GetTextHeight() );
m_textThickness.SetValue( cell->GetTextThickness() );
textThickness = cell->GetTextThickness();
effectivePenWidth = cell->GetEffectiveTextPenWidth();
hAlign = cell->GetHorizJustify();
vAlign = cell->GetVertJustify();
@ -181,6 +185,9 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
}
else
{
if( cell->GetText() != m_cellTextCtrl->GetValue() )
m_cellTextCtrl->SetValue( INDETERMINATE_STATE );
if( cell->GetFont() != m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) )
m_fontCtrl->SetSelection( -1 );
@ -190,8 +197,11 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
if( cell->GetTextHeight() != m_textHeight.GetValue() )
m_textHeight.SetValue( INDETERMINATE_STATE );
if( cell->GetTextThickness() != m_textThickness.GetValue() )
m_textThickness.SetValue( INDETERMINATE_STATE );
if( cell->GetTextThickness() != textThickness )
textThickness = -1;
if( cell->GetEffectiveTextPenWidth() != effectivePenWidth )
effectivePenWidth = -1;
if( cell->GetHorizJustify() != hAlign )
hAlign = GR_TEXT_H_ALIGN_INDETERMINATE;
@ -229,6 +239,22 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
}
}
m_textThickness.SetValue( INDETERMINATE_STATE );
m_autoTextThickness->Check( false );
if( textThickness == 0 )
{
if( effectivePenWidth > 0 )
m_textThickness.SetValue( effectivePenWidth );
m_autoTextThickness->Check( true );
m_textThickness.Enable( false );
}
else if( textThickness > 0 )
{
m_textThickness.SetValue( textThickness );
}
return true;
}
@ -244,8 +270,10 @@ void DIALOG_TABLECELL_PROPERTIES::onBoldToggle( wxCommandEvent& aEvent )
aEvent.Skip();
}
void DIALOG_TABLECELL_PROPERTIES::onAdjustTextThickness( wxCommandEvent& aEvent )
void DIALOG_TABLECELL_PROPERTIES::onTextSize( wxCommandEvent& aEvent )
{
if( m_autoTextThickness->IsChecked() )
{
int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
int thickness;
@ -256,6 +284,28 @@ void DIALOG_TABLECELL_PROPERTIES::onAdjustTextThickness( wxCommandEvent& aEvent
thickness = GetPenSizeForNormal( textSize );
m_textThickness.SetValue( thickness );
}
}
void DIALOG_TABLECELL_PROPERTIES::onAutoTextThickness( wxCommandEvent& aEvent )
{
if( aEvent.IsChecked() )
{
m_autoTextThickness->Check( true );
if( !m_textWidth.IsIndeterminate() && !m_textHeight.IsIndeterminate() )
{
wxCommandEvent dummy;
onTextSize( dummy );
}
m_textThickness.Enable( false );
}
else
{
m_textThickness.Enable( true );
}
}
@ -297,6 +347,8 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow()
m_table->SetFlags( IN_EDIT );
for( PCB_TABLECELL* cell : m_cells )
{
if( m_cellTextCtrl->GetValue() != INDETERMINATE_STATE )
{
wxString txt = m_cellTextCtrl->GetValue();
@ -311,6 +363,7 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow()
#endif
cell->SetText( txt );
}
cell->SetBold( m_bold->IsChecked() );
cell->SetItalic( m_italic->IsChecked() );
@ -324,7 +377,9 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow()
if( !m_textHeight.IsIndeterminate() )
cell->SetTextHeight( m_textHeight.GetIntValue() );
if( !m_textThickness.IsIndeterminate() )
if( m_autoTextThickness->IsChecked() )
cell->SetAutoThickness( true );
else if( !m_textThickness.IsIndeterminate() )
cell->SetTextThickness( m_textThickness.GetIntValue() );
if( m_hAlignLeft->IsChecked() )

3
pcbnew/dialogs/dialog_tablecell_properties.h

@ -58,7 +58,8 @@ private:
void onHAlignButton( wxCommandEvent& aEvent );
void onVAlignButton( wxCommandEvent& aEvent );
void onAdjustTextThickness( wxCommandEvent& aEvent ) override;
void onTextSize( wxCommandEvent &aEvent ) override;
void onAutoTextThickness( wxCommandEvent &aEvent ) override;
void onBoldToggle( wxCommandEvent& aEvent ) override;
void onEditTable( wxCommandEvent& aEvent ) override;

14
pcbnew/dialogs/dialog_tablecell_properties_base.cpp

@ -204,10 +204,10 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
m_ThicknessUnits->Wrap( -1 );
gbSizer1->Add( m_ThicknessUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_adjustTextThickness = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE );
m_adjustTextThickness->SetToolTip( _("Adjust the text thickness") );
m_autoTextThickness = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE );
m_autoTextThickness->SetToolTip( _("Adjust the text thickness") );
gbSizer1->Add( m_adjustTextThickness, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->Add( m_autoTextThickness, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
bMargins->Add( gbSizer1, 0, wxEXPAND|wxTOP, 5 );
@ -287,10 +287,12 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
// Connect Events
m_bold->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBoldToggle ), NULL, this );
m_SizeXCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeXCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_SizeYCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeYCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_ThicknessCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onThickness ), NULL, this );
m_adjustTextThickness->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onAdjustTextThickness ), NULL, this );
m_autoTextThickness->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onAutoTextThickness ), NULL, this );
m_editTable->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onEditTable ), NULL, this );
}
@ -298,10 +300,12 @@ DIALOG_TABLECELL_PROPERTIES_BASE::~DIALOG_TABLECELL_PROPERTIES_BASE()
{
// Disconnect Events
m_bold->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBoldToggle ), NULL, this );
m_SizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_SizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_ThicknessCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onThickness ), NULL, this );
m_adjustTextThickness->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onAdjustTextThickness ), NULL, this );
m_autoTextThickness->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onAutoTextThickness ), NULL, this );
m_editTable->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onEditTable ), NULL, this );
}

6
pcbnew/dialogs/dialog_tablecell_properties_base.fbp

@ -1359,6 +1359,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onTextSize</event>
<event name="OnTextEnter">OnOkClick</event>
</object>
</object>
@ -1558,6 +1559,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onTextSize</event>
<event name="OnTextEnter">OnOkClick</event>
</object>
</object>
@ -1877,7 +1879,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_adjustTextThickness</property>
<property name="name">m_autoTextThickness</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1900,7 +1902,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onAdjustTextThickness</event>
<event name="OnButtonClick">onAutoTextThickness</event>
</object>
</object>
</object>

5
pcbnew/dialogs/dialog_tablecell_properties_base.h

@ -68,7 +68,7 @@ class DIALOG_TABLECELL_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_ThicknessLabel;
wxTextCtrl* m_ThicknessCtrl;
wxStaticText* m_ThicknessUnits;
BITMAP_BUTTON* m_adjustTextThickness;
BITMAP_BUTTON* m_autoTextThickness;
wxTextCtrl* m_marginTopCtrl;
wxStaticText* m_marginTopUnits;
wxTextCtrl* m_marginLeftCtrl;
@ -81,9 +81,10 @@ class DIALOG_TABLECELL_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void onBoldToggle( wxCommandEvent& event ) { event.Skip(); }
virtual void onTextSize( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void onAdjustTextThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void onAutoTextThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void onEditTable( wxCommandEvent& event ) { event.Skip(); }

51
pcbnew/dialogs/dialog_text_properties.cpp

@ -202,7 +202,8 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PC
m_mirrored->SetIsCheckButton();
m_mirrored->SetBitmap( KiBitmapBundle( BITMAPS::text_mirrored ) );
m_adjustTextThickness->SetBitmap( KiBitmapBundle( BITMAPS::edit_cmp_symb_links ) );
m_autoTextThickness->SetIsCheckButton();
m_autoTextThickness->SetBitmap( KiBitmapBundle( BITMAPS::edit_cmp_symb_links ) );
SetTitle( title );
m_hash_key = title;
@ -328,7 +329,18 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_textWidth.SetValue( m_item->GetTextSize().x );
m_textHeight.SetValue( m_item->GetTextSize().y );
if( m_item->GetAutoThickness() )
{
m_autoTextThickness->Check( m_item->GetAutoThickness() );
m_thickness.SetValue( m_item->GetEffectiveTextPenWidth() );
m_thickness.Enable( false );
}
else
{
m_thickness.SetValue( m_item->GetTextThickness() );
}
m_posX.SetValue( m_item->GetFPRelativePosition().x );
m_posY.SetValue( m_item->GetFPRelativePosition().y );
@ -371,7 +383,7 @@ void DIALOG_TEXT_PROPERTIES::onFontSelected( wxCommandEvent & aEvent )
if( KIFONT::FONT::IsStroke( aEvent.GetString() ) )
{
m_thickness.Show( true );
m_adjustTextThickness->Show( true );
m_autoTextThickness->Show( true );
int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
int thickness = m_thickness.GetValue();
@ -382,7 +394,7 @@ void DIALOG_TEXT_PROPERTIES::onFontSelected( wxCommandEvent & aEvent )
else
{
m_thickness.Show( false );
m_adjustTextThickness->Show( false );
m_autoTextThickness->Show( false );
}
}
@ -430,8 +442,10 @@ void DIALOG_TEXT_PROPERTIES::onThickness( wxCommandEvent& event )
}
void DIALOG_TEXT_PROPERTIES::updateTextThickness( wxCommandEvent &aEvent )
void DIALOG_TEXT_PROPERTIES::onTextSize( wxCommandEvent& aEvent )
{
if( m_autoTextThickness->IsChecked() )
{
int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
int thickness;
@ -442,6 +456,25 @@ void DIALOG_TEXT_PROPERTIES::updateTextThickness( wxCommandEvent &aEvent )
thickness = GetPenSizeForNormal( textSize );
m_thickness.SetValue( thickness );
}
}
void DIALOG_TEXT_PROPERTIES::onAutoTextThickness( wxCommandEvent& aEvent )
{
if( aEvent.IsChecked() )
{
m_autoTextThickness->Check( true );
wxCommandEvent dummy;
onTextSize( dummy );
m_thickness.Enable( false );
}
else
{
m_thickness.Enable( true );
}
}
@ -512,8 +545,14 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
}
m_item->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
if( m_autoTextThickness->IsChecked() )
{
m_item->SetAutoThickness( true );
}
else
{
m_item->SetTextThickness( m_thickness.GetValue() );
m_item->SetFPRelativePosition( VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ) );
// Test for acceptable values for thickness and size and clamp if fails
int maxPenWidth = ClampTextPenSize( m_item->GetTextThickness(), m_item->GetTextSize() );
@ -524,7 +563,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
"It will be clamped." ) );
m_item->SetTextThickness( maxPenWidth );
}
}
m_item->SetFPRelativePosition( VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ) );
m_item->SetTextAngle( m_orientation.GetAngleValue().Normalize() );
if( m_Visible->IsShown() )

3
pcbnew/dialogs/dialog_text_properties.h

@ -56,7 +56,8 @@ private:
void onAlignButton( wxCommandEvent &aEvent ) override;
void onValignButton( wxCommandEvent &aEvent ) override;
void onThickness( wxCommandEvent &aEvent ) override;
void updateTextThickness( wxCommandEvent& aEvent ) override;
void onTextSize( wxCommandEvent &aEvent ) override;
void onAutoTextThickness( wxCommandEvent &aEvent ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;

14
pcbnew/dialogs/dialog_text_properties_base.cpp

@ -204,10 +204,10 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
m_ThicknessUnits->Wrap( -1 );
bSizer8->Add( m_ThicknessUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_adjustTextThickness = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE );
m_adjustTextThickness->SetToolTip( _("Adjust the text thickness") );
m_autoTextThickness = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE );
m_autoTextThickness->SetToolTip( _("Adjust the text thickness") );
bSizer8->Add( m_adjustTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
bSizer8->Add( m_autoTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
gbSizer1->Add( bSizer8, wxGBPosition( 5, 2 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
@ -308,9 +308,11 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
m_valignTop->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onValignButton ), NULL, this );
m_valignCenter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onValignButton ), NULL, this );
m_valignBottom->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onValignButton ), NULL, this );
m_SizeXCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeXCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_SizeYCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeYCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_adjustTextThickness->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::updateTextThickness ), NULL, this );
m_autoTextThickness->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onAutoTextThickness ), NULL, this );
m_PositionXCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_PositionYCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_OrientCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
@ -333,9 +335,11 @@ DIALOG_TEXT_PROPERTIES_BASE::~DIALOG_TEXT_PROPERTIES_BASE()
m_valignTop->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onValignButton ), NULL, this );
m_valignCenter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onValignButton ), NULL, this );
m_valignBottom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onValignButton ), NULL, this );
m_SizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_SizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_adjustTextThickness->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::updateTextThickness ), NULL, this );
m_autoTextThickness->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onAutoTextThickness ), NULL, this );
m_PositionXCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_PositionYCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_OrientCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );

6
pcbnew/dialogs/dialog_text_properties_base.fbp

@ -1967,6 +1967,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onTextSize</event>
<event name="OnTextEnter">OnOkClick</event>
</object>
</object>
@ -2166,6 +2167,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onTextSize</event>
<event name="OnTextEnter">OnOkClick</event>
</object>
</object>
@ -2357,7 +2359,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_adjustTextThickness</property>
<property name="name">m_autoTextThickness</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -2380,7 +2382,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">updateTextThickness</event>
<event name="OnButtonClick">onAutoTextThickness</event>
</object>
</object>
</object>

5
pcbnew/dialogs/dialog_text_properties_base.h

@ -78,7 +78,7 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
wxTextCtrl* m_SizeYCtrl;
wxStaticText* m_SizeYUnits;
wxStaticText* m_ThicknessUnits;
BITMAP_BUTTON* m_adjustTextThickness;
BITMAP_BUTTON* m_autoTextThickness;
wxStaticText* m_PositionXLabel;
wxTextCtrl* m_PositionXCtrl;
wxStaticText* m_PositionXUnits;
@ -103,7 +103,8 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
virtual void onBoldToggle( wxCommandEvent& event ) { event.Skip(); }
virtual void onAlignButton( wxCommandEvent& event ) { event.Skip(); }
virtual void onValignButton( wxCommandEvent& event ) { event.Skip(); }
virtual void updateTextThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void onTextSize( wxCommandEvent& event ) { event.Skip(); }
virtual void onAutoTextThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void onThickness( wxCommandEvent& event ) { event.Skip(); }

47
pcbnew/dialogs/dialog_textbox_properties.cpp

@ -117,7 +117,8 @@ DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aPare
m_separator4->SetIsSeparator();
m_adjustTextThickness->SetBitmap( KiBitmapBundle( BITMAPS::edit_cmp_symb_links ) );
m_autoTextThickness->SetIsCheckButton();
m_autoTextThickness->SetBitmap( KiBitmapBundle( BITMAPS::edit_cmp_symb_links ) );
// Configure the layers list selector. Note that footprints are built outside the current
// board and so we may need to show all layers if the text is on an unactivated layer.
@ -173,8 +174,7 @@ int PCB_BASE_EDIT_FRAME::ShowTextBoxPropertiesDialog( PCB_TEXTBOX* aTextBox )
bool DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow()
{
BOARD* board = m_frame->GetBoard();
wxString converted = board->ConvertKIIDsToCrossReferences(
UnescapeString( m_textBox->GetText() ) );
wxString converted = board->ConvertKIIDsToCrossReferences( UnescapeString( m_textBox->GetText() ) );
m_MultiLineText->SetValue( converted );
m_MultiLineText->SetSelection( -1, -1 );
@ -188,7 +188,17 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow()
m_textWidth.SetValue( m_textBox->GetTextSize().x );
m_textHeight.SetValue( m_textBox->GetTextSize().y );
if( m_textBox->GetAutoThickness() )
{
m_autoTextThickness->Check( m_textBox->GetAutoThickness() );
m_thickness.SetValue( m_textBox->GetEffectiveTextPenWidth() );
m_thickness.Enable( false );
}
else
{
m_thickness.SetValue( m_textBox->GetTextThickness() );
}
m_bold->Check( m_textBox->IsBold() );
m_italic->Check( m_textBox->IsItalic() );
@ -296,8 +306,10 @@ void DIALOG_TEXTBOX_PROPERTIES::onThickness( wxCommandEvent& event )
}
void DIALOG_TEXTBOX_PROPERTIES::updateTextThickness( wxCommandEvent& aEvent )
void DIALOG_TEXTBOX_PROPERTIES::onTextSize( wxCommandEvent& aEvent )
{
if( m_autoTextThickness->IsChecked() )
{
int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
int thickness;
@ -308,6 +320,25 @@ void DIALOG_TEXTBOX_PROPERTIES::updateTextThickness( wxCommandEvent& aEvent )
thickness = GetPenSizeForNormal( textSize );
m_thickness.SetValue( thickness );
}
}
void DIALOG_TEXTBOX_PROPERTIES::onAutoTextThickness( wxCommandEvent& aEvent )
{
if( aEvent.IsChecked() )
{
m_autoTextThickness->Check( true );
wxCommandEvent dummy;
onTextSize( dummy );
m_thickness.Enable( false );
}
else
{
m_thickness.Enable( true );
}
}
@ -374,6 +405,13 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
}
m_textBox->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
if( m_autoTextThickness->IsChecked() )
{
m_textBox->SetAutoThickness( true );
}
else
{
m_textBox->SetTextThickness( m_thickness.GetValue() );
// Test for acceptable values for thickness and size and clamp if fails
@ -385,6 +423,7 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
"It will be clamped." ) );
m_textBox->SetTextThickness( maxPenWidth );
}
}
m_textBox->SetTextAngle( m_orientation.GetAngleValue().Normalize() );
m_textBox->SetBoldFlag( m_bold->IsChecked() );

3
pcbnew/dialogs/dialog_textbox_properties.h

@ -48,7 +48,8 @@ private:
void onValignButton( wxCommandEvent& aEvent ) override;
void onThickness( wxCommandEvent& aEvent ) override;
void onBorderChecked( wxCommandEvent& event ) override;
void updateTextThickness( wxCommandEvent& aEvent ) override;
void onTextSize( wxCommandEvent &aEvent ) override;
void onAutoTextThickness( wxCommandEvent &aEvent ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;

14
pcbnew/dialogs/dialog_textbox_properties_base.cpp

@ -195,10 +195,10 @@ DIALOG_TEXTBOX_PROPERTIES_BASE::DIALOG_TEXTBOX_PROPERTIES_BASE( wxWindow* parent
m_ThicknessUnits->Wrap( -1 );
bSizer5->Add( m_ThicknessUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_adjustTextThickness = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE );
m_adjustTextThickness->SetToolTip( _("Adjust the text thickness") );
m_autoTextThickness = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE );
m_autoTextThickness->SetToolTip( _("Adjust the text thickness") );
bSizer5->Add( m_adjustTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
bSizer5->Add( m_autoTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
gbSizer1->Add( bSizer5, wxGBPosition( 7, 2 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
@ -268,11 +268,13 @@ DIALOG_TEXTBOX_PROPERTIES_BASE::DIALOG_TEXTBOX_PROPERTIES_BASE( wxWindow* parent
m_vAlignTop->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onValignButton ), NULL, this );
m_vAlignCenter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onValignButton ), NULL, this );
m_vAlignBottom->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onValignButton ), NULL, this );
m_SizeXCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeXCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_SizeYCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeYCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_ThicknessCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onThickness ), NULL, this );
m_adjustTextThickness->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::updateTextThickness ), NULL, this );
m_autoTextThickness->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onAutoTextThickness ), NULL, this );
m_OrientCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );
}
@ -290,11 +292,13 @@ DIALOG_TEXTBOX_PROPERTIES_BASE::~DIALOG_TEXTBOX_PROPERTIES_BASE()
m_vAlignTop->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onValignButton ), NULL, this );
m_vAlignCenter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onValignButton ), NULL, this );
m_vAlignBottom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onValignButton ), NULL, this );
m_SizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_SizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onTextSize ), NULL, this );
m_SizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_ThicknessCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onThickness ), NULL, this );
m_adjustTextThickness->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::updateTextThickness ), NULL, this );
m_autoTextThickness->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::onAutoTextThickness ), NULL, this );
m_OrientCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXTBOX_PROPERTIES_BASE::OnOkClick ), NULL, this );

6
pcbnew/dialogs/dialog_textbox_properties_base.fbp

@ -1746,6 +1746,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onTextSize</event>
<event name="OnTextEnter">OnOkClick</event>
</object>
</object>
@ -2014,6 +2015,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onTextSize</event>
<event name="OnTextEnter">OnOkClick</event>
</object>
</object>
@ -2339,7 +2341,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_adjustTextThickness</property>
<property name="name">m_autoTextThickness</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -2362,7 +2364,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">updateTextThickness</event>
<event name="OnButtonClick">onAutoTextThickness</event>
</object>
</object>
</object>

5
pcbnew/dialogs/dialog_textbox_properties_base.h

@ -77,7 +77,7 @@ class DIALOG_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_ThicknessLabel;
wxTextCtrl* m_ThicknessCtrl;
wxStaticText* m_ThicknessUnits;
BITMAP_BUTTON* m_adjustTextThickness;
BITMAP_BUTTON* m_autoTextThickness;
wxStaticText* m_OrientLabel;
wxComboBox* m_OrientCtrl;
wxStaticText* m_borderWidthLabel;
@ -96,10 +96,11 @@ class DIALOG_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM
virtual void onBoldToggle( wxCommandEvent& event ) { event.Skip(); }
virtual void onHalignButton( wxCommandEvent& event ) { event.Skip(); }
virtual void onValignButton( wxCommandEvent& event ) { event.Skip(); }
virtual void onTextSize( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void updateTextThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void onAutoTextThickness( wxCommandEvent& event ) { event.Skip(); }
public:

38
pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp

@ -587,17 +587,11 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
break;
case T_bold:
{
bool value = parseMaybeAbsentBool( true );
aText->SetBoldFlag( value );
}
aText->SetBoldFlag( parseMaybeAbsentBool( true ) );
break;
case T_italic:
{
bool value = parseMaybeAbsentBool( true );
aText->SetItalicFlag( value );
}
aText->SetItalicFlag( parseMaybeAbsentBool( true ) );
break;
default:
@ -615,28 +609,12 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
switch( token )
{
case T_left:
aText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
break;
case T_right:
aText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
break;
case T_top:
aText->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
break;
case T_bottom:
aText->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
break;
case T_mirror:
aText->SetMirrored( true );
break;
default:
Expecting( "left, right, top, bottom, or mirror" );
case T_left: aText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
case T_right: aText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case T_top: aText->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); break;
case T_bottom: aText->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); break;
case T_mirror: aText->SetMirrored( true ); break;
default: Expecting( "left, right, top, bottom, or mirror" );
}
}

7
pcbnew/pcb_tablecell.cpp

@ -117,7 +117,12 @@ void PCB_TABLECELL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PAN
aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
if( GetTextThickness() )
aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetEffectiveTextPenWidth() ) );
else
aList.emplace_back( _( "Text Thickness" ), _( "Auto" ) );
aList.emplace_back( _( "Text Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
}

19
pcbnew/pcb_text.cpp

@ -59,17 +59,15 @@ PCB_TEXT::PCB_TEXT( FOOTPRINT* aParent, KICAD_T idtype) :
{
SetKeepUpright( true );
// Set text thickness to a default value
SetTextThickness( pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ) );
// N.B. Do not automatically set text effects
// These are optional in the file format and so need to be defaulted to off.
SetLayer( F_SilkS );
if( aParent )
{
SetTextPos( aParent->GetPosition() );
// N.B. Do not automatically set text effects
// These are optional in the file format and so need to be defaulted
// to off.
if( IsBackLayer( aParent->GetLayer() ) )
SetLayer( B_SilkS );
}
@ -292,7 +290,12 @@ void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
aList.emplace_back( _( "Angle" ), wxString::Format( wxT( "%g" ), GetTextAngle().AsDegrees() ) );
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
aList.emplace_back( _( "Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
if( GetTextThickness() )
aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetEffectiveTextPenWidth() ) );
else
aList.emplace_back( _( "Text Thickness" ), _( "Auto" ) );
aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
}
@ -300,7 +303,7 @@ void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
int PCB_TEXT::getKnockoutMargin() const
{
return GetKnockoutTextMargin( VECTOR2I( GetTextWidth(), GetTextHeight() ), GetTextThickness() );
return GetKnockoutTextMargin( VECTOR2I( GetTextWidth(), GetTextHeight() ), GetEffectiveTextPenWidth() );
}
@ -355,7 +358,7 @@ bool PCB_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
int accuracy = aAccuracy;
if( IsKnockout() )
accuracy += GetKnockoutTextMargin( GetTextSize(), GetTextThickness() );
accuracy += GetKnockoutTextMargin( GetTextSize(), GetEffectiveTextPenWidth() );
return EDA_TEXT::TextHitTest( aPoint, accuracy );
}

7
pcbnew/pcb_textbox.cpp

@ -472,7 +472,12 @@ void PCB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
aList.emplace_back( _( "Angle" ), wxString::Format( "%g", GetTextAngle().AsDegrees() ) );
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
if( GetTextThickness() )
aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetEffectiveTextPenWidth() ) );
else
aList.emplace_back( _( "Text Thickness" ), _( "Auto" ) );
aList.emplace_back( _( "Text Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );

Loading…
Cancel
Save