Attribute changed old-javascript
[app.Builder.js] / old-javascript / Builder4 / WindowLeftProjects.bjs
1 {
2     "name" : "WindowLeftProjects",
3     "parent" : "",
4     "title" : "",
5     "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowLeftProjects.bjs",
6     "permname" : "",
7     "modOrder" : "",
8     "items" : [
9         {
10             "listeners" : {
11                 "show" : "  ( ) => {\n    this.load();\n}"
12             },
13             "@ void project_selected" : "(Project.Project project)",
14             "id" : "WindowLeftProjects",
15             "|  void load" : "() {\n     // clear list...\n    \n     if (_this.is_loaded) {\n         return;\n     }\n     _this.is_loading = true;\n        \n     _this.is_loaded = true;\n     \n     Project.Project.loadAll();\n     var projects = Project.Project.allProjectsByName();\n     \n     Gtk.TreeIter iter;\n     var m = this.model.el;\n     m.clear();\n          \n     for (var i = 0; i < projects.size; i++) {\n        m.append(out iter);\n        m.set(iter,   0,projects.get(i).name );\n        \n        var o = new GLib.Value(typeof(Object));\n        o.set_object((Object)projects.get(i));\n                   \n        m.set_value(iter, 1, o);\n     \n     }\n     m.set_sort_column_id(0, Gtk.SortType.ASCENDING);\n     _this.is_loading = false;     \n}\n",
16             "# bool is_loaded" : false,
17             "* pack" : "add",
18             "xtype" : "VBox",
19             "|  Project.Project? getSelectedProject" : "() {    \n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n            \n    var s = this.view.el.get_selection();\n    if (!s.get_selected(out mod, out iter)) {\n        return null;\n    }\n    \n    GLib.Value gval;\n\n    mod.get_value(iter, 1 , out gval);\n    var project = (Project.Project)gval.get_object();\n    \n    return project;\n}",
20             "|  void selectProject" : "(Project.Project project) {\n    \n    var sel = _this.view.el.get_selection();\n    \n    sel.unselect_all();\n    \n    var found = false;\n    _this.model.el.foreach((mod, path, iter) => {\n        GLib.Value val;\n    \n        mod.get_value(iter, 1, out val);\n        if ( ( (Project.Project)val.get_object()).fn != project.fn) {\n            print(\"SKIP %s != %s\\n\", ((Project.Project)val.get_object()).name , project.name);\n            return false;//continue\n        }\n        sel.select_iter(iter);\n        this.project_selected(project);\n        found = true;\n        return true;\n        \n    \n    });\n     if (!found) {\n\t    print(\"tried to select %s, could not find it\", project.name);\n    }\n}\n",
21             "# bool is_loading" : false,
22             "$ xns" : "Gtk",
23             "$ homogeneous" : false,
24             "@ void show_new_project" : "()",
25             "items" : [
26                 {
27                     "* init" : "  this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n",
28                     "$ shadow_type" : "Gtk.ShadowType.IN",
29                     "* pack" : "pack_end,true,true,0",
30                     "xtype" : "ScrolledWindow",
31                     "$ xns" : "Gtk",
32                     "items" : [
33                         {
34                             "listeners" : {
35                                 "cursor_changed" : " () => {\n    if (_this.is_loading) {\n        return;\n    }\n    \n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n            \n    var s = this.el.get_selection();\n    if (!s.get_selected(out mod, out iter)) {\n        return;\n    }\n    \n    GLib.Value gval;\n\n    mod.get_value(iter, 1 , out gval);\n    var project = (Project.Project)gval.get_object();\n    \n    _this.project_selected(project);\n    \n}"
36                             },
37                             "id" : "view",
38                             "* init" : "  var description = new Pango.FontDescription();\n     description.set_size(8000);\n    this.el.modify_font(description);     \n                    \n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n \n\n    \n  \n",
39                             "xtype" : "TreeView",
40                             "* pack" : "add",
41                             "$ enable_tree_lines" : true,
42                             "$ headers_visible" : false,
43                             "$ xns" : "Gtk",
44                             "items" : [
45                                 {
46                                     "id" : "model",
47                                     "* init" : "{\n   this.el.set_sort_func(0, (mod,a,b) => {\n       GLib.Value ga, gb;\n       mod.get_value(a,0, out ga);\n       mod.get_value(b,0, out gb);\n        \n        if ((string)ga == (string)gb) {\n            return 0;\n        }\n        return (string)ga > (string)gb ? 1 : -1;\n   }); \n\n\n}\n",
48                                     "* pack" : "set_model",
49                                     "xtype" : "ListStore",
50                                     "$ columns" : "typeof(string), typeof(Object)",
51                                     "n_columns" : 2,
52                                     "$ xns" : "Gtk"
53                                 },
54                                 {
55                                     "* init" : "\n    this.el.add_attribute(_this.namecol.el , \"markup\", 0  );\n ",
56                                     "xtype" : "TreeViewColumn",
57                                     "* pack" : "append_column",
58                                     "$ xns" : "Gtk",
59                                     "items" : [
60                                         {
61                                             "id" : "namecol",
62                                             "* pack" : "pack_start,true",
63                                             "xtype" : "CellRendererText",
64                                             "$ xns" : "Gtk"
65                                         }
66                                     ]
67                                 }
68                             ]
69                         }
70                     ]
71                 }
72             ]
73         }
74     ]
75 }