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_keystate keystate;
24 public Xcls_search_entry search_entry;
25 public Xcls_search_results search_results;
26 public Xcls_nextBtn nextBtn;
27 public Xcls_backBtn backBtn;
28 public Xcls_search_settings search_settings;
29 public Xcls_case_sensitive case_sensitive;
30 public Xcls_regex regex;
31 public Xcls_multiline multiline;
34 public Gtk.Widget lastObj;
35 public Xcls_MainWindow main_window;
36 public int last_error_counter;
37 public int last_search_end;
38 public GtkSource.SearchContext searchcontext;
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 );
60 // user defined functions
61 public void loadFile (JsRender.JsRender file)
65 if (file.tree == null) {
68 this.last_error_counter = -1;
69 this.notebook.el.page = 0;// gtk preview
74 this.sourceview.loadFile();
76 this.searchcontext = null;
77 this.last_error_counter = -1;
78 this.updateErrorMarks();
79 if (this.lastObj != null) {
80 this.container.el.remove(this.lastObj);
83 // hide the compile view at present..
86 var w = this.el.get_width();
87 var h = this.el.get_height();
89 print("ALLOC SET SIZES %d, %d\n", w,h);
91 // set the container size min to 500/500 or 20 px less than max..
92 w = int.max (w-20, 500);
93 h = int.max (h-20, 500);
95 print("SET SIZES %d, %d\n", w,h);
96 _this.container.el.set_size_request(w,h);
98 _this.view_layout.el.set_size_request(w,h);
99 // should be baded on calc.. -- see update_scrolled.
101 var fc = this.container.el.get_first_child();
103 this.container.el.remove(fc);
106 var xmlstr = JsRender.NodeToGlade.mungeFile( file);
107 var builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);
108 var obj = (Gtk.Widget) builder.get_object("w"+ file.tree.oid.to_string());
109 this.container.el.append(obj);
117 public void highlightNodeAtLine (int ln) {
119 // this is done from clicking on the editor..
124 var node = _this.file.lineToNode(ln+1);
127 //print("can not find node\n");
130 var prop = node.lineToProp(ln+1);
131 print("prop : %s", prop == null ? "???" : prop.name);
134 // ---------- this selects the tree's node...
136 var ltree = _this.main_window.windowstate.left_tree;
137 ltree.model.selectNode(node);
138 //var tp = ltree.model.treePathFromNode(node);
140 //print("got tree path %s\n", tp);
144 //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
147 //print("changing cursor on tree..\n");
151 // let's try allowing editing on the methods.
152 // a little klunky at present..
153 _this.sourceview.prop_selected = "";
156 //see if we can find it..
157 var kv = prop.split(":");
160 //var k = prop.get_key(kv[1]);
161 // fixme -- need to determine if it's an editable property...
162 _this.sourceview.prop_selected = prop;
164 } else if (kv[0] == "l") {
165 _this.sourceview.prop_selected = prop;
170 //ltree.view.setCursor(tp, "editor");
171 // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
172 _this.sourceview.nodeSelected(node,false);
174 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
175 // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
176 // this.allow_node_scroll = true;
192 public void forwardSearch (bool change_focus) {
194 if (this.searchcontext == null) {
197 this.notebook.el.page = 1;
198 Gtk.TextIter beg, st,en;
199 bool has_wrapped_around;
200 var buf = this.sourceview.el.get_buffer();
201 buf.get_iter_at_offset(out beg, this.last_search_end);
202 if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
203 this.last_search_end = 0;
206 this.last_search_end = en.get_offset();
208 this.sourceview.el.grab_focus();
210 buf.place_cursor(st);
214 this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
217 var ln = st.get_line();
219 this.highlightNodeAtLine(ln);
221 public void backSearch (bool change_focus) {
223 if (this.searchcontext == null) {
227 Gtk.TextIter beg, st,en;
228 bool has_wrapped_around;
229 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
231 if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
233 this.last_search_end = 0;
236 this.last_search_end = en.get_offset();
238 this.sourceview.el.grab_focus();
240 this.buffer.el.place_cursor(st);
241 this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
242 var ln = st.get_line();
243 this.highlightNodeAtLine(ln);
246 public int search (string in_txt) {
247 this.notebook.el.page = 1;
251 var s = new GtkSource.SearchSettings();
252 s.case_sensitive = _this.case_sensitive.el.active;
253 s.regex_enabled = _this.regex.el.active;
254 s.wrap_around = false;
256 this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
257 this.searchcontext.set_highlight(true);
260 if (_this.multiline.el.active) {
261 txt = in_txt.replace("\\n", "\n");
264 s.set_search_text(txt);
265 Gtk.TextIter beg, st,en;
266 bool has_wrapped_around;
267 this.buffer.el.get_start_iter(out beg);
268 this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
269 this.last_search_end = 0;
271 return this.searchcontext.get_occurrences_count();
277 public void createThumb () {
280 if (this.file == null) {
283 // only screenshot the gtk preview..
284 if (this.notebook.el.page > 0 ) {
289 this.file.widgetToIcon(this.container.el);
298 // should we hold until it's printed...
304 public void updateErrorMarks () {
308 var buf = _this.buffer.el;
311 buf.get_bounds (out start, out end);
315 //GLib.debug("highlight errors");
317 // we should highlight other types of errors..
322 if (_this.file == null) {
323 GLib.debug("file is null?");
327 var ar = this.file.getErrors();
329 buf.remove_tag_by_name ("ERR", start, end);
330 buf.remove_tag_by_name ("WARN", start, end);
331 buf.remove_tag_by_name ("DEPR", start, end);
332 buf.remove_source_marks (start, end, "ERR");
333 buf.remove_source_marks (start, end, "WARN");
334 buf.remove_source_marks (start, end, "DEPR");
335 this.last_error_counter = file.error_counter ;
336 //GLib.debug("higjlight has no errors");
339 if (this.last_error_counter == file.error_counter) {
347 var tlines = buf.get_line_count () +1;
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 buf.remove_tag_by_name ("ERR", start, end);
355 buf.remove_tag_by_name ("WARN", start, end);
356 buf.remove_tag_by_name ("DEPR", start, end);
357 foreach(var diag in ar) {
361 // print("get inter\n");
362 var eline = (int)diag.range.start.line ;
363 var eline_to = (int)diag.range.end.line;
364 if (eline > tlines || eline < 0) {
369 buf.get_iter_at_line( out iter, eline);
371 buf.get_iter_at_line_offset( out start,
372 eline, (int)diag.range.start.character);
373 buf.get_iter_at_line_offset( out end,
374 eline_to, (int)diag.range.end.character);
376 buf.apply_tag_by_name(diag.category, start, end);
379 var msg = "Line: %d %s : %s".printf(eline+1, diag.category, diag.message);
380 buf.create_source_mark( msg, diag.category, iter);
381 GLib.debug("set line %d to %s", eline, msg);
382 //this.marks.set(eline, msg);
384 this.last_error_counter = file.error_counter ;
391 public void scroll_to_line (int line) {
394 GLib.Timeout.add(100, () => {
397 this.notebook.el.set_current_page(1);
399 var buf = this.sourceview.el.get_buffer();
401 var sbuf = (GtkSource.Buffer) buf;
405 sbuf.get_iter_at_line(out iter, line);
406 this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
412 public class Xcls_notebook : Object
414 public Gtk.Notebook el;
415 private Xcls_GtkView _this;
421 public Xcls_notebook(Xcls_GtkView _owner )
424 _this.notebook = this;
425 this.el = new Gtk.Notebook();
429 // set gobject values
430 this.el.overflow = Gtk.Overflow.VISIBLE;
431 new Xcls_label_preview( _this );
432 new Xcls_label_code( _this );
433 var child_3 = new Xcls_ScrolledWindow4( _this );
435 this.el.append_page ( child_3.el , _this.label_preview.el );
436 var child_4 = new Xcls_Box7( _this );
438 this.el.append_page ( child_4.el , _this.label_code.el );
441 // user defined functions
443 public class Xcls_label_preview : Object
446 private Xcls_GtkView _this;
452 public Xcls_label_preview(Xcls_GtkView _owner )
455 _this.label_preview = this;
456 this.el = new Gtk.Label( "Preview" );
460 // set gobject values
463 // user defined functions
466 public class Xcls_label_code : Object
469 private Xcls_GtkView _this;
475 public Xcls_label_code(Xcls_GtkView _owner )
478 _this.label_code = this;
479 this.el = new Gtk.Label( "Preview Generated Code" );
483 // set gobject values
486 // user defined functions
489 public class Xcls_ScrolledWindow4 : Object
491 public Gtk.ScrolledWindow el;
492 private Xcls_GtkView _this;
498 public Xcls_ScrolledWindow4(Xcls_GtkView _owner )
501 this.el = new Gtk.ScrolledWindow();
505 // set gobject values
506 new Xcls_view_layout( _this );
507 this.el.set_child ( _this.view_layout.el );
510 // user defined functions
512 public class Xcls_view_layout : Object
515 private Xcls_GtkView _this;
521 public Xcls_view_layout(Xcls_GtkView _owner )
524 _this.view_layout = this;
525 this.el = new Gtk.Fixed();
529 // set gobject values
530 this.el.name = "gtkview-view-layout";
531 new Xcls_container( _this );
532 this.el.put ( _this.container.el , 10,10 );
535 // user defined functions
537 public class Xcls_container : Object
540 private Xcls_GtkView _this;
546 public Xcls_container(Xcls_GtkView _owner )
549 _this.container = this;
550 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
554 // set gobject values
557 // user defined functions
562 public class Xcls_Box7 : Object
565 private Xcls_GtkView _this;
571 public Xcls_Box7(Xcls_GtkView _owner )
574 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
578 // set gobject values
579 new Xcls_sourceviewscroll( _this );
580 this.el.append( _this.sourceviewscroll.el );
581 var child_2 = new Xcls_Box12( _this );
583 this.el.append( child_2.el );
586 // user defined functions
588 public class Xcls_sourceviewscroll : Object
590 public Gtk.ScrolledWindow el;
591 private Xcls_GtkView _this;
597 public Xcls_sourceviewscroll(Xcls_GtkView _owner )
600 _this.sourceviewscroll = this;
601 this.el = new Gtk.ScrolledWindow();
605 // set gobject values
606 this.el.vexpand = true;
607 new Xcls_sourceview( _this );
608 this.el.set_child ( _this.sourceview.el );
611 // user defined functions
613 public class Xcls_sourceview : Object
615 public GtkSource.View el;
616 private Xcls_GtkView _this;
621 public string prop_selected;
622 public JsRender.Node? node_selected;
625 public Xcls_sourceview(Xcls_GtkView _owner )
628 _this.sourceview = this;
629 this.el = new GtkSource.View();
632 this.loading = false;
633 this.prop_selected = "";
635 // set gobject values
636 this.el.name = "gtkview-view";
637 this.el.editable = false;
638 this.el.show_line_marks = true;
639 this.el.show_line_numbers = true;
640 this.el.css_classes = { "code-editor" };
641 this.el.tab_width = 4;
642 new Xcls_buffer( _this );
643 this.el.set_buffer ( _this.buffer.el );
644 new Xcls_keystate( _this );
645 this.el.add_controller( _this.keystate.el );
646 var child_3 = new Xcls_EventControllerScroll37( _this );
648 this.el.add_controller( child_3.el );
658 var attrs = new GtkSource.MarkAttributes();
659 attrs.set_icon_name ( "process-stop");
660 attrs.query_tooltip_text.connect(( mark) => {
661 //print("tooltip query? %s\n", mark.name);
665 this.el.set_mark_attributes ("ERR", attrs, 1);
667 var wattrs = new GtkSource.MarkAttributes();
668 wattrs.set_icon_name ( "process-stop");
669 wattrs.query_tooltip_text.connect(( mark) => {
670 //print("tooltip query? %s\n", mark.name);
674 this.el.set_mark_attributes ("WARN", wattrs, 1);
678 var dattrs = new GtkSource.MarkAttributes();
679 dattrs.set_icon_name ( "process-stop");
680 dattrs.query_tooltip_text.connect(( mark) => {
681 //print("tooltip query? %s\n", mark.name);
685 this.el.set_mark_attributes ("DEPR", dattrs, 1);
688 var gattrs = new GtkSource.MarkAttributes();
689 var grey = Gdk.RGBA();
690 grey.parse ( "#ccc");
691 gattrs.set_background ( grey);
694 this.el.set_mark_attributes ("grey", gattrs, 1);
704 this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
706 //GLib.debug("query tooltip");
710 var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
712 this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
714 var l = iter.get_line();
715 // GLib.debug("query tooltip line %d", (int) l);
716 var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
717 if (marks.is_empty()) {
718 marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
720 if (marks.is_empty()) {
721 marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
724 // GLib.debug("query tooltip line marks %d", (int) marks.length());
726 marks.@foreach((m) => {
727 //GLib.debug("got mark %s", m.name);
728 str += (str.length > 0 ? "\n" : "") + m.name;
731 // true if there is a mark..
732 tooltip.set_text( str);
733 return str.length > 0 ? true : false;
738 // user defined functions
739 public void loadFile ( ) {
741 var buf = this.el.get_buffer();
744 var cpos = buf.cursor_position;
746 print("BEFORE LOAD cursor = %d\n", cpos);
747 var vadj_pos = this.el.get_vadjustment().get_value();
749 if (_this.file == null || _this.file.xtype != "Gtk") {
750 print("xtype != Gtk");
751 this.loading = false;
757 var regex = new Regex("\\.bjs$");
760 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
761 } catch (GLib.RegexError e) {
762 this.loading = false;
767 if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
768 print("File path has no errors\n");
769 this.loading = false;
776 GLib.FileUtils.get_contents (valafn, out str);
778 this.loading = false;
782 var str = _this.file.toSource();
784 // print("setting str %d\n", str.length);
785 buf.set_text(str, str.length);
786 var lm = GtkSource.LanguageManager.get_default();
788 //?? is javascript going to work as js?
790 ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
793 _this.main_window.windowstate.updateErrorMarksAll();
794 // restore the cursor position?
795 // after reloading the contents.
796 GLib.Timeout.add(500, () => {
797 _this.buffer.in_cursor_change = true;
798 print("RESORTING cursor to = %d\n", cpos);
799 Gtk.TextIter cpos_iter;
800 buf.get_iter_at_offset(out cpos_iter, cpos);
801 buf.place_cursor(cpos_iter);
803 this.el.get_vadjustment().set_value(vadj_pos);;
804 _this.buffer.in_cursor_change = false;
808 //_this.buffer.checkSyntax();
813 this.loading = false;
815 public void nodeSelected (JsRender.Node? sel, bool scroll) {
821 // this is connected in widnowstate
822 print("Roo-view - node selected\n");
823 var buf = this.el.get_buffer();
825 var sbuf = (GtkSource.Buffer) buf;
831 // clear all the marks..
835 sbuf.get_bounds (out start, out end);
836 sbuf.remove_source_marks (start, end, "grey");
838 this.node_selected = sel;
844 sbuf.get_iter_at_line(out iter, sel.line_start);
847 Gtk.TextIter cur_iter;
848 sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
851 if (!_this.buffer.in_cursor_change) {
853 this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
858 for (var i = 0; i < buf.get_line_count();i++) {
859 if (i < sel.line_start || i > sel.line_end) {
861 sbuf.get_iter_at_line(out iter, i);
862 sbuf.create_source_mark(null, "grey", iter);
870 public string toString () {
873 this.el.get_buffer().get_start_iter(out s);
874 this.el.get_buffer().get_end_iter(out e);
875 var ret = this.el.get_buffer().get_text(s,e,true);
876 //print("TO STRING? " + ret);
880 public class Xcls_buffer : Object
882 public GtkSource.Buffer el;
883 private Xcls_GtkView _this;
887 public int error_line;
888 public bool in_cursor_change;
890 public int last_line;
893 public Xcls_buffer(Xcls_GtkView _owner )
897 this.el = new GtkSource.Buffer( null );
900 this.error_line = -1;
901 this.in_cursor_change = false;
905 // set gobject values
910 buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
911 buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
912 buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
913 buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
914 buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
915 buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
916 buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
917 buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
920 buf.create_tag ("ERR", "weight", Pango.Weight.BOLD, "background", "pink");
921 buf.create_tag ("WARN", "weight", Pango.Weight.BOLD, "background", "#ABF4EB");
922 buf.create_tag ("DEPR", "weight", Pango.Weight.BOLD, "background", "#EEA9FF");
925 this.el.cursor_moved.connect( ( ) => {
926 GLib.debug("cursor moved called");
929 if (this.in_cursor_change ) {
930 GLib.debug("cursor changed : %d [ignoring nested call)", this.el.cursor_position);
934 GLib.debug("cursor changed : %d", this.el.cursor_position);
936 this.el.get_iter_at_offset(out cpos, this.el.cursor_position);
938 var ln = cpos.get_line();
939 if (this.last_line == ln ){
943 var node = _this.file.lineToNode(ln);
946 print("can not find node\n");
949 this.in_cursor_change = true;
950 var ltree = _this.main_window.windowstate.left_tree;
951 ltree.model.selectNode(node);
952 this.in_cursor_change = false;
956 // user defined functions
959 public class Xcls_keystate : Object
961 public Gtk.EventControllerKey el;
962 private Xcls_GtkView _this;
966 public bool is_control;
969 public Xcls_keystate(Xcls_GtkView _owner )
972 _this.keystate = this;
973 this.el = new Gtk.EventControllerKey();
976 this.is_control = false;
978 // set gobject values
981 this.el.key_released.connect( (keyval, keycode, state) => {
983 if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
984 this.is_control = false;
987 this.el.key_pressed.connect( (keyval, keycode, state) => {
989 if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
990 this.is_control = true;
993 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
994 GLib.debug("SAVE: ctrl-g pressed");
995 _this.forwardSearch(true);
998 if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
999 GLib.debug("SAVE: ctrl-f pressed");
1000 _this.search_entry.el.grab_focus();
1008 // user defined functions
1011 public class Xcls_EventControllerScroll37 : Object
1013 public Gtk.EventControllerScroll el;
1014 private Xcls_GtkView _this;
1018 public double distance;
1021 public Xcls_EventControllerScroll37(Xcls_GtkView _owner )
1024 this.el = new Gtk.EventControllerScroll( Gtk.EventControllerScrollFlags.VERTICAL );
1027 this.distance = 0.0f;
1029 // set gobject values
1032 this.el.scroll.connect( (dx, dy) => {
1033 if (!_this.keystate.is_control) {
1036 //GLib.debug("scroll %f", dy);
1038 this.distance += dy;
1039 if (this.distance < 1) {
1040 BuilderApplication.settings.editor_font_size ++;
1043 if (this.distance > -1) {
1044 BuilderApplication.settings.editor_font_size --;
1052 // user defined functions
1057 public class Xcls_Box12 : Object
1060 private Xcls_GtkView _this;
1066 public Xcls_Box12(Xcls_GtkView _owner )
1069 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1073 // set gobject values
1074 this.el.homogeneous = false;
1075 this.el.vexpand = false;
1076 new Xcls_search_entry( _this );
1077 this.el.append( _this.search_entry.el );
1078 new Xcls_search_results( _this );
1079 this.el.append( _this.search_results.el );
1080 new Xcls_nextBtn( _this );
1081 this.el.append( _this.nextBtn.el );
1082 new Xcls_backBtn( _this );
1083 this.el.append( _this.backBtn.el );
1084 var child_5 = new Xcls_MenuButton18( _this );
1086 this.el.append( child_5.el );
1089 // user defined functions
1091 public class Xcls_search_entry : Object
1093 public Gtk.SearchEntry el;
1094 private Xcls_GtkView _this;
1098 public Gtk.CssProvider css;
1101 public Xcls_search_entry(Xcls_GtkView _owner )
1104 _this.search_entry = this;
1105 this.el = new Gtk.SearchEntry();
1109 // set gobject values
1110 this.el.name = "gtkview-search-entry";
1111 this.el.hexpand = true;
1112 this.el.placeholder_text = "Press enter to search";
1113 this.el.search_delay = 3;
1114 var child_1 = new Xcls_EventControllerKey14( _this );
1116 this.el.add_controller( child_1.el );
1119 this.el.search_changed.connect( () => {
1121 _this.search(_this.search_entry.el.text);
1122 _this.search_results.updateResults();
1124 GLib.Timeout.add_seconds(1,() => {
1125 _this.search_results.updateResults();
1134 // user defined functions
1135 public void forwardSearch (bool change_focus) {
1138 _this.forwardSearch(change_focus);
1142 switch(_this.windowstate.state) {
1143 case WindowState.State.CODEONLY:
1144 //case WindowState.State.CODE:
1145 // search the code being edited..
1146 _this.windowstate.code_editor_tab.forwardSearch(change_focus);
1149 case WindowState.State.PREVIEW:
1150 if (_this.windowstate.file.xtype == "Gtk") {
1151 _this.windowstate.window_gladeview.forwardSearch(change_focus);
1153 _this.windowstate.window_rooview.forwardSearch(change_focus);
1162 public class Xcls_EventControllerKey14 : Object
1164 public Gtk.EventControllerKey el;
1165 private Xcls_GtkView _this;
1171 public Xcls_EventControllerKey14(Xcls_GtkView _owner )
1174 this.el = new Gtk.EventControllerKey();
1178 // set gobject values
1181 this.el.key_pressed.connect( (keyval, keycode, state) => {
1183 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1184 GLib.debug("SAVE: ctrl-g pressed");
1185 _this.forwardSearch(true);
1190 if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
1191 _this.forwardSearch(true);
1197 // print(event.key.keyval)
1203 // user defined functions
1207 public class Xcls_search_results : Object
1209 public Gtk.Label el;
1210 private Xcls_GtkView _this;
1216 public Xcls_search_results(Xcls_GtkView _owner )
1219 _this.search_results = this;
1220 this.el = new Gtk.Label( "No Results" );
1224 // set gobject values
1225 this.el.margin_end = 4;
1226 this.el.margin_start = 4;
1229 // user defined functions
1230 public void updateResults () {
1231 this.el.visible = true;
1233 var res = _this.searchcontext.get_occurrences_count();
1235 _this.search_results.el.label = "??? Matches";
1239 _this.nextBtn.el.sensitive = false;
1240 _this.backBtn.el.sensitive = false;
1243 _this.search_results.el.label = "%d Matches".printf(res);
1244 _this.nextBtn.el.sensitive = true;
1245 _this.backBtn.el.sensitive = true;
1248 _this.search_results.el.label = "No Matches";
1253 public class Xcls_nextBtn : Object
1255 public Gtk.Button el;
1256 private Xcls_GtkView _this;
1260 public bool always_show_image;
1263 public Xcls_nextBtn(Xcls_GtkView _owner )
1266 _this.nextBtn = this;
1267 this.el = new Gtk.Button();
1270 this.always_show_image = true;
1272 // set gobject values
1273 this.el.icon_name = "go-down";
1274 this.el.sensitive = false;
1277 this.el.clicked.connect( ( ) => {
1278 _this.forwardSearch(true);
1284 // user defined functions
1287 public class Xcls_backBtn : Object
1289 public Gtk.Button el;
1290 private Xcls_GtkView _this;
1294 public bool always_show_image;
1297 public Xcls_backBtn(Xcls_GtkView _owner )
1300 _this.backBtn = this;
1301 this.el = new Gtk.Button();
1304 this.always_show_image = true;
1306 // set gobject values
1307 this.el.icon_name = "go-up";
1308 this.el.sensitive = false;
1311 this.el.clicked.connect( ( ) => {
1313 _this.backSearch(true);
1318 // user defined functions
1321 public class Xcls_MenuButton18 : Object
1323 public Gtk.MenuButton el;
1324 private Xcls_GtkView _this;
1328 public bool always_show_image;
1331 public Xcls_MenuButton18(Xcls_GtkView _owner )
1334 this.el = new Gtk.MenuButton();
1337 this.always_show_image = true;
1339 // set gobject values
1340 this.el.icon_name = "emblem-system";
1341 this.el.always_show_arrow = true;
1342 new Xcls_search_settings( _this );
1343 this.el.popover = _this.search_settings.el;
1346 // user defined functions
1348 public class Xcls_search_settings : Object
1350 public Gtk.PopoverMenu el;
1351 private Xcls_GtkView _this;
1357 public Xcls_search_settings(Xcls_GtkView _owner )
1360 _this.search_settings = this;
1361 this.el = new Gtk.PopoverMenu.from_model(null);
1365 // set gobject values
1366 var child_1 = new Xcls_Box20( _this );
1368 this.el.set_child ( child_1.el );
1371 // user defined functions
1373 public class Xcls_Box20 : Object
1376 private Xcls_GtkView _this;
1382 public Xcls_Box20(Xcls_GtkView _owner )
1385 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1389 // set gobject values
1390 new Xcls_case_sensitive( _this );
1391 this.el.append( _this.case_sensitive.el );
1392 new Xcls_regex( _this );
1393 this.el.append( _this.regex.el );
1394 new Xcls_multiline( _this );
1395 this.el.append( _this.multiline.el );
1398 // user defined functions
1400 public class Xcls_case_sensitive : Object
1402 public Gtk.CheckButton el;
1403 private Xcls_GtkView _this;
1409 public Xcls_case_sensitive(Xcls_GtkView _owner )
1412 _this.case_sensitive = this;
1413 this.el = new Gtk.CheckButton();
1417 // set gobject values
1418 this.el.label = "Case Sensitive";
1421 // user defined functions
1424 public class Xcls_regex : Object
1426 public Gtk.CheckButton el;
1427 private Xcls_GtkView _this;
1433 public Xcls_regex(Xcls_GtkView _owner )
1437 this.el = new Gtk.CheckButton();
1441 // set gobject values
1442 this.el.label = "Regex";
1445 // user defined functions
1448 public class Xcls_multiline : Object
1450 public Gtk.CheckButton el;
1451 private Xcls_GtkView _this;
1457 public Xcls_multiline(Xcls_GtkView _owner )
1460 _this.multiline = this;
1461 this.el = new Gtk.CheckButton();
1465 // set gobject values
1466 this.el.label = "Multi-line (add \\n)";
1469 // user defined functions