NetSurf
|
GUI URL auto-completion implementation. More...
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oslib/wimp.h>
#include "utils/log.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
#include "netsurf/url_db.h"
#include "netsurf/browser_window.h"
#include "riscos/global_history.h"
#include "riscos/gui.h"
#include "riscos/window.h"
#include "riscos/mouse.h"
#include "riscos/toolbar.h"
#include "riscos/url_complete.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/filetype.h"
Go to the source code of this file.
Macros | |
#define | MAXIMUM_VISIBLE_LINES 7 |
Functions | |
static bool | url_complete_callback (nsurl *url, const struct url_data *data) |
Callback function for urldb_iterate_partial. More... | |
static void | ro_gui_url_complete_mouse_at (wimp_pointer *pointer, void *data) |
Handle mouse movement over the URL completion window. More... | |
void | ro_gui_url_complete_start (struct toolbar *toolbar) |
Should be called when the caret is placed into a URL completion icon. More... | |
bool | ro_gui_url_complete_keypress (struct toolbar *toolbar, uint32_t key) |
Handles a keypress for URL completion. More... | |
void | ro_gui_url_complete_resize (struct toolbar *toolbar, wimp_open *open) |
Move and resize the url completion window to match the toolbar. More... | |
bool | ro_gui_url_complete_close (void) |
Try to close the current url completion window. More... | |
void | ro_gui_url_complete_redraw (wimp_draw *redraw) |
Redraws a section of the URL completion window. More... | |
void | ro_gui_url_complete_entering (wimp_entering *entering) |
Handle the pointer entering the URL completion window. More... | |
bool | ro_gui_url_complete_click (wimp_pointer *pointer) |
Handle mouse clicks in the URL completion window. More... | |
Variables | |
static nsurl ** | url_complete_matches = NULL |
static int | url_complete_matches_allocated = 0 |
static int | url_complete_matches_available = 0 |
static char * | url_complete_matched_string = NULL |
static int | url_complete_matches_selection = -1 |
static int | url_complete_keypress_selection = -1 |
static wimp_w | url_complete_parent = 0 |
static bool | url_complete_matches_reset = false |
static char * | url_complete_original_url = NULL |
static bool | url_complete_memory_exhausted = false |
static nsurl * | url_complete_redraw [MAXIMUM_VISIBLE_LINES] |
static char | url_complete_icon_null [] = "" |
static char | url_complete_icon_sprite [12] |
static wimp_icon | url_complete_icon |
static wimp_icon | url_complete_sprite |
static int | mouse_x |
static int | mouse_y |
GUI URL auto-completion implementation.
Definition in file url_complete.c.
#define MAXIMUM_VISIBLE_LINES 7 |
Definition at line 48 of file url_complete.c.
bool ro_gui_url_complete_click | ( | wimp_pointer * | pointer | ) |
Handle mouse clicks in the URL completion window.
pointer | the pointer state |
Definition at line 667 of file url_complete.c.
References browser_window_navigate(), gui_window::bw, BW_NAVIGATE_HISTORY, dialog_url_complete, mouse_x, mouse_y, NSLOG, nsurl_access(), ro_gui_url_complete_close(), ro_gui_url_complete_keypress(), ro_gui_window_lookup(), ro_toolbar_get_url(), ro_toolbar_set_url(), ro_warn_user(), gui_window::state, gui_window::toolbar, gui_window::url, url_complete_matches, url_complete_matches_selection, url_complete_original_url, and url_complete_parent.
Referenced by ro_gui_dialog_init(), and ro_gui_url_complete_mouse_at().
bool ro_gui_url_complete_close | ( | void | ) |
Try to close the current url completion window.
Definition at line 497 of file url_complete.c.
References dialog_url_complete, NSLOG, ro_warn_user(), url_complete_keypress_selection, url_complete_matched_string, url_complete_matches, url_complete_matches_allocated, url_complete_matches_available, url_complete_matches_selection, url_complete_original_url, and url_complete_parent.
Referenced by gui_window_destroy(), ro_gui_url_complete_click(), ro_gui_url_complete_keypress(), ro_gui_url_complete_resize(), ro_gui_url_complete_start(), ro_gui_window_click(), ro_gui_window_handle_local_keypress(), ro_gui_window_launch_url(), ro_gui_window_menu_prepare(), and ro_toolbar_click().
void ro_gui_url_complete_entering | ( | wimp_entering * | entering | ) |
Handle the pointer entering the URL completion window.
*entering | The pointer entering data block. |
Definition at line 641 of file url_complete.c.
References ro_gui_url_complete_mouse_at(), and ro_mouse_track_start().
Referenced by ro_gui_dialog_init().
bool ro_gui_url_complete_keypress | ( | struct toolbar * | toolbar, |
uint32_t | key | ||
) |
Handles a keypress for URL completion.
*toolbar | The toolbar to be updated. |
key | the key pressed (as UTF32 code or wimp key + bit31 set) |
Definition at line 100 of file url_complete.c.
References dialog_url_complete, height, IS_WIMP_KEY, MAXIMUM_VISIBLE_LINES, NSLOG, nsoption_bool, nsurl_access(), parent, PTR_WIMP_OPEN, ro_gui_url_complete_close(), ro_gui_url_complete_resize(), ro_toolbar_get_display_url(), ro_toolbar_get_parent_window(), ro_toolbar_get_url(), ro_toolbar_set_url(), ro_warn_user(), url_complete_callback(), url_complete_keypress_selection, url_complete_matched_string, url_complete_matches, url_complete_matches_allocated, url_complete_matches_available, url_complete_matches_reset, url_complete_matches_selection, url_complete_memory_exhausted, url_complete_original_url, url_complete_parent, url_complete_redraw, urldb_iterate_entries(), and urldb_iterate_partial().
Referenced by ro_gui_url_complete_click(), ro_gui_window_handle_local_keypress(), and ro_toolbar_keypress().
|
static |
Handle mouse movement over the URL completion window.
*pointer | The pointer state |
*data | NULL data pointer expected by mouse tracker |
Definition at line 654 of file url_complete.c.
References ro_gui_url_complete_click().
Referenced by ro_gui_url_complete_entering().
void ro_gui_url_complete_redraw | ( | wimp_draw * | redraw | ) |
Redraws a section of the URL completion window.
redraw | the area to redraw |
Definition at line 537 of file url_complete.c.
References line(), NSLOG, nsurl_access(), nsurl_length(), ro_content_filetype_from_type(), ro_gui_user_redraw(), ro_gui_wimp_sprite_exists(), ro_warn_user(), type, url_data::type, url_complete_icon, url_complete_icon_null, url_complete_icon_sprite, url_complete_matches, url_complete_matches_selection, url_complete_sprite, and urldb_get_url_data().
Referenced by ro_gui_dialog_init().
void ro_gui_url_complete_resize | ( | struct toolbar * | toolbar, |
wimp_open * | open | ||
) |
Move and resize the url completion window to match the toolbar.
*toolbar | The toolbar to update |
*open | the wimp_open request (updated on exit) |
Definition at line 398 of file url_complete.c.
References dialog_url_complete, MAXIMUM_VISIBLE_LINES, NSLOG, ro_get_vscroll_width(), ro_gui_url_complete_close(), ro_toolbar_get_display_url(), ro_toolbar_get_url_field_extent(), ro_toolbar_get_window(), ro_warn_user(), url_complete_matches, url_complete_matches_available, url_complete_matches_reset, and url_complete_parent.
Referenced by ro_gui_url_complete_keypress(), and ro_gui_window_open().
void ro_gui_url_complete_start | ( | struct toolbar * | toolbar | ) |
Should be called when the caret is placed into a URL completion icon.
*toolbar | The toolbar to initialise URL completion for. |
Definition at line 76 of file url_complete.c.
References parent, ro_gui_url_complete_close(), ro_toolbar_get_display_url(), ro_toolbar_get_parent_window(), ro_toolbar_get_url(), url_complete_matched_string, and url_complete_parent.
Referenced by gui_window_create(), ro_gui_window_handle_local_keypress(), ro_gui_window_set_url(), and ro_toolbar_click().
Callback function for urldb_iterate_partial.
url | URL which matches |
data | Data associated with URL |
Definition at line 366 of file url_complete.c.
References url_complete_matches, url_complete_matches_allocated, url_complete_matches_available, url_complete_memory_exhausted, and url_data::visits.
Referenced by ro_gui_url_complete_keypress().
|
static |
Definition at line 66 of file url_complete.c.
Referenced by ami_mouse_to_ns_coords(), ro_gui_url_complete_click(), and treeview_edit_node_at_point().
|
static |
Definition at line 67 of file url_complete.c.
Referenced by ami_mouse_to_ns_coords(), ro_gui_url_complete_click(), treeview_edit_node_at_point(), and treeview_set_move_indicator().
|
static |
Definition at line 64 of file url_complete.c.
Referenced by ro_gui_url_complete_redraw().
|
static |
Definition at line 62 of file url_complete.c.
Referenced by ro_gui_url_complete_redraw().
|
static |
Definition at line 63 of file url_complete.c.
Referenced by ro_gui_url_complete_redraw().
|
static |
Definition at line 55 of file url_complete.c.
Referenced by ro_gui_url_complete_close(), and ro_gui_url_complete_keypress().
|
static |
Definition at line 53 of file url_complete.c.
Referenced by ro_gui_url_complete_close(), ro_gui_url_complete_keypress(), and ro_gui_url_complete_start().
|
static |
Definition at line 50 of file url_complete.c.
Referenced by ro_gui_url_complete_click(), ro_gui_url_complete_close(), ro_gui_url_complete_keypress(), ro_gui_url_complete_redraw(), ro_gui_url_complete_resize(), and url_complete_callback().
|
static |
Definition at line 51 of file url_complete.c.
Referenced by ro_gui_url_complete_close(), ro_gui_url_complete_keypress(), and url_complete_callback().
|
static |
Definition at line 52 of file url_complete.c.
Referenced by ro_gui_url_complete_close(), ro_gui_url_complete_keypress(), ro_gui_url_complete_resize(), and url_complete_callback().
|
static |
Definition at line 57 of file url_complete.c.
Referenced by ro_gui_url_complete_keypress(), and ro_gui_url_complete_resize().
|
static |
Definition at line 54 of file url_complete.c.
Referenced by ro_gui_url_complete_click(), ro_gui_url_complete_close(), ro_gui_url_complete_keypress(), and ro_gui_url_complete_redraw().
|
static |
Definition at line 59 of file url_complete.c.
Referenced by ro_gui_url_complete_keypress(), and url_complete_callback().
|
static |
Definition at line 58 of file url_complete.c.
Referenced by ro_gui_url_complete_click(), ro_gui_url_complete_close(), and ro_gui_url_complete_keypress().
|
static |
Definition at line 56 of file url_complete.c.
Referenced by ro_gui_url_complete_click(), ro_gui_url_complete_close(), ro_gui_url_complete_keypress(), ro_gui_url_complete_resize(), and ro_gui_url_complete_start().
|
static |
Definition at line 61 of file url_complete.c.
Referenced by ro_gui_url_complete_keypress().
|
static |
Definition at line 65 of file url_complete.c.
Referenced by ro_gui_url_complete_redraw().