2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file common_plot_functions.cpp
|
2012-05-03 18:37:56 +00:00
|
|
|
* @brief Kicad: Common plotting Routines
|
2011-09-30 18:15:37 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +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>
|
|
|
|
#include <class_base_screen.h>
|
|
|
|
#include <drawtxt.h>
|
|
|
|
#include <class_title_block.h>
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
|
|
|
|
wxString GetDefaultPlotExtension( PlotFormat aFormat )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-08-29 16:59:50 +00:00
|
|
|
switch( aFormat )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_DXF:
|
|
|
|
return DXF_PLOTTER::GetDefaultFileExtension();
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
return PS_PLOTTER::GetDefaultFileExtension();
|
|
|
|
|
|
|
|
case PLOT_FORMAT_PDF:
|
|
|
|
return PDF_PLOTTER::GetDefaultFileExtension();
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
return HPGL_PLOTTER::GetDefaultFileExtension();
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
return GERBER_PLOTTER::GetDefaultFileExtension();
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2012-09-15 12:13:03 +00:00
|
|
|
case PLOT_FORMAT_SVG:
|
|
|
|
return SVG_PLOTTER::GetDefaultFileExtension();
|
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
default:
|
|
|
|
wxASSERT( false );
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
/* Plot sheet references
|
|
|
|
* margin is in mils (1/1000 inch)
|
|
|
|
*/
|
|
|
|
void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
|
|
|
|
const PAGE_INFO& aPageInfo,
|
|
|
|
int aSheetNumber, int aNumberOfSheets,
|
|
|
|
const wxString &aSheetDesc,
|
|
|
|
const wxString &aFilename )
|
|
|
|
{
|
|
|
|
static const int WSTEXTSIZE = 50; // Text size in mils
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
int iusPerMil = plotter->GetIUsPerDecimil() * 10;
|
|
|
|
wxSize pageSize = aPageInfo.GetSizeMils(); // in mils
|
|
|
|
int xg, yg;
|
|
|
|
wxPoint pos, ref;
|
2009-11-23 15:16:50 +00:00
|
|
|
wxString msg;
|
|
|
|
wxSize text_size;
|
2011-12-31 05:44:00 +00:00
|
|
|
|
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;
|
2010-12-18 16:09:06 +00:00
|
|
|
#endif
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2013-02-21 23:45:46 +00:00
|
|
|
EDA_COLOR_T plotClr;
|
|
|
|
plotClr = plotter->GetColorMode() ? RED : BLACK;
|
|
|
|
plotter->SetColor( plotClr );
|
2012-08-29 16:59:50 +00:00
|
|
|
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// Plot edge.
|
2012-08-29 16:59:50 +00:00
|
|
|
ref.x = aPageInfo.GetLeftMarginMils() * iusPerMil;
|
|
|
|
ref.y = aPageInfo.GetTopMarginMils() * iusPerMil;
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
xg = ( pageSize.x - aPageInfo.GetRightMarginMils() ) * iusPerMil;
|
|
|
|
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() ) * iusPerMil;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->MoveTo( ref );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = ref.y;
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->LineTo( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = yg;
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->LineTo( pos );
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ref.x;
|
|
|
|
pos.y = yg;
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->LineTo( pos );
|
|
|
|
plotter->FinishTo( ref );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#else
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
for( unsigned ii = 0; ii < 2; ii++ )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->MoveTo( ref );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = ref.y;
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->LineTo( pos );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = xg;
|
|
|
|
pos.y = yg;
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->LineTo( pos );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
pos.x = ref.x;
|
|
|
|
pos.y = yg;
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->LineTo( pos );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->FinishTo( ref );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
ref.x += GRID_REF_W * iusPerMil;
|
|
|
|
ref.y += GRID_REF_W * iusPerMil;
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
xg -= GRID_REF_W * iusPerMil;
|
|
|
|
yg -= GRID_REF_W * iusPerMil;
|
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
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
text_size.x = WSTEXTSIZE * iusPerMil;
|
|
|
|
text_size.y = WSTEXTSIZE * iusPerMil;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
// upper left corner in mils
|
2012-08-29 16:59:50 +00:00
|
|
|
ref.x = aPageInfo.GetLeftMarginMils();
|
|
|
|
ref.y = aPageInfo.GetTopMarginMils();
|
2011-12-22 21:57:50 +00:00
|
|
|
|
|
|
|
// lower right corner in mils
|
2012-08-29 16:59:50 +00:00
|
|
|
xg = ( pageSize.x - aPageInfo.GetRightMarginMils() );
|
|
|
|
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() );
|
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
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
|
|
|
|
pos.y = ( yg - WsItem->m_Posy ) * iusPerMil;
|
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;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
2009-08-29 10:20:48 +00:00
|
|
|
msg, TEXT_ORIENT_VERT, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_SEGMENT_LU:
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
|
|
|
|
pos.y = ( yg - WsItem->m_Endy ) * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2009-08-29 10:20:48 +00:00
|
|
|
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
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ref.x + WsItem->m_Posx ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y + WsItem->m_Posy ) * iusPerMil;
|
2009-08-29 10:20:48 +00:00
|
|
|
msg.Empty();
|
|
|
|
switch( WsItem->m_Type )
|
|
|
|
{
|
|
|
|
case WS_SEGMENT_LT:
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ( ref.x + WsItem->m_Endx ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y + WsItem->m_Endy ) * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2009-08-29 10:20:48 +00:00
|
|
|
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
|
|
|
|
|
2011-12-31 05:44:00 +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 )
|
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ii * iusPerMil;
|
|
|
|
pos.y = ref.y * iusPerMil;
|
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ii * iusPerMil;
|
|
|
|
pos.y = ( ref.y + GRID_REF_W ) * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ii - gxpas / 2 ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y + GRID_REF_W / 2 ) * iusPerMil;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
2009-08-29 10:20:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
if( ii < xg - PAS_REF / 2 )
|
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ii * iusPerMil;
|
|
|
|
pos.y = yg * iusPerMil;
|
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ii * iusPerMil;
|
|
|
|
pos.y = (yg - GRID_REF_W) * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ii - gxpas / 2 ) * iusPerMil;
|
|
|
|
pos.y = ( yg - GRID_REF_W / 2 ) * iusPerMil;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
2009-08-29 10:20:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// Plot legend along the Y axis.
|
2009-11-23 15:16:50 +00:00
|
|
|
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 )
|
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ref.x * iusPerMil;
|
|
|
|
pos.y = ii * iusPerMil;
|
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ( ref.x + GRID_REF_W ) * iusPerMil;
|
|
|
|
pos.y = ii * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ref.x + GRID_REF_W / 2 ) * iusPerMil;
|
|
|
|
pos.y = ( ii - gypas / 2 ) * iusPerMil;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
2009-08-29 10:20:48 +00:00
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
if( ii < yg - PAS_REF / 2 )
|
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = xg * iusPerMil;
|
|
|
|
pos.y = ii * iusPerMil;
|
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ( xg - GRID_REF_W ) * iusPerMil;
|
|
|
|
pos.y = ii * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( xg - GRID_REF_W / 2 ) * iusPerMil;
|
|
|
|
pos.y = ( ii - gypas / 2 ) * iusPerMil;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, 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
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// Plot the worksheet.
|
2012-05-03 18:37:56 +00:00
|
|
|
text_size.x = SIZETEXT * iusPerMil;
|
|
|
|
text_size.y = SIZETEXT * iusPerMil;
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2012-05-03 18:37:56 +00:00
|
|
|
text_size2.x = SIZETEXT * iusPerMil * 2;
|
|
|
|
text_size2.y = SIZETEXT * iusPerMil * 2;
|
|
|
|
text_size3.x = SIZETEXT * iusPerMil * 3;
|
|
|
|
text_size3.y = SIZETEXT * iusPerMil * 3;
|
|
|
|
text_size1_5.x = SIZETEXT * iusPerMil * 1.5;
|
|
|
|
text_size1_5.y = SIZETEXT * iusPerMil * 1.5;
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
ref.x = pageSize.x - aPageInfo.GetRightMarginMils();
|
|
|
|
ref.y = pageSize.y - aPageInfo.GetBottomMarginMils();
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
if( aSheetNumber == 1 )
|
2009-08-29 10:20:48 +00:00
|
|
|
{
|
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Date;
|
|
|
|
WsItem != NULL;
|
|
|
|
WsItem = WsItem->Pnext )
|
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
|
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;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_SIZESHEET:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_IDENTSHEET:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
2012-08-29 16:59:50 +00:00
|
|
|
if( aNumberOfSheets > 1 )
|
|
|
|
msg << aSheetNumber;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_SHEETS:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
2012-08-29 16:59:50 +00:00
|
|
|
msg << aNumberOfSheets;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMPANY_NAME:
|
2013-02-21 23:45:46 +00:00
|
|
|
msg = aTitleBlock.GetCompany();
|
2009-12-02 13:06:55 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-12-02 13:06:55 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_TITLE:
|
2013-02-21 23:45:46 +00:00
|
|
|
msg = aTitleBlock.GetTitle();
|
2009-12-02 13:06:55 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-12-02 13:06:55 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT1:
|
2013-02-21 23:45:46 +00:00
|
|
|
msg = aTitleBlock.GetComment1();
|
2009-12-02 13:06:55 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
|
|
|
pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil;
|
|
|
|
pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
2009-12-02 13:06:55 +00:00
|
|
|
msg.GetData(), 1800, text_size2,
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-12-02 13:06:55 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT2:
|
2013-02-21 23:45:46 +00:00
|
|
|
msg = aTitleBlock.GetComment2();
|
2009-12-02 13:06:55 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-12-02 13:06:55 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT3:
|
2013-02-21 23:45:46 +00:00
|
|
|
msg = aTitleBlock.GetComment3();
|
2009-12-02 13:06:55 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-12-02 13:06:55 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT4:
|
2013-02-21 23:45:46 +00:00
|
|
|
msg = aTitleBlock.GetComment4();
|
2009-12-02 13:06:55 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-12-02 13:06:55 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_UPPER_SEGMENT:
|
|
|
|
case WS_LEFT_SEGMENT:
|
|
|
|
case WS_SEGMENT:
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2009-08-29 10:20:48 +00:00
|
|
|
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 )
|
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
|
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:
|
2011-12-31 05:44:00 +00:00
|
|
|
// Begin list number > 1
|
2012-08-29 16:59:50 +00:00
|
|
|
msg = aTitleBlock.GetComment1();
|
2009-12-02 13:06:55 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
|
|
|
pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil;
|
|
|
|
pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-12-02 13:06:55 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
case WS_PODPIS_D:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_IDENTSHEET_D:
|
|
|
|
if( WsItem->m_Legende )
|
|
|
|
msg = WsItem->m_Legende;
|
2012-08-29 16:59:50 +00:00
|
|
|
msg << aSheetNumber;
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size,
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_LEFT_SEGMENT_D:
|
|
|
|
case WS_SEGMENT_D:
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->MoveTo( pos );
|
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
|
|
|
|
plotter->FinishTo( pos );
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-11-05 11:41:15 +00:00
|
|
|
}
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
#else
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
ref.x = pageSize.x - GRID_REF_W - aPageInfo.GetRightMarginMils();
|
|
|
|
ref.y = pageSize.y - GRID_REF_W - aPageInfo.GetBottomMarginMils();
|
2008-03-22 05:55:06 +00:00
|
|
|
|
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
|
|
|
{
|
2012-08-29 16:59:50 +00:00
|
|
|
bool bold = false;
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
|
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
|
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:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetDate();
|
2009-08-29 10:20:48 +00:00
|
|
|
bold = true;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_REV:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetRevision();
|
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:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aPageInfo.GetType();
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_IDENTSHEET:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg << aSheetNumber << wxT( "/" ) << aNumberOfSheets;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_FILENAME:
|
|
|
|
{
|
|
|
|
wxString fname, fext;
|
2012-08-29 16:59:50 +00:00
|
|
|
wxFileName::SplitPath( aFilename, 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:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aSheetDesc;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMPANY_NAME:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetCompany();
|
2008-03-22 05:55:06 +00:00
|
|
|
if( !msg.IsEmpty() )
|
2012-09-22 11:19:37 +00:00
|
|
|
UpperLimit = std::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:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetTitle();
|
2009-08-29 10:20:48 +00:00
|
|
|
bold = true;
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT1:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetComment1();
|
2008-03-22 05:55:06 +00:00
|
|
|
if( !msg.IsEmpty() )
|
2012-09-22 11:19:37 +00:00
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT2:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetComment2();
|
2008-03-22 05:55:06 +00:00
|
|
|
if( !msg.IsEmpty() )
|
2012-09-22 11:19:37 +00:00
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT3:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetComment3();
|
2008-03-22 05:55:06 +00:00
|
|
|
if( !msg.IsEmpty() )
|
2012-09-22 11:19:37 +00:00
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
2008-03-22 05:55:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WS_COMMENT4:
|
2012-08-29 16:59:50 +00:00
|
|
|
msg += aTitleBlock.GetComment4();
|
2008-03-22 05:55:06 +00:00
|
|
|
if( !msg.IsEmpty() )
|
2012-09-22 11:19:37 +00:00
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
|
2008-03-22 05:55:06 +00:00
|
|
|
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;
|
2012-05-03 18:37:56 +00:00
|
|
|
pos.y = (ref.y - WsItem->m_Posy) * iusPerMil;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
case WS_SEGMENT:
|
|
|
|
{
|
|
|
|
wxPoint auxpos;
|
2012-05-03 18:37:56 +00:00
|
|
|
auxpos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
|
|
|
|
auxpos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
|
|
|
|
plotter->MoveTo( pos );
|
|
|
|
plotter->FinishTo( 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() )
|
|
|
|
{
|
2013-02-21 23:45:46 +00:00
|
|
|
plotter->Text( pos, plotClr,
|
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,
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, bold, false );
|
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
|
|
|
}
|