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

restore selected tab in settings ui #1281

Merged
merged 2 commits into from
Jan 18, 2020
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
47 changes: 37 additions & 10 deletions addons/settings/fnc_gui_configure.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,45 @@ if !(ctrlShown _ctrlAddonsGroup) then {
//--- change button text
_ctrlToggleButton ctrlSetText LLSTRING(configureBase);

//--- emulate default scope selection
switch (true) do {
case CAN_SET_CLIENT_SETTINGS: {
_ctrlClientButton call FUNC(gui_sourceChanged);
};
case CAN_SET_MISSION_SETTINGS: {
_ctrlMissionButton call FUNC(gui_sourceChanged);
};
case CAN_SET_SERVER_SETTINGS: {
_ctrlServerButton call FUNC(gui_sourceChanged);
//--- emulate scope selection
private _previousSelectedSource = uiNamespace getVariable QGVAR(source);

if (isNil "_previousSelectedSource") then {
switch (true) do {
case CAN_SET_CLIENT_SETTINGS: {
_previousSelectedSource = "client";
};
case CAN_SET_MISSION_SETTINGS: {
_previousSelectedSource = "mission";
};
case CAN_SET_SERVER_SETTINGS: {
_previousSelectedSource = "server";
};
default {
_previousSelectedSource = "";
};
};
};

if (_previousSelectedSource == "client" && {!CAN_VIEW_CLIENT_SETTINGS}) then {
_previousSelectedSource = "mission";
};

if (_previousSelectedSource == "mission" && {!CAN_VIEW_MISSION_SETTINGS}) then {
_previousSelectedSource = "server";
};

if (_previousSelectedSource == "server" && {!CAN_VIEW_SERVER_SETTINGS}) then {
_previousSelectedSource = "";
};

private _ctrlPreviousButton = [_ctrlServerButton, _ctrlMissionButton, _ctrlClientButton] param [
["server", "mission", "client"] find _previousSelectedSource,
_ctrlServerButton
];

_ctrlPreviousButton call FUNC(gui_sourceChanged);
ctrlSetFocus _ctrlPreviousButton;
} else {
//--- enable and show default menu
_ctrlGeneralGroup ctrlEnable true;
Expand Down
1 change: 1 addition & 0 deletions addons/settings/fnc_initDisplayGameOptions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ _ctrlButtonExport ctrlAddEventHandler ["ButtonClick", {
_x ctrlAddEventHandler ["ButtonClick", FUNC(gui_sourceChanged)];
} forEach [_ctrlServerButton, _ctrlMissionButton, _ctrlClientButton];

// ----- configure addons/base button
(_display displayCtrl IDC_BTN_CONFIGURE_ADDONS) ctrlAddEventHandler ["ButtonClick", {_this call FUNC(gui_configure)}];

// ----- scripted OK button
Expand Down
9 changes: 0 additions & 9 deletions addons/settings/fnc_openSettingsMenu.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,3 @@ private _ctrlConfirm = _dlgSettings ctrlCreate ["RscButtonMenuOK", IDC_CANCEL];
_ctrlConfirm ctrlSetPosition ctrlPosition _ctrlScriptedOK;
_ctrlConfirm ctrlCommit 0;
_ctrlConfirm ctrlAddEventHandler ["ButtonClick", {call FUNC(gui_saveTempData)}];

// then switch right to missions tab if in 3den
if (ctrlIDD _display isEqualTo 313) then {
private _ctrlMissionButton = _dlgSettings displayCtrl IDC_BTN_MISSION;

if (ctrlEnabled _ctrlMissionButton) then {
_ctrlMissionButton call FUNC(gui_sourceChanged);
};
};