Commit 7080828f authored by jean-pierre charras's avatar jean-pierre charras

More about worksheet code.

parent 26f2c04f
......@@ -26,6 +26,12 @@ set(COMMON_ABOUT_DLG_SRCS
dialogs/dialog_page_settings_base.cpp
)
if(KICAD_GOST)
set( TITLE_BLOCK_SHAPES title_block_shapes_gost )
else()
set( TITLE_BLOCK_SHAPES title_block_shapes )
endif()
set(COMMON_SRCS
${COMMON_ABOUT_DLG_SRCS}
base_struct.cpp
......@@ -76,6 +82,7 @@ set(COMMON_SRCS
richio.cpp
selcolor.cpp
string.cpp
${TITLE_BLOCK_SHAPES}.cpp
trigo.cpp
wildcards_and_files_ext.cpp
worksheet.cpp
......
......@@ -90,17 +90,16 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH );
WS_DRAW_ITEM_LIST drawList;
// Initialize plot parameters
// Prepare plot parameters
drawList.SetMargins( LTmargin, RBmargin);
drawList.SetPenSize(PLOTTER::DEFAULT_LINE_WIDTH );
drawList.SetMilsToIUfactor( iusPerMil );
drawList.SetPageSize( pageSize );
drawList.SetSheetNumber( aSheetNumber );
drawList.SetSheetCount( aNumberOfSheets );
drawList.BuildWorkSheetGraphicList(
aPageInfo.GetType(), aFilename,
aSheetDesc,
aTitleBlock, aNumberOfSheets, aSheetNumber,
plotColor, plotColor );
drawList.BuildWorkSheetGraphicList( aPageInfo.GetType(), aFilename,
aSheetDesc, aTitleBlock, plotColor, plotColor );
// Draw item list
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item;
......
/**
* @file title_block_shape.h
* @file title_block_shape.cpp
* @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
* This file creates a lot of structures which define the shape of a title block
* and frame references
*/
......@@ -35,22 +33,29 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <drawtxt.h>
#include <appl_wxstruct.h>
#include <worksheet.h>
#include <class_title_block.h>
#include <build_version.h>
#include <worksheet_shape_builder.h>
#define GRID_REF_W 70 // height of the band reference grid
#define TEXTSIZE 60 // worksheet text size
#define FRMREF_TXTSIZE 50 // worksheet frame reference text size
#define GRID_REF_W Mm2mils( 1.8 ) // height of the band reference grid
#define TEXTSIZE Mm2mils( 1.5 ) // worksheet text size
#define FRMREF_TXTSIZE Mm2mils( 1.3 ) // worksheet frame reference text size
#define VARIABLE_BLOCK_START_POSITION (TEXTSIZE * 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_OX Mm2mils( 106 )
#define BLOCK_KICAD_VERSION_X BLOCK_OX - TEXTSIZE
#define BLOCK_KICAD_VERSION_Y TEXTSIZE
#define BLOCK_REV_X 820
#define BLOCK_REV_X Mm2mils( 22 )
#define BLOCK_REV_Y (TEXTSIZE * 3)
#define BLOCK_DATE_X BLOCK_OX - (TEXTSIZE * 15)
#define BLOCK_DATE_Y (TEXTSIZE * 3)
#define BLOCK_ID_SHEET_X 820
#define BLOCK_ID_SHEET_X Mm2mils( 22 )
#define BLOCK_ID_SHEET_Y TEXTSIZE
#define BLOCK_SIZE_SHEET_X BLOCK_OX - TEXTSIZE
#define BLOCK_SIZE_SHEET_Y (TEXTSIZE * 3)
......@@ -67,25 +72,40 @@
#define BLOCK_COMMENT3_Y (TEXTSIZE * 17)
#define BLOCK_COMMENT4_Y (TEXTSIZE * 19)
/*
* Basic texts in Ki_WorkSheetData struct use format "C" type to
* identify the user text which should be shown, at runtime.
* Currently formats are % and a letter , or 2 letters
*
* %% = replaced by %
* %K = Kicad version
* %Z = paper format name (A4, USLetter)
* %N = company name
* %D = date
* %R = revision
* %S = sheet number
* %N = number of sheets
* %Cx = comment (x = 0 to 9 to identify the comment)
* %F = filename
* %P = sheet path or sheet full name
* %T = title
* Other fields like Developer, Verifier, Approver could use %Cx
* and are seen as comments for format
*/
// Text attributes set in m_Flags (ORed bits)
#define USE_BOLD 1 // has meaning for texts
#define USE_THICK_LINE 1 // equivalent to bold for lines
#define USE_ITALIC 2 // has meaning for texts
#define USE_TEXT_COLOR 4
#define SET_UPPER_LIMIT 8 // Flag used to calculate variable position items
// 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_TEXT,
WS_SEGMENT,
WS_UPPER_SEGMENT,
WS_LEFT_SEGMENT,
WS_CADRE
WS_LEFT_SEGMENT
};
......@@ -97,7 +117,7 @@ Ki_WorkSheetData WS_MostUpperLine =
NULL,
BLOCK_OX, TEXTSIZE * 16,
0, TEXTSIZE * 16,
NULL, NULL
NULL
};
// Left vertical segment: should be after comments
......@@ -108,7 +128,7 @@ Ki_WorkSheetData WS_MostLeftLine =
&WS_MostUpperLine,
BLOCK_OX, TEXTSIZE * 16,
BLOCK_OX, 0,
NULL, NULL
NULL
};
// horizontal segment between filename and comments
......@@ -118,126 +138,133 @@ Ki_WorkSheetData WS_SeparatorLine =
&WS_MostLeftLine,
BLOCK_OX, VARIABLE_BLOCK_START_POSITION,
0, VARIABLE_BLOCK_START_POSITION,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Date =
{
WS_DATE,
WS_TEXT,
&WS_SeparatorLine,
BLOCK_DATE_X, BLOCK_DATE_Y,
0, 0,
wxT( "Date: " ),NULL
wxT( "Date: %D" )
};
Ki_WorkSheetData WS_Licence =
{
WS_KICAD_VERSION,
WS_TEXT,
&WS_Date,
BLOCK_KICAD_VERSION_X,BLOCK_KICAD_VERSION_Y,
0,
0,
NULL, NULL
wxT("%K") // Kicad version
};
Ki_WorkSheetData WS_Revision =
{
WS_REV,
WS_TEXT,
&WS_Licence,
BLOCK_REV_X, BLOCK_REV_Y,
0, 0,
wxT( "Rev: " ),NULL
wxT( "Rev: %R" ),
USE_BOLD
};
Ki_WorkSheetData WS_SizeSheet =
{
WS_SIZESHEET,
WS_TEXT,
&WS_Revision,
BLOCK_SIZE_SHEET_X,BLOCK_SIZE_SHEET_Y,
0, 0,
wxT( "Size: " ), NULL
wxT( "Size: %Z" ) // Paper format name
};
Ki_WorkSheetData WS_IdentSheet =
{
WS_IDENTSHEET,
WS_TEXT,
&WS_SizeSheet,
BLOCK_ID_SHEET_X,BLOCK_ID_SHEET_Y,
0, 0,
wxT( "Id: " ), NULL
wxT( "Id: %S/%N" )
};
Ki_WorkSheetData WS_Title =
{
WS_TITLE,
WS_TEXT,
&WS_IdentSheet,
BLOCK_TITLE_X, BLOCK_TITLE_Y,
0, 0,
wxT( "Title: " ), NULL
wxT( "Title: %T" ),
USE_BOLD
};
Ki_WorkSheetData WS_SheetFilename =
{
WS_FILENAME,
WS_TEXT,
&WS_Title,
BLOCK_FILENAME_X, BLOCK_FILENAME_Y,
0, 0,
wxT( "File: " ), NULL
wxT( "File: %F" )
};
Ki_WorkSheetData WS_FullSheetName =
{
WS_FULLSHEETNAME,
WS_TEXT,
&WS_SheetFilename,
BLOCK_FULLSHEETNAME_X,BLOCK_FULLSHEETNAME_Y,
0,
0,
wxT( "Sheet: " ), NULL
wxT( "Sheet: %P" ) // Full sheet name (sheet path)
};
Ki_WorkSheetData WS_Company =
{
WS_COMPANY_NAME,
WS_TEXT,
&WS_FullSheetName,
BLOCK_COMMENT_X,BLOCK_COMPANY_Y,
0, 0,
NULL, NULL
wxT("%N"), // Company name
USE_BOLD | SET_UPPER_LIMIT | USE_TEXT_COLOR
};
Ki_WorkSheetData WS_Comment1 =
{
WS_COMMENT1,
WS_TEXT,
&WS_Company,
BLOCK_COMMENT_X,BLOCK_COMMENT1_Y,
0, 0,
NULL, NULL
wxT("%C1"), // Comment 1
SET_UPPER_LIMIT | USE_TEXT_COLOR
};
Ki_WorkSheetData WS_Comment2 =
{
WS_COMMENT2,
WS_TEXT,
&WS_Comment1,
BLOCK_COMMENT_X,BLOCK_COMMENT2_Y,
0, 0,
NULL, NULL
wxT("%C2"), // Comment 2
SET_UPPER_LIMIT | USE_TEXT_COLOR
};
Ki_WorkSheetData WS_Comment3 =
{
WS_COMMENT3,
WS_TEXT,
&WS_Comment2,
BLOCK_COMMENT_X,BLOCK_COMMENT3_Y,
0, 0,
NULL, NULL
wxT("%C3"), // Comment 3
SET_UPPER_LIMIT | USE_TEXT_COLOR
};
Ki_WorkSheetData WS_Comment4 =
{
WS_COMMENT4,
WS_TEXT,
&WS_Comment3,
BLOCK_COMMENT_X, BLOCK_COMMENT4_Y,
0, 0,
NULL, NULL
wxT("%C4"), // Comment 4
SET_UPPER_LIMIT | USE_TEXT_COLOR
};
......@@ -248,7 +275,7 @@ Ki_WorkSheetData WS_Segm3 =
&WS_Comment4,
BLOCK_OX, TEXTSIZE * 6,
0, TEXTSIZE * 6,
NULL, NULL
NULL
};
......@@ -259,7 +286,7 @@ Ki_WorkSheetData WS_Segm4 =
&WS_Segm3,
BLOCK_REV_X + TEXTSIZE,TEXTSIZE * 4,
BLOCK_REV_X + TEXTSIZE, 0,
NULL, NULL
NULL
};
......@@ -269,7 +296,7 @@ Ki_WorkSheetData WS_Segm5 =
&WS_Segm4,
BLOCK_OX, TEXTSIZE * 2,
0, TEXTSIZE * 2,
NULL, NULL
NULL
};
......@@ -279,7 +306,7 @@ Ki_WorkSheetData WS_Segm6 =
&WS_Segm5,
BLOCK_OX, TEXTSIZE * 4,
0, TEXTSIZE * 4,
NULL, NULL
NULL
};
......@@ -289,13 +316,14 @@ Ki_WorkSheetData WS_Segm7 =
&WS_Segm6,
BLOCK_OX - (TEXTSIZE * 11),TEXTSIZE * 4,
BLOCK_OX - (TEXTSIZE * 11),TEXTSIZE * 2,
NULL, NULL
NULL
};
#include <worksheet_shape_builder.h>
// Helper function which returns the text corresponding to the aIdent identifier
static wxString FindUserText( int aIdent, const TITLE_BLOCK& aTitleBlock,
static wxString BuildFullText( const wxString& aTextbase,
const TITLE_BLOCK& aTitleBlock,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
......@@ -307,277 +335,292 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
{
wxPoint pos;
wxSize textsize( TEXTSIZE * m_milsToIu, TEXTSIZE * m_milsToIu );
wxSize size_ref( FRMREF_TXTSIZE * m_milsToIu,
FRMREF_TXTSIZE * m_milsToIu );
wxString msg;
// Upper left corner
int refx = m_LTmargin.x;
int refy = m_LTmargin.y;
// Left top corner position
wxPoint lt_corner;
lt_corner.x = m_LTmargin.x;
lt_corner.y = m_LTmargin.y;
// lower right corner
wxPoint currpos;
currpos.x = m_pageSize.x - m_RBmargin.x;
currpos.y = m_pageSize.y - m_RBmargin.y;
// Right bottom corner position
wxPoint rb_corner;
rb_corner.x = m_pageSize.x - m_RBmargin.x;
rb_corner.y = m_pageSize.y - m_RBmargin.y;
// Draw the border.
int ii, jj, ipas, gxpas, gypas;
wxPoint pos = lt_corner;
wxPoint end = rb_corner;
for( ii = 0; ii < 2; ii++ )
{
Append( new WS_DRAW_ITEM_RECT(
wxPoint( refx * m_milsToIu, refy * m_milsToIu ),
wxPoint( currpos.x * m_milsToIu, currpos.y * m_milsToIu ),
wxPoint( pos.x * m_milsToIu, pos.y * m_milsToIu ),
wxPoint( end.x * m_milsToIu, end.y * m_milsToIu ),
m_penSize, aLineColor ) );
refx += GRID_REF_W;
refy += GRID_REF_W;
currpos.x -= GRID_REF_W;
currpos.y -= GRID_REF_W;
pos.x += GRID_REF_W;
pos.y += GRID_REF_W;
end.x -= GRID_REF_W;
end.y -= GRID_REF_W;
}
// Upper left corner
refx = m_LTmargin.x;
refy = m_LTmargin.y;
ipas = ( rb_corner.x - lt_corner.x ) / PAS_REF;
gxpas = ( rb_corner.x - lt_corner.x ) / ipas;
// lower right corner
currpos.x = m_pageSize.x - m_RBmargin.x;
currpos.y = m_pageSize.y - m_RBmargin.y;
ipas = ( currpos.x - refx ) / PAS_REF;
gxpas = ( currpos.x - refx ) / ipas;
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
for( ii = lt_corner.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
msg.Printf( wxT( "%d" ), jj );
if( ii < currpos.x - PAS_REF / 2 )
if( ii < rb_corner.x - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( ii * m_milsToIu, refy * m_milsToIu ),
wxPoint( ii * m_milsToIu, ( refy + GRID_REF_W ) * m_milsToIu ),
wxPoint( ii * m_milsToIu, lt_corner.y * m_milsToIu ),
wxPoint( ii * m_milsToIu, ( lt_corner.y + GRID_REF_W ) * m_milsToIu ),
m_penSize, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( msg,
wxPoint( ( ii - gxpas / 2 ) * m_milsToIu,
( refy + GRID_REF_W / 2 ) * m_milsToIu ),
( lt_corner.y + GRID_REF_W / 2 ) * m_milsToIu ),
size_ref, m_penSize, aLineColor ) );
if( ii < currpos.x - PAS_REF / 2 )
if( ii < rb_corner.x - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( ii * m_milsToIu, currpos.y * m_milsToIu ),
wxPoint( ii * m_milsToIu, (currpos.y - GRID_REF_W ) * m_milsToIu ),
wxPoint( ii * m_milsToIu, rb_corner.y * m_milsToIu ),
wxPoint( ii * m_milsToIu, (rb_corner.y - GRID_REF_W ) * m_milsToIu ),
m_penSize, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( msg,
wxPoint( ( ii - gxpas / 2 ) * m_milsToIu,
( currpos.y - GRID_REF_W / 2) * m_milsToIu ),
( rb_corner.y - GRID_REF_W / 2) * m_milsToIu ),
size_ref, m_penSize, aLineColor ) );
}
ipas = ( currpos.y - refy ) / PAS_REF;
gypas = ( currpos.y - refy ) / ipas;
ipas = ( rb_corner.y - lt_corner.y ) / PAS_REF;
gypas = ( rb_corner.y - lt_corner.y ) / ipas;
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
for( ii = lt_corner.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 < currpos.y - PAS_REF / 2 )
if( ii < rb_corner.y - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( refx * m_milsToIu, ii * m_milsToIu ),
wxPoint( ( refx + GRID_REF_W ) * m_milsToIu, ii * m_milsToIu ),
wxPoint( lt_corner.x * m_milsToIu, ii * m_milsToIu ),
wxPoint( ( lt_corner.x + GRID_REF_W ) * m_milsToIu, ii * m_milsToIu ),
m_penSize, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( msg,
wxPoint( ( refx + GRID_REF_W / 2 ) * m_milsToIu,
wxPoint( ( lt_corner.x + GRID_REF_W / 2 ) * m_milsToIu,
( ii - gypas / 2 ) * m_milsToIu ),
size_ref, m_penSize, aLineColor ) );
if( ii < currpos.y - PAS_REF / 2 )
if( ii < rb_corner.y - PAS_REF / 2 )
{
Append( new WS_DRAW_ITEM_LINE(
wxPoint( currpos.x * m_milsToIu, ii * m_milsToIu ),
wxPoint( ( currpos.x - GRID_REF_W ) * m_milsToIu, ii * m_milsToIu ),
wxPoint( rb_corner.x * m_milsToIu, ii * m_milsToIu ),
wxPoint( ( rb_corner.x - GRID_REF_W ) * m_milsToIu, ii * m_milsToIu ),
m_penSize, aLineColor ) );
}
Append( new WS_DRAW_ITEM_TEXT( msg,
wxPoint( ( currpos.x - GRID_REF_W / 2 ) * m_milsToIu,
wxPoint( ( rb_corner.x - GRID_REF_W / 2 ) * m_milsToIu,
( ii - gxpas / 2 ) * m_milsToIu ),
size_ref, m_penSize, aLineColor ) );
}
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
refx = m_pageSize.x - m_RBmargin.x - GRID_REF_W;
refy = m_pageSize.y - m_RBmargin.y - GRID_REF_W;
int upperLimit = VARIABLE_BLOCK_START_POSITION;
rb_corner.x -= GRID_REF_W;
rb_corner.y -= GRID_REF_W;
WS_DRAW_ITEM_TEXT* gtext;
Ki_WorkSheetData* WsItem;
int boldPenSize;
int pensize;
bool bold;
bool italic = false;
EDA_COLOR_T color;
for( WsItem = &WS_Segm7; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * m_milsToIu;
pos.y = (refy - WsItem->m_Posy) * m_milsToIu;
pos.x = (rb_corner.x - WsItem->m_Posx) * m_milsToIu;
pos.y = (rb_corner.y - WsItem->m_Posy) * m_milsToIu;
msg.Empty();
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += FindUserText( WsItem->m_Type, aTitleBlock, aPaperFormat, aFileName,
aSheetPathHumanReadable, aSheetCount, aSheetNumber );
if( WsItem->m_Type == WS_TEXT && WsItem->m_TextBase )
msg = BuildFullText( WsItem->m_TextBase, aTitleBlock, aPaperFormat, aFileName,
aSheetPathHumanReadable, m_sheetCount, m_sheetNumber );
switch( WsItem->m_Type )
{
case WS_REV:
case WS_TITLE:
boldPenSize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, textsize, boldPenSize,
aTextColor, false, true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_KICAD_VERSION:
case WS_SIZESHEET:
case WS_IDENTSHEET:
case WS_FILENAME:
case WS_FULLSHEETNAME:
case WS_DATE:
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, textsize,
m_penSize, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case WS_COMPANY_NAME:
if( !msg.IsEmpty() )
{
boldPenSize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, textsize ,boldPenSize,
aTextColor, false, true ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + TEXTSIZE );
}
break;
case WS_TEXT:
if( msg.IsEmpty() )
break;
bold = false;
pensize = m_penSize;
color = aLineColor;
if( WsItem->m_Flags & USE_TEXT_COLOR )
color = aTextColor;
case WS_COMMENT1:
case WS_COMMENT2:
case WS_COMMENT3:
case WS_COMMENT4:
if( !msg.IsEmpty() )
if( WsItem->m_Flags & USE_BOLD )
{
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, textsize,
m_penSize, aTextColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + TEXTSIZE );
bold = true;
pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
}
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, textsize,
pensize, color, italic, bold ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
if( WsItem->m_Flags & SET_UPPER_LIMIT )
upperLimit = std::max( upperLimit, WsItem->m_Posy + TEXTSIZE );
break;
case WS_UPPER_SEGMENT:
if( UpperLimit == 0 )
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) * m_milsToIu;
WS_MostUpperLine.m_Posy = upperLimit;
WS_MostUpperLine.m_Endy = upperLimit;
WS_MostLeftLine.m_Posy = upperLimit;
pos.y = (rb_corner.y - WsItem->m_Posy) * m_milsToIu;
case WS_SEGMENT:
currpos.x = m_pageSize.x - GRID_REF_W - m_RBmargin.x - WsItem->m_Endx;
currpos.y = m_pageSize.y - GRID_REF_W - m_RBmargin.y - WsItem->m_Endy;
end.x = rb_corner.x - WsItem->m_Endx;
end.y = rb_corner.y - WsItem->m_Endy;
Append( new WS_DRAW_ITEM_LINE( pos,
wxPoint( currpos.x * m_milsToIu, currpos.y * m_milsToIu ),
wxPoint( end.x * m_milsToIu, end.y * m_milsToIu ),
m_penSize, aLineColor ) );
break;
}
}
}
// returns the text corresponding to the aIdent identifier
wxString FindUserText( int aIdent, const TITLE_BLOCK& aTitleBlock,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
int aSheetCount, int aSheetNumber )
// returns the full text corresponding to the aTextbase,
// after replacing format symbols by the corresponding value
wxString BuildFullText( const wxString& aTextbase,
const TITLE_BLOCK& aTitleBlock,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
int aSheetCount, int aSheetNumber )
{
wxString msg;
switch( aIdent )
/* Known formats
* %% = replaced by %
* %K = Kicad version
* %Z = paper format name (A4, USLetter)
* %N = company name
* %D = date
* %R = revision
* %S = sheet number
* %N = number of sheets
* %Cx = comment (x = 0 to 9 to identify the comment)
* %F = filename
* %P = sheet path or sheet full name
* %T = title
*/
for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
{
case WS_DATE:
msg = aTitleBlock.GetDate();
if( aTextbase[ii] != '%' )
{
msg << aTextbase[ii];
continue;
}
ii++;
if( ii >= aTextbase.Len() )
break;
case WS_REV:
msg = aTitleBlock.GetRevision();
break;
wxChar format = aTextbase[ii++];
switch( format )
{
case '%':
msg += '%';
break;
case WS_KICAD_VERSION:
msg = g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
break;
case 'D':
msg += aTitleBlock.GetDate();
break;
case WS_SIZESHEET:
msg = aPaperFormat;
break;
case 'R':
msg += aTitleBlock.GetRevision();
break;
case 'K':
msg += g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
break;
case WS_IDENTSHEET:
msg << aSheetNumber << wxT( "/" ) << aSheetCount;
break;
case 'Z':
msg += aPaperFormat;
break;
case WS_FILENAME:
{
wxFileName fn( aFileName );
msg = fn.GetFullName();
}
break;
case WS_FULLSHEETNAME:
msg = aSheetPathHumanReadable;
break;
case 'S':
msg << aSheetNumber;
break;
case WS_COMPANY_NAME:
msg = aTitleBlock.GetCompany();
break;
case 'F':
{
wxFileName fn( aFileName );
msg += fn.GetFullName();
}
break;
case WS_TITLE:
msg = aTitleBlock.GetTitle();
break;
case 'P':
msg += aSheetPathHumanReadable;
break;
case WS_COMMENT1:
msg = aTitleBlock.GetComment1();
break;
case 'N':
msg = aTitleBlock.GetCompany();
break;
case WS_COMMENT2:
msg = aTitleBlock.GetComment2();
break;
case 'T':
msg += aTitleBlock.GetTitle();
break;
case WS_COMMENT3:
msg = aTitleBlock.GetComment3();
break;
case 'C':
format = aTextbase[ii++];
switch( format )
{
case '1':
msg += aTitleBlock.GetComment1();
break;
case WS_COMMENT4:
msg = aTitleBlock.GetComment4();
break;
case '2':
msg += aTitleBlock.GetComment2();
break;
default:
break;
case '3':
msg += aTitleBlock.GetComment3();
break;
case '4':
msg += aTitleBlock.GetComment4();
break;
default:
break;
}
default:
break;
}
}
return msg;
......
......@@ -5,9 +5,7 @@
*/
/*
* 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
* This file creates a lot of structures to define the shape of a title block
* and frame references
*/
......@@ -35,6 +33,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <drawtxt.h>
#include <appl_wxstruct.h>
#include <worksheet.h>
#include <class_title_block.h>
#include <build_version.h>
#include <worksheet_shape_builder.h>
#define TEXTSIZE 100 // worksheet text size
// Work sheet structure type definitions.
......@@ -150,7 +156,7 @@ Ki_WorkSheetData WS_Osn1_Line1 =
&WS_Osn1_Line2,
Mm2mils( 185 ),Mm2mils( 55 ),
0, Mm2mils( 55 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line2 =
......@@ -159,7 +165,7 @@ Ki_WorkSheetData WS_Osn1_Line2 =
&WS_Osn1_Line3,
Mm2mils( 120 ),Mm2mils( 40 ),
0, Mm2mils( 40 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line3 =
......@@ -168,7 +174,7 @@ Ki_WorkSheetData WS_Osn1_Line3 =
&WS_Osn1_Line4,
Mm2mils( 185 ),Mm2mils( 35 ),
Mm2mils( 120 ),Mm2mils( 35 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line4 =
......@@ -177,7 +183,7 @@ Ki_WorkSheetData WS_Osn1_Line4 =
&WS_Osn1_Line5,
Mm2mils( 50 ), Mm2mils( 35 ),
0, Mm2mils( 35 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line5 =
......@@ -186,7 +192,7 @@ Ki_WorkSheetData WS_Osn1_Line5 =
&WS_Osn1_Line6,
Mm2mils( 185 ),Mm2mils( 30 ),
Mm2mils( 120 ),Mm2mils( 30 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line6 =
......@@ -195,7 +201,7 @@ Ki_WorkSheetData WS_Osn1_Line6 =
&WS_Osn1_Line7,
Mm2mils( 50 ), Mm2mils( 20 ),
0, Mm2mils( 20 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line7 =
......@@ -204,7 +210,7 @@ Ki_WorkSheetData WS_Osn1_Line7 =
&WS_Osn1_Line8,
Mm2mils( 120 ),Mm2mils( 15 ),
0, Mm2mils( 15 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line8 =
......@@ -213,7 +219,7 @@ Ki_WorkSheetData WS_Osn1_Line8 =
&WS_Osn1_Line9,
Mm2mils( 185 ),Mm2mils( 55 ),
Mm2mils( 185 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line9 =
......@@ -222,7 +228,7 @@ Ki_WorkSheetData WS_Osn1_Line9 =
&WS_Osn1_Line10,
Mm2mils( 178 ), Mm2mils( 55 ),
Mm2mils( 178 ), Mm2mils( 30 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line10 =
......@@ -231,7 +237,7 @@ Ki_WorkSheetData WS_Osn1_Line10 =
&WS_Osn1_Line11,
Mm2mils( 168 ), Mm2mils( 55 ),
Mm2mils( 168 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line11 =
......@@ -240,7 +246,7 @@ Ki_WorkSheetData WS_Osn1_Line11 =
&WS_Osn1_Line12,
Mm2mils( 145 ), Mm2mils( 55 ),
Mm2mils( 145 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line12 =
......@@ -249,7 +255,7 @@ Ki_WorkSheetData WS_Osn1_Line12 =
&WS_Osn1_Line13,
Mm2mils( 130 ), Mm2mils( 55 ),
Mm2mils( 130 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line13 =
......@@ -258,7 +264,7 @@ Ki_WorkSheetData WS_Osn1_Line13 =
&WS_Osn1_Line14,
Mm2mils( 120 ), Mm2mils( 55 ),
Mm2mils( 120 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line14 =
......@@ -267,7 +273,7 @@ Ki_WorkSheetData WS_Osn1_Line14 =
&WS_Osn1_Line15,
Mm2mils( 50 ), Mm2mils( 40 ),
Mm2mils( 50 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line15 =
......@@ -276,7 +282,7 @@ Ki_WorkSheetData WS_Osn1_Line15 =
&WS_Osn1_Line16,
Mm2mils( 35 ), Mm2mils( 40 ),
Mm2mils( 35 ), Mm2mils( 20 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line16 =
......@@ -285,7 +291,7 @@ Ki_WorkSheetData WS_Osn1_Line16 =
&WS_Osn1_Line17,
Mm2mils( 30 ), Mm2mils( 20 ),
Mm2mils( 30 ), Mm2mils( 15 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line17 =
......@@ -294,7 +300,7 @@ Ki_WorkSheetData WS_Osn1_Line17 =
&WS_Osn1_Line18,
Mm2mils( 18 ), Mm2mils( 40 ),
Mm2mils( 18 ), Mm2mils( 20 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line18 =
......@@ -303,7 +309,7 @@ Ki_WorkSheetData WS_Osn1_Line18 =
&WS_Osn1_Line19,
Mm2mils( 185 ), Mm2mils( 50 ),
Mm2mils( 120 ), Mm2mils( 50 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line19 =
......@@ -312,7 +318,7 @@ Ki_WorkSheetData WS_Osn1_Line19 =
&WS_Osn1_Line20,
Mm2mils( 185 ), Mm2mils( 45 ),
Mm2mils( 120 ), Mm2mils( 45 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line20 =
......@@ -321,7 +327,7 @@ Ki_WorkSheetData WS_Osn1_Line20 =
&WS_Osn1_Line21,
Mm2mils( 185 ), Mm2mils( 40 ),
Mm2mils( 120 ), Mm2mils( 40 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line21 =
......@@ -330,7 +336,7 @@ Ki_WorkSheetData WS_Osn1_Line21 =
&WS_Osn1_Line22,
Mm2mils( 185 ), Mm2mils( 25 ),
Mm2mils( 120 ), Mm2mils( 25 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line22 =
......@@ -339,7 +345,7 @@ Ki_WorkSheetData WS_Osn1_Line22 =
&WS_Osn1_Line23,
Mm2mils( 185 ), Mm2mils( 20 ),
Mm2mils( 120 ), Mm2mils( 20 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line23 =
......@@ -348,7 +354,7 @@ Ki_WorkSheetData WS_Osn1_Line23 =
&WS_Osn1_Line24,
Mm2mils( 185 ), Mm2mils( 15 ),
Mm2mils( 120 ), Mm2mils( 15 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line24 =
......@@ -357,7 +363,7 @@ Ki_WorkSheetData WS_Osn1_Line24 =
&WS_Osn1_Line25,
Mm2mils( 185 ), Mm2mils( 10 ),
Mm2mils( 120 ), Mm2mils( 10 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line25 =
......@@ -366,7 +372,7 @@ Ki_WorkSheetData WS_Osn1_Line25 =
&WS_Osn1_Line26,
Mm2mils( 185 ), Mm2mils( 5 ),
Mm2mils( 120 ), Mm2mils( 5 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line26 =
......@@ -375,7 +381,7 @@ Ki_WorkSheetData WS_Osn1_Line26 =
&WS_Osn1_Line27,
Mm2mils( 45 ), Mm2mils( 35 ),
Mm2mils( 45 ), Mm2mils( 20 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Line27 =
......@@ -384,7 +390,7 @@ Ki_WorkSheetData WS_Osn1_Line27 =
&WS_Osn1_Text1,
Mm2mils( 40 ), Mm2mils( 35 ),
Mm2mils( 40 ), Mm2mils( 20 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn1_Text1 =
......@@ -393,7 +399,7 @@ Ki_WorkSheetData WS_Osn1_Text1 =
&WS_Osn1_Text2,
Mm2mils( 181.5 ),Mm2mils( 32.5 ),
0, 0,
wxT( "Изм." ), NULL
wxT( "Изм." )
};
Ki_WorkSheetData WS_Osn1_Text2 =
......@@ -402,7 +408,7 @@ Ki_WorkSheetData WS_Osn1_Text2 =
&WS_Osn1_Text3,
Mm2mils( 184 ), Mm2mils( 27.5 ),
0, 0,
wxT( "Разраб." ),NULL
wxT( "Разраб." )
};
Ki_WorkSheetData WS_Osn1_Text3 =
......@@ -411,7 +417,7 @@ Ki_WorkSheetData WS_Osn1_Text3 =
&WS_Osn1_Text4,
Mm2mils( 184 ),Mm2mils( 22.5 ),
0, 0,
wxT( "Пров." ),NULL
wxT( "Пров." )
};
Ki_WorkSheetData WS_Osn1_Text4 =
......@@ -420,7 +426,7 @@ Ki_WorkSheetData WS_Osn1_Text4 =
&WS_Osn1_Text5,
Mm2mils( 184 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Т.контр." ),NULL
wxT( "Т.контр." )
};
Ki_WorkSheetData WS_Osn1_Text5 =
......@@ -429,7 +435,7 @@ Ki_WorkSheetData WS_Osn1_Text5 =
&WS_Osn1_Text6,
Mm2mils( 184 ), Mm2mils( 7.5 ),
0, 0,
wxT( "Н.контр." ),NULL
wxT( "Н.контр." )
};
Ki_WorkSheetData WS_Osn1_Text6 =
......@@ -438,7 +444,7 @@ Ki_WorkSheetData WS_Osn1_Text6 =
&WS_Osn1_Text7,
Mm2mils( 184 ),Mm2mils( 2.5 ),
0, 0,
wxT( "Утв." ), NULL
wxT( "Утв." )
};
Ki_WorkSheetData WS_Osn1_Text7 =
......@@ -447,7 +453,7 @@ Ki_WorkSheetData WS_Osn1_Text7 =
&WS_Osn1_Text8,
Mm2mils( 173 ),Mm2mils( 32.5 ),
0, 0,
wxT( "Лист" ), NULL
wxT( "Лист" )
};
Ki_WorkSheetData WS_Osn1_Text8 =
......@@ -456,7 +462,7 @@ Ki_WorkSheetData WS_Osn1_Text8 =
&WS_Osn1_Text9,
Mm2mils( 156.5 ), Mm2mils( 32.5 ),
0, 0,
wxT( "N докум." ),NULL
wxT( "N докум." )
};
Ki_WorkSheetData WS_Osn1_Text9 =
......@@ -465,7 +471,7 @@ Ki_WorkSheetData WS_Osn1_Text9 =
&WS_Osn1_Text10,
Mm2mils( 137.5 ),Mm2mils( 32.5 ),
0, 0,
wxT( "Подп." ), NULL
wxT( "Подп." )
};
Ki_WorkSheetData WS_Osn1_Text10 =
......@@ -474,7 +480,7 @@ Ki_WorkSheetData WS_Osn1_Text10 =
&WS_Osn1_Text11,
Mm2mils( 125 ), Mm2mils( 32.5 ),
0, 0,
wxT( "Дата" ), NULL
wxT( "Дата" )
};
Ki_WorkSheetData WS_Osn1_Text11 =
......@@ -483,7 +489,7 @@ Ki_WorkSheetData WS_Osn1_Text11 =
&WS_Osn1_Text12,
Mm2mils( 42.5 ),Mm2mils( 37.5 ),
0, 0,
wxT( "Лит." ), NULL
wxT( "Лит." )
};
Ki_WorkSheetData WS_Osn1_Text12 =
......@@ -492,7 +498,7 @@ Ki_WorkSheetData WS_Osn1_Text12 =
&WS_Osn1_Text13,
Mm2mils( 26.5 ),Mm2mils( 37.5 ),
0, 0,
wxT( "Масса" ), NULL
wxT( "Масса" )
};
Ki_WorkSheetData WS_Osn1_Text13 =
......@@ -501,7 +507,7 @@ Ki_WorkSheetData WS_Osn1_Text13 =
&WS_Osn1_Text14,
Mm2mils( 9 ), Mm2mils( 37.5 ),
0, 0,
wxT( "Масштаб" ),NULL
wxT( "Масштаб" )
};
Ki_WorkSheetData WS_Osn1_Text14 =
......@@ -510,7 +516,7 @@ Ki_WorkSheetData WS_Osn1_Text14 =
&WS_Osn1_Text15,
Mm2mils( 49 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Лист" ), NULL
wxT( "Лист" )
};
Ki_WorkSheetData WS_Osn1_Text15 =
......@@ -519,7 +525,7 @@ Ki_WorkSheetData WS_Osn1_Text15 =
&WS_Osn1_Text16,
Mm2mils( 29 ), Mm2mils( 17.5 ),
0, 0,
wxT( "Листов" ),NULL
wxT( "Листов" )
};
Ki_WorkSheetData WS_Osn1_Text16 =
......@@ -528,7 +534,7 @@ Ki_WorkSheetData WS_Osn1_Text16 =
&WS_Osn1_Text17,
Mm2mils( 40 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Формат" ),NULL
wxT( "Формат" )
};
Ki_WorkSheetData WS_Osn1_Text17 =
......@@ -537,7 +543,7 @@ Ki_WorkSheetData WS_Osn1_Text17 =
NULL,
Mm2mils( 110 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Копировал" ),NULL
wxT( "Копировал" )
};
Ki_WorkSheetData WS_Osn2a_Line1 =
......@@ -546,7 +552,7 @@ Ki_WorkSheetData WS_Osn2a_Line1 =
&WS_Osn2a_Line2,
Mm2mils( 185 ), Mm2mils( 15 ),
0, Mm2mils( 15 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line2 =
......@@ -555,7 +561,7 @@ Ki_WorkSheetData WS_Osn2a_Line2 =
&WS_Osn2a_Line3,
Mm2mils( 185 ), Mm2mils( 5 ),
Mm2mils( 120 ), Mm2mils( 5 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line3 =
......@@ -564,7 +570,7 @@ Ki_WorkSheetData WS_Osn2a_Line3 =
&WS_Osn2a_Line4,
Mm2mils( 10 ), Mm2mils( 8 ),
0, Mm2mils( 8 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line4 =
......@@ -573,7 +579,7 @@ Ki_WorkSheetData WS_Osn2a_Line4 =
&WS_Osn2a_Line5,
Mm2mils( 185 ), Mm2mils( 15 ),
Mm2mils( 185 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line5 =
......@@ -582,7 +588,7 @@ Ki_WorkSheetData WS_Osn2a_Line5 =
&WS_Osn2a_Line6,
Mm2mils( 178 ), Mm2mils( 15 ),
Mm2mils( 178 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line6 =
......@@ -591,7 +597,7 @@ Ki_WorkSheetData WS_Osn2a_Line6 =
&WS_Osn2a_Line7,
Mm2mils( 168 ), Mm2mils( 15 ),
Mm2mils( 168 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line7 =
......@@ -600,7 +606,7 @@ Ki_WorkSheetData WS_Osn2a_Line7 =
&WS_Osn2a_Line8,
Mm2mils( 145 ), Mm2mils( 15 ),
Mm2mils( 145 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line8 =
......@@ -609,7 +615,7 @@ Ki_WorkSheetData WS_Osn2a_Line8 =
&WS_Osn2a_Line9,
Mm2mils( 130 ), Mm2mils( 15 ),
Mm2mils( 130 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line9 =
......@@ -618,7 +624,7 @@ Ki_WorkSheetData WS_Osn2a_Line9 =
&WS_Osn2a_Line10,
Mm2mils( 120 ), Mm2mils( 15 ),
Mm2mils( 120 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line10 =
......@@ -627,7 +633,7 @@ Ki_WorkSheetData WS_Osn2a_Line10 =
&WS_Osn2a_Line11,
Mm2mils( 10 ), Mm2mils( 15 ),
Mm2mils( 10 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Line11 =
......@@ -636,7 +642,7 @@ Ki_WorkSheetData WS_Osn2a_Line11 =
&WS_Osn2a_Text1,
Mm2mils( 185 ), Mm2mils( 10 ),
Mm2mils( 120 ), Mm2mils( 10 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_Osn2a_Text1 =
......@@ -645,7 +651,7 @@ Ki_WorkSheetData WS_Osn2a_Text1 =
&WS_Osn2a_Text2,
Mm2mils( 181.5 ),Mm2mils( 2.5 ),
0, 0,
wxT( "Изм." ), NULL
wxT( "Изм." )
};
Ki_WorkSheetData WS_Osn2a_Text2 =
......@@ -654,7 +660,7 @@ Ki_WorkSheetData WS_Osn2a_Text2 =
&WS_Osn2a_Text3,
Mm2mils( 173 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Лист" ), NULL
wxT( "Лист" )
};
Ki_WorkSheetData WS_Osn2a_Text3 =
......@@ -663,7 +669,7 @@ Ki_WorkSheetData WS_Osn2a_Text3 =
&WS_Osn2a_Text4,
Mm2mils( 156.5 ), Mm2mils( 2.5 ),
0, 0,
wxT( "N докум." ),NULL
wxT( "N докум." )
};
Ki_WorkSheetData WS_Osn2a_Text4 =
......@@ -672,7 +678,7 @@ Ki_WorkSheetData WS_Osn2a_Text4 =
&WS_Osn2a_Text5,
Mm2mils( 137.5 ),Mm2mils( 2.5 ),
0, 0,
wxT( "Подп." ), NULL
wxT( "Подп." )
};
Ki_WorkSheetData WS_Osn2a_Text5 =
......@@ -681,7 +687,7 @@ Ki_WorkSheetData WS_Osn2a_Text5 =
&WS_Osn2a_Text6,
Mm2mils( 125 ), Mm2mils( 2.5 ),
0, 0,
wxT( "Дата" ), NULL
wxT( "Дата" )
};
Ki_WorkSheetData WS_Osn2a_Text6 =
......@@ -690,7 +696,7 @@ Ki_WorkSheetData WS_Osn2a_Text6 =
&WS_Osn2a_Text7,
Mm2mils( 5 ), Mm2mils( 11.5 ),
0, 0,
wxT( "Лист" ), NULL
wxT( "Лист" )
};
Ki_WorkSheetData WS_Osn2a_Text7 =
......@@ -699,7 +705,7 @@ Ki_WorkSheetData WS_Osn2a_Text7 =
&WS_Osn2a_Text8,
Mm2mils( 40 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Формат" ),NULL
wxT( "Формат" )
};
Ki_WorkSheetData WS_Osn2a_Text8 =
......@@ -708,7 +714,7 @@ Ki_WorkSheetData WS_Osn2a_Text8 =
NULL,
Mm2mils( 110 ), -Mm2mils( 2.5 ),
0, 0,
wxT( "Копировал" ),NULL
wxT( "Копировал" )
};
// Center - left bottom corner
......@@ -719,7 +725,7 @@ Ki_WorkSheetData WS_DopLeft_Line1 =
&WS_DopLeft_Line2,
Mm2mils( 12 ), Mm2mils( 145 ),
0, Mm2mils( 145 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line2 =
......@@ -728,7 +734,7 @@ Ki_WorkSheetData WS_DopLeft_Line2 =
&WS_DopLeft_Line3,
Mm2mils( 12 ), Mm2mils( 110 ),
0, Mm2mils( 110 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line3 =
......@@ -737,7 +743,7 @@ Ki_WorkSheetData WS_DopLeft_Line3 =
&WS_DopLeft_Line4,
Mm2mils( 12 ), Mm2mils( 85 ),
0, Mm2mils( 85 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line4 =
......@@ -746,7 +752,7 @@ Ki_WorkSheetData WS_DopLeft_Line4 =
&WS_DopLeft_Line5,
Mm2mils( 12 ), Mm2mils( 60 ),
0, Mm2mils( 60 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line5 =
......@@ -755,7 +761,7 @@ Ki_WorkSheetData WS_DopLeft_Line5 =
&WS_DopLeft_Line6,
Mm2mils( 12 ), Mm2mils( 25 ),
0, Mm2mils( 25 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line6 =
......@@ -764,7 +770,7 @@ Ki_WorkSheetData WS_DopLeft_Line6 =
&WS_DopLeft_Line7,
Mm2mils( 12 ), 0,
0, 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line7 =
......@@ -773,7 +779,7 @@ Ki_WorkSheetData WS_DopLeft_Line7 =
&WS_DopLeft_Line8,
Mm2mils( 12 ), Mm2mils( 145 ),
Mm2mils( 12 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line8 =
......@@ -782,7 +788,7 @@ Ki_WorkSheetData WS_DopLeft_Line8 =
&WS_DopLeft_Text1,
Mm2mils( 7 ), Mm2mils( 145 ),
Mm2mils( 7 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Text1 =
......@@ -791,7 +797,7 @@ Ki_WorkSheetData WS_DopLeft_Text1 =
&WS_DopLeft_Text2,
Mm2mils( 9.5 ), Mm2mils( 12.5 ),
0, 0,
wxT( "Инв.N подл." ),NULL
wxT( "Инв.N подл." )
};
Ki_WorkSheetData WS_DopLeft_Text2 =
......@@ -800,7 +806,7 @@ Ki_WorkSheetData WS_DopLeft_Text2 =
&WS_DopLeft_Text3,
Mm2mils( 9.5 ), Mm2mils( 42.5 ),
0, 0,
wxT( "Подп. и дата" ),NULL
wxT( "Подп. и дата" )
};
Ki_WorkSheetData WS_DopLeft_Text3 =
......@@ -809,7 +815,7 @@ Ki_WorkSheetData WS_DopLeft_Text3 =
&WS_DopLeft_Text4,
Mm2mils( 9.5 ), Mm2mils( 72.5 ),
0, 0,
wxT( "Взам.инв.N" ),NULL
wxT( "Взам.инв.N" )
};
Ki_WorkSheetData WS_DopLeft_Text4 =
......@@ -818,7 +824,7 @@ Ki_WorkSheetData WS_DopLeft_Text4 =
&WS_DopLeft_Text5,
Mm2mils( 9.5 ), Mm2mils( 97.5 ),
0, 0,
wxT( "Инв.N дубл." ),NULL
wxT( "Инв.N дубл." )
};
Ki_WorkSheetData WS_DopLeft_Text5 =
......@@ -827,7 +833,7 @@ Ki_WorkSheetData WS_DopLeft_Text5 =
&WS_DopLeft_Line9,
Mm2mils( 9.5 ), Mm2mils( 127.5 ),
0, 0,
wxT( "Подп. и дата" ),NULL
wxT( "Подп. и дата" )
};
Ki_WorkSheetData WS_DopLeft_Line9 =
......@@ -836,7 +842,7 @@ Ki_WorkSheetData WS_DopLeft_Line9 =
&WS_DopLeft_Line10,
Mm2mils( 7 ), Mm2mils( 287 ),
Mm2mils( 7 ), Mm2mils( 167 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line10 =
......@@ -845,7 +851,7 @@ Ki_WorkSheetData WS_DopLeft_Line10 =
&WS_DopLeft_Line11,
Mm2mils( 12 ), Mm2mils( 287 ),
Mm2mils( 12 ), Mm2mils( 167 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line11 =
......@@ -854,7 +860,7 @@ Ki_WorkSheetData WS_DopLeft_Line11 =
&WS_DopLeft_Line12,
Mm2mils( 12 ), Mm2mils( 287 ),
Mm2mils( 12 ), Mm2mils( 167 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line12 =
......@@ -863,7 +869,7 @@ Ki_WorkSheetData WS_DopLeft_Line12 =
&WS_DopLeft_Line13,
Mm2mils( 12 ), Mm2mils( 167 ),
0, Mm2mils( 167 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line13 =
......@@ -872,7 +878,7 @@ Ki_WorkSheetData WS_DopLeft_Line13 =
&WS_DopLeft_Line14,
Mm2mils( 12 ), Mm2mils( 227 ),
0, Mm2mils( 227 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Line14 =
......@@ -881,7 +887,7 @@ Ki_WorkSheetData WS_DopLeft_Line14 =
&WS_DopLeft_Text6,
Mm2mils( 12 ), Mm2mils( 287 ),
0, Mm2mils( 287 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopLeft_Text6 =
......@@ -890,7 +896,7 @@ Ki_WorkSheetData WS_DopLeft_Text6 =
&WS_DopLeft_Text7,
Mm2mils( 9.5 ), Mm2mils( 197 ),
0, 0,
wxT( "Справ. N" ),NULL
wxT( "Справ. N" )
};
Ki_WorkSheetData WS_DopLeft_Text7 =
......@@ -899,7 +905,7 @@ Ki_WorkSheetData WS_DopLeft_Text7 =
NULL,
Mm2mils( 9.5 ), Mm2mils( 257 ),
0, 0,
wxT( "Перв. примен." ),NULL
wxT( "Перв. примен." )
};
// Center - left top corner
......@@ -910,7 +916,7 @@ Ki_WorkSheetData WS_DopTop_Line1 =
&WS_DopTop_Line2,
Mm2mils( 70 ), 0,
Mm2mils( 70 ), Mm2mils( 14 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopTop_Line2 =
......@@ -919,7 +925,7 @@ Ki_WorkSheetData WS_DopTop_Line2 =
&WS_DopTop_Line3,
Mm2mils( 70 ), Mm2mils( 14 ),
0, Mm2mils( 14 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopTop_Line3 =
......@@ -928,7 +934,7 @@ Ki_WorkSheetData WS_DopTop_Line3 =
&WS_DopTop_Line4,
Mm2mils( 70 ), Mm2mils( 14 ),
Mm2mils( 137 ), Mm2mils( 14 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopTop_Line4 =
......@@ -937,7 +943,7 @@ Ki_WorkSheetData WS_DopTop_Line4 =
&WS_DopTop_Line5,
Mm2mils( 84 ), Mm2mils( 7 ),
Mm2mils( 137 ), Mm2mils( 7 ),
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopTop_Line5 =
......@@ -946,7 +952,7 @@ Ki_WorkSheetData WS_DopTop_Line5 =
&WS_DopTop_Line6,
Mm2mils( 84 ), Mm2mils( 14 ),
Mm2mils( 84 ), 0,
NULL, NULL
NULL
};
Ki_WorkSheetData WS_DopTop_Line6 =
......@@ -955,7 +961,7 @@ Ki_WorkSheetData WS_DopTop_Line6 =
NULL,
Mm2mils( 137 ),Mm2mils( 14 ),
Mm2mils( 137 ), 0,
NULL, NULL
NULL
};
#include <worksheet_shape_builder.h>
......@@ -965,7 +971,6 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
{
wxPoint pos;
......@@ -1005,7 +1010,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
refy = m_pageSize.y - m_RBmargin.y;
// First page
if( aSheetNumber == 1 )
if( m_sheetNumber == 1 )
{
for( WsItem = &WS_Osn1_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
......@@ -1013,7 +1018,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
pos.y = (refy - WsItem->m_Posy) * m_milsToIu;
end.x = (refx - WsItem->m_Endx) * m_milsToIu;
end.y = (refy - WsItem->m_Endy) * m_milsToIu;
msg = WsItem->m_Legende;
msg = WsItem->m_TextBase;
switch( WsItem->m_Type )
{
......@@ -1056,12 +1061,12 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
}
// Sheet number
if( aSheetCount > 1 )
if( m_sheetCount > 1 )
{
pos.x = ( refx - Mm2mils( 36 ) ) * m_milsToIu;
pos.y = ( refy - Mm2mils( 17.5 ) ) * m_milsToIu;
msg.Empty();
msg << aSheetNumber;
msg << m_sheetNumber;
Append( new WS_DRAW_ITEM_TEXT( msg, pos,
size, m_penSize, aLineColor ) );
}
......@@ -1070,7 +1075,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
pos.x = ( refx - Mm2mils( 10 ) ) * m_milsToIu;
pos.y = ( refy - Mm2mils( 17.5 ) ) * m_milsToIu;
msg.Empty();
msg << aSheetCount;
msg << m_sheetCount;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, m_penSize, aLineColor ) );
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
......@@ -1284,7 +1289,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
pos.y = (refy - WsItem->m_Posy) * m_milsToIu;
end.x = (refx - WsItem->m_Endx) * m_milsToIu;
end.y = (refy - WsItem->m_Endy) * m_milsToIu;
msg = WsItem->m_Legende;
msg = WsItem->m_TextBase;
switch( WsItem->m_Type )
{
......@@ -1331,7 +1336,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
pos.x = ( refx - Mm2mils( 5 ) ) * m_milsToIu;
pos.y = ( refy - Mm2mils( 4 ) ) * m_milsToIu;
msg.Empty();
msg << aSheetNumber;
msg << m_sheetNumber;
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
size, m_penSize, aLineColor ) );
......@@ -1369,14 +1374,14 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
for( WsItem = &WS_DopLeft_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only
if( m_sheetNumber > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posx) * m_milsToIu;
pos.y = (refy - WsItem->m_Posy) * m_milsToIu;
end.x = (refx - WsItem->m_Endx) * m_milsToIu;
end.y = (refy - WsItem->m_Endy) * m_milsToIu;
msg = WsItem->m_Legende;
msg = WsItem->m_TextBase;
switch( WsItem->m_Type )
{
......@@ -1406,14 +1411,14 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
if( m_sheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
break;
pos.x = (refx + WsItem->m_Posx) * m_milsToIu;
pos.y = (refy + WsItem->m_Posy) * m_milsToIu;
end.x = (refx + WsItem->m_Endx) * m_milsToIu;
end.y = (refy + WsItem->m_Endy) * m_milsToIu;
msg = WsItem->m_Legende;
msg = WsItem->m_TextBase;
switch( WsItem->m_Type )
{
......@@ -1457,14 +1462,14 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
{
if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
if( m_sheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
break;
pos.x = (refx - WsItem->m_Posy) * m_milsToIu;
pos.y = (refy + WsItem->m_Posx) * m_milsToIu;
end.x = (refx - WsItem->m_Endy) * m_milsToIu;
end.y = (refy + WsItem->m_Endx) * m_milsToIu;
msg = WsItem->m_Legende;
msg = WsItem->m_TextBase;
switch( WsItem->m_Type )
{
......
......@@ -33,28 +33,15 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <class_base_screen.h>
#include <drawtxt.h>
#include <confirm.h>
#include <wxstruct.h>
#include <appl_wxstruct.h>
#include <kicad_string.h>
#include <worksheet.h>
#include <class_title_block.h>
#include <build_version.h>
// include data which defines the shape of a title block
// and frame references
#include <worksheet_shape_builder.h>
#if defined(KICAD_GOST)
#include "title_block_shapes_gost.h"
#else
#include "title_block_shapes.h"
#endif
void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
const PAGE_INFO& aPageInfo,
const wxString& aPaperFormat,
......@@ -76,11 +63,12 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
drawList.SetPenSize( aPenWidth );
drawList.SetMilsToIUfactor( aScalar );
drawList.SetPageSize( pagesize );
drawList.SetSheetNumber( aSheetNumber );
drawList.SetSheetCount( aSheetCount );
drawList.BuildWorkSheetGraphicList(
aPaperFormat, aFullSheetName, aFileName,
aTitleBlock, aSheetCount, aSheetNumber,
aLineColor, aTextColor );
aTitleBlock, aLineColor, aTextColor );
// Draw item list
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item;
......
......@@ -38,7 +38,7 @@
#include <sch_junction.h>
int SCH_JUNCTION::m_symbolSize = 50; // Default diameter of the junction symbol
int SCH_JUNCTION::m_symbolSize = 40; // Default diameter of the junction symbol
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_JUNCTION_T )
......
......@@ -21,8 +21,8 @@ public:
Ki_WorkSheetData* Pnext;
int m_Posx, m_Posy;
int m_Endx, m_Endy;
const wxChar* m_Legende;
const wxChar* m_Text;
const wxChar* m_TextBase;
int m_Flags;
};
/**
......
......@@ -46,6 +46,7 @@ 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 ) :
......@@ -118,8 +119,10 @@ public:
};
/*
* this class stores the list of graphic items to draw/plot
* the title block and frame references
* this class stores the list of graphic items:
* rect, lines, polygons and texts to draw/plot
* the title block and frame references, and parameters to
* draw/plot them
*/
class WS_DRAW_ITEM_LIST
{
......@@ -131,6 +134,9 @@ class WS_DRAW_ITEM_LIST
double m_milsToIu; // the scalar to convert pages units ( mils)
// to draw/plot units.
int m_penSize; // The line width for drawings.
int m_sheetNumber; // the value of the sheet number, for basic inscriptions
int m_sheetCount; // the value of the number of sheets, in schematic
// for basic inscriptions, in schematic
public:
WS_DRAW_ITEM_LIST()
......@@ -138,6 +144,8 @@ public:
m_idx = 0;
m_milsToIu = 1.0;
m_penSize = 1;
m_sheetNumber = 1;
m_sheetCount = 1;
}
~WS_DRAW_ITEM_LIST()
......@@ -173,6 +181,26 @@ public:
m_pageSize = aPageSize;
}
/**
* Function SetSheetNumber
* Set the value of the sheet number, for basic inscriptions
* @param aSheetNumber the number to display.
*/
void SetSheetNumber( int aSheetNumber )
{
m_sheetNumber = aSheetNumber;
}
/**
* Function SetSheetCount
* Set the value of the count of sheets, for basic inscriptions
* @param aSheetCount the number of esheets to display.
*/
void SetSheetCount( int aSheetCount )
{
m_sheetCount = aSheetCount;
}
/* Function SetMargins
* Set the left top margin and the right bottom margin
* of the page layout
......@@ -220,8 +248,6 @@ public:
* @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 aLineColor The color for drawing and fixed text.
* @param aTextColor The color for user inscriptions.
*/
......@@ -229,7 +255,6 @@ public:
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor );
};
......
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