From bc533957fd8833976d8558a98b0e81d3f62cbe2e Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 29 Jun 2004 19:08:19 +0000 Subject: [project @ 2004-06-29 19:08:19 by jmb] Full reload support for HTML contents. Adjust click the reload button svn path=/import/netsurf/; revision=1029 --- desktop/browser.c | 19 ++++++++++++++++++- desktop/browser.h | 2 +- riscos/menus.c | 4 ++-- riscos/window.c | 19 +++++++++++-------- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/desktop/browser.c b/desktop/browser.c index 31daaf379..6de46c293 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -409,13 +409,30 @@ void browser_window_stop(struct browser_window *bw) * Reload the page in a browser window. * * \param bw browser window + * \param all whether to reload all objects associated with the page */ -void browser_window_reload(struct browser_window *bw) +void browser_window_reload(struct browser_window *bw, bool all) { + struct content *c; + unsigned int i; + if (!bw->current_content || bw->loading_content) return; + if (all && bw->current_content->type == CONTENT_HTML) { + c = bw->current_content; + /* invalidate objects */ + for (i=0; i!=c->data.html.object_count; i++) { + if (c->data.html.object[i].content != 0) + c->data.html.object[i].content->fresh = false; + } + /* invalidate stylesheets */ + for (i=2; i!=c->data.html.stylesheet_count; i++) { + if (c->data.html.stylesheet_content[i] != 0) + c->data.html.stylesheet_content[i]->fresh = false; + } + } bw->current_content->fresh = false; browser_window_go_post(bw, bw->current_content->url, 0, 0, false); } diff --git a/desktop/browser.h b/desktop/browser.h index 02a2476cd..25f01d04c 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -90,7 +90,7 @@ void browser_window_go_post(struct browser_window *bw, const char *url, struct form_successful_control *post_multipart, bool history_add); void browser_window_stop(struct browser_window *bw); -void browser_window_reload(struct browser_window *bw); +void browser_window_reload(struct browser_window *bw, bool all); void browser_window_destroy(struct browser_window *bw); int browser_window_action(struct browser_window* bw, struct browser_action* act); diff --git a/riscos/menus.c b/riscos/menus.c index b9fec20a9..8d2226aba 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -514,7 +514,7 @@ void ro_gui_menu_selection(wimp_selection *selection) ro_gui_prepare_navigate(current_gui); break; case 3: /* Reload */ - browser_window_reload(current_gui->data.browser.bw); + browser_window_reload(current_gui->data.browser.bw, false); break; case 4: /* Stop */ browser_window_stop(current_gui->data.browser.bw); @@ -1181,7 +1181,7 @@ void ro_gui_menu_object_reload(void) if (box) { box->object->fresh = false; - browser_window_reload(current_gui->data.browser.bw); + browser_window_reload(current_gui->data.browser.bw, false); } } diff --git a/riscos/window.c b/riscos/window.c index b220e7cbf..eb6548905 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -88,7 +88,7 @@ gui_window *gui_create_browser_window(struct browser_window *bw, open_centred = false; } else { ro_gui_screen_size(&screen_width, &screen_height); - + /* Check if we have a preferred position */ if ((option_window_screen_width != 0) && (option_window_screen_height != 0)) { @@ -115,7 +115,7 @@ gui_window *gui_create_browser_window(struct browser_window *bw, window.visible.x1 = window.visible.x0 + win_width; window.visible.y1 = window.visible.y0 + win_height; } - + /* Set the general window characteristics */ window.xscroll = 0; @@ -166,7 +166,7 @@ gui_window *gui_create_browser_window(struct browser_window *bw, free(g); return 0; } - + ro_theme_create_toolbar(g); g->next = window_list; @@ -188,14 +188,14 @@ gui_window *gui_create_browser_window(struct browser_window *bw, warn_user("WimpError", error->errmess); return g; } - + /* Only fix the centralisation if we've opened the window centred */ if (open_centred) { scroll_width = ro_get_vscroll_width(g->window); state.visible.x0 -= scroll_width; } - + /* Open the window at the top of the stack */ state.next = wimp_TOP; @@ -699,7 +699,7 @@ void ro_gui_window_mouse_at(wimp_pointer* pointer) */ void ro_gui_toolbar_click(gui_window* g, wimp_pointer* pointer) { - + /* Reject Menu clicks */ if (pointer->buttons == wimp_CLICK_MENU) return; @@ -719,7 +719,10 @@ void ro_gui_toolbar_click(gui_window* g, wimp_pointer* pointer) { break; case ICON_TOOLBAR_RELOAD: - browser_window_reload(g->data.browser.bw); + if (pointer->buttons == wimp_CLICK_SELECT) + browser_window_reload(g->data.browser.bw, false); + else if (pointer->buttons == wimp_CLICK_ADJUST) + browser_window_reload(g->data.browser.bw, true); break; case ICON_TOOLBAR_HISTORY: @@ -1029,7 +1032,7 @@ bool ro_gui_window_keypress(gui_window *g, int key, bool toolbar) browser_window_create(g->url, g->data.browser.bw); return true; case 18: /* CTRL+R */ - browser_window_reload(g->data.browser.bw); + browser_window_reload(g->data.browser.bw, false); return true; case 17: /* CTRL+Q (Zoom out) */ -- cgit v1.2.3