From 9a6c020fce3028df57490e8b2b198168e6a8fe45 Mon Sep 17 00:00:00 2001 From: WhiteTreePaladin Date: Wed, 21 Jul 2010 21:02:21 +0000 Subject: [PATCH] Allowed selections with only one group to also show the unit stats area Split unit cycle back to 2 functions This was SVN commit r7781. --- .../mods/public/gui/session_new/selection.js | 5 +++++ .../gui/session_new/selection_details.js | 22 +++++++++++++------ .../mods/public/gui/session_new/session.xml | 4 ++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/binaries/data/mods/public/gui/session_new/selection.js b/binaries/data/mods/public/gui/session_new/selection.js index c7c189f8d1..d197e68fbb 100644 --- a/binaries/data/mods/public/gui/session_new/selection.js +++ b/binaries/data/mods/public/gui/session_new/selection.js @@ -37,6 +37,11 @@ EntityGroups.prototype.reset = function() this.groups = []; }; +EntityGroups.prototype.getLength = function() +{ + return this.groups.length; +}; + EntityGroups.prototype.getPrimary = function() { return this.primary; diff --git a/binaries/data/mods/public/gui/session_new/selection_details.js b/binaries/data/mods/public/gui/session_new/selection_details.js index bbb17fd30d..671776b545 100644 --- a/binaries/data/mods/public/gui/session_new/selection_details.js +++ b/binaries/data/mods/public/gui/session_new/selection_details.js @@ -10,7 +10,8 @@ function resetCycleIndex() displayedCycleIndex = 1; } -function cycleThroughSelection(forward) +/* +function cycleThroughSelection(forward) // uses boolean to determine direction (forward or reverse) { var selection = g_Selection.toList(); @@ -62,10 +63,9 @@ function cycleThroughSelection(forward) } } } +*/ - - -function cycleThroughSelection1() +function cycleThroughSelection() { var selection = g_Selection.toList(); @@ -272,10 +272,18 @@ function updateSelectionDetails(simState) var selectionGroup = g_Selection.groups.getGroup(entState.template); var typeCount = g_Selection.groups.getGroup(entState.template).typeCount; getGUIObjectByName("sdSelectionCount").caption = ((typeCount > 1)? displayedCycleIndex + "/" + typeCount : ""); + + // Show cycle area if there is more than one unit of that type + if (typeCount > 1) + getGUIObjectByName("sdCycleArea").hidden = false; + else + getGUIObjectByName("sdCycleArea").hidden = true; - var visible = !(typeCount > 1); - getGUIObjectByName("sdCycleArea").hidden = visible; - getGUIObjectByName("sdStatsArea").hidden = true; + // Hide stats area if there is more thanone group + if (g_Selection.groups.getLength() > 1) + getGUIObjectByName("sdStatsArea").hidden = true; + else + getGUIObjectByName("sdStatsArea").hidden = false; } else { diff --git a/binaries/data/mods/public/gui/session_new/session.xml b/binaries/data/mods/public/gui/session_new/session.xml index 969e46d73c..9065564840 100644 --- a/binaries/data/mods/public/gui/session_new/session.xml +++ b/binaries/data/mods/public/gui/session_new/session.xml @@ -319,13 +319,13 @@ - cycleThroughSelection(false); + reverseCycleThroughSelection(); - cycleThroughSelection(true); + cycleThroughSelection();