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

feat: Add ctrl+shift+f to open the search all pages dropdown. #368

Merged
merged 1 commit into from
Nov 30, 2024
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
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