// ---------------------------------------------------------------------------- void ThreadSearchFrame::OnSearchFindNext(wxCommandEvent& event) // ---------------------------------------------------------------------------- { //(pecan 2008/7/20) FullSearch //Don't search in preview pane, and don't search if no editor is open ScbEditor* sEd = GetConfig()->GetEditorManager(this)->GetBuiltinActiveEditor(); if (not sEd) return; if (not ((wxWindow*)(sEd->GetControl()) == wxWindow::FindFocus())) return; bool bNext = !(event.GetId() == idSearchFindPrevious); //-Manager::Get()->GetEditorManager()->FindNext(bNext); GetConfig()->GetEditorManager(this)->FindNext(bNext); } // end of OnSearchFindNext
//PrintDialog::PrintDialog(wxWindow* parent) SPrintDialog::SPrintDialog(wxWindow* parent, SEditorManager* edMgr) { //ctor wxXmlResource::Get()->LoadObject(this, parent, _T("dlgPrint"),_T("wxScrollingDialog")); //-cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); ScbEditor* ed = edMgr->GetBuiltinActiveEditor(); if (ed) { bool hasSel = ed->GetControl()->GetSelectedText().Length(); XRCCTRL(*this, "rbScope", wxRadioBox)->SetSelection(hasSel ? 0 : 1); } else XRCCTRL(*this, "rbScope", wxRadioBox)->SetSelection(1); int mode = Manager::Get()->GetConfigManager(_T("app"))->ReadInt(_T("/print_mode"), 1); XRCCTRL(*this, "rbColourMode", wxRadioBox)->SetSelection(mode); bool print_line_numbers = Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/print_line_numbers"), true); XRCCTRL(*this, "chkLineNumbers", wxCheckBox)->SetValue(print_line_numbers); }
// ---------------------------------------------------------------------------- void ThreadSearchFrame::OnSearchFind(wxCommandEvent& event) // ---------------------------------------------------------------------------- { //(pecan 2008/7/20) //Don't search in preview pane, and don't search if no editor is open ScbEditor* sEd = GetConfig()->GetEditorManager(this)->GetBuiltinActiveEditor(); if (not sEd) return; if (not ((wxWindow*)(sEd->GetControl()) == wxWindow::FindFocus())) return; bool bDoMultipleFiles = (event.GetId() == idSearchFindInFiles); if(!bDoMultipleFiles) { //-bDoMultipleFiles = !Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); bDoMultipleFiles = not GetConfig()->GetEditorManager(this)->GetBuiltinActiveEditor(); } //-Manager::Get()->GetEditorManager()->ShowFindDialog(false, bDoMultipleFiles); GetConfig()->GetEditorManager(this)->ShowFindDialog(false, false); }// end of OnSearchFind
// ---------------------------------------------------------------------------- void ThreadSearchFrame::OnClose(wxCloseEvent &event) // ---------------------------------------------------------------------------- { this->Show(false); //avoid fragmented disappearing windows // memorize current ThreadSearchFrame position ConfigManager* pCfg = Manager::Get()->GetConfigManager(_T("SnippetsSearch")); int xPos, yPos, width, height; GetPosition(&xPos,&yPos); GetSize(&width,&height); pCfg->Write(wxT("/FramePosX"), xPos ); pCfg->Write(wxT("/FramePosY"), yPos); pCfg->Write(wxT("/FrameWidth"), width); pCfg->Write(wxT("/FrameHeight"), height); //-if (GetConfig()->IsApplication()) { // we have to close all open editors or we'll crash // in wxAuiNoteBook::GetPageCount(). EditoManager call wxAuiNotebook // to close 'em, but wxAuiNotebook has alread been deleted by // wxWidgets Destory(). SEditorManager* pEdMan = GetConfig()->GetEditorManager(this); if (pEdMan) { ScbEditor* ed; int knt = pEdMan->GetEditorsCount(); for ( int i=knt; i>0; --i ) { ed = (ScbEditor*)pEdMan->GetEditor(i-1); if ( ed ) ed->Close(); } } }//if // reverse splitterwindow switches and reparenting if (m_pThreadSearch){ RemoveEventHandler(m_pThreadSearch); m_pThreadSearch->OnRelease(true); } // free separate editor manager SEditorManager* m_pEdMan = GetConfig()->GetEditorManager(this); if ( m_pEdMan ) { RemoveEventHandler( m_pEdMan ); // *do this or crash @ Destroy()* delete m_pEdMan; GetConfig()->RemoveEditorManager((wxFrame*)this); } // free ThreadSearch plugin/evtHandler if ( m_pThreadSearch ){ delete m_pThreadSearch; // deletes ThreadSearch wxEvtHandler object m_pThreadSearch = 0; } // release memory in FileLinks array used by ThreadSearch GetConfig()->ClearFileLinksMapArray(); //- write the configuation file //- Don't free Manager unless we initialized it. which we didn't. //-Manager::Free(); //-GetConfig()->GetSnippetsWindow()->CloseThreadSearchFrame(); Destroy(); }