From: Alan Knowles Date: Thu, 1 Feb 2024 12:03:48 +0000 (+0800) Subject: Fix #8000 - left tree and file open X-Git-Tag: release-5.0.2~16 X-Git-Url: http://git.roojs.org/?p=roobuilder;a=commitdiff_plain;h=a3bc4d05fe08b2714d5bca8b7539560ab4858f32 Fix #8000 - left tree and file open --- diff --git a/.roobuilder.jcfg b/.roobuilder.jcfg index d85f7732d..c80927af5 100644 --- a/.roobuilder.jcfg +++ b/.roobuilder.jcfg @@ -15,7 +15,6 @@ "src/Builder4/EditProject.bjs", "src/Builder4/FakeServer.vala", "src/Builder4/GtkView.bjs", - "src/Builder4/MainWindow.bjs", "src/Builder4/PopoverAddObject.bjs", "src/Builder4/PopoverProperty.bjs", "src/Builder4/StandardErrorDialog.bjs", @@ -69,7 +68,8 @@ "src/Palete/ValaCompileRequest.vala", "src/JsRender/NodeWriter.vala", "src/JsRender/NodeToValaExtended.vala", - "src/JsRender/NodeToValaWrapped.vala" + "src/JsRender/NodeToValaWrapped.vala", + "src/Builder4/MainWindow.bjs" ] } ], diff --git a/debian/changelog b/debian/changelog index b577b8a07..fa98cccad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,9 @@ roobuilder (5.0.2) UNRELEASED; urgency=medium * Error highlighting now on character location of errors, along with marks * roojspacker dependancy removed for now (too slow to work currently) * add other property - use menubutton and tidy up pulldown so it looks like a menu. + * switch window now uses libadwadi panel + * switch window search shows full file list in panel - so you can jump to file + * control-o tiggers file open, after file serach up/down arrows select file, and enter / shift enter will open. -- Alan Knowles Sun, 28 Jan 2024 06:54:56 +0800 diff --git a/meson.build b/meson.build index a121621f9..34fb2087a 100644 --- a/meson.build +++ b/meson.build @@ -93,7 +93,6 @@ roobuilder_src = files([ 'src/Builder4/EditProject.vala', 'src/Builder4/FakeServer.vala', 'src/Builder4/GtkView.vala', - 'src/Builder4/MainWindow.vala', 'src/Builder4/PopoverAddObject.vala', 'src/Builder4/PopoverProperty.vala', 'src/Builder4/StandardErrorDialog.vala', @@ -148,6 +147,7 @@ roobuilder_src = files([ 'src/JsRender/NodeWriter.vala', 'src/JsRender/NodeToValaExtended.vala', 'src/JsRender/NodeToValaWrapped.vala', + 'src/Builder4/MainWindow.vala', ]) roobuilder = executable('roobuilder', diff --git a/src/Builder4/MainWindow.bjs b/src/Builder4/MainWindow.bjs index 5e0e29706..2ffff3b3d 100644 --- a/src/Builder4/MainWindow.bjs +++ b/src/Builder4/MainWindow.bjs @@ -20,7 +20,6 @@ "id" : "MainWindow", "items" : [ { - "$ string title" : "\"Application Builder\"", "$ xns" : "Gtk", "* pack" : "set_titlebar", "bool show_close_button" : true, @@ -35,26 +34,27 @@ "$ xns" : "Gtk", "* pack" : "append", "bool has_frame" : false, + "bool has_tooltip" : true, + "items" : [ + { + "$ xns" : "Adw", + "* prop" : "child", + "string icon_name" : "preferences-system-windows", + "string label" : " Files", + "xtype" : "ButtonContent" + } + ], "listeners" : { "clicked" : [ " ( ) => {", " \t_this.splitview.el.show_sidebar = !_this.splitview.el.show_sidebar;", " \tif (_this.splitview.el.show_sidebar) {", - " \t\t_this.filesearch.el.grab_focus();", - " \t\t_this.winloading = true;", - " \t\t_this.winmodel.el.remove_all();", - " \t\t_this.filesearch.el.set_text(\"\");", - " \t\tfor(var i = 0;i < BuilderApplication.windowlist.get_n_items(); i++) {", - "\t\t\t_this.winmodel.el.append( BuilderApplication.windowlist.get_item(i));", - "\t\t}", - "\t\t_this.winsel.selectCurrent();", - "\t\t_this.winloading = false;", + " \t\t_this.sidebar.show(); ", " \t}", "}" ] }, - "string icon_name" : "preferences-system-windows", - "tooltop_text" : "Manage Windows", + "string tooltip_text" : "Manage Windows (Ctrl-O)", "xtype" : "Button" } ], @@ -587,32 +587,100 @@ "$ xns" : "Gtk", "* prop" : "sidebar", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", + "id" : "sidebar", "int spacing" : 0, "items" : [ { "$ xns" : "Gtk", + "* prop" : "child", + "bool has_tooltip" : true, "bool hexpand" : true, - "bool search_mode_enabled" : true, + "id" : "filesearch", "items" : [ { "$ xns" : "Gtk", - "* prop" : "child", - "bool hexpand" : true, - "id" : "filesearch", "listeners" : { - "search_changed" : [ - "( ) => {", - "", - "\t_this.windowsearch.el.set_search(this.el.get_text());", + "key_released" : [ + "(keyval, keycode, state) => {", + "\tif (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) {", + "\t\treturn;", + "\t}", + "\tGLib.debug(", + "\t", + "\t\t\"searcj key release %d, %d, %d ?= %d\" , ", + "\t\t\t(int) keyval, (int) keycode, state,", + "\t\t\t(int)Gdk.Key.Return", + "\t\t);", + "\tif (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) {", + "\t\treturn;", + "\t}", + "\t\t", + "\tvar dir = 0;", + "\t", + "\tif (keyval == Gdk.Key.Return) {", + "\t\tvar tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;", + "\t\tGLib.debug(\"SELECTED = %s\", tr.item.get_type().name());", + "\t\tvar f = (JsRender.JsRender) tr.item;", + "\t\tGLib.debug(\"Click %s\", f.name);", + "\t\tif (f.xtype == \"Dir\") {", + "\t\t\treturn;", + "\t\t}", + "\t\t", + "\t\t", + "\t \t_this.windowstate.fileViewOpen(f,", + "\t \t\t_this.keystate.is_shift != 1 ", + "\t\t);", + "\t\t", + "\t\t_this.splitview.el.show_sidebar = false;", + "\t\treturn;", + "\t\t", + "\t", + "\t}", + "\tif (keyval == Gdk.Key.Up) {", + "\t\tdir = -1;", + "\t}if (keyval == Gdk.Key.Down) {", + "\t\tdir = 1;", + "\t}", + "\tif (dir == 0) {", + "\t\treturn;", + "\t}", + "\tvar ns = _this.treeselmodel.el.selected + dir;", + "\tif (ns < 0) {", + "\t\tns = 0;", + "\t}", + "\tif (ns >= _this.treeselmodel.el.get_n_items()) {", + "\t\tns = _this.treeselmodel.el.get_n_items()-1;", + "\t}", + "\t_this.treeselmodel.el.selected = ns;", "}", "" ] }, - "string placeholder_text" : "Search for file", - "xtype" : "SearchEntry" + "xtype" : "EventControllerKey" } ], - "xtype" : "SearchBar" + "listeners" : { + "search_changed" : [ + "( ) => {", + "", + "\t_this.windowsearch.el.set_search(this.el.get_text());", + "\tif (this.el.text == \"\") {", + "\t\t_this.treescroll.el.visible = false;", + "\t\treturn;", + "\t}", + "\t_this.treescroll.el.visible = true;", + "\t_this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);", + "}", + "" + ] + }, + "string placeholder_text" : "Search for file", + "string tooltip_text" : [ + "up/down arrow to select file from lower file list", + "enter opens selected in new window", + "shift+enter opens it in this window " + ], + "xtype" : "SearchEntry" }, { "$ xns" : "Gtk", @@ -702,6 +770,7 @@ { "$ xns" : "Gtk", "* prop" : "start_child", + "bool has_frame" : true, "items" : [ { "$ xns" : "Gtk", @@ -900,20 +969,58 @@ }, { "* prop" : "end_child", + "bool has_frame" : true, "bool hexpand" : true, "bool vexpand" : true, + "bool visible" : false, + "id" : "treescroll", "items" : [ { "$ xns" : "Gtk", "* prop" : "child", "bool hexpand" : true, "bool vexpand" : true, + "id" : "treeview", "items" : [ + { + "$ xns" : "Gtk", + "listeners" : { + "pressed" : [ + "(n_press, x, y) => {", + "\tif (n_press == 2) {", + "\t\tGLib.debug(\"double cliced\");", + "\t} else {", + "\t\treturn;", + "\t}", + "\tvar tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;", + "\tGLib.debug(\"SELECTED = %s\", tr.item.get_type().name());", + "\tvar f = (JsRender.JsRender) tr.item;", + "\tGLib.debug(\"Click %s\", f.name);", + "\tif (f.xtype == \"Dir\") {", + "\t\treturn;", + "\t}", + "\t", + "\t", + " \t_this.windowstate.fileViewOpen(f,", + " \t\t_this.keystate.is_shift != 1 ", + "\t);", + "\t", + "\t_this.splitview.el.show_sidebar = false;", + "\t", + "\t", + "", + "}", + "" + ] + }, + "xtype" : "GestureClick" + }, { "$ xns" : "Gtk", "* prop" : "model", - "bool autoselect" : false, + "bool autoselect" : true, "bool can_unselect" : true, + "id" : "treeselmodel", "items" : [ { "$ xns" : "Gtk", @@ -922,100 +1029,132 @@ { "$ xns" : "Gtk", "* prop" : "model", + "bool incremental" : true, + "id" : "treelistsort", "items" : [ { - "$ xns" : "GLib", + "$ xns" : "Gtk", "* prop" : "model", - "GLib.Type item_type" : "typeof(WindowState)", - "id" : "histmodel", - "xtype" : "ListStore" + "Gtk.TreeListModelCreateModelFunc create_func" : [ + "(item) => {", + "\t//GLib.debug(\"liststore got %s\", item.get_type().name());", + "\treturn ((JsRender.JsRender)item).childfiles;", + "} " + ], + "bool autoexpand" : true, + "bool passthrough" : false, + "id" : "treelistmodel", + "items" : [ + { + "$ xns" : "GLib", + "* prop" : "root", + "GLib.Type item_type" : "typeof(JsRender.JsRender)", + "id" : "treemodel", + "xtype" : "ListStore" + } + ], + "xtype" : "TreeListModel" }, { "$ xns" : "Gtk", - "* prop" : "filter", - "id" : "histsearch", + "* prop" : "sorter", "items" : [ { "$ xns" : "Gtk", - "* prop" : "expression", - "GLib.Type this_type" : "typeof(WindowState)", - "string property_name" : "file_name", - "xtype" : "PropertyExpression" + "* prop" : "sorter", + "bool ignore_case" : true, + "items" : [ + { + "$ xns" : "Gtk", + "* prop" : "expression", + "GLib.Type this_type" : "typeof(JsRender.JsRender) ", + "string property_name" : "name", + "xtype" : "PropertyExpression" + } + ], + "xtype" : "StringSorter" } ], - "xtype" : "StringFilter" + "xtype" : "TreeListRowSorter" } ], - "xtype" : "FilterListModel" + "xtype" : "SortListModel" }, { "$ xns" : "Gtk", - "* prop" : "sorter", - "bool ignore_case" : true, - "items" : [ - { - "$ xns" : "Gtk", - "* prop" : "expression", - "GLib.Type this_type" : "typeof(WindowState)", - "string property_name" : "file_name", - "xtype" : "PropertyExpression" - } + "* prop" : "filter", + "Gtk.CustomFilterFunc match_func" : [ + "(item) => { ", + "\tvar tr = ((Gtk.TreeListRow)item).get_item();", + "\t//GLib.debug(\"filter %s\", tr.get_type().name());", + "\tvar j = (JsRender.JsRender) tr;", + "\tif (j.xtype == \"Dir\" && j.childfiles.n_items < 1) {", + "\t\treturn false;", + "\t}", + "\tvar str = _this.filesearch.el.text.down();\t", + "\tif (j.xtype == \"Dir\") {", + "\t", + "\t\t", + "\t\tfor (var i =0 ; i < j.childfiles.n_items; i++) {", + "\t\t\tvar f = (JsRender.JsRender) j.childfiles.get_item(i);", + "\t\t\t//if (f.xtype != \"PlainFile\") {", + "\t\t\t//\tcontinue;", + "\t\t\t//}", + "\t\t\tif (f.content_type.contains(\"image\")) {", + "\t\t\t\tcontinue;", + "\t\t\t}", + "\t\t\tif (str.length < 1) {", + "\t\t\t\treturn true;", + "\t\t\t}", + "\t\t\tif (f.name.down().contains(str)) {", + "\t\t\t\treturn true;", + "\t\t\t}", + "\t\t\t", + "\t\t}", + "\t\t ", + "\t\treturn false;", + "\t}", + "\t//if (j.xtype != \"PlainFile\") {", + "\t//\treturn false;", + "\t//}", + " \tif (j.content_type.contains(\"image\")) {", + "\t\treturn false;", + "\t}", + "\t\t\t ", + "\tif (str.length < 1) { // no search.", + "\t\treturn true;", + "\t}", + "\tif (j.name.down().contains(str)) {", + "\t\treturn true;", + "\t}", + "\treturn false; ", + "", + "}" ], - "xtype" : "StringSorter" + "id" : "treefilter", + "xtype" : "CustomFilter" } ], - "xtype" : "SortListModel" + "xtype" : "FilterListModel" } ], "xtype" : "SingleSelection" }, { "$ xns" : "Gtk", - "bool expand" : true, - "bool resizable" : true, - "items" : [ - { - "$ xns" : "Gtk", - "* prop" : "factory", - "listeners" : { - "bind" : [ - "(listitem) => {", - "\t var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child();", - "\t var item = (listitem as Gtk.ListItem).get_item() as WindowState;", - "\t ", - "\t lb.label = item.project.name;", - "", - "", - " ", - "", - "}", - "" - ], - "setup" : [ - "(listitem) => {", - "\tvar lbl = new Gtk.Label(\"\");", - " \t(listitem as Gtk.ListItem).set_child(lbl);", - " \tlbl.justify = Gtk.Justification.LEFT;", - " \tlbl.xalign = 1;", - " \tlbl.use_markup = true;", - "\tlbl.ellipsize = Pango.EllipsizeMode.START;", - " ", - "\t(listitem as Gtk.ListItem).activatable = true;", - "}", - "" - ] - }, - "xtype" : "SignalListItemFactory" - } + "* init" : [ + "{", + "\t// this.el.set_sorter( new Gtk.StringSorter(", + "\t// \tnew Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, \"name\")", + " //\t));", + "\t\t", + "}", + "" ], - "title" : "Project", - "xtype" : "ColumnViewColumn" - }, - { - "$ xns" : "Gtk", "* pack" : "append_column", "bool expand" : true, "bool resizable" : true, + "id" : "name", "items" : [ { "$ xns" : "Gtk", @@ -1023,27 +1162,75 @@ "listeners" : { "bind" : [ "(listitem) => {", - " var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child();", - " var item = (listitem as Gtk.ListItem).get_item() as WindowState;", + "\t", + "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());", + " \t", + " \t", + " \t", + " \t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", + " \tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", + " \t ", + " \tvar hbox = (Gtk.Box) expand.child;", " ", - " lb.label = item.file.relpath;", + "\t", + "\t\tvar img = (Gtk.Image) hbox.get_first_child();", + "\t\tvar lbl = (Gtk.Label) img.get_next_sibling();", "", + " ", + " \t", + " \t if (lbl == null || lbl.label != \"\") { // do not update", + " \t \treturn;", + " \t}", + " \tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();", + " \t//GLib.debug(\"LR = %s\", lr.get_type().name());", + " ", + " \t", + " \tvar jr =(JsRender.JsRender) lr.get_item();", + " \t//GLib.debug(\"JR = %s\", jr.get_type().name());\t\t", + " \t", + " \t if (jr == null) {", + " \t\t GLib.debug(\"Problem getting item\"); ", + " \t\t return;", + " \t }", "", - " ", + "\t\tjr.bind_property(\"icon\",", + " img, \"gicon\",", + " GLib.BindingFlags.SYNC_CREATE);", "", + " \t//GLib.debug(\"change %s to %s\", lbl.label, np.name);", + " \tlbl.label = jr.name; // for dir's we could hsow the sub path..", + " \tlbl.tooltip_markup = jr.path;", + " \t ", + " expand.set_hide_expander( jr.xtype != \"Dir\" );", + " \t expand.set_list_row(lr);", + " ", + " \t ", + " \t// bind image...", "}", "" ], "setup" : [ "(listitem) => {", + "\t", + "\tvar expand = new Gtk.TreeExpander();", + "\t ", + "\texpand.set_indent_for_depth(true);", + "\texpand.set_indent_for_icon(true);", + "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);", + "\tvar icon = new Gtk.Image();", + "\ticon.margin_end = 4;", "\tvar lbl = new Gtk.Label(\"\");", - " \t(listitem as Gtk.ListItem).set_child(lbl);", + "\tlbl.use_markup = true;", + "\t", + "\t", " \tlbl.justify = Gtk.Justification.LEFT;", - " \tlbl.xalign = 1;", - " \tlbl.use_markup = true;", - "\tlbl.ellipsize = Pango.EllipsizeMode.START;", - " ", - "\t(listitem as Gtk.ListItem).activatable = true;", + " \tlbl.xalign = 0;", + "", + " \thbox.append(icon);", + "\thbox.append(lbl);", + "\texpand.set_child(hbox);", + "\t((Gtk.ListItem)listitem).set_child(expand);", + "\t((Gtk.ListItem)listitem).activatable = false;", "}", "" ] @@ -1051,13 +1238,17 @@ "xtype" : "SignalListItemFactory" } ], - "title" : "File", + "string title" : "All Project Files", "xtype" : "ColumnViewColumn" } ], "xtype" : "ColumnView" } ], + "string tooltip_text" : [ + "dbl-click - opens in NEW window ", + "shift--dbl-click opens in this window" + ], "string xns" : "Gtk", "string xtype" : "ScrolledWindow" } @@ -1065,7 +1256,77 @@ "xtype" : "Paned" } ], - "xtype" : "Box" + "xtype" : "Box", + "| void show" : [ + "() {", + "\t_this.splitview.el.show_sidebar = true;", + " \t ", + "\t_this.filesearch.el.grab_focus();", + "\t_this.winloading = true;", + "\t_this.winmodel.el.remove_all();", + "\t_this.filesearch.el.set_text(\"\");", + "\tfor(var i = 0;i < BuilderApplication.windowlist.get_n_items(); i++) {", + "\t\t_this.winmodel.el.append( BuilderApplication.windowlist.get_item(i));", + "\t}", + "\t_this.winsel.selectCurrent();", + "\t_this.winloading = false;", + "\t", + "\t _this.treeview.el.set_model(new Gtk.SingleSelection(null));", + "\t", + "\t_this.windowstate.project.loadDirsIntoStore(_this.treemodel.el);", + "\t", + "\t_this.treeview.el.set_model(_this.treeselmodel.el);", + "\t", + " \t _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;", + "\t", + " ", + "}" + ] + }, + { + "$ xns" : "Gtk", + "id" : "keystate", + "int is_shift" : 0, + "listeners" : { + "key_pressed" : [ + "(keyval, keycode, state) => {", + "", + " \tif (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {", + " \t\tthis.is_shift = 1;", + " \t\t", + "\t}", + "\t", + "\t", + "\treturn true;", + "\t", + "}", + "" + ], + "key_released" : [ + "(keyval, keycode, state) => {", + "\tGLib.debug(", + "\t", + "\t\t\"key release %d, %d, %d ?= %d %d\" , ", + "\t\t\t(int) keyval, (int) keycode, state,", + "\t\t\t(int)Gdk.Key.O, Gdk.ModifierType.CONTROL_MASK", + "\t\t);", + " \tif (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {", + " \t\tthis.is_shift = 0;", + "\t}", + "\t//GLib.debug(\"set state %d , shift = %d\", (int)this.el.get_current_event_state(), Gdk.ModifierType.SHIFT_MASK);", + "\tif (keyval == Gdk.Key.o && (state & Gdk.ModifierType.CONTROL_MASK) != 0) {", + "\t\t// ctrl O pressed", + "\t\tif (!_this.splitview.el.show_sidebar) {", + "\t \t\t_this.sidebar.show(); ", + "\t \t}", + "\t}", + "\t", + "", + " ", + "}" + ] + }, + "xtype" : "EventControllerKey" } ], "xtype" : "OverlaySplitView" @@ -1088,6 +1349,7 @@ "\t\tBuilderApplication.singleton( null ).quit();", "\t }", "\treturn true;", + "\t", "}", "" ], diff --git a/src/Builder4/MainWindow.vala b/src/Builder4/MainWindow.vala index c38134b38..94d0a0a29 100644 --- a/src/Builder4/MainWindow.vala +++ b/src/Builder4/MainWindow.vala @@ -31,6 +31,7 @@ public class Xcls_MainWindow : Object public Xcls_statusbar_run statusbar_run; public Xcls_statusbar_compile_spinner statusbar_compile_spinner; public Xcls_statusbar_compile_icon statusbar_compile_icon; + public Xcls_sidebar sidebar; public Xcls_filesearch filesearch; public Xcls_open_projects_btn open_projects_btn; public Xcls_winsel winsel; @@ -39,8 +40,15 @@ public class Xcls_MainWindow : Object public Xcls_winmodel winmodel; public Xcls_projcol projcol; public Xcls_filecol filecol; - public Xcls_histmodel histmodel; - public Xcls_histsearch histsearch; + public Xcls_treescroll treescroll; + public Xcls_treeview treeview; + public Xcls_treeselmodel treeselmodel; + public Xcls_treelistsort treelistsort; + public Xcls_treelistmodel treelistmodel; + public Xcls_treemodel treemodel; + public Xcls_treefilter treefilter; + public Xcls_name name; + public Xcls_keystate keystate; // my vars (def) public WindowState windowstate; @@ -86,6 +94,7 @@ public class Xcls_MainWindow : Object BuilderApplication.singleton( null ).quit(); } return true; + }); this.el.show.connect( ( ) => { // hide the file editing.. @@ -191,7 +200,6 @@ public class Xcls_MainWindow : Object // my vars (def) public bool show_close_button; - public string title; // ctor public Xcls_headerbar(Xcls_MainWindow _owner ) @@ -202,7 +210,6 @@ public class Xcls_MainWindow : Object // my vars (dec) this.show_close_button = true; - this.title = "Application Builder"; // set gobject values var child_1 = new Xcls_Box3( _this ); @@ -253,28 +260,47 @@ public class Xcls_MainWindow : Object // my vars (dec) // set gobject values - this.el.icon_name = "preferences-system-windows"; this.el.has_frame = false; + this.el.tooltip_text = "Manage Windows (Ctrl-O)"; + this.el.has_tooltip = true; + var child_1 = new Xcls_ButtonContent5( _this ); + this.el.child = child_1.el; //listeners this.el.clicked.connect( ( ) => { _this.splitview.el.show_sidebar = !_this.splitview.el.show_sidebar; if (_this.splitview.el.show_sidebar) { - _this.filesearch.el.grab_focus(); - _this.winloading = true; - _this.winmodel.el.remove_all(); - _this.filesearch.el.set_text(""); - for(var i = 0;i < BuilderApplication.windowlist.get_n_items(); i++) { - _this.winmodel.el.append( BuilderApplication.windowlist.get_item(i)); - } - _this.winsel.selectCurrent(); - _this.winloading = false; + _this.sidebar.show(); } }); } // user defined functions } + public class Xcls_ButtonContent5 : Object + { + public Adw.ButtonContent el; + private Xcls_MainWindow _this; + + + // my vars (def) + + // ctor + public Xcls_ButtonContent5(Xcls_MainWindow _owner ) + { + _this = _owner; + this.el = new Adw.ButtonContent(); + + // my vars (dec) + + // set gobject values + this.el.icon_name = "preferences-system-windows"; + this.el.label = " Files"; + } + + // user defined functions + } + @@ -297,12 +323,14 @@ public class Xcls_MainWindow : Object // set gobject values this.el.collapsed = true; - this.el.sidebar_width_fraction = 0.40000; + this.el.sidebar_width_fraction = 0.400000; this.el.show_sidebar = false; new Xcls_vbox( _this ); this.el.content = _this.vbox.el; - var child_2 = new Xcls_Box33( _this ); - this.el.sidebar = child_2.el; + new Xcls_sidebar( _this ); + this.el.sidebar = _this.sidebar.el; + new Xcls_keystate( _this ); + this.el.add_controller( _this.keystate.el ); } // user defined functions @@ -330,7 +358,7 @@ public class Xcls_MainWindow : Object this.el.vexpand = false; new Xcls_mainpane( _this ); this.el.append( _this.mainpane.el ); - var child_2 = new Xcls_Box15( _this ); + var child_2 = new Xcls_Box16( _this ); child_2.ref(); this.el.append( child_2.el ); } @@ -362,7 +390,7 @@ public class Xcls_MainWindow : Object this.el.position = 400; new Xcls_leftpane( _this ); this.el.start_child = _this.leftpane.el; - var child_2 = new Xcls_Box12( _this ); + var child_2 = new Xcls_Box13( _this ); this.el.end_child = child_2.el; //listeners @@ -488,7 +516,7 @@ public class Xcls_MainWindow : Object - public class Xcls_Box12 : Object + public class Xcls_Box13 : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -497,7 +525,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box12(Xcls_MainWindow _owner ) + public Xcls_Box13(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); @@ -567,7 +595,7 @@ public class Xcls_MainWindow : Object - public class Xcls_Box15 : Object + public class Xcls_Box16 : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -576,7 +604,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box15(Xcls_MainWindow _owner ) + public Xcls_Box16(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 ); @@ -586,21 +614,21 @@ public class Xcls_MainWindow : Object // set gobject values this.el.homogeneous = false; this.el.vexpand = false; - var child_1 = new Xcls_Button16( _this ); + var child_1 = new Xcls_Button17( _this ); child_1.ref(); this.el.append( child_1.el ); - var child_2 = new Xcls_Button17( _this ); + var child_2 = new Xcls_Button18( _this ); child_2.ref(); this.el.append( child_2.el ); - var child_3 = new Xcls_MenuButton18( _this ); + var child_3 = new Xcls_MenuButton19( _this ); child_3.ref(); this.el.append( child_3.el ); - var child_4 = new Xcls_Label23( _this ); + var child_4 = new Xcls_Label24( _this ); child_4.ref(); this.el.append( child_4.el ); new Xcls_statusbar( _this ); this.el.append( _this.statusbar.el ); - var child_6 = new Xcls_Box25( _this ); + var child_6 = new Xcls_Box26( _this ); child_6.ref(); this.el.append( child_6.el ); new Xcls_statusbar_compile_spinner( _this ); @@ -611,7 +639,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Button16 : Object + public class Xcls_Button17 : Object { public Gtk.Button el; private Xcls_MainWindow _this; @@ -621,7 +649,7 @@ public class Xcls_MainWindow : Object public bool always_show_image; // ctor - public Xcls_Button16(Xcls_MainWindow _owner ) + public Xcls_Button17(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -646,7 +674,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Button17 : Object + public class Xcls_Button18 : Object { public Gtk.Button el; private Xcls_MainWindow _this; @@ -656,7 +684,7 @@ public class Xcls_MainWindow : Object public bool always_show_image; // ctor - public Xcls_Button17(Xcls_MainWindow _owner ) + public Xcls_Button18(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -689,7 +717,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_MenuButton18 : Object + public class Xcls_MenuButton19 : Object { public Gtk.MenuButton el; private Xcls_MainWindow _this; @@ -699,7 +727,7 @@ public class Xcls_MainWindow : Object public bool always_show_image; // ctor - public Xcls_MenuButton18(Xcls_MainWindow _owner ) + public Xcls_MenuButton19(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.MenuButton(); @@ -734,7 +762,7 @@ public class Xcls_MainWindow : Object // my vars (dec) // set gobject values - var child_1 = new Xcls_Box20( _this ); + var child_1 = new Xcls_Box21( _this ); child_1.ref(); this.el.set_child ( child_1.el ); @@ -747,7 +775,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Box20 : Object + public class Xcls_Box21 : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -756,7 +784,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box20(Xcls_MainWindow _owner ) + public Xcls_Box21(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); @@ -764,17 +792,17 @@ public class Xcls_MainWindow : Object // my vars (dec) // set gobject values - var child_1 = new Xcls_Button21( _this ); + var child_1 = new Xcls_Button22( _this ); child_1.ref(); this.el.append( child_1.el ); - var child_2 = new Xcls_Button22( _this ); + var child_2 = new Xcls_Button23( _this ); child_2.ref(); this.el.append( child_2.el ); } // user defined functions } - public class Xcls_Button21 : Object + public class Xcls_Button22 : Object { public Gtk.Button el; private Xcls_MainWindow _this; @@ -783,7 +811,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Button21(Xcls_MainWindow _owner ) + public Xcls_Button22(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -802,7 +830,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Button22 : Object + public class Xcls_Button23 : Object { public Gtk.Button el; private Xcls_MainWindow _this; @@ -811,7 +839,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Button22(Xcls_MainWindow _owner ) + public Xcls_Button23(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -833,7 +861,7 @@ public class Xcls_MainWindow : Object - public class Xcls_Label23 : Object + public class Xcls_Label24 : Object { public Gtk.Label el; private Xcls_MainWindow _this; @@ -842,7 +870,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Label23(Xcls_MainWindow _owner ) + public Xcls_Label24(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Label( " " ); @@ -900,7 +928,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Box25 : Object + public class Xcls_Box26 : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -909,7 +937,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box25(Xcls_MainWindow _owner ) + public Xcls_Box26(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 ); @@ -1289,7 +1317,7 @@ public class Xcls_MainWindow : Object - public class Xcls_Box33 : Object + public class Xcls_sidebar : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -1298,28 +1326,52 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box33(Xcls_MainWindow _owner ) + public Xcls_sidebar(Xcls_MainWindow _owner ) { _this = _owner; + _this.sidebar = this; this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); // my vars (dec) // set gobject values - var child_1 = new Xcls_SearchBar34( _this ); + var child_1 = new Xcls_SearchBar35( _this ); child_1.ref(); this.el.append( child_1.el ); - var child_2 = new Xcls_Box36( _this ); + var child_2 = new Xcls_Box38( _this ); child_2.ref(); this.el.append( child_2.el ); - var child_3 = new Xcls_Paned45( _this ); + var child_3 = new Xcls_Paned47( _this ); child_3.ref(); this.el.append( child_3.el ); } // user defined functions + public void show () { + _this.splitview.el.show_sidebar = true; + + _this.filesearch.el.grab_focus(); + _this.winloading = true; + _this.winmodel.el.remove_all(); + _this.filesearch.el.set_text(""); + for(var i = 0;i < BuilderApplication.windowlist.get_n_items(); i++) { + _this.winmodel.el.append( BuilderApplication.windowlist.get_item(i)); + } + _this.winsel.selectCurrent(); + _this.winloading = false; + + _this.treeview.el.set_model(new Gtk.SingleSelection(null)); + + _this.windowstate.project.loadDirsIntoStore(_this.treemodel.el); + + _this.treeview.el.set_model(_this.treeselmodel.el); + + _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION; + + + } } - public class Xcls_SearchBar34 : Object + public class Xcls_SearchBar35 : Object { public Gtk.SearchBar el; private Xcls_MainWindow _this; @@ -1328,7 +1380,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_SearchBar34(Xcls_MainWindow _owner ) + public Xcls_SearchBar35(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.SearchBar(); @@ -1363,12 +1415,98 @@ public class Xcls_MainWindow : Object // set gobject values this.el.hexpand = true; + this.el.tooltip_text = "up/down arrow to select file from lower file list\nenter opens selected in new window\nshift+enter opens it in this window "; + this.el.has_tooltip = true; this.el.placeholder_text = "Search for file"; + var child_1 = new Xcls_EventControllerKey37( _this ); + child_1.ref(); + this.el.add_controller( child_1.el ); //listeners this.el.search_changed.connect( ( ) => { _this.windowsearch.el.set_search(this.el.get_text()); + if (this.el.text == "") { + _this.treescroll.el.visible = false; + return; + } + _this.treescroll.el.visible = true; + _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT); + }); + } + + // user defined functions + } + public class Xcls_EventControllerKey37 : Object + { + public Gtk.EventControllerKey el; + private Xcls_MainWindow _this; + + + // my vars (def) + + // ctor + public Xcls_EventControllerKey37(Xcls_MainWindow _owner ) + { + _this = _owner; + this.el = new Gtk.EventControllerKey(); + + // my vars (dec) + + // set gobject values + + //listeners + this.el.key_released.connect( (keyval, keycode, state) => { + if (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) { + return; + } + GLib.debug( + + "searcj key release %d, %d, %d ?= %d" , + (int) keyval, (int) keycode, state, + (int)Gdk.Key.Return + ); + if (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) { + return; + } + + var dir = 0; + + if (keyval == Gdk.Key.Return) { + var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item; + GLib.debug("SELECTED = %s", tr.item.get_type().name()); + var f = (JsRender.JsRender) tr.item; + GLib.debug("Click %s", f.name); + if (f.xtype == "Dir") { + return; + } + + + _this.windowstate.fileViewOpen(f, + _this.keystate.is_shift != 1 + ); + + _this.splitview.el.show_sidebar = false; + return; + + + } + if (keyval == Gdk.Key.Up) { + dir = -1; + }if (keyval == Gdk.Key.Down) { + dir = 1; + } + if (dir == 0) { + return; + } + var ns = _this.treeselmodel.el.selected + dir; + if (ns < 0) { + ns = 0; + } + if (ns >= _this.treeselmodel.el.get_n_items()) { + ns = _this.treeselmodel.el.get_n_items()-1; + } + _this.treeselmodel.el.selected = ns; }); } @@ -1376,7 +1514,8 @@ public class Xcls_MainWindow : Object } - public class Xcls_Box36 : Object + + public class Xcls_Box38 : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -1385,7 +1524,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box36(Xcls_MainWindow _owner ) + public Xcls_Box38(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 ); @@ -1396,7 +1535,7 @@ public class Xcls_MainWindow : Object this.el.hexpand = true; new Xcls_open_projects_btn( _this ); this.el.append( _this.open_projects_btn.el ); - var child_2 = new Xcls_Button41( _this ); + var child_2 = new Xcls_Button43( _this ); child_2.ref(); this.el.append( child_2.el ); } @@ -1422,7 +1561,7 @@ public class Xcls_MainWindow : Object // set gobject values this.el.hexpand = true; - var child_1 = new Xcls_Box38( _this ); + var child_1 = new Xcls_Box40( _this ); this.el.child = child_1.el; //listeners @@ -1433,7 +1572,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Box38 : Object + public class Xcls_Box40 : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -1442,7 +1581,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box38(Xcls_MainWindow _owner ) + public Xcls_Box40(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 ); @@ -1450,17 +1589,17 @@ public class Xcls_MainWindow : Object // my vars (dec) // set gobject values - var child_1 = new Xcls_Image39( _this ); + var child_1 = new Xcls_Image41( _this ); child_1.ref(); this.el.append( child_1.el ); - var child_2 = new Xcls_Label40( _this ); + var child_2 = new Xcls_Label42( _this ); child_2.ref(); this.el.append( child_2.el ); } // user defined functions } - public class Xcls_Image39 : Object + public class Xcls_Image41 : Object { public Gtk.Image el; private Xcls_MainWindow _this; @@ -1469,7 +1608,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Image39(Xcls_MainWindow _owner ) + public Xcls_Image41(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Image(); @@ -1484,7 +1623,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Label40 : Object + public class Xcls_Label42 : Object { public Gtk.Label el; private Xcls_MainWindow _this; @@ -1493,7 +1632,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Label40(Xcls_MainWindow _owner ) + public Xcls_Label42(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Label( "Open File" ); @@ -1508,7 +1647,7 @@ public class Xcls_MainWindow : Object - public class Xcls_Button41 : Object + public class Xcls_Button43 : Object { public Gtk.Button el; private Xcls_MainWindow _this; @@ -1517,7 +1656,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Button41(Xcls_MainWindow _owner ) + public Xcls_Button43(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -1526,7 +1665,7 @@ public class Xcls_MainWindow : Object // set gobject values this.el.hexpand = true; - var child_1 = new Xcls_Box42( _this ); + var child_1 = new Xcls_Box44( _this ); this.el.child = child_1.el; //listeners @@ -1538,7 +1677,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Box42 : Object + public class Xcls_Box44 : Object { public Gtk.Box el; private Xcls_MainWindow _this; @@ -1547,7 +1686,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Box42(Xcls_MainWindow _owner ) + public Xcls_Box44(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 ); @@ -1555,17 +1694,17 @@ public class Xcls_MainWindow : Object // my vars (dec) // set gobject values - var child_1 = new Xcls_Image43( _this ); + var child_1 = new Xcls_Image45( _this ); child_1.ref(); this.el.append( child_1.el ); - var child_2 = new Xcls_Label44( _this ); + var child_2 = new Xcls_Label46( _this ); child_2.ref(); this.el.append( child_2.el ); } // user defined functions } - public class Xcls_Image43 : Object + public class Xcls_Image45 : Object { public Gtk.Image el; private Xcls_MainWindow _this; @@ -1574,7 +1713,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Image43(Xcls_MainWindow _owner ) + public Xcls_Image45(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Image(); @@ -1589,7 +1728,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_Label44 : Object + public class Xcls_Label46 : Object { public Gtk.Label el; private Xcls_MainWindow _this; @@ -1598,7 +1737,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Label44(Xcls_MainWindow _owner ) + public Xcls_Label46(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Label( "New Window" ); @@ -1614,7 +1753,7 @@ public class Xcls_MainWindow : Object - public class Xcls_Paned45 : Object + public class Xcls_Paned47 : Object { public Gtk.Paned el; private Xcls_MainWindow _this; @@ -1623,7 +1762,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_Paned45(Xcls_MainWindow _owner ) + public Xcls_Paned47(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL ); @@ -1632,15 +1771,15 @@ public class Xcls_MainWindow : Object // set gobject values this.el.vexpand = true; - var child_1 = new Xcls_ScrolledWindow46( _this ); + var child_1 = new Xcls_ScrolledWindow48( _this ); this.el.start_child = child_1.el; - var child_2 = new Xcls_ScrolledWindow60( _this ); - this.el.end_child = child_2.el; + new Xcls_treescroll( _this ); + this.el.end_child = _this.treescroll.el; } // user defined functions } - public class Xcls_ScrolledWindow46 : Object + public class Xcls_ScrolledWindow48 : Object { public Gtk.ScrolledWindow el; private Xcls_MainWindow _this; @@ -1649,7 +1788,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_ScrolledWindow46(Xcls_MainWindow _owner ) + public Xcls_ScrolledWindow48(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.ScrolledWindow(); @@ -1657,13 +1796,14 @@ public class Xcls_MainWindow : Object // my vars (dec) // set gobject values - var child_1 = new Xcls_ColumnView47( _this ); + this.el.has_frame = true; + var child_1 = new Xcls_ColumnView49( _this ); this.el.child = child_1.el; } // user defined functions } - public class Xcls_ColumnView47 : Object + public class Xcls_ColumnView49 : Object { public Gtk.ColumnView el; private Xcls_MainWindow _this; @@ -1672,7 +1812,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_ColumnView47(Xcls_MainWindow _owner ) + public Xcls_ColumnView49(Xcls_MainWindow _owner ) { _this = _owner; new Xcls_winsel( _this ); @@ -1703,7 +1843,7 @@ public class Xcls_MainWindow : Object { _this = _owner; _this.winsel = this; - var child_1 = new Xcls_SortListModel49( _this ); + var child_1 = new Xcls_SortListModel51( _this ); child_1.ref(); this.el = new Gtk.SingleSelection( child_1.el ); @@ -1748,7 +1888,7 @@ public class Xcls_MainWindow : Object } } - public class Xcls_SortListModel49 : Object + public class Xcls_SortListModel51 : Object { public Gtk.SortListModel el; private Xcls_MainWindow _this; @@ -1757,11 +1897,11 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_SortListModel49(Xcls_MainWindow _owner ) + public Xcls_SortListModel51(Xcls_MainWindow _owner ) { _this = _owner; new Xcls_winfilter( _this ); - var child_2 = new Xcls_StringSorter54( _this ); + var child_2 = new Xcls_StringSorter56( _this ); child_2.ref(); this.el = new Gtk.SortListModel( _this.winfilter.el, child_2.el ); @@ -1809,7 +1949,7 @@ public class Xcls_MainWindow : Object { _this = _owner; _this.windowsearch = this; - var child_1 = new Xcls_PropertyExpression52( _this ); + var child_1 = new Xcls_PropertyExpression54( _this ); child_1.ref(); this.el = new Gtk.StringFilter( child_1.el ); @@ -1820,7 +1960,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_PropertyExpression52 : Object + public class Xcls_PropertyExpression54 : Object { public Gtk.PropertyExpression el; private Xcls_MainWindow _this; @@ -1829,7 +1969,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_PropertyExpression52(Xcls_MainWindow _owner ) + public Xcls_PropertyExpression54(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.PropertyExpression( typeof(WindowState), null, "file_name" ); @@ -1867,7 +2007,7 @@ public class Xcls_MainWindow : Object } - public class Xcls_StringSorter54 : Object + public class Xcls_StringSorter56 : Object { public Gtk.StringSorter el; private Xcls_MainWindow _this; @@ -1876,10 +2016,10 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_StringSorter54(Xcls_MainWindow _owner ) + public Xcls_StringSorter56(Xcls_MainWindow _owner ) { _this = _owner; - var child_1 = new Xcls_PropertyExpression55( _this ); + var child_1 = new Xcls_PropertyExpression57( _this ); child_1.ref(); this.el = new Gtk.StringSorter( child_1.el ); @@ -1891,7 +2031,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_PropertyExpression55 : Object + public class Xcls_PropertyExpression57 : Object { public Gtk.PropertyExpression el; private Xcls_MainWindow _this; @@ -1900,7 +2040,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_PropertyExpression55(Xcls_MainWindow _owner ) + public Xcls_PropertyExpression57(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.PropertyExpression( typeof(WindowState), null, "file_name" ); @@ -1929,7 +2069,7 @@ public class Xcls_MainWindow : Object { _this = _owner; _this.projcol = this; - var child_1 = new Xcls_SignalListItemFactory57( _this ); + var child_1 = new Xcls_SignalListItemFactory59( _this ); child_1.ref(); this.el = new Gtk.ColumnViewColumn( "Project", child_1.el ); @@ -1943,7 +2083,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_SignalListItemFactory57 : Object + public class Xcls_SignalListItemFactory59 : Object { public Gtk.SignalListItemFactory el; private Xcls_MainWindow _this; @@ -1952,7 +2092,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_SignalListItemFactory57(Xcls_MainWindow _owner ) + public Xcls_SignalListItemFactory59(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.SignalListItemFactory(); @@ -2001,7 +2141,7 @@ public class Xcls_MainWindow : Object { _this = _owner; _this.filecol = this; - var child_1 = new Xcls_SignalListItemFactory59( _this ); + var child_1 = new Xcls_SignalListItemFactory61( _this ); child_1.ref(); this.el = new Gtk.ColumnViewColumn( "File", child_1.el ); @@ -2015,7 +2155,7 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_SignalListItemFactory59 : Object + public class Xcls_SignalListItemFactory61 : Object { public Gtk.SignalListItemFactory el; private Xcls_MainWindow _this; @@ -2024,7 +2164,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_SignalListItemFactory59(Xcls_MainWindow _owner ) + public Xcls_SignalListItemFactory61(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.SignalListItemFactory(); @@ -2062,7 +2202,7 @@ public class Xcls_MainWindow : Object - public class Xcls_ScrolledWindow60 : Object + public class Xcls_treescroll : Object { public Gtk.ScrolledWindow el; private Xcls_MainWindow _this; @@ -2071,23 +2211,27 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_ScrolledWindow60(Xcls_MainWindow _owner ) + public Xcls_treescroll(Xcls_MainWindow _owner ) { _this = _owner; + _this.treescroll = this; this.el = new Gtk.ScrolledWindow(); // my vars (dec) // set gobject values + this.el.has_frame = true; this.el.hexpand = true; this.el.vexpand = true; - var child_1 = new Xcls_ColumnView61( _this ); - this.el.child = child_1.el; + this.el.tooltip_text = "dbl-click - opens in NEW window \nshift--dbl-click opens in this window"; + this.el.visible = false; + new Xcls_treeview( _this ); + this.el.child = _this.treeview.el; } // user defined functions } - public class Xcls_ColumnView61 : Object + public class Xcls_treeview : Object { public Gtk.ColumnView el; private Xcls_MainWindow _this; @@ -2096,79 +2240,102 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_ColumnView61(Xcls_MainWindow _owner ) + public Xcls_treeview(Xcls_MainWindow _owner ) { _this = _owner; - var child_1 = new Xcls_SingleSelection62( _this ); - child_1.ref(); - this.el = new Gtk.ColumnView( child_1.el ); + _this.treeview = this; + new Xcls_treeselmodel( _this ); + this.el = new Gtk.ColumnView( _this.treeselmodel.el ); // my vars (dec) // set gobject values this.el.hexpand = true; this.el.vexpand = true; - var child_2 = new Xcls_ColumnViewColumn70( _this ); + var child_2 = new Xcls_GestureClick64( _this ); child_2.ref(); - this.el.append_column( child_2.el ); - var child_3 = new Xcls_ColumnViewColumn72( _this ); - child_3.ref(); - this.el.append_column ( child_3.el ); + this.el.add_controller( child_2.el ); + new Xcls_name( _this ); + this.el.append_column ( _this.name.el ); } // user defined functions } - public class Xcls_SingleSelection62 : Object + public class Xcls_GestureClick64 : Object { - public Gtk.SingleSelection el; + public Gtk.GestureClick el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_SingleSelection62(Xcls_MainWindow _owner ) + public Xcls_GestureClick64(Xcls_MainWindow _owner ) { _this = _owner; - var child_1 = new Xcls_SortListModel63( _this ); - child_1.ref(); - this.el = new Gtk.SingleSelection( child_1.el ); + this.el = new Gtk.GestureClick(); // my vars (dec) // set gobject values - this.el.can_unselect = true; - this.el.autoselect = false; + + //listeners + this.el.pressed.connect( (n_press, x, y) => { + if (n_press == 2) { + GLib.debug("double cliced"); + } else { + return; + } + var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item; + GLib.debug("SELECTED = %s", tr.item.get_type().name()); + var f = (JsRender.JsRender) tr.item; + GLib.debug("Click %s", f.name); + if (f.xtype == "Dir") { + return; + } + + + _this.windowstate.fileViewOpen(f, + _this.keystate.is_shift != 1 + ); + + _this.splitview.el.show_sidebar = false; + + + + }); } // user defined functions } - public class Xcls_SortListModel63 : Object + + public class Xcls_treeselmodel : Object { - public Gtk.SortListModel el; + public Gtk.SingleSelection el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_SortListModel63(Xcls_MainWindow _owner ) + public Xcls_treeselmodel(Xcls_MainWindow _owner ) { _this = _owner; - var child_1 = new Xcls_FilterListModel64( _this ); + _this.treeselmodel = this; + var child_1 = new Xcls_FilterListModel66( _this ); child_1.ref(); - var child_2 = new Xcls_StringSorter68( _this ); - child_2.ref(); - this.el = new Gtk.SortListModel( child_1.el, child_2.el ); + this.el = new Gtk.SingleSelection( child_1.el ); // my vars (dec) // set gobject values + this.el.can_unselect = true; + this.el.autoselect = true; } // user defined functions } - public class Xcls_FilterListModel64 : Object + public class Xcls_FilterListModel66 : Object { public Gtk.FilterListModel el; private Xcls_MainWindow _this; @@ -2177,12 +2344,12 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_FilterListModel64(Xcls_MainWindow _owner ) + public Xcls_FilterListModel66(Xcls_MainWindow _owner ) { _this = _owner; - new Xcls_histmodel( _this ); - new Xcls_histsearch( _this ); - this.el = new Gtk.FilterListModel( _this.histmodel.el, _this.histsearch.el ); + new Xcls_treelistsort( _this ); + new Xcls_treefilter( _this ); + this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el ); // my vars (dec) @@ -2191,45 +2358,50 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_histmodel : Object + public class Xcls_treelistsort : Object { - public GLib.ListStore el; + public Gtk.SortListModel el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_histmodel(Xcls_MainWindow _owner ) + public Xcls_treelistsort(Xcls_MainWindow _owner ) { _this = _owner; - _this.histmodel = this; - this.el = new GLib.ListStore( typeof(WindowState) ); + _this.treelistsort = this; + new Xcls_treelistmodel( _this ); + var child_2 = new Xcls_TreeListRowSorter70( _this ); + child_2.ref(); + this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el ); // my vars (dec) // set gobject values + this.el.incremental = true; } // user defined functions } - - public class Xcls_histsearch : Object + public class Xcls_treelistmodel : Object { - public Gtk.StringFilter el; + public Gtk.TreeListModel el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_histsearch(Xcls_MainWindow _owner ) + public Xcls_treelistmodel(Xcls_MainWindow _owner ) { _this = _owner; - _this.histsearch = this; - var child_1 = new Xcls_PropertyExpression67( _this ); - child_1.ref(); - this.el = new Gtk.StringFilter( child_1.el ); + _this.treelistmodel = this; + 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; +} ); // my vars (dec) @@ -2238,19 +2410,20 @@ public class Xcls_MainWindow : Object // user defined functions } - public class Xcls_PropertyExpression67 : Object + public class Xcls_treemodel : Object { - public Gtk.PropertyExpression el; + public GLib.ListStore el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_PropertyExpression67(Xcls_MainWindow _owner ) + public Xcls_treemodel(Xcls_MainWindow _owner ) { _this = _owner; - this.el = new Gtk.PropertyExpression( typeof(WindowState), null, "file_name" ); + _this.treemodel = this; + this.el = new GLib.ListStore( typeof(JsRender.JsRender) ); // my vars (dec) @@ -2261,127 +2434,149 @@ public class Xcls_MainWindow : Object } - - public class Xcls_StringSorter68 : Object + public class Xcls_TreeListRowSorter70 : Object { - public Gtk.StringSorter el; + public Gtk.TreeListRowSorter el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_StringSorter68(Xcls_MainWindow _owner ) + public Xcls_TreeListRowSorter70(Xcls_MainWindow _owner ) { _this = _owner; - var child_1 = new Xcls_PropertyExpression69( _this ); + var child_1 = new Xcls_StringSorter71( _this ); child_1.ref(); - this.el = new Gtk.StringSorter( child_1.el ); + this.el = new Gtk.TreeListRowSorter( child_1.el ); // my vars (dec) // set gobject values - this.el.ignore_case = true; } // user defined functions } - public class Xcls_PropertyExpression69 : Object + public class Xcls_StringSorter71 : Object { - public Gtk.PropertyExpression el; + public Gtk.StringSorter el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_PropertyExpression69(Xcls_MainWindow _owner ) + public Xcls_StringSorter71(Xcls_MainWindow _owner ) { _this = _owner; - this.el = new Gtk.PropertyExpression( typeof(WindowState), null, "file_name" ); + var child_1 = new Xcls_PropertyExpression72( _this ); + child_1.ref(); + this.el = new Gtk.StringSorter( child_1.el ); // my vars (dec) // set gobject values + this.el.ignore_case = true; } // user defined functions } - - - - - public class Xcls_ColumnViewColumn70 : Object + public class Xcls_PropertyExpression72 : Object { - public Gtk.ColumnViewColumn el; + public Gtk.PropertyExpression el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_ColumnViewColumn70(Xcls_MainWindow _owner ) + public Xcls_PropertyExpression72(Xcls_MainWindow _owner ) { _this = _owner; - var child_1 = new Xcls_SignalListItemFactory71( _this ); - child_1.ref(); - this.el = new Gtk.ColumnViewColumn( "Project", child_1.el ); + this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" ); // my vars (dec) // set gobject values - this.el.expand = true; - this.el.resizable = true; } // user defined functions } - public class Xcls_SignalListItemFactory71 : Object + + + + + public class Xcls_treefilter : Object { - public Gtk.SignalListItemFactory el; + public Gtk.CustomFilter el; private Xcls_MainWindow _this; // my vars (def) // ctor - public Xcls_SignalListItemFactory71(Xcls_MainWindow _owner ) + public Xcls_treefilter(Xcls_MainWindow _owner ) { _this = _owner; - this.el = new Gtk.SignalListItemFactory(); + _this.treefilter = this; + this.el = new Gtk.CustomFilter( (item) => { + var tr = ((Gtk.TreeListRow)item).get_item(); + //GLib.debug("filter %s", tr.get_type().name()); + var j = (JsRender.JsRender) tr; + if (j.xtype == "Dir" && j.childfiles.n_items < 1) { + return false; + } + var str = _this.filesearch.el.text.down(); + if (j.xtype == "Dir") { + + + for (var i =0 ; i < j.childfiles.n_items; i++) { + var f = (JsRender.JsRender) j.childfiles.get_item(i); + //if (f.xtype != "PlainFile") { + // continue; + //} + if (f.content_type.contains("image")) { + continue; + } + if (str.length < 1) { + return true; + } + if (f.name.down().contains(str)) { + return true; + } + + } + + return false; + } + //if (j.xtype != "PlainFile") { + // return false; + //} + if (j.content_type.contains("image")) { + return false; + } + + if (str.length < 1) { // no search. + return true; + } + if (j.name.down().contains(str)) { + return true; + } + return false; + +} ); // my vars (dec) // set gobject values - - //listeners - this.el.setup.connect( (listitem) => { - var lbl = new Gtk.Label(""); - (listitem as Gtk.ListItem).set_child(lbl); - lbl.justify = Gtk.Justification.LEFT; - lbl.xalign = 1; - lbl.use_markup = true; - lbl.ellipsize = Pango.EllipsizeMode.START; - - (listitem as Gtk.ListItem).activatable = true; - }); - this.el.bind.connect( (listitem) => { - var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child(); - var item = (listitem as Gtk.ListItem).get_item() as WindowState; - - lb.label = item.project.name; - - - - - }); } // user defined functions } - public class Xcls_ColumnViewColumn72 : Object + + public class Xcls_name : Object { public Gtk.ColumnViewColumn el; private Xcls_MainWindow _this; @@ -2390,23 +2585,34 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_ColumnViewColumn72(Xcls_MainWindow _owner ) + public Xcls_name(Xcls_MainWindow _owner ) { _this = _owner; - var child_1 = new Xcls_SignalListItemFactory73( _this ); + _this.name = this; + var child_1 = new Xcls_SignalListItemFactory75( _this ); child_1.ref(); - this.el = new Gtk.ColumnViewColumn( "File", child_1.el ); + this.el = new Gtk.ColumnViewColumn( "All Project Files", child_1.el ); // my vars (dec) // set gobject values + this.el.id = "name"; this.el.expand = true; this.el.resizable = true; + + // init method + + { + // this.el.set_sorter( new Gtk.StringSorter( + // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name") + // )); + + } } // user defined functions } - public class Xcls_SignalListItemFactory73 : Object + public class Xcls_SignalListItemFactory75 : Object { public Gtk.SignalListItemFactory el; private Xcls_MainWindow _this; @@ -2415,7 +2621,7 @@ public class Xcls_MainWindow : Object // my vars (def) // ctor - public Xcls_SignalListItemFactory73(Xcls_MainWindow _owner ) + public Xcls_SignalListItemFactory75(Xcls_MainWindow _owner ) { _this = _owner; this.el = new Gtk.SignalListItemFactory(); @@ -2426,24 +2632,72 @@ public class Xcls_MainWindow : Object //listeners this.el.setup.connect( (listitem) => { + + var expand = new Gtk.TreeExpander(); + + expand.set_indent_for_depth(true); + expand.set_indent_for_icon(true); + var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0); + var icon = new Gtk.Image(); + icon.margin_end = 4; var lbl = new Gtk.Label(""); - (listitem as Gtk.ListItem).set_child(lbl); + lbl.use_markup = true; + + lbl.justify = Gtk.Justification.LEFT; - lbl.xalign = 1; - lbl.use_markup = true; - lbl.ellipsize = Pango.EllipsizeMode.START; - - (listitem as Gtk.ListItem).activatable = true; + lbl.xalign = 0; + + hbox.append(icon); + hbox.append(lbl); + expand.set_child(hbox); + ((Gtk.ListItem)listitem).set_child(expand); + ((Gtk.ListItem)listitem).activatable = false; }); this.el.bind.connect( (listitem) => { - var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child(); - var item = (listitem as Gtk.ListItem).get_item() as WindowState; + + //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name()); + + + + //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child(); + var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child(); + + var hbox = (Gtk.Box) expand.child; - lb.label = item.file.relpath; + + var img = (Gtk.Image) hbox.get_first_child(); + var lbl = (Gtk.Label) img.get_next_sibling(); + + + if (lbl == null || lbl.label != "") { // do not update + return; + } + var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item(); + //GLib.debug("LR = %s", lr.get_type().name()); + + + var jr =(JsRender.JsRender) lr.get_item(); + //GLib.debug("JR = %s", jr.get_type().name()); + + if (jr == null) { + GLib.debug("Problem getting item"); + return; + } - + jr.bind_property("icon", + img, "gicon", + GLib.BindingFlags.SYNC_CREATE); + //GLib.debug("change %s to %s", lbl.label, np.name); + lbl.label = jr.name; // for dir's we could hsow the sub path.. + lbl.tooltip_markup = jr.path; + + expand.set_hide_expander( jr.xtype != "Dir" ); + expand.set_list_row(lr); + + + // bind image... }); } @@ -2455,5 +2709,64 @@ public class Xcls_MainWindow : Object + public class Xcls_keystate : Object + { + public Gtk.EventControllerKey el; + private Xcls_MainWindow _this; + + + // my vars (def) + public int is_shift; + + // ctor + public Xcls_keystate(Xcls_MainWindow _owner ) + { + _this = _owner; + _this.keystate = this; + this.el = new Gtk.EventControllerKey(); + + // my vars (dec) + this.is_shift = 0; + + // set gobject values + + //listeners + this.el.key_released.connect( (keyval, keycode, state) => { + GLib.debug( + + "key release %d, %d, %d ?= %d %d" , + (int) keyval, (int) keycode, state, + (int)Gdk.Key.O, Gdk.ModifierType.CONTROL_MASK + ); + if (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) { + this.is_shift = 0; + } + //GLib.debug("set state %d , shift = %d", (int)this.el.get_current_event_state(), Gdk.ModifierType.SHIFT_MASK); + if (keyval == Gdk.Key.o && (state & Gdk.ModifierType.CONTROL_MASK) != 0) { + // ctrl O pressed + if (!_this.splitview.el.show_sidebar) { + _this.sidebar.show(); + } + } + + + + }); + this.el.key_pressed.connect( (keyval, keycode, state) => { + + if (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) { + this.is_shift = 1; + + } + + + return true; + + }); + } + + // user defined functions + } + } diff --git a/src/Builder4/WindowLeftProps.bjs b/src/Builder4/WindowLeftProps.bjs index 736d2df38..6e91f2896 100644 --- a/src/Builder4/WindowLeftProps.bjs +++ b/src/Builder4/WindowLeftProps.bjs @@ -1212,11 +1212,11 @@ "\t\t\t\t}", "\t\t\t\t// should be columnlistview", "\t\t\t\tchild = child.get_first_child(); ", - "\t\t\t GLib.debug(\"header height=%d\", h);", + "\t\t\t //GLib.debug(\"header height=%d\", h);", "\t\t\t\theader_height = h;", "\t\t\t\t", "\t\t\t\treading_header = false;", - "\t\t\t\t", + "\t\t\t\tcontinue;", "\t }", "\t ", "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {", @@ -1230,6 +1230,13 @@ "\t\t ", "\t\t line_no++;", "\t\t\tvar hh = child.get_height();", + "\t\t\tif (child.has_css_class(\"node-err\") || ", + "\t\t\t\tchild.has_css_class(\"node-warn\") || ", + "\t\t\t\tchild.has_css_class(\"node-depr\")) {", + "\t\t\t\thh += 10;", + "\t\t\t", + "\t\t\t}", + "\t\t\t", "\t\t\t//child.get_allocation(out alloc);", "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);", "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),", @@ -1425,42 +1432,6 @@ "", "}" ], - "| void a_addProp" : [ - " (JsRender.NodeProp prop) {", - " // info includes key, val, skel, etype..", - " //console.dump(info);", - " //type = info.type.toLowerCase();", - " //var data = this.toJS();", - " ", - " ", - " if (prop.ptype == JsRender.NodePropType.LISTENER) {", - " if (this.node.listeners.has_key(prop.name)) {", - " return;", - " }", - " this.node.listeners.set(prop.name,prop);", - " } else {", - " assert(this.node != null);", - " assert(this.node.props != null);", - " if (this.node.props.has_key(prop.to_index_key())) {", - " return;", - " }", - " this.node.props.set(prop.to_index_key(),prop);", - " }", - " ", - " ", - " // add a row???", - " this.load(this.file, this.node);", - " ", - " ", - " ", - " ", - " GLib.debug(\"trying to find new iter\");", - " ", - " ", - " ", - "}", - "" - ], "| void deleteSelected" : [ " () {", " ", @@ -1555,7 +1526,7 @@ "\tvar reading_header = true;", " ", "\twhile (child != null) {", - "\t\tGLib.debug(\"Got %s\", child.get_type().name());", + "\t\t//GLib.debug(\"Got %s\", child.get_type().name());", "\t ", "\t if (reading_header) {", "\t\t\t", @@ -1596,7 +1567,10 @@ "\tvar file = this.file;", "\tvar ar = file.getErrors();", "\tif (ar.size < 1) {", - "\t\tthis.removeErrors();", + "\t\tif (this.last_error_counter != file.error_counter) {", + "\t\t\tthis.removeErrors();", + "\t\t}", + "", "\t\tthis.last_error_counter = file.error_counter ;", "", "\t\treturn;", diff --git a/src/Builder4/WindowLeftProps.vala b/src/Builder4/WindowLeftProps.vala index 9966ec334..8cf971b43 100644 --- a/src/Builder4/WindowLeftProps.vala +++ b/src/Builder4/WindowLeftProps.vala @@ -90,7 +90,10 @@ public class Xcls_LeftProps : Object var file = this.file; var ar = file.getErrors(); if (ar.size < 1) { - this.removeErrors(); + if (this.last_error_counter != file.error_counter) { + this.removeErrors(); + } + this.last_error_counter = file.error_counter ; return; @@ -242,7 +245,7 @@ public class Xcls_LeftProps : Object var reading_header = true; while (child != null) { - GLib.debug("Got %s", child.get_type().name()); + //GLib.debug("Got %s", child.get_type().name()); if (reading_header) { @@ -276,39 +279,6 @@ public class Xcls_LeftProps : Object } //GLib.debug("Rturning null"); - } - public void a_addProp (JsRender.NodeProp prop) { - // info includes key, val, skel, etype.. - //console.dump(info); - //type = info.type.toLowerCase(); - //var data = this.toJS(); - - - if (prop.ptype == JsRender.NodePropType.LISTENER) { - if (this.node.listeners.has_key(prop.name)) { - return; - } - this.node.listeners.set(prop.name,prop); - } else { - assert(this.node != null); - assert(this.node.props != null); - if (this.node.props.has_key(prop.to_index_key())) { - return; - } - this.node.props.set(prop.to_index_key(),prop); - } - - - // add a row??? - this.load(this.file, this.node); - - - - - GLib.debug("trying to find new iter"); - - - } public void load (JsRender.JsRender file, JsRender.Node? node) { @@ -1857,11 +1827,11 @@ public class Xcls_LeftProps : Object } // should be columnlistview child = child.get_first_child(); - GLib.debug("header height=%d", h); + //GLib.debug("header height=%d", h); header_height = h; reading_header = false; - + continue; } if (child.get_type().name() != "GtkColumnViewRowWidget") { @@ -1875,6 +1845,13 @@ public class Xcls_LeftProps : Object line_no++; var hh = child.get_height(); + if (child.has_css_class("node-err") || + child.has_css_class("node-warn") || + child.has_css_class("node-depr")) { + hh += 10; + + } + //child.get_allocation(out alloc); //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height); //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y), diff --git a/src/Builder4/WindowLeftTree.bjs b/src/Builder4/WindowLeftTree.bjs index 27a5f8ed6..f2ea2be1c 100644 --- a/src/Builder4/WindowLeftTree.bjs +++ b/src/Builder4/WindowLeftTree.bjs @@ -3,7 +3,7 @@ "gen_extended" : false, "items" : [ { - "# Xcls_MainWindow main_window" : "null", + "# Xcls_MainWindow? main_window" : "null", "$ xns" : "Gtk", "@ bool before_node_change" : "()", "@ void changed" : "()", @@ -208,6 +208,8 @@ " \tGLib.warning(\"No node found at row %d\", row);", " \treturn;", "\t}", + "\t", + "\t", "\t_this.model.selectNode(node);", " ", " ", @@ -340,6 +342,36 @@ }, "xtype" : "EventControllerKey" }, + { + "$ xns" : "Gtk", + "id" : "keystate", + "int is_shift" : 0, + "listeners" : { + "key_pressed" : [ + "(keyval, keycode, state) => {", + "", + " \tif (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {", + " \t\tthis.is_shift = 1;", + "\t}", + "\treturn true;", + "}", + "" + ], + "key_released" : [ + "(keyval, keycode, state) => {", + "\tGLib.debug(\"key release %d, %d, %d\" , (int) keyval, (int) keycode, state);", + " \tif (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {", + " \t\tthis.is_shift = 0;", + "\t}", + "\t//GLib.debug(\"set state %d , shift = %d\", (int)this.el.get_current_event_state(), Gdk.ModifierType.SHIFT_MASK);", + "", + "", + " ", + "}" + ] + }, + "xtype" : "EventControllerKey" + }, { "$ xns" : "Gtk", "* ctor" : [ @@ -1265,36 +1297,6 @@ ], "string title" : "Add", "xtype" : "ColumnViewColumn" - }, - { - "$ xns" : "Gtk", - "id" : "keystate", - "int is_shift" : 0, - "listeners" : { - "key_pressed" : [ - "(keyval, keycode, state) => {", - "", - " \tif (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {", - " \t\tthis.is_shift = 1;", - "\t}", - "\treturn true;", - "}", - "" - ], - "key_released" : [ - "(keyval, keycode, state) => {", - "\tGLib.debug(\"key release %d, %d, %d\" , (int) keyval, (int) keycode, state);", - " \tif (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {", - " \t\tthis.is_shift = 0;", - "\t}", - "\t//GLib.debug(\"set state %d , shift = %d\", (int)this.el.get_current_event_state(), Gdk.ModifierType.SHIFT_MASK);", - "", - "", - " ", - "}" - ] - }, - "xtype" : "EventControllerKey" } ], "string name" : "left-tree-view", @@ -1335,7 +1337,7 @@ "\t\t\t\theader_height = h;", "\t\t\t\t", "\t\t\t\treading_header = false;", - "\t\t\t\t", + "\t\t\t\tcontinue;", "\t }", "\t\t line_no++;", "", @@ -1345,7 +1347,12 @@ "", "\t\t\tvar hh = child.get_height();", "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);", - "", + "\t\t\tif (child.has_css_class(\"node-err\") || ", + "\t\t\t\tchild.has_css_class(\"node-warn\") || ", + "\t\t\t\tchild.has_css_class(\"node-depr\")) {", + "\t\t\t\thh += 10;", + "\t\t\t", + "\t\t\t}\t", "\t\t if (y > curr_y && y <= header_height + hh + curr_y ) {", "\t\t\t return (Gtk.Widget)child;", "\t\t }", @@ -1394,7 +1401,7 @@ "\t\t\t ", "\t\t\t\t", "\t\t\t\treading_header = false;", - "\t\t\t\t ", + "\t\t\t\tcontinue;", "\t\t }", "\t\t ", "\t\t ", @@ -1486,10 +1493,11 @@ "\t\t\t\t}", "\t\t\t\t// should be columnlistview", "\t\t\t\tchild = child.get_first_child(); ", - "\t\t\t GLib.debug(\"header height=%d\", h);", + "\t\t\t //GLib.debug(\"header height=%d\", h);", "\t\t\t\theader_height = h;", "\t\t\t\t", "\t\t\t\treading_header = false;", + "\t\t\t\tcontinue;", "\t\t\t\t", "\t }", "\t ", @@ -1504,6 +1512,13 @@ "\t\t ", "\t\t line_no++;", "\t\t\tvar hh = child.get_height();", + "\t\t\t", + "\t\t\tif (child.has_css_class(\"node-err\") || ", + "\t\t\t\tchild.has_css_class(\"node-warn\") || ", + "\t\t\t\tchild.has_css_class(\"node-depr\")) {", + "\t\t\t\thh += 10;", + "\t\t\t", + "\t\t\t}", "\t\t\t//child.get_allocation(out alloc);", "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);", "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),", @@ -1682,7 +1697,7 @@ "\tvar reading_header = true;", " ", "\twhile (child != null) {", - "\t\tGLib.debug(\"Got %s\", child.get_type().name());", + "\t\t//GLib.debug(\"Got %s\", child.get_type().name());", "\t ", "\t if (reading_header) {", "\t\t\t", @@ -1722,8 +1737,11 @@ "() {", "\tvar file = this.getActiveFile();", "\tvar ar = file.getErrors();", - "\tif (ar.size < 1) {", - "\t\tthis.removeErrors();", + "\t\tif (ar.size < 1) {", + "\t\tif (this.last_error_counter != file.error_counter) {", + "\t\t\tthis.removeErrors();", + "\t\t}", + "\t", "\t\tthis.last_error_counter = file.error_counter ;", "", "\t\treturn;", diff --git a/src/Builder4/WindowLeftTree.vala b/src/Builder4/WindowLeftTree.vala index dfc25baa6..04c747e57 100644 --- a/src/Builder4/WindowLeftTree.vala +++ b/src/Builder4/WindowLeftTree.vala @@ -14,16 +14,16 @@ public class Xcls_WindowLeftTree : Object } public Xcls_viewwin viewwin; public Xcls_view view; + public Xcls_keystate keystate; public Xcls_drop drop; public Xcls_selmodel selmodel; public Xcls_model model; public Xcls_maincol maincol; - public Xcls_keystate keystate; public Xcls_LeftTreeMenu LeftTreeMenu; // my vars (def) public signal bool before_node_change (); - public Xcls_MainWindow main_window; + public Xcls_MainWindow? main_window; public int last_error_counter; public signal void changed (); public signal void node_selected (JsRender.Node? node); @@ -52,8 +52,11 @@ public class Xcls_WindowLeftTree : Object public void updateErrors () { var file = this.getActiveFile(); var ar = file.getErrors(); - if (ar.size < 1) { - this.removeErrors(); + if (ar.size < 1) { + if (this.last_error_counter != file.error_counter) { + this.removeErrors(); + } + this.last_error_counter = file.error_counter ; return; @@ -109,7 +112,7 @@ public class Xcls_WindowLeftTree : Object var reading_header = true; while (child != null) { - GLib.debug("Got %s", child.get_type().name()); + //GLib.debug("Got %s", child.get_type().name()); if (reading_header) { @@ -275,15 +278,15 @@ public class Xcls_WindowLeftTree : Object var child_5 = new Xcls_EventControllerKey9( _this ); child_5.ref(); this.el.add_controller( child_5.el ); + new Xcls_keystate( _this ); + this.el.add_controller( _this.keystate.el ); new Xcls_drop( _this ); this.el.add_controller( _this.drop.el ); new Xcls_maincol( _this ); this.el.append_column ( _this.maincol.el ); - var child_8 = new Xcls_ColumnViewColumn15( _this ); - child_8.ref(); - this.el.append_column ( child_8.el ); - new Xcls_keystate( _this ); - this.el.add_controller( _this.keystate.el ); + var child_9 = new Xcls_ColumnViewColumn16( _this ); + child_9.ref(); + this.el.append_column ( child_9.el ); // init method @@ -381,7 +384,7 @@ public class Xcls_WindowLeftTree : Object reading_header = false; - + continue; } @@ -469,10 +472,11 @@ public class Xcls_WindowLeftTree : Object } // should be columnlistview child = child.get_first_child(); - GLib.debug("header height=%d", h); + //GLib.debug("header height=%d", h); header_height = h; reading_header = false; + continue; } @@ -487,6 +491,13 @@ public class Xcls_WindowLeftTree : Object line_no++; var hh = child.get_height(); + + if (child.has_css_class("node-err") || + child.has_css_class("node-warn") || + child.has_css_class("node-depr")) { + hh += 10; + + } //child.get_allocation(out alloc); //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height); //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y), @@ -550,7 +561,7 @@ public class Xcls_WindowLeftTree : Object header_height = h; reading_header = false; - + continue; } line_no++; @@ -560,7 +571,12 @@ public class Xcls_WindowLeftTree : Object var hh = child.get_height(); //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height); - + if (child.has_css_class("node-err") || + child.has_css_class("node-warn") || + child.has_css_class("node-depr")) { + hh += 10; + + } if (y > curr_y && y <= header_height + hh + curr_y ) { return (Gtk.Widget)child; } @@ -703,6 +719,8 @@ public class Xcls_WindowLeftTree : Object GLib.warning("No node found at row %d", row); return; } + + _this.model.selectNode(node); @@ -856,6 +874,50 @@ public class Xcls_WindowLeftTree : Object // user defined functions } + public class Xcls_keystate : Object + { + public Gtk.EventControllerKey el; + private Xcls_WindowLeftTree _this; + + + // my vars (def) + public int is_shift; + + // ctor + public Xcls_keystate(Xcls_WindowLeftTree _owner ) + { + _this = _owner; + _this.keystate = this; + this.el = new Gtk.EventControllerKey(); + + // my vars (dec) + this.is_shift = 0; + + // set gobject values + + //listeners + this.el.key_released.connect( (keyval, keycode, state) => { + GLib.debug("key release %d, %d, %d" , (int) keyval, (int) keycode, state); + if (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) { + this.is_shift = 0; + } + //GLib.debug("set state %d , shift = %d", (int)this.el.get_current_event_state(), Gdk.ModifierType.SHIFT_MASK); + + + + }); + this.el.key_pressed.connect( (keyval, keycode, state) => { + + if (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) { + this.is_shift = 1; + } + return true; + }); + } + + // user defined functions + } + public class Xcls_drop : Object { public Gtk.DropTarget el; @@ -1654,7 +1716,7 @@ public class Xcls_WindowLeftTree : Object { _this = _owner; _this.maincol = this; - var child_1 = new Xcls_SignalListItemFactory14( _this ); + var child_1 = new Xcls_SignalListItemFactory15( _this ); child_1.ref(); this.el = new Gtk.ColumnViewColumn( "Property", child_1.el ); @@ -1668,7 +1730,7 @@ public class Xcls_WindowLeftTree : Object // user defined functions } - public class Xcls_SignalListItemFactory14 : Object + public class Xcls_SignalListItemFactory15 : Object { public Gtk.SignalListItemFactory el; private Xcls_WindowLeftTree _this; @@ -1677,7 +1739,7 @@ public class Xcls_WindowLeftTree : Object // my vars (def) // ctor - public Xcls_SignalListItemFactory14(Xcls_WindowLeftTree _owner ) + public Xcls_SignalListItemFactory15(Xcls_WindowLeftTree _owner ) { _this = _owner; this.el = new Gtk.SignalListItemFactory(); @@ -1778,7 +1840,7 @@ public class Xcls_WindowLeftTree : Object } - public class Xcls_ColumnViewColumn15 : Object + public class Xcls_ColumnViewColumn16 : Object { public Gtk.ColumnViewColumn el; private Xcls_WindowLeftTree _this; @@ -1787,10 +1849,10 @@ public class Xcls_WindowLeftTree : Object // my vars (def) // ctor - public Xcls_ColumnViewColumn15(Xcls_WindowLeftTree _owner ) + public Xcls_ColumnViewColumn16(Xcls_WindowLeftTree _owner ) { _this = _owner; - var child_1 = new Xcls_SignalListItemFactory16( _this ); + var child_1 = new Xcls_SignalListItemFactory17( _this ); child_1.ref(); this.el = new Gtk.ColumnViewColumn( "Add", child_1.el ); @@ -1802,7 +1864,7 @@ public class Xcls_WindowLeftTree : Object // user defined functions } - public class Xcls_SignalListItemFactory16 : Object + public class Xcls_SignalListItemFactory17 : Object { public Gtk.SignalListItemFactory el; private Xcls_WindowLeftTree _this; @@ -1811,7 +1873,7 @@ public class Xcls_WindowLeftTree : Object // my vars (def) // ctor - public Xcls_SignalListItemFactory16(Xcls_WindowLeftTree _owner ) + public Xcls_SignalListItemFactory17(Xcls_WindowLeftTree _owner ) { _this = _owner; this.el = new Gtk.SignalListItemFactory(); @@ -1855,50 +1917,6 @@ public class Xcls_WindowLeftTree : Object } - public class Xcls_keystate : Object - { - public Gtk.EventControllerKey el; - private Xcls_WindowLeftTree _this; - - - // my vars (def) - public int is_shift; - - // ctor - public Xcls_keystate(Xcls_WindowLeftTree _owner ) - { - _this = _owner; - _this.keystate = this; - this.el = new Gtk.EventControllerKey(); - - // my vars (dec) - this.is_shift = 0; - - // set gobject values - - //listeners - this.el.key_released.connect( (keyval, keycode, state) => { - GLib.debug("key release %d, %d, %d" , (int) keyval, (int) keycode, state); - if (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) { - this.is_shift = 0; - } - //GLib.debug("set state %d , shift = %d", (int)this.el.get_current_event_state(), Gdk.ModifierType.SHIFT_MASK); - - - - }); - this.el.key_pressed.connect( (keyval, keycode, state) => { - - if (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) { - this.is_shift = 1; - } - return true; - }); - } - - // user defined functions - } - public class Xcls_LeftTreeMenu : Object {