public static void SetKeywordInfo(KeywordInfo KI) { ki = KI; }
public QTextBox(Font Font, StringComparer Comparer) { InitializeComponent(); // NOP this.SuspendLayout(); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Name = "QTextBox"; this.DoubleBuffered = true; this.BackColor = Color.White; FontInfo.SetFont(Font); ki = new KeywordInfo(comparer = Comparer); SubLine.SetKeywordInfo(ki); Line.SetKeywordInfo(ki); currentView = new View(new Document(4), this); curDoc = currentView.Document; EventManager.ViewChanged += () => { vsb.SetValue(currentView.FirstVisibleLine); this.Invalidate(); }; EventManager.DocumentChanged += () => { if (DocumentChanged != null) { DocumentChanged.Invoke(this, EventArgs.Empty); } }; EventManager.CaretLocationChanged += () => { if (CaretLocationChanged != null) { CaretLocationChanged.Invoke(currentView.CaretDocLoc); } }; EventManager.SelectionChanged += () => { if (SelectionChanged != null) { SelectionChanged.Invoke(this, EventArgs.Empty); } }; EventManager.NumLinesChanged += updateMaxLinesChanged; EventManager.LongestLineChanged += updateForLongestLine; vsb = new QVScrollBar(SCROLL_BAR_WIDTH); this.Controls.Add(vsb); vsb.ValChanged += (e) => { switch (e.Delta) { case -1: if (!currentView.ScrollView(-1)) { e.Accept = false; } break; case 1: if (!currentView.ScrollView(1)) { e.Accept = false; } break; default: currentView.FirstVisibleLine = vsb.Value; break; } }; hsb = new QHScrollBar(SCROLL_BAR_WIDTH); this.Controls.Add(hsb); hsb.ValueChanged += (s, e) => { currentView.FirstVisibleColumn = hsb.Value; this.Invalidate(); }; hsb.Visible = false; this.ResumeLayout(false); ViewEnvironment.NumColumnsPerLineChanged += setMetrics; FontInfo.FontMetricsChanged += setMetrics; EventManager.DocumentChangedChanged += () => { if (this.DocumentChangedChanged != null) { DocumentChangedChanged.Invoke(this, EventArgs.Empty); } }; this.Size = new System.Drawing.Size(492, 313); }