Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Diagram elements/Shapes/SimpleRectangle.cs

    r3038 r4068  
    1 using System;
    21using System.Drawing;
    3 using System.Drawing.Drawing2D;
    4 namespace Netron.Diagramming.Core
    5 {
    6     // ----------------------------------------------------------------------
    7     /// <summary>
    8     /// A simple rectangular shape.
    9     /// </summary>
    10     // ----------------------------------------------------------------------
    11     [Shape(
    12         "Rectangle",
    13         "SimpleRectangle",
    14         "Standard",
    15         "A simple rectangular shape.")]
    16     public partial class SimpleRectangle : SimpleShapeBase
    17     {
    18         #region Fields
    19 
    20         // ------------------------------------------------------------------
    21         /// <summary>
    22         /// Implementation of IVersion - the current version of
    23         /// SimpleRectangle.
    24         /// </summary>
    25         // ------------------------------------------------------------------
    26         protected const double simpleRectangleVersion = 1.0;
    27 
    28         // ------------------------------------------------------------------
    29         /// <summary>
    30         /// The bottom connector.
    31         /// </summary>
    32         // ------------------------------------------------------------------
    33         //Connector cBottom;
    34 
    35         // ------------------------------------------------------------------
    36         /// <summary>
    37         /// The left connector.
    38         /// </summary>
    39         // ------------------------------------------------------------------
    40         //Connector cLeft;
    41 
    42         // ------------------------------------------------------------------
    43         /// <summary>
    44         /// The right connector.
    45         /// </summary>
    46         // ------------------------------------------------------------------
    47         //Connector cRight;
    48 
    49         // ------------------------------------------------------------------
    50         /// <summary>
    51         /// The top connector.
    52         /// </summary>
    53         // ------------------------------------------------------------------
    54         //Connector cTop;
    55 
    56         #endregion
    57 
    58         #region Properties
    59 
    60         // ------------------------------------------------------------------
    61         /// <summary>
    62         /// Gets the current version.
    63         /// </summary>
    64         // ------------------------------------------------------------------
    65         public override double Version
    66         {
    67             get
    68             {
    69                 return simpleRectangleVersion;
    70             }
     2namespace Netron.Diagramming.Core {
     3  // ----------------------------------------------------------------------
     4  /// <summary>
     5  /// A simple rectangular shape.
     6  /// </summary>
     7  // ----------------------------------------------------------------------
     8  [Shape(
     9      "Rectangle",
     10      "SimpleRectangle",
     11      "Standard",
     12      "A simple rectangular shape.")]
     13  public partial class SimpleRectangle : SimpleShapeBase {
     14    #region Fields
     15
     16    // ------------------------------------------------------------------
     17    /// <summary>
     18    /// Implementation of IVersion - the current version of
     19    /// SimpleRectangle.
     20    /// </summary>
     21    // ------------------------------------------------------------------
     22    protected const double simpleRectangleVersion = 1.0;
     23
     24    // ------------------------------------------------------------------
     25    /// <summary>
     26    /// The bottom connector.
     27    /// </summary>
     28    // ------------------------------------------------------------------
     29    //Connector cBottom;
     30
     31    // ------------------------------------------------------------------
     32    /// <summary>
     33    /// The left connector.
     34    /// </summary>
     35    // ------------------------------------------------------------------
     36    //Connector cLeft;
     37
     38    // ------------------------------------------------------------------
     39    /// <summary>
     40    /// The right connector.
     41    /// </summary>
     42    // ------------------------------------------------------------------
     43    //Connector cRight;
     44
     45    // ------------------------------------------------------------------
     46    /// <summary>
     47    /// The top connector.
     48    /// </summary>
     49    // ------------------------------------------------------------------
     50    //Connector cTop;
     51
     52    #endregion
     53
     54    #region Properties
     55
     56    // ------------------------------------------------------------------
     57    /// <summary>
     58    /// Gets the current version.
     59    /// </summary>
     60    // ------------------------------------------------------------------
     61    public override double Version {
     62      get {
     63        return simpleRectangleVersion;
     64      }
     65    }
     66
     67    // ------------------------------------------------------------------
     68    /// <summary>
     69    /// Gets the friendly name of the entity to be displayed in the UI
     70    /// </summary>
     71    /// <value>string</value>
     72    // ------------------------------------------------------------------
     73    public override string EntityName {
     74      get { return "Simple Rectangle"; }
     75    }
     76
     77    public override Rectangle Rectangle {
     78      get {
     79        return base.Rectangle;
     80      }
     81    }
     82
     83    #endregion
     84
     85    #region Constructor
     86
     87    // ------------------------------------------------------------------
     88    /// <summary>
     89    /// Default constructor.
     90    /// </summary>
     91    /// <param name="s"></param>
     92    // ------------------------------------------------------------------
     93    public SimpleRectangle(IModel s)
     94      : base(s) {
     95    }
     96
     97    // ------------------------------------------------------------------
     98    /// <summary>
     99    /// Initializes a new instance of the
     100    /// <see cref="T:SimpleRectangle"/> class.
     101    /// </summary>
     102    // ------------------------------------------------------------------
     103    public SimpleRectangle()
     104      : base() {
     105    }
     106
     107    #endregion
     108
     109    #region Methods
     110
     111    // -----------------------------------------------------------------
     112    /// <summary>
     113    /// Initializes this instance.
     114    /// </summary>
     115    // -----------------------------------------------------------------
     116    protected override void Initialize() {
     117      base.Initialize();
     118      //the initial size
     119      Transform(0, 0, 200, 50);
     120      this.mTextArea = Rectangle;
     121
     122      // I'm changing the "simple" shapes to have no connectors.
     123      #region Connectors
     124      //cTop = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
     125      //cTop.Name = "Top connector";
     126      //cTop.Parent = this;
     127      //Connectors.Add(cTop);
     128
     129      //cRight = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
     130      //cRight.Name = "Right connector";
     131      //cRight.Parent = this;
     132      //Connectors.Add(cRight);
     133
     134      //cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
     135      //cBottom.Name = "Bottom connector";
     136      //cBottom.Parent = this;
     137      //Connectors.Add(cBottom);
     138
     139      //cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
     140      //cLeft.Name = "Left connector";
     141      //cLeft.Parent = this;
     142      //Connectors.Add(cLeft);
     143      #endregion
     144    }
     145
     146    // ------------------------------------------------------------------
     147    /// <summary>
     148    /// Paints the bundle on the canvas
     149    /// </summary>
     150    /// <param name="g">Graphics: The GDI+ graphics surface.</param>
     151    // ------------------------------------------------------------------
     152    public override void Paint(Graphics g) {
     153      // Draw the shadow.
     154      if (ArtPalette.EnableShadows) {
     155        g.FillRectangle(
     156            ArtPalette.ShadowBrush,
     157            mRectangle.X + 5,
     158            mRectangle.Y + 5,
     159            mRectangle.Width,
     160            mRectangle.Height);
     161      }
     162
     163      // Fill the shape.
     164      g.FillRectangle(Brush, mRectangle);
     165
     166      // Draw the edge of the bundle.
     167      if (Hovered) {
     168        g.DrawRectangle(ArtPalette.HighlightPen, mRectangle);
     169      } else {
     170        g.DrawRectangle(Pen, mRectangle);
     171      }
     172
     173      // Finally, the connectors.
     174      if (this.ShowConnectors) {
     175        for (int k = 0; k < Connectors.Count; k++) {
     176          Connectors[k].Paint(g);
    71177        }
    72 
    73         // ------------------------------------------------------------------
    74         /// <summary>
    75         /// Gets the friendly name of the entity to be displayed in the UI
    76         /// </summary>
    77         /// <value>string</value>
    78         // ------------------------------------------------------------------
    79         public override string EntityName
    80         {
    81             get { return "Simple Rectangle"; }
    82         }
    83 
    84         public override Rectangle Rectangle
    85         {
    86             get
    87             {
    88                 return base.Rectangle;
    89             }
    90         }
    91 
    92         #endregion
    93 
    94         #region Constructor
    95 
    96         // ------------------------------------------------------------------
    97         /// <summary>
    98         /// Default constructor.
    99         /// </summary>
    100         /// <param name="s"></param>
    101         // ------------------------------------------------------------------
    102         public SimpleRectangle(IModel s)
    103             : base(s)
    104         {
    105         }
    106 
    107         // ------------------------------------------------------------------
    108         /// <summary>
    109         /// Initializes a new instance of the
    110         /// <see cref="T:SimpleRectangle"/> class.
    111         /// </summary>
    112         // ------------------------------------------------------------------
    113         public SimpleRectangle()
    114             : base()
    115         {
    116         }
    117 
    118         #endregion
    119 
    120         #region Methods
    121 
    122         // -----------------------------------------------------------------
    123         /// <summary>
    124         /// Initializes this instance.
    125         /// </summary>
    126         // -----------------------------------------------------------------
    127         protected override void Initialize()
    128         {
    129             base.Initialize();
    130             //the initial size
    131             Transform(0, 0, 200, 50);
    132             this.mTextArea = Rectangle;
    133 
    134             // I'm changing the "simple" shapes to have no connectors.
    135             #region Connectors
    136             //cTop = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
    137             //cTop.Name = "Top connector";
    138             //cTop.Parent = this;
    139             //Connectors.Add(cTop);
    140 
    141             //cRight = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
    142             //cRight.Name = "Right connector";
    143             //cRight.Parent = this;
    144             //Connectors.Add(cRight);
    145 
    146             //cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
    147             //cBottom.Name = "Bottom connector";
    148             //cBottom.Parent = this;
    149             //Connectors.Add(cBottom);
    150 
    151             //cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
    152             //cLeft.Name = "Left connector";
    153             //cLeft.Parent = this;
    154             //Connectors.Add(cLeft);
    155             #endregion
    156         }
    157 
    158         // ------------------------------------------------------------------
    159         /// <summary>
    160         /// Paints the bundle on the canvas
    161         /// </summary>
    162         /// <param name="g">Graphics: The GDI+ graphics surface.</param>
    163         // ------------------------------------------------------------------
    164         public override void Paint(Graphics g)
    165         {
    166             // Draw the shadow.
    167             if (ArtPalette.EnableShadows)
    168             {
    169                 g.FillRectangle(
    170                     ArtPalette.ShadowBrush,
    171                     mRectangle.X + 5,
    172                     mRectangle.Y + 5,
    173                     mRectangle.Width,
    174                     mRectangle.Height);
    175             }
    176 
    177             // Fill the shape.
    178             g.FillRectangle(Brush, mRectangle);
    179 
    180             // Draw the edge of the bundle.
    181             if (Hovered)
    182             {
    183                 g.DrawRectangle(ArtPalette.HighlightPen, mRectangle);
    184             }
    185             else
    186             {
    187                 g.DrawRectangle(Pen, mRectangle);
    188             }
    189 
    190             // Finally, the connectors.
    191             if (this.ShowConnectors)
    192             {
    193                 for (int k = 0; k < Connectors.Count; k++)
    194                 {
    195                     Connectors[k].Paint(g);
    196                 }
    197             }
    198 
    199             //here we keep it really simple:
    200             if (!string.IsNullOrEmpty(Text))
    201             {
    202                 //StringFormat format = new StringFormat();
    203                 //format.Alignment = this.VerticalAlignment;
    204                 //format.LineAlignment = this.HorizontalAlignment;
    205                 //SolidBrush textBrush = new SolidBrush(mForeColor);
    206 
    207                 //g.DrawString(
    208                 //    Text,
    209                 //    mFont,
    210                 //    textBrush,
    211                 //    TextArea,
    212                 //    format);
    213                 g.DrawString(
    214                     mTextStyle.GetFormattedText(Text),
    215                     mTextStyle.Font,
    216                     mTextStyle.GetBrush(),
    217                     TextArea,
    218                     mTextStyle.StringFormat);
    219             }
    220         }
    221 
    222         #endregion
    223     }
     178      }
     179
     180      //here we keep it really simple:
     181      if (!string.IsNullOrEmpty(Text)) {
     182        //StringFormat format = new StringFormat();
     183        //format.Alignment = this.VerticalAlignment;
     184        //format.LineAlignment = this.HorizontalAlignment;
     185        //SolidBrush textBrush = new SolidBrush(mForeColor);
     186
     187        //g.DrawString(
     188        //    Text,
     189        //    mFont,
     190        //    textBrush,
     191        //    TextArea,
     192        //    format);
     193        g.DrawString(
     194            mTextStyle.GetFormattedText(Text),
     195            mTextStyle.Font,
     196            mTextStyle.GetBrush(),
     197            TextArea,
     198            mTextStyle.StringFormat);
     199      }
     200    }
     201
     202    #endregion
     203  }
    224204}
Note: See TracChangeset for help on using the changeset viewer.