summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-01-01 18:43:32 +0000
committerVincent Sanders <vince@kyllikki.org>2014-01-01 18:43:32 +0000
commit62047c923443415c59ec75b70e788e7d702c39b2 (patch)
tree0f0c08e0fa92d1214fdf31a47fee0b70f736c44e
parent8b6874effd85a476af488a5c747a7ab861f576d8 (diff)
parentea28b07cae4d0d40850be1417bd00e555e6168fb (diff)
downloadnetsurf-62047c923443415c59ec75b70e788e7d702c39b2.tar.gz
netsurf-62047c923443415c59ec75b70e788e7d702c39b2.tar.bz2
Merge remote-tracking branch 'origin/stevef/hotlist'
-rw-r--r--resources/FatMessages25
-rw-r--r--riscos/gui/url_bar.c151
-rw-r--r--riscos/gui/url_bar.h8
-rw-r--r--riscos/hotlist.c122
-rw-r--r--riscos/hotlist.h2
-rw-r--r--riscos/mouse.c16
-rw-r--r--riscos/options.h1
-rw-r--r--riscos/toolbar.c25
-rw-r--r--riscos/toolbar.h13
-rw-r--r--riscos/window.c47
10 files changed, 305 insertions, 105 deletions
diff --git a/resources/FatMessages b/resources/FatMessages
index 44598c530..2d74f3d6d 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -3051,6 +3051,11 @@ de.all.OverwriteFile:Eine Datei mit diesem Namen existiert bereits und würde ü
fr.all.OverwriteFile:Un fichier portant ce nom existe déjà et serait perdu.
it.all.OverwriteFile:Un file con questo nome è già esistente, continuare comporterà la sovrascrittura del file originale.
nl.all.OverwriteFile:Een bestand met deze naam bestaat al en zal verloren gaan.
+en.all.RemoveHotlist:Are you sure you wish to remove this address from the hotlist?
+de.all.RemoveHotlist:Are you sure you wish to remove this address from the hotlist?
+fr.all.RemoveHotlist:Are you sure you wish to remove this address from the hotlist?
+it.all.RemoveHotlist:Are you sure you wish to remove this address from the hotlist?
+nl.all.RemoveHotlist:Are you sure you wish to remove this address from the hotlist?
# Page fetching
# =============
@@ -3590,6 +3595,16 @@ de.all.DontReplace:Abbrechen
fr.all.DontReplace:Ne pas remplacer le fichier
it.all.DontReplace:Non sostituire
nl.all.DontReplace:Bestand niet vervangen
+en.all.Remove:Remove address
+de.all.Remove:Remove address
+rf.all.Remove:Remove address
+it.all.Remove:Remove address
+nl.all.Remove:Remove address
+en.all.DontRemove:Don't remove
+de.all.DontRemove:Don't remove
+rf.all.DontRemove:Don't remove
+it.all.DontRemove:Don't remove
+nl.all.DontRemove:Don't remove
en.all.obj:object
de.all.obj:Objekt
fr.all.obj:objet
@@ -3696,6 +3711,16 @@ de.ro.HelpToolbar16:Das ist die Ladeaktivitätsanzeige.|MSie wird animiert, wenn
fr.ro.HelpToolbar16:\Tle pulseur.|MIl s'anime lorsque cette \w est active.
it.ro.HelpToolbar16:\Tthrobber animato durante le attività di rete
nl.ro.HelpToolbar16:\Tthrobber.|MIt animates while this \w is active.
+en.ro.HelpToolbarFav:\TFavicon: a small logo supplied by the current site, if available.
+de.ro.HelpToolbarFav:\TFavicon: a small logo supplied by the current site, if available.
+fr.ro.HelpToolbarFav:\TFavicon: a small logo supplied by the current site, if available.
+it.ro.HelpToolbarFav:\TFavicon: a small logo supplied by the current site, if available.
+nl.ro.HelpToolbarFav:\TFavicon: a small logo supplied by the current site, if available.
+en.ro.HelpToolbarHot:\Thotlist indicator: if lit, the current address is in the hotlist.|M\Sto add the current address to the hotlist.|M\Ato remove the current address from the hotlist.
+de.ro.HelpToolbarHot:\Thotlist indicator: if lit, the current address is in the hotlist.|M\Sto add the current address to the hotlist.|M\Ato remove the current address from the hotlist.
+fr.ro.HelpToolbarHot:\Thotlist indicator: if lit, the current address is in the hotlist.|M\Sto add the current address to the hotlist.|M\Ato remove the current address from the hotlist.
+it.ro.HelpToolbarHot:\Thotlist indicator: if lit, the current address is in the hotlist.|M\Sto add the current address to the hotlist.|M\Ato remove the current address from the hotlist.
+nl.ro.HelpToolbarHot:\Thotlist indicator: if lit, the current address is in the hotlist.|M\Sto add the current address to the hotlist.|M\Ato remove the current address from the hotlist.
en.ro.HelpStatus0:\Tstatus bar resizer.|MDrag to alter the size of the status bar.
de.ro.HelpStatus0:Das ist die Begrenzung der Statusanzeige.|MKlicken und Ziehen verändert die Länge der Statusanzeige.
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c
index eede2ac88..845f8b3e8 100644
--- a/riscos/gui/url_bar.c
+++ b/riscos/gui/url_bar.c
@@ -30,7 +30,7 @@
#include "oslib/os.h"
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
-#include "desktop/hotlist.h"
+#include "riscos/hotlist.h"
#include "riscos/gui/url_bar.h"
#include "riscos/theme.h"
#include "riscos/url_suggest.h"
@@ -83,7 +83,7 @@ struct url_bar {
bool shaded;
struct {
- bool add;
+ bool set;
os_box extent;
os_coord offset;
} hotlist;
@@ -111,6 +111,7 @@ static struct url_bar_resource url_bar_res[URLBAR_RES_LAST] = {
}; /**< Treeview content resources */
+static void ro_gui_url_bar_set_hotlist(struct url_bar *url_bar, bool set);
/* This is an exported interface documented in url_bar.h */
@@ -159,7 +160,7 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme)
strncpy(url_bar->favicon_sprite, "Ssmall_xxx",
URLBAR_FAVICON_NAME_LENGTH);
- url_bar->hotlist.add = true;
+ url_bar->hotlist.set = false;
url_bar->hotlist.extent.x0 = 0;
url_bar->hotlist.extent.y0 = 0;
url_bar->hotlist.extent.x1 = 0;
@@ -337,7 +338,10 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
if (!url_bar->hidden && url_bar->container_icon == -1) {
icon.icon.flags = wimp_ICON_BORDER |
- (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT);
+ (wimp_COLOUR_BLACK <<
+ wimp_ICON_FG_COLOUR_SHIFT) |
+ (wimp_BUTTON_DOUBLE_CLICK_DRAG <<
+ wimp_ICON_BUTTON_TYPE_SHIFT);
error = xwimp_create_icon(&icon, &url_bar->container_icon);
if (error != NULL) {
LOG(("xwimp_create_icon: 0x%x: %s",
@@ -694,9 +698,9 @@ void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
.background_images = true,
.plot = &ro_plotters
};
- struct url_bar_resource *hotlist_icon = url_bar->hotlist.add ?
- &(url_bar_res[URLBAR_RES_HOTLIST_ADD]) :
- &(url_bar_res[URLBAR_RES_HOTLIST_REMOVE]);
+ struct url_bar_resource *hotlist_icon = url_bar->hotlist.set ?
+ &(url_bar_res[URLBAR_RES_HOTLIST_REMOVE]) :
+ &(url_bar_res[URLBAR_RES_HOTLIST_ADD]);
xwimp_set_colour(wimp_COLOUR_WHITE);
xos_plot(os_MOVE_TO,
@@ -757,41 +761,22 @@ bool ro_gui_url_bar_click(struct url_bar *url_bar,
pos.y > url_bar->extent.y1)
return false;
- /* If we have a click over the hotlist icon, hotlist add/remove. */
- /* TODO: this doesn't work
- * neither does the TOOLBAR_URL_DRAG_FAVICON below */
- if (pointer->buttons & (wimp_CLICK_SELECT | wimp_SINGLE_SELECT) &&
- url_bar->text_buffer != NULL) {
+ /* If we have a Select or Adjust click, check if it originated on the
+ * hotlist icon; if it did, return an event.
+ */
+
+ if (pointer->buttons == wimp_SINGLE_SELECT ||
+ pointer->buttons == wimp_SINGLE_ADJUST) {
if (pos.x >= url_bar->hotlist.extent.x0 &&
pos.x <= url_bar->hotlist.extent.x1 &&
pos.y >= url_bar->hotlist.extent.y0 &&
pos.y <= url_bar->hotlist.extent.y1) {
- nsurl *n;
- bool redraw = false;
- if (nsurl_create((const char *)url_bar->text_buffer,
- &n) == NSERROR_OK) {
- if (url_bar->hotlist.add) {
- if (hotlist_add_url(n)) {
- redraw = true;
- url_bar->hotlist.add = false;
- }
- } else {
- /* TODO: Open "Remove page from
- * Hotlist?" query dialogue box,
- * rather than silent removal. */
- hotlist_remove_url(n);
- redraw = true;
- url_bar->hotlist.add = true;
- }
- nsurl_unref(n);
-
- if (redraw && !url_bar->hidden)
- xwimp_force_redraw(url_bar->window,
- url_bar->hotlist.extent.x0,
- url_bar->hotlist.extent.y0,
- url_bar->hotlist.extent.x1,
- url_bar->hotlist.extent.y1);
- }
+ if (pointer->buttons == wimp_SINGLE_SELECT &&
+ action != NULL)
+ *action = TOOLBAR_URL_SELECT_HOTLIST;
+ else if (pointer->buttons == wimp_SINGLE_ADJUST &&
+ action != NULL)
+ *action = TOOLBAR_URL_ADJUST_HOTLIST;
return true;
}
}
@@ -909,6 +894,16 @@ bool ro_gui_url_bar_help_suffix(struct url_bar *url_bar, wimp_i i,
*suffix = "14";
else if (i == url_bar->suggest_icon)
*suffix = "15";
+ else if (pos.x >= url_bar->hotlist.extent.x0 &&
+ pos.x <= url_bar->hotlist.extent.x1 &&
+ pos.y >= url_bar->hotlist.extent.y0 &&
+ pos.y <= url_bar->hotlist.extent.y1)
+ *suffix = "Hot";
+ else if (pos.x >= url_bar->favicon_extent.x0 &&
+ pos.x <= url_bar->favicon_extent.x1 &&
+ pos.y >= url_bar->favicon_extent.y0 &&
+ pos.y <= url_bar->favicon_extent.y1)
+ *suffix = "Fav";
else
*suffix = "";
@@ -953,16 +948,8 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
return;
if (nsurl_create(url, &n) == NSERROR_OK) {
- bool prev = url_bar->hotlist.add;
- url_bar->hotlist.add = !hotlist_has_url(n);
+ ro_gui_url_bar_set_hotlist(url_bar, ro_gui_hotlist_has_page(n));
nsurl_unref(n);
-
- if (prev != url_bar->hotlist.add && !url_bar->hidden)
- xwimp_force_redraw(url_bar->window,
- url_bar->hotlist.extent.x0,
- url_bar->hotlist.extent.y0,
- url_bar->hotlist.extent.x1,
- url_bar->hotlist.extent.y1);
}
if (url_bar->text_icon == -1) {
@@ -999,23 +986,42 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
/* This is an exported interface documented in url_bar.h */
-void ro_gui_url_bar_hotlist_modifed(struct url_bar *url_bar, nsurl *url)
+void ro_gui_url_bar_update_hotlist(struct url_bar *url_bar)
{
+ const char *url;
nsurl *n;
- if (nsurl_create((const char *)url_bar->text_buffer,
- &n) == NSERROR_OK) {
- bool prev = url_bar->hotlist.add;
- url_bar->hotlist.add = !hotlist_has_url(n);
+ if (url_bar == NULL)
+ return;
+
+ url = (const char *) url_bar->text_buffer;
+ if (url != NULL && nsurl_create(url, &n) == NSERROR_OK) {
+ ro_gui_url_bar_set_hotlist(url_bar, ro_gui_hotlist_has_page(n));
nsurl_unref(n);
+ }
+}
+
+
+/**
+ * Set the state of a URL Bar's hotlist icon.
+ *
+ * \param *url_bar The URL Bar to update.
+ * \param set TRUE to set the hotlist icon; FALSE to clear it.
+ */
- if (prev != url_bar->hotlist.add && !url_bar->hidden) {
+static void ro_gui_url_bar_set_hotlist(struct url_bar *url_bar, bool set)
+{
+ if (url_bar == NULL || set == url_bar->hotlist.set)
+ return;
+
+ url_bar->hotlist.set = set;
+
+ if (!url_bar->hidden) {
xwimp_force_redraw(url_bar->window,
url_bar->hotlist.extent.x0,
url_bar->hotlist.extent.y0,
url_bar->hotlist.extent.x1,
url_bar->hotlist.extent.y1);
- }
}
}
@@ -1083,7 +1089,6 @@ bool ro_gui_url_bar_test_for_text_field_keypress(struct url_bar *url_bar,
{
const char *url;
nsurl *n;
- bool changed = false;
if (url_bar == NULL || url_bar->hidden || key == NULL)
return false;
@@ -1091,30 +1096,14 @@ bool ro_gui_url_bar_test_for_text_field_keypress(struct url_bar *url_bar,
if (key->w != url_bar->window || key->i != url_bar->text_icon)
return false;
- if (url_bar->hidden)
- return true;
-
/* Update hotlist indicator */
+
url = (const char *) url_bar->text_buffer;
if (url != NULL && nsurl_create(url, &n) == NSERROR_OK) {
- bool prev = url_bar->hotlist.add;
- url_bar->hotlist.add = !hotlist_has_url(n);
+ ro_gui_url_bar_set_hotlist(url_bar, ro_gui_hotlist_has_page(n));
nsurl_unref(n);
-
- if (prev != url_bar->hotlist.add) {
- changed = true;
- }
- } else if (!url_bar->hotlist.add) {
- url_bar->hotlist.add = true;
- changed = true;
- }
-
- if (changed) {
- xwimp_force_redraw(url_bar->window,
- url_bar->hotlist.extent.x0,
- url_bar->hotlist.extent.y0,
- url_bar->hotlist.extent.x1,
- url_bar->hotlist.extent.y1);
+ } else if (url_bar->hotlist.set) {
+ ro_gui_url_bar_set_hotlist(url_bar, false);
}
return true;
@@ -1166,12 +1155,12 @@ bool ro_gui_url_bar_set_site_favicon(struct url_bar *url_bar,
"Ssmall_xxx");
}
- if (!url_bar->hidden)
- xwimp_force_redraw(url_bar->window,
- url_bar->favicon_extent.x0,
- url_bar->favicon_extent.y0,
- url_bar->favicon_extent.x1,
- url_bar->favicon_extent.y1);
+ if (!url_bar->hidden)
+ xwimp_force_redraw(url_bar->window,
+ url_bar->favicon_extent.x0,
+ url_bar->favicon_extent.y0,
+ url_bar->favicon_extent.x1,
+ url_bar->favicon_extent.y1);
return true;
}
diff --git a/riscos/gui/url_bar.h b/riscos/gui/url_bar.h
index 04a8468ba..034f74df6 100644
--- a/riscos/gui/url_bar.h
+++ b/riscos/gui/url_bar.h
@@ -34,6 +34,8 @@ typedef enum {
TOOLBAR_URL_NONE = 0, /* Special case: no action */
TOOLBAR_URL_DRAG_URL,
TOOLBAR_URL_DRAG_FAVICON,
+ TOOLBAR_URL_SELECT_HOTLIST,
+ TOOLBAR_URL_ADJUST_HOTLIST
} url_bar_action;
struct url_bar;
@@ -232,13 +234,13 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
/**
- * Update urlbar's hotlist icon, if necessary.
+ * Update the state of a URL Bar's hotlist icon to reflect any changes to the
+ * URL or the contents of the hotlist.
*
* \param *url_bar The URL Bar to update.
- * \param *url URL with updated hotlist presence, or NULL if unknown.
*/
-void ro_gui_url_bar_hotlist_modifed(struct url_bar *url_bar, nsurl *url);
+void ro_gui_url_bar_update_hotlist(struct url_bar *url_bar);
/**
diff --git a/riscos/hotlist.c b/riscos/hotlist.c
index 7b5762fad..f47d05e9c 100644
--- a/riscos/hotlist.c
+++ b/riscos/hotlist.c
@@ -62,6 +62,15 @@ static bool ro_gui_hotlist_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
static void ro_gui_hotlist_toolbar_click(button_bar_action action);
static void ro_gui_hotlist_addurl_bounce(wimp_message *message);
static void ro_gui_hotlist_scheduled_callback(void *p);
+static void ro_gui_hotlist_remove_confirmed(query_id id,
+ enum query_response res, void *p);
+static void ro_gui_hotlist_remove_cancelled(query_id id,
+ enum query_response res, void *p);
+
+static const query_callback remove_funcs = {
+ ro_gui_hotlist_remove_confirmed,
+ ro_gui_hotlist_remove_cancelled
+};
struct ro_treeview_callbacks ro_hotlist_treeview_callbacks = {
ro_gui_hotlist_toolbar_click,
@@ -85,6 +94,11 @@ struct ro_hotlist_message_hotlist_changed {
static char *hotlist_url = NULL; /**< URL area claimed from RMA. */
static char *hotlist_title = NULL; /**< Title area claimed from RMA. */
+/** Hotlist Query Handler. */
+
+static query_id hotlist_query = QUERY_INVALID;
+static nsurl *hotlist_delete_url = NULL;
+
/* The RISC OS hotlist window, toolbar and treeview data. */
static struct ro_hotlist {
@@ -241,6 +255,7 @@ void ro_gui_hotlist_toolbar_click(button_bar_action action)
switch (action) {
case TOOLBAR_BUTTON_DELETE:
hotlist_keypress(KEY_DELETE_LEFT);
+ ro_toolbar_update_all_hotlists();
break;
case TOOLBAR_BUTTON_EXPAND:
@@ -410,6 +425,7 @@ bool ro_gui_hotlist_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
return true;
case TREE_SELECTION_DELETE:
hotlist_keypress(KEY_DELETE_LEFT);
+ ro_toolbar_update_all_hotlists();
return true;
case TREE_SELECT_ALL:
hotlist_keypress(KEY_SELECT_ALL);
@@ -496,8 +512,6 @@ void ro_gui_hotlist_add_page(nsurl *url)
ro_gui_hotlist_add_cleanup();
- LOG(("Sending Hotlist AddURL to potential hotlist clients."));
-
data = urldb_get_url_data(url);
if (data == NULL)
return;
@@ -540,8 +554,6 @@ void ro_gui_hotlist_add_page(nsurl *url)
static void ro_gui_hotlist_addurl_bounce(wimp_message *message)
{
- LOG(("Hotlist AddURL Bounced"));
-
if (hotlist_url != NULL) {
nsurl *nsurl;
@@ -570,8 +582,6 @@ static void ro_gui_hotlist_addurl_bounce(wimp_message *message)
static void ro_gui_hotlist_scheduled_callback(void *p)
{
- LOG(("Hotlist AddURL was claimed by something."));
-
ro_gui_hotlist_add_cleanup();
}
@@ -582,8 +592,6 @@ static void ro_gui_hotlist_scheduled_callback(void *p)
void ro_gui_hotlist_add_cleanup(void)
{
- LOG(("Clean up RMA"));
-
if (hotlist_url != NULL) {
osmodule_free(hotlist_url);
hotlist_url = NULL;
@@ -596,6 +604,104 @@ void ro_gui_hotlist_add_cleanup(void)
}
+/**
+ * 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.
+ *
+ * \param *url The URL to be removed.
+ */
+
+void ro_gui_hotlist_remove_page(nsurl *url)
+{
+ if (url == NULL || nsoption_bool(external_hotlists) ||
+ !hotlist_has_url(url))
+ return;
+
+ /* Clean up any existing delete attempts before continuing. */
+
+ if (hotlist_query != QUERY_INVALID) {
+ query_close(hotlist_query);
+ hotlist_query = QUERY_INVALID;
+ }
+
+ if (hotlist_delete_url != NULL) {
+ nsurl_unref(hotlist_delete_url);
+ hotlist_delete_url = NULL;
+ }
+
+ /* Check with the user before removing the URL, unless they don't
+ * want us to be careful in which case just do it.
+ */
+
+ if (nsoption_bool(confirm_hotlist_remove)) {
+ hotlist_query = query_user("RemoveHotlist", NULL,
+ &remove_funcs, NULL,
+ messages_get("Remove"),
+ messages_get("DontRemove"));
+
+ hotlist_delete_url = nsurl_ref(url);
+ } else {
+ hotlist_remove_url(url);
+ ro_toolbar_update_all_hotlists();
+ }
+}
+
+
+/**
+ * Callback confirming a URL delete query.
+ *
+ * \param id The ID of the query calling us.
+ * \param res The user's response to the query.
+ * \param *p Callback data (always NULL).
+ */
+
+static void ro_gui_hotlist_remove_confirmed(query_id id,
+ enum query_response res, void *p)
+{
+ hotlist_remove_url(hotlist_delete_url);
+ ro_toolbar_update_all_hotlists();
+
+ nsurl_unref(hotlist_delete_url);
+ hotlist_delete_url = NULL;
+ hotlist_query = QUERY_INVALID;
+}
+
+
+/**
+ * Callback cancelling a URL delete query.
+ *
+ * \param id The ID of the query calling us.
+ * \param res The user's response to the query.
+ * \param *p Callback data (always NULL).
+ */
+
+static void ro_gui_hotlist_remove_cancelled(query_id id,
+ enum query_response res, void *p)
+{
+ nsurl_unref(hotlist_delete_url);
+ hotlist_delete_url = NULL;
+ hotlist_query = QUERY_INVALID;
+}
+
+
+/**
+ * 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.
+ *
+ * \param *url The URL to be tested.
+ * \return true if the hotlist contains the URL; else false.
+ */
+
+bool ro_gui_hotlist_has_page(nsurl *url)
+{
+ if (url == NULL || nsoption_bool(external_hotlists))
+ return false;
+
+ return hotlist_has_url(url);
+}
+
+
#if 0
/**
* Handle URL dropped on hotlist
diff --git a/riscos/hotlist.h b/riscos/hotlist.h
index 25e4794a7..4cb5a1ff3 100644
--- a/riscos/hotlist.h
+++ b/riscos/hotlist.h
@@ -47,6 +47,8 @@ bool ro_gui_hotlist_check_window(wimp_w window);
bool ro_gui_hotlist_check_menu(wimp_menu *menu);
void ro_gui_hotlist_add_page(nsurl *url);
void ro_gui_hotlist_add_cleanup(void);
+void ro_gui_hotlist_remove_page(nsurl *url);
+bool ro_gui_hotlist_has_page(nsurl *url);
#endif
diff --git a/riscos/mouse.c b/riscos/mouse.c
index c655340b4..a20965e31 100644
--- a/riscos/mouse.c
+++ b/riscos/mouse.c
@@ -50,6 +50,8 @@ static void (*ro_mouse_drag_track_callback)(wimp_pointer *pointer, void *data)
static void (*ro_mouse_drag_cancel_callback)(void *data) = NULL;
static void *ro_mouse_drag_data = NULL;
+static bool ro_mouse_ignore_leaving_event = false;
+
/* Data for the wimp poll handler. */
static void (*ro_mouse_poll_end_callback)(wimp_leaving *leaving, void *data)
@@ -123,6 +125,12 @@ void ro_mouse_drag_start(void (*drag_end)(wimp_dragged *dragged, void *data),
ro_mouse_drag_track_callback = drag_track;
ro_mouse_drag_cancel_callback = drag_cancel;
ro_mouse_drag_data = data;
+
+ /* The Wimp sends a PointerLeaving event when Wimp_DragBox is called,
+ * so we mask out the next event that will come our way.
+ */
+
+ ro_mouse_ignore_leaving_event = true;
}
@@ -184,14 +192,20 @@ void ro_mouse_track_start(void (*poll_end)(wimp_leaving *leaving, void *data),
* Process Wimp_PointerLeaving events by terminating an active mouse track and
* passing the details on to any registered event handler.
*
+ * If the ignore mask is set, we don't pass the event on to the client as it
+ * is assumed that it's a result of starting a Wimp_DragBox operation.
+ *
* \param *leaving The Wimp_PointerLeaving data block.
*/
void ro_mouse_pointer_leaving_window(wimp_leaving *leaving)
{
- if (ro_mouse_poll_end_callback != NULL)
+ if (ro_mouse_poll_end_callback != NULL &&
+ ro_mouse_ignore_leaving_event == false)
ro_mouse_poll_end_callback(leaving, ro_mouse_poll_data);
+ ro_mouse_ignore_leaving_event = false;
+
/* Poll tracking is a one-shot event, so clear the data ready for
* another claimant.
*/
diff --git a/riscos/options.h b/riscos/options.h
index 9ee35929d..cb2b78bd8 100644
--- a/riscos/options.h
+++ b/riscos/options.h
@@ -53,6 +53,7 @@ NSOPTION_BOOL(no_plugins, false)
NSOPTION_BOOL(block_popups, false)
NSOPTION_BOOL(strip_extensions, false)
NSOPTION_BOOL(confirm_overwrite, true)
+NSOPTION_BOOL(confirm_hotlist_remove, true)
NSOPTION_STRING(url_path, "NetSurf:URL")
NSOPTION_STRING(url_save, CHOICES_PREFIX "URL")
NSOPTION_STRING(hotlist_path, "NetSurf:Hotlist")
diff --git a/riscos/toolbar.c b/riscos/toolbar.c
index 4da4db478..93c4438c3 100644
--- a/riscos/toolbar.c
+++ b/riscos/toolbar.c
@@ -162,7 +162,7 @@ static wimp_window ro_toolbar_window = {
wimp_WINDOW_NEVER3D | 0x16u /* RISC OS 5.03+ */,
{0, 0, TOOLBAR_DEFAULT_WIDTH, 16384},
0,
- wimp_BUTTON_CLICK_DRAG << wimp_ICON_BUTTON_TYPE_SHIFT,
+ wimp_BUTTON_DOUBLE_CLICK_DRAG << wimp_ICON_BUTTON_TYPE_SHIFT,
wimpspriteop_AREA,
1,
1,
@@ -1620,10 +1620,27 @@ const char *ro_toolbar_get_url(struct toolbar *toolbar)
/* This is an exported interface documented in toolbar.h */
-void ro_toolbar_hotlist_modifed(struct toolbar *toolbar, nsurl *url)
+void ro_toolbar_update_all_hotlists(void)
{
- if (toolbar != NULL && toolbar->url != NULL)
- ro_gui_url_bar_hotlist_modifed(toolbar->url, url);
+ struct toolbar *bar;
+
+ bar = ro_toolbar_bars;
+ while (bar != NULL) {
+ ro_toolbar_update_hotlist(bar);
+
+ bar = bar->next;
+ }
+}
+
+
+/* This is an exported interface documented in toolbar.h */
+
+void ro_toolbar_update_hotlist(struct toolbar *toolbar)
+{
+ if (toolbar == NULL || toolbar->url == NULL)
+ return;
+
+ ro_gui_url_bar_update_hotlist(toolbar->url);
}
diff --git a/riscos/toolbar.h b/riscos/toolbar.h
index 284eee22d..336f95d15 100644
--- a/riscos/toolbar.h
+++ b/riscos/toolbar.h
@@ -386,13 +386,20 @@ const char *ro_toolbar_get_url(struct toolbar *toolbar);
/**
- * Update toolbar's urlbar hotlist icon, if necessary.
+ * Update the state of the URL Bar hotlist icons in all open toolbars.
+ */
+
+void ro_toolbar_update_all_hotlists(void);
+
+
+/**
+ * Update the state of a toolbar's URL Bar hotlist icon to reflect any changes
+ * to the URL or the hotlist contents.
*
* \param *toolbar The toolbar to update.
- * \param *url URL with updated hotlist presence, or NULL if unknown.
*/
-void ro_toolbar_hotlist_modifed(struct toolbar *toolbar, nsurl *url);
+void ro_toolbar_update_hotlist(struct toolbar *toolbar);
/**
diff --git a/riscos/window.c b/riscos/window.c
index a7c42ac12..f6b274a20 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -138,6 +138,7 @@ static void ro_gui_window_action_save(struct gui_window *g,
static void ro_gui_window_action_search(struct gui_window *g);
static void ro_gui_window_action_zoom(struct gui_window *g);
static void ro_gui_window_action_add_bookmark(struct gui_window *g);
+static void ro_gui_window_action_remove_bookmark(struct gui_window *g);
static void ro_gui_window_action_print(struct gui_window *g);
static void ro_gui_window_action_page_info(struct gui_window *g);
@@ -3611,9 +3612,12 @@ void ro_gui_window_toolbar_click(void *data,
return;
- if (action_type == TOOLBAR_ACTION_URL &&
- action.url == TOOLBAR_URL_DRAG_URL) {
- if (g->bw->current_content) {
+ if (action_type == TOOLBAR_ACTION_URL) {
+ switch (action.url) {
+ case TOOLBAR_URL_DRAG_URL:
+ if (g->bw->current_content == NULL)
+ break;
+
hlcache_handle *h = g->bw->current_content;
if (ro_gui_shift_pressed())
@@ -3624,6 +3628,18 @@ void ro_gui_window_toolbar_click(void *data,
ro_gui_drag_save_link(save_type,
nsurl_access(hlcache_handle_get_url(h)),
content_get_title(h), g);
+ break;
+
+ case TOOLBAR_URL_SELECT_HOTLIST:
+ ro_gui_window_action_add_bookmark(g);
+ break;
+
+ case TOOLBAR_URL_ADJUST_HOTLIST:
+ ro_gui_window_action_remove_bookmark(g);
+ break;
+
+ default:
+ break;
}
return;
@@ -4250,7 +4266,7 @@ void ro_gui_window_action_zoom(struct gui_window *g)
* \param *g The browser window to act on.
*/
-void ro_gui_window_action_add_bookmark(struct gui_window *g)
+static void ro_gui_window_action_add_bookmark(struct gui_window *g)
{
nsurl *url;
@@ -4262,7 +4278,28 @@ void ro_gui_window_action_add_bookmark(struct gui_window *g)
url = hlcache_handle_get_url(g->bw->current_content);
ro_gui_hotlist_add_page(url);
- ro_toolbar_hotlist_modifed(g->toolbar, url);
+ ro_toolbar_update_hotlist(g->toolbar);
+}
+
+
+/**
+ * Remove a hotlist entry for a browser window.
+ *
+ * \param *g The browser window to act on.
+ */
+
+static void ro_gui_window_action_remove_bookmark(struct gui_window *g)
+{
+ nsurl *url;
+
+ if (g == NULL || g->bw == NULL || g->toolbar == NULL ||
+ g->bw->current_content == NULL ||
+ hlcache_handle_get_url(g->bw->current_content) == NULL)
+ return;
+
+ url = hlcache_handle_get_url(g->bw->current_content);
+
+ ro_gui_hotlist_remove_page(url);
}