NetSurf
|
Free text search implementation. More...
#include "utils/config.h"
#include <ctype.h>
#include <string.h>
#include "oslib/hourglass.h"
#include "oslib/wimp.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/browser_window.h"
#include "netsurf/search.h"
#include "netsurf/content.h"
#include "desktop/search.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
Go to the source code of this file.
Data Structures | |
struct | search_static_data |
Macros | |
#define | RECENT_SEARCHES 8 |
#define | DEFAULT_FLAGS |
Functions | |
static | wimp_MENU (RECENT_SEARCHES) |
void | ro_gui_search_init (void) |
bool | ro_gui_search_next (wimp_w w) |
Wrapper for the pressing of an OK button for wimp_event. More... | |
bool | ro_gui_search_menu_prepare (wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer) |
Callback to prepare menus in the Search dialog. More... | |
bool | ro_gui_search_click (wimp_pointer *pointer) |
void | ro_gui_search_add_recent (const char *search, void *p) |
add search string to recent searches list More... | |
bool | ro_gui_search_prepare_menu (void) |
static bool | ro_gui_search_bw_searchable (struct browser_window *bw) |
Determine of the browser window is searchable. More... | |
void | ro_gui_search_prepare (struct browser_window *bw) |
Open the search dialog. More... | |
bool | ro_gui_search_keypress (wimp_key *key) |
Handle keypresses in the search dialog. More... | |
void | ro_gui_search_end (wimp_w w) |
Ends the search. More... | |
void | ro_gui_search_set_status (bool found, void *p) |
Change the displayed search status. More... | |
void | ro_gui_search_set_hourglass (bool active, void *p) |
display hourglass while searching More... | |
void | ro_gui_search_set_forward_state (bool active, void *p) |
activate search forwards button in gui More... | |
void | ro_gui_search_set_back_state (bool active, void *p) |
activate search forwards button in gui More... | |
search_flags_t | ro_gui_search_update_flags (void) |
retrieve state of 'case sensitive', 'show all' checks in gui More... | |
Variables | |
static struct search_static_data | search_data |
struct gui_search_table * | riscos_search_table = &search_table |
Free text search implementation.
Definition in file search.c.
#define DEFAULT_FLAGS |
void ro_gui_search_add_recent | ( | const char * | search, |
void * | p | ||
) |
add search string to recent searches list
front is at liberty how to implement the bare notification should normally store a strdup() of the string in search_global_data.recent[]; core gives no guarantee of the integrity of the const char *
search | string search pattern |
p | the pointer sent to search_verify_new() |
Definition at line 205 of file search.c.
References dialog_search, ICON_SEARCH_MENU, RECENT_SEARCHES, search_static_data::recent_searches, ro_gui_search_prepare_menu(), ro_gui_set_icon_shaded_state(), ro_warn_user(), search_data, and search_static_data::search_insert.
|
static |
Determine of the browser window is searchable.
bw | The browser window to check. |
Definition at line 269 of file search.c.
References browser_window_get_content(), content_get_type(), CONTENT_HTML, and CONTENT_TEXTPLAIN.
Referenced by ro_gui_search_prepare().
bool ro_gui_search_click | ( | wimp_pointer * | pointer | ) |
Definition at line 157 of file search.c.
References browser_window_search(), browser_window_search_clear(), dialog_search, ICON_SEARCH_CASE_SENSITIVE, ICON_SEARCH_FIND_PREV, ICON_SEARCH_SHOW_ALL, ICON_SEARCH_TEXT, ro_gui_get_icon_selected_state(), ro_gui_get_icon_string(), ro_gui_search_update_flags(), search_data, SEARCH_FLAG_FORWARDS, SEARCH_FLAG_NONE, SEARCH_FLAG_SHOWALL, search_static_data::search_insert, and search_static_data::search_window.
Referenced by ro_gui_search_init().
void ro_gui_search_end | ( | wimp_w | w | ) |
Ends the search.
w | the search window handle (not used) |
Definition at line 404 of file search.c.
References browser_window_search_clear(), search_data, and search_static_data::search_window.
Referenced by ro_gui_search_init().
void ro_gui_search_init | ( | void | ) |
Definition at line 87 of file search.c.
References dialog_search, ICON_SEARCH_CANCEL, ICON_SEARCH_CASE_SENSITIVE, ICON_SEARCH_FIND_NEXT, ICON_SEARCH_MENU, ICON_SEARCH_STATUS, ICON_SEARCH_TEXT, messages_get(), recent_search_menu, RECENT_SEARCHES, ro_gui_dialog_create(), ro_gui_menu_init_structure(), ro_gui_search_click(), ro_gui_search_end(), ro_gui_search_keypress(), ro_gui_search_menu_prepare(), ro_gui_search_next(), ro_gui_wimp_event_register_cancel(), ro_gui_wimp_event_register_checkbox(), ro_gui_wimp_event_register_close_window(), ro_gui_wimp_event_register_keypress(), ro_gui_wimp_event_register_menu_gright(), ro_gui_wimp_event_register_menu_prepare(), ro_gui_wimp_event_register_mouse_click(), ro_gui_wimp_event_register_ok(), ro_gui_wimp_event_register_text_field(), and ro_gui_wimp_event_set_help_prefix().
Referenced by ro_gui_dialog_init().
bool ro_gui_search_keypress | ( | wimp_key * | key | ) |
Handle keypresses in the search dialog.
key | wimp_key block |
Definition at line 323 of file search.c.
References browser_window_search(), browser_window_search_clear(), dialog_search, ICON_SEARCH_CASE_SENSITIVE, ICON_SEARCH_TEXT, IS_WIMP_KEY, ro_gui_get_icon_selected_state(), ro_gui_get_icon_string(), ro_gui_search_set_back_state(), ro_gui_search_set_forward_state(), ro_gui_search_update_flags(), ro_gui_set_icon_selected_state(), search_data, SEARCH_FLAG_FORWARDS, SEARCH_FLAG_SHOWALL, search_static_data::search_insert, and search_static_data::search_window.
Referenced by ro_gui_search_init().
bool ro_gui_search_menu_prepare | ( | wimp_w | w, |
wimp_i | i, | ||
wimp_menu * | menu, | ||
wimp_pointer * | pointer | ||
) |
Callback to prepare menus in the Search dialog.
At present, this only has to handle the previous search pop-up.
w | The window handle owning the menu. |
i | The icon handle owning the menu. |
*menu | The menu to be prepared. |
*pointer | The associated mouse click event block, or NULL on an Adjust-click re-opening. |
Definition at line 144 of file search.c.
References ICON_SEARCH_MENU, recent_search_menu, and ro_gui_search_prepare_menu().
Referenced by ro_gui_search_init().
bool ro_gui_search_next | ( | wimp_w | w | ) |
Wrapper for the pressing of an OK button for wimp_event.
Definition at line 120 of file search.c.
References browser_window_search(), dialog_search, ICON_SEARCH_TEXT, ro_gui_get_icon_string(), ro_gui_search_update_flags(), search_data, SEARCH_FLAG_FORWARDS, search_static_data::search_insert, and search_static_data::search_window.
Referenced by ro_gui_search_init().
void ro_gui_search_prepare | ( | struct browser_window * | bw | ) |
Open the search dialog.
bw | the browser window to search |
Definition at line 292 of file search.c.
References dialog_search, ICON_SEARCH_CASE_SENSITIVE, ICON_SEARCH_SHOW_ALL, ICON_SEARCH_TEXT, ro_gui_search_bw_searchable(), ro_gui_search_set_back_state(), ro_gui_search_set_forward_state(), ro_gui_search_set_status(), ro_gui_set_icon_selected_state(), ro_gui_set_icon_string(), ro_gui_wimp_event_memorise(), search_data, search_static_data::search_insert, and search_static_data::search_window.
Referenced by ro_gui_window_action_search(), and ro_gui_window_menu_warning().
bool ro_gui_search_prepare_menu | ( | void | ) |
Definition at line 239 of file search.c.
References recent_search_menu, RECENT_SEARCHES, search_static_data::recent_searches, and search_data.
Referenced by ro_gui_search_add_recent(), and ro_gui_search_menu_prepare().
void ro_gui_search_set_back_state | ( | bool | active, |
void * | p | ||
) |
activate search forwards button in gui
active | activate/inactivate |
p | the pointer sent to search_verify_new() / search_create_context() |
Definition at line 454 of file search.c.
References dialog_search, ICON_SEARCH_FIND_PREV, and ro_gui_set_icon_shaded_state().
Referenced by ro_gui_search_keypress(), and ro_gui_search_prepare().
void ro_gui_search_set_forward_state | ( | bool | active, |
void * | p | ||
) |
activate search forwards button in gui
active | activate/inactivate |
p | the pointer sent to search_verify_new() / search_create_context() |
Definition at line 442 of file search.c.
References dialog_search, ICON_SEARCH_FIND_NEXT, and ro_gui_set_icon_shaded_state().
Referenced by ro_gui_search_keypress(), and ro_gui_search_prepare().
void ro_gui_search_set_hourglass | ( | bool | active, |
void * | p | ||
) |
void ro_gui_search_set_status | ( | bool | found, |
void * | p | ||
) |
Change the displayed search status.
found | search pattern matched in text |
p | the pointer sent to search_verify_new() / search_create_context() |
Definition at line 415 of file search.c.
References dialog_search, ICON_SEARCH_STATUS, messages_get(), and ro_gui_set_icon_string().
Referenced by ro_gui_search_prepare().
search_flags_t ro_gui_search_update_flags | ( | void | ) |
retrieve state of 'case sensitive', 'show all' checks in gui
Definition at line 463 of file search.c.
References dialog_search, ICON_SEARCH_CASE_SENSITIVE, ICON_SEARCH_SHOW_ALL, ro_gui_get_icon_selected_state(), SEARCH_FLAG_CASE_SENSITIVE, and SEARCH_FLAG_SHOWALL.
Referenced by ro_gui_search_click(), ro_gui_search_keypress(), and ro_gui_search_next().
|
static |
struct gui_search_table* riscos_search_table = &search_table |
|
static |
Definition at line 53 of file search.c.
Referenced by ro_gui_search_add_recent(), ro_gui_search_click(), ro_gui_search_end(), ro_gui_search_keypress(), ro_gui_search_next(), ro_gui_search_prepare(), and ro_gui_search_prepare_menu().