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",
304 " _this.database_ERROR.el.label = \"\";",
306 " Gda.Connection cnc;",
308 " // assumes localhost...",
309 " cnc = Gda.Connection.open_from_string (",
310 "\t\t\t_this.database_DBTYPE.el.get_text(),",
311 "\t\t\t\"DB_NAME=\" + _this.database_DBNAME.el.get_text(), ",
312 "\t\t\t\"USERNAME=\" + _this.database_DBUSERNAME.el.get_text() + ",
313 "\t\t\t\";PASSWORD=\" + _this.database_DBPASSWORD.el.get_text(),",
314 "\t\t\tGda.ConnectionOptions.NONE",
316 " //} catch (Gda.ConnectionError ce) { ",
317 " // _this.database_ERROR.el.label = ce.message; ",
318 " } catch(GLib.Error ue) {",
319 " _this.database_ERROR.el.label = ue.message;",
322 " _this.database_ERROR.el.label = \"Connection Succeeded\";",
328 "utf8 label" : "Check Connection",
333 "id" : "database_ERROR",
349 "* prop" : "titlebar",
350 "bool show_title_buttons" : false,
354 "* pack" : "pack_start",
359 " _this.done = true;",
360 " _this.el.hide(); ",
364 "string label" : "Cancel",
369 "* pack" : "pack_end",
370 "css_classes" : "{ \"suggested-action\" }",
376 " _this.buttonPressed(\"save\");",
378 "\t// what about .js ?",
379 " _this.done = true;",
380 "\t_this.el.hide();",
382 "// hopefull this will work with bjs files..",
389 "string label" : "Save",
393 "xtype" : "HeaderBar"
396 "string title" : "Edit Project settings",
400 " var buf = _this.view.el.get_buffer();",
403 " buf.get_start_iter(out s);",
404 " buf.get_end_iter(out e);",
405 "\t_this.project.runhtml = buf.get_text(s,e,true);",
407 " _this.project.rootURL = _this.rootURL.el.get_text();",
413 "\tswitch (this.html_gen.el.selected) {",
414 "\t\tcase 1: val = \"bjs\"; break;",
415 "\t\tcase 2: val = \"template\"; break;",
418 " _this.project.html_gen = val;",
420 " // set by event changed...",
421 " //_this.project.base_template = _this.base_template.el.get_text(); ",
423 " var js = _this.project;",
424 " js.DBTYPE = _this.database_DBTYPE.el.get_text();",
425 " js.DBNAME= _this.database_DBNAME.el.get_text();",
426 " // js.DBUSERNAME= _this.database_DBUSERNAME.el.get_text();",
427 " // js.DBPASSWORD= _this.database_DBPASSWORD.el.get_text();",
428 "// _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text()); ",
430 " // need to re-init the database ",
432 " _this.project.initDatabase();",
438 " (Gtk.Window pwin, Project.Roo project) {",
439 " _this.done = false;",
441 " _this.project = project;",
442 " _this.path.el.label = project.path;",
443 " // get the active project.",
444 " var lm = GtkSource.LanguageManager.get_default();",
446 " ((GtkSource.Buffer)(_this.view.el.get_buffer())) .set_language(",
447 " lm.get_language(\"html\")",
450 " //print (project.fn);",
451 " //project.runhtml = project.runhtml || '';",
452 " _this.view.el.get_buffer().set_text(project.runhtml);",
455 " _this.rootURL.el.set_text( _this.project.rootURL );",
459 " switch (this.project.html_gen) {",
460 " \tcase \"bjs\": tv = 1; break;",
461 " \tcase \"template\": tv = 2; break;",
463 " this.html_gen.el.selected = tv;",
467 "\tvar sm = (Gtk.StringList) _this.base_template.el.model;",
468 "\tthis.base_template.loading = true;",
469 "\tthis.base_template.el.selected = Gtk.INVALID_LIST_POSITION;",
470 "\tfor(var i=0;i< sm.get_n_items(); i++) {",
471 "\t\tif (sm.get_string( i ) == this.project.base_template) {",
472 "\t\t\tthis.base_template.el.selected = i;",
476 " this.base_template.loading = false;",
477 " //var js = _this.project;",
478 " _this.database_DBTYPE.el.set_text( _this.project.DBTYPE );",
479 " _this.database_DBNAME.el.set_text( _this.project.DBNAME );",
480 " //_this.database_DBUSERNAME.el.set_text( _this.project.DBUSERNAME );",
481 " //_this.database_DBPASSWORD.el.set_text( _this.project.DBPASSWORD );",
483 " \t//console.log('show all');",
486 " this.el.set_transient_for(pwin);",
487 "\t// window + header?",
488 "\t print(\"SHOWALL - POPIP\\n\");",
490 "\tthis.el.set_size_request(800,600);",
491 "\tthis.view.el.grab_focus();",
494 " //this.el.show_all();",
500 "name" : "RooProjectSettings"