cache ctrlSetStructedText parseText

This commit is contained in:
commy2 2015-04-25 13:28:21 +02:00
parent 6fdaf4c400
commit 73b17efa2f
4 changed files with 19 additions and 3 deletions

View File

@ -3,6 +3,8 @@
if (!hasInterface) exitWith {};
GVAR(ParsedTextCached) = [];
//Setup text/shadow color matrix
[] call FUNC(setupTextColors);
["SettingChanged", {

View File

@ -8,6 +8,7 @@ PREP(compileMenu);
PREP(compileMenuSelfAction);
PREP(collectActiveActionTree);
PREP(createAction);
PREP(ctrlSetParsedTextCached);
PREP(findActionNode);
PREP(handlePlayerChanged);
PREP(isSubPath);

View File

@ -0,0 +1,13 @@
// by commy2
#include "script_component.hpp"
private ["_ctrl", "_index", "_text"];
_ctrl = _this select 0;
_index = _this select 1;
_text = _this select 2;
if (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"")) then {
GVAR(ParsedTextCached) set [_index, _text];
_ctrl ctrlSetStructuredText parseText _text;
};

View File

@ -33,12 +33,12 @@ if(_icon == "") then {
};
_text = if (GVAR(UseListMenu)) then {
format ["<img image='%1' color='%2' align='left'/><t color='%3' size='0.80' shadow='1' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, _text]
format ["<img image='%1' color='%2' align='left'/><t color='%3' size='0.80' shadow='2' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, _text]
} else {
format ["<img image='%1' color='%2' align='center'/><br/><t color='%3' size='0.80' align='center' shadow='1' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, "ace_breakLine" callExtension _text];
format ["<img image='%1' color='%2' align='center'/><br/><t color='%3' size='0.80' align='center' shadow='2' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, "ace_breakLine" callExtension _text];
};
_ctrl ctrlSetStructuredText (parseText _text);
[_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached);
_text = if (GVAR(UseListMenu)) then {
_ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW];
} else {