summaryrefslogtreecommitdiff
path: root/src/findbar.cc
diff options
context:
space:
mode:
authorJoão Ricardo Lourenço <jorl17.8@gmail.com>2009-02-08 16:58:29 -0300
committerJoão Ricardo Lourenço <jorl17.8@gmail.com>2009-02-08 16:58:29 -0300
commit31d9389f4d4eed8d3eb4e6f77148fb6ec0c0a37f (patch)
tree72289bd30fb46650217daecb87c396e851e8dc7a /src/findbar.cc
parent4e417d3988cff4143da06f438fcd39cb228ed1f9 (diff)
Implemented "search previous" in string searches
Diffstat (limited to 'src/findbar.cc')
-rw-r--r--src/findbar.cc31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/findbar.cc b/src/findbar.cc
index 5d1c6245..ea1c80f1 100644
--- a/src/findbar.cc
+++ b/src/findbar.cc
@@ -63,7 +63,22 @@ void Findbar::search_cb(Widget *, void *vfb)
if (key[0] != '\0')
a_UIcmd_findtext_search(a_UIcmd_get_bw_by_widget(fb),
- key, case_sens);
+ key, case_sens, false);
+}
+
+/*
+ * Find previous occurrence of input key
+ */
+void Findbar::searchBackwards_cb(Widget *, void *vfb)
+{
+ Findbar *fb = (Findbar *)vfb;
+ const char *key = fb->i->text();
+ bool case_sens = fb->check_btn->value();
+
+ if (key[0] != '\0') {
+ a_UIcmd_findtext_search(a_UIcmd_get_bw_by_widget(fb),
+ key, case_sens, true);
+ }
}
/*
@@ -96,7 +111,7 @@ Findbar::Findbar(int width, int height) :
int button_width = 70;
int gap = 2;
int border = 2;
- int input_width = width - (2 * border + 3 * (button_width + gap));
+ int input_width = width - (2 * border + 4 * (button_width + gap));
int x = border;
height -= 2 * border;
@@ -121,15 +136,23 @@ Findbar::Findbar(int width, int height) :
i->clear_tab_to_focus();
i->set_click_to_focus();
- // TODO: search previous would be nice
next_btn = new HighlightButton(x, border, button_width, height, "Next");
x += button_width + gap;
- next_btn->tooltip("Find next occurrence of the search phrase");
+ next_btn->tooltip("Find next occurrence of the search phrase\n"
+ "shortcut: Enter");
next_btn->add_shortcut(ReturnKey);
next_btn->add_shortcut(KeypadEnter);
next_btn->callback(search_cb, this);
next_btn->clear_tab_to_focus();
+ prev_btn= new HighlightButton(x, border, button_width, height, "Previous");
+ prev_btn->tooltip("Find previous occurrence of the search phrase\n"
+ "shortcut: Shift+Enter");
+ prev_btn->add_shortcut(SHIFT+ReturnKey);
+ prev_btn->callback(searchBackwards_cb, this);
+ prev_btn->clear_tab_to_focus();
+ x += button_width + gap;
+
check_btn = new CheckButton(x, border, 2*button_width, height,
"Case-sensitive");
check_btn->clear_tab_to_focus();