Beispiel #1
0
 public FlatToolBarPanel AddPanel( int row, string name )
 {
     FlatToolBarPanel p = new FlatToolBarPanel( 100000, row  * (BarPanelHeight + 2), name, this );
     panels.Add( p );
     FixupHeightAndRows( p, -1 );
     p.ChangedPosition();
     return p;
 }
Beispiel #2
0
        public FlatToolBarPanel AddPanel(int row, string name)
        {
            FlatToolBarPanel p = new FlatToolBarPanel(100000, row * (BarPanelHeight + 2), name, this);

            panels.Add(p);
            FixupHeightAndRows(p, -1);
            p.ChangedPosition();
            return(p);
        }
Beispiel #3
0
 public FlatToolBarButton(Control c, FlatToolBarPanel p)
 {
     style  = FlatButtonType.Control;
     cb     = c;
     state  = FlatButtonState.Basic;
     parent = p;
     parent.parent.Controls.Add(cb);
     width    = c.Width + 4;
     c.Height = 18;
 }
Beispiel #4
0
        public int CompareTo(object obj)
        {
            if (obj is FlatToolBarPanel)
            {
                FlatToolBarPanel t = (FlatToolBarPanel)obj;
                return(place.X.CompareTo(t.place.X));
            }

            throw new ArgumentException("wrong object in compare");
        }
Beispiel #5
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            int x = e.X - ClientRectangle.X, y = e.Y - ClientRectangle.Y;

            if (!moving)
            {
                foreach (FlatToolBarPanel p in panels)
                {
                    if (p.place.Contains(x, y))
                    {
                        if (!p.MouseMove(x - p.place.X, y - p.place.Y))
                        {
                            Cursor.Current = Cursors.SizeAll;
                            move_x         = x - p.place.X;
                            move_y         = y - p.place.Y;
                            ready_to_move  = true;
                            move_panel     = p;

                            if (highlighted != null)
                            {
                                highlighted.RemoveHighlight();
                            }
                            highlighted = null;
                            tt.Active   = false;
                            return;
                        }
                        else
                        {
                            if (highlighted != p && highlighted != null)
                            {
                                highlighted.RemoveHighlight();
                            }
                            highlighted = p;
                        }
                    }
                }
                ready_to_move  = false;
                Cursor.Current = Cursors.Arrow;
            }
            else
            {
                int old_y = move_panel.place.Y;
                move_panel.place.Y = (y + 3) / (BarPanelHeight + 2) * (BarPanelHeight + 2);
                if (move_panel.place.Y < 0)
                {
                    move_panel.place.Y = 0;
                }
                move_panel.place.X = x - move_x;

                FixupHeightAndRows(move_panel, old_y);
                move_panel.ChangedPosition();
            }
        }
Beispiel #6
0
        public void RemovePanel(FlatToolBarPanel p)
        {
            if (highlighted != null)
            {
                highlighted.RemoveHighlight();
            }
            highlighted = null;

            if (panels.IndexOf(p) != -1)
            {
                panels.Remove(p);
                FixupHeightAndRows(p, -1);
            }
        }
Beispiel #7
0
        public FlatToolBarButton(FlatButtonType t, int index, MouseClickEvent e, string title, FlatToolBarPanel p)
        {
            style       = t;
            this.title  = title;
            ev          = e;
            state       = FlatButtonState.Basic;
            image_index = index;
            parent      = p;
            switch (t)
            {
            case FlatButtonType.Control:
                throw new ArgumentException("wrong type: control");

            case FlatButtonType.Line: width = FlatToolBarPanel.LineWidth; break;

            case FlatButtonType.Radio:
            case FlatButtonType.RadioDown:
            case FlatButtonType.Simple:
                width = 23; break;
            }
        }
