summaryrefslogtreecommitdiff
path: root/riscos/configure
diff options
context:
space:
mode:
authorSteve Fryatt <steve@stevefryatt.org.uk>2011-02-20 23:16:33 +0000
committerSteve Fryatt <steve@stevefryatt.org.uk>2011-02-20 23:16:33 +0000
commitcd9c0998e9849472473e577c4c04906e380896e1 (patch)
tree9bef19ebd3d56eccd03fa5613f1506c82762584b /riscos/configure
parentf54fc080c2a96ffdb713a9c8b5d0ccb604197c07 (diff)
downloadnetsurf-cd9c0998e9849472473e577c4c04906e380896e1.tar.gz
netsurf-cd9c0998e9849472473e577c4c04906e380896e1.tar.bz2
Merge branches/stevef/toolbars to trunk.
svn path=/trunk/netsurf/; revision=11741
Diffstat (limited to 'riscos/configure')
-rw-r--r--riscos/configure/con_connect.c12
-rw-r--r--riscos/configure/con_home.c32
-rw-r--r--riscos/configure/con_image.c21
-rw-r--r--riscos/configure/con_theme.c39
4 files changed, 76 insertions, 28 deletions
diff --git a/riscos/configure/con_connect.c b/riscos/configure/con_connect.c
index 70236f23a..fd74155bd 100644
--- a/riscos/configure/con_connect.c
+++ b/riscos/configure/con_connect.c
@@ -60,7 +60,8 @@
static int ro_gui_options_connection_proxy_type(wimp_w w);
static void ro_gui_options_connection_default(wimp_pointer *pointer);
static bool ro_gui_options_connection_ok(wimp_w w);
-static void ro_gui_options_connection_update(wimp_w w, wimp_i i);
+static bool ro_gui_options_connection_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a);
bool ro_gui_options_connection_initialise(wimp_w w)
{
@@ -88,7 +89,7 @@ bool ro_gui_options_connection_initialise(wimp_w w)
option_max_fetchers_per_host);
ro_gui_set_icon_integer(w, CONNECTION_CACHE_FETCH_FIELD,
option_max_cached_fetch_handles);
- ro_gui_options_connection_update(w, -1);
+ ro_gui_options_connection_update(w, -1, NULL, NULL, NO_ACTION);
/* register icons */
ro_gui_wimp_event_register_menu_gright(w, CONNECTION_PROXY_FIELD,
@@ -124,7 +125,8 @@ bool ro_gui_options_connection_initialise(wimp_w w)
}
-void ro_gui_options_connection_update(wimp_w w, wimp_i i)
+bool ro_gui_options_connection_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a)
{
int proxy_type;
bool host, user;
@@ -142,6 +144,8 @@ void ro_gui_options_connection_update(wimp_w w, wimp_i i)
ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_USERNAME, !user);
ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PASSWORD_LABEL, !user);
ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PASSWORD, !user);
+
+ return true;
}
int ro_gui_options_connection_proxy_type(wimp_w w)
@@ -169,7 +173,7 @@ void ro_gui_options_connection_default(wimp_pointer *pointer)
ro_gui_set_icon_integer(pointer->w, CONNECTION_MAX_FETCH_FIELD, 24);
ro_gui_set_icon_integer(pointer->w, CONNECTION_HOST_FETCH_FIELD, 5);
ro_gui_set_icon_integer(pointer->w, CONNECTION_CACHE_FETCH_FIELD, 6);
- ro_gui_options_connection_update(pointer->w, -1);
+ ro_gui_options_connection_update(pointer->w, -1, NULL, NULL, NO_ACTION);
}
bool ro_gui_options_connection_ok(wimp_w w)
diff --git a/riscos/configure/con_home.c b/riscos/configure/con_home.c
index fbe1b7039..65cc4e39a 100644
--- a/riscos/configure/con_home.c
+++ b/riscos/configure/con_home.c
@@ -30,7 +30,6 @@
#include "utils/messages.h"
#include "utils/utils.h"
-
#define HOME_URL_FIELD 3
#define HOME_URL_GRIGHT 4
#define HOME_OPEN_STARTUP 5
@@ -40,6 +39,8 @@
static void ro_gui_options_home_default(wimp_pointer *pointer);
static bool ro_gui_options_home_ok(wimp_w w);
+static bool ro_gui_options_home_menu_prepare(wimp_w w, wimp_i i,
+ wimp_menu *menu, wimp_pointer *pointer);
bool ro_gui_options_home_initialise(wimp_w w)
{
@@ -53,13 +54,15 @@ bool ro_gui_options_home_initialise(wimp_w w)
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_menu_gright(w, HOME_URL_FIELD,
- HOME_URL_GRIGHT, url_suggest_menu);
+ HOME_URL_GRIGHT, ro_gui_url_suggest_menu);
ro_gui_wimp_event_register_checkbox(w, HOME_OPEN_STARTUP);
ro_gui_wimp_event_register_button(w, HOME_DEFAULT_BUTTON,
ro_gui_options_home_default);
ro_gui_wimp_event_register_cancel(w, HOME_CANCEL_BUTTON);
ro_gui_wimp_event_register_ok(w, HOME_OK_BUTTON,
ro_gui_options_home_ok);
+ ro_gui_wimp_event_register_menu_prepare(w,
+ ro_gui_options_home_menu_prepare);
ro_gui_wimp_event_set_help_prefix(w, "HelpHomeConfig");
ro_gui_wimp_event_memorise(w);
return true;
@@ -84,3 +87,28 @@ bool ro_gui_options_home_ok(wimp_w w)
ro_gui_save_options();
return true;
}
+
+
+/**
+ * Callback to prepare menus in the Configure Home dialog. At present, this
+ * only has to handle the URL Suggestion pop-up.
+ *
+ * \param w The window handle owning the menu.
+ * \param i The icon handle owning the menu.
+ * \param *menu The menu to be prepared.
+ * \param *pointer The associated mouse click event block, or NULL
+ * on an Adjust-click re-opening.
+ * \return true if the event was handled; false if not.
+ */
+
+bool ro_gui_options_home_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
+ wimp_pointer *pointer)
+{
+ if (menu != ro_gui_url_suggest_menu || i != HOME_URL_GRIGHT)
+ return false;
+
+ if (pointer != NULL)
+ ro_gui_url_suggest_prepare_menu();
+
+ return true;
+}
diff --git a/riscos/configure/con_image.c b/riscos/configure/con_image.c
index 45925d39b..1cb29a267 100644
--- a/riscos/configure/con_image.c
+++ b/riscos/configure/con_image.c
@@ -50,8 +50,9 @@
static bool ro_gui_options_image_click(wimp_pointer *pointer);
static bool ro_gui_options_image_ok(wimp_w w);
static void ro_gui_options_image_redraw(wimp_draw *redraw);
-static void ro_gui_options_image_update(wimp_w w, wimp_i i);
-static void ro_gui_options_image_read(wimp_w w, unsigned int *bg,
+static bool ro_gui_options_image_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a);
+static void ro_gui_options_image_read(wimp_w w, unsigned int *bg,
unsigned int *fg);
static void ro_gui_options_update_shading(wimp_w w);
@@ -86,7 +87,7 @@ bool ro_gui_options_image_initialise(wimp_w w)
image_quality_menu->entries[i].
data.indirected_text.text, true);
}
- ro_gui_set_icon_decimal(w, IMAGE_SPEED_FIELD,
+ ro_gui_set_icon_decimal(w, IMAGE_SPEED_FIELD,
option_minimum_gif_delay, 2);
ro_gui_set_icon_selected_state(w, IMAGE_DISABLE_ANIMATION,
!option_animate_images);
@@ -127,9 +128,12 @@ void ro_gui_options_image_finalise(wimp_w w)
ro_gui_wimp_event_finalise(w);
}
-void ro_gui_options_image_update(wimp_w w, wimp_i i)
+bool ro_gui_options_image_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a)
{
ro_gui_redraw_icon(w, IMAGE_CURRENT_DISPLAY);
+
+ return true;
}
void ro_gui_options_image_redraw(wimp_draw *redraw)
@@ -204,11 +208,11 @@ bool ro_gui_options_image_click(wimp_pointer *pointer)
ro_gui_options_image_read(pointer->w, &old_bg, &old_fg);
switch (pointer->i) {
case IMAGE_DEFAULT_BUTTON:
- ro_gui_set_icon_string(pointer->w,
+ ro_gui_set_icon_string(pointer->w,
IMAGE_FOREGROUND_FIELD,
image_quality_menu->entries[3].
data.indirected_text.text, true);
- ro_gui_set_icon_string(pointer->w,
+ ro_gui_set_icon_string(pointer->w,
IMAGE_BACKGROUND_FIELD,
image_quality_menu->entries[2].
data.indirected_text.text, true);
@@ -228,7 +232,8 @@ bool ro_gui_options_image_click(wimp_pointer *pointer)
ro_gui_options_image_read(pointer->w, &bg, &fg);
if ((bg != old_bg) || (fg != old_fg))
- ro_gui_options_image_update(pointer->w, pointer->i);
+ ro_gui_options_image_update(pointer->w, pointer->i,
+ NULL, NULL, NO_ACTION);
return false;
}
@@ -247,7 +252,7 @@ void ro_gui_options_update_shading(wimp_w w)
bool ro_gui_options_image_ok(wimp_w w)
{
- ro_gui_options_image_read(w, (unsigned int *) &option_bg_plot_style,
+ ro_gui_options_image_read(w, (unsigned int *) &option_bg_plot_style,
(unsigned int *) &option_fg_plot_style);
option_minimum_gif_delay = ro_gui_get_icon_decimal(w,
IMAGE_SPEED_FIELD, 2);
diff --git a/riscos/configure/con_theme.c b/riscos/configure/con_theme.c
index 0954a31e9..a6dc98265 100644
--- a/riscos/configure/con_theme.c
+++ b/riscos/configure/con_theme.c
@@ -29,6 +29,7 @@
#include "riscos/menus.h"
#include "riscos/options.h"
#include "riscos/theme.h"
+#include "riscos/toolbar.h"
#include "riscos/url_complete.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
@@ -261,11 +262,17 @@ void ro_gui_options_theme_load(void)
/* create toolbars for each theme */
theme_count = 0;
descriptor = theme_list;
- while (descriptor) {
+ while (descriptor != NULL) {
/* try to create a toolbar */
- toolbar = ro_gui_theme_create_toolbar(descriptor,
- THEME_BROWSER_TOOLBAR);
- if (toolbar) {
+ toolbar = ro_toolbar_create(descriptor, NULL,
+ THEME_STYLE_BROWSER_TOOLBAR,
+ TOOLBAR_FLAGS_DISPLAY, NULL, NULL, NULL);
+ if (toolbar != NULL) {
+ ro_toolbar_add_buttons(toolbar, brower_toolbar_buttons,
+ option_toolbar_browser);
+ ro_toolbar_add_url(toolbar);
+ ro_toolbar_add_throbber(toolbar);
+ ro_toolbar_rebuild(toolbar);
toolbar_display = calloc(sizeof(struct toolbar_display), 1);
if (!toolbar_display) {
LOG(("No memory for calloc()"));
@@ -311,21 +318,23 @@ void ro_gui_options_theme_load(void)
/* update the toolbar */
item_height = 44 + 44 + 16;
if (link->next) item_height += 16;
- ro_gui_theme_process_toolbar(link->toolbar, parent_width);
- extent.y0 = nested_y - link->toolbar->height - item_height;
+ ro_toolbar_process(link->toolbar, parent_width, false);
+ extent.y0 = nested_y -
+ ro_toolbar_height(link->toolbar) -
+ item_height;
if (link->next) extent.y0 -= 16;
if (extent.y0 > min_extent) extent.y0 = min_extent;
xwimp_set_extent(theme_pane, &extent);
- ro_gui_set_icon_button_type(link->toolbar->toolbar_handle,
- ICON_TOOLBAR_URL, wimp_BUTTON_NEVER);
/* create the descriptor icons and separator line */
new_icon.icon.extent.x0 = 8;
new_icon.icon.extent.x1 = parent_width - 8;
new_icon.icon.flags &= ~wimp_ICON_BORDER;
new_icon.icon.flags |= wimp_ICON_SPRITE;
- new_icon.icon.extent.y1 = nested_y - link->toolbar->height - 8;
- new_icon.icon.extent.y0 = nested_y - link->toolbar->height - 52;
+ new_icon.icon.extent.y1 = nested_y -
+ ro_toolbar_height(link->toolbar) - 8;
+ new_icon.icon.extent.y0 = nested_y -
+ ro_toolbar_height(link->toolbar) - 52;
new_icon.icon.data.indirected_text_and_sprite.text =
(char *)&link->descriptor->name;
new_icon.icon.data.indirected_text_and_sprite.size =
@@ -363,10 +372,11 @@ void ro_gui_options_theme_load(void)
}
/* nest the toolbar window */
- state.w = link->toolbar->toolbar_handle;
+ state.w = ro_toolbar_get_window(link->toolbar);
state.yscroll = 0;
state.visible.y1 = nested_y + base_extent;
- state.visible.y0 = state.visible.y1 - link->toolbar->height + 2;
+ state.visible.y0 = state.visible.y1 -
+ ro_toolbar_height(link->toolbar) + 2;
xwimp_open_window_nested(PTR_WIMP_OPEN(&state), theme_pane,
wimp_CHILD_LINKS_PARENT_WORK_AREA
<< wimp_CHILD_BS_EDGE_SHIFT |
@@ -374,7 +384,8 @@ void ro_gui_options_theme_load(void)
<< wimp_CHILD_TS_EDGE_SHIFT);
/* continue processing */
- nested_y -= link->toolbar->height + item_height;
+ nested_y -= ro_toolbar_height(link->toolbar) +
+ item_height;
link = link->next;
}
@@ -404,7 +415,7 @@ void ro_gui_options_theme_free(void)
if (next_toolbar)
xwimp_delete_icon(theme_pane,
toolbar->icon_number + 2);
- ro_gui_theme_destroy_toolbar(toolbar->toolbar);
+ ro_toolbar_destroy(toolbar->toolbar);
free(toolbar);
}
toolbars = NULL;