From f185bb4d0d24eef210a7c6db31c0ce15b0d252b2 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Tue, 9 Sep 2003 21:43:44 +0000 Subject: [project @ 2003-09-09 21:43:44 by bursa] Display image alt text while it loads. svn path=/import/netsurf/; revision=278 --- !NetSurf/Resources/CSS,f79 | 2 +- render/box.c | 24 ++-- render/box.h | 1 + render/html.c | 42 +++--- render/layout.c | 60 +++++---- riscos/htmlredraw.c | 324 ++++++++++++++++++++------------------------- 6 files changed, 208 insertions(+), 245 deletions(-) diff --git a/!NetSurf/Resources/CSS,f79 b/!NetSurf/Resources/CSS,f79 index f2ec0d8e5..2d0e03023 100644 --- a/!NetSurf/Resources/CSS,f79 +++ b/!NetSurf/Resources/CSS,f79 @@ -19,7 +19,7 @@ col { display: table-column } colgroup { display: table-column-group } td, th { display: table-cell } caption { display: table-caption } -img { color: #0b0; font-style: italic; } +img { color: #888; } h1 { font-size: xx-large; font-weight: bold; } h2 { font-size: x-large; } diff --git a/render/box.c b/render/box.c index 382429bb1..bbe02c732 100644 --- a/render/box.c +++ b/render/box.c @@ -152,6 +152,7 @@ struct box * box_create(struct css_style * style, /* under RISC OS, xcalloc makes these unnecessary */ box->text = 0; box->space = 0; + box->clone = 0; box->length = 0; box->start_column = 0; box->next = 0; @@ -590,17 +591,17 @@ struct result box_image(xmlNode *n, struct status *status, { struct box *box; char *s, *url; - /*xmlChar *s2;*/ + xmlChar *s2; box = box_create(style, status->href, status->title); /* handle alt text */ - /*if ((s2 = xmlGetProp(n, (const xmlChar *) "alt"))) { + if ((s2 = xmlGetProp(n, (const xmlChar *) "alt"))) { box->text = squash_tolat1(s2); box->length = strlen(box->text); - box->font = font_open(content->data.html.fonts, style); + box->font = font_open(status->content->data.html.fonts, style); free(s2); - }*/ + } /* img without src is an error */ if (!(s = (char *) xmlGetProp(n, (const xmlChar *) "src"))) @@ -919,12 +920,7 @@ void box_dump(struct box * box, unsigned int depth) switch (box->type) { case BOX_BLOCK: fprintf(stderr, "BOX_BLOCK "); break; case BOX_INLINE_CONTAINER: fprintf(stderr, "BOX_INLINE_CONTAINER "); break; - case BOX_INLINE: if (box->text != 0) - fprintf(stderr, "BOX_INLINE '%.*s' ", - (int) box->length, box->text); - else - fprintf(stderr, "BOX_INLINE (special) "); - break; + case BOX_INLINE: fprintf(stderr, "BOX_INLINE "); break; case BOX_TABLE: fprintf(stderr, "BOX_TABLE "); break; case BOX_TABLE_ROW: fprintf(stderr, "BOX_TABLE_ROW "); break; case BOX_TABLE_CELL: fprintf(stderr, "BOX_TABLE_CELL [columns %i] ", @@ -934,12 +930,16 @@ void box_dump(struct box * box, unsigned int depth) case BOX_FLOAT_RIGHT: fprintf(stderr, "BOX_FLOAT_RIGHT "); break; default: fprintf(stderr, "Unknown box type "); } + if (box->text) + fprintf(stderr, "'%.*s' ", (int) box->length, box->text); + if (box->object) + fprintf(stderr, "(object '%s') ", box->object->url); if (box->style) css_dump_style(box->style); if (box->href != 0) - fprintf(stderr, " -> '%s'", box->href); + fprintf(stderr, " -> '%s' ", box->href); if (box->title != 0) - fprintf(stderr, " [%s]", box->title); + fprintf(stderr, "[%s]", box->title); fprintf(stderr, "\n"); for (c = box->children; c != 0; c = c->next) diff --git a/render/box.h b/render/box.h index 002bb0601..bf56df591 100644 --- a/render/box.h +++ b/render/box.h @@ -126,6 +126,7 @@ struct box { unsigned long min_width, max_width; char * text; unsigned int space : 1; /* 1 <=> followed by a space */ + unsigned int clone : 1; char * href; char * title; unsigned int length; diff --git a/render/html.c b/render/html.c index 443d4cd7d..13b4e9bf6 100644 --- a/render/html.c +++ b/render/html.c @@ -412,37 +412,33 @@ void html_object_callback(content_msg msg, struct content *object, box->style->width.value.length.unit = CSS_UNIT_PX; box->style->width.value.length.value = object->width; box->min_width = box->max_width = box->width = object->width; - /* invalidate parent min, max widths */ - if (box->parent->max_width != UNKNOWN_MAX_WIDTH) { - struct box *b = box->parent; - if (b->min_width < object->width) - b->min_width = object->width; - if (b->max_width < object->width) - b->max_width = object->width; - for (b = b->parent; b != 0 && - (b->type == BOX_TABLE_ROW_GROUP || - b->type == BOX_TABLE_ROW || - b->max_width != UNKNOWN_MAX_WIDTH); - b = b->parent) - b->max_width = UNKNOWN_MAX_WIDTH; + } + /* invalidate parent min, max widths */ + if (box->parent->max_width != UNKNOWN_MAX_WIDTH) { + struct box *b = box->parent; + if (b->min_width < object->width) + b->min_width = object->width; + if (b->max_width < object->width) + b->max_width = object->width; + for (b = b->parent; b != 0 && + (b->type == BOX_TABLE_ROW_GROUP || + b->type == BOX_TABLE_ROW || + b->max_width != UNKNOWN_MAX_WIDTH); + b = b->parent) { + b->max_width = UNKNOWN_MAX_WIDTH; } } if (box->style->height.height == CSS_HEIGHT_AUTO) { box->style->height.height = CSS_HEIGHT_LENGTH; box->style->height.length.unit = CSS_UNIT_PX; box->style->height.length.value = object->height; + box->height = object->height; } - /* remove alt text */ - if (box->text != 0) { - free(box->text); - box->text = 0; - box->length = 0; + /* delete any clones of this box */ + while (box->next && box->next->clone) { + /* box_free_box(box->next); */ + box->next = box->next->next; } - /*if (box->children != 0) { - box_free(box->children); - box->children = 0; - }*/ - /* TODO: recalculate min, max width */ c->active--; break; diff --git a/render/layout.c b/render/layout.c index 9a6785025..73fb14a41 100644 --- a/render/layout.c +++ b/render/layout.c @@ -354,30 +354,29 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long for (x = 0, b = first; x < x1 - x0 && b != 0; b = b->next) { assert(b->type == BOX_INLINE || b->type == BOX_FLOAT_LEFT || b->type == BOX_FLOAT_RIGHT); if (b->type == BOX_INLINE) { - if (b->text != 0) + if (b->object && b->style && b->style->height.height == CSS_HEIGHT_LENGTH) + h = len(&b->style->height.length, b->style); + else if (b->text) h = line_height(b->style ? b->style : b->parent->parent->style); else if (b->gadget != 0) h = gadget_height(b->gadget); - else if (b->style != 0 && b->style->height.height == CSS_HEIGHT_LENGTH) - h = len(&b->style->height.length, b->style); else h = 0; b->height = h; if (h > height) height = h; - if (b->width == UNKNOWN_WIDTH) { - if (b->text != 0) + if (b->object && b->style && b->style->width.width == CSS_WIDTH_LENGTH) + b->width = len(&b->style->width.value.length, b->style); + else if (b->object && b->style && b->style->width.width == CSS_WIDTH_PERCENT) + b->width = width * b->style->width.value.percent / 100; + else if (b->text) { + if (b->width == UNKNOWN_WIDTH) b->width = font_width(b->font, b->text, b->length); - else if (b->gadget != 0) - b->width = gadget_width(b->gadget); - else if (b->style != 0 && b->style->width.width == CSS_WIDTH_LENGTH) - b->width = len(&b->style->width.value.length, b->style); - else if (b->style != 0 && b->style->width.width == CSS_WIDTH_PERCENT) - b->width = width * b->style->width.value.percent / 100; - else - b->width = 0; - } + } else if (b->gadget != 0) + b->width = gadget_width(b->gadget); + else + b->width = 0; if (b->text != 0) x += b->width + b->space ? b->font->space_width : 0; @@ -399,7 +398,9 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long b->x = x; x += b->width; space_before = space_after; - if (b->text != 0) + if (b->object) + space_after = 0; + else if (b->text) space_after = b->space ? b->font->space_width : 0; else space_after = 0; @@ -461,7 +462,7 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long x = x_previous; - if (c->text != 0) + if (!c->object && c->text) space = strchr(c->text, ' '); if (space != 0 && c->length <= (unsigned int) (space - c->text)) /* space after end of string */ @@ -485,6 +486,7 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long c2->text = xstrdup(space + 1); c2->length = c->length - ((space + 1) - c->text); c2->width = UNKNOWN_WIDTH; + c2->clone = 1; c->length = space - c->text; c->width = w; c->space = 1; @@ -510,6 +512,7 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long c2->text = xstrdup(space + 1); c2->length = c->length - ((space + 1) - c->text); c2->width = UNKNOWN_WIDTH; + c2->clone = 1; c->length = space - c->text; c->width = w; c->space = 1; @@ -852,8 +855,16 @@ void calculate_inline_container_widths(struct box *box) for (child = box->children; child != 0; child = child->next) { switch (child->type) { case BOX_INLINE: - if (child->text != 0) - { + if (child->object) { + if (child->style->width.width == CSS_WIDTH_LENGTH) { + child->width = len(&child->style->width.value.length, + child->style); + max += child->width; + if (min < child->width) + min = child->width; + } + + } else if (child->text) { /* max = all one line */ child->width = font_width(child->font, child->text, child->length); @@ -872,22 +883,13 @@ void calculate_inline_container_widths(struct box *box) } width = font_width(child->font, word, strlen(word)); if (min < width) min = width; - } - else if (child->gadget != 0) - { + + } else if (child->gadget) { child->width = gadget_width(child->gadget); max += child->width; if (min < child->width) min = child->width; } - else if (child->style->width.width == CSS_WIDTH_LENGTH) - { - child->width = len(&child->style->width.value.length, - child->style); - max += child->width; - if (min < child->width) - min = child->width; - } break; case BOX_FLOAT_LEFT: diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c index 588dde2a3..bd13f0ac4 100644 --- a/riscos/htmlredraw.c +++ b/riscos/htmlredraw.c @@ -70,80 +70,65 @@ void html_redraw_box(struct content *content, struct box * box, signed long gadget_subtract_x, signed long gadget_subtract_y, bool *select_on) { - struct box * c; - char* select_text; - struct formoption* opt; - int i; - - if (x + (signed long) (box->x*2 + box->width*2) /* right edge */ >= clip->x0 && - x + (signed long) (box->x*2) /* left edge */ <= clip->x1 && - y - (signed long) (box->y*2 + box->height*2 + 8) /* bottom edge */ <= clip->y1 && - y - (signed long) (box->y*2) /* top edge */ >= clip->y0) - { - -#ifdef FANCY_LINKS - if (box == g->link_box) - { - colourtrans_set_gcol(os_COLOUR_BLACK, colourtrans_USE_ECFS, os_ACTION_OVERWRITE, 0); - os_plot(os_MOVE_TO, x + box->x * 2, y - box->y * 2 - box->height * 2 - 4); - os_plot(os_PLOT_SOLID | os_PLOT_BY, box->width * 2, 0); - } -#endif - - if (box->style != 0 && box->style->background_color != TRANSPARENT) - { - colourtrans_set_gcol(box->style->background_color << 8, colourtrans_USE_ECFS, - os_ACTION_OVERWRITE, 0); - os_plot(os_MOVE_TO, (int) x + (int) box->x * 2, (int) y - (int) box->y * 2); - os_plot(os_PLOT_RECTANGLE | os_PLOT_BY, (int) box->width * 2, - (int) box->height * 2); - current_background_color = box->style->background_color; - } - - if (box->object != 0) - { - content_redraw(box->object, - (int) x + (int) box->x * 2, - (int) y - (int) box->y * 2, - box->width * 2, box->height * 2); - } - else if (box->gadget != 0) - { - wimp_icon icon; - LOG(("writing GADGET")); - - icon.extent.x0 = -gadget_subtract_x + x + box->x * 2; - icon.extent.y0 = -gadget_subtract_y + y - box->y * 2 - box->height * 2; - icon.extent.x1 = -gadget_subtract_x + x + box->x * 2 + box->width * 2; - icon.extent.y1 = -gadget_subtract_y + y - box->y * 2; - - switch (box->gadget->type) - { + struct box *c; + char *select_text; + struct formoption *opt; + + if (x + (signed long) (box->x * 2 + box->width * 2) /* right edge */ < clip->x0 || + x + (signed long) (box->x * 2) /* left edge */ > clip->x1 || + y - (signed long) (box->y * 2 + box->height * 2 + 8) /* bottom edge */ > clip->y1 || + y - (signed long) (box->y * 2) /* top edge */ < clip->y0) + return; + + if (box->style != 0 && box->style->background_color != TRANSPARENT) { + colourtrans_set_gcol(box->style->background_color << 8, colourtrans_USE_ECFS, os_ACTION_OVERWRITE, 0); + os_plot(os_MOVE_TO, (int) x + (int) box->x * 2, (int) y - (int) box->y * 2); + os_plot(os_PLOT_RECTANGLE | os_PLOT_BY, (int) box->width * 2, -(int) box->height * 2); + current_background_color = box->style->background_color; + } + + if (box->object) { + content_redraw(box->object, + (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2, + box->width * 2, box->height * 2); + + } else if (box->gadget) { + wimp_icon icon; + LOG(("writing GADGET")); + + icon.extent.x0 = -gadget_subtract_x + x + box->x * 2; + icon.extent.y0 = -gadget_subtract_y + y - box->y * 2 - box->height * 2; + icon.extent.x1 = -gadget_subtract_x + x + box->x * 2 + box->width * 2; + icon.extent.y1 = -gadget_subtract_y + y - box->y * 2; + + switch (box->gadget->type) { case GADGET_TEXTAREA: icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER | - wimp_ICON_VCENTRED | wimp_ICON_FILLED | - wimp_ICON_INDIRECTED | - (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | - (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT); + wimp_ICON_VCENTRED | wimp_ICON_FILLED | + wimp_ICON_INDIRECTED | + (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | + (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT); icon.data.indirected_text.text = box->gadget->data.textarea.text; icon.data.indirected_text.size = strlen(box->gadget->data.textarea.text); icon.data.indirected_text.validation = validation_textarea; LOG(("writing GADGET TEXTAREA")); wimp_plot_icon(&icon); - break; + break; case GADGET_TEXTBOX: icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER | - wimp_ICON_VCENTRED | wimp_ICON_FILLED | - wimp_ICON_INDIRECTED | - (wimp_COLOUR_DARK_GREY << wimp_ICON_FG_COLOUR_SHIFT) | - (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT); + wimp_ICON_VCENTRED | wimp_ICON_FILLED | + wimp_ICON_INDIRECTED | + (wimp_COLOUR_DARK_GREY << wimp_ICON_FG_COLOUR_SHIFT) | + (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT); icon.data.indirected_text.text = box->gadget->data.textbox.text; icon.data.indirected_text.size = box->gadget->data.textbox.maxlength + 1; icon.data.indirected_text.validation = validation_textbox; LOG(("writing GADGET TEXTBOX")); wimp_plot_icon(&icon); - break; + break; case GADGET_PASSWORD: icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER | @@ -160,20 +145,18 @@ void html_redraw_box(struct content *content, struct box * box, case GADGET_ACTIONBUTTON: icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER | - wimp_ICON_VCENTRED | wimp_ICON_FILLED | - wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED | - (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT); + wimp_ICON_VCENTRED | wimp_ICON_FILLED | + wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED | + (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT); icon.data.indirected_text.text = box->gadget->data.actionbutt.label; icon.data.indirected_text.size = strlen(box->gadget->data.actionbutt.label); - if (box->gadget->data.actionbutt.pressed) - { - icon.data.indirected_text.validation = validation_actionbutton_pressed; - icon.flags |= (wimp_COLOUR_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT) | wimp_ICON_SELECTED; - } - else - { - icon.data.indirected_text.validation = validation_actionbutton; - icon.flags |= (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT); + if (box->gadget->data.actionbutt.pressed) { + icon.data.indirected_text.validation = validation_actionbutton_pressed; + icon.flags |= + (wimp_COLOUR_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT) | wimp_ICON_SELECTED; + } else { + icon.data.indirected_text.validation = validation_actionbutton; + icon.flags |= (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT); } LOG(("writing GADGET ACTION")); wimp_plot_icon(&icon); @@ -181,10 +164,10 @@ void html_redraw_box(struct content *content, struct box * box, case GADGET_SELECT: icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER | - wimp_ICON_VCENTRED | wimp_ICON_FILLED | - wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED | - (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | - (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT); + wimp_ICON_VCENTRED | wimp_ICON_FILLED | + wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED | + (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | + (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT); select_text = 0; opt = box->gadget->data.select.items; // if (box->gadget->data.select.size == 1) { @@ -241,21 +224,19 @@ void html_redraw_box(struct content *content, struct box * box, case GADGET_CHECKBOX: icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE | - wimp_ICON_VCENTRED | wimp_ICON_HCENTRED | - wimp_ICON_INDIRECTED; + wimp_ICON_VCENTRED | wimp_ICON_HCENTRED | wimp_ICON_INDIRECTED; icon.data.indirected_text_and_sprite.text = empty_text; if (box->gadget->data.checkbox.selected) - icon.data.indirected_text_and_sprite.validation = validation_checkbox_selected; + icon.data.indirected_text_and_sprite.validation = validation_checkbox_selected; else - icon.data.indirected_text_and_sprite.validation = validation_checkbox_unselected; + icon.data.indirected_text_and_sprite.validation = validation_checkbox_unselected; icon.data.indirected_text_and_sprite.size = 1; LOG(("writing GADGET CHECKBOX")); wimp_plot_icon(&icon); break; case GADGET_RADIO: - icon.flags = wimp_ICON_SPRITE | - wimp_ICON_VCENTRED | wimp_ICON_HCENTRED; + icon.flags = wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_HCENTRED; if (box->gadget->data.radio.selected) strcpy(icon.data.sprite, "radioon"); else @@ -267,109 +248,92 @@ void html_redraw_box(struct content *content, struct box * box, case GADGET_HIDDEN: case GADGET_IMAGE: break; + } + LOG(("gadgets finished")); + + } else if (box->text && box->font) { + + if (content->data.html.text_selection.selected == 1) { + struct box_position *start; + struct box_position *end; + + start = &(content->data.html.text_selection.start); + end = &(content->data.html.text_selection.end); + + if (start->box == box) { + fprintf(stderr, "THE START OFFSET IS %d\n", start->pixel_offset * 2); + if (end->box == box) { + colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); + os_plot(os_MOVE_TO, + (int) x + (int) box->x * 2 + start->pixel_offset * 2, + (int) y - (int) box->y * 2 - (int) box->height * 2); + os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, + (int) x + (int) box->x * 2 + end->pixel_offset * 2 - 2, + (int) y - (int) box->y * 2 - 2); + } else { + colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); + os_plot(os_MOVE_TO, + (int) x + (int) box->x * 2 + start->pixel_offset * 2, + (int) y - (int) box->y * 2 - (int) box->height * 2); + os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, + (int) x + (int) box->x * 2 + (int) box->width * 2 - 2, + (int) y - (int) box->y * 2 - 2); + *select_on = true; + } + } else if (*select_on) { + if (end->box != box) { + colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); + os_plot(os_MOVE_TO, (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2 - (int) box->height * 2); + os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, + (int) x + (int) box->x * 2 + (int) box->width * 2 - 2, + (int) y - (int) box->y * 2 - 2); + } else { + colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); + os_plot(os_MOVE_TO, (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2 - (int) box->height * 2); + os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, + (int) x + (int) box->x * 2 + end->pixel_offset * 2 - 2, + (int) y - (int) box->y * 2 - 2); + *select_on = false; + } + } + } + + colourtrans_set_font_colours(box->font->handle, current_background_color << 8, + box->style->color << 8, 14, 0, 0, 0); + + font_paint(box->font->handle, box->text, + font_OS_UNITS | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH, + (int) x + (int) box->x * 2, (int) y - (int) box->y * 2 - (int) (box->height * 1.5), + NULL, NULL, (int) box->length); + + } else { + for (c = box->children; c != 0; c = c->next) + if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT) + html_redraw_box(content, c, (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2, clip, current_background_color, + gadget_subtract_x, gadget_subtract_y, select_on); + + for (c = box->float_children; c != 0; c = c->next_float) + html_redraw_box(content, c, (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2, clip, current_background_color, + gadget_subtract_x, gadget_subtract_y, select_on); } - LOG(("gadgets finished")); - } - if (box->type == BOX_INLINE && box->font != 0) - { +/* } else { + if (content->data.html.text_selection.selected == 1) { + struct box_position *start; + struct box_position *end; -if (content->data.html.text_selection.selected == 1) -{ - struct box_position* start; - struct box_position* end; - - start = &(content->data.html.text_selection.start); - end = &(content->data.html.text_selection.end); - - if (start->box == box) - { - fprintf(stderr, "THE START OFFSET IS %d\n", start->pixel_offset * 2); - if (end->box == box) - { - colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); - os_plot(os_MOVE_TO, - (int) x + (int) box->x * 2 + start->pixel_offset * 2, - (int) y - (int) box->y * 2 - (int) box->height * 2); - os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, - (int) x + (int) box->x * 2 + end->pixel_offset * 2 - 2, - (int) y - (int) box->y * 2 - 2); - } - else - { - colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); - os_plot(os_MOVE_TO, - (int) x + (int) box->x * 2 + start->pixel_offset * 2, - (int) y - (int) box->y * 2 - (int) box->height * 2); - os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, - (int) x + (int) box->x * 2 + (int) box->width * 2 - 2, - (int) y - (int) box->y * 2 - 2); - *select_on = true; - } - } - else if (*select_on) - { - if (end->box != box) - { - colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); - os_plot(os_MOVE_TO, - (int) x + (int) box->x * 2, - (int) y - (int) box->y * 2 - (int) box->height * 2); - os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, - (int) x + (int) box->x * 2 + (int) box->width * 2 - 2, - (int) y - (int) box->y * 2 - 2); - } - else - { - colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_USE_ECFS, 0, 0); - os_plot(os_MOVE_TO, - (int) x + (int) box->x * 2, - (int) y - (int) box->y * 2 - (int) box->height * 2); - os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, - (int) x + (int) box->x * 2 + end->pixel_offset * 2 - 2, - (int) y - (int) box->y * 2 - 2); - *select_on = false; - } - } -} + start = &(content->data.html.text_selection.start); + end = &(content->data.html.text_selection.end); - colourtrans_set_font_colours(box->font->handle, current_background_color << 8, box->style->color << 8, - 14, 0, 0, 0); - - font_paint(box->font->handle, box->text, - font_OS_UNITS | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH, - (int) x + (int) box->x * 2, (int) y - (int) box->y * 2 - (int) (box->height * 1.5), - NULL, NULL, - (int) box->length); - - } - } - else - { - if (content->data.html.text_selection.selected == 1) - { - struct box_position* start; - struct box_position* end; - - start = &(content->data.html.text_selection.start); - end = &(content->data.html.text_selection.end); - - if (start->box == box && end->box != box) - *select_on = true; - else if (*select_on && end->box == box) - *select_on = false; - } - } - - for (c = box->children; c != 0; c = c->next) - if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT) - html_redraw_box(content, c, (int) x + (int) box->x * 2, - (int) y - (int) box->y * 2, clip, current_background_color, - gadget_subtract_x, gadget_subtract_y, select_on); - - for (c = box->float_children; c != 0; c = c->next_float) - html_redraw_box(content, c, (int) x + (int) box->x * 2, - (int) y - (int) box->y * 2, clip, current_background_color, - gadget_subtract_x, gadget_subtract_y, select_on); + if (start->box == box && end->box != box) + *select_on = true; + else if (*select_on && end->box == box) + *select_on = false; + } + }*/ } -- cgit v1.2.3