[project @ 2003-03-04 11:59:35 by bursa]

More compiler warning fixes.

svn path=/import/netsurf/; revision=104
This commit is contained in:
James Bursa 2003-03-04 11:59:36 +00:00
parent 64e1781eb4
commit e2efda19df
16 changed files with 172 additions and 151 deletions

View File

@ -1,5 +1,5 @@
/** /**
* $Id: cache.c,v 1.1 2003/02/09 12:58:14 bursa Exp $ * $Id: cache.c,v 1.2 2003/03/04 11:59:35 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -67,7 +67,7 @@ void cache_quit(void)
* cache_get -- retrieve url from memory cache or disc cache * cache_get -- retrieve url from memory cache or disc cache
*/ */
struct content * cache_get(char * const url) struct content * cache_get(const char * const url)
{ {
struct cache_entry *e; struct cache_entry *e;

View File

@ -1,5 +1,5 @@
/** /**
* $Id: cache.h,v 1.1 2003/02/09 12:58:14 bursa Exp $ * $Id: cache.h,v 1.2 2003/03/04 11:59:35 bursa Exp $
*/ */
/** /**
@ -30,7 +30,7 @@ struct cache_entry;
void cache_init(void); void cache_init(void);
void cache_quit(void); void cache_quit(void);
struct content * cache_get(char * const url); struct content * cache_get(const char * const url);
void cache_put(struct content * content); void cache_put(struct content * content);
void cache_free(struct content * content); void cache_free(struct content * content);
void cache_dump(void); void cache_dump(void);

View File

@ -1,5 +1,5 @@
/** /**
* $Id: fetchcache.c,v 1.3 2003/02/28 11:49:13 bursa Exp $ * $Id: fetchcache.c,v 1.4 2003/03/04 11:59:35 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -22,11 +22,11 @@ struct fetchcache {
}; };
void fetchcache_free(struct fetchcache *fc); static void fetchcache_free(struct fetchcache *fc);
void fetchcache_callback(fetchcache_msg msg, void *p, char *data, unsigned long size); static void fetchcache_callback(fetchcache_msg msg, void *p, char *data, unsigned long size);
void fetchcache(char *url, char *referer, void fetchcache(const char *url, char *referer,
void (*callback)(fetchcache_msg msg, struct content *c, void *p, const char *error), void (*callback)(fetchcache_msg msg, struct content *c, void *p, const char *error),
void *p, unsigned long width, unsigned long height) void *p, unsigned long width, unsigned long height)
{ {

View File

@ -1,5 +1,5 @@
/** /**
* $Id: fetchcache.h,v 1.2 2003/02/28 11:49:13 bursa Exp $ * $Id: fetchcache.h,v 1.3 2003/03/04 11:59:35 bursa Exp $
*/ */
#ifndef _NETSURF_DESKTOP_FETCHCACHE_H_ #ifndef _NETSURF_DESKTOP_FETCHCACHE_H_
@ -9,7 +9,7 @@
typedef enum {FETCHCACHE_OK, FETCHCACHE_BADTYPE, FETCHCACHE_ERROR, FETCHCACHE_STATUS} fetchcache_msg; typedef enum {FETCHCACHE_OK, FETCHCACHE_BADTYPE, FETCHCACHE_ERROR, FETCHCACHE_STATUS} fetchcache_msg;
void fetchcache(char *url, char *referer, void fetchcache(const char *url, char *referer,
void (*callback)(fetchcache_msg msg, struct content *c, void *p, const char *error), void (*callback)(fetchcache_msg msg, struct content *c, void *p, const char *error),
void *p, unsigned long width, unsigned long height); void *p, unsigned long width, unsigned long height);

View File

@ -1,5 +1,5 @@
/** /**
* $Id: browser.c,v 1.29 2003/03/03 22:40:39 bursa Exp $ * $Id: browser.c,v 1.30 2003/03/04 11:59:35 bursa Exp $
*/ */
#include "netsurf/content/cache.h" #include "netsurf/content/cache.h"
@ -18,30 +18,27 @@
#include <time.h> #include <time.h>
#include <ctype.h> #include <ctype.h>
void browser_window_start_throbber(struct browser_window* bw); static void browser_window_start_throbber(struct browser_window* bw);
void browser_window_stop_throbber(struct browser_window* bw); static void browser_window_stop_throbber(struct browser_window* bw);
void browser_window_reformat(struct browser_window* bw); static void browser_window_reformat(struct browser_window* bw);
void browser_window_text_selection(struct browser_window* bw, static void browser_window_text_selection(struct browser_window* bw,
unsigned long click_x, unsigned long click_y, int click_type); unsigned long click_x, unsigned long click_y, int click_type);
void browser_window_clear_text_selection(struct browser_window* bw); static 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); static 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, static int redraw_box_list(struct browser_window* bw, struct box* current,
unsigned long x, unsigned long y, struct box_position* start, unsigned long x, unsigned long y, struct box_position* start,
struct box_position* end, int* plot); struct box_position* end, int* plot);
void browser_window_redraw_boxes(struct browser_window* bw, struct box_position* start, struct box_position* end); static 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, static void browser_window_follow_link(struct browser_window* bw,
unsigned long click_x, unsigned long 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, static void browser_window_callback(fetchcache_msg msg, struct content *c,
void *p, const char *error); void *p, const char *error);
void clear_radio_gadgets(struct browser_window* bw, struct box* box, struct gui_gadget* group); static 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, static void gui_redraw_gadget2(struct browser_window* bw, struct box* box, struct gui_gadget* g,
unsigned long x, unsigned long y); unsigned long x, unsigned long y);
void gui_redraw_gadget(struct browser_window* bw, struct gui_gadget* g); static void browser_window_gadget_select(struct browser_window* bw, struct gui_gadget* g, int item);
void browser_window_gadget_select(struct browser_window* bw, struct gui_gadget* g, int item); static int browser_window_gadget_click(struct browser_window* bw, unsigned long click_x, unsigned long click_y);
int browser_window_gadget_click(struct browser_window* bw, unsigned long click_x, unsigned long click_y); static char *url_join(const char* new, const char* base);
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) void browser_window_start_throbber(struct browser_window* bw)
@ -211,7 +208,7 @@ void browser_window_destroy(struct browser_window* bw)
LOG(("end")); LOG(("end"));
} }
void browser_window_open_location_historical(struct browser_window* bw, char* url) void browser_window_open_location_historical(struct browser_window* bw, const char* url)
{ {
LOG(("bw = %p, url = %s", bw, url)); LOG(("bw = %p, url = %s", bw, url));
@ -224,11 +221,12 @@ void browser_window_open_location_historical(struct browser_window* bw, char* ur
LOG(("end")); LOG(("end"));
} }
void browser_window_open_location(struct browser_window* bw, char* url) void browser_window_open_location(struct browser_window* bw, const char* url0)
{ {
LOG(("bw = %p, url = %s", bw, url)); char *url;
assert(bw != 0 && url != 0); LOG(("bw = %p, url0 = %s", bw, url0));
url = url_join(url, bw->url); assert(bw != 0 && url0 != 0);
url = url_join(url0, bw->url);
browser_window_open_location_historical(bw, url); browser_window_open_location_historical(bw, url);
if (bw->history == NULL) if (bw->history == NULL)
bw->history = history_create(NULL, url); bw->history = history_create(NULL, url);

View File

@ -1,5 +1,5 @@
/** /**
* $Id: browser.h,v 1.10 2003/03/03 22:40:39 bursa Exp $ * $Id: browser.h,v 1.11 2003/03/04 11:59:35 bursa Exp $
*/ */
#ifndef _NETSURF_DESKTOP_BROWSER_H_ #ifndef _NETSURF_DESKTOP_BROWSER_H_
@ -93,19 +93,22 @@ struct box_selection
struct browser_window* create_browser_window(int flags, int width, int height); struct browser_window* create_browser_window(int flags, int width, int height);
void browser_window_destroy(struct browser_window* bw); void browser_window_destroy(struct browser_window* bw);
void browser_window_open_location(struct browser_window* bw, char* url); void browser_window_open_location(struct browser_window* bw, const char* url);
void browser_window_open_location_historical(struct browser_window* bw, char* url); void browser_window_open_location_historical(struct browser_window* bw, const char* url);
int browser_window_action(struct browser_window* bw, struct browser_action* act); int browser_window_action(struct browser_window* bw, struct browser_action* act);
void browser_window_set_status(struct browser_window* bw, const char* text); void browser_window_set_status(struct browser_window* bw, const char* text);
void browser_window_back(struct browser_window* bw); void browser_window_back(struct browser_window* bw);
void browser_window_forward(struct browser_window* bw); void browser_window_forward(struct browser_window* bw);
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);
int box_position_lt(struct box_position* x, struct box_position* y); int box_position_lt(struct box_position* x, struct box_position* y);
int box_position_gt(struct box_position* x, struct box_position* y); int box_position_gt(struct box_position* x, struct box_position* y);
int box_position_eq(struct box_position* x, struct box_position* y); int box_position_eq(struct box_position* x, struct box_position* y);
int box_position_distance(struct box_position* x, struct box_position* y); int box_position_distance(struct box_position* x, struct box_position* y);
void gui_redraw_gadget(struct browser_window* bw, struct gui_gadget* g);
#endif #endif

View File

@ -1,5 +1,5 @@
/** /**
* $Id: gui.h,v 1.5 2003/03/03 22:40:39 bursa Exp $ * $Id: gui.h,v 1.6 2003/03/04 11:59:35 bursa Exp $
*/ */
#ifndef _NETSURF_DESKTOP_GUI_H_ #ifndef _NETSURF_DESKTOP_GUI_H_
@ -30,7 +30,7 @@ void gui_window_hide(gui_window* g);
void gui_window_redraw(gui_window* g, unsigned long x0, unsigned long y0, void gui_window_redraw(gui_window* g, unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1); unsigned long x1, unsigned long y1);
void gui_window_redraw_window(gui_window* g); void gui_window_redraw_window(gui_window* g);
void gui_window_set_scroll(gui_window* g, int sx, int sy); void gui_window_set_scroll(gui_window* g, unsigned long sx, unsigned long sy);
unsigned long gui_window_get_width(gui_window* g); 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_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_status(gui_window* g, const char* text);

View File

@ -1,5 +1,5 @@
/** /**
* $Id: netsurf.c,v 1.6 2003/02/09 12:58:15 bursa Exp $ * $Id: netsurf.c,v 1.7 2003/03/04 11:59:35 bursa Exp $
*/ */
#include "netsurf/desktop/netsurf.h" #include "netsurf/desktop/netsurf.h"
@ -13,6 +13,9 @@
int netsurf_quit = 0; int netsurf_quit = 0;
gui_window* netsurf_gui_windows = NULL; gui_window* netsurf_gui_windows = NULL;
static void netsurf_init(int argc, char** argv);
static void netsurf_exit(void);
void netsurf_poll(void) void netsurf_poll(void)
{ {

View File

@ -1,5 +1,5 @@
/** /**
* $Id: box.c,v 1.33 2003/02/09 12:58:15 bursa Exp $ * $Id: box.c,v 1.34 2003/03/04 11:59:35 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -20,13 +20,11 @@
* internal functions * internal functions
*/ */
struct box* input(xmlNode * n, struct css_style* style, struct form* current_form); static void box_add_child(struct box * parent, struct box * child);
static struct box * box_create(xmlNode * node, box_type type, struct css_style * style,
void box_add_child(struct box * parent, struct box * child);
struct box * box_create(xmlNode * node, box_type type, struct css_style * style,
char *href); char *href);
char * tolat1(xmlChar * s); static char * tolat1(xmlChar * s);
struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style, static struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
struct css_stylesheet * stylesheet, struct css_stylesheet * stylesheet,
struct css_selector ** selector, unsigned int depth, struct css_selector ** selector, unsigned int depth,
struct box * parent, struct box * inline_container, struct box * parent, struct box * inline_container,
@ -34,26 +32,26 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
struct gui_gadget* current_select, struct formoption* current_option, struct gui_gadget* current_select, struct formoption* current_option,
struct gui_gadget* current_textarea, struct form* current_form, struct gui_gadget* current_textarea, struct form* current_form,
struct page_elements* elements); struct page_elements* elements);
struct css_style * box_get_style(struct css_stylesheet * stylesheet, struct css_style * parent_style, static struct css_style * box_get_style(struct css_stylesheet * stylesheet, struct css_style * parent_style,
xmlNode * n, struct css_selector * selector, unsigned int depth); xmlNode * n, struct css_selector * selector, unsigned int depth);
void box_normalise_block(struct box *block); static void box_normalise_block(struct box *block);
void box_normalise_table(struct box *table); static void box_normalise_table(struct box *table);
void box_normalise_table_row_group(struct box *row_group); static void box_normalise_table_row_group(struct box *row_group);
void box_normalise_table_row(struct box *row); static void box_normalise_table_row(struct box *row);
void box_normalise_inline_container(struct box *cont); static void box_normalise_inline_container(struct box *cont);
void gadget_free(struct gui_gadget* g); static void gadget_free(struct gui_gadget* g);
void box_free_box(struct box *box); static void box_free_box(struct box *box);
struct box* box_image(xmlNode * n, struct css_style* style, char* href); static struct box* box_image(xmlNode * n, struct css_style* style, char* href);
struct box* box_textarea(xmlNode* n, struct css_style* style, struct form* current_form); static struct box* box_textarea(xmlNode* n, struct css_style* style, struct form* current_form);
struct box* box_select(xmlNode * n, struct css_style* style, struct form* current_form); static struct box* box_select(xmlNode * n, struct css_style* style, struct form* current_form);
struct formoption* box_option(xmlNode* n, struct css_style* style, struct gui_gadget* current_select); static struct formoption* box_option(xmlNode* n, struct css_style* style, struct gui_gadget* current_select);
void textarea_addtext(struct gui_gadget* textarea, char* text); static void textarea_addtext(struct gui_gadget* textarea, char* text);
void option_addtext(struct formoption* option, char* text); static void option_addtext(struct formoption* option, char* text);
struct box* box_input(xmlNode * n, struct css_style* style, struct form* current_form, struct page_elements* elements); static struct box* box_input(xmlNode * n, struct css_style* style, struct form* current_form, struct page_elements* elements);
struct form* box_form(xmlNode* n); static struct form* box_form(xmlNode* n);
void add_form_element(struct page_elements* pe, struct form* f); static void add_form_element(struct page_elements* pe, struct form* f);
void add_gadget_element(struct page_elements* pe, struct gui_gadget* g); static void add_gadget_element(struct page_elements* pe, struct gui_gadget* g);
void add_img_element(struct page_elements* pe, struct img* i); static void add_img_element(struct page_elements* pe, struct img* i);
/** /**
@ -1290,7 +1288,8 @@ struct box* box_input(xmlNode * n, struct css_style* style, struct form* current
free(s); free(s);
} }
box->gadget->data.textbox.text = xcalloc(box->gadget->data.textbox.maxlength + 2, sizeof(char)); box->gadget->data.textbox.text = xcalloc(
box->gadget->data.textbox.maxlength + 2, sizeof(char));
if ((s = (char *) xmlGetProp(n, (const xmlChar *) "value"))) { if ((s = (char *) xmlGetProp(n, (const xmlChar *) "value"))) {
strncpy(box->gadget->data.textbox.text, s, strncpy(box->gadget->data.textbox.text, s,

View File

@ -1,5 +1,5 @@
/** /**
* $Id: box.h,v 1.19 2003/02/09 12:58:15 bursa Exp $ * $Id: box.h,v 1.20 2003/03/04 11:59:35 bursa Exp $
*/ */
#ifndef _NETSURF_RENDER_BOX_H_ #ifndef _NETSURF_RENDER_BOX_H_
@ -44,7 +44,7 @@ struct gui_gadget {
char* value; char* value;
} hidden; } hidden;
struct { struct {
int maxlength; unsigned int maxlength;
char* text; char* text;
int size; int size;
} textbox; } textbox;

View File

@ -1,5 +1,5 @@
/** /**
* $Id: html.c,v 1.4 2003/03/03 22:40:39 bursa Exp $ * $Id: html.c,v 1.5 2003/03/04 11:59:35 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -36,7 +36,7 @@ void html_process_data(struct content *c, char *data, unsigned long size)
htmlParseChunk(c->data.html.parser, data + x, CHUNK, 0); htmlParseChunk(c->data.html.parser, data + x, CHUNK, 0);
gui_multitask(); gui_multitask();
} }
htmlParseChunk(c->data.html.parser, data + x, size - x, 0); htmlParseChunk(c->data.html.parser, data + x, (int) (size - x), 0);
} }

View File

@ -1,5 +1,5 @@
/** /**
* $Id: layout.c,v 1.33 2003/02/09 12:58:15 bursa Exp $ * $Id: layout.c,v 1.34 2003/03/04 11:59:35 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -22,27 +22,27 @@
* internal functions * internal functions
*/ */
signed long len(struct css_length * length, struct css_style * style); static signed long len(struct css_length * length, struct css_style * style);
void layout_node(struct box * box, unsigned long width, struct box * cont, static void layout_node(struct box * box, unsigned long width, struct box * cont,
unsigned long cx, unsigned long cy); unsigned long cx, unsigned long cy);
void layout_block(struct box * box, unsigned long width, struct box * cont, static void layout_block(struct box * box, unsigned long width, struct box * cont,
unsigned long cx, unsigned long cy); unsigned long cx, unsigned long cy);
unsigned long layout_block_children(struct box * box, unsigned long width, struct box * cont, static unsigned long layout_block_children(struct box * box, unsigned long width, struct box * cont,
unsigned long cx, unsigned long cy); unsigned long cx, unsigned long cy);
void find_sides(struct box * fl, unsigned long y0, unsigned long y1, static void find_sides(struct box * fl, unsigned long y0, unsigned long y1,
unsigned long * x0, unsigned long * x1, struct box ** left, struct box ** right); unsigned long * x0, unsigned long * x1, struct box ** left, struct box ** right);
void layout_inline_container(struct box * box, unsigned long width, struct box * cont, static void layout_inline_container(struct box * box, unsigned long width, struct box * cont,
unsigned long cx, unsigned long cy); unsigned long cx, unsigned long cy);
signed long line_height(struct css_style * style); static signed long line_height(struct css_style * style);
struct box * layout_line(struct box * first, unsigned long width, unsigned long * y, static struct box * layout_line(struct box * first, unsigned long width, unsigned long * y,
unsigned long cy, struct box * cont); unsigned long cy, struct box * cont);
void place_float_below(struct box * c, unsigned long width, unsigned long y, struct box * cont); static void place_float_below(struct box * c, unsigned long width, unsigned long y, struct box * cont);
void layout_table(struct box * box, unsigned long width, struct box * cont, static void layout_table(struct box * box, unsigned long width, struct box * cont,
unsigned long cx, unsigned long cy); unsigned long cx, unsigned long cy);
void calculate_widths(struct box *box); static void calculate_widths(struct box *box);
void calculate_inline_container_widths(struct box *box); static void calculate_inline_container_widths(struct box *box);
void calculate_table_widths(struct box *table); static void calculate_table_widths(struct box *table);
/** /**
* convert a struct css_length to pixels * convert a struct css_length to pixels
@ -106,6 +106,7 @@ void layout_node(struct box * box, unsigned long width, struct box * cont,
} }
/* TODO: change this to use style sheets */
int gadget_width(struct gui_gadget* gadget) int gadget_width(struct gui_gadget* gadget)
{ {
struct formoption* current; struct formoption* current;

View File

@ -1,5 +1,5 @@
/** /**
* $Id: font.c,v 1.11 2003/03/03 22:40:39 bursa Exp $ * $Id: font.c,v 1.12 2003/03/04 11:59:35 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -25,7 +25,7 @@ const char * const font_table[FONT_FAMILIES * 4] = {
"Homerton.Bold.Oblique\\ELatin1", "Homerton.Bold.Oblique\\ELatin1",
}; };
void font_close(struct font_data *data); static void font_close(struct font_data *data);
/** /**
* functions * functions

View File

@ -1,5 +1,5 @@
/** /**
* $Id: gui.c,v 1.19 2003/03/03 22:40:39 bursa Exp $ * $Id: gui.c,v 1.20 2003/03/04 11:59:35 bursa Exp $
*/ */
#include "netsurf/riscos/font.h" #include "netsurf/riscos/font.h"
@ -88,18 +88,48 @@ char* templates_messages_data;
wimp_w netsurf_info; wimp_w netsurf_info;
wimp_w netsurf_saveas; wimp_w netsurf_saveas;
void ro_gui_load_messages(void); struct ro_gui_drag_info;
wimp_w ro_gui_load_template(const char* template_name); typedef enum {
void ro_gui_load_templates(void); mouseaction_NONE,
wimp_i ro_gui_icon(char* token); mouseaction_BACK, mouseaction_FORWARD,
void ro_gui_transform_menu_entry(wimp_menu_entry* e); mouseaction_RELOAD, mouseaction_PARENT,
void ro_gui_transform_menus(void); mouseaction_NEWWINDOW_OR_LINKFG, mouseaction_DUPLICATE_OR_LINKBG,
void ro_gui_create_menu(wimp_menu* menu, int x, int y, gui_window* g); mouseaction_TOGGLESIZE, mouseaction_ICONISE, mouseaction_CLOSE
int window_x_units(int scr_units, wimp_window_state* win); } mouseaction;
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, static void ro_gui_load_messages(void);
signed long y, os_box* clip, int current_background_color); static wimp_w ro_gui_load_template(const char* template_name);
void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw); static void ro_gui_load_templates(void);
static wimp_i ro_gui_icon(char* token);
static void ro_gui_transform_menu_entry(wimp_menu_entry* e);
static void ro_gui_transform_menus(void);
static void ro_gui_create_menu(wimp_menu* menu, int x, int y, gui_window* g);
static int window_x_units(int scr_units, wimp_window_state* win);
static int window_y_units(int scr_units, wimp_window_state* win);
static void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x,
signed long y, os_box* clip, unsigned long current_background_color);
static void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw);
static void gui_disable_icon(wimp_w w, wimp_i i);
static void gui_enable_icon(wimp_w w, wimp_i i);
static void ro_gui_icon_bar_click(wimp_pointer* pointer);
static void ro_gui_throb(void);
static gui_window* ro_lookup_gui_from_w(wimp_w window);
static gui_window* ro_lookup_gui_toolbar_from_w(wimp_w window);
static void ro_gui_drag_box(wimp_drag* drag, struct ro_gui_drag_info* drag_info);
static void ro_gui_drag_end(wimp_dragged* drag);
static void ro_gui_window_mouse_at(wimp_pointer* pointer);
static void ro_gui_toolbar_click(gui_window* g, wimp_pointer* pointer);
static void ro_gui_w_click(wimp_pointer* pointer);
static double calculate_angle(double x, double y);
static int anglesDifferent(double a, double b);
static mouseaction ro_gui_try_mouse_action(void);
static void ro_gui_poll_queue(wimp_event_no event, wimp_block* block);
static void ro_gui_keypress(wimp_key* key);
static void ro_gui_copy_selection(gui_window* g);
static void ro_gui_menu_selection(wimp_selection* selection);
static void ro_msg_datasave(wimp_message* block);
static void ro_msg_dataload(wimp_message* block);
static void gui_set_gadget_extent(struct box* box, int x, int y, os_box* extent, struct gui_gadget* g);
void ro_gui_load_messages(void) void ro_gui_load_messages(void)
@ -516,7 +546,7 @@ static char select_text_none[] = "<None>";
static char empty_text[] = ""; static char empty_text[] = "";
void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, 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) signed long y, os_box* clip, unsigned long current_background_color)
{ {
struct box * c; struct box * c;
const char * const noname = ""; const char * const noname = "";
@ -836,10 +866,13 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
break; break;
case CONTENT_JPEG: case CONTENT_JPEG:
xjpeg_plot_scaled(c->data.jpeg.data, xjpeg_plot_scaled((jpeg_image *) c->data.jpeg.data,
redraw->box.x0 - redraw->xscroll, (int) redraw->box.x0 - (int) redraw->xscroll,
redraw->box.y1 - redraw->yscroll - c->height * 2, (int) redraw->box.y1 - (int) redraw->yscroll - (int) c->height * 2,
0, c->data.jpeg.length, 0); 0, (int) c->data.jpeg.length, 0);
break;
default:
break; break;
} }
more = wimp_get_rectangle(redraw); more = wimp_get_rectangle(redraw);
@ -853,7 +886,7 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
} }
} }
void gui_window_set_scroll(gui_window* g, int sx, int sy) void gui_window_set_scroll(gui_window* g, unsigned long sx, unsigned long sy)
{ {
wimp_window_state state; wimp_window_state state;
if (g == NULL) if (g == NULL)
@ -872,7 +905,7 @@ unsigned long gui_window_get_width(gui_window* g)
wimp_window_state state; wimp_window_state state;
state.w = g->data.browser.window; state.w = g->data.browser.window;
wimp_get_window_state(&state); wimp_get_window_state(&state);
return browser_x_units(state.visible.x1 - state.visible.x0); return browser_x_units((unsigned long) (state.visible.x1 - state.visible.x0));
} }
void gui_window_set_extent(gui_window* g, unsigned long width, unsigned long height) void gui_window_set_extent(gui_window* g, unsigned long width, unsigned long height)
@ -1008,8 +1041,9 @@ void ro_gui_icon_bar_click(wimp_pointer* pointer)
| browser_SCROLL_X_NONE | browser_SCROLL_Y_ALWAYS, 640, 480); | browser_SCROLL_X_NONE | browser_SCROLL_Y_ALWAYS, 640, 480);
gui_window_show(bw->window); gui_window_show(bw->window);
browser_window_open_location(bw, HOME_URL); browser_window_open_location(bw, HOME_URL);
wimp_set_caret_position(bw->window->data.browser.toolbar, ro_theme_icon(current_theme, THEME_TOOLBAR, "TOOLBAR_URL"), wimp_set_caret_position(bw->window->data.browser.toolbar,
0,0,-1, strlen(bw->window->url) - 1); ro_theme_icon(current_theme, THEME_TOOLBAR, "TOOLBAR_URL"),
0,0,-1, (int) strlen(bw->window->url) - 1);
} }
// else if (pointer->buttons == wimp_CLICK_ADJUST) // else if (pointer->buttons == wimp_CLICK_ADJUST)
// netsurf_quit = 1; // netsurf_quit = 1;
@ -1047,10 +1081,10 @@ void gui_init(int argc, char** argv)
ro_gui_transform_menus(); ro_gui_transform_menus();
} }
void ro_gui_throb() void ro_gui_throb(void)
{ {
gui_window* g = netsurf_gui_windows; gui_window* g = netsurf_gui_windows;
float nowtime = (float) clock() / CLOCKS_PER_SEC; float nowtime = (float) (clock() + 0) / CLOCKS_PER_SEC; /* workaround compiler warning */
while (g != NULL) while (g != NULL)
{ {
@ -1147,7 +1181,7 @@ struct ro_gui_drag_info
} data; } data;
}; };
struct ro_gui_drag_info current_drag; static struct ro_gui_drag_info current_drag;
void ro_gui_drag_box(wimp_drag* drag, struct ro_gui_drag_info* drag_info) void ro_gui_drag_box(wimp_drag* drag, struct ro_gui_drag_info* drag_info)
{ {
@ -1310,14 +1344,6 @@ int anglesDifferent(double a, double b)
return (c > M_PI / 6.0); return (c > M_PI / 6.0);
} }
typedef enum {
mouseaction_NONE,
mouseaction_BACK, mouseaction_FORWARD,
mouseaction_RELOAD, mouseaction_PARENT,
mouseaction_NEWWINDOW_OR_LINKFG, mouseaction_DUPLICATE_OR_LINKBG,
mouseaction_TOGGLESIZE, mouseaction_ICONISE, mouseaction_CLOSE
} mouseaction;
#define STOPPED 2 #define STOPPED 2
#define THRESHOLD 16 #define THRESHOLD 16
#define DAMPING 1 #define DAMPING 1
@ -1712,7 +1738,7 @@ void gui_multitask(void)
case wimp_USER_MESSAGE : case wimp_USER_MESSAGE :
case wimp_USER_MESSAGE_RECORDED : case wimp_USER_MESSAGE_RECORDED :
case wimp_USER_MESSAGE_ACKNOWLEDGE: case wimp_USER_MESSAGE_ACKNOWLEDGE:
fprintf(stderr, "MESSAGE %d (%x) HAS ARRIVED\n", block.message.action); fprintf(stderr, "MESSAGE %d (%x) HAS ARRIVED\n", block.message.action, block.message.action);
if (block.message.action == message_DATA_SAVE) if (block.message.action == message_DATA_SAVE)
ro_msg_datasave(&(block.message)); ro_msg_datasave(&(block.message));
else if (block.message.action == message_DATA_LOAD) else if (block.message.action == message_DATA_LOAD)
@ -1983,7 +2009,7 @@ void gui_poll(void)
case wimp_USER_MESSAGE : case wimp_USER_MESSAGE :
case wimp_USER_MESSAGE_RECORDED : case wimp_USER_MESSAGE_RECORDED :
case wimp_USER_MESSAGE_ACKNOWLEDGE: case wimp_USER_MESSAGE_ACKNOWLEDGE:
fprintf(stderr, "MESSAGE %d (%x) HAS ARRIVED\n", block.message.action); fprintf(stderr, "MESSAGE %d (%x) HAS ARRIVED\n", block.message.action, block.message.action);
if (block.message.action == message_DATA_SAVE) if (block.message.action == message_DATA_SAVE)
ro_msg_datasave(&(block.message)); ro_msg_datasave(&(block.message));
else if (block.message.action == message_DATA_LOAD) else if (block.message.action == message_DATA_LOAD)
@ -2046,7 +2072,7 @@ int gui_file_to_filename(char* location, char* actual_filename, int size)
void gui_window_start_throbber(gui_window* g) void gui_window_start_throbber(gui_window* g)
{ {
g->throbtime = (float)clock() / CLOCKS_PER_SEC; g->throbtime = (float) (clock() + 0) / CLOCKS_PER_SEC; /* workaround compiler warning */
g->throbber = 0; g->throbber = 0;
} }
@ -2125,22 +2151,11 @@ void gui_edit_textarea(struct browser_window* bw, struct gui_gadget* g)
xos_cli("filer_run <Wimp$ScrapDir>.NetSurf.TextArea"); xos_cli("filer_run <Wimp$ScrapDir>.NetSurf.TextArea");
} }
struct msg_datasave {
wimp_w w;
wimp_i i;
os_coord pos;
int size;
int filetype;
char leafname[212];
};
typedef struct msg_datasave msg_datasave;
void ro_msg_datasave(wimp_message* block) void ro_msg_datasave(wimp_message* block)
{ {
gui_window* gui; gui_window* gui;
struct browser_window* bw; struct browser_window* bw;
msg_datasave* data; wimp_message_data_xfer* data;
int x,y; int x,y;
struct box_selection* click_boxes; struct box_selection* click_boxes;
int found, plot_index; int found, plot_index;
@ -2148,7 +2163,7 @@ void ro_msg_datasave(wimp_message* block)
int done = 0; int done = 0;
wimp_window_state state; wimp_window_state state;
data = (msg_datasave*)block->data.reserved; data = &block->data.data_xfer;
gui = ro_lookup_gui_from_w(data->w); gui = ro_lookup_gui_from_w(data->w);
if (gui == NULL) if (gui == NULL)
@ -2169,20 +2184,20 @@ void ro_msg_datasave(wimp_message* block)
x, y, 0, 0, &click_boxes, &found, &plot_index); x, y, 0, 0, &click_boxes, &found, &plot_index);
if (found == 0) if (found == 0)
return 0; return;
for (i = found - 1; i >= 0; i--) for (i = found - 1; i >= 0; i--)
{ {
if (click_boxes[i].box->gadget != NULL) if (click_boxes[i].box->gadget != NULL)
{ {
if (click_boxes[i].box->gadget->type == GADGET_TEXTAREA && data->filetype == 0xFFF) if (click_boxes[i].box->gadget->type == GADGET_TEXTAREA && data->file_type == 0xFFF)
{ {
/* load the text in! */ /* load the text in! */
fprintf(stderr, "REPLYING TO MESSAGE MATE\n"); fprintf(stderr, "REPLYING TO MESSAGE MATE\n");
block->action = message_DATA_SAVE_ACK; block->action = message_DATA_SAVE_ACK;
block->your_ref = block->my_ref; block->your_ref = block->my_ref;
block->my_ref = 0; block->my_ref = 0;
strcpy(block->data.reserved[24], "<Wimp$Scrap>"); strcpy(block->data.data_xfer.file_name, "<Wimp$Scrap>");
wimp_send_message(wimp_USER_MESSAGE, block, block->sender); wimp_send_message(wimp_USER_MESSAGE, block, block->sender);
} }
} }
@ -2195,7 +2210,7 @@ void ro_msg_dataload(wimp_message* block)
{ {
gui_window* gui; gui_window* gui;
struct browser_window* bw; struct browser_window* bw;
msg_datasave* data; wimp_message_data_xfer* data;
int x,y; int x,y;
struct box_selection* click_boxes; struct box_selection* click_boxes;
int found, plot_index; int found, plot_index;
@ -2203,7 +2218,7 @@ void ro_msg_dataload(wimp_message* block)
int done = 0; int done = 0;
wimp_window_state state; wimp_window_state state;
data = (msg_datasave*)block->data.reserved; data = &block->data.data_xfer;
gui = ro_lookup_gui_from_w(data->w); gui = ro_lookup_gui_from_w(data->w);
if (gui == NULL) if (gui == NULL)
@ -2224,18 +2239,18 @@ void ro_msg_dataload(wimp_message* block)
x, y, 0, 0, &click_boxes, &found, &plot_index); x, y, 0, 0, &click_boxes, &found, &plot_index);
if (found == 0) if (found == 0)
return 0; return;
for (i = found - 1; i >= 0; i--) for (i = found - 1; i >= 0; i--)
{ {
if (click_boxes[i].box->gadget != NULL) if (click_boxes[i].box->gadget != NULL)
{ {
if (click_boxes[i].box->gadget->type == GADGET_TEXTAREA && data->filetype == 0xFFF) if (click_boxes[i].box->gadget->type == GADGET_TEXTAREA && data->file_type == 0xFFF)
{ {
/* load the text in! */ /* load the text in! */
if (click_boxes[i].box->gadget->data.textarea.text != 0) if (click_boxes[i].box->gadget->data.textarea.text != 0)
xfree(click_boxes[i].box->gadget->data.textarea.text); xfree(click_boxes[i].box->gadget->data.textarea.text);
click_boxes[i].box->gadget->data.textarea.text = load(data->leafname); click_boxes[i].box->gadget->data.textarea.text = load(data->file_name);
gui_redraw_gadget(bw, click_boxes[i].box->gadget); gui_redraw_gadget(bw, click_boxes[i].box->gadget);
} }
} }
@ -2245,10 +2260,10 @@ void ro_msg_dataload(wimp_message* block)
} }
struct browser_window* current_textbox_bw; static struct browser_window* current_textbox_bw;
struct gui_gadget* current_textbox = 0; static struct gui_gadget* current_textbox = 0;
wimp_w current_textbox_w; static wimp_w current_textbox_w;
wimp_i current_textbox_i; static wimp_i current_textbox_i;
void gui_set_gadget_extent(struct box* box, int x, int y, os_box* extent, struct gui_gadget* g) void gui_set_gadget_extent(struct box* box, int x, int y, os_box* extent, struct gui_gadget* g)
{ {
@ -2301,7 +2316,7 @@ void gui_edit_textbox(struct browser_window* bw, struct gui_gadget* g)
(wimp_BUTTON_WRITABLE << wimp_ICON_BUTTON_TYPE_SHIFT); (wimp_BUTTON_WRITABLE << wimp_ICON_BUTTON_TYPE_SHIFT);
icon.icon.data.indirected_text.text = g->data.textbox.text; icon.icon.data.indirected_text.text = g->data.textbox.text;
icon.icon.data.indirected_text.size = g->data.textbox.maxlength + 1; icon.icon.data.indirected_text.size = g->data.textbox.maxlength + 1;
icon.icon.data.indirected_text.validation = " "; icon.icon.data.indirected_text.validation = empty_text;
current_textbox_i = wimp_create_icon(&icon); current_textbox_i = wimp_create_icon(&icon);
current_textbox = g; current_textbox = g;
gui_redraw_gadget(bw, current_textbox); gui_redraw_gadget(bw, current_textbox);

View File

@ -166,7 +166,7 @@ fprintf(stderr, "Returning theme...\n");
return theme; return theme;
} }
wimp_i ro_theme_icon(ro_theme* theme, theme_window_type type, char* token) wimp_i ro_theme_icon(ro_theme* theme, theme_window_type type, const char* token)
{ {
int used; int used;
char buffer[32]; char buffer[32];

View File

@ -64,11 +64,13 @@ typedef enum {theme_TOOLBAR_UNKNOWN,
ro_theme* ro_theme_create(char* pathname); ro_theme* ro_theme_create(char* pathname);
/* return icon number */ /* return icon number */
wimp_i ro_theme_icon(ro_theme* theme, theme_window_type type, char* token); wimp_i ro_theme_icon(ro_theme* theme, theme_window_type type, const char* token);
/* create a window */ /* create a window */
wimp_w ro_theme_create_window(ro_theme* theme, ro_theme_window* create); wimp_w ro_theme_create_window(ro_theme* theme, ro_theme_window* create);
int ro_theme_toolbar_height(ro_theme* theme); int ro_theme_toolbar_height(ro_theme* theme);
void ro_theme_resize(ro_theme* theme, theme_window_type wintype, wimp_w w, int width, int height);
#endif #endif