void CscopePlugin::OnFind(wxCommandEvent &event) { wxString WordAtCaret = GetWordAtCaret(); if (WordAtCaret.IsEmpty()) return; wxString list_file, outputfilename; if ( !CreateListFile(list_file) ) return; wxString cmd( GetCscopeBinaryName() + _T(" ") + //_T(" -f ") + reffilename + _T(" -L") ); wxString endMsg(_T("Results for: ")); if ( event.GetId() == idOnFindFunctionsCallingThisFunction) { cmd += _T(" -3 "); endMsg += _T("find functions calling '") + WordAtCaret + _T("'"); } else //if( event.GetId() == idOnFindFunctionsCalledByThisFuncion) { cmd += _T(" -2 "); endMsg += _T("find functions called by '") + WordAtCaret + _T("'"); } // else if ( event.GetId() == idOnFindGlobalDefinition ) // { // cmd += _T(" -1 "); // endMsg += _T("find '") + WordAtCaret + _T("' global definition"); // } // else //idOnFindSymbol // { // cmd += _T(" -0 "); // endMsg += _T("find C symbol '") + WordAtCaret + _T("'"); // } cmd += WordAtCaret + _T(" -i \"") + list_file + _T("\""); DoCscopeCommand(cmd, endMsg); }
void OccurrencesHighlighting::BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data) { // Some library module is ready to display a pop-up menu. // Check the parameter \"type\" and see which module it is // and append any items you need in the menu... // TIP: for consistency, add a separator as the first item... if ( !IsAttached() ) return; if (type != mtEditorManager || !menu) return; EditorManager* emngr = Manager::Get()->GetEditorManager(); if ( !emngr ) return; EditorBase *edb = emngr->GetActiveEditor(); if ( !edb || !edb->IsBuiltinEditor() ) return; cbStyledTextCtrl* stc = ((cbEditor*)edb)->GetControl(); if ( !stc ) return; wxString word = GetWordAtCaret(); if ( word.IsEmpty() ) return; menu->AppendSeparator(); if ( m_texts.find(word) == m_texts.end() ) menu->Append(idMenuEntryPermanent, _("Permanently Highlight '") + word + _T("'")); else menu->Append(idMenuEntryRemove, _("Don't Highlight '") + word + _T("'")); }
void CscopePlugin::BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* /*data*/) { if ( !IsAttached() || m_pProcess) return; if(type != mtEditorManager || !menu ) return; EditorManager* emngr = Manager::Get()->GetEditorManager(); if ( !emngr ) return; EditorBase *edb = emngr->GetActiveEditor(); if ( !edb || !edb->IsBuiltinEditor() ) return; cbStyledTextCtrl* stc = ((cbEditor*)edb)->GetControl(); if ( !stc ) return; if ( stc->GetLexer() != wxSCI_LEX_CPP) return; wxString word = GetWordAtCaret(); if ( word.IsEmpty() ) return; PluginManager *pluginManager = Manager::Get()->GetPluginManager(); int idximp = pluginManager->GetFindMenuItemFirst() + pluginManager->GetFindMenuItemCount(); menu->Insert(idximp++, idOnFindFunctionsCalledByThisFuncion, _("Find functions called by '") + word + _T("'")); menu->Insert(idximp++, idOnFindFunctionsCallingThisFunction, _("Find functions calling '") + word + _T("'")); pluginManager->RegisterFindMenuItems(false, 2); }
void OccurrencesHighlighting::OnHighlightRemove(wxCommandEvent& WXUNUSED(event)) { wxString word = GetWordAtCaret(); m_texts.erase(word); m_pHighlighter->TextsChanged(); UpdatePanel(); }
void CscopePlugin::BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* /*data*/) { if ( !IsAttached() || m_pProcess) return; if(type != mtEditorManager || !menu ) return; EditorManager* emngr = Manager::Get()->GetEditorManager(); if ( !emngr ) return; EditorBase *edb = emngr->GetActiveEditor(); if ( !edb || !edb->IsBuiltinEditor() ) return; cbStyledTextCtrl* stc = ((cbEditor*)edb)->GetControl(); if ( !stc ) return; if ( stc->GetLexer() != wxSCI_LEX_CPP) return; wxString word = GetWordAtCaret(); if ( word.IsEmpty() ) return; // Looks after the "Find implementation of:" menu item const wxMenuItemList ItemsList = menu->GetMenuItems(); int idximp=-1; int idxocc=-1; for (int idx = 0; idx < (int)ItemsList.GetCount(); ++idx) { #if wxCHECK_VERSION(2, 9, 0) if (ItemsList[idx]->GetItemLabelText().StartsWith(_("Find implementation of:")) ) #else if (ItemsList[idx]->GetLabel().StartsWith(_("Find implementation of:")) ) #endif { idximp = idx; } #if wxCHECK_VERSION(2, 9, 0) if (ItemsList[idx]->GetItemLabelText().StartsWith(_("Find occurrences of:")) ) #else if (ItemsList[idx]->GetLabel().StartsWith(_("Find occurrences of:")) ) #endif { idxocc = idx; } } if ( idxocc == -1 && idximp == -1 ) { //for consistency, add a separator as the first item: menu->AppendSeparator(); //menu->Append(idOnFindSymbol, _T("Find C symbol '") + word + _T("'")); //menu->Append(idOnFindGlobalDefinition, _T("Find '") + word + _T("' global definition")); menu->Append(idOnFindFunctionsCalledByThisFuncion, _T("Find functions called by '") + word + _T("'")); menu->Append(idOnFindFunctionsCallingThisFunction, _T("Find functions calling '") + word + _T("'")); } else { if ( idxocc >= 0 ) // if find occurences idximp = idxocc; //menu->Insert(++idximp,idOnFindSymbol, _T("Find C symbol '") + word + _T("'")); //menu->Insert(++idximp,idOnFindGlobalDefinition, _T("Find '") + word + _T("' global definition")); menu->Insert(++idximp,idOnFindFunctionsCalledByThisFuncion, _T("Find functions called by '") + word + _T("'")); menu->Insert(++idximp,idOnFindFunctionsCallingThisFunction, _T("Find functions calling '") + word + _T("'")); } }