NetSurf
|
Implementation of RISC OS hotlist manager. More...
#include <stdint.h>
#include <stdlib.h>
#include <oslib/osmodule.h>
#include <oslib/wimp.h>
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
#include "netsurf/url_db.h"
#include "netsurf/window.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
#include "desktop/hotlist.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
#include "riscos/message.h"
#include "riscos/save.h"
#include "riscos/toolbar.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/query.h"
#include "riscos/menus.h"
#include "riscos/corewindow.h"
#include "riscos/hotlist.h"
Go to the source code of this file.
Data Structures | |
struct | ro_hotlist_window |
Hotlist window container for RISC OS. More... | |
struct | ro_hotlist_message_hotlist_addurl |
URL adding hotlist protocol message block. More... | |
struct | ro_hotlist_message_hotlist_changed |
change hotlist protocol message block. More... | |
Functions | |
static nserror | hotlist_draw (struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r) |
callback to draw on drawable area of ro hotlist window More... | |
static nserror | hotlist_key (struct ro_corewindow *ro_cw, uint32_t nskey) |
callback for keypress on ro hotlist window More... | |
static nserror | hotlist_mouse (struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y) |
callback for mouse event on ro hotlist window More... | |
static nserror | hotlist_toolbar_click (struct ro_corewindow *ro_cw, button_bar_action action) |
handle clicks in ro hotlist window toolbar. More... | |
static nserror | hotlist_toolbar_update (struct ro_corewindow *ro_cw) |
Handle updating state of buttons in ro core window toolbar. More... | |
static nserror | hotlist_toolbar_save (struct ro_corewindow *ro_cw, char *config) |
callback for saving of toolbar state in ro hotlist window More... | |
static bool | hotlist_menu_prepare (wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer) |
Prepare the hotlist menu for display. More... | |
static void | hotlist_menu_warning (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action) |
Handle submenu warnings for the hotlist menu. More... | |
static bool | hotlist_menu_select (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action) |
Handle selections from the hotlist menu. More... | |
static nserror | ro_hotlist_init (void) |
Creates the window for the hotlist tree. More... | |
nserror | ro_gui_hotlist_present (void) |
make the cookie window visible. More... | |
void | ro_gui_hotlist_initialise (void) |
initialise the hotlist window template ready for subsequent use. More... | |
nserror | ro_gui_hotlist_finalise (void) |
Free any resources allocated for the cookie window. More... | |
bool | ro_gui_hotlist_check_window (wimp_w wh) |
bool | ro_gui_hotlist_check_menu (wimp_menu *menu) |
static void | ro_gui_hotlist_scheduled_callback (void *p) |
Callback to schedule for the next available Null poll, by which point a hotlist client will have claimed the Message_HotlistAddURL and any details in RMA can safely be discarded. More... | |
static void | ro_gui_hotlist_addurl_bounce (wimp_message *message) |
Handle bounced Message_HotlistAddURL, so that RMA storage can be freed. More... | |
void | ro_gui_hotlist_add_page (nsurl *url) |
Add a URL to the hotlist. More... | |
void | ro_gui_hotlist_add_cleanup (void) |
Clean up RMA storage used by the Message_HotlistAddURL protocol. More... | |
static void | ro_gui_hotlist_remove_confirmed (query_id id, enum query_response res, void *p) |
Callback confirming a URL delete query. More... | |
static void | ro_gui_hotlist_remove_cancelled (query_id id, enum query_response res, void *p) |
Callback cancelling a URL delete query. More... | |
void | ro_gui_hotlist_remove_page (nsurl *url) |
Remove a URL from the hotlist. More... | |
bool | ro_gui_hotlist_has_page (nsurl *url) |
Report whether the hotlist contains a given URL. More... | |
Variables | |
static struct ro_hotlist_window * | hotlist_window = NULL |
hotlist window singleton More... | |
static wimp_window * | dialog_hotlist_template |
riscos template for hotlist window More... | |
static query_id | hotlist_query = QUERY_INVALID |
Hotlist Query Handler. More... | |
static nsurl * | hotlist_delete_url = NULL |
static char * | hotlist_url = NULL |
URL area claimed from RMA. More... | |
static char * | hotlist_title = NULL |
Title area claimed from RMA. More... | |
static const query_callback | remove_funcs |
removal query dialog callbacks. More... | |
Implementation of RISC OS hotlist manager.
Definition in file hotlist.c.
|
static |
callback to draw on drawable area of ro hotlist window
ro_cw | The riscos core window structure. |
r | The rectangle of the window that needs updating. |
originx | The risc os plotter x origin. |
originy | The risc os plotter y origin. |
Definition at line 107 of file hotlist.c.
References hotlist_redraw(), redraw_context::interactive, no_font_blending, NSERROR_OK, ro_plot_origin_x, ro_plot_origin_y, and ro_plotters.
Referenced by ro_hotlist_init().
|
static |
callback for keypress on ro hotlist window
ro_cw | The ro core window structure. |
nskey | The netsurf key code. |
Definition at line 137 of file hotlist.c.
References hotlist_keypress(), NSERROR_NOT_IMPLEMENTED, and NSERROR_OK.
Referenced by ro_hotlist_init().
|
static |
Prepare the hotlist menu for display.
w | The window owning the menu. |
i | The icon owning the menu. |
menu | The menu from which the selection was made. |
pointer | The pointer shape |
Definition at line 264 of file hotlist.c.
References ro_hotlist_window::core, GUI_SAVE_HOTLIST_EXPORT_HTML, hotlist_has_selection(), ro_hotlist_window::menu, ro_gui_menu_set_entry_shaded(), ro_gui_menu_set_entry_ticked(), ro_gui_save_prepare(), ro_gui_wimp_event_get_user_data(), ro_toolbar_menu_buttons_tick, ro_toolbar_menu_edit_shade, ro_toolbar_menu_edit_tick, ro_toolbar_menu_option_shade, ro_corewindow::toolbar, TOOLBAR_BUTTONS, TOOLBAR_EDIT, TREE_CLEAR_SELECTION, and TREE_SELECTION.
Referenced by ro_hotlist_init().
|
static |
Handle selections from the hotlist menu.
w | The window owning the menu. |
i | The icon owning the menu. |
menu | The menu from which the selection was made. |
selection | The wimp menu selection data. |
action | The selected menu action. |
Definition at line 329 of file hotlist.c.
References ro_hotlist_window::core, dialog_saveas, hotlist_add_entry(), hotlist_add_folder(), hotlist_contract(), hotlist_edit_selection(), hotlist_expand(), HOTLIST_EXPORT, hotlist_keypress(), ro_hotlist_window::menu, NS_KEY_CLEAR_SELECTION, NS_KEY_CR, NS_KEY_DELETE_LEFT, NS_KEY_SELECT_ALL, ro_gui_dialog_open_persistent(), ro_gui_wimp_event_get_user_data(), ro_toolbar_get_display_buttons(), ro_toolbar_set_display_buttons(), ro_toolbar_toggle_edit(), ro_toolbar_update_all_hotlists(), ro_corewindow::toolbar, TOOLBAR_BUTTONS, TOOLBAR_EDIT, TREE_CLEAR_SELECTION, TREE_COLLAPSE_ALL, TREE_COLLAPSE_FOLDERS, TREE_COLLAPSE_LINKS, TREE_EXPAND_ALL, TREE_EXPAND_FOLDERS, TREE_EXPAND_LINKS, TREE_NEW_FOLDER, TREE_NEW_LINK, TREE_SELECT_ALL, TREE_SELECTION_DELETE, TREE_SELECTION_EDIT, and TREE_SELECTION_LAUNCH.
Referenced by ro_hotlist_init().
|
static |
Handle submenu warnings for the hotlist menu.
w | The window owning the menu. |
i | The icon owning the menu. |
menu | The menu to which the warning applies. |
selection | The wimp menu selection data. |
action | The selected menu action. |
Definition at line 308 of file hotlist.c.
Referenced by ro_hotlist_init().
|
static |
callback for mouse event on ro hotlist window
ro_cw | The ro core window structure. |
mouse_state | mouse state |
x | location of event |
y | location of event |
Definition at line 156 of file hotlist.c.
References hotlist_mouse_action(), and NSERROR_OK.
Referenced by ro_hotlist_init().
|
static |
handle clicks in ro hotlist window toolbar.
ro_cw | The ro core window structure. |
action | The button bar action. |
Definition at line 174 of file hotlist.c.
References hotlist_add_folder(), hotlist_contract(), hotlist_expand(), hotlist_keypress(), NS_KEY_CR, NS_KEY_DELETE_LEFT, NSERROR_OK, ro_toolbar_update_all_hotlists(), TOOLBAR_BUTTON_CLOSE, TOOLBAR_BUTTON_COLLAPSE, TOOLBAR_BUTTON_CREATE, TOOLBAR_BUTTON_DELETE, TOOLBAR_BUTTON_EXPAND, TOOLBAR_BUTTON_LAUNCH, and TOOLBAR_BUTTON_OPEN.
Referenced by ro_hotlist_init().
|
static |
callback for saving of toolbar state in ro hotlist window
ro_cw | The ro core window structure. |
config | The new toolbar configuration. |
Definition at line 245 of file hotlist.c.
References NSERROR_OK, nsoption_set_charp, and ro_gui_save_options().
Referenced by ro_hotlist_init().
|
static |
Handle updating state of buttons in ro core window toolbar.
ro_cw | The ro core window structure. |
Definition at line 220 of file hotlist.c.
References hotlist_has_selection(), NSERROR_OK, ro_toolbar_set_button_shaded_state(), ro_corewindow::toolbar, TOOLBAR_BUTTON_DELETE, and TOOLBAR_BUTTON_LAUNCH.
Referenced by ro_hotlist_init().
void ro_gui_hotlist_add_cleanup | ( | void | ) |
Clean up RMA storage used by the Message_HotlistAddURL protocol.
Definition at line 730 of file hotlist.c.
References hotlist_title, and hotlist_url.
Referenced by ro_gui_hotlist_add_page(), ro_gui_hotlist_addurl_bounce(), ro_gui_hotlist_scheduled_callback(), and ro_gui_user_message().
void ro_gui_hotlist_add_page | ( | struct nsurl * | url | ) |
Add a URL to the hotlist.
This will be passed on to the core hotlist, then Message_HotlistAddURL will broadcast to any bookmark applications via the Hotlist Protocol.
*url | The URL to be added. |
Definition at line 667 of file hotlist.c.
References ro_hotlist_message_hotlist_addurl::appname, hotlist_add_url(), hotlist_title, hotlist_url, message_HOTLIST_ADD_URL, nsoption_bool, nsurl_access(), nsurl_length(), riscos_schedule(), ro_gui_hotlist_add_cleanup(), ro_gui_hotlist_addurl_bounce(), ro_gui_hotlist_scheduled_callback(), ro_message_send_message(), ro_hotlist_message_hotlist_addurl::title, url_data::title, ro_hotlist_message_hotlist_addurl::url, and urldb_get_url_data().
Referenced by ro_gui_window_action_add_bookmark().
|
static |
Handle bounced Message_HotlistAddURL, so that RMA storage can be freed.
message | The bounced message content. |
Definition at line 646 of file hotlist.c.
References hotlist_add_url(), hotlist_url, NSERROR_OK, nsurl_create(), nsurl_unref(), riscos_schedule(), ro_gui_hotlist_add_cleanup(), and ro_gui_hotlist_scheduled_callback().
Referenced by ro_gui_hotlist_add_page().
bool ro_gui_hotlist_check_menu | ( | wimp_menu * | menu | ) |
Definition at line 618 of file hotlist.c.
References hotlist_window, and ro_hotlist_window::menu.
Referenced by ro_gui_interactive_help_request().
bool ro_gui_hotlist_check_window | ( | wimp_w | wh | ) |
Definition at line 607 of file hotlist.c.
References ro_hotlist_window::core, hotlist_window, and ro_corewindow::wh.
Referenced by ro_gui_interactive_help_request().
nserror ro_gui_hotlist_finalise | ( | void | ) |
Free any resources allocated for the cookie window.
Definition at line 586 of file hotlist.c.
References ro_hotlist_window::core, hotlist_fini(), hotlist_window, NSERROR_OK, and ro_corewindow_fini().
Referenced by gui_quit().
bool ro_gui_hotlist_has_page | ( | struct nsurl * | url | ) |
Report whether the hotlist contains a given URL.
This will be passed on to the core hotlist, unless we're configured to use an external hotlist in which case we always report false.
url | The URL to be tested. |
Definition at line 826 of file hotlist.c.
References hotlist_has_url(), nsoption_bool, and ro_hotlist_message_hotlist_addurl::url.
Referenced by ro_gui_url_bar_set_url(), ro_gui_url_bar_test_for_text_field_keypress(), and ro_gui_url_bar_update_hotlist().
void ro_gui_hotlist_initialise | ( | void | ) |
initialise the hotlist window template ready for subsequent use.
Definition at line 579 of file hotlist.c.
References dialog_hotlist_template, and ro_gui_dialog_load_template().
Referenced by ro_gui_dialog_init().
nserror ro_gui_hotlist_present | ( | void | ) |
make the cookie window visible.
Definition at line 539 of file hotlist.c.
References ro_hotlist_window::core, hotlist_window, NSERROR_OK, NSLOG, nsoption_bool, nsoption_charp, ro_gui_dialog_open_top(), ro_hotlist_init(), ro_warn_user(), ro_corewindow::toolbar, and ro_corewindow::wh.
Referenced by ro_gui_iconbar_click(), ro_gui_iconbar_menu_select(), ro_gui_window_handle_local_keypress(), ro_gui_window_menu_select(), and ro_gui_window_toolbar_click().
|
static |
Callback cancelling a URL delete query.
id | The ID of the query calling us. |
res | The user's response to the query. |
p | Callback data (always NULL). |
Definition at line 771 of file hotlist.c.
References hotlist_delete_url, hotlist_query, nsurl_unref(), and QUERY_INVALID.
|
static |
Callback confirming a URL delete query.
id | The ID of the query calling us. |
res | The user's response to the query. |
p | Callback data (always NULL). |
Definition at line 752 of file hotlist.c.
References hotlist_delete_url, hotlist_query, hotlist_remove_url(), nsurl_unref(), QUERY_INVALID, and ro_toolbar_update_all_hotlists().
void ro_gui_hotlist_remove_page | ( | struct nsurl * | url | ) |
Remove a URL from the hotlist.
This will be passed on to the core hotlist, unless we're configured to use external hotlists in which case we ignore it.
*url | The URL to be removed. |
Definition at line 789 of file hotlist.c.
References hotlist_delete_url, hotlist_has_url(), hotlist_query, hotlist_remove_url(), messages_get(), nsoption_bool, nsurl_ref(), nsurl_unref(), query_close(), QUERY_INVALID, query_user(), remove_funcs, ro_toolbar_update_all_hotlists(), and ro_hotlist_message_hotlist_addurl::url.
Referenced by ro_gui_window_action_remove_bookmark().
|
static |
Callback to schedule for the next available Null poll, by which point a hotlist client will have claimed the Message_HotlistAddURL and any details in RMA can safely be discarded.
p | Unused data pointer. |
Definition at line 635 of file hotlist.c.
References ro_gui_hotlist_add_cleanup().
Referenced by ro_gui_hotlist_add_page(), and ro_gui_hotlist_addurl_bounce().
|
static |
Creates the window for the hotlist tree.
Definition at line 424 of file hotlist.c.
References ro_hotlist_window::core, dialog_hotlist_template, dialog_saveas, ro_corewindow::draw, hotlist_draw(), HOTLIST_EXPORT, hotlist_key(), hotlist_manager_init(), hotlist_menu_prepare(), hotlist_menu_select(), hotlist_menu_warning(), hotlist_mouse(), hotlist_toolbar_click(), hotlist_toolbar_save(), hotlist_toolbar_update(), hotlist_window, ro_corewindow::key, ro_hotlist_window::menu, messages_get(), ro_corewindow::mouse, NO_ACTION, NSERROR_NOMEM, NSERROR_OK, NSLOG, nsoption_charp, ro_corewindow_init(), ro_gui_menu_define_menu(), ro_gui_set_window_title(), ro_gui_wimp_event_register_menu(), ro_gui_wimp_event_register_menu_prepare(), ro_gui_wimp_event_register_menu_selection(), ro_gui_wimp_event_register_menu_warning(), ro_warn_user(), THEME_STYLE_HOTLIST_TOOLBAR, TOOLBAR_BUTTON_CLOSE, TOOLBAR_BUTTON_COLLAPSE, TOOLBAR_BUTTON_CREATE, TOOLBAR_BUTTON_DELETE, TOOLBAR_BUTTON_EXPAND, TOOLBAR_BUTTON_LAUNCH, TOOLBAR_BUTTON_NONE, TOOLBAR_BUTTON_OPEN, TOOLBAR_BUTTONS, ro_corewindow::toolbar_click, TOOLBAR_EDIT, ro_corewindow::toolbar_save, ro_corewindow::toolbar_update, TREE_CLEAR_SELECTION, TREE_COLLAPSE_ALL, TREE_COLLAPSE_FOLDERS, TREE_COLLAPSE_LINKS, TREE_EXPAND_ALL, TREE_EXPAND_FOLDERS, TREE_EXPAND_LINKS, TREE_NEW_FOLDER, TREE_NEW_LINK, TREE_SELECT_ALL, TREE_SELECTION, TREE_SELECTION_DELETE, TREE_SELECTION_EDIT, TREE_SELECTION_LAUNCH, and ro_corewindow::wh.
Referenced by ro_gui_hotlist_present().
|
static |
riscos template for hotlist window
Definition at line 64 of file hotlist.c.
Referenced by ro_gui_hotlist_initialise(), and ro_hotlist_init().
|
static |
Definition at line 68 of file hotlist.c.
Referenced by ro_gui_hotlist_remove_cancelled(), ro_gui_hotlist_remove_confirmed(), and ro_gui_hotlist_remove_page().
|
static |
Hotlist Query Handler.
Definition at line 67 of file hotlist.c.
Referenced by ro_gui_hotlist_remove_cancelled(), ro_gui_hotlist_remove_confirmed(), and ro_gui_hotlist_remove_page().
|
static |
Title area claimed from RMA.
Definition at line 94 of file hotlist.c.
Referenced by ro_gui_hotlist_add_cleanup(), and ro_gui_hotlist_add_page().
|
static |
URL area claimed from RMA.
Definition at line 92 of file hotlist.c.
Referenced by ro_gui_hotlist_add_cleanup(), ro_gui_hotlist_add_page(), and ro_gui_hotlist_addurl_bounce().
|
static |
hotlist window singleton
Definition at line 61 of file hotlist.c.
Referenced by ro_gui_hotlist_check_menu(), ro_gui_hotlist_check_window(), ro_gui_hotlist_finalise(), ro_gui_hotlist_present(), and ro_hotlist_init().
|
static |
removal query dialog callbacks.
Definition at line 782 of file hotlist.c.
Referenced by ro_gui_hotlist_remove_page().