Change super/subscript syntax to ^{foo} and _{foo}.

This commit is contained in:
Jeff Young 2020-04-18 21:04:41 +01:00
parent 42cd604c3c
commit 2b6089240a
64 changed files with 200 additions and 568 deletions

View File

@ -115,14 +115,14 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
GRText( nullptr, positions[ii], dummy_color, txt, aText->GetTextAngle(), size, GRText( nullptr, positions[ii], dummy_color, txt, aText->GetTextAngle(), size,
aText->GetHorizJustify(), aText->GetVertJustify(), penWidth, aText->GetHorizJustify(), aText->GetVertJustify(), penWidth,
aText->IsItalic(), forceBold, 0, addTextSegmToContainer ); aText->IsItalic(), forceBold, addTextSegmToContainer );
} }
} }
else else
{ {
GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(), GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(),
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(), aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
penWidth, aText->IsItalic(), forceBold, 0, addTextSegmToContainer ); penWidth, aText->IsItalic(), forceBold, addTextSegmToContainer );
} }
} }
@ -227,7 +227,7 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(), GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(), size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
forceBold, 0, addTextSegmToContainer ); forceBold, addTextSegmToContainer );
} }
} }

View File

@ -83,8 +83,7 @@ EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
} }
EDA_TEXT::EDA_TEXT( const wxString& text, int aTextMarkupFlags ) : EDA_TEXT::EDA_TEXT( const wxString& text ) :
m_textMarkupFlags( aTextMarkupFlags ),
m_text( text ), m_text( text ),
m_e( 1<<TE_VISIBLE ) m_e( 1<<TE_VISIBLE )
{ {
@ -97,7 +96,6 @@ EDA_TEXT::EDA_TEXT( const wxString& text, int aTextMarkupFlags ) :
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) : EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
m_textMarkupFlags( aText.m_textMarkupFlags ),
m_text( aText.m_text ), m_text( aText.m_text ),
m_e( aText.m_e ) m_e( aText.m_e )
{ {
@ -171,14 +169,14 @@ bool EDA_TEXT::Replace( wxFindReplaceData& aSearchData )
} }
int EDA_TEXT::LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const int EDA_TEXT::LenSize( const wxString& aLine, int aThickness ) const
{ {
basic_gal.SetFontItalic( IsItalic() ); basic_gal.SetFontItalic( IsItalic() );
basic_gal.SetFontBold( IsBold() ); basic_gal.SetFontBold( IsBold() );
basic_gal.SetLineWidth( (float) aThickness ); basic_gal.SetLineWidth( (float) aThickness );
basic_gal.SetGlyphSize( VECTOR2D( GetTextSize() ) ); basic_gal.SetGlyphSize( VECTOR2D( GetTextSize() ) );
VECTOR2D tsize = basic_gal.GetTextLineSize( aLine, aMarkupFlags ); VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
return KiROUND( tsize.x ); return KiROUND( tsize.x );
} }
@ -244,8 +242,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
const auto& font = basic_gal.GetStrokeFont(); const auto& font = basic_gal.GetStrokeFont();
VECTOR2D fontSize( GetTextSize() ); VECTOR2D fontSize( GetTextSize() );
double penWidth( thickness ); double penWidth( thickness );
int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth, int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
m_textMarkupFlags ).x );
int dy = GetInterline(); int dy = GetInterline();
// Creates bounding box (rectangle) for horizontal, left and top justified text. The // Creates bounding box (rectangle) for horizontal, left and top justified text. The
@ -284,8 +281,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
for( unsigned ii = 1; ii < strings.GetCount(); ii++ ) for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
{ {
text = strings.Item( ii ); text = strings.Item( ii );
dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth, dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
m_textMarkupFlags ).x );
textsize.x = std::max( textsize.x, dx ); textsize.x = std::max( textsize.x, dx );
textsize.y += dy; textsize.y += dy;
} }
@ -465,7 +461,7 @@ void EDA_TEXT::printOneLineOfText( RENDER_SETTINGS* aSettings, const wxPoint& aO
size.x = -size.x; size.x = -size.x;
GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(), GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags ); GetVertJustify(), penWidth, IsItalic(), IsBold() );
} }
@ -592,14 +588,14 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
{ {
wxString txt = strings_list.Item( ii ); wxString txt = strings_list.Item( ii );
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(), GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToBuffer, GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
&aCornerBuffer ); &aCornerBuffer );
} }
} }
else else
{ {
GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(), GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToBuffer, GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
&aCornerBuffer ); &aCornerBuffer );
} }
} }

View File

@ -169,12 +169,12 @@ void GAL::ResetTextAttributes()
} }
VECTOR2D GAL::GetTextLineSize( const UTF8& aText, int aMarkupFlags ) const VECTOR2D GAL::GetTextLineSize( const UTF8& aText ) const
{ {
// Compute the X and Y size of a given text. // Compute the X and Y size of a given text.
// Because computeTextLineSize expects a one line text, // Because computeTextLineSize expects a one line text,
// aText is expected to be only one line text. // aText is expected to be only one line text.
return strokeFont.computeTextLineSize( aText, aMarkupFlags ); return strokeFont.computeTextLineSize( aText );
} }

View File

@ -185,8 +185,7 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH* aGLYPH, double aGlyphWidth )
} }
void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle, void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle )
int markupFlags )
{ {
if( aText.empty() ) if( aText.empty() )
return; return;
@ -251,7 +250,7 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo
{ {
size_t length = newlinePos - begin; size_t length = newlinePos - begin;
drawSingleLineText( aText.substr( begin, length ), markupFlags ); drawSingleLineText( aText.substr( begin, length ) );
m_gal->Translate( VECTOR2D( 0.0, lineHeight ) ); m_gal->Translate( VECTOR2D( 0.0, lineHeight ) );
begin = newlinePos + 1; begin = newlinePos + 1;
@ -260,13 +259,13 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo
// Draw the last (or the only one) line // Draw the last (or the only one) line
if( !aText.empty() ) if( !aText.empty() )
drawSingleLineText( aText.substr( begin ), markupFlags ); drawSingleLineText( aText.substr( begin ) );
m_gal->Restore(); m_gal->Restore();
} }
void STROKE_FONT::drawSingleLineText( const UTF8& aText, int markupFlags ) void STROKE_FONT::drawSingleLineText( const UTF8& aText )
{ {
double xOffset; double xOffset;
double yOffset; double yOffset;
@ -277,7 +276,7 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText, int markupFlags )
overbar_italic_comp = -overbar_italic_comp; overbar_italic_comp = -overbar_italic_comp;
// Compute the text size // Compute the text size
VECTOR2D textSize = computeTextLineSize( aText, markupFlags ); VECTOR2D textSize = computeTextLineSize( aText );
double half_thickness = m_gal->GetLineWidth()/2; double half_thickness = m_gal->GetLineWidth()/2;
// Context needs to be saved before any transformations // Context needs to be saved before any transformations
@ -329,6 +328,7 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText, int markupFlags )
// overlap. // overlap.
bool last_had_overbar = false; bool last_had_overbar = false;
bool in_overbar = false; bool in_overbar = false;
bool in_super_or_subscript = false;
VECTOR2D glyphSize = baseGlyphSize; VECTOR2D glyphSize = baseGlyphSize;
yOffset = 0; yOffset = 0;
@ -379,43 +379,40 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText, int markupFlags )
in_overbar = !in_overbar; in_overbar = !in_overbar;
} }
} }
else if( *chIt == '^' && ( markupFlags & ENABLE_SUPERSCRIPT_MARKUP ) ) else if( *chIt == '^' )
{ {
if( ++chIt == end ) auto lookahead = chIt;
break;
if( *chIt == '^' ) if( ++lookahead != end && *lookahead == '{' )
{ {
// double ^ is really a ^ so go ahead and process the second one // process superscript
} chIt = lookahead;
else in_super_or_subscript = true;
{
// single ^ starts a superscript
glyphSize = baseGlyphSize * 0.8; glyphSize = baseGlyphSize * 0.8;
yOffset = -baseGlyphSize.y * 0.3; yOffset = -baseGlyphSize.y * 0.3;
continue;
} }
} }
else if( *chIt == '#' && ( markupFlags & ENABLE_SUBSCRIPT_MARKUP ) ) else if( *chIt == '_' )
{ {
if( ++chIt == end ) auto lookahead = chIt;
break;
if( *chIt == '#' ) if( ++lookahead != end && *lookahead == '{' )
{ {
// double # is really a # so go ahead and process the second one // process subscript
} chIt = lookahead;
else in_super_or_subscript = true;
{
// single _ starts a subscript
glyphSize = baseGlyphSize * 0.8; glyphSize = baseGlyphSize * 0.8;
yOffset = baseGlyphSize.y * 0.1; yOffset = baseGlyphSize.y * 0.1;
continue;
} }
} }
else if( *chIt == ' ' ) else if( *chIt == '}' && in_super_or_subscript )
{ {
// space ends a super- or subscript in_super_or_subscript = false;
glyphSize = baseGlyphSize; glyphSize = baseGlyphSize;
yOffset = 0; yOffset = 0;
continue;
} }
// Index into bounding boxes table // Index into bounding boxes table
@ -505,15 +502,14 @@ double STROKE_FONT::computeOverbarVerticalPosition() const
} }
VECTOR2D STROKE_FONT::computeTextLineSize( const UTF8& aText, int aMarkupFlags ) const VECTOR2D STROKE_FONT::computeTextLineSize( const UTF8& aText ) const
{ {
return ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(), m_gal->GetLineWidth(), return ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(), m_gal->GetLineWidth() );
aMarkupFlags );
} }
VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECTOR2D& aGlyphSize, VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECTOR2D& aGlyphSize,
double aGlyphThickness, int markupFlags ) const double aGlyphThickness ) const
{ {
VECTOR2D string_bbox; VECTOR2D string_bbox;
int line_count = 1; int line_count = 1;
@ -521,6 +517,7 @@ VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECT
double curScale = 1.0; double curScale = 1.0;
bool in_overbar = false; bool in_overbar = false;
bool in_super_or_subscript = false;
for( UTF8::uni_iter it = aText.ubegin(), end = aText.uend(); it < end; ++it ) for( UTF8::uni_iter it = aText.ubegin(), end = aText.uend(); it < end; ++it )
{ {
@ -572,40 +569,24 @@ VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECT
in_overbar = !in_overbar; in_overbar = !in_overbar;
} }
} }
else if( *it == '^' && ( markupFlags & ENABLE_SUPERSCRIPT_MARKUP ) ) else if( *it == '^' || *it == '_' )
{ {
if( ++it == end ) auto lookahead = it;
break;
if( *it == '^' ) if( ++lookahead != end && *lookahead == '{' )
{ {
// double ^ is really a ^ so go ahead and process the second one // process superscript
} it = lookahead;
else in_super_or_subscript = true;
{
// single ^ starts a superscript
curScale = 0.8; curScale = 0.8;
continue;
} }
} }
else if( *it == '#' && ( markupFlags & ENABLE_SUBSCRIPT_MARKUP ) ) else if( *it == '}' && in_super_or_subscript )
{ {
if( ++it == end ) in_super_or_subscript = false;
break;
if( *it == '#' )
{
// double # is really a # so go ahead and process the second one
}
else
{
// single _ starts a subscript
curScale = 0.8;
}
}
else if( *it == ' ' )
{
// space ends a super- or subscript
curScale = 1.0; curScale = 1.0;
continue;
} }
// Index in the bounding boxes table // Index in the bounding boxes table

