public void OpenDocument(Document doc) { var newDoc = (TextDocument)doc; sci.AttachDocument(newDoc.GetSciDocument()); try { sci.Select(); } catch { } sci.FistVisibleLine = newDoc.FirstVisibleLine; if (newDoc.Selections != null) { foreach (var s in newDoc.Selections) { sci.AddSelection(s.End, s.Start, s.Main); } } OnDocumentOpened((T)doc); }
public OutputControl() { InitializeComponent(); sci = new ScintillaControl(); sci.Dock = DockStyle.Fill; sci.MarginVisible = false; sci.ViewWhiteSpace = false; sci.IndentationGuides = false; sci.UseTabs = false; sci.AttachDocument(sci.CreateDocument()); sci.ReadOnly = true; sci.UseUnicodeLexing = true; panel.Controls.Add(sci); }
private void TreeViewBeforeExpand(object sender, TreeViewCancelEventArgs e) { e.Node.Nodes.Clear(); var doc = e.Node.Tag as TextDocument; if (doc != null) { var sciDoc = doc.GetSciDocument(); using (var sci = new ScintillaControl()) { sci.AttachDocument(sciDoc); sci.GetAllBookmarks().ForEach(l => AddBookmark(sci, e.Node, l)); } } }
private void RemoveBookmark(TreeNode n) { if (n != null && n.Tag is Int32) { var i = (Int32)n.Tag; var doc = n.Parent.Tag as TextDocument; if (doc != null) { var sciDoc = doc.GetSciDocument(); using (var sciTemp = new ScintillaControl()) { sciTemp.AttachDocument(sciDoc); sciTemp.RemoveBookmark(i); } treeView.Nodes.Remove(n); } } }
private void TreeViewBeforeExpand(object sender, TreeViewCancelEventArgs e) { e.Node.Nodes.Clear(); var doc = e.Node.Tag as CodeDocument; if (doc != null) { var sciDoc = doc.GetSciDocument(); using (var sci = new ScintillaControl()) { sci.AttachDocument(sciDoc); var tp = service.GetTaskProvider(doc); if (tp != null) { var tasks = tp.GetTasks(doc); tasks.ForEach(t => AddTask(sci, e.Node, t)); } } } }