partial update of core for new js stuff
[org.ibex.core.git] / src / org / ibex / graphics / Surface.java
index ced451a..a6b8447 100644 (file)
@@ -20,8 +20,8 @@ public abstract class Surface extends PixelBuffer implements Task {
 
     // Static Data ////////////////////////////////////////////////////////////////////////////////
 
-    private static final JS T = JS.T;
-    private static final JS F = JS.F;
+    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 */
     public static Vec allSurfaces = new Vec();
@@ -99,7 +99,7 @@ public abstract class Surface extends PixelBuffer implements Task {
             Scheduler.add(new Task() { public void perform() throws JSExn {
                 Platform.clipboardReadEnabled = true;
                 try {
-                    root.putAndTriggerTraps(JS.S("_Press3"), T);
+                    root.putAndTriggerTraps(JSU.S("_Press3"), T);
                 } finally {
                     Platform.clipboardReadEnabled = false;
                 }
@@ -133,7 +133,7 @@ public abstract class Surface extends PixelBuffer implements Task {
         }
     }
 
-    private final static JS MOVE = JS.S("_Move");
+    private final static JS MOVE = JSU.S("_Move");
     /** we enqueue ourselves in the Scheduler when we have a Move message to deal with */
     private Task mover = new Task() {
             public void perform() {
@@ -159,10 +159,10 @@ public abstract class Surface extends PixelBuffer implements Task {
         Scheduler.add(mover);
     }
 
-    protected final void HScroll(int pixels) { new Message("_HScroll", JS.N(pixels), root); }
-    protected final void VScroll(int pixels) { new Message("_VScroll", JS.N(pixels), root); }
-    protected final void HScroll(float lines) { new Message("_HScroll", JS.N(lines), root); }
-    protected final void VScroll(float lines) { new Message("_VScroll", JS.N(lines), root); }
+    protected final void HScroll(int pixels) { new Message("_HScroll", JSU.N(pixels), root); }
+    protected final void VScroll(int pixels) { new Message("_VScroll", JSU.N(pixels), root); }
+    protected final void HScroll(float lines) { new Message("_HScroll", JSU.N(lines), root); }
+    protected final void VScroll(float lines) { new Message("_VScroll", JSU.N(lines), root); }
 
     /** subclasses should invoke this method when the user resizes the window */
     protected final void SizeChange(final int width, final int height) {
@@ -179,14 +179,14 @@ public abstract class Surface extends PixelBuffer implements Task {
         Scheduler.add(new Task() { public void perform() throws JSExn {
             root.x = x;
             root.y = y;
-            root.putAndTriggerTrapsAndCatchExceptions(JS.S("PosChange"), T);
+            root.putAndTriggerTrapsAndCatchExceptions(JSU.S("PosChange"), T);
         }});
     }
 
     private final String[] doubleClick = new String[] { null, "_DoubleClick1", "_DoubleClick2", "_DoubleClick3" };
     protected final void DoubleClick(int button) { new Message(doubleClick[button], T, root); }
-    protected final void KeyPressed(String key) { new Message("_KeyPressed", JS.S(key), root); }
-    protected final void KeyReleased(String key) { new Message("_KeyReleased", JS.S(key), root); }
+    protected final void KeyPressed(String key) { new Message("_KeyPressed", JSU.S(key), root); }
+    protected final void KeyReleased(String key) { new Message("_KeyReleased", JSU.S(key), root); }
     protected final void Close() { new Message("Close", T, root); }
     protected final void Minimized(boolean b) { minimized = b; new Message("Minimized", b ? T : F, root); }
     protected final void Maximized(boolean b) { maximized = b; new Message("Maximized", b ? T : F, root); }
@@ -273,7 +273,7 @@ public abstract class Surface extends PixelBuffer implements Task {
             setSize(rootwidth, rootheight);
             /*String oldcursor = cursor;
             cursor = "default";
-            root.putAndTriggerTrapsAndCatchExceptions("_Move", JS.T);
+            root.putAndTriggerTrapsAndCatchExceptions("_Move", JSU.T);
             if (!cursor.equals(oldcursor)) syncCursor();*/
         } while(abort);
 
@@ -325,20 +325,20 @@ public abstract class Surface extends PixelBuffer implements Task {
                 if (value.toLowerCase().equals("alt")) alt = true;           else if (alt) value = "A-" + value;
                 if (value.toLowerCase().endsWith("control")) control = true; else if (control) value = "C-" + value;
                 if (value.equals("C-v") || value.equals("A-v")) Platform.clipboardReadEnabled = true;
-                this.value = JS.S(value);
+                this.value = JSU.S(value);
             } else if (name.equals("_KeyReleased")) {
                 String value = JS.toString(this.value);
                 if (value.toLowerCase().equals("alt")) alt = false;
                 else if (value.toLowerCase().equals("control")) control = false;
                 else if (value.toLowerCase().equals("shift")) shift = false;
-                this.value = JS.S(value);
+                this.value = JSU.S(value);
             } else if (name.equals("_HScroll") || name.equals("_VScroll")) {
                 // FIXME: technically points != pixels
                 if (JS.isInt(value))
-                    value = JS.N(JS.toInt(value) * root.fontSize());
+                    value = JSU.N(JS.toInt(value) * root.fontSize());
             }
             try {
-                boxContainingMouse.putAndTriggerTrapsAndCatchExceptions(JS.S(name), value);
+                boxContainingMouse.putAndTriggerTrapsAndCatchExceptions(JSU.S(name), value);
             } finally {
                 Platform.clipboardReadEnabled = false;
             }