ACE3/addons/microdagr/functions/fnc_showApplicationPage.sqf

118 lines
4.9 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
2015-03-09 15:46:59 +00:00
/*
* Author: PabstMirror
2015-03-11 07:06:07 +00:00
* Changes the "application page" shown on the microDAGR
2015-03-09 15:46:59 +00:00
*
* Arguments:
2015-08-26 03:31:33 +00:00
* None
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
* [] call ace_microdagr_fnc_showApplicationPage
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
*/
disableSerialization;
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
//TopBar
(_display displayCtrl IDC_RANGEFINDERCONNECTEDICON) ctrlShow (GVAR(currentWaypoint) == -2);
//Mode: Info:
2015-03-11 07:06:07 +00:00
(_display displayCtrl IDC_MODEDISPLAY) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_INFODISPLAY);
2015-03-09 15:46:59 +00:00
2015-03-11 07:06:07 +00:00
if (GVAR(currentApplicationPage) == APP_MODE_INFODISPLAY) then {
2015-03-09 15:46:59 +00:00
(_display displayCtrl IDC_MODEDISPLAY_UTMGRID) ctrlSetText GVAR(mgrsGridZoneDesignator);
if (GVAR(currentWaypoint) == -1) then {
(_display displayCtrl IDC_MODEDISPLAY_MODEPOSTIMECG) ctrlShow true;
(_display displayCtrl IDC_MODEDISPLAY_MODEPOSTARGETCG) ctrlShow false;
} else {
(_display displayCtrl IDC_MODEDISPLAY_MODEPOSTIMECG) ctrlShow false;
(_display displayCtrl IDC_MODEDISPLAY_MODEPOSTARGETCG) ctrlShow true;
if (GVAR(currentWaypoint) == -2) then {
2016-03-08 18:21:28 +00:00
(_display displayCtrl IDC_MODEDISPLAY_TARGETICON) ctrlSetText QUOTE(PATHTOF(images\icon_menuLaser.paa));
2015-03-09 15:46:59 +00:00
} else {
2016-04-08 18:34:50 +00:00
(_display displayCtrl IDC_MODEDISPLAY_TARGETICON) ctrlSetText QPATHTOF(images\icon_menuMark.paa);
2015-03-09 15:46:59 +00:00
};
};
};
//Mode: Compass:
2015-03-11 07:06:07 +00:00
(_display displayCtrl IDC_MODECOMPASS) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_COMPASS);
(_display displayCtrl IDC_MAPCOMPASS) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_COMPASS);
2015-03-09 15:46:59 +00:00
//Mode: Map
2015-03-11 07:06:07 +00:00
(_display displayCtrl IDC_MODEMAP_MAPTRACKBUTTON) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_MAP);
(_display displayCtrl IDC_MODEMAP_MAPZOOMIN) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_MAP);
(_display displayCtrl IDC_MODEMAP_MAPZOOMOUT) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_MAP);
2015-03-09 15:46:59 +00:00
2015-03-11 07:06:07 +00:00
(_display displayCtrl IDC_MAPPLAIN) ctrlShow ((GVAR(currentApplicationPage) == APP_MODE_MAP) && {!GVAR(mapShowTexture)});
(_display displayCtrl IDC_MAPDETAILS) ctrlShow ((GVAR(currentApplicationPage) == APP_MODE_MAP) && {GVAR(mapShowTexture)});
2015-03-09 15:46:59 +00:00
2015-03-11 07:06:07 +00:00
if (GVAR(currentApplicationPage) == APP_MODE_MAP) then {
2015-03-09 15:46:59 +00:00
_theMap = if (!GVAR(mapShowTexture)) then {_display displayCtrl IDC_MAPPLAIN} else {_display displayCtrl IDC_MAPDETAILS};
_mapSize = (ctrlPosition _theMap) select 3;
_theMap ctrlMapAnimAdd [0, (GVAR(mapZoom) / _mapSize), GVAR(mapPosition)];
ctrlMapAnimCommit _theMap;
if (GVAR(mapAutoTrackPosition)) then {
(_display displayCtrl IDC_MODEMAP_MAPTRACKBUTTON) ctrlSetTextColor [1,1,1,0.8];
} else {
(_display displayCtrl IDC_MODEMAP_MAPTRACKBUTTON) ctrlSetTextColor [1,1,1,0.4];
};
};
//Mode: Menu
2015-03-11 07:06:07 +00:00
(_display displayCtrl IDC_MODEMENU) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_MENU);
2015-03-09 15:46:59 +00:00
//Mode: Mark
if (GVAR(currentApplicationPage) == APP_MODE_MARK) then {
(_display displayCtrl IDC_MODEMARK) ctrlShow true;
//not backed up for displayMode swap, not a big deal
if ((count GVAR(newWaypointPosition)) == 0) then {
2015-05-28 19:59:04 +00:00
(_display displayCtrl IDC_MODEMARK_HEADER) ctrlSetText (localize LSTRING(wpEnterCords));
2015-03-09 15:46:59 +00:00
(_display displayCtrl IDC_MODEMARK_CORDSEDIT) ctrlSetText "";
} else {
2015-05-28 19:59:04 +00:00
(_display displayCtrl IDC_MODEMARK_HEADER) ctrlSetText format [(localize LSTRING(wpEnterName)), mapGridPosition GVAR(newWaypointPosition)];
2015-03-09 15:46:59 +00:00
(_display displayCtrl IDC_MODEMARK_CORDSEDIT) ctrlSetText format ["[%1]", mapGridPosition GVAR(newWaypointPosition)];
};
ctrlSetFocus (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
} else {
(_display displayCtrl IDC_MODEMARK) ctrlShow false;
GVAR(newWaypointPosition) = [];
};
//Mode: Waypoints
(_display displayCtrl IDC_MODEWAYPOINTS) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_WAYPOINTS);
2015-03-11 02:48:57 +00:00
//Mode: Setting
(_display displayCtrl IDC_MODESETTINGS) ctrlShow (GVAR(currentApplicationPage) == APP_MODE_SETUP);
2015-03-09 18:52:15 +00:00
2015-03-12 17:16:33 +00:00
//Buttons pushed:
2015-03-11 07:06:07 +00:00
if (GVAR(currentApplicationPage) == APP_MODE_INFODISPLAY) then {
2016-04-08 18:34:50 +00:00
(_display displayCtrl IDC_BUTTONBG0) ctrlSetText QPATHTOF(images\button_pushedDown.paa);
2015-03-09 15:46:59 +00:00
} else {
2016-04-08 18:34:50 +00:00
(_display displayCtrl IDC_BUTTONBG0) ctrlSetText QPATHTOF(images\button_pushedUp.paa);
2015-03-09 15:46:59 +00:00
};
2015-03-11 07:06:07 +00:00
if (GVAR(currentApplicationPage) == APP_MODE_COMPASS) then {
2016-04-08 18:34:50 +00:00
(_display displayCtrl IDC_BUTTONBG1) ctrlSetText QPATHTOF(images\button_pushedDown.paa);
2015-03-09 15:46:59 +00:00
} else {
2016-04-08 18:34:50 +00:00
(_display displayCtrl IDC_BUTTONBG1) ctrlSetText QPATHTOF(images\button_pushedUp.paa);
2015-03-09 15:46:59 +00:00
};
2015-03-11 07:06:07 +00:00
if (GVAR(currentApplicationPage) == APP_MODE_MAP) then {
2016-04-08 18:34:50 +00:00
(_display displayCtrl IDC_BUTTONBG2) ctrlSetText QPATHTOF(images\button_pushedDown.paa);
2015-03-09 15:46:59 +00:00
} else {
2016-04-08 18:34:50 +00:00
(_display displayCtrl IDC_BUTTONBG2) ctrlSetText QPATHTOF(images\button_pushedUp.paa);
2015-03-09 15:46:59 +00:00
};
//Update the page now:
[] call FUNC(updateDisplay);