예제 #1
0
 internal TextWindow(TextControl parent, TextWindowCreateArgs args)
 {
     ParentControl = parent;
     ForeColor = args.ForeColor;
     BackColor = args.BackColor;
     HighlightForeColor = RuntimeRepl.DefaultHighlightForeColor;
     HighlightBackColor = RuntimeRepl.DefaultHighlightBackColor;
     ShadowBackColor = RuntimeRepl.DefaultShadowBackColor;
     Buffer = new TextBuffer(args.BufferWidth, args.BufferHeight, foreColor, backColor);
     CodeCompletion = args.CodeCompletion;
     HtmlPrefix = args.HtmlPrefix;
     HtmlSuffix = RuntimeRepl.GetSuffixFromPrefix(HtmlPrefix);
     TextWriter = TextWriter.Synchronized(new TextWindowTextWriter(this));
     InitEditHandlers();
     InitScrollHandlers();
     dirty = true;
     Style = 0;
     BufferMark = BufferBound = -1;
 }
예제 #2
0
 public void ResizeBuffer(int width, int height)
 {
     width = Math.Max(width, WindowWidth);
     height = Math.Max(height, WindowHeight);
     if (width != BufferWidth || height != BufferHeight)
     {
         var x = 0;
         var w = Math.Min(width, BufferWidth - x);
         var y = Math.Max(0, LastRow - height - 1);
         var h = Math.Min(height, BufferHeight - y);
         var buf = new TextBuffer(width, height, Buffer.ForeColor, Buffer.BackColor);
         buf.CopyRect(0, 0, Buffer, x, y, w, h);
         CursorPos = Rebase(x, y, width, height, CursorPos);
         homePos = Rebase(x, y, width, height, homePos);
         //caretPos = Rebase(x, y, width, height, caretPos);
         savedPos = Rebase(x, y, width, height, savedPos);
         LastPos = Rebase(x, y, width, height, LastPos);
         if (BufferMark != -1)
         {
             BufferMark = Rebase(x, y, width, height, BufferMark);
         }
         if (BufferBound != -1)
         {
             BufferBound = Rebase(x, y, width, height, BufferBound);
         }
         Buffer = buf;
         Refresh();
     }
 }
예제 #3
0
 public void Paste(int x, int y, TextBuffer buffer)
 {
     Buffer.Paste(x, y, buffer);
     Refresh();
 }
예제 #4
0
 public void Paste(int x, int y, TextBuffer src)
 {
     CopyRect(x, y, src, 0, 0, src.Width, src.Height);
 }
예제 #5
0
 public void CopyRect(int xdst, int ydst, TextBuffer bsrc, int x, int y, int w, int h)
 {
     w = Math.Min(Width - xdst, w);
     h = Math.Min(Height - ydst, h);
     CopyArray(Data, Width, xdst, ydst, bsrc.Data, bsrc.Width, x, y, w, h);
 }
예제 #6
0
 public TextBuffer Copy(int x, int y, int w, int h)
 {
     var buf = new TextBuffer(w, h, ForeColor, BackColor);
     buf.CopyRect(0, 0, this, x, y, w, h);
     return buf;
 }
예제 #7
0
 public void Paste(int x, int y, TextBuffer buffer)
 {
     Buffer.Paste(x, y, buffer);
     Refresh();
 }
예제 #8
0
 public void Paste(int x, int y, TextBuffer src)
 {
     CopyRect(x, y, src, 0, 0, src.Width, src.Height);
 }
예제 #9
0
 public void CopyRect(int xdst, int ydst, TextBuffer bsrc, int x, int y, int w, int h)
 {
     w = Math.Min(Width - xdst, w);
     h = Math.Min(Height - ydst, h);
     CopyArray(Data, Width, xdst, ydst, bsrc.Data, bsrc.Width, x, y, w, h);
 }