Esempio n. 1
0
            public override ToolState StartPointerSequence(PointerEventInfo info, ILevelGeometry viewport)
            {
                Tool._selectionManager.ClearSelection();
                Tool.UpdatePropertyProvider();

                return(this);
            }
Esempio n. 2
0
 protected override void PointerPositionCore(PointerEventInfo info, ILevelGeometry viewport)
 {
     if (_snapManager == null)
     {
         _snapManager = new SnappingManager(GetSnappingSourceOrigin(), GetSnappingSourceBounds(), GridSize);
     }
 }
Esempio n. 3
0
        private void StartFillSequence(PointerEventInfo info)
        {
            if (!SourceValid)
            {
                return;
            }

            TileCoord location = TileLocation(info);

            if (!TileInRange(location))
            {
                return;
            }

            if (SourceType == TileSourceType.Brush)
            {
                Layer.TileAdding   += TileAddingHandler;
                Layer.TileRemoving += TileRemovingHandler;
            }

            _fillLayer   = Layer;
            _sourceStack = new TileStack();
            _sourceStack.Add(ActiveTile);

            _fillCommand = new TileReplace2DCommand(Layer);
            FloodFill(location.X, location.Y);

            if (SourceType == TileSourceType.Brush)
            {
                Layer.TileAdding   -= TileAddingHandler;
                Layer.TileRemoving -= TileRemovingHandler;
            }

            History.Execute(_fillCommand);
        }
