From 6281f981fab13d7d228762231aaaff694d20aa8d Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 18 Jan 2012 09:02:50 -0600 Subject: [PATCH] towards making KICAD_GOST a runtime option, hoping for unified paper size --- common/class_page_info.cpp | 29 ++++++++++++++++++++++------- include/common.h | 14 ++++---------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/common/class_page_info.cpp b/common/class_page_info.cpp index 917eb954af..14607d9f3b 100644 --- a/common/class_page_info.cpp +++ b/common/class_page_info.cpp @@ -29,11 +29,14 @@ const wxString PAGE_INFO::Custom( wxT( "User" ) ); // Standard page sizes in mils, all constants + +// A4 see: https://lists.launchpad.net/kicad-developers/msg07389.html #if defined(KICAD_GOST) -const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8268, 11700 ), wxT( "A4" ) ); +const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8268, 11693 ), wxT( "A4" ) ); #else -const PAGE_INFO PAGE_INFO::pageA4( wxSize( 11700, 8268 ), wxT( "A4" ) ); +const PAGE_INFO PAGE_INFO::pageA4( wxSize( 11693, 8268 ), wxT( "A4" ) ); #endif + const PAGE_INFO PAGE_INFO::pageA3( wxSize( 16535, 11700 ), wxT( "A3" ) ); const PAGE_INFO PAGE_INFO::pageA2( wxSize( 23400, 16535 ), wxT( "A2" ) ); const PAGE_INFO PAGE_INFO::pageA1( wxSize( 33070, 23400 ), wxT( "A1" ) ); @@ -93,17 +96,29 @@ inline void PAGE_INFO::updatePortrait() } + PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) : m_type( aType ), m_size( aSizeMils ) { + #if defined(KICAD_GOST) - m_left_margin = GOST_LEFTMARGIN; - m_right_margin = GOST_RIGHTMARGIN; - m_top_margin = GOST_TOPMARGIN; - m_bottom_margin = GOST_BOTTOMMARGIN; +/* +#define GOST_LEFTMARGIN 800 // 20mm +#define GOST_RIGHTMARGIN 200 // 5mm +#define GOST_TOPMARGIN 200 // 5mm +#define GOST_BOTTOMMARGIN 200 // 5mm +*/ + + m_left_margin = 800; // 20mm + m_right_margin = 200; // 5mm + m_top_margin = 200; // 5mm + m_bottom_margin = 200; // 5mm #else - m_left_margin = m_right_margin = m_top_margin = m_bottom_margin = 400; + m_left_margin = + m_right_margin = + m_top_margin = + m_bottom_margin = 400; #endif updatePortrait(); diff --git a/include/common.h b/include/common.h index 1094808035..983ab2f22f 100644 --- a/include/common.h +++ b/include/common.h @@ -112,13 +112,7 @@ enum EDA_UNITS_T { UNSCALED_UNITS = 2 }; -#if defined(KICAD_GOST) -#define GOST_LEFTMARGIN 800 // 20mm -#define GOST_RIGHTMARGIN 200 // 5mm -#define GOST_TOPMARGIN 200 // 5mm -#define GOST_BOTTOMMARGIN 200 // 5mm -#endif // forward declarations: class LibNameList; @@ -189,11 +183,11 @@ public: // and either deci-mils or nanometers in PCBNew. #if defined(PCBNEW) # if defined(KICAD_NANOMETRE) - int GetWidthIU() const { return int( 2.54e4 * GetWidthMils() ); } - int GetHeightIU() const { return int( 2.54e4 * GetHeightMils() ); } + int GetWidthIU() const { return 25400 * GetWidthMils(); } + int GetHeightIU() const { return 25400 * GetHeightMils(); } # else - int GetWidthIU() const { return int( 10 * GetWidthMils() ); } - int GetHeightIU() const { return int( 10 * GetHeightMils() ); } + int GetWidthIU() const { return 10 * GetWidthMils(); } + int GetHeightIU() const { return 10 * GetHeightMils(); } # endif const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); } #elif defined(EESCHEMA)