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 Xcls_MainWindow main_window;
35 public int last_error_counter;
36 public int last_search_end;
37 public GtkSource.SearchContext searchcontext;
38 public JsRender.JsRender file;
44 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
48 this.last_error_counter = 0;
49 this.last_search_end = 0;
53 this.el.hexpand = true;
54 this.el.vexpand = true;
55 new Xcls_notebook( _this );
56 this.el.append( _this.notebook.el );
59 // user defined functions
60 public void loadFile (JsRender.JsRender file)
64 if (file.tree == null) {
67 this.last_error_counter = -1;
68 this.notebook.el.page = 0;// gtk preview
73 this.sourceview.loadFile();
75 this.searchcontext = null;
76 this.last_error_counter = -1;
77 this.updateErrorMarks();
78 if (this.lastObj != null) {
79 this.container.el.remove(this.lastObj);
82 // hide the compile view at present..
85 var w = this.el.get_width();
86 var h = this.el.get_height();
88 print("ALLOC SET SIZES %d, %d\n", w,h);
90 // set the container size min to 500/500 or 20 px less than max..
91 w = int.max (w-20, 500);
92 h = int.max (h-20, 500);
94 print("SET SIZES %d, %d\n", w,h);
95 _this.container.el.set_size_request(w,h);
97 _this.view_layout.el.set_size_request(w,h);
98 // should be baded on calc.. -- see update_scrolled.
100 var fc = this.container.el.get_first_child();
102 this.container.el.remove(fc);
105 var xmlstr = JsRender.NodeToGlade.mungeFile( file);
106 var builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);
107 var obj = (Gtk.Widget) builder.get_object("w"+ file.tree.oid.to_string());
108 this.container.el.append(obj);
116 public void highlightNodeAtLine (int ln) {
118 // this is done from clicking on the editor..
123 var node = _this.file.lineToNode(ln+1);
126 //print("can not find node\n");
129 var prop = node.lineToProp(ln+1);
130 print("prop : %s", prop == null ? "???" : prop.name);
133 // ---------- this selects the tree's node...
135 var ltree = _this.main_window.windowstate.left_tree;
136 ltree.model.selectNode(node);
137 //var tp = ltree.model.treePathFromNode(node);
139 //print("got tree path %s\n", tp);
143 //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
146 //print("changing cursor on tree..\n");
150 // let's try allowing editing on the methods.
151 // a little klunky at present..
152 _this.sourceview.prop_selected = "";
155 //see if we can find it..
156 var kv = prop.split(":");
159 //var k = prop.get_key(kv[1]);
160 // fixme -- need to determine if it's an editable property...
161 _this.sourceview.prop_selected = prop;
163 } else if (kv[0] == "l") {
164 _this.sourceview.prop_selected = prop;
169 //ltree.view.setCursor(tp, "editor");
170 // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
171 _this.sourceview.nodeSelected(node,false);
173 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
174 // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
175 // this.allow_node_scroll = true;
191 public void forwardSearch (bool change_focus) {
193 if (this.searchcontext == null) {
196 this.notebook.el.page = 1;
197 Gtk.TextIter beg, st,en;
198 bool has_wrapped_around;
199 var buf = this.sourceview.el.get_buffer();
200 buf.get_iter_at_offset(out beg, this.last_search_end);
201 if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
202 this.last_search_end = 0;
205 this.last_search_end = en.get_offset();
207 this.sourceview.el.grab_focus();
209 buf.place_cursor(st);
213 this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
216 var ln = st.get_line();
218 this.highlightNodeAtLine(ln);
220 public void backSearch (bool change_focus) {
222 if (this.searchcontext == null) {
226 Gtk.TextIter beg, st,en;
227 bool has_wrapped_around;
228 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
230 if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
232 this.last_search_end = 0;
235 this.last_search_end = en.get_offset();
237 this.sourceview.el.grab_focus();
239 this.buffer.el.place_cursor(st);
240 this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
241 var ln = st.get_line();
242 this.highlightNodeAtLine(ln);
245 public int search (string in_txt) {
246 this.notebook.el.page = 1;
250 var s = new GtkSource.SearchSettings();
251 s.case_sensitive = _this.case_sensitive.el.active;
252 s.regex_enabled = _this.regex.el.active;
253 s.wrap_around = false;
255 this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
256 this.searchcontext.set_highlight(true);
259 if (_this.multiline.el.active) {
260 txt = in_txt.replace("\\n", "\n");
263 s.set_search_text(txt);
264 Gtk.TextIter beg, st,en;
265 bool has_wrapped_around;
266 this.buffer.el.get_start_iter(out beg);
267 this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
268 this.last_search_end = 0;
270 return this.searchcontext.get_occurrences_count();
276 public void createThumb () {
279 if (this.file == null) {
282 // only screenshot the gtk preview..
283 if (this.notebook.el.page > 0 ) {
288 this.file.widgetToIcon(this.container.el);
297 // should we hold until it's printed...
303 public void updateErrorMarks () {
307 var buf = _this.buffer.el;
310 buf.get_bounds (out start, out end);
314 GLib.debug("highlight errors");
316 // we should highlight other types of errors..
321 if (_this.file == null) {
322 GLib.debug("file is null?");
326 var ar = this.file.getErrors();
328 buf.remove_tag_by_name ("ERR", start, end);
329 buf.remove_tag_by_name ("WARN", start, end);
330 buf.remove_tag_by_name ("DEPR", start, end);
331 buf.remove_source_marks (start, end, "ERR");
332 buf.remove_source_marks (start, end, "WARN");
333 buf.remove_source_marks (start, end, "DEPR");
334 this.last_error_counter = file.error_counter ;
335 GLib.debug("higjlight has no errors");
338 if (this.last_error_counter == file.error_counter) {
346 var tlines = buf.get_line_count () +1;
350 buf.remove_source_marks (start, end, "ERR");
351 buf.remove_source_marks (start, end, "WARN");
352 buf.remove_source_marks (start, end, "DEPR");
353 buf.remove_tag_by_name ("ERR", start, end);
354 buf.remove_tag_by_name ("WARN", start, end);
355 buf.remove_tag_by_name ("DEPR", start, end);
356 foreach(var diag in ar) {
360 // print("get inter\n");
361 var eline = (int)diag.range.start.line ;
362 var eline_to = (int)diag.range.end.line;
363 if (eline > tlines || eline < 0) {
368 buf.get_iter_at_line( out iter, eline);
370 buf.get_iter_at_line_offset( out start,
371 eline, (int)diag.range.start.character);
372 buf.get_iter_at_line_offset( out end,
373 eline_to, (int)diag.range.end.character);
375 buf.apply_tag_by_name(diag.category, start, end);
378 var msg = "Line: %d %s : %s".printf(eline+1, diag.category, diag.message);
379 buf.create_source_mark( msg, diag.category, iter);
380 GLib.debug("set line %d to %s", eline, msg);
381 //this.marks.set(eline, msg);
383 this.last_error_counter = file.error_counter ;
390 public void scroll_to_line (int line) {
393 GLib.Timeout.add(100, () => {
396 this.notebook.el.set_current_page(1);
398 var buf = this.sourceview.el.get_buffer();
400 var sbuf = (GtkSource.Buffer) buf;
404 sbuf.get_iter_at_line(out iter, line);
405 this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
411 public class Xcls_notebook : Object
413 public Gtk.Notebook el;
414 private Xcls_GtkView _this;
420 public Xcls_notebook(Xcls_GtkView _owner )
423 _this.notebook = this;
424 this.el = new Gtk.Notebook();
428 // set gobject values
429 this.el.overflow = Gtk.Overflow.VISIBLE;
430 new Xcls_label_preview( _this );
431 new Xcls_label_code( _this );
432 var child_3 = new Xcls_ScrolledWindow4( _this );
434 this.el.append_page ( child_3.el , _this.label_preview.el );
435 var child_4 = new Xcls_Box7( _this );
437 this.el.append_page ( child_4.el , _this.label_code.el );
440 // user defined functions
442 public class Xcls_label_preview : Object
445 private Xcls_GtkView _this;
451 public Xcls_label_preview(Xcls_GtkView _owner )
454 _this.label_preview = this;
455 this.el = new Gtk.Label( "Preview" );
459 // set gobject values
462 // user defined functions
465 public class Xcls_label_code : Object
468 private Xcls_GtkView _this;
474 public Xcls_label_code(Xcls_GtkView _owner )
477 _this.label_code = this;
478 this.el = new Gtk.Label( "Preview Generated Code" );
482 // set gobject values
485 // user defined functions
488 public class Xcls_ScrolledWindow4 : Object
490 public Gtk.ScrolledWindow el;
491 private Xcls_GtkView _this;
497 public Xcls_ScrolledWindow4(Xcls_GtkView _owner )
500 this.el = new Gtk.ScrolledWindow();
504 // set gobject values
505 new Xcls_view_layout( _this );
506 this.el.set_child ( _this.view_layout.el );
509 // user defined functions
511 public class Xcls_view_layout : Object
514 private Xcls_GtkView _this;
520 public Xcls_view_layout(Xcls_GtkView _owner )
523 _this.view_layout = this;
524 this.el = new Gtk.Fixed();
528 // set gobject values
529 this.el.name = "gtkview-view-layout";
530 new Xcls_container( _this );
531 this.el.put ( _this.container.el , 10,10 );
534 // user defined functions
536 public class Xcls_container : Object
539 private Xcls_GtkView _this;
545 public Xcls_container(Xcls_GtkView _owner )
548 _this.container = this;
549 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
553 // set gobject values
556 // user defined functions
561 public class Xcls_Box7 : Object
564 private Xcls_GtkView _this;
570 public Xcls_Box7(Xcls_GtkView _owner )
573 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
577 // set gobject values
578 new Xcls_sourceviewscroll( _this );
579 this.el.append( _this.sourceviewscroll.el );
580 var child_2 = new Xcls_Box12( _this );
582 this.el.append( child_2.el );
585 // user defined functions
587 public class Xcls_sourceviewscroll : Object
589 public Gtk.ScrolledWindow el;
590 private Xcls_GtkView _this;
596 public Xcls_sourceviewscroll(Xcls_GtkView _owner )
599 _this.sourceviewscroll = this;
600 this.el = new Gtk.ScrolledWindow();
604 // set gobject values
605 this.el.vexpand = true;
606 new Xcls_sourceview( _this );
607 this.el.set_child ( _this.sourceview.el );
610 // user defined functions
612 public class Xcls_sourceview : Object
614 public GtkSource.View el;
615 private Xcls_GtkView _this;
620 public string prop_selected;
621 public JsRender.Node? node_selected;
624 public Xcls_sourceview(Xcls_GtkView _owner )
627 _this.sourceview = this;
628 this.el = new GtkSource.View();
631 this.loading = false;
632 this.prop_selected = "";
634 // set gobject values
635 this.el.name = "gtkview-view";
636 this.el.editable = false;
637 this.el.show_line_marks = true;
638 this.el.show_line_numbers = true;
639 this.el.css_classes = { "code-editor" };
640 this.el.tab_width = 4;
641 new Xcls_buffer( _this );
642 this.el.set_buffer ( _this.buffer.el );
643 var child_2 = new Xcls_EventControllerKey11( _this );
645 this.el.add_controller( child_2.el );
655 var attrs = new GtkSource.MarkAttributes();
656 attrs.set_icon_name ( "process-stop");
657 attrs.query_tooltip_text.connect(( mark) => {
658 //print("tooltip query? %s\n", mark.name);
662 this.el.set_mark_attributes ("ERR", attrs, 1);
664 var wattrs = new GtkSource.MarkAttributes();
665 wattrs.set_icon_name ( "process-stop");
666 wattrs.query_tooltip_text.connect(( mark) => {
667 //print("tooltip query? %s\n", mark.name);
671 this.el.set_mark_attributes ("WARN", wattrs, 1);
675 var dattrs = new GtkSource.MarkAttributes();
676 dattrs.set_icon_name ( "process-stop");
677 dattrs.query_tooltip_text.connect(( mark) => {
678 //print("tooltip query? %s\n", mark.name);
682 this.el.set_mark_attributes ("DEPR", dattrs, 1);
685 var gattrs = new GtkSource.MarkAttributes();
686 var grey = Gdk.RGBA();
687 grey.parse ( "#ccc");
688 gattrs.set_background ( grey);
691 this.el.set_mark_attributes ("grey", gattrs, 1);
701 this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
703 //GLib.debug("query tooltip");
707 var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
709 this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
711 var l = iter.get_line();
712 // GLib.debug("query tooltip line %d", (int) l);
713 var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
714 if (marks.is_empty()) {
715 marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
717 if (marks.is_empty()) {
718 marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
721 // GLib.debug("query tooltip line marks %d", (int) marks.length());
723 marks.@foreach((m) => {
724 //GLib.debug("got mark %s", m.name);
725 str += (str.length > 0 ? "\n" : "") + m.name;
728 // true if there is a mark..
729 tooltip.set_text( str);
730 return str.length > 0 ? true : false;
735 // user defined functions
736 public void loadFile ( ) {
738 var buf = this.el.get_buffer();
740 var sbuf = (GtkSource.Buffer) buf;
741 var cpos = buf.cursor_position;
743 print("BEFORE LOAD cursor = %d\n", cpos);
744 var vadj_pos = this.el.get_vadjustment().get_value();
746 if (_this.file == null || _this.file.xtype != "Gtk") {
747 print("xtype != Gtk");
748 this.loading = false;
754 var regex = new Regex("\\.bjs$");
757 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
758 } catch (GLib.RegexError e) {
759 this.loading = false;
764 if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
765 print("File path has no errors\n");
766 this.loading = false;
773 GLib.FileUtils.get_contents (valafn, out str);
775 this.loading = false;
779 var str = _this.file.toSource();
781 // print("setting str %d\n", str.length);
782 buf.set_text(str, str.length);
783 var lm = GtkSource.LanguageManager.get_default();
785 //?? is javascript going to work as js?
787 ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
790 _this.main_window.windowstate.updateErrorMarksAll();
791 // restore the cursor position?
792 // after reloading the contents.
793 GLib.Timeout.add(500, () => {
794 _this.buffer.in_cursor_change = true;
795 print("RESORTING cursor to = %d\n", cpos);
796 Gtk.TextIter cpos_iter;
797 buf.get_iter_at_offset(out cpos_iter, cpos);
798 buf.place_cursor(cpos_iter);
800 this.el.get_vadjustment().set_value(vadj_pos);;
801 _this.buffer.in_cursor_change = false;
805 //_this.buffer.checkSyntax();
810 this.loading = false;
812 public void nodeSelected (JsRender.Node? sel, bool scroll) {
818 // this is connected in widnowstate
819 print("Roo-view - node selected\n");
820 var buf = this.el.get_buffer();
822 var sbuf = (GtkSource.Buffer) buf;
828 // clear all the marks..
832 sbuf.get_bounds (out start, out end);
833 sbuf.remove_source_marks (start, end, "grey");
835 this.node_selected = sel;
841 sbuf.get_iter_at_line(out iter, sel.line_start);
844 Gtk.TextIter cur_iter;
845 sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
848 if (!_this.buffer.in_cursor_change) {
850 this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
855 for (var i = 0; i < buf.get_line_count();i++) {
856 if (i < sel.line_start || i > sel.line_end) {
858 sbuf.get_iter_at_line(out iter, i);
859 sbuf.create_source_mark(null, "grey", iter);
867 public string toString () {
870 this.el.get_buffer().get_start_iter(out s);
871 this.el.get_buffer().get_end_iter(out e);
872 var ret = this.el.get_buffer().get_text(s,e,true);
873 //print("TO STRING? " + ret);
877 public class Xcls_buffer : Object
879 public GtkSource.Buffer el;
880 private Xcls_GtkView _this;
884 public int error_line;
885 public bool in_cursor_change;
887 public int last_line;
890 public Xcls_buffer(Xcls_GtkView _owner )
894 this.el = new GtkSource.Buffer( null );
897 this.error_line = -1;
898 this.in_cursor_change = false;
902 // set gobject values
907 buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
908 buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
909 buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
910 buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
911 buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
912 buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
913 buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
914 buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
917 buf.create_tag ("ERR", "weight", Pango.Weight.BOLD, "background", "pink");
918 buf.create_tag ("WARN", "weight", Pango.Weight.BOLD, "background", "#ABF4EB");
919 buf.create_tag ("DEPR", "weight", Pango.Weight.BOLD, "background", "#EEA9FF");
922 this.el.cursor_moved.connect( ( ) => {
923 GLib.debug("cursor moved called");
926 if (this.in_cursor_change ) {
927 GLib.debug("cursor changed : %d [ignoring nested call)", this.el.cursor_position);
931 GLib.debug("cursor changed : %d", this.el.cursor_position);
933 this.el.get_iter_at_offset(out cpos, this.el.cursor_position);
935 var ln = cpos.get_line();
936 if (this.last_line == ln ){
940 var node = _this.file.lineToNode(ln);
943 print("can not find node\n");
946 this.in_cursor_change = true;
947 var ltree = _this.main_window.windowstate.left_tree;
948 ltree.model.selectNode(node);
949 this.in_cursor_change = false;
953 // user defined functions
956 public class Xcls_EventControllerKey11 : Object
958 public Gtk.EventControllerKey el;
959 private Xcls_GtkView _this;
965 public Xcls_EventControllerKey11(Xcls_GtkView _owner )
968 this.el = new Gtk.EventControllerKey();
972 // set gobject values
975 this.el.key_pressed.connect( (keyval, keycode, state) => {
979 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
980 GLib.debug("SAVE: ctrl-g pressed");
981 _this.forwardSearch(true);
984 if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
985 GLib.debug("SAVE: ctrl-f pressed");
986 _this.search_entry.el.grab_focus();
994 // user defined functions
999 public class Xcls_Box12 : Object
1002 private Xcls_GtkView _this;
1008 public Xcls_Box12(Xcls_GtkView _owner )
1011 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1015 // set gobject values
1016 this.el.homogeneous = false;
1017 this.el.vexpand = false;
1018 new Xcls_search_entry( _this );
1019 this.el.append( _this.search_entry.el );
1020 new Xcls_search_results( _this );
1021 this.el.append( _this.search_results.el );
1022 new Xcls_nextBtn( _this );
1023 this.el.append( _this.nextBtn.el );
1024 new Xcls_backBtn( _this );
1025 this.el.append( _this.backBtn.el );
1026 var child_5 = new Xcls_MenuButton18( _this );
1028 this.el.append( child_5.el );
1031 // user defined functions
1033 public class Xcls_search_entry : Object
1035 public Gtk.SearchEntry el;
1036 private Xcls_GtkView _this;
1040 public Gtk.CssProvider css;
1043 public Xcls_search_entry(Xcls_GtkView _owner )
1046 _this.search_entry = this;
1047 this.el = new Gtk.SearchEntry();
1051 // set gobject values
1052 this.el.name = "gtkview-search-entry";
1053 this.el.hexpand = true;
1054 this.el.placeholder_text = "Press enter to search";
1055 this.el.search_delay = 3;
1056 var child_1 = new Xcls_EventControllerKey14( _this );
1058 this.el.add_controller( child_1.el );
1061 this.el.search_changed.connect( () => {
1063 _this.search(_this.search_entry.el.text);
1064 _this.search_results.updateResults();
1066 GLib.Timeout.add_seconds(1,() => {
1067 _this.search_results.updateResults();
1076 // user defined functions
1077 public void forwardSearch (bool change_focus) {
1080 _this.forwardSearch(change_focus);
1084 switch(_this.windowstate.state) {
1085 case WindowState.State.CODEONLY:
1086 //case WindowState.State.CODE:
1087 // search the code being edited..
1088 _this.windowstate.code_editor_tab.forwardSearch(change_focus);
1091 case WindowState.State.PREVIEW:
1092 if (_this.windowstate.file.xtype == "Gtk") {
1093 _this.windowstate.window_gladeview.forwardSearch(change_focus);
1095 _this.windowstate.window_rooview.forwardSearch(change_focus);
1104 public class Xcls_EventControllerKey14 : Object
1106 public Gtk.EventControllerKey el;
1107 private Xcls_GtkView _this;
1113 public Xcls_EventControllerKey14(Xcls_GtkView _owner )
1116 this.el = new Gtk.EventControllerKey();
1120 // set gobject values
1123 this.el.key_pressed.connect( (keyval, keycode, state) => {
1125 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1126 GLib.debug("SAVE: ctrl-g pressed");
1127 _this.forwardSearch(true);
1132 if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
1133 _this.forwardSearch(true);
1139 // print(event.key.keyval)
1145 // user defined functions
1149 public class Xcls_search_results : Object
1151 public Gtk.Label el;
1152 private Xcls_GtkView _this;
1158 public Xcls_search_results(Xcls_GtkView _owner )
1161 _this.search_results = this;
1162 this.el = new Gtk.Label( "No Results" );
1166 // set gobject values
1167 this.el.margin_end = 4;
1168 this.el.margin_start = 4;
1171 // user defined functions
1172 public void updateResults () {
1173 this.el.visible = true;
1175 var res = _this.searchcontext.get_occurrences_count();
1177 _this.search_results.el.label = "??? Matches";
1181 _this.nextBtn.el.sensitive = false;
1182 _this.backBtn.el.sensitive = false;
1185 _this.search_results.el.label = "%d Matches".printf(res);
1186 _this.nextBtn.el.sensitive = true;
1187 _this.backBtn.el.sensitive = true;
1190 _this.search_results.el.label = "No Matches";
1195 public class Xcls_nextBtn : Object
1197 public Gtk.Button el;
1198 private Xcls_GtkView _this;
1202 public bool always_show_image;
1205 public Xcls_nextBtn(Xcls_GtkView _owner )
1208 _this.nextBtn = this;
1209 this.el = new Gtk.Button();
1212 this.always_show_image = true;
1214 // set gobject values
1215 this.el.icon_name = "go-down";
1216 this.el.sensitive = false;
1219 this.el.clicked.connect( ( ) => {
1220 _this.forwardSearch(true);
1226 // user defined functions
1229 public class Xcls_backBtn : Object
1231 public Gtk.Button el;
1232 private Xcls_GtkView _this;
1236 public bool always_show_image;
1239 public Xcls_backBtn(Xcls_GtkView _owner )
1242 _this.backBtn = this;
1243 this.el = new Gtk.Button();
1246 this.always_show_image = true;
1248 // set gobject values
1249 this.el.icon_name = "go-up";
1250 this.el.sensitive = false;
1253 this.el.clicked.connect( ( ) => {
1255 _this.backSearch(true);
1260 // user defined functions
1263 public class Xcls_MenuButton18 : Object
1265 public Gtk.MenuButton el;
1266 private Xcls_GtkView _this;
1270 public bool always_show_image;
1273 public Xcls_MenuButton18(Xcls_GtkView _owner )
1276 this.el = new Gtk.MenuButton();
1279 this.always_show_image = true;
1281 // set gobject values
1282 this.el.icon_name = "emblem-system";
1283 this.el.always_show_arrow = true;
1284 new Xcls_search_settings( _this );
1285 this.el.popover = _this.search_settings.el;
1288 // user defined functions
1290 public class Xcls_search_settings : Object
1292 public Gtk.PopoverMenu el;
1293 private Xcls_GtkView _this;
1299 public Xcls_search_settings(Xcls_GtkView _owner )
1302 _this.search_settings = this;
1303 this.el = new Gtk.PopoverMenu.from_model(null);
1307 // set gobject values
1308 var child_1 = new Xcls_Box20( _this );
1310 this.el.set_child ( child_1.el );
1313 // user defined functions
1315 public class Xcls_Box20 : Object
1318 private Xcls_GtkView _this;
1324 public Xcls_Box20(Xcls_GtkView _owner )
1327 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1331 // set gobject values
1332 new Xcls_case_sensitive( _this );
1333 this.el.append( _this.case_sensitive.el );
1334 new Xcls_regex( _this );
1335 this.el.append( _this.regex.el );
1336 new Xcls_multiline( _this );
1337 this.el.append( _this.multiline.el );
1340 // user defined functions
1342 public class Xcls_case_sensitive : Object
1344 public Gtk.CheckButton el;
1345 private Xcls_GtkView _this;
1351 public Xcls_case_sensitive(Xcls_GtkView _owner )
1354 _this.case_sensitive = this;
1355 this.el = new Gtk.CheckButton();
1359 // set gobject values
1360 this.el.label = "Case Sensitive";
1363 // user defined functions
1366 public class Xcls_regex : Object
1368 public Gtk.CheckButton el;
1369 private Xcls_GtkView _this;
1375 public Xcls_regex(Xcls_GtkView _owner )
1379 this.el = new Gtk.CheckButton();
1383 // set gobject values
1384 this.el.label = "Regex";
1387 // user defined functions
1390 public class Xcls_multiline : Object
1392 public Gtk.CheckButton el;
1393 private Xcls_GtkView _this;
1399 public Xcls_multiline(Xcls_GtkView _owner )
1402 _this.multiline = this;
1403 this.el = new Gtk.CheckButton();
1407 // set gobject values
1408 this.el.label = "Multi-line (add \\n)";
1411 // user defined functions