665be5f8394cf18a18fd11a552fe354823189e51
[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         public Xcls_statusbar_compile_icon statusbar_compile_icon;
37
38                 // my vars (def)
39         public WindowState windowstate;
40         public Project.Project project;
41
42         // ctor
43         public Xcls_MainWindow()
44         {
45                 _this = this;
46                 this.el = new Gtk.ApplicationWindow(BuilderApplication.singleton({}));
47
48                 // my vars (dec)
49                 this.project = null;
50
51                 // set gobject values
52                 this.el.title = "Roo Application Builder";
53                 this.el.default_height = 850;
54                 this.el.default_width = 1200;
55                 new Xcls_headerbar( _this );
56                 this.el.set_titlebar ( _this.headerbar.el  );
57                 new Xcls_vbox( _this );
58                 this.el.set_child ( _this.vbox.el  );
59
60                 // init method
61
62                 this.el.set_icon_name("roobuilder");
63
64                 //listeners
65                 this.el.close_request.connect( ( ) => {
66                          Resources.singleton().disconnect(_this.statusbar.handler_id);
67                          
68                          
69                          this.windowstate.file.getLanguageServer().document_close(
70                                 this.windowstate.file
71                         );
72                          
73                          BuilderApplication.removeWindow(this);
74                          
75                          if (BuilderApplication.windows.size  < 1) {
76                                 this.windowstate.file.getLanguageServer().exit();
77                                 BuilderApplication.singleton(  null ).quit();
78                          }
79                         return true;
80                 });
81                 this.el.show.connect( ( ) => {
82                     // hide the file editing..
83                    
84                     //this.hideViewEditing();
85                     // this is updated by windowstate - we try and fill it in..
86                      _this.statusbar.el.hide();
87                      //_this.statusbar_errors.el.hide();
88                     //_this.statusbar_warnings.el.hide();
89                     //_this.statusbar_depricated.el.hide();
90                     _this.statusbar_compile_spinner.el.hide();
91                   
92                     Resources.singleton().checkResources();
93                     
94                   
95                 
96                 });
97                 this.el.hide.connect( () =>  {
98                  
99                  
100                 
101                 });
102         }
103
104         // user defined functions
105         public void updateErrors () {
106         
107         
108                 GLib.debug("updateErrors");
109                 
110                 var pr = this.windowstate.project.getErrors("ERR");
111                 
112                 this.statusbar_errors.setNotices(
113                         pr,
114                         this.windowstate.file.getErrors("ERR")
115                 );
116                 
117                 this.statusbar_warnings.setNotices(
118                         this.windowstate.project.getErrors("WARN"),
119                         this.windowstate.file.getErrors("WARN")
120                 );
121                 this.statusbar_depricated.setNotices(
122                         this.windowstate.project.getErrors("DEPR"),
123                         this.windowstate.file.getErrors("DEPR")
124                 );
125          
126                 _this.statusbar_run.el.hide();
127         
128                 if (pr.get_n_items() < 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                         new Xcls_statusbar_compile_icon( _this );
895                         this.el.append( _this.statusbar_compile_icon.el );
896                 }
897
898                 // user defined functions
899         }
900         public class Xcls_Button24 : Object
901         {
902                 public Gtk.Button el;
903                 private Xcls_MainWindow  _this;
904
905
906                         // my vars (def)
907                 public bool always_show_image;
908
909                 // ctor
910                 public Xcls_Button24(Xcls_MainWindow _owner )
911                 {
912                         _this = _owner;
913                         this.el = new Gtk.Button();
914
915                         // my vars (dec)
916                         this.always_show_image = true;
917
918                         // set gobject values
919                         this.el.icon_name = "emblem-system";
920                         this.el.tooltip_text = "Project Details";
921                         this.el.label = "Edit Project Settings";
922
923                         //listeners
924                         this.el.clicked.connect( ( ) => {
925                              
926                              _this.windowstate.projectPopoverShow(_this.el, null, null);
927                            
928                           
929                         });
930                 }
931
932                 // user defined functions
933         }
934
935         public class Xcls_Button25 : Object
936         {
937                 public Gtk.Button el;
938                 private Xcls_MainWindow  _this;
939
940
941                         // my vars (def)
942                 public bool always_show_image;
943
944                 // ctor
945                 public Xcls_Button25(Xcls_MainWindow _owner )
946                 {
947                         _this = _owner;
948                         this.el = new Gtk.Button();
949
950                         // my vars (dec)
951                         this.always_show_image = true;
952
953                         // set gobject values
954                         this.el.icon_name = "document-properties";
955                         this.el.tooltip_text = "File Details";
956                         this.el.label = "Edit File Properties";
957
958                         //listeners
959                         this.el.clicked.connect( ( ) => {
960                           
961                             // create a new file in project..
962                             if (_this.project == null || _this.windowstate.file == null) {
963                                 return  ;
964                             }
965                              _this.windowstate.file_details.show(
966                                 _this.windowstate.file, _this.el, false
967                             );
968                              
969                             return  ;    
970                         
971                         
972                         });
973                 }
974
975                 // user defined functions
976         }
977
978         public class Xcls_MenuButton26 : Object
979         {
980                 public Gtk.MenuButton el;
981                 private Xcls_MainWindow  _this;
982
983
984                         // my vars (def)
985                 public bool always_show_image;
986
987                 // ctor
988                 public Xcls_MenuButton26(Xcls_MainWindow _owner )
989                 {
990                         _this = _owner;
991                         this.el = new Gtk.MenuButton();
992
993                         // my vars (dec)
994                         this.always_show_image = true;
995
996                         // set gobject values
997                         this.el.icon_name = "dialog-information";
998                         this.el.label = "About";
999                         new Xcls_topbarmenu( _this );
1000                         this.el.popover = _this.topbarmenu.el;
1001                 }
1002
1003                 // user defined functions
1004         }
1005         public class Xcls_topbarmenu : Object
1006         {
1007                 public Gtk.PopoverMenu el;
1008                 private Xcls_MainWindow  _this;
1009
1010
1011                         // my vars (def)
1012
1013                 // ctor
1014                 public Xcls_topbarmenu(Xcls_MainWindow _owner )
1015                 {
1016                         _this = _owner;
1017                         _this.topbarmenu = this;
1018                         this.el = new Gtk.PopoverMenu.from_model(null);
1019
1020                         // my vars (dec)
1021
1022                         // set gobject values
1023                         var child_1 = new Xcls_Box28( _this );
1024                         child_1.ref();
1025                         this.el.set_child ( child_1.el  );
1026
1027                         // init method
1028
1029                         {
1030                            // this.el.show();
1031                         }
1032                 }
1033
1034                 // user defined functions
1035         }
1036         public class Xcls_Box28 : Object
1037         {
1038                 public Gtk.Box el;
1039                 private Xcls_MainWindow  _this;
1040
1041
1042                         // my vars (def)
1043
1044                 // ctor
1045                 public Xcls_Box28(Xcls_MainWindow _owner )
1046                 {
1047                         _this = _owner;
1048                         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1049
1050                         // my vars (dec)
1051
1052                         // set gobject values
1053                         var child_1 = new Xcls_Button29( _this );
1054                         child_1.ref();
1055                         this.el.append( child_1.el );
1056                         var child_2 = new Xcls_Button30( _this );
1057                         child_2.ref();
1058                         this.el.append( child_2.el );
1059                 }
1060
1061                 // user defined functions
1062         }
1063         public class Xcls_Button29 : Object
1064         {
1065                 public Gtk.Button el;
1066                 private Xcls_MainWindow  _this;
1067
1068
1069                         // my vars (def)
1070
1071                 // ctor
1072                 public Xcls_Button29(Xcls_MainWindow _owner )
1073                 {
1074                         _this = _owner;
1075                         this.el = new Gtk.Button();
1076
1077                         // my vars (dec)
1078
1079                         // set gobject values
1080                         this.el.label = "Download updated Resources";
1081
1082                         //listeners
1083                         this.el.activate.connect( ( ) => {
1084                                  Resources.singleton().fetchStart();
1085                         });
1086                 }
1087
1088                 // user defined functions
1089         }
1090
1091         public class Xcls_Button30 : Object
1092         {
1093                 public Gtk.Button el;
1094                 private Xcls_MainWindow  _this;
1095
1096
1097                         // my vars (def)
1098
1099                 // ctor
1100                 public Xcls_Button30(Xcls_MainWindow _owner )
1101                 {
1102                         _this = _owner;
1103                         this.el = new Gtk.Button();
1104
1105                         // my vars (dec)
1106
1107                         // set gobject values
1108                         this.el.label = "About the Builder";
1109
1110                         //listeners
1111                         this.el.clicked.connect( () => {
1112                             About.singleton().el.show();
1113                             });
1114                 }
1115
1116                 // user defined functions
1117         }
1118
1119
1120
1121
1122         public class Xcls_Label31 : Object
1123         {
1124                 public Gtk.Label el;
1125                 private Xcls_MainWindow  _this;
1126
1127
1128                         // my vars (def)
1129
1130                 // ctor
1131                 public Xcls_Label31(Xcls_MainWindow _owner )
1132                 {
1133                         _this = _owner;
1134                         this.el = new Gtk.Label( "   " );
1135
1136                         // my vars (dec)
1137
1138                         // set gobject values
1139                         this.el.hexpand = true;
1140                 }
1141
1142                 // user defined functions
1143         }
1144
1145         public class Xcls_statusbar : Object
1146         {
1147                 public Gtk.ProgressBar el;
1148                 private Xcls_MainWindow  _this;
1149
1150
1151                         // my vars (def)
1152                 public ulong handler_id;
1153
1154                 // ctor
1155                 public Xcls_statusbar(Xcls_MainWindow _owner )
1156                 {
1157                         _this = _owner;
1158                         _this.statusbar = this;
1159                         this.el = new Gtk.ProgressBar();
1160
1161                         // my vars (dec)
1162                         this.handler_id = -1;
1163
1164                         // set gobject values
1165                         this.el.show_text = true;
1166
1167                         // init method
1168
1169                         {
1170                              this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {
1171                                 if (pos < 1) {
1172                                     this.el.hide();
1173                                     _this.mainpane.el.set_sensitive(true);
1174                                     
1175                                     return;
1176                                 }
1177                                  _this.mainpane.el.set_sensitive(false);
1178                                  this.el.show();
1179                                  this.el.set_fraction ((1.0f * pos) / (1.0f * total));
1180                                  this.el.set_text("Fetching Resource : %s/%s".printf(pos.to_string(), total.to_string()));
1181                                
1182                              });
1183                         }
1184                 }
1185
1186                 // user defined functions
1187         }
1188
1189         public class Xcls_Box33 : Object
1190         {
1191                 public Gtk.Box el;
1192                 private Xcls_MainWindow  _this;
1193
1194
1195                         // my vars (def)
1196
1197                 // ctor
1198                 public Xcls_Box33(Xcls_MainWindow _owner )
1199                 {
1200                         _this = _owner;
1201                         this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1202
1203                         // my vars (dec)
1204
1205                         // set gobject values
1206                         new Xcls_statusbar_compilestatus_label( _this );
1207                         this.el.append( _this.statusbar_compilestatus_label.el );
1208                         new Xcls_statusbar_errors( _this );
1209                         this.el.append( _this.statusbar_errors.el );
1210                         new Xcls_statusbar_warnings( _this );
1211                         this.el.append( _this.statusbar_warnings.el );
1212                         new Xcls_statusbar_depricated( _this );
1213                         this.el.append( _this.statusbar_depricated.el );
1214                         new Xcls_statusbar_run( _this );
1215                         this.el.append( _this.statusbar_run.el );
1216                 }
1217
1218                 // user defined functions
1219         }
1220         public class Xcls_statusbar_compilestatus_label : Object
1221         {
1222                 public Gtk.Label el;
1223                 private Xcls_MainWindow  _this;
1224
1225
1226                         // my vars (def)
1227
1228                 // ctor
1229                 public Xcls_statusbar_compilestatus_label(Xcls_MainWindow _owner )
1230                 {
1231                         _this = _owner;
1232                         _this.statusbar_compilestatus_label = this;
1233                         this.el = new Gtk.Label( "Compile Status:" );
1234
1235                         // my vars (dec)
1236
1237                         // set gobject values
1238                         this.el.margin_end = 4;
1239                         this.el.margin_start = 4;
1240                 }
1241
1242                 // user defined functions
1243         }
1244
1245         public class Xcls_statusbar_errors : Object
1246         {
1247                 public Gtk.Button el;
1248                 private Xcls_MainWindow  _this;
1249
1250
1251                         // my vars (def)
1252                 public Xcls_ValaCompileErrors popup;
1253
1254                 // ctor
1255                 public Xcls_statusbar_errors(Xcls_MainWindow _owner )
1256                 {
1257                         _this = _owner;
1258                         _this.statusbar_errors = this;
1259                         this.el = new Gtk.Button();
1260
1261                         // my vars (dec)
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                                 if (this.popup == null) {
1271                                         return;
1272                                 }
1273                            
1274                             this.popup.show();
1275                           
1276                         });
1277                 }
1278
1279                 // user defined functions
1280                 public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
1281                     BuilderApplication.showSpinner("");
1282                      if (nots.get_n_items() < 1 ) {
1283                         this.el.hide();
1284                         if (this.popup != null) {
1285                                 this.popup.el.hide();
1286                                 }
1287                         return;
1288                     }
1289                     
1290                     this.el.show();
1291                     this.el.label = "%d/%d Errors".printf((int)fe.get_n_items(),(int)nots.get_n_items());
1292                 
1293                     
1294                  
1295                         if (this.popup == null) {
1296                         this.popup = new Xcls_ValaCompileErrors();
1297                         this.popup.window = _this;
1298                       //    this.popup.el.set_transient_for( _this.el );
1299                         this.popup.el.set_parent(this.el);
1300                     }
1301                  
1302                         this.popup.updateNotices(nots);
1303                          
1304                 }
1305         }
1306
1307         public class Xcls_statusbar_warnings : Object
1308         {
1309                 public Gtk.Button el;
1310                 private Xcls_MainWindow  _this;
1311
1312
1313                         // my vars (def)
1314                 public Xcls_ValaCompileErrors popup;
1315
1316                 // ctor
1317                 public Xcls_statusbar_warnings(Xcls_MainWindow _owner )
1318                 {
1319                         _this = _owner;
1320                         _this.statusbar_warnings = this;
1321                         this.el = new Gtk.Button();
1322
1323                         // my vars (dec)
1324
1325                         // set gobject values
1326                         this.el.icon_name = "dialog-warning";
1327                         this.el.label = "0 Warnings";
1328
1329                         //listeners
1330                         this.el.clicked.connect( () => {
1331                          
1332                                 if (this.popup == null) {
1333                                         return;
1334                                 }
1335                            
1336                             this.popup.show();
1337                             return;
1338                         });
1339                 }
1340
1341                 // user defined functions
1342                 public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
1343                     
1344                      if (nots.get_n_items() < 1 ) {
1345                         this.el.hide();
1346                         if (this.popup != null) {
1347                                 this.popup.el.hide();
1348                                 }
1349                         return;
1350                     }
1351                     
1352                     this.el.show();
1353                     this.el.label = "%d/%d Warnings".printf((int)fe.get_n_items(),(int)nots.get_n_items());
1354                 
1355                     
1356                  
1357                         if (this.popup == null) {
1358                         this.popup = new Xcls_ValaCompileErrors();
1359                         this.popup.window = _this;
1360                       //    this.popup.el.set_transient_for( _this.el );
1361                         this.popup.el.set_parent(this.el);
1362                     }
1363                         this.popup.updateNotices(nots);
1364                          
1365                 }
1366         }
1367
1368         public class Xcls_statusbar_depricated : Object
1369         {
1370                 public Gtk.Button el;
1371                 private Xcls_MainWindow  _this;
1372
1373
1374                         // my vars (def)
1375                 public Xcls_ValaCompileErrors popup;
1376                 public GLib.ListStore notices;
1377
1378                 // ctor
1379                 public Xcls_statusbar_depricated(Xcls_MainWindow _owner )
1380                 {
1381                         _this = _owner;
1382                         _this.statusbar_depricated = this;
1383                         this.el = new Gtk.Button();
1384
1385                         // my vars (dec)
1386                         this.notices = null;
1387
1388                         // set gobject values
1389                         this.el.icon_name = "dialog-information";
1390                         this.el.label = "0 Depricated";
1391
1392                         //listeners
1393                         this.el.clicked.connect( () => {
1394                          
1395                                 if (this.popup == null) {
1396                                         return;
1397                                 }
1398                            
1399                             this.popup.show();
1400                           
1401                         });
1402                 }
1403
1404                 // user defined functions
1405                 public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
1406                     
1407                      if (nots.get_n_items() < 1 ) {
1408                         this.el.hide();
1409                         if (this.popup != null) {
1410                                 this.popup.el.hide();
1411                                 }
1412                         return;
1413                     }
1414                     
1415                     this.el.show();
1416                     this.el.label = "%d/%d Depricated".printf((int)fe.get_n_items(),(int)nots.get_n_items());
1417                 
1418                     
1419                  
1420                         if (this.popup == null) {
1421                         this.popup = new Xcls_ValaCompileErrors();
1422                         this.popup.window = _this;
1423                       //    this.popup.el.set_transient_for( _this.el );
1424                         this.popup.el.set_parent(this.el);
1425                     }
1426                         this.popup.updateNotices(nots);
1427                          
1428                 }
1429         }
1430
1431         public class Xcls_statusbar_run : Object
1432         {
1433                 public Gtk.Button el;
1434                 private Xcls_MainWindow  _this;
1435
1436
1437                         // my vars (def)
1438                 public Xcls_ValaCompileErrors popup;
1439                 public Palete.ValaCompileRequest? last_request;
1440
1441                 // ctor
1442                 public Xcls_statusbar_run(Xcls_MainWindow _owner )
1443                 {
1444                         _this = _owner;
1445                         _this.statusbar_run = this;
1446                         this.el = new Gtk.Button();
1447
1448                         // my vars (dec)
1449                         this.last_request = null;
1450
1451                         // set gobject values
1452                         this.el.icon_name = "media-playback-start";
1453                         this.el.label = "Run";
1454                         this.el.visible = false;
1455
1456                         //listeners
1457                         this.el.clicked.connect( () => {
1458                            
1459                            if (_this.windowstate.file == null) {
1460                                         return;
1461                                 }
1462                            if (_this.statusbar_compile_spinner.el.spinning) {
1463                                 _this.windowstate.compile_results.el.set_parent(this.el);
1464                                     _this.windowstate.compile_results.el.show(); // show currently running.
1465                                 return;
1466                                 }
1467                                 
1468                                 if (this.last_request != null) {
1469                                         this.last_request.cancel();
1470                                         if (this.last_request.terminal_pid > 0) {
1471                                                 this.last_request.killChildren(this.last_request.terminal_pid);
1472                                         }
1473                                 }
1474                                 var pr = _this.windowstate.project as Project.Gtk;
1475                                 if (pr == null) {
1476                                         return;
1477                                 }
1478                                 
1479                                 
1480                                 this.last_request= new Palete.ValaCompileRequest(
1481                                         pr,
1482                                         pr.firstBuildModuleWith(_this.windowstate.file)
1483                                 );
1484                                 this.last_request.onOutput.connect( ( str) => {
1485                                         _this.windowstate.compile_results.addLine(str);
1486                                 });
1487                                 this.last_request.run.begin( ( a, r) => {
1488                                         this.last_request.run.end(r);
1489                                 });
1490                                  if (_this.windowstate.compile_results.el.parent == null) {
1491                                         _this.windowstate.compile_results.el.set_parent(this.el);
1492                                 }
1493                                 _this.windowstate.compile_results.show(this.el,true);
1494                                          
1495                         });
1496                 }
1497
1498                 // user defined functions
1499         }
1500
1501
1502         public class Xcls_statusbar_compile_spinner : Object
1503         {
1504                 public Gtk.Spinner el;
1505                 private Xcls_MainWindow  _this;
1506
1507
1508                         // my vars (def)
1509
1510                 // ctor
1511                 public Xcls_statusbar_compile_spinner(Xcls_MainWindow _owner )
1512                 {
1513                         _this = _owner;
1514                         _this.statusbar_compile_spinner = this;
1515                         this.el = new Gtk.Spinner();
1516
1517                         // my vars (dec)
1518
1519                         // set gobject values
1520                         this.el.margin_end = 4;
1521                         this.el.margin_start = 4;
1522                         this.el.tooltip_text = "Compiling";
1523                 }
1524
1525                 // user defined functions
1526                 public void start (string icon, string tooltip) {
1527                 
1528                         if (icon == "spinner") {
1529                           this.el.show();
1530                           this.el.start();  
1531                           this.el.tooltip_text = tooltip;
1532                           _this.statusbar_compile_icon.el.hide();
1533                   } else {
1534                           this.el.hide();
1535                         //  GLib.debug("set status icon %s, %s", icon, tooltip);
1536                           _this.statusbar_compile_icon.el.tooltip_text = tooltip;
1537                           _this.statusbar_compile_icon.el.icon_name = icon;
1538                           _this.statusbar_compile_icon.el.show();         
1539                   }
1540                   
1541                          
1542                 }
1543                 public void stop () {
1544                  this.el.stop();
1545                   this.el.hide();
1546                  _this.statusbar_compile_icon.el.hide();  
1547                 }
1548         }
1549
1550         public class Xcls_statusbar_compile_icon : Object
1551         {
1552                 public Gtk.Image el;
1553                 private Xcls_MainWindow  _this;
1554
1555
1556                         // my vars (def)
1557
1558                 // ctor
1559                 public Xcls_statusbar_compile_icon(Xcls_MainWindow _owner )
1560                 {
1561                         _this = _owner;
1562                         _this.statusbar_compile_icon = this;
1563                         this.el = new Gtk.Image();
1564
1565                         // my vars (dec)
1566
1567                         // set gobject values
1568                         this.el.margin_end = 4;
1569                         this.el.margin_start = 4;
1570                         this.el.icon_size = Gtk.IconSize.NORMAL;
1571                 }
1572
1573                 // user defined functions
1574         }
1575
1576
1577
1578 }