Project

General

Profile

set_window_bounds_diff.txt

Sergey Ivanovskiy, 09/18/2015 01:07 PM

Download (6.43 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/gui/WindowGuiImpl.java'
2
--- src/com/goldencode/p2j/ui/client/gui/WindowGuiImpl.java	2015-09-18 13:47:36 +0000
3
+++ src/com/goldencode/p2j/ui/client/gui/WindowGuiImpl.java	2015-09-18 15:27:22 +0000
4
@@ -1428,19 +1428,19 @@
5
       gd.registerMoveableWidget(titleBar.config().id.asInt());
6
       gd.registerResizeableWidget(this.config().id.asInt());
7
       
8
-      Menu popup = createPopup();
9
-      reg.addWidgetsRecursive(popup);
10
-      moveToBottom(popup);
11
+//      Menu popup = createPopup();
12
+//      reg.addWidgetsRecursive(popup);
13
+//      moveToBottom(popup);
14
       
15
-      gd.registerWidgetPopup(((AbstractWidget<GuiOutputManager>) titleBar.icon).getId().asInt(), 
16
-                             MouseEvent.BUTTON1,
17
-                             popup.config().id.asInt());
18
-      gd.registerWidgetPopup(titleBar.config().id.asInt(), 
19
-                             MouseEvent.BUTTON3, 
20
-                             popup.config().id.asInt());
21
-      gd.registerWidgetPopup(((AbstractWidget<GuiOutputManager>) titleBar.title).getId().asInt(),
22
-                             MouseEvent.BUTTON3, 
23
-                             popup.config().id.asInt());
24
+//      gd.registerWidgetPopup(((AbstractWidget<GuiOutputManager>) titleBar.icon).getId().asInt(), 
25
+//                             MouseEvent.BUTTON1,
26
+//                             popup.config().id.asInt());
27
+//      gd.registerWidgetPopup(titleBar.config().id.asInt(), 
28
+//                             MouseEvent.BUTTON3, 
29
+//                             popup.config().id.asInt());
30
+//      gd.registerWidgetPopup(((AbstractWidget<GuiOutputManager>) titleBar.title).getId().asInt(),
31
+//                             MouseEvent.BUTTON3, 
32
+//                             popup.config().id.asInt());
33
       
34
       gd.setWindowVisible(config.visible);
35
    }
36

    
37
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/EmulatedWindowState.java'
38
--- src/com/goldencode/p2j/ui/client/gui/driver/EmulatedWindowState.java	2015-09-08 10:15:53 +0000
39
+++ src/com/goldencode/p2j/ui/client/gui/driver/EmulatedWindowState.java	2015-09-18 16:43:17 +0000
40
@@ -451,6 +451,13 @@
41
                   case SET_LOCATION:
42
                      extra = String.format(" x = %d; y = %d", ps.x, ps.y);
43
                      break;
44
+                  case SET_WINDOW_BOUNDS:
45
+                     extra = String.format(" x = %d; y = %d; width = %d; height = %d",
46
+                              ps.x,
47
+                              ps.y,
48
+                              ps.width,
49
+                              ps.height);
50
+                     break;
51
                   case DRAW_STRING:
52
                      extra = String.format(" text = %s; x = %d; y = %d; centered = %b",
53
                                            ps.text,
54

    
55
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java'
56
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2015-09-01 18:27:30 +0000
57
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2015-09-18 16:27:57 +0000
58
@@ -378,6 +378,16 @@
59
                websock.setWindowLocation(x, y);
60
             }
61
             break;
62
+         case SET_WINDOW_BOUNDS:
63
+            if (x != ps.x || y != ps.y || width != ps.width || height != ps.height)
64
+            {
65
+               x = ps.x;
66
+               y = ps.y;
67
+               width  = ps.width;
68
+               height = ps.height;
69
+               websock.setWindowBounds(x, y, width, height);
70
+            }
71
+            break;
72
          case RESIZE_WINDOW:
73
             if (width != ps.width || height != ps.height)
74
             {
75

    
76
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java'
77
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2015-09-18 11:10:16 +0000
78
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2015-09-18 16:39:02 +0000
79
@@ -440,6 +440,23 @@
80
    }
81
    
82
    /**
83
+    * Set the window bounds.
84
+    * 
85
+    * @param    x
86
+    *           The X coordinate in pixels.
87
+    * @param    y
88
+    *           The Y coordinate in pixels.
89
+    * @param    width
90
+    *           The window width in pixels.
91
+    * @param    height
92
+    *           The window height in pixels.
93
+    */
94
+   public void setWindowBounds(int x, int y, int width, int height)
95
+   {
96
+      allocateAndSend(PaintPrimitives.SET_WINDOW_BOUNDS, x, y, width, height);
97
+   }
98
+   
99
+   /**
100
     * Force the list of all GUI windows to be stacked as in the specified order.
101
     * 
102
     * @param    windowIds
103

    
104
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
105
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-09-18 11:10:16 +0000
106
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-09-18 16:32:57 +0000
107
@@ -73,12 +73,13 @@
108
       FLUSH                   : 22,
109
       SET_LOCATION            : 23,
110
       RESIZE_WINDOW           : 24,
111
-      DRAW_HIGHLIGHT          : 25,
112
-      CLEAR_HIGHLIGHT         : 26,
113
-      START_BATCH             : 27,
114
-      END_BATCH               : 28,
115
-      SET_TITLE               : 29,
116
-      SET_ICON                : 30,
117
+      SET_WINDOW_BOUNDS       : 25,
118
+      DRAW_HIGHLIGHT          : 26,
119
+      CLEAR_HIGHLIGHT         : 27,
120
+      START_BATCH             : 28,
121
+      END_BATCH               : 29,
122
+      SET_TITLE               : 30,
123
+      SET_ICON                : 31,
124
    };
125
    
126
    // reverse map the types to their property names
127
@@ -843,6 +844,16 @@
128
                extra = " " + this.clips.toString();
129
                this.canvasRenderer.unclip();
130
                break;
131
+            case ops.SET_WINDOW_BOUNDS:
132
+               x =  p2j.socket.readInt32BinaryMessage(message, idx + 1);
133
+               y =  p2j.socket.readInt32BinaryMessage(message, idx + 5);
134
+               this.canvas.style.left = x.toString() + "px";
135
+               this.canvas.style.top  = y.toString() + "px";
136
+               width  = p2j.socket.readInt32BinaryMessage(message, idx + 1);
137
+               height = p2j.socket.readInt32BinaryMessage(message, idx + 5);
138
+               this.resize(width, height);
139
+               extra = " x = " + x + "; y = " + y + "; width = " + width + "; height = " + height;
140
+               break;
141
             case ops.SET_LOCATION:
142
                x =  p2j.socket.readInt32BinaryMessage(message, idx + 1);
143
                y =  p2j.socket.readInt32BinaryMessage(message, idx + 5);
144