void OpenFilesListPlugin::RefreshOpenFilesTree(EditorBase* ed, bool remove) { if (Manager::IsAppShuttingDown() || !ed) return; EditorManager* mgr = Manager::Get()->GetEditorManager(); EditorBase* aed = mgr->GetActiveEditor(); m_pTree->Freeze(); wxTreeItemIdValue cookie = 0; wxTreeItemId item = m_pTree->GetFirstChild(m_pTree->GetRootItem(), cookie); wxString shortname = ed->GetShortName(); bool found = false; // loop all tree items while (item) { EditorBase* data = static_cast<EditorBase*>(static_cast<OpenFilesListData*>(m_pTree->GetItemData(item))->GetEditor()); if (data && ed == data) { // and apply changes to current item if (!remove) { found = true; int mod = GetOpenFilesListIcon(ed); if (m_pTree->GetItemText(item) != shortname) m_pTree->SetItemText(item, shortname); if (m_pTree->GetItemImage(item) != mod) { m_pTree->SetItemImage(item, mod, wxTreeItemIcon_Normal); m_pTree->SetItemImage(item, mod, wxTreeItemIcon_Selected); } if (ed == aed) m_pTree->SelectItem(item); } else m_pTree->Delete(item); break; } item = m_pTree->GetNextChild(m_pTree->GetRootItem(), cookie); } // not found, not to-remove and valid name: add new item if (!found && !remove && ed->VisibleToTree() && !shortname.IsEmpty()) { int mod = GetOpenFilesListIcon(ed); item = m_pTree->AppendItem(m_pTree->GetRootItem(), shortname, mod, mod, new OpenFilesListData(ed)); if (mgr->GetActiveEditor() == ed) m_pTree->SelectItem(item); m_pTree->SortChildren(m_pTree->GetRootItem()); } m_pTree->Thaw(); }
void NassiPlugin::OnInsertCFromDiagram(wxCommandEvent &event) { // check if user can isert an opened diagram unsigned idx = 0; for ( int i = 0 ; i < Manager::Get()->GetEditorManager()->GetEditorsCount() ; i++ ) { EditorBase *ed = Manager::Get()->GetEditorManager()->GetEditor( i ); if ( NassiEditorPanel::IsNassiEditor( ed ) ) { NassiEditorPanel *ned = (NassiEditorPanel *)ed; if ( event.GetId() == insertCFromDiagram[idx] ) { EditorManager* emngr = Manager::Get()->GetEditorManager(); if ( !emngr ) return; EditorBase *edb = emngr->GetActiveEditor(); if ( !edb || !edb->IsBuiltinEditor() ) return; unsigned int indent = ((cbEditor*)edb)->GetLineIndentInSpaces(); // from current line cbStyledTextCtrl *stc = ((cbEditor*)edb)->GetControl(); if ( !stc ) return; wxStringOutputStream ostrstream; wxTextOutputStream text_stream(ostrstream); if ( !ned ) return; ned->GetCSource(text_stream, indent); stc->InsertText(wxSCI_INVALID_POSITION, ostrstream.GetString()); } //some comment idx++; } } }
void NassiPlugin::ParseC(wxCommandEvent & /*event*/) { 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; NassiEditorPanel *panel = new NassiEditorPanel(_T(""), _T("")); switch ( stc->GetLexer() ) { case wxSCI_LEX_CPP: { const wxString str = stc->GetSelectedText(); if ( !panel->ParseC(str) ) { panel->Close(); wxMessageBox(_("unable to parse input"), _("Error!")); } //else stc->SetReadOnly(true); } break; default: break; } }
void OpenFilesListPlugin::RebuildOpenFilesTree() { if (Manager::IsAppShuttingDown()) return; EditorManager* mgr = Manager::Get()->GetEditorManager(); m_pTree->Freeze(); m_pTree->DeleteChildren(m_pTree->GetRootItem()); if (!mgr->GetEditorsCount()) { m_pTree->Thaw(); return; } // loop all open editors for (int i = 0; i < mgr->GetEditorsCount(); ++i) { EditorBase* ed = mgr->GetEditor(i); if (!ed || !ed->VisibleToTree()) continue; wxString shortname = ed->GetShortName(); int mod = GetOpenFilesListIcon(ed); wxTreeItemId item = m_pTree->AppendItem(m_pTree->GetRootItem(), shortname, mod, mod, new OpenFilesListData(ed)); if (mgr->GetActiveEditor() == ed) m_pTree->SelectItem(item); } m_pTree->SortChildren(m_pTree->GetRootItem()); m_pTree->Expand(m_pTree->GetRootItem()); m_pTree->Thaw(); }
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::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 PythonDebugger::SetWatchTooltip(const wxString &tip, int definition_length) { EditorManager* edMan = Manager::Get()->GetEditorManager(); EditorBase* base = edMan->GetActiveEditor(); cbEditor* ed = base && base->IsBuiltinEditor() ? static_cast<cbEditor*>(base) : 0; if (!ed) return; ed->GetControl()->CallTipShow(m_watch_tooltip_pos, tip); ed->GetControl()->CallTipSetHighlight(0,definition_length); }
wxString CBTSVN::GetEditorFilename() { EditorManager* man = Manager::Get()->GetEditorManager(); if (!man) return _(""); // prevent invocation on "start here" cbEditor* builtin_active_editor = man->GetBuiltinActiveEditor(); if (!builtin_active_editor) return _(""); EditorBase* active_editor = man->GetActiveEditor(); if (!active_editor) return _(""); return active_editor->GetFilename(); }
void Exporter::OnUpdateUI(wxUpdateUIEvent &event) { if (Manager::IsAppShuttingDown()) { event.Skip(); return; } wxMenuBar *mbar = Manager::Get()->GetAppFrame()->GetMenuBar(); if (mbar) { EditorManager *em = Manager::Get()->GetEditorManager(); // Enabled if there's a source file opened (be sure it isn't the "Start here" page) bool disable = !em || !em->GetActiveEditor() || !em->GetBuiltinActiveEditor(); mbar->Enable(idFileExportHTML, !disable); mbar->Enable(idFileExportRTF, !disable); mbar->Enable(idFileExportODT, !disable); mbar->Enable(idFileExportPDF, !disable); } event.Skip(); }
void NassiPlugin::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() || !menu ) return; if ( type != mtEditorManager ) 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; wxMenu *NassiMenu = 0; // check if user can select to generate a diagram from selection if ( stc->GetLexer() == wxSCI_LEX_CPP && stc->GetSelectionEnd() - stc->GetSelectionStart() > 0 ) { if (! NassiMenu ) NassiMenu = new wxMenu(); NassiMenu->Append(idParseC, _("Create diagram")); } // check if user can insert an opened diagram wxArrayString names; for ( int i = 0 ; i < Manager::Get()->GetEditorManager()->GetEditorsCount() ; ++i ) { EditorBase *ed = Manager::Get()->GetEditorManager()->GetEditor( i ); if ( NassiEditorPanel::IsNassiEditor( ed ) ) names.Add(ed->GetTitle( ) ); } if ( stc->GetLexer() == wxSCI_LEX_CPP && names.GetCount() > 0 ) { if (! NassiMenu ) { NassiMenu = new wxMenu(); } else { NassiMenu->AppendSeparator(); } for ( int i = 0; i < static_cast<int>(names.GetCount()) && i < 10 ; ++i ) { NassiMenu->Append(insertCFromDiagram[i], _("insert from ") + names[i] ); } } if ( NassiMenu ) { menu->AppendSeparator(); menu->AppendSubMenu(NassiMenu, _("Nassi Shneiderman")); } }
void ToolsPlus::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... m_contextvec.Empty(); if (type==mtProjectManager) { if (data) { if (data->GetKind()==FileTreeData::ftdkProject) { cbProject* prj = data->GetProject(); wxString filename=wxFileName(prj->GetFilename()).GetPath(); wxString name=_T(""); size_t sep_pos=menu->GetMenuItemCount(); size_t added=0; for (unsigned int i=0;i<m_ic.interps.size();i++) { if (WildCardListMatch(m_ic.interps[i].wildcards,name)) { m_RunTarget=filename; if (m_ic.interps[i].command.Find(_("$dir"))>=0 || m_ic.interps[i].command.Find(_("$reldir"))>=0 || m_ic.interps[i].command.Find(_("$path"))>=0 || m_ic.interps[i].command.Find(_("$relpath"))>=0 || m_ic.interps[i].command.Find(_("$mpaths"))>=0) { wxString menutext=m_ic.interps[i].name; m_contextvec.Add(i); AddModuleMenuEntry(menu,i,added); added++; } } } if (added>0) menu->InsertSeparator(sep_pos); } if (data->GetKind()==FileTreeData::ftdkFile) { ProjectFile *f=data->GetProjectFile(); if (f) { wxString filename=f->file.GetFullPath(); wxString name=f->file.GetFullName(); size_t sep_pos=menu->GetMenuItemCount(); size_t added=0; for (unsigned int i=0;i<m_ic.interps.size();i++) { if (WildCardListMatch(m_ic.interps[i].wildcards,name)) { m_RunTarget=filename; if (m_ic.interps[i].command.Find(_("$file"))>=0 || m_ic.interps[i].command.Find(_("$relfile"))>=0 || m_ic.interps[i].command.Find(_("$fname"))>=0 || m_ic.interps[i].command.Find(_("$fext"))>=0 || m_ic.interps[i].command.Find(_("$path"))>=0 || m_ic.interps[i].command.Find(_("$relpath"))>=0 || m_ic.interps[i].command.Find(_("$mpaths"))>=0) { wxString menutext=m_ic.interps[i].name; m_contextvec.Add(i); AddModuleMenuEntry(menu,i,added); added++; } } } if (added>0) menu->InsertSeparator(sep_pos); } } } } if (type==mtEditorManager) // also type==mtOpenFilesList - not sure how to find out which file has been right clicked. { EditorManager* edMan = Manager::Get()->GetEditorManager(); wxFileName activefile(edMan->GetActiveEditor()->GetFilename()); wxString filename=activefile.GetFullPath(); wxString name=activefile.GetFullName(); size_t sep_pos=menu->GetMenuItemCount(); size_t added=0; for (unsigned int i=0;i<m_ic.interps.size();i++) { if (WildCardListMatch(m_ic.interps[i].wildcards,name)) { m_RunTarget=filename; if (m_ic.interps[i].command.Find(_("$file"))>=0 || m_ic.interps[i].command.Find(_("$relfile"))>=0 || m_ic.interps[i].command.Find(_("$fname"))>=0 || m_ic.interps[i].command.Find(_("$fext"))>=0 || m_ic.interps[i].command.Find(_("$path"))>=0 || m_ic.interps[i].command.Find(_("$relpath"))>=0 || m_ic.interps[i].command.Find(_("$mpaths"))>=0) { wxString menutext=m_ic.interps[i].name; m_contextvec.Add(i); AddModuleMenuEntry(menu,i,added); added++; } } } if (added>0) menu->InsertSeparator(sep_pos); } if (type==mtUnknown) //Assuming file explorer -- fileexplorer fills the filetreedata with ftdkFile or ftdkFolder as "kind", the folder is the full path of the entry { if (data) { size_t sep_pos=menu->GetMenuItemCount(); size_t added=0; if (data->GetKind()==FileTreeData::ftdkFile) //right clicked on folder in file explorer { wxFileName f(data->GetFolder()); wxString filename=f.GetFullPath(); wxString name=f.GetFullName(); for (unsigned int i=0;i<m_ic.interps.size();i++) { if (WildCardListMatch(m_ic.interps[i].wildcards,name)) { m_RunTarget=filename; if (m_ic.interps[i].command.Find(_("$file"))>=0 || m_ic.interps[i].command.Find(_("$relfile"))>=0 || m_ic.interps[i].command.Find(_("$fname"))>=0 || m_ic.interps[i].command.Find(_("$fext"))>=0 || m_ic.interps[i].command.Find(_("$path"))>=0 || m_ic.interps[i].command.Find(_("$relpath"))>=0 || m_ic.interps[i].command.Find(_("$mpaths"))>=0) { wxString menutext=m_ic.interps[i].name; m_contextvec.Add(i); AddModuleMenuEntry(menu,i,added); added++; } } } } if (data->GetKind()==FileTreeData::ftdkFolder) //right clicked on folder in file explorer { wxFileName f(data->GetFolder()); wxString filename=f.GetFullPath(); wxString name=f.GetFullName(); for (unsigned int i=0;i<m_ic.interps.size();i++) { if (WildCardListMatch(m_ic.interps[i].wildcards,name)) { m_RunTarget=filename; if (m_ic.interps[i].command.Find(_("$dir"))>=0 || m_ic.interps[i].command.Find(_("$reldir"))>=0 || m_ic.interps[i].command.Find(_("$path"))>=0 || m_ic.interps[i].command.Find(_("$relpath"))>=0 || m_ic.interps[i].command.Find(_("$mpaths"))>=0) { wxString menutext=m_ic.interps[i].name; m_contextvec.Add(i); AddModuleMenuEntry(menu,i,added); added++; } } } } if (data->GetKind()==FileTreeData::ftdkVirtualGroup) //right clicked on multiple selections in file explorer { wxString paths=data->GetFolder(); //get folder contains a space separated list of the files/directories selected for (unsigned int i=0;i<m_ic.interps.size();i++) { bool match=true; // all selected items must have names that match the wildcard for this grouping wxString pathlist=paths; wxString ipath=paths.BeforeFirst('*'); // '*' separated list if (m_ic.interps[i].wildcards!=_T("")) { while (match && pathlist!=_T("")) { wxString name=wxFileName(ipath).GetFullName(); if (ipath!=_T("") && !WildCardListMatch(m_ic.interps[i].wildcards,ipath)) match=false; pathlist=pathlist.AfterFirst('*'); ipath=pathlist.BeforeFirst('*'); } } if (match) { m_RunTarget=paths; //TODO: need a m_TargetParent to allow the FileExplorer to define the parent of a selection (usually the root of the fileexplorer view?) if (m_ic.interps[i].command.Find(_("$mpaths"))>=0) { wxString menutext=m_ic.interps[i].name; m_contextvec.Add(i); AddModuleMenuEntry(menu,i,added); added++; } } } } if (added>0) menu->InsertSeparator(sep_pos); } } }
void ToolsPlus::OnRunTarget(wxCommandEvent& event) { int ID=event.GetId(); wxString commandstr; wxString consolename; wxString workingdir; bool windowed=false; bool console=false; if (ID>=ID_ContextMenu_0&&ID<=ID_ContextMenu_49) { m_interpnum=m_contextvec[ID-ID_ContextMenu_0]; commandstr=m_ic.interps[m_interpnum].command; consolename=m_ic.interps[m_interpnum].name; windowed=(m_ic.interps[m_interpnum].mode==_("W")); console=(m_ic.interps[m_interpnum].mode==_("C")); workingdir=m_ic.interps[m_interpnum].wdir; } else if (ID>=ID_SubMenu_0&&ID<=ID_SubMenu_49) { m_interpnum=ID-ID_SubMenu_0; commandstr=m_ic.interps[m_interpnum].command; consolename=m_ic.interps[m_interpnum].name; windowed=(m_ic.interps[m_interpnum].mode==_("W")); console=(m_ic.interps[m_interpnum].mode==_("C")); workingdir=m_ic.interps[m_interpnum].wdir; m_wildcard=m_ic.interps[m_interpnum].wildcards; if (m_ic.interps[m_interpnum].command.Find(_("$file"))>0 || m_ic.interps[m_interpnum].command.Find(_("$path"))>0) { m_RunTarget=wxEmptyString; EditorManager* edMan = Manager::Get()->GetEditorManager(); if (edMan && edMan->GetActiveEditor() && edMan->GetActiveEditor()->GetFilename()) { wxFileName activefile(edMan->GetActiveEditor()->GetFilename()); wxString filename=activefile.GetFullPath(); wxString name=activefile.GetFullName(); if (WildCardListMatch(m_ic.interps[m_interpnum].wildcards,name)) m_RunTarget=filename; } if (m_RunTarget==wxEmptyString) OnSetTarget(event); if (!wxFileName::FileExists(m_RunTarget)) { LogMessage(_("Tools Plus plugin: ")+m_RunTarget+_(" not found")); return; } } if (m_ic.interps[m_interpnum].command.Find(_("$dir"))>0) { OnSetDirTarget(event); if (!wxFileName::DirExists(m_RunTarget)) { LogMessage(_("Tools Plus plugin: ")+m_RunTarget+_(" not found")); return; } if (m_RunTarget==_T("")) return; } if (m_ic.interps[m_interpnum].command.Find(_("$mpaths"))>0) { OnSetMultiTarget(event); if (m_RunTarget==_T("")) return; } } else { LogMessage(wxString::Format(_("WARNING: Unprocessed Tools Plus Menu Message: ID %i, IDbase %i, IDend %i, num items on menu %i"),ID,ID_ContextMenu_0,ID_ContextMenu_49,(int)m_contextvec.size())); return; } m_RunTarget.Replace(_T("*"),_T(" ")); bool setdir=true; commandstr.Replace(_("$file"),wxFileName(m_RunTarget).GetShortPath()); commandstr.Replace(_("$relfile"),wxFileName(m_RunTarget).GetFullName()); commandstr.Replace(_("$fname"),wxFileName(m_RunTarget).GetName()); commandstr.Replace(_("$fext"),wxFileName(m_RunTarget).GetExt()); commandstr.Replace(_("$dir"),wxFileName(m_RunTarget).GetShortPath()); commandstr.Replace(_("$reldir"),wxFileName(m_RunTarget).GetFullName()); commandstr.Replace(_("$path"),wxFileName(m_RunTarget).GetShortPath()); commandstr.Replace(_("$relpath"),wxFileName(m_RunTarget).GetFullPath()); if (commandstr.Replace(_("$mpaths"),m_RunTarget)>0) setdir=false; // substitute user prompted values in the format: $inputstr{Enter your message} int promptind=commandstr.Find(_("$inputstr{")); wxString substitution; while (promptind>=0) { int promptend=commandstr.Mid(promptind+10).Find(_("}")); if (promptend<=0) { cbMessageBox(_("Malformed $inputstr in command line -- no closing '}' found: ")+commandstr); return; } else promptend++; wxTextEntryDialog ted(NULL,commandstr.Mid(promptind+10,promptend-1),consolename,_T(""),wxOK|wxCANCEL); if (ted.ShowModal()==wxID_OK) substitution=ted.GetValue(); else return; commandstr=commandstr.Left(promptind)+substitution+commandstr.Mid(promptind+10+promptend); int nextind=commandstr.Mid(promptind+substitution.Len()).Find(_("$inputstr")); if (nextind>=0) promptind+=nextind+substitution.Len(); else promptind=-1; } commandstr.Replace(_("$interpreter"),wxFileName(m_ic.interps[m_interpnum].command).GetShortPath()); workingdir.Replace(_("$parentdir"),wxFileName(m_RunTarget).GetPath()); if (wxFileName::DirExists(m_RunTarget)) workingdir.Replace(_("$dir"),wxFileName(m_RunTarget).GetFullPath()); if (Manager::Get()->GetMacrosManager()) { Manager::Get()->GetMacrosManager()->RecalcVars(0, 0, 0); // hack to force-update macros Manager::Get()->GetMacrosManager()->ReplaceMacros(commandstr); Manager::Get()->GetMacrosManager()->ReplaceMacros(workingdir); } wxString olddir=wxGetCwd(); if (setdir && workingdir!=_T("")) { if (!wxSetWorkingDirectory(workingdir)) { LogMessage(_("Tools Plus Plugin: Can't change to working directory to ")+workingdir); return; } } LogMessage(wxString::Format(_("Launching '%s': %s (in %s)"), consolename.c_str(), commandstr.c_str(), workingdir.c_str())); if (windowed) { wxArrayString astr; m_shellmgr->LaunchProcess(commandstr,consolename,_("Piped Process Control"),astr); ShowConsole(); } else if (console) { wxString cmdline; #ifndef __WXMSW__ // for non-win platforms, use m_ConsoleTerm to run the console app wxString term = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/console_terminal"), DEFAULT_CONSOLE_TERM); term.Replace(_T("$TITLE"), _T("'") + consolename + _T("'")); cmdline<< term << _T(" "); #define CONSOLE_RUNNER "cb_console_runner" #else #define CONSOLE_RUNNER "cb_console_runner.exe" #endif wxString baseDir = ConfigManager::GetExecutableFolder(); if (wxFileExists(baseDir + wxT("/" CONSOLE_RUNNER))) cmdline << baseDir << wxT("/" CONSOLE_RUNNER " "); cmdline<<commandstr; if (!wxExecute(cmdline)) cbMessageBox(_("Command Launch Failed: ")+commandstr); } else { if (!wxExecute(commandstr)) cbMessageBox(_("Command Launch Failed: ")+commandstr); } wxSetWorkingDirectory(olddir); }
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("'")); } }