public void GuiInvalidate(int x, int y, int w, int h) { if (w == 1) { // cursor update needs more bits to avoid artefacts if (x > 0) { --x; ++w; } if (x + w < Cols) { ++w; } } RuntimeRepl.GuiInvoke(new Action(() => { var screen = new Rectangle(0, 0, Cols, Rows); var dirty = new Rectangle(x, y, w, h); dirty.Intersect(screen); var bounds = new Rectangle(dirty.Left * CharWidth, dirty.Top * LineHeight, dirty.Width * CharWidth, dirty.Height * LineHeight); Invalidate(bounds); })); }
public void GuiUpdateVertScrollBarPos() { RuntimeRepl.GuiInvoke(new Action(() => { if (VertScrollBar != null) { VertScrollBar.Value = 0; VertScrollBar.Maximum = Window.BufferHeight - 1; VertScrollBar.Value = Window.WindowTop; } })); }
public void GuiUpdateHoriScrollBarPos() { RuntimeRepl.GuiInvoke(new Action(() => { if (HoriScrollBar != null) { HoriScrollBar.Value = 0; HoriScrollBar.Maximum = Window.BufferWidth - 1; HoriScrollBar.Value = Window.WindowLeft; } })); }
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; }
public TextWindowCreateArgs(CommandLineOptions options) { // // Called for REPL window // Left = -1; Top = -1; Width = options.Width; Height = options.Height; BufferWidth = Math.Max(Width, options.BufferWidth); BufferHeight = Math.Max(Height, options.BufferHeight); ForeColor = RuntimeRepl.MakeColor(options.ForeColor); BackColor = RuntimeRepl.MakeColor(options.BackColor); Caption = "Kiezellisp"; Visible = true; Resizable = true; Scrollable = true; CodeCompletion = true; HtmlPrefix = options.HtmlPrefix; Owned = false; Border = true; OnCloseFunction = null; }
public TextWindowCreateArgs(object[] args) { // // Called for non-REPL windows // var dict = new Prototype(args); var defaults = (TextWindow)(dict["defaults"] ?? RuntimeRepl.StdScr); var shiftRight = 5; var shiftDown = 3; Left = (int)(dict["left"] ?? defaults.ScreenLeft + shiftRight); Top = (int)(dict["top"] ?? defaults.ScreenTop + shiftDown); Width = (int)(dict["width"] ?? defaults.WindowWidth); Height = (int)(dict["height"] ?? defaults.WindowHeight); BufferWidth = (int)(dict["buffer-width"] ?? dict["width"] ?? defaults.BufferWidth); BufferHeight = (int)(dict["buffer-height"] ?? dict["height"] ?? defaults.BufferHeight); BufferWidth = Math.Max(Width, BufferWidth); BufferHeight = Math.Max(Height, BufferHeight); ForeColor = RuntimeRepl.MakeColor(dict["fore-color"] ?? defaults.ForeColor); BackColor = RuntimeRepl.MakeColor(dict["back-color"] ?? defaults.BackColor); Caption = (string)dict["caption"]; Visible = (bool)(dict["visible"] ?? true); Resizable = (bool)(dict["resizable"] ?? true); Scrollable = Resizable || (bool)(dict["scrollable"] ?? true); CodeCompletion = (bool)(dict["code-completion"] ?? false); HtmlPrefix = (string)(dict["html-prefix"] ?? defaults.HtmlPrefix); Owned = (bool)(dict["owned"] ?? false); Border = (bool)(dict["border"] ?? true); OnCloseFunction = (IApply)(dict["on-close"] ?? null); if (!Border) { Resizable = Scrollable = false; BufferWidth = Width; BufferHeight = Height; } }
public void GuiInvalidate() { RuntimeRepl.GuiInvoke(new Action(Invalidate)); }
public void GuiBringToFront() { RuntimeRepl.GuiInvoke(new Action(ParentForm.BringToFront)); }
public static TextWindow Open(params object[] args) { var createArgs = new TextWindowCreateArgs(args); return(RuntimeRepl.OpenWindow(createArgs)); }
public void Close() { RuntimeRepl.CloseWindow(this); }