From 21b8289882af6521a3cdb20e805461f3e153b390 Mon Sep 17 00:00:00 2001 From: Kevin James Date: Wed, 6 May 2009 14:04:37 +0000 Subject: [PATCH] Fix for bug #2035920 - Now follows other application functionality: When find pane is closed, focus returns to active document --- src/xmlcopyeditor.cpp | 18 +++++++++++++++++- src/xmlcopyeditor.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index dfa638c..23b5600 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -174,6 +174,7 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame ) EVT_UPDATE_UI ( ID_RELOAD, MyFrame::OnUpdateReload ) EVT_IDLE ( MyFrame::OnIdle ) EVT_AUINOTEBOOK_PAGE_CLOSE ( wxID_ANY, MyFrame::OnPageClosing ) + EVT_AUI_PANE_CLOSE ( MyFrame::OnPaneClose ) #ifdef __WXMSW__ EVT_DROP_FILES ( MyFrame::OnDropFiles ) #endif @@ -890,7 +891,7 @@ MyFrame::MyFrame ( manager.AddPane ( ( wxWindow * ) findReplacePanel, wxAuiPaneInfo().Bottom().Hide().Caption ( wxEmptyString ). - DestroyOnClose ( false ).Layer ( 2 ) ); + Name( _T ( "FindReplacePanel" ) ).DestroyOnClose ( false ).Layer ( 2 ) ); #endif commandPanel = new CommandPanel ( @@ -2608,6 +2609,7 @@ void MyFrame::OnGlobalReplace ( wxCommandEvent& event ) void MyFrame::OnFrameClose ( wxCloseEvent& event ) { + std::cout<<"MyFrame::OnFrameClose\n"; wxCommandEvent e; OnCloseAll ( e ); if ( mainBook->GetPageCount() ) @@ -6043,3 +6045,17 @@ void MyFrame::addToFileQueue ( wxString& fileName ) { fileQueue.push_back ( fileName ); } + +void MyFrame::OnPaneClose ( wxAuiManagerEvent& event ) +{ + wxAuiPaneInfo* closedPane=event.GetPane(); + + if (closedPane->name== _T ( "FindReplacePanel" ) ) + { + // Find pane was closed - set focus back to document pane + XmlDoc *doc; + if ( ( doc = getActiveDocument() ) == NULL ) + return; + doc->SetFocus(); + } +} diff --git a/src/xmlcopyeditor.h b/src/xmlcopyeditor.h index f2c7499..f3278a6 100755 --- a/src/xmlcopyeditor.h +++ b/src/xmlcopyeditor.h @@ -507,6 +507,7 @@ class MyFrame : public wxFrame bool ignoreEncoding = false, bool isXml = true ); void removeUtf8Bom ( std::string& buffer ); + void OnPaneClose ( wxAuiManagerEvent& event ); std::string getAuxPath ( const std::string& fileName ); wxMenuBar *getMenuBar(); wxToolBar *getToolBar();