Fix for bug #2035920 - Now follows other application functionality:

When find pane is closed, focus returns to active document
This commit is contained in:
Kevin James 2009-05-06 14:04:37 +00:00
parent 24eb60dae0
commit 21b8289882
2 changed files with 18 additions and 1 deletions

View File

@ -174,6 +174,7 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame )
EVT_UPDATE_UI ( ID_RELOAD, MyFrame::OnUpdateReload ) EVT_UPDATE_UI ( ID_RELOAD, MyFrame::OnUpdateReload )
EVT_IDLE ( MyFrame::OnIdle ) EVT_IDLE ( MyFrame::OnIdle )
EVT_AUINOTEBOOK_PAGE_CLOSE ( wxID_ANY, MyFrame::OnPageClosing ) EVT_AUINOTEBOOK_PAGE_CLOSE ( wxID_ANY, MyFrame::OnPageClosing )
EVT_AUI_PANE_CLOSE ( MyFrame::OnPaneClose )
#ifdef __WXMSW__ #ifdef __WXMSW__
EVT_DROP_FILES ( MyFrame::OnDropFiles ) EVT_DROP_FILES ( MyFrame::OnDropFiles )
#endif #endif
@ -890,7 +891,7 @@ MyFrame::MyFrame (
manager.AddPane ( manager.AddPane (
( wxWindow * ) findReplacePanel, ( wxWindow * ) findReplacePanel,
wxAuiPaneInfo().Bottom().Hide().Caption ( wxEmptyString ). wxAuiPaneInfo().Bottom().Hide().Caption ( wxEmptyString ).
DestroyOnClose ( false ).Layer ( 2 ) ); Name( _T ( "FindReplacePanel" ) ).DestroyOnClose ( false ).Layer ( 2 ) );
#endif #endif
commandPanel = new CommandPanel ( commandPanel = new CommandPanel (
@ -2608,6 +2609,7 @@ void MyFrame::OnGlobalReplace ( wxCommandEvent& event )
void MyFrame::OnFrameClose ( wxCloseEvent& event ) void MyFrame::OnFrameClose ( wxCloseEvent& event )
{ {
std::cout<<"MyFrame::OnFrameClose\n";
wxCommandEvent e; wxCommandEvent e;
OnCloseAll ( e ); OnCloseAll ( e );
if ( mainBook->GetPageCount() ) if ( mainBook->GetPageCount() )
@ -6043,3 +6045,17 @@ void MyFrame::addToFileQueue ( wxString& fileName )
{ {
fileQueue.push_back ( 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();
}
}

View File

@ -507,6 +507,7 @@ class MyFrame : public wxFrame
bool ignoreEncoding = false, bool ignoreEncoding = false,
bool isXml = true ); bool isXml = true );
void removeUtf8Bom ( std::string& buffer ); void removeUtf8Bom ( std::string& buffer );
void OnPaneClose ( wxAuiManagerEvent& event );
std::string getAuxPath ( const std::string& fileName ); std::string getAuxPath ( const std::string& fileName );
wxMenuBar *getMenuBar(); wxMenuBar *getMenuBar();
wxToolBar *getToolBar(); wxToolBar *getToolBar();