public void MakeSureDocumentIsVisible(XabslDocument doc) { if (_curTab.doc == null || !_curTab.doc.Equals(doc)) { int foundAt = -1; int i = 0; foreach (Tab tab in _tabs) { if (tab.doc != null && tab.doc.Equals(doc)) { foundAt = i; break; } i++; } if (foundAt >= 0) { ShowTab(foundAt); } else { CreateNewTab(); openDocument(doc.File.FullName); } } }
private void showSelectedError() { TreeNode node = treeViewErrors.SelectedNode; TreeNode errorNode = node; // sub-node? if (node.Level == 1) { errorNode = node.Parent; } int i = errorNode.Index; ErrorEntry error = _errorList.Errors[i]; // show XabslDocument doc = new XabslDocument(error.file, _curBehavior, _appPath + "\\" + Properties.Settings.Default.CacheDir); MakeSureDocumentIsVisible(doc); // goto line if (error.line > -1 && error.line < _curTab.view.LineCount) { int pos = _curTab.view.PositionFromLine(error.line-1); _curTab.view.GotoPos(pos); _curTab.view.SetSel(pos, pos + _curTab.view.GetLine(error.line-1).Length - 1); } else { _curTab.view.SetSel(0, 0); } }
private void findOptionsAndSymbols() { try { // AGENT.XABSL AND SYMBOLS // dropDownButtonAgent.DropDownItems.Clear(); if (_curBehavior != null) { dropDownButtonAgent.DropDownItems.Add(new ToolStripMenuItem(_curBehavior.Agent.Name, null, new EventHandler(optionItem_Activate), _curBehavior.Agent.FullName)); ToolStripMenuItem symbols = new ToolStripMenuItem("Symbols"); _curBehavior.FindAvailableSymbols(); foreach (FileInfo f in _curBehavior.Symbols) { ToolStripMenuItem item = new ToolStripMenuItem(f.Name, null, new EventHandler(optionItem_Activate), f.FullName); symbols.DropDownItems.Add(item); } dropDownButtonAgent.DropDownItems.Add(symbols); } // OPTIONS // // delete old entries dropDownButtonOption.DropDownItems.Clear(); if (_curBehavior.Options != null) { _curBehavior.FindAvailableOptions(); } foreach (FileInfo f in _curBehavior.Options) { XabslDocument doc = new XabslDocument(f.FullName, _curBehavior, _appPath + "\\" + Properties.Settings.Default.CacheDir); if (doc.ClassLoadedSuccessfully) { if (doc.IsTopOption) { dropDownButtonOption.DropDownItems.Add(new ToolStripMenuItem(doc.OptionName + XabslDocument.XabslEnding, null, new EventHandler(optionItem_Activate), doc.FullPath.FullName + "\\" + doc.OptionName + XabslDocument.XabslEnding)); } else { ToolStripMenuItem item = new ToolStripMenuItem(doc.OptionName + XabslDocument.XabslEnding, null, new EventHandler(optionItem_Activate), doc.FullPath.FullName + "\\" + doc.OptionName + XabslDocument.XabslEnding); ToolStripMenuItem parent = insertOption(doc.FullPath); parent.DropDownItems.Add(item); } } } } catch (Exception exc) { ExceptionDialog.ShowError(exc); } }
private void listBoxResults_DoubleClick(object sender, EventArgs e) { if(listBoxResults.SelectedItem.ToString().Equals("")) return; XabslDocument doc = new XabslDocument(listBoxResults.SelectedItem.ToString(), _behavior, null); _view.MakeSureDocumentIsVisible(doc); }
public Tab(XabslDocument doc, Control parent, string xabslStyleFile) { this.doc = doc; this.view = new Scintilla.ScintillaControl(); this._parent = parent; backOptions = new List<string>(); forwardOptions = new List<string>(); wasSaved = true; try { Scintilla.Configuration.ConfigurationUtility cu = new Scintilla.Configuration.ConfigurationUtility(GetType().Module.Assembly); Scintilla.Configuration.Scintilla conf = (Scintilla.Configuration.Scintilla)cu.LoadConfiguration( xabslStyleFile); view.Configuration = conf; view.ConfigurationLanguage = "xabsl"; // show line-numbers view.SetMarginWidthN(0, 30); // no codefolding yet view.SetMarginWidthN(1, 0); // tabs with spaces and width of 2 view.TabWidth = 2; view.IsUseTabs = false; // indent view.Indent = 2; view.IsIndentationGuides = true; // don't use these keys view.AddIgnoredKey(Shortcut.CtrlO); view.AddIgnoredKey(Shortcut.CtrlS); view.AddIgnoredKey(Shortcut.F5); view.AddIgnoredKey(Keys.Space, Keys.Control); view.AddIgnoredKey(Shortcut.CtrlZ); view.AddIgnoredKey(Shortcut.CtrlY); view.AddIgnoredKey(Shortcut.CtrlB); view.AddIgnoredKey(Shortcut.CtrlF); view.AddIgnoredKey(Shortcut.CtrlShiftF); view.AddIgnoredKey(Shortcut.CtrlN); view.AddIgnoredKey(Shortcut.CtrlI); view.AddIgnoredKey(Shortcut.CtrlT); view.AddIgnoredKey(Shortcut.CtrlW); view.AddIgnoredKey(Shortcut.Ctrl7); view.AddIgnoredKey(Shortcut.Ctrl8); view.AddIgnoredKey(Shortcut.F6); view.AddIgnoredKey(Shortcut.F7); view.AddIgnoredKey(Shortcut.F8); view.AddIgnoredKey(Shortcut.F9); // autocompletion view.AutoCSeparator = (int)'\n'; view.IsAutoCGetAutoHide = false; view.IsAutoCGetIgnoreCase = true; // line wrap view.WrapMode = (int)Scintilla.Enums.Wrap.word; view.WrapVisualFlags = (int)Scintilla.Enums.WrapVisualFlag.end; } catch (Exception e) { ExceptionDialog.ShowError(e); } _parent.Controls.Clear(); _parent.Controls.Add(view); view.Dock = DockStyle.Fill; }