Revision: 1405
http://rails.svn.sourceforge.net/rails/?rev=1405&view=rev
Author: stefanfrey
Date: 2010-08-22 20:13:41 +0000 (Sun, 22 Aug 2010)
Log Message:
-----------
Fixed undo problem for time history
Modified Paths:
--------------
trunk/18xx/rails/ui/swing/ReportWindowDynamic.java
Modified: trunk/18xx/rails/ui/swing/ReportWindowDynamic.java
===================================================================
--- trunk/18xx/rails/ui/swing/ReportWindowDynamic.java 2010-08-22 19:58:50 UTC (rev 1404)
+++ trunk/18xx/rails/ui/swing/ReportWindowDynamic.java 2010-08-22 20:13:41 UTC (rev 1405)
@@ -164,10 +164,16 @@
boolean haveRedo = false;
List<GameAction> gameActions = PossibleActions.getInstance().getType(GameAction.class);
+ boolean undoFlag = false;
for (GameAction action:gameActions) {
switch (action.getMode()) {
case GameAction.UNDO:
+ undoFlag = true;
+ backwardButton.setPossibleAction(action);
+ backwardButton.setEnabled(true);
+ break;
case GameAction.FORCED_UNDO:
+ if (undoFlag) break; // only activate forced undo, if no other undo available
backwardButton.setPossibleAction(action);
backwardButton.setEnabled(true);
break;
@@ -175,7 +181,6 @@
forwardButton.setPossibleAction(action);
forwardButton.setEnabled(true);
haveRedo = true;
- if (!timeWarpMode) activateTimeWarp();
break;
}
}
@@ -205,6 +210,13 @@
public void actionPerformed(ActionEvent e) {
ActionButton button = (ActionButton)e.getSource();
GameAction action = (GameAction)button.getPossibleActions().get(0);
+ if (action instanceof GameAction && (action.getMode() == GameAction.FORCED_UNDO)) {
+ if (!timeWarpMode) {
+ activateTimeWarp();
+ }
+ }
+
+
gameUIManager.processOnServer(action);
}
@@ -214,6 +226,9 @@
// String protocol = e.getURL().getProtocol();
int index = url.getPort();
gotoIndex(index + 1);
+ if (!timeWarpMode) {
+ activateTimeWarp();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|