1
|
=== modified file 'rules/annotations/ocx_conversion.rules'
|
2
|
--- rules/annotations/ocx_conversion.rules 2020-05-14 18:36:54 +0000
|
3
|
+++ rules/annotations/ocx_conversion.rules 2020-05-19 19:48:15 +0000
|
4
|
@@ -341,7 +341,7 @@
|
5
|
<!-- Calendar -->
|
6
|
<action>map6 = create("java.util.HashMap")</action>
|
7
|
<action>map6.put("value" , "DateTimeValue")</action>
|
8
|
- <action>map6.put("CheckBox" , "Checked")</action>
|
9
|
+ <action>map6.put("checkbox" , "Checked")</action>
|
10
|
<action>map6.put("font" , "FontInfo")</action>
|
11
|
<action>map6.put("format" , "FormatStyle")</action>
|
12
|
<action>aliasMap.put("CALENDAR" , map6)</action>
|
13
|
@@ -352,6 +352,8 @@
|
14
|
<action>mapRef.put("key", "NodeKey")</action>
|
15
|
<action>mapRef.put("index", "TreeNodeIndex")</action>
|
16
|
<action>mapRef.put("text", "NodeText")</action>
|
17
|
+ <action>mapRef.put("selectedimage", "ExpandNodeIcon")</action>
|
18
|
+ <action>mapRef.put("image", "NodeIcon")</action>
|
19
|
<action>aliasMap.put("COM.GOLDENCODE.P2J.UI.TREENODEFACE", mapRef)</action>
|
20
|
</rule>
|
21
|
</init-rules>
|
22
|
@@ -405,8 +407,13 @@
|
23
|
</rule>
|
24
|
</rule>
|
25
|
|
26
|
+ <rule>memberName != null
|
27
|
+ <action>printfln("memberName = %s", memberName)</action>
|
28
|
+ </rule>
|
29
|
+
|
30
|
<rule>memberName == null
|
31
|
<action>memberName = ref.text</action>
|
32
|
+ <action>printfln("memberName = ref.text = %s", ref.text)</action>
|
33
|
</rule>
|
34
|
|
35
|
<action>methodName = getMethodNoCase(javaClass, memberName)</action>
|
36
|
|
37
|
=== modified file 'rules/convert/builtin_functions.rules'
|
38
|
--- rules/convert/builtin_functions.rules 2020-05-03 20:30:03 +0000
|
39
|
+++ rules/convert/builtin_functions.rules 2020-05-20 06:59:23 +0000
|
40
|
@@ -621,6 +621,11 @@
|
41
|
<action>methodType = java.static_method_call</action>
|
42
|
</rule>
|
43
|
|
44
|
+ <rule>ftype == prog.kw_load_pic
|
45
|
+ <action>methodText = "com.goldencode.p2j.ui.ocx.ListImage.newInstance"</action>
|
46
|
+ <action>methodType = java.static_method_call</action>
|
47
|
+ </rule>
|
48
|
+
|
49
|
<rule>ftype == prog.kw_dyn_enum
|
50
|
<action>methodText = "ObjectOps.newDynamicEnum"</action>
|
51
|
<action>methodType = java.static_method_call</action>
|
52
|
|
53
|
=== modified file 'rules/gaps/expressions.rules'
|
54
|
--- rules/gaps/expressions.rules 2020-05-03 20:30:03 +0000
|
55
|
+++ rules/gaps/expressions.rules 2020-05-20 06:50:41 +0000
|
56
|
@@ -476,7 +476,7 @@
|
57
|
<rule>funcs.put(prog.kw_length , rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
58
|
<rule>funcs.put(prog.kw_lib , rw.cvt_lvl_none | rw.rt_lvl_none)</rule> <!-- library is not supported -->
|
59
|
<rule>funcs.put(prog.kw_line_cnt, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
60
|
- <rule>funcs.put(prog.kw_load_pic, rw.cvt_lvl_none | rw.rt_lvl_none)</rule> <!-- load-picture is not supported, supposed to be a statement but really acts like a function -->
|
61
|
+ <rule>funcs.put(prog.kw_load_pic, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
62
|
<rule>funcs.put(prog.kw_locked , rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
63
|
<rule>funcs.put(prog.kw_log , rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
64
|
<rule>funcs.put(prog.kw_logical , rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
65
|
|
66
|
=== modified file 'src/com/goldencode/p2j/ui/ImageList.java'
|
67
|
--- src/com/goldencode/p2j/ui/ImageList.java 2019-11-14 14:48:19 +0000
|
68
|
+++ src/com/goldencode/p2j/ui/ImageList.java 2020-05-20 08:14:37 +0000
|
69
|
@@ -63,12 +63,13 @@
|
70
|
|
71
|
package com.goldencode.p2j.ui;
|
72
|
|
73
|
+import com.goldencode.p2j.ui.ocx.ListImages;
|
74
|
import com.goldencode.p2j.util.*;
|
75
|
|
76
|
/**
|
77
|
* IMAGELIST resource interface.
|
78
|
*/
|
79
|
-public interface ImageList
|
80
|
+public interface ImageList extends WrappedResource
|
81
|
{
|
82
|
/**
|
83
|
* Adds an image to the list.
|
84
|
@@ -172,8 +173,9 @@
|
85
|
*
|
86
|
* @return ListImages COM interface.
|
87
|
*/
|
88
|
+ @ResourceType(type = ListImages.class)
|
89
|
@LegacyMethod(name = "IL-LIST-IMAGES")
|
90
|
- public comhandle getListImages();
|
91
|
+ public handle getListImages();
|
92
|
|
93
|
/**
|
94
|
* Get a value which determine the color to be transparent in ImageList graphical operation.
|
95
|
|
96
|
=== modified file 'src/com/goldencode/p2j/ui/ImageListWidget.java'
|
97
|
--- src/com/goldencode/p2j/ui/ImageListWidget.java 2019-12-09 12:20:19 +0000
|
98
|
+++ src/com/goldencode/p2j/ui/ImageListWidget.java 2020-05-19 08:36:26 +0000
|
99
|
@@ -80,7 +80,7 @@
|
100
|
private List<Integer> imgIds = new ArrayList<>();
|
101
|
|
102
|
/** Handle to access internal ImageList COM Interfaces*/
|
103
|
- private comhandle listImages = ListImages.newInstance(this);
|
104
|
+ private handle listImages = ListImages.newInstance(this);
|
105
|
|
106
|
/**
|
107
|
* Default constructor.
|
108
|
@@ -258,7 +258,7 @@
|
109
|
* {@inheritDoc}
|
110
|
*/
|
111
|
@Override
|
112
|
- public comhandle getListImages()
|
113
|
+ public handle getListImages()
|
114
|
{
|
115
|
return listImages;
|
116
|
}
|
117
|
|
118
|
=== modified file 'src/com/goldencode/p2j/ui/TreeFace.java'
|
119
|
--- src/com/goldencode/p2j/ui/TreeFace.java 2020-03-17 02:40:10 +0000
|
120
|
+++ src/com/goldencode/p2j/ui/TreeFace.java 2020-05-19 17:31:29 +0000
|
121
|
@@ -1006,7 +1006,17 @@
|
122
|
*/
|
123
|
@LegacyAttribute(name = "IMAGE-LIST", setter = true)
|
124
|
void setImageList(handle imgList);
|
125
|
-
|
126
|
+
|
127
|
+ /**
|
128
|
+ * Assigns an imagelist resource to the tree. When an imagelist is assigned, all images set to the tree
|
129
|
+ * are taken from the imagelist.
|
130
|
+ *
|
131
|
+ * @param imgList
|
132
|
+ * The image list to assign.
|
133
|
+ */
|
134
|
+ @LegacyAttribute(name = "IMAGE-LIST", setter = true)
|
135
|
+ void setImageList(ImageList imgList);
|
136
|
+
|
137
|
/**
|
138
|
* Get the TreeView node under mouse cursor as a node handle.
|
139
|
* If no node under cursor return unknown value.
|
140
|
|
141
|
=== modified file 'src/com/goldencode/p2j/ui/TreeNodeCollection.java'
|
142
|
--- src/com/goldencode/p2j/ui/TreeNodeCollection.java 2020-05-02 18:57:16 +0000
|
143
|
+++ src/com/goldencode/p2j/ui/TreeNodeCollection.java 2020-05-19 08:55:43 +0000
|
144
|
@@ -204,6 +204,33 @@
|
145
|
handle add(NumberType anchorIndex, NumberType relationType, character key, character text);
|
146
|
|
147
|
/**
|
148
|
+ * Adds a new tree node as a first, last, next, previous or child node relative to the anchor
|
149
|
+ * node given by its index.
|
150
|
+ *
|
151
|
+ * @param anchorIndex
|
152
|
+ * The anchor node index
|
153
|
+ * @param relationType
|
154
|
+ * The relation type: first(0), last(1), next(2), previous(3) and child(4)
|
155
|
+ * @param key
|
156
|
+ * The key of the new node
|
157
|
+ * @param text
|
158
|
+ * The label of the new node
|
159
|
+ * @param nodeIcon
|
160
|
+ * The node icon index within its tree images list
|
161
|
+ * @param expandNodeIcon
|
162
|
+ * The expand node icon index within its tree images list
|
163
|
+ *
|
164
|
+ * @return The handle to the new node.
|
165
|
+ */
|
166
|
+ @ResourceType(type = TreeNodeFace.class)
|
167
|
+ handle add(NumberType anchorIndex,
|
168
|
+ NumberType relationType,
|
169
|
+ character key,
|
170
|
+ character text,
|
171
|
+ NumberType nodeIcon,
|
172
|
+ NumberType expandNodeIcon);
|
173
|
+
|
174
|
+ /**
|
175
|
* Adds a new tree node as a last node relative to the root tree node. This node has a default
|
176
|
* " " value for NODE-VALUE (KEY) and TEXT attributes.
|
177
|
*
|
178
|
|
179
|
=== modified file 'src/com/goldencode/p2j/ui/TreeNodeCollectionResource.java'
|
180
|
--- src/com/goldencode/p2j/ui/TreeNodeCollectionResource.java 2020-05-02 18:57:16 +0000
|
181
|
+++ src/com/goldencode/p2j/ui/TreeNodeCollectionResource.java 2020-05-20 07:32:41 +0000
|
182
|
@@ -515,6 +515,47 @@
|
183
|
}
|
184
|
|
185
|
/**
|
186
|
+ * Adds a new tree node as a first, last, next, previous or child node relative to the anchor
|
187
|
+ * node given by its index.
|
188
|
+ *
|
189
|
+ * @param anchorIndex
|
190
|
+ * The anchor node index
|
191
|
+ * @param relationType
|
192
|
+ * The relation type: first(0), last(1), next(2), previous(3) and child(4)
|
193
|
+ * @param key
|
194
|
+ * The key of the new node
|
195
|
+ * @param text
|
196
|
+ * The label of the new node
|
197
|
+ * @param nodeIcon
|
198
|
+ * The node icon index within its tree images list
|
199
|
+ * @param expandNodeIcon
|
200
|
+ * The expand node icon index within its tree images list
|
201
|
+ *
|
202
|
+ * @return The handle to the new node.
|
203
|
+ */
|
204
|
+ @Override
|
205
|
+ public handle add(NumberType anchorIndex,
|
206
|
+ NumberType relationType,
|
207
|
+ character key,
|
208
|
+ character text,
|
209
|
+ NumberType nodeIcon,
|
210
|
+ NumberType expandNodeIcon)
|
211
|
+ {
|
212
|
+ handle hNode = add(anchorIndex, relationType, key, text);
|
213
|
+
|
214
|
+ if (hNode._isValid())
|
215
|
+ {
|
216
|
+ TreeNodeFace node = hNode.unwrapTreeNodeFace();
|
217
|
+
|
218
|
+ node.setNodeIcon(nodeIcon);
|
219
|
+
|
220
|
+ node.setExpandNodeIcon(expandNodeIcon);
|
221
|
+ }
|
222
|
+
|
223
|
+ return hNode;
|
224
|
+ }
|
225
|
+
|
226
|
+ /**
|
227
|
* Worker to be implemented by each resource. Called by {@link #delete()}.
|
228
|
*
|
229
|
* @return <code>true</code> if the resource was deleted.
|
230
|
|
231
|
=== modified file 'src/com/goldencode/p2j/ui/TreeWidgetBase.java'
|
232
|
--- src/com/goldencode/p2j/ui/TreeWidgetBase.java 2020-05-14 18:36:54 +0000
|
233
|
+++ src/com/goldencode/p2j/ui/TreeWidgetBase.java 2020-05-20 08:16:36 +0000
|
234
|
@@ -1753,6 +1753,31 @@
|
235
|
}
|
236
|
|
237
|
/**
|
238
|
+ * Assigns an imagelist resource to the tree. When an imagelist is assigned, all images set to the tree
|
239
|
+ * are taken from the imagelist.
|
240
|
+ *
|
241
|
+ * @param imgList
|
242
|
+ * The image list to assign.
|
243
|
+ */
|
244
|
+ @Override
|
245
|
+ public void setImageList(ImageList imgList)
|
246
|
+ {
|
247
|
+ if (imgList != null && imgList.id() != null)
|
248
|
+ {
|
249
|
+ imageList = new handle(imgList);
|
250
|
+
|
251
|
+ config.imageListId = imgList.id().intValue();
|
252
|
+ }
|
253
|
+ else
|
254
|
+ {
|
255
|
+ imageList = null;
|
256
|
+ config.imageListId = -1;
|
257
|
+ }
|
258
|
+
|
259
|
+ pushWidgetAttr("imageListId", config.imageListId);
|
260
|
+ }
|
261
|
+
|
262
|
+ /**
|
263
|
* Delete the resource.
|
264
|
*
|
265
|
* @return <code>true</code> if the resource was deleted.
|
266
|
|
267
|
=== modified file 'src/com/goldencode/p2j/ui/ocx/ComInterface.java'
|
268
|
--- src/com/goldencode/p2j/ui/ocx/ComInterface.java 2019-11-06 16:02:21 +0000
|
269
|
+++ src/com/goldencode/p2j/ui/ocx/ComInterface.java 2020-05-20 05:29:40 +0000
|
270
|
@@ -112,7 +112,12 @@
|
271
|
@Override
|
272
|
public boolean valid()
|
273
|
{
|
274
|
- return parent.valid();
|
275
|
+ if (parent != null)
|
276
|
+ {
|
277
|
+ return parent.valid();
|
278
|
+ }
|
279
|
+
|
280
|
+ return false;
|
281
|
}
|
282
|
|
283
|
/**
|
284
|
@@ -130,6 +135,11 @@
|
285
|
@Override
|
286
|
public String getName()
|
287
|
{
|
288
|
- return parent.name().toStringMessage();
|
289
|
+ if (parent != null)
|
290
|
+ {
|
291
|
+ return parent.name().toStringMessage();
|
292
|
+ }
|
293
|
+
|
294
|
+ return "?";
|
295
|
}
|
296
|
}
|
297
|
|
298
|
=== modified file 'src/com/goldencode/p2j/ui/ocx/ListImage.java'
|
299
|
--- src/com/goldencode/p2j/ui/ocx/ListImage.java 2019-11-07 15:56:38 +0000
|
300
|
+++ src/com/goldencode/p2j/ui/ocx/ListImage.java 2020-05-20 07:08:24 +0000
|
301
|
@@ -63,6 +63,8 @@
|
302
|
|
303
|
package com.goldencode.p2j.ui.ocx;
|
304
|
|
305
|
+import java.util.function.Function;
|
306
|
+
|
307
|
import com.goldencode.p2j.comauto.*;
|
308
|
import com.goldencode.p2j.ui.*;
|
309
|
import com.goldencode.p2j.util.*;
|
310
|
@@ -78,6 +80,12 @@
|
311
|
extends ComInterface
|
312
|
implements IImage
|
313
|
{
|
314
|
+ /** The unique image id */
|
315
|
+ private integer index;
|
316
|
+
|
317
|
+ /** The system file path to the binary image */
|
318
|
+ private character key;
|
319
|
+
|
320
|
/**
|
321
|
* Constructor.
|
322
|
*
|
323
|
@@ -88,6 +96,19 @@
|
324
|
{
|
325
|
super(IImage.class.getName(), parent);
|
326
|
}
|
327
|
+
|
328
|
+ /**
|
329
|
+ * Create a detached instance of an image that can be attached to a widget later.
|
330
|
+ *
|
331
|
+ * @param pathToImage
|
332
|
+ * The file system path to the image file.
|
333
|
+ */
|
334
|
+ private ListImage(character pathToImage)
|
335
|
+ {
|
336
|
+ super(IImage.class.getName(), null);
|
337
|
+
|
338
|
+ key = pathToImage;
|
339
|
+ }
|
340
|
|
341
|
/**
|
342
|
* Factory method.
|
343
|
@@ -103,6 +124,33 @@
|
344
|
}
|
345
|
|
346
|
/**
|
347
|
+ * Creates a detached instance of an image
|
348
|
+ *
|
349
|
+ * @param pathToImage
|
350
|
+ * The file system path to the image file.
|
351
|
+ *
|
352
|
+ * @return a new instance wrapped in a comhandle.
|
353
|
+ */
|
354
|
+ public static comhandle newInstance(String pathToImage)
|
355
|
+ {
|
356
|
+ return newInstance(new character(pathToImage));
|
357
|
+ }
|
358
|
+
|
359
|
+ /**
|
360
|
+ * Creates a detached instance of an image
|
361
|
+ *
|
362
|
+ * @param pathToImage
|
363
|
+ * The file system path to the image file.
|
364
|
+ *
|
365
|
+ * @return a new instance wrapped in a comhandle.
|
366
|
+ */
|
367
|
+ public static comhandle newInstance(character pathToImage)
|
368
|
+ {
|
369
|
+ return new comhandle(new ListImage(pathToImage));
|
370
|
+ }
|
371
|
+
|
372
|
+ //public static comhandle newInstance
|
373
|
+ /**
|
374
|
* {@inheritDoc}
|
375
|
*/
|
376
|
@ComMethod(name = "DRAW")
|
377
|
@@ -135,7 +183,7 @@
|
378
|
@ComProperty(name = "INDEX")
|
379
|
public void setIndex(integer index)
|
380
|
{
|
381
|
- // nop
|
382
|
+ this.index = index;
|
383
|
}
|
384
|
|
385
|
/**
|
386
|
@@ -144,7 +192,7 @@
|
387
|
@ComProperty(name = "INDEX")
|
388
|
public void setIndex(int index)
|
389
|
{
|
390
|
- // nop
|
391
|
+ this.index = new integer(index);
|
392
|
}
|
393
|
|
394
|
/**
|
395
|
@@ -153,7 +201,12 @@
|
396
|
@ComProperty(name = "KEY")
|
397
|
public character getKey()
|
398
|
{
|
399
|
- return new character();
|
400
|
+ if (key == null)
|
401
|
+ {
|
402
|
+ return new character();
|
403
|
+ }
|
404
|
+
|
405
|
+ return key;
|
406
|
}
|
407
|
|
408
|
/**
|
409
|
@@ -162,7 +215,7 @@
|
410
|
@ComProperty(name = "KEY")
|
411
|
public void setKey(character key)
|
412
|
{
|
413
|
- // nop
|
414
|
+ this.key = key;
|
415
|
}
|
416
|
|
417
|
/**
|
418
|
@@ -171,7 +224,7 @@
|
419
|
@ComProperty(name = "KEY")
|
420
|
public void setKey(String key)
|
421
|
{
|
422
|
- // nop
|
423
|
+ this.key = new character(key);
|
424
|
}
|
425
|
|
426
|
/**
|
427
|
@@ -209,4 +262,15 @@
|
428
|
{
|
429
|
// nop
|
430
|
}
|
431
|
+
|
432
|
+ /**
|
433
|
+ * Attach this iamge to the parent widget.
|
434
|
+ *
|
435
|
+ * @param parent
|
436
|
+ * The parent widget
|
437
|
+ */
|
438
|
+ public void setParent(GenericWidget parent)
|
439
|
+ {
|
440
|
+ this.parent = parent;
|
441
|
+ }
|
442
|
}
|
443
|
|
444
|
=== modified file 'src/com/goldencode/p2j/ui/ocx/ListImages.java'
|
445
|
--- src/com/goldencode/p2j/ui/ocx/ListImages.java 2019-11-07 15:56:38 +0000
|
446
|
+++ src/com/goldencode/p2j/ui/ocx/ListImages.java 2020-05-20 08:21:35 +0000
|
447
|
@@ -97,9 +97,9 @@
|
448
|
*
|
449
|
* @return a new instance wrapped in a comhandle.
|
450
|
*/
|
451
|
- public static comhandle newInstance(GenericWidget parent)
|
452
|
+ public static handle newInstance(GenericWidget parent)
|
453
|
{
|
454
|
- return new comhandle(new ListImages(parent));
|
455
|
+ return new handle(new ListImages(parent));
|
456
|
}
|
457
|
|
458
|
/**
|
459
|
@@ -108,8 +108,35 @@
|
460
|
@ComMethod(name = "ADD")
|
461
|
public comhandle add(integer index, character key, comhandle picture)
|
462
|
{
|
463
|
+ character pathToImage;
|
464
|
+
|
465
|
+ IImage unwrappedImage;
|
466
|
+
|
467
|
+ if (picture != null && picture.getResource() instanceof IImage)
|
468
|
+ {
|
469
|
+ unwrappedImage = (IImage) picture.getResource();
|
470
|
+ pathToImage = unwrappedImage.getKey();
|
471
|
+ }
|
472
|
+ else
|
473
|
+ {
|
474
|
+ unwrappedImage = null;
|
475
|
+ pathToImage = key;
|
476
|
+ }
|
477
|
+
|
478
|
ImageListWidget w = (ImageListWidget) parent;
|
479
|
- w.addImage(key);
|
480
|
+
|
481
|
+ integer imageId = w.addImage(pathToImage);
|
482
|
+
|
483
|
+ if (unwrappedImage != null)
|
484
|
+ {
|
485
|
+ unwrappedImage.setIndex(imageId);
|
486
|
+
|
487
|
+ if (unwrappedImage instanceof ListImage)
|
488
|
+ {
|
489
|
+ ((ListImage) unwrappedImage).setParent(parent);
|
490
|
+ }
|
491
|
+ }
|
492
|
+
|
493
|
return picture;
|
494
|
}
|
495
|
|
496
|
@@ -173,7 +200,9 @@
|
497
|
@ComProperty(name = "COUNT")
|
498
|
public integer getCount()
|
499
|
{
|
500
|
- return new integer(0);
|
501
|
+ ImageListWidget w = (ImageListWidget) parent;
|
502
|
+
|
503
|
+ return new integer(w.getImageIds().length);
|
504
|
}
|
505
|
|
506
|
/**
|
507
|
@@ -211,4 +240,6 @@
|
508
|
{
|
509
|
// nop
|
510
|
}
|
511
|
+
|
512
|
+
|
513
|
}
|
514
|
|
515
|
=== modified file 'src/com/goldencode/p2j/util/handle.java'
|
516
|
--- src/com/goldencode/p2j/util/handle.java 2020-04-27 16:17:03 +0000
|
517
|
+++ src/com/goldencode/p2j/util/handle.java 2020-05-15 13:16:49 +0000
|
518
|
@@ -292,6 +292,7 @@
|
519
|
import com.goldencode.p2j.ui.*;
|
520
|
/** Calendar must be imported explicitly */
|
521
|
import com.goldencode.p2j.ui.Calendar;
|
522
|
+import com.goldencode.p2j.ui.ocx.ListImages;
|
523
|
import com.goldencode.p2j.xml.*;
|
524
|
import com.goldencode.proxy.*;
|
525
|
|
526
|
@@ -1948,6 +1949,11 @@
|
527
|
return unwrapImpl(this, CommonLastEvent.class);
|
528
|
}
|
529
|
|
530
|
+ public ListImages unwrapListImages()
|
531
|
+ {
|
532
|
+ return unwrapImpl(this, ListImages.class);
|
533
|
+ }
|
534
|
+
|
535
|
/**
|
536
|
* Unwrap this handle to a {@link LegacyLogManager} instance. If the
|
537
|
* handle is not the LOG-MANAGER or DSLOG-MANAGER handle or is invalid, an
|
538
|
|