src/Builder4/PopoverFileDetails.bjs
[app.Builder.js] / src / Builder4 / PopoverFileDetails.vala
1 static Xcls_PopoverFileDetails  _PopoverFileDetails;
2
3 public class Xcls_PopoverFileDetails : Object
4 {
5     public Gtk.Popover el;
6     private Xcls_PopoverFileDetails  _this;
7
8     public static Xcls_PopoverFileDetails singleton()
9     {
10         if (_PopoverFileDetails == null) {
11             _PopoverFileDetails= new Xcls_PopoverFileDetails();
12         }
13         return _PopoverFileDetails;
14     }
15     public Xcls_grid grid;
16     public Xcls_filetypelbl filetypelbl;
17     public Xcls_filetype filetype;
18     public Xcls_ftdbcellrenderer ftdbcellrenderer;
19     public Xcls_ftdbmodel ftdbmodel;
20     public Xcls_name name;
21     public Xcls_title title;
22     public Xcls_region region;
23     public Xcls_parent parent;
24     public Xcls_permname permname;
25     public Xcls_modOrder modOrder;
26     public Xcls_build_module build_module;
27     public Xcls_dbcellrenderer dbcellrenderer;
28     public Xcls_dbmodel dbmodel;
29     public Xcls_dir dir;
30     public Xcls_dircellrenderer dircellrenderer;
31     public Xcls_dirmodel dirmodel;
32     public Xcls_save_btn save_btn;
33
34         // my vars (def)
35     public signal void success (Project.Project pr, JsRender.JsRender file);
36     public bool done;
37     public Project.Project project;
38     public JsRender.JsRender file;
39     public Xcls_MainWindow mainwindow;
40
41     // ctor
42     public Xcls_PopoverFileDetails()
43     {
44         _this = this;
45         this.el = new Gtk.Popover( null );
46
47         // my vars (dec)
48         this.done = false;
49         this.file = null;
50         this.mainwindow = null;
51
52         // set gobject values
53         this.el.border_width = 0;
54         this.el.modal = true;
55         this.el.position = Gtk.PositionType.RIGHT;
56         var child_0 = new Xcls_Box2( _this );
57         child_0.ref();
58         this.el.add (  child_0.el  );
59
60         //listeners
61         this.el.closed.connect( () => {
62           if (!this.done) {
63             _this.el.show();
64           
65           }
66         });
67     }
68
69     // user defined functions
70     public   void updateFileFromEntry () {
71     
72             _this.file.title = _this.title.el.get_text();
73             _this.file.region = _this.region.el.get_text();            
74             _this.file.parent = _this.parent.el.get_text();                        
75             _this.file.permname = _this.permname.el.get_text();                                    
76             _this.file.modOrder = _this.modOrder.el.get_text();
77             
78             if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
79                 _this.file.renameTo(_this.name.el.get_text());
80             }
81             // store the module...
82             _this.file.build_module = "";        
83              Gtk.TreeIter iter; 
84             if (_this.build_module.el.get_active_iter (out iter)) {
85                  Value vfname;
86                  this.dbmodel.el.get_value (iter, 0, out vfname);
87                  if (((string)vfname).length > 0) {
88                      _this.file.build_module = (string)vfname;
89                  }
90         
91             }
92             
93             
94     
95                                                         
96     }
97     public void show (JsRender.JsRender c, Gtk.Widget btn) 
98     {
99         this.project = c.project;
100         this.done = false;
101         
102         
103         //if (!this.el) {
104             //this.init();
105          //}
106         
107         _this.name.el.set_text(c.name);
108         _this.title.el.set_text(c.title);
109         _this.parent.el.set_text(c.parent);    
110         _this.region.el.set_text(c.region);
111         _this.modOrder.el.set_text(c.modOrder);
112          _this.permname.el.set_text(c.permname);
113         
114         
115         
116         
117         
118         
119         
120         if (c.path.length > 0) {
121                  
122             this.save_btn.el.set_label("Save");
123         } else {
124             this.save_btn.el.set_label("Create");
125         }
126         
127          var ar = new Gee.ArrayList<string>();
128          _this.dbmodel.loadData(ar,"");
129         // load the modules... if relivant..
130         if (this.project.xtype == "Gtk") {
131             var p = (Project.Gtk)c.project;
132               var cg = p.compilegroups;
133     
134             var iter = cg.map_iterator();
135            while(iter.next()) {
136                 var key = iter.get_key();
137                 if (key == "_default_") {
138                     continue;
139                 }
140                 ar.add(key);
141             };
142             _this.dbmodel.loadData(ar, c.build_module);
143     
144         }
145         
146          
147         _this.file = c;
148         //console.log('show all');
149        this.el.set_modal(true);
150         this.el.set_relative_to(btn);
151     
152         this.el.set_position(Gtk.PositionType.RIGHT);
153         
154         // window + header?
155          print("SHOWALL - POPIP\n");
156         this.el.show_all();
157         this.name.el.grab_focus();
158         
159         
160         
161         if (c.path.length > 0) {
162                 _this.filetype.el.hide();
163                 _this.filetypelbl.el.hide();
164                 _this.filetype.showhide(true); // as we only work on bjs files currently
165         } else {
166             
167             _this.ftdbmodel.loadData("bjs"); // fixme - need to determine type..
168             _this.filetype.el.show();
169             _this.filetypelbl.el.show();
170         }
171         
172         
173         //this.success = c.success;
174         
175         
176     }
177     public class Xcls_Box2 : Object
178     {
179         public Gtk.Box el;
180         private Xcls_PopoverFileDetails  _this;
181
182
183             // my vars (def)
184
185         // ctor
186         public Xcls_Box2(Xcls_PopoverFileDetails _owner )
187         {
188             _this = _owner;
189             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
190
191             // my vars (dec)
192
193             // set gobject values
194             this.el.homogeneous = false;
195             var child_0 = new Xcls_HeaderBar3( _this );
196             child_0.ref();
197             this.el.pack_start (  child_0.el , false,true,0 );
198             var child_1 = new Xcls_grid( _this );
199             child_1.ref();
200             this.el.pack_start (  child_1.el , false,false,4 );
201             var child_2 = new Xcls_HButtonBox29( _this );
202             child_2.ref();
203             this.el.pack_end (  child_2.el , false,true,0 );
204         }
205
206         // user defined functions
207     }
208     public class Xcls_HeaderBar3 : Object
209     {
210         public Gtk.HeaderBar el;
211         private Xcls_PopoverFileDetails  _this;
212
213
214             // my vars (def)
215
216         // ctor
217         public Xcls_HeaderBar3(Xcls_PopoverFileDetails _owner )
218         {
219             _this = _owner;
220             this.el = new Gtk.HeaderBar();
221
222             // my vars (dec)
223
224             // set gobject values
225             this.el.title = "Add / Edit File";
226         }
227
228         // user defined functions
229     }
230
231     public class Xcls_grid : Object
232     {
233         public Gtk.Grid el;
234         private Xcls_PopoverFileDetails  _this;
235
236
237             // my vars (def)
238
239         // ctor
240         public Xcls_grid(Xcls_PopoverFileDetails _owner )
241         {
242             _this = _owner;
243             _this.grid = this;
244             this.el = new Gtk.Grid();
245
246             // my vars (dec)
247
248             // set gobject values
249             this.el.margin_right = 4;
250             this.el.margin_left = 4;
251             this.el.row_spacing = 2;
252             var child_0 = new Xcls_filetypelbl( _this );
253             child_0.ref();
254             this.el.attach (  child_0.el , 0,0,1,1 );
255             var child_1 = new Xcls_filetype( _this );
256             child_1.ref();
257             this.el.attach (  child_1.el , 1,0,1,1 );
258             var child_2 = new Xcls_Label9( _this );
259             child_2.ref();
260             this.el.attach (  child_2.el , 0,1,1,1 );
261             var child_3 = new Xcls_name( _this );
262             child_3.ref();
263             this.el.attach (  child_3.el , 1,1,1,1 );
264             var child_4 = new Xcls_Label11( _this );
265             child_4.ref();
266             this.el.attach (  child_4.el , 0,2,1,1 );
267             var child_5 = new Xcls_title( _this );
268             child_5.ref();
269             this.el.attach (  child_5.el , 1,2,1,1 );
270             var child_6 = new Xcls_Label13( _this );
271             child_6.ref();
272             this.el.attach (  child_6.el , 0,3,1,1 );
273             var child_7 = new Xcls_region( _this );
274             child_7.ref();
275             this.el.attach (  child_7.el , 1,3,1,1 );
276             var child_8 = new Xcls_Label15( _this );
277             child_8.ref();
278             this.el.attach (  child_8.el , 0,4,1,1 );
279             var child_9 = new Xcls_parent( _this );
280             child_9.ref();
281             this.el.attach (  child_9.el , 1,4,1,1 );
282             var child_10 = new Xcls_Label17( _this );
283             child_10.ref();
284             this.el.attach (  child_10.el , 0,5,1,1 );
285             var child_11 = new Xcls_permname( _this );
286             child_11.ref();
287             this.el.attach (  child_11.el , 1,5,1,1 );
288             var child_12 = new Xcls_Label19( _this );
289             child_12.ref();
290             this.el.attach (  child_12.el , 0,6,1,1 );
291             var child_13 = new Xcls_modOrder( _this );
292             child_13.ref();
293             this.el.attach (  child_13.el , 1,6,1,1 );
294             var child_14 = new Xcls_Label21( _this );
295             child_14.ref();
296             this.el.attach (  child_14.el , 0,7,1,1 );
297             var child_15 = new Xcls_build_module( _this );
298             child_15.ref();
299             this.el.attach (  child_15.el , 1,7,1,1 );
300             var child_16 = new Xcls_Label25( _this );
301             child_16.ref();
302             this.el.attach (  child_16.el , 0,8 );
303             var child_17 = new Xcls_dir( _this );
304             child_17.ref();
305             this.el.attach (  child_17.el , 1,8 );
306         }
307
308         // user defined functions
309     }
310     public class Xcls_filetypelbl : Object
311     {
312         public Gtk.Label el;
313         private Xcls_PopoverFileDetails  _this;
314
315
316             // my vars (def)
317
318         // ctor
319         public Xcls_filetypelbl(Xcls_PopoverFileDetails _owner )
320         {
321             _this = _owner;
322             _this.filetypelbl = this;
323             this.el = new Gtk.Label( "File type" );
324
325             // my vars (dec)
326
327             // set gobject values
328             this.el.justify = Gtk.Justification.RIGHT;
329             this.el.xalign = 0.900000f;
330         }
331
332         // user defined functions
333     }
334
335     public class Xcls_filetype : Object
336     {
337         public Gtk.ComboBox el;
338         private Xcls_PopoverFileDetails  _this;
339
340
341             // my vars (def)
342
343         // ctor
344         public Xcls_filetype(Xcls_PopoverFileDetails _owner )
345         {
346             _this = _owner;
347             _this.filetype = this;
348             this.el = new Gtk.ComboBox();
349
350             // my vars (dec)
351
352             // set gobject values
353             var child_0 = new Xcls_ftdbcellrenderer( _this );
354             child_0.ref();
355             this.el.pack_start (  child_0.el , true );
356             var child_1 = new Xcls_ftdbmodel( _this );
357             child_1.ref();
358             this.el.set_model (  child_1.el  );
359
360             // init method
361
362             this.el.add_attribute(_this.ftdbcellrenderer.el , "markup", 1 );
363
364             //listeners
365             this.el.changed.connect( () => {
366                 Gtk.TreeIter iter;
367                 bool is_bjs = true;
368                 if (this.el.get_active_iter(out iter)) {
369                         Value vfname;
370                         _this.ftdbmodel.el.get_value (iter, 0, out vfname);
371                          is_bjs = ((string)vfname) == "bjs";
372                 }
373                 
374               
375                 // directory is only available for non-bjs 
376                 this.showhide(is_bjs);
377             
378             
379             });
380         }
381
382         // user defined functions
383         public void showhide (bool is_bjs) {
384                 for (var i = 2; i < 9;i++) {
385                         var el = _this.grid.el.get_child_at(0,i);
386                         
387                         var showhide= is_bjs;
388                         if (i> 7) {
389                                 showhide = !showhide;
390                         }
391                         
392                         if (showhide) {
393                            el.show();
394                         } else {
395                                 el.hide();
396                         }
397                          el = _this.grid.el.get_child_at(1,i);
398                         if (showhide) {
399                            el.show();
400                         } else {
401                                 el.hide();
402                         }     
403             }
404         }
405     }
406     public class Xcls_ftdbcellrenderer : Object
407     {
408         public Gtk.CellRendererText el;
409         private Xcls_PopoverFileDetails  _this;
410
411
412             // my vars (def)
413
414         // ctor
415         public Xcls_ftdbcellrenderer(Xcls_PopoverFileDetails _owner )
416         {
417             _this = _owner;
418             _this.ftdbcellrenderer = this;
419             this.el = new Gtk.CellRendererText();
420
421             // my vars (dec)
422
423             // set gobject values
424         }
425
426         // user defined functions
427     }
428
429     public class Xcls_ftdbmodel : Object
430     {
431         public Gtk.ListStore el;
432         private Xcls_PopoverFileDetails  _this;
433
434
435             // my vars (def)
436
437         // ctor
438         public Xcls_ftdbmodel(Xcls_PopoverFileDetails _owner )
439         {
440             _this = _owner;
441             _this.ftdbmodel = this;
442             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
443
444             // my vars (dec)
445
446             // set gobject values
447         }
448
449         // user defined functions
450         public void loadData (string cur) {
451             this.el.clear();                                    
452             Gtk.TreeIter iter;
453             var el = this.el;
454             
455            /// el.append(out iter);
456             
457              
458            // el.set_value(iter, 0, "");
459            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
460         
461             el.append(out iter);
462         
463             
464             el.set_value(iter, 0, "bjs");
465             el.set_value(iter, 1, "User Interface File (bjs)");
466             _this.filetype.el.set_active_iter(iter);
467         
468             el.append(out iter);
469             
470             el.set_value(iter, 0, "vala");
471             el.set_value(iter, 1, "Vala");
472                 if (cur == "vala") {
473                     _this.filetype.el.set_active_iter(iter);
474             }
475         
476         
477         
478             el.append(out iter);
479             
480             el.set_value(iter, 0, "js");
481             el.set_value(iter, 1, "Javascript");
482         
483                 if (cur == "js") {
484                     _this.filetype.el.set_active_iter(iter);
485             }
486         
487             el.append(out iter);
488             
489             el.set_value(iter, 0, "css");
490             el.set_value(iter, 1, "CSS");
491         
492                 if (cur == "css") {
493                     _this.filetype.el.set_active_iter(iter);
494             }
495                                              
496         }
497     }
498
499
500     public class Xcls_Label9 : Object
501     {
502         public Gtk.Label el;
503         private Xcls_PopoverFileDetails  _this;
504
505
506             // my vars (def)
507
508         // ctor
509         public Xcls_Label9(Xcls_PopoverFileDetails _owner )
510         {
511             _this = _owner;
512             this.el = new Gtk.Label( "Component Name" );
513
514             // my vars (dec)
515
516             // set gobject values
517             this.el.justify = Gtk.Justification.RIGHT;
518             this.el.xalign = 0.900000f;
519         }
520
521         // user defined functions
522     }
523
524     public class Xcls_name : Object
525     {
526         public Gtk.Entry el;
527         private Xcls_PopoverFileDetails  _this;
528
529
530             // my vars (def)
531
532         // ctor
533         public Xcls_name(Xcls_PopoverFileDetails _owner )
534         {
535             _this = _owner;
536             _this.name = this;
537             this.el = new Gtk.Entry();
538
539             // my vars (dec)
540
541             // set gobject values
542             this.el.visible = true;
543         }
544
545         // user defined functions
546     }
547
548     public class Xcls_Label11 : Object
549     {
550         public Gtk.Label el;
551         private Xcls_PopoverFileDetails  _this;
552
553
554             // my vars (def)
555
556         // ctor
557         public Xcls_Label11(Xcls_PopoverFileDetails _owner )
558         {
559             _this = _owner;
560             this.el = new Gtk.Label( "Title" );
561
562             // my vars (dec)
563
564             // set gobject values
565             this.el.justify = Gtk.Justification.RIGHT;
566             this.el.xalign = 0.900000f;
567             this.el.visible = true;
568         }
569
570         // user defined functions
571     }
572
573     public class Xcls_title : Object
574     {
575         public Gtk.Entry el;
576         private Xcls_PopoverFileDetails  _this;
577
578
579             // my vars (def)
580
581         // ctor
582         public Xcls_title(Xcls_PopoverFileDetails _owner )
583         {
584             _this = _owner;
585             _this.title = this;
586             this.el = new Gtk.Entry();
587
588             // my vars (dec)
589
590             // set gobject values
591             this.el.visible = true;
592         }
593
594         // user defined functions
595     }
596
597     public class Xcls_Label13 : Object
598     {
599         public Gtk.Label el;
600         private Xcls_PopoverFileDetails  _this;
601
602
603             // my vars (def)
604
605         // ctor
606         public Xcls_Label13(Xcls_PopoverFileDetails _owner )
607         {
608             _this = _owner;
609             this.el = new Gtk.Label( "Region" );
610
611             // my vars (dec)
612
613             // set gobject values
614             this.el.justify = Gtk.Justification.RIGHT;
615             this.el.xalign = 0.900000f;
616             this.el.tooltip_text = "center, north, south, east, west";
617             this.el.visible = true;
618         }
619
620         // user defined functions
621     }
622
623     public class Xcls_region : Object
624     {
625         public Gtk.Entry el;
626         private Xcls_PopoverFileDetails  _this;
627
628
629             // my vars (def)
630
631         // ctor
632         public Xcls_region(Xcls_PopoverFileDetails _owner )
633         {
634             _this = _owner;
635             _this.region = this;
636             this.el = new Gtk.Entry();
637
638             // my vars (dec)
639
640             // set gobject values
641             this.el.visible = true;
642         }
643
644         // user defined functions
645     }
646
647     public class Xcls_Label15 : Object
648     {
649         public Gtk.Label el;
650         private Xcls_PopoverFileDetails  _this;
651
652
653             // my vars (def)
654
655         // ctor
656         public Xcls_Label15(Xcls_PopoverFileDetails _owner )
657         {
658             _this = _owner;
659             this.el = new Gtk.Label( "Parent Name" );
660
661             // my vars (dec)
662
663             // set gobject values
664             this.el.justify = Gtk.Justification.RIGHT;
665             this.el.xalign = 0.900000f;
666             this.el.visible = true;
667         }
668
669         // user defined functions
670     }
671
672     public class Xcls_parent : Object
673     {
674         public Gtk.Entry el;
675         private Xcls_PopoverFileDetails  _this;
676
677
678             // my vars (def)
679
680         // ctor
681         public Xcls_parent(Xcls_PopoverFileDetails _owner )
682         {
683             _this = _owner;
684             _this.parent = this;
685             this.el = new Gtk.Entry();
686
687             // my vars (dec)
688
689             // set gobject values
690             this.el.visible = true;
691         }
692
693         // user defined functions
694     }
695
696     public class Xcls_Label17 : Object
697     {
698         public Gtk.Label el;
699         private Xcls_PopoverFileDetails  _this;
700
701
702             // my vars (def)
703
704         // ctor
705         public Xcls_Label17(Xcls_PopoverFileDetails _owner )
706         {
707             _this = _owner;
708             this.el = new Gtk.Label( "Permission Name" );
709
710             // my vars (dec)
711
712             // set gobject values
713             this.el.justify = Gtk.Justification.RIGHT;
714             this.el.xalign = 0.900000f;
715             this.el.visible = true;
716         }
717
718         // user defined functions
719     }
720
721     public class Xcls_permname : Object
722     {
723         public Gtk.Entry el;
724         private Xcls_PopoverFileDetails  _this;
725
726
727             // my vars (def)
728
729         // ctor
730         public Xcls_permname(Xcls_PopoverFileDetails _owner )
731         {
732             _this = _owner;
733             _this.permname = this;
734             this.el = new Gtk.Entry();
735
736             // my vars (dec)
737
738             // set gobject values
739             this.el.visible = true;
740         }
741
742         // user defined functions
743     }
744
745     public class Xcls_Label19 : Object
746     {
747         public Gtk.Label el;
748         private Xcls_PopoverFileDetails  _this;
749
750
751             // my vars (def)
752
753         // ctor
754         public Xcls_Label19(Xcls_PopoverFileDetails _owner )
755         {
756             _this = _owner;
757             this.el = new Gtk.Label( "Order (for tabs)" );
758
759             // my vars (dec)
760
761             // set gobject values
762             this.el.justify = Gtk.Justification.RIGHT;
763             this.el.xalign = 0.900000f;
764             this.el.visible = true;
765         }
766
767         // user defined functions
768     }
769
770     public class Xcls_modOrder : Object
771     {
772         public Gtk.Entry el;
773         private Xcls_PopoverFileDetails  _this;
774
775
776             // my vars (def)
777
778         // ctor
779         public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
780         {
781             _this = _owner;
782             _this.modOrder = this;
783             this.el = new Gtk.Entry();
784
785             // my vars (dec)
786
787             // set gobject values
788             this.el.visible = true;
789         }
790
791         // user defined functions
792     }
793
794     public class Xcls_Label21 : Object
795     {
796         public Gtk.Label el;
797         private Xcls_PopoverFileDetails  _this;
798
799
800             // my vars (def)
801
802         // ctor
803         public Xcls_Label21(Xcls_PopoverFileDetails _owner )
804         {
805             _this = _owner;
806             this.el = new Gtk.Label( "Module to build (Vala only)" );
807
808             // my vars (dec)
809
810             // set gobject values
811             this.el.justify = Gtk.Justification.RIGHT;
812             this.el.xalign = 0.900000f;
813             this.el.visible = true;
814         }
815
816         // user defined functions
817     }
818
819     public class Xcls_build_module : Object
820     {
821         public Gtk.ComboBox el;
822         private Xcls_PopoverFileDetails  _this;
823
824
825             // my vars (def)
826
827         // ctor
828         public Xcls_build_module(Xcls_PopoverFileDetails _owner )
829         {
830             _this = _owner;
831             _this.build_module = this;
832             this.el = new Gtk.ComboBox();
833
834             // my vars (dec)
835
836             // set gobject values
837             var child_0 = new Xcls_dbcellrenderer( _this );
838             child_0.ref();
839             this.el.pack_start (  child_0.el , true );
840             var child_1 = new Xcls_dbmodel( _this );
841             child_1.ref();
842             this.el.set_model (  child_1.el  );
843
844             // init method
845
846             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
847         }
848
849         // user defined functions
850     }
851     public class Xcls_dbcellrenderer : Object
852     {
853         public Gtk.CellRendererText el;
854         private Xcls_PopoverFileDetails  _this;
855
856
857             // my vars (def)
858
859         // ctor
860         public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
861         {
862             _this = _owner;
863             _this.dbcellrenderer = this;
864             this.el = new Gtk.CellRendererText();
865
866             // my vars (dec)
867
868             // set gobject values
869         }
870
871         // user defined functions
872     }
873
874     public class Xcls_dbmodel : Object
875     {
876         public Gtk.ListStore el;
877         private Xcls_PopoverFileDetails  _this;
878
879
880             // my vars (def)
881
882         // ctor
883         public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
884         {
885             _this = _owner;
886             _this.dbmodel = this;
887             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
888
889             // my vars (dec)
890
891             // set gobject values
892         }
893
894         // user defined functions
895         public void loadData (Gee.ArrayList<string> data, string cur) {
896             this.el.clear();                                    
897             Gtk.TreeIter iter;
898             var el = this.el;
899             
900            /// el.append(out iter);
901             
902              
903            // el.set_value(iter, 0, "");
904            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
905         
906             el.append(out iter);
907         
908             
909             el.set_value(iter, 0, "");
910             el.set_value(iter, 1, "-- select a module --");
911             _this.build_module.el.set_active_iter(iter);
912             
913             for (var i = 0; i < data.size;i++) {
914             
915         
916                 el.append(out iter);
917                 
918                 el.set_value(iter, 0, data.get(i));
919                 el.set_value(iter, 1, data.get(i));
920                 
921                 if (data.get(i) == cur) {
922                     _this.build_module.el.set_active_iter(iter);
923                 }
924                 
925             }
926              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
927                                              
928         }
929     }
930
931
932     public class Xcls_Label25 : Object
933     {
934         public Gtk.Label el;
935         private Xcls_PopoverFileDetails  _this;
936
937
938             // my vars (def)
939
940         // ctor
941         public Xcls_Label25(Xcls_PopoverFileDetails _owner )
942         {
943             _this = _owner;
944             this.el = new Gtk.Label( "Directory" );
945
946             // my vars (dec)
947
948             // set gobject values
949             this.el.justify = Gtk.Justification.RIGHT;
950             this.el.xalign = 0.900000f;
951             this.el.visible = true;
952         }
953
954         // user defined functions
955     }
956
957     public class Xcls_dir : Object
958     {
959         public Gtk.ComboBox el;
960         private Xcls_PopoverFileDetails  _this;
961
962
963             // my vars (def)
964
965         // ctor
966         public Xcls_dir(Xcls_PopoverFileDetails _owner )
967         {
968             _this = _owner;
969             _this.dir = this;
970             this.el = new Gtk.ComboBox();
971
972             // my vars (dec)
973
974             // set gobject values
975             var child_0 = new Xcls_dircellrenderer( _this );
976             child_0.ref();
977             this.el.pack_start (  child_0.el , true );
978             var child_1 = new Xcls_dirmodel( _this );
979             child_1.ref();
980             this.el.set_model (  child_1.el  );
981
982             // init method
983
984             this.el.add_attribute(_this.dircellrenderer.el , "markup", 1 );
985         }
986
987         // user defined functions
988     }
989     public class Xcls_dircellrenderer : Object
990     {
991         public Gtk.CellRendererText el;
992         private Xcls_PopoverFileDetails  _this;
993
994
995             // my vars (def)
996
997         // ctor
998         public Xcls_dircellrenderer(Xcls_PopoverFileDetails _owner )
999         {
1000             _this = _owner;
1001             _this.dircellrenderer = this;
1002             this.el = new Gtk.CellRendererText();
1003
1004             // my vars (dec)
1005
1006             // set gobject values
1007         }
1008
1009         // user defined functions
1010     }
1011
1012     public class Xcls_dirmodel : Object
1013     {
1014         public Gtk.ListStore el;
1015         private Xcls_PopoverFileDetails  _this;
1016
1017
1018             // my vars (def)
1019
1020         // ctor
1021         public Xcls_dirmodel(Xcls_PopoverFileDetails _owner )
1022         {
1023             _this = _owner;
1024             _this.dirmodel = this;
1025             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1026
1027             // my vars (dec)
1028
1029             // set gobject values
1030         }
1031
1032         // user defined functions
1033         public void loadData (Gee.ArrayList<string> data, string cur) {
1034             this.el.clear();                                    
1035             Gtk.TreeIter iter;
1036             var el = this.el;
1037             
1038            /// el.append(out iter);
1039             
1040              
1041            // el.set_value(iter, 0, "");
1042            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
1043         
1044             el.append(out iter);
1045         
1046             
1047             el.set_value(iter, 0, "");
1048             el.set_value(iter, 1, "-- select a module --");
1049             _this.build_module.el.set_active_iter(iter);
1050             
1051             for (var i = 0; i < data.size;i++) {
1052             
1053         
1054                 el.append(out iter);
1055                 
1056                 el.set_value(iter, 0, data.get(i));
1057                 el.set_value(iter, 1, data.get(i));
1058                 
1059                 if (data.get(i) == cur) {
1060                     _this.build_module.el.set_active_iter(iter);
1061                 }
1062                 
1063             }
1064              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1065                                              
1066         }
1067     }
1068
1069
1070
1071     public class Xcls_HButtonBox29 : Object
1072     {
1073         public Gtk.HButtonBox el;
1074         private Xcls_PopoverFileDetails  _this;
1075
1076
1077             // my vars (def)
1078
1079         // ctor
1080         public Xcls_HButtonBox29(Xcls_PopoverFileDetails _owner )
1081         {
1082             _this = _owner;
1083             this.el = new Gtk.HButtonBox();
1084
1085             // my vars (dec)
1086
1087             // set gobject values
1088             this.el.margin_right = 4;
1089             this.el.margin_left = 4;
1090             this.el.margin_bottom = 4;
1091             var child_0 = new Xcls_Button30( _this );
1092             child_0.ref();
1093             this.el.add (  child_0.el  );
1094             var child_1 = new Xcls_save_btn( _this );
1095             child_1.ref();
1096             this.el.add (  child_1.el  );
1097         }
1098
1099         // user defined functions
1100     }
1101     public class Xcls_Button30 : Object
1102     {
1103         public Gtk.Button el;
1104         private Xcls_PopoverFileDetails  _this;
1105
1106
1107             // my vars (def)
1108
1109         // ctor
1110         public Xcls_Button30(Xcls_PopoverFileDetails _owner )
1111         {
1112             _this = _owner;
1113             this.el = new Gtk.Button();
1114
1115             // my vars (dec)
1116
1117             // set gobject values
1118             this.el.label = "Cancel";
1119
1120             //listeners
1121             this.el.clicked.connect( () => { 
1122             
1123               _this.done = true;
1124                 _this.el.hide(); 
1125             });
1126         }
1127
1128         // user defined functions
1129     }
1130
1131     public class Xcls_save_btn : Object
1132     {
1133         public Gtk.Button el;
1134         private Xcls_PopoverFileDetails  _this;
1135
1136
1137             // my vars (def)
1138
1139         // ctor
1140         public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
1141         {
1142             _this = _owner;
1143             _this.save_btn = this;
1144             this.el = new Gtk.Button();
1145
1146             // my vars (dec)
1147
1148             // set gobject values
1149             this.el.label = "Save";
1150
1151             //listeners
1152             this.el.clicked.connect( ( ) =>  { 
1153             
1154              
1155             
1156             
1157                 if (_this.name.el.get_text().length  < 1) {
1158                     StandardErrorDialog.show(
1159                         _this.mainwindow.el,
1160                         "You have to set Component name "
1161                     );
1162                      
1163                     return;
1164                 }
1165                 // what does this do?
1166                 
1167                 var isNew = _this.file.name.length  > 0 ? false : true;
1168                 /*
1169                 if (!isNew && this.file.name != _this.name.el.get_text()) {
1170                     Xcls_StandardErrorDialog.singleton().show(
1171                         this.el,
1172                         "Sorry changing names does not work yet. "
1173                     );
1174                      
1175                     return;
1176                 }
1177                 */
1178                  
1179                 
1180               
1181                 // FIXME - this may be more complicated...
1182                 //for (var i in this.def) {
1183                 //    this.file[i] =  this.get(i).el.get_text();
1184                 //}
1185             
1186                 if (!isNew) {
1187                     try {
1188                          _this.updateFileFromEntry();
1189                      } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
1190                           Xcls_StandardErrorDialog.singleton().show(
1191                             _this.mainwindow.el,
1192                             "The name you used already exists "
1193                         );
1194                         return;
1195                          
1196                      }
1197             
1198                       _this.done = true;
1199                     _this.file.save();
1200                     _this.el.hide();
1201                     return;
1202                 }
1203                 
1204                 // ---------------- NEW FILES...
1205                 
1206                 var fn = _this.name.el.get_text();
1207                 var dir = _this.project.firstPath();   // fixme.. should be based on a pulldown?
1208                 
1209                 var targetfile = dir + "/" + fn;
1210                 
1211                 // strip the file type off the end..
1212                 Gtk.TreeIter iter;
1213             
1214                 if (!_this.filetype.el.get_active_iter(out iter)) {
1215                         // should not happen...
1216                         // so we are jut going to return without 
1217                         StandardErrorDialog.show(
1218                         _this.mainwindow.el,
1219                         "You must select a file type. "
1220                     );
1221                 }
1222                 Value ftypename;
1223                 _this.ftdbmodel.el.get_value (iter, 0, out ftypename);
1224                 var ext = ((string)ftypename);
1225                 
1226                 var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
1227                 targetfile = rx.replace(targetfile, targetfile.length, 0, ""); 
1228                
1229                 if (GLib.FileUtils.test(targetfile + "." + ext, GLib.FileTest.EXISTS)) {
1230                     Xcls_StandardErrorDialog.singleton().show(
1231                         _this.mainwindow.el,
1232                         "That file already exists"
1233                     ); 
1234                     return;
1235                 }
1236                
1237                var f =  JsRender.JsRender.factory(
1238                         ext == "bjs" ? _this.file.project.xtype : "PlainFile",  
1239                         _this.file.project, 
1240                         targetfile + "." + ext);
1241             
1242                 _this.file = f;
1243                 
1244             
1245                 
1246                 _this.updateFileFromEntry();
1247                 _this.file.loaded = true;
1248                 _this.file.save();
1249                 if (ext == "bjs") {
1250                         _this.file.project.addFile(_this.file);
1251                 }
1252                 
1253              
1254                 // what about .js ?
1255                _this.done = true;
1256                 _this.el.hide();
1257             
1258             // hopefull this will work with bjs files..
1259                 
1260                 _this.success(_this.project, _this.file);
1261                
1262             });
1263         }
1264
1265         // user defined functions
1266     }
1267
1268
1269
1270 }