internal Layers(Redrawer redrawer, DisplayModel displayModel) { this.redrawer = redrawer; this.displayModel = displayModel; this.layersList = new List <Layer>(); }
protected void UnIndent() { using (Redrawer r = new Redrawer(this.Root)) { this.RemoveFocus(MoveFocusDirection.SelectNextInChain); this.Delete(); } }
//protected override void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) //{ // if (this.MyControl.IsFocused && !char.IsControl(e.KeyChar)) // { // Completion.ShowCompletionList(this); // } //} //protected override void OnTextHasChanged(ITextProvider changedControl, string oldText, string newText) //{ // base.OnTextHasChanged(changedControl, oldText, newText); // if (Text.Length > 0) // { // Completion.ShowCompletionList(this, Text); // } // else // { // Completion.HideCompletionList(); // } //} protected override void OnMouseUpRight(GuiLabs.Canvas.Events.MouseWithKeysEventArgs e) { using (Redrawer r = new Redrawer(Root)) { SetFocus(); Completion.ShowCompletionList(this); } e.Handled = true; }
protected override void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.Tab) { using (Redrawer r = new Redrawer(this.Root)) { ToggleOrientation(); } return; } base.OnKeyDown(sender, e); }
internal void Unassign() { lock (this) { if (this.assignedRedrawer == null) { throw new System.InvalidOperationException("layer is not assigned"); } this.assignedRedrawer = null; OnRemove(); } }
internal void Assign(Redrawer redrawer) { lock (this) { if (this.assignedRedrawer != null) { throw new System.InvalidOperationException("layer already assigned"); } this.assignedRedrawer = redrawer; OnAdd(); } }
void mSetter_Deleted(Block itemChanged) { using (Redrawer r = new Redrawer(this.Root)) { if (mSetter != null) { mSetter.Deleted -= mSetter_Deleted; mSetter = null; } Empty.Hidden = false; Empty.SetFocus(); } }
protected override void OnMouseUp(MouseWithKeysEventArgs e) { if (e.Handled == true) { return; } bool shouldShowPopupMenu = e.IsRightButtonPressed; using (Redrawer r = new Redrawer(Root)) { if (DragState != null) { if (DragState.Result != null) { DragState.Query.ShouldCopyInsteadOfMove = e.IsCtrlPressed; DragState.Result.DropTargetContainer.AcceptBlocks( DragState.Query, DragState.Result); shouldShowPopupMenu = false; e.Handled = true; } else { if (DragState.DragStarted) { shouldShowPopupMenu = false; e.Handled = true; } } DragState = null; } if (shouldShowPopupMenu && e.IsRightButtonPressed) { Block rightClicked = FindBlockAtPoint(e.X, e.Y); if (rightClicked != null && rightClicked.Menu != null && rightClicked.MyControl.HitTest(e.X, e.Y)) { if (rightClicked.CanGetFocus) { rightClicked.SetFocus(); } MyRootControl.ShowPopupMenu(rightClicked.Menu, e.Location); e.Handled = true; } } } }
protected override void OnKeyDownBack(System.Windows.Forms.KeyEventArgs e) { if (this.MyTextBox.CaretPosition == 0 && Multiline) { TextLine previous = this.Prev as TextLine; if (previous != null) { previous.JoinWithNext(); e.Handled = true; } else if (this.Prev != null) { using (Redrawer a = new Redrawer(this.Root)) { Block p = this.FindPrevFocusableBlock(); if (p != null) { p.SetCursorToTheEnd(); } else { this.RemoveFocus(MoveFocusDirection.SelectPrev); } if (this.Text == "") { base.Delete(); } e.Handled = true; } } else { using (new Redrawer(Root, true)) { Block p = this.FindPrevFocusableBlockInChain(); if (p != null) { p.SetCursorToTheEnd(); e.Handled = true; } } } } if (!e.Handled) { base.OnKeyDownBack(e); } }
protected override void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (!char.IsLetterOrDigit(e.KeyChar)) { return; } using (Redrawer r = new Redrawer(this.Root)) { ModifierSeparatorBlock prev = this.Prev as ModifierSeparatorBlock; this.Delete(); if (prev != null) { prev.MyControl.OnKeyPress(e); } } }
protected override void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { base.OnKeyPress(sender, e); if (char.IsLetterOrDigit(e.KeyChar) && !e.Handled) { Block b = this.FindFirstFocusableChild(); if (b != null && b.MyControl != null) { using (Redrawer r = new Redrawer(this.Root)) { b.SetCursorToTheEnd(); b.MyControl.OnKeyPress(e); } e.Handled = true; } } }
protected override void AppendNewToken(string prefix) { if (!Container.Completion.CanShow()) { return; } using (Redrawer a = new Redrawer(this.Root)) { TemporaryCompletionBlock empty = new TemporaryCompletionBlock(Container.Completion); empty.MyControl.Box.Padding.Right = ShapeStyle.DefaultFontSize; this.Parent.Children.Append(this, empty); empty.Text = prefix; empty.SetCursorToTheEnd(); empty.Completion.ShowCompletionList(empty, prefix); } }
public void ReplaceWithProperty() { TrimName(); PropertyBlock newProperty = PropertyBlock.Create( Modifiers.GetModifierString(), this.TypeBlock.Text, this.NameBlock.Text); using (Redrawer r = new Redrawer(this.Root)) { this.Replace(newProperty); Block toFocus = newProperty.GetAccessor.FindFirstFocusableChild(); if (toFocus != null) { toFocus.SetFocus(); } } }
protected bool CtrlEnter(bool shouldDeleteCurrent) { Block ParentParentNext = ParentParent != null ? ParentParent.Next : null; TextBoxBlock NextText = ParentParentNext as TextBoxBlock; shouldDeleteCurrent = shouldDeleteCurrent && this.Text == "" && this.Prev != null; if (this.Next != null || ParentParent == null) { return(false); } if (NextText != null && NextText.Text == "") { using (Redrawer r = new Redrawer(this.Root)) { NextText.SetFocus(); if (shouldDeleteCurrent) { this.Delete(); } } return(true); } else { ContainerBlock containingControlStructure = FindNearestControlStructureParent(); if (shouldDeleteCurrent) { this.MoveAfterBlock(ParentParent); return(true); } else if (containingControlStructure != null) { containingControlStructure.AppendBlocks(CreateNewTextLine()); return(true); } } return(false); }
protected override void OnKeyDownReturn(System.Windows.Forms.KeyEventArgs e) { if (this.Prev != null && this.Next == null && this.Text == "") { using (Redrawer r = new Redrawer(Root)) { this.RemoveFocus(MoveFocusDirection.SelectNextInChain); this.Delete(); } return; } if (e.Control && ParentParent != null && ParentParent.Next != null) { ParentParent.Next.SetFocus(); } else { base.OnKeyDownReturn(e); } }
public SingleRedrawTransaction(Block block, bool isDelayed) : base(block.ActionManager, isDelayed) { redrawer = new Redrawer(block.Root, true); }