示例#1
0
        private void AddTask(ScintillaControl sci, TreeNode parent, TaskItem task)
        {
            var txt = sci.GetTextRangeUnicode(task.Position, task.Position + task.Length).Trim(':', '-', '.', ' ', '\r', '\n');

            txt = !String.IsNullOrEmpty(txt) && txt.Length > 30 ? txt.Substring(0, 30) + "..." : txt;
            var tn = new TreeNode(String.Format("{0}: {1} ({2},{3})", task.Type.ToString().ToUpper(), txt,
                                                sci.GetLineFromPosition(task.Position) + 1, sci.GetColumnFromPosition(task.Position) + 1));

            tn.ImageKey = tn.SelectedImageKey = "Task";
            tn.Tag      = task;
            parent.Nodes.Add(tn);
        }
示例#2
0
 string ITextEditor.GetContent(Document doc, int start, int length)
 {
     if (doc == App.Document())
     {
         return(sci.GetTextRangeUnicode(start, start + length));
     }
     else
     {
         using (var sciTemp = new BasicScintillaControl())
         {
             sciTemp.AttachDocument(((TextDocument)doc).GetSciDocument());
             return(sciTemp.GetTextRangeUnicode(start, start + length));
         }
     }
 }
示例#3
0
        protected void SmartClear()
        {
            if (sci.ReadOnly)
            {
                Clear();
                return;
            }

            var text = String.Empty;

            if (lastLen != 0)
            {
                var p = sci.GetPositionFromLine(sci.LineCount - 1);
                sci.GetTextRangeUnicode(p, p + lastLen);
            }

            sci.SetText(text);
            sci.SetLineState(0, 0);
            sci.CurrentPosition = sci.GetTextLength();
        }