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 "gr_basic.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
|
|
|
#include "plot_common.h"
|
|
|
|
#include "worksheet.h"
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
2008-09-14 13:05:15 +00:00
|
|
|
/* Local Variables : */
|
2008-04-15 19:38:19 +00:00
|
|
|
static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct );
|
2008-03-20 01:50:21 +00:00
|
|
|
static void PlotTextField( SCH_COMPONENT* DrawLibItem,
|
2008-02-20 19:37:17 +00:00
|
|
|
int FieldNumber, int IsMulti, int DrawMode );
|
2008-09-14 13:05:15 +00:00
|
|
|
static void PlotPinSymbol( const wxPoint & pos, int len, int orient, int Shape );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/***/
|
|
|
|
|
2008-09-14 13:05:15 +00:00
|
|
|
/* Defines for filling polygons in plot polygon functions */
|
2008-08-05 17:25:10 +00:00
|
|
|
#define FILL true
|
|
|
|
#define NOFILL false
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* routine de lever ou baisser de plume.
|
2008-02-20 19:37:17 +00:00
|
|
|
* si plume = 'U' les traces suivants se feront plume levee
|
|
|
|
* si plume = 'D' les traces suivants se feront plume levee
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
void Plume( int plume )
|
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
if( g_PlotFormat == PLOT_FORMAT_HPGL )
|
|
|
|
Plume_HPGL( plume );
|
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 deplacement de plume de plume.
|
2008-02-20 19:37:17 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
void Move_Plume( wxPoint pos, int plume )
|
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
switch( g_PlotFormat )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
Move_Plume_HPGL( pos, plume );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
LineTo_PS( pos, plume );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
void SetCurrentLineWidth( int width )
|
|
|
|
{
|
|
|
|
switch( g_PlotFormat )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
SetCurrentLineWidthPS( width );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-06-30 13:47:55 +00:00
|
|
|
/*******************************************************************************/
|
|
|
|
void PlotRect( wxPoint p1, wxPoint p2, int fill, int width )
|
|
|
|
/*******************************************************************************/
|
|
|
|
{
|
|
|
|
switch( g_PlotFormat )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
PlotRectHPGL( p1, p2, fill, width );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
PlotRectPS( p1, p2, fill, width );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-09-14 13:05:15 +00:00
|
|
|
/*****************************************************************************************/
|
|
|
|
void PlotArc( wxPoint aCentre, int aStAngle, int aEndAngle, int aRadius, bool aFill, int aWidth )
|
|
|
|
/*****************************************************************************************/
|
|
|
|
|
|
|
|
/** Function PlotArc
|
|
|
|
* Plot an arc:
|
|
|
|
* @param aCentre = Arc centre
|
|
|
|
* @param aStAngle = begining of arc in 0.1 degrees
|
|
|
|
* @param aEndAngle = end of arc in 0.1 degrees
|
|
|
|
* @param aRadius = Arc radius
|
|
|
|
* @param aFill = fill option
|
|
|
|
* @param aWidth = Tickness of outlines
|
2008-02-20 19:37:17 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
switch( g_PlotFormat )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2008-09-14 13:05:15 +00:00
|
|
|
PlotArcHPGL( aCentre, aStAngle, aEndAngle, aRadius, aFill, aWidth );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
2008-09-14 13:05:15 +00:00
|
|
|
PlotArcPS( aCentre, aStAngle, aEndAngle, aRadius, aFill, aWidth );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-09-14 13:05:15 +00:00
|
|
|
/*****************************************************************/
|
2008-08-05 17:25:10 +00:00
|
|
|
void PlotCercle( wxPoint pos, int diametre, bool fill, int width )
|
2008-09-14 13:05:15 +00:00
|
|
|
/*****************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
switch( g_PlotFormat )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2008-06-30 13:47:55 +00:00
|
|
|
PlotCircleHPGL( pos, diametre, fill, width );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
2008-06-30 13:47:55 +00:00
|
|
|
PlotCirclePS( pos, diametre, fill, width );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/******************************************************************/
|
2008-08-05 17:25:10 +00:00
|
|
|
void PlotPoly( int nb, int* coord, bool fill, int width )
|
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 un polygone ferme
|
2008-02-20 19:37:17 +00:00
|
|
|
* coord = tableau des coord des sommets
|
|
|
|
* nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau )
|
|
|
|
* fill : si != 0 polygone rempli
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
if( nb <= 1 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch( g_PlotFormat )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
PlotPolyHPGL( nb, coord, fill, width );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
PlotPolyPS( nb, coord, fill, width );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/
|
2008-02-20 19:37:17 +00:00
|
|
|
void PlotNoConnectStruct( 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
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
SetCurrentLineWidth( -1 );
|
|
|
|
Move_Plume( wxPoint( pX - DELTA, pY - DELTA ), 'U' );
|
|
|
|
Move_Plume( wxPoint( pX + DELTA, pY + DELTA ), 'D' );
|
|
|
|
Move_Plume( wxPoint( pX + DELTA, pY - DELTA ), 'U' );
|
|
|
|
Move_Plume( wxPoint( pX - DELTA, pY + DELTA ), 'D' );
|
|
|
|
Plume( 'U' );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2008-03-20 01:50:21 +00:00
|
|
|
void PlotLibPart( 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
|
|
|
{
|
2008-09-14 13:05:15 +00:00
|
|
|
int ii, t1, t2, * Poly, orient;
|
2008-02-20 19:37:17 +00:00
|
|
|
LibEDA_BaseStruct* DEntry;
|
|
|
|
EDA_LibComponentStruct* Entry;
|
2008-09-14 13:05:15 +00:00
|
|
|
int TransMat[2][2], Multi, convert;
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors CharColor = UNSPECIFIED_COLOR;
|
2008-02-20 19:37:17 +00:00
|
|
|
wxPoint pos;
|
2008-08-23 06:44:47 +00:00
|
|
|
bool draw_bgfill = false;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
|
|
|
if( Entry == NULL )
|
|
|
|
return;;
|
|
|
|
memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
|
|
|
|
Multi = DrawLibItem->m_Multi;
|
|
|
|
convert = DrawLibItem->m_Convert;
|
|
|
|
|
|
|
|
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;
|
|
|
|
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
Plume( 'U' );
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
2008-08-23 06:44:47 +00:00
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
2008-08-23 06:44:47 +00:00
|
|
|
draw_bgfill = true;
|
|
|
|
}
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
switch( DEntry->Type() )
|
|
|
|
{
|
|
|
|
case COMPONENT_ARC_DRAW_TYPE:
|
2008-08-23 06:44:47 +00:00
|
|
|
{
|
2008-09-09 16:56:47 +00:00
|
|
|
LibDrawArc* Arc = (LibDrawArc*) DEntry;
|
|
|
|
t1 = Arc->t1; t2 = Arc->t2;
|
2008-09-14 13:05:15 +00:00
|
|
|
pos = TransformCoordinate( TransMat, Arc->m_Pos ) + DrawLibItem->m_Pos;
|
2008-09-09 16:56:47 +00:00
|
|
|
MapAngles( &t1, &t2, TransMat );
|
|
|
|
if ( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
|
|
{
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
|
|
|
PlotArc( pos, t1, t2, Arc->m_Rayon, true, 0 );
|
|
|
|
}
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
|
|
|
PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Fill == FILLED_SHAPE ? true : false, Arc->m_Width );
|
2008-08-23 06:44:47 +00:00
|
|
|
}
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
2008-08-23 06:44:47 +00:00
|
|
|
{
|
2008-09-09 16:56:47 +00:00
|
|
|
LibDrawCircle* Circle = (LibDrawCircle*) DEntry;
|
2008-09-14 13:05:15 +00:00
|
|
|
pos = TransformCoordinate( TransMat, Circle->m_Pos ) + DrawLibItem->m_Pos;
|
2008-09-09 16:56:47 +00:00
|
|
|
if ( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
|
|
{
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
|
|
|
PlotCercle( pos, Circle->m_Rayon * 2, true, 0 );
|
|
|
|
}
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
|
|
|
PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Fill == FILLED_SHAPE ? true : false, Circle->m_Width );
|
2008-08-23 06:44:47 +00:00
|
|
|
}
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
2008-09-09 16:56:47 +00:00
|
|
|
{
|
2008-12-20 13:12:57 +00:00
|
|
|
LibDrawText* Text = (LibDrawText*) DEntry;
|
|
|
|
|
|
|
|
/* The text orientation may need to be flipped if the
|
|
|
|
* transformation matrix causes xy axes to be flipped. */
|
2008-12-28 18:00:37 +00:00
|
|
|
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;
|
|
|
|
SetCurrentLineWidth( -1 );
|
|
|
|
int thickness = Text->m_Width;
|
|
|
|
if( thickness == 0 ) //
|
|
|
|
thickness = MAX( g_PlotPSMinimunLineWidth, g_DrawMinimunLineWidth );
|
|
|
|
PlotGraphicText( g_PlotFormat, pos, CharColor,
|
2008-09-09 16:56:47 +00:00
|
|
|
Text->m_Text,
|
|
|
|
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
|
|
|
|
Text->m_Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness);
|
2008-09-09 16:56:47 +00:00
|
|
|
}
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_RECT_DRAW_TYPE:
|
2008-08-23 06:44:47 +00:00
|
|
|
{
|
2008-09-09 16:56:47 +00:00
|
|
|
LibDrawSquare* Square = (LibDrawSquare*) DEntry;
|
2008-09-14 13:05:15 +00:00
|
|
|
pos = TransformCoordinate( TransMat, Square->m_Pos ) + DrawLibItem->m_Pos;
|
|
|
|
wxPoint end = TransformCoordinate( TransMat, Square->m_End ) + DrawLibItem->m_Pos;
|
2008-09-09 16:56:47 +00:00
|
|
|
|
|
|
|
if ( draw_bgfill && Square->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
|
|
{
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
2008-09-14 13:05:15 +00:00
|
|
|
PlotRect( pos, end, true, 0 );
|
2008-09-09 16:56:47 +00:00
|
|
|
}
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
2008-09-14 13:05:15 +00:00
|
|
|
PlotRect( pos, end, Square->m_Fill == FILLED_SHAPE ? true : false, Square->m_Width );
|
2008-08-23 06:44:47 +00:00
|
|
|
}
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
|
|
|
|
{
|
2008-09-09 16:56:47 +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 */
|
2008-09-14 13:05:15 +00:00
|
|
|
pos = TransformCoordinate( TransMat, Pin->m_Pos ) + DrawLibItem->m_Pos;
|
2008-09-09 16:56:47 +00:00
|
|
|
|
|
|
|
/* Dessin de la pin et du symbole special associe */
|
|
|
|
SetCurrentLineWidth( -1 );
|
2008-09-14 13:05:15 +00:00
|
|
|
PlotPinSymbol( pos, Pin->m_PinLen, orient, Pin->m_PinShape );
|
2008-12-19 20:40:08 +00:00
|
|
|
int thickness = 0; // @todo: calcultae the pen tickness
|
2008-09-14 13:05:15 +00:00
|
|
|
Pin->PlotPinTexts( pos, orient,
|
2008-09-09 16:56:47 +00:00
|
|
|
Entry->m_TextInside,
|
2008-12-19 20:40:08 +00:00
|
|
|
Entry->m_DrawPinNum, Entry->m_DrawPinName,
|
|
|
|
thickness, false);
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
|
|
{
|
2008-09-09 16:56:47 +00:00
|
|
|
LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
|
2009-01-02 13:19:34 +00:00
|
|
|
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->GetCornerCount() );
|
|
|
|
for( ii = 0; ii < (int)polyline->GetCornerCount(); ii++ )
|
2008-09-09 16:56:47 +00:00
|
|
|
{
|
2009-01-02 13:19:34 +00:00
|
|
|
pos = polyline->m_PolyPoints[ii];
|
2008-09-14 13:05:15 +00:00
|
|
|
pos = TransformCoordinate( TransMat, pos ) + DrawLibItem->m_Pos;
|
|
|
|
Poly[ii * 2] = pos.x;
|
|
|
|
Poly[ii * 2 + 1] = pos.y;
|
2008-09-09 16:56:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
|
|
{
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
|
|
|
PlotPoly( ii, Poly, true, 0 );
|
|
|
|
}
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
|
|
|
PlotPoly( ii, Poly, polyline->m_Fill == FILLED_SHAPE ? true : false, polyline->m_Width );
|
|
|
|
MyFree( Poly );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-09-09 16:56:47 +00:00
|
|
|
D(printf("Drawing Type=%d\n", DEntry->Type() )) ;
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Fin Switch */
|
|
|
|
Plume( 'U' );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fin Boucle de dessin */
|
|
|
|
|
|
|
|
/* Trace des champs, avec placement et orientation selon orient. du
|
|
|
|
* composant
|
|
|
|
* Si la reference commence par # elle n'est pas tracee
|
|
|
|
*/
|
|
|
|
|
|
|
|
if( (Entry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE) == 0 )
|
|
|
|
{
|
|
|
|
if( Entry->m_UnitCount > 1 )
|
|
|
|
PlotTextField( DrawLibItem, REFERENCE, 1, 0 );
|
|
|
|
else
|
|
|
|
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 );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************/
|
2008-03-20 01:50:21 +00:00
|
|
|
static void PlotTextField( 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.
|
2008-02-20 19:37:17 +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
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
{
|
2008-09-14 13:05:15 +00:00
|
|
|
wxPoint textpos; /* Position des textes */
|
2008-10-06 05:44:29 +00:00
|
|
|
SCH_CMP_FIELD* field = DrawLibItem->GetField( FieldNumber );
|
2008-12-14 19:45:05 +00:00
|
|
|
int orient;
|
|
|
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
2008-10-06 05:44:29 +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 */
|
2008-10-06 05:44:29 +00:00
|
|
|
orient = field->m_Orient;
|
2008-12-16 19:44:57 +00:00
|
|
|
GRTextHorizJustifyType hjustify = field->m_HJustify;
|
|
|
|
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 )
|
2008-12-16 19:44:57 +00:00
|
|
|
switch ( vjustify )
|
|
|
|
{
|
|
|
|
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-02-20 19:37:17 +00:00
|
|
|
if( DrawLibItem->m_Transform[1][0] > 0 )
|
2008-12-16 19:44:57 +00:00
|
|
|
switch ( hjustify )
|
|
|
|
{
|
|
|
|
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-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 )
|
2008-12-16 19:44:57 +00:00
|
|
|
switch ( hjustify )
|
|
|
|
{
|
|
|
|
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-02-20 19:37:17 +00:00
|
|
|
if( DrawLibItem->m_Transform[1][1] > 0 )
|
2008-12-16 19:44:57 +00:00
|
|
|
switch ( vjustify )
|
|
|
|
{
|
|
|
|
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-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
2008-12-20 13:12:57 +00:00
|
|
|
int thickness = field->m_Width;
|
|
|
|
if( thickness == 0 )
|
|
|
|
thickness = MAX( g_PlotPSMinimunLineWidth, g_DrawMinimunLineWidth );
|
|
|
|
SetCurrentLineWidth( thickness );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
//@todo not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
|
2008-02-20 19:37:17 +00:00
|
|
|
if( !IsMulti || (FieldNumber != REFERENCE) )
|
|
|
|
{
|
2008-10-06 05:44:29 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, textpos, color, field->m_Text,
|
2008-02-20 19:37:17 +00:00
|
|
|
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
2008-10-06 05:44:29 +00:00
|
|
|
field->m_Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
hjustify, vjustify,
|
|
|
|
thickness, field->m_Italic);
|
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
|
|
|
{
|
2008-09-14 13:05:15 +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;
|
2008-11-05 11:41:15 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2008-11-24 06:53:43 +00:00
|
|
|
Text.Append( '.' );
|
2008-11-05 11:41:15 +00:00
|
|
|
Text.Append( '1' - 1 + DrawLibItem->m_Multi );
|
|
|
|
#else
|
2008-02-20 19:37:17 +00:00
|
|
|
Text.Append( 'A' - 1 + DrawLibItem->m_Multi );
|
2008-11-05 11:41:15 +00:00
|
|
|
#endif
|
2008-09-14 13:05:15 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, textpos, color, Text,
|
2008-02-20 19:37:17 +00:00
|
|
|
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
2008-12-19 20:40:08 +00:00
|
|
|
field->m_Size, hjustify, vjustify,
|
|
|
|
thickness, field->m_Italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
2008-09-14 13:05:15 +00:00
|
|
|
static void PlotPinSymbol( const wxPoint & pos, 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
|
|
|
{
|
2008-02-20 19:37:17 +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 );
|
|
|
|
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( color );
|
|
|
|
|
|
|
|
SetCurrentLineWidth( -1 );
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
|
2008-06-30 13:47:55 +00:00
|
|
|
MapY1 * INVERT_PIN_RADIUS + y1),
|
2008-09-09 16:56:47 +00:00
|
|
|
INVERT_PIN_RADIUS * 2, // diameter
|
|
|
|
false, // fill
|
|
|
|
-1 ); // width
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
Move_Plume( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
|
|
|
|
MapY1 * INVERT_PIN_RADIUS * 2 + y1 ), 'U' );
|
2008-09-14 13:05:15 +00:00
|
|
|
Move_Plume( pos, 'D' );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Move_Plume( wxPoint( x1, y1 ), 'U' );
|
2008-09-14 13:05:15 +00:00
|
|
|
Move_Plume( pos, 'D' );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( Shape & CLOCK )
|
|
|
|
{
|
|
|
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
|
|
|
{
|
|
|
|
Move_Plume( wxPoint( x1, y1 + CLOCK_PIN_DIM ), 'U' );
|
|
|
|
Move_Plume( wxPoint( x1 - MapX1 * CLOCK_PIN_DIM, y1 ), 'D' );
|
|
|
|
Move_Plume( wxPoint( x1, y1 - CLOCK_PIN_DIM ), 'D' );
|
|
|
|
}
|
|
|
|
else /* MapX1 = 0 */
|
|
|
|
{
|
|
|
|
Move_Plume( wxPoint( x1 + CLOCK_PIN_DIM, y1 ), 'U' );
|
|
|
|
Move_Plume( wxPoint( x1, y1 - MapY1 * CLOCK_PIN_DIM ), 'D' );
|
|
|
|
Move_Plume( wxPoint( x1 - CLOCK_PIN_DIM, y1 ), 'D' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Shape & LOWLEVEL_IN ) /* IEEE symbol "Active Low Input" */
|
|
|
|
{
|
|
|
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
|
|
|
{
|
|
|
|
Move_Plume( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ), 'U' );
|
|
|
|
Move_Plume( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
|
|
|
|
y1 - IEEE_SYMBOL_PIN_DIM ), 'D' );
|
|
|
|
Move_Plume( wxPoint( x1, y1 ), 'D' );
|
|
|
|
}
|
|
|
|
else /* MapX1 = 0 */
|
|
|
|
{
|
|
|
|
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' );
|
|
|
|
Move_Plume( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ), 'D' );
|
|
|
|
}
|
|
|
|
else /* MapX1 = 0 */
|
|
|
|
{
|
|
|
|
Move_Plume( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ), 'U' );
|
|
|
|
Move_Plume( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ), 'D' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Plume( 'U' );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************/
|
2008-02-20 19:37:17 +00:00
|
|
|
void PlotTextStruct( EDA_BaseStruct* 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
|
|
|
/*
|
2008-02-20 19:37:17 +00:00
|
|
|
* Routine de trace des Textes, Labels et Global-Labels.
|
|
|
|
* Les textes peuvent avoir 4 directions.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-20 19:37:17 +00:00
|
|
|
int Poly[50];
|
|
|
|
int pX, pY, Shape = 0, Orient = 0, offset;
|
|
|
|
wxSize Size;
|
|
|
|
wxString Text;
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
bool italic = false;
|
|
|
|
int thickness = 0;
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
switch( Struct->Type() )
|
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
case TYPE_SCH_TEXT:
|
|
|
|
Text = ( (SCH_TEXT*) Struct )->m_Text;
|
|
|
|
Size = ( (SCH_TEXT*) Struct )->m_Size;
|
2008-12-19 20:40:08 +00:00
|
|
|
thickness = ( (SCH_TEXT*) Struct )->m_Width;
|
|
|
|
italic = ( (SCH_TEXT*) Struct )->m_Italic;
|
2008-03-20 01:50:21 +00:00
|
|
|
Orient = ( (SCH_TEXT*) Struct )->m_Orient;
|
|
|
|
Shape = ( (SCH_TEXT*) Struct )->m_Shape;
|
|
|
|
pX = ( (SCH_TEXT*) Struct )->m_Pos.x;
|
|
|
|
pY = ( (SCH_TEXT*) Struct )->m_Pos.y;
|
2008-02-20 19:37:17 +00:00
|
|
|
offset = TXTMARGE;
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_GLOBALLABEL
|
|
|
|
|| Struct->Type() == TYPE_SCH_HIERLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
offset += Size.x; // We must draw the Glabel graphic symbol
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
2008-03-20 01:50:21 +00:00
|
|
|
color = ReturnLayerColor( ( (SCH_TEXT*) Struct )->m_Layer );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Size.x == 0 )
|
|
|
|
Size = wxSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
if ( Struct->Type() == TYPE_SCH_GLOBALLABEL )
|
|
|
|
{
|
|
|
|
offset = ( (SCH_GLOBALLABEL*) Struct )->m_Width;
|
|
|
|
switch( Shape )
|
|
|
|
{
|
|
|
|
case NET_INPUT:
|
|
|
|
case NET_BIDI:
|
|
|
|
case NET_TRISTATE:
|
|
|
|
offset += Size.x/2;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_OUTPUT:
|
|
|
|
offset += TXTMARGE;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-20 13:12:57 +00:00
|
|
|
if( thickness == 0 )
|
|
|
|
thickness = MAX( g_PlotPSMinimunLineWidth, g_DrawMinimunLineWidth );
|
|
|
|
SetCurrentLineWidth( thickness );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
switch( Orient )
|
|
|
|
{
|
|
|
|
case 0: /* Orientation horiz normale */
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
|
|
|
|
color, Text, TEXT_ORIENT_HORIZ, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
else
|
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
|
|
|
|
color, Text, TEXT_ORIENT_HORIZ, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* Orientation vert UP */
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
|
|
|
|
color, Text, TEXT_ORIENT_VERT, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
else
|
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX - offset, pY ),
|
|
|
|
color, Text, TEXT_ORIENT_VERT, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* Horiz Orientation - Right justified */
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
|
|
|
|
color, Text, TEXT_ORIENT_HORIZ, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
else
|
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY + offset ),
|
|
|
|
color, Text, TEXT_ORIENT_HORIZ, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* Orientation vert BOTTOM */
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_GLOBALLABEL || Struct->Type() == TYPE_SCH_HIERLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX, pY - offset ),
|
|
|
|
color, Text, TEXT_ORIENT_VERT, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
else
|
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( pX + offset, pY ),
|
|
|
|
color, Text, TEXT_ORIENT_VERT, Size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw graphic symbol for global or hierachical labels */
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_GLOBALLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
( (SCH_GLOBALLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotPoly( Poly[0], Poly + 1, NOFILL );
|
|
|
|
}
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_HIERLABEL )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
( (SCH_HIERLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotPoly( Poly[0], Poly + 1, NOFILL );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
/***********************************************************************/
|
2008-04-15 19:38:19 +00:00
|
|
|
static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
|
2008-12-14 19:45:05 +00:00
|
|
|
/***********************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Routine de dessin des Sheet Labels type hierarchie */
|
|
|
|
{
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
|
2008-02-20 19:37:17 +00:00
|
|
|
int posx, tposx, posy, size, size2;
|
|
|
|
int coord[16];
|
|
|
|
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
2008-04-14 19:22:48 +00:00
|
|
|
txtcolor = ReturnLayerColor( Struct->GetLayer() );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
posx = Struct->m_Pos.x; posy = Struct->m_Pos.y; size = Struct->m_Size.x;
|
2008-12-16 19:44:57 +00:00
|
|
|
GRTextHorizJustifyType side;
|
2008-02-20 19:37:17 +00:00
|
|
|
if( Struct->m_Edge )
|
|
|
|
{
|
|
|
|
tposx = posx - size;
|
|
|
|
side = GR_TEXT_HJUSTIFY_RIGHT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tposx = posx + size + (size / 8);
|
|
|
|
side = GR_TEXT_HJUSTIFY_LEFT;
|
|
|
|
}
|
2008-12-19 20:40:08 +00:00
|
|
|
int thickness = Struct->m_Width;
|
2008-12-20 13:12:57 +00:00
|
|
|
if( thickness == 0 )
|
|
|
|
thickness = MAX( g_PlotPSMinimunLineWidth, g_DrawMinimunLineWidth );
|
|
|
|
SetCurrentLineWidth( thickness );
|
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
bool italic = Struct->m_Italic;
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, wxPoint( tposx, posy ), txtcolor,
|
|
|
|
Struct->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
|
2008-12-19 20:40:08 +00:00
|
|
|
side, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic );
|
2008-02-20 19:37:17 +00:00
|
|
|
/* dessin du symbole de connexion */
|
|
|
|
|
|
|
|
if( Struct->m_Edge )
|
|
|
|
size = -size;
|
|
|
|
coord[0] = posx; coord[1] = posy; size2 = size / 2;
|
|
|
|
|
|
|
|
switch( Struct->m_Shape )
|
|
|
|
{
|
|
|
|
case 0: /* input |> */
|
|
|
|
coord[2] = posx; coord[3] = posy - size2;
|
|
|
|
coord[4] = posx + size2; coord[5] = posy - size2;
|
|
|
|
coord[6] = posx + size; coord[7] = posy;
|
|
|
|
coord[8] = posx + size2; coord[9] = posy + size2;
|
|
|
|
coord[10] = posx; coord[11] = posy + size2;
|
|
|
|
coord[12] = posx; coord[13] = posy;
|
|
|
|
PlotPoly( 7, coord, NOFILL );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* output <| */
|
|
|
|
coord[2] = posx + size2; coord[3] = posy - size2;
|
|
|
|
coord[4] = posx + size; coord[5] = posy - size2;
|
|
|
|
coord[6] = posx + size; coord[7] = posy + size2;
|
|
|
|
coord[8] = posx + size2; coord[9] = posy + size2;
|
|
|
|
coord[10] = posx; coord[11] = posy;
|
|
|
|
PlotPoly( 6, coord, NOFILL );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* bidi <> */
|
|
|
|
case 3: /* TriSt <> */
|
|
|
|
coord[2] = posx + size2; coord[3] = posy - size2;
|
|
|
|
coord[4] = posx + size; coord[5] = posy;
|
|
|
|
coord[6] = posx + size2; coord[7] = posy + size2;
|
|
|
|
coord[8] = posx; coord[9] = posy;
|
|
|
|
PlotPoly( 5, coord, NOFILL );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: /* unsp []*/
|
|
|
|
coord[2] = posx; coord[3] = posy - size2;
|
|
|
|
coord[4] = posx + size; coord[5] = posy - size2;
|
|
|
|
coord[6] = posx + size; coord[7] = posy + size2;
|
|
|
|
coord[8] = posx; coord[9] = posy + size2;
|
|
|
|
coord[10] = posx; coord[11] = posy;
|
|
|
|
PlotPoly( 6, coord, NOFILL );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2008-02-20 19:37:17 +00:00
|
|
|
void PlotSheetStruct( 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;
|
2008-02-20 19:37:17 +00:00
|
|
|
wxSize size;
|
|
|
|
wxString Text;
|
|
|
|
wxPoint pos;
|
|
|
|
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( Struct->m_Layer ) );
|
|
|
|
|
2008-12-20 13:12:57 +00:00
|
|
|
int thickness = MAX( g_PlotPSMinimunLineWidth, g_DrawMinimunLineWidth );
|
|
|
|
SetCurrentLineWidth( thickness );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
|
|
|
Move_Plume( Struct->m_Pos, 'U' );
|
|
|
|
pos = Struct->m_Pos; pos.x += Struct->m_Size.x;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
Move_Plume( pos, 'D' );
|
|
|
|
pos.y += Struct->m_Size.y;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
Move_Plume( pos, 'D' );
|
|
|
|
pos = Struct->m_Pos; pos.y += Struct->m_Size.y;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
Move_Plume( pos, 'D' );
|
|
|
|
Move_Plume( Struct->m_Pos, 'D' );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
Plume( 'U' );
|
|
|
|
|
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;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_SHEETNAME ) );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
bool italic = false;
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotGraphicText( g_PlotFormat, pos, txtcolor,
|
|
|
|
Text, TEXT_ORIENT_HORIZ, size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
|
|
|
|
thickness, italic );
|
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 );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( LAYER_SHEETFILENAME ) );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
PlotGraphicText( g_PlotFormat,
|
|
|
|
wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
|
|
|
|
txtcolor,
|
|
|
|
Text, TEXT_ORIENT_HORIZ, size,
|
2008-12-19 20:40:08 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
|
|
|
|
thickness, italic );
|
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;
|
|
|
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
|
|
SetColorMapPS( ReturnLayerColor( Struct->m_Layer ) );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
while( SheetLabelStruct != NULL )
|
|
|
|
{
|
|
|
|
PlotSheetLabelStruct( 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
|
|
|
}
|