Exemple #1
0
        private void DrawHeaderText(Graphics g)
        {
            if (!(Entity is TypeBase))
            {
                return;
            }

            TypeBase         type      = (TypeBase)Entity;
            ContentAlignment alignment = Style.CurrentStyle.HeaderAlignment;

            RectangleF textArea;
            string     name = type.Name;

            textArea = new RectangleF(MarginSize, MarginSize, Width - MarginSize * 2,
                                      HeaderHeight - MarginSize * 2 + 1);

            if (HasIdentifier)
            {
                string identifier = (Style.CurrentStyle.ShowSignature) ?
                                    type.Signature : type.Stereotype;
                float nameHeight       = NameFont.GetHeight();
                float identifierHeight = IdentifierFont.GetHeight();
                float textHeight       = nameHeight + identifierHeight;

                textArea.Y = GetHeaderTextTop(textArea, textHeight,
                                              Style.CurrentStyle.HeaderAlignment);
                textArea.Height = textHeight;

                // Drawing signature
                if (Style.CurrentStyle.ShowSignature)
                {
                    stringFormat.LineAlignment = StringAlignment.Near;
                    g.DrawString(name, NameFont, nameBrush, textArea, stringFormat);

                    stringFormat.LineAlignment = StringAlignment.Far;
                    g.DrawString(identifier, IdentifierFont, identifierBrush,
                                 textArea, stringFormat);
                }
                // Drawing stereotype
                else
                {
                    stringFormat.LineAlignment = StringAlignment.Near;
                    g.DrawString(type.Stereotype, IdentifierFont, identifierBrush,
                                 textArea, stringFormat);

                    stringFormat.LineAlignment = StringAlignment.Far;
                    g.DrawString(name, NameFont, nameBrush, textArea, stringFormat);
                }
            }
            else
            {
                stringFormat.LineAlignment = GetVerticalAlignment(alignment);
                g.DrawString(name, NameFont, nameBrush, textArea, stringFormat);
            }

            DrawLine(g, HeaderHeight);
        }
Exemple #2
0
        public Style Clone( )
        {
            Style newStyle = ( Style )MemberwiseClone( );

            newStyle.nameFont             = ( Font )NameFont.Clone( );
            newStyle.abstractNameFont     = ( Font )AbstractNameFont.Clone( );
            newStyle.identifierFont       = ( Font )IdentifierFont.Clone( );
            newStyle.memberFont           = ( Font )MemberFont.Clone( );
            newStyle.staticMemberFont     = ( Font )StaticMemberFont.Clone( );
            newStyle.abstractMemberFont   = ( Font )AbstractMemberFont.Clone( );
            newStyle.commentFont          = ( Font )CommentFont.Clone( );
            newStyle.relationshipTextFont = ( Font )RelationshipTextFont.Clone( );

            return(newStyle);
        }
        public void Bind(FormulaChart fc)
        {
            foreach (FormulaArea fa in fc.Areas)
            {
                if (fa.AxisXs.Count != AxisXs.Count)
                {
                    fa.AxisXs.Clear();
                    for (int i = 0; i < AxisXs.Count; i++)
                    {
                        fa.AxisXs.Add(new FormulaAxisX()); //AxisXs[i]
                    }
                    if (AxisXs.Count > 0)
                    {
                        fa.AxisX = fa.AxisXs[0];
                    }
                }

                for (int i = 0; i < AxisXs.Count; i++)
                {
                    fa.AxisXs[i].CopyFrom(AxisXs[i]);
                }

                foreach (FormulaAxisY fay in fa.AxisYs)
                {
                    fay.CopyFrom(AxisY);
                }
                fa.Back    = (FormulaBack)Back.Clone();
                fa.Colors  = (Color[])Colors.Clone();
                fa.LinePen = LinePen.GetPen();                                                                    // LinePen.Clone();

                fa.BarPens         = new Pen[] { BarPens[0].GetPen(), BarPens[1].GetPen(), BarPens[2].GetPen() }; // (Pen[])BarPens.Clone();
                fa.BarBrushes      = new Brush[] { BarBrushes[0].GetBrush(), BarBrushes[1].GetBrush(), BarBrushes[2].GetBrush() };
                fa.NameBrush       = NameBrush.GetBrush();
                fa.NameFont        = (Font)NameFont.Clone();
                fa.TextFont        = (Font)TextFont.Clone();
                fa.StockRenderType = StockRenderType;
                if (fa.IsMain())
                {
                    fa.AxisY.Scale = scaleType;
                }
            }
            fc.StickRenderType     = StickRenderType;
            fc.CursorPen           = CursorPen.GetPen();
            fc.ShowXAxisInLastArea = ShowXAxisInLastArea;
            fc.ShowValueLabel      = ShowValueLabel;
            fc.AllXFormats         = AllXFormats;
        }
Exemple #4
0
        /// <summary>
        /// Unload contents
        /// </summary>
        public override void UnloadContent()
        {
            Trace.WriteLine("[CharGen] UnloadContent()");


            if (Tileset != null)
            {
                Tileset.Dispose();
            }
            Tileset = null;

            if (Heads != null)
            {
                Heads.Dispose();
            }
            Heads = null;

            if (Font != null)
            {
                Font.Dispose();
            }
            Font = null;

            if (NameFont != null)
            {
                NameFont.Dispose();
            }
            NameFont = null;

            if (Anims != null)
            {
                Anims.Dispose();
            }
            Anims = null;

            if (Batch != null)
            {
                Batch.Dispose();
            }
            Batch = null;
        }
Exemple #5
0
        /// <summary>
        /// Gets the size of the Character's name string.
        /// </summary>
        /// <returns>The size of the Character's name string.</returns>
        protected virtual Vector2 GetNameSize()
        {
            var ret = NameFont.MeasureString(Name);

            return(ret);
        }