3 public class Editor : Object
8 public static Editor singleton()
10 if (_Editor == null) {
11 _Editor= new Editor();
15 public Xcls_save_button save_button;
16 public Xcls_close_btn close_btn;
17 public Xcls_RightEditor RightEditor;
18 public Xcls_view view;
19 public Xcls_buffer buffer;
20 public Xcls_search_entry search_entry;
21 public Xcls_search_results search_results;
22 public Xcls_nextBtn nextBtn;
23 public Xcls_backBtn backBtn;
24 public Xcls_search_settings search_settings;
25 public Xcls_case_sensitive case_sensitive;
26 public Xcls_regex regex;
27 public Xcls_multiline multiline;
30 public int pos_root_x;
31 public Xcls_MainWindow window;
33 public int pos_root_y;
35 public GtkSource.SearchContext searchcontext;
36 public int last_search_end;
37 public signal void save ();
38 public JsRender.JsRender? file;
39 public JsRender.Node node;
40 public JsRender.NodeProp? prop;
41 public string activeEditor;
47 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
53 this.searchcontext = null;
54 this.last_search_end = 0;
58 this.activeEditor = "";
61 this.el.homogeneous = false;
62 this.el.hexpand = true;
63 this.el.vexpand = true;
64 var child_1 = new Xcls_Box2( _this );
66 this.el.append( child_1.el );
67 new Xcls_RightEditor( _this );
68 this.el.append( _this.RightEditor.el );
69 var child_3 = new Xcls_Box12( _this );
71 this.el.append ( child_3.el );
74 // user defined functions
75 public bool saveContents () {
78 if (_this.file == null) {
84 var str = _this.buffer.toString();
86 _this.buffer.checkSyntax();
90 // LeftPanel.model.changed( str , false);
92 _this.save_button.el.sensitive = false;
94 // find the text for the node..
95 if (_this.file.xtype != "PlainFile") {
96 // in theory these properties have to exist!?!
98 //this.window.windowstate.left_props.reload();
100 _this.file.setSource( str );
109 public void forwardSearch (bool change_focus) {
111 if (this.searchcontext == null) {
115 Gtk.TextIter beg, st,en;
116 bool has_wrapped_around;
117 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
118 if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
120 this.last_search_end = 0; // not sure if this should happen
122 if (has_wrapped_around) {
126 this.last_search_end = en.get_offset();
128 this.view.el.grab_focus();
130 this.buffer.el.place_cursor(st);
131 this.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
135 public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
140 if (file.xtype != "PlainFile") {
144 // find the text for the node..
145 this.view.load( prop.val );
148 this.close_btn.el.show();
151 this.view.load( file.toSource() );
152 this.close_btn.el.hide();
156 public void backSearch (bool change_focus) {
158 if (this.searchcontext == null) {
162 Gtk.TextIter beg, st,en;
163 bool has_wrapped_around;
164 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
166 if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
167 this.last_search_end = 0;
169 this.last_search_end = en.get_offset();
171 this.view.el.grab_focus();
173 this.buffer.el.place_cursor(st);
174 this.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
178 public void reset () {
183 this.searchcontext = null;
186 public int search (string in_txt) {
188 var s = new GtkSource.SearchSettings();
189 s.case_sensitive = _this.case_sensitive.el.active;
190 s.regex_enabled = _this.regex.el.active;
191 s.wrap_around = false;
193 this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
194 this.searchcontext.set_highlight(true);
197 if (_this.multiline.el.active) {
198 txt = in_txt.replace("\\n", "\n");
201 s.set_search_text(txt);
202 Gtk.TextIter beg, st,en;
204 this.buffer.el.get_start_iter(out beg);
205 bool has_wrapped_around;
206 this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
207 this.last_search_end = 0;
209 return this.searchcontext.get_occurrences_count();
215 public void updateErrorMarks (GLib.ListStore? ar) {
219 var buf = _this.buffer.el;
222 buf.get_bounds (out start, out end);
224 buf.remove_source_marks (start, end, "ERR");
225 buf.remove_source_marks (start, end, "WARN");
226 buf.remove_source_marks (start, end, "DEPR");
227 GLib.debug("highlight errors");
229 // we should highlight other types of errors..
231 if (ar == null || ar.get_n_items() < 1) {
232 GLib.debug("Return has no errors\n");
236 if (_this.window.windowstate.state != WindowState.State.CODEONLY
238 _this.window.windowstate.state != WindowState.State.CODE
240 GLib.debug("windowstate != CODEONLY?");
246 if (_this.file == null) {
247 GLib.debug("file is null?");
258 var tlines = buf.get_line_count () +1;
260 if (_this.prop != null) {
262 tlines = _this.prop.end_line + 1;
263 offset = _this.prop.start_line + 1;
267 for (var i = 0; i < ar.get_n_items();i++) {
268 var err = (Palete.CompileError) ar.get_item(i);
271 // print("get inter\n");
272 var eline = err.line - offset;
273 GLib.debug("GOT ERROR on line %d -- converted to %d (offset = %d)",
274 err.line ,eline, offset);
277 if (eline > tlines || eline < 0) {
282 buf.get_iter_at_line( out iter, eline);
285 var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
286 buf.create_source_mark( msg, err.category, iter);
287 GLib.debug("set line %d to %m", eline, msg);
288 // this.marks.set(eline, msg);
297 public void scroll_to_line (int line) {
299 GLib.Timeout.add(500, () => {
301 var buf = this.view.el.get_buffer();
303 var sbuf = (GtkSource.Buffer) buf;
307 sbuf.get_iter_at_line(out iter, line);
308 this.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
312 public class Xcls_Box2 : Object
315 private Editor _this;
321 public Xcls_Box2(Editor _owner )
324 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
328 // set gobject values
329 this.el.homogeneous = false;
330 this.el.hexpand = true;
331 new Xcls_save_button( _this );
332 this.el.append( _this.save_button.el );
333 var child_2 = new Xcls_Label4( _this );
335 this.el.append( child_2.el );
336 var child_3 = new Xcls_Scale5( _this );
338 this.el.append( child_3.el );
339 new Xcls_close_btn( _this );
340 this.el.append( _this.close_btn.el );
343 // user defined functions
345 public class Xcls_save_button : Object
347 public Gtk.Button el;
348 private Editor _this;
354 public Xcls_save_button(Editor _owner )
357 _this.save_button = this;
358 this.el = new Gtk.Button();
362 // set gobject values
363 this.el.label = "Save";
366 this.el.clicked.connect( () => {
367 _this.saveContents();
371 // user defined functions
374 public class Xcls_Label4 : Object
377 private Editor _this;
383 public Xcls_Label4(Editor _owner )
386 this.el = new Gtk.Label( null );
390 // set gobject values
391 this.el.hexpand = true;
394 // user defined functions
397 public class Xcls_Scale5 : Object
400 private Editor _this;
406 public Xcls_Scale5(Editor _owner )
409 this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
413 // set gobject values
414 this.el.width_request = 200;
415 this.el.has_origin = true;
416 this.el.draw_value = false;
418 this.el.sensitive = true;
423 this.el.set_range(6,30);
424 this.el.set_value(8);
428 this.el.change_value.connect( (st, val ) => {
431 _this.view.css.load_from_string(
432 "#editor-view { font: %dpx monospace; }".printf((int)val)
439 // user defined functions
442 public class Xcls_close_btn : Object
444 public Gtk.Button el;
445 private Editor _this;
451 public Xcls_close_btn(Editor _owner )
454 _this.close_btn = this;
455 this.el = new Gtk.Button();
459 // set gobject values
460 this.el.icon_name = "window-close";
461 var child_1 = new Xcls_Image7( _this );
462 this.el.child = child_1.el;
465 this.el.clicked.connect( () => {
466 _this.saveContents();
467 _this.window.windowstate.switchState(WindowState.State.PREVIEW);
471 // user defined functions
473 public class Xcls_Image7 : Object
476 private Editor _this;
482 public Xcls_Image7(Editor _owner )
485 this.el = new Gtk.Image();
489 // set gobject values
490 this.el.icon_name = "window-close";
491 this.el.icon_size = Gtk.IconSize.NORMAL;
494 // user defined functions
499 public class Xcls_RightEditor : Object
501 public Gtk.ScrolledWindow el;
502 private Editor _this;
508 public Xcls_RightEditor(Editor _owner )
511 _this.RightEditor = this;
512 this.el = new Gtk.ScrolledWindow();
516 // set gobject values
517 this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
518 this.el.vexpand = true;
519 this.el.overlay_scrolling = false;
520 this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
521 new Xcls_view( _this );
522 this.el.child = _this.view.el;
525 // user defined functions
527 public class Xcls_view : Object
529 public GtkSource.View el;
530 private Editor _this;
534 public Gtk.CssProvider css;
537 public Xcls_view(Editor _owner )
541 this.el = new GtkSource.View();
546 // set gobject values
547 this.el.auto_indent = true;
548 this.el.indent_width = 4;
549 this.el.name = "editor-view";
550 this.el.show_line_marks = true;
551 this.el.insert_spaces_instead_of_tabs = true;
552 this.el.show_line_numbers = true;
553 this.el.hexpand = true;
554 this.el.vexpand = true;
555 this.el.has_tooltip = true;
556 this.el.tab_width = 4;
557 this.el.highlight_current_line = true;
558 new Xcls_buffer( _this );
559 this.el.buffer = _this.buffer.el;
560 var child_2 = new Xcls_EventControllerKey11( _this );
562 this.el.add_controller( child_2.el );
566 this.css = new Gtk.CssProvider();
568 this.css.load_from_string(
569 "#editor-view { font: 12px monospace;}"
572 Gtk.StyleContext.add_provider_for_display(
573 this.el.get_display(),
575 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
582 this.el.completion.add_provider(new Palete.CompletionProvider(_this));
585 this.el.completion.unblock_interactive();
586 this.el.completion.select_on_show = true; // select
588 this.el.completion.remember_info_visibility = true;
591 var attrs = new GtkSource.MarkAttributes();
592 var pink = Gdk.RGBA();
593 pink.parse ( "pink");
594 attrs.set_background ( pink);
595 attrs.set_icon_name ( "process-stop");
596 attrs.query_tooltip_text.connect(( mark) => {
597 GLib.debug("tooltip query? %s", mark.name);
598 return strdup( mark.name);
600 attrs.query_tooltip_markup.connect(( mark) => {
601 GLib.debug("tooltip query? %s", mark.name);
602 return strdup( mark.name);
604 this.el.set_mark_attributes ("ERR", attrs, 1);
606 var wattrs = new GtkSource.MarkAttributes();
607 var blue = Gdk.RGBA();
608 blue.parse ( "#ABF4EB");
609 wattrs.set_background ( blue);
610 wattrs.set_icon_name ( "process-stop");
611 wattrs.query_tooltip_text.connect(( mark) => {
612 GLib.debug("tooltip query? %s", mark.name);
613 return strdup(mark.name);
615 wattrs.query_tooltip_markup.connect(( mark) => {
616 GLib.debug("tooltip query? %s", mark.name);
617 return strdup(mark.name);
619 this.el.set_mark_attributes ("WARN", wattrs, 1);
623 var dattrs = new GtkSource.MarkAttributes();
624 var purple = Gdk.RGBA();
625 purple.parse ( "#EEA9FF");
626 dattrs.set_background ( purple);
627 dattrs.set_icon_name ( "process-stop");
628 dattrs.query_tooltip_text.connect(( mark) => {
629 GLib.debug("tooltip query? %s", mark.name);
630 return strdup(mark.name);
632 dattrs.query_tooltip_markup.connect(( mark) => {
633 GLib.debug("tooltip query? %s", mark.name);
634 return strdup(mark.name);
636 this.el.set_mark_attributes ("DEPR", dattrs, 1);
639 this.el.get_space_drawer().set_matrix(null);
640 this.el.get_space_drawer().set_types_for_locations(
641 GtkSource.SpaceLocationFlags.ALL,
642 GtkSource.SpaceTypeFlags.ALL
644 this.el.get_space_drawer().set_enable_matrix(true);
646 Gtk.SourceDrawSpacesFlags.LEADING +
647 Gtk.SourceDrawSpacesFlags.TRAILING +
648 Gtk.SourceDrawSpacesFlags.TAB +
649 Gtk.SourceDrawSpacesFlags.SPACE
653 this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
655 //GLib.debug("query tooltip");
659 var yoff = (int) _this.RightEditor.el.vadjustment.value;
661 // I think this is problematic - if it's compliing / updating at same time as query.
663 //if (_this.window.statusbar_compile_spinner.el.spinning) {
667 this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
669 var l = iter.get_line();
673 // GLib.debug("query tooltip line %d", (int) l);
679 if (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {
680 GLib.debug("line %d setting tip to %s", l, _this.buffer.marks.get(l));
681 tooltip.set_text(_this.buffer.marks.get(l).dup());
689 // this crashes?? - not sure why.
690 var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
691 if (marks.is_empty()) {
692 marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
694 if (marks.is_empty()) {
695 marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
698 // GLib.debug("query tooltip line %d marks %d", (int)l, (int) marks.length());
700 marks.@foreach((m) => {
701 //GLib.debug("got mark %s", m.name);
702 str += (str.length > 0 ? "\n" : "") + m.category + ": " + m.name;
704 // true if there is a mark..
705 if (str.length > 0 ) {
706 tooltip.set_text( str );
708 return str.length > 0 ? true : false;
713 // user defined functions
714 public void load (string str) {
716 // show the help page for the active node..
717 //this.get('/Help').show();
719 // this.get('/BottomPane').el.set_current_page(0);
720 GLib.debug("load called - Reset undo buffer");
722 var buf = (GtkSource.Buffer)this.el.get_buffer();
723 buf.begin_irreversible_action();
724 buf.set_text(str, str.length);
725 buf.end_irreversible_action();
727 var lm = GtkSource.LanguageManager.get_default();
729 if (_this.file != null) {
730 lang = _this.file.language;
732 print("lang=%s, content_type = %s\n", lang, _this.file.content_type);
733 var lg = _this.file.content_type.length > 0 ?
734 lm.guess_language(_this.file.path, _this.file.content_type) :
735 lm.get_language(lang);
738 ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg);
740 this.el.insert_spaces_instead_of_tabs = true;
742 print("sourcelanguage = %s\n", lg.name);
743 if (lg.name == "Vala") {
744 this.el.insert_spaces_instead_of_tabs = false;
748 this.el.grab_focus();
749 _this.save_button.el.sensitive = false;
752 public class Xcls_buffer : Object
754 public GtkSource.Buffer el;
755 private Editor _this;
759 public int error_line;
760 public Gee.HashMap<int,string>? xmarks;
761 public bool check_queued;
764 public Xcls_buffer(Editor _owner )
768 this.el = new GtkSource.Buffer( null );
771 this.error_line = -1;
773 this.check_queued = false;
775 // set gobject values
776 this.el.enable_undo = true;
779 this.el.changed.connect( () => {
782 _this.save_button.el.sensitive = true;
783 print("EDITOR CHANGED");
788 // this.get('/LeftPanel.model').changed( str , false);
793 // user defined functions
794 public bool checkSyntax () {
797 var str = this.toString();
800 if (this.error_line > 0) {
803 this.el.get_bounds (out start, out end);
805 this.el.remove_source_marks (start, end, null);
807 if (str.length < 1) {
808 print("checkSyntax - empty string?\n");
813 if (_this.file.xtype == "PlainFile" && _this.file.project.xtype == "Gtk") {
815 // assume it's gtk...
817 BuilderApplication.valacompilequeue.addFile(
818 Palete.ValaCompileRequestType.FILE_CHANGE,
819 _this.file , str, false) ;
825 if (_this.file == null) {
833 GLib.debug("calling validate");
834 // clear the buttons.
836 BuilderApplication.valacompilequeue.addProp(
837 Palete.ValaCompileRequestType.PROP_CHANGE,
845 //print("done mark line\n");
847 return true; // at present allow saving - even if it's invalid..
849 public bool highlightErrorsJson (string type, Json.Object obj) {
852 this.el.get_bounds (out start, out end);
854 this.el.remove_source_marks (start, end, type);
855 GLib.debug("highlight errors");
857 // we should highlight other types of errors..
859 if (!obj.has_member(type)) {
860 GLib.debug("Return has no errors\n");
864 if (_this.window.windowstate.state != WindowState.State.CODEONLY
866 _this.window.windowstate.state != WindowState.State.CODE
868 GLib.debug("windowstate != CODEONLY?");
873 //this.marks = new Gee.HashMap<int,string>();
874 var err = obj.get_object_member(type);
876 if (_this.file == null) {
877 GLib.debug("file is null?");
881 var valafn = _this.file.path;
883 if (_this.file.xtype != "PlainFile") {
887 var regex = new Regex("\\.bjs$");
889 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
890 } catch (GLib.RegexError e) {
897 if (!err.has_member(valafn)) {
898 GLib.debug("File path has no errors");
902 var lines = err.get_object_member(valafn);
905 if (obj.has_member("line_offset")) { // ?? why??
906 offset = (int)obj.get_int_member("line_offset") + 1;
910 var tlines = this.el.get_line_count () +1;
912 if (_this.prop != null) {
914 tlines = _this.prop.end_line + 1;
915 offset = _this.prop.start_line + 1;
921 lines.foreach_member((obj, line, node) => {
924 // print("get inter\n");
925 var eline = int.parse(line) - offset;
926 GLib.debug("GOT ERROR on line %s -- converted to %d (offset = %d)\n", line,eline, offset);
929 if (eline > tlines || eline < 0) {
934 this.el.get_iter_at_line( out iter, eline);
935 //print("mark line\n");
937 var ar = lines.get_array_member(line);
938 for (var i = 0 ; i < ar.get_length(); i++) {
939 if (ar.get_string_element(i) == "Success") {
942 msg += (msg.length > 0) ? "\n" : "";
943 msg += ar.get_string_element(i);
948 msg = "Line: %d".printf(eline+1) + " " + msg;
949 this.el.create_source_mark(msg, type, iter);
950 GLib.debug("set line %d to %m", eline, msg);
951 // this.marks.set(eline, msg);
960 public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
962 this.error_line = validate_res.size;
964 if (this.error_line < 1) {
967 var tlines = this.el.get_line_count ();
969 var valiter = validate_res.map_iterator();
970 while (valiter.next()) {
972 // print("get inter\n");
973 var eline = valiter.get_key();
974 if (eline > tlines) {
977 this.el.get_iter_at_line( out iter, eline);
978 //print("mark line\n");
979 this.el.create_source_mark(valiter.get_value(), "ERR", iter);
983 public string toString () {
987 this.el.get_start_iter(out s);
988 this.el.get_end_iter(out e);
989 var ret = this.el.get_text(s,e,true);
990 //print("TO STRING? " + ret);
995 public class Xcls_EventControllerKey11 : Object
997 public Gtk.EventControllerKey el;
998 private Editor _this;
1004 public Xcls_EventControllerKey11(Editor _owner )
1007 this.el = new Gtk.EventControllerKey();
1011 // set gobject values
1014 this.el.key_released.connect( (keyval, keycode, state) => {
1017 if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1018 GLib.debug("SAVE: ctrl-S pressed");
1019 _this.saveContents();
1023 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1024 GLib.debug("SAVE: ctrl-g pressed");
1025 _this.forwardSearch(true);
1028 if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1029 GLib.debug("SAVE: ctrl-f pressed");
1030 _this.search_entry.el.grab_focus();
1034 // print(event.key.keyval)
1042 // user defined functions
1047 public class Xcls_Box12 : Object
1050 private Editor _this;
1056 public Xcls_Box12(Editor _owner )
1059 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1063 // set gobject values
1064 this.el.homogeneous = false;
1065 this.el.vexpand = false;
1066 new Xcls_search_entry( _this );
1067 this.el.append( _this.search_entry.el );
1068 new Xcls_search_results( _this );
1069 this.el.append( _this.search_results.el );
1070 new Xcls_nextBtn( _this );
1071 this.el.append( _this.nextBtn.el );
1072 new Xcls_backBtn( _this );
1073 this.el.append( _this.backBtn.el );
1074 var child_5 = new Xcls_MenuButton18( _this );
1076 this.el.append( child_5.el );
1079 // user defined functions
1081 public class Xcls_search_entry : Object
1083 public Gtk.SearchEntry el;
1084 private Editor _this;
1088 public Gtk.CssProvider css;
1091 public Xcls_search_entry(Editor _owner )
1094 _this.search_entry = this;
1095 this.el = new Gtk.SearchEntry();
1099 // set gobject values
1100 this.el.name = "editor-search-entry";
1101 this.el.hexpand = true;
1102 this.el.placeholder_text = "Press enter to search";
1103 this.el.search_delay = 3;
1104 var child_1 = new Xcls_EventControllerKey14( _this );
1106 this.el.add_controller( child_1.el );
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();
1121 // user defined functions
1122 public void forwardSearch (bool change_focus) {
1125 _this.forwardSearch(change_focus);
1129 switch(_this.windowstate.state) {
1130 case WindowState.State.CODEONLY:
1131 //case WindowState.State.CODE:
1132 // search the code being edited..
1133 _this.windowstate.code_editor_tab.forwardSearch(change_focus);
1136 case WindowState.State.PREVIEW:
1137 if (_this.windowstate.file.xtype == "Gtk") {
1138 _this.windowstate.window_gladeview.forwardSearch(change_focus);
1140 _this.windowstate.window_rooview.forwardSearch(change_focus);
1149 public class Xcls_EventControllerKey14 : Object
1151 public Gtk.EventControllerKey el;
1152 private Editor _this;
1158 public Xcls_EventControllerKey14(Editor _owner )
1161 this.el = new Gtk.EventControllerKey();
1165 // set gobject values
1168 this.el.key_pressed.connect( (keyval, keycode, state) => {
1170 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1171 GLib.debug("SAVE: ctrl-g pressed");
1172 _this.forwardSearch(true);
1177 if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
1178 _this.forwardSearch(true);
1184 // print(event.key.keyval)
1190 // user defined functions
1194 public class Xcls_search_results : Object
1196 public Gtk.Label el;
1197 private Editor _this;
1203 public Xcls_search_results(Editor _owner )
1206 _this.search_results = this;
1207 this.el = new Gtk.Label( "No Results" );
1211 // set gobject values
1212 this.el.margin_end = 4;
1213 this.el.margin_start = 4;
1216 // user defined functions
1217 public void updateResults () {
1218 this.el.visible = true;
1220 var res = _this.searchcontext.get_occurrences_count();
1222 _this.search_results.el.label = "??? Matches";
1226 _this.nextBtn.el.sensitive = false;
1227 _this.backBtn.el.sensitive = false;
1230 _this.search_results.el.label = "%d Matches".printf(res);
1231 _this.nextBtn.el.sensitive = true;
1232 _this.backBtn.el.sensitive = true;
1235 _this.search_results.el.label = "No Matches";
1240 public class Xcls_nextBtn : Object
1242 public Gtk.Button el;
1243 private Editor _this;
1247 public bool always_show_image;
1250 public Xcls_nextBtn(Editor _owner )
1253 _this.nextBtn = this;
1254 this.el = new Gtk.Button();
1257 this.always_show_image = true;
1259 // set gobject values
1260 this.el.icon_name = "go-down";
1261 this.el.sensitive = false;
1264 this.el.clicked.connect( (event) => {
1266 _this.forwardSearch(true);
1272 // user defined functions
1275 public class Xcls_backBtn : Object
1277 public Gtk.Button el;
1278 private Editor _this;
1282 public bool always_show_image;
1285 public Xcls_backBtn(Editor _owner )
1288 _this.backBtn = this;
1289 this.el = new Gtk.Button();
1292 this.always_show_image = true;
1294 // set gobject values
1295 this.el.icon_name = "go-up";
1296 this.el.sensitive = false;
1299 this.el.clicked.connect( (event) => {
1301 _this.backSearch(true);
1306 // user defined functions
1309 public class Xcls_MenuButton18 : Object
1311 public Gtk.MenuButton el;
1312 private Editor _this;
1316 public bool always_show_image;
1319 public Xcls_MenuButton18(Editor _owner )
1322 this.el = new Gtk.MenuButton();
1325 this.always_show_image = true;
1327 // set gobject values
1328 this.el.icon_name = "emblem-system";
1329 this.el.always_show_arrow = true;
1330 new Xcls_search_settings( _this );
1331 this.el.popover = _this.search_settings.el;
1334 // user defined functions
1336 public class Xcls_search_settings : Object
1338 public Gtk.Popover el;
1339 private Editor _this;
1345 public Xcls_search_settings(Editor _owner )
1348 _this.search_settings = this;
1349 this.el = new Gtk.Popover();
1353 // set gobject values
1354 var child_1 = new Xcls_Box20( _this );
1355 this.el.child = child_1.el;
1358 // user defined functions
1360 public class Xcls_Box20 : Object
1363 private Editor _this;
1369 public Xcls_Box20(Editor _owner )
1372 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1376 // set gobject values
1377 new Xcls_case_sensitive( _this );
1378 this.el.append( _this.case_sensitive.el );
1379 new Xcls_regex( _this );
1380 this.el.append( _this.regex.el );
1381 new Xcls_multiline( _this );
1382 this.el.append( _this.multiline.el );
1385 // user defined functions
1387 public class Xcls_case_sensitive : Object
1389 public Gtk.CheckButton el;
1390 private Editor _this;
1396 public Xcls_case_sensitive(Editor _owner )
1399 _this.case_sensitive = this;
1400 this.el = new Gtk.CheckButton();
1404 // set gobject values
1405 this.el.label = "Case Sensitive";
1414 // user defined functions
1417 public class Xcls_regex : Object
1419 public Gtk.CheckButton el;
1420 private Editor _this;
1426 public Xcls_regex(Editor _owner )
1430 this.el = new Gtk.CheckButton();
1434 // set gobject values
1435 this.el.label = "Regex";
1444 // user defined functions
1447 public class Xcls_multiline : Object
1449 public Gtk.CheckButton el;
1450 private Editor _this;
1456 public Xcls_multiline(Editor _owner )
1459 _this.multiline = this;
1460 this.el = new Gtk.CheckButton();
1464 // set gobject values
1465 this.el.label = "Multi-line (add \\n)";
1468 // user defined functions