View File

@ -128,7 +128,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText, void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText,
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
int aMarkupFlags, void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ), void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData, PLOTTER* aPlotter ) void* aCallbackData, PLOTTER* aPlotter )
{ {
bool fill_mode = true; bool fill_mode = true;
@ -166,14 +166,14 @@ void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aTe
basic_gal.m_Color = aColor; basic_gal.m_Color = aColor;
basic_gal.SetClipBox( nullptr ); basic_gal.SetClipBox( nullptr );
basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800, aMarkupFlags ); basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800 );
} }
void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1, void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1,
COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize, COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth, bool aItalic, bool aBold, int aMarkupFlags, int aWidth, bool aItalic, bool aBold,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ), void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData, PLOTTER * aPlotter ) void* aCallbackData, PLOTTER * aPlotter )
{ {
@ -188,11 +188,11 @@ void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aCol
// Draw the background // Draw the background
GRText( aDC, aPos, aColor1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic, GRText( aDC, aPos, aColor1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
aBold, aMarkupFlags, aCallback, aCallbackData, aPlotter ); aBold, aCallback, aCallbackData, aPlotter );
// Draw the text // Draw the text
GRText( aDC, aPos, aColor2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth/4, aItalic, GRText( aDC, aPos, aColor2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth/4, aItalic,
aBold, aMarkupFlags, aCallback, aCallbackData, aPlotter ); aBold, aCallback, aCallbackData, aPlotter );
} }
@ -223,12 +223,11 @@ void PLOTTER::Text( const wxPoint& aPos,
int aPenWidth, int aPenWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed, bool aMultilineAllowed,
void* aData ) void* aData )
{ {
SetColor( aColor ); SetColor( aColor );
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth, GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
aItalic, aBold, aTextMarkupFlags, nullptr, nullptr, this ); aItalic, aBold, nullptr, nullptr, this );
} }

View File

@ -870,7 +870,6 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed, bool aMultilineAllowed,
void* aData ) void* aData )
{ {
@ -878,13 +877,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) ) if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
aMultilineAllowed = false; // the text has only one line. aMultilineAllowed = false; // the text has only one line.
bool processSuperSub = false; bool processSuperSub = aText.Contains( wxT( "^{" ) ) || aText.Contains( wxT( "_{" ) );
if( ( aTextMarkupFlags & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
processSuperSub = true;
if( ( aTextMarkupFlags & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
processSuperSub = true;
if( m_textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed || processSuperSub ) if( m_textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed || processSuperSub )
{ {
@ -892,7 +885,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
// Perhaps multiline texts could be handled as DXF text entity // Perhaps multiline texts could be handled as DXF text entity
// but I do not want spend time about this (JPC) // but I do not want spend time about this (JPC)
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed ); aWidth, aItalic, aBold, aMultilineAllowed );
} }
else else
{ {

View File

@ -1164,9 +1164,9 @@ void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos,
void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor, void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor,
const wxString& aText, double aOrient, const wxSize& aSize, const wxString& aText, double aOrient, const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, enum EDA_TEXT_HJUSTIFY_T aH_justify,
int aWidth, bool aItalic, bool aBold, int aTextMarkupFlags, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic,
bool aMultilineAllowed, void* aData ) bool aBold, bool aMultilineAllowed, void* aData )
{ {
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ); GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1174,7 +1174,7 @@ void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor,
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic, PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
aBold, aTextMarkupFlags, aMultilineAllowed, aData ); aBold, aMultilineAllowed, aData );
} }

View File

@ -804,7 +804,6 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed, bool aMultilineAllowed,
void* aData ) void* aData )
{ {
@ -880,7 +879,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
if( !use_native_font ) if( !use_native_font )
{ {
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
aItalic, aBold, aTextMarkupFlags, aMultilineAllowed ); aItalic, aBold, aMultilineAllowed );
} }
} }

View File

@ -974,7 +974,6 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed, bool aMultilineAllowed,
void* aData ) void* aData )
{ {
@ -985,12 +984,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) ) if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
aMultilineAllowed = false; // the text has only one line. aMultilineAllowed = false; // the text has only one line.
bool processSuperSub = false; bool processSuperSub = aText.Contains( wxT( "^{" ) ) || aText.Contains( wxT( "_{" ) );
if( ( aTextMarkupFlags & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
processSuperSub = true;
if( ( aTextMarkupFlags & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
processSuperSub = true; processSuperSub = true;
// Draw the native postscript text (if requested) // Draw the native postscript text (if requested)
@ -1054,7 +1048,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
if( !use_native ) if( !use_native )
{ {
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed ); aWidth, aItalic, aBold, aMultilineAllowed );
} }
} }

View File

@ -756,7 +756,6 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed, bool aMultilineAllowed,
void* aData ) void* aData )
{ {
@ -826,6 +825,6 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
"<g class=\"stroked-text\"><desc>%s</desc>\n", "<g class=\"stroked-text\"><desc>%s</desc>\n",
TO_UTF8( XmlEsc( aText ) ) ); TO_UTF8( XmlEsc( aText ) ) );
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed ); aWidth, aItalic, aBold, aMultilineAllowed );
fputs( "</g>", outputFile ); fputs( "</g>", outputFile );
} }

View File

@ -118,7 +118,7 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(), plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(), text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(), text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
text->GetTextMarkupFlags(), text->IsMultilineAllowed() ); text->IsMultilineAllowed() );
} }
break; break;

View File

@ -69,7 +69,6 @@ struct PART_DRAW_OPTIONS
bool draw_visible_fields; // Whether to draw "visible" fields bool draw_visible_fields; // Whether to draw "visible" fields
bool draw_hidden_fields; // Whether to draw "hidden" fields bool draw_hidden_fields; // Whether to draw "hidden" fields
bool show_elec_type; // Whether to show the pin electrical type bool show_elec_type; // Whether to show the pin electrical type
int text_markup_flags; // Whether to process various text markups
PART_DRAW_OPTIONS() PART_DRAW_OPTIONS()
{ {
@ -77,7 +76,6 @@ struct PART_DRAW_OPTIONS
draw_visible_fields = true; draw_visible_fields = true;
draw_hidden_fields = true; draw_hidden_fields = true;
show_elec_type = false; show_elec_type = false;
text_markup_flags = 0;
} }
}; };

View File

@ -160,8 +160,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
{ {
if( defined.count( templateFieldname.m_Name ) <= 0 ) if( defined.count( templateFieldname.m_Name ) <= 0 )
{ {
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name, SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name );
GetParent()->GetTextMarkupFlags() );
field.SetVisible( templateFieldname.m_Visible ); field.SetVisible( templateFieldname.m_Visible );
m_fields->push_back( field ); m_fields->push_back( field );
} }
@ -532,8 +531,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event )
int fieldID = m_fields->size(); int fieldID = m_fields->size();
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp, SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp,
TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ), TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
GetParent()->GetTextMarkupFlags() );
newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() ); newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
@ -664,8 +662,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary( wxCommandEvent
{ {
if( defined.count( templateFieldname.m_Name ) <= 0 ) if( defined.count( templateFieldname.m_Name ) <= 0 )
{ {
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name, SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name );
GetParent()->GetTextMarkupFlags() );
field.SetVisible( templateFieldname.m_Visible ); field.SetVisible( templateFieldname.m_Visible );
m_fields->push_back( field ); m_fields->push_back( field );
} }

View File

@ -608,8 +608,7 @@ public:
if( !destField && !srcValue.IsEmpty() ) if( !destField && !srcValue.IsEmpty() )
{ {
const auto compOrigin = comp.GetPosition(); const auto compOrigin = comp.GetPosition();
destField = comp.AddField( SCH_FIELD( compOrigin, -1, &comp, srcName, destField = comp.AddField( SCH_FIELD( compOrigin, -1, &comp, srcName ) );
m_frame->GetTextMarkupFlags() ) );
} }
if( !destField ) if( !destField )

View File

@ -188,7 +188,6 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
PART_DRAW_OPTIONS opts; PART_DRAW_OPTIONS opts;
opts.draw_hidden_fields = true; opts.draw_hidden_fields = true;
opts.text_markup_flags = libframe->GetTextMarkupFlags();
RENDER_SETTINGS* renderSettings = libframe->GetRenderSettings(); RENDER_SETTINGS* renderSettings = libframe->GetRenderSettings();
renderSettings->SetPrintDC( &dc ); renderSettings->SetPrintDC( &dc );

View File

@ -562,8 +562,7 @@ void DIALOG_SCH_SHEET_PROPS::OnAddField( wxCommandEvent& event )
int fieldID = m_fields->size(); int fieldID = m_fields->size();
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet, SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet,
SCH_SHEET::GetDefaultFieldName( fieldID ), SCH_SHEET::GetDefaultFieldName( fieldID ) );
m_frame->GetTextMarkupFlags() );
newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() ); newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() );

