mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#2098 - Option Menu Fixes for categories
Use lbValue to store the index of the filtered selection
This commit is contained in:
parent
e5eaefafdb
commit
2565a80a22
@ -16,7 +16,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_settingsMenu"];
|
||||
private ["_settingsMenu", "_ctrlComboBox"];
|
||||
|
||||
disableSerialization;
|
||||
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
|
||||
@ -24,4 +24,4 @@ _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
|
||||
_ctrlComboBox = (_settingsMenu displayCtrl 14);
|
||||
GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox;
|
||||
|
||||
[false] call FUNC(settingsMenuUpdateList);
|
||||
[true] call FUNC(settingsMenuUpdateList);
|
||||
|
@ -16,26 +16,30 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_settingIndex", "_rightDropDownIndex"];
|
||||
private ["_settingsMenu", "_settingIndex", "_rightDropDownIndex"];
|
||||
|
||||
_settingIndex = lbCurSel 200; //Index of left list
|
||||
_rightDropDownIndex = lbCurSel 400; //Index of right drop down
|
||||
|
||||
if (_rightDropDownIndex < 0) then {_rightDropDownIndex = 0;};
|
||||
|
||||
_settingIndex = -1;
|
||||
if (((lbCurSel 200) >= 0) && {(lbCurSel 200) < ((lbSize 200)/2)}) then {
|
||||
_settingIndex = lbValue [200, (lbCurSel 200)];
|
||||
};
|
||||
if (_settingIndex == -1) exitWith {};
|
||||
|
||||
switch (GVAR(optionMenu_openTab)) do {
|
||||
case (MENU_TAB_OPTIONS): {
|
||||
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideOptions)))) then {
|
||||
_settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0;
|
||||
[MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
|
||||
_settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0;
|
||||
[MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
|
||||
};
|
||||
[false] call FUNC(settingsMenuUpdateList);
|
||||
};
|
||||
};
|
||||
case (MENU_TAB_SERVER_OPTIONS): {
|
||||
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideOptions)))) then {
|
||||
_settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0;
|
||||
[MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
|
||||
_settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0;
|
||||
[MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
|
||||
};
|
||||
[false] call FUNC(serverSettingsMenuUpdateList);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -18,9 +18,13 @@
|
||||
|
||||
private ["_settingIndex", "_inputText", "_setting", "_settingName", "_convertedValue"];
|
||||
|
||||
_settingIndex = lbCurSel 200; //Index of left list
|
||||
_inputText = ctrlText 414; //Index of right drop down
|
||||
|
||||
_settingIndex = -1;
|
||||
if (((lbCurSel 200) >= 0) && {(lbCurSel 200) < ((lbSize 200)/2)}) then {
|
||||
_settingIndex = lbValue [200, (lbCurSel 200)];
|
||||
};
|
||||
|
||||
switch (GVAR(optionMenu_openTab)) do {
|
||||
case (MENU_TAB_SERVER_VALUES): {
|
||||
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideValues)))) then {
|
||||
|
@ -56,7 +56,7 @@ if (GVAR(serverConfigGeneration) == 0) then {
|
||||
lbClear (_menu displayCtrl 14);
|
||||
{
|
||||
if (_x == "") then {
|
||||
_x = localize "STR_ACE_OptionsMenu_category_all";
|
||||
_x = localize LSTRING(category_all);
|
||||
};
|
||||
if (isLocalized _x) then {_x = localize _x};
|
||||
(_menu displayCtrl 14) lbAdd _x;
|
||||
|
@ -16,9 +16,13 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_newColor", "_settingIndex"];
|
||||
private ["_newColor", "_settingIndex", "_settingsMenu"];
|
||||
|
||||
_settingIndex = lbCurSel 200;
|
||||
_settingIndex = -1;
|
||||
if (((lbCurSel 200) >= 0) && {(lbCurSel 200) < ((lbSize 200)/2)}) then {
|
||||
_settingIndex = lbValue [200, (lbCurSel 200)];
|
||||
};
|
||||
if (_settingIndex == -1) exitWith {};
|
||||
|
||||
switch (GVAR(optionMenu_openTab)) do {
|
||||
case (MENU_TAB_COLORS): {
|
||||
|
@ -29,24 +29,13 @@ _collection = switch (GVAR(optionMenu_openTab)) do {
|
||||
default {[]};
|
||||
};
|
||||
|
||||
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
|
||||
_filteredCollection = [];
|
||||
{
|
||||
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
||||
_filteredCollection pushBack _x;
|
||||
};
|
||||
} forEach _collection;
|
||||
_settingIndex = -1;
|
||||
if (((lbCurSel _ctrlList) >= 0) && {(lbCurSel _ctrlList) < ((lbSize _ctrlList)/2)}) then {
|
||||
_settingIndex = _ctrlList lbValue (lbCurSel _ctrlList);
|
||||
};
|
||||
|
||||
if (count _filteredCollection > 0) then {
|
||||
_settingIndex = (lbCurSel _ctrlList);
|
||||
if (_settingIndex > (count _filteredCollection)) then {
|
||||
_settingIndex = count _filteredCollection - 1;
|
||||
};
|
||||
|
||||
if (_settingIndex < 0) then {
|
||||
_settingIndex = 0;
|
||||
};
|
||||
_setting = _filteredCollection select _settingIndex;
|
||||
if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then {
|
||||
_setting = _collection select _settingIndex;
|
||||
|
||||
_entryName = _setting select 0;
|
||||
_localizedName = _setting select 3;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
|
||||
private ["_added", "_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
|
||||
DEFAULT_PARAM(0,_updateKeyView,true);
|
||||
|
||||
disableSerialization;
|
||||
@ -27,11 +27,11 @@ lbclear _ctrlList;
|
||||
|
||||
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
|
||||
|
||||
|
||||
_added = 0;
|
||||
switch (GVAR(optionMenu_openTab)) do {
|
||||
case (MENU_TAB_SERVER_OPTIONS): {
|
||||
{
|
||||
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
|
||||
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
||||
if ((_x select 3) != "") then {
|
||||
_ctrlList lbadd (_x select 3);
|
||||
} else {
|
||||
@ -48,12 +48,15 @@ switch (GVAR(optionMenu_openTab)) do {
|
||||
};
|
||||
|
||||
_ctrlList lbadd (_settingsText);
|
||||
|
||||
_ctrlList lbSetValue [_added, _forEachIndex];
|
||||
_added = _added + 1;
|
||||
};
|
||||
}foreach GVAR(serverSideOptions);
|
||||
};
|
||||
case (MENU_TAB_SERVER_COLORS): {
|
||||
{
|
||||
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
|
||||
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
||||
_color = +(_x select 9);
|
||||
{
|
||||
_color set [_forEachIndex, ((round (_x * 100))/100)];
|
||||
@ -66,22 +69,28 @@ switch (GVAR(optionMenu_openTab)) do {
|
||||
};
|
||||
_ctrlList lbadd (_settingsColor);
|
||||
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)];
|
||||
|
||||
_ctrlList lbSetValue [_added, _forEachIndex];
|
||||
_added = _added + 1;
|
||||
};
|
||||
}foreach GVAR(serverSideColors);
|
||||
};
|
||||
case (MENU_TAB_SERVER_VALUES): {
|
||||
{
|
||||
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
|
||||
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
||||
if ((_x select 3) != "") then {
|
||||
_ctrlList lbadd (_x select 3);
|
||||
} else {
|
||||
_ctrlList lbadd (_x select 0);
|
||||
};
|
||||
_settingsValue = _x select 9;
|
||||
if (typeName _settingsValue != "STRINg") then {
|
||||
if (typeName _settingsValue != "STRING") then {
|
||||
_settingsValue = format["%1", _settingsValue];
|
||||
};
|
||||
_ctrlList lbadd (_settingsValue);
|
||||
|
||||
_ctrlList lbSetValue [_added, _forEachIndex];
|
||||
_added = _added + 1;
|
||||
};
|
||||
}foreach GVAR(serverSideValues);
|
||||
};
|
||||
|
@ -28,24 +28,15 @@ _collection = switch (GVAR(optionMenu_openTab)) do {
|
||||
default {[]};
|
||||
};
|
||||
|
||||
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
|
||||
_filteredCollection = [];
|
||||
{
|
||||
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
||||
_filteredCollection pushBack _x;
|
||||
};
|
||||
} forEach _collection;
|
||||
_settingIndex = -1;
|
||||
if (((lbCurSel _ctrlList) >= 0) && {(lbCurSel _ctrlList) < ((lbSize _ctrlList)/2)}) then {
|
||||
_settingIndex = _ctrlList lbValue (lbCurSel _ctrlList);
|
||||
};
|
||||
|
||||
if (count _filteredCollection > 0) then {
|
||||
_settingIndex = (lbCurSel _ctrlList);
|
||||
if (_settingIndex > (count _filteredCollection)) then {
|
||||
_settingIndex = count _filteredCollection - 1;
|
||||
};
|
||||
TRACE_3("Selected",_settingIndex,(lbCurSel _ctrlList),((lbSize _ctrlList)/2));
|
||||
|
||||
if (_settingIndex < 0) then {
|
||||
_settingIndex = 0;
|
||||
};
|
||||
_setting = _filteredCollection select _settingIndex;
|
||||
if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then {
|
||||
_setting = _collection select _settingIndex;
|
||||
|
||||
_entryName = _setting select 0;
|
||||
_localizedName = _setting select 3;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
|
||||
private ["_added", "_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
|
||||
DEFAULT_PARAM(0,_updateKeyView,true);
|
||||
|
||||
disableSerialization;
|
||||
@ -27,10 +27,11 @@ lbclear _ctrlList;
|
||||
|
||||
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
|
||||
|
||||
_added = 0;
|
||||
switch (GVAR(optionMenu_openTab)) do {
|
||||
case (MENU_TAB_OPTIONS): {
|
||||
{
|
||||
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
|
||||
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
||||
_ctrlList lbadd (_x select 3);
|
||||
_settingsValue = _x select 9;
|
||||
|
||||
@ -41,12 +42,15 @@ switch (GVAR(optionMenu_openTab)) do {
|
||||
(_x select 5) select _settingsValue;
|
||||
};
|
||||
_ctrlList lbadd (_settingsText);
|
||||
|
||||
_ctrlList lbSetValue [_added, _forEachIndex];
|
||||
_added = _added + 1;
|
||||
};
|
||||
}foreach GVAR(clientSideOptions);
|
||||
} foreach GVAR(clientSideOptions);
|
||||
};
|
||||
case (MENU_TAB_COLORS): {
|
||||
{
|
||||
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
|
||||
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
||||
_color = +(_x select 9);
|
||||
{
|
||||
_color set [_forEachIndex, ((round (_x * 100))/100)];
|
||||
@ -55,6 +59,9 @@ switch (GVAR(optionMenu_openTab)) do {
|
||||
_ctrlList lbadd (_x select 3);
|
||||
_ctrlList lbadd (_settingsColor);
|
||||
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)];
|
||||
|
||||
_ctrlList lbSetValue [_added, _forEachIndex];
|
||||
_added = _added + 1;
|
||||
};
|
||||
}foreach GVAR(clientSideColors);
|
||||
};
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
private ["_str", "_array", "_maxIndex"];
|
||||
private ["_str", "_array", "_maxIndex", "_isEven"];
|
||||
_str = _this;
|
||||
|
||||
_isEven = {
|
||||
|
@ -277,7 +277,7 @@ class ACE_settingsMenu {
|
||||
};
|
||||
class ACE_serverSettingsMenu: ACE_settingsMenu {
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', _this select 0)]; [] call FUNC(onServerSettingsMenuOpen););
|
||||
onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', nil)];);
|
||||
onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', nil)]; [] call FUNC(onSettingsMenuOpen););
|
||||
class controls: controls {
|
||||
class HeaderName {
|
||||
idc = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user