[project @ 2004-11-04 01:19:46 by rjw]

Toolbar separator icons are now displayed.

svn path=/import/netsurf/; revision=1342
This commit is contained in:
Richard Wilson 2004-11-04 01:19:46 +00:00
parent 5fd222bd53
commit 010039686d
5 changed files with 89 additions and 21 deletions

View File

@ -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.

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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";
/**
@ -538,6 +538,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.
*
@ -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;

View File

@ -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);