Commit acf03b7d authored by CHARRAS's avatar CHARRAS

Global labels problems fixed (see changelog)

parent 9086e68d
...@@ -5,6 +5,13 @@ Started 2007-June-11 ...@@ -5,6 +5,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Feb-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
Fixed bug in getpart.cpp:
eeschema crashed when aborting a new component place command
Global Symbols now have their shapes
Bad global label shape fixed when reading a schematic file
2008-Feb-20 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Feb-20 UPDATE Dick Hollenbeck <dick@softplc.com>
......
/* XPM */
static const char *lang_chinese_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 16 1",
". c #E42814",
"X c #DC1A1C",
"& c #FCFE04",
"; c #EC6A14",
"% c #FCF20C",
"# c #EC5E14",
"$ c #F4B20C",
"+ c #DB031C",
"@ c #F4A60C",
"o c #DC0D1C",
"O c #E43E14",
"* c #F49A0C",
"- c #E45214",
" c #DC1519",
"= c #EC7A0C",
": c #E44614",
/* pixels */
" .. . X",
"X oO+ o@#+ ",
" ++$ ++o+@o . X",
"X.%&&*o o= ",
" +.&&+ + + . X",
"Xo-+O oo& ",
" o o#.++. X",
" X ;: . ",
" . . oo X",
"X . . ",
" . . . X",
"X ",
" . . . . . X",
"XX X X",
"X X X X X X",
"XXXXXXXXXXXXXXXX"
};
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "Lang_Ko.xpm" #include "Lang_Ko.xpm"
#include "Lang_Ru.xpm" #include "Lang_Ru.xpm"
#include "Lang_Catalan.xpm" #include "Lang_Catalan.xpm"
#include "Lang_chinese.xpm"
#endif #endif
...@@ -572,7 +573,7 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu ) ...@@ -572,7 +573,7 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_CHINESE_SIMPLIFIED, item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_CHINESE_SIMPLIFIED,
_( "Chinese simplified" ), wxEmptyString, wxITEM_CHECK ); _( "Chinese simplified" ), wxEmptyString, wxITEM_CHECK );
//SETBITMAPS( lang_chinese_simplified_xpm ); SETBITMAPS( lang_chinese_xpm );
m_Language_Menu->Append( item ); m_Language_Menu->Append( item );
} }
......
...@@ -16,71 +16,6 @@ ...@@ -16,71 +16,6 @@
#define NB_MAX_SHEET 500 #define NB_MAX_SHEET 500
/* Type des labels sur sheet (Labels sur hierarchie) et forme des Global-Labels*/
typedef enum {
NET_INPUT,
NET_OUTPUT,
NET_BIDI,
NET_TRISTATE,
NET_UNSPECIFIED,
NET_TMAX /* Derniere valeur: fin de tableau */
} TypeSheetLabel;
/* Messages correspondants aux types ou forme des labels */
#ifdef MAIN
const char* SheetLabelType[] =
{
"Input",
"Output",
"BiDi",
"3State",
"UnSpc",
"?????"
};
#else
extern const char* SheetLabelType[];
#endif
/* Description du graphisme des icones associes aux types des Global_Labels */
#ifdef MAIN
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int* TemplateShape[5][4] =
{
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
};
#else
extern int* TemplateShape[5][4];
#endif
/* Forward declarations */ /* Forward declarations */
class DrawSheetStruct; class DrawSheetStruct;
extern DrawSheetStruct* g_RootSheet; extern DrawSheetStruct* g_RootSheet;
......
...@@ -6,9 +6,11 @@ ...@@ -6,9 +6,11 @@
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "trigo.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "id.h" #include "id.h"
#include "protos.h" #include "protos.h"
...@@ -48,12 +50,12 @@ DrawTextStruct* DrawTextStruct::GenCopy() ...@@ -48,12 +50,12 @@ DrawTextStruct* DrawTextStruct::GenCopy()
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
newitem = new DrawGlobalLabelStruct(m_Pos, m_Text ); newitem = new DrawGlobalLabelStruct( m_Pos, m_Text );
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_HIER_LABEL_STRUCT_TYPE:
newitem = new DrawHierLabelStruct(m_Pos, m_Text ); newitem = new DrawHierLabelStruct( m_Pos, m_Text );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
newitem = new DrawLabelStruct( m_Pos, m_Text ); newitem = new DrawLabelStruct( m_Pos, m_Text );
...@@ -120,30 +122,33 @@ DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) : ...@@ -120,30 +122,33 @@ DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) :
/****************************************************************************/ /****************************************************************************/
{ {
m_Layer = LAYER_LOCLABEL; m_Layer = LAYER_LOCLABEL;
m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
/***********************************************************************************/ /***********************************************************************************/
DrawGlobalLabelStruct::DrawGlobalLabelStruct(const wxPoint& pos, const wxString& text) : DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString& text ) :
DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE ) DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_BIDI; m_Shape = NET_BIDI;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
/***********************************************************************************/ /***********************************************************************************/
DrawHierLabelStruct::DrawHierLabelStruct(const wxPoint& pos, const wxString& text) : DrawHierLabelStruct::DrawHierLabelStruct( const wxPoint& pos, const wxString& text ) :
DrawTextStruct( pos, text, DRAW_HIER_LABEL_STRUCT_TYPE ) DrawTextStruct( pos, text, DRAW_HIER_LABEL_STRUCT_TYPE )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_HIERLABEL; m_Layer = LAYER_HIERLABEL;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
/*******************************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
...@@ -215,141 +220,249 @@ void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of ...@@ -215,141 +220,249 @@ void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
/*******************************************************************************************/ /*******************************************************************************************/
void DrawHierLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawHierLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
{ {
int* Template; int Poly[40];
int Poly[20]; int ii, color;
int ii, jj, imax, color, HalfSize; wxPoint AnchorPos = m_Pos + offset;;
wxSize Size = m_Size;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
color = Color; color = Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
HalfSize = Size.x / 2; ii = Size.x + TXTMARGE; ii = m_Size.x + TXTMARGE;
switch( m_Orient ) switch( m_Orient )
{
case 0: /* Orientation horiz normale */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x - ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
break;
case 1: /* Orientation vert UP */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y + ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
break;
case 2: /* Orientation horiz inverse */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
break;
case 3: /* Orientation vert BOTTOM */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y - ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
break;
}
Template = TemplateShape[m_Shape][m_Orient];
imax = *Template; Template++;
for( ii = 0, jj = 0; ii < imax; ii++ )
{ {
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x; case 0: /* Orientation horiz normale */
jj++; Template++; DrawGraphicText( panel, DC,
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.y + offset.y; wxPoint( AnchorPos.x - ii, AnchorPos.y ), color,
jj++; Template++; m_Text, TEXT_ORIENT_HORIZ, m_Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
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 );
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 );
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 );
break;
} }
GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color ); CreateGraphicShape( Poly, AnchorPos );
GRPoly( &panel->m_ClipBox, DC, Poly[0], Poly + 1, 0, width, color, color );
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
} }
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape
* format list is
* corner_count, x0, y0, ... xn, yn
*/
void DrawHierLabelStruct::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
{
int* Template = TemplateShape[m_Shape][m_Orient];
int HalfSize = m_Size.x / 2;
int imax = *Template; Template++;
*corner_list = imax; corner_list++;
for( int ii = 0; ii < imax; ii++ )
{
*corner_list = ( HalfSize * (*Template) ) + Pos.x;
corner_list++; Template++;
*corner_list = ( HalfSize * (*Template) ) + Pos.y;
corner_list++; Template++;
}
}
/*******************************************************************************************/ /*******************************************************************************************/
void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& draw_offset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
//should reimplement this with a custom global shape??
//it is the same as Hierarchal sheet.
{ {
int* Template; int Poly[20];
int Poly[20]; int offset, color, HalfSize;
int ii, jj, imax, color, HalfSize; wxPoint AnchorPos = m_Pos + draw_offset;;
wxSize Size = m_Size;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
color = Color; color = Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
HalfSize = Size.x / 2; ii = Size.x + TXTMARGE; HalfSize = m_Size.x / 2;
offset = width;
switch( m_Orient )
{ switch( m_Shape )
case 0: /* Orientation horiz normale */ {
DrawGraphicText( panel, DC, case NET_INPUT:
wxPoint( m_Pos.x - ii + offset.x, m_Pos.y + offset.y ), color, case NET_BIDI:
m_Text, TEXT_ORIENT_HORIZ, Size, case NET_TRISTATE:
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width ); offset += HalfSize;
break; break;
case 1: /* Orientation vert UP */ case NET_OUTPUT:
DrawGraphicText( panel, DC, offset += TXTMARGE;
wxPoint( m_Pos.x + offset.x, m_Pos.y + ii + offset.y ), color, break;
m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width ); default:
break; break;
}
case 2: /* Orientation horiz inverse */
DrawGraphicText( panel, DC, switch( m_Orient )
wxPoint( m_Pos.x + ii + offset.x, m_Pos.y + offset.y ), color, {
m_Text, TEXT_ORIENT_HORIZ, Size, case 0: /* Orientation horiz normale */
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width ); DrawGraphicText( panel, DC,
break; wxPoint( AnchorPos.x - offset, AnchorPos.y ), color,
m_Text, TEXT_ORIENT_HORIZ, m_Size,
case 3: /* Orientation vert BOTTOM */ GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
DrawGraphicText( panel, DC, break;
wxPoint( m_Pos.x + offset.x, m_Pos.y - ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size, case 1: /* Orientation vert UP */
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width ); DrawGraphicText( panel, DC,
break; wxPoint( AnchorPos.x, AnchorPos.y + offset ), color,
} m_Text, TEXT_ORIENT_VERT, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
Template = TemplateShape[m_Shape][m_Orient]; break;
imax = *Template; Template++; case 2: /* Orientation horiz inverse */
for( ii = 0, jj = 0; ii < imax; ii++ ) DrawGraphicText( panel, DC,
{ wxPoint( AnchorPos.x + offset, AnchorPos.y ), color,
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x; m_Text, TEXT_ORIENT_HORIZ, m_Size,
jj++; Template++; GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.y + offset.y; break;
jj++; Template++;
} case 3: /* Orientation vert BOTTOM */
DrawGraphicText( panel, DC,
GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color ); wxPoint( AnchorPos.x, AnchorPos.y - offset ), color,
m_Text, TEXT_ORIENT_VERT, m_Size,
if( m_IsDangling ) GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); break;
}
CreateGraphicShape( Poly, AnchorPos );
GRPoly( &panel->m_ClipBox, DC, Poly[0], Poly + 1, 0, width, color, color );
if( m_IsDangling )
DrawDanglingSymbol( panel, DC, AnchorPos, color );
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = oordinates list fill with polygon corners ooordinates (size >= 14)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void DrawGlobalLabelStruct::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
{
int HalfSize = m_Size.x / 2;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
*corner_list = 7; corner_list++; // 7 corners in list
int symb_len = Len_Size() + (TXTMARGE * 2); // Real text len + text margin
// Create outline shape : 6 points
int x = symb_len + width + 3;
int y = HalfSize + width + 3;
corner_list[0] = 0; corner_list[1] = 0; // Starting point (anchor)
corner_list[2] = 0; corner_list[3] = -y; // Up
corner_list[4] = -x; corner_list[5] = -y; // left Up
corner_list[6] = -x; corner_list[7] = 0; // left
corner_list[8] = -x; corner_list[9] = y; // left down
corner_list[10] = 0; corner_list[11] = y; // down
int x_offset = 0;
switch( m_Shape )
{
case NET_INPUT:
x_offset = -HalfSize;
corner_list[0] += HalfSize;
break;
case NET_OUTPUT:
corner_list[6] -= HalfSize;
break;
case NET_BIDI:
case NET_TRISTATE:
x_offset = -HalfSize;
corner_list[0] += HalfSize;
corner_list[6] -= HalfSize;
break;
case NET_UNSPECIFIED:
default:
break;
}
int angle = 0;
switch( m_Orient )
{
case 0: /* Orientation horiz normale */
break;
case 1: /* Orientation vert UP */
angle = 900;
break;
case 2: /* Orientation horiz inverse */
angle = 1800;
break;
case 3: /* Orientation vert BOTTOM */
angle = -900;
break;
}
// Rotate outlines and move in real position
for( int ii = 0; ii < 12; ii += 2 )
{
corner_list[ii] += x_offset;
if( angle )
RotatePoint( &corner_list[ii], &corner_list[ii + 1], angle );
corner_list[ii] += Pos.x;
corner_list[ii + 1] += Pos.y;
}
corner_list[12] = corner_list[0]; corner_list[13] = corner_list[1]; // closing
} }
/********************************************/
/* Definitions for the EESchema program: */
/********************************************/
#ifndef CLASS_TEXT_LABEL_H
#define CLASS_TEXT_LABEL_H
#ifndef eda_global
#define eda_global extern
#endif
#include "macros.h"
#include "base_struct.h"
/* Type des labels sur sheet (Labels sur hierarchie) et forme des Global-Labels*/
typedef enum {
NET_INPUT,
NET_OUTPUT,
NET_BIDI,
NET_TRISTATE,
NET_UNSPECIFIED,
NET_TMAX /* Derniere valeur: fin de tableau */
} TypeSheetLabel;
/* Messages correspondants aux types ou forme des labels */
#ifdef MAIN
const char* SheetLabelType[] =
{
"Input",
"Output",
"BiDi",
"3State",
"UnSpc",
"?????"
};
#else
extern const char* SheetLabelType[];
#endif
/* Description du graphisme des icones associes aux types des Global_Labels */
#ifdef MAIN
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int* TemplateShape[5][4] =
{
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
};
#else
extern int* TemplateShape[5][4];
#endif
class DrawTextStruct : public EDA_BaseStruct
, public EDA_TextStruct
{
public:
int m_Layer;
int m_Shape;
bool m_IsDangling; // TRUE si non connect�
public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
~DrawTextStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawText" );
}
DrawTextStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
void SwapData( DrawTextStruct* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
};
class DrawLabelStruct : public DrawTextStruct
{
public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~DrawLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawLabel" );
}
};
class DrawGlobalLabelStruct : public DrawTextStruct
{
public:
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~DrawGlobalLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawGlobalLabel" );
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
};
class DrawHierLabelStruct : public DrawTextStruct
{
public:
DrawHierLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~DrawHierLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawHierLabel" );
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size >= 14)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
};
#endif /* CLASS_TEXT_LABEL_H */
...@@ -321,6 +321,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -321,6 +321,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */ if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
{ {
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
DrawLibItem->m_Flags = 0;
SAFE_DELETE( DrawLibItem ); SAFE_DELETE( DrawLibItem );
} }
else if( DrawLibItem ) /* Deplacement ancien composant en cours */ else if( DrawLibItem ) /* Deplacement ancien composant en cours */
...@@ -335,9 +336,9 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -335,9 +336,9 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
memcpy( DrawLibItem->m_Transform, OldTransMat, sizeof(OldTransMat) ); memcpy( DrawLibItem->m_Transform, OldTransMat, sizeof(OldTransMat) );
DrawLibItem->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawLibItem->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawLibItem->m_Flags = 0;
} }
DrawLibItem->m_Flags = 0;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
Panel->m_Parent->GetScreen()->SetCurItem( NULL ); Panel->m_Parent->GetScreen()->SetCurItem( NULL );
......
...@@ -389,6 +389,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -389,6 +389,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT; TextStruct->m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
...@@ -399,12 +400,13 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -399,12 +400,13 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
TextStruct->m_Shape = NET_UNSPECIFIED; TextStruct->m_Shape = NET_UNSPECIFIED;
} }
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1')) else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1'))
{ //in sschematic file version 1, glabels were actually hierarchal labels. { //in schematic file version 1, glabels were actually hierarchal labels.
DrawHierLabelStruct* TextStruct = DrawHierLabelStruct* TextStruct =
new DrawHierLabelStruct(pos, CONV_FROM_UTF8( text ) ); new DrawHierLabelStruct(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT; TextStruct->m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
......
/************************************************/ /************************************************/
/* Routine de trace communes aux divers formats */ /* Routine de trace communes aux divers formats */
/************************************************/ /************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -15,730 +15,781 @@ ...@@ -15,730 +15,781 @@
#include "protos.h" #include "protos.h"
/* Variables locales : */ /* Variables locales : */
static void PlotSheetLabelStruct(DrawSheetLabelStruct *Struct); static void PlotSheetLabelStruct( DrawSheetLabelStruct* Struct );
static void PlotTextField( EDA_SchComponentStruct *DrawLibItem, static void PlotTextField( EDA_SchComponentStruct* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode); int FieldNumber, int IsMulti, int DrawMode );
static void PlotPinSymbol(int posX, int posY, int len, int orient, int Shape); static void PlotPinSymbol( int posX, int posY, int len, int orient, int Shape );
/***/ /***/
/* cte pour remplissage de polygones */ /* cte pour remplissage de polygones */
#define FILL 1 #define FILL 1
#define NOFILL 0 #define NOFILL 0
#define PLOT_SHEETREF_MARGIN 0 // margin for sheet refs #define PLOT_SHEETREF_MARGIN 0 // margin for sheet refs
/*******************************/
/* Routines de base de trace : */
/*******************************/
/*******************************/
/* Routines de base de trace : */
/*******************************/
/* routine de lever ou baisser de plume. /* routine de lever ou baisser de plume.
si plume = 'U' les traces suivants se feront plume levee * si plume = 'U' les traces suivants se feront plume levee
si plume = 'D' les traces suivants se feront plume levee * si plume = 'D' les traces suivants se feront plume levee
*/ */
void Plume( int plume ) void Plume( int plume )
{ {
if ( g_PlotFormat == PLOT_FORMAT_HPGL ) Plume_HPGL(plume); if( g_PlotFormat == PLOT_FORMAT_HPGL )
Plume_HPGL( plume );
} }
/* routine de deplacement de plume de plume. /* routine de deplacement de plume de plume.
*/ */
void Move_Plume( wxPoint pos, int plume ) void Move_Plume( wxPoint pos, int plume )
{ {
switch ( g_PlotFormat ) switch( g_PlotFormat )
{ {
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
Move_Plume_HPGL(pos, plume); Move_Plume_HPGL( pos, plume );
break; break;
case PLOT_FORMAT_POST:
case PLOT_FORMAT_POST_A4: case PLOT_FORMAT_POST:
LineTo_PS(pos, plume); case PLOT_FORMAT_POST_A4:
break; LineTo_PS( pos, plume );
} break;
}
} }
void SetCurrentLineWidth( int width)
{
switch ( g_PlotFormat )
{
case PLOT_FORMAT_HPGL:
break;
case PLOT_FORMAT_POST: void SetCurrentLineWidth( int width )
case PLOT_FORMAT_POST_A4: {
SetCurrentLineWidthPS(width); switch( g_PlotFormat )
break; {
} case PLOT_FORMAT_HPGL:
break;
case PLOT_FORMAT_POST:
case PLOT_FORMAT_POST_A4:
SetCurrentLineWidthPS( width );
break;
}
} }
/*******************************************************************************/ /*******************************************************************************/
void PlotArc(wxPoint centre, int StAngle, int EndAngle, int rayon, int width) void PlotArc( wxPoint centre, int StAngle, int EndAngle, int rayon, int width )
/*******************************************************************************/ /*******************************************************************************/
/* trace d'un arc de cercle: /* trace d'un arc de cercle:
x, y = coord du centre * x, y = coord du centre
StAngle, EndAngle = angle de debut et fin * StAngle, EndAngle = angle de debut et fin
rayon = rayon de l'arc * rayon = rayon de l'arc
*/ */
{ {
switch ( g_PlotFormat ) switch( g_PlotFormat )
{ {
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
PlotArcHPGL(centre, StAngle, EndAngle, rayon, width); PlotArcHPGL( centre, StAngle, EndAngle, rayon, width );
break; break;
case PLOT_FORMAT_POST:
PlotArcPS(centre, StAngle, EndAngle, rayon, width); case PLOT_FORMAT_POST:
break; PlotArcPS( centre, StAngle, EndAngle, rayon, width );
} break;
}
} }
/*******************************************************/ /*******************************************************/
void PlotCercle( wxPoint pos,int diametre, int width ) void PlotCercle( wxPoint pos, int diametre, int width )
/*******************************************************/ /*******************************************************/
{ {
switch ( g_PlotFormat ) switch( g_PlotFormat )
{ {
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
PlotCircle_HPGL( pos, diametre, width); PlotCircle_HPGL( pos, diametre, width );
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
PlotCircle_PS(pos, diametre, width); PlotCircle_PS( pos, diametre, width );
break; break;
} }
} }
/******************************************************************/ /******************************************************************/
void PlotPoly( int nb, int * coord, int fill, int width) void PlotPoly( int nb, int* coord, int fill, int width )
/******************************************************************/ /******************************************************************/
/* Trace un polygone ferme /* Trace un polygone ferme
coord = tableau des coord des sommets * coord = tableau des coord des sommets
nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau ) * nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau )
fill : si != 0 polygone rempli * fill : si != 0 polygone rempli
*/ */
{ {
if( nb <= 1 ) return; if( nb <= 1 )
return;
switch ( g_PlotFormat )
{ switch( g_PlotFormat )
case PLOT_FORMAT_HPGL: {
PlotPolyHPGL( nb, coord, fill, width); case PLOT_FORMAT_HPGL:
break; PlotPolyHPGL( nb, coord, fill, width );
break;
case PLOT_FORMAT_POST:
PlotPolyPS( nb, coord, fill, width); case PLOT_FORMAT_POST:
break; PlotPolyPS( nb, coord, fill, width );
} break;
}
} }
/**********************************************************/ /**********************************************************/
void PlotNoConnectStruct(DrawNoConnectStruct * Struct) void PlotNoConnectStruct( DrawNoConnectStruct* Struct )
/**********************************************************/ /**********************************************************/
/* Routine de dessin des symboles de "No Connexion" .. /* Routine de dessin des symboles de "No Connexion" ..
*/ */
{ {
#define DELTA (DRAWNOCONNECT_SIZE/2) #define DELTA (DRAWNOCONNECT_SIZE / 2)
int pX, pY; int pX, pY;
pX = Struct->m_Pos.x; pY = Struct->m_Pos.y; pX = Struct->m_Pos.x; pY = Struct->m_Pos.y;
SetCurrentLineWidth(-1); SetCurrentLineWidth( -1 );
Move_Plume(wxPoint(pX - DELTA, pY - DELTA), 'U'); Move_Plume( wxPoint( pX - DELTA, pY - DELTA ), 'U' );
Move_Plume(wxPoint(pX + DELTA, pY + DELTA), 'D'); Move_Plume( wxPoint( pX + DELTA, pY + DELTA ), 'D' );
Move_Plume(wxPoint(pX + DELTA, pY - DELTA), 'U'); Move_Plume( wxPoint( pX + DELTA, pY - DELTA ), 'U' );
Move_Plume(wxPoint(pX - DELTA, pY + DELTA), 'D'); Move_Plume( wxPoint( pX - DELTA, pY + DELTA ), 'D' );
Plume('U'); Plume( 'U' );
} }
/*************************************************/ /*************************************************/
void PlotLibPart( EDA_SchComponentStruct *DrawLibItem ) void PlotLibPart( EDA_SchComponentStruct* DrawLibItem )
/*************************************************/ /*************************************************/
/* Genere le trace d'un composant */ /* Genere le trace d'un composant */
{ {
int ii, x1, y1, x2, y2, t1, t2, *Poly, orient; int ii, x1, y1, x2, y2, t1, t2, * Poly, orient;
LibEDA_BaseStruct *DEntry; LibEDA_BaseStruct* DEntry;
EDA_LibComponentStruct *Entry; EDA_LibComponentStruct* Entry;
int TransMat[2][2], PartX, PartY, Multi, convert; int TransMat[2][2], PartX, PartY, Multi, convert;
int CharColor = -1; int CharColor = -1;
wxPoint pos; wxPoint pos;
Entry = FindLibPart(DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL) return;; if( Entry == NULL )
memcpy(TransMat, DrawLibItem->m_Transform, sizeof(TransMat)); return;;
PartX = DrawLibItem->m_Pos.x; PartY = DrawLibItem->m_Pos.y; memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
Multi = DrawLibItem->m_Multi; PartX = DrawLibItem->m_Pos.x; PartY = DrawLibItem->m_Pos.y;
convert = DrawLibItem->m_Convert; Multi = DrawLibItem->m_Multi;
convert = DrawLibItem->m_Convert;
for( DEntry = Entry->m_Drawings; DEntry != NULL;DEntry = DEntry->Next())
{ for( DEntry = Entry->m_Drawings; DEntry != NULL; DEntry = DEntry->Next() )
/* Elimination des elements non relatifs a l'unite */ {
if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) ) continue; /* Elimination des elements non relatifs a l'unite */
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) )
continue; continue;
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
Plume('U'); continue;
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(LAYER_DEVICE) ); Plume( 'U' );
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
switch (DEntry->Type()) SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
{
case COMPONENT_ARC_DRAW_TYPE: switch( DEntry->Type() )
{ {
LibDrawArc * Arc = (LibDrawArc *) DEntry; case COMPONENT_ARC_DRAW_TYPE:
t1 = Arc->t1; t2 = Arc->t2; {
pos.x = PartX + TransMat[0][0] * Arc->m_Pos.x + LibDrawArc* Arc = (LibDrawArc*) DEntry;
TransMat[0][1] * Arc->m_Pos.y; t1 = Arc->t1; t2 = Arc->t2;
pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x + pos.x = PartX + TransMat[0][0] * Arc->m_Pos.x +
TransMat[1][1] * Arc->m_Pos.y; TransMat[0][1] * Arc->m_Pos.y;
MapAngles(&t1, &t2, TransMat); pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x +
PlotArc(pos, t1, t2, Arc->m_Rayon, Arc->m_Width); TransMat[1][1] * Arc->m_Pos.y;
} MapAngles( &t1, &t2, TransMat );
break; PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Width );
}
case COMPONENT_CIRCLE_DRAW_TYPE: break;
{
LibDrawCircle * Circle = (LibDrawCircle *) DEntry; case COMPONENT_CIRCLE_DRAW_TYPE:
pos.x = PartX + TransMat[0][0] * Circle->m_Pos.x + {
TransMat[0][1] * Circle->m_Pos.y; LibDrawCircle* Circle = (LibDrawCircle*) DEntry;
pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x + pos.x = PartX + TransMat[0][0] * Circle->m_Pos.x +
TransMat[1][1] * Circle->m_Pos.y; TransMat[0][1] * Circle->m_Pos.y;
PlotCercle(pos, Circle->m_Rayon * 2, Circle->m_Width); pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x +
} TransMat[1][1] * Circle->m_Pos.y;
break; PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Width );
}
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: break;
{
LibDrawText * Text = (LibDrawText *) DEntry; case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
/* The text orientation may need to be flipped if the {
transformation matrix causes xy axes to be flipped. */ LibDrawText* Text = (LibDrawText*) DEntry;
t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0);
pos.x = PartX + TransMat[0][0] * Text->m_Pos.x /* The text orientation may need to be flipped if the
+ TransMat[0][1] * Text->m_Pos.y; * transformation matrix causes xy axes to be flipped. */
pos.y = PartY + TransMat[1][0] * Text->m_Pos.x t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0);
+ TransMat[1][1] * Text->m_Pos.y; pos.x = PartX + TransMat[0][0] * Text->m_Pos.x
SetCurrentLineWidth(-1); + TransMat[0][1] * Text->m_Pos.y;
PlotGraphicText(g_PlotFormat, pos , CharColor, pos.y = PartY + TransMat[1][0] * Text->m_Pos.x
Text->m_Text, + TransMat[1][1] * Text->m_Pos.y;
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, SetCurrentLineWidth( -1 );
Text->m_Size, PlotGraphicText( g_PlotFormat, pos, CharColor,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); Text->m_Text,
} t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
break; Text->m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
case COMPONENT_RECT_DRAW_TYPE: }
{ break;
LibDrawSquare * Square = (LibDrawSquare *) DEntry;
x1 = PartX + TransMat[0][0] * Square->m_Pos.x case COMPONENT_RECT_DRAW_TYPE:
+ TransMat[0][1] * Square->m_Pos.y; {
y1 = PartY + TransMat[1][0] * Square->m_Pos.x LibDrawSquare* Square = (LibDrawSquare*) DEntry;
+ TransMat[1][1] * Square->m_Pos.y; x1 = PartX + TransMat[0][0] * Square->m_Pos.x
x2 = PartX + TransMat[0][0] * Square->m_End.x + TransMat[0][1] * Square->m_Pos.y;
+ TransMat[0][1] * Square->m_End.y; y1 = PartY + TransMat[1][0] * Square->m_Pos.x
y2 = PartY + TransMat[1][0] * Square->m_End.x + TransMat[1][1] * Square->m_Pos.y;
+ TransMat[1][1] * Square->m_End.y; x2 = PartX + TransMat[0][0] * Square->m_End.x
+ TransMat[0][1] * Square->m_End.y;
SetCurrentLineWidth(Square->m_Width); y2 = PartY + TransMat[1][0] * Square->m_End.x
Move_Plume(wxPoint(x1, y1), 'U'); + TransMat[1][1] * Square->m_End.y;
Move_Plume(wxPoint(x1, y2), 'D');
Move_Plume(wxPoint(x2, y2), 'D'); SetCurrentLineWidth( Square->m_Width );
Move_Plume(wxPoint(x2, y1), 'D'); Move_Plume( wxPoint( x1, y1 ), 'U' );
Move_Plume(wxPoint(x1, y1), 'D'); Move_Plume( wxPoint( x1, y2 ), 'D' );
} Move_Plume( wxPoint( x2, y2 ), 'D' );
break; Move_Plume( wxPoint( x2, y1 ), 'D' );
Move_Plume( wxPoint( x1, y1 ), 'D' );
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */ }
{ break;
LibDrawPin * Pin = (LibDrawPin *) DEntry;
if(Pin->m_Attributs & PINNOTDRAW) case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
{ {
if( ActiveScreen->m_Type == SCHEMATIC_FRAME ) LibDrawPin* Pin = (LibDrawPin*) DEntry;
break; if( Pin->m_Attributs & PINNOTDRAW )
} {
if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
/* Calcul de l'orientation reelle de la Pin */ break;
orient = Pin->ReturnPinDrawOrient(TransMat); }
/* compute Pin Pos */
x2 = PartX + TransMat[0][0] * Pin->m_Pos.x /* Calcul de l'orientation reelle de la Pin */
+ TransMat[0][1] * Pin->m_Pos.y; orient = Pin->ReturnPinDrawOrient( TransMat );
y2 = PartY + TransMat[1][0] * Pin->m_Pos.x /* compute Pin Pos */
+ TransMat[1][1] * Pin->m_Pos.y; x2 = PartX + TransMat[0][0] * Pin->m_Pos.x
+ TransMat[0][1] * Pin->m_Pos.y;
/* Dessin de la pin et du symbole special associe */ y2 = PartY + TransMat[1][0] * Pin->m_Pos.x
SetCurrentLineWidth(-1); + TransMat[1][1] * Pin->m_Pos.y;
PlotPinSymbol(x2, y2, Pin->m_PinLen, orient, Pin->m_PinShape);
wxPoint pinpos(x2, y2); /* Dessin de la pin et du symbole special associe */
Pin->PlotPinTexts(pinpos, orient, SetCurrentLineWidth( -1 );
Entry->m_TextInside, PlotPinSymbol( x2, y2, Pin->m_PinLen, orient, Pin->m_PinShape );
Entry->m_DrawPinNum, Entry->m_DrawPinName); wxPoint pinpos( x2, y2 );
} Pin->PlotPinTexts( pinpos, orient,
break; Entry->m_TextInside,
Entry->m_DrawPinNum, Entry->m_DrawPinName );
case COMPONENT_POLYLINE_DRAW_TYPE: }
{ break;
LibDrawPolyline * polyline = (LibDrawPolyline *) DEntry;
Poly = (int *) MyMalloc(sizeof(int) * 2 * polyline->n); case COMPONENT_POLYLINE_DRAW_TYPE:
for (ii = 0; ii < polyline->n; ii++) {
{ LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
Poly[ii * 2] = PartX + Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->n );
TransMat[0][0] * polyline->PolyList[ii * 2] + for( ii = 0; ii < polyline->n; ii++ )
TransMat[0][1] * polyline->PolyList[ii * 2 + 1]; {
Poly[ii * 2 + 1] = PartY + Poly[ii * 2] = PartX +
TransMat[1][0] * polyline->PolyList[ii * 2] + TransMat[0][0] * polyline->PolyList[ii * 2] +
TransMat[1][1] * polyline->PolyList[ii * 2 + 1]; TransMat[0][1] * polyline->PolyList[ii * 2 + 1];
} Poly[ii * 2 + 1] = PartY +
PlotPoly(ii, Poly, polyline->m_Fill, polyline->m_Width); TransMat[1][0] * polyline->PolyList[ii * 2] +
MyFree(Poly); TransMat[1][1] * polyline->PolyList[ii * 2 + 1];
} }
break;
PlotPoly( ii, Poly, polyline->m_Fill, polyline->m_Width );
default:; MyFree( Poly );
}
} /* Fin Switch */ break;
Plume('U');
} /* Fin Boucle de dessin */ default:
;
/* Trace des champs, avec placement et orientation selon orient. du }
composant
Si la reference commence par # elle n'est pas tracee /* Fin Switch */
*/ Plume( 'U' );
}
if( (Entry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE) == 0)
{ /* Fin Boucle de dessin */
if ( Entry->m_UnitCount > 1 )
PlotTextField(DrawLibItem,REFERENCE,1,0); /* Trace des champs, avec placement et orientation selon orient. du
else * composant
PlotTextField(DrawLibItem,REFERENCE,0,0); * Si la reference commence par # elle n'est pas tracee
} */
if( (Entry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0) if( (Entry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE) == 0 )
PlotTextField(DrawLibItem,VALUE,0,0); {
if( Entry->m_UnitCount > 1 )
for( ii = 2; ii < NUMBER_OF_FIELDS; ii++ ) PlotTextField( DrawLibItem, REFERENCE, 1, 0 );
{ else
PlotTextField(DrawLibItem,ii,0,0); PlotTextField( DrawLibItem, REFERENCE, 0, 0 );
} }
if( (Entry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
PlotTextField( DrawLibItem, VALUE, 0, 0 );
for( ii = 2; ii < NUMBER_OF_FIELDS; ii++ )
{
PlotTextField( DrawLibItem, ii, 0, 0 );
}
} }
/*************************************************************/ /*************************************************************/
static void PlotTextField( EDA_SchComponentStruct *DrawLibItem, static void PlotTextField( EDA_SchComponentStruct* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode) int FieldNumber, int IsMulti, int DrawMode )
/**************************************************************/ /**************************************************************/
/* Routine de trace des textes type Field du composant. /* Routine de trace des textes type Field du composant.
entree: * entree:
DrawLibItem: pointeur sur le composant * DrawLibItem: pointeur sur le composant
FieldNumber: Numero du champ * FieldNumber: Numero du champ
IsMulti: flag Non Null si il y a plusieurs parts par boitier. * IsMulti: flag Non Null si il y a plusieurs parts par boitier.
n'est utile que pour le champ reference pour ajouter a celui ci * n'est utile que pour le champ reference pour ajouter a celui ci
l'identification de la part ( A, B ... ) * l'identification de la part ( A, B ... )
DrawMode: mode de trace * DrawMode: mode de trace
*/ */
{ {
int posX, posY; /* Position des textes */ int posX, posY; /* Position des textes */
int px, py, x1, y1; int px, py, x1, y1;
PartTextStruct * Field = & DrawLibItem->m_Field[FieldNumber]; PartTextStruct* Field = &DrawLibItem->m_Field[FieldNumber];
int hjustify, vjustify; int hjustify, vjustify;
int orient, color = -1; int orient, color = -1;
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor(Field->m_Layer); color = ReturnLayerColor( Field->m_Layer );
DrawMode = 0; /* Unused */ DrawMode = 0; /* Unused */
if( Field->m_Attributs & TEXT_NO_VISIBLE ) return; if( Field->m_Attributs & TEXT_NO_VISIBLE )
if( Field->IsVoid() ) return; return;
if( Field->IsVoid() )
/* Calcul de la position des textes, selon orientation du composant */ return;
orient = Field->m_Orient;
hjustify = Field->m_HJustify; vjustify = Field->m_VJustify; /* Calcul de la position des textes, selon orientation du composant */
posX = DrawLibItem->m_Pos.x; posY = DrawLibItem->m_Pos.y; orient = Field->m_Orient;
x1 = Field->m_Pos.x - posX; hjustify = Field->m_HJustify; vjustify = Field->m_VJustify;
y1 = Field->m_Pos.y - posY; posX = DrawLibItem->m_Pos.x; posY = DrawLibItem->m_Pos.y;
x1 = Field->m_Pos.x - posX;
px = posX + (DrawLibItem->m_Transform[0][0] * x1) y1 = Field->m_Pos.y - posY;
+ (DrawLibItem->m_Transform[0][1] * y1);
py = posY + (DrawLibItem->m_Transform[1][0] * x1) px = posX + (DrawLibItem->m_Transform[0][0] * x1)
+ (DrawLibItem->m_Transform[1][1] * y1); + (DrawLibItem->m_Transform[0][1] * y1);
py = posY + (DrawLibItem->m_Transform[1][0] * x1)
/* Y a t-il rotation */ + (DrawLibItem->m_Transform[1][1] * y1);
if(DrawLibItem->m_Transform[0][1])
{ /* Y a t-il rotation */
if ( orient == TEXT_ORIENT_HORIZ) orient = TEXT_ORIENT_VERT; if( DrawLibItem->m_Transform[0][1] )
else orient = TEXT_ORIENT_HORIZ; {
/* Y a t-il rotation, miroir (pour les justifications)*/ if( orient == TEXT_ORIENT_HORIZ )
EXCHG(hjustify, vjustify); orient = TEXT_ORIENT_VERT;
if (DrawLibItem->m_Transform[1][0] < 0 ) vjustify = - vjustify; else
if (DrawLibItem->m_Transform[1][0] > 0 ) hjustify = - hjustify; orient = TEXT_ORIENT_HORIZ;
} /* Y a t-il rotation, miroir (pour les justifications)*/
else EXCHG( hjustify, vjustify );
{ /* Texte horizontal: Y a t-il miroir (pour les justifications)*/ if( DrawLibItem->m_Transform[1][0] < 0 )
if (DrawLibItem->m_Transform[0][0] < 0 ) vjustify = -vjustify;
hjustify = - hjustify; if( DrawLibItem->m_Transform[1][0] > 0 )
if (DrawLibItem->m_Transform[1][1] > 0 ) hjustify = -hjustify;
vjustify = - vjustify; }
} else
{
SetCurrentLineWidth(-1); /* Texte horizontal: Y a t-il miroir (pour les justifications)*/
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries. if( DrawLibItem->m_Transform[0][0] < 0 )
if( !IsMulti || (FieldNumber != REFERENCE) ) hjustify = -hjustify;
{ if( DrawLibItem->m_Transform[1][1] > 0 )
PlotGraphicText( g_PlotFormat, wxPoint(px, py), color, Field->m_Text, vjustify = -vjustify;
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, }
Field->m_Size,
hjustify, vjustify); SetCurrentLineWidth( -1 );
}
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
else /* Le champ est la reference, et il y a plusieurs parts par boitier */ if( !IsMulti || (FieldNumber != REFERENCE) )
{ /* On ajoute alors A ou B ... a la reference */ {
wxString Text; PlotGraphicText( g_PlotFormat, wxPoint( px, py ), color, Field->m_Text,
Text = Field->m_Text; orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Text.Append('A' - 1 + DrawLibItem->m_Multi); Field->m_Size,
PlotGraphicText( g_PlotFormat, wxPoint(px, py), color, Text, hjustify, vjustify );
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, }
Field->m_Size, hjustify, vjustify); else /* Le champ est la reference, et il y a plusieurs parts par boitier */
} {
/* On ajoute alors A ou B ... a la reference */
wxString Text;
Text = Field->m_Text;
Text.Append( 'A' - 1 + DrawLibItem->m_Multi );
PlotGraphicText( g_PlotFormat, wxPoint( px, py ), color, Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, hjustify, vjustify );
}
} }
/**************************************************************************/ /**************************************************************************/
static void PlotPinSymbol(int posX, int posY, int len, int orient, int Shape) static void PlotPinSymbol( int posX, int posY, int len, int orient, int Shape )
/**************************************************************************/ /**************************************************************************/
/* Trace la pin du symbole en cours de trace /* Trace la pin du symbole en cours de trace
*/ */
{ {
int MapX1, MapY1, x1, y1; int MapX1, MapY1, x1, y1;
int color; int color;
color = ReturnLayerColor(LAYER_PIN); color = ReturnLayerColor( LAYER_PIN );
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS ( color ); SetColorMapPS( color );
SetCurrentLineWidth(-1); SetCurrentLineWidth( -1 );
MapX1 = MapY1 = 0; x1 = posX; y1 = posY; MapX1 = MapY1 = 0; x1 = posX; y1 = posY;
switch ( orient )
{ switch( orient )
case PIN_UP: {
y1 = posY - len; MapY1 = 1; case PIN_UP:
break; y1 = posY - len; MapY1 = 1;
case PIN_DOWN: break;
y1 = posY + len; MapY1 = -1;
break; case PIN_DOWN:
case PIN_LEFT: y1 = posY + len; MapY1 = -1;
x1 = posX - len, MapX1 = 1; break;
break;
case PIN_RIGHT: case PIN_LEFT:
x1 = posX + len; MapX1 = -1; x1 = posX - len, MapX1 = 1;
break; break;
}
case PIN_RIGHT:
if( Shape & INVERT) x1 = posX + len; MapX1 = -1;
{ break;
PlotCercle( wxPoint(MapX1 * INVERT_PIN_RADIUS + x1, }
MapY1 * INVERT_PIN_RADIUS + y1),
INVERT_PIN_RADIUS * 2); if( Shape & INVERT )
{
Move_Plume( wxPoint(MapX1 * INVERT_PIN_RADIUS * 2 + x1, PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
MapY1 * INVERT_PIN_RADIUS * 2 + y1), 'U' ); MapY1 * INVERT_PIN_RADIUS + y1 ),
Move_Plume(wxPoint(posX, posY), 'D' ); INVERT_PIN_RADIUS * 2 );
}
else Move_Plume( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
{ MapY1 * INVERT_PIN_RADIUS * 2 + y1 ), 'U' );
Move_Plume(wxPoint(x1, y1), 'U' ); Move_Plume( wxPoint( posX, posY ), 'D' );
Move_Plume(wxPoint(posX, posY), 'D' ); }
} else
{
if(Shape & CLOCK) Move_Plume( wxPoint( x1, y1 ), 'U' );
{ Move_Plume( wxPoint( posX, posY ), 'D' );
if(MapY1 == 0 ) /* MapX1 = +- 1 */ }
{
Move_Plume(wxPoint(x1, y1 + CLOCK_PIN_DIM), 'U' ); if( Shape & CLOCK )
Move_Plume(wxPoint(x1 - MapX1 * CLOCK_PIN_DIM, y1), 'D' ); {
Move_Plume(wxPoint(x1, y1 - CLOCK_PIN_DIM), 'D' ); if( MapY1 == 0 ) /* MapX1 = +- 1 */
} {
else /* MapX1 = 0 */ Move_Plume( wxPoint( x1, y1 + CLOCK_PIN_DIM ), 'U' );
{ Move_Plume( wxPoint( x1 - MapX1 * CLOCK_PIN_DIM, y1 ), 'D' );
Move_Plume( wxPoint(x1 + CLOCK_PIN_DIM, y1), 'U' ); Move_Plume( wxPoint( x1, y1 - CLOCK_PIN_DIM ), 'D' );
Move_Plume( wxPoint(x1, y1 - MapY1 * CLOCK_PIN_DIM), 'D' ); }
Move_Plume( wxPoint(x1 - CLOCK_PIN_DIM, y1), 'D' ); else /* MapX1 = 0 */
} {
} Move_Plume( wxPoint( x1 + CLOCK_PIN_DIM, y1 ), 'U' );
Move_Plume( wxPoint( x1, y1 - MapY1 * CLOCK_PIN_DIM ), 'D' );
if(Shape & LOWLEVEL_IN) /* IEEE symbol "Active Low Input" */ Move_Plume( wxPoint( x1 - CLOCK_PIN_DIM, y1 ), 'D' );
{ }
if(MapY1 == 0 ) /* MapX1 = +- 1 */ }
{
Move_Plume(wxPoint(x1 + MapX1 * IEEE_SYMBOL_PIN_DIM*2, y1), 'U'); if( Shape & LOWLEVEL_IN ) /* IEEE symbol "Active Low Input" */
Move_Plume(wxPoint(x1 + MapX1 * IEEE_SYMBOL_PIN_DIM*2, {
y1 - IEEE_SYMBOL_PIN_DIM), 'D'); if( MapY1 == 0 ) /* MapX1 = +- 1 */
Move_Plume( wxPoint(x1, y1), 'D' ); {
} Move_Plume( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ), 'U' );
else /* MapX1 = 0 */ Move_Plume( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
{ y1 - IEEE_SYMBOL_PIN_DIM ), 'D' );
Move_Plume( wxPoint(x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM*2), 'U'); Move_Plume( wxPoint( x1, y1 ), 'D' );
Move_Plume(wxPoint(x1 - IEEE_SYMBOL_PIN_DIM, }
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM*2), 'D'); else /* MapX1 = 0 */
Move_Plume(wxPoint(x1, y1), 'D'); {
} Move_Plume( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ), 'U' );
} Move_Plume( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ), 'D' );
Move_Plume( wxPoint( x1, y1 ), 'D' );
if(Shape & LOWLEVEL_OUT) /* IEEE symbol "Active Low Output" */ }
{ }
if(MapY1 == 0 ) /* MapX1 = +- 1 */
{
Move_Plume(wxPoint(x1, y1 - IEEE_SYMBOL_PIN_DIM), 'U' ); if( Shape & LOWLEVEL_OUT ) /* IEEE symbol "Active Low Output" */
Move_Plume(wxPoint(x1 + MapX1 * IEEE_SYMBOL_PIN_DIM*2, y1), 'D' ); {
} if( MapY1 == 0 ) /* MapX1 = +- 1 */
else /* MapX1 = 0 */ {
{ Move_Plume( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ), 'U' );
Move_Plume(wxPoint(x1 - IEEE_SYMBOL_PIN_DIM, y1), 'U'); Move_Plume( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ), 'D' );
Move_Plume(wxPoint(x1 , y1 + MapY1 * IEEE_SYMBOL_PIN_DIM*2),'D' ); }
} else /* MapX1 = 0 */
} {
Plume('U'); Move_Plume( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ), 'U' );
Move_Plume( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ), 'D' );
}
}
Plume( 'U' );
} }
/*******************************************/ /*******************************************/
void PlotTextStruct(EDA_BaseStruct *Struct) void PlotTextStruct( EDA_BaseStruct* Struct )
/*******************************************/ /*******************************************/
/* /*
Routine de trace des Textes, Labels et Global-Labels. * Routine de trace des Textes, Labels et Global-Labels.
Les textes peuvent avoir 4 directions. * Les textes peuvent avoir 4 directions.
*/ */
{ {
int * Template; int Poly[50];
int Poly[50]; int pX, pY, Shape = 0, Orient = 0, offset;
int ii, pX, pY, Shape = 0, Orient = 0, offset; wxSize Size;
wxSize Size; wxString Text;
wxString Text; int color = -1;
int color = -1;
int HalfSize; switch( Struct->Type() )
{
switch ( Struct->Type() ) case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
{ case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: Text = ( (DrawTextStruct*) Struct )->m_Text;
case DRAW_TEXT_STRUCT_TYPE: Size = ( (DrawTextStruct*) Struct )->m_Size;
Text = ((DrawTextStruct*)Struct)->m_Text; Orient = ( (DrawTextStruct*) Struct )->m_Orient;
Size = ((DrawTextStruct*)Struct)->m_Size; Shape = ( (DrawTextStruct*) Struct )->m_Shape;
Orient = ((DrawTextStruct*)Struct)->m_Orient; pX = ( (DrawTextStruct*) Struct )->m_Pos.x;
Shape = ((DrawTextStruct*)Struct)->m_Shape; pY = ( (DrawTextStruct*) Struct )->m_Pos.y;
pX = ((DrawTextStruct*)Struct)->m_Pos.x; offset = TXTMARGE;
pY = ((DrawTextStruct*)Struct)->m_Pos.y; if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE
offset = TXTMARGE; || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || offset += Size.x; // We must draw the Glabel graphic symbol
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
offset += Size.x; // We must draw the Glabel graphic symbol color = ReturnLayerColor( ( (DrawTextStruct*) Struct )->m_Layer );
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) break;
color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer);
break; default:
return;
default: return; }
}
if( Size.x == 0 )
if(Size.x == 0 ) Size = wxSize(DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT); Size = wxSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
SetCurrentLineWidth(-1); SetCurrentLineWidth( -1 );
switch(Orient) if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE )
{
offset = ( (DrawGlobalLabelStruct*) Struct )->m_Width;
switch( Shape )
{ {
case 0: /* Orientation horiz normale */ case NET_INPUT:
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || case NET_BIDI:
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE ) case NET_TRISTATE:
PlotGraphicText(g_PlotFormat, wxPoint(pX - offset, pY), offset += Size.x/2;
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER);
else
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM);
break; break;
case 1: /* Orientation vert UP */ case NET_OUTPUT:
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || offset += TXTMARGE;
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP);
else
PlotGraphicText( g_PlotFormat, wxPoint(pX - offset, pY),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM);
break; break;
case 2: /* Horiz Orientation - Right justified */ default:
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
else
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM);
break;
case 3: /* Orientation vert BOTTOM */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
else
PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP);
break; break;
} }
}
/* Trace du symbole associe au label global */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
{
int jj, imax;
HalfSize = Size.x / 2;
Template = TemplateShape[Shape][Orient];
imax = *Template; Template++;
for ( ii = 0, jj = 0; ii < imax ; ii++ ) switch( Orient )
{ {
Poly[jj] = ( HalfSize * (*Template) ) + pX; case 0: /* Orientation horiz normale */
jj ++; Template++; if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
Poly[jj] = ( HalfSize * (*Template) ) + pY; PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
jj ++; Template++; color, Text, TEXT_ORIENT_HORIZ, Size,
} GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
PlotPoly(imax,Poly,NOFILL ); else
} PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM );
break;
case 1: /* Orientation vert UP */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM );
break;
case 2: /* Horiz Orientation - Right justified */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM );
break;
case 3: /* Orientation vert BOTTOM */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE || Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
else
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP );
break;
}
/* Draw graphic symbol for global or hierachical labels */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE )
{
( (DrawGlobalLabelStruct*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
PlotPoly( Poly[0], Poly + 1, NOFILL );
}
if( Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
{
( (DrawHierLabelStruct*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
PlotPoly( Poly[0], Poly + 1, NOFILL );
}
} }
/***********************************************************/ /***********************************************************/
static void PlotSheetLabelStruct(DrawSheetLabelStruct *Struct) static void PlotSheetLabelStruct( DrawSheetLabelStruct* Struct )
/***********************************************************/ /***********************************************************/
/* Routine de dessin des Sheet Labels type hierarchie */ /* Routine de dessin des Sheet Labels type hierarchie */
{ {
int side, txtcolor = -1; int side, txtcolor = -1;
int posx , tposx, posy, size, size2; int posx, tposx, posy, size, size2;
int coord[16]; int coord[16];
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
txtcolor = ReturnLayerColor(Struct->m_Layer); txtcolor = ReturnLayerColor( Struct->m_Layer );
posx = Struct->m_Pos.x; posy = Struct->m_Pos.y; size = Struct->m_Size.x; posx = Struct->m_Pos.x; posy = Struct->m_Pos.y; size = Struct->m_Size.x;
if( Struct->m_Edge ) if( Struct->m_Edge )
{ {
tposx = posx - size; tposx = posx - size;
side = GR_TEXT_HJUSTIFY_RIGHT; side = GR_TEXT_HJUSTIFY_RIGHT;
} }
else { else
tposx = posx + size + (size /8) ; {
side = GR_TEXT_HJUSTIFY_LEFT; tposx = posx + size + (size / 8);
} side = GR_TEXT_HJUSTIFY_LEFT;
PlotGraphicText(g_PlotFormat, wxPoint(tposx, posy), txtcolor, }
Struct->m_Text, TEXT_ORIENT_HORIZ, wxSize(size,size), PlotGraphicText( g_PlotFormat, wxPoint( tposx, posy ), txtcolor,
side, GR_TEXT_VJUSTIFY_CENTER); Struct->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
/* dessin du symbole de connexion */ side, GR_TEXT_VJUSTIFY_CENTER );
/* dessin du symbole de connexion */
if(Struct->m_Edge) size = -size;
coord[0] = posx; coord[1] = posy; size2 = size /2; if( Struct->m_Edge )
switch(Struct->m_Shape) size = -size;
{ coord[0] = posx; coord[1] = posy; size2 = size / 2;
case 0: /* input |> */
coord[2] = posx ; coord[3] = posy - size2; switch( Struct->m_Shape )
coord[4] = posx + size2; coord[5] = posy - size2; {
coord[6] = posx + size; coord[7] = posy; case 0: /* input |> */
coord[8] = posx + size2; coord[9] = posy + size2; coord[2] = posx; coord[3] = posy - size2;
coord[10] = posx ; coord[11] = posy + size2; coord[4] = posx + size2; coord[5] = posy - size2;
coord[12] = posx; coord[13] = posy; coord[6] = posx + size; coord[7] = posy;
PlotPoly(7, coord, NOFILL); coord[8] = posx + size2; coord[9] = posy + size2;
break; coord[10] = posx; coord[11] = posy + size2;
coord[12] = posx; coord[13] = posy;
case 1: /* output <| */ PlotPoly( 7, coord, NOFILL );
coord[2] = posx + size2; coord[3] = posy - size2; break;
coord[4] = posx + size; coord[5] = posy - size2;
coord[6] = posx + size; coord[7] = posy + size2; case 1: /* output <| */
coord[8] = posx + size2; coord[9] = posy + size2; coord[2] = posx + size2; coord[3] = posy - size2;
coord[10] = posx; coord[11] = posy; coord[4] = posx + size; coord[5] = posy - size2;
PlotPoly(6, coord, NOFILL); coord[6] = posx + size; coord[7] = posy + size2;
break; coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = posx; coord[11] = posy;
case 2: /* bidi <> */ PlotPoly( 6, coord, NOFILL );
case 3: /* TriSt <> */ break;
coord[2] = posx + size2; coord[3] = posy - size2;
coord[4] = posx + size; coord[5] = posy; case 2: /* bidi <> */
coord[6] = posx + size2; coord[7] = posy +size2; case 3: /* TriSt <> */
coord[8] = posx; coord[9] = posy; coord[2] = posx + size2; coord[3] = posy - size2;
PlotPoly(5, coord, NOFILL); coord[4] = posx + size; coord[5] = posy;
break; coord[6] = posx + size2; coord[7] = posy + size2;
coord[8] = posx; coord[9] = posy;
default: /* unsp []*/ PlotPoly( 5, coord, NOFILL );
coord[2] = posx ; coord[3] = posy - size2; break;
coord[4] = posx + size; coord[5] = posy - size2;
coord[6] = posx + size; coord[7] = posy + size2; default: /* unsp []*/
coord[8] = posx ; coord[9] = posy + size2; coord[2] = posx; coord[3] = posy - size2;
coord[10] = posx; coord[11] = posy; coord[4] = posx + size; coord[5] = posy - size2;
PlotPoly(6, coord, NOFILL); coord[6] = posx + size; coord[7] = posy + size2;
break; coord[8] = posx; coord[9] = posy + size2;
} coord[10] = posx; coord[11] = posy;
PlotPoly( 6, coord, NOFILL );
break;
}
} }
/*************************************************/ /*************************************************/
void PlotSheetStruct(DrawSheetStruct *Struct) void PlotSheetStruct( DrawSheetStruct* Struct )
/*************************************************/ /*************************************************/
/* Routine de dessin du bloc type hierarchie */ /* Routine de dessin du bloc type hierarchie */
{ {
DrawSheetLabelStruct * SheetLabelStruct; DrawSheetLabelStruct* SheetLabelStruct;
int txtcolor = -1; int txtcolor = -1;
wxSize size; wxSize size;
wxString Text; wxString Text;
wxPoint pos; wxPoint pos;
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(Struct->m_Layer) ); SetColorMapPS( ReturnLayerColor( Struct->m_Layer ) );
SetCurrentLineWidth(-1); SetCurrentLineWidth( -1 );
Move_Plume(Struct->m_Pos, 'U'); Move_Plume( Struct->m_Pos, 'U' );
pos = Struct->m_Pos; pos.x += Struct->m_Size.x; pos = Struct->m_Pos; pos.x += Struct->m_Size.x;
Move_Plume(pos,'D'); Move_Plume( pos, 'D' );
pos.y += Struct->m_Size.y; pos.y += Struct->m_Size.y;
Move_Plume(pos, 'D'); Move_Plume( pos, 'D' );
pos = Struct->m_Pos; pos.y += Struct->m_Size.y; pos = Struct->m_Pos; pos.y += Struct->m_Size.y;
Move_Plume(pos,'D'); Move_Plume( pos, 'D' );
Move_Plume(Struct->m_Pos, 'D'); Move_Plume( Struct->m_Pos, 'D' );
Plume('U'); Plume( 'U' );
/* Trace des textes : SheetName */ /* Trace des textes : SheetName */
Text = Struct->m_SheetName; Text = Struct->m_SheetName;
size = wxSize(Struct->m_SheetNameSize,Struct->m_SheetNameSize); size = wxSize( Struct->m_SheetNameSize, Struct->m_SheetNameSize );
pos = Struct->m_Pos; pos.y -= 4; pos = Struct->m_Pos; pos.y -= 4;
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(LAYER_SHEETNAME) ); SetColorMapPS( ReturnLayerColor( LAYER_SHEETNAME ) );
PlotGraphicText(g_PlotFormat, pos, txtcolor, PlotGraphicText( g_PlotFormat, pos, txtcolor,
Text, TEXT_ORIENT_HORIZ, size, Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM );
/* Trace des textes : FileName */ /* Trace des textes : FileName */
Text = Struct->m_FileName; Text = Struct->m_FileName;
size = wxSize(Struct->m_FileNameSize,Struct->m_FileNameSize); size = wxSize( Struct->m_FileNameSize, Struct->m_FileNameSize );
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(LAYER_SHEETFILENAME) ); SetColorMapPS( ReturnLayerColor( LAYER_SHEETFILENAME ) );
PlotGraphicText(g_PlotFormat, wxPoint(Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4), PlotGraphicText( g_PlotFormat,
txtcolor, wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
Text, TEXT_ORIENT_HORIZ, size, txtcolor,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP); Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP );
/* Trace des textes : SheetLabel */
SheetLabelStruct = Struct->m_Label; /* Trace des textes : SheetLabel */
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) SheetLabelStruct = Struct->m_Label;
SetColorMapPS ( ReturnLayerColor(Struct->m_Layer) ); if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
while( SheetLabelStruct != NULL ) SetColorMapPS( ReturnLayerColor( Struct->m_Layer ) );
{ while( SheetLabelStruct != NULL )
PlotSheetLabelStruct(SheetLabelStruct); {
SheetLabelStruct = (DrawSheetLabelStruct*)(SheetLabelStruct->Pnext); PlotSheetLabelStruct( SheetLabelStruct );
} SheetLabelStruct = (DrawSheetLabelStruct*) (SheetLabelStruct->Pnext);
}
} }
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "component_class.h" #include "component_class.h"
#include "class_screen.h" #include "class_screen.h"
#include "class_text-label.h"
#define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */ #define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */
#define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */ #define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */
...@@ -234,77 +235,6 @@ public: ...@@ -234,77 +235,6 @@ public:
}; };
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
{
public:
int m_Layer;
int m_Shape;
bool m_IsDangling; // TRUE si non connect�
public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
~DrawTextStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawText" );
}
DrawTextStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
void SwapData( DrawTextStruct* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
};
class DrawLabelStruct : public DrawTextStruct
{
public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~DrawLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawLabel" );
}
};
class DrawGlobalLabelStruct : public DrawTextStruct
{
public:
DrawGlobalLabelStruct(const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString);
~DrawGlobalLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawGlobalLabel" );
}
};
class DrawHierLabelStruct : public DrawTextStruct
{
public:
DrawHierLabelStruct(const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString);
~DrawHierLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawHierLabel" );
}
};
#define MAX_LAYERS 44 #define MAX_LAYERS 44
class LayerStruct class LayerStruct
......
...@@ -269,7 +269,7 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave) ...@@ -269,7 +269,7 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
Failed = TRUE; Failed = TRUE;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: /* Its a Global label item. */ case DRAW_HIER_LABEL_STRUCT_TYPE: /* Its a Hierarchical label item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawHierLabelStruct *) Phead) #define STRUCT ((DrawHierLabelStruct *) Phead)
shape = STRUCT->m_Shape; shape = STRUCT->m_Shape;
......
/*
* File: printing.h
* Purpose: Printing demo for wxWindows class library
*/
#ifdef __GNUG__
#pragma interface
#endif
// Define a new application
class MyApp: public wxApp
{
public:
MyApp() ;
bool OnInit();
int OnExit();
wxFont* m_testFont;
};
DECLARE_APP(MyApp)
class MyCanvas;
// Define a new canvas and frame
class MyFrame: public wxFrame
{
public:
MyCanvas *canvas;
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
void Draw(wxDC& dc);
void OnSize(wxSizeEvent& event);
void OnPrint(wxCommandEvent& event);
void OnPrintPreview(wxCommandEvent& event);
void OnPrintSetup(wxCommandEvent& event);
void OnPageSetup(wxCommandEvent& event);
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
void OnPrintPS(wxCommandEvent& event);
void OnPrintPreviewPS(wxCommandEvent& event);
void OnPrintSetupPS(wxCommandEvent& event);
void OnPageSetupPS(wxCommandEvent& event);
#endif
void OnExit(wxCommandEvent& event);
void OnPrintAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
// Define a new canvas which can receive some events
class MyCanvas: public wxScrolledWindow
{
public:
MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
~MyCanvas() ;
virtual void OnDraw(wxDC& dc);
void OnEvent(wxMouseEvent& event);
DECLARE_EVENT_TABLE()
};
class MyPrintout: public wxPrintout
{
public:
MyPrintout(char *title = "My printout"):wxPrintout(title) {}
bool OnPrintPage(int page);
bool HasPage(int page);
bool OnBeginDocument(int startPage, int endPage);
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
void DrawPageOne(wxDC *dc);
void DrawPageTwo(wxDC *dc);
};
#define WXPRINT_QUIT 100
#define WXPRINT_PRINT 101
#define WXPRINT_PRINT_SETUP 102
#define WXPRINT_PAGE_SETUP 103
#define WXPRINT_PREVIEW 104
#define WXPRINT_PRINT_PS 105
#define WXPRINT_PRINT_SETUP_PS 106
#define WXPRINT_PAGE_SETUP_PS 107
#define WXPRINT_PREVIEW_PS 108
#define WXPRINT_ABOUT 109
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment