From 0dd69a5e8671000fd2f3303aa0f5331198d60d72 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 4 Jan 2024 18:43:12 +0800 Subject: [PATCH] Fix #7959 - new project flow - use void func to callback after each step, tidy up create project and create file dialogs --- src/Builder4/DialogFiles.bjs | 26 +- src/Builder4/DialogFiles.vala | 126 +++--- src/Builder4/EditProject.bjs | 34 +- src/Builder4/EditProject.vala | 32 +- src/Builder4/MainWindow.bjs | 9 +- src/Builder4/MainWindow.vala | 9 +- src/Builder4/PopoverFileDetails.bjs | 181 ++++++--- src/Builder4/PopoverFileDetails.vala | 406 +++++++++++-------- src/Builder4/ValaProjectSettingsPopover.bjs | 18 +- src/Builder4/ValaProjectSettingsPopover.vala | 20 +- src/Builder4/WindowState.vala | 4 +- src/JsRender/JsRender.vala | 11 +- src/Project/Project.vala | 18 +- 13 files changed, 536 insertions(+), 358 deletions(-) diff --git a/src/Builder4/DialogFiles.bjs b/src/Builder4/DialogFiles.bjs index 1ecf130f9..d53a5a2d1 100644 --- a/src/Builder4/DialogFiles.bjs +++ b/src/Builder4/DialogFiles.bjs @@ -906,21 +906,25 @@ " pe.el.application = _this.win.el.application;", " pe.el.set_transient_for( _this.el );", " ", - " ", - " pe.selected.connect((pr) => {", - " \t ", - "\t _this.show( pr, _this.new_window);", - "", - " });", - " ", + " var cb = new Project.Callback();", + " cb.call.connect((pr) => {", + " \t_this.show( pr , _this.new_window);", + "\t});", " ", - " pe.show();", + " pe.show( cb);", " ", "", "}" ] }, - "xtype" : "Button" + "xtype" : "Button", + "| void onCreated" : [ + "() {", + "\tvar pe = EditProject.singleton();", + "", + "\t_this.show( pe.result , _this.new_window);", + "}" + ] }, { "$ xns" : "Gtk", @@ -955,7 +959,7 @@ " if (_this.selectedProject == null) {", "\t return;", " }", - "\t_this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject);", + "\t_this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);", " }" ] }, @@ -1272,7 +1276,7 @@ " ", "\t", "\t this.el.show();", - "\t \tthis.load();", + " this.load();", "\tthis.selectProject(project);", "\tthis.onProjectSelected(project); //?? twice?", "\t ", diff --git a/src/Builder4/DialogFiles.vala b/src/Builder4/DialogFiles.vala index 5b5d5b0f4..36e438759 100644 --- a/src/Builder4/DialogFiles.vala +++ b/src/Builder4/DialogFiles.vala @@ -160,7 +160,7 @@ this.el.show(); - this.load(); + this.load(); this.selectProject(project); this.onProjectSelected(project); //?? twice? @@ -222,8 +222,8 @@ var child_1 = new Xcls_Box3( _this ); child_1.ref(); this.el.append( child_1.el ); - var child_2 = new Xcls_mainpane( _this ); - this.el.append( child_2.el ); + new Xcls_mainpane( _this ); + this.el.append( _this.mainpane.el ); } // user defined functions @@ -276,10 +276,10 @@ this.el.hexpand = true; this.el.vexpand = true; this.el.position = 200; - var child_1 = new Xcls_projectscroll( _this ); - this.el.start_child = child_1.el; - var child_2 = new Xcls_filepane( _this ); - this.el.end_child = child_2.el; + new Xcls_projectscroll( _this ); + this.el.start_child = _this.projectscroll.el; + new Xcls_filepane( _this ); + this.el.end_child = _this.filepane.el; } // user defined functions @@ -308,8 +308,8 @@ this.el.has_frame = true; this.el.hexpand = true; this.el.vexpand = true; - var child_1 = new Xcls_project_list( _this ); - this.el.child = child_1.el; + new Xcls_project_list( _this ); + this.el.child = _this.project_list.el; // init method @@ -332,8 +332,8 @@ { _this = _owner; _this.project_list = this; - var child_1 = new Xcls_projectselection( _this ); - this.el = new Gtk.ColumnView( child_1.el ); + new Xcls_projectselection( _this ); + this.el = new Gtk.ColumnView( _this.projectselection.el ); // my vars (dec) @@ -376,8 +376,8 @@ { _this = _owner; _this.projectselection = this; - var child_1 = new Xcls_projectsort( _this ); - this.el = new Gtk.SingleSelection( child_1.el ); + new Xcls_projectsort( _this ); + this.el = new Gtk.SingleSelection( _this.projectsort.el ); // my vars (dec) @@ -436,10 +436,10 @@ { _this = _owner; _this.projectsort = this; - var child_1 = new Xcls_projectmodel( _this ); + new Xcls_projectmodel( _this ); var child_2 = new Xcls_StringSorter10( _this ); child_2.ref(); - this.el = new Gtk.SortListModel( child_1.el, child_2.el ); + this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el ); // my vars (dec) @@ -628,8 +628,8 @@ this.el.visible = false; var child_1 = new Xcls_Box15( _this ); this.el.end_child = child_1.el; - var child_2 = new Xcls_treescroll( _this ); - this.el.start_child = child_2.el; + new Xcls_treescroll( _this ); + this.el.start_child = _this.treescroll.el; } // user defined functions @@ -656,8 +656,8 @@ var child_1 = new Xcls_Box16( _this ); child_1.ref(); this.el.append( child_1.el ); - var child_2 = new Xcls_iconscroll( _this ); - this.el.append( child_2.el ); + new Xcls_iconscroll( _this ); + this.el.append( _this.iconscroll.el ); } // user defined functions @@ -680,8 +680,8 @@ // set gobject values this.el.hexpand = true; - var child_1 = new Xcls_searchbox( _this ); - this.el.append( child_1.el ); + new Xcls_searchbox( _this ); + this.el.append( _this.searchbox.el ); } // user defined functions @@ -755,8 +755,8 @@ this.el.has_frame = true; this.el.hexpand = true; this.el.vexpand = true; - var child_1 = new Xcls_gridview( _this ); - this.el.child = child_1.el; + new Xcls_gridview( _this ); + this.el.child = _this.gridview.el; // init method @@ -778,10 +778,10 @@ { _this = _owner; _this.gridview = this; - var child_1 = new Xcls_iconsel( _this ); + new Xcls_iconsel( _this ); var child_2 = new Xcls_SignalListItemFactory29( _this ); child_2.ref(); - this.el = new Gtk.GridView( child_1.el, child_2.el ); + this.el = new Gtk.GridView( _this.iconsel.el, child_2.el ); // my vars (dec) @@ -899,9 +899,9 @@ public Xcls_FilterListModel22(DialogFiles _owner ) { _this = _owner; - var child_1 = new Xcls_gridsort( _this ); - var child_2 = new Xcls_iconsearch( _this ); - this.el = new Gtk.FilterListModel( child_1.el, child_2.el ); + new Xcls_gridsort( _this ); + new Xcls_iconsearch( _this ); + this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el ); // my vars (dec) @@ -923,10 +923,10 @@ { _this = _owner; _this.gridsort = this; - var child_1 = new Xcls_gridmodel( _this ); + new Xcls_gridmodel( _this ); var child_2 = new Xcls_StringSorter25( _this ); child_2.ref(); - this.el = new Gtk.SortListModel( child_1.el, child_2.el ); + this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el ); // my vars (dec) @@ -1170,8 +1170,8 @@ this.el.hexpand = true; this.el.vexpand = true; this.el.visible = true; - var child_1 = new Xcls_treeview( _this ); - this.el.child = child_1.el; + new Xcls_treeview( _this ); + this.el.child = _this.treeview.el; // init method @@ -1194,8 +1194,8 @@ { _this = _owner; _this.treeview = this; - var child_1 = new Xcls_treeselmodel( _this ); - this.el = new Gtk.ColumnView( child_1.el ); + new Xcls_treeselmodel( _this ); + this.el = new Gtk.ColumnView( _this.treeselmodel.el ); // my vars (dec) @@ -1204,8 +1204,8 @@ var child_2 = new Xcls_GestureClick32( _this ); child_2.ref(); this.el.add_controller( child_2.el ); - var child_3 = new Xcls_name( _this ); - this.el.append_column ( child_3.el ); + new Xcls_name( _this ); + this.el.append_column ( _this.name.el ); // init method @@ -1341,9 +1341,9 @@ public Xcls_FilterListModel34(DialogFiles _owner ) { _this = _owner; - var child_1 = new Xcls_treelistsort( _this ); - var child_2 = new Xcls_treefilter( _this ); - this.el = new Gtk.FilterListModel( child_1.el, child_2.el ); + new Xcls_treelistsort( _this ); + new Xcls_treefilter( _this ); + this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el ); // my vars (dec) @@ -1365,10 +1365,10 @@ { _this = _owner; _this.treelistsort = this; - var child_1 = new Xcls_treelistmodel( _this ); + new Xcls_treelistmodel( _this ); var child_2 = new Xcls_TreeListRowSorter38( _this ); child_2.ref(); - this.el = new Gtk.SortListModel( child_1.el, child_2.el ); + this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el ); // my vars (dec) @@ -1391,8 +1391,8 @@ { _this = _owner; _this.treelistmodel = this; - var child_1 = new Xcls_treemodel( _this ); - this.el = new Gtk.TreeListModel( child_1.el, false, true, (item) => { + new Xcls_treemodel( _this ); + this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => { //GLib.debug("liststore got %s", item.get_type().name()); return ((JsRender.JsRender)item).childfiles; } ); @@ -1703,16 +1703,16 @@ var child_1 = new Xcls_Button45( _this ); child_1.ref(); this.el.pack_end ( child_1.el ); - var child_2 = new Xcls_btn_newproj( _this ); - this.el.pack_start ( child_2.el ); - var child_3 = new Xcls_btn_projprop( _this ); - this.el.pack_start ( child_3.el ); - var child_4 = new Xcls_btn_delproj( _this ); - this.el.pack_start ( child_4.el ); - var child_5 = new Xcls_btn_addfile( _this ); - this.el.pack_start ( child_5.el ); - var child_6 = new Xcls_btn_delfile( _this ); - this.el.pack_start ( child_6.el ); + new Xcls_btn_newproj( _this ); + this.el.pack_start ( _this.btn_newproj.el ); + new Xcls_btn_projprop( _this ); + this.el.pack_start ( _this.btn_projprop.el ); + new Xcls_btn_delproj( _this ); + this.el.pack_start ( _this.btn_delproj.el ); + new Xcls_btn_addfile( _this ); + this.el.pack_start ( _this.btn_addfile.el ); + new Xcls_btn_delfile( _this ); + this.el.pack_start ( _this.btn_delfile.el ); } // user defined functions @@ -1792,21 +1792,23 @@ pe.el.application = _this.win.el.application; pe.el.set_transient_for( _this.el ); - - pe.selected.connect((pr) => { - - _this.show( pr, _this.new_window); - - }); - + var cb = new Project.Callback(); + cb.call.connect((pr) => { + _this.show( pr , _this.new_window); + }); - pe.show(); + pe.show( cb); }); } // user defined functions + public void onCreated () { + var pe = EditProject.singleton(); + + _this.show( pe.result , _this.new_window); + } } public class Xcls_Box47 : Object { @@ -1912,7 +1914,7 @@ if (_this.selectedProject == null) { return; } - _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject); + _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null); }); } diff --git a/src/Builder4/EditProject.bjs b/src/Builder4/EditProject.bjs index edd9723e3..b45ca28cf 100644 --- a/src/Builder4/EditProject.bjs +++ b/src/Builder4/EditProject.bjs @@ -4,10 +4,11 @@ "items" : [ { "# WindowState? windowstate" : "null", + "$ Project.Callback doneObj" : "null", "$ deletable" : true, "$ xns" : "Gtk", "@ void canceled" : "()", - "@ void selected" : "(Project.Project? proj)", + "Project.Project result" : "null", "bool modal" : true, "default_width" : 600, "items" : [ @@ -113,9 +114,17 @@ "\t\t", "\t\tproject.save();", "\t\t Project.Project.saveProjectList();", - "\t\t_this.selected(project); // this should trigger a load()", + " \t\t_this.result = project;", "\t\tif (is_new_folder || is_existing) {", - "\t \t _this.windowstate.projectPopoverShow(_this.el, project);", + "\t\t\t ", + "\t\t", + "\t \t _this.windowstate.projectPopoverShow(", + "\t \t \t_this.el.transient_for, project, _this.doneObj ", + " \t \t);", + " \t } else {", + " \t \tif (_this.doneObj != null) {", + "\t\t \t _this.doneObj.call(project);", + "\t \t }", " \t }", "\t\t", "\t\treturn;", @@ -496,7 +505,13 @@ { "$ xns" : "Gtk", "* prop" : "model", - "strings" : "{ \"Roo\", \"Gtk\" /*, \"WrappedGtk\", \"Flutter\" */ }", + "strings" : [ + "{ ", + "\t\"Gtk - A Gtk / Vala Desktop project\", ", + "\t\"Roo - A Web Javascript Project using the Roo Library\"", + "\t/*, \"Flutter\" */ ", + "}" + ], "xtype" : "StringList" } ], @@ -517,8 +532,11 @@ "| string getValue" : [ "() {", "\tvar m = (Gtk.StringList) this.el.model;", - "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?", + "\tvar str = this.el.selected == Gtk.INVALID_LIST_POSITION ?", "\t\t\t \"\" : m.get_string(this.el.selected);", + "\t\t\t ", + " \tvar ar = str.split(\" \");", + " \treturn ar[0];", "\t", "}" ], @@ -544,7 +562,7 @@ } ], "name" : "EditProject", - "title" : "New Project", + "string title" : "New Project", "xtype" : "Window", "| void hideAll" : [ "() {", @@ -562,8 +580,8 @@ "}" ], "| void show" : [ - "() {", - " ", + "(Project.Callback doneObj) {", + " this.doneObj= doneObj;", " _this.hideAll(); ", " // hide stuff..", " _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;", diff --git a/src/Builder4/EditProject.vala b/src/Builder4/EditProject.vala index 080846dad..04e1592bf 100644 --- a/src/Builder4/EditProject.vala +++ b/src/Builder4/EditProject.vala @@ -25,9 +25,10 @@ public Xcls_ptype_dd ptype_dd; // my vars (def) + public Project.Callback doneObj; public WindowState? windowstate; public signal void canceled (); - public signal void selected (Project.Project? proj); + public Project.Project result; // ctor public EditProject() @@ -36,7 +37,9 @@ this.el = new Gtk.Window(); // my vars (dec) + this.doneObj = null; this.windowstate = null; + this.result = null; // set gobject values this.el.title = "New Project"; @@ -51,8 +54,8 @@ } // user defined functions - public void show () { - + public void show (Project.Callback doneObj) { + this.doneObj= doneObj; _this.hideAll(); // hide stuff.. _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION; @@ -231,9 +234,17 @@ project.save(); Project.Project.saveProjectList(); - _this.selected(project); // this should trigger a load() + _this.result = project; if (is_new_folder || is_existing) { - _this.windowstate.projectPopoverShow(_this.el, project); + + + _this.windowstate.projectPopoverShow( + _this.el.transient_for, project, _this.doneObj + ); + } else { + if (_this.doneObj != null) { + _this.doneObj.call(project); + } } return; @@ -880,8 +891,11 @@ // user defined functions public string getValue () { var m = (Gtk.StringList) this.el.model; - return this.el.selected == Gtk.INVALID_LIST_POSITION ? + var str = this.el.selected == Gtk.INVALID_LIST_POSITION ? "" : m.get_string(this.el.selected); + + var ar = str.split(" "); + return ar[0]; } public void setValue (string val) { @@ -908,7 +922,11 @@ public Xcls_StringList20(EditProject _owner ) { _this = _owner; - this.el = new Gtk.StringList( { "Roo", "Gtk" /*, "WrappedGtk", "Flutter" */ } ); + this.el = new Gtk.StringList( { + "Gtk - A Gtk / Vala Desktop project", + "Roo - A Web Javascript Project using the Roo Library" + /*, "Flutter" */ +} ); // my vars (dec) diff --git a/src/Builder4/MainWindow.bjs b/src/Builder4/MainWindow.bjs index 2d956badf..337bf15c9 100644 --- a/src/Builder4/MainWindow.bjs +++ b/src/Builder4/MainWindow.bjs @@ -359,7 +359,7 @@ "clicked" : [ " ( ) => {", " ", - " _this.windowstate.projectPopoverShow(_this.el, null);", + " _this.windowstate.projectPopoverShow(_this.el, null, null);", " ", " ", "}" @@ -831,6 +831,13 @@ "\t\treq.totalErrors(\"DEPR\"),", "\t\treq.totalErrors(\"DEPR\", this.windowstate.file)", "\t);", + "", + "\t_this.statusbar_run.el.hide();", + "", + "\tif (req.totalErrors(\"ERR\") < 1) {", + "\t\t_this.statusbar_run.el.show();", + "\t}", + "\t", "}" ] } diff --git a/src/Builder4/MainWindow.vala b/src/Builder4/MainWindow.vala index e5c8b871c..76242bb7c 100644 --- a/src/Builder4/MainWindow.vala +++ b/src/Builder4/MainWindow.vala @@ -122,6 +122,13 @@ req.totalErrors("DEPR"), req.totalErrors("DEPR", this.windowstate.file) ); + + _this.statusbar_run.el.hide(); + + if (req.totalErrors("ERR") < 1) { + _this.statusbar_run.el.show(); + } + } public void initChildren () { // this needs putting in a better place.. @@ -914,7 +921,7 @@ //listeners this.el.clicked.connect( ( ) => { - _this.windowstate.projectPopoverShow(_this.el, null); + _this.windowstate.projectPopoverShow(_this.el, null, null); }); diff --git a/src/Builder4/PopoverFileDetails.bjs b/src/Builder4/PopoverFileDetails.bjs index 158deed18..a698a4830 100644 --- a/src/Builder4/PopoverFileDetails.bjs +++ b/src/Builder4/PopoverFileDetails.bjs @@ -10,6 +10,7 @@ "@ void success" : "(Project.Project pr, JsRender.JsRender file)", "Xcls_MainWindow mainwindow" : "null", "bool done" : false, + "bool is_new" : true, "bool modal" : true, "id" : "PopoverFileDetails", "items" : [ @@ -35,36 +36,6 @@ "int margin_end" : 4, "int margin_start" : 4, "items" : [ - { - "$ 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" : [ - { - "$ xns" : "Gtk", - "* prop" : "model", - "id" : "dir_model", - "strings" : "{}", - "xtype" : "StringList" - } - ], - "xtype" : "DropDown", - "| string getValue" : [ - "() {", - "\treturn _this.dir_model.el.get_string(this.el.selected);", - "}" - ] - }, { "$ justify" : "Gtk.Justification.RIGHT", "$ xns" : "Gtk", @@ -135,6 +106,11 @@ "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}", @@ -155,9 +131,17 @@ ], "| void showhide" : [ "() {", + "\t ", "", - "", - "\t", + "\t_this.path_lbl.el.hide();", + " _this.path.el.hide();", + " ", + " ", + " _this.name_lbl.el.hide();", + " _this.name.el.hide();", + " ", + " _this.dir_dropdown_lbl.el.hide();", + " _this.dir_dropdown.el.hide();", "\t", "\t_this.title_lbl.el.hide();", "\t_this.title.el.hide();", @@ -179,8 +163,32 @@ "\t", "\t_this.gen_lbl.el.hide();", "\t_this.gen.el.hide();", - " ", + "\t", + " ", "\tvar sel = this.getValue();", + "", + "\tGLib.debug(\"showhide is new ? %s / sel = '%s'\" , _this.is_new ? \"YES\" :\"NO\", sel); ", + "\t", + " if (_this.is_new) {", + "\t\tif (sel == \"\" && _this.project.xtype == \"Gtk\") {", + "\t\t\treturn;", + "\t\t}", + "\t\t ", + "\t ", + " _this.dir_dropdown_lbl.el.show();", + "\t _this.dir_dropdown.el.show();", + "\t ", + " _this.name_lbl.el.show();", + " \t_this.name.el.show();", + "", + "\t ", + "\t ", + " } else {", + " _this.path.el.set_text(_this.file.relpath);", + " }", + " ", + "\t", + "\t", "\t", "\tswitch(_this.project.xtype) {", "\t\tcase \"Roo\":", @@ -211,9 +219,25 @@ "\t \t\t_this.build_module_lbl.el.show();", "\t\t\t_this.build_module.el.show();", "\t", - "\t\t\t_this.gen_lbl.el.show();", - "\t\t\t_this.gen.el.show();", - "\t\t ", + "\t\t\t ", + "\t\t\t", + "\t\t\tif (sel == \"bjs\" || sel == \"vala\") {", + "\t\t\t\t _this.project.loadDirsToStringList(_this.dir_model.el, \"/src\");", + "\t\t\t\t _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;", + "\t\t _this.name_lbl.el.label = \"Component Name (Filename with-out extension)\";\t\t\t\t ", + "\t\t ", + "\t\t if (sel == \"bjs\") {", + "\t\t\t _this.gen_lbl.el.show();", + "\t\t\t _this.gen.el.show();", + "\t\t }", + "\t\t ", + "\t\t ", + "\t\t ", + "\t\t\t} else {", + "\t\t _this.project.loadDirsToStringList(_this.dir_model.el, \"\");", + "\t\t _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;", + "\t\t _this.name_lbl.el.label = \"File Name (with extension)\";", + "\t }", "\t\t\tbreak;", "\t}", " ", @@ -233,7 +257,38 @@ }, { "$ 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" : [ + { + "$ xns" : "Gtk", + "* prop" : "model", + "id" : "dir_model", + "strings" : "{}", + "xtype" : "StringList" + } + ], + "xtype" : "DropDown", + "| string getValue" : [ + "() {", + "\treturn _this.dir_model.el.get_string(this.el.selected);", + "}" + ] + }, + { + "$ justify" : "Gtk.Justification.RIGHT", + "$ xns" : "Gtk", + "id" : "name_lbl", "label" : "Component Name (File name without extension)", "x_options" : 4, "xalign" : 0.90000000000000002, @@ -430,7 +485,7 @@ "$ xns" : "Gtk", "id" : "gen_lbl", "int colspan" : 1, - "label" : "Generate as Extended (experimental)", + "label" : "Generate as Extended (no working)", "x_options" : 4, "xalign" : 0.90000000000000002, "xtype" : "Label" @@ -454,7 +509,7 @@ ], "uint row_spacing" : 2, "xtype" : "Grid", - "| void hideRow" : [ + "| void xhideRow" : [ "(int row) ", "{", "\tvar el = _this.grid.el.get_child_at(0,row);", @@ -465,7 +520,7 @@ "", "}" ], - "| void showAllRows" : [ + "| void xshowAllRows" : [ "() {", "\tfor (var i = 2; i < 10;i++) {", "\t\tvar el = _this.grid.el.get_child_at(0,i);", @@ -663,7 +718,7 @@ "uint border_width" : 0, "xtype" : "Window", "| void show" : [ - "(JsRender.JsRender c, Gtk.Window pwin, bool new_window) ", + "(JsRender.JsRender c, Gtk.Window pwin, bool new_window) ", "{", " ", " this.project = c.project;", @@ -674,7 +729,7 @@ " //this.init();", " //} ", " ", - " ", + " this.is_new = c.name == \"\";", "", " _this.name.el.set_text(c.name);", " _this.title.el.set_text(c.title);", @@ -685,28 +740,14 @@ " ", " _this.gen.el.active = c.gen_extended;", " ", - "\t_this.path_lbl.el.show();", - " _this.path.el.show();", - " _this.dir_dropdown_lbl.el.hide();", - " _this.dir_dropdown.el.hide();", - " if (c.name == \"\") {", - " \t_this.path_lbl.el.hide();", - "\t _this.path.el.hide();", - "\t this.filetype_model.load();", - " _this.dir_dropdown_lbl.el.show();", - "\t _this.dir_dropdown.el.show();", - "\t ", - " } else {", - " _this.path.el.set_text(c.relpath);", - " }", - " ", + "", " ", " 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 (c.name != \"\") {", + "\t if (!this.is_new) {", "\t\t this.build_module.setValue(c.build_module);", "\t }", " }", @@ -719,22 +760,28 @@ " this.el.set_transient_for(pwin);", " ", " // window + header?", - " print(\"SHOWALL - POPIP\\n\");", + " ", " this.el.show();", - " this.name.el.grab_focus();", + " // this.name.el.grab_focus();", " ", - " _this.project.loadDirsToStringList(this.dir_model.el);", " ", - " if (c.path.length > 0) {", + " if (!this.is_new) {", "\t this.save_btn.el.set_label(\"Save\");", - "\t\t_this.filetype_lbl.el.hide();", - "\t\t_this.filetype.el.hide();", - "\t\t_this.filetype.showhide(); // as we only work on bjs files currently", + "\t\tthis.filetype_lbl.el.hide();", + "\t\tthis.filetype.el.hide();", + "\t\tthis.filetype.showhide(); // as we only work on bjs files currently", " } else {", + " ", + "\t\t//_this.project.loadDirsToStringList(this.dir_model.el, \"\");", + "\t\t//_this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;", + " ", " this.save_btn.el.set_label(\"Create\");", - "\t _this.filetype.el.show();", - "\t _this.filetype_lbl.el.show();", - "\t _this.filetype.showhide();", + "\t this.filetype.el.show();", + "\t this.filetype_lbl.el.show();", + "\t this.filetype_model.load();", + "\t\tthis.filetype.el.selected = Gtk.INVALID_LIST_POSITION;", + "\t this.filetype.showhide();", + "\t ", " }", " ", " ", diff --git a/src/Builder4/PopoverFileDetails.vala b/src/Builder4/PopoverFileDetails.vala index 49b9736c1..7181e957b 100644 --- a/src/Builder4/PopoverFileDetails.vala +++ b/src/Builder4/PopoverFileDetails.vala @@ -13,12 +13,13 @@ return _PopoverFileDetails; } public Xcls_grid grid; - public Xcls_dir_dropdown_lbl dir_dropdown_lbl; - public Xcls_dir_dropdown dir_dropdown; - public Xcls_dir_model dir_model; 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; @@ -40,6 +41,7 @@ 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; @@ -55,6 +57,7 @@ this.el = new Gtk.Window(); // my vars (dec) + this.is_new = true; this.new_window = true; this.file = null; this.border_width = 0; @@ -78,7 +81,7 @@ } // user defined functions - public void show (JsRender.JsRender c, Gtk.Window pwin, bool new_window) + public void show (JsRender.JsRender c, Gtk.Window pwin, bool new_window) { this.project = c.project; @@ -89,7 +92,7 @@ //this.init(); //} - + this.is_new = c.name == ""; _this.name.el.set_text(c.name); _this.title.el.set_text(c.title); @@ -100,28 +103,14 @@ _this.gen.el.active = c.gen_extended; - _this.path_lbl.el.show(); - _this.path.el.show(); - _this.dir_dropdown_lbl.el.hide(); - _this.dir_dropdown.el.hide(); - if (c.name == "") { - _this.path_lbl.el.hide(); - _this.path.el.hide(); - this.filetype_model.load(); - _this.dir_dropdown_lbl.el.show(); - _this.dir_dropdown.el.show(); - - } else { - _this.path.el.set_text(c.relpath); - } - + 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 (c.name != "") { + if (!this.is_new) { this.build_module.setValue(c.build_module); } } @@ -134,22 +123,28 @@ this.el.set_transient_for(pwin); // window + header? - print("SHOWALL - POPIP\n"); + this.el.show(); - this.name.el.grab_focus(); + // this.name.el.grab_focus(); - _this.project.loadDirsToStringList(this.dir_model.el); - if (c.path.length > 0) { + if (!this.is_new) { this.save_btn.el.set_label("Save"); - _this.filetype_lbl.el.hide(); - _this.filetype.el.hide(); - _this.filetype.showhide(); // as we only work on bjs files currently + this.filetype_lbl.el.hide(); + this.filetype.el.hide(); + this.filetype.showhide(); // as we only work on bjs files currently } else { + + //_this.project.loadDirsToStringList(this.dir_model.el, ""); + //_this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION; + this.save_btn.el.set_label("Create"); - _this.filetype.el.show(); - _this.filetype_lbl.el.show(); - _this.filetype.showhide(); + this.filetype.el.show(); + this.filetype_lbl.el.show(); + this.filetype_model.load(); + this.filetype.el.selected = Gtk.INVALID_LIST_POSITION; + this.filetype.showhide(); + } @@ -202,8 +197,8 @@ this.el.hexpand = true; this.el.margin_bottom = 4; this.el.margin_top = 4; - var child_1 = new Xcls_grid( _this ); - this.el.append ( child_1.el ); + new Xcls_grid( _this ); + this.el.append ( _this.grid.el ); } // user defined functions @@ -231,63 +226,54 @@ this.el.hexpand = true; this.el.column_spacing = 4; this.el.row_spacing = 2; - var child_1 = new Xcls_dir_dropdown_lbl( _this ); - this.el.attach( child_1.el, 0, 0, 1, 1 ); - var child_2 = new Xcls_dir_dropdown( _this ); - this.el.attach( child_2.el, 1, 0, 1, 1 ); - var child_3 = new Xcls_filetype_lbl( _this ); - this.el.attach( child_3.el, 0, 1, 1, 1 ); - var child_4 = new Xcls_filetype( _this ); - this.el.attach( child_4.el, 1, 1, 1, 1 ); - var child_5 = new Xcls_Label10( _this ); - child_5.ref(); - this.el.attach( child_5.el, 0, 2, 1, 1 ); - var child_6 = new Xcls_name( _this ); - this.el.attach( child_6.el, 1, 2, 1, 1 ); - var child_7 = new Xcls_title_lbl( _this ); - this.el.attach( child_7.el, 0, 3, 1, 1 ); - var child_8 = new Xcls_title( _this ); - this.el.attach ( child_8.el , 1,2,1,1 ); - var child_9 = new Xcls_region_lbl( _this ); - this.el.attach( child_9.el, 0, 4, 1, 1 ); - var child_10 = new Xcls_region( _this ); - this.el.attach( child_10.el, 1, 4, 1, 1 ); - var child_11 = new Xcls_parent_lbl( _this ); - this.el.attach( child_11.el, 0, 5, 1, 1 ); - var child_12 = new Xcls_parent( _this ); - this.el.attach( child_12.el, 1, 5, 1, 1 ); - var child_13 = new Xcls_permname_lbl( _this ); - this.el.attach( child_13.el, 0, 6, 1, 1 ); - var child_14 = new Xcls_permname( _this ); - this.el.attach( child_14.el, 1, 6, 1, 1 ); - var child_15 = new Xcls_modOrder_lbl( _this ); - this.el.attach( child_15.el, 0, 7, 1, 1 ); - var child_16 = new Xcls_modOrder( _this ); - this.el.attach( child_16.el, 1, 7, 1, 1 ); - var child_17 = new Xcls_build_module_lbl( _this ); - this.el.attach( child_17.el, 0, 8, 1, 1 ); - var child_18 = new Xcls_build_module( _this ); - this.el.attach( child_18.el, 1, 8, 1, 1 ); - var child_19 = new Xcls_path_lbl( _this ); - this.el.attach( child_19.el, 0, 9, 1, 1 ); - var child_20 = new Xcls_path( _this ); - this.el.attach( child_20.el, 1, 9, 1, 1 ); - var child_21 = new Xcls_gen_lbl( _this ); - this.el.attach( child_21.el, 0, 10, 1, 1 ); - var child_22 = new Xcls_gen( _this ); - this.el.attach( child_22.el, 1, 10, 1, 1 ); + 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 showAllRows () { - 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 void hideRow (int row) + public void xhideRow (int row) { var el = _this.grid.el.get_child_at(0,row); @@ -296,85 +282,15 @@ el.hide(); } - } - 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; - var child_1 = new Xcls_dir_model( _this ); - this.el = new Gtk.DropDown( child_1.el, null ); - - // my vars (dec) - this.colspan = 1; - - // set gobject values - } - - // user defined functions - public string getValue () { - return _this.dir_model.el.get_string(this.el.selected); - } - } - 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) - - // set gobject values + 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(); + } } - - // user defined functions } - - public class Xcls_filetype_lbl : Object { public Gtk.Label el; @@ -413,8 +329,8 @@ { _this = _owner; _this.filetype = this; - var child_1 = new Xcls_filetype_model( _this ); - this.el = new Gtk.DropDown( child_1.el, null ); + new Xcls_filetype_model( _this ); + this.el = new Gtk.DropDown( _this.filetype_model.el, null ); // my vars (dec) @@ -434,6 +350,11 @@ // 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 ""; } @@ -441,9 +362,17 @@ return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0]; } public void showhide () { + - - + _this.path_lbl.el.hide(); + _this.path.el.hide(); + + + _this.name_lbl.el.hide(); + _this.name.el.hide(); + + _this.dir_dropdown_lbl.el.hide(); + _this.dir_dropdown.el.hide(); _this.title_lbl.el.hide(); _this.title.el.hide(); @@ -465,8 +394,32 @@ _this.gen_lbl.el.hide(); _this.gen.el.hide(); - + + var sel = this.getValue(); + + GLib.debug("showhide is new ? %s / sel = '%s'" , _this.is_new ? "YES" :"NO", sel); + + if (_this.is_new) { + if (sel == "" && _this.project.xtype == "Gtk") { + return; + } + + + _this.dir_dropdown_lbl.el.show(); + _this.dir_dropdown.el.show(); + + _this.name_lbl.el.show(); + _this.name.el.show(); + + + + } else { + _this.path.el.set_text(_this.file.relpath); + } + + + switch(_this.project.xtype) { case "Roo": @@ -497,9 +450,25 @@ _this.build_module_lbl.el.show(); _this.build_module.el.show(); - _this.gen_lbl.el.show(); - _this.gen.el.show(); - + + + if (sel == "bjs" || sel == "vala") { + _this.project.loadDirsToStringList(_this.dir_model.el, "/src"); + _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION; + _this.name_lbl.el.label = "Component Name (Filename with-out extension)"; + + if (sel == "bjs") { + _this.gen_lbl.el.show(); + _this.gen.el.show(); + } + + + + } else { + _this.project.loadDirsToStringList(_this.dir_model.el, ""); + _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION; + _this.name_lbl.el.label = "File Name (with extension)"; + } break; } @@ -579,7 +548,85 @@ } - public class Xcls_Label10 : Object + 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 + } + + // user defined functions + public string getValue () { + return _this.dir_model.el.get_string(this.el.selected); + } + } + 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) + + // set gobject values + } + + // user defined functions + } + + + public class Xcls_name_lbl : Object { public Gtk.Label el; private Xcls_PopoverFileDetails _this; @@ -588,9 +635,10 @@ // my vars (def) // ctor - public Xcls_Label10(Xcls_PopoverFileDetails _owner ) + public Xcls_name_lbl(Xcls_PopoverFileDetails _owner ) { _this = _owner; + _this.name_lbl = this; this.el = new Gtk.Label( "Component Name (File name without extension)" ); // my vars (dec) @@ -920,8 +968,8 @@ { _this = _owner; _this.build_module = this; - var child_1 = new Xcls_build_module_model( _this ); - this.el = new Gtk.DropDown( child_1.el, null ); + new Xcls_build_module_model( _this ); + this.el = new Gtk.DropDown( _this.build_module_model.el, null ); // my vars (dec) @@ -1066,7 +1114,7 @@ { _this = _owner; _this.gen_lbl = this; - this.el = new Gtk.Label( "Generate as Extended (experimental)" ); + this.el = new Gtk.Label( "Generate as Extended (no working)" ); // my vars (dec) this.colspan = 1; @@ -1134,8 +1182,8 @@ var child_1 = new Xcls_Button30( _this ); child_1.ref(); this.el.pack_start ( child_1.el ); - var child_2 = new Xcls_save_btn( _this ); - this.el.pack_end ( child_2.el ); + new Xcls_save_btn( _this ); + this.el.pack_end ( _this.save_btn.el ); } // user defined functions diff --git a/src/Builder4/ValaProjectSettingsPopover.bjs b/src/Builder4/ValaProjectSettingsPopover.bjs index 907773ca0..df33c1b7f 100644 --- a/src/Builder4/ValaProjectSettingsPopover.bjs +++ b/src/Builder4/ValaProjectSettingsPopover.bjs @@ -3,8 +3,8 @@ "gen_extended" : false, "items" : [ { + "$ Project.Callback doneObj" : "null", "$ xns" : "Gtk", - "Gtk.PositionType position" : "Gtk.PositionType.RIGHT", "Project.Gtk project" : "null", "Project.GtkValaSettings? selected_target" : "null", "Xcls_MainWindow window" : "null", @@ -886,9 +886,11 @@ "_this.project.save(); ", " ", "\t// what about .js ?", - " _this.done = true;", - "\t_this.el.hide();", - "", + "_this.done = true;", + "_this.el.hide();", + "if (_this.doneObj != null) {", + "\t_this.doneObj.call(_this.project);", + "}", "// hopefull this will work with bjs files..", "\t", " ", @@ -933,10 +935,10 @@ "}" ], "| void show" : [ - "(Gtk.Window pwin, Project.Gtk project) {", + "(Gtk.Window pwin, Project.Gtk project, Project.Callback doneObj) {", " ", " //print(\"ValaProjectSettings show\\n\");", - " ", + " this.doneObj = doneObj;", " this.project= project;", "\t ", " this.compile_flags.el.buffer.set_text(", @@ -958,7 +960,9 @@ "//\tGtk.Allocation rect;", "\t//btn.get_allocation(out rect);", " // this.el.set_pointing_to(rect);", - "\tthis.el.set_transient_for(pwin);", + " this.el.application = pwin.application; // ??? make it modal?", + "\t this.el.set_transient_for(pwin);", + "\t ", "\t// window + header?", "\t// print(\"SHOWALL - POPIP\\n\");", "\tthis.el.set_size_request(800,800);", diff --git a/src/Builder4/ValaProjectSettingsPopover.vala b/src/Builder4/ValaProjectSettingsPopover.vala index 7969950c5..cdbf088c7 100644 --- a/src/Builder4/ValaProjectSettingsPopover.vala +++ b/src/Builder4/ValaProjectSettingsPopover.vala @@ -35,8 +35,8 @@ public Xcls_save_btn save_btn; // my vars (def) + public Project.Callback doneObj; public Xcls_MainWindow window; - public Gtk.PositionType position; public Project.GtkValaSettings? selected_target; public uint border_width; public bool done; @@ -50,8 +50,8 @@ this.el = new Gtk.Window(); // my vars (dec) + this.doneObj = null; this.window = null; - this.position = Gtk.PositionType.RIGHT; this.selected_target = null; this.border_width = 0; this.done = false; @@ -82,10 +82,10 @@ } // user defined functions - public void show (Gtk.Window pwin, Project.Gtk project) { + public void show (Gtk.Window pwin, Project.Gtk project, Project.Callback doneObj) { //print("ValaProjectSettings show\n"); - + this.doneObj = doneObj; this.project= project; this.compile_flags.el.buffer.set_text( @@ -107,7 +107,9 @@ // Gtk.Allocation rect; //btn.get_allocation(out rect); // this.el.set_pointing_to(rect); - this.el.set_transient_for(pwin); + this.el.application = pwin.application; // ??? make it modal? + this.el.set_transient_for(pwin); + // window + header? // print("SHOWALL - POPIP\n"); this.el.set_size_request(800,800); @@ -2021,9 +2023,11 @@ _this.project.save(); // what about .js ? - _this.done = true; - _this.el.hide(); - + _this.done = true; + _this.el.hide(); + if (_this.doneObj != null) { + _this.doneObj.call(_this.project); + } // hopefull this will work with bjs files.. diff --git a/src/Builder4/WindowState.vala b/src/Builder4/WindowState.vala index efd164d65..832c36700 100644 --- a/src/Builder4/WindowState.vala +++ b/src/Builder4/WindowState.vala @@ -421,7 +421,7 @@ public class WindowState : Object } - public void projectPopoverShow(Gtk.Window pwin, Project.Project? pr) + public void projectPopoverShow(Gtk.Window pwin, Project.Project? pr, Project.Callback? doneObj) { if (pr == null) { pr = this.project; @@ -438,7 +438,7 @@ public class WindowState : Object // gtk.. - this.vala_projectsettings_pop.show(pwin,(Project.Gtk)pr); + this.vala_projectsettings_pop.show(pwin,(Project.Gtk)pr, doneObj); } diff --git a/src/JsRender/JsRender.vala b/src/JsRender/JsRender.vala index adf5d55f6..04f590b37 100644 --- a/src/JsRender/JsRender.vala +++ b/src/JsRender/JsRender.vala @@ -61,7 +61,16 @@ namespace JsRender { private set {} } - + public string file_ext { + public owned get { + if (!this.path.contains(".")) { + return ""; + } + var bits = this.name.split("."); + return bits[bits.length-1]; + } + private set {} + } public string parent = ""; // JS parent. public string region = ""; // RooJS - insert region. diff --git a/src/Project/Project.vala b/src/Project/Project.vala index fe034ff15..716a2525e 100644 --- a/src/Project/Project.vala +++ b/src/Project/Project.vala @@ -40,15 +40,21 @@ namespace Project { INVALID_FORMAT } + + // static array of all projects. private Gee.ArrayList projects; public bool projects_loaded = false; - + // used to pass around callbacks with project as a return + public class Callback : Object { + public signal void call(Project project); + } + public abstract class Project : Object { public signal void on_changed (); @@ -930,7 +936,8 @@ namespace Project { return false; } - public void loadDirsToStringList( global::Gtk.StringList sl) + + public void loadDirsToStringList( global::Gtk.StringList sl, string prefix) { while (sl.get_n_items() > 0) { @@ -938,8 +945,11 @@ namespace Project { } foreach(var sp in this.sub_paths) { - - sl.append( sp.path == this.path ? "/" : sp.path.substring(this.path.length)); + var add = sp.path == this.path ? "/" : sp.path.substring(this.path.length); + if (prefix.length > 0 && !add.has_prefix(prefix)) { + continue; + } + sl.append(add); } } -- 2.39.2