Skip to content

Commit

Permalink
Merge pull request runelite#2372 from ypperlig/runepouchtooltip
Browse files Browse the repository at this point in the history
Add config option that enables/disables mouse tooltip on rune pouch hover
  • Loading branch information
Adam- authored May 7, 2018
2 parents 98e9b80 + 888b773 commit 50464c2
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode;

@ConfigGroup(
keyName = "runepouch",
Expand All @@ -39,7 +40,8 @@ public interface RunepouchConfig extends Config
@ConfigItem(
keyName = "fontcolor",
name = "Font Color",
description = "Color of the font for the number of runes in pouch"
description = "Color of the font for the number of runes in pouch",
position = 1
)
default Color fontColor()
{
Expand All @@ -49,20 +51,22 @@ default Color fontColor()
@ConfigItem(
keyName = "runeicons",
name = "Show Rune Icons",
description = "Show the rune icons next to the number of runes in pouch"
description = "Show the rune icons next to the number of runes in pouch",
position = 2
)
default boolean showIcons()
{
return true;
}

@ConfigItem(
keyName = "showOnlyOnHover",
name = "Show only on hover",
description = "Show the runes only when hovered"
keyName = "runePouchOverlayMode",
name = "Display mode",
description = "Configures where rune pouch overlay is displayed",
position = 3
)
default boolean showOnlyOnHover()
default RunePouchOverlayMode runePouchOverlayMode()
{
return false;
return RunePouchOverlayMode.BOTH;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import net.runelite.api.queries.InventoryWidgetItemQuery;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.game.ItemManager;
import static net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode.BOTH;
import static net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode.MOUSE_HOVER;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
Expand Down Expand Up @@ -125,7 +127,7 @@ public Dimension render(Graphics2D graphics)
.append(rune.getName())
.append("</col></br>");

if (config.showOnlyOnHover())
if (config.runePouchOverlayMode() == MOUSE_HOVER)
{
continue;
}
Expand Down Expand Up @@ -154,7 +156,9 @@ public Dimension render(Graphics2D graphics)

String tooltip = tooltipBuilder.toString();

if (!tooltip.isEmpty() && runePouch.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY()))
if (!tooltip.isEmpty()
&& runePouch.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY())
&& (config.runePouchOverlayMode() == MOUSE_HOVER || config.runePouchOverlayMode() == BOTH))
{
tooltipManager.add(new Tooltip(tooltip));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2018, Lars <[email protected]>
* 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.runepouch.config;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum RunePouchOverlayMode
{
INVENTORY("Inventory"),
MOUSE_HOVER("Mouse hover"),
BOTH("Both");

private final String name;

@Override
public String toString()
{
return name;
}
}

0 comments on commit 50464c2

Please sign in to comment.