Fix #7959 - new project flow - use void func to callback after each step, tidy up...
[roobuilder] / src / Builder4 / MainWindow.vala
1     static Xcls_MainWindow  _MainWindow;
2
3     public class Xcls_MainWindow : Object
4     {
5         public Gtk.ApplicationWindow el;
6         private Xcls_MainWindow  _this;
7
8         public static Xcls_MainWindow singleton()
9         {
10             if (_MainWindow == null) {
11                 _MainWindow= new Xcls_MainWindow();
12             }
13             return _MainWindow;
14         }
15         public Xcls_headerbar headerbar;
16         public Xcls_windowbtn windowbtn;
17         public Xcls_windowspopup windowspopup;
18         public Xcls_popover_menu popover_menu;
19         public Xcls_open_projects_btn open_projects_btn;
20         public Xcls_vbox vbox;
21         public Xcls_mainpane mainpane;
22         public Xcls_leftpane leftpane;
23         public Xcls_editpane editpane;
24         public Xcls_tree tree;
25         public Xcls_props props;
26         public Xcls_rooviewbox rooviewbox;
27         public Xcls_codeeditviewbox codeeditviewbox;
28         public Xcls_topbarmenu topbarmenu;
29         public Xcls_statusbar statusbar;
30         public Xcls_statusbar_compilestatus_label statusbar_compilestatus_label;
31         public Xcls_statusbar_errors statusbar_errors;
32         public Xcls_statusbar_warnings statusbar_warnings;
33         public Xcls_statusbar_depricated statusbar_depricated;
34         public Xcls_statusbar_run statusbar_run;
35         public Xcls_statusbar_compile_spinner statusbar_compile_spinner;
36
37             // my vars (def)
38         public WindowState windowstate;
39         public Project.Project project;
40
41         // ctor
42         public Xcls_MainWindow()
43         {
44             _this = this;
45             this.el = new Gtk.ApplicationWindow(BuilderApplication.singleton({}));
46
47             // my vars (dec)
48             this.project = null;
49
50             // set gobject values
51             this.el.title = "Roo Application Builder";
52             this.el.default_height = 850;
53             this.el.default_width = 1200;
54             new Xcls_headerbar( _this );
55             this.el.set_titlebar ( _this.headerbar.el  );
56             new Xcls_vbox( _this );
57             this.el.set_child ( _this.vbox.el  );
58
59             // init method
60
61             this.el.set_icon_name("roobuilder");
62
63             //listeners
64             this.el.close_request.connect( ( ) => {
65                  Resources.singleton().disconnect(_this.statusbar.handler_id);
66                  
67                  BuilderApplication.removeWindow(this);
68                  
69                  if (BuilderApplication.windows.size  < 1) {
70             
71                         BuilderApplication.singleton(  null ).quit();
72                  }
73                 return true;
74             });
75             this.el.show.connect( ( ) => {
76                 // hide the file editing..
77                
78                 //this.hideViewEditing();
79                 // this is updated by windowstate - we try and fill it in..
80                  _this.statusbar.el.hide();
81                  //_this.statusbar_errors.el.hide();
82                 //_this.statusbar_warnings.el.hide();
83                 //_this.statusbar_depricated.el.hide();
84                 _this.statusbar_compile_spinner.el.hide();
85               
86                 Resources.singleton().checkResources();
87                 
88               
89             
90             });
91             this.el.hide.connect( () =>  {
92              
93              
94             
95             });
96         }
97
98         // user defined functions
99         public void updateErrors (Palete.ValaCompileRequest? req) {
100         
101                 if (req == null) {
102          
103                     _this.statusbar_errors.el.hide();
104                         _this.statusbar_warnings.el.hide();
105                         _this.statusbar_depricated.el.hide();
106                         return;
107                 }
108                 
109                 
110                 this.statusbar_errors.setNotices(
111                         req.errorByType.get("ERR"),
112                         req.totalErrors("ERR"),
113                         req.totalErrors("ERR", this.windowstate.file)
114                 );
115                 this.statusbar_warnings.setNotices(
116                         req.errorByType.get("WARN"),
117                         req.totalErrors("WARN"),
118                         req.totalErrors("WARN", this.windowstate.file)
119                 );
120                 this.statusbar_depricated.setNotices(
121                         req.errorByType.get("DEPR"),
122                         req.totalErrors("DEPR"),
123                         req.totalErrors("DEPR", this.windowstate.file)
124                 );
125         
126                 _this.statusbar_run.el.hide();
127         
128                 if (req.totalErrors("ERR") < 1) {
129                         _this.statusbar_run.el.show();
130                 }
131                 
132         }
133         public void initChildren () {
134             // this needs putting in a better place..
135             this.windowstate = new WindowState(this);
136              
137         
138          
139         
140             
141         
142         
143         
144         }
145         public void show () {
146            
147             this.el.show();
148             if (this.windowstate.file  == null) {
149                 this.windowstate.showPopoverFiles(this.open_projects_btn.el, null, false);
150             }
151         }
152         public void setTitle () {
153             if (_this.windowstate.project == null || 
154                     _this.windowstate.file == null
155             ) {
156                 this.el.set_title("Select File");
157                 return;
158                 }
159             _this.el.set_title(
160                 _this.windowstate.project.name + 
161                 " - " +
162                         _this.windowstate.file.relpath);
163         }
164         public void openNewWindow () {
165          
166             var w = new Xcls_MainWindow();
167             w.ref();
168                 BuilderApplication.addWindow(w);
169             w.el.show();
170             w.initChildren();
171             w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);
172              
173         }
174         public class Xcls_headerbar : Object
175         {
176             public Gtk.HeaderBar el;
177             private Xcls_MainWindow  _this;
178
179
180                 // my vars (def)
181             public bool show_close_button;
182             public string title;
183
184             // ctor
185             public Xcls_headerbar(Xcls_MainWindow _owner )
186             {
187                 _this = _owner;
188                 _this.headerbar = this;
189                 this.el = new Gtk.HeaderBar();
190
191                 // my vars (dec)
192                 this.show_close_button = true;
193                 this.title = "Application Builder";
194
195                 // set gobject values
196                 var child_1 = new Xcls_Box3( _this );
197                 child_1.ref();
198                 this.el.pack_start ( child_1.el  );
199             }
200
201             // user defined functions
202         }
203         public class Xcls_Box3 : Object
204         {
205             public Gtk.Box el;
206             private Xcls_MainWindow  _this;
207
208
209                 // my vars (def)
210
211             // ctor
212             public Xcls_Box3(Xcls_MainWindow _owner )
213             {
214                 _this = _owner;
215                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
216
217                 // my vars (dec)
218
219                 // set gobject values
220                 new Xcls_windowbtn( _this );
221                 this.el.append( _this.windowbtn.el );
222                 new Xcls_open_projects_btn( _this );
223                 this.el.append ( _this.open_projects_btn.el  );
224             }
225
226             // user defined functions
227         }
228         public class Xcls_windowbtn : Object
229         {
230             public Gtk.Button el;
231             private Xcls_MainWindow  _this;
232
233
234                 // my vars (def)
235             public Gee.ArrayList<Gtk.Widget> mitems;
236
237             // ctor
238             public Xcls_windowbtn(Xcls_MainWindow _owner )
239             {
240                 _this = _owner;
241                 _this.windowbtn = this;
242                 this.el = new Gtk.Button();
243
244                 // my vars (dec)
245
246                 // set gobject values
247                 this.el.margin_end = 4;
248                 this.el.halign = Gtk.Align.START;
249                 new Xcls_windowspopup( _this );
250                 var child_2 = new Xcls_Box10( _this );
251                 this.el.child = child_2.el;
252
253                 // init method
254
255                 {
256                         this.mitems = new Gee.ArrayList<Gtk.Button>();
257                 }
258
259                 //listeners
260                 this.el.clicked.connect( ( ) => {
261                         this.updateMenu();
262                 
263                          _this.windowspopup.el.set_parent(this.el);
264                 
265                          _this.windowspopup.el.set_position(Gtk.PositionType.BOTTOM); 
266                          _this.windowspopup.el.popup(); 
267                 });
268             }
269
270             // user defined functions
271             public void updateMenu () {
272                  foreach(var m in  this.mitems) {
273                          _this.popover_menu.el.remove(m);
274                  }
275                  this.mitems.clear();
276                 
277                  BuilderApplication.windows.sort((a,b) => {
278                         if (a.windowstate == null ||
279                                  a.windowstate.file == null || 
280                                  b.windowstate == null ||
281                                  b.windowstate.file == null
282                                  ) { 
283                                 return 0;
284                         }
285             
286                         var ap = a.windowstate.file.project.name;
287                         var bp = b.windowstate.file.project.name;
288                         
289             
290                         
291                         if (ap != bp) {
292                                 return ap.collate(bp);
293                         }
294                         var af =  a.windowstate.file == null ? "" : a.windowstate.file.getTitle();
295                         var bf = b.windowstate.file == null ? "" : b.windowstate.file.getTitle();               
296                         return af.collate(bf);
297                  
298                  });
299                  
300                  var p = "";
301                  foreach(var w in BuilderApplication.windows) {
302                         var wid = BuilderApplication.windows.index_of(w);
303                         // fixme find a better way to display this.
304                         if (w.windowstate == null ||
305                                  w.windowstate.file == null || 
306                                  _this.windowstate == null ||
307                                  _this.windowstate.file == null
308                                  ) { 
309                                 continue;
310                         }
311                         // should not happen...
312                         if (w.windowstate.file.path == _this.windowstate.file.path) {
313                                 continue;
314                         }
315                         if (w.windowstate.file.project.name != p || p != "") {
316                                 var ms = new Gtk.Separator(Gtk.Orientation.HORIZONTAL);
317                                 _this.popover_menu.el.append(ms);
318                                 ms.show();
319                                 this.mitems.add(ms);
320                         }
321                         
322                         p = w.windowstate.file.project.name;
323                         
324             
325                         GLib.debug("add menuitem %s", w.windowstate.file.path);
326                         
327                         
328                         
329                         var m = new Gtk.Button.with_label(
330                                 w.windowstate.file.project.name + " : " + w.windowstate.file.relpath
331                         );
332                         m.halign = Gtk.Align.START;
333                         
334                         
335                         //w.windowstate.file.path);
336                         m.clicked.connect(() => {
337                                 _this.windowspopup.el.hide();
338                                  BuilderApplication.windows.get(wid).el.present();
339                         });
340                         _this.popover_menu.el.append(m);
341                         //m.show();
342                         this.mitems.add(m);
343                  }
344             }
345         }
346         public class Xcls_windowspopup : Object
347         {
348             public Gtk.Popover el;
349             private Xcls_MainWindow  _this;
350
351
352                 // my vars (def)
353
354             // ctor
355             public Xcls_windowspopup(Xcls_MainWindow _owner )
356             {
357                 _this = _owner;
358                 _this.windowspopup = this;
359                 this.el = new Gtk.Popover();
360
361                 // my vars (dec)
362
363                 // set gobject values
364                 new Xcls_popover_menu( _this );
365                 this.el.set_child ( _this.popover_menu.el  );
366             }
367
368             // user defined functions
369         }
370         public class Xcls_popover_menu : Object
371         {
372             public Gtk.Box el;
373             private Xcls_MainWindow  _this;
374
375
376                 // my vars (def)
377
378             // ctor
379             public Xcls_popover_menu(Xcls_MainWindow _owner )
380             {
381                 _this = _owner;
382                 _this.popover_menu = this;
383                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
384
385                 // my vars (dec)
386
387                 // set gobject values
388                 var child_1 = new Xcls_Button7( _this );
389                 child_1.ref();
390                 this.el.append ( child_1.el  );
391                 var child_2 = new Xcls_Separator9( _this );
392                 child_2.ref();
393                 this.el.append ( child_2.el  );
394             }
395
396             // user defined functions
397         }
398         public class Xcls_Button7 : Object
399         {
400             public Gtk.Button el;
401             private Xcls_MainWindow  _this;
402
403
404                 // my vars (def)
405
406             // ctor
407             public Xcls_Button7(Xcls_MainWindow _owner )
408             {
409                 _this = _owner;
410                 this.el = new Gtk.Button();
411
412                 // my vars (dec)
413
414                 // set gobject values
415                 this.el.label = "New Window";
416                 var child_1 = new Xcls_ShortcutController8( _this );
417                 child_1.ref();
418                 this.el.add_controller(  child_1.el );
419
420                 //listeners
421                 this.el.clicked.connect( ( ) => {
422                         _this.windowspopup.el.hide();
423                         _this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);
424                 });
425             }
426
427             // user defined functions
428         }
429         public class Xcls_ShortcutController8 : Object
430         {
431             public Gtk.ShortcutController el;
432             private Xcls_MainWindow  _this;
433
434
435                 // my vars (def)
436
437             // ctor
438             public Xcls_ShortcutController8(Xcls_MainWindow _owner )
439             {
440                 _this = _owner;
441                 this.el = new Gtk.ShortcutController();
442
443                 // my vars (dec)
444
445                 // set gobject values
446                 this.el.scope = Gtk.ShortcutScope.GLOBAL;
447
448                 // init method
449
450                 {
451                         this.el.add_shortcut(
452                                 new Gtk.Shortcut(
453                                         new Gtk.KeyvalTrigger(Gdk.Key.N,Gdk.ModifierType.CONTROL_MASK),
454                                         new Gtk.SignalAction("clicked")
455                                 )
456                         );
457                 }
458             }
459
460             // user defined functions
461         }
462
463
464         public class Xcls_Separator9 : Object
465         {
466             public Gtk.Separator el;
467             private Xcls_MainWindow  _this;
468
469
470                 // my vars (def)
471
472             // ctor
473             public Xcls_Separator9(Xcls_MainWindow _owner )
474             {
475                 _this = _owner;
476                 this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
477
478                 // my vars (dec)
479
480                 // set gobject values
481             }
482
483             // user defined functions
484         }
485
486
487
488         public class Xcls_Box10 : Object
489         {
490             public Gtk.Box el;
491             private Xcls_MainWindow  _this;
492
493
494                 // my vars (def)
495
496             // ctor
497             public Xcls_Box10(Xcls_MainWindow _owner )
498             {
499                 _this = _owner;
500                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
501
502                 // my vars (dec)
503
504                 // set gobject values
505                 var child_1 = new Xcls_Image11( _this );
506                 child_1.ref();
507                 this.el.append( child_1.el );
508                 var child_2 = new Xcls_Label12( _this );
509                 child_2.ref();
510                 this.el.append( child_2.el );
511             }
512
513             // user defined functions
514         }
515         public class Xcls_Image11 : Object
516         {
517             public Gtk.Image el;
518             private Xcls_MainWindow  _this;
519
520
521                 // my vars (def)
522
523             // ctor
524             public Xcls_Image11(Xcls_MainWindow _owner )
525             {
526                 _this = _owner;
527                 this.el = new Gtk.Image();
528
529                 // my vars (dec)
530
531                 // set gobject values
532                 this.el.icon_name = "window-new";
533                 this.el.margin_start = 4;
534             }
535
536             // user defined functions
537         }
538
539         public class Xcls_Label12 : Object
540         {
541             public Gtk.Label el;
542             private Xcls_MainWindow  _this;
543
544
545                 // my vars (def)
546
547             // ctor
548             public Xcls_Label12(Xcls_MainWindow _owner )
549             {
550                 _this = _owner;
551                 this.el = new Gtk.Label( "Windows (Add/List)" );
552
553                 // my vars (dec)
554
555                 // set gobject values
556             }
557
558             // user defined functions
559         }
560
561
562
563         public class Xcls_open_projects_btn : Object
564         {
565             public Gtk.Button el;
566             private Xcls_MainWindow  _this;
567
568
569                 // my vars (def)
570             public bool always_show_image;
571
572             // ctor
573             public Xcls_open_projects_btn(Xcls_MainWindow _owner )
574             {
575                 _this = _owner;
576                 _this.open_projects_btn = this;
577                 this.el = new Gtk.Button();
578
579                 // my vars (dec)
580                 this.always_show_image = true;
581
582                 // set gobject values
583                 this.el.icon_name = "system-file-manager";
584                 this.el.label = "Files / Projects";
585
586                 //listeners
587                 this.el.clicked.connect( ( ) => {
588                         _this.windowstate.showPopoverFiles(this.el, _this.project, false);
589                 });
590             }
591
592             // user defined functions
593         }
594
595
596
597         public class Xcls_vbox : Object
598         {
599             public Gtk.Box el;
600             private Xcls_MainWindow  _this;
601
602
603                 // my vars (def)
604
605             // ctor
606             public Xcls_vbox(Xcls_MainWindow _owner )
607             {
608                 _this = _owner;
609                 _this.vbox = this;
610                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
611
612                 // my vars (dec)
613
614                 // set gobject values
615                 this.el.homogeneous = false;
616                 this.el.vexpand = true;
617                 new Xcls_mainpane( _this );
618                 this.el.append( _this.mainpane.el );
619                 var child_2 = new Xcls_Box23( _this );
620                 child_2.ref();
621                 this.el.append( child_2.el );
622             }
623
624             // user defined functions
625         }
626         public class Xcls_mainpane : Object
627         {
628             public Gtk.Paned el;
629             private Xcls_MainWindow  _this;
630
631
632                 // my vars (def)
633             public int lastWidth;
634
635             // ctor
636             public Xcls_mainpane(Xcls_MainWindow _owner )
637             {
638                 _this = _owner;
639                 _this.mainpane = this;
640                 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
641
642                 // my vars (dec)
643                 this.lastWidth = 0;
644
645                 // set gobject values
646                 this.el.hexpand = true;
647                 this.el.vexpand = true;
648                 this.el.position = 400;
649                 new Xcls_leftpane( _this );
650                 this.el.start_child = _this.leftpane.el;
651                 var child_2 = new Xcls_Box20( _this );
652                 this.el.end_child = child_2.el;
653
654                 //listeners
655                 this.el.accept_position.connect( ( ) => {
656                         _this.windowstate.left_tree.onresize();
657                         return true;
658                 });
659             }
660
661             // user defined functions
662         }
663         public class Xcls_leftpane : Object
664         {
665             public Gtk.Box el;
666             private Xcls_MainWindow  _this;
667
668
669                 // my vars (def)
670
671             // ctor
672             public Xcls_leftpane(Xcls_MainWindow _owner )
673             {
674                 _this = _owner;
675                 _this.leftpane = this;
676                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
677
678                 // my vars (dec)
679
680                 // set gobject values
681                 this.el.hexpand = true;
682                 this.el.vexpand = true;
683                 new Xcls_editpane( _this );
684                 this.el.append( _this.editpane.el );
685             }
686
687             // user defined functions
688         }
689         public class Xcls_editpane : Object
690         {
691             public Gtk.Paned el;
692             private Xcls_MainWindow  _this;
693
694
695                 // my vars (def)
696
697             // ctor
698             public Xcls_editpane(Xcls_MainWindow _owner )
699             {
700                 _this = _owner;
701                 _this.editpane = this;
702                 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
703
704                 // my vars (dec)
705
706                 // set gobject values
707                 new Xcls_tree( _this );
708                 this.el.start_child = _this.tree.el;
709                 new Xcls_props( _this );
710                 this.el.end_child = _this.props.el;
711
712                 //listeners
713                 this.el.accept_position.connect( ( ) => {
714                         _this.windowstate.left_tree.onresize();
715                         return true;
716                 });
717                 this.el.move_handle.connect( (scroll) => {
718                         GLib.debug("Move handle");
719                         return true;
720                 });
721             }
722
723             // user defined functions
724         }
725         public class Xcls_tree : Object
726         {
727             public Gtk.Box el;
728             private Xcls_MainWindow  _this;
729
730
731                 // my vars (def)
732
733             // ctor
734             public Xcls_tree(Xcls_MainWindow _owner )
735             {
736                 _this = _owner;
737                 _this.tree = this;
738                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
739
740                 // my vars (dec)
741
742                 // set gobject values
743                 this.el.hexpand = true;
744                 this.el.vexpand = true;
745             }
746
747             // user defined functions
748         }
749
750         public class Xcls_props : Object
751         {
752             public Gtk.Box el;
753             private Xcls_MainWindow  _this;
754
755
756                 // my vars (def)
757
758             // ctor
759             public Xcls_props(Xcls_MainWindow _owner )
760             {
761                 _this = _owner;
762                 _this.props = this;
763                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
764
765                 // my vars (dec)
766
767                 // set gobject values
768                 this.el.hexpand = true;
769                 this.el.vexpand = true;
770             }
771
772             // user defined functions
773         }
774
775
776
777         public class Xcls_Box20 : Object
778         {
779             public Gtk.Box el;
780             private Xcls_MainWindow  _this;
781
782
783                 // my vars (def)
784
785             // ctor
786             public Xcls_Box20(Xcls_MainWindow _owner )
787             {
788                 _this = _owner;
789                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
790
791                 // my vars (dec)
792
793                 // set gobject values
794                 this.el.hexpand = true;
795                 this.el.vexpand = true;
796                 new Xcls_rooviewbox( _this );
797                 this.el.append( _this.rooviewbox.el );
798                 new Xcls_codeeditviewbox( _this );
799                 this.el.append( _this.codeeditviewbox.el );
800             }
801
802             // user defined functions
803         }
804         public class Xcls_rooviewbox : Object
805         {
806             public Gtk.Box el;
807             private Xcls_MainWindow  _this;
808
809
810                 // my vars (def)
811
812             // ctor
813             public Xcls_rooviewbox(Xcls_MainWindow _owner )
814             {
815                 _this = _owner;
816                 _this.rooviewbox = this;
817                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
818
819                 // my vars (dec)
820
821                 // set gobject values
822                 this.el.hexpand = true;
823                 this.el.vexpand = true;
824             }
825
826             // user defined functions
827         }
828
829         public class Xcls_codeeditviewbox : Object
830         {
831             public Gtk.Box el;
832             private Xcls_MainWindow  _this;
833
834
835                 // my vars (def)
836
837             // ctor
838             public Xcls_codeeditviewbox(Xcls_MainWindow _owner )
839             {
840                 _this = _owner;
841                 _this.codeeditviewbox = this;
842                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
843
844                 // my vars (dec)
845
846                 // set gobject values
847                 this.el.hexpand = true;
848                 this.el.vexpand = true;
849             }
850
851             // user defined functions
852         }
853
854
855
856         public class Xcls_Box23 : Object
857         {
858             public Gtk.Box el;
859             private Xcls_MainWindow  _this;
860
861
862                 // my vars (def)
863
864             // ctor
865             public Xcls_Box23(Xcls_MainWindow _owner )
866             {
867                 _this = _owner;
868                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
869
870                 // my vars (dec)
871
872                 // set gobject values
873                 this.el.homogeneous = false;
874                 this.el.vexpand = false;
875                 var child_1 = new Xcls_Button24( _this );
876                 child_1.ref();
877                 this.el.append( child_1.el );
878                 var child_2 = new Xcls_Button25( _this );
879                 child_2.ref();
880                 this.el.append( child_2.el );
881                 var child_3 = new Xcls_MenuButton26( _this );
882                 child_3.ref();
883                 this.el.append( child_3.el );
884                 var child_4 = new Xcls_Label31( _this );
885                 child_4.ref();
886                 this.el.append( child_4.el );
887                 new Xcls_statusbar( _this );
888                 this.el.append( _this.statusbar.el );
889                 var child_6 = new Xcls_Box33( _this );
890                 child_6.ref();
891                 this.el.append( child_6.el );
892                 new Xcls_statusbar_compile_spinner( _this );
893                 this.el.append( _this.statusbar_compile_spinner.el );
894             }
895
896             // user defined functions
897         }
898         public class Xcls_Button24 : Object
899         {
900             public Gtk.Button el;
901             private Xcls_MainWindow  _this;
902
903
904                 // my vars (def)
905             public bool always_show_image;
906
907             // ctor
908             public Xcls_Button24(Xcls_MainWindow _owner )
909             {
910                 _this = _owner;
911                 this.el = new Gtk.Button();
912
913                 // my vars (dec)
914                 this.always_show_image = true;
915
916                 // set gobject values
917                 this.el.icon_name = "emblem-system";
918                 this.el.tooltip_text = "Project Details";
919                 this.el.label = "Edit Project Settings";
920
921                 //listeners
922                 this.el.clicked.connect( ( ) => {
923                      
924                      _this.windowstate.projectPopoverShow(_this.el, null, null);
925                    
926                   
927                 });
928             }
929
930             // user defined functions
931         }
932
933         public class Xcls_Button25 : Object
934         {
935             public Gtk.Button el;
936             private Xcls_MainWindow  _this;
937
938
939                 // my vars (def)
940             public bool always_show_image;
941
942             // ctor
943             public Xcls_Button25(Xcls_MainWindow _owner )
944             {
945                 _this = _owner;
946                 this.el = new Gtk.Button();
947
948                 // my vars (dec)
949                 this.always_show_image = true;
950
951                 // set gobject values
952                 this.el.icon_name = "document-properties";
953                 this.el.tooltip_text = "File Details";
954                 this.el.label = "Edit File Properties";
955
956                 //listeners
957                 this.el.clicked.connect( ( ) => {
958                   
959                     // create a new file in project..
960                     if (_this.project == null || _this.windowstate.file == null) {
961                         return  ;
962                     }
963                      _this.windowstate.file_details.show(
964                         _this.windowstate.file, _this.el, false
965                     );
966                      
967                     return  ;    
968                 
969                 
970                 });
971             }
972
973             // user defined functions
974         }
975
976         public class Xcls_MenuButton26 : Object
977         {
978             public Gtk.MenuButton el;
979             private Xcls_MainWindow  _this;
980
981
982                 // my vars (def)
983             public bool always_show_image;
984
985             // ctor
986             public Xcls_MenuButton26(Xcls_MainWindow _owner )
987             {
988                 _this = _owner;
989                 this.el = new Gtk.MenuButton();
990
991                 // my vars (dec)
992                 this.always_show_image = true;
993
994                 // set gobject values
995                 this.el.icon_name = "dialog-information";
996                 this.el.label = "About";
997                 new Xcls_topbarmenu( _this );
998                 this.el.popover = _this.topbarmenu.el;
999             }
1000
1001             // user defined functions
1002         }
1003         public class Xcls_topbarmenu : Object
1004         {
1005             public Gtk.PopoverMenu el;
1006             private Xcls_MainWindow  _this;
1007
1008
1009                 // my vars (def)
1010
1011             // ctor
1012             public Xcls_topbarmenu(Xcls_MainWindow _owner )
1013             {
1014                 _this = _owner;
1015                 _this.topbarmenu = this;
1016                 this.el = new Gtk.PopoverMenu.from_model(null);
1017
1018                 // my vars (dec)
1019
1020                 // set gobject values
1021                 var child_1 = new Xcls_Box28( _this );
1022                 child_1.ref();
1023                 this.el.set_child ( child_1.el  );
1024
1025                 // init method
1026
1027                 {
1028                    // this.el.show();
1029                 }
1030             }
1031
1032             // user defined functions
1033         }
1034         public class Xcls_Box28 : Object
1035         {
1036             public Gtk.Box el;
1037             private Xcls_MainWindow  _this;
1038
1039
1040                 // my vars (def)
1041
1042             // ctor
1043             public Xcls_Box28(Xcls_MainWindow _owner )
1044             {
1045                 _this = _owner;
1046                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1047
1048                 // my vars (dec)
1049
1050                 // set gobject values
1051                 var child_1 = new Xcls_Button29( _this );
1052                 child_1.ref();
1053                 this.el.append( child_1.el );
1054                 var child_2 = new Xcls_Button30( _this );
1055                 child_2.ref();
1056                 this.el.append( child_2.el );
1057             }
1058
1059             // user defined functions
1060         }
1061         public class Xcls_Button29 : Object
1062         {
1063             public Gtk.Button el;
1064             private Xcls_MainWindow  _this;
1065
1066
1067                 // my vars (def)
1068
1069             // ctor
1070             public Xcls_Button29(Xcls_MainWindow _owner )
1071             {
1072                 _this = _owner;
1073                 this.el = new Gtk.Button();
1074
1075                 // my vars (dec)
1076
1077                 // set gobject values
1078                 this.el.label = "Download updated Resources";
1079
1080                 //listeners
1081                 this.el.activate.connect( ( ) => {
1082                          Resources.singleton().fetchStart();
1083                 });
1084             }
1085
1086             // user defined functions
1087         }
1088
1089         public class Xcls_Button30 : Object
1090         {
1091             public Gtk.Button el;
1092             private Xcls_MainWindow  _this;
1093
1094
1095                 // my vars (def)
1096
1097             // ctor
1098             public Xcls_Button30(Xcls_MainWindow _owner )
1099             {
1100                 _this = _owner;
1101                 this.el = new Gtk.Button();
1102
1103                 // my vars (dec)
1104
1105                 // set gobject values
1106                 this.el.label = "About the Builder";
1107
1108                 //listeners
1109                 this.el.clicked.connect( () => {
1110                     About.singleton().el.show();
1111                     });
1112             }
1113
1114             // user defined functions
1115         }
1116
1117
1118
1119
1120         public class Xcls_Label31 : Object
1121         {
1122             public Gtk.Label el;
1123             private Xcls_MainWindow  _this;
1124
1125
1126                 // my vars (def)
1127
1128             // ctor
1129             public Xcls_Label31(Xcls_MainWindow _owner )
1130             {
1131                 _this = _owner;
1132                 this.el = new Gtk.Label( "   " );
1133
1134                 // my vars (dec)
1135
1136                 // set gobject values
1137                 this.el.hexpand = true;
1138             }
1139
1140             // user defined functions
1141         }
1142
1143         public class Xcls_statusbar : Object
1144         {
1145             public Gtk.ProgressBar el;
1146             private Xcls_MainWindow  _this;
1147
1148
1149                 // my vars (def)
1150             public ulong handler_id;
1151
1152             // ctor
1153             public Xcls_statusbar(Xcls_MainWindow _owner )
1154             {
1155                 _this = _owner;
1156                 _this.statusbar = this;
1157                 this.el = new Gtk.ProgressBar();
1158
1159                 // my vars (dec)
1160                 this.handler_id = -1;
1161
1162                 // set gobject values
1163                 this.el.show_text = true;
1164
1165                 // init method
1166
1167                 {
1168                      this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {
1169                         if (pos < 1) {
1170                             this.el.hide();
1171                             _this.mainpane.el.set_sensitive(true);
1172                             
1173                             return;
1174                         }
1175                          _this.mainpane.el.set_sensitive(false);
1176                          this.el.show();
1177                          this.el.set_fraction ((1.0f * pos) / (1.0f * total));
1178                          this.el.set_text("Fetching Resource : %s/%s".printf(pos.to_string(), total.to_string()));
1179                        
1180                      });
1181                 }
1182             }
1183
1184             // user defined functions
1185         }
1186
1187         public class Xcls_Box33 : Object
1188         {
1189             public Gtk.Box el;
1190             private Xcls_MainWindow  _this;
1191
1192
1193                 // my vars (def)
1194
1195             // ctor
1196             public Xcls_Box33(Xcls_MainWindow _owner )
1197             {
1198                 _this = _owner;
1199                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1200
1201                 // my vars (dec)
1202
1203                 // set gobject values
1204                 new Xcls_statusbar_compilestatus_label( _this );
1205                 this.el.append( _this.statusbar_compilestatus_label.el );
1206                 new Xcls_statusbar_errors( _this );
1207                 this.el.append( _this.statusbar_errors.el );
1208                 new Xcls_statusbar_warnings( _this );
1209                 this.el.append( _this.statusbar_warnings.el );
1210                 new Xcls_statusbar_depricated( _this );
1211                 this.el.append( _this.statusbar_depricated.el );
1212                 new Xcls_statusbar_run( _this );
1213                 this.el.append( _this.statusbar_run.el );
1214             }
1215
1216             // user defined functions
1217         }
1218         public class Xcls_statusbar_compilestatus_label : Object
1219         {
1220             public Gtk.Label el;
1221             private Xcls_MainWindow  _this;
1222
1223
1224                 // my vars (def)
1225
1226             // ctor
1227             public Xcls_statusbar_compilestatus_label(Xcls_MainWindow _owner )
1228             {
1229                 _this = _owner;
1230                 _this.statusbar_compilestatus_label = this;
1231                 this.el = new Gtk.Label( "Compile Status:" );
1232
1233                 // my vars (dec)
1234
1235                 // set gobject values
1236                 this.el.margin_end = 4;
1237                 this.el.margin_start = 4;
1238             }
1239
1240             // user defined functions
1241         }
1242
1243         public class Xcls_statusbar_errors : Object
1244         {
1245             public Gtk.Button el;
1246             private Xcls_MainWindow  _this;
1247
1248
1249                 // my vars (def)
1250             public Xcls_ValaCompileErrors popup;
1251             public GLib.ListStore notices;
1252
1253             // ctor
1254             public Xcls_statusbar_errors(Xcls_MainWindow _owner )
1255             {
1256                 _this = _owner;
1257                 _this.statusbar_errors = this;
1258                 this.el = new Gtk.Button();
1259
1260                 // my vars (dec)
1261                 this.notices = null;
1262
1263                 // set gobject values
1264                 this.el.icon_name = "dialog-error";
1265                 this.el.label = "0 Errors";
1266
1267                 //listeners
1268                 this.el.clicked.connect( () => {
1269                     
1270                 
1271                     
1272                     if (this.popup == null) {
1273                         this.popup = new Xcls_ValaCompileErrors();
1274                         this.popup.window = _this;
1275                         //this.popup.el.application = _this.el.application;
1276                           //   this.popup.el.set_transient_for( _this.el );
1277                        this.popup.el.set_parent(this.el);
1278                     }
1279                     if (_this.statusbar_compile_spinner.el.spinning) {
1280                                 this.popup.el.show();           
1281                         return;
1282                         }    
1283                     this.popup.show(this.notices, this.el);
1284                     return;
1285                 });
1286             }
1287
1288             // user defined functions
1289             public void setNotices (GLib.ListStore nots, int qty, int tf) {
1290                 
1291                  if (qty < 1 ) {
1292                         this.el.hide();
1293                         if (this.popup != null && this.popup.el.visible) {
1294                                 this.popup.el.hide();
1295                         }
1296                         return;
1297                 }
1298                 
1299                 this.el.show();
1300                 this.el.label = "%d/%d Errors".printf(tf,qty);
1301                 this.notices = nots;
1302                 if (this.popup != null && this.popup.el.visible) {
1303                          this.popup.show(this.notices, this.el);
1304                 }
1305             }
1306         }
1307
1308         public class Xcls_statusbar_warnings : Object
1309         {
1310             public Gtk.Button el;
1311             private Xcls_MainWindow  _this;
1312
1313
1314                 // my vars (def)
1315             public Xcls_ValaCompileErrors popup;
1316             public GLib.ListStore notices;
1317
1318             // ctor
1319             public Xcls_statusbar_warnings(Xcls_MainWindow _owner )
1320             {
1321                 _this = _owner;
1322                 _this.statusbar_warnings = this;
1323                 this.el = new Gtk.Button();
1324
1325                 // my vars (dec)
1326                 this.notices = null;
1327
1328                 // set gobject values
1329                 this.el.icon_name = "dialog-warning";
1330                 this.el.label = "0 Warnings";
1331
1332                 //listeners
1333                 this.el.clicked.connect( () => {
1334                  
1335                         if (this.popup == null) {
1336                         this.popup = new Xcls_ValaCompileErrors();
1337                         this.popup.window = _this;
1338                       //    this.popup.el.set_transient_for( _this.el );
1339                         this.popup.el.set_parent(this.el);
1340                     }
1341                         if (_this.statusbar_compile_spinner.el.spinning) {
1342                                 this.popup.el.show();           
1343                         return;
1344                         }    
1345                     this.popup.show(this.notices, this.el);
1346                     return;
1347                 });
1348             }
1349
1350             // user defined functions
1351             public void setNotices (GLib.ListStore nots, int qty, int tf) {
1352                 
1353                 if (qty < 1 ) {
1354                         this.el.hide();
1355                         if (this.popup != null && this.popup.el.visible) {
1356                                 this.popup.el.hide();
1357                         }
1358                         return;
1359                 }
1360                 this.el.show();
1361                 this.el.label = "%d/%d Warnings".printf(tf,qty);
1362                  this.notices = nots;
1363                 if (this.popup != null && this.popup.el.visible) {
1364                          this.popup.show(this.notices, this.el);
1365                 }
1366                 
1367             
1368             }
1369         }
1370
1371         public class Xcls_statusbar_depricated : Object
1372         {
1373             public Gtk.Button el;
1374             private Xcls_MainWindow  _this;
1375
1376
1377                 // my vars (def)
1378             public Xcls_ValaCompileErrors popup;
1379             public GLib.ListStore notices;
1380
1381             // ctor
1382             public Xcls_statusbar_depricated(Xcls_MainWindow _owner )
1383             {
1384                 _this = _owner;
1385                 _this.statusbar_depricated = this;
1386                 this.el = new Gtk.Button();
1387
1388                 // my vars (dec)
1389                 this.notices = null;
1390
1391                 // set gobject values
1392                 this.el.icon_name = "dialog-information";
1393                 this.el.label = "0 Depricated";
1394
1395                 //listeners
1396                 this.el.clicked.connect( () => {
1397                     
1398                         if (this.popup == null) {
1399                         this.popup = new Xcls_ValaCompileErrors();
1400                         this.popup.window = _this;
1401                       //  this.popup.el.set_transient_for( _this.el );
1402                         this.popup.el.set_parent(this.el);
1403                     }
1404                     if (_this.statusbar_compile_spinner.el.spinning) {
1405                                 this.popup.el.show();           
1406                         return;
1407                         }    
1408                     
1409                     this.popup.show(this.notices, this.el);
1410                     return;
1411                 });
1412             }
1413
1414             // user defined functions
1415             public void setNotices (GLib.ListStore nots, int qty, int tf) {
1416                 if (qty < 1) {
1417                         this.el.hide();
1418                         if (this.popup != null && this.popup.el.visible) {
1419                                  this.popup.el.hide();
1420                         }
1421              
1422                         return;
1423                 }
1424                 
1425                 this.el.show();
1426                 
1427                 this.el.label = "%d/%d Depricated".printf(tf,qty);
1428                 this.notices = nots;
1429                 if (this.popup != null && this.popup.el.visible) {
1430                          this.popup.show(this.notices, this.el);
1431                 }
1432             }
1433         }
1434
1435         public class Xcls_statusbar_run : Object
1436         {
1437             public Gtk.Button el;
1438             private Xcls_MainWindow  _this;
1439
1440
1441                 // my vars (def)
1442             public Xcls_ValaCompileErrors popup;
1443
1444             // ctor
1445             public Xcls_statusbar_run(Xcls_MainWindow _owner )
1446             {
1447                 _this = _owner;
1448                 _this.statusbar_run = this;
1449                 this.el = new Gtk.Button();
1450
1451                 // my vars (dec)
1452
1453                 // set gobject values
1454                 this.el.icon_name = "media-playback-start";
1455                 this.el.label = "Run";
1456
1457                 //listeners
1458                 this.el.clicked.connect( () => {
1459                    
1460                    if (_this.windowstate.file == null) {
1461                                 return;
1462                         }
1463                    if (_this.statusbar_compile_spinner.el.spinning) {
1464                         _this.windowstate.compile_results.el.set_parent(this.el);
1465                             _this.windowstate.compile_results.el.show(); // show currently running.
1466                         return;
1467                         }
1468                         BuilderApplication.valacompilequeue.addFile( 
1469                                                                 Palete.ValaCompileRequestType.RUN, 
1470                                                                 _this.windowstate.file, "", true ) ;
1471                 
1472                         _this.windowstate.compile_results.el.set_parent(this.el);
1473                         _this.windowstate.compile_results.show(this.el,true);
1474                                  
1475                 });
1476             }
1477
1478             // user defined functions
1479         }
1480
1481
1482         public class Xcls_statusbar_compile_spinner : Object
1483         {
1484             public Gtk.Spinner el;
1485             private Xcls_MainWindow  _this;
1486
1487
1488                 // my vars (def)
1489
1490             // ctor
1491             public Xcls_statusbar_compile_spinner(Xcls_MainWindow _owner )
1492             {
1493                 _this = _owner;
1494                 _this.statusbar_compile_spinner = this;
1495                 this.el = new Gtk.Spinner();
1496
1497                 // my vars (dec)
1498
1499                 // set gobject values
1500                 this.el.margin_end = 4;
1501                 this.el.margin_start = 4;
1502                 this.el.tooltip_text = "Compiling";
1503             }
1504
1505             // user defined functions
1506             public void start () {
1507               this.el.show();
1508               this.el.start();  
1509               
1510                  
1511             }
1512             public void stop () {
1513              this.el.stop();
1514               this.el.hide();
1515                
1516             }
1517         }
1518
1519
1520
1521     }