From c1b21383ef25d365d0a0f56c54717f42ef6cd87a Mon Sep 17 00:00:00 2001 From: Loporrit <141286461+loporrit@users.noreply.github.com> Date: Tue, 12 Dec 2023 01:55:24 +0000 Subject: [PATCH] Minor UI fixes --- MareSynchronos/UI/CompactUI.cs | 5 +---- MareSynchronos/UI/Components/GroupPanel.cs | 6 ++---- MareSynchronos/UI/Components/PairGroupsUi.cs | 5 +---- MareSynchronos/UI/IntroUI.cs | 2 +- MareSynchronos/UI/SettingsUi.cs | 20 ++++++++++---------- MareSynchronos/UI/UISharedService.cs | 12 ++++++------ 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/MareSynchronos/UI/CompactUI.cs b/MareSynchronos/UI/CompactUI.cs index 126183a..503ad29 100644 --- a/MareSynchronos/UI/CompactUI.cs +++ b/MareSynchronos/UI/CompactUI.cs @@ -111,6 +111,7 @@ public class CompactUi : WindowMediatorSubscriberBase else UiSharedService.AccentColor = ImGuiColors.ParsedGreen; } + ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetStyle().WindowPadding.Y - 1f * ImGuiHelpers.GlobalScale + ImGui.GetStyle().ItemSpacing.Y); WindowContentWidth = UiSharedService.GetWindowContentRegionWidth(); if (!_apiController.IsCurrentVersion) { @@ -390,11 +391,7 @@ public class CompactUi : WindowMediatorSubscriberBase var userCount = _apiController.OnlineUsers.ToString(CultureInfo.InvariantCulture); var userSize = ImGui.CalcTextSize(userCount); var textSize = ImGui.CalcTextSize("Users Online"); -#if DEBUG - string shardConnection = $"Shard: {_apiController.ServerInfo.ShardName}"; -#else string shardConnection = string.Equals(_apiController.ServerInfo.ShardName, "Main", StringComparison.OrdinalIgnoreCase) ? string.Empty : $"Shard: {_apiController.ServerInfo.ShardName}"; -#endif var shardTextSize = ImGui.CalcTextSize(shardConnection); var printShard = !string.IsNullOrEmpty(_apiController.ServerInfo.ShardName) && shardConnection != string.Empty; diff --git a/MareSynchronos/UI/Components/GroupPanel.cs b/MareSynchronos/UI/Components/GroupPanel.cs index 3daaf47..e32752f 100644 --- a/MareSynchronos/UI/Components/GroupPanel.cs +++ b/MareSynchronos/UI/Components/GroupPanel.cs @@ -141,7 +141,7 @@ internal sealed class GroupPanel if (ImGui.BeginPopupModal("Create Syncshell", ref _showModalCreateGroup, UiSharedService.PopupWindowFlags)) { UiSharedService.TextWrapped("Press the button below to create a new Syncshell."); - ImGui.SetNextItemWidth(200); + ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale); if (ImGui.Button("Create Syncshell")) { try @@ -473,7 +473,6 @@ internal sealed class GroupPanel var userVFXIcon = userVFXDisabled ? FontAwesomeIcon.Circle : FontAwesomeIcon.Sun; var iconSize = UiSharedService.GetIconSize(infoIcon); - var diffLockUnlockIcons = showInfoIcon ? (UiSharedService.GetIconButtonSize(infoIcon).X - iconSize.X) / 2 : 0; var barbuttonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars); var isOwner = string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal); @@ -482,7 +481,7 @@ internal sealed class GroupPanel var pauseIcon = groupDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause; var pauseIconSize = UiSharedService.GetIconButtonSize(pauseIcon); - ImGui.SameLine(windowEndX - barbuttonSize.X - (showInfoIcon ? iconSize.X : 0) - diffLockUnlockIcons - (showInfoIcon ? spacingX : 0) - pauseIconSize.X - spacingX); + ImGui.SameLine(windowEndX - barbuttonSize.X - (showInfoIcon ? iconSize.X : 0) - (showInfoIcon ? spacingX : 0) - pauseIconSize.X - spacingX); if (showInfoIcon) { @@ -574,7 +573,6 @@ internal sealed class GroupPanel UiSharedService.AttachToolTip((groupDto.GroupUserPermissions.IsPaused() ? "Resume" : "Pause") + " pairing with all users in this Syncshell"); ImGui.SameLine(); - ImGui.SetCursorPosX(ImGui.GetCursorPosX() + diffLockUnlockIcons); if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars)) { ImGui.OpenPopup("ShellPopup"); diff --git a/MareSynchronos/UI/Components/PairGroupsUi.cs b/MareSynchronos/UI/Components/PairGroupsUi.cs index 09fa376..9eed4e6 100644 --- a/MareSynchronos/UI/Components/PairGroupsUi.cs +++ b/MareSynchronos/UI/Components/PairGroupsUi.cs @@ -114,10 +114,7 @@ public class PairGroupsUi DrawName(tag, isSpecialTag, visibleInThisTag, usersInThisTag.Count(), otherUidsTaggedWithTag?.Count); if (!isSpecialTag) { - if (onlineUsers.Any() && onlineUsers.First() is DrawUserPair) - { - using (ImRaii.PushId($"group-{tag}-buttons")) DrawButtons(tag, allUsers.Cast().Where(p => otherUidsTaggedWithTag!.Contains(p.UID)).ToList()); - } + using (ImRaii.PushId($"group-{tag}-buttons")) DrawButtons(tag, allUsers.Cast().Where(p => otherUidsTaggedWithTag!.Contains(p.UID)).ToList()); } if (!_tagHandler.IsTagOpen(tag)) return; diff --git a/MareSynchronos/UI/IntroUI.cs b/MareSynchronos/UI/IntroUI.cs index 79dd240..1af038f 100644 --- a/MareSynchronos/UI/IntroUI.cs +++ b/MareSynchronos/UI/IntroUI.cs @@ -114,7 +114,7 @@ public class IntroUi : WindowMediatorSubscriberBase ImGui.TextUnformatted(Strings.ToS.LanguageLabel); ImGui.SameLine(); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + textSize.Y / 2 - (languageSize.Y + ImGui.GetStyle().FramePadding.Y) / 2); - ImGui.SetNextItemWidth(80); + ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale); if (ImGui.Combo("", ref _currentLanguage, _languages.Keys.ToArray(), _languages.Count)) { GetToSLocalization(_currentLanguage); diff --git a/MareSynchronos/UI/SettingsUi.cs b/MareSynchronos/UI/SettingsUi.cs index 42e33b4..017e6b5 100644 --- a/MareSynchronos/UI/SettingsUi.cs +++ b/MareSynchronos/UI/SettingsUi.cs @@ -167,7 +167,7 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted("Global Download Speed Limit"); ImGui.SameLine(); - ImGui.SetNextItemWidth(100); + ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale); if (ImGui.InputInt("###speedlimit", ref downloadSpeedLimit)) { _configService.Current.DownloadSpeedLimitInBytes = downloadSpeedLimit; @@ -175,7 +175,7 @@ public class SettingsUi : WindowMediatorSubscriberBase Mediator.Publish(new DownloadLimitChangedMessage()); } ImGui.SameLine(); - ImGui.SetNextItemWidth(100); + ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale); _uiShared.DrawCombo("###speed", new[] { DownloadSpeeds.Bps, DownloadSpeeds.KBps, DownloadSpeeds.MBps }, (s) => s switch { @@ -193,7 +193,7 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted("0 = No limit/infinite"); - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); if (ImGui.SliderInt("Maximum Parallel Downloads", ref maxParallelDownloads, 1, 10)) { _configService.Current.ParallelDownloads = maxParallelDownloads; @@ -249,7 +249,7 @@ public class SettingsUi : WindowMediatorSubscriberBase } UiSharedService.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars"); int transferBarWidth = _configService.Current.TransferBarsWidth; - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(500 * ImGuiHelpers.GlobalScale); if (ImGui.SliderInt("Transfer Bar Width", ref transferBarWidth, 10, 500)) { _configService.Current.TransferBarsWidth = transferBarWidth; @@ -257,7 +257,7 @@ public class SettingsUi : WindowMediatorSubscriberBase } UiSharedService.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)"); int transferBarHeight = _configService.Current.TransferBarsHeight; - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(500 * ImGuiHelpers.GlobalScale); if (ImGui.SliderInt("Transfer Bar Height", ref transferBarHeight, 2, 50)) { _configService.Current.TransferBarsHeight = transferBarHeight; @@ -698,7 +698,7 @@ public class SettingsUi : WindowMediatorSubscriberBase _configService.Save(); } - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); _uiShared.DrawCombo("Server Info Bar style", Enumerable.Range(0, DtrEntry.NumStyles), (i) => DtrEntry.RenderDtrStyle(i, "123"), (i) => { @@ -755,7 +755,7 @@ public class SettingsUi : WindowMediatorSubscriberBase Mediator.Publish(new CompactUiChange(Vector2.Zero, Vector2.Zero)); } UiSharedService.DrawHelpText("Will show profiles on the right side of the main UI"); - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); if (ImGui.SliderFloat("Hover Delay", ref profileDelay, 1, 10)) { _configService.Current.ProfileDelay = profileDelay; @@ -780,7 +780,7 @@ public class SettingsUi : WindowMediatorSubscriberBase var onlineNotifsNamedOnly = _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs; UiSharedService.FontText("Notifications", _uiShared.UidFont); - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); _uiShared.DrawCombo("Info Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), (i) => { @@ -793,7 +793,7 @@ public class SettingsUi : WindowMediatorSubscriberBase + Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner" + Environment.NewLine + "'Both' will show chat as well as the toast notification"); - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); _uiShared.DrawCombo("Warning Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), (i) => { @@ -806,7 +806,7 @@ public class SettingsUi : WindowMediatorSubscriberBase + Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner" + Environment.NewLine + "'Both' will show chat as well as the toast notification"); - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); _uiShared.DrawCombo("Error Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), (i) => { diff --git a/MareSynchronos/UI/UISharedService.cs b/MareSynchronos/UI/UISharedService.cs index 47bbf32..50fac9d 100644 --- a/MareSynchronos/UI/UISharedService.cs +++ b/MareSynchronos/UI/UISharedService.cs @@ -573,7 +573,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase { ColorTextWrapped("Note: The storage folder should be somewhere close to root (i.e. C:\\LoporritStorage) in a new empty folder. DO NOT point this to your game folder. DO NOT point this to your Penumbra folder.", ImGuiColors.DalamudYellow); var cacheDirectory = _configService.Current.CacheFolder; - ImGui.SetNextItemWidth(400); + ImGui.SetNextItemWidth(400 * ImGuiHelpers.GlobalScale); ImGui.InputText("Storage Folder##cache", ref cacheDirectory, 255, ImGuiInputTextFlags.ReadOnly); ImGui.SameLine(); @@ -624,7 +624,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase } float maxCacheSize = (float)_configService.Current.MaxLocalCacheInGiB; - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(400 * ImGuiHelpers.GlobalScale); if (ImGui.SliderFloat("Maximum Storage Size", ref maxCacheSize, 1f, 200f, "%.2f GiB")) { _configService.Current.MaxLocalCacheInGiB = maxCacheSize; @@ -820,7 +820,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase if (string.Equals(_serverConfigurationManager.CurrentServer?.ServerName, comboEntries[i], StringComparison.OrdinalIgnoreCase)) comboEntries[i] += " [Current]"; } - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); if (ImGui.BeginCombo("Select Service", comboEntries[_serverSelectionIndex])) { for (int i = 0; i < comboEntries.Length; i++) @@ -858,9 +858,9 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase if (ImGui.TreeNode("Add Custom Service")) { - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); ImGui.InputText("Custom Service URI", ref _customServerUri, 255); - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); ImGui.InputText("Custom Service Name", ref _customServerName, 255); if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add Custom Service") && !string.IsNullOrEmpty(_customServerUri) @@ -884,7 +884,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase public void DrawTimeSpanBetweenScansSetting() { var timeSpan = _configService.Current.TimeSpanBetweenScansInSeconds; - ImGui.SetNextItemWidth(250); + ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale); if (ImGui.SliderInt("Seconds between scans##timespan", ref timeSpan, 20, 60)) { _configService.Current.TimeSpanBetweenScansInSeconds = timeSpan;