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_search_end;
38 public JsRender.JsRender file;
44 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
48 this.last_search_end = 0;
52 this.el.hexpand = true;
53 this.el.vexpand = true;
54 new Xcls_notebook( _this );
55 this.el.append( _this.notebook.el );
61 this.css = new Gtk.CssProvider();
63 this.css.load_from_string(
64 "#gtkview-view-layout { background-color: #ccc; }"
67 Gtk.StyleContext.add_provider_for_display(
68 this.el.get_display(),
70 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
77 // user defined functions
78 public void loadFile (JsRender.JsRender file)
82 if (file.tree == null) {
85 this.notebook.el.page = 0;// gtk preview
90 this.sourceview.loadFile();
91 this.searchcontext = null;
94 if (this.lastObj != null) {
95 this.container.el.remove(this.lastObj);
98 // hide the compile view at present..
101 var w = this.el.get_width();
102 var h = this.el.get_height();
104 print("ALLOC SET SIZES %d, %d\n", w,h);
106 // set the container size min to 500/500 or 20 px less than max..
107 w = int.max (w-20, 500);
108 h = int.max (h-20, 500);
110 print("SET SIZES %d, %d\n", w,h);
111 _this.container.el.set_size_request(w,h);
113 _this.view_layout.el.set_size_request(w,h);
114 // should be baded on calc.. -- see update_scrolled.
116 var fc = this.container.el.get_first_child();
118 this.container.el.remove(fc);
121 var xmlstr = JsRender.NodeToGlade.mungeFile( file);
122 var builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);
123 var obj = (Gtk.Widget) builder.get_object("w"+ file.tree.oid.to_string());
124 this.container.el.append(obj);
130 var x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);
131 var obj = x.munge() as Gtk.Widget;
138 this.container.el.append(obj);
144 public void highlightNodeAtLine (int ln) {
146 // this is done from clicking on the editor..
151 var node = _this.file.lineToNode(ln+1);
154 //print("can not find node\n");
157 var prop = node.lineToProp(ln+1);
158 print("prop : %s", prop == null ? "???" : prop.name);
161 // ---------- this selects the tree's node...
163 var ltree = _this.main_window.windowstate.left_tree;
164 ltree.model.selectNode(node);
165 //var tp = ltree.model.treePathFromNode(node);
167 //print("got tree path %s\n", tp);
171 //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
174 //print("changing cursor on tree..\n");
178 // let's try allowing editing on the methods.
179 // a little klunky at present..
180 _this.sourceview.prop_selected = "";
183 //see if we can find it..
184 var kv = prop.split(":");
187 //var k = prop.get_key(kv[1]);
188 // fixme -- need to determine if it's an editable property...
189 _this.sourceview.prop_selected = prop;
191 } else if (kv[0] == "l") {
192 _this.sourceview.prop_selected = prop;
197 //ltree.view.setCursor(tp, "editor");
198 // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
199 _this.sourceview.nodeSelected(node,false);
201 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
202 // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
203 // this.allow_node_scroll = true;
219 public void forwardSearch (bool change_focus) {
221 if (this.searchcontext == null) {
224 this.notebook.el.page = 1;
225 Gtk.TextIter beg, st,en;
226 bool has_wrapped_around;
227 var buf = this.sourceview.el.get_buffer();
228 buf.get_iter_at_offset(out beg, this.last_search_end);
229 if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
230 this.last_search_end = 0;
233 this.last_search_end = en.get_offset();
235 this.sourceview.el.grab_focus();
237 buf.place_cursor(st);
241 this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
244 var ln = st.get_line();
246 this.highlightNodeAtLine(ln);
248 public void backSearch (bool change_focus) {
250 if (this.searchcontext == null) {
254 Gtk.TextIter beg, st,en;
255 bool has_wrapped_around;
256 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
258 if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
260 this.last_search_end = 0;
263 this.last_search_end = en.get_offset();
265 this.sourceview.el.grab_focus();
267 this.buffer.el.place_cursor(st);
268 this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
269 var ln = st.get_line();
270 this.highlightNodeAtLine(ln);
273 public int search (string in_txt) {
274 this.notebook.el.page = 1;
278 var s = new GtkSource.SearchSettings();
279 s.case_sensitive = _this.case_sensitive.el.active;
280 s.regex_enabled = _this.regex.el.active;
281 s.wrap_around = false;
283 this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
284 this.searchcontext.set_highlight(true);
287 if (_this.multiline.el.active) {
288 txt = in_txt.replace("\\n", "\n");
291 s.set_search_text(txt);
292 Gtk.TextIter beg, st,en;
293 bool has_wrapped_around;
294 this.buffer.el.get_start_iter(out beg);
295 this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
296 this.last_search_end = 0;
298 return this.searchcontext.get_occurrences_count();
304 public void createThumb () {
307 if (this.file == null) {
310 // only screenshot the gtk preview..
311 if (this.notebook.el.page > 0 ) {
316 this.file.widgetToIcon(this.container.el);
325 // should we hold until it's printed...
331 public void scroll_to_line (int line) {
334 GLib.Timeout.add(100, () => {
337 this.notebook.el.set_current_page(1);
339 var buf = this.sourceview.el.get_buffer();
341 var sbuf = (GtkSource.Buffer) buf;
345 sbuf.get_iter_at_line(out iter, line);
346 this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
352 public class Xcls_notebook : Object
354 public Gtk.Notebook el;
355 private Xcls_GtkView _this;
361 public Xcls_notebook(Xcls_GtkView _owner )
364 _this.notebook = this;
365 this.el = new Gtk.Notebook();
369 // set gobject values
370 this.el.overflow = Gtk.Overflow.VISIBLE;
371 new Xcls_label_preview( _this );
372 new Xcls_label_code( _this );
373 var child_3 = new Xcls_ScrolledWindow5( _this );
375 this.el.append_page ( child_3.el , _this.label_preview.el );
376 var child_4 = new Xcls_Box8( _this );
378 this.el.append_page ( child_4.el , _this.label_code.el );
381 // user defined functions
383 public class Xcls_label_preview : Object
386 private Xcls_GtkView _this;
392 public Xcls_label_preview(Xcls_GtkView _owner )
395 _this.label_preview = this;
396 this.el = new Gtk.Label( "Preview" );
400 // set gobject values
403 // user defined functions
406 public class Xcls_label_code : Object
409 private Xcls_GtkView _this;
415 public Xcls_label_code(Xcls_GtkView _owner )
418 _this.label_code = this;
419 this.el = new Gtk.Label( "Preview Generated Code" );
423 // set gobject values
426 // user defined functions
429 public class Xcls_ScrolledWindow5 : Object
431 public Gtk.ScrolledWindow el;
432 private Xcls_GtkView _this;
438 public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
441 this.el = new Gtk.ScrolledWindow();
445 // set gobject values
446 new Xcls_view_layout( _this );
447 this.el.set_child ( _this.view_layout.el );
450 // user defined functions
452 public class Xcls_view_layout : Object
455 private Xcls_GtkView _this;
461 public Xcls_view_layout(Xcls_GtkView _owner )
464 _this.view_layout = this;
465 this.el = new Gtk.Fixed();
469 // set gobject values
470 this.el.name = "gtkview-view-layout";
471 new Xcls_container( _this );
472 this.el.put ( _this.container.el , 10,10 );
475 // user defined functions
477 public class Xcls_container : Object
480 private Xcls_GtkView _this;
486 public Xcls_container(Xcls_GtkView _owner )
489 _this.container = this;
490 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
494 // set gobject values
497 // user defined functions
502 public class Xcls_Box8 : Object
505 private Xcls_GtkView _this;
511 public Xcls_Box8(Xcls_GtkView _owner )
514 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
518 // set gobject values
519 new Xcls_sourceviewscroll( _this );
520 this.el.append( _this.sourceviewscroll.el );
521 var child_2 = new Xcls_Box13( _this );
523 this.el.append( child_2.el );
526 // user defined functions
528 public class Xcls_sourceviewscroll : Object
530 public Gtk.ScrolledWindow el;
531 private Xcls_GtkView _this;
537 public Xcls_sourceviewscroll(Xcls_GtkView _owner )
540 _this.sourceviewscroll = this;
541 this.el = new Gtk.ScrolledWindow();
545 // set gobject values
546 this.el.vexpand = true;
547 new Xcls_sourceview( _this );
548 this.el.set_child ( _this.sourceview.el );
551 // user defined functions
553 public class Xcls_sourceview : Object
555 public GtkSource.View el;
556 private Xcls_GtkView _this;
561 public string prop_selected;
562 public bool allow_node_scroll;
563 public Gtk.CssProvider css;
564 public JsRender.Node? node_selected;
567 public Xcls_sourceview(Xcls_GtkView _owner )
570 _this.sourceview = this;
571 this.el = new GtkSource.View();
575 this.prop_selected = "";
576 this.allow_node_scroll = true;
578 // set gobject values
579 this.el.name = "gtkview-view";
580 this.el.editable = false;
581 this.el.show_line_marks = true;
582 this.el.show_line_numbers = true;
583 new Xcls_buffer( _this );
584 this.el.set_buffer ( _this.buffer.el );
585 var child_2 = new Xcls_EventControllerKey12( _this );
587 this.el.add_controller( child_2.el );
594 this.css = new Gtk.CssProvider();
596 this.css.load_from_string("#gtkview-view { font: 10px monospace ;}");
598 Gtk.StyleContext.add_provider_for_display(
599 this.el.get_display(),
601 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
609 var attrs = new GtkSource.MarkAttributes();
610 var pink = Gdk.RGBA();
611 pink.parse ( "pink");
612 attrs.set_background ( pink);
613 attrs.set_icon_name ( "process-stop");
614 attrs.query_tooltip_text.connect(( mark) => {
615 //print("tooltip query? %s\n", mark.name);
619 this.el.set_mark_attributes ("ERR", attrs, 1);
621 var wattrs = new GtkSource.MarkAttributes();
622 var blue = Gdk.RGBA();
623 blue.parse ( "#ABF4EB");
624 wattrs.set_background ( blue);
625 wattrs.set_icon_name ( "process-stop");
626 wattrs.query_tooltip_text.connect(( mark) => {
627 //print("tooltip query? %s\n", mark.name);
631 this.el.set_mark_attributes ("WARN", wattrs, 1);
635 var dattrs = new GtkSource.MarkAttributes();
636 var purple = Gdk.RGBA();
637 purple.parse ( "#EEA9FF");
638 dattrs.set_background ( purple);
639 dattrs.set_icon_name ( "process-stop");
640 dattrs.query_tooltip_text.connect(( mark) => {
641 //print("tooltip query? %s\n", mark.name);
645 this.el.set_mark_attributes ("DEPR", dattrs, 1);
648 var gattrs = new GtkSource.MarkAttributes();
649 var grey = Gdk.RGBA();
650 grey.parse ( "#ccc");
651 gattrs.set_background ( grey);
654 this.el.set_mark_attributes ("grey", gattrs, 1);
664 this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
666 //GLib.debug("query tooltip");
670 var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
672 this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
674 var l = iter.get_line();
675 // GLib.debug("query tooltip line %d", (int) l);
676 var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
677 if (marks.is_empty()) {
678 marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
680 if (marks.is_empty()) {
681 marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
684 // GLib.debug("query tooltip line marks %d", (int) marks.length());
686 marks.@foreach((m) => {
687 //GLib.debug("got mark %s", m.name);
688 str += (str.length > 0 ? "\n" : "") + m.name;
691 // true if there is a mark..
692 tooltip.set_text( str);
693 return str.length > 0 ? true : false;
698 // user defined functions
699 public void loadFile ( ) {
701 var buf = this.el.get_buffer();
703 var sbuf = (GtkSource.Buffer) buf;
707 if (_this.file == null || _this.file.xtype != "Gtk") {
708 print("xtype != Gtk");
709 this.loading = false;
715 var regex = new Regex("\\.bjs$");
718 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
719 } catch (GLib.RegexError e) {
720 this.loading = false;
725 if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
726 print("File path has no errors\n");
727 this.loading = false;
734 GLib.FileUtils.get_contents (valafn, out str);
736 this.loading = false;
740 // print("setting str %d\n", str.length);
741 buf.set_text(str, str.length);
742 var lm = GtkSource.LanguageManager.get_default();
744 //?? is javascript going to work as js?
746 ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
752 sbuf.get_bounds (out start, out end);
753 sbuf.remove_source_marks (start, end, null); // remove all marks..
756 if (_this.main_window.windowstate.last_compile_result != null) {
757 var obj = _this.main_window.windowstate.last_compile_result;
758 this.highlightErrorsJson("ERR", obj);
759 this.highlightErrorsJson("WARN", obj);
760 this.highlightErrorsJson("DEPR", obj);
762 // while (Gtk.events_pending()) {
763 // Gtk.main_iteration();
766 this.loading = false;
768 public void nodeSelected (JsRender.Node? sel, bool scroll) {
774 // this is connected in widnowstate
775 print("Roo-view - node selected\n");
776 var buf = this.el.get_buffer();
778 var sbuf = (GtkSource.Buffer) buf;
781 // while(Gtk.events_pending()) {
782 // Gtk.main_iteration();
786 // clear all the marks..
790 sbuf.get_bounds (out start, out end);
791 sbuf.remove_source_marks (start, end, "grey");
793 this.node_selected = sel;
799 sbuf.get_iter_at_line(out iter, sel.line_start);
802 Gtk.TextIter cur_iter;
803 sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
805 //var cur_line = cur_iter.get_line();
806 //if (cur_line > sel.line_start && cur_line < sel.line_end) {
809 if (this.allow_node_scroll) {
811 this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
816 for (var i = 0; i < buf.get_line_count();i++) {
817 if (i < sel.line_start || i > sel.line_end) {
819 sbuf.get_iter_at_line(out iter, i);
820 sbuf.create_source_mark(null, "grey", iter);
828 public void highlightErrorsJson (string type, Json.Object obj) {
832 var buf = this.el.get_buffer();
833 var sbuf = (GtkSource.Buffer)buf;
834 buf.get_bounds (out start, out end);
836 sbuf.remove_source_marks (start, end, type);
839 // we should highlight other types of errors..
841 if (!obj.has_member(type)) {
842 GLib.debug("Return has no errors\n");
845 var err = obj.get_object_member(type);
847 if (_this.file == null) {
849 return; // just in case the file has not loaded yet?
855 var regex = new Regex("\\.bjs$");
858 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
859 } catch (GLib.RegexError e) {
863 if (!err.has_member(valafn)) {
864 GLib.debug("File path has no errors\n");
867 var lines = err.get_object_member(valafn);
871 var tlines = buf.get_line_count () +1;
873 lines.foreach_member((obj, line, node) => {
876 // print("get inter\n");
877 var eline = int.parse(line) -1 ;
878 GLib.debug("GOT ERROR on line %s -- converted to %d\n", line,eline);
881 if (eline > tlines || eline < 0) {
884 sbuf.get_iter_at_line( out iter, eline);
885 //print("mark line\n");
886 var msg = type + " on line: %d - %s".printf(eline+1, valafn);
887 var ar = lines.get_array_member(line);
888 for (var i = 0 ; i < ar.get_length(); i++) {
889 msg += (msg.length > 0) ? "\n" : "";
890 msg += ar.get_string_element(i);
894 sbuf.create_source_mark(msg, type, iter);
902 public string toString () {
905 this.el.get_buffer().get_start_iter(out s);
906 this.el.get_buffer().get_end_iter(out e);
907 var ret = this.el.get_buffer().get_text(s,e,true);
908 //print("TO STRING? " + ret);
912 public class Xcls_buffer : Object
914 public GtkSource.Buffer el;
915 private Xcls_GtkView _this;
919 public int error_line;
923 public Xcls_buffer(Xcls_GtkView _owner )
927 this.el = new GtkSource.Buffer( null );
930 this.error_line = -1;
933 // set gobject values
936 this.el.notify["cursor_position"].connect( () => {
939 if (_this.sourceview.loading) {
943 GLib.debug("cursor changed : %d", this.el.cursor_position);
945 this.el.get_iter_at_offset(out cpos, this.el.cursor_position);
947 var ln = cpos.get_line();
949 var node = _this.file.lineToNode(ln);
952 print("can not find node\n");
955 _this.sourceview.loading = true;
956 var ltree = _this.main_window.windowstate.left_tree;
957 ltree.model.selectNode(node);
958 _this.sourceview.loading = false;
960 //print("got tree path %s\n", tp);
962 // this.allow_node_scroll = false;
963 // print("changing cursor on tree..\n");
964 //ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
965 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
966 ///GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
967 // this.allow_node_scroll = true;
972 // highlight the node..
979 // user defined functions
982 public class Xcls_EventControllerKey12 : Object
984 public Gtk.EventControllerKey el;
985 private Xcls_GtkView _this;
991 public Xcls_EventControllerKey12(Xcls_GtkView _owner )
994 this.el = new Gtk.EventControllerKey();
998 // set gobject values
1001 this.el.key_pressed.connect( (keyval, keycode, state) => {
1005 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1006 GLib.debug("SAVE: ctrl-g pressed");
1007 _this.forwardSearch(true);
1010 if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1011 GLib.debug("SAVE: ctrl-f pressed");
1012 _this.search_entry.el.grab_focus();
1020 // user defined functions
1025 public class Xcls_Box13 : Object
1028 private Xcls_GtkView _this;
1034 public Xcls_Box13(Xcls_GtkView _owner )
1037 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1041 // set gobject values
1042 this.el.homogeneous = false;
1043 this.el.vexpand = false;
1044 new Xcls_search_entry( _this );
1045 this.el.append( _this.search_entry.el );
1046 new Xcls_search_results( _this );
1047 this.el.append( _this.search_results.el );
1048 new Xcls_nextBtn( _this );
1049 this.el.append( _this.nextBtn.el );
1050 new Xcls_backBtn( _this );
1051 this.el.append( _this.backBtn.el );
1052 var child_5 = new Xcls_MenuButton19( _this );
1054 this.el.append( child_5.el );
1057 // user defined functions
1059 public class Xcls_search_entry : Object
1061 public Gtk.SearchEntry el;
1062 private Xcls_GtkView _this;
1066 public Gtk.CssProvider css;
1069 public Xcls_search_entry(Xcls_GtkView _owner )
1072 _this.search_entry = this;
1073 this.el = new Gtk.SearchEntry();
1077 // set gobject values
1078 this.el.name = "gtkview-search-entry";
1079 this.el.hexpand = true;
1080 this.el.placeholder_text = "Press enter to search";
1081 this.el.search_delay = 3;
1082 var child_1 = new Xcls_EventControllerKey15( _this );
1084 this.el.add_controller( child_1.el );
1088 this.css = new Gtk.CssProvider();
1090 this.css.load_from_string("
1091 #gtkview-search-entry { font: 10px monospace ;}"
1094 Gtk.StyleContext.add_provider_for_display(
1095 this.el.get_display(),
1097 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1101 this.el.search_changed.connect( () => {
1103 _this.search(_this.search_entry.el.text);
1104 _this.search_results.updateResults();
1106 GLib.Timeout.add_seconds(1,() => {
1107 _this.search_results.updateResults();
1116 // user defined functions
1117 public void forwardSearch (bool change_focus) {
1120 _this.forwardSearch(change_focus);
1124 switch(_this.windowstate.state) {
1125 case WindowState.State.CODEONLY:
1126 //case WindowState.State.CODE:
1127 // search the code being edited..
1128 _this.windowstate.code_editor_tab.forwardSearch(change_focus);
1131 case WindowState.State.PREVIEW:
1132 if (_this.windowstate.file.xtype == "Gtk") {
1133 _this.windowstate.window_gladeview.forwardSearch(change_focus);
1135 _this.windowstate.window_rooview.forwardSearch(change_focus);
1144 public class Xcls_EventControllerKey15 : Object
1146 public Gtk.EventControllerKey el;
1147 private Xcls_GtkView _this;
1153 public Xcls_EventControllerKey15(Xcls_GtkView _owner )
1156 this.el = new Gtk.EventControllerKey();
1160 // set gobject values
1163 this.el.key_pressed.connect( (keyval, keycode, state) => {
1165 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1166 GLib.debug("SAVE: ctrl-g pressed");
1167 _this.forwardSearch(true);
1172 if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
1173 _this.forwardSearch(true);
1179 // print(event.key.keyval)
1185 // user defined functions
1189 public class Xcls_search_results : Object
1191 public Gtk.Label el;
1192 private Xcls_GtkView _this;
1198 public Xcls_search_results(Xcls_GtkView _owner )
1201 _this.search_results = this;
1202 this.el = new Gtk.Label( "No Results" );
1206 // set gobject values
1207 this.el.margin_end = 4;
1208 this.el.margin_start = 4;
1211 // user defined functions
1212 public void updateResults () {
1213 this.el.visible = true;
1215 var res = _this.searchcontext.get_occurrences_count();
1217 _this.search_results.el.label = "??? Matches";
1221 _this.nextBtn.el.sensitive = false;
1222 _this.backBtn.el.sensitive = false;
1225 _this.search_results.el.label = "%d Matches".printf(res);
1226 _this.nextBtn.el.sensitive = true;
1227 _this.backBtn.el.sensitive = true;
1230 _this.search_results.el.label = "No Matches";
1235 public class Xcls_nextBtn : Object
1237 public Gtk.Button el;
1238 private Xcls_GtkView _this;
1242 public bool always_show_image;
1245 public Xcls_nextBtn(Xcls_GtkView _owner )
1248 _this.nextBtn = this;
1249 this.el = new Gtk.Button();
1252 this.always_show_image = true;
1254 // set gobject values
1255 this.el.icon_name = "go-down";
1256 this.el.sensitive = false;
1259 this.el.clicked.connect( ( ) => {
1260 _this.forwardSearch(true);
1266 // user defined functions
1269 public class Xcls_backBtn : Object
1271 public Gtk.Button el;
1272 private Xcls_GtkView _this;
1276 public bool always_show_image;
1279 public Xcls_backBtn(Xcls_GtkView _owner )
1282 _this.backBtn = this;
1283 this.el = new Gtk.Button();
1286 this.always_show_image = true;
1288 // set gobject values
1289 this.el.icon_name = "go-up";
1290 this.el.sensitive = false;
1293 this.el.clicked.connect( ( ) => {
1295 _this.backSearch(true);
1300 // user defined functions
1303 public class Xcls_MenuButton19 : Object
1305 public Gtk.MenuButton el;
1306 private Xcls_GtkView _this;
1310 public bool always_show_image;
1313 public Xcls_MenuButton19(Xcls_GtkView _owner )
1316 this.el = new Gtk.MenuButton();
1319 this.always_show_image = true;
1321 // set gobject values
1322 this.el.icon_name = "emblem-system";
1323 this.el.always_show_arrow = true;
1324 new Xcls_search_settings( _this );
1325 this.el.popover = _this.search_settings.el;
1328 // user defined functions
1330 public class Xcls_search_settings : Object
1332 public Gtk.PopoverMenu el;
1333 private Xcls_GtkView _this;
1339 public Xcls_search_settings(Xcls_GtkView _owner )
1342 _this.search_settings = this;
1343 this.el = new Gtk.PopoverMenu.from_model(null);
1347 // set gobject values
1348 var child_1 = new Xcls_Box21( _this );
1350 this.el.set_child ( child_1.el );
1353 // user defined functions
1355 public class Xcls_Box21 : Object
1358 private Xcls_GtkView _this;
1364 public Xcls_Box21(Xcls_GtkView _owner )
1367 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1371 // set gobject values
1372 new Xcls_case_sensitive( _this );
1373 this.el.append( _this.case_sensitive.el );
1374 new Xcls_regex( _this );
1375 this.el.append( _this.regex.el );
1376 new Xcls_multiline( _this );
1377 this.el.append( _this.multiline.el );
1380 // user defined functions
1382 public class Xcls_case_sensitive : Object
1384 public Gtk.CheckButton el;
1385 private Xcls_GtkView _this;
1391 public Xcls_case_sensitive(Xcls_GtkView _owner )
1394 _this.case_sensitive = this;
1395 this.el = new Gtk.CheckButton();
1399 // set gobject values
1400 this.el.label = "Case Sensitive";
1403 // user defined functions
1406 public class Xcls_regex : Object
1408 public Gtk.CheckButton el;
1409 private Xcls_GtkView _this;
1415 public Xcls_regex(Xcls_GtkView _owner )
1419 this.el = new Gtk.CheckButton();
1423 // set gobject values
1424 this.el.label = "Regex";
1427 // user defined functions
1430 public class Xcls_multiline : Object
1432 public Gtk.CheckButton el;
1433 private Xcls_GtkView _this;
1439 public Xcls_multiline(Xcls_GtkView _owner )
1442 _this.multiline = this;
1443 this.el = new Gtk.CheckButton();
1447 // set gobject values
1448 this.el.label = "Multi-line (add \\n)";
1451 // user defined functions