Beispiel #8
0
        public override ArrayList LoadToolbars()
        {
            ArrayList   l       = new ArrayList();
            FlatToolBar toolbar = proj.tool_bar;

            UMLDes.Controls.MouseClickEvent  m = new UMLDes.Controls.MouseClickEvent(ToolbarAction);
            UMLDes.Controls.FlatToolBarPanel p;

            // UML Elements drawing
            p = toolbar.AddPanel(0, "UML");
            l.Add(p);
            defbutton = p.AddButton(FlatButtonType.RadioDown, (int)ToolBarIcons.arrow, "Select", m);
            p.AddButton(FlatButtonType.Line, 0, null, null);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.conn_inher, "Draw inhreitance", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.conn_assoc, "Draw association", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.conn_aggregation, "Draw aggregation", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.conn_composition, "Draw composition", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.conn_attachm, "Draw attachment", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.conn_dependence, "Draw dependency/usage", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.conn_realiz, "Draw realization", m);
            p.AddButton(FlatButtonType.Line, 0, null, null);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.memo, "Draw memo", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.package, "Draw package", m);
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.constraint, "Draw constraint", m).disabled = true;
            p.AddButton(FlatButtonType.Radio, (int)ToolBarIcons.actor, "Draw actor", m).disabled           = true;
            drawingmode = p;

            p = toolbar.AddPanel(0, "Default line type");
            l.Add(p);
            p.AddButton(MouseAgent.conn_style == GuiConnectionStyle.Line           ? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.straight_conn, "Line", m);
            p.AddButton(MouseAgent.conn_style == GuiConnectionStyle.Segmented ? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.segmented_conn, "Segmented", m);
            p.AddButton(MouseAgent.conn_style == GuiConnectionStyle.Quadric        ? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.quadric_conn, "Quadric", m);
            p.AddButton(MouseAgent.conn_style == GuiConnectionStyle.Besier ? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.curved_conn, "Bezier", m).disabled = true;
            p.AddButton(FlatButtonType.Line, 0, null, null);
            p.AddButton(FlatButtonType.Simple, (int)ToolBarIcons.show_qual, "Show full qualified", m).disabled       = true;
            p.AddButton(FlatButtonType.Simple, (int)ToolBarIcons.oper_signature, "Operations signature", m).disabled = true;

            return(l);
        }
Beispiel #9
0
        public void RemovePanel( FlatToolBarPanel p )
        {
            if( highlighted != null )
                highlighted.RemoveHighlight();
            highlighted = null;

            if( panels.IndexOf( p ) != -1 ) {
                panels.Remove( p );
                FixupHeightAndRows( p, -1 );
            }
        }
Beispiel #10
0
 public FlatToolBarButton( Control c, FlatToolBarPanel p )
 {
     style = FlatButtonType.Control;
     cb = c;
     state = FlatButtonState.Basic;
     parent = p;
     parent.parent.Controls.Add( cb );
     width = c.Width + 4;
     c.Height = 18;
 }
Beispiel #11
0
 public FlatToolBarButton( FlatButtonType t, int index, MouseClickEvent e, string title, FlatToolBarPanel p )
 {
     style = t;
     this.title = title;
     ev = e;
     state = FlatButtonState.Basic;
     image_index = index;
     parent = p;
     switch( t ) {
         case FlatButtonType.Control:
             throw new ArgumentException( "wrong type: control" );
         case FlatButtonType.Line: width = FlatToolBarPanel.LineWidth; break;
         case FlatButtonType.Radio: case FlatButtonType.RadioDown: case FlatButtonType.Simple:
             width = 23;break;
     }
 }
Beispiel #12
0
        void FixupHeightAndRows( FlatToolBarPanel pp, int prev_y )
        {
            bool need_validation = false;

            // fix the height of the Toolbar control
            if( pp.place.Bottom > this.Height ) {
                this.Height = pp.place.Bottom;
                need_validation = true;
            }
            int height = BarPanelHeight;
            foreach( FlatToolBarPanel p in panels )
                if( p.place.Bottom > height )
                    height = p.place.Bottom;
            if( height < this.Height ) {
                this.Height = height;
                need_validation = true;
            }

            FlatToolBarPanel[] arr = (FlatToolBarPanel[])panels.ToArray(typeof(FlatToolBarPanel));
            Array.Sort( arr );

            int x = 0;

            // fixup Panels in the row of pp
            foreach( FlatToolBarPanel p in arr )
                if( p.place.Y == pp.place.Y ) {
                    if( p.place.X != x ) {
                        need_validation = true;
                        p.place.X = x;
                        p.ChangedPosition();
                    }
                    x = p.place.Right + 4;
                }

            if( prev_y != -1 ) {
                x = 0;
                foreach( FlatToolBarPanel p in arr )
                    if( p.place.Y == prev_y ) {
                        if( p.place.X != x ) {
                            need_validation = true;
                            p.place.X = x;
                            p.ChangedPosition();
                        }
                        x = p.place.Right + 4;
                    }
            }

            if( need_validation )
                Invalidate();
        }
