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