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/Tools/EllipseTool.cs

    r2768 r4068  
    1 using System;
    21using System.Drawing;
    32
    4 namespace Netron.Diagramming.Core
    5 {
     3namespace Netron.Diagramming.Core {
     4  /// <summary>
     5  /// Tool to draw an ellipse on the canvas
     6  /// <seealso cref="RectangleTool"/>
     7  /// </summary>
     8  public class EllipseTool : AbstractDrawingTool {
     9    #region Fields
     10
     11    #endregion
     12
     13    #region Properties
     14
     15    #endregion
     16
     17    #region Constructor
     18    public EllipseTool()
     19      : base("Ellipse Tool") {
     20    }
     21    public EllipseTool(string name)
     22      : base(name) {
     23
     24    }
     25    #endregion
     26
     27    #region Methods
     28
     29    // ------------------------------------------------------------------
    630    /// <summary>
    7     /// Tool to draw an ellipse on the canvas
    8     /// <seealso cref="RectangleTool"/>
     31    /// Activates the tool - the cursor is set to the Cursors.DrawRectangle.
    932    /// </summary>
    10     public class EllipseTool : AbstractDrawingTool
    11     {
    12         #region Fields
     33    // ------------------------------------------------------------------
     34    protected override void OnActivateTool() {
     35      base.OnActivateTool();
     36      Cursor = CursorPalette.DrawEllipse;
     37    }
    1338
    14         #endregion
    15 
    16         #region Properties
    17 
    18         #endregion
    19 
    20         #region Constructor
    21         public EllipseTool() : base("Ellipse Tool")
    22         {
    23         }
    24         public EllipseTool(string name): base(name)
    25         {
    26 
    27         }
    28         #endregion
    29 
    30         #region Methods
    31 
    32         // ------------------------------------------------------------------
    33         /// <summary>
    34         /// Activates the tool - the cursor is set to the Cursors.DrawRectangle.
    35         /// </summary>
    36         // ------------------------------------------------------------------
    37         protected override void OnActivateTool()
    38         {
    39             base.OnActivateTool();
    40             Cursor = CursorPalette.DrawEllipse;
    41         }
    42 
    43         /// <summary>
    44         /// Handles the mouse move event.
    45         /// </summary>
    46         /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
    47         protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
    48         {
    49             base.OnMouseMove(e);
    50             if (IsActive && started)
    51             {
    52                 Point point = new Point(e.X, e.Y);
    53                 Controller.View.PaintGhostEllipse(startingPoint, point);
    54                 Controller.View.Invalidate(System.Drawing.Rectangle.Inflate(Controller.View.Ghost.Rectangle, 20, 20));
    55             }
    56         }
     39    /// <summary>
     40    /// Handles the mouse move event.
     41    /// </summary>
     42    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
     43    protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e) {
     44      base.OnMouseMove(e);
     45      if (IsActive && started) {
     46        Point point = new Point(e.X, e.Y);
     47        Controller.View.PaintGhostEllipse(startingPoint, point);
     48        Controller.View.Invalidate(System.Drawing.Rectangle.Inflate(Controller.View.Ghost.Rectangle, 20, 20));
     49      }
     50    }
    5751
    5852
    59         /// <summary>
    60         /// This method will be called when the user has finished drawing a ghost rectangle or bundle
    61         /// and initiates the actual creation of a bundle and the addition to the model via the appropriate command.
    62         /// </summary>
    63         protected override void GhostDrawingComplete()
    64         {
    65             if ((IsActive == false) ||
    66                 (started == false))
    67             {
    68                 return;
    69             }
     53    /// <summary>
     54    /// This method will be called when the user has finished drawing a ghost rectangle or bundle
     55    /// and initiates the actual creation of a bundle and the addition to the model via the appropriate command.
     56    /// </summary>
     57    protected override void GhostDrawingComplete() {
     58      if ((IsActive == false) ||
     59          (started == false)) {
     60        return;
     61      }
    7062
    71             try
    72             {
    73                 SimpleEllipse shape = new SimpleEllipse(this.Controller.Model);
    74                 shape.Width = (int) Rectangle.Width;
    75                 shape.Height = (int) Rectangle.Height;
    76                 AddShapeCommand cmd = new AddShapeCommand(
    77                     this.Controller,
    78                     shape,
    79                     new Point((int) Rectangle.X, (int)Rectangle.Y));
    80                 this.Controller.UndoManager.AddUndoCommand(cmd);
    81                 cmd.Redo();
    82             }
    83             catch
    84             {
    85                 base.Controller.DeactivateTool(this);
    86                 Controller.View.Invalidate();
    87                 throw;
    88             }
     63      try {
     64        SimpleEllipse shape = new SimpleEllipse(this.Controller.Model);
     65        shape.Width = (int)Rectangle.Width;
     66        shape.Height = (int)Rectangle.Height;
     67        AddShapeCommand cmd = new AddShapeCommand(
     68            this.Controller,
     69            shape,
     70            new Point((int)Rectangle.X, (int)Rectangle.Y));
     71        this.Controller.UndoManager.AddUndoCommand(cmd);
     72        cmd.Redo();
     73      }
     74      catch {
     75        base.Controller.DeactivateTool(this);
     76        Controller.View.Invalidate();
     77        throw;
     78      }
    8979
    90             //base.Controller.DeactivateTool(this);
    91         }
     80      //base.Controller.DeactivateTool(this);
     81    }
    9282
    9383
    94         #endregion
    95     }
     84    #endregion
     85  }
    9686
    9787}
Note: See TracChangeset for help on using the changeset viewer.