Merge PluginToolbar and TitleToolbar together
Because of new isTab property there is no need to separate the toolbars anymore as it can be decided which one to add where based on it. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -28,7 +28,7 @@ import lombok.Value;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
|
||||
@Value
|
||||
public class TitleToolbarButtonAdded
|
||||
public class NavigationButtonAdded
|
||||
{
|
||||
private NavigationButton button;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import lombok.Value;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
|
||||
@Value
|
||||
public class PluginToolbarButtonAdded
|
||||
public class NavigationButtonRemoved
|
||||
{
|
||||
private NavigationButton button;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||
* 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.events;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
|
||||
@Value
|
||||
public class PluginToolbarButtonRemoved
|
||||
{
|
||||
private NavigationButton button;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||
* 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.events;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
|
||||
@Value
|
||||
public class TitleToolbarButtonRemoved
|
||||
{
|
||||
private NavigationButton button;
|
||||
}
|
||||
@@ -38,8 +38,8 @@ import net.runelite.client.account.AccountSession;
|
||||
import net.runelite.client.account.SessionManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.TitleToolbar;
|
||||
import net.runelite.client.util.RunnableExceptionLogger;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -55,7 +55,7 @@ public class AccountPlugin extends Plugin
|
||||
private SessionManager sessionManager;
|
||||
|
||||
@Inject
|
||||
private TitleToolbar titleToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private ScheduledExecutorService executor;
|
||||
@@ -103,9 +103,9 @@ public class AccountPlugin extends Plugin
|
||||
|
||||
private void addAndRemoveButtons()
|
||||
{
|
||||
titleToolbar.removeNavigation(loginButton);
|
||||
titleToolbar.removeNavigation(logoutButton);
|
||||
titleToolbar.addNavigation(sessionManager.getAccountSession() == null
|
||||
clientToolbar.removeNavigation(loginButton);
|
||||
clientToolbar.removeNavigation(logoutButton);
|
||||
clientToolbar.addNavigation(sessionManager.getAccountSession() == null
|
||||
? loginButton
|
||||
: logoutButton);
|
||||
}
|
||||
@@ -113,8 +113,8 @@ public class AccountPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
titleToolbar.removeNavigation(loginButton);
|
||||
titleToolbar.removeNavigation(logoutButton);
|
||||
clientToolbar.removeNavigation(loginButton);
|
||||
clientToolbar.removeNavigation(logoutButton);
|
||||
}
|
||||
|
||||
private void loginClick()
|
||||
|
||||
@@ -38,7 +38,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Configuration",
|
||||
@@ -48,7 +48,7 @@ import net.runelite.client.ui.PluginToolbar;
|
||||
public class ConfigPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
@@ -86,13 +86,13 @@ public class ConfigPlugin extends Plugin
|
||||
.panel(configPanel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -49,7 +49,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class DevToolsPlugin extends Plugin
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@@ -143,7 +143,7 @@ public class DevToolsPlugin extends Plugin
|
||||
.panel(panel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
|
||||
font = FontManager.getRunescapeFont()
|
||||
.deriveFont(Font.BOLD, 16);
|
||||
@@ -157,7 +157,7 @@ public class DevToolsPlugin extends Plugin
|
||||
overlayManager.remove(sceneOverlay);
|
||||
overlayManager.remove(cameraOverlay);
|
||||
overlayManager.remove(worldMapLocationOverlay);
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -49,8 +49,8 @@ import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.TitleToolbar;
|
||||
import net.runelite.client.util.LinkBrowser;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -67,7 +67,7 @@ public class DiscordPlugin extends Plugin
|
||||
private DiscordConfig config;
|
||||
|
||||
@Inject
|
||||
private TitleToolbar titleToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private RuneLiteProperties properties;
|
||||
@@ -101,14 +101,14 @@ public class DiscordPlugin extends Plugin
|
||||
.onClick(() -> LinkBrowser.browse(properties.getDiscordInvite()))
|
||||
.build();
|
||||
|
||||
titleToolbar.addNavigation(discordButton);
|
||||
clientToolbar.addNavigation(discordButton);
|
||||
checkForGameStateUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
titleToolbar.removeNavigation(discordButton);
|
||||
clientToolbar.removeNavigation(discordButton);
|
||||
discordState.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Farming Tracker",
|
||||
@@ -56,7 +56,7 @@ import net.runelite.client.ui.PluginToolbar;
|
||||
public class FarmingTrackerPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
@@ -103,7 +103,7 @@ public class FarmingTrackerPlugin extends Plugin
|
||||
.priority(4)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
|
||||
updatePanel();
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class FarmingTrackerPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -42,7 +42,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.http.api.feed.FeedClient;
|
||||
import net.runelite.http.api.feed.FeedResult;
|
||||
|
||||
@@ -56,7 +56,7 @@ import net.runelite.http.api.feed.FeedResult;
|
||||
public class FeedPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private FeedConfig config;
|
||||
@@ -99,14 +99,14 @@ public class FeedPlugin extends Plugin
|
||||
.panel(feedPanel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
executorService.submit(this::updateFeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
private void updateFeed()
|
||||
|
||||
@@ -65,7 +65,7 @@ import net.runelite.client.input.MouseManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.http.api.osbuddy.GrandExchangeClient;
|
||||
@@ -111,7 +111,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private GrandExchangeConfig config;
|
||||
@@ -151,7 +151,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
.panel(panel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(button);
|
||||
clientToolbar.addNavigation(button);
|
||||
|
||||
if (config.quickLookup())
|
||||
{
|
||||
@@ -163,7 +163,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
pluginToolbar.removeNavigation(button);
|
||||
clientToolbar.removeNavigation(button);
|
||||
mouseManager.unregisterMouseListener(inputListener);
|
||||
keyManager.unregisterKeyListener(inputListener);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ import net.runelite.client.menus.MenuManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.util.Text;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class HiscorePlugin extends Plugin
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private MenuManager menuManager;
|
||||
@@ -110,7 +110,7 @@ public class HiscorePlugin extends Plugin
|
||||
.panel(hiscorePanel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
|
||||
if (config.playerOption())
|
||||
{
|
||||
@@ -126,7 +126,7 @@ public class HiscorePlugin extends Plugin
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
hiscorePanel.removeInputKeyListener(autocompleter);
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
menuManager.removePlayerMenuItem(LOOKUP);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import javax.inject.Inject;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Info Panel",
|
||||
@@ -40,7 +40,7 @@ import net.runelite.client.ui.PluginToolbar;
|
||||
public class InfoPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
private NavigationButton navButton;
|
||||
|
||||
@@ -63,12 +63,12 @@ public class InfoPlugin extends Plugin
|
||||
.panel(panel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -67,7 +67,7 @@ public class KourendLibraryPlugin extends Plugin
|
||||
final static boolean debug = false;
|
||||
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -124,7 +124,7 @@ public class KourendLibraryPlugin extends Plugin
|
||||
|
||||
if (!config.hideButton())
|
||||
{
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class KourendLibraryPlugin extends Plugin
|
||||
{
|
||||
if (!config.hideButton())
|
||||
{
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -148,11 +148,11 @@ public class KourendLibraryPlugin extends Plugin
|
||||
boolean inRegion = lp != null && lp.getWorldLocation().getRegionID() == REGION;
|
||||
if (inRegion)
|
||||
{
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -163,7 +163,7 @@ public class KourendLibraryPlugin extends Plugin
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -211,11 +211,11 @@ public class KourendLibraryPlugin extends Plugin
|
||||
{
|
||||
if (inRegion)
|
||||
{
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
});
|
||||
buttonAttached = inRegion;
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Notes",
|
||||
@@ -47,7 +47,7 @@ import net.runelite.client.ui.PluginToolbar;
|
||||
public class NotesPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private NotesConfig config;
|
||||
@@ -80,13 +80,13 @@ public class NotesPlugin extends Plugin
|
||||
.panel(panel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -51,7 +51,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.screenmarkers.ui.ScreenMarkerPluginPanel;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -79,7 +79,7 @@ public class ScreenMarkerPlugin extends Plugin
|
||||
private MouseManager mouseManager;
|
||||
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@@ -121,7 +121,7 @@ public class ScreenMarkerPlugin extends Plugin
|
||||
.panel(pluginPanel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navigationButton);
|
||||
clientToolbar.addNavigation(navigationButton);
|
||||
|
||||
mouseListener = new ScreenMarkerMouseListener(this);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class ScreenMarkerPlugin extends Plugin
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.removeIf(ScreenMarkerOverlay.class::isInstance);
|
||||
screenMarkers.clear();
|
||||
pluginToolbar.removeNavigation(navigationButton);
|
||||
clientToolbar.removeNavigation(navigationButton);
|
||||
setMouseListenerEnabled(false);
|
||||
creatingScreenMarker = false;
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
@@ -60,6 +59,7 @@ import net.runelite.api.GameState;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.WorldType;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import static net.runelite.api.widgets.WidgetID.BARROWS_REWARD_GROUP_ID;
|
||||
@@ -79,10 +79,10 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.screenshot.imgur.ImageUploadRequest;
|
||||
import net.runelite.client.plugins.screenshot.imgur.ImageUploadResponse;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.DrawManager;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.TitleToolbar;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.HotkeyListener;
|
||||
import net.runelite.client.util.Text;
|
||||
@@ -159,7 +159,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
private ClientUI clientUi;
|
||||
|
||||
@Inject
|
||||
private TitleToolbar titleToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private DrawManager drawManager;
|
||||
@@ -224,7 +224,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
.build())
|
||||
.build();
|
||||
|
||||
titleToolbar.addNavigation(titleBarButton);
|
||||
clientToolbar.addNavigation(titleBarButton);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
@@ -236,7 +236,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(screenshotOverlay);
|
||||
titleToolbar.removeNavigation(titleBarButton);
|
||||
clientToolbar.removeNavigation(titleBarButton);
|
||||
keyManager.unregisterKeyListener(hotkeyListener);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Skill Calculator",
|
||||
@@ -61,7 +61,7 @@ public class SkillCalculatorPlugin extends Plugin
|
||||
private SpriteManager spriteManager;
|
||||
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
private NavigationButton uiNavigationButton;
|
||||
private SkillCalculatorPanel uiPanel;
|
||||
@@ -85,12 +85,12 @@ public class SkillCalculatorPlugin extends Plugin
|
||||
.priority(6)
|
||||
.panel(uiPanel)
|
||||
.build();
|
||||
pluginToolbar.addNavigation(uiNavigationButton);
|
||||
clientToolbar.addNavigation(uiNavigationButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
pluginToolbar.removeNavigation(uiNavigationButton);
|
||||
clientToolbar.removeNavigation(uiNavigationButton);
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
import static net.runelite.client.plugins.xptracker.XpWorldType.NORMAL;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.PluginToolbar;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.http.api.xp.XpClient;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -64,7 +64,7 @@ import net.runelite.http.api.xp.XpClient;
|
||||
public class XpTrackerPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private PluginToolbar pluginToolbar;
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -115,14 +115,14 @@ public class XpTrackerPlugin extends Plugin
|
||||
.panel(xpPanel)
|
||||
.build();
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
clientToolbar.addNavigation(navButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
xpState.reset();
|
||||
pluginToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
/**
|
||||
@@ -42,7 +41,7 @@ public class ClientPluginToolbar extends JToolBar
|
||||
private final Map<NavigationButton, Component> componentMap = new TreeMap<>((a, b) ->
|
||||
ComparisonChain
|
||||
.start()
|
||||
.compare(a.isTab(), b.isTab())
|
||||
.compareTrueFirst(a.isTab(), b.isTab())
|
||||
.compare(a.getPriority(), b.getPriority())
|
||||
.compare(a.getTooltip(), b.getTooltip())
|
||||
.result());
|
||||
@@ -80,18 +79,18 @@ public class ClientPluginToolbar extends JToolBar
|
||||
private void update()
|
||||
{
|
||||
removeAll();
|
||||
boolean isDelimited = false;
|
||||
|
||||
final AtomicBoolean isDelimited = new AtomicBoolean(false);
|
||||
componentMap.forEach((key, value) ->
|
||||
for (final Map.Entry<NavigationButton, Component> entry : componentMap.entrySet())
|
||||
{
|
||||
if (!key.isTab() && !isDelimited.get())
|
||||
if (!entry.getKey().isTab() && !isDelimited)
|
||||
{
|
||||
isDelimited.set(true);
|
||||
isDelimited = true;
|
||||
addSeparator();
|
||||
}
|
||||
|
||||
add(value);
|
||||
});
|
||||
add(entry.getValue());
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import javax.swing.JPanel;
|
||||
*/
|
||||
class ClientTitleToolbar extends JPanel
|
||||
{
|
||||
static final int TITLEBAR_SIZE = 23;
|
||||
private static final int TITLEBAR_SIZE = 23;
|
||||
private static final int ITEM_PADDING = 4;
|
||||
private final Map<NavigationButton, Component> componentMap = new TreeMap<>((a, b) ->
|
||||
ComparisonChain
|
||||
@@ -146,7 +146,7 @@ class ClientTitleToolbar extends JPanel
|
||||
private void update()
|
||||
{
|
||||
removeAll();
|
||||
componentMap.forEach((key, value) -> add(value));
|
||||
componentMap.values().forEach(this::add);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,20 +29,20 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.events.PluginToolbarButtonAdded;
|
||||
import net.runelite.client.events.PluginToolbarButtonRemoved;
|
||||
import net.runelite.client.events.NavigationButtonAdded;
|
||||
import net.runelite.client.events.NavigationButtonRemoved;
|
||||
|
||||
/**
|
||||
* Plugin toolbar buttons holder.
|
||||
*/
|
||||
@Singleton
|
||||
public class PluginToolbar
|
||||
public class ClientToolbar
|
||||
{
|
||||
private final EventBus eventBus;
|
||||
private final Set<NavigationButton> buttons = new HashSet<>();
|
||||
|
||||
@Inject
|
||||
private PluginToolbar(final EventBus eventBus)
|
||||
private ClientToolbar(final EventBus eventBus)
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class PluginToolbar
|
||||
|
||||
if (buttons.add(button))
|
||||
{
|
||||
eventBus.post(new PluginToolbarButtonAdded(button));
|
||||
eventBus.post(new NavigationButtonAdded(button));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class PluginToolbar
|
||||
{
|
||||
if (buttons.remove(button))
|
||||
{
|
||||
eventBus.post(new PluginToolbarButtonRemoved(button));
|
||||
eventBus.post(new NavigationButtonRemoved(button));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,10 +66,8 @@ import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.ExpandResizeType;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.config.WarningOnExit;
|
||||
import net.runelite.client.events.PluginToolbarButtonAdded;
|
||||
import net.runelite.client.events.PluginToolbarButtonRemoved;
|
||||
import net.runelite.client.events.TitleToolbarButtonAdded;
|
||||
import net.runelite.client.events.TitleToolbarButtonRemoved;
|
||||
import net.runelite.client.events.NavigationButtonAdded;
|
||||
import net.runelite.client.events.NavigationButtonRemoved;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.ui.skin.SubstanceRuneLiteLookAndFeel;
|
||||
import net.runelite.client.util.OSType;
|
||||
@@ -171,19 +169,22 @@ public class ClientUI
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginToolbarButtonAdded(final PluginToolbarButtonAdded event)
|
||||
public void onNavigationButtonAdded(final NavigationButtonAdded event)
|
||||
{
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
final NavigationButton navigationButton = event.getButton();
|
||||
final PluginPanel pluginPanel = navigationButton.getPanel();
|
||||
final boolean inTitle = !event.getButton().isTab() &&
|
||||
(config.enableCustomChrome() || SwingUtil.isCustomTitlePanePresent(frame));
|
||||
final int iconSize = 16;
|
||||
|
||||
if (pluginPanel != null)
|
||||
{
|
||||
navContainer.add(pluginPanel.getWrappedPanel(), navigationButton.getTooltip());
|
||||
}
|
||||
|
||||
final JButton button = SwingUtil.createSwingButton(navigationButton, 0, (navButton, jButton) ->
|
||||
final JButton button = SwingUtil.createSwingButton(navigationButton, iconSize, (navButton, jButton) ->
|
||||
{
|
||||
final PluginPanel panel = navButton.getPanel();
|
||||
|
||||
@@ -222,16 +223,24 @@ public class ClientUI
|
||||
}
|
||||
});
|
||||
|
||||
pluginToolbar.addComponent(event.getButton(), button);
|
||||
if (inTitle)
|
||||
{
|
||||
titleToolbar.addComponent(event.getButton(), button);
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginToolbar.addComponent(event.getButton(), button);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginToolbarButtonRemoved(final PluginToolbarButtonRemoved event)
|
||||
public void onNavigationButtonRemoved(final NavigationButtonRemoved event)
|
||||
{
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
pluginToolbar.removeComponent(event.getButton());
|
||||
titleToolbar.removeComponent(event.getButton());
|
||||
final PluginPanel pluginPanel = event.getButton().getPanel();
|
||||
|
||||
if (pluginPanel != null)
|
||||
@@ -241,39 +250,6 @@ public class ClientUI
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onTitleToolbarButtonAdded(final TitleToolbarButtonAdded event)
|
||||
{
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
final int iconSize = ClientTitleToolbar.TITLEBAR_SIZE - 6;
|
||||
final JButton button = SwingUtil.createSwingButton(event.getButton(), iconSize, null);
|
||||
|
||||
if (config.enableCustomChrome() || SwingUtil.isCustomTitlePanePresent(frame))
|
||||
{
|
||||
titleToolbar.addComponent(event.getButton(), button);
|
||||
return;
|
||||
}
|
||||
|
||||
pluginToolbar.addComponent(event.getButton(), button);
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onTitleToolbarButtonRemoved(final TitleToolbarButtonRemoved event)
|
||||
{
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
if (config.enableCustomChrome() || SwingUtil.isCustomTitlePanePresent(frame))
|
||||
{
|
||||
titleToolbar.removeComponent(event.getButton());
|
||||
return;
|
||||
}
|
||||
|
||||
pluginToolbar.removeComponent(event.getButton());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize UI.
|
||||
*
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2018, Adam <Adam@sigterm.info>
|
||||
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||
* 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.ui;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.events.TitleToolbarButtonAdded;
|
||||
import net.runelite.client.events.TitleToolbarButtonRemoved;
|
||||
|
||||
/**
|
||||
* Title toolbar buttons holder.
|
||||
*/
|
||||
@Singleton
|
||||
public class TitleToolbar
|
||||
{
|
||||
private final EventBus eventBus;
|
||||
private final Set<NavigationButton> buttons = new HashSet<>();
|
||||
|
||||
@Inject
|
||||
private TitleToolbar(final EventBus eventBus)
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add navigation.
|
||||
*
|
||||
* @param button the button
|
||||
*/
|
||||
public void addNavigation(final NavigationButton button)
|
||||
{
|
||||
if (buttons.contains(button))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (buttons.add(button))
|
||||
{
|
||||
eventBus.post(new TitleToolbarButtonAdded(button));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove navigation.
|
||||
*
|
||||
* @param button the button
|
||||
*/
|
||||
public void removeNavigation(final NavigationButton button)
|
||||
{
|
||||
if (buttons.remove(button))
|
||||
{
|
||||
eventBus.post(new TitleToolbarButtonRemoved(button));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user