diff --git a/src/main/java/net/rptools/maptool/client/AppPreferences.java b/src/main/java/net/rptools/maptool/client/AppPreferences.java index 6f5f2dc64e..b42ea6471e 100644 --- a/src/main/java/net/rptools/maptool/client/AppPreferences.java +++ b/src/main/java/net/rptools/maptool/client/AppPreferences.java @@ -147,6 +147,9 @@ public class AppPreferences { "hideMousePointerWhileDragging"; private static final boolean DEFAULT_KEY_HIDE_MOUSE_POINTER_WHILE_DRAGGING = true; + private static final String KEY_HIDE_TOKEN_STACK_INDICATOR = "hideTokenStackIndicator"; + private static final boolean DEFAULT_KEY_HIDE_TOKEN_STACK_INDICATOR = false; + private static final String KEY_OBJECTS_START_SNAP_TO_GRID = "newStampsStartSnapToGrid"; private static final boolean DEFAULT_OBJECTS_START_SNAP_TO_GRID = false; @@ -960,6 +963,14 @@ public static boolean getHideMousePointerWhileDragging() { KEY_HIDE_MOUSE_POINTER_WHILE_DRAGGING, DEFAULT_KEY_HIDE_MOUSE_POINTER_WHILE_DRAGGING); } + public static void setHideTokenStackIndicator(boolean flag) { + prefs.putBoolean(KEY_HIDE_TOKEN_STACK_INDICATOR, flag); + } + + public static boolean getHideTokenStackIndicator() { + return prefs.getBoolean(KEY_HIDE_TOKEN_STACK_INDICATOR, DEFAULT_KEY_HIDE_TOKEN_STACK_INDICATOR); + } + public static void setObjectsStartSnapToGrid(boolean flag) { prefs.putBoolean(KEY_OBJECTS_START_SNAP_TO_GRID, flag); } diff --git a/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialog.java b/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialog.java index 6afd3a7fc2..fcff01d94f 100644 --- a/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialog.java +++ b/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialog.java @@ -79,6 +79,7 @@ public class PreferencesDialog extends JDialog { private final JCheckBox tokensStartSnapToGridCheckBox; private final JCheckBox tokensSnapWhileDraggingCheckBox; private final JCheckBox hideMousePointerWhileDraggingCheckBox; + private final JCheckBox hideTokenStackIndicatorCheckBox; private final JCheckBox newMapsVisibleCheckBox; private final JCheckBox newTokensVisibleCheckBox; private final JCheckBox tokensStartFreeSizeCheckBox; @@ -323,6 +324,7 @@ public PreferencesDialog() { tokensStartSnapToGridCheckBox = panel.getCheckBox("tokensStartSnapToGridCheckBox"); tokensSnapWhileDraggingCheckBox = panel.getCheckBox("tokensSnapWhileDragging"); hideMousePointerWhileDraggingCheckBox = panel.getCheckBox("hideMousePointerWhileDragging"); + hideTokenStackIndicatorCheckBox = panel.getCheckBox("hideTokenStackIndicator"); newMapsVisibleCheckBox = panel.getCheckBox("newMapsVisibleCheckBox"); newTokensVisibleCheckBox = panel.getCheckBox("newTokensVisibleCheckBox"); stampsStartFreeSizeCheckBox = panel.getCheckBox("stampsStartFreeSize"); @@ -661,6 +663,10 @@ public void focusLost(FocusEvent e) { e -> AppPreferences.setHideMousePointerWhileDragging( hideMousePointerWhileDraggingCheckBox.isSelected())); + hideTokenStackIndicatorCheckBox.addActionListener( + e -> + AppPreferences.setHideTokenStackIndicator( + hideTokenStackIndicatorCheckBox.isSelected())); newMapsVisibleCheckBox.addActionListener( e -> AppPreferences.setNewMapsVisible(newMapsVisibleCheckBox.isSelected())); newTokensVisibleCheckBox.addActionListener( @@ -1138,6 +1144,7 @@ private void setInitialState() { tokensSnapWhileDraggingCheckBox.setSelected(AppPreferences.getTokensSnapWhileDragging()); hideMousePointerWhileDraggingCheckBox.setSelected( AppPreferences.getHideMousePointerWhileDragging()); + hideTokenStackIndicatorCheckBox.setSelected(AppPreferences.getHideTokenStackIndicator()); newMapsVisibleCheckBox.setSelected(AppPreferences.getNewMapsVisible()); newTokensVisibleCheckBox.setSelected(AppPreferences.getNewTokensVisible()); stampsStartFreeSizeCheckBox.setSelected(AppPreferences.getObjectsStartFreesize()); diff --git a/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialogView.form b/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialogView.form index b5f9adfecd..fef0e21d2e 100644 --- a/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialogView.form +++ b/src/main/java/net/rptools/maptool/client/ui/preferencesdialog/PreferencesDialogView.form @@ -35,7 +35,7 @@ - + @@ -323,14 +323,33 @@ + - + + + + + + + + + + + + + + + + + + + @@ -966,7 +985,7 @@ - + diff --git a/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java b/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java index fb971c650b..28c60a388f 100644 --- a/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java +++ b/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java @@ -3638,7 +3638,9 @@ protected void renderTokens( // Stacks if (!tokenList.isEmpty() && !tokenList.get(0).isStamp()) { // TODO: find a cleaner way to indicate token layer - if (tokenStackMap != null) { // FIXME Needed to prevent NPE but how can it be null? + boolean hideTSI = AppPreferences.getHideTokenStackIndicator(); + if (tokenStackMap != null + && !hideTSI) { // FIXME Needed to prevent NPE but how can it be null? for (Token token : tokenStackMap.keySet()) { Area bounds = getTokenBounds(token); if (bounds == null) { diff --git a/src/main/resources/net/rptools/maptool/language/i18n.properties b/src/main/resources/net/rptools/maptool/language/i18n.properties index 141c4b9182..f668593181 100644 --- a/src/main/resources/net/rptools/maptool/language/i18n.properties +++ b/src/main/resources/net/rptools/maptool/language/i18n.properties @@ -2822,4 +2822,6 @@ advanced.roll.variableNotNumber = Variable {0} is not a number. advanced.roll.unknownProperty = Unknown Property {0}. advanced.roll.propertyNotNumber = Property {0} is not a number. advanced.roll.noTokenInContext = No token in context. -advanced.roll.inputNotNumber = Input {0} is not a number. \ No newline at end of file +advanced.roll.inputNotNumber = Input {0} is not a number. +Preferences.label.tokens.stack.hide=Hide Token stack indicator +Preferences.label.tokens.stack.hide.tooltip=Token Layer stack inidicator will be hidden \ No newline at end of file