diff --git a/Resources/UK/Browse/Res,fae b/Resources/UK/Browse/Res,fae index 21a9fd3e5fd2c2f375443f9035cd9158b8f22241..a0f4342b5e9a5cf17169e561bcb953f6c6bc2526 100644 Binary files a/Resources/UK/Browse/Res,fae and b/Resources/UK/Browse/Res,fae differ diff --git a/Resources/UK/Phoenix/Res,fae b/Resources/UK/Phoenix/Res,fae index cc871c1bbbfe4d9904e3e99145206cbcde700652..5402a9937664a17ea8846ec3f279c9c52e0bf193 100644 Binary files a/Resources/UK/Phoenix/Res,fae and b/Resources/UK/Phoenix/Res,fae differ diff --git a/Resources/UK/Ursula/Res,fae b/Resources/UK/Ursula/Res,fae index 4cf5ada86cc9bbb84b5b0c15c63bb09aeff453aa..4aa35b6d1022bc905a3a1b3a70a82c6c2e49bd95 100644 Binary files a/Resources/UK/Ursula/Res,fae and b/Resources/UK/Ursula/Res,fae differ diff --git a/c/Object b/c/Object index 0c809fc7b71f8e06e4398666efac5515597639ce..9480f75f79a559caf2d746e9e78efef1030bd15a 100644 --- a/c/Object +++ b/c/Object @@ -113,6 +113,13 @@ _kernel_oserror * object_new_object(browser_data * b, HStream * t) b->odata[b->nobjects].plugin_task_handle = 0; b->odata[b->nobjects].token = t; + /* Until this is seen by the user, open it off-screen to avoid */ + /* having to send out lots of reposition calls during the main */ + /* page reformat. */ + + b->odata[b->nobjects].x = -1; + b->odata[b->nobjects].y = -1; + /* Width and height initially come from the token, but if this */ /* ends up leading to a Plug-In being called, that Plug-In */ /* could ask for the size to change; hence the 'width' and */ @@ -269,6 +276,14 @@ static _kernel_oserror * object_get_object_size(browser_data * b, int object, BB size->ymax = b->odata[object].height * 2; } + /* Don't allow zero in any direction */ + + if (size->xmax == 0 || size->ymax == 0) + { + size->xmax = ImageDefaultOSSize_X; + size->ymax = ImageDefaultOSSize_Y; + } + return NULL; } @@ -294,6 +309,80 @@ _kernel_oserror * object_get_token_object_size(browser_data * b, HStream * t, BB return object_get_object_size(b, object_get_token_object(b, t), size); } +/*************************************************/ +/* object_get_token_object_position() */ +/* */ +/* Returns the x and y fields of the object_info */ +/* structure for a given Object. */ +/* */ +/* Parameters: Pointer to a browser_data struct */ +/* relevant to the Object; */ +/* */ +/* Pointer to the token representing */ +/* the Object; */ +/* */ +/* Pointer to an int, in which the */ +/* X coordinate is returned; */ +/* */ +/* Pointer to an int, in which the */ +/* Y coordinate is returned. */ +/* */ +/* Returns: 1 if the object could not be */ +/* found from the given token, or 0 */ +/* for success. */ +/* */ +/* Assumes: Neither pointer is NULL. */ +/*************************************************/ + +int object_get_token_object_position(browser_data * b, HStream * t, int * x, int * y) +{ + int object = object_get_token_object(b, t); + + if (object < 0) return 1; + + *x = b->odata[object].x; + *y = b->odata[object].y; + + return 0; +} + +/*************************************************/ +/* object_set_token_object_position() */ +/* */ +/* Sets the x and y fields of the object_info */ +/* structure for a given Object, so that it may */ +/* be [partially] plotted during a fetch. */ +/* */ +/* Parameters: Pointer to a browser_data struct */ +/* relevant to the object; */ +/* */ +/* Pointer to the token representing */ +/* the Object; */ +/* */ +/* X coordinate (window coords); */ +/* */ +/* Y coordinate (window coords). */ +/* */ +/* Returns: Number of the Object that was */ +/* changed, or -1 if none could be */ +/* found for the given token. */ +/*************************************************/ + +int object_set_token_object_position(browser_data * b, HStream * t, int x, int y) +{ + int object = object_get_token_object(b, t); + + /* If an object was found, set the x and y coordinates */ + + if (object >= 0) + { + b->odata[object].x = x; + b->odata[object].y = y; + } + + return object; +} + /*************************************************/ /* object_redraw() */ /* */ @@ -347,7 +436,7 @@ _kernel_oserror * object_redraw(browser_data * b, WimpRedrawWindowBlock * r, HSt box.xmin &= ~(wimpt_dx() - 1); box.ymin &= ~(wimpt_dy() - 1); -Printf("%d, %d\n",box.xmax,box.ymax); + if (box.xmax > 8 && box.ymax > 8) { /* xmin, ymin hold the bottom left hand corner coordinates, whilst */ diff --git a/c/Redraw b/c/Redraw index f85f6f9ed4acedc363a4d5e5ba48b36b742a77b2..204ac660682a63491d60a689f4c35109ec8342e5 100644 --- a/c/Redraw +++ b/c/Redraw @@ -1794,16 +1794,16 @@ do_image: /* (This code is also used for form INPUT TYPE=IMAGE tags; see above) { ox -= box.xmin; - /* Draw a border of tp->maxlen * 2 OS units width around an */ - /* image, if it represents a link. (I.e. if 'border="3"' */ - /* was specified in the document source, a 3 pixel wide */ - /* border would be drawn in mode 20, say). */ - box.xmin += ox; box.ymin += oy; box.xmax += ox; box.ymax += oy; + /* Draw a border of tp->maxlen * 2 OS units width around an */ + /* image, if it represents a link. (I.e. if 'border="3"' */ + /* was specified in the document source, a 3 pixel wide */ + /* border would be drawn in mode 20, say). */ + if (ISLINK(tp)) { o = (tp->style & IMG) ? tp->maxlen * 2 : 4; @@ -1844,12 +1844,60 @@ do_image: /* (This code is also used for form INPUT TYPE=IMAGE tags; see above) convert_pair_to_os(x, y + base, &ox, &oy); + object_set_token_object_position(b, + tp, + coords_x_toworkarea(ox, r), + coords_y_toworkarea(oy, r)); + if (!reformat_get_object_size(b, tp, &box)) { ox -= box.xmin; - // Can you have borders on Objects? If so, draw them here in - // the same way as for images above. + box.xmin += ox; + box.ymin += oy; + box.xmax += ox; + box.ymax += oy; + +// Printf("declare : %d\n", HtmlOBJECTdeclare(tp)); +// Printf("shapes : %d\n", HtmlOBJECTshapes(tp)); +// Printf("tabindex: %d\n", HtmlOBJECTtabindex(tp)); +// Printf("type : '%s'\n", HtmlOBJECTtype(tp)); +// Printf("usemap : '%s'\n", HtmlOBJECTusemap(tp)); +// Printf("vspace : %d\n", HtmlOBJECTvspace(tp)); +// Printf("hspace : %d\n", HtmlOBJECThspace(tp)); +// Printf("align : %d\n", HtmlOBJECTalign(tp)); +// Printf("archive : '%s'\n", HtmlOBJECTarchive(tp)); +// Printf("border : %d\n", HtmlOBJECTborder(tp)); +// Printf("classid : '%s'\n", HtmlOBJECTclassid(tp)); +// Printf("codebase: '%s'\n", HtmlOBJECTcodebase(tp)); +// Printf("codetype: '%s'\n", HtmlOBJECTcodetype(tp)); +// Printf("data : '%s'\n", HtmlOBJECTdata(tp)); +// Printf("stream : %p\n", HtmlOBJECTstream(tp)); +// Printf("parent : %p\n\n", HtmlOBJECTparent(tp)); + + /* Draw a border, if required */ + + if (HtmlOBJECTborder(tp)) + { + o = HtmlOBJECTborder(tp) * 2; + + if (o) + { + redraw_set_colour(redraw_token_colour(b, tp)); + + bbc_rectanglefill(box.xmin, box.ymin, box.xmax - box.xmin - 1, o - 1); + bbc_rectanglefill(box.xmin, box.ymin, o - 1, box.ymax - box.ymin - 1); + bbc_rectanglefill(box.xmin, box.ymax - o, box.xmax - box.xmin - 1, o - 1); + bbc_rectanglefill(box.xmax - o, box.ymin, o - 1, box.ymax - box.ymin - 1); + } + + // A selection mode for Objects...? + // + // else if (redraw_selected(b, tp)) + // { + // redraw_border_around_box(&box, b->selected_colour); + // } + } } if (nocontent != tp) RetError(object_redraw(b, r, d->cdata[cn].t, o + box.xmin, o + box.ymin)); diff --git a/c/Reformat b/c/Reformat index 1e8c3606a7ab5ece3af06aae9966195461c41139..8df210e7cd1dc98832e9a9b7c3c523ae2fb8d609 100644 --- a/c/Reformat +++ b/c/Reformat @@ -1250,6 +1250,8 @@ _kernel_oserror * reformat_get_image_size(browser_data * b, HStream * tp, BBox * } break; + // Sort this out... Should align to top line of text, not baseline! + case imgalign_TOP: { box->ymin =- box->ymax; @@ -1299,55 +1301,48 @@ _kernel_oserror * reformat_get_image_size(browser_data * b, HStream * tp, BBox * _kernel_oserror * reformat_get_object_size(browser_data * b, HStream * tp, BBox * box) { _kernel_oserror * e; - -// imgalign align; + imgalign align; /* Get the Object size from the Object library */ RetError(object_get_token_object_size(b, tp, box)); -// /* Deal with alignments */ -// -// if (tp->style & IMG) /* It'll either be an IMG or an INPUT TYPE=IMAGE item */ -// { -// if ((tp->type & TYPE_ALIGN_MASK) == TYPE_MIDDLE) align = imgalign_MIDDLE; -// else if ((tp->type & TYPE_ALIGN_MASK) == TYPE_TOP) align = imgalign_TOP; -// else align = imgalign_NONE; -// } -// else align = HtmlINPUTalign(tp); -// -// switch (align) -// { -// case imgalign_MIDDLE: -// { -// box->ymin -= box->ymax / 2; -// box->ymax /= 2; -// } -// break; -// -// case imgalign_TOP: -// { -// box->ymin =- box->ymax; -// box->ymax = 0; -// } -// break; -// } -// -// /* Deal with links - need to account for a border */ -// /* of maxlen * 2 pixels width. ISLINK is defined */ -// /* in Fetch.h. */ -// -// if (ISLINK(tp) && (tp->style & IMG)) -// { -// int b; -// -// b = tp->maxlen * 2; -// -// box->xmax += b; -// box->ymax += b; -// box->xmin -= b; -// box->ymin -= b; -// } + /* Deal with alignments */ + + align = HtmlOBJECTalign(tp); + + switch (align) + { + case imgalign_MIDDLE: + { + box->ymin -= box->ymax / 2; + box->ymax /= 2; + } + break; + + // Sort this out, as with image handling + + case imgalign_TOP: + { + box->ymin =- box->ymax; + box->ymax = 0; + } + break; + } + + /* Account for a border */ + + if (HtmlOBJECTborder(tp)) + { + int b; + + b = HtmlOBJECTborder(tp) * 2; + + box->xmax += b; + box->ymax += b; + box->xmin -= b; + box->ymin -= b; + } return NULL; } diff --git a/h/Choices b/h/Choices index e41da22b0c444533ed7b953719c206232922ade4..ed4431e45cf03528cde6b42cc9009ea5efca829a 100644 --- a/h/Choices +++ b/h/Choices @@ -23,11 +23,6 @@ /* History: 23-Sep-97: Created. */ /***************************************************/ -/* Define this if you want to display the Selected colour */ -/* in the faked page. */ - -#define ChoiceUseSelected - /* Choices main dialogue component IDs */ #define CDSet 0x2600 diff --git a/h/Images b/h/Images index 3ccb6c71c0b47ebcfe6e96843d7d2567545f502d..1d8980e4cb1bf64d74ee2763415c6d7672a0ec04 100644 --- a/h/Images +++ b/h/Images @@ -32,7 +32,8 @@ /* order to aid legibility. */ /***************************************************/ -/* Size reported for an image if it's data isn't present and no other size information can be found */ +/* Size reported for an image or Object if it's data isn't */ +/* present and no other size information can be found */ #define ImageDefaultOSSize_X 48 #define ImageDefaultOSSize_Y 48 diff --git a/h/Object b/h/Object index 3915c18c231c4512e4ce5a900df88efb50bc4e8d..ad0b784c0d4768fe18a22041f79f571136e3bbad 100644 --- a/h/Object +++ b/h/Object @@ -37,6 +37,9 @@ typedef struct object_info HStream * token; + int x; + int y; + int width; int height; int units; @@ -45,9 +48,11 @@ object_info; /* Function prototypes */ -_kernel_oserror * object_new_object (browser_data * b, HStream * t); -_kernel_oserror * object_discard (browser_data * b); +_kernel_oserror * object_new_object (browser_data * b, HStream * t); +_kernel_oserror * object_discard (browser_data * b); -_kernel_oserror * object_get_token_object_size (browser_data * b, HStream * t, BBox * size); +_kernel_oserror * object_get_token_object_size (browser_data * b, HStream * t, BBox * size); +int object_get_token_object_position (browser_data * b, HStream * t, int * x, int * y); +int object_set_token_object_position (browser_data * b, HStream * t, int x, int y); -_kernel_oserror * object_redraw (browser_data * b, WimpRedrawWindowBlock * r, HStream * token, int x, int y); +_kernel_oserror * object_redraw (browser_data * b, WimpRedrawWindowBlock * r, HStream * token, int x, int y);