Skip to content

Commit

Permalink
Remove FiguresReversed property
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltwin committed Aug 22, 2011
1 parent 384ff43 commit 55a5b43
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion MonoDevelop.ClassDesigner/ClassDiagram.cs
Expand Up @@ -401,7 +401,7 @@ protected void OnGroupSettingChanged (DiagramEventArgs e)
protected void OnCreatedHandler (object o, FigureEventArgs e)
{
Add (e.Figure);
IFigure last = FiguresReversed.LastOrDefault ();
IFigure last = Figures.FirstOrDefault ();

if (last == null)
return;
Expand Down
1 change: 0 additions & 1 deletion MonoHotDraw/IDrawing.cs
Expand Up @@ -51,7 +51,6 @@ public interface IDrawing : IDisposable
void SendToBack (IFigure figure);

RectangleD DisplayBox { get; }
IEnumerable <IFigure> FiguresReversed { get; }
IEnumerable <IFigure> Figures { get; }
//IList <IFigure> FigureCollection { get; }
}
Expand Down
10 changes: 1 addition & 9 deletions MonoHotDraw/MonoHotDraw.Figures/CompositeFigure.cs
Expand Up @@ -52,10 +52,6 @@ protected CompositeFigure ()
get { return FigureCollection; }
}

public IEnumerable<IFigure> FiguresReversed {
get { return FigureCollection.Reverse<IFigure> (); }
}

public override IEnumerable<IHandle> Handles {
get {
foreach (IFigure fig in FigureCollection)
Expand Down Expand Up @@ -126,11 +122,7 @@ public override ITool CreateFigureTool (IDrawingEditor editor, ITool dt)

public IFigure FindFigure (double x, double y)
{
foreach (IFigure figure in FiguresReversed)
if (figure.ContainsPoint (x, y))
return figure;

return null;
return Figures.LastOrDefault (f => f.ContainsPoint (x, y));
}

public override bool Includes (IFigure figure)
Expand Down
9 changes: 3 additions & 6 deletions MonoHotDraw/MonoHotDraw.Handles/ChangeConnectionHandle.cs
Expand Up @@ -25,6 +25,8 @@

using Cairo;
using System;
using System.Linq;

using MonoHotDraw.Connectors;
using MonoHotDraw.Commands;
using MonoHotDraw.Figures;
Expand Down Expand Up @@ -160,12 +162,7 @@ protected override void UpdateUndoActivity ()
#region Private Members
private IFigure FindConnectableFigure (double x, double y, IDrawing drawing)
{
foreach (IFigure figure in drawing.FiguresReversed) {
if (figure.ContainsPoint (x, y) && IsConnectionPossible (figure)) {
return figure;
}
}
return null;
return drawing.Figures.LastOrDefault (f => f.ContainsPoint (x, y) && IsConnectionPossible (f));
}

private IConnector FindConnectionTarget (double x, double y, IDrawing drawing)
Expand Down
2 changes: 1 addition & 1 deletion MonoHotDraw/MonoHotDraw.Tools/SelectAreaTool.cs
Expand Up @@ -98,7 +98,7 @@ private void DrawSelectionRect (Gtk.Widget widget, Gdk.Window window)

private void SelectFiguresOnRect (IDrawingView view, bool shift_pressed)
{
foreach (IFigure figure in view.Drawing.FiguresReversed) {
foreach (IFigure figure in view.Drawing.Figures) {
RectangleD rect = figure.DisplayBox;

if (selectionRectangle.Contains (rect.X, rect.Y) &&
Expand Down

0 comments on commit 55a5b43

Please sign in to comment.