rename Ki_PageDescr to PAGE_INFO, encapsulate it in accessors, and move it into the BOARD
This commit is contained in:
parent
0e27f45ffd
commit
0d4598656b
|
@ -40,7 +40,6 @@
|
|||
|
||||
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
|
||||
{
|
||||
m_drawList = NULL; /* Draw items list */
|
||||
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */
|
||||
m_FirstRedraw = true;
|
||||
m_ScreenNumber = 1;
|
||||
|
@ -49,12 +48,9 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
|
|||
m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */
|
||||
m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
|
||||
m_Center = true;
|
||||
m_CurrentSheetDesc = &g_Sheet_A4;
|
||||
m_IsPrinting = false;
|
||||
m_ScrollPixelsPerUnitX = 1;
|
||||
m_ScrollPixelsPerUnitY = 1;
|
||||
|
||||
InitDatas();
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,36 +59,7 @@ BASE_SCREEN::~BASE_SCREEN()
|
|||
}
|
||||
|
||||
|
||||
void BASE_SCREEN::InitDatas()
|
||||
{
|
||||
if( m_Center )
|
||||
{
|
||||
m_crossHairPosition.x = m_crossHairPosition.y = 0;
|
||||
m_DrawOrg.x = -ReturnPageSize().x / 2;
|
||||
m_DrawOrg.y = -ReturnPageSize().y / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DrawOrg.x = m_DrawOrg.y = 0;
|
||||
m_crossHairPosition.x = ReturnPageSize().x / 2;
|
||||
m_crossHairPosition.y = ReturnPageSize().y / 2;
|
||||
}
|
||||
|
||||
m_O_Curseur.x = m_O_Curseur.y = 0;
|
||||
|
||||
SetCurItem( NULL );
|
||||
|
||||
m_FlagModified = false; // Set when any change is made on broad.
|
||||
m_FlagSave = false; // Used in auto save set when an auto save is required.
|
||||
}
|
||||
|
||||
|
||||
int BASE_SCREEN::GetInternalUnits( void )
|
||||
{
|
||||
return EESCHEMA_INTERNAL_UNIT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
wxSize BASE_SCREEN::ReturnPageSize( void )
|
||||
{
|
||||
int internal_units = GetInternalUnits();
|
||||
|
@ -110,6 +77,39 @@ void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
|
|||
m_CurrentSheetDesc->m_Size.x = (int) ((double)aPageSize.x * 1000 / internal_units);
|
||||
m_CurrentSheetDesc->m_Size.y = (int) ((double)aPageSize.y * 1000 / internal_units);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeInternalUnits )
|
||||
{
|
||||
if( m_Center )
|
||||
{
|
||||
m_crossHairPosition.x = m_crossHairPosition.y = 0;
|
||||
|
||||
m_DrawOrg.x = -aPageSizeInternalUnits.x / 2;
|
||||
m_DrawOrg.y = -aPageSizeInternalUnits.y / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DrawOrg.x = m_DrawOrg.y = 0;
|
||||
|
||||
m_crossHairPosition.x = aPageSizeInternalUnits.x / 2;
|
||||
m_crossHairPosition.y = aPageSizeInternalUnits.y / 2;
|
||||
}
|
||||
|
||||
m_O_Curseur.x = m_O_Curseur.y = 0;
|
||||
|
||||
SetCurItem( NULL );
|
||||
|
||||
m_FlagModified = false; // Set when any change is made on board.
|
||||
m_FlagSave = false; // Used in auto save set when an auto save is required.
|
||||
}
|
||||
|
||||
|
||||
int BASE_SCREEN::GetInternalUnits( void )
|
||||
{
|
||||
return EESCHEMA_INTERNAL_UNIT;
|
||||
}
|
||||
|
||||
|
||||
double BASE_SCREEN::GetScalingFactor() const
|
||||
|
@ -513,22 +513,3 @@ void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem )
|
|||
m_items.insert( aIter, aItem );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
EDA_ITEM* item = m_drawList;
|
||||
|
||||
// for now, make it look like XML, expand on this later.
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||
|
||||
for( ; item; item = item->Next() )
|
||||
{
|
||||
item->Show( nestLevel+1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,6 @@ PLOTTER::PLOTTER( PlotFormat aPlotType )
|
|||
output_file = 0;
|
||||
color_mode = false; /* Start as a BW plot */
|
||||
negative_mode = false;
|
||||
sheet = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -424,12 +423,12 @@ void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
|
|||
}
|
||||
|
||||
|
||||
void PLOTTER::set_paper_size( Ki_PageDescr* asheet )
|
||||
void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
|
||||
{
|
||||
wxASSERT( !output_file );
|
||||
sheet = asheet;
|
||||
pageInfo = aPageSettings;
|
||||
|
||||
// Sheets are in mils, plotter works with decimals
|
||||
paper_size.x = sheet->m_Size.x * 10;
|
||||
paper_size.y = sheet->m_Size.y * 10;
|
||||
// PAGE_INFO is in mils, plotter works with decimals
|
||||
paper_size = pageInfo.GetSizeMils() * 10;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,31 +46,6 @@
|
|||
* application class.
|
||||
*/
|
||||
|
||||
/* Standard page sizes in 1/1000 inch */
|
||||
#if defined(KICAD_GOST)
|
||||
Ki_PageDescr g_Sheet_A4( wxSize( 8283, 11700 ), wxPoint( 0, 0 ), wxT( "A4" ) );
|
||||
#else
|
||||
Ki_PageDescr g_Sheet_A4( wxSize( 11700, 8267 ), wxPoint( 0, 0 ), wxT( "A4" ) );
|
||||
#endif
|
||||
Ki_PageDescr g_Sheet_A3( wxSize( 16535, 11700 ), wxPoint( 0, 0 ), wxT( "A3" ) );
|
||||
Ki_PageDescr g_Sheet_A2( wxSize( 23400, 16535 ), wxPoint( 0, 0 ), wxT( "A2" ) );
|
||||
Ki_PageDescr g_Sheet_A1( wxSize( 33070, 23400 ), wxPoint( 0, 0 ), wxT( "A1" ) );
|
||||
Ki_PageDescr g_Sheet_A0( wxSize( 46800, 33070 ), wxPoint( 0, 0 ), wxT( "A0" ) );
|
||||
Ki_PageDescr g_Sheet_A( wxSize( 11000, 8500 ), wxPoint( 0, 0 ), wxT( "A" ) );
|
||||
Ki_PageDescr g_Sheet_B( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "B" ) );
|
||||
Ki_PageDescr g_Sheet_C( wxSize( 22000, 17000 ), wxPoint( 0, 0 ), wxT( "C" ) );
|
||||
Ki_PageDescr g_Sheet_D( wxSize( 34000, 22000 ), wxPoint( 0, 0 ), wxT( "D" ) );
|
||||
Ki_PageDescr g_Sheet_E( wxSize( 44000, 34000 ), wxPoint( 0, 0 ), wxT( "E" ) );
|
||||
Ki_PageDescr g_Sheet_GERBER( wxSize( 32000, 32000 ), wxPoint( 0, 0 ), wxT( "GERBER" ) );
|
||||
Ki_PageDescr g_Sheet_user( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "User" ) );
|
||||
|
||||
Ki_PageDescr* g_SheetSizeList[NB_ITEMS + 1] =
|
||||
{
|
||||
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
|
||||
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
|
||||
&g_Sheet_user, NULL
|
||||
};
|
||||
|
||||
|
||||
const wxString ProjectFileExtension( wxT( "pro" ) );
|
||||
const wxString SchematicFileExtension( wxT( "sch" ) );
|
||||
|
@ -199,12 +174,88 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
|
|||
}
|
||||
|
||||
|
||||
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
|
||||
//-----<PAGE_INFO>-------------------------------------------------------------
|
||||
|
||||
// Standard page sizes in 1/1000 inch
|
||||
#if defined(KICAD_GOST)
|
||||
static const PAGE_INFO pageA4( wxSize( 8283, 11700 ), wxPoint( 0, 0 ), wxT( "A4" ) );
|
||||
#else
|
||||
static const PAGE_INFO pageA4( wxSize( 11700, 8267 ), wxPoint( 0, 0 ), wxT( "A4" ) );
|
||||
#endif
|
||||
static const PAGE_INFO pageA3( wxSize( 16535, 11700 ), wxPoint( 0, 0 ), wxT( "A3" ) );
|
||||
static const PAGE_INFO pageA2( wxSize( 23400, 16535 ), wxPoint( 0, 0 ), wxT( "A2" ) );
|
||||
static const PAGE_INFO pageA1( wxSize( 33070, 23400 ), wxPoint( 0, 0 ), wxT( "A1" ) );
|
||||
static const PAGE_INFO pageA0( wxSize( 46800, 33070 ), wxPoint( 0, 0 ), wxT( "A0" ) );
|
||||
static const PAGE_INFO pageA( wxSize( 11000, 8500 ), wxPoint( 0, 0 ), wxT( "A" ) );
|
||||
static const PAGE_INFO pageB( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "B" ) );
|
||||
static const PAGE_INFO pageC( wxSize( 22000, 17000 ), wxPoint( 0, 0 ), wxT( "C" ) );
|
||||
static const PAGE_INFO pageD( wxSize( 34000, 22000 ), wxPoint( 0, 0 ), wxT( "D" ) );
|
||||
static const PAGE_INFO pageE( wxSize( 44000, 34000 ), wxPoint( 0, 0 ), wxT( "E" ) );
|
||||
static const PAGE_INFO pageGERBER(wxSize( 32000, 32000 ), wxPoint( 0, 0 ), wxT( "GERBER" ) );
|
||||
|
||||
double PAGE_INFO::s_user_width = 17.0;
|
||||
double PAGE_INFO::s_user_height = 11.0;
|
||||
static const PAGE_INFO pageUser( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "User" ) );
|
||||
|
||||
/*
|
||||
static const PAGE_INFO* pageSizes[] =
|
||||
{
|
||||
// All sizes are in 1/1000 inch
|
||||
m_Size = size;
|
||||
m_Offset = offset;
|
||||
m_Name = name;
|
||||
&pageA4, &pageA3, &pageA2, &pageA1, &pageA0,
|
||||
&pageA, &pageB, &pageC, &pageD, &pageE, &pageUser,
|
||||
};
|
||||
|
||||
|
||||
PAGE_INFOS PAGE_INFO::GetStandardSizes()
|
||||
{
|
||||
return PAGE_INFOS( pageSizes, pageSizes + DIM( pageSizes ) );
|
||||
}
|
||||
*/
|
||||
|
||||
bool PAGE_INFO::SetType( const wxString& aType )
|
||||
{
|
||||
bool rc = true;
|
||||
|
||||
if( aType == pageA4.GetType() )
|
||||
*this = pageA4;
|
||||
else if( aType == pageA3.GetType() )
|
||||
*this = pageA3;
|
||||
else if( aType == pageA2.GetType() )
|
||||
*this = pageA2;
|
||||
else if( aType == pageA1.GetType() )
|
||||
*this = pageA1;
|
||||
else if( aType == pageA0.GetType() )
|
||||
*this = pageA0;
|
||||
else if( aType == pageA.GetType() )
|
||||
*this = pageA;
|
||||
else if( aType == pageB.GetType() )
|
||||
*this = pageB;
|
||||
else if( aType == pageC.GetType() )
|
||||
*this = pageC;
|
||||
else if( aType == pageD.GetType() )
|
||||
*this = pageD;
|
||||
else if( aType == pageE.GetType() )
|
||||
*this = pageE;
|
||||
else if( aType == pageUser.GetType() )
|
||||
{
|
||||
*this = pageUser;
|
||||
m_widthInches = s_user_width;
|
||||
m_heightInches = s_user_height;
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxPoint& aOffsetMils, const wxString& aType )
|
||||
{
|
||||
// aSizeMils is in 1/1000th of an inch
|
||||
SetWidthInches( aSizeMils.x / 1000.0 );
|
||||
SetHeightInches( aSizeMils.y / 1000.0 );
|
||||
|
||||
m_Offset = aOffsetMils;
|
||||
m_Type = aType;
|
||||
|
||||
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
|
||||
#if defined(KICAD_GOST)
|
||||
|
@ -218,6 +269,50 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxS
|
|||
}
|
||||
|
||||
|
||||
PAGE_INFO::PAGE_INFO( const wxString& aType )
|
||||
{
|
||||
SetType( aType );
|
||||
}
|
||||
|
||||
|
||||
void PAGE_INFO::SetWidthInches( double aWidthInInches )
|
||||
{
|
||||
// limit resolution to 1/1000th of an inch
|
||||
m_widthInches = double( int( aWidthInInches * 1000 + 500 ) / 1000 );
|
||||
}
|
||||
|
||||
|
||||
void PAGE_INFO::SetHeightInches( double aHeightInInches )
|
||||
{
|
||||
// limit resolution to 1/1000th of an inch
|
||||
m_heightInches = double( int( aHeightInInches * 1000 + 500 ) / 1000 );
|
||||
}
|
||||
|
||||
|
||||
void PAGE_INFO::SetUserWidthInches( double aWidthInInches )
|
||||
{
|
||||
if( aWidthInInches < 6.0 )
|
||||
aWidthInInches = 6.0;
|
||||
else if( aWidthInInches > 44.0 )
|
||||
aWidthInInches = 44.0;
|
||||
|
||||
s_user_width = aWidthInInches;
|
||||
}
|
||||
|
||||
void PAGE_INFO::SetUserHeightInches( double aHeightInInches )
|
||||
{
|
||||
if( aHeightInInches < 4.0 )
|
||||
aHeightInInches = 4.0;
|
||||
else if( aHeightInInches > 44.0 )
|
||||
aHeightInInches = 44.0;
|
||||
|
||||
s_user_height = aHeightInInches;
|
||||
}
|
||||
|
||||
|
||||
//-----</PAGE_INFO>------------------------------------------------------------
|
||||
|
||||
|
||||
wxString ReturnUnitSymbol( EDA_UNITS_T aUnit, const wxString& formatString )
|
||||
{
|
||||
wxString tmp;
|
||||
|
|
|
@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
|
|||
fprintf( output_file, "%%%%Pages: 1\n" );
|
||||
fprintf( output_file, "%%%%PageOrder: Ascend\n" );
|
||||
|
||||
// Print boundary box in 1/72 pixels per inch, box is in decimals
|
||||
// Print boundary box in 1/72 pixels per inch, box is in deci-mils
|
||||
const double CONV_SCALE = DECIMIL_TO_INCH * 72;
|
||||
|
||||
// The coordinates of the lower left corner of the boundary
|
||||
|
@ -388,18 +388,20 @@ bool PS_PLOTTER::start_plot( FILE* fout )
|
|||
//
|
||||
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
|
||||
// the order in which they are specified is not wrong!)
|
||||
// Also note sheet->m_Size is given in mils, not in decimils and must be
|
||||
// sheet->m_Size * 10 in decimals
|
||||
if( sheet->m_Name.Cmp( wxT( "User" ) ) == 0 )
|
||||
// Also note pageSize is given in mils, not in internal units and must be
|
||||
// converted to internal units.
|
||||
wxSize pageSize = pageInfo.GetSizeMils();
|
||||
|
||||
if( pageInfo.GetType().Cmp( wxT( "User" ) ) == 0 )
|
||||
fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
|
||||
wxRound( sheet->m_Size.y * 10 * CONV_SCALE ),
|
||||
wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) );
|
||||
wxRound( pageSize.y * 10 * CONV_SCALE ),
|
||||
wxRound( pageSize.x * 10 * CONV_SCALE ) );
|
||||
|
||||
else // ( if sheet->m_Name does not equal "User" )
|
||||
fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
|
||||
TO_UTF8( sheet->m_Name ),
|
||||
wxRound( sheet->m_Size.y * 10 * CONV_SCALE ),
|
||||
wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) );
|
||||
TO_UTF8( pageInfo.GetType() ),
|
||||
wxRound( pageSize.y * 10 * CONV_SCALE ),
|
||||
wxRound( pageSize.x * 10 * CONV_SCALE ) );
|
||||
|
||||
fprintf( output_file, "%%%%Orientation: Landscape\n" );
|
||||
|
||||
|
|
|
@ -22,15 +22,17 @@
|
|||
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
||||
{
|
||||
#define WSTEXTSIZE 50 // Text size in mils
|
||||
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
|
||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
||||
wxSize pageSize = pageInfo.GetSizeMils(); // mils
|
||||
int xg, yg;
|
||||
wxSize PageSize;
|
||||
|
||||
wxPoint pos, ref;
|
||||
EDA_Colors color;
|
||||
|
||||
/* 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;
|
||||
#if defined(KICAD_GOST)
|
||||
|
@ -47,14 +49,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
color = BLACK;
|
||||
plotter->set_color( color );
|
||||
|
||||
PageSize.x = Sheet->m_Size.x;
|
||||
PageSize.y = Sheet->m_Size.y;
|
||||
|
||||
/* Plot edge. */
|
||||
ref.x = Sheet->m_LeftMargin * conv_unit;
|
||||
ref.y = Sheet->m_TopMargin * conv_unit;
|
||||
xg = ( PageSize.x - Sheet->m_RightMargin ) * conv_unit;
|
||||
yg = ( PageSize.y - Sheet->m_BottomMargin ) * conv_unit;
|
||||
ref.x = pageInfo.GetLeftMarginMils() * conv_unit;
|
||||
ref.y = pageInfo.GetTopMarginMils() * conv_unit;
|
||||
xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * conv_unit;
|
||||
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() ) * conv_unit;
|
||||
|
||||
#if defined(KICAD_GOST)
|
||||
plotter->move_to( ref );
|
||||
|
@ -93,12 +92,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
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 */
|
||||
// upper left corner in mils
|
||||
ref.x = pageInfo.GetLeftMarginMils();
|
||||
ref.y = pageInfo.GetTopMarginMils();
|
||||
|
||||
// lower right corner in mils
|
||||
xg = ( pageSize.x - pageInfo.GetRightMarginMils() );
|
||||
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() );
|
||||
|
||||
#if defined(KICAD_GOST)
|
||||
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
|
||||
|
@ -240,6 +240,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
/* Plot the worksheet. */
|
||||
text_size.x = SIZETEXT * conv_unit;
|
||||
text_size.y = SIZETEXT * conv_unit;
|
||||
|
||||
#if defined(KICAD_GOST)
|
||||
text_size2.x = SIZETEXT * conv_unit * 2;
|
||||
text_size2.y = SIZETEXT * conv_unit * 2;
|
||||
|
@ -247,8 +248,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
text_size3.y = SIZETEXT * conv_unit * 3;
|
||||
text_size1_5.x = SIZETEXT * conv_unit * 1.5;
|
||||
text_size1_5.y = SIZETEXT * conv_unit * 1.5;
|
||||
ref.x = PageSize.x - Sheet->m_RightMargin;
|
||||
ref.y = PageSize.y - Sheet->m_BottomMargin;
|
||||
ref.x = pageSize.x - pageInfo.GetRightMarginMils();
|
||||
ref.y = pageSize.y - pageInfo.GetBottomMarginMils();
|
||||
|
||||
if( screen->m_ScreenNumber == 1 )
|
||||
{
|
||||
|
@ -334,8 +335,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
msg, TEXT_ORIENT_HORIZ, text_size3,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic, false );
|
||||
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
|
||||
pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
|
||||
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
|
||||
pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
|
||||
plotter->text( pos, color,
|
||||
msg.GetData(), 1800, text_size2,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
|
@ -408,8 +409,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
msg, TEXT_ORIENT_HORIZ, text_size3,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
thickness, italic, false );
|
||||
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
|
||||
pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
|
||||
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
|
||||
pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
|
||||
plotter->text( pos, color,
|
||||
msg, 1800, text_size2,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
|
@ -444,9 +445,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
|
||||
ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;
|
||||
|
||||
ref.x = pageSize.x - GRID_REF_W - pageInfo.GetRightMarginMils();
|
||||
ref.y = pageSize.y - GRID_REF_W - pageInfo.GetBottomMarginMils();
|
||||
|
||||
for( Ki_WorkSheetData* WsItem = &WS_Date;
|
||||
WsItem != NULL;
|
||||
|
@ -477,7 +480,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
break;
|
||||
|
||||
case WS_SIZESHEET:
|
||||
msg += screen->m_CurrentSheetDesc->m_Name;
|
||||
msg += pageInfo.GetType();
|
||||
break;
|
||||
|
||||
case WS_IDENTSHEET:
|
||||
|
|
|
@ -23,14 +23,6 @@
|
|||
|
||||
#include "dialog_page_settings.h"
|
||||
|
||||
#define NB_ITEMS 11
|
||||
Ki_PageDescr* SheetList[NB_ITEMS + 1] =
|
||||
{
|
||||
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
|
||||
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
|
||||
&g_Sheet_user, NULL
|
||||
};
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
|
||||
{
|
||||
|
@ -43,13 +35,12 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
|
|||
|
||||
|
||||
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) :
|
||||
DIALOG_PAGES_SETTINGS_BASE( parent )
|
||||
DIALOG_PAGES_SETTINGS_BASE( parent ),
|
||||
m_user_size( wxT( "User" ) )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_Screen = m_Parent->GetScreen();
|
||||
m_Modified = 0;
|
||||
m_SelectedSheet = NULL;
|
||||
m_CurrentSelection = 0;
|
||||
m_modified = false;
|
||||
|
||||
initDialog();
|
||||
|
||||
|
@ -66,9 +57,10 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
|
|||
void DIALOG_PAGES_SETTINGS::initDialog()
|
||||
{
|
||||
wxString msg;
|
||||
double userSizeX;
|
||||
double userSizeY;
|
||||
|
||||
SetFocus();
|
||||
SearchPageSizeSelection();
|
||||
|
||||
// Init display value for sheet User size
|
||||
wxString format = m_TextSheetCount->GetLabel();
|
||||
|
@ -78,38 +70,49 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
|||
msg.Printf( format, m_Screen->m_ScreenNumber );
|
||||
m_TextSheetNumber->SetLabel( msg );
|
||||
|
||||
m_page = m_Parent->GetPageSettings();
|
||||
|
||||
setCurrentPageSizeSelection();
|
||||
|
||||
switch( g_UserUnit )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
UserSizeX = (double) g_Sheet_user.m_Size.x * 25.4 / 1000;
|
||||
UserSizeY = (double) g_Sheet_user.m_Size.y * 25.4 / 1000;
|
||||
msg.Printf( wxT( "%.2f" ), UserSizeX );
|
||||
userSizeX = m_user_size.GetWidthInches() * 25.4;
|
||||
userSizeY = m_user_size.GetHeightInches() * 25.4;
|
||||
|
||||
msg.Printf( wxT( "%.2f" ), userSizeX );
|
||||
m_TextUserSizeX->SetValue( msg );
|
||||
msg.Printf( wxT( "%.2f" ), UserSizeY );
|
||||
|
||||
msg.Printf( wxT( "%.2f" ), userSizeY );
|
||||
m_TextUserSizeY->SetValue( msg );
|
||||
break;
|
||||
|
||||
default:
|
||||
case INCHES:
|
||||
UserSizeX = (double) g_Sheet_user.m_Size.x / 1000;
|
||||
UserSizeY = (double) g_Sheet_user.m_Size.y / 1000;
|
||||
msg.Printf( wxT( "%.3f" ), UserSizeX );
|
||||
userSizeX = m_user_size.GetWidthInches();
|
||||
userSizeY = m_user_size.GetHeightInches();
|
||||
|
||||
msg.Printf( wxT( "%.3f" ), userSizeX );
|
||||
m_TextUserSizeX->SetValue( msg );
|
||||
msg.Printf( wxT( "%.3f" ), UserSizeY );
|
||||
|
||||
msg.Printf( wxT( "%.3f" ), userSizeY );
|
||||
m_TextUserSizeY->SetValue( msg );
|
||||
break;
|
||||
|
||||
/* // you want it in 1/1000ths of an inch, why?
|
||||
case UNSCALED_UNITS:
|
||||
UserSizeX = g_Sheet_user.m_Size.x;
|
||||
UserSizeY = g_Sheet_user.m_Size.y;
|
||||
msg.Printf( wxT( "%f" ), UserSizeX );
|
||||
userSizeX = m_user_size.GetWidthInches() * 1000;
|
||||
userSizeY = m_user_size.GetHeightInches() * 1000;
|
||||
msg.Printf( wxT( "%f" ), m_userSizeX );
|
||||
m_TextUserSizeX->SetValue( msg );
|
||||
msg.Printf( wxT( "%f" ), UserSizeY );
|
||||
msg.Printf( wxT( "%f" ), m_userSizeY );
|
||||
m_TextUserSizeY->SetValue( msg );
|
||||
break;
|
||||
*/
|
||||
}
|
||||
|
||||
// Set validators
|
||||
m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
|
||||
// m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
|
||||
m_TextRevision->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Revision ) );
|
||||
m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) );
|
||||
m_TextCompany->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Company ) );
|
||||
|
@ -139,7 +142,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
|||
|
||||
void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
|
||||
{
|
||||
EndModal( m_Modified );
|
||||
EndModal( m_modified );
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,7 +153,7 @@ void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
|
|||
void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
SavePageSettings( event );
|
||||
m_Modified = 1;
|
||||
m_modified = true;
|
||||
Close( true );
|
||||
}
|
||||
|
||||
|
@ -167,8 +170,9 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
|
||||
{
|
||||
double dtmp;
|
||||
wxString msg;
|
||||
double userSizeX;
|
||||
double userSizeY;
|
||||
|
||||
m_Screen->m_Revision = m_TextRevision->GetValue();
|
||||
m_Screen->m_Company = m_TextCompany->GetValue();
|
||||
|
@ -179,50 +183,42 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
|
|||
m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
|
||||
|
||||
msg = m_TextUserSizeX->GetValue();
|
||||
msg.ToDouble( &dtmp );
|
||||
UserSizeX = dtmp;
|
||||
msg.ToDouble( &userSizeX );
|
||||
|
||||
msg = m_TextUserSizeY->GetValue();
|
||||
msg.ToDouble( &dtmp );
|
||||
UserSizeY = dtmp;
|
||||
msg.ToDouble( &userSizeY );
|
||||
|
||||
int ii = m_PageSizeBox->GetSelection();
|
||||
int radioSelection = m_PageSizeBox->GetSelection();
|
||||
if( radioSelection < 0 )
|
||||
radioSelection = 0;
|
||||
|
||||
if( ii < 0 )
|
||||
ii = 0;
|
||||
wxString paperType = m_PageSizeBox->GetString( radioSelection );
|
||||
|
||||
m_SelectedSheet = SheetList[ii];
|
||||
m_Screen->m_CurrentSheetDesc = m_SelectedSheet;
|
||||
m_page.SetType( paperType );
|
||||
|
||||
m_Parent->SetPageSettings( m_page );
|
||||
|
||||
switch( g_UserUnit )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 / 25.4 );
|
||||
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 / 25.4 );
|
||||
PAGE_INFO::SetUserWidthInches( userSizeX / 25.4 );
|
||||
PAGE_INFO::SetUserHeightInches( userSizeY / 25.4 );
|
||||
break;
|
||||
|
||||
default:
|
||||
case INCHES:
|
||||
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 );
|
||||
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 );
|
||||
PAGE_INFO::SetUserWidthInches( userSizeX );
|
||||
PAGE_INFO::SetUserHeightInches( userSizeY );
|
||||
break;
|
||||
|
||||
/* // set in 1/1000ths of an inch, but why?
|
||||
case UNSCALED_UNITS:
|
||||
g_Sheet_user.m_Size.x = (int) ( UserSizeX );
|
||||
g_Sheet_user.m_Size.y = (int) ( UserSizeY );
|
||||
PAGE_INFO::SetUserWidthInches( userSizeX /1000 );
|
||||
PAGE_INFO::SetUserHeightInches( userSizeY /1000 );
|
||||
break;
|
||||
*/
|
||||
}
|
||||
|
||||
if( g_Sheet_user.m_Size.x < 6000 )
|
||||
g_Sheet_user.m_Size.x = 6000;
|
||||
|
||||
if( g_Sheet_user.m_Size.x > 44000 )
|
||||
g_Sheet_user.m_Size.x = 44000;
|
||||
|
||||
if( g_Sheet_user.m_Size.y < 4000 )
|
||||
g_Sheet_user.m_Size.y = 4000;
|
||||
|
||||
if( g_Sheet_user.m_Size.y > 44000 )
|
||||
g_Sheet_user.m_Size.y = 44000;
|
||||
|
||||
#ifdef EESCHEMA
|
||||
/* Exports settings to other sheets if requested: */
|
||||
SCH_SCREEN* screen;
|
||||
|
@ -265,21 +261,19 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Search the correct index to activate the radiobox list size selection
|
||||
* according to the current page size
|
||||
*/
|
||||
void DIALOG_PAGES_SETTINGS::SearchPageSizeSelection()
|
||||
void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection()
|
||||
{
|
||||
Ki_PageDescr* sheet;
|
||||
int ii;
|
||||
wxString curPaperType = m_page.GetType();
|
||||
|
||||
m_CurrentSelection = NB_ITEMS - 1;
|
||||
|
||||
for( ii = 0; ii < NB_ITEMS; ii++ )
|
||||
for( unsigned i = 0; i < m_PageSizeBox->GetCount(); ++i )
|
||||
{
|
||||
sheet = SheetList[ii];
|
||||
|
||||
if( m_Parent->GetScreen()->m_CurrentSheetDesc == sheet )
|
||||
m_CurrentSelection = ii;
|
||||
if( m_PageSizeBox->GetString( i ) == curPaperType )
|
||||
{
|
||||
m_PageSizeBox->SetSelection( i );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// m_PageSizeBox->SetSelection( 1 ); // wxFormBuilder does this, control there
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
|
||||
{
|
||||
private:
|
||||
EDA_DRAW_FRAME *m_Parent;
|
||||
BASE_SCREEN * m_Screen;
|
||||
int m_Modified;
|
||||
Ki_PageDescr * m_SelectedSheet;
|
||||
float UserSizeX, UserSizeY;
|
||||
int m_CurrentSelection;
|
||||
EDA_DRAW_FRAME* m_Parent;
|
||||
BASE_SCREEN* m_Screen;
|
||||
bool m_modified;
|
||||
PAGE_INFO m_page; ///< the one being edited
|
||||
PAGE_INFO m_user_size; ///< instantiated just to get the size
|
||||
|
||||
public:
|
||||
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent );
|
||||
|
@ -37,7 +36,8 @@ private:
|
|||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
void SearchPageSizeSelection();
|
||||
|
||||
void setCurrentPageSizeSelection();
|
||||
void SavePageSettings(wxCommandEvent& event);
|
||||
void ReturnSizeSelected(wxCommandEvent& event);
|
||||
|
||||
|
|
|
@ -524,12 +524,11 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
|
|||
logicalClientSize.x = wxRound( (double) clientSize.x / scalar );
|
||||
logicalClientSize.y = wxRound( (double) clientSize.y / scalar );
|
||||
|
||||
// The upper left corner of the drawing in device units.
|
||||
int w = screen->ReturnPageSize().x;
|
||||
int h = screen->ReturnPageSize().y;
|
||||
// A corner of the drawing in internal units.
|
||||
wxSize corner = GetPageSizeIU();
|
||||
|
||||
// The drawing rectangle logical units
|
||||
wxRect drawingRect( wxPoint( 0, 0 ), wxSize( w, h ) );
|
||||
wxRect drawingRect( wxPoint( 0, 0 ), corner );
|
||||
|
||||
wxLogTrace( traceScrollSettings, wxT( "Logical drawing rect = ( %d, %d, %d, %d )." ),
|
||||
drawingRect.x, drawingRect.y, drawingRect.width, drawingRect.height );
|
||||
|
|
|
@ -527,23 +527,24 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
|
|||
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
|
||||
{
|
||||
int axis_color = BLUE;
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
if( GetParent()->IsGridVisible() )
|
||||
DrawGrid( DC );
|
||||
|
||||
/* Draw axis */
|
||||
// Draw axis
|
||||
if( GetParent()->m_showAxis )
|
||||
{
|
||||
/* Draw the Y axis */
|
||||
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
|
||||
0, screen->ReturnPageSize().y, 0, axis_color );
|
||||
wxSize pageSize = GetParent()->GetPageSizeIU();
|
||||
|
||||
/* Draw the X axis */
|
||||
GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
|
||||
screen->ReturnPageSize().x, 0, 0, axis_color );
|
||||
// Draw the Y axis
|
||||
GRDashedLine( &m_ClipBox, DC, 0, -pageSize.y,
|
||||
0, pageSize.y, 0, axis_color );
|
||||
|
||||
// Draw the X axis
|
||||
GRDashedLine( &m_ClipBox, DC, -pageSize.x, 0,
|
||||
pageSize.x, 0, 0, axis_color );
|
||||
}
|
||||
|
||||
if( GetParent()->m_showOriginAxis )
|
||||
|
@ -679,26 +680,26 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
|
|||
if( GetParent()->m_originAxisPosition == wxPoint( 0, 0 ) )
|
||||
return;
|
||||
|
||||
int Color = DARKRED;
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
int color = DARKRED;
|
||||
wxSize pageSize = GetParent()->GetPageSizeIU();
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
/* Draw the Y axis */
|
||||
// Draw the Y axis
|
||||
GRDashedLine( &m_ClipBox, aDC,
|
||||
GetParent()->m_originAxisPosition.x,
|
||||
-screen->ReturnPageSize().y,
|
||||
-pageSize.y,
|
||||
GetParent()->m_originAxisPosition.x,
|
||||
screen->ReturnPageSize().y,
|
||||
0, Color );
|
||||
pageSize.y,
|
||||
0, color );
|
||||
|
||||
/* Draw the X axis */
|
||||
// Draw the X axis
|
||||
GRDashedLine( &m_ClipBox, aDC,
|
||||
-screen->ReturnPageSize().x,
|
||||
-pageSize.x,
|
||||
GetParent()->m_originAxisPosition.y,
|
||||
screen->ReturnPageSize().x,
|
||||
pageSize.x,
|
||||
GetParent()->m_originAxisPosition.y,
|
||||
0, Color );
|
||||
0, color );
|
||||
}
|
||||
|
||||
|
||||
|
@ -710,25 +711,26 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
|
|||
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
|
||||
return;
|
||||
|
||||
int Color = GetParent()->GetGridColor();
|
||||
int color = GetParent()->GetGridColor();
|
||||
wxSize pageSize = GetParent()->GetPageSizeIU();
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
/* Draw the Y axis */
|
||||
// Draw the Y axis
|
||||
GRDashedLine( &m_ClipBox, aDC,
|
||||
screen->m_GridOrigin.x,
|
||||
-screen->ReturnPageSize().y,
|
||||
-pageSize.y,
|
||||
screen->m_GridOrigin.x,
|
||||
screen->ReturnPageSize().y,
|
||||
0, Color );
|
||||
pageSize.y,
|
||||
0, color );
|
||||
|
||||
/* Draw the X axis */
|
||||
// Draw the X axis
|
||||
GRDashedLine( &m_ClipBox, aDC,
|
||||
-screen->ReturnPageSize().x,
|
||||
-pageSize.x,
|
||||
screen->m_GridOrigin.y,
|
||||
screen->ReturnPageSize().x,
|
||||
pageSize.x,
|
||||
screen->m_GridOrigin.y,
|
||||
0, Color );
|
||||
0, color );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "build_version.h"
|
||||
|
||||
/* Must be defined in main applications: */
|
||||
// Must be defined in main applications:
|
||||
|
||||
Ki_WorkSheetData WS_Date =
|
||||
{
|
||||
|
@ -186,7 +186,9 @@ Ki_WorkSheetData WS_Comment4 =
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
|
||||
|
||||
/// Left vertical segment
|
||||
Ki_WorkSheetData WS_MostLeftLine =
|
||||
{
|
||||
WS_LEFT_SEGMENT,
|
||||
#if defined(KICAD_GOST)
|
||||
|
@ -200,8 +202,9 @@ Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
|
||||
* and comments */
|
||||
|
||||
/// horizontal segment between filename and comments
|
||||
Ki_WorkSheetData WS_SeparatorLine =
|
||||
{
|
||||
WS_SEGMENT,
|
||||
&WS_MostUpperLine,
|
||||
|
@ -211,7 +214,9 @@ Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
|
||||
|
||||
/// superior horizontal segment
|
||||
Ki_WorkSheetData WS_MostUpperLine =
|
||||
{
|
||||
WS_UPPER_SEGMENT,
|
||||
&WS_Segm3,
|
||||
|
@ -225,7 +230,9 @@ Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
|
||||
|
||||
/// horizontal segment above COMPANY NAME
|
||||
Ki_WorkSheetData WS_Segm3 =
|
||||
{
|
||||
WS_SEGMENT,
|
||||
&WS_Segm4,
|
||||
|
@ -239,7 +246,9 @@ Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
|
||||
|
||||
/// vertical segment of the left REV and SHEET
|
||||
Ki_WorkSheetData WS_Segm4 =
|
||||
{
|
||||
WS_SEGMENT,
|
||||
&WS_Segm5,
|
||||
|
@ -253,6 +262,7 @@ Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
Ki_WorkSheetData WS_Segm5 =
|
||||
{
|
||||
WS_SEGMENT,
|
||||
|
@ -267,6 +277,7 @@ Ki_WorkSheetData WS_Segm5 =
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
Ki_WorkSheetData WS_Segm6 =
|
||||
{
|
||||
WS_SEGMENT,
|
||||
|
@ -281,6 +292,7 @@ Ki_WorkSheetData WS_Segm6 =
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
Ki_WorkSheetData WS_Segm7 =
|
||||
{
|
||||
WS_SEGMENT,
|
||||
|
@ -989,14 +1001,14 @@ Ki_WorkSheetData WS_Segm5_LT =
|
|||
};
|
||||
|
||||
|
||||
/* Draw the page reference sheet.
|
||||
*/
|
||||
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width )
|
||||
{
|
||||
if( !m_showBorderAndTitleBlock )
|
||||
return;
|
||||
|
||||
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
|
||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
||||
wxSize pageSize = pageInfo.GetSizeMils();
|
||||
|
||||
int ii, jj, xg, yg, ipas, gxpas, gypas;
|
||||
wxPoint pos;
|
||||
int refx, refy;
|
||||
|
@ -1017,28 +1029,27 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
int width = line_width;
|
||||
|
||||
Color = RED;
|
||||
if( Sheet == NULL )
|
||||
{
|
||||
DisplayError( this,
|
||||
wxT( "EDA_DRAW_FRAME::TraceWorkSheet() error: NULL Sheet" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// if not printing, draw the page limits:
|
||||
if( !screen->m_IsPrinting & g_ShowPageLimits )
|
||||
{
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
GRRect( &DrawPanel->m_ClipBox, DC, 0, 0,
|
||||
Sheet->m_Size.x * scale, Sheet->m_Size.y * scale, width,
|
||||
pageSize.x * scale, pageSize.y * scale, width,
|
||||
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
|
||||
}
|
||||
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
/* Draw the border. */
|
||||
refx = Sheet->m_LeftMargin;
|
||||
refy = Sheet->m_TopMargin; /* Upper left corner */
|
||||
xg = Sheet->m_Size.x - Sheet->m_RightMargin;
|
||||
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
|
||||
|
||||
// Draw the border.
|
||||
|
||||
// Upper left corner
|
||||
refx = pageInfo.GetLeftMarginMils();
|
||||
refy = pageInfo.GetTopMarginMils();
|
||||
|
||||
// lower right corner
|
||||
xg = pageSize.x - pageInfo.GetRightMarginMils();
|
||||
yg = pageSize.y - pageInfo.GetBottomMarginMils();
|
||||
|
||||
#if defined(KICAD_GOST)
|
||||
GRRect( &DrawPanel->m_ClipBox, DC, refx * scale, refy * scale,
|
||||
|
@ -1056,10 +1067,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
|
||||
#endif
|
||||
|
||||
/* Draw the reference legends. */
|
||||
refx = Sheet->m_LeftMargin;
|
||||
// Draw the reference legends.
|
||||
refx = pageInfo.GetLeftMarginMils();
|
||||
|
||||
#if defined(KICAD_GOST)
|
||||
refy = Sheet->m_Size.y - Sheet->m_BottomMargin; /* Lower left corner */
|
||||
refy = pageSize.y - pageInfo.GetBottomMargin(); // Lower left corner
|
||||
for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
|
||||
{
|
||||
pos.x = ( refx - WsItem->m_Posx ) * scale;
|
||||
|
@ -1080,15 +1092,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
break;
|
||||
|
||||
case WS_SEGMENT_LU:
|
||||
xg = Sheet->m_LeftMargin - WsItem->m_Endx;
|
||||
yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy;
|
||||
xg = pageInfo.GetLeftMargin() - WsItem->m_Endx;
|
||||
yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
|
||||
xg * scale, yg * scale, width, Color );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
refy = Sheet->m_BottomMargin; /* Left Top corner */
|
||||
refy = pageInfo.GetBottomMarginMils(); // Left Top corner
|
||||
for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
|
||||
{
|
||||
pos.x = ( refx + WsItem->m_Posx ) * scale;
|
||||
|
@ -1097,8 +1109,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
switch( WsItem->m_Type )
|
||||
{
|
||||
case WS_SEGMENT_LT:
|
||||
xg = Sheet->m_LeftMargin + WsItem->m_Endx;
|
||||
yg = Sheet->m_BottomMargin + WsItem->m_Endy;
|
||||
xg = pageInfo.GetLeftMarginMils() + WsItem->m_Endx;
|
||||
yg = pageInfo.GetBottomMarginMils() + WsItem->m_Endy;
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
|
||||
xg * scale, yg * scale, width, Color );
|
||||
break;
|
||||
|
@ -1106,31 +1118,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
}
|
||||
|
||||
#else
|
||||
refy = Sheet->m_TopMargin; /* Upper left corner */
|
||||
xg = Sheet->m_Size.x - Sheet->m_RightMargin;
|
||||
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
|
||||
|
||||
// Upper left corner
|
||||
refy = pageInfo.GetTopMarginMils();
|
||||
|
||||
// lower right corner
|
||||
xg = pageSize.x - pageInfo.GetRightMarginMils();
|
||||
yg = pageSize.y - pageInfo.GetBottomMarginMils();
|
||||
|
||||
ipas = ( xg - refx ) / PAS_REF;
|
||||
gxpas = ( xg - refx ) / ipas;
|
||||
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
|
||||
{
|
||||
Line.Printf( wxT( "%d" ), jj );
|
||||
|
||||
if( ii < xg - PAS_REF / 2 )
|
||||
{
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, refy * scale,
|
||||
ii * scale, ( refy + GRID_REF_W ) * scale, width, Color );
|
||||
}
|
||||
|
||||
DrawGraphicText( DrawPanel, DC,
|
||||
wxPoint( ( ii - gxpas / 2 ) * scale,
|
||||
( refy + GRID_REF_W / 2 ) * scale ),
|
||||
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
width, false, false );
|
||||
|
||||
if( ii < xg - PAS_REF / 2 )
|
||||
{
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, yg * scale,
|
||||
ii * scale, ( yg - GRID_REF_W ) * scale, width, Color );
|
||||
}
|
||||
|
||||
DrawGraphicText( DrawPanel, DC,
|
||||
wxPoint( ( ii - gxpas / 2 ) * scale,
|
||||
( yg - GRID_REF_W / 2) * scale ),
|
||||
|
@ -1141,28 +1161,33 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
|
||||
ipas = ( yg - refy ) / PAS_REF;
|
||||
gypas = ( yg - refy ) / ipas;
|
||||
|
||||
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
|
||||
{
|
||||
if( jj < 26 )
|
||||
Line.Printf( wxT( "%c" ), jj + 'A' );
|
||||
else // I hope 52 identifiers are enought...
|
||||
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
|
||||
|
||||
if( ii < yg - PAS_REF / 2 )
|
||||
{
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, refx * scale, ii * scale,
|
||||
( refx + GRID_REF_W ) * scale, ii * scale, width, Color );
|
||||
}
|
||||
|
||||
DrawGraphicText( DrawPanel, DC,
|
||||
wxPoint( ( refx + GRID_REF_W / 2 ) * scale,
|
||||
( ii - gypas / 2 ) * scale ),
|
||||
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
width, false, false );
|
||||
|
||||
if( ii < yg - PAS_REF / 2 )
|
||||
{
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, xg * scale, ii * scale,
|
||||
( xg - GRID_REF_W ) * scale, ii * scale, width, Color );
|
||||
}
|
||||
|
||||
DrawGraphicText( DrawPanel, DC,
|
||||
wxPoint( ( xg - GRID_REF_W / 2 ) * scale,
|
||||
( ii - gxpas / 2 ) * scale ),
|
||||
|
@ -1174,8 +1199,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
#endif
|
||||
|
||||
#if defined(KICAD_GOST)
|
||||
refx = Sheet->m_Size.x - Sheet->m_RightMargin;
|
||||
refy = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
|
||||
// lower right corner
|
||||
refx = pageSize.x - pageInfo.GetRightMarginMils();
|
||||
refy = pageSize.y - pageInfo.GetBottomMarginMils();
|
||||
|
||||
if( screen->m_ScreenNumber == 1 )
|
||||
{
|
||||
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
|
||||
|
@ -1197,6 +1224,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
case WS_PODPIS:
|
||||
if( WsItem->m_Legende )
|
||||
msg = WsItem->m_Legende;
|
||||
|
||||
DrawGraphicText( DrawPanel, DC, pos, Color,
|
||||
msg, TEXT_ORIENT_HORIZ, size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
|
@ -1258,8 +1286,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
width,
|
||||
false, false );
|
||||
pos.x = (Sheet->m_LeftMargin + 1260) * scale;
|
||||
pos.y = (Sheet->m_TopMargin + 270) * scale;
|
||||
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
|
||||
pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
|
||||
DrawGraphicText( DrawPanel, DC, pos, Color,
|
||||
msg, 1800, size2,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
|
@ -1308,10 +1336,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
pos.y = ( refy - WsItem->m_Posy ) * scale;
|
||||
|
||||
case WS_SEGMENT:
|
||||
xg = Sheet->m_Size.x -
|
||||
Sheet->m_RightMargin - WsItem->m_Endx;
|
||||
yg = Sheet->m_Size.y -
|
||||
Sheet->m_BottomMargin - WsItem->m_Endy;
|
||||
xg = pageSize.x -
|
||||
pageInfo.GetRightMarginMils() - WsItem->m_Endx;
|
||||
yg = pageSize.y -
|
||||
pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
|
||||
xg * scale, yg * scale, width, Color );
|
||||
break;
|
||||
|
@ -1325,10 +1353,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
pos.x = ( refx - WsItem->m_Posx ) * scale;
|
||||
pos.y = ( refy - WsItem->m_Posy ) * scale;
|
||||
msg.Empty();
|
||||
|
||||
switch( WsItem->m_Type )
|
||||
{
|
||||
case WS_CADRE:
|
||||
/* Begin list number > 1 */
|
||||
// Begin list number > 1
|
||||
msg = screen->m_Commentaire1;
|
||||
if( !msg.IsEmpty() )
|
||||
{
|
||||
|
@ -1337,8 +1366,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
width,
|
||||
false, false );
|
||||
pos.x = (Sheet->m_LeftMargin + 1260) * scale;
|
||||
pos.y = (Sheet->m_TopMargin + 270) * scale;
|
||||
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
|
||||
pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
|
||||
DrawGraphicText( DrawPanel, DC, pos, Color,
|
||||
msg, 1800, size2,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
|
@ -1371,19 +1400,21 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
pos.y = ( refy - WsItem->m_Posy ) * scale;
|
||||
|
||||
case WS_SEGMENT_D:
|
||||
xg = Sheet->m_Size.x -
|
||||
Sheet->m_RightMargin - WsItem->m_Endx;
|
||||
yg = Sheet->m_Size.y -
|
||||
Sheet->m_BottomMargin - WsItem->m_Endy;
|
||||
xg = pageSize.x -
|
||||
pageInfo.GetRightMarginMils() - WsItem->m_Endx;
|
||||
yg = pageSize.y -
|
||||
pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
|
||||
xg * scale, yg * scale, width, Color );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
refx = Sheet->m_Size.x - Sheet->m_RightMargin - GRID_REF_W;
|
||||
refy = Sheet->m_Size.y - Sheet->m_BottomMargin - GRID_REF_W;
|
||||
|
||||
refx = pageSize.x - pageInfo.GetRightMarginMils() - GRID_REF_W;
|
||||
refy = pageSize.y - pageInfo.GetBottomMarginMils() - GRID_REF_W;
|
||||
|
||||
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
|
||||
{
|
||||
|
@ -1428,7 +1459,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
case WS_SIZESHEET:
|
||||
if( WsItem->m_Legende )
|
||||
msg = WsItem->m_Legende;
|
||||
msg += Sheet->m_Name;
|
||||
msg += pageInfo.GetType();
|
||||
DrawGraphicText( DrawPanel, DC, pos, Color,
|
||||
msg, TEXT_ORIENT_HORIZ, size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||
|
@ -1566,10 +1597,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
pos.y = (refy - WsItem->m_Posy) * scale;
|
||||
|
||||
case WS_SEGMENT:
|
||||
xg = Sheet->m_Size.x -
|
||||
GRID_REF_W - Sheet->m_RightMargin - WsItem->m_Endx;
|
||||
yg = Sheet->m_Size.y -
|
||||
GRID_REF_W - Sheet->m_BottomMargin - WsItem->m_Endy;
|
||||
xg = pageSize.x -
|
||||
GRID_REF_W - pageInfo.GetRightMarginMils() - WsItem->m_Endx;
|
||||
yg = pageSize.y -
|
||||
GRID_REF_W - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
|
||||
xg * scale, yg * scale, width, Color );
|
||||
break;
|
||||
|
@ -1580,33 +1611,26 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function GetXYSheetReferences
|
||||
* Return the X,Y sheet references where the point position is located
|
||||
* @param aScreen = screen to use
|
||||
* @param aPosition = position to identify by YX ref
|
||||
* @return a wxString containing the message locator like A3 or B6 (or ?? if out of page limits)
|
||||
*/
|
||||
wxString EDA_DRAW_FRAME::GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition )
|
||||
const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition )
|
||||
{
|
||||
Ki_PageDescr* Sheet = aScreen->m_CurrentSheetDesc;
|
||||
int ii, xg, yg, ipas, gxpas, gypas;
|
||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
||||
|
||||
int ii;
|
||||
int xg, yg;
|
||||
int ipas;
|
||||
int gxpas, gypas;
|
||||
int refx, refy;
|
||||
wxString msg;
|
||||
|
||||
if( Sheet == NULL )
|
||||
{
|
||||
DisplayError( this,
|
||||
wxT( "EDA_DRAW_FRAME::GetXYSheetReferences() error: NULL Sheet" ) );
|
||||
return msg;
|
||||
}
|
||||
// Upper left corner
|
||||
refx = pageInfo.GetLeftMarginMils();
|
||||
refy = pageInfo.GetTopMarginMils();
|
||||
|
||||
refx = Sheet->m_LeftMargin;
|
||||
refy = Sheet->m_TopMargin; /* Upper left corner */
|
||||
xg = Sheet->m_Size.x - Sheet->m_RightMargin;
|
||||
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
|
||||
// lower right corner
|
||||
xg = pageInfo.GetSizeMils().x - pageInfo.GetRightMarginMils();
|
||||
yg = pageInfo.GetSizeMils().y - pageInfo.GetBottomMarginMils();
|
||||
|
||||
/* Get the Y axis identifier (A symbol A ... Z) */
|
||||
// Get the Y axis identifier (A symbol A ... Z)
|
||||
if( aPosition.y < refy || aPosition.y > yg ) // Ouside of Y limits
|
||||
msg << wxT( "?" );
|
||||
else
|
||||
|
@ -1617,7 +1641,7 @@ wxString EDA_DRAW_FRAME::GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoi
|
|||
msg.Printf( wxT( "%c" ), 'A' + ii );
|
||||
}
|
||||
|
||||
/* Get the X axis identifier (A number 1 ... n) */
|
||||
// Get the X axis identifier (A number 1 ... n)
|
||||
if( aPosition.x < refx || aPosition.x > xg ) // Ouside of X limits
|
||||
msg << wxT( "?" );
|
||||
else
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
|
||||
class EDA_DRAW_FRAME;
|
||||
class BASE_SCREEN;
|
||||
|
||||
|
||||
#include "dialog_SVG_print_base.h"
|
||||
|
|
|
@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
|
|||
{
|
||||
#if defined(KICAD_GOST)
|
||||
strCur.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, GetChars( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
|
||||
msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
|
||||
strCur.Printf( wxT( "%c%s)" ), s_ExportSeparatorSymbol, GetChars( msg ) );
|
||||
#else
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol, TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
|
||||
msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
|
||||
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
|
||||
TO_UTF8( msg ) );
|
||||
#endif
|
||||
|
@ -762,7 +762,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
|
|||
else
|
||||
{
|
||||
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
|
||||
msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
|
||||
fprintf( f, " (loc %s)", TO_UTF8( msg ) );
|
||||
}
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
|
|||
{
|
||||
msg = aList[ii].GetSheetPath().PathHumanReadable();
|
||||
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->GetPosition() );
|
||||
msg = m_Parent->GetXYSheetReferences( DrawLibItem->GetPosition() );
|
||||
fprintf( f, " (loc %s)", TO_UTF8( msg ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
void initOptVars();
|
||||
void CreateDXFFile();
|
||||
void PlotOneSheetDXF( const wxString& FileName,
|
||||
SCH_SCREEN* screen, Ki_PageDescr* sheet,
|
||||
SCH_SCREEN* screen, PAGE_INFO* sheet,
|
||||
wxPoint plot_offset, double scale );
|
||||
};
|
||||
/* static members (static to remember last state): */
|
||||
|
@ -148,7 +148,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
|
|||
SCH_SHEET_PATH* sheetpath;
|
||||
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
|
||||
wxString PlotFileName;
|
||||
Ki_PageDescr* PlotSheet;
|
||||
PAGE_INFO* PlotSheet;
|
||||
wxPoint plot_offset;
|
||||
|
||||
/* When printing all pages, the printed page is not the current page.
|
||||
|
@ -208,7 +208,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
|
|||
|
||||
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
|
||||
SCH_SCREEN* screen,
|
||||
Ki_PageDescr* sheet,
|
||||
PAGE_INFO* sheet,
|
||||
wxPoint plot_offset,
|
||||
double scale )
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ enum PageFormatReq
|
|||
PAGE_SIZE_E
|
||||
};
|
||||
|
||||
static Ki_PageDescr* Plot_sheet_list[] =
|
||||
static PAGE_INFO* Plot_sheet_list[] =
|
||||
{
|
||||
NULL,
|
||||
&g_Sheet_A4,
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
void HPGL_Plot( bool aPlotAll );
|
||||
void Plot_Schematic_HPGL( bool aPlotAll, int HPGL_SheetSize );
|
||||
void Plot_1_Page_HPGL( const wxString& FileName,
|
||||
SCH_SCREEN* screen, Ki_PageDescr* sheet,
|
||||
SCH_SCREEN* screen, PAGE_INFO* sheet,
|
||||
wxPoint& offset, double plot_scale );
|
||||
void ReturnSheetDims( SCH_SCREEN* screen, wxSize& SheetSize, wxPoint& SheetOffset );
|
||||
};
|
||||
|
@ -245,7 +245,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
|
|||
|
||||
if( m_pageSizeSelect != PAGE_DEFAULT )
|
||||
{
|
||||
Ki_PageDescr* plot_sheet = Plot_sheet_list[m_pageSizeSelect];
|
||||
PAGE_INFO* plot_sheet = Plot_sheet_list[m_pageSizeSelect];
|
||||
wxString msg = m_PlotOrgPosition_X->GetValue();
|
||||
plot_sheet->m_Offset.x =
|
||||
ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
|
||||
|
@ -265,7 +265,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
|
|||
wxSize& SheetSize,
|
||||
wxPoint& SheetOffset )
|
||||
{
|
||||
Ki_PageDescr* PlotSheet;
|
||||
PAGE_INFO* PlotSheet;
|
||||
|
||||
if( screen == NULL )
|
||||
screen = m_Parent->GetScreen();
|
||||
|
@ -283,7 +283,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
|
|||
SCH_SCREEN* screen = m_Parent->GetScreen();
|
||||
SCH_SHEET_PATH* sheetpath;
|
||||
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
|
||||
Ki_PageDescr* PlotSheet;
|
||||
PAGE_INFO* PlotSheet;
|
||||
wxSize SheetSize;
|
||||
wxPoint SheetOffset, PlotOffset;
|
||||
|
||||
|
@ -353,7 +353,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
|
|||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
|
||||
SCH_SCREEN* screen,
|
||||
Ki_PageDescr* sheet,
|
||||
PAGE_INFO* sheet,
|
||||
wxPoint& offset,
|
||||
double plot_scale )
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
void initOptVars();
|
||||
void createPSFile();
|
||||
void plotOneSheetPS( const wxString& FileName,
|
||||
SCH_SCREEN* screen, Ki_PageDescr* sheet,
|
||||
SCH_SCREEN* screen, PAGE_INFO* sheet,
|
||||
wxPoint plot_offset, double scale );
|
||||
};
|
||||
/* static members (static to remember last state): */
|
||||
|
@ -176,8 +176,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
|
|||
SCH_SHEET_PATH* sheetpath;
|
||||
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
|
||||
wxString plotFileName;
|
||||
Ki_PageDescr* actualPage; // page size selected in schematic
|
||||
Ki_PageDescr* plotPage; // page size selected to plot
|
||||
PAGE_INFO* actualPage; // page size selected in schematic
|
||||
PAGE_INFO* plotPage; // page size selected to plot
|
||||
wxPoint plot_offset;
|
||||
|
||||
/* When printing all pages, the printed page is not the current page.
|
||||
|
@ -254,7 +254,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
|
|||
|
||||
void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
|
||||
SCH_SCREEN* screen,
|
||||
Ki_PageDescr* sheet,
|
||||
PAGE_INFO* sheet,
|
||||
wxPoint plot_offset,
|
||||
double scale )
|
||||
{
|
||||
|
|
|
@ -305,11 +305,11 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScre
|
|||
char Text[256];
|
||||
char buf[1024];
|
||||
int ii;
|
||||
Ki_PageDescr* wsheet = &g_Sheet_A4;
|
||||
PAGE_INFO* wsheet = &g_Sheet_A4;
|
||||
wxSize PageSize;
|
||||
char* line;
|
||||
|
||||
static Ki_PageDescr* SheetFormatList[] =
|
||||
static PAGE_INFO* SheetFormatList[] =
|
||||
{
|
||||
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
|
||||
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
|
||||
|
|
|
@ -101,7 +101,8 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
|
|||
{
|
||||
size_t i;
|
||||
|
||||
SetDrawItems( NULL ); /* Schematic items list */
|
||||
SetDrawItems( NULL ); // Schematic items list
|
||||
|
||||
m_Zoom = 32;
|
||||
|
||||
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
|
||||
|
@ -110,12 +111,12 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
|
|||
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
|
||||
AddGrid( SchematicGridList[i] );
|
||||
|
||||
SetGrid( wxRealPoint( 50, 50 ) ); /* Default grid size. */
|
||||
SetGrid( wxRealPoint( 50, 50 ) ); // Default grid size.
|
||||
m_refCount = 0;
|
||||
m_Center = false; /* Suitable for schematic only. For
|
||||
* libedit and viewlib, must be set
|
||||
* to true */
|
||||
InitDatas();
|
||||
|
||||
m_Center = false; // Suitable for schematic only. For
|
||||
// libedit and viewlib, must be set
|
||||
// to true
|
||||
}
|
||||
|
||||
|
||||
|
@ -1547,3 +1548,18 @@ int SCH_SCREENS::GetMarkerCount( int aMarkerType )
|
|||
|
||||
return count;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
// for now, make it look like XML, expand on this later.
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||
|
||||
for( EDA_ITEM* item = m_drawList; item; item = item->Next() )
|
||||
{
|
||||
item->Show( nestLevel+1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,7 @@ int g_DisplayPolygonsModeSketch;
|
|||
GERBER_IMAGE* g_GERBER_List[32];
|
||||
|
||||
// List of page sizes
|
||||
Ki_PageDescr* g_GerberPageSizeList[] =
|
||||
PAGE_INFO* g_GerberPageSizeList[] =
|
||||
{
|
||||
&g_Sheet_GERBER, // Full size page selection, and do not show page limits
|
||||
&g_Sheet_GERBER, // Full size page selection, and show page limits
|
||||
|
|
|
@ -19,7 +19,7 @@ class GERBVIEW_FRAME;
|
|||
//class BOARD;
|
||||
|
||||
class GERBER_IMAGE;
|
||||
class Ki_PageDescr;
|
||||
class PAGE_INFO;
|
||||
|
||||
|
||||
// Type of photoplotter action:
|
||||
|
@ -57,8 +57,6 @@ extern int g_DisplayPolygonsModeSketch;
|
|||
extern const wxString GerbviewProjectFileExt;
|
||||
extern const wxString GerbviewProjectFileWildcard;
|
||||
|
||||
extern Ki_PageDescr* g_GerberPageSizeList[];
|
||||
|
||||
// Interpolation type
|
||||
enum Gerb_Interpolation
|
||||
{
|
||||
|
|
|
@ -83,13 +83,13 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
|
|||
icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
SetScreen( new PCB_SCREEN() );
|
||||
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
|
||||
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
|
||||
|
||||
SetScreen( new PCB_SCREEN() );
|
||||
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
|
||||
|
||||
// Create the PCB_LAYER_WIDGET *after* SetBoard():
|
||||
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
int pointSize = font.GetPointSize();
|
||||
|
@ -209,17 +209,15 @@ void GERBVIEW_FRAME::LoadSettings()
|
|||
|
||||
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
|
||||
|
||||
long pageSize_opt;
|
||||
config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l );
|
||||
int imax = 0;
|
||||
wxString pageType;
|
||||
|
||||
for( ; g_GerberPageSizeList[imax] != NULL; imax++ )
|
||||
;
|
||||
config->Read( GerbviewShowPageSizeOption, &pageType, wxT( "GERBER" ) );
|
||||
|
||||
if( pageSize_opt < 0 || pageSize_opt >= imax )
|
||||
pageSize_opt = 0;
|
||||
PAGE_INFO pageInfo( pageType );
|
||||
|
||||
GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt];
|
||||
SetPageSettings( pageInfo );
|
||||
|
||||
GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
|
||||
|
||||
if( pageSize_opt > 0 )
|
||||
{
|
||||
|
@ -268,7 +266,7 @@ void GERBVIEW_FRAME::SaveSettings()
|
|||
}
|
||||
}
|
||||
|
||||
config->Write( GerbviewShowPageSizeOption, pageSize_opt );
|
||||
config->Write( GerbviewShowPageSizeOption, GetPageSettings().GetType() );
|
||||
config->Write( GerbviewShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
|
||||
// Save the drill file history list.
|
||||
// Because we have 2 file histories, we must save this one
|
||||
|
|
|
@ -70,6 +70,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
|
|||
|
||||
SetScreen( new PCB_SCREEN() );
|
||||
GetScreen()->Init();
|
||||
|
||||
setActiveLayer(FIRST_COPPER_LAYER);
|
||||
m_LayersManager->UpdateLayerIcons();
|
||||
syncLayerBox();
|
||||
|
|
|
@ -37,11 +37,10 @@
|
|||
#include "common.h"
|
||||
|
||||
|
||||
// Forward declarations:
|
||||
class Ki_PageDescr;
|
||||
|
||||
|
||||
/* Simple class for handling grid arrays. */
|
||||
/**
|
||||
* Class GRID_TYPE
|
||||
* is for grid arrays.
|
||||
*/
|
||||
class GRID_TYPE
|
||||
{
|
||||
public:
|
||||
|
@ -59,7 +58,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
const bool operator==( const GRID_TYPE& item ) const
|
||||
{
|
||||
return m_Size == item.m_Size && m_Id == item.m_Id;
|
||||
|
@ -72,13 +70,12 @@ typedef std::vector< GRID_TYPE > GRIDS;
|
|||
|
||||
/**
|
||||
* Class BASE_SCREEN
|
||||
* handle how to draw a screen (a board, a schematic ...)
|
||||
* handles how to draw a screen (a board, a schematic ...)
|
||||
*/
|
||||
class BASE_SCREEN : public EDA_ITEM
|
||||
{
|
||||
EDA_ITEMS m_items; ///< The drawing items associated with this screen.
|
||||
GRIDS m_grids; ///< List of valid grid sizes.
|
||||
EDA_ITEM* m_drawList; ///< Object list for the screen.
|
||||
wxString m_fileName; ///< File used to load the screen.
|
||||
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
|
||||
bool m_FlagModified; ///< Indicates current drawing has been modified.
|
||||
|
@ -96,18 +93,19 @@ class BASE_SCREEN : public EDA_ITEM
|
|||
wxPoint m_crossHairPosition;
|
||||
|
||||
public:
|
||||
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
|
||||
wxPoint m_DrawOrg; ///< offsets for drawing the circuit on the screen
|
||||
|
||||
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
|
||||
* in user units. (coordinates from last reset position)*/
|
||||
|
||||
// Scrollbars management:
|
||||
int m_ScrollPixelsPerUnitX; /* Pixels per scroll unit in the horizontal direction. */
|
||||
int m_ScrollPixelsPerUnitY; /* Pixels per scroll unit in the vertical direction. */
|
||||
int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
|
||||
int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
|
||||
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
|
||||
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
|
||||
* virtual draw area size in pixels */
|
||||
wxPoint m_ScrollbarPos; /* Current scroll bar position in scroll units. */
|
||||
|
||||
wxPoint m_ScrollbarPos; ///< Current scroll bar position in scroll units.
|
||||
|
||||
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
|
||||
* view position (upper left corner of device)
|
||||
|
@ -121,15 +119,13 @@ public:
|
|||
bool m_FirstRedraw;
|
||||
|
||||
// Undo/redo list of commands
|
||||
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
|
||||
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
|
||||
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
|
||||
UNDO_REDO_CONTAINER m_UndoList; ///< Objects list for the undo command (old data)
|
||||
UNDO_REDO_CONTAINER m_RedoList; ///< Objects list for the redo command (old data)
|
||||
unsigned m_UndoRedoCountMax; ///< undo/Redo command Max depth
|
||||
|
||||
/* block control */
|
||||
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
|
||||
// block control
|
||||
BLOCK_SELECTOR m_BlockLocate; ///< Block description for block commands
|
||||
|
||||
/* Page description */
|
||||
Ki_PageDescr* m_CurrentSheetDesc;
|
||||
int m_ScreenNumber;
|
||||
int m_NumberOfScreen;
|
||||
|
||||
|
@ -145,8 +141,8 @@ public:
|
|||
/* Grid and zoom values. */
|
||||
wxPoint m_GridOrigin;
|
||||
|
||||
wxArrayDouble m_ZoomList; /* Array of standard zoom (i.e. scale) coefficients. */
|
||||
double m_Zoom; /* Current zoom coefficient. */
|
||||
wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients.
|
||||
double m_Zoom; ///< Current zoom coefficient.
|
||||
bool m_IsPrinting;
|
||||
|
||||
public:
|
||||
|
@ -162,24 +158,12 @@ public:
|
|||
|
||||
EDA_ITEM* GetCurItem() const { return m_CurrentItem; }
|
||||
|
||||
/**
|
||||
* Function GetDrawItems().
|
||||
*
|
||||
* @return - A pointer to the first item in the linked list of draw items.
|
||||
*/
|
||||
virtual EDA_ITEM* GetDrawItems() const { return m_drawList; }
|
||||
|
||||
virtual void SetDrawItems( EDA_ITEM* aItem ) { m_drawList = aItem; }
|
||||
|
||||
void InitDatas();
|
||||
void InitDataPoints( const wxSize& aPageSizeInternalUnits );
|
||||
|
||||
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
|
||||
|
||||
wxString GetFileName() const { return m_fileName; }
|
||||
|
||||
void SetPageSize( wxSize& aPageSize );
|
||||
wxSize ReturnPageSize( void );
|
||||
|
||||
/**
|
||||
* Function GetInternalUnits
|
||||
* @return the screen units scalar.
|
||||
|
@ -469,9 +453,8 @@ public:
|
|||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif // CLASS_BASE_SCREEN_H_
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* @file class_pcb_screen.h
|
||||
*/
|
||||
|
||||
#ifndef __CLASSPCB_SCREEN_H__
|
||||
#define __CLASSPCB_SCREEN_H__
|
||||
#ifndef CLASS_PCB_SCREEN_H_
|
||||
#define CLASS_PCB_SCREEN_H_
|
||||
|
||||
|
||||
#include "class_base_screen.h"
|
||||
|
@ -26,17 +26,17 @@ public:
|
|||
~PCB_SCREEN();
|
||||
|
||||
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
|
||||
void Init();
|
||||
|
||||
void SetNextZoom();
|
||||
void SetPreviousZoom();
|
||||
void SetLastZoom();
|
||||
|
||||
virtual int GetInternalUnits( void );
|
||||
virtual int GetInternalUnits();
|
||||
|
||||
/**
|
||||
* Function GetCurItem
|
||||
* returns the currently selected BOARD_ITEM, overriding
|
||||
*BASE_SCREEN::GetCurItem().
|
||||
* BASE_SCREEN::GetCurItem().
|
||||
* @return BOARD_ITEM* - the one selected, or NULL.
|
||||
*/
|
||||
BOARD_ITEM* GetCurItem() const
|
||||
|
@ -73,5 +73,4 @@ public:
|
|||
void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
|
||||
};
|
||||
|
||||
|
||||
#endif /* __CLASSPCB_SCREEN_H__ */
|
||||
#endif // CLASS_PCB_SCREEN_H_
|
||||
|
|
|
@ -55,7 +55,7 @@ enum SCH_LINE_TEST_T
|
|||
};
|
||||
|
||||
|
||||
/* Max number of sheets in a hierarchy project: */
|
||||
/// Max number of sheets in a hierarchy project
|
||||
#define NB_MAX_SHEET 500
|
||||
|
||||
|
||||
|
@ -64,6 +64,12 @@ class SCH_SCREEN : public BASE_SCREEN
|
|||
int m_refCount; ///< Number of sheets referencing this screen.
|
||||
///< Delete when it goes to zero.
|
||||
|
||||
/// The size of the paper to print or plot on
|
||||
PAGE_INFO m_paper; // keep with the MVC model as this class gets split
|
||||
|
||||
SCH_ITEM* m_drawList; ///< Object list for the screen.
|
||||
/// @todo use DLIST<SCH_ITEM> or superior container
|
||||
|
||||
/**
|
||||
* Function addConnectedItemsToBlock
|
||||
* add items connected at \a aPosition to the block pick list.
|
||||
|
@ -85,6 +91,9 @@ public:
|
|||
return wxT( "SCH_SCREEN" );
|
||||
}
|
||||
|
||||
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
||||
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
||||
|
||||
void DecRefCount();
|
||||
|
||||
void IncRefCount();
|
||||
|
@ -93,12 +102,10 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetDrawItems().
|
||||
*
|
||||
* @return - A pointer to the first item in the linked list of draw items.
|
||||
*/
|
||||
virtual SCH_ITEM* GetDrawItems() const { return (SCH_ITEM*) BASE_SCREEN::GetDrawItems(); }
|
||||
|
||||
virtual void SetDrawItems( SCH_ITEM* aItem ) { BASE_SCREEN::SetDrawItems( aItem ); }
|
||||
SCH_ITEM* GetDrawItems() const { return m_drawList; }
|
||||
void SetDrawItems( SCH_ITEM* aItem ) { m_drawList = aItem; }
|
||||
|
||||
/**
|
||||
* Function GetCurItem
|
||||
|
@ -456,6 +463,10 @@ public:
|
|||
{
|
||||
BASE_SCREEN::InsertItem( aIter, (EDA_ITEM*) aItem );
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
117
include/common.h
117
include/common.h
|
@ -32,10 +32,13 @@
|
|||
#ifndef INCLUDE__COMMON_H_
|
||||
#define INCLUDE__COMMON_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/confbase.h"
|
||||
#include "wx/fileconf.h"
|
||||
|
||||
|
||||
class wxAboutDialogInfo;
|
||||
class BASE_SCREEN;
|
||||
class EDA_DRAW_FRAME;
|
||||
|
@ -54,12 +57,11 @@ class EDA_DRAW_PANEL;
|
|||
* flag for block commands
|
||||
*/
|
||||
|
||||
// default name for nameless projects
|
||||
/// default name for nameless projects
|
||||
#define NAMELESS_PROJECT wxT( "noname" )
|
||||
|
||||
#define NB_ITEMS 11
|
||||
|
||||
/* Pseudo key codes for command panning */
|
||||
/// Pseudo key codes for command panning
|
||||
enum pseudokeys {
|
||||
EDA_PANNING_UP_KEY = 1,
|
||||
EDA_PANNING_DOWN_KEY,
|
||||
|
@ -124,40 +126,103 @@ enum EDA_UNITS_T {
|
|||
class LibNameList;
|
||||
|
||||
|
||||
/* Class to handle pages sizes:
|
||||
class PAGE_INFO;
|
||||
|
||||
/**
|
||||
* Class PAGE_INFO
|
||||
* describes the page size and margins of a paper page on which to
|
||||
* eventually print or plot. Since paper is often described in inches,
|
||||
* (and due to legacy code), inches, mils, and internal units (IU) are supported
|
||||
* in the accessors. Again, we are describing paper in this class.
|
||||
*/
|
||||
class Ki_PageDescr
|
||||
class PAGE_INFO
|
||||
{
|
||||
// All sizes are in 1/1000 inch
|
||||
public:
|
||||
wxSize m_Size; /* page size in 1/1000 inch */
|
||||
wxPoint m_Offset; /* plot offset in 1/1000 inch */
|
||||
wxString m_Name;
|
||||
PAGE_INFO( const wxString& aType = wxT( "A3" ) );
|
||||
PAGE_INFO( const wxSize& aSizeMils, const wxPoint& aOffsetMils, const wxString& aName );
|
||||
|
||||
const wxString& GetType() const { return m_Type; }
|
||||
|
||||
/**
|
||||
* Function SetType
|
||||
* sets the name of the page type and also the sizes and margins
|
||||
* commonly associated with that type name.
|
||||
*
|
||||
* @param aStandardPageDescriptionName is a wxString constant giving one of:
|
||||
* "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", or "User". If "User"
|
||||
* then the width and height are custom, and will be set according to previous calls
|
||||
* to static PAGE_INFO::SetUserWidthInches( double aWidthInInches ) and
|
||||
* static PAGE_INFO::SetUserHeightInches( double aHeightInInches );
|
||||
*
|
||||
* @return bool - true iff @a aStandarePageDescription was a recognized type.
|
||||
*/
|
||||
bool SetType( const wxString& aStandardPageDescriptionName );
|
||||
|
||||
void SetWidthInches( double aWidthInInches );
|
||||
void SetHeightInches( double aHeightInInches );
|
||||
|
||||
double GetWidthInches() const { return m_widthInches; }
|
||||
double GetHeightInches() const { return m_heightInches; }
|
||||
|
||||
int GetWidthMils() const { return int( 1000 * m_widthInches ); }
|
||||
int GetHeightMils() const { return int( 1000 * m_heightInches ); }
|
||||
const wxSize GetSizeMils() const { return wxSize( GetWidthMils(), GetHeightMils() ); }
|
||||
|
||||
// accessors returning Internal Units
|
||||
#if defined(PCBNEW)
|
||||
# if defined(KICAD_NANOMETRE)
|
||||
int GetWidthIU() const { return int( 2.54e7 * m_widthInches ); }
|
||||
int GetHeightIU() const { return int( 2.54e7 * m_heightInches ); }
|
||||
# else
|
||||
int GetWidthIU() const { return int( 10000 * m_widthInches ); }
|
||||
int GetHeightIU() const { return int( 10000 * m_heightInches ); }
|
||||
# endif
|
||||
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
|
||||
#elif defined(EESCHEMA)
|
||||
int GetWidthIU() const { return int( 1000 * m_widthInches ); }
|
||||
int GetHeightIU() const { return int( 1000 * m_heightInches ); }
|
||||
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
|
||||
#endif
|
||||
|
||||
wxPoint GetOffsetMils() const { return m_Offset; }
|
||||
|
||||
int GetLeftMarginMils() const { return m_LeftMargin; }
|
||||
int GetRightMarginMils() const { return m_RightMargin; }
|
||||
int GetTopMarginMils() const { return m_TopMargin; }
|
||||
int GetBottomMarginMils() const { return m_BottomMargin; }
|
||||
|
||||
/**
|
||||
* Function SetUserWidthInches
|
||||
* sets the width of type "User" page in inches.
|
||||
*/
|
||||
static void SetUserWidthInches( double aWidthInInches );
|
||||
|
||||
/**
|
||||
* Function SetUserHeightInches
|
||||
* sets the height type "User" page in inches.
|
||||
*/
|
||||
static void SetUserHeightInches( double aHeightInInches );
|
||||
|
||||
#define PAGE_INFO_COUNT 11 ///< count of standard page sizes
|
||||
|
||||
private:
|
||||
wxString m_Type; ///< paper type: A4, A3, etc.
|
||||
|
||||
double m_widthInches;
|
||||
double m_heightInches;
|
||||
|
||||
wxPoint m_Offset; ///< plot offset in 1/1000 inches
|
||||
|
||||
int m_LeftMargin;
|
||||
int m_RightMargin;
|
||||
int m_TopMargin;
|
||||
int m_BottomMargin;
|
||||
|
||||
public:
|
||||
Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name );
|
||||
static double s_user_height;
|
||||
static double s_user_width;
|
||||
};
|
||||
|
||||
|
||||
extern Ki_PageDescr g_Sheet_A4;
|
||||
extern Ki_PageDescr g_Sheet_A3;
|
||||
extern Ki_PageDescr g_Sheet_A2;
|
||||
extern Ki_PageDescr g_Sheet_A1;
|
||||
extern Ki_PageDescr g_Sheet_A0;
|
||||
extern Ki_PageDescr g_Sheet_A;
|
||||
extern Ki_PageDescr g_Sheet_B;
|
||||
extern Ki_PageDescr g_Sheet_C;
|
||||
extern Ki_PageDescr g_Sheet_D;
|
||||
extern Ki_PageDescr g_Sheet_E;
|
||||
extern Ki_PageDescr g_Sheet_GERBER;
|
||||
extern Ki_PageDescr g_Sheet_user;
|
||||
extern Ki_PageDescr* g_SheetSizeList[];
|
||||
|
||||
|
||||
extern wxString g_ProductName;
|
||||
|
||||
/* Default user lib path can be left void, if the standard lib path is used */
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include "drawtxt.h"
|
||||
|
||||
|
||||
class Ki_PageDescr;
|
||||
|
||||
#include "common.h" // PAGE_INFO
|
||||
|
||||
/**
|
||||
* Enum PlotFormat
|
||||
|
@ -27,6 +24,7 @@ enum PlotFormat {
|
|||
PLOT_FORMAT_DXF
|
||||
};
|
||||
|
||||
|
||||
class PLOTTER
|
||||
{
|
||||
public:
|
||||
|
@ -70,8 +68,8 @@ public: PLOTTER( PlotFormat aPlotType );
|
|||
return color_mode;
|
||||
}
|
||||
|
||||
void SetPageSettings( const PAGE_INFO& aPageSettings );
|
||||
|
||||
virtual void set_paper_size( Ki_PageDescr* sheet );
|
||||
virtual void set_current_line_width( int width ) = 0;
|
||||
virtual void set_default_line_width( int width ) = 0;
|
||||
virtual void set_color( int color ) = 0;
|
||||
|
@ -226,7 +224,7 @@ protected:
|
|||
bool plotMirror;
|
||||
wxString creator;
|
||||
wxString filename;
|
||||
Ki_PageDescr* sheet;
|
||||
PAGE_INFO pageInfo;
|
||||
wxSize paper_size;
|
||||
};
|
||||
|
||||
|
|
|
@ -112,6 +112,10 @@ public:
|
|||
*/
|
||||
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
|
||||
|
||||
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
|
||||
const PAGE_INFO& GetPageSettings() const; // overload
|
||||
const wxSize GetPageSizeIU() const; // overload
|
||||
|
||||
/**
|
||||
* Function SetBoard
|
||||
* sets the m_Pcb member in such as way as to ensure deleting any previous
|
||||
|
|
|
@ -72,7 +72,7 @@ class EDA_DRAW_PANEL;
|
|||
class EDA_MSG_PANEL;
|
||||
class BASE_SCREEN;
|
||||
class PARAM_CFG_BASE;
|
||||
class Ki_PageDescr;
|
||||
class PAGE_INFO;
|
||||
class PLOTTER;
|
||||
|
||||
enum id_librarytype {
|
||||
|
@ -449,6 +449,16 @@ public:
|
|||
|
||||
~EDA_DRAW_FRAME();
|
||||
|
||||
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
|
||||
virtual const PAGE_INFO& GetPageSettings() const = 0;
|
||||
|
||||
/**
|
||||
* Function GetPageSizeIU
|
||||
* works off of GetPageSettings() to return the size of the paper page in
|
||||
* the internal units of this particular view.
|
||||
*/
|
||||
virtual const wxSize GetPageSizeIU() const = 0;
|
||||
|
||||
wxPoint GetOriginAxisPosition() const { return m_originAxisPosition; }
|
||||
|
||||
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
|
||||
|
@ -653,13 +663,13 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetXYSheetReferences
|
||||
* Return the X,Y sheet references where the point position is located
|
||||
* returns the X,Y sheet references where the point position is located
|
||||
* @param aScreen = screen to use
|
||||
* @param aPosition = position to identify by YX ref
|
||||
* @return a wxString containing the message locator like A3 or B6
|
||||
* (or ?? if out of page limits)
|
||||
*/
|
||||
wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition );
|
||||
const wxString GetXYSheetReferences( const wxPoint& aPosition );
|
||||
|
||||
void DisplayToolMsg( const wxString& msg );
|
||||
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
||||
|
|
|
@ -125,6 +125,33 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
|||
m_Pcb = aBoard;
|
||||
}
|
||||
|
||||
void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
||||
{
|
||||
wxASSERT( m_Pcb );
|
||||
m_Pcb->SetPageSettings( aPageSettings );
|
||||
}
|
||||
|
||||
|
||||
const PAGE_INFO& PCB_BASE_FRAME::GetPageSettings() const
|
||||
{
|
||||
wxASSERT( m_Pcb );
|
||||
return m_Pcb->GetPageSettings();
|
||||
}
|
||||
|
||||
|
||||
const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
|
||||
{
|
||||
wxASSERT( m_Pcb );
|
||||
const PAGE_INFO& page = m_Pcb->GetPageSettings();
|
||||
|
||||
// convert paper size into internal units.
|
||||
#if defined( KICAD_NANOMETRE )
|
||||
return page.GetSizeMils() * 25400; // nanometers
|
||||
#else
|
||||
return page.GetSizeMils() * 10; // deci-mils
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
|
||||
{
|
||||
|
@ -134,18 +161,17 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
|
|||
|
||||
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
|
||||
{
|
||||
wxSize pageSize = GetPageSizeIU();
|
||||
|
||||
if( m_showBorderAndTitleBlock )
|
||||
{
|
||||
area.SetOrigin( 0, 0 );
|
||||
area.SetEnd( GetScreen()->ReturnPageSize().x,
|
||||
GetScreen()->ReturnPageSize().y );
|
||||
area.SetEnd( pageSize.x, pageSize.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
area.SetOrigin( -GetScreen()->ReturnPageSize().x / 2,
|
||||
-GetScreen()->ReturnPageSize().y / 2 );
|
||||
area.SetEnd( GetScreen()->ReturnPageSize().x / 2,
|
||||
GetScreen()->ReturnPageSize().y / 2 );
|
||||
area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
|
||||
area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "class_pad.h"
|
||||
#include "class_colors_design_settings.h"
|
||||
#include "class_board_design_settings.h"
|
||||
|
||||
#include "common.h" // PAGE_INFO
|
||||
|
||||
class PCB_BASE_FRAME;
|
||||
class PCB_EDIT_FRAME;
|
||||
|
@ -27,7 +27,7 @@ class D_PAD;
|
|||
class MARKER_PCB;
|
||||
|
||||
|
||||
// buffer of item candidates when search for items on the same track.
|
||||
// non-owning container of item candidates when searching for items on the same track.
|
||||
typedef std::vector< TRACK* > TRACK_PTRS;
|
||||
|
||||
|
||||
|
@ -174,6 +174,7 @@ private:
|
|||
|
||||
BOARD_DESIGN_SETTINGS m_designSettings;
|
||||
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
|
||||
PAGE_INFO m_paper;
|
||||
|
||||
/**
|
||||
* Function chainMarkedSegments
|
||||
|
@ -534,15 +535,14 @@ public:
|
|||
*/
|
||||
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings );
|
||||
|
||||
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
||||
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
||||
|
||||
/**
|
||||
* Function SetBoardSettings
|
||||
* @return the current COLORS_DESIGN_SETTINGS in use
|
||||
*/
|
||||
COLORS_DESIGN_SETTINGS* GetColorsSettings() const
|
||||
{
|
||||
return m_colorsSettings;
|
||||
}
|
||||
|
||||
COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; }
|
||||
|
||||
/**
|
||||
* Function SetColorsSettings
|
||||
|
@ -553,7 +553,6 @@ public:
|
|||
m_colorsSettings = aColorsSettings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function GetLayerName
|
||||
* returns the name of the layer given by aLayerIndex.
|
||||
|
|
|
@ -184,12 +184,9 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
|
|||
|
||||
text.Empty();
|
||||
|
||||
for( int ii = 0; ii < PADNAMEZ; ii++ )
|
||||
for( int ii = 0; ii < PADNAMEZ && m_Padname[ii]; ii++ )
|
||||
{
|
||||
if( !m_Padname[ii] )
|
||||
break;
|
||||
|
||||
// add an unsigned 8 bit byte, which is LATIN1 or CRYLIC
|
||||
// m_Padname is 8 bit KiCad font junk, do not sign extend
|
||||
text.Append( (unsigned char) m_Padname[ii] );
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -197,9 +197,9 @@ public:
|
|||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor );
|
||||
/**
|
||||
* Function SetDrillValue
|
||||
* Function SetDrill
|
||||
* Set the drill value for vias
|
||||
* @param drill_value = new drill value
|
||||
* @param aDrill is the new drill diameter
|
||||
*/
|
||||
void SetDrill( int aDrill ) { m_Drill = aDrill; }
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static const double PcbZoomList[] =
|
|||
};
|
||||
|
||||
#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
|
||||
#define MM_TO_PCB_UNITS 10000.0 / 25.4
|
||||
#define MM_TO_PCB_UNITS (10000.0 / 25.4)
|
||||
|
||||
|
||||
/* Default grid sizes for PCB editor screens. */
|
||||
|
@ -82,8 +82,13 @@ PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( SCREEN_T )
|
|||
for( i = 0; i < PCB_GRID_LIST_CNT; i++ )
|
||||
AddGrid( PcbGridList[i] );
|
||||
|
||||
SetGrid( wxRealPoint( 500, 500 ) ); /* Set the working grid size to a reasonnable value (in 1/10000 inch) */
|
||||
Init();
|
||||
// Set the working grid size to a reasonnable value (in 1/10000 inch)
|
||||
SetGrid( wxRealPoint( 500, 500 ) );
|
||||
|
||||
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
|
||||
m_Route_Layer_TOP = LAYER_N_FRONT; // default layers pair for vias (bottom to top)
|
||||
m_Route_Layer_BOTTOM = LAYER_N_BACK;
|
||||
m_Zoom = 150; // a default value for zoom
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,17 +98,7 @@ PCB_SCREEN::~PCB_SCREEN()
|
|||
}
|
||||
|
||||
|
||||
void PCB_SCREEN::Init()
|
||||
{
|
||||
InitDatas();
|
||||
m_Active_Layer = LAYER_N_BACK; /* default active layer = bottom layer */
|
||||
m_Route_Layer_TOP = LAYER_N_FRONT; /* default layers pair for vias (bottom to top) */
|
||||
m_Route_Layer_BOTTOM = LAYER_N_BACK;
|
||||
m_Zoom = 150; /* a default value for zoom */
|
||||
}
|
||||
|
||||
|
||||
int PCB_SCREEN::GetInternalUnits( void )
|
||||
int PCB_SCREEN::GetInternalUnits()
|
||||
{
|
||||
return PCB_INTERNAL_UNIT;
|
||||
}
|
||||
|
|
|
@ -226,39 +226,40 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
|
|||
BASE_SCREEN* screen,
|
||||
bool aPrint_Frame_Ref )
|
||||
{
|
||||
// const PAGE_INFO& pageInfo = m_Parent->GetPageSettings();
|
||||
|
||||
LOCALE_IO toggle;
|
||||
int tmpzoom;
|
||||
wxPoint tmp_startvisu;
|
||||
wxSize SheetSize; // Sheet size in internal units
|
||||
wxPoint old_org;
|
||||
bool success = true;
|
||||
|
||||
/* Change frames and local settings */
|
||||
// Change frames and local settings
|
||||
tmp_startvisu = screen->m_StartVisu;
|
||||
tmpzoom = screen->GetZoom();
|
||||
old_org = screen->m_DrawOrg;
|
||||
|
||||
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
|
||||
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
|
||||
SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
||||
SheetSize.x *= m_Parent->GetInternalUnits() / 1000;
|
||||
SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in pixels
|
||||
|
||||
screen->SetScalingFactor( 1.0 );
|
||||
float dpi = (float)m_Parent->GetInternalUnits();
|
||||
|
||||
EDA_DRAW_PANEL* panel = m_Parent->DrawPanel;
|
||||
|
||||
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
|
||||
// to print floating point numbers like 1.3)
|
||||
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
|
||||
// paper pageSize is in internal units, either nanometers or deci-mils
|
||||
wxSize pageSize = m_Parent->GetPageSizeIU();
|
||||
|
||||
wxSVGFileDC dc( FullFileName, pageSize.x, pageSize.y, dpi );
|
||||
|
||||
EDA_RECT tmp = panel->m_ClipBox;
|
||||
GRResetPenAndBrush( &dc );
|
||||
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true );
|
||||
s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
|
||||
|
||||
|
||||
panel->m_ClipBox.SetX( 0 );
|
||||
panel->m_ClipBox.SetY( 0 );
|
||||
|
||||
// Set clip box to the max size
|
||||
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
|
||||
// and that allows calculations without overflow
|
||||
|
@ -275,7 +276,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
|
|||
|
||||
m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
|
||||
g_DrawBgColor = bg_color;
|
||||
SetLocaleTo_Default(); // revert to the current locale
|
||||
|
||||
screen->m_IsPrinting = false;
|
||||
panel->m_ClipBox = tmp;
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ private:
|
|||
static bool m_createRpt; // true to create a drill file report
|
||||
static int m_createMap; // > 0 to create a map file report
|
||||
|
||||
public: DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
|
||||
public:
|
||||
DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
|
||||
~DIALOG_GENDRILL();
|
||||
|
||||
private:
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||
Ki_PageDescr* aSheet,
|
||||
const PAGE_INFO& aSheet,
|
||||
std::vector<HOLE_INFO> aHoleListBuffer,
|
||||
std::vector<DRILL_TOOL> aToolListBuffer,
|
||||
bool aUnit_Drill_is_Inch, int format,
|
||||
|
@ -37,8 +37,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
wxPoint offset;
|
||||
wxString msg;
|
||||
PLOTTER* plotter = NULL;
|
||||
|
||||
SetLocaleTo_C_standard(); // Use the standard notation for float numbers
|
||||
LOCALE_IO toggle; // use standard notation for float numbers
|
||||
|
||||
// Calculate dimensions and center of PCB
|
||||
EDA_RECT bbbox = aPcb->ComputeBoundingBox();
|
||||
|
@ -58,7 +57,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
plotter->set_viewport( offset, scale, 0 );
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_HPGL: /* Scale for HPGL format. */
|
||||
case PLOT_FORMAT_HPGL: // Scale for HPGL format.
|
||||
{
|
||||
offset.x = 0;
|
||||
offset.y = 0;
|
||||
|
@ -68,29 +67,29 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
hpgl_plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
|
||||
hpgl_plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
|
||||
hpgl_plotter->set_pen_overlap( 0 );
|
||||
plotter->set_paper_size( aSheet );
|
||||
plotter->SetPageSettings( aSheet );
|
||||
plotter->set_viewport( offset, scale, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_POST:
|
||||
{
|
||||
Ki_PageDescr* SheetPS = &g_Sheet_A4;
|
||||
wxSize SheetSize;
|
||||
SheetSize.x = SheetPS->m_Size.x * U_PCB;
|
||||
SheetSize.y = SheetPS->m_Size.y * U_PCB;
|
||||
/* Keep size for drill legend */
|
||||
double Xscale = (double) ( SheetSize.x * 0.8 ) / dX;
|
||||
double Yscale = (double) ( SheetSize.y * 0.6 ) / dY;
|
||||
PAGE_INFO pageA4( wxT( "A4" ) );
|
||||
wxSize pageSizeIU = pageA4.GetSizeIU();
|
||||
|
||||
// Keep size for drill legend
|
||||
double Xscale = (double) ( pageSizeIU.x * 0.8 ) / dX;
|
||||
double Yscale = (double) ( pageSizeIU.y * 0.6 ) / dY;
|
||||
|
||||
scale = MIN( Xscale, Yscale );
|
||||
|
||||
offset.x = (int) ( (double) BoardCentre.x - ( (double) SheetSize.x / 2.0 ) / scale );
|
||||
offset.y = (int) ( (double) BoardCentre.y - ( (double) SheetSize.y / 2.0 ) / scale );
|
||||
offset.y += SheetSize.y / 8; /* offset to legend */
|
||||
offset.x = (int) ( (double) BoardCentre.x - ( (double) pageSizeIU.x / 2.0 ) / scale );
|
||||
offset.y = (int) ( (double) BoardCentre.y - ( (double) pageSizeIU.y / 2.0 ) / scale );
|
||||
|
||||
offset.y += pageSizeIU.y / 8; // offset to legend
|
||||
PS_PLOTTER* ps_plotter = new PS_PLOTTER;
|
||||
plotter = ps_plotter;
|
||||
ps_plotter->set_paper_size( SheetPS );
|
||||
ps_plotter->SetPageSettings( pageA4 );
|
||||
plotter->set_viewport( offset, scale, 0 );
|
||||
break;
|
||||
}
|
||||
|
@ -102,7 +101,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
scale = 1;
|
||||
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
|
||||
plotter = dxf_plotter;
|
||||
plotter->set_paper_size( aSheet );
|
||||
plotter->SetPageSettings( aSheet );
|
||||
plotter->set_viewport( offset, scale, 0 );
|
||||
break;
|
||||
}
|
||||
|
@ -116,7 +115,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
plotter->set_default_line_width( 10 );
|
||||
plotter->start_plot( aFile );
|
||||
|
||||
/* Draw items on edge layer */
|
||||
// Draw items on edge layer
|
||||
|
||||
for( PtStruct = aPcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
|
@ -154,19 +153,19 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
// Plot board outlines and drill map
|
||||
Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer );
|
||||
|
||||
/* Print a list of symbols used. */
|
||||
CharSize = 800; /* text size in 1/10000 mils */
|
||||
// Print a list of symbols used.
|
||||
CharSize = 800; // text size in 1/10000 mils
|
||||
double CharScale = 1.0 / scale; /* real scale will be CharScale
|
||||
* scale_x, because the global
|
||||
* plot scale is scale_x */
|
||||
TextWidth = (int) ( (CharSize * CharScale) / 10 ); // Set text width (thickness)
|
||||
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
|
||||
|
||||
/* Trace information. */
|
||||
// Trace information.
|
||||
plotX = (int) ( (double) bbbox.GetX() + 200.0 * CharScale );
|
||||
plotY = bbbox.GetBottom() + intervalle;
|
||||
|
||||
/* Plot title "Info" */
|
||||
// Plot title "Info"
|
||||
wxString Text = wxT( "Drill Map:" );
|
||||
plotter->text( wxPoint( plotX, plotY ), BLACK, Text, 0,
|
||||
wxSize( (int) ( CharSize * CharScale ),
|
||||
|
@ -188,7 +187,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
y = (int) ( (double) plotY + (double) CharSize * CharScale );
|
||||
plotter->marker( wxPoint( x, y ), plot_diam, ii );
|
||||
|
||||
/* Trace the legends. */
|
||||
// Trace the legends.
|
||||
|
||||
// List the diameter of each drill in the selected Drill Unit,
|
||||
// and then its diameter in the other Drill Unit.
|
||||
|
@ -235,7 +234,6 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
|||
|
||||
plotter->end_plot();
|
||||
delete plotter;
|
||||
SetLocaleTo_Default(); // Revert to local notation for float numbers
|
||||
}
|
||||
|
||||
|
||||
|
@ -251,7 +249,7 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
|
|||
{
|
||||
wxPoint pos;
|
||||
|
||||
/* create the drill list */
|
||||
// create the drill list
|
||||
if( aToolListBuffer.size() > 13 )
|
||||
{
|
||||
DisplayInfoMessage( NULL,
|
||||
|
|
|
@ -635,7 +635,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
|
|||
GenDrillMapFile( m_Parent->GetBoard(),
|
||||
plotfile,
|
||||
dlg.GetPath(),
|
||||
m_Parent->GetScreen()->m_CurrentSheetDesc,
|
||||
m_Parent->GetPageSettings(),
|
||||
s_HoleListBuffer,
|
||||
s_ToolListBuffer,
|
||||
m_UnitDrillIsInch,
|
||||
|
|
|
@ -217,7 +217,7 @@ void Build_Holes_List( BOARD* aPcb, std::vector<HOLE_INFO>& aHoleListBuffer,
|
|||
void GenDrillMapFile( BOARD* aPcb,
|
||||
FILE* aFile,
|
||||
const wxString& aFullFileName,
|
||||
Ki_PageDescr* aSheet,
|
||||
const PAGE_INFO& aSheet,
|
||||
std::vector<HOLE_INFO> aHoleListBuffer,
|
||||
std::vector<DRILL_TOOL> aToolListBuffer,
|
||||
bool aUnit_Drill_is_Inch,
|
||||
|
|
|
@ -42,21 +42,22 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
|||
SetBoard( new BOARD() );
|
||||
SetCurItem( NULL );
|
||||
|
||||
/* clear filename, to avoid overwriting an old file */
|
||||
// clear filename, to avoid overwriting an old file
|
||||
GetScreen()->GetFileName().Empty();
|
||||
|
||||
/* Init new grid size */
|
||||
wxRealPoint gridsize = GetScreen()->GetGridSize();
|
||||
GetScreen()->Init();
|
||||
GetScreen()->SetGrid( gridsize );
|
||||
// preserve grid size accross call to InitDataPoints()
|
||||
|
||||
// wxRealPoint gridsize = GetScreen()->GetGridSize();
|
||||
GetScreen()->InitDataPoints( GetPageSizeIU() );
|
||||
// GetScreen()->SetGrid( gridsize );
|
||||
|
||||
GetBoard()->ResetHighLight();
|
||||
|
||||
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
|
||||
GetBoard()->SetEnabledLayers(ALL_LAYERS);
|
||||
GetBoard()->SetEnabledLayers( ALL_LAYERS );
|
||||
|
||||
// Default copper layers count set to 2: double layer board
|
||||
GetBoard()->SetCopperLayerCount(2);
|
||||
GetBoard()->SetCopperLayerCount( 2 );
|
||||
|
||||
// Update display:
|
||||
GetBoard()->SetVisibleLayers( ALL_LAYERS );
|
||||
|
@ -91,15 +92,15 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
|||
// Delete the current footprint
|
||||
GetBoard()->m_Modules.DeleteAll();
|
||||
|
||||
/* init pointeurs et variables */
|
||||
// init pointeurs et variables
|
||||
GetScreen()->GetFileName().Empty();
|
||||
|
||||
SetCurItem( NULL );
|
||||
|
||||
/* Init parametres de gestion */
|
||||
wxRealPoint gridsize = GetScreen()->GetGridSize();
|
||||
GetScreen()->Init();
|
||||
GetScreen()->SetGrid( gridsize );
|
||||
// preserve grid size accross call to InitDataPoints()
|
||||
// wxRealPoint gridsize = GetScreen()->GetGridSize();
|
||||
GetScreen()->InitDataPoints( GetPageSizeIU() );
|
||||
// GetScreen()->SetGrid( gridsize );
|
||||
|
||||
Zoom_Automatique( false );
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ public:
|
|||
* implementation knows about, or it can be used to write a portion of
|
||||
* aBoard to a special kind of export file.
|
||||
*
|
||||
* @param aFileType is the PCB_FILE_T of file to save.
|
||||
*
|
||||
* @param aFileName is the name of a file to save to on disk.
|
||||
* @param aBoard is the BOARD document (data tree) to save or export to disk.
|
||||
*
|
||||
|
|
|
@ -786,7 +786,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
|
|||
EDA_ITEM* PtStruct = GetBoard()->m_Modules;
|
||||
int NbModules, NbDrawItem, NbLayers;
|
||||
|
||||
/* Write copper layer count */
|
||||
// Write copper layer count
|
||||
NbLayers = GetBoard()->GetCopperLayerCount();
|
||||
fprintf( File, "$GENERAL\n" );
|
||||
fprintf( File, "encoding utf-8\n");
|
||||
|
@ -801,7 +801,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
|
|||
fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() );
|
||||
fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect );
|
||||
|
||||
// Write Bounding box info
|
||||
// Write board's bounding box info
|
||||
EDA_RECT bbbox = GetBoard()->ComputeBoundingBox();
|
||||
fprintf( File, "Di %d %d %d %d\n",
|
||||
bbbox.GetX(),
|
||||
|
@ -809,8 +809,8 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
|
|||
bbbox.GetRight(),
|
||||
bbbox.GetBottom() );
|
||||
|
||||
/* Write segment count for footprints, drawings, track and zones */
|
||||
/* Calculate the footprint count */
|
||||
// Write segment count for footprints, drawings, track and zones
|
||||
// Calculate the footprint count
|
||||
for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
NbModules++;
|
||||
|
||||
|
@ -836,13 +836,14 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
|
|||
* @param screen BASE_SCREEN to save
|
||||
* @param File = an open FILE to write info
|
||||
*/
|
||||
bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
|
||||
static bool WriteSheetDescr( const PAGE_INFO& aPageSettings, BASE_SCREEN* screen, FILE* File )
|
||||
{
|
||||
Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
|
||||
|
||||
fprintf( File, "$SHEETDESCR\n" );
|
||||
fprintf( File, "Sheet %s %d %d\n",
|
||||
TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y );
|
||||
TO_UTF8( aPageSettings.GetType() ),
|
||||
aPageSettings.GetSizeMils().x,
|
||||
aPageSettings.GetSizeMils().y );
|
||||
|
||||
fprintf( File, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
|
||||
fprintf( File, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
|
||||
fprintf( File, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
|
||||
|
@ -859,7 +860,7 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
|
|||
|
||||
#if !defined( USE_NEW_PCBNEW_LOAD )
|
||||
|
||||
static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
|
||||
static bool ReadSheetDescr( BOARD* aBoard, BASE_SCREEN* screen, LINE_READER* aReader )
|
||||
{
|
||||
char buf[1024];
|
||||
char* text;
|
||||
|
@ -873,34 +874,43 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
|
|||
|
||||
if( strnicmp( line, "Sheet", 4 ) == 0 )
|
||||
{
|
||||
text = strtok( line, " \t\n\r" );
|
||||
text = strtok( NULL, " \t\n\r" );
|
||||
Ki_PageDescr* sheet = g_SheetSizeList[0];
|
||||
int ii;
|
||||
// e.g. "Sheet A3 16535 11700"
|
||||
// width and height are in 1/1000th of an inch, always
|
||||
|
||||
for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
|
||||
PAGE_INFO page;
|
||||
char* sname = strtok( line + SZ( "Sheet" ), delims );
|
||||
|
||||
if( sname )
|
||||
{
|
||||
if( stricmp( TO_UTF8( sheet->m_Name ), text ) == 0 )
|
||||
wxString wname = FROM_UTF8( sname );
|
||||
if( !page.SetType( wname ) )
|
||||
{
|
||||
screen->m_CurrentSheetDesc = sheet;
|
||||
|
||||
if( sheet == &g_Sheet_user )
|
||||
{
|
||||
text = strtok( NULL, " \t\n\r" );
|
||||
|
||||
if( text )
|
||||
sheet->m_Size.x = atoi( text );
|
||||
|
||||
text = strtok( NULL, " \t\n\r" );
|
||||
|
||||
if( text )
|
||||
sheet->m_Size.y = atoi( text );
|
||||
m_error.Printf( _( "Unknown sheet type '%s' on line:%d" ),
|
||||
wname.GetData(), m_reader->LineNumber() );
|
||||
THROW_IO_ERROR( m_error );
|
||||
}
|
||||
|
||||
break;
|
||||
// only parse the width and height if page size is "User"
|
||||
if( wname == wxT( "User" ) )
|
||||
{
|
||||
char* width = strtok( line, delims );
|
||||
char* height = strtok( line, delims );
|
||||
|
||||
if( width && height )
|
||||
{
|
||||
// legacy disk file describes paper in mils
|
||||
// (1/1000th of an inch)
|
||||
int w = intParse( width );
|
||||
int h = intParse( height );
|
||||
|
||||
page.SetWidthInches( w / 1000.0 );
|
||||
page.SetHeightInches( h / 1000.0 );
|
||||
}
|
||||
}
|
||||
|
||||
aBoard->SetPageSettings( page );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1108,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
|
|||
|
||||
if( TESTLINE( "SHEETDESCR" ) )
|
||||
{
|
||||
ReadSheetDescr( GetScreen(), aReader );
|
||||
ReadSheetDescr( board, GetScreen(), aReader );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1172,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
|
|||
// like 1.3)
|
||||
LOCALE_IO toggle;
|
||||
|
||||
/* Writing file header. */
|
||||
// Writing file header.
|
||||
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION,
|
||||
TO_UTF8( DateAndTime() ) );
|
||||
fprintf( aFile, "# Created by Pcbnew%s\n\n", TO_UTF8( GetBuildVersion() ) );
|
||||
|
@ -1174,7 +1184,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
|
|||
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
|
||||
|
||||
WriteGeneralDescrPcb( aFile );
|
||||
WriteSheetDescr( GetScreen(), aFile );
|
||||
WriteSheetDescr( GetBoard()->GetPageSettings(), GetScreen(), aFile );
|
||||
WriteSetup( aFile, this, GetBoard() );
|
||||
|
||||
rc = GetBoard()->Save( aFile );
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
/// C string compare test for a specific length of characters.
|
||||
/// The -1 is to omit the trailing \0 which is included in sizeof() on a
|
||||
/// string constant.
|
||||
#define TESTLINE( x ) (strncmp( line, x, sizeof(x) - 1 ) == 0)
|
||||
#define TESTLINE( x ) (strnicmp( line, x, sizeof(x)-1 ) == 0)
|
||||
|
||||
/// Get the length of a string constant, at compile time
|
||||
#define SZ( x ) (sizeof(x)-1)
|
||||
|
@ -440,7 +440,6 @@ void KICAD_PLUGIN::loadGENERAL()
|
|||
void KICAD_PLUGIN::loadSHEET()
|
||||
{
|
||||
char buf[260];
|
||||
char* text;
|
||||
|
||||
while( READLINE() )
|
||||
{
|
||||
|
@ -448,34 +447,42 @@ void KICAD_PLUGIN::loadSHEET()
|
|||
|
||||
if( TESTLINE( "Sheet" ) )
|
||||
{
|
||||
text = strtok( line, delims );
|
||||
text = strtok( NULL, delims );
|
||||
// e.g. "Sheet A3 16535 11700"
|
||||
// width and height are in 1/1000th of an inch, always
|
||||
|
||||
Ki_PageDescr* sheet = g_SheetSizeList[0];
|
||||
int ii;
|
||||
PAGE_INFO page;
|
||||
char* sname = strtok( line + SZ( "Sheet" ), delims );
|
||||
|
||||
for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
|
||||
if( sname )
|
||||
{
|
||||
if( !stricmp( TO_UTF8( sheet->m_Name ), text ) )
|
||||
wxString wname = FROM_UTF8( sname );
|
||||
if( !page.SetType( wname ) )
|
||||
{
|
||||
// @todo screen->m_CurrentSheetDesc = sheet;
|
||||
|
||||
if( sheet == &g_Sheet_user )
|
||||
{
|
||||
text = strtok( NULL, delims );
|
||||
|
||||
if( text )
|
||||
sheet->m_Size.x = intParse( text );
|
||||
|
||||
text = strtok( NULL, delims );
|
||||
|
||||
if( text )
|
||||
sheet->m_Size.y = intParse( text );
|
||||
m_error.Printf( _( "Unknown sheet type '%s' on line:%d" ),
|
||||
wname.GetData(), m_reader->LineNumber() );
|
||||
THROW_IO_ERROR( m_error );
|
||||
}
|
||||
|
||||
break;
|
||||
// only parse the width and height if page size is "User"
|
||||
if( wname == wxT( "User" ) )
|
||||
{
|
||||
char* width = strtok( line, delims );
|
||||
char* height = strtok( line, delims );
|
||||
|
||||
if( width && height )
|
||||
{
|
||||
// legacy disk file describes paper in mils
|
||||
// (1/1000th of an inch)
|
||||
int w = intParse( width );
|
||||
int h = intParse( height );
|
||||
|
||||
page.SetWidthInches( w / 1000.0 );
|
||||
page.SetHeightInches( h / 1000.0 );
|
||||
}
|
||||
}
|
||||
|
||||
m_board->SetPageSettings( page );
|
||||
}
|
||||
}
|
||||
|
||||
else if( TESTLINE( "Title" ) )
|
||||
|
@ -2727,14 +2734,17 @@ void KICAD_PLUGIN::saveGENERAL() const
|
|||
|
||||
void KICAD_PLUGIN::saveSHEET() const
|
||||
{
|
||||
#if 0 // @todo sheet not available here. The sheet needs to go into the board if it is important enough to be saved with the board
|
||||
Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
|
||||
const PAGE_INFO& pageInfo = m_board->GetPageSettings();
|
||||
|
||||
fprintf( m_fp, "$SHEETDESCR\n" );
|
||||
|
||||
// paper is described in mils
|
||||
fprintf( m_fp, "Sheet %s %d %d\n",
|
||||
TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y ); // in mm ?
|
||||
TO_UTF8( pageInfo.GetType() ),
|
||||
pageInfo.GetSizeMils().x,
|
||||
pageInfo.GetSizeMils().y );
|
||||
|
||||
#if 0 // @todo sheet not available here. The sheet needs to go into the board if it is important enough to be saved with the board
|
||||
fprintf( m_fp, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
|
||||
fprintf( m_fp, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
|
||||
fprintf( m_fp, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
|
||||
|
@ -2744,8 +2754,9 @@ void KICAD_PLUGIN::saveSHEET() const
|
|||
fprintf( m_fp, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
|
||||
fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
|
||||
|
||||
fprintf( m_fp, "$EndSHEETDESCR\n\n" );
|
||||
#endif
|
||||
|
||||
fprintf( m_fp, "$EndSHEETDESCR\n\n" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -3077,26 +3088,29 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
|
|||
THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_FORMAT, me->GetShape() ) );
|
||||
}
|
||||
|
||||
// universal character set padname
|
||||
wxString padname = me->GetPadName();
|
||||
#if BOARD_FORMAT_VERSION == 1 // saving mode is a compile time option
|
||||
|
||||
#if BOARD_FORMAT_VERSION == 1
|
||||
wxString wpadname = me->GetPadName(); // universal character set padname
|
||||
std::string spadname;
|
||||
|
||||
char mypadname[PADNAMEZ+1];
|
||||
|
||||
int i;
|
||||
for( i = 0; i<PADNAMEZ && padname[i]; ++i )
|
||||
for( unsigned i = 0; wpadname.size(); ++i )
|
||||
{
|
||||
// truncate from universal character down to 8 bit foreign jibber jabber byte
|
||||
mypadname[i] = (char) padname[i];
|
||||
// truncate from universal character down to 8 bit foreign jibber
|
||||
// jabber byte. This basically duplicates what was done in the old
|
||||
// BOARD_FORMAT_VERSION 1 code. Any characters that were in the 8 bit
|
||||
// character space were OK.
|
||||
spadname += (char) wpadname[i];
|
||||
}
|
||||
|
||||
mypadname[i] = 0;
|
||||
|
||||
fprintf( m_fp, "Sh \"%s\" %c %s %s %s\n",
|
||||
mypadname, // probably ASCII, but possibly jibber jabber
|
||||
spadname.c_str(), // probably ASCII, but possibly jibber jabber
|
||||
#else
|
||||
|
||||
fprintf( m_fp, "Sh %s %c %s %s %s\n",
|
||||
// legacy VERSION 2 simply uses UTF8, wrapped in quotes,
|
||||
// and 99.99 % of the time there is no difference between 1 & 2,
|
||||
// since ASCII is a subset of UTF8. But if they were not using
|
||||
// ASCII pad names, then there is a difference in the file.
|
||||
EscapedUTF8( me->GetPadName() ).c_str(),
|
||||
#endif
|
||||
cshape,
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
* updates d so that the values are correct (goes through target's
|
||||
* neighbours making sure that the distances between them and the tree
|
||||
* are indeed minimum)
|
||||
* @param target = index of curr item
|
||||
* @param aTarget = index of curr item
|
||||
*/
|
||||
void updateDistances( int aTarget );
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
|
||||
GRTraceMode aTraceMode )
|
||||
{
|
||||
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
||||
LOCALE_IO toggle;
|
||||
|
||||
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
|
||||
|
||||
|
@ -27,10 +27,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
|
|||
return false;
|
||||
}
|
||||
|
||||
SetLocaleTo_C_standard();
|
||||
|
||||
DXF_PLOTTER* plotter = new DXF_PLOTTER();
|
||||
plotter->set_paper_size( currentsheet );
|
||||
plotter->SetPageSettings( GetPageSettings() );
|
||||
plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
|
||||
plotter->set_creator( wxT( "PCBNEW-DXF" ) );
|
||||
plotter->set_filename( aFullFileName );
|
||||
|
@ -42,7 +40,5 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
|
|||
Plot_Layer( plotter, aLayer, aTraceMode );
|
||||
plotter->end_plot();
|
||||
delete plotter;
|
||||
SetLocaleTo_Default();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,13 +20,12 @@
|
|||
bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer,
|
||||
GRTraceMode aTraceMode )
|
||||
{
|
||||
wxSize SheetSize;
|
||||
wxSize BoardSize;
|
||||
wxPoint BoardCenter;
|
||||
bool Center = false;
|
||||
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
||||
wxSize boardSize;
|
||||
wxPoint boardCenter;
|
||||
bool center = false;
|
||||
double scale;
|
||||
wxPoint offset;
|
||||
LOCALE_IO toggle;
|
||||
|
||||
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
|
||||
|
||||
|
@ -52,29 +51,26 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
|||
g_PcbPlotOptions.m_PlotScale );
|
||||
|
||||
|
||||
SetLocaleTo_C_standard();
|
||||
|
||||
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
|
||||
Center = true; // when scale != 1.0 we must calculate the position in page
|
||||
{
|
||||
// when scale != 1.0 we must calculate the position in page
|
||||
// because actual position has no meaning
|
||||
center = true;
|
||||
}
|
||||
|
||||
// Scale units from 0.0001" to HPGL plot units.
|
||||
SheetSize.x = currentsheet->m_Size.x * U_PCB;
|
||||
SheetSize.y = currentsheet->m_Size.y * U_PCB;
|
||||
wxSize pageSizeIU = GetPageSizeIU();
|
||||
|
||||
// Calculate the center of the PCB
|
||||
EDA_RECT bbbox = GetBoardBoundingBox();
|
||||
|
||||
BoardSize = bbbox.GetSize();
|
||||
BoardCenter = bbbox.Centre();
|
||||
boardSize = bbbox.GetSize();
|
||||
boardCenter = bbbox.Centre();
|
||||
|
||||
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
|
||||
{
|
||||
double Xscale, Yscale;
|
||||
|
||||
// Fit to 80% of the page
|
||||
Xscale = ( ( SheetSize.x * 0.8 ) / BoardSize.x );
|
||||
Yscale = ( ( SheetSize.y * 0.8 ) / BoardSize.y );
|
||||
double Xscale = ( ( pageSizeIU.x * 0.8 ) / boardSize.x );
|
||||
double Yscale = ( ( pageSizeIU.y * 0.8 ) / boardSize.y );
|
||||
scale = MIN( Xscale, Yscale );
|
||||
}
|
||||
else
|
||||
|
@ -83,12 +79,12 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
|||
}
|
||||
|
||||
// Calculate the page size offset.
|
||||
if( Center )
|
||||
if( center )
|
||||
{
|
||||
offset.x = wxRound( (double) BoardCenter.x -
|
||||
( (double) SheetSize.x / 2.0 ) / scale );
|
||||
offset.y = wxRound( (double) BoardCenter.y -
|
||||
( (double) SheetSize.y / 2.0 ) / scale );
|
||||
offset.x = wxRound( (double) boardCenter.x -
|
||||
( (double) pageSizeIU.x / 2.0 ) / scale );
|
||||
offset.y = wxRound( (double) boardCenter.y -
|
||||
( (double) pageSizeIU.y / 2.0 ) / scale );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -97,7 +93,9 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
|||
}
|
||||
|
||||
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
|
||||
plotter->set_paper_size( currentsheet );
|
||||
|
||||
plotter->SetPageSettings( GetPageSettings() );
|
||||
|
||||
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
|
||||
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
|
||||
plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
|
||||
|
@ -108,14 +106,13 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
|
|||
plotter->set_pen_diameter( pen_diam );
|
||||
plotter->start_plot( output_file );
|
||||
|
||||
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
|
||||
if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
|
||||
// The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
|
||||
if( g_PcbPlotOptions.m_PlotFrameRef && !center )
|
||||
PlotWorkSheet( plotter, GetScreen() );
|
||||
|
||||
Plot_Layer( plotter, aLayer, aTraceMode );
|
||||
plotter->end_plot();
|
||||
delete plotter;
|
||||
SetLocaleTo_Default();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,15 +24,19 @@
|
|||
bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int aLayer,
|
||||
bool aUseA4, GRTraceMode aTraceMode )
|
||||
{
|
||||
wxSize SheetSize;
|
||||
wxSize PaperSize;
|
||||
wxSize BoardSize;
|
||||
wxPoint BoardCenter;
|
||||
bool Center = false;
|
||||
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
||||
double scale, paperscale;
|
||||
Ki_PageDescr* SheetPS;
|
||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
||||
|
||||
wxSize paperSizeIU;
|
||||
wxSize boardSize;
|
||||
wxPoint boardCenter;
|
||||
bool center = false;
|
||||
double scale;
|
||||
double paperscale;
|
||||
wxPoint offset;
|
||||
LOCALE_IO toggle;
|
||||
PAGE_INFO pageA4( wxT( "A4" ) );
|
||||
|
||||
const PAGE_INFO* sheetPS;
|
||||
|
||||
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
|
||||
|
||||
|
@ -41,45 +45,43 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
|
|||
return false;
|
||||
}
|
||||
|
||||
SetLocaleTo_C_standard();
|
||||
|
||||
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
|
||||
Center = true; // when scale != 1.0 we must calculate the position in page
|
||||
{
|
||||
// when scale != 1.0 we must calculate the position in page
|
||||
// because actual position has no meaning
|
||||
center = true;
|
||||
}
|
||||
|
||||
// Set default line width
|
||||
if( g_PcbPlotOptions.m_PlotLineWidth < 1 )
|
||||
g_PcbPlotOptions.m_PlotLineWidth = 1;
|
||||
|
||||
SheetSize.x = currentsheet->m_Size.x * U_PCB;
|
||||
SheetSize.y = currentsheet->m_Size.y * U_PCB;
|
||||
wxSize pageSizeIU = GetPageSizeIU();
|
||||
|
||||
if( aUseA4 )
|
||||
{
|
||||
SheetPS = &g_Sheet_A4;
|
||||
PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB;
|
||||
PaperSize.y = g_Sheet_A4.m_Size.y * U_PCB;
|
||||
paperscale = (float) PaperSize.x / SheetSize.x;
|
||||
sheetPS = &pageA4;
|
||||
paperSizeIU = pageA4.GetSizeIU();
|
||||
paperscale = (double) paperSizeIU.x / pageSizeIU.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
SheetPS = currentsheet;
|
||||
PaperSize = SheetSize;
|
||||
sheetPS = &pageInfo;
|
||||
paperSizeIU = pageSizeIU;
|
||||
paperscale = 1;
|
||||
}
|
||||
|
||||
EDA_RECT bbbox = GetBoardBoundingBox();
|
||||
|
||||
BoardSize = bbbox.GetSize();
|
||||
BoardCenter = bbbox.Centre();
|
||||
boardSize = bbbox.GetSize();
|
||||
boardCenter = bbbox.Centre();
|
||||
|
||||
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
|
||||
{
|
||||
double Xscale, Yscale;
|
||||
|
||||
// Fit to 80% of the page
|
||||
Xscale = (PaperSize.x * 0.8) / BoardSize.x;
|
||||
Yscale = (PaperSize.y * 0.8) / BoardSize.y;
|
||||
double Xscale = (paperSizeIU.x * 0.8) / boardSize.x;
|
||||
double Yscale = (paperSizeIU.y * 0.8) / boardSize.y;
|
||||
|
||||
scale = MIN( Xscale, Yscale );
|
||||
}
|
||||
else
|
||||
|
@ -87,10 +89,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
|
|||
scale = g_PcbPlotOptions.m_PlotScale * paperscale;
|
||||
}
|
||||
|
||||
if( Center )
|
||||
if( center )
|
||||
{
|
||||
offset.x = wxRound( (double) BoardCenter.x - ( (double) PaperSize.x / 2.0 ) / scale );
|
||||
offset.y = wxRound( (double) BoardCenter.y - ( (double) PaperSize.y / 2.0 ) / scale );
|
||||
offset.x = wxRound( (double) boardCenter.x - ( (double) paperSizeIU.x / 2.0 ) / scale );
|
||||
offset.y = wxRound( (double) boardCenter.y - ( (double) paperSizeIU.y / 2.0 ) / scale );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -99,7 +101,9 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
|
|||
}
|
||||
|
||||
PS_PLOTTER* plotter = new PS_PLOTTER();
|
||||
plotter->set_paper_size( SheetPS );
|
||||
|
||||
plotter->SetPageSettings( *sheetPS );
|
||||
|
||||
plotter->set_scale_adjust( g_PcbPlotOptions.m_FineScaleAdjustX,
|
||||
g_PcbPlotOptions.m_FineScaleAdjustY );
|
||||
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
|
||||
|
@ -109,7 +113,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
|
|||
plotter->start_plot( output_file );
|
||||
|
||||
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
|
||||
if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
|
||||
if( g_PcbPlotOptions.m_PlotFrameRef && !center )
|
||||
PlotWorkSheet( plotter, GetScreen() );
|
||||
|
||||
// If plot a negative board:
|
||||
|
@ -131,7 +135,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
|
|||
Plot_Layer( plotter, aLayer, aTraceMode );
|
||||
plotter->end_plot();
|
||||
delete plotter;
|
||||
SetLocaleTo_Default();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,12 +31,11 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
bool aPrintMirrorMode,
|
||||
void * aData)
|
||||
{
|
||||
MODULE* Module;
|
||||
int drawmode = GR_COPY;
|
||||
DISPLAY_OPTIONS save_opt;
|
||||
BOARD* Pcb = GetBoard();
|
||||
int defaultPenSize = 50;
|
||||
|
||||
DISPLAY_OPTIONS save_opt;
|
||||
|
||||
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
|
||||
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
|
||||
|
||||
|
@ -74,21 +73,17 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
|
||||
// Draw footprints, this is done at last in order to print the pad holes in
|
||||
// white (or g_DrawBgColor) after the tracks and zones
|
||||
Module = (MODULE*) Pcb->m_Modules;
|
||||
int tmp = D_PAD::m_PadSketchModePenSize;
|
||||
D_PAD::m_PadSketchModePenSize = defaultPenSize;
|
||||
wxPoint offset;
|
||||
offset.x = GetScreen()->m_CurrentSheetDesc->m_Size.x / 2;
|
||||
offset.y = GetScreen()->m_CurrentSheetDesc->m_Size.y / 2;
|
||||
// offset is in mils, converts in internal units
|
||||
offset.x *= m_internalUnits / 1000;
|
||||
offset.y *= m_internalUnits / 1000;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
wxSize pageSizeIU = GetPageSizeIU() / 2;
|
||||
wxPoint offset( pageSizeIU.x, pageSizeIU.y );
|
||||
|
||||
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
Module->Move( offset );
|
||||
Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt );
|
||||
Module->Move( -offset );
|
||||
module->Move( offset );
|
||||
Print_Module( DrawPanel, aDC, module, drawmode, aPrintMaskLayer, drillShapeOpt );
|
||||
module->Move( -offset );
|
||||
}
|
||||
|
||||
D_PAD::m_PadSketchModePenSize = tmp;
|
||||
|
@ -100,7 +95,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
|
||||
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
|
||||
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
|
||||
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp);
|
||||
GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -142,7 +142,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|||
{
|
||||
int tmpzoom;
|
||||
wxPoint tmp_startvisu;
|
||||
wxSize SheetSize; // Page size in internal units
|
||||
wxPoint old_org;
|
||||
wxPoint DrawOffset; // Offset de trace
|
||||
double userscale;
|
||||
|
@ -153,65 +152,68 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|||
|
||||
wxBusyCursor dummy;
|
||||
|
||||
/* Save old draw scale and draw offset */
|
||||
// Save old draw scale and draw offset
|
||||
tmp_startvisu = screen->m_StartVisu;
|
||||
tmpzoom = screen->GetZoom();
|
||||
old_org = screen->m_DrawOrg;
|
||||
/* Change draw scale and offset to draw the whole page */
|
||||
|
||||
// Change draw scale and offset to draw the whole page
|
||||
screen->SetScalingFactor( DrawZoom );
|
||||
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
|
||||
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
|
||||
|
||||
SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
||||
SheetSize.x *= m_Parent->GetInternalUnits() / 1000;
|
||||
SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in internal units
|
||||
|
||||
PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent;
|
||||
|
||||
EDA_RECT brd_BBox = pcbframe->GetBoard()->ComputeBoundingBox();
|
||||
wxSize pageSizeIU = pcbframe->GetPageSizeIU(); // internal units
|
||||
EDA_RECT bbbox = pcbframe->GetBoard()->ComputeBoundingBox();
|
||||
|
||||
// In module editor, the module is located at 0,0 but for printing
|
||||
// it is moved to SheetSize.x/2, SheetSize.y/2.
|
||||
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
|
||||
// So the equivalent board must be moved:
|
||||
if( m_Parent->IsType( MODULE_EDITOR_FRAME ) )
|
||||
{
|
||||
wxPoint mv_offset;
|
||||
mv_offset.x = SheetSize.x / 2;
|
||||
mv_offset.y = SheetSize.y / 2;
|
||||
brd_BBox.Move( mv_offset );
|
||||
bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) );
|
||||
}
|
||||
|
||||
/* Compute the PCB size in internal units*/
|
||||
// Compute the PCB size in internal units
|
||||
userscale = m_PrintParams.m_PrintScale;
|
||||
|
||||
if( userscale == 0 ) // fit in page
|
||||
{
|
||||
int extra_margin = 4000*2; // Margin = 4000 units pcb = 0.4 inch
|
||||
SheetSize.x = brd_BBox.GetWidth() + extra_margin;
|
||||
SheetSize.y = brd_BBox.GetHeight() + extra_margin;
|
||||
// Margin = 0.4 inch
|
||||
#if defined(KICAD_NANOMETRE)
|
||||
int extra_margin = int( 0.4 * 25400 ); // nanometers
|
||||
#else
|
||||
int extra_margin = int( 0.4 * 1000 ); // deci-mils
|
||||
#endif
|
||||
|
||||
pageSizeIU.x = bbbox.GetWidth() + extra_margin * 2;
|
||||
pageSizeIU.y = bbbox.GetHeight() + extra_margin * 2;
|
||||
|
||||
userscale = 0.99;
|
||||
}
|
||||
|
||||
|
||||
if( (m_PrintParams.m_PrintScale > 1.0) // scale > 1 -> Recadrage
|
||||
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page
|
||||
{
|
||||
DrawOffset += brd_BBox.Centre();
|
||||
DrawOffset += bbbox.Centre();
|
||||
}
|
||||
|
||||
if( m_PrintParams.m_PageSetupData )
|
||||
{
|
||||
wxSize pagesize;
|
||||
pagesize.x = (int) (SheetSize.x / userscale);
|
||||
pagesize.y = (int) (SheetSize.y / userscale);
|
||||
FitThisSizeToPageMargins(pagesize, *m_PrintParams.m_PageSetupData );
|
||||
|
||||
pagesize.x = int( pageSizeIU.x / userscale );
|
||||
pagesize.y = int( pageSizeIU.y / userscale );
|
||||
|
||||
FitThisSizeToPageMargins( pagesize, *m_PrintParams.m_PageSetupData );
|
||||
}
|
||||
|
||||
// Compute Accurate scale 1
|
||||
if( userscale == 1.0 )
|
||||
{
|
||||
// We want a 1:1 scale and margins for printing
|
||||
MapScreenSizeToPaper( );
|
||||
MapScreenSizeToPaper();
|
||||
int w, h;
|
||||
GetPPIPrinter( &w, &h );
|
||||
double accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (double) PCB_INTERNAL_UNIT;
|
||||
|
@ -263,7 +265,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|||
if( m_PrintParams.m_Print_Black_and_White )
|
||||
GRForceBlackPen( true );
|
||||
|
||||
|
||||
EDA_DRAW_PANEL* panel = m_Parent->DrawPanel;
|
||||
EDA_RECT tmp = panel->m_ClipBox;
|
||||
|
||||
|
@ -303,7 +304,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|||
* for scales > 1, the DrawOffset was already computed to have the board centre
|
||||
* to the middle of the page.
|
||||
*/
|
||||
wxPoint pcb_centre = brd_BBox.Centre();
|
||||
wxPoint pcb_centre = bbbox.Centre();
|
||||
|
||||
if( userscale <= 1.0 )
|
||||
DrawOffset.y += pcb_centre.y - (ysize / 2);
|
||||
|
|
Loading…
Reference in New Issue