From 64e1781eb4c0d007801ea894cb3c0967a8aecbbd Mon Sep 17 00:00:00 2001 From: James Bursa Date: Mon, 3 Mar 2003 22:40:39 +0000 Subject: [project @ 2003-03-03 22:40:39 by bursa] Fix many browser warnings. svn path=/import/netsurf/; revision=103 --- desktop/browser.c | 124 ++++++++++++++++++++------------------ desktop/browser.h | 11 ++-- desktop/gui.h | 14 +++-- render/html.c | 4 +- riscos/font.c | 4 +- riscos/font.h | 4 +- riscos/gui.c | 174 +++++++++++++++++++++++++++++++++--------------------- riscos/gui.h | 10 ++-- riscos/jpeg.c | 5 +- 9 files changed, 201 insertions(+), 149 deletions(-) diff --git a/desktop/browser.c b/desktop/browser.c index e76e97547..4661325ed 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1,5 +1,5 @@ /** - * $Id: browser.c,v 1.28 2003/02/28 11:49:13 bursa Exp $ + * $Id: browser.c,v 1.29 2003/03/03 22:40:39 bursa Exp $ */ #include "netsurf/content/cache.h" @@ -21,15 +21,27 @@ void browser_window_start_throbber(struct browser_window* bw); void browser_window_stop_throbber(struct browser_window* bw); void browser_window_reformat(struct browser_window* bw); -void browser_window_text_selection(struct browser_window* bw, int click_x, int click_y, int click_type); +void browser_window_text_selection(struct browser_window* bw, + unsigned long click_x, unsigned long click_y, int click_type); void browser_window_clear_text_selection(struct browser_window* bw); void browser_window_change_text_selection(struct browser_window* bw, struct box_position* new_start, struct box_position* new_end); +int redraw_box_list(struct browser_window* bw, struct box* current, + unsigned long x, unsigned long y, struct box_position* start, + struct box_position* end, int* plot); void browser_window_redraw_boxes(struct browser_window* bw, struct box_position* start, struct box_position* end); void browser_window_follow_link(struct browser_window* bw, - int click_x, int click_y, int click_type); + unsigned long click_x, unsigned long click_y, int click_type); void browser_window_callback(fetchcache_msg msg, struct content *c, - struct browser_window* bw, const char *error); -void box_under_area(struct box* box, int x, int y, int ox, int oy, struct box_selection** found, int* count, int* plot_index); + void *p, const char *error); +void clear_radio_gadgets(struct browser_window* bw, struct box* box, struct gui_gadget* group); +void gui_redraw_gadget2(struct browser_window* bw, struct box* box, struct gui_gadget* g, + unsigned long x, unsigned long y); +void gui_redraw_gadget(struct browser_window* bw, struct gui_gadget* g); +void browser_window_gadget_select(struct browser_window* bw, struct gui_gadget* g, int item); +int browser_window_gadget_click(struct browser_window* bw, unsigned long click_x, unsigned long click_y); +void box_under_area(struct box* box, unsigned long x, unsigned long y, unsigned long ox, unsigned long oy, + struct box_selection** found, int* count, int* plot_index); +char *url_join(const char* new, const char* base); void browser_window_start_throbber(struct browser_window* bw) @@ -48,32 +60,21 @@ void browser_window_stop_throbber(struct browser_window* bw) void browser_window_reformat(struct browser_window* bw) { - LOG(("Entering...")); + LOG(("bw = %p", bw)); + assert(bw != 0); if (bw->current_content == NULL) return; - switch (bw->current_content->type) - { - case CONTENT_HTML: - LOG(("HTML content.")); - if (bw->current_content->title == 0) - gui_window_set_title(bw->window, bw->url); - else - gui_window_set_title(bw->window, bw->current_content->title); - LOG(("Setting extent")); - gui_window_set_extent(bw->window, bw->current_content->width, bw->current_content->height); - LOG(("Setting scroll")); - gui_window_set_scroll(bw->window, 0, 0); - LOG(("Complete")); - break; - default: - LOG(("Unknown content type")); - break; - } - - LOG(("Redraw window")); + if (bw->current_content->title == 0) + gui_window_set_title(bw->window, bw->url); + else + gui_window_set_title(bw->window, bw->current_content->title); + gui_window_set_extent(bw->window, bw->current_content->width, bw->current_content->height); + gui_window_set_scroll(bw->window, 0, 0); gui_window_redraw_window(bw->window); + + LOG(("done")); } /* create a new history item */ @@ -159,7 +160,6 @@ struct browser_window* create_browser_window(int flags, int width, int height) bw->history = NULL; bw->url = NULL; - bw->title = xstrdup("NetSurf"); bw->window = create_gui_browser_window(bw); @@ -203,7 +203,6 @@ void browser_window_destroy(struct browser_window* bw) } xfree(bw->url); - xfree(bw->title); gui_window_destroy(bw->window); @@ -243,8 +242,9 @@ void browser_window_open_location(struct browser_window* bw, char* url) } void browser_window_callback(fetchcache_msg msg, struct content *c, - struct browser_window* bw, const char *error) + void *p, const char *error) { + struct browser_window* bw = p; gui_safety previous_safety; char status[40]; @@ -262,19 +262,22 @@ void browser_window_callback(fetchcache_msg msg, struct content *c, gui_window_message(bw->window, &gmsg); previous_safety = gui_window_set_redraw_safety(bw->window, UNSAFE); - if (bw->current_content != NULL && bw->current_content->type == CONTENT_HTML) - { - int gc; - for (gc = 0; gc < bw->current_content->data.html.elements.numGadgets; gc++) - { - gui_remove_gadget(bw->current_content->data.html.elements.gadgets[gc]); - } + if (bw->current_content != NULL) + { + if (bw->current_content->type == CONTENT_HTML) + { + int gc; + for (gc = 0; gc < bw->current_content->data.html.elements.numGadgets; gc++) + { + gui_remove_gadget(bw->current_content->data.html.elements.gadgets[gc]); + } + } cache_free(bw->current_content); - } + } bw->current_content = c; browser_window_reformat(bw); gui_window_set_redraw_safety(bw->window, previous_safety); - sprintf(status, "Page complete (%gs)", ((float) clock() - bw->time0) / CLOCKS_PER_SEC); + sprintf(status, "Page complete (%gs)", ((float) (clock() - bw->time0)) / CLOCKS_PER_SEC); browser_window_set_status(bw, status); browser_window_stop_throbber(bw); } @@ -286,7 +289,7 @@ void browser_window_callback(fetchcache_msg msg, struct content *c, break; case FETCHCACHE_BADTYPE: - fprintf(status, "Unknown type '%s'", error); + sprintf(status, "Unknown type '%s'", error); browser_window_set_status(bw, status); browser_window_stop_throbber(bw); break; @@ -327,7 +330,8 @@ void clear_radio_gadgets(struct browser_window* bw, struct box* box, struct gui_ clear_radio_gadgets(bw, c, group); } -void gui_redraw_gadget2(struct browser_window* bw, struct box* box, struct gui_gadget* g, int x, int y) +void gui_redraw_gadget2(struct browser_window* bw, struct box* box, struct gui_gadget* g, + unsigned long x, unsigned long y) { struct box* c; @@ -370,7 +374,7 @@ void browser_window_gadget_select(struct browser_window* bw, struct gui_gadget* gui_redraw_gadget(bw, g); } -int browser_window_gadget_click(struct browser_window* bw, int click_x, int click_y) +int browser_window_gadget_click(struct browser_window* bw, unsigned long click_x, unsigned long click_y) { struct box_selection* click_boxes; int found, plot_index; @@ -418,6 +422,8 @@ int browser_window_gadget_click(struct browser_window* bw, int click_x, int clic case GADGET_TEXTBOX: gui_edit_textbox(bw, g); break; + case GADGET_HIDDEN: + break; } xfree(click_boxes); @@ -462,8 +468,8 @@ int browser_window_action(struct browser_window* bw, struct browser_action* act) return 0; } -void box_under_area(struct box* box, int x, int y, int ox, int oy, - struct box_selection** found, int* count, int* plot_index) +void box_under_area(struct box* box, unsigned long x, unsigned long y, unsigned long ox, unsigned long oy, + struct box_selection** found, int* count, int* plot_index) { struct box* c; @@ -494,7 +500,7 @@ void box_under_area(struct box* box, int x, int y, int ox, int oy, } void browser_window_follow_link(struct browser_window* bw, - int click_x, int click_y, int click_type) + unsigned long click_x, unsigned long click_y, int click_type) { struct box_selection* click_boxes; int found, plot_index; @@ -548,7 +554,7 @@ void browser_window_follow_link(struct browser_window* bw, } void browser_window_text_selection(struct browser_window* bw, - int click_x, int click_y, int click_type) + unsigned long click_x, unsigned long click_y, int click_type) { struct box_selection* click_boxes; int found, plot_index; @@ -782,14 +788,14 @@ int box_position_distance(struct box_position* x, struct box_position* y) return dx*dx + dy*dy; } -int redraw_min_x = INT_MAX; -int redraw_min_y = INT_MAX; -int redraw_max_x = INT_MIN; -int redraw_max_y = INT_MIN; +unsigned long redraw_min_x = LONG_MAX; +unsigned long redraw_min_y = LONG_MAX; +unsigned long redraw_max_x = 0; +unsigned long redraw_max_y = 0; int redraw_box_list(struct browser_window* bw, struct box* current, - int x, int y, struct box_position* start, struct box_position* end, - int* plot) + unsigned long x, unsigned long y, struct box_position* start, + struct box_position* end, int* plot) { struct box* c; @@ -799,10 +805,10 @@ int redraw_box_list(struct browser_window* bw, struct box* current, if (*plot >= 1 && current->type == BOX_INLINE) { - int minx = x + current->x; - int miny = y + current->y; - int maxx = x + current->x + current->width; - int maxy = y + current->y + current->height; + unsigned long minx = x + current->x; + unsigned long miny = y + current->y; + unsigned long maxx = x + current->x + current->width; + unsigned long maxy = y + current->y + current->height; if (minx < redraw_min_x) redraw_min_x = minx; @@ -841,10 +847,10 @@ void browser_window_redraw_boxes(struct browser_window* bw, struct box_position* if (box_position_eq(start, end)) return; - redraw_min_x = INT_MAX; - redraw_min_y = INT_MAX; - redraw_max_x = INT_MIN; - redraw_max_y = INT_MIN; + redraw_min_x = LONG_MAX; + redraw_min_y = LONG_MAX; + redraw_max_x = 0; + redraw_max_y = 0; redraw_box_list(bw, bw->current_content->data.html.layout, 0,0, start, end, &plot); diff --git a/desktop/browser.h b/desktop/browser.h index 00cb937a8..25fc6f6ed 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -1,5 +1,5 @@ /** - * $Id: browser.h,v 1.9 2003/02/28 11:49:13 bursa Exp $ + * $Id: browser.h,v 1.10 2003/03/03 22:40:39 bursa Exp $ */ #ifndef _NETSURF_DESKTOP_BROWSER_H_ @@ -43,8 +43,8 @@ void history_remember(struct history* current, char* desc, char* url); struct browser_window { - int format_width; - int format_height; + unsigned long format_width; + unsigned long format_height; struct { int mult; int div; } scale; struct content* current_content; @@ -54,7 +54,6 @@ struct browser_window char* url; browser_window_flags flags; - char* title; gui_window* window; int throbbing; @@ -71,8 +70,8 @@ struct browser_action } type; union { struct { - int x; - int y; + unsigned long x; + unsigned long y; action_buttons buttons; } mouse; struct { diff --git a/desktop/gui.h b/desktop/gui.h index 3cbc7472a..685def3f2 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -1,5 +1,5 @@ /** - * $Id: gui.h,v 1.4 2003/01/11 17:33:31 monkeyson Exp $ + * $Id: gui.h,v 1.5 2003/03/03 22:40:39 bursa Exp $ */ #ifndef _NETSURF_DESKTOP_GUI_H_ @@ -27,11 +27,13 @@ gui_window* create_gui_browser_window(struct browser_window* bw); void gui_window_destroy(gui_window* g); void gui_window_show(gui_window* g); void gui_window_hide(gui_window* g); -void gui_window_redraw(gui_window* g, int x0, int y0, int x1, int y1); +void gui_window_redraw(gui_window* g, unsigned long x0, unsigned long y0, + unsigned long x1, unsigned long y1); void gui_window_redraw_window(gui_window* g); void gui_window_set_scroll(gui_window* g, int sx, int sy); -void gui_window_set_extent(gui_window* g, int width, int height); -void gui_window_set_status(gui_window* g, char* text); +unsigned long gui_window_get_width(gui_window* g); +void gui_window_set_extent(gui_window* g, unsigned long width, unsigned long height); +void gui_window_set_status(gui_window* g, const char* text); void gui_window_set_title(gui_window* g, char* title); void gui_window_message(gui_window* g, gui_message* msg); @@ -46,5 +48,7 @@ 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); -void gui_gadget_combo(struct browser_window* bw, struct gui_gadget* g, int mx, int my); +void gui_gadget_combo(struct browser_window* bw, struct gui_gadget* g, unsigned long mx, unsigned long my); +void gui_edit_textarea(struct browser_window* bw, struct gui_gadget* g); +void gui_edit_textbox(struct browser_window* bw, struct gui_gadget* g); #endif diff --git a/render/html.c b/render/html.c index 3548895e7..b76ac15a3 100644 --- a/render/html.c +++ b/render/html.c @@ -1,5 +1,5 @@ /** - * $Id: html.c,v 1.3 2003/02/26 18:22:24 bursa Exp $ + * $Id: html.c,v 1.4 2003/03/03 22:40:39 bursa Exp $ */ #include @@ -160,5 +160,7 @@ void html_destroy(struct content *c) box_free(c->data.html.layout); if (c->data.html.fonts != 0) font_free_set(c->data.html.fonts); + if (c->title != 0) + xfree(c->title); /* TODO: stylesheets */ } diff --git a/riscos/font.c b/riscos/font.c index 8c0d6de44..a2ae8306d 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -1,5 +1,5 @@ /** - * $Id: font.c,v 1.10 2003/02/09 12:58:15 bursa Exp $ + * $Id: font.c,v 1.11 2003/03/03 22:40:39 bursa Exp $ */ #include @@ -56,7 +56,7 @@ unsigned long font_width(struct font_data *font, const char * text, unsigned int } void font_position_in_string(const char* text, struct font_data* font, - int length, int x, int* char_offset, int* pixel_offset) + unsigned int length, unsigned long x, int* char_offset, int* pixel_offset) { font_scan_block block; char* split_point; diff --git a/riscos/font.h b/riscos/font.h index 9d2abf419..9cbbdf1f6 100644 --- a/riscos/font.h +++ b/riscos/font.h @@ -1,5 +1,5 @@ /** - * $Id: font.h,v 1.5 2002/12/27 17:28:19 bursa Exp $ + * $Id: font.h,v 1.6 2003/03/03 22:40:39 bursa Exp $ */ #ifndef _NETSURF_RISCOS_FONT_H_ @@ -36,7 +36,7 @@ struct font_data { unsigned long font_width(struct font_data *font, const char * text, unsigned int length); void font_position_in_string(const char* text, struct font_data *font, - int length, int x, int* char_offset, int* pixel_offset); + unsigned int length, unsigned long x, int* char_offset, int* pixel_offset); struct font_set *font_new_set(void); struct font_data *font_open(struct font_set *set, struct css_style *style); diff --git a/riscos/gui.c b/riscos/gui.c index 5881243c1..98e91c128 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -1,5 +1,5 @@ /** - * $Id: gui.c,v 1.18 2003/02/25 21:00:27 bursa Exp $ + * $Id: gui.c,v 1.19 2003/03/03 22:40:39 bursa Exp $ */ #include "netsurf/riscos/font.h" @@ -22,7 +22,7 @@ int gadget_subtract_x; int gadget_subtract_y; #define browser_menu_flags (wimp_ICON_TEXT | wimp_ICON_FILLED | (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT)) -char* HOME_URL = "file:///%3CNetSurf$Dir%3E/Resources/intro.html\0"; +const char* HOME_URL = "file:///%3CNetSurf$Dir%3E/Resources/intro.html\0"; wimp_MENU(2) netsurf_iconbar_menu = { @@ -77,18 +77,32 @@ wimp_MENU(4) browser_menu = } }; -char* netsurf_messages_filename = ".Resources.Messages"; +const char* netsurf_messages_filename = ".Resources.Messages"; messagetrans_control_block netsurf_messages_cb; char* netsurf_messages_data; -char* templates_messages_filename = ".Resources.IconNames"; +const char* templates_messages_filename = ".Resources.IconNames"; messagetrans_control_block templates_messages_cb; char* templates_messages_data; wimp_w netsurf_info; wimp_w netsurf_saveas; -void ro_gui_load_messages() +void ro_gui_load_messages(void); +wimp_w ro_gui_load_template(const char* template_name); +void ro_gui_load_templates(void); +wimp_i ro_gui_icon(char* token); +void ro_gui_transform_menu_entry(wimp_menu_entry* e); +void ro_gui_transform_menus(void); +void ro_gui_create_menu(wimp_menu* menu, int x, int y, gui_window* g); +int window_x_units(int scr_units, wimp_window_state* win); +int window_y_units(int scr_units, wimp_window_state* win); +void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, + signed long y, os_box* clip, int current_background_color); +void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw); + + +void ro_gui_load_messages(void) { int size; messagetrans_file_flags flags; @@ -96,33 +110,37 @@ void ro_gui_load_messages() fprintf(stderr, "opening messages:\n"); messagetrans_file_info(netsurf_messages_filename, &flags, &size); fprintf(stderr, "allocating %d bytes\n", size); - netsurf_messages_data = xcalloc(size, sizeof(char)); + netsurf_messages_data = xcalloc((unsigned int) size, sizeof(char)); messagetrans_open_file(&netsurf_messages_cb, netsurf_messages_filename, netsurf_messages_data); fprintf(stderr, "messages opened\n"); } -wimp_w ro_gui_load_template(char* template_name) +wimp_w ro_gui_load_template(const char* template_name) { int winicon; int indirected; + wimp_window *window; char* data; int temp; + char name[20]; - wimp_load_template(0,0,0, (byte*)0xffffffff, template_name,0, &winicon, &indirected); - data = xcalloc(winicon + indirected + 16, 1); - wimp_load_template((wimp_window*) data, data+winicon, data+winicon+indirected, - (byte*)0xffffffff, template_name, 0, &temp, &temp); - return wimp_create_window((wimp_window*) data); + strcpy(name, template_name); /* wimp_load_template won't accept a const char * */ + + wimp_load_template(wimp_GET_SIZE, 0, 0, wimp_NO_FONTS, name, 0, &winicon, &indirected); + data = (char *) window = xcalloc((unsigned int) (winicon + indirected + 16), 1); + wimp_load_template(window, data+winicon, data+winicon+indirected, + wimp_NO_FONTS, name, 0, &temp, &temp); + return wimp_create_window(window); } -void ro_gui_load_templates() +void ro_gui_load_templates(void) { int size; messagetrans_file_flags flags; messagetrans_file_info(templates_messages_filename, &flags, &size); - templates_messages_data = xcalloc(size, sizeof(char)); + templates_messages_data = xcalloc((unsigned int) size, sizeof(char)); messagetrans_open_file(&templates_messages_cb, templates_messages_filename, templates_messages_data); @@ -153,9 +171,9 @@ void ro_gui_transform_menu_entry(wimp_menu_entry* e) fprintf(stderr, "looking up message %s\n", e->data.text); messagetrans_lookup(&netsurf_messages_cb, e->data.text, buffer, 256, 0,0,0,0, &size); fprintf(stderr, "message '%s' uses %d bytes\n", buffer, size + 1); - block = xcalloc(size + 1, 1); + block = xcalloc((unsigned int) size + 1, 1); fprintf(stderr, "copying buffer to block\n"); - strncpy(block, buffer, size); + strncpy(block, buffer, (unsigned int) size); fprintf(stderr, "applying flags\n"); e->icon_flags = e->icon_flags | wimp_ICON_INDIRECTED; @@ -168,7 +186,7 @@ void ro_gui_transform_menu_entry(wimp_menu_entry* e) return; } -void ro_gui_transform_menus() +void ro_gui_transform_menus(void) { int i; @@ -215,7 +233,7 @@ int TOOLBAR_HEIGHT = 128; ro_theme* current_theme = NULL; -char* BROWSER_VALIDATION = "\0"; +const char* BROWSER_VALIDATION = "\0"; const char* task_name = "NetSurf"; const wimp_MESSAGE_LIST(3) task_messages = { {message_DATA_SAVE, message_DATA_LOAD, 0} }; @@ -225,22 +243,22 @@ wimp_i ro_gui_iconbar_i; gui_window* over_window = NULL; -int ro_x_units(int browser_units) +unsigned long ro_x_units(unsigned long browser_units) { return (browser_units << 1); } -int ro_y_units(int browser_units) +unsigned long ro_y_units(unsigned long browser_units) { return -(browser_units << 1); } -int browser_x_units(int ro_units) +unsigned long browser_x_units(unsigned long ro_units) { return (ro_units >> 1); } -int browser_y_units(int ro_units) +unsigned long browser_y_units(unsigned long ro_units) { return -(ro_units >> 1); } @@ -446,13 +464,14 @@ void gui_window_hide(gui_window* g) wimp_close_window(g->data.browser.window); } -void gui_window_redraw(gui_window* g, int x0, int y0, int x1, int y1) +void gui_window_redraw(gui_window* g, unsigned long x0, unsigned long y0, + unsigned long x1, unsigned long y1) { if (g == NULL) return; wimp_force_redraw(g->data.browser.window, - ro_x_units(x0), ro_y_units(y1), ro_x_units(x1), ro_y_units(y0)); + (int) ro_x_units(x0), (int) ro_y_units(y1), (int) ro_x_units(x1), (int) ro_y_units(y0)); } void gui_window_redraw_window(gui_window* g) @@ -480,12 +499,28 @@ gui_safety gui_window_set_redraw_safety(gui_window* g, gui_safety s) int select_on = 0; -void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, signed long y, os_box* clip, int current_background_color) +/* validation strings can't be const */ +static char validation_textarea[] = "R7;L"; +static char validation_textbox[] = ""; +static char validation_actionbutton[] = "R1"; +static char validation_actionbutton_pressed[] = "R2"; +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[] = ""; /* TODO: read from messages */ +static char select_text_none[] = ""; + +static char empty_text[] = ""; + +void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, + signed long y, os_box* clip, int current_background_color) { struct box * c; const char * const noname = ""; const char * name = noname; - char *text; char* select_text; struct formoption* opt; @@ -522,16 +557,16 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si if (box->style != 0 && box->style->background_color != TRANSPARENT) { colourtrans_set_gcol(box->style->background_color << 8, 0, os_ACTION_OVERWRITE, 0); - os_plot(os_MOVE_TO, x + box->x * 2, y - box->y * 2); - os_plot(os_PLOT_RECTANGLE | os_PLOT_BY, box->width * 2, -box->height * 2); + 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->img != 0) { colourtrans_set_gcol(os_COLOUR_LIGHT_GREY, 0, os_ACTION_OVERWRITE, 0); - os_plot(os_MOVE_TO, x + box->x * 2, y - box->y * 2); - os_plot(os_PLOT_RECTANGLE | os_PLOT_BY, box->width * 2, -box->height * 2); + 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) { @@ -553,7 +588,7 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si (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 = "R7;L"; + icon.data.indirected_text.validation = validation_textarea; fprintf(stderr, "writing GADGET TEXTAREA\n"); wimp_plot_icon(&icon); break; @@ -567,7 +602,7 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si (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 = " "; + icon.data.indirected_text.validation = validation_textbox; fprintf(stderr, "writing GADGET TEXTBOX\n"); wimp_plot_icon(&icon); break; @@ -581,12 +616,12 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si icon.data.indirected_text.size = strlen(box->gadget->data.actionbutt.label); if (box->gadget->data.actionbutt.pressed) { - icon.data.indirected_text.validation = "R2"; + icon.data.indirected_text.validation = validation_actionbutton_pressed; icon.flags |= (wimp_COLOUR_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT); } else { - icon.data.indirected_text.validation = "R1"; + icon.data.indirected_text.validation = validation_actionbutton; icon.flags |= (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT); } fprintf(stderr, "writing GADGET ACTION\n"); @@ -608,15 +643,15 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si if (select_text == 0) select_text = opt->text; else - select_text = ""; + select_text = select_text_multiple; } opt = opt->next; } if (select_text == 0) - select_text = ""; + 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 = "R2"; + icon.data.indirected_text.validation = validation_select; fprintf(stderr, "writing GADGET ACTION\n"); wimp_plot_icon(&icon); break; @@ -625,11 +660,11 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_HCENTRED | wimp_ICON_INDIRECTED; - icon.data.indirected_text_and_sprite.text = "\0"; + icon.data.indirected_text_and_sprite.text = empty_text; if (box->gadget->data.checkbox.selected) - icon.data.indirected_text_and_sprite.validation = "Sopton;"; + icon.data.indirected_text_and_sprite.validation = validation_checkbox_selected; else - icon.data.indirected_text_and_sprite.validation = "Soptoff;"; + icon.data.indirected_text_and_sprite.validation = validation_checkbox_unselected; icon.data.indirected_text_and_sprite.size = 1; wimp_plot_icon(&icon); break; @@ -638,16 +673,17 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_HCENTRED | wimp_ICON_INDIRECTED; - icon.data.indirected_text_and_sprite.text = "\0"; + icon.data.indirected_text_and_sprite.text = empty_text; if (box->gadget->data.radio.selected) - icon.data.indirected_text_and_sprite.validation = "Sradioon;"; + icon.data.indirected_text_and_sprite.validation = validation_radio_selected; else - icon.data.indirected_text_and_sprite.validation = "Sradiooff;"; + icon.data.indirected_text_and_sprite.validation = validation_radio_unselected; icon.data.indirected_text_and_sprite.size = 1; wimp_plot_icon(&icon); break; - + case GADGET_HIDDEN: + break; } } @@ -669,21 +705,21 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1) { colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_SET_FG, 0, 0); os_plot(os_MOVE_TO, - x + box->x * 2 + start->pixel_offset * 2, - y - box->y * 2 - box->height * 2); + (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, - x + box->x * 2 + end->pixel_offset * 2 - 2, - y - box->y * 2 - 2); + (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_SET_FG, 0, 0); os_plot(os_MOVE_TO, - x + box->x * 2 + start->pixel_offset * 2, - y - box->y * 2 - box->height * 2); + (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, - x + box->x * 2 + box->width * 2 - 2, - y - box->y * 2 - 2); + (int) x + (int) box->x * 2 + (int) box->width * 2 - 2, + (int) y - (int) box->y * 2 - 2); select_on = 1; } } @@ -693,21 +729,21 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1) { colourtrans_set_gcol(os_COLOUR_VERY_LIGHT_GREY, colourtrans_SET_FG, 0, 0); os_plot(os_MOVE_TO, - x + box->x * 2, - y - box->y * 2 - box->height * 2); + (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2 - (int) box->height * 2); os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, - x + box->x * 2 + box->width * 2 - 2, - y - box->y * 2 - 2); + (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_SET_FG, 0, 0); os_plot(os_MOVE_TO, - x + box->x * 2, - y - box->y * 2 - box->height * 2); + (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2 - (int) box->height * 2); os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, - x + box->x * 2 + end->pixel_offset * 2 - 2, - y - box->y * 2 - 2); + (int) x + (int) box->x * 2 + end->pixel_offset * 2 - 2, + (int) y - (int) box->y * 2 - 2); select_on = 0; } } @@ -718,9 +754,9 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1) font_paint(box->font->handle, box->text, font_OS_UNITS | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH, - x + box->x * 2, y - box->y * 2 - box->height * 1.5, + (int) x + (int) box->x * 2, (int) y - (int) box->y * 2 - (int) (box->height * 1.5), NULL, NULL, - box->length); + (int) box->length); } } @@ -743,10 +779,12 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1) 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(g, c, x + box->x * 2, y - box->y * 2, clip, current_background_color); + ro_gui_window_redraw_box(g, c, (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2, clip, current_background_color); for (c = box->float_children; c != 0; c = c->next_float) - ro_gui_window_redraw_box(g, c, x + box->x * 2, y - box->y * 2, clip, current_background_color); + ro_gui_window_redraw_box(g, c, (int) x + (int) box->x * 2, + (int) y - (int) box->y * 2, clip, current_background_color); } @@ -829,7 +867,7 @@ void gui_window_set_scroll(gui_window* g, int sx, int sy) ro_gui_window_open(g, (wimp_open*)&state); } -int gui_window_get_width(gui_window* g) +unsigned long gui_window_get_width(gui_window* g) { wimp_window_state state; state.w = g->data.browser.window; @@ -837,7 +875,7 @@ int gui_window_get_width(gui_window* g) return browser_x_units(state.visible.x1 - state.visible.x0); } -void gui_window_set_extent(gui_window* g, int width, int height) +void gui_window_set_extent(gui_window* g, unsigned long width, unsigned long height) { os_box extent; @@ -861,7 +899,7 @@ void gui_window_set_extent(gui_window* g, int width, int height) } -void gui_window_set_status(gui_window* g, char* text) +void gui_window_set_status(gui_window* g, const char* text) { if (strcmp(g->status, text) != 0) { @@ -2018,7 +2056,7 @@ void gui_window_stop_throbber(gui_window* g) wimp_set_icon_state(g->data.browser.toolbar, ro_theme_icon(current_theme, THEME_TOOLBAR, "TOOLBAR_THROBBER"), 0, 0); } -void gui_gadget_combo(struct browser_window* bw, struct gui_gadget* g, int mx, int my) +void gui_gadget_combo(struct browser_window* bw, struct gui_gadget* g, unsigned long mx, unsigned long my) { int count = 0; struct formoption* o; diff --git a/riscos/gui.h b/riscos/gui.h index 14716eac8..7a69a5a88 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -1,5 +1,5 @@ /** - * $Id: gui.h,v 1.3 2002/12/30 22:56:30 monkeyson Exp $ + * $Id: gui.h,v 1.4 2003/03/03 22:40:39 bursa Exp $ */ #ifndef _NETSURF_RISCOS_GUI_H_ @@ -10,10 +10,10 @@ struct ro_gui_window; typedef struct ro_gui_window gui_window; - int ro_x_units (int browser_units); - int ro_y_units (int browser_units); - int browser_x_units (int ro_units) ; - int browser_y_units (int ro_units) ; + unsigned long ro_x_units (unsigned long browser_units); + unsigned long ro_y_units (unsigned long browser_units); + unsigned long browser_x_units (unsigned long ro_units) ; + unsigned long browser_y_units (unsigned long ro_units) ; struct ro_gui_window { diff --git a/riscos/jpeg.c b/riscos/jpeg.c index f8ef1c7d0..b329d3393 100644 --- a/riscos/jpeg.c +++ b/riscos/jpeg.c @@ -1,5 +1,5 @@ /** - * $Id: jpeg.c,v 1.2 2003/02/28 11:49:13 bursa Exp $ + * $Id: jpeg.c,v 1.3 2003/03/03 22:40:39 bursa Exp $ * * This is just a temporary implementation using the JPEG renderer * available in some versions of RISC OS. @@ -40,6 +40,8 @@ int jpeg_convert(struct content *c, unsigned int width, unsigned int height) return 1; c->width = w; c->height = h; + c->title = xcalloc(100, 1); + sprintf(c->title, "JPEG image (%ux%u, %lu bytes)", w, h, c->data.jpeg.length); return 0; } @@ -57,4 +59,5 @@ void jpeg_reformat(struct content *c, unsigned int width, unsigned int height) void jpeg_destroy(struct content *c) { xfree(c->data.jpeg.data); + xfree(c->title); } -- cgit v1.2.3