private void scintillaControl_UpdateUI(object sender, UpdateUIEventArgs e) { // Has the caret changed position? var caretPosition = _scintillaControl.CurrentPosition; if (_lastCaretPosition != caretPosition) { _lastCaretPosition = caretPosition; BraceInfo braceInfo = GetCurrentBraceInfo(); if (braceInfo != null) { int bracePosition2 = _scintillaControl.BraceMatch(braceInfo.Position); if (bracePosition2 == Scintilla.InvalidPosition) { _scintillaControl.BraceBadLight(braceInfo.Position); } else { _scintillaControl.BraceHighlight(braceInfo.Position, bracePosition2); } } else { _scintillaControl.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); } } }
private void NoteEdit_UpdateUI(object sender, UpdateUIEventArgs e) { if (e.Change == UpdateChange.VScroll) { VM.OnScroll(NoteEdit.FirstVisibleLine); } }
private void NoteEdit_UpdateUI(object sender, UpdateUIEventArgs e) { if (e.Change == UpdateChange.VScroll || e.Change == UpdateChange.Selection) { VM.OnScroll(NoteEdit.FirstVisibleLine, NoteEdit.CurrentPosition); } }
private void ScintillaUpdateUi(object sender, UpdateUIEventArgs e) { if (!this.Editor.IsEnabled) { this.LineBox.Text = "Ln 0, Col 0"; } else { var pos = this.Editor.CurrentPosition; var line = this.Editor.LineFromPosition(pos); var col = this.Editor.GetColumn(pos); this.LineBox.Text = $"Ln {line + 1}, Col {col + 1}"; } // Did the number of characters in the line number display change? // i.e. nnn VS nn, or nnnn VS nn, etc... var charLength = this.Editor.Lines.Count.ToString().Length; if (charLength == this.maxLineNumberCharLength) { return; } // Calculate the width required to display the last line number // and include some padding for good measure. const int LinePadding = 2; this.Editor.Margins[0].Width = this.Editor.TextWidth(ScintillaNET.Style.LineNumber, new string('9', charLength + 1)) + LinePadding; this.maxLineNumberCharLength = charLength; }
// handle caret position change - highlight current function private void scintilla_UpdateUI(object sender, UpdateUIEventArgs e) { if (e.Change == UpdateChange.Content || changed) { return; } syntaxIndicators(); }
private void PrintPosition(object sender, UpdateUIEventArgs e) { ScintillaXml sc = sender as ScintillaXml; int pos = sc.GetColumn(sc.CurrentPosition) + 1; int line = sc.CurrentLine + 1; posLabel.Text = "| Line " + line.ToString() + ", Col " + pos.ToString(); }
private void CEditor_Main_UpdateUI(object sender, UpdateUIEventArgs e) { if (e.Change == UpdateChange.VScroll) { UpdateStatusPanel(); } EditorStatusUpdated?.Invoke(this, EventArgs.Empty); }
private void scintilla1_UpdateUI(object sender, UpdateUIEventArgs e) { if ((e.Change & UpdateChange.Selection) > 0) { if (OnSelectionChanged != null) { OnSelectionChanged(this, e); } } }
private void OnUpdateUI(object sender, UpdateUIEventArgs e) { if ((e.Change & UpdateChange.Selection) > 0) { if (MainWindow.highlightAll) { sbDocument.searchManager.HighLight(textArea.SelectedText); } } }
//--------------------------------------------------------------------- // Обработчик события 'UpdateUI'. // - Выводит положение курсора (также отрабатывает от мышки). // - Выводит подсветку парных скобок. //--------------------------------------------------------------------- private void scintilla1_UpdateUI(object sender, UpdateUIEventArgs e) { //------------------------------------------------------- // вывод в статусбаре положение курсора //------------------------------------------------------- toolStripStatusLabel1.Text = "Line: " + Convert.ToString(scintilla1.CurrentLine + 1) + ", Col: " + Convert.ToString(scintilla1.GetColumn(scintilla1.CurrentPosition) + 1); //------------------------------------------------------- // подсветка парных скобок //------------------------------------------------------- // Has the caret changed position? var caretPos = scintilla1.CurrentPosition; if (lastCaretPos != caretPos) { lastCaretPos = caretPos; var bracePos1 = -1; var bracePos2 = -1; // Is there a brace to the left or right? if (caretPos > 0 && IsBrace(scintilla1.GetCharAt(caretPos - 1))) { bracePos1 = (caretPos - 1); } else if (IsBrace(scintilla1.GetCharAt(caretPos))) { bracePos1 = caretPos; } if (bracePos1 >= 0) { // Find the matching brace bracePos2 = scintilla1.BraceMatch(bracePos1); if (bracePos2 == Scintilla.InvalidPosition) { scintilla1.BraceBadLight(bracePos1); scintilla1.HighlightGuide = 0; // верт. линии отступов } else { scintilla1.BraceHighlight(bracePos1, bracePos2); // подсветить этим методом две позиции скобки scintilla1.HighlightGuide = scintilla1.GetColumn(bracePos1); // верт. линии отступов } } else { // Turn off brace matching scintilla1.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); // подсветить этим методом не парную скобку ? scintilla1.HighlightGuide = 0; // верт. линии отступов } } } //scintilla1_UpdateUI
private int _errorLine; // If Cursor still in error line -> keep caret line background as red private void OnCursorChanged(object sender, UpdateUIEventArgs e) { if (_isGotoHappenned || ScintillaEditor.CurrentLine == _errorLine) { _isGotoHappenned = false; return; } ScintillaEditor.CaretLineBackColor = Color.Gray; ScintillaEditor.CaretLineBackColorAlpha = 50; ScintillaEditor.UpdateUI -= OnCursorChanged; }
/// <summary> /// Called if the editor's text or styling have changed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TxtEditor_OnUpdateUI(object sender, UpdateUIEventArgs e) { if ((e.Change & UpdateChange.Selection) != 0 || (e.Change & UpdateChange.Content) != 0) { var pos = this.TxtEditor.CurrentPosition; var line = this.TxtEditor.LineFromPosition(pos); var col = (pos - this.TxtEditor.Lines[line].Position); this.LblCurLine.Text = "Line " + (line + 1); this.LblCurCol.Text = "Col " + (col + 1); } }
void CodeEditor_UpdateUI(object sender, UpdateUIEventArgs e) { updateLinesAndColumnsView(); checkSavedStatus(); for (int i = 0; i < this.Lines.Count; i++) { this.Lines[i].MarkerDelete(3); } var line = this.Lines[this.getCurrentRow()]; line.MarkerAdd(3); }
private void scintilla_UpdateUI(object sender, UpdateUIEventArgs e) { // Has the caret changed position? var caretPos = scintilla.CurrentPosition; if (lastCaretPos != caretPos) { lastCaretPos = caretPos; var bracePos1 = -1; var bracePos2 = -1; // Is there a brace to the left or right? if (caretPos > 0 && IsBrace(scintilla.GetCharAt(caretPos - 1))) { bracePos1 = (caretPos - 1); } else if (IsBrace(scintilla.GetCharAt(caretPos))) { bracePos1 = caretPos; } if (bracePos1 >= 0) { // Find the matching brace bracePos2 = scintilla.BraceMatch(bracePos1); if (bracePos2 == Scintilla.InvalidPosition) { scintilla.BraceBadLight(bracePos1); scintilla.HighlightGuide = 0; } else { scintilla.BraceHighlight(bracePos1, bracePos2); scintilla.HighlightGuide = scintilla.GetColumn(bracePos1); } } else { // Turn off brace matching scintilla.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); scintilla.HighlightGuide = 0; } if ((e.Change & UpdateChange.Selection) > 0) { // The caret/selection changed var currentPos = scintilla.CurrentPosition; var anchorPos = scintilla.AnchorPosition; tsCaretPosition.Text = "Ch: " + currentPos + " Sel: " + Math.Abs(anchorPos - currentPos); } } }
/// <summary>on change event to capture the current cursor position to display on gui elsewhere</summary> /// <param name="sender"> </param> /// <param name="e"> </param> public void scintilla_UpdateUI(object sender, UpdateUIEventArgs e) { Scintilla sci = ((Scintilla)sender); if ((e.Change & UpdateChange.Selection) > 0) { // The caret/selection changed var currentPos = sci.CurrentPosition; var anchorPos = sci.AnchorPosition; var wrd = sci.GetWordFromPosition(currentPos); //toolStripStatusLabel.Text = "Ch: " + currentPos + " Sel: " + Math.Abs(anchorPos - currentPos); //StatusBar("Ch: " + currentPos + " Sel: " + Math.Abs(anchorPos - currentPos) + " Word = " + wrd); } }
private void OnScintillaUpdateUi(object sender, UpdateUIEventArgs e) { if (!this.Editor.IsEnabled) { this.LineBox.Text = "Ln 0, Col 0"; } else { var pos = this.Editor.CurrentPosition; var line = this.Editor.LineFromPosition(pos); var col = this.Editor.GetColumn(pos); this.LineBox.Text = $"Ln {line + 1}, Col {col + 1}"; } }
/// <summary> /// manages Brace highlighting /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void TextArea_UpdateUI(object sender, UpdateUIEventArgs e) { // Has the caret changed position? var caretPos = TextArea.CurrentPosition; if (lastCaretPos != caretPos) { UpdateStatusEventArgs evt = new UpdateStatusEventArgs(); evt.Text = "Pos: " + caretPos.ToString(); FireUpdateStatus(this, evt); lastCaretPos = caretPos; var bracePos1 = -1; var bracePos2 = -1; //TODO Brace higligthing not working or overridden by Lexer?? // Is there a brace to the left or right? if (caretPos > 0 && IsBrace(TextArea.GetCharAt(caretPos - 1))) { bracePos1 = (caretPos - 1); } else if (IsBrace(TextArea.GetCharAt(caretPos))) { bracePos1 = caretPos; } if (bracePos1 >= 0) { // Find the matching brace bracePos2 = TextArea.BraceMatch(bracePos1); if (bracePos2 == Scintilla.InvalidPosition) { TextArea.BraceBadLight(bracePos1); TextArea.HighlightGuide = 0; } else { TextArea.BraceHighlight(bracePos1, bracePos2); TextArea.HighlightGuide = TextArea.GetColumn(bracePos1); } } else { // Turn off brace matching TextArea.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); TextArea.HighlightGuide = 0; } } }
//Evenement déclenché quand une nouvelle forme ou instruction est reçue par le client private void UpdateUi(Object o, UpdateUIEventArgs eventArgs) { lock (forms) { switch (eventArgs.Type) { case "PATH": ColoredPath coloredPath = eventArgs.Path; forms.Add(coloredPath); break; case "CIRCLE": ColoredCircle coloredCircle = eventArgs.Circle; forms.Add(coloredCircle); break; case "LINE": ColoredLine coloredLine = eventArgs.Line; forms.Add(coloredLine); break; case "RECTANGLE": ColoredRectangle coloredRectangle = eventArgs.Rectangle; forms.Add(coloredRectangle); break; case "CLEAR": forms.Clear(); break; case "SIZE": width = eventArgs.Width; height = eventArgs.Height; break; case "REQUEST_STATUS": asyncClient.RestoreWhiteboard(this.forms, eventArgs.client_id); break; case "RESTORE": forms = eventArgs.Forms; break; } View.InvalidateSurface(); } }
private void codeBox_UpdateUI(object sender, UpdateUIEventArgs e) { const string openBraces = "([{"; const string closeBraces = ")]}"; var caretPos = _codeBox.CurrentPosition; if (caretPos != _lastCaretPos) { int lastLine = _codeBox.LineFromPosition(_lastCaretPos); int currentLine = _codeBox.LineFromPosition(caretPos); _codeBox.MarkerDeleteAll(3); if (_highlightLine) { _codeBox.Lines[currentLine].MarkerAdd(3); } char charBefore = (char)_codeBox.GetCharAt(caretPos - 1); char charAfter = (char)_codeBox.GetCharAt(caretPos); int brace1Pos = Scintilla.InvalidPosition; if (closeBraces.Contains(charBefore)) { brace1Pos = caretPos - 1; } else if (openBraces.Contains(charAfter)) { brace1Pos = caretPos; } if (brace1Pos != Scintilla.InvalidPosition) { int brace2Pos = _codeBox.BraceMatch(brace1Pos); if (brace2Pos != Scintilla.InvalidPosition) { _codeBox.BraceHighlight(brace1Pos, brace2Pos); } else { _codeBox.BraceBadLight(brace1Pos); } } else { _codeBox.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); } _lastCaretPos = caretPos; } }
private void ScintillaUpdateUi(object sender, UpdateUIEventArgs e) { // Did the number of characters in the line number display change? // i.e. nnn VS nn, or nnnn VS nn, etc... var charLength = this.Editor.Lines.Count.ToString().Length; if (charLength == this.maxLineNumberCharLength) { return; } // Calculate the width required to display the last line number // and include some padding for good measure. const int LinePadding = 2; this.Editor.Margins[0].Width = this.Editor.TextWidth(ScintillaNET.Style.LineNumber, new string('9', charLength + 1)) + LinePadding; this.maxLineNumberCharLength = charLength; }
private void SymbolicTextBox_UpdateUI(object sender, UpdateUIEventArgs e) { // Has the selection changed position? var selectionPos = SelectionStart; if (lastSelectionPos != selectionPos) { lastSelectionPos = selectionPos; var bracePos1 = -1; var bracePos2 = -1; if (selectionPos > 0 && IsBraceRight(GetCharAt(selectionPos - 1))) { // Select the brace to the immediate left bracePos1 = selectionPos - 1; } else if (IsBraceLeft(GetCharAt(selectionPos))) { // Select the brace to the immediate right bracePos1 = selectionPos; } if (bracePos1 >= 0) { // Find the matching brace bracePos2 = BraceMatch(bracePos1); if (bracePos2 == InvalidPosition) { BraceBadLight(bracePos1); HighlightGuide = 0; } else { BraceHighlight(bracePos1, bracePos2); HighlightGuide = GetColumn(bracePos1); } } else { // Turn off brace matching BraceHighlight(InvalidPosition, InvalidPosition); HighlightGuide = 0; } } }
private void scnOutput_UpdateUI(object sender, UpdateUIEventArgs e) { // Has the caret changed position? var caretPos = scnOutput.CurrentPosition; if (_lastCaretPos != caretPos) { _lastCaretPos = caretPos; var bracePos1 = -1; var bracePos2 = -1; // Is there a brace to the left or right? if (caretPos > 0 && IsBrace(scnOutput.GetCharAt(caretPos - 1))) { bracePos1 = (caretPos - 1); } else if (IsBrace(scnOutput.GetCharAt(caretPos))) { bracePos1 = caretPos; } if (bracePos1 >= 0) { // Find the matching brace bracePos2 = scnOutput.BraceMatch(bracePos1); if (bracePos2 == Scintilla.InvalidPosition) { scnOutput.BraceBadLight(bracePos1); scnOutput.HighlightGuide = 0; } else { scnOutput.BraceHighlight(bracePos1, bracePos2); scnOutput.HighlightGuide = scnOutput.GetColumn(bracePos1); } } else { // Turn off brace matching scnOutput.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); scnOutput.HighlightGuide = 0; } } }
//mxd private void scintilla_OnUpdateUI(object sender, UpdateUIEventArgs e) { Scintilla s = sender as Scintilla; if (s != null) { // Update caret position info [line] : [caret pos start] OR [caret pos start x selection length] ([total lines]) positionlabel.Text = (s.CurrentLine + 1) + " : " + (s.SelectionStart + 1 - s.Lines[s.LineFromPosition(s.SelectionStart)].Position) + (s.SelectionStart != s.SelectionEnd ? "x" + (s.SelectionEnd - s.SelectionStart) : "") + " (" + s.Lines.Count + ")"; // Update copy-paste buttons buttoncut.Enabled = (s.SelectionEnd > s.SelectionStart); buttoncopy.Enabled = (s.SelectionEnd > s.SelectionStart); buttonpaste.Enabled = s.CanPaste; buttonunindent.Enabled = s.Lines[s.CurrentLine].Indentation > 0; } }
private void Scintilla_UpdateUI(object sender, UpdateUIEventArgs e) { var caretPos = Scintilla.CurrentPosition; if (_lastCaretPos == caretPos) { return; } _lastCaretPos = caretPos; var openingBracePos = -1; if (caretPos > 0 && IsBrace(Scintilla.GetCharAt(caretPos - 1))) { openingBracePos = caretPos - 1; } else if (IsBrace(Scintilla.GetCharAt(caretPos))) { openingBracePos = caretPos; } if (openingBracePos != -1) { var closingBracePos = Scintilla.BraceMatch(openingBracePos); if (closingBracePos == Scintilla.InvalidPosition) { Scintilla.BraceBadLight(openingBracePos); Scintilla.HighlightGuide = 0; } else { Scintilla.BraceHighlight(openingBracePos, closingBracePos); Scintilla.HighlightGuide = Scintilla.GetColumn(openingBracePos); } } else { Scintilla.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); Scintilla.HighlightGuide = 0; } }
private void scriptedit_UpdateUI(object sender, UpdateUIEventArgs e) { UpdateWordHighlight(); // Has the caret changed position? int caretpos = scriptedit.CurrentPosition; if (lastcaretpos != caretpos) { lastcaretpos = caretpos; int bracepos1 = -1; // Is there a brace to the left or right? if (caretpos > 0 && bracechars.Contains((char)scriptedit.GetCharAt(caretpos - 1))) { bracepos1 = (caretpos - 1); } else if (bracechars.Contains((char)(scriptedit.GetCharAt(caretpos)))) { bracepos1 = caretpos; } if (bracepos1 > -1) { // Find the matching brace int bracepos2 = scriptedit.BraceMatch(bracepos1); if (bracepos2 == Scintilla.InvalidPosition) { scriptedit.BraceBadLight(bracepos1); } else { scriptedit.BraceHighlight(bracepos1, bracepos2); } } else { // Turn off brace matching scriptedit.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); } } }
private void OnScintillaUpdateUi(object sender, UpdateUIEventArgs e) { if (!(this.DataContext is EditorTabViewModel vm)) { return; } if (!this.Editor.IsEnabled) { vm.StatusText = "Ln 0, Col 0"; } else { var pos = this.Editor.CurrentPosition; var line = this.Editor.LineFromPosition(pos); var col = this.Editor.GetColumn(pos); vm.StatusText = $"Ln {line + 1}, Col {col + 1}"; } }
protected override void OnUpdateUI(UpdateUIEventArgs e) { if ((e.Change & UpdateChange.HScroll) != 0) { int xOff = base.XOffset; int width = base.ScrollWidth - base.ClientSize.Width; if (xOff > width) { int left = xOff + base.PointXFromPosition(base.Lines[base.LineFromPosition(base.TextLength)].Position); width += left + 2; } if (xOff > width) { base.XOffset = width; } } base.OnUpdateUI(e); }
//Brace Matching private void BraceMatching_UpdateUI(object sender, UpdateUIEventArgs e) { if (_styler != null && _styler.BraceMatching) { var caretPos = CurrentPosition; if (_lastCaretPos != caretPos) { _lastCaretPos = caretPos; var bracePos1 = -1; // Is there a brace to the left or right? if (caretPos > 0 && _styler.IsBrace(GetCharAt(caretPos - 1))) { bracePos1 = (caretPos - 1); } else if (_styler.IsBrace(GetCharAt(caretPos))) { bracePos1 = caretPos; } if (bracePos1 >= 0) { // Find the matching brace var bracePos2 = BraceMatch(bracePos1); if (bracePos2 == ScintillaNET.Scintilla.InvalidPosition) { BraceBadLight(bracePos1); } else { BraceHighlight(bracePos1, bracePos2); } } else { // Turn off brace matching BraceHighlight(ScintillaNET.Scintilla.InvalidPosition, ScintillaNET.Scintilla.InvalidPosition); } } } }
private void Scintilla_UpdateUI(object sender, UpdateUIEventArgs e) { // (C): https://github.com/jacobslusser/ScintillaNET/wiki/Brace-Matching // Has the caret changed position? var caretPos = scintillaScript.CurrentPosition; if (lastCaretPos != caretPos) { lastCaretPos = caretPos; var bracePos1 = -1; // Is there a brace to the left or right? if (caretPos > 0 && IsBrace(scintillaScript.GetCharAt(caretPos - 1))) { bracePos1 = (caretPos - 1); } else if (IsBrace(scintillaScript.GetCharAt(caretPos))) { bracePos1 = caretPos; } if (bracePos1 >= 0) { // Find the matching brace var bracePos2 = scintillaScript.BraceMatch(bracePos1); if (bracePos2 == Scintilla.InvalidPosition) { scintillaScript.BraceBadLight(bracePos1); } else { scintillaScript.BraceHighlight(bracePos1, bracePos2); } } else { // Turn off brace matching scintillaScript.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); } } }
private void sqlEditor_UpdateUI(object sender, UpdateUIEventArgs e) { // Has the caret changed position? var caretPos = editor.CurrentPosition; if (lastCaretPos != caretPos) { lastCaretPos = caretPos; var bracePos1 = -1; var bracePos2 = -1; // Is there a brace to the left or right? if (caretPos > 0 && IsBrace(editor.GetCharAt(caretPos - 1))) { bracePos1 = (caretPos - 1); } else if (IsBrace(editor.GetCharAt(caretPos))) { bracePos1 = caretPos; } if (bracePos1 >= 0) { // Find the matching brace bracePos2 = editor.BraceMatch(bracePos1); if (bracePos2 == Scintilla.InvalidPosition) { editor.BraceBadLight(bracePos1); } else { editor.BraceHighlight(bracePos1, bracePos2); } } else { // Turn off brace matching editor.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); } } }