From cd2a9836a7d9466af66ffde013c38551d5c5e3a7 Mon Sep 17 00:00:00 2001 From: Dranni21312 Date: Mon, 6 Nov 2023 16:15:59 -0600 Subject: [PATCH 1/3] Map: added show/hide ID toggle --- .../src/main/java/gg/xp/xivsupport/gui/map/MapConfig.java | 2 ++ .../java/gg/xp/xivsupport/gui/map/MapDisplayConfig.java | 6 ++++++ .../src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapConfig.java b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapConfig.java index e554a733eb82..bb5dc6578ead 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapConfig.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapConfig.java @@ -29,6 +29,7 @@ public Component makeComponent() { EnumSettingGui omenSetting = new EnumSettingGui<>(displayConf.getOmenDisplayMode(), "AoEs (BETA)", () -> true); BooleanSettingGui hpBars = new BooleanSettingGui(displayConf.getHpBars(), "HP Bars", () -> true); BooleanSettingGui castBars = new BooleanSettingGui(displayConf.getCastBars(), "Cast Bars", () -> true); + BooleanSettingGui ids = new BooleanSettingGui(displayConf.getIds(), "IDs", () -> true); JCheckBox recording = new BooleanSettingGui(mdc.getEnableCapture(), "Recording", true).getComponent(); IntSettingSpinner max = new IntSettingSpinner(mdc.getMaxCaptures(), "Max Snapshots"); IntSettingSpinner minInterval = new IntSettingSpinner(mdc.getMsBetweenCaptures(), "Min Snap Interval (ms)"); @@ -48,6 +49,7 @@ public Component makeComponent() { omenSetting.getComboBoxOnly(), new ReadOnlyText("This feature is beta. Do not report bugs with regards to the display (or lack thereof) of a particular ability."), Box.createVerticalStrut(10), + ids.getComponent(), hpBars.getComponent(), castBars.getComponent(), Box.createVerticalStrut(10), diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapDisplayConfig.java b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapDisplayConfig.java index 25c3f52b849d..7f882b305714 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapDisplayConfig.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapDisplayConfig.java @@ -12,6 +12,7 @@ public class MapDisplayConfig { private final EnumSetting omenDisplayMode; private final BooleanSetting castBars; private final BooleanSetting hpBars; + private final BooleanSetting ids; public MapDisplayConfig(PersistenceProvider pers) { String settingBase = "map-display-config."; @@ -19,6 +20,7 @@ public MapDisplayConfig(PersistenceProvider pers) { omenDisplayMode = new EnumSetting<>(pers, settingBase + "omen-display-mode", OmenDisplayMode.class, OmenDisplayMode.SELECTED_ONLY); castBars = new BooleanSetting(pers, settingBase + "display-cast-bars", true); hpBars = new BooleanSetting(pers, settingBase + "display-hp-bars", true); + ids = new BooleanSetting(pers, settingBase + "display-ids", true); } public EnumSetting getNameDisplayMode() { @@ -36,4 +38,8 @@ public BooleanSetting getCastBars() { public BooleanSetting getHpBars() { return hpBars; } + + public BooleanSetting getIds() { + return ids; + } } diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java index 9331e948cf82..751e6a56f4c1 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java @@ -7,8 +7,6 @@ import gg.xp.xivsupport.gui.map.omen.ActionOmenInfo; import gg.xp.xivsupport.gui.map.omen.OmenDisplayMode; import gg.xp.xivsupport.gui.map.omen.OmenInstance; -import gg.xp.xivsupport.gui.map.omen.OmenLocationType; -import gg.xp.xivsupport.gui.map.omen.OmenShape; import gg.xp.xivsupport.gui.overlay.RefreshLoop; import gg.xp.xivsupport.gui.tables.renderers.HpBar; import gg.xp.xivsupport.gui.tables.renderers.IconTextRenderer; @@ -65,6 +63,7 @@ public class MapPanel extends JPanel implements MouseMotionListener, MouseListen private final EnumSetting omenDisp; private final BooleanSetting displayHpBars; private final BooleanSetting displayCastBars; + private final BooleanSetting displayIds; private double zoomFactor = 1; private volatile int curXpan; private volatile int curYpan; @@ -93,6 +92,7 @@ public MapPanel(MapDataController mdc, MapDisplayConfig mapDisplayConfig) { nameDisp = mapDisplayConfig.getNameDisplayMode(); displayHpBars = mapDisplayConfig.getHpBars(); displayCastBars = mapDisplayConfig.getCastBars(); + displayIds = mapDisplayConfig.getIds(); setLayout(null); setBackground(new Color(168, 153, 114)); @@ -711,6 +711,8 @@ else if (cbt.getType() == CombatantType.FAKE || hp.max() == 1 || hp.current() < else { hpBar.setVisible(false); } + + idLabel.setText((displayIds.get() ? String.format("0x%X", cbt.getId()) : "")); } private void formatComponent(XivCombatant cbt) { From 5263fd50a2c64fe7ae10794c347ae4c8c61818e7 Mon Sep 17 00:00:00 2001 From: Dranni21312 <80227585+Dranni21312@users.noreply.github.com> Date: Mon, 6 Nov 2023 20:50:56 -0600 Subject: [PATCH 2/3] Changed setText() to setVisible() Co-authored-by: xpdota --- xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java index 751e6a56f4c1..57d5e9b071d2 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java @@ -712,7 +712,7 @@ else if (cbt.getType() == CombatantType.FAKE || hp.max() == 1 || hp.current() < hpBar.setVisible(false); } - idLabel.setText((displayIds.get() ? String.format("0x%X", cbt.getId()) : "")); + idLabel.setVisible(displayIds.get()); } private void formatComponent(XivCombatant cbt) { From 49439590d9f2fddcaa4d35191db4efe341d55b02 Mon Sep 17 00:00:00 2001 From: Dranni21312 <80227585+Dranni21312@users.noreply.github.com> Date: Mon, 6 Nov 2023 21:32:08 -0600 Subject: [PATCH 3/3] Moved idLabel.setVisible() up. --- .../src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java index 57d5e9b071d2..9ea30bacdd22 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/gui/map/MapPanel.java @@ -684,6 +684,8 @@ public void update(XivCombatant cbt, @Nullable CastTracker castData) { castBar.setData(castData); } + idLabel.setVisible(displayIds.get()); + if (displayHpBars.get()) { HitPoints hp = cbt.getHp(); long hpCurrent = hp == null ? -1 : hp.current(); @@ -711,8 +713,6 @@ else if (cbt.getType() == CombatantType.FAKE || hp.max() == 1 || hp.current() < else { hpBar.setVisible(false); } - - idLabel.setVisible(displayIds.get()); } private void formatComponent(XivCombatant cbt) {