Browse Source

Add font to status bar for text objects.

7.0
Jeff Young 4 years ago
parent
commit
47e002a33d
  1. 2
      common/drawing_sheet/ds_data_model_io.cpp
  2. 4
      common/eda_text.cpp
  3. 6
      common/font/font.cpp
  4. 4
      common/widgets/font_choice.cpp
  5. 2
      eeschema/lib_field.cpp
  6. 2
      eeschema/lib_text.cpp
  7. 2
      eeschema/lib_textbox.cpp
  8. 2
      eeschema/sch_field.cpp
  9. 2
      eeschema/sch_label.cpp
  10. 2
      eeschema/sch_text.cpp
  11. 2
      eeschema/sch_textbox.cpp
  12. 16
      include/font/font.h
  13. 13
      pcbnew/fp_text.cpp
  14. 1
      pcbnew/fp_textbox.cpp
  15. 6
      pcbnew/pcb_dimension.cpp
  16. 1
      pcbnew/pcb_text.cpp
  17. 1
      pcbnew/pcb_textbox.cpp

2
common/drawing_sheet/ds_data_model_io.cpp

@ -253,7 +253,7 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
{
m_out->Print( 0, " (font" );
if( aItem->m_Font && !aItem->m_Font->Name().IsEmpty() )
if( aItem->m_Font && !aItem->m_Font->GetName().IsEmpty() )
m_out->Print( 0, " (face \"%s\")", aItem->m_Font->NameAsToken() );
if( write_thickness )

4
common/eda_text.cpp

@ -781,7 +781,7 @@ wxString EDA_TEXT::GetTextStyleName() const
wxString EDA_TEXT::GetFontName() const
{
if( GetFont() )
return GetFont()->Name();
return GetFont()->GetName();
else
return wxEmptyString;
}
@ -812,7 +812,7 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
aFormatter->Print( 0, " (font" );
if( GetFont() && !GetFont()->Name().IsEmpty() )
if( GetFont() && !GetFont()->GetName().IsEmpty() )
aFormatter->Print( 0, " (face \"%s\")", GetFont()->NameAsToken() );
// Text size

6
common/font/font.cpp

@ -53,12 +53,6 @@ FONT::FONT()
}
const wxString& FONT::Name() const
{
return m_fontName;
}
FONT* FONT::getDefaultFont()
{
if( !s_defaultFont )

4
common/widgets/font_choice.cpp

@ -72,11 +72,11 @@ void FONT_CHOICE::SetFontSelection( KIFONT::FONT* aFont )
}
else
{
SetStringSelection( aFont->Name() );
SetStringSelection( aFont->GetName() );
if( GetSelection() == wxNOT_FOUND )
{
Append( aFont->Name() + m_notFound );
Append( aFont->GetName() + m_notFound );
SetSelection( GetCount() );
}
}

2
eeschema/lib_field.cpp

@ -472,6 +472,8 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
aList.emplace_back( _( "Style" ), GetTextStyleName() );
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),

2
eeschema/lib_text.cpp

@ -363,6 +363,8 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
// Don't use GetShownText() here; we want to show the user the variable references
aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
aList.emplace_back( _( "Style" ), GetTextStyleName() );
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),

2
eeschema/lib_textbox.cpp

