JsRender/Gtk.vala.c
[app.Builder.js] / Builder4 / ValaProjectSettings.bjs
1 {
2     "name" : "ValaProjectSettings",
3     "parent" : "",
4     "title" : "",
5     "path" : "/home/alan/gitlive/app.Builder.js/Builder4/ValaProjectSettings.bjs",
6     "permname" : "",
7     "modOrder" : "",
8     "items" : [
9         {
10             "# Project.Gtk project" : "null",
11             "# Xcls_MainWindow window" : "null",
12             "| void show" : "(Project.Gtk project) {\n    \n    \n    print(\"ValaProjectSettings show\\n\");\n    \n    this.project=  project;\n\n    this.compile_flags.el.text = \"\";\n    \n    this.default_directory_tree_store.load();    \n    this.default_packages_tree_store.load();            \n     \n\n\n}\n",
13             "xtype" : "VBox",
14             "string id" : "ValaProjectSettings",
15             "$ xns" : "Gtk",
16             "items" : [
17                 {
18                     "* pack" : "pack_start,true,true,0",
19                     "xtype" : "Notebook",
20                     "$ xns" : "Gtk",
21                     "items" : [
22                         {
23                             "id" : "label_global",
24                             "xtype" : "Label",
25                             "* pack" : false,
26                             "$ xns" : "Gtk",
27                             "utf8 label" : "Global"
28                         },
29                         {
30                             "id" : "label_targets",
31                             "* pack" : false,
32                             "xtype" : "Label",
33                             "$ xns" : "Gtk",
34                             "utf8 label" : "Targets"
35                         },
36                         {
37                             "xtype" : "VBox",
38                             "* pack" : "append_page,_this.label_global.el",
39                             "gboolean homogeneous" : false,
40                             "$ xns" : "Gtk",
41                             "items" : [
42                                 {
43                                     "xtype" : "Label",
44                                     "* pack" : "pack_start,false,false,0",
45                                     "$ xns" : "Gtk",
46                                     "utf8 label" : "compile flags"
47                                 },
48                                 {
49                                     "id" : "compile_flags",
50                                     "xtype" : "Entry",
51                                     "* pack" : "pack_start,false,false,0",
52                                     "$ xns" : "Gtk"
53                                 },
54                                 {
55                                     "xtype" : "Label",
56                                     "* pack" : "pack_start,false,false,0",
57                                     "$ xns" : "Gtk",
58                                     "utf8 label" : "packages"
59                                 },
60                                 {
61                                     "* pack" : "pack_start,true,true,0",
62                                     "xtype" : "ScrolledWindow",
63                                     "$ xns" : "Gtk",
64                                     "items" : [
65                                         {
66                                             "gboolean headers_visible" : false,
67                                             "* pack" : "add",
68                                             "xtype" : "TreeView",
69                                             "string id" : "default_packages_tree",
70                                             "$ xns" : "Gtk",
71                                             "items" : [
72                                                 {
73                                                     "id" : "default_packages_tree_store",
74                                                     "* pack" : "set_model",
75                                                     "xtype" : "ListStore",
76                                                     "$ n_columns" : 2,
77                                                     "| void load" : "() {\n \n    var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.packages;\n    \n    this.el.clear();\n    var pal = (Palete.Gtk) Palete.factory(\"Gtk\");\n    var pkgs = pal.packages();\n    print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < pkgs.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   pkgs.get(i) ); // title \n        this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
78                                                     "$ columns" : "    typeof(string),  // 0 key type\n      typeof(bool)",
79                                                     "$ xns" : "Gtk"
80                                                 },
81                                                 {
82                                                     "utf8 title" : "name",
83                                                     "* init" : " \n this.el.add_attribute(_this.packages_render.el , \"text\", 0 );\n  ",
84                                                     "* pack" : "append_column",
85                                                     "xtype" : "TreeViewColumn",
86                                                     "gboolean resizable" : true,
87                                                     "gboolean expand" : true,
88                                                     "$ xns" : "Gtk",
89                                                     "items" : [
90                                                         {
91                                                             "id" : "packages_render",
92                                                             "* pack" : "pack_start,false",
93                                                             "xtype" : "CellRendererText",
94                                                             "$ xns" : "Gtk"
95                                                         }
96                                                     ]
97                                                 },
98                                                 {
99                                                     "utf8 title" : "use",
100                                                     "* init" : "{\n this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );\n }",
101                                                     "* pack" : "append_column",
102                                                     "xtype" : "TreeViewColumn",
103                                                     "gboolean resizable" : false,
104                                                     "$ xns" : "Gtk",
105                                                     "gint fixed_width" : 50,
106                                                     "items" : [
107                                                         {
108                                                             "listeners" : {
109                                                                 "toggled" : "(  path_string) =>  { \n    var m = _this.default_packages_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 1, out val);\n   m.set_value(iter, 1,  ((bool) val) ? false :true); \n     GLib.Value fval;  \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    if ((bool)val) {\n        // renive\n        items.remove(fn);\n    } else {\n        items.add(fn);\n    }\n    \n}"
110                                                             },
111                                                             "id" : "packages_render_use",
112                                                             "* pack" : "pack_start,false",
113                                                             "xtype" : "CellRendererToggle",
114                                                             "$ xns" : "Gtk",
115                                                             "gboolean activatable" : true
116                                                         }
117                                                     ]
118                                                 }
119                                             ]
120                                         }
121                                     ]
122                                 },
123                                 {
124                                     "xtype" : "Label",
125                                     "* pack" : "pack_start,false,false,0",
126                                     "$ xns" : "Gtk",
127                                     "utf8 label" : "Available Directories"
128                                 },
129                                 {
130                                     "* pack" : "pack_start,true,true,0",
131                                     "xtype" : "ScrolledWindow",
132                                     "$ xns" : "Gtk",
133                                     "items" : [
134                                         {
135                                             "listeners" : {
136                                                 "button_press_event" : " ( ev) => {\n    //console.log(\"button press?\");\n   \n    \n    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {\n        //print(\"click\" + ev.type);\n        return false;\n    }\n    //Gtk.TreePath res;\n    //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n    //    return true;\n    //}\n     \n  //  this.el.get_selection().select_path(res);\n     \n      //if (!this.get('/LeftTreeMenu').el)  { \n      //      this.get('/LeftTreeMenu').init(); \n      //  }\n        \n     _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());\n     _this.default_directory_menu.el.show_all();\n      _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}"
137                                             },
138                                             "gboolean headers_visible" : false,
139                                             "id" : "default_directory_tree",
140                                             "* pack" : "add",
141                                             "xtype" : "TreeView",
142                                             "$ xns" : "Gtk",
143                                             "items" : [
144                                                 {
145                                                     "id" : "default_directory_tree_store",
146                                                     "* pack" : "set_model",
147                                                     "xtype" : "ListStore",
148                                                     "$ n_columns" : 1,
149                                                     "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
150                                                     "$ columns" : "    typeof(string)\n     ",
151                                                     "$ xns" : "Gtk"
152                                                 },
153                                                 {
154                                                     "utf8 title" : "name",
155                                                     "* init" : "\n this.el.add_attribute(_this.directory_render.el , \"text\", 0 );\n  ",
156                                                     "* pack" : "append_column",
157                                                     "xtype" : "TreeViewColumn",
158                                                     "gboolean resizable" : true,
159                                                     "$ xns" : "Gtk",
160                                                     "items" : [
161                                                         {
162                                                             "id" : "directory_render",
163                                                             "* pack" : "pack_start,false",
164                                                             "xtype" : "CellRendererText",
165                                                             "$ xns" : "Gtk"
166                                                         }
167                                                     ]
168                                                 }
169                                             ]
170                                         },
171                                         {
172                                             "id" : "default_directory_menu",
173                                             "xtype" : "Menu",
174                                             "$ xns" : "Gtk",
175                                             "items" : [
176                                                 {
177                                                     "listeners" : {
178                                                         "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
179                                                     },
180                                                     "* pack" : "add",
181                                                     "xtype" : "MenuItem",
182                                                     "$ xns" : "Gtk",
183                                                     "utf8 label" : "Add Directory"
184                                                 },
185                                                 {
186                                                     "listeners" : {
187                                                         "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
188                                                     },
189                                                     "* pack" : "add",
190                                                     "xtype" : "MenuItem",
191                                                     "$ xns" : "Gtk",
192                                                     "utf8 label" : "Add File"
193                                                 },
194                                                 {
195                                                     "* pack" : "add",
196                                                     "xtype" : "SeparatorMenuItem",
197                                                     "$ xns" : "Gtk"
198                                                 },
199                                                 {
200                                                     "listeners" : {
201                                                         "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {\n                  print(\"remove failed\");\n              }\n       _this.default_directory_tree_store.load();\n}"
202                                                     },
203                                                     "* pack" : "add",
204                                                     "xtype" : "MenuItem",
205                                                     "$ xns" : "Gtk",
206                                                     "utf8 label" : "Remove File/Directory"
207                                                 }
208                                             ]
209                                         }
210                                     ]
211                                 }
212                             ]
213                         },
214                         {
215                             "gint position" : 300,
216                             "xtype" : "HPaned",
217                             "* pack" : "append_page,_this.label_targets.el",
218                             "$ xns" : "Gtk",
219                             "items" : [
220                                 {
221                                     "* init" : "{  \nthis.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n\n}\n",
222                                     "xtype" : "ScrolledWindow",
223                                     "* pack" : "add1",
224                                     "$ xns" : "Gtk",
225                                     "items" : [
226                                         {
227                                             "id" : "targets_tree",
228                                             "xtype" : "TreeView",
229                                             "$ xns" : "Gtk",
230                                             "items" : [
231                                                 {
232                                                     "* pack" : "set_model",
233                                                     "xtype" : "ListStore",
234                                                     "$ n_columns" : 2,
235                                                     "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
236                                                     "$ xns" : "Gtk"
237                                                 },
238                                                 {
239                                                     "utf8 title" : "name",
240                                                     "* init" : " this.el.add_attribute(_this.targets_render.el , \"markup\", 2 );\n this.el.add_attribute(_this.targets_render.el , \"text\", 1 );\n  ",
241                                                     "* pack" : "append_column",
242                                                     "xtype" : "TreeViewColumn",
243                                                     "gboolean resizable" : true,
244                                                     "$ xns" : "Gtk",
245                                                     "items" : [
246                                                         {
247                                                             "id" : "targets_render",
248                                                             "xtype" : "CellRendererText",
249                                                             "* pack" : "pack_start,false",
250                                                             "$ xns" : "Gtk"
251                                                         }
252                                                     ]
253                                                 }
254                                             ]
255                                         }
256                                     ]
257                                 },
258                                 {
259                                     "xtype" : "VBox",
260                                     "* pack" : "add2",
261                                     "string id" : "set_vbox",
262                                     "gboolean homogeneous" : false,
263                                     "$ xns" : "Gtk",
264                                     "items" : [
265                                         {
266                                             "xtype" : "Label",
267                                             "* pack" : "pack_start,false,false,0",
268                                             "$ xns" : "Gtk",
269                                             "utf8 label" : "target filename"
270                                         },
271                                         {
272                                             "xtype" : "Entry",
273                                             "* pack" : "pack_start,false,false,0",
274                                             "string id" : "build_pack_target",
275                                             "$ xns" : "Gtk"
276                                         },
277                                         {
278                                             "xtype" : "Label",
279                                             "* pack" : "pack_start,false,false,0",
280                                             "$ xns" : "Gtk",
281                                             "utf8 label" : "compile flags"
282                                         },
283                                         {
284                                             "xtype" : "Entry",
285                                             "* pack" : "pack_start,false,false,0",
286                                             "string id" : "build_compile_flags",
287                                             "$ xns" : "Gtk"
288                                         },
289                                         {
290                                             "xtype" : "Label",
291                                             "* pack" : "pack_start,false,false,0",
292                                             "$ xns" : "Gtk",
293                                             "utf8 label" : "Files to compile"
294                                         },
295                                         {
296                                             "* pack" : "pack_start,true,true,0",
297                                             "xtype" : "ScrolledWindow",
298                                             "$ xns" : "Gtk",
299                                             "items" : [
300                                                 {
301                                                     "xtype" : "TreeView",
302                                                     "string id" : "files_tree",
303                                                     "$ xns" : "Gtk",
304                                                     "items" : [
305                                                         {
306                                                             "* pack" : "set_model",
307                                                             "xtype" : "ListStore",
308                                                             "$ n_columns" : 2,
309                                                             "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
310                                                             "$ xns" : "Gtk"
311                                                         },
312                                                         {
313                                                             "utf8 title" : "name",
314                                                             "* init" : " this.el.add_attribute(_this.files_render.el , \"markup\", 2 );\n this.el.add_attribute(_this.files_render.el , \"text\", 1 );\n  ",
315                                                             "* pack" : "append_column",
316                                                             "xtype" : "TreeViewColumn",
317                                                             "gboolean resizable" : true,
318                                                             "$ xns" : "Gtk",
319                                                             "items" : [
320                                                                 {
321                                                                     "id" : "files_render",
322                                                                     "* pack" : "pack_start,false",
323                                                                     "xtype" : "CellRendererText",
324                                                                     "$ xns" : "Gtk"
325                                                                 }
326                                                             ]
327                                                         }
328                                                     ]
329                                                 }
330                                             ]
331                                         }
332                                     ]
333                                 }
334                             ]
335                         }
336                     ]
337                 }
338             ]
339         }
340     ]
341 }