summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2005-07-02 18:17:51 +0000
committerJames Bursa <james@netsurf-browser.org>2005-07-02 18:17:51 +0000
commit9b78daf135d7fa555990454c219649e4d54157d2 (patch)
treed5d8c1d773d0ef51afbe055dcff60607821f7a9c /riscos
parent894ba8b6230ffa57e1a5037adbd1b246a9a877da (diff)
downloadnetsurf-9b78daf135d7fa555990454c219649e4d54157d2.tar.gz
netsurf-9b78daf135d7fa555990454c219649e4d54157d2.tar.bz2
[project @ 2005-07-02 18:17:51 by bursa]
Rewrite calculation of box minimum and maximum widths to improve layout of many pages. Move calculation of column types and border collapsing to box tree normalising stage, since they are layout independent. Add window height parameter to layout and make <html> and <body> at least window height. svn path=/import/netsurf/; revision=1777
Diffstat (limited to 'riscos')
-rw-r--r--riscos/print.c9
-rw-r--r--riscos/save_draw.c6
-rw-r--r--riscos/window.c32
3 files changed, 39 insertions, 8 deletions
diff --git a/riscos/print.c b/riscos/print.c
index 94f067783..29663f259 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -469,7 +469,7 @@ void print_cleanup(void)
bool print_document(struct gui_window *g, const char *filename)
{
int left, right, top, bottom, width, height;
- int saved_width;
+ int saved_width, saved_height;
int yscroll = 0, sheets = print_max_sheets;
struct content *c = g->bw->current_content;
const char *error_message;
@@ -506,8 +506,9 @@ bool print_document(struct gui_window *g, const char *filename)
/* layout the document to the correct width */
saved_width = c->width;
+ saved_height = c->height;
if (c->type == CONTENT_HTML)
- layout_document(c, width);
+ layout_document(c, width, height);
/* open printer file */
error = xosfind_openoutw(osfind_NO_PATH | osfind_ERROR_IF_DIR |
@@ -645,7 +646,7 @@ bool print_document(struct gui_window *g, const char *filename)
/* restore document layout */
if (c->type == CONTENT_HTML)
- layout_document(c, saved_width);
+ layout_document(c, saved_width, saved_height);
return true;
@@ -663,7 +664,7 @@ error:
/* restore document layout */
if (c->type == CONTENT_HTML)
- layout_document(c, saved_width);
+ layout_document(c, saved_width, saved_height);
return false;
}
diff --git a/riscos/save_draw.c b/riscos/save_draw.c
index ba4842ca2..46622f0e1 100644
--- a/riscos/save_draw.c
+++ b/riscos/save_draw.c
@@ -146,7 +146,7 @@ bool save_as_draw(struct content *c, const char *path)
memcpy(diagram->source, "NetSurf ", 12);
/* recalculate box widths for an A4 page */
- if (!layout_document(c, A4PAGEWIDTH)) {
+ if (!layout_document(c, A4PAGEWIDTH, A4PAGEWIDTH)) {
warn_user("NoMemory", 0);
goto draw_save_error;
}
@@ -185,7 +185,7 @@ bool save_as_draw(struct content *c, const char *path)
drawbuf_free();
/* reset layout to current window width */
- if (!layout_document(c, current_width)) {
+ if (!layout_document(c, current_width, current_width)) {
warn_user("NoMemory", 0);
return false;
}
@@ -195,7 +195,7 @@ bool save_as_draw(struct content *c, const char *path)
draw_save_error:
drawbuf_free();
/* attempt to reflow back on failure */
- (void)layout_document(c, current_width);
+ (void)layout_document(c, current_width, current_width);
return false;
}
diff --git a/riscos/window.c b/riscos/window.c
index 12729853b..3d65abfdc 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -819,6 +819,32 @@ int gui_window_get_width(struct gui_window *g)
/**
+ * Find the current height of a browser window.
+ *
+ * \param g gui_window to measure
+ * \return height of window
+ */
+
+int gui_window_get_height(struct gui_window *g)
+{
+ wimp_window_state state;
+ os_error *error;
+
+ state.w = g->window;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ LOG(("xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return 800;
+ }
+ return (state.visible.y1 - state.visible.y0 - (g->toolbar ?
+ ro_gui_theme_toolbar_full_height(g->toolbar) : 0)) /
+ 2 / g->option.scale;
+}
+
+
+/**
* Set the extent of the inside of a browser window.
*
* \param g gui_window to resize
@@ -1878,6 +1904,10 @@ bool ro_gui_window_keypress(struct gui_window *g, int key, bool toolbar)
}
return true;
+ case wimp_KEY_CONTROL + wimp_KEY_SHIFT + wimp_KEY_F9:
+ talloc_report_full(0, stderr);
+ return true;
+
case wimp_KEY_CONTROL + wimp_KEY_F9: /* Dump url_store. */
url_store_dump();
return true;
@@ -2259,7 +2289,7 @@ void ro_gui_window_process_reformats(void)
continue;
content_reformat(g->bw->current_content,
g->old_width / 2 / g->option.scale,
- 1000);
+ gui_window_get_height(g));
g->reformat_pending = false;
}
gui_reformat_pending = false;