From 0d1dc01b7b9855282035719e979da48954e16f54 Mon Sep 17 00:00:00 2001 From: Kenneth VanderLinde Date: Wed, 20 Nov 2024 17:13:37 -0800 Subject: [PATCH 1/2] Add "Is landing map?" checkbox to map properties dialog --- .../MapPropertiesDialog.java | 16 +++++++++++++ .../MapPropertiesDialogView.form | 24 ++++++++++++++----- .../rptools/maptool/language/i18n.properties | 1 + 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialog.java b/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialog.java index 43b2394e45..4400a3ba73 100644 --- a/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialog.java +++ b/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialog.java @@ -273,6 +273,10 @@ public JComboBox getLightingStyleCombo() { return formPanel.getComboBox("lightingStyle"); } + public JCheckBox getIsLandingMapCheckBox() { + return formPanel.getCheckBox("isLandingMap"); + } + public JComboBox getAStarRoundingOptionsComboBox() { return formPanel.getComboBox("aStarRoundingOptionsComboBox"); } @@ -283,6 +287,8 @@ public void setZone(Zone zone) { } private void copyZoneToUI() { + var campaign = MapTool.getClient().getCampaign(); + getNameTextField().setText(zone.getName()); getPlayerAliasTextField().setText(zone.getPlayerAlias()); // Localizes units per cell, using the proper separator. Fixes #507. @@ -297,6 +303,7 @@ private void copyZoneToUI() { getVisionTypeCombo().setSelectedItem(zone.getVisionType()); getLightingStyleCombo().setSelectedItem(zone.getLightingStyle()); getAStarRoundingOptionsComboBox().setSelectedItem(zone.getAStarRounding()); + getIsLandingMapCheckBox().setSelected(zone.getId().equals(campaign.getLandingMapId())); gridOffsetX = zone.getGrid().getOffsetX(); gridOffsetY = zone.getGrid().getOffsetY(); @@ -324,6 +331,15 @@ private void copyUIToZone() { zone.setFogPaint(fogPaint); zone.setBackgroundPaint(backgroundPaint); zone.setMapAsset(mapAsset != null ? mapAsset.getMD5Key() : null); + + var campaign = MapTool.getClient().getCampaign(); + if (getIsLandingMapCheckBox().isSelected()) { + campaign.setLandingMapId(zone.getId()); + } else if (zone.getId().equals(campaign.getLandingMapId())) { + // This zone was the landing map but got toggled off. + campaign.setLandingMapId(null); + } + // TODO: Handle grid type changes } diff --git a/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form b/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form index de7f9fae2c..e45a82a2c9 100644 --- a/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form +++ b/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form @@ -3,14 +3,14 @@ - + - + @@ -341,11 +341,23 @@ - + - + - + + + + + + + + + + + + + @@ -455,4 +467,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/net/rptools/maptool/language/i18n.properties b/src/main/resources/net/rptools/maptool/language/i18n.properties index 3262d84ec1..e3c59a87b0 100644 --- a/src/main/resources/net/rptools/maptool/language/i18n.properties +++ b/src/main/resources/net/rptools/maptool/language/i18n.properties @@ -374,6 +374,7 @@ EditTokenDialog.libTokenURI.error.reserved = lib:Tokens can not be named {0 MapPropertiesDialog.label.playerMapAlias = Display Name: MapPropertiesDialog.label.playerMapAlias.tooltip = This is how players will see the map identified. Must be unique within campaign. MapPropertiesDialog.label.Name.tooltip = This is how the map is referred to in macros and is only visible to the GM. +MapPropertiesDialog.label.landingMap = Is landing map? MapPropertiesDialog.label.cell.type = Cell Type: MapPropertiesDialog.label.cell.dist = Distance per cell: MapPropertiesDialog.label.cell.pixels = Pixels per Cell: From 5f4c61b6e296b1b48a8843d5e4336677b4cdd915 Mon Sep 17 00:00:00 2001 From: Kenneth VanderLinde Date: Wed, 20 Nov 2024 17:36:21 -0800 Subject: [PATCH 2/2] Add missing tooltip --- .../client/ui/mappropertiesdialog/MapPropertiesDialogView.form | 1 + src/main/resources/net/rptools/maptool/language/i18n.properties | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form b/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form index e45a82a2c9..ab45304198 100644 --- a/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form +++ b/src/main/java/net/rptools/maptool/client/ui/mappropertiesdialog/MapPropertiesDialogView.form @@ -347,6 +347,7 @@ + diff --git a/src/main/resources/net/rptools/maptool/language/i18n.properties b/src/main/resources/net/rptools/maptool/language/i18n.properties index e3c59a87b0..c4f57a1587 100644 --- a/src/main/resources/net/rptools/maptool/language/i18n.properties +++ b/src/main/resources/net/rptools/maptool/language/i18n.properties @@ -375,6 +375,7 @@ MapPropertiesDialog.label.playerMapAlias = Display Name: MapPropertiesDialog.label.playerMapAlias.tooltip = This is how players will see the map identified. Must be unique within campaign. MapPropertiesDialog.label.Name.tooltip = This is how the map is referred to in macros and is only visible to the GM. MapPropertiesDialog.label.landingMap = Is landing map? +MapPropertiesDialog.label.landingMap.tooltip = Make this map the first one that players see when they connect. MapPropertiesDialog.label.cell.type = Cell Type: MapPropertiesDialog.label.cell.dist = Distance per cell: MapPropertiesDialog.label.cell.pixels = Pixels per Cell: