Commit 2aa1a26b authored by dickelbeck's avatar dickelbeck

beautification

parent 461d75de
...@@ -342,6 +342,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -342,6 +342,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( m_TextDrawings == NULL ) /* pointeur sur la liste des segments de dessin */ if( m_TextDrawings == NULL ) /* pointeur sur la liste des segments de dessin */
CreateDrawData(); CreateDrawData();
if( m_TextDrawings == NULL ) if( m_TextDrawings == NULL )
return; return;
...@@ -349,6 +350,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -349,6 +350,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
width = m_Width / zoom; width = m_Width / zoom;
if( display_mode == FILAIRE ) if( display_mode == FILAIRE )
width = 0; width = 0;
/* choix de la couleur du texte : */ /* choix de la couleur du texte : */
if( draw_mode != -1 ) if( draw_mode != -1 )
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
...@@ -370,12 +372,15 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -370,12 +372,15 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
int anchor_size = 2 * zoom; int anchor_size = 2 * zoom;
anchor_color &= MASKCOLOR; anchor_color &= MASKCOLOR;
/* calcul de la position du texte */ /* calcul de la position du texte */
int cX = m_Pos.x - offset.x; int cX = m_Pos.x - offset.x;
int cY = m_Pos.y - offset.y; int cY = m_Pos.y - offset.y;
/* trace ancre du texte */ /* trace ancre du texte */
GRLine( &panel->m_ClipBox, DC, cX - anchor_size, cY, GRLine( &panel->m_ClipBox, DC, cX - anchor_size, cY,
cX + anchor_size, cY, 0, anchor_color ); cX + anchor_size, cY, 0, anchor_color );
GRLine( &panel->m_ClipBox, DC, cX, cY - anchor_size, GRLine( &panel->m_ClipBox, DC, cX, cY - anchor_size,
cX, cY + anchor_size, 0, anchor_color ); cX, cY + anchor_size, 0, anchor_color );
} }
...@@ -385,15 +390,14 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -385,15 +390,14 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
nbpoints = m_TextDrawings[jj]; nbpoints = m_TextDrawings[jj];
if( nbpoints > 50 ) if( nbpoints > 50 )
nbpoints = 50; nbpoints = 50;
for( kk = 0, ll = 0; (kk < nbpoints) && (ii < m_TextDrawingsSize); kk++ ) for( kk = 0, ll = 0; (kk < nbpoints) && (ii < m_TextDrawingsSize); kk++ )
{ {
coord[ll] = m_TextDrawings[ii] + offset.x + m_Pos.x; coord[ll++] = m_TextDrawings[ii++] + offset.x + m_Pos.x;
ll++; ii++; coord[ll++] = m_TextDrawings[ii++] + offset.y + m_Pos.y;
coord[ll] = m_TextDrawings[ii] + offset.y + m_Pos.y;
ll++; ii++;
} }
jj = ii; ii++; jj = ii++;
if( width > 2 ) if( width > 2 )
{ {
...@@ -544,8 +548,13 @@ void EDA_TextStruct::CreateDrawData() ...@@ -544,8 +548,13 @@ void EDA_TextStruct::CreateDrawData()
m_ZoomLevelDrawable = m_Size.x / 3; m_ZoomLevelDrawable = m_Size.x / 3;
dx = (espacement * nbchar) / 2; dx = (espacement * nbchar) / 2;
dy = size_v / 2; /* Decalage du debut du texte / centre */ dy = size_v / 2; /* Decalage du debut du texte / centre */
ux0 = cX - dx; uy0 = cY;
dx += cX; dy = cY; ux0 = cX - dx;
uy0 = cY;
dx += cX;
dy = cY;
RotatePoint( &ux0, &uy0, cX, cY, m_Orient ); RotatePoint( &ux0, &uy0, cX, cY, m_Orient );
RotatePoint( &dx, &dy, cX, cY, m_Orient ); RotatePoint( &dx, &dy, cX, cY, m_Orient );
...@@ -582,9 +591,10 @@ void EDA_TextStruct::CreateDrawData() ...@@ -582,9 +591,10 @@ void EDA_TextStruct::CreateDrawData()
coord = (int*) realloc( coord, coord_count_max * sizeof(int) ); coord = (int*) realloc( coord, coord_count_max * sizeof(int) );
} }
coord[jj] = nbpoints; coord[jj] = nbpoints;
jj = ii; ii++; jj = ii++;
} }
plume = f_cod; nbpoints = 0; plume = f_cod;
nbpoints = 0;
break; break;
case 'D': case 'D':
...@@ -600,14 +610,20 @@ void EDA_TextStruct::CreateDrawData() ...@@ -600,14 +610,20 @@ void EDA_TextStruct::CreateDrawData()
f_cod = *ptcar; f_cod = *ptcar;
k2 = f_cod; /* trace sur axe H */ k2 = f_cod; /* trace sur axe H */
k2 = (k2 * size_h) / 9; k2 = (k2 * size_h) / 9;
dx = k2 + ox; dy = k1 + oy;
dx = k2 + ox;
dy = k1 + oy;
RotatePoint( &dx, &dy, cX, cY, m_Orient ); RotatePoint( &dx, &dy, cX, cY, m_Orient );
if( ii >= coord_count_max ) if( ii >= coord_count_max )
{ {
coord_count_max *= 2; coord_count_max *= 2;
coord = (int*) realloc( coord, coord_count_max * sizeof(int) ); coord = (int*) realloc( coord, coord_count_max * sizeof(int) );
} }
coord[ii] = dx; ii++; coord[ii] = dy; ii++;
coord[ii++] = dx;
coord[ii++] = dy;
nbpoints++; nbpoints++;
break; break;
} }
...@@ -618,7 +634,8 @@ void EDA_TextStruct::CreateDrawData() ...@@ -618,7 +634,8 @@ void EDA_TextStruct::CreateDrawData()
/* end boucle for = end trace de 1 caractere */ /* end boucle for = end trace de 1 caractere */
ptr++; ox += espacement; ptr++;
ox += espacement;
} }
/* end trace du texte */ /* end trace du texte */
...@@ -661,13 +678,16 @@ bool EDA_Rect::Inside( const wxPoint& point ) ...@@ -661,13 +678,16 @@ bool EDA_Rect::Inside( const wxPoint& point )
if( size.x < 0 ) if( size.x < 0 )
{ {
size.x = -size.x; rel_posx += size.x; size.x = -size.x;
rel_posx += size.x;
} }
if( size.y < 0 ) if( size.y < 0 )
{ {
size.y = -size.y; rel_posy += size.y; size.y = -size.y;
rel_posy += size.y;
} }
return (rel_posx >= 0) && (rel_posy >= 0) return (rel_posx >= 0) && (rel_posy >= 0)
&& ( rel_posy <= size.y) && ( rel_posy <= size.y)
&& ( rel_posx <= size.x) && ( rel_posx <= size.x)
......
/*************************************************/ /*************************************************/
/* drawtxt.cpp : Function to draw and plot texts */ /* drawtxt.cpp : Function to draw and plot texts */
/*************************************************/ /*************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -22,391 +22,454 @@ ...@@ -22,391 +22,454 @@
/****************************************************************************/ /****************************************************************************/
void DrawGraphicText(WinEDA_DrawPanel * panel, wxDC * DC, void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint & Pos, int gcolor, const wxString & Text, const wxPoint& Pos, int gcolor, const wxString& Text,
int orient, const wxSize & Size, int h_justify, int v_justify, int width) int orient, const wxSize& Size, int h_justify, int v_justify, int width )
/*****************************************************************************/ /*****************************************************************************/
/* Draw a graphic text (like module texts) /* Draw a graphic text (like module texts)
Text = text to draw * Text = text to draw
Pos = text position (according to h_justify, v_justify) * Pos = text position (according to h_justify, v_justify)
Size = text size (size.x or size.y can be < 0 for mirrored texts) * Size = text size (size.x or size.y can be < 0 for mirrored texts)
orient = angle in 0.1 degree * orient = angle in 0.1 degree
mode_color = GR_OR, GR_XOR.. * mode_color = GR_OR, GR_XOR..
h_justify = horizontal justification (Left, center, right) * h_justify = horizontal justification (Left, center, right)
v_justify = vertical justification (bottom, center, top) * v_justify = vertical justification (bottom, center, top)
width = line width (pen width) (default = 0) * width = line width (pen width) (default = 0)
if width < 0 : draw segments in sketch mode, width = abs(width) * if width < 0 : draw segments in sketch mode, width = abs(width)
*/ */
{ {
int ii, kk,nbchar, AsciiCode, endcar; int ii, kk, nbchar, AsciiCode, endcar;
int k1 , k2, x0, y0; int k1, k2, x0, y0;
int zoom; int zoom;
int size_h , size_v , espacement ; int size_h, size_v, espacement;
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 ux0, uy0, dx, dy; // Draw coordinate for segments to draw. also used in some other calculation
int cX, cY; // Texte center int cX, cY; // Texte center
int ox, oy; // Draw coordinates for the current char int ox, oy; // Draw coordinates for the current char
int coord[100]; // Buffer coordinate used to draw polylines (char shapes) int coord[100]; // Buffer coordinate used to draw polylines (char shapes)
bool sketch_mode = FALSE; bool sketch_mode = FALSE;
zoom = panel->GetZoom(); zoom = panel->GetZoom();
size_h = Size.x; size_h = Size.x;
size_v = Size.y; size_v = Size.y;
if ( width < 0 ) if( width < 0 )
{ {
width = - width; width = -width;
sketch_mode = TRUE; sketch_mode = TRUE;
} }
kk = 0 ; ptr = 0; /* ptr = text index */ kk = 0;
ptr = 0; /* ptr = text index */
nbchar = Text.Len();
if ( nbchar == 0 ) return; nbchar = Text.Len();
if( nbchar == 0 )
espacement = (10 * size_h ) / 9; // this is the pitch between chars return;
ox = cX = Pos.x; oy = cY = Pos.y;
espacement = (10 * size_h ) / 9; // this is the pitch between chars
/* Do not draw the text if out of draw area! */ ox = cX = Pos.x;
if ( panel ) oy = cY = Pos.y;
{
int xm, ym, ll, xc, yc; /* Do not draw the text if out of draw area! */
int textsize = ABS(espacement); if( panel )
ll = (textsize * nbchar) / zoom; {
xc = GRMapX(cX); int xm, ym, ll, xc, yc;
yc = GRMapY(cY); int textsize = ABS( espacement );
x0 = panel->m_ClipBox.GetX() - ll; ll = (textsize * nbchar) / zoom;
y0 = panel->m_ClipBox.GetY() -ll ;
xm = panel->m_ClipBox.GetRight() + ll; xc = GRMapX( cX );
ym = panel->m_ClipBox.GetBottom() + ll; yc = GRMapY( cY );
if ( xc < x0 ) return;
if ( yc < y0 ) return; x0 = panel->m_ClipBox.GetX() - ll;
if ( xc > xm ) return; y0 = panel->m_ClipBox.GetY() - ll;
if ( yc > ym ) return; xm = panel->m_ClipBox.GetRight() + ll;
} ym = panel->m_ClipBox.GetBottom() + ll;
if( xc < x0 )
/* Compute the position ux0, uy0 of the first letter , next */ return;
dx = (espacement * nbchar) / 2; if( yc < y0 )
dy = size_v / 2; /* dx, dy = draw offset between first letter and text center */ return;
if( xc > xm )
ux0 = uy0 = 0; /* Decalage du centre du texte / coord de ref */ return;
if( yc > ym )
if( (orient == 0) || (orient == 1800) ) /* Horizontal Text */ return;
{ }
switch(h_justify)
{
case GR_TEXT_HJUSTIFY_CENTER: /* Compute the position ux0, uy0 of the first letter , next */
break; dx = (espacement * nbchar) / 2;
dy = size_v / 2; /* dx, dy = draw offset between first letter and text center */
case GR_TEXT_HJUSTIFY_RIGHT:
ux0 = - dx; ux0 = uy0 = 0; /* Decalage du centre du texte / coord de ref */
break;
if( (orient == 0) || (orient == 1800) ) /* Horizontal Text */
case GR_TEXT_HJUSTIFY_LEFT: {
ux0 = dx; switch( h_justify )
break; {
} case GR_TEXT_HJUSTIFY_CENTER:
break;
switch(v_justify)
{ case GR_TEXT_HJUSTIFY_RIGHT:
case GR_TEXT_VJUSTIFY_CENTER: ux0 = -dx;
break; break;
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_HJUSTIFY_LEFT:
uy0 = dy; ux0 = dx;
break; break;
}
case GR_TEXT_VJUSTIFY_BOTTOM:
uy0 = -dy; switch( v_justify )
break; {
} case GR_TEXT_VJUSTIFY_CENTER:
} break;
else /* Vertical Text */ case GR_TEXT_VJUSTIFY_TOP:
{ uy0 = dy;
switch(h_justify) break;
{
case GR_TEXT_HJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_BOTTOM:
break; uy0 = -dy;
break;
case GR_TEXT_HJUSTIFY_RIGHT: }
ux0 = - dy; }
break; else /* Vertical Text */
{
case GR_TEXT_HJUSTIFY_LEFT: switch( h_justify )
ux0 = dy; {
break; case GR_TEXT_HJUSTIFY_CENTER:
} break;
switch(v_justify) case GR_TEXT_HJUSTIFY_RIGHT:
{ ux0 = -dy;
case GR_TEXT_VJUSTIFY_CENTER: break;
break;
case GR_TEXT_HJUSTIFY_LEFT:
case GR_TEXT_VJUSTIFY_TOP: ux0 = dy;
uy0 = dx; break;
break; }
case GR_TEXT_VJUSTIFY_BOTTOM: switch( v_justify )
uy0 = -dx; {
break; case GR_TEXT_VJUSTIFY_CENTER:
} break;
}
cX += ux0; cY += uy0; case GR_TEXT_VJUSTIFY_TOP:
ox = cX - dx; ; oy = cY + dy; uy0 = dx;
break;
if( (Size.x/zoom) == 0 ) return;
case GR_TEXT_VJUSTIFY_BOTTOM:
if( ABS((Size.x/zoom)) < 3) /* chars trop petits pour etre dessines */ uy0 = -dx;
{ /* le texte est symbolise par une barre */ break;
dx = (espacement * nbchar) / 2; }
dy = size_v / 2; /* Decalage du debut du texte / centre */ }
ux0 = cX - dx; uy0 = cY; cX += ux0;
dx += cX; dy = cY; cY += uy0;
RotatePoint(&ux0, &uy0, cX, cY, orient);
RotatePoint(&dx, &dy, cX, cY, orient); ox = cX - dx;
GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, width, gcolor); oy = cY + dy;
return; if( (Size.x / zoom) == 0 )
} return;
if( ABS( (Size.x / zoom) ) < 3 ) /* chars trop petits pour etre dessines */
{ /* le texte est symbolise par une barre */
dx = (espacement * nbchar) / 2;
dy = size_v / 2; /* Decalage du debut du texte / centre */
ux0 = cX - dx;
uy0 = cY;
dx += cX;
dy = cY;
RotatePoint( &ux0, &uy0, cX, cY, orient );
RotatePoint( &dx, &dy, cX, cY, orient );
GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, width, gcolor );
return;
}
#if 0 #if 0
dx = (espacement * nbchar) / 2; dx = (espacement * nbchar) / 2;
dy = size_v / 2; /* Decalage du debut du texte / centre */ dy = size_v / 2;/* Decalage du debut du texte / centre */
ux0 = cX - dx; uy0 = cY;
dx += cX; dy = cY; ux0 = cX - dx;
RotatePoint(&ux0, &uy0, cX, cY, orient); uy0 = cY;
RotatePoint(&dx, &dy, cX, cY, orient);
DC->SetTextForeground( wxColour( dx += cX;
ColorRefs[gcolor].r, dy = cY;
ColorRefs[gcolor].g,
ColorRefs[gcolor].b) ); RotatePoint( &ux0, &uy0, cX, cY, orient );
DC->DrawRotatedText(Text, GRMapX(ux0), GRMapY(uy0), (double) orient / 10.0); RotatePoint( &dx, &dy, cX, cY, orient );
return;
DC->SetTextForeground( wxColour(
ColorRefs[gcolor].r,
ColorRefs[gcolor].g,
ColorRefs[gcolor].b ) );
DC->DrawRotatedText( Text, GRMapX( ux0 ), GRMapY( uy0 ), (double) orient / 10.0 );
return;
#endif #endif
while(kk++ < nbchar) while( kk++ < nbchar )
{ {
x0 = 0 ; y0 = 0 ; x0 = 0; y0 = 0;
AsciiCode = Text.GetChar(ptr) & 255; AsciiCode = Text.GetChar( ptr ) & 255;
ptcar = graphic_fonte_shape[AsciiCode] ; /* ptcar pointe la description ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description
du caractere a dessiner */ * du caractere a dessiner */
for(ii = 0, endcar = FALSE; ! endcar; ptcar++) for( ii = 0, endcar = FALSE; !endcar; ptcar++ )
{ {
f_cod = *ptcar ; /* get code n de la forme selectionnee */ f_cod = *ptcar;
switch(f_cod)
{ /* get code n de la forme selectionnee */
case 'X' : switch( f_cod )
endcar = TRUE;/* fin du caractere */ {
break; case 'X':
endcar = TRUE; /* fin du caractere */
case 'U' : break;
if(ii && (plume == 'D' ) )
{ case 'U':
if ( width <= 1 ) if( ii && (plume == 'D' ) )
GRPoly(&panel->m_ClipBox, DC, ii /2, coord, 0, 0, {
gcolor, gcolor); if( width <= 1 )
else if ( sketch_mode ) GRPoly( &panel->m_ClipBox, DC, ii / 2, coord, 0, 0,
{ gcolor, gcolor );
int ik, * coordptr; else if( sketch_mode )
coordptr = coord; {
for ( ik = 0; ik < (ii-2); ik += 2, coordptr+= 2) int ik, * coordptr;
GRCSegm(&panel->m_ClipBox, DC, *coordptr, *(coordptr+1), coordptr = coord;
*(coordptr+2), *(coordptr+3), width, gcolor) ; for( ik = 0; ik < (ii - 2); ik += 2, coordptr += 2 )
} GRCSegm( &panel->m_ClipBox, DC, *coordptr, *(coordptr + 1),
*(coordptr + 2), *(coordptr + 3), width, gcolor );
else }
GRPoly(&panel->m_ClipBox, DC, ii /2, coord, 0, else
width, gcolor, gcolor); GRPoly( &panel->m_ClipBox, DC, ii / 2, coord, 0,
} width, gcolor, gcolor );
plume = f_cod; ii = 0; }
break; plume = f_cod; ii = 0;
break;
case 'D' : plume = f_cod ; break ;
case 'D':
default : plume = f_cod;
{ break;
k1 = f_cod; /* trace sur axe V */
k1 = - ((k1 * size_v) / 9) ; default:
ptcar++ ; {
f_cod = *ptcar ; k1 = f_cod; /* trace sur axe V */
k2 = f_cod; /* trace sur axe H */ k1 = -( (k1 * size_v) / 9 );
k2 = (k2 * size_h) / 9 ;
dx = k2 + ox; dy = k1 + oy; ptcar++;
RotatePoint(&dx, &dy, cX, cY, orient); f_cod = *ptcar;
coord[ii] = dx; ii++; coord[ii] = dy; ii++;
break ; k2 = f_cod; /* trace sur axe H */
} k2 = (k2 * size_h) / 9;
} /* end switch */ dx = k2 + ox; dy = k1 + oy;
} /* end boucle for = end trace de 1 caractere */
RotatePoint( &dx, &dy, cX, cY, orient );
ptr++; ox += espacement; coord[ii++] = dx;
} /* end trace du texte */ coord[ii++] = dy;
break;
}
}
/* end switch */
}
/* end boucle for = end trace de 1 caractere */
ptr++; ox += espacement;
}
/* end trace du texte */
} }
/******************************************************************************************/ /******************************************************************************************/
void PlotGraphicText(int format_plot, const wxPoint & Pos, int gcolor, void PlotGraphicText( int format_plot, const wxPoint& Pos, int gcolor,
const wxString & Text, const wxString& Text,
int orient, const wxSize & Size, int h_justify, int v_justify) int orient, const wxSize& Size, int h_justify, int v_justify )
/******************************************************************************************/ /******************************************************************************************/
/* /*
id DrawGraphicText, for plot graphic text * id DrawGraphicText, for plot graphic text
*/ */
{ {
int kk, nbchar, end, AsciiCode; int kk, nbchar, end, AsciiCode;
int k1 , k2 , x0 , y0, ox, oy ; int k1, k2, x0, y0, ox, oy;
int size_h , size_v , espacement ; int size_h, size_v, espacement;
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; // Coord de trace des segments de texte & variables de calcul */ int ux0, uy0, dx, dy; // Coord de trace des segments de texte & variables de calcul */
int cX, cY; // Centre du texte int cX, cY; // Centre du texte
void (*FctPlume)(wxPoint pos, int state);
void (*FctPlume)( wxPoint pos, int state );
switch ( format_plot)
{ switch( format_plot )
case PLOT_FORMAT_POST: {
FctPlume = LineTo_PS; case PLOT_FORMAT_POST:
break; FctPlume = LineTo_PS;
break;
case PLOT_FORMAT_HPGL:
FctPlume = Move_Plume_HPGL; case PLOT_FORMAT_HPGL:
break; FctPlume = Move_Plume_HPGL;
break;
case PLOT_FORMAT_GERBER:
default: case PLOT_FORMAT_GERBER:
return; default:
} return;
}
if ( (gcolor >= 0) && (format_plot == PLOT_FORMAT_POST) )
SetColorMapPS ( gcolor ); if( (gcolor >= 0) && (format_plot == PLOT_FORMAT_POST) )
SetColorMapPS( gcolor );
size_h = Size.x;
size_v = Size.y; size_h = Size.x;
if(size_h == 0) size_h = DEFAULT_SIZE_TEXT; size_v = Size.y;
if(size_v == 0) size_v = DEFAULT_SIZE_TEXT; if( size_h == 0 )
size_h = DEFAULT_SIZE_TEXT;
kk = 0 ; ptr = 0; /* ptr = text index */ if( size_v == 0 )
size_v = DEFAULT_SIZE_TEXT;
/* calcul de la position du debut des textes: ox et oy */
nbchar = Text.Len(); kk = 0;
ptr = 0; /* ptr = text index */
espacement = (10 * size_h ) / 9;
ox = cX = Pos.x; oy = cY = Pos.y; /* calcul de la position du debut des textes: ox et oy */
nbchar = Text.Len();
/* Calcul du cadrage du texte */
dx = (espacement * nbchar) / 2; espacement = (10 * size_h ) / 9;
dy = size_v / 2; /* Decalage du debut du texte / centre */ ox = cX = Pos.x;
oy = cY = Pos.y;
ux0 = uy0 = 0; /* Decalage du centre du texte / ccord de ref */
/* Calcul du cadrage du texte */
if( (orient == 0) || (orient == 1800) ) /* Texte Horizontal */ dx = (espacement * nbchar) / 2;
{ dy = size_v / 2; /* Decalage du debut du texte / centre */
switch(h_justify)
{ ux0 = uy0 = 0; /* Decalage du centre du texte / ccord de ref */
case GR_TEXT_HJUSTIFY_CENTER:
break; if( (orient == 0) || (orient == 1800) ) /* Texte Horizontal */
{
case GR_TEXT_HJUSTIFY_RIGHT: switch( h_justify )
ux0 = - dx; {
break; case GR_TEXT_HJUSTIFY_CENTER:
break;
case GR_TEXT_HJUSTIFY_LEFT:
ux0 = dx; case GR_TEXT_HJUSTIFY_RIGHT:
break; ux0 = -dx;
} break;
switch(v_justify) case GR_TEXT_HJUSTIFY_LEFT:
{ ux0 = dx;
case GR_TEXT_VJUSTIFY_CENTER: break;
break; }
case GR_TEXT_VJUSTIFY_TOP: switch( v_justify )
uy0 = dy; {
break; case GR_TEXT_VJUSTIFY_CENTER:
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
uy0 = -dy; case GR_TEXT_VJUSTIFY_TOP:
break; uy0 = dy;
} break;
}
case GR_TEXT_VJUSTIFY_BOTTOM:
else /* Texte Vertical */ uy0 = -dy;
{ break;
switch(h_justify) }
{ }
case GR_TEXT_HJUSTIFY_CENTER: else /* Texte Vertical */
break; {
switch( h_justify )
case GR_TEXT_HJUSTIFY_RIGHT: {
ux0 = -dy; case GR_TEXT_HJUSTIFY_CENTER:
break; break;
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_RIGHT:
ux0 = dy; ux0 = -dy;
break; break;
}
case GR_TEXT_HJUSTIFY_LEFT:
switch(v_justify) ux0 = dy;
{ break;
case GR_TEXT_VJUSTIFY_CENTER: }
break;
switch( v_justify )
case GR_TEXT_VJUSTIFY_TOP: {
uy0 = dx; case GR_TEXT_VJUSTIFY_CENTER:
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_TOP:
uy0 = -dx; uy0 = dx;
break; break;
}
} case GR_TEXT_VJUSTIFY_BOTTOM:
cX += ux0; cY += uy0; /* cX, cY = coord du centre du texte */ uy0 = -dx;
ox = -dx; oy = +dy; /* ox, oy = coord debut texte, relativement au centre */ break;
}
FctPlume(wxPoint(0,0), 'Z'); }
while(kk++ < nbchar) cX += ux0;
{ cY += uy0; /* cX, cY = coord du centre du texte */
AsciiCode = Text.GetChar(ptr) & 255;
ptcar = graphic_fonte_shape[AsciiCode] ; /* ptcar pointe la description ox = -dx;
du caractere a dessiner */ oy = +dy; /* ox, oy = coord debut texte, relativement au centre */
for(end = 0 ; end == 0; ptcar++) FctPlume( wxPoint( 0, 0 ), 'Z' );
{
f_cod = *ptcar ; /* get code n de la forme selectionnee */ while( kk++ < nbchar )
switch(f_cod) {
{ AsciiCode = Text.GetChar( ptr ) & 255;
case 'X' : end = 1 ;/* fin du caractere */ ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description
* du caractere a dessiner */
case 'U' :
case 'D' : plume = f_cod ; break ; for( end = 0; end == 0; ptcar++ )
{
default : f_cod = *ptcar;
k1 = f_cod ; /* trace sur axe V */
k1 = -(k1 * size_v) / 9 ; /* get code n de la forme selectionnee */
ptcar++ ; switch( f_cod )
f_cod = *ptcar; {
k2 = f_cod; /* trace sur axe H */ case 'X':
k2 = (k2 * size_h) / 9 ; end = 1; /* fin du caractere */
dx = k2 + ox; dy = k1 + oy;
RotatePoint(&dx, &dy, orient); case 'U':
FctPlume(wxPoint(cX + dx, cY + dy), plume); case 'D':
x0 = k2 ; y0 = k1 ; plume = f_cod; break;
break ;
} /* end switch */ default:
} /* end boucle for = end trace de 1 caractere */ k1 = f_cod; /* trace sur axe V */
k1 = -(k1 * size_v) / 9;
FctPlume(wxPoint(0,0), 'Z'); ptcar++;
ptr++; ox += espacement; f_cod = *ptcar;
} /* end trace du texte */
FctPlume(wxPoint(0,0), 'Z'); k2 = f_cod; /* trace sur axe H */
k2 = (k2 * size_h) / 9;
dx = k2 + ox;
dy = k1 + oy;
RotatePoint( &dx, &dy, orient );
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;
}
/* end trace du texte */
FctPlume( wxPoint( 0, 0 ), 'Z' );
} }
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