From 160f6d40ba3e0ce13e06533561f567f389547511 Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Fri, 11 Nov 2022 13:39:16 +0100 Subject: ctrl +f support (#423) --- .../moulberry/notenoughupdates/NEUOverlay.java | 20 ++++++++++++++++++-- .../notenoughupdates/infopanes/DevInfoPane.java | 15 +++++++-------- .../notenoughupdates/options/NEUConfigEditor.java | 5 +++++ .../options/seperateSections/Toolbar.java | 9 +++++++++ 4 files changed, 39 insertions(+), 10 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 87ce915b..cff83cca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1035,14 +1035,30 @@ public class NEUOverlay extends Gui { return false; } - if ((Keyboard.isKeyDown(Keyboard.KEY_Y) && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) && NotEnoughUpdates.INSTANCE.config.hidden.dev) { - displayInformationPane(new DevInfoPane(this, manager)); + if (NotEnoughUpdates.INSTANCE.config.hidden.dev && (Keyboard.isKeyDown(Keyboard.KEY_Y) && !Keyboard.isKeyDown( + Keyboard.KEY_LCONTROL)) && !searchBarHasFocus) { + DevInfoPane devInfoPane = new DevInfoPane(this, manager); + if (devInfoPane.getText().isEmpty()) { + Utils.addChatMessage(EnumChatFormatting.AQUA + "[NEU] No missing items!"); + } else { + displayInformationPane(devInfoPane); + } } if (Keyboard.getEventKeyState()) { if (!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { searchBarHasFocus = false; } + + if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_F) && + NotEnoughUpdates.INSTANCE.config.toolbar.searchBar && NotEnoughUpdates.INSTANCE.config.toolbar.ctrlF) { + searchBarHasFocus = !searchBarHasFocus; + if (searchBarHasFocus) { + itemPaneOpen = true; + } + return true; + } + if (searchBarHasFocus) { if (keyPressed == 1) { searchBarHasFocus = false; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java index c44a9f71..1ae3c17c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java @@ -55,19 +55,18 @@ public class DevInfoPane extends TextInfoPane { text = getText(); } - private String getText() { - String text = ""; + public String getText() { + StringBuilder text = new StringBuilder(0); for (String internalname : manager.auctionManager.getItemAuctionInfoKeySet()) { if (internalname.matches("^.*-[0-9]{1,3}$")) continue; - if (!manager.getItemInformation().containsKey(internalname)) { - if (internalname.equals("RUNE") || internalname.contains("PARTY_HAT_CRAB") || internalname.equals("ABICASE")) continue; - text += internalname + "\n"; + if (!manager.isValidInternalName(internalname)) { + if (internalname.equals("RUNE") || internalname.contains("PARTY_HAT_CRAB") || internalname.equals("ABICASE")) + continue; + text.append(internalname).append("\n"); } } - - - return text; + return text.toString(); } //#region add vanilla items diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java index cee994b7..e3881f44 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java @@ -850,6 +850,11 @@ public class NEUConfigEditor extends GuiElement { int innerWidth = xSize - 154 - innerPadding * 2; if (Keyboard.getEventKeyState()) { + if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_F)) { + searchField.setFocus(!searchField.getFocus()); + return true; + } + String old = searchField.getText(); searchField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey()); searchField.setText(Minecraft.getMinecraft().fontRendererObj.trimStringToWidth( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java index 7d2f4fc4..2d88544e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java @@ -71,6 +71,15 @@ public class Toolbar { @ConfigAccordionId(id = 0) public boolean enableHelpButton = true; + @Expose + @ConfigOption( + name = "CTRL+F keybind", + desc = "Change the focus of the search bar when pressing CTRL + F" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean ctrlF = true; + @Expose @ConfigOption( name = "Search Bar Width", -- cgit