summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/gui.h1
-rw-r--r--makefile2
-rw-r--r--riscos/gui.c362
-rw-r--r--riscos/gui.h2
-rw-r--r--riscos/htmlredraw.c327
5 files changed, 332 insertions, 362 deletions
diff --git a/desktop/gui.h b/desktop/gui.h
index a12cb8d5e..821d528b3 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -54,7 +54,6 @@ void gui_multitask(void);
void gui_poll(void);
gui_safety gui_window_set_redraw_safety(gui_window* g, gui_safety s);
-int gui_file_to_filename(char* location, char* actual_filename, int size);
void gui_window_start_throbber(gui_window* g);
void gui_window_stop_throbber(gui_window* g);
diff --git a/makefile b/makefile
index c5046d386..f402b1fdc 100644
--- a/makefile
+++ b/makefile
@@ -13,7 +13,7 @@ OBJECTS_COMMON = cache.o content.o fetch.o fetchcache.o other.o \
OBJECTS = $(OBJECTS_COMMON) \
browser.o netsurf.o \
dialog.o download.o gif.o gui.o jpeg.o menus.o png.o theme.o plugin.o \
- options.o filetype.o font.o uri.o
+ options.o filetype.o font.o uri.o htmlredraw.o
OBJECTS_DEBUG = $(OBJECTS_COMMON) \
netsurfd.o \
optionsd.o filetyped.o fontd.o
diff --git a/riscos/gui.c b/riscos/gui.c
index b52afa646..5f964c6e0 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -14,7 +14,6 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "oslib/colourtrans.h"
#include "oslib/os.h"
#include "oslib/osfile.h"
#include "oslib/osgbpb.h"
@@ -35,9 +34,11 @@
#include "netsurf/utils/utils.h"
const char *__dynamic_da_name = "NetSurf";
+static char empty_text[] = "";
char *NETSURF_DIR;
gui_window *window_list = 0;
+os_box *clip;
int gadget_subtract_x;
int gadget_subtract_y;
@@ -320,318 +321,6 @@ gui_safety gui_window_set_redraw_safety(gui_window* g, gui_safety s)
}
-os_box *clip;
-
-void html_redraw(struct content *c, long x, long y,
- unsigned long width, unsigned long height)
-{
- bool select_on = false;
- unsigned long background_colour = 0xffffff;
- struct box *box;
-
- assert(c->data.html.layout != NULL);
- box = c->data.html.layout->children;
- assert(box);
-
- /* clear to background colour */
- if (c->data.html.background_colour != TRANSPARENT) {
- colourtrans_set_gcol(c->data.html.background_colour << 8,
- colourtrans_SET_BG | colourtrans_USE_ECFS,
- os_ACTION_OVERWRITE, 0);
- os_clg();
- background_colour = c->data.html.background_colour;
- }
-
- ro_gui_window_redraw_box(c, box, x, y, clip, background_colour, x, y,
- &select_on);
-}
-
-
-int select_on = 0;
-
-/* validation strings can't be const */
-static char validation_textarea[] = "R7;L";
-static char validation_textbox[] = "";
-static char validation_actionbutton[] = "R5";
-static char validation_actionbutton_pressed[] = "R5,3";
-static char validation_select[] = "R2";
-static char validation_checkbox_selected[] = "Sopton";
-static char validation_checkbox_unselected[] = "Soptoff";
-static char validation_radio_selected[] = "Sradioon";
-static char validation_radio_unselected[] = "Sradiooff";
-
-static char select_text_multiple[] = "<Multiple>"; /* TODO: read from messages */
-static char select_text_none[] = "<None>";
-
-static char empty_text[] = "";
-
-void ro_gui_window_redraw_box(struct content *content, struct box * box,
- signed long x, signed long y, os_box* clip,
- unsigned long current_background_color,
- signed long gadget_subtract_x, signed long gadget_subtract_y,
- bool *select_on)
-{
- 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)
- {
-
-#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);
- }
-/* if (box->img != 0)
- {
- colourtrans_set_gcol(os_COLOUR_LIGHT_GREY, 0, 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);
- }*/
- 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)
- {
- 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);
- 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;
-
-
- 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);
- 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;
-
- 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);
- 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);
- }
- LOG(("writing GADGET ACTION"));
- wimp_plot_icon(&icon);
- break;
-
- 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);
- select_text = 0;
- opt = box->gadget->data.select.items;
- while (opt != NULL)
- {
- if (opt->selected)
- {
- if (select_text == 0)
- select_text = opt->text;
- else
- select_text = select_text_multiple;
- }
- opt = opt->next;
- }
- if (select_text == 0)
- select_text = select_text_none;
- icon.data.indirected_text.text = select_text;
- icon.data.indirected_text.size = strlen(icon.data.indirected_text.text);
- icon.data.indirected_text.validation = validation_select;
- LOG(("writing GADGET ACTION"));
- wimp_plot_icon(&icon);
- break;
-
- case GADGET_CHECKBOX:
- icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE |
- 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;
- else
- 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;
- if (box->gadget->data.radio.selected)
- strcpy(icon.data.sprite, "radioon");
- else
- strcpy(icon.data.sprite, "radiooff");
- LOG(("writing GADGET RADIO"));
- wimp_plot_icon(&icon);
- break;
-
- case GADGET_HIDDEN:
- break;
- }
- LOG(("gadgets finished"));
- }
-
- if (box->type == BOX_INLINE && box->font != 0)
- {
-
-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
- {
- 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)
- ro_gui_window_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)
- ro_gui_window_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);
-}
void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw)
@@ -1903,53 +1592,6 @@ void gui_poll(void)
return;
}
-int gui_file_to_filename(char* location, char* actual_filename, int size)
-{
- char* current;
- int count = 0;
-
- if (strspn(location, "file:/") != strlen("file:/"))
- return -1;
-
- current = location + strlen("file:/");
- while (*current != '\0' && count < size - 1)
- {
- if (strspn(current, "..") == 2)
- {
- if (actual_filename != NULL)
- actual_filename[count] = '^';
- count++;
- current += 2;
- }
- if (*current == '/')
- {
- if (actual_filename != NULL)
- actual_filename[count] = '.';
- count++;
- current += 1;
- }
- else if (*current == '.')
- {
- if (actual_filename != NULL)
- actual_filename[count] = '/';
- count++;
- current += 1;
- }
- else
- {
- if (actual_filename != NULL)
- actual_filename[count] = *current;
- count++;
- current += 1;
- }
- }
-
- if (actual_filename != NULL)
- actual_filename[count] = '\0';
-
- return count + 1;
-}
-
void gui_window_start_throbber(gui_window* g)
{
g->throbtime = (float) (clock() + 0) / CLOCKS_PER_SEC; /* workaround compiler warning */
diff --git a/riscos/gui.h b/riscos/gui.h
index 9f1f60e39..94b24f84d 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -8,6 +8,7 @@
#ifndef _NETSURF_RISCOS_GUI_H_
#define _NETSURF_RISCOS_GUI_H_
+#include "oslib/os.h"
#include "oslib/wimp.h"
#include "netsurf/desktop/browser.h"
#include "netsurf/desktop/netsurf.h"
@@ -24,6 +25,7 @@ extern int current_menu_x, current_menu_y, iconbar_menu_height;
extern struct gui_gadget *current_gadget;
extern const char *HOME_URL;
extern gui_window *window_list;
+extern os_box *clip;
struct gui_window
diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c
new file mode 100644
index 000000000..d3ef7d500
--- /dev/null
+++ b/riscos/htmlredraw.c
@@ -0,0 +1,327 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
+ * Copyright 2003 James Bursa <bursa@users.sourceforge.net>
+ */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <string.h>
+#include "oslib/colourtrans.h"
+#include "oslib/font.h"
+#include "netsurf/content/content.h"
+#include "netsurf/render/html.h"
+#include "netsurf/riscos/gui.h"
+#include "netsurf/utils/log.h"
+
+static void html_redraw_box(struct content *content, struct box * box,
+ signed long x, signed long y, os_box* clip,
+ unsigned long current_background_color,
+ signed long gadget_subtract_x, signed long gadget_subtract_y,
+ bool *select_on);
+
+void html_redraw(struct content *c, long x, long y,
+ unsigned long width, unsigned long height)
+{
+ bool select_on = false;
+ unsigned long background_colour = 0xffffff;
+ struct box *box;
+
+ assert(c->data.html.layout != NULL);
+ box = c->data.html.layout->children;
+ assert(box);
+
+ /* clear to background colour */
+ if (c->data.html.background_colour != TRANSPARENT) {
+ colourtrans_set_gcol(c->data.html.background_colour << 8,
+ colourtrans_SET_BG | colourtrans_USE_ECFS,
+ os_ACTION_OVERWRITE, 0);
+ os_clg();
+ background_colour = c->data.html.background_colour;
+ }
+
+ html_redraw_box(c, box, x, y, clip, background_colour, x, y,
+ &select_on);
+}
+
+
+/* validation strings can't be const */
+static char validation_textarea[] = "R7;L";
+static char validation_textbox[] = "";
+static char validation_actionbutton[] = "R5";
+static char validation_actionbutton_pressed[] = "R5,3";
+static char validation_select[] = "R2";
+static char validation_checkbox_selected[] = "Sopton";
+static char validation_checkbox_unselected[] = "Soptoff";
+static char validation_radio_selected[] = "Sradioon";
+static char validation_radio_unselected[] = "Sradiooff";
+
+static char select_text_multiple[] = "<Multiple>"; /* TODO: read from messages */
+static char select_text_none[] = "<None>";
+
+static char empty_text[] = "";
+
+void html_redraw_box(struct content *content, struct box * box,
+ signed long x, signed long y, os_box* clip,
+ unsigned long current_background_color,
+ signed long gadget_subtract_x, signed long gadget_subtract_y,
+ bool *select_on)
+{
+ 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)
+ {
+
+#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)
+ {
+ 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);
+ 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;
+
+
+ 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);
+ 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;
+
+ 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);
+ 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);
+ }
+ LOG(("writing GADGET ACTION"));
+ wimp_plot_icon(&icon);
+ break;
+
+ 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);
+ select_text = 0;
+ opt = box->gadget->data.select.items;
+ while (opt != NULL)
+ {
+ if (opt->selected)
+ {
+ if (select_text == 0)
+ select_text = opt->text;
+ else
+ select_text = select_text_multiple;
+ }
+ opt = opt->next;
+ }
+ if (select_text == 0)
+ select_text = select_text_none;
+ icon.data.indirected_text.text = select_text;
+ icon.data.indirected_text.size = strlen(icon.data.indirected_text.text);
+ icon.data.indirected_text.validation = validation_select;
+ LOG(("writing GADGET ACTION"));
+ wimp_plot_icon(&icon);
+ break;
+
+ case GADGET_CHECKBOX:
+ icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE |
+ 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;
+ else
+ 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;
+ if (box->gadget->data.radio.selected)
+ strcpy(icon.data.sprite, "radioon");
+ else
+ strcpy(icon.data.sprite, "radiooff");
+ LOG(("writing GADGET RADIO"));
+ wimp_plot_icon(&icon);
+ break;
+
+ case GADGET_HIDDEN:
+ break;
+ }
+ LOG(("gadgets finished"));
+ }
+
+ if (box->type == BOX_INLINE && box->font != 0)
+ {
+
+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
+ {
+ 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);
+}
+