From 00d865c173e077ac8acd5be8b2cbde47b50fee37 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Fri, 18 Jan 2013 00:04:25 -0600 Subject: [PATCH] Enhance DIALOG_SHIM to optionally call SetFocus() after the derived class's constructor has been called, for wx 2.8 and wxGTK --- Documentation/guidelines/UIpolicies.txt | 5 +- common/dialog_shim.cpp | 58 +- common/dialogs/dialog_exit_base.cpp | 194 +-- common/dialogs/dialog_exit_base.fbp | 1558 +++++++++++------------ common/dialogs/dialog_exit_base.h | 125 +- common/dialogs/dialog_page_settings.cpp | 3 +- include/dialog_shim.h | 15 +- 7 files changed, 980 insertions(+), 978 deletions(-) diff --git a/Documentation/guidelines/UIpolicies.txt b/Documentation/guidelines/UIpolicies.txt index f0de9f7d3b..62332e3c04 100644 --- a/Documentation/guidelines/UIpolicies.txt +++ b/Documentation/guidelines/UIpolicies.txt @@ -18,13 +18,16 @@ Capitalization: Dialogs: Follow the recommendations here: + http://library.gnome.org/devel/hig-book/2.20/windows-dialog.html.en paying particular attention to "initial focus", "sensible default values", "default buttons", ESC key termination. Please note that the escape key termination only works properly if there is a dialog button defined with an ID of wxID_CANCEL or SetEscapeID( MY_ESCAPE_BUTTON_ID ) is called during dialog initialization. The former is the preferred method for handling - escape key dialog termination. + escape key dialog termination. There is a checkbox in wxformbuilder for + the "default" control, and this is the one fired when the "enter" key + is pressed. Use wxWidgets "sizers" in all dialogs, no matter how simple they are: http://zetcode.com/tutorials/wxwidgetstutorial/layoutmanagement diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index aec7c2dd18..47066e77c7 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -30,8 +30,9 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( aParent, id, title, pos, size, style, name ) { - // linux wxGTK needed this at one time to allow the ESCAPE key to close a wxDialog window. - SetFocus(); +#if DLGSHIM_USE_SETFOCUS + Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHIM::onInit ) ); +#endif } @@ -70,17 +71,54 @@ bool DIALOG_SHIM::Show( bool show ) return ret; } -/* -const wxSize& DIALOG_SHIM::GetLastSize() + +#if DLGSHIM_USE_SETFOCUS + +static bool findWindowRecursively( const wxWindowList& children, const wxWindow* wanted ) { - const char* classname = typeid(*this).name(); - return class_map[ classname ].GetSize(); + for( wxWindowList::const_iterator it = children.begin(); it != children.end(); ++it ) + { + const wxWindow* child = *it; + + if( wanted == child ) + return true; + else + { + if( findWindowRecursively( child->GetChildren(), wanted ) ) + return true; + } + } + + return false; } -const wxPoint& DIALOG_SHIM::GetLastPosition() +static bool findWindowRecursively( const wxWindow* topmost, const wxWindow* wanted ) { - const char* classname = typeid(*this).name(); - return class_map[ classname ].GetPosition(); + // wanted may be NULL and that is ok. + + if( wanted == topmost ) + return true; + + return findWindowRecursively( topmost->GetChildren(), wanted ); } -*/ + + +/// Set the focus if it is not already set in a derived constructor to a specific control. +void DIALOG_SHIM::onInit( wxInitDialogEvent& aEvent ) +{ + wxWindow* focusWnd = wxWindow::FindFocus(); + + // If focusWnd is not already this window or a child of it, then SetFocus(). + // Otherwise the derived class's constructor SetFocus() already to a specific + // child control. + + if( !findWindowRecursively( this, focusWnd ) ) + { + // Linux wxGTK needs this to allow the ESCAPE key to close a wxDialog window. + SetFocus(); + } + + aEvent.Skip(); // derived class's handler should be called too +} +#endif diff --git a/common/dialogs/dialog_exit_base.cpp b/common/dialogs/dialog_exit_base.cpp index 4d0205dafc..0e1d422130 100644 --- a/common/dialogs/dialog_exit_base.cpp +++ b/common/dialogs/dialog_exit_base.cpp @@ -1,96 +1,98 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Feb 9 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_exit_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_EXIT_BASE::DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizerMain; - bSizerMain = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizerUpper; - bSizerUpper = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizerBitmap; - bSizerBitmap = new wxBoxSizer( wxVERTICAL ); - - m_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerBitmap->Add( m_bitmap, 0, wxALL, 5 ); - - - bSizerUpper->Add( bSizerBitmap, 0, 0, 5 ); - - wxBoxSizer* bSizerMessages; - bSizerMessages = new wxBoxSizer( wxVERTICAL ); - - m_TextInfo = new wxStaticText( this, wxID_ANY, _("Save the changes before closing?"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextInfo->Wrap( -1 ); - m_TextInfo->SetFont( wxFont( 8, 74, 90, 92, false, wxT("MS Shell Dlg 2") ) ); - - bSizerMessages->Add( m_TextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizerMessages->Add( 10, 10, 0, 0, 5 ); - - m_staticText2 = new wxStaticText( this, wxID_ANY, _("If you don't save, all your changes will be permanently lost."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText2->Wrap( -1 ); - bSizerMessages->Add( m_staticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizerUpper->Add( bSizerMessages, 1, wxEXPAND, 5 ); - - - bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizerLower; - bSizerLower = new wxBoxSizer( wxVERTICAL ); - - m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerLower->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - wxBoxSizer* bSizerButtons; - bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonSaveAndExit = new wxButton( this, wxID_ANY, _("Save and Exit"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButtons->Add( m_buttonSaveAndExit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonExitNoSave = new wxButton( this, wxID_ANY, _("Exit without Save"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButtons->Add( m_buttonExitNoSave, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButtons->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerLower->Add( bSizerButtons, 0, wxALIGN_RIGHT, 5 ); - - - bSizerMain->Add( bSizerLower, 0, wxEXPAND, 5 ); - - - this->SetSizer( bSizerMain ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - m_buttonSaveAndExit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this ); - m_buttonExitNoSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this ); - m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this ); -} - -DIALOG_EXIT_BASE::~DIALOG_EXIT_BASE() -{ - // Disconnect Events - m_buttonSaveAndExit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this ); - m_buttonExitNoSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this ); - m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this ); - -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_exit_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_EXIT_BASE::DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerUpper; + bSizerUpper = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerBitmap; + bSizerBitmap = new wxBoxSizer( wxVERTICAL ); + + m_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBitmap->Add( m_bitmap, 0, wxALL, 5 ); + + + bSizerUpper->Add( bSizerBitmap, 0, 0, 5 ); + + wxBoxSizer* bSizerMessages; + bSizerMessages = new wxBoxSizer( wxVERTICAL ); + + m_TextInfo = new wxStaticText( this, wxID_ANY, _("Save the changes before closing?"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextInfo->Wrap( -1 ); + m_TextInfo->SetFont( wxFont( 8, 74, 90, 92, false, wxT("MS Shell Dlg 2") ) ); + + bSizerMessages->Add( m_TextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizerMessages->Add( 10, 10, 0, 0, 5 ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("If you don't save, all your changes will be permanently lost."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + bSizerMessages->Add( m_staticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizerUpper->Add( bSizerMessages, 1, wxEXPAND, 5 ); + + + bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerLower; + bSizerLower = new wxBoxSizer( wxVERTICAL ); + + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerLower->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerButtons; + bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonSaveAndExit = new wxButton( this, wxID_ANY, _("Save and Exit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSaveAndExit->SetDefault(); + bSizerButtons->Add( m_buttonSaveAndExit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonExitNoSave = new wxButton( this, wxID_ANY, _("Exit without Save"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonExitNoSave, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerLower->Add( bSizerButtons, 0, wxALIGN_RIGHT, 5 ); + + + bSizerMain->Add( bSizerLower, 0, wxEXPAND, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + m_buttonSaveAndExit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this ); + m_buttonExitNoSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this ); +} + +DIALOG_EXIT_BASE::~DIALOG_EXIT_BASE() +{ + // Disconnect Events + m_buttonSaveAndExit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this ); + m_buttonExitNoSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this ); + +} diff --git a/common/dialogs/dialog_exit_base.fbp b/common/dialogs/dialog_exit_base.fbp index a5702a029e..a02b7552f7 100644 --- a/common/dialogs/dialog_exit_base.fbp +++ b/common/dialogs/dialog_exit_base.fbp @@ -1,804 +1,754 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_exit_base - 1000 - none - 1 - dialog_exit_base - - . - - 1 - 1 - 1 - 0 - 0 - - 1 - 1 - 1 - 1 - - 0 - - - - - - - 1 - wxBOTH - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - impl_virtual - - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - DIALOG_EXIT_BASE - 1 - - - 1 - - Resizable - 1 - 345,155 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - bSizerUpper - wxHORIZONTAL - none - - 5 - - 0 - - - bSizerBitmap - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizerMessages - wxVERTICAL - none - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - MS Shell Dlg 2,90,92,8,74,0 - 0 - 0 - wxID_ANY - Save the changes before closing? - - 0 - - - 0 - - 1 - m_TextInfo - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - If you don't save, all your changes will be permanently lost. - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizerLower - wxVERTICAL - none - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_RIGHT - 0 - - - bSizerButtons - wxHORIZONTAL - none - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Save and Exit - - 0 - - - 0 - - 1 - m_buttonSaveAndExit - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnSaveAndExit - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Exit without Save - - 0 - - - 0 - - 1 - m_buttonExitNoSave - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnExitNoSave - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Cancel - - 0 - - - 0 - - 1 - m_buttonCancel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_exit_base + 1000 + none + 1 + dialog_exit_base + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_EXIT_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxHORIZONTAL + none + + 5 + + 0 + + + bSizerBitmap + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerMessages + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + MS Shell Dlg 2,90,92,8,74,0 + 0 + 0 + wxID_ANY + Save the changes before closing? + + 0 + + + 0 + + 1 + m_TextInfo + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 10 + protected + 10 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + If you don't save, all your changes will be permanently lost. + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerLower + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + + bSizerButtons + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Save and Exit + + 0 + + + 0 + + 1 + m_buttonSaveAndExit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSaveAndExit + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exit without Save + + 0 + + + 0 + + 1 + m_buttonExitNoSave + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnExitNoSave + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Cancel + + 0 + + + 0 + + 1 + m_buttonCancel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCancel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/dialogs/dialog_exit_base.h b/common/dialogs/dialog_exit_base.h index 43ebdc5e9f..73304357b3 100644 --- a/common/dialogs/dialog_exit_base.h +++ b/common/dialogs/dialog_exit_base.h @@ -1,61 +1,64 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Feb 9 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_EXIT_BASE_H__ -#define __DIALOG_EXIT_BASE_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_EXIT_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_EXIT_BASE : public wxDialog -{ - private: - - protected: - wxStaticBitmap* m_bitmap; - wxStaticText* m_TextInfo; - wxStaticText* m_staticText2; - wxStaticLine* m_staticline; - wxButton* m_buttonSaveAndExit; - wxButton* m_buttonExitNoSave; - wxButton* m_buttonCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnSaveAndExit( wxCommandEvent& event ) { event.Skip(); } - virtual void OnExitNoSave( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 345,155 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_EXIT_BASE(); - -}; - -#endif //__DIALOG_EXIT_BASE_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_EXIT_BASE_H__ +#define __DIALOG_EXIT_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_EXIT_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_EXIT_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticBitmap* m_bitmap; + wxStaticText* m_TextInfo; + wxStaticText* m_staticText2; + wxStaticLine* m_staticline; + wxButton* m_buttonSaveAndExit; + wxButton* m_buttonExitNoSave; + wxButton* m_buttonCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnSaveAndExit( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExitNoSave( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_EXIT_BASE(); + +}; + +#endif //__DIALOG_EXIT_BASE_H__ diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 4d221cdf5e..2c55b543ec 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -45,6 +45,7 @@ #include + // List of page formats. // should be statically initialized, because we need both // the translated and the not translated version. @@ -109,8 +110,6 @@ void DIALOG_PAGES_SETTINGS::initDialog() double customSizeX; double customSizeY; - SetFocus(); - // initalize page format choice box and page format list. // The first shows translated strings, the second contains not tralated strings m_paperSizeComboBox->Clear(); diff --git a/include/dialog_shim.h b/include/dialog_shim.h index f4b88e65bf..c776a66c95 100644 --- a/include/dialog_shim.h +++ b/include/dialog_shim.h @@ -28,6 +28,12 @@ #include #include +#if wxMINOR_VERSION == 9 && defined(__WXGTK__) + #define DLGSHIM_USE_SETFOCUS 0 +#else + #define DLGSHIM_USE_SETFOCUS 1 +#endif + /** * Class DIALOG_SHIM @@ -50,10 +56,11 @@ public: bool Show( bool show ); // overload wxDialog::Show - /* - const wxSize& GetLastSize(); - const wxPoint& GetLastPosition(); - */ + +#if DLGSHIM_USE_SETFOCUS +private: + void onInit( wxInitDialogEvent& aEvent ); +#endif }; #endif // DIALOG_SHIM_