cpee 2.1.23 → 2.1.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,7 @@ function WFAdaptorManifestation(adaptor) {
8
8
  this.compact = false;
9
9
  this.striped = true;
10
10
  this.endpoints = {};
11
+ this.presstimer;
11
12
 
12
13
  //{{{ transform the details data to description parts based on rng
13
14
  this.source = function(base,opts) {
@@ -137,93 +138,104 @@ function WFAdaptorManifestation(adaptor) {
137
138
  }
138
139
  } //}}}
139
140
 
140
- // Events
141
- this.events.mousedown = function(svgid, e, child, sibling) { // {{{
142
- if(e.button == 0) { // left-click
143
- } else if(e.button == 1) { // middle-click
144
- } else if(e.button == 2) { // right-click
145
- if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
141
+ function contextMenuHandling(svgid,e,child,sibling) { //{{{
142
+ if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
146
143
 
147
- var xml_node = self.adaptor.description.get_node_by_svg_id(svgid);
148
- var group = null;
149
- var menu = {};
144
+ var xml_node = self.adaptor.description.get_node_by_svg_id(svgid);
145
+ var group = null;
146
+ var menu = {};
150
147
 
151
- if (child) {
152
- group = self.elements[xml_node.get(0).tagName].permissible_children(xml_node,'into');
148
+ if (child) {
149
+ group = self.elements[xml_node.get(0).tagName].permissible_children(xml_node,'into');
150
+ if(group.length > 0) {
151
+ menu['Insert into'] = group;
152
+ copyOrMove(menu['Insert into'],group,xml_node,self.adaptor.description.insert_first_into);
153
+ }
154
+ if (self.elements[xml_node.get(0).tagName].permissible_children_expert) {
155
+ group = self.elements[xml_node.get(0).tagName].permissible_children_expert(xml_node,'into');
153
156
  if(group.length > 0) {
154
- menu['Insert into'] = group;
155
- copyOrMove(menu['Insert into'],group,xml_node,self.adaptor.description.insert_first_into);
156
- }
157
- if (self.elements[xml_node.get(0).tagName].permissible_children_expert) {
158
- group = self.elements[xml_node.get(0).tagName].permissible_children_expert(xml_node,'into');
159
- if(group.length > 0) {
160
- menu['Insert into (Experts Only!)'] = group;
161
- copyOrMove(menu['Insert into (Experts Only!)'],group,xml_node,self.adaptor.description.insert_first_into);
162
- }
157
+ menu['Insert into (Experts Only!)'] = group;
158
+ copyOrMove(menu['Insert into (Experts Only!)'],group,xml_node,self.adaptor.description.insert_first_into);
163
159
  }
164
160
  }
165
- if (sibling) {
166
- group = self.elements[xml_node.parent().get(0).tagName].permissible_children(xml_node,'after');
161
+ }
162
+ if (sibling) {
163
+ group = self.elements[xml_node.parent().get(0).tagName].permissible_children(xml_node,'after');
164
+ if(group.length > 0) {
165
+ menu['Insert after'] = group;
166
+ copyOrMove(menu['Insert after'],group,xml_node,self.adaptor.description.insert_after);
167
+ }
168
+ if (self.elements[xml_node.parent().get(0).tagName].permissible_children_expert) {
169
+ group = self.elements[xml_node.parent().get(0).tagName].permissible_children_expert(xml_node,'after');
167
170
  if(group.length > 0) {
168
- menu['Insert after'] = group;
169
- copyOrMove(menu['Insert after'],group,xml_node,self.adaptor.description.insert_after);
170
- }
171
- if (self.elements[xml_node.parent().get(0).tagName].permissible_children_expert) {
172
- group = self.elements[xml_node.parent().get(0).tagName].permissible_children_expert(xml_node,'after');
173
- if(group.length > 0) {
174
- menu['Insert after (Experts Only!)'] = group;
175
- copyOrMove(menu['Insert after (Experts Only!)'],group,xml_node,self.adaptor.description.insert_after);
176
- }
171
+ menu['Insert after (Experts Only!)'] = group;
172
+ copyOrMove(menu['Insert after (Experts Only!)'],group,xml_node,self.adaptor.description.insert_after);
177
173
  }
178
174
  }
175
+ }
179
176
 
180
- if(xml_node.get(0).tagName != 'description' && !self.elements[xml_node.get(0).tagName].neverdelete) {
181
- var icon = self.elements[xml_node.get(0).tagName].illustrator.svg.clone();
182
- icon.children('.rfill').addClass('menu');
183
- menu['Delete'] = [{
184
- 'label': 'Remove Element',
185
- 'function_call': function(selector,target,selected){ self.adaptor.description.remove(selector,target); self.adaptor.illustrator.get_label_by_svg_id(selected).addClass('selected'); },
186
- 'menu_icon': icon,
187
- 'type': undefined,
188
- 'params': [null, xml_node, self.selected()]
189
- }];
190
- }
191
- if($('> code', xml_node).length > 0 && xml_node.get(0).tagName == 'call') {
192
- var icon = self.elements.callmanipulate.illustrator.svg.clone();
193
- icon.children('.rfill:last').addClass('menu');
194
- menu['Delete'].push({
195
- 'label': 'Remove Scripts',
196
- 'function_call': self.adaptor.description.remove,
197
- 'menu_icon': icon,
198
- 'type': undefined,
199
- 'params': ['> code', xml_node]
200
- });
201
- }
202
- if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate" || xml_node.get(0).tagName == "stop") {
203
- var icon = self.elements.call.illustrator.svg.clone();
204
- icon.children('g.replace').addClass('active');
205
- var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
206
- if (vtarget.length > 0) {
207
- if (vtarget.parents('g.activities.passive, g.activities.active').length > 0) {
208
- menu['Position'] = [{
209
- 'label': 'No Execution from here',
210
- 'function_call': del_ui_pos,
211
- 'menu_icon': icon,
212
- 'type': undefined,
213
- 'params': xml_node
214
- }];
215
- } else {
216
- menu['Position'] = [{
217
- 'label': 'Execute from here',
218
- 'function_call': add_ui_pos,
219
- 'menu_icon': icon,
220
- 'type': undefined,
221
- 'params': xml_node
222
- }];
223
- }
177
+ if(xml_node.get(0).tagName != 'description' && !self.elements[xml_node.get(0).tagName].neverdelete) {
178
+ var icon = self.elements[xml_node.get(0).tagName].illustrator.svg.clone();
179
+ icon.children('.rfill').addClass('menu');
180
+ menu['Delete'] = [{
181
+ 'label': 'Remove Element',
182
+ 'function_call': function(selector,target,selected){ self.adaptor.description.remove(selector,target); self.adaptor.illustrator.get_label_by_svg_id(selected).addClass('selected'); },
183
+ 'menu_icon': icon,
184
+ 'type': undefined,
185
+ 'params': [null, xml_node, self.selected()]
186
+ }];
187
+ }
188
+ if($('> code', xml_node).length > 0 && xml_node.get(0).tagName == 'call') {
189
+ var icon = self.elements.callmanipulate.illustrator.svg.clone();
190
+ icon.children('.rfill:last').addClass('menu');
191
+ menu['Delete'].push({
192
+ 'label': 'Remove Scripts',
193
+ 'function_call': self.adaptor.description.remove,
194
+ 'menu_icon': icon,
195
+ 'type': undefined,
196
+ 'params': ['> code', xml_node]
197
+ });
198
+ }
199
+ if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate" || xml_node.get(0).tagName == "stop") {
200
+ var icon = self.elements.call.illustrator.svg.clone();
201
+ icon.children('g.replace').addClass('active');
202
+ var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
203
+ if (vtarget.length > 0) {
204
+ if (vtarget.parents('g.activities.passive, g.activities.active').length > 0) {
205
+ menu['Position'] = [{
206
+ 'label': 'No Execution from here',
207
+ 'function_call': del_ui_pos,
208
+ 'menu_icon': icon,
209
+ 'type': undefined,
210
+ 'params': xml_node
211
+ }];
212
+ } else {
213
+ menu['Position'] = [{
214
+ 'label': 'Execute from here',
215
+ 'function_call': add_ui_pos,
216
+ 'menu_icon': icon,
217
+ 'type': undefined,
218
+ 'params': xml_node
219
+ }];
224
220
  }
225
221
  }
226
- new CustomMenu(e).contextmenu(menu);
222
+ }
223
+ new CustomMenu(e).contextmenu(menu);
224
+ } //}}}
225
+
226
+ // Events
227
+ this.events.touchend = function(svgid, e) { // {{{
228
+ clearTimeout(self.presstimer);
229
+ } // }}}
230
+ this.events.touchstart = function(svgid, e, child, sibling) { // {{{
231
+ self.presstimer = window.setTimeout(function() { contextMenuHandling(svgid,e,child,sibling); },1000);
232
+ return false;
233
+ } // }}}
234
+ this.events.mousedown = function(svgid, e, child, sibling) { // {{{
235
+ if(e.button == 0) { // left-click
236
+ } else if(e.button == 1) { // middle-click
237
+ } else if(e.button == 2) { // right-click
238
+ contextMenuHandling(svgid,e,child,sibling);
227
239
  }
228
240
  return false;
229
241
  } // }}}
@@ -339,6 +351,8 @@ function WFAdaptorManifestation(adaptor) {
339
351
  }, //}}}
340
352
  'adaptor': {//{{{
341
353
  'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
354
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
355
+ 'touchend': self.events.touchend,
342
356
  'click': self.events.click,
343
357
  'dragstart': self.events.dragstart,
344
358
  'mouseover': self.events.mouseover,
@@ -365,6 +379,8 @@ function WFAdaptorManifestation(adaptor) {
365
379
  }, //}}}
366
380
  'adaptor': {//{{{
367
381
  'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
382
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,false,true); },
383
+ 'touchend': self.events.touchend,
368
384
  'click': self.events.click,
369
385
  'mouseover': self.events.mouseover,
370
386
  'mouseout': self.events.mouseout
@@ -382,6 +398,8 @@ function WFAdaptorManifestation(adaptor) {
382
398
  }, //}}}
383
399
  'adaptor': {//{{{
384
400
  'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
401
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,false,true); },
402
+ 'touchend': self.events.touchend,
385
403
  'click': self.events.click,
386
404
  'mouseover': self.events.mouseover,
387
405
  'mouseout': self.events.mouseout
@@ -402,6 +420,8 @@ function WFAdaptorManifestation(adaptor) {
402
420
  }, //}}}
403
421
  'adaptor': {//{{{
404
422
  'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
423
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,false,true); },
424
+ 'touchend': self.events.touchend,
405
425
  'click': self.events.click,
406
426
  'mouseover': self.events.mouseover,
407
427
  'mouseout': self.events.mouseout
@@ -420,6 +440,8 @@ function WFAdaptorManifestation(adaptor) {
420
440
  }, //}}}
421
441
  'adaptor': {//{{{
422
442
  'mousedown': function (node,e) { self.events.mousedown(node,e,false,false); },
443
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,false,false); },
444
+ 'touchend': self.events.touchend,
423
445
  'mouseover': self.events.mouseover,
424
446
  'mouseout': self.events.mouseout
425
447
  }//}}}
@@ -431,9 +453,7 @@ function WFAdaptorManifestation(adaptor) {
431
453
  'svg': self.adaptor.theme_dir + 'symbols/end.svg'
432
454
  }, //}}}
433
455
  'adaptor': {//{{{
434
- 'mousedown': function (node,e) {
435
- self.events.suppress();
436
- }
456
+ 'mousedown': function (node,e) { self.events.suppress(); }
437
457
  }//}}}
438
458
  }; /*}}}*/
