Merge pull request #1134 from MESLewis/mouse-tooltip-tweaks
Mouse Tooltip Options
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Morgan Lewis <https://github.com/MESLewis>
|
||||
* 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.mousehighlight;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup(
|
||||
keyName = "mousehighlight",
|
||||
name = "Mouse Tooltips",
|
||||
description = "Configures the Mouse Tooltips plugin"
|
||||
)
|
||||
public interface MouseHighlightConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "uiTooltip",
|
||||
name = "Interface Tooltips",
|
||||
description = "Whether or not tooltips are shown on interfaces"
|
||||
)
|
||||
default boolean uiTooltip()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "chatboxTooltip",
|
||||
name = "Chatbox Tooltips",
|
||||
description = "Whether or not tooltips are shown over the chatbox"
|
||||
)
|
||||
default boolean chatboxTooltip()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -43,13 +43,15 @@ class MouseHighlightOverlay extends Overlay
|
||||
{
|
||||
private final TooltipManager tooltipManager;
|
||||
private final Client client;
|
||||
private final MouseHighlightConfig config;
|
||||
|
||||
@Inject
|
||||
MouseHighlightOverlay(Client client, TooltipManager tooltipManager)
|
||||
MouseHighlightOverlay(Client client, TooltipManager tooltipManager, MouseHighlightConfig config)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
this.client = client;
|
||||
this.tooltipManager = tooltipManager;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,6 +99,16 @@ class MouseHighlightOverlay extends Overlay
|
||||
final int childId = WidgetInfo.TO_CHILD(widgetId);
|
||||
final Widget widget = client.getWidget(groupId, childId);
|
||||
|
||||
if (!config.uiTooltip() && widget != null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!config.chatboxTooltip() && groupId == WidgetInfo.CHATBOX.getGroupId())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (widget != null)
|
||||
{
|
||||
// If this varc is set, some CS is showing tooltip
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.mousehighlight;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -37,6 +39,12 @@ public class MouseHighlightPlugin extends Plugin
|
||||
@Inject
|
||||
private MouseHighlightOverlay overlay;
|
||||
|
||||
@Provides
|
||||
MouseHighlightConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(MouseHighlightConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user