private void DoEditAction(IEditAction action) { if (action != null) { var area = txtEditor.ActiveTextAreaControl.TextArea; txtEditor.BeginUpdate(); try { lock (txtEditor.Document) { action.Execute(area); if (area.SelectionManager.HasSomethingSelected && area.AutoClearSelection /*&& caretchanged*/) { if (area.Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { area.SelectionManager.ClearSelection(); } } } } finally { txtEditor.EndUpdate(); area.Caret.UpdateCaretPosition(); } } }
bool ITextEditorExtension.KeyPress(Gdk.Key key, char ch, Gdk.ModifierType modifier) { Gdk.EventKey evnt = evntCopy; HideLanguageItemWindow(); bool res = false; IEditAction action = editactions.GetAction(evnt.Key, evnt.State); if (action != null) { action.PreExecute(this); if (action.PassToBase) { base.OnKeyPressEvent(evnt); } action.Execute(this); if (action.PassToBase) { base.OnKeyPressEvent(evnt); } action.PostExecute(this); res = true; } else { res = base.OnKeyPressEvent(evnt); } return(res); }
/// <summary> /// This method executes a dialog key /// </summary> public bool ExecuteDialogKey(Keys keyData) { // try, if a dialog key processor was set to use this if (DoProcessDialogKey != null && DoProcessDialogKey(keyData)) { return(true); } // if not (or the process was 'silent', use the standard edit actions IEditAction action = motherTextEditorControl.GetEditAction(keyData); AutoClearSelection = true; if (action != null) { BeginUpdate(); try { lock (Document) { action.Execute(this); if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/) { if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { SelectionManager.ClearSelection(); } } } } finally { EndUpdate(); Caret.UpdateCaretPosition(); } return(true); } return(false); }
public bool ExecuteDialogKey(Keys keyData) { if (this.DoProcessDialogKey != null && this.DoProcessDialogKey(keyData)) { return(true); } IEditAction editAction = this.motherTextEditorControl.GetEditAction(keyData); this.AutoClearSelection = true; if (editAction == null) { return(false); } this.BeginUpdate(); try { lock (this.Document) { editAction.Execute(this); if (this.SelectionManager.HasSomethingSelected && this.AutoClearSelection && this.Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { this.SelectionManager.ClearSelection(); } } } finally { this.EndUpdate(); this.Caret.UpdateCaretPosition(); } return(true); }
public void Edit(IEditAction editAction) { _redoStack.Clear(); if (_undoStack.TryPeek(out var previous) && previous.TryMerge(editAction)) { previous.Edit(); }
private static string GetReverseName(IEditAction editAction) { var name = editAction.Name ?? ""; if (name.StartsWith(ReverseActionPrefix)) { return(name.Substring(ReverseActionPrefix.Length)); } return(ReverseActionPrefix + name); }
private static string GetReverseName(IEditAction editAction) { var name = editAction.Name ?? ""; if (name.StartsWith(ReverseActionPrefix)) { return name.Substring(ReverseActionPrefix.Length); } return ReverseActionPrefix + name; }
public virtual void BeginEdit(IEditAction action) { EditWasCancelled = false; CurrentEditAction = action; if (IsEditing) { throw new InvalidOperationException("BeginEdit: Network already in editing state."); } IsEditing = true; }
/// <summary> /// Processes a dialog key. /// </summary> /// <param name="keyData">One of the <see cref="Keys"></see> values that represents the key to process.</param> /// <returns> /// true if the key was processed by the control; otherwise, false. /// </returns> protected override bool ProcessDialogKey(Keys keyData) { // Try, if a dialog key is handled by a subscriber of the DialogKeyPress event. KeyEventArgs keyEventArgs = new KeyEventArgs(keyData); OnDialogKeyPress(keyEventArgs); if (keyEventArgs.Handled) { return(true); } // if not (or the process was 'silent'), use the standard edit actions IEditAction action = _motherTextEditorControl.GetEditAction(keyData); AutoClearSelection = true; if (action != null) { BeginUpdate(); try { lock (Document) { action.Execute(this); if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/) { if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { SelectionManager.ClearSelection(); } } } } finally { EndUpdate(); } return(true); } return(base.ProcessDialogKey(keyData)); }
public object BuildItem(object caller, Codon codon, ArrayList subItems) { IEditAction editAction = (IEditAction)codon.AddIn.CreateObject(codon.Properties["class"]); string[] keys = codon.Properties["keys"].Split(','); Keys[] actionKeys = new Keys[keys.Length]; for (int j = 0; j < keys.Length; ++j) { string[] keydescr = keys[j].Split('|'); Keys key = (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[0], BindingFlags.GetField, null, System.Windows.Forms.Keys.Space, new object[0])); for (int k = 1; k < keydescr.Length; ++k) { key |= (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[k], BindingFlags.GetField, null, System.Windows.Forms.Keys.Space, new object[0])); } actionKeys[j] = key; } editAction.Keys = actionKeys; return(editAction); }
public void Add(IEditAction action) { throw new NotImplementedException(); }
/// <summary> /// Constructor /// </summary> /// <param name="oldAction">The old action to call if this action /// doesn't do anything.</param> public InsertClosingElement(IEditAction oldAction) { defaultAction = oldAction; }
public RepeatAction(IEditAction action) : base("Repeat " + action.Key) { m_action = new NoMacroRecordAction(action); // Ensure this action is never recorded. }
internal void RegisterAction(Keys k, IEditAction action) { editactions[k] = action; }
public void BeginEdit(IEditAction action) { function.BeginEdit(action); }
public void EndEdit() { CurrentEditAction = null; IsEditing = false; }
/// <summary> /// Executes the edit action. /// </summary> /// <param name="command">The command.</param> private void ExecuteIEditAction(IEditAction command) { command.Execute(codeEditorCtrl.ActiveTextAreaControl.TextArea); }
public void AddAction( IEditAction action ) { _actions.RemoveAllAfter( _currentAction ); _currentAction = _actions.AddAfter( _currentAction, action ); }
public NoMacroRecordAction(IEditAction action) { m_action = action; }
public EditableObjectMemento(IEditableObject editable, IEditAction editAction) { Editable = editable; EditAction = editAction; }
public void Add (IEditAction action) { actions.Add (action); }
public void BeginEdit(IEditAction action) { }
/// <summary> /// This method executes a dialog key /// </summary> public bool ExecuteDialogKey(Keys keyData) { // try, if a dialog key processor was set to use this if (DoProcessDialogKey != null && DoProcessDialogKey(keyData)) { return(true); } if (keyData == Keys.Back || keyData == Keys.Delete || keyData == Keys.Enter) { if (TextEditorProperties.UseCustomLine == true) { if (SelectionManager.HasSomethingSelected) { if (Document.CustomLineManager.IsReadOnly(SelectionManager.SelectionCollection[0], false)) { return(true); } } else { int curLineNr = Document.GetLineNumberForOffset(Caret.Offset); if (Document.CustomLineManager.IsReadOnly(curLineNr, false) == true) { return(true); } if ((Caret.Column == 0) && (curLineNr - 1 >= 0) && keyData == Keys.Back && Document.CustomLineManager.IsReadOnly(curLineNr - 1, false) == true) { return(true); } if (keyData == Keys.Delete) { LineSegment curLine = Document.GetLineSegment(curLineNr); if (curLine.Offset + curLine.Length == Caret.Offset && Document.CustomLineManager.IsReadOnly(curLineNr + 1, false) == true) { return(true); } } } } } // if not (or the process was 'silent', use the standard edit actions IEditAction action = motherTextEditorControl.GetEditAction(keyData); AutoClearSelection = true; if (action != null) { motherTextEditorControl.BeginUpdate(); try { lock (Document) { action.Execute(this); if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/) { if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { SelectionManager.ClearSelection(); } } } } finally { motherTextEditorControl.EndUpdate(); Caret.UpdateCaretPosition(); } return(true); } return(false); }
///////////////////////////////////////////////////////////////////////////////////////////////////// // NON-PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Binds data to the list. /// </summary> private void BindList() { string ClipboardCategory = "Clipboard / Undo"; string DeletionCategory = "Deletion"; string InsertionCategory = "Insertion"; string IntelliPromptCategory = "IntelliPrompt"; string MacroCategory = "Macro Recording"; string MiscellaneousCategory = "Miscellaneous"; string MovementCategory = "Movement"; string ScrollCategory = "Scroll"; string SearchCategory = "Search"; string SelectionCategory = "Selection"; EditActionData[] actionDataArray = new EditActionData[] { // Clipboard/undo new EditActionData() { Category = ClipboardCategory, Action = new CopyAndAppendToClipboardAction() }, new EditActionData() { Category = ClipboardCategory, Action = new CopyToClipboardAction() }, new EditActionData() { Category = ClipboardCategory, Action = new CutAndAppendToClipboardAction() }, new EditActionData() { Category = ClipboardCategory, Action = new CutLineToClipboardAction() }, new EditActionData() { Category = ClipboardCategory, Action = new CutToClipboardAction() }, new EditActionData() { Category = ClipboardCategory, Action = new PasteFromClipboardAction() }, new EditActionData() { Category = ClipboardCategory, Action = new RedoAction() }, new EditActionData() { Category = ClipboardCategory, Action = new ActiproSoftware.Windows.Controls.SyntaxEditor.EditActions.UndoAction() }, // Deletion new EditActionData() { Category = DeletionCategory, Action = new BackspaceAction() }, new EditActionData() { Category = DeletionCategory, Action = new BackspaceToPreviousWordAction() }, new EditActionData() { Category = DeletionCategory, Action = new DeleteAction() }, new EditActionData() { Category = DeletionCategory, Action = new DeleteBlankLinesAction() }, new EditActionData() { Category = DeletionCategory, Action = new DeleteHorizontalWhitespaceAction() }, new EditActionData() { Category = DeletionCategory, Action = new DeleteLineAction() }, new EditActionData() { Category = DeletionCategory, Action = new DeleteToLineEndAction() }, new EditActionData() { Category = DeletionCategory, Action = new DeleteToLineStartAction() }, new EditActionData() { Category = DeletionCategory, Action = new DeleteToNextWordAction() }, // Insertion new EditActionData() { Category = InsertionCategory, Action = new InsertLineBreakAction() }, new EditActionData() { Category = InsertionCategory, Action = new OpenLineAboveAction() }, new EditActionData() { Category = InsertionCategory, Action = new OpenLineBelowAction() }, new EditActionData() { Category = InsertionCategory, Action = new TypingAction("*Typing*", false) }, // IntelliPrompt new EditActionData() { Category = IntelliPromptCategory, Action = new RequestIntelliPromptAutoCompleteAction() }, new EditActionData() { Category = IntelliPromptCategory, Action = new RequestIntelliPromptCompletionSessionAction() }, new EditActionData() { Category = IntelliPromptCategory, Action = new RequestIntelliPromptParameterInfoSessionAction() }, new EditActionData() { Category = IntelliPromptCategory, Action = new RequestIntelliPromptQuickInfoSessionAction() }, // Macro new EditActionData() { Category = MacroCategory, Action = new CancelMacroRecordingAction() }, new EditActionData() { Category = MacroCategory, Action = new PauseResumeMacroRecordingAction() }, new EditActionData() { Category = MacroCategory, Action = new RunMacroAction() }, new EditActionData() { Category = MacroCategory, Action = new ToggleMacroRecordingAction() }, // Miscellaneous new EditActionData() { Category = MiscellaneousCategory, Action = new CapitalizeAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new CommentLinesAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new ConvertSpacesToTabsAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new ConvertTabsToSpacesAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new DuplicateAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new FormatDocumentAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new FormatSelectionAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new IndentAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new InsertTabStopOrIndentAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new MakeLowercaseAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new MakeUppercaseAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new MoveSelectedLinesDownAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new MoveSelectedLinesUpAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new OutdentAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new RemoveTabStopOrOutdentAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new ResetZoomLevelAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new TabifySelectedLinesAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new ToggleCharacterCasingAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new ToggleOverwriteModeAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new TransposeCharactersAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new TransposeLinesAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new TransposeWordsAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new TrimAllTrailingWhitespaceAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new TrimTrailingWhitespaceAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new UncommentLinesAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new UntabifySelectedLinesAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new ZoomInAction() }, new EditActionData() { Category = MiscellaneousCategory, Action = new ZoomOutAction() }, // Movement new EditActionData() { Category = MovementCategory, Action = new MoveDownAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveLeftAction() }, new EditActionData() { Category = MovementCategory, Action = new MovePageDownAction() }, new EditActionData() { Category = MovementCategory, Action = new MovePageUpAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveRightAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToDocumentEndAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToDocumentStartAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToLineEndAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToLineStartAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToLineStartAfterIndentationAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToMatchingBracketAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToNextLineStartAfterIndentationAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToNextWordAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToPreviousLineStartAfterIndentationAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToPreviousWordAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToVisibleBottomAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveToVisibleTopAction() }, new EditActionData() { Category = MovementCategory, Action = new MoveUpAction() }, // Scroll new EditActionData() { Category = ScrollCategory, Action = new ScrollDownAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollLeftAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollLineToVisibleBottomAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollLineToVisibleMiddleAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollLineToVisibleTopAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollPageDownAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollPageUpAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollRightAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollToDocumentEndAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollToDocumentStartAction() }, new EditActionData() { Category = ScrollCategory, Action = new ScrollUpAction() }, // Search new EditActionData() { Category = SearchCategory, Action = new FindAction() }, new EditActionData() { Category = SearchCategory, Action = new FindNextAction() }, new EditActionData() { Category = SearchCategory, Action = new FindNextSelectedAction() }, new EditActionData() { Category = SearchCategory, Action = new FindPreviousAction() }, new EditActionData() { Category = SearchCategory, Action = new FindPreviousSelectedAction() }, new EditActionData() { Category = SearchCategory, Action = new IncrementalSearchAction() }, new EditActionData() { Category = SearchCategory, Action = new ReplaceAction() }, new EditActionData() { Category = SearchCategory, Action = new ReverseIncrementalSearchAction() }, // Selection new EditActionData() { Category = SelectionCategory, Action = new CodeBlockSelectionContractAction() }, new EditActionData() { Category = SelectionCategory, Action = new CodeBlockSelectionExpandAction() }, new EditActionData() { Category = SelectionCategory, Action = new CollapseSelectionAction() }, new EditActionData() { Category = SelectionCategory, Action = new CollapseSelectionLeftAction() }, new EditActionData() { Category = SelectionCategory, Action = new CollapseSelectionRightAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectAllAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectBlockDownAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectBlockLeftAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectBlockRightAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectBlockToNextWordAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectBlockToPreviousWordAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectBlockUpAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectDownAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectLeftAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectPageDownAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectPageUpAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectRightAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToDocumentEndAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToDocumentStartAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToLineEndAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToLineStartAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToLineStartAfterIndentationAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToMatchingBracketAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToNextWordAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToPreviousWordAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToVisibleBottomAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectToVisibleTopAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectUpAction() }, new EditActionData() { Category = SelectionCategory, Action = new SelectWordAction() }, }; // Find the default binding for each action foreach (EditActionData actionData in actionDataArray) { foreach (InputBinding binding in editor.InputBindings) { KeyBinding keyBinding = binding as KeyBinding; if (keyBinding != null) { IEditAction command = binding.Command as IEditAction; if ((command != null) && (command.Key == actionData.Name)) { actionData.Key = EditActionBase.GetKeyText(keyBinding.Modifiers, keyBinding.Key); break; } } } } // Create a collection view source ListCollectionView source = new ListCollectionView(actionDataArray); source.GroupDescriptions.Add(new PropertyGroupDescription("Category")); // Set list items source editActionsListView.ItemsSource = source; }
public void BeginEdit(IEditAction action) { CurrentEditAction = action; IsEditing = true; }
public sealed override void OnInvoke(MethodInterceptionArgs eventArgs) { if (EditActionSettings.Disabled && !(EditActionSettings.AllowRestoreActions && editActionType != null)) { return; } IEditAction editAction = null; try { editActionsInProgress++; if (EventSettings.EnableLogging) { //log.DebugFormat(Indent + ">> Entering edit action {0} (enabled:{1}) {2}", // (eventArgs.Instance != null ? eventArgs.Instance.GetType().Name : "static") + "." + eventArgs.Method.Name, !Disabled, editActionsInProgress); } if (BeforeEdit != null) { BeforeEdit(eventArgs); } var editableObject = eventArgs.Instance as IEditableObject; if (EditActionSettings.SupportEditableObject && editActionType != null) { if (editableObject == null) { throw new InvalidOperationException("Cannot apply EditAction attribute with EditActionType if target is not IEditableObject"); } editAction = EditActionBase.Create(editActionType); if (editAction.HandlesRestore) { editAction.Instance = eventArgs.Instance; editAction.Arguments = eventArgs.Arguments.ToArray(); editAction.BeforeChanges(); } editableObject.BeginEdit(editAction); } var exception = false; try { eventArgs.Proceed(); } catch (Exception) { exception = true; throw; } finally { if (EditActionSettings.SupportEditableObject && editAction != null) { if (exception) { editableObject.CancelEdit(); } else { if (editAction.HandlesRestore) { editAction.ReturnValue = eventArgs.ReturnValue; } editableObject.EndEdit(); } } if (AfterEdit != null) { AfterEdit(eventArgs); } if (EventSettings.EnableLogging) { //log.DebugFormat(Indent + "<< Exiting edit action {0} {1}", // (eventArgs.Instance != null ? eventArgs.Instance.GetType().Name : "static") + "." + eventArgs.Method.Name, editActionsInProgress); } } } finally { editActionsInProgress--; } }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object CreateInstance() { IEditAction editAction = (IEditAction)base.CreateInstance(); if (editAction == null) { return(null); } // basically, we want to take a string like: // Control|J and turn it into the value to trigger the edit action // in GTK+ lingo that is a Gdk.Key and Gdk.ModifierType // we assume the order is Modifier|Modifier|Key Gdk.Key key = Gdk.Key.VoidSymbol; Gdk.ModifierType state = Gdk.ModifierType.None; for (int i = 0; i < keys.Length; i++) { string[] keydescr = keys[i].Split('|'); // the last keydescr is the Gdk.Key key = (Gdk.Key)Enum.Parse(typeof(Gdk.Key), keydescr[keydescr.Length - 1]); // the rest, if any, are modifiers for (int j = 0; j < keydescr.Length - 1; j++) { // FIXME: newer gdk's have more values here switch (keydescr[j]) { // ignore the buttons case "Button1": case "Button2": case "Button3": case "Button4": case "Button5": break; case "Control": state |= Gdk.ModifierType.ControlMask; break; // Caps Lock or Shift Lock case "Lock": state |= Gdk.ModifierType.LockMask; break; // this is normally Alt case "Alt": case "Mod1": state |= Gdk.ModifierType.Mod1Mask; break; case "Mod2": state |= Gdk.ModifierType.Mod2Mask; break; case "Mod3": state |= Gdk.ModifierType.Mod3Mask; break; case "Mod4": state |= Gdk.ModifierType.Mod4Mask; break; case "Mod5": state |= Gdk.ModifierType.Mod5Mask; break; // all the modifiers case "Modifier": state |= Gdk.ModifierType.ModifierMask; break; // ignore internal to GTK+ case "Release": break; case "Shift": state |= Gdk.ModifierType.ShiftMask; break; default: break; } } } editAction.Key = key; editAction.State = state; return(editAction); }
/// <summary> /// Performs an action encapsulated in IEditAction. /// </summary> private void DoEditAction(IEditAction action) { if (action != null) { var area = Editor.ActiveTextAreaControl.TextArea; Editor.BeginUpdate(); try { lock (Editor.Document) { action.Execute(area); if (area.SelectionManager.HasSomethingSelected && area.AutoClearSelection) { if (area.Document.TextEditorProperties.DocumentSelectionMode == ICSharpCode.TextEditor.Document.DocumentSelectionMode.Normal) { area.SelectionManager.ClearSelection(); } } } } finally { Editor.EndUpdate(); area.Caret.UpdateCaretPosition(); } } }
/// <summary> /// Execute a specified action in the editor /// </summary> /// <param name="action">The action to execute</param> public void Execute(IEditAction action) { action.Execute(this.ActiveTextAreaControl.TextArea); }
public void BeginEdit(IEditAction action) { IsEditing = true; }
public virtual void BeginEdit(IEditAction action) { editActions.Push(action); EditWasCancelled = false; IsEditing = true; }
public void Add(IEditAction action) { actions.Add(action); }
/// <summary> /// Executes the edit action. /// </summary> /// <param name="command">The command.</param> private void ExecuteIEditAction(IEditAction command) { command.Execute(rtbCode.ActiveTextAreaControl.TextArea); }
/// <summary> /// Execute a specified action in the editor /// </summary> /// <param name="action">The action to execute</param> public void Execute(IEditAction action) { action?.Execute(this.ActiveTextAreaControl.TextArea); }
/// <summary> /// Adds edit actions to the xml editor. /// </summary> public void AddEditActions(IEditAction[] actions) { foreach (IEditAction action in actions) { foreach (Keys key in action.Keys) { editactions[key] = action; } } }
public bool ExecuteDialogKey(Keys keyData) { if (this.DoProcessDialogKey != null && this.DoProcessDialogKey(keyData)) { return(true); } if ((keyData == Keys.Back || keyData == Keys.Delete || keyData == Keys.Return) && this.TextEditorProperties.UseCustomLine) { if (this.SelectionManager.HasSomethingSelected) { if (this.Document.CustomLineManager.IsReadOnly(this.SelectionManager.SelectionCollection[0], false)) { return(true); } } else { int lineNumberForOffset = this.Document.GetLineNumberForOffset(this.Caret.Offset); if (this.Document.CustomLineManager.IsReadOnly(lineNumberForOffset, false)) { return(true); } if (this.Caret.Column == 0 && lineNumberForOffset - 1 >= 0 && keyData == Keys.Back && this.Document.CustomLineManager.IsReadOnly(lineNumberForOffset - 1, false)) { return(true); } if (keyData == Keys.Delete) { LineSegment lineSegment = this.Document.GetLineSegment(lineNumberForOffset); if (lineSegment.Offset + lineSegment.Length == this.Caret.Offset && this.Document.CustomLineManager.IsReadOnly(lineNumberForOffset + 1, false)) { return(true); } } } } IEditAction editAction = this.motherTextEditorControl.GetEditAction(keyData); this.AutoClearSelection = true; if (editAction != null) { this.motherTextEditorControl.BeginUpdate(); try { IDocument document; Monitor.Enter(document = this.Document); try { editAction.Execute(this); if (this.SelectionManager.HasSomethingSelected && this.AutoClearSelection && this.Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { this.SelectionManager.ClearSelection(); } } finally { Monitor.Exit(document); } } catch (Exception ex) { Console.WriteLine(string.Concat(new object[] { "Got Exception while executing action ", editAction, " : ", ex.ToString() })); } finally { this.motherTextEditorControl.EndUpdate(); this.Caret.UpdateCaretPosition(); } return(true); } return(false); }