Esempio n. 4
0
            public override void HandlePointerPosition(PointerEventInfo info)
            {
                if (_form._tileController == null || _form._layer == null)
                {
                    return;
                }

                TileCoord location = TileLocation(info);

                if (!TileInRange(location))
                {
                    return;
                }

                if (_form._tileController.SelectedTile != null)
                {
                    if (_form._tileController.SelectedTile.Width != _form._layer.TileWidth ||
                        _form._tileController.SelectedTile.Height != _form._layer.TileHeight)
                    {
                        MessageBox.Show("Selected tile not compatible with brush tile dimensions.", "Incompatible Tile", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    _form._layer.ClearTile(location.X, location.Y);
                    if (!_erase)
                    {
                        _form._layer.AddTile(location.X, location.Y, _form._tileController.SelectedTile);
                    }
                }
            }
Esempio n. 5
0
        private void EndEraseAreaSequence(PointerEventInfo info, ILevelGeometry viewport)
        {
            Rectangle selection = _band.Selection;
            int       xmin      = Math.Max(Layer.TileOriginX, selection.Left);
            int       ymin      = Math.Max(Layer.TileOriginY, selection.Top);
            int       xmax      = Math.Min(Layer.TileOriginX + Layer.TilesWide, selection.Right);
            int       ymax      = Math.Min(Layer.TileOriginY + Layer.TilesHigh, selection.Bottom);

            TileReplace2DCommand command = new TileReplace2DCommand(Layer);

            for (int x = xmin; x < xmax; x++)
            {
                for (int y = ymin; y < ymax; y++)
                {
                    command.QueueReplacement(new TileCoord(x, y), (TileStack)null);
                    Layer[new TileCoord(x, y)] = null;
                }
            }

            History.Execute(command);

            _annots.Remove(_selection);
            _inAreaSequence = false;

            EndAutoScroll(info, viewport);
        }
Esempio n. 6
0
        private void StartSelectTilesSequence(PointerEventInfo info, ILevelGeometry viewport)
        {
            bool controlKey = Control.ModifierKeys.HasFlag(Keys.Control);
            bool shiftKey   = Control.ModifierKeys.HasFlag(Keys.Shift);

            if (shiftKey)
            {
                StartDragAdd(info, viewport);
                return;
            }

            if (controlKey)
            {
                StartDragRemove(info, viewport);
                return;
            }

            TileCoord location = TileLocation(info);

            if (!_selectLayer.TileSelectionCoverageAt(location))
            {
                StartDragNew(info, viewport);
            }
            else
            {
                StartMove(info, viewport);
            }
        }
Esempio n. 7
0
 private ToolState StartTimeoutSequence(PointerEventInfo info, ILevelGeometry viewport, ObjectInstance obj)
 {
     return(new SelectionTimeoutToolState(Tool)
     {
         HitObject = obj
     }.StartPointerSequence(info, viewport));
 }
Esempio n. 8
0
 public void HandleUpdatePointerSequence(PointerEventInfo info)
 {
     if (_currentTool != null)
     {
         _currentTool.UpdatePointerSequence(info, LayerContext.Geometry);
     }
 }
Esempio n. 9
0
 public virtual void HandlePointerPosition(PointerEventInfo info)
 {
     if (_parent != null)
     {
         _parent.HandlePointerPosition(info);
     }
 }
Esempio n. 10
0
 public virtual void HandleUpdatePointerSequence(PointerEventInfo info)
 {
     if (_parent != null)
     {
         _parent.HandleUpdatePointerSequence(info);
     }
 }
Esempio n. 11
0
            public override ToolState StartPointerSequence(PointerEventInfo info, ILevelGeometry viewport)
            {
                InitialLocation = new Point((int)info.X, (int)info.Y);
                Timeout         = DateTime.Now;

                return(this);
            }
Esempio n. 12
0
            private ToolState StartClickRemove(PointerEventInfo info, ILevelGeometry viewport, ObjectInstance obj)
            {
                Tool._selectionManager.RemoveObjectFromSelection(obj);

                Tool.StartAutoScroll(info, viewport);
                Tool.UpdatePropertyProvider();

                return(new SelectionStandbyToolState(Tool).StartPointerSequence(info, viewport));
            }
Esempio n. 13
0
 public override ToolState EndPointerSequence(PointerEventInfo info, ILevelGeometry viewport)
 {
     if ((DateTime.Now - Timeout).TotalMilliseconds < _timeoutThreshold)
     {
         return new RotationStandbyToolState(Tool)
                {
                    HitObject = HitObject
                }
     }
Esempio n. 14
0
        private void StartDragRemove(PointerEventInfo info, ILevelGeometry viewport)
        {
            if (!_selectLayer.HasSelection)
            {
                return;
            }

            StartDrag(info, viewport, MergeAction.Remove);
        }
Esempio n. 15
0
 protected override void EndPointerSequenceCore(PointerEventInfo info, ILevelGeometry viewport)
 {
     switch (info.Type)
     {
     case PointerEventType.Primary:
         EndSelectTilesSequence(info, viewport);
         break;
     }
 }
Esempio n. 16
0
        private void StartDrawPathSequence(PointerEventInfo info)
        {
            if (ActiveTile == null && _activeBrush == null)
            {
                return;
            }

            _drawCommand = new TileReplace2DCommand(Layer);
        }
Esempio n. 17
0
        private void UpdateDragCommon(PointerEventInfo info, ILevelGeometry viewport)
        {
            TileCoord location = TileLocation(info);

            _band.End = new Point(location.X, location.Y);
            Rectangle selection = _band.Selection;

            _selectionAnnot.Start = new Point(selection.Left * Layer.TileWidth, selection.Top * Layer.TileHeight);
            _selectionAnnot.End   = new Point(selection.Right * Layer.TileWidth, selection.Bottom * Layer.TileHeight);
        }
Esempio n. 18
0
        protected override void EndPointerSequenceCore(PointerEventInfo info, ILevelGeometry viewport)
        {
            _state = _state.EndPointerSequence(info, viewport);

            /*switch (info.Type) {
             *  case PointerEventType.Primary:
             *      EndSelectObjectSequence(info, viewport);
             *      break;
             * }*/
        }
Esempio n. 19
0
        private void EndMove(PointerEventInfo info, ILevelGeometry viewport)
        {
            Command command = new MoveTileSelectionCommand(_selectLayer, _initialOffset, _selectLayer.TileSelectionOffset);

            History.Execute(command);

            _action = UpdateAction.None;

            EndAutoScroll(info, viewport);
        }
Esempio n. 20
0
        protected override void StartPointerSequenceCore(PointerEventInfo info, ILevelGeometry viewport)
        {
            switch (info.Type)
            {
            case PointerEventType.Primary:
                StartFillSequence(info);
                break;
            }

            UpdatePointerSequence(info, viewport);
        }
Esempio n. 21
0
            public override ToolState EndPointerSequence(PointerEventInfo info, ILevelGeometry viewport)
            {
                ClearAnnot();

                Tool._selectionManager.AddObjectsToSelection(Tool.ObjectsInArea(Band.Selection));

                Tool.EndAutoScroll(info, viewport);
                Tool.UpdatePropertyProvider();

                return(new ReleaseToolState(Tool).EndPointerSequence(info, viewport));
            }
Esempio n. 22
0
            public override void HandleStartPointerSequence(PointerEventInfo info)
            {
                base.HandleStartPointerSequence(info);

                if (info.Type == PointerEventType.Secondary && _form._tilePool.SelectedTile != null)
                {
                    Point position = _form._pointerController.UntranslatePosition(new Point((int)info.X, (int)info.Y));

                    _form._tileContextMenu.Show(_form._layerControl, position);
                }
            }
Esempio n. 23
0
            public override ToolState UpdatePointerSequence(PointerEventInfo info, ILevelGeometry viewport)
            {
                Band.End = new Point((int)info.X, (int)info.Y);
                Rectangle selection = Band.Selection;

                Annot.Start = new Point(selection.Left, selection.Top);
                Annot.End   = new Point(selection.Right, selection.Bottom);

                Tool.UpdateAutoScroll(info, viewport);

                return(this);
            }
Esempio n. 24
0
        public void HandleEndPointerSequence(PointerEventInfo info)
        {
            if (_currentTool != null)
            {
                _currentTool.EndPointerSequence(info, LayerContext.Geometry);
            }

            if (_currentTool is ObjectDrawTool && _currentTool.IsCancelled)
            {
                SetCurrentTool(NewSelectTool());
            }
        }
Esempio n. 25
0
        protected override void PointerPositionCore(PointerEventInfo info, ILevelGeometry viewport)
        {
            TileCoord location = TileLocation(info);

            if (!TileInRange(location) || _inAreaSequence)
            {
                HidePreviewMarker();
                return;
            }

            ShowPreviewMarker(location);
        }
Esempio n. 26
0
        public void HandlePointerPosition(PointerEventInfo info)
        {
            if (_currentTool != null)
            {
                _currentTool.PointerPosition(info, LayerContext.Geometry);
            }

            if (Info != null)
            {
                Info.ActionUpdateCoordinates(info.X + ", " + info.Y);
            }
        }
Esempio n. 27
0
        private void EndDrawPathSequence(PointerEventInfo info)
        {
            if (ActiveTile == null && _activeBrush == null)
            {
                return;
            }

            if (!_drawCommand.IsEmpty)
            {
                History.Execute(_drawCommand);
            }
        }
Esempio n. 28
0
        public void HandlePointerPosition(PointerEventInfo info)
        {
            if (_currentTool != null)
            {
                _currentTool.PointerPosition(info, LayerContext.Geometry);
            }

            if (Info != null)
            {
                TileCoord coords = MouseToTileCoords(new Point((int)info.X, (int)info.Y));
                Info.ActionUpdateCoordinates(coords.X + ", " + coords.Y);
            }
        }
Esempio n. 29
0
        private void EndSelectTilesSequence(PointerEventInfo info, ILevelGeometry viewport)
        {
            switch (_action)
            {
            case UpdateAction.Move:
                EndMove(info, viewport);
                break;

            case UpdateAction.Box:
                EndDrag(info, viewport);
                break;
            }
        }
Esempio n. 30
0
            public override ToolState EndPointerSequence(PointerEventInfo info, ILevelGeometry viewport)
            {
                if (Annot == null)
                {
                    float radius = Tool.MaxBoundingDiagonal(HitObject) / 2 + 5;
                    Annot             = new CircleAnnot(HitObject.ImageBounds.Center, radius);
                    Annot.Outline     = Outline;
                    Annot.OutlineGlow = OutlineGlow;
                    Tool._annots.Add(Annot);
                }

                return(this);
            }