Marker Fixes for 1.42 WIP

This commit is contained in:
PabstMirror 2015-03-27 19:22:49 -05:00
parent 5f1201d75a
commit 63b7f0a755
3 changed files with 59 additions and 187 deletions

View File

@ -1,4 +1,3 @@
class RscPicture; class RscPicture;
class RscText; class RscText;
class RscStructuredText; class RscStructuredText;
@ -13,91 +12,34 @@ class RscXSliderH;
class RscDisplayInsertMarker { class RscDisplayInsertMarker {
onLoad = QUOTE(_this call DFUNC(initInsertMarker);); onLoad = QUOTE(_this call DFUNC(initInsertMarker););
onUnload = QUOTE(_this call DFUNC(placeMarker);); onUnload = QUOTE(_this call DFUNC(placeMarker););
idd = 54; // idd = 54;
movingEnable = 1; movingEnable = 1;
class controlsBackground { class controlsBackground {
class RscText_1000: RscText { // class RscText_1000: RscText {idc = 1000;};
idc = 1000;
/*x = "0 * GUI_GRID_INSERTMARKER_W + GUI_GRID_INSERTMARKER_X";
y = "0 * GUI_GRID_INSERTMARKER_H + GUI_GRID_INSERTMARKER_Y";
w = "8 * GUI_GRID_INSERTMARKER_W";
h = "2.5 * GUI_GRID_INSERTMARKER_H";
colorBackground[] = {0,0,0,0.5};*/
};
class Description: RscStructuredText {
colorBackground[] = {0,0,0,0.7};
idc = 1100;
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "9.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
}; };
class controls { class controls {
//delete ButtonOK; // class ButtonMenuOK: RscButtonMenuOK {idc = 1;};
class ButtonMenuOK: RscButtonMenuOK { // class ButtonMenuCancel: RscButtonMenuCancel {idc = 2;};
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)"; // class Title: RscText {idc = 1001;};
y = "15.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))"; // class Description: RscStructuredText {idc = 1100;};
w = "8.9 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; // class DescriptionChannel: RscStructuredText {idc = 1101;};
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; // class MarkerPicture: RscPicture {idc = 102;};
// size = "0.85 * ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; // class MarkerText: RscEdit {idc = 101;};
// sizeEx = "0.85 * ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; // class MarkerChannel: RscCombo {idc = 103;};
text = "";
class MarkerShape: RscCombo {
idc = 1210;
}; };
class ButtonMenuCancel: RscButtonMenuCancel { class MarkerColor: RscCombo {
x = "23 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)"; idc = 1211;
y = "15.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "1.1 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
text = "X";
colorBackground[] = {0.75,0,0,0.5};
colorBackgroundFocused[] = {0.75,0,0,0.5};
colorBackground2[] = {1,0,0,0.5};
}; };
/*class ButtonMenuInfo: RscButtonMenu { class MarkerAngle: RscXSliderH {
idc = 2400; idc = 1220;
text = "$STR_A3_RscDisplayInsertMarker_ButtonMenuInfo";
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "13.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};*/
delete ButtonMenuInfo;
class Title: RscText {
moving = 1;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"};
idc = 1001;
text = "$STR_A3_RscDisplayInsertMarker_Title";
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "8.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
}; };
delete Description; class MarkerAngleText: RscText {
/*class Info: RscStructuredText { idc = 1221;
colorBackground[] = {0,0,0,0.7};
idc = 1101;
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "11.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};*/
delete Info;
class Picture: RscPicture {
idc = 102;
x = 0.259984;
y = 0.4;
w = 0.05;
h = 0.0666667;
};
class Text: RscEdit {
idc = 101;
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "10.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
}; };
/*class SizeX: RscEdit { /*class SizeX: RscEdit {
idc = 1200; idc = 1200;
text = "10"; text = "10";
@ -114,34 +56,5 @@ class RscDisplayInsertMarker {
w = "5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; w = "5 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};*/ };*/
class MarkerShape: RscCombo {
idc = 1210;
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "11.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class MarkerColor: RscCombo {
idc = 1211;
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "12.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class MarkerAngle: RscXSliderH {
idc = 1220;
text = "10";
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "13.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class MarkerAngleText: RscText {
idc = 1221;
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "14.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
}; };
}; };

View File

