コード例 #1
0
ファイル: StaticView.cs プロジェクト: presscad/BaseLayer
        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);
                            }
                        }
                    }
                }
            }
        }
コード例 #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;
        }
コード例 #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 );
 }
コード例 #4
0
 public override void StopDrag()
 {
     if (dropitem == null)
     {
         throw new ArgumentException("have nothing to stop");
     }
     dropitem.Invalidate();
     dropitem = null;
     action   = MouseAction.None;
 }
コード例 #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);
 }
コード例 #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;
            }
        }
コード例 #7
0
 public override void StopDrag()
 {
     if( dropitem == null )
         throw new ArgumentException( "have nothing to stop" );
     dropitem.Invalidate();
     dropitem = null;
     action = MouseAction.None;
 }
コード例 #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;
        }
コード例 #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;
        }
コード例 #10
0
ファイル: StaticView.cs プロジェクト: inspirer/uml-designer
        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 );
                }
            }
        }