Builder4/ValaProjectSettings.bjs
[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    this.default_packages_tree_store.el.clear();\n    this.default_directory_tree_store.el.clear();    \n\n    this.default_directory_tree_store.load();    \n        \n    if (this.project.compilegroups.has_key(\"default\")) {\n        var def = this.project.compilegroups.get(\"default\");\n        this.compile_flags.el.text = def.compile_flags;\n        this.default_packages_tree_store.load(def.packages);\n\n    } else {\n        this.default_packages_tree_store.load(new Gee.ArrayList<string>());\n                 \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" : "(Gee.ArrayList<string> items) {\n \n\n\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    \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                                             "* pack" : "add",
140                                             "xtype" : "TreeView",
141                                             "string id" : "default_directory_tree",
142                                             "$ xns" : "Gtk",
143                                             "items" : [
144                                                 {
145                                                     "id" : "default_directory_tree_store",
146                                                     "* pack" : "set_model",
147                                                     "xtype" : "ListStore",
148                                                     "$ n_columns" : 2,
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),  // 0 key type\n     typeof(string) // ??\n     ",
151                                                     "$ xns" : "Gtk"
152                                                 },
153                                                 {
154                                                     "utf8 title" : "name",
155                                                     "* init" : " this.el.add_attribute(_this.directory_render.el , \"markup\", 2 );\n this.el.add_attribute(_this.directory_render.el , \"text\", 1 );\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       _this.project.compilegroups.get(\"_default_\").sources.add(chooser.get_uri ());\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                                         }
187                                     ]
188                                 }
189                             ]
190                         },
191                         {
192                             "gint position" : 300,
193                             "xtype" : "HPaned",
194                             "* pack" : "append_page,_this.label_targets.el",
195                             "$ xns" : "Gtk",
196                             "items" : [
197                                 {
198                                     "* init" : "{  \nthis.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n\n}\n",
199                                     "xtype" : "ScrolledWindow",
200                                     "* pack" : "add1",
201                                     "$ xns" : "Gtk",
202                                     "items" : [
203                                         {
204                                             "id" : "targets_tree",
205                                             "xtype" : "TreeView",
206                                             "$ xns" : "Gtk",
207                                             "items" : [
208                                                 {
209                                                     "* pack" : "set_model",
210                                                     "xtype" : "ListStore",
211                                                     "$ n_columns" : 2,
212                                                     "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
213                                                     "$ xns" : "Gtk"
214                                                 },
215                                                 {
216                                                     "utf8 title" : "name",
217                                                     "* init" : " this.el.add_attribute(_this.targets_render.el , \"markup\", 2 );\n this.el.add_attribute(_this.targets_render.el , \"text\", 1 );\n  ",
218                                                     "* pack" : "append_column",
219                                                     "xtype" : "TreeViewColumn",
220                                                     "gboolean resizable" : true,
221                                                     "$ xns" : "Gtk",
222                                                     "items" : [
223                                                         {
224                                                             "id" : "targets_render",
225                                                             "xtype" : "CellRendererText",
226                                                             "* pack" : "pack_start,false",
227                                                             "$ xns" : "Gtk"
228                                                         }
229                                                     ]
230                                                 }
231                                             ]
232                                         }
233                                     ]
234                                 },
235                                 {
236                                     "xtype" : "VBox",
237                                     "* pack" : "add2",
238                                     "string id" : "set_vbox",
239                                     "gboolean homogeneous" : false,
240                                     "$ xns" : "Gtk",
241                                     "items" : [
242                                         {
243                                             "xtype" : "Label",
244                                             "* pack" : "pack_start,false,false,0",
245                                             "$ xns" : "Gtk",
246                                             "utf8 label" : "target filename"
247                                         },
248                                         {
249                                             "xtype" : "Entry",
250                                             "* pack" : "pack_start,false,false,0",
251                                             "string id" : "build_pack_target",
252                                             "$ xns" : "Gtk"
253                                         },
254                                         {
255                                             "xtype" : "Label",
256                                             "* pack" : "pack_start,false,false,0",
257                                             "$ xns" : "Gtk",
258                                             "utf8 label" : "compile flags"
259                                         },
260                                         {
261                                             "xtype" : "Entry",
262                                             "* pack" : "pack_start,false,false,0",
263                                             "string id" : "build_compile_flags",
264                                             "$ xns" : "Gtk"
265                                         },
266                                         {
267                                             "xtype" : "Label",
268                                             "* pack" : "pack_start,false,false,0",
269                                             "$ xns" : "Gtk",
270                                             "utf8 label" : "Files to compile"
271                                         },
272                                         {
273                                             "* pack" : "pack_start,true,true,0",
274                                             "xtype" : "ScrolledWindow",
275                                             "$ xns" : "Gtk",
276                                             "items" : [
277                                                 {
278                                                     "xtype" : "TreeView",
279                                                     "string id" : "files_tree",
280                                                     "$ xns" : "Gtk",
281                                                     "items" : [
282                                                         {
283                                                             "* pack" : "set_model",
284                                                             "xtype" : "ListStore",
285                                                             "$ n_columns" : 2,
286                                                             "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
287                                                             "$ xns" : "Gtk"
288                                                         },
289                                                         {
290                                                             "utf8 title" : "name",
291                                                             "* init" : " this.el.add_attribute(_this.files_render.el , \"markup\", 2 );\n this.el.add_attribute(_this.files_render.el , \"text\", 1 );\n  ",
292                                                             "* pack" : "append_column",
293                                                             "xtype" : "TreeViewColumn",
294                                                             "gboolean resizable" : true,
295                                                             "$ xns" : "Gtk",
296                                                             "items" : [
297                                                                 {
298                                                                     "id" : "files_render",
299                                                                     "* pack" : "pack_start,false",
300                                                                     "xtype" : "CellRendererText",
301                                                                     "$ xns" : "Gtk"
302                                                                 }
303                                                             ]
304                                                         }
305                                                     ]
306                                                 }
307                                             ]
308                                         }
309                                     ]
310                                 }
311                             ]
312                         }
313                     ]
314                 }
315             ]
316         }
317     ]
318 }