Пример #1
0
        public override void MouseDown(MouseEvent ev)
        {
            IDrawingView view = ev.View;

            base.MouseDown(ev);
            view.Drawing.Add(Prototype);
            Prototype.MoveTo(ev.X, ev.Y);
            view.ClearSelection();
            view.AddToSelection(Prototype);
            CreateUndoActivity();
        }
 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);
 }
Пример #3
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);
 }
 public override void InvokeEnd(double x, double y, IDrawingView view) 
 {
     if (m_handle != null) {
         m_handle.InvokeEnd(x, y, view);
     }
     
     if (m_connection.EndConnector == null) {
         m_connection.DisconnectStart ();
         m_connection.DisconnectEnd ();
         view.Drawing.Remove(m_connection);
         view.ClearSelection();
     }
 }
Пример #5
0
        public override void InvokeEnd(double x, double y, IDrawingView view)
        {
            if (m_handle != null)
            {
                m_handle.InvokeEnd(x, y, view);
            }

            if (m_connection.EndConnector == null)
            {
                m_connection.DisconnectStart();
                m_connection.DisconnectEnd();
                view.Drawing.Remove(m_connection);
                view.ClearSelection();
            }
        }
Пример #6
0
        private void DeleteFigures(IDrawingView view)
        {
            List <IFigure> figures = new List <IFigure> ();

            foreach (IFigure fig in view.SelectionEnumerator)
            {
                figures.Add(fig);
            }

            view.ClearSelection();

            foreach (IFigure fig in figures)
            {
                view.Drawing.Remove(fig);
            }
        }
Пример #7
0
        public override void MouseDown(MouseEvent ev)
        {
            base.MouseDown(ev);

            IDrawingView view = ev.View;

            EventButton gdk_event = ev.GdkEvent as EventButton;

            bool shift_pressed = (gdk_event.State & ModifierType.ShiftMask) != 0;

            if (!shift_pressed)
            {
                view.ClearSelection();
            }

            _selectionRect = new RectangleD(ev.X, ev.Y, 0, 0);
            DrawSelectionRect((Gtk.Widget)view, gdk_event.Window);
        }
Пример #8
0
        public override void MouseDown(MouseEvent ev)
        {
            IDrawingView view   = ev.View;
            IFigure      figure = view.Drawing.FindFigure(ev.X, ev.Y);

            if (figure != null)
            {
                _connection.EndPoint   = new PointD(ev.X, ev.Y);
                _connection.StartPoint = new PointD(ev.X, ev.Y);
                _connection.ConnectStart(figure.ConnectorAt(ev.X, ev.Y));
                _connection.UpdateConnection();
                view.Drawing.Add(_connection);
                view.ClearSelection();
                view.AddToSelection(_connection);
                _handle = _connection.EndHandle;
                CreateUndoActivity();
            }
            else
            {
                Editor.Tool = new SelectionTool(Editor);
            }
        }
Пример #9
0
        public override void MouseDown(MouseEvent ev)
        {
            base.MouseDown(ev);
            IDrawingView view = ev.View;

            SetLastCoords(ev.X, ev.Y);

            Gdk.ModifierType state = (ev.GdkEvent as EventButton).State;

            bool shift_pressed = (state & ModifierType.ShiftMask) != 0;

            if (shift_pressed)
            {
                view.ToggleSelection(AnchorFigure);
            }

            else if (!view.IsFigureSelected(AnchorFigure))
            {
                view.ClearSelection();
                view.AddToSelection(AnchorFigure);
            }
            CreateUndoActivity();
        }
Пример #10
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);
            }
        }
Пример #11
0
 private void DeleteFigures (IDrawingView view) {
     List <IFigure> figures = new List <IFigure> ();
     
     foreach (IFigure fig in view.SelectionEnumerator) {
         figures.Add (fig);
     }
     
     view.ClearSelection ();
     
     foreach (IFigure fig in figures) {
         view.Drawing.Remove (fig);
     }
 }
Пример #12
0
        public override void InvokeEnd(double x, double y, IDrawingView view)
        {
            if (_handle != null) {
                _handle.InvokeEnd(x, y, view);
            }

            if (_connection.EndConnector == null) {
                IFigure new_figure = CreateEndFigure();
                new_figure.MoveTo(x, y);
                view.Drawing.Add(new_figure);
                _connection.ConnectEnd(new_figure.ConnectorAt(0.0, 0.0));
                _connection.UpdateConnection();
                view.ClearSelection();
                view.AddToSelection(new_figure);
            }
        }
 public override void InvokeStart(double x, double y, IDrawingView view)
 {
     if (Owner is TableFigure) {
         _clicked = !_clicked;
         TableFigure f = (TableFigure)Owner;
         if (_locator is IndexLocator) {
             //Show/Hide Indexes
             if (f.showIndexes) {
                 foreach (Index indx in f.Model.indexes) {
                     f.Remove (indx);
                 }
                 f.showIndexes = false;
             } else {
                 foreach (Index indx in f.Model.indexes) {
                     f.Add (indx);
                 }
                 f.showIndexes = true;
             }
         }
         if (_locator is TriggerLocator) {
             //Show/Hide Triggers
             if (f.showTriggers) {
                 foreach (Trigger trg in f.Model.triggers) {
                     f.Remove (trg);
                 }
                 f.showTriggers = false;
             } else {
                 foreach (Trigger trg in f.Model.triggers) {
                     f.Add (trg);
                 }
                 f.showTriggers = true;
             }
         }
         if (_locator is ColumnAddLocator){
             //Add a new column to table
             f.addNewColumn();
         }
         if (_locator is ColumnRemoveLocator){
             //Activate a state where the figure wait for the user to click a column and then delete it
             f.activateRemoveColumn();
         }
         if (_locator is ForeignKeyLocator){
             //Start Creation of Foreign Key
             RelationshipFigure rel = new RelationshipFigure ();
             f.figureCanvas.Tool = new ConnectionCreationTool (f.figureCanvas, rel);
             f.figureCanvas.Tool.MouseDown(new MouseEvent(f.figureCanvas.View,null,new Cairo.PointD(x,y)));
         }
         if (_locator is RemoveTableLocator){
             //Remove Table Selected
             f.unPopulateTable();
             //view.ToggleSelection(f);
             view.ClearSelection ();
             view.Drawing.Remove(f);
             view.Remove(f);
             List<RelationshipFigure> deleteFigures = new List<RelationshipFigure>();
             foreach ( IFigure fig in view.Drawing.FiguresEnumerator){
                     if(fig is RelationshipFigure){
                         TableFigure startTable=((fig as RelationshipFigure).StartFigure as TableFigure);
                         TableFigure endTable=((fig as RelationshipFigure).EndFigure as TableFigure);
                         if(startTable.Model.Name==f.Model.Name || endTable.Model.Name==f.Model.Name)
                             deleteFigures.Add(fig as RelationshipFigure);
                     }
                 }
             if(deleteFigures.Count>0){
                 view.ClearSelection ();
                 foreach(RelationshipFigure delRelationship in deleteFigures){
                         view.Drawing.Remove(delRelationship);
                     }
                 }
         }
     }
 }
        private void DeleteFigures(IDrawingView view)
        {
            IEnumerable<Figure> figures = view.SelectionEnumerator.ToFigures ();

            view.ClearSelection ();
            view.RemoveRange (figures);
        }