Stream->Fountain, move Scheduler to Platform, HashMap->Hash
[org.ibex.core.git] / src / org / ibex / graphics / Surface.java
index 7658ec5..0f29914 100644 (file)
@@ -7,8 +7,7 @@ package org.ibex.graphics;
 import org.ibex.js.*;
 import org.ibex.util.*;
 import org.ibex.plat.*;
-
-import org.ibex.core.*;  // FIXME
+import org.ibex.core.*;
 
 /** 
  *  A Surface, as described in the Ibex Reference.
@@ -23,7 +22,7 @@ public abstract class Surface implements Callable {
     private static final JS T = JSU.T;
     private static final JS F = JSU.F;
 
-    /** all instances of Surface which need to be refreshed by the Scheduler */
+    /** all instances of Surface which need to be refreshed by the Platform.Scheduler */
     public static Vec allSurfaces = new Vec();
     
     /** When set to true, render() should abort as soon as possible and restart the rendering process */
@@ -97,7 +96,7 @@ public abstract class Surface implements Callable {
         if (button == 1) new Message("_Press1", T, root);
         else if (button == 2) new Message("_Press2", T, root);
         else if (button == 3) {
-            Scheduler.add(new Callable() { public Object run(Object o) throws JSExn {
+            Platform.Scheduler.add(new Callable() { public Object run(Object o) throws JSExn {
                 Platform.clipboardReadEnabled = true;
                 try {
                     root.putAndTriggerTraps(JSU.S("_Press3"), T);
@@ -136,7 +135,7 @@ public abstract class Surface implements Callable {
     }
 
     private final static JS MOVE = JSU.S("_Move");
-    /** we enqueue ourselves in the Scheduler when we have a Move message to deal with */
+    /** we enqueue ourselves in the Platform.Scheduler when we have a Move message to deal with */
     private Callable mover = new Callable() {
         public Object run(Object o) {
                 if (mousex == newmousex && mousey == newmousey) return null;
@@ -159,7 +158,7 @@ public abstract class Surface implements Callable {
     protected final void Move(final int newmousex, final int newmousey) {
         this.newmousex = newmousex;
         this.newmousey = newmousey;
-        Scheduler.add(mover);
+        Platform.Scheduler.add(mover);
     }
 
     protected final void HScroll(int pixels) { new Message("_HScroll", JSU.N(pixels), root); }
@@ -174,12 +173,12 @@ public abstract class Surface implements Callable {
         pendingHeight = height;
         syncRootBoxToSurface = true;
         abort = true;
-        Scheduler.renderAll();
+        Platform.Scheduler.renderAll();
     }
 
     // FEATURE: can we avoid creating objects here?
     protected final void PosChange(final int x, final int y) {
-        Scheduler.add(new Callable() { public Object run(Object o) throws JSExn {
+        Platform.Scheduler.add(new Callable() { public Object run(Object o) throws JSExn {
             root.x = x;
             root.y = y;
             root.putAndTriggerTrapsAndCatchExceptions(JSU.S("PosChange"), T);
@@ -197,8 +196,8 @@ public abstract class Surface implements Callable {
     protected final void Focused(boolean b) { new Message("Focused", b ? T : F, root); }
 
     private boolean scheduled = false;
-    public void Refresh() { if (!scheduled) Scheduler.add(this); scheduled = true; }
-    public Object run(Object o) { scheduled = false; Scheduler.renderAll(); return null; }
+    public void Refresh() { if (!scheduled) Platform.Scheduler.add(this); scheduled = true; }
+    public Object run(Object o) { scheduled = false; Platform.Scheduler.renderAll(); return null; }
 
     public final void setMaximized(boolean b) { if (b != maximized) _setMaximized(maximized = b); }
     public final void setMinimized(boolean b) { if (b != minimized) _setMinimized(minimized = b); }
@@ -318,7 +317,7 @@ public abstract class Surface implements Callable {
             this.boxContainingMouse = boxContainingMouse;
             this.name = name;
             this.value = value;
-            Scheduler.add(this);
+            Platform.Scheduler.add(this);
         }
         
         public Object run(Object o) throws JSExn {
@@ -414,7 +413,7 @@ public abstract class Surface implements Callable {
         // This is how subclasses signal a 'shallow dirty', indicating that although the backbuffer is valid, the screen is not
         public final void Dirty(int x, int y, int w, int h) {
             screenDirtyRegions.dirty(x, y, w, h);
-            Scheduler.renderAll();
+            Platform.Scheduler.renderAll();
         }
 
         public void dirty(int x, int y, int w, int h) {