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