Skip to content

Commit

Permalink
Merge pull request #5064 from kwvanderlinde/feature/75-landing-map--o…
Browse files Browse the repository at this point in the history
…ption-in-edit-map-dialog

Add "Is landing map?" checkbox to map properties dialog
  • Loading branch information
cwisniew authored Nov 21, 2024
2 parents 1e8174c + 5f4c61b commit c66ed4b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ public JComboBox<Zone.LightingStyle> getLightingStyleCombo() {
return formPanel.getComboBox("lightingStyle");
}

public JCheckBox getIsLandingMapCheckBox() {
return formPanel.getCheckBox("isLandingMap");
}

public JComboBox getAStarRoundingOptionsComboBox() {
return formPanel.getComboBox("aStarRoundingOptionsComboBox");
}
Expand All @@ -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.
Expand All @@ -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();
Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<grid id="775b6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="5" bottom="5" right="5"/>
<constraints>
<xy x="10" y="10" width="813" height="401"/>
<xy x="10" y="10" width="813" height="422"/>
</constraints>
<properties>
<name value="root"/>
</properties>
<border type="none"/>
<children>
<grid id="aa2a3" layout-manager="GridLayoutManager" row-count="10" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="aa2a3" layout-manager="GridLayoutManager" row-count="10" column-count="6" same-size-horizontally="false" same-size-vertically="true" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
Expand Down Expand Up @@ -341,11 +341,24 @@
<name value="lightingStyle"/>
</properties>
</component>
<vspacer id="fe121">
<component id="52be" class="javax.swing.JLabel">
<constraints>
<grid row="9" column="5" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<properties>
<text resource-bundle="net/rptools/maptool/language/i18n" key="MapPropertiesDialog.label.landingMap"/>
<toolTipText resource-bundle="net/rptools/maptool/language/i18n" key="MapPropertiesDialog.label.landingMap.tooltip"/>
</properties>
</component>
<component id="f6573" class="javax.swing.JCheckBox" default-binding="true">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<name value="isLandingMap"/>
<text value=""/>
</properties>
</component>
</children>
</grid>
<grid id="218f9" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
Expand Down Expand Up @@ -455,4 +468,4 @@
<member id="ef506"/>
</group>
</buttonGroups>
</form>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ 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.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:
Expand Down

0 comments on commit c66ed4b

Please sign in to comment.