Skip to content

Commit 33c8a9e

Browse files
committed
Merge pull request #265 from CBATeam/fixhelpmodule
improve / fix help module, fix #258 and #244
2 parents ac567ab + dced686 commit 33c8a9e

14 files changed

+506
-838
lines changed

addons/help/CfgEventhandlers.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ class Extended_PostInit_EventHandlers {
1313

1414
class Extended_DisplayLoad_EventHandlers {
1515
class RscDisplayMain {
16-
CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line));
17-
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line));
16+
CBA_helpVersion = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
17+
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(fnc_setCreditsLine));
1818
};
1919
class RscDisplayInterrupt {
20-
CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line));
21-
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line));
20+
CBA_helpVersion = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
21+
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(fnc_setCreditsLine));
2222
};
2323
class RscDisplayMPInterrupt {
24-
CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line));
25-
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line));
24+
CBA_helpVersion = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
25+
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(fnc_setCreditsLine));
2626
};
2727
};

addons/help/CfgRscStd.hpp

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
1-
#include "script_dialog_defines.hpp"
21

3-
class RscStandardDisplay;
4-
class RscStructuredText;
52
class RscButton;
6-
class RscControlsGroupNoScrollbars;
7-
8-
class CBA_CREDITS_CONT: RscStructuredText {
9-
idc = -1; //template
10-
colorBackground[] = { 0, 0, 0, 0 };
11-
__SX(25);
12-
__SY(23);
13-
__SW(30);
14-
__SH(1);
15-
class Attributes {
16-
font = "PuristaLight";
17-
align = "center";
18-
valign = "bottom";
19-
color = "#bdcc9c";
20-
size = 0.8;
21-
};
22-
};
23-
24-
class CBA_CREDITS_VER_BTN: RscButton {
3+
class CBA_Credits_Ver_Btn: RscButton {
254
idc = -1; //template
265
colorText[] = {1, 1, 1, 0};
276
colorDisabled[] = {1, 1, 1, 0};
@@ -38,37 +17,55 @@ class CBA_CREDITS_VER_BTN: RscButton {
3817
text = "";
3918
};
4019

20+
class RscStructuredText;
21+
class CBA_Credits_Cont: RscStructuredText {
22+
idc = -1; //template
23+
colorBackground[] = { 0, 0, 0, 0 };
24+
__SX(25);
25+
__SY(23);
26+
__SW(30);
27+
__SH(1);
28+
29+
class Attributes {
30+
font = "RobotoCondensed";
31+
align = "center";
32+
valign = "bottom";
33+
color = "#bdcc9c";
34+
size = 0.8;
35+
};
36+
};
37+
38+
class RscStandardDisplay;
4139
class RscDisplayMain: RscStandardDisplay {
4240
class controls {
4341
class VersionNumber;
44-
45-
class CBA_CREDITS_VER: VersionNumber {
42+
class CBA_Credits_Ver: VersionNumber {
4643
idc = CBA_CREDITS_VER_IDC;
4744
y = -1;
4845
};
49-
class CBA_CREDITS_VER_BTN: CBA_CREDITS_VER_BTN {
46+
47+
class CBA_Credits_Ver_Btn: CBA_Credits_Ver_Btn {
5048
idc = CBA_CREDITS_VER_BTN_IDC;
51-
onMouseButtonClick = "_this call compile preprocessFileLineNumbers '\x\cba\addons\help\ver_line.sqf';";
52-
onMouseEnter = QUOTE(GVAR(VerPause) = true);
53-
onMouseExit = QUOTE(GVAR(VerPause) = nil);
49+
onMouseButtonClick = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
5450
};
55-
class CBA_CREDITS_CONT_C : CBA_CREDITS_CONT {
51+
52+
class CBA_Credits_Cont_C: CBA_Credits_Cont {
5653
idc = CBA_CREDITS_CONT_IDC;
5754
};
5855
};
5956
};
6057

6158
class RscDisplayInterrupt: RscStandardDisplay {
6259
class controls {
63-
class CBA_CREDITS_CONT_C: CBA_CREDITS_CONT {
60+
class CBA_Credits_Cont_C: CBA_Credits_Cont {
6461
idc = CBA_CREDITS_CONT_IDC;
6562
};
6663
};
6764
};
6865

6966
class RscDisplayMPInterrupt: RscStandardDisplay {
7067
class controls {
71-
class CBA_CREDITS_CONT_C: CBA_CREDITS_CONT {
68+
class CBA_Credits_Cont_C: CBA_Credits_Cont {
7269
idc = CBA_CREDITS_CONT_IDC;
7370
};
7471
};

addons/help/XEH_postClientInit.sqf

Lines changed: 88 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,101 @@
11
//#define DEBUG_MODE_FULL
22
#include "script_component.hpp"
33

4-
GVAR(CREDITS_Info) = [GVAR(credits), "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet");
5-
GVAR(CREDITS_CfgPatches) = (GVAR(CREDITS_Info)) call FUNC(process);
6-
TRACE_2("",GVAR(CREDITS_Info), GVAR(CREDITS_CfgPatches));
7-
8-
#ifdef DEBUG_MODE_FULL
9-
// Troubleshooting an A3 Funcitons Compliation for missionNamespace.
10-
if (isNil "CBA_fnc_hashGet") then { diag_log "CBA_fnc_hashGet is nil!!";};
11-
if (isNil QGVAR(CREDITS_CfgPatches)) then { diag_log "CREDITS_CfgPatches is nil! CBA_fnc_hashGet must have failed"; TRACE_1("",CBA_fnc_hashGet)};
12-
#endif
13-
14-
private ["_pkeynam", "_shift", "_ctrl", "_alt", "_keys", "_key", "_keystrg",
15-
"_mod", "_knaml", "_knam", "_i", "_j", "_k", "_text", "_names", "_handlers",
16-
"_name", "_handler", "_actionNames", "_actionEntries", "_actionName",
17-
"_displayName", "_keyn"];
18-
19-
_pkeynam = {
20-
_shift = if(_shift) then {42} else {0};
21-
_ctrl = if(_ctrl) then {56} else {0};
22-
_alt = if(_alt) then {29} else {0};
23-
_keys = [_shift,_ctrl,_alt,_dikKey];
24-
_keystrg = "^";
4+
// create diary
5+
player createDiarySubject ["CBA_docs", "CBA"];
6+
7+
//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE_WIKI", "http://dev-heaven.net/projects/cca"]];
8+
9+
private _creditsInfo = GVAR(credits) getVariable "CfgPatches";
10+
private _credits_CfgPatches = _creditsInfo call FUNC(process);
11+
12+
if (!isNil "_credits_CfgPatches") then {
13+
player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS_ADDONS", _credits_CfgPatches]];
14+
};
15+
16+
if (!isNil QGVAR(docs)) then {
17+
player createDiaryRecord ["CBA_docs", ["Docs", GVAR(docs)]];
18+
};
19+
20+
if (!isNil QGVAR(keys)) then {
21+
player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", GVAR(keys)]];
22+
};
23+
24+
//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS", GVAR(credits_cba)]];
25+
//player createDiaryRecord ["CBA_docs", ["Credits - Vehicles", (_creditsInfo getVariable "CfgVehicles") call FUNC(process)]];
26+
//player createDiaryRecord ["CBA_docs", ["Credits - Weapons", (_creditsInfo getVariable "CfgWeapons") call FUNC(process)]];
27+
//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE", "http://dev-heaven.net/projects/cca"]];
28+
29+
// add diary for scripted keybinds
30+
private _fnc_getKeyName = {
31+
private _shift = [0, DIK_LSHIFT] select _shift;
32+
private _ctrl = [0, DIK_LCONTROL] select _ctrl;
33+
private _alt = [0, DIK_LMENU] select _alt;
34+
35+
private _keys = [_shift, _ctrl, _alt, _key];
36+
37+
_result = "^";
38+
2539
{
26-
_knaml = [cba_keybinding_dikDecToStringTable, format ["%1", _x], format ["Unknown key (%1)",_x]] call BIS_fnc_getFromPairs;
27-
_knaml = [_knaml, " "] call (uiNamespace getVariable "CBA_fnc_split");
28-
_knam = "^";
29-
{_k = _x; _knam = _knam + " " + _k} forEach _knaml;
30-
_knam = [_knam, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace");
31-
_keystrg = _keystrg + "+" + _knam;
40+
private _keyname1 = [cba_keybinding_dikDecToStringTable, format ["%1", _x], format ["Unknown key (%1)",_x]] call BIS_fnc_getFromPairs;
41+
_keyname1 = [_keyname1, " "] call CBA_fnc_split;
42+
43+
private _keyname2 = "^";
44+
45+
{
46+
_keyname2 = _keyname2 + " " + _x;
47+
} forEach _keyname1;
48+
49+
_keyname2 = [_keyname2, "^ ", ""] call CBA_fnc_replace;
50+
_result = _result + "+" + _keyname2;
3251
} forEach _keys;
33-
_keystrg = [_keystrg, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace");
34-
_keystrg = [_keystrg, "^+", ""] call (uiNamespace getVariable "CBA_fnc_replace");
35-
_keystrg = [_keystrg, "^", "None"] call (uiNamespace getVariable "CBA_fnc_replace");
36-
_keystrg = [_keystrg, "LAlt", "Alt"] call (uiNamespace getVariable "CBA_fnc_replace");
37-
_keystrg = [_keystrg, "LCtrl", "Ctrl"] call (uiNamespace getVariable "CBA_fnc_replace");
38-
_keystrg = [_keystrg, "LShift", "Shift"] call (uiNamespace getVariable "CBA_fnc_replace");
39-
_keystrg
52+
53+
_result = [_result, "^ ", ""] call CBA_fnc_replace;
54+
_result = [_result, "^+", ""] call CBA_fnc_replace;
55+
_result = [_result, "^", "None"] call CBA_fnc_replace;
56+
_result = [_result, "LAlt", "Alt"] call CBA_fnc_replace;
57+
_result = [_result, "LCtrl", "Ctrl"] call CBA_fnc_replace;
58+
_result = [_result, "LShift", "Shift"] call CBA_fnc_replace;
59+
_result
4060
};
4161

42-
_h = _pkeynam spawn {
43-
_text = "";
44-
_names = cba_keybinding_handlers select 0;
45-
_handlers = cba_keybinding_handlers select 1;
46-
for "_i" from 0 to (count _names) do {
47-
_name = _names select _i;
48-
_handler = _handlers select _i;
49-
if (!isNil "_name") then {
50-
_text = _text + format ["%1:<br/>", _name];
51-
_actionNames = _handler select 0;
52-
_actionEntries = _handler select 1;
53-
54-
for "_j" from 0 to (count _actionNames - 1) do {
55-
_actionName = _actionNames select _j;
56-
_actionEntry = _actionEntries select _j;
57-
58-
_displayName = _actionEntry select 0;
59-
if (typeName _displayName == typeName []) then {
60-
_displayName = (_actionEntry select 0) select 0;
62+
_fnc_getKeyName spawn {
63+
private _text = GVAR(keys);
64+
65+
cba_keybinding_handlers params [["_keyNames", [], [[]]], ["_keyHandlers", [], [[]]]];
66+
67+
{
68+
private _keyName = _x;
69+
private _keyHandler = _keyHandlers param [_forEachIndex, []];
70+
71+
if (!isNil "_keyName") then {
72+
_text = _text + format ["%1:<br/>", _keyName];
73+
74+
_keyHandler params [["_actionNames", [], [[]]], ["_actionEntries", [], [[]]]];
75+
76+
{
77+
private _actionName = _x;
78+
private _actionEntry = _actionEntries param [_forEachIndex, []];
79+
80+
_actionEntry params [["_displayName", "", ["", []]], ["_keyBind", [], [[]]]];
81+
82+
if (_displayName isEqualType []) then {
83+
_displayName = _displayName param [0, ""];
6184
};
85+
6286
// Escape < and >
63-
_displayName = [_displayName, "<", "&lt;"] call (uiNamespace getVariable "CBA_fnc_replace");
64-
_displayName = [_displayName, ">", "&gt;"] call (uiNamespace getVariable "CBA_fnc_replace");
65-
_keyBind = _actionEntry select 1;
66-
_dikKey = _keyBind select 0;
67-
_mod = _keyBind select 1;
68-
_shift = _mod select 0;
69-
_ctrl = _mod select 1;
70-
_alt = _mod select 2;
71-
_keyn = call _this;
72-
73-
_text = _text + format [" %1: <font color='#c48214'>%2</font><br/>", _displayName, _keyn];
74-
};
75-
_text = _text + "<br/>";
76-
};
77-
};
78-
player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_HELP_KEYS"), _text]];
79-
};
87+
_displayName = [_displayName, "<", "&lt;"] call CBA_fnc_replace;
88+
_displayName = [_displayName, ">", "&gt;"] call CBA_fnc_replace;
8089

81-
player createDiarySubject ["CBA_docs", "CBA"];
82-
//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_WEBSITE_WIKI"), "http://dev-heaven.net/projects/cca"]];
83-
if (!isNil QGVAR(CREDITS_CfgPatches)) then { player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_CREDITS_ADDONS"), GVAR(CREDITS_CfgPatches)]];};
84-
if (!isNil QGVAR(docs)) then { player createDiaryRecord ["CBA_docs", ["Docs", GVAR(docs)]];};
85-
if (!isNil QGVAR(keys)) then { player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_HELP_KEYS"), GVAR(keys)]];};
86-
//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_CREDITS"), GVAR(credits_cba)]];
87-
//player createDiaryRecord ["CBA_docs", ["Credits - Vehicles", ([GVAR(credits), "CfgVehicles"] call (uiNamespace getVariable "CBA_fnc_hashGet")) call FUNC(process)]];
88-
//player createDiaryRecord ["CBA_docs", ["Credits - Weapons", ([GVAR(credits), "CfgWeapons"] call (uiNamespace getVariable "CBA_fnc_hashGet")) call FUNC(process)]];
90+
_keyBind params [["_key", 0, [0]], ["_mod", [], [[]]]];
91+
_mod params [["_shift", false, [false]], ["_ctrl", false, [false]], ["_alt", false, [false]]];
8992

90-
//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_WEBSITE"), "http://dev-heaven.net/projects/cca"]];
93+
_text = _text + format [" %1: <font color='#c48214'>%2</font><br/>", _displayName, call _this];
94+
} forEach _actionNames;
9195

96+
_text = _text + "<br/>";
97+
};
98+
} forEach _keyNames;
9299

93-
// [cba_help_credits, "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet")
100+
player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", _text]];
101+
};

0 commit comments

Comments
 (0)