Fix #7214 - move edit code into popover
[roobuilder] / src / Builder4 / MainWindow.bjs
1 {
2  "build_module" : "builder",
3  "items" : [
4   {
5    "# Project.Project project" : "null",
6    "# WindowState windowstate" : "null",
7    "# int no_windows" : 1,
8    "# string title" : "\"Roo Application Builder\"",
9    "$ type" : "Gtk.WindowType.TOPLEVEL",
10    "$ xns" : "Gtk",
11    "* init" : [
12     " ",
13     "\t  ",
14     "    //this.el.show_all();",
15     "    //try {",
16     "         this.el.set_icon_name(\"roobuilder\");",
17     "\t//} catch (Exception e) {",
18     "\t//\tprint(\"no icon found\");",
19     "//\t}"
20    ],
21    "border_width" : 0,
22    "default_height" : 500,
23    "default_width" : 800,
24    "id" : "MainWindow",
25    "items" : [
26     {
27      "$ xns" : "Gtk",
28      "* pack" : "set_titlebar",
29      "bool show_close_button" : true,
30      "id" : "headerbar",
31      "items" : [
32       {
33        "$ xns" : "Gtk",
34        "* pack" : "pack_start",
35        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
36        "items" : [
37         {
38          "$ xns" : "Gtk",
39          "* pack" : "add",
40          "bool use_popover" : false,
41          "items" : [
42           {
43            "$ xns" : "Gtk",
44            "* init" : [
45             "{",
46             "    this.el.show_all();",
47             "}",
48             ""
49            ],
50            "* pack" : "set_popup",
51            "id" : "topbarmenu",
52            "items" : [
53             {
54              "$ xns" : "Gtk",
55              "* pack" : "append",
56              "listeners" : {
57               "activate" : [
58                "( ) => {",
59                "       _this.openNewWindow();",
60                "}"
61               ]
62              },
63              "string label" : "Open a new Window",
64              "xtype" : "MenuItem"
65             },
66             {
67              "$ xns" : "Gtk",
68              "* pack" : "append",
69              "xtype" : "SeparatorMenuItem"
70             },
71             {
72              "$ xns" : "Gtk",
73              "* pack" : "append",
74              "listeners" : {
75               "activate" : [
76                " ( ) => {",
77                "         Resources.singleton().fetchStart();",
78                "}"
79               ]
80              },
81              "string label" : "Download updated Resources",
82              "xtype" : "MenuItem"
83             },
84             {
85              "$ xns" : "Gtk",
86              "* pack" : "append",
87              "listeners" : {
88               "activate" : [
89                "() => {",
90                "    About.singleton().el.show();",
91                "    }"
92               ]
93              },
94              "string label" : "About the Builder",
95              "xtype" : "MenuItem"
96             }
97            ],
98            "xtype" : "Menu"
99           },
100           {
101            "$ xns" : "Gtk",
102            "* pack" : "set_image",
103            "utf8 icon_name" : "help-about",
104            "xtype" : "Image"
105           }
106          ],
107          "xtype" : "MenuButton"
108         },
109         {
110          "$ tooltop_text" : "\"Open File\"",
111          "$ xns" : "Gtk",
112          "* pack" : "add",
113          "id" : "openbtn",
114          "items" : [
115           {
116            "$ xns" : "Gtk",
117            "* pack" : "set_image",
118            "utf8 icon_name" : "document-open",
119            "xtype" : "Image"
120           }
121          ],
122          "listeners" : {
123           "clicked" : [
124            "  ( ) => {",
125            "   _this.windowstate.switchState(WindowState.State.FILES);",
126            "      ",
127            "",
128            "}"
129           ]
130          },
131          "xtype" : "Button"
132         },
133         {
134          "$ xns" : "Gtk",
135          "* pack" : "add",
136          "bool visible" : false,
137          "id" : "openbackbtn",
138          "items" : [
139           {
140            "$ xns" : "Gtk",
141            "* pack" : "set_image",
142            "utf8 icon_name" : "go-previous",
143            "xtype" : "Image"
144           }
145          ],
146          "listeners" : {
147           "clicked" : [
148            "  ( ) => {",
149            "  ",
150            "    _this.windowstate.switchState(WindowState.State.PREVIEW);",
151            "    ",
152            "",
153            "}"
154           ]
155          },
156          "utf8 tooltip_text" : "Back",
157          "xtype" : "Button"
158         }
159        ],
160        "xtype" : "Box"
161       }
162      ],
163      "string title" : "Application Builder",
164      "xtype" : "HeaderBar"
165     },
166     {
167      "$ homogeneous" : false,
168      "$ xns" : "Gtk",
169      "* pack" : "add",
170      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
171      "id" : "vbox",
172      "items" : [
173       {
174        "# int lastWidth" : 0,
175        "$ xns" : "Gtk",
176        "* pack" : "pack_start,true,true,0",
177        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
178        "id" : "mainpane",
179        "items" : [
180         {
181          "$ xns" : "Gtk",
182          "* pack" : "add1",
183          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
184          "id" : "leftpane",
185          "items" : [
186           {
187            "$ xns" : "Gtk",
188            "* pack" : "pack_start,true,true,0",
189            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
190            "id" : "editpane",
191            "items" : [
192             {
193              "$ xns" : "Gtk",
194              "* pack" : "add1",
195              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
196              "id" : "tree",
197              "xtype" : "Box"
198             },
199             {
200              "$ xns" : "Gtk",
201              "* pack" : "add2",
202              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
203              "id" : "props",
204              "xtype" : "Box"
205             }
206            ],
207            "xtype" : "Paned"
208           }
209          ],
210          "xtype" : "Box"
211         },
212         {
213          "$ xns" : "Gtk",
214          "* pack" : "add2",
215          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
216          "items" : [
217           {
218            "$ xns" : "GtkClutter",
219            "* init" : [
220             "    var stage = this.el.get_stage();",
221             "    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));",
222             "    ",
223             "    ",
224             ""
225            ],
226            "* pack" : "pack_start,true,true,0",
227            "id" : "clutterembed",
228            "items" : [
229             {
230              "$ xns" : "GtkClutter",
231              "* init" : [
232               "{",
233               "   ",
234               "   ",
235               "    this.el.add_constraint(",
236               "        new Clutter.AlignConstraint(",
237               "            _this.clutterembed.el.get_stage(), ",
238               "            Clutter.AlignAxis.X_AXIS,",
239               "            1.0f",
240               "        )",
241               "    );",
242               "        ",
243               "    //this.el.set_position(100,100);",
244               "    this.el.set_pivot_point(1.0f,1.0f);",
245               "    ",
246               "    this.el.set_size(_this.clutterembed.el.get_stage().width-50,",
247               "            _this.clutterembed.el.get_stage().height);",
248               "            ",
249               "}"
250              ],
251              "* pack" : "get_stage().add_child",
252              "id" : "rooview",
253              "xtype" : "Actor"
254             },
255             {
256              "$ xns" : "GtkClutter",
257              "* init" : [
258               "{",
259               "   ",
260               "   /*",
261               "    this.el.add_constraint(",
262               "        new Clutter.AlignConstraint(",
263               "            _this.clutterembed.el.get_stage(), ",
264               "            Clutter.AlignAxis.X_AXIS,",
265               "            0.0f",
266               "        )",
267               "    );",
268               "    */",
269               "    this.el.fixed_x = 50.0f;",
270               "    this.el.fixed_y = 0.0f;",
271               "    //this.el.set_position(100,100);",
272               "    this.el.set_pivot_point(0.0f,0.0f);",
273               "    this.el.set_scale(0.0f,1.0f);",
274               "    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,",
275               "            _this.clutterembed.el.get_stage().height);",
276               "            ",
277               "}"
278              ],
279              "* pack" : "get_stage().add_child",
280              "id" : "objectview",
281              "xtype" : "Actor"
282             },
283             {
284              "$ xns" : "GtkClutter",
285              "* init" : [
286               "{",
287               "   ",
288               "   /*",
289               "    this.el.add_constraint(",
290               "        new Clutter.AlignConstraint(",
291               "            _this.clutterembed.el.get_stage(), ",
292               "            Clutter.AlignAxis.X_AXIS,",
293               "            0.0f",
294               "        )",
295               "    );",
296               "    */",
297               "    this.el.fixed_x = 50.0f;",
298               "    this.el.fixed_y = 0.0f;",
299               "    //this.el.set_position(100,100);",
300               "    this.el.set_pivot_point(0.0f,0.0f);",
301               "    this.el.set_scale(0.0f,1.0f);",
302               "    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,",
303               "            _this.clutterembed.el.get_stage().height);",
304               "            ",
305               "}"
306              ],
307              "* pack" : "get_stage().add_child",
308              "id" : "codeeditview",
309              "xtype" : "Actor"
310             },
311             {
312              "$ xns" : "GtkClutter",
313              "* init" : [
314               "{",
315               "   ",
316               "   /*",
317               "    this.el.add_constraint(",
318               "        new Clutter.AlignConstraint(",
319               "            _this.clutterembed.el.get_stage(), ",
320               "            Clutter.AlignAxis.X_AXIS,",
321               "            0.0f",
322               "        )",
323               "    );",
324               "    */",
325               "    this.el.fixed_x = 50.0f;",
326               "    this.el.fixed_y = 0.0f;",
327               "    //this.el.set_position(100,100);",
328               "    this.el.set_pivot_point(0.0f,0.0f);",
329               "    this.el.set_scale(0.0f,1.0f);",
330               "    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,",
331               "            _this.clutterembed.el.get_stage().height);",
332               "            ",
333               "}"
334              ],
335              "* pack" : "get_stage().add_child",
336              "id" : "addpropsview",
337              "xtype" : "Actor"
338             },
339             {
340              "$ xns" : "Clutter",
341              "* init" : [
342               "{",
343               "    ",
344               "    this.el.add_constraint(",
345               "        new Clutter.AlignConstraint(",
346               "            _this.clutterembed.el.get_stage(), ",
347               "            Clutter.AlignAxis.X_AXIS,",
348               "            0.0f",
349               "        )",
350               "    );",
351               "     ",
352               "    ",
353               "    //this.el.set_position(100,100);",
354               "    this.el.set_pivot_point(0.5f,0.5f);",
355               "     this.el.set_size(50,",
356               "           _this.clutterembed.el.get_stage().height);",
357               "     ",
358               "}"
359              ],
360              "* pack" : "get_stage().add_child",
361              "id" : "buttonlayout",
362              "items" : [
363               {
364                "$ orientation" : "Clutter.Orientation.VERTICAL",
365                "$ xns" : "Clutter",
366                "* prop" : "layout_manager",
367                "xtype" : "BoxLayout"
368               },
369               {
370                "$ xns" : "Clutter",
371                "* init" : "this.el.set_size(50,50);",
372                "* pack" : "add_child",
373                "id" : "backbutton",
374                "items" : [
375                 {
376                  "$ xns" : "GtkClutter",
377                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
378                  "* pack" : "add_child",
379                  "items" : [
380                   {
381                    "$ xns" : "Gtk",
382                    "* pack" : false,
383                    "height_request" : 50,
384                    "items" : [
385                     {
386                      "$ xns" : "Gtk",
387                      "* pack" : "set_image",
388                      "utf8 icon_name" : "go-previous",
389                      "xtype" : "Image"
390                     }
391                    ],
392                    "listeners" : {
393                     "clicked" : [
394                      "  ( ) => {",
395                      " //  if (_this.windowstate.state == WindowState.State.FILEPROJECT) {",
396                      "    ",
397                      "//\t     _this.windowstate.switchState(WindowState.State.FILES);",
398                      "  //   } else { ",
399                      "\t    _this.windowstate.switchState(WindowState.State.PREVIEW);",
400                      "  //  }",
401                      "    ",
402                      "",
403                      "}"
404                     ]
405                    },
406                    "utf8 tooltip_text" : "Back",
407                    "width_request" : 50,
408                    "xtype" : "Button"
409                   }
410                  ],
411                  "xtype" : "Actor"
412                 }
413                ],
414                "xtype" : "Actor"
415               },
416               {
417                "$ xns" : "Clutter",
418                "* init" : "this.el.set_size(50.0f,50.0f);",
419                "* pack" : "add_child",
420                "id" : "editfilebutton",
421                "items" : [
422                 {
423                  "$ xns" : "GtkClutter",
424                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
425                  "* pack" : "add_child",
426                  "items" : [
427                   {
428                    "$ tooltip_text" : "\"File Details\"",
429                    "$ xns" : "Gtk",
430                    "* pack" : false,
431                    "height_request" : 50,
432                    "items" : [
433                     {
434                      "$ xns" : "Gtk",
435                      "* pack" : "set_image",
436                      "utf8 icon_name" : "document-properties",
437                      "xtype" : "Image"
438                     }
439                    ],
440                    "listeners" : {
441                     "clicked" : [
442                      "  ( ) => {",
443                      "  ",
444                      "    // create a new file in project..",
445                      "    if (_this.project == null || _this.windowstate.file == null) {",
446                      "        return  ;",
447                      "    }",
448                      "     _this.windowstate.file_details.show(",
449                      "        _this.windowstate.file, this.el",
450                      "    );",
451                      "     ",
452                      "    return  ;    ",
453                      "",
454                      "",
455                      "}"
456                     ]
457                    },
458                    "width_request" : 50,
459                    "xtype" : "Button"
460                   }
461                  ],
462                  "xtype" : "Actor"
463                 }
464                ],
465                "xtype" : "Actor"
466               },
467               {
468                "$ xns" : "Clutter",
469                "* init" : "this.el.set_size(50,50);",
470                "* pack" : "add_child",
471                "id" : "projecteditbutton",
472                "items" : [
473                 {
474                  "$ xns" : "GtkClutter",
475                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
476                  "* pack" : "add_child",
477                  "items" : [
478                   {
479                    "$ tooltip_text" : "\"Project Details\"",
480                    "$ xns" : "Gtk",
481                    "* pack" : false,
482                    "height_request" : 50,
483                    "items" : [
484                     {
485                      "$ xns" : "Gtk",
486                      "* pack" : "set_image",
487                      "utf8 icon_name" : "emblem-system",
488                      "xtype" : "Image"
489                     }
490                    ],
491                    "listeners" : {
492                     "clicked" : [
493                      "  ( ) => {",
494                      "     ",
495                      "     _this.windowstate.projectPopoverShow(this.el);",
496                      "   ",
497                      " ",
498                      "}"
499                     ]
500                    },
501                    "width_request" : 50,
502                    "xtype" : "Button"
503                   }
504                  ],
505                  "xtype" : "Actor"
506                 }
507                ],
508                "xtype" : "Actor"
509               },
510               {
511                "$ xns" : "Clutter",
512                "* init" : "this.el.set_size(50,50);",
513                "* pack" : "add_child",
514                "id" : "objectshowbutton",
515                "items" : [
516                 {
517                  "$ xns" : "GtkClutter",
518                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
519                  "* pack" : "add_child",
520                  "items" : [
521                   {
522                    "$ tooltip_text" : "\"Add Child Element\"",
523                    "$ xns" : "Gtk",
524                    "* pack" : false,
525                    "height_request" : 50,
526                    "items" : [
527                     {
528                      "$ xns" : "Gtk",
529                      "* pack" : "set_image",
530                      "utf8 icon_name" : "list-add",
531                      "xtype" : "Image"
532                     }
533                    ],
534                    "listeners" : {
535                     "clicked" : [
536                      "  ( ) => {",
537                      "    ",
538                      "",
539                      "  \t_this.windowstate.showAddObject(this.el);",
540                      " ",
541                      "}"
542                     ]
543                    },
544                    "width_request" : 50,
545                    "xtype" : "Button"
546                   }
547                  ],
548                  "xtype" : "Actor"
549                 }
550                ],
551                "listeners" : {
552                 "enter_event" : [
553                  "(  event)  => {",
554                  "    this.el.background_color =   Clutter.Color.from_string(\"#333\");",
555                  "        return false;",
556                  "}"
557                 ],
558                 "leave_event" : [
559                  "(  event)  => {",
560                  "    this.el.background_color =   Clutter.Color.from_string(\"#000\");",
561                  "    return false;",
562                  "}"
563                 ]
564                },
565                "xtype" : "Actor"
566               },
567               {
568                "$ xns" : "Clutter",
569                "* init" : "this.el.set_size(50,50);",
570                "* pack" : "add_child",
571                "id" : "addpropbutton",
572                "items" : [
573                 {
574                  "$ xns" : "GtkClutter",
575                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
576                  "* pack" : "add_child",
577                  "items" : [
578                   {
579                    "$ tooltip_text" : "\"Add Property\"",
580                    "$ xns" : "Gtk",
581                    "* pack" : false,
582                    "height_request" : 50,
583                    "items" : [
584                     {
585                      "$ xns" : "Gtk",
586                      "* pack" : "set_image",
587                      "utf8 icon_name" : "format-justify-left",
588                      "xtype" : "Image"
589                     }
590                    ],
591                    "listeners" : {
592                     "clicked" : [
593                      "  ( ) => {",
594                      "    ",
595                      "     _this.windowstate.showProps(this.el, \"props\");",
596                      " ",
597                      "",
598                      "}"
599                     ]
600                    },
601                    "width_request" : 50,
602                    "xtype" : "Button"
603                   }
604                  ],
605                  "xtype" : "Actor"
606                 }
607                ],
608                "xtype" : "Actor"
609               },
610               {
611                "$ xns" : "Clutter",
612                "* init" : "this.el.set_size(50,50);",
613                "* pack" : "add_child",
614                "id" : "addlistenerbutton",
615                "items" : [
616                 {
617                  "$ xns" : "GtkClutter",
618                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
619                  "* pack" : "add_child",
620                  "items" : [
621                   {
622                    "$ tooltip_text" : "\"Add Event Code\"",
623                    "$ xns" : "Gtk",
624                    "* pack" : false,
625                    "height_request" : 50,
626                    "items" : [
627                     {
628                      "$ xns" : "Gtk",
629                      "* pack" : "set_image",
630                      "utf8 icon_name" : "appointment-new",
631                      "xtype" : "Image"
632                     }
633                    ],
634                    "listeners" : {
635                     "clicked" : [
636                      "  ( ) => {",
637                      "    ",
638                      " ",
639                      "   _this.windowstate.showProps(this.el, \"signals\");",
640                      "",
641                      "",
642                      "}"
643                     ]
644                    },
645                    "width_request" : 50,
646                    "xtype" : "Button"
647                   }
648                  ],
649                  "xtype" : "Actor"
650                 }
651                ],
652                "xtype" : "Actor"
653               },
654               {
655                "$ xns" : "Clutter",
656                "* init" : "this.el.set_size(50.0f,50.0f);",
657                "* pack" : "add_child",
658                "id" : "addprojectbutton",
659                "items" : [
660                 {
661                  "$ xns" : "GtkClutter",
662                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
663                  "* pack" : "add_child",
664                  "items" : [
665                   {
666                    "$ tooltip_text" : "\"New\\nProj.\"",
667                    "$ xns" : "Gtk",
668                    "* pack" : false,
669                    "height_request" : 50,
670                    "items" : [
671                     {
672                      "$ xns" : "Gtk",
673                      "* pack" : "set_image",
674                      "utf8 icon_name" : "folder-new",
675                      "xtype" : "Image"
676                     }
677                    ],
678                    "listeners" : {
679                     "clicked" : [
680                      "  ( ) => {",
681                      "  ",
682                      "    // create a new file in project..",
683                      "    //Xcls_DialogNewComponent.singleton().show(",
684                      "   var  pe =      EditProject.singleton();",
685                      "    pe.el.set_transient_for(_this.el);",
686                      "    pe.el.set_modal(true);   ",
687                      "   ",
688                      "    var p  = pe.show();",
689                      "",
690                      "    if (p == null) {",
691                      "        return;",
692                      "    }",
693                      "    ",
694                      "    ",
695                      "    _this.windowstate.left_projects.is_loaded = false;    ",
696                      "    _this.windowstate.left_projects.load();",
697                      "    _this.windowstate.left_projects.selectProject(p);",
698                      "    return  ;    ",
699                      "",
700                      "",
701                      "}"
702                     ]
703                    },
704                    "width_request" : 50,
705                    "xtype" : "Button"
706                   }
707                  ],
708                  "xtype" : "Actor"
709                 }
710                ],
711                "xtype" : "Actor"
712               },
713               {
714                "$ xns" : "Clutter",
715                "* init" : "this.el.set_size(50.0f,50.0f);",
716                "* pack" : "add_child",
717                "id" : "addfilebutton",
718                "items" : [
719                 {
720                  "$ xns" : "GtkClutter",
721                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
722                  "* pack" : "add_child",
723                  "items" : [
724                   {
725                    "$ tooltip_text" : "\"Add File\"",
726                    "$ xns" : "Gtk",
727                    "* pack" : false,
728                    "height_request" : 50,
729                    "items" : [
730                     {
731                      "$ xns" : "Gtk",
732                      "* pack" : "set_image",
733                      "utf8 icon_name" : "document-new",
734                      "xtype" : "Image"
735                     }
736                    ],
737                    "listeners" : {
738                     "clicked" : [
739                      " () => {",
740                      "    // create a new file in project..",
741                      "    print(\"add file selected\\n\");",
742                      "    // what's the currently selected project...",
743                      "    var proj = _this.windowstate.left_projects.getSelectedProject();",
744                      "    ",
745                      "    if (proj == null) {",
746                      "\t\tprint(\"no project selected?\\n\");",
747                      "        return  ;",
748                      "    }",
749                      "    ",
750                      "    print(\"creating file?\");",
751                      "    ",
752                      "    var f = JsRender.JsRender.factory(proj.xtype,  proj, \"\");",
753                      "    _this.project = proj;",
754                      "        print(\"showing popup?\");",
755                      "     _this.windowstate.file_details.show(",
756                      "       f, this.el",
757                      "    );",
758                      "    ",
759                      "    ",
760                      "    return  ;    ",
761                      "}"
762                     ]
763                    },
764                    "width_request" : 50,
765                    "xtype" : "Button"
766                   }
767                  ],
768                  "xtype" : "Actor"
769                 }
770                ],
771                "xtype" : "Actor"
772               },
773               {
774                "$ xns" : "Clutter",
775                "* init" : "this.el.set_size(50,50);",
776                "* pack" : "add_child",
777                "id" : "delprojectbutton",
778                "items" : [
779                 {
780                  "$ xns" : "GtkClutter",
781                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
782                  "* pack" : "add_child",
783                  "items" : [
784                   {
785                    "$ tooltip_text" : "\"Delete Project\"",
786                    "$ xns" : "Gtk",
787                    "* pack" : false,
788                    "height_request" : 50,
789                    "items" : [
790                     {
791                      "$ xns" : "Gtk",
792                      "* pack" : "set_image",
793                      "utf8 icon_name" : "user-trash",
794                      "xtype" : "Image"
795                     }
796                    ],
797                    "listeners" : {
798                     "clicked" : [
799                      "  ( ) => {",
800                      "     ",
801                      "     var cd = DialogConfirm.singleton();",
802                      "     cd.el.set_transient_for(_this.el);",
803                      "    cd.el.set_modal(true);",
804                      "",
805                      "     var project =   _this.windowstate.left_projects.getSelectedProject();",
806                      "    if (project == null) {",
807                      "        print(\"SKIP - no project\\n\");",
808                      "        return;",
809                      "    }",
810                      "    ",
811                      "        ",
812                      "     if (Gtk.ResponseType.YES != cd.show(\"Confirm\", ",
813                      "        \"Are you sure you want to delete project %s\".printf(project.name))) {",
814                      "        return;",
815                      "    }",
816                      "     ",
817                      "",
818                      "    // confirm?",
819                      "    Project.Project.remove(project);",
820                      "    _this.project = null;",
821                      "    ",
822                      "    _this.windowstate.left_projects.is_loaded =  false;",
823                      "    _this.windowstate.left_projects.load();",
824                      "    _this.windowstate.clutterfiles.clearFiles();",
825                      "",
826                      "}"
827                     ]
828                    },
829                    "width_request" : 50,
830                    "xtype" : "Button"
831                   }
832                  ],
833                  "xtype" : "Actor"
834                 }
835                ],
836                "xtype" : "Actor"
837               }
838              ],
839              "xtype" : "Actor"
840             }
841            ],
842            "listeners" : {
843             "size_allocate" : [
844              "  (  alloc) => {",
845              "    if (_this.windowstate == null) {",
846              "        return;",
847              "    }",
848              "    _this.windowstate.resizeCanvas(); ",
849              "        ",
850              "}"
851             ]
852            },
853            "xtype" : "Embed"
854           }
855          ],
856          "xtype" : "Box"
857         }
858        ],
859        "position" : 400,
860        "xtype" : "Paned"
861       },
862       {
863        "$ xns" : "Gtk",
864        "* pack" : "pack_end,false,true,0",
865        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
866        "bool homogeneous" : false,
867        "items" : [
868         {
869          "$ xns" : "Gtk",
870          "* pack" : "pack_start,true,true,0",
871          "string label" : "   ",
872          "xtype" : "Label"
873         },
874         {
875          "$ xns" : "Gtk",
876          "* init" : [
877           "{",
878           "     this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {",
879           "        if (pos < 1) {",
880           "            this.el.hide();",
881           "            _this.mainpane.el.set_sensitive(true);",
882           "            ",
883           "            return;",
884           "        }",
885           "         _this.mainpane.el.set_sensitive(false);",
886           "         this.el.show();",
887           "         this.el.set_fraction ((1.0f * pos) / (1.0f * total));",
888           "         this.el.set_text(\"Fetching Resource : %s/%s\".printf(pos.to_string(), total.to_string()));",
889           "       ",
890           "     });",
891           "}",
892           ""
893          ],
894          "* pack" : "pack_start,true,true,0",
895          "bool show_text" : true,
896          "id" : "statusbar",
897          "ulong handler_id" : "-1",
898          "xtype" : "ProgressBar"
899         },
900         {
901          "$ xns" : "Gtk",
902          "* init" : [
903           "var description =   Pango.FontDescription.from_string(\"monospace\");",
904           "\tdescription.set_size(8000);",
905           "\t this.el.override_font(description);",
906           "",
907           ""
908          ],
909          "* pack" : "pack_start,false,true,0",
910          "id" : "search_entry",
911          "listeners" : {
912           "changed" : [
913            "() => {",
914            "\tif (this.el.text == \"\") {",
915            "\t\t_this.search_results.el.hide();",
916            "\t\treturn;",
917            "\t}",
918            "\tvar res = 0;",
919            "\tswitch(_this.windowstate.state) {",
920            "\t\tcase WindowState.State.CODEONLY:",
921            "\t\t///case WindowState.State.CODE:",
922            "\t\t\t// search the code being edited..",
923            "\t\t\tres = _this.windowstate.code_editor_tab.search(this.el.text);",
924            "\t\t\t",
925            "\t\t\tbreak;",
926            "\t\tcase WindowState.State.PREVIEW:",
927            "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
928            "\t\t\t\t res = _this.windowstate.window_gladeview.search(this.el.text);",
929            "\t\t\t} else { ",
930            "\t\t\t\t res = _this.windowstate.window_rooview.search(this.el.text);\t\t\t",
931            "\t\t\t}",
932            "\t\t",
933            "\t\t",
934            "\t\t\tbreak;",
935            "\t}",
936            "\t_this.search_results.el.show();",
937            "\tif (res > 0) {",
938            "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
939            "\t} else {",
940            "\t\t_this.search_results.el.label = \"No Matches\";",
941            "\t}",
942            "\t\t",
943            "\t",
944            "\t",
945            "}",
946            ""
947           ],
948           "key_press_event" : [
949            "(event) => {",
950            "    ",
951            " \tif (event.keyval == Gdk.Key.Return) {",
952            "\t\tthis.forwardSearch(false);",
953            "\t    return true;",
954            "",
955            "\t}    ",
956            "   // print(event.key.keyval)",
957            "    ",
958            "    return false;",
959            "",
960            "} "
961           ]
962          },
963          "xtype" : "SearchEntry",
964          "| void forwardSearch" : [
965           "(bool change_focus) {",
966           "\tswitch(_this.windowstate.state) {",
967           "\t\tcase WindowState.State.CODEONLY:",
968           "\t\t//case WindowState.State.CODE:",
969           "\t\t\t// search the code being edited..",
970           "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
971           "\t\t\t ",
972           "\t\t\tbreak;",
973           "\t\tcase WindowState.State.PREVIEW:",
974           "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
975           "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
976           "\t\t\t} else { ",
977           "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
978           "\t\t\t}",
979           "\t\t",
980           "\t\t\tbreak;",
981           "\t}",
982           "\t",
983           "}",
984           ""
985          ]
986         },
987         {
988          "$ xns" : "Gtk",
989          "* pack" : "add",
990          "items" : [
991           {
992            "$ xns" : "Gtk",
993            "* pack" : "add",
994            "Xcls_ValaCompileErrors popup" : "",
995            "bool always_show_image" : true,
996            "id" : "search_results",
997            "items" : [
998             {
999              "$ xns" : "Gtk",
1000              "* pack" : "set_image",
1001              "bool sensitive" : false,
1002              "utf8 icon_name" : "system-search",
1003              "xtype" : "Image"
1004             }
1005            ],
1006            "listeners" : {
1007             "button_press_event" : [
1008              "() => {",
1009              "/*",
1010              "    if (this.popup == null) {",
1011              "        this.popup = new Xcls_ValaCompileErrors();",
1012              "        this.popup.window = _this;",
1013              "    }",
1014              "   ",
1015              "    ",
1016              "    this.popup.show(this.notices, this.el);",
1017              "    */",
1018              "    return true;",
1019              "}"
1020             ]
1021            },
1022            "string label" : "Matches",
1023            "xtype" : "ImageMenuItem"
1024           },
1025           {
1026            "$ xns" : "Gtk",
1027            "* pack" : "add",
1028            "id" : "statusbar_compilestatus_label",
1029            "string label" : "Compile Status:",
1030            "xtype" : "MenuItem"
1031           },
1032           {
1033            "# Json.Object notices" : "new Json.Object() ",
1034            "$ xns" : "Gtk",
1035            "* pack" : "add",
1036            "Xcls_ValaCompileErrors popup" : "",
1037            "bool always_show_image" : true,
1038            "id" : "statusbar_errors",
1039            "items" : [
1040             {
1041              "$ xns" : "Gtk",
1042              "* pack" : "set_image",
1043              "utf8 icon_name" : "dialog-error",
1044              "xtype" : "Image"
1045             }
1046            ],
1047            "listeners" : {
1048             "button_press_event" : [
1049              "() => {",
1050              "    if (this.popup == null) {",
1051              "        this.popup = new Xcls_ValaCompileErrors();",
1052              "        this.popup.window = _this;",
1053              "    }",
1054              "   ",
1055              "    ",
1056              "    this.popup.show(this.notices, this.el);",
1057              "    return true;",
1058              "}"
1059             ]
1060            },
1061            "string label" : "Errors",
1062            "xtype" : "ImageMenuItem",
1063            "| void setNotices" : [
1064             "(Json.Object nots, int qty) {",
1065             "    this.el.show();",
1066             "    this.el.label = qty.to_string() + \" Errors\";",
1067             "    this.notices = nots;",
1068             "",
1069             "}",
1070             ""
1071            ]
1072           },
1073           {
1074            "# Json.Object notices" : "new Json.Object()",
1075            "$ xns" : "Gtk",
1076            "* pack" : "add",
1077            "Xcls_ValaCompileErrors popup" : "",
1078            "bool always_show_image" : true,
1079            "id" : "statusbar_warnings",
1080            "items" : [
1081             {
1082              "$ xns" : "Gtk",
1083              "* pack" : "set_image",
1084              "utf8 icon_name" : "dialog-warning",
1085              "xtype" : "Image"
1086             }
1087            ],
1088            "listeners" : {
1089             "button_press_event" : [
1090              "() => {",
1091              "    if (this.popup == null) {",
1092              "        this.popup = new Xcls_ValaCompileErrors();",
1093              "        this.popup.window = _this;",
1094              "    }",
1095              "    ",
1096              "    this.popup.show(this.notices, this.el);",
1097              "    return true;",
1098              "}"
1099             ]
1100            },
1101            "string label" : "Warnings",
1102            "xtype" : "ImageMenuItem",
1103            "| void setNotices" : [
1104             "(Json.Object nots, int qty) {",
1105             "    this.el.show();",
1106             "    this.el.label = qty.to_string() + \" Warnings\";",
1107             "    this.notices = nots;",
1108             "",
1109             "}",
1110             ""
1111            ]
1112           },
1113           {
1114            "# Json.Object notices" : "new Json.Object()",
1115            "$ xns" : "Gtk",
1116            "* pack" : "add",
1117            "Xcls_ValaCompileErrors popup" : "",
1118            "bool always_show_image" : true,
1119            "id" : "statusbar_depricated",
1120            "items" : [
1121             {
1122              "$ xns" : "Gtk",
1123              "* pack" : "set_image",
1124              "utf8 icon_name" : "dialog-information",
1125              "xtype" : "Image"
1126             }
1127            ],
1128            "listeners" : {
1129             "button_press_event" : [
1130              "() => {",
1131              "    if (this.popup == null) {",
1132              "        this.popup = new Xcls_ValaCompileErrors();",
1133              "        this.popup.window = _this;",
1134              "    }",
1135              "    ",
1136              "    ",
1137              "    this.popup.show(this.notices, this.el);",
1138              "    return true;",
1139              "}"
1140             ]
1141            },
1142            "string label" : "Depricated",
1143            "xtype" : "ImageMenuItem",
1144            "| void setNotices" : [
1145             "(Json.Object nots, int qty) {",
1146             "    this.el.show();",
1147             "    this.el.label = qty.to_string() + \" Depricated\";",
1148             "    this.notices = nots;",
1149             "",
1150             "}",
1151             ""
1152            ]
1153           },
1154           {
1155            "$ xns" : "Gtk",
1156            "* pack" : "add",
1157            "Xcls_ValaCompileErrors popup" : "",
1158            "bool always_show_image" : true,
1159            "id" : "statusbar_run",
1160            "items" : [
1161             {
1162              "$ xns" : "Gtk",
1163              "* pack" : "set_image",
1164              "utf8 icon_name" : "media-playback-start",
1165              "xtype" : "Image"
1166             }
1167            ],
1168            "listeners" : {
1169             "button_press_event" : [
1170              "() => {",
1171              "\tif (_this.windowstate.file == null) {",
1172              "\t\treturn true;",
1173              "\t}",
1174              "\t_this.windowstate.valasource.spawnExecute(_this.windowstate.file);",
1175              "\t",
1176              "\t_this.windowstate.compile_results.show(this.el,true);",
1177              "\t",
1178              "\treturn true;",
1179              "}"
1180             ]
1181            },
1182            "string label" : "Run",
1183            "xtype" : "ImageMenuItem"
1184           }
1185          ],
1186          "xtype" : "MenuBar"
1187         },
1188         {
1189          "$ xns" : "Gtk",
1190          "* pack" : "add",
1191          "id" : "statusbar_compile_spinner",
1192          "string tooltip_text" : "Compiling",
1193          "xtype" : "Spinner",
1194          "| void start" : [
1195           "() {",
1196           "  this.el.show();",
1197           "  this.el.start();  ",
1198           "}",
1199           ""
1200          ],
1201          "| void stop" : [
1202           "() {",
1203           " this.el.stop();",
1204           "  this.el.hide();",
1205           "}",
1206           ""
1207          ]
1208         }
1209        ],
1210        "xtype" : "Box"
1211       }
1212      ],
1213      "xtype" : "Box"
1214     }
1215    ],
1216    "listeners" : {
1217     "delete_event" : [
1218      "  (   event) => {",
1219      "    return false;",
1220      "} "
1221     ],
1222     "destroy" : [
1223      "() =>  {",
1224      " Xcls_MainWindow.singleton().no_windows--;",
1225      " ",
1226      " Resources.singleton().disconnect(_this.statusbar.handler_id);",
1227      " ",
1228      " ",
1229      " if (Xcls_MainWindow.singleton().no_windows < 1) {",
1230      "",
1231      "     Gtk.main_quit();",
1232      " }",
1233      "}"
1234     ],
1235     "key_release_event" : [
1236      " (event) => {",
1237      "    ",
1238      "    if (this.search_entry.el.is_visible()) {",
1239      "\t\tif (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
1240      "\t\t    print(\"SAVE: ctrl-f  pressed\");",
1241      "\t\t\tthis.search_entry.el.grab_focus();",
1242      "\t\t    return false;",
1243      "\t\t}",
1244      "\t\t",
1245      "\t\tif (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
1246      "\t\t    print(\"SAVE: ctrl-g  pressed\");",
1247      "\t\t\tthis.search_entry.forwardSearch(true);",
1248      "\t\t    return false;",
1249      "\t\t}",
1250      "\t\t",
1251      "\t}    ",
1252      "\t",
1253      "\tif (event.keyval == Gdk.Key.n && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
1254      "\t\tprint(\"SAVE: ctrl-n  pressed\");",
1255      "\t\tthis.openNewWindow();",
1256      "\t\treturn false;",
1257      "\t}",
1258      "\t",
1259      "   // print(event.key.keyval)",
1260      "    ",
1261      "    return false;",
1262      "",
1263      "} ",
1264      "",
1265      ""
1266     ],
1267     "show" : [
1268      "  ( ) => {",
1269      "    // hide the file editing..",
1270      "   ",
1271      "    //this.hideViewEditing();",
1272      "    _this.statusbar.el.hide();",
1273      "     _this.statusbar_errors.el.hide();",
1274      "    _this.statusbar_warnings.el.hide();",
1275      "    _this.statusbar_depricated.el.hide();",
1276      "    _this.statusbar_compile_spinner.el.hide();",
1277      "  ",
1278      "    Resources.singleton().checkResources();",
1279      "",
1280      "}"
1281     ]
1282    },
1283    "xtype" : "Window",
1284    "|             void setTitle" : [
1285     " (string str) {",
1286     "    this.headerbar.el.set_title(this.title + \" - \" + str);",
1287     "} ",
1288     ""
1289    ],
1290    "|             void show" : [
1291     "() {",
1292     "   ",
1293     "    this.el.show_all();",
1294     "",
1295     "}"
1296    ],
1297    "|        void initChildren" : [
1298     " () {",
1299     "    // this needs putting in a better place..",
1300     "    this.windowstate = new WindowState(this);",
1301     "     ",
1302     "",
1303     "    //w.el.show_all();",
1304     "    var tl = new Clutter.Timeline(6000);",
1305     "    tl.set_repeat_count(-1);",
1306     "    tl.start();",
1307     "    tl.ref();",
1308     "",
1309     "    ",
1310     "",
1311     "",
1312     "",
1313     "}",
1314     ""
1315    ],
1316    "| void openNewWindow" : [
1317     "() {",
1318     "\tXcls_MainWindow.singleton().no_windows++;",
1319     "        var w = new Xcls_MainWindow();",
1320     "        w.ref();",
1321     "",
1322     "        w.el.show_all();",
1323     "        w.initChildren();",
1324     "        w.windowstate.switchState(WindowState.State.FILES);",
1325     "}",
1326     ""
1327    ]
1328   }
1329  ],
1330  "modOrder" : "",
1331  "name" : "MainWindow",
1332  "parent" : "",
1333  "path" : "/home/alan/gitlive/roobuilder/src/Builder4/MainWindow.bjs",
1334  "permname" : "",
1335  "title" : ""
1336 }