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