summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/cache.c4
-rw-r--r--content/cache.h4
-rw-r--r--content/fetchcache.c8
-rw-r--r--content/fetchcache.h4
-rw-r--r--desktop/browser.c46
-rw-r--r--desktop/browser.h9
-rw-r--r--desktop/gui.h4
-rw-r--r--desktop/netsurf.c5
-rw-r--r--render/box.c53
-rw-r--r--render/box.h4
-rw-r--r--render/html.c4
-rw-r--r--render/layout.c29
-rw-r--r--riscos/font.c4
-rw-r--r--riscos/gui.c139
-rw-r--r--riscos/theme.c2
-rw-r--r--riscos/theme.h4
16 files changed, 172 insertions, 151 deletions
diff --git a/content/cache.c b/content/cache.c
index 30a39053b..f9dd4e4f5 100644
--- a/content/cache.c
+++ b/content/cache.c
@@ -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>
@@ -67,7 +67,7 @@ void cache_quit(void)
* 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;
diff --git a/content/cache.h b/content/cache.h
index 2ee4e3b81..a1c681507 100644
--- a/content/cache.h
+++ b/content/cache.h
@@ -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_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_free(struct content * content);
void cache_dump(void);
diff --git a/content/fetchcache.c b/content/fetchcache.c
index b950da093..8def6956f 100644
--- a/content/fetchcache.c
+++ b/content/fetchcache.c
@@ -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>
@@ -22,11 +22,11 @@ struct fetchcache {
};
-void fetchcache_free(struct fetchcache *fc);
-void fetchcache_callback(fetchcache_msg msg, void *p, char *data, unsigned long size);
+static void fetchcache_free(struct fetchcache *fc);
+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 *p, unsigned long width, unsigned long height)
{
diff --git a/content/fetchcache.h b/content/fetchcache.h
index 37fa8176b..d8986002a 100644
--- a/content/fetchcache.h
+++ b/content/fetchcache.h
@@ -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_
@@ -9,7 +9,7 @@
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 *p, unsigned long width, unsigned long height);
diff --git a/desktop/browser.c b/desktop/browser.c
index 4661325ed..1d94971fa 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -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"
@@ -18,30 +18,27 @@
#include <time.h>
#include <ctype.h>
-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,
+static void browser_window_start_throbber(struct browser_window* bw);
+static void browser_window_stop_throbber(struct browser_window* bw);
+static void browser_window_reformat(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);
-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,
+static void browser_window_clear_text_selection(struct browser_window* bw);
+static void browser_window_change_text_selection(struct browser_window* bw, struct box_position* new_start, struct box_position* new_end);
+static 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,
+static void browser_window_redraw_boxes(struct browser_window* bw, struct box_position* start, struct box_position* end);
+static void browser_window_follow_link(struct browser_window* bw,
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 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 clear_radio_gadgets(struct browser_window* bw, struct box* box, struct gui_gadget* group);
+static 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);
+static 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);
+static char *url_join(const char* new, const char* base);
void browser_window_start_throbber(struct browser_window* bw)
@@ -211,7 +208,7 @@ void browser_window_destroy(struct browser_window* bw)
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));
@@ -224,11 +221,12 @@ void browser_window_open_location_historical(struct browser_window* bw, char* ur
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));
- assert(bw != 0 && url != 0);
- url = url_join(url, bw->url);
+ char *url;
+ LOG(("bw = %p, url0 = %s", bw, url0));
+ assert(bw != 0 && url0 != 0);
+ url = url_join(url0, bw->url);
browser_window_open_location_historical(bw, url);
if (bw->history == NULL)
bw->history = history_create(NULL, url);
diff --git a/desktop/browser.h b/desktop/browser.h
index 25fc6f6ed..299b17f73 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -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_
@@ -93,19 +93,22 @@ struct box_selection
struct browser_window* create_browser_window(int flags, int width, int height);
void browser_window_destroy(struct browser_window* bw);
-void browser_window_open_location(struct browser_window* bw, char* url);
-void browser_window_open_location_historical(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, const char* url);
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_back(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_gt(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);
+void gui_redraw_gadget(struct browser_window* bw, struct gui_gadget* g);
#endif
diff --git a/desktop/gui.h b/desktop/gui.h
index 685def3f2..c80c56b4e 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -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_
@@ -30,7 +30,7 @@ void gui_window_hide(gui_window* g);
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_scroll(gui_window* g, unsigned long sx, unsigned long sy);
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);
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index f8161c975..446f8c05a 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -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"
@@ -13,6 +13,9 @@
int netsurf_quit = 0;
gui_window* netsurf_gui_windows = NULL;
+static void netsurf_init(int argc, char** argv);
+static void netsurf_exit(void);
+
void netsurf_poll(void)
{
diff --git a/render/box.c b/render/box.c
index 1a07be7ba..96b0931d7 100644
--- a/render/box.c
+++ b/render/box.c
@@ -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>
@@ -20,13 +20,11 @@
* internal functions
*/
-struct box* input(xmlNode * n, struct css_style* style, struct form* current_form);
-
-void box_add_child(struct box * parent, struct box * child);
-struct box * box_create(xmlNode * node, box_type type, struct css_style * style,
+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,
char *href);
-char * tolat1(xmlChar * s);
-struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
+static char * tolat1(xmlChar * s);
+static struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
struct css_stylesheet * stylesheet,
struct css_selector ** selector, unsigned int depth,
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_textarea, struct form* current_form,
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);
-void box_normalise_block(struct box *block);
-void box_normalise_table(struct box *table);
-void box_normalise_table_row_group(struct box *row_group);
-void box_normalise_table_row(struct box *row);
-void box_normalise_inline_container(struct box *cont);
-void gadget_free(struct gui_gadget* g);
-void box_free_box(struct box *box);
-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);
-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);
-void textarea_addtext(struct gui_gadget* textarea, char* text);
-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);
-struct form* box_form(xmlNode* n);
-void add_form_element(struct page_elements* pe, struct form* f);
-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 box_normalise_block(struct box *block);
+static void box_normalise_table(struct box *table);
+static void box_normalise_table_row_group(struct box *row_group);
+static void box_normalise_table_row(struct box *row);
+static void box_normalise_inline_container(struct box *cont);
+static void gadget_free(struct gui_gadget* g);
+static void box_free_box(struct box *box);
+static struct box* box_image(xmlNode * n, struct css_style* style, char* href);
+static struct box* box_textarea(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);
+static struct formoption* box_option(xmlNode* n, struct css_style* style, struct gui_gadget* current_select);
+static void textarea_addtext(struct gui_gadget* textarea, char* text);
+static void option_addtext(struct formoption* option, char* text);
+static struct box* box_input(xmlNode * n, struct css_style* style, struct form* current_form, struct page_elements* elements);
+static struct form* box_form(xmlNode* n);
+static void add_form_element(struct page_elements* pe, struct form* f);
+static void add_gadget_element(struct page_elements* pe, struct gui_gadget* g);
+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);
}
- 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"))) {
strncpy(box->gadget->data.textbox.text, s,
diff --git a/render/box.h b/render/box.h
index 78d78d456..d329ee331 100644
--- a/render/box.h
+++ b/render/box.h
@@ -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_
@@ -44,7 +44,7 @@ struct gui_gadget {
char* value;
} hidden;
struct {
- int maxlength;
+ unsigned int maxlength;
char* text;
int size;
} textbox;
diff --git a/render/html.c b/render/html.c
index b76ac15a3..b41ca6ed2 100644
--- a/render/html.c
+++ b/render/html.c
@@ -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>
@@ -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);
gui_multitask();
}
- htmlParseChunk(c->data.html.parser, data + x, size - x, 0);
+ htmlParseChunk(c->data.html.parser, data + x, (int) (size - x), 0);
}
diff --git a/render/layout.c b/render/layout.c
index afc8c25df..a74dda48a 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -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>
@@ -22,27 +22,27 @@
* 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);
-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 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);
-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);
-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);
-signed long line_height(struct css_style * style);
-struct box * layout_line(struct box * first, unsigned long width, unsigned long * y,
+static signed long line_height(struct css_style * style);
+static struct box * layout_line(struct box * first, unsigned long width, unsigned long * y,
unsigned long cy, struct box * cont);
-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 place_float_below(struct box * c, unsigned long width, unsigned long y, struct box * cont);
+static void layout_table(struct box * box, unsigned long width, struct box * cont,
unsigned long cx, unsigned long cy);
-void calculate_widths(struct box *box);
-void calculate_inline_container_widths(struct box *box);
-void calculate_table_widths(struct box *table);
+static void calculate_widths(struct box *box);
+static void calculate_inline_container_widths(struct box *box);
+static void calculate_table_widths(struct box *table);
/**
* 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)
{
struct formoption* current;
diff --git a/riscos/font.c b/riscos/font.c
index a2ae8306d..12be223c4 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -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>
@@ -25,7 +25,7 @@ const char * const font_table[FONT_FAMILIES * 4] = {
"Homerton.Bold.Oblique\\ELatin1",
};
-void font_close(struct font_data *data);
+static void font_close(struct font_data *data);
/**
* functions
diff --git a/riscos/gui.c b/riscos/gui.c
index 98e91c128..a11980c06 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -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"
@@ -88,18 +88,48 @@ char* templates_messages_data;
wimp_w netsurf_info;
wimp_w netsurf_saveas;
-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);
+struct ro_gui_drag_info;
+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;
+
+static void ro_gui_load_messages(void);
+static wimp_w ro_gui_load_template(const char* template_name);
+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)
@@ -516,7 +546,7 @@ static char select_text_none[] = "<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)
+ signed long y, os_box* clip, unsigned long current_background_color)
{
struct box * c;
const char * const noname = "";
@@ -836,10 +866,13 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
break;
case CONTENT_JPEG:
- xjpeg_plot_scaled(c->data.jpeg.data,
- redraw->box.x0 - redraw->xscroll,
- redraw->box.y1 - redraw->yscroll - c->height * 2,
- 0, c->data.jpeg.length, 0);
+ xjpeg_plot_scaled((jpeg_image *) c->data.jpeg.data,
+ (int) redraw->box.x0 - (int) redraw->xscroll,
+ (int) redraw->box.y1 - (int) redraw->yscroll - (int) c->height * 2,
+ 0, (int) c->data.jpeg.length, 0);
+ break;
+
+ default:
break;
}
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;
if (g == NULL)
@@ -872,7 +905,7 @@ unsigned long gui_window_get_width(gui_window* g)
wimp_window_state state;
state.w = g->data.browser.window;
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)
@@ -1008,8 +1041,9 @@ void ro_gui_icon_bar_click(wimp_pointer* pointer)
| browser_SCROLL_X_NONE | browser_SCROLL_Y_ALWAYS, 640, 480);
gui_window_show(bw->window);
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"),
- 0,0,-1, strlen(bw->window->url) - 1);
+ wimp_set_caret_position(bw->window->data.browser.toolbar,
+ 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)
// netsurf_quit = 1;
@@ -1047,10 +1081,10 @@ void gui_init(int argc, char** argv)
ro_gui_transform_menus();
}
-void ro_gui_throb()
+void ro_gui_throb(void)
{
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)
{
@@ -1147,7 +1181,7 @@ struct ro_gui_drag_info
} 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)
{
@@ -1310,14 +1344,6 @@ int anglesDifferent(double a, double b)
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 THRESHOLD 16
#define DAMPING 1
@@ -1712,7 +1738,7 @@ void gui_multitask(void)
case wimp_USER_MESSAGE :
case wimp_USER_MESSAGE_RECORDED :
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)
ro_msg_datasave(&(block.message));
else if (block.message.action == message_DATA_LOAD)
@@ -1983,7 +2009,7 @@ void gui_poll(void)
case wimp_USER_MESSAGE :
case wimp_USER_MESSAGE_RECORDED :
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)
ro_msg_datasave(&(block.message));
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)
{
- g->throbtime = (float)clock() / CLOCKS_PER_SEC;
+ g->throbtime = (float) (clock() + 0) / CLOCKS_PER_SEC; /* workaround compiler warning */
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");
}
-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)
{
gui_window* gui;
struct browser_window* bw;
- msg_datasave* data;
+ wimp_message_data_xfer* data;
int x,y;
struct box_selection* click_boxes;
int found, plot_index;
@@ -2148,7 +2163,7 @@ void ro_msg_datasave(wimp_message* block)
int done = 0;
wimp_window_state state;
- data = (msg_datasave*)block->data.reserved;
+ data = &block->data.data_xfer;
gui = ro_lookup_gui_from_w(data->w);
if (gui == NULL)
@@ -2169,20 +2184,20 @@ void ro_msg_datasave(wimp_message* block)
x, y, 0, 0, &click_boxes, &found, &plot_index);
if (found == 0)
- return 0;
+ return;
for (i = found - 1; i >= 0; i--)
{
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! */
fprintf(stderr, "REPLYING TO MESSAGE MATE\n");
block->action = message_DATA_SAVE_ACK;
block->your_ref = block->my_ref;
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);
}
}
@@ -2195,7 +2210,7 @@ void ro_msg_dataload(wimp_message* block)
{
gui_window* gui;
struct browser_window* bw;
- msg_datasave* data;
+ wimp_message_data_xfer* data;
int x,y;
struct box_selection* click_boxes;
int found, plot_index;
@@ -2203,7 +2218,7 @@ void ro_msg_dataload(wimp_message* block)
int done = 0;
wimp_window_state state;
- data = (msg_datasave*)block->data.reserved;
+ data = &block->data.data_xfer;
gui = ro_lookup_gui_from_w(data->w);
if (gui == NULL)
@@ -2224,18 +2239,18 @@ void ro_msg_dataload(wimp_message* block)
x, y, 0, 0, &click_boxes, &found, &plot_index);
if (found == 0)
- return 0;
+ return;
for (i = found - 1; i >= 0; i--)
{
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! */
if (click_boxes[i].box->gadget->data.textarea.text != 0)
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);
}
}
@@ -2245,10 +2260,10 @@ void ro_msg_dataload(wimp_message* block)
}
-struct browser_window* current_textbox_bw;
-struct gui_gadget* current_textbox = 0;
-wimp_w current_textbox_w;
-wimp_i current_textbox_i;
+static struct browser_window* current_textbox_bw;
+static struct gui_gadget* current_textbox = 0;
+static wimp_w current_textbox_w;
+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)
{
@@ -2301,7 +2316,7 @@ void gui_edit_textbox(struct browser_window* bw, struct gui_gadget* g)
(wimp_BUTTON_WRITABLE << wimp_ICON_BUTTON_TYPE_SHIFT);
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.validation = " ";
+ icon.icon.data.indirected_text.validation = empty_text;
current_textbox_i = wimp_create_icon(&icon);
current_textbox = g;
gui_redraw_gadget(bw, current_textbox);
diff --git a/riscos/theme.c b/riscos/theme.c
index 806255ff8..97e7fbd81 100644
--- a/riscos/theme.c
+++ b/riscos/theme.c
@@ -166,7 +166,7 @@ fprintf(stderr, "Returning theme...\n");
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;
char buffer[32];
diff --git a/riscos/theme.h b/riscos/theme.h
index 2f8d8a803..92f29e177 100644
--- a/riscos/theme.h
+++ b/riscos/theme.h
@@ -64,11 +64,13 @@ typedef enum {theme_TOOLBAR_UNKNOWN,
ro_theme* ro_theme_create(char* pathname);
/* 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 */
wimp_w ro_theme_create_window(ro_theme* theme, ro_theme_window* create);
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