gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/lava/gzz client/PotionFallbackBinder.java p...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/lava/gzz client/PotionFallbackBinder.java p...
Date: Sun, 05 Jan 2003 05:41:12 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      03/01/05 05:41:08

Modified files:
        lava/gzz/client: PotionFallbackBinder.java 
        lava/gzz/potion/potions: Connect.java PrefixOrLeft.java 
                                 PrefixOrOther.java 
        lava/gzz/view  : PendingPotionDecorator.java 
Added files:
        lava/gzz/potion/potions: Hop2.java LeftWindow.java 
                                 PrefixOrRight.java Put.java 
                                 RightWindow.java ToggleMark.java 

Log message:
        Stuff by Ayse

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/client/PotionFallbackBinder.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Hop2.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/LeftWindow.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/PrefixOrRight.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Put.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/RightWindow.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/ToggleMark.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Connect.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/PrefixOrLeft.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/PrefixOrOther.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/view/PendingPotionDecorator.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/lava/gzz/client/PotionFallbackBinder.java
diff -u gzz/lava/gzz/client/PotionFallbackBinder.java:1.3 
gzz/lava/gzz/client/PotionFallbackBinder.java:1.4
--- gzz/lava/gzz/client/PotionFallbackBinder.java:1.3   Fri Jan  3 13:05:06 2003
+++ gzz/lava/gzz/client/PotionFallbackBinder.java       Sun Jan  5 05:41:05 2003
@@ -10,11 +10,14 @@
     public static boolean dbg = false;
     private static void pa(String s) { System.out.println(s); }
 
-    public CommandCall currentAction;
+    public CommandCall currentCommand;
+    public int currentWin;
 
     protected Fallback fallback;
     protected Map bindings;
 
+    public Set markedCells = new HashSet();
+
     /** An arrow key.
      *  Can be a value in the <code>bindings</code> map.
      */
@@ -22,6 +25,15 @@
        int win, axis, dir;
        public Arrow(int w, int a, int d) { win=w; axis=a; dir=d; }
     }
