Commit 1393eb0f authored by Dick Hollenbeck's avatar Dick Hollenbeck

finish up SCH_SHEET::{Set,Get}PageSettings() switch over

parent d3afe95c
...@@ -176,53 +176,53 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString ) ...@@ -176,53 +176,53 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
//-----<PAGE_INFO>------------------------------------------------------------- //-----<PAGE_INFO>-------------------------------------------------------------
// Standard page sizes in 1/1000 inch // Standard page sizes in mils
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
static const PAGE_INFO pageA4( wxSize( 8283, 11700 ), wxT( "A4" ) ); const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8283, 11700 ), wxT( "A4" ) );
#else #else
static const PAGE_INFO pageA4( wxSize( 11700, 8267 ), wxT( "A4" ) ); const PAGE_INFO PAGE_INFO::pageA4( wxSize( 11700, 8267 ), wxT( "A4" ) );
#endif #endif
static const PAGE_INFO pageA3( wxSize( 16535, 11700 ), wxT( "A3" ) ); const PAGE_INFO PAGE_INFO::pageA3( wxSize( 16535, 11700 ), wxT( "A3" ) );
static const PAGE_INFO pageA2( wxSize( 23400, 16535 ), wxT( "A2" ) ); const PAGE_INFO PAGE_INFO::pageA2( wxSize( 23400, 16535 ), wxT( "A2" ) );
static const PAGE_INFO pageA1( wxSize( 33070, 23400 ), wxT( "A1" ) ); const PAGE_INFO PAGE_INFO::pageA1( wxSize( 33070, 23400 ), wxT( "A1" ) );
static const PAGE_INFO pageA0( wxSize( 46800, 33070 ), wxT( "A0" ) ); const PAGE_INFO PAGE_INFO::pageA0( wxSize( 46800, 33070 ), wxT( "A0" ) );
static const PAGE_INFO pageA( wxSize( 11000, 8500 ), wxT( "A" ) ); const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ) );
static const PAGE_INFO pageB( wxSize( 17000, 11000 ), wxT( "B" ) ); const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ) );
static const PAGE_INFO pageC( wxSize( 22000, 17000 ), wxT( "C" ) ); const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ) );
static const PAGE_INFO pageD( wxSize( 34000, 22000 ), wxT( "D" ) ); const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ) );
static const PAGE_INFO pageE( wxSize( 44000, 34000 ), wxT( "E" ) ); const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ) );
static const PAGE_INFO pageGERBER(wxSize( 32000, 32000 ), wxT( "GERBER" ) ); const PAGE_INFO PAGE_INFO::pageGERBER(wxSize( 32000, 32000 ), wxT( "GERBER" ) );
const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), wxT( "User" ) );
double PAGE_INFO::s_user_width = 17.0;
double PAGE_INFO::s_user_height = 11.0; int PAGE_INFO::s_user_width = 17000;
static const PAGE_INFO pageUser( wxSize( 17000, 11000 ), wxT( "User" ) ); int PAGE_INFO::s_user_height = 11000;
static const PAGE_INFO* stdPageSizes[] = {
&pageA4,
&pageA3,
&pageA2,
&pageA1,
&pageA0,
&pageA,
&pageB,
&pageC,
&pageD,
&pageE,
// &pageGERBER, omitted, not standard
&pageUser,
};
/*
wxArrayString PAGE_INFO::GetStandardSizes() wxArrayString PAGE_INFO::GetStandardSizes()
{ {
wxArrayString ret; wxArrayString ret;
static const PAGE_INFO* stdPageSizes[] = {
&pageA4,
&pageA3,
&pageA2,
&pageA1,
&pageA0,
&pageA,
&pageB,
&pageC,
&pageD,
&pageE,
// &pageGERBER, // standard?
&pageUser,
};
for( unsigned i=0; i < DIM( stdPageSizes ); ++i ) for( unsigned i=0; i < DIM( stdPageSizes ); ++i )
ret.Add( stdPageSizes[i]->GetType() ); ret.Add( stdPageSizes[i]->GetType() );
return ret; return ret;
} }
*/
bool PAGE_INFO::SetType( const wxString& aType ) bool PAGE_INFO::SetType( const wxString& aType )
{ {
...@@ -252,9 +252,13 @@ bool PAGE_INFO::SetType( const wxString& aType ) ...@@ -252,9 +252,13 @@ bool PAGE_INFO::SetType( const wxString& aType )
*this = pageGERBER; *this = pageGERBER;
else if( aType == pageUser.GetType() ) else if( aType == pageUser.GetType() )
{ {
// pageUser is const, and may not and does not hold the custom size,
// so customize *this later
*this = pageUser; *this = pageUser;
m_widthInches = s_user_width;
m_heightInches = s_user_height; // customize:
m_size.x = s_user_width;
m_size.y = s_user_height;
} }
else else
rc = false; rc = false;
...@@ -263,22 +267,18 @@ bool PAGE_INFO::SetType( const wxString& aType ) ...@@ -263,22 +267,18 @@ bool PAGE_INFO::SetType( const wxString& aType )
} }
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) :
m_size( aSizeMils )
{ {
// aSizeMils is in 1/1000th of an inch m_type = aType;
SetWidthInches( aSizeMils.x / 1000.0 );
SetHeightInches( aSizeMils.y / 1000.0 );
m_Type = aType;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
m_LeftMargin = GOST_LEFTMARGIN; m_left_margin = GOST_LEFTMARGIN;
m_RightMargin = GOST_RIGHTMARGIN; m_right_margin = GOST_RIGHTMARGIN;
m_TopMargin = GOST_TOPMARGIN; m_top_margin = GOST_TOPMARGIN;
m_BottomMargin = GOST_BOTTOMMARGIN; m_bottom_margin = GOST_BOTTOMMARGIN;
#else #else
m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400; m_left_margin = m_right_margin = m_top_margin = m_bottom_margin = 400;
#endif #endif
} }
...@@ -289,42 +289,24 @@ PAGE_INFO::PAGE_INFO( const wxString& aType ) ...@@ -289,42 +289,24 @@ PAGE_INFO::PAGE_INFO( const wxString& aType )
} }
void PAGE_INFO::SetWidthInches( double aWidthInInches ) void PAGE_INFO::SetUserWidthMils( int aWidthInMils )
{
// limit resolution to 1/1000th of an inch
int mils = aWidthInInches * 1000 + 0.5;
m_widthInches = mils / 1000.0;
}
void PAGE_INFO::SetHeightInches( double aHeightInInches )
{
// limit resolution to 1/1000th of an inch
int mils = aHeightInInches * 1000 + 0.5;
m_heightInches = mils / 1000.0;
}
void PAGE_INFO::SetUserWidthInches( double aWidthInInches )
{ {
if( aWidthInInches < 6.0 ) if( aWidthInMils < 6000 )
aWidthInInches = 6.0; aWidthInMils = 6000;
else if( aWidthInInches > 44.0 ) else if( aWidthInMils > 44000 )
aWidthInInches = 44.0; aWidthInMils = 44000;
s_user_width = aWidthInInches; s_user_width = aWidthInMils;
} }
void PAGE_INFO::SetUserHeightInches( double aHeightInInches ) void PAGE_INFO::SetUserHeightMils( int aHeightInMils )
{ {
if( aHeightInInches < 4.0 ) if( aHeightInMils < 4000 )
aHeightInInches = 4.0; aHeightInMils = 4000;
else if( aHeightInInches > 44.0 ) else if( aHeightInMils > 44000 )
aHeightInInches = 44.0; aHeightInMils = 44000;
s_user_height = aHeightInInches; s_user_height = aHeightInMils;
} }
......
...@@ -79,8 +79,8 @@ void DIALOG_PAGES_SETTINGS::initDialog() ...@@ -79,8 +79,8 @@ void DIALOG_PAGES_SETTINGS::initDialog()
switch( g_UserUnit ) switch( g_UserUnit )
{ {
case MILLIMETRES: case MILLIMETRES:
userSizeX = m_user_size.GetWidthInches() * 25.4; userSizeX = m_user_size.GetWidthMils() * 25.4e-3;
userSizeY = m_user_size.GetHeightInches() * 25.4; userSizeY = m_user_size.GetHeightMils() * 25.4e-3;
msg.Printf( wxT( "%.2f" ), userSizeX ); msg.Printf( wxT( "%.2f" ), userSizeX );
m_TextUserSizeX->SetValue( msg ); m_TextUserSizeX->SetValue( msg );
...@@ -91,8 +91,8 @@ void DIALOG_PAGES_SETTINGS::initDialog() ...@@ -91,8 +91,8 @@ void DIALOG_PAGES_SETTINGS::initDialog()
default: default:
case INCHES: case INCHES:
userSizeX = m_user_size.GetWidthInches(); userSizeX = m_user_size.GetWidthMils() / 1000.0;
userSizeY = m_user_size.GetHeightInches(); userSizeY = m_user_size.GetHeightMils() / 1000.0;
msg.Printf( wxT( "%.3f" ), userSizeX ); msg.Printf( wxT( "%.3f" ), userSizeX );
m_TextUserSizeX->SetValue( msg ); m_TextUserSizeX->SetValue( msg );
...@@ -101,10 +101,10 @@ void DIALOG_PAGES_SETTINGS::initDialog() ...@@ -101,10 +101,10 @@ void DIALOG_PAGES_SETTINGS::initDialog()
m_TextUserSizeY->SetValue( msg ); m_TextUserSizeY->SetValue( msg );
break; break;
/* // you want it in 1/1000ths of an inch, why? /* // you want it in mils, why?
case UNSCALED_UNITS: case UNSCALED_UNITS:
userSizeX = m_user_size.GetWidthInches() * 1000; userSizeX = m_user_size.GetWidthMils();
userSizeY = m_user_size.GetHeightInches() * 1000; userSizeY = m_user_size.GetHeightMils();
msg.Printf( wxT( "%f" ), m_userSizeX ); msg.Printf( wxT( "%f" ), m_userSizeX );
m_TextUserSizeX->SetValue( msg ); m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%f" ), m_userSizeY ); msg.Printf( wxT( "%f" ), m_userSizeY );
...@@ -204,20 +204,20 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) ...@@ -204,20 +204,20 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
switch( g_UserUnit ) switch( g_UserUnit )
{ {
case MILLIMETRES: case MILLIMETRES:
PAGE_INFO::SetUserWidthInches( userSizeX / 25.4 ); PAGE_INFO::SetUserWidthMils( int( userSizeX * 1000.0 / 25.4 ) );
PAGE_INFO::SetUserHeightInches( userSizeY / 25.4 ); PAGE_INFO::SetUserHeightMils( int( userSizeY * 1000.0 / 25.4 ) );
break; break;
default: default:
case INCHES: case INCHES:
PAGE_INFO::SetUserWidthInches( userSizeX ); PAGE_INFO::SetUserWidthMils( int( 1000 * userSizeX ) );
PAGE_INFO::SetUserHeightInches( userSizeY ); PAGE_INFO::SetUserHeightMils( int( 1000 * userSizeY ) );
break; break;
/* // set in 1/1000ths of an inch, but why? /* // set in 1/1000ths of an inch, but why?
case UNSCALED_UNITS: case UNSCALED_UNITS:
PAGE_INFO::SetUserWidthInches( userSizeX /1000 ); PAGE_INFO::SetUserWidthMils( (int) userSizeX );
PAGE_INFO::SetUserHeightInches( userSizeY /1000 ); PAGE_INFO::SetUserHeightMils( (int) userSizeY );
break; break;
*/ */
} }
......
...@@ -238,7 +238,6 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -238,7 +238,6 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
GRForceBlackPen( false ); GRForceBlackPen( false );
screen->m_StartVisu = tmp_startvisu; screen->m_StartVisu = tmp_startvisu;
......
...@@ -100,7 +100,7 @@ private: ...@@ -100,7 +100,7 @@ private:
void OnPlotCurrent( wxCommandEvent& event ); void OnPlotCurrent( wxCommandEvent& event );
void OnPlotAll( wxCommandEvent& event ); void OnPlotAll( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void AcceptplotOffset( wxCommandEvent& event ); void AcceptPlotOffset( wxCommandEvent& event );
void initDlg(); void initDlg();
void SetPenSpeed(); void SetPenSpeed();
...@@ -119,7 +119,7 @@ private: ...@@ -119,7 +119,7 @@ private:
// static members (static to remember last state): // static members (static to remember last state):
HPGL_PAGEZ_T DIALOG_PLOT_SCHEMATIC_HPGL:: s_pageSizeSelect = PAGE_DEFAULT; HPGL_PAGEZ_T DIALOG_PLOT_SCHEMATIC_HPGL:: s_pageSizeSelect = PAGE_DEFAULT;
bool DIALOG_PLOT_SCHEMATIC_HPGL::s_plot_Sheet_Ref = true; bool DIALOG_PLOT_SCHEMATIC_HPGL::s_plot_Sheet_Ref = true;
wxSize DIALOG_PLOT_SCHEMATIC_HPGL::s_Offset;
void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event ) void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
{ {
...@@ -202,7 +202,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue() ...@@ -202,7 +202,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptplotOffset( wxCommandEvent& event ) void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event )
{ {
s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection(); s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
......
...@@ -95,7 +95,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ...@@ -95,7 +95,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() ); m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() );
#ifdef __WXMAC__ #ifdef __WXMAC__
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */ // Problems with modal on wx-2.9 - Anyway preview is standard for OSX
m_buttonPreview->Hide(); m_buttonPreview->Hide();
#endif #endif
} }
...@@ -310,7 +310,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -310,7 +310,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
{ {
int oldZoom; int oldZoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize SheetSize; // Page size in internal units wxSize pageSizeIU; // Page size in internal units
wxPoint old_org; wxPoint old_org;
EDA_RECT oldClipBox; EDA_RECT oldClipBox;
wxRect fitRect; wxRect fitRect;
...@@ -320,13 +320,13 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -320,13 +320,13 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxBusyCursor dummy; wxBusyCursor dummy;
/* Save current scale factor, offsets, and clip box. */ // Save current scale factor, offsets, and clip box.
tmp_startvisu = aScreen->m_StartVisu; tmp_startvisu = aScreen->m_StartVisu;
oldZoom = aScreen->GetZoom(); oldZoom = aScreen->GetZoom();
old_org = aScreen->m_DrawOrg; old_org = aScreen->m_DrawOrg;
oldClipBox = panel->m_ClipBox; oldClipBox = panel->m_ClipBox;
/* Change scale factor, offsets, and clip box to print the whole page. */ // Change scale factor, offsets, and clip box to print the whole page.
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) ); panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ); panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
...@@ -346,16 +346,17 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -346,16 +346,17 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ), wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() ); memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
SheetSize.x = memDC.MaxX() - memDC.MinX(); pageSizeIU.x = memDC.MaxX() - memDC.MinX();
SheetSize.y = memDC.MaxY() - memDC.MinY(); pageSizeIU.y = memDC.MaxY() - memDC.MinY();
FitThisSizeToPageMargins( SheetSize, parent->GetPageSetupData() ); FitThisSizeToPageMargins( pageSizeIU, parent->GetPageSetupData() );
fitRect = GetLogicalPageMarginsRect( parent->GetPageSetupData() ); fitRect = GetLogicalPageMarginsRect( parent->GetPageSetupData() );
} }
else else
{ {
SheetSize = aScreen->m_CurrentSheetDesc->m_Size; pageSizeIU = aScreen->GetPageSettings().GetSizeIU();
FitThisSizeToPaper( SheetSize );
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect(); fitRect = GetLogicalPaperRect();
} }
......
...@@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) ...@@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break; break;
/* Hotkey IDs */ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR: case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr ); InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr );
break; break;
...@@ -145,7 +145,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event ) ...@@ -145,7 +145,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break; break;
/* Hotkey IDs */ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr ); ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr );
break; break;
...@@ -267,7 +267,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() ...@@ -267,7 +267,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
NET_TYPE_PCBNEW, NET_TYPE_PCBNEW,
NET_TYPE_CUSTOM_MAX ) ); NET_TYPE_CUSTOM_MAX ) );
/* NOTE: Left as global until supporting code can be fixed. */ // NOTE: Left as global until supporting code can be fixed.
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLSpd" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLSpd" ),
&g_HPGL_Pen_Descr.m_Pen_Speed, &g_HPGL_Pen_Descr.m_Pen_Speed,
20, 2, 45 ) ); 20, 2, 45 ) );
...@@ -277,6 +277,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() ...@@ -277,6 +277,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ),
&g_HPGL_Pen_Descr.m_Pen_Num, &g_HPGL_Pen_Descr.m_Pen_Num,
1, 1, 8 ) ); 1, 1, 8 ) );
/* these globals don't exist
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ),
&g_Sheet_A4.m_Offset.x ) ); &g_Sheet_A4.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A4" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A4" ),
...@@ -317,6 +319,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() ...@@ -317,6 +319,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
&g_Sheet_E.m_Offset.x ) ); &g_Sheet_E.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ),
&g_Sheet_E.m_Offset.y ) ); &g_Sheet_E.m_Offset.y ) );
*/
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
&g_RepeatStep.x, &g_RepeatStep.x,
0, -1000, +1000 ) ); 0, -1000, +1000 ) );
...@@ -362,7 +366,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere ...@@ -362,7 +366,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
IsRead = false; IsRead = false;
} }
/* User library path takes precedent over default library search paths. */ // User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( m_userLibraryPath, 1 ); wxGetApp().InsertLibraryPath( m_userLibraryPath, 1 );
/* If the list is void, force loading the library "power.lib" that is /* If the list is void, force loading the library "power.lib" that is
...@@ -382,7 +386,7 @@ void SCH_EDIT_FRAME::SaveProjectFile() ...@@ -382,7 +386,7 @@ void SCH_EDIT_FRAME::SaveProjectFile()
{ {
wxFileName fn; wxFileName fn;
fn = g_RootSheet->GetScreen()->GetFileName(); /*ConfigFileName*/ fn = g_RootSheet->GetScreen()->GetFileName(); //ConfigFileName
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
if( !IsWritable( fn ) ) if( !IsWritable( fn ) )
...@@ -528,7 +532,7 @@ void SCH_EDIT_FRAME::LoadSettings() ...@@ -528,7 +532,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false ); cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true ); cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
/* Load print preview window session settings. */ // Load print preview window session settings.
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 ); cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
m_previewPosition.x = (int) tmp; m_previewPosition.x = (int) tmp;
cfg->Read( PreviewFramePositionYEntry, &tmp, -1 ); cfg->Read( PreviewFramePositionYEntry, &tmp, -1 );
...@@ -538,7 +542,7 @@ void SCH_EDIT_FRAME::LoadSettings() ...@@ -538,7 +542,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( PreviewFrameHeightEntry, &tmp, -1 ); cfg->Read( PreviewFrameHeightEntry, &tmp, -1 );
m_previewSize.SetHeight( (int) tmp ); m_previewSize.SetHeight( (int) tmp );
/* Load print dialog session settings. */ // Load print dialog session settings.
cfg->Read( PrintDialogPositionXEntry, &tmp, -1 ); cfg->Read( PrintDialogPositionXEntry, &tmp, -1 );
m_printDialogPosition.x = (int) tmp; m_printDialogPosition.x = (int) tmp;
cfg->Read( PrintDialogPositionYEntry, &tmp, -1 ); cfg->Read( PrintDialogPositionYEntry, &tmp, -1 );
...@@ -552,7 +556,7 @@ void SCH_EDIT_FRAME::LoadSettings() ...@@ -552,7 +556,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false ); cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false );
cfg->Read( SimulatorCommandEntry, &m_simulatorCommand ); cfg->Read( SimulatorCommandEntry, &m_simulatorCommand );
/* Load find dialog session setting. */ // Load find dialog session setting.
cfg->Read( FindDialogPositionXEntry, &tmp, -1 ); cfg->Read( FindDialogPositionXEntry, &tmp, -1 );
m_findDialogPosition.x = (int) tmp; m_findDialogPosition.x = (int) tmp;
cfg->Read( FindDialogPositionYEntry, &tmp, -1 ); cfg->Read( FindDialogPositionYEntry, &tmp, -1 );
...@@ -568,7 +572,7 @@ void SCH_EDIT_FRAME::LoadSettings() ...@@ -568,7 +572,7 @@ void SCH_EDIT_FRAME::LoadSettings()
m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) ); m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) );
m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, wxEmptyString ) ); m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, wxEmptyString ) );
/* Load the find and replace string history list. */ // Load the find and replace string history list.
for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ ) for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ )
{ {
wxString tmpHistory; wxString tmpHistory;
...@@ -619,13 +623,13 @@ void SCH_EDIT_FRAME::SaveSettings() ...@@ -619,13 +623,13 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( ShowHiddenPinsEntry, m_showAllPins ); cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines ); cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
/* Save print preview window session settings. */ // Save print preview window session settings.
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x ); cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y ); cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y );
cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() ); cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() );
cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() ); cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() );
/* Save print dialog session settings. */ // Save print dialog session settings.
cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x ); cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x );
cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y ); cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y );
cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() ); cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() );
...@@ -635,7 +639,7 @@ void SCH_EDIT_FRAME::SaveSettings() ...@@ -635,7 +639,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames ); cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames );
cfg->Write( SimulatorCommandEntry, m_simulatorCommand ); cfg->Write( SimulatorCommandEntry, m_simulatorCommand );
/* Save find dialog session setting. */ // Save find dialog session setting.
cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x ); cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x );
cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y ); cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y );
cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() ); cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() );
...@@ -647,7 +651,7 @@ void SCH_EDIT_FRAME::SaveSettings() ...@@ -647,7 +651,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() ); cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() );
cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() ); cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() );
/* Save the find and replace string history list. */ // Save the find and replace string history list.
size_t i; size_t i;
wxString tmpHistory; wxString tmpHistory;
wxString entry; // invoke constructor outside of any loops wxString entry; // invoke constructor outside of any loops
......
...@@ -244,7 +244,10 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew ) ...@@ -244,7 +244,10 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
if( aIsNew ) if( aIsNew )
{ {
screen->m_CurrentSheetDesc = &g_Sheet_A4; /* SCH_SCREEN constructor does this now
screen->SetPageSettings( PAGE_INFO( wxT( "A4" ) ) );
*/
screen->SetZoom( 32 ); screen->SetZoom( 32 );
screen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); screen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
screen->m_Title = NAMELESS_PROJECT; screen->m_Title = NAMELESS_PROJECT;
......
...@@ -33,54 +33,71 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) ...@@ -33,54 +33,71 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_LIBEDIT_GEN_PNG_FILE: case ID_LIBEDIT_GEN_PNG_FILE:
{ {
bool fmt_is_jpeg = false; // could be selectable later. so keep this option. bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" ); file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
mask = wxT( "*." ) + file_ext; mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() ); wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext ); fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(), FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this, fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true ); wxFD_SAVE, true );
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
// calling wxYield is mandatory under Linux, after closing the file selector dialog // calling wxYield is mandatory under Linux, after closing the file selector dialog
// to refresh the screen before creating the PNG or JPEG image from screen // to refresh the screen before creating the PNG or JPEG image from screen
wxYield(); wxYield();
CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg ); CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
} }
break; break;
case ID_LIBEDIT_GEN_SVG_FILE: case ID_LIBEDIT_GEN_SVG_FILE:
{ {
file_ext = wxT( "svg" ); file_ext = wxT( "svg" );
mask = wxT( "*." ) + file_ext; mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() ); wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext ); fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(), FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this, fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true ); wxFD_SAVE, true );
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
/* Give a size to the SVG draw area = component size + margin #if 0 // would the PAGE_INFO margins work for this old code:
* the margin is 10% the size of the component size
*/ // Give a size to the SVG draw area = component size + margin
wxSize pagesize = GetScreen()->ReturnPageSize( ); // the margin is 10% the size of the component size
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize(); wxSize pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2); // Add a small margin to the plot bounding box
componentSize.y = (int)(componentSize.y * 1.2); componentSize.x = (int)(componentSize.x * 1.2);
GetScreen()->SetPageSize( componentSize ); componentSize.y = (int)(componentSize.y * 1.2);
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize ); GetScreen()->SetPageSize( componentSize );
} SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize );
#else
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave;
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
GetScreen()->SetPageSettings( pageTemp );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSettings( pageSave );
#endif
}
break; break;
} }
} }
...@@ -116,7 +133,8 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode ...@@ -116,7 +133,8 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode
if( ! m_component ) if( ! m_component )
return; return;
wxSize pagesize = GetScreen()->ReturnPageSize(); wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU();
/* Plot item centered to the page /* Plot item centered to the page
* In libedit, the component is centered at 0,0 coordinates. * In libedit, the component is centered at 0,0 coordinates.
* So we must plot it with an offset = pagesize/2. * So we must plot it with an offset = pagesize/2.
......
...@@ -209,7 +209,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, ...@@ -209,7 +209,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
SetIcon( icon ); SetIcon( icon );
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) ); SetScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; GetScreen()->m_Center = true;
...@@ -287,6 +287,39 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME() ...@@ -287,6 +287,39 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
} }
void LIB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
GetScreen()->SetPageSettings( aPageSettings );
}
const PAGE_INFO& LIB_EDIT_FRAME::GetPageSettings () const
{
return GetScreen()->GetPageSettings();
}
const wxSize LIB_EDIT_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU();
}
const wxPoint& LIB_EDIT_FRAME::GetOriginAxisPosition() const
{
wxASSERT( GetScreen() );
return GetScreen()->GetOriginAxisPosition();
}
void LIB_EDIT_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition );
}
void LIB_EDIT_FRAME::LoadSettings() void LIB_EDIT_FRAME::LoadSettings()
{ {
wxConfig* cfg; wxConfig* cfg;
...@@ -379,8 +412,11 @@ double LIB_EDIT_FRAME::BestZoom() ...@@ -379,8 +412,11 @@ double LIB_EDIT_FRAME::BestZoom()
} }
else else
{ {
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
dx = pageInfo.GetSizeIU().x;
dy = pageInfo.GetSizeIU().y;
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) ); GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
} }
......
...@@ -257,7 +257,17 @@ public: ...@@ -257,7 +257,17 @@ public:
double BestZoom(); // Returns the best zoom double BestZoom(); // Returns the best zoom
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); } SCH_SCREEN* GetScreen() const { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these 5 functions:
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ); void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "sch_bitmap.h" #include "sch_bitmap.h"
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ); bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window );
static void LoadLayers( LINE_READER* aLine ); static void LoadLayers( LINE_READER* aLine );
...@@ -300,45 +300,20 @@ static void LoadLayers( LINE_READER* aLine ) ...@@ -300,45 +300,20 @@ static void LoadLayers( LINE_READER* aLine )
/* Read the schematic header. */ /* Read the schematic header. */
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScreen ) bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScreen )
{ {
char Text[256]; char text[256];
char buf[1024]; char buf[1024];
int ii; wxSize pageSize;
PAGE_INFO* wsheet = &g_Sheet_A4; char* line = aLine->Line();
wxSize PageSize;
char* line;
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,
&g_Sheet_user, NULL
};
line = aLine->Line();
sscanf( line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y ); sscanf( line, "%s %s %d %d", text, text, &pageSize.x, &pageSize.y );
wxString pagename = FROM_UTF8( Text ); wxString pagename = FROM_UTF8( text );
for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
{
wsheet = SheetFormatList[ii];
if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */
{
// Get the user page size and make it the default
if( wsheet == &g_Sheet_user )
{
g_Sheet_user.m_Size = PageSize;
}
break; PAGE_INFO pageInfo;
}
}
if( SheetFormatList[ii] == NULL ) if( !pageInfo.SetType( pagename ) )
{ {
aMsgDiag.Printf( wxT( "Eeschema file dimension definition error \ aMsgDiag.Printf( wxT( "Eeschema file dimension definition error \
line %d, \aAbort reading file.\n" ), line %d, \aAbort reading file.\n" ),
...@@ -346,7 +321,13 @@ line %d, \aAbort reading file.\n" ), ...@@ -346,7 +321,13 @@ line %d, \aAbort reading file.\n" ),
aMsgDiag << FROM_UTF8( line ); aMsgDiag << FROM_UTF8( line );
} }
aScreen->m_CurrentSheetDesc = wsheet; if( pagename == wxT( "User" ) )
{
pageInfo.SetWidthMils( pageSize.x );
pageInfo.SetHeightMils( pageSize.y );
}
aScreen->SetPageSettings( pageInfo );
for( ; ; ) for( ; ; )
{ {
......
...@@ -97,14 +97,15 @@ static GRID_TYPE SchematicGridList[] = { ...@@ -97,14 +97,15 @@ static GRID_TYPE SchematicGridList[] = {
#define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / sizeof( GRID_TYPE ) ) #define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / sizeof( GRID_TYPE ) )
SCH_SCREEN::SCH_SCREEN( const wxSize& aPageSizeIU ) : SCH_SCREEN::SCH_SCREEN() :
BASE_SCREEN( SCH_SCREEN_T ) BASE_SCREEN( SCH_SCREEN_T ),
m_paper( wxT( "A4" ) )
{ {
size_t i; size_t i;
SetDrawItems( NULL ); // Schematic items list SetDrawItems( NULL ); // Schematic items list
m_Zoom = 32; SetZoom( 32 );
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ ) for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
m_ZoomList.Add( SchematicZoomList[i] ); m_ZoomList.Add( SchematicZoomList[i] );
...@@ -118,7 +119,7 @@ SCH_SCREEN::SCH_SCREEN( const wxSize& aPageSizeIU ) : ...@@ -118,7 +119,7 @@ SCH_SCREEN::SCH_SCREEN( const wxSize& aPageSizeIU ) :
// Suitable for schematic only. For libedit and viewlib, must be set to true // Suitable for schematic only. For libedit and viewlib, must be set to true
m_Center = false; m_Center = false;
InitDataPoints( aPageSizeIU ); InitDataPoints( m_paper.GetSizeIU() );
} }
...@@ -574,8 +575,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const ...@@ -574,8 +575,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
* sheet ( ScreenNumber = 1 ) within the files * sheet ( ScreenNumber = 1 ) within the files
*/ */
if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_CurrentSheetDesc->m_Name ), if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_paper.GetType() ),
m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0 m_paper.GetWidthMils(), m_paper.GetHeightMils() ) < 0
|| fprintf( aFile, "encoding utf-8\n") < 0 || fprintf( aFile, "encoding utf-8\n") < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0 || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 0 || fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 0
......
...@@ -794,7 +794,7 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame ) ...@@ -794,7 +794,7 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
} }
else else
{ {
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) ); SetScreen( new SCH_SCREEN() );
success = aFrame->LoadOneEEFile( m_screen, m_fileName ); success = aFrame->LoadOneEEFile( m_screen, m_fileName );
if( success ) if( success )
......
...@@ -243,6 +243,8 @@ typedef boost::ptr_vector<SCH_SHEET_PIN> SCH_SHEET_PINS; ...@@ -243,6 +243,8 @@ typedef boost::ptr_vector<SCH_SHEET_PIN> SCH_SHEET_PINS;
*/ */
class SCH_SHEET : public SCH_ITEM class SCH_SHEET : public SCH_ITEM
{ {
friend class SCH_SHEET_PIN;
/// Screen that contains the physical data for the sheet. In complex hierarchies /// Screen that contains the physical data for the sheet. In complex hierarchies
/// multiple sheets can share a common screen. /// multiple sheets can share a common screen.
SCH_SCREEN* m_screen; SCH_SCREEN* m_screen;
...@@ -270,8 +272,6 @@ class SCH_SHEET : public SCH_ITEM ...@@ -270,8 +272,6 @@ class SCH_SHEET : public SCH_ITEM
/// The size of the sheet. /// The size of the sheet.
wxSize m_size; wxSize m_size;
friend class SCH_SHEET_PIN;
public: public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
......
...@@ -285,6 +285,39 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME() ...@@ -285,6 +285,39 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
} }
void SCH_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
GetScreen()->SetPageSettings( aPageSettings );
}
const PAGE_INFO& SCH_EDIT_FRAME::GetPageSettings () const
{
return GetScreen()->GetPageSettings();
}
const wxSize SCH_EDIT_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU();
}
const wxPoint& SCH_EDIT_FRAME::GetOriginAxisPosition() const
{
wxASSERT( GetScreen() );
return GetScreen()->GetOriginAxisPosition();
}
void SCH_EDIT_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition );
}
void SCH_EDIT_FRAME::SetSheetNumberAndCount() void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
...@@ -345,7 +378,7 @@ void SCH_EDIT_FRAME::CreateScreens() ...@@ -345,7 +378,7 @@ void SCH_EDIT_FRAME::CreateScreens()
if( g_RootSheet->GetScreen() == NULL ) if( g_RootSheet->GetScreen() == NULL )
{ {
g_RootSheet->SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) ); g_RootSheet->SetScreen( new SCH_SCREEN() );
SetScreen( g_RootSheet->GetScreen() ); SetScreen( g_RootSheet->GetScreen() );
} }
...@@ -355,7 +388,7 @@ void SCH_EDIT_FRAME::CreateScreens() ...@@ -355,7 +388,7 @@ void SCH_EDIT_FRAME::CreateScreens()
m_CurrentSheet->Push( g_RootSheet ); m_CurrentSheet->Push( g_RootSheet );
if( GetScreen() == NULL ) if( GetScreen() == NULL )
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) ); SetScreen( new SCH_SCREEN() );
GetScreen()->SetZoom( 32.0 ); GetScreen()->SetZoom( 32.0 );
GetScreen()->m_UndoRedoCountMax = 10; GetScreen()->m_UndoRedoCountMax = 10;
...@@ -489,8 +522,8 @@ double SCH_EDIT_FRAME::BestZoom() ...@@ -489,8 +522,8 @@ double SCH_EDIT_FRAME::BestZoom()
int dx, dy; int dx, dy;
wxSize size; wxSize size;
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; dx = GetScreen()->GetPageSettings().GetWidthIU();
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; dy = GetScreen()->GetPageSettings().GetHeightIU();
size = m_canvas->GetClientSize(); size = m_canvas->GetClientSize();
......
...@@ -116,7 +116,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -116,7 +116,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
} }
else // New file. else // New file.
{ {
aSheet->SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) ); aSheet->SetScreen( new SCH_SCREEN() );
aSheet->GetScreen()->SetFileName( fileName.GetFullPath() ); aSheet->GetScreen()->SetFileName( fileName.GetFullPath() );
} }
} }
......
...@@ -125,7 +125,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph ...@@ -125,7 +125,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
if( m_Semaphore ) if( m_Semaphore )
MakeModal(true); MakeModal(true);
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) ); SetScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; // Center coordinate origins on screen. GetScreen()->m_Center = true; // Center coordinate origins on screen.
LoadSettings(); LoadSettings();
...@@ -265,6 +265,39 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME() ...@@ -265,6 +265,39 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
} }
void LIB_VIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
GetScreen()->SetPageSettings( aPageSettings );
}
const PAGE_INFO& LIB_VIEW_FRAME::GetPageSettings () const
{
return GetScreen()->GetPageSettings();
}
const wxSize LIB_VIEW_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU();
}
const wxPoint& LIB_VIEW_FRAME::GetOriginAxisPosition() const
{
wxASSERT( GetScreen() );
return GetScreen()->GetOriginAxisPosition();
}
void LIB_VIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition );
}
void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
SaveSettings(); SaveSettings();
......
...@@ -34,12 +34,11 @@ ...@@ -34,12 +34,11 @@
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include "wxstruct.h" #include "wxstruct.h"
#include "class_sch_screen.h"
class wxSashLayoutWindow; class wxSashLayoutWindow;
class wxListBox; class wxListBox;
class wxSemaphore; class wxSemaphore;
class SCH_SCREEN;
class CMP_LIBRARY; class CMP_LIBRARY;
...@@ -108,7 +107,17 @@ public: ...@@ -108,7 +107,17 @@ public:
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event ); void OnSetRelativeOffset( wxCommandEvent& event );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); } SCH_SCREEN* GetScreen() const { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these 5 functions:
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
......
...@@ -142,8 +142,7 @@ public: ...@@ -142,8 +142,7 @@ public:
wxString m_Commentaire3; wxString m_Commentaire3;
wxString m_Commentaire4; wxString m_Commentaire4;
/* Grid and zoom values. */ wxPoint m_GridOrigin;
wxPoint m_GridOrigin;
wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients. wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients.
bool m_IsPrinting; bool m_IsPrinting;
......
...@@ -65,7 +65,10 @@ class SCH_SCREEN : public BASE_SCREEN ...@@ -65,7 +65,10 @@ class SCH_SCREEN : public BASE_SCREEN
///< Delete when it goes to zero. ///< Delete when it goes to zero.
/// The size of the paper to print or plot on /// The size of the paper to print or plot on
PAGE_INFO m_paper; // keep with the MVC 'model' as this class gets split PAGE_INFO m_paper; // keep with the MVC 'model' if this class gets split
/// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA
wxPoint m_originAxisPosition;
SCH_ITEM* m_drawList; ///< Object list for the screen. SCH_ITEM* m_drawList; ///< Object list for the screen.
/// @todo use DLIST<SCH_ITEM> or superior container /// @todo use DLIST<SCH_ITEM> or superior container
...@@ -86,9 +89,8 @@ public: ...@@ -86,9 +89,8 @@ public:
/** /**
* Constructor * Constructor
* @param aPageSizeIU is the size of the initial paper page in internal units.
*/ */
SCH_SCREEN( const wxSize& aPageSizeIU ); SCH_SCREEN();
~SCH_SCREEN(); ~SCH_SCREEN();
...@@ -100,6 +102,9 @@ public: ...@@ -100,6 +102,9 @@ public:
const PAGE_INFO& GetPageSettings() const { return m_paper; } const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; } void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
void DecRefCount(); void DecRefCount();
void IncRefCount(); void IncRefCount();
......
...@@ -126,13 +126,15 @@ enum EDA_UNITS_T { ...@@ -126,13 +126,15 @@ enum EDA_UNITS_T {
class LibNameList; class LibNameList;
class PAGE_INFO; //class PAGE_INFO;
/** /**
* Class PAGE_INFO * Class PAGE_INFO
* describes the page size and margins of a paper page on which to * describes the page size and margins of a paper page on which to
* eventually print or plot. Here paper is described in inches, but * eventually print or plot. Paper sizes are often described in inches.
* accessors for mils, and internal units (IU) are supported. * Here paper is described in 1/1000th of an inch (mils). For convenience
* there are some read only accessors for internal units (IU), which is a compile
* time calculation, not runtime.
* *
* @author Dick Hollenbeck * @author Dick Hollenbeck
*/ */
...@@ -142,7 +144,7 @@ public: ...@@ -142,7 +144,7 @@ public:
PAGE_INFO( const wxString& aType = wxT( "A3" ) ); PAGE_INFO( const wxString& aType = wxT( "A3" ) );
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName ); PAGE_INFO( const wxSize& aSizeMils, const wxString& aName );
const wxString& GetType() const { return m_Type; } const wxString& GetType() const { return m_type; }
/** /**
* Function SetType * Function SetType
...@@ -152,80 +154,99 @@ public: ...@@ -152,80 +154,99 @@ public:
* @param aStandardPageDescriptionName is a wxString constant giving one of: * @param aStandardPageDescriptionName is a wxString constant giving one of:
* "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", or "User". If "User" * "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 * then the width and height are custom, and will be set according to previous calls
* to static PAGE_INFO::SetUserWidthInches( double aWidthInInches ) and * to static PAGE_INFO::SetUserWidthMils() and
* static PAGE_INFO::SetUserHeightInches( double aHeightInInches ); * static PAGE_INFO::SetUserHeightMils();
* *
* @return bool - true iff @a aStandarePageDescription was a recognized type. * @return bool - true iff @a aStandarePageDescription was a recognized type.
*/ */
bool SetType( const wxString& aStandardPageDescriptionName ); bool SetType( const wxString& aStandardPageDescriptionName );
void SetWidthInches( double aWidthInInches ); void SetWidthMils( int aWidthInMils ) { m_size.x = aWidthInMils; }
void SetHeightInches( double aHeightInInches ); int GetWidthMils() const { return m_size.x; }
double GetWidthInches() const { return m_widthInches; } void SetHeightMils( int aHeightInMils ) { m_size.y = aHeightInMils; }
double GetHeightInches() const { return m_heightInches; } int GetHeightMils() const { return m_size.y; }
int GetWidthMils() const { return int( 1000 * m_widthInches ); } const wxSize& GetSizeMils() const { return m_size; }
int GetHeightMils() const { return int( 1000 * m_heightInches ); }
const wxSize GetSizeMils() const { return wxSize( GetWidthMils(), GetHeightMils() ); }
// Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA, // Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA,
// and either deci-mils or nanometers in PCBNew. // and either deci-mils or nanometers in PCBNew.
#if defined(PCBNEW) #if defined(PCBNEW)
# if defined(KICAD_NANOMETRE) # if defined(KICAD_NANOMETRE)
int GetWidthIU() const { return int( 2.54e7 * m_widthInches ); } int GetWidthIU() const { return int( 2.54e4 * GetWidthMils() ); }
int GetHeightIU() const { return int( 2.54e7 * m_heightInches ); } int GetHeightIU() const { return int( 2.54e4 * GetHeightMils() ); }
# else # else
int GetWidthIU() const { return int( 10000 * m_widthInches ); } int GetWidthIU() const { return int( 10 * GetWidthMils() ); }
int GetHeightIU() const { return int( 10000 * m_heightInches ); } int GetHeightIU() const { return int( 10 * GetHeightMils() ); }
# endif # endif
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); } const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#elif defined(EESCHEMA) #elif defined(EESCHEMA)
int GetWidthIU() const { return int( 1000 * m_widthInches ); } int GetWidthIU() const { return GetWidthMils(); }
int GetHeightIU() const { return int( 1000 * m_heightInches ); } int GetHeightIU() const { return GetHeightMils(); }
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); } const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#endif #endif
// wxPoint GetOffsetMils() const { return m_Offset; } // wxPoint GetOffsetMils() const { return m_Offset; }
int GetLeftMarginMils() const { return m_LeftMargin; } int GetLeftMarginMils() const { return m_left_margin; }
int GetRightMarginMils() const { return m_RightMargin; } int GetRightMarginMils() const { return m_right_margin; }
int GetTopMarginMils() const { return m_TopMargin; } int GetTopMarginMils() const { return m_top_margin; }
int GetBottomMarginMils() const { return m_BottomMargin; } int GetBottomMarginMils() const { return m_bottom_margin; }
void SetLeftMarginMils( int aMargin ) { m_left_margin = aMargin; }
void SetRightMarginMils( int aMargin ) { m_right_margin = aMargin; }
void SetTopMarginMils( int aMargin ) { m_top_margin = aMargin; }
void SetBottomMarginMils( int aMargin ) { m_bottom_margin = aMargin; }
/** /**
* Function SetUserWidthInches * Function SetUserWidthMils
* sets the width of type "User" page in inches. * sets the width of type "User" page in mils.
*/ */
static void SetUserWidthInches( double aWidthInInches ); static void SetUserWidthMils( int aWidthInMils );
/** /**
* Function SetUserHeightInches * Function SetUserHeightMils
* sets the height type "User" page in inches. * sets the height type "User" page in mils.
*/ */
static void SetUserHeightInches( double aHeightInInches ); static void SetUserHeightMils( int aHeightInMils );
/** /**
* Function GetStandardSizes * Function GetStandardSizes
* returns the standard page types, such as "A4", "A3", etc. * returns the standard page types, such as "A4", "A3", etc.
*/
static wxArrayString GetStandardSizes(); static wxArrayString GetStandardSizes();
*/
private: private:
wxString m_Type; ///< paper type: A4, A3, etc.
double m_widthInches; // standard pre-defined sizes
double m_heightInches; static const PAGE_INFO pageA4;
static const PAGE_INFO pageA3;
static const PAGE_INFO pageA2;
static const PAGE_INFO pageA1;
static const PAGE_INFO pageA0;
static const PAGE_INFO pageA;
static const PAGE_INFO pageB;
static const PAGE_INFO pageC;
static const PAGE_INFO pageD;
static const PAGE_INFO pageE;
static const PAGE_INFO pageGERBER;
static const PAGE_INFO pageUser;
// all dimensions here are in mils
wxString m_type; ///< paper type: A4, A3, etc.
wxSize m_size; ///< mils
// wxPoint m_Offset; ///< plot offset in 1/1000 inches // wxPoint m_offset_mils; ///< plot offset in mils
int m_LeftMargin; int m_left_margin;
int m_RightMargin; int m_right_margin;
int m_TopMargin; int m_top_margin;
int m_BottomMargin; int m_bottom_margin;
static double s_user_height; static int s_user_height;
static double s_user_width; static int s_user_width;
}; };
......
...@@ -133,8 +133,6 @@ public: ...@@ -133,8 +133,6 @@ public:
return m_Pcb; return m_Pcb;
} }
BOARD_DESIGN_SETTINGS* GetDesignSettings();
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { } virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
...@@ -147,10 +145,7 @@ public: ...@@ -147,10 +145,7 @@ public:
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg ); virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
virtual void UpdateStatusBar(); virtual void UpdateStatusBar();
virtual PCB_SCREEN* GetScreen() const PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
{
return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen();
}
/** /**
* Function BestZoom * Function BestZoom
......
...@@ -342,6 +342,20 @@ public: ...@@ -342,6 +342,20 @@ public:
SCH_SCREEN* GetScreen() const; SCH_SCREEN* GetScreen() const;
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these three functions:
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these 5 functions:
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
void InstallConfigFrame( wxCommandEvent& event ); void InstallConfigFrame( wxCommandEvent& event );
......
...@@ -363,6 +363,10 @@ public: ...@@ -363,6 +363,10 @@ public:
*/ */
class EDA_DRAW_FRAME : public EDA_BASE_FRAME class EDA_DRAW_FRAME : public EDA_BASE_FRAME
{ {
/// Let the #EDA_DRAW_PANEL object have access to the protected data since
/// it is closely tied to the #EDA_DRAW_FRAME.
friend class EDA_DRAW_PANEL;
///< Id of active button on the vertical toolbar. ///< Id of active button on the vertical toolbar.
int m_toolId; int m_toolId;
...@@ -416,19 +420,13 @@ protected: ...@@ -416,19 +420,13 @@ protected:
/// Panel used to display information at the bottom of the main window. /// Panel used to display information at the bottom of the main window.
EDA_MSG_PANEL* m_messagePanel; EDA_MSG_PANEL* m_messagePanel;
/// Let the #EDA_DRAW_PANEL object have access to the protected data since
/// it is closely tied to the #EDA_DRAW_FRAME.
friend class EDA_DRAW_PANEL;
private: private:
BASE_SCREEN* m_currentScreen; ///< current used SCREEN BASE_SCREEN* m_currentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid. bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
protected: protected:
void SetScreen( BASE_SCREEN* aScreen )
{ void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
m_currentScreen = aScreen;
}
/** /**
* Function unitsChangeRefresh * Function unitsChangeRefresh
...@@ -439,6 +437,7 @@ protected: ...@@ -439,6 +437,7 @@ protected:
*/ */
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
public: public:
EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title, EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
...@@ -474,11 +473,12 @@ public: ...@@ -474,11 +473,12 @@ public:
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
/** /**
* Function GetBaseScreen * Function GetScreen
* is virtual and returns a pointer to a BASE_SCREEN or one of its * returns a pointer to a BASE_SCREEN or one of its
* derivatives. It may be overloaded by derived classes. * derivatives. It is overloaded by derived classes to return
* SCH_SCREEN or PCB_SCREEN.
*/ */
virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; } virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
/* Configuration entry names. */ // Configuration entry names.
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) ); static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) ); static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) ); static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
...@@ -94,7 +94,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, ...@@ -94,7 +94,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch) m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch) m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
m_DisplayPcbTrackFill = true; /* false = sketch , true = filled */ m_DisplayPcbTrackFill = true; // false = sketch , true = filled
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL) m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition m_ModuleEditFrame = NULL; // Frame for footprint edition
...@@ -194,14 +194,7 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const ...@@ -194,14 +194,7 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
} }
BOARD_DESIGN_SETTINGS* PCB_BASE_FRAME::GetDesignSettings() double PCB_BASE_FRAME::BestZoom()
{
wxASSERT( m_Pcb );
return m_Pcb ? &m_Pcb->GetDesignSettings() : NULL;
}
double PCB_BASE_FRAME::BestZoom( void )
{ {
int dx, dy; int dx, dy;
...@@ -236,7 +229,7 @@ double PCB_BASE_FRAME::BestZoom( void ) ...@@ -236,7 +229,7 @@ double PCB_BASE_FRAME::BestZoom( void )
} }
void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
{ {
// factored out of pcbnew/find.cpp // factored out of pcbnew/find.cpp
...@@ -244,7 +237,7 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) ...@@ -244,7 +237,7 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
wxClientDC dc( m_canvas ); wxClientDC dc( m_canvas );
/* There may be need to reframe the drawing. */ // There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) ) if( !m_canvas->IsPointOnDisplay( aPos ) )
{ {
screen->SetCrossHairPosition( aPos ); screen->SetCrossHairPosition( aPos );
...@@ -267,7 +260,7 @@ void PCB_BASE_FRAME::ReCreateMenuBar( void ) ...@@ -267,7 +260,7 @@ void PCB_BASE_FRAME::ReCreateMenuBar( void )
} }
/* Virtual functions: Do nothing for PCB_BASE_FRAME window */ // Virtual functions: Do nothing for PCB_BASE_FRAME window
void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event ) void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
{ {
} }
......
...@@ -176,7 +176,7 @@ private: ...@@ -176,7 +176,7 @@ private:
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
PAGE_INFO m_paper; PAGE_INFO m_paper;
/// Position of the origin axis. /// Position of the origin axis, which is used in exports mostly
wxPoint m_originAxisPosition; wxPoint m_originAxisPosition;
/** /**
......
...@@ -476,8 +476,8 @@ void KICAD_PLUGIN::loadSHEET() ...@@ -476,8 +476,8 @@ void KICAD_PLUGIN::loadSHEET()
int w = intParse( width ); int w = intParse( width );
int h = intParse( height ); int h = intParse( height );
page.SetWidthInches( w / 1000.0 ); page.SetWidthMils( w );
page.SetHeightInches( h / 1000.0 ); page.SetHeightMils( h );
} }
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "worksheet.h" #include "worksheet.h"
#include "dialog_hotkeys_editor.h" #include "dialog_hotkeys_editor.h"
#include "class_pad.h" #include "class_board.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -210,7 +210,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings() ...@@ -210,7 +210,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
{ {
PARAM_CFG_ARRAY pca; PARAM_CFG_ARRAY pca;
BOARD_DESIGN_SETTINGS& bds = *GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer, pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
GROUPLIB ) ); GROUPLIB ) );
......
...@@ -152,6 +152,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, ...@@ -152,6 +152,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
FILE* FichCmp, * NewFile; FILE* FichCmp, * NewFile;
char line[1024]; char line[1024];
wxString msg; wxString msg;
char* ignore;
if( old_name == new_name ) if( old_name == new_name )
return 0; return 0;
...@@ -189,7 +190,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, ...@@ -189,7 +190,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
return 1; return 1;
} }
fgets( line, sizeof(line), FichCmp ); ignore = fgets( line, sizeof(line), FichCmp );
fprintf( NewFile, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) ); fprintf( NewFile, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
...@@ -587,6 +588,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) ...@@ -587,6 +588,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
MODULE* Module = GetBoard()->m_Modules; MODULE* Module = GetBoard()->m_Modules;
wxString msg; wxString msg;
wxString wildcard; wxString wildcard;
char* ignore;
if( Module == NULL ) if( Module == NULL )
{ {
...@@ -617,7 +619,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) ...@@ -617,7 +619,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return; return;
} }
fgets( line, sizeof(line), FichCmp ); ignore = fgets( line, sizeof(line), FichCmp );
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) ); fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment