From 97ab5a58055e03b95ee3b01e70014a72a45f1418 Mon Sep 17 00:00:00 2001 From: Blue Date: Tue, 17 Oct 2023 15:46:37 +0200 Subject: [PATCH] More GUI stuff --- addons/gui/functions/fnc_onMenuOpen.sqf | 22 +++++++++++++++++++--- addons/gui/script_component.hpp | 5 ++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/addons/gui/functions/fnc_onMenuOpen.sqf b/addons/gui/functions/fnc_onMenuOpen.sqf index 25e3a3ad7..6291c95e6 100644 --- a/addons/gui/functions/fnc_onMenuOpen.sqf +++ b/addons/gui/functions/fnc_onMenuOpen.sqf @@ -26,8 +26,8 @@ if (ACEGVAR(interact_menu,menuBackground) == 2) then {0 cutRsc [QACEGVAR(interac [{setMousePosition _this}, _this] call CBA_fnc_execNextFrame; }, getMousePosition] call CBA_fnc_execNextFrame; -// Set target name as title -private _ctrlTitle = _display displayCtrl IDC_TITLE; +// Set middle header as target name +private _ctrlTitle = _display displayCtrl IDC_NAME; _ctrlTitle ctrlSetText ([ACEGVAR(medical_gui,target)] call ACEFUNC(common,getName)); // Initially hide the triage select buttons @@ -60,9 +60,25 @@ private _countEnabled = { if (_category isEqualType "") then { _x set [1, (ACEGVAR(medical_gui,actions) findIf {_category == _x select 1}) > -1]; }; _x select 1 } count _list; -private _offsetX = POS_X(1.75) + 0.5 * (POS_X(12) - POS_X(_countEnabled * 1.5)); +private _offsetX = POS_X(1.5) + 0.5 * (POS_X(12.33) - POS_X(_countEnabled * 1.5) - POS_W(2 * 0.2)); +// 0.2 - divider gap size + +// Set divider position +private _ctrl = _display displayCtrl IDC_TRIAGE_DIVIDER; +_ctrl ctrlSetPositionX _offsetX + POS_W(1.5) + POS_W(0.085); // 0.085 = (0.2 - 0.03) / 2 +_ctrl ctrlCommit 0; + +_ctrl = _display displayCtrl IDC_TOGGLE_DIVIDER; +_ctrl ctrlSetPositionX _offsetX + POS_W(1.5*(_countEnabled - 1)) + POS_W(0.2) + POS_W(0.085); +_ctrl ctrlCommit 0; + { _x params ["_idc", "_enabled"]; + + if (_forEachIndex == 1 || {_forEachIndex == count _list - 1}) then { + _offsetX = _offsetX + POS_W(0.2); + }; + private _ctrl = _display displayCtrl _idc; if (_enabled) then { _ctrl ctrlSetPositionX _offsetX; diff --git a/addons/gui/script_component.hpp b/addons/gui/script_component.hpp index 00d7a8831..b790f78e8 100644 --- a/addons/gui/script_component.hpp +++ b/addons/gui/script_component.hpp @@ -39,6 +39,7 @@ #define IDD_MEDICAL_MENU 38580 #define IDC_TITLE 1200 +#define IDC_NAME 1210 #define IDC_TRIAGE 1300 #define IDC_EXAMINE 1310 #define IDC_BANDAGE 1320 @@ -47,7 +48,9 @@ #define IDC_ADVANCED 1350 #define IDC_DRAG 1360 #define IDC_TOGGLE 1370 -#define IDC_SURGERY 1380 +#define IDC_SURGERY 1385 +#define IDC_TRIAGE_DIVIDER 1380 +#define IDC_TOGGLE_DIVIDER 1390 #define IDC_TRIAGE_CARD 1400 #define IDC_INJURIES 1410