2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
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-08-26 03:31:33 +00:00
|
|
|
* None
|
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
|
|
|
*/
|
|
|
|
|
2015-08-26 03:31:33 +00:00
|
|
|
params ["_keypadButton"];
|
2015-03-09 15:46:59 +00:00
|
|
|
|
|
|
|
disableSerialization;
|
2017-10-10 14:39:59 +00:00
|
|
|
private _display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull];
|
2015-08-26 03:31:33 +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 {};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _editText = ctrlText (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
|
2015-03-09 15:46:59 +00:00
|
|
|
|
|
|
|
switch (_keypadButton) do {
|
|
|
|
case ("ok"): {
|
|
|
|
if ((count GVAR(newWaypointPosition)) == 0) then {
|
2017-10-10 14:39:59 +00:00
|
|
|
private _actualPos = [_editText, true] call EFUNC(common,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);
|
|
|
|
};
|
|
|
|
};
|