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

Resize GUI grids in order to keep text grids fixed #340

Merged
merged 3 commits into from
Jul 21, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
#define GUI_GRID_Y (0.177 * safeZoneH + safeZoneY)
#define GUI_GRID_W (0.010 * safeZoneW)
#define GUI_GRID_H (0.022 * safeZoneH)
#define GUI_GRID_H_FIX (0.04)

//converts GUI grid to GUI coordinates
#define GtC_X(GRID) (GRID) * GUI_GRID_W + GUI_GRID_X
#define GtC_Y(GRID) (GRID) * GUI_GRID_H + GUI_GRID_Y
#define GtC_W(GRID) (GRID) * GUI_GRID_W
#define GtC_H(GRID) (GRID) * GUI_GRID_H
#define GtC_H_FIX(GRID) GRID * GUI_GRID_H_FIX

#define DYNAMIC_GUI_IDD 133798
#define DYNAMIC_TITLE_IDC 1000
Expand All @@ -19,24 +21,24 @@
#define BG_WIDTH (40 * GUI_GRID_W)
#define START_ROW_Y (0)
#define MAX_ALL_ROWS_H (29.4 * GUI_GRID_H)
#define LABEL_COMBO_H (0.5 * GUI_GRID_H)
#define LABEL_COMBO_H (0.5 * GUI_GRID_H_FIX)
#define LABEL_COLUMN_X (0.5 * GUI_GRID_W)
#define LABEL_WIDTH (39 * GUI_GRID_W)
#define LABEL_HEIGHT (2 * GUI_GRID_H)
#define LABEL_HEIGHT (2 * GUI_GRID_H_FIX)
#define LABEL_BG_COLOR [0,0,0,0.6]

#define COMBO_COLUMN_X (16 * GUI_GRID_W)
#define COMBO_WIDTH (22.5 * GUI_GRID_W)
#define COMBO_HEIGHT (1 * GUI_GRID_H)
#define COMBO_HEIGHT (1 * GUI_GRID_H_FIX)
#define OK_BUTTON_X (29.5 * GUI_GRID_W)
#define OK_BUTTON_WIDTH (4 * GUI_GRID_W)
#define OK_BUTTON_HEIGHT (1.5 * GUI_GRID_H)
#define OK_BUTTON_HEIGHT (1.5 * GUI_GRID_H_FIX)
#define CANCEL_BUTTON_X (34 * GUI_GRID_W)
#define CANCEL_BUTTON_WIDTH (4.5 * GUI_GRID_W)
#define CANCEL_BUTTON_HEIGHT (1.5 * GUI_GRID_H)
#define TOTAL_ROW_HEIGHT (2.1 * GUI_GRID_H)
#define CANCEL_BUTTON_HEIGHT (1.5 * GUI_GRID_H_FIX)
#define TOTAL_ROW_HEIGHT (2.1 * GUI_GRID_H_FIX)

#define FONT_SIZE (1.2 * GUI_GRID_H)
#define DEFAULT_FONT_SIZE (GUI_GRID_H_FIX)

#define BASE_IDC_LABEL (10000)
#define BASE_IDC_CTRL (20000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private _tot_height = 0;
_x params [["_control_type","",[""]]];
switch (_control_type) do
{
case "ALLSIDES"; case "SIDES": {_tot_height = _tot_height + GtC_H(4.1)};
case "ALLSIDES"; case "SIDES": {_tot_height = _tot_height + GtC_H_FIX(4.1)};
case "MESSAGE"; case "SCRIPT": {_tot_height = _tot_height + TOTAL_ROW_HEIGHT + 4*COMBO_HEIGHT};
default {_tot_height = _tot_height + TOTAL_ROW_HEIGHT};
};
Expand All @@ -48,7 +48,7 @@ _ctrl_group ctrlSetPosition _pos;
_ctrl_group ctrlCommit 0;

