コード例 #1
0
ファイル: Layers.cs プロジェクト: tilemapjp/MapsforgeSharp
        internal Layers(Redrawer redrawer, DisplayModel displayModel)
        {
            this.redrawer     = redrawer;
            this.displayModel = displayModel;

            this.layersList = new List <Layer>();
        }
コード例 #2
0
 protected void UnIndent()
 {
     using (Redrawer r = new Redrawer(this.Root))
     {
         this.RemoveFocus(MoveFocusDirection.SelectNextInChain);
         this.Delete();
     }
 }
コード例 #3
0
ファイル: EmptyBlock.cs プロジェクト: orb1t/StructuredEditor
        //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;
        }
コード例 #4
0
 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);
 }
コード例 #5
0
ファイル: Layer.cs プロジェクト: tilemapjp/MapsforgeSharp
        internal void Unassign()
        {
            lock (this)
            {
                if (this.assignedRedrawer == null)
                {
                    throw new System.InvalidOperationException("layer is not assigned");
                }

                this.assignedRedrawer = null;
                OnRemove();
            }
        }
コード例 #6
0
ファイル: Layer.cs プロジェクト: tilemapjp/MapsforgeSharp
        internal void Assign(Redrawer redrawer)
        {
            lock (this)
            {
                if (this.assignedRedrawer != null)
                {
                    throw new System.InvalidOperationException("layer already assigned");
                }

                this.assignedRedrawer = redrawer;
                OnAdd();
            }
        }
コード例 #7
0
 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();
     }
 }
コード例 #8
0
        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;
                    }
                }
            }
        }
コード例 #9
0
        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);
            }
        }
コード例 #10
0
        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);
                }
            }
        }
コード例 #11
0
 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;
         }
     }
 }
コード例 #12
0
        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);
            }
        }
コード例 #13
0
ファイル: FieldBlock.cs プロジェクト: orb1t/StructuredEditor
        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();
                }
            }
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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);
            }
        }
コード例 #16
0
 public SingleRedrawTransaction(Block block, bool isDelayed) : base(block.ActionManager, isDelayed)
 {
     redrawer = new Redrawer(block.Root, true);
 }