All: cleaning code to draw/plot texts (work in progress). Eeschema: italic and bold texts and labels allowed
(plot functions not yet updated for bold texts)
This commit is contained in:
parent
42116eff46
commit
cd6fbbef68
|
@ -5,6 +5,15 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2008-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
++All
|
||||
Cleaning code to draw/plot texts (work in progress):
|
||||
Now only one function is used to draw and plot texts
|
||||
(easier to maintain and ensure textes have the same size in ploting and drawing)
|
||||
In eeschema, italic and bold texts allowed (in pcbenew, texts thicness is already adjustable)
|
||||
|
||||
|
||||
2008-Dec-18 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
|
||||
================================================================================
|
||||
++all
|
||||
|
|
|
@ -192,7 +192,7 @@ int EDA_TextStruct::Len_Size()
|
|||
if( nbchar == 0 )
|
||||
return 0;
|
||||
|
||||
len = ( (10 * m_Size.x ) / 9 ) * nbchar;
|
||||
len = (( (10 * m_Size.x ) / 9 ) + m_Width) * nbchar;
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref )
|
|||
int dx, dy;
|
||||
int spot_cX, spot_cY;
|
||||
|
||||
dx = ( Pitch() * GetLength() ) / 2;
|
||||
dx = (int) (( Pitch() * GetLength() ) / 2);
|
||||
dy = m_Size.y / 2;
|
||||
|
||||
/* Is the ref point inside the text area ? */
|
||||
|
@ -243,13 +243,15 @@ bool EDA_TextStruct::HitTest( EDA_Rect& refArea )
|
|||
|
||||
|
||||
/*******************************/
|
||||
int EDA_TextStruct::Pitch()
|
||||
int EDA_TextStruct::Pitch(int aMinTickness)
|
||||
/*******************************/
|
||||
|
||||
/* retourne le pas entre 2 caracteres
|
||||
/**
|
||||
* Function Pitch
|
||||
* @return distance between 2 characters
|
||||
* @param aMinTickness = min segments tickness
|
||||
*/
|
||||
{
|
||||
return ( (10 * m_Size.x ) / 9 ) + m_Width;
|
||||
return ((m_Size.x * 10)/9) + MAX( m_Width, aMinTickness);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
wxSize text_size;
|
||||
void (*FctPlume)( wxPoint pos, int state );
|
||||
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
|
||||
bool italic = false;
|
||||
bool thickness = 0; //@todo : use current pen
|
||||
|
||||
switch( format_plot )
|
||||
{
|
||||
|
@ -176,7 +178,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
if(WsItem->m_Legende) msg = WsItem->m_Legende;
|
||||
PlotGraphicText(format_plot, pos, color,
|
||||
msg, TEXT_ORIENT_VERT, text_size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
thickness, italic );
|
||||
|
||||
break;
|
||||
case WS_SEGMENT_LU:
|
||||
|
@ -221,7 +224,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
pos.y = (ref.y + GRID_REF_W / 2) * conv_unit;
|
||||
PlotGraphicText( format_plot, pos, color,
|
||||
msg, TEXT_ORIENT_HORIZ, text_size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
|
||||
if( ii < xg - PAS_REF / 2 )
|
||||
{
|
||||
|
@ -234,7 +238,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
pos.y = (yg - GRID_REF_W / 2) * conv_unit;
|
||||
PlotGraphicText( format_plot, pos, color,
|
||||
msg, TEXT_ORIENT_HORIZ, text_size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
}
|
||||
|
||||
/* Trace des reperes selon l'axe Y */
|
||||
|
@ -254,7 +259,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
pos.y = (ii - gypas / 2) * conv_unit;
|
||||
PlotGraphicText( format_plot, pos, color,
|
||||
msg, TEXT_ORIENT_HORIZ, text_size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
|
||||
if( ii < yg - PAS_REF / 2 )
|
||||
{
|
||||
|
@ -266,7 +272,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
pos.x = (xg - GRID_REF_W / 2) * conv_unit;
|
||||
pos.y = (ii - gypas / 2) * conv_unit;
|
||||
PlotGraphicText( format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -294,7 +301,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
case WS_PODPIS:
|
||||
if(WsItem->m_Legende) msg = WsItem->m_Legende;
|
||||
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
break;
|
||||
case WS_SIZESHEET:
|
||||
break;
|
||||
|
@ -302,13 +310,15 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
if(WsItem->m_Legende) msg = WsItem->m_Legende;
|
||||
msg << screen->m_ScreenNumber;
|
||||
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
break;
|
||||
case WS_SHEETS:
|
||||
if(WsItem->m_Legende) msg = WsItem->m_Legende;
|
||||
msg << screen->m_NumberOfScreen;
|
||||
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
break;
|
||||
case WS_COMPANY_NAME:
|
||||
break;
|
||||
|
@ -345,13 +355,15 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
case WS_PODPIS_D:
|
||||
if(WsItem->m_Legende) msg = WsItem->m_Legende;
|
||||
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
break;
|
||||
case WS_IDENTSHEET_D:
|
||||
if(WsItem->m_Legende) msg = WsItem->m_Legende;
|
||||
msg << screen->m_ScreenNumber;
|
||||
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
break;
|
||||
case WS_LEFT_SEGMENT_D:
|
||||
case WS_SEGMENT_D:
|
||||
|
@ -470,7 +482,8 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
|||
{
|
||||
PlotGraphicText( format_plot, pos, color,
|
||||
msg.GetData(), TEXT_ORIENT_HORIZ, text_size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
int ii, kk, char_count, AsciiCode, endcar;
|
||||
int x0, y0;
|
||||
int zoom;
|
||||
int size_h, size_v, espacement;
|
||||
int size_h, size_v, pitch;
|
||||
SH_CODE f_cod, plume = 'U';
|
||||
const SH_CODE* ptcar;
|
||||
int ptr;
|
||||
|
@ -83,11 +83,11 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
if( char_count == 0 )
|
||||
return;
|
||||
|
||||
espacement = (10 * size_h ) / 9; // this is the pitch between chars
|
||||
if ( espacement > 0 )
|
||||
espacement += ABS(aWidth);
|
||||
pitch = (10 * size_h ) / 9; // this is the pitch between chars
|
||||
if ( pitch > 0 )
|
||||
pitch += ABS(aWidth);
|
||||
else
|
||||
espacement -= ABS(aWidth);
|
||||
pitch -= ABS(aWidth);
|
||||
|
||||
ox = cX = aPos.x;
|
||||
oy = cY = aPos.y;
|
||||
|
@ -96,7 +96,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
if( aPanel )
|
||||
{
|
||||
int xm, ym, ll, xc, yc;
|
||||
int textsize = ABS( espacement );
|
||||
int textsize = ABS( pitch );
|
||||
ll = (textsize * char_count) / zoom;
|
||||
|
||||
xc = GRMapX( cX );
|
||||
|
@ -119,7 +119,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
|
||||
|
||||
/* Compute the position ux0, uy0 of the first letter , next */
|
||||
dx = (espacement * char_count) / 2;
|
||||
dx = (pitch * char_count) / 2;
|
||||
dy = size_v / 2; /* dx, dy = draw offset between first letter and text center */
|
||||
|
||||
ux0 = uy0 = 0; /* Decalage du centre du texte / coord de ref */
|
||||
|
@ -196,7 +196,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
|
||||
if( ABS( (aSize.x / zoom) ) < 3 ) /* chars trop petits pour etre dessines */
|
||||
{ /* le texte est symbolise par une barre */
|
||||
dx = (espacement * char_count) / 2;
|
||||
dx = (pitch * char_count) / 2;
|
||||
dy = size_v / 2; /* Decalage du debut du texte / centre */
|
||||
|
||||
ux0 = cX - dx;
|
||||
|
@ -303,18 +303,54 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
|
||||
/* end draw 1 char */
|
||||
|
||||
ptr++; ox += espacement;
|
||||
ptr++; ox += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* functions used to plot texts, using DrawGraphicText() with a call back function */
|
||||
static void (*MovePenFct)( wxPoint pos, int state ); // a pointer to actual plot function (HPGL, PS, ..)
|
||||
static bool s_Plotbegin; // Flag to init plot
|
||||
/* The call back function */
|
||||
static void s_Callback_plot(int x0, int y0, int xf, int yf)
|
||||
{
|
||||
static wxPoint PenLastPos;
|
||||
wxPoint pstart;
|
||||
pstart.x = x0;
|
||||
pstart.y = y0;
|
||||
wxPoint pend;
|
||||
pend.x = xf;
|
||||
pend.y = yf;
|
||||
if ( s_Plotbegin ) // First segment to plot
|
||||
{
|
||||
MovePenFct( pstart, 'U' );
|
||||
MovePenFct( pend, 'D' );
|
||||
s_Plotbegin = false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if ( PenLastPos == pstart ) // this is a next segment in a polyline
|
||||
{
|
||||
MovePenFct( pend, 'D' );
|
||||
}
|
||||
else // New segment to plot
|
||||
{
|
||||
MovePenFct( pstart, 'U' );
|
||||
MovePenFct( pend, 'D' );
|
||||
}
|
||||
}
|
||||
|
||||
PenLastPos = pend;
|
||||
}
|
||||
/******************************************************************************************/
|
||||
void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor,
|
||||
const wxString& aText,
|
||||
int aOrient, const wxSize& aSize,
|
||||
enum GRTextHorizJustifyType aH_justify,
|
||||
enum GRTextVertJustifyType aV_justify,
|
||||
bool aItalic )
|
||||
int aWidth, bool aItalic )
|
||||
/******************************************************************************************/
|
||||
|
||||
/** Function PlotGraphicText
|
||||
|
@ -327,27 +363,21 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
|
|||
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
|
||||
* @param aH_justify = horizontal justification (Left, center, right)
|
||||
* @param aV_justify = vertical justification (bottom, center, top)
|
||||
* @param aWidth = line width (pen width) (default = 0)
|
||||
* if width < 0 : draw segments in sketch mode, width = abs(width)
|
||||
* @param aItalic = true to simulate an italic font
|
||||
*/
|
||||
{
|
||||
int kk, char_count, end, AsciiCode;
|
||||
int k1, k2, x0, y0, ox, oy;
|
||||
int size_h, size_v, espacement;
|
||||
SH_CODE f_cod, plume = 'U';
|
||||
const SH_CODE* ptcar;
|
||||
int ptr;
|
||||
int ux0, uy0, dx, dy; // Coord de trace des segments de texte & variables de calcul */
|
||||
int cX, cY; // Centre du texte
|
||||
|
||||
void (*FctPlume)( wxPoint pos, int state );
|
||||
|
||||
// Initialise the actual function used to plot lines:
|
||||
switch( aFormat_plot )
|
||||
{
|
||||
case PLOT_FORMAT_POST:
|
||||
FctPlume = LineTo_PS;
|
||||
MovePenFct = LineTo_PS;
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_HPGL:
|
||||
FctPlume = Move_Plume_HPGL;
|
||||
MovePenFct = Move_Plume_HPGL;
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_GERBER:
|
||||
|
@ -358,158 +388,13 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
|
|||
if( aColor >= 0 && IsPostScript( aFormat_plot ) )
|
||||
SetColorMapPS( aColor );
|
||||
|
||||
size_h = aSize.x;
|
||||
size_v = aSize.y;
|
||||
if( size_h == 0 )
|
||||
size_h = DEFAULT_SIZE_TEXT;
|
||||
if( size_v == 0 )
|
||||
size_v = DEFAULT_SIZE_TEXT;
|
||||
s_Plotbegin = true;
|
||||
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
|
||||
aOrient, aSize,
|
||||
aH_justify, aV_justify,
|
||||
aWidth, aItalic,
|
||||
s_Callback_plot);
|
||||
|
||||
kk = 0;
|
||||
ptr = 0; /* ptr = text index */
|
||||
|
||||
/* calcul de la position du debut des textes: ox et oy */
|
||||
char_count = aText.Len();
|
||||
|
||||
espacement = (10 * size_h ) / 9;
|
||||
ox = cX = aPos.x;
|
||||
oy = cY = aPos.y;
|
||||
|
||||
/* Calcul du cadrage du texte */
|
||||
dx = (espacement * char_count) / 2;
|
||||
dy = size_v / 2; /* Decalage du debut du texte / centre */
|
||||
|
||||
ux0 = uy0 = 0; /* Decalage du centre du texte / ccord de ref */
|
||||
|
||||
if( (aOrient == 0) || (aOrient == 1800) ) /* Texte Horizontal */
|
||||
{
|
||||
switch( aH_justify )
|
||||
{
|
||||
case GR_TEXT_HJUSTIFY_CENTER:
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||
ux0 = -dx;
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_LEFT:
|
||||
ux0 = dx;
|
||||
break;
|
||||
}
|
||||
|
||||
switch( aV_justify )
|
||||
{
|
||||
case GR_TEXT_VJUSTIFY_CENTER:
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_TOP:
|
||||
uy0 = dy;
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||
uy0 = -dy;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else /* Texte Vertical */
|
||||
{
|
||||
switch( aH_justify )
|
||||
{
|
||||
case GR_TEXT_HJUSTIFY_CENTER:
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||
ux0 = -dy;
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_LEFT:
|
||||
ux0 = dy;
|
||||
break;
|
||||
}
|
||||
|
||||
switch( aV_justify )
|
||||
{
|
||||
case GR_TEXT_VJUSTIFY_CENTER:
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_TOP:
|
||||
uy0 = dx;
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||
uy0 = -dx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cX += ux0;
|
||||
cY += uy0; /* cX, cY = coord du centre du texte */
|
||||
|
||||
ox = -dx;
|
||||
oy = +dy; /* ox, oy = coord debut texte, relativement au centre */
|
||||
|
||||
FctPlume( wxPoint( 0, 0 ), 'Z' );
|
||||
|
||||
while( kk++ < char_count )
|
||||
{
|
||||
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
|
||||
AsciiCode = aText.GetChar(ptr) & 0x7FF;
|
||||
if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr
|
||||
AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF;
|
||||
else
|
||||
AsciiCode = AsciiCode & 0xFF;
|
||||
#else
|
||||
AsciiCode = aText.GetChar( ptr ) & 0xFF;
|
||||
#endif
|
||||
ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description
|
||||
* du caractere a dessiner */
|
||||
|
||||
for( end = 0; end == 0; ptcar++ )
|
||||
{
|
||||
f_cod = *ptcar;
|
||||
|
||||
/* get code n de la forme selectionnee */
|
||||
switch( f_cod )
|
||||
{
|
||||
case 'X':
|
||||
end = 1; /* fin du caractere */
|
||||
|
||||
case 'U':
|
||||
case 'D':
|
||||
plume = f_cod; break;
|
||||
|
||||
default:
|
||||
k1 = f_cod; /* trace sur axe V */
|
||||
k1 = -(k1 * size_v) / 9;
|
||||
ptcar++;
|
||||
f_cod = *ptcar;
|
||||
|
||||
k2 = f_cod; /* trace sur axe H */
|
||||
k2 = (k2 * size_h) / 9;
|
||||
// To simulate an italic font, add a x offset depending on the y offset
|
||||
if ( aItalic )
|
||||
k2 -= k1/8;
|
||||
|
||||
dx = k2 + ox;
|
||||
dy = k1 + oy;
|
||||
|
||||
RotatePoint( &dx, &dy, aOrient );
|
||||
FctPlume( wxPoint( cX + dx, cY + dy ), plume );
|
||||
|
||||
x0 = k2;
|
||||
y0 = k1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* end switch */
|
||||
}
|
||||
|
||||
/* end boucle for = end trace de 1 caractere */
|
||||
|
||||
FctPlume( wxPoint( 0, 0 ), 'Z' );
|
||||
ptr++; ox += espacement;
|
||||
}
|
||||
|
||||
/* end trace du texte */
|
||||
FctPlume( wxPoint( 0, 0 ), 'Z' );
|
||||
/* end text : pen UP ,no move */
|
||||
MovePenFct( wxPoint( 0, 0 ), 'Z' );
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ set(EESCHEMA_SRCS
|
|||
# dialog_edit_component_in_lib.cpp
|
||||
dialog_edit_component_in_schematic_fbp.cpp
|
||||
dialog_edit_component_in_schematic.cpp
|
||||
# dialog_edit_label.cpp
|
||||
dialog_edit_label.cpp
|
||||
dialog_edit_label_base.cpp
|
||||
dialog_eeschema_config.cpp
|
||||
dialog_erc.cpp
|
||||
# dialog_find.cpp
|
||||
|
@ -82,6 +83,7 @@ set(EESCHEMA_SRCS
|
|||
plothpgl.cpp
|
||||
plotps.cpp
|
||||
priorque.cpp
|
||||
read_from_file_schematic_items_descriptions.cpp
|
||||
savelib.cpp
|
||||
save_schemas.cpp
|
||||
schedit.cpp
|
||||
|
|
|
@ -281,7 +281,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
|
|||
}
|
||||
|
||||
const wxChar* textsrc = m_PinName.GetData();
|
||||
float fPinTextPitch = PinNameSize.x * 1.1;
|
||||
float fPinTextPitch = (PinNameSize.x * 1.1) + LineWidth;
|
||||
/* Do we need to invert the string? Is this string has only "~"? */
|
||||
PinTextBarCount = 0; PinTxtLen = 0;
|
||||
ii = 0;
|
||||
|
@ -555,7 +555,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
int orient,
|
||||
int TextInside,
|
||||
bool DrawPinNum,
|
||||
bool DrawPinName )
|
||||
bool DrawPinName,
|
||||
int aWidth, bool aItalic )
|
||||
{
|
||||
int dx, len, start;
|
||||
int ii, x, y, x1, y1, cte;
|
||||
|
@ -594,7 +595,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
}
|
||||
|
||||
const wxChar* textsrc = m_PinName.GetData();
|
||||
float fPinTextPitch = PinNameSize.x * 1.1;
|
||||
float fPinTextPitch = (PinNameSize.x * 1.1) + aWidth;
|
||||
/* Do we need to invert the string? Is this string has only "~"? */
|
||||
PinTextBarCount = 0; PinTxtLen = 0;
|
||||
ii = 0;
|
||||
|
@ -635,7 +636,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
TEXT_ORIENT_HORIZ,
|
||||
PinNameSize,
|
||||
GR_TEXT_HJUSTIFY_LEFT,
|
||||
GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_VJUSTIFY_CENTER,
|
||||
aWidth, aItalic );
|
||||
|
||||
for( ii = 0; ii < PinTextBarCount; )
|
||||
{
|
||||
|
@ -654,7 +656,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
NameColor, PinText, TEXT_ORIENT_HORIZ,
|
||||
PinNameSize,
|
||||
GR_TEXT_HJUSTIFY_RIGHT,
|
||||
GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_VJUSTIFY_CENTER,
|
||||
aWidth, aItalic );
|
||||
|
||||
for( ii = 0; ii < PinTextBarCount; )
|
||||
{
|
||||
|
@ -675,7 +678,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
NumColor, StringPinNum,
|
||||
TEXT_ORIENT_HORIZ, PinNumSize,
|
||||
GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
aWidth, aItalic );
|
||||
}
|
||||
}
|
||||
else /* Its a vertical line. */
|
||||
|
@ -691,7 +695,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
PinText,
|
||||
TEXT_ORIENT_VERT, PinNameSize,
|
||||
GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_TOP );
|
||||
GR_TEXT_VJUSTIFY_TOP,
|
||||
aWidth, aItalic);
|
||||
|
||||
for( ii = 0; ii < PinTextBarCount; )
|
||||
{
|
||||
|
@ -711,7 +716,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
PinText,
|
||||
TEXT_ORIENT_VERT, PinNameSize,
|
||||
GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
aWidth, aItalic);
|
||||
|
||||
for( ii = 0; ii < PinTextBarCount; )
|
||||
{
|
||||
|
@ -732,7 +738,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
NumColor, StringPinNum,
|
||||
TEXT_ORIENT_VERT, PinNumSize,
|
||||
GR_TEXT_HJUSTIFY_RIGHT,
|
||||
GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_VJUSTIFY_CENTER,
|
||||
aWidth, aItalic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -749,7 +756,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
NameColor, PinText,
|
||||
TEXT_ORIENT_HORIZ, PinNameSize,
|
||||
GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
aWidth, aItalic);
|
||||
|
||||
for( ii = 0; ii < PinTextBarCount; )
|
||||
{
|
||||
|
@ -767,7 +775,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 + TXTMARGE ),
|
||||
NumColor, StringPinNum,
|
||||
TEXT_ORIENT_HORIZ, PinNumSize,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
|
||||
aWidth, aItalic);
|
||||
}
|
||||
}
|
||||
else /* Its a vertical line. */
|
||||
|
@ -780,7 +789,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
NameColor, PinText,
|
||||
TEXT_ORIENT_VERT, PinNameSize,
|
||||
GR_TEXT_HJUSTIFY_RIGHT,
|
||||
GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_VJUSTIFY_CENTER,
|
||||
aWidth, aItalic);
|
||||
|
||||
for( ii = 0; ii < PinTextBarCount; )
|
||||
{
|
||||
|
@ -801,7 +811,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
|
|||
NumColor, StringPinNum,
|
||||
TEXT_ORIENT_VERT, PinNumSize,
|
||||
GR_TEXT_HJUSTIFY_LEFT,
|
||||
GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_VJUSTIFY_CENTER,
|
||||
aWidth, aItalic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|||
wxPoint( m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y ),
|
||||
color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
|
||||
GR_TEXT_HJUSTIFY_LEFT,
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, width );
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 1: /* Vert Orientation UP */
|
||||
|
@ -148,7 +148,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|||
m_Pos.y + offset.y ),
|
||||
color, m_Text, TEXT_ORIENT_VERT, m_Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT,
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, width );
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 2: /* Horiz Orientation - Right justified */
|
||||
|
@ -157,7 +157,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|||
TXTMARGE + offset.y ),
|
||||
color, m_Text, TEXT_ORIENT_HORIZ, m_Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT,
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, width );
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 3: /* Vert Orientation BOTTOM */
|
||||
|
@ -166,7 +166,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|||
m_Pos.y + offset.y ),
|
||||
color, m_Text, TEXT_ORIENT_VERT, m_Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT,
|
||||
GR_TEXT_VJUSTIFY_TOP, width );
|
||||
GR_TEXT_VJUSTIFY_TOP, width, m_Italic );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -184,9 +184,13 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|||
bool SCH_TEXT::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d ~\n%s\n",
|
||||
const char * shape = "~";
|
||||
if (m_Italic )
|
||||
shape = "Italic";
|
||||
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Orient, m_Size.x,
|
||||
shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
|
@ -234,10 +238,13 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
|
|||
bool SCH_LABEL::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
char shape = '~';
|
||||
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %c\n%s\n",
|
||||
const char * shape = "~";
|
||||
if (m_Italic )
|
||||
shape = "Italic";
|
||||
|
||||
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Orient, m_Size.x, shape,
|
||||
m_Orient, m_Size.x, shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
|
@ -267,10 +274,14 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
|
|||
bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s\n%s\n",
|
||||
const char * shape = "~";
|
||||
if (m_Italic )
|
||||
shape = "Italic";
|
||||
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Orient, m_Size.x,
|
||||
SheetLabelType[m_Shape],
|
||||
shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
|
@ -300,10 +311,14 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) :
|
|||
bool SCH_HIERLABEL::Save( FILE* aFile ) const
|
||||
{
|
||||
bool success = true;
|
||||
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s\n%s\n",
|
||||
const char * shape = "~";
|
||||
if (m_Italic )
|
||||
shape = "Italic";
|
||||
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Orient, m_Size.x,
|
||||
SheetLabelType[m_Shape],
|
||||
shape, m_Width,
|
||||
CONV_TO_UTF8( m_Text ) ) == EOF )
|
||||
{
|
||||
success = false;
|
||||
|
@ -352,28 +367,28 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
|
|||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x - ii, AnchorPos.y ), color,
|
||||
m_Text, TEXT_ORIENT_HORIZ, m_Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 1: /* Orientation vert UP */
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x, AnchorPos.y + ii ), color,
|
||||
m_Text, TEXT_ORIENT_VERT, m_Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 2: /* Orientation horiz inverse */
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x + ii, AnchorPos.y ), color,
|
||||
m_Text, TEXT_ORIENT_HORIZ, m_Size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 3: /* Orientation vert BOTTOM */
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x, AnchorPos.y - ii ), color,
|
||||
m_Text, TEXT_ORIENT_VERT, m_Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -417,8 +432,9 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
|
|||
y = m_Pos.y;
|
||||
dx = dy = 0;
|
||||
|
||||
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||
height = m_Size.y + 2*TXTMARGE;
|
||||
length = ( Pitch() * GetLength() ) + height + 2*DANGLING_SYMBOL_SIZE; // add height for triangular shapes
|
||||
length = ( Pitch(width) * GetLength() ) + height + 2*DANGLING_SYMBOL_SIZE; // add height for triangular shapes
|
||||
|
||||
switch( m_Orient ) // respect orientation
|
||||
{
|
||||
|
@ -504,28 +520,28 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
|
|||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x - offset, AnchorPos.y ), color,
|
||||
m_Text, TEXT_ORIENT_HORIZ, m_Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 1: /* Orientation vert UP */
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x, AnchorPos.y + offset ), color,
|
||||
m_Text, TEXT_ORIENT_VERT, m_Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 2: /* Orientation horiz inverse */
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x + offset, AnchorPos.y ), color,
|
||||
m_Text, TEXT_ORIENT_HORIZ, m_Size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, m_Italic );
|
||||
break;
|
||||
|
||||
case 3: /* Orientation vert BOTTOM */
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( AnchorPos.x, AnchorPos.y - offset ), color,
|
||||
m_Text, TEXT_ORIENT_VERT, m_Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, m_Italic );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -629,8 +645,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
|
|||
y = m_Pos.y;
|
||||
dx = dy = 0;
|
||||
|
||||
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||
height = m_Size.y + 2*TXTMARGE;
|
||||
length = ( Pitch() * GetLength() ) + 2* height + 2*DANGLING_SYMBOL_SIZE; // add 2*height for triangular shapes (bidirectional)
|
||||
length = ( Pitch(width) * GetLength() ) + 2* height + 2*DANGLING_SYMBOL_SIZE; // add 2*height for triangular shapes (bidirectional)
|
||||
|
||||
switch( m_Orient ) // respect orientation
|
||||
{
|
||||
|
@ -675,7 +692,8 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
|
|||
|
||||
x = m_Pos.x;
|
||||
y = m_Pos.y;
|
||||
length = ( Pitch() * GetLength() );
|
||||
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||
length = ( Pitch(width) * GetLength() );
|
||||
height = m_Size.y;
|
||||
dx = dy = 0;
|
||||
|
||||
|
@ -714,3 +732,4 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
|
|||
box.Normalize();
|
||||
return box;
|
||||
}
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ public:
|
|||
int TextInside, bool DrawPinNum, bool DrawPinName,
|
||||
int Color, int DrawMode );
|
||||
void PlotPinTexts( wxPoint& pin_pos, int orient,
|
||||
int TextInside, bool DrawPinNum, bool DrawPinName );
|
||||
int TextInside, bool DrawPinNum, bool DrawPinNameint, int aWidth, bool aItalic );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,67 +1,38 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog_edit_label.cpp
|
||||
// Purpose:
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
// Created: 19/02/2006 15:46:26
|
||||
// RCS-ID:
|
||||
// Copyright: License GNU
|
||||
// Licence:
|
||||
// Created: 18/12/2008 15:46:26
|
||||
// Licence: GPL
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Generated by DialogBlocks (unregistered), 19/02/2006 15:46:26
|
||||
|
||||
/* This is the dialog box for labels, glob. labels and graphic texts edition */
|
||||
|
||||
////@begin includes
|
||||
////@end includes
|
||||
#include "fctsys.h"
|
||||
#include "wx/valgen.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
#include "dialog_edit_label.h"
|
||||
|
||||
////@begin XPM images
|
||||
////@end XPM images
|
||||
|
||||
/*!
|
||||
* WinEDA_LabelPropertiesFrame type definition
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( WinEDA_LabelPropertiesFrame, wxDialog )
|
||||
|
||||
/*!
|
||||
* WinEDA_LabelPropertiesFrame event table definition
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_LabelPropertiesFrame, wxDialog )
|
||||
|
||||
////@begin WinEDA_LabelPropertiesFrame event table entries
|
||||
EVT_BUTTON( wxID_OK, WinEDA_LabelPropertiesFrame::OnOkClick )
|
||||
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_LabelPropertiesFrame::OnCancelClick )
|
||||
|
||||
////@end WinEDA_LabelPropertiesFrame event table entries
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/*!
|
||||
* WinEDA_LabelPropertiesFrame constructors
|
||||
*/
|
||||
|
||||
WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( )
|
||||
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText)
|
||||
: DialogLabelEditor_Base ( parent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_CurrentText= CurrentText;
|
||||
}
|
||||
|
||||
WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent,
|
||||
SCH_TEXT * CurrentText,
|
||||
const wxPoint& pos,
|
||||
wxWindowID id, const wxString& caption, const wxSize& size, long style )
|
||||
void DialogLabelEditor::OnInitDialog( wxInitDialogEvent& event )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
m_Parent = parent;
|
||||
m_CurrentText = CurrentText;
|
||||
Create(parent, id, caption, pos, size, style);
|
||||
m_TextLabel->SetValue(m_CurrentText->m_Text);
|
||||
m_TextLabel->SetFocus();
|
||||
|
||||
// Set validators
|
||||
m_TextOrient->SetSelection( m_CurrentText->m_Orient );
|
||||
m_TextShape->SetSelection( m_CurrentText->m_Shape );
|
||||
|
||||
switch( m_CurrentText->Type() )
|
||||
{
|
||||
case TYPE_SCH_GLOBALLABEL:
|
||||
|
@ -81,163 +52,37 @@ wxString msg;
|
|||
break;
|
||||
}
|
||||
|
||||
int style = 0;
|
||||
if ( m_CurrentText->m_Italic )
|
||||
style = 1;
|
||||
if ( m_CurrentText->m_Width > 1 )
|
||||
style += 2;
|
||||
m_TextStyle->SetSelection(style);
|
||||
|
||||
msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol();
|
||||
m_SizeTitle->SetLabel(msg);
|
||||
|
||||
msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits);
|
||||
m_TextSize->SetValue(msg);
|
||||
}
|
||||
|
||||
/*!
|
||||
* WinEDA_LabelPropertiesFrame creator
|
||||
*/
|
||||
SetFocus();
|
||||
|
||||
bool WinEDA_LabelPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
////@begin WinEDA_LabelPropertiesFrame member initialisation
|
||||
m_TextLabel = NULL;
|
||||
m_TextOrient = NULL;
|
||||
m_TextShape = NULL;
|
||||
m_SizeTitle = NULL;
|
||||
m_TextSize = NULL;
|
||||
m_btClose = NULL;
|
||||
////@end WinEDA_LabelPropertiesFrame member initialisation
|
||||
if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL &&
|
||||
m_CurrentText->Type() != TYPE_SCH_HIERLABEL)
|
||||
m_TextShape->Show(false);
|
||||
|
||||
////@begin WinEDA_LabelPropertiesFrame creation
|
||||
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||
|
||||
CreateControls();
|
||||
if (GetSizer())
|
||||
{
|
||||
GetSizer()->SetSizeHints(this);
|
||||
}
|
||||
Centre();
|
||||
////@end WinEDA_LabelPropertiesFrame creation
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Control creation for WinEDA_LabelPropertiesFrame
|
||||
*/
|
||||
|
||||
void WinEDA_LabelPropertiesFrame::CreateControls()
|
||||
{
|
||||
SetFont(*g_DialogFont);
|
||||
////@begin WinEDA_LabelPropertiesFrame content construction
|
||||
// Generated by DialogBlocks, 29/04/2008 21:03:43 (unregistered)
|
||||
|
||||
WinEDA_LabelPropertiesFrame* itemDialog1 = this;
|
||||
|
||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemDialog1->SetSizer(itemBoxSizer2);
|
||||
|
||||
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
|
||||
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
|
||||
|
||||
wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Text "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
|
||||
m_TextLabel = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(250, -1), 0 );
|
||||
itemBoxSizer3->Add(m_TextLabel, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer3->Add(itemBoxSizer6, 0, wxGROW|wxALL, 5);
|
||||
|
||||
wxArrayString m_TextOrientStrings;
|
||||
m_TextOrientStrings.Add(_("Right"));
|
||||
m_TextOrientStrings.Add(_("Up"));
|
||||
m_TextOrientStrings.Add(_("Left"));
|
||||
m_TextOrientStrings.Add(_("Down"));
|
||||
m_TextOrient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Text Orient:"), wxDefaultPosition, wxDefaultSize, m_TextOrientStrings, 1, wxRA_SPECIFY_COLS );
|
||||
m_TextOrient->SetSelection(0);
|
||||
itemBoxSizer6->Add(m_TextOrient, 0, wxALIGN_TOP|wxALL, 5);
|
||||
|
||||
itemBoxSizer6->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxArrayString m_TextShapeStrings;
|
||||
m_TextShapeStrings.Add(_("Input"));
|
||||
m_TextShapeStrings.Add(_("Output"));
|
||||
m_TextShapeStrings.Add(_("Bidi"));
|
||||
m_TextShapeStrings.Add(_("TriState"));
|
||||
m_TextShapeStrings.Add(_("Passive"));
|
||||
m_TextShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Glabel Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeStrings, 1, wxRA_SPECIFY_COLS );
|
||||
m_TextShape->SetSelection(0);
|
||||
m_TextShape->Show(false);
|
||||
itemBoxSizer6->Add(m_TextShape, 0, wxALIGN_TOP|wxALL, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
|
||||
itemBoxSizer2->Add(itemBoxSizer10, 0, wxGROW|wxALL, 5);
|
||||
|
||||
m_SizeTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Size "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer10->Add(m_SizeTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
|
||||
m_TextSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer10->Add(m_TextSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
|
||||
itemBoxSizer10->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
||||
|
||||
wxButton* itemButton14 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton14->SetDefault();
|
||||
itemButton14->SetForegroundColour(wxColour(204, 0, 0));
|
||||
itemBoxSizer10->Add(itemButton14, 0, wxGROW|wxALL, 5);
|
||||
|
||||
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btClose->SetForegroundColour(wxColour(0, 0, 255));
|
||||
itemBoxSizer10->Add(m_btClose, 0, wxGROW|wxALL, 5);
|
||||
|
||||
// Set validators
|
||||
m_TextOrient->SetValidator( wxGenericValidator(& m_CurrentText->m_Orient) );
|
||||
m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) );
|
||||
////@end WinEDA_LabelPropertiesFrame content construction
|
||||
|
||||
m_btClose->SetFocus();
|
||||
|
||||
if (m_CurrentText->Type() == TYPE_SCH_GLOBALLABEL ||
|
||||
m_CurrentText->Type() == TYPE_SCH_HIERLABEL)
|
||||
m_TextShape->Show(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Should we show tooltips?
|
||||
*/
|
||||
|
||||
bool WinEDA_LabelPropertiesFrame::ShowToolTips()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get bitmap resources
|
||||
*/
|
||||
|
||||
wxBitmap WinEDA_LabelPropertiesFrame::GetBitmapResource( const wxString& name )
|
||||
{
|
||||
// Bitmap retrieval
|
||||
////@begin WinEDA_LabelPropertiesFrame bitmap retrieval
|
||||
wxUnusedVar(name);
|
||||
return wxNullBitmap;
|
||||
////@end WinEDA_LabelPropertiesFrame bitmap retrieval
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get icon resources
|
||||
*/
|
||||
|
||||
wxIcon WinEDA_LabelPropertiesFrame::GetIconResource( const wxString& name )
|
||||
{
|
||||
// Icon retrieval
|
||||
////@begin WinEDA_LabelPropertiesFrame icon retrieval
|
||||
wxUnusedVar(name);
|
||||
return wxNullIcon;
|
||||
////@end WinEDA_LabelPropertiesFrame icon retrieval
|
||||
}
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
||||
*/
|
||||
|
||||
void WinEDA_LabelPropertiesFrame::OnOkClick( wxCommandEvent& event )
|
||||
void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
|
||||
{
|
||||
TextPropertiesAccept(event);
|
||||
}
|
||||
|
@ -246,7 +91,7 @@ void WinEDA_LabelPropertiesFrame::OnOkClick( wxCommandEvent& event )
|
|||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
||||
*/
|
||||
|
||||
void WinEDA_LabelPropertiesFrame::OnCancelClick( wxCommandEvent& event )
|
||||
void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event )
|
||||
{
|
||||
m_Parent->DrawPanel->MouseToCursorSchema();
|
||||
EndModal( -1 );
|
||||
|
|
|
@ -1,119 +1,30 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog_edit_label.h
|
||||
// Purpose:
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
// Created: 19/02/2006 15:46:26
|
||||
// RCS-ID:
|
||||
// Copyright: License GNU
|
||||
// Licence:
|
||||
// Licence: GPL
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Generated by DialogBlocks (unregistered), 19/02/2006 15:46:26
|
||||
|
||||
#ifndef _DIALOG_EDIT_LABEL_H_
|
||||
#define _DIALOG_EDIT_LABEL_H_
|
||||
|
||||
#include "dialog_edit_label_base.h"
|
||||
|
||||
/*!
|
||||
* Includes
|
||||
*/
|
||||
|
||||
////@begin includes
|
||||
#include "wx/valgen.h"
|
||||
////@end includes
|
||||
|
||||
/*!
|
||||
* Forward declarations
|
||||
*/
|
||||
|
||||
////@begin forward declarations
|
||||
////@end forward declarations
|
||||
|
||||
/*!
|
||||
* Control identifiers
|
||||
*/
|
||||
|
||||
////@begin control identifiers
|
||||
#define ID_DIALOG 10000
|
||||
#define ID_TEXTCTRL 10001
|
||||
#define ID_RADIOBOX 10003
|
||||
#define ID_RADIOBOX1 10004
|
||||
#define ID_TEXTCTRL1 10002
|
||||
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER
|
||||
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE _("Text Editor")
|
||||
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME ID_DIALOG
|
||||
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE wxSize(400, 300)
|
||||
#define SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION wxDefaultPosition
|
||||
////@end control identifiers
|
||||
|
||||
/*!
|
||||
* Compatibility
|
||||
*/
|
||||
|
||||
#ifndef wxCLOSE_BOX
|
||||
#define wxCLOSE_BOX 0x1000
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* WinEDA_LabelPropertiesFrame class declaration
|
||||
*/
|
||||
|
||||
class WinEDA_LabelPropertiesFrame: public wxDialog
|
||||
class DialogLabelEditor : public DialogLabelEditor_Base
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( WinEDA_LabelPropertiesFrame )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
/// Constructors
|
||||
WinEDA_LabelPropertiesFrame( );
|
||||
WinEDA_LabelPropertiesFrame( WinEDA_SchematicFrame* parent,
|
||||
SCH_TEXT * CurrentText,
|
||||
const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION,
|
||||
wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE );
|
||||
|
||||
/// Creation
|
||||
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE );
|
||||
|
||||
/// Creates the controls and sizers
|
||||
void CreateControls();
|
||||
|
||||
////@begin WinEDA_LabelPropertiesFrame event handler declarations
|
||||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
|
||||
////@end WinEDA_LabelPropertiesFrame event handler declarations
|
||||
|
||||
////@begin WinEDA_LabelPropertiesFrame member function declarations
|
||||
|
||||
/// Retrieves bitmap resources
|
||||
wxBitmap GetBitmapResource( const wxString& name );
|
||||
|
||||
/// Retrieves icon resources
|
||||
wxIcon GetIconResource( const wxString& name );
|
||||
////@end WinEDA_LabelPropertiesFrame member function declarations
|
||||
|
||||
/// Should we show tooltips?
|
||||
static bool ShowToolTips();
|
||||
void TextPropertiesAccept(wxCommandEvent& event);
|
||||
|
||||
////@begin WinEDA_LabelPropertiesFrame member variables
|
||||
wxTextCtrl* m_TextLabel;
|
||||
wxRadioBox* m_TextOrient;
|
||||
wxRadioBox* m_TextShape;
|
||||
wxStaticText* m_SizeTitle;
|
||||
wxTextCtrl* m_TextSize;
|
||||
wxButton* m_btClose;
|
||||
////@end WinEDA_LabelPropertiesFrame member variables
|
||||
|
||||
private:
|
||||
WinEDA_SchematicFrame * m_Parent;
|
||||
SCH_TEXT * m_CurrentText;
|
||||
|
||||
public:
|
||||
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
|
||||
~DialogLabelEditor(){};
|
||||
private:
|
||||
void OnInitDialog( wxInitDialogEvent& event );
|
||||
void OnButtonOKClick( wxCommandEvent& event );
|
||||
void OnButtonCANCEL_Click( wxCommandEvent& event );
|
||||
void TextPropertiesAccept( wxCommandEvent& event );
|
||||
};
|
||||
|
||||
#endif
|
||||
// _DIALOG_EDIT_LABEL_H_
|
||||
|
||||
#endif // _DIALOG_EDIT_LABEL_H_
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +0,0 @@
|
|||
#include "wx/msw/wx.rc"
|
|
@ -0,0 +1,94 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 16 2008)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_edit_label_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
bSizer2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer2->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* m_OptionsSizer;
|
||||
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") };
|
||||
int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString );
|
||||
m_TextOrient = new wxRadioBox( this, wxID_ANY, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_TextOrient->SetSelection( 0 );
|
||||
m_OptionsSizer->Add( m_TextOrient, 0, wxALL, 5 );
|
||||
|
||||
wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
|
||||
int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString );
|
||||
m_TextStyle = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_TextStyle->SetSelection( 0 );
|
||||
m_OptionsSizer->Add( m_TextStyle, 0, wxALL, 5 );
|
||||
|
||||
wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidi"), _("TriState"), _("Passive") };
|
||||
int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString );
|
||||
m_TextShape = new wxRadioBox( this, wxID_ANY, _("Glabel Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_TextShape->SetSelection( 2 );
|
||||
m_OptionsSizer->Add( m_TextShape, 0, wxALL, 5 );
|
||||
|
||||
bSizer2->Add( m_OptionsSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
bMainSizer->Add( bSizer2, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeTitle->Wrap( -1 );
|
||||
bSizer4->Add( m_SizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer4->Add( 8, 8, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonOK->SetForegroundColour( wxColour( 234, 0, 0 ) );
|
||||
|
||||
bSizer4->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonCANCEL->SetForegroundColour( wxColour( 0, 0, 187 ) );
|
||||
|
||||
bSizer4->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
bMainSizer->Add( bSizer4, 0, wxEXPAND, 5 );
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogLabelEditor_Base::OnInitDialog ) );
|
||||
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
|
||||
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
|
||||
}
|
||||
|
||||
DialogLabelEditor_Base::~DialogLabelEditor_Base()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogLabelEditor_Base::OnInitDialog ) );
|
||||
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
|
||||
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
|
||||
}
|
|
@ -0,0 +1,602 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="9" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_edit_label_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_edit_label_base</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="center"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DialogLabelEditor_Base</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">401,222</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="title">Text Editor</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog">OnInitDialog</event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer2</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Text</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticText1</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_VALUE</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_TextLabel</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_OptionsSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"Right" "Up" "Left" "Down"</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">wxRadioBox</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_TextOrient</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="selection">0</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioBox"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"Normal" "Italic" "Bold" "Bold Italic"</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Style</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_TextStyle</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="selection">0</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioBox"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"Input" "Output" "Bidi" "TriState" "Passive"</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Glabel Shape:</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_TextShape</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="selection">2</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioBox"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer4</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Size</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_SizeTitle</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_SIZE</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_TextSize</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">8</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">8</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg">234,0,0</property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_OK</property>
|
||||
<property name="label">OK</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_buttonOK</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnButtonOKClick</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg">0,0,187</property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_CANCEL</property>
|
||||
<property name="label">Cancel</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_buttonCANCEL</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnButtonCANCEL_Click</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,64 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 16 2008)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __dialog_edit_label_base__
|
||||
#define __dialog_edit_label_base__
|
||||
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DialogLabelEditor_Base
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DialogLabelEditor_Base : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
wxID_VALUE = 1000,
|
||||
wxID_SIZE,
|
||||
};
|
||||
|
||||
wxStaticText* m_staticText1;
|
||||
wxTextCtrl* m_TextLabel;
|
||||
wxRadioBox* m_TextOrient;
|
||||
wxRadioBox* m_TextStyle;
|
||||
wxRadioBox* m_TextShape;
|
||||
wxStaticText* m_SizeTitle;
|
||||
wxTextCtrl* m_TextSize;
|
||||
|
||||
wxButton* m_buttonOK;
|
||||
wxButton* m_buttonCANCEL;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonOKClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonCANCEL_Click( wxCommandEvent& event ){ event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 401,222 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~DialogLabelEditor_Base();
|
||||
|
||||
};
|
||||
|
||||
#endif //__dialog_edit_label_base__
|
|
@ -10,6 +10,7 @@
|
|||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
#include "dialog_edit_label.h"
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
|
@ -24,15 +25,11 @@ static wxSize OldSize;
|
|||
static int s_DefaultShapeGLabel = (int) NET_INPUT;
|
||||
static int s_DefaultOrientGLabel = 0;
|
||||
|
||||
/************************************/
|
||||
/* class WinEDA_LabelPropertiesFrame */
|
||||
/************************************/
|
||||
|
||||
#include "dialog_edit_label.cpp"
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_LabelPropertiesFrame::TextPropertiesAccept( wxCommandEvent& event )
|
||||
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
|
||||
/****************************************************************************/
|
||||
{
|
||||
wxString text;
|
||||
|
@ -55,6 +52,17 @@ void WinEDA_LabelPropertiesFrame::TextPropertiesAccept( wxCommandEvent& event )
|
|||
if( m_TextShape )
|
||||
m_CurrentText->m_Shape = m_TextShape->GetSelection();
|
||||
|
||||
int style = m_TextStyle->GetSelection();
|
||||
if ( ( style & 1 ) )
|
||||
m_CurrentText->m_Italic = 1;
|
||||
else
|
||||
m_CurrentText->m_Italic = 0;
|
||||
|
||||
if ( ( style & 2 ) )
|
||||
m_CurrentText->m_Width = m_CurrentText->m_Size.x / 5;
|
||||
else
|
||||
m_CurrentText->m_Width = 0;
|
||||
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
|
||||
/* Make the text size as new default size if it is a new text */
|
||||
|
@ -127,10 +135,8 @@ void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct,
|
|||
DrawPanel->CursorOff( DC );
|
||||
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
|
||||
|
||||
WinEDA_LabelPropertiesFrame* frame = new WinEDA_LabelPropertiesFrame( this,
|
||||
TextStruct,
|
||||
wxPoint( 30, 30 ) );
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
DialogLabelEditor* dialog = new DialogLabelEditor( this, TextStruct );
|
||||
dialog->ShowModal(); dialog->Destroy();
|
||||
|
||||
RedrawOneStruct( DrawPanel, DC, TextStruct, GR_DEFAULT_DRAWMODE );
|
||||
DrawPanel->CursorOn( DC );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -53,11 +53,14 @@ OBJECTS = eeschema.o\
|
|||
netlist.o\
|
||||
netlist_control.o\
|
||||
edit_label.o\
|
||||
dialog_edit_label.o\
|
||||
dialog_edit_label_base.o\
|
||||
edit_component_in_schematic.o\
|
||||
dialog_edit_component_in_schematic_fbp.o \
|
||||
dialog_edit_component_in_schematic.o \
|
||||
locate.o \
|
||||
save_schemas.o sheet.o \
|
||||
read_from_file_schematic_items_descriptions.o\
|
||||
viewlibs.o \
|
||||
libedit.o \
|
||||
libframe.o \
|
||||
|
@ -97,13 +100,18 @@ OBJECTS = eeschema.o\
|
|||
|
||||
eeschema.o: eeschema.cpp program.h general.h $(DEPEND)
|
||||
|
||||
read_from_file_schematic_items_descriptions.o: read_from_file_schematic_items_descriptions.cpp
|
||||
|
||||
|
||||
#edit_component_in_lib.o: edit_component_in_lib.cpp\
|
||||
# dialog_edit_component_in_lib.cpp dialog_edit_component_in_lib.h $(DEPEND)
|
||||
|
||||
edit_component_in_schematic.o: edit_component_in_schematic.cpp\
|
||||
dialog_edit_component_in_schematic.cpp dialog_edit_component_in_schematic.h $(DEPEND)
|
||||
|
||||
edit_label.o: edit_label.cpp dialog_edit_label.cpp dialog_edit_label.h $(DEPEND)
|
||||
edit_label.o: edit_label.cpp dialog_edit_label.h dialog_edit_label_base.h $(DEPEND)
|
||||
|
||||
dialog_edit_label.o: dialog_edit_label.cpp dialog_edit_label.h dialog_edit_label_base.h $(DEPEND)
|
||||
|
||||
dialog_create_component.o: dialog_create_component.cpp dialog_create_component.h $(DEPEND)
|
||||
|
||||
|
|
|
@ -252,11 +252,13 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
|
|||
t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0);
|
||||
pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos;
|
||||
SetCurrentLineWidth( -1 );
|
||||
int thickness = Text->m_Width; // @todo: calcultae the pen tickness
|
||||
PlotGraphicText( g_PlotFormat, pos, CharColor,
|
||||
Text->m_Text,
|
||||
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
|
||||
Text->m_Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -282,7 +284,6 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
|
|||
LibDrawPin* Pin = (LibDrawPin*) DEntry;
|
||||
if( Pin->m_Attributs & PINNOTDRAW )
|
||||
{
|
||||
// if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -294,9 +295,11 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
|
|||
/* Dessin de la pin et du symbole special associe */
|
||||
SetCurrentLineWidth( -1 );
|
||||
PlotPinSymbol( pos, Pin->m_PinLen, orient, Pin->m_PinShape );
|
||||
int thickness = 0; // @todo: calcultae the pen tickness
|
||||
Pin->PlotPinTexts( pos, orient,
|
||||
Entry->m_TextInside,
|
||||
Entry->m_DrawPinNum, Entry->m_DrawPinName );
|
||||
Entry->m_DrawPinNum, Entry->m_DrawPinName,
|
||||
thickness, false);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -463,14 +466,16 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
|
|||
}
|
||||
|
||||
SetCurrentLineWidth( -1 );
|
||||
int thickness = field->m_Width; // @todo: calculate the pen tickness
|
||||
|
||||
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
|
||||
//@todo not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
|
||||
if( !IsMulti || (FieldNumber != REFERENCE) )
|
||||
{
|
||||
PlotGraphicText( g_PlotFormat, textpos, color, field->m_Text,
|
||||
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
||||
field->m_Size,
|
||||
hjustify, vjustify );
|
||||
hjustify, vjustify,
|
||||
thickness, field->m_Italic);
|
||||
}
|
||||
else /* We plt the reference, for a multiple parts per package */
|
||||
{
|
||||
|
@ -485,7 +490,8 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
|
|||
#endif
|
||||
PlotGraphicText( g_PlotFormat, textpos, color, Text,
|
||||
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
||||
field->m_Size, hjustify, vjustify );
|
||||
field->m_Size, hjustify, vjustify,
|
||||
thickness, field->m_Italic );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,6 +619,9 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
|
|||
wxString Text;
|
||||
EDA_Colors color = UNSPECIFIED_COLOR;
|
||||
|
||||
bool italic = false;
|
||||
int thickness = 0;
|
||||
|
||||
switch( Struct->Type() )
|
||||
{
|
||||
case TYPE_SCH_GLOBALLABEL:
|
||||
|
@ -621,6 +630,8 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
|
|||
case TYPE_SCH_TEXT:
|
||||
Text = ( (SCH_TEXT*) Struct )->m_Text;
|
||||
Size = ( (SCH_TEXT*) Struct )->m_Size;
|
||||
thickness = ( (SCH_TEXT*) Struct )->m_Width;
|
||||
italic = ( (SCH_TEXT*) Struct )->m_Italic;
|
||||
Orient = ( (SCH_TEXT*) Struct )->m_Orient;
|
||||
Shape = ( (SCH_TEXT*) Struct )->m_Shape;
|
||||
pX = ( (SCH_TEXT*) Struct )->m_Pos.x;
|
||||
|
@ -641,7 +652,6 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
|
|||
Size = wxSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
|
||||
|
||||
SetCurrentLineWidth( -1 );
|
||||
|
||||
if ( Struct->Type() == TYPE_SCH_GLOBALLABEL )
|
||||
{
|
||||
offset = ( (SCH_GLOBALLABEL*) Struct )->m_Width;
|
||||
|
@ -669,44 +679,52 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
|
|||
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
|
||||
color, Text, TEXT_ORIENT_HORIZ, Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
else
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
|
||||
color, Text, TEXT_ORIENT_HORIZ, Size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
thickness, italic );
|
||||
break;
|
||||
|
||||
case 1: /* Orientation vert UP */
|
||||
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
|
||||
color, Text, TEXT_ORIENT_VERT, Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
|
||||
thickness, italic );
|
||||
else
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
|
||||
color, Text, TEXT_ORIENT_VERT, Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
thickness, italic );
|
||||
break;
|
||||
|
||||
case 2: /* Horiz Orientation - Right justified */
|
||||
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
|
||||
color, Text, TEXT_ORIENT_HORIZ, Size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
else
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
|
||||
color, Text, TEXT_ORIENT_HORIZ, Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
thickness, italic );
|
||||
break;
|
||||
|
||||
case 3: /* Orientation vert BOTTOM */
|
||||
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
|
||||
color, Text, TEXT_ORIENT_VERT, Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
thickness, italic );
|
||||
else
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
|
||||
color, Text, TEXT_ORIENT_VERT, Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP );
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP,
|
||||
thickness, italic );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -748,9 +766,12 @@ static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
|
|||
tposx = posx + size + (size / 8);
|
||||
side = GR_TEXT_HJUSTIFY_LEFT;
|
||||
}
|
||||
int thickness = Struct->m_Width;
|
||||
bool italic = Struct->m_Italic;
|
||||
PlotGraphicText( g_PlotFormat, wxPoint( tposx, posy ), txtcolor,
|
||||
Struct->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
|
||||
side, GR_TEXT_VJUSTIFY_CENTER );
|
||||
side, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic );
|
||||
/* dessin du symbole de connexion */
|
||||
|
||||
if( Struct->m_Edge )
|
||||
|
@ -837,9 +858,12 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
|
|||
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
||||
SetColorMapPS( ReturnLayerColor( LAYER_SHEETNAME ) );
|
||||
|
||||
int thickness = 0; //@todo use current pen width
|
||||
bool italic = false;
|
||||
PlotGraphicText( g_PlotFormat, pos, txtcolor,
|
||||
Text, TEXT_ORIENT_HORIZ, size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||
thickness, italic );
|
||||
|
||||
/* Trace des textes : FileName */
|
||||
Text = Struct->GetFileName();
|
||||
|
@ -852,7 +876,8 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
|
|||
wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
|
||||
txtcolor,
|
||||
Text, TEXT_ORIENT_HORIZ, size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP );
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
|
||||
thickness, italic );
|
||||
|
||||
/* Trace des textes : SheetLabel */
|
||||
SheetLabelStruct = Struct->m_Label;
|
||||
|
|
|
@ -0,0 +1,798 @@
|
|||
/* read_from_file_schematic_items_descriptions.cpp */
|
||||
|
||||
/*functions to read schematic items descriptions from file
|
||||
*/
|
||||
#include "fctsys.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
|
||||
SCH_ITEM* ReadTextDescr( FILE * aFile,
|
||||
wxString & aMsgDiag,
|
||||
char* aLine,
|
||||
int aBufsize,
|
||||
int* aLineNum,
|
||||
int aSchematicFileVersion)
|
||||
{
|
||||
/**
|
||||
* Function ReadTextDescr
|
||||
* Reads the data structures for a Text (Comment, label, Hlabel and Hlabel
|
||||
* from a FILE in "*.brd" format.
|
||||
* @param aFile The FILE to read.
|
||||
* @param aLine The buffer used to read the first line of description.
|
||||
* @param aBufsize The size of aLine.
|
||||
* @param aLineNum a pointer to the line count.
|
||||
* @return a poiner to the new created obect if success reading else NULL.
|
||||
*/
|
||||
SCH_ITEM* Struct = NULL;
|
||||
char Name1[256];
|
||||
char Name2[256];
|
||||
char Name3[256];
|
||||
int width = 0, size = 0, orient = 0;
|
||||
wxPoint pos;
|
||||
|
||||
char* SLine = aLine;
|
||||
|
||||
while( (*SLine != ' ' ) && *SLine )
|
||||
SLine++;
|
||||
|
||||
// SLine points the start of parameters
|
||||
|
||||
Name1[0] = 0; Name2[0] = 0; Name3[0] = 0;
|
||||
int ii = sscanf( SLine, "%s %d %d %d %d %s %s %d",
|
||||
Name1, &pos.x, &pos.y, &orient, &size, Name2, Name3, &width );
|
||||
|
||||
if( ii < 4 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "EESchema file text struct error line %d, aborted" ),
|
||||
*aLineNum );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( feof( aFile ) || GetLine( aFile, aLine, aLineNum, aBufsize) == NULL )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "EESchema file text struct error line %d (No text), aborted" ),
|
||||
*aLineNum );
|
||||
return NULL;
|
||||
}
|
||||
if( size == 0 )
|
||||
size = DEFAULT_SIZE_TEXT;
|
||||
char* text = strtok( aLine, "\n\r" );
|
||||
if( text == NULL )
|
||||
return NULL;
|
||||
|
||||
if( Name1[0] == 'L' )
|
||||
{
|
||||
SCH_LABEL* TextStruct =
|
||||
new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
|
||||
|
||||
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
||||
TextStruct->m_Orient = orient;
|
||||
TextStruct->m_Width = width;
|
||||
Struct = TextStruct;
|
||||
if( stricmp( Name2, "Italic" ) == 0 )
|
||||
TextStruct->m_Italic = 1;
|
||||
}
|
||||
else if( Name1[0] == 'G' && aSchematicFileVersion > '1' )
|
||||
{
|
||||
SCH_GLOBALLABEL* TextStruct = new SCH_GLOBALLABEL( pos, CONV_FROM_UTF8( text ) );
|
||||
|
||||
Struct = TextStruct;
|
||||
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
||||
TextStruct->m_Orient = orient;
|
||||
TextStruct->m_Shape = NET_INPUT;
|
||||
TextStruct->m_Width = width;
|
||||
|
||||
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
|
||||
TextStruct->m_Shape = NET_OUTPUT;
|
||||
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
|
||||
TextStruct->m_Shape = NET_BIDI;
|
||||
if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 )
|
||||
TextStruct->m_Shape = NET_TRISTATE;
|
||||
if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 )
|
||||
TextStruct->m_Shape = NET_UNSPECIFIED;
|
||||
if( stricmp( Name3, "Italic" ) == 0 )
|
||||
TextStruct->m_Italic = 1;
|
||||
}
|
||||
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && aSchematicFileVersion == '1') )
|
||||
{ //in schematic file version 1, glabels were actually hierarchal labels.
|
||||
SCH_HIERLABEL* TextStruct = new SCH_HIERLABEL( pos, CONV_FROM_UTF8( text ) );
|
||||
|
||||
Struct = TextStruct;
|
||||
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
||||
TextStruct->m_Orient = orient;
|
||||
TextStruct->m_Shape = NET_INPUT;
|
||||
TextStruct->m_Width = width;
|
||||
|
||||
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
|
||||
TextStruct->m_Shape = NET_OUTPUT;
|
||||
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
|
||||
TextStruct->m_Shape = NET_BIDI;
|
||||
if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 )
|
||||
TextStruct->m_Shape = NET_TRISTATE;
|
||||
if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 )
|
||||
TextStruct->m_Shape = NET_UNSPECIFIED;
|
||||
if( stricmp( Name3, "Italic" ) == 0 )
|
||||
TextStruct->m_Italic = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_TEXT* TextStruct =
|
||||
new SCH_TEXT( pos, CONV_FROM_UTF8( text ) );
|
||||
|
||||
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
||||
TextStruct->m_Orient = orient;
|
||||
TextStruct->m_Width = width;
|
||||
|
||||
if( strnicmp( Name2, "Italic", 6 ) == 0 )
|
||||
TextStruct->m_Italic = 1;
|
||||
Struct = TextStruct;
|
||||
}
|
||||
|
||||
return Struct;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
int ReadSheetDescr( wxWindow* frame,
|
||||
char* Line,
|
||||
FILE* f,
|
||||
wxString& aMsgDiag, int* aLineNum,
|
||||
BASE_SCREEN* Window )
|
||||
/*************************************************************************************/
|
||||
|
||||
/* Fonction utilisee par LoadEEFile().
|
||||
* Lit les lignes relatives a la description d'une feuille de hierarchie
|
||||
*/
|
||||
{
|
||||
int ii, fieldNdx, size;
|
||||
char Name1[256], Char1[256], Char2[256];
|
||||
DrawSheetStruct* SheetStruct;
|
||||
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct, * OldSheetLabel = NULL;
|
||||
int Failed = FALSE;
|
||||
char* ptcar;
|
||||
|
||||
SheetStruct = new DrawSheetStruct();
|
||||
|
||||
SheetStruct->m_TimeStamp = GetTimeStamp();
|
||||
|
||||
//sheets are added to the EEDrawList like other schematic components.
|
||||
//however, in order to preserve the hierarchy (through m_Parent pointers),
|
||||
//a duplicate of the sheet is added to m_SubSheet array.
|
||||
//must be a duplicate, references just work for a two-layer structure.
|
||||
//this is accomplished through the Sync() function.
|
||||
|
||||
if( Line[0] == '$' ) /* Ligne doit etre "$Sheet" */
|
||||
{
|
||||
*aLineNum++;
|
||||
if( fgets( Line, 256 - 1, f ) == 0 )
|
||||
{
|
||||
aMsgDiag.Printf( wxT( "Read File Errror" ) );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Next line: must be "S xx yy nn mm" with xx, yy = sheet position
|
||||
* ( upper left corner ) et nn,mm = sheet size */
|
||||
if( (sscanf( &Line[1], "%d %d %d %d",
|
||||
&SheetStruct->m_Pos.x, &SheetStruct->m_Pos.y,
|
||||
&SheetStruct->m_Size.x, &SheetStruct->m_Size.y ) != 4)
|
||||
|| (Line[0] != 'S' ) )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( " ** EESchema file sheet struct error at line %d, aborted\n" ),
|
||||
*aLineNum );
|
||||
aMsgDiag << CONV_FROM_UTF8(Line);
|
||||
Failed = TRUE;
|
||||
return Failed;
|
||||
}
|
||||
|
||||
/* Read fields */
|
||||
for( ; ; ) /* Analyse des lignes "Fn "texte" .." */
|
||||
{
|
||||
*aLineNum++;
|
||||
if( fgets( Line, 256 - 1, f ) == NULL )
|
||||
return TRUE;
|
||||
if( Line[0] == 'U' )
|
||||
{
|
||||
sscanf( Line + 1, "%lX", &(SheetStruct->m_TimeStamp) );
|
||||
if( SheetStruct->m_TimeStamp == 0 ) //zero is not unique!
|
||||
SheetStruct->m_TimeStamp = GetTimeStamp();
|
||||
continue;
|
||||
}
|
||||
if( Line[0] != 'F' )
|
||||
break;
|
||||
sscanf( Line + 1, "%d", &fieldNdx );
|
||||
|
||||
/* Lecture du champ :
|
||||
* si fieldNdx >= 2 : Fn "texte" t s posx posy
|
||||
* sinon F0 "texte" pour sheetname
|
||||
* et F1 "texte" pour filename */
|
||||
|
||||
ptcar = Line; while( *ptcar && (*ptcar != '"') )
|
||||
ptcar++;
|
||||
|
||||
if( *ptcar != '"' )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "EESchema file sheet label F%d at line %d, aborted\n" ),
|
||||
fieldNdx, *aLineNum );
|
||||
aMsgDiag << CONV_FROM_UTF8(Line);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for( ptcar++, ii = 0; ; ii++, ptcar++ )
|
||||
{
|
||||
Name1[ii] = *ptcar;
|
||||
if( *ptcar == 0 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "EESchema file sheet field F at line %d, aborted\n" ), *aLineNum );
|
||||
aMsgDiag << CONV_FROM_UTF8(Line);
|
||||
return TRUE;
|
||||
}
|
||||
if( *ptcar == '"' )
|
||||
{
|
||||
Name1[ii] = 0; ptcar++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) )
|
||||
{
|
||||
if( sscanf( ptcar, "%d", &size ) != 1 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT(
|
||||
"EESchema file sheet Label Caract error line %d, aborted\n" ), *aLineNum );
|
||||
aMsgDiag << CONV_FROM_UTF8(Line);
|
||||
DisplayError( frame, aMsgDiag );
|
||||
}
|
||||
if( size == 0 )
|
||||
size = DEFAULT_SIZE_TEXT;
|
||||
if( fieldNdx == 0 )
|
||||
{
|
||||
SheetStruct->m_SheetName = CONV_FROM_UTF8( Name1 );
|
||||
SheetStruct->m_SheetNameSize = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
SheetStruct->SetFileName( CONV_FROM_UTF8( Name1 ) );
|
||||
|
||||
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
|
||||
SheetStruct->m_FileNameSize = size;
|
||||
}
|
||||
}
|
||||
|
||||
if( fieldNdx > 1 )
|
||||
{
|
||||
SheetLabelStruct = new Hierarchical_PIN_Sheet_Struct( SheetStruct,
|
||||
wxPoint( 0,
|
||||
0 ),
|
||||
CONV_FROM_UTF8( Name1 ) );
|
||||
|
||||
if( SheetStruct->m_Label == NULL )
|
||||
OldSheetLabel = SheetStruct->m_Label = SheetLabelStruct;
|
||||
else
|
||||
OldSheetLabel->SetNext( (EDA_BaseStruct*) SheetLabelStruct );
|
||||
OldSheetLabel = SheetLabelStruct;
|
||||
|
||||
/* Lecture des coordonnees */
|
||||
if( sscanf( ptcar, "%s %s %d %d %d", Char1, Char2,
|
||||
&SheetLabelStruct->m_Pos.x, &SheetLabelStruct->m_Pos.y,
|
||||
&size ) != 5 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT(
|
||||
"EESchema file Sheet Label Caract error line %d, aborted\n" ), *aLineNum );
|
||||
aMsgDiag << CONV_FROM_UTF8(Line);
|
||||
DisplayError( frame, aMsgDiag );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( size == 0 )
|
||||
size = DEFAULT_SIZE_TEXT;
|
||||
SheetLabelStruct->m_Size.x = SheetLabelStruct->m_Size.y = size;
|
||||
|
||||
/* Mise a jour des cadrage et type */
|
||||
switch( Char1[0] )
|
||||
{
|
||||
case 'I':
|
||||
SheetLabelStruct->m_Shape = NET_INPUT; break;
|
||||
|
||||
case 'O':
|
||||
SheetLabelStruct->m_Shape = NET_OUTPUT; break;
|
||||
|
||||
case 'B':
|
||||
SheetLabelStruct->m_Shape = NET_BIDI; break;
|
||||
|
||||
case 'T':
|
||||
SheetLabelStruct->m_Shape = NET_TRISTATE; break;
|
||||
|
||||
case 'U':
|
||||
SheetLabelStruct->m_Shape = NET_UNSPECIFIED; break;
|
||||
}
|
||||
|
||||
if( Char2[0] == 'R' )
|
||||
SheetLabelStruct->m_Edge = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( strnicmp( "$End", Line, 4 ) != 0 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( " **EESchema file end_sheet struct error at line %d, aborted\n" ),
|
||||
*aLineNum );
|
||||
aMsgDiag << CONV_FROM_UTF8(Line);
|
||||
Failed = TRUE;
|
||||
}
|
||||
if( !Failed )
|
||||
{
|
||||
SheetStruct->SetNext( Window->EEDrawList );
|
||||
Window->EEDrawList = SheetStruct;
|
||||
SheetStruct->SetParent( Window );
|
||||
}
|
||||
return Failed; /* Fin lecture 1 composant */
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
bool ReadSchemaDescr( wxWindow* frame,
|
||||
char* Line,
|
||||
FILE* f,
|
||||
wxString& aMsgDiag, int* aLineNum,
|
||||
BASE_SCREEN* Window )
|
||||
/******************************************************************/
|
||||
|
||||
/* Analyse de l'entete du schema ( dims feuille, cartouche..)
|
||||
*/
|
||||
{
|
||||
char Text[256], buf[1024];
|
||||
int ii;
|
||||
Ki_PageDescr* wsheet = &g_Sheet_A4;
|
||||
static Ki_PageDescr* SheetFormatList[] = {
|
||||
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
|
||||
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
|
||||
&g_Sheet_user, NULL
|
||||
};
|
||||
wxSize PageSize;
|
||||
|
||||
sscanf( Line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
|
||||
/* Recherche de la descr correspondante: */
|
||||
wxString pagename = CONV_FROM_UTF8( Text );
|
||||
for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
|
||||
{
|
||||
wsheet = SheetFormatList[ii];
|
||||
if( wsheet->m_Name.CmpNoCase( pagename ) == 0 )
|
||||
{ /* Descr found ! */
|
||||
if( wsheet == &g_Sheet_user ) // Get the user page size and make it the default
|
||||
{
|
||||
g_Sheet_user.m_Size = PageSize;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( SheetFormatList[ii] == NULL )
|
||||
{
|
||||
/* Erreur ici: descr non trouvee */
|
||||
aMsgDiag.Printf(
|
||||
wxT( "EESchema file Dims Caract error line %d, aborted\n" ), *aLineNum );
|
||||
aMsgDiag << CONV_FROM_UTF8(Line);
|
||||
DisplayError( frame, aMsgDiag );
|
||||
}
|
||||
|
||||
/* Ajuste ecran */
|
||||
Window->m_CurrentSheetDesc = wsheet;
|
||||
|
||||
/* Recheche suite et fin de descr */
|
||||
for( ; ; )
|
||||
{
|
||||
if( GetLine( f, Line, aLineNum, 1024 ) == NULL )
|
||||
return TRUE;
|
||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||
break;
|
||||
|
||||
if( strnicmp( Line, "Sheet", 2 ) == 0 )
|
||||
sscanf( Line + 5, " %d %d",
|
||||
&Window->m_ScreenNumber, &Window->m_NumberOfScreen );
|
||||
|
||||
if( strnicmp( Line, "Title", 2 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Title = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Date", 2 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Date = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Rev", 2 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Revision = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comp", 4 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Company = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment1", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Commentaire1 = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment2", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Commentaire2 = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment3", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Commentaire3 = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "Comment4", 8 ) == 0 )
|
||||
{
|
||||
ReadDelimitedText( buf, Line, 256 );
|
||||
Window->m_Commentaire4 = CONV_FROM_UTF8( buf );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
|
||||
wxString& aMsgDiag, int* aLineNum,
|
||||
BASE_SCREEN* Window )
|
||||
/*************************************************************/
|
||||
|
||||
/* Fonction utilisee par LoadEEFile().
|
||||
* Lit les lignes relatives a la description d'un composant en schema
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
char Name1[256], Name2[256],
|
||||
Char1[256], Char2[256], Char3[256];
|
||||
SCH_COMPONENT* component;
|
||||
int Failed = 0, newfmt = 0;
|
||||
char* ptcar;
|
||||
wxString fieldName;
|
||||
|
||||
|
||||
component = new SCH_COMPONENT();
|
||||
|
||||
component->m_Convert = 1;
|
||||
|
||||
if( Line[0] == '$' )
|
||||
{
|
||||
newfmt = 1;
|
||||
*aLineNum++;
|
||||
if( fgets( Line, 256 - 1, f ) == 0 )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Traitement de la 1ere ligne de description */
|
||||
if( sscanf( &Line[1], "%s %s", Name1, Name2 ) != 2 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "EESchema Component descr error at line %d, aborted" ),
|
||||
*aLineNum );
|
||||
aMsgDiag << wxT("\n") << CONV_FROM_UTF8(Line);
|
||||
Failed = TRUE;
|
||||
return Failed;
|
||||
}
|
||||
|
||||
if( strcmp( Name1, NULL_STRING ) != 0 )
|
||||
{
|
||||
for( ii = 0; ii < (int) strlen( Name1 ); ii++ )
|
||||
if( Name1[ii] == '~' )
|
||||
Name1[ii] = ' ';
|
||||
|
||||
component->m_ChipName = CONV_FROM_UTF8( Name1 );
|
||||
if( !newfmt )
|
||||
component->GetField( VALUE )->m_Text = CONV_FROM_UTF8( Name1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
component->m_ChipName.Empty();
|
||||
component->GetField( VALUE )->m_Text.Empty();
|
||||
component->GetField( VALUE )->m_Orient = TEXT_ORIENT_HORIZ;
|
||||
component->GetField( VALUE )->m_Attributs = TEXT_NO_VISIBLE;
|
||||
}
|
||||
|
||||
if( strcmp( Name2, NULL_STRING ) != 0 )
|
||||
{
|
||||
bool isDigit = false;
|
||||
for( ii = 0; ii < (int) strlen( Name2 ); ii++ )
|
||||
{
|
||||
if( Name2[ii] == '~' )
|
||||
Name2[ii] = ' ';
|
||||
|
||||
// get RefBase from this, too. store in Name1.
|
||||
if( Name2[ii] >= '0' && Name2[ii] <= '9' )
|
||||
{
|
||||
isDigit = true;
|
||||
Name1[ii] = 0; //null-terminate.
|
||||
}
|
||||
if( !isDigit )
|
||||
{
|
||||
Name1[ii] = Name2[ii];
|
||||
}
|
||||
}
|
||||
|
||||
Name1[ii] = 0; //just in case
|
||||
int jj;
|
||||
for( jj = 0; jj<ii && Name1[jj] == ' '; jj++ )
|
||||
;
|
||||
|
||||
if( jj == ii )
|
||||
{
|
||||
// blank string.
|
||||
component->m_PrefixString = wxT( "U" );
|
||||
}
|
||||
else
|
||||
{
|
||||
component->m_PrefixString = CONV_FROM_UTF8( &Name1[jj] );
|
||||
|
||||
//printf("prefix: %s\n", CONV_TO_UTF8(component->m_PrefixString));
|
||||
}
|
||||
if( !newfmt )
|
||||
component->GetField( REFERENCE )->m_Text = CONV_FROM_UTF8( Name2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
component->GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE;
|
||||
}
|
||||
|
||||
/* Traitement des autres lignes de description */
|
||||
|
||||
/* Ces lignes commencent par:
|
||||
* "P " = position
|
||||
* "U " = Num Unit, et Conversion
|
||||
* "Fn" = Champs ( n = 0.. = numero de champ )
|
||||
* "Ar" = AlternateReference, in the case of multiple sheets
|
||||
* referring to one schematic file.
|
||||
*/
|
||||
|
||||
/* Lecture des champs */
|
||||
for( ; ; )
|
||||
{
|
||||
*aLineNum++;
|
||||
if( fgets( Line, 256 - 1, f ) == NULL )
|
||||
return TRUE;
|
||||
|
||||
if( Line[0] == 'U' ) /* Lecture num multi, conversion et time stamp */
|
||||
{
|
||||
sscanf( Line + 1, "%d %d %lX",
|
||||
&component->m_Multi, &component->m_Convert,
|
||||
&component->m_TimeStamp );
|
||||
}
|
||||
else if( Line[0] == 'P' )
|
||||
{
|
||||
sscanf( Line + 1, "%d %d",
|
||||
&component->m_Pos.x, &component->m_Pos.y );
|
||||
}
|
||||
else if( Line[0] == 'A' && Line[1] == 'R' )
|
||||
{
|
||||
/* format:
|
||||
* AR Path="/9086AF6E/67452AA0" Ref="C99" Part="1"
|
||||
* where 9086AF6E is the unique timestamp of the containing sheet
|
||||
* and 67452AA0 is the timestamp of this component.
|
||||
* C99 is the reference given this path.
|
||||
*/
|
||||
int ii;
|
||||
ptcar = Line + 2;
|
||||
|
||||
//copy the path.
|
||||
ii = ReadDelimitedText( Name1, ptcar, 255 );
|
||||
ptcar += ii + 1;
|
||||
wxString path = CONV_FROM_UTF8( Name1 );
|
||||
|
||||
// copy the reference
|
||||
ii = ReadDelimitedText( Name1, ptcar, 255 );
|
||||
ptcar += ii + 1;
|
||||
wxString ref = CONV_FROM_UTF8( Name1 );
|
||||
|
||||
// copy the multi, if exists
|
||||
ii = ReadDelimitedText( Name1, ptcar, 255 );
|
||||
if( Name1[0] == 0 ) // Nothing read, put a default value
|
||||
sprintf( Name1, "%d", component->m_Multi );
|
||||
int multi = atoi( Name1 );
|
||||
if( multi < 0 || multi > 25 )
|
||||
multi = 1;
|
||||
component->AddHierarchicalReference( path, ref, multi );
|
||||
component->GetField( REFERENCE )->m_Text = ref;
|
||||
}
|
||||
else if( Line[0] == 'F' )
|
||||
{
|
||||
int fieldNdx;
|
||||
|
||||
char FieldUserName[1024];
|
||||
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
|
||||
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||
|
||||
FieldUserName[0] = 0;
|
||||
|
||||
/* Lecture du champ */
|
||||
ptcar = Line;
|
||||
|
||||
while( *ptcar && (*ptcar != '"') )
|
||||
ptcar++;
|
||||
|
||||
if( *ptcar != '"' )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "EESchema file lib field F at line %d, aborted" ),
|
||||
*aLineNum );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for( ptcar++, ii = 0; ; ii++, ptcar++ )
|
||||
{
|
||||
Name1[ii] = *ptcar;
|
||||
if( *ptcar == 0 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "Component field F at line %d, aborted" ),
|
||||
*aLineNum );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if( *ptcar == '"' )
|
||||
{
|
||||
Name1[ii] = 0;
|
||||
ptcar++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fieldNdx = atoi( Line + 2 );
|
||||
|
||||
ReadDelimitedText( FieldUserName, ptcar, sizeof(FieldUserName) );
|
||||
|
||||
if( !FieldUserName[0] )
|
||||
fieldName = ReturnDefaultFieldName( fieldNdx );
|
||||
else
|
||||
fieldName = CONV_FROM_UTF8( FieldUserName );
|
||||
|
||||
if( fieldNdx >= component->GetFieldCount() )
|
||||
{
|
||||
// add as many fields as needed so the m_FieldId's are contiguous, no gaps.
|
||||
while( fieldNdx >= component->GetFieldCount() )
|
||||
{
|
||||
int newNdx = component->GetFieldCount();
|
||||
|
||||
SCH_CMP_FIELD f( wxPoint( 0, 0 ), newNdx, component, fieldName );
|
||||
component->AddField( f );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
component->GetField( fieldNdx )->m_Name = fieldName;
|
||||
}
|
||||
|
||||
component->GetField( fieldNdx )->m_Text = CONV_FROM_UTF8( Name1 );
|
||||
|
||||
if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1,
|
||||
&component->GetField( fieldNdx )->m_Pos.x,
|
||||
&component->GetField( fieldNdx )->m_Pos.y,
|
||||
&component->GetField( fieldNdx )->m_Size.x,
|
||||
&component->GetField( fieldNdx )->m_Attributs,
|
||||
Char2, Char3 ) ) < 4 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "Component Field error line %d, aborted" ),
|
||||
*aLineNum );
|
||||
DisplayError( frame, aMsgDiag );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( (component->GetField( fieldNdx )->m_Size.x == 0 ) || (ii == 4) )
|
||||
component->GetField( fieldNdx )->m_Size.x = DEFAULT_SIZE_TEXT;
|
||||
|
||||
component->GetField( fieldNdx )->m_Orient = TEXT_ORIENT_HORIZ;
|
||||
component->GetField( fieldNdx )->m_Size.y = component->GetField( fieldNdx )->m_Size.x;
|
||||
|
||||
if( Char1[0] == 'V' )
|
||||
component->GetField( fieldNdx )->m_Orient = TEXT_ORIENT_VERT;
|
||||
|
||||
if( ii >= 7 )
|
||||
{
|
||||
if( *Char2 == 'L' )
|
||||
hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||
else if( *Char2 == 'R' )
|
||||
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
||||
if( *Char3 == 'B' )
|
||||
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
||||
else if( *Char3 == 'T' )
|
||||
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
||||
|
||||
component->GetField( fieldNdx )->m_HJustify = hjustify;
|
||||
component->GetField( fieldNdx )->m_VJustify = vjustify;
|
||||
}
|
||||
|
||||
if( fieldNdx == REFERENCE )
|
||||
if( component->GetField( fieldNdx )->m_Text[0] == '#' )
|
||||
component->GetField( fieldNdx )->m_Attributs |= TEXT_NO_VISIBLE;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* Lecture multi et position du composant */
|
||||
if( sscanf( Line, "%d %d %d",
|
||||
&component->m_Multi,
|
||||
&component->m_Pos.x, &component->m_Pos.y ) != 3 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "Component unit & pos error at line %d, aborted" ),
|
||||
*aLineNum );
|
||||
Failed = TRUE;
|
||||
return Failed;
|
||||
}
|
||||
|
||||
/* Lecture de la matrice de miroir / rotation */
|
||||
*aLineNum++;
|
||||
if( (fgets( Line, 256 - 1, f ) == NULL)
|
||||
|| (sscanf( Line, "%d %d %d %d",
|
||||
&component->m_Transform[0][0],
|
||||
&component->m_Transform[0][1],
|
||||
&component->m_Transform[1][0],
|
||||
&component->m_Transform[1][1] ) != 4) )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "Component orient error at line %d, aborted" ),
|
||||
*aLineNum );
|
||||
Failed = TRUE;
|
||||
return Failed;
|
||||
}
|
||||
|
||||
if( newfmt )
|
||||
{
|
||||
*aLineNum++;
|
||||
if( fgets( Line, 256 - 1, f ) == NULL )
|
||||
return TRUE;
|
||||
if( strnicmp( "$End", Line, 4 ) != 0 )
|
||||
{
|
||||
aMsgDiag.Printf(
|
||||
wxT( "Component End expected at line %d, aborted" ),
|
||||
*aLineNum );
|
||||
Failed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if( !Failed )
|
||||
{
|
||||
component->SetNext( Window->EEDrawList );
|
||||
Window->EEDrawList = component;
|
||||
component->SetParent( Window );
|
||||
}
|
||||
|
||||
return Failed; /* Fin lecture 1 composant */
|
||||
}
|
||||
|
|
@ -509,8 +509,9 @@ public:
|
|||
/**
|
||||
* Function Pitch
|
||||
* @return distance between 2 characters
|
||||
* @param aMinTickness = min segments tickness
|
||||
*/
|
||||
int Pitch();
|
||||
int Pitch(int aMinTickness = 0);
|
||||
|
||||
/** Function Draw
|
||||
* @param aPanel = the current DrawPanel
|
||||
|
|
|
@ -461,6 +461,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
|||
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
|
||||
* @param aH_justify = horizontal justification (Left, center, right)
|
||||
* @param aV_justify = vertical justification (bottom, center, top)
|
||||
* @param aWidth = line width (pen width) (default = 0)
|
||||
* if width < 0 : draw segments in sketch mode, width = abs(width)
|
||||
* @param aItalic = true to simulate an italic font
|
||||
*/
|
||||
void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor,
|
||||
|
@ -468,7 +470,7 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
|
|||
int aOrient, const wxSize& aSize,
|
||||
enum GRTextHorizJustifyType aH_justify,
|
||||
enum GRTextVertJustifyType aV_justify,
|
||||
bool aItalic = false );
|
||||
int aWidth, bool aItalic = false );
|
||||
|
||||
/***************/
|
||||
/* CONFIRM.CPP */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*******************************************************************/
|
||||
/* Functions relatives to tracks, vias and zones(see class_track.h */
|
||||
/*******************************************************************/
|
||||
/***********************************************************************/
|
||||
/* Functions relatives to tracks, vias and segments used to fill zones */
|
||||
/* (see class_track.h ) */
|
||||
/***********************************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -636,11 +637,13 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
|
|||
m_Width + (g_DesignSettings.m_TrackClearence * 2), color );
|
||||
}
|
||||
|
||||
/* Display the short netname:
|
||||
/* Display the short netname for tracks, not for zone segments.
|
||||
* we must filter tracks, to avoid a lot of texts.
|
||||
* - only horizontal or vertical tracks are eligible
|
||||
* - only tracks with a length > 10 * thickness are eligible
|
||||
*/
|
||||
if( Type() == TYPE_ZONE )
|
||||
return;
|
||||
|
||||
#define THRESHOLD 10
|
||||
if( (m_End.x - m_Start.x) != 0 && (m_End.y - m_Start.y) != 0 )
|
||||
|
@ -651,6 +654,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
|
|||
if( len < THRESHOLD * m_Width )
|
||||
return;
|
||||
|
||||
if( ( m_Width / zoom) < 6 ) // no room to display a text inside track
|
||||
return;
|
||||
|
||||
if( GetNet() == 0 )
|
||||
return;
|
||||
EQUIPOT* net = ( (BOARD*) GetParent() )->FindNet( GetNet() );
|
||||
|
|
Loading…
Reference in New Issue