Beispiel #1
0
        public override void MouseDown(MouseEvent ev)
        {
            base.MouseDown(ev);
            IDrawingView view = ev.View;

            if (IsRightButtonPressed(ev))
            {
                DelegateTool = new PanTool(Editor, CursorFactory.GetCursorFromType(Gdk.CursorType.Arrow));
            }
            else
            {
                IHandle handle = view.FindHandle(ev.X, ev.Y);
                if (handle != null)
                {
                    DelegateTool = new HandleTracker(Editor, new UndoableHandle(handle));
                }
                else
                {
                    IFigure figure = view.Drawing.FindFigure(ev.X, ev.Y);
                    if (figure != null)
                    {
                        DelegateTool = figure.CreateFigureTool(Editor, new DragTool(Editor, figure));
                    }
                    else
                    {
                        DelegateTool = new SelectAreaTool(Editor);
                    }
                }
            }

            if (DelegateTool != null)
            {
                DelegateTool.MouseDown(ev);
            }
        }
Beispiel #2
0
        public override void MouseMove(MouseEvent ev)
        {
            IDrawingView view   = ev.View;
            Widget       widget = (Widget)view;
            IHandle      handle = view.FindHandle(ev.X, ev.Y);

            if (handle != null)
            {
                widget.GdkWindow.Cursor = handle.CreateCursor();
            }
            else
            {
                IFigure figure = view.Drawing.FindFigure(ev.X, ev.Y);
                if (figure != null)
                {
                    widget.GdkWindow.Cursor = CursorFactory.GetCursorFromType(Gdk.CursorType.Fleur);
                }
                else
                {
                    widget.GdkWindow.Cursor = null;
                }
            }

            if (DelegateTool != null)
            {
                DelegateTool.MouseMove(ev);
            }
        }
 public override void InvokeStart(double x, double y, IDrawingView view) 
 {
     m_connection = CreateConnection();
     m_connection.EndPoint = new PointD (x, y);
     m_connection.StartPoint = new PointD (x, y);
     m_connection.ConnectStart (Owner.ConnectorAt(x, y));
     m_connection.UpdateConnection();
     view.Drawing.Add(m_connection);
     view.ClearSelection();
     view.AddToSelection(m_connection);
     m_handle = view.FindHandle(x, y);
 }
Beispiel #4
0
 public override void InvokeStart(double x, double y, IDrawingView view)
 {
     m_connection            = CreateConnection();
     m_connection.EndPoint   = new PointD(x, y);
     m_connection.StartPoint = new PointD(x, y);
     m_connection.ConnectStart(Owner.ConnectorAt(x, y));
     m_connection.UpdateConnection();
     view.Drawing.Add(m_connection);
     view.ClearSelection();
     view.AddToSelection(m_connection);
     m_handle = view.FindHandle(x, y);
 }
Beispiel #5
0
        public override void MouseDown(MouseEvent ev)
        {
            base.MouseDown(ev);
            IDrawingView view = ev.View;

            IFigure figure = view.Drawing.FindFigure(ev.X, ev.Y);

            if (ev.IsRightButtonPressed())
            {
                ITool defaultTool = new PanTool(Editor, CursorFactory.GetCursorFromType(Gdk.CursorType.Arrow));
                if (figure != null)
                {
                    DelegateTool = figure.CreateFigureTool(this, Editor, defaultTool, ev);
                }
                else
                {
                    //if it didn't hit figure then allow panning
                    DelegateTool = defaultTool;
                }
            }
            else
            {
                IHandle handle = view.FindHandle(ev.X, ev.Y);
                if (handle != null)
                {
                    DelegateTool = new HandleTracker(Editor, new UndoableHandle(handle));
                }
                else
                {
                    if (figure != null)
                    {
                        ITool dragTool = new DragTool(Editor, figure);
                        DelegateTool = figure.CreateFigureTool(this, Editor, dragTool, ev);
                    }
                    else
                    {
                        DelegateTool = new SelectAreaTool(Editor);
                    }
                }
            }

            if (DelegateTool != null)
            {
                DelegateTool.MouseDown(ev);
            }
        }
Beispiel #6
0
        public override void MouseDown(MouseEvent ev)
        {
            SetAnchorCoords(ev.X, ev.Y);
            IDrawingView view = ev.View;

            View = view;

            Gdk.EventType type = ev.GdkEvent.Type;
            if (type == EventType.TwoButtonPress)
            {
                PolyLineFigure connection = (PolyLineFigure)Figure;
                connection.SplitSegment(ev.X, ev.Y);
                view.ClearSelection();
                view.AddToSelection(Figure);
                _handle = view.FindHandle(ev.X, ev.Y) as PolyLineHandle;
                ((Gtk.Widget)view).GdkWindow.Cursor = _handle.CreateCursor();
                _handle.InvokeStart(ev.X, ev.Y, ev.View);
                CreateUndoActivity();
            }
            else
            {
                DefaultTool.MouseDown(ev);
            }
        }
Beispiel #7
0
        // END // HERZUM SPRINT 2.5 TLAB-136
        // END HERZUM SPRINT 2.0 TLAB-136-2

        public override void MouseDown(MouseEvent ev)
        {
            base.MouseDown(ev);
            IDrawingView view = ev.View;

            // HERZUM SPRINT 2.5 TLAB-136
            if (!mouseUp)
            {
                return;
            }
            else
            {
                mouseUp   = false;
                mouseDown = true;
            }
            // HERZUM SPRINT 2.5 TLAB-136

            // HERZUM SPRINT 2.0 TLAB-136-2

            /*
             * if (x!=-1 && (x != ev.X || y != ev.Y)){
             *  x = ev.X;
             *  y = ev.Y;
             * }
             * else if (x == ev.X && y == ev.Y)
             *  return;
             * else {
             *  x = ev.X;
             *  y = ev.Y;
             * }
             */
            // END HERZUM SPRINT 2.5 TLAB-136
            // END HERZUM SPRINT 2.2 TLAB-136-2

            IFigure figure = view.Drawing.FindFigure(ev.X, ev.Y);

            if (ev.IsRightButtonPressed())
            {
                ITool defaultTool = new PanTool(Editor, CursorFactory.GetCursorFromType(Gdk.CursorType.Arrow));
                if (figure != null)
                {
                    DelegateTool = figure.CreateFigureTool(this, Editor, defaultTool, ev);
                }
                else
                {
                    //if it didn't hit figure then allow panning
                    DelegateTool = defaultTool;
                }
            }
            else
            {
                IHandle handle = view.FindHandle(ev.X, ev.Y);
                if (handle != null)
                {
                    DelegateTool = new HandleTracker(Editor, new UndoableHandle(handle));
                }
                else
                {
                    if (figure != null)
                    {
                        ITool dragTool = new DragTool(Editor, figure);
                        DelegateTool = figure.CreateFigureTool(this, Editor, dragTool, ev);
                    }
                    else
                    {
                        DelegateTool = new SelectAreaTool(Editor);
                    }
                }
            }

            if (DelegateTool != null)
            {
                DelegateTool.MouseDown(ev);
            }
        }