2008-09-14 13:05:15 +00:00
|
|
|
/***************************************************/
|
|
|
|
/* Plot functions common to different plot formats */
|
|
|
|
/***************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
|
|
|
#include "worksheet.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "base_struct.h"
|
|
|
|
#include "drawtxt.h"
|
2009-05-12 12:12:34 +00:00
|
|
|
#include "trigo.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
|
|
|
|
2008-09-14 13:05:15 +00:00
|
|
|
/* Local Variables : */
|
2009-08-29 10:20:48 +00:00
|
|
|
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
2009-06-28 18:13:55 +00:00
|
|
|
Hierarchical_PIN_Sheet_Struct* Struct );
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
2008-02-20 19:37:17 +00:00
|
|
|
int FieldNumber, int IsMulti, int DrawMode );
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
|
2009-06-28 18:13:55 +00:00
|
|
|
int len, int orient, int Shape );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/***/
|
|
|
|
|
|
|
|
/**********************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************/
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Routine de dessin des symboles de "No Connexion" ..
|
2008-02-20 19:37:17 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
#define DELTA (DRAWNOCONNECT_SIZE / 2)
|
|
|
|
int pX, pY;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
pX = Struct->m_Pos.x; pY = Struct->m_Pos.y;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
plotter->set_current_line_width( Struct->GetPenSize() );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( pX - DELTA, pY - DELTA ) );
|
|
|
|
plotter->finish_to( wxPoint( pX + DELTA, pY + DELTA ) );
|
|
|
|
plotter->move_to( wxPoint( pX + DELTA, pY - DELTA ) );
|
|
|
|
plotter->finish_to( wxPoint( pX - DELTA, pY + DELTA ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2008-09-14 13:05:15 +00:00
|
|
|
/* Polt a component */
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-06-28 18:13:55 +00:00
|
|
|
int ii, t1, t2, * Poly, orient;
|
2008-02-20 19:37:17 +00:00
|
|
|
EDA_LibComponentStruct* Entry;
|
2009-06-28 18:13:55 +00:00
|
|
|
int TransMat[2][2], Multi, convert;
|
|
|
|
EDA_Colors CharColor = UNSPECIFIED_COLOR;
|
|
|
|
wxPoint pos;
|
|
|
|
bool draw_bgfill = false;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName );
|
2008-02-20 19:37:17 +00:00
|
|
|
if( Entry == NULL )
|
|
|
|
return;;
|
|
|
|
memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
|
|
|
|
Multi = DrawLibItem->m_Multi;
|
|
|
|
convert = DrawLibItem->m_Convert;
|
|
|
|
|
2009-06-28 18:13:55 +00:00
|
|
|
for( LibEDA_BaseStruct* DEntry = Entry->m_Drawings;
|
|
|
|
DEntry != NULL; DEntry = DEntry->Next() )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
|
|
|
/* Elimination des elements non relatifs a l'unite */
|
|
|
|
if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) )
|
|
|
|
continue;
|
|
|
|
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
|
|
|
|
continue;
|
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
int thickness = DEntry->GetPenSize();
|
2009-06-30 20:18:18 +00:00
|
|
|
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
|
|
|
draw_bgfill = plotter->get_color_mode();
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
switch( DEntry->Type() )
|
|
|
|
{
|
|
|
|
case COMPONENT_ARC_DRAW_TYPE:
|
2009-05-12 12:12:34 +00:00
|
|
|
{
|
|
|
|
LibDrawArc* Arc = (LibDrawArc*) DEntry;
|
|
|
|
t1 = Arc->t1; t2 = Arc->t2;
|
|
|
|
pos = TransformCoordinate( TransMat, Arc->m_Pos ) + DrawLibItem->m_Pos;
|
|
|
|
MapAngles( &t1, &t2, TransMat );
|
|
|
|
if( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
2008-08-23 06:44:47 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
2009-06-30 17:57:27 +00:00
|
|
|
plotter->arc( pos, -t2, -t1, Arc->m_Rayon, FILLED_SHAPE, 0 );
|
2008-08-23 06:44:47 +00:00
|
|
|
}
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
|
|
|
plotter->arc( pos,
|
2009-06-30 10:43:20 +00:00
|
|
|
-t2,
|
2009-06-30 17:57:27 +00:00
|
|
|
-t1,
|
2009-06-28 18:13:55 +00:00
|
|
|
Arc->m_Rayon,
|
|
|
|
Arc->m_Fill,
|
2009-06-30 20:18:18 +00:00
|
|
|
thickness );
|
2009-05-12 12:12:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
2009-05-12 12:12:34 +00:00
|
|
|
{
|
|
|
|
LibDrawCircle* Circle = (LibDrawCircle*) DEntry;
|
|
|
|
pos = TransformCoordinate( TransMat, Circle->m_Pos ) + DrawLibItem->m_Pos;
|
|
|
|
if( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
2008-08-23 06:44:47 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
|
|
|
plotter->circle( pos, Circle->m_Rayon * 2, FILLED_SHAPE, 0 );
|
2008-08-23 06:44:47 +00:00
|
|
|
}
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->circle( pos,
|
2009-06-28 18:13:55 +00:00
|
|
|
Circle->m_Rayon * 2,
|
|
|
|
Circle->m_Fill,
|
2009-06-30 20:18:18 +00:00
|
|
|
thickness );
|
2009-05-12 12:12:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
2009-05-12 12:12:34 +00:00
|
|
|
{
|
2008-12-20 13:12:57 +00:00
|
|
|
LibDrawText* Text = (LibDrawText*) DEntry;
|
|
|
|
|
|
|
|
/* The text orientation may need to be flipped if the
|
2009-05-12 12:12:34 +00:00
|
|
|
* transformation matrix causes xy axes to be flipped. */
|
|
|
|
t1 = (TransMat[0][0] != 0) ^ (Text->m_Orient != 0);
|
2008-12-20 13:12:57 +00:00
|
|
|
pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, CharColor,
|
2009-06-28 18:13:55 +00:00
|
|
|
Text->m_Text,
|
|
|
|
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
|
|
|
|
Text->m_Size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, Text->m_Italic, Text->m_Bold );
|
2009-05-12 12:12:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
case COMPONENT_RECT_DRAW_TYPE:
|
2009-05-12 12:12:34 +00:00
|
|
|
{
|
|
|
|
LibDrawSquare* Square = (LibDrawSquare*) DEntry;
|
|
|
|
pos = TransformCoordinate( TransMat, Square->m_Pos ) + DrawLibItem->m_Pos;
|
|
|
|
wxPoint end =
|
|
|
|
TransformCoordinate( TransMat, Square->m_End ) + DrawLibItem->m_Pos;
|
|
|
|
|
|
|
|
if( draw_bgfill && Square->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
2008-08-23 06:44:47 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
|
|
|
plotter->rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
|
2008-08-23 06:44:47 +00:00
|
|
|
}
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
2009-06-30 20:18:18 +00:00
|
|
|
plotter->rect( pos, end, Square->m_Fill, thickness );
|
2009-05-12 12:12:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
|
2009-05-12 12:12:34 +00:00
|
|
|
{
|
|
|
|
LibDrawPin* Pin = (LibDrawPin*) DEntry;
|
|
|
|
if( Pin->m_Attributs & PINNOTDRAW )
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Calcul de l'orientation reelle de la Pin */
|
|
|
|
orient = Pin->ReturnPinDrawOrient( TransMat );
|
|
|
|
/* compute Pin Pos */
|
|
|
|
pos = TransformCoordinate( TransMat, Pin->m_Pos ) + DrawLibItem->m_Pos;
|
|
|
|
|
|
|
|
/* Dessin de la pin et du symbole special associe */
|
2009-06-30 20:18:18 +00:00
|
|
|
thickness = Pin->GetPenSize();
|
2009-06-30 19:21:41 +00:00
|
|
|
plotter->set_current_line_width( thickness );
|
2009-06-28 18:13:55 +00:00
|
|
|
PlotPinSymbol( plotter, pos, Pin->m_PinLen, orient, Pin->m_PinShape );
|
2009-06-28 16:50:42 +00:00
|
|
|
Pin->PlotPinTexts( plotter, pos, orient,
|
2009-05-12 12:12:34 +00:00
|
|
|
Entry->m_TextInside,
|
|
|
|
Entry->m_DrawPinNum, Entry->m_DrawPinName,
|
2009-05-28 17:39:40 +00:00
|
|
|
thickness );
|
2009-05-12 12:12:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
|
|
{
|
|
|
|
LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
|
|
|
|
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->GetCornerCount() );
|
2009-06-28 18:13:55 +00:00
|
|
|
for( ii = 0; ii < (int) polyline->GetCornerCount(); ii++ )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
pos = polyline->m_PolyPoints[ii];
|
|
|
|
pos = TransformCoordinate( TransMat, pos ) + DrawLibItem->m_Pos;
|
|
|
|
Poly[ii * 2] = pos.x;
|
|
|
|
Poly[ii * 2 + 1] = pos.y;
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
if( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
|
|
|
plotter->poly( ii, Poly, FILLED_WITH_BG_BODYCOLOR, 0 );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
2009-06-30 20:18:18 +00:00
|
|
|
plotter->poly( ii, Poly, polyline->m_Fill, thickness );
|
2009-05-12 12:12:34 +00:00
|
|
|
MyFree( Poly );
|
|
|
|
}
|
|
|
|
break;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-25 20:45:27 +00:00
|
|
|
case COMPONENT_BEZIER_DRAW_TYPE:
|
|
|
|
{
|
|
|
|
LibDrawBezier* polyline = (LibDrawBezier*) DEntry;
|
|
|
|
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->GetCornerCount() );
|
|
|
|
for( ii = 0; ii < (int) polyline->GetCornerCount(); ii++ )
|
|
|
|
{
|
|
|
|
pos = polyline->m_PolyPoints[ii];
|
|
|
|
pos = TransformCoordinate( TransMat, pos ) + DrawLibItem->m_Pos;
|
|
|
|
Poly[ii * 2] = pos.x;
|
|
|
|
Poly[ii * 2 + 1] = pos.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
|
|
|
plotter->poly( ii, Poly, FILLED_WITH_BG_BODYCOLOR, 0 );
|
2009-06-25 20:45:27 +00:00
|
|
|
}
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
2009-06-30 20:18:18 +00:00
|
|
|
plotter->poly( ii, Poly, polyline->m_Fill, thickness );
|
2009-06-25 20:45:27 +00:00
|
|
|
MyFree( Poly );
|
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
default:
|
2009-05-12 12:12:34 +00:00
|
|
|
D( printf( "Drawing Type=%d\n", DEntry->Type() ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Fin Switch */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fin Boucle de dessin */
|
|
|
|
|
|
|
|
/* Trace des champs, avec placement et orientation selon orient. du
|
2009-05-12 12:12:34 +00:00
|
|
|
* composant
|
|
|
|
* Si la reference commence par # elle n'est pas tracee
|
2008-02-20 19:37:17 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
if( (Entry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE) == 0 )
|
|
|
|
{
|
|
|
|
if( Entry->m_UnitCount > 1 )
|
2009-06-28 18:13:55 +00:00
|
|
|
PlotTextField( plotter, DrawLibItem, REFERENCE, 1, 0 );
|
2008-02-20 19:37:17 +00:00
|
|
|
else
|
2009-06-28 18:13:55 +00:00
|
|
|
PlotTextField( plotter, DrawLibItem, REFERENCE, 0, 0 );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( (Entry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
|
2009-06-28 18:13:55 +00:00
|
|
|
PlotTextField( plotter, DrawLibItem, VALUE, 0, 0 );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
for( ii = 2; ii < NUMBER_OF_FIELDS; ii++ )
|
|
|
|
{
|
2009-06-28 18:13:55 +00:00
|
|
|
PlotTextField( plotter, DrawLibItem, ii, 0, 0 );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
2008-02-20 19:37:17 +00:00
|
|
|
int FieldNumber, int IsMulti, int DrawMode )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************************/
|
|
|
|
|
|
|
|
/* Routine de trace des textes type Field du composant.
|
2009-05-12 12:12:34 +00:00
|
|
|
* entree:
|
|
|
|
* DrawLibItem: pointeur sur le composant
|
|
|
|
* FieldNumber: Numero du champ
|
|
|
|
* 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
|
|
|
|
* l'identification de la part ( A, B ... )
|
|
|
|
* DrawMode: mode de trace
|
2008-02-20 19:37:17 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
wxPoint textpos; /* Position des textes */
|
|
|
|
SCH_CMP_FIELD* field = DrawLibItem->GetField( FieldNumber );
|
|
|
|
int orient;
|
|
|
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-28 18:13:55 +00:00
|
|
|
color = ReturnLayerColor( field->GetLayer() );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
DrawMode = 0; /* Unused */
|
2008-10-06 05:44:29 +00:00
|
|
|
if( field->m_Attributs & TEXT_NO_VISIBLE )
|
2008-02-20 19:37:17 +00:00
|
|
|
return;
|
2008-10-06 05:44:29 +00:00
|
|
|
if( field->IsVoid() )
|
2008-02-20 19:37:17 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Calcul de la position des textes, selon orientation du composant */
|
2009-05-12 12:12:34 +00:00
|
|
|
orient = field->m_Orient;
|
2008-12-16 19:44:57 +00:00
|
|
|
GRTextHorizJustifyType hjustify = field->m_HJustify;
|
2009-05-12 12:12:34 +00:00
|
|
|
GRTextVertJustifyType vjustify = field->m_VJustify;
|
2008-10-06 05:44:29 +00:00
|
|
|
textpos = field->m_Pos - DrawLibItem->m_Pos; // textpos is the text position relative to the component anchor
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-09-14 13:05:15 +00:00
|
|
|
textpos = TransformCoordinate( DrawLibItem->m_Transform, textpos ) + DrawLibItem->m_Pos;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
/* Y a t-il rotation */
|
|
|
|
if( DrawLibItem->m_Transform[0][1] )
|
|
|
|
{
|
|
|
|
if( orient == TEXT_ORIENT_HORIZ )
|
|
|
|
orient = TEXT_ORIENT_VERT;
|
|
|
|
else
|
|
|
|
orient = TEXT_ORIENT_HORIZ;
|
|
|
|
/* Y a t-il rotation, miroir (pour les justifications)*/
|
2008-12-16 19:44:57 +00:00
|
|
|
GRTextHorizJustifyType tmp = hjustify;
|
|
|
|
hjustify = (GRTextHorizJustifyType) vjustify;
|
|
|
|
vjustify = (GRTextVertJustifyType) tmp;
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
if( DrawLibItem->m_Transform[1][0] < 0 )
|
2009-05-12 12:12:34 +00:00
|
|
|
switch( vjustify )
|
2008-12-16 19:44:57 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
|
|
|
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_TOP:
|
|
|
|
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2008-12-16 19:44:57 +00:00
|
|
|
}
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
if( DrawLibItem->m_Transform[1][0] > 0 )
|
2009-05-12 12:12:34 +00:00
|
|
|
switch( hjustify )
|
2008-12-16 19:44:57 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
case GR_TEXT_HJUSTIFY_LEFT:
|
|
|
|
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
|
|
|
hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2008-12-16 19:44:57 +00:00
|
|
|
}
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
|
|
|
|
if( DrawLibItem->m_Transform[0][0] < 0 )
|
2009-05-12 12:12:34 +00:00
|
|
|
switch( hjustify )
|
2008-12-16 19:44:57 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
case GR_TEXT_HJUSTIFY_LEFT:
|
|
|
|
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
|
|
|
hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2008-12-16 19:44:57 +00:00
|
|
|
}
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
if( DrawLibItem->m_Transform[1][1] > 0 )
|
2009-05-12 12:12:34 +00:00
|
|
|
switch( vjustify )
|
2008-12-16 19:44:57 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
|
|
|
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_TOP:
|
|
|
|
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2008-12-16 19:44:57 +00:00
|
|
|
}
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
int thickness = field->GetPenSize();
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
if( !IsMulti || (FieldNumber != REFERENCE) )
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( textpos, color, field->m_Text,
|
2009-06-28 18:13:55 +00:00
|
|
|
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
|
|
field->m_Size,
|
|
|
|
hjustify, vjustify,
|
|
|
|
thickness, field->m_Italic, field->m_Bold );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2008-09-14 13:05:15 +00:00
|
|
|
else /* We plt the reference, for a multiple parts per package */
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
/* Adding A, B ... to the reference */
|
2008-02-20 19:37:17 +00:00
|
|
|
wxString Text;
|
2008-10-06 05:44:29 +00:00
|
|
|
Text = field->m_Text;
|
2009-05-12 12:12:34 +00:00
|
|
|
char unit_id;
|
2008-11-05 11:41:15 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2009-04-13 05:58:11 +00:00
|
|
|
Text.Append( '.' );
|
|
|
|
unit_id = '1' - 1 + DrawLibItem->m_Multi;
|
2008-11-05 11:41:15 +00:00
|
|
|
#else
|
2009-04-13 05:58:11 +00:00
|
|
|
unit_id = 'A' - 1 + DrawLibItem->m_Multi;
|
2008-11-05 11:41:15 +00:00
|
|
|
#endif
|
2009-04-13 05:58:11 +00:00
|
|
|
Text.Append( unit_id );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( textpos, color, Text,
|
2009-06-28 18:13:55 +00:00
|
|
|
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
|
|
field->m_Size, hjustify, vjustify,
|
|
|
|
thickness, field->m_Italic, field->m_Bold );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
|
2009-06-28 18:13:55 +00:00
|
|
|
int len, int orient, int Shape )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************************************/
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Trace la pin du symbole en cours de trace
|
2008-02-20 19:37:17 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
int MapX1, MapY1, x1, y1;
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
color = ReturnLayerColor( LAYER_PIN );
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( color );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-09-14 13:05:15 +00:00
|
|
|
MapX1 = MapY1 = 0; x1 = pos.x; y1 = pos.y;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
switch( orient )
|
|
|
|
{
|
|
|
|
case PIN_UP:
|
2008-09-14 13:05:15 +00:00
|
|
|
y1 = pos.y - len; MapY1 = 1;
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PIN_DOWN:
|
2008-09-14 13:05:15 +00:00
|
|
|
y1 = pos.y + len; MapY1 = -1;
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PIN_LEFT:
|
2008-09-14 13:05:15 +00:00
|
|
|
x1 = pos.x - len, MapX1 = 1;
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PIN_RIGHT:
|
2008-09-14 13:05:15 +00:00
|
|
|
x1 = pos.x + len; MapX1 = -1;
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Shape & INVERT )
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->circle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
|
2009-06-28 18:13:55 +00:00
|
|
|
MapY1 * INVERT_PIN_RADIUS + y1 ),
|
|
|
|
INVERT_PIN_RADIUS * 2, // diameter
|
|
|
|
NO_FILL, // fill
|
|
|
|
-1 ); // width
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
|
2009-06-28 18:13:55 +00:00
|
|
|
MapY1 * INVERT_PIN_RADIUS * 2 + y1 ) );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->finish_to( pos );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( x1, y1 ) );
|
|
|
|
plotter->finish_to( pos );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( Shape & CLOCK )
|
|
|
|
{
|
|
|
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( x1, y1 + CLOCK_PIN_DIM ) );
|
|
|
|
plotter->line_to( wxPoint( x1 - MapX1 * CLOCK_PIN_DIM, y1 ) );
|
|
|
|
plotter->finish_to( wxPoint( x1, y1 - CLOCK_PIN_DIM ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
else /* MapX1 = 0 */
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( x1 + CLOCK_PIN_DIM, y1 ) );
|
|
|
|
plotter->line_to( wxPoint( x1, y1 - MapY1 * CLOCK_PIN_DIM ) );
|
|
|
|
plotter->finish_to( wxPoint( x1 - CLOCK_PIN_DIM, y1 ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Shape & LOWLEVEL_IN ) /* IEEE symbol "Active Low Input" */
|
|
|
|
{
|
|
|
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
|
|
|
|
plotter->line_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
|
2009-06-28 18:13:55 +00:00
|
|
|
y1 - IEEE_SYMBOL_PIN_DIM ) );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->finish_to( wxPoint( x1, y1 ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
else /* MapX1 = 0 */
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
|
|
|
plotter->line_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
|
2009-06-28 18:13:55 +00:00
|
|
|
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->finish_to( wxPoint( x1, y1 ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( Shape & LOWLEVEL_OUT ) /* IEEE symbol "Active Low Output" */
|
|
|
|
{
|
|
|
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ) );
|
|
|
|
plotter->finish_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
else /* MapX1 = 0 */
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ) );
|
|
|
|
plotter->finish_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-30 17:57:27 +00:00
|
|
|
/********************************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
|
2009-06-30 17:57:27 +00:00
|
|
|
/********************************************************************/
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*
|
2009-05-12 12:12:34 +00:00
|
|
|
* Routine de trace des Textes, Labels et Global-Labels.
|
|
|
|
* Les textes peuvent avoir 4 directions.
|
2008-02-20 19:37:17 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
static std::vector <wxPoint> Poly;
|
2008-12-19 20:40:08 +00:00
|
|
|
|
2009-06-30 17:57:27 +00:00
|
|
|
switch( aSchText->Type() )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
case TYPE_SCH_TEXT:
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
2009-06-30 17:57:27 +00:00
|
|
|
color = ReturnLayerColor( aSchText->m_Layer );
|
|
|
|
wxPoint textpos = aSchText->m_Pos + aSchText->GetSchematicTextOffset();
|
2009-07-01 16:07:18 +00:00
|
|
|
int thickness = aSchText->GetPenSize();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_current_line_width( thickness );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-06-30 17:57:27 +00:00
|
|
|
if( aSchText->m_MultilineAllowed )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2009-05-12 12:12:34 +00:00
|
|
|
wxPoint pos = textpos;
|
2009-06-30 17:57:27 +00:00
|
|
|
wxArrayString* list = wxStringSplit( aSchText->m_Text, '\n' );
|
2009-05-12 12:12:34 +00:00
|
|
|
wxPoint offset;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-30 17:57:27 +00:00
|
|
|
offset.y = aSchText->GetInterline();
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-30 17:57:27 +00:00
|
|
|
RotatePoint( &offset, aSchText->m_Orient );
|
2009-05-12 12:12:34 +00:00
|
|
|
for( unsigned i = 0; i<list->Count(); i++ )
|
|
|
|
{
|
|
|
|
wxString txt = list->Item( i );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos,
|
2009-06-30 17:57:27 +00:00
|
|
|
color, txt, aSchText->m_Orient, aSchText->m_Size,
|
|
|
|
aSchText->m_HJustify, aSchText->m_VJustify,
|
|
|
|
thickness, aSchText->m_Italic, aSchText->m_Bold );
|
2009-05-12 12:12:34 +00:00
|
|
|
pos += offset;
|
|
|
|
}
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
delete (list);
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2009-05-12 12:12:34 +00:00
|
|
|
else
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( textpos,
|
2009-06-30 17:57:27 +00:00
|
|
|
color, aSchText->m_Text, aSchText->m_Orient, aSchText->m_Size,
|
|
|
|
aSchText->m_HJustify, aSchText->m_VJustify,
|
|
|
|
thickness, aSchText->m_Italic, aSchText->m_Bold );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
/* Draw graphic symbol for global or hierachical labels */
|
2009-06-30 17:57:27 +00:00
|
|
|
if( aSchText->Type() == TYPE_SCH_GLOBALLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2009-06-30 17:57:27 +00:00
|
|
|
( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2009-06-30 17:57:27 +00:00
|
|
|
if( aSchText->Type() == TYPE_SCH_HIERLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2009-06-30 17:57:27 +00:00
|
|
|
( (SCH_HIERLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-05-05 18:25:47 +00:00
|
|
|
/*****************************************************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
2009-06-28 18:13:55 +00:00
|
|
|
Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN )
|
2009-05-05 18:25:47 +00:00
|
|
|
/****************************************************************************************/
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2009-05-05 18:25:47 +00:00
|
|
|
/* Plot a Hierarchical_PIN_Sheet
|
2009-05-12 12:12:34 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
|
2009-05-12 12:12:34 +00:00
|
|
|
int posx, tposx, posy, size;
|
|
|
|
|
2009-05-05 18:25:47 +00:00
|
|
|
static std::vector <wxPoint> Poly;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-28 18:13:55 +00:00
|
|
|
txtcolor = ReturnLayerColor( aHierarchical_PIN->GetLayer() );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-05-05 18:25:47 +00:00
|
|
|
posx = aHierarchical_PIN->m_Pos.x;
|
|
|
|
posy = aHierarchical_PIN->m_Pos.y;
|
|
|
|
size = aHierarchical_PIN->m_Size.x;
|
2008-12-16 19:44:57 +00:00
|
|
|
GRTextHorizJustifyType side;
|
2009-05-05 18:25:47 +00:00
|
|
|
if( aHierarchical_PIN->m_Edge )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
|
|
|
tposx = posx - size;
|
|
|
|
side = GR_TEXT_HJUSTIFY_RIGHT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tposx = posx + size + (size / 8);
|
|
|
|
side = GR_TEXT_HJUSTIFY_LEFT;
|
|
|
|
}
|
2009-06-02 07:26:49 +00:00
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
int thickness = aHierarchical_PIN->GetPenSize();
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_current_line_width( thickness );
|
2008-12-20 13:12:57 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( wxPoint( tposx, posy ), txtcolor,
|
2009-06-28 18:13:55 +00:00
|
|
|
aHierarchical_PIN->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
|
|
|
|
side, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-05-05 18:25:47 +00:00
|
|
|
/* Draw the associated graphic symbol */
|
|
|
|
aHierarchical_PIN->CreateGraphicShape( Poly, aHierarchical_PIN->m_Pos );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
|
|
|
/* Routine de dessin du bloc type hierarchie */
|
|
|
|
{
|
2008-04-15 19:38:19 +00:00
|
|
|
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct;
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
|
2009-05-12 12:12:34 +00:00
|
|
|
wxSize size;
|
|
|
|
wxString Text;
|
|
|
|
wxPoint pos;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( Struct->m_Layer ) );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
int thickness = Struct->GetPenSize();
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_current_line_width( thickness );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( Struct->m_Pos );
|
2008-02-20 19:37:17 +00:00
|
|
|
pos = Struct->m_Pos; pos.x += Struct->m_Size.x;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
2008-02-20 19:37:17 +00:00
|
|
|
pos.y += Struct->m_Size.y;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
2008-02-20 19:37:17 +00:00
|
|
|
pos = Struct->m_Pos; pos.y += Struct->m_Size.y;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
|
|
|
plotter->finish_to( Struct->m_Pos );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-12-20 13:12:57 +00:00
|
|
|
/* Draw texts: SheetName */
|
2008-02-20 19:37:17 +00:00
|
|
|
Text = Struct->m_SheetName;
|
|
|
|
size = wxSize( Struct->m_SheetNameSize, Struct->m_SheetNameSize );
|
|
|
|
pos = Struct->m_Pos; pos.y -= 4;
|
2009-06-02 07:26:49 +00:00
|
|
|
thickness = g_DrawDefaultLineThickness;
|
|
|
|
thickness = Clamp_Text_PenSize( thickness, size, false );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_SHEETNAME ) );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
bool italic = false;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, txtcolor,
|
2009-06-28 18:13:55 +00:00
|
|
|
Text, TEXT_ORIENT_HORIZ, size,
|
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
|
|
|
|
thickness, italic, false );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-12-20 13:12:57 +00:00
|
|
|
/*Draw texts : FileName */
|
2008-02-28 19:27:25 +00:00
|
|
|
Text = Struct->GetFileName();
|
2008-02-20 19:37:17 +00:00
|
|
|
size = wxSize( Struct->m_FileNameSize, Struct->m_FileNameSize );
|
2009-06-02 07:26:49 +00:00
|
|
|
thickness = g_DrawDefaultLineThickness;
|
|
|
|
thickness = Clamp_Text_PenSize( thickness, size, false );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
|
2009-06-28 18:13:55 +00:00
|
|
|
txtcolor,
|
|
|
|
Text, TEXT_ORIENT_HORIZ, size,
|
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
|
|
|
|
thickness, italic, false );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-12-20 13:12:57 +00:00
|
|
|
/* Draw texts : SheetLabel */
|
2008-02-20 19:37:17 +00:00
|
|
|
SheetLabelStruct = Struct->m_Label;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( Struct->m_Layer ) );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
while( SheetLabelStruct != NULL )
|
|
|
|
{
|
2009-06-28 18:13:55 +00:00
|
|
|
Plot_Hierarchical_PIN_Sheet( plotter, SheetLabelStruct );
|
2008-11-24 06:53:43 +00:00
|
|
|
SheetLabelStruct = SheetLabelStruct->Next();
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2009-06-28 18:13:55 +00:00
|
|
|
|
2009-06-30 20:18:18 +00:00
|
|
|
/********************************************************/
|
2009-08-29 10:20:48 +00:00
|
|
|
void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
2009-06-30 20:18:18 +00:00
|
|
|
/*********************************************************/
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2009-06-30 20:18:18 +00:00
|
|
|
while( aDrawlist ) /* Plot each item in draw list */
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2009-06-28 18:13:55 +00:00
|
|
|
SCH_COMPONENT* DrawLibItem;
|
|
|
|
int layer;
|
|
|
|
wxPoint StartPos, EndPos;
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
plotter->set_current_line_width( aDrawlist->GetPenSize() );
|
2009-06-30 20:18:18 +00:00
|
|
|
switch( aDrawlist->Type() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2009-07-01 16:07:18 +00:00
|
|
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
2009-06-30 10:43:20 +00:00
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
2009-06-30 20:18:18 +00:00
|
|
|
if( aDrawlist->Type() == DRAW_BUSENTRY_STRUCT_TYPE )
|
2009-06-30 10:43:20 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
#undef STRUCT
|
2009-06-30 20:18:18 +00:00
|
|
|
#define STRUCT ( (DrawBusEntryStruct*) aDrawlist )
|
2009-06-30 10:43:20 +00:00
|
|
|
StartPos = STRUCT->m_Pos;
|
|
|
|
EndPos = STRUCT->m_End();
|
|
|
|
layer = STRUCT->GetLayer();
|
|
|
|
plotter->set_color( ReturnLayerColor( layer ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
#undef STRUCT
|
2009-06-30 20:18:18 +00:00
|
|
|
#define STRUCT ( (EDA_DrawLineStruct*) aDrawlist )
|
2009-06-30 10:43:20 +00:00
|
|
|
StartPos = STRUCT->m_Start;
|
|
|
|
EndPos = STRUCT->m_End;
|
|
|
|
layer = STRUCT->GetLayer();
|
|
|
|
plotter->set_color( ReturnLayerColor( layer ) );
|
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2009-07-01 16:07:18 +00:00
|
|
|
if( layer == LAYER_NOTES )
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_dash( true );
|
2009-07-01 16:07:18 +00:00
|
|
|
plotter->move_to( StartPos );
|
|
|
|
plotter->finish_to( EndPos );
|
|
|
|
if( layer == LAYER_NOTES )
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_dash( false );
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
2009-06-30 20:18:18 +00:00
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (DrawJunctionStruct*) aDrawlist )
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
|
2009-07-01 17:32:16 +00:00
|
|
|
plotter->circle( STRUCT->m_Pos, DRAWJUNCTION_DIAMETER, FILLED_SHAPE );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPE_SCH_TEXT:
|
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
2009-06-30 20:18:18 +00:00
|
|
|
PlotTextStruct( plotter, (SCH_TEXT*) aDrawlist );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPE_SCH_COMPONENT:
|
2009-06-30 20:18:18 +00:00
|
|
|
DrawLibItem = (SCH_COMPONENT*) aDrawlist;
|
2009-06-28 18:13:55 +00:00
|
|
|
PlotLibPart( plotter, DrawLibItem );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
|
|
|
break;
|
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
case TYPE_MARKER_SCH:
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
2009-06-30 20:18:18 +00:00
|
|
|
PlotSheetStruct( plotter, (DrawSheetStruct*) aDrawlist );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( LAYER_NOCONNECT ) );
|
2009-06-30 20:18:18 +00:00
|
|
|
PlotNoConnectStruct( plotter, (DrawNoConnectStruct*) aDrawlist );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-06-30 20:18:18 +00:00
|
|
|
aDrawlist = aDrawlist->Next();
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
}
|