Revision: 5195
http://vassalengine.svn.sourceforge.net/vassalengine/?rev=5195&view=rev
Author: mkiefte
Date: 2009-03-02 11:37:04 +0000 (Mon, 02 Mar 2009)
Log Message:
-----------
Merged up to r5194.
Modified Paths:
--------------
VASSAL-src/branches/mkiefte-3.2/Makefile
VASSAL-src/branches/mkiefte-3.2/dist/macosx/VASSAL.icns
VASSAL-src/branches/mkiefte-3.2/dist/windows/VASSAL.ico
VASSAL-src/branches/mkiefte-3.2/dist/windows/nsis/installer.nsi
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/GameModule.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/BasicLogger.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/DoActionButton.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/Map.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/documentation/AboutScreen.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DeckGlobalKeyCommand.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DrawPile.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/ImageSaver.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/MassKeyCommand.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/SetupStack.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/metadata/SaveMetaData.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/ListTurnLevel.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnLevel.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnTracker.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ServerStatus.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/SimpleRoom.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/RoomTreeRenderer.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/ServerStatusView.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/CounterGlobalKeyCommand.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Deck.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/DynamicProperty.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Embellishment.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/FreeRotator.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/GlobalCommand.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/SubMenu.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/BundleHelper.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/ComponentI18nData.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Editor.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Localization.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL_de.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL_es.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL_fr.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL_it.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL_ja.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL_nl.properties
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/launch/AbstractLaunchAction.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/launch/BasicModule.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/tools/ErrorDialog.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/tools/imports/adc2/MapBoard.java
VASSAL-src/branches/mkiefte-3.2/src/icons/32x32/VASSAL.png
Added Paths:
-----------
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/tools/RecursionLimitException.java
VASSAL-src/branches/mkiefte-3.2/src/VASSAL/tools/RecursionLimiter.java
Modified: VASSAL-src/branches/mkiefte-3.2/Makefile
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/Makefile 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/Makefile 2009-03-02 11:37:04 UTC (rev 5195)
@@ -48,8 +48,8 @@
VNUM:=3.2.0
SVNVERSION:=$(shell svnversion | perl -pe 's/(\d+:)?(\d+[MS]?)/$$2/; s/(\d+)M/$$1+1/e')
-VERSION:=$(VNUM)-svn$(SVNVERSION)
-#VERSION:=$(VNUM)-beta5
+#VERSION:=$(VNUM)-svn$(SVNVERSION)
+VERSION:=$(VNUM)
#CLASSPATH:=$(CLASSDIR):$(LIBDIR)/*
@@ -63,7 +63,7 @@
JAR:=$(JAVAPATH)/jar
JDOC:=$(JAVAPATH)/javadoc
-NSIS:=PATH=$$PATH:~/java/nsis/bin makensis
+NSIS:=PATH=$$PATH:~/java/nsis makensis
LAUNCH4J:=~/java/launch4j/launch4j
@@ -159,7 +159,7 @@
$(TMPDIR)/VASSAL-$(VERSION)-macosx.dmg: $(TMPDIR)/VASSAL-$(VERSION).app
genisoimage -V VASSAL-$(VERSION) -r -apple -root VASSAL-$(VERSION).app -o $@ $<
-$(TMPDIR)/VASSAL-$(VERSION)-generic.zip: version all $(JARS)
+$(TMPDIR)/VASSAL-$(VERSION)-other.zip: version all $(JARS)
mkdir -p $(TMPDIR)/VASSAL-$(VERSION)
svn export $(DOCDIR) $(TMPDIR)/VASSAL-$(VERSION)/doc
svn export $(LIBDIR) $(TMPDIR)/VASSAL-$(VERSION)/lib
@@ -168,7 +168,10 @@
cp dist/VASSAL.sh dist/windows/VASSAL.bat $(TMPDIR)/VASSAL-$(VERSION)
cd $(TMPDIR) ; zip -9rv $(notdir $@) VASSAL-$(VERSION) ; cd ..
-$(TMPDIR)/VASSAL-$(VERSION)-windows.exe: version release-generic $(TMPDIR)/VASSAL.exe
+$(TMPDIR)/VASSAL-$(VERSION)-linux.zip: $(TMPDIR)/VASSAL-$(VERSION)-other.zip
+ cp $< $@
+
+$(TMPDIR)/VASSAL-$(VERSION)-windows.exe: version release-other $(TMPDIR)/VASSAL.exe
rm $(TMPDIR)/VASSAL-$(VERSION)/VASSAL.sh
cp $(TMPDIR)/VASSAL.exe $(TMPDIR)/VASSAL-$(VERSION)
for i in `find $(TMPDIR)/VASSAL-$(VERSION) -type d` ; do \
@@ -186,15 +189,17 @@
svn export . $(TMPDIR)/VASSAL-$(VERSION)-src
cd $(TMPDIR) ; zip -9rv $(notdir $@) VASSAL-$(VERSION)-src ; cd ..
+release-linux: $(TMPDIR)/VASSAL-$(VERSION)-linux.zip
+
release-macosx: $(TMPDIR)/VASSAL-$(VERSION)-macosx.dmg
release-windows: $(TMPDIR)/VASSAL-$(VERSION)-windows.exe
-release-generic: $(TMPDIR)/VASSAL-$(VERSION)-generic.zip
+release-other: $(TMPDIR)/VASSAL-$(VERSION)-other.zip
release-src: $(TMPDIR)/VASSAL-$(VERSION)-src.zip
-release: clean release-generic release-windows release-macosx
+release: clean release-other release-linux release-windows release-macosx
clean-release:
$(RM) -r $(TMPDIR)/* $(LIBDIR)/Vengine.jar
@@ -211,4 +216,4 @@
clean: clean-release
$(RM) -r $(CLASSDIR)/*
-.PHONY: all fast-compile clean release release-macosx release-windows release-generic clean-release i18n icons images help javadoc clean-javadoc version
+.PHONY: all fast-compile clean release release-linux release-macosx release-windows release-other clean-release i18n icons images help javadoc clean-javadoc version
Modified: VASSAL-src/branches/mkiefte-3.2/dist/macosx/VASSAL.icns
===================================================================
(Binary files differ)
Modified: VASSAL-src/branches/mkiefte-3.2/dist/windows/VASSAL.ico
===================================================================
(Binary files differ)
Modified: VASSAL-src/branches/mkiefte-3.2/dist/windows/nsis/installer.nsi
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/dist/windows/nsis/installer.nsi 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/dist/windows/nsis/installer.nsi 2009-03-02 11:37:04 UTC (rev 5195)
@@ -738,7 +738,7 @@
; create the shortcuts
; don't use version number in shortcut names for Standard install
${If} $CustomSetup == 1
- StrCpy $0 "VASSAL-${VERSION}"
+ StrCpy $0 "VASSAL ${VERSION}"
${Else}
StrCpy $0 "VASSAL"
${EndIf}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/GameModule.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/GameModule.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/GameModule.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -79,6 +79,8 @@
import VASSAL.configure.CompoundValidityChecker;
import VASSAL.configure.MandatoryComponent;
import VASSAL.counters.GamePiece;
+import VASSAL.i18n.ComponentI18nData;
+import VASSAL.i18n.Localization;
import VASSAL.i18n.Resources;
import VASSAL.launch.PlayerWindow;
import VASSAL.preferences.Prefs;
@@ -122,6 +124,7 @@
protected String moduleVersion = "0.0"; //$NON-NLS-1$
protected String vassalVersionCreated = "0.0"; //$NON-NLS-1$
protected String gameName = DEFAULT_NAME;
+ protected String localizedGameName = null;
protected String description = "";
protected String lastSavedConfiguration;
protected FileChooser fileChooser;
@@ -173,6 +176,10 @@
return frame;
}
+ public void initFrameTitle() {
+ frame.setTitle(getLocalizedGameName());
+ }
+
public WizardSupport getWizardSupport() {
if (wizardSupport == null) {
wizardSupport = new WizardSupport();
@@ -209,8 +216,13 @@
public void setAttribute(String name, Object value) {
if (MODULE_NAME.equals(name)) {
- gameName = (String) value;
- setConfigureName(gameName);
+ if (Localization.getInstance().isTranslationInProgress()) {
+ localizedGameName = (String) value;
+ }
+ else {
+ gameName = (String) value;
+ }
+ setConfigureName((String) value);
}
else if (MODULE_VERSION.equals(name)) {
moduleVersion = (String) value;
@@ -379,6 +391,10 @@
public String getGameName() {
return gameName;
}
+
+ public String getLocalizedGameName() {
+ return localizedGameName == null ? gameName : localizedGameName;
+ }
public String getGameVersion() {
return moduleVersion;
@@ -613,7 +629,7 @@
*/
public void appendToTitle(String s) {
if (s == null) {
- frame.setTitle(Resources.getString("GameModule.frame_title", gameName)); //$NON-NLS-1$
+ frame.setTitle(Resources.getString("GameModule.frame_title", getLocalizedGameName())); //$NON-NLS-1$
}
else {
frame.setTitle(frame.getTitle() + s);
@@ -992,4 +1008,10 @@
return 0L;
}
}
+
+ public ComponentI18nData getI18nData() {
+ ComponentI18nData myI18nData = super.getI18nData();
+ myI18nData.setAttributeTranslatable(MODULE_VERSION, false);
+ return myI18nData;
+ }
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/BasicLogger.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/BasicLogger.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/BasicLogger.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -72,6 +72,7 @@
public static final String PROMPT_NEW_LOG = "PromptNewLog"; //$NON-NLS-1$
public static final String PROMPT_NEW_LOG_START = "PromptNewLogStart"; //$NON-NLS-1$
public static final String PROMPT_NEW_LOG_END = "PromptNewLogEnd"; //$NON-NLS-1$
+ public static final String PROMPT_LOG_COMMENT = "promptLogComment"; //$NON-NLS-1$
protected static final String STEP_ICON = "/images/StepForward16.gif"; //$NON-NLS-1$
protected static final String UNDO_ICON = "/images/Undo16.gif"; //$NON-NLS-1$
protected List<Command> logInput;
@@ -169,6 +170,9 @@
BooleanConfigurer logOptionEnd = new BooleanConfigurer(PROMPT_NEW_LOG_END, Resources.getString("BasicLogger.prompt_new_log_after"), Boolean.TRUE); //$NON-NLS-1$
mod.getPrefs().addOption(Resources.getString("Prefs.general_tab"), logOptionEnd); //$NON-NLS-1$
+
+ BooleanConfigurer logOptionComment = new BooleanConfigurer(PROMPT_LOG_COMMENT, Resources.getString("BasicLogger.enable_comments"), Boolean.TRUE); //$NON-NLS-1$
+ mod.getPrefs().addOption(Resources.getString("Prefs.general_tab"), logOptionComment); //$NON-NLS-1$
}
public Element getBuildElement(Document doc) {
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/DoActionButton.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/DoActionButton.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/DoActionButton.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -47,13 +47,15 @@
import VASSAL.tools.ErrorDialog;
import VASSAL.tools.FormattedString;
import VASSAL.tools.LaunchButton;
+import VASSAL.tools.RecursionLimiter;
+import VASSAL.tools.RecursionLimitException;
import VASSAL.tools.SequenceEncoder;
-import VASSAL.tools.ThrowableUtils;
/**
* This component places a button into the controls window toolbar.
* Pressing the button displays a message, plays a sound and/or sends hotkeys */
-public class DoActionButton extends AbstractConfigurable {
+public class DoActionButton extends AbstractConfigurable
+ implements RecursionLimiter.Loopable {
public static final String BUTTON_TEXT = "text"; //$NON-NLS-1$
public static final String TOOLTIP = "tooltip"; //$NON-NLS-1$
@@ -69,33 +71,25 @@
protected LaunchButton launch;
protected boolean doReport = false;
- protected FormattedString reportFormat = new FormattedString(GameModule.getGameModule());
+ protected FormattedString reportFormat =
+ new FormattedString(GameModule.getGameModule());
protected boolean doSound = false;
protected String soundClip = "";
protected boolean doHotkey = false;
protected List<KeyStroke> hotkeys = new ArrayList<KeyStroke>();
- // Detect looping Action Buttons
- protected static final int RECURSION_LIMIT = 50;
- protected static int recursionDepth = 0;
-
public DoActionButton() {
ActionListener rollAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
execute();
}
- catch (InfiniteLoopException ex) {
- ErrorDialog.showDetails(
- ex,
- ThrowableUtils.getStackTrace(ex),
- "Error.infinite_loop",
- getConfigureTypeName(),
- getConfigureName()
- );
+ catch (RecursionLimitException ex) {
+ ErrorDialog.infiniteLoop(ex);
}
}
};
+
launch = new LaunchButton(
"Do Action", TOOLTIP, BUTTON_TEXT, HOTKEY, ICON, rollAction);
setAttribute(NAME, "Do Action");
@@ -157,7 +151,7 @@
}
}
- public static class HotkeyConfig implements TranslatableConfigurerFactory {
+ public static class HotkeyConfig implements ConfigurerFactory {
public Configurer getConfigurer(AutoConfigurable c, String key, String name) {
return new HotkeyListConfigurer(key, name, ((DoActionButton) c).hotkeys);
}
@@ -329,11 +323,9 @@
return HelpFile.getReferenceManualPage("MessageButton.htm"); //$NON-NLS-1$
}
- protected void execute() throws InfiniteLoopException {
+ protected void execute() throws RecursionLimitException {
try {
- if (++recursionDepth > RECURSION_LIMIT) {
- throw new InfiniteLoopException();
- }
+ RecursionLimiter.startExecution(this);
final Command c = new NullCommand();
if (doReport) {
@@ -360,11 +352,16 @@
GameModule.getGameModule().sendAndLog(c);
}
finally {
- --recursionDepth;
+ RecursionLimiter.endExecution();
}
}
+
+ // Implement Loopable
+ public String getComponentTypeName () {
+ return getConfigureTypeName();
+ }
- private static class InfiniteLoopException extends Exception {
- private static final long serialVersionUID = 1L;
+ public String getComponentName() {
+ return getConfigureName();
}
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/Map.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/Map.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/Map.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -1898,7 +1898,7 @@
}
protected String getDefaultWindowTitle() {
- return getLocalizedMapName().length() > 0 ? getLocalizedMapName() : Resources.getString("Map.window_title", GameModule.getGameModule().getGameName()); //$NON-NLS-1$
+ return getLocalizedMapName().length() > 0 ? getLocalizedMapName() : Resources.getString("Map.window_title", GameModule.getGameModule().getLocalizedGameName()); //$NON-NLS-1$
}
/**
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/documentation/AboutScreen.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/documentation/AboutScreen.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/documentation/AboutScreen.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -84,7 +84,7 @@
sb.append(
Resources.getString("AboutScreen.module_version", //$NON-NLS-1$
- g.getGameName(), g.getGameVersion()));
+ g.getLocalizedGameName(), g.getGameVersion()));
for (ModuleExtension ext : g.getComponentsOf(ModuleExtension.class)) {
sb.append("<br/>").append(
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DeckGlobalKeyCommand.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DeckGlobalKeyCommand.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DeckGlobalKeyCommand.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -35,6 +35,7 @@
import VASSAL.counters.GlobalCommand;
import VASSAL.counters.KeyCommand;
import VASSAL.counters.PieceFilter;
+import VASSAL.tools.RecursionLimiter.Loopable;
import VASSAL.tools.SequenceEncoder;
/**
@@ -44,7 +45,7 @@
public class DeckGlobalKeyCommand extends MassKeyCommand {
public DeckGlobalKeyCommand() {
- globalCommand = new DeckGlobalCommand();
+ globalCommand = new DeckGlobalCommand(this);
setConfigureName("");
}
@@ -72,7 +73,7 @@
}
public KeyCommand getKeyCommand(Deck deck) {
- return new DeckKeyCommand(getConfigureName(), null, deck);
+ return new DeckKeyCommand(getLocalizedConfigureName(), null, deck);
}
class DeckKeyCommand extends KeyCommand {
@@ -108,7 +109,8 @@
.append(getAttributeValueString(KEY_COMMAND))
.append(getAttributeValueString(PROPERTIES_FILTER))
.append(getAttributeValueString(DECK_COUNT))
- .append(getAttributeValueString(REPORT_FORMAT));
+ .append(getAttributeValueString(REPORT_FORMAT))
+ .append(getLocalizedConfigureName());
return se.getValue();
}
@@ -119,6 +121,7 @@
setAttribute(PROPERTIES_FILTER, sd.nextToken(null));
setAttribute(DECK_COUNT, sd.nextInt(0));
setAttribute(REPORT_FORMAT, sd.nextToken(""));
+ localizedName = sd.nextToken(getConfigureName());
}
public String[] getAttributeDescriptions() {
@@ -161,6 +164,11 @@
}
public static class DeckGlobalCommand extends GlobalCommand {
+
+ public DeckGlobalCommand(Loopable l) {
+ super(l);
+ }
+
public Command apply(Deck d, PieceFilter filter) {
String reportText = reportFormat.getText();
Command c;
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DrawPile.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DrawPile.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/DrawPile.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -49,6 +49,7 @@
import VASSAL.counters.Deck;
import VASSAL.counters.GamePiece;
import VASSAL.counters.Stack;
+import VASSAL.i18n.ComponentI18nData;
import VASSAL.i18n.TranslatableConfigurerFactory;
import VASSAL.tools.UniqueIdManager;
@@ -666,4 +667,12 @@
public static String getConfigureTypeName() {
return "Deck";
}
+
+ public ComponentI18nData getI18nData() {
+ ComponentI18nData myI18nData = super.getI18nData();
+ myI18nData.setAttributeTranslatable(SELECT_DISPLAY_PROPERTY, false);
+ myI18nData.setAttributeTranslatable(SELECT_SORT_PROPERTY, false);
+ return myI18nData;
+ }
}
+
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/ImageSaver.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/ImageSaver.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/ImageSaver.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -166,7 +166,7 @@
// prompt user for image filename
final FileChooser fc = GameModule.getGameModule().getFileChooser();
fc.setSelectedFile(new File(fc.getCurrentDirectory(),
- GameModule.getGameModule().getGameName() + "Map.png"));
+ GameModule.getGameModule().getLocalizedGameName() + "Map.png"));
final Frame frame =
(Frame) SwingUtilities.getAncestorOfClass(Frame.class, map.getView());
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/MassKeyCommand.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/MassKeyCommand.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/MassKeyCommand.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -32,10 +32,12 @@
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.Box;
import javax.swing.JLabel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
+
import VASSAL.build.AbstractConfigurable;
import VASSAL.build.AutoConfigurable;
import VASSAL.build.Buildable;
@@ -62,13 +64,15 @@
import VASSAL.i18n.TranslatableConfigurerFactory;
import VASSAL.tools.FormattedString;
import VASSAL.tools.LaunchButton;
+import VASSAL.tools.RecursionLimiter;
import VASSAL.tools.ToolBarComponent;
/**
* Adds a button to a map window toolbar. Hitting the button applies a particular key command to all pieces on that map
* with a given name.
*/
-public class MassKeyCommand extends AbstractConfigurable {
+public class MassKeyCommand extends AbstractConfigurable
+ implements RecursionLimiter.Loopable {
public static final String DEPRECATED_NAME = "text";
public static final String NAME = "name";
public static final String ICON = "icon";
@@ -97,7 +101,7 @@
protected PropertySource propertySource;
protected PieceFilter filter;
protected Map map;
- protected GlobalCommand globalCommand = new GlobalCommand();
+ protected GlobalCommand globalCommand = new GlobalCommand(this);
protected FormattedString reportFormat = new FormattedString();
public MassKeyCommand() {
@@ -502,4 +506,13 @@
}
}
+ // Implement Loopable
+ public String getComponentName() {
+ return getConfigureName();
+ }
+
+ public String getComponentTypeName() {
+ return getConfigureTypeName();
+ }
+
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/SetupStack.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/SetupStack.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/map/SetupStack.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -96,6 +96,7 @@
import VASSAL.counters.PieceCloner;
import VASSAL.counters.Properties;
import VASSAL.counters.Stack;
+import VASSAL.i18n.ComponentI18nData;
import VASSAL.i18n.Resources;
import VASSAL.tools.AdjustableSpeedScrollPane;
import VASSAL.tools.ErrorDialog;
@@ -849,6 +850,12 @@
}
}
+
+ public ComponentI18nData getI18nData() {
+ ComponentI18nData myI18nData = super.getI18nData();
+ myI18nData.setAttributeTranslatable(LOCATION, false);
+ return myI18nData;
+ }
// FIXME: check for duplication with PieceMover
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/metadata/SaveMetaData.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/metadata/SaveMetaData.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/metadata/SaveMetaData.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -48,23 +48,27 @@
public static final String ZIP_ENTRY_NAME = "savedata";
public static final String DATA_VERSION = "1";
-
+ public static final String PROMPT_LOG_COMMENT = "promptLogComment";
+
protected ModuleMetaData moduleData;
public SaveMetaData() {
super();
- final String comments = (String) JOptionPane.showInputDialog(
- GameModule.getGameModule().getFrame(),
- Resources.getString("BasicLogger.enter_comments"),
- Resources.getString("BasicLogger.log_file_comments"),
- JOptionPane.PLAIN_MESSAGE,
- null,
- null,
- ""
- );
+ String comments = "";
+ if ( (Boolean)GameModule.getGameModule().getPrefs().getValue( PROMPT_LOG_COMMENT )){
+ comments = (String) JOptionPane.showInputDialog(
+ GameModule.getGameModule().getFrame(),
+ Resources.getString("BasicLogger.enter_comments"),
+ Resources.getString("BasicLogger.log_file_comments"),
+ JOptionPane.PLAIN_MESSAGE,
+ null,
+ null,
+ ""
+ );
- setDescription(new Attribute(DESCRIPTION_ELEMENT, comments));
+ setDescription(new Attribute(DESCRIPTION_ELEMENT, comments));
+ }
}
public SaveMetaData(ZipFile zip) {
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/ListTurnLevel.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/ListTurnLevel.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/ListTurnLevel.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -39,6 +39,7 @@
import VASSAL.configure.StringArrayConfigurer;
import VASSAL.configure.StringEnumConfigurer;
import VASSAL.configure.VisibilityCondition;
+import VASSAL.i18n.ComponentI18nData;
import VASSAL.i18n.Resources;
import VASSAL.tools.ArrayUtils;
import VASSAL.tools.FormattedString;
@@ -443,4 +444,11 @@
pack();
}
}
+
+ public ComponentI18nData getI18nData() {
+ ComponentI18nData myI18nData = super.getI18nData();
+ myI18nData.setAttributeTranslatable(LIST, true);
+ return myI18nData;
+ }
+
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnLevel.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnLevel.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnLevel.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -39,9 +39,10 @@
import VASSAL.build.GameModule;
import VASSAL.build.module.properties.MutableProperty;
import VASSAL.configure.Configurer;
-import VASSAL.configure.ConfigurerFactory;
import VASSAL.configure.FormattedStringConfigurer;
import VASSAL.configure.StringEnumConfigurer;
+import VASSAL.i18n.ComponentI18nData;
+import VASSAL.i18n.TranslatableConfigurerFactory;
import VASSAL.tools.FormattedString;
public abstract class TurnLevel extends TurnComponent {
@@ -355,15 +356,19 @@
myValue.removeFromContainer();
}
- @SuppressWarnings("unchecked")
- public Class[] getAllowableConfigureComponents() {
+ public Class<?>[] getAllowableConfigureComponents() {
return new Class[] { CounterTurnLevel.class, ListTurnLevel.class };
}
- public static class TurnFormatConfig implements ConfigurerFactory {
+ public static class TurnFormatConfig implements TranslatableConfigurerFactory {
public Configurer getConfigurer(AutoConfigurable c, String key, String name) {
return new FormattedStringConfigurer(key, name, new String[] { LEVEL_VALUE });
}
}
+ public ComponentI18nData getI18nData() {
+ ComponentI18nData myI18nData = super.getI18nData();
+ myI18nData.setAttributeTranslatable(PROP, false);
+ return myI18nData;
+ }
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnTracker.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnTracker.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/build/module/turn/TurnTracker.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -73,6 +73,7 @@
import VASSAL.configure.StringEnumConfigurer;
import VASSAL.configure.VisibilityCondition;
import VASSAL.i18n.Resources;
+import VASSAL.i18n.TranslatableConfigurerFactory;
import VASSAL.tools.FormattedString;
import VASSAL.tools.IconButton;
import VASSAL.tools.KeyStrokeListener;
@@ -447,7 +448,7 @@
}
}
- public static class TurnFormatConfig implements ConfigurerFactory {
+ public static class TurnFormatConfig implements TranslatableConfigurerFactory {
public Configurer getConfigurer(AutoConfigurable c, String key, String name) {
TurnTracker t = (TurnTracker) c;
String s[] = new String[t.getLevelCount()];
@@ -458,7 +459,7 @@
}
}
- public static class ReportFormatConfig implements ConfigurerFactory {
+ public static class ReportFormatConfig implements TranslatableConfigurerFactory {
public Configurer getConfigurer(AutoConfigurable c, String key, String name) {
return new PlayerIdFormattedStringConfigurer(key, name, new String[] {OLD_TURN, NEW_TURN } );
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ServerStatus.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ServerStatus.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ServerStatus.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -54,6 +54,10 @@
return moduleName;
}
+ public void setModuleName( String moduleName ) {
+ this.moduleName = moduleName;
+ }
+
public void addRoom(Room r) {
rooms.put(r.getName(), r);
}
@@ -66,6 +70,15 @@
return rooms.values().toArray(new Room[rooms.size()]);
}
+ public int numPlayers(){
+ Room[] roomsArray = getRooms();
+ int n=0;
+ for (int i = 0; i < roomsArray.length; ++i) {
+ n += ((SimpleRoom)roomsArray[i]).numPlayers();
+ }
+ return n;
+ }
+
public String toString() {
return moduleName;
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/SimpleRoom.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/SimpleRoom.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/SimpleRoom.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -84,6 +84,10 @@
return name;
}
+ public int numPlayers() {
+ return players.size();
+ }
+
public int hashCode() {
return name.hashCode();
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/RoomTreeRenderer.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/RoomTreeRenderer.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/RoomTreeRenderer.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -75,9 +75,7 @@
}
else if (value instanceof SimpleRoom) {
List<Player> players = ((Room) value).getPlayerList();
- if (!expanded || players.size() == 0) {
- setText(getText() + " [" + players.size() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ setText(getText() + " (" + players.size() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
return this;
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/ServerStatusView.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/ServerStatusView.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/chat/ui/ServerStatusView.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -259,9 +259,18 @@
Object[] children = null;
if (o instanceof ServerStatus.ModuleSummary) {
children = ((ServerStatus.ModuleSummary) o).getRooms();
+
+ int players = ((ServerStatus.ModuleSummary) o).numPlayers();
+ String moduleName = new String(((ServerStatus.ModuleSummary) o).getModuleName()+ " ("+players+")");
+ ((ServerStatus.ModuleSummary) o).setModuleName( moduleName );
}
else if (o instanceof SimpleRoom) {
List<Player> l = ((Room)o).getPlayerList();
+
+ // append the number of players to each room name
+ String roomName = new String(((SimpleRoom) o).getName()+" ("+l.size()+")");
+ ((SimpleRoom) o).setName( roomName );
+
children = l.toArray(new Player[l.size()]);
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/CounterGlobalKeyCommand.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/CounterGlobalKeyCommand.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/CounterGlobalKeyCommand.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -47,18 +47,21 @@
import VASSAL.i18n.PieceI18nData;
import VASSAL.i18n.Resources;
import VASSAL.i18n.TranslatablePiece;
+import VASSAL.tools.RecursionLimiter;
import VASSAL.tools.SequenceEncoder;
/**
* Adds a menu item that applies a {@link GlobalCommand} to other pieces
*/
-public class CounterGlobalKeyCommand extends Decorator implements TranslatablePiece {
+public class CounterGlobalKeyCommand extends Decorator
+ implements TranslatablePiece,
+ RecursionLimiter.Loopable {
public static final String ID = "globalkey;";
protected KeyCommand[] command;
protected String commandName;
protected KeyStroke key;
protected KeyStroke globalKey;
- protected GlobalCommand globalCommand = new GlobalCommand();
+ protected GlobalCommand globalCommand = new GlobalCommand(this);
protected PropertyExpression propertiesFilter = new PropertyExpression();
protected boolean restrictRange;
protected boolean fixedRange = true;
@@ -302,4 +305,13 @@
}
}
+ // Implement Loopable
+ public String getComponentName() {
+ return Decorator.getOutermost(this).getLocalizedName();
+ }
+
+ public String getComponentTypeName() {
+ return getDescription();
+ }
+
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Deck.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Deck.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Deck.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -122,7 +122,7 @@
new ArrayList<MutableProperty.Impl>();
protected String deckName;
- protected String untranslatedDeckName;
+ protected String localizedDeckName;
protected boolean faceDown;
protected int dragCount = 0;
@@ -515,9 +515,11 @@
public void setDeckName(String n) {
if (Localization.getInstance().isTranslationInProgress()) {
- untranslatedDeckName = deckName;
+ localizedDeckName = n;
}
- deckName = n;
+ else {
+ deckName = n;
+ }
countProperty.setPropertyName(deckName+"_numPieces");
for (int i=0;i<countExpressions.length;++i) {
expressionProperties.get(i).setPropertyName(
@@ -526,11 +528,11 @@
}
public String getDeckName() {
- return untranslatedDeckName == null ? deckName : untranslatedDeckName;
+ return deckName;
}
public String getLocalizedDeckName() {
- return deckName;
+ return localizedDeckName == null ? deckName : localizedDeckName;
}
/**
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/DynamicProperty.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/DynamicProperty.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/DynamicProperty.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -70,7 +70,7 @@
protected FormattedString format = new FormattedString();
protected DynamicKeyCommand[] keyCommands;
- protected DynamicKeyCommand[] menuCommands;
+ protected KeyCommand[] menuCommands;
protected ListConfigurer keyCommandListConfig;
@@ -89,20 +89,22 @@
}
public void mySetType(String s) {
- SequenceEncoder.Decoder sd = new SequenceEncoder.Decoder(s, ';');
+ final SequenceEncoder.Decoder sd = new SequenceEncoder.Decoder(s, ';');
sd.nextToken(); // Skip over command prefix
key = sd.nextToken("name");
decodeConstraints(sd.nextToken(""));
keyCommandListConfig.setValue(sd.nextToken(""));
keyCommands = keyCommandListConfig.getListValue().toArray(
new DynamicKeyCommand[keyCommandListConfig.getListValue().size()]);
- ArrayList<DynamicKeyCommand> l = new ArrayList<DynamicKeyCommand>();
+
+ final ArrayList<DynamicKeyCommand> l = new ArrayList<DynamicKeyCommand>();
for (DynamicKeyCommand dkc : keyCommands) {
if (dkc.getName() != null && dkc.getName().length() > 0) {
l.add(dkc);
}
}
- menuCommands = l.toArray(new DynamicKeyCommand[l.size()]);
+
+ menuCommands = l.toArray(new KeyCommand[l.size()]);
}
protected void decodeConstraints(String s) {
@@ -218,7 +220,7 @@
}
public String myGetType() {
- SequenceEncoder se = new SequenceEncoder(';');
+ final SequenceEncoder se = new SequenceEncoder(';');
se.append(key);
se.append(encodeConstraints());
se.append(keyCommandListConfig.getValueString());
@@ -230,17 +232,17 @@
}
public Command myKeyEvent(KeyStroke stroke) {
- ChangeTracker tracker = new ChangeTracker(this);
- for (int i = 0; i < keyCommands.length; i++) {
- if (keyCommands[i].matches(stroke)) {
- String newValue = keyCommands[i].propChanger.getNewValue(value);
+ final ChangeTracker tracker = new ChangeTracker(this);
+ for (DynamicKeyCommand dkc : keyCommands) {
+ if (dkc.matches(stroke)) {
+ String newValue = dkc.propChanger.getNewValue(value);
format.setFormat(newValue);
newValue = format.getText(Decorator.getOutermost(this));
setValue(newValue);
}
}
- Command comm = tracker.getChangeCommand();
- return comm;
+
+ return tracker.getChangeCommand();
}
public String getDescription() {
@@ -276,12 +278,14 @@
}
public PieceI18nData getI18nData() {
- String[] commandNames = new String[menuCommands.length];
- String[] commandDescs = new String[menuCommands.length];
- for (int i=0; i < menuCommands.length; i++) {
+ final String[] commandNames = new String[menuCommands.length];
+ final String[] commandDescs = new String[menuCommands.length];
+
+ for (int i = 0; i < menuCommands.length; i++) {
commandNames[i] = menuCommands[i].getName();
commandDescs[i] = "Property " + key + ": Menu Command " + i;
}
+
return getI18nData(commandNames, commandDescs);
}
@@ -339,12 +343,15 @@
}
protected String encodeConstraints() {
- return new SequenceEncoder(',').append(numericConfig.getValueString()).append(minConfig.getValueString()).append(maxConfig.getValueString()).append(
- wrapConfig.getValueString()).getValue();
+ return new SequenceEncoder(',')
+ .append(numericConfig.getValueString())
+ .append(minConfig.getValueString())
+ .append(maxConfig.getValueString())
+ .append(wrapConfig.getValueString()).getValue();
}
public String getType() {
- SequenceEncoder se = new SequenceEncoder(';');
+ final SequenceEncoder se = new SequenceEncoder(';');
se.append(nameConfig.getValueString());
se.append(encodeConstraints());
se.append(keyCommandListConfig.getValueString());
@@ -354,7 +361,6 @@
public String getState() {
return initialValueConfig.getValueString();
}
-
}
/**
@@ -370,7 +376,6 @@
super(name, key, target, i18nPiece);
this.propChanger = propChanger;
}
-
}
/**
@@ -451,7 +456,5 @@
controls.add(keyConfig.getControls());
controls.add(propChangeConfig.getControls());
}
-
}
-
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Embellishment.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Embellishment.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/Embellishment.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -429,14 +429,14 @@
if (activateCommand.length() > 0 && activateKey.length() > 0) {
l.add(new KeyCommand(activateCommand,
KeyStroke.getKeyStroke(activateKey.charAt(0), activateModifiers),
- outer));
+ outer, this));
}
if (upCommand.length() > 0 &&
upKey.length() > 0 &&
nValues > 1 &&
!followProperty) {
up = new KeyCommand(upCommand,
- KeyStroke.getKeyStroke(upKey.charAt(0), upModifiers), outer);
+ KeyStroke.getKeyStroke(upKey.charAt(0), upModifiers), outer, this);
l.add(up);
}
if (downCommand.length() > 0 &&
@@ -444,7 +444,7 @@
nValues > 1 &&
!followProperty) {
down = new KeyCommand(downCommand,
- KeyStroke.getKeyStroke(downKey.charAt(0), downModifiers), outer);
+ KeyStroke.getKeyStroke(downKey.charAt(0), downModifiers), outer, this);
l.add(down);
}
if (resetKey != null && resetCommand.length() > 0 && !followProperty) {
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/FreeRotator.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/FreeRotator.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/FreeRotator.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -58,6 +58,7 @@
import VASSAL.configure.StringConfigurer;
import VASSAL.i18n.PieceI18nData;
import VASSAL.i18n.Resources;
+import VASSAL.i18n.TranslatablePiece;
import VASSAL.tools.SequenceEncoder;
import VASSAL.tools.imageop.GamePieceOp;
import VASSAL.tools.imageop.Op;
@@ -70,7 +71,8 @@
implements EditablePiece,
MouseListener,
MouseMotionListener,
- Drawable {
+ Drawable,
+ TranslatablePiece {
public static final String ID = "rotate;";
public static final String FACING = "_Facing";
@@ -388,12 +390,12 @@
if (commands == null) {
final ArrayList<KeyCommand> l = new ArrayList<KeyCommand>();
final GamePiece outer = Decorator.getOutermost(this);
- setAngleCommand = new KeyCommand(setAngleText, setAngleKey, outer);
- rotateCWCommand = new KeyCommand(rotateCWText, rotateCWKey, outer);
- rotateCCWCommand = new KeyCommand(rotateCCWText, rotateCCWKey, outer);
+ setAngleCommand = new KeyCommand(setAngleText, setAngleKey, outer, this);
+ rotateCWCommand = new KeyCommand(rotateCWText, rotateCWKey, outer, this);
+ rotateCCWCommand = new KeyCommand(rotateCCWText, rotateCCWKey, outer, this);
// for random rotation
- rotateRNDCommand = new KeyCommand(rotateRNDText, rotateRNDKey, outer);
+ rotateRNDCommand = new KeyCommand(rotateRNDText, rotateRNDKey, outer, this);
// end random rotation
if (validAngles.length == 1) {
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/GlobalCommand.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/GlobalCommand.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/GlobalCommand.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -19,13 +19,19 @@
package VASSAL.counters;
import java.util.Iterator;
+
import javax.swing.KeyStroke;
+
import VASSAL.build.GameModule;
import VASSAL.build.module.Chatter;
import VASSAL.build.module.Map;
import VASSAL.command.Command;
import VASSAL.command.NullCommand;
+import VASSAL.tools.ErrorDialog;
import VASSAL.tools.FormattedString;
+import VASSAL.tools.RecursionLimiter;
+import VASSAL.tools.RecursionLimiter.Loopable;
+import VASSAL.tools.RecursionLimitException;
/**
* Applies a given keyboard command to all counters on a map
@@ -35,6 +41,11 @@
protected boolean reportSingle;
protected int selectFromDeck = -1;
protected FormattedString reportFormat = new FormattedString();
+ protected Loopable owner;
+
+ public GlobalCommand(Loopable l) {
+ owner = l;
+ }
public void setKeyStroke(KeyStroke keyStroke) {
this.keyStroke = keyStroke;
@@ -71,32 +82,40 @@
* @return a the corresponding {@link Command}
*/
public Command apply(Map[] m, PieceFilter filter) {
- String reportText = reportFormat.getLocalizedText();
- Command c;
- if (reportText.length() > 0) {
- c = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), "*" + reportText);
- c.execute();
- }
- else {
- c = new NullCommand();
- }
- for (int mapI = 0; mapI < m.length; ++mapI) {
- String mapFormat = m[mapI].getChangeFormat();
- if (reportSingle) {
- m[mapI].setAttribute(Map.CHANGE_FORMAT, "");
+ Command c = new NullCommand();
+ try {
+ RecursionLimiter.startExecution(owner);
+ String reportText = reportFormat.getLocalizedText();
+ if (reportText.length() > 0) {
+ c = new Chatter.DisplayText(
+ GameModule.getGameModule().getChatter(), "*" + reportText);
+ c.execute();
}
- Visitor visitor = new Visitor(c, filter, keyStroke);
- DeckVisitorDispatcher dispatcher = new DeckVisitorDispatcher(visitor);
- GamePiece[] p = m[mapI].getPieces();
- for (int i = 0; i < p.length; ++i) {
- dispatcher.accept(p[i]);
+ for (int mapI = 0; mapI < m.length; ++mapI) {
+ String mapFormat = m[mapI].getChangeFormat();
+ if (reportSingle) {
+ m[mapI].setAttribute(Map.CHANGE_FORMAT, "");
+ }
+ Visitor visitor = new Visitor(c, filter, keyStroke);
+ DeckVisitorDispatcher dispatcher = new DeckVisitorDispatcher(visitor);
+ GamePiece[] p = m[mapI].getPieces();
+ for (int i = 0; i < p.length; ++i) {
+ dispatcher.accept(p[i]);
+ }
+ visitor.getTracker().repaint();
+ if (reportSingle) {
+ m[mapI].setAttribute(Map.CHANGE_FORMAT, mapFormat);
+ }
+ c = visitor.getCommand();
}
- visitor.getTracker().repaint();
- if (reportSingle) {
- m[mapI].setAttribute(Map.CHANGE_FORMAT, mapFormat);
- }
- c = visitor.getCommand();
}
+ catch (RecursionLimitException e) {
+ ErrorDialog.infiniteLoop(e);
+ }
+ finally {
+ RecursionLimiter.endExecution();
+ }
+
return c;
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/SubMenu.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/SubMenu.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/counters/SubMenu.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -38,7 +38,8 @@
public class SubMenu extends Decorator implements TranslatablePiece {
public static final String ID = "submenu;";
private String subMenu;
- private KeyCommandSubMenu[] keyCommands = new KeyCommandSubMenu[1];
+ private KeyCommandSubMenu keyCommandSubMenu;
+ private final KeyCommand[] keyCommands = new KeyCommand[1];
public SubMenu() {
this(ID+"Sub-Menu;",null);
@@ -67,11 +68,14 @@
}
public void mySetType(String type) {
- SequenceEncoder.Decoder st = new SequenceEncoder.Decoder(type,';');
+ final SequenceEncoder.Decoder st = new SequenceEncoder.Decoder(type,';');
st.nextToken();
subMenu = st.nextToken();
- keyCommands[0] = new KeyCommandSubMenu(subMenu,this, this);
- keyCommands[0].setCommands(StringArrayConfigurer.stringToArray(st.nextToken()));
+ keyCommandSubMenu = new KeyCommandSubMenu(subMenu, this, this);
+ keyCommandSubMenu.setCommands(
+ StringArrayConfigurer.stringToArray(st.nextToken()));
+
+ keyCommands[0] = keyCommandSubMenu;
}
protected KeyCommand[] myGetKeyCommands() {
@@ -83,14 +87,15 @@
}
public String myGetType() {
- SequenceEncoder se = new SequenceEncoder(';');
- se.append(getMenuName()).append(StringArrayConfigurer.arrayToString(getSubcommands()));
+ final SequenceEncoder se = new SequenceEncoder(';');
+ se.append(getMenuName()).append(
+ StringArrayConfigurer.arrayToString(getSubcommands()));
return ID+se.getValue();
}
public String[] getSubcommands() {
final ArrayList<String> l = new ArrayList<String>();
- for (Iterator<String> i = keyCommands[0].getCommands(); i.hasNext(); ) {
+ for (Iterator<String> i = keyCommandSubMenu.getCommands(); i.hasNext(); ) {
l.add(i.next());
}
return l.toArray(new String[l.size()]);
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/BundleHelper.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/BundleHelper.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/BundleHelper.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -16,7 +16,7 @@
*/
package VASSAL.i18n;
-import java.text.MessageFormat;
+import java.util.IllegalFormatException;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -51,9 +51,9 @@
public String getString(String id, Object... args) {
try {
- return new MessageFormat(getString(id)).format(args);
+ return String.format(getString(id), args);
}
- catch (IllegalArgumentException e) {
+ catch (IllegalFormatException e) {
Logger.log("Illegal Message Format: " + id);
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/ComponentI18nData.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/ComponentI18nData.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/ComponentI18nData.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -68,6 +68,9 @@
init(c, prefix, c.getAttributeNames(), c.getAttributeTypes(), c.getAttributeDescriptions());
}
+ public ComponentI18nData(AbstractConfigurable c, String prefix, ArrayList<String> names, ArrayList<Class<?>> types, ArrayList<String> descriptions) {
+ init(c, prefix, names.toArray(new String[0]), types.toArray(new Class<?>[0]), descriptions.toArray(new String[0]));
+ }
/**
* Build from an AutoConfigurable
*
@@ -89,7 +92,7 @@
for (int i = 0; i < types.length; i++) {
translatable[i] = types[i] != null &&
(types[i].equals(String.class) ||
- types[i].isAssignableFrom(TranslatableConfigurerFactory.class));
+ TranslatableConfigurerFactory.class.isAssignableFrom(types[i]));
}
init(c, pfx, names, descriptions, translatable);
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Editor.properties
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Editor.properties 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Editor.properties 2009-03-02 11:37:04 UTC (rev 5195)
@@ -39,7 +39,7 @@
Editor.ModuleEditor.update_saved=Update saved games
Editor.ModuleEditor.properties=Properties
Editor.ModuleEditor.translate=Translate
-Editor.ModuleEditor.edit=Edit {0}
+Editor.ModuleEditor.edit=Edit %$1s
Editor.ModuleEditor.component_help=Component help
# Extension Editor
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Localization.java
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Localization.java 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/Localization.java 2009-03-02 11:37:04 UTC (rev 5195)
@@ -26,6 +26,7 @@
import java.util.Set;
import VASSAL.build.GameModule;
import VASSAL.configure.SingleChildInstance;
+import VASSAL.tools.logging.Logger;
/**
* Singleton class for managing the translation of a module into other languages
@@ -159,8 +160,10 @@
}
translationInProgress = false;
translationComplete = true;
+ Logger.log("-- Translated");
}
translatableItems.clear();
+ GameModule.getGameModule().initFrameTitle();
}
}
Modified: VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL.properties
===================================================================
--- VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL.properties 2009-03-01 23:44:49 UTC (rev 5194)
+++ VASSAL-src/branches/mkiefte-3.2/src/VASSAL/i18n/VASSAL.properties 2009-03-02 11:37:04 UTC (rev 5195)
@@ -24,7 +24,7 @@
BugDialog.send_button=Send
BugDialog.dont_send_button=Don't Send
BugDialog.old_version_instructions=<html>VASSAL had an internal error. Because this version of VASSAL is no longer current, bug reporting is disabled. If you can reproduce this bug with a <a href="http://sourceforge.net/project/showfiles.php?group_id=90612">current verision</a> of VASSAL, please do so and alert the VASSAL developers to the problem.</html>
-BugDialog.connection_failed_instructions=<html>VASSAL was unable to submit your bug report. Please post the file <a href="file://{0}">{0}</a> and a description of what you were doing when the bug occurred in the <a href="http://www.vassalengine.org/forums/viewforum.php?f=3">Technical Support & Bugs</a> section of the VASSAL Forum.</html>
+BugDialog.connection_failed_instructions=<html>VASSAL was unable to submit your bug report. Please post the file <a href="file://%1$s">%1$s</a> and a description of what you were doing when the bug occurred in the <a href="http://www.vassalengine.org/forums/viewforum.php?f=3">Technical Support & Bugs</a> section of the VASSAL Forum.</html>
BugDialog.how_to_proceed=Due to the error, VASSAL may be in an inconsistent state or may behave erratically. We recommend that you save your open files under different names and restart VASSAL.\n\nDepending on what the error was, modules, saved games, and logs written afterwards may be corrupt. Be sure to check any modules, saved games, or logs written after an error before continuing to use them.
BugDialog.sending_bug_report=Please wait while we send your bug report to the bug tracker.
@@ -37,15 +37,15 @@
#
Warning.bad_initial_heap_title=Invalid Initial Heap Size
Warning.bad_initial_heap_heading=Invalid Initial Heap Size
-Warning.bad_initial_heap_message=The initial heap size stored in your Preferences for this module is invalid. The default initial heap size of {0}MB will be used instead.
+Warning.bad_initial_heap_message=The initial heap size stored in your Preferences for this module is invalid. The default initial heap size of %1$sMB will be used instead.
Warning.bad_maximum_heap_title=Invalid Maximum Heap Size
Warning.bad_maximum_heap_heading=Invalid Maximum Heap Size
-Warning.bad_maximum_heap_message=The maximum heap size stored in your Preferences for this module is invalid. The default maximum heap size of {0}MB will be used instead.
+Warning.bad_maximum_heap_message=The maximum heap size stored in your Preferences for this module is invalid. The default maximum heap size of %1$sMB will be used instead.
Warning.initial_gt_maximum_heap_title=Illegal Heap Sizes
Warning.initial_gt_maximum_heap_heading=Illegal Heap Sizes
-Warning.initial_gt_maximum_heap_message=The maximum heap size stored in your Preferences for this module is smaller than the the initial heap size stored there. The default initial ({0}MB) and maximum ({1}MB) heap sizes will be used instead.
+Warning.initial_gt_maximum_heap_message=The maximum heap size stored in your Preferences for this module is smaller than the the initial heap size stored there. The default initial (%1$sMB) and maximum (%2$sMB) heap sizes will be used instead.
Warning.set_lower_maximum_heap_title=Maximum Heap Size Too Large
Warning.set_lower_maximum_heap_heading=Maximum Heap Size Too Large
@@ -60,15 +60,15 @@
#
Error.file_not_found_title=File Not Found
Error.file_not_found_heading=File Not Found
-Error.file_not_found_message=VASSAL could not find the file ''{0}''.
+Error.file_not_found_message=VASSAL could not find the file '%1$s'.
Error.file_read_error_title=Unable to Read File
Error.file_read_error_heading=Unable to Read File
-Error.file_read_error_message=VASSAL was unable to read the file ''{0}''.
+Error.file_read_error_message=VASSAL was unable to read the file '%1$s'.
Error.file_write_error_title=Unable to Write File
Error.file_write_error_heading=Unable to Write File
-Error.file_write_error_message=VASSAL was unable to write the file ''{0}''.
+Error.file_write_error_message=VASSAL was unable to write the file '%1$s'.
#
# network I/O errors
@@ -83,68 +83,68 @@
#
Error.custom_class_error_title=Custom Class Error
Error.custom_class_error_heading=Custom Class Error
-Error.custom_class_error_message=There was an error loading or instantiating the class {0}, which is provided by this module. Please report this problem to the module maintainer.
+Error.custom_class_error_message=There was an error loading or instantiating the class %1$s, which is provided by this module. Please report this problem to the module maintainer.
Error.invalid_vassal_file_title=Invalid VASSAL File
Error.invalid_vassal_file_heading=Invalid VASSAL File
-Error.invalid_vassal_file_message=The file ''{0}'' is not recognized by VASSAL.
+Error.invalid_vassal_file_message=The file '%1$s' is not recognized by VASSAL.
Error.invalid_vassal_module_title=Invalid VASSAL Module
Error.invalid_vassal_module_heading=Invalid VASSAL Module
-Error.invalid_vassal_module_message=The file ''{0}'' is not a valid VASSAL module.
+Error.invalid_vassal_module_message=The file '%1$s' is not a valid VASSAL module.
Error.invalid_import_file_title=Invalid Import File
Error.invalid_import_file_heading=Invalid Import File
-Error.invalid_import_file_message=The file ''{0}'' cannot be imported into VASSAL.
+Error.invalid_import_file_message=The file '%1$s' cannot be imported into VASSAL.
Error.module_load_failed_title=Module Load Failed
Error.module_load_failed_heading=Module Load Failed
-Error.module_load_failed_message=VASSAL was unable to load the module:\n\n{0}
+Error.module_load_failed_message=VASSAL was unable to load the module:\n\n%1$s
Error.communication_error_title=Communication Error
Error.communication_error_heading=Communication Error
-Error.communication_error_message=The {0} and the Module Manager cannot communicate with each other. Please restart VASSAL and try loading the module again.
+Error.communication_error_message=The %1$s and the Module Manager cannot communicate with each other. Please restart VASSAL and try loading the module again.
Error.not_a_configurable_title=Class Is Not A Configurable
Error.not_a_configurable_heading=Class Is Not A Configurable
-Error.not_a_configurable_message=The class {0} which you attempted to import does not implement the Configurable interface. Only classes which are Configurables may be imported this way.
+Error.not_a_configurable_message=The class %1$s which you attempted to import does not implement the Configurable interface. Only classes which are Configurables may be imported this way.
Error.not_a_gamepiece_title=Invalid GamePiece
Error.not_a_gamepiece_heading=Invalid GamePiece
-Error.not_a_gamepiece_message=The class {0} which you attempted to import does not implement the GamePiece interface. Only classes which are GamePieces may be imported this way.
+Error.not_a_gamepiece_message=The class %1$s which you attempted to import does not implement the GamePiece interface....
[truncated message content] |