summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
Diffstat (limited to 'riscos')
-rw-r--r--riscos/dialog.c33
-rw-r--r--riscos/gui.c23
-rw-r--r--riscos/gui.h1
-rw-r--r--riscos/theme.c52
-rw-r--r--riscos/theme.h1
5 files changed, 89 insertions, 21 deletions
diff --git a/riscos/dialog.c b/riscos/dialog.c
index 32dbb2ddc..f55cb7b55 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -457,6 +457,39 @@ void ro_gui_dialog_click(wimp_pointer *pointer)
ro_gui_dialog_click_config_font(pointer);
}
+/**
+ * Redraw a dialog window
+ */
+void ro_gui_dialog_redraw(wimp_draw *redraw) {
+ os_error *error;
+ osbool more;
+ struct toolbar_display *display;
+
+ for (display = toolbars; display; display = display->next) {
+ if ((display->toolbar) && (display->toolbar->toolbar_handle == redraw->w)) {
+ ro_gui_theme_redraw(display->toolbar, redraw);
+ return;
+ }
+ }
+
+ error = xwimp_redraw_window(redraw, &more);
+ if (error) {
+ LOG(("xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+ while (more) {
+ error = xwimp_get_rectangle(redraw, &more);
+ if (error) {
+ LOG(("xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+ }
+
+}
/**
* Prepare and open the Choices dialog.
diff --git a/riscos/gui.c b/riscos/gui.c
index af3b3c263..22b35a9b5 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -743,34 +743,21 @@ void ro_gui_null_reason_code(void)
void ro_gui_redraw_window_request(wimp_draw *redraw)
{
struct gui_window *g;
- osbool more;
- os_error *error;
if (redraw->w == history_window)
ro_gui_history_redraw(redraw);
else if (redraw->w == hotlist_window)
ro_gui_hotlist_redraw(redraw);
+ else if ((hotlist_toolbar) && (hotlist_toolbar->toolbar_handle == redraw->w))
+ ro_gui_theme_redraw(hotlist_toolbar, redraw);
else if (redraw->w == dialog_debug)
ro_gui_debugwin_redraw(redraw);
else if ((g = ro_gui_window_lookup(redraw->w)) != NULL)
ro_gui_window_redraw(g, redraw);
+ else if ((g = ro_gui_toolbar_lookup(redraw->w)) != NULL)
+ ro_gui_theme_redraw(g->toolbar, redraw);
else {
- error = xwimp_redraw_window(redraw, &more);
- if (error) {
- LOG(("xwimp_redraw_window: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- return;
- }
- while (more) {
- error = xwimp_get_rectangle(redraw, &more);
- if (error) {
- LOG(("xwimp_get_rectangle: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- return;
- }
- }
+ ro_gui_dialog_redraw(redraw);
}
}
diff --git a/riscos/gui.h b/riscos/gui.h
index 47b76fe14..c4d55f29a 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -139,6 +139,7 @@ void ro_gui_dialog_proxyauth_menu_selection(int item);
void ro_gui_dialog_image_menu_selection(int item);
void ro_gui_dialog_languages_menu_selection(char *lang);
void ro_gui_dialog_font_menu_selection(char *name);
+void ro_gui_dialog_redraw(wimp_draw *redraw);
/* in download.c */
void ro_gui_download_init(void);
diff --git a/riscos/theme.c b/riscos/theme.c
index 62488f1dd..3420c5c43 100644
--- a/riscos/theme.c
+++ b/riscos/theme.c
@@ -69,8 +69,7 @@ static wimp_window theme_toolbar_window = {
0,
0,
wimp_TOP,
- wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE | wimp_WINDOW_AUTO_REDRAW |
- wimp_WINDOW_FURNITURE_WINDOW,
+ wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE | wimp_WINDOW_FURNITURE_WINDOW,
wimp_COLOUR_BLACK,
wimp_COLOUR_LIGHT_GREY,
wimp_COLOUR_LIGHT_GREY,
@@ -96,6 +95,7 @@ static wimp_window theme_toolbar_window = {
static char theme_url_validation[] = "Pptr_write\0";
static char theme_resize_validation[] = "R1;Pptr_lr,8,6\0";
static char theme_null_text_string[] = "\0";
+static char theme_separator_name[] = "separator\0";
/**
@@ -539,6 +539,51 @@ void ro_gui_theme_close(struct theme_descriptor *descriptor, bool list) {
/**
+ * Performs the redraw for a toolbar
+ *
+ * \param redraw the redraw area
+ * \param toolbar the toolbar to redraw
+ */
+void ro_gui_theme_redraw(struct toolbar *toolbar, wimp_draw *redraw) {
+ assert(toolbar);
+
+ struct toolbar_icon *icon;
+ osbool more = wimp_redraw_window(redraw);
+ wimp_icon separator_icon;
+ bool perform_redraw = false;
+
+ /* Set up the icon
+ */
+ if ((toolbar->descriptor) && (toolbar->descriptor->theme) &&
+ (toolbar->descriptor->theme->sprite_area)) {
+ separator_icon.flags = wimp_ICON_SPRITE | wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED |
+ wimp_ICON_VCENTRED;
+ separator_icon.data.indirected_sprite.id = (osspriteop_id)theme_separator_name;
+ separator_icon.data.indirected_sprite.area =
+ toolbar->descriptor->theme->sprite_area;
+ separator_icon.data.indirected_sprite.size = 12;
+ separator_icon.extent.y0 = 0;
+ separator_icon.extent.y1 = toolbar->height;
+ perform_redraw = true;
+ }
+ while (more) {
+ if (perform_redraw) {
+ for (icon = toolbar->icon; icon; icon = icon->next) {
+ if (icon->icon_number == -1) {
+ separator_icon.extent.x0 = icon->x;
+ separator_icon.extent.x1 = icon->x + icon->width;
+ wimp_plot_icon(&separator_icon);
+ }
+ }
+
+
+ }
+ more = wimp_get_rectangle(redraw);
+ }
+}
+
+
+/**
* Frees any unused theme descriptors.
*
* \param descriptor the theme_descriptor to free
@@ -727,6 +772,7 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor, struct too
} else {
theme_toolbar_window.work_bg = wimp_COLOUR_VERY_LIGHT_GREY;
}
+ theme_toolbar_window.flags &= ~wimp_WINDOW_AUTO_REDRAW;
theme_toolbar_window.flags |= wimp_WINDOW_NO_BOUNDS;
theme_toolbar_window.xmin = 1;
theme_toolbar_window.ymin = 1;
@@ -743,7 +789,6 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor, struct too
warn_user("WimpError", error->errmess);
return false;
}
- LOG(("Created window 1"));
/* Create the basic icons
*/
@@ -834,6 +879,7 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor, struct too
theme_toolbar_window.work_bg = wimp_COLOUR_VERY_LIGHT_GREY;
}
theme_toolbar_window.flags &= ~wimp_WINDOW_NO_BOUNDS;
+ theme_toolbar_window.flags |= wimp_WINDOW_AUTO_REDRAW;
theme_toolbar_window.xmin = 12;
theme_toolbar_window.ymin = ro_get_hscroll_height((wimp_w)0) - 4;
theme_toolbar_window.extent.y1 = theme_toolbar_window.ymin;
diff --git a/riscos/theme.h b/riscos/theme.h
index 8e34ff66b..1f6e90b2e 100644
--- a/riscos/theme.h
+++ b/riscos/theme.h
@@ -85,6 +85,7 @@ struct theme_descriptor *ro_gui_theme_get_available(void);
bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list);
bool ro_gui_theme_apply(struct theme_descriptor *descriptor);
void ro_gui_theme_close(struct theme_descriptor *descriptor, bool list);
+void ro_gui_theme_redraw(struct toolbar *toolbar, wimp_draw *redraw);
struct toolbar *ro_gui_theme_create_toolbar(struct theme_descriptor *descriptor, toolbar_type type);
bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor, struct toolbar *toolbar);