2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# Project.Roo project" : "",
9 "@ void buttonPressed" : "(string btn)",
11 "id" : "RooProjectSettings",
14 "$ homogeneous" : false,
16 "* pack" : "set_child",
17 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
26 "id" : "label_global",
27 "utf8 label" : "Global",
33 "id" : "label_database",
34 "utf8 label" : "Database",
39 "* pack" : "append_page,_this.label_global.el",
40 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
41 "gboolean homogeneous" : false,
44 "$ homogeneous" : true,
48 "int margin_start" : 4,
52 "* pack" : "attach,0,0,1,1",
53 "int margin_bottom" : 3,
55 "int margin_start" : 3,
63 "* pack" : "attach,1,0,1,1",
65 "int margin_bottom" : 3,
67 "int margin_start" : 3,
75 "* pack" : "attach,0,1,1,1",
76 "int margin_bottom" : 3,
78 "int margin_start" : 3,
80 "label" : "HTML template file",
84 "# bool loading" : false,
86 "* pack" : "attach,1,1,1,1",
87 "id" : "base_template",
94 "\t\"roo.builder.html\",",
95 "\t\"bootstrap.builder.html\",",
96 "\t\"bootstrap4.builder.html\",",
97 "\t\"mailer.builder.html\"",
100 "xtype" : "StringList"
104 "notify[\"selected\"]" : [
108 "\t// this get's called when we are filling in the data... ???",
109 "\tif (this.loading) {",
112 "\tvar sm = (Gtk.StringList) this.el.model;",
113 "\t_this.project.base_template = sm.get_string(this.el.selected);",
115 "\t\t print(\"\\nSET base template to %s\\n\", _this.project.base_template );",
116 "\t\t// is_bjs = ((string)vfname) == \"bjs\";",
126 "* pack" : "attach,0,2,1,1",
127 "int margin_bottom" : 3,
128 "int margin_end" : 3,
129 "int margin_start" : 3,
130 "int margin_top" : 3,
131 "label" : "root URL",
136 "* pack" : "attach,1,2,1,1",
142 "* pack" : "attach,0,3,1,1",
143 "label" : "Generate HTML in",
147 "# bool loading" : false,
149 "* pack" : "attach,1,3,1,1",
157 "\t\"Do not Generate\", // \"\"",
158 "\t\"same directory as BJS file\", // bjs",
159 "\t\"in templates subdirectory\" // tmeplate",
163 "xtype" : "StringList"
167 "notify[\"selected\"]" : [
171 "\t// this get's called when we are filling in the data... ???",
172 "\tif (this.loading) {",
175 "\tvar sm = (Gtk.StringList) this.el.model;",
176 "\t_this.project.base_template = sm.get_string(this.el.selected);",
178 "\t\t print(\"\\nSET base template to %s\\n\", _this.project.base_template );",
179 "\t\t// is_bjs = ((string)vfname) == \"bjs\";",
190 "uint row_spacing" : 2,
195 "label" : "HTML To insert at end of <HEAD>",
200 "bool vexpand" : true,
203 "$ xns" : "GtkSource",
204 "* pack" : "set_child",
205 "css_classes" : "{ \"code-editor\" }",
212 "(keyval, keycode, state) => {",
215 " if (keyval != 115) {",
219 " if ( (state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {",
222 " var buf = _this.view.el.get_buffer();",
225 " buf.get_start_iter(out s);",
226 " buf.get_end_iter(out e);",
227 " _this.project.runhtml = buf.get_text(s,e,true);",
230 " _this.buttonPressed(\"save\");",
238 "xtype" : "EventControllerKey"
244 "xtype" : "ScrolledWindow"
251 "* pack" : "append_page,_this.label_database.el",
252 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
253 "gboolean homogeneous" : false,
257 "label" : "Type (eg. MySQL or PostgreSQL)",
263 "id" : "database_DBTYPE",
269 "(keyval, keycode, state) => {",
270 " if (keyval == Gdk.Key.Tab) {",
271 " _this.database_DBNAME.el.grab_focus();",
281 "xtype" : "EventControllerKey"
294 "id" : "database_DBNAME",
300 "(keyval, keycode, state) => {",
301 " if (keyval == Gdk.Key.Tab) {",
302 " _this.database_DBUSERNAME.el.grab_focus();",
313 "xtype" : "EventControllerKey"
325 " _this.database_ERROR.el.label = \"\";",
327 " Gda.Connection cnc;",
329 " // assumes localhost...",
330 " cnc = Gda.Connection.open_from_string (",
331 "\t\t\t_this.database_DBTYPE.el.get_text(),",
332 "\t\t\t\"DB_NAME=\" + _this.database_DBNAME.el.get_text(), ",
333 "\t\t\t\"USERNAME=\" + _this.database_DBUSERNAME.el.get_text() + ",
334 "\t\t\t\";PASSWORD=\" + _this.database_DBPASSWORD.el.get_text(),",
335 "\t\t\tGda.ConnectionOptions.NONE",
337 " //} catch (Gda.ConnectionError ce) { ",
338 " // _this.database_ERROR.el.label = ce.message; ",
339 " } catch(GLib.Error ue) {",
340 " _this.database_ERROR.el.label = ue.message;",
343 " _this.database_ERROR.el.label = \"Connection Succeeded\";",
349 "utf8 label" : "Check Connection",
354 "id" : "database_ERROR",
370 "* prop" : "titlebar",
371 "bool show_title_buttons" : false,
375 "* pack" : "pack_start",
380 " _this.done = true;",
381 " _this.el.hide(); ",
385 "string label" : "Cancel",
390 "* pack" : "pack_end",
391 "css_classes" : "{ \"suggested-action\" }",
397 " _this.buttonPressed(\"save\");",
399 "\t// what about .js ?",
400 " _this.done = true;",
401 "\t_this.el.hide();",
403 "// hopefull this will work with bjs files..",
410 "string label" : "Save",
414 "xtype" : "HeaderBar"
417 "string title" : "Edit Project settings",
421 " var buf = _this.view.el.get_buffer();",
424 " buf.get_start_iter(out s);",
425 " buf.get_end_iter(out e);",
426 "\t_this.project.runhtml = buf.get_text(s,e,true);",
428 " _this.project.rootURL = _this.rootURL.el.get_text();",
434 "\tswitch (this.html_gen.el.selected) {",
435 "\t\tcase 1: val = \"bjs\"; break;",
436 "\t\tcase 2: val = \"template\"; break;",
439 " _this.project.html_gen = val;",
441 " // set by event changed...",
442 " //_this.project.base_template = _this.base_template.el.get_text(); ",
444 " var js = _this.project;",
445 " js.DBTYPE = _this.database_DBTYPE.el.get_text();",
446 " js.DBNAME= _this.database_DBNAME.el.get_text();",
447 " // js.DBUSERNAME= _this.database_DBUSERNAME.el.get_text();",
448 " // js.DBPASSWORD= _this.database_DBPASSWORD.el.get_text();",
449 "// _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text()); ",
451 " // need to re-init the database ",
453 " _this.project.initDatabase();",
459 " (Gtk.Window pwin, Project.Roo project) {",
460 " _this.done = false;",
462 " _this.project = project;",
463 " _this.path.el.label = project.path;",
464 " // get the active project.",
465 " var lm = GtkSource.LanguageManager.get_default();",
467 " ((GtkSource.Buffer)(_this.view.el.get_buffer())) .set_language(",
468 " lm.get_language(\"html\")",
471 " //print (project.fn);",
472 " //project.runhtml = project.runhtml || '';",
473 " _this.view.el.get_buffer().set_text(project.runhtml);",
476 " _this.rootURL.el.set_text( _this.project.rootURL );",
480 " switch (this.project.html_gen) {",
481 " \tcase \"bjs\": tv = 1; break;",
482 " \tcase \"template\": tv = 2; break;",
484 " this.html_gen.el.selected = tv;",
488 "\tvar sm = (Gtk.StringList) _this.base_template.el.model;",
489 "\tthis.base_template.loading = true;",
490 "\tthis.base_template.el.selected = Gtk.INVALID_LIST_POSITION;",
491 "\tfor(var i=0;i< sm.get_n_items(); i++) {",
492 "\t\tif (sm.get_string( i ) == this.project.base_template) {",
493 "\t\t\tthis.base_template.el.selected = i;",
497 " this.base_template.loading = false;",
498 " //var js = _this.project;",
499 " _this.database_DBTYPE.el.set_text( _this.project.DBTYPE );",
500 " _this.database_DBNAME.el.set_text( _this.project.DBNAME );",
501 " //_this.database_DBUSERNAME.el.set_text( _this.project.DBUSERNAME );",
502 " //_this.database_DBPASSWORD.el.set_text( _this.project.DBPASSWORD );",
504 " \t//console.log('show all');",
507 " this.el.set_transient_for(pwin);",
508 "\t// window + header?",
509 "\t print(\"SHOWALL - POPIP\\n\");",
511 "\tthis.el.set_size_request(800,600);",
512 "\tthis.view.el.grab_focus();",
515 " //this.el.show_all();",
521 "name" : "RooProjectSettings"