1 static Xcls_GtkView _GtkView;
3 public class Xcls_GtkView : Object
6 private Xcls_GtkView _this;
8 public static Xcls_GtkView singleton()
10 if (_GtkView == null) {
11 _GtkView= new Xcls_GtkView();
15 public Xcls_notebook notebook;
16 public Xcls_label_preview label_preview;
17 public Xcls_label_code label_code;
18 public Xcls_view_layout view_layout;
19 public Xcls_container container;
20 public Xcls_sourceviewscroll sourceviewscroll;
21 public Xcls_sourceview sourceview;
22 public Xcls_buffer buffer;
23 public Xcls_search_entry search_entry;
24 public Xcls_search_results search_results;
25 public Xcls_nextBtn nextBtn;
26 public Xcls_backBtn backBtn;
27 public Xcls_search_settings search_settings;
28 public Xcls_case_sensitive case_sensitive;
29 public Xcls_regex regex;
30 public Xcls_multiline multiline;
33 public Gtk.Widget lastObj;
34 public Gtk.CssProvider css;
35 public Xcls_MainWindow main_window;
36 public GtkSource.SearchContext searchcontext;
37 public int last_error_counter;
38 public int last_search_end;
39 public JsRender.JsRender file;
45 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
49 this.last_error_counter = 0;
50 this.last_search_end = 0;
54 this.el.hexpand = true;
55 this.el.vexpand = true;
56 new Xcls_notebook( _this );
57 this.el.append( _this.notebook.el );
63 this.css = new Gtk.CssProvider();
65 this.css.load_from_string(
66 "#gtkview-view-layout { background-color: #ccc; }"
69 Gtk.StyleContext.add_provider_for_display(
70 this.el.get_display(),
72 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
79 // user defined functions
80 public void loadFile (JsRender.JsRender file)
84 if (file.tree == null) {
87 this.last_error_counter = -1;
88 this.notebook.el.page = 0;// gtk preview
93 this.sourceview.loadFile();
95 this.searchcontext = null;
96 this.last_error_counter = -1;
97 this.updateErrorMarks();
98 if (this.lastObj != null) {
99 this.container.el.remove(this.lastObj);
102 // hide the compile view at present..
105 var w = this.el.get_width();
106 var h = this.el.get_height();
108 print("ALLOC SET SIZES %d, %d\n", w,h);
110 // set the container size min to 500/500 or 20 px less than max..
111 w = int.max (w-20, 500);
112 h = int.max (h-20, 500);
114 print("SET SIZES %d, %d\n", w,h);
115 _this.container.el.set_size_request(w,h);
117 _this.view_layout.el.set_size_request(w,h);
118 // should be baded on calc.. -- see update_scrolled.
120 var fc = this.container.el.get_first_child();
122 this.container.el.remove(fc);
125 var xmlstr = JsRender.NodeToGlade.mungeFile( file);
126 var builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);
127 var obj = (Gtk.Widget) builder.get_object("w"+ file.tree.oid.to_string());
128 this.container.el.append(obj);
136 public void highlightNodeAtLine (int ln) {
138 // this is done from clicking on the editor..
143 var node = _this.file.lineToNode(ln+1);
146 //print("can not find node\n");
149 var prop = node.lineToProp(ln+1);
150 print("prop : %s", prop == null ? "???" : prop.name);
153 // ---------- this selects the tree's node...
155 var ltree = _this.main_window.windowstate.left_tree;
156 ltree.model.selectNode(node);
157 //var tp = ltree.model.treePathFromNode(node);
159 //print("got tree path %s\n", tp);
163 //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
166 //print("changing cursor on tree..\n");
170 // let's try allowing editing on the methods.
171 // a little klunky at present..
172 _this.sourceview.prop_selected = "";
175 //see if we can find it..
176 var kv = prop.split(":");
179 //var k = prop.get_key(kv[1]);
180 // fixme -- need to determine if it's an editable property...
181 _this.sourceview.prop_selected = prop;
183 } else if (kv[0] == "l") {
184 _this.sourceview.prop_selected = prop;
189 //ltree.view.setCursor(tp, "editor");
190 // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
191 _this.sourceview.nodeSelected(node,false);
193 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
194 // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
195 // this.allow_node_scroll = true;
211 public void forwardSearch (bool change_focus) {
213 if (this.searchcontext == null) {
216 this.notebook.el.page = 1;
217 Gtk.TextIter beg, st,en;
218 bool has_wrapped_around;
219 var buf = this.sourceview.el.get_buffer();
220 buf.get_iter_at_offset(out beg, this.last_search_end);
221 if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
222 this.last_search_end = 0;
225 this.last_search_end = en.get_offset();
227 this.sourceview.el.grab_focus();
229 buf.place_cursor(st);
233 this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
236 var ln = st.get_line();
238 this.highlightNodeAtLine(ln);
240 public void backSearch (bool change_focus) {
242 if (this.searchcontext == null) {
246 Gtk.TextIter beg, st,en;
247 bool has_wrapped_around;
248 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
250 if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
252 this.last_search_end = 0;
255 this.last_search_end = en.get_offset();
257 this.sourceview.el.grab_focus();
259 this.buffer.el.place_cursor(st);
260 this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
261 var ln = st.get_line();
262 this.highlightNodeAtLine(ln);
265 public int search (string in_txt) {
266 this.notebook.el.page = 1;
270 var s = new GtkSource.SearchSettings();
271 s.case_sensitive = _this.case_sensitive.el.active;
272 s.regex_enabled = _this.regex.el.active;
273 s.wrap_around = false;
275 this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
276 this.searchcontext.set_highlight(true);
279 if (_this.multiline.el.active) {
280 txt = in_txt.replace("\\n", "\n");
283 s.set_search_text(txt);
284 Gtk.TextIter beg, st,en;
285 bool has_wrapped_around;
286 this.buffer.el.get_start_iter(out beg);
287 this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
288 this.last_search_end = 0;
290 return this.searchcontext.get_occurrences_count();
296 public void createThumb () {
299 if (this.file == null) {
302 // only screenshot the gtk preview..
303 if (this.notebook.el.page > 0 ) {
308 this.file.widgetToIcon(this.container.el);
317 // should we hold until it's printed...
323 public void updateErrorMarks () {
327 var buf = _this.buffer.el;
330 buf.get_bounds (out start, out end);
334 GLib.debug("highlight errors");
336 // we should highlight other types of errors..
341 if (_this.file == null) {
342 GLib.debug("file is null?");
346 var ar = this.file.getErrors();
348 buf.remove_tag_by_name ("ERR", start, end);
349 buf.remove_tag_by_name ("WARN", start, end);
350 buf.remove_tag_by_name ("DEPR", start, end);
351 buf.remove_source_marks (start, end, "ERR");
352 buf.remove_source_marks (start, end, "WARN");
353 buf.remove_source_marks (start, end, "DEPR");
354 this.last_error_counter = file.error_counter ;
355 GLib.debug("higjlight has no errors");
358 if (this.last_error_counter == file.error_counter) {
366 var tlines = buf.get_line_count () +1;
370 buf.remove_source_marks (start, end, "ERR");
371 buf.remove_source_marks (start, end, "WARN");
372 buf.remove_source_marks (start, end, "DEPR");
373 buf.remove_tag_by_name ("ERR", start, end);
374 buf.remove_tag_by_name ("WARN", start, end);
375 buf.remove_tag_by_name ("DEPR", start, end);
376 foreach(var diag in ar) {
380 // print("get inter\n");
381 var eline = (int)diag.range.start.line ;
382 var eline_to = (int)diag.range.end.line;
383 if (eline > tlines || eline < 0) {
388 buf.get_iter_at_line( out iter, eline);
390 buf.get_iter_at_line_offset( out start,
391 eline, (int)diag.range.start.character);
392 buf.get_iter_at_line_offset( out end,
393 eline_to, (int)diag.range.end.character);
395 buf.apply_tag_by_name(diag.category, start, end);
398 var msg = "Line: %d %s : %s".printf(eline+1, diag.category, diag.message);
399 buf.create_source_mark( msg, diag.category, iter);
400 GLib.debug("set line %d to %s", eline, msg);
401 //this.marks.set(eline, msg);
403 this.last_error_counter = file.error_counter ;
410 public void scroll_to_line (int line) {
413 GLib.Timeout.add(100, () => {
416 this.notebook.el.set_current_page(1);
418 var buf = this.sourceview.el.get_buffer();
420 var sbuf = (GtkSource.Buffer) buf;
424 sbuf.get_iter_at_line(out iter, line);
425 this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
431 public class Xcls_notebook : Object
433 public Gtk.Notebook el;
434 private Xcls_GtkView _this;
440 public Xcls_notebook(Xcls_GtkView _owner )
443 _this.notebook = this;
444 this.el = new Gtk.Notebook();
448 // set gobject values
449 this.el.overflow = Gtk.Overflow.VISIBLE;
450 new Xcls_label_preview( _this );
451 new Xcls_label_code( _this );
452 var child_3 = new Xcls_ScrolledWindow5( _this );
454 this.el.append_page ( child_3.el , _this.label_preview.el );
455 var child_4 = new Xcls_Box8( _this );
457 this.el.append_page ( child_4.el , _this.label_code.el );
460 // user defined functions
462 public class Xcls_label_preview : Object
465 private Xcls_GtkView _this;
471 public Xcls_label_preview(Xcls_GtkView _owner )
474 _this.label_preview = this;
475 this.el = new Gtk.Label( "Preview" );
479 // set gobject values
482 // user defined functions
485 public class Xcls_label_code : Object
488 private Xcls_GtkView _this;
494 public Xcls_label_code(Xcls_GtkView _owner )
497 _this.label_code = this;
498 this.el = new Gtk.Label( "Preview Generated Code" );
502 // set gobject values
505 // user defined functions
508 public class Xcls_ScrolledWindow5 : Object
510 public Gtk.ScrolledWindow el;
511 private Xcls_GtkView _this;
517 public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
520 this.el = new Gtk.ScrolledWindow();
524 // set gobject values
525 new Xcls_view_layout( _this );
526 this.el.set_child ( _this.view_layout.el );
529 // user defined functions
531 public class Xcls_view_layout : Object
534 private Xcls_GtkView _this;
540 public Xcls_view_layout(Xcls_GtkView _owner )
543 _this.view_layout = this;
544 this.el = new Gtk.Fixed();
548 // set gobject values
549 this.el.name = "gtkview-view-layout";
550 new Xcls_container( _this );
551 this.el.put ( _this.container.el , 10,10 );
554 // user defined functions
556 public class Xcls_container : Object
559 private Xcls_GtkView _this;
565 public Xcls_container(Xcls_GtkView _owner )
568 _this.container = this;
569 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
573 // set gobject values
576 // user defined functions
581 public class Xcls_Box8 : Object
584 private Xcls_GtkView _this;
590 public Xcls_Box8(Xcls_GtkView _owner )
593 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
597 // set gobject values
598 new Xcls_sourceviewscroll( _this );
599 this.el.append( _this.sourceviewscroll.el );
600 var child_2 = new Xcls_Box13( _this );
602 this.el.append( child_2.el );
605 // user defined functions
607 public class Xcls_sourceviewscroll : Object
609 public Gtk.ScrolledWindow el;
610 private Xcls_GtkView _this;
616 public Xcls_sourceviewscroll(Xcls_GtkView _owner )
619 _this.sourceviewscroll = this;
620 this.el = new Gtk.ScrolledWindow();
624 // set gobject values
625 this.el.vexpand = true;
626 new Xcls_sourceview( _this );
627 this.el.set_child ( _this.sourceview.el );
630 // user defined functions
632 public class Xcls_sourceview : Object
634 public GtkSource.View el;
635 private Xcls_GtkView _this;
640 public bool zallow_node_scroll;
641 public string prop_selected;
642 public Gtk.CssProvider css;
643 public JsRender.Node? node_selected;
646 public Xcls_sourceview(Xcls_GtkView _owner )
649 _this.sourceview = this;
650 this.el = new GtkSource.View();
653 this.loading = false;
654 this.zallow_node_scroll = true;
655 this.prop_selected = "";
657 // set gobject values
658 this.el.name = "gtkview-view";
659 this.el.editable = false;
660 this.el.show_line_marks = true;
661 this.el.show_line_numbers = true;
662 this.el.tab_width = 4;
663 new Xcls_buffer( _this );
664 this.el.set_buffer ( _this.buffer.el );
665 var child_2 = new Xcls_EventControllerKey12( _this );
667 this.el.add_controller( child_2.el );
674 this.css = new Gtk.CssProvider();
676 this.css.load_from_string("#gtkview-view { font: 10px monospace ;}");
678 Gtk.StyleContext.add_provider_for_display(
679 this.el.get_display(),
681 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
689 var attrs = new GtkSource.MarkAttributes();
690 attrs.set_icon_name ( "process-stop");
691 attrs.query_tooltip_text.connect(( mark) => {
692 //print("tooltip query? %s\n", mark.name);
696 this.el.set_mark_attributes ("ERR", attrs, 1);
698 var wattrs = new GtkSource.MarkAttributes();
699 wattrs.set_icon_name ( "process-stop");
700 wattrs.query_tooltip_text.connect(( mark) => {
701 //print("tooltip query? %s\n", mark.name);
705 this.el.set_mark_attributes ("WARN", wattrs, 1);
709 var dattrs = new GtkSource.MarkAttributes();
710 dattrs.set_icon_name ( "process-stop");
711 dattrs.query_tooltip_text.connect(( mark) => {
712 //print("tooltip query? %s\n", mark.name);
716 this.el.set_mark_attributes ("DEPR", dattrs, 1);
719 var gattrs = new GtkSource.MarkAttributes();
720 var grey = Gdk.RGBA();
721 grey.parse ( "#ccc");
722 gattrs.set_background ( grey);
725 this.el.set_mark_attributes ("grey", gattrs, 1);
735 this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
737 //GLib.debug("query tooltip");
741 var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
743 this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
745 var l = iter.get_line();
746 // GLib.debug("query tooltip line %d", (int) l);
747 var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
748 if (marks.is_empty()) {
749 marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
751 if (marks.is_empty()) {
752 marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
755 // GLib.debug("query tooltip line marks %d", (int) marks.length());
757 marks.@foreach((m) => {
758 //GLib.debug("got mark %s", m.name);
759 str += (str.length > 0 ? "\n" : "") + m.name;
762 // true if there is a mark..
763 tooltip.set_text( str);
764 return str.length > 0 ? true : false;
769 // user defined functions
770 public void loadFile ( ) {
772 var buf = this.el.get_buffer();
774 var sbuf = (GtkSource.Buffer) buf;
775 var cpos = buf.cursor_position;
777 print("BEFORE LOAD cursor = %d\n", cpos);
778 var vadj_pos = this.el.get_vadjustment().get_value();
780 if (_this.file == null || _this.file.xtype != "Gtk") {
781 print("xtype != Gtk");
782 this.loading = false;
788 var regex = new Regex("\\.bjs$");
791 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
792 } catch (GLib.RegexError e) {
793 this.loading = false;
798 if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
799 print("File path has no errors\n");
800 this.loading = false;
807 GLib.FileUtils.get_contents (valafn, out str);
809 this.loading = false;
813 var str = _this.file.toSource();
815 // print("setting str %d\n", str.length);
816 buf.set_text(str, str.length);
817 var lm = GtkSource.LanguageManager.get_default();
819 //?? is javascript going to work as js?
821 ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
824 _this.main_window.windowstate.updateErrorMarksAll();
825 // restore the cursor position?
826 // after reloading the contents.
827 GLib.Timeout.add(500, () => {
828 _this.buffer.in_cursor_change = true;
829 print("RESORTING cursor to = %d\n", cpos);
830 Gtk.TextIter cpos_iter;
831 buf.get_iter_at_offset(out cpos_iter, cpos);
832 buf.place_cursor(cpos_iter);
834 this.el.get_vadjustment().set_value(vadj_pos);;
835 _this.buffer.in_cursor_change = false;
839 //_this.buffer.checkSyntax();
844 this.loading = false;
846 public void nodeSelected (JsRender.Node? sel, bool scroll) {
852 // this is connected in widnowstate
853 print("Roo-view - node selected\n");
854 var buf = this.el.get_buffer();
856 var sbuf = (GtkSource.Buffer) buf;
862 // clear all the marks..
866 sbuf.get_bounds (out start, out end);
867 sbuf.remove_source_marks (start, end, "grey");
869 this.node_selected = sel;
875 sbuf.get_iter_at_line(out iter, sel.line_start);
878 Gtk.TextIter cur_iter;
879 sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
882 if (!_this.buffer.in_cursor_change) {
884 this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
889 for (var i = 0; i < buf.get_line_count();i++) {
890 if (i < sel.line_start || i > sel.line_end) {
892 sbuf.get_iter_at_line(out iter, i);
893 sbuf.create_source_mark(null, "grey", iter);
901 public string toString () {
904 this.el.get_buffer().get_start_iter(out s);
905 this.el.get_buffer().get_end_iter(out e);
906 var ret = this.el.get_buffer().get_text(s,e,true);
907 //print("TO STRING? " + ret);
911 public class Xcls_buffer : Object
913 public GtkSource.Buffer el;
914 private Xcls_GtkView _this;
918 public int error_line;
919 public bool in_cursor_change;
921 public int last_line;
924 public Xcls_buffer(Xcls_GtkView _owner )
928 this.el = new GtkSource.Buffer( null );
931 this.error_line = -1;
932 this.in_cursor_change = false;
936 // set gobject values
941 buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
942 buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
943 buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
944 buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
945 buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
946 buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
947 buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
948 buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
951 buf.create_tag ("ERR", "weight", Pango.Weight.BOLD, "background", "pink");
952 buf.create_tag ("WARN", "weight", Pango.Weight.BOLD, "background", "#ABF4EB");
953 buf.create_tag ("DEPR", "weight", Pango.Weight.BOLD, "background", "#EEA9FF");
956 this.el.cursor_moved.connect( ( ) => {
957 GLib.debug("cursor moved called");
960 if (this.in_cursor_change ) {
961 GLib.debug("cursor changed : %d [ignoring nested call)", this.el.cursor_position);
965 GLib.debug("cursor changed : %d", this.el.cursor_position);
967 this.el.get_iter_at_offset(out cpos, this.el.cursor_position);
969 var ln = cpos.get_line();
970 if (this.last_line == ln ){
974 var node = _this.file.lineToNode(ln);
977 print("can not find node\n");
980 this.in_cursor_change = true;
981 var ltree = _this.main_window.windowstate.left_tree;
982 ltree.model.selectNode(node);
983 this.in_cursor_change = false;
987 // user defined functions
990 public class Xcls_EventControllerKey12 : Object
992 public Gtk.EventControllerKey el;
993 private Xcls_GtkView _this;
999 public Xcls_EventControllerKey12(Xcls_GtkView _owner )
1002 this.el = new Gtk.EventControllerKey();
1006 // set gobject values
1009 this.el.key_pressed.connect( (keyval, keycode, state) => {
1013 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1014 GLib.debug("SAVE: ctrl-g pressed");
1015 _this.forwardSearch(true);
1018 if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1019 GLib.debug("SAVE: ctrl-f pressed");
1020 _this.search_entry.el.grab_focus();
1028 // user defined functions
1033 public class Xcls_Box13 : Object
1036 private Xcls_GtkView _this;
1042 public Xcls_Box13(Xcls_GtkView _owner )
1045 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1049 // set gobject values
1050 this.el.homogeneous = false;
1051 this.el.vexpand = false;
1052 new Xcls_search_entry( _this );
1053 this.el.append( _this.search_entry.el );
1054 new Xcls_search_results( _this );
1055 this.el.append( _this.search_results.el );
1056 new Xcls_nextBtn( _this );
1057 this.el.append( _this.nextBtn.el );
1058 new Xcls_backBtn( _this );
1059 this.el.append( _this.backBtn.el );
1060 var child_5 = new Xcls_MenuButton19( _this );
1062 this.el.append( child_5.el );
1065 // user defined functions
1067 public class Xcls_search_entry : Object
1069 public Gtk.SearchEntry el;
1070 private Xcls_GtkView _this;
1074 public Gtk.CssProvider css;
1077 public Xcls_search_entry(Xcls_GtkView _owner )
1080 _this.search_entry = this;
1081 this.el = new Gtk.SearchEntry();
1085 // set gobject values
1086 this.el.name = "gtkview-search-entry";
1087 this.el.hexpand = true;
1088 this.el.placeholder_text = "Press enter to search";
1089 this.el.search_delay = 3;
1090 var child_1 = new Xcls_EventControllerKey15( _this );
1092 this.el.add_controller( child_1.el );
1096 this.css = new Gtk.CssProvider();
1098 this.css.load_from_string("
1099 #gtkview-search-entry { font: 10px monospace ;}"
1102 Gtk.StyleContext.add_provider_for_display(
1103 this.el.get_display(),
1105 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1109 this.el.search_changed.connect( () => {
1111 _this.search(_this.search_entry.el.text);
1112 _this.search_results.updateResults();
1114 GLib.Timeout.add_seconds(1,() => {
1115 _this.search_results.updateResults();
1124 // user defined functions
1125 public void forwardSearch (bool change_focus) {
1128 _this.forwardSearch(change_focus);
1132 switch(_this.windowstate.state) {
1133 case WindowState.State.CODEONLY:
1134 //case WindowState.State.CODE:
1135 // search the code being edited..
1136 _this.windowstate.code_editor_tab.forwardSearch(change_focus);
1139 case WindowState.State.PREVIEW:
1140 if (_this.windowstate.file.xtype == "Gtk") {
1141 _this.windowstate.window_gladeview.forwardSearch(change_focus);
1143 _this.windowstate.window_rooview.forwardSearch(change_focus);
1152 public class Xcls_EventControllerKey15 : Object
1154 public Gtk.EventControllerKey el;
1155 private Xcls_GtkView _this;
1161 public Xcls_EventControllerKey15(Xcls_GtkView _owner )
1164 this.el = new Gtk.EventControllerKey();
1168 // set gobject values
1171 this.el.key_pressed.connect( (keyval, keycode, state) => {
1173 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1174 GLib.debug("SAVE: ctrl-g pressed");
1175 _this.forwardSearch(true);
1180 if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
1181 _this.forwardSearch(true);
1187 // print(event.key.keyval)
1193 // user defined functions
1197 public class Xcls_search_results : Object
1199 public Gtk.Label el;
1200 private Xcls_GtkView _this;
1206 public Xcls_search_results(Xcls_GtkView _owner )
1209 _this.search_results = this;
1210 this.el = new Gtk.Label( "No Results" );
1214 // set gobject values
1215 this.el.margin_end = 4;
1216 this.el.margin_start = 4;
1219 // user defined functions
1220 public void updateResults () {
1221 this.el.visible = true;
1223 var res = _this.searchcontext.get_occurrences_count();
1225 _this.search_results.el.label = "??? Matches";
1229 _this.nextBtn.el.sensitive = false;
1230 _this.backBtn.el.sensitive = false;
1233 _this.search_results.el.label = "%d Matches".printf(res);
1234 _this.nextBtn.el.sensitive = true;
1235 _this.backBtn.el.sensitive = true;
1238 _this.search_results.el.label = "No Matches";
1243 public class Xcls_nextBtn : Object
1245 public Gtk.Button el;
1246 private Xcls_GtkView _this;
1250 public bool always_show_image;
1253 public Xcls_nextBtn(Xcls_GtkView _owner )
1256 _this.nextBtn = this;
1257 this.el = new Gtk.Button();
1260 this.always_show_image = true;
1262 // set gobject values
1263 this.el.icon_name = "go-down";
1264 this.el.sensitive = false;
1267 this.el.clicked.connect( ( ) => {
1268 _this.forwardSearch(true);
1274 // user defined functions
1277 public class Xcls_backBtn : Object
1279 public Gtk.Button el;
1280 private Xcls_GtkView _this;
1284 public bool always_show_image;
1287 public Xcls_backBtn(Xcls_GtkView _owner )
1290 _this.backBtn = this;
1291 this.el = new Gtk.Button();
1294 this.always_show_image = true;
1296 // set gobject values
1297 this.el.icon_name = "go-up";
1298 this.el.sensitive = false;
1301 this.el.clicked.connect( ( ) => {
1303 _this.backSearch(true);
1308 // user defined functions
1311 public class Xcls_MenuButton19 : Object
1313 public Gtk.MenuButton el;
1314 private Xcls_GtkView _this;
1318 public bool always_show_image;
1321 public Xcls_MenuButton19(Xcls_GtkView _owner )
1324 this.el = new Gtk.MenuButton();
1327 this.always_show_image = true;
1329 // set gobject values
1330 this.el.icon_name = "emblem-system";
1331 this.el.always_show_arrow = true;
1332 new Xcls_search_settings( _this );
1333 this.el.popover = _this.search_settings.el;
1336 // user defined functions
1338 public class Xcls_search_settings : Object
1340 public Gtk.PopoverMenu el;
1341 private Xcls_GtkView _this;
1347 public Xcls_search_settings(Xcls_GtkView _owner )
1350 _this.search_settings = this;
1351 this.el = new Gtk.PopoverMenu.from_model(null);
1355 // set gobject values
1356 var child_1 = new Xcls_Box21( _this );
1358 this.el.set_child ( child_1.el );
1361 // user defined functions
1363 public class Xcls_Box21 : Object
1366 private Xcls_GtkView _this;
1372 public Xcls_Box21(Xcls_GtkView _owner )
1375 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1379 // set gobject values
1380 new Xcls_case_sensitive( _this );
1381 this.el.append( _this.case_sensitive.el );
1382 new Xcls_regex( _this );
1383 this.el.append( _this.regex.el );
1384 new Xcls_multiline( _this );
1385 this.el.append( _this.multiline.el );
1388 // user defined functions
1390 public class Xcls_case_sensitive : Object
1392 public Gtk.CheckButton el;
1393 private Xcls_GtkView _this;
1399 public Xcls_case_sensitive(Xcls_GtkView _owner )
1402 _this.case_sensitive = this;
1403 this.el = new Gtk.CheckButton();
1407 // set gobject values
1408 this.el.label = "Case Sensitive";
1411 // user defined functions
1414 public class Xcls_regex : Object
1416 public Gtk.CheckButton el;
1417 private Xcls_GtkView _this;
1423 public Xcls_regex(Xcls_GtkView _owner )
1427 this.el = new Gtk.CheckButton();
1431 // set gobject values
1432 this.el.label = "Regex";
1435 // user defined functions
1438 public class Xcls_multiline : Object
1440 public Gtk.CheckButton el;
1441 private Xcls_GtkView _this;
1447 public Xcls_multiline(Xcls_GtkView _owner )
1450 _this.multiline = this;
1451 this.el = new Gtk.CheckButton();
1455 // set gobject values
1456 this.el.label = "Multi-line (add \\n)";
1459 // user defined functions