2 "build_module" : "builder",
3 "gen_extended" : false,
7 "@ void buttonPressed" : "(string btn)",
8 "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
9 "Project.Roo project" : "",
10 "bool autohide" : false,
13 "id" : "RooProjectSettings",
16 "$ homogeneous" : false,
18 "* pack" : "set_child",
19 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
28 "id" : "label_global",
29 "utf8 label" : "Global",
35 "id" : "label_database",
36 "utf8 label" : "Database",
41 "* pack" : "append_page,_this.label_global.el",
42 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
43 "gboolean homogeneous" : false,
46 "$ homogeneous" : true,
50 "int margin_start" : 4,
54 "* pack" : "attach,0,0,1,1",
55 "int margin_bottom" : 3,
57 "int margin_start" : 3,
65 "* pack" : "attach,1,0,1,1",
67 "int margin_bottom" : 3,
69 "int margin_start" : 3,
77 "* pack" : "attach,0,1,1,1",
78 "int margin_bottom" : 3,
80 "int margin_start" : 3,
82 "label" : "HTML template file",
87 "* init" : "this.el.add_attribute(_this.base_template_cellrenderer.el , \"markup\", 0 );",
88 "* pack" : "attach,1,1,1,1",
89 "bool loading" : false,
90 "id" : "base_template",
94 "* pack" : "pack_start,true",
95 "id" : "base_template_cellrenderer",
96 "xtype" : "CellRendererText"
99 "$ columns" : "typeof(string)",
101 "* pack" : "set_model",
102 "id" : "base_template_model",
104 "xtype" : "ListStore",
105 "| void loadData" : [
107 "\t_this.base_template.loading = true;",
109 " this.el.clear(); ",
110 " Gtk.TreeIter iter;",
111 " var el = this.el;",
113 " /// el.append(out iter);",
116 " el.append(out iter);",
117 " el.set_value(iter, 0, \"roo.builder.html\");",
118 " _this.base_template.el.set_active_iter(iter);",
119 "\tif (_this.project.base_template == \"roo.builder.html\") {",
120 "\t _this.base_template.el.set_active_iter(iter);",
123 " el.append(out iter);",
124 " el.set_value(iter, 0, \"bootstrap.builder.html\");",
126 "\tprint(\"\\ncur template = %s\\n\", _this.project.base_template);",
128 " if (_this.project.base_template == \"bootstrap.builder.html\") {",
129 "\t _this.base_template.el.set_active_iter(iter);",
131 "\t el.append(out iter);",
132 " el.set_value(iter, 0, \"bootstrap4.builder.html\");",
133 " if (_this.project.base_template == \"bootstrap4.builder.html\") {",
134 "\t _this.base_template.el.set_active_iter(iter);",
138 "\tel.append(out iter);",
139 " el.set_value(iter, 0, \"mailer.builder.html\");",
141 "\tif (_this.project.base_template == \"mailer.builder.html\") {",
142 "\t _this.base_template.el.set_active_iter(iter);",
144 "\t_this.base_template.loading = false;",
154 "\tGtk.TreeIter iter;",
156 "\t// this get's called when we are filling in the data... ???",
157 "\tif (this.loading) {",
162 "\tif (this.el.get_active_iter(out iter)) {",
164 "\t\t_this.base_template_model.el.get_value (iter, 0, out vfname);",
165 "\t\t_this.project.base_template = ((string)vfname) ;",
167 "\t\t print(\"\\nSET base template to %s\\n\", _this.project.base_template );",
168 "\t\t// is_bjs = ((string)vfname) == \"bjs\";",
172 " // directory is only available for non-bjs ",
184 "* pack" : "attach,0,2,1,1",
185 "int margin_bottom" : 3,
186 "int margin_end" : 3,
187 "int margin_start" : 3,
188 "int margin_top" : 3,
189 "label" : "root URL",
194 "* pack" : "attach,1,2,1,1",
200 "* pack" : "attach,0,3,1,1",
201 "label" : "Generate HTML in",
206 "* init" : "this.el.add_attribute(_this.html_gen_cellrenderer.el , \"markup\", 1 );",
207 "* pack" : "attach,1,3,1,1",
212 "* pack" : "pack_start,true",
213 "id" : "html_gen_cellrenderer",
214 "xtype" : "CellRendererText"
217 "$ columns" : "typeof(string),typeof(string)",
219 "* pack" : "set_model",
220 "id" : "html_gen_model",
222 "xtype" : "ListStore",
223 "| void loadData" : [
225 " this.el.clear(); ",
226 " Gtk.TreeIter iter;",
227 " var el = this.el;",
230 " el.append(out iter);",
233 " el.set_value(iter, 0, \"\");",
234 " el.set_value(iter, 1, \"Do not Generate\");",
235 " _this.html_gen.el.set_active_iter(iter);",
237 " el.append(out iter);",
239 " el.set_value(iter, 0, \"bjs\");",
240 " el.set_value(iter, 1, \"same directory as BJS file\");",
241 "\tif (cur == \"bjs\") {",
242 "\t _this.html_gen.el.set_active_iter(iter);",
247 " el.append(out iter);",
249 " el.set_value(iter, 0, \"templates\");",
250 " el.set_value(iter, 1, \"in templates subdirectory\");",
252 "\tif (cur == \"template\") {",
253 "\t _this.html_gen.el.set_active_iter(iter);",
267 "uint row_spacing" : 2,
272 "label" : "HTML To insert at end of <HEAD>",
277 "bool vexpand" : true,
280 "$ xns" : "GtkSource",
284 "this.css = new Gtk.CssProvider();",
286 "\tthis.css.load_from_string(",
287 "\t\"#roo-project-settings-view{ font: 10px monospace;}\"",
290 "//this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
292 " Gtk.StyleContext.add_provider_for_display(",
293 "\t Gdk.Display.get_default(), ",
295 "\t Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
298 "* pack" : "set_child",
299 "Gtk.CssProvider css" : "",
306 "(keyval, keycode, state) => {",
309 " if (keyval != 115) {",
313 " if ( (state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {",
316 " var buf = _this.view.el.get_buffer();",
319 " buf.get_start_iter(out s);",
320 " buf.get_end_iter(out e);",
321 " _this.project.runhtml = buf.get_text(s,e,true);",
324 " _this.buttonPressed(\"save\");",
332 "xtype" : "EventControllerKey"
335 "string name" : "roo-project-settings-view",
339 "xtype" : "ScrolledWindow"
346 "* pack" : "append_page,_this.label_database.el",
347 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
348 "gboolean homogeneous" : false,
352 "label" : "Type (eg. MySQL or PostgreSQL)",
358 "id" : "database_DBTYPE",
364 "(keyval, keycode, state) => {",
365 " if (keyval == Gdk.Key.Tab) {",
366 " _this.database_DBNAME.el.grab_focus();",
376 "xtype" : "EventControllerKey"
389 "id" : "database_DBNAME",
395 "(keyval, keycode, state) => {",
396 " if (keyval == Gdk.Key.Tab) {",
397 " _this.database_DBUSERNAME.el.grab_focus();",
408 "xtype" : "EventControllerKey"
415 "label" : "Username",
421 "id" : "database_DBUSERNAME",
427 "(keyval, keycode, state) => {",
428 " if (keyval == Gdk.Key.Tab) {",
429 " _this.database_DBPASSWORD.el.grab_focus();",
441 "xtype" : "EventControllerKey"
448 "label" : "Password",
454 "id" : "database_DBPASSWORD",
464 " _this.database_ERROR.el.label = \"\";",
466 " Gda.Connection cnc;",
468 " // assumes localhost...",
469 " cnc = Gda.Connection.open_from_string (",
470 "\t\t\t_this.database_DBTYPE.el.get_text(),",
471 "\t\t\t\"DB_NAME=\" + _this.database_DBNAME.el.get_text(), ",
472 "\t\t\t\"USERNAME=\" + _this.database_DBUSERNAME.el.get_text() + ",
473 "\t\t\t\";PASSWORD=\" + _this.database_DBPASSWORD.el.get_text(),",
474 "\t\t\tGda.ConnectionOptions.NONE",
476 " //} catch (Gda.ConnectionError ce) { ",
477 " // _this.database_ERROR.el.label = ce.message; ",
478 " } catch(GLib.Error ue) {",
479 " _this.database_ERROR.el.label = ue.message;",
482 " _this.database_ERROR.el.label = \"Connection Succeeded\";",
488 "utf8 label" : "Check Connection",
493 "id" : "database_ERROR",
509 "* prop" : "titlebar",
510 "bool show_title_buttons" : false,
514 "* pack" : "pack_start",
519 " _this.done = true;",
520 " _this.el.hide(); ",
524 "string label" : "Cancel",
529 "* pack" : "pack_end",
530 "css_classes" : "{ \"suggested-action\" }",
536 " _this.buttonPressed(\"save\");",
538 "\t// what about .js ?",
539 " _this.done = true;",
540 "\t_this.el.hide();",
542 "// hopefull this will work with bjs files..",
549 "string label" : "Save",
553 "xtype" : "HeaderBar"
556 "string title" : "Edit Project settings",
557 "uint border_width" : 0,
561 " var buf = _this.view.el.get_buffer();",
564 " buf.get_start_iter(out s);",
565 " buf.get_end_iter(out e);",
566 "\t_this.project.runhtml = buf.get_text(s,e,true);",
568 " _this.project.rootURL = _this.rootURL.el.get_text();",
571 " Gtk.TreeIter iter;",
572 " Value html_gen_val;",
573 " _this.html_gen.el.get_active_iter(out iter);",
574 " _this.html_gen_model.el.get_value (iter, 0, out html_gen_val);",
576 " _this.project.html_gen = (string)html_gen_val;",
578 " // set by event changed...",
579 " //_this.project.base_template = _this.base_template.el.get_text(); ",
581 " var js = _this.project;",
582 " js.DBTYPE = _this.database_DBTYPE.el.get_text();",
583 " js.DBNAME= _this.database_DBNAME.el.get_text();",
584 " js.DBUSERNAME= _this.database_DBUSERNAME.el.get_text();",
585 " js.DBPASSWORD= _this.database_DBPASSWORD.el.get_text();",
586 "// _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text()); ",
588 " // need to re-init the database ",
590 " _this.project.initDatabase();",
596 " (Gtk.Window pwin, Project.Roo project) {",
597 " _this.done = false;",
599 " _this.project = project;",
600 " _this.path.el.label = project.path;",
601 " // get the active project.",
602 " var lm = GtkSource.LanguageManager.get_default();",
604 " ((GtkSource.Buffer)(_this.view.el.get_buffer())) .set_language(",
605 " lm.get_language(\"html\")",
608 " //print (project.fn);",
609 " //project.runhtml = project.runhtml || '';",
610 " _this.view.el.get_buffer().set_text(project.runhtml);",
613 " _this.rootURL.el.set_text( _this.project.rootURL );",
615 " _this.html_gen_model.loadData(_this.project.html_gen);",
617 " _this.base_template_model.loadData();",
619 " //var js = _this.project;",
620 " _this.database_DBTYPE.el.set_text( _this.project.DBTYPE );",
621 " _this.database_DBNAME.el.set_text( _this.project.DBNAME );",
622 " _this.database_DBUSERNAME.el.set_text( _this.project.DBUSERNAME );",
623 " _this.database_DBPASSWORD.el.set_text( _this.project.DBPASSWORD );",
625 " \t//console.log('show all');",
628 " this.el.set_transient_for(pwin);",
629 "\t// window + header?",
630 "\t print(\"SHOWALL - POPIP\\n\");",
632 "\tthis.el.set_size_request(800,600);",
633 "\tthis.view.el.grab_focus();",
636 " //this.el.show_all();",
642 "name" : "RooProjectSettings"