@ -373,6 +373,8 @@ void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
// Don't use GetShownText() here; we want to show the user the variable references
aList.emplace_back( _( "Text Box" ), UnescapeString( ShortenedText() ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
aList.emplace_back( _( "Style" ), textStyle[style] );

2
eeschema/sch_field.cpp

@ -691,6 +691,8 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
aList.emplace_back( _( "Style" ), GetTextStyleName() );
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),

2
eeschema/sch_label.cpp

@ -786,6 +786,8 @@ void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
if( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T )
aList.emplace_back( _( "Type" ), getElectricalTypeLabel( GetShape() ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
aList.emplace_back( _( "Style" ), textStyle[style] );

2
eeschema/sch_text.cpp

@ -472,6 +472,8 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
// Don't use GetShownText() here; we want to show the user the variable references
aList.emplace_back( _( "Graphic Text" ), UnescapeString( ShortenedText() ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
aList.emplace_back( _( "Style" ), textStyle[style] );

2
eeschema/sch_textbox.cpp

@ -376,6 +376,8 @@ void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
// Don't use GetShownText() here; we want to show the user the variable references
aList.emplace_back( _( "Text Box" ), UnescapeString( ShortenedText() ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
aList.emplace_back( _( "Style" ), textStyle[style] );

16
include/font/font.h

@ -108,17 +108,17 @@ public:
virtual ~FONT()
{ }
virtual bool IsStroke() const { return false; }
virtual bool IsStroke() const { return false; }
virtual bool IsOutline() const { return false; }
virtual bool IsBold() const { return false; }
virtual bool IsItalic() const { return false; }
virtual bool IsBold() const { return false; }
virtual bool IsItalic() const { return false; }
static FONT* GetFont( const wxString& aFontName = "", bool aBold = false,
static FONT* GetFont( const wxString& aFontName = wxEmptyString, bool aBold = false,
bool aItalic = false );
static bool IsStroke( const wxString& aFontName );
static bool IsStroke( const wxString& aFontName );
const wxString& Name() const;
inline const char* NameAsToken() const { return Name().utf8_str().data(); }
const wxString& GetName() const { return m_fontName; };
inline const char* NameAsToken() const { return GetName().utf8_str().data(); }
/**
* Draw a string.
@ -266,7 +266,7 @@ private:
inline std::ostream& operator<<(std::ostream& os, const KIFONT::FONT& aFont)
{
os << "[Font \"" << aFont.Name() << "\"" << ( aFont.IsStroke() ? " stroke" : "" )
os << "[Font \"" << aFont.GetName() << "\"" << ( aFont.IsStroke() ? " stroke" : "" )
<< ( aFont.IsOutline() ? " outline" : "" ) << ( aFont.IsBold() ? " bold" : "" )
<< ( aFont.IsItalic() ? " italic" : "" ) << "]";
return os;

13
pcbnew/fp_text.cpp

@ -259,6 +259,7 @@ EDA_ANGLE FP_TEXT::GetDrawRotation() const
void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
EDA_UNITS units = aFrame->GetUserUnits();
wxString msg;
static const wxString text_type_msg[3] =
@ -293,14 +294,10 @@ void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
msg.Printf( wxT( "%g" ), GetTextAngle().AsDegrees() );
aList.emplace_back( _( "Angle" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
aList.emplace_back( _( "Thickness" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
aList.emplace_back( _( "Width" ), msg );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
aList.emplace_back( _( "Height" ), msg );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
aList.emplace_back( _( "Thickness" ), MessageTextFromValue( units, GetTextThickness() ) );
aList.emplace_back( _( "Width" ), MessageTextFromValue( units, GetTextWidth() ) );
aList.emplace_back( _( "Height" ), MessageTextFromValue(units, GetTextHeight() ) );
}

1
pcbnew/fp_textbox.cpp

@ -239,6 +239,7 @@ void FP_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
aList.emplace_back( _( "Angle" ), wxString::Format( "%g", GetTextAngle().AsDegrees() ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
aList.emplace_back( _( "Thickness" ), MessageTextFromValue( units, GetTextThickness() ) );
aList.emplace_back( _( "Text Width" ), MessageTextFromValue( units, GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ), MessageTextFromValue( units, GetTextHeight() ) );

6
pcbnew/pcb_dimension.cpp

@ -335,6 +335,12 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
GetUnits( units );
aList.emplace_back( _( "Units" ), GetAbbreviatedUnitsLabel( units ).Trim( false ) );
aList.emplace_back( _( "Font" ), m_text.GetDrawFont()->GetName() );
aList.emplace_back( _( "Text Thickness" ),
MessageTextFromValue( units, m_text.GetTextThickness() ) );
aList.emplace_back( _( "Text Width" ), MessageTextFromValue( units, m_text.GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ), MessageTextFromValue( units, m_text.GetTextHeight() ) );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
units = aFrame->GetUserUnits();

1
pcbnew/pcb_text.cpp

@ -141,6 +141,7 @@ 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" ), GetDrawFont()->GetName() );
aList.emplace_back( _( "Thickness" ), MessageTextFromValue( units, GetTextThickness() ) );
aList.emplace_back( _( "Width" ), MessageTextFromValue( units, GetTextWidth() ) );
aList.emplace_back( _( "Height" ), MessageTextFromValue( units, GetTextHeight() ) );

1
pcbnew/pcb_textbox.cpp

@ -233,6 +233,7 @@ void PCB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
aList.emplace_back( _( "Angle" ), wxString::Format( "%g", GetTextAngle().AsDegrees() ) );
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
aList.emplace_back( _( "Text Thickness" ), MessageTextFromValue( units, GetTextThickness() ) );
aList.emplace_back( _( "Text Width" ), MessageTextFromValue( units, GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ), MessageTextFromValue( units, GetTextHeight() ) );

Loading…
Cancel
Save