Esempio n. 1
0
        protected override void OnDeactivate()
        {
            if (cursorZoom != null)
            {
                cursorZoom.Dispose();
                cursorZoom = null;
            }

            if (cursorZoomIn != null)
            {
                cursorZoomIn.Dispose();
                cursorZoomIn = null;
            }

            if (cursorZoomOut != null)
            {
                cursorZoomOut.Dispose();
                cursorZoomOut = null;
            }

            if (cursorZoomPan != null)
            {
                cursorZoomPan.Dispose();
                cursorZoomPan = null;
            }

            this.RendererList.Remove(this.outlineRenderer);
            this.outlineRenderer.Dispose();
            this.outlineRenderer = null;

            base.OnDeactivate();
        }
Esempio n. 2
0
 public MoveItemsDragAction(SelectionRenderer selectionRenderer, ISelectionService selectionService,
                            IHistoryService historyService)
 {
     this.selectionRenderer = selectionRenderer;
     this.selectionService  = selectionService;
     this.historyService    = historyService;
 }
Esempio n. 3
0
 public MoveTool(ISelectionService selectionService, SelectionRenderer selectionRenderer,
                 IHistoryService historyService)
 {
     this.selectionService  = selectionService;
     this.selectionRenderer = selectionRenderer;
     this.historyService    = historyService;
 }
Esempio n. 4
0
        public Renderer(IntPtr mapHwnd, Rectangle initialViewport)
        {
            layerStates = new Dictionary <Layers, bool>
            {
                { Layers.Floor, true },
                { Layers.Guide, false },
                { Layers.Object, true },
                { Layers.Physics, true },
                { Layers.Vision, true },
                { Layers.Selection, true },
            };

            var presentParams = new PresentParameters
            {
                BackBufferWidth  = initialViewport.Width,
                BackBufferHeight = initialViewport.Height,
                Windowed         = true,
                SwapEffect       = SwapEffect.Flip,
            };

            direct3D = new Direct3D();
            device   = new Device(direct3D, 0, DeviceType.Hardware, mapHwnd, CreateFlags.HardwareVertexProcessing,
                                  presentParams);

            viewport = initialViewport;
            floors   = new FloorRenderer(device, new Size(initialViewport.Width, initialViewport.Height));
            guides   = new GuideRenderer(device, initialViewport, DefaultGuideColor, DefaultGuideColumnInterval,
                                         DefaultGuideRowInterval, DefaultGuideTransparency);
            selection = new SelectionRenderer(device);

            grid = new Grid(2048, 2048);
        }
Esempio n. 5
0
        public override void OnMouseUp(MouseActionEventArgs e)
        {
            canStart = false;
            base.OnMouseUp(e);
            Exclusive = false;
            var oldShape = this.Shape;

            this.Shape = ShapeFactory.Shape(ShapeDataType, Point.Zero, Size.Zero, false);
            SelectionRenderer.InvalidateShapeOutline(oldShape, ShapeFactory.Shape(ShapeDataType, Point.Zero, Size.Zero, false));
        }
