Added support for decoupling stored text from shown text in EDA_TEXT

Factored out text ellipsing support to max 15 character (for generating menu items)
This commit is contained in:
Lorenzo Marcantonio 2014-09-13 20:15:45 +02:00
parent 3132690c0b
commit 260ca0e79f
25 changed files with 111 additions and 121 deletions

View File

@ -129,7 +129,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
{
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
plotter->Text( text->GetTextPosition(), text->GetColor(),
text->GetText(), text->GetOrientation(),
text->GetShownText(), text->GetOrientation(),
text->GetSize(),
text->GetHorizJustify(), text->GetVertJustify(),
text->GetPenWidth(),

View File

@ -90,6 +90,21 @@ int EDA_TEXT::LenSize( const wxString& aLine ) const
return GraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold );
}
wxString EDA_TEXT::ShortenedShownText() const
{
wxString tmp = GetShownText();
tmp.Replace( wxT( "\n" ), wxT( " " ) );
tmp.Replace( wxT( "\r" ), wxT( " " ) );
tmp.Replace( wxT( "\t" ), wxT( " " ) );
if( tmp.Length() > 15 )
tmp = tmp.Left( 12 ) + wxT( "..." );
return tmp;
}
/**
* Function GetInterline
* return the distance between 2 text lines
@ -106,13 +121,13 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
EDA_RECT rect;
wxPoint pos;
wxArrayString* list = NULL;
wxString text = m_Text;
wxString text = GetShownText();
int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness;
int linecount = 1;
if( m_MultilineAllowed )
{
list = wxStringSplit( m_Text, '\n' );
list = wxStringSplit( text, '\n' );
if ( list->GetCount() ) // GetCount() == 0 for void strings
{
@ -129,7 +144,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
int dx = LenSize( text );
int dy = GetInterline( aThickness );
/* Creates bounding box (rectangle) for an horizontal text */
// Creates bounding box (rectangle) for an horizontal text
wxSize textsize = wxSize( dx, dy );
if( aInvertY )
@ -257,7 +272,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
if( m_MultilineAllowed )
{
std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( m_Text, '\n' );
wxArrayString* list = wxStringSplit( GetShownText(), '\n' );
positions.reserve( list->Count() );
GetPositionsOfLinesOfMultilineText(positions, list->Count() );
@ -273,7 +288,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
}
else
drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode, m_Text, m_Pos );
aDrawMode, aFillMode, GetShownText(), m_Pos );
// Draw text anchor, if requested
if( aAnchor_color != UNSPECIFIED_COLOR )
@ -330,7 +345,7 @@ void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
wxString& aText, wxPoint aPos )
const wxString& aText, const wxPoint &aPos )
{
int width = m_Thickness;
@ -474,7 +489,7 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
if( IsMultilineAllowed() )
{
wxArrayString* list = wxStringSplit( GetText(), '\n' );
wxArrayString* list = wxStringSplit( GetShownText(), '\n' );
std::vector<wxPoint> positions;
positions.reserve( list->Count() );
GetPositionsOfLinesOfMultilineText( positions, list->Count() );

View File

@ -192,7 +192,7 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const
aGal->SetStrokeColor( COLOR4D( aItem->GetColor() ) );
aGal->SetLineWidth( aItem->GetThickness() );
aGal->SetTextAttributes( aItem );
aGal->StrokeText( aItem->GetText(), VECTOR2D( 0, 0 ), 0.0 );
aGal->StrokeText( aItem->GetShownText(), VECTOR2D( 0, 0 ), 0.0 );
aGal->Restore();
}

View File

@ -452,7 +452,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
// The reference is a special case: we shoud change the basic text
// to add '?' and the part id
LIB_FIELD& field = (LIB_FIELD&) item;
wxString tmp = field.GetText();
wxString tmp = field.GetShownText();
if( field.GetId() == REFERENCE )
{
wxString text = field.GetFullText( aUnit );

View File

@ -110,7 +110,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
if( LibItem )
items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet ),
LibItem->GetField( VALUE )->GetText(), DARKCYAN ) );
LibItem->GetField( VALUE )->GetShownText(), DARKCYAN ) );
SetMsgPanel( items );

View File

