Inheritance: AttributeFigure
Ejemplo n.º 1
0
        public DigitalClockFigure()
        {
            _now = DateTime.Now;

            _hour            = new DigitalClockTextFigure (DigitalClockValueType.Hour, "XX");
            _hourSeparator   = new DigitalClockTextFigure (DigitalClockValueType.Separator, ":");
            _hourSeparator.TextEditable = false;
            _minute          = new DigitalClockTextFigure (DigitalClockValueType.Minute, "XX");
            _minuteSeparator = new DigitalClockTextFigure (DigitalClockValueType.Separator, ":");
            _minuteSeparator.TextEditable = false;
            _second          = new DigitalClockTextFigure (DigitalClockValueType.Second, "XX");

            _list = new List <SimpleTextFigure> ();
            _list.Add (_hour);
            _list.Add (_hourSeparator);
            _list.Add (_minute);
            _list.Add (_minuteSeparator);
            _list.Add (_second);

            foreach (DigitalClockTextFigure figure in _list) {
                figure.TextChanged += delegate (object sender, EventArgs args) {
                    MoveTextFigures ();
                    UpdateDateTime ();
                };
                figure.FigureChanged += delegate (object sender, FigureEventArgs args) {

                    UpdateDisplayBox ();
                };
            }

            GLib.Timeout.Add (500, new GLib.TimeoutHandler (UpdateClock));
        }
Ejemplo n.º 2
0
        public TypeMemberGroupFigure(string name)
            : base()
        {
            Spacing = 5;
            Alignment = VStackAlignment.Left;

            groupName = new SimpleTextFigure(name);
            groupName.Padding = 0;
            groupName.FontSize = 10;
            groupName.FontColor = new Cairo.Color(0.3, 0.0, 0.0);

            Add(groupName);

            membersStack = new VStackFigure();
            membersStack.Spacing = 2;

            expandHandle = new ToggleButtonHandle(this, new AbsoluteLocator(-10, 7.5));
            expandHandle.Toggled += delegate(object sender, ToggleEventArgs e) {
                if (e.Active) {
                    Add(membersStack);
                }
                else {
                    Remove(membersStack);
                }
            };
            expandHandle.Active = true;
        }
Ejemplo n.º 3
0
        public ClassFigure()
            : base()
        {
            FillColor = new Cairo.Color(0.8, 0.0, 0.0, 0.8);

            classname = new SimpleTextFigure("ClassName");
        }
        public TypeMemberGroupFigure(string name)
            : base()
        {
            Spacing = 10;
            Alignment = VStackAlignment.Left;

            groupName = new SimpleTextFigure(name);
            groupName.Padding = 0;
            groupName.FontSize = 12;
            groupName.FontColor = new Cairo.Color(0.3, 0.0, 0.0);
            groupName.FontFamily = Pango.Weight.Heavy.ToString();
            //groupName.FontColor  = new Cairo.Color(1.0,1.0,1.0);
            //this.FillColor = new Cairo.Color(1.0,1.0,1.0);
            Add(groupName);

            membersStack = new VStackFigure();
            membersStack.Spacing = 8;

            expandHandle = new ToggleButtonHandle(this, new AbsoluteLocator(-10, 7.5));
            expandHandle.Toggled += delegate(object sender, ToggleEventArgs e) {
                if (e.Active) {
                    Add(membersStack);
                }
                else {
                    Remove(membersStack);
                }
            };

            expandHandle.Active = true;
            expandHandle.FillColor = new Cairo.Color(0,0,0.0,0.0);
            expandHandle.Height = 10;
            expandHandle.Width = 10;
        }
		public SimpleTextTool (IDrawingEditor editor, SimpleTextFigure fig, ITool dt) 
			: base (editor, fig, dt) {
			_entry = new Gtk.Entry ();
			_entry.HasFrame = false;
			_entry.Alignment = 0.5f;
			_entry.Changed += new System.EventHandler (ChangedHandler);
			_entry.ModifyFont (fig.PangoLayout.FontDescription.Copy ());
		}
