本文整理汇总了C++中IEditor::FindAndSelectV方法的典型用法代码示例。如果您正苦于以下问题:C++ IEditor::FindAndSelectV方法的具体用法?C++ IEditor::FindAndSelectV怎么用?C++ IEditor::FindAndSelectV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditor
的用法示例。
在下文中一共展示了IEditor::FindAndSelectV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoItemActivated
void CscopeTab::DoItemActivated(const wxDataViewItem& item )
{
CscopeTabClientData *data = dynamic_cast<CscopeTabClientData*>(m_dataviewModel->GetClientObject(item));
if (data) {
wxString wsp_path = clCxxWorkspaceST::Get()->GetPrivateFolder();
//a single entry was activated, open the file
//convert the file path to absolut path. We do it here, to improve performance
wxFileName fn(data->GetEntry().GetFile());
if ( !fn.MakeAbsolute(wsp_path) ) {
wxLogMessage(wxT("failed to convert file to absolute path"));
}
if(m_mgr->OpenFile(fn.GetFullPath(), wxEmptyString, data->GetEntry().GetLine()-1)) {
IEditor *editor = m_mgr->GetActiveEditor();
if( editor && editor->GetFileName().GetFullPath() == fn.GetFullPath() && !GetFindWhat().IsEmpty()) {
// We can't use data->GetEntry().GetPattern() as the line to search for as any appended comments have been truncated
// For some reason LEditor::DoFindAndSelect checks it against the whole current line
// and won't believe a match unless their lengths are the same
int line = data->GetEntry().GetLine() - 1;
int start = editor->PosFromLine(line); // PosFromLine() returns the line start position
int end = editor->LineEnd(line);
wxString searchline(editor->GetTextRange(start, end));
// Find and select the entry in the file
editor->FindAndSelectV(searchline, GetFindWhat(), start); // The async version of FindAndSelect()
editor->DelayedSetActive(); // We need to SetActive() editor. At least in wxGTK, this won't work synchronously
}
}
} else {
// Parent item, expand it
m_dataview->Expand( item );
}
}
示例2: OpenSelection
void OpenResourceDialog::OpenSelection(const OpenResourceDialogItemData& selection, IManager* manager)
{
// send event to the plugins to see if they want
// to open this file
wxString file_path = selection.m_file;
clCommandEvent activateEvent(wxEVT_TREE_ITEM_FILE_ACTIVATED);
activateEvent.SetFileName(file_path);
if(EventNotifier::Get()->ProcessEvent(activateEvent)) return;
if(manager && manager->OpenFile(selection.m_file, wxEmptyString, selection.m_line - 1)) {
IEditor* editor = manager->GetActiveEditor();
if(editor && !selection.m_name.IsEmpty() && !selection.m_pattern.IsEmpty()) {
editor->FindAndSelectV(selection.m_pattern, selection.m_name);
}
}
}