2 "build_module" : "builder",
6 "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
7 "Project.Gtk project" : "null",
8 "Xcls_MainWindow window" : "null",
15 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
16 "bool hexpand" : true,
17 "bool vexpand" : true,
22 "string title" : "Change Vala Project Compile settings",
27 "* pack" : "pack_start,true,true,0",
32 "id" : "label_global",
33 "utf8 label" : "Global",
39 "id" : "label_targets",
40 "utf8 label" : "Targets",
45 "* pack" : "append_page,_this.label_global.el",
46 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
47 "gboolean homogeneous" : false,
51 "* pack" : "pack_start,false,false,0",
52 "utf8 label" : "compile flags",
57 "* pack" : "pack_start,false,false,0",
58 "id" : "compile_flags",
63 " _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;",
64 " _this.project.writeConfig();",
65 "// _this.project.save();",
70 "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR ",
75 "* pack" : "pack_start,true,true,0",
76 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
82 "bool hexpand" : true,
87 "gboolean headers_visible" : true,
91 " typeof(string), // 0 key type",
96 "* pack" : "set_model",
97 "id" : "default_packages_tree_store",
98 "xtype" : "ListStore",
102 " var def = _this.project.compilegroups.get(\"_default_\");",
103 " var items = def.packages;",
106 " var pal = (Palete.Gtk) _this.project.palete;",
107 " var pkgs = pal.packages(_this.project);",
108 " print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);",
110 " Gtk.TreeIter citer;",
112 " for(var i =0 ; i < pkgs.size; i++) {",
113 " this.el.append(out citer); ",
115 " this.el.set_value(citer, 0, pkgs.get(i) ); // title ",
116 " this.el.set_value(citer, 1, items.contains(pkgs.get(i)) );",
118 " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
128 " this.el.add_attribute(_this.packages_render.el , \"text\", 0 );",
131 "* pack" : "append_column",
132 "gboolean expand" : true,
133 "gboolean resizable" : true,
137 "* pack" : "pack_start,false",
138 "id" : "packages_render",
139 "xtype" : "CellRendererText"
142 "utf8 title" : "package name",
143 "xtype" : "TreeViewColumn"
149 " this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );",
152 "* pack" : "append_column",
153 "gboolean resizable" : false,
154 "gint fixed_width" : 50,
158 "* pack" : "pack_start,false",
159 "gboolean activatable" : true,
160 "id" : "packages_render_use",
163 "( path_string) => { ",
164 " var m = _this.default_packages_tree_store.el;",
165 " Gtk.TreeIter iter;",
166 " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
167 " m.get_iter (out iter, path);",
169 " m.get_value(iter, 1, out val);",
170 " m.set_value(iter, 1, ((bool) val) ? false :true); ",
171 " GLib.Value fval; ",
172 " m.get_value(iter, 0, out fval);",
173 " var fn = (string)fval;",
175 " var def = _this.project.compilegroups.get(\"_default_\");",
176 " var items = def.packages;",
179 " items.remove(fn);",
187 "xtype" : "CellRendererToggle"
190 "utf8 title" : "use",
191 "xtype" : "TreeViewColumn"
194 "string id" : "default_packages_tree",
198 "xtype" : "ScrolledWindow"
203 "bool hexpand" : true,
208 "gboolean headers_visible" : true,
209 "id" : "default_directory_tree",
218 "* pack" : "set_model",
219 "id" : "default_directory_tree_store",
220 "xtype" : "ListStore",
227 " var def = _this.project.compilegroups.get(\"_default_\");",
228 " var items = def.sources;",
231 " Gtk.TreeIter citer;",
233 " for(var i =0 ; i < items.size; i++) {",
234 " this.el.append(out citer); ",
236 " this.el.set_value(citer, 0, items.get(i) ); // title ",
237 " //this.el.set_value(citer, 1, items.get(i) );",
239 " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
249 " this.el.add_attribute(_this.directory_render.el , \"text\", 0 );",
252 "* pack" : "append_column",
253 "gboolean resizable" : true,
257 "* pack" : "pack_start,false",
258 "id" : "directory_render",
259 "xtype" : "CellRendererText"
262 "utf8 title" : "Available Directories (right click to add)",
263 "xtype" : "TreeViewColumn"
267 "button_press_event" : [
269 " //console.log(\"button press?\");",
272 " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
273 " //print(\"click\" + ev.type);",
276 " //Gtk.TreePath res;",
277 " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
281 " // this.el.get_selection().select_path(res);",
283 " //if (!this.get('/LeftTreeMenu').el) { ",
284 " // this.get('/LeftTreeMenu').init(); ",
287 " _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());",
288 " _this.default_directory_menu.el.show_all();",
289 " _this.default_directory_menu.el.popup(null, null, null, 3, ev.time);",
290 " // print(\"click:\" + res.path.to_string());",
299 "id" : "default_directory_menu",
308 " var chooser = new Gtk.FileChooserDialog (",
309 "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,",
311 "\tGtk.ResponseType.CANCEL,",
313 "\tGtk.ResponseType.ACCEPT);",
314 " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
315 " chooser.close ();",
318 " chooser.close ();",
319 " // add the directory..",
320 " var fn = _this.project.relPath(chooser.get_filename());",
321 " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
322 " _this.default_directory_tree_store.load();",
326 "utf8 label" : "Add Directory",
336 " var chooser = new Gtk.FileChooserDialog (",
337 "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,",
339 "\tGtk.ResponseType.CANCEL,",
341 "\tGtk.ResponseType.ACCEPT);",
342 " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
343 " chooser.close ();",
346 " chooser.close ();",
347 " // add the directory..",
348 " var fn = _this.project.relPath(chooser.get_filename());",
349 " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
350 " _this.default_directory_tree_store.load();",
354 "utf8 label" : "Add File",
360 "xtype" : "SeparatorMenuItem"
370 " Gtk.TreeModel mod;",
371 " Gtk.TreeIter iter;",
372 " if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {",
373 " print(\"nothing selected\\n\");",
378 " // add the directory..",
382 " mod.get_value(iter,0, out val);",
383 " var fn = (string) val;",
385 " print(\"remove: %s\\n\", fn);",
386 " if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {",
387 " print(\"remove failed\");",
389 " _this.default_directory_tree_store.load();",
393 "utf8 label" : "Remove File/Directory",
400 "xtype" : "ScrolledWindow"
410 "* pack" : "append_page,_this.label_targets.el",
411 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
412 "gint position" : 300,
418 "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
428 "id" : "targets_tree_menu",
437 " if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {",
441 " // add the directory..",
443 " _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));",
444 " _this.targets_tree_store.load();",
448 "utf8 label" : "Add Compile Target",
454 "xtype" : "SeparatorMenuItem"
464 " Gtk.TreeModel mod;",
465 " Gtk.TreeIter iter;",
466 " if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {",
467 " print(\"nothing selected\\n\");",
472 " // add the directory..",
476 " mod.get_value(iter,0, out val);",
477 " var fn = (string) val;",
479 " print(\"remove: %s\\n\", fn);",
480 " if (!_this.project.compilegroups.unset(fn)) {",
481 " print(\"remove failed\");",
483 " _this.targets_tree_store.load();",
487 "utf8 label" : "Remove Target",
494 "# string cursor" : "",
497 "id" : "targets_tree",
501 " typeof(string), // 0 key type",
502 " typeof(string) // ??",
507 "* pack" : "set_model",
508 "id" : "targets_tree_store",
509 "xtype" : "ListStore",
516 " var cg = _this.project.compilegroups;",
518 " _this.targets_tree.cursor = \"\";",
519 " Gtk.TreeIter citer;",
520 " var iter = cg.map_iterator();",
521 " while(iter.next()) {",
522 " var key = iter.get_key();",
523 " if (key == \"_default_\") {",
527 " this.el.append(out citer); ",
529 " this.el.set_value(citer, 0, key ); // title ",
530 " //this.el.set_value(citer, 1, items.get(i) );",
532 " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
533 " _this.set_vbox.el.hide();",
542 " this.el.add_attribute(_this.targets_render.el , \"text\", 0 );",
545 "* pack" : "append_column",
546 "gboolean resizable" : true,
550 "* pack" : "pack_start,false",
551 "gboolean editable" : true,
552 "id" : "targets_render",
555 " (path, newtext) => {",
557 " Gtk.TreeIter iter;",
558 " _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
560 " _this.targets_tree_store.el.get_value(iter,0, out gval);",
561 " var oldval = (string)gval;",
562 " if (oldval == newtext) {",
565 " var cg = _this.project.compilegroups.get(oldval);",
566 " cg.name = newtext;",
567 " _this.project.compilegroups.unset(oldval);",
568 " _this.project.compilegroups.set(newtext, cg);",
569 " _this.targets_tree_store.load();",
573 "xtype" : "CellRendererText"
576 "utf8 title" : "name",
577 "xtype" : "TreeViewColumn"
581 "button_press_event" : [
583 " //console.log(\"button press?\");",
586 " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
587 " //print(\"click\" + ev.type);",
590 " //Gtk.TreePath res;",
591 " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
595 " // this.el.get_selection().select_path(res);",
597 " //if (!this.get('/LeftTreeMenu').el) { ",
598 " // this.get('/LeftTreeMenu').init(); ",
601 " _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());",
602 " _this.targets_tree_menu.el.show_all();",
603 " _this.targets_tree_menu.el.popup(null, null, null, 3, ev.time);",
604 " // print(\"click:\" + res.path.to_string());",
611 " if (this.cursor != \"\") {",
612 " // save the values..",
615 " // load the new values.",
618 " Gtk.TreeModel mod;",
619 " Gtk.TreeIter iter;",
620 " if (!this.el.get_selection().get_selected(out mod, out iter)) {",
621 " print(\"nothing selected\\n\");",
622 " // should disable the right hand side..",
623 " _this.set_vbox.el.hide();",
626 " _this.set_vbox.el.show();",
628 " // add the directory..",
632 " mod.get_value(iter,0, out val);",
633 " var fn = (string) val;",
635 " this.cursor = fn;",
636 " var cg = _this.project.compilegroups.get(fn);",
638 " _this.build_pack_target.el.set_text(cg.target_bin);",
639 " _this.build_compile_flags.el.set_text(cg.compile_flags);",
640 "\t\t_this.build_execute_args.el.set_text(cg.execute_args);",
642 " _this.set_vbox.cgroup = cg;",
643 " _this.files_tree_store.update();",
645 " // load the srouces",
654 "xtype" : "ScrolledWindow"
657 "# Project.GtkValaSettings cgroup" : "null",
660 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
661 "gboolean homogeneous" : false,
666 "* pack" : "pack_start,false,false,0",
667 "utf8 label" : "target filename",
672 "* pack" : "pack_start,false,false,0",
673 "id" : "build_pack_target",
677 " if (_this.targets_tree.cursor.length < 1) {",
680 " _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;",
688 "* pack" : "pack_start,false,false,0",
689 "utf8 label" : "compile flags",
694 "* pack" : "pack_start,false,false,0",
695 "id" : "build_compile_flags",
699 " if (_this.targets_tree.cursor.length < 1) {",
702 " _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;",
710 "* pack" : "pack_start,false,false,0",
711 "utf8 label" : "test argments - when run after a build",
716 "* pack" : "pack_start,false,false,0",
717 "id" : "build_execute_args",
721 " if (_this.targets_tree.cursor.length < 1) {",
724 " _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;",
728 "string placeholder_text" : "eg. -f somefile -g ",
733 "* pack" : "pack_start,false,false,0",
734 "utf8 label" : "Files to compile",
739 "* pack" : "pack_start,true,true,0",
747 " typeof(string), // 0 file name",
748 " typeof(string), // 0 basename",
749 " typeof(string), // type (dir orfile)",
750 " typeof(bool) // is checked.",
755 "* pack" : "set_model",
756 "id" : "files_tree_store",
757 "xtype" : "ListStore",
764 " var def = _this.project.compilegroups.get(\"_default_\");",
765 " var items = def.sources;",
771 " Gtk.TreeIter citer;",
773 " for(var i =0 ; i < items.size; i++) {",
775 " var files = _this.project.filesForCompile(items.get(i), false);",
776 " if (files.size < 1) {",
780 " this.el.append(out citer); ",
782 " this.el.set_value(citer, 0, items.get(i) ); // title ",
783 " this.el.set_value(citer, 1, \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + ",
784 " GLib.Markup.escape_text(items.get(i)) + \"</span>\"",
786 " print(\"ADD item %s\", items.get(i));",
787 " this.el.set_value(citer, 2, \"dir\"); // type ",
788 " this.el.set_value(citer, 3, false ); // checked ",
792 " for(var j =0 ; j < files.size; j++) {",
793 " this.el.append(out citer); ",
794 " print(\"ADD item %s\", files.get(j));",
795 " this.el.set_value(citer, 0, files.get(j) ); // title ",
796 " this.el.set_value(citer, 1, GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title ",
797 " this.el.set_value(citer, 2, \"file\"); // type ",
798 " this.el.set_value(citer, 3, false ); // checked ",
803 " //this.el.set_value(citer, 1, items.get(i) );",
805 " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
806 " if (_this.set_vbox.cgroup == null) {",
807 "\t\t_this.set_vbox.el.set_sensitive(false);",
817 " Gtk.TreeIter citer;",
819 " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
820 " this.el.iter_nth_child(out citer,null,i);",
823 " this.el.get_value(citer,0, out val);",
824 " var fn = (string) val;",
826 " var active = false;",
827 " if (_this.set_vbox.cgroup.sources.contains(fn)) {",
831 " this.el.set_value(citer, 3, active ); // checked ",
834 " _this.set_vbox.el.set_sensitive(true);",
838 "| void updateDir" : [
839 "(string dname, bool bval) {",
841 " Gtk.TreeIter citer;",
843 " var cg = _this.set_vbox.cgroup;",
844 " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
845 " this.el.iter_nth_child(out citer,null,i);",
848 " this.el.get_value(citer,0, out val);",
849 " var fn = (string) val;",
851 " if ( Path.get_dirname (fn) == dname) {",
853 " this.el.set_value(citer, 3, bval ); // checked ",
859 " if (cg.sources.contains(fn)) {",
860 " cg.sources.remove(fn);",
863 " if (!cg.sources.contains(fn)) {",
864 " cg.sources.add(fn);",
880 " this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae",
882 "/* this.el.add_attribute(_this.files_render.el , \"markup\", 2 );",
885 "* pack" : "append_column",
886 "gboolean resizable" : true,
890 "* pack" : "pack_start,false",
891 "id" : "files_render",
892 "xtype" : "CellRendererText"
895 "utf8 title" : "name",
896 "xtype" : "TreeViewColumn"
902 " this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );",
905 "* pack" : "append_column",
906 "gboolean resizable" : false,
907 "gint fixed_width" : 50,
911 "* pack" : "pack_start,false",
912 "gboolean activatable" : true,
913 "id" : "files_render_use",
916 "( path_string) => { ",
920 " var m = _this.files_tree_store.el;",
921 " Gtk.TreeIter iter;",
922 " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
923 " m.get_iter (out iter, path);",
925 " m.get_value(iter, 3, out val);",
926 " m.set_value(iter, 3, ((bool) val) ? false :true); ",
929 " GLib.Value ftval; ",
930 " m.get_value(iter, 2, out ftval);",
931 " var ftype = (string)ftval; ",
934 " GLib.Value fval; ",
935 " m.get_value(iter, 0, out fval);",
936 " var fn = (string)fval;",
939 " var cg = _this.set_vbox.cgroup;",
940 " // what's the sleected target?",
941 " // update the list..",
942 " // if ftype is a dir == then toggle all the bellow.",
944 " if (ftype == \"dir\") {",
945 " _this.files_tree_store.updateDir(fn, ((bool) val) ? false :true);",
948 " // if ftype is a file .. see if all the files in that directory are check and check the dir.",
953 " cg.sources.remove(fn);",
955 " cg.sources.add(fn);",
961 "xtype" : "CellRendererToggle"
964 "utf8 title" : "use",
965 "xtype" : "TreeViewColumn"
968 "string id" : "files_tree",
972 "xtype" : "ScrolledWindow"
986 "int margin_bottom" : 4,
987 "int margin_left" : 4,
988 "int margin_right" : 4,
989 "int margin_top" : 4,
998 " _this.done = true;",
999 " _this.el.hide(); ",
1003 "string label" : "Cancel",
1015 "_this.project.writeConfig(); ",
1017 "\t// what about .js ?",
1018 " _this.done = true;",
1019 "\t_this.el.hide();",
1021 "// hopefull this will work with bjs files..",
1028 "string label" : "Save",
1032 "xtype" : "HButtonBox"
1041 " if (!this.done) {",
1042 " _this.el.show_all();",
1051 "\t if (!this.done) {",
1052 " _this.el.show();",
1058 "uint border_width" : 0,
1059 "xtype" : "Popover",
1062 " this.project.writeConfig(); ",
1066 "(Gtk.Widget btn, Project.Gtk project) {",
1068 " //print(\"ValaProjectSettings show\\n\");",
1070 " this.project= project;",
1072 " this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;",
1074 " this.default_directory_tree_store.load(); ",
1075 " this.default_packages_tree_store.load(); ",
1076 " this.targets_tree_store.load();",
1077 " this.files_tree_store.load();",
1080 "\tthis.el.set_modal(true);",
1081 "\tthis.el.set_relative_to(btn);",
1083 "\tthis.el.set_position(Gtk.PositionType.RIGHT);",
1085 "\t// window + header?",
1086 "\t// print(\"SHOWALL - POPIP\\n\");",
1087 "\tthis.el.set_size_request(800,500);",
1088 "\tthis.el.show_all();",
1089 "\t//this.view.el.grab_focus();",
1097 "name" : "ValaProjectSettingsPopover",
1099 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaProjectSettingsPopover.bjs",