From 79d6eb4a2b528aba123ded56f17c661780f60236 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 10 Oct 2010 15:09:26 +1300 Subject: [PATCH] some widgets cleanup --- .../WorldInteractionControllerWidget.cs | 8 ++---- OpenRA.Mods.RA/Cargo.cs | 3 +-- OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs | 27 ------------------- OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs | 10 +++++++ .../Widgets/SpecialPowerBinWidget.cs | 1 - 5 files changed, 13 insertions(+), 36 deletions(-) diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index b283900709..53bd4ada67 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -6,9 +6,8 @@ * as published by the Free Software Foundation. For more information, * see LICENSE. */ -#endregion - -using System; +#endregion + using System.Collections.Generic; using System.Drawing; using System.Linq; @@ -21,7 +20,6 @@ namespace OpenRA.Widgets class WorldInteractionControllerWidget : Widget { public WorldInteractionControllerWidget() : base() {} - protected WorldInteractionControllerWidget(WorldInteractionControllerWidget widget) : base(widget) {} public override void DrawInner( World world ) { @@ -173,7 +171,5 @@ namespace OpenRA.Widgets .DefaultIfEmpty( new Actor[] {} ) .FirstOrDefault(); } - - public override Widget Clone() { return new WorldInteractionControllerWidget(this); } } } \ No newline at end of file diff --git a/OpenRA.Mods.RA/Cargo.cs b/OpenRA.Mods.RA/Cargo.cs index b50bdaf3f2..3409a1da6d 100644 --- a/OpenRA.Mods.RA/Cargo.cs +++ b/OpenRA.Mods.RA/Cargo.cs @@ -9,10 +9,9 @@ #endregion using System.Collections.Generic; -using System.Linq; using OpenRA.Mods.RA.Activities; -using OpenRA.Traits; using OpenRA.Mods.RA.Orders; +using OpenRA.Traits; namespace OpenRA.Mods.RA { diff --git a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs index fdfc6d9776..45f5168145 100755 --- a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs @@ -8,11 +8,7 @@ */ #endregion -using System; -using System.Collections.Generic; -using System.Drawing; using System.Linq; -using OpenRA.FileFormats; using OpenRA.Graphics; using OpenRA.Traits; using OpenRA.Widgets; @@ -21,17 +17,9 @@ namespace OpenRA.Mods.RA.Widgets { class MoneyBinWidget : Widget { - const int chromeButtonGap = 2; public bool SplitOreAndCash = false; - /* legacy crap!!! */ - List>> buttons = new List>>(); - void AddButton(Rectangle r, Action b) { buttons.Add(Pair.New(r, b)); } - public MoneyBinWidget() : base() { } - protected MoneyBinWidget(Widget other) : base(other) { } - - public override Widget Clone() { return new MoneyBinWidget(this); } public override void DrawInner(World world) { @@ -74,20 +62,5 @@ namespace OpenRA.Mods.RA.Widgets } } } - - public override bool HandleInputInner(MouseInput mi) - { - if (mi.Event == MouseInputEvent.Down) - { - var action = buttons.Where(a => a.First.Contains(mi.Location.ToPoint())) - .Select(a => a.Second).FirstOrDefault(); - if (action == null) - return false; - - action(mi); - return true; - } - return false; - } } } diff --git a/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs b/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs index 2fc6a4a4f4..1d8200704f 100755 --- a/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs +++ b/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs @@ -1,3 +1,13 @@ +#region Copyright & License Information +/* + * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see LICENSE. + */ +#endregion + using System; using System.Drawing; using OpenRA.Graphics; diff --git a/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs index a99c7bfac3..22532b13db 100755 --- a/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs @@ -14,7 +14,6 @@ using System.Drawing; using System.Linq; using OpenRA.FileFormats; using OpenRA.Graphics; -using OpenRA.Traits; using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets