ACE3/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf

57 lines
1.8 KiB
Plaintext
Raw Normal View History

2015-03-09 15:46:59 +00:00
/*
* Author: PabstMirror
2015-03-11 07:06:07 +00:00
* Handles the keypad entries from the "Mark" Application
2015-03-09 15:46:59 +00:00
*
* Arguments:
2015-03-11 07:06:07 +00:00
* 0: String version of Keypad entry ["ok","del","1",...] <STRING>
2015-03-09 15:46:59 +00:00
*
* Return Value:
2015-03-11 07:06:07 +00:00
* Nothing
2015-03-09 15:46:59 +00:00
*
* Example:
2015-03-11 07:06:07 +00:00
* ["ok"] call ace_microdagr_fnc_appMarkKeypadEntry
2015-03-09 15:46:59 +00:00
*
2015-03-11 07:06:07 +00:00
* Public: No
2015-03-09 15:46:59 +00:00
*/
#include "script_component.hpp"
2015-06-30 16:18:47 +00:00
private ["_display", "_editText", "_actualPos"];
2015-03-09 15:46:59 +00:00
PARAMS_1(_keypadButton);
disableSerialization;
2015-03-09 18:52:15 +00:00
_display = displayNull;
if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then {
_display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]);
} else {
_display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]);
2015-03-09 15:46:59 +00:00
};
2015-03-09 18:52:15 +00:00
if (isNull _display) exitWith {ERROR("No Display");};
2015-03-09 15:46:59 +00:00
if (GVAR(currentApplicationPage) != APP_MODE_MARK) exitWith {};
_editText = ctrlText (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
switch (_keypadButton) do {
case ("ok"): {
if ((count GVAR(newWaypointPosition)) == 0) then {
2015-06-30 16:18:47 +00:00
_actualPos = [_editText, true] call EFUNC(map,getMapPosFromGrid);
2015-03-09 21:09:00 +00:00
_actualPos set [2, (getTerrainHeightASL _actualPos)];
2015-03-09 15:46:59 +00:00
GVAR(newWaypointPosition) = _actualPos;
[APP_MODE_MARK] call FUNC(saveCurrentAndSetNewMode);
} else {
2015-03-09 18:52:15 +00:00
[_editText, GVAR(newWaypointPosition)] call FUNC(deviceAddWaypoint);
2015-03-09 15:46:59 +00:00
[APP_MODE_WAYPOINTS] call FUNC(saveCurrentAndSetNewMode);
};
};
case ("del"): {
_editText = _editText select [0, (((count _editText) - 1) max 0)];
(_display displayCtrl IDC_MODEMARK_CORDSEDIT) ctrlSetText _editText;
ctrlSetFocus (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
};
default {
_editText = _editText + _keypadButton;
(_display displayCtrl IDC_MODEMARK_CORDSEDIT) ctrlSetText _editText;
ctrlSetFocus (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
};
};