/[gzz]/gzz/lava/gzz/client/PotionFallbackBinder.java
ViewVC logotype

Diff of /gzz/lava/gzz/client/PotionFallbackBinder.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by benja, Wed Jan 1 22:46:50 2003 UTC revision 1.2 by benja, Thu Jan 2 00:00:49 2003 UTC
# Line 7  import java.awt.event.MouseEvent; Line 7  import java.awt.event.MouseEvent;
7  import java.util.*;  import java.util.*;
8    
9  public class PotionFallbackBinder implements FallbackBinder {  public class PotionFallbackBinder implements FallbackBinder {
10        public static boolean dbg = false;
11        private static void pa(String s) { System.out.println(s); }
12    
13      public CommandCall currentAction;      public CommandCall currentAction;
14    
# Line 28  public class PotionFallbackBinder implem Line 30  public class PotionFallbackBinder implem
30      public void setFallback(Fallback f) { fallback=f; }      public void setFallback(Fallback f) { fallback=f; }
31    
32      public void keystroke(String k, Fallback.Win win) {      public void keystroke(String k, Fallback.Win win) {
33            if(dbg) pa("Key: "+k);
34    
35          Object binding = bindings.get(k);          Object binding = bindings.get(k);
36            if(dbg) pa("Binding: "+binding);
37          if(binding == null)          if(binding == null)
38              // no binding for this key              // no binding for this key
39              return;              return;
40    
41          else if(binding instanceof CommandCall) {          else if(binding instanceof CommandCall) {
42              currentAction = (CommandCall)binding;              currentAction = (CommandCall)binding;
43                if(dbg) pa("Replaced currentAction.");
44              if(currentAction.isComplete()) {              if(currentAction.isComplete()) {
45                    if(dbg) pa("Execute: "+currentAction);
46                  Map context = getContext(fallback.windows[1]);                  Map context = getContext(fallback.windows[1]);
47                  currentAction.execute(context);                  currentAction.execute(context);
48                  currentAction = null;                  currentAction = null;
# Line 43  public class PotionFallbackBinder implem Line 50  public class PotionFallbackBinder implem
50          } else if(binding instanceof Arrow) {          } else if(binding instanceof Arrow) {
51              Arrow a = (Arrow)binding;              Arrow a = (Arrow)binding;
52              Fallback.Win w = fallback.windows[a.win];              Fallback.Win w = fallback.windows[a.win];
53                AbstractUpdateManager.prioritize(w.getScreen());
54    
55              if(currentAction == null) {              if(currentAction == null) {
56                    if(dbg) pa("Move.");
57                  Cell n = w.cursor.s(w.dims[a.axis], a.dir);                  Cell n = w.cursor.s(w.dims[a.axis], a.dir);
58                  if(n != null) w.cursor = n;                  if(n != null) w.cursor = n;
59              } else {              } else {
60                  Map context = getContext(w);                  Map context = getContext(w);
61                  Type t = currentAction.getNextParam();                  Type t = currentAction.getNextParam();
62                  FunctionExpression e = t.readDir(a.win, a.axis, a.dir, context);                  FunctionExpression e = t.readDir(a.win, a.axis, a.dir, context);
63                  if(e == null) return;                  if(dbg) pa("Read direction: "+e);
64                    if(e == null) {
65                        AbstractUpdateManager.chg();
66                        return;
67                    }
68                  currentAction = (CommandCall)currentAction.setNextParam(e);                  currentAction = (CommandCall)currentAction.setNextParam(e);
69                    if(dbg) pa("Updated currentAction: "+currentAction);
70                  if(currentAction.isComplete()) {                  if(currentAction.isComplete()) {
71                        if(dbg) pa("Execute: "+currentAction);
72                      currentAction.execute(context);                      currentAction.execute(context);
73                      currentAction = null;                      currentAction = null;
74                  }                  }
75              }              }
76          }          }
77    
78            AbstractUpdateManager.chg();
79      }      }
80    
81      public Map getContext(Fallback.Win win) {      public Map getContext(Fallback.Win win) {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26