mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
58 lines
2.0 KiB
Plaintext
58 lines
2.0 KiB
Plaintext
/*
|
|
* Author: PabstMirror
|
|
* Handles the keypad entries from the "Mark" Application
|
|
*
|
|
* Arguments:
|
|
* 0: String version of Keypad entry ["ok","del","1",...] <STRING>
|
|
*
|
|
* Return Value:
|
|
* Nothing
|
|
*
|
|
* Example:
|
|
* ["ok"] call ace_microdagr_fnc_appMarkKeypadEntry
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
private ["_display", "_editText", "_gridPosTuple", "_actualPos"];
|
|
PARAMS_1(_keypadButton);
|
|
|
|
disableSerialization;
|
|
_display = displayNull;
|
|
if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then {
|
|
_display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]);
|
|
} else {
|
|
_display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]);
|
|
};
|
|
if (isNull _display) exitWith {ERROR("No Display");};
|
|
|
|
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 {
|
|
_gridPosTuple = [_editText] call BIS_fnc_gridToPos;
|
|
_actualPos = [(((_gridPosTuple select 0) select 0) + 0.5 * ((_gridPosTuple select 1) select 0)), (((_gridPosTuple select 0) select 1) + 0.5 * ((_gridPosTuple select 1) select 1))];
|
|
_actualPos set [2, (getTerrainHeightASL _actualPos)];
|
|
GVAR(newWaypointPosition) = _actualPos;
|
|
[APP_MODE_MARK] call FUNC(saveCurrentAndSetNewMode);
|
|
} else {
|
|
[_editText, GVAR(newWaypointPosition)] call FUNC(deviceAddWaypoint);
|
|
[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);
|
|
};
|
|
};
|