Skip to content

Commit

Permalink
feat: Add ctrl+shift+f to open the search all pages dropdown. (#368)
Browse files Browse the repository at this point in the history
Ctrl+Shift+F is often search all, so I made it be that here too.
  • Loading branch information
shpaass authored Nov 30, 2024
2 parents 3f2060c + 0720a83 commit 4f18ba2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 16 additions & 16 deletions Yafc/Windows/MainScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ private void BuildTabBar(ImGui gui) {
}

gui.allocator = RectAllocator.RightRow;
var spaceForDropdown = gui.AllocateRect(2.1f, 2.1f);
tabBar.Build(gui);

gui.DrawIcon(spaceForDropdown.Expand(-0.3f), Icon.DropDown, SchemeColor.BackgroundText);
if (gui.BuildButton(spaceForDropdown, SchemeColor.None, SchemeColor.Grey)) {
if (gui.BuildButton(Icon.DropDown, SchemeColor.None, SchemeColor.Grey).WithTooltip(gui, "List and search all pages (Ctrl+Shift+" +
ImGuiUtils.ScanToString(SDL.SDL_Scancode.SDL_SCANCODE_F) + ")") || showSearchAll) {
showSearchAll = false;
updatePageList();
ShowDropDown(gui, spaceForDropdown, missingPagesDropdown, new Padding(0f, 0f, 0f, 0.5f), 30f);
ShowDropDown(gui, gui.lastRect, missingPagesDropdown, new Padding(0f, 0f, 0f, 0.5f), 30f);
}

tabBar.Build(gui);
}
gui.DrawRectangle(gui.lastRect, SchemeColor.PureBackground);

Expand Down Expand Up @@ -434,6 +434,8 @@ private void SettingsDropdown(ImGui gui) {
}

private bool saveConfirmationActive;
private bool showSearchAll;

public override bool preventQuit => true;

protected override async void Close() {
Expand Down Expand Up @@ -571,25 +573,23 @@ public bool KeyDown(SDL.SDL_Keysym key) {
case SDL.SDL_Scancode.SDL_SCANCODE_S:
SaveProject().CaptureException();
break;
case SDL.SDL_Scancode.SDL_SCANCODE_Z:
if ((key.mod & SDL.SDL_Keymod.KMOD_SHIFT) != 0) {
project.undo.PerformRedo();
}
else {
project.undo.PerformUndo();
}

case SDL.SDL_Scancode.SDL_SCANCODE_Z when shift:
case SDL.SDL_Scancode.SDL_SCANCODE_Y:
project.undo.PerformRedo();
_activePageView?.Rebuild(false);
secondaryPageView?.Rebuild(false);
break;
case SDL.SDL_Scancode.SDL_SCANCODE_Y:
project.undo.PerformRedo();
case SDL.SDL_Scancode.SDL_SCANCODE_Z:
project.undo.PerformUndo();
_activePageView?.Rebuild(false);
secondaryPageView?.Rebuild(false);
break;
case SDL.SDL_Scancode.SDL_SCANCODE_N:
ShowNeie();
break;
case SDL.SDL_Scancode.SDL_SCANCODE_F when shift:
showSearchAll = true;
break;
case SDL.SDL_Scancode.SDL_SCANCODE_F:
ShowSearch();
break;
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
----------------------------------------------------------------------------------------------------------------------
Version:
Date:
Features:
- Added Ctrl+Shift+F to search all pages.
Fixes:
- "Map generated" entities that don't generate in any locations could break automation analysis.
- Recipes that are referenced without being defined do not prevent YAFC from loading.
Expand Down

0 comments on commit 4f18ba2

Please sign in to comment.