PluginsArray PluginManager::GetOffersFor(PluginType type) { PluginsArray arr; // special case for MIME plugins // we 'll add the default MIME handler, last in the returned array cbPlugin* dflt = nullptr; for (unsigned int i = 0; i < m_Plugins.GetCount(); ++i) { cbPlugin* plug = m_Plugins[i]->plugin; if (plug && plug->IsAttached() && plug->GetType() == type) { if (type == ptMime) { // default MIME handler? if (((cbMimePlugin*)plug)->HandlesEverything()) dflt = plug; else arr.Add(plug); } else arr.Add(plug); } } // add default MIME handler last if (dflt) arr.Add(dflt); return arr; }
void PluginManager::GetConfigurationPanels(int group, wxWindow* parent, ConfigurationPanelsArray& arrayToFill) { // build an array of Plugins* because we need to order it by configuration priority PluginsArray arr; for (unsigned int i = 0; i < m_Plugins.GetCount(); ++i) { cbPlugin* plug = m_Plugins[i]->plugin; // all check are done here if (plug && plug->IsAttached() && (plug->GetConfigurationGroup() & group)) arr.Add(plug); } // sort the array arr.Sort(SortByConfigurationPriority); // now enumerate the array and fill the supplied configurations panel array arrayToFill.Clear(); for (unsigned int i = 0; i < arr.GetCount(); ++i) { cbPlugin* plug = arr[i]; cbConfigurationPanel* pnl = plug->GetConfigurationPanel(parent); if (pnl) arrayToFill.Add(pnl); } }
// class constructor ProjectOptionsDlg::ProjectOptionsDlg(wxWindow* parent, cbProject* project) : m_Project(project), m_Current_Sel(-1), m_pCompiler(0L) { wxXmlResource::Get()->LoadObject(this, parent, _T("dlgProjectOptions"),_T("wxScrollingDialog")); wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox); int count = m_Project->GetFilesCount(); for (int i = 0; i < count; ++i) { ProjectFile* pf = m_Project->GetFile(i); list->Append(pf->relativeFilename); } // this fixes the minsize of the file list // which becomes huge when we add items in it (!) list->SetMinSize(wxSize(50,50)); // general XRCCTRL(*this, "txtProjectName", wxTextCtrl)->SetValue(m_Project->GetTitle()); XRCCTRL(*this, "txtProjectFilename", wxStaticText)->SetLabel(m_Project->GetFilename()); XRCCTRL(*this, "txtProjectMakefile", wxTextCtrl)->SetValue(m_Project->GetMakefile()); XRCCTRL(*this, "chkCustomMakefile", wxCheckBox)->SetValue(m_Project->IsMakefileCustom()); XRCCTRL(*this, "txtExecutionDir", wxTextCtrl)->SetValue(m_Project->GetMakefileExecutionDir()); XRCCTRL(*this, "txtMakeTool", wxTextCtrl)->SetValue(m_Project->GetMakeTool()); XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->SetSelection((int)m_Project->GetModeForPCH()); Compiler* compiler = CompilerFactory::GetCompiler(project->GetCompilerID()); bool hasPCH = compiler && compiler->GetSwitches().supportsPCH; XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->Enable(hasPCH); XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox)->SetValue(m_Project->GetExtendedObjectNamesGeneration()); XRCCTRL(*this, "chkNoForceObjectLowCase", wxCheckBox)->SetValue(m_Project->GetForceLowerCaseObject()); XRCCTRL(*this, "chkShowNotes", wxCheckBox)->SetValue(m_Project->GetShowNotesOnLoad()); XRCCTRL(*this, "txtNotes", wxTextCtrl)->SetValue(m_Project->GetNotes()); FillBuildTargets(); PluginsArray plugins = Manager::Get()->GetPluginManager()->GetCompilerOffers(); if (plugins.GetCount()) m_pCompiler = (cbCompilerPlugin*)plugins[0]; // scripts BuildScriptsTree(); // make sure everything is laid out properly // before adding panels from plugins // we don't want the dialog to become huge ;) // note that a similar situation in editor settings had been solved by commenting // the following line out... GetSizer()->SetSizeHints(this); // other plugins configuration AddPluginPanels(); CentreOnParent(); }
cbMimePlugin* PluginManager::GetMIMEHandlerForFile(const wxString& filename) { PluginsArray mimes = GetMimeOffers(); for (unsigned int i = 0; i < mimes.GetCount(); ++i) { cbMimePlugin* plugin = (cbMimePlugin*)mimes[i]; if (plugin && plugin->CanHandleFile(filename)) return plugin; } return nullptr; }
void DisassemblyTextCtrl::OnDclick(wxMouseEvent& event) { if(GetStatus()) { SetStatus(0); PluginsArray plugins = Manager::Get()->GetPluginManager()->GetDebuggerOffers(); if (plugins.GetCount()) { cbDebuggerPlugin* dbg = (cbDebuggerPlugin*)plugins[0]; if (dbg) { // is the debugger running? if (dbg->IsRunning()) { dbg->StepByStep(); } } } } int LineNum = GetCurrentLine(); int L2 = GetCurrentLine(); wxString LineText,SourceFile; unsigned long SourceLine=0; while(LineNum > 0) { LineText = GetLine(LineNum--); if(reRelativePath.Matches(LineText)) break; } if(LineText.IsEmpty()) return ; LineText.AfterLast(_T(':')).ToULong(&SourceLine,10); SourceFile = Manager::Get()->GetProjectManager()->GetActiveProject()->GetBasePath(); SourceFile << LineText.Before(_T(':')); SyncEditor(LineText.Before(_T(':')),SourceLine,true); SetReadOnly(false); MarkerDeleteAll(DEBUG_MARKER); MarkerAdd(SourceLine,DEBUG_MARKER); SetReadOnly(true); //wxMessageBox(wxString::Format(_T("%s:%d"),SourceFile.c_str(),SourceLine)); event.Skip(); }
bool cbDebuggerPlugin::EnsureBuildUpToDate(StartType startType) { m_StartType = startType; m_WaitingCompilerToFinish = false; // compile project/target (if not attaching to a PID) if (!IsAttachedToProcess()) { // should we build to make sure project is up-to-date? if (!cbDebuggerCommonConfig::GetFlag(cbDebuggerCommonConfig::AutoBuild)) { m_WaitingCompilerToFinish = false; m_pCompiler = nullptr; return true; } // make sure the target is compiled PluginsArray plugins = Manager::Get()->GetPluginManager()->GetCompilerOffers(); if (plugins.GetCount()) m_pCompiler = (cbCompilerPlugin*)plugins[0]; else m_pCompiler = nullptr; if (m_pCompiler) { // is the compiler already running? if (m_pCompiler->IsRunning()) { Log(_("Compiler in use...")); Log(_("Aborting debugging session")); cbMessageBox(_("The compiler is currently in use. Aborting debugging session..."), _("Compiler running"), wxICON_WARNING); return false; } Log(_("Building to ensure sources are up-to-date")); m_WaitingCompilerToFinish = true; m_pCompiler->Build(); // now, when the build is finished, DoDebug will be launched in OnCompilerFinished() } } return true; }