Ejemplo n.º 6
0
        public TypeMemberFigure(Pixbuf icon, string retvalue, string name)
            : base()
        {
            _icon = new PixbufFigure(icon);
            _retvalue = new SimpleTextFigure(retvalue);
            _name = new SimpleTextFigure(name);

            _name.Padding = 0.0;
            _name.FontSize = 10;
            _retvalue.Padding = 0.0;
            _retvalue.FontSize = 10;
            _retvalue.FontColor = new Cairo.Color(0, 0, 1.0);

            Alignment = HStackAlignment.Bottom;

            Add(_icon);
            Add(_retvalue);
            Add(_name);
        }
Ejemplo n.º 7
0
        public TypeHeaderFigure()
            : base()
        {
            namespaceFigure = new SimpleTextFigure("Namespace");
            namespaceFigure.Padding = 0;
            namespaceFigure.FontSize = 7;

            typeFigure = new SimpleTextFigure("Type");
            typeFigure.Padding = 0;
            typeFigure.FontSize = 7;

            nameFigure = new SimpleTextFigure("Name");
            nameFigure.Padding = 0;
            nameFigure.FontSize = 12;

            Spacing = 0.0;

            Add(typeFigure);
            Add(namespaceFigure);
            Add(nameFigure);
        }
Ejemplo n.º 8
0
        public TypeHeaderFigure(Pixbuf icon)
            : base()
        {
            namespaceFigure = new SimpleTextFigure("Namespace");
            namespaceFigure.Padding = 0;
            namespaceFigure.FontSize = 9;

            typeFigure = new SimpleTextFigure("Type");
            typeFigure.Padding = 0;
            typeFigure.FontSize = 7;

            nameFigure = new SimpleTextFigure("Name");
            nameFigure.Padding = 0;
            nameFigure.FontSize = 12;

            Spacing = 3.0;
            _icon = new PixbufFigure(icon);
            //Add(new TypeMemberFigure(icon,"",typeFigure.Text));
            Add(_icon);
            //Add(typeFigure);
            Add(namespaceFigure);
            Add(nameFigure);
        }
 public SimpleTextTool(IDrawingEditor editor, SimpleTextFigure fig, ITool dt, MouseEvent ev)
     : this(editor, fig, dt)
 {
     View = ev.View;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Returns all the figures to be drawn
        /// </summary>
        /// <returns>The figures.</returns>
        /// <param name="cls">Project details.</param>
        public IEnumerable<IFigure> GetFigures(UMLClass cls)
        {
            // We build trees with the input
            Roots = GetTreeRoots(cls);

            #region Class Blocks
            double x = X_START;
            double y = Y_START;
            // For each tree, we perform a level order traversal
            // and draw the tree in that order. This, will make sure
            // that links don't overlap each other.
            foreach(var root in Roots)
            {
                if(root.children.Count == 0){
                    //figures.Add(new ClassFigure((ClassNode)root.Node));
                    Singles.Add(new ClassFigure((ClassNode)root.Node));
                    continue;
                }
                Queue<TreeNode> queue1 = new Queue<TreeNode>();
                Queue<TreeNode> queue2 = new Queue<TreeNode>();
                queue1.Enqueue(root);
                int level = 0;
                x = X_START;
                var root_figure = new ClassFigure((ClassNode)root.Node);
                root_figure.MoveTo(x,y);
                figures.Add(root_figure);
                while(queue1.Count != 0 || queue2.Count != 0){
                    while(queue1.Count !=0){
                        var parent = queue1.Dequeue();
                        foreach(var child in parent.children){
                            queue2.Enqueue(child);
                        }
                    }
                    level = level + 1;

                    x = X_START;
                    y+= Y_INCREMENT;
                    foreach(var node in queue2){
                        var figure = new ClassFigure((ClassNode)node.Node);
                        figure.MoveTo(x,y);
                        x += figure.DisplayBox.Width + 50.0;
                        figures.Add(figure);
                        //connections.Add(new InheritanceConnectionFigure(figure, node.P
                    }
                    if(queue2.Count == 0) continue;
                    while(queue2.Count !=0){
                        var parent = queue2.Dequeue();
                        foreach(var child in parent.children){
                            queue1.Enqueue(child);
                        }
                    }
                    level = level + 1;
                    x = X_START;
                    y+= Y_INCREMENT;
                    foreach(var node in queue1){
                        var figure = new ClassFigure((ClassNode)node.Node);
                        figure.MoveTo(x,y);
                        x += figure.DisplayBox.Width + 50.0;
                        figures.Add(figure);
                    }

                }
            }
            #endregion Class Blocks

            #region Links
            foreach(var node in cls.ClassNodes){
                // Add all inheritance links
                TypeFigure subclass = GetFigure(node.Namespace);
                foreach(var link in node.Links){
                    TypeFigure superclass = GetFigure(link);
                    if (subclass != null && superclass != null) {
                        InheritanceConnectionFigure connection = new InheritanceConnectionFigure(subclass, superclass);
                        yield return connection;
                    }
                }
                if(node.Implementations.Count ==0) continue;

                // Handle implementations
                string imps = "";
                //Position the text to the center of the box
                string space_string = "";
                int len = subclass.Namespace.Length;

                foreach(var implementation in node.Implementations)
                {
                    for(int i =0;i<(len - implementation.Length) /2;i++) space_string +=" ";

                    imps= imps + space_string + implementation + space_string;
                    imps+="\n";
                }
                SimpleTextFigure interf = new SimpleTextFigure(imps);
                figureToInterfaces.Add(subclass.Namespace,interf);
                InheritanceConnectionFigure connex = new InheritanceConnectionFigure(subclass, interf);
                yield return connex;

            }
            //Positioning the interface names on top of the class figures
            foreach(var item in figures){
                if(figureToInterfaces.ContainsKey(item.Namespace)){
                    var simple = figureToInterfaces[item.Namespace];
                    simple.MoveTo(item.DisplayBox.X,item.DisplayBox.Y-50);
                    yield return simple;
                }
                yield return item;
            }
            #endregion Links

            #region Single Nodes
            // Draw single nodes in a row
            x = X_START;
            foreach(var item in Singles){
                item.MoveTo(x,y);
                x += item.DisplayBox.Width + SINGLES_GAP;
                if(x>PAGE_WIDTH_LIMIT){
                    x = X_START;
                    y+= Y_INCREMENT;
                }
                if(figureToInterfaces.ContainsKey(item.Namespace)){
                    var simple = figureToInterfaces[item.Namespace];
                    simple.MoveTo(item.DisplayBox.X,item.DisplayBox.Y-50);
                    yield return simple;
                }
                yield return item;
            }

            // Next, all structures, enum and interfaces are drawn.
            foreach(var node in cls.StructNodes){
                var item = new StructFigure(node);
                item.MoveTo(x,y);
                x += item.DisplayBox.Width + SINGLES_GAP;
                if(x>PAGE_WIDTH_LIMIT){
                    x = X_START;
                    y+= Y_INCREMENT;
                }
                yield return item;
            }
            foreach(var node in cls.EnumNodes){
                var item = new EnumFigure(node);
                item.MoveTo(x,y);
                x += item.DisplayBox.Width + SINGLES_GAP;
                if(x> PAGE_WIDTH_LIMIT){
                    x = X_START;
                    y+= Y_INCREMENT;
                }
                yield return item;
            }
            foreach(var node in cls.InterfaceNodes){
                var item = new InterfaceFigure(node);
                item.MoveTo(x,y);
                x += item.DisplayBox.Width + SINGLES_GAP;
                if(x>PAGE_WIDTH_LIMIT){
                    x = X_START;
                    y+= Y_INCREMENT;
                }
                yield return item;
            }
            #endregion Single Nodes
        }
        private void populateTable()
        {
            //Create Labels
            _tableName = new PlainSimpleTextFigure (_tableModel.Name);
            _tableName.SetAttribute (FigureAttribute.FontSize, 7);
            _tableName.SetAttribute (FigureAttribute.FontColor, new Cairo.Color (0, 0, 0.501961));
            //TODO: don't change name at each letter changed
            _tableName.TextChanged += delegate { Model.Name = _tableName.Text; };

            _indexLabel = new PlainSimpleTextFigure ("Indexes");
            _indexLabel.SetAttribute (FigureAttribute.FontColor, new Cairo.Color (0, 0, 0.501961));
            _indexLabel.SetAttribute (FigureAttribute.FontSize, 6);

            _triggerLabel = new PlainSimpleTextFigure ("Triggers");
            _triggerLabel.SetAttribute (FigureAttribute.FontColor, new Cairo.Color (0, 0, 0.501961));
            _triggerLabel.SetAttribute (FigureAttribute.FontSize, 6);
            //Add Table Columns & Name
            this.Add (_tableName);
            _tableName.MoveTo (DisplayBox.X + 2, DisplayBox.Y + 2);
            foreach (AbstractColumnFigure col in _tableModel.columns) {
                this.Add (col);
            }

            //TODO: Add/Detect Foreign Keys that table model have

            //Add Table Indexes Label (items added at ButtonHandle)
            this.Add (_indexLabel);
            //Add Table Triggers Label (items added at ButtonHandle)
            this.Add (_triggerLabel);

            OnFigureChanged (new FigureEventArgs (this, DisplayBox));
        }
Ejemplo n.º 12
0
		public TextTool (IDrawingEditor editor, SimpleTextFigure fig, ITool dt) 
			: base (editor, fig, dt) {
		}
Ejemplo n.º 13
0
        public IEnumerable<IFigure> GetFigures(UMLClass cls)
        {
            // Add all entities
            foreach(var classnode in cls.ClassNodes){
                figures.Add(new ClassFigure(classnode));
                AllNodes.Add(classnode);
                //NodeMapping.Add(classnode.Namespace,classnode);
            }
            foreach(var interfacenode in cls.InterfaceNodes){
                figures.Add(new InterfaceFigure(interfacenode));
                AllNodes.Add(interfacenode);
                //NodeMapping.Add(interfacenode.Namespace,interfacenode);
            }
            foreach(var structnode in cls.StructNodes){
                figures.Add(new StructFigure(structnode));
                AllNodes.Add(structnode);
                //NodeMapping.Add(structnode.Namespace,structnode);
            }
            foreach(var enumnode in cls.EnumNodes){
                figures.Add(new EnumFigure(enumnode));
                AllNodes.Add(enumnode);
                //NodeMapping.Add(enumnode.Namespace,enumnode);
            }

            // Iterate over links of all entities and draw links.
            foreach (var node in AllNodes) {
                TypeFigure subclass = GetFigure(node.Namespace);
                foreach(var link in node.Links){
                    TypeFigure superclass = GetFigure(link);
                    if (subclass != null && superclass != null) {
                        InheritanceConnectionFigure connection = new InheritanceConnectionFigure(subclass, superclass);
                        //connection.EndHandle.Owner.
                        yield return connection;
                    }
                }
                if(node.Implementations.Count ==0) continue;
                string imps = "";
                foreach(var implementation in node.Implementations)
                {
                    imps+=implementation;
                    imps+="\n";
                }
                SimpleTextFigure interf = new SimpleTextFigure(imps);
                figureToInterfaces.Add(subclass.Namespace,interf);
                implementations.Add(interf);
                InheritanceConnectionFigure connex = new InheritanceConnectionFigure(subclass, interf);
                yield return connex;

            }
            double x = 50.0;
            double y = 50.0;

            foreach (TypeFigure figure in figures)  {
                figure.MoveTo(x, y);
                if(figureToInterfaces.ContainsKey(figure.Namespace)){
                    var simple = figureToInterfaces[figure.Namespace];
                    simple.MoveTo(x,y-50);
                    yield return simple;
                }
                yield return figure;
                x += figure.DisplayBox.Width + 50.0;
                if (x > 1000.0) {
                    x = 50.0;
                    y += figure.DisplayBox.Height + 100.0;

                }
            }
            //foreach(var figure in implementations)
            //{
            //    figure.MoveTo(x,y);
            //    yield return figure;
            //    x += figure.DisplayBox.Width + 50.0;
            //    if (x > 1000.0) {
            //        x = 50.0;
            //        y += figure.DisplayBox.Height + 100.0;
            //    }
            //}
        }
Ejemplo n.º 14
0
 protected virtual void OnAddSimpleTextFigureActionActivated(object sender, System.EventArgs e)
 {
     SimpleTextFigure figure = new SimpleTextFigure("Hello World");
     figure.Padding = 0;
     mhdcanvas.AddWithDragging(figure);
 }