@ -14,25 +14,15 @@ PREP(setMarkerNetwork);
// init marker types // init marker types
if (isNil QGVAR(MarkersCache)) then { if (isNil QGVAR(MarkersCache)) then {
_config = configfile >> "CfgMarkers"; _config = configfile >> "CfgMarkers";
_index = 0;
GVAR(MarkersCache) = []; GVAR(MarkersCache) = [];
for "_a" from 0 to (count _config - 1) do { for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a; _marker = _config select _a;
_scope = getNumber (_marker >> "scope"); _scope = getNumber (_marker >> "scope");
_name = getText (_marker >> "name");
_icon = getText (_marker >> "icon");
if (_scope == 2) then { if (_scope == 2) then {
_shape lbAdd _name; _name = getText (_marker >> "name");
_shape lbSetValue [_index, _a]; _icon = getText (_marker >> "icon");
_shape lbSetPicture [_index, _icon];
GVAR(MarkersCache) pushBack [_name, _a, _icon]; GVAR(MarkersCache) pushBack [_name, _a, _icon];
_index = _index + 1;
}; };
}; };
}; };
@ -40,39 +30,27 @@ if (isNil QGVAR(MarkersCache)) then {
// init marker colors // init marker colors
if (isNil QGVAR(MarkerColorsCache)) then { if (isNil QGVAR(MarkerColorsCache)) then {
_config = configfile >> "CfgMarkerColors"; _config = configfile >> "CfgMarkerColors";
_index = 0;
GVAR(MarkerColorsCache) = []; GVAR(MarkerColorsCache) = [];
for "_a" from 0 to (count _config - 1) do { for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a; _marker = _config select _a;
_scope = getNumber (_marker >> "scope"); _scope = getNumber (_marker >> "scope");
_name = getText (_marker >> "name");
if (_scope == 2) then { if (_scope == 2) then {
_color lbAdd _name; _name = getText (_marker >> "name");
_color lbSetValue [_index, _a];
_rgba = getArray (_marker >> "color"); _rgba = getArray (_marker >> "color");
{ {
if (typeName _x != "SCALAR") then { if (typeName _x != "SCALAR") then {
_rgba set [_forEachIndex, call compile _x]; _rgba set [_forEachIndex, call compile _x];
}; };
} forEach _rgba; } forEach _rgba;
_icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _rgba select 0, _rgba select 1, _rgba select 2, _rgba select 3]; _icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _rgba select 0, _rgba select 1, _rgba select 2, _rgba select 3];
_color lbSetPicture [_index, _icon];
GVAR(MarkerColorsCache) pushBack [_name, _a, _icon]; GVAR(MarkerColorsCache) pushBack [_name, _a, _icon];
_index = _index + 1;
}; };
}; };
}; };
//Server Sync JIP markers:
[QGVAR(sendMarkersJIP), FUNC(sendMarkersJIP)] call EFUNC(common,addEventHandler); [QGVAR(sendMarkersJIP), FUNC(sendMarkersJIP)] call EFUNC(common,addEventHandler);
ADDON = true; ADDON = true;

View File

