summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontends/riscos/gui/url_bar.c123
-rw-r--r--frontends/riscos/gui/url_bar.h11
-rw-r--r--frontends/riscos/toolbar.c14
-rw-r--r--frontends/riscos/toolbar.h10
-rw-r--r--frontends/riscos/window.c20
5 files changed, 162 insertions, 16 deletions
diff --git a/frontends/riscos/gui/url_bar.c b/frontends/riscos/gui/url_bar.c
index ee5c689df..3e2066fbc 100644
--- a/frontends/riscos/gui/url_bar.c
+++ b/frontends/riscos/gui/url_bar.c
@@ -57,10 +57,13 @@
#define URLBAR_HEIGHT 52
#define URLBAR_FAVICON_SIZE 16
#define URLBAR_HOTLIST_SIZE 17
+#define URLBAR_PGINFO_WIDTH ((26) * 2)
#define URLBAR_FAVICON_WIDTH ((5 + URLBAR_FAVICON_SIZE + 5) * 2)
#define URLBAR_HOTLIST_WIDTH ((5 + URLBAR_HOTLIST_SIZE + 5) * 2)
#define URLBAR_MIN_WIDTH 52
#define URLBAR_GRIGHT_GUTTER 8
+
+#define URLBAR_PGINFO_NAME_LENGTH 12
#define URLBAR_FAVICON_NAME_LENGTH 12
struct url_bar {
@@ -73,9 +76,13 @@ struct url_bar {
/** The window and icon details. */
wimp_w window;
os_box extent;
+ osspriteop_area *sprites;
wimp_i container_icon;
+ char pginfo_sprite[URLBAR_PGINFO_NAME_LENGTH];
+ os_box pginfo_extent;
+
char favicon_sprite[URLBAR_FAVICON_NAME_LENGTH];
int favicon_type;
struct hlcache_handle *favicon_content;
@@ -147,6 +154,7 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme)
/* Set up default parameters. */
url_bar->theme = theme;
+ url_bar->sprites = ro_gui_theme_get_sprites(theme);
url_bar->display = false;
url_bar->shaded = false;
@@ -165,6 +173,14 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme)
url_bar->text_icon = -1;
url_bar->suggest_icon = -1;
+ url_bar->pginfo_extent.x0 = 0;
+ url_bar->pginfo_extent.y0 = 0;
+ url_bar->pginfo_extent.x1 = 0;
+ url_bar->pginfo_extent.y1 = 0;
+ strncpy(url_bar->pginfo_sprite,
+ "pgiinternal",
+ URLBAR_PGINFO_NAME_LENGTH);
+
url_bar->favicon_extent.x0 = 0;
url_bar->favicon_extent.y0 = 0;
url_bar->favicon_extent.x1 = 0;
@@ -173,8 +189,9 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme)
url_bar->favicon_height = 0;
url_bar->favicon_content = NULL;
url_bar->favicon_type = 0;
- strncpy(url_bar->favicon_sprite, "Ssmall_xxx",
- URLBAR_FAVICON_NAME_LENGTH);
+ strncpy(url_bar->favicon_sprite,
+ "Ssmall_xxx",
+ URLBAR_FAVICON_NAME_LENGTH);
url_bar->hotlist.set = false;
url_bar->hotlist.extent.x0 = 0;
@@ -272,7 +289,7 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
/* Position the Text icon. */
if (url_bar->text_icon != -1) {
- x0 = url_bar->extent.x0 + URLBAR_FAVICON_WIDTH;
+ x0 = url_bar->extent.x0 + URLBAR_PGINFO_WIDTH + URLBAR_FAVICON_WIDTH;
x1 = url_bar->extent.x1 - eig.x - URLBAR_HOTLIST_WIDTH -
url_bar->suggest_x - URLBAR_GRIGHT_GUTTER;
@@ -300,10 +317,18 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
}
}
+ /* Position the page info icon. */
+
+ url_bar->pginfo_extent.x0 = url_bar->extent.x0 + eig.x;
+ url_bar->pginfo_extent.x1 = url_bar->extent.x0 + URLBAR_PGINFO_WIDTH;
+ url_bar->pginfo_extent.y0 = centre - (URLBAR_HEIGHT / 2) + eig.y;
+ url_bar->pginfo_extent.y1 = url_bar->pginfo_extent.y0 + URLBAR_HEIGHT
+ - 2 * eig.y;
+
/* Position the Favicon icon. */
- url_bar->favicon_extent.x0 = url_bar->extent.x0 + eig.x;
- url_bar->favicon_extent.x1 = url_bar->extent.x0 + URLBAR_FAVICON_WIDTH;
+ url_bar->favicon_extent.x0 = url_bar->extent.x0 + URLBAR_PGINFO_WIDTH ;
+ url_bar->favicon_extent.x1 = url_bar->extent.x0 + URLBAR_PGINFO_WIDTH + URLBAR_FAVICON_WIDTH;
url_bar->favicon_extent.y0 = centre - (URLBAR_HEIGHT / 2) + eig.y;
url_bar->favicon_extent.y1 = url_bar->favicon_extent.y0 + URLBAR_HEIGHT
- 2 * eig.y;
@@ -512,7 +537,7 @@ bool ro_gui_url_bar_rebuild(struct url_bar *url_bar,
ro_gui_wimp_get_sprite_dimensions((osspriteop_area *) -1,
suggest_icon, &url_bar->suggest_x, &url_bar->suggest_y);
- url_bar->x_min = URLBAR_FAVICON_WIDTH + URLBAR_MIN_WIDTH +
+ url_bar->x_min = URLBAR_PGINFO_WIDTH + URLBAR_FAVICON_WIDTH + URLBAR_MIN_WIDTH +
URLBAR_HOTLIST_WIDTH + URLBAR_GRIGHT_GUTTER +
url_bar->suggest_x;
url_bar->y_min = (url_bar->suggest_y > URLBAR_HEIGHT) ?
@@ -588,7 +613,7 @@ bool ro_gui_url_bar_set_extent(struct url_bar *url_bar,
if (url_bar->window != NULL && !url_bar->hidden) {
if (stretch) {
xwimp_force_redraw(url_bar->window,
- x0 + URLBAR_FAVICON_WIDTH, y0,
+ x0 + URLBAR_PGINFO_WIDTH + URLBAR_FAVICON_WIDTH, y0,
(x1 > url_bar->extent.x1) ?
x1 : url_bar->extent.x1, y1);
} else {
@@ -629,6 +654,7 @@ void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
{
wimp_icon icon;
struct rect clip;
+ bool draw_pginfo = true;
bool draw_favicon = true;
bool draw_hotlist = true;
@@ -637,6 +663,18 @@ void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
return;
if ((redraw->clip.x0 - (redraw->box.x0 - redraw->xscroll)) >
+ (url_bar->pginfo_extent.x1) ||
+ (redraw->clip.y0 - (redraw->box.y1 - redraw->yscroll)) >
+ (url_bar->pginfo_extent.y1) ||
+ (redraw->clip.x1 - (redraw->box.x0 - redraw->xscroll)) <
+ (url_bar->pginfo_extent.x0) ||
+ (redraw->clip.y1 - (redraw->box.y1 - redraw->yscroll)) <
+ (url_bar->pginfo_extent.y0)) {
+ /* page info not in redraw area */
+ draw_pginfo = false;
+ }
+
+ if ((redraw->clip.x0 - (redraw->box.x0 - redraw->xscroll)) >
(url_bar->favicon_extent.x1) ||
(redraw->clip.y0 - (redraw->box.y1 - redraw->yscroll)) >
(url_bar->favicon_extent.y1) ||
@@ -660,6 +698,25 @@ void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
draw_hotlist = false;
}
+ if (draw_pginfo) {
+ icon.flags = wimp_ICON_SPRITE |
+ wimp_ICON_INDIRECTED |
+ wimp_ICON_FILLED |
+ wimp_ICON_HCENTRED |
+ wimp_ICON_VCENTRED |
+ (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT);
+ icon.data.indirected_sprite.id = (osspriteop_id)url_bar->pginfo_sprite;
+ icon.data.indirected_sprite.area = url_bar->sprites;
+ icon.data.indirected_sprite.size = 12;
+
+ icon.extent.x0 = url_bar->pginfo_extent.x0;
+ icon.extent.x1 = url_bar->pginfo_extent.x1;
+ icon.extent.y0 = url_bar->pginfo_extent.y0;
+ icon.extent.y1 = url_bar->pginfo_extent.y1;
+
+ xwimp_plot_icon(&icon);
+ }
+
if (draw_favicon) {
if (url_bar->favicon_content == NULL) {
icon.data.indirected_text.text = null_text_string;
@@ -1195,7 +1252,6 @@ bool ro_gui_url_bar_test_for_text_field_keypress(struct url_bar *url_bar,
/* This is an exported interface documented in url_bar.h */
-
bool ro_gui_url_bar_set_site_favicon(struct url_bar *url_bar,
struct hlcache_handle *h)
{
@@ -1251,7 +1307,58 @@ bool ro_gui_url_bar_set_site_favicon(struct url_bar *url_bar,
/* This is an exported interface documented in url_bar.h */
+bool ro_gui_url_bar_page_info_change(struct url_bar *url_bar)
+{
+ browser_window_page_info_state pistate;
+ const char *icon_name;
+ struct gui_window *g;
+
+ g = ro_gui_toolbar_lookup(url_bar->window);
+
+ pistate = browser_window_get_page_info_state(g->bw);
+
+ switch (pistate) {
+ case PAGE_STATE_LOCAL:
+ icon_name = "pgilocal";
+ break;
+ case PAGE_STATE_INSECURE:
+ icon_name = "pgiinsecure";
+ break;
+
+ case PAGE_STATE_SECURE_OVERRIDE:
+ icon_name = "pgiwarning";
+ break;
+
+ case PAGE_STATE_SECURE_ISSUES:
+ icon_name = "pgiwarning";
+ break;
+
+ case PAGE_STATE_SECURE:
+ icon_name = "pgisecure";
+ break;
+
+ case PAGE_STATE_INTERNAL:
+ default:
+ icon_name = "pgiinternal";
+ break;
+ }
+
+ strncpy(url_bar->pginfo_sprite, icon_name, URLBAR_PGINFO_NAME_LENGTH);
+
+ if (!url_bar->hidden) {
+ xwimp_force_redraw(url_bar->window,
+ url_bar->pginfo_extent.x0,
+ url_bar->pginfo_extent.y0,
+ url_bar->pginfo_extent.x1,
+ url_bar->pginfo_extent.y1);
+ }
+
+ return true;
+}
+
+
+/* This is an exported interface documented in url_bar.h */
bool ro_gui_url_bar_set_content_favicon(struct url_bar *url_bar,
struct gui_window *g)
{
diff --git a/frontends/riscos/gui/url_bar.h b/frontends/riscos/gui/url_bar.h
index 9486e214d..f7ed38a66 100644
--- a/frontends/riscos/gui/url_bar.h
+++ b/frontends/riscos/gui/url_bar.h
@@ -323,8 +323,17 @@ bool ro_gui_url_bar_set_content_favicon(struct url_bar *url_bar,
* \param *url_bar The URL bar to update.
* \return true if successful; else false.
*/
-
bool ro_gui_url_bar_update_urlsuggest(struct url_bar *url_bar);
+
+/**
+ * Update the page info icon
+ *
+ * \param url_bar The URL bar to update.
+ * \return true if successful; else false.
+ */
+bool ro_gui_url_bar_page_info_change(struct url_bar *url_bar);
+
+
#endif
diff --git a/frontends/riscos/toolbar.c b/frontends/riscos/toolbar.c
index 758c90cc2..b3acba503 100644
--- a/frontends/riscos/toolbar.c
+++ b/frontends/riscos/toolbar.c
@@ -420,7 +420,7 @@ bool ro_toolbar_rebuild(struct toolbar *toolbar)
ro_gui_wimp_event_transfer(old_window, toolbar->toolbar_handle);
}
- /* The help prefix changes from edit to non-edit more. */
+ /* The help prefix changes from edit to non-edit mode. */
ro_gui_wimp_event_set_help_prefix(toolbar->toolbar_handle,
(toolbar->editing) ?
@@ -1538,7 +1538,6 @@ void ro_toolbar_start_throbbing(struct toolbar *toolbar)
/* This is an exported interface documented in toolbar.h */
-
void ro_toolbar_stop_throbbing(struct toolbar *toolbar)
{
if (toolbar != NULL && toolbar->throbber != NULL)
@@ -1547,7 +1546,16 @@ void ro_toolbar_stop_throbbing(struct toolbar *toolbar)
/* This is an exported interface documented in toolbar.h */
+void ro_toolbar_page_info_change(struct toolbar *toolbar)
+{
+ if (toolbar == NULL || toolbar->url == NULL)
+ return;
+
+ ro_gui_url_bar_page_info_change(toolbar->url);
+}
+
+/* This is an exported interface documented in toolbar.h */
void ro_toolbar_throb(struct toolbar *toolbar)
{
if (toolbar != NULL && toolbar->throbber != NULL)
@@ -1656,7 +1664,6 @@ bool ro_toolbar_get_url_field_extent(struct toolbar *toolbar, os_box *extent)
/* This is an exported interface documented in toolbar.h */
-
void ro_toolbar_set_site_favicon(struct toolbar *toolbar,
struct hlcache_handle *h)
{
@@ -1668,7 +1675,6 @@ void ro_toolbar_set_site_favicon(struct toolbar *toolbar,
/* This is an exported interface documented in toolbar.h */
-
void ro_toolbar_set_content_favicon(struct toolbar *toolbar,
struct gui_window *g)
{
diff --git a/frontends/riscos/toolbar.h b/frontends/riscos/toolbar.h
index 41f1af728..9bca44525 100644
--- a/frontends/riscos/toolbar.h
+++ b/frontends/riscos/toolbar.h
@@ -304,7 +304,6 @@ int ro_toolbar_full_height(struct toolbar *toolbar);
*
* \param *toolbar the toolbar to start throbbing.
*/
-
void ro_toolbar_start_throbbing(struct toolbar *toolbar);
@@ -538,5 +537,14 @@ bool ro_toolbar_get_editing(struct toolbar *toolbar);
bool ro_toolbar_toggle_edit(struct toolbar *toolbar);
+
+/**
+ * Update the page information indicator.
+ *
+ * \param toolbar the toolbar to update the page info in.
+ */
+void ro_toolbar_page_info_change(struct toolbar *toolbar);
+
+
#endif
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 96346f800..fcb6b08f2 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -3762,7 +3762,6 @@ static void gui_window_start_throbber(struct gui_window *g)
}
-
/**
* Update the interface to reflect page loading stopped.
*
@@ -3777,6 +3776,20 @@ static void gui_window_stop_throbber(struct gui_window *g)
g->active = false;
}
+
+/**
+ * Update the interface to reflect change in page info status
+ *
+ * \param gw window with start of load
+ */
+static void gui_window_page_info_change(struct gui_window *gw)
+{
+ if (gw->toolbar != NULL) {
+ ro_toolbar_page_info_change(gw->toolbar);
+ }
+}
+
+
/**
* set favicon
*/
@@ -3790,7 +3803,6 @@ gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
}
-
/**
* Remove the caret, if present.
*
@@ -4174,6 +4186,10 @@ ro_gui_window_event(struct gui_window *gw, enum gui_window_event event)
gui_start_selection(gw);
break;
+ case GW_EVENT_PAGE_INFO_CHANGE:
+ gui_window_page_info_change(gw);
+ break;
+
default:
break;
}