Skip to content

Commit

Permalink
Merge pull request #456 from Dranni21312/map_hide_ids
Browse files Browse the repository at this point in the history
Map: added show/hide ID toggle
  • Loading branch information
xpdota authored Nov 7, 2023
2 parents a0e6df4 + 4943959 commit ab8e5b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public Component makeComponent() {
EnumSettingGui<OmenDisplayMode> 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)");
Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ public class MapDisplayConfig {
private final EnumSetting<OmenDisplayMode> omenDisplayMode;
private final BooleanSetting castBars;
private final BooleanSetting hpBars;
private final BooleanSetting ids;

public MapDisplayConfig(PersistenceProvider pers) {
String settingBase = "map-display-config.";
nameDisplayMode = new EnumSetting<>(pers, settingBase + "name-display-mode", NameDisplayMode.class, NameDisplayMode.FULL);
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<NameDisplayMode> getNameDisplayMode() {
Expand All @@ -36,4 +38,8 @@ public BooleanSetting getCastBars() {
public BooleanSetting getHpBars() {
return hpBars;
}

public BooleanSetting getIds() {
return ids;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -65,6 +63,7 @@ public class MapPanel extends JPanel implements MouseMotionListener, MouseListen
private final EnumSetting<OmenDisplayMode> 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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ab8e5b0

Please sign in to comment.