resources/RooUsage.txt
[app.Builder.js] / src / Builder4 / WindowLeftProjects.bjs
1 {
2  "name" : "WindowLeftProjects",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/WindowLeftProjects.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "build_module" : "builder",
9  "items" : [
10   {
11    "listeners" : {
12     "show" : "  ( ) => {\n    this.load();\n}"
13    },
14    "@ void project_selected" : "(Project.Project project)",
15    "id" : "WindowLeftProjects",
16    "|  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 =  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",
17    "# bool is_loaded" : false,
18    "* pack" : "add",
19    "xtype" : "Box",
20    "|  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}",
21    "|  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",
22    "# bool is_loading" : false,
23    "$ xns" : "Gtk",
24    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
25    "$ homogeneous" : false,
26    "@ void show_new_project" : "()",
27    "items" : [
28     {
29      "* init" : "  this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n",
30      "$ shadow_type" : "Gtk.ShadowType.IN",
31      "* pack" : "pack_end,true,true,0",
32      "xtype" : "ScrolledWindow",
33      "$ xns" : "Gtk",
34      "items" : [
35       {
36        "listeners" : {
37         "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}  "
38        },
39        "id" : "view",
40        "* init" : "  var description = new Pango.FontDescription();\n     description.set_size(8000);\n    this.el.override_font(description);     \n                    \n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n \n\n    \n   \n ",
41        "xtype" : "TreeView",
42        "* pack" : "add",
43        "$ enable_tree_lines" : true,
44        "$ headers_visible" : true,
45        "$ xns" : "Gtk",
46        "items" : [
47         {
48          "id" : "model",
49          "* 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",
50          "* pack" : "set_model",
51          "xtype" : "ListStore",
52          "$ columns" : "typeof(string), typeof(Object)",
53          "n_columns" : 2,
54          "$ xns" : "Gtk"
55         },
56         {
57          "utf8 title" : "Projects",
58          "* init" : "\n    this.el.add_attribute(_this.namecol.el , \"markup\", 0  );\n ",
59          "* pack" : "append_column",
60          "xtype" : "TreeViewColumn",
61          "$ xns" : "Gtk",
62          "items" : [
63           {
64            "id" : "namecol",
65            "* pack" : "pack_start,true",
66            "xtype" : "CellRendererText",
67            "$ xns" : "Gtk"
68           }
69          ]
70         }
71        ]
72       }
73      ]
74     }
75    ]
76   }
77  ]
78 }