View File

@ -233,8 +233,7 @@ void DIALOG_UPDATE_FIELDS::updateFields( SCH_COMPONENT* aComponent )
else else
{ {
// Missing field, it has to be added to the component // Missing field, it has to be added to the component
SCH_FIELD newField( wxPoint( 0, 0 ), newFields.size(), aComponent, fieldName, SCH_FIELD newField( wxPoint( 0, 0 ), newFields.size(), aComponent, fieldName );
m_frame->GetTextMarkupFlags() );
newField.ImportValues( *libField ); newField.ImportValues( *libField );
newField.SetText( libField->GetText() ); newField.SetText( libField->GetText() );

View File

@ -38,9 +38,6 @@ PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAM
m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ), m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ),
m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true ) m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true )
{ {
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
m_superSubHint->SetFont( infoFont );
} }
@ -75,9 +72,6 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
wxString offsetRatio = wxString::Format( "%f", m_frame->GetTextOffsetRatio() * 100.0 ); wxString offsetRatio = wxString::Format( "%f", m_frame->GetTextOffsetRatio() * 100.0 );
m_textOffsetRatioCtrl->SetValue( offsetRatio ); m_textOffsetRatioCtrl->SetValue( offsetRatio );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
m_checkSuperSub->SetValue( m_frame->GetTextMarkupFlags() & superSubFlags );
return true; return true;
} }
@ -117,21 +111,11 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
m_frame->SetTextOffsetRatio( dtmp / 100.0 ); m_frame->SetTextOffsetRatio( dtmp / 100.0 );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
if( m_checkSuperSub->GetValue() )
m_frame->SetTextMarkupFlags( m_frame->GetTextMarkupFlags() | superSubFlags );
else
m_frame->SetTextMarkupFlags( m_frame->GetTextMarkupFlags() & ~superSubFlags );
m_frame->GetRenderSettings()->SetDefaultPenWidth( m_frame->GetDefaultLineWidth() ); m_frame->GetRenderSettings()->SetDefaultPenWidth( m_frame->GetDefaultLineWidth() );
m_frame->GetRenderSettings()->m_DefaultWireThickness = m_frame->GetDefaultWireThickness(); m_frame->GetRenderSettings()->m_DefaultWireThickness = m_frame->GetDefaultWireThickness();
m_frame->GetRenderSettings()->m_DefaultBusThickness = m_frame->GetDefaultBusThickness(); m_frame->GetRenderSettings()->m_DefaultBusThickness = m_frame->GetDefaultBusThickness();
m_frame->GetRenderSettings()->m_TextOffsetRatio = m_frame->GetTextOffsetRatio(); m_frame->GetRenderSettings()->m_TextOffsetRatio = m_frame->GetTextOffsetRatio();
SCH_SCREENS schematic;
schematic.UpdateTextMarkupFlags( m_frame->GetTextMarkupFlags() );
m_frame->GetCanvas()->GetView()->MarkDirty(); m_frame->GetCanvas()->GetView()->MarkDirty();
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT ); m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();

View File

@ -75,15 +75,6 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
sbSizer4->Add( fgSizer2, 1, wxEXPAND|wxBOTTOM, 5 ); sbSizer4->Add( fgSizer2, 1, wxEXPAND|wxBOTTOM, 5 );
m_checkSuperSub = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("Enable superscript/subscript markup"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkSuperSub->SetToolTip( _("Use '^' for superscript and '#' for subscript") );
sbSizer4->Add( m_checkSuperSub, 0, wxEXPAND|wxALL, 5 );
m_superSubHint = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("(preceed superscript text with ^; subscript text with #)"), wxDefaultPosition, wxDefaultSize, 0 );
m_superSubHint->Wrap( -1 );
sbSizer4->Add( m_superSubHint, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bLeftColumn->Add( sbSizer4, 1, wxEXPAND|wxALL, 5 ); bLeftColumn->Add( sbSizer4, 1, wxEXPAND|wxALL, 5 );

View File

@ -615,131 +615,6 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Enable superscript/subscript markup</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkSuperSub</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Use &apos;^&apos; for superscript and &apos;#&apos; for subscript</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">(preceed superscript text with ^; subscript text with #)</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_superSubHint</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">

View File

@ -20,7 +20,6 @@
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/panel.h> #include <wx/panel.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -41,8 +40,6 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel
wxStaticText* m_textOffsetRatioLabel; wxStaticText* m_textOffsetRatioLabel;
wxTextCtrl* m_textOffsetRatioCtrl; wxTextCtrl* m_textOffsetRatioCtrl;
wxStaticText* m_offsetRatioUnits; wxStaticText* m_offsetRatioUnits;
wxCheckBox* m_checkSuperSub;
wxStaticText* m_superSubHint;
wxStaticText* m_lineWidthLabel; wxStaticText* m_lineWidthLabel;
wxTextCtrl* m_lineWidthCtrl; wxTextCtrl* m_lineWidthCtrl;
wxStaticText* m_lineWidthUnits; wxStaticText* m_lineWidthUnits;

View File

@ -62,27 +62,26 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( int aType )
{ {
wxPoint cursorPos = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition(); wxPoint cursorPos = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();
SCH_TEXT* textItem = nullptr; SCH_TEXT* textItem = nullptr;
int markupFlags = GetTextMarkupFlags();
s_queuedTexts.clear(); s_queuedTexts.clear();
switch( aType ) switch( aType )
{ {
case LAYER_NOTES: case LAYER_NOTES:
textItem = new SCH_TEXT( cursorPos, wxEmptyString, SCH_TEXT_T, markupFlags ); textItem = new SCH_TEXT( cursorPos );
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
textItem = new SCH_LABEL( cursorPos, wxEmptyString, markupFlags ); textItem = new SCH_LABEL( cursorPos );
break; break;
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
textItem = new SCH_HIERLABEL( cursorPos, wxEmptyString, SCH_HIER_LABEL_T, markupFlags ); textItem = new SCH_HIERLABEL( cursorPos );
textItem->SetShape( lastGlobalLabelShape ); textItem->SetShape( lastGlobalLabelShape );
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
textItem = new SCH_GLOBALLABEL( cursorPos, wxEmptyString, markupFlags ); textItem = new SCH_GLOBALLABEL( cursorPos );
textItem->SetShape( lastGlobalLabelShape ); textItem->SetShape( lastGlobalLabelShape );
break; break;
@ -200,7 +199,6 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
const wxPoint& position = aText->GetPosition(); const wxPoint& position = aText->GetPosition();
LABEL_SPIN_STYLE orientation = aText->GetLabelSpinStyle(); LABEL_SPIN_STYLE orientation = aText->GetLabelSpinStyle();
wxString txt = UnescapeString( aText->GetText() ); wxString txt = UnescapeString( aText->GetText() );
int markupFlags = GetTextMarkupFlags();
// There can be characters in a SCH_TEXT object that can break labels so we have to // There can be characters in a SCH_TEXT object that can break labels so we have to
// fix them here. // fix them here.
@ -218,18 +216,11 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
switch( aNewType ) switch( aNewType )
{ {
case SCH_LABEL_T: case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
newtext = new SCH_LABEL( position, txt, markupFlags ); case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
break; case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
case SCH_GLOBAL_LABEL_T: case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
newtext = new SCH_GLOBALLABEL( position, txt, markupFlags );
break;
case SCH_HIER_LABEL_T:
newtext = new SCH_HIERLABEL( position, txt, SCH_HIER_LABEL_T, markupFlags );
break;
case SCH_TEXT_T:
newtext = new SCH_TEXT( position, txt, SCH_TEXT_T, markupFlags );
break;
default: default:
wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", aNewType ) ); wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", aNewType ) );
return; return;

View File

@ -267,8 +267,6 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
&m_textOffsetRatio, &m_textOffsetRatio,
(double) TXT_MARGIN / DEFAULT_SIZE_TEXT, (double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
-200.0, 200.0 ) ); -200.0, 200.0 ) );
params.push_back( new PARAM_CFG_INT( wxT( "TextMarkupFlags" ),
&m_textMarkupFlags, 0 ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ), params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
&m_defaultLineWidth, &m_defaultLineWidth,
Mils2iu( appSettings->m_Drawing.default_line_thickness ), Mils2iu( appSettings->m_Drawing.default_line_thickness ),

View File

@ -326,7 +326,6 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" ); ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.hv_lines_only" ); ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.hv_lines_only" );
ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" ); ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
ret &= fromLegacy<int>( aCfg, "TextMarkupFlags", "drawing.text_markup_flags" );
ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" ); ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );

View File

@ -407,7 +407,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
} }
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets. schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
g_ConnectionGraph->Reset(); g_ConnectionGraph->Reset();
RecalculateConnections( GLOBAL_CLEANUP ); RecalculateConnections( GLOBAL_CLEANUP );
@ -684,7 +683,6 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
UpdateFileHistory( aFileName ); UpdateFileHistory( aFileName );
SCH_SCREENS schematic; SCH_SCREENS schematic;
schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets. schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets.
schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
GetScreen()->m_Initialized = true; GetScreen()->m_Initialized = true;
SCH_SCREENS allScreens; SCH_SCREENS allScreens;

View File