@ -15,14 +15,19 @@
// prevent vanilla key input // prevent vanilla key input
_display displayAddEventHandler ["KeyDown", {(_this select 1) in [200, 208]}]; _display displayAddEventHandler ["KeyDown", {(_this select 1) in [200, 208]}];
//BIS Controlls:
_text = _display displayctrl 101; _text = _display displayctrl 101;
_picture = _display displayctrl 102; _picture = _display displayctrl 102;
_channel = _display displayctrl 103;
_buttonOK = _display displayctrl 1; _buttonOK = _display displayctrl 1;
_buttonCancel = _display displayctrl 2; _buttonCancel = _display displayctrl 2;
_description = _display displayctrl 1100; _description = _display displayctrl 1100;
_title = _display displayctrl 1001; _title = _display displayctrl 1001;
_sizeX = _display displayctrl 1200; _descriptionChannel = _display displayctrl 1101;
_sizeY = _display displayctrl 1201;
//ACE Controlls:
// _sizeX = _display displayctrl 1200;
// _sizeY = _display displayctrl 1201;
_shape = _display displayctrl 1210; _shape = _display displayctrl 1210;
_color = _display displayctrl 1211; _color = _display displayctrl 1211;
_angle = _display displayctrl 1220; _angle = _display displayctrl 1220;
@ -30,51 +35,6 @@
ctrlSetFocus _text; ctrlSetFocus _text;
//Change ok button's text based on current channel
[{
EXPLODE_2_PVT(_this,_params,_pfhId);
EXPLODE_1_PVT(_params,_buttonOK);
if (isNull _buttonOK) exitWith {
[_pfhId] call CBA_fnc_removePerFrameHandler;
};
_channel = "";
_textColor = [1,1,1,1];
switch (call EFUNC(common,currentChannel)) do {
case ("global"): {
_channel = localize "str_channel_global";
_textColor = [(216/255),(216/255),(216/255),1];
};
case ("side"): {
_channel = localize "str_channel_side";
_textColor = [(70/255),(211/255),(252/255),1];
};
case ("group"): {
_channel = localize "str_channel_group";
_textColor = [(181/255),(248/255),(98/255),1];
};
case ("vehicle"): {
_channel = localize "str_channel_vehicle";
_textColor = [(255/255),(208/255),(0/255),1];
};
case ("direct"): {
_channel = localize "str_channel_direct";
_textColor = [(255/255),(255/255),(255/255),1];
};
case ("command"): {
_channel = localize "str_channel_command";
_textColor = [(255/255),(255/255),(70/255),1];
};
};
//If localization not found, then don't touch anything (default is RscButtonMenuOK's localized text)
if (_channel != "") then {
_buttonOK ctrlSetTextColor _textColor;
_buttonOK ctrlSetText format [localize "STR_ACE_Markers_PlaceIn", _channel];
};
}, 0, [_buttonOK]] call CBA_fnc_addPerFrameHandler;
//--- Background //--- Background
_pos = ctrlposition _text; _pos = ctrlposition _text;
_posX = (_pos select 0) + 0.01; _posX = (_pos select 0) + 0.01;
@ -96,12 +56,11 @@
//--- Description //--- Description
_pos set [1,_posY - 1*_posH]; _pos set [1,_posY - 1*_posH];
_pos set [3,6*_posH + 6 * BORDER]; _pos set [3,6*_posH + 6 * BORDER];
_description ctrlenable false;
_description ctrlsetposition _pos; _description ctrlsetposition _pos;
_description ctrlsetstructuredtext parsetext format ["<t size='0.8'>%1</t>","Description:"]; //--- ToDo: Localze _description ctrlsetstructuredtext parsetext format ["<t size='0.8'>%1</t>", (localize "str_lib_label_description")];
_description ctrlcommit 0; _description ctrlcommit 0;
_activeColor = (["IGUI","WARNING_RGB"] call bis_fnc_displaycolorget) call bis_fnc_colorRGBtoHTML;
//--- Shape //--- Shape
_pos set [1,_posY + 1 * _posH + 2 * BORDER]; _pos set [1,_posY + 1 * _posH + 2 * BORDER];
_pos set [2,_posW]; _pos set [2,_posW];
@ -127,15 +86,37 @@
_angleText ctrlsetposition _pos; _angleText ctrlsetposition _pos;
_angleText ctrlcommit 0; _angleText ctrlcommit 0;
_offsetButtons = 0;
if (ismultiplayer) then {
_pos set [1,_posY + 5 * _posH + 7 * BORDER];
_pos set [3,_posH];
_descriptionChannel ctrlsetstructuredtext parsetext format ["<t size='0.8'>%1</t>", (localize "str_a3_cfgvehicles_modulerespawnposition_f_arguments_marker_0") + ":"];
_descriptionChannel ctrlsetposition _pos;
_descriptionChannel ctrlcommit 0;
_pos set [1,_posY + 6 * _posH + 7 * BORDER];
_pos set [3,_posH];
_channel ctrlsetposition _pos;
_channel ctrlcommit 0;
_offsetButtons = 7 * _posH + 8 * BORDER;
} else {
_descriptionChannel ctrlshow false;
_channel ctrlshow false;
_offsetButtons = 5 * _posH + 7 * BORDER;
};
//--- ButtonOK //--- ButtonOK
_pos set [1,_posY + 5 * _posH + 7 * BORDER]; _pos set [1,_posY + _offsetButtons];
_pos set [2,_posW * (8.9/10) - BORDER]; _pos set [2,_posW / 2 - BORDER];
_pos set [3,_posH];
_buttonOk ctrlsetposition _pos; _buttonOk ctrlsetposition _pos;
_buttonOk ctrlcommit 0; _buttonOk ctrlcommit 0;
//--- ButtonCancel //--- ButtonCancel
_pos set [0,_posX + _posW * (8.9 / 10)]; _pos set [0,_posX + _posW / 2];
_pos set [2,_posW * (1.1 / 10)]; _pos set [1,_posY + _offsetButtons];
_pos set [2,_posW / 2];
_pos set [3,_posH];
_buttonCancel ctrlsetposition _pos; _buttonCancel ctrlsetposition _pos;
_buttonCancel ctrlcommit 0; _buttonCancel ctrlcommit 0;