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

    r2868 r4068  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Text;
    41using System.Drawing;
    52
    6 namespace Netron.Diagramming.Core
    7 {
    8     // ----------------------------------------------------------------------
     3namespace Netron.Diagramming.Core {
     4  // ----------------------------------------------------------------------
     5  /// <summary>
     6  /// The base class for zooming tools.  Zoom tools allow the user to
     7  /// incrementally adjust (increase or decrease) the View's magnification.
     8  /// </summary>
     9  // ----------------------------------------------------------------------
     10  public class ZoomToolBase : AbstractTool {
     11    // ------------------------------------------------------------------
    912    /// <summary>
    10     /// The base class for zooming tools.  Zoom tools allow the user to
    11     /// incrementally adjust (increase or decrease) the View's magnification.
     13    /// Used to multiply the current magnification by.
    1214    /// </summary>
    13     // ----------------------------------------------------------------------
    14     public class ZoomToolBase : AbstractTool
    15     {
    16         // ------------------------------------------------------------------
    17         /// <summary>
    18         /// Used to multiply the current magnification by.
    19         /// </summary>
    20         // ------------------------------------------------------------------
    21         protected float myZoomFactor = 0.9F;
     15    // ------------------------------------------------------------------
     16    protected float myZoomFactor = 0.9F;
    2217
    23         // ------------------------------------------------------------------
    24         /// <summary>
    25         /// Gets or sets the multiplier used to adjust the View's
    26         /// Magnification by.  The default is 0.9.
    27         /// </summary>
    28         // ------------------------------------------------------------------
    29         public float ZoomFactor
    30         {
    31             get
    32             {
    33                 return myZoomFactor;
    34             }
    35             set
    36             {
    37                 myZoomFactor = value;
    38             }
    39         }
     18    // ------------------------------------------------------------------
     19    /// <summary>
     20    /// Gets or sets the multiplier used to adjust the View's
     21    /// Magnification by.  The default is 0.9.
     22    /// </summary>
     23    // ------------------------------------------------------------------
     24    public float ZoomFactor {
     25      get {
     26        return myZoomFactor;
     27      }
     28      set {
     29        myZoomFactor = value;
     30      }
     31    }
    4032
    41         // ------------------------------------------------------------------
    42         /// <summary>
    43         /// Constructor.
    44         /// </summary>
    45         /// <param name="toolName">string: The  name of the tool.</param>
    46         // ------------------------------------------------------------------
    47         public ZoomToolBase(string toolName)
    48             : base(toolName)
    49         {
    50         }
     33    // ------------------------------------------------------------------
     34    /// <summary>
     35    /// Constructor.
     36    /// </summary>
     37    /// <param name="toolName">string: The  name of the tool.</param>
     38    // ------------------------------------------------------------------
     39    public ZoomToolBase(string toolName)
     40      : base(toolName) {
     41    }
    5142
    52         // ------------------------------------------------------------------
    53         /// <summary>
    54         /// Activates this tool - the View's current magnification is
    55         /// mulitiplied by 'ZoomFactor'.
    56         /// </summary>
    57         // ------------------------------------------------------------------
    58         protected override void OnActivateTool()
    59         {
    60             base.OnActivateTool();
     43    // ------------------------------------------------------------------
     44    /// <summary>
     45    /// Activates this tool - the View's current magnification is
     46    /// mulitiplied by 'ZoomFactor'.
     47    /// </summary>
     48    // ------------------------------------------------------------------
     49    protected override void OnActivateTool() {
     50      base.OnActivateTool();
    6151
    62             SizeF size = Controller.View.Magnification;
    63             SizeF autoScrollMinSize =
    64                 Controller.ParentControl.AutoScrollMinSize;
    65             Point origin = Controller.View.Origin;
    66             Point parentAutoScrollPosition =
    67                 Controller.ParentControl.AutoScrollPosition;
     52      SizeF size = Controller.View.Magnification;
     53      SizeF autoScrollMinSize =
     54          Controller.ParentControl.AutoScrollMinSize;
     55      Point origin = Controller.View.Origin;
     56      Point parentAutoScrollPosition =
     57          Controller.ParentControl.AutoScrollPosition;
    6858
    69             Controller.View.Magnification = new SizeF(
    70                 size.Width * myZoomFactor,
    71                 size.Height * myZoomFactor);
     59      Controller.View.Magnification = new SizeF(
     60          size.Width * myZoomFactor,
     61          size.Height * myZoomFactor);
    7262
    73             // Remember to also adjust the diagram's scroll bars.
    74             size = new SizeF(
    75                 autoScrollMinSize.Width * myZoomFactor,
    76                 autoScrollMinSize.Height * myZoomFactor);
    77             Controller.ParentControl.AutoScrollMinSize = Size.Round(size);
     63      // Remember to also adjust the diagram's scroll bars.
     64      size = new SizeF(
     65          autoScrollMinSize.Width * myZoomFactor,
     66          autoScrollMinSize.Height * myZoomFactor);
     67      Controller.ParentControl.AutoScrollMinSize = Size.Round(size);
    7868
    79             // Should we set the Origin to the location of the selected items
    80             // if there are any?  This will allow the user to zoom in on
    81             // a selection.
    82             if (this.Controller.Model.Selection.SelectedItems.Count > 0)
    83             {
    84               Bundle bundle = new Bundle(this.Controller.Model.Selection.SelectedItems);
    85                 Point bundleLocation = bundle.Rectangle.Location;
     69      // Should we set the Origin to the location of the selected items
     70      // if there are any?  This will allow the user to zoom in on
     71      // a selection.
     72      if (this.Controller.Model.Selection.SelectedItems.Count > 0) {
     73        Bundle bundle = new Bundle(this.Controller.Model.Selection.SelectedItems);
     74        Point bundleLocation = bundle.Rectangle.Location;
    8675
    87                 // Don't move the origin *exactly* to the bundle's location.
    88                 // Offset it a little so the bundle is butted-up with the
    89                 // upper-right hand corner of the screen.
    90                 bundleLocation.Offset(-20, -20);
    91                 origin.Offset(Point.Round(Controller.View.WorldToView(
    92                     bundleLocation)));
     76        // Don't move the origin *exactly* to the bundle's location.
     77        // Offset it a little so the bundle is butted-up with the
     78        // upper-right hand corner of the screen.
     79        bundleLocation.Offset(-20, -20);
     80        origin.Offset(Point.Round(Controller.View.WorldToView(
     81            bundleLocation)));
    9382
    94                 Controller.View.Origin = origin;
    95             }
     83        Controller.View.Origin = origin;
     84      }
    9685
    97             Controller.ParentControl.AutoScrollPosition =
    98                 Controller.View.Origin;
     86      Controller.ParentControl.AutoScrollPosition =
     87          Controller.View.Origin;
    9988
    100             DeactivateTool();
    101         }
     89      DeactivateTool();
    10290    }
     91  }
    10392}
Note: See TracChangeset for help on using the changeset viewer.