1 static DialogFiles _DialogFiles;
3 public class DialogFiles : Object
6 private DialogFiles _this;
8 public static DialogFiles singleton()
10 if (_DialogFiles == null) {
11 _DialogFiles= new DialogFiles();
15 public Xcls_mainpane mainpane;
16 public Xcls_projectscroll projectscroll;
17 public Xcls_project_list project_list;
18 public Xcls_projectselection projectselection;
19 public Xcls_projectsort projectsort;
20 public Xcls_projectmodel projectmodel;
21 public Xcls_filepane filepane;
22 public Xcls_searchbox searchbox;
23 public Xcls_iconscroll iconscroll;
24 public Xcls_gridview gridview;
25 public Xcls_iconsel iconsel;
26 public Xcls_gridsort gridsort;
27 public Xcls_gridmodel gridmodel;
28 public Xcls_iconsearch iconsearch;
29 public Xcls_treescroll treescroll;
30 public Xcls_treeview treeview;
31 public Xcls_treeselmodel treeselmodel;
32 public Xcls_treelistsort treelistsort;
33 public Xcls_treelistmodel treelistmodel;
34 public Xcls_treemodel treemodel;
35 public Xcls_treefilter treefilter;
36 public Xcls_name name;
37 public Xcls_btn_newproj btn_newproj;
38 public Xcls_btn_projprop btn_projprop;
39 public Xcls_btn_delproj btn_delproj;
40 public Xcls_btn_addfile btn_addfile;
41 public Xcls_btn_delfile btn_delfile;
44 public Xcls_MainWindow win;
45 public string lastfilter;
46 public bool in_onprojectselected;
47 public bool is_loading;
48 public bool new_window;
49 public Project.Project selectedProject;
50 public Gdk.Pixbuf missing_thumb_pixbuf;
51 public Gee.HashMap<string,Gdk.Pixbuf> image_cache;
57 this.el = new Gtk.Window();
60 this.in_onprojectselected = false;
61 this.is_loading = false;
62 this.new_window = false;
65 this.el.title = "Select Project / File";
66 this.el.name = "DialogFiles";
67 this.el.default_height = 550;
68 this.el.default_width = 1000;
70 var child_1 = new Xcls_Box1( _this );
71 this.el.child = child_1.el;
72 var child_2 = new Xcls_HeaderBar43( _this );
73 this.el.titlebar = child_2.el;
78 var ev = new Gtk.EventControllerKey();
79 ev.propagation_phase = Gtk.PropagationPhase.CAPTURE;
85 ev.key_released.connect( (keyval, keycode, state) => {
87 // GLib.debug("key pressed %d", (int)keycode);
91 if (BuilderApplication.windows.size < 2 &&
92 _this.win.windowstate.file == null
94 BuilderApplication.singleton(null).quit();
100 if (_this.win.windowstate.file == null) {
101 BuilderApplication.removeWindow(_this.win);
107 ev.ref(); //?? needed?
108 ((Gtk.Widget)this.el).add_controller(ev);
112 // user defined functions
113 public void onProjectSelected (Project.Project? project)
115 if (this.in_onprojectselected) {
118 this.selectedProject = project;
120 if (project == null) {
121 GLib.debug("Hide project files");
122 _this.mainpane.el.set_end_child(null);
123 _this.filepane.el.hide();
128 GLib.debug("Show project files");
129 _this.mainpane.el.set_end_child(_this.filepane.el);
131 _this.filepane.el.show();
132 this.in_onprojectselected = true;
139 _this.searchbox.el.text = "";
140 _this.gridview.el.set_model(new Gtk.SingleSelection(null));
141 _this.selectedProject.loadFilesIntoStore(_this.gridmodel.el);
142 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
144 _this.gridview.el.set_model(_this.iconsel.el);
147 GLib.Timeout.add(500, () => {
148 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
149 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
151 _this.searchbox.el.grab_focus();
154 _this.treeview.el.set_model(new Gtk.SingleSelection(null));
156 this.selectedProject.loadDirsIntoStore(_this.treemodel.el);
158 _this.treeview.el.set_model(_this.treeselmodel.el);
160 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
161 this.treescroll.el.vadjustment.value = 0;
162 this.in_onprojectselected = false;
164 public void selectProject (Project.Project? project) {
168 var sm = this.projectselection.el;
169 if (project == null) {
170 sm.selected = Gtk.INVALID_LIST_POSITION;
171 this.onProjectSelected(null);
176 for (var i =0; i < sm.n_items; i++) {
177 var p = (Project.Project) sm.get_item(i);
178 if (p.path == project.path) {
179 GLib.debug("Select Project %s => %d", project.name, i);
186 public void show (Project.Project? project, bool new_window) {
188 this.new_window = new_window;
190 this.projectscroll.el.vadjustment.value = 0; // scroll to top?
193 //var win = this.win.el;
194 //var w = win.get_width();
195 //var h = win.get_height();
200 this.selectProject(project);
201 this.onProjectSelected(project); //?? twice?
203 GLib.Timeout.add(500, () => {
204 if (project == null) {
205 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
206 this.onProjectSelected(null);
209 this.el.set_size_request( 800 , 750); // ?? based on default
214 public void load () {
218 _this.is_loading = true;
221 Project.Project.loadAll();
222 _this.project_list.el.set_model(new Gtk.SingleSelection(null));
223 Project.Project.loadIntoStore(this.projectmodel.el);
225 _this.project_list.el.set_model(_this.projectselection.el);
227 _this.is_loading = false;
229 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
230 _this.btn_delfile.el.hide();
234 public class Xcls_Box1 : Object
237 private DialogFiles _this;
244 public Xcls_Box1(DialogFiles _owner )
247 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
252 // set gobject values
253 this.el.homogeneous = false;
254 this.el.margin_end = 10;
255 this.el.margin_start = 10;
256 this.el.margin_bottom = 10;
257 this.el.margin_top = 10;
258 var child_1 = new Xcls_Box2( _this );
260 this.el.append( child_1.el );
261 new Xcls_mainpane( _this );
262 this.el.append( _this.mainpane.el );
265 // user defined functions
267 public class Xcls_Box2 : Object
270 private DialogFiles _this;
276 public Xcls_Box2(DialogFiles _owner )
279 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
283 // set gobject values
284 this.el.hexpand = true;
287 // user defined functions
290 public class Xcls_mainpane : Object
293 private DialogFiles _this;
297 public bool homogeneous;
301 public Xcls_mainpane(DialogFiles _owner )
304 _this.mainpane = this;
305 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
308 this.homogeneous = false;
311 // set gobject values
312 this.el.hexpand = true;
313 this.el.vexpand = true;
314 this.el.position = 200;
315 new Xcls_projectscroll( _this );
316 this.el.start_child = _this.projectscroll.el;
317 new Xcls_filepane( _this );
318 this.el.end_child = _this.filepane.el;
319 var child_3 = new Xcls_EventControllerKey411( _this );
321 this.el.add_controller( child_3.el );
324 // user defined functions
326 public class Xcls_projectscroll : Object
328 public Gtk.ScrolledWindow el;
329 private DialogFiles _this;
336 public Xcls_projectscroll(DialogFiles _owner )
339 _this.projectscroll = this;
340 this.el = new Gtk.ScrolledWindow();
345 // set gobject values
346 this.el.width_request = 150;
347 this.el.has_frame = true;
348 this.el.hexpand = true;
349 this.el.vexpand = true;
350 new Xcls_project_list( _this );
351 this.el.child = _this.project_list.el;
355 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
358 // user defined functions
360 public class Xcls_project_list : Object
362 public Gtk.ColumnView el;
363 private DialogFiles _this;
367 public Gtk.CssProvider css;
370 public Xcls_project_list(DialogFiles _owner )
373 _this.project_list = this;
374 new Xcls_projectselection( _this );
375 this.el = new Gtk.ColumnView( _this.projectselection.el );
379 // set gobject values
380 this.el.name = "project-list";
381 var child_2 = new Xcls_ColumnViewColumn11( _this );
383 this.el.append_column ( child_2.el );
386 // user defined functions
388 public class Xcls_projectselection : Object
390 public Gtk.SingleSelection el;
391 private DialogFiles _this;
397 public Xcls_projectselection(DialogFiles _owner )
400 _this.projectselection = this;
401 new Xcls_projectsort( _this );
402 this.el = new Gtk.SingleSelection( _this.projectsort.el );
406 // set gobject values
407 this.el.can_unselect = true;
410 this.el.notify["selected"].connect( (position, n_items) => {
412 if (_this.is_loading) {
416 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
417 _this.btn_delproj.el.hide();
418 _this.btn_projprop.el.hide();
419 _this.btn_addfile.el.hide();
420 //_this.btn_delfile.el.hide();
423 _this.btn_delproj.el.show();
424 _this.btn_projprop.el.show();
425 _this.btn_addfile.el.show();
426 //_this.btn_delfile.el.show(); // ??
433 if (_this.is_loading) {
437 Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
438 (Project.Project) _this.projectsort.el.get_item(this.el.selected);
440 GLib.debug("selection changed to %s", project == null ? "none" : project.name);
442 _this.onProjectSelected(project);
446 // user defined functions
448 public class Xcls_projectsort : Object
450 public Gtk.SortListModel el;
451 private DialogFiles _this;
457 public Xcls_projectsort(DialogFiles _owner )
460 _this.projectsort = this;
461 new Xcls_projectmodel( _this );
462 var child_2 = new Xcls_StringSorter9( _this );
464 this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
468 // set gobject values
469 this.el.incremental = true;
472 // user defined functions
474 public class Xcls_projectmodel : Object
476 public GLib.ListStore el;
477 private DialogFiles _this;
483 public Xcls_projectmodel(DialogFiles _owner )
486 _this.projectmodel = this;
487 this.el = new GLib.ListStore( typeof(Project.Project) );
491 // set gobject values
494 // user defined functions
495 public void remove (Project.Project p) {
497 for (var i =0;i < this.el.n_items; i++ ) {
498 var pr = (Project.Project) this.el.get_item(i);
499 if (p.path == pr.path) {
509 public class Xcls_StringSorter9 : Object
511 public Gtk.StringSorter el;
512 private DialogFiles _this;
518 public Xcls_StringSorter9(DialogFiles _owner )
521 var child_1 = new Xcls_PropertyExpression10( _this );
523 this.el = new Gtk.StringSorter( child_1.el );
527 // set gobject values
530 // user defined functions
532 public class Xcls_PropertyExpression10 : Object
534 public Gtk.PropertyExpression el;
535 private DialogFiles _this;
541 public Xcls_PropertyExpression10(DialogFiles _owner )
544 this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
548 // set gobject values
551 // user defined functions
557 public class Xcls_ColumnViewColumn11 : Object
559 public Gtk.ColumnViewColumn el;
560 private DialogFiles _this;
566 public Xcls_ColumnViewColumn11(DialogFiles _owner )
569 var child_1 = new Xcls_SignalListItemFactory12( _this );
571 this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
575 // set gobject values
576 this.el.expand = true;
579 // user defined functions
581 public class Xcls_SignalListItemFactory12 : Object
583 public Gtk.SignalListItemFactory el;
584 private DialogFiles _this;
590 public Xcls_SignalListItemFactory12(DialogFiles _owner )
593 this.el = new Gtk.SignalListItemFactory();
597 // set gobject values
600 this.el.setup.connect( (item) => {
601 //var j = (JsRender.JsRender) item;
602 var gi = (Gtk.ListItem)item;
604 var lbl = new Gtk.Label("");
605 lbl.halign = Gtk.Align.START;
611 this.el.bind.connect( (listitem) => {
613 var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
615 var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
617 item.bind_property("name",
619 GLib.BindingFlags.SYNC_CREATE);
625 // user defined functions
631 public class Xcls_filepane : Object
634 private DialogFiles _this;
640 public Xcls_filepane(DialogFiles _owner )
643 _this.filepane = this;
644 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
648 // set gobject values
649 this.el.position = 200;
650 this.el.visible = false;
651 var child_1 = new Xcls_Box14( _this );
652 this.el.end_child = child_1.el;
653 new Xcls_treescroll( _this );
654 this.el.start_child = _this.treescroll.el;
657 // user defined functions
659 public class Xcls_Box14 : Object
662 private DialogFiles _this;
668 public Xcls_Box14(DialogFiles _owner )
671 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
675 // set gobject values
676 this.el.hexpand = true;
677 this.el.vexpand = true;
678 var child_1 = new Xcls_Box15( _this );
680 this.el.append( child_1.el );
681 new Xcls_iconscroll( _this );
682 this.el.append( _this.iconscroll.el );
685 // user defined functions
687 public class Xcls_Box15 : Object
690 private DialogFiles _this;
696 public Xcls_Box15(DialogFiles _owner )
699 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
703 // set gobject values
704 this.el.hexpand = true;
705 new Xcls_searchbox( _this );
706 this.el.append( _this.searchbox.el );
709 // user defined functions
711 public class Xcls_searchbox : Object
713 public Gtk.SearchEntry el;
714 private DialogFiles _this;
718 public Gtk.CssProvider css;
721 public Xcls_searchbox(DialogFiles _owner )
724 _this.searchbox = this;
725 this.el = new Gtk.SearchEntry();
729 // set gobject values
730 this.el.name = "popover-files-iconsearch";
731 this.el.hexpand = true;
732 this.el.placeholder_text = "type to filter results";
733 this.el.search_delay = 1000;
738 this.css = new Gtk.CssProvider();
740 this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
742 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
748 this.el.search_changed.connect( ( ) => {
750 _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
751 _this.iconsearch.el.set_search(this.el.text);
755 // user defined functions
759 public class Xcls_iconscroll : Object
761 public Gtk.ScrolledWindow el;
762 private DialogFiles _this;
768 public Xcls_iconscroll(DialogFiles _owner )
771 _this.iconscroll = this;
772 this.el = new Gtk.ScrolledWindow();
776 // set gobject values
777 this.el.has_frame = true;
778 this.el.hexpand = true;
779 this.el.vexpand = true;
780 new Xcls_gridview( _this );
781 this.el.child = _this.gridview.el;
785 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
788 // user defined functions
790 public class Xcls_gridview : Object
792 public Gtk.GridView el;
793 private DialogFiles _this;
799 public Xcls_gridview(DialogFiles _owner )
802 _this.gridview = this;
803 new Xcls_iconsel( _this );
804 var child_2 = new Xcls_SignalListItemFactory28( _this );
806 this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
810 // set gobject values
811 var child_3 = new Xcls_GestureClick19( _this );
813 this.el.add_controller( child_3.el );
816 // user defined functions
818 public class Xcls_GestureClick19 : Object
820 public Gtk.GestureClick el;
821 private DialogFiles _this;
827 public Xcls_GestureClick19(DialogFiles _owner )
830 this.el = new Gtk.GestureClick();
834 // set gobject values
837 this.el.pressed.connect( (n_press, x, y) => {
839 GLib.debug("double cliced");
843 var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
845 GLib.debug("Click %s", f.name);
846 if (f.xtype == "Dir") {
851 _this.win.windowstate.fileViewOpen(f, _this.new_window);
860 // user defined functions
863 public class Xcls_iconsel : Object
865 public Gtk.SingleSelection el;
866 private DialogFiles _this;
872 public Xcls_iconsel(DialogFiles _owner )
875 _this.iconsel = this;
876 var child_1 = new Xcls_FilterListModel21( _this );
878 this.el = new Gtk.SingleSelection( child_1.el );
882 // set gobject values
883 this.el.can_unselect = true;
886 this.el.notify["selected"].connect( () => {
887 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
888 if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
889 _this.btn_delfile.el.hide();
894 _this.btn_delfile.el.show();
895 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
901 // user defined functions
902 public JsRender.JsRender? selectedFile () {
904 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
907 return (JsRender.JsRender)this.el.get_item(this.el.selected);
912 public class Xcls_FilterListModel21 : Object
914 public Gtk.FilterListModel el;
915 private DialogFiles _this;
921 public Xcls_FilterListModel21(DialogFiles _owner )
924 new Xcls_gridsort( _this );
925 new Xcls_iconsearch( _this );
926 this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
930 // set gobject values
933 // user defined functions
935 public class Xcls_gridsort : Object
937 public Gtk.SortListModel el;
938 private DialogFiles _this;
944 public Xcls_gridsort(DialogFiles _owner )
947 _this.gridsort = this;
948 new Xcls_gridmodel( _this );
949 var child_2 = new Xcls_StringSorter24( _this );
951 this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
955 // set gobject values
958 // user defined functions
960 public class Xcls_gridmodel : Object
962 public GLib.ListStore el;
963 private DialogFiles _this;
969 public Xcls_gridmodel(DialogFiles _owner )
972 _this.gridmodel = this;
973 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
977 // set gobject values
980 // user defined functions
981 public void remove (JsRender.JsRender p) {
983 for (var i =0;i < this.el.n_items; i++ ) {
984 var pr = (JsRender.JsRender) this.el.get_item(i);
985 if (p.path == pr.path) {
994 public class Xcls_StringSorter24 : Object
996 public Gtk.StringSorter el;
997 private DialogFiles _this;
1003 public Xcls_StringSorter24(DialogFiles _owner )
1006 var child_1 = new Xcls_PropertyExpression25( _this );
1008 this.el = new Gtk.StringSorter( child_1.el );
1012 // set gobject values
1013 this.el.ignore_case = true;
1016 // user defined functions
1018 public class Xcls_PropertyExpression25 : Object
1020 public Gtk.PropertyExpression el;
1021 private DialogFiles _this;
1027 public Xcls_PropertyExpression25(DialogFiles _owner )
1030 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1034 // set gobject values
1037 // user defined functions
1042 public class Xcls_iconsearch : Object
1044 public Gtk.StringFilter el;
1045 private DialogFiles _this;
1051 public Xcls_iconsearch(DialogFiles _owner )
1054 _this.iconsearch = this;
1055 var child_1 = new Xcls_PropertyExpression27( _this );
1057 this.el = new Gtk.StringFilter( child_1.el );
1061 // set gobject values
1062 this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
1063 this.el.ignore_case = true;
1066 // user defined functions
1068 public class Xcls_PropertyExpression27 : Object
1070 public Gtk.PropertyExpression el;
1071 private DialogFiles _this;
1077 public Xcls_PropertyExpression27(DialogFiles _owner )
1080 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1084 // set gobject values
1087 // user defined functions
1093 public class Xcls_SignalListItemFactory28 : Object
1095 public Gtk.SignalListItemFactory el;
1096 private DialogFiles _this;
1102 public Xcls_SignalListItemFactory28(DialogFiles _owner )
1105 this.el = new Gtk.SignalListItemFactory();
1109 // set gobject values
1112 this.el.setup.connect( (item) => {
1113 //var j = (JsRender.JsRender) item;
1114 var gi = (Gtk.ListItem)item;
1115 var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
1116 var i = new Gtk.Image();
1118 var t = new Gtk.Label("");
1123 b.has_tooltip = true;
1124 b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
1125 var j = (JsRender.JsRender) gi.get_item();
1127 var ti = new Gtk.Image.from_file ( j.getIconFileName());
1128 ti.pixel_size = 368;
1129 tooltip.set_custom( ti );
1135 this.el.bind.connect( (listitem) => {
1137 var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
1139 var img = (Gtk.Image) box.get_first_child();
1140 var lbl = (Gtk.Label)img.get_next_sibling();
1142 var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
1143 //GLib.debug("set label name to %s", item.name);
1145 var ns = item.name.split(".");
1146 if (ns.length < 2) {
1147 lbl.label = item.name;
1150 item.name.substring(0, item.name.length - ns[ns.length-1].length)
1151 + "\n"+ ns[ns.length-1];
1155 item.bind_property("name",
1157 GLib.BindingFlags.SYNC_CREATE);
1160 img.set_from_file(item.getIconFileName());
1166 // user defined functions
1172 public class Xcls_treescroll : Object
1174 public Gtk.ScrolledWindow el;
1175 private DialogFiles _this;
1181 public Xcls_treescroll(DialogFiles _owner )
1184 _this.treescroll = this;
1185 this.el = new Gtk.ScrolledWindow();
1189 // set gobject values
1190 this.el.width_request = 200;
1191 this.el.has_frame = true;
1192 this.el.hexpand = true;
1193 this.el.vexpand = true;
1194 this.el.visible = true;
1195 new Xcls_treeview( _this );
1196 this.el.child = _this.treeview.el;
1200 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1203 // user defined functions
1205 public class Xcls_treeview : Object
1207 public Gtk.ColumnView el;
1208 private DialogFiles _this;
1212 public Gtk.CssProvider css;
1215 public Xcls_treeview(DialogFiles _owner )
1218 _this.treeview = this;
1219 new Xcls_treeselmodel( _this );
1220 this.el = new Gtk.ColumnView( _this.treeselmodel.el );
1224 // set gobject values
1225 this.el.name = "file-list";
1226 var child_2 = new Xcls_GestureClick31( _this );
1228 this.el.add_controller( child_2.el );
1229 new Xcls_name( _this );
1230 this.el.append_column ( _this.name.el );
1236 this.css = new Gtk.CssProvider();
1238 this.css.load_from_string("
1239 #file-list { font-size: 12px;}
1241 -gtk-icon-size : 2px;
1243 #file-list indent:nth-last-child(2) {
1248 Gtk.StyleContext.add_provider_for_display(
1249 this.el.get_display(),
1251 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1257 // user defined functions
1259 public class Xcls_GestureClick31 : Object
1261 public Gtk.GestureClick el;
1262 private DialogFiles _this;
1268 public Xcls_GestureClick31(DialogFiles _owner )
1271 this.el = new Gtk.GestureClick();
1275 // set gobject values
1278 this.el.pressed.connect( (n_press, x, y) => {
1280 GLib.debug("double cliced");
1284 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1285 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1286 var f = (JsRender.JsRender) tr.item;
1287 GLib.debug("Click %s", f.name);
1288 if (f.xtype == "Dir") {
1293 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1302 // user defined functions
1305 public class Xcls_treeselmodel : Object
1307 public Gtk.SingleSelection el;
1308 private DialogFiles _this;
1314 public Xcls_treeselmodel(DialogFiles _owner )
1317 _this.treeselmodel = this;
1318 var child_1 = new Xcls_FilterListModel33( _this );
1320 this.el = new Gtk.SingleSelection( child_1.el );
1324 // set gobject values
1325 this.el.can_unselect = true;
1328 this.el.notify["selected"].connect( () => {
1329 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1330 if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
1331 _this.btn_delfile.el.hide();
1336 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1337 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1338 var f = (JsRender.JsRender) tr.item;
1339 if (f.xtype == "Dir") {
1340 _this.btn_delfile.el.hide();
1342 _this.btn_delfile.el.show();
1345 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
1351 // user defined functions
1352 public JsRender.JsRender? selectedFile () {
1354 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1357 var tr = (Gtk.TreeListRow) this.el.selected_item;
1359 return (JsRender.JsRender) tr.item;
1362 public class Xcls_FilterListModel33 : Object
1364 public Gtk.FilterListModel el;
1365 private DialogFiles _this;
1371 public Xcls_FilterListModel33(DialogFiles _owner )
1374 new Xcls_treelistsort( _this );
1375 new Xcls_treefilter( _this );
1376 this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
1380 // set gobject values
1383 // user defined functions
1385 public class Xcls_treelistsort : Object
1387 public Gtk.SortListModel el;
1388 private DialogFiles _this;
1394 public Xcls_treelistsort(DialogFiles _owner )
1397 _this.treelistsort = this;
1398 new Xcls_treelistmodel( _this );
1399 var child_2 = new Xcls_TreeListRowSorter37( _this );
1401 this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
1405 // set gobject values
1406 this.el.incremental = true;
1409 // user defined functions
1411 public class Xcls_treelistmodel : Object
1413 public Gtk.TreeListModel el;
1414 private DialogFiles _this;
1420 public Xcls_treelistmodel(DialogFiles _owner )
1423 _this.treelistmodel = this;
1424 new Xcls_treemodel( _this );
1425 this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
1426 //GLib.debug("liststore got %s", item.get_type().name());
1427 return ((JsRender.JsRender)item).childfiles;
1432 // set gobject values
1435 // user defined functions
1437 public class Xcls_treemodel : Object
1439 public GLib.ListStore el;
1440 private DialogFiles _this;
1446 public Xcls_treemodel(DialogFiles _owner )
1449 _this.treemodel = this;
1450 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
1454 // set gobject values
1457 // user defined functions
1461 public class Xcls_TreeListRowSorter37 : Object
1463 public Gtk.TreeListRowSorter el;
1464 private DialogFiles _this;
1470 public Xcls_TreeListRowSorter37(DialogFiles _owner )
1473 var child_1 = new Xcls_StringSorter38( _this );
1475 this.el = new Gtk.TreeListRowSorter( child_1.el );
1479 // set gobject values
1482 // user defined functions
1484 public class Xcls_StringSorter38 : Object
1486 public Gtk.StringSorter el;
1487 private DialogFiles _this;
1493 public Xcls_StringSorter38(DialogFiles _owner )
1496 var child_1 = new Xcls_PropertyExpression39( _this );
1498 this.el = new Gtk.StringSorter( child_1.el );
1502 // set gobject values
1503 this.el.ignore_case = true;
1506 // user defined functions
1508 public class Xcls_PropertyExpression39 : Object
1510 public Gtk.PropertyExpression el;
1511 private DialogFiles _this;
1517 public Xcls_PropertyExpression39(DialogFiles _owner )
1520 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
1524 // set gobject values
1527 // user defined functions
1533 public class Xcls_treefilter : Object
1535 public Gtk.CustomFilter el;
1536 private DialogFiles _this;
1542 public Xcls_treefilter(DialogFiles _owner )
1545 _this.treefilter = this;
1546 this.el = new Gtk.CustomFilter( (item) => {
1547 var tr = ((Gtk.TreeListRow)item).get_item();
1548 //GLib.debug("filter %s", tr.get_type().name());
1549 var j = (JsRender.JsRender) tr;
1550 if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
1553 var str = _this.searchbox.el.text.down();
1554 if (j.xtype == "Dir") {
1557 for (var i =0 ; i < j.childfiles.n_items; i++) {
1558 var f = (JsRender.JsRender) j.childfiles.get_item(i);
1559 if (f.xtype != "PlainFile") {
1562 if (f.content_type.contains("image")) {
1565 if (str.length < 1) {
1568 if (f.name.down().contains(str)) {
1576 if (j.xtype != "PlainFile") {
1579 if (j.content_type.contains("image")) {
1583 if (str.length < 1) { // no search.
1586 if (j.name.down().contains(str)) {
1595 // set gobject values
1598 // user defined functions
1603 public class Xcls_name : Object
1605 public Gtk.ColumnViewColumn el;
1606 private DialogFiles _this;
1612 public Xcls_name(DialogFiles _owner )
1616 var child_1 = new Xcls_SignalListItemFactory42( _this );
1618 this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
1622 // set gobject values
1623 this.el.id = "name";
1624 this.el.expand = true;
1625 this.el.resizable = true;
1630 // this.el.set_sorter( new Gtk.StringSorter(
1631 // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
1637 // user defined functions
1639 public class Xcls_SignalListItemFactory42 : Object
1641 public Gtk.SignalListItemFactory el;
1642 private DialogFiles _this;
1648 public Xcls_SignalListItemFactory42(DialogFiles _owner )
1651 this.el = new Gtk.SignalListItemFactory();
1655 // set gobject values
1658 this.el.setup.connect( (listitem) => {
1660 var expand = new Gtk.TreeExpander();
1662 expand.set_indent_for_depth(true);
1663 expand.set_indent_for_icon(true);
1664 var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
1665 var icon = new Gtk.Image();
1666 icon.margin_end = 4;
1667 var lbl = new Gtk.Label("");
1668 lbl.use_markup = true;
1671 lbl.justify = Gtk.Justification.LEFT;
1676 expand.set_child(hbox);
1677 ((Gtk.ListItem)listitem).set_child(expand);
1678 ((Gtk.ListItem)listitem).activatable = false;
1680 this.el.bind.connect( (listitem) => {
1682 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
1686 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1687 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1689 var hbox = (Gtk.Box) expand.child;
1692 var img = (Gtk.Image) hbox.get_first_child();
1693 var lbl = (Gtk.Label) img.get_next_sibling();
1697 if (lbl.label != "") { // do not update
1700 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
1701 //GLib.debug("LR = %s", lr.get_type().name());
1704 var jr =(JsRender.JsRender) lr.get_item();
1705 //GLib.debug("JR = %s", jr.get_type().name());
1708 GLib.debug("Problem getting item");
1712 jr.bind_property("icon",
1714 GLib.BindingFlags.SYNC_CREATE);
1716 //GLib.debug("change %s to %s", lbl.label, np.name);
1717 lbl.label = jr.name; // for dir's we could hsow the sub path..
1718 lbl.tooltip_markup = jr.path;
1720 expand.set_hide_expander( jr.xtype != "Dir" );
1721 expand.set_list_row(lr);
1728 // user defined functions
1735 public class Xcls_EventControllerKey411 : Object
1737 public Gtk.EventControllerKey el;
1738 private DialogFiles _this;
1744 public Xcls_EventControllerKey411(DialogFiles _owner )
1747 this.el = new Gtk.EventControllerKey();
1751 // set gobject values
1754 this.el.key_pressed.connect( (keyval, keycode, state) => {
1756 if (keycode != Gdk.Key.Escape) {
1759 if (BuilderApplication.windows.size < 2 &&
1760 _this.win.windowstate.file == null
1762 BuilderApplication.singleton(null).quit();
1768 if (_this.win.windowstate.file == null) {
1769 BuilderApplication.removeWindow(_this.win);
1777 // user defined functions
1782 public class Xcls_HeaderBar43 : Object
1784 public Gtk.HeaderBar el;
1785 private DialogFiles _this;
1791 public Xcls_HeaderBar43(DialogFiles _owner )
1794 this.el = new Gtk.HeaderBar();
1798 // set gobject values
1799 this.el.show_title_buttons = false;
1800 var child_1 = new Xcls_Button44( _this );
1802 this.el.pack_end ( child_1.el );
1803 new Xcls_btn_newproj( _this );
1804 this.el.pack_start ( _this.btn_newproj.el );
1805 new Xcls_btn_projprop( _this );
1806 this.el.pack_start ( _this.btn_projprop.el );
1807 new Xcls_btn_delproj( _this );
1808 this.el.pack_start ( _this.btn_delproj.el );
1809 new Xcls_btn_addfile( _this );
1810 this.el.pack_start ( _this.btn_addfile.el );
1811 new Xcls_btn_delfile( _this );
1812 this.el.pack_start ( _this.btn_delfile.el );
1815 // user defined functions
1817 public class Xcls_Button44 : Object
1819 public Gtk.Button el;
1820 private DialogFiles _this;
1826 public Xcls_Button44(DialogFiles _owner )
1829 this.el = new Gtk.Button();
1833 // set gobject values
1834 this.el.label = "Close / Cancel";
1837 this.el.clicked.connect( ( ) => {
1838 if (BuilderApplication.windows.size < 2 &&
1839 _this.win.windowstate.file == null
1841 BuilderApplication.singleton(null).quit();
1847 if (_this.win.windowstate.file == null) {
1848 BuilderApplication.removeWindow(_this.win);
1857 // user defined functions
1860 public class Xcls_btn_newproj : Object
1862 public Gtk.Button el;
1863 private DialogFiles _this;
1869 public Xcls_btn_newproj(DialogFiles _owner )
1872 _this.btn_newproj = this;
1873 this.el = new Gtk.Button();
1877 // set gobject values
1878 var child_1 = new Xcls_Box46( _this );
1879 this.el.child = child_1.el;
1882 this.el.clicked.connect( ( ) => {
1884 // create a new file in project..
1885 //Xcls_DialogNewComponent.singleton().show(
1886 var pe = EditProject.singleton();
1887 pe.windowstate = _this.win.windowstate;
1889 pe.el.application = _this.win.el.application;
1890 pe.el.set_transient_for( _this.el );
1892 var cb = new Project.Callback();
1893 cb.call.connect((pr) => {
1894 _this.show( pr , _this.new_window);
1903 // user defined functions
1904 public void onCreated () {
1905 var pe = EditProject.singleton();
1907 _this.show( pe.result , _this.new_window);
1910 public class Xcls_Box46 : Object
1913 private DialogFiles _this;
1919 public Xcls_Box46(DialogFiles _owner )
1922 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1926 // set gobject values
1927 var child_1 = new Xcls_Image47( _this );
1929 this.el.append( child_1.el );
1930 var child_2 = new Xcls_Label48( _this );
1932 this.el.append( child_2.el );
1935 // user defined functions
1937 public class Xcls_Image47 : Object
1939 public Gtk.Image el;
1940 private DialogFiles _this;
1946 public Xcls_Image47(DialogFiles _owner )
1949 this.el = new Gtk.Image();
1953 // set gobject values
1954 this.el.icon_name = "folder-new";
1955 this.el.margin_end = 4;
1956 this.el.icon_size = Gtk.IconSize.NORMAL;
1959 // user defined functions
1962 public class Xcls_Label48 : Object
1964 public Gtk.Label el;
1965 private DialogFiles _this;
1971 public Xcls_Label48(DialogFiles _owner )
1974 this.el = new Gtk.Label( "New Project" );
1978 // set gobject values
1979 this.el.halign = Gtk.Align.START;
1982 // user defined functions
1987 public class Xcls_btn_projprop : Object
1989 public Gtk.Button el;
1990 private DialogFiles _this;
1996 public Xcls_btn_projprop(DialogFiles _owner )
1999 _this.btn_projprop = this;
2000 this.el = new Gtk.Button();
2004 // set gobject values
2005 var child_1 = new Xcls_Box50( _this );
2006 this.el.child = child_1.el;
2009 this.el.clicked.connect( ( ) => {
2010 // should disable the button really.
2011 if (_this.selectedProject == null) {
2014 _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
2018 // user defined functions
2020 public class Xcls_Box50 : Object
2023 private DialogFiles _this;
2029 public Xcls_Box50(DialogFiles _owner )
2032 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2036 // set gobject values
2037 var child_1 = new Xcls_Image51( _this );
2039 this.el.append( child_1.el );
2040 var child_2 = new Xcls_Label52( _this );
2042 this.el.append( child_2.el );
2045 // user defined functions
2047 public class Xcls_Image51 : Object
2049 public Gtk.Image el;
2050 private DialogFiles _this;
2056 public Xcls_Image51(DialogFiles _owner )
2059 this.el = new Gtk.Image();
2063 // set gobject values
2064 this.el.icon_name = "emblem-system";
2065 this.el.margin_end = 4;
2068 // user defined functions
2071 public class Xcls_Label52 : Object
2073 public Gtk.Label el;
2074 private DialogFiles _this;
2080 public Xcls_Label52(DialogFiles _owner )
2083 this.el = new Gtk.Label( "Project Properties" );
2087 // set gobject values
2090 // user defined functions
2095 public class Xcls_btn_delproj : Object
2097 public Gtk.Button el;
2098 private DialogFiles _this;
2102 public DialogConfirm confirm;
2105 public Xcls_btn_delproj(DialogFiles _owner )
2108 _this.btn_delproj = this;
2109 this.el = new Gtk.Button();
2112 this.confirm = null;
2114 // set gobject values
2115 var child_1 = new Xcls_Box54( _this );
2116 this.el.child = child_1.el;
2119 this.el.clicked.connect( ( ) => {
2122 if (this.confirm == null) {
2123 this.confirm = new DialogConfirm();
2124 this.confirm.el.set_transient_for(_this.el);
2127 var project = (Project.Project) _this.projectsort.el.get_item(
2128 _this.projectselection.el.selected
2131 this.confirm.el.response.connect((res) => {
2132 this.confirm.el.hide();
2133 if (res == Gtk.ResponseType.CANCEL) {
2136 project = (Project.Project) _this.projectsort.el.get_item(
2137 _this.projectselection.el.selected
2139 Project.Project.remove(project);
2140 _this.projectmodel.remove(project);
2141 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2144 this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2148 // user defined functions
2150 public class Xcls_Box54 : Object
2153 private DialogFiles _this;
2159 public Xcls_Box54(DialogFiles _owner )
2162 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2166 // set gobject values
2167 var child_1 = new Xcls_Image55( _this );
2169 this.el.append( child_1.el );
2170 var child_2 = new Xcls_Label56( _this );
2172 this.el.append( child_2.el );
2175 // user defined functions
2177 public class Xcls_Image55 : Object
2179 public Gtk.Image el;
2180 private DialogFiles _this;
2186 public Xcls_Image55(DialogFiles _owner )
2189 this.el = new Gtk.Image();
2193 // set gobject values
2194 this.el.icon_name = "user-trash";
2197 // user defined functions
2200 public class Xcls_Label56 : Object
2202 public Gtk.Label el;
2203 private DialogFiles _this;
2209 public Xcls_Label56(DialogFiles _owner )
2212 this.el = new Gtk.Label( "Delete Project" );
2216 // set gobject values
2219 // user defined functions
2224 public class Xcls_btn_addfile : Object
2226 public Gtk.Button el;
2227 private DialogFiles _this;
2233 public Xcls_btn_addfile(DialogFiles _owner )
2236 _this.btn_addfile = this;
2237 this.el = new Gtk.Button();
2241 // set gobject values
2242 var child_1 = new Xcls_Box58( _this );
2243 this.el.child = child_1.el;
2246 this.el.clicked.connect( () => {
2247 // create a new file in project..
2248 print("add file selected\n");
2250 if (_this.selectedProject == null) {
2254 var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
2255 _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2256 } catch (JsRender.Error e) {}
2261 // user defined functions
2263 public class Xcls_Box58 : Object
2266 private DialogFiles _this;
2272 public Xcls_Box58(DialogFiles _owner )
2275 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2279 // set gobject values
2280 var child_1 = new Xcls_Image59( _this );
2282 this.el.append( child_1.el );
2283 var child_2 = new Xcls_Label60( _this );
2285 this.el.append( child_2.el );
2288 // user defined functions
2290 public class Xcls_Image59 : Object
2292 public Gtk.Image el;
2293 private DialogFiles _this;
2299 public Xcls_Image59(DialogFiles _owner )
2302 this.el = new Gtk.Image();
2306 // set gobject values
2307 this.el.icon_name = "document-new";
2308 this.el.margin_end = 4;
2311 // user defined functions
2314 public class Xcls_Label60 : Object
2316 public Gtk.Label el;
2317 private DialogFiles _this;
2323 public Xcls_Label60(DialogFiles _owner )
2326 this.el = new Gtk.Label( "New File" );
2330 // set gobject values
2333 // user defined functions
2338 public class Xcls_btn_delfile : Object
2340 public Gtk.Button el;
2341 private DialogFiles _this;
2345 public DialogConfirm confirm;
2348 public Xcls_btn_delfile(DialogFiles _owner )
2351 _this.btn_delfile = this;
2352 this.el = new Gtk.Button();
2355 this.confirm = null;
2357 // set gobject values
2358 var child_1 = new Xcls_Box62( _this );
2359 this.el.child = child_1.el;
2362 this.el.clicked.connect( ( ) => {
2364 if (this.confirm == null) {
2365 this.confirm = new DialogConfirm();
2366 this.confirm.el.set_transient_for(_this.el);
2369 GLib.debug("DELETE");
2371 var isel = _this.iconsel.selectedFile();
2374 GLib.debug("DELETE - no icons selected");
2376 isel = _this.treeselmodel.selectedFile();
2379 GLib.debug("DELETE - no tree item selected");
2380 return; // should nto happen..
2383 GLib.debug("DELETE - calling confirm.");
2384 this.confirm.el.response.connect((res) => {
2385 this.confirm.el.hide();
2386 if (res == Gtk.ResponseType.CANCEL) {
2390 isel = _this.iconsel.selectedFile();
2393 isel = _this.treeselmodel.selectedFile();
2396 return; // should nto happen..
2400 isel.project.deleteFile(isel);
2401 _this.gridmodel.remove(isel);
2404 isel.project.deleteFile(isel);
2407 this.confirm.showIt("Confirm Delete File",
2408 "Are you sure you want to delete this file?");
2415 // user defined functions
2417 public class Xcls_Box62 : Object
2420 private DialogFiles _this;
2426 public Xcls_Box62(DialogFiles _owner )
2429 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2433 // set gobject values
2434 var child_1 = new Xcls_Image63( _this );
2436 this.el.append( child_1.el );
2437 var child_2 = new Xcls_Label64( _this );
2439 this.el.append( child_2.el );
2442 // user defined functions
2444 public class Xcls_Image63 : Object
2446 public Gtk.Image el;
2447 private DialogFiles _this;
2453 public Xcls_Image63(DialogFiles _owner )
2456 this.el = new Gtk.Image();
2460 // set gobject values
2461 this.el.icon_name = "user-trash";
2464 // user defined functions
2467 public class Xcls_Label64 : Object
2469 public Gtk.Label el;
2470 private DialogFiles _this;
2476 public Xcls_Label64(DialogFiles _owner )
2479 this.el = new Gtk.Label( "Delete File" );
2483 // set gobject values
2486 // user defined functions