...
|
...
|
@@ -168,18 +168,51 @@ var pageClass = {
|
168
|
168
|
logprint(LOG_DEBUG, 'objet ' ~ id ~ ' already exists');
|
169
|
169
|
return;
|
170
|
170
|
}
|
|
171
|
+ if (!contains(geometry, 'sep'))
|
|
172
|
+ geometry.sep = 0;
|
|
173
|
+ if (contains(geometry, 'autogeom') and geometry.autogeom) {
|
|
174
|
+ # 1024x768 display
|
|
175
|
+ # - let 10 from the border
|
|
176
|
+ # - plus other 10 from the window border and the text
|
|
177
|
+ # - font size tends to be 10x24
|
|
178
|
+ # - let 8+8 around the separator
|
|
179
|
+ var textWidth = 200;
|
|
180
|
+ var lines = 0;
|
|
181
|
+ forindex (var o; objects) {
|
|
182
|
+ if (contains(objects[o], 'text')) {
|
|
183
|
+ var l = size(objects[o].text) * 10;
|
|
184
|
+ if (l > textWidth)
|
|
185
|
+ textWidth = l;
|
|
186
|
+ lines += 1;
|
|
187
|
+ }
|
|
188
|
+ if (contains(objects[o], 'type') and objects[o].type == 'separator')
|
|
189
|
+ geometry.sep += 1;
|
|
190
|
+ }
|
|
191
|
+ geometry.l = lines;
|
|
192
|
+ if (contains(geometry, 'x')) geometry.x -= textWidth;
|
|
193
|
+ else geometry.x = 1014 - textWidth;
|
|
194
|
+ if (contains(geometry, 'y')) geometry.y -= lines * 24 + 72; # 72 = offset from bottom to let...
|
|
195
|
+ else geometry.y = 758 - (lines * 24) - 72; # ... softkeys display and margin
|
|
196
|
+ if (!contains(geometry, 'w')) geometry.w = textWidth;
|
|
197
|
+ }
|
171
|
198
|
if (!contains(geometry, 'h') and !contains(geometry, 'l')) {
|
172
|
199
|
logprint(LOG_DEBUG, 'missing parameter l or h');
|
173
|
200
|
return;
|
174
|
201
|
}
|
|
202
|
+
|
175
|
203
|
var save_x = geometry.x;
|
176
|
204
|
var save_y = geometry.y;
|
|
205
|
+ if (!geometry.sep)
|
|
206
|
+ geometry.sep = 1;
|
177
|
207
|
me.state[id] = {
|
178
|
208
|
objects: objects,
|
179
|
209
|
geometry: geometry,
|
180
|
210
|
x_base : geometry.x + 10,
|
181
|
211
|
h_max : contains(geometry, 'h') ? h : geometry.l * 24 + 8 + geometry.sep * 16,
|
182
|
212
|
};
|
|
213
|
+
|
|
214
|
+ logprint(LOG_DEBUG, sprintf('geom id: %s, x: %d, y: %d, w: %d, h: %d, l: %d, sep: %d',
|
|
215
|
+ id, geometry.x, geometry.y, geometry.w, me.state[id].h_max, geometry.l, geometry.sep));
|
183
|
216
|
me.state[id].y_max = me.state[id].h_max + me.state[id].geometry.y;
|
184
|
217
|
me.window[id ~ '-bg'] = me.page.createChild('path');
|
185
|
218
|
me.window[id ~ '-bg']
|