|
|
|
@ -59,17 +59,12 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, |
|
|
|
int iusPerMil = plotter->GetIUsPerDecimil() * 10; |
|
|
|
wxSize pageSize = aPageInfo.GetSizeMils(); // in mils
|
|
|
|
int xg, yg; |
|
|
|
wxPoint pos, ref; |
|
|
|
int refx, refy; |
|
|
|
wxPoint pos, end, ref; |
|
|
|
wxString msg; |
|
|
|
wxSize text_size; |
|
|
|
|
|
|
|
#if defined(KICAD_GOST)
|
|
|
|
wxSize text_size2; |
|
|
|
wxSize text_size3; |
|
|
|
wxSize text_size1_5; |
|
|
|
#else
|
|
|
|
int UpperLimit = VARIABLE_BLOCK_START_POSITION; |
|
|
|
#endif
|
|
|
|
|
|
|
|
EDA_COLOR_T plotClr; |
|
|
|
plotClr = plotter->GetColorMode() ? RED : BLACK; |
|
|
|
@ -84,6 +79,19 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, |
|
|
|
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() ) * iusPerMil; |
|
|
|
|
|
|
|
#if defined(KICAD_GOST)
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
plotter->SetCurrentLineWidth( lineOsn_widht ); |
|
|
|
plotter->MoveTo( ref ); |
|
|
|
pos.x = xg; |
|
|
|
pos.y = ref.y; |
|
|
|
@ -95,6 +103,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, |
|
|
|
pos.y = yg; |
|
|
|
plotter->LineTo( pos ); |
|
|
|
plotter->FinishTo( ref ); |
|
|
|
plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); |
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
@ -125,9 +134,6 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, |
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
text_size.x = WSTEXTSIZE * iusPerMil; |
|
|
|
text_size.y = WSTEXTSIZE * iusPerMil; |
|
|
|
|
|
|
|
// upper left corner in mils
|
|
|
|
ref.x = aPageInfo.GetLeftMarginMils(); |
|
|
|
ref.y = aPageInfo.GetTopMarginMils(); |
|
|
|
@ -137,56 +143,516 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, |
|
|
|
yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() ); |
|
|
|
|
|
|
|
#if defined(KICAD_GOST)
|
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU; |
|
|
|
WsItem != NULL; |
|
|
|
WsItem = WsItem->Pnext ) |
|
|
|
|
|
|
|
// Lower right corner
|
|
|
|
refx = xg; |
|
|
|
refy = yg; |
|
|
|
|
|
|
|
// First page
|
|
|
|
if( aSheetNumber == 1 ) |
|
|
|
{ |
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil; |
|
|
|
pos.y = ( yg - WsItem->m_Posy ) * iusPerMil; |
|
|
|
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(); |
|
|
|
switch( WsItem->m_Type ) |
|
|
|
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() ) |
|
|
|
{ |
|
|
|
case WS_CADRE: |
|
|
|
break; |
|
|
|
sz = text_size1_5; |
|
|
|
lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; |
|
|
|
ln = Mm2mils( 49 ); |
|
|
|
if( lnMsg > ln ) |
|
|
|
sz.x *= float( 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 ); |
|
|
|
} |
|
|
|
|
|
|
|
case WS_PODPIS_LU: |
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
// 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 *= float( ln ) / lnMsg; |
|
|
|
pos.x = (refx - Mm2mils( 60 )) * iusPerMil; |
|
|
|
pos.y = (refy - Mm2mils( 47.5 )) * iusPerMil; |
|
|
|
plotter->Text( pos, plotClr, |
|
|
|
msg, TEXT_ORIENT_VERT, text_size, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, |
|
|
|
msg, TEXT_ORIENT_HORIZ, sz, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case WS_SEGMENT_LU: |
|
|
|
plotter->MoveTo( pos ); |
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil; |
|
|
|
pos.y = ( yg - WsItem->m_Endy ) * iusPerMil; |
|
|
|
plotter->FinishTo( pos ); |
|
|
|
break; |
|
|
|
// 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 *= float( 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 *= float( 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 *= float( 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
|
|
|
|
{ |
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Osn2a_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_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; |
|
|
|
|
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT; |
|
|
|
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
|
|
|
|
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 *= float( 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 ) |
|
|
|
{ |
|
|
|
pos.x = ( ref.x + WsItem->m_Posx ) * iusPerMil; |
|
|
|
pos.y = ( ref.y + WsItem->m_Posy ) * iusPerMil; |
|
|
|
msg.Empty(); |
|
|
|
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_SEGMENT_LT: |
|
|
|
case WS_OSN: |
|
|
|
plotter->SetCurrentLineWidth( lineOsn_widht ); |
|
|
|
plotter->MoveTo( pos ); |
|
|
|
pos.x = ( ref.x + WsItem->m_Endx ) * iusPerMil; |
|
|
|
pos.y = ( ref.y + WsItem->m_Endy ) * iusPerMil; |
|
|
|
plotter->FinishTo( 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() ) |
|
|
|
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_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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 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 *= float( 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; |
|
|
|
|
|
|
|
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_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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 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 *= float( 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; |
|
|
|
@ -271,220 +737,10 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
} |
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Plot the worksheet.
|
|
|
|
text_size.x = SIZETEXT * iusPerMil; |
|
|
|
text_size.y = SIZETEXT * iusPerMil; |
|
|
|
|
|
|
|
#if defined(KICAD_GOST)
|
|
|
|
text_size2.x = SIZETEXT * iusPerMil * 2; |
|
|
|
text_size2.y = SIZETEXT * iusPerMil * 2; |
|
|
|
text_size3.x = SIZETEXT * iusPerMil * 3; |
|
|
|
text_size3.y = SIZETEXT * iusPerMil * 3; |
|
|
|
text_size1_5.x = SIZETEXT * iusPerMil * 1.5; |
|
|
|
text_size1_5.y = SIZETEXT * iusPerMil * 1.5; |
|
|
|
|
|
|
|
ref.x = pageSize.x - aPageInfo.GetRightMarginMils(); |
|
|
|
ref.y = pageSize.y - aPageInfo.GetBottomMarginMils(); |
|
|
|
|
|
|
|
if( aSheetNumber == 1 ) |
|
|
|
{ |
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_Date; |
|
|
|
WsItem != NULL; |
|
|
|
WsItem = WsItem->Pnext ) |
|
|
|
{ |
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil; |
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil; |
|
|
|
msg.Empty(); |
|
|
|
|
|
|
|
switch( WsItem->m_Type ) |
|
|
|
{ |
|
|
|
case WS_DATE: |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_REV: |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_KICAD_VERSION: |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_PODPIS: |
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_SIZESHEET: |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_IDENTSHEET: |
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
if( aNumberOfSheets > 1 ) |
|
|
|
msg << aSheetNumber; |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_SHEETS: |
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
msg << aNumberOfSheets; |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_COMPANY_NAME: |
|
|
|
msg = aTitleBlock.GetCompany(); |
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
plotter->Text( pos, plotClr, |
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size1_5, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_TITLE: |
|
|
|
msg = aTitleBlock.GetTitle(); |
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
plotter->Text( pos, plotClr, |
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size1_5, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_COMMENT1: |
|
|
|
msg = aTitleBlock.GetComment1(); |
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
plotter->Text( pos, plotClr, |
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size3, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil; |
|
|
|
pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil; |
|
|
|
plotter->Text( pos, plotClr, |
|
|
|
msg.GetData(), 1800, text_size2, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_COMMENT2: |
|
|
|
msg = aTitleBlock.GetComment2(); |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_COMMENT3: |
|
|
|
msg = aTitleBlock.GetComment3(); |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_COMMENT4: |
|
|
|
msg = aTitleBlock.GetComment4(); |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_UPPER_SEGMENT: |
|
|
|
case WS_LEFT_SEGMENT: |
|
|
|
case WS_SEGMENT: |
|
|
|
plotter->MoveTo( pos ); |
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil; |
|
|
|
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil; |
|
|
|
plotter->FinishTo( pos ); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
for( Ki_WorkSheetData* WsItem = &WS_CADRE_D; |
|
|
|
WsItem != NULL; |
|
|
|
WsItem = WsItem->Pnext ) |
|
|
|
{ |
|
|
|
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil; |
|
|
|
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil; |
|
|
|
msg.Empty(); |
|
|
|
|
|
|
|
switch( WsItem->m_Type ) |
|
|
|
{ |
|
|
|
case WS_CADRE: |
|
|
|
// Begin list number > 1
|
|
|
|
msg = aTitleBlock.GetComment1(); |
|
|
|
if( !msg.IsEmpty() ) |
|
|
|
{ |
|
|
|
plotter->Text( pos, plotClr, |
|
|
|
msg, TEXT_ORIENT_HORIZ, text_size3, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil; |
|
|
|
pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil; |
|
|
|
plotter->Text( pos, plotClr, |
|
|
|
msg, 1800, text_size2, |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
PLOTTER::DEFAULT_LINE_WIDTH, false, false ); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case WS_PODPIS_D: |
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_IDENTSHEET_D: |
|
|
|
if( WsItem->m_Legende ) |
|
|
|
msg = WsItem->m_Legende; |
|
|
|
msg << aSheetNumber; |
|
|
|
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; |
|
|
|
|
|
|
|
case WS_LEFT_SEGMENT_D: |
|
|
|
case WS_SEGMENT_D: |
|
|
|
plotter->MoveTo( pos ); |
|
|
|
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil; |
|
|
|
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil; |
|
|
|
plotter->FinishTo( pos ); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
ref.x = pageSize.x - GRID_REF_W - aPageInfo.GetRightMarginMils(); |
|
|
|
ref.y = pageSize.y - GRID_REF_W - aPageInfo.GetBottomMarginMils(); |
|
|
|
|
|
|
|
@ -603,4 +859,5 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, |
|
|
|
} |
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} |