21893cbb5859d083cce7256c648ed6200feb3365
[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        var pane = _this.main_window.editpane.el;
341         var try_size = (i * 25) + 60; // est. 20px per line + 40px header
342         GLib.Timeout.add_seconds(1, () => { 
343                 // max 80%...
344                 pane.set_position( 
345                      ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
346                     (int) (pane.max_position * 0.2f) :
347                     pane.max_position-try_size);
348             return GLib.Source.REMOVE;
349         });
350        
351     }
352     public              string keyFormat (string val, string type) {
353         
354         // Glib.markup_escape_text(val);
355     
356         if (type == "listener") {
357             return "<span font_weight=\"bold\" color=\"#660000\">" + 
358                 GLib.Markup.escape_text(val) +
359                  "</span>";
360         }
361         // property..
362         if (val.length < 1) {
363             return "<span  color=\"#FF0000\">--empty--</span>";
364         }
365         
366         //@ = signal
367         //$ = property with 
368         //# - object properties
369         //* = special
370         // all of these... - display value is last element..
371         var ar = val.strip().split(" ");
372         
373         
374         var dval = GLib.Markup.escape_text(ar[ar.length-1]);
375         
376         
377         
378         
379         switch(val[0]) {
380             case '@': // signal // just bold balck?
381                 if (dval[0] == '@') {
382                     dval = dval.substring(1);
383                 }
384             
385                 return @"<span  font_weight=\"bold\">@ $dval</span>";        
386             case '#': // object properties?
387                 if (dval[0] == '#') {
388                     dval = dval.substring(1);
389                 }
390                 return @"<span  font_weight=\"bold\">$dval</span>";
391             case '*': // special
392                 if (dval[0] == '*') {
393                     dval = dval.substring(1);
394                 }
395                 return @"<span   color=\"#0000CC\" font_weight=\"bold\">$dval</span>";            
396             case '$':
397                 if (dval[0] == '$') {
398                     dval = dval.substring(1);
399                 }
400                 return @"<span   style=\"italic\">$dval</span>";
401            case '|': // user defined methods
402                 if (dval[0] == '|') {
403                     dval = dval.substring(1);
404                 }
405                 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
406                 
407                   
408                 
409             default:
410                 return dval;
411         }
412           
413         
414     
415     }
416     public              void deleteSelected () {
417         
418             Gtk.TreeIter iter;
419             Gtk.TreeModel mod;
420             
421             var s = this.view.el.get_selection();
422             s.get_selected(out mod, out iter);
423                  
424                   
425             GLib.Value gval;
426             mod.get_value(iter, 0 , out gval);
427             var type = (string)gval;
428             
429             mod.get_value(iter, 1 , out gval);
430             var key = (string)gval;
431             
432             switch(type) {
433                 case "listener":
434                     this.node.listeners.unset(key);
435                     break;
436                     
437                 case "props":
438                     this.node.props.unset(key);
439                     break;
440             }
441             this.load(this.file, this.node);
442             
443             _this.changed();
444     }
445     public              void startEditingKey ( Gtk.TreePath path) {
446         
447          if (!this.stop_editor()) {
448             return;
449          }
450       
451         // others... - fill in options for true/false?
452         
453            
454         GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
455             this.allow_edit  = true;
456             this.keyrender.el.editable = true;
457          
458             this.view.el.set_cursor_on_cell(
459                 path,
460                 this.keycol.el,
461                 this.keyrender.el,
462                 true
463             );
464                    
465             return false;
466         });
467           
468         
469     }
470     public              void addProp (string in_type, string key, string value, string value_type) {
471           // info includes key, val, skel, etype..
472           //console.dump(info);
473             //type = info.type.toLowerCase();
474             //var data = this.toJS();
475               
476         var type = in_type == "signals" ? "listener" : in_type;
477           
478         var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
479                   
480         if (type == "listener") {
481             if (this.node.listeners.has_key(key)) {
482                 return;
483             }
484             this.node.listeners.set(key,value);
485         } else  {
486              assert(this.node != null);
487              assert(this.node.props != null);
488             if (this.node.props.has_key(fkey)) {
489                 return;
490             }
491             this.node.props.set(fkey,value);
492         }
493                 
494           
495         // add a row???
496         this.load(this.file, this.node);
497         
498         
499         
500         /// need to find the row which I've just added..
501         
502         
503         var s = this.view.el.get_selection();
504         s.unselect_all();
505         
506         GLib.debug("trying to find new iter");
507       
508         this.model.el.foreach((model, path, iter) => {
509             GLib.Value gval;
510         
511             this.model.el.get_value(iter, 0 , out gval);
512             if ((string)gval != type) {
513                 GLib.debug("not type: %s = %s\n", (string)gval , type);
514                 return false;
515             }
516             this.model.el.get_value(iter, 1 , out gval);
517             if ((string)gval != fkey) {
518                 GLib.debug("not key: %s = %s\n", (string)gval , fkey);
519                 return false;
520             }
521             // delay this?
522             GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
523             
524                 this.startEditingValue(this.model.el.get_path(iter));
525                 return false;
526             });
527             //s.select_iter(iter);
528             return true; 
529         });
530         
531         
532         
533                   
534     }
535     public              void updateIter (Gtk.TreeIter iter,  string type, string key, string kvalue) {
536     
537         //print("update Iter %s, %s\n", key,kvalue);
538         //typeof(string),  // 0 key type
539          //typeof(string),  // 1 key
540          //typeof(string),  // 2 key (display)
541          //typeof(string),  // 3 value
542          //typeof(string),  // 4 value (display)
543          //typeof(string),  // 5 both (tooltip)
544          //typeof(string),  // 6 key (sort)
545         
546         var dl = kvalue.strip().split("\n");
547     
548         var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
549         
550         if (type == "listener") {
551          
552            
553             
554             this.model.el.set(iter, 
555                     0, type,
556                 1, key,
557                 2, this.keyFormat(key ,type),
558                 3, kvalue,
559                 4, dis_val,
560                 5, "<tt>" +  GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
561                 6,  "0 " + key
562             ); 
563             return;
564         }
565         
566     
567     
568         this.model.el.set(iter, 
569                 0, "props",
570                 1, key,
571                 2,  this.keyFormat(key , "prop"),
572                 3, kvalue,
573                 4, dis_val,
574                  5, "<tt>" + GLib.Markup.escape_text(key + " " + kvalue) + "</tt>",
575                  6,  this.keySortFormat(key)
576             ); 
577     }
578     public class Xcls_Box2 : Object
579     {
580         public Gtk.Box el;
581         private Xcls_LeftProps  _this;
582
583
584             // my vars (def)
585
586         // ctor
587         public Xcls_Box2(Xcls_LeftProps _owner )
588         {
589             _this = _owner;
590             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
591
592             // my vars (dec)
593
594             // set gobject values
595             var child_0 = new Xcls_Button3( _this );
596             child_0.ref();
597             this.el.add (  child_0.el  );
598         }
599
600         // user defined functions
601     }
602     public class Xcls_Button3 : Object
603     {
604         public Gtk.Button el;
605         private Xcls_LeftProps  _this;
606
607
608             // my vars (def)
609
610         // ctor
611         public Xcls_Button3(Xcls_LeftProps _owner )
612         {
613             _this = _owner;
614             this.el = new Gtk.Button();
615
616             // my vars (dec)
617
618             // set gobject values
619             this.el.hexpand = true;
620             var child_0 = new Xcls_Box4( _this );
621             child_0.ref();
622             this.el.add (  child_0.el  );
623             var child_1 = new Xcls_AddPropertyPopup( _this );
624             child_1.ref();
625
626             //listeners
627             this.el.button_press_event.connect( (self, ev) => {
628                 _this.before_edit();
629                 
630                     
631                 var p = _this.AddPropertyPopup;
632                 p.el.set_screen(Gdk.Screen.get_default());
633                 p.el.show_all();
634                  p.el.popup(null, null, null, ev.button, ev.time);
635                  return true;
636             });
637         }
638
639         // user defined functions
640     }
641     public class Xcls_Box4 : Object
642     {
643         public Gtk.Box el;
644         private Xcls_LeftProps  _this;
645
646
647             // my vars (def)
648
649         // ctor
650         public Xcls_Box4(Xcls_LeftProps _owner )
651         {
652             _this = _owner;
653             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
654
655             // my vars (dec)
656
657             // set gobject values
658             var child_0 = new Xcls_Image5( _this );
659             child_0.ref();
660             this.el.add (  child_0.el  );
661             var child_1 = new Xcls_Label6( _this );
662             child_1.ref();
663             this.el.add (  child_1.el  );
664         }
665
666         // user defined functions
667     }
668     public class Xcls_Image5 : Object
669     {
670         public Gtk.Image el;
671         private Xcls_LeftProps  _this;
672
673
674             // my vars (def)
675
676         // ctor
677         public Xcls_Image5(Xcls_LeftProps _owner )
678         {
679             _this = _owner;
680             this.el = new Gtk.Image();
681
682             // my vars (dec)
683
684             // set gobject values
685             this.el.stock = Gtk.Stock.ADD;
686             this.el.icon_size = Gtk.IconSize.MENU;
687         }
688
689         // user defined functions
690     }
691
692     public class Xcls_Label6 : Object
693     {
694         public Gtk.Label el;
695         private Xcls_LeftProps  _this;
696
697
698             // my vars (def)
699
700         // ctor
701         public Xcls_Label6(Xcls_LeftProps _owner )
702         {
703             _this = _owner;
704             this.el = new Gtk.Label( "Other" );
705
706             // my vars (dec)
707
708             // set gobject values
709         }
710
711         // user defined functions
712     }
713
714
715     public class Xcls_AddPropertyPopup : Object
716     {
717         public Gtk.Menu el;
718         private Xcls_LeftProps  _this;
719
720
721             // my vars (def)
722
723         // ctor
724         public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
725         {
726             _this = _owner;
727             _this.AddPropertyPopup = this;
728             this.el = new Gtk.Menu();
729
730             // my vars (dec)
731
732             // set gobject values
733             var child_0 = new Xcls_MenuItem8( _this );
734             child_0.ref();
735             this.el.append (  child_0.el  );
736             var child_1 = new Xcls_MenuItem9( _this );
737             child_1.ref();
738             this.el.append (  child_1.el  );
739             var child_2 = new Xcls_MenuItem10( _this );
740             child_2.ref();
741             this.el.append (  child_2.el  );
742             var child_3 = new Xcls_MenuItem11( _this );
743             child_3.ref();
744             this.el.append (  child_3.el  );
745             var child_4 = new Xcls_MenuItem12( _this );
746             child_4.ref();
747             this.el.append (  child_4.el  );
748             var child_5 = new Xcls_SeparatorMenuItem13( _this );
749             child_5.ref();
750             this.el.add (  child_5.el  );
751             var child_6 = new Xcls_MenuItem14( _this );
752             child_6.ref();
753             this.el.append (  child_6.el  );
754             var child_7 = new Xcls_MenuItem15( _this );
755             child_7.ref();
756             this.el.append (  child_7.el  );
757             var child_8 = new Xcls_MenuItem16( _this );
758             child_8.ref();
759             this.el.append (  child_8.el  );
760             var child_9 = new Xcls_SeparatorMenuItem17( _this );
761             child_9.ref();
762             this.el.add (  child_9.el  );
763             var child_10 = new Xcls_MenuItem18( _this );
764             child_10.ref();
765             this.el.append (  child_10.el  );
766             var child_11 = new Xcls_MenuItem19( _this );
767             child_11.ref();
768             this.el.append (  child_11.el  );
769             var child_12 = new Xcls_MenuItem20( _this );
770             child_12.ref();
771             this.el.append (  child_12.el  );
772             var child_13 = new Xcls_SeparatorMenuItem21( _this );
773             child_13.ref();
774             this.el.add (  child_13.el  );
775             var child_14 = new Xcls_MenuItem22( _this );
776             child_14.ref();
777             this.el.append (  child_14.el  );
778             var child_15 = new Xcls_MenuItem23( _this );
779             child_15.ref();
780             this.el.append (  child_15.el  );
781             var child_16 = new Xcls_MenuItem24( _this );
782             child_16.ref();
783             this.el.append (  child_16.el  );
784         }
785
786         // user defined functions
787     }
788     public class Xcls_MenuItem8 : Object
789     {
790         public Gtk.MenuItem el;
791         private Xcls_LeftProps  _this;
792
793
794             // my vars (def)
795
796         // ctor
797         public Xcls_MenuItem8(Xcls_LeftProps _owner )
798         {
799             _this = _owner;
800             this.el = new Gtk.MenuItem();
801
802             // my vars (dec)
803
804             // set gobject values
805             this.el.tooltip_markup = "Using _this.{ID} will map to this element";
806             this.el.label = "id: _this.{ID} (Vala)";
807
808             //listeners
809             this.el.activate.connect( ()  => {
810                 _this.addProp( "prop", "id", "", "");
811             });
812         }
813
814         // user defined functions
815     }
816
817     public class Xcls_MenuItem9 : Object
818     {
819         public Gtk.MenuItem el;
820         private Xcls_LeftProps  _this;
821
822
823             // my vars (def)
824
825         // ctor
826         public Xcls_MenuItem9(Xcls_LeftProps _owner )
827         {
828             _this = _owner;
829             this.el = new Gtk.MenuItem();
830
831             // my vars (dec)
832
833             // set gobject values
834             this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
835             this.el.label = "pack: Pack method (Vala)";
836
837             //listeners
838             this.el.activate.connect( ( ) => {
839             
840                 _this.addProp( "prop", "pack","add", "*");
841             });
842         }
843
844         // user defined functions
845     }
846
847     public class Xcls_MenuItem10 : Object
848     {
849         public Gtk.MenuItem el;
850         private Xcls_LeftProps  _this;
851
852
853             // my vars (def)
854
855         // ctor
856         public Xcls_MenuItem10(Xcls_LeftProps _owner )
857         {
858             _this = _owner;
859             this.el = new Gtk.MenuItem();
860
861             // my vars (dec)
862
863             // set gobject values
864             this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
865             this.el.label = "ctor: Alterative to default contructor (Vala)";
866
867             //listeners
868             this.el.activate.connect( ( ) => {
869             
870                 _this.addProp( "prop", "ctor","", "*");
871             });
872         }
873
874         // user defined functions
875     }
876
877     public class Xcls_MenuItem11 : Object
878     {
879         public Gtk.MenuItem el;
880         private Xcls_LeftProps  _this;
881
882
883             // my vars (def)
884
885         // ctor
886         public Xcls_MenuItem11(Xcls_LeftProps _owner )
887         {
888             _this = _owner;
889             this.el = new Gtk.MenuItem();
890
891             // my vars (dec)
892
893             // set gobject values
894             this.el.tooltip_markup = "This code is called after the ctor";
895             this.el.label = "init: initialziation code (vala)";
896
897             //listeners
898             this.el.activate.connect( ( ) => {
899             
900                 _this.addProp( "prop",  "init", "{\n\n}\n", "*" );
901             });
902         }
903
904         // user defined functions
905     }
906
907     public class Xcls_MenuItem12 : Object
908     {
909         public Gtk.MenuItem el;
910         private Xcls_LeftProps  _this;
911
912
913             // my vars (def)
914
915         // ctor
916         public Xcls_MenuItem12(Xcls_LeftProps _owner )
917         {
918             _this = _owner;
919             this.el = new Gtk.MenuItem();
920
921             // my vars (dec)
922
923             // set gobject values
924             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";
925             this.el.label = "cms-id: (Roo JS/Pman library)";
926
927             //listeners
928             this.el.activate.connect( ()  => {
929                 _this.addProp( "prop", "cms-id", "", "string");
930             });
931         }
932
933         // user defined functions
934     }
935
936     public class Xcls_SeparatorMenuItem13 : Object
937     {
938         public Gtk.SeparatorMenuItem el;
939         private Xcls_LeftProps  _this;
940
941
942             // my vars (def)
943
944         // ctor
945         public Xcls_SeparatorMenuItem13(Xcls_LeftProps _owner )
946         {
947             _this = _owner;
948             this.el = new Gtk.SeparatorMenuItem();
949
950             // my vars (dec)
951
952             // set gobject values
953         }
954
955         // user defined functions
956     }
957
958     public class Xcls_MenuItem14 : Object
959     {
960         public Gtk.MenuItem el;
961         private Xcls_LeftProps  _this;
962
963
964             // my vars (def)
965
966         // ctor
967         public Xcls_MenuItem14(Xcls_LeftProps _owner )
968         {
969             _this = _owner;
970             this.el = new Gtk.MenuItem();
971
972             // my vars (dec)
973
974             // set gobject values
975             this.el.tooltip_markup = "Add a user defined string property";
976             this.el.label = "String";
977
978             //listeners
979             this.el.activate.connect( (self) => {
980             
981                 _this.addProp( "prop", "XXXX", "","string");
982             
983             });
984         }
985
986         // user defined functions
987     }
988
989     public class Xcls_MenuItem15 : Object
990     {
991         public Gtk.MenuItem el;
992         private Xcls_LeftProps  _this;
993
994
995             // my vars (def)
996
997         // ctor
998         public Xcls_MenuItem15(Xcls_LeftProps _owner )
999         {
1000             _this = _owner;
1001             this.el = new Gtk.MenuItem();
1002
1003             // my vars (dec)
1004
1005             // set gobject values
1006             this.el.tooltip_markup = "Add a user defined number property";
1007             this.el.label = "Number";
1008
1009             //listeners
1010             this.el.activate.connect( ( ) =>{
1011             
1012                 _this.addProp("prop",  "XXX", "0", "int");
1013             });
1014         }
1015
1016         // user defined functions
1017     }
1018
1019     public class Xcls_MenuItem16 : Object
1020     {
1021         public Gtk.MenuItem el;
1022         private Xcls_LeftProps  _this;
1023
1024
1025             // my vars (def)
1026
1027         // ctor
1028         public Xcls_MenuItem16(Xcls_LeftProps _owner )
1029         {
1030             _this = _owner;
1031             this.el = new Gtk.MenuItem();
1032
1033             // my vars (dec)
1034
1035             // set gobject values
1036             this.el.tooltip_markup = "Add a user defined boolean property";
1037             this.el.label = "Boolean";
1038
1039             //listeners
1040             this.el.activate.connect( ( ) =>{
1041             
1042                 _this.addProp( "prop", "XXX", "true", "bool");
1043             });
1044         }
1045
1046         // user defined functions
1047     }
1048
1049     public class Xcls_SeparatorMenuItem17 : Object
1050     {
1051         public Gtk.SeparatorMenuItem el;
1052         private Xcls_LeftProps  _this;
1053
1054
1055             // my vars (def)
1056
1057         // ctor
1058         public Xcls_SeparatorMenuItem17(Xcls_LeftProps _owner )
1059         {
1060             _this = _owner;
1061             this.el = new Gtk.SeparatorMenuItem();
1062
1063             // my vars (dec)
1064
1065             // set gobject values
1066         }
1067
1068         // user defined functions
1069     }
1070
1071     public class Xcls_MenuItem18 : Object
1072     {
1073         public Gtk.MenuItem el;
1074         private Xcls_LeftProps  _this;
1075
1076
1077             // my vars (def)
1078
1079         // ctor
1080         public Xcls_MenuItem18(Xcls_LeftProps _owner )
1081         {
1082             _this = _owner;
1083             this.el = new Gtk.MenuItem();
1084
1085             // my vars (dec)
1086
1087             // set gobject values
1088             this.el.tooltip_markup = "Add a user function boolean property";
1089             this.el.label = "Javascript Function";
1090
1091             //listeners
1092             this.el.activate.connect( ( ) =>{
1093             
1094                 _this.addProp("prop",  "XXXX", "function() { }", "| function");
1095             });
1096         }
1097
1098         // user defined functions
1099     }
1100
1101     public class Xcls_MenuItem19 : Object
1102     {
1103         public Gtk.MenuItem el;
1104         private Xcls_LeftProps  _this;
1105
1106
1107             // my vars (def)
1108
1109         // ctor
1110         public Xcls_MenuItem19(Xcls_LeftProps _owner )
1111         {
1112             _this = _owner;
1113             this.el = new Gtk.MenuItem();
1114
1115             // my vars (dec)
1116
1117             // set gobject values
1118             this.el.tooltip_markup = "Add a user function boolean property";
1119             this.el.label = "Vala Method";
1120
1121             //listeners
1122             this.el.activate.connect( ( ) =>{
1123             
1124                 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1125             });
1126         }
1127
1128         // user defined functions
1129     }
1130
1131     public class Xcls_MenuItem20 : Object
1132     {
1133         public Gtk.MenuItem el;
1134         private Xcls_LeftProps  _this;
1135
1136
1137             // my vars (def)
1138
1139         // ctor
1140         public Xcls_MenuItem20(Xcls_LeftProps _owner )
1141         {
1142             _this = _owner;
1143             this.el = new Gtk.MenuItem();
1144
1145             // my vars (dec)
1146
1147             // set gobject values
1148             this.el.tooltip_markup = "Add a vala signal";
1149             this.el.label = "Vala Signal";
1150
1151             //listeners
1152             this.el.activate.connect( ( ) =>{
1153             
1154                 _this.addProp( "prop", "XXXX", "()", "@ void");
1155             });
1156         }
1157
1158         // user defined functions
1159     }
1160
1161     public class Xcls_SeparatorMenuItem21 : Object
1162     {
1163         public Gtk.SeparatorMenuItem el;
1164         private Xcls_LeftProps  _this;
1165
1166
1167             // my vars (def)
1168
1169         // ctor
1170         public Xcls_SeparatorMenuItem21(Xcls_LeftProps _owner )
1171         {
1172             _this = _owner;
1173             this.el = new Gtk.SeparatorMenuItem();
1174
1175             // my vars (dec)
1176
1177             // set gobject values
1178         }
1179
1180         // user defined functions
1181     }
1182
1183     public class Xcls_MenuItem22 : Object
1184     {
1185         public Gtk.MenuItem el;
1186         private Xcls_LeftProps  _this;
1187
1188
1189             // my vars (def)
1190
1191         // ctor
1192         public Xcls_MenuItem22(Xcls_LeftProps _owner )
1193         {
1194             _this = _owner;
1195             this.el = new Gtk.MenuItem();
1196
1197             // my vars (dec)
1198
1199             // set gobject values
1200             this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1201             this.el.label = "Flexy - If";
1202
1203             //listeners
1204             this.el.activate.connect( ( ) =>{
1205             
1206                 _this.addProp("prop",  "flexy:if", "value_or_condition", "string");
1207             });
1208         }
1209
1210         // user defined functions
1211     }
1212
1213     public class Xcls_MenuItem23 : Object
1214     {
1215         public Gtk.MenuItem el;
1216         private Xcls_LeftProps  _this;
1217
1218
1219             // my vars (def)
1220
1221         // ctor
1222         public Xcls_MenuItem23(Xcls_LeftProps _owner )
1223         {
1224             _this = _owner;
1225             this.el = new Gtk.MenuItem();
1226
1227             // my vars (dec)
1228
1229             // set gobject values
1230             this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1231             this.el.label = "Flexy - Include";
1232
1233             //listeners
1234             this.el.activate.connect( ( ) =>{
1235             
1236                 _this.addProp("prop",  "flexy:include", "name_of_file.html", "string");
1237             });
1238         }
1239
1240         // user defined functions
1241     }
1242
1243     public class Xcls_MenuItem24 : Object
1244     {
1245         public Gtk.MenuItem el;
1246         private Xcls_LeftProps  _this;
1247
1248
1249             // my vars (def)
1250
1251         // ctor
1252         public Xcls_MenuItem24(Xcls_LeftProps _owner )
1253         {
1254             _this = _owner;
1255             this.el = new Gtk.MenuItem();
1256
1257             // my vars (dec)
1258
1259             // set gobject values
1260             this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1261             this.el.label = "Flexy - Foreach";
1262
1263             //listeners
1264             this.el.activate.connect( ( ) =>{
1265             
1266                 _this.addProp("prop",  "flexy:foreach", "array,key,value", "string");
1267             });
1268         }
1269
1270         // user defined functions
1271     }
1272
1273
1274
1275
1276     public class Xcls_EditProps : Object
1277     {
1278         public Gtk.ScrolledWindow el;
1279         private Xcls_LeftProps  _this;
1280
1281
1282             // my vars (def)
1283         public bool editing;
1284
1285         // ctor
1286         public Xcls_EditProps(Xcls_LeftProps _owner )
1287         {
1288             _this = _owner;
1289             _this.EditProps = this;
1290             this.el = new Gtk.ScrolledWindow( null, null );
1291
1292             // my vars (dec)
1293             this.editing = false;
1294
1295             // set gobject values
1296             this.el.shadow_type = Gtk.ShadowType.IN;
1297             var child_0 = new Xcls_view( _this );
1298             child_0.ref();
1299             this.el.add (  child_0.el  );
1300
1301             // init method
1302
1303             {
1304               
1305                this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1306             }
1307         }
1308
1309         // user defined functions
1310     }
1311     public class Xcls_view : Object
1312     {
1313         public Gtk.TreeView el;
1314         private Xcls_LeftProps  _this;
1315
1316
1317             // my vars (def)
1318         public Xcls_PopoverProperty popover;
1319
1320         // ctor
1321         public Xcls_view(Xcls_LeftProps _owner )
1322         {
1323             _this = _owner;
1324             _this.view = this;
1325             this.el = new Gtk.TreeView();
1326
1327             // my vars (dec)
1328             this.popover = null;
1329
1330             // set gobject values
1331             this.el.tooltip_column = 5;
1332             this.el.enable_tree_lines = true;
1333             this.el.headers_visible = true;
1334             var child_0 = new Xcls_model( _this );
1335             child_0.ref();
1336             this.el.set_model (  child_0.el  );
1337             var child_1 = new Xcls_keycol( _this );
1338             child_1.ref();
1339             this.el.append_column (  child_1.el  );
1340             var child_2 = new Xcls_valcol( _this );
1341             child_2.ref();
1342             this.el.append_column (  child_2.el  );
1343             var child_3 = new Xcls_ContextMenu( _this );
1344             child_3.ref();
1345
1346             // init method
1347
1348             {
1349                 var selection = this.el.get_selection();
1350                 selection.set_mode( Gtk.SelectionMode.SINGLE);
1351             
1352             
1353                 var description = new Pango.FontDescription();
1354                 description.set_size(10000);
1355                 this.el.override_font(description);
1356             }
1357
1358             //listeners
1359             this.el.button_press_event.connect( ( ev)  => {
1360              
1361                 Gtk.TreeViewColumn col;
1362                 int cell_x;
1363                 int cell_y;
1364                 Gtk.TreePath path;
1365                 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1366                     GLib.debug("nothing selected on click");
1367                     GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1368                         this.el.get_selection().unselect_all();
1369             
1370                         return false;
1371                     });
1372                      _this.before_edit();
1373                     return false; //not on a element.
1374                 }
1375                 
1376                  
1377                  // double click on name..
1378                  if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1 && col.title == "Name") {    
1379                     // show popup!.   
1380                     
1381                      if (this.popover == null) {
1382                                    this.popover = new Xcls_PopoverProperty();
1383                                    this.popover.mainwindow = _this.main_window;
1384                         }
1385                         
1386              
1387                      _this.before_edit();
1388                       _this.stop_editor();
1389                           
1390                      _this.keyrender.el.stop_editing(false);
1391                      _this.keyrender.el.editable  =false;
1392                 
1393                      _this.valrender.el.stop_editing(false);
1394                      _this.valrender.el.editable  =false;
1395                      Gtk.TreeIter iter;
1396                       var mod = this.el.get_model();
1397                           mod.get_iter (out iter, path);
1398                           
1399                    
1400                         GLib.Value gvaltype, gval;
1401                         mod.get_value(iter, 1 , out gval); // one is key..
1402                         
1403                      mod.get_value(iter,0, out gvaltype);
1404             
1405                     this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
1406                        
1407                     //  _this.startEditingKey(path); 
1408                      
1409                     return false;
1410                 }
1411                 
1412                 
1413                 
1414                 
1415                  // right click.
1416                  if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button == 3) {    
1417                     // show popup!.   
1418                     //if (col.title == "Value") {
1419                      //     _this.before_edit();
1420                      //    return false;
1421                      //}
1422             
1423                     var p = _this.ContextMenu;
1424             
1425                     p.el.set_screen(Gdk.Screen.get_default());
1426                     p.el.show_all();
1427                     p.el.popup(null, null, null,  ev.button, ev.time);
1428                     //Seed.print("click:" + res.column.title);
1429                     // select the 
1430                     GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1431               
1432                         this.el.get_selection().select_path(path);
1433                         return false;
1434                     });
1435                      _this.before_edit();
1436                     return false;
1437                 }
1438                 
1439                  
1440                 if (col.title != "Value") {
1441                     GLib.debug("col title != Value");
1442                     
1443                     GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1444                         this.el.get_selection().select_path(path);
1445                         return false;
1446                     });
1447                     
1448                     _this.before_edit();
1449                       //  XObject.error("column is not value?");
1450                     return false; // ignore.. - key click.. ??? should we do this??
1451                 }
1452                 
1453                 
1454                 // if the cell can be edited with a pulldown
1455                 // then we should return true... - and let the start_editing handle it?
1456                 
1457                 
1458                 
1459                 
1460                 
1461                   
1462                //             _this.before_edit(); <<< we really need to stop the other editor..
1463                  _this.keyrender.el.stop_editing(false);
1464                 _this.keyrender.el.editable  =false;
1465                 
1466                        
1467                 return _this.startEditingValue(path); // assumes selected row..
1468                     
1469                
1470             
1471                           
1472                
1473             });
1474         }
1475
1476         // user defined functions
1477     }
1478     public class Xcls_model : Object
1479     {
1480         public Gtk.TreeStore el;
1481         private Xcls_LeftProps  _this;
1482
1483
1484             // my vars (def)
1485
1486         // ctor
1487         public Xcls_model(Xcls_LeftProps _owner )
1488         {
1489             _this = _owner;
1490             _this.model = this;
1491             this.el = new Gtk.TreeStore( 7,      typeof(string),  // 0 key type
1492      typeof(string),  // 1 key
1493      typeof(string),  // 2 key (display)
1494      typeof(string),  // 3 value
1495      typeof(string),   // 4 value (display)
1496      typeof(string),   // 5 both (tooltip)     
1497      typeof(string)   // 6 key (for sorting)
1498  );
1499
1500             // my vars (dec)
1501
1502             // set gobject values
1503         }
1504
1505         // user defined functions
1506     }
1507
1508     public class Xcls_keycol : Object
1509     {
1510         public Gtk.TreeViewColumn el;
1511         private Xcls_LeftProps  _this;
1512
1513
1514             // my vars (def)
1515
1516         // ctor
1517         public Xcls_keycol(Xcls_LeftProps _owner )
1518         {
1519             _this = _owner;
1520             _this.keycol = this;
1521             this.el = new Gtk.TreeViewColumn();
1522
1523             // my vars (dec)
1524
1525             // set gobject values
1526             this.el.title = "Name";
1527             this.el.resizable = true;
1528             var child_0 = new Xcls_keyrender( _this );
1529             child_0.ref();
1530             this.el.pack_start (  child_0.el , false );
1531
1532             // init method
1533
1534             this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1535              this.el.add_attribute(_this.keyrender.el , "text", 1 );
1536         }
1537
1538         // user defined functions
1539     }
1540     public class Xcls_keyrender : Object
1541     {
1542         public Gtk.CellRendererText el;
1543         private Xcls_LeftProps  _this;
1544
1545
1546             // my vars (def)
1547
1548         // ctor
1549         public Xcls_keyrender(Xcls_LeftProps _owner )
1550         {
1551             _this = _owner;
1552             _this.keyrender = this;
1553             this.el = new Gtk.CellRendererText();
1554
1555             // my vars (dec)
1556
1557             // set gobject values
1558
1559             //listeners
1560             this.el.editing_started.connect( (  editable, path) => {
1561             
1562                  Gtk.TreeIter  iter;
1563                 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1564                 GLib.Value gval;
1565                               
1566             
1567             
1568                  //   this.get('/LeftPanel.model').activePath  = path;
1569                 _this.model.el.get_value(iter,1, out gval);
1570                     var val = (string)gval;
1571                              
1572                     ((Gtk.Entry)editable).set_text(val);                 
1573             });
1574             this.el.edited.connect( (path, newtext) => {
1575                     GLib.debug("Keyrender  - signal:edited\n");
1576                 
1577                 this.el.editable = false;
1578               
1579              
1580             
1581                     Gtk.TreeIter  iter;
1582                     _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1583                     GLib.Value gval;
1584                     
1585                      _this.model.el.get_value(iter,1, out gval);
1586                     var oldval = (string)gval;
1587                     
1588                      _this.model.el.get_value(iter,0, out gval);
1589                     var ktype = (string)gval;
1590                    
1591                     _this.model.el.set_value(iter, 1, newtext);
1592                     
1593                     if (oldval == newtext) {
1594                         return;
1595                     }
1596                     
1597                     
1598                     GLib.debug("ktype: %s\n",ktype);
1599                     switch(ktype) {
1600                         case "listener":
1601                             var ov = _this.node.listeners.get(oldval);
1602                             _this.node.listeners.set(newtext, ov);
1603                             _this.node.listeners.unset(oldval);
1604                             
1605                             _this.updateIter(iter,  ktype, newtext, ov);
1606                             
1607                             break;
1608                         case "props":
1609                             var ov = _this.node.props.get(oldval);
1610                             _this.node.props.set(newtext, ov);
1611                             _this.node.props.unset(oldval);
1612                             _this.updateIter(iter,  ktype, newtext, ov);
1613                             break;
1614                      }
1615                      _this.changed();
1616                       
1617             });
1618         }
1619
1620         // user defined functions
1621     }
1622
1623
1624     public class Xcls_valcol : Object
1625     {
1626         public Gtk.TreeViewColumn el;
1627         private Xcls_LeftProps  _this;
1628
1629
1630             // my vars (def)
1631
1632         // ctor
1633         public Xcls_valcol(Xcls_LeftProps _owner )
1634         {
1635             _this = _owner;
1636             _this.valcol = this;
1637             this.el = new Gtk.TreeViewColumn();
1638
1639             // my vars (dec)
1640
1641             // set gobject values
1642             this.el.title = "Value";
1643             this.el.resizable = true;
1644             var child_0 = new Xcls_valrender( _this );
1645             child_0.ref();
1646             this.el.pack_start (  child_0.el , true );
1647
1648             // init method
1649
1650             {
1651                 
1652                 //     typeof(string),  // 0 key type
1653                 // typeof(string),  // 1 key
1654                 // typeof(string),  // 2 key (display)
1655                 // typeof(string),  // 3 value
1656                 // typeof(string)   // 4 value (display)
1657             
1658                 
1659                 this.el.add_attribute(_this.valrender.el , "text", 4 );
1660                 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1661                 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1662                       // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1663             
1664              // this.get('/LeftPanel').editableColumn= this;
1665             }
1666         }
1667
1668         // user defined functions
1669     }
1670     public class Xcls_valrender : Object
1671     {
1672         public Gtk.CellRendererCombo el;
1673         private Xcls_LeftProps  _this;
1674
1675
1676             // my vars (def)
1677
1678         // ctor
1679         public Xcls_valrender(Xcls_LeftProps _owner )
1680         {
1681             _this = _owner;
1682             _this.valrender = this;
1683             this.el = new Gtk.CellRendererCombo();
1684
1685             // my vars (dec)
1686
1687             // set gobject values
1688             this.el.editable = false;
1689             this.el.text_column = 0;
1690             this.el.has_entry = true;
1691             var child_0 = new Xcls_valrendermodel( _this );
1692             child_0.ref();
1693             this.el.model = child_0.el;
1694
1695             //listeners
1696             this.el.editing_started.connect( ( editable, path) => {
1697                 //_this.editing = true;
1698                 GLib.debug("editing started called\n");
1699                 if (!_this.allow_edit) {
1700                    
1701                      GLib.debug("val - editing_Started\n");
1702                     this.el.editable = false; // make sure it's not editor...
1703                
1704                      
1705                     return;
1706                 }
1707                  _this.allow_edit =false;
1708                 
1709                
1710                  if (  this.el.has_entry ) {
1711                
1712                      Gtk.TreeIter  iter;
1713                     _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1714                     GLib.Value gval;
1715                                   
1716             
1717                   
1718                      //   this.get('/LeftPanel.model').activePath  = path;
1719                    _this.model.el.get_value(iter,3, out gval);
1720                 
1721             
1722                     var val = (string)gval;
1723                     var combo =        (Gtk.ComboBox)editable;
1724             
1725                     var entry =  (Gtk.Entry) combo.get_child();        
1726                     entry.set_text(val);
1727                 }
1728                
1729             });
1730             this.el.edited.connect( (path, newtext) => {
1731                 GLib.debug("Valrender  - signal:edited\n");
1732               
1733                     this.el.editable = false;
1734             /*  
1735              m.set(iter, 
1736                             0, "listener",
1737                             1, miter.get_key(),
1738                             2, "<b>" + miter.get_key() + "</b>",
1739                             3, miter.get_value(),
1740                             4, display_value(short);
1741                         ); 
1742             
1743               */      
1744             
1745                     Gtk.TreeIter  iter;
1746                     _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1747                     GLib.Value gval;
1748                     
1749                      _this.model.el.get_value(iter,0, out gval);
1750                     var ktype = (string)gval;
1751                     
1752                     
1753                      _this.model.el.get_value(iter,3, out gval);
1754                     var oldval = (string)gval;
1755                     
1756                      _this.model.el.get_value(iter,1, out gval);
1757                     var key = (string)gval;
1758                     
1759                      
1760                     
1761                     switch(ktype) {
1762                         case "listener":
1763                             _this.node.listeners.set(key, newtext);
1764                             _this.updateIter(iter,ktype,key,newtext);
1765                             break;
1766                         case "props":
1767                             _this.node.props.set(key,newtext);
1768                             _this.updateIter(iter,ktype, key,newtext);                
1769                             break;
1770                      }
1771             //         _this.load(_this.file,_this.node);
1772                      _this.changed();
1773                       
1774             });
1775         }
1776
1777         // user defined functions
1778         public              void setOptions (string[] ar) {
1779               var m = _this.valrendermodel.el;
1780                 m.clear();
1781              Gtk.TreeIter iret;
1782             for (var i =0; i < ar.length; i++) {
1783                     m.append(out iret);
1784                     m.set_value(iret, 0, ar[i]);
1785             }
1786         
1787         }
1788     }
1789     public class Xcls_valrendermodel : Object
1790     {
1791         public Gtk.ListStore el;
1792         private Xcls_LeftProps  _this;
1793
1794
1795             // my vars (def)
1796
1797         // ctor
1798         public Xcls_valrendermodel(Xcls_LeftProps _owner )
1799         {
1800             _this = _owner;
1801             _this.valrendermodel = this;
1802             this.el = new Gtk.ListStore( 1, typeof(string) );
1803
1804             // my vars (dec)
1805
1806             // set gobject values
1807         }
1808
1809         // user defined functions
1810     }
1811
1812
1813
1814     public class Xcls_ContextMenu : Object
1815     {
1816         public Gtk.Menu el;
1817         private Xcls_LeftProps  _this;
1818
1819
1820             // my vars (def)
1821
1822         // ctor
1823         public Xcls_ContextMenu(Xcls_LeftProps _owner )
1824         {
1825             _this = _owner;
1826             _this.ContextMenu = this;
1827             this.el = new Gtk.Menu();
1828
1829             // my vars (dec)
1830
1831             // set gobject values
1832             var child_0 = new Xcls_MenuItem34( _this );
1833             child_0.ref();
1834             this.el.append (  child_0.el  );
1835             var child_1 = new Xcls_SeparatorMenuItem35( _this );
1836             child_1.ref();
1837             this.el.append (  child_1.el  );
1838             var child_2 = new Xcls_MenuItem36( _this );
1839             child_2.ref();
1840             this.el.append (  child_2.el  );
1841         }
1842
1843         // user defined functions
1844     }
1845     public class Xcls_MenuItem34 : Object
1846     {
1847         public Gtk.MenuItem el;
1848         private Xcls_LeftProps  _this;
1849
1850
1851             // my vars (def)
1852
1853         // ctor
1854         public Xcls_MenuItem34(Xcls_LeftProps _owner )
1855         {
1856             _this = _owner;
1857             this.el = new Gtk.MenuItem();
1858
1859             // my vars (dec)
1860
1861             // set gobject values
1862             this.el.label = "Edit (double click)";
1863
1864             //listeners
1865             this.el.activate.connect( ( )  =>{
1866               
1867                 var s = _this.view.el.get_selection();
1868                 Gtk.TreeIter iter;
1869                 Gtk.TreeModel mod;
1870                 s.get_selected (out  mod, out  iter);
1871                 
1872                   if (_this.view.popover == null) {
1873                                    _this.view.popover = new Xcls_PopoverProperty();
1874                                    _this.view.popover.mainwindow = _this.main_window;
1875                         }
1876                         
1877              
1878                   _this.before_edit();
1879                   _this.stop_editor();
1880                   
1881                  _this.keyrender.el.stop_editing(false);
1882                  _this.keyrender.el.editable  =false;
1883             
1884                  _this.valrender.el.stop_editing(false);
1885                  _this.valrender.el.editable  =false;
1886                  
1887                   
1888                 GLib.Value gvaltype, gval;
1889                 mod.get_value(iter, 1 , out gval); // one is key..
1890                 
1891                  mod.get_value(iter,0, out gvaltype);
1892             
1893                 _this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);
1894                    
1895                 
1896                 
1897                // _this.startEditingKey(model.get_path(iter));
1898             });
1899         }
1900
1901         // user defined functions
1902     }
1903
1904     public class Xcls_SeparatorMenuItem35 : Object
1905     {
1906         public Gtk.SeparatorMenuItem el;
1907         private Xcls_LeftProps  _this;
1908
1909
1910             // my vars (def)
1911
1912         // ctor
1913         public Xcls_SeparatorMenuItem35(Xcls_LeftProps _owner )
1914         {
1915             _this = _owner;
1916             this.el = new Gtk.SeparatorMenuItem();
1917
1918             // my vars (dec)
1919
1920             // set gobject values
1921         }
1922
1923         // user defined functions
1924     }
1925
1926     public class Xcls_MenuItem36 : Object
1927     {
1928         public Gtk.MenuItem el;
1929         private Xcls_LeftProps  _this;
1930
1931
1932             // my vars (def)
1933
1934         // ctor
1935         public Xcls_MenuItem36(Xcls_LeftProps _owner )
1936         {
1937             _this = _owner;
1938             this.el = new Gtk.MenuItem();
1939
1940             // my vars (dec)
1941
1942             // set gobject values
1943             this.el.label = "Delete";
1944
1945             //listeners
1946             this.el.activate.connect( ( )  =>{
1947                 _this.deleteSelected();
1948             });
1949         }
1950
1951         // user defined functions
1952     }
1953
1954
1955
1956
1957 }