summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2004-08-08 20:16:17 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2004-08-08 20:16:17 +0000
commitafa046e1be4d01acdc035fbec2dab530c9e48abe (patch)
tree107f18b3e95d681dc5261b3dae8193cb49004ceb /riscos
parent8337acfc7839cde431d4761bbe693f0faa17b741 (diff)
downloadnetsurf-afa046e1be4d01acdc035fbec2dab530c9e48abe.tar.gz
netsurf-afa046e1be4d01acdc035fbec2dab530c9e48abe.tar.bz2
[project @ 2004-08-08 20:16:17 by rjw]
Internal changes for theme handling. Tinct is now an external resource. svn path=/import/netsurf/; revision=1196
Diffstat (limited to 'riscos')
-rw-r--r--riscos/dialog.c50
-rw-r--r--riscos/gui.c6
-rw-r--r--riscos/theme.c264
-rw-r--r--riscos/theme.h22
-rw-r--r--riscos/toolbar.c29
-rw-r--r--riscos/toolbar.h4
-rw-r--r--riscos/window.c10
7 files changed, 221 insertions, 164 deletions
diff --git a/riscos/dialog.c b/riscos/dialog.c
index e4ece4b9c..126d1bcc8 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -78,7 +78,7 @@ static void ro_gui_dialog_click_zoom(wimp_pointer *pointer);
static void ro_gui_dialog_reset_zoom(void);
static void ro_gui_dialog_click_warning(wimp_pointer *pointer);
static const char *language_name(const char *code);
-
+static struct theme_entry *ro_gui_theme_entry(int index);
/**
* Load and create dialogs from template file.
@@ -478,7 +478,7 @@ void ro_gui_dialog_config_prepare(void)
if (option_theme)
theme_choice = strdup(option_theme);
if (theme_list)
- ro_theme_list_free(theme_list, theme_list_entries);
+ ro_theme_free(theme_list);
theme_list = ro_theme_list(&theme_list_entries);
}
@@ -545,8 +545,7 @@ void ro_gui_dialog_click_config(wimp_pointer *pointer)
if (pointer->buttons == wimp_CLICK_SELECT) {
ro_gui_dialog_close(dialog_config);
if (theme_list) {
- ro_theme_list_free(theme_list,
- theme_list_entries);
+ ro_theme_free(theme_list);
theme_list = 0;
}
}
@@ -822,12 +821,12 @@ void ro_gui_dialog_click_config_th_pane(wimp_pointer *pointer)
if (!theme_list || theme_list_entries <= y)
return;
- if (theme_choice && strcmp(theme_choice, theme_list[y].name) == 0)
+ if (theme_choice && strcmp(theme_choice, ro_gui_theme_entry(y)->name) == 0)
return;
if (theme_choice) {
for (i = 0; i != theme_list_entries &&
- strcmp(theme_choice, theme_list[i].name); i++)
+ strcmp(theme_choice, ro_gui_theme_entry(i)->name); i++)
;
if (i != theme_list_entries) {
error = xwimp_force_redraw(dialog_config_th_pane,
@@ -843,7 +842,7 @@ void ro_gui_dialog_click_config_th_pane(wimp_pointer *pointer)
}
free(theme_choice);
- theme_choice = strdup(theme_list[y].name);
+ theme_choice = strdup(ro_gui_theme_entry(y)->name);
error = xwimp_force_redraw(dialog_config_th_pane,
0, -y * THEME_HEIGHT - THEME_HEIGHT - 2,
@@ -856,6 +855,11 @@ void ro_gui_dialog_click_config_th_pane(wimp_pointer *pointer)
}
}
+struct theme_entry *ro_gui_theme_entry(int index) {
+ struct theme_entry *entry = theme_list;
+ for (int i = 0; i < index; i++) entry = entry->next;
+ return entry;
+}
/**
* Redraw the scrolling Theme Choices list pane.
@@ -912,7 +916,7 @@ void ro_gui_redraw_config_th_pane_plot(wimp_draw *redraw)
/* plot background for selected theme */
if (theme_choice &&
- strcmp(theme_list[i].name, theme_choice) == 0) {
+ strcmp(ro_gui_theme_entry(i)->name, theme_choice) == 0) {
error = xcolourtrans_set_gcol(os_COLOUR_LIGHT_GREY,
0, os_ACTION_OVERWRITE, 0, 0);
if (error)
@@ -931,25 +935,27 @@ void ro_gui_redraw_config_th_pane_plot(wimp_draw *redraw)
}
/* icons */
- icon.extent.y0 = -i * THEME_HEIGHT - THEME_HEIGHT;
- icon.extent.y1 = -i * THEME_HEIGHT;
- icon.data.indirected_sprite.area = theme_list[i].sprite_area;
- icon.data.indirected_sprite.size = 12;
- for (j = 0, x = 0; j != sizeof sprite / sizeof sprite[0]; j++) {
- icon.extent.x0 = x;
- icon.extent.x1 = x + 50;
- icon.data.indirected_sprite.id =
- (osspriteop_id) sprite[j];
- error = xwimp_plot_icon(&icon);
- if (error)
- break;
- x += 50;
+ if (ro_gui_theme_entry(i)->sprite_area) {
+ icon.extent.y0 = -i * THEME_HEIGHT - THEME_HEIGHT;
+ icon.extent.y1 = -i * THEME_HEIGHT;
+ icon.data.indirected_sprite.area = ro_gui_theme_entry(i)->sprite_area;
+ icon.data.indirected_sprite.size = 12;
+ for (j = 0, x = 0; j != sizeof sprite / sizeof sprite[0]; j++) {
+ icon.extent.x0 = x;
+ icon.extent.x1 = x + 50;
+ icon.data.indirected_sprite.id =
+ (osspriteop_id) sprite[j];
+ error = xwimp_plot_icon(&icon);
+ if (error)
+ break;
+ x += 50;
+ }
}
if (error)
break;
/* theme name */
- error = xwimptextop_paint(0, theme_list[i].name,
+ error = xwimptextop_paint(0, ro_gui_theme_entry(i)->name,
x0 + 400,
y0 - i * THEME_HEIGHT - THEME_HEIGHT / 2);
if (error)
diff --git a/riscos/gui.c b/riscos/gui.c
index 44e76ed4e..ebc450e3d 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -165,6 +165,7 @@ void gui_init(int argc, char** argv)
char theme_fname[256];
os_error *error;
int length;
+ struct theme_entry *theme;
xhourglass_start(1);
@@ -223,7 +224,10 @@ void gui_init(int argc, char** argv)
}
if (option_theme == NULL)
strcpy(theme_fname, "<NetSurf$Dir>.Themes.Default");
- ro_theme_load(theme_fname);
+ theme = ro_theme_load(theme_fname);
+ if (theme == NULL)
+ LOG(("Unable to load default theme"));
+ ro_theme_apply(theme);
if ((length = snprintf(path, sizeof(path),
"<NetSurf$Dir>.Resources.%s.Templates",
diff --git a/riscos/theme.c b/riscos/theme.c
index 637aa8f52..c236bab2e 100644
--- a/riscos/theme.c
+++ b/riscos/theme.c
@@ -29,103 +29,146 @@
#include "netsurf/utils/utils.h"
#include "netsurf/utils/log.h"
-/* Current sprite area
+/* Current theme
*/
-static osspriteop_area *theme_sprite_area = 0;
+static struct theme_entry *ro_theme_current = NULL;
-/* Throbber details
-*/
-int theme_throbs;
-static int throbber_width;
-static int throbber_height;
+
+/**
+ * Apply the current theme
+ *
+ * /param theme the theme to apply
+ */
+void ro_theme_apply(struct theme_entry *theme) {
+#ifdef WITH_KIOSK_THEMES
+ char *kioskfilename = alloca(strlen(pathname) + 16);
+#endif
+
+ /* Release any previous theme
+ */
+ if (ro_theme_current) ro_theme_free(ro_theme_current);
+
+ /* Set the current theme
+ */
+ ro_theme_current = theme;
+
+ /* Load the window furniture if using Kiosk Themes
+ *
+ * Yes I know this is one serious hack!
+ * I'll do something a little more "realistic" when I've
+ * finished various other bits... Right now it works.
+ */
+#ifdef WITH_KIOSK_THEMES
+ sprintf(kioskfilename, "%s.!SetTheme", pathname);
+ xos_cli(kioskfilename);
+#endif
+
+ /* todo: update all current windows */
+}
/**
* Load a theme from a directory.
*
- * The directory must contain a Templates file containing the toolbar template,
- * and a Sprites file containing icons.
+ * Ideally, the directory should contain a Sprite file and a Text options file.
+ * If the path is invalid, or neither of these are present then a default theme
+ * is returned with no icons present.
*/
-void ro_theme_load(char *pathname) {
+struct theme_entry *ro_theme_load(char *pathname) {
osbool mask;
os_mode mode;
os_coord dimensions;
int size, i, n;
char *filename = alloca(strlen(pathname) + 16);
- char *kioskfilename = alloca(strlen(pathname) + 16);
fileswitch_object_type obj_type;
-
- /* Release previous sprite are
- */
- free(theme_sprite_area);
- theme_sprite_area = NULL;
-
- /* Reset the throbber variables
+ struct theme_entry *theme;
+ os_error *error;
+
+ /* Get some memory for the theme
*/
- theme_throbs = 0;
- throbber_height = 0;
- throbber_width = 0;
+ theme = (struct theme_entry *)calloc(1, sizeof(struct theme_entry));
+ if (!theme) {
+ LOG(("Failed to claim memory to hold theme."));
+ warn_user("NoMemory", 0);
+ return NULL;
+ }
+ theme->default_settings = true;
/* Load the sprites
*/
sprintf(filename, "%s.Sprites", pathname);
xosfile_read_no_path(filename, &obj_type, 0, 0, &size, 0);
- /* Load the window furniture if using Kiosk Themes
- *
- * Yes I know this is one serious hack!
- * I'll do something a little more "realistic" when I've
- * finished various other bits... Right now it works.
- */
-#ifdef WITH_KIOSK_THEMES
- sprintf(kioskfilename, "%s.!SetTheme", pathname);
- xos_cli(kioskfilename);
-
-#endif
/* Claim memory for a sprite file if we have one
*/
- if (obj_type & fileswitch_IS_FILE) theme_sprite_area = malloc(size + 16);
+ if (obj_type & fileswitch_IS_FILE) theme->sprite_area = malloc(size + 16);
/* Load the sprite file if we have any memory
*/
- if (theme_sprite_area) {
+ if (theme->sprite_area) {
/* Initialise then load
*/
- theme_sprite_area->size = size + 16;
- theme_sprite_area->sprite_count = 0;
- theme_sprite_area->first = 16;
- theme_sprite_area->used = 16;
- xosspriteop_clear_sprites(osspriteop_USER_AREA, theme_sprite_area);
- xosspriteop_load_sprite_file(osspriteop_USER_AREA, theme_sprite_area,
+ theme->sprite_area->size = size + 16;
+ theme->sprite_area->sprite_count = 0;
+ theme->sprite_area->first = 16;
+ theme->sprite_area->used = 16;
+ xosspriteop_clear_sprites(osspriteop_USER_AREA, theme->sprite_area);
+ error = xosspriteop_load_sprite_file(osspriteop_USER_AREA, theme->sprite_area,
filename);
+ if (error) {
+ free(theme->sprite_area);
+ theme->sprite_area = NULL;
+ }
+ }
+
+ /* Get the throbber details
+ */
+ if (theme->sprite_area) {
+ /* We aren't default
+ */
+ theme->default_settings = false;
/* Find the highest sprite called 'throbber%i', and get the maximum
dimensions for all 'thobber%i' icons. We use the filename buffer
as the temporary spritename buffer as it is guaranteed to be at
least 12 bytes (max sprite name size).
*/
- for (i = 1; i <= theme_sprite_area->sprite_count; i++) {
+ for (i = 1; i <= theme->sprite_area->sprite_count; i++) {
osspriteop_return_name(osspriteop_USER_AREA,
- theme_sprite_area, filename, 12, i);
+ theme->sprite_area, filename, 12, i);
if (strncmp(filename, "throbber", 8) == 0) {
/* Get the max sprite width/height
*/
xosspriteop_read_sprite_info(osspriteop_USER_AREA,
- theme_sprite_area, (osspriteop_id)filename,
+ theme->sprite_area, (osspriteop_id)filename,
&dimensions.x, &dimensions.y, &mask, &mode);
ro_convert_pixels_to_os_units(&dimensions, mode);
- if (dimensions.x > throbber_width) throbber_width = dimensions.x;
- if (dimensions.y > throbber_height) throbber_height = dimensions.y;
+ if (dimensions.x > theme->throbber_width)
+ theme->throbber_width = dimensions.x;
+ if (dimensions.y > theme->throbber_height)
+ theme->throbber_height = dimensions.y;
/* Get the throbber number
*/
n = atoi(filename + 8);
- if (theme_throbs < n) theme_throbs = n;
+ if (theme->throbber_frames < n) theme->throbber_frames = n;
}
}
}
+
+ /* Load the options
+ */
+ theme->browser_background = wimp_COLOUR_VERY_LIGHT_GREY;
+ theme->hotlist_background = wimp_COLOUR_VERY_LIGHT_GREY;
+ theme->status_background = wimp_COLOUR_VERY_LIGHT_GREY;
+ theme->status_foreground = wimp_COLOUR_BLACK;
+ /* todo: impement option loading */
+
+ /* Return our new theme
+ */
+ return theme;
}
@@ -146,14 +189,12 @@ void ro_theme_create_browser_toolbar(struct gui_window *g) {
}
/* Create a toolbar
*/
- toolbar = ro_toolbar_create(theme_sprite_area, g->url, g->status,
+ toolbar = ro_toolbar_create(ro_theme_current, g->url, g->status,
g->throb_buf, TOOLBAR_BROWSER);
if (toolbar == NULL) return;
- /* Set up the throbber
+ /* Set up the default status width
*/
- toolbar->throbber_width = throbber_width;
- toolbar->throbber_height = throbber_height;
toolbar->status_width = 640;
/* Store our toolbar
@@ -184,7 +225,7 @@ void ro_theme_create_hotlist_toolbar(void) {
/* Create a toolbar
*/
- toolbar = ro_toolbar_create(theme_sprite_area, NULL, NULL,
+ toolbar = ro_toolbar_create(ro_theme_current, NULL, NULL,
NULL, TOOLBAR_HOTLIST);
if (toolbar == NULL) return;
@@ -351,23 +392,20 @@ int ro_theme_resize_toolbar(struct toolbar *toolbar, wimp_w window) {
/**
* Make a list of available themes.
*
- * \param entries updated to number of themes
- * \return array of struct theme_entry, or 0 on error, and error reported
+ * \return a forwardly link list of available themes
*/
-struct theme_entry *ro_theme_list(unsigned int *entries)
-{
+struct theme_entry *ro_theme_list(unsigned int *entries) {
char pathname[256];
- unsigned int i = 0, n = 0;
int context = 0;
int read_count;
- struct theme_entry *list = 0, *list1;
- fileswitch_object_type obj_type;
- int file_type;
+ struct theme_entry *first = NULL;
+ struct theme_entry *last = NULL;
+ struct theme_entry *theme = NULL;
osgbpb_INFO(100) info;
os_error *error;
- /* invariant: list[0..n) are valid */
+ *entries = 0;
while (context != -1) {
error = xosgbpb_dir_entries_info(THEMES_DIR,
(osgbpb_info_list *) &info, 1, context,
@@ -376,82 +414,64 @@ struct theme_entry *ro_theme_list(unsigned int *entries)
LOG(("xosgbpb_dir_entries_info: 0x%x: %s",
error->errnum, error->errmess));
warn_user("MiscError", error->errmess);
- ro_theme_list_free(list, n);
- return 0;
+ ro_theme_free(first);
+ *entries = 0;
+ return NULL;
}
if (read_count == 0)
continue;
- if (info.obj_type != fileswitch_IS_DIR)
- continue;
- /* check for presence of Sprites in directory */
- snprintf(pathname, sizeof pathname, "%s.%s.%s",
- THEMES_DIR, info.name, "Sprites");
+ /* Get our directory name
+ */
+ snprintf(pathname, sizeof pathname, "%s.%s",
+ THEMES_DIR, info.name);
pathname[sizeof pathname - 1] = 0;
- error = xosfile_read_stamped_no_path(pathname,
- &obj_type, 0, 0, 0, 0, &file_type);
- if (error) {
- LOG(("xosfile_read_stamped_no_path: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("MiscError", error->errmess);
- ro_theme_list_free(list, n);
- return 0;
- }
- if (obj_type != fileswitch_IS_FILE ||
- file_type != osfile_TYPE_SPRITE)
- continue;
-
- /* expand list */
- list1 = realloc(list, sizeof *list * (i + 1));
- if (!list1) {
- warn_user("NoMemory", 0);
- ro_theme_list_free(list, n);
- return 0;
- }
- list = list1;
-
- /* update invariant */
- list[i].name = 0;
- list[i].sprite_area = 0;
- n = i + 1;
-
- /* copy name */
- list[i].name = strdup(info.name);
- if (!list[i].name) {
- warn_user("NoMemory", 0);
- ro_theme_list_free(list, n);
- return 0;
- }
-
- /* load sprites */
- list[i].sprite_area = ro_gui_load_sprite_file(pathname);
- if (!list[i].sprite_area) {
- ro_theme_list_free(list, n);
- return 0;
+
+ /* Load the theme and link it in
+ */
+ theme = ro_theme_load(pathname);
+ if (theme && !(theme->default_settings)) {
+ if (first) {
+ last->next = theme;
+ } else {
+ first = theme;
+ }
+ last = theme;
+ *entries = *entries + 1;
+
+ /* Copy name. This should be done when loading.
+ */
+ theme->name = strdup(info.name);
+ if (!theme->name) {
+ warn_user("NoMemory", 0);
+ ro_theme_free(first);
+ *entries = 0;
+ return NULL;
+ }
+ } else {
+ if (theme) ro_theme_free(theme);
}
-
- i++;
}
-
- *entries = n;
- return list;
+ return first;
}
/**
- * Free an array of themes, as returned by ro_theme_list().
+ * Free a linked list of themes.
*
- * \param list array of struct theme_entry
- * \param entries size of array
+ * \param theme the list of themes to free
*/
-void ro_theme_list_free(struct theme_entry *list, unsigned int entries)
-{
- unsigned int i;
- for (i = 0; i != entries; i++) {
- free(list[i].name);
- free(list[i].sprite_area);
+void ro_theme_free(struct theme_entry *theme) {
+ struct theme_entry *next;
+ while (theme) {
+ free(theme->name);
+ free(theme->author);
+ free(theme->sprite_area);
+ next = theme->next;
+ free(theme);
+ theme = next;
}
- free(list);
}
+
diff --git a/riscos/theme.h b/riscos/theme.h
index 613da245c..8c06be5fb 100644
--- a/riscos/theme.h
+++ b/riscos/theme.h
@@ -23,18 +23,28 @@
struct toolbar;
struct theme_entry {
- char *name;
- osspriteop_area *sprite_area;
-};
+ char *name; /**< theme name */
+ char *author; /**< theme author */
+ osspriteop_area *sprite_area; /**< sprite area for theme */
+ int throbber_width; /**< width of the throbber */
+ int throbber_height; /**< height of the throbber */
+ int throbber_frames; /**< frames of animation for the throbber */
+ int browser_background; /**< background colour of browser toolbar */
+ int hotlist_background; /**< background colour of hotlist toolbar */
+ int status_background; /**< background colour of status window */
+ int status_foreground; /**< colour of status window text */
+ bool default_settings; /**< no theme was loaded, defaults used */
+ struct theme_entry *next; /**< next entry in theme list */
-extern int theme_throbs;
+};
-void ro_theme_load(char *pathname);
+void ro_theme_apply(struct theme_entry *theme);
+struct theme_entry *ro_theme_load(char *pathname);
void ro_theme_create_browser_toolbar(struct gui_window *g);
void ro_theme_create_hotlist_toolbar(void);
int ro_theme_update_toolbar(struct toolbar *toolbar, wimp_w window);
int ro_theme_resize_toolbar(struct toolbar *toolbar, wimp_w window);
struct theme_entry *ro_theme_list(unsigned int *entries);
-void ro_theme_list_free(struct theme_entry *list, unsigned int entries);
+void ro_theme_free(struct theme_entry *theme);
#endif
diff --git a/riscos/toolbar.c b/riscos/toolbar.c
index 873c6c5a8..55d0ce820 100644
--- a/riscos/toolbar.c
+++ b/riscos/toolbar.c
@@ -17,6 +17,7 @@
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "netsurf/riscos/gui.h"
+#include "netsurf/riscos/theme.h"
#include "netsurf/riscos/toolbar.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/utils/log.h"
@@ -98,14 +99,20 @@ static void ro_toolbar_add_icon(struct toolbar *toolbar, struct toolbar_icon *ic
/**
* Creates a toolbar with a complete set of icons
*
- * \param sprite_area the sprite area to read from
+ * \param theme the theme to use settings from
*/
-struct toolbar *ro_toolbar_create(osspriteop_area *sprite_area, char *url_buffer,
+struct toolbar *ro_toolbar_create(struct theme_entry *theme, char *url_buffer,
char *status_buffer, char *throbber_buffer,
int toolbar_type) {
+ osspriteop_area *sprite_area;
struct toolbar *toolbar;
wimp_i icon_handle;
+ /* Get our sprite area from the theme
+ */
+ if (!theme) return NULL;
+ sprite_area = theme->sprite_area;
+
/* Create a new toolbar
*/
toolbar = calloc(1, sizeof(struct toolbar));
@@ -118,6 +125,13 @@ struct toolbar *ro_toolbar_create(osspriteop_area *sprite_area, char *url_buffer
toolbar->status_old_width = 0xffffffff;
toolbar->type = toolbar_type;
+ /* Get the throbber details. These are held by the theme so we don't need
+ to query the sprite file each time.
+ */
+ toolbar->throbber_width = theme->throbber_width;
+ toolbar->throbber_height = theme->throbber_height;
+ toolbar->throbber_frames = theme->throbber_frames;
+
/* Load the toolbar icons
*/
if ((sprite_area) && (toolbar_type == TOOLBAR_BROWSER)) {
@@ -160,12 +174,18 @@ struct toolbar *ro_toolbar_create(osspriteop_area *sprite_area, char *url_buffer
*/
if (toolbar_type == TOOLBAR_BROWSER) {
empty_window.ymin = 36;
+ empty_window.work_bg = theme->status_background;
if (xwimp_create_window(&empty_window, &toolbar->status_handle)) {
ro_toolbar_destroy(toolbar);
return NULL;
}
}
empty_window.ymin = 1;
+ if (toolbar_type == TOOLBAR_BROWSER) {
+ empty_window.work_bg = theme->browser_background;
+ } else {
+ empty_window.work_bg = theme->hotlist_background;
+ }
if (xwimp_create_window(&empty_window, &toolbar->toolbar_handle)) {
ro_toolbar_destroy(toolbar);
return NULL;
@@ -179,8 +199,9 @@ struct toolbar *ro_toolbar_create(osspriteop_area *sprite_area, char *url_buffer
empty_icon.icon.extent.y0 = 0;
empty_icon.icon.extent.x1 = 16384;
empty_icon.icon.extent.y1 = 36;
- empty_icon.icon.flags = wimp_ICON_TEXT | (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
- wimp_ICON_INDIRECTED | wimp_ICON_VCENTRED;
+ empty_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED | wimp_ICON_VCENTRED |
+ (theme->status_foreground << wimp_ICON_FG_COLOUR_SHIFT) |
+ (theme->status_background << wimp_ICON_BG_COLOUR_SHIFT);
empty_icon.icon.data.indirected_text.text = status_buffer;
empty_icon.icon.data.indirected_text.validation = 0;
empty_icon.icon.data.indirected_text.size = 256;
diff --git a/riscos/toolbar.h b/riscos/toolbar.h
index a62bf3d99..4f68fd01e 100644
--- a/riscos/toolbar.h
+++ b/riscos/toolbar.h
@@ -12,6 +12,7 @@
#ifndef _NETSURF_RISCOS_TOOLBAR_H_
#define _NETSURF_RISCOS_TOOLBAR_H_
+#include "netsurf/riscos/theme.h"
#include "oslib/wimp.h"
@@ -34,6 +35,7 @@ struct toolbar {
*/
unsigned int throbber_width; // Throbber width (0 = unavaiable)
unsigned int throbber_height; // Throbber height (0 = unavaiable)
+ int throbber_frames; // Throbber frames (0 = unavaiable)
unsigned int status_window; // Show status window?
unsigned int standard_buttons; // Show standard buttons?
unsigned int url_bar; // Show URL bar?
@@ -55,7 +57,7 @@ struct toolbar {
};
-struct toolbar *ro_toolbar_create(osspriteop_area *sprite_area, char *url_buffer,
+struct toolbar *ro_toolbar_create(struct theme_entry *theme, char *url_buffer,
char *status_buffer, char *throbber_buffer, int toolbar_type);
void ro_toolbar_destroy(struct toolbar *toolbar);
void ro_toolbar_resize_status(struct toolbar *toolbar, int height);
diff --git a/riscos/window.c b/riscos/window.c
index caa692f19..7f97220fb 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -875,20 +875,16 @@ void ro_gui_throb(void)
os_t t;
struct gui_window *g;
- if (theme_throbs == 0)
- return;
-
xos_read_monotonic_time(&t);
for (g = window_list; g; g = g->next) {
- if (!g->bw->throbbing || !g->toolbar)
+ if (!g->bw->throbbing || !g->toolbar || (g->toolbar->throbber_frames == 0))
continue;
if (t < g->throbtime + 10)
continue;
-
g->throbtime = t;
g->throbber++;
- if (theme_throbs < g->throbber)
+ if (g->toolbar->throbber_frames < g->throbber)
g->throbber = 0;
sprintf(g->throb_buf, "throbber%i", g->throbber);
ro_gui_redraw_icon(g->toolbar->toolbar_handle,
@@ -1157,8 +1153,6 @@ void ro_gui_window_click(struct gui_window *g, wimp_pointer *pointer)
void gui_window_start_throbber(struct gui_window *g)
{
ro_gui_prepare_navigate(g);
- if (theme_throbs == 0)
- return;
xos_read_monotonic_time(&g->throbtime);
g->throbber = 0;
}