summaryrefslogtreecommitdiff
path: root/riscos/search.c
diff options
context:
space:
mode:
authorAdrian Lees <adrian@aemulor.com>2005-04-17 23:32:09 +0000
committerAdrian Lees <adrian@aemulor.com>2005-04-17 23:32:09 +0000
commit89d98d057772721036504bd5edc8446d5d592234 (patch)
treeb6d507a7bd6a93472c4e8daec36a067715b2cb49 /riscos/search.c
parentf3f63a1cac19ee1833965e77f7fbc3d6326bd25b (diff)
downloadnetsurf-89d98d057772721036504bd5edc8446d5d592234.tar.gz
netsurf-89d98d057772721036504bd5edc8446d5d592234.tar.bz2
[project @ 2005-04-17 23:32:09 by adrianl]
better keyboard support for scale and find dialogs svn path=/import/netsurf/; revision=1665
Diffstat (limited to 'riscos/search.c')
-rw-r--r--riscos/search.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/riscos/search.c b/riscos/search.c
index c309aba69..acb02f326 100644
--- a/riscos/search.c
+++ b/riscos/search.c
@@ -65,6 +65,7 @@ static const char *find_pattern(const char *string, int s_len,
const char *pattern, int p_len, bool case_sens, int *m_len);
static bool find_occurrences(const char *pattern, int p_len, struct box *cur,
bool case_sens);
+static void show_search_direction(bool forwards);
/**
@@ -81,10 +82,7 @@ void ro_gui_search_prepare(struct gui_window *g)
search_current_window = g;
ro_gui_set_icon_string(dialog_search, ICON_SEARCH_TEXT, "");
- ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_FORWARDS,
- true);
- ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_BACKWARDS,
- false);
+ show_search_direction(true);
ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_START,
false);
ro_gui_set_icon_selected_state(dialog_search,
@@ -147,12 +145,10 @@ bool ro_gui_search_keypress(wimp_key *key)
switch (key->c) {
case 2: /* ctrl b */
- ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_FORWARDS, false);
- ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_BACKWARDS, true);
+ show_search_direction(false);
return true;
case 6: /* ctrl f */
- ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_FORWARDS, true);
- ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_BACKWARDS, false);
+ show_search_direction(true);
return true;
case 9: /* ctrl i */
state = ro_gui_get_icon_selected_state(dialog_search, ICON_SEARCH_CASE_SENSITIVE);
@@ -161,7 +157,6 @@ bool ro_gui_search_keypress(wimp_key *key)
case 19: /* ctrl s */
state = ro_gui_get_icon_selected_state(dialog_search, ICON_SEARCH_START);
ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_START, !state);
-
return true;
case wimp_KEY_RETURN:
start_search();
@@ -169,6 +164,14 @@ bool ro_gui_search_keypress(wimp_key *key)
case wimp_KEY_ESCAPE:
end_search();
return true;
+ case wimp_KEY_UP:
+ show_search_direction(false);
+ start_search();
+ return true;
+ case wimp_KEY_DOWN:
+ show_search_direction(true);
+ start_search();
+ return true;
}
return false;
@@ -563,4 +566,16 @@ bool gui_search_term_highlighted(struct gui_window *g, struct box *box,
}
+/**
+ * Change the displayed search direction.
+ *
+ * \param forwards true for forwards, else backwards
+ */
+
+void show_search_direction(bool forwards)
+{
+ ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_FORWARDS, forwards);
+ ro_gui_set_icon_selected_state(dialog_search, ICON_SEARCH_BACKWARDS, !forwards);
+}
+
#endif