Commit 26638448 authored by Andrew Hodgkinson's avatar Andrew Hodgkinson
Browse files

Res files had component 0x29fc in frame gadgets for Choices - that's meant to...

Res files had component 0x29fc in frame gadgets for Choices - that's meant to be the 'fake page' display. Sorted that out.

Got rid of unnecessary #define in Choices.h; the gadget autodetect
for the colour choices took its place.

Unsized objects now default to the same dimensions as unsized images.
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -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 */
......
......@@ -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));
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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
......
......@@ -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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment