Fix #7420 - deprication warnings
[roobuilder] / src / Builder4 / MainWindow.bjs
1 {
2  "build_module" : "builder",
3  "items" : [
4   {
5    "# Project.Project project" : "null",
6    "# WindowState windowstate" : "",
7    "# string title" : "\"Roo Application Builder\"",
8    "$ type" : "Gtk.WindowType.TOPLEVEL",
9    "$ xns" : "Gtk",
10    "* init" : [
11     " ",
12     " ",
13     "     this.el.set_icon_name(\"roobuilder\");",
14     " "
15    ],
16    "border_width" : 0,
17    "default_height" : 850,
18    "default_width" : 1200,
19    "id" : "MainWindow",
20    "items" : [
21     {
22      "$ xns" : "Gtk",
23      "* pack" : "set_titlebar",
24      "bool show_close_button" : true,
25      "id" : "headerbar",
26      "items" : [
27       {
28        "$ xns" : "Gtk",
29        "* pack" : "pack_start",
30        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
31        "items" : [
32         {
33          "# Gee.ArrayList<Gtk.MenuItem> mitems" : "",
34          "$ Gtk.Align halign" : "Gtk.Align.START",
35          "$ Gtk.ArrowType direction" : "Gtk.ArrowType.DOWN",
36          "$ xns" : "Gtk",
37          "* init" : [
38           "{",
39           "\tthis.mitems = new Gee.ArrayList<Gtk.MenuItem>();",
40           "\t",
41           "}",
42           ""
43          ],
44          "bool always_show_image" : true,
45          "bool use_popover" : false,
46          "id" : "windowbtn",
47          "int margin_end" : 4,
48          "items" : [
49           {
50            "$ xns" : "Gtk",
51            "* pack" : "set_image",
52            "utf8 icon_name" : "window-new",
53            "xtype" : "Image"
54           },
55           {
56            "$ xns" : "Gtk",
57            "* init" : [
58             " ",
59             "  this.el.show_all();",
60             " "
61            ],
62            "* prop" : "popup",
63            "items" : [
64             {
65              "$ xns" : "Gtk",
66              "* pack" : "append",
67              "listeners" : {
68               "activate" : [
69                "( ) => {",
70                "",
71                "\t_this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);",
72                "}",
73                ""
74               ]
75              },
76              "string label" : "New Window",
77              "xtype" : "MenuItem"
78             },
79             {
80              "$ xns" : "Gtk",
81              "* pack" : "append",
82              "xtype" : "SeparatorMenuItem"
83             }
84            ],
85            "xtype" : "Menu"
86           }
87          ],
88          "string label" : "Windows",
89          "xtype" : "MenuButton",
90          "| void updateMenu" : [
91           "() {",
92           "\t foreach(var m in  this.mitems) {",
93           "\t \t this.el.popup.remove(m);",
94           "\t }",
95           "\t this.mitems.clear();",
96           "\t   ",
97           "\t foreach(var w in BuilderApplication.windows) {",
98           "\t \tvar wid = BuilderApplication.windows.index_of(w);",
99           "\t \t// fixme find a better way to display this.",
100           " \t\tif (w.windowstate == null ||",
101           " \t\t\t w.windowstate.file == null || ",
102           " \t\t\t _this.windowstate == null ||",
103           " \t\t\t _this.windowstate.file == null",
104           " \t\t\t ) { ",
105           " \t\t\tcontinue;",
106           "\t\t}",
107           "\t \t",
108           "\t \tif (w.windowstate.file.path == _this.windowstate.file.path) {",
109           "\t \t\tcontinue;",
110           " \t\t}",
111           "",
112           " \t\tGLib.debug(\"add menuitem %s\", w.windowstate.file.path);",
113           "\t \tvar m = new Gtk.MenuItem.with_label(w.windowstate.file.path);",
114           "\t \tm.activate.connect(() => {",
115           "\t \t\t BuilderApplication.windows.get(wid).el.present();",
116           "\t \t});",
117           "\t \tthis.el.popup.append(m);",
118           "\t \tm.show();",
119           "\t \tthis.mitems.add(m);",
120           "\t }",
121           "}"
122          ]
123         },
124         {
125          "$ tooltop_text" : "\"Open File\"",
126          "$ xns" : "Gtk",
127          "* pack" : "add",
128          "bool always_show_image" : true,
129          "id" : "open_projects_btn",
130          "items" : [
131           {
132            "$ xns" : "Gtk",
133            "* pack" : "set_image",
134            "utf8 icon_name" : "system-file-manager",
135            "xtype" : "Image"
136           }
137          ],
138          "listeners" : {
139           "clicked" : [
140            "  ( ) => {",
141            "  \t_this.windowstate.showPopoverFiles(this.el, _this.project, false);",
142            "",
143            "}"
144           ]
145          },
146          "string label" : "Files / Projects",
147          "xtype" : "Button"
148         }
149        ],
150        "xtype" : "Box"
151       }
152      ],
153      "string title" : "Application Builder",
154      "xtype" : "HeaderBar"
155     },
156     {
157      "$ homogeneous" : false,
158      "$ xns" : "Gtk",
159      "* pack" : "add",
160      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
161      "id" : "vbox",
162      "items" : [
163       {
164        "# int lastWidth" : 0,
165        "$ xns" : "Gtk",
166        "* pack" : "pack_start,true,true,0",
167        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
168        "id" : "mainpane",
169        "items" : [
170         {
171          "$ xns" : "Gtk",
172          "* pack" : "add",
173          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
174          "id" : "leftpane",
175          "items" : [
176           {
177            "$ xns" : "Gtk",
178            "* pack" : "pack_start,true,true,0",
179            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
180            "id" : "editpane",
181            "items" : [
182             {
183              "$ xns" : "Gtk",
184              "* pack" : "add1",
185              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
186              "id" : "tree",
187              "xtype" : "Box"
188             },
189             {
190              "$ xns" : "Gtk",
191              "* pack" : "add2",
192              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
193              "id" : "props",
194              "xtype" : "Box"
195             }
196            ],
197            "listeners" : {
198             "accept_position" : [
199              "() => {",
200              "\tGLib.debug(\"Accept postion\");",
201              "\treturn true;",
202              "}"
203             ],
204             "move_handle" : [
205              "(scroll) => {",
206              "\tGLib.debug(\"Move handle\");",
207              "\treturn true;",
208              "}"
209             ]
210            },
211            "xtype" : "Paned"
212           }
213          ],
214          "xtype" : "Box"
215         },
216         {
217          "$ xns" : "Gtk",
218          "* pack" : "add2",
219          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
220          "items" : [
221           {
222            "$ xns" : "Gtk",
223            "* pack" : "add",
224            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
225            "bool vexpand" : true,
226            "id" : "rooviewbox",
227            "xtype" : "Box"
228           },
229           {
230            "$ xns" : "Gtk",
231            "* pack" : "add",
232            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
233            "bool vexpand" : true,
234            "id" : "codeeditviewbox",
235            "xtype" : "Box"
236           }
237          ],
238          "xtype" : "Box"
239         }
240        ],
241        "position" : 400,
242        "xtype" : "Paned"
243       },
244       {
245        "$ xns" : "Gtk",
246        "* pack" : "pack_end,false,true,0",
247        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
248        "bool homogeneous" : false,
249        "items" : [
250         {
251          "$ tooltip_text" : "\"Project Details\"",
252          "$ xns" : "Gtk",
253          "* pack" : "add",
254          "bool always_show_image" : true,
255          "items" : [
256           {
257            "$ xns" : "Gtk",
258            "* pack" : "set_image",
259            "utf8 icon_name" : "emblem-system",
260            "xtype" : "Image"
261           }
262          ],
263          "listeners" : {
264           "clicked" : [
265            "  ( ) => {",
266            "     ",
267            "     _this.windowstate.projectPopoverShow(this.el, _this.project);",
268            "   ",
269            "  ",
270            "}"
271           ]
272          },
273          "string label" : "Edit Project Settings",
274          "xtype" : "Button"
275         },
276         {
277          "$ tooltip_text" : "\"File Details\"",
278          "$ xns" : "Gtk",
279          "* pack" : "add",
280          "bool always_show_image" : true,
281          "items" : [
282           {
283            "$ xns" : "Gtk",
284            "* pack" : "set_image",
285            "utf8 icon_name" : "document-properties",
286            "xtype" : "Image"
287           }
288          ],
289          "listeners" : {
290           "clicked" : [
291            "  ( ) => {",
292            "  ",
293            "    // create a new file in project..",
294            "    if (_this.project == null || _this.windowstate.file == null) {",
295            "        return  ;",
296            "    }",
297            "     _this.windowstate.file_details.show(",
298            "        _this.windowstate.file, this.el, false",
299            "    );",
300            "     ",
301            "    return  ;    ",
302            "",
303            "",
304            "}"
305           ]
306          },
307          "string label" : "Edit File Properties",
308          "xtype" : "Button"
309         },
310         {
311          "$ xns" : "Gtk",
312          "* pack" : "add",
313          "bool always_show_image" : true,
314          "items" : [
315           {
316            "$ xns" : "Gtk",
317            "* init" : [
318             "{",
319             "    this.el.show_all();",
320             "}",
321             ""
322            ],
323            "* pack" : "set_popup",
324            "id" : "topbarmenu",
325            "items" : [
326             {
327              "$ xns" : "Gtk",
328              "* pack" : "append",
329              "listeners" : {
330               "activate" : [
331                " ( ) => {",
332                "         Resources.singleton().fetchStart();",
333                "}"
334               ]
335              },
336              "string label" : "Download updated Resources",
337              "xtype" : "MenuItem"
338             },
339             {
340              "$ xns" : "Gtk",
341              "* pack" : "append",
342              "listeners" : {
343               "activate" : [
344                "() => {",
345                "    About.singleton().el.show();",
346                "    }"
347               ]
348              },
349              "string label" : "About the Builder",
350              "xtype" : "MenuItem"
351             }
352            ],
353            "xtype" : "Menu"
354           },
355           {
356            "$ xns" : "Gtk",
357            "* pack" : "set_image",
358            "utf8 icon_name" : "dialog-information",
359            "xtype" : "Image"
360           }
361          ],
362          "string label" : "About",
363          "xtype" : "MenuButton"
364         },
365         {
366          "$ xns" : "Gtk",
367          "* pack" : "pack_start,true,true,0",
368          "string label" : "   ",
369          "xtype" : "Label"
370         },
371         {
372          "$ xns" : "Gtk",
373          "* init" : [
374           "{",
375           "     this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {",
376           "        if (pos < 1) {",
377           "            this.el.hide();",
378           "            _this.mainpane.el.set_sensitive(true);",
379           "            ",
380           "            return;",
381           "        }",
382           "         _this.mainpane.el.set_sensitive(false);",
383           "         this.el.show();",
384           "         this.el.set_fraction ((1.0f * pos) / (1.0f * total));",
385           "         this.el.set_text(\"Fetching Resource : %s/%s\".printf(pos.to_string(), total.to_string()));",
386           "       ",
387           "     });",
388           "}",
389           ""
390          ],
391          "* pack" : "pack_start,true,true,0",
392          "bool show_text" : true,
393          "id" : "statusbar",
394          "ulong handler_id" : "-1",
395          "xtype" : "ProgressBar"
396         },
397         {
398          "$ xns" : "Gtk",
399          "* pack" : "add",
400          "items" : [
401           {
402            "$ xns" : "Gtk",
403            "* pack" : "add",
404            "id" : "statusbar_compilestatus_label",
405            "string label" : "Compile Status:",
406            "xtype" : "MenuItem"
407           },
408           {
409            "# Json.Object notices" : "new Json.Object() ",
410            "$ xns" : "Gtk",
411            "* pack" : "add",
412            "Xcls_ValaCompileErrors popup" : "",
413            "id" : "statusbar_errors",
414            "items" : [
415             {
416              "$ xns" : "Gtk",
417              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
418              "int spacing" : 2,
419              "items" : [
420               {
421                "$ xns" : "Gtk",
422                "utf8 icon_name" : "dialog-error",
423                "xtype" : "Image"
424               },
425               {
426                "$ xns" : "Gtk",
427                "id" : "statusbar_errors_label",
428                "string label" : "Errors",
429                "xtype" : "Label"
430               }
431              ],
432              "xtype" : "Box"
433             }
434            ],
435            "listeners" : {
436             "button_press_event" : [
437              "() => {",
438              "    if (this.popup == null) {",
439              "        this.popup = new Xcls_ValaCompileErrors();",
440              "        this.popup.window = _this;",
441              "    }",
442              "   ",
443              "    ",
444              "    this.popup.show(this.notices, this.el);",
445              "    return true;",
446              "}"
447             ]
448            },
449            "xtype" : "MenuItem",
450            "| void setNotices" : [
451             "(Json.Object nots, int qty) {",
452             "    this.el.show_all();",
453             "    _this.statusbar_errors_label.el.label = qty.to_string() + \" Errors\";",
454             "    this.notices = nots;",
455             "",
456             "}",
457             ""
458            ]
459           },
460           {
461            "# Json.Object notices" : "new Json.Object()",
462            "$ xns" : "Gtk",
463            "* pack" : "add",
464            "Xcls_ValaCompileErrors popup" : "",
465            "id" : "statusbar_warnings",
466            "items" : [
467             {
468              "$ xns" : "Gtk",
469              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
470              "int spacing" : 2,
471              "items" : [
472               {
473                "$ xns" : "Gtk",
474                "utf8 icon_name" : "dialog-warning",
475                "xtype" : "Image"
476               },
477               {
478                "$ xns" : "Gtk",
479                "id" : "statusbar_warnings_label",
480                "string label" : "Errors",
481                "xtype" : "Label"
482               }
483              ],
484              "xtype" : "Box"
485             }
486            ],
487            "listeners" : {
488             "button_press_event" : [
489              "() => {",
490              "    if (this.popup == null) {",
491              "        this.popup = new Xcls_ValaCompileErrors();",
492              "        this.popup.window = _this;",
493              "    }",
494              "    ",
495              "    this.popup.show(this.notices, this.el);",
496              "    return true;",
497              "}"
498             ]
499            },
500            "xtype" : "MenuItem",
501            "| void setNotices" : [
502             "(Json.Object nots, int qty) {",
503             "    this.el.show_all();",
504             "    _this.statusbar_warnings_label.el.label = qty.to_string() + \" Warnings\";",
505             "    this.notices = nots;",
506             "",
507             "}",
508             ""
509            ]
510           },
511           {
512            "# Json.Object notices" : "new Json.Object()",
513            "$ xns" : "Gtk",
514            "* pack" : "add",
515            "Xcls_ValaCompileErrors popup" : "",
516            "id" : "statusbar_depricated",
517            "items" : [
518             {
519              "$ xns" : "Gtk",
520              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
521              "int spacing" : 2,
522              "items" : [
523               {
524                "$ xns" : "Gtk",
525                "utf8 icon_name" : "dialog-information",
526                "xtype" : "Image"
527               },
528               {
529                "$ xns" : "Gtk",
530                "id" : "statusbar_depricated_label",
531                "string label" : "Errors",
532                "xtype" : "Label"
533               }
534              ],
535              "xtype" : "Box"
536             }
537            ],
538            "listeners" : {
539             "button_press_event" : [
540              "() => {",
541              "    if (this.popup == null) {",
542              "        this.popup = new Xcls_ValaCompileErrors();",
543              "        this.popup.window = _this;",
544              "    }",
545              "    ",
546              "    ",
547              "    this.popup.show(this.notices, this.el);",
548              "    return true;",
549              "}"
550             ]
551            },
552            "xtype" : "MenuItem",
553            "| void setNotices" : [
554             "(Json.Object nots, int qty) {",
555             "    this.el.show_all();",
556             "    _this.statusbar_depricated_label.el.label = qty.to_string() + \" Depricated\";",
557             "    this.notices = nots;",
558             "",
559             "}",
560             ""
561            ]
562           },
563           {
564            "$ xns" : "Gtk",
565            "* pack" : "add",
566            "Xcls_ValaCompileErrors popup" : "",
567            "id" : "statusbar_run",
568            "items" : [
569             {
570              "$ xns" : "Gtk",
571              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
572              "int spacing" : 2,
573              "items" : [
574               {
575                "$ xns" : "Gtk",
576                "utf8 icon_name" : "media-playback-start",
577                "xtype" : "Image"
578               },
579               {
580                "$ xns" : "Gtk",
581                "string label" : "Run",
582                "xtype" : "Label"
583               }
584              ],
585              "xtype" : "Box"
586             }
587            ],
588            "listeners" : {
589             "button_press_event" : [
590              "() => {",
591              "\tif (_this.windowstate.file == null) {",
592              "\t\treturn true;",
593              "\t}",
594              "\tBuilderApplication.valasource.spawnExecute(_this.windowstate.file);",
595              "\t",
596              "\t_this.windowstate.compile_results.show(this.el,true);",
597              "\t",
598              "\treturn true;",
599              "}"
600             ]
601            },
602            "xtype" : "MenuItem"
603           }
604          ],
605          "xtype" : "MenuBar"
606         },
607         {
608          "$ xns" : "Gtk",
609          "* pack" : "add",
610          "id" : "statusbar_compile_spinner",
611          "string tooltip_text" : "Compiling",
612          "xtype" : "Spinner",
613          "| void start" : [
614           "() {",
615           "  this.el.show();",
616           "  this.el.start();  ",
617           "}",
618           ""
619          ],
620          "| void stop" : [
621           "() {",
622           " this.el.stop();",
623           "  this.el.hide();",
624           "}",
625           ""
626          ]
627         }
628        ],
629        "xtype" : "Box"
630       }
631      ],
632      "xtype" : "Box"
633     }
634    ],
635    "listeners" : {
636     "delete_event" : [
637      "(   event) => {",
638      "    return false;",
639      "} "
640     ],
641     "destroy" : [
642      "() =>  {",
643      " ",
644      " ",
645      " Resources.singleton().disconnect(_this.statusbar.handler_id);",
646      " ",
647      " BuilderApplication.removeWindow(this);",
648      " ",
649      " if (BuilderApplication.windows.size  < 1) {",
650      "",
651      "     Gtk.main_quit();",
652      " }",
653      "}"
654     ],
655     "key_release_event" : [
656      " (event) => {",
657      "    ",
658      "    ",
659      "\t",
660      "\tif (event.keyval == Gdk.Key.n && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
661      "\t\tprint(\"SAVE: ctrl-n  pressed\");",
662      "\t\t_this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);",
663      "\t\treturn false;",
664      "\t}",
665      "\t",
666      "   // print(event.key.keyval)",
667      "    ",
668      "    return false;",
669      "",
670      "} ",
671      "",
672      ""
673     ],
674     "show" : [
675      "  ( ) => {",
676      "    // hide the file editing..",
677      "   ",
678      "    //this.hideViewEditing();",
679      "    _this.statusbar.el.hide();",
680      "     _this.statusbar_errors.el.hide();",
681      "    _this.statusbar_warnings.el.hide();",
682      "    _this.statusbar_depricated.el.hide();",
683      "    _this.statusbar_compile_spinner.el.hide();",
684      "  ",
685      "    Resources.singleton().checkResources();",
686      "",
687      "}"
688     ]
689    },
690    "xtype" : "Window",
691    "| void initChildren" : [
692     " () {",
693     "    // this needs putting in a better place..",
694     "    this.windowstate = new WindowState(this);",
695     "     ",
696     "",
697     " ",
698     "",
699     "    ",
700     "",
701     "",
702     "",
703     "}",
704     ""
705    ],
706    "| void openNewWindow" : [
707     "() {",
708     " ",
709     "    var w = new Xcls_MainWindow();",
710     "    w.ref();",
711     "\tBuilderApplication.addWindow(w);",
712     "    w.el.show_all();",
713     "    w.initChildren();",
714     "    w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);",
715     "     ",
716     "}",
717     ""
718    ],
719    "| void setTitle" : [
720     " (string str) {",
721     "    this.headerbar.el.set_title(this.title + \" - \" + str);",
722     "} ",
723     ""
724    ],
725    "| void show" : [
726     "() {",
727     "   ",
728     "    this.el.show_all();",
729     "",
730     "}"
731    ]
732   }
733  ],
734  "modOrder" : "",
735  "name" : "MainWindow",
736  "parent" : "",
737  "path" : "/home/alan/gitlive/roobuilder/src/Builder4/MainWindow.bjs",
738  "permname" : "",
739  "title" : ""
740 }