summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
Diffstat (limited to 'riscos')
-rw-r--r--riscos/bitmap.c10
-rw-r--r--riscos/buffer.c4
-rw-r--r--riscos/configure/con_cache.c8
-rw-r--r--riscos/configure/con_connect.c82
-rw-r--r--riscos/configure/con_content.c27
-rw-r--r--riscos/configure/con_fonts.c61
-rw-r--r--riscos/configure/con_home.c18
-rw-r--r--riscos/configure/con_image.c25
-rw-r--r--riscos/configure/con_inter.c58
-rw-r--r--riscos/configure/con_language.c22
-rw-r--r--riscos/configure/con_memory.c17
-rw-r--r--riscos/configure/con_secure.c14
-rw-r--r--riscos/configure/con_theme.c15
-rw-r--r--riscos/cookies.c8
-rw-r--r--riscos/dialog.c4
-rw-r--r--riscos/download.c8
-rw-r--r--riscos/font.c39
-rw-r--r--riscos/global_history.c8
-rw-r--r--riscos/gui.c139
-rw-r--r--riscos/help.c4
-rw-r--r--riscos/history.c4
-rw-r--r--riscos/hotlist.c19
-rw-r--r--riscos/iconbar.c12
-rw-r--r--riscos/image.c6
-rw-r--r--riscos/menus.c2
-rw-r--r--riscos/options.h235
-rw-r--r--riscos/save.c8
-rw-r--r--riscos/system_colour.c56
-rw-r--r--riscos/theme.c6
-rw-r--r--riscos/theme_install.c7
-rw-r--r--riscos/thumbnail.c2
-rw-r--r--riscos/toolbar.c2
-rw-r--r--riscos/url_complete.c4
-rw-r--r--riscos/window.c126
34 files changed, 534 insertions, 526 deletions
diff --git a/riscos/bitmap.c b/riscos/bitmap.c
index 12198fe13..257d7ced2 100644
--- a/riscos/bitmap.c
+++ b/riscos/bitmap.c
@@ -39,7 +39,7 @@
#include "image/bitmap.h"
#include "riscos/bitmap.h"
#include "riscos/image.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/palettes.h"
#include "riscos/content-handlers/sprite.h"
#include "riscos/tinct.h"
@@ -138,7 +138,7 @@ void bitmap_initialise_memory(void)
available_memory = free_slot;
/* calculate our memory block sizes */
- if (option_image_memory_direct == -1) {
+ if (nsoption_int(image_memory_direct) == -1) {
/* claim 25% of free memory - min 256KB, max 32768KB */
direct_size = available_memory / 4;
if (direct_size < (256 << 10))
@@ -146,9 +146,9 @@ void bitmap_initialise_memory(void)
if (direct_size > (32768 << 10))
direct_size = (32768 << 10);
} else {
- direct_size = (option_image_memory_direct << 10);
+ direct_size = (nsoption_int(image_memory_direct) << 10);
}
- if (option_image_memory_compressed == -1) {
+ if (nsoption_int(image_memory_compressed) == -1) {
/* claim 10% of free memory - min 256KB, max 4192KB */
compressed_size = available_memory / 10;
if (compressed_size < (256 << 10))
@@ -156,7 +156,7 @@ void bitmap_initialise_memory(void)
if (compressed_size > (4192 << 10))
compressed_size = (4192 << 10);
} else {
- compressed_size = (option_image_memory_compressed << 10);
+ compressed_size = (nsoption_int(image_memory_compressed) << 10);
}
/* set our values. No fixed buffers here, ho hum. */
diff --git a/riscos/buffer.c b/riscos/buffer.c
index d135d3d84..6eec8bf7e 100644
--- a/riscos/buffer.c
+++ b/riscos/buffer.c
@@ -27,7 +27,7 @@
#include "oslib/wimpreadsysinfo.h"
#include "riscos/buffer.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/tinct.h"
#include "riscos/wimp.h"
#include "riscos/wimputils.h"
@@ -274,7 +274,7 @@ void ro_gui_buffer_close(void)
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
(char *)(buffer + 1),
clipping.x0, clipping.y0,
- option_fg_plot_style);
+ nsoption_int(fg_plot_style));
else
xosspriteop_put_sprite_user_coords(osspriteop_PTR,
buffer, (osspriteop_id)(buffer + 1),
diff --git a/riscos/configure/con_cache.c b/riscos/configure/con_cache.c
index 45a952cdb..cd211236e 100644
--- a/riscos/configure/con_cache.c
+++ b/riscos/configure/con_cache.c
@@ -21,7 +21,6 @@
#include "desktop/options.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/configure.h"
@@ -45,7 +44,7 @@ bool ro_gui_options_cache_initialise(wimp_w w)
{
/* set the current values */
ro_gui_set_icon_decimal(w, CACHE_MEMORY_SIZE,
- (option_memory_cache_size * 10) >> 20, 1);
+ (nsoption_int(memory_cache_size) * 10) >> 20, 1);
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_numeric_field(w, CACHE_MEMORY_SIZE,
@@ -74,8 +73,9 @@ bool ro_gui_options_cache_click(wimp_pointer *pointer)
bool ro_gui_options_cache_ok(wimp_w w)
{
- option_memory_cache_size = (((ro_gui_get_icon_decimal(w,
- CACHE_MEMORY_SIZE, 1) + 1) << 20) - 1) / 10;
+ nsoption_set_int(memory_cache_size,
+ (((ro_gui_get_icon_decimal(w,
+ CACHE_MEMORY_SIZE, 1) + 1) << 20) - 1) / 10);
ro_gui_save_options();
return true;
diff --git a/riscos/configure/con_connect.c b/riscos/configure/con_connect.c
index fd74155bd..c47e90419 100644
--- a/riscos/configure/con_connect.c
+++ b/riscos/configure/con_connect.c
@@ -24,7 +24,6 @@
#include "riscos/configure/configure.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
#include "riscos/tinct.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
@@ -55,7 +54,7 @@
#define CONNECTION_CANCEL_BUTTON 28
#define CONNECTION_OK_BUTTON 29
-#define http_proxy_type (option_http_proxy ? (option_http_proxy_auth + 1) : 0)
+#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);
@@ -68,27 +67,27 @@ bool ro_gui_options_connection_initialise(wimp_w w)
int proxy_type;
/* set the current values */
- proxy_type = (option_http_proxy ? (option_http_proxy_auth + 1) : 0);
+ 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,
- option_http_proxy_host ?
- option_http_proxy_host : "", true);
+ nsoption_charp(http_proxy_host) ?
+ nsoption_charp(http_proxy_host) : "", true);
ro_gui_set_icon_integer(w, CONNECTION_PROXY_PORT,
- option_http_proxy_port);
+ nsoption_int(http_proxy_port));
ro_gui_set_icon_string(w, CONNECTION_PROXY_USERNAME,
- option_http_proxy_auth_user ?
- option_http_proxy_auth_user : "", true);
+ nsoption_charp(http_proxy_auth_user) ?
+ nsoption_charp(http_proxy_auth_user) : "", true);
ro_gui_set_icon_string(w, CONNECTION_PROXY_PASSWORD,
- option_http_proxy_auth_pass ?
- option_http_proxy_auth_pass : "", true);
+ nsoption_charp(http_proxy_auth_pass) ?
+ nsoption_charp(http_proxy_auth_pass) : "", true);
ro_gui_set_icon_integer(w, CONNECTION_MAX_FETCH_FIELD,
- option_max_fetchers);
+ nsoption_int(max_fetchers));
ro_gui_set_icon_integer(w, CONNECTION_HOST_FETCH_FIELD,
- option_max_fetchers_per_host);
+ nsoption_int(max_fetchers_per_host));
ro_gui_set_icon_integer(w, CONNECTION_CACHE_FETCH_FIELD,
- option_max_cached_fetch_handles);
+ nsoption_int(max_cached_fetch_handles));
ro_gui_options_connection_update(w, -1, NULL, NULL, NO_ACTION);
/* register icons */
@@ -181,32 +180,39 @@ 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)
- option_http_proxy = false;
- else {
- option_http_proxy = true;
- option_http_proxy_auth = proxy_type - 1;
+ 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);
}
- if (option_http_proxy_host)
- free(option_http_proxy_host);
- option_http_proxy_host = strdup(ro_gui_get_icon_string(w,
- CONNECTION_PROXY_HOST));
- option_http_proxy_port = ro_gui_get_icon_decimal(w,
- CONNECTION_PROXY_PORT, 0);
- if (option_http_proxy_auth_user)
- free(option_http_proxy_auth_user);
- option_http_proxy_auth_user = strdup(ro_gui_get_icon_string(w,
- CONNECTION_PROXY_USERNAME));
- if (option_http_proxy_auth_pass)
- free(option_http_proxy_auth_pass);
- option_http_proxy_auth_pass = strdup(ro_gui_get_icon_string(w,
- CONNECTION_PROXY_PASSWORD));
- option_max_fetchers = ro_gui_get_icon_decimal(w,
- CONNECTION_MAX_FETCH_FIELD, 0);
- option_max_fetchers_per_host = ro_gui_get_icon_decimal(w,
- CONNECTION_HOST_FETCH_FIELD, 0);
- option_max_cached_fetch_handles = ro_gui_get_icon_decimal(w,
- CONNECTION_CACHE_FETCH_FIELD, 0);
+
+ 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/riscos/configure/con_content.c b/riscos/configure/con_content.c
index bda7b6d57..a8e9f78b4 100644
--- a/riscos/configure/con_content.c
+++ b/riscos/configure/con_content.c
@@ -20,7 +20,6 @@
#include "desktop/options.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/configure.h"
@@ -44,13 +43,13 @@ bool ro_gui_options_content_initialise(wimp_w w)
{
/* set the current values */
ro_gui_set_icon_selected_state(w, CONTENT_BLOCK_ADVERTISEMENTS,
- option_block_ads);
+ nsoption_bool(block_ads));
ro_gui_set_icon_selected_state(w, CONTENT_BLOCK_POPUPS,
- option_block_popups);
+ nsoption_bool(block_popups));
ro_gui_set_icon_selected_state(w, CONTENT_NO_PLUGINS,
- option_no_plugins);
+ nsoption_bool(no_plugins));
ro_gui_set_icon_selected_state(w, CONTENT_TARGET_BLANK,
- option_target_blank);
+ nsoption_bool(target_blank));
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_checkbox(w, CONTENT_BLOCK_ADVERTISEMENTS);
@@ -83,14 +82,16 @@ void ro_gui_options_content_default(wimp_pointer *pointer)
bool ro_gui_options_content_ok(wimp_w w)
{
- option_block_ads = ro_gui_get_icon_selected_state(w,
- CONTENT_BLOCK_ADVERTISEMENTS);
- option_block_popups = ro_gui_get_icon_selected_state(w,
- CONTENT_BLOCK_POPUPS);
- option_no_plugins = ro_gui_get_icon_selected_state(w,
- CONTENT_NO_PLUGINS);
- option_target_blank = ro_gui_get_icon_selected_state(w,
- CONTENT_TARGET_BLANK);
+ nsoption_set_bool(block_ads,
+ 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));
ro_gui_save_options();
return true;
diff --git a/riscos/configure/con_fonts.c b/riscos/configure/con_fonts.c
index b420b26e5..0bd13ce2a 100644
--- a/riscos/configure/con_fonts.c
+++ b/riscos/configure/con_fonts.c
@@ -23,7 +23,6 @@
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/configure.h"
@@ -74,15 +73,15 @@ 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, option_font_size, 1);
- ro_gui_set_icon_decimal(w, FONT_MINIMUM_SIZE, option_font_min_size, 1);
- ro_gui_set_icon_string(w, FONT_SANS_FIELD, option_font_sans, true);
- ro_gui_set_icon_string(w, FONT_SERIF_FIELD, option_font_serif, true);
- ro_gui_set_icon_string(w, FONT_MONOSPACE_FIELD, option_font_mono, true);
- ro_gui_set_icon_string(w, FONT_CURSIVE_FIELD, option_font_cursive, true);
- ro_gui_set_icon_string(w, FONT_FANTASY_FIELD, option_font_fantasy, true);
+ 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[option_font_default], true);
+ font_names[nsoption_int(font_default)], true);
if (!ro_gui_options_fonts_init_menu())
return false;
@@ -140,22 +139,32 @@ bool ro_gui_options_fonts_ok(wimp_w w)
{
unsigned int i;
- option_font_size = ro_gui_get_icon_decimal(w, FONT_DEFAULT_SIZE, 1);
- option_font_min_size = ro_gui_get_icon_decimal(w, FONT_MINIMUM_SIZE, 1);
- if (option_font_size < option_font_min_size) {
- option_font_size = option_font_min_size;
- ro_gui_set_icon_decimal(w, FONT_DEFAULT_SIZE, option_font_size, 1);
- }
- free(option_font_sans);
- option_font_sans = strdup(ro_gui_get_icon_string(w, FONT_SANS_FIELD));
- free(option_font_serif);
- option_font_serif = strdup(ro_gui_get_icon_string(w, FONT_SERIF_FIELD));
- free(option_font_mono);
- option_font_mono = strdup(ro_gui_get_icon_string(w, FONT_MONOSPACE_FIELD));
- free(option_font_cursive);
- option_font_cursive = strdup(ro_gui_get_icon_string(w, FONT_CURSIVE_FIELD));
- free(option_font_fantasy);
- option_font_fantasy = strdup(ro_gui_get_icon_string(w, FONT_FANTASY_FIELD));
+ 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,
@@ -166,7 +175,7 @@ bool ro_gui_options_fonts_ok(wimp_w w)
/* this should never happen, but still */
i = 0;
- option_font_default = i;
+ nsoption_set_int(font_default, i);
ro_gui_save_options();
return true;
diff --git a/riscos/configure/con_home.c b/riscos/configure/con_home.c
index 65cc4e39a..9e966b96e 100644
--- a/riscos/configure/con_home.c
+++ b/riscos/configure/con_home.c
@@ -21,7 +21,6 @@
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
#include "riscos/url_suggest.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
@@ -46,9 +45,12 @@ bool ro_gui_options_home_initialise(wimp_w w)
{
/* set the current values */
ro_gui_set_icon_string(w, HOME_URL_FIELD,
- option_homepage_url ? option_homepage_url : "", true);
+ nsoption_charp(homepage_url) ?
+ nsoption_charp(homepage_url) : "", true);
+
ro_gui_set_icon_selected_state(w, HOME_OPEN_STARTUP,
- option_open_browser_at_startup);
+ nsoption_bool(open_browser_at_startup));
+
ro_gui_set_icon_shaded_state(w,
HOME_URL_GRIGHT, !ro_gui_url_suggest_prepare_menu());
@@ -78,11 +80,11 @@ void ro_gui_options_home_default(wimp_pointer *pointer)
bool ro_gui_options_home_ok(wimp_w w)
{
- if (option_homepage_url)
- free(option_homepage_url);
- option_homepage_url = strdup(ro_gui_get_icon_string(w, HOME_URL_FIELD));
- option_open_browser_at_startup = ro_gui_get_icon_selected_state(w,
- HOME_OPEN_STARTUP);
+ 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;
diff --git a/riscos/configure/con_image.c b/riscos/configure/con_image.c
index 1cb29a267..8617e6d2e 100644
--- a/riscos/configure/con_image.c
+++ b/riscos/configure/con_image.c
@@ -24,7 +24,6 @@
#include "riscos/configure/configure.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
#include "riscos/tinct.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
@@ -78,19 +77,19 @@ bool ro_gui_options_image_initialise(wimp_w w)
/* set the current values */
for (i = 0; (i < 4); i++) {
- if ((unsigned int)option_fg_plot_style == tinct_options[i])
+ if ((unsigned int)nsoption_int(fg_plot_style) == 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)option_bg_plot_style == tinct_options[i])
+ if ((unsigned int)nsoption_int(bg_plot_style) == 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,
- option_minimum_gif_delay, 2);
+ nsoption_int(minimum_gif_delay), 2);
ro_gui_set_icon_selected_state(w, IMAGE_DISABLE_ANIMATION,
- !option_animate_images);
+ !nsoption_bool(animate_images));
ro_gui_options_update_shading(w);
/* register icons */
@@ -252,12 +251,16 @@ void ro_gui_options_update_shading(wimp_w w)
bool ro_gui_options_image_ok(wimp_w w)
{
- ro_gui_options_image_read(w, (unsigned int *) &option_bg_plot_style,
- (unsigned int *) &option_fg_plot_style);
- option_minimum_gif_delay = ro_gui_get_icon_decimal(w,
- IMAGE_SPEED_FIELD, 2);
- option_animate_images = !ro_gui_get_icon_selected_state(w,
- IMAGE_DISABLE_ANIMATION);
+ ro_gui_options_image_read(w,
+ (unsigned int *)&nsoption_int(bg_plot_style),
+ (unsigned int *)&nsoption_int(fg_plot_style));
+
+ 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/riscos/configure/con_inter.c b/riscos/configure/con_inter.c
index 570ba5782..be2114b05 100644
--- a/riscos/configure/con_inter.c
+++ b/riscos/configure/con_inter.c
@@ -19,7 +19,7 @@
#include <stdbool.h>
#include "riscos/dialog.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/configure.h"
@@ -46,23 +46,23 @@ bool ro_gui_options_interface_initialise(wimp_w w)
{
/* set the current values */
ro_gui_set_icon_selected_state(w, INTERFACE_STRIP_EXTNS_OPTION,
- option_strip_extensions);
+ nsoption_bool(strip_extensions));
ro_gui_set_icon_selected_state(w, INTERFACE_CONFIRM_OVWR_OPTION,
- option_confirm_overwrite);
+ nsoption_bool(confirm_overwrite));
ro_gui_set_icon_selected_state(w, INTERFACE_URL_COMPLETE_OPTION,
- option_url_suggestion);
+ nsoption_bool(url_suggestion));
ro_gui_set_icon_selected_state(w, INTERFACE_HISTORY_TOOLTIP_OPTION,
- option_history_tooltip);
+ nsoption_bool(history_tooltip));
ro_gui_set_icon_selected_state(w, INTERFACE_THUMBNAIL_ICONISE_OPTION,
- option_thumbnail_iconise);
+ nsoption_bool(thumbnail_iconise));
ro_gui_set_icon_selected_state(w, INTERFACE_USE_EXTERNAL_HOTLIST,
- option_external_hotlists);
+ nsoption_bool(external_hotlists));
ro_gui_set_icon_string(w, INTERFACE_EXTERNAL_HOTLIST_APP,
- (option_external_hotlist_app) ?
- option_external_hotlist_app : "", false);
+ (nsoption_charp(external_hotlist_app)) ?
+ nsoption_charp(external_hotlist_app) : "", false);
ro_gui_set_icon_shaded_state(w, INTERFACE_EXTERNAL_HOTLIST_APP,
- !option_external_hotlists);
+ !nsoption_bool(external_hotlists));
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_mouse_click(w,
@@ -117,23 +117,27 @@ void ro_gui_options_interface_default(wimp_pointer *pointer)
bool ro_gui_options_interface_ok(wimp_w w)
{
- option_strip_extensions = ro_gui_get_icon_selected_state(w,
- INTERFACE_STRIP_EXTNS_OPTION);
- option_confirm_overwrite = ro_gui_get_icon_selected_state(w,
- INTERFACE_CONFIRM_OVWR_OPTION);
- option_url_suggestion = ro_gui_get_icon_selected_state(w,
- INTERFACE_URL_COMPLETE_OPTION);
- option_history_tooltip = ro_gui_get_icon_selected_state(w,
- INTERFACE_HISTORY_TOOLTIP_OPTION);
- option_thumbnail_iconise = ro_gui_get_icon_selected_state(w,
- INTERFACE_THUMBNAIL_ICONISE_OPTION);
- option_external_hotlists = ro_gui_get_icon_selected_state(w,
- INTERFACE_USE_EXTERNAL_HOTLIST);
- if (option_external_hotlist_app)
- free(option_external_hotlist_app);
- option_external_hotlist_app =
- strdup(ro_gui_get_icon_string(w,
- INTERFACE_EXTERNAL_HOTLIST_APP));
+ 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/riscos/configure/con_language.c b/riscos/configure/con_language.c
index 4e8490055..be40b1c39 100644
--- a/riscos/configure/con_language.c
+++ b/riscos/configure/con_language.c
@@ -22,7 +22,6 @@
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/configure.h"
@@ -48,11 +47,11 @@ 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(option_language ?
- option_language : "en"), true);
+ 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(option_accept_language ?
- option_accept_language : "en"), true);
+ 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,
@@ -92,11 +91,11 @@ bool ro_gui_options_language_ok(wimp_w w)
ro_gui_get_icon_string(w, LANGUAGE_INTERFACE_FIELD));
if (code) {
code += 5; /* skip 'lang_' */
- if ((!option_language) || (strcmp(option_language, code))) {
+ if ((!nsoption_charp(language)) ||
+ (strcmp(nsoption_charp(language), code))) {
temp = strdup(code);
if (temp) {
- free(option_language);
- option_language = temp;
+ nsoption_set_charp(language, temp);
} else {
LOG(("No memory to duplicate language code"));
warn_user("NoMemory", 0);
@@ -107,12 +106,11 @@ bool ro_gui_options_language_ok(wimp_w w)
ro_gui_get_icon_string(w, LANGUAGE_WEB_PAGES_FIELD));
if (code) {
code += 5; /* skip 'lang_' */
- if ((!option_accept_language) ||
- (strcmp(option_accept_language, code))) {
+ if ((!nsoption_charp(accept_language)) ||
+ (strcmp(nsoption_charp(accept_language), code))) {
temp = strdup(code);
if (temp) {
- free(option_accept_language);
- option_accept_language = temp;
+ nsoption_set_charp(accept_language,temp);
} else {
LOG(("No memory to duplicate language code"));
warn_user("NoMemory", 0);
diff --git a/riscos/configure/con_memory.c b/riscos/configure/con_memory.c
index 65d9bed26..5bf890597 100644
--- a/riscos/configure/con_memory.c
+++ b/riscos/configure/con_memory.c
@@ -19,7 +19,6 @@
#include <stdbool.h>
#include "desktop/options.h"
#include "riscos/bitmap.h"
-#include "riscos/options.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/dialog.h"
@@ -52,9 +51,9 @@ bool ro_gui_options_memory_initialise(wimp_w w)
ro_gui_set_icon_decimal(w, MEMORY_COMPRESSED_FIELD,
(bitmap_compressed_size * 10) >> 20, 1);
ro_gui_set_icon_selected_state(w, MEMORY_DIRECT_AUTO,
- (option_image_memory_direct == -1));
+ (nsoption_int(image_memory_direct) == -1));
ro_gui_set_icon_selected_state(w, MEMORY_COMPRESSED_AUTO,
- (option_image_memory_compressed == -1));
+ (nsoption_int(image_memory_compressed) == -1));
ro_gui_options_update_shading(w);
/* register icons */
@@ -123,17 +122,17 @@ bool ro_gui_options_memory_ok(wimp_w w)
{
/* set the option values */
if (ro_gui_get_icon_selected_state(w, MEMORY_DIRECT_AUTO))
- option_image_memory_direct = -1;
+ nsoption_set_int(image_memory_direct, -1);
else
- option_image_memory_direct =
+ nsoption_set_int(image_memory_direct,
(((ro_gui_get_icon_decimal(w, MEMORY_DIRECT_FIELD, 1)
- << 10) + 1023) / 10);
+ << 10) + 1023) / 10));
if (ro_gui_get_icon_selected_state(w, MEMORY_COMPRESSED_AUTO))
- option_image_memory_compressed = -1;
+ nsoption_set_int(image_memory_compressed, -1);
else
- option_image_memory_compressed =
+ nsoption_set_int(image_memory_compressed,
(((ro_gui_get_icon_decimal(w, MEMORY_COMPRESSED_FIELD, 1)
- << 10) + 1023) / 10);
+ << 10) + 1023) / 10));
/* update the memory usage */
bitmap_initialise_memory();
ro_gui_set_icon_decimal(w, MEMORY_DIRECT_FIELD,
diff --git a/riscos/configure/con_secure.c b/riscos/configure/con_secure.c
index c3b289b45..568a03ddd 100644
--- a/riscos/configure/con_secure.c
+++ b/riscos/configure/con_secure.c
@@ -20,7 +20,6 @@
#include "desktop/options.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/configure.h"
@@ -44,9 +43,9 @@ bool ro_gui_options_security_initialise(wimp_w w)
{
/* set the current values */
ro_gui_set_icon_selected_state(w, SECURITY_REFERRER,
- option_send_referer);
+ nsoption_bool(send_referer));
ro_gui_set_icon_integer(w, SECURITY_DURATION_FIELD,
- option_expire_url);
+ nsoption_int(expire_url));
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_checkbox(w, SECURITY_REFERRER);
@@ -73,10 +72,11 @@ void ro_gui_options_security_default(wimp_pointer *pointer)
bool ro_gui_options_security_ok(wimp_w w)
{
- option_send_referer = ro_gui_get_icon_selected_state(w,
- SECURITY_REFERRER);
- option_expire_url = ro_gui_get_icon_decimal(w,
- SECURITY_DURATION_FIELD, 0);
+ 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/riscos/configure/con_theme.c b/riscos/configure/con_theme.c
index a6dc98265..b41484be0 100644
--- a/riscos/configure/con_theme.c
+++ b/riscos/configure/con_theme.c
@@ -23,11 +23,11 @@
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "utils/config.h"
+#include "desktop/options.h"
#include "riscos/configure/configure.h"
#include "riscos/configure.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
#include "riscos/theme.h"
#include "riscos/toolbar.h"
#include "riscos/url_complete.h"
@@ -151,7 +151,7 @@ bool ro_gui_options_theme_initialise(wimp_w w)
ro_gui_options_theme_load();
/* set the current selection */
- theme_choice = ro_gui_theme_find(option_theme);
+ 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)
@@ -202,13 +202,12 @@ bool ro_gui_options_theme_ok(wimp_w w)
}
/* set the options */
- if (option_theme)
- free(option_theme);
if (theme_new) {
- option_theme = strdup(theme_new->leafname);
+ nsoption_set_charp(theme, strdup(theme_new->leafname));
ro_gui_theme_apply(theme_new);
- } else
- option_theme = NULL;
+ } else {
+ nsoption_set_charp(theme, NULL);
+ }
ro_gui_save_options();
/* store the pane status */
@@ -269,7 +268,7 @@ void ro_gui_options_theme_load(void)
TOOLBAR_FLAGS_DISPLAY, NULL, NULL, NULL);
if (toolbar != NULL) {
ro_toolbar_add_buttons(toolbar, brower_toolbar_buttons,
- option_toolbar_browser);
+ nsoption_charp(toolbar_browser));
ro_toolbar_add_url(toolbar);
ro_toolbar_add_throbber(toolbar);
ro_toolbar_rebuild(toolbar);
diff --git a/riscos/cookies.c b/riscos/cookies.c
index 76c7f4673..347b43d0e 100644
--- a/riscos/cookies.c
+++ b/riscos/cookies.c
@@ -35,7 +35,7 @@
#include "riscos/cookies.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/toolbar.h"
#include "riscos/treeview.h"
#include "riscos/wimp.h"
@@ -99,7 +99,7 @@ void ro_gui_cookies_postinitialise(void)
if (cookies_window.toolbar != NULL) {
ro_toolbar_add_buttons(cookies_window.toolbar,
cookies_toolbar_buttons,
- option_toolbar_cookies);
+ nsoption_charp(toolbar_cookies));
ro_toolbar_rebuild(cookies_window.toolbar);
}
@@ -232,9 +232,7 @@ void ro_gui_cookies_toolbar_update_buttons(void)
void ro_gui_cookies_toolbar_save_buttons(char *config)
{
- if (option_toolbar_cookies != NULL)
- free(option_toolbar_cookies);
- option_toolbar_cookies = config;
+ nsoption_set_charp(toolbar_cookies, config);
ro_gui_save_options();
}
diff --git a/riscos/dialog.c b/riscos/dialog.c
index 96746329e..ab53603dc 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -41,7 +41,7 @@
#include "riscos/gui.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/save.h"
#include "riscos/sslcert.h"
#include "riscos/toolbar.h"
@@ -664,7 +664,7 @@ void ro_gui_dialog_close_persistent(wimp_w parent) {
void ro_gui_save_options(void)
{
- options_write("<NetSurf$ChoicesSave>");
+ nsoption_write("<NetSurf$ChoicesSave>");
}
bool ro_gui_dialog_zoom_apply(wimp_w w) {
diff --git a/riscos/download.c b/riscos/download.c
index eade5a176..233d19300 100644
--- a/riscos/download.c
+++ b/riscos/download.c
@@ -44,7 +44,7 @@
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "riscos/dialog.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/save.h"
#include "riscos/query.h"
#include "riscos/wimp.h"
@@ -364,7 +364,7 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
filename[i] = '_';
}
- if (option_strip_extensions && last_dot != (size_t) -1)
+ if (nsoption_bool(strip_extensions) && last_dot != (size_t) -1)
filename[last_dot] = '\0';
if (download_dir != NULL && strlen(download_dir) > 0)
@@ -881,7 +881,7 @@ bool ro_gui_download_keypress(wimp_key *key)
dw->send_dataload = false;
if (ro_gui_download_save(dw, dw->path,
- !option_confirm_overwrite) && !dw->ctx)
+ !nsoption_bool(confirm_overwrite)) && !dw->ctx)
{
/* finished already */
schedule(200, ro_gui_download_window_destroy_wrapper, dw);
@@ -967,7 +967,7 @@ void ro_gui_download_datasave_ack(wimp_message *message)
memcpy(&dw->save_message, message, sizeof(wimp_message));
if (!ro_gui_download_save(dw, message->data.data_xfer.file_name,
- !option_confirm_overwrite))
+ !nsoption_bool(confirm_overwrite)))
return;
if (!dw->ctx) {
diff --git a/riscos/font.c b/riscos/font.c
index ce9e70a99..ff9127c0b 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -31,7 +31,7 @@
#include "css/utils.h"
#include "render/font.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
@@ -94,18 +94,19 @@ void nsfont_init(void)
fallback = nsfont_fallback_font();
- nsfont_check_option(&option_font_sans, "Homerton", fallback);
- nsfont_check_option(&option_font_serif, "Trinity", fallback);
- nsfont_check_option(&option_font_mono, "Corpus", fallback);
- nsfont_check_option(&option_font_cursive, "Churchill", fallback);
- nsfont_check_option(&option_font_fantasy, "Sassoon", fallback);
-
- if (option_font_default != PLOT_FONT_FAMILY_SANS_SERIF &&
- option_font_default != PLOT_FONT_FAMILY_SERIF &&
- option_font_default != PLOT_FONT_FAMILY_MONOSPACE &&
- option_font_default != PLOT_FONT_FAMILY_CURSIVE &&
- option_font_default != PLOT_FONT_FAMILY_FANTASY)
- option_font_default = PLOT_FONT_FAMILY_SANS_SERIF;
+ nsfont_check_option(&nsoption_charp(font_sans), "Homerton", fallback);
+ nsfont_check_option(&nsoption_charp(font_serif), "Trinity", fallback);
+ nsfont_check_option(&nsoption_charp(font_mono), "Corpus", fallback);
+ nsfont_check_option(&nsoption_charp(font_cursive), "Churchill", fallback);
+ nsfont_check_option(&nsoption_charp(font_fantasy), "Sassoon", fallback);
+
+ if (nsoption_int(font_default) != PLOT_FONT_FAMILY_SANS_SERIF &&
+ nsoption_int(font_default) != PLOT_FONT_FAMILY_SERIF &&
+ nsoption_int(font_default) != PLOT_FONT_FAMILY_MONOSPACE &&
+ nsoption_int(font_default) != PLOT_FONT_FAMILY_CURSIVE &&
+ nsoption_int(font_default) != PLOT_FONT_FAMILY_FANTASY) {
+ nsoption_set_int(font_default, PLOT_FONT_FAMILY_SANS_SERIF);
+ }
}
@@ -447,22 +448,22 @@ void nsfont_read_style(const plot_font_style_t *fstyle,
switch (fstyle->family) {
case PLOT_FONT_FAMILY_SANS_SERIF:
- *font_family = option_font_sans;
+ *font_family = nsoption_charp(font_sans);
break;
case PLOT_FONT_FAMILY_SERIF:
- *font_family = option_font_serif;
+ *font_family = nsoption_charp(font_serif);
break;
case PLOT_FONT_FAMILY_MONOSPACE:
- *font_family = option_font_mono;
+ *font_family = nsoption_charp(font_mono);
break;
case PLOT_FONT_FAMILY_CURSIVE:
- *font_family = option_font_cursive;
+ *font_family = nsoption_charp(font_cursive);
break;
case PLOT_FONT_FAMILY_FANTASY:
- *font_family = option_font_fantasy;
+ *font_family = nsoption_charp(font_fantasy);
break;
default:
- *font_family = option_font_sans;
+ *font_family = nsoption_charp(font_sans);
break;
}
diff --git a/riscos/global_history.c b/riscos/global_history.c
index a6b43b863..ca51b7253 100644
--- a/riscos/global_history.c
+++ b/riscos/global_history.c
@@ -36,7 +36,7 @@
#include "riscos/global_history.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/save.h"
#include "riscos/toolbar.h"
#include "riscos/treeview.h"
@@ -102,7 +102,7 @@ void ro_gui_global_history_postinitialise(void)
if (global_history_window.toolbar != NULL) {
ro_toolbar_add_buttons(global_history_window.toolbar,
global_history_toolbar_buttons,
- option_toolbar_history);
+ nsoption_charp(toolbar_history));
ro_toolbar_rebuild(global_history_window.toolbar);
}
@@ -246,9 +246,7 @@ void ro_gui_global_history_toolbar_update_buttons(void)
void ro_gui_global_history_toolbar_save_buttons(char *config)
{
- if (option_toolbar_history != NULL)
- free(option_toolbar_history);
- option_toolbar_history = config;
+ nsoption_set_charp(toolbar_history, config);
ro_gui_save_options();
}
diff --git a/riscos/gui.c b/riscos/gui.c
index f65d89f85..11f4e1df7 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -81,7 +81,6 @@
#include "riscos/iconbar.h"
#include "riscos/menus.h"
#include "riscos/message.h"
-#include "riscos/options.h"
#include "riscos/print.h"
#include "riscos/query.h"
#include "riscos/save.h"
@@ -379,49 +378,40 @@ static void gui_init(int argc, char** argv)
}
/* Set defaults for absent option strings */
- if (!option_theme)
- option_theme = strdup("Aletheia");
- if (!option_toolbar_browser)
- option_toolbar_browser = strdup("0123|58|9");
- if (!option_toolbar_hotlist)
- option_toolbar_hotlist = strdup("40|12|3");
- if (!option_toolbar_history)
- option_toolbar_history = strdup("0|12|3");
- if (!option_toolbar_cookies)
- option_toolbar_cookies = strdup("0|12");
- if (!option_ca_bundle)
- option_ca_bundle = strdup("NetSurf:Resources.ca-bundle");
- if (!option_cookie_file)
- option_cookie_file = strdup("NetSurf:Cookies");
- if (!option_cookie_jar)
- option_cookie_jar = strdup(CHOICES_PREFIX "Cookies");
- if (!option_url_path)
- option_url_path = strdup("NetSurf:URL");
- if (!option_url_save)
- option_url_save = strdup(CHOICES_PREFIX "URL");
- if (!option_hotlist_path)
- option_hotlist_path = strdup("NetSurf:Hotlist");
- if (!option_hotlist_save)
- option_hotlist_save = strdup(CHOICES_PREFIX "Hotlist");
- if (!option_recent_path)
- option_recent_path = strdup("NetSurf:Recent");
- if (!option_recent_save)
- option_recent_save = strdup(CHOICES_PREFIX "Recent");
- if (!option_theme_path)
- option_theme_path = strdup("NetSurf:Themes");
- if (!option_theme_save)
- option_theme_save = strdup(CHOICES_PREFIX "Themes");
+ nsoption_setnull_charp(theme, strdup("Aletheia"));
+ nsoption_setnull_charp(toolbar_browser, strdup("0123|58|9"));
+ nsoption_setnull_charp(toolbar_hotlist, strdup("40|12|3"));
+ nsoption_setnull_charp(toolbar_history, strdup("0|12|3"));
+ nsoption_setnull_charp(toolbar_cookies, strdup("0|12"));
+ nsoption_setnull_charp(ca_bundle, strdup("NetSurf:Resources.ca-bundle"));
+ nsoption_setnull_charp(cookie_file, strdup("NetSurf:Cookies"));
+ nsoption_setnull_charp(cookie_jar, strdup(CHOICES_PREFIX "Cookies"));
+ nsoption_setnull_charp(url_path, strdup("NetSurf:URL"));
+ nsoption_setnull_charp(url_save, strdup(CHOICES_PREFIX "URL"));
+ nsoption_setnull_charp(hotlist_path, strdup("NetSurf:Hotlist"));
+ nsoption_setnull_charp(hotlist_save, strdup(CHOICES_PREFIX "Hotlist"));
+ nsoption_setnull_charp(recent_path, strdup("NetSurf:Recent"));
+ nsoption_setnull_charp(recent_save, strdup(CHOICES_PREFIX "Recent"));
+ nsoption_setnull_charp(theme_path, strdup("NetSurf:Themes"));
+ nsoption_setnull_charp(theme_save, strdup(CHOICES_PREFIX "Themes"));
tree_set_icon_dir(strdup("NetSurf:Resources.Icons"));
- if (!option_theme || ! option_toolbar_browser ||
- !option_toolbar_hotlist || !option_toolbar_history ||
- !option_ca_bundle || !option_cookie_file ||
- !option_cookie_jar || !option_url_path ||
- !option_url_save || !option_hotlist_path ||
- !option_hotlist_save || !option_recent_path ||
- !option_recent_save || !option_theme_path ||
- !option_theme_save)
+ if (nsoption_charp(theme) == NULL ||
+ nsoption_charp(toolbar_browser) == NULL ||
+ nsoption_charp(toolbar_hotlist) == NULL ||
+ nsoption_charp(toolbar_history) == NULL ||
+ nsoption_charp(ca_bundle) == NULL ||
+ nsoption_charp(cookie_file) == NULL ||
+ nsoption_charp(cookie_jar) == NULL ||
+ nsoption_charp(url_path) == NULL ||
+ nsoption_charp(url_save) == NULL ||
+ nsoption_charp(hotlist_path) == NULL ||
+ nsoption_charp(hotlist_save) == NULL ||
+ nsoption_charp(recent_path) == NULL ||
+ nsoption_charp(recent_save) == NULL ||
+ nsoption_charp(theme_path) == NULL ||
+ nsoption_charp(theme_save) == NULL)
die("Failed initialising string options");
/* Create our choices directories */
@@ -466,8 +456,8 @@ static void gui_init(int argc, char** argv)
bitmap_initialise_memory();
/* Load in visited URLs and Cookies */
- urldb_load(option_url_path);
- urldb_load_cookies(option_cookie_file);
+ urldb_load(nsoption_charp(url_path));
+ urldb_load_cookies(nsoption_charp(cookie_file));
/* Initialise with the wimp */
error = xwimp_initialise(wimp_VERSION_RO38, task_name,
@@ -512,7 +502,7 @@ static void gui_init(int argc, char** argv)
/* Open the templates */
if ((length = snprintf(path, sizeof(path),
"NetSurf:Resources.%s.Templates",
- option_language)) < 0 || length >= (int)sizeof(path))
+ nsoption_charp(language))) < 0 || length >= (int)sizeof(path))
die("Failed to locate Templates resource.");
error = xwimp_open_template(path);
if (error) {
@@ -565,19 +555,19 @@ void ro_gui_create_dirs(void)
ro_gui_create_dir(buf);
/* URL */
- snprintf(buf, sizeof(buf), "%s", option_url_save);
+ snprintf(buf, sizeof(buf), "%s", nsoption_charp(url_save));
ro_gui_create_dir(buf);
/* Hotlist */
- snprintf(buf, sizeof(buf), "%s", option_hotlist_save);
+ snprintf(buf, sizeof(buf), "%s", nsoption_charp(hotlist_save));
ro_gui_create_dir(buf);
/* Recent */
- snprintf(buf, sizeof(buf), "%s", option_recent_save);
+ snprintf(buf, sizeof(buf), "%s", nsoption_charp(recent_save));
ro_gui_create_dir(buf);
/* Theme */
- snprintf(buf, sizeof(buf), "%s", option_theme_save);
+ snprintf(buf, sizeof(buf), "%s", nsoption_charp(theme_save));
ro_gui_create_dir(buf);
/* and the final directory part (as theme_save is a directory) */
xosfile_create_dir(buf, 0);
@@ -611,24 +601,23 @@ void ro_gui_choose_language(void)
char path[40];
/* if option_language exists and is valid, use that */
- if (option_language) {
- if (2 < strlen(option_language))
- option_language[2] = 0;
- sprintf(path, "NetSurf:Resources.%s", option_language);
+ if (nsoption_charp(language)) {
+ if (2 < strlen(nsoption_charp(language)))
+ nsoption_charp(language)[2] = 0;
+ sprintf(path, "NetSurf:Resources.%s", nsoption_charp(language));
if (is_dir(path)) {
- if (!option_accept_language)
- option_accept_language = strdup(option_language);
+ nsoption_setnull_charp(accept_language,
+ strdup(nsoption_charp(language)));
return;
}
- free(option_language);
- option_language = 0;
+ nsoption_set_charp(language, NULL);
}
- option_language = strdup(ro_gui_default_language());
- if (!option_language)
+ nsoption_set_charp(language, strdup(ro_gui_default_language()));
+ if (nsoption_charp(language) == NULL)
die("Out of memory");
- option_accept_language = strdup(option_language);
- if (!option_accept_language)
+ nsoption_set_charp(accept_language, strdup(nsoption_charp(language)));
+ if (nsoption_charp(accept_language) == NULL)
die("Out of memory");
}
@@ -702,7 +691,7 @@ void ro_gui_check_resolvers(void)
static void gui_init2(int argc, char** argv)
{
char *url = 0;
- bool open_window = option_open_browser_at_startup;
+ bool open_window = nsoption_bool(open_browser_at_startup);
/* Complete initialisation of the treeview modules. */
@@ -762,13 +751,13 @@ static void gui_init2(int argc, char** argv)
}
}
/* get user's homepage (if configured) */
- else if (option_homepage_url && option_homepage_url[0]) {
- url = calloc(strlen(option_homepage_url) + 5, sizeof(char));
+ else if (nsoption_charp(homepage_url) && nsoption_charp(homepage_url)[0]) {
+ url = calloc(strlen(nsoption_charp(homepage_url)) + 5, sizeof(char));
if (!url) {
LOG(("malloc failed"));
die("Insufficient memory for URL");
}
- sprintf(url, "%s", option_homepage_url);
+ sprintf(url, "%s", nsoption_charp(homepage_url));
}
/* default homepage */
else {
@@ -778,7 +767,7 @@ static void gui_init2(int argc, char** argv)
die("Insufficient memory for URL");
}
snprintf(url, 80, "file:///<NetSurf$Dir>/Docs/welcome/index_%s",
- option_language);
+ nsoption_charp(language));
}
if (open_window)
@@ -807,7 +796,7 @@ int main(int argc, char** argv)
/* Load in our language-specific Messages */
if ((length = snprintf(path, sizeof(path),
"NetSurf:Resources.%s.Messages",
- option_language)) < 0 || length >= (int)sizeof(path))
+ nsoption_charp(language))) < 0 || length >= (int)sizeof(path))
die("Failed to locate Messages resource.");
messages_load(path);
messages_load("NetSurf:Resources.LangNames");
@@ -831,12 +820,12 @@ int main(int argc, char** argv)
void gui_quit(void)
{
bitmap_quit();
- urldb_save_cookies(option_cookie_jar);
- urldb_save(option_url_save);
+ urldb_save_cookies(nsoption_charp(cookie_jar));
+ urldb_save(nsoption_charp(url_save));
ro_gui_window_quit();
history_global_cleanup();
cookies_cleanup();
- hotlist_cleanup(option_hotlist_save);
+ hotlist_cleanup(nsoption_charp(hotlist_save));
sslcert_cleanup();
ro_gui_saveas_quit();
rufl_quit();
@@ -861,7 +850,7 @@ void ro_gui_signal(int sig)
xhourglass_on();
xhourglass_colours(0x0000ffff, 0x000000ff, &old_sand, &old_glass);
- options_dump(stderr);
+ nsoption_dump(stderr);
/*rufl_dump_state();*/
#ifndef __ELF__
@@ -1836,14 +1825,14 @@ void ro_msg_dataopen(wimp_message *message)
if (len < 9 || strcmp(".!NetSurf",
message->data.data_xfer.file_name + len - 9))
return;
- if (option_homepage_url && option_homepage_url[0]) {
- url = strdup(option_homepage_url);
+ if (nsoption_charp(homepage_url) && nsoption_charp(homepage_url)[0]) {
+ url = strdup(nsoption_charp(homepage_url));
} else {
url = malloc(80);
if (url)
snprintf(url, 80,
"file:///<NetSurf$Dir>/Docs/welcome/index_%s",
- option_language);
+ nsoption_charp(language));
}
if (!url)
warn_user("NoMemory", 0);
@@ -1943,7 +1932,7 @@ void ro_msg_window_info(wimp_message *message)
struct gui_window *g;
/* allow the user to turn off thumbnail icons */
- if (!option_thumbnail_iconise)
+ if (!nsoption_bool(thumbnail_iconise))
return;
wi = (wimp_full_message_window_info*)message;
@@ -2141,7 +2130,7 @@ void ro_gui_open_help_page(const char *page)
if ((length = snprintf(url, sizeof url,
"file:///<NetSurf$Dir>/Docs/%s_%s",
- page, option_language)) >= 0 &&
+ page, nsoption_charp(language))) >= 0 &&
length < (int)sizeof(url))
browser_window_create(url, NULL, 0, true, false);
}
diff --git a/riscos/help.c b/riscos/help.c
index 6a71fb1ec..ae2a2af84 100644
--- a/riscos/help.c
+++ b/riscos/help.c
@@ -35,7 +35,7 @@
#include "riscos/help.h"
#include "riscos/iconbar.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/treeview.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
@@ -106,7 +106,7 @@ void ro_gui_interactive_help_request(wimp_message *message)
int i;
/* check we aren't turned off */
- if (!option_interactive_help)
+ if (!nsoption_bool(interactive_help))
return;
/* only accept help requests */
diff --git a/riscos/history.c b/riscos/history.c
index c8094e5a0..00ff5d6ff 100644
--- a/riscos/history.c
+++ b/riscos/history.c
@@ -30,7 +30,7 @@
#include "desktop/history_core.h"
#include "desktop/plotters.h"
#include "riscos/dialog.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
@@ -183,7 +183,7 @@ void ro_gui_history_mouse_at(wimp_pointer *pointer)
/* If the mouse hasn't moved, or if we don't want tooltips, exit */
if ((mouse_x == pointer->pos.x && mouse_y == pointer->pos.y) ||
- !option_history_tooltip)
+ !nsoption_bool(history_tooltip))
return;
/* Update mouse position */
diff --git a/riscos/hotlist.c b/riscos/hotlist.c
index 532a657ca..a01b9256e 100644
--- a/riscos/hotlist.c
+++ b/riscos/hotlist.c
@@ -39,7 +39,7 @@
#include "riscos/hotlist.h"
#include "riscos/menus.h"
#include "riscos/message.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/save.h"
#include "riscos/toolbar.h"
#include "riscos/treeview.h"
@@ -123,7 +123,7 @@ void ro_gui_hotlist_postinitialise(void)
if (hotlist_window.toolbar != NULL) {
ro_toolbar_add_buttons(hotlist_window.toolbar,
hotlist_toolbar_buttons,
- option_toolbar_hotlist);
+ nsoption_charp(toolbar_hotlist));
ro_toolbar_rebuild(hotlist_window.toolbar);
}
@@ -143,7 +143,7 @@ void ro_gui_hotlist_postinitialise(void)
/* Initialise the hotlist into the tree. */
hotlist_initialise(ro_treeview_get_tree(hotlist_window.tv),
- option_hotlist_path,
+ nsoption_charp(hotlist_path),
tree_directory_icon_name);
@@ -200,10 +200,11 @@ void ro_gui_hotlist_open(void)
os_error *error;
char command[2048];
- if (option_external_hotlists && option_external_hotlist_app != NULL &&
- *option_external_hotlist_app != '\0') {
+ if (nsoption_bool(external_hotlists) &&
+ nsoption_charp(external_hotlist_app) != NULL &&
+ *nsoption_charp(external_hotlist_app) != '\0') {
snprintf(command, sizeof(command), "Filer_Run %s",
- option_external_hotlist_app);
+ nsoption_charp(external_hotlist_app));
error = xos_cli(command);
if (error == NULL)
@@ -292,9 +293,7 @@ void ro_gui_hotlist_toolbar_update_buttons(void)
void ro_gui_hotlist_toolbar_save_buttons(char *config)
{
- if (option_toolbar_hotlist != NULL)
- free(option_toolbar_hotlist);
- option_toolbar_hotlist = config;
+ nsoption_set_charp(toolbar_hotlist, config);
ro_gui_save_options();
}
@@ -481,7 +480,7 @@ void ro_gui_hotlist_add_page(const char *url)
* own hotlist and return...
*/
- if (!option_external_hotlists) {
+ if (!nsoption_bool(external_hotlists)) {
hotlist_add_page(url);
return;
}
diff --git a/riscos/iconbar.c b/riscos/iconbar.c
index 85ca59155..9e3a050e1 100644
--- a/riscos/iconbar.c
+++ b/riscos/iconbar.c
@@ -37,7 +37,7 @@
#include "riscos/global_history.h"
#include "riscos/hotlist.h"
#include "riscos/iconbar.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/wimp_event.h"
#include "utils/log.h"
#include "utils/utils.h"
@@ -122,13 +122,13 @@ bool ro_gui_iconbar_click(wimp_pointer *pointer)
switch (pointer->buttons) {
case wimp_CLICK_SELECT:
- if (option_homepage_url && option_homepage_url[0]) {
- browser_window_create(option_homepage_url, NULL, 0,
- true, false);
+ if (nsoption_charp(homepage_url) != NULL) {
+ browser_window_create(nsoption_charp(homepage_url),
+ NULL, 0, true, false);
} else {
snprintf(url, sizeof url,
- "file:///<NetSurf$Dir>/Docs/welcome/index_%s",
- option_language);
+ "file:///<NetSurf$Dir>/Docs/welcome/index_%s",
+ nsoption_charp(language));
browser_window_create(url, NULL, 0, true, false);
}
break;
diff --git a/riscos/image.c b/riscos/image.c
index 6ba57695b..3d4f28b1d 100644
--- a/riscos/image.c
+++ b/riscos/image.c
@@ -22,7 +22,7 @@
#include "oslib/osspriteop.h"
#include "riscos/image.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/tinct.h"
#include "utils/log.h"
#include "utils/utils.h"
@@ -69,8 +69,8 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
req_height *= 2;
width *= 2;
height *= 2;
- tinct_options = background ? option_bg_plot_style :
- option_fg_plot_style;
+ tinct_options = background ? nsoption_int(bg_plot_style) :
+ nsoption_int(fg_plot_style);
switch (type) {
case IMAGE_PLOT_TINCT_ALPHA:
return image_redraw_tinct(header, x, y,
diff --git a/riscos/menus.c b/riscos/menus.c
index 133aa9d6d..6f69b7535 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -54,7 +54,7 @@
#include "riscos/help.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/save.h"
#include "riscos/tinct.h"
#include "riscos/toolbar.h"
diff --git a/riscos/options.h b/riscos/options.h
index 6aa6a8b20..62bfcf2bb 100644
--- a/riscos/options.h
+++ b/riscos/options.h
@@ -22,126 +22,131 @@
* RISC OS specific options.
*/
+#include "riscos/tinct.h"
+
+#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
+#error "Frontend options header cannot be included directly"
+#endif
+
#ifndef _NETSURF_RISCOS_OPTIONS_H_
#define _NETSURF_RISCOS_OPTIONS_H_
-#include <stdbool.h>
-#include "desktop/options.h"
-#include "riscos/tinct.h"
+#define NSOPTION_EXTRA_DEFINE \
+ bool use_mouse_gestures; \
+ bool allow_text_selection; \
+ char *theme; \
+ char *language; \
+ int fg_plot_style; /* tinct flagword */ \
+ int bg_plot_style; /* tinct flagword */ \
+ bool history_tooltip; \
+ bool toolbar_show_buttons; \
+ bool toolbar_show_address; \
+ bool toolbar_show_throbber; \
+ char *toolbar_browser; \
+ char *toolbar_hotlist; \
+ char *toolbar_history; \
+ char *toolbar_cookies; \
+ bool window_stagger; \
+ bool window_size_clone; \
+ bool buffer_animations; \
+ bool buffer_everything; \
+ bool open_browser_at_startup; \
+ bool no_plugins; \
+ bool block_popups; \
+ int image_memory_direct; /* -1 means auto-detect */ \
+ int image_memory_compressed; /* -1 means auto-detect */ \
+ bool strip_extensions; \
+ bool confirm_overwrite; \
+ char *url_path; \
+ char *url_save; \
+ char *hotlist_path; \
+ char *hotlist_save; \
+ char *recent_path; \
+ char *recent_save; \
+ char *theme_path; \
+ char *theme_save; \
+ bool thumbnail_iconise; \
+ bool interactive_help; \
+ bool external_hotlists; \
+ char *external_hotlist_app
-extern bool option_allow_text_selection;
-extern char *option_theme;
-extern char *option_language;
-extern int option_fg_plot_style; /* tinct flagword */
-extern int option_bg_plot_style; /* tinct flagword */
-extern bool option_history_tooltip;
-extern bool option_toolbar_show_buttons;
-extern bool option_toolbar_show_address;
-extern bool option_toolbar_show_throbber;
-extern char *option_toolbar_browser;
-extern char *option_toolbar_hotlist;
-extern char *option_toolbar_history;
-extern char *option_toolbar_cookies;
-extern bool option_window_stagger;
-extern bool option_window_size_clone;
-extern bool option_buffer_animations;
-extern bool option_buffer_everything;
-extern bool option_open_browser_at_startup;
-extern bool option_no_plugins;
-extern bool option_block_popups;
-extern int option_image_memory_direct; /* -1 means auto-detect */
-extern int option_image_memory_compressed; /* -1 means auto-detect */
-extern bool option_strip_extensions;
-extern bool option_confirm_overwrite;
-extern char *option_url_path;
-extern char *option_url_save;
-extern char *option_hotlist_path;
-extern char *option_hotlist_save;
-extern char *option_recent_path;
-extern char *option_recent_save;
-extern char *option_theme_path;
-extern char *option_theme_save;
-extern bool option_thumbnail_iconise;
-extern bool option_interactive_help;
-extern bool option_external_hotlists;
-extern char *option_external_hotlist_app;
-#define EXTRA_OPTION_DEFINE \
-bool option_use_mouse_gestures = false;\
-bool option_allow_text_selection = true;\
-char *option_theme = 0;\
-char *option_language = 0;\
-int option_fg_plot_style = tinct_ERROR_DIFFUSE;\
-int option_bg_plot_style = tinct_DITHER;\
-bool option_history_tooltip = true; \
-bool option_toolbar_show_buttons = true; \
-bool option_toolbar_show_address = true; \
-bool option_toolbar_show_throbber = true; \
-char *option_toolbar_browser = 0; \
-char *option_toolbar_hotlist = 0; \
-char *option_toolbar_history = 0; \
-char *option_toolbar_cookies = 0; \
-bool option_window_stagger = true; \
-bool option_window_size_clone = true; \
-bool option_buffer_animations = true; \
-bool option_buffer_everything = true; \
-bool option_open_browser_at_startup = false; \
-bool option_no_plugins = false; \
-bool option_block_popups = false; \
-int option_image_memory_direct = -1; \
-int option_image_memory_compressed = -1; \
-bool option_strip_extensions = true; \
-bool option_confirm_overwrite = true; \
-char *option_url_path = 0; \
-char *option_url_save = 0; \
-char *option_hotlist_path = 0; \
-char *option_hotlist_save = 0; \
-char *option_recent_path = 0; \
-char *option_recent_save = 0; \
-char *option_theme_path = 0; \
-char *option_theme_save = 0; \
-bool option_thumbnail_iconise = true; \
-bool option_interactive_help = true; \
-bool option_external_hotlists = false; \
-char *option_external_hotlist_app = 0;
+#define NSOPTION_EXTRA_DEFAULTS \
+ .use_mouse_gestures = false, \
+ .allow_text_selection = true, \
+ .theme = NULL, \
+ .language = NULL, \
+ .fg_plot_style = tinct_ERROR_DIFFUSE, \
+ .bg_plot_style = tinct_DITHER, \
+ .history_tooltip = true, \
+ .toolbar_show_buttons = true, \
+ .toolbar_show_address = true, \
+ .toolbar_show_throbber = true, \
+ .toolbar_browser = NULL, \
+ .toolbar_hotlist = NULL, \
+ .toolbar_history = NULL, \
+ .toolbar_cookies = NULL, \
+ .window_stagger = true, \
+ .window_size_clone = true, \
+ .buffer_animations = true, \
+ .buffer_everything = true, \
+ .open_browser_at_startup = false, \
+ .no_plugins = false, \
+ .block_popups = false, \
+ .image_memory_direct = -1, \
+ .image_memory_compressed = -1, \
+ .strip_extensions = true, \
+ .confirm_overwrite = true, \
+ .url_path = NULL, \
+ .url_save = NULL, \
+ .hotlist_path = NULL, \
+ .hotlist_save = NULL, \
+ .recent_path = NULL, \
+ .recent_save = NULL, \
+ .theme_path = NULL, \
+ .theme_save = NULL, \
+ .thumbnail_iconise = true, \
+ .interactive_help = true, \
+ .external_hotlists = false, \
+ .external_hotlist_app = NULL
-#define EXTRA_OPTION_TABLE \
-{ "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\
-{ "allow_text_selection", OPTION_BOOL, &option_allow_text_selection },\
-{ "theme", OPTION_STRING, &option_theme },\
-{ "language", OPTION_STRING, &option_language },\
-{ "plot_fg_quality", OPTION_INTEGER, &option_fg_plot_style },\
-{ "plot_bg_quality", OPTION_INTEGER, &option_bg_plot_style },\
-{ "history_tooltip", OPTION_BOOL, &option_history_tooltip }, \
-{ "toolbar_show_buttons", OPTION_BOOL, &option_toolbar_show_buttons }, \
-{ "toolbar_show_address", OPTION_BOOL, &option_toolbar_show_address }, \
-{ "toolbar_show_throbber", OPTION_BOOL, &option_toolbar_show_throbber }, \
-{ "toolbar_browser", OPTION_STRING, &option_toolbar_browser }, \
-{ "toolbar_hotlist", OPTION_STRING, &option_toolbar_hotlist }, \
-{ "toolbar_history", OPTION_STRING, &option_toolbar_history }, \
-{ "toolbar_cookies", OPTION_STRING, &option_toolbar_cookies }, \
-{ "window_stagger", OPTION_BOOL, &option_window_stagger }, \
-{ "window_size_clone", OPTION_BOOL, &option_window_size_clone }, \
-{ "buffer_animations", OPTION_BOOL, &option_buffer_animations }, \
-{ "buffer_everything", OPTION_BOOL, &option_buffer_everything }, \
-{ "open_browser_at_startup",OPTION_BOOL, &option_open_browser_at_startup }, \
-{ "no_plugins", OPTION_BOOL, &option_no_plugins }, \
-{ "block_popups", OPTION_BOOL, &option_block_popups }, \
-{ "image_memory_direct", OPTION_INTEGER, &option_image_memory_direct }, \
-{ "image_memory_compressed",OPTION_INTEGER, &option_image_memory_compressed }, \
-{ "strip_extensions", OPTION_BOOL, &option_strip_extensions }, \
-{ "confirm_overwrite", OPTION_BOOL, &option_confirm_overwrite }, \
-{ "url_path", OPTION_STRING, &option_url_path }, \
-{ "url_save", OPTION_STRING, &option_url_save }, \
-{ "hotlist_path", OPTION_STRING, &option_hotlist_path }, \
-{ "hotlist_save", OPTION_STRING, &option_hotlist_save }, \
-{ "recent_path", OPTION_STRING, &option_recent_path }, \
-{ "recent_save", OPTION_STRING, &option_recent_save }, \
-{ "theme_path", OPTION_STRING, &option_theme_path }, \
-{ "theme_save", OPTION_STRING, &option_theme_save }, \
-{ "thumbnail_iconise", OPTION_BOOL, &option_thumbnail_iconise }, \
-{ "interactive_help", OPTION_BOOL, &option_interactive_help }, \
-{ "external_hotlists", OPTION_BOOL, &option_external_hotlists }, \
-{ "external_hotlist_app", OPTION_STRING, &option_external_hotlist_app }
+#define NSOPTION_EXTRA_TABLE \
+{ "use_mouse_gestures", OPTION_BOOL, &nsoptions.use_mouse_gestures },\
+{ "allow_text_selection", OPTION_BOOL, &nsoptions.allow_text_selection },\
+{ "theme", OPTION_STRING, &nsoptions.theme },\
+{ "language", OPTION_STRING, &nsoptions.language },\
+{ "plot_fg_quality", OPTION_INTEGER, &nsoptions.fg_plot_style },\
+{ "plot_bg_quality", OPTION_INTEGER, &nsoptions.bg_plot_style },\
+{ "history_tooltip", OPTION_BOOL, &nsoptions.history_tooltip }, \
+{ "toolbar_show_buttons", OPTION_BOOL, &nsoptions.toolbar_show_buttons }, \
+{ "toolbar_show_address", OPTION_BOOL, &nsoptions.toolbar_show_address }, \
+{ "toolbar_show_throbber", OPTION_BOOL, &nsoptions.toolbar_show_throbber }, \
+{ "toolbar_browser", OPTION_STRING, &nsoptions.toolbar_browser }, \
+{ "toolbar_hotlist", OPTION_STRING, &nsoptions.toolbar_hotlist }, \
+{ "toolbar_history", OPTION_STRING, &nsoptions.toolbar_history }, \
+{ "toolbar_cookies", OPTION_STRING, &nsoptions.toolbar_cookies }, \
+{ "window_stagger", OPTION_BOOL, &nsoptions.window_stagger }, \
+{ "window_size_clone", OPTION_BOOL, &nsoptions.window_size_clone }, \
+{ "buffer_animations", OPTION_BOOL, &nsoptions.buffer_animations }, \
+{ "buffer_everything", OPTION_BOOL, &nsoptions.buffer_everything }, \
+{ "open_browser_at_startup",OPTION_BOOL, &nsoptions.open_browser_at_startup }, \
+{ "no_plugins", OPTION_BOOL, &nsoptions.no_plugins }, \
+{ "block_popups", OPTION_BOOL, &nsoptions.block_popups }, \
+{ "image_memory_direct", OPTION_INTEGER, &nsoptions.image_memory_direct }, \
+{ "image_memory_compressed",OPTION_INTEGER, &nsoptions.image_memory_compressed }, \
+{ "strip_extensions", OPTION_BOOL, &nsoptions.strip_extensions }, \
+{ "confirm_overwrite", OPTION_BOOL, &nsoptions.confirm_overwrite }, \
+{ "url_path", OPTION_STRING, &nsoptions.url_path }, \
+{ "url_save", OPTION_STRING, &nsoptions.url_save }, \
+{ "hotlist_path", OPTION_STRING, &nsoptions.hotlist_path }, \
+{ "hotlist_save", OPTION_STRING, &nsoptions.hotlist_save }, \
+{ "recent_path", OPTION_STRING, &nsoptions.recent_path }, \
+{ "recent_save", OPTION_STRING, &nsoptions.recent_save }, \
+{ "theme_path", OPTION_STRING, &nsoptions.theme_path }, \
+{ "theme_save", OPTION_STRING, &nsoptions.theme_save }, \
+{ "thumbnail_iconise", OPTION_BOOL, &nsoptions.thumbnail_iconise }, \
+{ "interactive_help", OPTION_BOOL, &nsoptions.interactive_help }, \
+{ "external_hotlists", OPTION_BOOL, &nsoptions.external_hotlists }, \
+{ "external_hotlist_app", OPTION_STRING, &nsoptions.external_hotlist_app }
#endif
diff --git a/riscos/save.c b/riscos/save.c
index f585ad5ea..8233eb7cd 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -51,7 +51,7 @@
#include "riscos/gui.h"
#include "riscos/menus.h"
#include "riscos/message.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/query.h"
#include "riscos/save.h"
#include "riscos/save_draw.h"
@@ -337,7 +337,7 @@ bool ro_gui_save_ok(wimp_w w)
|| !(pointer.buttons & wimp_CLICK_ADJUST);
memcpy(&gui_save_message.data.data_xfer.file_name, path, 1 + strlen(path));
- if (ro_gui_save_content(gui_save_content, path, !option_confirm_overwrite)) {
+ if (ro_gui_save_content(gui_save_content, path, !nsoption_bool(confirm_overwrite))) {
ro_gui_save_done();
return true;
}
@@ -794,7 +794,7 @@ void ro_gui_save_datasave_ack(wimp_message *message)
if (message->data.data_xfer.est_size == -1)
force_overwrite = true;
else
- force_overwrite = !option_confirm_overwrite;
+ force_overwrite = !nsoption_bool(confirm_overwrite);
if (ro_gui_save_content(h, path, force_overwrite))
ro_gui_save_done();
@@ -1312,7 +1312,7 @@ void ro_gui_save_set_state(hlcache_handle *h, gui_save_type save_type,
}
/* leafname */
- if (url && url_nice(url, &nice, option_strip_extensions) ==
+ if (url && url_nice(url, &nice, nsoption_bool(strip_extensions)) ==
URL_FUNC_OK) {
for (i = 0; nice[i]; i++) {
if (nice[i] == '.')
diff --git a/riscos/system_colour.c b/riscos/system_colour.c
index dbb909c36..7334fde73 100644
--- a/riscos/system_colour.c
+++ b/riscos/system_colour.c
@@ -49,196 +49,196 @@ static struct gui_system_colour_ctx colour_list[] = {
SLEN("ActiveBorder"),
0xff000000,
wimp_COLOUR_BLACK,
- &option_sys_colour_ActiveBorder,
+ &nsoption_colour(sys_colour_ActiveBorder),
NULL
}, {
"ActiveCaption",
SLEN("ActiveCaption"),
0xffdddddd,
wimp_COLOUR_CREAM,
- &option_sys_colour_ActiveCaption,
+ &nsoption_colour(sys_colour_ActiveCaption),
NULL
}, {
"AppWorkspace",
SLEN("AppWorkspace"),
0xffeeeeee,
wimp_COLOUR_VERY_LIGHT_GREY,
- &option_sys_colour_AppWorkspace,
+ &nsoption_colour(sys_colour_AppWorkspace),
NULL
}, {
"Background",
SLEN("Background"),
0xff0000aa,
wimp_COLOUR_VERY_LIGHT_GREY, /* \TODO -- Check */
- &option_sys_colour_Background,
+ &nsoption_colour(sys_colour_Background),
NULL
}, {
"ButtonFace",
SLEN("ButtonFace"),
0xffaaaaaa,
wimp_COLOUR_VERY_LIGHT_GREY,
- &option_sys_colour_ButtonFace,
+ &nsoption_colour(sys_colour_ButtonFace),
NULL
}, {
"ButtonHighlight",
SLEN("ButtonHighlight"),
0xffdddddd,
wimp_COLOUR_DARK_GREY, /* \TODO -- Check */
- &option_sys_colour_ButtonHighlight,
+ &nsoption_colour(sys_colour_ButtonHighlight),
NULL
}, {
"ButtonShadow",
SLEN("ButtonShadow"),
0xffbbbbbb,
wimp_COLOUR_MID_DARK_GREY,
- &option_sys_colour_ButtonShadow,
+ &nsoption_colour(sys_colour_ButtonShadow),
NULL
}, {
"ButtonText",
SLEN("ButtonText"),
0xff000000,
wimp_COLOUR_BLACK,
- &option_sys_colour_ButtonText,
+ &nsoption_colour(sys_colour_ButtonText),
NULL
}, {
"CaptionText",
SLEN("CaptionText"),
0xff000000,
wimp_COLOUR_BLACK,
- &option_sys_colour_CaptionText,
+ &nsoption_colour(sys_colour_CaptionText),
NULL
}, {
"GrayText",
SLEN("GrayText"),
0xffcccccc,
wimp_COLOUR_MID_LIGHT_GREY, /* \TODO -- Check */
- &option_sys_colour_GrayText,
+ &nsoption_colour(sys_colour_GrayText),
NULL
}, {
"Highlight",
SLEN("Highlight"),
0xff0000ee,
wimp_COLOUR_BLACK,
- &option_sys_colour_Highlight,
+ &nsoption_colour(sys_colour_Highlight),
NULL
}, {
"HighlightText",
SLEN("HighlightText"),
0xff000000,
wimp_COLOUR_WHITE,
- &option_sys_colour_HighlightText,
+ &nsoption_colour(sys_colour_HighlightText),
NULL
}, {
"InactiveBorder",
SLEN("InactiveBorder"),
0xffffffff,
wimp_COLOUR_BLACK,
- &option_sys_colour_InactiveBorder,
+ &nsoption_colour(sys_colour_InactiveBorder),
NULL
}, {
"InactiveCaption",
SLEN("InactiveCaption"),
0xffffffff,
wimp_COLOUR_LIGHT_GREY,
- &option_sys_colour_InactiveCaption,
+ &nsoption_colour(sys_colour_InactiveCaption),
NULL
}, {
"InactiveCaptionText",
SLEN("InactiveCaptionText"),
0xffcccccc,
wimp_COLOUR_BLACK,
- &option_sys_colour_InactiveCaptionText,
+ &nsoption_colour(sys_colour_InactiveCaptionText),
NULL
}, {
"InfoBackground",
SLEN("InfoBackground"),
0xffaaaaaa,
wimp_COLOUR_CREAM,
- &option_sys_colour_InfoBackground,
+ &nsoption_colour(sys_colour_InfoBackground),
NULL
}, {
"InfoText",
SLEN("InfoText"),
0xff000000,
wimp_COLOUR_BLACK,
- &option_sys_colour_InfoText,
+ &nsoption_colour(sys_colour_InfoText),
NULL
}, {
"Menu",
SLEN("Menu"),
0xffaaaaaa,
wimp_COLOUR_WHITE,
- &option_sys_colour_Menu,
+ &nsoption_colour(sys_colour_Menu),
NULL
}, {
"MenuText",
SLEN("MenuText"),
0xff000000,
wimp_COLOUR_BLACK,
- &option_sys_colour_MenuText,
+ &nsoption_colour(sys_colour_MenuText),
NULL
}, {
"Scrollbar",
SLEN("Scrollbar"),
0xffaaaaaa,
wimp_COLOUR_LIGHT_GREY, /* \TODO -- Check */
- &option_sys_colour_Scrollbar,
+ &nsoption_colour(sys_colour_Scrollbar),
NULL
}, {
"ThreeDDarkShadow",
SLEN("ThreeDDarkShadow"),
0xff555555,
wimp_COLOUR_MID_DARK_GREY,
- &option_sys_colour_ThreeDDarkShadow,
+ &nsoption_colour(sys_colour_ThreeDDarkShadow),
NULL
}, {
"ThreeDFace",
SLEN("ThreeDFace"),
0xffdddddd,
wimp_COLOUR_VERY_LIGHT_GREY,
- &option_sys_colour_ThreeDFace,
+ &nsoption_colour(sys_colour_ThreeDFace),
NULL
}, {
"ThreeDHighlight",
SLEN("ThreeDHighlight"),
0xffaaaaaa,
wimp_COLOUR_WHITE,
- &option_sys_colour_ThreeDHighlight,
+ &nsoption_colour(sys_colour_ThreeDHighlight),
NULL
}, {
"ThreeDLightShadow",
SLEN("ThreeDLightShadow"),
0xff999999,
wimp_COLOUR_WHITE,
- &option_sys_colour_ThreeDLightShadow,
+ &nsoption_colour(sys_colour_ThreeDLightShadow),
NULL
}, {
"ThreeDShadow",
SLEN("ThreeDShadow"),
0xff777777,
wimp_COLOUR_MID_DARK_GREY,
- &option_sys_colour_ThreeDShadow,
+ &nsoption_colour(sys_colour_ThreeDShadow),
NULL
}, {
"Window",
SLEN("Window"),
0xffaaaaaa,
wimp_COLOUR_VERY_LIGHT_GREY,
- &option_sys_colour_Window,
+ &nsoption_colour(sys_colour_Window),
NULL
}, {
"WindowFrame",
SLEN("WindowFrame"),
0xff000000,
wimp_COLOUR_BLACK,
- &option_sys_colour_WindowFrame,
+ &nsoption_colour(sys_colour_WindowFrame),
NULL
}, {
"WindowText",
SLEN("WindowText"),
0xff000000,
wimp_COLOUR_BLACK,
- &option_sys_colour_WindowText,
+ &nsoption_colour(sys_colour_WindowText),
NULL
},
diff --git a/riscos/theme.c b/riscos/theme.c
index 6b83cad92..b44493dd9 100644
--- a/riscos/theme.c
+++ b/riscos/theme.c
@@ -44,7 +44,7 @@
#include "riscos/gui.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/theme.h"
#include "riscos/treeview.h"
#include "riscos/wimp.h"
@@ -72,7 +72,7 @@ void ro_gui_theme_initialise(void)
struct theme_descriptor *descriptor;
theme_descriptors = ro_gui_theme_get_available();
- descriptor = ro_gui_theme_find(option_theme);
+ descriptor = ro_gui_theme_find(nsoption_charp(theme));
if (!descriptor)
descriptor = ro_gui_theme_find("Aletheia");
ro_gui_theme_apply(descriptor);
@@ -136,7 +136,7 @@ struct theme_descriptor *ro_gui_theme_get_available(void)
ro_gui_theme_add_descriptor("NetSurf:Resources", "Aletheia");
/* scan our choices directory */
- ro_gui_theme_get_available_in_dir(option_theme_path);
+ ro_gui_theme_get_available_in_dir(nsoption_charp(theme_path));
/* sort alphabetically in a very rubbish way */
if ((theme_descriptors) && (theme_descriptors->next)) {
diff --git a/riscos/theme_install.c b/riscos/theme_install.c
index 574a380d4..e5d5aafa3 100644
--- a/riscos/theme_install.c
+++ b/riscos/theme_install.c
@@ -28,7 +28,7 @@
#include "desktop/browser.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/theme.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
@@ -198,7 +198,7 @@ bool ro_gui_theme_install_apply(wimp_w w)
/* simply overwrite previous theme versions */
snprintf(theme_save, sizeof theme_save, "%s.%s",
- option_theme_save, theme_file);
+ nsoption_charp(theme_save), theme_file);
theme_save[sizeof theme_save - 1] = '\0';
@@ -222,8 +222,7 @@ bool ro_gui_theme_install_apply(wimp_w w)
if (!theme_install || !ro_gui_theme_apply(theme_install)) {
warn_user("ThemeApplyErr", 0);
} else {
- free(option_theme);
- option_theme = strdup(theme_install->leafname);
+ nsoption_set_charp(theme, strdup(theme_install->leafname));
}
free(theme_file);
ro_gui_save_options();
diff --git a/riscos/thumbnail.c b/riscos/thumbnail.c
index a9ee005af..43100cab1 100644
--- a/riscos/thumbnail.c
+++ b/riscos/thumbnail.c
@@ -40,7 +40,7 @@
#include "render/font.h"
#include "riscos/bitmap.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/oslib_pre7.h"
#include "riscos/thumbnail.h"
#include "riscos/tinct.h"
diff --git a/riscos/toolbar.c b/riscos/toolbar.c
index 96bd5a8d7..7e95ce6b0 100644
--- a/riscos/toolbar.c
+++ b/riscos/toolbar.c
@@ -49,7 +49,7 @@
#include "riscos/gui/url_bar.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/save.h"
#include "riscos/theme.h"
#include "riscos/toolbar.h"
diff --git a/riscos/url_complete.c b/riscos/url_complete.c
index 98820b7a3..d962f195d 100644
--- a/riscos/url_complete.c
+++ b/riscos/url_complete.c
@@ -30,7 +30,7 @@
#include "utils/log.h"
#include "riscos/global_history.h"
#include "riscos/gui.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/toolbar.h"
#include "riscos/url_complete.h"
#include "riscos/wimp.h"
@@ -105,7 +105,7 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
/* we must have a toolbar/url bar */
if (!ro_toolbar_get_display_url(toolbar) ||
- (!option_url_suggestion)) {
+ (!nsoption_bool(url_suggestion))) {
ro_gui_url_complete_close();
return false;
}
diff --git a/riscos/window.c b/riscos/window.c
index 7674419d7..9cdcb19f6 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -69,7 +69,7 @@
#include "riscos/help.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
-#include "riscos/options.h"
+#include "desktop/options.h"
#include "riscos/oslib_pre7.h"
#include "riscos/save.h"
#include "riscos/content-handlers/sprite.h"
@@ -398,7 +398,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
g->iconise_icon = -1;
/* Set the window position */
- if (clone && clone->window && option_window_size_clone) {
+ if (clone && clone->window && nsoption_bool(window_size_clone)) {
for (top = clone; top->parent; top = top->parent);
state.w = top->window->window;
error = xwimp_get_window_state(&state);
@@ -416,17 +416,17 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
ro_gui_screen_size(&screen_width, &screen_height);
/* Check if we have a preferred position */
- if ((option_window_screen_width != 0) &&
- (option_window_screen_height != 0)) {
- win_width = (option_window_width * screen_width) /
- option_window_screen_width;
- win_height = (option_window_height * screen_height) /
- option_window_screen_height;
- window.visible.x0 = (option_window_x * screen_width) /
- option_window_screen_width;
- window.visible.y0 = (option_window_y * screen_height) /
- option_window_screen_height;
- if (option_window_stagger) {
+ if ((nsoption_int(window_screen_width) != 0) &&
+ (nsoption_int(window_screen_height) != 0)) {
+ win_width = (nsoption_int(window_width) * screen_width) /
+ nsoption_int(window_screen_width);
+ win_height = (nsoption_int(window_height) * screen_height) /
+ nsoption_int(window_screen_height);
+ window.visible.x0 = (nsoption_int(window_x) * screen_width) /
+ nsoption_int(window_screen_width);
+ window.visible.y0 = (nsoption_int(window_y) * screen_height) /
+ nsoption_int(window_screen_height);
+ if (nsoption_bool(window_stagger)) {
window.visible.y0 += 96 -
(48 * (window_count % 5));
}
@@ -520,7 +520,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
/* Add in a toolbar and status bar */
g->status_bar = ro_gui_status_bar_create(g->window,
- option_toolbar_status_width);
+ nsoption_int(toolbar_status_width));
g->toolbar = ro_toolbar_create(NULL, g->window,
THEME_STYLE_BROWSER_TOOLBAR, TOOLBAR_FLAGS_NONE,
&ro_gui_window_toolbar_callbacks, g,
@@ -528,7 +528,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
if (g->toolbar != NULL) {
ro_toolbar_add_buttons(g->toolbar,
brower_toolbar_buttons,
- option_toolbar_browser);
+ nsoption_charp(toolbar_browser));
ro_toolbar_add_url(g->toolbar);
ro_toolbar_add_throbber(g->toolbar);
ro_toolbar_rebuild(g->toolbar);
@@ -2349,10 +2349,10 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
/* View Submenu */
ro_gui_menu_set_entry_ticked(menu, BROWSER_IMAGES_FOREGROUND,
- g != NULL && option_foreground_images);
+ g != NULL && nsoption_bool(foreground_images));
ro_gui_menu_set_entry_ticked(menu, BROWSER_IMAGES_BACKGROUND,
- g != NULL && option_background_images);
+ g != NULL && nsoption_bool(background_images));
ro_gui_menu_set_entry_shaded(menu, BROWSER_BUFFER_ANIMS,
g == NULL || g->option.buffer_everything);
@@ -2367,16 +2367,16 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
ro_gui_menu_set_entry_shaded(menu, BROWSER_SCALE_VIEW, h == NULL);
ro_gui_menu_set_entry_shaded(menu, BROWSER_WINDOW_STAGGER,
- option_window_screen_width == 0);
+ nsoption_int(window_screen_width) == 0);
ro_gui_menu_set_entry_ticked(menu, BROWSER_WINDOW_STAGGER,
- ((option_window_screen_width == 0) ||
- option_window_stagger));
+ ((nsoption_int(window_screen_width) == 0) ||
+ nsoption_bool(window_stagger)));
ro_gui_menu_set_entry_ticked(menu, BROWSER_WINDOW_COPY,
- option_window_size_clone);
+ nsoption_bool(window_size_clone));
ro_gui_menu_set_entry_shaded(menu, BROWSER_WINDOW_RESET,
- option_window_screen_width == 0);
+ nsoption_int(window_screen_width) == 0);
/* Utilities Submenu */
@@ -2393,7 +2393,7 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
ro_gui_menu_set_entry_ticked(menu, HELP_LAUNCH_INTERACTIVE,
ro_gui_interactive_help_available() &&
- option_interactive_help);
+ nsoption_bool(interactive_help));
return true;
}
@@ -2658,9 +2658,9 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
case HELP_LAUNCH_INTERACTIVE:
if (!ro_gui_interactive_help_available()) {
ro_gui_interactive_help_start();
- option_interactive_help = true;
+ nsoption_set_bool(interactive_help, true);
} else {
- option_interactive_help = !option_interactive_help;
+ nsoption_set_bool(interactive_help, !nsoption_bool(interactive_help));
}
break;
@@ -2868,13 +2868,13 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
break;
case BROWSER_IMAGES_FOREGROUND:
if (g != NULL)
- option_foreground_images =
- !option_foreground_images;
+ nsoption_set_bool(foreground_images,
+ !nsoption_bool(foreground_images));
break;
case BROWSER_IMAGES_BACKGROUND:
if (g != NULL)
- option_background_images =
- !option_background_images;
+ nsoption_set_bool(background_images,
+ !nsoption_bool(background_images));
break;
case BROWSER_BUFFER_ANIMS:
if (g != NULL)
@@ -2894,8 +2894,8 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
break;
case BROWSER_WINDOW_DEFAULT:
if (g != NULL) {
- ro_gui_screen_size(&option_window_screen_width,
- &option_window_screen_height);
+ ro_gui_screen_size(&nsoption_int(window_screen_width),
+ &nsoption_int(window_screen_height));
state.w = w;
error = xwimp_get_window_state(&state);
if (error) {
@@ -2904,26 +2904,26 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
error->errmess));
warn_user("WimpError", error->errmess);
}
- option_window_x = state.visible.x0;
- option_window_y = state.visible.y0;
- option_window_width =
- state.visible.x1 - state.visible.x0;
- option_window_height =
- state.visible.y1 - state.visible.y0;
+ nsoption_set_int(window_x, state.visible.x0);
+ nsoption_set_int(window_y, state.visible.y0);
+ nsoption_set_int(window_width,
+ state.visible.x1 - state.visible.x0);
+ nsoption_set_int(window_height,
+ state.visible.y1 - state.visible.y0);
ro_gui_save_options();
}
break;
case BROWSER_WINDOW_STAGGER:
- option_window_stagger = !option_window_stagger;
+ nsoption_set_bool(window_stagger, !nsoption_bool(window_stagger));
ro_gui_save_options();
break;
case BROWSER_WINDOW_COPY:
- option_window_size_clone = !option_window_size_clone;
+ nsoption_set_bool(window_size_clone, !nsoption_bool(window_size_clone));
ro_gui_save_options();
break;
case BROWSER_WINDOW_RESET:
- option_window_screen_width = 0;
- option_window_screen_height = 0;
+ nsoption_set_int(window_screen_width, 0);
+ nsoption_set_int(window_screen_height, 0);
ro_gui_save_options();
break;
@@ -3886,12 +3886,12 @@ void ro_gui_window_action_home(struct gui_window *g)
if (g == NULL || g->bw == NULL)
return;
- if ((option_homepage_url) && (option_homepage_url[0])) {
- browser_window_go(g->bw, option_homepage_url, 0, true);
+ if ((nsoption_charp(homepage_url)) && (nsoption_charp(homepage_url)[0])) {
+ browser_window_go(g->bw, nsoption_charp(homepage_url), 0, true);
} else {
snprintf(url, sizeof url,
"file:///<NetSurf$Dir>/Docs/welcome/index_%s",
- option_language);
+ nsoption_charp(language));
browser_window_go(g->bw, url, 0, true);
}
}
@@ -4325,9 +4325,7 @@ void ro_gui_window_update_toolbar(void *data)
void ro_gui_window_save_toolbar_buttons(void *data, char *config)
{
- if (option_toolbar_browser != NULL)
- free(option_toolbar_browser);
- option_toolbar_browser = config;
+ nsoption_set_charp(toolbar_browser, config);
ro_gui_save_options();
}
@@ -4467,9 +4465,9 @@ void ro_gui_window_clone_options(struct browser_window *new_bw,
/* Clone the basic options
*/
if (!old_gui) {
- new_bw->scale = ((float)option_scale) / 100;
- new_gui->option.buffer_animations = option_buffer_animations;
- new_gui->option.buffer_everything = option_buffer_everything;
+ new_bw->scale = ((float)nsoption_int(scale)) / 100;
+ new_gui->option.buffer_animations = nsoption_bool(buffer_animations);
+ new_gui->option.buffer_everything = nsoption_bool(buffer_everything);
} else {
new_gui->option = old_gui->option;
}
@@ -4478,11 +4476,11 @@ void ro_gui_window_clone_options(struct browser_window *new_bw,
*/
if (new_gui->toolbar) {
ro_toolbar_set_display_buttons(new_gui->toolbar,
- option_toolbar_show_buttons);
+ nsoption_bool(toolbar_show_buttons));
ro_toolbar_set_display_url(new_gui->toolbar,
- option_toolbar_show_address);
+ nsoption_bool(toolbar_show_address));
ro_toolbar_set_display_throbber(new_gui->toolbar,
- option_toolbar_show_throbber);
+ nsoption_bool(toolbar_show_throbber));
if ((old_gui) && (old_gui->toolbar)) {
ro_toolbar_set_display_buttons(new_gui->toolbar,
ro_toolbar_get_display_buttons(
@@ -4518,23 +4516,23 @@ void ro_gui_window_default_options(struct browser_window *bw)
/* Save the basic options
*/
- option_scale = bw->scale * 100;
- option_buffer_animations = gui->option.buffer_animations;
- option_buffer_everything = gui->option.buffer_everything;
+ nsoption_set_int(scale, bw->scale * 100);
+ nsoption_set_bool(buffer_animations, gui->option.buffer_animations);
+ nsoption_set_bool(buffer_everything, gui->option.buffer_everything);
/* Set up the toolbar
*/
if (gui->toolbar != NULL) {
- option_toolbar_show_buttons =
- ro_toolbar_get_display_buttons(gui->toolbar);
- option_toolbar_show_address =
- ro_toolbar_get_display_url(gui->toolbar);
- option_toolbar_show_throbber =
- ro_toolbar_get_display_throbber(gui->toolbar);
+ nsoption_set_bool(toolbar_show_buttons,
+ ro_toolbar_get_display_buttons(gui->toolbar));
+ nsoption_set_bool(toolbar_show_address,
+ ro_toolbar_get_display_url(gui->toolbar));
+ nsoption_set_bool(toolbar_show_throbber,
+ ro_toolbar_get_display_throbber(gui->toolbar));
}
if (gui->status_bar != NULL)
- option_toolbar_status_width =
- ro_gui_status_bar_get_width(gui->status_bar);
+ nsoption_set_int(toolbar_status_width,
+ ro_gui_status_bar_get_width(gui->status_bar));
}