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