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

    r2868 r4068  
    1 using System;
    2 using System.Diagnostics;
    3 using System.Collections;
    4 using System.Drawing;
    51using System.Windows.Forms;
    62
    7 namespace Netron.Diagramming.Core
    8 {
    9     // ----------------------------------------------------------------------
     3namespace Netron.Diagramming.Core {
     4  // ----------------------------------------------------------------------
     5  /// <summary>
     6  /// Tool to align shapes in various ways
     7  /// </summary>
     8  // ----------------------------------------------------------------------
     9  public class AlignTool : AbstractTool {
     10
     11    #region Fields
     12
     13    // ------------------------------------------------------------------
    1014    /// <summary>
    11     /// Tool to align shapes in various ways
     15    /// The type of alignment to apply.
    1216    /// </summary>
    13     // ----------------------------------------------------------------------
    14     public class AlignTool : AbstractTool
    15     {
     17    // ------------------------------------------------------------------
     18    private ShapeAlignment mAlignment;
    1619
    17         #region Fields
    18 
    19         // ------------------------------------------------------------------
    20         /// <summary>
    21         /// The type of alignment to apply.
    22         /// </summary>
    23         // ------------------------------------------------------------------
    24         private ShapeAlignment mAlignment;
    25 
    26         // ------------------------------------------------------------------
    27         /// <summary>
    28         /// Gets or sets the type of alignment to apply.
    29         /// </summary>
    30         // ------------------------------------------------------------------
    31         public ShapeAlignment Alignment
    32         {
    33             get { return mAlignment; }
    34             set { mAlignment = value; }
    35         }
    36 
    37  
    38         #endregion
    39 
    40         #region Constructor
    41 
    42         // ------------------------------------------------------------------
    43         /// <summary>
    44         /// Initializes a new instance of the <see cref="T:AlignTool"/> class.
    45         /// </summary>
    46         /// <param name="name">The name of the tool.</param>
    47         // ------------------------------------------------------------------
    48         public AlignTool(string name) : base(name)
    49         {
    50         }
    51         #endregion
    52 
    53         #region Methods
    54 
    55         /// <summary>
    56         /// Called when the tool is activated.
    57         /// </summary>
    58         protected override void OnActivateTool()
    59         {
    60             bool valid = true;
    61            
    62             #region Validation of the selection
    63            
    64             //make sure we have the correct stuff on the table
    65             if (this.Controller.Model.Selection.SelectedItems == null || this.Controller.Model.Selection.SelectedItems.Count == 0)
    66             {
    67                 MessageBox.Show("Nothing is selected, you need to select an existing group.", "Nothing selected.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
    68                 valid = false;               
    69             } else if (this.Controller.Model.Selection.SelectedItems.Count != 1)
    70             {
    71                 MessageBox.Show("Multiple items are selected, select only one group.", "Multiple items", MessageBoxButtons.OK, MessageBoxIcon.Hand);
    72                 valid = false;
    73             } else if (!(this.Controller.Model.Selection.SelectedItems[0] is IGroup))
    74             {
    75                 MessageBox.Show("The selected item is not a group.", "Not a group.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
    76                 valid = false;
    77             }
    78             #endregion
    79 
    80             if (valid)
    81             {
    82                 UngroupCommand cmd = new UngroupCommand(
    83                     this.Controller,
    84                    this.Controller.Model.Selection.SelectedItems[0] as IGroup);
    85 
    86                 this.Controller.UndoManager.AddUndoCommand(cmd);
    87                 cmd.Redo();
    88             }
    89              DeactivateTool();
    90              return;
    91         }
    92 
    93      
    94         #endregion
    95 
    96      
     20    // ------------------------------------------------------------------
     21    /// <summary>
     22    /// Gets or sets the type of alignment to apply.
     23    /// </summary>
     24    // ------------------------------------------------------------------
     25    public ShapeAlignment Alignment {
     26      get { return mAlignment; }
     27      set { mAlignment = value; }
    9728    }
    9829
     30
     31    #endregion
     32
     33    #region Constructor
     34
     35    // ------------------------------------------------------------------
     36    /// <summary>
     37    /// Initializes a new instance of the <see cref="T:AlignTool"/> class.
     38    /// </summary>
     39    /// <param name="name">The name of the tool.</param>
     40    // ------------------------------------------------------------------
     41    public AlignTool(string name)
     42      : base(name) {
     43    }
     44    #endregion
     45
     46    #region Methods
     47
     48    /// <summary>
     49    /// Called when the tool is activated.
     50    /// </summary>
     51    protected override void OnActivateTool() {
     52      bool valid = true;
     53
     54      #region Validation of the selection
     55
     56      //make sure we have the correct stuff on the table
     57      if (this.Controller.Model.Selection.SelectedItems == null || this.Controller.Model.Selection.SelectedItems.Count == 0) {
     58        MessageBox.Show("Nothing is selected, you need to select an existing group.", "Nothing selected.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     59        valid = false;
     60      } else if (this.Controller.Model.Selection.SelectedItems.Count != 1) {
     61        MessageBox.Show("Multiple items are selected, select only one group.", "Multiple items", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     62        valid = false;
     63      } else if (!(this.Controller.Model.Selection.SelectedItems[0] is IGroup)) {
     64        MessageBox.Show("The selected item is not a group.", "Not a group.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     65        valid = false;
     66      }
     67      #endregion
     68
     69      if (valid) {
     70        UngroupCommand cmd = new UngroupCommand(
     71            this.Controller,
     72           this.Controller.Model.Selection.SelectedItems[0] as IGroup);
     73
     74        this.Controller.UndoManager.AddUndoCommand(cmd);
     75        cmd.Redo();
     76      }
     77      DeactivateTool();
     78      return;
     79    }
     80
     81
     82    #endregion
     83
     84
     85  }
     86
    9987}
Note: See TracChangeset for help on using the changeset viewer.