Complete comment translation of common source.

This commit is contained in:
stambaughw
2009-11-23 15:16:50 +00:00
parent d21bf859ae
commit bc5d9a75f5
33 changed files with 2510 additions and 2645 deletions
+100 -76
View File
@@ -14,13 +14,11 @@
#include "class_base_screen.h"
#include "drawtxt.h"
/**************************************************************************/
void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
/**************************************************************************/
/* Plot sheet references
* margin is in mils (1/1000 inch)
*/
void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
{
#define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
@@ -28,14 +26,16 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
wxSize PageSize;
wxPoint pos, ref;
EDA_Colors color;
int conv_unit = screen->GetInternalUnits() / 1000; /* Scale to convert dimension in 1/1000 in into internal units
* (1/1000 inc for EESchema, 1/10000 for pcbnew */
wxString msg;
wxSize text_size;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool italic = false;
bool bold = false;
bool thickness = 0; //@todo : use current pen
/* Scale to convert dimension in 1/1000 in into internal units
* (1/1000 inc for EESchema, 1/10000 for pcbnew. */
int conv_unit = screen->GetInternalUnits() / 1000;
wxString msg;
wxSize text_size;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool italic = false;
bool bold = false;
bool thickness = 0; //@todo : use current pen
color = BLACK;
plotter->set_color( color );
@@ -43,30 +43,36 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
PageSize.x = Sheet->m_Size.x;
PageSize.y = Sheet->m_Size.y;
/* trace de la bordure */
/* Plot edge. */
ref.x = Sheet->m_LeftMargin * conv_unit;
ref.y = Sheet->m_TopMargin * conv_unit; /* Upper left corner */
xg = (PageSize.x - Sheet->m_RightMargin) * conv_unit;
yg = (PageSize.y - Sheet->m_BottomMargin) * conv_unit; /* lower right corner */
ref.y = Sheet->m_TopMargin * conv_unit;
xg = ( PageSize.x - Sheet->m_RightMargin ) * conv_unit;
yg = ( PageSize.y - Sheet->m_BottomMargin ) * conv_unit;
#if defined(KICAD_GOST)
plotter->move_to( ref );
pos.x = xg; pos.y = ref.y;
pos.x = xg;
pos.y = ref.y;
plotter->line_to( pos );
pos.x = xg; pos.y = yg;
pos.x = xg;
pos.y = yg;
plotter->line_to( pos );
pos.x = ref.x; pos.y = yg;
pos.x = ref.x;
pos.y = yg;
plotter->line_to( pos );
plotter->finish_to( ref );
#else
for( unsigned ii = 0; ii < 2; ii++ )
{
plotter->move_to( ref );
pos.x = xg; pos.y = ref.y;
pos.x = xg;
pos.y = ref.y;
plotter->line_to( pos );
pos.x = xg; pos.y = yg;
pos.x = xg;
pos.y = yg;
plotter->line_to( pos );
pos.x = ref.x; pos.y = yg;
pos.x = ref.x;
pos.y = yg;
plotter->line_to( pos );
plotter->finish_to( ref );
ref.x += GRID_REF_W * conv_unit;
@@ -77,22 +83,23 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#endif
/* trace des reperes */
text_size.x = WSTEXTSIZE * conv_unit;
text_size.y = WSTEXTSIZE * conv_unit;
ref.x = Sheet->m_LeftMargin;
ref.y = Sheet->m_TopMargin; /* Upper left corner in 1/1000 inch */
xg = (PageSize.x - Sheet->m_RightMargin);
yg = (PageSize.y - Sheet->m_BottomMargin); /* lower right corner in 1/1000 inch */
ref.y = Sheet->m_TopMargin; /* Upper left corner in
* 1/1000 inch */
xg = ( PageSize.x - Sheet->m_RightMargin );
yg = ( PageSize.y - Sheet->m_BottomMargin ); /* lower right corner
* in 1/1000 inch */
#if defined(KICAD_GOST)
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (yg - WsItem->m_Posy) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( yg - WsItem->m_Posy ) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
@@ -110,8 +117,8 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_SEGMENT_LU:
plotter->move_to( pos );
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (yg - WsItem->m_Endy) * conv_unit;
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
pos.y = ( yg - WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
break;
}
@@ -121,15 +128,15 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x + WsItem->m_Posx) * conv_unit;
pos.y = (ref.y + WsItem->m_Posy) * conv_unit;
pos.x = ( ref.x + WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y + WsItem->m_Posy ) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_SEGMENT_LT:
plotter->move_to( pos );
pos.x = (ref.x + WsItem->m_Endx) * conv_unit;
pos.y = (ref.y + WsItem->m_Endy) * conv_unit;
pos.x = ( ref.x + WsItem->m_Endx ) * conv_unit;
pos.y = ( ref.y + WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
break;
}
@@ -137,21 +144,26 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#else
/* Trace des reperes selon l'axe X */
ipas = (xg - ref.x) / PAS_REF;
gxpas = ( xg - ref.x) / ipas;
/* Plot legend along the X axis. */
ipas = ( xg - ref.x ) / PAS_REF;
gxpas = ( xg - ref.x ) / ipas;
for( int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
msg.Empty(); msg << jj;
msg.Empty();
msg << jj;
if( ii < xg - PAS_REF / 2 )
{
pos.x = ii * conv_unit; pos.y = ref.y * conv_unit;
pos.x = ii * conv_unit;
pos.y = ref.y * conv_unit;
plotter->move_to( pos );
pos.x = ii * conv_unit; pos.y = (ref.y + GRID_REF_W) * conv_unit;
pos.x = ii * conv_unit;
pos.y = ( ref.y + GRID_REF_W ) * conv_unit;
plotter->finish_to( pos );
}
pos.x = (ii - gxpas / 2) * conv_unit;
pos.y = (ref.y + GRID_REF_W / 2) * conv_unit;
pos.x = ( ii - gxpas / 2 ) * conv_unit;
pos.y = ( ref.y + GRID_REF_W / 2 ) * conv_unit;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@@ -159,37 +171,41 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if( ii < xg - PAS_REF / 2 )
{
pos.x = ii * conv_unit; pos.y = yg * conv_unit;
pos.x = ii * conv_unit;
pos.y = yg * conv_unit;
plotter->move_to( pos );
pos.x = ii * conv_unit; pos.y = (yg - GRID_REF_W) * conv_unit;
pos.x = ii * conv_unit;
pos.y = (yg - GRID_REF_W) * conv_unit;
plotter->finish_to( pos );
}
pos.x = (ii - gxpas / 2) * conv_unit;
pos.y = (yg - GRID_REF_W / 2) * conv_unit;
pos.x = ( ii - gxpas / 2 ) * conv_unit;
pos.y = ( yg - GRID_REF_W / 2 ) * conv_unit;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
}
/* Trace des reperes selon l'axe Y */
ipas = (yg - ref.y) / PAS_REF;
gypas = ( yg - ref.y) / ipas;
/* Plot legend along the Y axis. */
ipas = ( yg - ref.y ) / PAS_REF;
gypas = ( yg - ref.y ) / ipas;
for( int ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
if( jj < 26 )
msg.Printf( wxT( "%c" ), jj + 'A' );
else // I hope 52 identifiers are enought...
else // I hope 52 identifiers are enough...
msg.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
pos.x = ref.x * conv_unit; pos.y = ii * conv_unit;
pos.x = ref.x * conv_unit;
pos.y = ii * conv_unit;
plotter->move_to( pos );
pos.x = (ref.x + GRID_REF_W) * conv_unit; pos.y = ii * conv_unit;
pos.x = ( ref.x + GRID_REF_W ) * conv_unit;
pos.y = ii * conv_unit;
plotter->finish_to( pos );
}
pos.x = (ref.x + GRID_REF_W / 2) * conv_unit;
pos.y = (ii - gypas / 2) * conv_unit;
pos.x = ( ref.x + GRID_REF_W / 2 ) * conv_unit;
pos.y = ( ii - gypas / 2 ) * conv_unit;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@@ -197,13 +213,16 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if( ii < yg - PAS_REF / 2 )
{
pos.x = xg * conv_unit; pos.y = ii * conv_unit;
pos.x = xg * conv_unit;
pos.y = ii * conv_unit;
plotter->move_to( pos );
pos.x = (xg - GRID_REF_W) * conv_unit; pos.y = ii * conv_unit;
pos.x = ( xg - GRID_REF_W ) * conv_unit;
pos.y = ii * conv_unit;
plotter->finish_to( pos );
}
pos.x = (xg - GRID_REF_W / 2) * conv_unit;
pos.y = (ii - gypas / 2) * conv_unit;
pos.x = ( xg - GRID_REF_W / 2 ) * conv_unit;
pos.y = ( ii - gypas / 2 ) * conv_unit;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@@ -211,21 +230,23 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#endif
/* Trace du cartouche */
/* Plot the worksheet. */
text_size.x = SIZETEXT * conv_unit;
text_size.y = SIZETEXT * conv_unit;
#if defined(KICAD_GOST)
ref.x = PageSize.x - Sheet->m_RightMargin;
ref.y = PageSize.y - Sheet->m_BottomMargin;
if( screen->m_ScreenNumber == 1 )
{
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
@@ -288,8 +309,8 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_LEFT_SEGMENT:
case WS_SEGMENT:
plotter->move_to( pos );
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (ref.y - WsItem->m_Endy) * conv_unit;
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
break;
}
@@ -301,9 +322,10 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_CADRE:
@@ -328,8 +350,8 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_LEFT_SEGMENT_D:
case WS_SEGMENT_D:
plotter->move_to( pos );
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (ref.y - WsItem->m_Endy) * conv_unit;
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
break;
}
@@ -343,8 +365,8 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
bold = false;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
@@ -372,13 +394,17 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break;
case WS_IDENTSHEET:
msg << screen->m_ScreenNumber << wxT( "/" ) << screen->m_NumberOfScreen;
msg << screen->m_ScreenNumber << wxT( "/" ) <<
screen->m_NumberOfScreen;
break;
case WS_FILENAME:
{
wxString fname, fext;
wxFileName::SplitPath( screen->m_FileName, (wxString*) NULL, &fname, &fext );
wxFileName::SplitPath( screen->m_FileName,
(wxString*) NULL,
&fname,
&fext );
msg << fname << wxT( "." ) << fext;
}
break;
@@ -428,16 +454,15 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break;
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit;
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy
= WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
case WS_SEGMENT:
{
wxPoint auxpos;
auxpos.x = (ref.x - WsItem->m_Endx) * conv_unit;;
auxpos.y = (ref.y - WsItem->m_Endy) * conv_unit;;
auxpos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;;
auxpos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;;
plotter->move_to( pos );
plotter->finish_to( auxpos );
}
@@ -455,4 +480,3 @@ void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#endif
}