devtools: factor frame handling out
This commit is contained in:
@@ -28,7 +28,7 @@ import java.awt.Color;
|
|||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
class DevToolsButton extends JButton
|
public class DevToolsButton extends JButton
|
||||||
{
|
{
|
||||||
@Getter
|
@Getter
|
||||||
private boolean active;
|
private boolean active;
|
||||||
@@ -53,4 +53,20 @@ class DevToolsButton extends JButton
|
|||||||
setBackground(null);
|
setBackground(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addFrame(DevToolsFrame frame)
|
||||||
|
{
|
||||||
|
frame.setDevToolsButton(this);
|
||||||
|
addActionListener(ev ->
|
||||||
|
{
|
||||||
|
if (isActive())
|
||||||
|
{
|
||||||
|
frame.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frame.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021 Abex
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.plugins.devtools;
|
||||||
|
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Setter;
|
||||||
|
import net.runelite.client.ui.ClientUI;
|
||||||
|
|
||||||
|
public class DevToolsFrame extends JFrame
|
||||||
|
{
|
||||||
|
@Setter(AccessLevel.PACKAGE)
|
||||||
|
protected DevToolsButton devToolsButton;
|
||||||
|
|
||||||
|
public DevToolsFrame()
|
||||||
|
{
|
||||||
|
setIconImage(ClientUI.ICON);
|
||||||
|
|
||||||
|
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
addWindowListener(new WindowAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e)
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
devToolsButton.setActive(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open()
|
||||||
|
{
|
||||||
|
setVisible(true);
|
||||||
|
toFront();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -129,30 +129,10 @@ class DevToolsPanel extends PluginPanel
|
|||||||
});
|
});
|
||||||
|
|
||||||
container.add(plugin.getWidgetInspector());
|
container.add(plugin.getWidgetInspector());
|
||||||
plugin.getWidgetInspector().addActionListener((ev) ->
|
plugin.getWidgetInspector().addFrame(widgetInspector);
|
||||||
{
|
|
||||||
if (plugin.getWidgetInspector().isActive())
|
|
||||||
{
|
|
||||||
widgetInspector.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
widgetInspector.open();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
container.add(plugin.getVarInspector());
|
container.add(plugin.getVarInspector());
|
||||||
plugin.getVarInspector().addActionListener((ev) ->
|
plugin.getVarInspector().addFrame(varInspector);
|
||||||
{
|
|
||||||
if (plugin.getVarInspector().isActive())
|
|
||||||
{
|
|
||||||
varInspector.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
varInspector.open();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
container.add(plugin.getSoundEffects());
|
container.add(plugin.getSoundEffects());
|
||||||
|
|
||||||
@@ -164,17 +144,7 @@ class DevToolsPanel extends PluginPanel
|
|||||||
container.add(notificationBtn);
|
container.add(notificationBtn);
|
||||||
|
|
||||||
container.add(plugin.getScriptInspector());
|
container.add(plugin.getScriptInspector());
|
||||||
plugin.getScriptInspector().addActionListener((ev) ->
|
plugin.getScriptInspector().addFrame(scriptInspector);
|
||||||
{
|
|
||||||
if (plugin.getScriptInspector().isActive())
|
|
||||||
{
|
|
||||||
scriptInspector.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scriptInspector.open();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final JButton newInfoboxBtn = new JButton("Infobox");
|
final JButton newInfoboxBtn = new JButton("Infobox");
|
||||||
newInfoboxBtn.addActionListener(e ->
|
newInfoboxBtn.addActionListener(e ->
|
||||||
@@ -198,17 +168,7 @@ class DevToolsPanel extends PluginPanel
|
|||||||
container.add(clearInfoboxBtn);
|
container.add(clearInfoboxBtn);
|
||||||
|
|
||||||
container.add(plugin.getInventoryInspector());
|
container.add(plugin.getInventoryInspector());
|
||||||
plugin.getInventoryInspector().addActionListener((ev) ->
|
plugin.getInventoryInspector().addFrame(inventoryInspector);
|
||||||
{
|
|
||||||
if (plugin.getInventoryInspector().isActive())
|
|
||||||
{
|
|
||||||
inventoryInspector.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
inventoryInspector.open();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final JButton disconnectBtn = new JButton("Disconnect");
|
final JButton disconnectBtn = new JButton("Disconnect");
|
||||||
disconnectBtn.addActionListener(e -> clientThread.invoke(() -> client.setGameState(GameState.CONNECTION_LOST)));
|
disconnectBtn.addActionListener(e -> clientThread.invoke(() -> client.setGameState(GameState.CONNECTION_LOST)));
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import java.awt.BorderLayout;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.AdjustmentEvent;
|
import java.awt.event.AdjustmentEvent;
|
||||||
import java.awt.event.AdjustmentListener;
|
import java.awt.event.AdjustmentListener;
|
||||||
import java.awt.event.WindowAdapter;
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,7 +37,6 @@ import javax.annotation.Nullable;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollBar;
|
import javax.swing.JScrollBar;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
@@ -65,7 +62,7 @@ import net.runelite.client.ui.ColorScheme;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Singleton
|
@Singleton
|
||||||
class InventoryInspector extends JFrame
|
class InventoryInspector extends DevToolsFrame
|
||||||
{
|
{
|
||||||
private static final int MAX_LOG_ENTRIES = 25;
|
private static final int MAX_LOG_ENTRIES = 25;
|
||||||
|
|
||||||
@@ -80,7 +77,7 @@ class InventoryInspector extends JFrame
|
|||||||
private final InventoryDeltaPanel deltaPanel;
|
private final InventoryDeltaPanel deltaPanel;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
InventoryInspector(Client client, EventBus eventBus, DevToolsPlugin plugin, ItemManager itemManager, ClientThread clientThread)
|
InventoryInspector(Client client, EventBus eventBus, ItemManager itemManager, ClientThread clientThread)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
@@ -92,18 +89,6 @@ class InventoryInspector extends JFrame
|
|||||||
setTitle("RuneLite Inventory Inspector");
|
setTitle("RuneLite Inventory Inspector");
|
||||||
setIconImage(ClientUI.ICON);
|
setIconImage(ClientUI.ICON);
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
|
||||||
// Reset highlight on close
|
|
||||||
addWindowListener(new WindowAdapter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void windowClosing(WindowEvent e)
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
plugin.getInventoryInspector().setActive(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
tree.setBorder(new EmptyBorder(2, 2, 2, 2));
|
tree.setBorder(new EmptyBorder(2, 2, 2, 2));
|
||||||
tree.setRootVisible(false);
|
tree.setRootVisible(false);
|
||||||
tree.setShowsRootHandles(true);
|
tree.setShowsRootHandles(true);
|
||||||
@@ -175,19 +160,19 @@ class InventoryInspector extends JFrame
|
|||||||
pack();
|
pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void open()
|
public void open()
|
||||||
{
|
{
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
setVisible(true);
|
super.open();
|
||||||
toFront();
|
|
||||||
repaint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
eventBus.unregister(this);
|
eventBus.unregister(this);
|
||||||
clearTracker();
|
clearTracker();
|
||||||
setVisible(false);
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ import java.awt.Dimension;
|
|||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.event.AdjustmentEvent;
|
import java.awt.event.AdjustmentEvent;
|
||||||
import java.awt.event.AdjustmentListener;
|
import java.awt.event.AdjustmentListener;
|
||||||
import java.awt.event.WindowAdapter;
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -42,7 +40,6 @@ import javax.swing.BorderFactory;
|
|||||||
import javax.swing.DefaultListModel;
|
import javax.swing.DefaultListModel;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JFormattedTextField;
|
import javax.swing.JFormattedTextField;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JList;
|
import javax.swing.JList;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -68,14 +65,13 @@ import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.ui.ClientUI;
|
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.DynamicGridLayout;
|
import net.runelite.client.ui.DynamicGridLayout;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ScriptInspector extends JFrame
|
public class ScriptInspector extends DevToolsFrame
|
||||||
{
|
{
|
||||||
// These scripts are the only ones that fire every client tick regardless of location.
|
// These scripts are the only ones that fire every client tick regardless of location.
|
||||||
private final static String DEFAULT_BLACKLIST = "3174,1004";
|
private final static String DEFAULT_BLACKLIST = "3174,1004";
|
||||||
@@ -139,28 +135,16 @@ public class ScriptInspector extends JFrame
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ScriptInspector(Client client, EventBus eventBus, DevToolsPlugin plugin, ConfigManager configManager)
|
ScriptInspector(Client client, EventBus eventBus, ConfigManager configManager)
|
||||||
{
|
{
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.configManager = configManager;
|
this.configManager = configManager;
|
||||||
|
|
||||||
setTitle("RuneLite Script Inspector");
|
setTitle("RuneLite Script Inspector");
|
||||||
setIconImage(ClientUI.ICON);
|
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
|
||||||
addWindowListener(new WindowAdapter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void windowClosing(WindowEvent e)
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
plugin.getScriptInspector().setActive(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
tracker.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
tracker.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
||||||
|
|
||||||
final JPanel leftSide = new JPanel();
|
final JPanel leftSide = new JPanel();
|
||||||
@@ -344,14 +328,14 @@ public class ScriptInspector extends JFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void open()
|
public void open()
|
||||||
{
|
{
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
setVisible(true);
|
super.open();
|
||||||
toFront();
|
|
||||||
repaint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
configManager.setConfiguration("devtools", "highlights",
|
configManager.setConfiguration("devtools", "highlights",
|
||||||
@@ -360,7 +344,7 @@ public class ScriptInspector extends JFrame
|
|||||||
Text.toCSV(Lists.transform(new ArrayList<>(blacklist), String::valueOf)));
|
Text.toCSV(Lists.transform(new ArrayList<>(blacklist), String::valueOf)));
|
||||||
currentNode = null;
|
currentNode = null;
|
||||||
eventBus.unregister(this);
|
eventBus.unregister(this);
|
||||||
setVisible(false);
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addScriptLog(ScriptTreeNode treeNode)
|
private void addScriptLog(ScriptTreeNode treeNode)
|
||||||
|
|||||||
@@ -32,15 +32,12 @@ import java.awt.Dimension;
|
|||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.event.AdjustmentEvent;
|
import java.awt.event.AdjustmentEvent;
|
||||||
import java.awt.event.AdjustmentListener;
|
import java.awt.event.AdjustmentListener;
|
||||||
import java.awt.event.WindowAdapter;
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollBar;
|
import javax.swing.JScrollBar;
|
||||||
@@ -62,13 +59,12 @@ import net.runelite.api.events.VarbitChanged;
|
|||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.ui.ClientUI;
|
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.DynamicGridLayout;
|
import net.runelite.client.ui.DynamicGridLayout;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
class VarInspector extends JFrame
|
class VarInspector extends DevToolsFrame
|
||||||
{
|
{
|
||||||
@Getter
|
@Getter
|
||||||
private enum VarType
|
private enum VarType
|
||||||
@@ -106,28 +102,16 @@ class VarInspector extends JFrame
|
|||||||
private Map<Integer, Object> varcs = null;
|
private Map<Integer, Object> varcs = null;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VarInspector(Client client, ClientThread clientThread, EventBus eventBus, DevToolsPlugin plugin)
|
VarInspector(Client client, ClientThread clientThread, EventBus eventBus)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.clientThread = clientThread;
|
this.clientThread = clientThread;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
setTitle("RuneLite Var Inspector");
|
setTitle("RuneLite Var Inspector");
|
||||||
setIconImage(ClientUI.ICON);
|
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
|
||||||
addWindowListener(new WindowAdapter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void windowClosing(WindowEvent e)
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
plugin.getVarInspector().setActive(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
tracker.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
tracker.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
||||||
|
|
||||||
final JPanel trackerWrapper = new JPanel();
|
final JPanel trackerWrapper = new JPanel();
|
||||||
@@ -332,6 +316,7 @@ class VarInspector extends JFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void open()
|
public void open()
|
||||||
{
|
{
|
||||||
if (oldVarps == null)
|
if (oldVarps == null)
|
||||||
@@ -361,16 +346,15 @@ class VarInspector extends JFrame
|
|||||||
});
|
});
|
||||||
|
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
setVisible(true);
|
super.open();
|
||||||
toFront();
|
|
||||||
repaint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
|
super.close();
|
||||||
tracker.removeAll();
|
tracker.removeAll();
|
||||||
eventBus.unregister(this);
|
eventBus.unregister(this);
|
||||||
setVisible(false);
|
|
||||||
varcs = null;
|
varcs = null;
|
||||||
varbits = null;
|
varbits = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ import com.google.inject.Singleton;
|
|||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.WindowAdapter;
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
@@ -43,7 +41,6 @@ import java.util.Stack;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSplitPane;
|
import javax.swing.JSplitPane;
|
||||||
@@ -73,13 +70,12 @@ import net.runelite.api.widgets.WidgetType;
|
|||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.ui.ClientUI;
|
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.client.util.ColorUtil;
|
import net.runelite.client.util.ColorUtil;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Singleton
|
@Singleton
|
||||||
class WidgetInspector extends JFrame
|
class WidgetInspector extends DevToolsFrame
|
||||||
{
|
{
|
||||||
private static final Map<Integer, WidgetInfo> widgetIdMap = new HashMap<>();
|
private static final Map<Integer, WidgetInfo> widgetIdMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -123,7 +119,6 @@ class WidgetInspector extends JFrame
|
|||||||
ClientThread clientThread,
|
ClientThread clientThread,
|
||||||
WidgetInfoTableModel infoTableModel,
|
WidgetInfoTableModel infoTableModel,
|
||||||
DevToolsConfig config,
|
DevToolsConfig config,
|
||||||
DevToolsPlugin plugin,
|
|
||||||
EventBus eventBus,
|
EventBus eventBus,
|
||||||
Provider<WidgetInspectorOverlay> overlay,
|
Provider<WidgetInspectorOverlay> overlay,
|
||||||
OverlayManager overlayManager)
|
OverlayManager overlayManager)
|
||||||
@@ -138,18 +133,6 @@ class WidgetInspector extends JFrame
|
|||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
|
|
||||||
setTitle("RuneLite Widget Inspector");
|
setTitle("RuneLite Widget Inspector");
|
||||||
setIconImage(ClientUI.ICON);
|
|
||||||
|
|
||||||
// Reset highlight on close
|
|
||||||
addWindowListener(new WindowAdapter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void windowClosing(WindowEvent e)
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
plugin.getWidgetInspector().setActive(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
@@ -402,21 +385,21 @@ class WidgetInspector extends JFrame
|
|||||||
return widgetIdMap.get(packedId);
|
return widgetIdMap.get(packedId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void open()
|
public void open()
|
||||||
{
|
{
|
||||||
setVisible(true);
|
super.open();
|
||||||
toFront();
|
|
||||||
repaint();
|
|
||||||
overlayManager.add(this.overlay.get());
|
overlayManager.add(this.overlay.get());
|
||||||
clientThread.invokeLater(this::addPickerWidget);
|
clientThread.invokeLater(this::addPickerWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
overlayManager.remove(this.overlay.get());
|
overlayManager.remove(this.overlay.get());
|
||||||
clientThread.invokeLater(this::removePickerWidget);
|
clientThread.invokeLater(this::removePickerWidget);
|
||||||
setSelectedWidget(null, -1, false);
|
setSelectedWidget(null, -1, false);
|
||||||
setVisible(false);
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removePickerWidget()
|
private void removePickerWidget()
|
||||||
|
|||||||
Reference in New Issue
Block a user