2008-03-22 05:55:06 +00:00
|
|
|
/******************************************/
|
|
|
|
/* Kicad: Common plot Postscript Routines */
|
|
|
|
/******************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "trigo.h"
|
|
|
|
#include "wxstruct.h"
|
|
|
|
#include "base_struct.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
|
|
|
#include "worksheet.h"
|
|
|
|
#include "macros.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_base_screen.h"
|
|
|
|
#include "drawtxt.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Plot sheet references
|
2009-08-29 10:20:48 +00:00
|
|
|
* margin is in mils (1/1000 inch)
|
2008-03-22 05:55:06 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-03-22 05:55:06 +00:00
|
|
|
#define WSTEXTSIZE 50 // Text size in mils
|
2009-08-29 10:20:48 +00:00
|
|
|
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
|
2010-12-18 16:09:06 +00:00
|
|
|
int xg, yg;
|
2009-08-29 10:20:48 +00:00
|
|
|
wxSize PageSize;
|
|
|
|
wxPoint pos, ref;
|
|
|
|
EDA_Colors color;
|
2009-11-23 15:16:50 +00:00
|
|
|
|
|
|
|
/* Scale to convert dimension in 1/1000 in into internal units
|
|
|
|
* (1/1000 inc for EESchema, 1/10000 for pcbnew. */
|
|
|
|
int conv_unit = screen->GetInternalUnits() / 1000;
|
|
|
|
wxString msg;
|
|
|
|
wxSize text_size;
|
2009-12-02 13:06:55 +00:00
|
|
|
#if defined(KICAD_GOST)
|
|
|
|
wxSize text_size2;
|
|
|
|
wxSize text_size3;
|
|
|
|
wxSize text_size1_5;
|
2010-12-18 16:09:06 +00:00
|
|
|
#else
|
2009-11-23 15:16:50 +00:00
|
|
|
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
|
|
|
|
bool bold = false;
|
2010-12-18 16:09:06 +00:00
|
|
|
#endif
|
|
|
|
bool italic = false;
|
2009-11-23 15:16:50 +00:00
|
|
|
bool thickness = 0; //@todo : use current pen
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
color = BLACK;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->set_color( color );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
PageSize.x = Sheet->m_Size.x;
|
|
|
|
PageSize.y = Sheet->m_Size.y;
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Plot edge. */
|
2008-03-22 05:55:06 +00:00
|
|
|
ref.x = Sheet->m_LeftMargin * conv_unit;
|
2009-11-23 15:16:50 +00:00
|
|
|
ref.y = Sheet->m_TopMargin * conv_unit;
|
|
|
|
xg = ( PageSize.x - Sheet->m_RightMargin ) * conv_unit;
|
|
|
|
yg = ( PageSize.y - Sheet->m_BottomMargin ) * conv_unit;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( ref );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = ref.y;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = yg;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ref.x;
|
|
|
|
pos.y = yg;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
|
|
|
plotter->finish_to( ref );
|
2008-11-05 11:41:15 +00:00
|
|
|
#else
|
2009-06-28 16:50:42 +00:00
|
|
|
for( unsigned ii = 0; ii < 2; ii++ )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->move_to( ref );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = ref.y;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = yg;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ref.x;
|
|
|
|
pos.y = yg;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->line_to( pos );
|
|
|
|
plotter->finish_to( ref );
|
2009-08-29 10:20:48 +00:00
|
|
|
ref.x += GRID_REF_W * conv_unit;
|
|
|
|
ref.y += GRID_REF_W * conv_unit;
|
|
|
|
xg -= GRID_REF_W * conv_unit;
|
|
|
|
yg -= GRID_REF_W * conv_unit;
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#endif
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
text_size.x = WSTEXTSIZE * conv_unit;
|
|
|
|
text_size.y = WSTEXTSIZE * conv_unit;
|
|
|
|
|
|
|
|
ref.x = Sheet->m_LeftMargin;
|
2009-11-23 15:16:50 +00:00
|
|
|
ref.y = Sheet->m_TopMargin; /* Upper left corner in
|
|
|
|
* 1/1000 inch */
|
|
|
|
xg = ( PageSize.x - Sheet->m_RightMargin );
|
|
|
|
yg = ( PageSize.y - Sheet->m_BottomMargin ); /* lower right corner
|
|
|
|
* in 1/1000 inch */
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2009-08-29 10:20:48 +00:00
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
|
|
|
|
WsItem != NULL;
|
|
|
|
WsItem = WsItem->Pnext )
|
2008-11-05 11:41:15 +00:00
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
|
|
|
|
pos.y = ( yg - WsItem->m_Posy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
msg.Empty();
|
|
|
|
switch( WsItem->m_Type )
|
|
|
|
{
|
|
|
|
case WS_CADRE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_PODPIS_LU:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
|
|
|
plotter->text( pos, color,
|
|
|
|
msg, TEXT_ORIENT_VERT, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
|
|
|
thickness, italic, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_SEGMENT_LU:
|
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
|
|
|
|
pos.y = ( yg - WsItem->m_Endy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
|
|
|
break;
|
|
|
|
}
|
2008-11-05 11:41:15 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
|
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT;
|
|
|
|
WsItem != NULL;
|
|
|
|
WsItem = WsItem->Pnext )
|
2008-11-05 11:41:15 +00:00
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x + WsItem->m_Posx ) * conv_unit;
|
|
|
|
pos.y = ( ref.y + WsItem->m_Posy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
msg.Empty();
|
|
|
|
switch( WsItem->m_Type )
|
|
|
|
{
|
|
|
|
case WS_SEGMENT_LT:
|
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x + WsItem->m_Endx ) * conv_unit;
|
|
|
|
pos.y = ( ref.y + WsItem->m_Endy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
|
|
|
break;
|
|
|
|
}
|
2008-11-05 11:41:15 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#else
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Plot legend along the X axis. */
|
2010-12-18 16:09:06 +00:00
|
|
|
int ipas = ( xg - ref.x ) / PAS_REF;
|
|
|
|
int gxpas = ( xg - ref.x ) / ipas;
|
2009-08-29 10:20:48 +00:00
|
|
|
for( int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
msg.Empty();
|
|
|
|
msg << jj;
|
|
|
|
|
2008-03-22 05:55:06 +00:00
|
|
|
if( ii < xg - PAS_REF / 2 )
|
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ii * conv_unit;
|
|
|
|
pos.y = ref.y * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ii * conv_unit;
|
|
|
|
pos.y = ( ref.y + GRID_REF_W ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
|
|
|
|
pos.x = ( ii - gxpas / 2 ) * conv_unit;
|
|
|
|
pos.y = ( ref.y + GRID_REF_W / 2 ) * conv_unit;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, color,
|
2009-08-29 10:20:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
if( ii < xg - PAS_REF / 2 )
|
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ii * conv_unit;
|
|
|
|
pos.y = yg * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ii * conv_unit;
|
|
|
|
pos.y = (yg - GRID_REF_W) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ii - gxpas / 2 ) * conv_unit;
|
|
|
|
pos.y = ( yg - GRID_REF_W / 2 ) * conv_unit;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, color,
|
2009-08-29 10:20:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Plot legend along the Y axis. */
|
|
|
|
ipas = ( yg - ref.y ) / PAS_REF;
|
2010-12-18 16:09:06 +00:00
|
|
|
int gypas = ( yg - ref.y ) / ipas;
|
2009-06-28 16:50:42 +00:00
|
|
|
for( int ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2009-06-02 07:26:49 +00:00
|
|
|
if( jj < 26 )
|
|
|
|
msg.Printf( wxT( "%c" ), jj + 'A' );
|
2009-11-23 15:16:50 +00:00
|
|
|
else // I hope 52 identifiers are enough...
|
2009-06-02 07:26:49 +00:00
|
|
|
msg.Printf( wxT( "%c" ), 'a' + jj - 26 );
|
2008-03-22 05:55:06 +00:00
|
|
|
if( ii < yg - PAS_REF / 2 )
|
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ref.x * conv_unit;
|
|
|
|
pos.y = ii * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x + GRID_REF_W ) * conv_unit;
|
|
|
|
pos.y = ii * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x + GRID_REF_W / 2 ) * conv_unit;
|
|
|
|
pos.y = ( ii - gypas / 2 ) * conv_unit;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, color,
|
2009-08-29 10:20:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
if( ii < yg - PAS_REF / 2 )
|
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg * conv_unit;
|
|
|
|
pos.y = ii * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( xg - GRID_REF_W ) * conv_unit;
|
|
|
|
pos.y = ii * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
|
|
|
|
pos.x = ( xg - GRID_REF_W / 2 ) * conv_unit;
|
|
|
|
pos.y = ( ii - gypas / 2 ) * conv_unit;
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#endif
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Plot the worksheet. */
|
2008-03-22 05:55:06 +00:00
|
|
|
text_size.x = SIZETEXT * conv_unit;
|
|
|
|
text_size.y = SIZETEXT * conv_unit;
|
2008-11-05 11:41:15 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2009-12-02 13:06:55 +00:00
|
|
|
text_size2.x = SIZETEXT * conv_unit * 2;
|
|
|
|
text_size2.y = SIZETEXT * conv_unit * 2;
|
|
|
|
text_size3.x = SIZETEXT * conv_unit * 3;
|
|
|
|
text_size3.y = SIZETEXT * conv_unit * 3;
|
|
|
|
text_size1_5.x = SIZETEXT * conv_unit * 1.5;
|
|
|
|
text_size1_5.y = SIZETEXT * conv_unit * 1.5;
|
2008-11-05 11:41:15 +00:00
|
|
|
ref.x = PageSize.x - Sheet->m_RightMargin;
|
|
|
|
ref.y = PageSize.y - Sheet->m_BottomMargin;
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
if( screen->m_ScreenNumber == 1 )
|
|
|
|
{
|
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Date;
|
|
|
|
WsItem != NULL;
|
|
|
|
WsItem = WsItem->Pnext )
|
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
msg.Empty();
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
switch( WsItem->m_Type )
|
|
|
|
{
|
|
|
|
case WS_DATE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_REV:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_KICAD_VERSION:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_PODPIS:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
2009-12-02 13:06:55 +00:00
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_SIZESHEET:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_IDENTSHEET:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
2010-05-14 19:31:46 +00:00
|
|
|
if( screen->m_NumberOfScreen > 1 )
|
|
|
|
msg << screen->m_ScreenNumber;
|
2009-12-02 13:06:55 +00:00
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_SHEETS:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
2010-05-16 06:32:38 +00:00
|
|
|
msg << screen->m_NumberOfScreen;
|
2009-12-02 13:06:55 +00:00
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMPANY_NAME:
|
2009-12-02 13:06:55 +00:00
|
|
|
msg = screen->m_Company;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size1_5,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_TITLE:
|
2009-12-02 13:06:55 +00:00
|
|
|
msg = screen->m_Title;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size1_5,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT1:
|
2009-12-02 13:06:55 +00:00
|
|
|
msg = screen->m_Commentaire1;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size3,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
|
|
|
|
pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
|
|
|
|
plotter->text( pos, color,
|
|
|
|
msg.GetData(), 1800, text_size2,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT2:
|
2009-12-02 13:06:55 +00:00
|
|
|
msg = screen->m_Commentaire2;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT3:
|
2009-12-02 13:06:55 +00:00
|
|
|
msg = screen->m_Commentaire3;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT4:
|
2009-12-02 13:06:55 +00:00
|
|
|
msg = screen->m_Commentaire4;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_UPPER_SEGMENT:
|
|
|
|
case WS_LEFT_SEGMENT:
|
|
|
|
case WS_SEGMENT:
|
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-11-05 11:41:15 +00:00
|
|
|
{
|
2009-08-29 10:20:48 +00:00
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_CADRE_D;
|
|
|
|
WsItem != NULL;
|
|
|
|
WsItem = WsItem->Pnext )
|
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
msg.Empty();
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
switch( WsItem->m_Type )
|
|
|
|
{
|
|
|
|
case WS_CADRE:
|
|
|
|
/* Begin list number > 1 */
|
2009-12-02 13:06:55 +00:00
|
|
|
msg = screen->m_Commentaire1;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size3,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
|
|
|
|
pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
|
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, 1800, text_size2,
|
2009-12-02 13:06:55 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
case WS_PODPIS_D:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
|
|
|
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_IDENTSHEET_D:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
|
|
|
msg << screen->m_ScreenNumber;
|
|
|
|
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_LEFT_SEGMENT_D:
|
|
|
|
case WS_SEGMENT_D:
|
|
|
|
plotter->move_to( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->finish_to( pos );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-11-05 11:41:15 +00:00
|
|
|
}
|
|
|
|
#else
|
2008-03-22 05:55:06 +00:00
|
|
|
ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
|
|
|
|
ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Date;
|
|
|
|
WsItem != NULL;
|
|
|
|
WsItem = WsItem->Pnext )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
|
2009-08-29 10:20:48 +00:00
|
|
|
bold = false;
|
2008-03-22 05:55:06 +00:00
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
|
|
|
else
|
|
|
|
msg.Empty();
|
|
|
|
|
|
|
|
switch( WsItem->m_Type )
|
|
|
|
{
|
|
|
|
case WS_DATE:
|
|
|
|
msg += screen->m_Date;
|
2009-08-29 10:20:48 +00:00
|
|
|
bold = true;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_REV:
|
|
|
|
msg += screen->m_Revision;
|
2009-08-29 10:20:48 +00:00
|
|
|
bold = true;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_KICAD_VERSION:
|
|
|
|
msg += g_ProductName;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_SIZESHEET:
|
|
|
|
msg += screen->m_CurrentSheetDesc->m_Name;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_IDENTSHEET:
|
2009-11-23 15:16:50 +00:00
|
|
|
msg << screen->m_ScreenNumber << wxT( "/" ) <<
|
|
|
|
screen->m_NumberOfScreen;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_FILENAME:
|
|
|
|
{
|
|
|
|
wxString fname, fext;
|
2011-01-20 16:34:57 +00:00
|
|
|
wxFileName::SplitPath( screen->GetFileName(),
|
2009-11-23 15:16:50 +00:00
|
|
|
(wxString*) NULL,
|
|
|
|
&fname,
|
|
|
|
&fext );
|
2008-03-22 05:55:06 +00:00
|
|
|
msg << fname << wxT( "." ) << fext;
|
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
case WS_FULLSHEETNAME:
|
2009-01-08 10:11:39 +00:00
|
|
|
msg += GetScreenDesc();
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMPANY_NAME:
|
|
|
|
msg += screen->m_Company;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
2009-08-29 10:20:48 +00:00
|
|
|
bold = true;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_TITLE:
|
|
|
|
msg += screen->m_Title;
|
2009-08-29 10:20:48 +00:00
|
|
|
bold = true;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT1:
|
|
|
|
msg += screen->m_Commentaire1;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT2:
|
|
|
|
msg += screen->m_Commentaire2;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT3:
|
|
|
|
msg += screen->m_Commentaire3;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT4:
|
|
|
|
msg += screen->m_Commentaire4;
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_UPPER_SEGMENT:
|
|
|
|
if( UpperLimit == 0 )
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_LEFT_SEGMENT:
|
2009-11-23 15:16:50 +00:00
|
|
|
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy
|
|
|
|
= WS_MostLeftLine.m_Posy = UpperLimit;
|
2008-03-22 05:55:06 +00:00
|
|
|
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
|
|
|
|
|
|
|
|
case WS_SEGMENT:
|
|
|
|
{
|
|
|
|
wxPoint auxpos;
|
2009-11-23 15:16:50 +00:00
|
|
|
auxpos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;;
|
|
|
|
auxpos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;;
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->move_to( pos );
|
|
|
|
plotter->finish_to( auxpos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->text( pos, color,
|
2009-12-03 09:33:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
thickness, italic, bold );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
#endif
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|