[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
This commit is contained in:
John Mark Bell 2004-06-29 19:08:19 +00:00
parent afd366ecae
commit bc533957fd
4 changed files with 32 additions and 12 deletions

View File

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

View File

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

View File

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

View File

@ -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) */