@ -152,7 +152,7 @@ void DIALOG_LABEL_EDITOR::InitDialog()
if ( !multiLine )
{
max_len =m_CurrentText->GetText().Length();
max_len = m_CurrentText->GetText().Length();
}
else
{

View File

@ -175,23 +175,25 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
return;
SCH_TEXT* newtext;
const wxPoint &position = text->GetPosition();
const wxString &txt = text->GetText();
switch( type )
{
case SCH_LABEL_T:
newtext = new SCH_LABEL( text->GetPosition(), text->GetText() );
newtext = new SCH_LABEL( position, txt );
break;
case SCH_GLOBAL_LABEL_T:
newtext = new SCH_GLOBALLABEL( text->GetPosition(), text->GetText() );
newtext = new SCH_GLOBALLABEL( position, txt );
break;
case SCH_HIERARCHICAL_LABEL_T:
newtext = new SCH_HIERLABEL( text->GetPosition(), text->GetText() );
newtext = new SCH_HIERLABEL( position, txt );
break;
case SCH_TEXT_T:
newtext = new SCH_TEXT( text->GetPosition(), text->GetText() );
newtext = new SCH_TEXT( position, txt );
break;
default:

View File

@ -173,7 +173,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
case FIND_VALUE: // find value
pos = pSch->GetPosition();
if( aSearchText.CmpNoCase( pSch->GetField( VALUE )->GetText() ) != 0 )
if( aSearchText.CmpNoCase( pSch->GetField( VALUE )->GetShownText() ) != 0 )
break;
notFound = false;

View File

@ -164,7 +164,7 @@ bool LIB_FIELD::Load( LINE_READER& aLineReader, wxString& errorMsg )
// Doctor the *.lib file field which has a "~" in blank fields. New saves will
// not save like this, and eventually these two lines can be removed.
if( m_Text.size()==1 && m_Text[0]==wxChar( '~' ) )
if( m_Text.size() == 1 && m_Text[0] == wxChar( '~' ) )
m_Text.clear();
memset( textVJustify, 0, sizeof( textVJustify ) );
@ -491,7 +491,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
wxPoint textpos = aTransform.TransformCoordinate( BoundaryBox.Centre() )
+ aOffset;
aPlotter->Text( textpos, GetDefaultColor(), m_Text, orient, m_Size,
aPlotter->Text( textpos, GetDefaultColor(), GetShownText(), orient, m_Size,
hjustify, vjustify,
GetPenSize(), m_Italic, m_Bold );
}
@ -500,9 +500,9 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
wxString LIB_FIELD::GetFullText( int unit )
{
if( m_id != REFERENCE )
return m_Text;
return GetText();
wxString text = m_Text;
wxString text = GetText();
text << wxT( "?" );
if( GetParent()->IsMulti() )
@ -642,7 +642,7 @@ void LIB_FIELD::SetName( const wxString& aName )
void LIB_FIELD::SetText( const wxString& aText )
{
if( aText == m_Text )
if( aText == GetText() )
return;
wxString oldName = m_Text;
@ -673,7 +673,7 @@ wxString LIB_FIELD::GetSelectMenuText() const
{
return wxString::Format( _( "Field %s %s" ),
GetChars( GetName() ),
GetChars( GetText() ) );
GetChars( ShortenedShownText() ) );
}
@ -763,5 +763,5 @@ void LIB_FIELD::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Field" ), msg, BROWN ) );
// Display field text:
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), m_Text, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetShownText(), BROWN ) );
}

View File