// adjust dialog bottom accordingly
private _yCoord = GUI_GRID_Y + GtC_H(1.5) + GtC_H(0.4) + _tot_height + GtC_H(0.4);
private _yCoord = GUI_GRID_Y + GtC_H_FIX(1.5) + GtC_H_FIX(0.4) + _tot_height + GtC_H_FIX(0.4);
{
private _bottomCtrl = _dialog displayCtrl _x;
_pos = ctrlPosition _bottomCtrl;
Expand All @@ -58,7 +58,7 @@ private _yCoord = GUI_GRID_Y + GtC_H(1.5) + GtC_H(0.4) + _tot_height + GtC_H(0.4
} forEach DYNAMIC_BOTTOM_IDCs;

// Resize the background accordingly
_yCoord = _yCoord + TOTAL_ROW_HEIGHT;
_yCoord = _yCoord + GtC_H_FIX(1.5) + GtC_H_FIX(0.4);
private _background = _dialog displayCtrl DYNAMIC_BG_IDC;
_pos = ctrlPosition _background;
_pos set [3, _yCoord - (_pos select 1)];
Expand Down Expand Up @@ -100,16 +100,16 @@ private _titleVariableIdentifier = format ["Ares_ChooseDialog_DefaultValues_%1",
_label_data params [["_label_text","",[""]], ["_tooltip_text","",[""]]];
private _ctrl_label = _dialog ctrlCreate ["RscText", BASE_IDC_LABEL + _forEachIndex, _ctrl_group];
_ctrl_label ctrlSetText _label_text;
_ctrl_label ctrlSetFontHeight FONT_SIZE;
_ctrl_label ctrlSetFontHeight DEFAULT_FONT_SIZE;
_ctrl_label ctrlSetTooltip _tooltip_text;
_ctrl_label ctrlSetBackgroundColor LABEL_BG_COLOR;
_ctrl_label ctrlSetPosition [LABEL_COLUMN_X, _yCoord, LABEL_WIDTH, LABEL_HEIGHT];
_ctrl_label ctrlCommit 0;

// Create the combo box
private _ctrl_cb = _dialog ctrlCreate ["RscCombo", BASE_IDC_CTRL + _forEachIndex, _ctrl_group];
private _ctrl_cb = _dialog ctrlCreate ["RscAchillesCombo", BASE_IDC_CTRL + _forEachIndex, _ctrl_group];
_ctrl_cb ctrlSetPosition [COMBO_COLUMN_X, _yCoord+LABEL_COMBO_H, COMBO_WIDTH, COMBO_HEIGHT];
_ctrl_cb ctrlSetFontHeight FONT_SIZE;
_ctrl_cb ctrlSetFontHeight DEFAULT_FONT_SIZE;
private _use_data = false;
{
_x params [["_entry_text_L","",[""]], ["_entry_text_R","",[""]], ["_str_data","",[""]]];
Expand Down Expand Up @@ -169,7 +169,7 @@ private _titleVariableIdentifier = format ["Ares_ChooseDialog_DefaultValues_%1",
_label_data params [["_label_text","",[""]], ["_tooltip_text","",[""]]];
private _ctrl_label = _dialog ctrlCreate ["RscText", BASE_IDC_LABEL + _forEachIndex, _ctrl_group];
_ctrl_label ctrlSetText _label_text;
_ctrl_label ctrlSetFontHeight FONT_SIZE;
_ctrl_label ctrlSetFontHeight DEFAULT_FONT_SIZE;
_ctrl_label ctrlSetTooltip _tooltip_text;
_ctrl_label ctrlSetBackgroundColor LABEL_BG_COLOR;
_ctrl_label ctrlSetPosition [LABEL_COLUMN_X, _yCoord, LABEL_WIDTH, LABEL_HEIGHT];
Expand Down Expand Up @@ -229,7 +229,7 @@ private _titleVariableIdentifier = format ["Ares_ChooseDialog_DefaultValues_%1",
_label_data params [["_label_text","",[""]], ["_tooltip_text","",[""]]];
private _ctrl_label = _dialog ctrlCreate ["RscText", BASE_IDC_LABEL + _forEachIndex, _ctrl_group];
_ctrl_label ctrlSetText _label_text;
_ctrl_label ctrlSetFontHeight FONT_SIZE;
_ctrl_label ctrlSetFontHeight DEFAULT_FONT_SIZE;
_ctrl_label ctrlSetTooltip _tooltip_text;
_ctrl_label ctrlSetBackgroundColor LABEL_BG_COLOR;
_ctrl_label ctrlSetPosition [LABEL_COLUMN_X, _yCoord, LABEL_WIDTH, LABEL_HEIGHT + _add_height];
Expand All @@ -243,7 +243,7 @@ private _titleVariableIdentifier = format ["Ares_ChooseDialog_DefaultValues_%1",
// Adjust default choice if it is invalid and select the current choice
if (!(_default_choice isEqualType "")) then {_default_choice = ""};
_ctrl_edit ctrlSetText _default_choice;
_ctrl_edit ctrlSetFontHeight FONT_SIZE;
_ctrl_edit ctrlSetFontHeight DEFAULT_FONT_SIZE;

// Set the current choice in a global variable and update the default value as well
uiNamespace setVariable [_defaultVariableId, _default_choice];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Add: RscControlsGroupNoScrollbars
w = "19 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
colorBackground[] = {0.518,0.016,0,0.8};
sizeEx = 1.2 * GUI_GRID_H;
sizeEx = 1.2 * GUI_GRID_H_FIX;
};
class Ares_Icon_Background_Attr: IGUIBack
{
Expand Down
11 changes: 10 additions & 1 deletion @AresModAchillesExpansion/addons/ui_f/dialogs/RscBaseClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@
#define GUI_GRID_X (0.294 * safeZoneW + safeZoneX)
#define GUI_GRID_Y (0.177 * safeZoneH + safeZoneY)
#define GUI_GRID_W (0.010 * safeZoneW)
#define GUI_GRID_W_FIX (0.025)
#define GUI_GRID_H (0.022 * safeZoneH)
#define GUI_GRID_H_FIX (0.04)

#define FONT_SIZE (1.2 * GUI_GRID_H)
#define TITLE_FONT_SIZE (1.2 * GUI_GRID_H_FIX)
#define DEFAULT_FONT_SIZE (1.0 * GUI_GRID_H_FIX)

// Forward declare some default base classes.
class IGUIBack;
Expand Down Expand Up @@ -152,6 +155,12 @@ class RscAchillesXSliderH: RscXSliderH
{
colorBackground[] = {0,0,0,1};
};
class RscAchillesCombo : RscCombo
{
h = 1 * GUI_GRID_H_FIX;
rowHeight = 1.1 * GUI_GRID_H_FIX;
wholeHeight = 6.5 * GUI_GRID_H_FIX;
};
class RscAchillesEdit: RscEdit
{
autocomplete = "general";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ class Ares_composition_Dialog
moving = 1;

text = "$STR_AMAE_ADVANCED_COMPOSITION"; //--- ToDo: Localize;
x = 9.5 * GUI_GRID_W + GUI_GRID_X;
x = 7.5 * GUI_GRID_W + 2 * GUI_GRID_W_FIX + GUI_GRID_X;
y = 0.5 * GUI_GRID_H + GUI_GRID_Y;
w = 24 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
size = FONT_SIZE;
sizeEx = FONT_SIZE;
w = 26 * GUI_GRID_W - 2 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
size = TITLE_FONT_SIZE;
sizeEx = TITLE_FONT_SIZE;
colorBackground[] = {0.518,0.016,0,0.8};
};
class Ares_Main_Background: IGUIBack
{
idc = 2000;

x = 7.5 * GUI_GRID_W + GUI_GRID_X;
y = 2 * GUI_GRID_H + GUI_GRID_Y;
y = 0.5 * GUI_GRID_H + 1.5 * GUI_GRID_H_FIX + GUI_GRID_Y;
w = 26 * GUI_GRID_W;
h = 20.5 * GUI_GRID_H;
colorBackground[] = {0.2,0.2,0.2,0.8};
};
class Ares_Dialog_Bottom: IGUIBack
class Ares_Dialog_Bottom_Bar: IGUIBack
{
idc = 2010;

x = 14.5 * GUI_GRID_W + GUI_GRID_X;
x = 8.5 * GUI_GRID_W + 6 * GUI_GRID_W_FIX + GUI_GRID_X;
y = 20.5 * GUI_GRID_H + GUI_GRID_Y;
w = 11 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
size = FONT_SIZE;
sizeEx = FONT_SIZE;
w = 24 * GUI_GRID_W - 13 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
size = DEFAULT_FONT_SIZE;
sizeEx = DEFAULT_FONT_SIZE;
colorBackground[] = {0,0,0,0.6};
};
class Ares_Cancle_Button: RscButtonMenuCancel
Expand All @@ -52,10 +52,10 @@ class Ares_composition_Dialog
onButtonClick = "uiNamespace setVariable ['Ares_Dialog_Result', -1]; closeDialog 2;";
x = 8 * GUI_GRID_W + GUI_GRID_X;
y = 20.5 * GUI_GRID_H + GUI_GRID_Y;
w = 6 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
size = FONT_SIZE;
sizeEx = FONT_SIZE;
w = 6 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
size = DEFAULT_FONT_SIZE;
sizeEx = DEFAULT_FONT_SIZE;
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,0.8};
};
Expand All @@ -67,21 +67,21 @@ class Ares_composition_Dialog

text = "$STR_AMAE_SPAWN"; //--- ToDo: Localize;

x = 26 * GUI_GRID_W + GUI_GRID_X;
x = 33 * GUI_GRID_W - 7 * GUI_GRID_W_FIX + GUI_GRID_X;
y = 20.5 * GUI_GRID_H + GUI_GRID_Y;
w = 7 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
size = FONT_SIZE;
sizeEx = FONT_SIZE;
w = 7 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
size = DEFAULT_FONT_SIZE;
sizeEx = DEFAULT_FONT_SIZE;
};
class Ares_Background_Edit: IGUIBack
{
idc = 2020;

x = 8 * GUI_GRID_W + GUI_GRID_X;
y = 2.5 * GUI_GRID_H + GUI_GRID_Y;
y = 1 * GUI_GRID_H + 1.5 * GUI_GRID_H_FIX + GUI_GRID_Y;
w = 25 * GUI_GRID_W;
h = 17 * GUI_GRID_H;
h = 19 * GUI_GRID_H - 1.5 * GUI_GRID_H_FIX;
colorBackground[] = {0,0,0,0.6};
};
class Ares_Paragraph_edit: RscText
Expand All @@ -90,11 +90,11 @@ class Ares_composition_Dialog

text = "Select composition to edit or delete."; //--- ToDo: Localize;
x = 8 * GUI_GRID_W + GUI_GRID_X;
y = 2.5 * GUI_GRID_H + GUI_GRID_Y;
y = 1 * GUI_GRID_H + 1.5 * GUI_GRID_H_FIX + GUI_GRID_Y;
w = 25.5 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
size = FONT_SIZE;
sizeEx = FONT_SIZE;
h = 1.5 * GUI_GRID_H_FIX;
size = DEFAULT_FONT_SIZE;
sizeEx = DEFAULT_FONT_SIZE;
};
class Ares_composition_tree: RscTree
{
Expand All @@ -105,11 +105,11 @@ class Ares_composition_Dialog
colorMarkedSelected[] = {1, 1, 1, 0.700000};

x = 8.5 * GUI_GRID_W + GUI_GRID_X;
y = 4 * GUI_GRID_H + GUI_GRID_Y;
y = 1 * GUI_GRID_H + 3 * GUI_GRID_H_FIX + GUI_GRID_Y;
w = 24 * GUI_GRID_W;
h = 15 * GUI_GRID_H;
size = FONT_SIZE;
sizeEx = FONT_SIZE;
h = 18.5 * GUI_GRID_H - 3 * GUI_GRID_H_FIX;
size = DEFAULT_FONT_SIZE;
sizeEx = DEFAULT_FONT_SIZE;
colorText[] = {0.5,0.5,0.5,1};
colorBackground[] = {0,0,0,0.5};
};
Expand All @@ -119,8 +119,8 @@ class Ares_composition_Dialog

x = 7.5 * GUI_GRID_W + GUI_GRID_X;
y = 0.5 * GUI_GRID_H + GUI_GRID_Y;
w = 2 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
w = 2 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
colorBackground[] = {0.518,0.016,0,0.8};
};
class Ares_Icon: RscPicture
Expand All @@ -130,8 +130,8 @@ class Ares_composition_Dialog
text = "\achilles\data_f_achilles\icons\icon_achilles_dialog.paa";
x = 7.5 * GUI_GRID_W + GUI_GRID_X;
y = 0.5 * GUI_GRID_H + GUI_GRID_Y;
w = 2 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
w = 2 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
};
class Ares_Delete_Button: RscActivePicture
{
Expand All @@ -144,32 +144,32 @@ class Ares_composition_Dialog
soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1};

