ATragMX - Improved gun list readability (#4674)

* Reduced the gun list font size
* Redesigned the listbox scrollbars (new colors, smaller width)
* Added a negative offset for the horizontal text position in the gun list
* Limited the max. allowed length of custom gun names to 14 characters
This commit is contained in:
ulteq 2016-11-19 18:05:26 +01:00 committed by GitHub
parent 491aaa89cb
commit f94b1a7a10
5 changed files with 46 additions and 13 deletions

View File

@ -4,6 +4,8 @@
#define ST_WITH_RECT 160
#define LB_TEXTURES 0x10
class ATragMX_RscText {
idc=-1;
type=0;
@ -95,7 +97,7 @@ class ATragMX_RscToolbox {
class ATragMX_RscListBox {
idc=-1;
type=5;
style=0;
style=LB_TEXTURES;
font="TahomaB";
sizeEx=0.028;
rowHeight=0.03;
@ -115,13 +117,14 @@ class ATragMX_RscListBox {
soundSelect[]={"",0.09,1};
class ScrollBar {
color[]={1,1,1,0.6};
colorActive[]={1,1,1,1};
colorDisabled[]={1,1,1,0.3};
//thumb="\ca\ui\data\igui_scrollbar_thumb_ca.paa";
//arrowFull="\ca\ui\data\igui_arrow_top_active_ca.paa";
//arrowEmpty="\ca\ui\data\igui_arrow_top_ca.paa";
//border="\ca\ui\data\igui_border_scroll_ca.paa";
width=0.05;
color[]={0.15,0.21,0.23,0.3};
colorActive[]={0.15,0.21,0.23,0.3};
colorDisabled[]={0.15,0.21,0.23,0.3};
arrowEmpty="\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowFull="\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
border="\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
thumb="\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
};
class ListScrollBar : ScrollBar {
@ -130,7 +133,6 @@ class ATragMX_RscListBox {
class ATragMX_RscListNBox: ATragMX_RscListBox {
idc=-1;
type=102;
columns[]={0.0, 0.225, 0.475, 0.7};
drawSideArrows=0;
idcLeft=-1;
idcRight=-1;
@ -636,6 +638,7 @@ class ATragMX_Display {
};
class TEXT_OPTIONS_LIST_OUTPUT: ATragMX_RscListBox {
idc=3002;
style=0;
w=0.17;
h=0.28;
x=0.550*safezoneW+safezoneX+0.225;
@ -691,6 +694,7 @@ class ATragMX_Display {
};
class TEXT_RANGE_CARD_OUTPUT: ATragMX_RscListNBox {
idc=5007;
columns[]={0.0, 0.225, 0.475, 0.7};
idcLeft=50061;
idcRight=50062;
w=0.285;
@ -699,16 +703,17 @@ class ATragMX_Display {
y=0.265*safezoneH+safezoneY+0.27;
};
class TEXT_GUN_LIST_OUTPUT: ATragMX_RscListBox {
class TEXT_GUN_LIST_OUTPUT: ATragMX_RscListNBox {
idc=6000;
columns[]={-0.05};
w=0.16;
h=0.45;
x=0.550*safezoneW+safezoneX+0.11;
y=0.265*safezoneH+safezoneY+0.24;
sizeEx=0.025;
sizeEx=0.018;
colorSelectBackground[]={0.15,0.21,0.23,0.3};
colorSelectBackground2[]={0.15,0.21,0.23,0.3};
onMouseButtonDblClick=QUOTE(true call FUNC(toggle_gun_list));
onLBDblClick=QUOTE(true call FUNC(toggle_gun_list));
};
class TEXT_GUN_LIST_COLUMN_CAPTION: TEXT_GUN_PROFILE {
idc=6001;
@ -1066,6 +1071,8 @@ class ATragMX_Display {
x=0.550*safezoneW+safezoneX+0.12;
y=0.265*safezoneH+safezoneY+0.28;
text="";
onKeyDown=QUOTE(call FUNC(trim_gun_name));
onKeyUp=QUOTE(call FUNC(trim_gun_name));
};
class TEXT_ADD_NEW_GUN_OK: ATragMX_RscButton {
idc=11002;

View File

@ -70,6 +70,7 @@ PREP(toggle_target_data);
PREP(toggle_target_range_assist);
PREP(toggle_target_speed_assist);
PREP(toggle_truing_drop);
PREP(trim_gun_name);
PREP(true_c1_ballistic_coefficient);
PREP(true_muzzle_velocity);
PREP(update_atmosphere);

View File

@ -15,13 +15,16 @@
*/
#include "script_component.hpp"
call FUNC(trim_gun_name);
private _gunName = ctrlText 11001;
if (_gunName != "") then {
private _gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO", [[-15,0],[0,0],[10,0],[15,0],[25,0],[30,0],[35,0]], [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]], true];
GVAR(gunList) = GVAR(gunList) + [_gunProfileEntry];
lbAdd [6000, _gunProfileEntry select 0];
lbAdd [6000, _gunName];
call FUNC(store_gun_list);
};

View File

@ -26,6 +26,9 @@ private _validate_preset = {
ERROR("Invalid gun profile name");
_valid = false;
};
if (count (_this select 0) > 14) then {
WARNING("Gun profile name too long (max. allowed 14 characters)");
};
if (_this select 1 < 0 || _this select 1 > 1400) then {
private _errorMsg = format ["Invalid muzzle velocity: %1", _this select 1];
ERROR(_errorMsg);
@ -112,6 +115,7 @@ private _validate_preset = {
private _gun = getArray _preset;
if (_gun call _validate_preset) then {
_gun set [0, (_gun select 0) select [0, 14]];
_gun set [20, false];
GVAR(gunList) = GVAR(gunList) + [_gun];
};

View File

@ -0,0 +1,18 @@
/*
* Author: Ruthberg
* Trims the gun name input field
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
* call ace_atragmx_fnc_trim_gun_name
*
* Public: No
*/
#include "script_component.hpp"
ctrlSetText [11001, (ctrlText 11001) select [0, 14]];