Beispiel #13
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            int x = e.X - ClientRectangle.X, y = e.Y - ClientRectangle.Y;

            if( !moving ) {
                foreach( FlatToolBarPanel p in panels )
                    if( p.place.Contains( x, y ) ) {
                        if( !p.MouseMove(x-p.place.X,y-p.place.Y ) ) {
                            Cursor.Current = Cursors.SizeAll;
                            move_x = x - p.place.X;
                            move_y = y - p.place.Y;
                            ready_to_move = true;
                            move_panel = p;

                            if( highlighted != null )
                                highlighted.RemoveHighlight();
                            highlighted = null;
                            tt.Active = false;
                            return;
                        } else {
                            if( highlighted != p && highlighted != null )
                                highlighted.RemoveHighlight();
                            highlighted = p;
                        }
                    }
                ready_to_move = false;
                Cursor.Current = Cursors.Arrow;
            } else {
                int old_y = move_panel.place.Y;
                move_panel.place.Y = ( y + 3 ) / (BarPanelHeight+2) * (BarPanelHeight+2);
                if( move_panel.place.Y < 0 )
                    move_panel.place.Y = 0;
                move_panel.place.X = x - move_x;

                FixupHeightAndRows( move_panel, old_y );
                move_panel.ChangedPosition();
            }
        }
Beispiel #14
0
        void FixupHeightAndRows(FlatToolBarPanel pp, int prev_y)
        {
            bool need_validation = false;

            // fix the height of the Toolbar control
            if (pp.place.Bottom > this.Height)
            {
                this.Height     = pp.place.Bottom;
                need_validation = true;
            }
            int height = BarPanelHeight;

            foreach (FlatToolBarPanel p in panels)
            {
                if (p.place.Bottom > height)
                {
                    height = p.place.Bottom;
                }
            }
            if (height < this.Height)
            {
                this.Height     = height;
                need_validation = true;
            }

            FlatToolBarPanel[] arr = (FlatToolBarPanel[])panels.ToArray(typeof(FlatToolBarPanel));
            Array.Sort(arr);

            int x = 0;

            // fixup Panels in the row of pp
            foreach (FlatToolBarPanel p in arr)
            {
                if (p.place.Y == pp.place.Y)
                {
                    if (p.place.X != x)
                    {
                        need_validation = true;
                        p.place.X       = x;
                        p.ChangedPosition();
                    }
                    x = p.place.Right + 4;
                }
            }

            if (prev_y != -1)
            {
                x = 0;
                foreach (FlatToolBarPanel p in arr)
                {
                    if (p.place.Y == prev_y)
                    {
                        if (p.place.X != x)
                        {
                            need_validation = true;
                            p.place.X       = x;
                            p.ChangedPosition();
                        }
                        x = p.place.Right + 4;
                    }
                }
            }

            if (need_validation)
            {
                Invalidate();
            }
        }
Beispiel #15
0
        public override ArrayList LoadToolbars()
        {
            ArrayList l = new ArrayList();
            FlatToolBar toolbar = proj.tool_bar;

            UMLDes.Controls.MouseClickEvent m = new UMLDes.Controls.MouseClickEvent(ToolbarAction);
            UMLDes.Controls.FlatToolBarPanel p;

            // UML Elements drawing
            p = toolbar.AddPanel( 0, "UML" );
            l.Add( p );
            defbutton = p.AddButton( FlatButtonType.RadioDown, (int)ToolBarIcons.arrow, "Select", m );
            p.AddButton( FlatButtonType.Line, 0, null, null );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.conn_inher, "Draw inhreitance", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.conn_assoc, "Draw association", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.conn_aggregation, "Draw aggregation", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.conn_composition, "Draw composition", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.conn_attachm, "Draw attachment", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.conn_dependence, "Draw dependency/usage", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.conn_realiz, "Draw realization", m );
            p.AddButton( FlatButtonType.Line, 0, null, null );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.memo, "Draw memo", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.package, "Draw package", m );
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.constraint, "Draw constraint", m ).disabled = true;
            p.AddButton( FlatButtonType.Radio, (int)ToolBarIcons.actor, "Draw actor", m ).disabled = true;
            drawingmode = p;

            p = toolbar.AddPanel( 0, "Default line type" );
            l.Add( p );
            p.AddButton( MouseAgent.conn_style == GuiConnectionStyle.Line		? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.straight_conn, "Line", m );
            p.AddButton( MouseAgent.conn_style == GuiConnectionStyle.Segmented ? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.segmented_conn, "Segmented", m );
            p.AddButton( MouseAgent.conn_style == GuiConnectionStyle.Quadric	? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.quadric_conn, "Quadric", m );
            p.AddButton( MouseAgent.conn_style == GuiConnectionStyle.Besier	? FlatButtonType.RadioDown : FlatButtonType.Radio, (int)ToolBarIcons.curved_conn, "Bezier", m ).disabled = true;
            p.AddButton( FlatButtonType.Line, 0, null, null );
            p.AddButton( FlatButtonType.Simple, (int)ToolBarIcons.show_qual, "Show full qualified", m ).disabled = true;
            p.AddButton( FlatButtonType.Simple, (int)ToolBarIcons.oper_signature, "Operations signature", m ).disabled = true;

            return l;
        }