439
459
  this.elements.event_end = { /*{{{*/
@@ -443,9 +463,7 @@ function WFAdaptorManifestation(adaptor) {
443
463
  'svg': self.adaptor.theme_dir + 'symbols/event_end.svg'
444
464
  }, //}}}
445
465
  'adaptor': {//{{{
446
- 'mousedown': function (node,e) {
447
- self.events.suppress();
448
- },
466
+ 'mousedown': function (node,e) { self.events.suppress(); },
449
467
  'click': self.events.click,
450
468
  'dblclick': self.events.dblclick,
451
469
  'mouseover': self.events.mouseover,
@@ -466,9 +484,9 @@ function WFAdaptorManifestation(adaptor) {
466
484
  },
467
485
  }, //}}}
468
486
  'adaptor': {//{{{
469
- 'mousedown': function (node,e) {
470
- self.events.mousedown(node,e,true,true);
471
- },
487
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
488
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
489
+ 'touchend': self.events.touchend,
472
490
  'click': self.events.click,
473
491
  'dblclick': self.events.dblclick,
474
492
  'mouseover': self.events.mouseover,
@@ -491,9 +509,9 @@ function WFAdaptorManifestation(adaptor) {
491
509
  'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg',
492
510
  }, //}}}
493
511
  'adaptor': {//{{{
494
- 'mousedown': function (node,e) {
495
- self.events.mousedown(node,e,true,true);
496
- },
512
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
513
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
514
+ 'touchend': self.events.touchend,
497
515
  'click': self.events.click,
498
516
  'dblclick': self.events.dblclick,
499
517
  'mouseover': self.events.mouseover,
@@ -518,9 +536,9 @@ function WFAdaptorManifestation(adaptor) {
518
536
  },
519
537
  }, //}}}
520
538
  'adaptor': {//{{{
521
- 'mousedown': function (node,e) {
522
- self.events.mousedown(node,e,true,true);
523
- },
539
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
540
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
541
+ 'touchend': self.events.touchend,
524
542
  'click': self.events.click,
525
543
  'dblclick': self.events.dblclick,
526
544
  'mouseover': self.events.mouseover,
@@ -583,9 +601,9 @@ function WFAdaptorManifestation(adaptor) {
583
601
  return childs;
584
602
  }, //}}}
585
603
  'adaptor': {//{{{
586
- 'mousedown': function (node,e) {
587
- self.events.mousedown(node,e,true,true);
588
- },
604
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
605
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
606
+ 'touchend': self.events.touchend,
589
607
  'click': self.events.click,
590
608
  'dblclick': self.events.dblclick,
591
609
  'mouseover': self.events.mouseover,
@@ -671,9 +689,9 @@ function WFAdaptorManifestation(adaptor) {
671
689
  return childs;
672
690
  }, //}}}
673
691
  'adaptor': {//{{{
674
- 'mousedown': function (node,e) {
675
- self.events.mousedown(node,e,true,false);
676
- },
692
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,false); },
693
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,false); },
694
+ 'touchend': self.events.touchend,
677
695
  'click': self.events.click,
678
696
  'dblclick': self.events.dblclick,
679
697
  'mouseover': self.events.mouseover,
@@ -767,9 +785,9 @@ function WFAdaptorManifestation(adaptor) {
767
785
  return childs;
768
786
  }, //}}}
769
787
  'adaptor': {//{{{
770
- 'mousedown': function (node,e) {
771
- self.events.mousedown(node,e,true,true);
772
- },
788
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
789
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
790
+ 'touchend': self.events.touchend,
773
791
  'click': self.events.click,
774
792
  'dblclick': self.events.dblclick,
775
793
  'mouseover': self.events.mouseover,
@@ -863,9 +881,9 @@ function WFAdaptorManifestation(adaptor) {
863
881
  return childs;
864
882
  }, //}}}
865
883
  'adaptor': {//{{{
866
- 'mousedown': function (node,e) {
867
- self.events.mousedown(node,e,true,true);
868
- },
884
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
885
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
886
+ 'touchend': self.events.touchend,
869
887
  'click': self.events.click,
870
888
  'dblclick': self.events.dblclick,
871
889
  'mouseover': self.events.mouseover,
@@ -956,9 +974,9 @@ function WFAdaptorManifestation(adaptor) {
956
974
  return childs;
957
975
  }, //}}}
958
976
  'adaptor': {//{{{
959
- 'mousedown': function (node,e) {
960
- self.events.mousedown(node,e,true,true);
961
- },
977
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
978
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
979
+ 'touchend': self.events.touchend,
962
980
  'click': self.events.click,
963
981
  'dblclick': self.events.dblclick,
964
982
  'mouseover': self.events.mouseover,
@@ -1050,9 +1068,9 @@ function WFAdaptorManifestation(adaptor) {
1050
1068
  return childs;
1051
1069
  }, //}}}
1052
1070
  'adaptor': {//{{{
1053
- 'mousedown': function (node,e) {
1054
- self.events.mousedown(node,e,true,true);
1055
- },
1071
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1072
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1073
+ 'touchend': self.events.touchend,
1056
1074
  'click': self.events.click,
1057
1075
  'dblclick': self.events.dblclick,
1058
1076
  'mouseover': self.events.mouseover,
@@ -1132,9 +1150,9 @@ function WFAdaptorManifestation(adaptor) {
1132
1150
  return childs;
1133
1151
  }, //}}}
1134
1152
  'adaptor': {//{{{
1135
- 'mousedown': function (node,e) {
1136
- self.events.mousedown(node,e,true,true);
1137
- },
1153
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1154
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1155
+ 'touchend': self.events.touchend,
1138
1156
  'click': self.events.click,
1139
1157
  'dblclick': self.events.dblclick,
1140
1158
  'mouseover': self.events.mouseover,
@@ -1164,9 +1182,9 @@ function WFAdaptorManifestation(adaptor) {
1164
1182
  ];
1165
1183
  }, //}}}
1166
1184
  'adaptor': {//{{{
1167
- 'mousedown': function (node,e) {
1168
- self.events.mousedown(node,e,true,true);
1169
- },
1185
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1186
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1187
+ 'touchend': self.events.touchend,
1170
1188
  'click': self.events.click,
1171
1189
  'dblclick': self.events.dblclick,
1172
1190
  'mouseover': self.events.mouseover,
@@ -1243,9 +1261,9 @@ function WFAdaptorManifestation(adaptor) {
1243
1261
  return childs;
1244
1262
  }, //}}}
1245
1263
  'adaptor': {//{{{
1246
- 'mousedown': function (node,e) {
1247
- self.events.mousedown(node,e,true,false);
1248
- },
1264
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,false); },
1265
+ 'touchstart': function (node,e) { self.events.touchstart(node,e,true,false); },
1266
+ 'touchend': self.events.touchend,
1249
1267
  'click': self.events.click,
1250
1268
  'dblclick': self.events.dblclick,
1251
1269
  'mouseover': self.events.mouseover,