diff options
Diffstat (limited to 'frontends/riscos/gui/status_bar.c')
-rw-r--r-- | frontends/riscos/gui/status_bar.c | 83 |
1 files changed, 59 insertions, 24 deletions
diff --git a/frontends/riscos/gui/status_bar.c b/frontends/riscos/gui/status_bar.c index 9d1bada91..dd1aab639 100644 --- a/frontends/riscos/gui/status_bar.c +++ b/frontends/riscos/gui/status_bar.c @@ -28,9 +28,10 @@ #include "oslib/os.h" #include "oslib/wimp.h" #include "oslib/wimpspriteop.h" -#include "netsurf/plotters.h" + #include "utils/log.h" #include "utils/utils.h" +#include "netsurf/plotters.h" #include "riscos/gui.h" #include "riscos/wimp.h" @@ -130,7 +131,8 @@ struct status_bar *ro_gui_status_bar_create(wimp_w parent, unsigned int width) error = xwimp_create_window((wimp_window *)&status_bar_definition, &sb->w); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); free(sb); return NULL; } @@ -164,7 +166,8 @@ void ro_gui_status_bar_destroy(struct status_bar *sb) ro_gui_wimp_event_finalise(sb->w); error = xwimp_delete_window(sb->w); if (error) { - LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s", + error->errnum, error->errmess); } ro_gui_progress_bar_destroy(sb->pb); @@ -221,7 +224,8 @@ void ro_gui_status_bar_set_visible(struct status_bar *sb, bool visible) } else { os_error *error = xwimp_close_window(sb->w); if (error) { - LOG("xwimp_close_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s", + error->errnum, error->errmess); } } } @@ -274,14 +278,15 @@ void ro_gui_status_bar_set_progress_range(struct status_bar *sb, old_range = ro_gui_progress_bar_get_range(sb->pb); ro_gui_progress_bar_set_range(sb->pb, range); - LOG("Ranges are %i vs %i", old_range, range); + NSLOG(netsurf, INFO, "Ranges are %i vs %i", old_range, range); if ((old_range == 0) && (range != 0)) { ro_gui_status_position_progress_bar(sb); } else if ((old_range != 0) && (range == 0)) { os_error *error = xwimp_close_window( ro_gui_progress_bar_get_window(sb->pb)); if (error) { - LOG("xwimp_close_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s", + error->errnum, error->errmess); } } } @@ -353,7 +358,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb) state.w = sb->parent; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } window_width = state.visible.x1 - state.visible.x0; @@ -376,7 +382,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb) extent.y1 = status_height - 4; error = xwimp_set_extent(sb->w, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -404,7 +411,10 @@ void ro_gui_status_bar_resize(struct status_bar *sb) wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_TS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_open_window_nested: 0x%x: %s", + error->errnum, + error->errmess); return; } ro_gui_status_position_progress_bar(sb); @@ -412,7 +422,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb) status_width - WIDGET_WIDTH, 0, status_width, status_height - 4); if (error) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -436,6 +447,12 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) os_error *error; osbool more; rufl_code code; + struct redraw_context ctx = { + .interactive = true, + .background_images = true, + .plot = &ro_plotters + }; + struct rect rect; sb = (struct status_bar *)ro_gui_wimp_event_get_user_data(redraw->w); assert(sb); @@ -447,7 +464,8 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) /* redraw the window */ error = xwimp_redraw_window(redraw, &more); if (error) { - LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); return; } while (more) { @@ -456,7 +474,10 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) error = xcolourtrans_set_font_colours(font_CURRENT, 0xeeeeee00, 0x00000000, 14, 0, 0, 0); if (error) { - LOG("xcolourtrans_set_font_colours: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_font_colours: 0x%x: %s", + error->errnum, + error->errmess); return; } code = rufl_paint(ro_gui_desktop_font_family, @@ -467,22 +488,30 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) rufl_BLEND_FONT); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_FONT_MANAGER_ERROR: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); else - LOG("rufl_paint: 0x%x", code); + NSLOG(netsurf, INFO, + "rufl_paint: 0x%x", code); } } + rect.x0 = (redraw->box.x0 + sb->width - WIDGET_WIDTH - 2) >> 1; + rect.y0 = -redraw->box.y0 >> 1; + rect.x1 = (redraw->box.x0 + sb->width - WIDGET_WIDTH) >> 1; + rect.y1 = -redraw->box.y1 >> 1; + /* separate the widget from the text with a line */ - ro_plotters.rectangle((redraw->box.x0 + sb->width - WIDGET_WIDTH - 2) >> 1, - -redraw->box.y0 >> 1, - (redraw->box.x0 + sb->width - WIDGET_WIDTH) >> 1, - -redraw->box.y1 >> 1, - plot_style_fill_black); + ctx.plot->rectangle(&ctx, + plot_style_fill_black, + &rect); error = xwimp_get_rectangle(redraw, &more); if (error) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s", + error->errnum, error->errmess); return; } } @@ -521,7 +550,10 @@ bool ro_gui_status_bar_click(wimp_pointer *pointer) drag.initial.y1 = pointer->pos.y; error = xwimp_drag_box(&drag); if (error) { - LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_drag_box: 0x%x: %s", + error->errnum, + error->errmess); } break; } @@ -546,7 +578,8 @@ void ro_gui_status_bar_open(wimp_open *open) state.w = sb->parent; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } window_width = state.visible.x1 - state.visible.x0; @@ -585,7 +618,8 @@ void ro_gui_status_position_progress_bar(struct status_bar *sb) state.w = sb->w; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -615,7 +649,8 @@ void ro_gui_status_position_progress_bar(struct status_bar *sb) wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_TS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); } /* update the progress bar display on non-standard width */ |