Commit 568ae2ec authored by jean-pierre charras's avatar jean-pierre charras

Remove duplicate code to draw and to plot title blocks (more than 1500...

Remove duplicate code to draw and to plot title blocks  (more than 1500 duplicate lines). Note: this is a work in progress.
Code cleanup
parents c9be8bfd 26a3029a
......@@ -62,7 +62,8 @@ const wxString PAGE_INFO::Custom( wxT( "User" ) );
// local readability macro for millimeter wxSize
#define MMsize( x, y ) wxSize( Mm2mils( x ), Mm2mils( y ) )
// All MUST be defined as landscape. If IsGOST() is true, A4 is dynamically rotated later.
// All MUST be defined as landscape.
// If IsGOST() is true, A4 is dynamically rotated later.
const PAGE_INFO PAGE_INFO::pageA4( MMsize( 297, 210 ), wxT( "A4" ), wxPAPER_A4 );
const PAGE_INFO PAGE_INFO::pageA3( MMsize( 420, 297 ), wxT( "A3" ), wxPAPER_A3 );
const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), wxPAPER_A2 );
......@@ -139,7 +140,7 @@ void PAGE_INFO::setMargins()
m_left_margin =
m_right_margin =
m_top_margin =
m_bottom_margin = 400; // Units = mils
m_bottom_margin = Mm2mils( 10 );
}
}
......
......@@ -20,7 +20,6 @@
#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>
......@@ -463,7 +462,7 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
}
void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
int radius, int width, EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
......
/**
* @file common_plot_functions.cpp
* @brief Kicad: Common plotting Routines
* @brief Kicad: Common plotting functions
*/
#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>
#include "worksheet_shape_builder.h"
wxString GetDefaultPlotExtension( PlotFormat aFormat )
......@@ -45,823 +41,76 @@ wxString GetDefaultPlotExtension( PlotFormat aFormat )
}
}
/* 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 )
const wxString &aSheetDesc, const wxString &aFilename )
{
static const int WSTEXTSIZE = 50; // Text size in mils
int iusPerMil = plotter->GetIUsPerDecimil() * 10;
/* Note: Page sizes values are given in mils
*/
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
wxSize pageSize = aPageInfo.GetSizeMils(); // in mils
int xg, yg;
#if defined( KICAD_GOST )
int refx, refy;
#endif
wxPoint pos, end, ref;
wxString msg;
wxSize text_size;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
EDA_COLOR_T plotClr;
plotClr = plotter->GetColorMode() ? RED : BLACK;
plotter->SetColor( plotClr );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
// Plot edge.
ref.x = aPageInfo.GetLeftMarginMils() * iusPerMil;
ref.y = aPageInfo.GetTopMarginMils() * iusPerMil;
xg = ( pageSize.x - aPageInfo.GetRightMarginMils() ) * iusPerMil;
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() ) * iusPerMil;
#if defined(KICAD_GOST)
wxPoint LTmargin;
LTmargin.x = aPageInfo.GetLeftMarginMils() * iusPerMil;
LTmargin.y = aPageInfo.GetTopMarginMils() * iusPerMil;
int lnMsg, ln;
text_size.x = SIZETEXT * iusPerMil;
text_size.y = SIZETEXT * iusPerMil;
wxSize sz;
wxSize text_size0_8( SIZETEXT * iusPerMil * 0.8, SIZETEXT * iusPerMil * 1 );
wxSize text_size1_5( SIZETEXT * iusPerMil * 1.5, SIZETEXT * iusPerMil * 1.5 );
wxSize text_size2( SIZETEXT * iusPerMil * 2, SIZETEXT * iusPerMil * 2 );
wxSize text_size3( SIZETEXT * iusPerMil * 3, SIZETEXT * iusPerMil * 3 );
int lineOsn_widht = plotter->GetCurrentLineWidth() * 2;
int lineTonk_widht = plotter->GetCurrentLineWidth();
wxPoint RBmargin;
RBmargin.x = aPageInfo.GetRightMarginMils() * iusPerMil;
RBmargin.y = aPageInfo.GetBottomMarginMils() * iusPerMil;
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( ref );
pos.x = xg;
pos.y = ref.y;
plotter->LineTo( pos );
pos.x = xg;
pos.y = yg;
plotter->LineTo( pos );
pos.x = ref.x;
pos.y = yg;
plotter->LineTo( pos );
plotter->FinishTo( ref );
EDA_COLOR_T plotColor = plotter->GetColorMode() ? RED : BLACK;
plotter->SetColor( plotColor );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
#else
for( unsigned ii = 0; ii < 2; ii++ )
{
plotter->MoveTo( ref );
pos.x = xg;
pos.y = ref.y;
plotter->LineTo( pos );
pos.x = xg;
pos.y = yg;
plotter->LineTo( pos );
pos.x = ref.x;
pos.y = yg;
plotter->LineTo( pos );
plotter->FinishTo( ref );
ref.x += GRID_REF_W * iusPerMil;
ref.y += GRID_REF_W * iusPerMil;
xg -= GRID_REF_W * iusPerMil;
yg -= GRID_REF_W * iusPerMil;
}
#endif
// upper left corner in mils
ref.x = aPageInfo.GetLeftMarginMils();
ref.y = aPageInfo.GetTopMarginMils();
// lower right corner in mils
xg = ( pageSize.x - aPageInfo.GetRightMarginMils() );
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() );
#if defined(KICAD_GOST)
// Lower right corner
refx = xg;
refy = yg;
// First page
if( aSheetNumber == 1 )
{
for( Ki_WorkSheetData* WsItem = &WS_Osn1_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * iusPerMil;
pos.y = (refy - WsItem->m_Posy) * iusPerMil;
end.x = (refx - WsItem->m_Endx) * iusPerMil;
end.y = (refy - WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn1_Text1 )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size0_8,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
else
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
}
}
// Sheet number
if( aNumberOfSheets > 1 )
{
pos.x = (refx - Mm2mils( 36 )) * iusPerMil;
pos.y = (refy - Mm2mils( 17.5 )) * iusPerMil;
msg.Empty();
msg << aSheetNumber;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Count of sheets
pos.x = (refx - Mm2mils( 10 )) * iusPerMil;
pos.y = (refy - Mm2mils( 17.5 )) * iusPerMil;
msg.Empty();
msg << aNumberOfSheets;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
// Company name
msg = aTitleBlock.GetCompany();
if( !msg.IsEmpty() )
{
sz = text_size1_5;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 49 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 25 )) * iusPerMil;
pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Title
msg = aTitleBlock.GetTitle();
if( !msg.IsEmpty() )
{
sz = text_size1_5;
wxArrayString lines;
int titleWidth = 0;
int titleHeight = (sz.y + sz.y * 0.5) / iusPerMil;
int titleFieldWidth = Mm2mils( 69 );
int titleFieldHeight = Mm2mils( 24 );
int index = 0;
wxString fullMsg = msg;
do // Reduce the height of wrapped title until the fit
{
do // Wrap the title
{
titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
if( titleWidth > titleFieldWidth )
{
index = 0;
do
{
msg = msg.Left( msg.Length() - 1 );
if( msg.Length() == 0 )
{
lines.Clear();
msg = fullMsg;
sz.x -= iusPerMil;
break;
}
else
{
index++;
titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
wxString ch = wxString( msg.Last() );
if( titleWidth < titleFieldWidth && ch == wxT( " " ) )
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
index += msg.Length() - dot - 2;
msg = msg.Left( dot + 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
else
{
msg = msg.Left( msg.Length() - 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
}
}
}while( 1 );
}
else
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
lines.Add( msg.Left( dot + 1 ) );
lines.Add( fullMsg.Right( msg.Length() - dot - 2 ) );
}
else
lines.Add( msg );
break;
}
}while( 1 );
if( titleFieldHeight < titleHeight * lines.Count() )
{
sz.y -= iusPerMil;
sz.x -= iusPerMil;
msg = fullMsg;
lines.Clear();
}
else
break;
}while( 1 );
pos.x = (refx - Mm2mils( 85 )) * iusPerMil;
pos.y = (refy - Mm2mils( 27.5 ) - (titleHeight * (lines.Count() - 1) / 2)) * iusPerMil;
for( int curLn = 0; curLn < lines.Count(); curLn++ )
{
msg = lines[curLn];
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
pos.y += titleHeight * iusPerMil;
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 119 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 60 )) * iusPerMil;
pos.y = (refy - Mm2mils( 47.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Developer
msg = aTitleBlock.GetComment2();
if( !msg.IsEmpty() )
{
sz = text_size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 27.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Verifier
msg = aTitleBlock.GetComment3();
if( !msg.IsEmpty() )
{
sz = text_size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 22.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Approver
msg = aTitleBlock.GetComment4();
if( !msg.IsEmpty() )
{
sz = text_size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 2.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
else // other pages
WS_DRAW_ITEM_LIST drawList;
drawList.BuildWorkSheetGraphicList( pageSize, LTmargin, RBmargin,
aPageInfo.GetType(), aFilename,
aSheetDesc,
aTitleBlock, aNumberOfSheets, aSheetNumber,
PLOTTER::DEFAULT_LINE_WIDTH, iusPerMil,
plotColor, plotColor );
// Draw item list
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item;
item = drawList.GetNext() )
{
for( Ki_WorkSheetData* WsItem = &WS_Osn2a_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
switch( item->GetType() )
{
pos.x = (refx - WsItem->m_Posx) * iusPerMil;
pos.y = (refy - WsItem->m_Posy) * iusPerMil;
end.x = (refx - WsItem->m_Endx) * iusPerMil;
end.y = (refy - WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
case WS_DRAW_ITEM_BASE::wsg_line:
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn2a_Text1 )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size0_8,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
else
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
plotter->MoveTo( line->GetStart() );
plotter->FinishTo( line->GetEnd() );
}
}
// Sheet number
pos.x = (refx - Mm2mils( 5 )) * iusPerMil;
pos.y = (refy - Mm2mils( 4 )) * iusPerMil;
msg.Empty();
msg << aSheetNumber;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 109 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 65 )) * iusPerMil;
pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
// Format
pos.x = (refx - Mm2mils( 23 )) * iusPerMil;
pos.y = (refy + Mm2mils( 2.5 )) * iusPerMil;
msg.Empty();
msg << aPageInfo.GetType();
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
// Lower left corner
refx = ref.x;
refy = yg;
for( Ki_WorkSheetData* WsItem = &WS_DopLeft_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posx) * iusPerMil;
pos.y = (refy - WsItem->m_Posy) * iusPerMil;
end.x = (refx - WsItem->m_Endx) * iusPerMil;
end.y = (refy - WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
case WS_DRAW_ITEM_BASE::wsg_rect:
{
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
plotter->Rect( rect->GetStart(), rect->GetEnd(), NO_FILL ); }
break;
case WS_TEXT:
if( !msg.IsEmpty() )
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
break;
}
}
if( aPageInfo.GetType() == PAGE_INFO::A4 || !aPageInfo.IsPortrait() ) // A4 or Landscape
{
// Left Top corner
refx = ref.x;
refy = ref.y;
for( Ki_WorkSheetData* WsItem = &WS_DopTop_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 )// Some fields for first page only
break;
pos.x = (refx + WsItem->m_Posx) * iusPerMil;
pos.y = (refy + WsItem->m_Posy) * iusPerMil;
end.x = (refx + WsItem->m_Endx) * iusPerMil;
end.y = (refy + WsItem->m_Endy) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
case WS_DRAW_ITEM_BASE::wsg_text:
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
plotter->Text( text->GetTextPosition(), text->GetColor(),
text->GetText(), text->GetOrientation(),
text->GetSize(),
text->GetHorizJustify(), text->GetVertJustify(),
text->GetPenWidth(),
text->IsItalic(), text->IsBold() );
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx + Mm2mils( 35 )) * iusPerMil;
pos.y = (refy + Mm2mils( 7 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, 1800, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
else // Portrait
{
// Right Top corner
// Lines are used from the upper left corner by the change of coordinates
refx = xg;
refy = ref.y;
for( Ki_WorkSheetData* WsItem = &WS_DopTop_Line1;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 )// Some fields for first page only
break;
break;
pos.x = (refx - WsItem->m_Posy) * iusPerMil;
pos.y = (refy + WsItem->m_Posx) * iusPerMil;
end.x = (refx - WsItem->m_Endy) * iusPerMil;
end.y = (refy + WsItem->m_Endx) * iusPerMil;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
case WS_DRAW_ITEM_BASE::wsg_poly:
{
case WS_OSN:
plotter->SetCurrentLineWidth( lineOsn_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
case WS_TONK:
plotter->SetCurrentLineWidth( lineTonk_widht );
plotter->MoveTo( pos );
plotter->FinishTo( end );
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
break;
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
plotter->PlotPoly( poly->m_Corners, NO_FILL );
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = text_size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= double( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 7 )) * iusPerMil;
pos.y = (refy + Mm2mils( 35 )) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_VERT, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
}
#else
text_size.x = WSTEXTSIZE * iusPerMil;
text_size.y = WSTEXTSIZE * iusPerMil;
// Plot legend along the X axis.
int ipas = ( xg - ref.x ) / PAS_REF;
int gxpas = ( xg - ref.x ) / ipas;
for( int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
msg.Empty();
msg << jj;
if( ii < xg - PAS_REF / 2 )
{
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 );
}
pos.x = ( ii - gxpas / 2 ) * iusPerMil;
pos.y = ( ref.y + GRID_REF_W / 2 ) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
if( ii < xg - PAS_REF / 2 )
{
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 );
}
pos.x = ( ii - gxpas / 2 ) * iusPerMil;
pos.y = ( yg - GRID_REF_W / 2 ) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Plot legend along the Y axis.
ipas = ( yg - ref.y ) / PAS_REF;
int gypas = ( yg - ref.y ) / ipas;
for( int ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
if( jj < 26 )
msg.Printf( wxT( "%c" ), jj + 'A' );
else // I hope 52 identifiers are enough...
msg.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
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 );
}
pos.x = ( ref.x + GRID_REF_W / 2 ) * iusPerMil;
pos.y = ( ii - gypas / 2 ) * iusPerMil;
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
if( ii < yg - PAS_REF / 2 )
{
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 );
}
pos.x = ( xg - GRID_REF_W / 2 ) * iusPerMil;
pos.y = ( ii - gypas / 2 ) * iusPerMil;
plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, false, false );
}
// Plot the worksheet.
text_size.x = SIZETEXT * iusPerMil;
text_size.y = SIZETEXT * iusPerMil;
ref.x = pageSize.x - GRID_REF_W - aPageInfo.GetRightMarginMils();
ref.y = pageSize.y - GRID_REF_W - aPageInfo.GetBottomMarginMils();
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
bool bold = false;
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
else
msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
msg += aTitleBlock.GetDate();
bold = true;
break;
case WS_REV:
msg += aTitleBlock.GetRevision();
bold = true;
break;
case WS_KICAD_VERSION:
msg += g_ProductName;
break;
case WS_SIZESHEET:
msg += aPageInfo.GetType();
break;
case WS_IDENTSHEET:
msg << aSheetNumber << wxT( "/" ) << aNumberOfSheets;
break;
case WS_FILENAME:
{
wxString fname, fext;
wxFileName::SplitPath( aFilename, NULL, &fname, &fext );
msg << fname << wxT( "." ) << fext;
}
break;
case WS_FULLSHEETNAME:
msg += aSheetDesc;
break;
case WS_COMPANY_NAME:
msg += aTitleBlock.GetCompany();
if( !msg.IsEmpty() )
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
bold = true;
break;
case WS_TITLE:
msg += aTitleBlock.GetTitle();
bold = true;
break;
case WS_COMMENT1:
msg += aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
case WS_COMMENT2:
msg += aTitleBlock.GetComment2();
if( !msg.IsEmpty() )
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
case WS_COMMENT3:
msg += aTitleBlock.GetComment3();
if( !msg.IsEmpty() )
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
case WS_COMMENT4:
msg += aTitleBlock.GetComment4();
if( !msg.IsEmpty() )
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
case WS_UPPER_SEGMENT:
if( UpperLimit == 0 )
break;
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy
= WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (ref.y - WsItem->m_Posy) * iusPerMil;
case WS_SEGMENT:
{
wxPoint auxpos;
auxpos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
auxpos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
plotter->MoveTo( pos );
plotter->FinishTo( auxpos );
}
break;
}
if( !msg.IsEmpty() )
{
plotter->Text( pos, plotClr,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
PLOTTER::DEFAULT_LINE_WIDTH, bold, false );
}
}
#endif
}
......@@ -38,6 +38,7 @@
#include <class_board_item.h>
#elif defined( EESCHEMA )
#include <sch_item_struct.h>
#elif defined( GERBVIEW )
#else
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
#endif
......@@ -325,10 +326,12 @@ bool EDA_TEXT::IsDefaultFormatting() const
&& ( m_MultilineAllowed == false ) );
}
void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
throw( IO_ERROR )
{
#ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
// and does not define FMT_IU, used here
// however this function should exist
if( !IsDefaultFormatting() )
{
aFormatter->Print( aNestLevel+1, "(effects" );
......@@ -381,4 +384,5 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
aFormatter->Print( 0, ")\n" );
}
#endif
}
......@@ -45,7 +45,6 @@
#include <wxstruct.h>
#include <macros.h>
#include <param_config.h>
#include <worksheet.h>
#include <id.h>
#include <build_version.h>
#include <hotkeys_basic.h>
......
/**
* @file title_block_shape.h
* @brief description of graphic items and texts to build a title block
*/
/*
* This file should be included only in worksheet.cpp
* This is not an usual .h file, it is more a .cpp file
* it creates a lot of structures which define the shape of a title block
* and frame references
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define GRID_REF_W 70 // height of the band reference grid
#define SIZETEXT 60 // worksheet text size
#define SIZETEXT_REF 50 // worksheet frame reference text size
#define PAS_REF 2000 // reference markings on worksheet frame
#define VARIABLE_BLOCK_START_POSITION (SIZETEXT * 10)
// The coordinates below are relative to the bottom right corner of page and
// will be subtracted from this origin.
#define BLOCK_OX 4200
#define BLOCK_KICAD_VERSION_X BLOCK_OX - SIZETEXT
#define BLOCK_KICAD_VERSION_Y SIZETEXT
#define BLOCK_REV_X 820
#define BLOCK_REV_Y (SIZETEXT * 3)
#define BLOCK_DATE_X BLOCK_OX - (SIZETEXT * 15)
#define BLOCK_DATE_Y (SIZETEXT * 3)
#define BLOCK_ID_SHEET_X 820
#define BLOCK_ID_SHEET_Y SIZETEXT
#define BLOCK_SIZE_SHEET_X BLOCK_OX - SIZETEXT
#define BLOCK_SIZE_SHEET_Y (SIZETEXT * 3)
#define BLOCK_TITLE_X BLOCK_OX - SIZETEXT
#define BLOCK_TITLE_Y (SIZETEXT * 5)
#define BLOCK_FULLSHEETNAME_X BLOCK_OX - SIZETEXT
#define BLOCK_FULLSHEETNAME_Y (SIZETEXT * 7)
#define BLOCK_FILENAME_X BLOCK_OX - SIZETEXT
#define BLOCK_FILENAME_Y (SIZETEXT * 9)
#define BLOCK_COMMENT_X BLOCK_OX - SIZETEXT
#define BLOCK_COMPANY_Y (SIZETEXT * 11)
#define BLOCK_COMMENT1_Y (SIZETEXT * 13)
#define BLOCK_COMMENT2_Y (SIZETEXT * 15)
#define BLOCK_COMMENT3_Y (SIZETEXT * 17)
#define BLOCK_COMMENT4_Y (SIZETEXT * 19)
// Work sheet structure type definitions.
enum TypeKi_WorkSheetData {
WS_DATE,
WS_REV,
WS_KICAD_VERSION,
WS_SIZESHEET,
WS_IDENTSHEET,
WS_TITLE,
WS_FILENAME,
WS_FULLSHEETNAME,
WS_COMPANY_NAME,
WS_COMMENT1,
WS_COMMENT2,
WS_COMMENT3,
WS_COMMENT4,
WS_SEGMENT,
WS_UPPER_SEGMENT,
WS_LEFT_SEGMENT,
WS_CADRE
};
extern Ki_WorkSheetData WS_Date;
extern Ki_WorkSheetData WS_Revision;
extern Ki_WorkSheetData WS_Licence;
extern Ki_WorkSheetData WS_SizeSheet;
extern Ki_WorkSheetData WS_IdentSheet;
extern Ki_WorkSheetData WS_FullSheetName;
extern Ki_WorkSheetData WS_SheetFilename;
extern Ki_WorkSheetData WS_Title;
extern Ki_WorkSheetData WS_Company;
extern Ki_WorkSheetData WS_Comment1;
extern Ki_WorkSheetData WS_Comment2;
extern Ki_WorkSheetData WS_Comment3;
extern Ki_WorkSheetData WS_Comment4;
extern Ki_WorkSheetData WS_SeparatorLine;
extern Ki_WorkSheetData WS_MostLeftLine;
extern Ki_WorkSheetData WS_MostUpperLine;
extern Ki_WorkSheetData WS_Segm3;
extern Ki_WorkSheetData WS_Segm4;
extern Ki_WorkSheetData WS_Segm5;
extern Ki_WorkSheetData WS_Segm6;
extern Ki_WorkSheetData WS_Segm7;
Ki_WorkSheetData WS_Date =
{
WS_DATE,
&WS_Licence,
BLOCK_DATE_X, BLOCK_DATE_Y,
0, 0,
wxT( "Date: " ),NULL
};
Ki_WorkSheetData WS_Licence =
{
WS_KICAD_VERSION,
&WS_Revision,
BLOCK_KICAD_VERSION_X,BLOCK_KICAD_VERSION_Y,
0,
0,
NULL, NULL
};
Ki_WorkSheetData WS_Revision =
{
WS_REV,
&WS_SizeSheet,
BLOCK_REV_X, BLOCK_REV_Y,
0, 0,
wxT( "Rev: " ),NULL
};
Ki_WorkSheetData WS_SizeSheet =
{
WS_SIZESHEET,
&WS_IdentSheet,
BLOCK_SIZE_SHEET_X,BLOCK_SIZE_SHEET_Y,
0, 0,
wxT( "Size: " ), NULL
};
Ki_WorkSheetData WS_IdentSheet =
{
WS_IDENTSHEET,
&WS_Title,
BLOCK_ID_SHEET_X,BLOCK_ID_SHEET_Y,
0, 0,
wxT( "Id: " ), NULL
};
Ki_WorkSheetData WS_Title =
{
WS_TITLE,
&WS_SheetFilename,
BLOCK_TITLE_X, BLOCK_TITLE_Y,
0, 0,
wxT( "Title: " ), NULL
};
Ki_WorkSheetData WS_SheetFilename =
{
WS_FILENAME,
&WS_FullSheetName,
BLOCK_FILENAME_X, BLOCK_FILENAME_Y,
0, 0,
wxT( "File: " ), NULL
};
Ki_WorkSheetData WS_FullSheetName =
{
WS_FULLSHEETNAME,
&WS_Company,
BLOCK_FULLSHEETNAME_X,BLOCK_FULLSHEETNAME_Y,
0,
0,
wxT( "Sheet: " ), NULL
};
Ki_WorkSheetData WS_Company =
{
WS_COMPANY_NAME,
&WS_Comment1,
BLOCK_COMMENT_X,BLOCK_COMPANY_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment1 =
{
WS_COMMENT1,
&WS_Comment2,
BLOCK_COMMENT_X,BLOCK_COMMENT1_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment2 =
{
WS_COMMENT2,
&WS_Comment3,
BLOCK_COMMENT_X,BLOCK_COMMENT2_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment3 =
{
WS_COMMENT3,
&WS_Comment4,
BLOCK_COMMENT_X,BLOCK_COMMENT3_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment4 =
{
WS_COMMENT4,
&WS_MostLeftLine,
BLOCK_COMMENT_X, BLOCK_COMMENT4_Y,
0, 0,
NULL, NULL
};
// Left vertical segment
Ki_WorkSheetData WS_MostLeftLine =
{
WS_LEFT_SEGMENT,
&WS_SeparatorLine,
BLOCK_OX, SIZETEXT * 16,
BLOCK_OX, 0,
NULL, NULL
};
// horizontal segment between filename and comments
Ki_WorkSheetData WS_SeparatorLine =
{
WS_SEGMENT,
&WS_MostUpperLine,
BLOCK_OX, VARIABLE_BLOCK_START_POSITION,
0, VARIABLE_BLOCK_START_POSITION,
NULL, NULL
};
// superior horizontal segment
Ki_WorkSheetData WS_MostUpperLine =
{
WS_UPPER_SEGMENT,
&WS_Segm3,
BLOCK_OX, SIZETEXT * 16,
0, SIZETEXT * 16,
NULL, NULL
};
// horizontal segment above COMPANY NAME
Ki_WorkSheetData WS_Segm3 =
{
WS_SEGMENT,
&WS_Segm4,
BLOCK_OX, SIZETEXT * 6,
0, SIZETEXT * 6,
NULL, NULL
};
// vertical segment of the left REV and SHEET
Ki_WorkSheetData WS_Segm4 =
{
WS_SEGMENT,
&WS_Segm5,
BLOCK_REV_X + SIZETEXT,SIZETEXT * 4,
BLOCK_REV_X + SIZETEXT, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Segm5 =
{
WS_SEGMENT,
&WS_Segm6,
BLOCK_OX, SIZETEXT * 2,
0, SIZETEXT * 2,
NULL, NULL
};
Ki_WorkSheetData WS_Segm6 =
{
WS_SEGMENT,
&WS_Segm7,
BLOCK_OX, SIZETEXT * 4,
0, SIZETEXT * 4,
NULL, NULL
};
Ki_WorkSheetData WS_Segm7 =
{
WS_SEGMENT,
NULL,
BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 4,
BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 2,
NULL, NULL
};
#include <worksheet_shape_builder.h>
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( wxSize& aPageSize,
wxPoint& aLTmargin, wxPoint& aRBmargin,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
{
wxPoint pos;
wxPoint end;
int refx, refy;
wxString Line;
Ki_WorkSheetData* WsItem;
wxSize size( SIZETEXT * aScalar, SIZETEXT * aScalar );
wxSize size_ref( SIZETEXT_REF * aScalar, SIZETEXT_REF * aScalar );
wxString msg;
// Upper left corner
refx = aLTmargin.x;
refy = aLTmargin.y;
// lower right corner
int xg, yg;
xg = aPageSize.x - aRBmargin.x;
yg = aPageSize.y - aRBmargin.y;
// Draw the border.
int ii, jj, ipas, gxpas, gypas;
for( ii = 0; ii < 2; ii++ )
{
Append( new WS_DRAW_ITEM_RECT(
wxPoint( refx * aScalar, refy * aScalar ),
wxPoint( xg * aScalar, yg * aScalar ),
aPenWidth, aLineColor ) );
refx += GRID_REF_W; refy += GRID_REF_W;
xg -= GRID_REF_W; yg -= GRID_REF_W;
}
// Upper left corner
refx = aLTmargin.x;
refy = aLTmargin.y;
// lower right corner
xg = aPageSize.x - aRBmargin.x;
yg = aPageSize.y - aRBmargin.y;
ipas = ( xg - refx ) / PAS_REF;
gxpas = ( xg - refx ) / ipas;
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
Line.Printf( wxT( "%d" ), jj );
if( ii < xg - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( ii * aScalar, refy * aScalar ),
wxPoint( ii * aScalar, ( refy + GRID_REF_W ) * aScalar ),
aPenWidth, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( Line,
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( refy + GRID_REF_W / 2 ) * aScalar ),
size_ref, aPenWidth, aLineColor ) );
if( ii < xg - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( ii * aScalar, yg * aScalar ),
wxPoint( ii * aScalar, (yg - GRID_REF_W ) * aScalar ),
aPenWidth, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( Line,
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( yg - GRID_REF_W / 2) * aScalar ),
size_ref, aPenWidth, aLineColor ) );
}
ipas = ( yg - refy ) / PAS_REF;
gypas = ( yg - refy ) / ipas;
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
if( jj < 26 )
Line.Printf( wxT( "%c" ), jj + 'A' );
else // I hope 52 identifiers are enough...
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( refx * aScalar, ii * aScalar ),
wxPoint( ( refx + GRID_REF_W ) * aScalar, ii * aScalar ),
aPenWidth, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( Line,
wxPoint( ( refx + GRID_REF_W / 2 ) * aScalar,
( ii - gypas / 2 ) * aScalar ),
size_ref, aPenWidth, aLineColor ) );
if( ii < yg - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( xg * aScalar, ii * aScalar ),
wxPoint( ( xg - GRID_REF_W ) * aScalar, ii * aScalar ),
aPenWidth, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( Line,
wxPoint( ( xg - GRID_REF_W / 2 ) * aScalar,
( ii - gxpas / 2 ) * aScalar ),
size_ref, aPenWidth, aLineColor ) );
}
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
refx = aPageSize.x - aRBmargin.x - GRID_REF_W;
refy = aPageSize.y - aRBmargin.y - GRID_REF_W;
WS_DRAW_ITEM_TEXT* gtext;
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTitleBlock.GetDate();
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor, false,
true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_REV:
if( WsItem->m_Legende )
{
msg = WsItem->m_Legende;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
GetPenSizeForBold( std::min( size.
x,
size.
y ) ),
aLineColor, false, true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
pos.x += ReturnGraphicTextWidth( msg, size.x, false, false );
}
msg = aTitleBlock.GetRevision();
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
GetPenSizeForBold( std::min( size.x,
size.y ) ),
aTextColor, false, true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_KICAD_VERSION:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_SIZESHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aPaperFormat;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_IDENTSHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << aSheetNumber << wxT( "/" ) << aSheetCount;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_FILENAME:
{
wxFileName fn( aFileName );
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << fn.GetFullName();
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
}
break;
case WS_FULLSHEETNAME:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aSheetPathHumanReadable;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_COMPANY_NAME:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTitleBlock.GetCompany();
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
GetPenSizeForBold( std::min( size.
x,
size.
y ) ),
aTextColor, false, true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_TITLE:
if( WsItem->m_Legende )
{
msg = WsItem->m_Legende;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
GetPenSizeForBold( std::min( size.
x,
size.
y ) ),
aLineColor, false, true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
pos.x += ReturnGraphicTextWidth( msg, size.x, false, false );
}
msg = aTitleBlock.GetTitle();
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
GetPenSizeForBold( std::min( size.x,
size.y ) ),
aTextColor, false, true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_COMMENT1:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_COMMENT2:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTitleBlock.GetComment2();
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_COMMENT3:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTitleBlock.GetComment3();
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_COMMENT4:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTitleBlock.GetComment4();
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size,
aPenWidth, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_UPPER_SEGMENT:
if( UpperLimit == 0 )
break;
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (refy - WsItem->m_Posy) * aScalar;
case WS_SEGMENT:
xg = aPageSize.x - GRID_REF_W - aRBmargin.x - WsItem->m_Endx;
yg = aPageSize.y - GRID_REF_W - aRBmargin.y - WsItem->m_Endy;
Append( new WS_DRAW_ITEM_LINE( pos,
wxPoint( xg * aScalar, yg * aScalar ),
aPenWidth, aLineColor ) );
break;
}
}
}
/**
* @file title_block_shape_gost.h
* @brief description of graphic items and texts to build a title block
* using GOST standard
*/
/*
* This file should be included only in worksheet.cpp
* This is not an usual .h file, it is more a .cpp file
* it creates a lot of structures to define the shape of a title block
* and frame references
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define SIZETEXT 100 // worksheet text size
#define SIZETEXT_REF 50 // worksheet frame reference text size
#define PAS_REF 2000 // reference markings on worksheet frame
// used in worksheet.cpp
// Work sheet structure type definitions.
enum TypeKi_WorkSheetData {
WS_OSN,
WS_TONK,
WS_TEXT,
WS_TEXTL
};
extern Ki_WorkSheetData WS_Osn1_Line1;
extern Ki_WorkSheetData WS_Osn1_Line2;
extern Ki_WorkSheetData WS_Osn1_Line3;
extern Ki_WorkSheetData WS_Osn1_Line4;
extern Ki_WorkSheetData WS_Osn1_Line5;
extern Ki_WorkSheetData WS_Osn1_Line6;
extern Ki_WorkSheetData WS_Osn1_Line7;
extern Ki_WorkSheetData WS_Osn1_Line8;
extern Ki_WorkSheetData WS_Osn1_Line9;
extern Ki_WorkSheetData WS_Osn1_Line10;
extern Ki_WorkSheetData WS_Osn1_Line11;
extern Ki_WorkSheetData WS_Osn1_Line12;
extern Ki_WorkSheetData WS_Osn1_Line13;
extern Ki_WorkSheetData WS_Osn1_Line14;
extern Ki_WorkSheetData WS_Osn1_Line15;
extern Ki_WorkSheetData WS_Osn1_Line16;
extern Ki_WorkSheetData WS_Osn1_Line17;
extern Ki_WorkSheetData WS_Osn1_Line18;
extern Ki_WorkSheetData WS_Osn1_Line19;
extern Ki_WorkSheetData WS_Osn1_Line20;
extern Ki_WorkSheetData WS_Osn1_Line21;
extern Ki_WorkSheetData WS_Osn1_Line22;
extern Ki_WorkSheetData WS_Osn1_Line23;
extern Ki_WorkSheetData WS_Osn1_Line24;
extern Ki_WorkSheetData WS_Osn1_Line25;
extern Ki_WorkSheetData WS_Osn1_Line26;
extern Ki_WorkSheetData WS_Osn1_Line27;
extern Ki_WorkSheetData WS_Osn1_Text1;
extern Ki_WorkSheetData WS_Osn1_Text2;
extern Ki_WorkSheetData WS_Osn1_Text3;
extern Ki_WorkSheetData WS_Osn1_Text4;
extern Ki_WorkSheetData WS_Osn1_Text5;
extern Ki_WorkSheetData WS_Osn1_Text6;
extern Ki_WorkSheetData WS_Osn1_Text7;
extern Ki_WorkSheetData WS_Osn1_Text8;
extern Ki_WorkSheetData WS_Osn1_Text9;
extern Ki_WorkSheetData WS_Osn1_Text10;
extern Ki_WorkSheetData WS_Osn1_Text11;
extern Ki_WorkSheetData WS_Osn1_Text12;
extern Ki_WorkSheetData WS_Osn1_Text13;
extern Ki_WorkSheetData WS_Osn1_Text14;
extern Ki_WorkSheetData WS_Osn1_Text15;
extern Ki_WorkSheetData WS_Osn1_Text16;
extern Ki_WorkSheetData WS_Osn1_Text17;
extern Ki_WorkSheetData WS_Osn2a_Line1;
extern Ki_WorkSheetData WS_Osn2a_Line2;
extern Ki_WorkSheetData WS_Osn2a_Line3;
extern Ki_WorkSheetData WS_Osn2a_Line4;
extern Ki_WorkSheetData WS_Osn2a_Line5;
extern Ki_WorkSheetData WS_Osn2a_Line6;
extern Ki_WorkSheetData WS_Osn2a_Line7;
extern Ki_WorkSheetData WS_Osn2a_Line8;
extern Ki_WorkSheetData WS_Osn2a_Line9;
extern Ki_WorkSheetData WS_Osn2a_Line10;
extern Ki_WorkSheetData WS_Osn2a_Line11;
extern Ki_WorkSheetData WS_Osn2a_Text1;
extern Ki_WorkSheetData WS_Osn2a_Text2;
extern Ki_WorkSheetData WS_Osn2a_Text3;
extern Ki_WorkSheetData WS_Osn2a_Text4;
extern Ki_WorkSheetData WS_Osn2a_Text5;
extern Ki_WorkSheetData WS_Osn2a_Text6;
extern Ki_WorkSheetData WS_Osn2a_Text7;
extern Ki_WorkSheetData WS_Osn2a_Text8;
extern Ki_WorkSheetData WS_DopLeft_Line1;
extern Ki_WorkSheetData WS_DopLeft_Line2;
extern Ki_WorkSheetData WS_DopLeft_Line3;
extern Ki_WorkSheetData WS_DopLeft_Line4;
extern Ki_WorkSheetData WS_DopLeft_Line5;
extern Ki_WorkSheetData WS_DopLeft_Line6;
extern Ki_WorkSheetData WS_DopLeft_Line7;
extern Ki_WorkSheetData WS_DopLeft_Line8;
extern Ki_WorkSheetData WS_DopLeft_Line9;
extern Ki_WorkSheetData WS_DopLeft_Line10;
extern Ki_WorkSheetData WS_DopLeft_Line11;
extern Ki_WorkSheetData WS_DopLeft_Line12;
extern Ki_WorkSheetData WS_DopLeft_Line13;
extern Ki_WorkSheetData WS_DopLeft_Line14;
extern Ki_WorkSheetData WS_DopLeft_Text1;
extern Ki_WorkSheetData WS_DopLeft_Text2;
extern Ki_WorkSheetData WS_DopLeft_Text3;
extern Ki_WorkSheetData WS_DopLeft_Text4;
extern Ki_WorkSheetData WS_DopLeft_Text5;
extern Ki_WorkSheetData WS_DopLeft_Text6;
extern Ki_WorkSheetData WS_DopLeft_Text7;
extern Ki_WorkSheetData WS_DopTop_Line1;
extern Ki_WorkSheetData WS_DopTop_Line2;
extern Ki_WorkSheetData WS_DopTop_Line3;
extern Ki_WorkSheetData WS_DopTop_Line4;
extern Ki_WorkSheetData WS_DopTop_Line5;
extern Ki_WorkSheetData WS_DopTop_Line6;
// Center - right bottom corner
Ki_WorkSheetData WS_Osn1_Line1 =
{
WS_OSN,
&WS_Osn1_Line2,
Mm2mils( 185 ),Mm2mils( 55 ),
0, Mm2mils( 55 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line2 =
{
WS_OSN,
&WS_Osn1_Line3,
Mm2mils( 120 ),Mm2mils( 40 ),
0, Mm2mils( 40 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line3 =
{
WS_OSN,
&WS_Osn1_Line4,
Mm2mils( 185 ),Mm2mils( 35 ),
Mm2mils( 120 ),Mm2mils( 35 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line4 =
{
WS_OSN,
&WS_Osn1_Line5,
Mm2mils( 50 ), Mm2mils( 35 ),
0, Mm2mils( 35 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line5 =
{
WS_OSN,
&WS_Osn1_Line6,
Mm2mils( 185 ),Mm2mils( 30 ),
Mm2mils( 120 ),Mm2mils( 30 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line6 =
{
WS_OSN,
&WS_Osn1_Line7,
Mm2mils( 50 ), Mm2mils( 20 ),
0, Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line7 =
{
WS_OSN,
&WS_Osn1_Line8,
Mm2mils( 120 ),Mm2mils( 15 ),
0, Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line8 =
{
WS_OSN,
&WS_Osn1_Line9,
Mm2mils( 185 ),Mm2mils( 55 ),
Mm2mils( 185 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line9 =
{
WS_OSN,
&WS_Osn1_Line10,
Mm2mils( 178 ), Mm2mils( 55 ),
Mm2mils( 178 ), Mm2mils( 30 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line10 =
{
WS_OSN,
&WS_Osn1_Line11,
Mm2mils( 168 ), Mm2mils( 55 ),
Mm2mils( 168 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line11 =
{
WS_OSN,
&WS_Osn1_Line12,
Mm2mils( 145 ), Mm2mils( 55 ),
Mm2mils( 145 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line12 =
{
WS_OSN,
&WS_Osn1_Line13,
Mm2mils( 130 ), Mm2mils( 55 ),
Mm2mils( 130 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line13 =
{
WS_OSN,
&WS_Osn1_Line14,
Mm2mils( 120 ), Mm2mils( 55 ),
Mm2mils( 120 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line14 =
{
WS_OSN,
&WS_Osn1_Line15,
Mm2mils( 50 ), Mm2mils( 40 ),
Mm2mils( 50 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line15 =
{
WS_OSN,
&WS_Osn1_Line16,
Mm2mils( 35 ), Mm2mils( 40 ),
Mm2mils( 35 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line16 =
{
WS_OSN,
&WS_Osn1_Line17,
Mm2mils( 30 ), Mm2mils( 20 ),
Mm2mils( 30 ), Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line17 =
{
WS_OSN,
&WS_Osn1_Line18,
Mm2mils( 18 ), Mm2mils( 40 ),
Mm2mils( 18 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line18 =
{
WS_TONK,
&WS_Osn1_Line19,
Mm2mils( 185 ), Mm2mils( 50 ),
Mm2mils( 120 ), Mm2mils( 50 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line19 =
{
WS_TONK,
&WS_Osn1_Line20,
Mm2mils( 185 ), Mm2mils( 45 ),
Mm2mils( 120 ), Mm2mils( 45 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line20 =
{
WS_TONK,
&WS_Osn1_Line21,
Mm2mils( 185 ), Mm2mils( 40 ),
Mm2mils( 120 ), Mm2mils( 40 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line21 =
{
WS_TONK,
&WS_Osn1_Line22,
Mm2mils( 185 ), Mm2mils( 25 ),
Mm2mils( 120 ), Mm2mils( 25 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line22 =
{
WS_TONK,
&WS_Osn1_Line23,
Mm2mils( 185 ), Mm2mils( 20 ),
Mm2mils( 120 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line23 =
{
WS_TONK,
&WS_Osn1_Line24,
Mm2mils( 185 ), Mm2mils( 15 ),
Mm2mils( 120 ), Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line24 =
{
WS_TONK,
&WS_Osn1_Line25,
Mm2mils( 185 ), Mm2mils( 10 ),
Mm2mils( 120 ), Mm2mils( 10 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line25 =
{
WS_TONK,
&WS_Osn1_Line26,
Mm2mils( 185 ), Mm2mils( 5 ),
Mm2mils( 120 ), Mm2mils( 5 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line26 =
{
WS_TONK,
&WS_Osn1_Line27,
Mm2mils( 45 ), Mm2mils( 35 ),
Mm2mils( 45 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line27 =
{
WS_TONK,
&WS_Osn1_Text1,
Mm2mils( 40 ), Mm2mils( 35 ),
Mm2mils( 40 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Text1 =
{
WS_TEXT,
&WS_Osn1_Text2,
Mm2mils( 181.5 ),Mm2mils( 32.5 ),
0, 0,
wxT( "Изм." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text2 =
{
WS_TEXTL,
&WS_Osn1_Text3,
Mm2mils( 184 ), Mm2mils( 27.5 ),
0, 0,
wxT( "Разраб." ),NULL
};
Ki_WorkSheetData WS_Osn1_Text3 =
{
WS_TEXTL,
&WS_Osn1_Text4,
Mm2mils( 184 ),Mm2mils( 22.5 ),
0, 0,
wxT( "Пров." ),NULL
};
Ki_WorkSheetData WS_Osn1_Text4 =
{
WS_TEXTL,
&WS_Osn1_Text5,
Mm2mils( 184 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Т.контр." ),NULL
};
Ki_WorkSheetData WS_Osn1_Text5 =
{
WS_TEXTL,
&WS_Osn1_Text6,
Mm2mils( 184 ), Mm2mils( 7.5 ),
0, 0,
wxT( "Н.контр." ),NULL
};
Ki_WorkSheetData WS_Osn1_Text6 =
{
WS_TEXTL,
&WS_Osn1_Text7,
Mm2mils( 184 ),Mm2mils( 2.5 ),
0, 0,
wxT( "Утв." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text7 =
{
WS_TEXT,
&WS_Osn1_Text8,
Mm2mils( 173 ),Mm2mils( 32.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text8 =
{
WS_TEXT,
&WS_Osn1_Text9,
Mm2mils( 156.5 ), Mm2mils( 32.5 ),
0, 0,
wxT( "N докум." ),NULL
};
Ki_WorkSheetData WS_Osn1_Text9 =
{
WS_TEXT,
&WS_Osn1_Text10,
Mm2mils( 137.5 ),Mm2mils( 32.5 ),
0, 0,
wxT( "Подп." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text10 =
{
WS_TEXT,
&WS_Osn1_Text11,
Mm2mils( 125 ), Mm2mils( 32.5 ),
0, 0,
wxT( "Дата" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text11 =
{
WS_TEXT,
&WS_Osn1_Text12,
Mm2mils( 42.5 ),Mm2mils( 37.5 ),
0, 0,
wxT( "Лит." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text12 =
{
WS_TEXT,
&WS_Osn1_Text13,
Mm2mils( 26.5 ),Mm2mils( 37.5 ),
0, 0,
wxT( "Масса" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text13 =
{
WS_TEXT,
&WS_Osn1_Text14,
Mm2mils( 9 ), Mm2mils( 37.5 ),
0, 0,
wxT( "Масштаб" ),NULL
};
Ki_WorkSheetData WS_Osn1_Text14 =
{
WS_TEXTL,
&WS_Osn1_Text15,
Mm2mils( 49 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text15 =
{
WS_TEXTL,
&WS_Osn1_Text16,
Mm2mils( 29 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Листов" ),NULL
};
Ki_WorkSheetData WS_Osn1_Text16 =
{
WS_TEXTL,
&WS_Osn1_Text17,
Mm2mils( 40 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Формат" ),NULL
};
Ki_WorkSheetData WS_Osn1_Text17 =
{
WS_TEXTL,
NULL,
Mm2mils( 110 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Копировал" ),NULL
};
Ki_WorkSheetData WS_Osn2a_Line1 =
{
WS_OSN,
&WS_Osn2a_Line2,
Mm2mils( 185 ), Mm2mils( 15 ),
0, Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line2 =
{
WS_OSN,
&WS_Osn2a_Line3,
Mm2mils( 185 ), Mm2mils( 5 ),
Mm2mils( 120 ), Mm2mils( 5 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line3 =
{
WS_OSN,
&WS_Osn2a_Line4,
Mm2mils( 10 ), Mm2mils( 8 ),
0, Mm2mils( 8 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line4 =
{
WS_OSN,
&WS_Osn2a_Line5,
Mm2mils( 185 ), Mm2mils( 15 ),
Mm2mils( 185 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line5 =
{
WS_OSN,
&WS_Osn2a_Line6,
Mm2mils( 178 ), Mm2mils( 15 ),
Mm2mils( 178 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line6 =
{
WS_OSN,
&WS_Osn2a_Line7,
Mm2mils( 168 ), Mm2mils( 15 ),
Mm2mils( 168 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line7 =
{
WS_OSN,
&WS_Osn2a_Line8,
Mm2mils( 145 ), Mm2mils( 15 ),
Mm2mils( 145 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line8 =
{
WS_OSN,
&WS_Osn2a_Line9,
Mm2mils( 130 ), Mm2mils( 15 ),
Mm2mils( 130 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line9 =
{
WS_OSN,
&WS_Osn2a_Line10,
Mm2mils( 120 ), Mm2mils( 15 ),
Mm2mils( 120 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line10 =
{
WS_OSN,
&WS_Osn2a_Line11,
Mm2mils( 10 ), Mm2mils( 15 ),
Mm2mils( 10 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line11 =
{
WS_TONK,
&WS_Osn2a_Text1,
Mm2mils( 185 ), Mm2mils( 10 ),
Mm2mils( 120 ), Mm2mils( 10 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Text1 =
{
WS_TEXT,
&WS_Osn2a_Text2,
Mm2mils( 181.5 ),Mm2mils( 2.5 ),
0, 0,
wxT( "Изм." ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text2 =
{
WS_TEXT,
&WS_Osn2a_Text3,
Mm2mils( 173 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text3 =
{
WS_TEXT,
&WS_Osn2a_Text4,
Mm2mils( 156.5 ), Mm2mils( 2.5 ),
0, 0,
wxT( "N докум." ),NULL
};
Ki_WorkSheetData WS_Osn2a_Text4 =
{
WS_TEXT,
&WS_Osn2a_Text5,
Mm2mils( 137.5 ),Mm2mils( 2.5 ),
0, 0,
wxT( "Подп." ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text5 =
{
WS_TEXT,
&WS_Osn2a_Text6,
Mm2mils( 125 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Дата" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text6 =
{
WS_TEXT,
&WS_Osn2a_Text7,
Mm2mils( 5 ), Mm2mils( 11.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text7 =
{
WS_TEXTL,
&WS_Osn2a_Text8,
Mm2mils( 40 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Формат" ),NULL
};
Ki_WorkSheetData WS_Osn2a_Text8 =
{
WS_TEXTL,
NULL,
Mm2mils( 110 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Копировал" ),NULL
};
// Center - left bottom corner
Ki_WorkSheetData WS_DopLeft_Line1 =
{
WS_OSN,
&WS_DopLeft_Line2,
Mm2mils( 12 ), Mm2mils( 145 ),
0, Mm2mils( 145 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line2 =
{
WS_OSN,
&WS_DopLeft_Line3,
Mm2mils( 12 ), Mm2mils( 110 ),
0, Mm2mils( 110 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line3 =
{
WS_OSN,
&WS_DopLeft_Line4,
Mm2mils( 12 ), Mm2mils( 85 ),
0, Mm2mils( 85 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line4 =
{
WS_OSN,
&WS_DopLeft_Line5,
Mm2mils( 12 ), Mm2mils( 60 ),
0, Mm2mils( 60 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line5 =
{
WS_OSN,
&WS_DopLeft_Line6,
Mm2mils( 12 ), Mm2mils( 25 ),
0, Mm2mils( 25 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line6 =
{
WS_OSN,
&WS_DopLeft_Line7,
Mm2mils( 12 ), 0,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line7 =
{
WS_OSN,
&WS_DopLeft_Line8,
Mm2mils( 12 ), Mm2mils( 145 ),
Mm2mils( 12 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line8 =
{
WS_OSN,
&WS_DopLeft_Text1,
Mm2mils( 7 ), Mm2mils( 145 ),
Mm2mils( 7 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Text1 =
{
WS_TEXT,
&WS_DopLeft_Text2,
Mm2mils( 9.5 ), Mm2mils( 12.5 ),
0, 0,
wxT( "Инв.N подл." ),NULL
};
Ki_WorkSheetData WS_DopLeft_Text2 =
{
WS_TEXT,
&WS_DopLeft_Text3,
Mm2mils( 9.5 ), Mm2mils( 42.5 ),
0, 0,
wxT( "Подп. и дата" ),NULL
};
Ki_WorkSheetData WS_DopLeft_Text3 =
{
WS_TEXT,
&WS_DopLeft_Text4,
Mm2mils( 9.5 ), Mm2mils( 72.5 ),
0, 0,
wxT( "Взам.инв.N" ),NULL
};
Ki_WorkSheetData WS_DopLeft_Text4 =
{
WS_TEXT,
&WS_DopLeft_Text5,
Mm2mils( 9.5 ), Mm2mils( 97.5 ),
0, 0,
wxT( "Инв.N дубл." ),NULL
};
Ki_WorkSheetData WS_DopLeft_Text5 =
{
WS_TEXT,
&WS_DopLeft_Line9,
Mm2mils( 9.5 ), Mm2mils( 127.5 ),
0, 0,
wxT( "Подп. и дата" ),NULL
};
Ki_WorkSheetData WS_DopLeft_Line9 =
{
WS_OSN,
&WS_DopLeft_Line10,
Mm2mils( 7 ), Mm2mils( 287 ),
Mm2mils( 7 ), Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line10 =
{
WS_OSN,
&WS_DopLeft_Line11,
Mm2mils( 12 ), Mm2mils( 287 ),
Mm2mils( 12 ), Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line11 =
{
WS_OSN,
&WS_DopLeft_Line12,
Mm2mils( 12 ), Mm2mils( 287 ),
Mm2mils( 12 ), Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line12 =
{
WS_OSN,
&WS_DopLeft_Line13,
Mm2mils( 12 ), Mm2mils( 167 ),
0, Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line13 =
{
WS_OSN,
&WS_DopLeft_Line14,
Mm2mils( 12 ), Mm2mils( 227 ),
0, Mm2mils( 227 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line14 =
{
WS_OSN,
&WS_DopLeft_Text6,
Mm2mils( 12 ), Mm2mils( 287 ),
0, Mm2mils( 287 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Text6 =
{
WS_TEXT,
&WS_DopLeft_Text7,
Mm2mils( 9.5 ), Mm2mils( 197 ),
0, 0,
wxT( "Справ. N" ),NULL
};
Ki_WorkSheetData WS_DopLeft_Text7 =
{
WS_TEXT,
NULL,
Mm2mils( 9.5 ), Mm2mils( 257 ),
0, 0,
wxT( "Перв. примен." ),NULL
};
// Center - left top corner
Ki_WorkSheetData WS_DopTop_Line1 =
{
WS_OSN,
&WS_DopTop_Line2,
Mm2mils( 70 ), 0,
Mm2mils( 70 ), Mm2mils( 14 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line2 =
{
WS_OSN,
&WS_DopTop_Line3,
Mm2mils( 70 ), Mm2mils( 14 ),
0, Mm2mils( 14 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line3 =
{
WS_OSN,
&WS_DopTop_Line4,
Mm2mils( 70 ), Mm2mils( 14 ),
Mm2mils( 137 ), Mm2mils( 14 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line4 =
{
WS_OSN,
&WS_DopTop_Line5,
Mm2mils( 84 ), Mm2mils( 7 ),
Mm2mils( 137 ), Mm2mils( 7 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line5 =
{
WS_OSN,
&WS_DopTop_Line6,
Mm2mils( 84 ), Mm2mils( 14 ),
Mm2mils( 84 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line6 =
{
WS_OSN,
NULL,
Mm2mils( 137 ),Mm2mils( 14 ),
Mm2mils( 137 ), 0,
NULL, NULL
};
#include <worksheet_shape_builder.h>
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( wxSize& aPageSize,
wxPoint& aLTmargin, wxPoint& aRBmargin,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
{
wxPoint pos;
wxPoint end;
int refx, refy;
wxString Line;
Ki_WorkSheetData* WsItem;
wxSize size( SIZETEXT * aScalar, SIZETEXT * aScalar );
wxSize size_ref( SIZETEXT_REF * aScalar, SIZETEXT_REF * aScalar );
wxString msg;
WS_DRAW_ITEM_TEXT* gtext;
// Upper left corner
refx = aLTmargin.x;
refy = aLTmargin.y;
// lower right corner
int xg, yg;
xg = aPageSize.x - aRBmargin.x;
yg = aPageSize.y - aRBmargin.y;
int lnMsg, ln;
int lnWosn = aPenWidth * 2;
int lnWtonk = aPenWidth;
wxSize sz;
wxSize size0_8( SIZETEXT * aScalar * 0.8, SIZETEXT * aScalar * 1 );
wxSize size1_5( SIZETEXT * aScalar * 1.5, SIZETEXT * aScalar * 1.5 );
wxSize size2( SIZETEXT * aScalar * 2, SIZETEXT * aScalar * 2 );
wxSize size3( SIZETEXT * aScalar * 3, SIZETEXT * aScalar * 3 );
// Draw the border.
Append( new WS_DRAW_ITEM_RECT(
wxPoint( refx * aScalar, refy * aScalar ),
wxPoint( xg * aScalar, yg * aScalar ),
lnWosn, aLineColor ) );
// Center - right bottom corner
refx = aPageSize.x - aRBmargin.x;
refy = aPageSize.y - aRBmargin.y;
// First page
if( aSheetNumber == 1 )
{
for( WsItem = &WS_Osn1_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
end.x = (refx - WsItem->m_Endx) * aScalar;
end.y = (refy - WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWosn, aLineColor ) );
break;
case WS_TONK:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWtonk, aLineColor ) );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn1_Text1 )
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
size0_8, aPenWidth,
aLineColor ) );
else
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
}
break;
}
}
// Sheet number
if( aSheetCount > 1 )
{
pos.x = ( refx - Mm2mils( 36 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 17.5 ) ) * aScalar;
msg.Empty();
msg << aSheetNumber;
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
}
// Count of sheets
pos.x = ( refx - Mm2mils( 10 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 17.5 ) ) * aScalar;
msg.Empty();
msg << aSheetCount;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
// Company name
msg = aTitleBlock.GetCompany();
if( !msg.IsEmpty() )
{
sz = size1_5;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 49 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx - Mm2mils( 25 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 7.5 ) ) * aScalar;
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aLineColor ) );
}
// Title
msg = aTitleBlock.GetTitle();
if( !msg.IsEmpty() )
{
sz = size1_5;
wxArrayString lines;
int titleWidth = 0;
int titleHeight = (sz.y + sz.y * 0.5) / aScalar;
int titleFieldWidth = Mm2mils( 69 );
int titleFieldHeight = Mm2mils( 24 );
int index = 0;
wxString fullMsg = msg;
do // Reduce the height of wrapped title until the fit
{
do // Wrap the title
{
titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
if( titleWidth > titleFieldWidth )
{
index = 0;
do
{
msg = msg.Left( msg.Length() - 1 );
if( msg.Length() == 0 )
{
lines.Clear();
msg = fullMsg;
sz.x -= aScalar;
break;
}
else
{
index++;
titleWidth =
ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
wxString ch = wxString( msg.Last() );
if( titleWidth < titleFieldWidth && ch == wxT( " " ) )
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
index += msg.Length() - dot - 2;
msg = msg.Left( dot + 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
else
{
msg = msg.Left( msg.Length() - 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
}
}
} while( 1 );
}
else
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
lines.Add( msg.Left( dot + 1 ) );
lines.Add( fullMsg.Right( msg.Length() - dot - 2 ) );
}
else
lines.Add( msg );
break;
}
} while( 1 );
if( titleFieldHeight < (int) ( titleHeight * lines.Count() ) )
{
sz.y -= aScalar;
sz.x -= aScalar;
msg = fullMsg;
lines.Clear();
}
else
break;
} while( 1 );
pos.x = ( refx - Mm2mils( 85 ) ) * aScalar;
pos.y =
( refy - Mm2mils( 27.5 ) - (titleHeight * (lines.Count() - 1) / 2) ) * aScalar;
for( unsigned curLn = 0; curLn < lines.Count(); curLn++ )
{
msg = lines[curLn];
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
pos.y += titleHeight * aScalar;
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 119 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx - Mm2mils( 60 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 47.5 ) ) * aScalar;
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
}
// Developer
msg = aTitleBlock.GetComment2();
if( !msg.IsEmpty() )
{
sz = size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx - Mm2mils( 167.5 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 27.5 ) ) * aScalar;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
}
// Verifier
msg = aTitleBlock.GetComment3();
if( !msg.IsEmpty() )
{
sz = size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx - Mm2mils( 167 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 22.5 ) ) * aScalar;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
}
// Approver
msg = aTitleBlock.GetComment4();
if( !msg.IsEmpty() )
{
sz = size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx - Mm2mils( 167 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 2.5 ) ) * aScalar;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
}
}
else // other pages
{
for( WsItem = &WS_Osn2a_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
end.x = (refx - WsItem->m_Endx) * aScalar;
end.y = (refy - WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWosn, aLineColor ) );
break;
case WS_TONK:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWtonk, aLineColor ) );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn2a_Text1 )
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
size0_8, aPenWidth,
aLineColor ) );
else
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth,
aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
}
break;
}
}
// Sheet number
pos.x = ( refx - Mm2mils( 5 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 4 ) ) * aScalar;
msg.Empty();
msg << aSheetNumber;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 109 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx - Mm2mils( 65 ) ) * aScalar;
pos.y = ( refy - Mm2mils( 7.5 ) ) * aScalar;
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
}
}
// Format
pos.x = ( refx - Mm2mils( 23 ) ) * aScalar;
pos.y = ( refy + Mm2mils( 2.5 ) ) * aScalar;
msg.Empty();
msg << aPaperFormat;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
// Center - left bottom corner
refx = aLTmargin.x;
refy = aPageSize.y - aRBmargin.y;
for( WsItem = &WS_DopLeft_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
end.x = (refx - WsItem->m_Endx) * aScalar;
end.y = (refy - WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWosn, aLineColor ) );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, aPenWidth, aLineColor ) );
gtext->SetOrientation( TEXT_ORIENT_VERT );
}
break;
}
}
if( aPaperFormat == PAGE_INFO::A4 || aPageSize.x > aPageSize.y ) // A4 or Landscape
{
// Center - left top corner
refx = aLTmargin.x;
refy = aLTmargin.y;
for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
break;
pos.x = (refx + WsItem->m_Posx) * aScalar;
pos.y = (refy + WsItem->m_Posy) * aScalar;
end.x = (refx + WsItem->m_Endx) * aScalar;
end.y = (refy + WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWosn, aLineColor ) );
break;
case WS_TONK:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWtonk, aLineColor ) );
break;
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx + Mm2mils( 35 ) ) * aScalar;
pos.y = ( refy + Mm2mils( 7 ) ) * aScalar;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
gtext->SetOrientation( 1800.0 );
}
}
else // Portrait
{
// Center - right top corner
// Lines are used from the upper left corner by the change of coordinates
refx = aPageSize.x - aRBmargin.x;
refy = aLTmargin.y;
for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posy) * aScalar;
pos.y = (refy + WsItem->m_Posx) * aScalar;
end.x = (refx - WsItem->m_Endy) * aScalar;
end.y = (refy + WsItem->m_Endx) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWosn, aLineColor ) );
break;
case WS_TONK:
Append( new WS_DRAW_ITEM_LINE( pos, end,
lnWtonk, aLineColor ) );
break;
}
}
// Decimal number
msg = aTitleBlock.GetComment1();
if( !msg.IsEmpty() )
{
sz = size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= float(ln) / lnMsg;
pos.x = ( refx - Mm2mils( 7 ) ) * aScalar;
pos.y = ( refy + Mm2mils( 35 ) ) * aScalar;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
sz, aPenWidth, aTextColor ) );
gtext->SetOrientation( TEXT_ORIENT_VERT );
}
}
}
/*****************/
/* WORKSHEET.CPP */
/*****************/
/**
* @file worksheet.cpp
* @brief Common code to draw the title block and frame references
* @note it should include title_block_shape_gost.h or title_block_shape.h
* which defines most of draw shapes, and contains a part of the draw code
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <gr_basic.h>
......@@ -15,1035 +43,19 @@
#include <kicad_string.h>
#include <worksheet.h>
#include <class_title_block.h>
#include <build_version.h>
// Must be defined in main applications:
// include data which defines the shape of a title block
// and frame references
#include <worksheet_shape_builder.h>
#if defined(KICAD_GOST)
// Center - right bottom corner
Ki_WorkSheetData WS_Osn1_Line1 =
{
WS_OSN,
&WS_Osn1_Line2,
Mm2mils( 185 ), Mm2mils( 55 ),
0, Mm2mils( 55 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line2 =
{
WS_OSN,
&WS_Osn1_Line3,
Mm2mils( 120 ), Mm2mils( 40 ),
0, Mm2mils( 40 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line3 =
{
WS_OSN,
&WS_Osn1_Line4,
Mm2mils( 185 ), Mm2mils( 35 ),
Mm2mils( 120 ), Mm2mils( 35 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line4 =
{
WS_OSN,
&WS_Osn1_Line5,
Mm2mils( 50 ), Mm2mils( 35 ),
0, Mm2mils( 35 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line5 =
{
WS_OSN,
&WS_Osn1_Line6,
Mm2mils( 185 ), Mm2mils( 30 ),
Mm2mils( 120 ), Mm2mils( 30 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line6 =
{
WS_OSN,
&WS_Osn1_Line7,
Mm2mils( 50 ), Mm2mils( 20 ),
0, Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line7 =
{
WS_OSN,
&WS_Osn1_Line8,
Mm2mils( 120 ), Mm2mils( 15 ),
0, Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line8 =
{
WS_OSN,
&WS_Osn1_Line9,
Mm2mils( 185 ), Mm2mils( 55 ),
Mm2mils( 185 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line9 =
{
WS_OSN,
&WS_Osn1_Line10,
Mm2mils( 178 ), Mm2mils( 55 ),
Mm2mils( 178 ), Mm2mils( 30 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line10 =
{
WS_OSN,
&WS_Osn1_Line11,
Mm2mils( 168 ), Mm2mils( 55 ),
Mm2mils( 168 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line11 =
{
WS_OSN,
&WS_Osn1_Line12,
Mm2mils( 145 ), Mm2mils( 55 ),
Mm2mils( 145 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line12 =
{
WS_OSN,
&WS_Osn1_Line13,
Mm2mils( 130 ), Mm2mils( 55 ),
Mm2mils( 130 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line13 =
{
WS_OSN,
&WS_Osn1_Line14,
Mm2mils( 120 ), Mm2mils( 55 ),
Mm2mils( 120 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line14 =
{
WS_OSN,
&WS_Osn1_Line15,
Mm2mils( 50 ), Mm2mils( 40 ),
Mm2mils( 50 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line15 =
{
WS_OSN,
&WS_Osn1_Line16,
Mm2mils( 35 ), Mm2mils( 40 ),
Mm2mils( 35 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line16 =
{
WS_OSN,
&WS_Osn1_Line17,
Mm2mils( 30 ), Mm2mils( 20 ),
Mm2mils( 30 ), Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line17 =
{
WS_OSN,
&WS_Osn1_Line18,
Mm2mils( 18 ), Mm2mils( 40 ),
Mm2mils( 18 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line18 =
{
WS_TONK,
&WS_Osn1_Line19,
Mm2mils( 185 ), Mm2mils( 50 ),
Mm2mils( 120 ), Mm2mils( 50 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line19 =
{
WS_TONK,
&WS_Osn1_Line20,
Mm2mils( 185 ), Mm2mils( 45 ),
Mm2mils( 120 ), Mm2mils( 45 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line20 =
{
WS_TONK,
&WS_Osn1_Line21,
Mm2mils( 185 ), Mm2mils( 40 ),
Mm2mils( 120 ), Mm2mils( 40 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line21 =
{
WS_TONK,
&WS_Osn1_Line22,
Mm2mils( 185 ), Mm2mils( 25 ),
Mm2mils( 120 ), Mm2mils( 25 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line22 =
{
WS_TONK,
&WS_Osn1_Line23,
Mm2mils( 185 ), Mm2mils( 20 ),
Mm2mils( 120 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line23 =
{
WS_TONK,
&WS_Osn1_Line24,
Mm2mils( 185 ), Mm2mils( 15 ),
Mm2mils( 120 ), Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line24 =
{
WS_TONK,
&WS_Osn1_Line25,
Mm2mils( 185 ), Mm2mils( 10 ),
Mm2mils( 120 ), Mm2mils( 10 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line25 =
{
WS_TONK,
&WS_Osn1_Line26,
Mm2mils( 185 ), Mm2mils( 5 ),
Mm2mils( 120 ), Mm2mils( 5 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line26 =
{
WS_TONK,
&WS_Osn1_Line27,
Mm2mils( 45 ), Mm2mils( 35 ),
Mm2mils( 45 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Line27 =
{
WS_TONK,
&WS_Osn1_Text1,
Mm2mils( 40 ), Mm2mils( 35 ),
Mm2mils( 40 ), Mm2mils( 20 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn1_Text1 =
{
WS_TEXT,
&WS_Osn1_Text2,
Mm2mils( 181.5 ), Mm2mils( 32.5 ),
0, 0,
wxT( "Изм." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text2 =
{
WS_TEXTL,
&WS_Osn1_Text3,
Mm2mils( 184 ), Mm2mils( 27.5 ),
0, 0,
wxT( "Разраб." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text3 =
{
WS_TEXTL,
&WS_Osn1_Text4,
Mm2mils( 184 ), Mm2mils( 22.5 ),
0, 0,
wxT( "Пров." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text4 =
{
WS_TEXTL,
&WS_Osn1_Text5,
Mm2mils( 184 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Т.контр." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text5 =
{
WS_TEXTL,
&WS_Osn1_Text6,
Mm2mils( 184 ), Mm2mils( 7.5 ),
0, 0,
wxT( "Н.контр." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text6 =
{
WS_TEXTL,
&WS_Osn1_Text7,
Mm2mils( 184 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Утв." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text7 =
{
WS_TEXT,
&WS_Osn1_Text8,
Mm2mils( 173 ), Mm2mils( 32.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text8 =
{
WS_TEXT,
&WS_Osn1_Text9,
Mm2mils( 156.5 ), Mm2mils( 32.5 ),
0, 0,
wxT( "N докум." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text9 =
{
WS_TEXT,
&WS_Osn1_Text10,
Mm2mils( 137.5 ), Mm2mils( 32.5 ),
0, 0,
wxT( "Подп." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text10 =
{
WS_TEXT,
&WS_Osn1_Text11,
Mm2mils( 125 ), Mm2mils( 32.5 ),
0, 0,
wxT( "Дата" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text11 =
{
WS_TEXT,
&WS_Osn1_Text12,
Mm2mils( 42.5 ), Mm2mils( 37.5 ),
0, 0,
wxT( "Лит." ), NULL
};
Ki_WorkSheetData WS_Osn1_Text12 =
{
WS_TEXT,
&WS_Osn1_Text13,
Mm2mils( 26.5 ), Mm2mils( 37.5 ),
0, 0,
wxT( "Масса" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text13 =
{
WS_TEXT,
&WS_Osn1_Text14,
Mm2mils( 9 ), Mm2mils( 37.5 ),
0, 0,
wxT( "Масштаб" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text14 =
{
WS_TEXTL,
&WS_Osn1_Text15,
Mm2mils( 49 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text15 =
{
WS_TEXTL,
&WS_Osn1_Text16,
Mm2mils( 29 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Листов" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text16 =
{
WS_TEXTL,
&WS_Osn1_Text17,
Mm2mils( 40 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Формат" ), NULL
};
Ki_WorkSheetData WS_Osn1_Text17 =
{
WS_TEXTL,
NULL,
Mm2mils( 110 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Копировал" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Line1 =
{
WS_OSN,
&WS_Osn2a_Line2,
Mm2mils( 185 ), Mm2mils( 15 ),
0, Mm2mils( 15 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line2 =
{
WS_OSN,
&WS_Osn2a_Line3,
Mm2mils( 185 ), Mm2mils( 5 ),
Mm2mils( 120 ), Mm2mils( 5 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line3 =
{
WS_OSN,
&WS_Osn2a_Line4,
Mm2mils( 10 ), Mm2mils( 8 ),
0, Mm2mils( 8 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line4 =
{
WS_OSN,
&WS_Osn2a_Line5,
Mm2mils( 185 ), Mm2mils( 15 ),
Mm2mils( 185 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line5 =
{
WS_OSN,
&WS_Osn2a_Line6,
Mm2mils( 178 ), Mm2mils( 15 ),
Mm2mils( 178 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line6 =
{
WS_OSN,
&WS_Osn2a_Line7,
Mm2mils( 168 ), Mm2mils( 15 ),
Mm2mils( 168 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line7 =
{
WS_OSN,
&WS_Osn2a_Line8,
Mm2mils( 145 ), Mm2mils( 15 ),
Mm2mils( 145 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line8 =
{
WS_OSN,
&WS_Osn2a_Line9,
Mm2mils( 130 ), Mm2mils( 15 ),
Mm2mils( 130 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line9 =
{
WS_OSN,
&WS_Osn2a_Line10,
Mm2mils( 120 ), Mm2mils( 15 ),
Mm2mils( 120 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line10 =
{
WS_OSN,
&WS_Osn2a_Line11,
Mm2mils( 10 ), Mm2mils( 15 ),
Mm2mils( 10 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Line11 =
{
WS_TONK,
&WS_Osn2a_Text1,
Mm2mils( 185 ), Mm2mils( 10 ),
Mm2mils( 120 ), Mm2mils( 10 ),
NULL, NULL
};
Ki_WorkSheetData WS_Osn2a_Text1 =
{
WS_TEXT,
&WS_Osn2a_Text2,
Mm2mils( 181.5 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Изм." ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text2 =
{
WS_TEXT,
&WS_Osn2a_Text3,
Mm2mils( 173 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text3 =
{
WS_TEXT,
&WS_Osn2a_Text4,
Mm2mils( 156.5 ), Mm2mils( 2.5 ),
0, 0,
wxT( "N докум." ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text4 =
{
WS_TEXT,
&WS_Osn2a_Text5,
Mm2mils( 137.5 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Подп." ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text5 =
{
WS_TEXT,
&WS_Osn2a_Text6,
Mm2mils( 125 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Дата" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text6 =
{
WS_TEXT,
&WS_Osn2a_Text7,
Mm2mils( 5 ), Mm2mils( 11.5 ),
0, 0,
wxT( "Лист" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text7 =
{
WS_TEXTL,
&WS_Osn2a_Text8,
Mm2mils( 40 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Формат" ), NULL
};
Ki_WorkSheetData WS_Osn2a_Text8 =
{
WS_TEXTL,
NULL,
Mm2mils( 110 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Копировал" ), NULL
};
// Center - left bottom corner
Ki_WorkSheetData WS_DopLeft_Line1 =
{
WS_OSN,
&WS_DopLeft_Line2,
Mm2mils( 12 ), Mm2mils( 145 ),
0, Mm2mils( 145 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line2 =
{
WS_OSN,
&WS_DopLeft_Line3,
Mm2mils( 12 ), Mm2mils( 110 ),
0, Mm2mils( 110 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line3 =
{
WS_OSN,
&WS_DopLeft_Line4,
Mm2mils( 12 ), Mm2mils( 85 ),
0, Mm2mils( 85 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line4 =
{
WS_OSN,
&WS_DopLeft_Line5,
Mm2mils( 12 ), Mm2mils( 60 ),
0, Mm2mils( 60 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line5 =
{
WS_OSN,
&WS_DopLeft_Line6,
Mm2mils( 12 ), Mm2mils( 25 ),
0, Mm2mils( 25 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line6 =
{
WS_OSN,
&WS_DopLeft_Line7,
Mm2mils( 12 ), 0,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line7 =
{
WS_OSN,
&WS_DopLeft_Line8,
Mm2mils( 12 ), Mm2mils( 145 ),
Mm2mils( 12 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line8 =
{
WS_OSN,
&WS_DopLeft_Text1,
Mm2mils( 7 ), Mm2mils( 145 ),
Mm2mils( 7 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Text1 =
{
WS_TEXT,
&WS_DopLeft_Text2,
Mm2mils( 9.5 ), Mm2mils( 12.5 ),
0, 0,
wxT( "Инв.N подл." ), NULL
};
Ki_WorkSheetData WS_DopLeft_Text2 =
{
WS_TEXT,
&WS_DopLeft_Text3,
Mm2mils( 9.5 ), Mm2mils( 42.5 ),
0, 0,
wxT( "Подп. и дата" ), NULL
};
Ki_WorkSheetData WS_DopLeft_Text3 =
{
WS_TEXT,
&WS_DopLeft_Text4,
Mm2mils( 9.5 ), Mm2mils( 72.5 ),
0, 0,
wxT( "Взам.инв.N" ), NULL
};
Ki_WorkSheetData WS_DopLeft_Text4 =
{
WS_TEXT,
&WS_DopLeft_Text5,
Mm2mils( 9.5 ), Mm2mils( 97.5 ),
0, 0,
wxT( "Инв.N дубл." ), NULL
};
Ki_WorkSheetData WS_DopLeft_Text5 =
{
WS_TEXT,
&WS_DopLeft_Line9,
Mm2mils( 9.5 ), Mm2mils( 127.5 ),
0, 0,
wxT( "Подп. и дата" ), NULL
};
Ki_WorkSheetData WS_DopLeft_Line9 =
{
WS_OSN,
&WS_DopLeft_Line10,
Mm2mils( 7 ), Mm2mils( 287 ),
Mm2mils( 7 ), Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line10 =
{
WS_OSN,
&WS_DopLeft_Line11,
Mm2mils( 12 ), Mm2mils( 287 ),
Mm2mils( 12 ), Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line11 =
{
WS_OSN,
&WS_DopLeft_Line12,
Mm2mils( 12 ), Mm2mils( 287 ),
Mm2mils( 12 ), Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line12 =
{
WS_OSN,
&WS_DopLeft_Line13,
Mm2mils( 12 ), Mm2mils( 167 ),
0, Mm2mils( 167 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line13 =
{
WS_OSN,
&WS_DopLeft_Line14,
Mm2mils( 12 ), Mm2mils( 227 ),
0, Mm2mils( 227 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Line14 =
{
WS_OSN,
&WS_DopLeft_Text6,
Mm2mils( 12 ), Mm2mils( 287 ),
0, Mm2mils( 287 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopLeft_Text6 =
{
WS_TEXT,
&WS_DopLeft_Text7,
Mm2mils( 9.5 ), Mm2mils( 197 ),
0, 0,
wxT( "Справ. N" ), NULL
};
Ki_WorkSheetData WS_DopLeft_Text7 =
{
WS_TEXT,
NULL,
Mm2mils( 9.5 ), Mm2mils( 257 ),
0, 0,
wxT( "Перв. примен." ), NULL
};
// Center - left top corner
Ki_WorkSheetData WS_DopTop_Line1 =
{
WS_OSN,
&WS_DopTop_Line2,
Mm2mils( 70 ), 0,
Mm2mils( 70 ), Mm2mils( 14 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line2 =
{
WS_OSN,
&WS_DopTop_Line3,
Mm2mils( 70 ), Mm2mils( 14 ),
0, Mm2mils( 14 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line3 =
{
WS_OSN,
&WS_DopTop_Line4,
Mm2mils( 70 ), Mm2mils( 14 ),
Mm2mils( 137 ), Mm2mils( 14 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line4 =
{
WS_OSN,
&WS_DopTop_Line5,
Mm2mils( 84 ), Mm2mils( 7 ),
Mm2mils( 137 ), Mm2mils( 7 ),
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line5 =
{
WS_OSN,
&WS_DopTop_Line6,
Mm2mils( 84 ), Mm2mils( 14 ),
Mm2mils( 84 ), 0,
NULL, NULL
};
Ki_WorkSheetData WS_DopTop_Line6 =
{
WS_OSN,
NULL,
Mm2mils( 137 ), Mm2mils( 14 ),
Mm2mils( 137 ), 0,
NULL, NULL
};
#include "title_block_shapes_gost.h"
#else
Ki_WorkSheetData WS_Date =
{
WS_DATE,
&WS_Licence,
BLOCK_DATE_X, BLOCK_DATE_Y,
0, 0,
wxT( "Date: " ),NULL
};
Ki_WorkSheetData WS_Licence =
{
WS_KICAD_VERSION,
&WS_Revision,
BLOCK_KICAD_VERSION_X,BLOCK_KICAD_VERSION_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Revision =
{
WS_REV,
&WS_SizeSheet,
BLOCK_REV_X, BLOCK_REV_Y,
0, 0,
wxT( "Rev: " ), NULL
};
Ki_WorkSheetData WS_SizeSheet =
{
WS_SIZESHEET,
&WS_IdentSheet,
BLOCK_SIZE_SHEET_X, BLOCK_SIZE_SHEET_Y,
0, 0,
wxT( "Size: " ), NULL
};
Ki_WorkSheetData WS_IdentSheet =
{
WS_IDENTSHEET,
&WS_Title,
BLOCK_ID_SHEET_X,BLOCK_ID_SHEET_Y,
0, 0,
wxT( "Id: " ), NULL
};
Ki_WorkSheetData WS_Title =
{
WS_TITLE,
&WS_SheetFilename,
BLOCK_TITLE_X, BLOCK_TITLE_Y,
0, 0,
wxT( "Title: " ), NULL
};
Ki_WorkSheetData WS_SheetFilename =
{
WS_FILENAME,
&WS_FullSheetName,
BLOCK_FILENAME_X, BLOCK_FILENAME_Y,
0, 0,
wxT( "File: " ), NULL
};
Ki_WorkSheetData WS_FullSheetName =
{
WS_FULLSHEETNAME,
&WS_Company,
BLOCK_FULLSHEETNAME_X,BLOCK_FULLSHEETNAME_Y,
0, 0,
wxT( "Sheet: " ), NULL
};
Ki_WorkSheetData WS_Company =
{
WS_COMPANY_NAME,
&WS_Comment1,
BLOCK_COMMENT_X,BLOCK_COMPANY_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment1 =
{
WS_COMMENT1,
&WS_Comment2,
BLOCK_COMMENT_X,BLOCK_COMMENT1_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment2 =
{
WS_COMMENT2,
&WS_Comment3,
BLOCK_COMMENT_X,BLOCK_COMMENT2_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment3 =
{
WS_COMMENT3,
&WS_Comment4,
BLOCK_COMMENT_X,BLOCK_COMMENT3_Y,
0, 0,
NULL, NULL
};
Ki_WorkSheetData WS_Comment4 =
{
WS_COMMENT4,
&WS_MostLeftLine,
BLOCK_COMMENT_X, BLOCK_COMMENT4_Y,
0, 0,
NULL, NULL
};
/// Left vertical segment
Ki_WorkSheetData WS_MostLeftLine =
{
WS_LEFT_SEGMENT,
&WS_SeparatorLine,
BLOCK_OX, SIZETEXT * 16,
BLOCK_OX, 0,
NULL, NULL
};
/// horizontal segment between filename and comments
Ki_WorkSheetData WS_SeparatorLine =
{
WS_SEGMENT,
&WS_MostUpperLine,
BLOCK_OX, VARIABLE_BLOCK_START_POSITION,
0, VARIABLE_BLOCK_START_POSITION,
NULL, NULL
};
/// superior horizontal segment
Ki_WorkSheetData WS_MostUpperLine =
{
WS_UPPER_SEGMENT,
&WS_Segm3,
BLOCK_OX, SIZETEXT * 16,
0, SIZETEXT * 16,
NULL, NULL
};
/// horizontal segment above COMPANY NAME
Ki_WorkSheetData WS_Segm3 =
{
WS_SEGMENT,
&WS_Segm4,
BLOCK_OX, SIZETEXT * 6,
0, SIZETEXT * 6,
NULL, NULL
};
/// vertical segment of the left REV and SHEET
Ki_WorkSheetData WS_Segm4 =
{
WS_SEGMENT,
&WS_Segm5,
BLOCK_REV_X + SIZETEXT,SIZETEXT * 4,
BLOCK_REV_X + SIZETEXT,0,
NULL, NULL
};
Ki_WorkSheetData WS_Segm5 =
{
WS_SEGMENT,
&WS_Segm6,
BLOCK_OX, SIZETEXT * 2,
0, SIZETEXT * 2,
NULL, NULL
};
Ki_WorkSheetData WS_Segm6 =
{
WS_SEGMENT,
&WS_Segm7,
BLOCK_OX, SIZETEXT * 4,
0, SIZETEXT * 4,
NULL, NULL
};
Ki_WorkSheetData WS_Segm7 =
{
WS_SEGMENT,
NULL,
BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 4,
BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 2,
NULL, NULL
};
#include "title_block_shapes.h"
#endif
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScalar, const wxString &aFilename )
{
......@@ -1076,805 +88,6 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineW
}
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr1, EDA_COLOR_T aClr2 )
{
wxPoint pos;
wxPoint end;
int refx, refy;
wxString Line;
Ki_WorkSheetData* WsItem;
wxSize size( SIZETEXT * aScalar, SIZETEXT * aScalar );
wxSize size_ref( SIZETEXT_REF * aScalar, SIZETEXT_REF * aScalar );
wxString msg;
GRSetDrawMode( aDC, GR_COPY );
// Upper left corner
refx = aLT.x;
refy = aLT.y;
// lower right corner
int xg, yg;
xg = aSz.x - aRB.x;
yg = aSz.y - aRB.y;
#if defined(KICAD_GOST)
int lnMsg, ln;
int lnWosn = aLnW * 2;
int lnWtonk = aLnW;
wxSize sz;
wxSize size0_8( SIZETEXT * aScalar * 0.8, SIZETEXT * aScalar * 1 );
wxSize size1_5( SIZETEXT * aScalar * 1.5, SIZETEXT * aScalar * 1.5 );
wxSize size2( SIZETEXT * aScalar * 2, SIZETEXT * aScalar * 2 );
wxSize size3( SIZETEXT * aScalar * 3, SIZETEXT * aScalar * 3 );
// Draw the border.
GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * aScalar, yg * aScalar, lnWosn, aClr1 );
// Center - right bottom corner
refx = aSz.x - aRB.x;
refy = aSz.y - aRB.y;
// First page
if( aScr == 1 )
{
for( WsItem = &WS_Osn1_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
end.x = (refx - WsItem->m_Endx) * aScalar;
end.y = (refy - WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWosn, aClr1 );
break;
case WS_TONK:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWtonk, aClr1 );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn1_Text1 )
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size0_8,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
else
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
break;
}
}
// Sheet number
if( aNScr > 1 )
{
pos.x = (refx - Mm2mils( 36 )) * aScalar;
pos.y = (refy - Mm2mils( 17.5 )) * aScalar;
msg.Empty();
msg << aScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg,
TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false );
}
// Count of sheets
pos.x = (refx - Mm2mils( 10 )) * aScalar;
pos.y = (refy - Mm2mils( 17.5 )) * aScalar;
msg.Empty();
msg << aNScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg,
TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false );
// Company name
msg = aTb.GetCompany();
if( !msg.IsEmpty() )
{
sz = size1_5;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 49 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 25 )) * aScalar;
pos.y = (refy - Mm2mils( 7.5 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
// Title
msg = aTb.GetTitle();
if( !msg.IsEmpty() )
{
sz = size1_5;
wxArrayString lines;
int titleWidth = 0;
int titleHeight = (sz.y + sz.y * 0.5) / aScalar;
int titleFieldWidth = Mm2mils( 69 );
int titleFieldHeight = Mm2mils( 24 );
int index = 0;
wxString fullMsg = msg;
do // Reduce the height of wrapped title until the fit
{
do // Wrap the title
{
titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
if( titleWidth > titleFieldWidth )
{
index = 0;
do
{
msg = msg.Left( msg.Length() - 1 );
if( msg.Length() == 0 )
{
lines.Clear();
msg = fullMsg;
sz.x -= aScalar;
break;
}
else
{
index++;
titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
wxString ch = wxString( msg.Last() );
if( titleWidth < titleFieldWidth && ch == wxT( " " ) )
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
index += msg.Length() - dot - 2;
msg = msg.Left( dot + 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
else
{
msg = msg.Left( msg.Length() - 1 );
lines.Add( msg );
msg = fullMsg.Right( index );
break;
}
}
}
}while( 1 );
}
else
{
// New sentence on a new line
int dot = msg.Index( wxT( ". " ) );
if( dot != wxNOT_FOUND )
{
lines.Add( msg.Left( dot + 1 ) );
lines.Add( fullMsg.Right( msg.Length() - dot - 2 ) );
}
else
lines.Add( msg );
break;
}
}while( 1 );
if( titleFieldHeight < titleHeight * lines.Count() )
{
sz.y -= aScalar;
sz.x -= aScalar;
msg = fullMsg;
lines.Clear();
}
else
break;
}while( 1 );
pos.x = (refx - Mm2mils( 85 )) * aScalar;
pos.y = (refy - Mm2mils( 27.5 ) - (titleHeight * (lines.Count() - 1) / 2)) * aScalar;
for( int curLn = 0; curLn < lines.Count(); curLn++ )
{
msg = lines[curLn];
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
pos.y += titleHeight * aScalar;
}
}
// Decimal number
msg = aTb.GetComment1();
if( !msg.IsEmpty() )
{
sz = size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 119 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 60 )) * aScalar;
pos.y = (refy - Mm2mils( 47.5 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
// Developer
msg = aTb.GetComment2();
if( !msg.IsEmpty() )
{
sz = size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167.5 )) * aScalar;
pos.y = (refy - Mm2mils( 27.5 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
// Verifier
msg = aTb.GetComment3();
if( !msg.IsEmpty() )
{
sz = size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167 )) * aScalar;
pos.y = (refy - Mm2mils( 22.5 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
// Approver
msg = aTb.GetComment4();
if( !msg.IsEmpty() )
{
sz = size;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 22 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 167 )) * aScalar;
pos.y = (refy - Mm2mils( 2.5 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
}
else // other pages
{
for( WsItem = &WS_Osn2a_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
end.x = (refx - WsItem->m_Endx) * aScalar;
end.y = (refy - WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWosn, aClr1 );
break;
case WS_TONK:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWtonk, aClr1 );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
{
if( WsItem == &WS_Osn2a_Text1 )
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size0_8,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
else
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
break;
case WS_TEXTL:
if( !msg.IsEmpty() )
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
break;
}
}
// Sheet number
pos.x = (refx - Mm2mils( 5 )) * aScalar;
pos.y = (refy - Mm2mils( 4 )) * aScalar;
msg.Empty();
msg << aScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg,
TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false );
// Decimal number
msg = aTb.GetComment1();
if( !msg.IsEmpty() )
{
sz = size3;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 109 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 65 )) * aScalar;
pos.y = (refy - Mm2mils( 7.5 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
}
// Format
pos.x = (refx - Mm2mils( 23 )) * aScalar;
pos.y = (refy + Mm2mils( 2.5 )) * aScalar;
msg.Empty();
msg << aType;
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
// Center - left bottom corner
refx = aLT.x;
refy = aSz.y - aRB.y;
for( WsItem = &WS_DopLeft_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aScr > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
end.x = (refx - WsItem->m_Endx) * aScalar;
end.y = (refy - WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWosn, aClr1 );
break;
case WS_TEXT:
if( !msg.IsEmpty() )
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_VERT, size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
break;
}
}
if( aType == PAGE_INFO::A4 || aSz.x > aSz.y ) // A4 or Landscape
{
// Center - left top corner
refx = aLT.x;
refy = aLT.y;
for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aScr > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
break;
pos.x = (refx + WsItem->m_Posx) * aScalar;
pos.y = (refy + WsItem->m_Posy) * aScalar;
end.x = (refx + WsItem->m_Endx) * aScalar;
end.y = (refy + WsItem->m_Endy) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWosn, aClr1 );
break;
case WS_TONK:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWtonk, aClr1 );
break;
}
}
// Decimal number
msg = aTb.GetComment1();
if( !msg.IsEmpty() )
{
sz = size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx + Mm2mils( 35 )) * aScalar;
pos.y = (refy + Mm2mils( 7 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
}
else // Portrait
{
// Center - right top corner
// Lines are used from the upper left corner by the change of coordinates
refx = aSz.x - aRB.x;
refy = aLT.y;
for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aScr > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posy) * aScalar;
pos.y = (refy + WsItem->m_Posx) * aScalar;
end.x = (refx - WsItem->m_Endy) * aScalar;
end.y = (refy + WsItem->m_Endx) * aScalar;
msg = WsItem->m_Legende;
switch( WsItem->m_Type )
{
case WS_OSN:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWosn, aClr1 );
break;
case WS_TONK:
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y,
lnWtonk, aClr1 );
break;
}
}
// Decimal number
msg = aTb.GetComment1();
if( !msg.IsEmpty() )
{
sz = size2;
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar;
ln = Mm2mils( 69 );
if( lnMsg > ln )
sz.x *= float( ln ) / lnMsg;
pos.x = (refx - Mm2mils( 7 )) * aScalar;
pos.y = (refy + Mm2mils( 35 )) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_VERT, sz,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
}
#else
// Draw the border.
int ii, jj, ipas, gxpas, gypas;
for( ii = 0; ii < 2; ii++ )
{
GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * aScalar, yg * aScalar, aLnW, aClr1 );
refx += GRID_REF_W; refy += GRID_REF_W;
xg -= GRID_REF_W; yg -= GRID_REF_W;
}
// Upper left corner
refx = aLT.x;
refy = aLT.y;
// lower right corner
xg = aSz.x - aRB.x;
yg = aSz.y - aRB.y;
ipas = ( xg - refx ) / PAS_REF;
gxpas = ( xg - refx ) / ipas;
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
Line.Printf( wxT( "%d" ), jj );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, refy * aScalar,
ii * aScalar, ( refy + GRID_REF_W ) * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( refy + GRID_REF_W / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, yg * aScalar,
ii * aScalar, ( yg - GRID_REF_W ) * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( yg - GRID_REF_W / 2) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
ipas = ( yg - refy ) / PAS_REF;
gypas = ( yg - refy ) / ipas;
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
if( jj < 26 )
Line.Printf( wxT( "%c" ), jj + 'A' );
else // I hope 52 identifiers are enough...
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, refx * aScalar, ii * aScalar,
( refx + GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( refx + GRID_REF_W / 2 ) * aScalar,
( ii - gypas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, xg * aScalar, ii * aScalar,
( xg - GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( xg - GRID_REF_W / 2 ) * aScalar,
( ii - gxpas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
refx = aSz.x - aRB.x - GRID_REF_W;
refy = aSz.y - aRB.y - GRID_REF_W;
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTb.GetDate();
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, true );
break;
case WS_REV:
if( WsItem->m_Legende )
{
msg = WsItem->m_Legende;
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( std::min( size.x, size.y ) ), false, true );
pos.x += ReturnGraphicTextWidth( msg, size.x, false, false );
}
msg = aTb.GetRevision();
DrawGraphicText( m_canvas, aDC, pos, aClr2, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( std::min( size.x, size.y ) ), false, true );
break;
case WS_KICAD_VERSION:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
break;
case WS_SIZESHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aType;
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
break;
case WS_IDENTSHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << aScr << wxT( "/" ) << aNScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
break;
case WS_FILENAME:
{
wxFileName fn( aFlNm );
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << fn.GetFullName();
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
break;
case WS_FULLSHEETNAME:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += GetScreenDesc();
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
break;
case WS_COMPANY_NAME:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTb.GetCompany();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( std::min( size.x, size.y ) ),
false, true );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_TITLE:
if( WsItem->m_Legende )
{
msg = WsItem->m_Legende;
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( std::min( size.x, size.y ) ), false, true );
pos.x += ReturnGraphicTextWidth( msg, size.x, false, false );
}
msg = aTb.GetTitle();
DrawGraphicText( m_canvas, aDC, pos, aClr2, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( std::min( size.x, size.y ) ), false, true );
break;
case WS_COMMENT1:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTb.GetComment1();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_COMMENT2:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTb.GetComment2();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_COMMENT3:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTb.GetComment3();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_COMMENT4:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += aTb.GetComment4();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
case WS_UPPER_SEGMENT:
if( UpperLimit == 0 )
break;
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (refy - WsItem->m_Posy) * aScalar;
case WS_SEGMENT:
xg = aSz.x - GRID_REF_W - aRB.x - WsItem->m_Endx;
yg = aSz.y - GRID_REF_W - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
#endif
}
const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition ) const
{
const PAGE_INFO& pageInfo = GetPageSettings();
......@@ -1978,3 +191,72 @@ void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
aFormatter->Print( aNestLevel, ")\n\n" );
}
}
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aPageSize,
wxPoint& aLTmargin, wxPoint& aRBmargin,
wxString& aPaperFormat,
wxString& aFileName,
TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
{
GRSetDrawMode( aDC, GR_COPY );
WS_DRAW_ITEM_LIST drawList;
drawList.BuildWorkSheetGraphicList( aPageSize, aLTmargin, aRBmargin,
aPaperFormat, aFileName,
GetScreenDesc(),
aTitleBlock, aSheetCount, aSheetNumber,
aPenWidth, aScalar, aLineColor, aTextColor );
// Draw item list
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item;
item = drawList.GetNext() )
{
switch( item->GetType() )
{
case WS_DRAW_ITEM_BASE::wsg_line:
{
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
GRLine( m_canvas->GetClipBox(), aDC,
line->GetStart(), line->GetEnd(),
line->GetPenWidth(), line->GetColor() );
}
break;
case WS_DRAW_ITEM_BASE::wsg_rect:
{
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
GRRect( m_canvas->GetClipBox(), aDC,
rect->GetStart().x, rect->GetStart().y,
rect->GetEnd().x, rect->GetEnd().y,
rect->GetPenWidth(), rect->GetColor() );
}
break;
case WS_DRAW_ITEM_BASE::wsg_text:
{
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
DrawGraphicText( m_canvas, aDC, text->GetTextPosition(),
text->GetColor(),
text->GetText(),
text->GetOrientation(), text->GetSize(),
text->GetHorizJustify(), text->GetVertJustify(),
text->GetPenWidth(), text->IsItalic(), text->IsBold() );
}
break;
case WS_DRAW_ITEM_BASE::wsg_poly:
{
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
GRPoly( m_canvas->GetClipBox(), aDC,
poly->m_Corners.size(), &poly->m_Corners[0],
true, poly->GetPenWidth(),
poly->GetColor(), poly->GetColor() );
}
break;
}
}
}
/**
* @file worksheet_shape_builder.h
* @brief classes and function to generate graphics to plt or draw titles blocks
* and frame references
*/
#ifndef WORKSHEET_SHAPE_BUILDER_H
#define WORKSHEET_SHAPE_BUILDER_H
/*
* Helper classes to handle basic graphic items used to raw/plot
* title blocks and frame references
* segments
* rect
* polygons (for logos)
* graphic texts
*/
class WS_DRAW_ITEM_BASE // This basic class, not directly usable.
{
public:
enum WS_DRAW_TYPE {
wsg_line, wsg_rect, wsg_poly, wsg_text
};
protected:
WS_DRAW_TYPE m_type; // wsg_line, wsg_rect, wsg_poly, wsg_text
EDA_COLOR_T m_color;
protected:
WS_DRAW_ITEM_BASE( WS_DRAW_TYPE aType, EDA_COLOR_T aColor )
{
m_type = aType;
m_color = aColor;
}
public:
virtual ~WS_DRAW_ITEM_BASE() {}
// Accessors:
EDA_COLOR_T GetColor() { return m_color; }
WS_DRAW_TYPE GetType() { return m_type; };
};
// This class draws a thick segment
class WS_DRAW_ITEM_LINE : public WS_DRAW_ITEM_BASE
{
wxPoint m_start; // start point of line/rect
wxPoint m_end; // end point
int m_penWidth;
public:
WS_DRAW_ITEM_LINE( wxPoint aStart, wxPoint aEnd,
int aPenWidth, EDA_COLOR_T aColor ) :
WS_DRAW_ITEM_BASE( wsg_line, aColor )
{
m_start = aStart;
m_end = aEnd;
m_penWidth = aPenWidth;
}
// Accessors:
int GetPenWidth() { return m_penWidth; }
const wxPoint& GetStart() { return m_start; }
const wxPoint& GetEnd() { return m_end; }
};
// This class draws a polygon
class WS_DRAW_ITEM_POLYGON : public WS_DRAW_ITEM_BASE
{
int m_penWidth;
public:
std::vector <wxPoint> m_Corners;
public:
WS_DRAW_ITEM_POLYGON( wxPoint aStart, wxPoint aEnd,
int aPenWidth, EDA_COLOR_T aColor ) :
WS_DRAW_ITEM_BASE( wsg_poly, aColor )
{
m_penWidth = aPenWidth;
}
// Accessors:
int GetPenWidth() { return m_penWidth; }
};
// This class draws a not filled rectangle with thick segment
class WS_DRAW_ITEM_RECT : public WS_DRAW_ITEM_LINE
{
public:
WS_DRAW_ITEM_RECT( wxPoint aStart, wxPoint aEnd,
int aPenWidth, EDA_COLOR_T aColor ) :
WS_DRAW_ITEM_LINE( aStart, aEnd, aPenWidth, aColor )
{
m_type = wsg_rect;
}
};
// This class draws a graphic text.
// it is derived from an EDA_TEXT, so it handle all caracteristics
// of this graphic text (justification, rotation ... )
class WS_DRAW_ITEM_TEXT : public WS_DRAW_ITEM_BASE, public EDA_TEXT
{
public:
WS_DRAW_ITEM_TEXT( wxString& aText, wxPoint aPos, wxSize aSize,
int aPenWidth, EDA_COLOR_T aColor,
bool aItalic = false, bool aBold = false ) :
WS_DRAW_ITEM_BASE( wsg_text, aColor ), EDA_TEXT( aText )
{
SetTextPosition( aPos );
SetSize( aSize );
SetThickness( aPenWidth );
SetItalic( aItalic );
SetBold( aBold );
}
// Accessors:
int GetPenWidth() { return GetThickness(); }
};
/*
* this class stores the list of graphic items to draw/plot
* the title block and frame references
*/
class WS_DRAW_ITEM_LIST
{
std::vector <WS_DRAW_ITEM_BASE*> m_graphicList;
unsigned m_idx;
public:
WS_DRAW_ITEM_LIST()
{
m_idx = 0;
}
~WS_DRAW_ITEM_LIST()
{
for( unsigned ii = 0; ii < m_graphicList.size(); ii++ )
delete m_graphicList[ii];
}
void Append( WS_DRAW_ITEM_BASE* aItem )
{
m_graphicList.push_back( aItem );
}
WS_DRAW_ITEM_BASE* GetFirst()
{
m_idx = 0;
if( m_graphicList.size() )
return m_graphicList[0];
else
return NULL;
}
WS_DRAW_ITEM_BASE* GetNext()
{
m_idx++;
if( m_graphicList.size() > m_idx )
return m_graphicList[m_idx];
else
return NULL;
}
/**
* Function BuildWorkSheetGraphicList is a core function for
* drawing or plotting the page layout with
* the frame and the basic inscriptions.
* It fills the list of basic graphic items to draw or plot.
* currently lines, rect, polygons and texts
*
* @param aPageSize The size of the page layout.
* @param aLTmargin The left top margin of the page layout.
* @param aRBmargin The right bottom margin of the page layout.
* @param aPaperFormat The paper size type, for basic inscriptions.
* @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for basic inscriptions.
* @param aSheetCount The number of sheets (for basic inscriptions).
* @param aSheetNumber The sheet number (for basic inscriptions).
* @param aPenWidth The line width for drawing.
* @param aScalar Scalar to convert from mils to internal units.
* @param aLineColor The color for drawing.
* @param aTextColor The color for inscriptions.
*/
void BuildWorkSheetGraphicList( wxSize& aPageSize,
wxPoint& aLTmargin, wxPoint& aRBmargin,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor );
};
#endif // WORKSHEET_SHAPE_BUILDER_H
......@@ -60,6 +60,14 @@
#define TRACE_DESTRUCTOR 0
// the separator char between the subpart id and the reference
// 0 (no separator) or '.' or some other character
int LIB_COMPONENT::m_subpartIdSeparator = 0;
// the ascii char value to calculate the subpart symbol id from the part number:
// 'A' or '1' usually. (to print U1.A or U1.1)
// if this a a digit, a number is used as id symbol
int LIB_COMPONENT::m_subpartFirstId = 'A';
LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aRootComponent ):
EDA_ITEM( LIB_ALIAS_T )
......@@ -251,14 +259,18 @@ wxString LIB_COMPONENT::GetLibraryName()
}
wxString LIB_COMPONENT::ReturnSubReference( int aUnit )
wxString LIB_COMPONENT::ReturnSubReference( int aUnit, bool aAddSeparator )
{
wxString subRef;
#if defined(KICAD_GOST)
subRef.Printf( wxT(".%d" ), aUnit);
#else
subRef.Append( wxChar(aUnit + 'A' - 1) );
#endif
if( m_subpartIdSeparator != 0 && aAddSeparator )
subRef << wxChar( m_subpartIdSeparator );
if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
subRef << aUnit;
else
subRef << wxChar( m_subpartFirstId + aUnit - 1);
return subRef;
}
......
......@@ -187,6 +187,9 @@ extern int LibraryEntryCompare( const LIB_ALIAS* aItem1, const LIB_ALIAS* aItem2
*/
class LIB_COMPONENT : public EDA_ITEM
{
friend class CMP_LIBRARY;
friend class LIB_ALIAS;
wxString m_name;
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0
///< to draw the pin name above the pin.
......@@ -203,12 +206,15 @@ class LIB_COMPONENT : public EDA_ITEM
LIB_ALIASES m_aliases; ///< List of alias object pointers associated with the
///< component.
CMP_LIBRARY* m_library; ///< Library the component belongs to if any.
static int m_subpartIdSeparator; ///< the separator char between
///< the subpart id and the reference
///< like U1A ( m_subpartIdSeparator = 0 ) or U1.A or U1-A
static int m_subpartFirstId; ///< the ascii char value to calculate the subpart symbol id
///< from the part number: only 'A', 'a' or '1' can be used,
///< other values have no sense.
void deleteAllFields();
friend class CMP_LIBRARY;
friend class LIB_ALIAS;
public:
LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary = NULL );
LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary = NULL );
......@@ -645,9 +651,17 @@ public:
* @return the sub reference for component having multiple parts per package.
* The sub reference identify the part (or unit)
* @param aUnit = the part identifier ( 1 to max count)
* @param aAddSeparator = true (default) to prpebd the sub ref
* by the separator symbol (if any)
* Note: this is a static function.
*/
static wxString ReturnSubReference( int aUnit );
static wxString ReturnSubReference( int aUnit, bool aAddSeparator = true );
// Accessors to sub ref parameters
static int GetSubpartIdSeparator() { return m_subpartIdSeparator; }
static void SetSubpartIdSeparator( int aSep ) { m_subpartIdSeparator = aSep; }
static int GetSubpartFirstId() { return m_subpartFirstId; }
static void SetSubpartFirstId( int aFirstId ) { m_subpartFirstId = aFirstId; }
/**
* Set or clear the alternate body style (DeMorgan) for the component.
......
......@@ -38,6 +38,8 @@
#include <eda_text.h>
#include <general.h>
#include <class_libentry.h>
#include <sch_junction.h>
#include <protos.h>
#include <hotkeys.h>
#include <dialogs/dialog_color_config.h>
......@@ -117,10 +119,25 @@ bool EDA_APP::OnInit()
}
// Give a default colour for all layers
// (actual color will beinitialized by config)
// (actual color will be initialized by config)
for( int ii = 0; ii < NB_SCH_LAYERS; ii++ )
SetLayerColor( DARKGRAY, ii );
#ifdef KICAD_GOST
// These options will be user configurable in the future,
// and not specific to GOST users
// the separator char between the subpart id and the reference
// 0 (no separator) or '.' or some other character
LIB_COMPONENT::SetSubpartIdSeparator( '.' );
// the ascii char value to calculate the subpart symbol id from the part number:
// 'A' or '1' usually. (to print U1.A or U1.1)
// if this is a digit, a number is used as id symbol
LIB_COMPONENT::SetSubpartFirstId( '1' );
// Default diameter of the junction symbol
SCH_JUNCTION::SetSymbolSize( 32 );
#endif
// read current setup and reopen last directory if no filename to open in
// command line
bool reopenLastUsedDirectory = argc == 1;
......
......@@ -36,7 +36,6 @@
#include <general.h>
#include <libeditframe.h>
#include <eeschema_config.h>
#include <worksheet.h>
#include <hotkeys.h>
#include <sch_sheet.h>
......
......@@ -186,14 +186,14 @@ const wxChar* MsgPinElectricType[] =
LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) :
LIB_ITEM( LIB_PIN_T, aParent )
{
m_length = 300; /* default Pin len */
m_orientation = PIN_RIGHT; /* Pin orient: Up, Down, Left, Right */
m_shape = NONE; /* Pin shape, bitwise. */
m_type = PIN_UNSPECIFIED; /* electrical type of pin */
m_attributes = 0; /* bit 0 != 0: pin invisible */
m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */
m_numTextSize = 50;
m_nameTextSize = 50; /* Default size for pin name and num */
m_length = DEFAULT_PIN_LENGTH; // default Pin len
m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
m_shape = NONE; // Pin shape, bitwise.
m_type = PIN_UNSPECIFIED; // electrical type of pin
m_attributes = 0; // bit 0 != 0: pin invisible
m_number = 0; // pin number (i.e. 4 ASCII chars)
m_numTextSize = DEFAULT_TEXT_SIZE;
m_nameTextSize = DEFAULT_TEXT_SIZE; // Default size for pin name and num
m_width = 0;
m_typeName = _( "Pin" );
}
......
......@@ -32,18 +32,14 @@
#include <lib_draw_item.h>
#define TARGET_PIN_RADIUS 12 /* Circle diameter drawn at the active end of pins */
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */
#if defined(KICAD_GOST)
#define INVERT_PIN_RADIUS 30 /* Radius of inverted pin circle. */
#else
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */
#endif
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */
#define NONLOGIC_PIN_DIM 30 /* Dim of nonlogic pin symbol (X). */
#define TARGET_PIN_RADIUS 12 // Circle diameter drawn at the active end of pins
#define DEFAULT_PIN_LENGTH 300 // Default Length of a pin when it is created.
// pins: special symbols sizes
#define INVERT_PIN_RADIUS 30 // Radius of inverted pin circle.
#define CLOCK_PIN_DIM 40 // Dim of clock pin symbol.
#define IEEE_SYMBOL_PIN_DIM 40 // Dim of special pin symbol.
#define NONLOGIC_PIN_DIM 30 // Dim of nonlogic pin symbol (X).
/**
* The component library pin object electrical types used in ERC tests.
......
......@@ -468,12 +468,8 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
{
for( int i = 0; i < m_component->GetPartCount(); i++ )
{
wxString msg;
#if defined(KICAD_GOST)
msg.Printf( _( "Part %d" ), i + 1 );
#else
msg.Printf( _( "Part %c" ), 'A' + i );
#endif
wxString msg = LIB_COMPONENT::ReturnSubReference( i+1, false );
msg.Printf( _( "Part %s" ), GetChars( msg ) );
m_partSelectBox->Append( msg );
}
}
......
......@@ -59,9 +59,9 @@ static wxPoint PinPreviousPos;
static int LastPinType = PIN_INPUT;
static int LastPinOrient = PIN_RIGHT;
static int LastPinShape = NONE;
static int LastPinLength = 300;
static int LastPinNameSize = 50;
static int LastPinNumSize = 50;
static int LastPinLength = DEFAULT_PIN_LENGTH;
static int LastPinNameSize = DEFAULT_TEXT_SIZE;
static int LastPinNumSize = DEFAULT_TEXT_SIZE;
static bool LastPinCommonConvert = false;
static bool LastPinCommonUnit = false;
static bool LastPinVisible = true;
......
......@@ -27,7 +27,6 @@
#include <fctsys.h>
#include <plot_common.h>
#include <worksheet.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <sch_sheet_path.h>
......
......@@ -27,7 +27,6 @@
#include <fctsys.h>
#include <plot_common.h>
#include <worksheet.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <base_units.h>
......
......@@ -26,7 +26,6 @@
*/
#include <fctsys.h>
#include <worksheet.h>
#include <plot_common.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
......
......@@ -70,15 +70,6 @@ std::string toUTFTildaText( const wxString& txt )
{
if( (unsigned char) *it <= ' ' )
*it = '~';
/*
#if defined(KICAD_GOST)
if( *it == ' ' )
#else
if( (unsigned char) *it <= ' ' )
#endif
*it = '~';
*/
}
return ret;
}
......
......@@ -35,24 +35,16 @@
#include <richio.h>
#include <plot_common.h>
#include <general.h>
#include <protos.h>
#include <sch_junction.h>
#include <class_netlist_object.h>
int SCH_JUNCTION::m_symbolSize = 50; // Default diameter of the junction symbol
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_JUNCTION_T )
{
#if defined(KICAD_GOST)
#define DRAWJUNCTION_DIAMETER 50 /* Diameter of junction symbol between wires by GOST*/
#else
#define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */
#endif
m_pos = pos;
m_Layer = LAYER_JUNCTION;
m_size.x = m_size.y = DRAWJUNCTION_DIAMETER;
#undef DRAWJUNCTION_DIAMETER
}
......@@ -82,7 +74,6 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
SCH_JUNCTION* item = (SCH_JUNCTION*) aItem;
EXCHG( m_pos, item->m_pos );
EXCHG( m_size, item->m_size );
}
......@@ -111,7 +102,7 @@ EDA_RECT SCH_JUNCTION::GetBoundingBox() const
EDA_RECT rect;
rect.SetOrigin( m_pos );
rect.Inflate( ( GetPenSize() + m_size.x ) / 2 );
rect.Inflate( ( GetPenSize() + GetSymbolSize() ) / 2 );
return rect;
}
......@@ -130,7 +121,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
GRSetDrawMode( aDC, aDrawMode );
GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
( m_size.x / 2 ), 0, color, color );
( GetSymbolSize() / 2 ), 0, color, color );
}
......@@ -243,5 +234,5 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
{
aPlotter->SetColor( GetLayerColor( GetLayer() ) );
aPlotter->Circle( m_pos, m_size.x, FILLED_SHAPE );
aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE );
}
......@@ -32,11 +32,10 @@
#include <sch_item_struct.h>
class SCH_JUNCTION : public SCH_ITEM
{
wxPoint m_pos; /* XY coordinates of connection. */
wxSize m_size;
wxPoint m_pos; // Position of the junction.
static int m_symbolSize; // diameter of the junction graphic symbol
public:
SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
......@@ -50,6 +49,9 @@ public:
return wxT( "SCH_JUNCTION" );
}
static int GetSymbolSize() { return m_symbolSize; }
static void SetSymbolSize( int aSize ) { m_symbolSize = aSize; }
void SwapData( SCH_ITEM* aItem );
EDA_RECT GetBoundingBox() const;
......
......@@ -516,29 +516,35 @@ double SCH_EDIT_FRAME::BestZoom()
}
/* Build a filename that can be used in plot and print functions
* for the current sheet path.
* This filename is unique and must be used instead of the screen filename
* when one must creates file for each sheet in the hierarchy,
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than once
*/
wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
{
wxFileName fn = GetScreen()->GetFileName();
#ifndef KICAD_GOST
wxString filename = fn.GetName();
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 )
#else
/* Name is <root sheet filename>-<sheet path> and has no extension.
* However if filename is too long name is <sheet filename>-<sheet number>
*/
#define FN_LEN_MAX 100 // A reasonnable value for the full file name len
fn.ClearExt();
wxString filename = fn.GetFullPath();
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 80 )
#endif
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < FN_LEN_MAX )
{
filename += m_CurrentSheet->PathHumanReadable();
filename.Replace( wxT( "/" ), wxT( "-" ) );
filename.RemoveLast();
#if defined(KICAD_GOST)
// To avoid issues on unix, ensure the filename does not start
// by '-', which has a special meaning in command lines
#ifndef __WINDOWS__
wxString newfn;
if( filename.StartsWith( wxT( "-" ), &newfn ) )
filename = newfn;
#endif
#endif
}
else
......
......@@ -71,6 +71,7 @@ set(GERBVIEW_SRCS
set(GERBVIEW_EXTRA_SRCS
../common/base_screen.cpp
../common/base_units.cpp
../common/eda_text.cpp
../common/class_layer_box_selector.cpp
../common/class_page_info.cpp
../pcbnew/layer_widget.cpp
......
......@@ -7,51 +7,6 @@
#ifndef WORKSHEET_H_
#define WORKSHEET_H_
#include <common.h> // Mm2mils()
#define GRID_REF_W 70 // height of the band reference grid
#if defined(KICAD_GOST)
#define SIZETEXT 100 // worksheet text size
#else
#define SIZETEXT 60 // worksheet text size
#endif
#define SIZETEXT_REF 50 // worksheet frame reference text size
#define PAS_REF 2000 // no reference markings on worksheet frame
#if !defined(KICAD_GOST)
// The coordinates below are relative to the bottom right corner of page and
// will be subtracted from this origin.
#define BLOCK_OX 4200
#define BLOCK_KICAD_VERSION_X BLOCK_OX - SIZETEXT
#define BLOCK_KICAD_VERSION_Y SIZETEXT
#define BLOCK_REV_X 820
#define BLOCK_REV_Y (SIZETEXT * 3)
#define BLOCK_DATE_X BLOCK_OX - (SIZETEXT * 15)
#define BLOCK_DATE_Y (SIZETEXT * 3)
#define BLOCK_ID_SHEET_X 820
#define BLOCK_ID_SHEET_Y SIZETEXT
#define BLOCK_SIZE_SHEET_X BLOCK_OX - SIZETEXT
#define BLOCK_SIZE_SHEET_Y (SIZETEXT * 3)
#define BLOCK_TITLE_X BLOCK_OX - SIZETEXT
#define BLOCK_TITLE_Y (SIZETEXT * 5)
#define BLOCK_FULLSHEETNAME_X BLOCK_OX - SIZETEXT
#define BLOCK_FULLSHEETNAME_Y (SIZETEXT * 7)
#define BLOCK_FILENAME_X BLOCK_OX - SIZETEXT
#define BLOCK_FILENAME_Y (SIZETEXT * 9)
#define BLOCK_COMMENT_X BLOCK_OX - SIZETEXT
#define BLOCK_COMPANY_Y (SIZETEXT * 11)
#define BLOCK_COMMENT1_Y (SIZETEXT * 13)
#define BLOCK_COMMENT2_Y (SIZETEXT * 15)
#define BLOCK_COMMENT3_Y (SIZETEXT * 17)
#define BLOCK_COMMENT4_Y (SIZETEXT * 19)
#endif
#define VARIABLE_BLOCK_START_POSITION (SIZETEXT * 10)
struct Ki_WorkSheetData
{
public:
......@@ -63,156 +18,4 @@ public:
const wxChar* m_Text;
};
/// Work sheet structure type definitions.
enum TypeKi_WorkSheetData {
#if defined(KICAD_GOST)
WS_OSN,
WS_TONK,
WS_TEXT,
WS_TEXTL
#else
WS_DATE,
WS_REV,
WS_KICAD_VERSION,
WS_SIZESHEET,
WS_IDENTSHEET,
WS_TITLE,
WS_FILENAME,
WS_FULLSHEETNAME,
WS_COMPANY_NAME,
WS_COMMENT1,
WS_COMMENT2,
WS_COMMENT3,
WS_COMMENT4,
WS_SEGMENT,
WS_UPPER_SEGMENT,
WS_LEFT_SEGMENT,
WS_CADRE
#endif
};
#if defined(KICAD_GOST)
extern Ki_WorkSheetData WS_Osn1_Line1;
extern Ki_WorkSheetData WS_Osn1_Line2;
extern Ki_WorkSheetData WS_Osn1_Line3;
extern Ki_WorkSheetData WS_Osn1_Line4;
extern Ki_WorkSheetData WS_Osn1_Line5;
extern Ki_WorkSheetData WS_Osn1_Line6;
extern Ki_WorkSheetData WS_Osn1_Line7;
extern Ki_WorkSheetData WS_Osn1_Line8;
extern Ki_WorkSheetData WS_Osn1_Line9;
extern Ki_WorkSheetData WS_Osn1_Line10;
extern Ki_WorkSheetData WS_Osn1_Line11;
extern Ki_WorkSheetData WS_Osn1_Line12;
extern Ki_WorkSheetData WS_Osn1_Line13;
extern Ki_WorkSheetData WS_Osn1_Line14;
extern Ki_WorkSheetData WS_Osn1_Line15;
extern Ki_WorkSheetData WS_Osn1_Line16;
extern Ki_WorkSheetData WS_Osn1_Line17;
extern Ki_WorkSheetData WS_Osn1_Line18;
extern Ki_WorkSheetData WS_Osn1_Line19;
extern Ki_WorkSheetData WS_Osn1_Line20;
extern Ki_WorkSheetData WS_Osn1_Line21;
extern Ki_WorkSheetData WS_Osn1_Line22;
extern Ki_WorkSheetData WS_Osn1_Line23;
extern Ki_WorkSheetData WS_Osn1_Line24;
extern Ki_WorkSheetData WS_Osn1_Line25;
extern Ki_WorkSheetData WS_Osn1_Line26;
extern Ki_WorkSheetData WS_Osn1_Line27;
extern Ki_WorkSheetData WS_Osn1_Text1;
extern Ki_WorkSheetData WS_Osn1_Text2;
extern Ki_WorkSheetData WS_Osn1_Text3;
extern Ki_WorkSheetData WS_Osn1_Text4;
extern Ki_WorkSheetData WS_Osn1_Text5;
extern Ki_WorkSheetData WS_Osn1_Text6;
extern Ki_WorkSheetData WS_Osn1_Text7;
extern Ki_WorkSheetData WS_Osn1_Text8;
extern Ki_WorkSheetData WS_Osn1_Text9;
extern Ki_WorkSheetData WS_Osn1_Text10;
extern Ki_WorkSheetData WS_Osn1_Text11;
extern Ki_WorkSheetData WS_Osn1_Text12;
extern Ki_WorkSheetData WS_Osn1_Text13;
extern Ki_WorkSheetData WS_Osn1_Text14;
extern Ki_WorkSheetData WS_Osn1_Text15;
extern Ki_WorkSheetData WS_Osn1_Text16;
extern Ki_WorkSheetData WS_Osn1_Text17;
extern Ki_WorkSheetData WS_Osn2a_Line1;
extern Ki_WorkSheetData WS_Osn2a_Line2;
extern Ki_WorkSheetData WS_Osn2a_Line3;
extern Ki_WorkSheetData WS_Osn2a_Line4;
extern Ki_WorkSheetData WS_Osn2a_Line5;
extern Ki_WorkSheetData WS_Osn2a_Line6;
extern Ki_WorkSheetData WS_Osn2a_Line7;
extern Ki_WorkSheetData WS_Osn2a_Line8;
extern Ki_WorkSheetData WS_Osn2a_Line9;
extern Ki_WorkSheetData WS_Osn2a_Line10;
extern Ki_WorkSheetData WS_Osn2a_Line11;
extern Ki_WorkSheetData WS_Osn2a_Text1;
extern Ki_WorkSheetData WS_Osn2a_Text2;
extern Ki_WorkSheetData WS_Osn2a_Text3;
extern Ki_WorkSheetData WS_Osn2a_Text4;
extern Ki_WorkSheetData WS_Osn2a_Text5;
extern Ki_WorkSheetData WS_Osn2a_Text6;
extern Ki_WorkSheetData WS_Osn2a_Text7;
extern Ki_WorkSheetData WS_Osn2a_Text8;
extern Ki_WorkSheetData WS_DopLeft_Line1;
extern Ki_WorkSheetData WS_DopLeft_Line2;
extern Ki_WorkSheetData WS_DopLeft_Line3;
extern Ki_WorkSheetData WS_DopLeft_Line4;
extern Ki_WorkSheetData WS_DopLeft_Line5;
extern Ki_WorkSheetData WS_DopLeft_Line6;
extern Ki_WorkSheetData WS_DopLeft_Line7;
extern Ki_WorkSheetData WS_DopLeft_Line8;
extern Ki_WorkSheetData WS_DopLeft_Line9;
extern Ki_WorkSheetData WS_DopLeft_Line10;
extern Ki_WorkSheetData WS_DopLeft_Line11;
extern Ki_WorkSheetData WS_DopLeft_Line12;
extern Ki_WorkSheetData WS_DopLeft_Line13;
extern Ki_WorkSheetData WS_DopLeft_Line14;
extern Ki_WorkSheetData WS_DopLeft_Text1;
extern Ki_WorkSheetData WS_DopLeft_Text2;
extern Ki_WorkSheetData WS_DopLeft_Text3;
extern Ki_WorkSheetData WS_DopLeft_Text4;
extern Ki_WorkSheetData WS_DopLeft_Text5;
extern Ki_WorkSheetData WS_DopLeft_Text6;
extern Ki_WorkSheetData WS_DopLeft_Text7;
extern Ki_WorkSheetData WS_DopTop_Line1;
extern Ki_WorkSheetData WS_DopTop_Line2;
extern Ki_WorkSheetData WS_DopTop_Line3;
extern Ki_WorkSheetData WS_DopTop_Line4;
extern Ki_WorkSheetData WS_DopTop_Line5;
extern Ki_WorkSheetData WS_DopTop_Line6;
#else
extern Ki_WorkSheetData WS_Date;
extern Ki_WorkSheetData WS_Revision;
extern Ki_WorkSheetData WS_Licence;
extern Ki_WorkSheetData WS_SizeSheet;
extern Ki_WorkSheetData WS_IdentSheet;
extern Ki_WorkSheetData WS_FullSheetName;
extern Ki_WorkSheetData WS_SheetFilename;
extern Ki_WorkSheetData WS_Title;
extern Ki_WorkSheetData WS_Company;
extern Ki_WorkSheetData WS_Comment1;
extern Ki_WorkSheetData WS_Comment2;
extern Ki_WorkSheetData WS_Comment3;
extern Ki_WorkSheetData WS_Comment4;
extern Ki_WorkSheetData WS_SeparatorLine;
extern Ki_WorkSheetData WS_MostLeftLine;
extern Ki_WorkSheetData WS_MostUpperLine;
extern Ki_WorkSheetData WS_Segm3;
extern Ki_WorkSheetData WS_Segm4;
extern Ki_WorkSheetData WS_Segm5;
extern Ki_WorkSheetData WS_Segm6;
extern Ki_WorkSheetData WS_Segm7;
#endif
#endif // WORKSHEET_H_
......@@ -703,23 +703,26 @@ public:
* Function TraceWorkSheet is a core function for drawing of the page layout with
* the frame and the basic inscriptions.
* @param aDC The device context.
* @param aSz The size of the page layout.
* @param aLT The left top margin of the page layout.
* @param aRB The right bottom margin of the page layout.
* @param aType The paper size type (for basic inscriptions).
* @param aFlNm The file name (for basic inscriptions).
* @param aTb The block of titles (for basic inscriptions).
* @param aNScr The number of screens (for basic inscriptions).
* @param aScr The screen number (for basic inscriptions).
* @param aLnW The line width for drawing.
* @param aPageSize The size of the page layout.
* @param aLTmargin The left top margin of the page layout.
* @param aRBmargin The right bottom margin of the page layout.
* @param aPaperFormat The paper size type, for basic inscriptions.
* @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for basic inscriptions.
* @param aSheetCount The number of sheets (for basic inscriptions).
* @param aSheetNumber The sheet number (for basic inscriptions).
* @param aPenWidth The line width for drawing.
* @param aScalar Scalar to convert from mils to internal units.
* @param aClr1 The color for drawing.
* @param aClr2 The colr for inscriptions.
*/
void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED );
* @param aLineColor The color for drawing.
* @param aTextColor The color for inscriptions.
*/
void TraceWorkSheet( wxDC* aDC, wxSize& aPageSize,
wxPoint& aLTmargin, wxPoint& aRBmargin,
wxString& aPaperFormat, wxString& aFileName,
TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor = RED, EDA_COLOR_T aTextColor = RED );
/**
* Function GetXYSheetReferences
......
......@@ -61,7 +61,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
BOARD::BOARD() :
BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ),
m_NetInfo( this ),
m_paper( IsGOST() ? PAGE_INFO::A4 : PAGE_INFO::A3, IsGOST() ),
m_paper( PAGE_INFO::A4, IsGOST() ),
m_NetClasses( this )
{
// we have not loaded a board yet, assume latest until then.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment