Dynamically update scale view (implement 1556975) and prevent double redraws.

svn path=/trunk/netsurf/; revision=3191
This commit is contained in:
Richard Wilson 2007-03-03 19:46:20 +00:00
parent cd3fb4a7cc
commit 7368688642
5 changed files with 31 additions and 26 deletions

View File

@ -488,6 +488,17 @@ struct content * content_get_ready(const char *url)
}
/**
* Get whether a content can reformat
*
* \param c content to check
* \return whether the content can reformat
*/
bool content_get_reformat(struct content *c) {
return (handler_map[c->type].reformat != NULL);
}
/**
* Initialise the content for the specified type.
*

View File

@ -225,6 +225,7 @@ content_type content_lookup(const char *mime_type);
struct content * content_create(const char *url);
struct content * content_get(const char *url);
struct content * content_get_ready(const char *url);
bool content_get_reformat(struct content *c);
bool content_set_type(struct content *c, content_type type,
const char *mime_type, const char *params[]);
void content_set_status(struct content *c, const char *status_message, ...);

View File

@ -684,6 +684,16 @@ void ro_gui_dialog_prepare_zoom(struct gui_window *g)
ro_gui_wimp_event_memorise(dialog_zoom);
}
/**
* Update the Scale View dialog to reflect the current window settings
*
* \param g the gui_window to update for
*/
void ro_gui_dialog_update_zoom(struct gui_window *g) {
if (g == ro_gui_current_zoom_gui)
ro_gui_dialog_prepare_zoom(g);
}
bool ro_gui_dialog_openurl_apply(wimp_w w) {
url_func_result res;

View File

@ -39,6 +39,7 @@ void ro_gui_dialog_close_persistent(wimp_w parent);
void ro_gui_dialog_click(wimp_pointer *pointer);
void ro_gui_dialog_prepare_zoom(struct gui_window *g);
void ro_gui_dialog_update_zoom(struct gui_window *g);
void ro_gui_dialog_prepare_open_url(void);
void ro_gui_save_options(void);
void ro_gui_dialog_open_config(void);

View File

@ -518,27 +518,7 @@ void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
*/
void gui_window_redraw_window(struct gui_window *g)
{
wimp_window_info info;
os_error *error;
assert(g);
info.w = g->window;
error = xwimp_get_window_info_header_only(&info);
if (error) {
LOG(("xwimp_get_window_info_header_only: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
return;
}
error = xwimp_force_redraw(g->window, info.extent.x0, info.extent.y0,
info.extent.x1, info.extent.y1);
if (error) {
LOG(("xwimp_force_redraw: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
}
gui_window_redraw(g, 0, -8192, 8192, 8192);
}
@ -1394,11 +1374,13 @@ void gui_window_set_scale(struct gui_window *g, float scale)
g->option.scale = scale;
c = g->bw->current_content;
if (c) {
/* todo: we should only call _update for contents that don't have a
* reformat function and thus don't redraw themselves */
browser_window_update(g->bw, false);
g->reformat_pending = true;
gui_reformat_pending = true;
ro_gui_dialog_update_zoom(g);
if (!content_get_reformat(c)) {
browser_window_update(g->bw, false);
} else {
g->reformat_pending = true;
gui_reformat_pending = true;
}
}
}