+    public static class Action {
+       CommandCall command;
+       int window;
+
+       public Action(CommandCall command, int window) {
+           this.command = command;
+           this.window = window;
+       }
+    }
 
     public PotionFallbackBinder(Map bindings) {
        this.bindings = bindings;
@@ -36,41 +48,43 @@
        if(dbg) pa("Binding: "+binding);
        if(binding == null) {
            // no binding for this key: clear pending
-           currentAction = null;
+           currentCommand = null;
            AbstractUpdateManager.chg();
-       } else if(binding instanceof CommandCall) {
-           currentAction = (CommandCall)binding;
-           if(dbg) pa("Replaced currentAction.");
-           if(currentAction.isComplete()) {
-               if(dbg) pa("Execute: "+currentAction);
-               Map context = getContext(fallback.windows[1]);
-               currentAction.execute(context);
-               currentAction = null;
+       } else if(binding instanceof Action) {
+           Action action = (Action)binding;
+           currentCommand = action.command;
+           currentWin = action.window;
+           if(dbg) pa("Replaced currentCommand.");
+           if(currentCommand.isComplete()) {
+               if(dbg) pa("Execute: "+currentCommand);
+               Map context = getContext(fallback.windows[currentWin]);
+               currentCommand.execute(context);
+               currentCommand = null;
            }
        } else if(binding instanceof Arrow) {
            Arrow a = (Arrow)binding;
            Fallback.Win w = fallback.windows[a.win];
            AbstractUpdateManager.prioritize(w.getScreen());
 
-           if(currentAction == null) {
+           if(currentCommand == null) {
                if(dbg) pa("Move.");
                Cell n = w.cursor.s(w.dims[a.axis], a.dir);
                if(n != null) w.cursor = n;
            } else {
                Map context = getContext(w);
-               Type t = currentAction.getNextParam();
+               Type t = currentCommand.getNextParam();
                FunctionExpression e = t.readDir(a.win, a.axis, a.dir, context);
                if(dbg) pa("Read direction: "+e);
                if(e == null) {
                    AbstractUpdateManager.chg();
                    return;
                }
-               currentAction = (CommandCall)currentAction.setNextParam(e);
-               if(dbg) pa("Updated currentAction: "+currentAction);
-               if(currentAction.isComplete()) {
-                   if(dbg) pa("Execute: "+currentAction);
-                   currentAction.execute(context);
-                   currentAction = null;
+               currentCommand = (CommandCall)currentCommand.setNextParam(e);
+               if(dbg) pa("Updated currentCommand: "+currentCommand);
+               if(currentCommand.isComplete()) {
+                   if(dbg) pa("Execute: "+currentCommand);
+                   currentCommand.execute(context);
+                   currentCommand = null;
                }
            }
        }
@@ -82,7 +96,12 @@
        Map context = new HashMap();
        context.put(Space.class, fallback.space);
        context.put(ViewContext.class, win);
+       context.put(PotionFallbackBinder.class, this);
        return context;
+    }
+
+    public boolean isMarked(Cell c){
+       return markedCells.contains(c);
     }
 
     public void mouse(MouseEvent e, Fallback.Win win) {
Index: gzz/lava/gzz/potion/potions/Connect.java
diff -u gzz/lava/gzz/potion/potions/Connect.java:1.1 
gzz/lava/gzz/potion/potions/Connect.java:1.2
--- gzz/lava/gzz/potion/potions/Connect.java:1.1        Fri Jan  3 13:05:06 2003
+++ gzz/lava/gzz/potion/potions/Connect.java    Sun Jan  5 05:41:06 2003
@@ -1,14 +1,14 @@
 //(c):Benja Fallenstein
 package gzz.potion.potions;
 import gzz.potion.*;
-import java.util.*; 
+import java.util.*;
 import gzz.zzutil.*;
 import gzz.vob.linebreaking.HChain;
 import gzz.*;
 import gzz.potion.Expression.*;
 
 public class Connect extends AbstractHead implements Command {
-    
+
     public Connect() {
        super(new Object[] {
            "Connect ", Types.CELL, " ", Types.PLACE
Index: gzz/lava/gzz/potion/potions/PrefixOrLeft.java
diff -u gzz/lava/gzz/potion/potions/PrefixOrLeft.java:1.1 
gzz/lava/gzz/potion/potions/PrefixOrLeft.java:1.2
--- gzz/lava/gzz/potion/potions/PrefixOrLeft.java:1.1   Sat Jan  4 09:39:47 2003
+++ gzz/lava/gzz/potion/potions/PrefixOrLeft.java       Sun Jan  5 05:41:06 2003
@@ -20,14 +20,14 @@
     public List evaluate(List[] params, Map context) {
        return Collections.nCopies(1, getCell(context));
     }
-    
+
     public String getString(Expression[] params, Map context) {
        return "the cell in the LEFT window";
     }
-       
+
     public void render(Expression[] params,Map context, HChain into) {
     }
-       
+
     public Type[] getParams() {
        return new Type[0];
     }
Index: gzz/lava/gzz/potion/potions/PrefixOrOther.java
diff -u gzz/lava/gzz/potion/potions/PrefixOrOther.java:1.1 
gzz/lava/gzz/potion/potions/PrefixOrOther.java:1.2
--- gzz/lava/gzz/potion/potions/PrefixOrOther.java:1.1  Fri Jan  3 13:05:06 2003
+++ gzz/lava/gzz/potion/potions/PrefixOrOther.java      Sun Jan  5 05:41:06 2003
@@ -11,22 +11,33 @@
 public class PrefixOrOther implements Function {
 
     protected Cell getCell(Map context) {
-       System.out.println("PrefixOrOther.getCell");
        Fallback.Win win = (Fallback.Win)context.get(ViewContext.class);
        return win.getOther().cursor;
     }
 
-    public List evaluate(List[] params, Map context) {
+    protected List getCells(Map context) {
+       System.out.println("PrefixOrOther.getCell");
+
+       PotionFallbackBinder binder =
+           (PotionFallbackBinder)context.get(PotionFallbackBinder.class);
+
+       if(!binder.markedCells.isEmpty())
+           return new ArrayList(binder.markedCells);
+
        return Collections.nCopies(1, getCell(context));
     }
-    
+
+    public List evaluate(List[] params, Map context) {
+       return getCells(context);
+    }
+
     public String getString(Expression[] params, Map context) {
        return "the cell in the other window";
     }
-       
+
     public void render(Expression[] params,Map context, HChain into) {
     }
-       
+
     public Type[] getParams() {
        return new Type[0];
     }
Index: gzz/lava/gzz/view/PendingPotionDecorator.java
diff -u gzz/lava/gzz/view/PendingPotionDecorator.java:1.1 
gzz/lava/gzz/view/PendingPotionDecorator.java:1.2
--- gzz/lava/gzz/view/PendingPotionDecorator.java:1.1   Fri Jan  3 13:05:07 2003
+++ gzz/lava/gzz/view/PendingPotionDecorator.java       Sun Jan  5 05:41:06 2003
@@ -36,7 +36,7 @@
  *  potion op entered.
  */
 public class PendingPotionDecorator implements FallbackSceneDecorator {
-String rcsid = "$Id: PendingPotionDecorator.java,v 1.1 2003/01/03 18:05:07 
benja Exp $";
+String rcsid = "$Id: PendingPotionDecorator.java,v 1.2 2003/01/05 10:41:06 
benja Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -51,16 +51,16 @@
        if(!(fallback.binder instanceof PotionFallbackBinder)) return;
        PotionFallbackBinder binder = (PotionFallbackBinder)fallback.binder;
 
-        if(dbg) pa("Next potion action: "+binder.currentAction);
+        if(dbg) pa("Next potion action: "+binder.currentCommand);
 
-       if(binder.currentAction == null)
+       if(binder.currentCommand == null)
            return;
 
        Dimension size = sc.getSize();
        HChain ch = new LinebreakableChain();
 
        Map context = binder.getContext(win);
-       String text = binder.currentAction.getString(context);
+       String text = binder.currentCommand.getString(context);
        if(dbg) pa("Potion action text: "+text);
        ch.addBox(text(text));
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]