@ -115,7 +115,7 @@ void LIB_FIELD::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void*
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText(); wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(), GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags ); GetVertJustify(), penWidth, IsItalic(), IsBold() );
} }
@ -289,10 +289,8 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int penWidth = std::max( GetPenWidth(),aPlotter->RenderSettings()->GetDefaultPenWidth() ); int penWidth = std::max( GetPenWidth(),aPlotter->RenderSettings()->GetDefaultPenWidth() );
// NOTE: do NOT use m_textMarkupFlags; those are from the library, not the schematic
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify, aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
penWidth, IsItalic(), IsBold(), aPlotter->GetTextMarkupFlags() ); penWidth, IsItalic(), IsBold() );
} }

View File

@ -563,7 +563,6 @@ void LIB_PIN::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* a
PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData; PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData;
bool drawHiddenFields = opts ? opts->draw_hidden_fields : false; bool drawHiddenFields = opts ? opts->draw_hidden_fields : false;
bool showPinType = opts ? opts->show_elec_type : false; bool showPinType = opts ? opts->show_elec_type : false;
int textMarkupFlags = opts ? opts->text_markup_flags : 0;
LIB_PART* part = GetParent(); LIB_PART* part = GetParent();
@ -578,7 +577,7 @@ void LIB_PIN::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* a
PrintPinSymbol( aSettings, pos1, orient ); PrintPinSymbol( aSettings, pos1, orient );
PrintPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(), PrintPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
part->ShowPinNames(), textMarkupFlags ); part->ShowPinNames() );
if( showPinType ) if( showPinType )
PrintPinElectricalTypeName( aSettings, pos1, orient ); PrintPinElectricalTypeName( aSettings, pos1, orient );
@ -696,7 +695,7 @@ void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, i
void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int orient, void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, bool DrawPinName, int aMarkupFlags ) int TextInside, bool DrawPinNum, bool DrawPinName )
{ {
if( !DrawPinName && !DrawPinNum ) if( !DrawPinName && !DrawPinNum )
return; return;
@ -744,14 +743,14 @@ void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int o
x = x1 + TextInside; x = x1 + TextInside;
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ, GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, PinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
else // Orient == PIN_LEFT else // Orient == PIN_LEFT
{ {
x = x1 - TextInside; x = x1 - TextInside;
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ, GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
} }
@ -759,7 +758,7 @@ void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int o
{ {
GRText( DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ), NumColor, m_number, GRText( DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ), NumColor, m_number,
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags ); GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
@ -772,12 +771,12 @@ void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int o
if( DrawPinName ) if( DrawPinName )
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize, GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
false, aMarkupFlags ); false );
if( DrawPinNum ) if( DrawPinNum )
GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor, GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags ); GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
} }
else /* PIN_UP */ else /* PIN_UP */
{ {
@ -786,12 +785,12 @@ void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int o
if( DrawPinName ) if( DrawPinName )
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize, GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
false, aMarkupFlags ); false );
if( DrawPinNum ) if( DrawPinNum )
GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor, GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags ); GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
} }
} }
} }
@ -805,14 +804,14 @@ void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int o
x = (x1 + pin_pos.x) / 2; x = (x1 + pin_pos.x) / 2;
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ANGLE_HORIZ, GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
if( DrawPinNum ) if( DrawPinNum )
{ {
x = (x1 + pin_pos.x) / 2; x = (x1 + pin_pos.x) / 2;
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, m_number, TEXT_ANGLE_HORIZ, GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, m_number, TEXT_ANGLE_HORIZ,
PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numPenWidth, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numPenWidth,
false, false, aMarkupFlags ); false, false );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
@ -822,14 +821,14 @@ void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int o
y = (y1 + pin_pos.y) / 2; y = (y1 + pin_pos.y) / 2;
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ANGLE_VERT, GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ANGLE_VERT,
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
if( DrawPinNum ) if( DrawPinNum )
{ {
GRText( DC, wxPoint( x1 + num_offset, (y1 + pin_pos.y) / 2 ), NumColor, m_number, GRText( DC, wxPoint( x1 + num_offset, (y1 + pin_pos.y) / 2 ), NumColor, m_number,
TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
numPenWidth, false, false, aMarkupFlags ); numPenWidth, false, false );
} }
} }
} }
@ -1018,7 +1017,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int TextInside, void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int TextInside,
bool DrawPinNum, bool DrawPinName, int aMarkupFlags ) bool DrawPinNum, bool DrawPinName )
{ {
if( m_name.IsEmpty() || m_name == wxT( "~" ) ) if( m_name.IsEmpty() || m_name == wxT( "~" ) )
DrawPinName = false; DrawPinName = false;
@ -1072,7 +1071,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
PinNameSize, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
else // orient == PIN_LEFT else // orient == PIN_LEFT
{ {
@ -1084,7 +1083,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
PinNameSize, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
} }
if( DrawPinNum ) if( DrawPinNum )
@ -1095,7 +1094,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_HORIZ, PinNumSize, TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_BOTTOM,
numPenWidth, false, false, aMarkupFlags ); numPenWidth, false, false );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
@ -1110,7 +1109,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_VERT, PinNameSize, TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
if( DrawPinNum ) if( DrawPinNum )
{ {
@ -1120,7 +1119,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_VERT, PinNumSize, TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_BOTTOM,
numPenWidth, false, false, aMarkupFlags ); numPenWidth, false, false );
} }
} }
else /* PIN_UP */ else /* PIN_UP */
@ -1133,7 +1132,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_VERT, PinNameSize, TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
if( DrawPinNum ) if( DrawPinNum )
{ {
@ -1143,7 +1142,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_VERT, PinNumSize, TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_BOTTOM,
numPenWidth, false, false, aMarkupFlags ); numPenWidth, false, false );
} }
} }
} }
@ -1161,7 +1160,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_HORIZ, PinNameSize, TEXT_ANGLE_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_BOTTOM,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
if( DrawPinNum ) if( DrawPinNum )
@ -1172,7 +1171,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_HORIZ, PinNumSize, TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, GR_TEXT_VJUSTIFY_TOP,
numPenWidth, false, false, aMarkupFlags ); numPenWidth, false, false );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
@ -1185,7 +1184,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_VERT, PinNameSize, TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_BOTTOM,
namePenWidth, false, false, aMarkupFlags ); namePenWidth, false, false );
} }
if( DrawPinNum ) if( DrawPinNum )
@ -1196,7 +1195,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int
TEXT_ANGLE_VERT, PinNumSize, TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, GR_TEXT_VJUSTIFY_TOP,
numPenWidth, false, false, aMarkupFlags ); numPenWidth, false, false );
} }
} }
} }
@ -1394,8 +1393,7 @@ void LIB_PIN::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
PlotSymbol( plotter, pos, orient ); PlotSymbol( plotter, pos, orient );
PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(), PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(), GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames() );
plotter->GetTextMarkupFlags() );
} }

View File

@ -78,9 +78,7 @@ class LIB_PIN : public LIB_ITEM
wxString m_number; wxString m_number;
int m_numTextSize; // Pin num and Pin name sizes int m_numTextSize; // Pin num and Pin name sizes
int m_nameTextSize; int m_nameTextSize;
int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
// features are to be processed within the pin name
// and number.
/** /**
* Print a pin, with or without the pin texts * Print a pin, with or without the pin texts
* *
@ -373,7 +371,7 @@ public:
* Pin Name: substring between '~' is negated * Pin Name: substring between '~' is negated
*/ */
void PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& aPosition, int aOrientation, void PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& aPosition, int aOrientation,
int TextInside, bool DrawPinNum, bool DrawPinName, int aMarkupFlags ); int TextInside, bool DrawPinNum, bool DrawPinName );
/** /**
* Draw the electrical type text of the pin (only for the footprint editor) * Draw the electrical type text of the pin (only for the footprint editor)
@ -389,7 +387,7 @@ public:
* the opposite direction to x2,y2), otherwise all is drawn outside. * the opposite direction to x2,y2), otherwise all is drawn outside.
*/ */
void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPosition, int aOrientation, void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPosition, int aOrientation,
int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aMarkupFlags ); int aTextInside, bool aDrawPinNum, bool aDrawPinName );
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ); void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation );
@ -449,9 +447,6 @@ public:
int GetWidth() const override { return m_width; } int GetWidth() const override { return m_width; }
void SetWidth( int aWidth ) override; void SetWidth( int aWidth ) override;
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;

View File

@ -44,9 +44,9 @@
#include <default_values.h> // For some default values #include <default_values.h> // For some default values
LIB_TEXT::LIB_TEXT( LIB_PART* aParent, int aMarkupFlags ) : LIB_TEXT::LIB_TEXT( LIB_PART* aParent ) :
LIB_ITEM( LIB_TEXT_T, aParent ), LIB_ITEM( LIB_TEXT_T, aParent ),
EDA_TEXT( wxEmptyString, aMarkupFlags ) EDA_TEXT( wxEmptyString )
{ {
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) ); SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
} }
@ -78,7 +78,7 @@ bool LIB_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
EDA_ITEM* LIB_TEXT::Clone() const EDA_ITEM* LIB_TEXT::Clone() const
{ {
LIB_TEXT* newitem = new LIB_TEXT( nullptr, GetTextMarkupFlags() ); LIB_TEXT* newitem = new LIB_TEXT( nullptr );
newitem->m_Unit = m_Unit; newitem->m_Unit = m_Unit;
newitem->m_Convert = m_Convert; newitem->m_Convert = m_Convert;
@ -290,11 +290,9 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
int penWidth = std::max( GetEffectiveTextPenWidth(), int penWidth = std::max( GetEffectiveTextPenWidth(),
plotter->RenderSettings()->GetDefaultPenWidth() ); plotter->RenderSettings()->GetDefaultPenWidth() );
// NOTE: do NOT use m_textMarkupFlags; those are from the library, not the schematic
plotter->Text( pos, color, GetText(), t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT, GetTextSize(), plotter->Text( pos, color, GetText(), t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT, GetTextSize(),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(),
IsBold(), plotter->GetTextMarkupFlags() ); IsBold() );
} }
@ -345,7 +343,7 @@ void LIB_TEXT::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void*
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset; txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
GRText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GRText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold(), m_textMarkupFlags ); GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold() );
} }

