Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
This commit is contained in:
@@ -52,7 +52,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
// Equivalent to OnMouseUp, but without an input arg
|
||||
public Action OnClick = () => { };
|
||||
public Action OnDoubleClick = () => { };
|
||||
public Action OnDoubleClick = () => { };
|
||||
public Action<KeyInput> OnKeyPress = _ => { };
|
||||
|
||||
protected readonly Ruleset ModRules;
|
||||
@@ -149,7 +149,7 @@ namespace OpenRA.Widgets
|
||||
OnDoubleClick();
|
||||
return YieldMouseFocus(mi);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (HasMouseFocus && mi.Event == MouseInputEvent.Up)
|
||||
{
|
||||
// Only fire the onMouseUp event if we successfully lost focus, and were pressed
|
||||
@@ -197,8 +197,14 @@ namespace OpenRA.Widgets
|
||||
tooltipContainer.Value.RemoveTooltip();
|
||||
}
|
||||
|
||||
public override int2 ChildOrigin { get { return RenderOrigin +
|
||||
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); } }
|
||||
public override int2 ChildOrigin
|
||||
{
|
||||
get
|
||||
{
|
||||
return RenderOrigin +
|
||||
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
|
||||
@@ -101,8 +101,7 @@ namespace OpenRA.Widgets
|
||||
public void ShowDropDown<T>(string panelTemplate, int maxHeight, IEnumerable<T> options, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
||||
{
|
||||
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs()
|
||||
{ { "substitutions", substitutions } });
|
||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } });
|
||||
|
||||
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
||||
panel.RemoveChildren();
|
||||
@@ -124,8 +123,7 @@ namespace OpenRA.Widgets
|
||||
public void ShowDropDown<T>(string panelTemplate, int height, Dictionary<string, IEnumerable<T>> groups, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
||||
{
|
||||
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs()
|
||||
{ { "substitutions", substitutions } });
|
||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } });
|
||||
|
||||
var headerTemplate = panel.GetOrNull<ScrollItemWidget>("HEADER");
|
||||
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
||||
|
||||
@@ -61,22 +61,22 @@ namespace OpenRA.Widgets
|
||||
|
||||
switch (mi.Event)
|
||||
{
|
||||
case MouseInputEvent.Up:
|
||||
isMoving = false;
|
||||
YieldMouseFocus(mi);
|
||||
break;
|
||||
case MouseInputEvent.Up:
|
||||
isMoving = false;
|
||||
YieldMouseFocus(mi);
|
||||
break;
|
||||
|
||||
case MouseInputEvent.Down:
|
||||
isMoving = true;
|
||||
/* TODO: handle snapping to ticks properly again */
|
||||
/* TODO: handle nudge via clicking outside the thumb */
|
||||
UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left));
|
||||
break;
|
||||
|
||||
case MouseInputEvent.Move:
|
||||
if (isMoving)
|
||||
case MouseInputEvent.Down:
|
||||
isMoving = true;
|
||||
/* TODO: handle snapping to ticks properly again */
|
||||
/* TODO: handle nudge via clicking outside the thumb */
|
||||
UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left));
|
||||
break;
|
||||
break;
|
||||
|
||||
case MouseInputEvent.Move:
|
||||
if (isMoving)
|
||||
UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left));
|
||||
break;
|
||||
}
|
||||
|
||||
return ThumbRect.Contains(mi.Location);
|
||||
|
||||
@@ -268,9 +268,10 @@ namespace OpenRA.Widgets
|
||||
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom));
|
||||
}
|
||||
|
||||
var color = disabled ? TextColorDisabled
|
||||
: IsValid() ? TextColor
|
||||
: TextColorInvalid;
|
||||
var color =
|
||||
disabled ? TextColorDisabled
|
||||
: IsValid() ? TextColor
|
||||
: TextColorInvalid;
|
||||
font.DrawText(apparentText, textPos, color);
|
||||
|
||||
if (showCursor && HasKeyboardFocus)
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Widgets
|
||||
0,
|
||||
0,
|
||||
video.Width,
|
||||
video.Height),
|
||||
video.Height),
|
||||
TextureChannel.Alpha);
|
||||
|
||||
var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
|
||||
@@ -121,15 +121,15 @@ namespace OpenRA.Widgets
|
||||
skippedFrames++;
|
||||
}
|
||||
|
||||
if (skippedFrames > 1)
|
||||
Log.Write("perf", "VqaPlayer : {0} skipped {1} frames at position {2}", cachedVideo, skippedFrames, video.CurrentFrame);
|
||||
if (skippedFrames > 1)
|
||||
Log.Write("perf", "VqaPlayer : {0} skipped {1} frames at position {2}", cachedVideo, skippedFrames, video.CurrentFrame);
|
||||
}
|
||||
|
||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(
|
||||
videoSprite,
|
||||
videoOrigin,
|
||||
videoSize);
|
||||
|
||||
|
||||
if (DrawOverlay)
|
||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, videoSize);
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ namespace OpenRA.Widgets
|
||||
public override string GetCursor(int2 pos) { return null; }
|
||||
public override Widget Clone() { return new ContainerWidget(this); }
|
||||
public Func<KeyInput, bool> OnKeyPress = _ => false;
|
||||
public override bool HandleKeyPress(KeyInput e) { return OnKeyPress(e); }
|
||||
public override bool HandleKeyPress(KeyInput e) { return OnKeyPress(e); }
|
||||
}
|
||||
|
||||
public class WidgetArgs : Dictionary<string, object>
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA
|
||||
{
|
||||
if (!args.ContainsKey("modRules"))
|
||||
args = new WidgetArgs(args) { { "modRules", modData.DefaultRules } };
|
||||
|
||||
|
||||
var widget = NewWidget(node.Key, args);
|
||||
|
||||
if (parent != null)
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace OpenRA.Widgets
|
||||
// Background
|
||||
if (ps.HasFlags(PanelSides.Center) && ss[8] != null)
|
||||
FillRectWithSprite(new Rectangle(bounds.Left + marginLeft, bounds.Top + marginTop,
|
||||
bounds.Width - marginWidth, bounds.Height - marginHeight),
|
||||
bounds.Width - marginWidth, bounds.Height - marginHeight),
|
||||
ss[8]);
|
||||
|
||||
// Left border
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Widgets
|
||||
var unit = World.ScreenMap.ActorsAt(xy)
|
||||
.WithHighestSelectionPriority();
|
||||
|
||||
var newSelection2 = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight,
|
||||
var newSelection2 = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight,
|
||||
a => unit != null && a.Info.Name == unit.Info.Name && a.Owner == unit.Owner);
|
||||
|
||||
World.Selection.Combine(World, newSelection2, true, false);
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
|
||||
// don't issue orders while selecting
|
||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down && !hasBox)
|
||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down && !hasBox)
|
||||
ApplyOrders(World, xy, mi);
|
||||
|
||||
lastMousePosition = xy;
|
||||
|
||||
Reference in New Issue
Block a user