From dc9ebf30e54b4abda9d6aea5377226c1e764f920 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 14 Jun 2015 19:58:57 +0200 Subject: [PATCH] A few minor fixes. Eeschema: add a workaround (not afix) to solve issue Bug #1464773 (Print bug with differently sized subsheets). --- common/common.cpp | 11 ---- common/dialogs/dialog_page_settings.cpp | 34 ++++++---- common/dialogs/dialog_page_settings.h | 5 +- common/dialogs/dialog_page_settings_base.cpp | 62 +++++++++---------- common/dialogs/dialog_page_settings_base.fbp | 48 +++++++------- common/dialogs/dialog_page_settings_base.h | 29 ++------- .../dialogs/dialog_print_using_printer.cpp | 53 ++++++++++------ .../dialog_print_using_printer_base.cpp | 4 +- .../dialog_print_using_printer_base.fbp | 6 +- .../dialogs/dialog_print_using_printer_base.h | 5 +- eeschema/onrightclick.cpp | 3 +- include/common.h | 8 --- pcbnew/xchgmod.cpp | 6 +- 13 files changed, 128 insertions(+), 146 deletions(-) diff --git a/common/common.cpp b/common/common.cpp index 3de52b990f..3ba5ab4cef 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -295,17 +295,6 @@ double RoundTo0( double x, double precision ) return (double) ix / precision; } -wxString FormatDateLong( const wxDateTime &aDate ) -{ - // GetInfo was introduced only on wx 2.9; for portability reason an - // hardcoded format is used on wx 2.8 -#if wxCHECK_VERSION( 2, 9, 0 ) - return aDate.Format( wxLocale::GetInfo( wxLOCALE_LONG_DATE_FMT ) ); -#else - return aDate.Format( wxT("%d %b %Y") ); -#endif -} - wxConfigBase* GetNewConfig( const wxString& aProgName ) { diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 055ed9ae11..2665b6cc6b 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 1992-2013 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -78,10 +78,12 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event ) { DIALOG_PAGES_SETTINGS dlg( this ); dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName ); - int diag = dlg.ShowModal(); - if( m_canvas && diag ) - m_canvas->Refresh(); + if( dlg.ShowModal() == wxID_OK ) + { + if( m_canvas ) + m_canvas->Refresh(); + } } @@ -201,6 +203,8 @@ void DIALOG_PAGES_SETTINGS::initDialog() m_TextComment4->SetValue( m_tb.GetComment4() ); #ifndef EESCHEMA + // these options have meaning only for Eeschema. + // disable them for other apps m_RevisionExport->Show( false ); m_DateExport->Show( false ); m_TitleExport->Show( false ); @@ -215,7 +219,7 @@ void DIALOG_PAGES_SETTINGS::initDialog() UpdatePageLayoutExample(); // Make the OK button the default. - m_sdbSizer1OK->SetDefault(); + m_sdbSizerOK->SetDefault(); m_initialized = true; } @@ -229,15 +233,9 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event ) if( LocalPrjConfigChanged() ) m_parent->SaveProjectSettings( true ); - - EndModal( true ); } -} - -void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event ) -{ - EndModal( false ); + event.Skip(); } @@ -397,9 +395,19 @@ void DIALOG_PAGES_SETTINGS::OnComment4TextUpdated( wxCommandEvent& event ) } } + void DIALOG_PAGES_SETTINGS::OnDateApplyClick( wxCommandEvent& event ) { - m_TextDate->SetValue( FormatDateLong( m_PickDate->GetValue() ) ); + wxDateTime datetime = m_PickDate->GetValue(); + wxString date = + // We can choose different formats. Only one must be uncommented + // + // datetime.Format( wxLocale::GetInfo( wxLOCALE_SHORT_DATE_FMT ) ); + // datetime.Format( wxLocale::GetInfo( wxLOCALE_LONG_DATE_FMT ) ); + // datetime.Format( wxT("%Y-%b-%d") ); + datetime.FormatISODate(); + + m_TextDate->SetValue( date ); } diff --git a/common/dialogs/dialog_page_settings.h b/common/dialogs/dialog_page_settings.h index 5bd62ba250..5127886f29 100644 --- a/common/dialogs/dialog_page_settings.h +++ b/common/dialogs/dialog_page_settings.h @@ -72,12 +72,9 @@ public: private: void initDialog(); // Initialisation of member variables - // event handler for wxID_OK + // event handler for button OK void OnOkClick( wxCommandEvent& event ); - // event handler for wxID_CANCEL - void OnCancelClick( wxCommandEvent& event ); - // event handlers for page size choice void OnPaperSizeChoice( wxCommandEvent& event ); void OnUserPageSizeXTextUpdated( wxCommandEvent& event ); diff --git a/common/dialogs/dialog_page_settings_base.cpp b/common/dialogs/dialog_page_settings_base.cpp index d38544a21e..5d0a483457 100644 --- a/common/dialogs/dialog_page_settings_base.cpp +++ b/common/dialogs/dialog_page_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -45,7 +45,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxString m_orientationComboBoxChoices[] = { _("Landscape"), _("Portrait") }; int m_orientationComboBoxNChoices = sizeof( m_orientationComboBoxChoices ) / sizeof( wxString ); - m_orientationComboBox = new wxChoice( this, ID_CHOICE_PAGE_ORIENTATION, wxDefaultPosition, wxDefaultSize, m_orientationComboBoxNChoices, m_orientationComboBoxChoices, 0 ); + m_orientationComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_orientationComboBoxNChoices, m_orientationComboBoxChoices, 0 ); m_orientationComboBox->SetSelection( 0 ); bleftSizer->Add( m_orientationComboBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -63,7 +63,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind m_staticTextHeight->Wrap( -1 ); bSizercustHeight->Add( m_staticTextHeight, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_TextUserSizeY = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_Y, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); + m_TextUserSizeY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); m_TextUserSizeY->SetMaxLength( 6 ); m_TextUserSizeY->SetToolTip( _("Custom paper height.") ); @@ -79,7 +79,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind m_staticTextWidth->Wrap( -1 ); bSizercustWidth->Add( m_staticTextWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_TextUserSizeX = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_X, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); + m_TextUserSizeX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); m_TextUserSizeX->SetMaxLength( 6 ); m_TextUserSizeX->SetToolTip( _("Custom paper width.") ); @@ -144,19 +144,19 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizerissuedate; bSizerissuedate = new wxBoxSizer( wxHORIZONTAL ); - m_TextDate = new wxTextCtrl( this, ID_TEXTCTRL_DATE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextDate = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextDate->SetMaxLength( 0 ); m_TextDate->SetMinSize( wxSize( 100,-1 ) ); bSizerissuedate->Add( m_TextDate, 3, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_ApplyDate = new wxButton( this, ID_BTN_APPLY_DATE, _("<-"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + m_ApplyDate = new wxButton( this, wxID_ANY, _("<<<"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); bSizerissuedate->Add( m_ApplyDate, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_PickDate = new wxDatePickerCtrl( this, ID_PICKER_DATE, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT ); + m_PickDate = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT ); bSizerissuedate->Add( m_PickDate, 2, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_DateExport = new wxCheckBox( this, ID_CHECKBOX_DATE, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DateExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerissuedate->Add( m_DateExport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -175,13 +175,13 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizer9; bSizer9 = new wxBoxSizer( wxHORIZONTAL ); - m_TextRevision = new wxTextCtrl( this, ID_TEXTCTRL_REVISION, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextRevision = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextRevision->SetMaxLength( 0 ); m_TextRevision->SetMinSize( wxSize( 100,-1 ) ); bSizer9->Add( m_TextRevision, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_RevisionExport = new wxCheckBox( this, ID_CHECKBOX_REVISION, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_RevisionExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer9->Add( m_RevisionExport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -200,7 +200,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizer12; bSizer12 = new wxBoxSizer( wxHORIZONTAL ); - m_TextTitle = new wxTextCtrl( this, ID_TEXTCTRL_TITLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextTitle = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextTitle->SetMaxLength( 0 ); m_TextTitle->SetMinSize( wxSize( 360,-1 ) ); @@ -225,13 +225,13 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizer14; bSizer14 = new wxBoxSizer( wxHORIZONTAL ); - m_TextCompany = new wxTextCtrl( this, ID_TEXTCTRL_COMPANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextCompany = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextCompany->SetMaxLength( 0 ); m_TextCompany->SetMinSize( wxSize( 360,-1 ) ); bSizer14->Add( m_TextCompany, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_CompanyExport = new wxCheckBox( this, ID_CHECKBOX_COMPANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_CompanyExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer14->Add( m_CompanyExport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -250,13 +250,13 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizercmt1; bSizercmt1 = new wxBoxSizer( wxHORIZONTAL ); - m_TextComment1 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextComment1->SetMaxLength( 0 ); m_TextComment1->SetMinSize( wxSize( 360,-1 ) ); bSizercmt1->Add( m_TextComment1, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_Comment1Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT1, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Comment1Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); bSizercmt1->Add( m_Comment1Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -275,13 +275,13 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizercmt2; bSizercmt2 = new wxBoxSizer( wxHORIZONTAL ); - m_TextComment2 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextComment2->SetMaxLength( 0 ); m_TextComment2->SetMinSize( wxSize( 360,-1 ) ); bSizercmt2->Add( m_TextComment2, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_Comment2Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT2, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Comment2Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); bSizercmt2->Add( m_Comment2Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -300,13 +300,13 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizercmt3; bSizercmt3 = new wxBoxSizer( wxHORIZONTAL ); - m_TextComment3 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment3 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextComment3->SetMaxLength( 0 ); m_TextComment3->SetMinSize( wxSize( 360,-1 ) ); bSizercmt3->Add( m_TextComment3, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_Comment3Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT3, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Comment3Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); bSizercmt3->Add( m_Comment3Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -325,13 +325,13 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizercmt4; bSizercmt4 = new wxBoxSizer( wxHORIZONTAL ); - m_TextComment4 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment4 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextComment4->SetMaxLength( 0 ); m_TextComment4->SetMinSize( wxSize( 360,-1 ) ); bSizercmt4->Add( m_TextComment4, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - m_Comment4Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT4, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Comment4Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); bSizercmt4->Add( m_Comment4Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -368,14 +368,14 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind bMainSizer->Add( bUpperSizerH, 1, wxEXPAND, 5 ); - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( this, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); - m_sdbSizer1->Realize(); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); - bMainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxALL, 5 ); + bMainSizer->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); this->SetSizer( bMainSizer ); @@ -397,8 +397,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind m_TextComment3->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment3TextUpdated ), NULL, this ); m_TextComment4->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment4TextUpdated ), NULL, this ); m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this ); - m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCancelClick ), NULL, this ); - m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); } DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE() @@ -419,7 +418,6 @@ DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE() m_TextComment3->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment3TextUpdated ), NULL, this ); m_TextComment4->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment4TextUpdated ), NULL, this ); m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this ); - m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCancelClick ), NULL, this ); - m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); } diff --git a/common/dialogs/dialog_page_settings_base.fbp b/common/dialogs/dialog_page_settings_base.fbp index 220b6d3fef..e09292e291 100644 --- a/common/dialogs/dialog_page_settings_base.fbp +++ b/common/dialogs/dialog_page_settings_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -561,7 +561,7 @@ 0 0 - ID_CHOICE_PAGE_ORIENTATION + wxID_ANY 0 @@ -832,7 +832,7 @@ 0 0 - ID_TEXTCTRL_USER_PAGE_SIZE_Y + wxID_ANY 0 @@ -1017,7 +1017,7 @@ 0 0 - ID_TEXTCTRL_USER_PAGE_SIZE_X + wxID_ANY 0 @@ -1820,7 +1820,7 @@ 0 0 - ID_TEXTCTRL_DATE + wxID_ANY 0 @@ -1912,8 +1912,8 @@ 0 0 - ID_BTN_APPLY_DATE - <- + wxID_ANY + <<< 0 @@ -1999,7 +1999,7 @@ 0 0 - ID_PICKER_DATE + wxID_ANY 0 @@ -2086,7 +2086,7 @@ 0 0 - ID_CHECKBOX_DATE + wxID_ANY Export to other sheets 0 @@ -2278,7 +2278,7 @@ 0 0 - ID_TEXTCTRL_REVISION + wxID_ANY 0 @@ -2370,7 +2370,7 @@ 0 0 - ID_CHECKBOX_REVISION + wxID_ANY Export to other sheets 0 @@ -2562,7 +2562,7 @@ 0 0 - ID_TEXTCTRL_TITLE + wxID_ANY 0 @@ -2846,7 +2846,7 @@ 0 0 - ID_TEXTCTRL_COMPANY + wxID_ANY 0 @@ -2938,7 +2938,7 @@ 0 0 - ID_CHECKBOX_COMPANY + wxID_ANY Export to other sheets 0 @@ -3130,7 +3130,7 @@ 0 0 - ID_TEXTCTRL_COMMENT1 + wxID_ANY 0 @@ -3222,7 +3222,7 @@ 0 0 - ID_CHECKBOX_COMMENT1 + wxID_ANY Export to other sheets 0 @@ -3414,7 +3414,7 @@ 0 0 - ID_TEXTCTRL_COMMENT2 + wxID_ANY 0 @@ -3506,7 +3506,7 @@ 0 0 - ID_CHECKBOX_COMMENT2 + wxID_ANY Export to other sheets 0 @@ -3698,7 +3698,7 @@ 0 0 - ID_TEXTCTRL_COMMENT3 + wxID_ANY 0 @@ -3790,7 +3790,7 @@ 0 0 - ID_CHECKBOX_COMMENT3 + wxID_ANY Export to other sheets 0 @@ -3982,7 +3982,7 @@ 0 0 - ID_TEXTCTRL_COMMENT4 + wxID_ANY 0 @@ -4074,7 +4074,7 @@ 0 0 - ID_CHECKBOX_COMMENT4 + wxID_ANY Export to other sheets 0 @@ -4436,10 +4436,10 @@ 0 0 - m_sdbSizer1 + m_sdbSizer protected - OnCancelClick + diff --git a/common/dialogs/dialog_page_settings_base.h b/common/dialogs/dialog_page_settings_base.h index 2fba886d27..eda79e286b 100644 --- a/common/dialogs/dialog_page_settings_base.h +++ b/common/dialogs/dialog_page_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -37,26 +37,6 @@ class DIALOG_SHIM; /////////////////////////////////////////////////////////////////////////// -#define ID_CHOICE_PAGE_ORIENTATION 1000 -#define ID_TEXTCTRL_USER_PAGE_SIZE_Y 1001 -#define ID_TEXTCTRL_USER_PAGE_SIZE_X 1002 -#define ID_TEXTCTRL_DATE 1003 -#define ID_BTN_APPLY_DATE 1004 -#define ID_PICKER_DATE 1005 -#define ID_CHECKBOX_DATE 1006 -#define ID_TEXTCTRL_REVISION 1007 -#define ID_CHECKBOX_REVISION 1008 -#define ID_TEXTCTRL_TITLE 1009 -#define ID_TEXTCTRL_COMPANY 1010 -#define ID_CHECKBOX_COMPANY 1011 -#define ID_TEXTCTRL_COMMENT1 1012 -#define ID_CHECKBOX_COMMENT1 1013 -#define ID_TEXTCTRL_COMMENT2 1014 -#define ID_CHECKBOX_COMMENT2 1015 -#define ID_TEXTCTRL_COMMENT3 1016 -#define ID_CHECKBOX_COMMENT3 1017 -#define ID_TEXTCTRL_COMMENT4 1018 -#define ID_CHECKBOX_COMMENT4 1019 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_PAGES_SETTINGS_BASE @@ -113,9 +93,9 @@ class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM wxStaticText* m_staticTextfilename; wxTextCtrl* m_textCtrlFilePicker; wxButton* m_buttonBrowse; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; // Virtual event handlers, overide them in your derived class virtual void OnPaperSizeChoice( wxCommandEvent& event ) { event.Skip(); } @@ -133,7 +113,6 @@ class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM virtual void OnComment3TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment4TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnWksFileSelection( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index f0ba62236f..6fbb0ac3f2 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -52,16 +52,19 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE public: DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ); - SCH_EDIT_FRAME* GetParent() const; + SCH_EDIT_FRAME* GetParent() const + { + return ( SCH_EDIT_FRAME* ) wxWindow::GetParent(); + } private: void OnCloseWindow( wxCloseEvent& event ); - void OnInitDialog( wxInitDialogEvent& event ); void OnPageSetup( wxCommandEvent& event ); void OnPrintPreview( wxCommandEvent& event ); void OnPrintButtonClick( wxCommandEvent& event ); void OnButtonCancelClick( wxCommandEvent& event ) { Close(); } + void initDialog(); void GetPrintOptions(); }; @@ -73,7 +76,7 @@ private: class SCH_PRINTOUT : public wxPrintout { private: - DIALOG_PRINT_USING_PRINTER* m_Parent; + DIALOG_PRINT_USING_PRINTER* m_parent; public: SCH_PRINTOUT( DIALOG_PRINT_USING_PRINTER* aParent, const wxString& aTitle ) : @@ -81,9 +84,9 @@ public: { wxASSERT( aParent != NULL ); - m_Parent = aParent; + m_parent = aParent; } - SCH_EDIT_FRAME* GetSchFrameParent() { return m_Parent->GetParent(); } + SCH_EDIT_FRAME* GetSchFrameParent() { return m_parent->GetParent(); } bool OnPrintPage( int page ); bool HasPage( int page ); bool OnBeginDocument( int startPage, int endPage ); @@ -160,6 +163,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent m_checkReference->SetValue( aParent->GetPrintSheetReference() ); m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() ); + initDialog(); #ifdef __WXMAC__ // Problems with modal on wx-2.9 - Anyway preview is standard for OSX @@ -170,13 +174,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent } -SCH_EDIT_FRAME* DIALOG_PRINT_USING_PRINTER::GetParent() const -{ - return ( SCH_EDIT_FRAME* ) wxWindow::GetParent(); -} - - -void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) +void DIALOG_PRINT_USING_PRINTER::initDialog() { SCH_EDIT_FRAME* parent = GetParent(); @@ -321,7 +319,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) bool SCH_PRINTOUT::OnPrintPage( int page ) { wxString msg; - SCH_EDIT_FRAME* parent = m_Parent->GetParent(); + SCH_EDIT_FRAME* parent = m_parent->GetParent(); msg.Printf( _( "Print page %d" ), page ); parent->ClearMsgPanel(); parent->AppendMsgPanel( msg, wxEmptyString, CYAN ); @@ -381,7 +379,7 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage ) return false; #ifdef __WXDEBUG__ - SCH_EDIT_FRAME* parent = m_Parent->GetParent(); + SCH_EDIT_FRAME* parent = m_parent->GetParent(); wxLogDebug( wxT( "Printer name: " ) + parent->GetPageSetupData().GetPrintData().GetPrinterName() ); wxLogDebug( wxT( "Paper ID: %d" ), @@ -411,7 +409,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) EDA_RECT oldClipBox; wxRect fitRect; wxDC* dc = GetDC(); - SCH_EDIT_FRAME* parent = m_Parent->GetParent(); + SCH_EDIT_FRAME* parent = m_parent->GetParent(); EDA_DRAW_PANEL* panel = parent->GetCanvas(); wxBusyCursor dummy; @@ -435,12 +433,31 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) FitThisSizeToPaper( pageSizeIU ); fitRect = GetLogicalPaperRect(); - wxLogDebug( wxT( "Fit rectangle: %d, %d, %d, %d" ), - fitRect.x, fitRect.y, fitRect.width, fitRect.height ); + wxLogDebug( wxT( "Fit rectangle: %d, %d, %d" ), + fitRect.x, fitRect.y, fitRect.width, fitRect.height ); + // When is the actual paper size does not match the schematic page + // size, the drawing is not perfectly centered on X or Y axis. + // Give a draw offset centers the schematic page on the paper draw area + // Because the sizes are fitted, only an Y or X offset is needed + // and both are 0 when sizes are identical. + // Y or Y offset is not null when the X/Y size ratio differs between + // the actual paper size and the schematic page int xoffset = ( fitRect.width - pageSizeIU.x ) / 2; - int yoffset = ( fitRect.height - pageSizeIU.y ) / 2; + // For an obscure reason, OffsetLogicalOrigin creates issues, + // under some circumstances, when yoffset is not always null + // and changes from a page to an other page + // This is only a workaround, not a fix + // see https://bugs.launchpad.net/kicad/+bug/1464773 + // xoffset does not create issues. +#if 0 // FIX ME + int yoffset = ( fitRect.height - pageSizeIU.y ) / 2; +#else + // the Y centering will be not perfect, but this is less annoying + // than a blank page or a buggy centering + int yoffset = 0; +#endif OffsetLogicalOrigin( xoffset, yoffset ); GRResetPenAndBrush( dc ); diff --git a/eeschema/dialogs/dialog_print_using_printer_base.cpp b/eeschema/dialogs/dialog_print_using_printer_base.cpp index 8b6c425d62..d57997b26f 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.cpp +++ b/eeschema/dialogs/dialog_print_using_printer_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 11 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -62,7 +62,6 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) ); - this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDialog ) ); m_buttonPageSetup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this ); m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this ); m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this ); @@ -73,7 +72,6 @@ DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) ); - this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDialog ) ); m_buttonPageSetup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this ); m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this ); m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this ); diff --git a/eeschema/dialogs/dialog_print_using_printer_base.fbp b/eeschema/dialogs/dialog_print_using_printer_base.fbp index 05f62f19a5..1a42437aa8 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.fbp +++ b/eeschema/dialogs/dialog_print_using_printer_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 1 0 @@ -65,7 +67,7 @@ - OnInitDialog + diff --git a/eeschema/dialogs/dialog_print_using_printer_base.h b/eeschema/dialogs/dialog_print_using_printer_base.h index a481d2b2b8..49994cf17e 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.h +++ b/eeschema/dialogs/dialog_print_using_printer_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 11 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,8 @@ #include #include #include +class DIALOG_SHIM; + #include "dialog_shim.h" #include #include @@ -43,7 +45,6 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } - virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnPageSetup( wxCommandEvent& event ) { event.Skip(); } virtual void OnPrintPreview( wxCommandEvent& event ) { event.Skip(); } virtual void OnPrintButtonClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 310910b4b6..047dfa7248 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -193,7 +193,8 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { if( m_CurrentSheet->Last() != g_RootSheet ) { - AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), + msg = AddHotkeyName( _( "Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET ); + AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, msg, KiBitmap( leave_sheet_xpm ) ); PopMenu->AppendSeparator(); } diff --git a/include/common.h b/include/common.h index 2abbc589bc..5082cdfed5 100644 --- a/include/common.h +++ b/include/common.h @@ -353,14 +353,6 @@ void wxStringSplit( const wxString& aText, wxArrayString& aStrings, wxChar aSpli */ unsigned GetRunningMicroSecs(); -/** - * Formats a wxDateTime using the long date format (on wx 2.9) or - * an hardcoded format in wx 2.8; the idea is to avoid like the plague - * the numeric-only date formats: it's difficult to discriminate between - * dd/mm/yyyy and mm/dd/yyyy. The output is meant for user consumption - * so no attempt to parse it should be done - */ -wxString FormatDateLong( const wxDateTime &aDate ); /** * Function SystemDirsAppend diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 9835d424fa..3ae43b86e2 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -177,7 +177,7 @@ void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event ) wxFileName fn; wxString msg; - // Build CMP file name by changing the extension of NetList filename + // Build the .cmp file name from the board name fn = m_parent->GetBoard()->GetFileName(); fn.SetExt( ComponentFileExtension ); @@ -528,7 +528,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) return; } - // Calculation file name by changing the extension name to NetList + // Build the .cmp file name from the board name fn = GetBoard()->GetFileName(); fn.SetExt( ComponentFileExtension ); wildcard = wxGetTranslation( ComponentFileWildcard ); @@ -561,7 +561,7 @@ bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ) if( cmpFile == NULL ) return false; - fprintf( cmpFile, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) ); + fprintf( cmpFile, "Cmp-Mod V01 Created by PcbNew date = %s\n", TO_UTF8( DateAndTime() ) ); MODULE* module = aBrd->m_Modules; for( ; module != NULL; module = module->Next() )