diff --git a/common/class_page_info.cpp b/common/class_page_info.cpp index f0b9042e02..c8d5bd83d1 100644 --- a/common/class_page_info.cpp +++ b/common/class_page_info.cpp @@ -1,6 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * + * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or @@ -29,22 +30,28 @@ const wxString PAGE_INFO::Custom( wxT( "User" ) ); // Standard page sizes in mils, all constants #if defined(KICAD_GOST) -const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8283, 11700 ), wxT( "A4" ) ); +const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8268, 11700 ), wxT( "A4" ) ); #else -const PAGE_INFO PAGE_INFO::pageA4( wxSize( 11700, 8267 ), wxT( "A4" ) ); +const PAGE_INFO PAGE_INFO::pageA4( wxSize( 11700, 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" ) ); -const PAGE_INFO PAGE_INFO::pageA0( wxSize( 46800, 33070 ), wxT( "A0" ) ); -const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ) ); -const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ) ); -const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ) ); -const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ) ); -const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ) ); -const PAGE_INFO PAGE_INFO::pageGERBER(wxSize( 32000, 32000 ), wxT( "GERBER" ) ); -const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), Custom ); +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" ) ); +const PAGE_INFO PAGE_INFO::pageA0( wxSize( 46800, 33070 ), wxT( "A0" ) ); +const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ) ); +const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ) ); +const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ) ); +const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ) ); +const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ) ); +const PAGE_INFO PAGE_INFO::pageGERBER( wxSize( 32000, 32000 ), wxT( "GERBER" ) ); +const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), Custom ); +// US paper sizes +const PAGE_INFO PAGE_INFO::pageUSLetter( wxSize( 11000, 8500 ), wxT( "USLetter" ) ); +const PAGE_INFO PAGE_INFO::pageUSLegal( wxSize( 14000, 8500 ), wxT( "USLegal" ) ); +const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedger" ) ); + +// Custom paper size for next instantiation of type "User" int PAGE_INFO::s_user_width = 17000; int PAGE_INFO::s_user_height = 11000; @@ -65,6 +72,9 @@ wxArrayString PAGE_INFO::GetStandardSizes() &pageD, &pageE, // &pageGERBER, // standard? + &pageUSLetter, + &pageUSLegal, + &pageUSLedger, &pageUser, }; @@ -122,6 +132,12 @@ bool PAGE_INFO::SetType( const wxString& aType ) *this = pageE; else if( aType == pageGERBER.GetType() ) *this = pageGERBER; + else if( aType == pageUSLetter.GetType() ) + *this = pageUSLetter; + else if( aType == pageUSLegal.GetType() ) + *this = pageUSLegal; + else if( aType == pageUSLedger.GetType() ) + *this = pageUSLedger; else if( aType == pageUser.GetType() ) { // pageUser is const, and may not and does not hold the custom size, @@ -201,4 +217,3 @@ void PAGE_INFO::SetHeightMils( int aHeightInMils ) { m_size.y = clampHeight( aHeightInMils ); } - diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index c306b8c8cb..9e02f7800d 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -75,12 +75,14 @@ void DIALOG_PAGES_SETTINGS::initDialog() const PAGE_INFO& pageInfo = m_Parent->GetPageSettings(); if( !pageInfo.IsCustom() ) - m_landscapeCheckbox->SetValue( !pageInfo.IsPortrait() ); + m_orientationComboBox->SetSelection( pageInfo.IsPortrait() ); setCurrentPageSizeSelection( pageInfo.GetType() ); - // only a click fires the radiobutton selected event, so have to fabricate this check - onRadioButtonSelected(); + // only a click fires the selection changed event, so have to fabricate this check + wxCommandEvent junk; + + onPaperSizeChoice( junk ); switch( g_UserUnit ) { @@ -175,25 +177,19 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event ) } -void DIALOG_PAGES_SETTINGS::onRadioButtonSelected() +void DIALOG_PAGES_SETTINGS::onPaperSizeChoice( wxCommandEvent& event ) { - if( PAGE_INFO::Custom == m_PageSizeBox->GetStringSelection() ) + if( m_paperSizeComboBox->GetStringSelection().Contains( PAGE_INFO::Custom ) ) { - m_landscapeCheckbox->Enable( false ); + m_orientationComboBox->Enable( false ); } else { - m_landscapeCheckbox->Enable( true ); + m_orientationComboBox->Enable( true ); } } -void DIALOG_PAGES_SETTINGS::onRadioButtonSelected( wxCommandEvent& event ) -{ - onRadioButtonSelected(); // no event arg -} - - void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) { wxString msg; @@ -238,19 +234,27 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) */ } - int radioSelection = m_PageSizeBox->GetSelection(); - if( radioSelection < 0 ) - radioSelection = 0; - // wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations - wxString paperType = m_PageSizeBox->GetString( radioSelection ); + wxString paperType = m_paperSizeComboBox->GetStringSelection(); // construct pageInfo _after_ user settings have been established in case the // paperType is custom, otherwise User width and height will not go into effect right away. - PAGE_INFO pageInfo( paperType ); + PAGE_INFO pageInfo; - if( PAGE_INFO::Custom != paperType ) - pageInfo.SetPortrait( !m_landscapeCheckbox->IsChecked() ); + if( paperType.Contains( PAGE_INFO::Custom ) ) + { + pageInfo.SetType( PAGE_INFO::Custom ); + } + else + { + pageInfo.SetPortrait( m_orientationComboBox->GetSelection() ); + + // here we assume translators will keep original paper size spellings + if( !pageInfo.SetType( paperType ) ) + { + wxASSERT_MSG( FALSE, wxT( "the translation for paper size must preserve original spellings" ) ); + } + } m_Parent->SetPageSettings( pageInfo ); @@ -305,19 +309,19 @@ void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection( const wxString& aPaperS // use wxFormBuilder to store the sheet type in the wxRadioButton's label // i.e. "A4", "A3", etc, anywhere within the text of the label. - D(printf("m_PageSizeBox->GetCount() = %d\n", (int) m_PageSizeBox->GetCount() );) + D(printf("m_paperSizeComboBox->GetCount() = %d\n", (int) m_paperSizeComboBox->GetCount() );) // search all the child wxRadioButtons for a label containing our paper type - for( unsigned i = 0; i < m_PageSizeBox->GetCount(); ++i ) + for( unsigned i = 0; i < m_paperSizeComboBox->GetCount(); ++i ) { // parse each label looking for aPaperSize within it - wxStringTokenizer st( m_PageSizeBox->GetString( i ) ); + wxStringTokenizer st( m_paperSizeComboBox->GetString( i ) ); while( st.HasMoreTokens() ) { if( st.GetNextToken() == aPaperSize ) { - m_PageSizeBox->SetSelection( i ); + m_paperSizeComboBox->SetSelection( i ); return; } } diff --git a/common/dialogs/dialog_page_settings.h b/common/dialogs/dialog_page_settings.h index d3d719d856..0a8563adf0 100644 --- a/common/dialogs/dialog_page_settings.h +++ b/common/dialogs/dialog_page_settings.h @@ -36,14 +36,11 @@ private: /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL void OnCancelClick( wxCommandEvent& event ); - /// wxEVT_COMMAND_RADIOBOX_SELECTED - void onRadioButtonSelected( wxCommandEvent& event ); - void setCurrentPageSizeSelection( const wxString& aPaperSize ); void SavePageSettings(wxCommandEvent& event); void ReturnSizeSelected(wxCommandEvent& event); - void onRadioButtonSelected(); + void onPaperSizeChoice( wxCommandEvent& event ); }; #endif // _DIALOG_PAGES_SETTINGS_H_ diff --git a/common/dialogs/dialog_page_settings_base.cpp b/common/dialogs/dialog_page_settings_base.cpp index 40aed71047..2540bde582 100644 --- a/common/dialogs/dialog_page_settings_base.cpp +++ b/common/dialogs/dialog_page_settings_base.cpp @@ -21,62 +21,62 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxFlexGridSizer* LeftColumnSizer; LeftColumnSizer = new wxFlexGridSizer( 6, 1, 0, 0 ); + LeftColumnSizer->AddGrowableRow( 0 ); LeftColumnSizer->AddGrowableRow( 1 ); - LeftColumnSizer->AddGrowableRow( 3 ); - LeftColumnSizer->AddGrowableRow( 4 ); - LeftColumnSizer->AddGrowableRow( 5 ); + LeftColumnSizer->AddGrowableRow( 2 ); LeftColumnSizer->SetFlexibleDirection( wxBOTH ); LeftColumnSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - wxString m_PageSizeBoxChoices[] = { _("A4"), _("A3"), _("A2"), _("A1"), _("A0"), _("A"), _("B"), _("C"), _("D"), _("E"), _("User") }; - int m_PageSizeBoxNChoices = sizeof( m_PageSizeBoxChoices ) / sizeof( wxString ); - m_PageSizeBox = new wxRadioBox( this, wxID_ANY, _("Page Size:"), wxDefaultPosition, wxDefaultSize, m_PageSizeBoxNChoices, m_PageSizeBoxChoices, 1, wxRA_SPECIFY_COLS ); - m_PageSizeBox->SetSelection( 9 ); - LeftColumnSizer->Add( m_PageSizeBox, 0, wxALL|wxEXPAND, 5 ); + wxStaticBoxSizer* sbSizer9; + sbSizer9 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Paper Size:") ), wxVERTICAL ); + wxString m_paperSizeComboBoxChoices[] = { _("A4"), _("A3"), _("A2"), _("A1"), _("A0"), _("A"), _("B"), _("C"), _("D"), _("E"), _("USLetter"), _("USLegal"), _("USLedger"), _("User (Custom)") }; + int m_paperSizeComboBoxNChoices = sizeof( m_paperSizeComboBoxChoices ) / sizeof( wxString ); + m_paperSizeComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_paperSizeComboBoxNChoices, m_paperSizeComboBoxChoices, 0 ); + m_paperSizeComboBox->SetSelection( 0 ); + sbSizer9->Add( m_paperSizeComboBox, 0, wxALL|wxEXPAND, 5 ); - LeftColumnSizer->Add( 5, 0, 1, wxEXPAND, 5 ); + LeftColumnSizer->Add( sbSizer9, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer8; sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Orientation:") ), wxVERTICAL ); - m_landscapeCheckbox = new wxCheckBox( this, wxID_ANY, _("Landscape"), wxDefaultPosition, wxDefaultSize, 0 ); - m_landscapeCheckbox->SetValue(true); - m_landscapeCheckbox->SetToolTip( _("Check for landscape, uncheck for portrait") ); + wxString m_orientationComboBoxChoices[] = { _("Landscape"), _("Portrait") }; + int m_orientationComboBoxNChoices = sizeof( m_orientationComboBoxChoices ) / sizeof( wxString ); + m_orientationComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_orientationComboBoxNChoices, m_orientationComboBoxChoices, 0 ); + m_orientationComboBox->SetSelection( 0 ); + sbSizer8->Add( m_orientationComboBox, 0, wxALL|wxEXPAND, 5 ); - sbSizer8->Add( m_landscapeCheckbox, 0, wxALL|wxEXPAND, 5 ); + LeftColumnSizer->Add( sbSizer8, 0, wxALL|wxEXPAND, 5 ); - LeftColumnSizer->Add( sbSizer8, 1, wxALL|wxEXPAND, 5 ); + wxStaticBoxSizer* sbSizer10; + sbSizer10 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Custom Page Size:") ), wxVERTICAL ); wxBoxSizer* bSizerXsize; bSizerXsize = new wxBoxSizer( wxVERTICAL ); - UserPageSizeX = new wxStaticText( this, wxID_ANY, _("User Page Size X: "), wxDefaultPosition, wxDefaultSize, 0 ); + UserPageSizeX = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); UserPageSizeX->Wrap( -1 ); bSizerXsize->Add( UserPageSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_TextUserSizeX = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_X, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerXsize->Add( m_TextUserSizeX, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerXsize->Add( m_TextUserSizeX, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL|wxEXPAND, 5 ); - LeftColumnSizer->Add( bSizerXsize, 1, wxEXPAND, 5 ); + sbSizer10->Add( bSizerXsize, 1, wxALIGN_TOP|wxALL|wxEXPAND, 5 ); wxBoxSizer* bSizerYsize; bSizerYsize = new wxBoxSizer( wxVERTICAL ); - UserPageSizeY = new wxStaticText( this, wxID_ANY, _("User Page Size Y: "), wxDefaultPosition, wxDefaultSize, 0 ); + UserPageSizeY = new wxStaticText( this, wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 ); UserPageSizeY->Wrap( -1 ); - bSizerYsize->Add( UserPageSizeY, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizerYsize->Add( UserPageSizeY, 0, wxALIGN_TOP|wxALL, 5 ); m_TextUserSizeY = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_Y, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerYsize->Add( m_TextUserSizeY, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerYsize->Add( m_TextUserSizeY, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 ); - LeftColumnSizer->Add( bSizerYsize, 1, wxEXPAND, 5 ); + sbSizer10->Add( bSizerYsize, 1, wxALIGN_TOP|wxALL|wxEXPAND, 5 ); - - LeftColumnSizer->Add( 5, 5, 1, wxEXPAND, 5 ); - - - LeftColumnSizer->Add( 5, 5, 1, wxEXPAND, 5 ); + LeftColumnSizer->Add( sbSizer10, 1, wxALL|wxEXPAND, 5 ); bUpperSizerH->Add( LeftColumnSizer, 0, wxEXPAND, 5 ); @@ -219,7 +219,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCloseWindow ) ); - m_PageSizeBox->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::onRadioButtonSelected ), NULL, this ); + m_paperSizeComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::onPaperSizeChoice ), NULL, this ); m_TextUserSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeXTextUpdated ), NULL, this ); m_TextUserSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeYTextUpdated ), NULL, this ); m_TitleExport->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this ); @@ -231,7 +231,7 @@ DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCloseWindow ) ); - m_PageSizeBox->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::onRadioButtonSelected ), NULL, this ); + m_paperSizeComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::onPaperSizeChoice ), NULL, this ); m_TextUserSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeXTextUpdated ), NULL, this ); m_TextUserSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeYTextUpdated ), NULL, this ); m_TitleExport->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this ); diff --git a/common/dialogs/dialog_page_settings_base.fbp b/common/dialogs/dialog_page_settings_base.fbp index 139b12b7b7..60fbdf0bf3 100644 --- a/common/dialogs/dialog_page_settings_base.fbp +++ b/common/dialogs/dialog_page_settings_base.fbp @@ -140,7 +140,7 @@ 1 wxBOTH - 1,3,4,5 + 0,1,2 0 LeftColumnSizer @@ -152,106 +152,107 @@ 5 wxALL|wxEXPAND 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "User" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxID_ANY - Page Size: - - 1 - - 0 - - - 0 + Paper Size: - 1 - m_PageSizeBox - 1 - - - protected - 1 - - - Resizable - - 9 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - onRadioButtonSelected - - - - - + sbSizer9 + wxVERTICAL + none - - - - 5 - wxEXPAND - 1 - - 0 - protected - 5 + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "USLetter" "USLegal" "USLedger" "User (Custom)" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_paperSizeComboBox + 1 + + + protected + 1 + + + Resizable + + 0 + 1 + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onPaperSizeChoice + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL|wxEXPAND - 1 + 0 wxID_ANY Orientation: @@ -264,7 +265,7 @@ 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -275,7 +276,7 @@ 1 0 - 1 + "Landscape" "Portrait" 1 1 @@ -290,7 +291,6 @@ 0 0 wxID_ANY - Landscape 0 @@ -299,7 +299,7 @@ 0 1 - m_landscapeCheckbox + m_orientationComboBox 1 @@ -309,12 +309,12 @@ Resizable + 0 1 - 0 - Check for landscape, uncheck for portrait + wxFILTER_NONE wxDefaultValidator @@ -323,7 +323,7 @@ - + @@ -352,402 +352,396 @@ 5 - wxEXPAND + wxALL|wxEXPAND 1 - + + wxID_ANY + Custom Page Size: - bSizerXsize + sbSizer10 wxVERTICAL none + 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - User Page Size X: - - - 0 - - - 0 + wxALIGN_TOP|wxALL|wxEXPAND + 1 + - 1 - UserPageSizeX - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizerXsize + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Width: + + + 0 + + + 0 + + 1 + UserPageSizeX + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_LEFT|wxALIGN_TOP|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_TEXTCTRL_USER_PAGE_SIZE_X + + + 0 + + 0 + + 0 + + 1 + m_TextUserSizeX + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnTextctrlUserPageSizeXTextUpdated + + + + + + 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_TEXTCTRL_USER_PAGE_SIZE_X - - - 0 - - 0 - - 0 + wxALIGN_TOP|wxALL|wxEXPAND + 1 + - 1 - m_TextUserSizeX - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnTextctrlUserPageSizeXTextUpdated - - - - + bSizerYsize + wxVERTICAL + none + + 5 + wxALIGN_TOP|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Height: + + + 0 + + + 0 + + 1 + UserPageSizeY + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_TOP|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_TEXTCTRL_USER_PAGE_SIZE_Y + + + 0 + + 0 + + 0 + + 1 + m_TextUserSizeY + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnTextctrlUserPageSizeYTextUpdated + + + + + + - - 5 - wxEXPAND - 1 - - - bSizerYsize - wxVERTICAL - none - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - User Page Size Y: - - - 0 - - - 0 - - 1 - UserPageSizeY - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_TEXTCTRL_USER_PAGE_SIZE_Y - - - 0 - - 0 - - 0 - - 1 - m_TextUserSizeY - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnTextctrlUserPageSizeYTextUpdated - - - - - - - - - - 5 - wxEXPAND - 1 - - 5 - protected - 5 - - - - 5 - wxEXPAND - 1 - - 5 - protected - 5 - - diff --git a/common/dialogs/dialog_page_settings_base.h b/common/dialogs/dialog_page_settings_base.h index 04628a84c8..610269c5f5 100644 --- a/common/dialogs/dialog_page_settings_base.h +++ b/common/dialogs/dialog_page_settings_base.h @@ -11,16 +11,16 @@ #include #include -#include +#include #include #include #include #include -#include #include #include #include #include +#include #include #include @@ -50,15 +50,12 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog private: protected: - wxRadioBox* m_PageSizeBox; - - wxCheckBox* m_landscapeCheckbox; + wxChoice* m_paperSizeComboBox; + wxChoice* m_orientationComboBox; wxStaticText* UserPageSizeX; wxTextCtrl* m_TextUserSizeX; wxStaticText* UserPageSizeY; wxTextCtrl* m_TextUserSizeY; - - wxStaticText* m_TextSheetCount; wxStaticText* m_TextSheetNumber; @@ -82,7 +79,7 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog // Virtual event handlers, overide them in your derived class virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } - virtual void onRadioButtonSelected( wxCommandEvent& event ) { event.Skip(); } + virtual void onPaperSizeChoice( wxCommandEvent& event ) { event.Skip(); } virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/include/common.h b/include/common.h index f412452c0d..a862eea6dc 100644 --- a/include/common.h +++ b/include/common.h @@ -247,6 +247,11 @@ private: static const PAGE_INFO pageD; static const PAGE_INFO pageE; static const PAGE_INFO pageGERBER; + + static const PAGE_INFO pageUSLetter; + static const PAGE_INFO pageUSLegal; + static const PAGE_INFO pageUSLedger; + static const PAGE_INFO pageUser; // all dimensions here are in mils diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 029d4f0cf5..0d61ba6500 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -478,8 +478,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF { wxString header = wxString::Format( wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by Pcbnew%s\n\n" ), - BOARD_FILE_VERSION, TO_UTF8( DateAndTime() ), - TO_UTF8( GetBuildVersion() ) ); + BOARD_FILE_VERSION, DateAndTime().GetData(), + GetBuildVersion().GetData() ); PROPERTIES props; diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 8779189dab..e90cbdb0d7 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -2654,8 +2654,9 @@ void KICAD_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* a if( m_props ) { + wxString header = (*m_props)["header"]; // save a file header, if caller provided one (with trailing \n hopefully). - fprintf( m_fp, "%s", TO_UTF8( (*m_props)["header"] ) ); + fprintf( m_fp, "%s", TO_UTF8( header ) ); } saveAllSections();