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
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
/*
* Author: Glowbal
* Called when a listbox selection is changed.
*
* Arguments:
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingIndex", "_rightDropDownIndex"];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,16 @@
/**
* fnc_settingsMenuUpdateList.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
/*
* Author: Glowbal
* Updates the list with all settings in the menu.
*
* Arguments:
* 0: update The selection view <BOOL>
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView"];
@ -19,7 +23,7 @@ _ctrlList = _settingsMenu displayCtrl 200;
lbclear _ctrlList;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
case (MENU_TAB_OPTIONS): {
{
_ctrlList lbadd (_x select 3);
@ -35,7 +39,7 @@ case (MENU_TAB_OPTIONS): {
_ctrlList lbadd (_settingsText);
}foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
case (MENU_TAB_COLORS): {
{
_color = +(_x select 8);
{

View File

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