Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ATragMX - Improved gun list readability #4674

Merged
merged 1 commit into from
Nov 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions addons/atragmx/RscTitles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#define ST_WITH_RECT 160

#define LB_TEXTURES 0x10

class ATragMX_RscText {
idc=-1;
type=0;
Expand Down Expand Up @@ -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;
Expand All @@ -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 {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions addons/atragmx/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion addons/atragmx/functions/fnc_add_new_gun.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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];
};
Expand Down
18 changes: 18 additions & 0 deletions addons/atragmx/functions/fnc_trim_gun_name.sqf
Original file line number Diff line number Diff line change
@@ -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]];