Commit d3afe95c authored by Dick Hollenbeck's avatar Dick Hollenbeck

remove page size globals from eeschema

parent 697f9123
...@@ -22,8 +22,8 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) ...@@ -22,8 +22,8 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
option(USE_PNG_BITMAPS "use PNG bitmaps instead of XPM (default ON)" ON) option(USE_PNG_BITMAPS "use PNG bitmaps instead of XPM (default ON)" ON)
option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format (default OFF)" OFF) option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format (default ON)" ON)
option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format (default OFF)" OFF) option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format (default ON)" ON)
# Russian GOST patch # Russian GOST patch
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)") option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
...@@ -265,6 +265,11 @@ add_subdirectory(bitmap2component) ...@@ -265,6 +265,11 @@ add_subdirectory(bitmap2component)
add_subdirectory(pcb_calculator) add_subdirectory(pcb_calculator)
#add_subdirectory(new) #add_subdirectory(new)
add_executable( container_test EXCLUDE_FROM_ALL container_test.cpp )
target_link_libraries( container_test common polygon bitmaps ${wxWidgets_LIBRARIES} )
############# #############
# Resources # # Resources #
############# #############
......
...@@ -178,24 +178,24 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString ) ...@@ -178,24 +178,24 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
// Standard page sizes in 1/1000 inch // Standard page sizes in 1/1000 inch
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
static const PAGE_INFO pageA4( wxSize( 8283, 11700 ), wxPoint( 0, 0 ), wxT( "A4" ) ); static const PAGE_INFO pageA4( wxSize( 8283, 11700 ), wxT( "A4" ) );
#else #else
static const PAGE_INFO pageA4( wxSize( 11700, 8267 ), wxPoint( 0, 0 ), wxT( "A4" ) ); static const PAGE_INFO pageA4( wxSize( 11700, 8267 ), wxT( "A4" ) );
#endif #endif
static const PAGE_INFO pageA3( wxSize( 16535, 11700 ), wxPoint( 0, 0 ), wxT( "A3" ) ); static const PAGE_INFO pageA3( wxSize( 16535, 11700 ), wxT( "A3" ) );
static const PAGE_INFO pageA2( wxSize( 23400, 16535 ), wxPoint( 0, 0 ), wxT( "A2" ) ); static const PAGE_INFO pageA2( wxSize( 23400, 16535 ), wxT( "A2" ) );
static const PAGE_INFO pageA1( wxSize( 33070, 23400 ), wxPoint( 0, 0 ), wxT( "A1" ) ); static const PAGE_INFO pageA1( wxSize( 33070, 23400 ), wxT( "A1" ) );
static const PAGE_INFO pageA0( wxSize( 46800, 33070 ), wxPoint( 0, 0 ), wxT( "A0" ) ); static const PAGE_INFO pageA0( wxSize( 46800, 33070 ), wxT( "A0" ) );
static const PAGE_INFO pageA( wxSize( 11000, 8500 ), wxPoint( 0, 0 ), wxT( "A" ) ); static const PAGE_INFO pageA( wxSize( 11000, 8500 ), wxT( "A" ) );
static const PAGE_INFO pageB( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "B" ) ); static const PAGE_INFO pageB( wxSize( 17000, 11000 ), wxT( "B" ) );
static const PAGE_INFO pageC( wxSize( 22000, 17000 ), wxPoint( 0, 0 ), wxT( "C" ) ); static const PAGE_INFO pageC( wxSize( 22000, 17000 ), wxT( "C" ) );
static const PAGE_INFO pageD( wxSize( 34000, 22000 ), wxPoint( 0, 0 ), wxT( "D" ) ); static const PAGE_INFO pageD( wxSize( 34000, 22000 ), wxT( "D" ) );
static const PAGE_INFO pageE( wxSize( 44000, 34000 ), wxPoint( 0, 0 ), wxT( "E" ) ); static const PAGE_INFO pageE( wxSize( 44000, 34000 ), wxT( "E" ) );
static const PAGE_INFO pageGERBER(wxSize( 32000, 32000 ), wxPoint( 0, 0 ), wxT( "GERBER" ) ); static const PAGE_INFO pageGERBER(wxSize( 32000, 32000 ), wxT( "GERBER" ) );
double PAGE_INFO::s_user_width = 17.0; double PAGE_INFO::s_user_width = 17.0;
double PAGE_INFO::s_user_height = 11.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 pageUser( wxSize( 17000, 11000 ), wxT( "User" ) );
static const PAGE_INFO* stdPageSizes[] = { static const PAGE_INFO* stdPageSizes[] = {
&pageA4, &pageA4,
...@@ -263,13 +263,12 @@ bool PAGE_INFO::SetType( const wxString& aType ) ...@@ -263,13 +263,12 @@ bool PAGE_INFO::SetType( const wxString& aType )
} }
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxPoint& aOffsetMils, const wxString& aType ) PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType )
{ {
// aSizeMils is in 1/1000th of an inch // aSizeMils is in 1/1000th of an inch
SetWidthInches( aSizeMils.x / 1000.0 ); SetWidthInches( aSizeMils.x / 1000.0 );
SetHeightInches( aSizeMils.y / 1000.0 ); SetHeightInches( aSizeMils.y / 1000.0 );
m_Offset = aOffsetMils;
m_Type = aType; m_Type = aType;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm) // Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
......
...@@ -87,7 +87,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, ...@@ -87,7 +87,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
SetIcon( icon ); SetIcon( icon );
SetBoard( new BOARD() ); SetBoard( new BOARD() );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
LoadSettings(); LoadSettings();
......
...@@ -119,7 +119,7 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list ) ...@@ -119,7 +119,7 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
for( unsigned ii = 0; ii < list.GetCount(); ii++ ) for( unsigned ii = 0; ii < list.GetCount(); ii++ )
{ {
FOOTPRINT_INFO & footprint = list.GetItem(ii); FOOTPRINT_INFO & footprint = list.GetItem(ii);
msg.Printf( wxT( "%3d %s" ), m_FullFootprintList.GetCount() + 1, msg.Printf( wxT( "%3d %s" ), (int) m_FullFootprintList.GetCount() + 1,
GetChars(footprint.m_Module) ); GetChars(footprint.m_Module) );
m_FullFootprintList.Add( msg ); m_FullFootprintList.Add( msg );
} }
......
...@@ -605,7 +605,7 @@ void CVPCB_MAINFRAME::DisplayStatus() ...@@ -605,7 +605,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
{ {
wxString msg; wxString msg;
msg.Printf( _( "Components: %d (free: %d)" ), m_components.size(), m_undefinedComponentCnt ); msg.Printf( _( "Components: %d (free: %d)" ), (int) m_components.size(), m_undefinedComponentCnt );
SetStatusText( msg, 0 ); SetStatusText( msg, 0 );
SetStatusText( wxEmptyString, 1 ); SetStatusText( wxEmptyString, 1 );
...@@ -614,10 +614,10 @@ void CVPCB_MAINFRAME::DisplayStatus() ...@@ -614,10 +614,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
{ {
if( m_FootprintList->m_UseFootprintFullList ) if( m_FootprintList->m_UseFootprintFullList )
msg.Printf( _( "Footprints (All): %d" ), msg.Printf( _( "Footprints (All): %d" ),
m_FootprintList->m_ActiveFootprintList->GetCount() ); (int) m_FootprintList->m_ActiveFootprintList->GetCount() );
else else
msg.Printf( _( "Footprints (filtered): %d" ), msg.Printf( _( "Footprints (filtered): %d" ),
m_FootprintList->m_ActiveFootprintList->GetCount() ); (int) m_FootprintList->m_ActiveFootprintList->GetCount() );
} }
else else
{ {
......
...@@ -199,7 +199,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -199,7 +199,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
{ {
int tmpzoom; int tmpzoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize SheetSize; // Sheet size in internal units wxSize sheetSize; // Sheet size in internal units
wxPoint old_org; wxPoint old_org;
bool success = true; bool success = true;
...@@ -209,16 +209,15 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -209,16 +209,15 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0; screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
SheetSize = screen->ReturnPageSize(); // page size in 1/1000 inch, ie in internal units sheetSize = screen->GetPageSettings().GetSizeIU(); // page size in 1/1000 inch, ie in internal units
screen->SetScalingFactor( 1.0 ); screen->SetScalingFactor( 1.0 );
EDA_DRAW_PANEL* panel = frame->GetCanvas(); EDA_DRAW_PANEL* panel = frame->GetCanvas();
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed LOCALE_IO toggle;
// to print floating point numbers like 1.3)
float dpi = (float) frame->GetInternalUnits(); float dpi = (float) frame->GetInternalUnits();
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); wxSVGFileDC dc( FullFileName, sheetSize.x, sheetSize.y, dpi );
EDA_RECT tmp = panel->m_ClipBox; EDA_RECT tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc );
...@@ -236,7 +235,6 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -236,7 +235,6 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness ); frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
......
...@@ -63,11 +63,11 @@ private: ...@@ -63,11 +63,11 @@ private:
void initDlg(); void initDlg();
void initOptVars(); void initOptVars();
void CreateDXFFile(); void CreateDXFFile();
void PlotOneSheetDXF( const wxString& FileName, void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen,
SCH_SCREEN* screen, PAGE_INFO* sheet,
wxPoint plot_offset, double scale ); wxPoint plot_offset, double scale );
}; };
/* static members (static to remember last state): */
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plotColorOpt = false; bool DIALOG_PLOT_SCHEMATIC_DXF::m_plotColorOpt = false;
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true; bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true;
...@@ -147,8 +147,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) ...@@ -147,8 +147,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
wxString PlotFileName; wxString plotFileName;
PAGE_INFO* PlotSheet;
wxPoint plot_offset; wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page. /* When printing all pages, the printed page is not the current page.
...@@ -186,15 +185,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) ...@@ -186,15 +185,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
sheetpath = SheetList.GetNext(); sheetpath = SheetList.GetNext();
} }
PlotSheet = screen->m_CurrentSheetDesc;
double scale = 10; double scale = 10;
plot_offset.x = 0; plot_offset.x = 0;
plot_offset.y = 0; plot_offset.y = 0;
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" ); plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale ); PlotOneSheetDXF( plotFileName, screen, plot_offset, scale );
if( !m_select_PlotAll ) if( !m_select_PlotAll )
break; break;
...@@ -206,14 +204,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) ...@@ -206,14 +204,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
} }
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen, SCH_SCREEN* screen,
PAGE_INFO* sheet, wxPoint plot_offset,
wxPoint plot_offset, double scale )
double scale )
{ {
wxString msg;
wxString msg;
FILE* output_file = wxFopen( FileName, wxT( "wt" ) ); FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
...@@ -227,13 +225,17 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, ...@@ -227,13 +225,17 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
msg.Printf( _( "Plot: %s " ), GetChars( FileName ) ); msg.Printf( _( "Plot: %s " ), GetChars( FileName ) );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
SetLocaleTo_C_standard(); LOCALE_IO toggle;
DXF_PLOTTER* plotter = new DXF_PLOTTER(); DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( sheet );
const PAGE_INFO& pageInfo = screen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 ); plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_color_mode( m_plotColorOpt ); plotter->set_color_mode( m_plotColorOpt );
/* Init : */ // Init :
plotter->set_creator( wxT( "Eeschema-DXF" ) ); plotter->set_creator( wxT( "Eeschema-DXF" ) );
plotter->set_filename( FileName ); plotter->set_filename( FileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
...@@ -246,10 +248,9 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, ...@@ -246,10 +248,9 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
screen->Plot( plotter ); screen->Plot( plotter );
/* fin */ // finish
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) ); m_MsgBox->AppendText( wxT( "Ok\n" ) );
} }
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
#include "dialog_plot_schematic_HPGL_base.h" #include "dialog_plot_schematic_HPGL_base.h"
enum PageFormatReq
enum HPGL_PAGEZ_T
{ {
PAGE_DEFAULT = 0, PAGE_DEFAULT = 0,
PAGE_SIZE_A4, PAGE_SIZE_A4,
...@@ -51,37 +52,47 @@ enum PageFormatReq ...@@ -51,37 +52,47 @@ enum PageFormatReq
PAGE_SIZE_B, PAGE_SIZE_B,
PAGE_SIZE_C, PAGE_SIZE_C,
PAGE_SIZE_D, PAGE_SIZE_D,
PAGE_SIZE_E PAGE_SIZE_E,
}; };
static PAGE_INFO* Plot_sheet_list[] =
static const wxChar* plot_sheet_list( HPGL_PAGEZ_T aSize )
{ {
NULL, const wxChar* ret;
&g_Sheet_A4,
&g_Sheet_A3, switch( aSize )
&g_Sheet_A2, {
&g_Sheet_A1, default:
&g_Sheet_A0, case PAGE_DEFAULT: ret = NULL; break;
&g_Sheet_A, case PAGE_SIZE_A4: ret = wxT( "A4" ); break;
&g_Sheet_B, case PAGE_SIZE_A3: ret = wxT( "A3" ); break;
&g_Sheet_C, case PAGE_SIZE_A2: ret = wxT( "A2" ); break;
&g_Sheet_D, case PAGE_SIZE_A1: ret = wxT( "A1" ); break;
&g_Sheet_E, case PAGE_SIZE_A0: ret = wxT( "A0" ); break;
&g_Sheet_GERBER, case PAGE_SIZE_A: ret = wxT( "A" ); break;
&g_Sheet_user case PAGE_SIZE_B: ret = wxT( "B" ); break;
case PAGE_SIZE_C: ret = wxT( "C" ); break;
case PAGE_SIZE_D: ret = wxT( "D" ); break;
case PAGE_SIZE_E: ret = wxT( "E" ); break;
}
return ret;
}; };
class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE
{ {
private: private:
SCH_EDIT_FRAME* m_Parent; SCH_EDIT_FRAME* m_Parent;
public: public:
DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ); DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent );
private: private:
static PageFormatReq m_pageSizeSelect; static HPGL_PAGEZ_T s_pageSizeSelect;
static bool m_plot_Sheet_Ref; static bool s_plot_Sheet_Ref;
static wxSize s_Offset;
bool m_select_PlotAll; bool m_select_PlotAll;
private: private:
...@@ -89,7 +100,7 @@ private: ...@@ -89,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();
...@@ -97,15 +108,17 @@ private: ...@@ -97,15 +108,17 @@ private:
void SetPenWidth(); void SetPenWidth();
void SetPageOffsetValue(); void SetPageOffsetValue();
void HPGL_Plot( bool aPlotAll ); void HPGL_Plot( bool aPlotAll );
void Plot_Schematic_HPGL( bool aPlotAll, int HPGL_SheetSize ); void Plot_Schematic_HPGL( bool aPlotAll );
void Plot_1_Page_HPGL( const wxString& FileName, void Plot_1_Page_HPGL( const wxString& FileName,
SCH_SCREEN* screen, PAGE_INFO* sheet, SCH_SCREEN* screen, const PAGE_INFO& aPageInfo,
wxPoint& offset, double plot_scale ); wxPoint& offset, double plot_scale );
void ReturnSheetDims( SCH_SCREEN* screen, wxSize& SheetSize, wxPoint& SheetOffset );
}; };
/* static members (static to remember last state): */
PageFormatReq DIALOG_PLOT_SCHEMATIC_HPGL:: m_pageSizeSelect = PAGE_DEFAULT;
bool DIALOG_PLOT_SCHEMATIC_HPGL::m_plot_Sheet_Ref = true; // static members (static to remember last state):
HPGL_PAGEZ_T DIALOG_PLOT_SCHEMATIC_HPGL:: s_pageSizeSelect = PAGE_DEFAULT;
bool DIALOG_PLOT_SCHEMATIC_HPGL::s_plot_Sheet_Ref = true;
void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event ) void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
...@@ -115,8 +128,8 @@ void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event ) ...@@ -115,8 +128,8 @@ void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
} }
DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) :
:DIALOG_PLOT_SCHEMATIC_HPGL_BASE(parent) DIALOG_PLOT_SCHEMATIC_HPGL_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
initDlg(); initDlg();
...@@ -130,16 +143,14 @@ DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) ...@@ -130,16 +143,14 @@ DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent )
void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg() void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg()
{ {
SetFocus(); // Make ESC key work
SetFocus(); // Make ESC key working
// Set validators // Set validators
m_SizeOption->SetSelection( m_pageSizeSelect ); m_SizeOption->SetSelection( s_pageSizeSelect );
AddUnitSymbol( *m_penWidthTitle, g_UserUnit ); AddUnitSymbol( *m_penWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam, EESCHEMA_INTERNAL_UNIT ); PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam, EESCHEMA_INTERNAL_UNIT );
m_penSpeedCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Speed ); m_penSpeedCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Speed );
m_penNumCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Num ); m_penNumCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Num );
} }
...@@ -153,25 +164,31 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::OnPlotAll( wxCommandEvent& event ) ...@@ -153,25 +164,31 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::OnPlotAll( wxCommandEvent& event )
HPGL_Plot( true ); HPGL_Plot( true );
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event ) void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( 0 ); EndModal( 0 );
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue() void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
{ {
wxString msg; wxString msg;
m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection(); s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
if( m_pageSizeSelect != PAGE_DEFAULT )
if( s_pageSizeSelect != PAGE_DEFAULT )
{ {
msg = ReturnStringFromValue( g_UserUnit, msg = ReturnStringFromValue( g_UserUnit,
Plot_sheet_list[m_pageSizeSelect]->m_Offset.x, s_Offset.x,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_X->SetValue( msg ); m_PlotOrgPosition_X->SetValue( msg );
msg = ReturnStringFromValue( g_UserUnit, msg = ReturnStringFromValue( g_UserUnit,
Plot_sheet_list[m_pageSizeSelect]-> m_Offset.y, s_Offset.y,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_Y->SetValue( msg ); m_PlotOrgPosition_Y->SetValue( msg );
m_PlotOrgPosition_X->Enable( TRUE ); m_PlotOrgPosition_X->Enable( TRUE );
...@@ -185,18 +202,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue() ...@@ -185,18 +202,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event ) void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptplotOffset( wxCommandEvent& event )
{ {
m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection(); s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
if( m_pageSizeSelect != PAGE_DEFAULT ) if( s_pageSizeSelect != PAGE_DEFAULT )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
Plot_sheet_list[m_pageSizeSelect]->m_Offset.x =
ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
Plot_sheet_list[m_pageSizeSelect]->m_Offset.y =
ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
} }
} }
...@@ -243,52 +261,32 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll ) ...@@ -243,52 +261,32 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
SetPenNum( ); SetPenNum( );
SetPenSpeed( ); SetPenSpeed( );
if( m_pageSizeSelect != PAGE_DEFAULT ) if( s_pageSizeSelect != PAGE_DEFAULT )
{ {
PAGE_INFO* plot_sheet = Plot_sheet_list[m_pageSizeSelect];
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
plot_sheet->m_Offset.x =
ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
msg = m_PlotOrgPosition_Y->GetValue();
plot_sheet->m_Offset.y =
ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
}
Plot_Schematic_HPGL( aPlotAll, m_pageSizeSelect );
}
s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
/* Function calculates the offsets and dimensions of any trace of the msg = m_PlotOrgPosition_Y->GetValue();
* selected sheet
*/
void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
wxSize& SheetSize,
wxPoint& SheetOffset )
{
PAGE_INFO* PlotSheet;
if( screen == NULL )
screen = m_Parent->GetScreen();
PlotSheet = screen->m_CurrentSheetDesc; s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
}
SheetSize = PlotSheet->m_Size; Plot_Schematic_HPGL( aPlotAll );
SheetOffset = PlotSheet->m_Offset;
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_SheetSize ) void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
{ {
wxString PlotFileName; wxString plotFileName;
SCH_SCREEN* screen = m_Parent->GetScreen(); SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
PAGE_INFO* PlotSheet;
wxSize SheetSize; wxPoint plotOffset;
wxPoint SheetOffset, PlotOffset;
/* When printing all pages, the printed page is not the current page. /* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must setup references and others parameters * In complex hierarchies, we must setup references and other parameters
* in the printed SCH_SCREEN * in the printed SCH_SCREEN
* because in complex hierarchies a SCH_SCREEN (a schematic drawings) * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
* is shared between many sheets * is shared between many sheets
...@@ -312,7 +310,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh ...@@ -312,7 +310,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
m_Parent->SetCurrentSheet( list ); m_Parent->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount(); m_Parent->SetSheetNumberAndCount();
screen = m_Parent->GetCurrentSheet().LastScreen(); screen = m_Parent->GetCurrentSheet().LastScreen();
if( !screen ) // LastScreen() may return NULL
screen = m_Parent->GetScreen();
} }
else // Should not happen else // Should not happen
return; return;
...@@ -320,26 +322,28 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh ...@@ -320,26 +322,28 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
sheetpath = SheetList.GetNext(); sheetpath = SheetList.GetNext();
} }
ReturnSheetDims( screen, SheetSize, SheetOffset ); const PAGE_INFO& curPage = screen->GetPageSettings();
PAGE_INFO plotPage = curPage;
// if plotting on a page size other than curPage
if( s_pageSizeSelect != PAGE_DEFAULT )
plotPage.SetType( plot_sheet_list( s_pageSizeSelect ) );
/* Calculation of conversion scales. */ // Calculation of conversion scales.
if( HPGL_SheetSize )
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
else
PlotSheet = screen->m_CurrentSheetDesc;
/* 10x because Eeschema works in mils, not decimals */ // 10x because Eeschema works in mils, not deci-mils
double plot_scale = 10 * (double) PlotSheet->m_Size.x / (double) SheetSize.x; double plot_scale = 10 * (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
/* Calculate offsets */ // Calculate offsets
PlotOffset.x = -SheetOffset.x; plotOffset.x = -s_Offset.x;
PlotOffset.y = -SheetOffset.y; plotOffset.y = -s_Offset.y;
PlotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" ); plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
SetLocaleTo_C_standard(); LOCALE_IO toggle;
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset, plot_scale );
SetLocaleTo_Default(); Plot_1_Page_HPGL( plotFileName, screen, plotPage, plotOffset, plot_scale );
if( !aPlotAll ) if( !aPlotAll )
break; break;
...@@ -351,11 +355,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh ...@@ -351,11 +355,11 @@ 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, void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
SCH_SCREEN* screen, SCH_SCREEN* screen,
PAGE_INFO* sheet, const PAGE_INFO& pageInfo,
wxPoint& offset, wxPoint& offset,
double plot_scale ) double plot_scale )
{ {
wxString msg; wxString msg;
...@@ -370,15 +374,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName, ...@@ -370,15 +374,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
return; return;
} }
SetLocaleTo_C_standard(); LOCALE_IO toggle;
msg.Printf( _( "Plot: %s " ), FileName.GetData() ); msg.Printf( _( "Plot: %s " ), FileName.GetData() );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
HPGL_PLOTTER* plotter = new HPGL_PLOTTER(); HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->set_paper_size( sheet );
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( offset, plot_scale, 0 ); plotter->set_viewport( offset, plot_scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness ); plotter->set_default_line_width( g_DrawDefaultLineThickness );
/* Init : */
// Init :
plotter->set_creator( wxT( "Eeschema-HPGL" ) ); plotter->set_creator( wxT( "Eeschema-HPGL" ) );
plotter->set_filename( FileName ); plotter->set_filename( FileName );
plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed ); plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed );
...@@ -389,14 +397,13 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName, ...@@ -389,14 +397,13 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
plotter->set_color( BLACK ); plotter->set_color( BLACK );
if( m_plot_Sheet_Ref ) if( s_plot_Sheet_Ref )
m_Parent->PlotWorkSheet( plotter, screen ); m_Parent->PlotWorkSheet( plotter, screen );
screen->Plot( plotter ); screen->Plot( plotter );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) ); m_MsgBox->AppendText( wxT( "Ok\n" ) );
} }
...@@ -406,7 +413,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName, ...@@ -406,7 +413,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
*/ */
void DIALOG_PLOT_SCHEMATIC_HPGL::OnPageSelected( wxCommandEvent& event ) void DIALOG_PLOT_SCHEMATIC_HPGL::OnPageSelected( wxCommandEvent& event )
{ {
m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection(); s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
SetPageOffsetValue(); SetPageOffsetValue();
} }
......
...@@ -70,12 +70,13 @@ private: ...@@ -70,12 +70,13 @@ private:
void initOptVars(); void initOptVars();
void createPSFile(); void createPSFile();
void plotOneSheetPS( const wxString& FileName, void plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen, PAGE_INFO* sheet, SCH_SCREEN* screen, const PAGE_INFO& pageInfo,
wxPoint plot_offset, double scale ); wxPoint plot_offset, double scale );
}; };
/* static members (static to remember last state): */
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_PS::m_plotColorOpt = false; bool DIALOG_PLOT_SCHEMATIC_PS::m_plotColorOpt = false;
int DIALOG_PLOT_SCHEMATIC_PS:: m_pageSizeSelect = PAGE_SIZE_AUTO; int DIALOG_PLOT_SCHEMATIC_PS::m_pageSizeSelect = PAGE_SIZE_AUTO;
bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true; bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true;
...@@ -172,13 +173,13 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars() ...@@ -172,13 +173,13 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{ {
SCH_SCREEN* screen = m_Parent->GetScreen(); SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxString plotFileName; wxString plotFileName;
PAGE_INFO* actualPage; // page size selected in schematic PAGE_INFO actualPage; // page size selected in schematic
PAGE_INFO* plotPage; // page size selected to plot PAGE_INFO plotPage; // page size selected to plot
wxPoint plot_offset; wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page. /* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must update component references * In complex hierarchies, we must update component references
...@@ -213,16 +214,16 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() ...@@ -213,16 +214,16 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
sheetpath = SheetList.GetNext(); sheetpath = SheetList.GetNext();
} }
actualPage = screen->m_CurrentSheetDesc; actualPage = screen->GetPageSettings();
switch( m_pageSizeSelect ) switch( m_pageSizeSelect )
{ {
case PAGE_SIZE_A: case PAGE_SIZE_A:
plotPage = &g_Sheet_A; plotPage.SetType( wxT( "A" ) );
break; break;
case PAGE_SIZE_A4: case PAGE_SIZE_A4:
plotPage = &g_Sheet_A4; plotPage.SetType( wxT( "A4" ) );
break; break;
case PAGE_SIZE_AUTO: case PAGE_SIZE_AUTO:
...@@ -231,8 +232,9 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() ...@@ -231,8 +232,9 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
break; break;
} }
double scalex = (double) plotPage->m_Size.x / actualPage->m_Size.x; double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage->m_Size.y / actualPage->m_Size.y; double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = 10 * MIN( scalex, scaley ); double scale = 10 * MIN( scalex, scaley );
plot_offset.x = 0; plot_offset.x = 0;
...@@ -252,11 +254,11 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() ...@@ -252,11 +254,11 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
} }
void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName, void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen, SCH_SCREEN* screen,
PAGE_INFO* sheet, const PAGE_INFO& pageInfo,
wxPoint plot_offset, wxPoint plot_offset,
double scale ) double scale )
{ {
wxString msg; wxString msg;
...@@ -276,12 +278,12 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName, ...@@ -276,12 +278,12 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
PS_PLOTTER* plotter = new PS_PLOTTER(); PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->set_paper_size( sheet ); plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 ); plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness ); plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->set_color_mode( m_plotColorOpt ); plotter->set_color_mode( m_plotColorOpt );
/* Init : */ // Init :
plotter->set_creator( wxT( "Eeschema-PS" ) ); plotter->set_creator( wxT( "Eeschema-PS" ) );
plotter->set_filename( FileName ); plotter->set_filename( FileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
......
...@@ -620,7 +620,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, int aDrawMode, int aC ...@@ -620,7 +620,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, int aDrawMode, int aC
void SCH_SCREEN::Plot( PLOTTER* aPlotter ) void SCH_SCREEN::Plot( PLOTTER* aPlotter )
{ {
for( SCH_ITEM* item = GetDrawItems(); item != NULL; item = item->Next() ) for( SCH_ITEM* item = GetDrawItems(); item; item = item->Next() )
{ {
aPlotter->set_current_line_width( item->GetPenSize() ); aPlotter->set_current_line_width( item->GetPenSize() );
item->Plot( aPlotter ); item->Plot( aPlotter );
......
...@@ -64,8 +64,8 @@ class SCH_SCREEN : public BASE_SCREEN ...@@ -64,8 +64,8 @@ class SCH_SCREEN : public BASE_SCREEN
int m_refCount; ///< Number of sheets referencing this screen. int m_refCount; ///< Number of sheets referencing this 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' as this class gets split
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
......
...@@ -44,13 +44,13 @@ class BASE_SCREEN; ...@@ -44,13 +44,13 @@ class BASE_SCREEN;
class EDA_DRAW_FRAME; class EDA_DRAW_FRAME;
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
/* Flag for special keys */ // Flag for special keys
#define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right #define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right
* shift key depressed */ * shift key depressed */
#define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed #define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed
*/ */
#define GR_KB_CTRL 0x40000000 /* CTRL depressed */ #define GR_KB_CTRL 0x40000000 // CTRL depressed
#define GR_KB_ALT 0x80000000 /* ALT depressed */ #define GR_KB_ALT 0x80000000 // ALT depressed
#define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT) #define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL) #define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE 0x08000000 /* Middle button mouse #define MOUSE_MIDDLE 0x08000000 /* Middle button mouse
...@@ -74,7 +74,7 @@ enum pseudokeys { ...@@ -74,7 +74,7 @@ enum pseudokeys {
#define ESC 27 #define ESC 27
/* TODO Executable names TODO*/ // TODO Executable names TODO
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#define CVPCB_EXE wxT( "cvpcb.exe" ) #define CVPCB_EXE wxT( "cvpcb.exe" )
#define PCBNEW_EXE wxT( "pcbnew.exe" ) #define PCBNEW_EXE wxT( "pcbnew.exe" )
...@@ -101,7 +101,7 @@ enum pseudokeys { ...@@ -101,7 +101,7 @@ enum pseudokeys {
#endif #endif
/* Graphic Texts Orientation in 0.1 degree*/ // Graphic Texts Orientation in 0.1 degree
#define TEXT_ORIENT_HORIZ 0 #define TEXT_ORIENT_HORIZ 0
#define TEXT_ORIENT_VERT 900 #define TEXT_ORIENT_VERT 900
...@@ -116,13 +116,13 @@ enum EDA_UNITS_T { ...@@ -116,13 +116,13 @@ enum EDA_UNITS_T {
}; };
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
#define GOST_LEFTMARGIN 800 /* 20mm */ #define GOST_LEFTMARGIN 800 // 20mm
#define GOST_RIGHTMARGIN 200 /* 5mm */ #define GOST_RIGHTMARGIN 200 // 5mm
#define GOST_TOPMARGIN 200 /* 5mm */ #define GOST_TOPMARGIN 200 // 5mm
#define GOST_BOTTOMMARGIN 200 /* 5mm */ #define GOST_BOTTOMMARGIN 200 // 5mm
#endif #endif
/* forward declarations: */ // forward declarations:
class LibNameList; class LibNameList;
...@@ -131,9 +131,8 @@ class PAGE_INFO; ...@@ -131,9 +131,8 @@ 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. Since paper is often described in inches, * eventually print or plot. Here paper is described in inches, but
* (and due to legacy code), inches, mils, and internal units (IU) are supported * accessors for mils, and internal units (IU) are supported.
* in the accessors. Again, we are describing paper in this class.
* *
* @author Dick Hollenbeck * @author Dick Hollenbeck
*/ */
...@@ -141,7 +140,7 @@ class PAGE_INFO ...@@ -141,7 +140,7 @@ class PAGE_INFO
{ {
public: public:
PAGE_INFO( const wxString& aType = wxT( "A3" ) ); PAGE_INFO( const wxString& aType = wxT( "A3" ) );
PAGE_INFO( const wxSize& aSizeMils, const wxPoint& aOffsetMils, 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; }
...@@ -187,7 +186,7 @@ public: ...@@ -187,7 +186,7 @@ public:
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_LeftMargin; }
int GetRightMarginMils() const { return m_RightMargin; } int GetRightMarginMils() const { return m_RightMargin; }
...@@ -218,7 +217,7 @@ private: ...@@ -218,7 +217,7 @@ private:
double m_widthInches; double m_widthInches;
double m_heightInches; double m_heightInches;
wxPoint m_Offset; ///< plot offset in 1/1000 inches // wxPoint m_Offset; ///< plot offset in 1/1000 inches
int m_LeftMargin; int m_LeftMargin;
int m_RightMargin; int m_RightMargin;
...@@ -232,10 +231,10 @@ private: ...@@ -232,10 +231,10 @@ private:
extern wxString g_ProductName; extern wxString g_ProductName;
/* Default user lib path can be left void, if the standard lib path is used */ /// Default user lib path can be left void, if the standard lib path is used
extern wxString g_UserLibDirBuffer; extern wxString g_UserLibDirBuffer;
extern bool g_ShowPageLimits; // true to display the page limits extern bool g_ShowPageLimits; ///< true to display the page limits
/** /**
* File extension definitions. Please do not changes these. If a different * File extension definitions. Please do not changes these. If a different
...@@ -263,10 +262,10 @@ extern const wxString MacrosFileWildcard; ...@@ -263,10 +262,10 @@ extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard; extern const wxString AllFilesWildcard;
// Name of default configuration file. (kicad.pro) /// Name of default configuration file. (kicad.pro)
extern wxString g_Prj_Default_Config_FullFilename; extern wxString g_Prj_Default_Config_FullFilename;
// Name of local configuration file. (<curr projet>.pro) /// Name of local configuration file. (<curr projet>.pro)
extern wxString g_Prj_Config_LocalFilename; extern wxString g_Prj_Config_LocalFilename;
extern EDA_UNITS_T g_UserUnit; ///< display units extern EDA_UNITS_T g_UserUnit; ///< display units
...@@ -275,7 +274,7 @@ extern EDA_UNITS_T g_UserUnit; ///< display units ...@@ -275,7 +274,7 @@ extern EDA_UNITS_T g_UserUnit; ///< display units
extern int g_GhostColor; extern int g_GhostColor;
/* COMMON.CPP */ // COMMON.CPP
/** /**
* Function SetLocaleTo_C_standard * Function SetLocaleTo_C_standard
......
...@@ -343,7 +343,7 @@ void DIALOG_PAD_PROPERTIES::initValues() ...@@ -343,7 +343,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
break; break;
} }
msg.Printf( wxT( "%d" ), m_dummyPad->m_Orient ); msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
m_PadOrientCtrl->SetValue( msg ); m_PadOrientCtrl->SetValue( msg );
// Type of pad selection // Type of pad selection
...@@ -493,7 +493,7 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event ) ...@@ -493,7 +493,7 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
} }
wxString msg; wxString msg;
msg.Printf( wxT( "%d" ), m_dummyPad->m_Orient ); msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
m_PadOrientCtrl->SetValue( msg ); m_PadOrientCtrl->SetValue( msg );
TransfertDataToPad( m_dummyPad ); TransfertDataToPad( m_dummyPad );
...@@ -775,10 +775,11 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError ...@@ -775,10 +775,11 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
aPad->m_Offset.x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits ); aPad->m_Offset.x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits );
aPad->m_Offset.y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits ); aPad->m_Offset.y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits );
long orient_value = 0; double orient_value = 0;
msg = m_PadOrientCtrl->GetValue(); msg = m_PadOrientCtrl->GetValue();
msg.ToLong( &orient_value ); msg.ToDouble( &orient_value );
aPad->m_Orient = orient_value;
aPad->SetOrientation( orient_value );
msg = m_PadNumCtrl->GetValue().Left( 4 ); msg = m_PadNumCtrl->GetValue().Left( 4 );
aPad->SetPadName( msg ); aPad->SetPadName( msg );
......
...@@ -299,9 +299,10 @@ this file again." ) ); ...@@ -299,9 +299,10 @@ this file again." ) );
} }
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{wxMessageBox("catch"); {
wxString msg = wxString::Format( _( "Error loading board.\n%s" ), wxString msg = wxString::Format( _( "Error loading board.\n%s" ),
ioe.errorText.GetData() ); ioe.errorText.GetData() );
wxMessageBox( msg, _( "Open Board File" ), wxOK | wxICON_ERROR ); wxMessageBox( msg, _( "Open Board File" ), wxOK | wxICON_ERROR );
} }
......
...@@ -367,7 +367,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, ...@@ -367,7 +367,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
if( footprint_names_list.GetCount() ) if( footprint_names_list.GetCount() )
{ {
msg.Printf( _( "Modules [%d items]" ), footprint_names_list.GetCount() ); msg.Printf( _( "Modules [%d items]" ), (int) footprint_names_list.GetCount() );
EDA_LIST_DIALOG dlg( aWindow, msg, footprint_names_list, OldName, EDA_LIST_DIALOG dlg( aWindow, msg, footprint_names_list, OldName,
DisplayCmpDoc, GetComponentDialogPosition() ); DisplayCmpDoc, GetComponentDialogPosition() );
......
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