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 "general.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2010-03-04 09:32:51 +00:00
|
|
|
#include "class_pin.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-17 11:14:57 +00:00
|
|
|
/* Local functions : */
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
2010-04-24 09:03:35 +00:00
|
|
|
int FieldNumber, bool IsMulti, int DrawMode );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
static void PlotNoConnectStruct( PLOTTER* plotter, SCH_NO_CONNECT* Struct )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-28 09:24:37 +00:00
|
|
|
int delta = Struct->m_Size.x / 2;
|
2008-02-20 19:37:17 +00:00
|
|
|
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-11-28 09:24:37 +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
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-09-18 14:56:05 +00:00
|
|
|
LIB_COMPONENT* Entry;
|
2009-10-05 17:52:41 +00:00
|
|
|
int TransMat[2][2];
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
|
2009-10-05 17:52:41 +00:00
|
|
|
|
2008-02-20 19:37:17 +00:00
|
|
|
if( Entry == NULL )
|
|
|
|
return;;
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2009-10-05 17:52:41 +00:00
|
|
|
memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-10-05 17:52:41 +00:00
|
|
|
Entry->Plot( plotter, DrawLibItem->m_Multi, DrawLibItem->m_Convert,
|
|
|
|
DrawLibItem->m_Pos, TransMat );
|
2010-04-24 09:03:35 +00:00
|
|
|
bool isMulti = Entry->GetPartCount() > 1;
|
2010-05-08 16:32:35 +00:00
|
|
|
for( int fieldId = 0; fieldId < DrawLibItem->GetFieldCount(); fieldId++ )
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
2010-04-24 09:03:35 +00:00
|
|
|
PlotTextField( plotter, DrawLibItem, fieldId, isMulti, 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
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* Plot field text.
|
|
|
|
* Input:
|
|
|
|
* DrawLibItem: pointer to the component
|
|
|
|
* FieldNumber: Number Field
|
2010-04-24 09:03:35 +00:00
|
|
|
* IsMulti: true flag if there are several parts per package.
|
2009-11-04 20:46:53 +00:00
|
|
|
* Only useful for the field to add a reference to this one
|
|
|
|
* The identification from (A, B ...)
|
|
|
|
* DrawMode: trace mode
|
|
|
|
*/
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
2010-04-24 09:03:35 +00:00
|
|
|
int FieldNumber, bool IsMulti, int DrawMode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_FIELD* field = DrawLibItem->GetField( FieldNumber );
|
|
|
|
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;
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* Calculate the text orientation, according to the component
|
|
|
|
* orientation/mirror */
|
2009-10-16 07:48:26 +00:00
|
|
|
int orient = field->m_Orient;
|
2009-11-04 20:46:53 +00:00
|
|
|
if( DrawLibItem->m_Transform[0][1] ) // Rotate component 90 deg.
|
2008-02-20 19:37:17 +00:00
|
|
|
{
|
|
|
|
if( orient == TEXT_ORIENT_HORIZ )
|
|
|
|
orient = TEXT_ORIENT_VERT;
|
|
|
|
else
|
|
|
|
orient = TEXT_ORIENT_HORIZ;
|
|
|
|
}
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* Calculate the text justification, according to the component
|
|
|
|
* orientation/mirror
|
2009-10-16 07:48:26 +00:00
|
|
|
* this is a bit complicated due to cumulative calculations:
|
|
|
|
* - numerous cases (mirrored or not, rotation)
|
2009-11-04 20:46:53 +00:00
|
|
|
* - the DrawGraphicText function recalculate also H and H justifications
|
|
|
|
* according to the text orientation.
|
|
|
|
* - When a component is mirrored, the text is not mirrored and
|
|
|
|
* justifications are complicated to calculate
|
2009-10-16 07:48:26 +00:00
|
|
|
* so the more easily way is to use no justifications ( Centered text )
|
|
|
|
* and use GetBoundaryBox to know the text coordinate considered as centered
|
2009-11-04 20:46:53 +00:00
|
|
|
*/
|
2009-10-16 07:48:26 +00:00
|
|
|
EDA_Rect BoundaryBox = field->GetBoundaryBox();
|
|
|
|
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
|
2010-09-05 17:01:48 +00:00
|
|
|
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
|
|
|
wxPoint textpos = BoundaryBox.Centre();
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2010-09-05 17:01:48 +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-10-16 07:48:26 +00:00
|
|
|
orient,
|
2009-06-28 18:13:55 +00:00
|
|
|
field->m_Size,
|
|
|
|
hjustify, vjustify,
|
|
|
|
thickness, field->m_Italic, field->m_Bold );
|
2008-02-20 19:37:17 +00:00
|
|
|
}
|
2009-11-04 20:46:53 +00:00
|
|
|
else /* We plot 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;
|
2010-04-24 11:27:38 +00:00
|
|
|
Text = field->m_Text + LIB_COMPONENT::ReturnSubReference( DrawLibItem->m_Multi );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( textpos, color, Text,
|
2009-10-16 07:48:26 +00:00
|
|
|
orient,
|
2009-06-28 18:13:55 +00:00
|
|
|
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-10-05 17:52:41 +00:00
|
|
|
void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
|
|
|
|
int len, int orient, int Shape )
|
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-11-04 20:46:53 +00:00
|
|
|
plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
|
|
|
|
y1 ) );
|
2009-06-28 16:50:42 +00:00
|
|
|
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-11-04 20:46:53 +00:00
|
|
|
plotter->move_to( wxPoint( x1,
|
|
|
|
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
2009-06-28 16:50:42 +00:00
|
|
|
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 ) );
|
2009-11-04 20:46:53 +00:00
|
|
|
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 ) );
|
2009-11-04 20:46:53 +00:00
|
|
|
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-08-29 10:20:48 +00:00
|
|
|
static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
|
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
|
|
|
{
|
2010-09-05 17:01:48 +00:00
|
|
|
case DRAW_HIERARCHICAL_PIN_SHEET_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:
|
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-11-04 20:46:53 +00:00
|
|
|
plotter->text( pos, 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-11-04 20:46:53 +00:00
|
|
|
plotter->text( textpos, 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
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* Draw graphic symbol for global or hierarchical labels */
|
2010-09-11 16:33:43 +00:00
|
|
|
aSchText->CreateGraphicShape( Poly, aSchText->m_Pos );
|
|
|
|
if( Poly.size() )
|
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
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct )
|
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
|
|
|
wxSize size;
|
|
|
|
wxString Text;
|
2010-09-05 17:01:48 +00:00
|
|
|
int name_orientation;
|
|
|
|
wxPoint pos_sheetname, pos_filename;
|
2009-05-12 12:12:34 +00:00
|
|
|
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
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
if( Struct->IsVerticalOrientation() )
|
|
|
|
{
|
|
|
|
pos_sheetname = wxPoint( Struct->m_Pos.x - 8, Struct->m_Pos.y + Struct->m_Size.y );
|
|
|
|
pos_filename = wxPoint( Struct->m_Pos.x + Struct->m_Size.x + 4,
|
|
|
|
Struct->m_Pos.y + Struct->m_Size.y );
|
|
|
|
name_orientation = TEXT_ORIENT_VERT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pos_sheetname = wxPoint( Struct->m_Pos.x, Struct->m_Pos.y - 4 );
|
|
|
|
pos_filename = wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 );
|
|
|
|
name_orientation = TEXT_ORIENT_HORIZ;
|
|
|
|
}
|
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 );
|
2010-09-05 17:01:48 +00:00
|
|
|
|
|
|
|
//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;
|
2010-09-05 17:01:48 +00:00
|
|
|
plotter->text( pos_sheetname, txtcolor,
|
|
|
|
Text, name_orientation, size,
|
2009-06-28 18:13:55 +00:00
|
|
|
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
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
plotter->text( pos_filename, txtcolor,
|
|
|
|
Text, name_orientation, size,
|
2009-06-28 18:13:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
|
|
|
|
thickness, italic, false );
|
2008-02-20 19:37:17 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( Struct->m_Layer ) );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
/* Draw texts : SheetLabel */
|
2010-09-05 17:01:48 +00:00
|
|
|
BOOST_FOREACH( SCH_SHEET_PIN & pin_sheet, Struct->GetSheetPins() ) {
|
|
|
|
//pin_sheet.Plot( plotter );
|
|
|
|
PlotTextStruct( plotter, &pin_sheet );
|
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-08-29 10:20:48 +00:00
|
|
|
void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
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-12-02 21:44:03 +00:00
|
|
|
#define STRUCT ( (SCH_BUS_ENTRY*) 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-12-02 21:44:03 +00:00
|
|
|
#define STRUCT ( (SCH_LINE*) 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
|
2009-12-02 21:44:03 +00:00
|
|
|
#define STRUCT ( (SCH_JUNCTION*) aDrawlist )
|
2009-06-28 18:13:55 +00:00
|
|
|
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
|
2009-11-28 09:24:37 +00:00
|
|
|
plotter->circle( STRUCT->m_Pos, STRUCT->m_Size.x, 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-12-02 21:44:03 +00:00
|
|
|
case TYPE_SCH_MARKER:
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
2009-11-04 20:46:53 +00:00
|
|
|
PlotSheetStruct( plotter, (SCH_SHEET*) 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-12-02 21:44:03 +00:00
|
|
|
PlotNoConnectStruct( plotter, (SCH_NO_CONNECT*) 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
|
|
|
}
|
|
|
|
}
|