Merge pull request #2 from FreeCol/ticket/ir222

Create preference option to show region naming dialog
This commit is contained in:
David Lewis 2017-09-08 12:28:34 -07:00 committed by GitHub
commit bb2700d530
4 changed files with 28 additions and 10 deletions

View File

@ -210,6 +210,9 @@
<!-- Show the warnings about poor choice of tile worker. -->
<booleanOption id="model.option.guiShowNotBestTile"
defaultValue="true"/>
<!-- Show the Region Naming dialog -->
<booleanOption id="model.option.guiShowRegionNaming"
defaultValue="true"/>
<!-- Type of colony report. -->
<selectOption id="model.option.colonyReport"
defaultValue="0" localizedLabels="true">

View File

@ -1131,6 +1131,8 @@ model.option.guiShowPreCombat.name=Pre-combat analysis
model.option.guiShowPreCombat.shortDescription=Determines whether to show the pre-combat analysis.
model.option.guiShowNotBestTile.name=Not best tile
model.option.guiShowNotBestTile.shortDescription=Determines whether to warn about units not working on the best available tile.
model.option.guiShowRegionNaming.name=Region naming
model.option.guiShowRegionNaming.shortDescription=Display the Region Naming Dialog while exploring.
model.option.colonyReport.name=Colony Report
model.option.colonyReport.shortDescription=A summary of activity in each colony.
clientOptions.messages.colonyReport.classic.name=Classic

View File

@ -199,11 +199,11 @@ public class ClientOptions extends OptionGroup {
/** Whether to draw the fog of war on the minimap. */
public static final String MINIMAP_TOGGLE_FOG_OF_WAR
= "model.option.miniMapToggleFogOfWar";
/** Whether to draw the borders on the minimap. */
public static final String MINIMAP_TOGGLE_BORDERS
= "model.option.miniMapToggleBorders";
/** Style of map controls. */
public static final String MAP_CONTROLS
= "model.option.mapControls";
@ -290,6 +290,9 @@ public class ClientOptions extends OptionGroup {
public static final String SHOW_NOT_BEST_TILE
= "model.option.guiShowNotBestTile";
public static final String SHOW_REGION_NAMING
= "model.option.guiShowRegionNaming";
/** Option for selecting the compact colony report. */
public static final String COLONY_REPORT
= "model.option.colonyReport";
@ -399,7 +402,7 @@ public class ClientOptions extends OptionGroup {
/** Option to autoload sentried units. */
public static final String AUTOLOAD_SENTRIES
= "model.option.autoloadSentries";
/** Automatically end the turn when no units can be * made active. */
public static final String AUTO_END_TURN
= "model.option.autoEndTurn";
@ -696,7 +699,7 @@ public class ClientOptions extends OptionGroup {
public void fixClientOptions() {
// @compact 0.11.0
addBooleanOption(MINIMAP_TOGGLE_BORDERS,
"clientOptions.gui", true);
"clientOptions.gui", true);
addBooleanOption(MINIMAP_TOGGLE_FOG_OF_WAR,
"clientOptions.gui", true);
addTextOption(AUTO_SAVE_PREFIX,
@ -733,6 +736,11 @@ public class ClientOptions extends OptionGroup {
+ " option", e);
}
// end @compat 0.11.3
// @compat 0.11.6
addBooleanOption(SHOW_REGION_NAMING,
"clientOptions.messages", true);
// end @compat 0.11.6
}
private void addBooleanOption(String id, String gr, boolean val) {

View File

@ -4201,12 +4201,17 @@ public final class InGameController extends FreeColClientHolder {
}
newRegionName(region, tile, unit, name);
} else {
getGUI().showNamingDialog(StringTemplate
.template("nameRegion.text")
.addStringTemplate("%type%", region.getLabel()),
name, unit,
(String n) -> newRegionName(region, tile, unit,
(n == null || n.isEmpty()) ? name : n));
if (getClientOptions().getBoolean(ClientOptions.SHOW_REGION_NAMING)) {
getGUI().showNamingDialog(StringTemplate
.template("nameRegion.text")
.addStringTemplate("%type%", region.getLabel()),
name, unit,
(String n) -> newRegionName(region, tile, unit,
(n == null || n.isEmpty()) ? name : n));
} else {
newRegionName(region, tile, unit, name);
}
}
});
}