|
|
|
@ -37,36 +37,36 @@ |
|
|
|
|
|
|
|
|
|
|
|
#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 TEXTSIZE 60 // worksheet text size |
|
|
|
#define FRMREF_TXTSIZE 50 // worksheet frame reference text size |
|
|
|
#define PAS_REF 2000 // reference markings on worksheet frame |
|
|
|
#define VARIABLE_BLOCK_START_POSITION (SIZETEXT * 10) |
|
|
|
#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_KICAD_VERSION_X BLOCK_OX - SIZETEXT |
|
|
|
#define BLOCK_KICAD_VERSION_Y SIZETEXT |
|
|
|
#define BLOCK_KICAD_VERSION_X BLOCK_OX - TEXTSIZE |
|
|
|
#define BLOCK_KICAD_VERSION_Y TEXTSIZE |
|
|
|
#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_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_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) |
|
|
|
#define BLOCK_ID_SHEET_Y TEXTSIZE |
|
|
|
#define BLOCK_SIZE_SHEET_X BLOCK_OX - TEXTSIZE |
|
|
|
#define BLOCK_SIZE_SHEET_Y (TEXTSIZE * 3) |
|
|
|
#define BLOCK_TITLE_X BLOCK_OX - TEXTSIZE |
|
|
|
#define BLOCK_TITLE_Y (TEXTSIZE * 5) |
|
|
|
#define BLOCK_FULLSHEETNAME_X BLOCK_OX - TEXTSIZE |
|
|
|
#define BLOCK_FULLSHEETNAME_Y (TEXTSIZE * 7) |
|
|
|
#define BLOCK_FILENAME_X BLOCK_OX - TEXTSIZE |
|
|
|
#define BLOCK_FILENAME_Y (TEXTSIZE * 9) |
|
|
|
#define BLOCK_COMMENT_X BLOCK_OX - TEXTSIZE |
|
|
|
#define BLOCK_COMPANY_Y (TEXTSIZE * 11) |
|
|
|
#define BLOCK_COMMENT1_Y (TEXTSIZE * 13) |
|
|
|
#define BLOCK_COMMENT2_Y (TEXTSIZE * 15) |
|
|
|
#define BLOCK_COMMENT3_Y (TEXTSIZE * 17) |
|
|
|
#define BLOCK_COMMENT4_Y (TEXTSIZE * 19) |
|
|
|
|
|
|
|
// Work sheet structure type definitions. |
|
|
|
enum TypeKi_WorkSheetData { |
|
|
|
@ -89,32 +89,43 @@ enum TypeKi_WorkSheetData { |
|
|
|
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; |
|
|
|
|
|
|
|
// superior horizontal segment: should be after comments |
|
|
|
// to know the exact position |
|
|
|
Ki_WorkSheetData WS_MostUpperLine = |
|
|
|
{ |
|
|
|
WS_UPPER_SEGMENT, |
|
|
|
NULL, |
|
|
|
BLOCK_OX, TEXTSIZE * 16, |
|
|
|
0, TEXTSIZE * 16, |
|
|
|
NULL, NULL |
|
|
|
}; |
|
|
|
|
|
|
|
// Left vertical segment: should be after comments |
|
|
|
// to know the exact position |
|
|
|
Ki_WorkSheetData WS_MostLeftLine = |
|
|
|
{ |
|
|
|
WS_LEFT_SEGMENT, |
|
|
|
&WS_MostUpperLine, |
|
|
|
BLOCK_OX, TEXTSIZE * 16, |
|
|
|
BLOCK_OX, 0, |
|
|
|
NULL, NULL |
|
|
|
}; |
|
|
|
|
|
|
|
// horizontal segment between filename and comments |
|
|
|
Ki_WorkSheetData WS_SeparatorLine = |
|
|
|
{ |
|
|
|
WS_SEGMENT, |
|
|
|
&WS_MostLeftLine, |
|
|
|
BLOCK_OX, VARIABLE_BLOCK_START_POSITION, |
|
|
|
0, VARIABLE_BLOCK_START_POSITION, |
|
|
|
NULL, NULL |
|
|
|
}; |
|
|
|
|
|
|
|
Ki_WorkSheetData WS_Date = |
|
|
|
{ |
|
|
|
WS_DATE, |
|
|
|
&WS_Licence, |
|
|
|
&WS_SeparatorLine, |
|
|
|
BLOCK_DATE_X, BLOCK_DATE_Y, |
|
|
|
0, 0, |
|
|
|
wxT( "Date: " ),NULL |
|
|
|
@ -123,7 +134,7 @@ Ki_WorkSheetData WS_Date = |
|
|
|
Ki_WorkSheetData WS_Licence = |
|
|
|
{ |
|
|
|
WS_KICAD_VERSION, |
|
|
|
&WS_Revision, |
|
|
|
&WS_Date, |
|
|
|
BLOCK_KICAD_VERSION_X,BLOCK_KICAD_VERSION_Y, |
|
|
|
0, |
|
|
|
0, |
|
|
|
@ -133,7 +144,7 @@ Ki_WorkSheetData WS_Licence = |
|
|
|
Ki_WorkSheetData WS_Revision = |
|
|
|
{ |
|
|
|
WS_REV, |
|
|
|
&WS_SizeSheet, |
|
|
|
&WS_Licence, |
|
|
|
BLOCK_REV_X, BLOCK_REV_Y, |
|
|
|
0, 0, |
|
|
|
wxT( "Rev: " ),NULL |
|
|
|
@ -142,7 +153,7 @@ Ki_WorkSheetData WS_Revision = |
|
|
|
Ki_WorkSheetData WS_SizeSheet = |
|
|
|
{ |
|
|
|
WS_SIZESHEET, |
|
|
|
&WS_IdentSheet, |
|
|
|
&WS_Revision, |
|
|
|
BLOCK_SIZE_SHEET_X,BLOCK_SIZE_SHEET_Y, |
|
|
|
0, 0, |
|
|
|
wxT( "Size: " ), NULL |
|
|
|
@ -151,7 +162,7 @@ Ki_WorkSheetData WS_SizeSheet = |
|
|
|
Ki_WorkSheetData WS_IdentSheet = |
|
|
|
{ |
|
|
|
WS_IDENTSHEET, |
|
|
|
&WS_Title, |
|
|
|
&WS_SizeSheet, |
|
|
|
BLOCK_ID_SHEET_X,BLOCK_ID_SHEET_Y, |
|
|
|
0, 0, |
|
|
|
wxT( "Id: " ), NULL |
|
|
|
@ -160,7 +171,7 @@ Ki_WorkSheetData WS_IdentSheet = |
|
|
|
Ki_WorkSheetData WS_Title = |
|
|
|
{ |
|
|
|
WS_TITLE, |
|
|
|
&WS_SheetFilename, |
|
|
|
&WS_IdentSheet, |
|
|
|
BLOCK_TITLE_X, BLOCK_TITLE_Y, |
|
|
|
0, 0, |
|
|
|
wxT( "Title: " ), NULL |
|
|
|
@ -169,7 +180,7 @@ Ki_WorkSheetData WS_Title = |
|
|
|
Ki_WorkSheetData WS_SheetFilename = |
|
|
|
{ |
|
|
|
WS_FILENAME, |
|
|
|
&WS_FullSheetName, |
|
|
|
&WS_Title, |
|
|
|
BLOCK_FILENAME_X, BLOCK_FILENAME_Y, |
|
|
|
0, 0, |
|
|
|
wxT( "File: " ), NULL |
|
|
|
@ -178,7 +189,7 @@ Ki_WorkSheetData WS_SheetFilename = |
|
|
|
Ki_WorkSheetData WS_FullSheetName = |
|
|
|
{ |
|
|
|
WS_FULLSHEETNAME, |
|
|
|
&WS_Company, |
|
|
|
&WS_SheetFilename, |
|
|
|
BLOCK_FULLSHEETNAME_X,BLOCK_FULLSHEETNAME_Y, |
|
|
|
0, |
|
|
|
0, |
|
|
|
@ -188,7 +199,7 @@ Ki_WorkSheetData WS_FullSheetName = |
|
|
|
Ki_WorkSheetData WS_Company = |
|
|
|
{ |
|
|
|
WS_COMPANY_NAME, |
|
|
|
&WS_Comment1, |
|
|
|
&WS_FullSheetName, |
|
|
|
BLOCK_COMMENT_X,BLOCK_COMPANY_Y, |
|
|
|
0, 0, |
|
|
|
NULL, NULL |
|
|
|
@ -197,7 +208,7 @@ Ki_WorkSheetData WS_Company = |
|
|
|
Ki_WorkSheetData WS_Comment1 = |
|
|
|
{ |
|
|
|
WS_COMMENT1, |
|
|
|
&WS_Comment2, |
|
|
|
&WS_Company, |
|
|
|
BLOCK_COMMENT_X,BLOCK_COMMENT1_Y, |
|
|
|
0, 0, |
|
|
|
NULL, NULL |
|
|
|
@ -206,7 +217,7 @@ Ki_WorkSheetData WS_Comment1 = |
|
|
|
Ki_WorkSheetData WS_Comment2 = |
|
|
|
{ |
|
|
|
WS_COMMENT2, |
|
|
|
&WS_Comment3, |
|
|
|
&WS_Comment1, |
|
|
|
BLOCK_COMMENT_X,BLOCK_COMMENT2_Y, |
|
|
|
0, 0, |
|
|
|
NULL, NULL |
|
|
|
@ -215,7 +226,7 @@ Ki_WorkSheetData WS_Comment2 = |
|
|
|
Ki_WorkSheetData WS_Comment3 = |
|
|
|
{ |
|
|
|
WS_COMMENT3, |
|
|
|
&WS_Comment4, |
|
|
|
&WS_Comment2, |
|
|
|
BLOCK_COMMENT_X,BLOCK_COMMENT3_Y, |
|
|
|
0, 0, |
|
|
|
NULL, NULL |
|
|
|
@ -224,53 +235,20 @@ Ki_WorkSheetData WS_Comment3 = |
|
|
|
Ki_WorkSheetData WS_Comment4 = |
|
|
|
{ |
|
|
|
WS_COMMENT4, |
|
|
|
&WS_MostLeftLine, |
|
|
|
&WS_Comment3, |
|
|
|
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, |
|
|
|
&WS_Comment4, |
|
|
|
BLOCK_OX, TEXTSIZE * 6, |
|
|
|
0, TEXTSIZE * 6, |
|
|
|
NULL, NULL |
|
|
|
}; |
|
|
|
|
|
|
|
@ -279,9 +257,9 @@ Ki_WorkSheetData WS_Segm3 = |
|
|
|
Ki_WorkSheetData WS_Segm4 = |
|
|
|
{ |
|
|
|
WS_SEGMENT, |
|
|
|
&WS_Segm5, |
|
|
|
BLOCK_REV_X + SIZETEXT,SIZETEXT * 4, |
|
|
|
BLOCK_REV_X + SIZETEXT, 0, |
|
|
|
&WS_Segm3, |
|
|
|
BLOCK_REV_X + TEXTSIZE,TEXTSIZE * 4, |
|
|
|
BLOCK_REV_X + TEXTSIZE, 0, |
|
|
|
NULL, NULL |
|
|
|
}; |
|
|
|
|
|
|
|
@ -289,9 +267,9 @@ Ki_WorkSheetData WS_Segm4 = |
|
|
|
Ki_WorkSheetData WS_Segm5 = |
|
|
|
{ |
|
|
|
WS_SEGMENT, |
|
|
|
&WS_Segm6, |
|
|
|
BLOCK_OX, SIZETEXT * 2, |
|
|
|
0, SIZETEXT * 2, |
|
|
|
&WS_Segm4, |
|
|
|
BLOCK_OX, TEXTSIZE * 2, |
|
|
|
0, TEXTSIZE * 2, |
|
|
|
NULL, NULL |
|
|
|
}; |
|
|
|
|
|
|
|
@ -299,9 +277,9 @@ Ki_WorkSheetData WS_Segm5 = |
|
|
|
Ki_WorkSheetData WS_Segm6 = |
|
|
|
{ |
|
|
|
WS_SEGMENT, |
|
|
|
&WS_Segm7, |
|
|
|
BLOCK_OX, SIZETEXT * 4, |
|
|
|
0, SIZETEXT * 4, |
|
|
|
&WS_Segm5, |
|
|
|
BLOCK_OX, TEXTSIZE * 4, |
|
|
|
0, TEXTSIZE * 4, |
|
|
|
NULL, NULL |
|
|
|
}; |
|
|
|
|
|
|
|
@ -309,14 +287,22 @@ Ki_WorkSheetData WS_Segm6 = |
|
|
|
Ki_WorkSheetData WS_Segm7 = |
|
|
|
{ |
|
|
|
WS_SEGMENT, |
|
|
|
NULL, |
|
|
|
BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 4, |
|
|
|
BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 2, |
|
|
|
&WS_Segm6, |
|
|
|
BLOCK_OX - (TEXTSIZE * 11),TEXTSIZE * 4, |
|
|
|
BLOCK_OX - (TEXTSIZE * 11),TEXTSIZE * 2, |
|
|
|
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, |
|
|
|
const wxString& aPaperFormat, |
|
|
|
const wxString& aFileName, |
|
|
|
const wxString& aSheetPathHumanReadable, |
|
|
|
int aSheetCount, int aSheetNumber ); |
|
|
|
|
|
|
|
|
|
|
|
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
const wxString& aPaperFormat, |
|
|
|
const wxString& aFileName, |
|
|
|
@ -326,22 +312,18 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor ) |
|
|
|
{ |
|
|
|
wxPoint pos; |
|
|
|
wxPoint end; |
|
|
|
int refx, refy; |
|
|
|
wxString Line; |
|
|
|
Ki_WorkSheetData* WsItem; |
|
|
|
wxSize size( SIZETEXT * m_milsToIu, SIZETEXT * m_milsToIu ); |
|
|
|
wxSize size_ref( SIZETEXT_REF * m_milsToIu, SIZETEXT_REF * m_milsToIu ); |
|
|
|
wxSize textsize( TEXTSIZE * m_milsToIu, TEXTSIZE * m_milsToIu ); |
|
|
|
wxSize size_ref( FRMREF_TXTSIZE * m_milsToIu, |
|
|
|
FRMREF_TXTSIZE * m_milsToIu ); |
|
|
|
wxString msg; |
|
|
|
|
|
|
|
// Upper left corner |
|
|
|
refx = m_LTmargin.x; |
|
|
|
refy = m_LTmargin.y; |
|
|
|
int refx = m_LTmargin.x; |
|
|
|
int refy = m_LTmargin.y; |
|
|
|
|
|
|
|
// lower right corner |
|
|
|
wxPoint currpos; |
|
|
|
currpos.x = m_pageSize.x - m_RBmargin.x; |
|
|
|
currpos.y = m_pageSize.y - m_RBmargin.y; |
|
|
|
currpos = m_pageSize - m_RBmargin; |
|
|
|
|
|
|
|
// Draw the border. |
|
|
|
int ii, jj, ipas, gxpas, gypas; |
|
|
|
@ -372,7 +354,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
|
|
|
|
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- ) |
|
|
|
{ |
|
|
|
Line.Printf( wxT( "%d" ), jj ); |
|
|
|
msg.Printf( wxT( "%d" ), jj ); |
|
|
|
|
|
|
|
if( ii < currpos.x - PAS_REF / 2 ) |
|
|
|
{ |
|
|
|
@ -382,7 +364,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
m_penSize, aLineColor ) ); |
|
|
|
} |
|
|
|
|
|
|
|
Append( new WS_DRAW_ITEM_TEXT( Line, |
|
|
|
Append( new WS_DRAW_ITEM_TEXT( msg, |
|
|
|
wxPoint( ( ii - gxpas / 2 ) * m_milsToIu, |
|
|
|
( refy + GRID_REF_W / 2 ) * m_milsToIu ), |
|
|
|
size_ref, m_penSize, aLineColor ) ); |
|
|
|
@ -395,7 +377,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
m_penSize, aLineColor ) ); |
|
|
|
} |
|
|
|
|
|
|
|
Append( new WS_DRAW_ITEM_TEXT( Line, |
|
|
|
Append( new WS_DRAW_ITEM_TEXT( msg, |
|
|
|
wxPoint( ( ii - gxpas / 2 ) * m_milsToIu, |
|
|
|
( currpos.y - GRID_REF_W / 2) * m_milsToIu ), |
|
|
|
size_ref, m_penSize, aLineColor ) ); |
|
|
|
@ -407,9 +389,9 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- ) |
|
|
|
{ |
|
|
|
if( jj < 26 ) |
|
|
|
Line.Printf( wxT( "%c" ), jj + 'A' ); |
|
|
|
msg.Printf( wxT( "%c" ), jj + 'A' ); |
|
|
|
else // I hope 52 identifiers are enough... |
|
|
|
Line.Printf( wxT( "%c" ), 'a' + jj - 26 ); |
|
|
|
msg.Printf( wxT( "%c" ), 'a' + jj - 26 ); |
|
|
|
|
|
|
|
if( ii < currpos.y - PAS_REF / 2 ) |
|
|
|
{ |
|
|
|
@ -419,7 +401,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
m_penSize, aLineColor ) ); |
|
|
|
} |
|
|
|
|
|
|
|
Append( new WS_DRAW_ITEM_TEXT( Line, |
|
|
|
Append( new WS_DRAW_ITEM_TEXT( msg, |
|
|
|
wxPoint( ( refx + GRID_REF_W / 2 ) * m_milsToIu, |
|
|
|
( ii - gypas / 2 ) * m_milsToIu ), |
|
|
|
size_ref, m_penSize, aLineColor ) ); |
|
|
|
@ -432,7 +414,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
m_penSize, aLineColor ) ); |
|
|
|
} |
|
|
|
|
|
|
|
Append( new WS_DRAW_ITEM_TEXT( Line, |
|
|
|
Append( new WS_DRAW_ITEM_TEXT( msg, |
|
|
|
wxPoint( ( currpos.x - GRID_REF_W / 2 ) * m_milsToIu, |
|
|
|
( ii - gxpas / 2 ) * m_milsToIu ), |
|
|
|
size_ref, m_penSize, aLineColor ) ); |
|
|
|
@ -443,241 +425,160 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( |
|
|
|
refy = m_pageSize.y - m_RBmargin.y - GRID_REF_W; |
|
|
|
|
|
|
|
WS_DRAW_ITEM_TEXT* gtext; |
|
|
|
Ki_WorkSheetData* WsItem; |
|
|
|
int boldPenSize; |
|
|
|
|
|
|
|
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) |
|
|
|
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; |
|
|
|
|
|
|
|
msg.Empty(); |
|
|
|
|
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
msg += FindUserText( WsItem->m_Type, aTitleBlock, aPaperFormat, aFileName, |
|
|
|
aSheetPathHumanReadable, aSheetCount, aSheetNumber ); |
|
|
|
|
|
|
|
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, m_penSize, 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 ) ), |
|
|
|
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: |
|
|
|
|
|
|
|
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, |
|
|
|
m_penSize, 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, |
|
|
|
m_penSize, 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, |
|
|
|
m_penSize, 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, |
|
|
|
m_penSize, 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, |
|
|
|
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( 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 ) ), |
|
|
|
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 + SIZETEXT ); |
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + TEXTSIZE ); |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case WS_TITLE: |
|
|
|
|
|
|
|
if( WsItem->m_Legende ) |
|
|
|
case WS_COMMENT1: |
|
|
|
case WS_COMMENT2: |
|
|
|
case WS_COMMENT3: |
|
|
|
case WS_COMMENT4: |
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size, |
|
|
|
GetPenSizeForBold( std::min( size. |
|
|
|
x, |
|
|
|
size. |
|
|
|
y ) ), |
|
|
|
aLineColor, false, true ) ); |
|
|
|
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, textsize, |
|
|
|
m_penSize, aTextColor ) ); |
|
|
|
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); |
|
|
|
pos.x += ReturnGraphicTextWidth( msg, size.x, false, false ); |
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + TEXTSIZE ); |
|
|
|
} |
|
|
|
|
|
|
|
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; |
|
|
|
case WS_UPPER_SEGMENT: |
|
|
|
|
|
|
|
msg += aTitleBlock.GetComment1(); |
|
|
|
if( UpperLimit == 0 ) |
|
|
|
break; |
|
|
|
|
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size, |
|
|
|
m_penSize, aTextColor ) ); |
|
|
|
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); |
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT ); |
|
|
|
} |
|
|
|
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; |
|
|
|
|
|
|
|
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; |
|
|
|
Append( new WS_DRAW_ITEM_LINE( pos, |
|
|
|
wxPoint( currpos.x * m_milsToIu, currpos.y * m_milsToIu ), |
|
|
|
m_penSize, aLineColor ) ); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case WS_COMMENT2: |
|
|
|
|
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
// 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 ) |
|
|
|
{ |
|
|
|
wxString msg; |
|
|
|
|
|
|
|
msg += aTitleBlock.GetComment2(); |
|
|
|
switch( aIdent ) |
|
|
|
{ |
|
|
|
case WS_DATE: |
|
|
|
msg = aTitleBlock.GetDate(); |
|
|
|
break; |
|
|
|
|
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size, |
|
|
|
m_penSize, aTextColor ) ); |
|
|
|
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); |
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT ); |
|
|
|
} |
|
|
|
case WS_REV: |
|
|
|
msg = aTitleBlock.GetRevision(); |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_KICAD_VERSION: |
|
|
|
msg = g_ProductName + wxGetApp().GetAppName(); |
|
|
|
msg += wxT( " " ) + GetBuildVersion(); |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_COMMENT3: |
|
|
|
case WS_SIZESHEET: |
|
|
|
msg = aPaperFormat; |
|
|
|
break; |
|
|
|
|
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
|
|
|
|
msg += aTitleBlock.GetComment3(); |
|
|
|
case WS_IDENTSHEET: |
|
|
|
msg << aSheetNumber << wxT( "/" ) << aSheetCount; |
|
|
|
break; |
|
|
|
|
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
case WS_FILENAME: |
|
|
|
{ |
|
|
|
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size, |
|
|
|
m_penSize, aTextColor ) ); |
|
|
|
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); |
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT ); |
|
|
|
wxFileName fn( aFileName ); |
|
|
|
msg = fn.GetFullName(); |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case WS_COMMENT4: |
|
|
|
|
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
case WS_FULLSHEETNAME: |
|
|
|
msg = aSheetPathHumanReadable; |
|
|
|
break; |
|
|
|
|
|
|
|
msg += aTitleBlock.GetComment4(); |
|
|
|
case WS_COMPANY_NAME: |
|
|
|
msg = aTitleBlock.GetCompany(); |
|
|
|
break; |
|
|
|
|
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, size, |
|
|
|
m_penSize, aTextColor ) ); |
|
|
|
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); |
|
|
|
UpperLimit = std::max( UpperLimit, WsItem->m_Posy + SIZETEXT ); |
|
|
|
} |
|
|
|
case WS_TITLE: |
|
|
|
msg = aTitleBlock.GetTitle(); |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_COMMENT1: |
|
|
|
msg = aTitleBlock.GetComment1(); |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_UPPER_SEGMENT: |
|
|
|
case WS_COMMENT2: |
|
|
|
msg = aTitleBlock.GetComment2(); |
|
|
|
break; |
|
|
|
|
|
|
|
if( UpperLimit == 0 ) |
|
|
|
break; |
|
|
|
case WS_COMMENT3: |
|
|
|
msg = aTitleBlock.GetComment3(); |
|
|
|
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; |
|
|
|
case WS_COMMENT4: |
|
|
|
msg = aTitleBlock.GetComment4(); |
|
|
|
break; |
|
|
|
|
|
|
|
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; |
|
|
|
Append( new WS_DRAW_ITEM_LINE( pos, |
|
|
|
wxPoint( currpos.x * m_milsToIu, currpos.y * m_milsToIu ), |
|
|
|
m_penSize, aLineColor ) ); |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return msg; |
|
|
|
} |