Esempio n. 6
0
    void OnEnable()
    {
        volumeGraph       = new VolumeGraph();
        selectionRenderer = new SelectionRenderer();
        waveformRenderer  = new AudioWaveformRenderer(volumeGraph.volumeAtTime, () => currentAudioData);
        selectionRenderer.selectionChanged += onSelectionRangeChanged;

        wantsMouseMove            = true;
        EditorApplication.update += onUpdate;
    }
        public void HandleNull()
        {
            // Setup
            const string markup            = null;
            var          selectionRenderer = new SelectionRenderer();
            var          characters        = new SingleLineTextRange(0, 1, 2);

            // Operation
            string output = selectionRenderer.GetSelectionMarkup(markup, characters);

            // Verification
            Assert.IsNull(output);
        }
        public void PlainMiddleOfString()
        {
            // Setup
            const string markup            = "this is a string";
            var          selectionRenderer = new SelectionRenderer();
            var          characters        = new SingleLineTextRange(0, 5, 9);

            // Operation
            string output = selectionRenderer.GetSelectionMarkup(markup, characters);

            // Verification
            Assert.AreEqual("this <span background='#CCCCFF'>is a</span> string", output);
        }
        public void HandleBlank()
        {
            // Setup
            string markup            = string.Empty;
            var    selectionRenderer = new SelectionRenderer();
            var    characters        = new SingleLineTextRange(0, 1, 2);

            // Operation
            string output = selectionRenderer.GetSelectionMarkup(markup, characters);

            // Verification
            Assert.AreEqual(string.Empty, output);
        }
        public void PlainEmptySelectionAtEndOfLine()
        {
            // Setup
            const string markup            = "this";
            var          selectionRenderer = new SelectionRenderer();
            var          characters        = new SingleLineTextRange(0, 5, CharacterPosition.End);

            // Operation
            string output = selectionRenderer.GetSelectionMarkup(markup, characters);

            // Verification
            Assert.AreEqual("this", output);
        }
    public void drawSelection(Rect rect, Color color)
    {
        if (!mouseDown.HasValue)
        {
            return;
        }
        drawLine(rect, at: mouseDown.Value, width: 1, color);

        var mouseEnd = (mouseUp.HasValue ? mouseUp.Value : Event.current.mousePosition.x / rect.width);
        var xMin     = Mathf.Min(mouseEnd, mouseDown.Value) * rect.width;
        var xMax     = Mathf.Max(mouseEnd, mouseDown.Value) * rect.width;

        SelectionRenderer.drawLine(rect, mouseEnd, width: 1, color: color);
        EditorGUI.DrawRect(new Rect(xMin, 0, xMax - xMin, rect.height), new Color(color.r, color.g, color.b, 0.5f));
    }
Esempio n. 12
0
        protected override void OnActivate()
        {
            // Assume that SetCursors() has been called by now

            this.Cursor = GetCursor();
            DocumentWorkspace.EnableSelectionTinting = true;

            this.newSelection         = new Selection();
            this.newSelectionRenderer = new SelectionRenderer(this.RendererList, this.newSelection, this.DocumentWorkspace);
            this.newSelectionRenderer.EnableSelectionTinting = false;
            this.newSelectionRenderer.EnableOutlineAnimation = false;
            this.newSelectionRenderer.Visible = false;
            this.RendererList.Add(this.newSelectionRenderer, true);

            base.OnActivate();
        }
Esempio n. 13
0
 protected override void EndAction()
 {
     //if (Resolved) {
     CursorHandler.RestoreCursor();
     resizing     = false;
     moving       = false;
     LastMousePos = Point.Zero;
     MouseDownPos = Point.Zero;
     hitAnchor    = Anchor.None;
     if (SelectionRenderer != null)
     {
         SelectionRenderer.UpdateSelection();
     }
     //}
     base.EndAction();
 }
Esempio n. 14
0
        protected override void OnActivate()
        {
            this.cursorZoom    = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomToolCursor.cur"));
            this.cursorZoomIn  = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomInToolCursor.cur"));
            this.cursorZoomOut = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomOutToolCursor.cur"));
            this.cursorZoomPan = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomOutToolCursor.cur"));
            this.Cursor        = this.cursorZoom;

            base.OnActivate();

            this.outline         = new Selection();
            this.outlineRenderer = new SelectionRenderer(this.RendererList, this.outline, this.DocumentWorkspace);
            this.outlineRenderer.InvertedTinting = true;
            this.outlineRenderer.TintColor       = Color.FromArgb(128, 255, 255, 255);
            this.outlineRenderer.ResetOutlineWhiteOpacity();
            this.RendererList.Add(this.outlineRenderer, true);
        }
Esempio n. 15
0
        protected override void OnActivate()
        {
            this.cursorZoom = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomToolCursor.cur"));
            this.cursorZoomIn = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomInToolCursor.cur"));
            this.cursorZoomOut = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomOutToolCursor.cur"));
            this.cursorZoomPan = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomOutToolCursor.cur"));
            this.Cursor = this.cursorZoom;

            base.OnActivate();

            this.outline = new Selection();
            this.outlineRenderer = new SelectionRenderer(this.RendererList, this.outline, this.DocumentWorkspace);
            this.outlineRenderer.InvertedTinting = true;
            this.outlineRenderer.TintColor = Color.FromArgb(128, 255, 255, 255);
            this.outlineRenderer.ResetOutlineWhiteOpacity();
            this.RendererList.Add(this.outlineRenderer, true);
        }
        /// <summary>
        /// Performs one of the exhaustive tests by taking the input and applying
        /// the selection to characters 3-4.
        /// </summary>
        /// <param name="startIndex">The start index.</param>
        /// <param name="endIndex">The end index.</param>
        /// <param name="input">The input.</param>
        /// <param name="desiredOutput">The output.</param>
        protected void TestExhaustive(
            int startIndex,
            int endIndex,
            string input,
            string desiredOutput)
        {
            // Setup
            var selectionRenderer = new SelectionRenderer();
            var characters        = new SingleLineTextRange(0, startIndex, endIndex);

            // Operation
            string output = selectionRenderer.GetSelectionMarkup(
                input, characters, "s", String.Empty);

            // Verification
            Assert.AreEqual(desiredOutput, output);
        }