View File

@ -43,7 +43,7 @@ class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
const TRANSFORM& aTransform ) override; const TRANSFORM& aTransform ) override;
public: public:
LIB_TEXT( LIB_PART* aParent, int aMarkupFlags = 0 ); LIB_TEXT( LIB_PART* aParent );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.

View File

@ -777,30 +777,6 @@ void LIB_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
void LIB_EDIT_FRAME::RebuildView() void LIB_EDIT_FRAME::RebuildView()
{ {
if( m_my_part )
{
for( LIB_ITEM& item : m_my_part->GetDrawItems() )
{
switch( item.Type() )
{
case LIB_FIELD_T:
static_cast<LIB_FIELD*>( &item )->SetTextMarkupFlags( m_textMarkupFlags );
break;
case LIB_TEXT_T:
static_cast<LIB_TEXT*>( &item )->SetTextMarkupFlags( m_textMarkupFlags );
break;
case LIB_PIN_T:
static_cast<LIB_PIN*>( &item )->SetTextMarkupFlags( m_textMarkupFlags );
break;
default:
break;
}
}
}
GetRenderSettings()->m_ShowUnit = m_unit; GetRenderSettings()->m_ShowUnit = m_unit;
GetRenderSettings()->m_ShowConvert = m_convert; GetRenderSettings()->m_ShowConvert = m_convert;
GetRenderSettings()->m_ShowDisabled = m_my_part && m_my_part->IsAlias(); GetRenderSettings()->m_ShowDisabled = m_my_part && m_my_part->IsAlias();

View File

@ -41,7 +41,6 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
plotter->SetRenderSettings( &renderSettings ); plotter->SetRenderSettings( &renderSettings );
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( true ); plotter->SetColorMode( true );
plotter->SetTextMarkupFlags( GetTextMarkupFlags() );
wxPoint plot_offset; wxPoint plot_offset;
const double scale = 1.0; const double scale = 1.0;

View File

@ -574,7 +574,6 @@ bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
SCH_SCREENS schematic; SCH_SCREENS schematic;
schematic.UpdateSymbolLinks( true ); schematic.UpdateSymbolLinks( true );
schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
g_ConnectionGraph->Reset(); g_ConnectionGraph->Reset();
RecalculateConnections( GLOBAL_CLEANUP ); RecalculateConnections( GLOBAL_CLEANUP );

View File

@ -88,7 +88,6 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ), m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ), m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
m_textOffsetRatio( 0.08 ), m_textOffsetRatio( 0.08 ),
m_textMarkupFlags( 0 ),
m_showPinElectricalTypeName( false ) m_showPinElectricalTypeName( false )
{ {
createCanvas(); createCanvas();

View File

@ -93,7 +93,6 @@ protected:
int m_defaultBusThickness; int m_defaultBusThickness;
int m_defaultTextSize; int m_defaultTextSize;
double m_textOffsetRatio; double m_textOffsetRatio;
int m_textMarkupFlags;
TEMPLATES m_templateFieldNames; TEMPLATES m_templateFieldNames;
@ -147,9 +146,6 @@ public:
double GetTextOffsetRatio() const { return m_textOffsetRatio; } double GetTextOffsetRatio() const { return m_textOffsetRatio; }
void SetTextOffsetRatio( double aRatio ) { m_textOffsetRatio = aRatio; } void SetTextOffsetRatio( double aRatio ) { m_textOffsetRatio = aRatio; }
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
/** /**
* Function GetZoomLevelIndicator * Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom * returns a human readable value which can be displayed as zoom

View File

@ -535,7 +535,6 @@ void SCH_COMPONENT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
opts.transform = m_transform; opts.transform = m_transform;
opts.draw_visible_fields = false; opts.draw_visible_fields = false;
opts.draw_hidden_fields = false; opts.draw_hidden_fields = false;
opts.text_markup_flags = m_Fields[0].GetTextMarkupFlags();
if( m_part ) if( m_part )
{ {
@ -822,8 +821,7 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef )
if( !schField ) if( !schField )
{ {
wxString fieldName = libField.GetCanonicalName(); wxString fieldName = libField.GetCanonicalName();
SCH_FIELD newField( wxPoint( 0, 0), GetFieldCount(), this, fieldName, SCH_FIELD newField( wxPoint( 0, 0), GetFieldCount(), this, fieldName );
GetField( REFERENCE )->GetTextMarkupFlags() );
schField = AddField( newField ); schField = AddField( newField );
} }
} }
@ -1828,9 +1826,6 @@ void SCH_COMPONENT::Plot( PLOTTER* aPlotter )
TRANSFORM temp = GetTransform(); TRANSFORM temp = GetTransform();
aPlotter->StartBlock( nullptr ); aPlotter->StartBlock( nullptr );
// A cheater since we don't want to modify the various LIB_ITEMs' m_textMarkupFlags
aPlotter->SetTextMarkupFlags( m_Fields[0].GetTextMarkupFlags() );
m_part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp ); m_part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp );
for( SCH_FIELD field : m_Fields ) for( SCH_FIELD field : m_Fields )

View File

@ -48,10 +48,10 @@
#include <trace_helpers.h> #include <trace_helpers.h>
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName, SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
int aMarkupFlags ) : const wxString& aName ) :
SCH_ITEM( aParent, SCH_FIELD_T ), SCH_ITEM( aParent, SCH_FIELD_T ),
EDA_TEXT( wxEmptyString, aMarkupFlags ) EDA_TEXT( wxEmptyString )
{ {
SetTextPos( aPos ); SetTextPos( aPos );
m_id = aFieldId; m_id = aFieldId;
@ -178,7 +178,7 @@ void SCH_FIELD::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
textpos = boundaryBox.Centre() + aOffset; textpos = boundaryBox.Centre() + aOffset;
GRText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GRText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold(), m_textMarkupFlags ); GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold() );
} }
@ -525,7 +525,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
wxPoint textpos = BoundaryBox.Centre(); wxPoint textpos = BoundaryBox.Centre();
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify, aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
penWidth, IsItalic(), IsBold(), m_textMarkupFlags ); penWidth, IsItalic(), IsBold() );
} }

View File

@ -57,7 +57,7 @@ class SCH_FIELD : public SCH_ITEM, public EDA_TEXT
public: public:
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
const wxString& aName = wxEmptyString, int aMarkupFlags = 0 ); const wxString& aName = wxEmptyString );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.

View File

@ -370,10 +370,9 @@ float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows
} }
void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle, void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle )
int aTextMarkupFlags )
{ {
m_gal->StrokeText( aText, aPosition, aAngle, aTextMarkupFlags ); m_gal->StrokeText( aText, aPosition, aAngle );
} }
@ -632,7 +631,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
double orient = aField->GetTextAngleRadians(); double orient = aField->GetTextAngleRadians();
strokeText( aField->GetText(), pos, orient, aField->GetTextMarkupFlags() ); strokeText( aField->GetText(), pos, orient );
} }
// Draw the umbilical line // Draw the umbilical line
@ -679,7 +678,7 @@ void SCH_PAINTER::draw( LIB_TEXT *aText, int aLayer )
m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) ); m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
m_gal->SetFontBold( aText->IsBold() ); m_gal->SetFontBold( aText->IsBold() );
m_gal->SetFontItalic( aText->IsItalic() ); m_gal->SetFontItalic( aText->IsItalic() );
strokeText( aText->GetText(), pos, orient, aText->GetTextMarkupFlags() ); strokeText( aText->GetText(), pos, orient );
} }
@ -714,7 +713,6 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
return; return;
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
int flags = aPin->GetTextMarkupFlags();
if( drawingShadows && !aPin->IsSelected() ) if( drawingShadows && !aPin->IsSelected() )
return; return;
@ -988,28 +986,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE ); SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0, flags ); strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 );
} }
if( size[OUTSIDE] ) if( size[OUTSIDE] )
{ {
SET_DC( OUTSIDE ); SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0, flags ); strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 );
} }
if( size[ABOVE] ) if( size[ABOVE] )
{ {
SET_DC( ABOVE ); SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0, flags ); strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
} }
if( size[BELOW] ) if( size[BELOW] )
{ {
SET_DC( BELOW ); SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0, flags ); strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
} }
break; break;
@ -1020,28 +1018,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0, flags ); strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 );
} }
if( size[OUTSIDE] ) if( size[OUTSIDE] )
{ {
SET_DC( OUTSIDE ); SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0, flags ); strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 );
} }
if( size[ABOVE] ) if( size[ABOVE] )
{ {
SET_DC( ABOVE ); SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0, flags ); strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
} }
if( size[BELOW] ) if( size[BELOW] )
{ {
SET_DC( BELOW ); SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0, flags ); strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
} }
break; break;
@ -1051,28 +1049,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE ); SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2, flags ); strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2 );
} }
if( size[OUTSIDE] ) if( size[OUTSIDE] )
{ {
SET_DC( OUTSIDE ); SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2, flags ); strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2 );
} }
if( size[ABOVE] ) if( size[ABOVE] )
{ {
SET_DC( ABOVE ); SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2, flags ); strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
} }
if( size[BELOW] ) if( size[BELOW] )
{ {
SET_DC( BELOW ); SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2, flags ); strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
} }
break; break;
@ -1082,28 +1080,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE ); SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2, flags ); strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2 );
} }
if( size[OUTSIDE] ) if( size[OUTSIDE] )
{ {
SET_DC( OUTSIDE ); SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2, flags ); strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2 );
} }
if( size[ABOVE] ) if( size[ABOVE] )
{ {
SET_DC( ABOVE ); SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2, flags ); strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
} }
if( size[BELOW] ) if( size[BELOW] )
{ {
SET_DC( BELOW ); SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2, flags ); strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
} }
break; break;
@ -1316,8 +1314,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
if( !shownText.IsEmpty() ) if( !shownText.IsEmpty() )
{ {
strokeText( shownText, text_offset, aText->GetTextAngleRadians(), strokeText( shownText, text_offset, aText->GetTextAngleRadians() );
aText->GetTextMarkupFlags() );
} }
if( aText->IsDangling() ) if( aText->IsDangling() )
@ -1405,7 +1402,6 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
tempPin->ClearFlags(); tempPin->ClearFlags();
tempPin->SetFlags( compPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED tempPin->SetFlags( compPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
tempPin->SetTextMarkupFlags( compPin->GetTextMarkupFlags() );
if( compPin->IsDangling() ) if( compPin->IsDangling() )
tempPin->SetFlags( IS_DANGLING ); tempPin->SetFlags( IS_DANGLING );
@ -1499,8 +1495,7 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
m_gal->SetTextMirrored( aField->IsMirrored() ); m_gal->SetTextMirrored( aField->IsMirrored() );
m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) ); m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0, strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0 );
aField->GetTextMarkupFlags() );
} }
// Draw the umbilical line // Draw the umbilical line

View File

@ -183,8 +183,7 @@ private:
void fillIfSelection( int aLayer ); void fillIfSelection( int aLayer );
void triLine ( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c ); void triLine ( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle, void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle );
int aTextMarkupFlags );
SCH_RENDER_SETTINGS m_schSettings; SCH_RENDER_SETTINGS m_schSettings;
}; };

View File

@ -39,10 +39,6 @@ class SCH_PIN : public SCH_ITEM
wxPoint m_position; wxPoint m_position;
bool m_isDangling; bool m_isDangling;
int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
// features are to be processed within the pin name
// and number.
/// The name that this pin connection will drive onto a net /// The name that this pin connection will drive onto a net
std::mutex m_netmap_mutex; std::mutex m_netmap_mutex;
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map; std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
@ -89,9 +85,6 @@ public:
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
bool IsDangling() const override { return m_isDangling; } bool IsDangling() const override { return m_isDangling; }
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; } void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }

View File

@ -521,43 +521,6 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
} }
void SCH_SCREEN::UpdateTextMarkupFlags( int aMarkupFlags )
{
for( SCH_ITEM* aItem : Items() )
{
switch( aItem->Type() )
{
case SCH_TEXT_T:
case SCH_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_SHEET_PIN_T:
static_cast<SCH_TEXT*>( aItem )->SetTextMarkupFlags( aMarkupFlags );
break;
case SCH_COMPONENT_T:
for( SCH_FIELD& field : static_cast<SCH_COMPONENT*>( aItem )->GetFields() )
field.SetTextMarkupFlags( aMarkupFlags );
break;
case SCH_PIN_T:
static_cast<SCH_PIN*>( aItem )->SetTextMarkupFlags( aMarkupFlags );
break;
case SCH_SHEET_T:
for( SCH_FIELD& field : static_cast<SCH_SHEET*>( aItem )->GetFields() )
field.SetTextMarkupFlags( aMarkupFlags );
break;
default:
break;
}
}
}
void SCH_SCREEN::Print( RENDER_SETTINGS* aSettings ) void SCH_SCREEN::Print( RENDER_SETTINGS* aSettings )
{ {
// Ensure links are up to date, even if a library was reloaded for some reason: // Ensure links are up to date, even if a library was reloaded for some reason:
@ -1189,13 +1152,6 @@ void SCH_SCREENS::UpdateSymbolLinks( bool aForce )
} }
void SCH_SCREENS::UpdateTextMarkupFlags( int aMarkupFlags )
{
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
screen->UpdateTextMarkupFlags( aMarkupFlags );
}
void SCH_SCREENS::TestDanglingEnds() void SCH_SCREENS::TestDanglingEnds()
{ {
std::vector<SCH_SCREEN*> screens; std::vector<SCH_SCREEN*> screens;

View File

@ -235,8 +235,6 @@ public:
*/ */
void UpdateSymbolLinks( bool aForce = false ); void UpdateSymbolLinks( bool aForce = false );
void UpdateTextMarkupFlags( int aMarkupFlags );
/** /**
* Print all the items in the screen to \a aDC. * Print all the items in the screen to \a aDC.
* *
@ -556,8 +554,6 @@ public:
*/ */
void UpdateSymbolLinks( bool aForce = false ); void UpdateSymbolLinks( bool aForce = false );
void UpdateTextMarkupFlags( int aMarkupFlags );
void TestDanglingEnds(); void TestDanglingEnds();
/** /**

View File

@ -96,9 +96,9 @@ static int* TemplateShape[5][4] =
}; };
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType, int aMarkupFlags ) : SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
SCH_ITEM( NULL, aType ), SCH_ITEM( NULL, aType ),
EDA_TEXT( text, aMarkupFlags ), EDA_TEXT( text ),
m_shape( PINSHEETLABEL_SHAPE::PS_INPUT ), m_shape( PINSHEETLABEL_SHAPE::PS_INPUT ),
m_isDangling( false ), m_isDangling( false ),
m_connectionType( CONNECTION_TYPE::NONE ), m_connectionType( CONNECTION_TYPE::NONE ),
@ -603,7 +603,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
wxPoint textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() ); wxPoint textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() );
wxString& txt = strings_list.Item( ii ); wxString& txt = strings_list.Item( ii );
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(), aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags ); GetVertJustify(), penWidth, IsItalic(), IsBold() );
} }
} }
else else
@ -611,8 +611,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
wxPoint textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() ); wxPoint textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(), aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(), GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
m_textMarkupFlags );
} }
// Draw graphic symbol for global or hierarchical labels // Draw graphic symbol for global or hierarchical labels
@ -703,8 +702,8 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const
#endif #endif
SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text, int aMarkupFlags ) SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text )
: SCH_TEXT( pos, text, SCH_LABEL_T, aMarkupFlags ) : SCH_TEXT( pos, text, SCH_LABEL_T )
{ {
m_Layer = LAYER_LOCLABEL; m_Layer = LAYER_LOCLABEL;
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
@ -796,8 +795,8 @@ BITMAP_DEF SCH_LABEL::GetMenuImage() const
} }
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text, int aMarkupFlags ) SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text )
: SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T, aMarkupFlags ) : SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T )
{ {
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_shape = PINSHEETLABEL_SHAPE::PS_BIDI; m_shape = PINSHEETLABEL_SHAPE::PS_BIDI;
@ -905,7 +904,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( RENDER_SETTINGS* aRenderSettings,
int margin = GetTextOffset( aRenderSettings ); int margin = GetTextOffset( aRenderSettings );
int halfSize = ( GetTextHeight() / 2 ) + margin; int halfSize = ( GetTextHeight() / 2 ) + margin;
int linewidth = GetPenWidth(); int linewidth = GetPenWidth();
int symb_len = LenSize( GetShownText(), linewidth, m_textMarkupFlags ) + 2 * margin; int symb_len = LenSize( GetShownText(), linewidth ) + 2 * margin;
int x = symb_len + linewidth + 3; int x = symb_len + linewidth + 3;
int y = halfSize; int y = halfSize;
@ -982,7 +981,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
int margin = Mils2iu( TXT_MARGIN ); int margin = Mils2iu( TXT_MARGIN );
int height = ( (GetTextHeight() * 15) / 10 ) + penWidth + 2 * margin; int height = ( (GetTextHeight() * 15) / 10 ) + penWidth + 2 * margin;
int length = LenSize( GetShownText(), penWidth, m_textMarkupFlags ) int length = LenSize( GetShownText(), penWidth )
+ height // add height for triangular shapes + height // add height for triangular shapes
+ 2 * margin; + 2 * margin;
@ -1038,9 +1037,8 @@ BITMAP_DEF SCH_GLOBALLABEL::GetMenuImage() const
} }
SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType, SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType )
int aMarkupFlags ) : SCH_TEXT( pos, text, aType )
: SCH_TEXT( pos, text, aType, aMarkupFlags )
{ {
m_Layer = LAYER_HIERLABEL; m_Layer = LAYER_HIERLABEL;
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
@ -1150,7 +1148,7 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
int y = GetTextPos().y; int y = GetTextPos().y;
int height = GetTextHeight() + penWidth + 2 * margin; int height = GetTextHeight() + penWidth + 2 * margin;
int length = LenSize( GetShownText(), penWidth, m_textMarkupFlags ) int length = LenSize( GetShownText(), penWidth )
+ height // add height for triangular shapes + height // add height for triangular shapes
+ 2 * margin; + 2 * margin;

View File

@ -185,7 +185,7 @@ protected:
public: public:
SCH_TEXT( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, SCH_TEXT( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString,
KICAD_T aType = SCH_TEXT_T, int aMarkupFlags = 0 ); KICAD_T aType = SCH_TEXT_T );
/** /**
* Clones \a aText into a new object. All members are copied as is except * Clones \a aText into a new object. All members are copied as is except
@ -325,8 +325,7 @@ public:
class SCH_LABEL : public SCH_TEXT class SCH_LABEL : public SCH_TEXT
{ {
public: public:
SCH_LABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, SCH_LABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString );
int aMarkupFlags = 0 );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -370,8 +369,7 @@ private:
class SCH_GLOBALLABEL : public SCH_TEXT class SCH_GLOBALLABEL : public SCH_TEXT
{ {
public: public:
SCH_GLOBALLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, SCH_GLOBALLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString );
int aMarkupFlags = 0 );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -421,7 +419,7 @@ class SCH_HIERLABEL : public SCH_TEXT
{ {
public: public:
SCH_HIERLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, SCH_HIERLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString,
KICAD_T aType = SCH_HIER_LABEL_T, int aMarkupFlags = 0 ); KICAD_T aType = SCH_HIER_LABEL_T );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.

View File

@ -472,7 +472,6 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
SCH_SCREENS screens( aSheet ); SCH_SCREENS screens( aSheet );
screens.UpdateSymbolLinks( true ); screens.UpdateSymbolLinks( true );
screens.UpdateTextMarkupFlags( GetTextMarkupFlags() );
return true; return true;
} }

View File

@ -143,7 +143,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
} }
case LIB_TEXT_T: case LIB_TEXT_T:
{ {
LIB_TEXT* text = new LIB_TEXT( part, m_frame->GetTextMarkupFlags() ); LIB_TEXT* text = new LIB_TEXT( part );
text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) ); text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( wxSize( m_frame->GetDefaultTextSize(), text->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
m_frame->GetDefaultTextSize() ) ); m_frame->GetDefaultTextSize() ) );

View File

@ -661,7 +661,7 @@ int LIB_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
{ {
// If it's not a part then paste as text // If it's not a part then paste as text
newPart = new LIB_PART( "dummy_part" ); newPart = new LIB_PART( "dummy_part" );
LIB_TEXT* newText = new LIB_TEXT( newPart, m_frame->GetTextMarkupFlags() ); LIB_TEXT* newText = new LIB_TEXT( newPart );
newText->SetText( text ); newText->SetText( text );
newPart->AddDrawItem( newText ); newPart->AddDrawItem( newText );
} }

View File

@ -1170,8 +1170,6 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
} }
} }
paste_screen.UpdateTextMarkupFlags( m_frame->GetTextMarkupFlags() );
// Remove the references from our temporary screen to prevent freeing on the DTOR // Remove the references from our temporary screen to prevent freeing on the DTOR
paste_screen.Clear( false ); paste_screen.Clear( false );

View File

@ -373,8 +373,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
m_busUnfold.entry->SetParent( m_frame->GetScreen() ); m_busUnfold.entry->SetParent( m_frame->GetScreen() );
m_frame->AddToScreen( m_busUnfold.entry ); m_frame->AddToScreen( m_busUnfold.entry );
m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet, m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet );
m_frame->GetTextMarkupFlags() );
m_busUnfold.label->SetTextSize( wxSize( m_frame->GetDefaultTextSize(), m_busUnfold.label->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
m_frame->GetDefaultTextSize() ) ); m_frame->GetDefaultTextSize() ) );
m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );

View File

@ -112,7 +112,7 @@ struct TEXT_EFFECTS
class EDA_TEXT class EDA_TEXT
{ {
public: public:
EDA_TEXT( const wxString& text = wxEmptyString, int aMarkupFlags = 0 ); EDA_TEXT( const wxString& text = wxEmptyString );
EDA_TEXT( const EDA_TEXT& aText ); EDA_TEXT( const EDA_TEXT& aText );
@ -218,9 +218,6 @@ public:
bool IsDefaultFormatting() const; bool IsDefaultFormatting() const;
void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
void SetTextSize( const wxSize& aNewSize ) { m_e.size = aNewSize; } void SetTextSize( const wxSize& aNewSize ) { m_e.size = aNewSize; }
const wxSize& GetTextSize() const { return m_e.size; } const wxSize& GetTextSize() const { return m_e.size; }
@ -303,10 +300,8 @@ public:
* @param aLine : the line of text to consider. * @param aLine : the line of text to consider.
* For single line text, this parameter is always m_Text * For single line text, this parameter is always m_Text
* @param aThickness : the stroke width of the text * @param aThickness : the stroke width of the text
* @param aMarkupFlags a flag set of MARKUP_FLAG enums indicating which markup tokens should
* be processed
*/ */
int LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const; int LenSize( const wxString& aLine, int aThickness ) const;
/** /**
* Useful in multiline texts to calculate the full text or a line area (for zones filling, * Useful in multiline texts to calculate the full text or a line area (for zones filling,
@ -353,9 +348,6 @@ public:
*/ */
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const; virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
protected:
int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
// features are to be processed.
private: private:
wxString m_text; wxString m_text;
wxString m_shown_text; // Cache of unescaped text for efficient access wxString m_shown_text; // Cache of unescaped text for efficient access

View File

@ -339,12 +339,11 @@ public:
* @param aText is the text to be drawn. * @param aText is the text to be drawn.
* @param aPosition is the text position in world coordinates. * @param aPosition is the text position in world coordinates.
* @param aRotationAngle is the text rotation angle. * @param aRotationAngle is the text rotation angle.
* @param aMarkupFlags a bitset of TEXT_MARKUP_FLAGS.
*/ */
virtual void StrokeText( const wxString& aText, const VECTOR2D& aPosition, virtual void StrokeText( const wxString& aText, const VECTOR2D& aPosition,
double aRotationAngle, int aMarkupFlags = 0 ) double aRotationAngle )
{ {
strokeFont.Draw( aText, aPosition, aRotationAngle, aMarkupFlags ); strokeFont.Draw( aText, aPosition, aRotationAngle );
} }
/** /**
@ -375,10 +374,9 @@ public:
* a only one line text. * a only one line text.
* *
* @param aText is the text string (one line). * @param aText is the text string (one line).
* @param aMarkupFlags a bitset of TEXT_MARKUP_FLAGS.
* @return is the text size. * @return is the text size.
*/ */
VECTOR2D GetTextLineSize( const UTF8& aText, int aMarkupFlags = 0 ) const; VECTOR2D GetTextLineSize( const UTF8& aText ) const;
/** /**
* Compute the vertical position of an overbar, sometimes used in texts. * Compute the vertical position of an overbar, sometimes used in texts.

View File

@ -73,11 +73,8 @@ public:
* @param aText is the text to be drawn. * @param aText is the text to be drawn.
* @param aPosition is the text position in world coordinates. * @param aPosition is the text position in world coordinates.
* @param aRotationAngle is the text rotation angle in radians. * @param aRotationAngle is the text rotation angle in radians.
* @param markupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should
* be processed
*/ */
void Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle, void Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle );
int markupFlags );
/** /**
* Function SetGAL * Function SetGAL
@ -92,13 +89,10 @@ public:
/** /**
* Compute the boundary limits of aText (the bounding box of all shapes). * Compute the boundary limits of aText (the bounding box of all shapes).
* The overbar and alignment are not taken in account, '~' characters are skipped. * The overbar and alignment are not taken in account, '~' characters are skipped.
*
* @param markupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should
* be processed
* @return a VECTOR2D giving the width and height of text. * @return a VECTOR2D giving the width and height of text.
*/ */
VECTOR2D ComputeStringBoundaryLimits( const UTF8& aText, const VECTOR2D& aGlyphSize, VECTOR2D ComputeStringBoundaryLimits( const UTF8& aText, const VECTOR2D& aGlyphSize,
double aGlyphThickness, int markupFlags ) const; double aGlyphThickness ) const;
/** /**
* Compute the vertical position of an overbar, sometimes used in texts. * Compute the vertical position of an overbar, sometimes used in texts.
@ -129,10 +123,9 @@ private:
* a only one line text. * a only one line text.
* *
* @param aText is the text string (one line). * @param aText is the text string (one line).
* @param aMarkupFlags a bitset of TEXT_MARKUP_FLAGS.
* @return the text size. * @return the text size.
*/ */
VECTOR2D computeTextLineSize( const UTF8& aText, int aMarkupFlags ) const; VECTOR2D computeTextLineSize( const UTF8& aText ) const;
/** /**
* Compute the vertical position of an overbar, sometimes used in texts. * Compute the vertical position of an overbar, sometimes used in texts.
@ -156,7 +149,7 @@ private:
* *
* @param aText is the text to be drawn. * @param aText is the text to be drawn.
*/ */
void drawSingleLineText( const UTF8& aText, int markupFlags ); void drawSingleLineText( const UTF8& aText );
/** /**
* @brief Returns number of lines for a given text. * @brief Returns number of lines for a given text.

View File

@ -50,12 +50,6 @@
class PLOTTER; class PLOTTER;
enum TEXT_MARKUP_FLAGS
{
ENABLE_SUBSCRIPT_MARKUP = 1 << 0,
ENABLE_SUPERSCRIPT_MARKUP = 1 << 1
};
/** /**
* Function Clamp_Text_PenSize * Function Clamp_Text_PenSize
*As a rule, pen width should not be >1/4em, otherwise the character *As a rule, pen width should not be >1/4em, otherwise the character
@ -103,8 +97,6 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
* Use a value min(aSize.x, aSize.y) / 5 for a bold text * Use a value min(aSize.x, aSize.y) / 5 for a bold text
* @param aItalic = true to simulate an italic font * @param aItalic = true to simulate an italic font
* @param aBold = true to use a bold font * @param aBold = true to use a bold font
* @param aMarkupFlags a set of TEXT_MARKUP_FLAGS indicating what markup features are to
* be processed
* @param aCallback( int x0, int y0, int xf, int yf, void* aData ) is a function called * @param aCallback( int x0, int y0, int xf, int yf, void* aData ) is a function called
* (if non null) to draw each segment. used to draw 3D texts or for plotting. * (if non null) to draw each segment. used to draw 3D texts or for plotting.
* NULL for normal drawings * NULL for normal drawings
@ -116,7 +108,6 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
void GRText( wxDC * aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, void GRText( wxDC * aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText,
double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
int aMarkupFlags,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr, void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr ); void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
@ -130,7 +121,7 @@ void GRText( wxDC * aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aT
void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1, void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1,
COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize, COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth, bool aItalic, bool aBold, int aMarkupFlags, int aWidth, bool aItalic, bool aBold,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr, void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr ); void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );

View File

@ -133,9 +133,6 @@ public:
virtual void SetColorMode( bool aColorMode ) { colorMode = aColorMode; } virtual void SetColorMode( bool aColorMode ) { colorMode = aColorMode; }
bool GetColorMode() const { return colorMode; } bool GetColorMode() const { return colorMode; }
void SetTextMarkupFlags( bool aMarkupFlags ) { m_textMarkupFlags = aMarkupFlags; }
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
void SetRenderSettings( RENDER_SETTINGS* aSettings ) { m_renderSettings = aSettings; } void SetRenderSettings( RENDER_SETTINGS* aSettings ) { m_renderSettings = aSettings; }
RENDER_SETTINGS* RenderSettings() { return m_renderSettings; } RENDER_SETTINGS* RenderSettings() { return m_renderSettings; }
@ -412,7 +409,6 @@ public:
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed = false, bool aMultilineAllowed = false,
void* aData = NULL ); void* aData = NULL );
@ -590,7 +586,6 @@ protected: // variables used in most of plotters:
wxArrayString m_headerExtraLines; // a set of string to print in header file wxArrayString m_headerExtraLines; // a set of string to print in header file
RENDER_SETTINGS* m_renderSettings; RENDER_SETTINGS* m_renderSettings;
int m_textMarkupFlags;
}; };
@ -827,7 +822,6 @@ public:
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed = false, bool aMultilineAllowed = false,
void* aData = NULL ) override; void* aData = NULL ) override;
protected: protected:
@ -900,7 +894,6 @@ public:
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed = false, bool aMultilineAllowed = false,
void* aData = NULL ) override; void* aData = NULL ) override;
@ -994,7 +987,6 @@ public:
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed = false, bool aMultilineAllowed = false,
void* aData = NULL ) override; void* aData = NULL ) override;
@ -1202,7 +1194,6 @@ public:
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed = false, bool aMultilineAllowed = false,
void* aData = NULL ) override; void* aData = NULL ) override;
@ -1490,7 +1481,6 @@ public:
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
int aTextMarkupFlags,
bool aMultilineAllowed = false, bool aMultilineAllowed = false,
void* aData = NULL ) override; void* aData = NULL ) override;

View File

@ -275,10 +275,10 @@ class WS_DRAW_ITEM_TEXT : public WS_DRAW_ITEM_BASE, public EDA_TEXT
{ {
public: public:
WS_DRAW_ITEM_TEXT( WS_DATA_ITEM* aPeer, int aIndex, wxString& aText, wxPoint aPos, WS_DRAW_ITEM_TEXT( WS_DATA_ITEM* aPeer, int aIndex, wxString& aText, wxPoint aPos,
wxSize aSize, int aPenWidth, int aMarkupFlags, bool aItalic = false, wxSize aSize, int aPenWidth, bool aItalic = false,
bool aBold = false ) : bool aBold = false ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T), WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T),
EDA_TEXT( aText, aMarkupFlags ) EDA_TEXT( aText )
{ {
SetTextPos( aPos ); SetTextPos( aPos );
SetTextSize( aSize ); SetTextSize( aSize );

View File

@ -234,8 +234,8 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLaye
GRText( NULL, textmod->GetTextPos(), BLACK, textmod->GetShownText(), GRText( NULL, textmod->GetTextPos(), BLACK, textmod->GetShownText(),
textmod->GetDrawRotation(), size, textmod->GetHorizJustify(), textmod->GetDrawRotation(), size, textmod->GetHorizJustify(),
textmod->GetVertJustify(), penWidth, textmod->IsItalic(), textmod->GetVertJustify(), penWidth, textmod->IsItalic(), forceBold,
forceBold, 0, addTextSegmToPoly, &prms ); addTextSegmToPoly, &prms );
} }
} }
@ -336,13 +336,13 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCorner
{ {
wxString txt = strings_list.Item( ii ); wxString txt = strings_list.Item( ii );
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(), GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToPoly, &prms ); GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToPoly, &prms );
} }
} }
else else
{ {
GRText( NULL, GetTextPos(), color, GetShownText(), GetTextAngle(), size, GetHorizJustify(), GRText( NULL, GetTextPos(), color, GetShownText(), GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToPoly, &prms ); GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToPoly, &prms );
} }
} }

View File

@ -308,7 +308,7 @@ void TEXTE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOff
size.x = -size.x; size.x = -size.x;
GRText( aDC, pos, color, GetShownText(), orient, size, GetHorizJustify(), GetVertJustify(), GRText( aDC, pos, color, GetShownText(), orient, size, GetHorizJustify(), GetVertJustify(),
width, IsItalic(), IsBold(), 0 ); width, IsItalic(), IsBold() );
} }

View File

@ -659,7 +659,7 @@ void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
tsize = (tsize * 7) / 10; // small reduction to give a better look, inside via tsize = (tsize * 7) / 10; // small reduction to give a better look, inside via
GRHaloText( aDC, m_Start, color, WHITE, BLACK, text, 0, wxSize( tsize, tsize ), GRHaloText( aDC, m_Start, color, WHITE, BLACK, text, 0, wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize/7, false, false, 0 ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize/7, false, false );
} }
} }
} }

View File

@ -797,14 +797,14 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
{ {
GRText( nullptr, positions[ii], color, strings_list[ii], text->GetTextAngle(), size, GRText( nullptr, positions[ii], color, strings_list[ii], text->GetTextAngle(), size,
text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(), text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
forceBold, 0, vrml_text_callback ); forceBold, vrml_text_callback );
} }
} }
else else
{ {
GRText( nullptr, text->GetTextPos(), color, text->GetShownText(), text->GetTextAngle(), GRText( nullptr, text->GetTextPos(), color, text->GetShownText(), text->GetTextAngle(),
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(), size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
forceBold, 0, vrml_text_callback ); forceBold, vrml_text_callback );
} }
} }
@ -1066,7 +1066,7 @@ static void export_vrml_text_module( TEXTE_MODULE* item )
GRText( NULL, item->GetTextPos(), BLACK, item->GetShownText(), item->GetDrawRotation(), GRText( NULL, item->GetTextPos(), BLACK, item->GetShownText(), item->GetDrawRotation(),
size, item->GetHorizJustify(), item->GetVertJustify(), penWidth, item->IsItalic(), size, item->GetHorizJustify(), item->GetVertJustify(), penWidth, item->IsItalic(),
forceBold, 0, vrml_text_callback ); forceBold, vrml_text_callback );
} }
} }

View File

@ -241,7 +241,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
wxString Text = wxT( "Drill Map:" ); wxString Text = wxT( "Drill Map:" );
plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0, plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0,
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false, 0 ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
// For some formats (PS, PDF SVG) we plot the drill size list on more than one column // For some formats (PS, PDF SVG) we plot the drill size list on more than one column
// because the list must be contained inside the printed page // because the list must be contained inside the printed page
@ -301,7 +301,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0, plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0,
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false, 0 ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 ); intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );

View File

@ -543,7 +543,7 @@ void D_PAD::PrintShape( wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
tsize = ( tsize * 7 ) / 10; tsize = ( tsize * 7 ) / 10;
GRHaloText( aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, m_name, t_angle, GRHaloText( aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, m_name, t_angle,
wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
tsize / 7, false, false, 0 ); tsize / 7, false, false );
} }
} }
@ -568,7 +568,7 @@ void D_PAD::PrintShape( wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
tsize = ( tsize * 7 ) / 10; tsize = ( tsize * 7 ) / 10;
GRHaloText( aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, shortname, t_angle, GRHaloText( aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, shortname, t_angle,
wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
tsize / 7, false, false, 0 ); tsize / 7, false, false );
} }
} }

View File

@ -1024,7 +1024,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
m_gal->SetIsFill( false ); m_gal->SetIsFill( false );
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
m_gal->SetTextAttributes( aText ); m_gal->SetTextAttributes( aText );
m_gal->StrokeText( shownText, position, aText->GetTextAngleRadians(), 0 ); m_gal->StrokeText( shownText, position, aText->GetTextAngleRadians() );
} }
@ -1056,7 +1056,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
m_gal->SetIsFill( false ); m_gal->SetIsFill( false );
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
m_gal->SetTextAttributes( aText ); m_gal->SetTextAttributes( aText );
m_gal->StrokeText( shownText, position, aText->GetDrawRotationRadians(), 0 ); m_gal->StrokeText( shownText, position, aText->GetDrawRotationRadians() );
// Draw the umbilical line // Draw the umbilical line
if( aText->IsSelected() ) if( aText->IsSelected() )
@ -1186,7 +1186,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
m_gal->SetLineWidth( getLineThickness( text.GetEffectiveTextPenWidth() ) ); m_gal->SetLineWidth( getLineThickness( text.GetEffectiveTextPenWidth() ) );
m_gal->SetTextAttributes( &text ); m_gal->SetTextAttributes( &text );
m_gal->StrokeText( text.GetShownText(), position, text.GetTextAngleRadians(), 0 ); m_gal->StrokeText( text.GetShownText(), position, text.GetTextAngleRadians() );
} }

View File

@ -380,8 +380,7 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, COLOR4D aColor )
m_plotter->Text( pos, aColor, pt_texte->GetShownText(), orient, size, m_plotter->Text( pos, aColor, pt_texte->GetShownText(), orient, size,
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(), thickness, pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(), thickness,
pt_texte->IsItalic(), allow_bold, pt_texte->GetTextMarkupFlags(), pt_texte->IsItalic(), allow_bold, false, &gbr_metadata );
false, &gbr_metadata );
} }
@ -682,14 +681,14 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
wxString& txt = strings_list.Item( ii ); wxString& txt = strings_list.Item( ii );
m_plotter->Text( positions[ii], color, txt, orient, size, pt_texte->GetHorizJustify(), m_plotter->Text( positions[ii], color, txt, orient, size, pt_texte->GetHorizJustify(),
pt_texte->GetVertJustify(), thickness, pt_texte->IsItalic(), pt_texte->GetVertJustify(), thickness, pt_texte->IsItalic(),
allow_bold, pt_texte->GetTextMarkupFlags(), false, &gbr_metadata ); allow_bold, false, &gbr_metadata );
} }
} }
else else
{ {
m_plotter->Text( pos, color, shownText, orient, size, pt_texte->GetHorizJustify(), m_plotter->Text( pos, color, shownText, orient, size, pt_texte->GetHorizJustify(),
pt_texte->GetVertJustify(), thickness, pt_texte->IsItalic(), allow_bold, pt_texte->GetVertJustify(), thickness, pt_texte->IsItalic(), allow_bold,
pt_texte->GetTextMarkupFlags(), false, &gbr_metadata ); false, &gbr_metadata );
} }
} }