Resources.singleton().checkResources();
});
+ this.el.key_release_event.connect( (event) => {
+
+ if (this.search_entry.el.is_visible()) {
+ if (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ print("SAVE: ctrl-f pressed");
+ this.search_entry.el.grab_focus();
+ return false;
+ }
+
+ if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ print("SAVE: ctrl-g pressed");
+ this.search_entry.forwardSearch(true);
+ return false;
+ }
+ }
+ // print(event.key.keyval)
+
+ return false;
+
+ });
}
// user defined functions
public class Xcls_search_entry : Object
{
- public Gtk.Entry el;
+ public Gtk.SearchEntry el;
private Xcls_MainWindow _this;
{
_this = _owner;
_this.search_entry = this;
- this.el = new Gtk.Entry();
+ this.el = new Gtk.SearchEntry();
// my vars (dec)
this.el.override_font(description);
//listeners
+ this.el.key_press_event.connect( (event) => {
+
+ if (event.keyval == Gdk.Key.Return) {
+ this.forwardSearch(false);
+ return true;
+
+ }
+ // print(event.key.keyval)
+
+ return false;
+
+ });
this.el.changed.connect( () => {
- if (this.el.text != "") {
+ if (this.el.text == "") {
+ return;
+ }
+ var res = 0;
+ switch(_this.windowstate.state) {
+ case WindowState.State.CODEONLY:
+ case WindowState.State.CODE:
+ // search the code being edited..
+ res = _this.windowstate.code_editor.search(this.el.text);
+
+ break;
+ case WindowState.State.PREVIEW:
+ if (_this.windowstate.file.xtype == "Gtk") {
+ res = _this.windowstate.window_gladeview.search(this.el.text);
+ } else {
+ res = _this.windowstate.window_rooview.search(this.el.text);
+ }
-
+
+ break;
+ }
+ if (res > 0) {
+ _this.search_results.el.label = "%d Matches".printf(res);
+ } else {
+ _this.search_results.el.label = "No Matches";
}
+
+
+
});
}
// user defined functions
+ public void forwardSearch (bool change_focus) {
+ switch(_this.windowstate.state) {
+ case WindowState.State.CODEONLY:
+ case WindowState.State.CODE:
+ // search the code being edited..
+ _this.windowstate.code_editor.forwardSearch(change_focus);
+
+ break;
+ case WindowState.State.PREVIEW:
+ if (_this.windowstate.file.xtype == "Gtk") {
+ _this.windowstate.window_gladeview.forwardSearch(change_focus);
+ } else {
+ _this.windowstate.window_rooview.forwardSearch(change_focus);
+ }
+
+ break;
+ }
+
+ }
}
public class Xcls_MenuBar70 : Object