Formatting, indentation, minor refactoring + fix for opening settings menu

This commit is contained in:
Glowbal 2015-03-06 18:15:32 +01:00
parent 39be8ffbe7
commit 8064253a4d
8 changed files with 212 additions and 181 deletions

View File

@ -1,12 +1,15 @@
/** /*
* fnc_onListBoxSettingsChanged.sqf * Author: Glowbal
* @Descr: N/A * Called when a listbox selection is changed.
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: *
* @PublicAPI: false * Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_settingIndex", "_rightDropDownIndex"]; private ["_settingIndex", "_rightDropDownIndex"];

View File

@ -1,12 +1,16 @@
/** /*
* fnc_onListBoxShowSelectionChanged.sqf * Author: Glowbal
* @Descr: called when the listbox selection has changed. Updates configuration menu information * called when the listbox selection has changed. Updates configuration menu information
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: * 0: Opened category or tab <STRING>
* @PublicAPI: false *
* Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_settingsMenu", "_localizedHeader"]; private ["_settingsMenu", "_localizedHeader"];

View File

@ -1,12 +1,15 @@
/** /*
* fnc_onSettingsMenuOpen.sqf * Author: Glowbal
* @Descr: called when the settings or configuration menu has opened. Do not use anywhere else. * called when the settings or configuration menu has opened. Do not use anywhere else.
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: *
* @PublicAPI: false * Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
// Filter only user setable setting // Filter only user setable setting

View File

@ -1,29 +1,34 @@
/** /*
* fnc_onSliderPosChanged.sqf * Author: PabstMirror
* @Descr: N/A * Called when a slider position is changed.
* @Author: PabstMirror
* *
* @Arguments: [] * Arguments:
* @Return: *
* @PublicAPI: false * Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_newColor", "_settingIndex"]; private ["_newColor", "_settingIndex"];
_settingIndex = lbCurSel 200;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_COLORS): {
_newColor = []; _newColor = [];
{ {
_newColor pushBack ((sliderPosition _x) / 255); _newColor pushBack ((sliderPosition _x) / 255);
} forEach [410, 411, 412, 413]; } forEach [410, 411, 412, 413];
_settingIndex = lbCurSel 200;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_COLORS): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideColors)))) then { if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideColors)))) then {
_settingIndex = (GVAR(clientSideColors) select _settingIndex) select 0; _settingIndex = (GVAR(clientSideColors) select _settingIndex) select 0;
[MENU_TAB_COLORS, _settingIndex, _newColor] call FUNC(updateSetting); [MENU_TAB_COLORS, _settingIndex, _newColor] call FUNC(updateSetting);
}; };
[false] call FUNC(settingsMenuUpdateList); [false] call FUNC(settingsMenuUpdateList);
}; };
default {};
}; };

View File

@ -1,12 +1,15 @@
/** /*
* fnc_resetSettings.sqf * Author: Glowbal
* @Descr: * Sets all client side settings back to default.
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: *
* @PublicAPI: true * Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_name", "_default", "_lastSelected"]; private ["_name", "_default", "_lastSelected"];

View File

@ -1,12 +1,15 @@
/** /*
* fnc_settingsMenuUpdateKeyView.sqf * Author: Glowbal
* @Descr: N/A * Updates the view on the right side with the selected settings details
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: *
* @PublicAPI: false * Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor"]; private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor"];
@ -27,7 +30,7 @@ if (count _collection > 0) then {
_settingIndex = count _collection - 1; _settingIndex = count _collection - 1;
}; };
if (_settingIndex < 0) exitwith { if (_settingIndex < 0) then {
_settingIndex = 0; _settingIndex = 0;
}; };
_setting = _collection select _settingIndex; _setting = _collection select _settingIndex;
@ -67,7 +70,7 @@ if (count _collection > 0) then {
}; };
} else { //no settings in list: } else { //no settings in list:
lbClear 400; lbClear 400;
(_settingsMenu displayCtrl 250) ctrlSetText _localizedName; (_settingsMenu displayCtrl 250) ctrlSetText "No settings available";
(_settingsMenu displayCtrl 251) ctrlSetText _localizedDescription; (_settingsMenu displayCtrl 251) ctrlSetText "No settings available";
(_settingsMenu displayCtrl 300) ctrlSetText _entryName; (_settingsMenu displayCtrl 300) ctrlSetText "No settings available";
}; };

View File

@ -1,12 +1,16 @@
/** /*
* fnc_settingsMenuUpdateList.sqf * Author: Glowbal
* @Descr: N/A * Updates the list with all settings in the menu.
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: * 0: update The selection view <BOOL>
* @PublicAPI: false *
* Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView"]; private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView"];

View File

@ -1,12 +1,18 @@
/** /*
* fnc_updateSetting.sqf * Author: Glowbal
* @Descr: * Upidates a setting.
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: * 0: Type Of setting <NUMBER>
* @PublicAPI: true * 1: Name of setting <STRING>
* 2: New value <ANY>
*
* Return Value:
* NONE
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_changed"]; private ["_changed"];