- static Xcls_PopoverFileDetails _PopoverFileDetails;
-
- public class Xcls_PopoverFileDetails : Object
- {
- public Gtk.Window el;
- private Xcls_PopoverFileDetails _this;
-
- public static Xcls_PopoverFileDetails singleton()
- {
- if (_PopoverFileDetails == null) {
- _PopoverFileDetails= new Xcls_PopoverFileDetails();
- }
- return _PopoverFileDetails;
- }
- public Xcls_grid grid;
- public Xcls_filetype_lbl filetype_lbl;
- public Xcls_filetype filetype;
- public Xcls_filetype_model filetype_model;
- public Xcls_dir_dropdown_lbl dir_dropdown_lbl;
- public Xcls_dir_dropdown dir_dropdown;
- public Xcls_dir_model dir_model;
- public Xcls_name_lbl name_lbl;
- public Xcls_name name;
- public Xcls_title_lbl title_lbl;
- public Xcls_title title;
- public Xcls_region_lbl region_lbl;
- public Xcls_region region;
- public Xcls_parent_lbl parent_lbl;
- public Xcls_parent parent;
- public Xcls_permname_lbl permname_lbl;
- public Xcls_permname permname;
- public Xcls_modOrder_lbl modOrder_lbl;
- public Xcls_modOrder modOrder;
- public Xcls_build_module_lbl build_module_lbl;
- public Xcls_build_module build_module;
- public Xcls_build_module_model build_module_model;
- public Xcls_path_lbl path_lbl;
- public Xcls_path path;
- public Xcls_gen_lbl gen_lbl;
- public Xcls_gen gen;
- public Xcls_save_btn save_btn;
-
- // my vars (def)
- public bool is_new;
- public bool new_window;
- public signal void success (Project.Project pr, JsRender.JsRender file);
- public JsRender.JsRender file;
- public Project.Project project;
- public uint border_width;
- public bool done;
- public Xcls_MainWindow mainwindow;
-
- // ctor
- public Xcls_PopoverFileDetails()
- {
- _this = this;
- this.el = new Gtk.Window();
-
- // my vars (dec)
- this.is_new = true;
- this.new_window = true;
- this.file = null;
- this.border_width = 0;
- this.done = false;
- this.mainwindow = null;
-
- // set gobject values
- this.el.title = "Add / Edit File";
- this.el.modal = true;
- var child_1 = new Xcls_Box2( _this );
- child_1.ref();
- this.el.set_child ( child_1.el );
- var child_2 = new Xcls_HeaderBar29( _this );
- this.el.titlebar = child_2.el;
-
- //listeners
- this.el.close_request.connect( ( ) => {
- _this.el.hide();
- return true;
- });
- }
-
- // user defined functions
- public void onDirChanged () {
- if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {
- this.build_module_lbl.el.hide();
- this.build_module.el.hide();
- this.name_lbl.el.hide();
- this.name.el.hide();
-
- this.gen_lbl.el.hide();
- this.gen.el.hide();
-
- return;
-
-
- }
- // directory selected
- var sel = this.filetype.getValue();
-
- if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
- this.build_module_lbl.el.show();
- this.build_module.el.show();
- }
- this.name_lbl.el.show();
- this.name.el.show();
-
- if (sel == "bjs") {
- _this.gen_lbl.el.show();
- _this.gen.el.show();
- }
-
- if (this.file.project.xtype == "Roo" && sel == "bjs") {
- this.title_lbl.el.show();
- this.title.el.show();
-
- this.region_lbl.el.show();
- this.region.el.show();
-
- this.parent_lbl.el.show();
- this.parent.el.show();
-
- this.permname_lbl.el.show();
- this.permname.el.show();
-
- this.modOrder_lbl.el.show();
- this.modOrder.el.show();
- }
-
-
- }
- public void showEditFile () {
- this.save_btn.el.set_label("Save");
- this.filetype_lbl.el.hide();
- this.filetype.el.hide();
-
- var sel = this.filetype.getValue();
- switch(_this.project.xtype) {
- case "Roo":
- if (sel == "bjs") {
- _this.title_lbl.el.show();
- _this.title.el.show();
-
- _this.region_lbl.el.show();
- _this.region.el.show();
-
- _this.parent_lbl.el.show();
- _this.parent.el.show();
-
- _this.permname_lbl.el.show();
- _this.permname.el.show();
-
- _this.modOrder_lbl.el.show();
- _this.modOrder.el.show();
-
- }
- break;
- default:
- _this.build_module_lbl.el.show();
- _this.build_module.el.show();
-
- if (sel == "bjs") {
-
- _this.gen_lbl.el.show();
- _this.gen.el.show();
- }
- break;
- }
- this.path.el.show();
- this.path_lbl.el.show();
- this.path.el.set_text(_this.file.relpath);
- }
- public 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") {
- var p = (Project.Gtk) this.project;
- this.build_module_model.load(p.compilegroups);
- // it will select first if available...
- // only for new files.
- if (!this.is_new) {
- this.build_module.setValue(c.build_module);
- }
- }
-
-
- _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) {
- this.showEditFile();
- } else {
- this.showNewFile();
-
-
-
- }
-
-
- //this.success = c.success;
-
-
- }
- public 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 {
- _this.file.renameTo( new_name );
- } catch (JsRender.Error e) { } // do nothing?
- }
-
- _this.file.build_module = _this.build_module.getValue();
-
-
-
-
-
- }
- public void onFileTypeChange () {
- if (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {
- this.dir_dropdown.el.hide();
- this.dir_dropdown_lbl.el.hide();
- this.build_module_lbl.el.hide();
- this.build_module.el.hide();
- this.name_lbl.el.hide();
- this.name.el.hide();
-
- this.gen_lbl.el.hide();
- this.gen.el.hide();
-
-
- this.title_lbl.el.hide();
- this.title.el.hide();
-
- this.region_lbl.el.hide();
- this.region.el.hide();
-
- this.parent_lbl.el.hide();
- this.parent.el.hide();
-
- this.permname_lbl.el.hide();
- this.permname.el.hide();
-
- this.modOrder_lbl.el.hide();
- this.modOrder.el.hide();
-
- return;
-
- }
-
- this.dir_dropdown.el.show();
- this.dir_dropdown_lbl.el.show();
- var sel = this.filetype.getValue();
-
- var old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;
- var olddir = this.dir_dropdown.getValue();
- GLib.debug("old dir = %s", olddir);
- if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
- _this.project.loadDirsToStringList(_this.dir_model.el, "/src");
- if (old_sel && olddir.has_prefix("/src")) {
- this.dir_dropdown.setValue(olddir);
- } else {
- _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
- }
-
- } else {
-
- _this.project.loadDirsToStringList(_this.dir_model.el, "");
- if (old_sel) {
- this.dir_dropdown.setValue(olddir);
- } else {
- _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
- }
-
- }
-
-
- // 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)";
- } else {
- _this.name_lbl.el.label = "File Name (with extension)";
- }
-
- }
- public void showNewFile () {
- this.save_btn.el.set_label("Create");
- this.hideAll();
- this.filetype.el.show();
- this.filetype_lbl.el.show();
- this.filetype_model.load();
- this.filetype.el.selected = Gtk.INVALID_LIST_POSITION;
-
-
- }
- public void hideAll () {
-
- // exiting only
- this.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();
- // roo
- this.title_lbl.el.hide();
- this.title.el.hide();
-
- this.region_lbl.el.hide();
- this.region.el.hide();
-
- this.parent_lbl.el.hide();
- this.parent.el.hide();
-
- this.permname_lbl.el.hide();
- this.permname.el.hide();
-
- this.modOrder_lbl.el.hide();
- this.modOrder.el.hide();
-
- this.build_module_lbl.el.hide();
- this.build_module.el.hide();
-
- this.gen_lbl.el.hide();
- this.gen.el.hide();
- this.filetype_lbl.el.hide();
- this.filetype.el.hide();
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.hexpand = true;
- this.el.margin_bottom = 4;
- this.el.margin_top = 4;
- new Xcls_grid( _this );
- this.el.append ( _this.grid.el );
- }
-
- // user defined functions
- }
- public class Xcls_grid : Object
- {
- public Gtk.Grid el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_grid(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.grid = this;
- this.el = new Gtk.Grid();
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.hexpand = true;
- this.el.column_spacing = 4;
- this.el.row_spacing = 2;
- new Xcls_filetype_lbl( _this );
- this.el.attach( _this.filetype_lbl.el, 0, 0, 1, 1 );
- new Xcls_filetype( _this );
- this.el.attach( _this.filetype.el, 1, 0, 1, 1 );
- new Xcls_dir_dropdown_lbl( _this );
- this.el.attach( _this.dir_dropdown_lbl.el, 0, 1, 1, 1 );
- new Xcls_dir_dropdown( _this );
- this.el.attach( _this.dir_dropdown.el, 1, 1, 1, 1 );
- new Xcls_name_lbl( _this );
- this.el.attach( _this.name_lbl.el, 0, 2, 1, 1 );
- new Xcls_name( _this );
- this.el.attach( _this.name.el, 1, 2, 1, 1 );
- new Xcls_title_lbl( _this );
- this.el.attach( _this.title_lbl.el, 0, 3, 1, 1 );
- new Xcls_title( _this );
- this.el.attach ( _this.title.el , 1,2,1,1 );
- new Xcls_region_lbl( _this );
- this.el.attach( _this.region_lbl.el, 0, 4, 1, 1 );
- new Xcls_region( _this );
- this.el.attach( _this.region.el, 1, 4, 1, 1 );
- new Xcls_parent_lbl( _this );
- this.el.attach( _this.parent_lbl.el, 0, 5, 1, 1 );
- new Xcls_parent( _this );
- this.el.attach( _this.parent.el, 1, 5, 1, 1 );
- new Xcls_permname_lbl( _this );
- this.el.attach( _this.permname_lbl.el, 0, 6, 1, 1 );
- new Xcls_permname( _this );
- this.el.attach( _this.permname.el, 1, 6, 1, 1 );
- new Xcls_modOrder_lbl( _this );
- this.el.attach( _this.modOrder_lbl.el, 0, 7, 1, 1 );
- new Xcls_modOrder( _this );
- this.el.attach( _this.modOrder.el, 1, 7, 1, 1 );
- new Xcls_build_module_lbl( _this );
- this.el.attach( _this.build_module_lbl.el, 0, 8, 1, 1 );
- new Xcls_build_module( _this );
- this.el.attach( _this.build_module.el, 1, 8, 1, 1 );
- new Xcls_path_lbl( _this );
- this.el.attach( _this.path_lbl.el, 0, 9, 1, 1 );
- new Xcls_path( _this );
- this.el.attach( _this.path.el, 1, 9, 1, 1 );
- new Xcls_gen_lbl( _this );
- this.el.attach( _this.gen_lbl.el, 0, 10, 1, 1 );
- new Xcls_gen( _this );
- this.el.attach( _this.gen.el, 1, 10, 1, 1 );
- }
-
- // user defined functions
- public void xhideRow (int row)
- {
- var el = _this.grid.el.get_child_at(0,row);
-
- el.hide();
- el = _this.grid.el.get_child_at(1,row);
- el.hide();
-
- }
- public void xshowAllRows () {
- for (var i = 2; i < 10;i++) {
- var el = _this.grid.el.get_child_at(0,i);
- el.show();
- el = _this.grid.el.get_child_at(1,i);
- el.show();
- }
- }
- }
- public class Xcls_filetype_lbl : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.filetype_lbl = this;
- this.el = new Gtk.Label( "File type" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- }
-
- // user defined functions
- }
-
- public class Xcls_filetype : Object
- {
- public Gtk.DropDown el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
- public bool in_showhide;
-
- // ctor
- public Xcls_filetype(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.filetype = this;
- new Xcls_filetype_model( _this );
- this.el = new Gtk.DropDown( _this.filetype_model.el, null );
-
- // my vars (dec)
- this.in_showhide = false;
-
- // set gobject values
- this.el.hexpand = true;
-
- //listeners
- this.el.notify["selected"].connect( () => {
-
- _this.onFileTypeChange();
-
- });
- }
-
- // user defined functions
- public string getValue () {
-
- if (!_this.is_new) {
- return _this.file.xtype != "Plainfile" ? "bjs" : _this.file.file_ext;
- }
-
- if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
- return "";
- }
-
- return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
- }
- public void setValue (string cur) {
- var el = _this.filetype_model.el;
- for(var i= 0; i < el.get_n_items();i++) {
- if (el.get_string(i).has_prefix(cur)) {
- this.el.selected = i;
- break;
- }
- }
- }
- }
- public class Xcls_filetype_model : Object
- {
- public Gtk.StringList el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.filetype_model = this;
- this.el = new Gtk.StringList( {} );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void load () {
- var el = this.el;
-
- while (el.get_n_items() > 0) {
- el.remove(0);
- }
- el.append("bjs - User Interface File");
-
-
- switch(_this.project.xtype) {
- case "Roo":
- el.append("js - Javascript File");
- el.append("css - CSS File");
- el.append("php - Javascript File");
-
- break;
-
- case "Gtk":
-
- el.append("vala - Vala File");
- el.append("css - CSS File");
- el.append("other - Other Type");
- break;
- default :
- break;
- }
-
-
-
-
- }
- }
-
-
- public class Xcls_dir_dropdown_lbl : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.dir_dropdown_lbl = this;
- this.el = new Gtk.Label( "Create File in this Directory" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_dir_dropdown : Object
- {
- public Gtk.DropDown el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
- public int colspan;
-
- // ctor
- public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.dir_dropdown = this;
- new Xcls_dir_model( _this );
- this.el = new Gtk.DropDown( _this.dir_model.el, null );
-
- // my vars (dec)
- this.colspan = 1;
-
- // set gobject values
-
- //listeners
- this.el.notify["selected"].connect( () => {
-
- _this.onDirChanged();
-
-
-
- });
- }
-
- // user defined functions
- public string getValue () {
- return _this.dir_model.el.get_string(this.el.selected);
- }
- public void setValue (string cur) {
- var el = _this.dir_model.el;
- for(var i= 0; i < el.get_n_items();i++) {
- if (el.get_string(i) == cur) {
- this.el.selected = i;
- break;
- }
- }
- }
- }
- public class Xcls_dir_model : Object
- {
- public Gtk.StringList el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.dir_model = this;
- this.el = new Gtk.StringList( {} );
-
- // my vars (dec)
+static Xcls_PopoverFileDetails _PopoverFileDetails;
+
+public class Xcls_PopoverFileDetails : Object
+{
+ public Gtk.Window el;
+ private Xcls_PopoverFileDetails _this;
+
+ public static Xcls_PopoverFileDetails singleton()
+ {
+ if (_PopoverFileDetails == null) {
+ _PopoverFileDetails= new Xcls_PopoverFileDetails();
+ }
+ return _PopoverFileDetails;
+ }
+ public Xcls_grid grid;
+ public Xcls_filetype_lbl filetype_lbl;
+ public Xcls_filetype filetype;
+ public Xcls_filetype_model filetype_model;
+ public Xcls_dir_dropdown_lbl dir_dropdown_lbl;
+ public Xcls_dir_dropdown dir_dropdown;
+ public Xcls_dir_model dir_model;
+ public Xcls_name_lbl name_lbl;
+ public Xcls_name name;
+ public Xcls_title_lbl title_lbl;
+ public Xcls_title title;
+ public Xcls_region_lbl region_lbl;
+ public Xcls_region region;
+ public Xcls_parent_lbl parent_lbl;
+ public Xcls_parent parent;
+ public Xcls_permname_lbl permname_lbl;
+ public Xcls_permname permname;
+ public Xcls_modOrder_lbl modOrder_lbl;
+ public Xcls_modOrder modOrder;
+ public Xcls_build_module_lbl build_module_lbl;
+ public Xcls_build_module build_module;
+ public Xcls_build_module_model build_module_model;
+ public Xcls_path_lbl path_lbl;
+ public Xcls_path path;
+ public Xcls_gen_lbl gen_lbl;
+ public Xcls_gen gen;
+ public Xcls_save_btn save_btn;
+
+ // my vars (def)
+ public bool is_new;
+ public bool new_window;
+ public signal void success (Project.Project pr, JsRender.JsRender file);
+ public JsRender.JsRender file;
+ public Project.Project project;
+ public uint border_width;
+ public bool done;
+ public Xcls_MainWindow mainwindow;
+
+ // ctor
+ public Xcls_PopoverFileDetails()
+ {
+ _this = this;
+ this.el = new Gtk.Window();
+
+ // my vars (dec)
+ this.is_new = true;
+ this.new_window = true;
+ this.file = null;
+ this.border_width = 0;
+ this.done = false;
+ this.mainwindow = null;
+
+ // set gobject values
+ this.el.title = "Add / Edit File";
+ this.el.modal = true;
+ var child_1 = new Xcls_Box1( _this );
+ child_1.ref();
+ this.el.set_child ( child_1.el );
+ var child_2 = new Xcls_HeaderBar28( _this );
+ child_2.ref();
+ this.el.titlebar = child_2.el;
+
+ //listeners
+ this.el.close_request.connect( ( ) => {
+ _this.el.hide();
+ return true;
+ });
+ }
+
+ // user defined functions
+ public void onDirChanged () {
+ if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {
+ this.build_module_lbl.el.hide();
+ this.build_module.el.hide();
+ this.name_lbl.el.hide();
+ this.name.el.hide();
+
+ this.gen_lbl.el.hide();
+ this.gen.el.hide();
+
+ return;
+
+
+ }
+ // directory selected
+ var sel = this.filetype.getValue();
+
+ if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
+ this.build_module_lbl.el.show();
+ this.build_module.el.show();
+ }
+ this.name_lbl.el.show();
+ this.name.el.show();
+
+ if (sel == "bjs") {
+ _this.gen_lbl.el.show();
+ _this.gen.el.show();
+ }
+
+ if (this.file.project.xtype == "Roo" && sel == "bjs") {
+ this.title_lbl.el.show();
+ this.title.el.show();
+
+ this.region_lbl.el.show();
+ this.region.el.show();
+
+ this.parent_lbl.el.show();
+ this.parent.el.show();
+
+ this.permname_lbl.el.show();
+ this.permname.el.show();
+
+ this.modOrder_lbl.el.show();
+ this.modOrder.el.show();
+ }
+
+
+ }
+ public void showEditFile () {
+ this.save_btn.el.set_label("Save");
+ this.filetype_lbl.el.hide();
+ this.filetype.el.hide();
+
+ var sel = this.filetype.getValue();
+ switch(_this.project.xtype) {
+ case "Roo":
+ if (sel == "bjs") {
+ _this.title_lbl.el.show();
+ _this.title.el.show();
+
+ _this.region_lbl.el.show();
+ _this.region.el.show();
+
+ _this.parent_lbl.el.show();
+ _this.parent.el.show();
+
+ _this.permname_lbl.el.show();
+ _this.permname.el.show();
+
+ _this.modOrder_lbl.el.show();
+ _this.modOrder.el.show();
+
+ }
+ break;
+ default:
+ _this.build_module_lbl.el.show();
+ _this.build_module.el.show();
+
+ if (sel == "bjs") {
+
+ _this.gen_lbl.el.show();
+ _this.gen.el.show();
+ }
+ break;
+ }
+ this.path.el.show();
+ this.path_lbl.el.show();
+ this.path.el.set_text(_this.file.relpath);
+ }
+ public 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") {
+ var p = (Project.Gtk) this.project;
+ this.build_module_model.load(p.compilegroups);
+ // it will select first if available...
+ // only for new files.
+ if (!this.is_new) {
+ this.build_module.setValue(c.build_module);
+ }
+ }
+
+
+ _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) {
+ this.showEditFile();
+ } else {
+ this.showNewFile();
+
+
+
+ }
+
+
+ //this.success = c.success;
+
+
+ }
+ public 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 {
+ _this.file.renameTo( new_name );
+ } catch (JsRender.Error e) { } // do nothing?
+ }
+
+ _this.file.build_module = _this.build_module.getValue();
+
+
+
+
+
+ }
+ public void onFileTypeChange () {
+ if (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {
+ this.dir_dropdown.el.hide();
+ this.dir_dropdown_lbl.el.hide();
+ this.build_module_lbl.el.hide();
+ this.build_module.el.hide();
+ this.name_lbl.el.hide();
+ this.name.el.hide();
+
+ this.gen_lbl.el.hide();
+ this.gen.el.hide();
+
+
+ this.title_lbl.el.hide();
+ this.title.el.hide();
+
+ this.region_lbl.el.hide();
+ this.region.el.hide();
+
+ this.parent_lbl.el.hide();
+ this.parent.el.hide();
+
+ this.permname_lbl.el.hide();
+ this.permname.el.hide();
+
+ this.modOrder_lbl.el.hide();
+ this.modOrder.el.hide();
+
+ return;
+
+ }
+
+ this.dir_dropdown.el.show();
+ this.dir_dropdown_lbl.el.show();
+ var sel = this.filetype.getValue();
+
+ var old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;
+ var olddir = this.dir_dropdown.getValue();
+ GLib.debug("old dir = %s", olddir);
+ if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
+ _this.project.loadDirsToStringList(_this.dir_model.el, "/src");
+ if (old_sel && olddir.has_prefix("/src")) {
+ this.dir_dropdown.setValue(olddir);
+ } else {
+ _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
+ }
+
+ } else {
+
+ _this.project.loadDirsToStringList(_this.dir_model.el, "");
+ if (old_sel) {
+ this.dir_dropdown.setValue(olddir);
+ } else {
+ _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
+ }
+
+ }
+
+
+ // 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)";
+ } else {
+ _this.name_lbl.el.label = "File Name (with extension)";
+ }
+
+ }
+ public void showNewFile () {
+ this.save_btn.el.set_label("Create");
+ this.hideAll();
+ this.filetype.el.show();
+ this.filetype_lbl.el.show();
+ this.filetype_model.load();
+ this.filetype.el.selected = Gtk.INVALID_LIST_POSITION;
+
+
+ }
+ public void hideAll () {
+
+ // exiting only
+ this.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();
+ // roo
+ this.title_lbl.el.hide();
+ this.title.el.hide();
+
+ this.region_lbl.el.hide();
+ this.region.el.hide();
+
+ this.parent_lbl.el.hide();
+ this.parent.el.hide();
+
+ this.permname_lbl.el.hide();
+ this.permname.el.hide();
+
+ this.modOrder_lbl.el.hide();
+ this.modOrder.el.hide();
+
+ this.build_module_lbl.el.hide();
+ this.build_module.el.hide();
+
+ this.gen_lbl.el.hide();
+ this.gen.el.hide();
+ this.filetype_lbl.el.hide();
+ this.filetype.el.hide();
+ }
+ public class Xcls_Box1 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box1(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ this.el.hexpand = true;
+ this.el.margin_bottom = 4;
+ this.el.margin_top = 4;
+ new Xcls_grid( _this );
+ this.el.append ( _this.grid.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_grid : Object
+ {
+ public Gtk.Grid el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_grid(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.grid = this;
+ this.el = new Gtk.Grid();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ this.el.hexpand = true;
+ this.el.column_spacing = 4;
+ this.el.row_spacing = 2;
+ new Xcls_filetype_lbl( _this );
+ this.el.attach( _this.filetype_lbl.el, 0, 0, 1, 1 );
+ new Xcls_filetype( _this );
+ this.el.attach( _this.filetype.el, 1, 0, 1, 1 );
+ new Xcls_dir_dropdown_lbl( _this );
+ this.el.attach( _this.dir_dropdown_lbl.el, 0, 1, 1, 1 );
+ new Xcls_dir_dropdown( _this );
+ this.el.attach( _this.dir_dropdown.el, 1, 1, 1, 1 );
+ new Xcls_name_lbl( _this );
+ this.el.attach( _this.name_lbl.el, 0, 2, 1, 1 );
+ new Xcls_name( _this );
+ this.el.attach( _this.name.el, 1, 2, 1, 1 );
+ new Xcls_title_lbl( _this );
+ this.el.attach( _this.title_lbl.el, 0, 3, 1, 1 );
+ new Xcls_title( _this );
+ this.el.attach( _this.title.el, 1, 3, 1, 1 );
+ new Xcls_region_lbl( _this );
+ this.el.attach( _this.region_lbl.el, 0, 4, 1, 1 );
+ new Xcls_region( _this );
+ this.el.attach( _this.region.el, 1, 4, 1, 1 );
+ new Xcls_parent_lbl( _this );
+ this.el.attach( _this.parent_lbl.el, 0, 5, 1, 1 );
+ new Xcls_parent( _this );
+ this.el.attach( _this.parent.el, 1, 5, 1, 1 );
+ new Xcls_permname_lbl( _this );
+ this.el.attach( _this.permname_lbl.el, 0, 6, 1, 1 );
+ new Xcls_permname( _this );
+ this.el.attach( _this.permname.el, 1, 6, 1, 1 );
+ new Xcls_modOrder_lbl( _this );
+ this.el.attach( _this.modOrder_lbl.el, 0, 7, 1, 1 );
+ new Xcls_modOrder( _this );
+ this.el.attach( _this.modOrder.el, 1, 7, 1, 1 );
+ new Xcls_build_module_lbl( _this );
+ this.el.attach( _this.build_module_lbl.el, 0, 8, 1, 1 );
+ new Xcls_build_module( _this );
+ this.el.attach( _this.build_module.el, 1, 8, 1, 1 );
+ new Xcls_path_lbl( _this );
+ this.el.attach( _this.path_lbl.el, 0, 9, 1, 1 );
+ new Xcls_path( _this );
+ this.el.attach( _this.path.el, 1, 9, 1, 1 );
+ new Xcls_gen_lbl( _this );
+ this.el.attach( _this.gen_lbl.el, 0, 10, 1, 1 );
+ new Xcls_gen( _this );
+ this.el.attach( _this.gen.el, 1, 10, 1, 1 );
+ }
+
+ // user defined functions
+ public void xhideRow (int row)
+ {
+ var el = _this.grid.el.get_child_at(0,row);
+
+ el.hide();
+ el = _this.grid.el.get_child_at(1,row);
+ el.hide();
+
+ }
+ public void xshowAllRows () {
+ for (var i = 2; i < 10;i++) {
+ var el = _this.grid.el.get_child_at(0,i);
+ el.show();
+ el = _this.grid.el.get_child_at(1,i);
+ el.show();
+ }
+ }
+ }
+ public class Xcls_filetype_lbl : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.filetype_lbl = this;
+ this.el = new Gtk.Label( "File type" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_filetype : Object
+ {
+ public Gtk.DropDown el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+ public bool in_showhide;
+
+ // ctor
+ public Xcls_filetype(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.filetype = this;
+ new Xcls_filetype_model( _this );
+ this.el = new Gtk.DropDown( _this.filetype_model.el, null );
+
+ // my vars (dec)
+ this.in_showhide = false;
+
+ // set gobject values
+ this.el.hexpand = true;
+
+ //listeners
+ this.el.notify["selected"].connect( () => {
+
+ _this.onFileTypeChange();
+
+ });
+ }
+
+ // user defined functions
+ public string getValue () {
+
+ if (!_this.is_new) {
+ return _this.file.xtype != "Plainfile" ? "bjs" : _this.file.file_ext;
+ }
+
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ return "";
+ }
+
+ return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
+ }
+ public void setValue (string cur) {
+ var el = _this.filetype_model.el;
+ for(var i= 0; i < el.get_n_items();i++) {
+ if (el.get_string(i).has_prefix(cur)) {
+ this.el.selected = i;
+ break;
+ }
+ }
+ }
+ }
+ public class Xcls_filetype_model : Object
+ {
+ public Gtk.StringList el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.filetype_model = this;
+ this.el = new Gtk.StringList( {} );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public void load () {
+ var el = this.el;
+
+ while (el.get_n_items() > 0) {
+ el.remove(0);
+ }
+ el.append("bjs - User Interface File");
+
+
+ switch(_this.project.xtype) {
+ case "Roo":
+ el.append("js - Javascript File");
+ el.append("css - CSS File");
+ el.append("php - Javascript File");
+
+ break;
+
+ case "Gtk":
+
+ el.append("vala - Vala File");
+ el.append("css - CSS File");
+ el.append("other - Other Type");
+ break;
+ default :
+ break;
+ }
+
+
+
+
+ }
+ }
+
+
+ public class Xcls_dir_dropdown_lbl : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.dir_dropdown_lbl = this;
+ this.el = new Gtk.Label( "Create File in this Directory" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_dir_dropdown : Object
+ {
+ public Gtk.DropDown el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+ public int colspan;
+
+ // ctor
+ public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.dir_dropdown = this;
+ new Xcls_dir_model( _this );
+ this.el = new Gtk.DropDown( _this.dir_model.el, null );
+
+ // my vars (dec)
+ this.colspan = 1;
+
+ // set gobject values
+
+ //listeners
+ this.el.notify["selected"].connect( () => {
+
+ _this.onDirChanged();
+
+
+
+ });
+ }
+
+ // user defined functions
+ public string getValue () {
+ return _this.dir_model.el.get_string(this.el.selected);
+ }
+ public void setValue (string cur) {
+ var el = _this.dir_model.el;
+ for(var i= 0; i < el.get_n_items();i++) {
+ if (el.get_string(i) == cur) {
+ this.el.selected = i;
+ break;
+ }
+ }
+ }
+ }
+ public class Xcls_dir_model : Object
+ {
+ public Gtk.StringList el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.dir_model = this;
+ this.el = new Gtk.StringList( {} );
+
+ // my vars (dec)