Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve / fix help module, fix #258 and #244 #265

Merged
merged 7 commits into from
Feb 20, 2016
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions addons/help/CfgEventhandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class Extended_PostInit_EventHandlers {

class Extended_DisplayLoad_EventHandlers {
class RscDisplayMain {
CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line));
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line));
CBA_helpVersion = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(fnc_setCreditsLine));
};
class RscDisplayInterrupt {
CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line));
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line));
CBA_helpVersion = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(fnc_setCreditsLine));
};
class RscDisplayMPInterrupt {
CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line));
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line));
CBA_helpVersion = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
CBA_helpCredits = QUOTE(_this call COMPILE_FILE(fnc_setCreditsLine));
};
};
59 changes: 28 additions & 31 deletions addons/help/CfgRscStd.hpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
#include "script_dialog_defines.hpp"

class RscStandardDisplay;
class RscStructuredText;
class RscButton;
class RscControlsGroupNoScrollbars;

class CBA_CREDITS_CONT: RscStructuredText {
idc = -1; //template
colorBackground[] = { 0, 0, 0, 0 };
__SX(25);
__SY(23);
__SW(30);
__SH(1);
class Attributes {
font = "PuristaLight";
align = "center";
valign = "bottom";
color = "#bdcc9c";
size = 0.8;
};
};