@ -221,12 +221,12 @@ EDA_ITEM* LIB_TEXT::Clone() const
newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags;
newitem->m_Text = m_Text;
newitem->m_Thickness = m_Thickness;
newitem->m_Thickness = m_Thickness;
newitem->m_Italic = m_Italic;
newitem->m_Bold = m_Bold;
newitem->m_HJustify = m_HJustify;
newitem->m_VJustify = m_VJustify;
return (EDA_ITEM*) newitem;
return newitem;
}
@ -320,7 +320,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
else
color = BLACK;
plotter->Text( pos, color, m_Text,
plotter->Text( pos, color, GetShownText(),
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GetPenSize(), m_Italic, m_Bold );
@ -349,7 +349,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
EDA_COLOR_T color = GetDefaultColor();
EDA_COLOR_T color = GetDefaultColor();
if( aColor < 0 ) // Used normal color or selected color
{
@ -394,7 +394,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
DrawGraphicText( clipbox, aDC, txtpos, (EDA_COLOR_T) color, m_Text, orient, m_Size,
DrawGraphicText( clipbox, aDC, txtpos, color, GetShownText(), orient, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(),
m_Italic, m_Bold );
@ -478,14 +478,8 @@ void LIB_TEXT::SetText( const wxString& aText )
wxString LIB_TEXT::GetSelectMenuText() const
{
wxString tmp = GetText();
tmp.Replace( wxT( "\n" ), wxT( " " ) );
tmp.Replace( wxT( "\r" ), wxT( " " ) );
tmp.Replace( wxT( "\t" ), wxT( " " ) );
tmp =( tmp.Length() > 15 ) ? tmp.Left( 12 ) + wxT( "..." ) : tmp;
wxString msg;
msg.Printf( _( "Graphic Text %s" ), GetChars( tmp ) );
msg.Printf( _( "Graphic Text %s" ), GetChars( ShortenedShownText() ) );
return msg;
}

View File

@ -517,7 +517,7 @@ public:
wxString GetText() const
{
const SCH_TEXT* tmp = (SCH_TEXT*) m_label;
const SCH_TEXT* tmp = static_cast<SCH_TEXT*>( m_label );
return tmp->GetText();
}
};

View File

@ -1496,7 +1496,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" );
aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetText(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) );
// Display component reference in library and library
aList.push_back( MSG_PANEL_ITEM( _( "Component" ), GetPartName(), BROWN ) );
@ -1508,7 +1508,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
// Display the current associated footprint, if exists.
if( !GetField( FOOTPRINT )->IsVoid() )
msg = GetField( FOOTPRINT )->GetText();
msg = GetField( FOOTPRINT )->GetShownText();
else
msg = _( "<Unknown>" );
@ -1683,7 +1683,7 @@ wxString SCH_COMPONENT::GetSelectMenuText() const
wxString tmp;
tmp.Printf( _( "Component %s, %s" ),
GetChars( GetPartName() ),
GetChars( GetField( REFERENCE )->GetText() ) );
GetChars( GetField( REFERENCE )->GetShownText() ) );
return tmp;
}

View File

@ -565,19 +565,8 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
int thickness = GetPenSize();
if( (parent->GetUnitCount() <= 1) || (m_id != REFERENCE) )
{
aPlotter->Text( textpos, color, m_Text, orient, m_Size, hjustify, vjustify,
thickness, m_Italic, m_Bold );
}
else /* We plot the reference, for a multiple parts per package */
{
/* Adding A, B ... to the reference */
wxString Text = m_Text + LIB_PART::SubReference( parent->GetUnit() );
aPlotter->Text( textpos, color, Text, orient, m_Size, hjustify, vjustify,
thickness, m_Italic, m_Bold );
}
aPlotter->Text( textpos, color, GetFullyQualifiedText(), orient, m_Size, hjustify, vjustify,
thickness, m_Italic, m_Bold );
}

View File

