Ejemplo n.º 1
0
        public void AddObject(GuiItem item, string name_base)
        {
            item.parent = this;
            if (item is INeedRefresh)
            {
                RefreshObject((INeedRefresh)item);
            }
            item.id = RegisterItemID(name_base, item);
            item.Invalidate();
            Undo.Push(new CreateOperation((IRemoveable)item), false);

            // add relations
            if (item is GuiClass)
            {
                GuiClass cl = (GuiClass)item;
                for (int i = 0; i < active_objects.Count; i++)
                {
                    GuiObject obj = (GuiObject)active_objects[i];
                    if (obj is GuiClass)
                    {
                        foreach (UmlRelation rel in RelationsHelper.GetRelations(((GuiClass)obj).st, proj.model))
                        {
                            if (rel.dest == cl.st || rel.src == cl.st)
                            {
                                NewRelation(rel);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Drop( )
        {
            if (dropitem == null)
            {
                throw new ArgumentException("have nothing to drop");
            }

            parent.AddObject(dropitem, UmlModel.GetUniversal(dropobj));
            action = MouseAction.None;

            // insert Inheritance
            ArrayList l = new ArrayList(parent.active_objects);

            foreach (GuiObject a in l)
            {
                if (a is GuiClass)
                {
                    GuiClass c = a as GuiClass;

                    // TODO ?????????

                    /*if( c.st.bases != null && c.st.bases.Contains( dropitem.st.fullname ) ) {
                     *      NewRelation( dropitem, c, UmlRelationType.Inheritance );
                     * } else if( dropitem.st.bases != null && dropitem.st.bases.Contains( c.st.fullname ) ) {
                     *      NewRelation( c, dropitem, UmlRelationType.Inheritance );
                     * }*/
                }
            }
            dropitem = null;
        }
Ejemplo n.º 3
0
 public StaticViewMouseAgent( StaticView p )
 {
     parent = p;
     dropitem = null;
     action = MouseAction.None;
     scroll_active = false;
     scroll_dx = scroll_dy = 0;
     scroll_buttons = MouseButtons.None;
     scroll_timer = new System.Threading.Timer( new TimerCallback( ScrollTimerCallback ), null, Timeout.Infinite, SCROLL_TIMEOUT );
 }
Ejemplo n.º 4
0
 public override void StopDrag()
 {
     if (dropitem == null)
     {
         throw new ArgumentException("have nothing to stop");
     }
     dropitem.Invalidate();
     dropitem = null;
     action   = MouseAction.None;
 }
Ejemplo n.º 5
0
 public StaticViewMouseAgent(StaticView p)
 {
     parent         = p;
     dropitem       = null;
     action         = MouseAction.None;
     scroll_active  = false;
     scroll_dx      = scroll_dy = 0;
     scroll_buttons = MouseButtons.None;
     scroll_timer   = new System.Threading.Timer(new TimerCallback(ScrollTimerCallback), null, Timeout.Infinite, SCROLL_TIMEOUT);
 }
Ejemplo n.º 6
0
        // Drag-n-drop functions

        public override void StartDrag(UmlObject elem)
        {
            dropobj  = elem;
            dropitem = GuiElementFactory.CreateElement(elem);

            if (dropitem != null)
            {
                System.Diagnostics.Debug.Assert(dropitem is IMoveable && dropitem is IRemoveable, "wrong element created");
                dropitem.parent = parent;
                if (dropitem is INeedRefresh)
                {
                    parent.RefreshObject((INeedRefresh)dropitem);
                }
                action = MouseAction.Drag;
            }
            else
            {
                action = MouseAction.None;
            }
        }
Ejemplo n.º 7
0
 public override void StopDrag()
 {
     if( dropitem == null )
         throw new ArgumentException( "have nothing to stop" );
     dropitem.Invalidate();
     dropitem = null;
     action = MouseAction.None;
 }
Ejemplo n.º 8
0
        // Drag-n-drop functions
        public override void StartDrag( UmlObject elem )
        {
            dropobj = elem;
            dropitem = GuiElementFactory.CreateElement( elem );

            if( dropitem != null ) {
                System.Diagnostics.Debug.Assert( dropitem is IMoveable && dropitem is IRemoveable, "wrong element created" );
                dropitem.parent = parent;
                if( dropitem is INeedRefresh )
                    parent.RefreshObject( (INeedRefresh)dropitem );
                action = MouseAction.Drag;
            } else
                action = MouseAction.None;
        }
Ejemplo n.º 9
0
        public override void Drop( )
        {
            if( dropitem == null )
                throw new ArgumentException( "have nothing to drop" );

            parent.AddObject( dropitem, UmlModel.GetUniversal(dropobj) );
            action = MouseAction.None;

            // insert Inheritance
            ArrayList l = new ArrayList( parent.active_objects );
            foreach( GuiObject a in l )
                if( a is GuiClass ) {
                    GuiClass c = a as GuiClass;

                    // TODO ?????????
                    /*if( c.st.bases != null && c.st.bases.Contains( dropitem.st.fullname ) ) {
                        NewRelation( dropitem, c, UmlRelationType.Inheritance );
                    } else if( dropitem.st.bases != null && dropitem.st.bases.Contains( c.st.fullname ) ) {
                        NewRelation( c, dropitem, UmlRelationType.Inheritance );
                    }*/
                }
            dropitem = null;
        }
Ejemplo n.º 10
0
        public void AddObject( GuiItem item, string name_base )
        {
            item.parent = this;
            if( item is INeedRefresh )
                RefreshObject( (INeedRefresh)item );
            item.id = RegisterItemID( name_base, item );
            item.Invalidate();
            Undo.Push( new CreateOperation( (IRemoveable)item ), false );

            // add relations
            if( item is GuiClass ) {
                GuiClass cl = (GuiClass)item;
                for( int i = 0; i < active_objects.Count; i++ ) {
                    GuiObject obj = (GuiObject)active_objects[i];
                    if( obj is GuiClass )
                        foreach( UmlRelation rel in RelationsHelper.GetRelations( ((GuiClass)obj).st, proj.model ) )
                            if( rel.dest == cl.st || rel.src == cl.st )
                                NewRelation( rel );
                }
            }
        }