summaryrefslogtreecommitdiff
path: root/frontends/riscos/configure
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/riscos/configure')
-rw-r--r--frontends/riscos/configure/con_cache.c107
-rw-r--r--frontends/riscos/configure/con_connect.c220
-rw-r--r--frontends/riscos/configure/con_content.c107
-rw-r--r--frontends/riscos/configure/con_fonts.c209
-rw-r--r--frontends/riscos/configure/con_home.c118
-rw-r--r--frontends/riscos/configure/con_image.c269
-rw-r--r--frontends/riscos/configure/con_inter.c145
-rw-r--r--frontends/riscos/configure/con_language.c139
-rw-r--r--frontends/riscos/configure/con_secure.c83
-rw-r--r--frontends/riscos/configure/con_theme.c420
-rw-r--r--frontends/riscos/configure/configure.h43
11 files changed, 1860 insertions, 0 deletions
diff --git a/frontends/riscos/configure/con_cache.c b/frontends/riscos/configure/con_cache.c
new file mode 100644
index 000000000..730d6f82f
--- /dev/null
+++ b/frontends/riscos/configure/con_cache.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2005 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include <oslib/hourglass.h>
+
+#include "utils/nsoption.h"
+#include "utils/filename.h"
+#include "utils/messages.h"
+
+#include "riscos/gui.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/configure.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+
+
+#define CACHE_MEMORY_SIZE 3
+#define CACHE_MEMORY_DEC 4
+#define CACHE_MEMORY_INC 5
+#define CACHE_DISC_SIZE 10
+#define CACHE_DISC_DEC 11
+#define CACHE_DISC_INC 12
+#define CACHE_DISC_EXPIRE 15
+#define CACHE_DISC_EXPIRE_DEC 16
+#define CACHE_DISC_EXPIRE_INC 17
+#define CACHE_DEFAULT_BUTTON 19
+#define CACHE_CANCEL_BUTTON 20
+#define CACHE_OK_BUTTON 21
+
+static bool ro_gui_options_cache_click(wimp_pointer *pointer);
+static bool ro_gui_options_cache_ok(wimp_w w);
+
+bool ro_gui_options_cache_initialise(wimp_w w)
+{
+ /* set the current values */
+ ro_gui_set_icon_decimal(w, CACHE_MEMORY_SIZE,
+ (nsoption_int(memory_cache_size) * 10) >> 20, 1);
+ ro_gui_set_icon_decimal(w, CACHE_DISC_SIZE,
+ (int) ((nsoption_uint(disc_cache_size)) >> 20), 0);
+ ro_gui_set_icon_decimal(w, CACHE_DISC_EXPIRE,
+ (nsoption_int(disc_cache_age)), 0);
+
+ /* initialise all functions for a newly created window */
+ ro_gui_wimp_event_register_numeric_field(w, CACHE_MEMORY_SIZE,
+ CACHE_MEMORY_INC, CACHE_MEMORY_DEC, 0, 640, 1, 1);
+ ro_gui_wimp_event_register_numeric_field(w, CACHE_DISC_SIZE,
+ CACHE_DISC_INC, CACHE_DISC_DEC, 0, 4095, 1, 0);
+ ro_gui_wimp_event_register_numeric_field(w, CACHE_DISC_EXPIRE,
+ CACHE_DISC_EXPIRE_INC, CACHE_DISC_EXPIRE_DEC, 1, 3650,
+ 1, 0);
+ ro_gui_wimp_event_register_mouse_click(w, ro_gui_options_cache_click);
+ ro_gui_wimp_event_register_cancel(w, CACHE_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, CACHE_OK_BUTTON,
+ ro_gui_options_cache_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpCacheConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+bool ro_gui_options_cache_click(wimp_pointer *pointer)
+{
+ switch (pointer->i) {
+ case CACHE_DEFAULT_BUTTON:
+ /* set the default values */
+ ro_gui_set_icon_decimal(pointer->w, CACHE_MEMORY_SIZE,
+ 120, 1);
+ ro_gui_set_icon_decimal(pointer->w, CACHE_DISC_SIZE,
+ 1024, 0);
+ ro_gui_set_icon_decimal(pointer->w, CACHE_DISC_EXPIRE,
+ 28, 0);
+ return true;
+ }
+ return false;
+}
+
+bool ro_gui_options_cache_ok(wimp_w w)
+{
+ nsoption_set_int(memory_cache_size,
+ (((ro_gui_get_icon_decimal(w,
+ CACHE_MEMORY_SIZE, 1) + 1) << 20) - 1) / 10);
+ nsoption_set_uint(disc_cache_size,
+ (uint) (ro_gui_get_icon_decimal(w,
+ CACHE_DISC_SIZE, 0) << 20));
+ nsoption_set_int(disc_cache_age,
+ ro_gui_get_icon_decimal(w, CACHE_DISC_EXPIRE, 0));
+
+ ro_gui_save_options();
+ return true;
+}
diff --git a/frontends/riscos/configure/con_connect.c b/frontends/riscos/configure/con_connect.c
new file mode 100644
index 000000000..9515c5d6f
--- /dev/null
+++ b/frontends/riscos/configure/con_connect.c
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2006 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include "swis.h"
+#include "oslib/osspriteop.h"
+#include "oslib/wimp.h"
+
+#include "utils/nsoption.h"
+#include "utils/log.h"
+
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+#include "riscos/menus.h"
+#include "riscos/tinct.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+
+
+#define CONNECTION_PROXY_FIELD 3
+#define CONNECTION_PROXY_MENU 4
+#define CONNECTION_PROXY_HOST_LABEL 5
+#define CONNECTION_PROXY_HOST 6
+#define CONNECTION_PROXY_PORT_LABEL 7
+#define CONNECTION_PROXY_PORT 8
+#define CONNECTION_PROXY_USERNAME_LABEL 9
+#define CONNECTION_PROXY_USERNAME 10
+#define CONNECTION_PROXY_PASSWORD_LABEL 11
+#define CONNECTION_PROXY_PASSWORD 12
+#define CONNECTION_MAX_FETCH_FIELD 16
+#define CONNECTION_MAX_FETCH_DEC 17
+#define CONNECTION_MAX_FETCH_INC 18
+#define CONNECTION_HOST_FETCH_FIELD 20
+#define CONNECTION_HOST_FETCH_DEC 21
+#define CONNECTION_HOST_FETCH_INC 22
+#define CONNECTION_CACHE_FETCH_FIELD 24
+#define CONNECTION_CACHE_FETCH_DEC 25
+#define CONNECTION_CACHE_FETCH_INC 26
+#define CONNECTION_DEFAULT_BUTTON 27
+#define CONNECTION_CANCEL_BUTTON 28
+#define CONNECTION_OK_BUTTON 29
+
+#define http_proxy_type (nsoption_bool(http_proxy) ? (nsoption_int(http_proxy_auth) + 1) : 0)
+
+static int ro_gui_options_connection_proxy_type(wimp_w w);
+static void ro_gui_options_connection_default(wimp_pointer *pointer);
+static bool ro_gui_options_connection_ok(wimp_w w);
+static bool ro_gui_options_connection_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a);
+
+bool ro_gui_options_connection_initialise(wimp_w w)
+{
+ int proxy_type;
+
+ /* set the current values */
+ proxy_type = (nsoption_bool(http_proxy) ? (nsoption_int(http_proxy_auth) + 1) : 0);
+ ro_gui_set_icon_string(w, CONNECTION_PROXY_FIELD,
+ proxy_type_menu->entries[proxy_type].
+ data.indirected_text.text, true);
+ ro_gui_set_icon_string(w, CONNECTION_PROXY_HOST,
+ nsoption_charp(http_proxy_host) ?
+ nsoption_charp(http_proxy_host) : "", true);
+ ro_gui_set_icon_integer(w, CONNECTION_PROXY_PORT,
+ nsoption_int(http_proxy_port));
+ ro_gui_set_icon_string(w, CONNECTION_PROXY_USERNAME,
+ nsoption_charp(http_proxy_auth_user) ?
+ nsoption_charp(http_proxy_auth_user) : "", true);
+ ro_gui_set_icon_string(w, CONNECTION_PROXY_PASSWORD,
+ nsoption_charp(http_proxy_auth_pass) ?
+ nsoption_charp(http_proxy_auth_pass) : "", true);
+ ro_gui_set_icon_integer(w, CONNECTION_MAX_FETCH_FIELD,
+ nsoption_int(max_fetchers));
+ ro_gui_set_icon_integer(w, CONNECTION_HOST_FETCH_FIELD,
+ nsoption_int(max_fetchers_per_host));
+ ro_gui_set_icon_integer(w, CONNECTION_CACHE_FETCH_FIELD,
+ nsoption_int(max_cached_fetch_handles));
+ ro_gui_options_connection_update(w, -1, NULL, NULL, NO_ACTION);
+
+ /* register icons */
+ ro_gui_wimp_event_register_menu_gright(w, CONNECTION_PROXY_FIELD,
+ CONNECTION_PROXY_MENU, proxy_type_menu);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_HOST_LABEL);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_HOST);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_PORT_LABEL);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_PORT);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_USERNAME_LABEL);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_USERNAME);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_PASSWORD_LABEL);
+ ro_gui_wimp_event_register_text_field(w, CONNECTION_PROXY_PASSWORD);
+ ro_gui_wimp_event_register_numeric_field(w, CONNECTION_MAX_FETCH_FIELD,
+ CONNECTION_MAX_FETCH_INC, CONNECTION_MAX_FETCH_DEC,
+ 1, 99, 1, 0);
+ ro_gui_wimp_event_register_numeric_field(w, CONNECTION_HOST_FETCH_FIELD,
+ CONNECTION_HOST_FETCH_INC, CONNECTION_HOST_FETCH_DEC,
+ 1, 99, 1, 0);
+ ro_gui_wimp_event_register_numeric_field(w, CONNECTION_CACHE_FETCH_FIELD,
+ CONNECTION_CACHE_FETCH_INC, CONNECTION_CACHE_FETCH_DEC,
+ 1, 99, 1, 0);
+ ro_gui_wimp_event_register_menu_selection(w,
+ ro_gui_options_connection_update);
+ ro_gui_wimp_event_register_button(w, CONNECTION_DEFAULT_BUTTON,
+ ro_gui_options_connection_default);
+ ro_gui_wimp_event_register_cancel(w, CONNECTION_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, CONNECTION_OK_BUTTON,
+ ro_gui_options_connection_ok);
+
+ ro_gui_wimp_event_set_help_prefix(w, "HelpConnectConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+bool ro_gui_options_connection_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a)
+{
+ int proxy_type;
+ bool host, user;
+
+ /* update the shaded state */
+ proxy_type = ro_gui_options_connection_proxy_type(w);
+ host = (proxy_type > 0);
+ user = (proxy_type > 1);
+
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_HOST_LABEL, !host);
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_HOST, !host);
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PORT_LABEL, !host);
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PORT, !host);
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_USERNAME_LABEL, !user);
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_USERNAME, !user);
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PASSWORD_LABEL, !user);
+ ro_gui_set_icon_shaded_state(w, CONNECTION_PROXY_PASSWORD, !user);
+
+ return true;
+}
+
+int ro_gui_options_connection_proxy_type(wimp_w w)
+{
+ const char *text;
+ int i;
+
+ text = ro_gui_get_icon_string(w, CONNECTION_PROXY_FIELD);
+ for (i = 0; (i < 4); i++)
+ if (!strcmp(text, proxy_type_menu->entries[i].
+ data.indirected_text.text))
+ return i;
+ assert(false);
+}
+
+void ro_gui_options_connection_default(wimp_pointer *pointer)
+{
+ ro_gui_set_icon_string(pointer->w, CONNECTION_PROXY_FIELD,
+ proxy_type_menu->entries[0].
+ data.indirected_text.text, true);
+ ro_gui_set_icon_string(pointer->w, CONNECTION_PROXY_HOST, "", true);
+ ro_gui_set_icon_integer(pointer->w, CONNECTION_PROXY_PORT, 8080);
+ ro_gui_set_icon_string(pointer->w, CONNECTION_PROXY_USERNAME, "", true);
+ ro_gui_set_icon_string(pointer->w, CONNECTION_PROXY_PASSWORD, "", true);
+ ro_gui_set_icon_integer(pointer->w, CONNECTION_MAX_FETCH_FIELD, 24);
+ ro_gui_set_icon_integer(pointer->w, CONNECTION_HOST_FETCH_FIELD, 5);
+ ro_gui_set_icon_integer(pointer->w, CONNECTION_CACHE_FETCH_FIELD, 6);
+ ro_gui_options_connection_update(pointer->w, -1, NULL, NULL, NO_ACTION);
+}
+
+bool ro_gui_options_connection_ok(wimp_w w)
+{
+ int proxy_type;
+
+ proxy_type = ro_gui_options_connection_proxy_type(w);
+ if (proxy_type == 0) {
+ nsoption_set_bool(http_proxy, false);
+ } else {
+ nsoption_set_bool(http_proxy, true);
+ nsoption_set_int(http_proxy_auth, proxy_type - 1);
+ }
+
+ nsoption_set_charp(http_proxy_host,
+ strdup(ro_gui_get_icon_string(w,
+ CONNECTION_PROXY_HOST)));
+
+ nsoption_set_int(http_proxy_port,
+ ro_gui_get_icon_decimal(w, CONNECTION_PROXY_PORT, 0));
+
+ nsoption_set_charp(http_proxy_auth_user,
+ strdup(ro_gui_get_icon_string(w,
+ CONNECTION_PROXY_USERNAME)));
+
+ nsoption_set_charp(http_proxy_auth_pass,
+ strdup(ro_gui_get_icon_string(w,
+ CONNECTION_PROXY_PASSWORD)));
+
+ nsoption_set_int(max_fetchers,
+ ro_gui_get_icon_decimal(w,
+ CONNECTION_MAX_FETCH_FIELD, 0));
+
+ nsoption_set_int(max_fetchers_per_host,
+ ro_gui_get_icon_decimal(w,
+ CONNECTION_HOST_FETCH_FIELD, 0));
+
+ nsoption_set_int(max_cached_fetch_handles,
+ ro_gui_get_icon_decimal(w,
+ CONNECTION_CACHE_FETCH_FIELD, 0));
+
+ ro_gui_save_options();
+ return true;
+}
diff --git a/frontends/riscos/configure/con_content.c b/frontends/riscos/configure/con_content.c
new file mode 100644
index 000000000..50bbd15ef
--- /dev/null
+++ b/frontends/riscos/configure/con_content.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2006 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+
+#include "utils/nsoption.h"
+#include "utils/messages.h"
+
+#include "riscos/gui.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/configure.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+
+#define CONTENT_BLOCK_ADVERTISEMENTS 2
+#define CONTENT_BLOCK_POPUPS 3
+#define CONTENT_NO_PLUGINS 4
+#define CONTENT_TARGET_BLANK 7
+#define CONTENT_DEFAULT_BUTTON 8
+#define CONTENT_CANCEL_BUTTON 9
+#define CONTENT_OK_BUTTON 10
+#define CONTENT_NO_JAVASCRIPT 11
+
+static void ro_gui_options_content_default(wimp_pointer *pointer);
+static bool ro_gui_options_content_ok(wimp_w w);
+
+bool ro_gui_options_content_initialise(wimp_w w)
+{
+ /* set the current values */
+ ro_gui_set_icon_selected_state(w, CONTENT_BLOCK_ADVERTISEMENTS,
+ nsoption_bool(block_advertisements));
+ ro_gui_set_icon_selected_state(w, CONTENT_BLOCK_POPUPS,
+ nsoption_bool(block_popups));
+ ro_gui_set_icon_selected_state(w, CONTENT_NO_PLUGINS,
+ nsoption_bool(no_plugins));
+ ro_gui_set_icon_selected_state(w, CONTENT_TARGET_BLANK,
+ nsoption_bool(target_blank));
+ ro_gui_set_icon_selected_state(w, CONTENT_NO_JAVASCRIPT,
+ !nsoption_bool(enable_javascript));
+
+ /* initialise all functions for a newly created window */
+ ro_gui_wimp_event_register_checkbox(w, CONTENT_BLOCK_ADVERTISEMENTS);
+ ro_gui_wimp_event_register_checkbox(w, CONTENT_BLOCK_POPUPS);
+ ro_gui_wimp_event_register_checkbox(w, CONTENT_NO_PLUGINS);
+ ro_gui_wimp_event_register_checkbox(w, CONTENT_TARGET_BLANK);
+ ro_gui_wimp_event_register_checkbox(w, CONTENT_NO_JAVASCRIPT);
+ ro_gui_wimp_event_register_button(w, CONTENT_DEFAULT_BUTTON,
+ ro_gui_options_content_default);
+ ro_gui_wimp_event_register_cancel(w, CONTENT_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, CONTENT_OK_BUTTON,
+ ro_gui_options_content_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpContentConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+void ro_gui_options_content_default(wimp_pointer *pointer)
+{
+ /* set the default values */
+ ro_gui_set_icon_selected_state(pointer->w, CONTENT_BLOCK_ADVERTISEMENTS,
+ false);
+ ro_gui_set_icon_selected_state(pointer->w, CONTENT_BLOCK_POPUPS,
+ false);
+ ro_gui_set_icon_selected_state(pointer->w, CONTENT_NO_PLUGINS,
+ false);
+ ro_gui_set_icon_selected_state(pointer->w, CONTENT_TARGET_BLANK,
+ true);
+ ro_gui_set_icon_selected_state(pointer->w, CONTENT_NO_JAVASCRIPT,
+ false);
+}
+
+bool ro_gui_options_content_ok(wimp_w w)
+{
+ nsoption_set_bool(block_advertisements,
+ ro_gui_get_icon_selected_state(w, CONTENT_BLOCK_ADVERTISEMENTS));
+
+ nsoption_set_bool(block_popups,
+ ro_gui_get_icon_selected_state(w, CONTENT_BLOCK_POPUPS));
+ nsoption_set_bool(no_plugins,
+ ro_gui_get_icon_selected_state(w, CONTENT_NO_PLUGINS));
+
+ nsoption_set_bool(target_blank,
+ ro_gui_get_icon_selected_state(w, CONTENT_TARGET_BLANK));
+
+ nsoption_set_bool(enable_javascript,
+ !ro_gui_get_icon_selected_state(w, CONTENT_NO_JAVASCRIPT));
+
+ ro_gui_save_options();
+ return true;
+}
diff --git a/frontends/riscos/configure/con_fonts.c b/frontends/riscos/configure/con_fonts.c
new file mode 100644
index 000000000..280312843
--- /dev/null
+++ b/frontends/riscos/configure/con_fonts.c
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2005 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#include "utils/nsoption.h"
+#include "utils/messages.h"
+#include "desktop/plot_style.h"
+
+#include "riscos/gui.h"
+#include "riscos/font.h"
+#include "riscos/menus.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/configure.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+
+
+#define FONT_SANS_FIELD 3
+#define FONT_SANS_MENU 4
+#define FONT_SERIF_FIELD 6
+#define FONT_SERIF_MENU 7
+#define FONT_MONOSPACE_FIELD 9
+#define FONT_MONOSPACE_MENU 10
+#define FONT_CURSIVE_FIELD 12
+#define FONT_CURSIVE_MENU 13
+#define FONT_FANTASY_FIELD 15
+#define FONT_FANTASY_MENU 16
+#define FONT_DEFAULT_FIELD 18
+#define FONT_DEFAULT_MENU 19
+#define FONT_DEFAULT_SIZE 23
+#define FONT_DEFAULT_DEC 24
+#define FONT_DEFAULT_INC 25
+#define FONT_MINIMUM_SIZE 28
+#define FONT_MINIMUM_DEC 29
+#define FONT_MINIMUM_INC 30
+#define FONT_DEFAULT_BUTTON 32
+#define FONT_CANCEL_BUTTON 33
+#define FONT_OK_BUTTON 34
+
+/* This menu only ever gets created once */
+/** \todo The memory claimed for this menu should
+ * probably be released at some point */
+static wimp_menu *default_menu;
+
+static const char *font_names[PLOT_FONT_FAMILY_COUNT] = {
+ "Sans-serif",
+ "Serif",
+ "Monospace",
+ "Cursive",
+ "Fantasy"
+};
+
+static void ro_gui_options_fonts_default(wimp_pointer *pointer);
+static bool ro_gui_options_fonts_ok(wimp_w w);
+static bool ro_gui_options_fonts_init_menu(void);
+
+bool ro_gui_options_fonts_initialise(wimp_w w)
+{
+ /* set the current values */
+ ro_gui_set_icon_decimal(w, FONT_DEFAULT_SIZE, nsoption_int(font_size), 1);
+ ro_gui_set_icon_decimal(w, FONT_MINIMUM_SIZE, nsoption_int(font_min_size), 1);
+ ro_gui_set_icon_string(w, FONT_SANS_FIELD, nsoption_charp(font_sans), true);
+ ro_gui_set_icon_string(w, FONT_SERIF_FIELD, nsoption_charp(font_serif), true);
+ ro_gui_set_icon_string(w, FONT_MONOSPACE_FIELD, nsoption_charp(font_mono), true);
+ ro_gui_set_icon_string(w, FONT_CURSIVE_FIELD, nsoption_charp(font_cursive), true);
+ ro_gui_set_icon_string(w, FONT_FANTASY_FIELD, nsoption_charp(font_fantasy), true);
+ ro_gui_set_icon_string(w, FONT_DEFAULT_FIELD,
+ font_names[nsoption_int(font_default)], true);
+
+ if (!ro_gui_options_fonts_init_menu())
+ return false;
+
+ /* initialise all functions for a newly created window */
+ ro_gui_wimp_event_register_menu_gright(w, FONT_SANS_FIELD,
+ FONT_SANS_MENU, rufl_family_menu);
+ ro_gui_wimp_event_register_menu_gright(w, FONT_SERIF_FIELD,
+ FONT_SERIF_MENU, rufl_family_menu);
+ ro_gui_wimp_event_register_menu_gright(w, FONT_MONOSPACE_FIELD,
+ FONT_MONOSPACE_MENU, rufl_family_menu);
+ ro_gui_wimp_event_register_menu_gright(w, FONT_CURSIVE_FIELD,
+ FONT_CURSIVE_MENU, rufl_family_menu);
+ ro_gui_wimp_event_register_menu_gright(w, FONT_FANTASY_FIELD,
+ FONT_FANTASY_MENU, rufl_family_menu);
+ ro_gui_wimp_event_register_menu_gright(w, FONT_DEFAULT_FIELD,
+ FONT_DEFAULT_MENU, default_menu);
+ ro_gui_wimp_event_register_numeric_field(w, FONT_DEFAULT_SIZE,
+ FONT_DEFAULT_INC, FONT_DEFAULT_DEC, 50, 1000, 1, 1);
+ ro_gui_wimp_event_register_numeric_field(w, FONT_MINIMUM_SIZE,
+ FONT_MINIMUM_INC, FONT_MINIMUM_DEC, 10, 500, 1, 1);
+ ro_gui_wimp_event_register_button(w, FONT_DEFAULT_BUTTON,
+ ro_gui_options_fonts_default);
+ ro_gui_wimp_event_register_cancel(w, FONT_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, FONT_OK_BUTTON,
+ ro_gui_options_fonts_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpFontConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+void ro_gui_options_fonts_default(wimp_pointer *pointer)
+{
+ const char *fallback = nsfont_fallback_font();
+
+ /* set the default values */
+ ro_gui_set_icon_decimal(pointer->w, FONT_DEFAULT_SIZE, 128, 1);
+ ro_gui_set_icon_decimal(pointer->w, FONT_MINIMUM_SIZE, 85, 1);
+ ro_gui_set_icon_string(pointer->w, FONT_SANS_FIELD,
+ nsfont_exists("Homerton") ? "Homerton" : fallback, true);
+ ro_gui_set_icon_string(pointer->w, FONT_SERIF_FIELD,
+ nsfont_exists("Trinity") ? "Trinity" : fallback, true);
+ ro_gui_set_icon_string(pointer->w, FONT_MONOSPACE_FIELD,
+ nsfont_exists("Corpus") ? "Corpus" : fallback, true);
+ ro_gui_set_icon_string(pointer->w, FONT_CURSIVE_FIELD,
+ nsfont_exists("Churchill") ? "Churchill" : fallback, true);
+ ro_gui_set_icon_string(pointer->w, FONT_FANTASY_FIELD,
+ nsfont_exists("Sassoon") ? "Sassoon" : fallback, true);
+ ro_gui_set_icon_string(pointer->w, FONT_DEFAULT_FIELD,
+ font_names[0], true);
+}
+
+bool ro_gui_options_fonts_ok(wimp_w w)
+{
+ unsigned int i;
+
+ nsoption_set_int(font_size,
+ ro_gui_get_icon_decimal(w, FONT_DEFAULT_SIZE, 1));
+
+ nsoption_set_int(font_min_size,
+ ro_gui_get_icon_decimal(w, FONT_MINIMUM_SIZE, 1));
+
+ if (nsoption_int(font_size) < nsoption_int(font_min_size)) {
+ nsoption_set_int(font_size, nsoption_int(font_min_size));
+ ro_gui_set_icon_decimal(w, FONT_DEFAULT_SIZE, nsoption_int(font_size), 1);
+
+}
+
+ nsoption_set_charp(font_sans,
+ strdup(ro_gui_get_icon_string(w, FONT_SANS_FIELD)));
+
+ nsoption_set_charp(font_serif,
+ strdup(ro_gui_get_icon_string(w, FONT_SERIF_FIELD)));
+
+ nsoption_set_charp(font_mono,
+ strdup(ro_gui_get_icon_string(w, FONT_MONOSPACE_FIELD)));
+
+ nsoption_set_charp(font_cursive,
+ strdup(ro_gui_get_icon_string(w, FONT_CURSIVE_FIELD)));
+
+ nsoption_set_charp(font_fantasy,
+ strdup(ro_gui_get_icon_string(w, FONT_FANTASY_FIELD)));
+
+ for (i = 0; i != 5; i++) {
+ if (!strcmp(font_names[i], ro_gui_get_icon_string(w,
+ FONT_DEFAULT_FIELD)))
+ break;
+ }
+ if (i == 5)
+ /* this should never happen, but still */
+ i = 0;
+
+ nsoption_set_int(font_default, i);
+
+ ro_gui_save_options();
+ return true;
+}
+
+bool ro_gui_options_fonts_init_menu(void)
+{
+ unsigned int i;
+
+ if (default_menu)
+ /* Already exists */
+ return true;
+
+ default_menu = malloc(wimp_SIZEOF_MENU(5));
+ if (!default_menu) {
+ ro_warn_user("NoMemory", 0);
+ return false;
+ }
+ default_menu->title_data.indirected_text.text =
+ (char *) messages_get("DefaultFonts");
+ ro_gui_menu_init_structure(default_menu, 5);
+ for (i = 0; i < 5; i++) {
+ default_menu->entries[i].data.indirected_text.text =
+ (char *) font_names[i];
+ default_menu->entries[i].data.indirected_text.size =
+ strlen(font_names[i]);
+ }
+ return true;
+}
diff --git a/frontends/riscos/configure/con_home.c b/frontends/riscos/configure/con_home.c
new file mode 100644
index 000000000..ea8e243ed
--- /dev/null
+++ b/frontends/riscos/configure/con_home.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2005 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+
+#include "riscos/gui.h"
+#include "riscos/menus.h"
+#include "riscos/url_suggest.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/configure.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+
+#define HOME_URL_FIELD 3
+#define HOME_URL_GRIGHT 4
+#define HOME_OPEN_STARTUP 5
+#define HOME_DEFAULT_BUTTON 6
+#define HOME_CANCEL_BUTTON 7
+#define HOME_OK_BUTTON 8
+
+static void ro_gui_options_home_default(wimp_pointer *pointer);
+static bool ro_gui_options_home_ok(wimp_w w);
+static bool ro_gui_options_home_menu_prepare(wimp_w w, wimp_i i,
+ wimp_menu *menu, wimp_pointer *pointer);
+
+bool ro_gui_options_home_initialise(wimp_w w)
+{
+ /* set the current values */
+ ro_gui_set_icon_string(w, HOME_URL_FIELD,
+ nsoption_charp(homepage_url) ?
+ nsoption_charp(homepage_url) : "", true);
+
+ ro_gui_set_icon_selected_state(w, HOME_OPEN_STARTUP,
+ nsoption_bool(open_browser_at_startup));
+
+ ro_gui_set_icon_shaded_state(w,
+ HOME_URL_GRIGHT, !ro_gui_url_suggest_prepare_menu());
+
+ /* initialise all functions for a newly created window */
+ ro_gui_wimp_event_register_menu_gright(w, HOME_URL_FIELD,
+ HOME_URL_GRIGHT, ro_gui_url_suggest_menu);
+ ro_gui_wimp_event_register_checkbox(w, HOME_OPEN_STARTUP);
+ ro_gui_wimp_event_register_button(w, HOME_DEFAULT_BUTTON,
+ ro_gui_options_home_default);
+ ro_gui_wimp_event_register_cancel(w, HOME_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, HOME_OK_BUTTON,
+ ro_gui_options_home_ok);
+ ro_gui_wimp_event_register_menu_prepare(w,
+ ro_gui_options_home_menu_prepare);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpHomeConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+void ro_gui_options_home_default(wimp_pointer *pointer)
+{
+ /* set the default values */
+ ro_gui_set_icon_string(pointer->w, HOME_URL_FIELD, "", true);
+ ro_gui_set_icon_selected_state(pointer->w, HOME_OPEN_STARTUP, false);
+}
+
+bool ro_gui_options_home_ok(wimp_w w)
+{
+ nsoption_set_charp(homepage_url,
+ strdup(ro_gui_get_icon_string(w, HOME_URL_FIELD)));
+
+ nsoption_set_bool(open_browser_at_startup,
+ ro_gui_get_icon_selected_state(w, HOME_OPEN_STARTUP));
+
+ ro_gui_save_options();
+ return true;
+}
+
+
+/**
+ * Callback to prepare menus in the Configure Home dialog. At present, this
+ * only has to handle the URL Suggestion pop-up.
+ *
+ * \param w The window handle owning the menu.
+ * \param i The icon handle owning the menu.
+ * \param *menu The menu to be prepared.
+ * \param *pointer The associated mouse click event block, or NULL
+ * on an Adjust-click re-opening.
+ * \return true if the event was handled; false if not.
+ */
+
+bool ro_gui_options_home_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
+ wimp_pointer *pointer)
+{
+ if (menu != ro_gui_url_suggest_menu || i != HOME_URL_GRIGHT)
+ return false;
+
+ if (pointer != NULL)
+ ro_gui_url_suggest_prepare_menu();
+
+ return true;
+}
diff --git a/frontends/riscos/configure/con_image.c b/frontends/riscos/configure/con_image.c
new file mode 100644
index 000000000..49dd4f76d
--- /dev/null
+++ b/frontends/riscos/configure/con_image.c
@@ -0,0 +1,269 @@
+/*
+ * Copyright 2006 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include <swis.h>
+#include <oslib/osspriteop.h>
+#include <oslib/wimp.h>
+
+#include "utils/nsoption.h"
+#include "utils/log.h"
+
+#include "riscos/gui.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+#include "riscos/menus.h"
+#include "riscos/tinct.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+
+
+#define IMAGE_FOREGROUND_FIELD 3
+#define IMAGE_FOREGROUND_MENU 4
+#define IMAGE_BACKGROUND_FIELD 6
+#define IMAGE_BACKGROUND_MENU 7
+#define IMAGE_CURRENT_DISPLAY 8
+#define IMAGE_SPEED_TEXT 11
+#define IMAGE_SPEED_FIELD 12
+#define IMAGE_SPEED_DEC 13
+#define IMAGE_SPEED_INC 14
+#define IMAGE_SPEED_CS 15
+#define IMAGE_DISABLE_ANIMATION 16
+#define IMAGE_DEFAULT_BUTTON 17
+#define IMAGE_CANCEL_BUTTON 18
+#define IMAGE_OK_BUTTON 19
+
+static bool ro_gui_options_image_click(wimp_pointer *pointer);
+static bool ro_gui_options_image_ok(wimp_w w);
+static void ro_gui_options_image_redraw(wimp_draw *redraw);
+static bool ro_gui_options_image_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a);
+static void ro_gui_options_image_read(wimp_w w, unsigned int *bg,
+ unsigned int *fg);
+static void ro_gui_options_update_shading(wimp_w w);
+
+static osspriteop_area *example_images;
+int example_users = 0;
+unsigned int tinct_options[] = {tinct_USE_OS_SPRITE_OP, 0, tinct_DITHER,
+ tinct_ERROR_DIFFUSE};
+
+bool ro_gui_options_image_initialise(wimp_w w)
+{
+ int i;
+
+ /* load the sprite file */
+ if (example_users == 0) {
+ char pathname[256];
+ snprintf(pathname, 256, "%s.Resources.Image", NETSURF_DIR);
+ pathname[255] = '\0';
+ example_images = ro_gui_load_sprite_file(pathname);
+ if (!example_images)
+ return false;
+ }
+ example_users++;
+
+ /* set the current values */
+ for (i = 0; (i < 4); i++) {
+ if ((unsigned int)nsoption_int(plot_fg_quality) == tinct_options[i])
+ ro_gui_set_icon_string(w, IMAGE_FOREGROUND_FIELD,
+ image_quality_menu->entries[i].
+ data.indirected_text.text, true);
+ if ((unsigned int)nsoption_int(plot_bg_quality) == tinct_options[i])
+ ro_gui_set_icon_string(w, IMAGE_BACKGROUND_FIELD,
+ image_quality_menu->entries[i].
+ data.indirected_text.text, true);
+ }
+ ro_gui_set_icon_decimal(w, IMAGE_SPEED_FIELD,
+ nsoption_int(minimum_gif_delay), 2);
+ ro_gui_set_icon_selected_state(w, IMAGE_DISABLE_ANIMATION,
+ !nsoption_bool(animate_images));
+ ro_gui_options_update_shading(w);
+
+ /* register icons */
+ ro_gui_wimp_event_register_menu_gright(w, IMAGE_FOREGROUND_FIELD,
+ IMAGE_FOREGROUND_MENU, image_quality_menu);
+ ro_gui_wimp_event_register_menu_gright(w, IMAGE_BACKGROUND_FIELD,
+ IMAGE_BACKGROUND_MENU, image_quality_menu);
+ ro_gui_wimp_event_register_text_field(w, IMAGE_SPEED_TEXT);
+ ro_gui_wimp_event_register_numeric_field(w, IMAGE_SPEED_FIELD,
+ IMAGE_SPEED_INC, IMAGE_SPEED_DEC, 0, 6000, 10, 2);
+ ro_gui_wimp_event_register_checkbox(w, IMAGE_DISABLE_ANIMATION);
+ ro_gui_wimp_event_register_text_field(w, IMAGE_SPEED_CS);
+ ro_gui_wimp_event_register_redraw_window(w,
+ ro_gui_options_image_redraw);
+ ro_gui_wimp_event_register_mouse_click(w,
+ ro_gui_options_image_click);
+ ro_gui_wimp_event_register_menu_selection(w,
+ ro_gui_options_image_update);
+ ro_gui_wimp_event_register_cancel(w, IMAGE_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, IMAGE_OK_BUTTON,
+ ro_gui_options_image_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpImageConfig");
+ ro_gui_wimp_event_memorise(w);
+
+ return true;
+}
+
+void ro_gui_options_image_finalise(wimp_w w)
+{
+ example_users--;
+ if (example_users == 0) {
+ free(example_images);
+ example_images = NULL;
+ }
+ ro_gui_wimp_event_finalise(w);
+}
+
+bool ro_gui_options_image_update(wimp_w w, wimp_i i, wimp_menu *m,
+ wimp_selection *s, menu_action a)
+{
+ ro_gui_redraw_icon(w, IMAGE_CURRENT_DISPLAY);
+
+ return true;
+}
+
+void ro_gui_options_image_redraw(wimp_draw *redraw)
+{
+ osbool more;
+ os_error *error;
+ wimp_icon_state icon_state;
+ osspriteop_header *bg = NULL, *fg = NULL;
+ unsigned int bg_tinct = 0, fg_tinct = 0;
+
+ /* get the icon location */
+ icon_state.w = redraw->w;
+ icon_state.i = IMAGE_CURRENT_DISPLAY;
+ error = xwimp_get_icon_state(&icon_state);
+ if (error) {
+ LOG("xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("MenuError", error->errmess);
+ return;
+ }
+
+ /* find the sprites */
+ if (example_images) {
+ ro_gui_options_image_read(redraw->w, &bg_tinct, &fg_tinct);
+ fg_tinct |= 0xeeeeee00;
+ xosspriteop_select_sprite(osspriteop_USER_AREA,
+ example_images, (osspriteop_id)"img_bg", &bg);
+ xosspriteop_select_sprite(osspriteop_USER_AREA,
+ example_images, (osspriteop_id)"img_fg", &fg);
+ }
+
+ /* perform the redraw */
+ more = wimp_redraw_window(redraw);
+ while (more) {
+ int origin_x, origin_y;
+ origin_x = redraw->box.x0 - redraw->xscroll +
+ icon_state.icon.extent.x0 + 2;
+ origin_y = redraw->box.y1 - redraw->yscroll +
+ icon_state.icon.extent.y0 + 2;
+ if (bg)
+ _swix(Tinct_Plot, _INR(2,4) | _IN(7),
+ bg, origin_x, origin_y, bg_tinct);
+ if (fg)
+ _swix(Tinct_PlotAlpha, _INR(2,4) | _IN(7),
+ fg, origin_x, origin_y, fg_tinct);
+ more = wimp_get_rectangle(redraw);
+ }
+}
+
+void ro_gui_options_image_read(wimp_w w, unsigned int *bg, unsigned int *fg)
+{
+ const char *text;
+ int i;
+
+ text = ro_gui_get_icon_string(w, IMAGE_FOREGROUND_FIELD);
+ for (i = 0; i < 4; i++)
+ if (!strcmp(text, image_quality_menu->entries[i].
+ data.indirected_text.text))
+ *fg = tinct_options[i];
+
+ text = ro_gui_get_icon_string(w, IMAGE_BACKGROUND_FIELD);
+ for (i = 0; i < 4; i++)
+ if (!strcmp(text, image_quality_menu->entries[i].
+ data.indirected_text.text))
+ *bg = tinct_options[i];
+}
+
+bool ro_gui_options_image_click(wimp_pointer *pointer)
+{
+ unsigned int old_fg, old_bg, bg, fg;
+
+ ro_gui_options_image_read(pointer->w, &old_bg, &old_fg);
+ switch (pointer->i) {
+ case IMAGE_DEFAULT_BUTTON:
+ ro_gui_set_icon_string(pointer->w,
+ IMAGE_FOREGROUND_FIELD,
+ image_quality_menu->entries[3].
+ data.indirected_text.text, true);
+ ro_gui_set_icon_string(pointer->w,
+ IMAGE_BACKGROUND_FIELD,
+ image_quality_menu->entries[2].
+ data.indirected_text.text, true);
+ ro_gui_set_icon_decimal(pointer->w, IMAGE_SPEED_FIELD,
+ 10, 2);
+ ro_gui_set_icon_selected_state(pointer->w,
+ IMAGE_DISABLE_ANIMATION, false);
+ case IMAGE_DISABLE_ANIMATION:
+ ro_gui_options_update_shading(pointer->w);
+ break;
+ case IMAGE_CANCEL_BUTTON:
+ ro_gui_wimp_event_restore(pointer->w);
+ break;
+ default:
+ return false;
+ }
+
+ ro_gui_options_image_read(pointer->w, &bg, &fg);
+ if ((bg != old_bg) || (fg != old_fg))
+ ro_gui_options_image_update(pointer->w, pointer->i,
+ NULL, NULL, NO_ACTION);
+
+ return false;
+}
+
+void ro_gui_options_update_shading(wimp_w w)
+{
+ bool shaded;
+
+ shaded = ro_gui_get_icon_selected_state(w, IMAGE_DISABLE_ANIMATION);
+ ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_TEXT, shaded);
+ ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_FIELD, shaded);
+ ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_DEC, shaded);
+ ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_INC, shaded);
+ ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_CS, shaded);
+}
+
+bool ro_gui_options_image_ok(wimp_w w)
+{
+ ro_gui_options_image_read(w,
+ (unsigned int *)&nsoption_int(plot_bg_quality),
+ (unsigned int *)&nsoption_int(plot_fg_quality));
+
+ nsoption_set_int(minimum_gif_delay,
+ ro_gui_get_icon_decimal(w, IMAGE_SPEED_FIELD, 2));
+
+ nsoption_set_bool(animate_images,
+ !ro_gui_get_icon_selected_state(w,
+ IMAGE_DISABLE_ANIMATION));
+ ro_gui_save_options();
+
+ return true;
+}
diff --git a/frontends/riscos/configure/con_inter.c b/frontends/riscos/configure/con_inter.c
new file mode 100644
index 000000000..7ab912c54
--- /dev/null
+++ b/frontends/riscos/configure/con_inter.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2006 Adrian Lees <adrianl@users.sourceforge.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+
+#include "utils/nsoption.h"
+
+#include "riscos/gui.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/configure.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+
+#define INTERFACE_STRIP_EXTNS_OPTION 2
+#define INTERFACE_CONFIRM_OVWR_OPTION 3
+#define INTERFACE_URL_COMPLETE_OPTION 6
+#define INTERFACE_HISTORY_TOOLTIP_OPTION 7
+#define INTERFACE_THUMBNAIL_ICONISE_OPTION 10
+#define INTERFACE_DEFAULT_BUTTON 11
+#define INTERFACE_CANCEL_BUTTON 12
+#define INTERFACE_OK_BUTTON 13
+#define INTERFACE_USE_EXTERNAL_HOTLIST 16
+#define INTERFACE_EXTERNAL_HOTLIST_APP 18
+
+
+static bool ro_gui_options_interface_click(wimp_pointer *pointer);
+static void ro_gui_options_interface_default(wimp_pointer *pointer);
+static bool ro_gui_options_interface_ok(wimp_w w);
+
+bool ro_gui_options_interface_initialise(wimp_w w)
+{
+ /* set the current values */
+ ro_gui_set_icon_selected_state(w, INTERFACE_STRIP_EXTNS_OPTION,
+ nsoption_bool(strip_extensions));
+ ro_gui_set_icon_selected_state(w, INTERFACE_CONFIRM_OVWR_OPTION,
+ nsoption_bool(confirm_overwrite));
+ ro_gui_set_icon_selected_state(w, INTERFACE_URL_COMPLETE_OPTION,
+ nsoption_bool(url_suggestion));
+ ro_gui_set_icon_selected_state(w, INTERFACE_HISTORY_TOOLTIP_OPTION,
+ nsoption_bool(history_tooltip));
+ ro_gui_set_icon_selected_state(w, INTERFACE_THUMBNAIL_ICONISE_OPTION,
+ nsoption_bool(thumbnail_iconise));
+ ro_gui_set_icon_selected_state(w, INTERFACE_USE_EXTERNAL_HOTLIST,
+ nsoption_bool(external_hotlists));
+ ro_gui_set_icon_string(w, INTERFACE_EXTERNAL_HOTLIST_APP,
+ (nsoption_charp(external_hotlist_app)) ?
+ nsoption_charp(external_hotlist_app) : "", false);
+
+ ro_gui_set_icon_shaded_state(w, INTERFACE_EXTERNAL_HOTLIST_APP,
+ !nsoption_bool(external_hotlists));
+
+ /* initialise all functions for a newly created window */
+ ro_gui_wimp_event_register_mouse_click(w,
+ ro_gui_options_interface_click);
+ ro_gui_wimp_event_register_button(w, INTERFACE_DEFAULT_BUTTON,
+ ro_gui_options_interface_default);
+ ro_gui_wimp_event_register_cancel(w, INTERFACE_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, INTERFACE_OK_BUTTON,
+ ro_gui_options_interface_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpInterfaceConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+
+bool ro_gui_options_interface_click(wimp_pointer *pointer)
+{
+ bool shaded;
+
+ switch (pointer->i) {
+ case INTERFACE_USE_EXTERNAL_HOTLIST:
+ shaded = !ro_gui_get_icon_selected_state(pointer->w,
+ INTERFACE_USE_EXTERNAL_HOTLIST);
+ ro_gui_set_icon_shaded_state(pointer->w,
+ INTERFACE_EXTERNAL_HOTLIST_APP, shaded);
+ return false;
+ break;
+ }
+ return false;
+}
+
+
+
+void ro_gui_options_interface_default(wimp_pointer *pointer)
+{
+ ro_gui_set_icon_selected_state(pointer->w,
+ INTERFACE_STRIP_EXTNS_OPTION, true);
+ ro_gui_set_icon_selected_state(pointer->w,
+ INTERFACE_CONFIRM_OVWR_OPTION, true);
+ ro_gui_set_icon_selected_state(pointer->w,
+ INTERFACE_URL_COMPLETE_OPTION, true);
+ ro_gui_set_icon_selected_state(pointer->w,
+ INTERFACE_HISTORY_TOOLTIP_OPTION, true);
+ ro_gui_set_icon_selected_state(pointer->w,
+ INTERFACE_THUMBNAIL_ICONISE_OPTION, true);
+ ro_gui_set_icon_selected_state(pointer->w,
+ INTERFACE_USE_EXTERNAL_HOTLIST, false);
+ ro_gui_set_icon_string(pointer->w, INTERFACE_EXTERNAL_HOTLIST_APP,
+ "", false);
+}
+
+bool ro_gui_options_interface_ok(wimp_w w)
+{
+ nsoption_set_bool(strip_extensions,
+ ro_gui_get_icon_selected_state(w,
+ INTERFACE_STRIP_EXTNS_OPTION));
+ nsoption_set_bool(confirm_overwrite,
+ ro_gui_get_icon_selected_state(w,
+ INTERFACE_CONFIRM_OVWR_OPTION));
+ nsoption_set_bool(url_suggestion,
+ ro_gui_get_icon_selected_state(w,
+ INTERFACE_URL_COMPLETE_OPTION));
+ nsoption_set_bool(history_tooltip,
+ ro_gui_get_icon_selected_state(w,
+ INTERFACE_HISTORY_TOOLTIP_OPTION));
+ nsoption_set_bool(thumbnail_iconise,
+ ro_gui_get_icon_selected_state(w,
+ INTERFACE_THUMBNAIL_ICONISE_OPTION));
+ nsoption_set_bool(external_hotlists,
+ ro_gui_get_icon_selected_state(w,
+ INTERFACE_USE_EXTERNAL_HOTLIST));
+ nsoption_set_charp(external_hotlist_app,
+ strdup(ro_gui_get_icon_string(w,
+ INTERFACE_EXTERNAL_HOTLIST_APP)));
+
+ ro_gui_save_options();
+ return true;
+}
diff --git a/frontends/riscos/configure/con_language.c b/frontends/riscos/configure/con_language.c
new file mode 100644
index 000000000..2030c65c0
--- /dev/null
+++ b/frontends/riscos/configure/con_language.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
+ * Copyright 2006 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+
+#include "riscos/gui.h"
+#include "riscos/menus.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/configure.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+
+
+#define LANGUAGE_INTERFACE_FIELD 3
+#define LANGUAGE_INTERFACE_GRIGHT 4
+#define LANGUAGE_WEB_PAGES_FIELD 6
+#define LANGUAGE_WEB_PAGES_GRIGHT 7
+#define LANGUAGE_DEFAULT_BUTTON 8
+#define LANGUAGE_CANCEL_BUTTON 9
+#define LANGUAGE_OK_BUTTON 10
+
+static void ro_gui_options_language_default(wimp_pointer *pointer);
+static bool ro_gui_options_language_ok(wimp_w w);
+static const char *ro_gui_options_language_name(const char *code);
+
+bool ro_gui_options_language_initialise(wimp_w w)
+{
+ /* set the current values */
+ ro_gui_set_icon_string(w, LANGUAGE_INTERFACE_FIELD,
+ ro_gui_options_language_name(nsoption_charp(language) ?
+ nsoption_charp(language) : "en"), true);
+ ro_gui_set_icon_string(w, LANGUAGE_WEB_PAGES_FIELD,
+ ro_gui_options_language_name(nsoption_charp(accept_language) ?
+ nsoption_charp(accept_language) : "en"), true);
+
+ /* initialise all functions for a newly created window */
+ ro_gui_wimp_event_register_menu_gright(w, LANGUAGE_INTERFACE_FIELD,
+ LANGUAGE_INTERFACE_GRIGHT, languages_menu);
+ ro_gui_wimp_event_register_menu_gright(w, LANGUAGE_WEB_PAGES_FIELD,
+ LANGUAGE_WEB_PAGES_GRIGHT, languages_menu);
+ ro_gui_wimp_event_register_button(w, LANGUAGE_DEFAULT_BUTTON,
+ ro_gui_options_language_default);
+ ro_gui_wimp_event_register_cancel(w, LANGUAGE_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, LANGUAGE_OK_BUTTON,
+ ro_gui_options_language_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpLanguageConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+void ro_gui_options_language_default(wimp_pointer *pointer)
+{
+ const char *code;
+
+ code = ro_gui_default_language();
+ ro_gui_set_icon_string(pointer->w, LANGUAGE_INTERFACE_FIELD,
+ ro_gui_options_language_name(code ?
+ code : "en"), true);
+ ro_gui_set_icon_string(pointer->w, LANGUAGE_WEB_PAGES_FIELD,
+ ro_gui_options_language_name(code ?
+ code : "en"), true);
+}
+
+bool ro_gui_options_language_ok(wimp_w w)
+{
+ const char *code;
+ char *temp;
+
+ code = ro_gui_menu_find_menu_entry_key(languages_menu,
+ ro_gui_get_icon_string(w, LANGUAGE_INTERFACE_FIELD));
+ if (code) {
+ code += 5; /* skip 'lang_' */
+ if ((!nsoption_charp(language)) ||
+ (strcmp(nsoption_charp(language), code))) {
+ temp = strdup(code);
+ if (temp) {
+ nsoption_set_charp(language, temp);
+ } else {
+ LOG("No memory to duplicate language code");
+ ro_warn_user("NoMemory", 0);
+ }
+ }
+ }
+ code = ro_gui_menu_find_menu_entry_key(languages_menu,
+ ro_gui_get_icon_string(w, LANGUAGE_WEB_PAGES_FIELD));
+ if (code) {
+ code += 5; /* skip 'lang_' */
+ if ((!nsoption_charp(accept_language)) ||
+ (strcmp(nsoption_charp(accept_language), code))) {
+ temp = strdup(code);
+ if (temp) {
+ nsoption_set_charp(accept_language,temp);
+ } else {
+ LOG("No memory to duplicate language code");
+ ro_warn_user("NoMemory", 0);
+ }
+ }
+ }
+ ro_gui_save_options();
+ return true;
+}
+
+
+/**
+ * Convert a 2-letter ISO language code to the language name.
+ *
+ * \param code 2-letter ISO language code
+ * \return language name, or code if unknown
+ */
+const char *ro_gui_options_language_name(const char *code)
+{
+ char key[] = "lang_xx";
+ key[5] = code[0];
+ key[6] = code[1];
+
+ return messages_get(key);
+}
diff --git a/frontends/riscos/configure/con_secure.c b/frontends/riscos/configure/con_secure.c
new file mode 100644
index 000000000..9c8a846c3
--- /dev/null
+++ b/frontends/riscos/configure/con_secure.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+
+#include "utils/nsoption.h"
+#include "utils/messages.h"
+
+#include "riscos/gui.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/configure.h"
+#include "riscos/configure/configure.h"
+#include "riscos/dialog.h"
+
+#define SECURITY_REFERRER 2
+#define SECURITY_DURATION_FIELD 6
+#define SECURITY_DURATION_INC 7
+#define SECURITY_DURATION_DEC 8
+#define SECURITY_DEFAULT_BUTTON 10
+#define SECURITY_CANCEL_BUTTON 11
+#define SECURITY_OK_BUTTON 12
+
+static void ro_gui_options_security_default(wimp_pointer *pointer);
+static bool ro_gui_options_security_ok(wimp_w w);
+
+bool ro_gui_options_security_initialise(wimp_w w)
+{
+ /* set the current values */
+ ro_gui_set_icon_selected_state(w, SECURITY_REFERRER,
+ nsoption_bool(send_referer));
+ ro_gui_set_icon_integer(w, SECURITY_DURATION_FIELD,
+ nsoption_int(expire_url));
+
+ /* initialise all functions for a newly created window */
+ ro_gui_wimp_event_register_checkbox(w, SECURITY_REFERRER);
+ ro_gui_wimp_event_register_numeric_field(w, SECURITY_DURATION_FIELD,
+ SECURITY_DURATION_DEC, SECURITY_DURATION_INC,
+ 0, 365, 1, 0);
+ ro_gui_wimp_event_register_button(w, SECURITY_DEFAULT_BUTTON,
+ ro_gui_options_security_default);
+ ro_gui_wimp_event_register_cancel(w, SECURITY_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, SECURITY_OK_BUTTON,
+ ro_gui_options_security_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpSecurityConfig");
+ ro_gui_wimp_event_memorise(w);
+ return true;
+
+}
+
+void ro_gui_options_security_default(wimp_pointer *pointer)
+{
+ /* set the default values */
+ ro_gui_set_icon_integer(pointer->w, SECURITY_DURATION_FIELD, 28);
+ ro_gui_set_icon_selected_state(pointer->w, SECURITY_REFERRER, true);
+}
+
+bool ro_gui_options_security_ok(wimp_w w)
+{
+ nsoption_set_bool(send_referer,
+ ro_gui_get_icon_selected_state(w, SECURITY_REFERRER));
+
+ nsoption_set_int(expire_url,
+ ro_gui_get_icon_decimal(w,SECURITY_DURATION_FIELD, 0));
+
+ ro_gui_save_options();
+ return true;
+}
diff --git a/frontends/riscos/configure/con_theme.c b/frontends/riscos/configure/con_theme.c
new file mode 100644
index 000000000..fb0d3dfb0
--- /dev/null
+++ b/frontends/riscos/configure/con_theme.c
@@ -0,0 +1,420 @@
+/*
+ * Copyright 2006 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <oslib/osspriteop.h>
+#include <oslib/wimp.h>
+#include <oslib/wimpspriteop.h>
+
+#include "utils/config.h"
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+
+#include "riscos/gui.h"
+#include "riscos/configure/configure.h"
+#include "riscos/configure.h"
+#include "riscos/dialog.h"
+#include "riscos/menus.h"
+#include "riscos/theme.h"
+#include "riscos/toolbar.h"
+#include "riscos/url_complete.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/wimputils.h"
+
+
+#define THEME_PANE_AREA 0
+#define THEME_DEFAULT_BUTTON 2
+#define THEME_CANCEL_BUTTON 3
+#define THEME_OK_BUTTON 4
+
+struct toolbar_display {
+ struct toolbar *toolbar;
+ struct theme_descriptor *descriptor;
+ int icon_number;
+ struct toolbar_display *next;
+};
+
+static wimp_window theme_pane_definition = {
+ {0, 0, 16, 16},
+ 0,
+ 0,
+ wimp_TOP,
+ wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_VSCROLL | wimp_WINDOW_AUTO_REDRAW,
+ wimp_COLOUR_BLACK,
+ wimp_COLOUR_LIGHT_GREY,
+ wimp_COLOUR_LIGHT_GREY,
+ wimp_COLOUR_VERY_LIGHT_GREY,
+ wimp_COLOUR_DARK_GREY,
+ wimp_COLOUR_MID_LIGHT_GREY,
+ wimp_COLOUR_CREAM,
+ 0,
+ {0, -16384, 16384, 0},
+ wimp_ICON_TEXT | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED,
+ wimp_BUTTON_CLICK << wimp_ICON_BUTTON_TYPE_SHIFT,
+ wimpspriteop_AREA,
+ 1,
+ 1,
+ {""},
+ 0,
+ {}
+};
+
+
+static wimp_w theme_pane;
+static struct theme_descriptor *theme_list = NULL;
+static struct toolbar_display *toolbars = NULL;
+static char theme_radio_validation[] = "Sradiooff,radioon";
+static char theme_null_validation[] = "";
+static char theme_line_validation[] = "R2";
+
+static bool ro_gui_options_theme_ok(wimp_w w);
+static bool ro_gui_options_theme_click(wimp_pointer *pointer);
+static void ro_gui_options_theme_load(void);
+static void ro_gui_options_theme_free(void);
+
+bool ro_gui_options_theme_initialise(wimp_w w)
+{
+ wimp_window_state state;
+ wimp_icon_state icon_state;
+ os_error *error;
+ struct theme_descriptor *theme_choice;
+ struct toolbar_display *toolbar;
+
+ /* only allow one instance for now*/
+ if (theme_pane)
+ return false;
+ error = xwimp_create_window(&theme_pane_definition, &theme_pane);
+ if (error) {
+ LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ return false;
+ }
+ state.w = w;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ return false;
+ }
+ icon_state.w = w;
+ icon_state.i = THEME_PANE_AREA;
+ error = xwimp_get_icon_state(&icon_state);
+ if (error) {
+ LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ return false;
+ }
+ state.w = theme_pane;
+ state.visible.x1 = state.visible.x0 + icon_state.icon.extent.x1 - 16 -
+ ro_get_vscroll_width(theme_pane);
+ state.visible.x0 += icon_state.icon.extent.x0 + 16;
+ state.visible.y0 = state.visible.y1 + icon_state.icon.extent.y0 + 16;
+ state.visible.y1 += icon_state.icon.extent.y1 - 28;
+ LOG("Y0 = %i, y1 = %i", icon_state.icon.extent.y0, icon_state.icon.extent.y1);
+ error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state), w,
+ wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
+ << wimp_CHILD_XORIGIN_SHIFT |
+ wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
+ << wimp_CHILD_YORIGIN_SHIFT |
+ wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
+ << wimp_CHILD_LS_EDGE_SHIFT |
+ wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
+ << wimp_CHILD_BS_EDGE_SHIFT |
+ wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
+ << wimp_CHILD_RS_EDGE_SHIFT |
+ wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
+ << wimp_CHILD_TS_EDGE_SHIFT);
+ if (error) {
+ LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess);
+ return false;
+ }
+
+ /* load themes */
+ ro_gui_options_theme_load();
+
+ /* set the current selection */
+ theme_choice = ro_gui_theme_find(nsoption_charp(theme));
+ if (!theme_choice)
+ theme_choice = ro_gui_theme_find("Aletheia");
+ for (toolbar = toolbars; toolbar; toolbar = toolbar->next)
+ ro_gui_set_icon_selected_state(theme_pane, toolbar->icon_number,
+ (toolbar->descriptor == theme_choice));
+ ro_gui_wimp_event_memorise(theme_pane);
+ ro_gui_wimp_event_set_help_prefix(theme_pane, "HelpThemePConfig");
+
+ ro_gui_wimp_event_register_mouse_click(w, ro_gui_options_theme_click);
+ ro_gui_wimp_event_register_cancel(w, THEME_CANCEL_BUTTON);
+ ro_gui_wimp_event_register_ok(w, THEME_OK_BUTTON,
+ ro_gui_options_theme_ok);
+ ro_gui_wimp_event_set_help_prefix(w, "HelpThemeConfig");
+ ro_gui_wimp_event_memorise(w);
+
+ return true;
+}
+
+void ro_gui_options_theme_finalise(wimp_w w)
+{
+ ro_gui_options_theme_free();
+ if (theme_pane) {
+ os_error *error;
+ ro_gui_wimp_event_finalise(theme_pane);
+ error = xwimp_delete_window(theme_pane);
+ if (error) {
+ LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ }
+ theme_pane = 0;
+ }
+ ro_gui_wimp_event_finalise(w);
+}
+
+bool ro_gui_options_theme_ok(wimp_w w)
+{
+ struct toolbar_display *toolbar;
+ struct theme_descriptor *theme_new = NULL;
+
+ /* find the current selection */
+ for (toolbar = toolbars; toolbar; toolbar = toolbar->next) {
+ if (ro_gui_get_icon_selected_state(theme_pane, toolbar->icon_number)) {
+ theme_new = toolbar->descriptor;
+ break;
+ }
+ }
+
+ /* set the options */
+ if (theme_new) {
+ nsoption_set_charp(theme, strdup(theme_new->leafname));
+ ro_gui_theme_apply(theme_new);
+ } else {
+ nsoption_set_charp(theme, NULL);
+ }
+ ro_gui_save_options();
+
+ /* store the pane status */
+ ro_gui_wimp_event_memorise(theme_pane);
+ return true;
+}
+
+bool ro_gui_options_theme_click(wimp_pointer *pointer)
+{
+ struct theme_descriptor *theme_default;
+ struct toolbar_display *toolbar;
+
+ switch (pointer->i) {
+ case THEME_DEFAULT_BUTTON:
+ theme_default = ro_gui_theme_find("Aletheia");
+ for (toolbar = toolbars; toolbar; toolbar = toolbar->next)
+ ro_gui_set_icon_selected_state(theme_pane,
+ toolbar->icon_number,
+ (toolbar->descriptor == theme_default));
+ break;
+ case THEME_CANCEL_BUTTON:
+ ro_gui_wimp_event_restore(theme_pane);
+ break;
+ case THEME_OK_BUTTON:
+ ro_gui_wimp_event_memorise(theme_pane);
+ break;
+ }
+ return false;
+}
+
+void ro_gui_options_theme_load(void)
+{
+ os_error *error;
+ os_box extent = { 0, 0, 0, 0 };
+ struct theme_descriptor *descriptor;
+ struct toolbar_display *link;
+ struct toolbar_display *toolbar_display;
+ struct toolbar *toolbar;
+ wimp_icon_create new_icon;
+ wimp_window_state state;
+ int parent_width, nested_y, min_extent, base_extent;
+ int *radio_icons, *radio_set;
+ int theme_count;
+
+ /* delete our old list and get/open a new one */
+ ro_gui_options_theme_free();
+ theme_list = ro_gui_theme_get_available();
+ ro_gui_theme_open(theme_list, true);
+
+ /* create toolbars for each theme */
+ theme_count = 0;
+ descriptor = theme_list;
+ while (descriptor != NULL) {
+ /* try to create a toolbar */
+ toolbar = ro_toolbar_create(descriptor, NULL,
+ THEME_STYLE_BROWSER_TOOLBAR,
+ TOOLBAR_FLAGS_DISPLAY, NULL, NULL, NULL);
+ if (toolbar != NULL) {
+ ro_toolbar_add_buttons(toolbar, brower_toolbar_buttons,
+ nsoption_charp(toolbar_browser));
+ ro_toolbar_add_url(toolbar);
+ ro_toolbar_add_throbber(toolbar);
+ ro_toolbar_rebuild(toolbar);
+ toolbar_display = calloc(sizeof(struct toolbar_display), 1);
+ if (!toolbar_display) {
+ LOG("No memory for calloc()");
+ ro_warn_user("NoMemory", 0);
+ return;
+ }
+ toolbar_display->toolbar = toolbar;
+ toolbar_display->descriptor = descriptor;
+ if (!toolbars) {
+ toolbars = toolbar_display;
+ } else {
+ link = toolbars;
+ while (link->next) link = link->next;
+ link->next = toolbar_display;
+ }
+ theme_count++;
+ }
+ descriptor = descriptor->next;
+ }
+
+ /* nest the toolbars */
+ state.w = theme_pane;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return;
+ }
+
+ parent_width = state.visible.x1 - state.visible.x0;
+ min_extent = state.visible.y0 - state.visible.y1;
+ nested_y = 0;
+ base_extent = state.visible.y1 - state.yscroll;
+ extent.x1 = parent_width;
+ link = toolbars;
+ new_icon.w = theme_pane;
+ new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
+ wimp_ICON_VCENTRED |
+ (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
+ (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT);
+ while (link) {
+ /* update the toolbar */
+ int item_height = 44 + 44 + 16;
+ if (link->next) item_height += 16;
+ ro_toolbar_process(link->toolbar, parent_width, false);
+ extent.y0 = nested_y -
+ ro_toolbar_height(link->toolbar) -
+ item_height;
+ if (link->next) extent.y0 -= 16;
+ if (extent.y0 > min_extent) extent.y0 = min_extent;
+ xwimp_set_extent(theme_pane, &extent);
+
+ /* create the descriptor icons and separator line */
+ new_icon.icon.extent.x0 = 8;
+ new_icon.icon.extent.x1 = parent_width - 8;
+ new_icon.icon.flags &= ~wimp_ICON_BORDER;
+ new_icon.icon.flags |= wimp_ICON_SPRITE;
+ new_icon.icon.extent.y1 = nested_y -
+ ro_toolbar_height(link->toolbar) - 8;
+ new_icon.icon.extent.y0 = nested_y -
+ ro_toolbar_height(link->toolbar) - 52;
+ new_icon.icon.data.indirected_text_and_sprite.text =
+ (char *)&link->descriptor->name;
+ new_icon.icon.data.indirected_text_and_sprite.size =
+ strlen(link->descriptor->name) + 1;
+ new_icon.icon.data.indirected_text_and_sprite.validation =
+ theme_radio_validation;
+ new_icon.icon.flags |= (wimp_BUTTON_RADIO <<
+ wimp_ICON_BUTTON_TYPE_SHIFT);
+ xwimp_create_icon(&new_icon, &link->icon_number);
+ new_icon.icon.flags &= ~wimp_ICON_SPRITE;
+ new_icon.icon.extent.x0 = 52;
+ new_icon.icon.extent.y1 -= 44;
+ new_icon.icon.extent.y0 -= 44;
+ new_icon.icon.data.indirected_text.text =
+ (char *)&link->descriptor->author;
+ new_icon.icon.data.indirected_text.size =
+ strlen(link->descriptor->author) + 1;
+ new_icon.icon.data.indirected_text.validation =
+ theme_null_validation;
+ new_icon.icon.flags &= ~(wimp_BUTTON_RADIO <<
+ wimp_ICON_BUTTON_TYPE_SHIFT);
+ xwimp_create_icon(&new_icon, 0);
+ if (link->next) {
+ new_icon.icon.flags |= wimp_ICON_BORDER;
+ new_icon.icon.extent.x0 = -8;
+ new_icon.icon.extent.x1 = parent_width + 8;
+ new_icon.icon.extent.y1 -= 52;
+ new_icon.icon.extent.y0 = new_icon.icon.extent.y1 - 8;
+ new_icon.icon.data.indirected_text.text =
+ theme_null_validation;
+ new_icon.icon.data.indirected_text.validation =
+ theme_line_validation;
+ new_icon.icon.data.indirected_text.size = 1;
+ xwimp_create_icon(&new_icon, 0);
+ }
+
+ /* nest the toolbar window */
+ state.w = ro_toolbar_get_window(link->toolbar);
+ state.yscroll = 0;
+ state.visible.y1 = nested_y + base_extent;
+ state.visible.y0 = state.visible.y1 -
+ ro_toolbar_height(link->toolbar) + 2;
+ xwimp_open_window_nested(PTR_WIMP_OPEN(&state), theme_pane,
+ wimp_CHILD_LINKS_PARENT_WORK_AREA
+ << wimp_CHILD_BS_EDGE_SHIFT |
+ wimp_CHILD_LINKS_PARENT_WORK_AREA
+ << wimp_CHILD_TS_EDGE_SHIFT);
+
+ /* continue processing */
+ nested_y -= ro_toolbar_height(link->toolbar) +
+ item_height;
+ link = link->next;
+ }
+
+ /* set the icons as radios */
+ radio_icons = (int *)calloc(theme_count + 1, sizeof(int));
+ radio_set = radio_icons;
+ for (link = toolbars; link; link = link->next)
+ *radio_set++ = link->icon_number;
+ *radio_set = -1;
+ ro_gui_wimp_event_register_radio(theme_pane, radio_icons);
+
+ /* update our display */
+ xwimp_force_redraw(theme_pane, 0, -16384, 16384, 16384);
+}
+
+void ro_gui_options_theme_free(void)
+{
+ struct toolbar_display *toolbar;
+ struct toolbar_display *next_toolbar;
+
+ /* free all our toolbars */
+ next_toolbar = toolbars;
+ while ((toolbar = next_toolbar) != NULL) {
+ next_toolbar = toolbar->next;
+ xwimp_delete_icon(theme_pane, toolbar->icon_number);
+ xwimp_delete_icon(theme_pane, toolbar->icon_number + 1);
+ if (next_toolbar)
+ xwimp_delete_icon(theme_pane,
+ toolbar->icon_number + 2);
+ ro_toolbar_destroy(toolbar->toolbar);
+ free(toolbar);
+ }
+ toolbars = NULL;
+
+ /* close all our themes */
+ if (theme_list)
+ ro_gui_theme_close(theme_list, true);
+ theme_list = NULL;
+}
diff --git a/frontends/riscos/configure/configure.h b/frontends/riscos/configure/configure.h
new file mode 100644
index 000000000..e5cdb392e
--- /dev/null
+++ b/frontends/riscos/configure/configure.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 Richard Wilson <info@tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Automated RISC OS WIMP event handling (interface).
+ */
+
+
+#ifndef _NETSURF_RISCOS_OPTIONS_CONFIGURE_H_
+#define _NETSURF_RISCOS_OPTIONS_CONFIGURE_H_
+
+#include <stdbool.h>
+#include "oslib/wimp.h"
+
+bool ro_gui_options_cache_initialise(wimp_w w);
+bool ro_gui_options_connection_initialise(wimp_w w);
+bool ro_gui_options_content_initialise(wimp_w w);
+bool ro_gui_options_fonts_initialise(wimp_w w);
+bool ro_gui_options_home_initialise(wimp_w w);
+bool ro_gui_options_image_initialise(wimp_w w);
+void ro_gui_options_image_finalise(wimp_w w);
+bool ro_gui_options_interface_initialise(wimp_w w);
+bool ro_gui_options_language_initialise(wimp_w w);
+bool ro_gui_options_security_initialise(wimp_w w);
+bool ro_gui_options_theme_initialise(wimp_w w);
+void ro_gui_options_theme_finalise(wimp_w w);
+
+#endif