mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Store last tab selected.
This commit is contained in:
parent
f01b2f8754
commit
654978dd64
3 changed files with 30 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
using OtterGui.Filesystem;
|
using OtterGui.Filesystem;
|
||||||
using OtterGui.Widgets;
|
using OtterGui.Widgets;
|
||||||
|
using Penumbra.Api.Enums;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using Penumbra.Import.Structs;
|
using Penumbra.Import.Structs;
|
||||||
using Penumbra.Interop.Services;
|
using Penumbra.Interop.Services;
|
||||||
|
|
@ -87,6 +88,7 @@ public class Configuration : IPluginConfiguration, ISavable
|
||||||
public string QuickMoveFolder3 { get; set; } = string.Empty;
|
public string QuickMoveFolder3 { get; set; } = string.Empty;
|
||||||
public DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
public DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||||
public CollectionsTab.PanelMode CollectionPanel { get; set; } = CollectionsTab.PanelMode.SimpleAssignment;
|
public CollectionsTab.PanelMode CollectionPanel { get; set; } = CollectionsTab.PanelMode.SimpleAssignment;
|
||||||
|
public TabType SelectedTab { get; set; } = TabType.Settings;
|
||||||
|
|
||||||
public bool PrintSuccessfulCommandsToChat { get; set; } = true;
|
public bool PrintSuccessfulCommandsToChat { get; set; } = true;
|
||||||
public bool FixMainWindow { get; set; } = false;
|
public bool FixMainWindow { get; set; } = false;
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ public sealed class ConfigWindow : Window
|
||||||
{
|
{
|
||||||
_penumbra = penumbra;
|
_penumbra = penumbra;
|
||||||
_configTabs = configTabs;
|
_configTabs = configTabs;
|
||||||
|
SelectTab(_config.SelectedTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool DrawConditions()
|
public override bool DrawConditions()
|
||||||
|
|
@ -108,7 +109,12 @@ public sealed class ConfigWindow : Window
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_configTabs.Draw();
|
var type = _configTabs.Draw();
|
||||||
|
if (type != _config.SelectedTab)
|
||||||
|
{
|
||||||
|
_config.SelectedTab = type;
|
||||||
|
_config.Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastException = null;
|
_lastException = null;
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,12 @@ public class ConfigTabBar
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw()
|
public TabType Draw()
|
||||||
{
|
{
|
||||||
if (TabBar.Draw(string.Empty, ImGuiTabBarFlags.NoTooltip, ToLabel(SelectTab), out _, () => { }, Tabs))
|
if (TabBar.Draw(string.Empty, ImGuiTabBarFlags.NoTooltip, ToLabel(SelectTab), out var currentLabel, () => { }, Tabs))
|
||||||
SelectTab = TabType.None;
|
SelectTab = TabType.None;
|
||||||
|
|
||||||
|
return FromLabel(currentLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReadOnlySpan<byte> ToLabel(TabType type)
|
private ReadOnlySpan<byte> ToLabel(TabType type)
|
||||||
|
|
@ -68,4 +70,20 @@ public class ConfigTabBar
|
||||||
TabType.ResourceManager => Resource.Label,
|
TabType.ResourceManager => Resource.Label,
|
||||||
_ => ReadOnlySpan<byte>.Empty,
|
_ => ReadOnlySpan<byte>.Empty,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private TabType FromLabel(ReadOnlySpan<byte> label)
|
||||||
|
{
|
||||||
|
// @formatter:off
|
||||||
|
if (label == Mods.Label) return TabType.Mods;
|
||||||
|
if (label == Collections.Label) return TabType.Collections;
|
||||||
|
if (label == Settings.Label) return TabType.Settings;
|
||||||
|
if (label == ChangedItems.Label) return TabType.ChangedItems;
|
||||||
|
if (label == Effective.Label) return TabType.EffectiveChanges;
|
||||||
|
if (label == OnScreenTab.Label) return TabType.OnScreen;
|
||||||
|
if (label == Watcher.Label) return TabType.ResourceWatcher;
|
||||||
|
if (label == Debug.Label) return TabType.Debug;
|
||||||
|
if (label == Resource.Label) return TabType.ResourceManager;
|
||||||
|
// @formatter:on
|
||||||
|
return TabType.None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue