Commit cd6fbbef authored by charras's avatar charras

All: cleaning code to draw/plot texts (work in progress). Eeschema: italic and...

All: cleaning code to draw/plot texts (work in progress). Eeschema: italic and bold texts and labels allowed
(plot functions not yet updated for bold texts)
parent 42116eff
......@@ -5,6 +5,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++All
Cleaning code to draw/plot texts (work in progress):
Now only one function is used to draw and plot texts
(easier to maintain and ensure textes have the same size in ploting and drawing)
In eeschema, italic and bold texts allowed (in pcbenew, texts thicness is already adjustable)
2008-Dec-18 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
......
......@@ -192,7 +192,7 @@ int EDA_TextStruct::Len_Size()
if( nbchar == 0 )
return 0;
len = ( (10 * m_Size.x ) / 9 ) * nbchar;
len = (( (10 * m_Size.x ) / 9 ) + m_Width) * nbchar;
return len;
}
......@@ -210,7 +210,7 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref )
int dx, dy;
int spot_cX, spot_cY;
dx = ( Pitch() * GetLength() ) / 2;
dx = (int) (( Pitch() * GetLength() ) / 2);
dy = m_Size.y / 2;
/* Is the ref point inside the text area ? */
......@@ -243,13 +243,15 @@ bool EDA_TextStruct::HitTest( EDA_Rect& refArea )
/*******************************/
int EDA_TextStruct::Pitch()
int EDA_TextStruct::Pitch(int aMinTickness)
/*******************************/
/* retourne le pas entre 2 caracteres
/**
* Function Pitch
* @return distance between 2 characters
* @param aMinTickness = min segments tickness
*/
{
return ( (10 * m_Size.x ) / 9 ) + m_Width;
return ((m_Size.x * 10)/9) + MAX( m_Width, aMinTickness);
}
......
......@@ -100,6 +100,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
wxSize text_size;
void (*FctPlume)( wxPoint pos, int state );
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool italic = false;
bool thickness = 0; //@todo : use current pen
switch( format_plot )
{
......@@ -176,7 +178,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
if(WsItem->m_Legende) msg = WsItem->m_Legende;
PlotGraphicText(format_plot, pos, color,
msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic );
break;
case WS_SEGMENT_LU:
......@@ -221,7 +224,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
pos.y = (ref.y + GRID_REF_W / 2) * conv_unit;
PlotGraphicText( format_plot, pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
if( ii < xg - PAS_REF / 2 )
{
......@@ -234,7 +238,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
pos.y = (yg - GRID_REF_W / 2) * conv_unit;
PlotGraphicText( format_plot, pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
}
/* Trace des reperes selon l'axe Y */
......@@ -254,7 +259,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
pos.y = (ii - gypas / 2) * conv_unit;
PlotGraphicText( format_plot, pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
if( ii < yg - PAS_REF / 2 )
{
......@@ -266,7 +272,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
pos.x = (xg - GRID_REF_W / 2) * conv_unit;
pos.y = (ii - gypas / 2) * conv_unit;
PlotGraphicText( format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
}
#endif
......@@ -294,7 +301,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
case WS_PODPIS:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
break;
case WS_SIZESHEET:
break;
......@@ -302,13 +310,15 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
break;
case WS_SHEETS:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen;
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
break;
case WS_COMPANY_NAME:
break;
......@@ -345,13 +355,15 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
case WS_PODPIS_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
break;
case WS_IDENTSHEET_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
break;
case WS_LEFT_SEGMENT_D:
case WS_SEGMENT_D:
......@@ -470,7 +482,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
{
PlotGraphicText( format_plot, pos, color,
msg.GetData(), TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
}
}
#endif
......
......@@ -52,7 +52,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
int ii, kk, char_count, AsciiCode, endcar;
int x0, y0;
int zoom;
int size_h, size_v, espacement;
int size_h, size_v, pitch;
SH_CODE f_cod, plume = 'U';
const SH_CODE* ptcar;
int ptr;
......@@ -83,11 +83,11 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
if( char_count == 0 )
return;
espacement = (10 * size_h ) / 9; // this is the pitch between chars
if ( espacement > 0 )
espacement += ABS(aWidth);
pitch = (10 * size_h ) / 9; // this is the pitch between chars
if ( pitch > 0 )
pitch += ABS(aWidth);
else
espacement -= ABS(aWidth);
pitch -= ABS(aWidth);
ox = cX = aPos.x;
oy = cY = aPos.y;
......@@ -96,7 +96,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
if( aPanel )
{
int xm, ym, ll, xc, yc;
int textsize = ABS( espacement );
int textsize = ABS( pitch );
ll = (textsize * char_count) / zoom;
xc = GRMapX( cX );
......@@ -119,7 +119,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
/* Compute the position ux0, uy0 of the first letter , next */
dx = (espacement * char_count) / 2;
dx = (pitch * char_count) / 2;
dy = size_v / 2; /* dx, dy = draw offset between first letter and text center */
ux0 = uy0 = 0; /* Decalage du centre du texte / coord de ref */
......@@ -196,7 +196,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
if( ABS( (aSize.x / zoom) ) < 3 ) /* chars trop petits pour etre dessines */
{ /* le texte est symbolise par une barre */
dx = (espacement * char_count) / 2;
dx = (pitch * char_count) / 2;
dy = size_v / 2; /* Decalage du debut du texte / centre */
ux0 = cX - dx;
......@@ -303,18 +303,54 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
/* end draw 1 char */
ptr++; ox += espacement;
ptr++; ox += pitch;
}
}
/* functions used to plot texts, using DrawGraphicText() with a call back function */
static void (*MovePenFct)( wxPoint pos, int state ); // a pointer to actual plot function (HPGL, PS, ..)
static bool s_Plotbegin; // Flag to init plot
/* The call back function */
static void s_Callback_plot(int x0, int y0, int xf, int yf)
{
static wxPoint PenLastPos;
wxPoint pstart;
pstart.x = x0;
pstart.y = y0;
wxPoint pend;
pend.x = xf;
pend.y = yf;
if ( s_Plotbegin ) // First segment to plot
{
MovePenFct( pstart, 'U' );
MovePenFct( pend, 'D' );
s_Plotbegin = false;
}
else
{
if ( PenLastPos == pstart ) // this is a next segment in a polyline
{
MovePenFct( pend, 'D' );
}
else // New segment to plot
{
MovePenFct( pstart, 'U' );
MovePenFct( pend, 'D' );
}
}
PenLastPos = pend;
}
/******************************************************************************************/
void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor,
const wxString& aText,
int aOrient, const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
bool aItalic )
int aWidth, bool aItalic )
/******************************************************************************************/
/** Function PlotGraphicText
......@@ -327,27 +363,21 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
* @param aH_justify = horizontal justification (Left, center, right)
* @param aV_justify = vertical justification (bottom, center, top)
* @param aWidth = line width (pen width) (default = 0)
* if width < 0 : draw segments in sketch mode, width = abs(width)
* @param aItalic = true to simulate an italic font
*/
{
int kk, char_count, end, AsciiCode;
int k1, k2, x0, y0, ox, oy;
int size_h, size_v, espacement;
SH_CODE f_cod, plume = 'U';
const SH_CODE* ptcar;
int ptr;
int ux0, uy0, dx, dy; // Coord de trace des segments de texte & variables de calcul */
int cX, cY; // Centre du texte
void (*FctPlume)( wxPoint pos, int state );
// Initialise the actual function used to plot lines:
switch( aFormat_plot )
{
case PLOT_FORMAT_POST:
FctPlume = LineTo_PS;
MovePenFct = LineTo_PS;
break;
case PLOT_FORMAT_HPGL:
FctPlume = Move_Plume_HPGL;
MovePenFct = Move_Plume_HPGL;
break;
case PLOT_FORMAT_GERBER:
......@@ -358,158 +388,13 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
if( aColor >= 0 && IsPostScript( aFormat_plot ) )
SetColorMapPS( aColor );
size_h = aSize.x;
size_v = aSize.y;
if( size_h == 0 )
size_h = DEFAULT_SIZE_TEXT;
if( size_v == 0 )
size_v = DEFAULT_SIZE_TEXT;
kk = 0;
ptr = 0; /* ptr = text index */
/* calcul de la position du debut des textes: ox et oy */
char_count = aText.Len();
espacement = (10 * size_h ) / 9;
ox = cX = aPos.x;
oy = cY = aPos.y;
/* Calcul du cadrage du texte */
dx = (espacement * char_count) / 2;
dy = size_v / 2; /* Decalage du debut du texte / centre */
ux0 = uy0 = 0; /* Decalage du centre du texte / ccord de ref */
if( (aOrient == 0) || (aOrient == 1800) ) /* Texte Horizontal */
{
switch( aH_justify )
{
case GR_TEXT_HJUSTIFY_CENTER:
break;
case GR_TEXT_HJUSTIFY_RIGHT:
ux0 = -dx;
break;
case GR_TEXT_HJUSTIFY_LEFT:
ux0 = dx;
break;
}
switch( aV_justify )
{
case GR_TEXT_VJUSTIFY_CENTER:
break;
case GR_TEXT_VJUSTIFY_TOP:
uy0 = dy;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
uy0 = -dy;
break;
}
}
else /* Texte Vertical */
{
switch( aH_justify )
{
case GR_TEXT_HJUSTIFY_CENTER:
break;
case GR_TEXT_HJUSTIFY_RIGHT:
ux0 = -dy;
break;
case GR_TEXT_HJUSTIFY_LEFT:
ux0 = dy;
break;
}
switch( aV_justify )
{
case GR_TEXT_VJUSTIFY_CENTER:
break;
case GR_TEXT_VJUSTIFY_TOP:
uy0 = dx;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
uy0 = -dx;
break;
}
}
cX += ux0;
cY += uy0; /* cX, cY = coord du centre du texte */
ox = -dx;
oy = +dy; /* ox, oy = coord debut texte, relativement au centre */
FctPlume( wxPoint( 0, 0 ), 'Z' );
while( kk++ < char_count )
{
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
AsciiCode = aText.GetChar(ptr) & 0x7FF;
if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr
AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF;
else
AsciiCode = AsciiCode & 0xFF;
#else
AsciiCode = aText.GetChar( ptr ) & 0xFF;
#endif
ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description
* du caractere a dessiner */
for( end = 0; end == 0; ptcar++ )
{
f_cod = *ptcar;
/* get code n de la forme selectionnee */
switch( f_cod )
{
case 'X':
end = 1; /* fin du caractere */
case 'U':
case 'D':
plume = f_cod; break;
default:
k1 = f_cod; /* trace sur axe V */
k1 = -(k1 * size_v) / 9;
ptcar++;
f_cod = *ptcar;
k2 = f_cod; /* trace sur axe H */
k2 = (k2 * size_h) / 9;
// To simulate an italic font, add a x offset depending on the y offset
if ( aItalic )
k2 -= k1/8;
dx = k2 + ox;
dy = k1 + oy;
RotatePoint( &dx, &dy, aOrient );
FctPlume( wxPoint( cX + dx, cY + dy ), plume );
x0 = k2;
y0 = k1;
break;
}
/* end switch */
}
/* end boucle for = end trace de 1 caractere */
FctPlume( wxPoint( 0, 0 ), 'Z' );
ptr++; ox += espacement;
}
s_Plotbegin = true;
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
aOrient, aSize,
aH_justify, aV_justify,
aWidth, aItalic,
s_Callback_plot);
/* end trace du texte */
FctPlume( wxPoint( 0, 0 ), 'Z' );
/* end text : pen UP ,no move */
MovePenFct( wxPoint( 0, 0 ), 'Z' );
}
......@@ -38,7 +38,8 @@ set(EESCHEMA_SRCS
# dialog_edit_component_in_lib.cpp
dialog_edit_component_in_schematic_fbp.cpp
dialog_edit_component_in_schematic.cpp
# dialog_edit_label.cpp
dialog_edit_label.cpp
dialog_edit_label_base.cpp
dialog_eeschema_config.cpp
dialog_erc.cpp
# dialog_find.cpp
......@@ -82,6 +83,7 @@ set(EESCHEMA_SRCS
plothpgl.cpp
plotps.cpp
priorque.cpp
read_from_file_schematic_items_descriptions.cpp
savelib.cpp
save_schemas.cpp
schedit.cpp
......
......@@ -281,7 +281,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
}
const wxChar* textsrc = m_PinName.GetData();
float fPinTextPitch = PinNameSize.x * 1.1;
float fPinTextPitch = (PinNameSize.x * 1.1) + LineWidth;
/* Do we need to invert the string? Is this string has only "~"? */
PinTextBarCount = 0; PinTxtLen = 0;
ii = 0;
......@@ -555,7 +555,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
int orient,
int TextInside,
bool DrawPinNum,
bool DrawPinName )
bool DrawPinName,
int aWidth, bool aItalic )
{
int dx, len, start;
int ii, x, y, x1, y1, cte;
......@@ -594,7 +595,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
}
const wxChar* textsrc = m_PinName.GetData();
float fPinTextPitch = PinNameSize.x * 1.1;
float fPinTextPitch = (PinNameSize.x * 1.1) + aWidth;
/* Do we need to invert the string? Is this string has only "~"? */
PinTextBarCount = 0; PinTxtLen = 0;
ii = 0;
......@@ -635,7 +636,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic );
for( ii = 0; ii < PinTextBarCount; )
{
......@@ -654,7 +656,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
NameColor, PinText, TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic );
for( ii = 0; ii < PinTextBarCount; )
{
......@@ -675,7 +678,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_VJUSTIFY_BOTTOM,
aWidth, aItalic );
}
}
else /* Its a vertical line. */
......@@ -691,7 +695,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP );
GR_TEXT_VJUSTIFY_TOP,
aWidth, aItalic);
for( ii = 0; ii < PinTextBarCount; )
{
......@@ -711,7 +716,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_VJUSTIFY_BOTTOM,
aWidth, aItalic);
for( ii = 0; ii < PinTextBarCount; )
{
......@@ -732,7 +738,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic);
}
}
}
......@@ -749,7 +756,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_VJUSTIFY_BOTTOM,
aWidth, aItalic);
for( ii = 0; ii < PinTextBarCount; )
{
......@@ -767,7 +775,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
aWidth, aItalic);
}
}
else /* Its a vertical line. */
......@@ -780,7 +789,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic);
for( ii = 0; ii < PinTextBarCount; )
{
......@@ -801,7 +811,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic);
}
}
}
......
......@@ -139,7 +139,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
wxPoint( m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y ),
color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_BOTTOM, width );
GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
break;
case 1: /* Vert Orientation UP */
......@@ -148,7 +148,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
m_Pos.y + offset.y ),
color, m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_BOTTOM, width );
GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
break;
case 2: /* Horiz Orientation - Right justified */
......@@ -157,7 +157,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
TXTMARGE + offset.y ),
color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_BOTTOM, width );
GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
break;
case 3: /* Vert Orientation BOTTOM */
......@@ -166,7 +166,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
m_Pos.y + offset.y ),
color, m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_TOP, width );
GR_TEXT_VJUSTIFY_TOP, width, m_Italic );
break;
}
......@@ -184,9 +184,13 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
bool SCH_TEXT::Save( FILE* aFile ) const
{
bool success = true;
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d ~\n%s\n",
const char * shape = "~";
if (m_Italic )
shape = "Italic";
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n",
m_Pos.x, m_Pos.y,
m_Orient, m_Size.x,
shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF )
{
success = false;
......@@ -234,10 +238,13 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
bool SCH_LABEL::Save( FILE* aFile ) const
{
bool success = true;
char shape = '~';
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %c\n%s\n",
const char * shape = "~";
if (m_Italic )
shape = "Italic";
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n",
m_Pos.x, m_Pos.y,
m_Orient, m_Size.x, shape,
m_Orient, m_Size.x, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF )
{
success = false;
......@@ -267,10 +274,14 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
{
bool success = true;
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s\n%s\n",
const char * shape = "~";
if (m_Italic )
shape = "Italic";
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y,
m_Orient, m_Size.x,
SheetLabelType[m_Shape],
shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF )
{
success = false;
......@@ -300,10 +311,14 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) :
bool SCH_HIERLABEL::Save( FILE* aFile ) const
{
bool success = true;
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s\n%s\n",
const char * shape = "~";
if (m_Italic )
shape = "Italic";
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y,
m_Orient, m_Size.x,
SheetLabelType[m_Shape],
shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF )
{
success = false;
......@@ -352,28 +367,28 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x - ii, AnchorPos.y ), color,
m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
break;
case 1: /* Orientation vert UP */
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x, AnchorPos.y + ii ), color,
m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width, m_Italic );
break;
case 2: /* Orientation horiz inverse */
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x + ii, AnchorPos.y ), color,
m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
break;
case 3: /* Orientation vert BOTTOM */
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x, AnchorPos.y - ii ), color,
m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
break;
}
......@@ -417,8 +432,9 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
y = m_Pos.y;
dx = dy = 0;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
height = m_Size.y + 2*TXTMARGE;
length = ( Pitch() * GetLength() ) + height + 2*DANGLING_SYMBOL_SIZE; // add height for triangular shapes
length = ( Pitch(width) * GetLength() ) + height + 2*DANGLING_SYMBOL_SIZE; // add height for triangular shapes
switch( m_Orient ) // respect orientation
{
......@@ -504,28 +520,28 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x - offset, AnchorPos.y ), color,
m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
break;
case 1: /* Orientation vert UP */
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x, AnchorPos.y + offset ), color,
m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width, m_Italic );
break;
case 2: /* Orientation horiz inverse */
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x + offset, AnchorPos.y ), color,
m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
break;
case 3: /* Orientation vert BOTTOM */
DrawGraphicText( panel, DC,
wxPoint( AnchorPos.x, AnchorPos.y - offset ), color,
m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
break;
}
......@@ -629,8 +645,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
y = m_Pos.y;
dx = dy = 0;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
height = m_Size.y + 2*TXTMARGE;
length = ( Pitch() * GetLength() ) + 2* height + 2*DANGLING_SYMBOL_SIZE; // add 2*height for triangular shapes (bidirectional)
length = ( Pitch(width) * GetLength() ) + 2* height + 2*DANGLING_SYMBOL_SIZE; // add 2*height for triangular shapes (bidirectional)
switch( m_Orient ) // respect orientation
{
......@@ -675,7 +692,8 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
x = m_Pos.x;
y = m_Pos.y;
length = ( Pitch() * GetLength() );
int width = MAX( m_Width, g_DrawMinimunLineWidth );
length = ( Pitch(width) * GetLength() );
height = m_Size.y;
dx = dy = 0;
......@@ -714,3 +732,4 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
box.Normalize();
return box;
}
......@@ -232,7 +232,7 @@ public:
int TextInside, bool DrawPinNum, bool DrawPinName,
int Color, int DrawMode );
void PlotPinTexts( wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, bool DrawPinName );
int TextInside, bool DrawPinNum, bool DrawPinNameint, int aWidth, bool aItalic );
};
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_label.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 19/02/2006 15:46:26
// RCS-ID:
// Copyright: License GNU
// Licence:
// Created: 18/12/2008 15:46:26
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 19/02/2006 15:46:26
/* This is the dialog box for labels, glob. labels and graphic texts edition */
////@begin includes
////@end includes
#include "fctsys.h"
#include "wx/valgen.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "dialog_edit_label.h"
////@begin XPM images
////@end XPM images
/*!
* WinEDA_LabelPropertiesFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_LabelPropertiesFrame, wxDialog )
/*!
* WinEDA_LabelPropertiesFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_LabelPropertiesFrame, wxDialog )
////@begin WinEDA_LabelPropertiesFrame event table entries
EVT_BUTTON( wxID_OK, WinEDA_LabelPropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_LabelPropertiesFrame::OnCancelClick )
////@end WinEDA_LabelPropertiesFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_LabelPropertiesFrame constructors
*/
WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( )
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText)
: DialogLabelEditor_Base ( parent )
{
m_Parent = parent;
m_CurrentText= CurrentText;
}
WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent,
SCH_TEXT * CurrentText,
const wxPoint& pos,
wxWindowID id, const wxString& caption, const wxSize& size, long style )
void DialogLabelEditor::OnInitDialog( wxInitDialogEvent& event )
{
wxString msg;
m_Parent = parent;
m_CurrentText = CurrentText;
Create(parent, id, caption, pos, size, style);
m_TextLabel->SetValue(m_CurrentText->m_Text);
m_TextLabel->SetFocus();
// Set validators
m_TextOrient->SetSelection( m_CurrentText->m_Orient );
m_TextShape->SetSelection( m_CurrentText->m_Shape );
switch( m_CurrentText->Type() )
{
case TYPE_SCH_GLOBALLABEL:
......@@ -81,163 +52,37 @@ wxString msg;
break;
}
int style = 0;
if ( m_CurrentText->m_Italic )
style = 1;
if ( m_CurrentText->m_Width > 1 )
style += 2;
m_TextStyle->SetSelection(style);
msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol();
m_SizeTitle->SetLabel(msg);
msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits);
m_TextSize->SetValue(msg);
}
/*!
* WinEDA_LabelPropertiesFrame creator
*/
SetFocus();
if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL &&
m_CurrentText->Type() != TYPE_SCH_HIERLABEL)
m_TextShape->Show(false);
bool WinEDA_LabelPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin WinEDA_LabelPropertiesFrame member initialisation
m_TextLabel = NULL;
m_TextOrient = NULL;
m_TextShape = NULL;
m_SizeTitle = NULL;
m_TextSize = NULL;
m_btClose = NULL;
////@end WinEDA_LabelPropertiesFrame member initialisation
////@begin WinEDA_LabelPropertiesFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end WinEDA_LabelPropertiesFrame creation
return true;
}
/*!
* Control creation for WinEDA_LabelPropertiesFrame
*/
void WinEDA_LabelPropertiesFrame::CreateControls()
{
SetFont(*g_DialogFont);
////@begin WinEDA_LabelPropertiesFrame content construction
// Generated by DialogBlocks, 29/04/2008 21:03:43 (unregistered)
WinEDA_LabelPropertiesFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Text "), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_TextLabel = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(250, -1), 0 );
itemBoxSizer3->Add(m_TextLabel, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer3->Add(itemBoxSizer6, 0, wxGROW|wxALL, 5);
wxArrayString m_TextOrientStrings;
m_TextOrientStrings.Add(_("Right"));
m_TextOrientStrings.Add(_("Up"));
m_TextOrientStrings.Add(_("Left"));
m_TextOrientStrings.Add(_("Down"));
m_TextOrient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Text Orient:"), wxDefaultPosition, wxDefaultSize, m_TextOrientStrings, 1, wxRA_SPECIFY_COLS );
m_TextOrient->SetSelection(0);
itemBoxSizer6->Add(m_TextOrient, 0, wxALIGN_TOP|wxALL, 5);
itemBoxSizer6->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxArrayString m_TextShapeStrings;
m_TextShapeStrings.Add(_("Input"));
m_TextShapeStrings.Add(_("Output"));
m_TextShapeStrings.Add(_("Bidi"));
m_TextShapeStrings.Add(_("TriState"));
m_TextShapeStrings.Add(_("Passive"));
m_TextShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Glabel Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeStrings, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection(0);
m_TextShape->Show(false);
itemBoxSizer6->Add(m_TextShape, 0, wxALIGN_TOP|wxALL, 5);
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer10, 0, wxGROW|wxALL, 5);
m_SizeTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Size "), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(m_SizeTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_TextSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(m_TextSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
itemBoxSizer10->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxButton* itemButton14 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton14->SetDefault();
itemButton14->SetForegroundColour(wxColour(204, 0, 0));
itemBoxSizer10->Add(itemButton14, 0, wxGROW|wxALL, 5);
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_btClose->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer10->Add(m_btClose, 0, wxGROW|wxALL, 5);
// Set validators
m_TextOrient->SetValidator( wxGenericValidator(& m_CurrentText->m_Orient) );
m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) );
////@end WinEDA_LabelPropertiesFrame content construction
m_btClose->SetFocus();
if (m_CurrentText->Type() == TYPE_SCH_GLOBALLABEL ||
m_CurrentText->Type() == TYPE_SCH_HIERLABEL)
m_TextShape->Show(true);
}
/*!
* Should we show tooltips?
*/
bool WinEDA_LabelPropertiesFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_LabelPropertiesFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_LabelPropertiesFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end WinEDA_LabelPropertiesFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_LabelPropertiesFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_LabelPropertiesFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end WinEDA_LabelPropertiesFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_LabelPropertiesFrame::OnOkClick( wxCommandEvent& event )
void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
{
TextPropertiesAccept(event);
}
......@@ -246,7 +91,7 @@ void WinEDA_LabelPropertiesFrame::OnOkClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void WinEDA_LabelPropertiesFrame::OnCancelClick( wxCommandEvent& event )
void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event )
{
m_Parent->DrawPanel->MouseToCursorSchema();
EndModal( -1 );
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_label.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 19/02/2006 15:46:26
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 19/02/2006 15:46:26
#ifndef _DIALOG_EDIT_LABEL_H_
#define _DIALOG_EDIT_LABEL_H_
#include "dialog_edit_label_base.h"
/*!
* Includes
*/
////@begin includes
#include "wx/valgen.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL 10001
#define ID_RADIOBOX 10003
#define ID_RADIOBOX1 10004
#define ID_TEXTCTRL1 10002
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE _("Text Editor")
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_LabelPropertiesFrame class declaration
*/
class WinEDA_LabelPropertiesFrame: public wxDialog
class DialogLabelEditor : public DialogLabelEditor_Base
{
DECLARE_DYNAMIC_CLASS( WinEDA_LabelPropertiesFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_LabelPropertiesFrame( );
WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent,
SCH_TEXT * CurrentText,
const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION,
wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_LabelPropertiesFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
////@end WinEDA_LabelPropertiesFrame event handler declarations
////@begin WinEDA_LabelPropertiesFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_LabelPropertiesFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void TextPropertiesAccept(wxCommandEvent& event);
////@begin WinEDA_LabelPropertiesFrame member variables
wxTextCtrl* m_TextLabel;
wxRadioBox* m_TextOrient;
wxRadioBox* m_TextShape;
wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize;
wxButton* m_btClose;
////@end WinEDA_LabelPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent;
private:
WinEDA_SchematicFrame * m_Parent;
SCH_TEXT * m_CurrentText;
public:
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
~DialogLabelEditor(){};
private:
void OnInitDialog( wxInitDialogEvent& event );
void OnButtonOKClick( wxCommandEvent& event );
void OnButtonCANCEL_Click( wxCommandEvent& event );
void TextPropertiesAccept( wxCommandEvent& event );
};
#endif
// _DIALOG_EDIT_LABEL_H_
#endif // _DIALOG_EDIT_LABEL_H_
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_label_base.h"
///////////////////////////////////////////////////////////////////////////
DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bSizer2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") };
int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString );
m_TextOrient = new wxRadioBox( this, wxID_ANY, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS );
m_TextOrient->SetSelection( 0 );
m_OptionsSizer->Add( m_TextOrient, 0, wxALL, 5 );
wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString );
m_TextStyle = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS );
m_TextStyle->SetSelection( 0 );
m_OptionsSizer->Add( m_TextStyle, 0, wxALL, 5 );
wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidi"), _("TriState"), _("Passive") };
int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString );
m_TextShape = new wxRadioBox( this, wxID_ANY, _("Glabel Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection( 2 );
m_OptionsSizer->Add( m_TextShape, 0, wxALL, 5 );
bSizer2->Add( m_OptionsSizer, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizer2, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeTitle->Wrap( -1 );
bSizer4->Add( m_SizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer4->Add( 8, 8, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetForegroundColour( wxColour( 234, 0, 0 ) );
bSizer4->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonCANCEL->SetForegroundColour( wxColour( 0, 0, 187 ) );
bSizer4->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bMainSizer->Add( bSizer4, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogLabelEditor_Base::OnInitDialog ) );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
}
DialogLabelEditor_Base::~DialogLabelEditor_Base()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogLabelEditor_Base::OnInitDialog ) );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_edit_label_base__
#define __dialog_edit_label_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DialogLabelEditor_Base
///////////////////////////////////////////////////////////////////////////////
class DialogLabelEditor_Base : public wxDialog
{
private:
protected:
enum
{
wxID_VALUE = 1000,
wxID_SIZE,
};
wxStaticText* m_staticText1;
wxTextCtrl* m_TextLabel;
wxRadioBox* m_TextOrient;
wxRadioBox* m_TextStyle;
wxRadioBox* m_TextShape;
wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnButtonOKClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCANCEL_Click( wxCommandEvent& event ){ event.Skip(); }
public:
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 401,222 ), long style = wxDEFAULT_DIALOG_STYLE );
~DialogLabelEditor_Base();
};
#endif //__dialog_edit_label_base__
......@@ -10,6 +10,7 @@
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "dialog_edit_label.h"
#include "protos.h"
......@@ -24,15 +25,11 @@ static wxSize OldSize;
static int s_DefaultShapeGLabel = (int) NET_INPUT;
static int s_DefaultOrientGLabel = 0;
/************************************/
/* class WinEDA_LabelPropertiesFrame */
/************************************/
#include "dialog_edit_label.cpp"
/****************************************************************************/
void WinEDA_LabelPropertiesFrame::TextPropertiesAccept( wxCommandEvent& event )
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
/****************************************************************************/
{
wxString text;
......@@ -55,6 +52,17 @@ void WinEDA_LabelPropertiesFrame::TextPropertiesAccept( wxCommandEvent& event )
if( m_TextShape )
m_CurrentText->m_Shape = m_TextShape->GetSelection();
int style = m_TextStyle->GetSelection();
if ( ( style & 1 ) )
m_CurrentText->m_Italic = 1;
else
m_CurrentText->m_Italic = 0;
if ( ( style & 2 ) )
m_CurrentText->m_Width = m_CurrentText->m_Size.x / 5;
else
m_CurrentText->m_Width = 0;
m_Parent->GetScreen()->SetModify();
/* Make the text size as new default size if it is a new text */
......@@ -127,10 +135,8 @@ void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct,
DrawPanel->CursorOff( DC );
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
WinEDA_LabelPropertiesFrame* frame = new WinEDA_LabelPropertiesFrame( this,
TextStruct,
wxPoint( 30, 30 ) );
frame->ShowModal(); frame->Destroy();
DialogLabelEditor* dialog = new DialogLabelEditor( this, TextStruct );
dialog->ShowModal(); dialog->Destroy();
RedrawOneStruct( DrawPanel, DC, TextStruct, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC );
......
This diff is collapsed.
......@@ -53,11 +53,14 @@ OBJECTS = eeschema.o\
netlist.o\
netlist_control.o\
edit_label.o\
dialog_edit_label.o\
dialog_edit_label_base.o\
edit_component_in_schematic.o\
dialog_edit_component_in_schematic_fbp.o \
dialog_edit_component_in_schematic.o \
locate.o \
save_schemas.o sheet.o \
read_from_file_schematic_items_descriptions.o\
viewlibs.o \
libedit.o \
libframe.o \
......@@ -97,13 +100,18 @@ OBJECTS = eeschema.o\
eeschema.o: eeschema.cpp program.h general.h $(DEPEND)
read_from_file_schematic_items_descriptions.o: read_from_file_schematic_items_descriptions.cpp
#edit_component_in_lib.o: edit_component_in_lib.cpp\
# dialog_edit_component_in_lib.cpp dialog_edit_component_in_lib.h $(DEPEND)
edit_component_in_schematic.o: edit_component_in_schematic.cpp\
dialog_edit_component_in_schematic.cpp dialog_edit_component_in_schematic.h $(DEPEND)
edit_label.o: edit_label.cpp dialog_edit_label.cpp dialog_edit_label.h $(DEPEND)
edit_label.o: edit_label.cpp dialog_edit_label.h dialog_edit_label_base.h $(DEPEND)
dialog_edit_label.o: dialog_edit_label.cpp dialog_edit_label.h dialog_edit_label_base.h $(DEPEND)
dialog_create_component.o: dialog_create_component.cpp dialog_create_component.h $(DEPEND)
......
......@@ -252,11 +252,13 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0);
pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos;
SetCurrentLineWidth( -1 );
int thickness = Text->m_Width; // @todo: calcultae the pen tickness
PlotGraphicText( g_PlotFormat, pos, CharColor,
Text->m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
Text->m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness);
}
break;
......@@ -282,7 +284,6 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
LibDrawPin* Pin = (LibDrawPin*) DEntry;
if( Pin->m_Attributs & PINNOTDRAW )
{
// if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
break;
}
......@@ -294,9 +295,11 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
/* Dessin de la pin et du symbole special associe */
SetCurrentLineWidth( -1 );
PlotPinSymbol( pos, Pin->m_PinLen, orient, Pin->m_PinShape );
int thickness = 0; // @todo: calcultae the pen tickness
Pin->PlotPinTexts( pos, orient,
Entry->m_TextInside,
Entry->m_DrawPinNum, Entry->m_DrawPinName );
Entry->m_DrawPinNum, Entry->m_DrawPinName,
thickness, false);
}
break;
......@@ -463,14 +466,16 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
}
SetCurrentLineWidth( -1 );
int thickness = field->m_Width; // @todo: calculate the pen tickness
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
//@todo not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
if( !IsMulti || (FieldNumber != REFERENCE) )
{
PlotGraphicText( g_PlotFormat, textpos, color, field->m_Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
field->m_Size,
hjustify, vjustify );
hjustify, vjustify,
thickness, field->m_Italic);
}
else /* We plt the reference, for a multiple parts per package */
{
......@@ -485,7 +490,8 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
#endif
PlotGraphicText( g_PlotFormat, textpos, color, Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
field->m_Size, hjustify, vjustify );
field->m_Size, hjustify, vjustify,
thickness, field->m_Italic );
}
}
......@@ -613,6 +619,9 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
wxString Text;
EDA_Colors color = UNSPECIFIED_COLOR;
bool italic = false;
int thickness = 0;
switch( Struct->Type() )
{
case TYPE_SCH_GLOBALLABEL:
......@@ -621,6 +630,8 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
case TYPE_SCH_TEXT:
Text = ( (SCH_TEXT*) Struct )->m_Text;
Size = ( (SCH_TEXT*) Struct )->m_Size;
thickness = ( (SCH_TEXT*) Struct )->m_Width;
italic = ( (SCH_TEXT*) Struct )->m_Italic;
Orient = ( (SCH_TEXT*) Struct )->m_Orient;
Shape = ( (SCH_TEXT*) Struct )->m_Shape;
pX = ( (SCH_TEXT*) Struct )->m_Pos.x;
......@@ -641,7 +652,6 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
Size = wxSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
SetCurrentLineWidth( -1 );
if ( Struct->Type() == TYPE_SCH_GLOBALLABEL )
{
offset = ( (SCH_GLOBALLABEL*) Struct )->m_Width;
......@@ -669,44 +679,52 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic );
break;
case 1: /* Orientation vert UP */
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
thickness, italic );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic );
break;
case 2: /* Horiz Orientation - Right justified */
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic );
break;
case 3: /* Orientation vert BOTTOM */
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP );
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic );
break;
}
......@@ -748,9 +766,12 @@ static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
tposx = posx + size + (size / 8);
side = GR_TEXT_HJUSTIFY_LEFT;
}
int thickness = Struct->m_Width;
bool italic = Struct->m_Italic;
PlotGraphicText( g_PlotFormat, wxPoint( tposx, posy ), txtcolor,
Struct->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
side, GR_TEXT_VJUSTIFY_CENTER );
side, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic );
/* dessin du symbole de connexion */
if( Struct->m_Edge )
......@@ -837,9 +858,12 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( LAYER_SHEETNAME ) );
int thickness = 0; //@todo use current pen width
bool italic = false;
PlotGraphicText( g_PlotFormat, pos, txtcolor,
Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic );
/* Trace des textes : FileName */
Text = Struct->GetFileName();
......@@ -852,7 +876,8 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
txtcolor,
Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic );
/* Trace des textes : SheetLabel */
SheetLabelStruct = Struct->m_Label;
......
This diff is collapsed.
......@@ -509,8 +509,9 @@ public:
/**
* Function Pitch
* @return distance between 2 characters
* @param aMinTickness = min segments tickness
*/
int Pitch();
int Pitch(int aMinTickness = 0);
/** Function Draw
* @param aPanel = the current DrawPanel
......
......@@ -461,6 +461,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
* @param aH_justify = horizontal justification (Left, center, right)
* @param aV_justify = vertical justification (bottom, center, top)
* @param aWidth = line width (pen width) (default = 0)
* if width < 0 : draw segments in sketch mode, width = abs(width)
* @param aItalic = true to simulate an italic font
*/
void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor,
......@@ -468,7 +470,7 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
int aOrient, const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
bool aItalic = false );
int aWidth, bool aItalic = false );
/***************/
/* CONFIRM.CPP */
......
/*******************************************************************/
/* Functions relatives to tracks, vias and zones(see class_track.h */
/*******************************************************************/
/***********************************************************************/
/* Functions relatives to tracks, vias and segments used to fill zones */
/* (see class_track.h ) */
/***********************************************************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -636,11 +637,13 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
m_Width + (g_DesignSettings.m_TrackClearence * 2), color );
}
/* Display the short netname:
/* Display the short netname for tracks, not for zone segments.
* we must filter tracks, to avoid a lot of texts.
* - only horizontal or vertical tracks are eligible
* - only tracks with a length > 10 * thickness are eligible
*/
if( Type() == TYPE_ZONE )
return;
#define THRESHOLD 10
if( (m_End.x - m_Start.x) != 0 && (m_End.y - m_Start.y) != 0 )
......@@ -651,6 +654,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( len < THRESHOLD * m_Width )
return;
if( ( m_Width / zoom) < 6 ) // no room to display a text inside track
return;
if( GetNet() == 0 )
return;
EQUIPOT* net = ( (BOARD*) GetParent() )->FindNet( GetNet() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment