Commit 5759f734 authored by charras's avatar charras

Rework on TEXTE_PCB, SCH_TEXT and EDA_TextStruct classes.

Code seriously cleaned, obscure and duplicated code removed, and some oddities removed.
Better support of multiline texts.
parent 804e5397
...@@ -4,6 +4,17 @@ KiCad ChangeLog 2009 ...@@ -4,6 +4,17 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-may-12 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++All:
Rework on TEXTE_PCB, SCH_TEXT and EDA_TextStruct classes.
Code seriously cleaned, obscure and duplicated code removed,
and some oddities removed ( like different .m_Orient values in eeschema and
pcbnew, for the same text orientation )
Multiline texts (in comments and Pcb texts) are now supported.
In pcbnew text justifications could work (but not yet used and tested)
2009-may-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-may-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++pcbnew: ++pcbnew:
......
...@@ -254,8 +254,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) ...@@ -254,8 +254,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
rect.SetSize( textsize ); rect.SetSize( textsize );
/* Now, calculate the rect origin, according to text justification /* Now, calculate the rect origin, according to text justification
* At this point the area origin is the text origin. * At this point the area origin is the text origin (m_Pos).
* This is true only for left and top text justified. * This is true only for left and top text justified texts.
* and must be recalculated for others justifications * and must be recalculated for others justifications
* also, note the V justification is relative to the first line * also, note the V justification is relative to the first line
*/ */
...@@ -284,7 +284,7 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) ...@@ -284,7 +284,7 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine )
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
rect.SetY( rect.GetY() + (dy / 2) ); rect.SetY( rect.GetY() - dy );
break; break;
} }
......
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
#define EDA_DRAWBASE #define EDA_DRAWBASE
#include "grfonte.h" #include "grfonte.h"
/* Functions to draw / plot a string.
* texts have only one line.
* They can be in italic.
* Horizontal and Vertical justification are handled.
* Texts can be rotated
* substrings between ~ markers can be "negated" (i.e. with an over bar
*/
/** Function NegableTextLength /** Function NegableTextLength
* Return the text length of a negable string, excluding the ~ markers */ * Return the text length of a negable string, excluding the ~ markers */
int NegableTextLength( const wxString& aText ) int NegableTextLength( const wxString& aText )
...@@ -48,7 +56,7 @@ static void DrawGraphicTextPline( ...@@ -48,7 +56,7 @@ static void DrawGraphicTextPline(
bool sketch_mode, bool sketch_mode,
int point_count, int point_count,
wxPoint* coord, wxPoint* coord,
void (* aCallback)(int x0, int y0, int xf, int yf) ) void (*aCallback)( int x0, int y0, int xf, int yf ) )
{ {
if( aCallback ) if( aCallback )
{ {
...@@ -107,7 +115,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -107,7 +115,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
int aWidth, int aWidth,
bool aItalic, bool aItalic,
bool aNegable, bool aNegable,
void (* aCallback)(int x0, int y0, int xf, int yf) ) void (*aCallback)( int x0, int y0, int xf, int yf ) )
/****************************************************************************************************/ /****************************************************************************************************/
{ {
int char_count, AsciiCode; int char_count, AsciiCode;
...@@ -116,10 +124,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -116,10 +124,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
SH_CODE f_cod, plume = 'U'; SH_CODE f_cod, plume = 'U';
const SH_CODE* ptcar; const SH_CODE* ptcar;
int ptr; int ptr;
int ux0, uy0, dx, dy; // Draw coordinate for segments to draw. also used in some other calculation int dx, dy; // Draw coordinate for segments to draw. also used in some other calculation
int cX, cY; // Texte center wxPoint current_char_pos; // Draw coordinates for the current char
int ox, oy; // Draw coordinates for the current char wxPoint overbar_pos; // Start point for the current overbar
int overbar_x, overbar_y; // Start point for the current overbar
int overbars; // Number of ~ seen int overbars; // Number of ~ seen
#define BUF_SIZE 100 #define BUF_SIZE 100
...@@ -156,8 +163,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -156,8 +163,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
else else
pitch -= thickness; pitch -= thickness;
ox = cX = aPos.x; current_char_pos = aPos;
oy = cY = aPos.y;
/* Do not draw the text if out of draw area! */ /* Do not draw the text if out of draw area! */
if( aPanel ) if( aPanel )
...@@ -166,8 +172,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -166,8 +172,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
int textsize = ABS( pitch ); int textsize = ABS( pitch );
ll = aPanel->GetScreen()->Scale( textsize * char_count ); ll = aPanel->GetScreen()->Scale( textsize * char_count );
xc = GRMapX( cX ); xc = GRMapX( current_char_pos.x );
yc = GRMapY( cY ); yc = GRMapY( current_char_pos.y );
x0 = aPanel->m_ClipBox.GetX() - ll; x0 = aPanel->m_ClipBox.GetX() - ll;
y0 = aPanel->m_ClipBox.GetY() - ll; y0 = aPanel->m_ClipBox.GetY() - ll;
...@@ -185,81 +191,60 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -185,81 +191,60 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
} }
/* Compute the position ux0, uy0 of the first letter , next */ /* Compute the position of the first letter of the text
dx = (pitch * char_count) / 2; * this position is the position of the left bottom point of the letter
dy = size_v / 2; /* dx, dy = draw offset between first letter and text center */ * this is the same as the text position only for a left and bottom justified text
* In others cases, this position must be calculated from the text position ans size
ux0 = uy0 = 0; /* for ux0 = uy0 = 0, the text is centered */ */
dx = pitch * char_count;
wxPoint offset_org( dx, dy ); dy = size_v; /* dx, dy = draw offset between first letter and text center */
int irot = aOrient;
while( irot >= 1800 )
irot -= 1800;
while( irot < 0 )
irot += 1800;
if( irot != 0 )
EXCHG( offset_org.x, offset_org.y );
switch( aH_justify ) switch( aH_justify )
{ {
case GR_TEXT_HJUSTIFY_CENTER: case GR_TEXT_HJUSTIFY_CENTER:
current_char_pos.x -= dx / 2;
break; break;
case GR_TEXT_HJUSTIFY_RIGHT: case GR_TEXT_HJUSTIFY_RIGHT:
ux0 = -offset_org.x; current_char_pos.x -= dx;
break; break;
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_LEFT:
ux0 = offset_org.x;
break; break;
} }
switch( aV_justify ) switch( aV_justify )
{ {
case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER:
current_char_pos.y += dy/2;
break; break;
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
uy0 = offset_org.y; current_char_pos.y += dy;
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
uy0 = -offset_org.y;
break; break;
} }
cX += ux0;
cY += uy0;
ox = cX - dx;
oy = cY + dy;
// Note: if aPanel == NULL, we are using a GL Canvas that handle scaling // Note: if aPanel == NULL, we are using a GL Canvas that handle scaling
if( aPanel && aPanel->GetScreen()->Scale( aSize.x ) == 0 ) if( aPanel && aPanel->GetScreen()->Scale( aSize.x ) == 0 )
return; return;
if( aPanel && ABS( ( aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 ) /* shapes are too small: connot be drawn */ /* if a text size is too small, the text cannot be drawn, and it is drawn as a single graphic line */
if( aPanel && ABS( ( aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 )
{ {
/* insteed the text is drawn as a line */ /* draw the text as a line always vertically centered */
dx = (pitch * char_count) / 2; wxPoint end( current_char_pos.x + dx, current_char_pos.y);
dy = size_v / 2; /* line is always centered */
ux0 = cX - dx;
uy0 = cY;
dx += cX;
dy = cY;
RotatePoint( &ux0, &uy0, cX, cY, aOrient ); RotatePoint( &current_char_pos, aPos, aOrient );
RotatePoint( &dx, &dy, cX, cY, aOrient ); RotatePoint( &end, aPos, aOrient );
if( aCallback ) if( aCallback )
aCallback( ux0, uy0, dx, dy ); aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y );
else else
GRLine( &aPanel->m_ClipBox, aDC, ux0, uy0, dx, dy, aWidth, aColor ); GRLine( &aPanel->m_ClipBox, aDC,
current_char_pos.x, current_char_pos.y, end.x, end.y , aWidth, aColor );
return; return;
} }
...@@ -278,20 +263,18 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -278,20 +263,18 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
if( overbars % 2 ) if( overbars % 2 )
{ {
/* Starting the overbar */ /* Starting the overbar */
overbar_x = ox; overbar_pos = current_char_pos;
overbar_y = oy - overbar_position( size_v, thickness ); overbar_pos.y -= overbar_position( size_v, thickness );
RotatePoint( &overbar_x, &overbar_y, cX, cY, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient );
} }
else else
{ {
/* Ending the overbar */ /* Ending the overbar */
coord[0].x = overbar_x; coord[0] = overbar_pos;
coord[0].y = overbar_y; overbar_pos = current_char_pos;
overbar_x = ox; overbar_pos.y -= overbar_position( size_v, thickness );
overbar_y = oy - overbar_position( size_v, thickness ); RotatePoint( &overbar_pos, aPos, aOrient );
RotatePoint( &overbar_x, &overbar_y, cX, cY, aOrient ); coord[1] = overbar_pos;
coord[1].x = overbar_x;
coord[1].y = overbar_y;
/* Plot the overbar segment */ /* Plot the overbar segment */
DrawGraphicTextPline( aPanel, aDC, aColor, aWidth, DrawGraphicTextPline( aPanel, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback ); sketch_mode, 2, coord, aCallback );
...@@ -345,6 +328,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -345,6 +328,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
default: default:
{ {
int y, k1, k2; int y, k1, k2;
wxPoint currpoint;
y = k1 = f_cod; /* trace sur axe V */ y = k1 = f_cod; /* trace sur axe V */
k1 = -( (k1 * size_v) / 9 ); k1 = -( (k1 * size_v) / 9 );
...@@ -357,11 +341,11 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -357,11 +341,11 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
// To simulate an italic font, add a x offset depending on the y offset // To simulate an italic font, add a x offset depending on the y offset
if( aItalic ) if( aItalic )
k2 -= italic_reverse ? -k1 / 8 : k1 / 8; k2 -= italic_reverse ? -k1 / 8 : k1 / 8;
dx = k2 + ox; dy = k1 + oy; currpoint.x = k2 + current_char_pos.x;
currpoint.y = k1 + current_char_pos.y;
RotatePoint( &dx, &dy, cX, cY, aOrient ); RotatePoint( &currpoint, aPos, aOrient );
coord[point_count].x = dx; coord[point_count] = currpoint;
coord[point_count].y = dy;
if( point_count < BUF_SIZE - 1 ) if( point_count < BUF_SIZE - 1 )
point_count++; point_count++;
break; break;
...@@ -373,19 +357,18 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -373,19 +357,18 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
/* end draw 1 char */ /* end draw 1 char */
ptr++; ox += pitch; ptr++;
current_char_pos.x += pitch; // current_char_pos is now the next position
} }
if( overbars % 2 ) if( overbars % 2 )
{ {
/* Close the last overbar */ /* Close the last overbar */
coord[0].x = overbar_x; coord[0] = overbar_pos;
coord[0].y = overbar_y; overbar_pos = current_char_pos;
overbar_x = ox; overbar_pos.y -= overbar_position( size_v, thickness );
overbar_y = oy - overbar_position( size_v, thickness ); RotatePoint( &overbar_pos, aPos, aOrient );
RotatePoint( &overbar_x, &overbar_y, cX, cY, aOrient ); coord[1] = overbar_pos;
coord[1].x = overbar_x;
coord[1].y = overbar_y;
/* Plot the overbar segment */ /* Plot the overbar segment */
DrawGraphicTextPline( aPanel, aDC, aColor, aWidth, DrawGraphicTextPline( aPanel, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback ); sketch_mode, 2, coord, aCallback );
......
...@@ -469,8 +469,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -469,8 +469,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
/* Get the num and name colors */ /* Get the num and name colors */
if( (Color < 0) && (m_Selected & IS_SELECTED) ) if( (Color < 0) && (m_Selected & IS_SELECTED) )
Color = g_ItemSelectetColor; Color = g_ItemSelectetColor;
NameColor = (EDA_Colors) (Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color); NameColor = (EDA_Colors) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color );
NumColor = (EDA_Colors) (Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color); NumColor = (EDA_Colors) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color );
/* Create the pin num string */ /* Create the pin num string */
ReturnPinStringNum( StringPinNum ); ReturnPinStringNum( StringPinNum );
...@@ -545,41 +545,45 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -545,41 +545,45 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
else /* Its a vertical line. */ else /* Its a vertical line. */
{ {
// Text is drawn from bottom to top (i.e. to negative value for Y axis) // Text is drawn from bottom to top (i.e. to negative value for Y axis)
if( DrawPinName )
{
if( orient == PIN_DOWN ) if( orient == PIN_DOWN )
{ {
y = y1 + TextInside; y = y1 + TextInside;
if( DrawPinName )
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
m_PinName, m_PinName,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_TOP, LineWidth, GR_TEXT_VJUSTIFY_CENTER, LineWidth,
false, true ); false, true );
if( DrawPinNum )
DrawGraphicText( panel, DC,
wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ), NumColor,
StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
} }
else /* PIN_UP */ else /* PIN_UP */
{ {
y = y1 - TextInside; y = y1 - TextInside;
if( DrawPinName )
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
m_PinName, m_PinName,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth, GR_TEXT_VJUSTIFY_CENTER, LineWidth,
false, true ); false, true );
}
}
if( DrawPinNum ) if( DrawPinNum )
{
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( x1 - TXTMARGE, wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ), NumColor, (y1 + pin_pos.y) / 2 ), NumColor,
StringPinNum, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, LineWidth ); GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
} }
} }
} }
...@@ -606,7 +610,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -606,7 +610,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
y1 + TXTMARGE ), y1 + TXTMARGE ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP,
LineWidth ); LineWidth );
} }
} }
...@@ -619,8 +624,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -619,8 +624,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
y ), y ),
NameColor, m_PinName, NameColor, m_PinName,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, LineWidth, false, true ); GR_TEXT_VJUSTIFY_BOTTOM, LineWidth, false, true );
} }
if( DrawPinNum ) if( DrawPinNum )
...@@ -630,8 +635,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -630,8 +635,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
(y1 + pin_pos.y) / 2 ), (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, LineWidth ); GR_TEXT_VJUSTIFY_TOP, LineWidth );
} }
} }
} }
...@@ -667,8 +672,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -667,8 +672,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
&& g_PlotPSColorOpt; && g_PlotPSColorOpt;
/* Get the num and name colors */ /* Get the num and name colors */
NameColor = (EDA_Colors) (plot_color ? ReturnLayerColor( LAYER_PINNAM ) : -1); NameColor = (EDA_Colors) ( plot_color ? ReturnLayerColor( LAYER_PINNAM ) : -1 );
NumColor = (EDA_Colors) (plot_color ? ReturnLayerColor( LAYER_PINNUM ) : -1); NumColor = (EDA_Colors) ( plot_color ? ReturnLayerColor( LAYER_PINNUM ) : -1 );
/* Create the pin num string */ /* Create the pin num string */
ReturnPinStringNum( StringPinNum ); ReturnPinStringNum( StringPinNum );
...@@ -717,6 +722,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -717,6 +722,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
else // orient == PIN_LEFT else // orient == PIN_LEFT
{ {
x = x1 - TextInside; x = x1 - TextInside;
if( DrawPinName )
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ), PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ),
NameColor, m_PinName, TEXT_ORIENT_HORIZ, NameColor, m_PinName, TEXT_ORIENT_HORIZ,
PinNameSize, PinNameSize,
...@@ -724,13 +730,10 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -724,13 +730,10 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic, true ); aWidth, aItalic, true );
} }
}
if( DrawPinNum ) if( DrawPinNum )
{ {
PlotGraphicText( g_PlotFormat, PlotGraphicText( g_PlotFormat,
wxPoint( (x1 + pin_pos.x) / 2, wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ),
y1 - TXTMARGE ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER,
...@@ -738,34 +741,43 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -738,34 +741,43 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
aWidth, aItalic ); aWidth, aItalic );
} }
} }
}
else /* Its a vertical line. */ else /* Its a vertical line. */
{
if( DrawPinName )
{ {
if( orient == PIN_DOWN ) if( orient == PIN_DOWN )
{ {
y = y1 + TextInside; y = y1 + TextInside;
if( DrawPinName )
PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor,
m_PinName, m_PinName,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_TOP, GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic, true ); aWidth, aItalic, true );
if( DrawPinNum )
{
PlotGraphicText( g_PlotFormat,
wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
aWidth, aItalic );
}
} }
else /* PIN_UP */ else /* PIN_UP */
{ {
y = y1 - TextInside; y = y1 - TextInside;
if( DrawPinName )
PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor,
m_PinName, m_PinName,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER,
aWidth, aItalic, true ); aWidth, aItalic, true );
}
}
if( DrawPinNum ) if( DrawPinNum )
{ {
PlotGraphicText( g_PlotFormat, PlotGraphicText( g_PlotFormat,
...@@ -773,12 +785,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -773,12 +785,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
(y1 + pin_pos.y) / 2 ), (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
aWidth, aItalic ); aWidth, aItalic );
} }
} }
} }
}
else /* Draw num & text pin outside */ else /* Draw num & text pin outside */
{ {
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
...@@ -801,7 +814,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -801,7 +814,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 + TXTMARGE ), PlotGraphicText( g_PlotFormat, wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP,
aWidth, aItalic ); aWidth, aItalic );
} }
} }
...@@ -814,8 +828,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -814,8 +828,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
y ), y ),
NameColor, m_PinName, NameColor, m_PinName,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
aWidth, aItalic, true ); aWidth, aItalic, true );
} }
...@@ -826,8 +840,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, ...@@ -826,8 +840,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
(y1 + pin_pos.y) / 2 ), (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
aWidth, aItalic ); aWidth, aItalic );
} }
} }
......
...@@ -39,32 +39,32 @@ const char* SheetLabelType[] = ...@@ -39,32 +39,32 @@ const char* SheetLabelType[] =
* others are the corners coordinates in reduced units * others are the corners coordinates in reduced units
* the real coordinate is the reduced coordinate * text half size * the real coordinate is the reduced coordinate * text half size
*/ */
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 }; static int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 }; static int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 }; static int TemplateIN_UP[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 }; static int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 }; static int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 }; static int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 }; static int TemplateOUT_UP[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 }; static int TemplateOUT_BOTTOM[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 }; static int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 }; static int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 }; static int TemplateUNSPC_UP[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 }; static int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }; static int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }; static int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }; static int TemplateBIDI_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }; static int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }; static int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }; static int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }; static int Template3STATE_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }; static int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int* TemplateShape[5][4] = static int* TemplateShape[5][4] =
{ {
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM }, { TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM }, { TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
...@@ -84,7 +84,8 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : ...@@ -84,7 +84,8 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
m_Pos = pos; m_Pos = pos;
m_Shape = 0; m_Shape = 0;
m_IsDangling = FALSE; m_IsDangling = FALSE;
m_MultilineAllowed=true; m_MultilineAllowed = true;
m_SchematicOrientation = 0;
} }
...@@ -94,9 +95,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : ...@@ -94,9 +95,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
*/ */
bool SCH_TEXT::HitTest( const wxPoint& aPosRef ) bool SCH_TEXT::HitTest( const wxPoint& aPosRef )
{ {
EDA_Rect rect = GetBoundingBox(); return EDA_TextStruct::HitTest( aPosRef );
return rect.Inside( aPosRef );
} }
...@@ -135,11 +134,292 @@ SCH_TEXT* SCH_TEXT::GenCopy() ...@@ -135,11 +134,292 @@ SCH_TEXT* SCH_TEXT::GenCopy()
newitem->m_VJustify = m_VJustify; newitem->m_VJustify = m_VJustify;
newitem->m_IsDangling = m_IsDangling; newitem->m_IsDangling = m_IsDangling;
newitem->m_Italic = m_Italic; newitem->m_Italic = m_Italic;
newitem->m_SchematicOrientation = m_SchematicOrientation;
return newitem; return newitem;
} }
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
wxPoint SCH_TEXT::GetSchematicTextOffset()
{
wxPoint text_offset;
// add a small offset (TXTMARGE) to x ( or y) position to allow a text to be on a wire or a line and be readable
switch( m_SchematicOrientation )
{
default:
case 0: /* Horiz Normal Orientation (left justified) */
text_offset.y = -TXTMARGE;
break;
case 1: /* Vert Orientation UP */
text_offset.x = -TXTMARGE;
break;
case 2: /* Horiz Orientation - Right justified */
text_offset.y = -TXTMARGE;
break;
case 3: /* Vert Orientation BOTTOM */
text_offset.x = -TXTMARGE;
break;
}
return text_offset;
}
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
wxPoint SCH_LABEL::GetSchematicTextOffset()
{
return SCH_TEXT::GetSchematicTextOffset();
}
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
wxPoint SCH_HIERLABEL::GetSchematicTextOffset()
{
wxPoint text_offset;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int ii = m_Size.x + TXTMARGE + width;
switch( m_SchematicOrientation )
{
case 0: /* Orientation horiz normale */
text_offset.x = -ii;
break;
case 1: /* Orientation vert UP */
text_offset.y = -ii;
break;
case 2: /* Orientation horiz inverse */
text_offset.x = ii;
break;
case 3: /* Orientation vert BOTTOM */
text_offset.y = ii;
break;
}
return text_offset;
}
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset()
{
wxPoint text_offset;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
int HalfSize = m_Size.x / 2;
int offset = width;
switch( m_Shape )
{
case NET_INPUT:
case NET_BIDI:
case NET_TRISTATE:
offset += HalfSize;
break;
case NET_OUTPUT:
offset += TXTMARGE;
break;
default:
break;
}
switch( m_SchematicOrientation )
{
case 0: /* Orientation horiz normale */
text_offset.x -= offset;
break;
case 1: /* Orientation vert UP */
text_offset.y -= offset;
break;
case 2: /* Orientation horiz inverse */
text_offset.x += offset;
break;
case 3: /* Orientation vert BOTTOM */
text_offset.y += offset;
break;
}
return text_offset;
}
/** function SetTextOrientAndJustifyParmeters (virtual)
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
void SCH_TEXT::SetSchematicTextOrientation( int aSchematicOrientation )
{
m_SchematicOrientation = aSchematicOrientation;
switch( m_SchematicOrientation )
{
default:
case 0: /* Horiz Normal Orientation (left justified) */
m_Orient = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
break;
case 1: /* Vert Orientation UP */
m_Orient = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
break;
case 2: /* Horiz Orientation - Right justified */
m_Orient = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
break;
case 3: /* Vert Orientation BOTTOM */
m_Orient = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
break;
}
}
/** function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a label)
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
void SCH_LABEL::SetSchematicTextOrientation( int aSchematicOrientation )
{
SCH_TEXT::SetSchematicTextOrientation( aSchematicOrientation );
}
/** function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
void SCH_GLOBALLABEL::SetSchematicTextOrientation( int aSchematicOrientation )
{
m_SchematicOrientation = aSchematicOrientation;
switch( m_SchematicOrientation )
{
default:
case 0: /* Horiz Normal Orientation */
m_Orient = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 1: /* Vert Orientation UP */
m_Orient = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 2: /* Horiz Orientation */
m_Orient = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 3: /* Vert Orientation BOTTOM */
m_Orient = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
}
}
/** function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
void SCH_HIERLABEL::SetSchematicTextOrientation( int aSchematicOrientation )
{
m_SchematicOrientation = aSchematicOrientation;
switch( m_SchematicOrientation )
{
default:
case 0: /* Horiz Normal Orientation */
m_Orient = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 1: /* Vert Orientation UP */
m_Orient = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 2: /* Horiz Orientation */
m_Orient = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 3: /* Vert Orientation BOTTOM */
m_Orient = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
}
}
/********************************************************/ /********************************************************/
void SCH_TEXT::SwapData( SCH_TEXT* copyitem ) void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
/********************************************************/ /********************************************************/
...@@ -155,6 +435,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem ) ...@@ -155,6 +435,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
EXCHG( m_HJustify, copyitem->m_HJustify ); EXCHG( m_HJustify, copyitem->m_HJustify );
EXCHG( m_VJustify, copyitem->m_VJustify ); EXCHG( m_VJustify, copyitem->m_VJustify );
EXCHG( m_IsDangling, copyitem->m_IsDangling ); EXCHG( m_IsDangling, copyitem->m_IsDangling );
EXCHG( m_SchematicOrientation, copyitem->m_SchematicOrientation );
} }
...@@ -198,52 +479,16 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset, ...@@ -198,52 +479,16 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
int orientation; wxPoint text_offset = aOffset + GetSchematicTextOffset();
wxPoint text_offset = aOffset;
switch( m_Orient )
{
default:
case 0: /* Horiz Normal Orientation (left justified) */
orientation = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
text_offset.y -= TXTMARGE;
break;
case 1: /* Vert Orientation UP */
orientation = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
text_offset.x -= TXTMARGE;
break;
case 2: /* Horiz Orientation - Right justified */
orientation = TEXT_ORIENT_HORIZ;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
text_offset.y -= TXTMARGE;
break;
case 3: /* Vert Orientation BOTTOM */
orientation = TEXT_ORIENT_VERT;
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_VJustify = GR_TEXT_VJUSTIFY_TOP;
text_offset.x -= TXTMARGE;
break;
}
// Due to eeschema history; texts orientations are in 0.1 deg, and m_Orient is 0,1,2,3 for label
// Set m_Orient to is value in deg, and after call EDA_TextStruct::Draw retrieve its previous value
EXCHG( orientation, m_Orient );
EXCHG( width, m_Width ); // Set the minimum width EXCHG( width, m_Width ); // Set the minimum width
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( orientation, m_Orient ); // set initial value
EXCHG( width, m_Width ); // set initial value EXCHG( width, m_Width ); // set initial value
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color ); DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
} }
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
...@@ -258,21 +503,21 @@ bool SCH_TEXT::Save( FILE* aFile ) const ...@@ -258,21 +503,21 @@ bool SCH_TEXT::Save( FILE* aFile ) const
if( m_Italic ) if( m_Italic )
shape = "Italic"; shape = "Italic";
wxString text=m_Text; wxString text = m_Text;
for (;;) for( ; ; )
{ {
int i=text.find('\n'); int i = text.find( '\n' );
if (i==wxNOT_FOUND) if( i==wxNOT_FOUND )
break; break;
text.erase(i,1); text.erase( i, 1 );
text.insert(i,_("\\n")); text.insert( i, _( "\\n" ) );
} }
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n", if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Orient, m_Size.x, m_SchematicOrientation, m_Size.x,
shape, m_Width, shape, m_Width,
CONV_TO_UTF8( text ) ) == EOF ) CONV_TO_UTF8( text ) ) == EOF )
{ {
...@@ -310,6 +555,7 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : ...@@ -310,6 +555,7 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
m_Layer = LAYER_LOCLABEL; m_Layer = LAYER_LOCLABEL;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
m_MultilineAllowed = false;
} }
...@@ -329,7 +575,7 @@ bool SCH_LABEL::Save( FILE* aFile ) const ...@@ -329,7 +575,7 @@ bool SCH_LABEL::Save( FILE* aFile ) const
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n", if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Orient, m_Size.x, shape, m_Width, m_SchematicOrientation, m_Size.x, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF ) CONV_TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
...@@ -347,6 +593,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : ...@@ -347,6 +593,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_BIDI; m_Shape = NET_BIDI;
m_IsDangling = TRUE; m_IsDangling = TRUE;
m_MultilineAllowed = false;
} }
...@@ -365,7 +612,7 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const ...@@ -365,7 +612,7 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
shape = "Italic"; shape = "Italic";
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Orient, m_Size.x, m_SchematicOrientation, m_Size.x,
SheetLabelType[m_Shape], SheetLabelType[m_Shape],
shape, m_Width, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF ) CONV_TO_UTF8( m_Text ) ) == EOF )
...@@ -400,6 +647,7 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) : ...@@ -400,6 +647,7 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) :
m_Layer = LAYER_HIERLABEL; m_Layer = LAYER_HIERLABEL;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
m_MultilineAllowed = false;
} }
...@@ -418,7 +666,7 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const ...@@ -418,7 +666,7 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
shape = "Italic"; shape = "Italic";
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Orient, m_Size.x, m_SchematicOrientation, m_Size.x,
SheetLabelType[m_Shape], SheetLabelType[m_Shape],
shape, m_Width, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF ) CONV_TO_UTF8( m_Text ) ) == EOF )
...@@ -463,9 +711,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs ...@@ -463,9 +711,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
*/ */
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
int ii;
EDA_Colors color; EDA_Colors color;
wxPoint AnchorPos = m_Pos + offset; wxPoint text_offset = offset + GetSchematicTextOffset();
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
...@@ -476,40 +723,11 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs ...@@ -476,40 +723,11 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
ii = m_Size.x + TXTMARGE; EXCHG( width, m_Width ); // Set the minimum width
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
switch( m_Orient ) EXCHG( width, m_Width ); // set initial value
{
case 0: /* Orientation horiz normale */
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, m_Italic, true );
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, m_Italic, true );
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, m_Italic, true );
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, m_Italic, true );
break;
}
CreateGraphicShape( Poly, AnchorPos ); CreateGraphicShape( Poly, m_Pos + offset );
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color ); GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color );
if( m_IsDangling ) if( m_IsDangling )
...@@ -517,17 +735,14 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs ...@@ -517,17 +735,14 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
} }
/** /** Function CreateGraphicShape
* Function CreateGraphicShape
* calculates the graphic shape (a polygon) associated to the text * calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = coordinates list fill with polygon corners ooordinates (size > 20) * @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape * @param Pos = Postion of the shape
* format list is
* corner_count, x0, y0, ... xn, yn
*/ */
void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos ) void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
{ {
int* Template = TemplateShape[m_Shape][m_Orient]; int* Template = TemplateShape[m_Shape][m_SchematicOrientation];
int HalfSize = m_Size.x / 2; int HalfSize = m_Size.x / 2;
int imax = *Template; Template++; int imax = *Template; Template++;
...@@ -559,9 +774,11 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox() ...@@ -559,9 +774,11 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
height = m_Size.y + 2 * TXTMARGE; height = m_Size.y + 2 * TXTMARGE;
length = ( Pitch( width ) * NegableTextLength( m_Text ) ) + height + 2 * DANGLING_SYMBOL_SIZE; // add height for triangular shapes length = ( Pitch( width ) * NegableTextLength( m_Text ) )
+ height // add height for triangular shapes
+ 2 * DANGLING_SYMBOL_SIZE;
switch( m_Orient ) // respect orientation switch( m_SchematicOrientation ) // respect orientation
{ {
case 0: /* Horiz Normal Orientation (left justified) */ case 0: /* Horiz Normal Orientation (left justified) */
dx = -length; dx = -length;
...@@ -572,9 +789,9 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox() ...@@ -572,9 +789,9 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
case 1: /* Vert Orientation UP */ case 1: /* Vert Orientation UP */
dx = height; dx = height;
dy = length; dy = -length;
x -= height / 2; x -= height / 2;
y -= DANGLING_SYMBOL_SIZE; y += DANGLING_SYMBOL_SIZE;
break; break;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
...@@ -586,9 +803,9 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox() ...@@ -586,9 +803,9 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
case 3: /* Vert Orientation BOTTOM */ case 3: /* Vert Orientation BOTTOM */
dx = height; dx = height;
dy = -length; dy = length;
x -= height / 2; x -= height / 2;
y += DANGLING_SYMBOL_SIZE; y -= DANGLING_SYMBOL_SIZE;
break; break;
} }
...@@ -599,7 +816,7 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox() ...@@ -599,7 +816,7 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
/*******************************************************************************************/ /*******************************************************************************************/
void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& draw_offset, void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
...@@ -607,10 +824,8 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr ...@@ -607,10 +824,8 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
*/ */
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
int offset;
EDA_Colors color; EDA_Colors color;
int HalfSize; wxPoint text_offset = aOffset + GetSchematicTextOffset();
wxPoint AnchorPos = m_Pos + draw_offset;;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
...@@ -621,67 +836,21 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr ...@@ -621,67 +836,21 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
HalfSize = m_Size.x / 2; EXCHG( width, m_Width ); // Set the minimum width
offset = width; EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( width, m_Width ); // set initial value
switch( m_Shape )
{
case NET_INPUT:
case NET_BIDI:
case NET_TRISTATE:
offset += HalfSize;
break;
case NET_OUTPUT:
offset += TXTMARGE;
break;
default:
break;
}
switch( m_Orient )
{
case 0: /* Orientation horiz normale */
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, m_Italic, true );
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, m_Italic, true );
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, m_Italic, true );
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, m_Italic, true );
break;
}
CreateGraphicShape( Poly, AnchorPos ); CreateGraphicShape( Poly, m_Pos + aOffset );
GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color ); GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color );
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, AnchorPos, color ); DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
} }
/** function CreateGraphicShape /** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = list to fill with polygon corners coordinates * @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Position of the shape * @param Pos = Position of the shape
*/ */
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos ) void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
...@@ -730,13 +899,13 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, c ...@@ -730,13 +899,13 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, c
int angle = 0; int angle = 0;
switch( m_Orient ) switch( m_SchematicOrientation )
{ {
case 0: /* Orientation horiz normale */ case 0: /* Orientation horiz normale */
break; break;
case 1: /* Orientation vert UP */ case 1: /* Orientation vert UP */
angle = 900; angle = -900;
break; break;
case 2: /* Orientation horiz inverse */ case 2: /* Orientation horiz inverse */
...@@ -744,12 +913,12 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, c ...@@ -744,12 +913,12 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, c
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Orientation vert BOTTOM */
angle = -900; angle = 900;
break; break;
} }
// Rotate outlines and move corners in real position // Rotate outlines and move corners in real position
for( unsigned ii = 0; ii < aCorner_list.size(); ii ++ ) for( unsigned ii = 0; ii < aCorner_list.size(); ii++ )
{ {
aCorner_list[ii].x += x_offset; aCorner_list[ii].x += x_offset;
if( angle ) if( angle )
...@@ -772,11 +941,13 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() ...@@ -772,11 +941,13 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
dx = dy = 0; dx = dy = 0;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
height = m_Size.y + 2 * TXTMARGE; height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE;
length = length =
( Pitch( width ) * NegableTextLength( m_Text ) ) + 2 * height + 2 * DANGLING_SYMBOL_SIZE; // add 2*height for triangular shapes (bidirectional) ( Pitch( width ) * NegableTextLength( m_Text ) ) // text X size
+ height // add height for triangular shapes (bidirectional)
+ DANGLING_SYMBOL_SIZE;
switch( m_Orient ) // respect orientation switch( m_SchematicOrientation ) // respect orientation
{ {
case 0: /* Horiz Normal Orientation (left justified) */ case 0: /* Horiz Normal Orientation (left justified) */
dx = -length; dx = -length;
...@@ -787,9 +958,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() ...@@ -787,9 +958,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
case 1: /* Vert Orientation UP */ case 1: /* Vert Orientation UP */
dx = height; dx = height;
dy = length; dy = -length;
x -= height / 2; x -= height / 2;
y -= DANGLING_SYMBOL_SIZE; y += DANGLING_SYMBOL_SIZE;
break; break;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
...@@ -801,9 +972,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() ...@@ -801,9 +972,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
case 3: /* Vert Orientation BOTTOM */ case 3: /* Vert Orientation BOTTOM */
dx = height; dx = height;
dy = -length; dy = length;
x -= height / 2; x -= height / 2;
y += DANGLING_SYMBOL_SIZE; y -= DANGLING_SYMBOL_SIZE;
break; break;
} }
...@@ -826,7 +997,7 @@ EDA_Rect SCH_TEXT::GetBoundingBox() ...@@ -826,7 +997,7 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
height = m_Size.y; height = m_Size.y;
dx = dy = 0; dx = dy = 0;
switch( m_Orient ) // respect orientation switch( m_SchematicOrientation )
{ {
case 0: /* Horiz Normal Orientation (left justified) */ case 0: /* Horiz Normal Orientation (left justified) */
dx = 2 * DANGLING_SYMBOL_SIZE + length; dx = 2 * DANGLING_SYMBOL_SIZE + length;
......
...@@ -8,28 +8,37 @@ ...@@ -8,28 +8,37 @@
#include "macros.h" #include "macros.h"
#include "base_struct.h" #include "base_struct.h"
/* Type des labels sur sheet (Labels sur hierarchie) et forme des Global-Labels*/ /* Type of SCH_HIERLABEL and SCH_GLOBALLABEL
* mainly used to handle the graphic associated shape
*/
typedef enum { typedef enum {
NET_INPUT, NET_INPUT,
NET_OUTPUT, NET_OUTPUT,
NET_BIDI, NET_BIDI,
NET_TRISTATE, NET_TRISTATE,
NET_UNSPECIFIED, NET_UNSPECIFIED,
NET_TMAX /* Derniere valeur: fin de tableau */ NET_TMAX /* Last value */
} TypeSheetLabel; } TypeSheetLabel;
/* Messages correspondants aux types ou forme des labels */
extern const char* SheetLabelType[];
extern int* TemplateShape[5][4];
class SCH_TEXT : public SCH_ITEM extern const char* SheetLabelType[]; /* names of types of labels */
, public EDA_TextStruct
{
class SCH_TEXT : public SCH_ITEM,
public EDA_TextStruct
{
public: public:
int m_Layer; int m_Layer;
int m_Shape; int m_Shape;
bool m_IsDangling; // TRUE if not connected bool m_IsDangling; // true if not connected (used to draw the "not connected" symbol
protected:
int m_SchematicOrientation; /* orientation of texts (comments) and labels in schematic
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
* this is perhaps a duplicate of m_Orient and m_HJustified or m_VJustified,
* but is more easy to handle that 3 parmeters in editions, Reading and Saving file
*/
public: public:
...@@ -43,6 +52,27 @@ public: ...@@ -43,6 +52,27 @@ public:
} }
/** function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a text )
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
int GetSchematicTextOrientation() { return m_SchematicOrientation;}
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
virtual wxPoint GetSchematicTextOffset( );
SCH_TEXT* GenCopy(); SCH_TEXT* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
...@@ -71,9 +101,6 @@ public: ...@@ -71,9 +101,6 @@ public:
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
}; };
...@@ -90,6 +117,26 @@ public: ...@@ -90,6 +117,26 @@ public:
return wxT( "SCH_LABEL" ); return wxT( "SCH_LABEL" );
} }
/** function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a label)
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
virtual wxPoint GetSchematicTextOffset( );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
...@@ -115,6 +162,25 @@ public: ...@@ -115,6 +162,25 @@ public:
} }
/** function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
virtual wxPoint GetSchematicTextOffset( );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
...@@ -133,17 +199,13 @@ public: ...@@ -133,17 +199,13 @@ public:
/** function CreateGraphicShape /** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = coordinates list fill with polygon corners ooordinates * @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape * @param Pos = Position of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/ */
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint & Pos ); void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos );
}; };
class SCH_HIERLABEL : public SCH_TEXT class SCH_HIERLABEL : public SCH_TEXT
{ {
public: public:
...@@ -159,14 +221,31 @@ public: ...@@ -159,14 +221,31 @@ public:
} }
/** function SetTextOrientAndJustifyParmeters
* Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
* must be called after changing m_SchematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a wire)
*/
virtual wxPoint GetSchematicTextOffset( );
/** function CreateGraphicShape /** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = coordinates list fill with polygon corners ooordinates * @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape * @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/ */
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint & Pos ); void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos );
/** /**
* Function Save * Function Save
......
...@@ -21,20 +21,7 @@ ...@@ -21,20 +21,7 @@
int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText ) int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText )
{ {
int ret; int ret;
bool multiline; bool multiline = CurrentText->m_MultilineAllowed;
switch( CurrentText->Type() )
{
case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL:
case TYPE_SCH_LABEL:
multiline = false;
break;
default:
multiline = true;
break;
}
DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText, multiline ); DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText, multiline );
...@@ -97,7 +84,7 @@ void DialogLabelEditor::init() ...@@ -97,7 +84,7 @@ void DialogLabelEditor::init()
EnsureTextCtrlWidth( m_TextLabel ); EnsureTextCtrlWidth( m_TextLabel );
// Set validators // Set validators
m_TextOrient->SetSelection( m_CurrentText->m_Orient ); m_TextOrient->SetSelection( m_CurrentText->GetSchematicTextOrientation() );
m_TextShape->SetSelection( m_CurrentText->m_Shape ); m_TextShape->SetSelection( m_CurrentText->m_Shape );
int style = 0; int style = 0;
......
...@@ -525,6 +525,13 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -525,6 +525,13 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
else else
m_FieldHJustifyCtrl->SetSelection(1); m_FieldHJustifyCtrl->SetSelection(1);
if( field.m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
m_FieldVJustifyCtrl->SetSelection(0);
else if( field.m_VJustify == GR_TEXT_VJUSTIFY_TOP )
m_FieldVJustifyCtrl->SetSelection(2);
else
m_FieldVJustifyCtrl->SetSelection(1);
fieldNameTextCtrl->SetValue( field.m_Name ); fieldNameTextCtrl->SetValue( field.m_Name );
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable filed name editing // if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable filed name editing
...@@ -605,16 +612,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -605,16 +612,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
field.m_HJustify = hjustify[m_FieldHJustifyCtrl->GetSelection()]; field.m_HJustify = hjustify[m_FieldHJustifyCtrl->GetSelection()];
field.m_VJustify = vjustify[m_FieldVJustifyCtrl->GetSelection()]; field.m_VJustify = vjustify[m_FieldVJustifyCtrl->GetSelection()];
if( field.m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) /* Void fields texts for REFERENCE and VALUE (value is the name of the component in lib ! ) are not allowed
m_FieldVJustifyCtrl->SetSelection(0);
else if( field.m_VJustify == GR_TEXT_VJUSTIFY_TOP )
m_FieldVJustifyCtrl->SetSelection(2);
else
m_FieldVJustifyCtrl->SetSelection(1);
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
/* Void fields texts for REFERENCE and VALUE (value is the name of the compinent in lib ! ) are not allowed
* change them only for a new non void value * change them only for a new non void value
*/ */
if( !fieldValueTextCtrl->GetValue().IsEmpty() || fieldNdx > VALUE ) if( !fieldValueTextCtrl->GetValue().IsEmpty() || fieldNdx > VALUE )
......
...@@ -47,7 +47,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) ...@@ -47,7 +47,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
else if( (m_CurrentText->m_Flags & IS_NEW) == 0 ) else if( (m_CurrentText->m_Flags & IS_NEW) == 0 )
DisplayError( this, _( "Empty Text!" ) ); DisplayError( this, _( "Empty Text!" ) );
m_CurrentText->m_Orient = m_TextOrient->GetSelection(); m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue(); text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UnitMetric, text, m_Parent->m_InternalUnits ); value = ReturnValueFromString( g_UnitMetric, text, m_Parent->m_InternalUnits );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value; m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
...@@ -101,7 +101,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -101,7 +101,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
case TYPE_SCH_TEXT: case TYPE_SCH_TEXT:
ItemInitialPosition = TextStruct->m_Pos; ItemInitialPosition = TextStruct->m_Pos;
OldSize = TextStruct->m_Size; OldSize = TextStruct->m_Size;
OldOrient = TextStruct->m_Orient; OldOrient = TextStruct->GetSchematicTextOrientation();
break; break;
default: default:
...@@ -163,14 +163,16 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -163,14 +163,16 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
/* Rotation du texte */ /* Rotation du texte */
int orient;
switch( TextStruct->Type() ) switch( TextStruct->Type() )
{ {
case TYPE_SCH_LABEL: case TYPE_SCH_LABEL:
case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
case TYPE_SCH_TEXT: case TYPE_SCH_TEXT:
TextStruct->m_Orient++; orient = TextStruct->GetSchematicTextOrientation() + 1;
TextStruct->m_Orient &= 3; orient &= 3;
TextStruct->SetSchematicTextOrientation( orient );
break; break;
default: default:
...@@ -209,13 +211,13 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -209,13 +211,13 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur ); NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur ); NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
break; break;
default: default:
...@@ -238,7 +240,7 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -238,7 +240,7 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL ) if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL )
{ {
s_DefaultShapeGLabel = NewText->m_Shape; s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->m_Orient; s_DefaultOrientGLabel = NewText->GetSchematicTextOrientation();
} }
RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE );
...@@ -317,7 +319,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -317,7 +319,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
SCH_TEXT* Text = (SCH_TEXT*) Struct; SCH_TEXT* Text = (SCH_TEXT*) Struct;
Text->m_Pos = ItemInitialPosition; Text->m_Pos = ItemInitialPosition;
Text->m_Size = OldSize; Text->m_Size = OldSize;
Text->m_Orient = OldOrient; Text->SetSchematicTextOrientation( OldOrient );
} }
break; break;
...@@ -372,11 +374,9 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, ...@@ -372,11 +374,9 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text,
/* copy the old text settings */ /* copy the old text settings */
newtext->m_Shape = Text->m_Shape; newtext->m_Shape = Text->m_Shape;
newtext->m_Orient = Text->m_Orient; newtext->SetSchematicTextOrientation( Text->GetSchematicTextOrientation() );
newtext->m_Size = Text->m_Size; newtext->m_Size = Text->m_Size;
newtext->m_Width = Text->m_Width; newtext->m_Width = Text->m_Width;
newtext->m_HJustify = Text->m_HJustify;
newtext->m_VJustify = Text->m_VJustify;
newtext->m_IsDangling = Text->m_IsDangling; newtext->m_IsDangling = Text->m_IsDangling;
// save current text flag: // save current text flag:
......
...@@ -311,11 +311,10 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, ...@@ -311,11 +311,10 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
break; break;
} }
case TYPE_SCH_LABEL:
case TYPE_SCH_TEXT: case TYPE_SCH_TEXT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_TEXT*) DrawList ) #define STRUCT ( (SCH_TEXT*) DrawList )
if( !( SearchMask & (TEXTITEM | LABELITEM) ) ) if( !( SearchMask & TEXTITEM) )
break; break;
if( STRUCT->HitTest( aPosRef ) ) if( STRUCT->HitTest( aPosRef ) )
{ {
...@@ -325,21 +324,11 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, ...@@ -325,21 +324,11 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
break; break;
case TYPE_SCH_LABEL:
case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_GLOBALLABEL:
#undef STRUCT
#define STRUCT ( (SCH_GLOBALLABEL*) DrawList )
if( !(SearchMask & LABELITEM) )
break;
if( STRUCT->HitTest( aPosRef ) )
{
LastSnappedStruct = DrawList;
return TRUE;
}
break;
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_HIERLABEL*) DrawList ) #define STRUCT ( (SCH_TEXT*) DrawList ) // SCH_TEXT is the base class of these labels
if( !(SearchMask & LABELITEM) ) if( !(SearchMask & LABELITEM) )
break; break;
if( STRUCT->HitTest( aPosRef ) ) if( STRUCT->HitTest( aPosRef ) )
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "grfonte.h" #include "grfonte.h"
#include "base_struct.h" #include "base_struct.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "trigo.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
static void Plot_Hierarchical_PIN_Sheet( Hierarchical_PIN_Sheet_Struct* Struct ); static void Plot_Hierarchical_PIN_Sheet( Hierarchical_PIN_Sheet_Struct* Struct );
static void PlotTextField( SCH_COMPONENT* DrawLibItem, static void PlotTextField( SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode ); int FieldNumber, int IsMulti, int DrawMode );
static void PlotPinSymbol( const wxPoint & pos, int len, int orient, int Shape ); static void PlotPinSymbol( const wxPoint& pos, int len, int orient, int Shape );
/***/ /***/
...@@ -69,6 +70,7 @@ void SetCurrentLineWidth( int width ) ...@@ -69,6 +70,7 @@ void SetCurrentLineWidth( int width )
} }
} }
/*******************************************************************************/ /*******************************************************************************/
void PlotRect( wxPoint p1, wxPoint p2, int fill, int width ) void PlotRect( wxPoint p1, wxPoint p2, int fill, int width )
/*******************************************************************************/ /*******************************************************************************/
...@@ -85,6 +87,7 @@ void PlotRect( wxPoint p1, wxPoint p2, int fill, int width ) ...@@ -85,6 +87,7 @@ void PlotRect( wxPoint p1, wxPoint p2, int fill, int width )
} }
} }
/*****************************************************************************************/ /*****************************************************************************************/
void PlotArc( wxPoint aCentre, int aStAngle, int aEndAngle, int aRadius, bool aFill, int aWidth ) void PlotArc( wxPoint aCentre, int aStAngle, int aEndAngle, int aRadius, bool aFill, int aWidth )
/*****************************************************************************************/ /*****************************************************************************************/
...@@ -219,14 +222,19 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -219,14 +222,19 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
t1 = Arc->t1; t2 = Arc->t2; t1 = Arc->t1; t2 = Arc->t2;
pos = TransformCoordinate( TransMat, Arc->m_Pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, Arc->m_Pos ) + DrawLibItem->m_Pos;
MapAngles( &t1, &t2, TransMat ); MapAngles( &t1, &t2, TransMat );
if ( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
{ {
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
PlotArc( pos, t1, t2, Arc->m_Rayon, true, 0 ); PlotArc( pos, t1, t2, Arc->m_Rayon, true, 0 );
} }
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) ); SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Fill == FILLED_SHAPE ? true : false, Arc->m_Width ); PlotArc( pos,
t1,
t2,
Arc->m_Rayon,
Arc->m_Fill == FILLED_SHAPE ? true : false,
Arc->m_Width );
} }
break; break;
...@@ -234,14 +242,17 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -234,14 +242,17 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
{ {
LibDrawCircle* Circle = (LibDrawCircle*) DEntry; LibDrawCircle* Circle = (LibDrawCircle*) DEntry;
pos = TransformCoordinate( TransMat, Circle->m_Pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, Circle->m_Pos ) + DrawLibItem->m_Pos;
if ( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR )
{ {
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
PlotCercle( pos, Circle->m_Rayon * 2, true, 0 ); PlotCercle( pos, Circle->m_Rayon * 2, true, 0 );
} }
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) ); SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Fill == FILLED_SHAPE ? true : false, Circle->m_Width ); PlotCercle( pos,
Circle->m_Rayon * 2,
Circle->m_Fill == FILLED_SHAPE ? true : false,
Circle->m_Width );
} }
break; break;
...@@ -262,7 +273,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -262,7 +273,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
Text->m_Size, Text->m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, false, true); thickness, false, true );
} }
break; break;
...@@ -270,9 +281,10 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -270,9 +281,10 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
{ {
LibDrawSquare* Square = (LibDrawSquare*) DEntry; LibDrawSquare* Square = (LibDrawSquare*) DEntry;
pos = TransformCoordinate( TransMat, Square->m_Pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, Square->m_Pos ) + DrawLibItem->m_Pos;
wxPoint end = TransformCoordinate( TransMat, Square->m_End ) + DrawLibItem->m_Pos; wxPoint end =
TransformCoordinate( TransMat, Square->m_End ) + DrawLibItem->m_Pos;
if ( draw_bgfill && Square->m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( draw_bgfill && Square->m_Fill == FILLED_WITH_BG_BODYCOLOR )
{ {
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
PlotRect( pos, end, true, 0 ); PlotRect( pos, end, true, 0 );
...@@ -300,7 +312,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -300,7 +312,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
Pin->PlotPinTexts( pos, orient, Pin->PlotPinTexts( pos, orient,
Entry->m_TextInside, Entry->m_TextInside,
Entry->m_DrawPinNum, Entry->m_DrawPinName, Entry->m_DrawPinNum, Entry->m_DrawPinName,
thickness, false); thickness, false );
} }
break; break;
...@@ -308,7 +320,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -308,7 +320,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
{ {
LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry; LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->GetCornerCount() ); Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->GetCornerCount() );
for( ii = 0; ii < (int)polyline->GetCornerCount(); ii++ ) for( ii = 0; ii < (int) polyline->GetCornerCount(); ii++ )
{ {
pos = polyline->m_PolyPoints[ii]; pos = polyline->m_PolyPoints[ii];
pos = TransformCoordinate( TransMat, pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, pos ) + DrawLibItem->m_Pos;
...@@ -316,7 +328,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -316,7 +328,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
Poly[ii * 2 + 1] = pos.y; Poly[ii * 2 + 1] = pos.y;
} }
if ( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR )
{ {
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
PlotPoly( ii, Poly, true, 0 ); PlotPoly( ii, Poly, true, 0 );
...@@ -329,7 +341,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -329,7 +341,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
break; break;
default: default:
D(printf("Drawing Type=%d\n", DEntry->Type() )) ; D( printf( "Drawing Type=%d\n", DEntry->Type() ) );
} }
/* Fin Switch */ /* Fin Switch */
...@@ -412,57 +424,69 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem, ...@@ -412,57 +424,69 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
vjustify = (GRTextVertJustifyType) tmp; vjustify = (GRTextVertJustifyType) tmp;
if( DrawLibItem->m_Transform[1][0] < 0 ) if( DrawLibItem->m_Transform[1][0] < 0 )
switch ( vjustify ) switch( vjustify )
{ {
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
vjustify = GR_TEXT_VJUSTIFY_TOP; vjustify = GR_TEXT_VJUSTIFY_TOP;
break; break;
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
vjustify = GR_TEXT_VJUSTIFY_BOTTOM; vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
break; break;
default: default:
break; break;
} }
if( DrawLibItem->m_Transform[1][0] > 0 ) if( DrawLibItem->m_Transform[1][0] > 0 )
switch ( hjustify ) switch( hjustify )
{ {
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_LEFT:
hjustify = GR_TEXT_HJUSTIFY_RIGHT; hjustify = GR_TEXT_HJUSTIFY_RIGHT;
break; break;
case GR_TEXT_HJUSTIFY_RIGHT: case GR_TEXT_HJUSTIFY_RIGHT:
hjustify = GR_TEXT_HJUSTIFY_LEFT; hjustify = GR_TEXT_HJUSTIFY_LEFT;
break; break;
default: default:
break; break;
} }
} }
else else
{ {
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/ /* Texte horizontal: Y a t-il miroir (pour les justifications)*/
if( DrawLibItem->m_Transform[0][0] < 0 ) if( DrawLibItem->m_Transform[0][0] < 0 )
switch ( hjustify ) switch( hjustify )
{ {
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_LEFT:
hjustify = GR_TEXT_HJUSTIFY_RIGHT; hjustify = GR_TEXT_HJUSTIFY_RIGHT;
break; break;
case GR_TEXT_HJUSTIFY_RIGHT: case GR_TEXT_HJUSTIFY_RIGHT:
hjustify = GR_TEXT_HJUSTIFY_LEFT; hjustify = GR_TEXT_HJUSTIFY_LEFT;
break; break;
default: default:
break; break;
} }
if( DrawLibItem->m_Transform[1][1] > 0 ) if( DrawLibItem->m_Transform[1][1] > 0 )
switch ( vjustify ) switch( vjustify )
{ {
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
vjustify = GR_TEXT_VJUSTIFY_TOP; vjustify = GR_TEXT_VJUSTIFY_TOP;
break; break;
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
vjustify = GR_TEXT_VJUSTIFY_BOTTOM; vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
break; break;
default: default:
break; break;
} }
} }
int thickness = field->m_Width; int thickness = field->m_Width;
...@@ -476,7 +500,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem, ...@@ -476,7 +500,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
field->m_Size, field->m_Size,
hjustify, vjustify, hjustify, vjustify,
thickness, field->m_Italic, true); thickness, field->m_Italic, true );
} }
else /* We plt the reference, for a multiple parts per package */ else /* We plt the reference, for a multiple parts per package */
{ {
...@@ -500,7 +524,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem, ...@@ -500,7 +524,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
/**************************************************************************/ /**************************************************************************/
static void PlotPinSymbol( const wxPoint & pos, int len, int orient, int Shape ) static void PlotPinSymbol( const wxPoint& pos, int len, int orient, int Shape )
/**************************************************************************/ /**************************************************************************/
/* Trace la pin du symbole en cours de trace /* Trace la pin du symbole en cours de trace
...@@ -540,7 +564,7 @@ static void PlotPinSymbol( const wxPoint & pos, int len, int orient, int Shape ) ...@@ -540,7 +564,7 @@ static void PlotPinSymbol( const wxPoint & pos, int len, int orient, int Shape )
if( Shape & INVERT ) if( Shape & INVERT )
{ {
PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1, PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
MapY1 * INVERT_PIN_RADIUS + y1), MapY1 * INVERT_PIN_RADIUS + y1 ),
INVERT_PIN_RADIUS * 2, // diameter INVERT_PIN_RADIUS * 2, // diameter
false, // fill false, // fill
-1 ); // width -1 ); // width
...@@ -617,13 +641,6 @@ void PlotTextStruct( EDA_BaseStruct* Struct ) ...@@ -617,13 +641,6 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
*/ */
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
int pX, pY, Shape = 0, Orient = 0, offset;
wxSize Size;
wxString Text;
EDA_Colors color = UNSPECIFIED_COLOR;
bool italic = false;
int thickness = 0;
switch( Struct->Type() ) switch( Struct->Type() )
{ {
...@@ -631,117 +648,60 @@ void PlotTextStruct( EDA_BaseStruct* Struct ) ...@@ -631,117 +648,60 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
case TYPE_SCH_LABEL: case TYPE_SCH_LABEL:
case TYPE_SCH_TEXT: 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;
pY = ( (SCH_TEXT*) Struct )->m_Pos.y;
offset = TXTMARGE;
if( Struct->Type() == TYPE_SCH_GLOBALLABEL
|| Struct->Type() == TYPE_SCH_HIERLABEL )
offset += Size.x; // We must draw the Glabel graphic symbol
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor( ( (SCH_TEXT*) Struct )->m_Layer );
break; break;
default: default:
return; return;
} }
if( Size.x == 0 ) SCH_TEXT* schText = (SCH_TEXT*) Struct;
Size = wxSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT ); EDA_Colors color = UNSPECIFIED_COLOR;
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor( schText->m_Layer );
wxPoint textpos = schText->m_Pos + schText->GetSchematicTextOffset();
int thickness = schText->m_Width;
if( thickness == 0 )
thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth );
if ( Struct->Type() == TYPE_SCH_GLOBALLABEL ) SetCurrentLineWidth( thickness );
{
offset = ( (SCH_GLOBALLABEL*) Struct )->m_Width; if( schText->m_MultilineAllowed )
switch( Shape )
{ {
case NET_INPUT: wxPoint pos = textpos;
case NET_BIDI: wxArrayString* list = wxStringSplit( schText->m_Text, '\n' );
case NET_TRISTATE: wxPoint offset;
offset += Size.x/2;
break;
case NET_OUTPUT: offset.y = schText->GetInterline();
offset += TXTMARGE;
break;
default: RotatePoint( &offset, schText->m_Orient );
break; for( unsigned i = 0; i<list->Count(); i++ )
} {
wxString txt = list->Item( i );
PlotGraphicText( g_PlotFormat, pos,
color, txt, schText->m_Orient, schText->m_Size,
schText->m_HJustify, schText->m_VJustify,
thickness, schText->m_Italic, true );
pos += offset;
} }
if( thickness == 0 ) delete (list);
thickness = MAX( g_PlotLine_Width, g_DrawMinimunLineWidth ); }
SetCurrentLineWidth( thickness );
switch( Orient )
{
case 0: /* Orientation horiz normale */
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,
thickness, italic, true );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, true );
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,
thickness, italic, true );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, true );
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,
thickness, italic, true );
else else
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ), PlotGraphicText( g_PlotFormat, textpos,
color, Text, TEXT_ORIENT_HORIZ, Size, color, schText->m_Text, schText->m_Orient, schText->m_Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, schText->m_HJustify, schText->m_VJustify,
thickness, italic, true ); thickness, schText->m_Italic, true );
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,
thickness, italic, true );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic, true );
break;
}
/* Draw graphic symbol for global or hierachical labels */ /* Draw graphic symbol for global or hierachical labels */
if( Struct->Type() == TYPE_SCH_GLOBALLABEL ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL )
{ {
( (SCH_GLOBALLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) ); ( (SCH_GLOBALLABEL*) Struct )->CreateGraphicShape( Poly, schText->m_Pos );
PlotPoly( Poly.size(), &Poly[0].x, NOFILL ); PlotPoly( Poly.size(), &Poly[0].x, NOFILL );
} }
if( Struct->Type() == TYPE_SCH_HIERLABEL ) if( Struct->Type() == TYPE_SCH_HIERLABEL )
{ {
( (SCH_HIERLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) ); ( (SCH_HIERLABEL*) Struct )->CreateGraphicShape( Poly, schText->m_Pos );
PlotPoly( Poly.size(), &Poly[0].x, NOFILL ); PlotPoly( Poly.size(), &Poly[0].x, NOFILL );
} }
} }
...@@ -750,11 +710,13 @@ void PlotTextStruct( EDA_BaseStruct* Struct ) ...@@ -750,11 +710,13 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
/*****************************************************************************************/ /*****************************************************************************************/
static void Plot_Hierarchical_PIN_Sheet( Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN ) static void Plot_Hierarchical_PIN_Sheet( Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN )
/****************************************************************************************/ /****************************************************************************************/
/* Plot a Hierarchical_PIN_Sheet /* Plot a Hierarchical_PIN_Sheet
*/ */
{ {
EDA_Colors txtcolor = UNSPECIFIED_COLOR; EDA_Colors txtcolor = UNSPECIFIED_COLOR;
int posx, tposx, posy, size; int posx, tposx, posy, size;
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
......
...@@ -75,7 +75,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile, ...@@ -75,7 +75,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
new SCH_LABEL( pos, CONV_FROM_UTF8( text ) ); new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->SetSchematicTextOrientation( orient );
if( isdigit( Name3[0] ) ) if( isdigit( Name3[0] ) )
{ {
thickness = atol( Name3 ); thickness = atol( Name3 );
...@@ -92,7 +92,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile, ...@@ -92,7 +92,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
Struct = TextStruct; Struct = TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->SetSchematicTextOrientation( orient );
TextStruct->m_Shape = NET_INPUT; TextStruct->m_Shape = NET_INPUT;
TextStruct->m_Width = thickness; TextStruct->m_Width = thickness;
...@@ -115,7 +115,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile, ...@@ -115,7 +115,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
Struct = TextStruct; Struct = TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->SetSchematicTextOrientation( orient );
TextStruct->m_Shape = NET_INPUT; TextStruct->m_Shape = NET_INPUT;
TextStruct->m_Width = thickness; TextStruct->m_Width = thickness;
...@@ -145,7 +145,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile, ...@@ -145,7 +145,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
SCH_TEXT* TextStruct = new SCH_TEXT( pos, val ); SCH_TEXT* TextStruct = new SCH_TEXT( pos, val );
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->SetSchematicTextOrientation( orient );
if( isdigit( Name3[0] ) ) if( isdigit( Name3[0] ) )
{ {
thickness = atol( Name3 ); thickness = atol( Name3 );
......
...@@ -353,7 +353,7 @@ static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot ) ...@@ -353,7 +353,7 @@ static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot )
pt_texte->m_Text, pt_texte->m_Text,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic ); thickness, pt_texte->m_Italic, true );
} }
...@@ -620,11 +620,34 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer ) ...@@ -620,11 +620,34 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
break; break;
} }
if( pt_texte->m_MultilineAllowed )
{
wxArrayString* list = wxStringSplit( pt_texte->m_Text, '\n' );
wxPoint offset;
offset.y = pt_texte->GetInterline();
RotatePoint( &offset, orient );
for( unsigned i = 0; i<list->Count(); i++ )
{
wxString txt = list->Item( i );
PlotGraphicText( format_plot, pos, BLACK,
txt,
orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic, true );
pos += offset;
}
delete (list);
}
else
PlotGraphicText( format_plot, pos, BLACK, PlotGraphicText( format_plot, pos, BLACK,
pt_texte->m_Text, pt_texte->m_Text,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic ); thickness, pt_texte->m_Italic, true );
} }
......
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