class CBA_CREDITS_VER_BTN: RscButton {
class CBA_Credits_Ver_Btn: RscButton {
idc = -1; //template
colorText[] = {1, 1, 1, 0};
colorDisabled[] = {1, 1, 1, 0};
Expand All @@ -38,37 +17,55 @@ class CBA_CREDITS_VER_BTN: RscButton {
text = "";
};

class RscStructuredText;
class CBA_Credits_Cont: RscStructuredText {
idc = -1; //template
colorBackground[] = { 0, 0, 0, 0 };
__SX(25);
__SY(23);
__SW(30);
__SH(1);

class Attributes {
font = "RobotoCondensed";
align = "center";
valign = "bottom";
color = "#bdcc9c";
size = 0.8;
};
};

class RscStandardDisplay;
class RscDisplayMain: RscStandardDisplay {
class controls {
class VersionNumber;

class CBA_CREDITS_VER: VersionNumber {
class CBA_Credits_Ver: VersionNumber {
idc = CBA_CREDITS_VER_IDC;
y = -1;
};
class CBA_CREDITS_VER_BTN: CBA_CREDITS_VER_BTN {

class CBA_Credits_Ver_Btn: CBA_Credits_Ver_Btn {
idc = CBA_CREDITS_VER_BTN_IDC;
onMouseButtonClick = "_this call compile preprocessFileLineNumbers '\x\cba\addons\help\ver_line.sqf';";
onMouseEnter = QUOTE(GVAR(VerPause) = true);
onMouseExit = QUOTE(GVAR(VerPause) = nil);
onMouseButtonClick = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine));
};
class CBA_CREDITS_CONT_C : CBA_CREDITS_CONT {

class CBA_Credits_Cont_C: CBA_Credits_Cont {
idc = CBA_CREDITS_CONT_IDC;
};
};
};

class RscDisplayInterrupt: RscStandardDisplay {
class controls {
class CBA_CREDITS_CONT_C: CBA_CREDITS_CONT {
class CBA_Credits_Cont_C: CBA_Credits_Cont {
idc = CBA_CREDITS_CONT_IDC;
};
};
};

class RscDisplayMPInterrupt: RscStandardDisplay {
class controls {
class CBA_CREDITS_CONT_C: CBA_CREDITS_CONT {
class CBA_Credits_Cont_C: CBA_Credits_Cont {
idc = CBA_CREDITS_CONT_IDC;
};
};
Expand Down
168 changes: 88 additions & 80 deletions addons/help/XEH_postClientInit.sqf
Original file line number Diff line number Diff line change
@@ -1,93 +1,101 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"

GVAR(CREDITS_Info) = [GVAR(credits), "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet");
GVAR(CREDITS_CfgPatches) = (GVAR(CREDITS_Info)) call FUNC(process);
TRACE_2("",GVAR(CREDITS_Info), GVAR(CREDITS_CfgPatches));

#ifdef DEBUG_MODE_FULL
// Troubleshooting an A3 Funcitons Compliation for missionNamespace.
if (isNil "CBA_fnc_hashGet") then { diag_log "CBA_fnc_hashGet is nil!!";};
if (isNil QGVAR(CREDITS_CfgPatches)) then { diag_log "CREDITS_CfgPatches is nil! CBA_fnc_hashGet must have failed"; TRACE_1("",CBA_fnc_hashGet)};
#endif

private ["_pkeynam", "_shift", "_ctrl", "_alt", "_keys", "_key", "_keystrg",
"_mod", "_knaml", "_knam", "_i", "_j", "_k", "_text", "_names", "_handlers",
"_name", "_handler", "_actionNames", "_actionEntries", "_actionName",
"_displayName", "_keyn"];

_pkeynam = {
_shift = if(_shift) then {42} else {0};
_ctrl = if(_ctrl) then {56} else {0};
_alt = if(_alt) then {29} else {0};
_keys = [_shift,_ctrl,_alt,_dikKey];
_keystrg = "^";
// create diary
player createDiarySubject ["CBA_docs", "CBA"];

//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE_WIKI", "http://dev-heaven.net/projects/cca"]];

private _creditsInfo = GVAR(credits) getVariable "CfgPatches";
private _credits_CfgPatches = _creditsInfo call FUNC(process);

if (!isNil "_credits_CfgPatches") then {
player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS_ADDONS", _credits_CfgPatches]];
};

if (!isNil QGVAR(docs)) then {
player createDiaryRecord ["CBA_docs", ["Docs", GVAR(docs)]];
};

if (!isNil QGVAR(keys)) then {
player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", GVAR(keys)]];
};

//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS", GVAR(credits_cba)]];
//player createDiaryRecord ["CBA_docs", ["Credits - Vehicles", (_creditsInfo getVariable "CfgVehicles") call FUNC(process)]];
//player createDiaryRecord ["CBA_docs", ["Credits - Weapons", (_creditsInfo getVariable "CfgWeapons") call FUNC(process)]];
//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE", "http://dev-heaven.net/projects/cca"]];

// add diary for scripted keybinds
private _fnc_getKeyName = {
private _shift = [0, DIK_LSHIFT] select _shift;
private _ctrl = [0, DIK_LCONTROL] select _ctrl;
private _alt = [0, DIK_LMENU] select _alt;

private _keys = [_shift, _ctrl, _alt, _key];

_result = "^";

{
_knaml = [cba_keybinding_dikDecToStringTable, format ["%1", _x], format ["Unknown key (%1)",_x]] call BIS_fnc_getFromPairs;
_knaml = [_knaml, " "] call (uiNamespace getVariable "CBA_fnc_split");
_knam = "^";
{_k = _x; _knam = _knam + " " + _k} forEach _knaml;
_knam = [_knam, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace");
_keystrg = _keystrg + "+" + _knam;
private _keyname1 = [cba_keybinding_dikDecToStringTable, format ["%1", _x], format ["Unknown key (%1)",_x]] call BIS_fnc_getFromPairs;
_keyname1 = [_keyname1, " "] call CBA_fnc_split;

private _keyname2 = "^";

{
_keyname2 = _keyname2 + " " + _x;
} forEach _keyname1;

_keyname2 = [_keyname2, "^ ", ""] call CBA_fnc_replace;
_result = _result + "+" + _keyname2;
} forEach _keys;
_keystrg = [_keystrg, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace");
_keystrg = [_keystrg, "^+", ""] call (uiNamespace getVariable "CBA_fnc_replace");
_keystrg = [_keystrg, "^", "None"] call (uiNamespace getVariable "CBA_fnc_replace");
_keystrg = [_keystrg, "LAlt", "Alt"] call (uiNamespace getVariable "CBA_fnc_replace");
_keystrg = [_keystrg, "LCtrl", "Ctrl"] call (uiNamespace getVariable "CBA_fnc_replace");
_keystrg = [_keystrg, "LShift", "Shift"] call (uiNamespace getVariable "CBA_fnc_replace");
_keystrg

_result = [_result, "^ ", ""] call CBA_fnc_replace;
_result = [_result, "^+", ""] call CBA_fnc_replace;
_result = [_result, "^", "None"] call CBA_fnc_replace;
_result = [_result, "LAlt", "Alt"] call CBA_fnc_replace;
_result = [_result, "LCtrl", "Ctrl"] call CBA_fnc_replace;
_result = [_result, "LShift", "Shift"] call CBA_fnc_replace;
_result
};

_h = _pkeynam spawn {
_text = "";
_names = cba_keybinding_handlers select 0;
_handlers = cba_keybinding_handlers select 1;
for "_i" from 0 to (count _names) do {
_name = _names select _i;
_handler = _handlers select _i;
if (!isNil "_name") then {
_text = _text + format ["%1:<br/>", _name];
_actionNames = _handler select 0;
_actionEntries = _handler select 1;

for "_j" from 0 to (count _actionNames - 1) do {
_actionName = _actionNames select _j;
_actionEntry = _actionEntries select _j;

_displayName = _actionEntry select 0;
if (typeName _displayName == typeName []) then {
_displayName = (_actionEntry select 0) select 0;
_fnc_getKeyName spawn {
private _text = GVAR(keys);

cba_keybinding_handlers params [["_keyNames", [], [[]]], ["_keyHandlers", [], [[]]]];

{
private _keyName = _x;
private _keyHandler = _keyHandlers param [_forEachIndex, []];

if (!isNil "_keyName") then {
_text = _text + format ["%1:<br/>", _keyName];

_keyHandler params [["_actionNames", [], [[]]], ["_actionEntries", [], [[]]]];

{
private _actionName = _x;
private _actionEntry = _actionEntries param [_forEachIndex, []];

_actionEntry params [["_displayName", "", ["", []]], ["_keyBind", [], [[]]]];

if (_displayName isEqualType []) then {
_displayName = _displayName param [0, ""];
};

// Escape < and >
_displayName = [_displayName, "<", "&lt;"] call (uiNamespace getVariable "CBA_fnc_replace");
_displayName = [_displayName, ">", "&gt;"] call (uiNamespace getVariable "CBA_fnc_replace");
_keyBind = _actionEntry select 1;
_dikKey = _keyBind select 0;
_mod = _keyBind select 1;
_shift = _mod select 0;
_ctrl = _mod select 1;
_alt = _mod select 2;
_keyn = call _this;

_text = _text + format [" %1: <font color='#c48214'>%2</font><br/>", _displayName, _keyn];
};
_text = _text + "<br/>";
};
};
player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_HELP_KEYS"), _text]];
};
_displayName = [_displayName, "<", "&lt;"] call CBA_fnc_replace;
_displayName = [_displayName, ">", "&gt;"] call CBA_fnc_replace;

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

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

_text = _text + "<br/>";
};
} forEach _keyNames;

// [cba_help_credits, "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet")
player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", _text]];
};
Loading