From 2f133d08c39a867a52f0c6b1f5eba509bb05ba69 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 18 Feb 2016 18:27:14 +0100 Subject: [PATCH 1/5] rewrite help credits, fix issues with help credits --- addons/help/CfgEventhandlers.hpp | 6 +- addons/help/CfgRscStd.hpp | 59 +++-- addons/help/XEH_preClientInit.sqf | 5 +- addons/help/cred_line.sqf | 115 +++++---- addons/help/defineCommonGrids.inc | 323 -------------------------- addons/help/fnc_describe.sqf | 44 ---- addons/help/fnc_help.sqf | 2 - addons/help/script_component.hpp | 6 + addons/help/script_dialog_defines.hpp | 73 +----- addons/help/stringtable.xml | 96 ++++---- addons/help/ver_line.sqf | 136 ++++++----- 11 files changed, 230 insertions(+), 635 deletions(-) delete mode 100644 addons/help/defineCommonGrids.inc delete mode 100644 addons/help/fnc_describe.sqf delete mode 100644 addons/help/fnc_help.sqf diff --git a/addons/help/CfgEventhandlers.hpp b/addons/help/CfgEventhandlers.hpp index 93118f953..88e981d61 100644 --- a/addons/help/CfgEventhandlers.hpp +++ b/addons/help/CfgEventhandlers.hpp @@ -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_helpVersion = QUOTE(_this call COMPILE_FILE(ver_line)); CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line)); }; class RscDisplayInterrupt { - CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line)); + CBA_helpVersion = QUOTE(_this call COMPILE_FILE(ver_line)); CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line)); }; class RscDisplayMPInterrupt { - CBA_helpVersion = QUOTE([(_this select 0) displayCtrl CBA_CREDITS_VER_IDC] call COMPILE_FILE(ver_line)); + CBA_helpVersion = QUOTE(_this call COMPILE_FILE(ver_line)); CBA_helpCredits = QUOTE(_this call COMPILE_FILE(cred_line)); }; }; diff --git a/addons/help/CfgRscStd.hpp b/addons/help/CfgRscStd.hpp index c01cf6d70..65c776a9c 100644 --- a/addons/help/CfgRscStd.hpp +++ b/addons/help/CfgRscStd.hpp @@ -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}; @@ -38,21 +17,39 @@ 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(ver_line)); }; - class CBA_CREDITS_CONT_C : CBA_CREDITS_CONT { + + class CBA_Credits_Cont_C: CBA_Credits_Cont { idc = CBA_CREDITS_CONT_IDC; }; }; @@ -60,7 +57,7 @@ class RscDisplayMain: RscStandardDisplay { 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; }; }; @@ -68,7 +65,7 @@ class RscDisplayInterrupt: RscStandardDisplay { 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; }; }; diff --git a/addons/help/XEH_preClientInit.sqf b/addons/help/XEH_preClientInit.sqf index 234484c76..0d4049b70 100644 --- a/addons/help/XEH_preClientInit.sqf +++ b/addons/help/XEH_preClientInit.sqf @@ -8,8 +8,9 @@ LOG(MSG_INIT); ADDON = false; -PREP(help); -PREP(describe); +FUNC(help) = { + call BIS_fnc_help; +}; FUNC(readConfig) = { params ["_type"]; diff --git a/addons/help/cred_line.sqf b/addons/help/cred_line.sqf index 82756ed30..9bd1dcb5d 100644 --- a/addons/help/cred_line.sqf +++ b/addons/help/cred_line.sqf @@ -1,71 +1,68 @@ // #define DEBUG_MODE_FULL #include "script_component.hpp" -#include "script_dialog_defines.hpp" disableSerialization; -private ["_disp", "_ctrlt", "_ctrl", "_config", "_stop", "_rand", "_entry", "_name", "_authors", "_author", "_url", "_text", "_version"]; -if ( isNil QGVAR(show_proc) ) then { - GVAR(show_proc) = true; +// get display +params [["_display", displayNull, [displayNull, controlNull]]]; - //get display control - if (typeName (_this select 0) == "DISPLAY") then { - _disp = _this select 0; +if (_display isEqualType controlNull) then { + _display = ctrlParent _display; +}; + +private _ctrl = _display displayCtrl CBA_CREDITS_CONT_IDC; + +if !(ctrlText _ctrl isEqualTo "") exitWith {}; + +// get settings +{ + if (isNil _x) then { + missionNamespace setVariable [_x, isClass (configFile >> "CfgPatches" >> _x)]; }; +} forEach ["CBA_DisableCredits", "CBA_MonochromeCredits"]; + +if (CBA_DisableCredits) exitWith {}; - if (typeName (_this select 0) == "CONTROL") then { - _ctrlt = _this select 0; - _disp = ctrlParent _ctrlt; +// find addon with author +private _config = configFile >> "CfgPatches"; +private _entry = selectRandom ("isArray (_x >> 'author')" configClasses _config); + +if (isNil "_entry") exitWith {}; + +// addon name +private _name = configName _entry; + +if (!CBA_MonochromeCredits) then { + _name = format ["%1", _name]; +}; + +// author(s) name +private _authors = getArray (_entry >> "author"); +private _author = _authors deleteAt 0; + +{ + if (_x isEqualType "") then { + _author = format ["%1, %2", _author, _x]; }; +} forEach _authors; + +// url if any +private _url = ""; + +if (isText (_entry >> "authorUrl")) then { + _url = getText (_entry >> "authorUrl"); - _ctrl = _disp displayCtrl CBA_CREDITS_CONT_IDC; - - //get settings - { - if (isNil _x) then { missionNamespace setVariable [_x, isClass(configFile/"CfgPatches"/_x)] }; - } forEach ["CBA_DisableCredits", "CBA_MonochromeCredits"]; - - //TRACE_1("",ctrlText _ctrl); - //if text not already shown - if ( (ctrlText _ctrl) == "" && {!CBA_DisableCredits} ) then { - //find addon with author - _config = configFile >> "CfgPatches"; - _stop = false; - while { ! _stop } do { - _rand = floor(random(count _config)); - _entry = _config select _rand; - if ( isClass _entry ) then { _stop = isArray (_entry >> "author"); }; - //TRACE_1("",configName _entry); - }; - - //addon name - _name = configName _entry; - if ( ! CBA_MonochromeCredits ) then { _name = "" + _name + ""; }; - //author(s) name - _authors = getArray(_entry >> "author"); - _author = _authors select 0; - for "_x" from 1 to (count(_authors)-1) do { - if ( typeName (_authors select _x) == "STRING" ) then { _author = _author + ", " + (_authors select _x); } - }; - //url if any - if (isText (_entry >> "authorUrl")) then { - _url = getText(_entry >> "authorUrl"); - if ( ! CBA_MonochromeCredits ) then { _url = "" + _url + ""; }; - } else { - _url = ""; - }; - - //version if any - if (isText (_entry >> "version")) then { - _version = " v" + getText(_entry >> "version"); - } else { - _version = ""; - }; - - //single line - _text = _name + _version + " by " + _author + " " + _url; - _ctrl ctrlSetStructuredText parseText _text; - //TRACE_1("2",ctrlText _ctrl); + if (!CBA_MonochromeCredits) then { + _url = format ["%1", _url]; }; - GVAR(show_proc) = nil; }; + +// version if any +private _version = ""; + +if (isText (_entry >> "version")) then { + _version = format [" v%1", getText (_entry >> "version")]; +}; + +// add single line +_ctrl ctrlSetStructuredText parseText format ["%1%2 by %3 %4", _name, _version, _author, _url]; diff --git a/addons/help/defineCommonGrids.inc b/addons/help/defineCommonGrids.inc deleted file mode 100644 index 6acbf7f12..000000000 --- a/addons/help/defineCommonGrids.inc +++ /dev/null @@ -1,323 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -/// GUI -/////////////////////////////////////////////////////////////////////////// - -//--- Hack to avoid too large display upon first startup (fixed in engine) -//#define GUI_GRID_OLD_WAbs ((safezoneW / ((floor (safezoneW / safezoneH)) max 1)) min 1.2) - -//--- New grid for new A3 displays -#define GUI_GRID_WAbs ((safezoneW / safezoneH) min 1.2) -#define GUI_GRID_HAbs (GUI_GRID_WAbs / 1.2) -#define GUI_GRID_W (GUI_GRID_WAbs / 40) -#define GUI_GRID_H (GUI_GRID_HAbs / 25) -#define GUI_GRID_X (safezoneX) -#define GUI_GRID_Y (safezoneY + safezoneH - GUI_GRID_HAbs) - -//--- MUF - Test grid used in MP -#define GUI_GRID_MP_WAbs GUI_GRID_WAbs -#define GUI_GRID_MP_HAbs GUI_GRID_HAbs -#define GUI_GRID_MP_W GUI_GRID_W -#define GUI_GRID_MP_H GUI_GRID_H -#define GUI_GRID_MP_X (SafezoneX) -#define GUI_GRID_MP_Y (safezoneY) - -//--- Screen Center -#define GUI_GRID_CENTER_WAbs GUI_GRID_WAbs -#define GUI_GRID_CENTER_HAbs GUI_GRID_HAbs -#define GUI_GRID_CENTER_W GUI_GRID_W -#define GUI_GRID_CENTER_H GUI_GRID_H -#define GUI_GRID_CENTER_X (safezoneX + (safezoneW - GUI_GRID_CENTER_WAbs)/2) -#define GUI_GRID_CENTER_Y (safezoneY + (safezoneH - GUI_GRID_CENTER_HAbs)/2) - -//--- 2D Editor - TEST A3 -#define GUI_GRID_EDITOR_WAbs GUI_GRID_CENTER_WAbs -#define GUI_GRID_EDITOR_HAbs GUI_GRID_CENTER_HAbs -#define GUI_GRID_EDITOR_W GUI_GRID_CENTER_W -#define GUI_GRID_EDITOR_H GUI_GRID_CENTER_H -#define GUI_GRID_EDITOR_X (safezoneX) -#define GUI_GRID_EDITOR_Y (safezoneY) - -//--- Diary -#define GUI_GRID_DIARY_WAbs GUI_GRID_WAbs -#define GUI_GRID_DIARY_HAbs GUI_GRID_HAbs -#define GUI_GRID_DIARY_W GUI_GRID_W -#define GUI_GRID_DIARY_H GUI_GRID_H -#define GUI_GRID_DIARY_X (safezoneX) -#define GUI_GRID_DIARY_Y (safezoneY) - -//--- Top left -#define GUI_GRID_TOPLEFT_WAbs GUI_GRID_WAbs -#define GUI_GRID_TOPLEFT_HAbs GUI_GRID_HAbs -#define GUI_GRID_TOPLEFT_W GUI_GRID_W -#define GUI_GRID_TOPLEFT_H GUI_GRID_H -#define GUI_GRID_TOPLEFT_X (safezoneX) -#define GUI_GRID_TOPLEFT_Y (safezoneY) - - -/////////////////////////////////////////////////////////////////////////// -/// iGUI -/////////////////////////////////////////////////////////////////////////// - -//--- IGUI Vehicle -#define IGUI_GRID_VEHICLE_WAbs (10 * GUI_GRID_W) -#define IGUI_GRID_VEHICLE_HAbs (4.5 * GUI_GRID_H) -#define IGUI_GRID_VEHICLE_XDef (safezoneX + 0.5 * GUI_GRID_W) -#define IGUI_GRID_VEHICLE_YDef (safezoneY + 0.5 * GUI_GRID_H) -#define IGUI_GRID_VEHICLE_X (profilenamespace getvariable ["IGUI_GRID_VEHICLE_X",IGUI_GRID_VEHICLE_XDef]) -#define IGUI_GRID_VEHICLE_Y (profilenamespace getvariable ["IGUI_GRID_VEHICLE_Y",IGUI_GRID_VEHICLE_YDef]) -#define IGUI_GRID_VEHICLE_W GUI_GRID_W -#define IGUI_GRID_VEHICLE_H GUI_GRID_H - -//--- IGUI Radar -#define IGUI_GRID_RADAR_WAbs (5.6 * GUI_GRID_W) -#define IGUI_GRID_RADAR_HAbs (5.6 * GUI_GRID_H) -#define IGUI_GRID_RADAR_XDef (safezoneX + safezoneW / 2 - 2.8 * GUI_GRID_W) -#define IGUI_GRID_RADAR_YDef (safezoneY + 0.5 * GUI_GRID_H) -#define IGUI_GRID_RADAR_X (profilenamespace getvariable ["IGUI_GRID_RADAR_X",IGUI_GRID_RADAR_XDef]) -#define IGUI_GRID_RADAR_Y (profilenamespace getvariable ["IGUI_GRID_RADAR_Y",IGUI_GRID_RADAR_YDef]) -#define IGUI_GRID_RADAR_W GUI_GRID_W -#define IGUI_GRID_RADAR_H GUI_GRID_H - -//--- IGUI Weapon -#define IGUI_GRID_WEAPON_WAbs (12.4 * GUI_GRID_W) -#define IGUI_GRID_WEAPON_HAbs (4.5 * GUI_GRID_H) -#define IGUI_GRID_WEAPON_XDef ((safezoneX + safezoneW) - IGUI_GRID_WEAPON_WAbs - 0.5 * GUI_GRID_W) -#define IGUI_GRID_WEAPON_YDef (safezoneY + 0.5 * GUI_GRID_H) -#define IGUI_GRID_WEAPON_X (profilenamespace getvariable ["IGUI_GRID_WEAPON_X",IGUI_GRID_WEAPON_XDef]) -#define IGUI_GRID_WEAPON_Y (profilenamespace getvariable ["IGUI_GRID_WEAPON_Y",IGUI_GRID_WEAPON_YDef]) -#define IGUI_GRID_WEAPON_W GUI_GRID_W -#define IGUI_GRID_WEAPON_H GUI_GRID_H - -//--- IGUI Notification -#define IGUI_GRID_NOTIFICATION_WAbs (12 * GUI_GRID_W) -#define IGUI_GRID_NOTIFICATION_HAbs (6 * GUI_GRID_H) -#define IGUI_GRID_NOTIFICATION_XDef (0.5 - 6 * GUI_GRID_W) -#define IGUI_GRID_NOTIFICATION_YDef (safezoneY + 6.5 * GUI_GRID_H) -#define IGUI_GRID_NOTIFICATION_X (profilenamespace getvariable ["IGUI_GRID_NOTIFICATION_X",IGUI_GRID_NOTIFICATION_XDef]) -#define IGUI_GRID_NOTIFICATION_Y (profilenamespace getvariable ["IGUI_GRID_NOTIFICATION_Y",IGUI_GRID_NOTIFICATION_YDef]) -#define IGUI_GRID_NOTIFICATION_W GUI_GRID_W -#define IGUI_GRID_NOTIFICATION_H GUI_GRID_H - -//--- IGUI Action / Command Menu -#define IGUI_GRID_MENU_WAbs (4.5 * GUI_GRID_W) -#define IGUI_GRID_MENU_HAbs (10 * (IGUI_TEXT_SIZE_MEDIUM * 1.3)) -#define IGUI_GRID_MENU_XDef (1.5 * GUI_GRID_W + safezoneX) -#define IGUI_GRID_MENU_YDef (5 * GUI_GRID_H + safezoneY) -#define IGUI_GRID_MENU_X (profilenamespace getvariable ["IGUI_GRID_MENU_X",IGUI_GRID_MENU_XDef]) -#define IGUI_GRID_MENU_Y (profilenamespace getvariable ["IGUI_GRID_MENU_Y",IGUI_GRID_MENU_YDef]) -#define IGUI_GRID_MENU_W GUI_GRID_W -#define IGUI_GRID_MENU_H GUI_GRID_H - -//--- IGUI Communication menu icons -#define IGUI_GRID_COMM_WAbs (1.5 * GUI_GRID_W) -#define IGUI_GRID_COMM_HAbs (15 * GUI_GRID_H) -#define IGUI_GRID_COMM_XDef (0 * GUI_GRID_W + safezoneX) -#define IGUI_GRID_COMM_YDef (5 * GUI_GRID_H + safezoneY) -#define IGUI_GRID_COMM_X (profilenamespace getvariable ["IGUI_GRID_COMM_X",IGUI_GRID_COMM_XDef]) -#define IGUI_GRID_COMM_Y (profilenamespace getvariable ["IGUI_GRID_COMM_Y",IGUI_GRID_COMM_YDef]) -#define IGUI_GRID_COMM_W GUI_GRID_W -#define IGUI_GRID_COMM_H GUI_GRID_H - -//--- IGUI Hint -#define IGUI_GRID_HINT_WAbs (12 * GUI_GRID_W) -#define IGUI_GRID_HINT_HAbs (8 * GUI_GRID_H) -#define IGUI_GRID_HINT_XDef ((safezoneX + safezoneW) - IGUI_GRID_HINT_WAbs - 1 * GUI_GRID_W) -#define IGUI_GRID_HINT_YDef (safezoneY + 6 * GUI_GRID_H) -#define IGUI_GRID_HINT_X (profilenamespace getvariable ["IGUI_GRID_HINT_X",IGUI_GRID_HINT_XDef]) -#define IGUI_GRID_HINT_Y (profilenamespace getvariable ["IGUI_GRID_HINT_Y",IGUI_GRID_HINT_YDef]) -#define IGUI_GRID_HINT_W GUI_GRID_W -#define IGUI_GRID_HINT_H GUI_GRID_H - -//--- IGUI GPS -#define IGUI_GRID_GPS_XDef (safezoneX + safezoneW - 10.5 * GUI_GRID_W) -#define IGUI_GRID_GPS_YDef (safezoneY + safezoneH - 15.5 * GUI_GRID_H) -#define IGUI_GRID_GPS_WDef (10 * GUI_GRID_W) -#define IGUI_GRID_GPS_HDef (10 * GUI_GRID_H) -#define IGUI_GRID_GPS_X (profilenamespace getvariable ['IGUI_GRID_GPS_X',IGUI_GRID_GPS_XDef]) -#define IGUI_GRID_GPS_Y (profilenamespace getvariable ['IGUI_GRID_GPS_Y',IGUI_GRID_GPS_YDef]) -#define IGUI_GRID_GPS_WAbs (profilenamespace getvariable ['IGUI_GRID_GPS_W',IGUI_GRID_GPS_WDef]) -#define IGUI_GRID_GPS_HAbs (profilenamespace getvariable ['IGUI_GRID_GPS_H',IGUI_GRID_GPS_HDef]) - -//--- IGUI AV Camera -#define IGUI_GRID_AVCAMERA_XDef (safezoneX + safezoneW - 11.1 * GUI_GRID_W) -#define IGUI_GRID_AVCAMERA_YDef (13.5 * GUI_GRID_H + GUI_GRID_Y) -#define IGUI_GRID_AVCAMERA_WDef (10.6 * GUI_GRID_W) -#define IGUI_GRID_AVCAMERA_HDef (6.7 * GUI_GRID_H) -#define IGUI_GRID_AVCAMERA_X (profilenamespace getvariable ['IGUI_GRID_AVCAMERA_X',IGUI_GRID_AVCAMERA_XDef]) -#define IGUI_GRID_AVCAMERA_Y (profilenamespace getvariable ['IGUI_GRID_AVCAMERA_Y',IGUI_GRID_AVCAMERA_YDef]) -#define IGUI_GRID_AVCAMERA_WAbs (profilenamespace getvariable ['IGUI_GRID_AVCAMERA_W',IGUI_GRID_AVCAMERA_WDef]) -#define IGUI_GRID_AVCAMERA_HAbs (profilenamespace getvariable ['IGUI_GRID_AVCAMERA_H',IGUI_GRID_AVCAMERA_HDef]) - -//--- IGUI IGUI Chat Log -#define IGUI_GRID_CHAT_XDef (safezoneX + 1 * GUI_GRID_W) -#define IGUI_GRID_CHAT_YDef (safezoneY + safezoneH - 10.5 * GUI_GRID_H) -#define IGUI_GRID_CHAT_WDef (20 * GUI_GRID_W) -#define IGUI_GRID_CHAT_HDef (5 * GUI_GRID_H) -#define IGUI_GRID_CHAT_X (profilenamespace getvariable ["IGUI_GRID_CHAT_X",IGUI_GRID_CHAT_XDef]) -#define IGUI_GRID_CHAT_Y (profilenamespace getvariable ["IGUI_GRID_CHAT_Y",IGUI_GRID_CHAT_YDef]) -#define IGUI_GRID_CHAT_WAbs (profilenamespace getvariable ["IGUI_GRID_CHAT_W",IGUI_GRID_CHAT_WDef]) -#define IGUI_GRID_CHAT_HAbs (profilenamespace getvariable ["IGUI_GRID_CHAT_H",IGUI_GRID_CHAT_HDef]) - -//--- IGUI Command Bar -#define IGUI_GRID_BAR_WAbs (36 * GUI_GRID_W) -#define IGUI_GRID_BAR_HAbs (4 * GUI_GRID_H) -#define IGUI_GRID_BAR_XDef (safezoneX + 1 * GUI_GRID_W) -#define IGUI_GRID_BAR_YDef (safezoneY + safezoneH - 4.5 * GUI_GRID_H) -#define IGUI_GRID_BAR_X (profilenamespace getvariable ["IGUI_GRID_BAR_X",IGUI_GRID_BAR_XDef]) -#define IGUI_GRID_BAR_Y (profilenamespace getvariable ["IGUI_GRID_BAR_Y",IGUI_GRID_BAR_YDef]) -#define IGUI_GRID_BAR_W GUI_GRID_W -#define IGUI_GRID_BAR_H GUI_GRID_H - -//--- IGUI MP Progress -#define IGUI_GRID_MP_WAbs (2.5 * GUI_GRID_W) -#define IGUI_GRID_MP_HAbs (15 * GUI_GRID_H) -#define IGUI_GRID_MP_XDef (safezoneX + safezoneW - 2 * GUI_GRID_W) -#define IGUI_GRID_MP_YDef (5 * GUI_GRID_H + safezoneY) -#define IGUI_GRID_MP_X (profilenamespace getvariable ["IGUI_GRID_MP_X",IGUI_GRID_MP_XDef]) -#define IGUI_GRID_MP_Y (profilenamespace getvariable ["IGUI_GRID_MP_Y",IGUI_GRID_MP_YDef]) -#define IGUI_GRID_MP_W GUI_GRID_W -#define IGUI_GRID_MP_H GUI_GRID_H - - -/////////////////////////////////////////////////////////////////////////// -/// Old -/////////////////////////////////////////////////////////////////////////// - -//--- Old grid, that is used for old A3 and TKOH displays -#define GUI_GRID_OLD_WAbs ((safezoneW / safezoneH) min 1.2) -#define GUI_GRID_OLD_HAbs (GUI_GRID_OLD_WAbs / 1.2) -#define GUI_GRID_OLD_W (GUI_GRID_OLD_WAbs / 32) -#define GUI_GRID_OLD_H (GUI_GRID_OLD_HAbs / 20) -#define GUI_GRID_OLD_X (safezoneX) -#define GUI_GRID_OLD_Y (safezoneY + safezoneH - GUI_GRID_OLD_HAbs) - -//--- Centered -//#define GUI_GRID_OLD_X (safezoneX + (safezoneW - GUI_GRID_OLD_CENTER_WAbs)/2) -//--- Dark magic -//#define GUI_GRID_OLD_X (profilenamespace getvariable ['GUI_GRID_OLD_X',(safezoneX + (safezoneW - GUI_GRID_OLD_CENTER_WAbs)/2)]) -//#define GUI_GRID_OLD_Y (profilenamespace getvariable ['GUI_GRID_OLD_Y',(safezoneY + safezoneH - GUI_GRID_OLD_HAbs)]) - -//MUF-TEST: Anchor near the right edge of the screen - when changing Interface size, this point doesn't change its X position -#define GUI_ANCHOR_RIGHT (0.983 * safezoneW + safezoneX) -#define GUI_ANCHOR_LEFT 0 - -//--- Screen Center -#define GUI_GRID_OLD_CENTER_WAbs GUI_GRID_OLD_WAbs -#define GUI_GRID_OLD_CENTER_HAbs GUI_GRID_OLD_HAbs -#define GUI_GRID_OLD_CENTER_W GUI_GRID_OLD_W -#define GUI_GRID_OLD_CENTER_H GUI_GRID_OLD_H -#define GUI_GRID_OLD_CENTER_X (safezoneX + (safezoneW - GUI_GRID_OLD_CENTER_WAbs)/2) -#define GUI_GRID_OLD_CENTER_Y (safezoneY + (safezoneH - GUI_GRID_OLD_CENTER_HAbs)/2) - -//--- 2D Editor -#define GUI_GRID_OLD_EDITOR_WAbs GUI_GRID_OLD_CENTER_WAbs -#define GUI_GRID_OLD_EDITOR_HAbs GUI_GRID_OLD_CENTER_HAbs -#define GUI_GRID_OLD_EDITOR_W GUI_GRID_OLD_CENTER_W -#define GUI_GRID_OLD_EDITOR_H GUI_GRID_OLD_CENTER_H -#define GUI_GRID_OLD_EDITOR_X GUI_GRID_OLD_CENTER_X -#define GUI_GRID_OLD_EDITOR_Y (safezoneY) - -//--- Debug console (center down) -#define GUI_GRID_OLD_DEBUG_WAbs GUI_GRID_OLD_WAbs -#define GUI_GRID_OLD_DEBUG_HAbs GUI_GRID_OLD_HAbs -#define GUI_GRID_OLD_DEBUG_W GUI_GRID_OLD_W -#define GUI_GRID_OLD_DEBUG_H GUI_GRID_OLD_H -#define GUI_GRID_OLD_DEBUG_X (safezoneX + (safezoneW - GUI_GRID_OLD_DEBUG_WAbs)/2) -#define GUI_GRID_OLD_DEBUG_Y (safezoneY + safezoneH - GUI_GRID_OLD_DEBUG_HAbs) - -//--- IGUI Common -#define IGUI_GRID_OLD_WAbs GUI_GRID_OLD_WAbs -#define IGUI_GRID_OLD_HAbs GUI_GRID_OLD_HAbs -#define IGUI_GRID_OLD_W GUI_GRID_OLD_W -#define IGUI_GRID_OLD_H GUI_GRID_OLD_H -#define IGUI_GRID_OLD_X (safezoneX + (safezoneW - IGUI_GRID_OLD_WAbs) / 2) -#define IGUI_GRID_OLD_Y (safezoneY + safezoneH - IGUI_GRID_OLD_HAbs) - -//--- IGUI Bottom -#define IGUI_GRID_OLD_BOTTOM_WAbs IGUI_GRID_OLD_WAbs -#define IGUI_GRID_OLD_BOTTOM_HAbs IGUI_GRID_OLD_HAbs -#define IGUI_GRID_OLD_BOTTOM_W IGUI_GRID_OLD_W -#define IGUI_GRID_OLD_BOTTOM_H IGUI_GRID_OLD_H -#define IGUI_GRID_OLD_BOTTOM_X (safezoneX + (safezoneW - IGUI_GRID_OLD_BOTTOM_WAbs) / 2) -#define IGUI_GRID_OLD_BOTTOM_Y (safezoneY + safezoneH - IGUI_GRID_OLD_BOTTOM_HAbs) - -//--- IGUI Analogue Gauges -#define IGUI_GRID_OLD_GAUGES_WAbs (30 * IGUI_GRID_OLD_BOTTOM_W) -#define IGUI_GRID_OLD_GAUGES_HAbs (6 * IGUI_GRID_OLD_BOTTOM_H) -#define IGUI_GRID_OLD_GAUGES_XDef (1 * IGUI_GRID_OLD_BOTTOM_W + IGUI_GRID_OLD_BOTTOM_X) -#define IGUI_GRID_OLD_GAUGES_YDef (13.5 * IGUI_GRID_OLD_BOTTOM_H + IGUI_GRID_OLD_BOTTOM_Y) -//#define IGUI_GRID_OLD_GAUGES_X //(profilenamespace getvariable ["IGUI_GRID_OLD_GAUGES_X",IGUI_GRID_OLD_GAUGES_XDef]) -//#define IGUI_GRID_OLD_GAUGES_Y //(profilenamespace getvariable ["IGUI_GRID_OLD_GAUGES_Y",IGUI_GRID_OLD_GAUGES_YDef]) -#define IGUI_GRID_OLD_GAUGES_X IGUI_GRID_OLD_GAUGES_XDef -#define IGUI_GRID_OLD_GAUGES_Y IGUI_GRID_OLD_GAUGES_YDef -#define IGUI_GRID_OLD_GAUGES_W IGUI_GRID_OLD_W -#define IGUI_GRID_OLD_GAUGES_H IGUI_GRID_OLD_H - -//--- IGUI Action / Command Menu -#define IGUI_GRID_OLD_MENU_WAbs (4.5 * IGUI_GRID_OLD_W) -#define IGUI_GRID_OLD_MENU_HAbs (10 * (IGUI_TEXT_SIZE_MEDIUM * 1.3)) -#define IGUI_GRID_OLD_MENU_XDef (1 * IGUI_GRID_OLD_W + safezoneX) -#define IGUI_GRID_OLD_MENU_YDef (5 * IGUI_GRID_OLD_H + safezoneY) -#define IGUI_GRID_OLD_MENU_X (profilenamespace getvariable ["IGUI_GRID_OLD_MENU_X",IGUI_GRID_OLD_MENU_XDef]) -#define IGUI_GRID_OLD_MENU_Y (profilenamespace getvariable ["IGUI_GRID_OLD_MENU_Y",IGUI_GRID_OLD_MENU_YDef]) -#define IGUI_GRID_OLD_MENU_W IGUI_GRID_OLD_W -#define IGUI_GRID_OLD_MENU_H IGUI_GRID_OLD_H - -//--- E3 -/* -#define IGUI_GRID_OLD_MENU_WAbs (4.5 * IGUI_GRID_OLD_W) -#define IGUI_GRID_OLD_MENU_HAbs (10 * (IGUI_TEXT_SIZE_MEDIUM * 1.3)) -#define IGUI_GRID_OLD_MENU_XDef (0.6) -#define IGUI_GRID_OLD_MENU_YDef (0.55) -#define IGUI_GRID_OLD_MENU_X (profilenamespace getvariable ["IGUI_GRID_OLD_MENU_X",IGUI_GRID_OLD_MENU_XDef]) -#define IGUI_GRID_OLD_MENU_Y (profilenamespace getvariable ["IGUI_GRID_OLD_MENU_Y",IGUI_GRID_OLD_MENU_YDef]) -#define IGUI_GRID_OLD_MENU_W IGUI_GRID_OLD_W -#define IGUI_GRID_OLD_MENU_H IGUI_GRID_OLD_H -*/ - -//--- IGUI Task -#define IGUI_GRID_OLD_TASK_WAbs (12 * IGUI_GRID_OLD_W) -#define IGUI_GRID_OLD_TASK_HAbs (2 * IGUI_GRID_OLD_H) -#define IGUI_GRID_OLD_TASK_XDef (10 * IGUI_GRID_OLD_W + IGUI_GRID_OLD_X) -#define IGUI_GRID_OLD_TASK_YDef (1 * IGUI_GRID_OLD_H + safezoneY) -#define IGUI_GRID_OLD_TASK_X IGUI_GRID_OLD_TASK_XDef -#define IGUI_GRID_OLD_TASK_Y IGUI_GRID_OLD_TASK_YDef -#define IGUI_GRID_OLD_TASK_W IGUI_GRID_OLD_W -#define IGUI_GRID_OLD_TASK_H IGUI_GRID_OLD_H - -//--- IGUI PIP -#define IGUI_GRID_OLD_PIP_XDef (safezoneX + safezoneW - 6.5 * IGUI_GRID_OLD_W) -#define IGUI_GRID_OLD_PIP_YDef (9 * IGUI_GRID_OLD_H + IGUI_GRID_OLD_Y) -#define IGUI_GRID_OLD_PIP_WDef (6 * IGUI_GRID_OLD_W) -#define IGUI_GRID_OLD_PIP_HDef (IGUI_GRID_OLD_PIP_WDef) -//#define IGUI_GRID_OLD_PIP_X (profilenamespace getvariable ['IGUI_GRID_OLD_PIP_X',IGUI_GRID_OLD_PIP_XDef]) -//#define IGUI_GRID_OLD_PIP_Y (profilenamespace getvariable ['IGUI_GRID_OLD_PIP_Y',IGUI_GRID_OLD_PIP_YDef]) -//#define IGUI_GRID_OLD_PIP_WAbs (profilenamespace getvariable ['IGUI_GRID_OLD_PIP_W',IGUI_GRID_OLD_PIP_WDef]) -#define IGUI_GRID_OLD_PIP_X IGUI_GRID_OLD_PIP_XDef -#define IGUI_GRID_OLD_PIP_Y IGUI_GRID_OLD_PIP_YDef -#define IGUI_GRID_OLD_PIP_WAbs IGUI_GRID_OLD_PIP_WDef -#define IGUI_GRID_OLD_PIP_HAbs (IGUI_GRID_OLD_PIP_WAbs) - - -//--- MUF - experimental optics grid -// #define GUI_GRID_OLD_OPTICS_X (SafezoneX + ((SafezoneW - SafezoneH) / 2)) -// #define GUI_GRID_OLD_OPTICS_Y (SafezoneY) -// #define GUI_GRID_OLD_OPTICS_W (0.01875) -// #define GUI_GRID_OLD_OPTICS_H (0.025) -// #define GUI_GRID_OLD_OPTICS_WAbs ((SafezoneX + ((SafezoneW - SafezoneH) / 2)) / 0.01875) -// #define GUI_GRID_OLD_OPTICS_HAbs (SafezoneH / 0.01875) - -#define GUI_GRID_OLD_OPTICS_X (SafezoneX + ((SafezoneW - SafezoneH) / 2)) -#define GUI_GRID_OLD_OPTICS_Y (SafezoneY) -#define GUI_GRID_OLD_OPTICS_W (0.01875 * SafezoneH) -#define GUI_GRID_OLD_OPTICS_H (0.025 * SafezoneH) -#define GUI_GRID_OLD_OPTICS_WAbs (SafezoneH) -#define GUI_GRID_OLD_OPTICS_HAbs (SafezoneH) - -//--- MUF - experimental AV Terminal grid -#define GUI_GRID_OLD_AV_TERMINAL_X (safezoneX) -#define GUI_GRID_OLD_AV_TERMINAL_Y (safezoneY) -#define GUI_GRID_OLD_AV_TERMINAL_W (safezoneW / 64) -#define GUI_GRID_OLD_AV_TERMINAL_H (safezoneH / 40) -#define GUI_GRID_OLD_AV_TERMINAL_WAbs (safezoneW) -#define GUI_GRID_OLD_AV_TERMINAL_HAbs (safezoneH) \ No newline at end of file diff --git a/addons/help/fnc_describe.sqf b/addons/help/fnc_describe.sqf deleted file mode 100644 index ee6ff3158..000000000 --- a/addons/help/fnc_describe.sqf +++ /dev/null @@ -1,44 +0,0 @@ -//#define DEBUG_MODE_FULL -#define __cfg configFile >> _type -#define __cfgveh configFile >> _type -#include "script_component.hpp" - -private ["_ar", "_entry", "_type"]; -params ["_unit"]; -_ar = []; -_type = typeOf _unit; - -_entry = ["Unit", format["%1", _type]]; -PUSH(_ar,_entry); - -if (vehicle _unit != _unit) then { - _entry = ["Vehicle", format["%1", typeOf (vehicle _unit)]]; - PUSH(_ar,_entry); - if (isArray(__cfgveh >> "author")) then { - _entry = ["VehAuthor", format["%1", getArray(__cfgveh >> "author")]]; - PUSH(_ar,_entry); - }; - - if (isText(__cfgveh >> "authorUrl")) then { - _entry = ["VehAuthorUrl", format["%1", getText(__cfgveh >> "authorUrl")]]; - PUSH(_ar,_entry); - }; -}; - -_entry = ["Weapons", format["%1", weapons _unit]]; -PUSH(_ar,_entry); - -_entry = ["Magazines", format["%1", magazines _unit]]; -PUSH(_ar,_entry); - -if (isArray(__cfg >> "author")) then { - _entry = ["Author", format["%1", getArray(__cfg >> "author")]]; - PUSH(_ar,_entry); -}; - -if (isText(__cfg >> "authorUrl")) then { - _entry = ["AuthorUrl", format["%1", getText(__cfg >> "authorUrl")]]; - PUSH(_ar,_entry); -}; - -_ar; diff --git a/addons/help/fnc_help.sqf b/addons/help/fnc_help.sqf deleted file mode 100644 index de5f4ae35..000000000 --- a/addons/help/fnc_help.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#include "script_component.hpp" -call BIS_fnc_help; diff --git a/addons/help/script_component.hpp b/addons/help/script_component.hpp index 3b01ca0eb..b7b018ab7 100644 --- a/addons/help/script_component.hpp +++ b/addons/help/script_component.hpp @@ -10,3 +10,9 @@ #endif #include "\x\cba\addons\main\script_macros.hpp" + +#include "script_dialog_defines.hpp" + +#define CBA_CREDITS_CONT_IDC 2222710 +#define CBA_CREDITS_VER_IDC 2222712 +#define CBA_CREDITS_VER_BTN_IDC 2222713 diff --git a/addons/help/script_dialog_defines.hpp b/addons/help/script_dialog_defines.hpp index 8303b2e40..310c4ace3 100644 --- a/addons/help/script_dialog_defines.hpp +++ b/addons/help/script_dialog_defines.hpp @@ -1,4 +1,5 @@ -#include "defineCommonGrids.inc" +#include "\a3\ui_f\hpp\defineCommonGrids.inc" +#include "\a3\ui_f\hpp\defineResincl.inc" #define __X SafeZoneX #define __Y SafeZoneY @@ -23,73 +24,3 @@ #define __IH(var1) var1 * GUI_GRID_H #define __RIX(var1) var1 * GUI_GRID_W + GUI_GRID_X + safeZoneW #define __RIY(var1) var1 * GUI_GRID_H + GUI_GRID_Y + safeZoneH - -// Control types -#define CT_STATIC 0 -#define CT_BUTTON 1 -#define CT_EDIT 2 -#define CT_SLIDER 3 -#define CT_COMBO 4 -#define CT_LISTBOX 5 -#define CT_LISTNBOX 102 -#define CT_TOOLBOX 6 -#define CT_CHECKBOXES 7 -#define CT_PROGRESS 8 -#define CT_HTML 9 -#define CT_STATIC_SKEW 10 -#define CT_ACTIVETEXT 11 -#define CT_TREE 12 -#define CT_STRUCTURED_TEXT 13 -#define CT_CONTEXT_MENU 14 -#define CT_CONTROLS_GROUP 15 -#define CT_SHORTCUTBUTTON 16 -#define CT_XKEYDESC 40 -#define CT_XBUTTON 41 -#define CT_XLISTBOX 42 -#define CT_XSLIDER 43 -#define CT_XCOMBO 44 -#define CT_ANIMATED_TEXTURE 45 -#define CT_OBJECT 80 -#define CT_OBJECT_ZOOM 81 -#define CT_OBJECT_CONTAINER 82 -#define CT_OBJECT_CONT_ANIM 83 -#define CT_LINEBREAK 98 -#define CT_USER 99 -#define CT_MAP 100 -#define CT_MAP_MAIN 101 - -// Static styles -#define ST_POS 0x0F -#define ST_HPOS 0x03 -#define ST_VPOS 0x0C -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 -#define ST_DOWN 0x04 -#define ST_UP 0x08 -#define ST_VCENTER 0x0c - -#define ST_TYPE 0xF0 -#define ST_SINGLE 0 -#define ST_MULTI 16 -#define ST_TITLE_BAR 32 -#define ST_PICTURE 48 -#define ST_FRAME 64 -#define ST_BACKGROUND 80 -#define ST_GROUP_BOX 96 -#define ST_GROUP_BOX2 112 -#define ST_HUD_BACKGROUND 128 -#define ST_TILE_PICTURE 144 -#define ST_WITH_RECT 160 -#define ST_LINE 176 - -#define ST_SHADOW 0x100 -#define ST_NO_RECT 0x200 -#define ST_KEEP_ASPECT_RATIO 0x800 - -//MM -#define CA_Version_IDC 118 - -#define CBA_CREDITS_CONT_IDC 2222710 -#define CBA_CREDITS_VER_IDC 2222712 -#define CBA_CREDITS_VER_BTN_IDC 2222713 diff --git a/addons/help/stringtable.xml b/addons/help/stringtable.xml index b08aacbca..28e17c2ad 100644 --- a/addons/help/stringtable.xml +++ b/addons/help/stringtable.xml @@ -1,60 +1,62 @@ - + + -Keybindings -Tastendruckzuweisung -Keybindings -Keybindings -Keybindings -Keybindings -Klawisze -Keybindings -Keybindings + Keybindings + Tastendruckzuweisung + Keybindings + Keybindings + Keybindings + Keybindings + Klawisze + Keybindings + Keybindings -Bugtracker -Bugtracker -Bugtracker -Bugtracker -Bugtracker -Bugtracker -Zgłaszanie błędów -Bugtracker -Bugtracker + Bugtracker + Bugtracker + Bugtracker + Bugtracker + Bugtracker + Bugtracker + Zgłaszanie błędów + Bugtracker + Bugtracker -Wiki (Documentation) -Wiki (Documentation) -Wiki (Documentation) -Wiki (Documentation) -Wiki (Documentation) -Wiki (Documentation) -Wiki (dokumentacja) -Wiki (Documentation) -Wiki (Documentation) + Wiki (Documentation) + Wiki (Documentation) + Wiki (Documentation) + Wiki (Documentation) + Wiki (Documentation) + Wiki (Documentation) + Wiki (dokumentacja) + Wiki (Documentation) + Wiki (Documentation) -Credits -Credits -Credits -Credits -Credits -Credits -Twórcy -Credits -Credits + Credits + Credits + Credits + Credits + Credits + Credits + Twórcy + Credits + Credits -Credits - Addons -Credits - Addons -Credits - Addons -Credits - Addons -Credits - Addons -Credits - Addons -Twórcy - Addons -Credits - Addons -Credits - Addons + Credits - Addons + Credits - Addons + Credits - Addons + Credits - Addons + Credits - Addons + Credits - Addons + Twórcy - Addons + Credits - Addons + Credits - Addons - + + diff --git a/addons/help/ver_line.sqf b/addons/help/ver_line.sqf index 4c21b6c61..092b1d0b6 100644 --- a/addons/help/ver_line.sqf +++ b/addons/help/ver_line.sqf @@ -1,76 +1,106 @@ // #define DEBUG_MODE_FULL #include "script_component.hpp" -#include "script_dialog_defines.hpp" - -if (isNil "CBA_fnc_defaultParam") then { CBA_fnc_defaultParam = uiNamespace getVariable "CBA_fnc_defaultParam" }; disableSerialization; -private ["_trap", "_disp", "_ctrl_b", "_x", "_ctrl_o", "_next", "_config", "_ver_list", "_entry", "_ver_line", "_ver_act", "_ver_arr"]; -params ["_ctrl", ["_key",0]]; - -_trap = ctrlIDC _ctrl != CBA_CREDITS_VER_BTN_IDC; -_disp = ctrlParent _ctrl; -_ctrl = _disp displayCtrl CBA_CREDITS_VER_IDC; -_ctrl_b = _disp displayCtrl CBA_CREDITS_VER_BTN_IDC; - -if ( isNil {uiNamespace getVariable QGVAR(VerList)} ) then { - _ver_list = []; - uiNamespace setVariable [QGVAR(VerList), _ver_list]; - //Position version banner - _ctrl_o = _disp displayCtrl CA_Version_IDC; - //align with BI version position - _x = __RIX(-21); - _y = __IY(23); - _w = __IW(8); - _h = __IH(1); - _ctrl ctrlSetPosition [_x, _y, _w, _h]; + +// get display +params [["_display", displayNull, [displayNull, controlNull]], ["_key", 0]]; + +if (_display isEqualType controlNull) then { + _display = ctrlParent _display; +}; + +private _ctrl = _display displayCtrl CBA_CREDITS_VER_IDC; +private _ctrlBtn = _display displayCtrl CBA_CREDITS_VER_BTN_IDC; + +if (isNull _ctrl) exitWith {}; + +// create addon list +if (isNil {uiNamespace getVariable QGVAR(VerList)}) then { + private _verList = []; + uiNamespace setVariable [QGVAR(VerList), _verList]; + + // align with BI version position + private _posX = __RIX(-21); + private _posY = __IY(23); + private _posW = __IW(8); + private _posH = __IH(1); + + _ctrl ctrlSetPosition [_posX, _posY, _posW, _posH]; _ctrl ctrlCommit 0; - //button align - _ctrl_b ctrlSetPosition [_x, _y, _w, _h]; - _ctrl_b ctrlCommit 0; - //Gather version info + // button align + _ctrlBtn ctrlSetPosition [_posX, _posY, _posW, _posH]; + _ctrlBtn ctrlCommit 0; + + // gather version info _config = configFile >> "CfgPatches"; - for "_x" from 0 to ((count _config) - 1) do { - _entry = _config select _x; - if ( isClass _entry && {isText(_entry >> "versionDesc")} ) then { - _ver_line = getText(_entry >> "versionDesc") + " v" + getText(_entry >> "version"); - _ver_act = getText(_entry >> "versionAct"); - _ver_arr = [_ver_line, _ver_act]; - PUSH(_ver_list,_ver_arr); - }; - }; + + { + private _entry = _x; + + private _verLine = format ["%1 v%2", getText (_entry >> "versionDesc"), getText (_entry >> "version")]; + private _verAct = getText (_entry >> "versionAct"); + + _verList pushBack [_verLine, _verAct]; + } forEach ("isText (_x >> 'versionDesc')" configClasses _config); }; -if (_trap) then { - [_ctrl_b] spawn { //will terminate when main menu mission exits - while {true} do { +// start loop that cycles through all addons +terminate (_display getVariable [QGVAR(VerScript), scriptNull]); + +private _verScript = [_display] spawn { // will terminate when main menu mission exits + uiSleep 3; + QUOTE(_this call COMPILE_FILE(ver_line)) configClasses (configFile >> "CBA_DirectCall"); +}; + +_display setVariable [QGVAR(VerScript), _verScript]; + +// start loop with mouse moving event on main menu. this is used, because loops can't be used at that point +if !(_display getVariable [QGVAR(VerScriptFlag), false]) then { + _display setVariable [QGVAR(VerScriptFlag), true]; + _display displayAddEventHandler ["mouseMoving", { + params ["_display"]; + + if (!scriptDone (_display getVariable [QGVAR(VerScript), scriptNull])) exitWith {}; + + private _verScript = [_display] spawn { // will terminate when main menu mission exits uiSleep 3; - if (isNil QGVAR(VerPause)) then { _this call compile preprocessFileLineNumbers '\x\cba\addons\help\ver_line.sqf'; }; + QUOTE(_this call COMPILE_FILE(ver_line)) configClasses (configFile >> "CBA_DirectCall"); }; - }; + + _display setVariable [QGVAR(VerScript), _verScript]; + }]; }; -//left click forward, other click back -if ( isNil {uiNamespace getVariable QGVAR(VerNext)} ) then { uiNamespace setVariable [QGVAR(VerNext), -1]; }; -_next = uiNamespace getVariable QGVAR(VerNext); -if ( _key == 0 ) then { +// left click forward, other click back +if (isNil {uiNamespace getVariable QGVAR(VerNext)}) then { + uiNamespace setVariable [QGVAR(VerNext), -1]; +}; + +private _next = uiNamespace getVariable QGVAR(VerNext); + +if (_key isEqualTo 0) then { _next = _next + 1; } else { _next = _next - 1; }; -//stay in bounds -_ver_list = uiNamespace getVariable QGVAR(VerList); -if ( _next >= count _ver_list ) then { + +// stay in bounds +_verList = uiNamespace getVariable QGVAR(VerList); + +if (_next >= count _verList) then { _next = 0; } else { - if ( _next < 0 ) then { _next = count _ver_list - 1; }; + if (_next < 0) then { + _next = count _verList - 1; + }; }; + uiNamespace setVariable [QGVAR(VerNext), _next]; -_ver_arr = _ver_list select _next; -_ver_line = _ver_arr select 0; -_ver_act = _ver_arr select 1; +// add single line +(_verList select _next) params ["_verLine", "_verAct"]; -_ctrl ctrlSetText _ver_line; //print version line -_ctrl_b ctrlSetEventHandler ["MouseButtonDblClick", _ver_act]; //set double-click action if any +_ctrl ctrlSetText _verLine; // print version line +_ctrlBtn ctrlSetEventHandler ["MouseButtonDblClick", _verAct]; // set double-click action if any From e2c736c6b13ddf79d8b459ebe0192ae869cf161b Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 18 Feb 2016 21:35:52 +0100 Subject: [PATCH 2/5] rewrite help preClientInit, fix #244 --- addons/help/XEH_postClientInit.sqf | 23 ++- addons/help/XEH_preClientInit.sqf | 207 +++++++++++++++----------- addons/help/config.cpp | 2 + addons/help/cred_line.sqf | 2 +- addons/help/script_dialog_defines.hpp | 1 + addons/help/test_key.hpp | 22 +++ addons/help/ver_line.sqf | 2 +- 7 files changed, 167 insertions(+), 92 deletions(-) create mode 100644 addons/help/test_key.hpp diff --git a/addons/help/XEH_postClientInit.sqf b/addons/help/XEH_postClientInit.sqf index cc9fd3e20..58fd4a202 100644 --- a/addons/help/XEH_postClientInit.sqf +++ b/addons/help/XEH_postClientInit.sqf @@ -1,7 +1,8 @@ //#define DEBUG_MODE_FULL #include "script_component.hpp" -GVAR(CREDITS_Info) = [GVAR(credits), "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet"); +GVAR(CREDITS_Info) = GVAR(credits) getVariable "CfgPatches"; + GVAR(CREDITS_CfgPatches) = (GVAR(CREDITS_Info)) call FUNC(process); TRACE_2("",GVAR(CREDITS_Info), GVAR(CREDITS_CfgPatches)); @@ -78,16 +79,26 @@ _h = _pkeynam spawn { player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_HELP_KEYS"), _text]]; }; +// create diary 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)]];}; + +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)]]; - //player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_WEBSITE"), "http://dev-heaven.net/projects/cca"]]; - // [cba_help_credits, "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet") diff --git a/addons/help/XEH_preClientInit.sqf b/addons/help/XEH_preClientInit.sqf index 0d4049b70..904c46cb7 100644 --- a/addons/help/XEH_preClientInit.sqf +++ b/addons/help/XEH_preClientInit.sqf @@ -1,6 +1,3 @@ -// Any registered functions used in the PreINIT phase must use the uiNamespace copies of the variable. -// So uiNamespace getVariable "CBA_fnc_hashCreate" instead of just CBA_fnc_hashCreate -VM - //#define DEBUG_MODE_FULL #include "script_component.hpp" @@ -8,105 +5,147 @@ LOG(MSG_INIT); ADDON = false; -FUNC(help) = { - call BIS_fnc_help; -}; +FUNC(help) = {call BIS_fnc_help}; FUNC(readConfig) = { params ["_type"]; - _config = configFile >> _type; - _hash = [[], []] call (uiNamespace getVariable "CBA_fnc_hashCreate"); - _hash2 = [[], ""] call (uiNamespace getVariable "CBA_fnc_hashCreate"); - _hash3 = [[], ""] call (uiNamespace getVariable "CBA_fnc_hashCreate"); - for "_i" from 0 to (count _config) - 1 do { - _entry = _config select _i; - if (isClass _entry) then { - if (isArray (_entry >> "author")) then { [_hash, configName _entry, getArray(_entry >> "author")] call (uiNamespace getVariable "CBA_fnc_hashSet") }; - if (isText (_entry >> "authorUrl")) then { [_hash2, configName _entry, getText(_entry >> "authorUrl")] call (uiNamespace getVariable "CBA_fnc_hashSet") }; - if (isText (_entry >> "version")) then { [_hash3, configName _entry, getText(_entry >> "version")] call (uiNamespace getVariable "CBA_fnc_hashSet") }; - }; - }; - [_hash, _hash2, _hash3]; + + private _config = configFile >> _type; + + private _hash1 = call CBA_fnc_createNamespace; + private _hash2 = call CBA_fnc_createNamespace; + private _hash3 = call CBA_fnc_createNamespace; + + { + private _entry = _x; + + _hash1 setVariable [configName _entry, getArray (_entry >> "author")]; + _hash2 setVariable [configName _entry, getText (_entry >> "authorUrl")]; + _hash3 setVariable [configName _entry, getText (_entry >> "version")]; + } forEach ("isArray (_x >> 'author')" configClasses _config); + + [_hash1, _hash2, _hash3] }; FUNC(process) = { - params ["_h1","_h2","_h3"]; - _ar = []; - [_h1, {_entry = format["%1, v%2, (%3)
Author: %4", _key, [_h3, _key] call (uiNamespace getVariable "CBA_fnc_hashGet"), [_h2, _key] call (uiNamespace getVariable "CBA_fnc_hashGet"), _value joinString ", "]; PUSH(_ar,_entry) }] call (uiNamespace getVariable "CBA_fnc_hashEachPair"); - _ar joinString "

"; + params ["_hash1", "_hash2", "_hash3"]; + + private _result = []; + + { + private _entry = format [ + "%1, v%2, (%3)
Author: %4", + _x, + _hash3 getVariable _x, + _hash2 getVariable _x, + (_hash1 getVariable _x) joinString ", " + ]; + + _result pushBack _entry; + } forEach allVariables _hash1; + + _result joinString "

"; }; -private ["_pkeynam", "_shift", "_ctrl", "_alt", "_keys", "_key", "_keystrg", "_mod", "_knaml", "_knam", "_k", "_text", "_cEvents", "_i", "_cSys", "_tSys", "_aSys", "_tS", "_j", "_c", "_tC", "_keyn", "_credits"]; -_pkeynam = { //local function - _shift = if(_shift > 0) then {42} else {0}; - _ctrl = if(_ctrl > 0) then {56} else {0}; - _alt = if(_alt > 0) then {29} else {0}; - _keys = [_shift,_ctrl,_alt,_key]; - _keystrg = "^"; +// keys +private _fnc_getKeyName = { + private _shift = [0, DIK_LSHIFT] select (_shift > 0); + private _ctrl = [0, DIK_LCONTROL] select (_ctrl > 0); + private _alt = [0, DIK_LMENU] select (_alt > 0); + + private _keys = [_shift, _ctrl, _alt, _key]; + + private _result = "^"; + { - _mod = _x in [42,56,29]; // ??? - _knaml = call compile format["format['%2',%1]",(keyName _x),"%1"]; - _knaml = [_knaml, " "] call (uiNamespace getVariable "CBA_fnc_split"); - _knam = "^"; - {_k = _x; _knam = _knam + " " + _k} forEach _knaml; - // if(!(_mod) || ( (_k != (localize "STR_ACE_KN_LEFT")) && (_k != (localize "STR_ACE_KN_RIGHT")) )) then { // ????? - _knam = [_knam, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace"); - _keystrg = _keystrg + "-" + _knam; + private _keyname1 = call compile format ["format ['%1', %2]", "%1", keyName _x]; + + _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 + + _result = [_result, "^ ", ""] call CBA_fnc_replace; + _result = [_result, "^-", ""] call CBA_fnc_replace; + _result = [_result, "^", "None"] call CBA_fnc_replace; + _result }; -_text=""; -_cEvents = configFile/"CfgSettings"/"CBA"/"events"; -for "_i" from 0 to (count _cEvents)-1 do { - _cSys = _cEvents select _i; - _tSys = configName _cSys; - if (isNumber((_cSys select 0)/"key")) then { - //format system name - _aSys = [_tSys, "_"] call (uiNamespace getVariable "CBA_fnc_split"); - _tS = "^"; - {if((_x != "sys")) then {_tS = _tS + " " + _x;}} forEach _aSys; - // (_x != "ace") && - _tS = [_tS, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace"); - _tS = format["%1:",_tS]; - _text = _text + _tS + "
"; - for "_j" from 0 to (count _cSys)-1 do { - _c = _cSys select _j; - _tC = configName _c; - _tC = [_tC, "_", " "] call (uiNamespace getVariable "CBA_fnc_replace"); - //key - _key = getNumber (_c/"key"); - _shift = getNumber (_c/"shift"); - _ctrl = getNumber (_c/"ctrl"); - _alt = getNumber (_c/"alt"); - _keyn = [_key,_shift,_ctrl,_alt] call _pkeynam; - _tC = format[" %1: %2",_tC,_keyn]; - _text = _text + _tC + "
"; +private _text = ""; + +private _config = configFile >> "CfgSettings" >> "CBA" >> "events"; + +{ + private _addonConfig = _x; + private _addonName = configName _addonConfig; + + private _addonNameArr = [_addonName, "_"] call CBA_fnc_split; + private _addonText = "^"; + + { + if (_x != "sys") then { + _addonText = format ["%1 %2", _addonText, _x]; }; - _text = _text + "
"; - }; -}; + } forEach _addonNameArr; + _addonText = [_addonText, "^ ", ""] call CBA_fnc_replace; + _addonText = format ["%1:", _addonText]; -GVAR(credits) = [[], []] call (uiNamespace getVariable "CBA_fnc_hashCreate"); -{ [GVAR(credits), _x, [_x] call FUNC(readConfig)] call (uiNamespace getVariable "CBA_fnc_hashSet") } forEach ["CfgPatches"]; //, "CfgVehicles", "CfgWeapons"]; + { + private _entry = _x; + private _actionName = configName _entry; -GVAR(docs) = ""; -_cfg = configFile >> "CfgMods"; -_c = count _cfg; -if (_c > 0) then { - for "_i" from 0 to (_c - 1) do { - _mod = _cfg select _i; - if (isClass _mod && {isText(_mod >> "description")}) then { - _e = format["* %1 - %2
%3

", configName _mod, getText(_mod >> "name"), getText(_mod >> "description")]; - ADD(GVAR(docs),_e); + _actionName = [_actionName, "_", " "] call CBA_fnc_replace; + + private ["_key", "_shift", "_ctrl", "_alt"]; + + if (isNumber _entry) then { + _key = getNumber _entry; + _shift = 0; + _ctrl = 0; + _alt = 0; + } else { + _key = getNumber (_entry >> "key"); + _shift = getNumber (_entry >> "shift"); + _ctrl = getNumber (_entry >> "ctrl"); + _alt = getNumber (_entry >> "alt"); }; - }; -}; + + private _keyName = [_key, _shift, _ctrl, _alt] call _fnc_getKeyName; + + _actionName = format [" %1: %2", _actionName, _keyName]; + + _text = _text + _actionName + "
"; + } forEach configProperties [_addonConfig, "isNumber _x || isClass _x", true]; + + _text = _text + "
"; +} forEach ("true" configClasses _config); GVAR(keys) = _text; +// credits +GVAR(credits) = call CBA_fnc_createNamespace; + +{ + GVAR(credits) setVariable [_x, _x call FUNC(readConfig)]; +} forEach ["CfgPatches"]; //, "CfgVehicles", "CfgWeapons"]; + +// docs +GVAR(docs) = ""; + +private _config = configFile >> "CfgMods"; + +{ + private _entry = format ["* %1 - %2
%3

", configName _x, getText (_x >> "name"), getText (_x >> "description")]; + + GVAR(docs) + _entry; +} forEach ("isText (_x >> 'description')" configClasses _config); + ADDON = true; diff --git a/addons/help/config.cpp b/addons/help/config.cpp index d4b46e5c3..2f4d1cfbf 100644 --- a/addons/help/config.cpp +++ b/addons/help/config.cpp @@ -14,3 +14,5 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgRscStd.hpp" + +//#include "test_key.hpp" diff --git a/addons/help/cred_line.sqf b/addons/help/cred_line.sqf index 9bd1dcb5d..295ffec1a 100644 --- a/addons/help/cred_line.sqf +++ b/addons/help/cred_line.sqf @@ -1,4 +1,4 @@ -// #define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" disableSerialization; diff --git a/addons/help/script_dialog_defines.hpp b/addons/help/script_dialog_defines.hpp index 310c4ace3..4e7feacb7 100644 --- a/addons/help/script_dialog_defines.hpp +++ b/addons/help/script_dialog_defines.hpp @@ -1,4 +1,5 @@ #include "\a3\ui_f\hpp\defineCommonGrids.inc" +#include "\a3\ui_f\hpp\defineDIKCodes.inc" #include "\a3\ui_f\hpp\defineResincl.inc" #define __X SafeZoneX diff --git a/addons/help/test_key.hpp b/addons/help/test_key.hpp new file mode 100644 index 000000000..faf059f30 --- /dev/null +++ b/addons/help/test_key.hpp @@ -0,0 +1,22 @@ + +class CfgSettings { + class CBA { + class Events { + class TestAddon { + action1 = 15; // tab + + class action2 { // ctrl T + key = 20; + shift = 0; + ctrl = 1; + alt = 0; + }; + }; + }; + }; +}; + +/* +a1 = ["TestAddon", "action1", { systemChat str _this }] call CBA_fnc_addKeyHandlerFromConfig; +a2 = ["TestAddon", "action2", { systemChat str _this }] call CBA_fnc_addKeyHandlerFromConfig; +*/ diff --git a/addons/help/ver_line.sqf b/addons/help/ver_line.sqf index 092b1d0b6..dab2103ce 100644 --- a/addons/help/ver_line.sqf +++ b/addons/help/ver_line.sqf @@ -1,4 +1,4 @@ -// #define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" disableSerialization; From ea56ec3a433f71b74e4c9466ff45e36fa77d1350 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 18 Feb 2016 23:38:09 +0100 Subject: [PATCH 3/5] rewrite help postClientInit, fix #258 --- addons/help/CfgEventhandlers.hpp | 12 +- addons/help/CfgRscStd.hpp | 2 +- addons/help/XEH_postClientInit.sqf | 169 +++++++++--------- addons/help/XEH_preClientInit.sqf | 57 +++--- addons/help/config.cpp | 2 +- .../{cred_line.sqf => fnc_setCreditsLine.sqf} | 12 ++ .../{ver_line.sqf => fnc_setVersionLine.sqf} | 18 +- 7 files changed, 147 insertions(+), 125 deletions(-) rename addons/help/{cred_line.sqf => fnc_setCreditsLine.sqf} (76%) rename addons/help/{ver_line.sqf => fnc_setVersionLine.sqf} (77%) diff --git a/addons/help/CfgEventhandlers.hpp b/addons/help/CfgEventhandlers.hpp index 88e981d61..a2e40172d 100644 --- a/addons/help/CfgEventhandlers.hpp +++ b/addons/help/CfgEventhandlers.hpp @@ -13,15 +13,15 @@ class Extended_PostInit_EventHandlers { class Extended_DisplayLoad_EventHandlers { class RscDisplayMain { - CBA_helpVersion = QUOTE(_this 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 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 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)); }; }; diff --git a/addons/help/CfgRscStd.hpp b/addons/help/CfgRscStd.hpp index 65c776a9c..99bdabca4 100644 --- a/addons/help/CfgRscStd.hpp +++ b/addons/help/CfgRscStd.hpp @@ -46,7 +46,7 @@ class RscDisplayMain: RscStandardDisplay { class CBA_Credits_Ver_Btn: CBA_Credits_Ver_Btn { idc = CBA_CREDITS_VER_BTN_IDC; - onMouseButtonClick = QUOTE(_this call COMPILE_FILE(ver_line)); + onMouseButtonClick = QUOTE(_this call COMPILE_FILE(fnc_setVersionLine)); }; class CBA_Credits_Cont_C: CBA_Credits_Cont { diff --git a/addons/help/XEH_postClientInit.sqf b/addons/help/XEH_postClientInit.sqf index 58fd4a202..615c2298d 100644 --- a/addons/help/XEH_postClientInit.sqf +++ b/addons/help/XEH_postClientInit.sqf @@ -1,91 +1,16 @@ //#define DEBUG_MODE_FULL #include "script_component.hpp" -GVAR(CREDITS_Info) = GVAR(credits) getVariable "CfgPatches"; - -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 = "^"; - { - _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; - } 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 -}; - -_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:
", _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; - }; - // Escape < and > - _displayName = [_displayName, "<", "<"] call (uiNamespace getVariable "CBA_fnc_replace"); - _displayName = [_displayName, ">", ">"] 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: %2
", _displayName, _keyn]; - }; - _text = _text + "
"; - }; - }; - player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_HELP_KEYS"), _text]]; -}; - // create diary player createDiarySubject ["CBA_docs", "CBA"]; -//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_WEBSITE_WIKI"), "http://dev-heaven.net/projects/cca"]]; +//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)]]; +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 { @@ -96,9 +21,81 @@ 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)]]; -//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_WEBSITE"), "http://dev-heaven.net/projects/cca"]]; +//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 = "^"; + + { + 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; + + _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 +}; + +_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:
", _keyName]; + + _keyHandler params [["_actionNames", [], [[]]], ["_actionEntries", [], [[]]]]; + + { + private _actionName = _x; + private _actionEntry = _actionEntries param [_forEachIndex, []]; + + _actionEntry params [["_displayName", "", ["", []]], ["_keyBind", [], [[]]]]; -// [cba_help_credits, "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet") + if (_displayName isEqualType []) then { + _displayName = _displayName param [0, ""]; + }; + + // Escape < and > + _displayName = [_displayName, "<", "<"] call CBA_fnc_replace; + _displayName = [_displayName, ">", ">"] call CBA_fnc_replace; + + _keyBind params [["_key", 0, [0]], ["_mod", [], [[]]]]; + _mod params [["_shift", false, [false]], ["_ctrl", false, [false]], ["_alt", false, [false]]]; + + _text = _text + format [" %1: %2
", _displayName, call _this]; + } forEach _actionNames; + + _text = _text + "
"; + }; + } forEach _keyNames; + + player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", _text]]; +}; diff --git a/addons/help/XEH_preClientInit.sqf b/addons/help/XEH_preClientInit.sqf index 904c46cb7..798adec29 100644 --- a/addons/help/XEH_preClientInit.sqf +++ b/addons/help/XEH_preClientInit.sqf @@ -7,26 +7,6 @@ ADDON = false; FUNC(help) = {call BIS_fnc_help}; -FUNC(readConfig) = { - params ["_type"]; - - private _config = configFile >> _type; - - private _hash1 = call CBA_fnc_createNamespace; - private _hash2 = call CBA_fnc_createNamespace; - private _hash3 = call CBA_fnc_createNamespace; - - { - private _entry = _x; - - _hash1 setVariable [configName _entry, getArray (_entry >> "author")]; - _hash2 setVariable [configName _entry, getText (_entry >> "authorUrl")]; - _hash3 setVariable [configName _entry, getText (_entry >> "version")]; - } forEach ("isArray (_x >> 'author')" configClasses _config); - - [_hash1, _hash2, _hash3] -}; - FUNC(process) = { params ["_hash1", "_hash2", "_hash3"]; @@ -58,18 +38,17 @@ private _fnc_getKeyName = { private _result = "^"; { - private _keyname1 = call compile format ["format ['%1', %2]", "%1", keyName _x]; - - _keyname1 = [_keyname1, " "] call CBA_fnc_split; + private _keyName = call compile format ["format ['%1', %2]", "%1", keyName _x]; + _keyName = [_keyName, " "] call CBA_fnc_split; - private _keyname2 = "^"; + private _keyText = "^"; { - _keyname2 = _keyname2 + " " + _x; - } forEach _keyname1; + _keyText = _keyText + " " + _x; + } forEach _keyName; - _keyname2 = [_keyname2, "^ ", ""] call CBA_fnc_replace; - _result = _result + "-" + _keyname2; + _keyText = [_keyText, "^ ", ""] call CBA_fnc_replace; + _result = _result + "-" + _keyText; } forEach _keys; _result = [_result, "^ ", ""] call CBA_fnc_replace; @@ -133,8 +112,28 @@ GVAR(keys) = _text; // credits GVAR(credits) = call CBA_fnc_createNamespace; +private _fnc_readCreditsFromConfig = { + params ["_type"]; + + private _config = configFile >> _type; + + private _hash1 = call CBA_fnc_createNamespace; + private _hash2 = call CBA_fnc_createNamespace; + private _hash3 = call CBA_fnc_createNamespace; + + { + private _entry = _x; + + _hash1 setVariable [configName _entry, getArray (_entry >> "author")]; + _hash2 setVariable [configName _entry, getText (_entry >> "authorUrl")]; + _hash3 setVariable [configName _entry, getText (_entry >> "version")]; + } forEach ("isArray (_x >> 'author')" configClasses _config); + + [_hash1, _hash2, _hash3] +}; + { - GVAR(credits) setVariable [_x, _x call FUNC(readConfig)]; + GVAR(credits) setVariable [_x, _x call _fnc_readCreditsFromConfig]; } forEach ["CfgPatches"]; //, "CfgVehicles", "CfgWeapons"]; // docs diff --git a/addons/help/config.cpp b/addons/help/config.cpp index 2f4d1cfbf..ac4e4de01 100644 --- a/addons/help/config.cpp +++ b/addons/help/config.cpp @@ -15,4 +15,4 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgRscStd.hpp" -//#include "test_key.hpp" +#include "test_key.hpp" diff --git a/addons/help/cred_line.sqf b/addons/help/fnc_setCreditsLine.sqf similarity index 76% rename from addons/help/cred_line.sqf rename to addons/help/fnc_setCreditsLine.sqf index 295ffec1a..251e80ef7 100644 --- a/addons/help/cred_line.sqf +++ b/addons/help/fnc_setCreditsLine.sqf @@ -1,3 +1,15 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_help_fnc_setCreditsLine + +Description: + Picks a random CfgPatches entry with an "author" entry and displays author, version and url in the main menu and ingame in the pause menu. + +Parameters: + 0: _display - Either Main menu or Pause menu display or a control of these displays. + +Returns: + None +---------------------------------------------------------------------------- */ //#define DEBUG_MODE_FULL #include "script_component.hpp" diff --git a/addons/help/ver_line.sqf b/addons/help/fnc_setVersionLine.sqf similarity index 77% rename from addons/help/ver_line.sqf rename to addons/help/fnc_setVersionLine.sqf index dab2103ce..25f340366 100644 --- a/addons/help/ver_line.sqf +++ b/addons/help/fnc_setVersionLine.sqf @@ -1,3 +1,17 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_help_fnc_setVersionLine + +Description: + Displays all CfgPatches with a "versionDesc" entry in the main menu. Mods are cycled automatically every 3 seconds or can be browsed using LMB and RMB. + Double clicking executes the script in "versionAct". + +Parameters: + 0: _display - Main menu display or a control of the display. + 1: _key - 0: LMB - next mod, 1: RMB - previous mod (optional, default: 0) + +Returns: + None +---------------------------------------------------------------------------- */ //#define DEBUG_MODE_FULL #include "script_component.hpp" @@ -51,7 +65,7 @@ terminate (_display getVariable [QGVAR(VerScript), scriptNull]); private _verScript = [_display] spawn { // will terminate when main menu mission exits uiSleep 3; - QUOTE(_this call COMPILE_FILE(ver_line)) configClasses (configFile >> "CBA_DirectCall"); + QUOTE(_this call COMPILE_FILE(fnc_setVersionLine)) configClasses (configFile >> "CBA_DirectCall"); }; _display setVariable [QGVAR(VerScript), _verScript]; @@ -66,7 +80,7 @@ if !(_display getVariable [QGVAR(VerScriptFlag), false]) then { private _verScript = [_display] spawn { // will terminate when main menu mission exits uiSleep 3; - QUOTE(_this call COMPILE_FILE(ver_line)) configClasses (configFile >> "CBA_DirectCall"); + QUOTE(_this call COMPILE_FILE(fnc_setVersionLine)) configClasses (configFile >> "CBA_DirectCall"); }; _display setVariable [QGVAR(VerScript), _verScript]; From f5c16c92c7f919c0282ee5fa6cb26547bfa5adb9 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 18 Feb 2016 23:38:34 +0100 Subject: [PATCH 4/5] comment out debug --- addons/help/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/help/config.cpp b/addons/help/config.cpp index ac4e4de01..2f4d1cfbf 100644 --- a/addons/help/config.cpp +++ b/addons/help/config.cpp @@ -15,4 +15,4 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgRscStd.hpp" -#include "test_key.hpp" +//#include "test_key.hpp" From dced6868efb7e5021de187b62d07b814cac3f2c2 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 20 Feb 2016 16:15:07 +0100 Subject: [PATCH 5/5] remove debug and update stringtable header --- addons/help/config.cpp | 2 -- addons/help/stringtable.xml | 2 +- addons/help/test_key.hpp | 22 ---------------------- 3 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 addons/help/test_key.hpp diff --git a/addons/help/config.cpp b/addons/help/config.cpp index 2f4d1cfbf..d4b46e5c3 100644 --- a/addons/help/config.cpp +++ b/addons/help/config.cpp @@ -14,5 +14,3 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgRscStd.hpp" - -//#include "test_key.hpp" diff --git a/addons/help/stringtable.xml b/addons/help/stringtable.xml index 28e17c2ad..3413d1ac7 100644 --- a/addons/help/stringtable.xml +++ b/addons/help/stringtable.xml @@ -1,5 +1,5 @@ - + diff --git a/addons/help/test_key.hpp b/addons/help/test_key.hpp deleted file mode 100644 index faf059f30..000000000 --- a/addons/help/test_key.hpp +++ /dev/null @@ -1,22 +0,0 @@ - -class CfgSettings { - class CBA { - class Events { - class TestAddon { - action1 = 15; // tab - - class action2 { // ctrl T - key = 20; - shift = 0; - ctrl = 1; - alt = 0; - }; - }; - }; - }; -}; - -/* -a1 = ["TestAddon", "action1", { systemChat str _this }] call CBA_fnc_addKeyHandlerFromConfig; -a2 = ["TestAddon", "action2", { systemChat str _this }] call CBA_fnc_addKeyHandlerFromConfig; -*/