Skip to content

Commit 5a8dd9a

Browse files
committed
Add home page toggle hotkey
1 parent 981bbae commit 5a8dd9a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

ContentEditor.App/Configuration/AppConfig.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public static class Keys
6565
public const string Key_Save = "key_save";
6666
public const string Key_Back = "key_back";
6767
public const string Key_Close = "key_close";
68+
public const string Key_HomePage = "key_homepage";
6869
public const string Key_PakBrowser_Bookmark = "key_pakbrowser_bookmark";
6970
public const string Key_PakBrowser_OpenBookmarks = "key_pakbrowser_openbookmarks";
7071
public const string Key_PakBrowser_JumpToPageTop = "key_pakbrowser_jumptopagetop";
@@ -207,6 +208,7 @@ public void Set(T? value) => SetAndSave(value, (v) => {
207208
public readonly SettingWrapper<KeyBinding> Key_Save = new SettingWrapper<KeyBinding>(Keys.Key_Save, _lock, new KeyBinding(ImGuiKey.S, ctrl: true));
208209
public readonly SettingWrapper<KeyBinding> Key_Back = new SettingWrapper<KeyBinding>(Keys.Key_Back, _lock, new KeyBinding(ImGuiKey.Backspace));
209210
public readonly SettingWrapper<KeyBinding> Key_Close = new SettingWrapper<KeyBinding>(Keys.Key_Close, _lock, new KeyBinding(ImGuiKey.W, ctrl: true));
211+
public readonly SettingWrapper<KeyBinding> Key_HomePage = new SettingWrapper<KeyBinding>(Keys.Key_HomePage, _lock, new KeyBinding(ImGuiKey.H, ctrl: true, shift: true));
210212
public readonly SettingWrapper<KeyBinding> Key_PakBrowser_Bookmark = new SettingWrapper<KeyBinding>(Keys.Key_PakBrowser_Bookmark, _lock, new KeyBinding(ImGuiKey.D, ctrl: true));
211213
public readonly SettingWrapper<KeyBinding> Key_PakBrowser_OpenBookmarks = new SettingWrapper<KeyBinding>(Keys.Key_PakBrowser_OpenBookmarks, _lock, new KeyBinding(ImGuiKey.B, ctrl: true, shift: true));
212214
public readonly SettingWrapper<KeyBinding> Key_PakBrowser_JumpToPageTop = new SettingWrapper<KeyBinding>(Keys.Key_PakBrowser_JumpToPageTop, _lock, new KeyBinding(ImGuiKey.Home));
@@ -345,6 +347,7 @@ public static void SaveConfigToIni()
345347
(Keys.Key_Save, instance.Key_Save.value.ToString(), "Keys"),
346348
(Keys.Key_Back, instance.Key_Back.value.ToString(), "Keys"),
347349
(Keys.Key_Close, instance.Key_Close.value.ToString(), "Keys"),
350+
(Keys.Key_HomePage, instance.Key_HomePage.value.ToString(), "Keys"),
348351
(Keys.Key_PakBrowser_Bookmark, instance.Key_PakBrowser_Bookmark.value.ToString(), "Keys"),
349352
(Keys.Key_PakBrowser_OpenBookmarks, instance.Key_PakBrowser_OpenBookmarks.value.ToString(), "Keys"),
350353
(Keys.Key_PakBrowser_OpenBookmarks, instance.Key_PakBrowser_OpenBookmarks.value.ToString(), "Keys"),
@@ -535,6 +538,7 @@ private void LoadConfigs(IEnumerable<(string key, string value, string? group)>
535538
case Keys.Key_Save: if (KeyBinding.TryParse(value, out _key)) Key_Save.value = _key; break;
536539
case Keys.Key_Back: if (KeyBinding.TryParse(value, out _key)) Key_Back.value = _key; break;
537540
case Keys.Key_Close: if (KeyBinding.TryParse(value, out _key)) Key_Close.value = _key; break;
541+
case Keys.Key_HomePage: if (KeyBinding.TryParse(value, out _key)) Key_HomePage.value = _key; break;
538542
case Keys.Key_PakBrowser_Bookmark: if (KeyBinding.TryParse(value, out _key)) Key_PakBrowser_Bookmark.value = _key; break;
539543
case Keys.Key_PakBrowser_OpenBookmarks: if (KeyBinding.TryParse(value, out _key)) Key_PakBrowser_OpenBookmarks.value = _key; break;
540544
case Keys.Key_PakBrowser_JumpToPageTop: if (KeyBinding.TryParse(value, out _key)) Key_PakBrowser_JumpToPageTop.value = _key; break;

ContentEditor.App/Imgui/SettingsWindowHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ private void ShowHotkeysGlobalTab()
356356
ImguiKeybinding("Save Open Files", config.Key_Save);
357357
ImguiKeybinding("Back", config.Key_Back);
358358
ImguiKeybinding("Close Current Window", config.Key_Close);
359+
ImguiKeybinding("Toggle Home Page", config.Key_HomePage);
359360
}
360361
private void ShowHotkeysPakBrowserTab()
361362
{

ContentEditor.App/NativeWindows/EditorWindow.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ protected void ShowMainMenuBar()
437437
ImGui.BeginMainMenuBar();
438438

439439
bool isHomePageDrawn = HasSubwindow<HomeWindow>(out var homePageData);
440-
if (ImGui.MenuItem($"{AppIcons.REECE_LogoSimple}", isHomePageDrawn)) {
440+
var toggleHome = ImGui.MenuItem($"{AppIcons.REECE_LogoSimple}", isHomePageDrawn) || AppConfig.Instance.Key_HomePage.Get().IsPressed();
441+
if (toggleHome) {
441442
if (isHomePageDrawn && homePageData != null) {
442443
CloseSubwindow(homePageData);
443444
} else {

0 commit comments

Comments
 (0)