@ -368,7 +368,7 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
}
wxLogDebug( wxT( "Fix me: attempt to remove label %s which is not in sheet %s." ),
GetChars( aSheetPin->GetText() ), GetChars( m_name ) );
GetChars( aSheetPin->GetShownText() ), GetChars( m_name ) );
}
@ -401,14 +401,14 @@ bool SCH_SHEET::HasUndefinedPins()
{
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
SCH_HIERLABEL* HLabel = NULL;
const SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
continue;
HLabel = (SCH_HIERLABEL*) DrawStruct;
HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
if( pin.GetText().CmpNoCase( HLabel->GetText() ) == 0 )
break; // Found!
@ -485,14 +485,14 @@ void SCH_SHEET::CleanupSheet()
{
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
SCH_HIERLABEL* HLabel = NULL;
const SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
continue;
HLabel = (SCH_HIERLABEL*) DrawStruct;
HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
if( i->GetText().CmpNoCase( HLabel->GetText() ) == 0 )
break; // Found!

View File

@ -479,7 +479,7 @@ void SCH_SHEET_PIN::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
wxString SCH_SHEET_PIN::GetSelectMenuText() const
{
wxString tmp;
tmp.Printf( _( "Hierarchical Sheet Pin %s" ), GetChars( GetText() ) );
tmp.Printf( _( "Hierarchical Sheet Pin %s" ), GetChars( ShortenedShownText() ) );
return tmp;
}

View File

@ -601,14 +601,8 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const
wxString SCH_TEXT::GetSelectMenuText() const
{
wxString tmp = GetText();
tmp.Replace( wxT( "\n" ), wxT( " " ) );
tmp.Replace( wxT( "\r" ), wxT( " " ) );
tmp.Replace( wxT( "\t" ), wxT( " " ) );
tmp =( tmp.Length() > 15 ) ? tmp.Left( 12 ) + wxT( "..." ) : tmp;
wxString msg;
msg.Printf( _( "Graphic Text %s" ), GetChars( tmp ) );
msg.Printf( _( "Graphic Text %s" ), GetChars( ShortenedShownText() ) );
return msg;
}
@ -674,7 +668,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
if( m_MultilineAllowed )
{
std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( m_Text, '\n' );
wxArrayString* list = wxStringSplit( GetShownText(), '\n' );
positions.reserve( list->Count() );
GetPositionsOfLinesOfMultilineText(positions, list->Count() );
@ -690,7 +684,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
}
else
{
aPlotter->Text( textpos, color, m_Text, m_Orient, m_Size, m_HJustify,
aPlotter->Text( textpos, color, GetShownText(), m_Orient, m_Size, m_HJustify,
m_VJustify, thickness, m_Italic, m_Bold );
}
@ -737,7 +731,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
return;
}
aList.push_back( MSG_PANEL_ITEM( msg, GetText(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( msg, GetShownText(), DARKCYAN ) );
switch( GetOrientation() )
{
@ -973,7 +967,7 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const
x = m_Pos.x;
y = m_Pos.y;
int width = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
length = LenSize( m_Text );
length = LenSize( GetShownText() );
height = m_Size.y + width;
dx = dy = 0;
@ -1016,10 +1010,8 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const
wxString SCH_LABEL::GetSelectMenuText() const
{
wxString tmp = ( GetText().Length() > 15 ) ? GetText().Left( 12 ) + wxT( "..." ) : GetText();
wxString msg;
msg.Printf( _( "Label %s" ), GetChars(tmp) );
msg.Printf( _( "Label %s" ), GetChars( ShortenedShownText() ) );
return msg;
}
@ -1312,7 +1304,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
aPoints.clear();
int symb_len = LenSize( m_Text ) + ( TXTMARGE * 2 );
int symb_len = LenSize( GetShownText() ) + ( TXTMARGE * 2 );
// Create outline shape : 6 points
int x = symb_len + linewidth + 3;
@ -1406,7 +1398,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE;
// text X size add height for triangular shapes(bidirectional)
length = LenSize( m_Text ) + height + DANGLING_SYMBOL_SIZE;
length = LenSize( GetShownText() ) + height + DANGLING_SYMBOL_SIZE;
switch( m_schematicOrientation ) // respect orientation
{
@ -1447,10 +1439,8 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
wxString SCH_GLOBALLABEL::GetSelectMenuText() const
{
wxString tmp = ( GetText().Length() > 15 ) ? GetText().Left( 12 ) + wxT( "..." ) : GetText();
wxString msg;
msg.Printf( _( "Global Label %s" ), GetChars(tmp) );
msg.Printf( _( "Global Label %s" ), GetChars( ShortenedShownText() ) );
return msg;
}
@ -1670,7 +1660,7 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
int width = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
height = m_Size.y + width + 2 * TXTMARGE;
length = LenSize( m_Text )
length = LenSize( GetShownText() )
+ height // add height for triangular shapes
+ 2 * DANGLING_SYMBOL_SIZE;
@ -1794,9 +1784,7 @@ void SCH_HIERLABEL::Rotate( wxPoint aPosition )
wxString SCH_HIERLABEL::GetSelectMenuText() const
{
wxString tmp = ( GetText().Length() > 15 ) ? GetText().Left( 12 ) + wxT( "..." ) : GetText();
wxString msg;
msg.Printf( _( "Hierarchical Label %s" ), GetChars( tmp ) );
msg.Printf( _( "Hierarchical Label %s" ), GetChars( ShortenedShownText() ) );
return msg;
}

View File

@ -80,7 +80,7 @@ enum EDA_DRAW_MODE_T {
class EDA_TEXT
{
protected:
wxString m_Text;
wxString m_Text; ///< The 'base' text, maybe later processed for display
int m_Thickness; ///< pen size used to draw this text
double m_Orient; ///< Orient in 0.1 degrees
wxPoint m_Pos; ///< XY position of anchor text.
@ -104,14 +104,19 @@ public:
/**
* Function GetText
* returns the string associated with the text object.
* <p>
* This function is virtual to allow derived classes to override getting the
* string to provide a way for modifying the base string by adding a suffix or
* prefix to the base string.
* </p>
* @return a const wxString object containing the string of the item.
*
* @return a const wxString reference containing the string of the item.
*/
virtual const wxString& GetText() const { return m_Text; }
const wxString& GetText() const { return m_Text; }
/**
* Returns the string actually shown after processing of the base
* text. Default is no processing */
virtual wxString GetShownText() const { return m_Text; }
/**
* Returns a shortened version (max 15 characters) of the shown text */
wxString ShortenedShownText() const;
virtual void SetText( const wxString& aText ) { m_Text = aText; }
@ -320,7 +325,7 @@ private:
void drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
wxString& aText, wxPoint aPos );
const wxString& aText, const wxPoint &aPos );
};

View File

@ -250,7 +250,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
NEGATE( size.x );
DrawGraphicText( NULL, NULL, textmod->GetTextPosition(), BLACK,
textmod->GetText(), textmod->GetDrawRotation(), size,
textmod->GetShownText(), textmod->GetDrawRotation(), size,
textmod->GetHorizJustify(), textmod->GetVertJustify(),
textmod->GetThickness(), textmod->IsItalic(),
true, addTextSegmToPoly );
@ -379,7 +379,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
if( IsMultilineAllowed() )
{
wxArrayString* list = wxStringSplit( GetText(), '\n' );
wxArrayString* list = wxStringSplit( GetShownText(), '\n' );
std::vector<wxPoint> positions;
positions.reserve( list->Count() );
GetPositionsOfLinesOfMultilineText( positions, list->Count() );
@ -399,7 +399,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
else
{
DrawGraphicText( NULL, NULL, GetTextPosition(), color,
GetText(), GetOrientation(), size,
GetShownText(), GetOrientation(), size,
GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(),
true, addTextSegmToPoly );

View File

@ -538,7 +538,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
char bufcar[512], Line[512];
wxString msg;
aList.push_back( MSG_PANEL_ITEM( m_Reference->GetText(), m_Value->GetText(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
// Display last date the component was edited (useful in Module Editor).
time_t edit_time = m_LastEditTime;

View File

@ -131,9 +131,9 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
#endif
if( m_Parent && m_Parent->Type() == PCB_DIMENSION_T )
aList.push_back( MSG_PANEL_ITEM( _( "Dimension" ), m_Text, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Dimension" ), GetShownText(), DARKGREEN ) );
else
aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), m_Text, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), GetShownText(), DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BLUE ) );
@ -184,15 +184,10 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre )
wxString TEXTE_PCB::GetSelectMenuText() const
{
wxString text, shorttxt;
if( m_Text.Len() < 12 )
shorttxt << m_Text;
else
shorttxt += m_Text.Left( 10 ) + wxT( "..." );
wxString text;
text.Printf( _( "Pcb Text \"%s\" on %s"),
GetChars ( shorttxt ), GetChars( GetLayerName() ) );
GetChars ( ShortenedShownText() ), GetChars( GetLayerName() ) );
return text;
}

View File

@ -319,7 +319,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
size.x = -size.x;
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
DrawGraphicText( clipbox, DC, pos, color, m_Text, orient,
DrawGraphicText( clipbox, DC, pos, color, GetShownText(), orient,
size, m_HJustify, m_VJustify, width, m_Italic, m_Bold );
// Enable these line to draw the bounding box (debug tests purposes only)
@ -387,7 +387,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
Line = module->GetReference();
aList.push_back( MSG_PANEL_ITEM( _( "Module" ), Line, DARKCYAN ) );
Line = m_Text;
Line = GetShownText();
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) );
wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
@ -436,11 +436,11 @@ wxString TEXTE_MODULE::GetSelectMenuText() const
break;
case TEXT_is_VALUE:
text.Printf( _( "Value %s of %s" ), GetChars( m_Text ), reference );
text.Printf( _( "Value %s of %s" ), GetChars( GetShownText() ), reference );
break;
default: // wrap this one in quotes:
text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( m_Text ),
text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( ShortenedShownText() ),
GetChars( GetLayerName() ), reference );
break;
}

View File

@ -124,7 +124,6 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
m_valueCopy->Copy( &m_currentModule->Value() );
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
m_FootprintNameCtrl->SetValue( m_currentModule->GetFPID().Format() );
m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD components" ) );

View File

@ -640,7 +640,7 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
if( text->IsMultilineAllowed() )
{
wxArrayString* list = wxStringSplit( text->GetText(), '\n' );
wxArrayString* list = wxStringSplit( text->GetShownText(), '\n' );
std::vector<wxPoint> positions;
positions.reserve( list->Count() );
text->GetPositionsOfLinesOfMultilineText( positions, list->Count() );
@ -661,7 +661,7 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
else
{
DrawGraphicText( NULL, NULL, text->GetTextPosition(), color,
text->GetText(), text->GetOrientation(), size,
text->GetShownText(), text->GetOrientation(), size,
text->GetHorizJustify(), text->GetVertJustify(),
text->GetThickness(), text->IsItalic(),
true,
@ -941,7 +941,7 @@ static void export_vrml_text_module( TEXTE_MODULE* module )
model_vrml->s_text_width = module->GetThickness();
DrawGraphicText( NULL, NULL, module->GetTextPosition(), BLACK,
module->GetText(), module->GetDrawRotation(), size,
module->GetShownText(), module->GetDrawRotation(), size,
module->GetHorizJustify(), module->GetVertJustify(),
module->GetThickness(), module->IsItalic(),
true,

View File

@ -767,7 +767,8 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
{
if( aText->GetText().Length() == 0 )
wxString shownText( aText->GetShownText() );
if( shownText.Length() == 0 )
return;
const COLOR4D& color = m_pcbSettings.GetColor( aText, aText->GetLayer() );
@ -789,13 +790,14 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color );
m_gal->SetTextAttributes( aText );
m_gal->StrokeText( aText->GetText(), position, orientation );
m_gal->StrokeText( shownText, position, orientation );
}
void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
{
if( aText->GetLength() == 0 )
wxString shownText( aText->GetShownText() );
if( shownText.Length() == 0 )
return;
const COLOR4D& color = m_pcbSettings.GetColor( aText, aLayer );
@ -817,7 +819,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color );
m_gal->SetTextAttributes( aText );
m_gal->StrokeText( aText->GetText(), position, orientation );
m_gal->StrokeText( shownText, position, orientation );
}
@ -941,7 +943,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
m_gal->SetLineWidth( text.GetThickness() );
m_gal->SetTextAttributes( &text );
m_gal->StrokeText( text.GetText(), position, orientation );
m_gal->StrokeText( text.GetShownText(), position, orientation );
}

View File

@ -235,7 +235,7 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, EDA_COLOR_T aColo
bool allow_bold = pt_texte->IsBold() || thickness;
m_plotter->Text( pos, aColor,
pt_texte->GetText(),
pt_texte->GetShownText(),
orient, size,
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
thickness, pt_texte->IsItalic(), allow_bold );
@ -442,8 +442,9 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
int thickness;
wxPoint pos;
wxSize size;
wxString shownText( pt_texte->GetShownText() );
if( pt_texte->GetText().IsEmpty() )
if( shownText.IsEmpty() )
return;
if( !m_layerMask[pt_texte->GetLayer()] )
@ -468,7 +469,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
if( pt_texte->IsMultilineAllowed() )
{
std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( pt_texte->GetText(), '\n' );
wxArrayString* list = wxStringSplit( shownText, '\n' );
positions.reserve( list->Count() );
pt_texte->GetPositionsOfLinesOfMultilineText( positions, list->Count() );
@ -485,7 +486,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
}
else
{
m_plotter->Text( pos, UNSPECIFIED_COLOR, pt_texte->GetText(), orient, size,
m_plotter->Text( pos, UNSPECIFIED_COLOR, shownText, orient, size,
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
thickness, pt_texte->IsItalic(), allow_bold );
}