Merge pull request #2360 from Owain94/misc
misc: Fix button state, Configurable side panel shortcuts
This commit is contained in:
@@ -57,4 +57,6 @@ public interface GameShell
|
||||
DrawCallbacks getDrawCallbacks();
|
||||
|
||||
void resizeCanvas();
|
||||
|
||||
void setReplaceCanvasNextFrame(boolean replace);
|
||||
}
|
||||
|
||||
@@ -265,6 +265,9 @@ public class WidgetID
|
||||
static final int BANK_CONTAINER = 1;
|
||||
static final int INVENTORY_ITEM_CONTAINER = 3;
|
||||
static final int BANK_TITLE_BAR = 3;
|
||||
static final int ITEM_COUNT_TOP = 4;
|
||||
static final int ITEM_COUNT_BAR = 5;
|
||||
static final int ITEM_COUNT_BOTTOM = 6;
|
||||
static final int CONTENT_CONTAINER = 8;
|
||||
static final int TAB_CONTAINER = 9;
|
||||
static final int ITEM_CONTAINER = 11;
|
||||
@@ -273,6 +276,7 @@ public class WidgetID
|
||||
static final int DEPOSIT_EQUIPMENT = 42;
|
||||
static final int INCINERATOR = 44;
|
||||
static final int INCINERATOR_CONFIRM = 45;
|
||||
static final int EQUIPMENT_BUTTON = 107;
|
||||
}
|
||||
|
||||
static class GrandExchange
|
||||
|
||||
@@ -144,6 +144,10 @@ public enum WidgetInfo
|
||||
BANK_DEPOSIT_EQUIPMENT(WidgetID.BANK_GROUP_ID, WidgetID.Bank.DEPOSIT_EQUIPMENT),
|
||||
BANK_DEPOSIT_INVENTORY(WidgetID.BANK_GROUP_ID, WidgetID.Bank.DEPOSIT_INVENTORY),
|
||||
BANK_TAB_CONTAINER(WidgetID.BANK_GROUP_ID, WidgetID.Bank.TAB_CONTAINER),
|
||||
BANK_EQUIPMENT_BUTTON(WidgetID.BANK_GROUP_ID, WidgetID.Bank.EQUIPMENT_BUTTON),
|
||||
BANK_ITEM_COUNT_TOP(WidgetID.BANK_GROUP_ID, WidgetID.Bank.ITEM_COUNT_TOP),
|
||||
BANK_ITEM_COUNT_BAR(WidgetID.BANK_GROUP_ID, WidgetID.Bank.ITEM_COUNT_BAR),
|
||||
BANK_ITEM_COUNT_BOTTOM(WidgetID.BANK_GROUP_ID, WidgetID.Bank.ITEM_COUNT_BOTTOM),
|
||||
|
||||
GRAND_EXCHANGE_WINDOW_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.WINDOW_CONTAINER),
|
||||
GRAND_EXCHANGE_OFFER_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.OFFER_CONTAINER),
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
package net.runelite.client.config;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.ui.ContainableFrame;
|
||||
@@ -181,11 +183,23 @@ public interface RuneLiteConfig extends Config
|
||||
return 100;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "tooltipPosition",
|
||||
name = "Tooltip Position",
|
||||
description = "Configures whether to show the tooltip above or under the cursor",
|
||||
position = 13,
|
||||
titleSection = "miscTitle"
|
||||
)
|
||||
default TooltipPositionType tooltipPosition()
|
||||
{
|
||||
return TooltipPositionType.UNDER_CURSOR;
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "notificationsTitle",
|
||||
name = "Notifications",
|
||||
description = "",
|
||||
position = 13
|
||||
position = 14
|
||||
)
|
||||
default Title notificationsTitle()
|
||||
{
|
||||
@@ -196,7 +210,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "notificationTray",
|
||||
name = "Enable tray notifications",
|
||||
description = "Enables tray notifications",
|
||||
position = 14,
|
||||
position = 15,
|
||||
titleSection = "notificationsTitle"
|
||||
)
|
||||
default boolean enableTrayNotifications()
|
||||
@@ -208,7 +222,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "notificationRequestFocus",
|
||||
name = "Request focus on notification",
|
||||
description = "Toggles window focus request",
|
||||
position = 15,
|
||||
position = 16,
|
||||
titleSection = "notificationsTitle"
|
||||
)
|
||||
default boolean requestFocusOnNotification()
|
||||
@@ -220,7 +234,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "notificationSound",
|
||||
name = "Notification sound",
|
||||
description = "Enables the playing of a beep sound when notifications are displayed",
|
||||
position = 16,
|
||||
position = 17,
|
||||
titleSection = "notificationsTitle"
|
||||
)
|
||||
default Notifier.NativeCustomOff notificationSound()
|
||||
@@ -232,7 +246,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "notificationGameMessage",
|
||||
name = "Enable game message notifications",
|
||||
description = "Puts a notification message in the chatbox",
|
||||
position = 17,
|
||||
position = 18,
|
||||
titleSection = "notificationsTitle"
|
||||
)
|
||||
default boolean enableGameMessageNotification()
|
||||
@@ -244,7 +258,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "notificationFlash",
|
||||
name = "Enable flash notification",
|
||||
description = "Flashes the game frame as a notification",
|
||||
position = 18,
|
||||
position = 19,
|
||||
titleSection = "notificationsTitle"
|
||||
)
|
||||
default FlashNotification flashNotification()
|
||||
@@ -256,7 +270,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "notificationFocused",
|
||||
name = "Send notifications when focused",
|
||||
description = "Toggles all notifications for when the client is focused",
|
||||
position = 19,
|
||||
position = 20,
|
||||
titleSection = "notificationsTitle"
|
||||
)
|
||||
default boolean sendNotificationsWhenFocused()
|
||||
@@ -268,7 +282,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "fontTitle",
|
||||
name = "Font",
|
||||
description = "",
|
||||
position = 20
|
||||
position = 21
|
||||
)
|
||||
default Title fontTitle()
|
||||
{
|
||||
@@ -279,7 +293,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "fontType",
|
||||
name = "Dynamic Overlay Font",
|
||||
description = "Configures what font type is used for in-game overlays such as player name, ground items, etc.",
|
||||
position = 21,
|
||||
position = 22,
|
||||
titleSection = "fontTitle"
|
||||
)
|
||||
default FontType fontType()
|
||||
@@ -291,7 +305,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "tooltipFontType",
|
||||
name = "Tooltip Font",
|
||||
description = "Configures what font type is used for in-game tooltips such as food stats, NPC names, etc.",
|
||||
position = 22,
|
||||
position = 23,
|
||||
titleSection = "fontTitle"
|
||||
)
|
||||
default FontType tooltipFontType()
|
||||
@@ -303,7 +317,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "interfaceFontType",
|
||||
name = "Interface Overlay Font",
|
||||
description = "Configures what font type is used for in-game interface overlays such as panels, opponent info, clue scrolls etc.",
|
||||
position = 23,
|
||||
position = 24,
|
||||
titleSection = "fontTitle"
|
||||
)
|
||||
default FontType interfaceFontType()
|
||||
@@ -315,7 +329,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "overlayTitle",
|
||||
name = "Overlays",
|
||||
description = "",
|
||||
position = 24
|
||||
position = 25
|
||||
)
|
||||
default Title overlayTitle()
|
||||
{
|
||||
@@ -326,7 +340,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "menuEntryShift",
|
||||
name = "Require Shift for overlay menu",
|
||||
description = "Overlay right-click menu will require shift to be added",
|
||||
position = 25,
|
||||
position = 26,
|
||||
titleSection = "overlayTitle"
|
||||
)
|
||||
default boolean menuEntryShift()
|
||||
@@ -334,22 +348,22 @@ public interface RuneLiteConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "tooltipPosition",
|
||||
name = "Tooltip Position",
|
||||
description = "Configures whether to show the tooltip above or under the cursor",
|
||||
position = 35
|
||||
@ConfigTitleSection(
|
||||
keyName = "infoboxTitle",
|
||||
name = "Infoboxes",
|
||||
description = "",
|
||||
position = 27
|
||||
)
|
||||
default TooltipPositionType tooltipPosition()
|
||||
default Title infoboxTitle()
|
||||
{
|
||||
return TooltipPositionType.UNDER_CURSOR;
|
||||
return new Title();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "infoBoxVertical",
|
||||
name = "Display infoboxes vertically",
|
||||
description = "Toggles the infoboxes to display vertically",
|
||||
position = 26,
|
||||
position = 28,
|
||||
titleSection = "infoboxTitle"
|
||||
)
|
||||
default boolean infoBoxVertical()
|
||||
@@ -361,7 +375,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "infoBoxWrap",
|
||||
name = "Infobox wrap count",
|
||||
description = "Configures the amount of infoboxes shown before wrapping",
|
||||
position = 27,
|
||||
position = 29,
|
||||
titleSection = "infoboxTitle"
|
||||
)
|
||||
default int infoBoxWrap()
|
||||
@@ -373,7 +387,7 @@ public interface RuneLiteConfig extends Config
|
||||
keyName = "infoBoxSize",
|
||||
name = "Infobox size",
|
||||
description = "Configures the size of each infobox in pixels",
|
||||
position = 28,
|
||||
position = 30,
|
||||
titleSection = "infoboxTitle"
|
||||
)
|
||||
@Units(Units.PIXELS)
|
||||
@@ -382,4 +396,38 @@ public interface RuneLiteConfig extends Config
|
||||
return 35;
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "keybindsTitle",
|
||||
name = "Key binds",
|
||||
description = "",
|
||||
position = 31
|
||||
)
|
||||
default Title keybindsTitle()
|
||||
{
|
||||
return new Title();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "sidebarToggleKey",
|
||||
name = "Sidebar Toggle Key",
|
||||
description = "The key that will toggle the sidebar (accepts modifiers)",
|
||||
position = 32,
|
||||
titleSection = "keybindsTitle"
|
||||
)
|
||||
default Keybind sidebarToggleKey()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_F11, InputEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "panelToggleKey",
|
||||
name = "Plugin Panel Toggle Key",
|
||||
description = "The key that will toggle the current or last opened plugin panel (accepts modifiers)",
|
||||
position = 33,
|
||||
titleSection = "keybindsTitle"
|
||||
)
|
||||
default Keybind panelToggleKey()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_F12, InputEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ import net.runelite.client.config.Keybind;
|
||||
import net.runelite.client.config.ModifierlessKeybind;
|
||||
import net.runelite.client.config.Range;
|
||||
import net.runelite.client.config.Units;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.events.PluginChanged;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
@@ -136,6 +136,9 @@ class ConfigPanel extends PluginPanel
|
||||
@Inject
|
||||
private ColorPickerManager colorPickerManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
private PluginConfigurationDescriptor pluginConfig = null;
|
||||
private final Map<String, JPanel> sectionWidgets = new HashMap<>();
|
||||
private final Map<String, JPanel> titleSectionWidgets = new HashMap<>();
|
||||
@@ -230,6 +233,7 @@ class ConfigPanel extends PluginPanel
|
||||
}
|
||||
|
||||
rebuild(false);
|
||||
eventBus.subscribe(PluginChanged.class, this, this::onPluginChanged);
|
||||
}
|
||||
|
||||
private void getSections(ConfigDescriptor cd)
|
||||
@@ -1169,7 +1173,6 @@ class ConfigPanel extends PluginPanel
|
||||
return new Dimension(PANEL_WIDTH + SCROLLBAR_WIDTH, super.getPreferredSize().height);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginChanged(PluginChanged event)
|
||||
{
|
||||
if (event.getPlugin() == this.pluginConfig.getPlugin())
|
||||
|
||||
@@ -43,7 +43,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.inject.Inject;
|
||||
@@ -70,7 +69,6 @@ import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.OpenOSRSConfig;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.events.ExternalPluginChanged;
|
||||
import net.runelite.client.events.ExternalPluginsLoaded;
|
||||
@@ -110,7 +108,6 @@ public class PluginListPanel extends PluginPanel
|
||||
|
||||
private final ConfigManager configManager;
|
||||
private final PluginManager pluginManager;
|
||||
private final ScheduledExecutorService executorService;
|
||||
private final Provider<ConfigPanel> configPanelProvider;
|
||||
private final OpenOSRSConfig openOSRSConfig;
|
||||
private final List<PluginConfigurationDescriptor> fakePlugins = new ArrayList<>();
|
||||
@@ -142,7 +139,6 @@ public class PluginListPanel extends PluginPanel
|
||||
public PluginListPanel(
|
||||
ConfigManager configManager,
|
||||
PluginManager pluginManager,
|
||||
ScheduledExecutorService executorService,
|
||||
Provider<ConfigPanel> configPanelProvider,
|
||||
OpenOSRSConfig openOSRSConfig,
|
||||
EventBus eventBus)
|
||||
@@ -151,7 +147,6 @@ public class PluginListPanel extends PluginPanel
|
||||
|
||||
this.configManager = configManager;
|
||||
this.pluginManager = pluginManager;
|
||||
this.executorService = executorService;
|
||||
this.configPanelProvider = configPanelProvider;
|
||||
this.openOSRSConfig = openOSRSConfig;
|
||||
|
||||
@@ -186,13 +181,13 @@ public class PluginListPanel extends PluginPanel
|
||||
});
|
||||
|
||||
eventBus.subscribe(ExternalPluginsLoaded.class, this, ignored -> {
|
||||
eventBus.subscribe(ExternalPluginChanged.class, this, ev -> {
|
||||
SwingUtilities.invokeLater(this::rebuildPluginList);
|
||||
});
|
||||
eventBus.subscribe(ExternalPluginChanged.class, this, ev -> SwingUtilities.invokeLater(this::rebuildPluginList));
|
||||
|
||||
SwingUtilities.invokeLater(this::rebuildPluginList);
|
||||
});
|
||||
|
||||
eventBus.subscribe(PluginChanged.class, this, this::onPluginChanged);
|
||||
|
||||
muxer = new MultiplexingPluginPanel(this);
|
||||
|
||||
searchBar = new IconTextField();
|
||||
@@ -475,7 +470,6 @@ public class PluginListPanel extends PluginPanel
|
||||
configManager.setConfiguration(RUNELITE_GROUP_NAME, PINNED_PLUGINS_CONFIG_KEY, value);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginChanged(PluginChanged event)
|
||||
{
|
||||
SwingUtilities.invokeLater(this::refresh);
|
||||
|
||||
@@ -43,8 +43,6 @@ import java.awt.Rectangle;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -79,7 +77,6 @@ import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.ExpandResizeType;
|
||||
import net.runelite.client.config.Keybind;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.config.WarningOnExit;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
@@ -366,8 +363,7 @@ public class ClientUI
|
||||
frame.add(container);
|
||||
|
||||
// Add key listener
|
||||
final HotkeyListener sidebarListener = new HotkeyListener(() ->
|
||||
new Keybind(KeyEvent.VK_F11, InputEvent.CTRL_DOWN_MASK))
|
||||
final HotkeyListener sidebarListener = new HotkeyListener(config::sidebarToggleKey)
|
||||
{
|
||||
@Override
|
||||
public void hotkeyPressed()
|
||||
@@ -378,6 +374,17 @@ public class ClientUI
|
||||
|
||||
keyManager.registerKeyListener(sidebarListener);
|
||||
|
||||
final HotkeyListener pluginPanelListener = new HotkeyListener(config::panelToggleKey)
|
||||
{
|
||||
@Override
|
||||
public void hotkeyPressed()
|
||||
{
|
||||
togglePluginPanel();
|
||||
}
|
||||
};
|
||||
|
||||
keyManager.registerKeyListener(pluginPanelListener);
|
||||
|
||||
// Add mouse listener
|
||||
final MouseListener mouseListener = new MouseAdapter()
|
||||
{
|
||||
@@ -612,7 +619,7 @@ public class ClientUI
|
||||
{
|
||||
OSXUtil.requestFocus();
|
||||
}
|
||||
|
||||
|
||||
// The workaround for Windows is to minimise and then un-minimise the client to bring
|
||||
// it to the front because java.awt.Window#toFront doesn't work reliably.
|
||||
// See https://stackoverflow.com/questions/309023/how-to-bring-a-window-to-the-front/7435722#7435722
|
||||
@@ -795,6 +802,30 @@ public class ClientUI
|
||||
}
|
||||
}
|
||||
|
||||
private void togglePluginPanel()
|
||||
{
|
||||
// Toggle sidebar open
|
||||
boolean isPanelOpen = sidebarOpen;
|
||||
sidebarOpen = !sidebarOpen;
|
||||
|
||||
if (isPanelOpen)
|
||||
{
|
||||
contract();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to restore last panel
|
||||
expand(currentNavButton);
|
||||
|
||||
//Checks if the toolbar was previously closed by toggleSidebar
|
||||
if (!container.isAncestorOf(pluginToolbar))
|
||||
{
|
||||
container.add(pluginToolbar);
|
||||
frame.expandBy(pluginToolbar.getWidth());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void expand(@Nullable NavigationButton button)
|
||||
{
|
||||
if (button == null)
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
package net.runelite.client.ui.overlay;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.experimental.NonFinal;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
|
||||
@Value
|
||||
@NonFinal
|
||||
public class OverlayMenuEntry
|
||||
{
|
||||
private MenuOpcode menuOpcode;
|
||||
|
||||
Reference in New Issue
Block a user