Skip to content

Commit

Permalink
Merge develop branch (v0.3.2.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
SceptreOfficial committed Mar 26, 2020
2 parents 5c08a95 + aaf602e commit 69dffe9
Show file tree
Hide file tree
Showing 67 changed files with 1,077 additions and 864 deletions.
21 changes: 0 additions & 21 deletions .clang-format

This file was deleted.

7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://github.com/SceptreOfficial/Simplex-Support-Services/raw/master/assets/sss_black.png" width="256">
<img src="https://github.com/SceptreOfficial/Simplex-Support-Services/raw/master/assets/sss_black.png" width="128">
</p>

<p align="center">
Expand All @@ -9,7 +9,7 @@

<p align="center">
<a href="https://github.com/SceptreOfficial/Simplex-Support-Services/releases/latest">
<img src="https://img.shields.io/badge/Version-0.3.0.6-blue?style=flat-square" alt="Version">
<img src="https://img.shields.io/badge/Version-0.3.2.2-blue?style=flat-square" alt="Version">
</a>
<a href="https://github.com/SceptreOfficial/Simplex-Support-Services/issues">
<img src="https://img.shields.io/github/issues-raw/SceptreOfficial/Simplex-Support-Services?style=flat-square&label=Issues" alt="Issues">
Expand Down
3 changes: 2 additions & 1 deletion addons/CDS/functions/fnc_cancel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ private _values = (uiNamespace getVariable QGVAR(controls)) apply {
private _data = _x getVariable QGVAR(data);
switch (_data # 0) do {
case "CHECKBOX";
case "EDITBOX" : {_data # 2};
case "EDITBOX";
case "BUTTON" : {_data # 2};
case "SLIDER";
case "COMBOBOX";
case "LISTNBOX" : {_data # 2 # 1};
Expand Down
3 changes: 2 additions & 1 deletion addons/CDS/functions/fnc_confirm.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ private _values = (uiNamespace getVariable QGVAR(controls)) apply {
private _data = _x getVariable QGVAR(data);
switch (_data # 0) do {
case "CHECKBOX";
case "EDITBOX" : {
case "EDITBOX";
case "BUTTON" : {
private _value = _data # 2;
GVAR(cache) setVariable [[uiNamespace getVariable QGVAR(title),_data # 1,_data # 0] joinString "~",_value];
_value
Expand Down
81 changes: 60 additions & 21 deletions addons/CDS/functions/fnc_dialog.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ _dummy ctrlCommit 0;
_x params [
["_type","",[""]],
["_description","",["",[]]],
["_valueData",[],[true,"",[]]],
["_valueData",[],[true,"",[],{}]],
["_forceDefault",true,[true]],
["_onValueChanged",{},[{}]],
["_enableCondition",{true},[{},true]]
Expand Down Expand Up @@ -110,15 +110,15 @@ _dummy ctrlCommit 0;
_ctrl setVariable [QGVAR(ctrlDescription),_ctrlDescription];
_controls pushBack _ctrl;

_ctrl ctrlAddEventHandler ["CheckedChanged",{
[_ctrl,"CheckedChanged",{
params ["_ctrl","_bool"];
_bool = _bool isEqualTo 1;

private _data = _ctrl getVariable QGVAR(data);
_data set [2,_bool];
_ctrl setVariable [QGVAR(data),_data];
[_bool,uiNamespace getVariable QGVAR(arguments),_ctrl] call (_data # 3);
}];
}] call CBA_fnc_addBISEventHandler;

_posY = _posY + ITEM_HEIGHT + SPACING;
};
Expand All @@ -141,15 +141,15 @@ _dummy ctrlCommit 0;
_ctrl setVariable [QGVAR(ctrlDescription),_ctrlDescription];
_controls pushBack _ctrl;

_ctrl ctrlAddEventHandler ["KeyUp",{
[_ctrl,"KeyUp",{
params ["_ctrl","_key"];

private _string = ctrlText _ctrl;
private _data = _ctrl getVariable QGVAR(data);
_data set [2,_string];
_ctrl setVariable [QGVAR(data),_data];
[_string,uiNamespace getVariable QGVAR(arguments),_ctrl] call (_data # 3);
}];
}] call CBA_fnc_addBISEventHandler;

_posY = _posY + ITEM_HEIGHT + SPACING;
};
Expand Down Expand Up @@ -183,7 +183,7 @@ _dummy ctrlCommit 0;
_ctrl setVariable [QGVAR(ctrlEdit),_ctrlEdit];
_ctrlEdit setVariable [QGVAR(slider),_ctrl];

_ctrl ctrlAddEventHandler ["SliderPosChanged",{
[_ctrl,"SliderPosChanged",{
params ["_ctrl","_sliderPos"];

private _data = _ctrl getVariable QGVAR(data);
Expand All @@ -198,9 +198,9 @@ _dummy ctrlCommit 0;
(_data select 2) set [1,_sliderPos];
_ctrl setVariable [QGVAR(data),_data];
[_sliderPos,uiNamespace getVariable QGVAR(arguments),_ctrl] call (_data # 3);
}];
}] call CBA_fnc_addBISEventHandler;

_ctrlEdit ctrlAddEventHandler ["KeyUp",{
[_ctrlEdit,"KeyUp",{
params ["_ctrlEdit"];

private _ctrl = _ctrlEdit getVariable QGVAR(slider);
Expand All @@ -214,17 +214,17 @@ _dummy ctrlCommit 0;
(_data select 2) set [1,_value];
_ctrl setVariable [QGVAR(data),_data];
[_value,uiNamespace getVariable QGVAR(arguments),_ctrl] call (_data # 3);
}];
}] call CBA_fnc_addBISEventHandler;

_ctrlEdit ctrlAddEventHandler ["KillFocus",{
[_ctrlEdit,"KillFocus",{
params ["_ctrlEdit"];

private _ctrl = _ctrlEdit getVariable QGVAR(slider);
private _data = _ctrl getVariable QGVAR(data);
((_data # 2) # 0) params ["_min","_max","_decimals"];

_ctrlEdit ctrlSetText (sliderPosition _ctrl toFixed _decimals);
}];
}] call CBA_fnc_addBISEventHandler;

_posY = _posY + ITEM_HEIGHT + SPACING;
};
Expand Down Expand Up @@ -256,14 +256,14 @@ _dummy ctrlCommit 0;
_ctrl setVariable [QGVAR(ctrlDescription),_ctrlDescription];
_controls pushBack _ctrl;

_ctrl ctrlAddEventHandler ["LBSelChanged",{
[_ctrl,"LBSelChanged",{
params ["_ctrl","_selection"];

private _data = _ctrl getVariable QGVAR(data);
(_data select 2) set [1,_selection];
_ctrl setVariable [QGVAR(data),_data];
[_selection,uiNamespace getVariable QGVAR(arguments),_ctrl] call (_data # 3);
}];
}] call CBA_fnc_addBISEventHandler;

_posY = _posY + ITEM_HEIGHT + SPACING;
};
Expand Down Expand Up @@ -310,17 +310,47 @@ _dummy ctrlCommit 0;
_ctrl setVariable [QGVAR(ctrlBG),_ctrlBG];
_controls pushBack _ctrl;

_ctrl ctrlAddEventHandler ["LBSelChanged",{
[_ctrl,"LBSelChanged",{
params ["_ctrl","_selection"];

private _data = _ctrl getVariable QGVAR(data);
(_data select 2) set [1,_selection];
_ctrl setVariable [QGVAR(data),_data];
[_selection,uiNamespace getVariable QGVAR(arguments),_ctrl] call (_data # 3);
}];
}] call CBA_fnc_addBISEventHandler;

_posY = _posY + ITEM_HEIGHT + SPACING + _height + SPACING;
};

case "BUTTON" : {
_valueData params [["_code",{},[{},""]]];

if (_code isEqualType "") then {
_code = compile _code;
};

if (!_forceDefault) then {
_code = GVAR(cache) getVariable [[_title,_description,_type] joinString "~",_code];
};

private _ctrl = _display ctrlCreate [QGVAR(Button),-1,_ctrlGroup];
_ctrl ctrlSetPosition [0,_posY];
_ctrl ctrlCommit 0;
_ctrl ctrlSetText _descriptionText;
_ctrl ctrlSetTooltip _descriptionTooltip;

_ctrl setVariable [QGVAR(data),[_type,_description,_code,_onValueChanged,_enableCondition]];
_ctrl setVariable [QGVAR(ctrlDescription),_ctrl];
_controls pushBack _ctrl;

[_ctrl,"ButtonClick",{
params ["_ctrl"];

[(_ctrl getVariable QGVAR(data)) # 2,uiNamespace getVariable QGVAR(arguments)] call CBA_fnc_directCall;
}] call CBA_fnc_addBISEventHandler;

_posY = _posY + ITEM_HEIGHT + SPACING;
};
};
} forEach _content;

Expand Down Expand Up @@ -362,18 +392,27 @@ GVAR(PFHID) = [{
};

private _enableCtrl = [_value,uiNamespace getVariable QGVAR(arguments),_ctrl] call (_data # 4);
private _ctrlDescription = _ctrl getVariable [QGVAR(ctrlDescription),controlNull];

if (!_enableCtrl && ctrlEnabled _ctrl) then {
_ctrl ctrlEnable false;
(_ctrl getVariable QGVAR(ctrlDescription)) ctrlSetTextColor [COLOR_DISABLED];

if (!isNull _ctrlDescription) then {
_ctrlDescription ctrlSetTextColor [COLOR_DISABLED];
};

if (_data # 0 == "SLIDER") then {
(_ctrl getVariable QGVAR(ctrlEdit)) ctrlEnable false;
};
};

if (_enableCtrl && !ctrlEnabled _ctrl) then {
_ctrl ctrlEnable true;
(_ctrl getVariable QGVAR(ctrlDescription)) ctrlSetTextColor [1,1,1,1];

if (!isNull _ctrlDescription) then {
_ctrlDescription ctrlSetTextColor [1,1,1,1];
};

if (_data # 0 == "SLIDER") then {
(_ctrl getVariable QGVAR(ctrlEdit)) ctrlEnable true;
};
Expand All @@ -391,19 +430,19 @@ _ctrlTitle ctrlSetPosition [POS_X - BUFFER,_contentX - BUFFER - SPACING - TITLE_
_ctrlTitle ctrlCommit 0;
_ctrlGroup ctrlSetPosition [POS_X,_contentX,CONTENT_WIDTH + BUFFER,_contentHeight];
_ctrlGroup ctrlCommit 0;
_ctrlCancel ctrlSetPosition [POS_X - BUFFER,_contentX + _contentHeight + BUFFER + SPACING,BUTTON_WIDTH,BUTTON_HEIGHT];
_ctrlCancel ctrlSetPosition [POS_X - BUFFER,_contentX + _contentHeight + BUFFER + SPACING,MENU_BUTTON_WIDTH,MENU_BUTTON_HEIGHT];
_ctrlCancel ctrlCommit 0;
_ctrlConfirm ctrlSetPosition [POS_X + CONTENT_WIDTH - BUTTON_WIDTH + BUFFER,_contentX + _contentHeight + BUFFER + SPACING,BUTTON_WIDTH,BUTTON_HEIGHT];
_ctrlConfirm ctrlSetPosition [POS_X + CONTENT_WIDTH - MENU_BUTTON_WIDTH + BUFFER,_contentX + _contentHeight + BUFFER + SPACING,MENU_BUTTON_WIDTH,MENU_BUTTON_HEIGHT];
_ctrlConfirm ctrlCommit 0;

// Set title and focus
_ctrlTitle ctrlSetText _title;
ctrlSetFocus _ctrlConfirm;

// Handle ESC key
_display displayAddEventHandler ["KeyDown",{
[_display,"KeyDown",{
if (_this # 1 == DIK_ESCAPE) then {call FUNC(cancel);};
false
}];
}] call CBA_fnc_addBISEventHandler;

true
3 changes: 2 additions & 1 deletion addons/CDS/functions/fnc_getCurrentValue.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ private _data = _ctrl getVariable QGVAR(data);

switch (_data # 0) do {
case "CHECKBOX";
case "EDITBOX" : {_data # 2};
case "EDITBOX";
case "BUTTON" : {_data # 2};
case "SLIDER";
case "COMBOBOX";
case "LISTNBOX" : {_data # 2 # 1};
Expand Down
4 changes: 3 additions & 1 deletion addons/CDS/functions/fnc_setDescription.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ disableSerialization;
params [["_index",0,[0]],["_description","",["",[]]]];

private _ctrl = (uiNamespace getVariable QGVAR(controls)) # _index;
private _ctrlDescription = _ctrl getVariable QGVAR(ctrlDescription);
private _ctrlDescription = _ctrl getVariable [QGVAR(ctrlDescription),controlNull];
private _data = _ctrl getVariable QGVAR(data);

_description params [["_descriptionText","",[""]],["_descriptionTooltip","",[""]]];
Expand All @@ -13,5 +13,7 @@ _description = [_descriptionText,_descriptionTooltip];
_data set [1,_description];
_ctrl setVariable [QGVAR(data),_data];

if (isNull _ctrlDescription) exitWith {};

_ctrlDescription ctrlSetText _descriptionText;
_ctrlDescription ctrlSetTooltip _descriptionTooltip;
6 changes: 5 additions & 1 deletion addons/CDS/functions/fnc_setEnableCondition.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "script_component.hpp"

disableSerialization;
params [["_index",0,[0]],["_enableCondition",{true},[{}]]];
params [["_index",0,[0]],["_enableCondition",{true},[{},true]]];

private _ctrl = (uiNamespace getVariable QGVAR(controls)) # _index;
private _data = _ctrl getVariable QGVAR(data);

if (_enableCondition isEqualType true) then {
_enableCondition = [{false},{true}] select _enableCondition;
};

_data set [4,_enableCondition];
_ctrl setVariable [QGVAR(data),_data];
17 changes: 17 additions & 0 deletions addons/CDS/functions/fnc_setValueData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ switch (_type) do {
_bool = GVAR(cache) getVariable [[uiNamespace getVariable QGVAR(title),_description,_type] joinString "~",_bool];
};

_data set [2,_bool];
_ctrl setVariable [QGVAR(data),_data];

_ctrl cbSetChecked _bool;
};

Expand All @@ -25,6 +28,9 @@ switch (_type) do {
_string = GVAR(cache) getVariable [[uiNamespace getVariable QGVAR(title),_description,_type] joinString "~",_string];
};

_data set [2,_string];
_ctrl setVariable [QGVAR(data),_data];

_ctrl ctrlSetText _string;
};

Expand Down Expand Up @@ -100,4 +106,15 @@ switch (_type) do {

_ctrl lnbSetCurSelRow _selection;
};

case "BUTTON" : {
_valueData params [["_code",{},[{},""]]];

if (!_forceDefault) then {
_code = GVAR(cache) getVariable [[uiNamespace getVariable QGVAR(title),_description,_type] joinString "~",_code];
};

_data set [2,_code];
_ctrl setVariable [QGVAR(data),_data];
};
};
32 changes: 31 additions & 1 deletion addons/CDS/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class GVAR(ListNBox) {
idcRight = -1;
color[] = {0.95,0.95,0.95,1};
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorDisabled[] = {COLOR_DISABLED};
colorScrollbar[] = {0.95,0.95,0.95,1};
colorSelect[] = {0,0,0,1};
colorSelect2[] = {0,0,0,1};
Expand Down Expand Up @@ -207,6 +207,36 @@ class GVAR(ListNBox) {
};
};

class GVAR(Button) {
idc = -1;
type = 1;
x = 0;
y = 0;
w = BUTTON_WIDTH;
h = BUTTON_HEIGHT;
colorBackground[] = {0,0,0,1};
colorBackgroundActive[] = {0.3,0.3,0.3,1};
colorBackgroundDisabled[] = {0,0,0,1};
colorBorder[] = {0,0,0,0};
colorDisabled[] = {COLOR_DISABLED};
colorFocused[] = {0.2,0.2,0.2,1};
colorShadow[] = {0,0,0,0};
colorText[] = {1,1,1,1};
text = "";
font = "RobotoCondensed";
sizeEx = GUI_GRID_H * 1;
style = 2;
borderSize = 0;
offsetPressedX = 0;
offsetPressedY = 0;
offsetX = 0;
offsetY = 0;
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1.0};
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1.0};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1.0};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1.0};
};

class GVAR(Dialog) {
idd = -1;
movingEnable = 0;
Expand Down
Loading

0 comments on commit 69dffe9

Please sign in to comment.