Esempio n. 17
0
        protected override void OnActivate()
        {
            // Assume that SetCursors() has been called by now

            Cursor = GetCursor();
            DocumentWorkspace.EnableSelectionTinting = true;

            NewSelection         = new Selection();
            NewSelectionRenderer = new SelectionRenderer(RendererList, NewSelection, DocumentWorkspace)
            {
                EnableSelectionTinting = false,
                EnableOutlineAnimation = false,
                Visible = false
            };
            RendererList.Add(NewSelectionRenderer, true);

            base.OnActivate();
        }
Esempio n. 18
0
        protected override void OnDeactivate()
        {
            DocumentWorkspace.EnableSelectionTinting = false;

            if (this.tracking)
            {
                Done();
            }

            base.OnDeactivate();

            SetCursors(null, null, null, null); // dispose 'em

            this.RendererList.Remove(this.newSelectionRenderer);
            this.newSelectionRenderer.Dispose();
            this.newSelectionRenderer = null;
            this.newSelection         = null;
        }
Esempio n. 19
0
        protected override void OnDeactivate()
        {
            cursorZoom?.Dispose();
            cursorZoom = null;

            cursorZoomIn?.Dispose();
            cursorZoomIn = null;

            cursorZoomOut?.Dispose();
            cursorZoomOut = null;

            cursorZoomPan?.Dispose();
            cursorZoomPan = null;

            this.RendererList.Remove(this.outlineRenderer);
            this.outlineRenderer.Dispose();
            this.outlineRenderer = null;

            base.OnDeactivate();
        }
Esempio n. 20
0
        protected override void OnDeactivate()
        {
            DocumentWorkspace.EnableSelectionTinting = false;

            if (this.tracking)
            {
                Done();
            }

            base.OnDeactivate();

            SetCursors(null, null, null, null); // dispose 'em

            this.RendererList.Remove(this.newSelectionRenderer);
            this.newSelectionRenderer.Dispose();
            this.newSelectionRenderer = null;
            this.newSelection = null;
        }
Esempio n. 21
0
        protected override void OnActivate()
        {
            // Assume that SetCursors() has been called by now

            this.Cursor = GetCursor();
            DocumentWorkspace.EnableSelectionTinting = true;

            this.newSelection = new Selection();
            this.newSelectionRenderer = new SelectionRenderer(this.RendererList, this.newSelection, this.DocumentWorkspace);
            this.newSelectionRenderer.EnableSelectionTinting = false;
            this.newSelectionRenderer.EnableOutlineAnimation = false;
            this.newSelectionRenderer.Visible = false;
            this.RendererList.Add(this.newSelectionRenderer, true);

            base.OnActivate();
        }
Esempio n. 22
0
        protected override void OnDeactivate()
        {
            if (cursorZoom != null)
            {
                cursorZoom.Dispose();
                cursorZoom = null;
            }

            if (cursorZoomIn != null)
            {
                cursorZoomIn.Dispose();
                cursorZoomIn = null;
            }

            if (cursorZoomOut != null)
            {
                cursorZoomOut.Dispose();
                cursorZoomOut = null;
            }

            if (cursorZoomPan != null)
            {
                cursorZoomPan.Dispose();
                cursorZoomPan = null;
            }

            this.RendererList.Remove(this.outlineRenderer);
            this.outlineRenderer.Dispose();
            this.outlineRenderer = null;

            base.OnDeactivate();
        }
Esempio n. 23
0
 public MoveTool(ISelectionService selectionService, SelectionRenderer selectionRenderer, IMapService mapService)
 {
     this.selectionService  = selectionService;
     this.selectionRenderer = selectionRenderer;
     this.mapService        = mapService;
 }