src/Builder4/MainWindow.bjs
[app.Builder.js] / src / Builder4 / MainWindow.bjs
1 {
2  "name" : "MainWindow",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/MainWindow.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "items" : [
9   {
10    "listeners" : {
11     "delete_event" : "  (   event) => {\n    return false;\n}",
12     "destroy" : "() =>  {\n Xcls_MainWindow.singleton().no_windows--;\n \n if (Xcls_MainWindow.singleton().no_windows < 1) {\n\n     Gtk.main_quit();\n }\n}",
13     "show" : "  ( ) => {\n    // hide the file editing..\n   \n    //this.hideViewEditing();\n}"
14    },
15    "id" : "MainWindow",
16    "default_width" : 800,
17    "* init" : " \n\t  \n    //this.el.show_all();\n    \n    ",
18    "# Project.Project project" : "null",
19    "# string title" : "\"Application Builder\"",
20    "xtype" : "Window",
21    "# int no_windows" : 1,
22    "default_height" : 500,
23    "|        void initChildren" : " () {\n    // this needs putting in a better place..\n    this.windowstate = new WindowState(this);\n     \n\n    //w.el.show_all();\n    var tl = new Clutter.Timeline(6000);\n    tl.set_repeat_count(-1);\n    tl.start();\n    tl.ref();\n\n    \n\n\n\n}\n",
24    "$ xns" : "Gtk",
25    "|             void show" : "() {\n   \n    this.el.show_all();\n\n}",
26    "# WindowState windowstate" : "null",
27    "border_width" : 0,
28    "$ type" : "Gtk.WindowType.TOPLEVEL",
29    "|             void setTitle" : " (string str) {\n    this.el.set_title(this.title + \" - \" + str);\n}\n",
30    "items" : [
31     {
32      "id" : "vbox",
33      "* pack" : "add",
34      "xtype" : "VBox",
35      "$ xns" : "Gtk",
36      "$ homogeneous" : false,
37      "items" : [
38       {
39        "id" : "mainpane",
40        "position" : 400,
41        "* pack" : "pack_end,true,true,0",
42        "# int lastWidth" : 0,
43        "xtype" : "HPaned",
44        "$ xns" : "Gtk",
45        "items" : [
46         {
47          "id" : "leftpane",
48          "xtype" : "VBox",
49          "* pack" : "add1",
50          "$ xns" : "Gtk",
51          "items" : [
52           {
53            "id" : "editpane",
54            "xtype" : "VPaned",
55            "* pack" : "pack_start,false,true,0",
56            "$ xns" : "Gtk",
57            "items" : [
58             {
59              "id" : "tree",
60              "xtype" : "VBox",
61              "* pack" : "add1",
62              "$ xns" : "Gtk"
63             },
64             {
65              "id" : "props",
66              "xtype" : "VBox",
67              "* pack" : "add2",
68              "$ xns" : "Gtk"
69             }
70            ]
71           }
72          ]
73         },
74         {
75          "* pack" : "add2",
76          "xtype" : "VBox",
77          "$ xns" : "Gtk",
78          "items" : [
79           {
80            "listeners" : {
81             "size_allocate" : "  (  alloc) => {\n    if (_this.windowstate == null) {\n        return;\n    }\n    _this.windowstate.resizeCanvas(); \n        \n}"
82            },
83            "id" : "clutterembed",
84            "* init" : "    var stage = this.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    \n",
85            "xtype" : "Embed",
86            "* pack" : "pack_start,true,true,0",
87            "$ xns" : "GtkClutter",
88            "items" : [
89             {
90              "id" : "rooview",
91              "* init" : "{\n   \n   \n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            1.0f\n        )\n    );\n        \n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(1.0f,1.0f);\n    \n    this.el.set_size(_this.clutterembed.el.get_stage().width-50,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
92              "xtype" : "Actor",
93              "* pack" : "get_stage().add_child",
94              "$ xns" : "GtkClutter"
95             },
96             {
97              "id" : "objectview",
98              "* init" : "{\n   \n   /*\n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n    */\n    this.el.fixed_x = 50.0f;\n    this.el.fixed_y = 0.0f;\n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(0.0f,1.0f);\n    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
99              "xtype" : "Actor",
100              "* pack" : "get_stage().add_child",
101              "$ xns" : "GtkClutter"
102             },
103             {
104              "id" : "codeeditview",
105              "* init" : "{\n   \n   /*\n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n    */\n    this.el.fixed_x = 50.0f;\n    this.el.fixed_y = 0.0f;\n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(0.0f,1.0f);\n    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
106              "xtype" : "Actor",
107              "* pack" : "get_stage().add_child",
108              "$ xns" : "GtkClutter"
109             },
110             {
111              "id" : "addpropsview",
112              "* init" : "{\n   \n   /*\n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n    */\n    this.el.fixed_x = 50.0f;\n    this.el.fixed_y = 0.0f;\n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(0.0f,1.0f);\n    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
113              "xtype" : "Actor",
114              "* pack" : "get_stage().add_child",
115              "$ xns" : "GtkClutter"
116             },
117             {
118              "id" : "projecteditview",
119              "* init" : "{\n   \n   \n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            1.0f\n        )\n    );\n        \n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(1.0f,0.0f);\n    this.el.set_size(_this.clutterembed.el.get_stage().width-50,\n            _this.clutterembed.el.get_stage().height /2);\n            \n}",
120              "xtype" : "Actor",
121              "* pack" : "get_stage().add_child",
122              "$ xns" : "GtkClutter"
123             },
124             {
125              "id" : "buttonlayout",
126              "* init" : "{\n    \n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n     \n    \n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.5f,0.5f);\n     this.el.set_size(50,\n           _this.clutterembed.el.get_stage().height);\n     \n}",
127              "xtype" : "Actor",
128              "* pack" : "get_stage().add_child",
129              "$ xns" : "Clutter",
130              "items" : [
131               {
132                "$ orientation" : "Clutter.Orientation.VERTICAL",
133                "xtype" : "BoxLayout",
134                "$ xns" : "Clutter",
135                "* prop" : "layout_manager"
136               },
137               {
138                "id" : "backbutton",
139                "* init" : "this.el.set_size(50,50);",
140                "xtype" : "Actor",
141                "* pack" : "add_child",
142                "$ xns" : "Clutter",
143                "items" : [
144                 {
145                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
146                  "xtype" : "Actor",
147                  "* pack" : "add_child",
148                  "$ xns" : "GtkClutter",
149                  "items" : [
150                   {
151                    "listeners" : {
152                     "clicked" : "  ( ) => {\n  \n    _this.windowstate.switchState(WindowState.State.PREVIEW);\n    \n\n}"
153                    },
154                    "utf8 tooltip_text" : "Back",
155                    "* pack" : false,
156                    "xtype" : "Button",
157                    "width_request" : 50,
158                    "$ xns" : "Gtk",
159                    "height_request" : 50,
160                    "items" : [
161                     {
162                      "* pack" : "set_image",
163                      "xtype" : "Image",
164                      "utf8 icon_name" : "go-previous",
165                      "$ xns" : "Gtk"
166                     }
167                    ]
168                   }
169                  ]
170                 }
171                ]
172               },
173               {
174                "id" : "projectbutton",
175                "* init" : "this.el.set_size(50,50);",
176                "xtype" : "Actor",
177                "* pack" : "add_child",
178                "$ xns" : "Clutter",
179                "items" : [
180                 {
181                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
182                  "* pack" : "add_child",
183                  "xtype" : "Actor",
184                  "$ xns" : "GtkClutter",
185                  "items" : [
186                   {
187                    "listeners" : {
188                     "clicked" : "  ( ) => {\n   _this.windowstate.switchState(WindowState.State.FILES);\n      \n\n}"
189                    },
190                    "* pack" : false,
191                    "xtype" : "Button",
192                    "width_request" : 50,
193                    "$ xns" : "Gtk",
194                    "height_request" : 50,
195                    "$ tooltop_text" : "\"Open File\"",
196                    "items" : [
197                     {
198                      "utf8 icon_name" : "document-open",
199                      "* pack" : "set_image",
200                      "xtype" : "Image",
201                      "$ xns" : "Gtk"
202                     }
203                    ]
204                   }
205                  ]
206                 }
207                ]
208               },
209               {
210                "id" : "editfilebutton",
211                "* init" : "this.el.set_size(50.0f,50.0f);",
212                "xtype" : "Actor",
213                "* pack" : "add_child",
214                "$ xns" : "Clutter",
215                "items" : [
216                 {
217                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
218                  "* pack" : "add_child",
219                  "xtype" : "Actor",
220                  "$ xns" : "GtkClutter",
221                  "items" : [
222                   {
223                    "listeners" : {
224                     "clicked" : "  ( ) => {\n  \n    // create a new file in project..\n    if (_this.project == null || _this.windowstate.left_tree.model.file == null) {\n        return  ;\n    }\n     _this.windowstate.new_file_dialog.show(_this.windowstate.left_tree.model.file);\n     \n    return  ;    \n\n\n}"
225                    },
226                    "* pack" : false,
227                    "xtype" : "Button",
228                    "width_request" : 50,
229                    "$ xns" : "Gtk",
230                    "$ tooltip_text" : "\"File Details\"",
231                    "height_request" : 50,
232                    "items" : [
233                     {
234                      "xtype" : "Image",
235                      "utf8 icon_name" : "document-properties",
236                      "* pack" : "set_image",
237                      "$ xns" : "Gtk"
238                     }
239                    ]
240                   }
241                  ]
242                 }
243                ]
244               },
245               {
246                "id" : "projecteditbutton",
247                "* init" : "this.el.set_size(50,50);",
248                "xtype" : "Actor",
249                "* pack" : "add_child",
250                "$ xns" : "Clutter",
251                "items" : [
252                 {
253                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
254                  "* pack" : "add_child",
255                  "xtype" : "Actor",
256                  "$ xns" : "GtkClutter",
257                  "items" : [
258                   {
259                    "listeners" : {
260                     "clicked" : "  ( ) => {\n     _this.windowstate.switchState(WindowState.State.PROJECT);\n   \n\n\n}"
261                    },
262                    "* pack" : false,
263                    "xtype" : "Button",
264                    "width_request" : 50,
265                    "$ xns" : "Gtk",
266                    "$ tooltip_text" : "\"Project Details\"",
267                    "height_request" : 50,
268                    "items" : [
269                     {
270                      "* pack" : "set_image",
271                      "xtype" : "Image",
272                      "utf8 icon_name" : "emblem-system",
273                      "$ xns" : "Gtk"
274                     }
275                    ]
276                   }
277                  ]
278                 }
279                ]
280               },
281               {
282                "listeners" : {
283                 "enter_event" : "(  event)  => {\n    this.el.background_color = new Clutter.Color.from_string(\"#333\");\n        return false;\n}",
284                 "leave_event" : "(  event)  => {\n    this.el.background_color = new Clutter.Color.from_string(\"#000\");\n    return false;\n}"
285                },
286                "id" : "objectshowbutton",
287                "* init" : "this.el.set_size(50,50);",
288                "xtype" : "Actor",
289                "* pack" : "add_child",
290                "$ xns" : "Clutter",
291                "items" : [
292                 {
293                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
294                  "* pack" : "add_child",
295                  "xtype" : "Actor",
296                  "$ xns" : "GtkClutter",
297                  "items" : [
298                   {
299                    "listeners" : {
300                     "clicked" : "  ( ) => {\n    \n     _this.windowstate.switchState(WindowState.State.OBJECT);\n  \n \n}"
301                    },
302                    "* pack" : false,
303                    "xtype" : "Button",
304                    "width_request" : 50,
305                    "$ xns" : "Gtk",
306                    "$ tooltip_text" : "\"Add Child Element\"",
307                    "height_request" : 50,
308                    "items" : [
309                     {
310                      "utf8 icon_name" : "list-add",
311                      "* pack" : "set_image",
312                      "xtype" : "Image",
313                      "$ xns" : "Gtk"
314                     }
315                    ]
316                   }
317                  ]
318                 }
319                ]
320               },
321               {
322                "id" : "addpropbutton",
323                "* init" : "this.el.set_size(50,50);",
324                "xtype" : "Actor",
325                "* pack" : "add_child",
326                "$ xns" : "Clutter",
327                "items" : [
328                 {
329                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
330                  "* pack" : "add_child",
331                  "xtype" : "Actor",
332                  "$ xns" : "GtkClutter",
333                  "items" : [
334                   {
335                    "listeners" : {
336                     "clicked" : "  ( ) => {\n    \n     _this.windowstate.switchState(WindowState.State.PROP);\n \n\n}"
337                    },
338                    "* pack" : false,
339                    "xtype" : "Button",
340                    "width_request" : 50,
341                    "$ xns" : "Gtk",
342                    "$ tooltip_text" : "\"Add Property\"",
343                    "height_request" : 50,
344                    "items" : [
345                     {
346                      "xtype" : "Image",
347                      "utf8 icon_name" : "format-justify-left",
348                      "* pack" : "set_image",
349                      "$ xns" : "Gtk"
350                     }
351                    ]
352                   }
353                  ]
354                 }
355                ]
356               },
357               {
358                "id" : "addlistenerbutton",
359                "* init" : "this.el.set_size(50,50);",
360                "xtype" : "Actor",
361                "* pack" : "add_child",
362                "$ xns" : "Clutter",
363                "items" : [
364                 {
365                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
366                  "* pack" : "add_child",
367                  "xtype" : "Actor",
368                  "$ xns" : "GtkClutter",
369                  "items" : [
370                   {
371                    "listeners" : {
372                     "clicked" : "  ( ) => {\n    \n    _this.windowstate.switchState(WindowState.State.LISTENER);\n  \n\n\n}"
373                    },
374                    "* pack" : false,
375                    "xtype" : "Button",
376                    "width_request" : 50,
377                    "$ xns" : "Gtk",
378                    "$ tooltip_text" : "\"Add Event Code\"",
379                    "height_request" : 50,
380                    "items" : [
381                     {
382                      "* pack" : "set_image",
383                      "xtype" : "Image",
384                      "utf8 icon_name" : "appointment-new",
385                      "$ xns" : "Gtk"
386                     }
387                    ]
388                   }
389                  ]
390                 }
391                ]
392               },
393               {
394                "id" : "addprojectbutton",
395                "* init" : "this.el.set_size(50.0f,50.0f);",
396                "xtype" : "Actor",
397                "* pack" : "add_child",
398                "$ xns" : "Clutter",
399                "items" : [
400                 {
401                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
402                  "* pack" : "add_child",
403                  "xtype" : "Actor",
404                  "$ xns" : "GtkClutter",
405                  "items" : [
406                   {
407                    "listeners" : {
408                     "clicked" : "  ( ) => {\n  \n    // create a new file in project..\n    //Xcls_DialogNewComponent.singleton().show(\n   var  pe =     Xcls_EditProject.singleton();\n    pe.el.set_transient_for(_this.el);\n    pe.el.set_modal(true);   \n   \n    var p  = pe.show();\n\n    if (p == null) {\n        return;\n    }\n    \n    \n    _this.windowstate.left_projects.is_loaded = false;    \n    _this.windowstate.left_projects.load();\n    _this.windowstate.left_projects.selectProject(p);\n    return  ;    \n\n\n}"
409                    },
410                    "* pack" : false,
411                    "xtype" : "Button",
412                    "width_request" : 50,
413                    "$ xns" : "Gtk",
414                    "$ tooltip_text" : "\"New\\nProj.\"",
415                    "height_request" : 50,
416                    "items" : [
417                     {
418                      "xtype" : "Image",
419                      "utf8 icon_name" : "folder-new",
420                      "* pack" : "set_image",
421                      "$ xns" : "Gtk"
422                     }
423                    ]
424                   }
425                  ]
426                 }
427                ]
428               },
429               {
430                "id" : "addfilebutton",
431                "* init" : "this.el.set_size(50.0f,50.0f);",
432                "xtype" : "Actor",
433                "* pack" : "add_child",
434                "$ xns" : "Clutter",
435                "items" : [
436                 {
437                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
438                  "* pack" : "add_child",
439                  "xtype" : "Actor",
440                  "$ xns" : "GtkClutter",
441                  "items" : [
442                   {
443                    "listeners" : {
444                     "clicked" : " () => {\n    // create a new file in project..\n    \n    // what's the currently selected project...\n    var proj = _this.windowstate.left_projects.getSelectedProject();\n    \n    if (proj == null) {\n        return  ;\n    }\n    \n    \n    \n    var f = JsRender.JsRender.factory(proj.xtype,  proj, \"\");\n    _this.project = proj;\n    _this.windowstate.new_file_dialog.show(f);\n    \n    return  ;    \n}"
445                    },
446                    "* pack" : false,
447                    "xtype" : "Button",
448                    "width_request" : 50,
449                    "$ xns" : "Gtk",
450                    "$ tooltip_text" : "\"Add File\"",
451                    "height_request" : 50,
452                    "items" : [
453                     {
454                      "utf8 icon_name" : "document-new",
455                      "* pack" : "set_image",
456                      "xtype" : "Image",
457                      "$ xns" : "Gtk"
458                     }
459                    ]
460                   }
461                  ]
462                 }
463                ]
464               },
465               {
466                "id" : "delprojectbutton",
467                "* init" : "this.el.set_size(50,50);",
468                "xtype" : "Actor",
469                "* pack" : "add_child",
470                "$ xns" : "Clutter",
471                "items" : [
472                 {
473                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
474                  "* pack" : "add_child",
475                  "xtype" : "Actor",
476                  "$ xns" : "GtkClutter",
477                  "items" : [
478                   {
479                    "listeners" : {
480                     "clicked" : "  ( ) => {\n     \n     var cd = DialogConfirm.singleton();\n     cd.el.set_transient_for(_this.el);\n    cd.el.set_modal(true);\n\n     var project =   _this.windowstate.left_projects.getSelectedProject();\n    if (project == null) {\n        print(\"SKIP - no project\\n\");\n        return;\n    }\n    \n        \n     if (Gtk.ResponseType.YES != cd.show(\"Confirm\", \n        \"Are you sure you want to delete project %s\".printf(project.name))) {\n        return;\n    }\n     \n\n    // confirm?\n    Project.Project.remove(project);\n    _this.project = null;\n    \n    _this.windowstate.left_projects.is_loaded =  false;\n    _this.windowstate.left_projects.load();\n    _this.windowstate.clutterfiles.clearFiles();\n\n}"
481                    },
482                    "* pack" : false,
483                    "xtype" : "Button",
484                    "width_request" : 50,
485                    "$ xns" : "Gtk",
486                    "$ tooltip_text" : "\"Delelte Project\"",
487                    "height_request" : 50,
488                    "items" : [
489                     {
490                      "xtype" : "Image",
491                      "utf8 icon_name" : "user-trash",
492                      "* pack" : "set_image",
493                      "$ xns" : "Gtk"
494                     }
495                    ]
496                   }
497                  ]
498                 }
499                ]
500               },
501               {
502                "id" : "new_window",
503                "* init" : "this.el.set_size(50,50);",
504                "xtype" : "Actor",
505                "* pack" : "add_child",
506                "$ xns" : "Clutter",
507                "items" : [
508                 {
509                  "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
510                  "* pack" : "add_child",
511                  "xtype" : "Actor",
512                  "$ xns" : "GtkClutter",
513                  "items" : [
514                   {
515                    "listeners" : {
516                     "clicked" : "  ( ) => {\n        Xcls_MainWindow.singleton().no_windows++;\n        var w = new Xcls_MainWindow();\n        w.ref();\n\n        w.el.show_all();\n        w.initChildren();\n        w.windowstate.switchState(WindowState.State.FILES);\n}"
517                    },
518                    "utf8 tooltip_text" : "Open New Window",
519                    "* pack" : false,
520                    "xtype" : "Button",
521                    "width_request" : 50,
522                    "$ xns" : "Gtk",
523                    "height_request" : 50,
524                    "items" : [
525                     {
526                      "xtype" : "Image",
527                      "utf8 icon_name" : "window-new",
528                      "* pack" : "set_image",
529                      "$ xns" : "Gtk"
530                     }
531                    ]
532                   }
533                  ]
534                 }
535                ]
536               }
537              ]
538             }
539            ]
540           }
541          ]
542         }
543        ]
544       }
545      ]
546     }
547    ]
548   }
549  ]
550 }