text = "a3\3den\Data\Displays\Display3DEN\PanelLeft\entityList_delete_ca.paa";
x = 31 * GUI_GRID_W + GUI_GRID_X;
x = 33 * GUI_GRID_W - 2 * GUI_GRID_W_FIX + GUI_GRID_X;
y = 20.5 * GUI_GRID_H + GUI_GRID_Y;
w = 2 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
w = 2 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
};
class Ares_Edit_Button: Ares_Delete_Button
{
idc = 3030;

onButtonClick = "([""EDIT_BUTTON""] + _this) call Achilles_fnc_RscDisplayAttributes_manageAdvancedComposition;";
text = "a3\3den\Data\Displays\Display3DEN\PanelRight\customcomposition_edit_ca.paa";
x = 28.5 * GUI_GRID_W + GUI_GRID_X;
x = 33 * GUI_GRID_W - 4.5 * GUI_GRID_W_FIX + GUI_GRID_X;
y = 20.5 * GUI_GRID_H + GUI_GRID_Y;
w = 2 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
w = 2 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
};
class Ares_New_Button: Ares_Delete_Button
{
idc = 3040;

onButtonClick = "([""NEW_BUTTON""] + _this) call Achilles_fnc_RscDisplayAttributes_manageAdvancedComposition;";
text = "a3\3den\Data\Displays\Display3DEN\PanelRight\customcomposition_add_ca.paa";
x = 26 * GUI_GRID_W + GUI_GRID_X;
x = 33 * GUI_GRID_W - 7 * GUI_GRID_W_FIX + GUI_GRID_X;
y = 20.5 * GUI_GRID_H + GUI_GRID_Y;
w = 2 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
w = 2 * GUI_GRID_W_FIX;
h = 1.5 * GUI_GRID_H_FIX;
};

////////////////////////////////////////////////////////
Expand Down
Loading