{
- "name" : "PopoverFileDetails",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverFileDetails.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
- "listeners" : {
- "closed" : "() => {\n if (!this.done) {\n _this.el.show();\n \n }\n} "
- },
- "| void updateFileFromEntry" : "() {\n\n _this.file.title = _this.title.el.get_text();\n _this.file.region = _this.region.el.get_text(); \n _this.file.parent = _this.parent.el.get_text(); \n _this.file.permname = _this.permname.el.get_text(); \n _this.file.modOrder = _this.modOrder.el.get_text();\n \n if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {\n _this.file.renameTo(_this.name.el.get_text());\n }\n // store the module...\n _this.file.build_module = \"\"; \n Gtk.TreeIter iter; \n if (_this.build_module.el.get_active_iter (out iter)) {\n Value vfname;\n this.dbmodel.el.get_value (iter, 0, out vfname);\n if (((string)vfname).length > 0) {\n _this.file.build_module = (string)vfname;\n }\n \n }\n \n \n\n \n} ",
- "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
- "id" : "PopoverFileDetails",
- "| void show" : "(JsRender.JsRender c, Gtk.Widget btn) \n{\n this.project = c.project;\n this.done = false;\n \n \n //if (!this.el) {\n //this.init();\n //}\n \n _this.name.el.set_text(c.name);\n _this.title.el.set_text(c.title);\n _this.parent.el.set_text(c.parent); \n _this.region.el.set_text(c.region);\n _this.modOrder.el.set_text(c.modOrder);\n _this.permname.el.set_text(c.permname);\n \n \n \n \n \n \n \n \n var ar = new Gee.ArrayList<string>();\n _this.dbmodel.loadData(ar,\"\");\n // load the modules... if relivant..\n if (this.project.xtype == \"Gtk\") {\n var p = (Project.Gtk)c.project;\n var cg = p.compilegroups;\n\n var iter = cg.map_iterator();\n while(iter.next()) {\n var key = iter.get_key();\n if (key == \"_default_\") {\n continue;\n }\n ar.add(key);\n };\n _this.dbmodel.loadData(ar, c.build_module);\n\n }\n \n \n _this.file = c;\n //console.log('show all');\n this.el.set_modal(true);\n this.el.set_relative_to(btn);\n\n this.el.set_position(Gtk.PositionType.RIGHT);\n \n // window + header?\n print(\"SHOWALL - POPIP\\n\");\n this.el.show_all();\n this.name.el.grab_focus();\n \n \n \n if (c.path.length > 0) {\n\t this.save_btn.el.set_label(\"Save\");\n\t\t_this.filetype.el.hide();\n\t\t_this.filetypelbl.el.hide();\n\t\t_this.filetype.showhide(true); // as we only work on bjs files currently\n } else {\n this.save_btn.el.set_label(\"Create\");\n _this.ftdbmodel.loadData(\"bjs\"); // fixme - need to determine type..\n\t _this.filetype.el.show();\n\t _this.filetypelbl.el.show();\n }\n \n \n //this.success = c.success;\n \n \n}",
- "bool done" : false,
- "# Project.Project project" : "",
- "xtype" : "Popover",
- "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
"# JsRender.JsRender file" : "null",
+ "# Project.Project project" : "",
+ "# bool new_window" : true,
"$ xns" : "Gtk",
+ "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
"Xcls_MainWindow mainwindow" : "null",
+ "bool done" : false,
+ "bool is_new" : true,
"bool modal" : true,
- "uint border_width" : 0,
+ "id" : "PopoverFileDetails",
"items" : [
{
- "bool homogeneous" : false,
- "xtype" : "Box",
"$ pack" : "add",
"$ xns" : "Gtk",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool homogeneous" : false,
+ "int margin_bottom" : 4,
+ "int margin_end" : 4,
+ "int margin_start" : 4,
+ "int margin_top" : 4,
"items" : [
{
- "* pack" : "pack_start,false,true,0",
- "xtype" : "HeaderBar",
"$ xns" : "Gtk",
- "string title" : "Add / Edit File"
- },
- {
+ "* columns" : 2,
+ "* pack" : "append",
+ "bool hexpand" : true,
"id" : "grid",
- "int margin_right" : 4,
- "* pack" : "pack_start,false,false,4",
- "xtype" : "Grid",
- "uint row_spacing" : 2,
- "n_columns" : 2,
- "$ xns" : "Gtk",
- "n_rows" : 7,
- "$ homogeneous" : true,
- "int margin_left" : 4,
+ "int column_spacing" : 4,
+ "int margin_end" : 4,
+ "int margin_start" : 4,
"items" : [
{
- "label" : "File type",
- "id" : "filetypelbl",
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,0,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ xns" : "Gtk",
+ "id" : "filetype_lbl",
+ "label" : "File type",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "bool hexpand" : true,
+ "bool in_showhide" : false,
+ "id" : "filetype",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "id" : "filetype_model",
+ "strings" : "{}",
+ "xtype" : "StringList",
+ "| void load" : [
+ "() {",
+ " var el = this.el;",
+ " ",
+ " while (el.get_n_items() > 0) {",
+ " \tel.remove(0);",
+ "\t}",
+ " \tel.append(\"bjs - User Interface File\");",
+ " ",
+ " ",
+ " switch(_this.project.xtype) {",
+ " \tcase \"Roo\":",
+ " \t \tel.append(\"js - Javascript File\");",
+ " \t \tel.append(\"css - CSS File\");",
+ " \t \tel.append(\"php - Javascript File\");",
+ " \t \t",
+ "\t\tbreak;",
+ "",
+ "\tcase \"Gtk\":\t\t",
+ "\t\t\t",
+ " \t \tel.append(\"vala - Vala File\");",
+ " \t \tel.append(\"css - CSS File\");",
+ " \t \tel.append(\"other - Other Type\");",
+ " \t \tbreak;",
+ " \t default : ",
+ " \t \tbreak;",
+ "\t}",
+ "",
+ "\t",
+ "\t",
+ "\t",
+ "}"
+ ]
+ }
+ ],
"listeners" : {
- "changed" : "() => {\n\tGtk.TreeIter iter;\n\tbool is_bjs = true;\n\tif (this.el.get_active_iter(out iter)) {\n\t\tValue vfname;\n\t\t_this.ftdbmodel.el.get_value (iter, 0, out vfname);\n\t\t is_bjs = ((string)vfname) == \"bjs\";\n\t}\n \n \n // directory is only available for non-bjs \n this.showhide(is_bjs);\n\n\n}\n"
+ "notify[\"selected\"]" : [
+ "() => {",
+ "",
+ " \t_this.onFileTypeChange();",
+ "",
+ " }"
+ ]
},
- "id" : "filetype",
- "* init" : "this.el.add_attribute(_this.ftdbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach,1,0,1,1",
- "xtype" : "ComboBox",
- "| void showhide" : "(bool is_bjs) {\n\tfor (var i = 2; i < 9;i++) {\n\t\tvar el = _this.grid.el.get_child_at(0,i);\n\t\t\n\t\tvar showhide= is_bjs;\n\t\tif (i> 7) {\n\t\t\tshowhide = !showhide;\n\t\t}\n\t\t\n\t\tif (showhide) {\n\t\t el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t}\n\t\t el = _this.grid.el.get_child_at(1,i);\n\t\tif (showhide) {\n\t\t el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t} \n }\n // load up the directories\n //??? why can we not create bjs files in other directories??\n\tif (!is_bjs && _this.file.path.length < 1) {\n\t\t_this.dirmodel.loadData();\n\t\t\n\t\t\n\t}\n \n \n}\n",
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ "() {",
+ "\t",
+ "\tif (!_this.is_new) {",
+ "\t\treturn _this.file.xtype != \"Plainfile\" ? \"bjs\" : _this.file.file_ext;",
+ "\t}",
+ "\t",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\treturn \"\";",
+ "\t}",
+ "\t",
+ "\treturn _this.filetype_model.el.get_string(this.el.selected).split(\" \")[0];",
+ "}"
+ ],
+ "| void setValue" : [
+ "(string cur) {",
+ "\tvar el = _this.filetype_model.el;",
+ "\tfor(var i= 0; i < el.get_n_items();i++) {",
+ "\t\tif (el.get_string(i).has_prefix(cur)) {",
+ "\t\t\tthis.el.selected = i;",
+ "\t\t\tbreak;",
+ "\t\t}",
+ "\t}",
+ "}"
+ ]
+ },
+ {
+ "$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "dir_dropdown_lbl",
+ "label" : "Create File in this Directory",
+ "x_options" : 4,
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
+ },
+ {
"$ xns" : "Gtk",
+ "id" : "dir_dropdown",
+ "int colspan" : 1,
"items" : [
{
- "id" : "ftdbcellrenderer",
- "* pack" : "pack_start,true",
- "xtype" : "CellRendererText",
- "$ xns" : "Gtk"
- },
- {
- "id" : "ftdbmodel",
- "* pack" : "set_model",
- "xtype" : "ListStore",
- "$ columns" : "typeof(string),typeof(string)",
- "n_columns" : 2,
"$ xns" : "Gtk",
- "| void loadData" : " (string cur) {\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n /// el.append(out iter);\n \n \n // el.set_value(iter, 0, \"\");\n // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");\n\n el.append(out iter);\n\n \n el.set_value(iter, 0, \"bjs\");\n el.set_value(iter, 1, \"User Interface File (bjs)\");\n _this.filetype.el.set_active_iter(iter);\n\n el.append(out iter);\n \n el.set_value(iter, 0, \"vala\");\n el.set_value(iter, 1, \"Vala\");\n\tif (cur == \"vala\") {\n\t _this.filetype.el.set_active_iter(iter);\n }\n\n\n\n el.append(out iter);\n \n el.set_value(iter, 0, \"js\");\n el.set_value(iter, 1, \"Javascript\");\n\n\tif (cur == \"js\") {\n\t _this.filetype.el.set_active_iter(iter);\n }\n\n el.append(out iter);\n \n el.set_value(iter, 0, \"css\");\n el.set_value(iter, 1, \"CSS\");\n\n\tif (cur == \"css\") {\n\t _this.filetype.el.set_active_iter(iter);\n }\n \n}\n"
+ "* prop" : "model",
+ "id" : "dir_model",
+ "strings" : "{}",
+ "xtype" : "StringList"
}
+ ],
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "() => {",
+ "",
+ "\t _this.onDirChanged();",
+ "\t",
+ "\t",
+ "\t",
+ " } "
+ ]
+ },
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ "() {",
+ "\treturn _this.dir_model.el.get_string(this.el.selected);",
+ "}"
+ ],
+ "| void setValue" : [
+ "(string cur) {",
+ "\tvar el = _this.dir_model.el;",
+ "\tfor(var i= 0; i < el.get_n_items();i++) {",
+ "\t\tif (el.get_string(i) == cur) {",
+ "\t\t\tthis.el.selected = i;",
+ "\t\t\tbreak;",
+ "\t\t}",
+ "\t}",
+ "}"
]
},
{
- "label" : "Component Name",
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,1,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ xns" : "Gtk",
+ "id" : "name_lbl",
+ "label" : "Component Name (File name without extension)",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "name",
"$ visible" : true,
- "xtype" : "Entry",
- "* pack" : "attach,1,1,1,1",
- "$ xns" : "Gtk"
+ "$ xns" : "Gtk",
+ "bool hexpand" : true,
+ "id" : "name",
+ "xtype" : "Entry"
},
{
- "label" : "Title",
- "$ visible" : true,
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,2,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "title_lbl",
+ "label" : "Title",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "title",
"$ visible" : true,
- "xtype" : "Entry",
+ "$ xns" : "Gtk",
"* pack" : "attach,1,2,1,1",
- "$ xns" : "Gtk"
+ "bool hexpand" : true,
+ "id" : "title",
+ "xtype" : "Entry"
},
{
- "label" : "Region",
+ "$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "region_lbl",
+ "label" : "Region",
"tooltip_text" : "center, north, south, east, west",
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,3,1,1",
- "xtype" : "Label",
- "$ justify" : "Gtk.Justification.RIGHT",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "region",
"$ visible" : true,
- "xtype" : "Entry",
- "* pack" : "attach,1,3,1,1",
- "$ xns" : "Gtk"
+ "$ xns" : "Gtk",
+ "bool hexpand" : true,
+ "id" : "region",
+ "xtype" : "Entry"
},
{
- "label" : "Parent Name",
- "$ visible" : true,
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,4,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "parent_lbl",
+ "label" : "Parent Name",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "parent",
"$ visible" : true,
- "xtype" : "Entry",
- "* pack" : "attach,1,4,1,1",
- "$ xns" : "Gtk"
+ "$ xns" : "Gtk",
+ "id" : "parent",
+ "xtype" : "Entry"
},
{
- "label" : "Permission Name",
- "$ visible" : true,
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,5,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "permname_lbl",
+ "label" : "Permission Name",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "permname",
"$ visible" : true,
- "xtype" : "Entry",
- "* pack" : "attach,1,5,1,1",
- "$ xns" : "Gtk"
+ "$ xns" : "Gtk",
+ "id" : "permname",
+ "xtype" : "Entry"
},
{
- "label" : "Order (for tabs)",
- "$ visible" : true,
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,6,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "modOrder_lbl",
+ "label" : "Order (for tabs)",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "modOrder",
"$ visible" : true,
- "xtype" : "Entry",
- "* pack" : "attach,1,6,1,1",
- "$ xns" : "Gtk"
+ "$ xns" : "Gtk",
+ "id" : "modOrder",
+ "xtype" : "Entry"
},
{
- "label" : "Module to build (Vala only)",
- "$ visible" : true,
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,7,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "build_module_lbl",
+ "label" : "Module to build",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "build_module",
- "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach,1,7,1,1",
- "xtype" : "ComboBox",
"$ xns" : "Gtk",
+ "id" : "build_module",
"items" : [
{
- "id" : "dbcellrenderer",
- "xtype" : "CellRendererText",
- "* pack" : "pack_start,true",
- "$ xns" : "Gtk"
- },
- {
- "id" : "dbmodel",
- "xtype" : "ListStore",
- "* pack" : "set_model",
- "$ columns" : "typeof(string),typeof(string)",
- "n_columns" : 2,
"$ xns" : "Gtk",
- "| void loadData" : " (Gee.ArrayList<string> data, string cur) {\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n /// el.append(out iter);\n \n \n // el.set_value(iter, 0, \"\");\n // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");\n\n el.append(out iter);\n\n \n el.set_value(iter, 0, \"\");\n el.set_value(iter, 1, \"-- select a module --\");\n _this.build_module.el.set_active_iter(iter);\n \n for (var i = 0; i < data.size;i++) {\n \n\n el.append(out iter);\n \n el.set_value(iter, 0, data.get(i));\n el.set_value(iter, 1, data.get(i));\n \n if (data.get(i) == cur) {\n _this.build_module.el.set_active_iter(iter);\n }\n \n }\n this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n"
+ "* prop" : "model",
+ "id" : "build_module_model",
+ "strings" : "{}",
+ "xtype" : "StringList",
+ "| void load" : [
+ "(Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)",
+ "{",
+ "\t",
+ "\t_this.build_module.el.hide();",
+ "\t\t_this.build_module_lbl.el.hide();",
+ "\tvar el = _this.build_module_model.el;",
+ "\t while (el.get_n_items() > 0) {",
+ "\t\t\tel.remove(0);",
+ "\t}",
+ "\t",
+ "\tif (compilegroups == null) {",
+ "\t\treturn;",
+ "\t}",
+ "\tforeach(var k in compilegroups.keys) {",
+ "\t\tthis.el.append(k);",
+ "\t}",
+ "\tif (compilegroups.keys.size > 0) {",
+ "\t\t_this.build_module.el.selected = 0;",
+ "\t\t_this.build_module.el.show();",
+ "\t\t_this.build_module_lbl.el.show();",
+ "\t} else {",
+ "\t\t",
+ "\t}",
+ "\t",
+ "}"
+ ]
}
+ ],
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ " ",
+ "() {",
+ "\tif (this.el.selected < 0) {",
+ "\t\treturn \"\";",
+ "\t}",
+ "\t",
+ "\treturn _this.build_module_model.el.get_string(this.el.selected);",
+ "}",
+ " "
+ ],
+ "| void setValue" : [
+ "(string str) {",
+ "\tvar m = _this.build_module_model.el;",
+ "\tfor(var i = 0; i < m.get_n_items(); i++) {",
+ "\t\tif (m.get_string(i) == str) {",
+ "\t\t\tthis.el.selected = i;",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t}",
+ "\t\t",
+ "}"
]
},
{
- "label" : "Directory",
- "$ visible" : true,
- "xalign" : 0.90000000000000002,
- "* pack" : "attach,0,8,1,1",
- "xtype" : "Label",
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "path_lbl",
+ "int colspan" : 1,
+ "label" : "Full path",
"x_options" : 4,
- "$ xns" : "Gtk"
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
- "id" : "dir",
- "* init" : "this.el.add_attribute(_this.dircellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach,1,8,1,1",
- "xtype" : "ComboBox",
+ "$ visible" : true,
"$ xns" : "Gtk",
- "items" : [
- {
- "id" : "dircellrenderer",
- "* pack" : "pack_start,true",
- "xtype" : "CellRendererText",
- "$ xns" : "Gtk"
- },
- {
- "id" : "dirmodel",
- "* pack" : "set_model",
- "xtype" : "ListStore",
- "$ columns" : "typeof(string),typeof(string)",
- "n_columns" : 2,
- "$ xns" : "Gtk",
- "| void loadData" : " () {\n\t\n\t\n \n this.el.clear(); \n \n if (!(_this.project is Project.Gtk)) {\n\t\treturn;\n\t}\n var sd = ((Project.Gtk)_this.project).sourcedirs();\n \n Gtk.TreeIter iter;\n var el = this.el;\n \n /// el.append(out iter);\n \n \n // el.set_value(iter, 0, \"\");\n // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");\n\n// el.append(out iter);\n\n \n// el.set_value(iter, 0, \"\");\n // el.set_value(iter, 1, \"-- select a directoyr --\");\n //_this.build_module.el.set_active_iter(iter);\n \n for (var i = 0; i < sd.length;i++) {\n \n\n el.append(out iter);\n \n el.set_value(iter, 0, sd[i]);\n el.set_value(iter, 1, sd[i]);\n \n //if (data.get(i) == cur) {\n // _this.build_module.el.set_active_iter(iter);\n // }\n \n }\n // this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n"
- }
- ]
- }
- ]
- },
- {
- "int margin_bottom" : 4,
- "int margin_right" : 4,
- "* pack" : "pack_end,false,true,0",
- "xtype" : "HButtonBox",
- "$ xns" : "Gtk",
- "int margin_left" : 4,
- "items" : [
+ "bool editable" : false,
+ "bool hexpand" : true,
+ "id" : "path",
+ "int colspan" : 1,
+ "xtype" : "Entry"
+ },
{
- "listeners" : {
- "clicked" : "() => { \n\n _this.done = true;\n _this.el.hide(); \n}"
- },
- "* pack" : "add",
- "xtype" : "Button",
- "string label" : "Cancel",
- "$ xns" : "Gtk"
+ "$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "gen_lbl",
+ "int colspan" : 1,
+ "label" : "Generate as Extended (no working)",
+ "x_options" : 4,
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "id" : "gen",
"listeners" : {
- "clicked" : "( ) => { \n\n \n\n\n\tif (_this.name.el.get_text().length < 1) {\n\t StandardErrorDialog.show(\n\t _this.mainwindow.el,\n\t \"You have to set Component name \"\n\t );\n\t \n\t return;\n\t}\n\t// what does this do?\n\t\n\tvar isNew = _this.file.name.length > 0 ? false : true;\n\t/*\n\tif (!isNew && this.file.name != _this.name.el.get_text()) {\n\t Xcls_StandardErrorDialog.singleton().show(\n\t this.el,\n\t \"Sorry changing names does not work yet. \"\n\t );\n\t \n\t return;\n\t}\n\t*/\n\t \n\t\n \n\t// FIXME - this may be more complicated...\n\t//for (var i in this.def) {\n\t// this.file[i] = this.get(i).el.get_text();\n\t//}\n\n\tif (!isNew) {\n\t try {\n\t _this.updateFileFromEntry();\n\t } catch( JsRender.Error.RENAME_FILE_EXISTS er) {\n\t Xcls_StandardErrorDialog.singleton().show(\n\t _this.mainwindow.el,\n\t \"The name you used already exists \"\n\t );\n\t return;\n\t \n\t }\n\n\t _this.done = true;\n\t _this.file.save();\n\t _this.el.hide();\n\t return;\n\t}\n\t\n\t// ---------------- NEW FILES...\n\tGtk.TreeIter iter;\n\n\tif (!_this.filetype.el.get_active_iter(out iter)) {\n\t\t// should not happen...\n\t\t// so we are jut going to return without \n\t\tStandardErrorDialog.show(\n\t _this.mainwindow.el,\n\t \"You must select a file type. \"\n\t );\n\t return;\n\t\t \n\t}\n\t\n\t\n\tvar fn = _this.name.el.get_text();\n\t\n\tValue ftypename;\n\t_this.ftdbmodel.el.get_value (iter, 0, out ftypename);\n\tvar ext = ((string)ftypename);\n\tvar dir = _this.project.firstPath(); \n\tif (ext != \"bjs\") {\n\t \n\t\tif (!_this.dir.el.get_active_iter(out iter)) {\n\t\t\t// should not happen...\n\t\t\t// so we are jut going to return without \n\t\t\tStandardErrorDialog.show(\n\t\t\t _this.mainwindow.el,\n\t\t\t \"You must select a directory \"\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tValue vdir;\n\t\t_this.dirmodel.el.get_value (iter, 0, out vdir);\n\t\tdir = (string)vdir;\n\t}\n\t\n\tvar targetfile = dir + \"/\" + fn;\n\t\n\t// strip the file type off the end..\n\t\n\t\n var rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);\n targetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); \n \n\tif (GLib.FileUtils.test(targetfile + \".\" + ext, GLib.FileTest.EXISTS)) {\n\t Xcls_StandardErrorDialog.singleton().show(\n\t _this.mainwindow.el,\n\t \"That file already exists\"\n\t ); \n\t return;\n\t}\n \n var f = JsRender.JsRender.factory(\n\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\", \n\t\t_this.file.project, \n\t\ttargetfile + \".\" + ext);\n\n\t_this.file = f;\n\t\n\n\t\n\t_this.updateFileFromEntry();\n\t_this.file.loaded = true;\n\t_this.file.save();\n\tif (ext == \"bjs\") {\n\t\t_this.file.project.addFile(_this.file);\n\t}\n\t\n \n\t// what about .js ?\n _this.done = true;\n\t_this.el.hide();\n\n// hopefull this will work with bjs files..\n\t\n\t_this.success(_this.project, _this.file);\n \n}"
+ "toggled" : [
+ "( ) => {",
+ "\t ",
+ "\tthis.el.label = this.el.active ? \"Extended\" : \"Wrapped\";",
+ "",
+ "}",
+ ""
+ ]
},
- "id" : "save_btn",
- "xtype" : "Button",
- "* pack" : "add",
- "string label" : "Save",
- "$ xns" : "Gtk"
+ "string label" : "Wrapped",
+ "xtype" : "CheckButton"
}
+ ],
+ "uint row_spacing" : 2,
+ "xtype" : "Grid",
+ "| void xhideRow" : [
+ "(int row) ",
+ "{",
+ "\tvar el = _this.grid.el.get_child_at(0,row);",
+ "",
+ "\tel.hide();",
+ "\tel = _this.grid.el.get_child_at(1,row);",
+ "\tel.hide();",
+ "",
+ "}"
+ ],
+ "| void xshowAllRows" : [
+ "() {",
+ "\tfor (var i = 2; i < 10;i++) {",
+ "\t\tvar el = _this.grid.el.get_child_at(0,i);",
+ "\t\tel.show();",
+ "\t\tel = _this.grid.el.get_child_at(1,i);",
+ "\t\tel.show();",
+ " }",
+ "}"
]
}
- ]
+ ],
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "titlebar",
+ "bool show_title_buttons" : false,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "listeners" : {
+ "clicked" : [
+ "() => { ",
+ " \t_this.done = true;",
+ " _this.el.hide(); ",
+ "}"
+ ]
+ },
+ "string label" : "Cancel",
+ "xtype" : "Button"
+ },
+ {
+ "$ css_classes" : "{ \"suggested-action\" }",
+ "$ xns" : "Gtk",
+ "* pack" : "pack_end",
+ "bool always_show_image" : true,
+ "bool hexpand" : false,
+ "id" : "save_btn",
+ "listeners" : {
+ "clicked" : [
+ "( ) => { ",
+ "",
+ " ",
+ "",
+ "",
+ "\tif (_this.name.el.get_text().length < 1) {",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"You have to set a Component name \"",
+ "\t );",
+ "\t ",
+ "\t return;",
+ "\t}",
+ "\t ",
+ "",
+ "\tif (!_this.is_new) {",
+ "\t // try {",
+ "\t ",
+ "\t \tvar old_target = _this.file.build_module;",
+ " _this.updateFileFromEntry();",
+ "\t if (_this.project.xtype == \"Gtk\" && old_target != _this.file.build_module) {",
+ "\t \tvar gp = (JsRender.Gtk)_this.file;",
+ "\t \tgp.updateCompileGroup(old_target, _this.file.build_module);",
+ " \t}",
+ "",
+ "\t _this.done = true;",
+ "\t _this.file.save();",
+ "\t _this.el.hide();",
+ "\t return;",
+ "\t} ",
+ "\t",
+ "\t// ---------------- NEW FILES...",
+ "\tvar ftype = _this.filetype.getValue();",
+ "",
+ "\tif (ftype == \"\") {",
+ "\t\t// should not happen...",
+ "\t\t// so we are jut going to return without ",
+ "\t\tXcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"You must select a file type. \"",
+ "\t );",
+ "\t return;",
+ "\t\t ",
+ "\t}",
+ "\t",
+ "\t",
+ "\tvar fn = _this.name.el.get_text();",
+ "\t",
+ "\t ",
+ "\tvar ext = ftype;",
+ "\t//var dir = _this.project.path; ",
+ "\t ",
+ "\t var dir = _this.dir_dropdown.getValue();",
+ "\t",
+ "\t ",
+ "\t",
+ "\t ",
+ "\tvar targetfile = _this.project.path;",
+ "\tif (dir != \"\") {",
+ "\t\ttargetfile += dir;",
+ "\t}",
+ "\ttargetfile += \"/\" + fn;",
+ "\t",
+ "\t// strip the file type off the end..",
+ "\t",
+ "\ttry {",
+ "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
+ "\t\tfn = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
+ "\t } catch (RegexError e) {} // ignore.",
+ "\t ",
+ "\t targetfile += \".\" + ext;",
+ "\t ",
+ "\t ",
+ "\tif (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"That file already exists\"",
+ "\t ); ",
+ "\t return;",
+ "\t}",
+ "\tJsRender.JsRender f;",
+ " try {",
+ "\t f = JsRender.JsRender.factory(",
+ "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\", ",
+ "\t\t\t_this.file.project, ",
+ "\t\t\ttargetfile);",
+ "\t} catch (JsRender.Error e) {",
+ "\t\tXcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"Error creating file\"",
+ "\t ); ",
+ "\t\treturn;",
+ "\t}",
+ "\t_this.file = f;",
+ "\t",
+ "\t",
+ "",
+ "\t",
+ "\t_this.updateFileFromEntry();",
+ "\t_this.file.loaded = true;",
+ "\t_this.file.save();",
+ " _this.file.project.addFile(_this.file);",
+ " var sel = _this.filetype.getValue();",
+ "\t if (_this.file.project.xtype == \"Gtk\" && ",
+ "\t \t_this.file.build_module.length > 0 &&",
+ "\t \t( sel == \"bjs\" || sel == \"vala\")) {",
+ "\t ",
+ "\t\tvar pr = (Project.Gtk) _this.file.project;",
+ "\t\tif (pr.compilegroups.has_key(_this.file.build_module)) {",
+ "\t\t\tvar cg = pr.compilegroups.get(_this.file.build_module);",
+ "\t\t\tif (!cg.sources.contains(_this.file.relpath)) {",
+ "\t\t\t\tcg.sources.add(_this.file.relpath);",
+ "\t\t\t}",
+ "\t\t}",
+ "\t",
+ "\t}",
+ "\t ",
+ " ",
+ "\t// what about .js ?",
+ " _this.done = true;",
+ "\t_this.el.hide();",
+ "",
+ "// hopefull this will work with bjs files..",
+ "\t",
+ "\t_this.success(_this.project, _this.file);",
+ " ",
+ "}"
+ ]
+ },
+ "string icon_name" : "document-save",
+ "string label" : "Save",
+ "xtype" : "Button"
+ }
+ ],
+ "title" : "Add / Edit File",
+ "xtype" : "HeaderBar"
}
+ ],
+ "listeners" : {
+ "close_request" : [
+ "( ) => {",
+ "\t_this.el.hide();",
+ "\treturn true;",
+ "}",
+ ""
+ ]
+ },
+ "string title" : "Add / Edit File",
+ "uint border_width" : 0,
+ "xtype" : "Window",
+ "| void hideAll" : [
+ "() {",
+ "",
+ "\t// exiting only",
+ "\tthis.path_lbl.el.hide();",
+ " this.path.el.hide();",
+ " ",
+ " // new ",
+ " this.name_lbl.el.hide();",
+ " this.name.el.hide();",
+ " //new ",
+ " this.dir_dropdown_lbl.el.hide();",
+ " this.dir_dropdown.el.hide();",
+ "\t// roo",
+ "\tthis.title_lbl.el.hide();",
+ "\tthis.title.el.hide();",
+ "\t",
+ "\tthis.region_lbl.el.hide();",
+ "\tthis.region.el.hide();",
+ "\t",
+ "\tthis.parent_lbl.el.hide();",
+ "\tthis.parent.el.hide();",
+ "\t",
+ "\tthis.permname_lbl.el.hide();",
+ "\tthis.permname.el.hide();",
+ "\t",
+ "\tthis.modOrder_lbl.el.hide();",
+ "\tthis.modOrder.el.hide();",
+ "\t",
+ "\tthis.build_module_lbl.el.hide();",
+ "\tthis.build_module.el.hide();",
+ "\t",
+ "\tthis.gen_lbl.el.hide();",
+ "\tthis.gen.el.hide();",
+ "\t\tthis.filetype_lbl.el.hide();",
+ "\t\tthis.filetype.el.hide();",
+ "}\t"
+ ],
+ "| void onDirChanged" : [
+ "() {",
+ "if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\tthis.build_module_lbl.el.hide();",
+ "\t\tthis.build_module.el.hide();",
+ "\t\tthis.name_lbl.el.hide();",
+ "\t\tthis.name.el.hide();",
+ "\t\t ",
+ " \tthis.gen_lbl.el.hide();",
+ "\t\tthis.gen.el.hide();",
+ " ",
+ "\t\treturn;",
+ "\t\t",
+ "\t",
+ "\t}",
+ "\t// directory selected",
+ "\tvar sel = this.filetype.getValue();",
+ "\t",
+ "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
+ "\t\tthis.build_module_lbl.el.show();",
+ "\t\tthis.build_module.el.show();",
+ "\t}",
+ "\tthis.name_lbl.el.show();",
+ "\tthis.name.el.show();",
+ "\t",
+ "\tif (sel == \"bjs\") {",
+ " _this.gen_lbl.el.show();",
+ " _this.gen.el.show();",
+ " }",
+ " ",
+ " if (this.file.project.xtype == \"Roo\" && sel == \"bjs\") {",
+ " \tthis.title_lbl.el.show();",
+ "\t\tthis.title.el.show();",
+ "\t\t",
+ "\t\tthis.region_lbl.el.show();",
+ "\t\tthis.region.el.show();",
+ "\t\t",
+ "\t\tthis.parent_lbl.el.show();",
+ "\t\tthis.parent.el.show();",
+ "\t\t",
+ "\t\tthis.permname_lbl.el.show();",
+ "\t\tthis.permname.el.show();",
+ "\t\t",
+ "\t\tthis.modOrder_lbl.el.show();",
+ "\t\tthis.modOrder.el.show();",
+ "\t}",
+ " ",
+ " ",
+ "}"
+ ],
+ "| void onFileTypeChange" : [
+ "() {",
+ "\tif (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\tthis.dir_dropdown.el.hide();",
+ "\t\tthis.dir_dropdown_lbl.el.hide();",
+ "\t\tthis.build_module_lbl.el.hide();",
+ "\t\tthis.build_module.el.hide();",
+ "\t\tthis.name_lbl.el.hide();",
+ "\t\tthis.name.el.hide();",
+ "\t ",
+ " \tthis.gen_lbl.el.hide();",
+ "\t\tthis.gen.el.hide();",
+ " ",
+ " ",
+ " \tthis.title_lbl.el.hide();",
+ "\t\tthis.title.el.hide();",
+ "\t\t",
+ "\t\tthis.region_lbl.el.hide();",
+ "\t\tthis.region.el.hide();",
+ "\t\t",
+ "\t\tthis.parent_lbl.el.hide();",
+ "\t\tthis.parent.el.hide();",
+ "\t\t",
+ "\t\tthis.permname_lbl.el.hide();",
+ "\t\tthis.permname.el.hide();",
+ "\t\t",
+ "\t\tthis.modOrder_lbl.el.hide();",
+ "\t\tthis.modOrder.el.hide();",
+ " ",
+ "\t\treturn;",
+ "\t\t ",
+ "\t}",
+ "\t",
+ "\tthis.dir_dropdown.el.show();",
+ "\tthis.dir_dropdown_lbl.el.show();",
+ "\tvar sel = this.filetype.getValue();",
+ "\t",
+ "\tvar old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;",
+ "\tvar olddir = this.dir_dropdown.getValue();",
+ "\tGLib.debug(\"old dir = %s\", olddir);",
+ "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
+ "\t\t_this.project.loadDirsToStringList(_this.dir_model.el, \"/src\");",
+ "\t\tif (old_sel && olddir.has_prefix(\"/src\")) {",
+ "\t\t \tthis.dir_dropdown.setValue(olddir);",
+ " \t\t} else {",
+ "\t \t _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " \t }",
+ " ",
+ "\t} else {",
+ "",
+ " _this.project.loadDirsToStringList(_this.dir_model.el, \"\");",
+ "\t\tif (old_sel) {",
+ "\t\t\tthis.dir_dropdown.setValue(olddir);",
+ "\t\t} else {",
+ "\t\t _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "\t }",
+ " ",
+ " }",
+ "",
+ " ",
+ " // is this confusing? - should we just strip out / add if necessary..",
+ " if (sel == \"bjs\" || sel == \"vala\" || sel == \"js\" || sel == \"css\" || sel == \"php\") {",
+ " _this.name_lbl.el.label = \"Component Name (Filename with-out extension)\";\t\t\t\t ",
+ " } else {",
+ "\t _this.name_lbl.el.label = \"File Name (with extension)\";",
+ " }",
+ " ",
+ "}"
+ ],
+ "| void show" : [
+ "(JsRender.JsRender c, Gtk.Window pwin, bool new_window) ",
+ "{",
+ " ",
+ " this.project = c.project;",
+ " this.done = false;",
+ " this.new_window = new_window;",
+ " ",
+ " //if (!this.el) {",
+ " //this.init();",
+ " //} ",
+ " ",
+ " this.is_new = c.name == \"\";",
+ "",
+ " _this.name.el.set_text(c.name);",
+ " _this.title.el.set_text(c.title);",
+ " _this.parent.el.set_text(c.parent); ",
+ " _this.region.el.set_text(c.region);",
+ " _this.modOrder.el.set_text(c.modOrder);",
+ " _this.permname.el.set_text(c.permname);",
+ " ",
+ " _this.gen.el.active = c.gen_extended;",
+ " ",
+ "",
+ " ",
+ " if (this.project.xtype == \"Gtk\") {",
+ " \tvar p = (Project.Gtk) this.project;",
+ "\t this.build_module_model.load(p.compilegroups);",
+ "\t // it will select first if available...",
+ "\t // only for new files.",
+ "\t if (!this.is_new) {",
+ "\t\t this.build_module.setValue(c.build_module);",
+ "\t }",
+ " }",
+ "\t ",
+ " ",
+ " _this.file = c;",
+ " ",
+ " // this.el.set_size_request( 550, 100); // should expand height, but give a min width.",
+ "",
+ " this.el.set_transient_for(pwin);",
+ " ",
+ " // window + header?",
+ " this.hideAll();",
+ " this.el.show();",
+ " // this.name.el.grab_focus();",
+ " ",
+ " ",
+ " if (!this.is_new) {",
+ "\t this.showEditFile();",
+ " } else {",
+ " \tthis.showNewFile();",
+ "\t\t ",
+ " ",
+ "\t ",
+ " }",
+ " ",
+ " ",
+ " //this.success = c.success;",
+ " ",
+ " ",
+ "}"
+ ],
+ "| void showEditFile" : [
+ "() {",
+ " \tthis.save_btn.el.set_label(\"Save\");",
+ "\tthis.filetype_lbl.el.hide();",
+ "\tthis.filetype.el.hide();",
+ "\t\t ",
+ "\tvar sel = this.filetype.getValue();",
+ "\tswitch(_this.project.xtype) {",
+ "\t\tcase \"Roo\":\t ",
+ "\t\t\t if (sel == \"bjs\") {",
+ "\t\t\t\t_this.title_lbl.el.show();",
+ "\t\t\t\t_this.title.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.region_lbl.el.show();",
+ "\t\t\t\t_this.region.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.parent_lbl.el.show();",
+ "\t\t\t\t_this.parent.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.permname_lbl.el.show();",
+ "\t\t\t\t_this.permname.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.modOrder_lbl.el.show();",
+ "\t\t\t\t_this.modOrder.el.show();",
+ "\t\t\t",
+ "\t\t\t}",
+ "\t\t\tbreak;",
+ "\t\tdefault:",
+ "\t\t\t_this.build_module_lbl.el.show();",
+ "\t\t\t_this.build_module.el.show();\t",
+ "\t\t\t",
+ "\t\t\tif (sel == \"bjs\") {",
+ "\t\t\t",
+ "\t\t\t\t _this.gen_lbl.el.show();",
+ "\t\t\t\t_this.gen.el.show();",
+ "\t\t\t}",
+ "\t\t\tbreak;",
+ "\t}",
+ "\tthis.path.el.show();",
+ "\tthis.path_lbl.el.show();",
+ "\tthis.path.el.set_text(_this.file.relpath);",
+ "}"
+ ],
+ "| void showNewFile" : [
+ "() {",
+ " \tthis.save_btn.el.set_label(\"Create\");",
+ " \tthis.hideAll();",
+ " \tthis.filetype.el.show();",
+ " this.filetype_lbl.el.show();",
+ " this.filetype_model.load();",
+ "\tthis.filetype.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " ",
+ "\t ",
+ "}"
+ ],
+ "| void updateFileFromEntry" : [
+ "() {",
+ "",
+ " _this.file.title = _this.title.el.get_text();",
+ " _this.file.region = _this.region.el.get_text(); ",
+ " _this.file.parent = _this.parent.el.get_text(); ",
+ " _this.file.permname = _this.permname.el.get_text(); ",
+ " _this.file.modOrder = _this.modOrder.el.get_text();",
+ " _this.file.gen_extended = _this.gen.el.active;",
+ " var new_name = _this.name.el.get_text();",
+ " if (_this.file.name.length > 0 && _this.file.name != new_name) {",
+ " try {",
+ " \t_this.file.renameTo( new_name );",
+ " \t} catch (JsRender.Error e) { } // do nothing?",
+ " }",
+ " ",
+ " _this.file.build_module = _this.build_module.getValue();",
+ "\t\t",
+ " ",
+ " ",
+ "",
+ " ",
+ "} "
]
}
- ]
+ ],
+ "name" : "PopoverFileDetails"
}
\ No newline at end of file