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/AlignmentToolBase.cs

    r2868 r4068  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Text;
     1using System.Drawing;
    42using System.Windows.Forms;
    5 using System.Drawing;
    63
    7 namespace Netron.Diagramming.Core
    8 {
    9     public abstract class AlignmentToolBase : AbstractTool
    10     {
    11         protected IDiagramEntity firstEntity;
    12         protected int xLocationOfFirstEntity;
    13         protected int yLocationOfFirstEntity;
    14         protected int topEdgeOfFirstEntity;
    15         protected int bottomEdgeOfFirstEntity;
    16         protected Point centerOfFirstEntity;
    17         protected int rightEdgeOfFirstEntity;
     4namespace Netron.Diagramming.Core {
     5  public abstract class AlignmentToolBase : AbstractTool {
     6    protected IDiagramEntity firstEntity;
     7    protected int xLocationOfFirstEntity;
     8    protected int yLocationOfFirstEntity;
     9    protected int topEdgeOfFirstEntity;
     10    protected int bottomEdgeOfFirstEntity;
     11    protected Point centerOfFirstEntity;
     12    protected int rightEdgeOfFirstEntity;
    1813
    19         // ------------------------------------------------------------------
    20         /// <summary>
    21         /// Constructor.
    22         /// </summary>
    23         /// <param name="toolName">string: The name of this tool</param>
    24         // ------------------------------------------------------------------
    25         public AlignmentToolBase(string toolName)
    26             : base(toolName)
    27         {
    28         }
     14    // ------------------------------------------------------------------
     15    /// <summary>
     16    /// Constructor.
     17    /// </summary>
     18    /// <param name="toolName">string: The name of this tool</param>
     19    // ------------------------------------------------------------------
     20    public AlignmentToolBase(string toolName)
     21      : base(toolName) {
     22    }
    2923
    30         // ------------------------------------------------------------------
    31         /// <summary>
    32         /// Activates the tool.  First a check is performed to ensure there
    33         /// are at least two IDiagramEntities selected.  If so, then the
    34         /// x, y, top edge, bottom edge, and center of the first entity
    35         /// is stored in local, protected variables for all other alignment
    36         /// tools to use.
    37         /// </summary>
    38         // ------------------------------------------------------------------
    39         protected override void OnActivateTool()
    40         {
    41             base.OnActivateTool();
     24    // ------------------------------------------------------------------
     25    /// <summary>
     26    /// Activates the tool.  First a check is performed to ensure there
     27    /// are at least two IDiagramEntities selected.  If so, then the
     28    /// x, y, top edge, bottom edge, and center of the first entity
     29    /// is stored in local, protected variables for all other alignment
     30    /// tools to use.
     31    /// </summary>
     32    // ------------------------------------------------------------------
     33    protected override void OnActivateTool() {
     34      base.OnActivateTool();
    4235
    43             // Make sure enough items were selected.
    44             if (this.Controller.Model.Selection.SelectedItems == null)
    45             {
    46                 MessageBox.Show(
    47                     "Nothing is selected, you need to select at " +
    48                     "least two items to align.",
    49                     "Nothing selected.",
    50                     MessageBoxButtons.OK,
    51                     MessageBoxIcon.Hand);
     36      // Make sure enough items were selected.
     37      if (this.Controller.Model.Selection.SelectedItems == null) {
     38        MessageBox.Show(
     39            "Nothing is selected, you need to select at " +
     40            "least two items to align.",
     41            "Nothing selected.",
     42            MessageBoxButtons.OK,
     43            MessageBoxIcon.Hand);
    5244
    53                 return;
    54             }
     45        return;
     46      }
    5547
    56             if (this.Controller.Model.Selection.SelectedItems.Count <= 1)
    57             {
    58                 MessageBox.Show(
    59                     "You need to select at least two items to align.",
    60                     "Nothing selected.",
    61                     MessageBoxButtons.OK,
    62                     MessageBoxIcon.Hand);
     48      if (this.Controller.Model.Selection.SelectedItems.Count <= 1) {
     49        MessageBox.Show(
     50            "You need to select at least two items to align.",
     51            "Nothing selected.",
     52            MessageBoxButtons.OK,
     53            MessageBoxIcon.Hand);
    6354
    64                 return;
    65             }
     55        return;
     56      }
    6657
    67             // Since there are enough items, peform the alignment.  But
    68             // first get all aspects about the location of the first
    69             // entity.
    70             this.firstEntity = this.Controller.Model.Selection.SelectedItems[0];
    71             this.xLocationOfFirstEntity = firstEntity.Rectangle.X;
    72             this.yLocationOfFirstEntity = firstEntity.Rectangle.Y;
    73             this.topEdgeOfFirstEntity = firstEntity.Rectangle.Top;
    74             this.bottomEdgeOfFirstEntity = firstEntity.Rectangle.Bottom;
    75             this.rightEdgeOfFirstEntity = firstEntity.Rectangle.Right;
    76             this.centerOfFirstEntity = firstEntity.Center;
     58      // Since there are enough items, peform the alignment.  But
     59      // first get all aspects about the location of the first
     60      // entity.
     61      this.firstEntity = this.Controller.Model.Selection.SelectedItems[0];
     62      this.xLocationOfFirstEntity = firstEntity.Rectangle.X;
     63      this.yLocationOfFirstEntity = firstEntity.Rectangle.Y;
     64      this.topEdgeOfFirstEntity = firstEntity.Rectangle.Top;
     65      this.bottomEdgeOfFirstEntity = firstEntity.Rectangle.Bottom;
     66      this.rightEdgeOfFirstEntity = firstEntity.Rectangle.Right;
     67      this.centerOfFirstEntity = firstEntity.Center;
    7768
    78             this.Align(this.Controller.Model.Selection.SelectedItems.ToArray());
     69      this.Align(this.Controller.Model.Selection.SelectedItems.ToArray());
    7970
    80             // Reset the Tracker.
    81             this.Controller.View.ShowTracker();
    82             DeactivateTool();
    83         }
     71      // Reset the Tracker.
     72      this.Controller.View.ShowTracker();
     73      DeactivateTool();
     74    }
    8475
    85         // ------------------------------------------------------------------
    86         /// <summary>
    87         /// Abstract method to be implemented by all alignment tools.
    88         /// </summary>
    89         /// <param name="entities">IDiagramEntity[]: All selected
    90         /// entities.</param>
    91         // ------------------------------------------------------------------
    92         public abstract void Align(IDiagramEntity[] entities);
    93     }
     76    // ------------------------------------------------------------------
     77    /// <summary>
     78    /// Abstract method to be implemented by all alignment tools.
     79    /// </summary>
     80    /// <param name="entities">IDiagramEntity[]: All selected
     81    /// entities.</param>
     82    // ------------------------------------------------------------------
     83    public abstract void Align(IDiagramEntity[] entities);
     84  }
    9485}
Note: See TracChangeset for help on using the changeset viewer.