summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2004-08-06 23:45:21 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2004-08-06 23:45:21 +0000
commit33f6d42b94d9cf9a6a67e66258e939da166f4c9e (patch)
tree4283636591914ff676f0f361c281afa560f53221
parentf68d4491be5438a3bd7cf28d59f44651710cb409 (diff)
downloadnetsurf-33f6d42b94d9cf9a6a67e66258e939da166f4c9e.tar.gz
netsurf-33f6d42b94d9cf9a6a67e66258e939da166f4c9e.tar.bz2
[project @ 2004-08-06 23:45:21 by rjw]
Scale view window are now persistent. Fix for incorrect buffering option saving. Background images extend to the full window dimensions. svn path=/import/netsurf/; revision=1189
-rw-r--r--!NetSurf/Resources/en/Templates,fecbin7689 -> 7689 bytes
-rw-r--r--!NetSurf/Resources/fr/Templates,fecbin7823 -> 7823 bytes
-rw-r--r--riscos/dialog.c19
-rw-r--r--riscos/gui.h1
-rw-r--r--riscos/htmlredraw.c46
-rw-r--r--riscos/menus.c2
-rw-r--r--riscos/options.h2
-rw-r--r--riscos/window.c141
8 files changed, 115 insertions, 96 deletions
diff --git a/!NetSurf/Resources/en/Templates,fec b/!NetSurf/Resources/en/Templates,fec
index e0c87cb9e..9245be2f5 100644
--- a/!NetSurf/Resources/en/Templates,fec
+++ b/!NetSurf/Resources/en/Templates,fec
Binary files differ
diff --git a/!NetSurf/Resources/fr/Templates,fec b/!NetSurf/Resources/fr/Templates,fec
index d6c84b404..56972975d 100644
--- a/!NetSurf/Resources/fr/Templates,fec
+++ b/!NetSurf/Resources/fr/Templates,fec
Binary files differ
diff --git a/riscos/dialog.c b/riscos/dialog.c
index 64b70e5f0..a6642fe81 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -1,7 +1,7 @@
/*
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
- * http://www.opensource.org/licenses/gpl-license
+ * http://www.opensource.org/licenses/gpl-license
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
@@ -50,6 +50,7 @@ static unsigned int theme_list_entries = 0;
static int config_br_icon = -1;
static const char *ro_gui_choices_lang = 0;
static const char *ro_gui_choices_alang = 0;
+static struct gui_window *current_zoom_gui;
static const char *ro_gui_proxy_auth_name[] = {
"ProxyNone", "ProxyBasic", "ProxyNTLM"
@@ -245,9 +246,9 @@ void ro_gui_dialog_open(wimp_w w)
* Open a persistant dialog box relative to the pointer.
*
* \param parent the owning window (NULL for no owner)
- * \param w the dialog window
+ * \param w the dialog window
* \param pointer open the window at the pointer (centre of the parent
- * otherwise)
+ * otherwise)
*/
void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w, bool pointer) {
@@ -395,7 +396,7 @@ void ro_gui_dialog_click(wimp_pointer *pointer)
ro_gui_dialog_click_config_th_pane(pointer);
#ifdef WITH_AUTH
else if (pointer->w == dialog_401li)
- ro_gui_401login_click(pointer);
+ ro_gui_401login_click(pointer);
#endif
else if (pointer->w == dialog_zoom)
ro_gui_dialog_click_zoom(pointer);
@@ -992,8 +993,8 @@ void ro_gui_dialog_click_zoom(wimp_pointer *pointer)
ro_gui_set_icon_integer(dialog_zoom, ICON_ZOOM_VALUE, scale);
if (pointer->i == ICON_ZOOM_OK) {
- current_gui->option.scale = scale * 0.01;
- current_gui->reformat_pending = true;
+ ro_gui_current_zoom_gui->option.scale = scale * 0.01;
+ ro_gui_current_zoom_gui->reformat_pending = true;
gui_reformat_pending = true;
}
@@ -1003,8 +1004,10 @@ void ro_gui_dialog_click_zoom(wimp_pointer *pointer)
if (pointer->buttons == wimp_CLICK_SELECT &&
(pointer->i == ICON_ZOOM_CANCEL ||
- pointer->i == ICON_ZOOM_OK))
+ pointer->i == ICON_ZOOM_OK)) {
+ ro_gui_dialog_close(dialog_zoom);
wimp_create_menu(wimp_CLOSE_MENU, 0, 0);
+ }
}
@@ -1014,7 +1017,7 @@ void ro_gui_dialog_click_zoom(wimp_pointer *pointer)
void ro_gui_dialog_reset_zoom(void) {
char scale_buffer[8];
- sprintf(scale_buffer, "%.0f", current_gui->option.scale * 100);
+ sprintf(scale_buffer, "%.0f", ro_gui_current_zoom_gui->option.scale * 100);
ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer);
}
diff --git a/riscos/gui.h b/riscos/gui.h
index 0a2c4bf3c..514dc9509 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -100,6 +100,7 @@ struct gui_window {
extern struct gui_window *current_gui;
extern struct gui_window *ro_gui_current_redraw_gui;
+extern struct gui_window *ro_gui_current_zoom_gui;
/* in gui.c */
diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c
index 6768449e6..d285629b1 100644
--- a/riscos/htmlredraw.c
+++ b/riscos/htmlredraw.c
@@ -60,6 +60,7 @@ static void html_redraw_background(int x, int y, int width, int height,
struct box *box, float scale);
bool gui_redraw_debug = false;
+static int ro_gui_redraw_box_depth;
static os_trfm trfm = { {
{ 65536, 0 },
@@ -106,6 +107,7 @@ void html_redraw(struct content *c, int x, int y,
trfm.entries[0][0] = trfm.entries[1][1] = 65536 * scale;
+ ro_gui_redraw_box_depth = 0;
html_redraw_box(box, x, y, background_colour,
clip_x0, clip_y0, clip_x1, clip_y1, scale);
}
@@ -139,6 +141,8 @@ void html_redraw_box(struct box *box,
int x0, y0, x1, y1;
int colour;
+ ro_gui_redraw_box_depth++;
+
x += box->x * 2 * scale;
y -= box->y * 2 * scale;
width = box->width * 2 * scale;
@@ -230,11 +234,13 @@ void html_redraw_box(struct box *box,
2 * scale);
/* return if the box is completely outside the clip rectangle */
- if (clip_y1 < y0 || y1 < clip_y0 || clip_x1 < x0 || x1 < clip_x0)
+ if ((ro_gui_redraw_box_depth > 2) &&
+ (clip_y1 < y0 || y1 < clip_y0 || clip_x1 < x0 || x1 < clip_x0))
return;
- if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
- box->type == BOX_TABLE_CELL || box->object) {
+ if ((ro_gui_redraw_box_depth > 2) &&
+ (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
+ box->type == BOX_TABLE_CELL || box->object)) {
/* find intersection of clip rectangle and box */
if (x0 < clip_x0) x0 = clip_x0;
if (y0 < clip_y0) y0 = clip_y0;
@@ -261,29 +267,38 @@ void html_redraw_box(struct box *box,
/* background colour */
if (box->style->background_color != TRANSPARENT) {
+ if (ro_gui_redraw_box_depth > 2) {
+
+ /* optimisation removed - transparent images break */
/* optimisation: skip if fully repeated bg image */
- if (!box->background ||
+ if (!box->background/* ||
box->style->background_repeat !=
- CSS_BACKGROUND_REPEAT_REPEAT) {
+ CSS_BACKGROUND_REPEAT_REPEAT*/) {
- colourtrans_set_gcol(
- box->style->background_color << 8,
- colourtrans_USE_ECFS,
- os_ACTION_OVERWRITE, 0);
+ colourtrans_set_gcol(
+ box->style->background_color << 8,
+ colourtrans_USE_ECFS,
+ os_ACTION_OVERWRITE, 0);
+
+ os_plot(os_MOVE_TO, px0, py0);
- os_plot(os_MOVE_TO, px0, py0);
+ if (px0 < px1 && py0 < py1)
+ os_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
+ px1 - 1, py1 - 1);
+ }
- if (px0 < px1 && py0 < py1)
- os_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
- px1 - 1, py1 - 1);
}
/* set current background color for font painting */
current_background_color = box->style->background_color;
}
if (box->background) {
- /* clip to padding box */
- html_redraw_clip(px0, py0, px1, py1);
+ /* clip to padding box for everything but the main window */
+ if (ro_gui_redraw_box_depth > 2) {
+ html_redraw_clip(px0, py0, px1, py1);
+ } else {
+ html_redraw_clip(clip_x0, clip_y0, clip_x1, clip_y1);
+ }
/* plot background image */
html_redraw_background(x, y, width, clip_y1 - clip_y0,
@@ -577,6 +592,7 @@ void html_redraw_background(int xi, int yi, int width, int height,
state.w = 0;
if (ro_gui_current_redraw_gui) {
+
/* read state of window we're drawing in */
os_error *error;
diff --git a/riscos/menus.c b/riscos/menus.c
index aebf81808..aa45e9d45 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -1501,9 +1501,9 @@ static void ro_gui_menu_prepare_toolbars(void) {
*/
void ro_gui_menu_prepare_scale(void) {
char scale_buffer[8];
- if (current_menu != browser_menu) return;
sprintf(scale_buffer, "%.0f", current_gui->option.scale * 100);
ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer);
+ ro_gui_current_zoom_gui = current_gui;
}
/**
diff --git a/riscos/options.h b/riscos/options.h
index a1f767f34..71cd06026 100644
--- a/riscos/options.h
+++ b/riscos/options.h
@@ -110,7 +110,7 @@ bool option_open_browser_at_startup = false;
{ "background_images", OPTION_BOOL, &option_background_images }, \
{ "background_blending", OPTION_BOOL, &option_background_blending }, \
{ "buffer_animations", OPTION_BOOL, &option_buffer_animations }, \
-{ "buffer_everything", OPTION_BOOL, &option_buffer_animations }, \
+{ "buffer_everything", OPTION_BOOL, &option_buffer_everything }, \
{ "homepage_url", OPTION_STRING, &option_homepage_url }, \
{ "open_browser_at_startup",OPTION_BOOL, &option_open_browser_at_startup }
#endif
diff --git a/riscos/window.c b/riscos/window.c
index fcd9fcf5b..caa692f19 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -38,8 +38,10 @@
/** List of all browser windows. */
static struct gui_window *window_list = 0;
-/** Browser window which is being redrawn. Valid only during redraw. */
+/** GUI window which is being redrawn. Valid only during redraw. */
struct gui_window *ro_gui_current_redraw_gui;
+/** GUI window which the current zoom window refers to. */
+struct gui_window *ro_gui_current_zoom_gui;
static void ro_gui_window_clone_options(struct browser_window *new_bw,
@@ -50,7 +52,7 @@ static void ro_gui_window_clone_options(struct browser_window *new_bw,
/**
* Create and open a new browser window.
*
- * \param bw browser_window structure to update
+ * \param bw browser_window structure to update
* \param clone the browser window to clone options from, or NULL for default
* \return gui_window, or 0 on error and error reported
*/
@@ -124,10 +126,10 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
win_height = 100;
} else {
- /* Base how we define the window height/width
- on the compile time options set */
+ /* Base how we define the window height/width
+ on the compile time options set */
#ifdef WITH_KIOSK_BROWSING
- /* We're going fullscreen, forget the iconbar! */
+ /* We're going fullscreen, forget the iconbar! */
win_width = screen_width;
win_height = screen_height;
#else
@@ -151,8 +153,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
window.yscroll = 0;
window.next = wimp_TOP;
- /* Base how we define the window characteristics
- on the compile time options set */
+ /* Base how we define the window characteristics
+ on the compile time options set */
#ifdef WITH_KIOSK_BROWSING
window.flags = wimp_WINDOW_NEW_FORMAT |
wimp_WINDOW_VSCROLL |
@@ -316,7 +318,7 @@ void ro_gui_window_quit(void)
/**
* Set the title of a browser window.
*
- * \param g gui_window to update
+ * \param g gui_window to update
* \param title new window title, copied
*/
@@ -454,11 +456,11 @@ void ro_gui_window_redraw(struct gui_window *g, wimp_draw *redraw)
}
error = xwimp_get_rectangle(redraw, &more);
if (error) {
- /* RISC OS 3.7 returns the following error is enough buffer
- is claimed to cause a new dynamic area to be created. It
- doesn't actually stop anything working, so we mask it out
- for now until a better fix is found.
- */
+ /* RISC OS 3.7 returns the following error is enough buffer
+ is claimed to cause a new dynamic area to be created. It
+ doesn't actually stop anything working, so we mask it out
+ for now until a better fix is found.
+ */
if ((!ro_gui_current_redraw_gui->option.buffer_everything) ||
(error->errnum != 0x286)) {
LOG(("xwimp_get_rectangle: 0x%x: %s",
@@ -562,15 +564,15 @@ void gui_window_update_box(struct gui_window *g,
g->option.scale);
}
- if (use_buffer) ro_gui_buffer_close();
+ if (use_buffer) ro_gui_buffer_close();
error = xwimp_get_rectangle(&update, &more);
if (error) {
- /* RISC OS 3.7 returns the following error is enough buffer
- is claimed to cause a new dynamic area to be created. It
- doesn't actually stop anything working, so we mask it out
- for now until a better fix is found.
- */
+ /* RISC OS 3.7 returns the following error is enough buffer
+ is claimed to cause a new dynamic area to be created. It
+ doesn't actually stop anything working, so we mask it out
+ for now until a better fix is found.
+ */
if ((!use_buffer) || (error->errnum != 0x286)) {
LOG(("xwimp_get_rectangle: 0x%x: %s",
error->errnum, error->errmess));
@@ -647,7 +649,7 @@ int gui_window_get_width(struct gui_window *g)
/**
* Set the extent of the inside of a browser window.
*
- * \param g gui_window to resize
+ * \param g gui_window to resize
* \param width new extent
* \param height new extent
*/
@@ -703,7 +705,7 @@ void gui_window_set_extent(struct gui_window *g, int width, int height)
/**
* Set the status bar of a browser window.
*
- * \param g gui_window to update
+ * \param g gui_window to update
* \param text new status text
*/
@@ -720,7 +722,7 @@ void gui_window_set_status(struct gui_window *g, const char *text)
/**
* Set the contents of a window's address bar.
*
- * \param g gui_window to update
+ * \param g gui_window to update
* \param url new url for address bar
*/
@@ -949,7 +951,7 @@ struct gui_window *ro_gui_status_lookup(wimp_w window)
/**
* Handle pointer movements in a browser window.
*
- * \param g browser window that the pointer is in
+ * \param g browser window that the pointer is in
* \param pointer new mouse position
*/
@@ -983,8 +985,7 @@ void ro_gui_window_mouse_at(struct gui_window *g, wimp_pointer *pointer)
void ro_gui_toolbar_click(struct gui_window *g, wimp_pointer *pointer)
{
- char url[80];
- os_error *error;
+ char url[80];
/* Reject Menu clicks
*/
@@ -1023,9 +1024,9 @@ void ro_gui_toolbar_click(struct gui_window *g, wimp_pointer *pointer)
browser_window_go_post(g->bw, option_homepage_url,
0, 0, true);
} else {
- browser_window_create(option_homepage_url, NULL);
- }
- } else {
+ browser_window_create(option_homepage_url, NULL);
+ }
+ } else {
snprintf(url, sizeof url,
"file:/<NetSurf$Dir>/Docs/intro_%s",
option_language);
@@ -1042,15 +1043,7 @@ void ro_gui_toolbar_click(struct gui_window *g, wimp_pointer *pointer)
case ICON_TOOLBAR_SCALE:
current_gui = g;
ro_gui_menu_prepare_scale();
- /** \todo make scale window persistent */
- error = xwimp_create_menu((wimp_menu *) dialog_zoom,
- pointer->pos.x, pointer->pos.y);
- if (error) {
- LOG(("xwimp_create_menu: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- return;
- }
+ ro_gui_dialog_open_persistant(g->window, dialog_zoom, true);
break;
case ICON_TOOLBAR_BOOKMARK:
@@ -1077,7 +1070,7 @@ void ro_gui_toolbar_click(struct gui_window *g, wimp_pointer *pointer)
/**
* Handle Mouse_Click events in the status bar.
*
- * \param g browser window that owns the status bar
+ * \param g browser window that owns the status bar
* \param pointer details of mouse click
*/
@@ -1108,7 +1101,7 @@ void ro_gui_status_click(struct gui_window *g, wimp_pointer *pointer)
/**
* Handle Mouse_Click events in a browser window.
*
- * \param g browser window
+ * \param g browser window
* \param pointer details of mouse click
*/
@@ -1190,9 +1183,9 @@ void gui_window_stop_throbber(struct gui_window *g)
/**
* Place the caret in a browser window.
*
- * \param g window with caret
- * \param x coordinates of caret
- * \param y coordinates of caret
+ * \param g window with caret
+ * \param x coordinates of caret
+ * \param y coordinates of caret
* \param height height of caret
*/
@@ -1215,7 +1208,7 @@ void gui_window_place_caret(struct gui_window *g, int x, int y, int height)
/**
* Remove/disown the caret.
*
- * \param g window with caret
+ * \param g window with caret
*
* \todo: do we want to do a test if g really owns the caret ?
*/
@@ -1291,19 +1284,19 @@ bool ro_gui_window_keypress(struct gui_window *g, int key, bool toolbar)
ro_gui_search_open(g, 0, 0, false, true);
return true;
- case wimp_KEY_F5: /* Refresh. */
- browser_window_reload(g->bw, false);
- return true;
+ case wimp_KEY_F5: /* Refresh. */
+ browser_window_reload(g->bw, false);
+ return true;
- case wimp_KEY_F6: /* Help. */
+ case wimp_KEY_F6: /* Hotlist. */
ro_gui_hotlist_show();
return true;
- case wimp_KEY_F7: /* Toggle fullscreen browsing. */
+ case wimp_KEY_F7: /* Toggle fullscreen browsing. */
- return true;
+ return true;
case wimp_KEY_F8: /* View source. */
@@ -1323,7 +1316,13 @@ bool ro_gui_window_keypress(struct gui_window *g, int key, bool toolbar)
}
return true;
- case wimp_KEY_F11: /* Toggle display of box outlines. */
+ case wimp_KEY_F11: /* Zoom */
+ current_gui = g;
+ ro_gui_menu_prepare_scale();
+ ro_gui_dialog_open_persistant(g->window, dialog_zoom, false);
+ return true;
+
+ case wimp_KEY_SHIFT + wimp_KEY_F11: /* Toggle display of box outlines. */
gui_redraw_debug = !gui_redraw_debug;
gui_window_redraw_window(g);
return true;
@@ -1389,25 +1388,25 @@ bool ro_gui_window_keypress(struct gui_window *g, int key, bool toolbar)
return true;
case 17: /* CTRL+Q (Zoom out) */
- current_gui = g;
- if (0.1 < current_gui->option.scale) {
- current_gui->option.scale -= 0.1;
- if (current_gui->option.scale < 0.1)
- current_gui->option.scale = 0.1;
- current_gui->reformat_pending = true;
- gui_reformat_pending = true;
- }
- return true;
+ current_gui = g;
+ if (0.1 < current_gui->option.scale) {
+ current_gui->option.scale -= 0.1;
+ if (current_gui->option.scale < 0.1)
+ current_gui->option.scale = 0.1;
+ current_gui->reformat_pending = true;
+ gui_reformat_pending = true;
+ }
+ return true;
case 23: /* CTRL+W (Zoom in) */
- current_gui = g;
- if (current_gui->option.scale < 10.0) {
- current_gui->option.scale += 0.1;
- if (10.0 < current_gui->option.scale)
- current_gui->option.scale = 10.0;
- current_gui->reformat_pending = true;
- gui_reformat_pending = true;
- }
- return true;
+ current_gui = g;
+ if (current_gui->option.scale < 10.0) {
+ current_gui->option.scale += 0.1;
+ if (10.0 < current_gui->option.scale)
+ current_gui->option.scale = 10.0;
+ current_gui->reformat_pending = true;
+ gui_reformat_pending = true;
+ }
+ return true;
case wimp_KEY_UP:
case wimp_KEY_DOWN:
@@ -1534,7 +1533,7 @@ int window_y_units(int y, wimp_window_state *state) {
/**
* Handle Message_DataLoad (file dragged in) for a window.
*
- * \param g window
+ * \param g window
* \param message Message_DataLoad block
* \return true if the load was processed
*
@@ -1673,13 +1672,13 @@ void ro_gui_window_clone_options(struct browser_window *new_bw,
/* Set up the toolbar
*/
if (new_gui->toolbar) {
- if ((old_gui) && (old_gui->toolbar)) {
+ if ((old_gui) && (old_gui->toolbar)) {
new_gui->toolbar->status_width = old_gui->toolbar->status_width;
new_gui->toolbar->status_window = old_gui->toolbar->status_window;
new_gui->toolbar->standard_buttons = old_gui->toolbar->standard_buttons;
new_gui->toolbar->url_bar = old_gui->toolbar->url_bar;
new_gui->toolbar->throbber = old_gui->toolbar->throbber;
- } else {
+ } else {
new_gui->toolbar->status_width = option_toolbar_status_width;
new_gui->toolbar->status_window = option_toolbar_show_status;
new_gui->toolbar->standard_buttons = option_toolbar_show_buttons;