Fix #8046 - meson generation option (so we can edit the language server..)
[roobuilder] / src / Builder4 / WindowLeftProps.vala
1 static Xcls_LeftProps  _LeftProps;
2
3 public class Xcls_LeftProps : Object
4 {
5         public Gtk.Box el;
6         private Xcls_LeftProps  _this;
7
8         public static Xcls_LeftProps singleton()
9         {
10                 if (_LeftProps == null) {
11                     _LeftProps= new Xcls_LeftProps();
12                 }
13                 return _LeftProps;
14         }
15         public Xcls_addpop addpop;
16         public Xcls_EditProps EditProps;
17         public Xcls_view view;
18         public Xcls_deletemenu deletemenu;
19         public Xcls_selmodel selmodel;
20         public Xcls_model model;
21         public Xcls_keycol keycol;
22         public Xcls_valcol valcol;
23         public Xcls_ContextMenu ContextMenu;
24
25                 // my vars (def)
26         public bool loading;
27         public bool allow_edit;
28         public signal void show_add_props (string type);
29         public signal bool stop_editor ();
30         public Xcls_MainWindow main_window;
31         public int last_error_counter;
32         public signal void changed ();
33         public JsRender.JsRender file;
34         public JsRender.Node node;
35         public signal void show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
36         public Gee.ArrayList<Gtk.Widget>? error_widgets;
37
38         // ctor
39         public Xcls_LeftProps()
40         {
41                 _this = this;
42                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
43
44                 // my vars (dec)
45                 this.loading = false;
46                 this.allow_edit = false;
47                 this.main_window = null;
48                 this.last_error_counter = -1;
49                 this.error_widgets = null;
50
51                 // set gobject values
52                 this.el.homogeneous = false   ;
53                 this.el.hexpand = true;
54                 this.el.vexpand = true;
55                 var child_1 = new Xcls_Box1( _this );
56                 child_1.ref();
57                 this.el.append( child_1.el );
58                 new Xcls_EditProps( _this );
59                 this.el.append( _this.EditProps.el );
60         }
61
62         // user defined functions
63         public string keySortFormat (string key) {
64             // listeners first - with 0
65             // specials
66             if (key[0] == '*') {
67                 return "1 " + key;
68             }
69             // functions
70             
71             var bits = key.split(" ");
72             
73             if (key[0] == '|') {
74                 return "2 " + bits[bits.length -1];
75             }
76             // signals
77             if (key[0] == '@') {
78                 return "3 " + bits[bits.length -1];
79             }
80                 
81             // props
82             if (key[0] == '#') {
83                 return "4 " + bits[bits.length -1];
84             }
85             // the rest..
86             return "5 " + bits[bits.length -1];    
87         
88         
89         
90         }
91         public void updateErrors () {
92                 var file = this.file;
93                 if (file == null) {
94                         return;
95                 }
96                 var ar = file.getErrors();
97                 if (ar == null || ar.size < 1) {
98                         if (this.last_error_counter != file.error_counter) {
99                                 this.removeErrors();
100                         }
101         
102                         this.last_error_counter = file.error_counter ;
103         
104                         return;
105                 }
106                 if (this.last_error_counter == file.error_counter) {
107                         return;
108                 }
109                 this.removeErrors();
110                 this.error_widgets = new Gee.ArrayList<Gtk.Widget>();
111                 foreach(var diag in ar) { 
112                 
113                          
114         //        print("get inter\n");
115                     var node = file.lineToNode( (int)diag.range.start.line) ;
116                     if (node == null || this.node == null || node.oid != this.node.oid) {
117                         continue;
118                 }
119                 var prop = node.lineToProp( (int)diag.range.start.line) ;
120                 if (prop == null) {
121                         continue;
122                         }
123                 var row = _this.selmodel.propToRow(prop);
124                 if (row < 0) {
125                         continue;
126                         }
127                 var w = this.view.getWidgetAtRow(row);
128                 if (w == null) {
129                         return;
130                         }
131         
132                         
133                         var ed = diag.category.down();
134                         if (ed != "err" && w.has_css_class("node-err")) {
135                                 continue;
136                         }
137                         this.error_widgets.add(w);              
138                         if (ed == "err" && w.has_css_class("node-warn")) {
139                                 w.remove_css_class("node-warn");
140                         }
141                         if (ed == "err" && w.has_css_class("node-depr")) {
142                                 w.remove_css_class("node-depr");
143                         }
144                         if (!w.has_css_class("node-"+ ed)) {
145                                 w.add_css_class("node-" + ed);
146                         }
147                         
148                 }
149                 
150         }
151         public string keyFormat (string val, string type) {
152             
153             // Glib.markup_escape_text(val);
154         
155             if (type == "listener") {
156                 return "<span font_weight=\"bold\" color=\"#660000\">" + 
157                     GLib.Markup.escape_text(val) +
158                      "</span>";
159             }
160             // property..
161             if (val.length < 1) {
162                 return "<span  color=\"#FF0000\">--empty--</span>";
163             }
164             
165             //@ = signal
166             //$ = property with 
167             //# - object properties
168             //* = special
169             // all of these... - display value is last element..
170             var ar = val.strip().split(" ");
171             
172             
173             var dval = GLib.Markup.escape_text(ar[ar.length-1]);
174             
175             
176             
177             
178             switch(val[0]) {
179                 case '@': // signal // just bold balck?
180                     if (dval[0] == '@') {
181                         dval = dval.substring(1);
182                     }
183                 
184                     return @"<span  font_weight=\"bold\">@ $dval</span>";        
185                 case '#': // object properties?
186                     if (dval[0] == '#') {
187                         dval = dval.substring(1);
188                     }
189                     return @"<span  font_weight=\"bold\">$dval</span>";
190                 case '*': // special
191                     if (dval[0] == '*') {
192                         dval = dval.substring(1);
193                     }
194                     return @"<span   color=\"#0000CC\" font_weight=\"bold\">$dval</span>";            
195                 case '$':
196                     if (dval[0] == '$') {
197                         dval = dval.substring(1);
198                     }
199                     return @"<span   style=\"italic\">$dval</span>";
200                case '|': // user defined methods
201                     if (dval[0] == '|') {
202                         dval = dval.substring(1);
203                     }
204                     return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
205                     
206                       
207                     
208                 default:
209                     return dval;
210             }
211               
212             
213         
214         }
215         public void deleteSelected () {
216             
217                         return;
218                         /*
219                 
220                 Gtk.TreeIter iter;
221                 Gtk.TreeModel mod;
222                 
223                 var s = this.view.el.get_selection();
224                 s.get_selected(out mod, out iter);
225                      
226                       
227                 GLib.Value gval;
228                 mod.get_value(iter, 0 , out gval);
229                 var prop = (JsRender.NodeProp)gval;
230                 if (prop == null) {
231                         this.load(this.file, this.node);    
232                         return;
233                 }
234                 // stop editor after fetching property - otherwise prop is null.
235                 this.stop_editor();
236                 
237                         
238                 switch(prop.ptype) {
239                     case JsRender.NodePropType.LISTENER:
240                         this.node.listeners.unset(prop.to_index_key());
241                         break;
242                         
243                     default:
244                         this.node.props.unset(prop.to_index_key());
245                         break;
246                 }
247                 this.load(this.file, this.node);
248                 
249                 _this.changed();
250                 */
251         }
252         public void removeErrors () {
253                         if (this.error_widgets == null || this.error_widgets.size < 1) {
254                         return;
255                 }
256                 foreach(var child in this.error_widgets) {
257                 
258                         if (child.has_css_class("node-err")) {
259                                 child.remove_css_class("node-err");
260                         }
261                         if (child.has_css_class("node-warn")) {
262                                 child.remove_css_class("node-warn");
263                         }
264                         
265                         if (child.has_css_class("node-depr")) {
266                                 child.remove_css_class("node-depr");
267                         }
268                 }
269                 this.error_widgets  = null;
270                 return;
271                 //GLib.debug("Rturning null");
272              
273         }
274         public void load (JsRender.JsRender file, JsRender.Node? node) 
275         {
276                 // not sure when to initialize this - we should do it on setting main window really.    
277                 
278                 this.loading = true;
279             if (this.view.popover == null) {
280                            this.view.popover = new Xcls_PopoverProperty();
281                            this.view.popover.mainwindow = _this.main_window;
282                 }
283             
284             
285             if (this.node != null) {
286                 this.node.dupeProps(); // ensures removeall will not do somethign silly
287                 
288             }
289             
290             GLib.debug("load leftprops");
291         
292             this.node = node;
293             this.file = file;
294             
295          
296             this.model.el.remove_all();
297                       
298             //this.get('/RightEditor').el.hide();
299             if (node ==null) {
300                 GLib.debug("node is null return");
301                 return ;
302             }
303         
304             node.loadProps(this.model.el, _this.main_window.windowstate.project); 
305             
306             
307            //GLib.debug("clear selection\n");
308            
309                 this.loading = false;
310             this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
311             this.updateErrors();
312            // clear selection?
313           //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
314            
315            // this.view.el.get_selection().unselect_all();
316            
317           // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
318           // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
319            
320         }
321         public class Xcls_Box1 : Object
322         {
323                 public Gtk.Box el;
324                 private Xcls_LeftProps  _this;
325
326
327                         // my vars (def)
328
329                 // ctor
330                 public Xcls_Box1(Xcls_LeftProps _owner )
331                 {
332                         _this = _owner;
333                         this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
334
335                         // my vars (dec)
336
337                         // set gobject values
338                         this.el.hexpand = true;
339                         var child_1 = new Xcls_Label2( _this );
340                         child_1.ref();
341                         this.el.append( child_1.el );
342                         var child_2 = new Xcls_Button3( _this );
343                         child_2.ref();
344                         this.el.append( child_2.el );
345                         var child_3 = new Xcls_Button4( _this );
346                         child_3.ref();
347                         this.el.append( child_3.el );
348                         var child_4 = new Xcls_MenuButton5( _this );
349                         child_4.ref();
350                         this.el.append( child_4.el );
351                 }
352
353                 // user defined functions
354         }
355         public class Xcls_Label2 : Object
356         {
357                 public Gtk.Label el;
358                 private Xcls_LeftProps  _this;
359
360
361                         // my vars (def)
362
363                 // ctor
364                 public Xcls_Label2(Xcls_LeftProps _owner )
365                 {
366                         _this = _owner;
367                         this.el = new Gtk.Label( "Add:" );
368
369                         // my vars (dec)
370
371                         // set gobject values
372                         this.el.margin_end = 5;
373                         this.el.margin_start = 5;
374                 }
375
376                 // user defined functions
377         }
378
379         public class Xcls_Button3 : Object
380         {
381                 public Gtk.Button el;
382                 private Xcls_LeftProps  _this;
383
384
385                         // my vars (def)
386                 public bool always_show_image;
387
388                 // ctor
389                 public Xcls_Button3(Xcls_LeftProps _owner )
390                 {
391                         _this = _owner;
392                         this.el = new Gtk.Button();
393
394                         // my vars (dec)
395                         this.always_show_image = true;
396
397                         // set gobject values
398                         this.el.icon_name = "format-justify-left";
399                         this.el.hexpand = true;
400                         this.el.tooltip_text = "Add Property";
401                         this.el.label = "Property";
402
403                         //listeners
404                         this.el.clicked.connect( ( ) => {
405                             
406                              _this.main_window.windowstate.showProps(
407                                 _this.view.el, 
408                                         JsRender.NodePropType.PROP
409                                 );
410                           
411                         });
412                 }
413
414                 // user defined functions
415         }
416
417         public class Xcls_Button4 : Object
418         {
419                 public Gtk.Button el;
420                 private Xcls_LeftProps  _this;
421
422
423                         // my vars (def)
424                 public bool always_show_image;
425
426                 // ctor
427                 public Xcls_Button4(Xcls_LeftProps _owner )
428                 {
429                         _this = _owner;
430                         this.el = new Gtk.Button();
431
432                         // my vars (dec)
433                         this.always_show_image = true;
434
435                         // set gobject values
436                         this.el.icon_name = "appointment-new";
437                         this.el.hexpand = true;
438                         this.el.tooltip_text = "Add Event Code";
439                         this.el.label = "Event";
440
441                         //listeners
442                         this.el.clicked.connect( ( ) => {
443                             
444                          
445                            _this.main_window.windowstate.showProps(
446                                         _this.view.el, 
447                                         JsRender.NodePropType.LISTENER
448                                 );
449                         
450                          
451                         });
452                 }
453
454                 // user defined functions
455         }
456
457         public class Xcls_MenuButton5 : Object
458         {
459                 public Gtk.MenuButton el;
460                 private Xcls_LeftProps  _this;
461
462
463                         // my vars (def)
464
465                 // ctor
466                 public Xcls_MenuButton5(Xcls_LeftProps _owner )
467                 {
468                         _this = _owner;
469                         this.el = new Gtk.MenuButton();
470
471                         // my vars (dec)
472
473                         // set gobject values
474                         this.el.label = "Other";
475                         new Xcls_addpop( _this );
476                         this.el.popover = _this.addpop.el;
477                 }
478
479                 // user defined functions
480         }
481         public class Xcls_addpop : Object
482         {
483                 public Gtk.Popover el;
484                 private Xcls_LeftProps  _this;
485
486
487                         // my vars (def)
488
489                 // ctor
490                 public Xcls_addpop(Xcls_LeftProps _owner )
491                 {
492                         _this = _owner;
493                         _this.addpop = this;
494                         this.el = new Gtk.Popover();
495
496                         // my vars (dec)
497
498                         // set gobject values
499                         var child_1 = new Xcls_Box7( _this );
500                         child_1.ref();
501                         this.el.child = child_1.el;
502                 }
503
504                 // user defined functions
505         }
506         public class Xcls_Box7 : Object
507         {
508                 public Gtk.Box el;
509                 private Xcls_LeftProps  _this;
510
511
512                         // my vars (def)
513
514                 // ctor
515                 public Xcls_Box7(Xcls_LeftProps _owner )
516                 {
517                         _this = _owner;
518                         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
519
520                         // my vars (dec)
521
522                         // set gobject values
523                         var child_1 = new Xcls_Button8( _this );
524                         child_1.ref();
525                         this.el.append( child_1.el );
526                         var child_2 = new Xcls_Button10( _this );
527                         child_2.ref();
528                         this.el.append( child_2.el );
529                         var child_3 = new Xcls_Button12( _this );
530                         child_3.ref();
531                         this.el.append( child_3.el );
532                         var child_4 = new Xcls_Button14( _this );
533                         child_4.ref();
534                         this.el.append( child_4.el );
535                         var child_5 = new Xcls_Button16( _this );
536                         child_5.ref();
537                         this.el.append( child_5.el );
538                         var child_6 = new Xcls_Separator18( _this );
539                         child_6.ref();
540                         this.el.append( child_6.el );
541                         var child_7 = new Xcls_Button19( _this );
542                         child_7.ref();
543                         this.el.append( child_7.el );
544                         var child_8 = new Xcls_Button21( _this );
545                         child_8.ref();
546                         this.el.append( child_8.el );
547                         var child_9 = new Xcls_Button23( _this );
548                         child_9.ref();
549                         this.el.append( child_9.el );
550                         var child_10 = new Xcls_Separator25( _this );
551                         child_10.ref();
552                         this.el.append( child_10.el );
553                         var child_11 = new Xcls_Button26( _this );
554                         child_11.ref();
555                         this.el.append( child_11.el );
556                         var child_12 = new Xcls_Button28( _this );
557                         child_12.ref();
558                         this.el.append( child_12.el );
559                         var child_13 = new Xcls_Button30( _this );
560                         child_13.ref();
561                         this.el.append( child_13.el );
562                         var child_14 = new Xcls_Separator32( _this );
563                         child_14.ref();
564                         this.el.append( child_14.el );
565                         var child_15 = new Xcls_Button33( _this );
566                         child_15.ref();
567                         this.el.append( child_15.el );
568                         var child_16 = new Xcls_Button35( _this );
569                         child_16.ref();
570                         this.el.append( child_16.el );
571                         var child_17 = new Xcls_Button37( _this );
572                         child_17.ref();
573                         this.el.append( child_17.el );
574                 }
575
576                 // user defined functions
577         }
578         public class Xcls_Button8 : Object
579         {
580                 public Gtk.Button el;
581                 private Xcls_LeftProps  _this;
582
583
584                         // my vars (def)
585
586                 // ctor
587                 public Xcls_Button8(Xcls_LeftProps _owner )
588                 {
589                         _this = _owner;
590                         this.el = new Gtk.Button();
591
592                         // my vars (dec)
593
594                         // set gobject values
595                         this.el.has_frame = false;
596                         var child_1 = new Xcls_Label9( _this );
597                         child_1.ref();
598                         this.el.child = child_1.el;
599
600                         //listeners
601                         this.el.clicked.connect( ()  => {
602                                 _this.addpop.el.hide();
603                                 // is this userdef or special??
604                                 var add = new JsRender.NodeProp.prop("id");
605                                 if (_this.node.has_prop_key(add)) {
606                                         return;
607                                 }
608                                 
609                                 _this.node.add_prop( add );
610                                 
611                                 _this.view.editProp( add );
612                                 
613                         });
614                 }
615
616                 // user defined functions
617         }
618         public class Xcls_Label9 : Object
619         {
620                 public Gtk.Label el;
621                 private Xcls_LeftProps  _this;
622
623
624                         // my vars (def)
625
626                 // ctor
627                 public Xcls_Label9(Xcls_LeftProps _owner )
628                 {
629                         _this = _owner;
630                         this.el = new Gtk.Label( "id: _this.{ID} (Vala)" );
631
632                         // my vars (dec)
633
634                         // set gobject values
635                         this.el.halign = Gtk.Align.START;
636                         this.el.tooltip_text = "Using _this.{ID} will map to this element";
637                 }
638
639                 // user defined functions
640         }
641
642
643         public class Xcls_Button10 : Object
644         {
645                 public Gtk.Button el;
646                 private Xcls_LeftProps  _this;
647
648
649                         // my vars (def)
650
651                 // ctor
652                 public Xcls_Button10(Xcls_LeftProps _owner )
653                 {
654                         _this = _owner;
655                         this.el = new Gtk.Button();
656
657                         // my vars (dec)
658
659                         // set gobject values
660                         this.el.has_frame = false;
661                         var child_1 = new Xcls_Label11( _this );
662                         child_1.ref();
663                         this.el.child = child_1.el;
664
665                         //listeners
666                         this.el.clicked.connect( ( ) => {
667                          
668                         
669                                 _this.addpop.el.hide();
670                                 // is this userdef or special??
671                                 var add = new JsRender.NodeProp.special("pack", "add");
672                                 if (_this.node.has_prop_key(add)) {
673                                         return;
674                                 }
675                                 
676                                 _this.node.add_prop( add );
677                                 
678                                 _this.view.editProp( add );
679                                 
680                         
681                         });
682                 }
683
684                 // user defined functions
685         }
686         public class Xcls_Label11 : Object
687         {
688                 public Gtk.Label el;
689                 private Xcls_LeftProps  _this;
690
691
692                         // my vars (def)
693
694                 // ctor
695                 public Xcls_Label11(Xcls_LeftProps _owner )
696                 {
697                         _this = _owner;
698                         this.el = new Gtk.Label( "pack: Pack method (Vala)" );
699
700                         // my vars (dec)
701
702                         // set gobject values
703                         this.el.halign = Gtk.Align.START;
704                         this.el.tooltip_text = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
705                 }
706
707                 // user defined functions
708         }
709
710
711         public class Xcls_Button12 : Object
712         {
713                 public Gtk.Button el;
714                 private Xcls_LeftProps  _this;
715
716
717                         // my vars (def)
718
719                 // ctor
720                 public Xcls_Button12(Xcls_LeftProps _owner )
721                 {
722                         _this = _owner;
723                         this.el = new Gtk.Button();
724
725                         // my vars (dec)
726
727                         // set gobject values
728                         this.el.has_frame = false;
729                         var child_1 = new Xcls_Label13( _this );
730                         child_1.ref();
731                         this.el.child = child_1.el;
732
733                         //listeners
734                         this.el.clicked.connect( ( ) => {
735                            
736                                 _this.addpop.el.hide();
737                                 // is this userdef or special??
738                                 var add = new JsRender.NodeProp.special("ctor");
739                                 if (_this.node.has_prop_key(add)) {
740                                         return;
741                                 }
742                                 
743                                 _this.node.add_prop( add );
744                                 
745                                 _this.view.editProp( add );
746                                 
747                         });
748                 }
749
750                 // user defined functions
751         }
752         public class Xcls_Label13 : Object
753         {
754                 public Gtk.Label el;
755                 private Xcls_LeftProps  _this;
756
757
758                         // my vars (def)
759
760                 // ctor
761                 public Xcls_Label13(Xcls_LeftProps _owner )
762                 {
763                         _this = _owner;
764                         this.el = new Gtk.Label( "ctor: Alterative to default contructor (Vala)" );
765
766                         // my vars (dec)
767
768                         // set gobject values
769                         this.el.halign = Gtk.Align.START;
770                         this.el.tooltip_text = "eg. \n\nnew Clutter.Image.from_file(.....)";
771                 }
772
773                 // user defined functions
774         }
775
776
777         public class Xcls_Button14 : Object
778         {
779                 public Gtk.Button el;
780                 private Xcls_LeftProps  _this;
781
782
783                         // my vars (def)
784
785                 // ctor
786                 public Xcls_Button14(Xcls_LeftProps _owner )
787                 {
788                         _this = _owner;
789                         this.el = new Gtk.Button();
790
791                         // my vars (dec)
792
793                         // set gobject values
794                         this.el.has_frame = false;
795                         var child_1 = new Xcls_Label15( _this );
796                         child_1.ref();
797                         this.el.child = child_1.el;
798
799                         //listeners
800                         this.el.clicked.connect( ( ) => {
801                             
802                                 _this.addpop.el.hide();
803                                 // is this userdef or special??
804                                 var add =  new JsRender.NodeProp.special("init","{\n\n}\n" ) ;
805                                 if (_this.node.has_prop_key(add)) {
806                                         return;
807                                 }
808                                 
809                                 _this.node.add_prop( add );
810                                 
811                                 _this.view.editProp( add );
812                         });
813                 }
814
815                 // user defined functions
816         }
817         public class Xcls_Label15 : Object
818         {
819                 public Gtk.Label el;
820                 private Xcls_LeftProps  _this;
821
822
823                         // my vars (def)
824
825                 // ctor
826                 public Xcls_Label15(Xcls_LeftProps _owner )
827                 {
828                         _this = _owner;
829                         this.el = new Gtk.Label( "init: initialziation code (vala)" );
830
831                         // my vars (dec)
832
833                         // set gobject values
834                         this.el.halign = Gtk.Align.START;
835                         this.el.tooltip_text = "This code is called after the ctor";
836                 }
837
838                 // user defined functions
839         }
840
841
842         public class Xcls_Button16 : Object
843         {
844                 public Gtk.Button el;
845                 private Xcls_LeftProps  _this;
846
847
848                         // my vars (def)
849
850                 // ctor
851                 public Xcls_Button16(Xcls_LeftProps _owner )
852                 {
853                         _this = _owner;
854                         this.el = new Gtk.Button();
855
856                         // my vars (dec)
857
858                         // set gobject values
859                         this.el.has_frame = false;
860                         var child_1 = new Xcls_Label17( _this );
861                         child_1.ref();
862                         this.el.child = child_1.el;
863
864                         //listeners
865                         this.el.clicked.connect( ()  => {
866                                 _this.addpop.el.hide();
867                          
868                                 // is this userdef or special??
869                                 var add =   new JsRender.NodeProp.prop("cms-id","string", "" ) ;
870                                 if (_this.node.has_prop_key(add)) {
871                                         return;
872                                 }
873                                 
874                                 _this.node.add_prop( add );
875                                 
876                                 _this.view.editProp( add );
877                             
878                         });
879                 }
880
881                 // user defined functions
882         }
883         public class Xcls_Label17 : Object
884         {
885                 public Gtk.Label el;
886                 private Xcls_LeftProps  _this;
887
888
889                         // my vars (def)
890
891                 // ctor
892                 public Xcls_Label17(Xcls_LeftProps _owner )
893                 {
894                         _this = _owner;
895                         this.el = new Gtk.Label( "cms-id: (Roo JS/Pman library)" );
896
897                         // my vars (dec)
898
899                         // set gobject values
900                         this.el.halign = Gtk.Align.START;
901                         this.el.tooltip_text = "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})\n";
902                 }
903
904                 // user defined functions
905         }
906
907
908         public class Xcls_Separator18 : Object
909         {
910                 public Gtk.Separator el;
911                 private Xcls_LeftProps  _this;
912
913
914                         // my vars (def)
915
916                 // ctor
917                 public Xcls_Separator18(Xcls_LeftProps _owner )
918                 {
919                         _this = _owner;
920                         this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
921
922                         // my vars (dec)
923
924                         // set gobject values
925                 }
926
927                 // user defined functions
928         }
929
930         public class Xcls_Button19 : Object
931         {
932                 public Gtk.Button el;
933                 private Xcls_LeftProps  _this;
934
935
936                         // my vars (def)
937
938                 // ctor
939                 public Xcls_Button19(Xcls_LeftProps _owner )
940                 {
941                         _this = _owner;
942                         this.el = new Gtk.Button();
943
944                         // my vars (dec)
945
946                         // set gobject values
947                         this.el.has_frame = false;
948                         var child_1 = new Xcls_Label20( _this );
949                         child_1.ref();
950                         this.el.child = child_1.el;
951
952                         //listeners
953                         this.el.clicked.connect( (self) => {
954                                 _this.addpop.el.hide();
955                                 _this.view.popover.show(
956                                         _this.view.el, 
957                                         _this.node, 
958                                          new JsRender.NodeProp.user("", "string", "") ,
959                                         -1,  
960                                         true
961                                 );
962                          
963                         });
964                 }
965
966                 // user defined functions
967         }
968         public class Xcls_Label20 : Object
969         {
970                 public Gtk.Label el;
971                 private Xcls_LeftProps  _this;
972
973
974                         // my vars (def)
975
976                 // ctor
977                 public Xcls_Label20(Xcls_LeftProps _owner )
978                 {
979                         _this = _owner;
980                         this.el = new Gtk.Label( "String" );
981
982                         // my vars (dec)
983
984                         // set gobject values
985                         this.el.halign = Gtk.Align.START;
986                         this.el.tooltip_text = "Add a user defined string property";
987                 }
988
989                 // user defined functions
990         }
991
992
993         public class Xcls_Button21 : Object
994         {
995                 public Gtk.Button el;
996                 private Xcls_LeftProps  _this;
997
998
999                         // my vars (def)
1000
1001                 // ctor
1002                 public Xcls_Button21(Xcls_LeftProps _owner )
1003                 {
1004                         _this = _owner;
1005                         this.el = new Gtk.Button();
1006
1007                         // my vars (dec)
1008
1009                         // set gobject values
1010                         this.el.has_frame = false;
1011                         var child_1 = new Xcls_Label22( _this );
1012                         child_1.ref();
1013                         this.el.child = child_1.el;
1014
1015                         //listeners
1016                         this.el.clicked.connect( ( ) =>{
1017                          
1018                                 _this.addpop.el.hide();
1019                                _this.view.popover.show(
1020                                         _this.view.el, 
1021                                         _this.node, 
1022                                          new JsRender.NodeProp.user("", "int", "0") ,
1023                                         -1,  
1024                                         true
1025                                 );
1026                          
1027                         });
1028                 }
1029
1030                 // user defined functions
1031         }
1032         public class Xcls_Label22 : Object
1033         {
1034                 public Gtk.Label el;
1035                 private Xcls_LeftProps  _this;
1036
1037
1038                         // my vars (def)
1039
1040                 // ctor
1041                 public Xcls_Label22(Xcls_LeftProps _owner )
1042                 {
1043                         _this = _owner;
1044                         this.el = new Gtk.Label( "Number" );
1045
1046                         // my vars (dec)
1047
1048                         // set gobject values
1049                         this.el.halign = Gtk.Align.START;
1050                         this.el.tooltip_text = "Add a user defined number property";
1051                 }
1052
1053                 // user defined functions
1054         }
1055
1056
1057         public class Xcls_Button23 : Object
1058         {
1059                 public Gtk.Button el;
1060                 private Xcls_LeftProps  _this;
1061
1062
1063                         // my vars (def)
1064
1065                 // ctor
1066                 public Xcls_Button23(Xcls_LeftProps _owner )
1067                 {
1068                         _this = _owner;
1069                         this.el = new Gtk.Button();
1070
1071                         // my vars (dec)
1072
1073                         // set gobject values
1074                         this.el.has_frame = false;
1075                         var child_1 = new Xcls_Label24( _this );
1076                         child_1.ref();
1077                         this.el.child = child_1.el;
1078
1079                         //listeners
1080                         this.el.clicked.connect( ( ) =>{
1081                           
1082                                 _this.addpop.el.hide();
1083                            _this.view.popover.show(
1084                                         _this.view.el, 
1085                                         _this.node, 
1086                                          new JsRender.NodeProp.user("", "bool", "true") ,
1087                                         -1,  
1088                                         true
1089                                 ); 
1090                          
1091                         });
1092                 }
1093
1094                 // user defined functions
1095         }
1096         public class Xcls_Label24 : Object
1097         {
1098                 public Gtk.Label el;
1099                 private Xcls_LeftProps  _this;
1100
1101
1102                         // my vars (def)
1103
1104                 // ctor
1105                 public Xcls_Label24(Xcls_LeftProps _owner )
1106                 {
1107                         _this = _owner;
1108                         this.el = new Gtk.Label( "Boolean" );
1109
1110                         // my vars (dec)
1111
1112                         // set gobject values
1113                         this.el.halign = Gtk.Align.START;
1114                         this.el.tooltip_text = "Add a user defined boolean property";
1115                 }
1116
1117                 // user defined functions
1118         }
1119
1120
1121         public class Xcls_Separator25 : Object
1122         {
1123                 public Gtk.Separator el;
1124                 private Xcls_LeftProps  _this;
1125
1126
1127                         // my vars (def)
1128
1129                 // ctor
1130                 public Xcls_Separator25(Xcls_LeftProps _owner )
1131                 {
1132                         _this = _owner;
1133                         this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
1134
1135                         // my vars (dec)
1136
1137                         // set gobject values
1138                 }
1139
1140                 // user defined functions
1141         }
1142
1143         public class Xcls_Button26 : Object
1144         {
1145                 public Gtk.Button el;
1146                 private Xcls_LeftProps  _this;
1147
1148
1149                         // my vars (def)
1150
1151                 // ctor
1152                 public Xcls_Button26(Xcls_LeftProps _owner )
1153                 {
1154                         _this = _owner;
1155                         this.el = new Gtk.Button();
1156
1157                         // my vars (dec)
1158
1159                         // set gobject values
1160                         this.el.has_frame = false;
1161                         var child_1 = new Xcls_Label27( _this );
1162                         child_1.ref();
1163                         this.el.child = child_1.el;
1164
1165                         //listeners
1166                         this.el.clicked.connect( ( ) =>{
1167                                 _this.addpop.el.hide();
1168                            _this.view.popover.show(
1169                                         _this.view.el, 
1170                                         _this.node, 
1171                                          new JsRender.NodeProp.jsmethod("") ,
1172                                         -1,  
1173                                         true
1174                                 );
1175                         
1176                          
1177                         });
1178                 }
1179
1180                 // user defined functions
1181         }
1182         public class Xcls_Label27 : Object
1183         {
1184                 public Gtk.Label el;
1185                 private Xcls_LeftProps  _this;
1186
1187
1188                         // my vars (def)
1189
1190                 // ctor
1191                 public Xcls_Label27(Xcls_LeftProps _owner )
1192                 {
1193                         _this = _owner;
1194                         this.el = new Gtk.Label( "Javascript Function" );
1195
1196                         // my vars (dec)
1197
1198                         // set gobject values
1199                         this.el.halign = Gtk.Align.START;
1200                         this.el.tooltip_text = "Add a javascript  function";
1201                 }
1202
1203                 // user defined functions
1204         }
1205
1206
1207         public class Xcls_Button28 : Object
1208         {
1209                 public Gtk.Button el;
1210                 private Xcls_LeftProps  _this;
1211
1212
1213                         // my vars (def)
1214
1215                 // ctor
1216                 public Xcls_Button28(Xcls_LeftProps _owner )
1217                 {
1218                         _this = _owner;
1219                         this.el = new Gtk.Button();
1220
1221                         // my vars (dec)
1222
1223                         // set gobject values
1224                         this.el.has_frame = false;
1225                         var child_1 = new Xcls_Label29( _this );
1226                         child_1.ref();
1227                         this.el.child = child_1.el;
1228
1229                         //listeners
1230                         this.el.clicked.connect( ( ) =>{
1231                                 _this.addpop.el.hide();
1232                             _this.view.popover.show(
1233                                         _this.view.el, 
1234                                         _this.node, 
1235                                          new JsRender.NodeProp.valamethod("") ,
1236                                         -1,  
1237                                         true
1238                                 ); 
1239                         });
1240                 }
1241
1242                 // user defined functions
1243         }
1244         public class Xcls_Label29 : Object
1245         {
1246                 public Gtk.Label el;
1247                 private Xcls_LeftProps  _this;
1248
1249
1250                         // my vars (def)
1251
1252                 // ctor
1253                 public Xcls_Label29(Xcls_LeftProps _owner )
1254                 {
1255                         _this = _owner;
1256                         this.el = new Gtk.Label( "Vala Method" );
1257
1258                         // my vars (dec)
1259
1260                         // set gobject values
1261                         this.el.halign = Gtk.Align.START;
1262                         this.el.tooltip_text = "Add a user defined method to a object";
1263                 }
1264
1265                 // user defined functions
1266         }
1267
1268
1269         public class Xcls_Button30 : Object
1270         {
1271                 public Gtk.Button el;
1272                 private Xcls_LeftProps  _this;
1273
1274
1275                         // my vars (def)
1276
1277                 // ctor
1278                 public Xcls_Button30(Xcls_LeftProps _owner )
1279                 {
1280                         _this = _owner;
1281                         this.el = new Gtk.Button();
1282
1283                         // my vars (dec)
1284
1285                         // set gobject values
1286                         this.el.has_frame = false;
1287                         var child_1 = new Xcls_Label31( _this );
1288                         child_1.ref();
1289                         this.el.child = child_1.el;
1290
1291                         //listeners
1292                         this.el.clicked.connect( ( ) =>{
1293                                 _this.addpop.el.hide(); 
1294                           _this.view.popover.show(
1295                                         _this.view.el, 
1296                                         _this.node, 
1297                                          new JsRender.NodeProp.sig("" ) ,
1298                                         -1,  
1299                                         true
1300                                 );    
1301                         });
1302                 }
1303
1304                 // user defined functions
1305         }
1306         public class Xcls_Label31 : Object
1307         {
1308                 public Gtk.Label el;
1309                 private Xcls_LeftProps  _this;
1310
1311
1312                         // my vars (def)
1313
1314                 // ctor
1315                 public Xcls_Label31(Xcls_LeftProps _owner )
1316                 {
1317                         _this = _owner;
1318                         this.el = new Gtk.Label( "Vala Signal" );
1319
1320                         // my vars (dec)
1321
1322                         // set gobject values
1323                         this.el.halign = Gtk.Align.START;
1324                         this.el.tooltip_text = "Add a user defined signal to a object";
1325                 }
1326
1327                 // user defined functions
1328         }
1329
1330
1331         public class Xcls_Separator32 : Object
1332         {
1333                 public Gtk.Separator el;
1334                 private Xcls_LeftProps  _this;
1335
1336
1337                         // my vars (def)
1338
1339                 // ctor
1340                 public Xcls_Separator32(Xcls_LeftProps _owner )
1341                 {
1342                         _this = _owner;
1343                         this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
1344
1345                         // my vars (dec)
1346
1347                         // set gobject values
1348                 }
1349
1350                 // user defined functions
1351         }
1352
1353         public class Xcls_Button33 : Object
1354         {
1355                 public Gtk.Button el;
1356                 private Xcls_LeftProps  _this;
1357
1358
1359                         // my vars (def)
1360
1361                 // ctor
1362                 public Xcls_Button33(Xcls_LeftProps _owner )
1363                 {
1364                         _this = _owner;
1365                         this.el = new Gtk.Button();
1366
1367                         // my vars (dec)
1368
1369                         // set gobject values
1370                         this.el.has_frame = false;
1371                         var child_1 = new Xcls_Label34( _this );
1372                         child_1.ref();
1373                         this.el.child = child_1.el;
1374
1375                         //listeners
1376                         this.el.clicked.connect( ( ) =>{
1377                                 _this.addpop.el.hide();
1378                                 _this.view.popover.show(
1379                                         _this.view.el, 
1380                                         _this.node, 
1381                                          new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
1382                                         -1,  
1383                                         true
1384                                 );
1385                         
1386                         
1387                         });
1388                 }
1389
1390                 // user defined functions
1391         }
1392         public class Xcls_Label34 : Object
1393         {
1394                 public Gtk.Label el;
1395                 private Xcls_LeftProps  _this;
1396
1397
1398                         // my vars (def)
1399
1400                 // ctor
1401                 public Xcls_Label34(Xcls_LeftProps _owner )
1402                 {
1403                         _this = _owner;
1404                         this.el = new Gtk.Label( "Flexy - If" );
1405
1406                         // my vars (dec)
1407
1408                         // set gobject values
1409                         this.el.halign = Gtk.Align.START;
1410                         this.el.tooltip_text = "Add a flexy if (for HTML templates)";
1411                 }
1412
1413                 // user defined functions
1414         }
1415
1416
1417         public class Xcls_Button35 : Object
1418         {
1419                 public Gtk.Button el;
1420                 private Xcls_LeftProps  _this;
1421
1422
1423                         // my vars (def)
1424
1425                 // ctor
1426                 public Xcls_Button35(Xcls_LeftProps _owner )
1427                 {
1428                         _this = _owner;
1429                         this.el = new Gtk.Button();
1430
1431                         // my vars (dec)
1432
1433                         // set gobject values
1434                         this.el.has_frame = false;
1435                         var child_1 = new Xcls_Label36( _this );
1436                         child_1.ref();
1437                         this.el.child = child_1.el;
1438
1439                         //listeners
1440                         this.el.clicked.connect( ( ) =>{
1441                                 _this.addpop.el.hide();
1442                                 _this.view.popover.show(
1443                                         _this.view.el, 
1444                                         _this.node, 
1445                                          new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
1446                                         -1,  
1447                                         true
1448                                 );
1449                         
1450                           
1451                         });
1452                 }
1453
1454                 // user defined functions
1455         }
1456         public class Xcls_Label36 : Object
1457         {
1458                 public Gtk.Label el;
1459                 private Xcls_LeftProps  _this;
1460
1461
1462                         // my vars (def)
1463
1464                 // ctor
1465                 public Xcls_Label36(Xcls_LeftProps _owner )
1466                 {
1467                         _this = _owner;
1468                         this.el = new Gtk.Label( "Flexy - Include" );
1469
1470                         // my vars (dec)
1471
1472                         // set gobject values
1473                         this.el.halign = Gtk.Align.START;
1474                         this.el.tooltip_text = "Add a flexy include (for HTML templates)";
1475                 }
1476
1477                 // user defined functions
1478         }
1479
1480
1481         public class Xcls_Button37 : Object
1482         {
1483                 public Gtk.Button el;
1484                 private Xcls_LeftProps  _this;
1485
1486
1487                         // my vars (def)
1488
1489                 // ctor
1490                 public Xcls_Button37(Xcls_LeftProps _owner )
1491                 {
1492                         _this = _owner;
1493                         this.el = new Gtk.Button();
1494
1495                         // my vars (dec)
1496
1497                         // set gobject values
1498                         this.el.has_frame = false;
1499                         this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1500                         var child_1 = new Xcls_Label38( _this );
1501                         child_1.ref();
1502                         this.el.child = child_1.el;
1503
1504                         //listeners
1505                         this.el.clicked.connect( ( ) =>{
1506                                 _this.addpop.el.hide();
1507                                 _this.view.popover.show(
1508                                         _this.view.el, 
1509                                         _this.node, 
1510                                          new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
1511                                         -1,  
1512                                         true
1513                                 );
1514                           
1515                         });
1516                 }
1517
1518                 // user defined functions
1519         }
1520         public class Xcls_Label38 : Object
1521         {
1522                 public Gtk.Label el;
1523                 private Xcls_LeftProps  _this;
1524
1525
1526                         // my vars (def)
1527
1528                 // ctor
1529                 public Xcls_Label38(Xcls_LeftProps _owner )
1530                 {
1531                         _this = _owner;
1532                         this.el = new Gtk.Label( "Flexy - Foreach" );
1533
1534                         // my vars (dec)
1535
1536                         // set gobject values
1537                         this.el.halign = Gtk.Align.START;
1538                         this.el.tooltip_text = "Add a flexy foreach (for HTML templates)";
1539                 }
1540
1541                 // user defined functions
1542         }
1543
1544
1545
1546
1547
1548
1549         public class Xcls_EditProps : Object
1550         {
1551                 public Gtk.ScrolledWindow el;
1552                 private Xcls_LeftProps  _this;
1553
1554
1555                         // my vars (def)
1556                 public bool editing;
1557
1558                 // ctor
1559                 public Xcls_EditProps(Xcls_LeftProps _owner )
1560                 {
1561                         _this = _owner;
1562                         _this.EditProps = this;
1563                         this.el = new Gtk.ScrolledWindow();
1564
1565                         // my vars (dec)
1566                         this.editing = false;
1567
1568                         // set gobject values
1569                         this.el.hexpand = true;
1570                         this.el.vexpand = true;
1571                         new Xcls_view( _this );
1572                         this.el.set_child ( _this.view.el  );
1573
1574                         // init method
1575
1576                         {
1577                           
1578                            this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1579                         }
1580                 }
1581
1582                 // user defined functions
1583         }
1584         public class Xcls_view : Object
1585         {
1586                 public Gtk.ColumnView el;
1587                 private Xcls_LeftProps  _this;
1588
1589
1590                         // my vars (def)
1591                 public Xcls_PopoverProperty popover;
1592
1593                 // ctor
1594                 public Xcls_view(Xcls_LeftProps _owner )
1595                 {
1596                         _this = _owner;
1597                         _this.view = this;
1598                         new Xcls_selmodel( _this );
1599                         this.el = new Gtk.ColumnView( _this.selmodel.el );
1600
1601                         // my vars (dec)
1602                         this.popover = null;
1603
1604                         // set gobject values
1605                         this.el.name = "leftprops-view";
1606                         this.el.single_click_activate = false;
1607                         this.el.hexpand = true;
1608                         this.el.vexpand = true;
1609                         this.el.show_row_separators = true;
1610                         new Xcls_deletemenu( _this );
1611                         var child_3 = new Xcls_GestureClick45( _this );
1612                         child_3.ref();
1613                         this.el.add_controller(  child_3.el );
1614                         var child_4 = new Xcls_GestureClick46( _this );
1615                         child_4.ref();
1616                         this.el.add_controller(  child_4.el );
1617                         new Xcls_keycol( _this );
1618                         this.el.append_column ( _this.keycol.el  );
1619                         new Xcls_valcol( _this );
1620                         this.el.append_column ( _this.valcol.el  );
1621                         new Xcls_ContextMenu( _this );
1622                 }
1623
1624                 // user defined functions
1625                 public Gtk.Widget? getWidgetAtRow (uint row) {
1626                 /*
1627                         
1628                 from            https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
1629                         var colview = gesture.widget;
1630                         var line_no = check_list_widget(colview, x,y);
1631                          if (line_no > -1) {
1632                                 var item = colview.model.get_item(line_no);
1633                                  
1634                         }
1635                         */
1636                                 //GLib.debug("Get Widget At Row %d", (int)row);
1637                         var  child = this.el.get_first_child(); 
1638                         var line_no = -1; 
1639                         var reading_header = true;
1640                 
1641                         while (child != null) {
1642                                         //GLib.debug("Got %s", child.get_type().name());
1643                             if (reading_header) {
1644                                          
1645                                            
1646                                                 if (child.get_type().name() != "GtkColumnListView") {
1647                                                         child = child.get_next_sibling();
1648                                                         continue;
1649                                                 }
1650                                                 child = child.get_first_child(); 
1651                                                 reading_header = false;
1652                                                 continue;
1653                                 }
1654                                     if (child.get_type().name() != "GtkColumnViewRowWidget") {
1655                                     child = child.get_next_sibling();
1656                                     continue;
1657                                     }
1658                                     line_no++;
1659                                         if (line_no == row) {
1660                                                 //GLib.debug("Returning widget %s", child.get_type().name());
1661                                             return (Gtk.Widget)child;
1662                                     }
1663                                 child = child.get_next_sibling(); 
1664                         }
1665                                 //GLib.debug("Rturning null");
1666                         return null;
1667                 
1668                  }
1669                 public void editProp (JsRender.NodeProp prop) 
1670                 {
1671                         var sm = _this.selmodel.el;
1672                  
1673                                 var sr = -1;
1674                                 GLib.debug("finding node");
1675                                 _this.selmodel.selectProp(prop);
1676                                 
1677                                 for (var i = 0 ; i < sm.n_items; i++) {
1678                                         var r = (JsRender.NodeProp)sm.get_item(i);
1679                                         if (r.equals(prop)) {
1680                                                 sr = i;
1681                                                 break;
1682                                         }
1683                                 }
1684                                 if (sr < 0) {
1685                                         GLib.debug("finding node - cant find it");
1686                                                         
1687                                         return;
1688                                 }
1689                                 var r = this.getWidgetAtRow(sr);
1690                                 GLib.debug("r = %s", r.get_type().name());
1691                                 var ca = r.get_first_child();
1692                                 var ll = (Gtk.Label)ca.get_first_child();
1693                                 var cb = ca.get_next_sibling();
1694                                 var b = cb.get_first_child();
1695                                 var e = (Gtk.EditableLabel) b.get_first_child();
1696                                 var l = (Gtk.Label) e.get_next_sibling();
1697                                 var d = (Gtk.DropDown) l.get_next_sibling();
1698                                 
1699                                 GLib.debug("row key = %s", ll.label);
1700                                 if (e.get_visible()) {
1701                                         _this.stop_editor();
1702                                         e.start_editing();
1703                                         //GLib.Timeout.add_once(500, () => {
1704                                         //      var st = (Gtk.Stack) e.get_first_child();
1705                                         //      var ed = (Gtk.Entry) st.get_visible_child();
1706                                         //      ed.grab_focus_without_selecting();
1707                                         //});
1708                                         return;
1709                                 }
1710                                 if (d.get_visible()) {
1711                                         _this.stop_editor();
1712                                         d.activate();
1713                                         return;
1714                                 }
1715                                 if (l.get_visible()) {
1716                                         _this.stop_editor();
1717                                         if (prop.parent == null) {
1718                                                 return;
1719                                         }
1720                                 _this.show_editor(_this.file, prop.parent, prop);
1721                                 
1722                                 }
1723                                 
1724                                 
1725                                 
1726                                 //gtkcolumnviewrowwidget
1727                                   // cell widet
1728                                   // cell widget
1729                                         // box
1730                                                 // entry / label / dropdown
1731                                                 
1732                                  
1733                 }
1734                 public int getColAt (double x,  double y) {
1735                 /*
1736                         
1737                 from            https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
1738                           
1739                         */
1740                                 //Gtk.Allocation alloc = { 0, 0, 0, 0 };
1741                         var  child = this.el.get_first_child(); 
1742                          
1743                         var col = 0;
1744                         var offx = 0;
1745                         while (child != null) {
1746                                         GLib.debug("Got %s", child.get_type().name());
1747                                         
1748                                         if (child.get_type().name() == "GtkColumnViewRowWidget") {
1749                                                 child = child.get_first_child();
1750                                                 continue;
1751                                         }
1752                                         
1753                                         //child.get_allocation(out alloc);
1754                                         if (x <  (child.get_width() + offx)) {
1755                                                 return col;
1756                                         }
1757                                         offx += child.get_width();
1758                                         col++;
1759                                         child = child.get_next_sibling();
1760                                 }
1761                              
1762                                           
1763                         return -1;
1764                 
1765                  }
1766                 public int getRowAt (double x,  double  y, out string pos) {
1767                 
1768                         pos = "";
1769                         var w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);
1770                         //GLib.debug("got widget %s", w == null ? "nothing" : w.get_type().name());
1771                         if (w == null) {
1772                                 return -1;
1773                         }
1774                         
1775                         var row= w.get_ancestor(GLib.Type.from_name("GtkColumnViewRowWidget"));
1776                         if (row == null) {
1777                                 return -1;
1778                         }
1779                         
1780                         //GLib.debug("got colview %s", row == null ? "nothing" : row.get_type().name());
1781                          
1782                         var rn = 0;
1783                         var cr = row;
1784                          
1785                         while (cr.get_prev_sibling() != null) {
1786                                 rn++;
1787                                 cr = cr.get_prev_sibling();
1788                         }
1789                         
1790                         //GLib.debug("row number is %d", rn);
1791                         //GLib.debug("click %d, %d", (int)x, (int)y);
1792                         // above or belw
1793                         Graphene.Rect  bounds;
1794                         row.compute_bounds(this.el, out bounds);
1795                         //GLib.debug("click x=%d, y=%d, w=%d, h=%d", 
1796                         //      (int)bounds.get_x(), (int)bounds.get_y(),
1797                         //      (int)bounds.get_width(), (int)bounds.get_height()
1798                         //      );
1799                         var ypos = y - bounds.get_y();
1800                         //GLib.debug("rel ypos = %d", (int)ypos);       
1801                         var rpos = 100.0 * (ypos / bounds.get_height());
1802                         //GLib.debug("rel pos = %d %%", (int)rpos);
1803                         pos = "over";
1804                         
1805                         if (rpos > 80) {
1806                                 pos = "below";
1807                         } else if (rpos < 20) {
1808                                 pos = "above";
1809                         } 
1810                         return rn;
1811                  }
1812         }
1813         public class Xcls_deletemenu : Object
1814         {
1815                 public Gtk.Popover el;
1816                 private Xcls_LeftProps  _this;
1817
1818
1819                         // my vars (def)
1820
1821                 // ctor
1822                 public Xcls_deletemenu(Xcls_LeftProps _owner )
1823                 {
1824                         _this = _owner;
1825                         _this.deletemenu = this;
1826                         this.el = new Gtk.Popover();
1827
1828                         // my vars (dec)
1829
1830                         // set gobject values
1831                         var child_1 = new Xcls_Box42( _this );
1832                         child_1.ref();
1833                         this.el.child = child_1.el;
1834                 }
1835
1836                 // user defined functions
1837         }
1838         public class Xcls_Box42 : Object
1839         {
1840                 public Gtk.Box el;
1841                 private Xcls_LeftProps  _this;
1842
1843
1844                         // my vars (def)
1845
1846                 // ctor
1847                 public Xcls_Box42(Xcls_LeftProps _owner )
1848                 {
1849                         _this = _owner;
1850                         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1851
1852                         // my vars (dec)
1853
1854                         // set gobject values
1855                         var child_1 = new Xcls_Button43( _this );
1856                         child_1.ref();
1857                         this.el.append( child_1.el );
1858                 }
1859
1860                 // user defined functions
1861         }
1862         public class Xcls_Button43 : Object
1863         {
1864                 public Gtk.Button el;
1865                 private Xcls_LeftProps  _this;
1866
1867
1868                         // my vars (def)
1869
1870                 // ctor
1871                 public Xcls_Button43(Xcls_LeftProps _owner )
1872                 {
1873                         _this = _owner;
1874                         this.el = new Gtk.Button();
1875
1876                         // my vars (dec)
1877
1878                         // set gobject values
1879                         this.el.has_frame = false;
1880                         this.el.label = "Delete";
1881                         var child_1 = new Xcls_Label44( _this );
1882                         child_1.ref();
1883                         this.el.child = child_1.el;
1884
1885                         //listeners
1886                         this.el.clicked.connect( ( ) => {
1887                                 
1888                         
1889                                 var n = (JsRender.NodeProp) _this.selmodel.el.selected_item;
1890                         
1891                                 _this.deletemenu.el.hide();
1892                                 _this.node.remove_prop(n);
1893                         });
1894                 }
1895
1896                 // user defined functions
1897         }
1898         public class Xcls_Label44 : Object
1899         {
1900                 public Gtk.Label el;
1901                 private Xcls_LeftProps  _this;
1902
1903
1904                         // my vars (def)
1905
1906                 // ctor
1907                 public Xcls_Label44(Xcls_LeftProps _owner )
1908                 {
1909                         _this = _owner;
1910                         this.el = new Gtk.Label( "Delete Property / Method" );
1911
1912                         // my vars (dec)
1913
1914                         // set gobject values
1915                         this.el.halign = Gtk.Align.START;
1916                 }
1917
1918                 // user defined functions
1919         }
1920
1921
1922
1923
1924         public class Xcls_GestureClick45 : Object
1925         {
1926                 public Gtk.GestureClick el;
1927                 private Xcls_LeftProps  _this;
1928
1929
1930                         // my vars (def)
1931
1932                 // ctor
1933                 public Xcls_GestureClick45(Xcls_LeftProps _owner )
1934                 {
1935                         _this = _owner;
1936                         this.el = new Gtk.GestureClick();
1937
1938                         // my vars (dec)
1939
1940                         // set gobject values
1941
1942                         //listeners
1943                         this.el.pressed.connect( (n_press, in_x, in_y) => {
1944                         
1945                                 GLib.debug("Prssed %d", (int)  this.el.get_current_button());
1946                                 
1947                                 var col = _this.view.getColAt(in_x, in_y);
1948                                 if (col != 0) {
1949                                         return;
1950                                 }
1951                                 string pos;
1952                                 var row = _this.view.getRowAt(in_x, in_y, out pos);
1953                                 
1954                                 if (row < 0) {
1955                                         return;
1956                         
1957                                 }
1958                                 GLib.debug("hit row %d", row);
1959                                 var prop = _this.selmodel.getPropAt(row);
1960                                 _this.selmodel.selectProp(prop);
1961                         
1962                                 //var point_at = _this.view.getWidgetAtRow(row);
1963                                 
1964                                         // need to shift down, as ev.y does not inclucde header apparently..
1965                                 // or popover might be trying to do a central?
1966                         //       _this.view.editPropertyDetails(prop, (int) in_y + 12); 
1967                                  _this.stop_editor();
1968                              _this.view.popover.show(
1969                                                 _this.view.el, 
1970                                                 _this.node, prop,  
1971                                          (int)in_y);
1972                             
1973                             
1974                               
1975                         });
1976                 }
1977
1978                 // user defined functions
1979         }
1980
1981         public class Xcls_GestureClick46 : Object
1982         {
1983                 public Gtk.GestureClick el;
1984                 private Xcls_LeftProps  _this;
1985
1986
1987                         // my vars (def)
1988
1989                 // ctor
1990                 public Xcls_GestureClick46(Xcls_LeftProps _owner )
1991                 {
1992                         _this = _owner;
1993                         this.el = new Gtk.GestureClick();
1994
1995                         // my vars (dec)
1996
1997                         // set gobject values
1998                         this.el.button = 3;
1999
2000                         //listeners
2001                         this.el.pressed.connect( (n_press, in_x, in_y) => {
2002                         
2003                                 
2004                                  
2005                                 string pos;
2006                                 var row = _this.view.getRowAt(in_x, in_y, out pos);
2007                                 
2008                                 if (row < 0) {
2009                                         return;
2010                         
2011                                 }
2012                                 
2013                                 _this.stop_editor();
2014                                 GLib.debug("hit row %d", row);
2015                                 var prop = _this.selmodel.getPropAt(row);
2016                                 _this.selmodel.selectProp(prop);
2017                                 
2018                                 
2019                                 
2020                                 GLib.debug("Prssed %d", (int)  this.el.get_current_button());
2021                                 //_this.deletemenu.el.set_parent(_this.view.el);
2022                                 if (_this.deletemenu.el.parent == null) {
2023                                         _this.deletemenu.el.set_parent(_this.main_window.el);
2024                                 }
2025                                 
2026                                 
2027                                  
2028                                 _this.deletemenu.el.set_offset(
2029                                                 (int)in_x  - _this.view.el.get_width() ,
2030                                                 (int)in_y - _this.view.el.get_height()
2031                                         );
2032                                 _this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); 
2033                             _this.deletemenu.el.popup();
2034                               
2035                         });
2036                 }
2037
2038                 // user defined functions
2039         }
2040
2041         public class Xcls_selmodel : Object
2042         {
2043                 public Gtk.SingleSelection el;
2044                 private Xcls_LeftProps  _this;
2045
2046
2047                         // my vars (def)
2048
2049                 // ctor
2050                 public Xcls_selmodel(Xcls_LeftProps _owner )
2051                 {
2052                         _this = _owner;
2053                         _this.selmodel = this;
2054                         new Xcls_model( _this );
2055                         this.el = new Gtk.SingleSelection( _this.model.el );
2056
2057                         // my vars (dec)
2058
2059                         // set gobject values
2060                         this.el.can_unselect = true;
2061                 }
2062
2063                 // user defined functions
2064                 public int propToRow (JsRender.NodeProp prop) {
2065                         for (var i = 0 ; i < this.el.n_items; i++) {
2066                                 var r = (JsRender.NodeProp)this.el.get_item(i);
2067                                 if (r.equals(prop)) {
2068                                         return i;
2069                                         
2070                                 }
2071                         }
2072                         return -1;
2073                          
2074                 }
2075                 public void startEditing (JsRender.NodeProp prop) {
2076                         // should we call select?? - caller does int (from windowstate)
2077                         
2078                 }
2079                 public void selectProp (JsRender.NodeProp prop) {
2080                         for (var i = 0 ; i < this.el.n_items; i++) {
2081                                 var r = (JsRender.NodeProp)this.el.get_item(i);
2082                                 if (r.equals(prop)) {
2083                                         this.el.selected = i;
2084                                         return;
2085                                 }
2086                         }
2087                          
2088                 }
2089                 public JsRender.NodeProp getPropAt (uint row) {
2090                 
2091                         return   (JsRender.NodeProp) this.el.get_item(row);
2092                 
2093                          
2094                 }
2095         }
2096         public class Xcls_model : Object
2097         {
2098                 public GLib.ListStore el;
2099                 private Xcls_LeftProps  _this;
2100
2101
2102                         // my vars (def)
2103
2104                 // ctor
2105                 public Xcls_model(Xcls_LeftProps _owner )
2106                 {
2107                         _this = _owner;
2108                         _this.model = this;
2109                         this.el = new GLib.ListStore(typeof(JsRender.NodeProp));
2110
2111                         // my vars (dec)
2112
2113                         // set gobject values
2114                 }
2115
2116                 // user defined functions
2117         }
2118
2119
2120         public class Xcls_keycol : Object
2121         {
2122                 public Gtk.ColumnViewColumn el;
2123                 private Xcls_LeftProps  _this;
2124
2125
2126                         // my vars (def)
2127
2128                 // ctor
2129                 public Xcls_keycol(Xcls_LeftProps _owner )
2130                 {
2131                         _this = _owner;
2132                         _this.keycol = this;
2133                         var child_1 = new Xcls_SignalListItemFactory50( _this );
2134                         child_1.ref();
2135                         this.el = new Gtk.ColumnViewColumn( "Property", child_1.el );
2136
2137                         // my vars (dec)
2138
2139                         // set gobject values
2140                         this.el.id = "keycol";
2141                         this.el.expand = true;
2142                         this.el.resizable = true;
2143                 }
2144
2145                 // user defined functions
2146         }
2147         public class Xcls_SignalListItemFactory50 : Object
2148         {
2149                 public Gtk.SignalListItemFactory el;
2150                 private Xcls_LeftProps  _this;
2151
2152
2153                         // my vars (def)
2154
2155                 // ctor
2156                 public Xcls_SignalListItemFactory50(Xcls_LeftProps _owner )
2157                 {
2158                         _this = _owner;
2159                         this.el = new Gtk.SignalListItemFactory();
2160
2161                         // my vars (dec)
2162
2163                         // set gobject values
2164
2165                         //listeners
2166                         this.el.setup.connect( (listitem) => {
2167                                 var lbl = new Gtk.Label("");
2168                                 ((Gtk.ListItem)listitem).set_child(lbl);
2169                                 lbl.justify = Gtk.Justification.LEFT;
2170                                 lbl.xalign = 1;
2171                                 lbl.use_markup = true;
2172                                 lbl.ellipsize = Pango.EllipsizeMode.START;
2173                                 /*lbl.changed.connect(() => {
2174                                         // notify and save the changed value...
2175                                         //var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());
2176                                  
2177                                 //prop.val = lbl.text;
2178                                 //_this.updateIter(iter,prop);
2179                                 _this.changed();
2180                                 });
2181                                 */
2182                                 ((Gtk.ListItem)listitem).activatable = true;
2183                         });
2184                         this.el.bind.connect( (listitem) => {
2185                          var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
2186                          var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
2187                         
2188                          if (item == null) {
2189                                 return;
2190                         }
2191                         item.bind_property("to_display_name_prop",
2192                                             lb, "label",
2193                                            GLib.BindingFlags.SYNC_CREATE);
2194                         item.bind_property("to_tooltip_name_prop",
2195                                             lb, "tooltip_markup",
2196                                            GLib.BindingFlags.SYNC_CREATE);
2197                         // was item (1) in old layout
2198                          
2199                         
2200                         });
2201                 }
2202
2203                 // user defined functions
2204         }
2205
2206
2207         public class Xcls_valcol : Object
2208         {
2209                 public Gtk.ColumnViewColumn el;
2210                 private Xcls_LeftProps  _this;
2211
2212
2213                         // my vars (def)
2214
2215                 // ctor
2216                 public Xcls_valcol(Xcls_LeftProps _owner )
2217                 {
2218                         _this = _owner;
2219                         _this.valcol = this;
2220                         var child_1 = new Xcls_SignalListItemFactory52( _this );
2221                         child_1.ref();
2222                         this.el = new Gtk.ColumnViewColumn( "Value", child_1.el );
2223
2224                         // my vars (dec)
2225
2226                         // set gobject values
2227                         this.el.id = "valcol";
2228                         this.el.expand = true;
2229                         this.el.resizable = true;
2230                 }
2231
2232                 // user defined functions
2233         }
2234         public class Xcls_SignalListItemFactory52 : Object
2235         {
2236                 public Gtk.SignalListItemFactory el;
2237                 private Xcls_LeftProps  _this;
2238
2239
2240                         // my vars (def)
2241                 public bool is_setting;
2242
2243                 // ctor
2244                 public Xcls_SignalListItemFactory52(Xcls_LeftProps _owner )
2245                 {
2246                         _this = _owner;
2247                         this.el = new Gtk.SignalListItemFactory();
2248
2249                         // my vars (dec)
2250                         this.is_setting = false;
2251
2252                         // set gobject values
2253
2254                         //listeners
2255                         this.el.setup.connect( (listitem) => {
2256                                 var hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
2257                                 var elbl  = new Gtk.EditableLabel("");
2258                                 elbl.hexpand = true;
2259                                 hb.append(elbl);
2260                                 var lbl  = new Gtk.Label("");
2261                                 hb.append(lbl);
2262                                 lbl.hexpand = true;
2263                                 lbl.use_markup = true;
2264                                 lbl.xalign =0;
2265                                 lbl.ellipsize = Pango.EllipsizeMode.END;
2266                                 var cb = new Gtk.DropDown(new Gtk.StringList({}), null);
2267                                 cb.hexpand = true;
2268                          
2269                                 hb.append(cb);
2270                                 ((Gtk.ListItem)listitem).set_child(hb);
2271                                  
2272                                  var ef = new Gtk.EventControllerFocus();
2273                                  ef.enter.connect(() => {
2274                                          _this.stop_editor();
2275                                           var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
2276                                          _this.selmodel.selectProp(prop);               
2277                                  });
2278                                  elbl.add_controller(ef);
2279                                  
2280                                  
2281                                   // dropdown??? - stop editing, and highliht node
2282                                  var tb = (Gtk.ToggleButton) cb.get_first_child();
2283                                  tb.clicked.connect(() => {
2284                                          var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
2285                                                 
2286                                          _this.stop_editor();
2287                                          _this.selmodel.selectProp(prop);
2288                                          
2289                                  });
2290                                 elbl.changed.connect(() => {
2291                                         // notify and save the changed value...
2292                                         
2293                                 //_this.updateIter(iter,prop);
2294                                 // this should happen automatically
2295                                 
2296                                 if (!_this.loading && !this.is_setting) {
2297                                             var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
2298                                                  
2299                                          
2300                                             prop.val = elbl.text;
2301                                          GLib.debug("calling changed");
2302                                         _this.changed();
2303                                        
2304                                 }
2305                                 
2306                                 });
2307                                 
2308                                 
2309                                 cb.notify["selected"].connect(() => {
2310                                         // dropdown selection changed.
2311                                         
2312                                         
2313                                         
2314                                 //_this.updateIter(iter,prop);
2315                                 if (!_this.loading && !this.is_setting) {
2316                                             var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
2317                                             var model = (Gtk.StringList)cb.model;
2318                                             prop.val =   model.get_string(cb.selected);
2319                                             GLib.debug("property set to %s", prop.val);
2320                                         GLib.debug("calling changed");
2321                                         _this.changed();
2322                                          
2323                                 }
2324                                 
2325                                         
2326                                 });
2327                                 var gc = new Gtk.GestureClick();
2328                                 lbl.add_controller(gc);
2329                                 gc.pressed.connect(() => {
2330                                         var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
2331                                          _this.stop_editor();
2332                                     _this.show_editor(_this.file, prop.parent, prop);
2333                                 });
2334                                   
2335                                 
2336                                 
2337                         });
2338                         this.el.bind.connect( (listitem) => {
2339                                  this.is_setting = true;
2340                         
2341                         
2342                                 var bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
2343                          
2344                                 
2345                                 
2346                                 
2347                                 var elbl = (Gtk.EditableLabel)bx.get_first_child();
2348                                 var lbl = (Gtk.Label) elbl.get_next_sibling();
2349                                 var cb  = (Gtk.DropDown) lbl.get_next_sibling();
2350                                 // decide if it's a combo or editable text..
2351                                 var model = (Gtk.StringList) cb.model;
2352                          
2353                                 elbl.hide();
2354                                 lbl.hide();
2355                                 cb.hide();
2356                                 
2357                                 var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
2358                                 if (prop == null || _this.node == null ) {
2359                                         GLib.error("something is wrong");
2360                                          
2361                                 }
2362                                 if ( _this.node.fqn() == "") {
2363                                         GLib.debug("node is missing fqn");
2364                                         return;
2365                                 }
2366                                 
2367                                 //GLib.debug("prop = %s", prop.get_type().name());
2368                                 //GLib.debug("prop.val = %s", prop.val);
2369                                 //GLib.debug("prop.key = %s", prop.to_display_name());
2370                                  
2371                             var use_textarea =  prop.useTextArea();
2372                             
2373                             
2374                             var pal = _this.file.project.palete;
2375                                 
2376                             string[] opts;
2377                             var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);
2378                             
2379                             if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {
2380                                 use_textarea = true;
2381                             }
2382                             
2383                             
2384                             if (use_textarea) {
2385                                 prop.bind_property("val_short",
2386                                             lbl, "label",
2387                                            GLib.BindingFlags.SYNC_CREATE);
2388                                 prop.bind_property("val_tooltip",
2389                                             lbl, "tooltip_markup",
2390                                            GLib.BindingFlags.SYNC_CREATE);
2391                                 lbl.show();
2392                                         this.is_setting = false;        
2393                                 return;
2394                                 
2395                             }
2396                              
2397                                 
2398                                 
2399                                 
2400                                 
2401                                 // others... - fill in options for true/false?
2402                                    // GLib.debug (ktype.up());
2403                             if (has_opts) {
2404                                 
2405                                         while(model.get_n_items() > 0) {
2406                                                 model.remove(0);
2407                                         }
2408                                         cb.show();
2409                                         // can not remove - hopefully always empty.
2410                                         var sel = -1;
2411                                         for(var i = 0; i < opts.length; i ++) {
2412                                                 model.append( opts[i]);
2413                                                 // not sure this is a great idea... 
2414                                                 if (opts[i].down() == prop.val.down()) {
2415                                                         sel = i;
2416                                                 }
2417                                         }
2418                                         GLib.debug("Set selected item to %d", sel);
2419                                         cb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); 
2420                                         this.is_setting = false;        
2421                                         return ;
2422                             }
2423                                                           
2424                                 // see if type is a Enum.
2425                                 // triggers a changed event
2426                          
2427                                 elbl.set_text(prop.val);
2428                          
2429                                 elbl.show();
2430                                 this.is_setting = false;                         
2431                                 
2432                                 
2433                                 
2434                          
2435                         
2436                         });
2437                 }
2438
2439                 // user defined functions
2440         }
2441
2442
2443         public class Xcls_ContextMenu : Object
2444         {
2445                 public Gtk.Popover el;
2446                 private Xcls_LeftProps  _this;
2447
2448
2449                         // my vars (def)
2450
2451                 // ctor
2452                 public Xcls_ContextMenu(Xcls_LeftProps _owner )
2453                 {
2454                         _this = _owner;
2455                         _this.ContextMenu = this;
2456                         this.el = new Gtk.Popover();
2457
2458                         // my vars (dec)
2459
2460                         // set gobject values
2461                         var child_1 = new Xcls_Box54( _this );
2462                         child_1.ref();
2463                         this.el.child = child_1.el;
2464                 }
2465
2466                 // user defined functions
2467         }
2468         public class Xcls_Box54 : Object
2469         {
2470                 public Gtk.Box el;
2471                 private Xcls_LeftProps  _this;
2472
2473
2474                         // my vars (def)
2475
2476                 // ctor
2477                 public Xcls_Box54(Xcls_LeftProps _owner )
2478                 {
2479                         _this = _owner;
2480                         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2481
2482                         // my vars (dec)
2483
2484                         // set gobject values
2485                         var child_1 = new Xcls_Button55( _this );
2486                         child_1.ref();
2487                         this.el.append( child_1.el );
2488                 }
2489
2490                 // user defined functions
2491         }
2492         public class Xcls_Button55 : Object
2493         {
2494                 public Gtk.Button el;
2495                 private Xcls_LeftProps  _this;
2496
2497
2498                         // my vars (def)
2499
2500                 // ctor
2501                 public Xcls_Button55(Xcls_LeftProps _owner )
2502                 {
2503                         _this = _owner;
2504                         this.el = new Gtk.Button();
2505
2506                         // my vars (dec)
2507
2508                         // set gobject values
2509                         this.el.label = "Delete";
2510
2511                         //listeners
2512                         this.el.activate.connect( ( )  =>{
2513                                 _this.deleteSelected();
2514                                 
2515                         });
2516                 }
2517
2518                 // user defined functions
2519         }
2520
2521
2522
2523
2524
2525 }