Loading common/class_page_info.cpp +18 −3 Original line number Original line Diff line number Diff line Loading @@ -85,10 +85,17 @@ wxArrayString PAGE_INFO::GetStandardSizes() } } */ */ inline void PAGE_INFO::updatePortrait() { // update m_portrait based on orientation of m_size.x and m_size.y m_portrait = ( m_size.y > m_size.x ); } PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) : PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) : m_type( aType ), m_type( aType ), m_size( aSizeMils ), m_size( aSizeMils ) m_portrait( false ) { { #if defined(KICAD_GOST) #if defined(KICAD_GOST) m_left_margin = GOST_LEFTMARGIN; m_left_margin = GOST_LEFTMARGIN; Loading @@ -98,6 +105,8 @@ PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) : #else #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 #endif updatePortrait(); } } Loading @@ -106,6 +115,7 @@ PAGE_INFO::PAGE_INFO( const wxString& aType ) SetType( aType ); SetType( aType ); } } bool PAGE_INFO::SetType( const wxString& aType ) bool PAGE_INFO::SetType( const wxString& aType ) { { bool rc = true; bool rc = true; Loading Loading @@ -147,6 +157,8 @@ bool PAGE_INFO::SetType( const wxString& aType ) // customize: // customize: m_size.x = s_user_width; m_size.x = s_user_width; m_size.y = s_user_height; m_size.y = s_user_height; updatePortrait(); } } else else rc = false; rc = false; Loading @@ -170,7 +182,7 @@ void PAGE_INFO::SetPortrait( bool isPortrait ) m_portrait = isPortrait; m_portrait = isPortrait; // margins are not touched. // margins are not touched, do that if you want } } } } Loading Loading @@ -210,10 +222,13 @@ void PAGE_INFO::SetUserHeightMils( int aHeightInMils ) void PAGE_INFO::SetWidthMils( int aWidthInMils ) void PAGE_INFO::SetWidthMils( int aWidthInMils ) { { m_size.x = clampWidth( aWidthInMils ); m_size.x = clampWidth( aWidthInMils ); updatePortrait(); } } void PAGE_INFO::SetHeightMils( int aHeightInMils ) void PAGE_INFO::SetHeightMils( int aHeightInMils ) { { m_size.y = clampHeight( aHeightInMils ); m_size.y = clampHeight( aHeightInMils ); updatePortrait(); } } common/dialogs/dialog_page_settings.cpp +7 −6 Original line number Original line Diff line number Diff line Loading @@ -79,10 +79,9 @@ void DIALOG_PAGES_SETTINGS::initDialog() setCurrentPageSizeSelection( pageInfo.GetType() ); setCurrentPageSizeSelection( pageInfo.GetType() ); // only a click fires the selection changed event, so have to fabricate this check // only a click fires the "selection changed" event, so have to fabricate this check wxCommandEvent junk; wxCommandEvent dummy; onPaperSizeChoice( dummy ); onPaperSizeChoice( junk ); switch( g_UserUnit ) switch( g_UserUnit ) { { Loading Loading @@ -247,13 +246,15 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) } } else else { { pageInfo.SetPortrait( m_orientationComboBox->GetSelection() ); // here we assume translators will keep original paper size spellings // here we assume translators will keep original paper size spellings if( !pageInfo.SetType( paperType ) ) if( !pageInfo.SetType( paperType ) ) { { wxASSERT_MSG( FALSE, wxT( "the translation for paper size must preserve original spellings" ) ); wxASSERT_MSG( FALSE, wxT( "the translation for paper size must preserve original spellings" ) ); } } // set portrait _after_ setting size/type above int choice = m_orientationComboBox->GetSelection(); pageInfo.SetPortrait( choice ); } } m_Parent->SetPageSettings( pageInfo ); m_Parent->SetPageSettings( pageInfo ); Loading include/common.h +6 −3 Original line number Original line Diff line number Diff line Loading @@ -148,9 +148,10 @@ public: * commonly associated with that type name. * commonly associated with that type name. * * * @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", "USLetter", "USLegal", * then the width and height are custom, and will be set according to previous calls * "USLedger", or "User". If "User" then the width and height are custom, * to static PAGE_INFO::SetUserWidthMils() and * and will be set according to <b>previous</b> calls to * static PAGE_INFO::SetUserWidthMils() and * static PAGE_INFO::SetUserHeightMils(); * static PAGE_INFO::SetUserHeightMils(); * * * @return bool - true iff @a aStandarePageDescription was a recognized type. * @return bool - true iff @a aStandarePageDescription was a recognized type. Loading Loading @@ -268,6 +269,8 @@ private: static int s_user_height; static int s_user_height; static int s_user_width; static int s_user_width; void updatePortrait(); }; }; Loading Loading
common/class_page_info.cpp +18 −3 Original line number Original line Diff line number Diff line Loading @@ -85,10 +85,17 @@ wxArrayString PAGE_INFO::GetStandardSizes() } } */ */ inline void PAGE_INFO::updatePortrait() { // update m_portrait based on orientation of m_size.x and m_size.y m_portrait = ( m_size.y > m_size.x ); } PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) : PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) : m_type( aType ), m_type( aType ), m_size( aSizeMils ), m_size( aSizeMils ) m_portrait( false ) { { #if defined(KICAD_GOST) #if defined(KICAD_GOST) m_left_margin = GOST_LEFTMARGIN; m_left_margin = GOST_LEFTMARGIN; Loading @@ -98,6 +105,8 @@ PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) : #else #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 #endif updatePortrait(); } } Loading @@ -106,6 +115,7 @@ PAGE_INFO::PAGE_INFO( const wxString& aType ) SetType( aType ); SetType( aType ); } } bool PAGE_INFO::SetType( const wxString& aType ) bool PAGE_INFO::SetType( const wxString& aType ) { { bool rc = true; bool rc = true; Loading Loading @@ -147,6 +157,8 @@ bool PAGE_INFO::SetType( const wxString& aType ) // customize: // customize: m_size.x = s_user_width; m_size.x = s_user_width; m_size.y = s_user_height; m_size.y = s_user_height; updatePortrait(); } } else else rc = false; rc = false; Loading @@ -170,7 +182,7 @@ void PAGE_INFO::SetPortrait( bool isPortrait ) m_portrait = isPortrait; m_portrait = isPortrait; // margins are not touched. // margins are not touched, do that if you want } } } } Loading Loading @@ -210,10 +222,13 @@ void PAGE_INFO::SetUserHeightMils( int aHeightInMils ) void PAGE_INFO::SetWidthMils( int aWidthInMils ) void PAGE_INFO::SetWidthMils( int aWidthInMils ) { { m_size.x = clampWidth( aWidthInMils ); m_size.x = clampWidth( aWidthInMils ); updatePortrait(); } } void PAGE_INFO::SetHeightMils( int aHeightInMils ) void PAGE_INFO::SetHeightMils( int aHeightInMils ) { { m_size.y = clampHeight( aHeightInMils ); m_size.y = clampHeight( aHeightInMils ); updatePortrait(); } }
common/dialogs/dialog_page_settings.cpp +7 −6 Original line number Original line Diff line number Diff line Loading @@ -79,10 +79,9 @@ void DIALOG_PAGES_SETTINGS::initDialog() setCurrentPageSizeSelection( pageInfo.GetType() ); setCurrentPageSizeSelection( pageInfo.GetType() ); // only a click fires the selection changed event, so have to fabricate this check // only a click fires the "selection changed" event, so have to fabricate this check wxCommandEvent junk; wxCommandEvent dummy; onPaperSizeChoice( dummy ); onPaperSizeChoice( junk ); switch( g_UserUnit ) switch( g_UserUnit ) { { Loading Loading @@ -247,13 +246,15 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) } } else else { { pageInfo.SetPortrait( m_orientationComboBox->GetSelection() ); // here we assume translators will keep original paper size spellings // here we assume translators will keep original paper size spellings if( !pageInfo.SetType( paperType ) ) if( !pageInfo.SetType( paperType ) ) { { wxASSERT_MSG( FALSE, wxT( "the translation for paper size must preserve original spellings" ) ); wxASSERT_MSG( FALSE, wxT( "the translation for paper size must preserve original spellings" ) ); } } // set portrait _after_ setting size/type above int choice = m_orientationComboBox->GetSelection(); pageInfo.SetPortrait( choice ); } } m_Parent->SetPageSettings( pageInfo ); m_Parent->SetPageSettings( pageInfo ); Loading
include/common.h +6 −3 Original line number Original line Diff line number Diff line Loading @@ -148,9 +148,10 @@ public: * commonly associated with that type name. * commonly associated with that type name. * * * @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", "USLetter", "USLegal", * then the width and height are custom, and will be set according to previous calls * "USLedger", or "User". If "User" then the width and height are custom, * to static PAGE_INFO::SetUserWidthMils() and * and will be set according to <b>previous</b> calls to * static PAGE_INFO::SetUserWidthMils() and * static PAGE_INFO::SetUserHeightMils(); * static PAGE_INFO::SetUserHeightMils(); * * * @return bool - true iff @a aStandarePageDescription was a recognized type. * @return bool - true iff @a aStandarePageDescription was a recognized type. Loading Loading @@ -268,6 +269,8 @@ private: static int s_user_height; static int s_user_height; static int s_user_width; static int s_user_width; void updatePortrait(); }; }; Loading