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/BaseClasses/ComplexShapeBase.cs

    r2768 r4068  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Text;
     2using System.ComponentModel;
    43using System.Drawing;
    5 using System.ComponentModel;
    6 using System.Drawing.Drawing2D;
    74using System.Windows.Forms;
    85
    9 namespace Netron.Diagramming.Core
    10 {
    11     // ----------------------------------------------------------------------
    12     /// <summary>
    13     /// Abstract base class for complex shapes <see cref="ComplexShapeBase"/>.
    14     /// </summary>
    15     // ----------------------------------------------------------------------
    16     public abstract partial class ComplexShapeBase :
    17         ShapeBase,
    18         IComplexShape,
    19         IMouseListener,
    20         IHoverListener
    21     {
    22         #region Fields
    23 
    24         // ------------------------------------------------------------------
    25         /// <summary>
    26         /// Implementation of IVersion - the current version of
    27         /// ComplexShapeBase.
    28         /// </summary>
    29         // ------------------------------------------------------------------
    30         protected const double complexShapeVersion = 1.0;
    31 
    32         /// <summary>
    33         /// the text on the bundle
    34         /// </summary>
    35         protected string mText = string.Empty;
    36 
    37         /// <summary>
    38         /// the shape children or sub-controls
    39         /// </summary>
    40         protected CollectionBase<IShapeMaterial> mChildren;
    41 
    42         #endregion
    43 
    44         #region Properties
    45 
    46         // ------------------------------------------------------------------
    47         /// <summary>
    48         /// Gets the current version.
    49         /// </summary>
    50         // ------------------------------------------------------------------
    51         public override double Version
    52         {
    53             get
    54             {
    55                 return complexShapeVersion;
     6namespace Netron.Diagramming.Core {
     7  // ----------------------------------------------------------------------
     8  /// <summary>
     9  /// Abstract base class for complex shapes <see cref="ComplexShapeBase"/>.
     10  /// </summary>
     11  // ----------------------------------------------------------------------
     12  public abstract partial class ComplexShapeBase :
     13      ShapeBase,
     14      IComplexShape,
     15      IMouseListener,
     16      IHoverListener {
     17    #region Fields
     18
     19    // ------------------------------------------------------------------
     20    /// <summary>
     21    /// Implementation of IVersion - the current version of
     22    /// ComplexShapeBase.
     23    /// </summary>
     24    // ------------------------------------------------------------------
     25    protected const double complexShapeVersion = 1.0;
     26
     27    /// <summary>
     28    /// the text on the bundle
     29    /// </summary>
     30    protected string mText = string.Empty;
     31
     32    /// <summary>
     33    /// the shape children or sub-controls
     34    /// </summary>
     35    protected CollectionBase<IShapeMaterial> mChildren;
     36
     37    #endregion
     38
     39    #region Properties
     40
     41    // ------------------------------------------------------------------
     42    /// <summary>
     43    /// Gets the current version.
     44    /// </summary>
     45    // ------------------------------------------------------------------
     46    public override double Version {
     47      get {
     48        return complexShapeVersion;
     49      }
     50    }
     51
     52    // ------------------------------------------------------------------
     53    /// <summary>
     54    /// Gets or sets the text of the bundle
     55    /// </summary>
     56    // ------------------------------------------------------------------
     57    [Browsable(true),
     58    Description("The text shown on the shape"), Category("Layout")]
     59    public virtual string Text {
     60      get {
     61        return mText;
     62      }
     63      set {
     64        mText = value;
     65        this.Invalidate();
     66      }
     67    }
     68
     69    #endregion
     70
     71    #region Constructor
     72
     73    // ------------------------------------------------------------------
     74    ///<summary>
     75    ///Default constructor
     76    ///</summary>
     77    // ------------------------------------------------------------------
     78    public ComplexShapeBase()
     79      : base() {
     80    }
     81
     82    // ------------------------------------------------------------------
     83    /// <summary>
     84    /// Initializes a new instance of the <see cref="ComplexShapeBase"/>
     85    /// class.
     86    /// </summary>
     87    /// <param name="model"></param>
     88    // ------------------------------------------------------------------
     89    public ComplexShapeBase(IModel model)
     90      : base(model) {
     91    }
     92
     93    // ------------------------------------------------------------------
     94    /// <summary>
     95    /// Initializes this instance.
     96    /// </summary>
     97    // ------------------------------------------------------------------
     98    protected override void Initialize() {
     99      base.Initialize();
     100      mChildren = new CollectionBase<IShapeMaterial>();
     101      mChildren.OnItemAdded +=
     102          new EventHandler<CollectionEventArgs<IShapeMaterial>>
     103          (mChildren_OnItemAdded);
     104    }
     105
     106    #endregion
     107
     108    #region Methods
     109    // ------------------------------------------------------------------
     110
     111    /// <summary>
     112    /// Sets some contextual properties of the <see cref="Children"/>
     113    /// when a new item is added.
     114    /// </summary>
     115    /// <param name="sender">The sender.</param>
     116    /// <param name="e">The e.</param>
     117    // ------------------------------------------------------------------
     118    void mChildren_OnItemAdded(object sender, CollectionEventArgs<IShapeMaterial> e) {
     119      e.Item.Shape = this;
     120    }
     121
     122    // ------------------------------------------------------------------
     123    /// <summary>
     124    /// Overrides the abstract paint method
     125    /// </summary>
     126    /// <param name="g">a graphics object onto which to paint</param>
     127    // ------------------------------------------------------------------
     128    public override void Paint(Graphics g) {
     129
     130      base.Paint(g);
     131
     132
     133
     134      foreach (IPaintable material in Children) {
     135        material.Paint(g);
     136      }
     137
     138    }
     139
     140    // ------------------------------------------------------------------
     141    /// <summary>
     142    /// Moves the entity with the given shift
     143    /// </summary>
     144    /// <param name="p">represent a shift-vector, not the absolute
     145    /// position!</param>
     146    // ------------------------------------------------------------------
     147    public override void MoveBy(Point p) {
     148      base.MoveBy(p);
     149      Rectangle rec;
     150      foreach (IShapeMaterial material in Children) {
     151        rec = material.Rectangle;
     152
     153        rec.Offset(p.X, p.Y);
     154        material.Transform(rec);
     155      }
     156    }
     157
     158    // ------------------------------------------------------------------
     159    /// <summary>
     160    /// Transforms the entity to the given new rectangle.
     161    /// </summary>
     162    /// <param name="x">The x-coordinate of the new rectangle.</param>
     163    /// <param name="y">The y-coordinate of the new rectangle.</param>
     164    /// <param name="width">The width.</param>
     165    /// <param name="height">The height.</param>
     166    // ------------------------------------------------------------------
     167    public override void Transform(int x, int y, int width, int height) {
     168      if (Children != null && Children.Count > 0) {
     169
     170        int a, b, w, h;
     171        foreach (IShapeMaterial material in Children) {
     172
     173          if (material.Gliding) {
     174            a = Convert.ToInt32(Math.Round(((double)material.Rectangle.X - (double)Rectangle.X) / (double)Rectangle.Width * width, 1) + x);
     175            b = Convert.ToInt32(Math.Round(((double)material.Rectangle.Y - (double)Rectangle.Y) / (double)Rectangle.Height * height, 1) + y);
     176          } else //shift the material, do not scale the position with respect to the sizing of the shape
     177                    {
     178            a = material.Rectangle.X - Rectangle.X + x;
     179            b = material.Rectangle.Y - Rectangle.Y + y;
     180          }
     181          if (material.Resizable) {
     182            w = Convert.ToInt32(Math.Round(((double)material.Rectangle.Width) / ((double)Rectangle.Width), 1) * width);
     183            h = Convert.ToInt32(Math.Round(((double)material.Rectangle.Height) / ((double)Rectangle.Height), 1) * height);
     184          } else {
     185            w = material.Rectangle.Width;
     186            h = material.Rectangle.Height;
     187          }
     188
     189          material.Transform(new Rectangle(a, b, w, h));
     190        }
     191      }
     192      base.Transform(x, y, width, height);
     193    }
     194    #endregion
     195
     196    // ------------------------------------------------------------------
     197    /// <summary>
     198    /// Gets or sets the children.
     199    /// </summary>
     200    /// <value>The children.</value>
     201    // ------------------------------------------------------------------
     202    public virtual CollectionBase<IShapeMaterial> Children {
     203      get {
     204        return mChildren;
     205      }
     206      set {
     207        throw new InconsistencyException("You cannot set the children, use the existing collection and the clear() method.");
     208      }
     209    }
     210
     211    // ------------------------------------------------------------------
     212    /// <summary>
     213    /// Defines a mechanism for retrieving a service object; that is, an
     214    /// object that provides custom support to other objects.
     215    /// </summary>
     216    /// <param name="serviceType">An object that specifies the type of
     217    /// service object to get.</param>
     218    /// <returns>
     219    /// A service object of type serviceType.-or- null if there is no
     220    /// service object of type serviceType.
     221    /// </returns>
     222    // ------------------------------------------------------------------
     223    public override object GetService(Type serviceType) {
     224      if (Services.ContainsKey(serviceType))
     225        return Services[serviceType];
     226      else {
     227        return null;
     228      }
     229    }
     230
     231    // ------------------------------------------------------------------
     232    /// <summary>
     233    /// <see cref="IMouseListener"/> implementation.
     234    /// </summary>
     235    /// <param name="e">The
     236    /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
     237    /// containing the event data.</param>
     238    // ------------------------------------------------------------------
     239    public override bool MouseDown(MouseEventArgs e) {
     240      base.MouseDown(e);
     241      IMouseListener listener;
     242      foreach (IShapeMaterial material in mChildren) {
     243        if (material.Rectangle.Contains(e.Location) && material.Visible) {
     244          listener = material.GetService(typeof(
     245              IMouseListener)) as IMouseListener;
     246          if (listener != null)
     247            if (listener.MouseDown(e))
     248              return true;
     249        }
     250
     251      }
     252      return false;
     253    }
     254
     255    // ------------------------------------------------------------------
     256    /// <summary>
     257    /// <see cref="IMouseListener"/> implementation.
     258    /// </summary>
     259    /// <param name="e">The
     260    /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
     261    /// containing the event data.</param>
     262    // ------------------------------------------------------------------
     263    public override void MouseMove(MouseEventArgs e) {
     264      base.MouseMove(e);
     265      IMouseListener listener;
     266      foreach (IShapeMaterial material in mChildren) {
     267        if ((material.Rectangle.Contains(e.Location)) &&
     268            (material.Visible)) {
     269          listener = material.GetService(typeof
     270              (IMouseListener)) as IMouseListener;
     271
     272          if (listener != null) {
     273            listener.MouseMove(e);
     274          }
     275        }
     276      }
     277    }
     278
     279    // ------------------------------------------------------------------
     280    /// <summary>
     281    /// <see cref="IMouseListener"/> implementation.
     282    /// </summary>
     283    /// <param name="e">The
     284    /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
     285    /// containing the event data.</param>
     286    // ------------------------------------------------------------------
     287    public override void MouseUp(MouseEventArgs e) {
     288      base.MouseUp(e);
     289      IMouseListener listener;
     290      foreach (IShapeMaterial material in mChildren) {
     291        if (material.Rectangle.Contains(e.Location) && material.Visible) {
     292          listener = material.GetService(typeof(IMouseListener)) as IMouseListener;
     293          if (listener != null) listener.MouseUp(e);
     294        }
     295      }
     296    }
     297
     298
     299
     300    #region IHoverListener Members
     301
     302    private IHoverListener currentHoveredMaterial;
     303
     304    // ------------------------------------------------------------------
     305    /// <summary>
     306    /// Handles the MouseHover event.
     307    /// </summary>
     308    /// <param name="e">The
     309    /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
     310    /// containing the event data.</param>
     311    // ------------------------------------------------------------------
     312    public override void MouseHover(MouseEventArgs e) {
     313      base.MouseHover(e);
     314      IHoverListener listener;
     315      foreach (IShapeMaterial material in this.Children) {
     316        if (material.Rectangle.Contains(e.Location) && material.Visible) //we caught an material and it's visible
     317                {
     318          listener = material.GetService(typeof(IHoverListener)) as IHoverListener;
     319          if (listener != null) //the caught material does listen
     320                    {
     321            if (currentHoveredMaterial == listener) //it's the same as the previous time
     322              listener.MouseHover(e);
     323            else //we moved from one material to another listening material
     324                        {
     325              if (currentHoveredMaterial != null) //tell the previous material we are leaving
     326                currentHoveredMaterial.MouseLeave(e);
     327              listener.MouseEnter(e); //tell the current one we enter
     328              currentHoveredMaterial = listener;
    56329            }
    57         }
    58 
    59         // ------------------------------------------------------------------
    60         /// <summary>
    61         /// Gets or sets the text of the bundle
    62         /// </summary>
    63         // ------------------------------------------------------------------
    64         [Browsable(true),
    65         Description("The text shown on the shape"), Category("Layout")]
    66         public virtual string Text
    67         {
    68             get
    69             {
    70                 return mText;
     330          } else //the caught material does not listen
     331                    {
     332            if (currentHoveredMaterial != null) {
     333              currentHoveredMaterial.MouseLeave(e);
     334              currentHoveredMaterial = null;
    71335            }
    72             set
    73             {
    74                 mText = value;
    75                 this.Invalidate();
    76             }
    77         }
    78      
    79         #endregion
    80 
    81         #region Constructor
    82 
    83         // ------------------------------------------------------------------
    84         ///<summary>
    85         ///Default constructor
    86         ///</summary>
    87         // ------------------------------------------------------------------
    88         public ComplexShapeBase() : base()
    89         {
    90         }
    91 
    92         // ------------------------------------------------------------------
    93         /// <summary>
    94         /// Initializes a new instance of the <see cref="ComplexShapeBase"/>
    95         /// class.
    96         /// </summary>
    97         /// <param name="model"></param>
    98         // ------------------------------------------------------------------
    99         public ComplexShapeBase(IModel model)
    100             : base(model)
    101         {
    102         }
    103 
    104         // ------------------------------------------------------------------
    105         /// <summary>
    106         /// Initializes this instance.
    107         /// </summary>
    108         // ------------------------------------------------------------------
    109         protected override void Initialize()
    110         {
    111             base.Initialize();
    112             mChildren = new CollectionBase<IShapeMaterial>();
    113             mChildren.OnItemAdded +=
    114                 new EventHandler<CollectionEventArgs<IShapeMaterial>>
    115                 (mChildren_OnItemAdded); 
    116         }
    117        
    118         #endregion
    119 
    120         #region Methods
    121         // ------------------------------------------------------------------
    122 
    123         /// <summary>
    124         /// Sets some contextual properties of the <see cref="Children"/>
    125         /// when a new item is added.
    126         /// </summary>
    127         /// <param name="sender">The sender.</param>
    128         /// <param name="e">The e.</param>
    129         // ------------------------------------------------------------------
    130         void mChildren_OnItemAdded(object sender, CollectionEventArgs<IShapeMaterial> e)
    131         {
    132             e.Item.Shape = this;
    133         }
    134 
    135         // ------------------------------------------------------------------
    136         /// <summary>
    137         /// Overrides the abstract paint method
    138         /// </summary>
    139         /// <param name="g">a graphics object onto which to paint</param>
    140         // ------------------------------------------------------------------
    141         public override void Paint(Graphics g)
    142         {
    143            
    144             base.Paint(g);
    145 
    146            
    147 
    148             foreach (IPaintable material in Children)
    149             {
    150                 material.Paint(g);
    151             }
    152          
    153         }
    154 
    155         // ------------------------------------------------------------------
    156         /// <summary>
    157         /// Moves the entity with the given shift
    158         /// </summary>
    159         /// <param name="p">represent a shift-vector, not the absolute
    160         /// position!</param>
    161         // ------------------------------------------------------------------
    162         public override void MoveBy(Point p)
    163         {
    164             base.MoveBy(p);
    165             Rectangle rec;
    166             foreach (IShapeMaterial material in Children)
    167             {
    168                 rec = material.Rectangle;
    169 
    170                 rec.Offset(p.X, p.Y);
    171                 material.Transform(rec);
    172             }
    173         }
    174 
    175         // ------------------------------------------------------------------
    176         /// <summary>
    177         /// Transforms the entity to the given new rectangle.
    178         /// </summary>
    179         /// <param name="x">The x-coordinate of the new rectangle.</param>
    180         /// <param name="y">The y-coordinate of the new rectangle.</param>
    181         /// <param name="width">The width.</param>
    182         /// <param name="height">The height.</param>
    183         // ------------------------------------------------------------------
    184         public override void Transform(int x, int y, int width, int height)
    185         {
    186             if (Children != null && Children.Count > 0)
    187             {
    188 
    189                 int a, b, w, h;
    190                 foreach (IShapeMaterial material in Children)
    191                 {
    192 
    193                     if (material.Gliding)
    194                     {
    195                         a = Convert.ToInt32(Math.Round(((double)material.Rectangle.X - (double)Rectangle.X) / (double)Rectangle.Width * width, 1) + x);
    196                         b = Convert.ToInt32(Math.Round(((double)material.Rectangle.Y - (double)Rectangle.Y) / (double)Rectangle.Height * height, 1) + y);
    197                     }
    198                     else //shift the material, do not scale the position with respect to the sizing of the shape
    199                     {
    200                         a = material.Rectangle.X - Rectangle.X + x;
    201                         b = material.Rectangle.Y - Rectangle.Y + y;
    202                     }
    203                     if (material.Resizable)
    204                     {
    205                         w = Convert.ToInt32(Math.Round(((double)material.Rectangle.Width) / ((double)Rectangle.Width), 1) * width);
    206                         h = Convert.ToInt32(Math.Round(((double)material.Rectangle.Height) / ((double)Rectangle.Height), 1) * height);
    207                     }
    208                     else
    209                     {
    210                         w = material.Rectangle.Width;
    211                         h = material.Rectangle.Height;
    212                     }
    213 
    214                     material.Transform(new Rectangle(a, b, w, h));
    215                 }
    216             }
    217             base.Transform(x, y, width, height);
    218         }
    219         #endregion
    220 
    221         // ------------------------------------------------------------------
    222         /// <summary>
    223         /// Gets or sets the children.
    224         /// </summary>
    225         /// <value>The children.</value>
    226         // ------------------------------------------------------------------
    227         public virtual CollectionBase<IShapeMaterial> Children
    228         {
    229             get
    230             {
    231                 return mChildren;
    232             }
    233             set
    234             {
    235                 throw new InconsistencyException("You cannot set the children, use the existing collection and the clear() method.");   
    236             }
    237         }
    238 
    239         // ------------------------------------------------------------------
    240         /// <summary>
    241         /// Defines a mechanism for retrieving a service object; that is, an
    242         /// object that provides custom support to other objects.
    243         /// </summary>
    244         /// <param name="serviceType">An object that specifies the type of
    245         /// service object to get.</param>
    246         /// <returns>
    247         /// A service object of type serviceType.-or- null if there is no
    248         /// service object of type serviceType.
    249         /// </returns>
    250         // ------------------------------------------------------------------
    251         public override object GetService(Type serviceType)
    252         {
    253             if (Services.ContainsKey(serviceType))
    254                 return Services[serviceType];
    255             else
    256             {
    257                 return null;
    258             }
    259         }
    260 
    261         // ------------------------------------------------------------------
    262         /// <summary>
    263         /// <see cref="IMouseListener"/> implementation.
    264         /// </summary>
    265         /// <param name="e">The
    266         /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
    267         /// containing the event data.</param>
    268         // ------------------------------------------------------------------
    269         public override bool MouseDown(MouseEventArgs e)
    270         {
    271             base.MouseDown(e);
    272             IMouseListener listener ;
    273             foreach (IShapeMaterial material in mChildren)
    274             {
    275                 if(material.Rectangle.Contains(e.Location) && material.Visible)
    276                 {
    277                     listener = material.GetService(typeof(
    278                         IMouseListener)) as IMouseListener;
    279                     if (listener != null)
    280                         if (listener.MouseDown(e))
    281                             return true;
    282                 }
    283 
    284             }
    285             return false;
    286         }
    287 
    288         // ------------------------------------------------------------------
    289         /// <summary>
    290         /// <see cref="IMouseListener"/> implementation.
    291         /// </summary>
    292         /// <param name="e">The
    293         /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
    294         /// containing the event data.</param>
    295         // ------------------------------------------------------------------
    296         public override void MouseMove(MouseEventArgs e)
    297         {
    298             base.MouseMove(e);
    299             IMouseListener listener;
    300             foreach (IShapeMaterial material in mChildren)
    301             {
    302                 if ( (material.Rectangle.Contains(e.Location)) &&
    303                     (material.Visible) )
    304                 {
    305                     listener = material.GetService(typeof
    306                         (IMouseListener)) as IMouseListener;
    307 
    308                     if (listener != null)
    309                     {
    310                         listener.MouseMove(e);
    311                     }
    312                 }
    313             }
    314         }
    315 
    316         // ------------------------------------------------------------------
    317         /// <summary>
    318         /// <see cref="IMouseListener"/> implementation.
    319         /// </summary>
    320         /// <param name="e">The
    321         /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
    322         /// containing the event data.</param>
    323         // ------------------------------------------------------------------
    324         public override void MouseUp(MouseEventArgs e)
    325         {
    326             base.MouseUp(e);
    327             IMouseListener listener;
    328             foreach (IShapeMaterial material in mChildren)
    329             {
    330                 if(material.Rectangle.Contains(e.Location) && material.Visible)
    331                 {
    332                     listener = material.GetService(typeof(IMouseListener)) as IMouseListener;
    333                     if (listener != null) listener.MouseUp(e);
    334                 }
    335             }
    336         }
    337 
    338 
    339 
    340         #region IHoverListener Members
    341 
    342         private IHoverListener currentHoveredMaterial;
    343 
    344         // ------------------------------------------------------------------
    345         /// <summary>
    346         /// Handles the MouseHover event.
    347         /// </summary>
    348         /// <param name="e">The
    349         /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
    350         /// containing the event data.</param>
    351         // ------------------------------------------------------------------
    352         public override void MouseHover(MouseEventArgs e)
    353         {
    354             base.MouseHover(e);
    355             IHoverListener listener;
    356             foreach(IShapeMaterial material in this.Children)
    357             {
    358                 if(material.Rectangle.Contains(e.Location) && material.Visible) //we caught an material and it's visible
    359                 {
    360                     listener = material.GetService(typeof(IHoverListener)) as IHoverListener;
    361                     if(listener != null) //the caught material does listen
    362                     {
    363                         if(currentHoveredMaterial == listener) //it's the same as the previous time
    364                             listener.MouseHover(e);
    365                         else //we moved from one material to another listening material
    366                         {
    367                             if(currentHoveredMaterial != null) //tell the previous material we are leaving
    368                                 currentHoveredMaterial.MouseLeave(e);
    369                             listener.MouseEnter(e); //tell the current one we enter
    370                             currentHoveredMaterial = listener;
    371                         }
    372                     }
    373                     else //the caught material does not listen
    374                     {
    375                         if(currentHoveredMaterial != null)
    376                         {
    377                             currentHoveredMaterial.MouseLeave(e);
    378                             currentHoveredMaterial = null;
    379                         }
    380                     }
    381                     return; //only one material at a time
    382                 }
    383 
    384             }
    385             if(currentHoveredMaterial != null)
    386             {
    387                 currentHoveredMaterial.MouseLeave(e);
    388                 currentHoveredMaterial = null;
    389             }
    390            
    391         }
    392 
    393         // ------------------------------------------------------------------
    394         /// <summary>
    395         /// Handles the OnMouseEnter event.
    396         /// </summary>
    397         /// <param name="e">The
    398         /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
    399         /// containing the event data.</param>
    400         // ------------------------------------------------------------------
    401         public override void MouseEnter(MouseEventArgs e)
    402         {
    403             base.MouseEnter(e);
    404         }
    405 
    406         // ------------------------------------------------------------------
    407         /// <summary>
    408         /// Handles the OnMouseLeave event.
    409         /// </summary>
    410         /// <param name="e">The
    411         /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
    412         /// containing the event data.</param>
    413         // ------------------------------------------------------------------
    414         public override void MouseLeave(MouseEventArgs e)
    415         {
    416             base.MouseLeave(e);
    417         }
    418 
    419         #endregion
    420     }
     336          }
     337          return; //only one material at a time
     338        }
     339
     340      }
     341      if (currentHoveredMaterial != null) {
     342        currentHoveredMaterial.MouseLeave(e);
     343        currentHoveredMaterial = null;
     344      }
     345
     346    }
     347
     348    // ------------------------------------------------------------------
     349    /// <summary>
     350    /// Handles the OnMouseEnter event.
     351    /// </summary>
     352    /// <param name="e">The
     353    /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
     354    /// containing the event data.</param>
     355    // ------------------------------------------------------------------
     356    public override void MouseEnter(MouseEventArgs e) {
     357      base.MouseEnter(e);
     358    }
     359
     360    // ------------------------------------------------------------------
     361    /// <summary>
     362    /// Handles the OnMouseLeave event.
     363    /// </summary>
     364    /// <param name="e">The
     365    /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance
     366    /// containing the event data.</param>
     367    // ------------------------------------------------------------------
     368    public override void MouseLeave(MouseEventArgs e) {
     369      base.MouseLeave(e);
     370    }
     371
     372    #endregion
     373  }
    421374}
Note: See TracChangeset for help on using the changeset viewer.