netsurf: branch vince/options updated. release/3.0-134-g7a72fc8
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7a72fc803a6a7a607c853...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7a72fc803a6a7a607c853fa...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7a72fc803a6a7a607c853fae5...
The branch, vince/options has been updated
via 7a72fc803a6a7a607c853fae533622322337e981 (commit)
from ae2f6ae3ed60a0e50f9aec06120ddc734b1e113a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7a72fc803a6a7a607c8...
commit 7a72fc803a6a7a607c853fae533622322337e981
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
start amiga move to new option API
diff --git a/amiga/gui.c b/amiga/gui.c
index bbd8444..d559494 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -391,7 +391,13 @@ void ami_open_resources(void)
//ami_help_init(NULL);
}
-void ami_set_options(void)
+/**
+ * Set option defaults for amiga frontend
+ *
+ * @param defaults The option table to update.
+ * @return error status.
+ */
+static nserror ami_set_options(struct nsoption_s *defaults)
{
STRPTR tempacceptlangs;
BPTR lock = 0;
@@ -482,6 +488,8 @@ void ami_set_options(void)
nsoption_set_bool(font_antialiasing, false);
nsoption_set_bool(truecolour_mouse_pointers, false);
#endif
+
+ return NSERROR_OK;
}
void ami_amiupdate(void)
@@ -543,13 +551,6 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
-/* Documented in utils/nsoption.h */
-void gui_options_init_defaults(void)
-{
- /* Set defaults for absent option strings */
- ami_set_options(); /* check options and set defaults where required */
-}
-
void gui_init(int argc, char** argv)
{
BPTR lock = 0;
@@ -895,7 +896,7 @@ int main(int argc, char** argv)
char temp[1024];
BPTR lock = 0;
int32 user = 0;
-
+ nserror ret;
Object *splash_window = ami_gui_splash_open();
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
@@ -924,7 +925,18 @@ int main(int argc, char** argv)
*/
nslog_init(NULL, &argc, argv);
- netsurf_init(&argc, &argv, current_user_options, messages);
+ /* user options setup */
+ ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ nsoption_read(current_user_options, NULL);
+ nsoption_commandline(&argc, argv, NULL);
+
+ ret = netsurf_init(messages);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
amiga_icon_init();
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index bbd8444..d559494 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -391,7 +391,13 @@ void ami_open_resources(void)
//ami_help_init(NULL);
}
-void ami_set_options(void)
+/**
+ * Set option defaults for amiga frontend
+ *
+ * @param defaults The option table to update.
+ * @return error status.
+ */
+static nserror ami_set_options(struct nsoption_s *defaults)
{
STRPTR tempacceptlangs;
BPTR lock = 0;
@@ -482,6 +488,8 @@ void ami_set_options(void)
nsoption_set_bool(font_antialiasing, false);
nsoption_set_bool(truecolour_mouse_pointers, false);
#endif
+
+ return NSERROR_OK;
}
void ami_amiupdate(void)
@@ -543,13 +551,6 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
-/* Documented in utils/nsoption.h */
-void gui_options_init_defaults(void)
-{
- /* Set defaults for absent option strings */
- ami_set_options(); /* check options and set defaults where required */
-}
-
void gui_init(int argc, char** argv)
{
BPTR lock = 0;
@@ -895,7 +896,7 @@ int main(int argc, char** argv)
char temp[1024];
BPTR lock = 0;
int32 user = 0;
-
+ nserror ret;
Object *splash_window = ami_gui_splash_open();
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
@@ -924,7 +925,18 @@ int main(int argc, char** argv)
*/
nslog_init(NULL, &argc, argv);
- netsurf_init(&argc, &argv, current_user_options, messages);
+ /* user options setup */
+ ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ nsoption_read(current_user_options, NULL);
+ nsoption_commandline(&argc, argv, NULL);
+
+ ret = netsurf_init(messages);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
amiga_icon_init();
--
NetSurf Browser
10 years
netsurf: branch vince/options created. release/3.0-133-gae2f6ae
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/ae2f6ae3ed60a0e50f9ae...
...commit http://git.netsurf-browser.org/netsurf.git/commit/ae2f6ae3ed60a0e50f9aec0...
...tree http://git.netsurf-browser.org/netsurf.git/tree/ae2f6ae3ed60a0e50f9aec061...
The branch, vince/options has been created
at ae2f6ae3ed60a0e50f9aec06120ddc734b1e113a (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ae2f6ae3ed60a0e50f9...
commit ae2f6ae3ed60a0e50f9aec06120ddc734b1e113a
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
use correct acessors for unsigned type
diff --git a/render/html.c b/render/html.c
index 0f63967..8fb35f8 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1227,8 +1227,8 @@ static void html_reformat(struct content *c, int width, int height)
time_taken = wallclock() - time_before;
c->reformat_time = wallclock() +
- ((time_taken * 3 < nsoption_int(min_reflow_period) ?
- nsoption_int(min_reflow_period) : time_taken * 3));
+ ((time_taken * 3 < nsoption_uint(min_reflow_period) ?
+ nsoption_uint(min_reflow_period) : time_taken * 3));
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5eebdad3110bc2cd82c...
commit 5eebdad3110bc2cd82c67021edcdf88daa6fc546
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
make min_reflow_period unsigned int
diff --git a/desktop/options.h b/desktop/options.h
index 4598b30..1a68c41 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -177,7 +177,7 @@ NSOPTION_INTEGER(scale, 100)
NSOPTION_BOOL(incremental_reflow, true)
/* Minimum time (in cs) between HTML reflows while objects are fetching */
-NSOPTION_INTEGER(min_reflow_period, DEFAULT_REFLOW_PERIOD)
+NSOPTION_UINT(min_reflow_period, DEFAULT_REFLOW_PERIOD)
/* use core selection menu */
NSOPTION_BOOL(core_select_menu, false)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=34b8bf7153f3cbc12a2...
commit 34b8bf7153f3cbc12a27ef4c0de3e10012c67428
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
add unsigned int type
diff --git a/utils/nsoption.c b/utils/nsoption.c
index 3d01a55..34c653b 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -47,6 +47,9 @@ struct nsoption_s *nsoptions_default = NULL;
#define NSOPTION_INTEGER(NAME, DEFAULT) \
{ #NAME, sizeof(#NAME) - 1, OPTION_INTEGER, { .i = DEFAULT } },
+#define NSOPTION_UINT(NAME, DEFAULT) \
+ { #NAME, sizeof(#NAME) - 1, OPTION_UINT, { .u = DEFAULT } },
+
#define NSOPTION_COLOUR(NAME, DEFAULT) \
{ #NAME, sizeof(#NAME) - 1, OPTION_COLOUR, { .c = DEFAULT } },
@@ -74,6 +77,7 @@ struct nsoption_s defaults[] = {
#undef NSOPTION_BOOL
#undef NSOPTION_STRING
#undef NSOPTION_INTEGER
+#undef NSOPTION_UINT
#undef NSOPTION_COLOUR
/**
@@ -94,6 +98,10 @@ strtooption(const char *value, struct nsoption_s *option)
option->value.i = atoi(value);
break;
+ case OPTION_UINT:
+ option->value.u = strtoul(value, NULL, 0);
+ break;
+
case OPTION_COLOUR:
sscanf(value, "%x", &rgbcolour);
option->value.c = (((0x000000FF & rgbcolour) << 16) |
@@ -180,6 +188,15 @@ nsoption_output(FILE *fp,
}
break;
+ case OPTION_UINT:
+ if (all ||
+ (opts[entry].value.u != defs[entry].value.u)) {
+ fprintf(fp, "%s:%u\n",
+ opts[entry].key,
+ opts[entry].value.u);
+ }
+ break;
+
case OPTION_COLOUR:
if (all ||
(opts[entry].value.c != defs[entry].value.c)) {
@@ -251,6 +268,13 @@ nsoption_output_value_html(struct nsoption_s *option,
option->value.i);
break;
+ case OPTION_UINT:
+ slen = snprintf(string + pos,
+ size - pos,
+ "%u",
+ option->value.u);
+ break;
+
case OPTION_COLOUR:
rgbcolour = (((0x000000FF & option->value.c) << 16) |
((0x0000FF00 & option->value.c) << 0) |
@@ -313,6 +337,13 @@ nsoption_output_value_text(struct nsoption_s *option,
option->value.i);
break;
+ case OPTION_UINT:
+ slen = snprintf(string + pos,
+ size - pos,
+ "%u",
+ option->value.u);
+ break;
+
case OPTION_COLOUR:
rgbcolour = (((0x000000FF & option->value.c) << 16) |
((0x0000FF00 & option->value.c) << 0) |
@@ -616,6 +647,12 @@ nsoption_snoptionf(char *string,
"integer");
break;
+ case OPTION_UINT:
+ slen += snprintf(string + slen,
+ size - slen,
+ "unsigned integer");
+ break;
+
case OPTION_COLOUR:
slen += snprintf(string + slen,
size - slen,
diff --git a/utils/nsoption.h b/utils/nsoption.h
index 0b8caa9..3ace847 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -53,6 +53,7 @@ typedef uint32_t colour;
#define NSOPTION_BOOL(NAME, DEFAULT)
#define NSOPTION_STRING(NAME, DEFAULT)
#define NSOPTION_INTEGER(NAME, DEFAULT)
+#define NSOPTION_UINT(NAME, DEFAULT)
#define NSOPTION_COLOUR(NAME, DEFAULT)
#include "desktop/options.h"
@@ -75,6 +76,7 @@ typedef uint32_t colour;
#undef NSOPTION_BOOL
#undef NSOPTION_STRING
#undef NSOPTION_INTEGER
+#undef NSOPTION_UINT
#undef NSOPTION_COLOUR
@@ -96,6 +98,7 @@ enum { OPTION_HTTP_PROXY_AUTH_NONE = 0,
enum nsoption_type_e {
OPTION_BOOL,
OPTION_INTEGER,
+ OPTION_UINT,
OPTION_STRING,
OPTION_COLOUR
};
@@ -107,6 +110,7 @@ struct nsoption_s {
union {
bool b;
int i;
+ unsigned int u;
char *s;
const char *cs;
colour c;
@@ -117,6 +121,7 @@ struct nsoption_s {
#define NSOPTION_BOOL(NAME, DEFAULT) NSOPTION_##NAME,
#define NSOPTION_STRING(NAME, DEFAULT) NSOPTION_##NAME,
#define NSOPTION_INTEGER(NAME, DEFAULT) NSOPTION_##NAME,
+#define NSOPTION_UINT(NAME, DEFAULT) NSOPTION_##NAME,
#define NSOPTION_COLOUR(NAME, DEFAULT) NSOPTION_##NAME,
enum nsoption_e {
@@ -142,6 +147,7 @@ enum nsoption_e {
#undef NSOPTION_BOOL
#undef NSOPTION_STRING
#undef NSOPTION_INTEGER
+#undef NSOPTION_UINT
#undef NSOPTION_COLOUR
/* global option table */
@@ -230,6 +236,7 @@ int nsoption_snoptionf(char *string, size_t size, enum nsoption_e option, const
/* value acessors - caution should be taken with type as this is not verified */
#define nsoption_bool(OPTION) (nsoptions[NSOPTION_##OPTION].value.b)
#define nsoption_int(OPTION) (nsoptions[NSOPTION_##OPTION].value.i)
+#define nsoption_uint(OPTION) (nsoptions[NSOPTION_##OPTION].value.u)
#define nsoption_charp(OPTION) (nsoptions[NSOPTION_##OPTION].value.s)
#define nsoption_colour(OPTION) (nsoptions[NSOPTION_##OPTION].value.c)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1b50a7478c0700a49a0...
commit 1b50a7478c0700a49a02519a56e45380909fcea3
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fixup monkey errors
diff --git a/monkey/main.c b/monkey/main.c
index a595c5c..0a9826a 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -101,6 +101,7 @@ static void quit_handler(int argc, char **argv)
static nserror set_defaults(struct nsoption_s *defaults)
{
/* currently no default overrides */
+ return NSERROR_OK;
}
/**
@@ -120,7 +121,8 @@ main(int argc, char **argv)
char *messages;
char *options;
char buf[PATH_MAX];
-
+ nserror ret;
+
/* Unbuffer stdin/out/err */
setbuf(stdin, NULL);
setbuf(stdout, NULL);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=25d84be42ee06d2688f...
commit 25d84be42ee06d2688f8f9a23b5ccf492cefaec1
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
remove unecessary colour parameter setting
diff --git a/gtk/gui.c b/gtk/gui.c
index c6305eb..ac743c5 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -294,36 +294,6 @@ static nserror set_defaults(struct nsoption_s *defaults)
nsoption_set_charp(font_cursive, strdup("Serif"));
nsoption_set_charp(font_fantasy, strdup("Serif"));
- /* set system colours for gtk ui */
- nsoption_set_colour(sys_colour_ActiveBorder, 0xff000000);
- nsoption_set_colour(sys_colour_ActiveCaption, 0xffdddddd);
- nsoption_set_colour(sys_colour_AppWorkspace, 0xffeeeeee);
- nsoption_set_colour(sys_colour_Background, 0xff0000aa);
- nsoption_set_colour(sys_colour_ButtonFace, 0xffaaaaaa);
- nsoption_set_colour(sys_colour_ButtonHighlight, 0xffdddddd);
- nsoption_set_colour(sys_colour_ButtonShadow, 0xffbbbbbb);
- nsoption_set_colour(sys_colour_ButtonText, 0xff000000);
- nsoption_set_colour(sys_colour_CaptionText, 0xff000000);
- nsoption_set_colour(sys_colour_GrayText, 0xffcccccc);
- nsoption_set_colour(sys_colour_Highlight, 0xff0000ee);
- nsoption_set_colour(sys_colour_HighlightText, 0xff000000);
- nsoption_set_colour(sys_colour_InactiveBorder, 0xffffffff);
- nsoption_set_colour(sys_colour_InactiveCaption, 0xffffffff);
- nsoption_set_colour(sys_colour_InactiveCaptionText, 0xffcccccc);
- nsoption_set_colour(sys_colour_InfoBackground, 0xffaaaaaa);
- nsoption_set_colour(sys_colour_InfoText, 0xff000000);
- nsoption_set_colour(sys_colour_Menu, 0xffaaaaaa);
- nsoption_set_colour(sys_colour_MenuText, 0xff000000);
- nsoption_set_colour(sys_colour_Scrollbar, 0xffaaaaaa);
- nsoption_set_colour(sys_colour_ThreeDDarkShadow, 0xff555555);
- nsoption_set_colour(sys_colour_ThreeDFace, 0xffdddddd);
- nsoption_set_colour(sys_colour_ThreeDHighlight, 0xffaaaaaa);
- nsoption_set_colour(sys_colour_ThreeDLightShadow, 0xff999999);
- nsoption_set_colour(sys_colour_ThreeDShadow, 0xff777777);
- nsoption_set_colour(sys_colour_Window, 0xffaaaaaa);
- nsoption_set_colour(sys_colour_WindowFrame, 0xff000000);
- nsoption_set_colour(sys_colour_WindowText, 0xff000000);
-
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a47105402a9e0a2c739...
commit a47105402a9e0a2c7398dafdf0c2f44848a041bb
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
make monkey frontend use new options code
diff --git a/monkey/Makefile.target b/monkey/Makefile.target
index 05a32d0..6c60ca1 100644
--- a/monkey/Makefile.target
+++ b/monkey/Makefile.target
@@ -66,7 +66,7 @@ endif
# ----------------------------------------------------------------------------
# S_MONKEY are sources purely for the MONKEY build
-S_MONKEY := main.c utils.c filetype.c schedule.c system_colour.c \
+S_MONKEY := main.c utils.c filetype.c schedule.c \
bitmap.c plot.c browser.c download.c thumbnail.c \
401login.c cert.c font.c poll.c dispatch.c
diff --git a/monkey/main.c b/monkey/main.c
index 2e37317..a595c5c 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -92,10 +92,15 @@ static void quit_handler(int argc, char **argv)
netsurf_quit = true;
}
-/* Documented in utils/nsoption.h */
-void gui_options_init_defaults(void)
+/**
+ * Set option defaults for monkey frontend
+ *
+ * @param defaults The option table to update.
+ * @return error status.
+ */
+static nserror set_defaults(struct nsoption_s *defaults)
{
- /* Set defaults for absent option strings */
+ /* currently no default overrides */
}
/**
@@ -123,19 +128,29 @@ main(int argc, char **argv)
/* Prep the search paths */
respaths = nsmonkey_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"MONKEY_RESPATH":./monkey/res");
-
- options = filepath_find(respaths, "Choices");
- messages = filepath_find(respaths, "Messages");
/* initialise logging. Not fatal if it fails but not much we can do
* about it either.
*/
nslog_init(nslog_stream_configure, &argc, argv);
- netsurf_init(&argc, &argv, options, messages);
-
- free(messages);
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ options = filepath_find(respaths, "Choices");
+ nsoption_read(options, NULL);
free(options);
+ nsoption_commandline(&argc, argv, NULL);
+
+ /* common initialisation */
+ messages = filepath_find(respaths, "Messages");
+ ret = netsurf_init(messages);
+ free(messages);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
filepath_sfinddef(respaths, buf, "mime.types", "/etc/");
gtk_fetch_filetype_init(buf);
diff --git a/monkey/system_colour.c b/monkey/system_colour.c
deleted file mode 100644
index c136e50..0000000
--- a/monkey/system_colour.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright 2011 Vincent Sanders <vince(a)netsurf-browser.org>
- *
- * 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
- * System colour handling
- *
- */
-
-#include "utils/utils.h"
-#include "utils/log.h"
-#include "desktop/gui.h"
-#include "utils/nsoption.h"
-
-struct gui_system_colour_ctx {
- const char *name;
- int length;
- css_color colour;
- colour *option_colour;
- lwc_string *lwcstr;
-};
-
-static struct gui_system_colour_ctx colour_list[] = {
- {
- "ActiveBorder",
- SLEN("ActiveBorder"),
- 0xff000000,
- &nsoption_charp(sys_colour_ActiveBorder),
- NULL
- }, {
- "ActiveCaption",
- SLEN("ActiveCaption"),
- 0xffdddddd,
- &nsoption_charp(sys_colour_ActiveCaption),
- NULL
- }, {
- "AppWorkspace",
- SLEN("AppWorkspace"),
- 0xffeeeeee,
- &nsoption_charp(sys_colour_AppWorkspace),
- NULL
- }, {
- "Background",
- SLEN("Background"),
- 0xff0000aa,
- &nsoption_charp(sys_colour_Background),
- NULL
- }, {
- "ButtonFace",
- SLEN("ButtonFace"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_ButtonFace),
- NULL
- }, {
- "ButtonHighlight",
- SLEN("ButtonHighlight"),
- 0xffdddddd,
- &nsoption_charp(sys_colour_ButtonHighlight),
- NULL
- }, {
- "ButtonShadow",
- SLEN("ButtonShadow"),
- 0xffbbbbbb,
- &nsoption_charp(sys_colour_ButtonShadow),
- NULL
- }, {
- "ButtonText",
- SLEN("ButtonText"),
- 0xff000000,
- &nsoption_charp(sys_colour_ButtonText),
- NULL
- }, {
- "CaptionText",
- SLEN("CaptionText"),
- 0xff000000,
- &nsoption_charp(sys_colour_CaptionText),
- NULL
- }, {
- "GrayText",
- SLEN("GrayText"),
- 0xffcccccc,
- &nsoption_charp(sys_colour_GrayText),
- NULL
- }, {
- "Highlight",
- SLEN("Highlight"),
- 0xff0000ee,
- &nsoption_charp(sys_colour_Highlight),
- NULL
- }, {
- "HighlightText",
- SLEN("HighlightText"),
- 0xff000000,
- &nsoption_charp(sys_colour_HighlightText),
- NULL
- }, {
- "InactiveBorder",
- SLEN("InactiveBorder"),
- 0xffffffff,
- &nsoption_charp(sys_colour_InactiveBorder),
- NULL
- }, {
- "InactiveCaption",
- SLEN("InactiveCaption"),
- 0xffffffff,
- &nsoption_charp(sys_colour_InactiveCaption),
- NULL
- }, {
- "InactiveCaptionText",
- SLEN("InactiveCaptionText"),
- 0xffcccccc,
- &nsoption_charp(sys_colour_InactiveCaptionText),
- NULL
- }, {
- "InfoBackground",
- SLEN("InfoBackground"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_InfoBackground),
- NULL
- }, {
- "InfoText",
- SLEN("InfoText"),
- 0xff000000,
- &nsoption_charp(sys_colour_InfoText),
- NULL
- }, {
- "Menu",
- SLEN("Menu"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_Menu),
- NULL
- }, {
- "MenuText",
- SLEN("MenuText"),
- 0xff000000,
- &nsoption_charp(sys_colour_MenuText),
- NULL
- }, {
- "Scrollbar",
- SLEN("Scrollbar"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_Scrollbar),
- NULL
- }, {
- "ThreeDDarkShadow",
- SLEN("ThreeDDarkShadow"),
- 0xff555555,
- &nsoption_charp(sys_colour_ThreeDDarkShadow),
- NULL
- }, {
- "ThreeDFace",
- SLEN("ThreeDFace"),
- 0xffdddddd,
- &nsoption_charp(sys_colour_ThreeDFace),
- NULL
- }, {
- "ThreeDHighlight",
- SLEN("ThreeDHighlight"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_ThreeDHighlight),
- NULL
- }, {
- "ThreeDLightShadow",
- SLEN("ThreeDLightShadow"),
- 0xff999999,
- &nsoption_charp(sys_colour_ThreeDLightShadow),
- NULL
- }, {
- "ThreeDShadow",
- SLEN("ThreeDShadow"),
- 0xff777777,
- &nsoption_charp(sys_colour_ThreeDShadow),
- NULL
- }, {
- "Window",
- SLEN("Window"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_Window),
- NULL
- }, {
- "WindowFrame",
- SLEN("WindowFrame"),
- 0xff000000,
- &nsoption_charp(sys_colour_WindowFrame),
- NULL
- }, {
-
- "WindowText",
- SLEN("WindowText"),
- 0xff000000,
- &nsoption_charp(sys_colour_WindowText),
- NULL
- },
-
-};
-
-#define colour_list_len (sizeof(colour_list) / sizeof(struct gui_system_colour_ctx))
-
-static struct gui_system_colour_ctx *gui_system_colour_pw = NULL;
-
-
-bool gui_system_colour_init(void)
-{
- unsigned int ccount;
-
- if (gui_system_colour_pw != NULL)
- return false;
-
- /* Intern colour strings */
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (lwc_intern_string(colour_list[ccount].name,
- colour_list[ccount].length,
- &(colour_list[ccount].lwcstr)) != lwc_error_ok) {
- return false;
- }
- }
-
- /* pull in options if set (ie not transparent) */
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (*(colour_list[ccount].option_colour) != 0) {
- colour_list[ccount].colour = *(colour_list[ccount].option_colour);
- }
- }
-
- gui_system_colour_pw = colour_list;
-
- return true;
-}
-
-void gui_system_colour_finalize(void)
-{
- unsigned int ccount;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- lwc_string_unref(colour_list[ccount].lwcstr);
- }
-}
-
-colour gui_system_colour_char(const char *name)
-{
- colour ret = 0xff00000;
- unsigned int ccount;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (strcmp(name, colour_list[ccount].name) == 0) {
- ret = colour_list[ccount].colour;
- break;
- }
- }
- return ret;
-}
-
-css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
-{
- unsigned int ccount;
- bool match;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (lwc_string_caseless_isequal(name,
- colour_list[ccount].lwcstr,
- &match) == lwc_error_ok && match) {
- *colour = colour_list[ccount].colour;
- return CSS_OK;
- }
- }
-
- return CSS_INVALID;
-}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=3fc74bed92ae41438cd...
commit 3fc74bed92ae41438cd14454d6d143815be569b2
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
set some sensible default system colours
diff --git a/desktop/options.h b/desktop/options.h
index ee441c6..4598b30 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -244,32 +244,31 @@ NSOPTION_BOOL(enable_PDF_compression, true)
NSOPTION_BOOL(enable_PDF_password, false)
/******** System colours ********/
-NSOPTION_COLOUR(sys_colour_ActiveBorder, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ActiveCaption, 0x00000000)
-NSOPTION_COLOUR(sys_colour_AppWorkspace, 0x00000000)
-NSOPTION_COLOUR(sys_colour_Background, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ButtonFace, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ButtonHighlight, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ButtonShadow, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ButtonText, 0x00000000)
-NSOPTION_COLOUR(sys_colour_CaptionText, 0x00000000)
-NSOPTION_COLOUR(sys_colour_GrayText, 0x00000000)
-NSOPTION_COLOUR(sys_colour_Highlight, 0x00000000)
-NSOPTION_COLOUR(sys_colour_HighlightText, 0x00000000)
-NSOPTION_COLOUR(sys_colour_InactiveBorder, 0x00000000)
-NSOPTION_COLOUR(sys_colour_InactiveCaption, 0x00000000)
-NSOPTION_COLOUR(sys_colour_InactiveCaptionText, 0x00000000)
-NSOPTION_COLOUR(sys_colour_InfoBackground, 0x00000000)
-NSOPTION_COLOUR(sys_colour_InfoText, 0x00000000)
-NSOPTION_COLOUR(sys_colour_Menu, 0x00000000)
-NSOPTION_COLOUR(sys_colour_MenuText, 0x00000000)
-NSOPTION_COLOUR(sys_colour_Scrollbar, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ThreeDDarkShadow, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ThreeDFace, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ThreeDHighlight, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ThreeDLightShadow, 0x00000000)
-NSOPTION_COLOUR(sys_colour_ThreeDShadow, 0x00000000)
-NSOPTION_COLOUR(sys_colour_Window, 0x00000000)
-NSOPTION_COLOUR(sys_colour_WindowFrame, 0x00000000)
-NSOPTION_COLOUR(sys_colour_WindowText, 0x00000000)
-
+NSOPTION_COLOUR(sys_colour_ActiveBorder, 0xff000000)
+NSOPTION_COLOUR(sys_colour_ActiveCaption, 0xffdddddd)
+NSOPTION_COLOUR(sys_colour_AppWorkspace, 0xffeeeeee)
+NSOPTION_COLOUR(sys_colour_Background, 0xff0000aa)
+NSOPTION_COLOUR(sys_colour_ButtonFace, 0xffaaaaaa)
+NSOPTION_COLOUR(sys_colour_ButtonHighlight, 0xffdddddd)
+NSOPTION_COLOUR(sys_colour_ButtonShadow, 0xffbbbbbb)
+NSOPTION_COLOUR(sys_colour_ButtonText, 0xff000000)
+NSOPTION_COLOUR(sys_colour_CaptionText, 0xff000000)
+NSOPTION_COLOUR(sys_colour_GrayText, 0xffcccccc)
+NSOPTION_COLOUR(sys_colour_Highlight, 0xff0000ee)
+NSOPTION_COLOUR(sys_colour_HighlightText, 0xff000000)
+NSOPTION_COLOUR(sys_colour_InactiveBorder, 0xffffffff)
+NSOPTION_COLOUR(sys_colour_InactiveCaption, 0xffffffff)
+NSOPTION_COLOUR(sys_colour_InactiveCaptionText, 0xffcccccc)
+NSOPTION_COLOUR(sys_colour_InfoBackground, 0xffaaaaaa)
+NSOPTION_COLOUR(sys_colour_InfoText, 0xff000000)
+NSOPTION_COLOUR(sys_colour_Menu, 0xffaaaaaa)
+NSOPTION_COLOUR(sys_colour_MenuText, 0xff000000)
+NSOPTION_COLOUR(sys_colour_Scrollbar, 0xffaaaaaa)
+NSOPTION_COLOUR(sys_colour_ThreeDDarkShadow, 0xff555555)
+NSOPTION_COLOUR(sys_colour_ThreeDFace, 0xffdddddd)
+NSOPTION_COLOUR(sys_colour_ThreeDHighlight, 0xffaaaaaa)
+NSOPTION_COLOUR(sys_colour_ThreeDLightShadow, 0xff999999)
+NSOPTION_COLOUR(sys_colour_ThreeDShadow, 0xff777777)
+NSOPTION_COLOUR(sys_colour_Window, 0xffaaaaaa)
+NSOPTION_COLOUR(sys_colour_WindowFrame, 0xff000000)
+NSOPTION_COLOUR(sys_colour_WindowText, 0xff000000)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d146a08d946bc5e6579...
commit d146a08d946bc5e65798abbe0b03db90f65a31c0
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
ensure all required headers included
diff --git a/utils/nsoption.h b/utils/nsoption.h
index c7b4b11..0b8caa9 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -42,8 +42,12 @@
#ifndef _NETSURF_UTILS_NSOPTION_H_
#define _NETSURF_UTILS_NSOPTION_H_
-typedef uint32_t colour;
#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "utils/errors.h"
+typedef uint32_t colour;
/* allow targets to include any necessary headers of their own */
#define NSOPTION_BOOL(NAME, DEFAULT)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d37dc7b9fb6531a01d6...
commit d37dc7b9fb6531a01d6ad3534b53376cf7bd9052
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
remove junk include protection
diff --git a/monkey/options.h b/monkey/options.h
index 3680187..57cce7e 100644
--- a/monkey/options.h
+++ b/monkey/options.h
@@ -16,10 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
-#error "Frontend options header cannot be included directly"
-#endif
-
#ifndef _NETSURF_MONKEY_OPTIONS_H_
#define _NETSURF_MONKEY_OPTIONS_H_
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=abe58a3d22f07d0a28b...
commit abe58a3d22f07d0a28baed64469c6bce6478942d
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
port framebuffer to new options code
move sys_colour code to be common
diff --git a/desktop/Makefile b/desktop/Makefile
index cdab1c4..f91754e 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -3,7 +3,7 @@
S_DESKTOP := cookies.c history_global_core.c hotlist.c knockout.c \
mouse.c plot_style.c print.c search.c searchweb.c \
scrollbar.c sslcert.c textarea.c thumbnail.c tree.c \
- tree_url_node.c version.c
+ tree_url_node.c version.c system_colour.c
S_DESKTOP := $(addprefix desktop/,$(S_DESKTOP))
diff --git a/desktop/system_colour.c b/desktop/system_colour.c
new file mode 100644
index 0000000..ab627c9
--- /dev/null
+++ b/desktop/system_colour.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2011 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * 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
+ * System colour handling
+ *
+ */
+
+#include "utils/utils.h"
+#include "utils/log.h"
+#include "desktop/gui.h"
+#include "utils/nsoption.h"
+
+
+
+#define colour_list_len ((NSOPTION_SYS_COLOUR_END - NSOPTION_SYS_COLOUR_START) + 1)
+
+static lwc_string *colour_list[colour_list_len];
+
+static lwc_string **gui_system_colour_pw = NULL;
+
+
+bool gui_system_colour_init(void)
+{
+ unsigned int ccount;
+
+ if (gui_system_colour_pw != NULL)
+ return false;
+
+ /* Intern colour strings */
+ for (ccount = 0; ccount < colour_list_len; ccount++) {
+ struct nsoption_s *opt;
+ opt = &nsoptions[ccount + NSOPTION_SYS_COLOUR_START];
+ if (lwc_intern_string(opt->key + SLEN("sys_colour_"),
+ opt->key_len - SLEN("sys_colour_"),
+ &(colour_list[ccount])) != lwc_error_ok) {
+ return false;
+ }
+ }
+
+ gui_system_colour_pw = colour_list;
+
+ return true;
+}
+
+void gui_system_colour_finalize(void)
+{
+ unsigned int ccount;
+
+ for (ccount = 0; ccount < colour_list_len; ccount++) {
+ lwc_string_unref(colour_list[ccount]);
+ }
+}
+
+colour gui_system_colour_char(const char *name)
+{
+ colour ret = 0xff00000;
+ unsigned int ccount;
+
+ for (ccount = 0; ccount < colour_list_len; ccount++) {
+ if (strcmp(name,
+ nsoptions[ccount + NSOPTION_SYS_COLOUR_START].key + SLEN("sys_colour_")) == 0) {
+ ret = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c;
+ break;
+ }
+ }
+ return ret;
+}
+
+css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
+{
+ unsigned int ccount;
+ bool match;
+
+ for (ccount = 0; ccount < colour_list_len; ccount++) {
+ if (lwc_string_caseless_isequal(name,
+ colour_list[ccount],
+ &match) == lwc_error_ok && match) {
+ *colour = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c;
+ return CSS_OK;
+ }
+ }
+
+ return CSS_INVALID;
+}
diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target
index 1441710..bad31ed 100644
--- a/framebuffer/Makefile.target
+++ b/framebuffer/Makefile.target
@@ -138,7 +138,7 @@ $(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V
# S_FRAMEBUFFER are sources purely for the framebuffer build
S_FRAMEBUFFER := gui.c framebuffer.c tree.c schedule.c \
thumbnail.c misc.c bitmap.c filetype.c login.c findfile.c \
- localhistory.c system_colour.c clipboard.c
+ localhistory.c clipboard.c
S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c \
text.c scroll.c osk.c
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 80322ec..3423e04 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -476,46 +476,59 @@ process_cmdline(int argc, char** argv)
return true;
}
-/* Documented in utils/nsoption.h */
-void gui_options_init_defaults(void)
+/**
+ * Set option defaults for framebuffer frontend
+ *
+ * @param defaults The option table to update.
+ * @return error status.
+ */
+static nserror set_defaults(struct nsoption_s *defaults)
{
/* Set defaults for absent option strings */
nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));
if (nsoption_charp(cookie_file) == NULL ||
- nsoption_charp(cookie_jar == NULL)) {
- die("Failed initialising cookie options");
+ nsoption_charp(cookie_jar) == NULL) {
+ LOG(("Failed initialising cookie options"));
+ return NSERROR_BAD_PARAMETER;
}
-}
-
-static void
-gui_init(int argc, char** argv)
-{
- nsfb_t *nsfb;
-
- /* Override, since we have no support for non-core SELECT menu */
- nsoption_set_bool(core_select_menu, true);
-
- if (process_cmdline(argc,argv) != true)
- die("unable to process command line.\n");
-
- nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
- if (nsfb == NULL)
- die("Unable to initialise framebuffer");
-
- framebuffer_set_cursor(&pointer_image);
- if (fb_font_init() == false)
- die("Unable to initialise the font system");
- fbtk = fbtk_init(nsfb);
+ /* set system colours for gtk ui */
+ nsoption_set_colour(sys_colour_ActiveBorder, 0xff000000);
+ nsoption_set_colour(sys_colour_ActiveCaption, 0xffddddcc);
+ nsoption_set_colour(sys_colour_AppWorkspace, 0xffeeeeee);
+ nsoption_set_colour(sys_colour_Background, 0xff0000aa);
+ nsoption_set_colour(sys_colour_ButtonFace, 0xffdddddd);
+ nsoption_set_colour(sys_colour_ButtonHighlight, 0xffcccccc);
+ nsoption_set_colour(sys_colour_ButtonShadow, 0xffbbbbbb);
+ nsoption_set_colour(sys_colour_ButtonText, 0xff000000);
+ nsoption_set_colour(sys_colour_CaptionText, 0xff000000);
+ nsoption_set_colour(sys_colour_GrayText, 0xff777777);
+ nsoption_set_colour(sys_colour_Highlight, 0xff0000ee);
+ nsoption_set_colour(sys_colour_HighlightText, 0xff000000);
+ nsoption_set_colour(sys_colour_InactiveBorder, 0xff000000);
+ nsoption_set_colour(sys_colour_InactiveCaption, 0xffffffff);
+ nsoption_set_colour(sys_colour_InactiveCaptionText, 0xffcccccc);
+ nsoption_set_colour(sys_colour_InfoBackground, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_InfoText, 0xff000000);
+ nsoption_set_colour(sys_colour_Menu, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_MenuText, 0xff000000);
+ nsoption_set_colour(sys_colour_Scrollbar, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_ThreeDDarkShadow, 0xff555555);
+ nsoption_set_colour(sys_colour_ThreeDFace, 0xffdddddd);
+ nsoption_set_colour(sys_colour_ThreeDHighlight, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_ThreeDLightShadow, 0xff999999);
+ nsoption_set_colour(sys_colour_ThreeDShadow, 0xff777777);
+ nsoption_set_colour(sys_colour_Window, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_WindowFrame, 0xff000000);
+ nsoption_set_colour(sys_colour_WindowText, 0xff000000);
- fbtk_enable_oskb(fbtk);
-
- urldb_load_cookies(nsoption_charp(cookie_file));
+ return NSERROR_OK;
}
+
/**
* Ensures output logging stream is correctly configured
*/
@@ -540,32 +553,62 @@ main(int argc, char** argv)
char *options;
char *messages;
nsurl *url;
- nserror error;
+ nserror ret;
+ nsfb_t *nsfb;
respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
- options = filepath_find(respaths, "Choices");
- messages = filepath_find(respaths, "messages");
-
/* initialise logging. Not fatal if it fails but not much we
* can do about it either.
*/
nslog_init(nslog_stream_configure, &argc, argv);
- netsurf_init(&argc, &argv, options, messages);
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ options = filepath_find(respaths, "Choices");
+ nsoption_read(options, NULL);
+ free(options);
+ nsoption_commandline(&argc, argv, NULL);
+ /* common initialisation */
+ messages = filepath_find(respaths, "Messages");
+ ret = netsurf_init(messages);
free(messages);
- free(options);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
- gui_init(argc, argv);
+ /* Override, since we have no support for non-core SELECT menu */
+ nsoption_set_bool(core_select_menu, true);
+
+ if (process_cmdline(argc,argv) != true)
+ die("unable to process command line.\n");
+
+ nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
+ if (nsfb == NULL)
+ die("Unable to initialise framebuffer");
+
+ framebuffer_set_cursor(&pointer_image);
+
+ if (fb_font_init() == false)
+ die("Unable to initialise the font system");
+
+ fbtk = fbtk_init(nsfb);
+
+ fbtk_enable_oskb(fbtk);
+
+ urldb_load_cookies(nsoption_charp(cookie_file));
/* create an initial browser window */
LOG(("calling browser_window_create"));
- error = nsurl_create(feurl, &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
+ ret = nsurl_create(feurl, &url);
+ if (ret == NSERROR_OK) {
+ ret = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
BROWSER_WINDOW_HISTORY,
url,
NULL,
@@ -573,8 +616,8 @@ main(int argc, char** argv)
&bw);
nsurl_unref(url);
}
- if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
+ if (ret != NSERROR_OK) {
+ warn_user(messages_get_errorcode(ret), 0);
} else {
netsurf_main_loop();
diff --git a/framebuffer/options.h b/framebuffer/options.h
index 5cb5bfb..eee6f4b 100644
--- a/framebuffer/options.h
+++ b/framebuffer/options.h
@@ -57,7 +57,7 @@ NSOPTION_STRING(fb_face_sans_serif_bold, NULL)
NSOPTION_STRING(fb_face_sans_serif_italic, NULL)
NSOPTION_STRING(fb_face_sans_serif_italic_bold, NULL)
NSOPTION_STRING(fb_face_serif, NULL)
-NSOPTION_STRING(fb_serif_bold, NULL)
+NSOPTION_STRING(fb_face_serif_bold, NULL)
NSOPTION_STRING(fb_face_monospace, NULL)
NSOPTION_STRING(fb_face_monospace_bold, NULL)
NSOPTION_STRING(fb_face_cursive, NULL)
diff --git a/framebuffer/system_colour.c b/framebuffer/system_colour.c
deleted file mode 100644
index 139cd47..0000000
--- a/framebuffer/system_colour.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright 2011 Vincent Sanders <vince(a)netsurf-browser.org>
- *
- * 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
- * System colour handling
- *
- */
-
-#include "utils/utils.h"
-#include "utils/log.h"
-#include "desktop/gui.h"
-#include "utils/nsoption.h"
-
-struct gui_system_colour_ctx {
- const char *name;
- int length;
- css_color colour;
- colour *option_colour;
- lwc_string *lwcstr;
-};
-
-static struct gui_system_colour_ctx colour_list[] = {
- {
- "ActiveBorder",
- SLEN("ActiveBorder"),
- 0xff000000,
- &nsoption_colour(sys_colour_ActiveBorder),
- NULL
- }, {
- "ActiveCaption",
- SLEN("ActiveCaption"),
- 0xffddddcc,
- &nsoption_colour(sys_colour_ActiveCaption),
- NULL
- }, {
- "AppWorkspace",
- SLEN("AppWorkspace"),
- 0xffeeeeee,
- &nsoption_colour(sys_colour_AppWorkspace),
- NULL
- }, {
- "Background",
- SLEN("Background"),
- 0xff0000aa,
- &nsoption_colour(sys_colour_Background),
- NULL
- }, {
- "ButtonFace",
- SLEN("ButtonFace"),
- 0xffdddddd,
- &nsoption_colour(sys_colour_ButtonFace),
- NULL
- }, {
- "ButtonHighlight",
- SLEN("ButtonHighlight"),
- 0xffcccccc,
- &nsoption_colour(sys_colour_ButtonHighlight),
- NULL
- }, {
- "ButtonShadow",
- SLEN("ButtonShadow"),
- 0xffbbbbbb,
- &nsoption_colour(sys_colour_ButtonShadow),
- NULL
- }, {
- "ButtonText",
- SLEN("ButtonText"),
- 0xff000000,
- &nsoption_colour(sys_colour_ButtonText),
- NULL
- }, {
- "CaptionText",
- SLEN("CaptionText"),
- 0xff000000,
- &nsoption_colour(sys_colour_CaptionText),
- NULL
- }, {
- "GrayText",
- SLEN("GrayText"),
- 0xff777777,
- &nsoption_colour(sys_colour_GrayText),
- NULL
- }, {
- "Highlight",
- SLEN("Highlight"),
- 0xff0000ee,
- &nsoption_colour(sys_colour_Highlight),
- NULL
- }, {
- "HighlightText",
- SLEN("HighlightText"),
- 0xff000000,
- &nsoption_colour(sys_colour_HighlightText),
- NULL
- }, {
- "InactiveBorder",
- SLEN("InactiveBorder"),
- 0xff000000,
- &nsoption_colour(sys_colour_InactiveBorder),
- NULL
- }, {
- "InactiveCaption",
- SLEN("InactiveCaption"),
- 0xffffffff,
- &nsoption_colour(sys_colour_InactiveCaption),
- NULL
- }, {
- "InactiveCaptionText",
- SLEN("InactiveCaptionText"),
- 0xffcccccc,
- &nsoption_colour(sys_colour_InactiveCaptionText),
- NULL
- }, {
- "InfoBackground",
- SLEN("InfoBackground"),
- 0xffaaaaaa,
- &nsoption_colour(sys_colour_InfoBackground),
- NULL
- }, {
- "InfoText",
- SLEN("InfoText"),
- 0xff000000,
- &nsoption_colour(sys_colour_InfoText),
- NULL
- }, {
- "Menu",
- SLEN("Menu"),
- 0xffaaaaaa,
- &nsoption_colour(sys_colour_Menu),
- NULL
- }, {
- "MenuText",
- SLEN("MenuText"),
- 0xff000000,
- &nsoption_colour(sys_colour_MenuText),
- NULL
- }, {
- "Scrollbar",
- SLEN("Scrollbar"),
- 0xffaaaaaa,
- &nsoption_colour(sys_colour_Scrollbar),
- NULL
- }, {
- "ThreeDDarkShadow",
- SLEN("ThreeDDarkShadow"),
- 0xff555555,
- &nsoption_colour(sys_colour_ThreeDDarkShadow),
- NULL
- }, {
- "ThreeDFace",
- SLEN("ThreeDFace"),
- 0xffdddddd,
- &nsoption_colour(sys_colour_ThreeDFace),
- NULL
- }, {
- "ThreeDHighlight",
- SLEN("ThreeDHighlight"),
- 0xffaaaaaa,
- &nsoption_colour(sys_colour_ThreeDHighlight),
- NULL
- }, {
- "ThreeDLightShadow",
- SLEN("ThreeDLightShadow"),
- 0xff999999,
- &nsoption_colour(sys_colour_ThreeDLightShadow),
- NULL
- }, {
- "ThreeDShadow",
- SLEN("ThreeDShadow"),
- 0xff777777,
- &nsoption_colour(sys_colour_ThreeDShadow),
- NULL
- }, {
- "Window",
- SLEN("Window"),
- 0xffaaaaaa,
- &nsoption_colour(sys_colour_Window),
- NULL
- }, {
- "WindowFrame",
- SLEN("WindowFrame"),
- 0xff000000,
- &nsoption_colour(sys_colour_WindowFrame),
- NULL
- }, {
-
- "WindowText",
- SLEN("WindowText"),
- 0xff000000,
- &nsoption_colour(sys_colour_WindowText),
- NULL
- },
-
-};
-
-#define colour_list_len (sizeof(colour_list) / sizeof(struct gui_system_colour_ctx))
-
-static struct gui_system_colour_ctx *gui_system_colour_pw = NULL;
-
-
-bool gui_system_colour_init(void)
-{
- unsigned int ccount;
-
- if (gui_system_colour_pw != NULL)
- return false;
-
- /* Intern colour strings */
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (lwc_intern_string(colour_list[ccount].name,
- colour_list[ccount].length,
- &(colour_list[ccount].lwcstr)) != lwc_error_ok) {
- return false;
- }
- }
-
- /* pull in options if set (ie not transparent) */
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (*(colour_list[ccount].option_colour) != 0) {
- colour_list[ccount].colour = *(colour_list[ccount].option_colour);
- }
- }
-
- gui_system_colour_pw = colour_list;
-
- return true;
-}
-
-void gui_system_colour_finalize(void)
-{
- unsigned int ccount;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- lwc_string_unref(colour_list[ccount].lwcstr);
- }
-}
-
-colour gui_system_colour_char(const char *name)
-{
- colour ret = 0xff00000;
- unsigned int ccount;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (strcmp(name, colour_list[ccount].name) == 0) {
- ret = colour_list[ccount].colour;
- break;
- }
- }
- return ret;
-}
-
-css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
-{
- unsigned int ccount;
- bool match;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (lwc_string_caseless_isequal(name,
- colour_list[ccount].lwcstr,
- &match) == lwc_error_ok && match) {
- *colour = colour_list[ccount].colour;
- return CSS_OK;
- }
- }
-
- return CSS_INVALID;
-}
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index 16b9325..ae67fd7 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -111,7 +111,7 @@ S_GTK := font_pango.c bitmap.c gui.c schedule.c thumbnail.c plotters.c \
treeview.c scaffolding.c gdk.c completion.c login.c throbber.c \
selection.c history.c window.c filetype.c download.c menu.c \
print.c search.c tabs.c theme.c toolbar.c gettext.c \
- compat.c cookies.c hotlist.c system_colour.c \
+ compat.c cookies.c hotlist.c \
$(addprefix dialogs/,preferences.c about.c source.c)
S_GTK := $(addprefix gtk/,$(S_GTK)) $(addprefix utils/,container.c)
diff --git a/gtk/system_colour.c b/gtk/system_colour.c
deleted file mode 100644
index ab627c9..0000000
--- a/gtk/system_colour.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2011 Vincent Sanders <vince(a)netsurf-browser.org>
- *
- * 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
- * System colour handling
- *
- */
-
-#include "utils/utils.h"
-#include "utils/log.h"
-#include "desktop/gui.h"
-#include "utils/nsoption.h"
-
-
-
-#define colour_list_len ((NSOPTION_SYS_COLOUR_END - NSOPTION_SYS_COLOUR_START) + 1)
-
-static lwc_string *colour_list[colour_list_len];
-
-static lwc_string **gui_system_colour_pw = NULL;
-
-
-bool gui_system_colour_init(void)
-{
- unsigned int ccount;
-
- if (gui_system_colour_pw != NULL)
- return false;
-
- /* Intern colour strings */
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- struct nsoption_s *opt;
- opt = &nsoptions[ccount + NSOPTION_SYS_COLOUR_START];
- if (lwc_intern_string(opt->key + SLEN("sys_colour_"),
- opt->key_len - SLEN("sys_colour_"),
- &(colour_list[ccount])) != lwc_error_ok) {
- return false;
- }
- }
-
- gui_system_colour_pw = colour_list;
-
- return true;
-}
-
-void gui_system_colour_finalize(void)
-{
- unsigned int ccount;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- lwc_string_unref(colour_list[ccount]);
- }
-}
-
-colour gui_system_colour_char(const char *name)
-{
- colour ret = 0xff00000;
- unsigned int ccount;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (strcmp(name,
- nsoptions[ccount + NSOPTION_SYS_COLOUR_START].key + SLEN("sys_colour_")) == 0) {
- ret = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c;
- break;
- }
- }
- return ret;
-}
-
-css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
-{
- unsigned int ccount;
- bool match;
-
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (lwc_string_caseless_isequal(name,
- colour_list[ccount],
- &match) == lwc_error_ok && match) {
- *colour = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c;
- return CSS_OK;
- }
- }
-
- return CSS_INVALID;
-}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=860c8133e43d973f7b7...
commit 860c8133e43d973f7b720d864607562c27d2d748
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
modify atari defaults
diff --git a/atari/gui.c b/atari/gui.c
index 97d63ce..1133cae 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -930,8 +930,6 @@ void gui_options_init_defaults(void)
if (nsoption_charp(cookie_file) == NULL) {
die("Failed initialising string options");
}
-
- nsoption_set_int(min_reflow_period, 350);
}
static void gui_init(int argc, char** argv)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b09b1e68d954000d710...
commit b09b1e68d954000d710f733cbfb34741c9ba1d33
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
modify amiga defaults
diff --git a/amiga/gui.c b/amiga/gui.c
index dcbf90b..bbd8444 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -440,9 +440,6 @@ void ami_set_options(void)
(char *)strdup("PROGDIR:Resources/ca-bundle"));
- nsoption_setnull_charp(search_engines_file,
- (char *)strdup("PROGDIR:Resources/SearchEngines"));
-
search_engines_file_location = nsoption_charp(search_engines_file);
sprintf(temp, "%s/FontGlyphCache", current_user_dir);
@@ -474,15 +471,8 @@ void ami_set_options(void)
}
}
- nsoption_setnull_charp(theme,
- (char *)strdup("PROGDIR:Resources/Themes/Default"));
-
tree_set_icon_dir(strdup("ENV:Sys"));
- nsoption_setnull_charp(arexx_dir, (char *)strdup("Rexx"));
- nsoption_setnull_charp(arexx_startup, (char *)strdup("Startup.nsrx"));
- nsoption_setnull_charp(arexx_shutdown, (char *)strdup("Shutdown.nsrx"));
-
if(!nsoption_int(window_width)) nsoption_set_int(window_width, 800);
if(!nsoption_int(window_height)) nsoption_set_int(window_height, 600);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=e31d8b3cfe36ae52230...
commit e31d8b3cfe36ae522308c118924eb6a8ab74a3e0
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
move gtk frontend to use new options API
diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c
index ca4ac2e..f17f1cc 100644
--- a/gtk/dialogs/preferences.c
+++ b/gtk/dialogs/preferences.c
@@ -999,7 +999,7 @@ G_MODULE_EXPORT void
nsgtk_preferences_dialogPreferences_response(GtkDialog *dlg, gint resid)
{
if (resid == GTK_RESPONSE_CLOSE) {
- nsoption_write(options_file_location);
+ nsoption_write(options_file_location, NULL, NULL);
gtk_widget_hide(GTK_WIDGET(dlg));
}
}
@@ -1008,7 +1008,7 @@ G_MODULE_EXPORT gboolean
nsgtk_preferences_dialogPreferences_deleteevent(GtkDialog *dlg,
struct ppref *priv)
{
- nsoption_write(options_file_location);
+ nsoption_write(options_file_location, NULL, NULL);
gtk_widget_hide(GTK_WIDGET(dlg));
/* delt with it by hiding window, no need to destory widget by
@@ -1019,7 +1019,7 @@ nsgtk_preferences_dialogPreferences_deleteevent(GtkDialog *dlg,
G_MODULE_EXPORT void
nsgtk_preferences_dialogPreferences_destroy(GtkDialog *dlg, struct ppref *priv)
{
- nsoption_write(options_file_location);
+ nsoption_write(options_file_location, NULL, NULL);
}
diff --git a/gtk/gui.c b/gtk/gui.c
index 657770d..c6305eb 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -241,8 +241,13 @@ nsgtk_init_glade(char **respath)
widWarning = GTK_WIDGET(gtk_builder_get_object(gladeWarning, "labelWarning"));
}
-/* Documented in utils/nsoption.h */
-void gui_options_init_defaults(void)
+/**
+ * Set option defaults for gtk frontend
+ *
+ * @param defaults The option table to update.
+ * @return error status.
+ */
+static nserror set_defaults(struct nsoption_s *defaults)
{
char *hdir = getenv("HOME");
char buf[PATH_MAX];
@@ -252,8 +257,10 @@ void gui_options_init_defaults(void)
nsoption_setnull_charp(cookie_file, strdup(buf));
nsoption_setnull_charp(cookie_jar, strdup(buf));
if (nsoption_charp(cookie_file) == NULL ||
- nsoption_charp(cookie_jar) == NULL)
- die("Failed initialising cookie options");
+ nsoption_charp(cookie_jar) == NULL) {
+ LOG(("Failed initialising cookie options"));
+ return NSERROR_BAD_PARAMETER;
+ }
if (nsoption_charp(downloads_directory) == NULL) {
snprintf(buf, PATH_MAX, "%s/", hdir);
@@ -276,8 +283,48 @@ void gui_options_init_defaults(void)
nsoption_charp(ca_path) == NULL ||
nsoption_charp(downloads_directory) == NULL ||
nsoption_charp(hotlist_path) == NULL) {
- die("Failed initialising string options");
+ LOG(("Failed initialising string options"));
+ return NSERROR_BAD_PARAMETER;
}
+
+ /* set default font names */
+ nsoption_set_charp(font_sans, strdup("Sans"));
+ nsoption_set_charp(font_serif, strdup("Serif"));
+ nsoption_set_charp(font_mono, strdup("Monospace"));
+ nsoption_set_charp(font_cursive, strdup("Serif"));
+ nsoption_set_charp(font_fantasy, strdup("Serif"));
+
+ /* set system colours for gtk ui */
+ nsoption_set_colour(sys_colour_ActiveBorder, 0xff000000);
+ nsoption_set_colour(sys_colour_ActiveCaption, 0xffdddddd);
+ nsoption_set_colour(sys_colour_AppWorkspace, 0xffeeeeee);
+ nsoption_set_colour(sys_colour_Background, 0xff0000aa);
+ nsoption_set_colour(sys_colour_ButtonFace, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_ButtonHighlight, 0xffdddddd);
+ nsoption_set_colour(sys_colour_ButtonShadow, 0xffbbbbbb);
+ nsoption_set_colour(sys_colour_ButtonText, 0xff000000);
+ nsoption_set_colour(sys_colour_CaptionText, 0xff000000);
+ nsoption_set_colour(sys_colour_GrayText, 0xffcccccc);
+ nsoption_set_colour(sys_colour_Highlight, 0xff0000ee);
+ nsoption_set_colour(sys_colour_HighlightText, 0xff000000);
+ nsoption_set_colour(sys_colour_InactiveBorder, 0xffffffff);
+ nsoption_set_colour(sys_colour_InactiveCaption, 0xffffffff);
+ nsoption_set_colour(sys_colour_InactiveCaptionText, 0xffcccccc);
+ nsoption_set_colour(sys_colour_InfoBackground, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_InfoText, 0xff000000);
+ nsoption_set_colour(sys_colour_Menu, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_MenuText, 0xff000000);
+ nsoption_set_colour(sys_colour_Scrollbar, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_ThreeDDarkShadow, 0xff555555);
+ nsoption_set_colour(sys_colour_ThreeDFace, 0xffdddddd);
+ nsoption_set_colour(sys_colour_ThreeDHighlight, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_ThreeDLightShadow, 0xff999999);
+ nsoption_set_colour(sys_colour_ThreeDShadow, 0xff777777);
+ nsoption_set_colour(sys_colour_Window, 0xffaaaaaa);
+ nsoption_set_colour(sys_colour_WindowFrame, 0xff000000);
+ nsoption_set_colour(sys_colour_WindowText, 0xff000000);
+
+ return NSERROR_OK;
}
static void check_options(char **respath)
@@ -308,15 +355,6 @@ static void check_options(char **respath)
LOG(("Using '%s' as Print Settings file", buf));
print_options_file_location = strdup(buf);
- /* check what the font settings are, setting them to a default font
- * if they're not set - stops Pango whinging
- */
-#define SETFONTDEFAULT(OPTION,y) if (nsoption_charp(OPTION) == NULL) nsoption_set_charp(OPTION, strdup((y)))
- SETFONTDEFAULT(font_sans, "Sans");
- SETFONTDEFAULT(font_serif, "Serif");
- SETFONTDEFAULT(font_mono, "Monospace");
- SETFONTDEFAULT(font_cursive, "Serif");
- SETFONTDEFAULT(font_fantasy, "Serif");
}
@@ -355,9 +393,6 @@ static void gui_init(int argc, char** argv, char **respath)
nsurl *url;
nserror error;
- /* check user options */
- check_options(respath);
-
/* find the languages file */
languages_file_location = filepath_find(respath, "languages");
if ((languages_file_location == NULL) ||
@@ -532,6 +567,7 @@ int main(int argc, char** argv)
{
char *messages;
char *options;
+ nserror ret;
/* check home directory is available */
nsgtk_check_homedir();
@@ -540,25 +576,39 @@ int main(int argc, char** argv)
gtk_init(&argc, &argv);
- options = filepath_find(respaths, "Choices");
- messages = filepath_find(respaths, "Messages");
-
/* initialise logging. Not fatal if it fails but not much we
* can do about it either.
*/
nslog_init(nslog_stream_configure, &argc, argv);
- netsurf_init(&argc, &argv, options, messages);
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ options = filepath_find(respaths, "Choices");
+ nsoption_read(options, NULL);
+ free(options);
+ nsoption_commandline(&argc, argv, NULL);
+ check_options(respaths); /* check user options */
+ /* common initialisation */
+ messages = filepath_find(respaths, "Messages");
+ ret = netsurf_init(messages);
free(messages);
- free(options);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
+ /* run the browser */
gui_init(argc, argv, respaths);
/* Ensure all scaffoldings are destroyed before we go into exit */
- while (scaf_list != NULL)
+ while (scaf_list != NULL) {
nsgtk_scaffolding_destroy(scaf_list);
+ }
+ /* common finalisation */
netsurf_exit();
return 0;
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index cf5bbed..566197d 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -1297,7 +1297,7 @@ MULTIHANDLER(savewindowsize)
nsoption_set_int(window_x, x);
nsoption_set_int(window_y, y);
- nsoption_write(options_file_location);
+ nsoption_write(options_file_location, NULL, NULL);
return TRUE;
}
diff --git a/gtk/system_colour.c b/gtk/system_colour.c
index c136e50..ab627c9 100644
--- a/gtk/system_colour.c
+++ b/gtk/system_colour.c
@@ -26,191 +26,13 @@
#include "desktop/gui.h"
#include "utils/nsoption.h"
-struct gui_system_colour_ctx {
- const char *name;
- int length;
- css_color colour;
- colour *option_colour;
- lwc_string *lwcstr;
-};
-static struct gui_system_colour_ctx colour_list[] = {
- {
- "ActiveBorder",
- SLEN("ActiveBorder"),
- 0xff000000,
- &nsoption_charp(sys_colour_ActiveBorder),
- NULL
- }, {
- "ActiveCaption",
- SLEN("ActiveCaption"),
- 0xffdddddd,
- &nsoption_charp(sys_colour_ActiveCaption),
- NULL
- }, {
- "AppWorkspace",
- SLEN("AppWorkspace"),
- 0xffeeeeee,
- &nsoption_charp(sys_colour_AppWorkspace),
- NULL
- }, {
- "Background",
- SLEN("Background"),
- 0xff0000aa,
- &nsoption_charp(sys_colour_Background),
- NULL
- }, {
- "ButtonFace",
- SLEN("ButtonFace"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_ButtonFace),
- NULL
- }, {
- "ButtonHighlight",
- SLEN("ButtonHighlight"),
- 0xffdddddd,
- &nsoption_charp(sys_colour_ButtonHighlight),
- NULL
- }, {
- "ButtonShadow",
- SLEN("ButtonShadow"),
- 0xffbbbbbb,
- &nsoption_charp(sys_colour_ButtonShadow),
- NULL
- }, {
- "ButtonText",
- SLEN("ButtonText"),
- 0xff000000,
- &nsoption_charp(sys_colour_ButtonText),
- NULL
- }, {
- "CaptionText",
- SLEN("CaptionText"),
- 0xff000000,
- &nsoption_charp(sys_colour_CaptionText),
- NULL
- }, {
- "GrayText",
- SLEN("GrayText"),
- 0xffcccccc,
- &nsoption_charp(sys_colour_GrayText),
- NULL
- }, {
- "Highlight",
- SLEN("Highlight"),
- 0xff0000ee,
- &nsoption_charp(sys_colour_Highlight),
- NULL
- }, {
- "HighlightText",
- SLEN("HighlightText"),
- 0xff000000,
- &nsoption_charp(sys_colour_HighlightText),
- NULL
- }, {
- "InactiveBorder",
- SLEN("InactiveBorder"),
- 0xffffffff,
- &nsoption_charp(sys_colour_InactiveBorder),
- NULL
- }, {
- "InactiveCaption",
- SLEN("InactiveCaption"),
- 0xffffffff,
- &nsoption_charp(sys_colour_InactiveCaption),
- NULL
- }, {
- "InactiveCaptionText",
- SLEN("InactiveCaptionText"),
- 0xffcccccc,
- &nsoption_charp(sys_colour_InactiveCaptionText),
- NULL
- }, {
- "InfoBackground",
- SLEN("InfoBackground"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_InfoBackground),
- NULL
- }, {
- "InfoText",
- SLEN("InfoText"),
- 0xff000000,
- &nsoption_charp(sys_colour_InfoText),
- NULL
- }, {
- "Menu",
- SLEN("Menu"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_Menu),
- NULL
- }, {
- "MenuText",
- SLEN("MenuText"),
- 0xff000000,
- &nsoption_charp(sys_colour_MenuText),
- NULL
- }, {
- "Scrollbar",
- SLEN("Scrollbar"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_Scrollbar),
- NULL
- }, {
- "ThreeDDarkShadow",
- SLEN("ThreeDDarkShadow"),
- 0xff555555,
- &nsoption_charp(sys_colour_ThreeDDarkShadow),
- NULL
- }, {
- "ThreeDFace",
- SLEN("ThreeDFace"),
- 0xffdddddd,
- &nsoption_charp(sys_colour_ThreeDFace),
- NULL
- }, {
- "ThreeDHighlight",
- SLEN("ThreeDHighlight"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_ThreeDHighlight),
- NULL
- }, {
- "ThreeDLightShadow",
- SLEN("ThreeDLightShadow"),
- 0xff999999,
- &nsoption_charp(sys_colour_ThreeDLightShadow),
- NULL
- }, {
- "ThreeDShadow",
- SLEN("ThreeDShadow"),
- 0xff777777,
- &nsoption_charp(sys_colour_ThreeDShadow),
- NULL
- }, {
- "Window",
- SLEN("Window"),
- 0xffaaaaaa,
- &nsoption_charp(sys_colour_Window),
- NULL
- }, {
- "WindowFrame",
- SLEN("WindowFrame"),
- 0xff000000,
- &nsoption_charp(sys_colour_WindowFrame),
- NULL
- }, {
-
- "WindowText",
- SLEN("WindowText"),
- 0xff000000,
- &nsoption_charp(sys_colour_WindowText),
- NULL
- },
-};
+#define colour_list_len ((NSOPTION_SYS_COLOUR_END - NSOPTION_SYS_COLOUR_START) + 1)
-#define colour_list_len (sizeof(colour_list) / sizeof(struct gui_system_colour_ctx))
+static lwc_string *colour_list[colour_list_len];
-static struct gui_system_colour_ctx *gui_system_colour_pw = NULL;
+static lwc_string **gui_system_colour_pw = NULL;
bool gui_system_colour_init(void)
@@ -222,20 +44,15 @@ bool gui_system_colour_init(void)
/* Intern colour strings */
for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (lwc_intern_string(colour_list[ccount].name,
- colour_list[ccount].length,
- &(colour_list[ccount].lwcstr)) != lwc_error_ok) {
+ struct nsoption_s *opt;
+ opt = &nsoptions[ccount + NSOPTION_SYS_COLOUR_START];
+ if (lwc_intern_string(opt->key + SLEN("sys_colour_"),
+ opt->key_len - SLEN("sys_colour_"),
+ &(colour_list[ccount])) != lwc_error_ok) {
return false;
}
}
- /* pull in options if set (ie not transparent) */
- for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (*(colour_list[ccount].option_colour) != 0) {
- colour_list[ccount].colour = *(colour_list[ccount].option_colour);
- }
- }
-
gui_system_colour_pw = colour_list;
return true;
@@ -246,7 +63,7 @@ void gui_system_colour_finalize(void)
unsigned int ccount;
for (ccount = 0; ccount < colour_list_len; ccount++) {
- lwc_string_unref(colour_list[ccount].lwcstr);
+ lwc_string_unref(colour_list[ccount]);
}
}
@@ -256,8 +73,9 @@ colour gui_system_colour_char(const char *name)
unsigned int ccount;
for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (strcmp(name, colour_list[ccount].name) == 0) {
- ret = colour_list[ccount].colour;
+ if (strcmp(name,
+ nsoptions[ccount + NSOPTION_SYS_COLOUR_START].key + SLEN("sys_colour_")) == 0) {
+ ret = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c;
break;
}
}
@@ -271,9 +89,9 @@ css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
for (ccount = 0; ccount < colour_list_len; ccount++) {
if (lwc_string_caseless_isequal(name,
- colour_list[ccount].lwcstr,
+ colour_list[ccount],
&match) == lwc_error_ok && match) {
- *colour = colour_list[ccount].colour;
+ *colour = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c;
return CSS_OK;
}
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4f58d74c1444e1babe2...
commit 4f58d74c1444e1babe2128ebfb364b839b142200
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
move option init out of netsurf_init
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 85723e8..ee2ea54 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -334,9 +334,10 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
"<tr><th></th><th></th><th></th></tr>\n");
do {
- res = nsoption_snoptionf(buffer + slen, sizeof buffer - slen,
- opt_loop,
- "<tr><th>%k</th><td>%t</td><td>%V</td></tr>\n");
+ res = nsoption_snoptionf(buffer + slen,
+ sizeof buffer - slen,
+ opt_loop,
+ "<tr><th>%k</th><td>%t</td><td>%V</td></tr>\n");
if (res <= 0)
break; /* last option */
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index f63969b..fa026dc 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -115,10 +115,7 @@ static nserror netsurf_llcache_query_handler(const llcache_query *query,
* Initialise components used by gui NetSurf.
*/
-nserror netsurf_init(int *pargc,
- char ***pargv,
- const char *options,
- const char *messages)
+nserror netsurf_init(const char *messages)
{
nserror error;
struct utsname utsname;
@@ -143,7 +140,7 @@ nserror netsurf_init(int *pargc,
signal(SIGPIPE, SIG_IGN);
#endif
- LOG(("version '%s'", netsurf_version));
+ LOG(("NetSurf version '%s'", netsurf_version));
if (uname(&utsname) < 0)
LOG(("Failed to extract machine information"));
else
@@ -152,10 +149,6 @@ nserror netsurf_init(int *pargc,
utsname.nodename, utsname.release,
utsname.version, utsname.machine));
- LOG(("Using '%s' for Options file", options));
- nsoption_read(options);
- gui_options_init_defaults();
-
messages_load(messages);
/* corestrings init */
@@ -175,7 +168,7 @@ nserror netsurf_init(int *pargc,
/* image cache is 25% of total memory cache size */
image_cache_parameters.limit = (hlcache_parameters.limit * 25) / 100;
- /* image cache hysteresis is 20% of teh image cache size */
+ /* image cache hysteresis is 20% of the image cache size */
image_cache_parameters.hysteresis = (image_cache_parameters.limit * 20) / 100;
/* account for image cache use from total */
@@ -220,8 +213,6 @@ nserror netsurf_init(int *pargc,
/* Initialize system colours */
gui_system_colour_init();
- nsoption_commandline(pargc, *pargv);
-
js_initialise();
return ret;
diff --git a/desktop/netsurf.h b/desktop/netsurf.h
index 10c1e00..bfdb647 100644
--- a/desktop/netsurf.h
+++ b/desktop/netsurf.h
@@ -28,7 +28,7 @@ extern const char * const netsurf_version;
extern const int netsurf_version_major;
extern const int netsurf_version_minor;
-nserror netsurf_init(int *argc, char ***argv, const char *options, const char *messages);
+nserror netsurf_init(const char *messages);
extern void netsurf_exit(void);
extern int netsurf_main_loop(void);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=21633f1ef2dc74481ef...
commit 21633f1ef2dc74481ef7da3b2e0707c653821dfd
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fix mismatched option name and variable names
block_ads should be block_advertisments to match option name
toolbar_status_width should be toolbar_status_size to match option name
diff --git a/amiga/gui.c b/amiga/gui.c
index 8342b8d..dcbf90b 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3673,7 +3673,7 @@ ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULO
available_width = gwin->win->Width - scrn->WBorLeft - sz;
- gad1percent = nsoption_int(toolbar_status_width) / 10000.0;
+ gad1percent = nsoption_int(toolbar_status_size) / 10000.0;
*size1 = (ULONG)(available_width * gad1percent);
*size2 = (ULONG)(available_width * (1 - gad1percent));
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index bd37acd..102036d 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -579,7 +579,7 @@ void ami_gui_opts_open(void)
GA_ID, GID_OPTS_HIDEADS,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_HIDEADS],
- GA_Selected, nsoption_bool(block_ads),
+ GA_Selected, nsoption_bool(block_advertisements),
CheckBoxEnd,
LayoutEnd, // content blocking
LAYOUT_AddChild,VGroupObject,
@@ -1531,9 +1531,9 @@ void ami_gui_opts_use(bool save)
GetAttr(GA_Selected,gow->objects[GID_OPTS_HIDEADS],(ULONG *)&data);
if (data) {
- nsoption_set_bool(block_ads, true);
+ nsoption_set_bool(block_advertisements, true);
} else {
- nsoption_set_bool(block_ads, false);
+ nsoption_set_bool(block_advertisements, false);
}
GetAttr(INTEGER_Number,gow->objects[GID_OPTS_HISTORY],(ULONG *)&nsoption_int(expire_url));
diff --git a/atari/settings.c b/atari/settings.c
index 1fc425a..5c3604f 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -131,7 +131,7 @@ static void display_settings(void)
set_text( SETTINGS_EDIT_HOMEPAGE, nsoption_charp(homepage_url),
INPUT_HOMEPAGE_URL_MAX_LEN );
- if( nsoption_bool(block_ads) ) {
+ if( nsoption_bool(block_advertisements) ) {
OBJ_CHECK( SETTINGS_CB_HIDE_ADVERTISEMENT );
} else {
OBJ_UNCHECK( SETTINGS_CB_HIDE_ADVERTISEMENT );
@@ -644,7 +644,7 @@ static void apply_settings(void)
/* "Browser" tab: */
nsoption_set_bool(target_blank,
!OBJ_SELECTED(SETTINGS_CB_DISABLE_POPUP_WINDOWS));
- nsoption_set_bool(block_ads,
+ nsoption_set_bool(block_advertisements,
OBJ_SELECTED(SETTINGS_CB_HIDE_ADVERTISEMENT));
nsoption_set_charp(accept_language,
gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE));
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 7e2ff2b..80322ec 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -1415,7 +1415,7 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width)
gw->window = fbtk_create_window(fbtk, 0, 0, 0, 0, 0);
- statusbar_width = nsoption_int(toolbar_status_width) *
+ statusbar_width = nsoption_int(toolbar_status_size) *
fbtk_get_width(gw->window) / 10000;
/* toolbar */
diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c
index 430554c..ca4ac2e 100644
--- a/gtk/dialogs/preferences.c
+++ b/gtk/dialogs/preferences.c
@@ -374,7 +374,7 @@ SPINBUTTON_SIGNALS(spinDiscCacheAge, disc_cache_age, 1.0)
TOGGLEBUTTON_SIGNALS(checkDisablePopups, disable_popups)
/* hide adverts */
-TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_ads)
+TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_advertisements)
/* enable javascript */
TOGGLEBUTTON_SIGNALS(checkEnableJavascript, enable_javascript)
diff --git a/gtk/gui.c b/gtk/gui.c
index 3408bb9..657770d 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -292,8 +292,8 @@ static void check_options(char **respath)
* The GTK front end now correctly uses it as a proportion of window
* width. Here we assume that a value of less than 15% is wrong
* and set to the default two thirds. */
- if (nsoption_int(toolbar_status_width) < 1500) {
- nsoption_set_int(toolbar_status_width, 6667);
+ if (nsoption_int(toolbar_status_size) < 1500) {
+ nsoption_set_int(toolbar_status_size, 6667);
}
/* user options should be stored in the users home directory */
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 01f7fe5..cf5bbed 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -1286,7 +1286,7 @@ MULTIHANDLER(savewindowsize)
int x,y,w,h;
if (GTK_IS_PANED(g->status_pane)) {
- nsoption_set_int(toolbar_status_width,
+ nsoption_set_int(toolbar_status_size,
gtk_paned_get_position(g->status_pane));
}
gtk_window_get_position(g->window, &x, &y);
diff --git a/gtk/window.c b/gtk/window.c
index 44b88d2..5edace8 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -593,12 +593,12 @@ static gboolean nsgtk_window_size_allocate_event(GtkWidget *widget,
if (g->paned != NULL) {
/* Set status bar / scroll bar proportion according to
- * option_toolbar_status_width */
+ * option_toolbar_status_size */
/* TODO: Probably want to detect when the user adjusts the
* status bar width, remember that proportion for the
* window, and use that here. */
gtk_paned_set_position(g->paned,
- (nsoption_int(toolbar_status_width) *
+ (nsoption_int(toolbar_status_size) *
allocation->width) / 10000);
}
diff --git a/render/html_css.c b/render/html_css.c
index b45275b..63d5b3e 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -551,7 +551,7 @@ nserror html_css_new_stylesheets(html_content *c)
LOG(("%d fetches active", c->base.active));
- if (nsoption_bool(block_ads)) {
+ if (nsoption_bool(block_advertisements)) {
ns_error = hlcache_handle_retrieve(html_adblock_stylesheet_url,
0, content_get_url(&c->base), NULL,
html_convert_css_callback,
diff --git a/riscos/configure/con_content.c b/riscos/configure/con_content.c
index 122b0e3..d4f3e46 100644
--- a/riscos/configure/con_content.c
+++ b/riscos/configure/con_content.c
@@ -44,7 +44,7 @@ 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_ads));
+ 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,
@@ -88,7 +88,7 @@ void ro_gui_options_content_default(wimp_pointer *pointer)
bool ro_gui_options_content_ok(wimp_w w)
{
- nsoption_set_bool(block_ads,
+ nsoption_set_bool(block_advertisements,
ro_gui_get_icon_selected_state(w, CONTENT_BLOCK_ADVERTISEMENTS));
nsoption_set_bool(block_popups,
diff --git a/riscos/window.c b/riscos/window.c
index e7b3699..772a0d1 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -521,7 +521,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,
- nsoption_int(toolbar_status_width));
+ nsoption_int(toolbar_status_size));
g->toolbar = ro_toolbar_create(NULL, g->window,
THEME_STYLE_BROWSER_TOOLBAR, TOOLBAR_FLAGS_NONE,
&ro_gui_window_toolbar_callbacks, g,
@@ -4712,7 +4712,7 @@ void ro_gui_window_default_options(struct browser_window *bw)
ro_toolbar_get_display_throbber(gui->toolbar));
}
if (gui->status_bar != NULL)
- nsoption_set_int(toolbar_status_width,
+ nsoption_set_int(toolbar_status_size,
ro_gui_status_bar_get_width(gui->status_bar));
}
diff --git a/windows/prefs.c b/windows/prefs.c
index 360a540..93a30b0 100644
--- a/windows/prefs.c
+++ b/windows/prefs.c
@@ -583,7 +583,7 @@ static BOOL CALLBACK options_general_dialog_handler(HWND hwnd,
/* advert blocking */
sub = GetDlgItem(hwnd, IDC_PREFS_ADVERTS);
SendMessage(sub, BM_SETCHECK,
- (WPARAM) ((nsoption_bool(block_ads)) ?
+ (WPARAM) ((nsoption_bool(block_advertisements)) ?
BST_CHECKED : BST_UNCHECKED), 0);
/* Referrer sending */
@@ -615,7 +615,7 @@ static BOOL CALLBACK options_general_dialog_handler(HWND hwnd,
nsoption_set_bool(suppress_images,
(IsDlgButtonChecked(hwnd, IDC_PREFS_IMAGES) == BST_CHECKED) ? true : false);
- nsoption_set_bool(block_ads, (IsDlgButtonChecked(hwnd,
+ nsoption_set_bool(block_advertisements, (IsDlgButtonChecked(hwnd,
IDC_PREFS_ADVERTS) == BST_CHECKED) ? true : false);
nsoption_set_bool(send_referer, (IsDlgButtonChecked(hwnd,
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=117636691d96a792d52...
commit 117636691d96a792d5234a71a5889632ac364d37
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
build new options code and remove old
diff --git a/desktop/Makefile b/desktop/Makefile
index b587e67..cdab1c4 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -1,7 +1,7 @@
# Sources for desktop
S_DESKTOP := cookies.c history_global_core.c hotlist.c knockout.c \
- mouse.c options.c plot_style.c print.c search.c searchweb.c \
+ mouse.c plot_style.c print.c search.c searchweb.c \
scrollbar.c sslcert.c textarea.c thumbnail.c tree.c \
tree_url_node.c version.c
diff --git a/desktop/options.c b/desktop/options.c
deleted file mode 100644
index 00c37f1..0000000
--- a/desktop/options.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
- * Copyright 2003 John M Bell <jmb202(a)ecs.soton.ac.uk>
- * Copyright 2004 James Bursa <bursa(a)users.sourceforge.net>
- * Copyright 2005 Richard Wilson <info(a)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
- * Option reading and saving (implementation).
- *
- * Options are stored in the format key:value, one per line. For bool options,
- * value is "0" or "1".
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <strings.h>
-
-#include "css/css.h"
-#include "desktop/plot_style.h"
-#include "utils/log.h"
-#include "utils/utils.h"
-#include "utils/nsoptions.h"
-
-struct ns_options nsoptions = {
- NSOPTION_MAIN_DEFAULTS,
- NSOPTION_SYS_COLOUR_DEFAULTS,
- NSOPTION_EXTRA_DEFAULTS
-};
-
-enum option_type_e {
- OPTION_BOOL,
- OPTION_INTEGER,
- OPTION_STRING,
- OPTION_COLOUR
-} ;
-
-struct option_entry_s {
- const char *key;
- enum option_type_e type;
- void *p;
-};
-
-struct option_entry_s option_table[] = {
- NSOPTION_MAIN_TABLE,
- NSOPTION_EXTRA_TABLE
-};
-
-#define option_table_entries (sizeof option_table / sizeof option_table[0])
-
-/**
- * Set an option value based on a string
- */
-static bool
-strtooption(const char *value, struct option_entry_s *option_entry)
-{
- bool ret = false;
- colour rgbcolour; /* RRGGBB */
-
- switch (option_entry->type) {
- case OPTION_BOOL:
- *((bool *)option_entry->p) = value[0] == '1';
- ret = true;
- break;
-
- case OPTION_INTEGER:
- *((int *)option_entry->p) = atoi(value);
- ret = true;
- break;
-
- case OPTION_COLOUR:
- sscanf(value, "%x", &rgbcolour);
- *((colour *)option_entry->p) =
- ((0x000000FF & rgbcolour) << 16) |
- ((0x0000FF00 & rgbcolour) << 0) |
- ((0x00FF0000 & rgbcolour) >> 16);
- ret = true;
- break;
-
- case OPTION_STRING:
- free(*((char **)option_entry->p));
- if (*value == 0) {
- /* do not allow empty strings in text options */
- *((char **)option_entry->p) = NULL;
- } else {
- *((char **)option_entry->p) = strdup(value);
- }
- ret = true;
- break;
- }
-
- return ret;
-}
-
-static void nsoptions_validate(struct ns_options *opts)
-{
- if (opts->font_size < 50)
- opts->font_size = 50;
-
- if (1000 < opts->font_size)
- opts->font_size = 1000;
-
- if (opts->font_min_size < 10)
- opts->font_min_size = 10;
-
- if (500 < opts->font_min_size)
- opts->font_min_size = 500;
-
- if (opts->memory_cache_size < 0)
- opts->memory_cache_size = 0;
-
-}
-
-/* exported interface documented in options.h */
-void nsoption_read(const char *path)
-{
- char s[100];
- FILE *fp;
-
- if (path == NULL) {
- LOG(("No options loaded"));
- return;
- }
-
- fp = fopen(path, "r");
- if (!fp) {
- LOG(("failed to open file '%s'", path));
- return;
- }
-
- while (fgets(s, 100, fp)) {
- char *colon, *value;
- unsigned int i;
-
- if (s[0] == 0 || s[0] == '#')
- continue;
- colon = strchr(s, ':');
- if (colon == 0)
- continue;
- s[strlen(s) - 1] = 0; /* remove \n at end */
- *colon = 0; /* terminate key */
- value = colon + 1;
-
- for (i = 0; i != option_table_entries; i++) {
- if (strcasecmp(s, option_table[i].key) != 0)
- continue;
-
- strtooption(value, option_table + i);
- break;
- }
- }
-
- fclose(fp);
-
- nsoptions_validate(&nsoptions);
-}
-
-
-/* exported interface documented in options.h */
-void nsoption_write(const char *path)
-{
- unsigned int entry;
- FILE *fp;
- colour rgbcolour; /* RRGGBB */
-
- fp = fopen(path, "w");
- if (!fp) {
- LOG(("failed to open file '%s' for writing", path));
- return;
- }
-
- for (entry = 0; entry != option_table_entries; entry++) {
- switch (option_table[entry].type) {
- case OPTION_BOOL:
- fprintf(fp, "%s:%c\n", option_table[entry].key,
- *((bool *) option_table[entry].p) ? '1' : '0');
- break;
-
- case OPTION_INTEGER:
- fprintf(fp, "%s:%i\n", option_table[entry].key,
- *((int *) option_table[entry].p));
- break;
-
- case OPTION_COLOUR:
- rgbcolour = ((0x000000FF & *((colour *)
- option_table[entry].p)) << 16) |
- ((0x0000FF00 & *((colour *)
- option_table[entry].p)) << 0) |
- ((0x00FF0000 & *((colour *)
- option_table[entry].p)) >> 16);
- fprintf(fp, "%s:%06x\n", option_table[entry].key,
- rgbcolour);
- break;
-
- case OPTION_STRING:
- if (((*((char **) option_table[entry].p)) != NULL) &&
- (*(*((char **) option_table[entry].p)) != 0)) {
- fprintf(fp, "%s:%s\n", option_table[entry].key,
- *((char **) option_table[entry].p));
- }
- break;
- }
- }
-
- fclose(fp);
-}
-
-
-/**
- * Output an option value into a string, in HTML format.
- *
- * \param option The option to output the value of.
- * \param size The size of the string buffer.
- * \param pos The current position in string
- * \param string The string in which to output the value.
- * \return The number of bytes written to string or -1 on error
- */
-static size_t
-nsoption_output_value_html(struct option_entry_s *option,
- size_t size, size_t pos, char *string)
-{
- size_t slen = 0; /* length added to string */
- colour rgbcolour; /* RRGGBB */
-
- switch (option->type) {
- case OPTION_BOOL:
- slen = snprintf(string + pos, size - pos, "%s",
- *((bool *)option->p) ? "true" : "false");
- break;
-
- case OPTION_INTEGER:
- slen = snprintf(string + pos, size - pos, "%i",
- *((int *)option->p));
- break;
-
- case OPTION_COLOUR:
- rgbcolour = ((0x000000FF & *((colour *) option->p)) << 16) |
- ((0x0000FF00 & *((colour *) option->p)) << 0) |
- ((0x00FF0000 & *((colour *) option->p)) >> 16);
- slen = snprintf(string + pos, size - pos,
- "<span style=\"background-color: #%06x; "
- "color: #%06x;\">#%06x</span>", rgbcolour,
- (~rgbcolour) & 0xffffff, rgbcolour);
- break;
-
- case OPTION_STRING:
- if (*((char **)option->p) != NULL) {
- slen = snprintf(string + pos, size - pos, "%s",
- *((char **)option->p));
- } else {
- slen = snprintf(string + pos, size - pos,
- "<span class=\"null-content\">NULL"
- "</span>");
- }
- break;
- }
-
- return slen;
-}
-
-
-/**
- * Output an option value into a string, in plain text format.
- *
- * \param option The option to output the value of.
- * \param size The size of the string buffer.
- * \param pos The current position in string
- * \param string The string in which to output the value.
- * \return The number of bytes written to string or -1 on error
- */
-static size_t
-nsoption_output_value_text(struct option_entry_s *option,
- size_t size, size_t pos, char *string)
-{
- size_t slen = 0; /* length added to string */
- colour rgbcolour; /* RRGGBB */
-
- switch (option->type) {
- case OPTION_BOOL:
- slen = snprintf(string + pos, size - pos, "%c",
- *((bool *)option->p) ? '1' : '0');
- break;
-
- case OPTION_INTEGER:
- slen = snprintf(string + pos, size - pos, "%i",
- *((int *)option->p));
- break;
-
- case OPTION_COLOUR:
- rgbcolour = ((0x000000FF & *((colour *) option->p)) << 16) |
- ((0x0000FF00 & *((colour *) option->p)) << 0) |
- ((0x00FF0000 & *((colour *) option->p)) >> 16);
- slen = snprintf(string + pos, size - pos, "%06x", rgbcolour);
- break;
-
- case OPTION_STRING:
- if (*((char **)option->p) != NULL) {
- slen = snprintf(string + pos, size - pos, "%s",
- *((char **)option->p));
- }
- break;
- }
-
- return slen;
-}
-
-/* exported interface documented in options.h */
-void
-nsoption_commandline(int *pargc, char **argv)
-{
- char *arg;
- char *val;
- int arglen;
- int idx = 1;
- int mv_loop;
-
- unsigned int entry_loop;
-
- while (idx < *pargc) {
- arg = argv[idx];
- arglen = strlen(arg);
-
- /* check we have an option */
- /* option must start -- and be as long as the shortest option*/
- if ((arglen < (2+5) ) || (arg[0] != '-') || (arg[1] != '-'))
- break;
-
- arg += 2; /* skip -- */
-
- val = strchr(arg, '=');
- if (val == NULL) {
- /* no equals sign - next parameter is val */
- idx++;
- if (idx >= *pargc)
- break;
- val = argv[idx];
- } else {
- /* equals sign */
- arglen = val - arg ;
- val++;
- }
-
- /* arg+arglen is the option to set, val is the value */
-
- LOG(("%.*s = %s",arglen,arg,val));
-
- for (entry_loop = 0;
- entry_loop < option_table_entries;
- entry_loop++) {
- if (strncmp(arg, option_table[entry_loop].key,
- arglen) == 0) {
- strtooption(val, option_table + entry_loop);
- break;
- }
- }
-
- idx++;
- }
-
- /* remove processed options from argv */
- for (mv_loop=0;mv_loop < (*pargc - idx); mv_loop++) {
- argv[mv_loop + 1] = argv[mv_loop + idx];
- }
- *pargc -= (idx - 1);
-}
-
-/* exported interface documented in options.h */
-int
-nsoption_snoptionf(char *string, size_t size, unsigned int option, const char *fmt)
-{
- size_t slen = 0; /* current output string length */
- int fmtc = 0; /* current index into format string */
- struct option_entry_s *option_entry;
-
- if (option >= option_table_entries)
- return -1;
-
- option_entry = option_table + option;
-
- while((slen < size) && (fmt[fmtc] != 0)) {
- if (fmt[fmtc] == '%') {
- fmtc++;
- switch (fmt[fmtc]) {
- case 'k':
- slen += snprintf(string + slen, size - slen,
- "%s", option_entry->key);
- break;
-
- case 't':
- switch (option_entry->type) {
- case OPTION_BOOL:
- slen += snprintf(string + slen,
- size - slen,
- "boolean");
- break;
-
- case OPTION_INTEGER:
- slen += snprintf(string + slen,
- size - slen,
- "integer");
- break;
-
- case OPTION_COLOUR:
- slen += snprintf(string + slen,
- size - slen,
- "colour");
- break;
-
- case OPTION_STRING:
- slen += snprintf(string + slen,
- size - slen,
- "string");
- break;
-
- }
- break;
-
-
- case 'V':
- slen += nsoption_output_value_html(option_entry,
- size, slen, string);
- break;
- case 'v':
- slen += nsoption_output_value_text(option_entry,
- size, slen, string);
- break;
- }
- fmtc++;
- } else {
- string[slen] = fmt[fmtc];
- slen++;
- fmtc++;
- }
- }
-
- /* Ensure that we NUL-terminate the output */
- string[min(slen, size - 1)] = '\0';
-
- return slen;
-}
-
-/* exported interface documented in options.h */
-void
-nsoption_dump(FILE *outf)
-{
- char buffer[256];
- int opt_loop = 0;
- int res;
-
- do {
- res = nsoption_snoptionf(buffer, sizeof buffer, opt_loop,
- "%k:%v\n");
- if (res > 0) {
- fprintf(outf, "%s", buffer);
- }
- opt_loop++;
- } while (res > 0);
-}
-
diff --git a/desktop/options_main.h b/desktop/options_main.h
deleted file mode 100644
index 43070ac..0000000
--- a/desktop/options_main.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright 2004 James Bursa <bursa(a)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/>.
- */
-
-/** \file
- * Option available on all platforms
- *
- * Non-platform specific options can be added by editing this file
- *
- * Platform specific options should be added in the platform options.h.
- *
- * The following types of options are supported:
- * - bool (OPTION_BOOL) boolean
- * - int (OPTION_INTEGER) integer
- * - colour (OPTION_COLOUR) colour
- * - char* (OPTION_STRING) must be allocated on heap, may be NULL
- */
-
-#ifndef _NETSURF_DESKTOP_OPTIONS_MAIN_H_
-#define _NETSURF_DESKTOP_OPTIONS_MAIN_H_
-
-#define NSOPTION_MAIN_DEFINE \
- /** An HTTP proxy should be used. */ \
- bool http_proxy; \
- /** Hostname of proxy. */ \
- char *http_proxy_host; \
- /** Proxy port. */ \
- int http_proxy_port; \
- /** Proxy authentication method. */ \
- int http_proxy_auth; \
- /** Proxy authentication user name */ \
- char *http_proxy_auth_user; \
- /** Proxy authentication password */ \
- char *http_proxy_auth_pass; \
- /** Default font size / 0.1pt. */ \
- int font_size; \
- /** Minimum font size. */ \
- int font_min_size; \
- /** Default sans serif font */ \
- char *font_sans; \
- /** Default serif font */ \
- char *font_serif; \
- /** Default monospace font */ \
- char *font_mono; \
- /** Default cursive font */ \
- char *font_cursive; \
- /** Default fantasy font */ \
- char *font_fantasy; \
- /** Accept-Language header. */ \
- char *accept_language; \
- /** Accept-Charset header. */ \
- char *accept_charset; \
- /** Preferred maximum size of memory cache / bytes. */ \
- int memory_cache_size; \
- /** Preferred expiry size of disc cache / bytes. */ \
- int disc_cache_size; \
- /** Preferred expiry age of disc cache / days. */ \
- int disc_cache_age; \
- /** Whether to block advertisements */ \
- bool block_ads; \
- /** Disable website tracking, see \
- * http://www.w3.org/Submission/2011/SUBM-web-tracking-protection-20110224/#... */ \
- bool do_not_track; \
- /** Minimum GIF animation delay */ \
- int minimum_gif_delay; \
- /** Whether to send the referer HTTP header */ \
- bool send_referer; \
- /** Whether to fetch foreground images */ \
- bool foreground_images; \
- /** Whether to fetch background images */ \
- bool background_images; \
- /** Whether to animate images */ \
- bool animate_images; \
- /** Whether to execute javascript */ \
- bool enable_javascript; \
- /** how long to wait for a script to run */ \
- int script_timeout; \
- /** How many days to retain URL data for */ \
- int expire_url; \
- /** Default font family */ \
- int font_default; \
- /** ca-bundle location */ \
- char *ca_bundle; \
- /** ca-path location */ \
- char *ca_path; \
- /** Cookie file location */ \
- char *cookie_file; \
- /** Cookie jar location */ \
- char *cookie_jar; \
- /** Home page location */ \
- char *homepage_url; \
- /** search web from url bar */ \
- bool search_url_bar; \
- /** URL completion in url bar */ \
- bool url_suggestion; \
- /** default web search provider */ \
- int search_provider; \
- /** default x position of new windows */ \
- int window_x; \
- /** default y position of new windows */ \
- int window_y; \
- /** default width of new windows */ \
- int window_width; \
- /** default height of new windows */ \
- int window_height; \
- /** width of screen when above options were saved */ \
- int window_screen_width; \
- /** height of screen when above options were saved */ \
- int window_screen_height; \
- /** default size of status bar vs. h scroll bar */ \
- int toolbar_status_width; \
- /** default window scale */ \
- int scale; \
- /* Whether to reflow web pages while objects are fetching */ \
- bool incremental_reflow; \
- /* Minimum time between HTML reflows while objects are fetching */ \
- unsigned int min_reflow_period; /* time in cs */ \
- bool core_select_menu; \
- /** top margin of exported page */ \
- int margin_top; \
- /** bottom margin of exported page */ \
- int margin_bottom; \
- /** left margin of exported page */ \
- int margin_left; \
- /** right margin of exported page*/ \
- int margin_right; \
- /** scale of exported content*/ \
- int export_scale; \
- /** suppressing images in printed content*/ \
- bool suppress_images; \
- /** turning off all backgrounds for printed content*/ \
- bool remove_backgrounds; \
- /** turning on content loosening for printed content*/ \
- bool enable_loosening; \
- /** compression of PDF documents*/ \
- bool enable_PDF_compression; \
- /** setting a password and encoding PDF documents*/ \
- bool enable_PDF_password; \
- \
- /* Fetcher configuration */ \
- /** Maximum simultaneous active fetchers */ \
- int max_fetchers; \
- /** Maximum simultaneous active fetchers per host. \
- * (<=option_max_fetchers else it makes no sense) Note that \
- * rfc2616 section 8.1.4 says that there should be no more \
- * than two keepalive connections per host. None of the main \
- * browsers follow this as it slows page fetches down \
- * considerably. See \
- * https://bugzilla.mozilla.org/show_bug.cgi?id=423377#c4 \
- */ \
- int max_fetchers_per_host; \
- /** Maximum number of inactive fetchers cached. The total \
- * number of handles netsurf will therefore have open is this \
- * plus option_max_fetchers. \
- */ \
- int max_cached_fetch_handles; \
- /** Suppress debug output from cURL. */ \
- bool suppress_curl_debug; \
- \
- /** Whether to allow target="_blank" */ \
- bool target_blank; \
- \
- /** Whether second mouse button opens in new tab */ \
- bool button_2_tab; \
- \
- /* system colours */ \
- colour sys_colour_ActiveBorder; \
- colour sys_colour_ActiveCaption; \
- colour sys_colour_AppWorkspace; \
- colour sys_colour_Background; \
- colour sys_colour_ButtonFace; \
- colour sys_colour_ButtonHighlight; \
- colour sys_colour_ButtonShadow; \
- colour sys_colour_ButtonText; \
- colour sys_colour_CaptionText; \
- colour sys_colour_GrayText; \
- colour sys_colour_Highlight; \
- colour sys_colour_HighlightText; \
- colour sys_colour_InactiveBorder; \
- colour sys_colour_InactiveCaption; \
- colour sys_colour_InactiveCaptionText; \
- colour sys_colour_InfoBackground; \
- colour sys_colour_InfoText; \
- colour sys_colour_Menu; \
- colour sys_colour_MenuText; \
- colour sys_colour_Scrollbar; \
- colour sys_colour_ThreeDDarkShadow; \
- colour sys_colour_ThreeDFace; \
- colour sys_colour_ThreeDHighlight; \
- colour sys_colour_ThreeDLightShadow; \
- colour sys_colour_ThreeDShadow; \
- colour sys_colour_Window; \
- colour sys_colour_WindowFrame; \
- colour sys_colour_WindowText
-
-#define NSOPTION_MAIN_DEFAULTS \
- .http_proxy = false, \
- .http_proxy_host = NULL, \
- .http_proxy_port = 8080, \
- .http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE, \
- .http_proxy_auth_user = NULL, \
- .http_proxy_auth_pass = NULL, \
- .font_size = 128, \
- .font_min_size = 85, \
- .font_sans = NULL, \
- .font_serif = NULL, \
- .font_mono = NULL, \
- .font_cursive = NULL, \
- .font_fantasy = NULL, \
- .accept_language = NULL, \
- .accept_charset = NULL, \
- .memory_cache_size = 12 * 1024 * 1024, \
- .disc_cache_size = 1024 * 1024 * 1024, \
- .disc_cache_age = 28, \
- .block_ads = false, \
- .do_not_track = false, \
- .minimum_gif_delay = 10, \
- .send_referer = true, \
- .foreground_images = true, \
- .background_images = true, \
- .animate_images = true, \
- .expire_url = 28, \
- .font_default = PLOT_FONT_FAMILY_SANS_SERIF, \
- .ca_bundle = NULL, \
- .ca_path = NULL, \
- .cookie_file = NULL, \
- .cookie_jar = NULL, \
- .homepage_url = NULL, \
- .search_url_bar = false, \
- .url_suggestion = true, \
- .search_provider = 0, \
- .window_x = 0, \
- .window_y = 0, \
- .window_width = 0, \
- .window_height = 0, \
- .window_screen_width = 0, \
- .window_screen_height = 0, \
- .toolbar_status_width = 6667, \
- .scale = 100, \
- .incremental_reflow = true, \
- .min_reflow_period = DEFAULT_REFLOW_PERIOD, \
- .core_select_menu = false, \
- .margin_top = DEFAULT_MARGIN_TOP_MM, \
- .margin_bottom = DEFAULT_MARGIN_BOTTOM_MM, \
- .margin_left = DEFAULT_MARGIN_LEFT_MM, \
- .margin_right = DEFAULT_MARGIN_RIGHT_MM, \
- .export_scale = DEFAULT_EXPORT_SCALE * 100, \
- .suppress_images = false, \
- .remove_backgrounds = false, \
- .enable_loosening = true, \
- .enable_PDF_compression = true, \
- .enable_PDF_password = false, \
- .max_fetchers = 24, \
- .max_fetchers_per_host = 5, \
- .max_cached_fetch_handles = 6, \
- .suppress_curl_debug = true, \
- .target_blank = true, \
- .button_2_tab = true, \
- .enable_javascript = true, \
- .script_timeout = 10
-
-#define NSOPTION_MAIN_SYS_COLOUR_DEFAULTS \
- .sys_colour_ActiveBorder = 0x00000000, \
- .sys_colour_ActiveCaption = 0x00000000, \
- .sys_colour_AppWorkspace = 0x00000000, \
- .sys_colour_Background = 0x00000000, \
- .sys_colour_ButtonFace = 0x00000000, \
- .sys_colour_ButtonHighlight = 0x00000000, \
- .sys_colour_ButtonShadow = 0x00000000, \
- .sys_colour_ButtonText = 0x00000000, \
- .sys_colour_CaptionText = 0x0000000, \
- .sys_colour_GrayText = 0x00000000, \
- .sys_colour_Highlight = 0x00000000, \
- .sys_colour_HighlightText = 0x00000000, \
- .sys_colour_InactiveBorder = 0x00000000, \
- .sys_colour_InactiveCaption = 0x00000000, \
- .sys_colour_InactiveCaptionText = 0x00000000, \
- .sys_colour_InfoBackground = 0x00000000, \
- .sys_colour_InfoText = 0x00000000, \
- .sys_colour_Menu = 0x00000000, \
- .sys_colour_MenuText = 0x0000000, \
- .sys_colour_Scrollbar = 0x0000000, \
- .sys_colour_ThreeDDarkShadow = 0x000000, \
- .sys_colour_ThreeDFace = 0x000000, \
- .sys_colour_ThreeDHighlight = 0x000000, \
- .sys_colour_ThreeDLightShadow = 0x000000, \
- .sys_colour_ThreeDShadow = 0x000000, \
- .sys_colour_Window = 0x000000, \
- .sys_colour_WindowFrame = 0x000000, \
- .sys_colour_WindowText = 0x000000
-
-
-#define NSOPTION_MAIN_TABLE \
- { "http_proxy", OPTION_BOOL, &nsoptions.http_proxy }, \
- { "http_proxy_host", OPTION_STRING, &nsoptions.http_proxy_host }, \
- { "http_proxy_port", OPTION_INTEGER, &nsoptions.http_proxy_port }, \
- { "http_proxy_auth", OPTION_INTEGER, &nsoptions.http_proxy_auth }, \
- { "http_proxy_auth_user", OPTION_STRING, &nsoptions.http_proxy_auth_user }, \
- { "http_proxy_auth_pass", OPTION_STRING, &nsoptions.http_proxy_auth_pass }, \
- { "font_size", OPTION_INTEGER, &nsoptions.font_size }, \
- { "font_min_size", OPTION_INTEGER, &nsoptions.font_min_size }, \
- { "font_sans", OPTION_STRING, &nsoptions.font_sans }, \
- { "font_serif", OPTION_STRING, &nsoptions.font_serif }, \
- { "font_mono", OPTION_STRING, &nsoptions.font_mono }, \
- { "font_cursive", OPTION_STRING, &nsoptions.font_cursive }, \
- { "font_fantasy", OPTION_STRING, &nsoptions.font_fantasy }, \
- { "accept_language", OPTION_STRING, &nsoptions.accept_language }, \
- { "accept_charset", OPTION_STRING, &nsoptions.accept_charset }, \
- { "memory_cache_size", OPTION_INTEGER, &nsoptions.memory_cache_size }, \
- { "disc_cache_size", OPTION_INTEGER, &nsoptions.disc_cache_size }, \
- { "disc_cache_age", OPTION_INTEGER, &nsoptions.disc_cache_age }, \
- { "block_advertisements", OPTION_BOOL, &nsoptions.block_ads }, \
- { "do_not_track", OPTION_BOOL, &nsoptions.do_not_track }, \
- { "minimum_gif_delay", OPTION_INTEGER, &nsoptions.minimum_gif_delay }, \
- { "send_referer", OPTION_BOOL, &nsoptions.send_referer }, \
- { "foreground_images", OPTION_BOOL, &nsoptions.foreground_images }, \
- { "background_images", OPTION_BOOL, &nsoptions.background_images }, \
- { "animate_images", OPTION_BOOL, &nsoptions.animate_images }, \
- { "enable_javascript", OPTION_BOOL, &nsoptions.enable_javascript}, \
- { "script_timeout", OPTION_INTEGER, &nsoptions.script_timeout}, \
- { "expire_url", OPTION_INTEGER, &nsoptions.expire_url }, \
- { "font_default", OPTION_INTEGER, &nsoptions.font_default }, \
- { "ca_bundle", OPTION_STRING, &nsoptions.ca_bundle }, \
- { "ca_path", OPTION_STRING, &nsoptions.ca_path }, \
- { "cookie_file", OPTION_STRING, &nsoptions.cookie_file }, \
- { "cookie_jar", OPTION_STRING, &nsoptions.cookie_jar }, \
- { "homepage_url", OPTION_STRING, &nsoptions.homepage_url }, \
- { "search_url_bar", OPTION_BOOL, &nsoptions.search_url_bar}, \
- { "search_provider", OPTION_INTEGER, &nsoptions.search_provider}, \
- { "url_suggestion", OPTION_BOOL, &nsoptions.url_suggestion }, \
- { "window_x", OPTION_INTEGER, &nsoptions.window_x }, \
- { "window_y", OPTION_INTEGER, &nsoptions.window_y }, \
- { "window_width", OPTION_INTEGER, &nsoptions.window_width }, \
- { "window_height", OPTION_INTEGER, &nsoptions.window_height }, \
- { "window_screen_width", OPTION_INTEGER, &nsoptions.window_screen_width }, \
- { "window_screen_height", OPTION_INTEGER, &nsoptions.window_screen_height }, \
- { "toolbar_status_size", OPTION_INTEGER, &nsoptions.toolbar_status_width }, \
- { "scale", OPTION_INTEGER, &nsoptions.scale }, \
- { "incremental_reflow", OPTION_BOOL, &nsoptions.incremental_reflow }, \
- { "min_reflow_period", OPTION_INTEGER, &nsoptions.min_reflow_period }, \
- { "core_select_menu", OPTION_BOOL, &nsoptions.core_select_menu }, \
- /* Fetcher options */ \
- { "max_fetchers", OPTION_INTEGER, &nsoptions.max_fetchers }, \
- { "max_fetchers_per_host", OPTION_INTEGER, &nsoptions.max_fetchers_per_host }, \
- { "max_cached_fetch_handles", OPTION_INTEGER, &nsoptions.max_cached_fetch_handles }, \
- { "suppress_curl_debug",OPTION_BOOL, &nsoptions.suppress_curl_debug }, \
- { "target_blank", OPTION_BOOL, &nsoptions.target_blank }, \
- { "button_2_tab", OPTION_BOOL, &nsoptions.button_2_tab }, \
- /* PDF / Print options*/ \
- { "margin_top", OPTION_INTEGER, &nsoptions.margin_top}, \
- { "margin_bottom", OPTION_INTEGER, &nsoptions.margin_bottom}, \
- { "margin_left", OPTION_INTEGER, &nsoptions.margin_left}, \
- { "margin_right", OPTION_INTEGER, &nsoptions.margin_right}, \
- { "export_scale", OPTION_INTEGER, &nsoptions.export_scale}, \
- { "suppress_images", OPTION_BOOL, &nsoptions.suppress_images}, \
- { "remove_backgrounds", OPTION_BOOL, &nsoptions.remove_backgrounds}, \
- { "enable_loosening", OPTION_BOOL, &nsoptions.enable_loosening}, \
- { "enable_PDF_compression", OPTION_BOOL, &nsoptions.enable_PDF_compression}, \
- { "enable_PDF_password", OPTION_BOOL, &nsoptions.enable_PDF_password}, \
- \
- /* System colours */ \
- { "sys_colour_ActiveBorder",OPTION_COLOUR,&nsoptions.sys_colour_ActiveBorder }, \
- { "sys_colour_ActiveCaption",OPTION_COLOUR,&nsoptions.sys_colour_ActiveCaption }, \
- { "sys_colour_AppWorkspace",OPTION_COLOUR,&nsoptions.sys_colour_AppWorkspace }, \
- { "sys_colour_Background",OPTION_COLOUR,&nsoptions.sys_colour_Background }, \
- { "sys_colour_ButtonFace",OPTION_COLOUR,&nsoptions.sys_colour_ButtonFace }, \
- { "sys_colour_ButtonHighlight",OPTION_COLOUR,&nsoptions.sys_colour_ButtonHighlight }, \
- { "sys_colour_ButtonShadow",OPTION_COLOUR,&nsoptions.sys_colour_ButtonShadow }, \
- { "sys_colour_ButtonText",OPTION_COLOUR,&nsoptions.sys_colour_ButtonText }, \
- { "sys_colour_CaptionText",OPTION_COLOUR,&nsoptions.sys_colour_CaptionText }, \
- { "sys_colour_GrayText",OPTION_COLOUR,&nsoptions.sys_colour_GrayText }, \
- { "sys_colour_Highlight",OPTION_COLOUR,&nsoptions.sys_colour_Highlight }, \
- { "sys_colour_HighlightText",OPTION_COLOUR,&nsoptions.sys_colour_HighlightText }, \
- { "sys_colour_InactiveBorder",OPTION_COLOUR,&nsoptions.sys_colour_InactiveBorder }, \
- { "sys_colour_InactiveCaption",OPTION_COLOUR,&nsoptions.sys_colour_InactiveCaption }, \
- { "sys_colour_InactiveCaptionText",OPTION_COLOUR,&nsoptions.sys_colour_InactiveCaptionText }, \
- { "sys_colour_InfoBackground",OPTION_COLOUR,&nsoptions.sys_colour_InfoBackground }, \
- { "sys_colour_InfoText",OPTION_COLOUR,&nsoptions.sys_colour_InfoText }, \
- { "sys_colour_Menu",OPTION_COLOUR,&nsoptions.sys_colour_Menu }, \
- { "sys_colour_MenuText",OPTION_COLOUR,&nsoptions.sys_colour_MenuText }, \
- { "sys_colour_Scrollbar",OPTION_COLOUR,&nsoptions.sys_colour_Scrollbar }, \
- { "sys_colour_ThreeDDarkShadow",OPTION_COLOUR,&nsoptions.sys_colour_ThreeDDarkShadow }, \
- { "sys_colour_ThreeDFace",OPTION_COLOUR,&nsoptions.sys_colour_ThreeDFace }, \
- { "sys_colour_ThreeDHighlight",OPTION_COLOUR,&nsoptions.sys_colour_ThreeDHighlight }, \
- { "sys_colour_ThreeDLightShadow", OPTION_COLOUR,&nsoptions.sys_colour_ThreeDLightShadow }, \
- { "sys_colour_ThreeDShadow", OPTION_COLOUR,&nsoptions.sys_colour_ThreeDShadow }, \
- { "sys_colour_Window", OPTION_COLOUR,&nsoptions.sys_colour_Window }, \
- { "sys_colour_WindowFrame", OPTION_COLOUR,&nsoptions.sys_colour_WindowFrame }, \
- { "sys_colour_WindowText", OPTION_COLOUR,&nsoptions.sys_colour_WindowText }
-
-#endif
diff --git a/utils/Makefile b/utils/Makefile
index 071e4fe..aef5799 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -2,6 +2,6 @@
S_UTILS := base64.c corestrings.c filename.c filepath.c hashtable.c \
libdom.c locale.c log.c messages.c nsurl.c talloc.c url.c \
- utf8.c utils.c useragent.c bloom.c
+ utf8.c utils.c useragent.c bloom.c nsoption.c
S_UTILS := $(addprefix utils/,$(S_UTILS))
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=90981ef46e50ee3df5c...
commit 90981ef46e50ee3df5cb04221f9c88be868ffe46
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
move options include
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 491fc03..5ff7792 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -23,7 +23,7 @@
#include "amiga/gui.h"
#include "amiga/hotlist.h"
#include "amiga/theme.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/browser_private.h"
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index c70212a..9a71d1c 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -28,7 +28,7 @@
#include <graphics/composite.h>
#endif
#include <graphics/gfxbase.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include <proto/datatypes.h>
#include <datatypes/pictureclass.h>
#include <proto/dos.h>
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index 2a4f2ab..d0772f1 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -19,7 +19,7 @@
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "desktop/textinput.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "amiga/bitmap.h"
#include "amiga/clipboard.h"
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index db751da..839b603 100644
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -34,7 +34,7 @@
#include "amiga/gui.h"
#include "amiga/history_local.h"
#include "amiga/iff_dr2d.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "amiga/plugin_hack.h"
#include "amiga/theme.h"
#include "amiga/tree.h"
diff --git a/amiga/download.c b/amiga/download.c
index f0a7d09..6b0e3c8 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -34,7 +34,7 @@
#include "amiga/download.h"
#include "amiga/icon.h"
#include "amiga/object.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "amiga/bitmap.h"
#include "amiga/iff_dr2d.h"
#include "amiga/file.h"
diff --git a/amiga/drag.c b/amiga/drag.c
index c8b4416..be4d490 100644
--- a/amiga/drag.c
+++ b/amiga/drag.c
@@ -37,7 +37,7 @@
#include "amiga/drag.h"
#include "amiga/file.h"
#include "amiga/filetype.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "amiga/theme.h"
#include "utils/errors.h"
diff --git a/amiga/file.c b/amiga/file.c
index 74c7225..6942857 100644
--- a/amiga/file.c
+++ b/amiga/file.c
@@ -29,7 +29,7 @@
#include "content/fetch.h"
#include "desktop/browser_private.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/save_pdf/pdf_plotters.h"
#include "desktop/save_text.h"
diff --git a/amiga/font.c b/amiga/font.c
index 69afdba..69001a2 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -23,7 +23,7 @@
#include "amiga/gui.h"
#include "amiga/utf8.h"
#include "amiga/object.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "css/css.h"
#include "css/utils.h"
#include "render/font.h"
diff --git a/amiga/font_scan.c b/amiga/font_scan.c
index 768fcee..b1732da 100644
--- a/amiga/font_scan.c
+++ b/amiga/font_scan.c
@@ -45,7 +45,7 @@
#include "amiga/object.h"
#include "amiga/utf8.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/amiga/gui.c b/amiga/gui.c
index 33cd1bc..8342b8d 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -23,7 +23,7 @@
#include "desktop/history_core.h"
#include "desktop/mouse.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/scrollbar.h"
#include "desktop/searchweb.h"
@@ -553,7 +553,7 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index 96ac2e4..bd37acd 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -38,7 +38,7 @@
#include "amiga/utf8.h"
#include "utils/messages.h"
#include "desktop/browser_private.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/searchweb.h"
#include <proto/window.h>
diff --git a/amiga/launch.c b/amiga/launch.c
index 20505f3..3236e79 100755
--- a/amiga/launch.c
+++ b/amiga/launch.c
@@ -30,7 +30,7 @@
#include <proto/utility.h>
#include <proto/openurl.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/url.h"
struct Library *OpenURLBase = NULL;
diff --git a/amiga/menu.c b/amiga/menu.c
index 2c8f541..c7c3c46 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -50,7 +50,7 @@
#include "amiga/history_local.h"
#include "amiga/hotlist.h"
#include "amiga/menu.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "amiga/print.h"
#include "amiga/search.h"
#include "amiga/theme.h"
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 4d29830..c8a5c20 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -22,7 +22,7 @@
#include "amiga/gui.h"
#include "amiga/utf8.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/utils.h"
#include "utils/log.h"
diff --git a/amiga/print.c b/amiga/print.c
index ec04c62..f0689f7 100644
--- a/amiga/print.c
+++ b/amiga/print.c
@@ -20,7 +20,7 @@
#include "amiga/plotters.h"
#include "render/font.h"
#include "amiga/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "amiga/print.h"
#include "utils/messages.h"
#include "utils/utils.h"
diff --git a/amiga/stringview/urlhistory.c b/amiga/stringview/urlhistory.c
index ec56987..fa5aec4 100644
--- a/amiga/stringview/urlhistory.c
+++ b/amiga/stringview/urlhistory.c
@@ -29,7 +29,7 @@
#include "urlhistory.h"
#include "content/urldb.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
static struct List PageList;
diff --git a/amiga/system_colour.c b/amiga/system_colour.c
index c9be5ad..d78f54b 100644
--- a/amiga/system_colour.c
+++ b/amiga/system_colour.c
@@ -25,7 +25,7 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/tree.h"
#include <proto/graphics.h>
diff --git a/amiga/theme.c b/amiga/theme.c
index fa058e0..ca5e2b6 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -37,7 +37,7 @@
#include "amiga/bitmap.h"
#include "amiga/drag.h"
#include "desktop/browser_private.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "amiga/theme.h"
#include "desktop/searchweb.h"
#include "utils/messages.h"
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
index f1738d2..61102fe 100755
--- a/amiga/thumbnail.c
+++ b/amiga/thumbnail.c
@@ -20,7 +20,7 @@
#include "desktop/browser.h"
#include "amiga/gui.h"
#include "amiga/bitmap.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "content/urldb.h"
#include "desktop/plotters.h"
#include "desktop/thumbnail.h"
diff --git a/amiga/tree.c b/amiga/tree.c
index bbacfdc..ddaf81e 100644
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -53,7 +53,7 @@
#include "amiga/drag.h" /* drag icon stuff */
#include "amiga/theme.h" /* pointers */
#include "amiga/filetype.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "content/urldb.h"
#include "desktop/cookies.h"
#include "desktop/history_global_core.h"
diff --git a/atari/bitmap.c b/atari/bitmap.c
index 0f27be4..6d986fb 100755
--- a/atari/bitmap.c
+++ b/atari/bitmap.c
@@ -22,7 +22,7 @@
#include "assert.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "image/bitmap.h"
#include "atari/bitmap.h"
#include "atari/plot/plot.h"
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index 1806d54..5b33fe4 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -42,7 +42,7 @@
#include "atari/rootwin.h"
#include "atari/misc.h"
#include "atari/clipboard.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "atari/res/netsurf.rsh"
#include "atari/ctxmenu.h"
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index e2b0dea..e4bfa98 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -5,7 +5,7 @@
#include "utils/url.h"
#include "desktop/browser.h"
#include "desktop/browser_private.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "atari/res/netsurf.rsh"
#include "atari/gemtk/gemtk.h"
diff --git a/atari/download.c b/atari/download.c
index 32a6f12..407be06 100755
--- a/atari/download.c
+++ b/atari/download.c
@@ -30,7 +30,7 @@
#include "desktop/gui.h"
#include "desktop/history_core.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/textinput.h"
#include "desktop/download.h"
diff --git a/atari/font.c b/atari/font.c
index dfa0efe..7640f61 100755
--- a/atari/font.c
+++ b/atari/font.c
@@ -42,7 +42,7 @@
#include "render/font.h"
#include "utils/utf8.h"
#include "utils/log.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/mouse.h"
#include "desktop/plotters.h"
diff --git a/atari/gui.c b/atari/gui.c
index 776e30a..97d63ce 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -40,7 +40,7 @@
#include "desktop/netsurf.h"
#include "desktop/401login.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/textinput.h"
#include "desktop/browser.h"
@@ -922,7 +922,7 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/atari/history.c b/atari/history.c
index aa32cbf..49e24ce 100755
--- a/atari/history.c
+++ b/atari/history.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <time.h>
#include "desktop/browser.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/tree.h"
#include "desktop/tree_url_node.h"
#include "desktop/gui.h"
diff --git a/atari/hotlist.c b/atari/hotlist.c
index adfd596..f3b093d 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -27,7 +27,7 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/hotlist.h"
#include "desktop/tree.h"
#include "desktop/tree_url_node.h"
diff --git a/atari/misc.c b/atari/misc.c
index e8e6a9b..96abcf5 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -31,7 +31,7 @@
#include "desktop/mouse.h"
#include "desktop/cookies.h"
#include "desktop/tree.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/url.h"
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index ed850bc..8b3980d 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -22,7 +22,7 @@
#include <ft2build.h>
#include FT_CACHE_H
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "atari/plot/plot.h"
#include "atari/plot/font_freetype.h"
#include "atari/findfile.h"
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index dfd9b0e..33810b7 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -34,7 +34,7 @@
#include "atari/bitmap.h"
#include "atari/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "atari/plot/plot.h"
void vq_scrninfo(VdiHdl handle, short *work_out);
diff --git a/atari/settings.c b/atari/settings.c
index 5244a7f..1fc425a 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -9,7 +9,7 @@
#include <stdbool.h>
#include <cflib.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plot_style.h"
#include "atari/res/netsurf.rsh"
#include "atari/settings.h"
diff --git a/atari/system_colour.c b/atari/system_colour.c
index 5f86733..efcd7b6 100644
--- a/atari/system_colour.c
+++ b/atari/system_colour.c
@@ -28,7 +28,7 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plot_style.h"
struct gui_system_colour_ctx {
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 18d8a45..79be31b 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -37,7 +37,7 @@
#include "desktop/plot_style.h"
#include "desktop/plotters.h"
#include "desktop/tree.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/utf8.h"
#include "atari/clipboard.h"
#include "atari/gui.h"
diff --git a/beos/fetch_rsrc.cpp b/beos/fetch_rsrc.cpp
index 6f78aaf..c52cafe 100644
--- a/beos/fetch_rsrc.cpp
+++ b/beos/fetch_rsrc.cpp
@@ -35,7 +35,7 @@ extern "C" {
#include "content/fetch.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
diff --git a/beos/font.cpp b/beos/font.cpp
index b73c9cc..5636743 100644
--- a/beos/font.cpp
+++ b/beos/font.cpp
@@ -35,7 +35,7 @@ extern "C" {
#include "render/font.h"
#include "utils/utils.h"
#include "utils/log.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
}
#include "beos/gui.h"
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 0913466..4d4549c 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -53,7 +53,7 @@ extern "C" {
#include "desktop/cookies.h"
#include "desktop/gui.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "render/form.h"
#include "utils/filename.h"
@@ -467,7 +467,7 @@ int gui_init_replicant(int argc, char** argv)
return 0;
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/beos/gui_options.cpp b/beos/gui_options.cpp
index 62e6640..2c56cf7 100644
--- a/beos/gui_options.cpp
+++ b/beos/gui_options.cpp
@@ -23,7 +23,7 @@
#include <string.h>
extern "C" {
#include "utils/log.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
}
#include "beos/gui.h"
#include "beos/scaffolding.h"
diff --git a/beos/plotters.cpp b/beos/plotters.cpp
index aabf302..c2a99fe 100644
--- a/beos/plotters.cpp
+++ b/beos/plotters.cpp
@@ -35,7 +35,7 @@ extern "C" {
#include "render/font.h"
#include "utils/log.h"
#include "utils/utils.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
}
#include "beos/font.h"
#include "beos/gui.h"
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 9954dd6..fe40b0c 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -56,7 +56,7 @@ extern "C" {
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "desktop/plotters.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/textinput.h"
#include "render/font.h"
#include "render/form.h"
diff --git a/beos/system_colour.cpp b/beos/system_colour.cpp
index 9f3f408..7a94d4c 100644
--- a/beos/system_colour.cpp
+++ b/beos/system_colour.cpp
@@ -34,7 +34,7 @@ extern "C" {
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plot_style.h"
}
diff --git a/beos/window.cpp b/beos/window.cpp
index 3ce8e27..64ef616 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "css/utils.h"
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/textinput.h"
#include "render/font.h"
#include "utils/log.h"
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m
index 4bda3b5..c472fd7 100644
--- a/cocoa/BrowserView.m
+++ b/cocoa/BrowserView.m
@@ -27,7 +27,7 @@
#import "desktop/history_core.h"
#import "desktop/plotters.h"
#import "desktop/textinput.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
#import "utils/messages.h"
@interface BrowserView ()
diff --git a/cocoa/BrowserViewController.m b/cocoa/BrowserViewController.m
index bea383d..4952f52 100644
--- a/cocoa/BrowserViewController.m
+++ b/cocoa/BrowserViewController.m
@@ -23,7 +23,7 @@
#import "desktop/browser_private.h"
#import "desktop/history_core.h"
#import "desktop/textinput.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
#import "utils/corestrings.h"
#import "utils/filename.h"
diff --git a/cocoa/BrowserWindowController.m b/cocoa/BrowserWindowController.m
index 7688c1a..2edb9a1 100644
--- a/cocoa/BrowserWindowController.m
+++ b/cocoa/BrowserWindowController.m
@@ -26,7 +26,7 @@
#import "cocoa/NetsurfApp.h"
#import "desktop/browser.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
#import "utils/messages.h"
@interface BrowserWindowController ()
diff --git a/cocoa/NetSurfAppDelegate.m b/cocoa/NetSurfAppDelegate.m
index 0a352c6..4a66212 100644
--- a/cocoa/NetSurfAppDelegate.m
+++ b/cocoa/NetSurfAppDelegate.m
@@ -22,7 +22,7 @@
#import "cocoa/HistoryWindowController.h"
#import "desktop/browser.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
#import "utils/messages.h"
@interface NetSurfAppDelegate ()
diff --git a/cocoa/NetsurfApp.m b/cocoa/NetsurfApp.m
index 1c288e8..0bcbefd 100644
--- a/cocoa/NetsurfApp.m
+++ b/cocoa/NetsurfApp.m
@@ -29,7 +29,7 @@
#import "desktop/history_core.h"
#import "desktop/mouse.h"
#import "desktop/netsurf.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
#import "desktop/plotters.h"
#import "desktop/save_complete.h"
#import "desktop/textinput.h"
@@ -163,7 +163,7 @@ void cocoa_autorelease( void )
pool = [[NSAutoreleasePool alloc] init];
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/cocoa/PreferencesWindowController.m b/cocoa/PreferencesWindowController.m
index 8ee4580..a3abe29 100644
--- a/cocoa/PreferencesWindowController.m
+++ b/cocoa/PreferencesWindowController.m
@@ -24,7 +24,7 @@
#import "desktop/browser_private.h"
#import "content/content.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
@implementation PreferencesWindowController
diff --git a/cocoa/font.m b/cocoa/font.m
index 915e7c8..08fad0a 100644
--- a/cocoa/font.m
+++ b/cocoa/font.m
@@ -22,7 +22,7 @@
#import "cocoa/font.h"
#import "css/css.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
#import "render/font.h"
#import "desktop/plotters.h"
diff --git a/cocoa/gui.m b/cocoa/gui.m
index fe92c52..b2ff01d 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -28,7 +28,7 @@
#import "desktop/gui.h"
#import "desktop/netsurf.h"
#import "desktop/browser_private.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
#import "desktop/textinput.h"
#import "desktop/401login.h"
#import "utils/utils.h"
diff --git a/cocoa/system_colour.m b/cocoa/system_colour.m
index bd3e87f..48330d0 100644
--- a/cocoa/system_colour.m
+++ b/cocoa/system_colour.m
@@ -24,7 +24,7 @@
#import "utils/utils.h"
#import "utils/log.h"
#import "desktop/gui.h"
-#import "desktop/options.h"
+#import "utils/nsoption.h"
struct gui_system_colour_ctx {
const char *name;
diff --git a/content/content.c b/content/content.c
index 9bf4312..891ad23 100644
--- a/content/content.c
+++ b/content/content.c
@@ -37,7 +37,7 @@
#include "css/css.h"
#include "image/bitmap.h"
#include "desktop/browser.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "render/html.h"
#include "render/textplain.h"
diff --git a/content/fetch.c b/content/fetch.c
index bfe4458..6f829bb 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -45,7 +45,7 @@
#include "content/fetchers/file.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 387e32a..85723e8 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -47,7 +47,7 @@
#include "content/fetchers/about.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 668e05a..ed4c759 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -45,7 +45,7 @@
#include "content/fetchers/curl.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/schedule.h"
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index 77d3c9f..fbaa247 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -34,7 +34,7 @@
#include "content/fetchers/data.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index b7b831d..21cee79 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -47,7 +47,7 @@
#include "content/fetchers/file.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/errors.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 1fc33f8..4afd443 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -42,7 +42,7 @@
#include "content/fetchers/resource.h"
#include "content/urldb.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
diff --git a/content/urldb.c b/content/urldb.c
index 059c3c6..c950dcd 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -101,7 +101,7 @@
#include "content/content.h"
#include "content/urldb.h"
#include "desktop/cookies.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/corestrings.h"
#include "utils/filename.h"
diff --git a/css/select.c b/css/select.c
index b9b8c28..0f1962b 100644
--- a/css/select.c
+++ b/css/select.c
@@ -27,7 +27,7 @@
#include "css/select.h"
#include "css/utils.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/url.h"
diff --git a/css/utils.c b/css/utils.c
index d5acf49..9bf743c 100644
--- a/css/utils.c
+++ b/css/utils.c
@@ -21,7 +21,7 @@
#include "css/utils.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
/** Screen DPI in fixed point units: defaults to 90, which RISC OS uses */
diff --git a/desktop/browser.c b/desktop/browser.c
index ac8c699..ea31715 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -49,7 +49,7 @@
#include "desktop/hotlist.h"
#include "desktop/gui.h"
#include "desktop/knockout.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/scrollbar.h"
#include "desktop/selection.h"
#include "desktop/plotters.h"
diff --git a/desktop/cookies.c b/desktop/cookies.c
index 197b3fb..9f66aea 100644
--- a/desktop/cookies.c
+++ b/desktop/cookies.c
@@ -31,7 +31,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/cookies.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/tree.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index b6e342c..f63969b 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -40,7 +40,7 @@
#include "desktop/401login.h"
#include "desktop/browser.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/searchweb.h"
#include "javascript/js.h"
diff --git a/desktop/options.c b/desktop/options.c
index 2a080d5..00c37f1 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -36,7 +36,7 @@
#include "desktop/plot_style.h"
#include "utils/log.h"
#include "utils/utils.h"
-#include "desktop/options.h"
+#include "utils/nsoptions.h"
struct ns_options nsoptions = {
NSOPTION_MAIN_DEFAULTS,
diff --git a/desktop/print.c b/desktop/print.c
index e1cd48f..8f83f2d 100644
--- a/desktop/print.c
+++ b/desktop/print.c
@@ -30,7 +30,7 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "css/utils.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/print.h"
#include "desktop/printer.h"
#include "render/box.h"
diff --git a/desktop/save_pdf/font_haru.c b/desktop/save_pdf/font_haru.c
index c907531..57d36fe 100644
--- a/desktop/save_pdf/font_haru.c
+++ b/desktop/save_pdf/font_haru.c
@@ -39,7 +39,7 @@
#include "css/css.h"
#include "css/utils.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_pdf/font_haru.h"
#include "render/font.h"
#include "utils/log.h"
diff --git a/desktop/save_pdf/pdf_plotters.c b/desktop/save_pdf/pdf_plotters.c
index 847d6da..123408d 100644
--- a/desktop/save_pdf/pdf_plotters.c
+++ b/desktop/save_pdf/pdf_plotters.c
@@ -31,7 +31,7 @@
#include <hpdf.h>
#include "content/hlcache.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/print.h"
#include "desktop/printer.h"
diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c
index 5517a6f..d24ea72 100644
--- a/desktop/scrollbar.c
+++ b/desktop/scrollbar.c
@@ -27,7 +27,7 @@
#include "desktop/mouse.h"
#include "desktop/scrollbar.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/plot_style.h"
#include "utils/log.h"
diff --git a/desktop/search.c b/desktop/search.c
index 014488e..3a7c768 100644
--- a/desktop/search.c
+++ b/desktop/search.c
@@ -30,7 +30,7 @@
#include "content/hlcache.h"
#include "desktop/browser_private.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/search.h"
#include "desktop/selection.h"
#include "render/box.h"
diff --git a/desktop/searchweb.c b/desktop/searchweb.c
index a90627a..87e3e21 100644
--- a/desktop/searchweb.c
+++ b/desktop/searchweb.c
@@ -27,7 +27,7 @@
#include "content/hlcache.h"
#include "desktop/browser.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/searchweb.h"
#include "utils/config.h"
#include "utils/log.h"
diff --git a/desktop/thumbnail.c b/desktop/thumbnail.c
index 975e799..1011adc 100644
--- a/desktop/thumbnail.c
+++ b/desktop/thumbnail.c
@@ -27,7 +27,7 @@
#include "content/hlcache.h"
#include "desktop/browser.h"
#include "desktop/knockout.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/thumbnail.h"
#include "utils/log.h"
diff --git a/desktop/tree.c b/desktop/tree.c
index c62793e..25bd948 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -34,7 +34,7 @@
#include "desktop/textarea.h"
#include "desktop/textinput.h"
#include "desktop/tree.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "render/font.h"
#include "utils/log.h"
diff --git a/desktop/tree_url_node.c b/desktop/tree_url_node.c
index 938cd1d..945893f 100644
--- a/desktop/tree_url_node.c
+++ b/desktop/tree_url_node.c
@@ -32,7 +32,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/browser.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/tree_url_node.h"
#include "utils/corestrings.h"
#include "utils/libdom.h"
diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c
index 987b101..87751a3 100644
--- a/framebuffer/font_freetype.c
+++ b/framebuffer/font_freetype.c
@@ -29,7 +29,7 @@
#include "utils/filepath.h"
#include "utils/utf8.h"
#include "utils/log.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
diff --git a/framebuffer/font_internal.c b/framebuffer/font_internal.c
index ff2bfa1..60f1b8e 100644
--- a/framebuffer/font_internal.c
+++ b/framebuffer/font_internal.c
@@ -23,7 +23,7 @@
#include <assert.h>
#include "css/css.h"
#include "render/font.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/utf8.h"
#include "framebuffer/gui.h"
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 4277557..7e2ff2b 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -36,7 +36,7 @@
#include "desktop/mouse.h"
#include "desktop/plotters.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/filepath.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -476,7 +476,7 @@ process_cmdline(int argc, char** argv)
return true;
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/framebuffer/localhistory.c b/framebuffer/localhistory.c
index f6c24a1..e23dd1f 100644
--- a/framebuffer/localhistory.c
+++ b/framebuffer/localhistory.c
@@ -35,7 +35,7 @@
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/url.h"
#include "utils/messages.h"
diff --git a/framebuffer/system_colour.c b/framebuffer/system_colour.c
index 18b25ee..139cd47 100644
--- a/framebuffer/system_colour.c
+++ b/framebuffer/system_colour.c
@@ -24,7 +24,7 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
struct gui_system_colour_ctx {
const char *name;
diff --git a/gtk/completion.c b/gtk/completion.c
index d249db1..a0df08a 100644
--- a/gtk/completion.c
+++ b/gtk/completion.c
@@ -21,7 +21,7 @@
#include "content/urldb.h"
#include "utils/log.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
GtkListStore *nsgtk_completion_list;
diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c
index 2784eb7..430554c 100644
--- a/gtk/dialogs/preferences.c
+++ b/gtk/dialogs/preferences.c
@@ -20,7 +20,7 @@
#include <math.h>
#include "desktop/browser_private.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/searchweb.h"
#include "utils/log.h"
#include "utils/utils.h"
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index c506790..ef4e36e 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -33,7 +33,7 @@
#include "desktop/browser_private.h"
#include "desktop/netsurf.h"
#include "desktop/print.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/url.h"
#include "utils/utils.h"
diff --git a/gtk/download.c b/gtk/download.c
index 71b1aa6..e882ec7 100644
--- a/gtk/download.c
+++ b/gtk/download.c
@@ -30,7 +30,7 @@
#include "desktop/gui.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "gtk/download.h"
#include "gtk/window.h"
#include "gtk/compat.h"
diff --git a/gtk/font_pango.c b/gtk/font_pango.c
index de115fa..aa4fae3 100644
--- a/gtk/font_pango.c
+++ b/gtk/font_pango.c
@@ -34,7 +34,7 @@
#include "render/font.h"
#include "utils/utils.h"
#include "utils/log.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
static bool nsfont_width(const plot_font_style_t *fstyle,
const char *string, size_t length,
diff --git a/gtk/gui.c b/gtk/gui.c
index 832d79e..3408bb9 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -49,7 +49,7 @@
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/save_pdf/pdf_plotters.h"
#include "desktop/searchweb.h"
@@ -241,7 +241,7 @@ nsgtk_init_glade(char **respath)
widWarning = GTK_WIDGET(gtk_builder_get_object(gladeWarning, "labelWarning"));
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
char *hdir = getenv("HOME");
diff --git a/gtk/hotlist.c b/gtk/hotlist.c
index d7b5b9e..d249d34 100644
--- a/gtk/hotlist.c
+++ b/gtk/hotlist.c
@@ -18,7 +18,7 @@
#include "desktop/hotlist.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/tree.h"
#include "gtk/gui.h"
diff --git a/gtk/plotters.c b/gtk/plotters.c
index 3af55b9..2650611 100644
--- a/gtk/plotters.c
+++ b/gtk/plotters.c
@@ -37,7 +37,7 @@
#include "gtk/plotters.h"
#include "gtk/scaffolding.h"
#include "render/font.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "gtk/bitmap.h"
GtkWidget *current_widget;
diff --git a/gtk/print.c b/gtk/print.c
index 02d89bb..68a96dc 100644
--- a/gtk/print.c
+++ b/gtk/print.c
@@ -33,7 +33,7 @@
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/print.h"
#include "desktop/printer.h"
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 5abda62..01f7fe5 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -37,7 +37,7 @@
#include "desktop/hotlist.h"
#include "desktop/gui.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/print.h"
#include "desktop/save_complete.h"
diff --git a/gtk/system_colour.c b/gtk/system_colour.c
index 6c1fd81..c136e50 100644
--- a/gtk/system_colour.c
+++ b/gtk/system_colour.c
@@ -24,7 +24,7 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
struct gui_system_colour_ctx {
const char *name;
diff --git a/gtk/tabs.c b/gtk/tabs.c
index e68a192..462f666 100644
--- a/gtk/tabs.c
+++ b/gtk/tabs.c
@@ -24,7 +24,7 @@
#include "gtk/gui.h"
#include "desktop/browser.h"
#include "content/content.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/search.h"
#include "utils/utils.h"
#include "gtk/search.h"
diff --git a/gtk/theme.c b/gtk/theme.c
index 402433c..9d50c59 100644
--- a/gtk/theme.c
+++ b/gtk/theme.c
@@ -31,7 +31,7 @@
#include "gtk/menu.h"
#include "gtk/theme.h"
#include "gtk/window.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "gtk/dialogs/preferences.h"
#include "utils/container.h"
#include "utils/log.h"
diff --git a/gtk/window.c b/gtk/window.c
index 557ea22..44b88d2 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -30,7 +30,7 @@
#include "gtk/window.h"
#include "desktop/browser_private.h"
#include "desktop/mouse.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "gtk/compat.h"
diff --git a/image/gif.c b/image/gif.c
index 704c971..4bd45c7 100644
--- a/image/gif.c
+++ b/image/gif.c
@@ -37,7 +37,7 @@
#include "utils/config.h"
#include "content/content_protected.h"
#include "content/hlcache.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "image/image.h"
#include "image/bitmap.h"
diff --git a/image/mng.c b/image/mng.c
index 518dc85..325d1d1 100644
--- a/image/mng.c
+++ b/image/mng.c
@@ -28,7 +28,7 @@
#include <time.h>
#include <libmng.h>
#include "content/content_protected.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "image/bitmap.h"
#include "image/mng.h"
diff --git a/javascript/jsapi/navigator.bnd b/javascript/jsapi/navigator.bnd
index 2fb0c2d..5a0bb39 100644
--- a/javascript/jsapi/navigator.bnd
+++ b/javascript/jsapi/navigator.bnd
@@ -22,8 +22,8 @@ preamble %{
#include <stdlib.h>
#include "desktop/netsurf.h"
-#include "desktop/options.h"
#include "utils/config.h"
+#include "utils/nsoption.h"
#include "utils/useragent.h"
#include "utils/log.h"
#include "utils/utsname.h"
diff --git a/javascript/none.c b/javascript/none.c
index 600a508..d4b8ce5 100644
--- a/javascript/none.c
+++ b/javascript/none.c
@@ -21,7 +21,7 @@
*/
#include "content/content.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "javascript/js.h"
#include "utils/log.h"
diff --git a/monkey/font.c b/monkey/font.c
index 7f390a4..a45b7fd 100644
--- a/monkey/font.c
+++ b/monkey/font.c
@@ -18,7 +18,7 @@
#include "css/css.h"
#include "render/font.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/utf8.h"
diff --git a/monkey/main.c b/monkey/main.c
index 6dd1a5a..2e37317 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include "monkey/filetype.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "monkey/poll.h"
#include "monkey/dispatch.h"
#include "monkey/browser.h"
@@ -92,7 +92,7 @@ static void quit_handler(int argc, char **argv)
netsurf_quit = true;
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/monkey/system_colour.c b/monkey/system_colour.c
index 6c1fd81..c136e50 100644
--- a/monkey/system_colour.c
+++ b/monkey/system_colour.c
@@ -24,7 +24,7 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
struct gui_system_colour_ctx {
const char *name;
diff --git a/render/box.c b/render/box.c
index 5dfada0..1f2c9fe 100644
--- a/render/box.c
+++ b/render/box.c
@@ -34,7 +34,7 @@
#include "css/utils.h"
#include "css/dump.h"
#include "desktop/scrollbar.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "render/box.h"
#include "render/form.h"
#include "render/html_internal.h"
diff --git a/render/box_construct.c b/render/box_construct.c
index 78d0f67..03e87e8 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -36,7 +36,7 @@
#include "css/css.h"
#include "css/utils.h"
#include "css/select.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "render/box.h"
#include "render/box_textarea.h"
#include "render/form.h"
diff --git a/render/font.c b/render/font.c
index a98a89a..03c5a36 100644
--- a/render/font.c
+++ b/render/font.c
@@ -18,7 +18,7 @@
#include "css/css.h"
#include "css/utils.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "render/font.h"
static plot_font_generic_family_t plot_font_generic_family(
diff --git a/render/html.c b/render/html.c
index c3430a4..0f63967 100644
--- a/render/html.c
+++ b/render/html.c
@@ -32,7 +32,7 @@
#include "content/content_protected.h"
#include "content/fetch.h"
#include "content/hlcache.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/selection.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
diff --git a/render/html_css.c b/render/html_css.c
index 7c09620..b45275b 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -28,7 +28,7 @@
#include <stdlib.h>
#include "content/hlcache.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "render/html_internal.h"
#include "utils/corestrings.h"
#include "utils/config.h"
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 7c3de2a..6f4d9bd 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -32,7 +32,7 @@
#include "desktop/browser.h"
#include "desktop/frames.h"
#include "desktop/mouse.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/scrollbar.h"
#include "desktop/selection.h"
#include "desktop/textarea.h"
diff --git a/render/html_object.c b/render/html_object.c
index d4d0ff9..1cc32a8 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -28,7 +28,7 @@
#include <stdlib.h>
#include "content/hlcache.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/scrollbar.h"
#include "render/box.h"
#include "render/html_internal.h"
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 91df897..7347d84 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -38,7 +38,7 @@
#include "css/utils.h"
#include "desktop/plotters.h"
#include "desktop/selection.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/print.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
diff --git a/render/layout.c b/render/layout.c
index 18f67b7..14d06ee 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -44,7 +44,7 @@
#include "css/css.h"
#include "css/utils.h"
#include "content/content_protected.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
#include "render/box.h"
diff --git a/render/textplain.c b/render/textplain.c
index 89628f9..10cf16a 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -36,7 +36,7 @@
#include "css/utils.h"
#include "desktop/browser.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/search.h"
#include "desktop/selection.h"
diff --git a/riscos/bitmap.c b/riscos/bitmap.c
index d783682..0af01c9 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/palettes.h"
#include "riscos/content-handlers/sprite.h"
#include "riscos/tinct.h"
diff --git a/riscos/buffer.c b/riscos/buffer.c
index 6eec8bf..a1b99f4 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/tinct.h"
#include "riscos/wimp.h"
#include "riscos/wimputils.h"
diff --git a/riscos/configure/con_cache.c b/riscos/configure/con_cache.c
index cd21123..6e402fe 100644
--- a/riscos/configure/con_cache.c
+++ b/riscos/configure/con_cache.c
@@ -18,7 +18,7 @@
#include <stdbool.h>
#include "oslib/hourglass.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
diff --git a/riscos/configure/con_connect.c b/riscos/configure/con_connect.c
index c47e904..d9919d0 100644
--- a/riscos/configure/con_connect.c
+++ b/riscos/configure/con_connect.c
@@ -20,7 +20,7 @@
#include "swis.h"
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/configure/configure.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
diff --git a/riscos/configure/con_content.c b/riscos/configure/con_content.c
index 81537bc..122b0e3 100644
--- a/riscos/configure/con_content.c
+++ b/riscos/configure/con_content.c
@@ -17,7 +17,7 @@
*/
#include <stdbool.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
diff --git a/riscos/configure/con_fonts.c b/riscos/configure/con_fonts.c
index 0bd13ce..6261155 100644
--- a/riscos/configure/con_fonts.c
+++ b/riscos/configure/con_fonts.c
@@ -18,7 +18,7 @@
#include <stdbool.h>
#include "css/css.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plot_style.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
diff --git a/riscos/configure/con_home.c b/riscos/configure/con_home.c
index 9e966b9..6f7d010 100644
--- a/riscos/configure/con_home.c
+++ b/riscos/configure/con_home.c
@@ -17,7 +17,7 @@
*/
#include <stdbool.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
diff --git a/riscos/configure/con_image.c b/riscos/configure/con_image.c
index 8617e6d..147f5d6 100644
--- a/riscos/configure/con_image.c
+++ b/riscos/configure/con_image.c
@@ -20,7 +20,7 @@
#include "swis.h"
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/configure/configure.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
diff --git a/riscos/configure/con_inter.c b/riscos/configure/con_inter.c
index be2114b..2af5e3a 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/configure.h"
diff --git a/riscos/configure/con_language.c b/riscos/configure/con_language.c
index be40b1c..7e483b5 100644
--- a/riscos/configure/con_language.c
+++ b/riscos/configure/con_language.c
@@ -18,7 +18,7 @@
*/
#include <stdbool.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
diff --git a/riscos/configure/con_memory.c b/riscos/configure/con_memory.c
index 5bf8905..2736849 100644
--- a/riscos/configure/con_memory.c
+++ b/riscos/configure/con_memory.c
@@ -17,7 +17,7 @@
*/
#include <stdbool.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/bitmap.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
diff --git a/riscos/configure/con_secure.c b/riscos/configure/con_secure.c
index 568a03d..75e2bc7 100644
--- a/riscos/configure/con_secure.c
+++ b/riscos/configure/con_secure.c
@@ -17,7 +17,7 @@
*/
#include <stdbool.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
diff --git a/riscos/configure/con_theme.c b/riscos/configure/con_theme.c
index b41484b..c4d605c 100644
--- a/riscos/configure/con_theme.c
+++ b/riscos/configure/con_theme.c
@@ -23,7 +23,7 @@
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "utils/config.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/configure/configure.h"
#include "riscos/configure.h"
#include "riscos/dialog.h"
diff --git a/riscos/cookies.c b/riscos/cookies.c
index 347b43d..8fb4594 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/toolbar.h"
#include "riscos/treeview.h"
#include "riscos/wimp.h"
diff --git a/riscos/dialog.c b/riscos/dialog.c
index 5e4bbbf..b00aee6 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/save.h"
#include "riscos/sslcert.h"
#include "riscos/toolbar.h"
diff --git a/riscos/download.c b/riscos/download.c
index 233d193..089714c 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/save.h"
#include "riscos/query.h"
#include "riscos/wimp.h"
diff --git a/riscos/font.c b/riscos/font.c
index b949a57..68ee6b6 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
diff --git a/riscos/global_history.c b/riscos/global_history.c
index ca51b72..8eeb924 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/save.h"
#include "riscos/toolbar.h"
#include "riscos/treeview.h"
diff --git a/riscos/gui.c b/riscos/gui.c
index bca2a70..50cccef 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -60,7 +60,7 @@
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/save_complete.h"
#include "desktop/sslcert.h"
#include "desktop/tree.h"
@@ -328,7 +328,7 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/riscos/help.c b/riscos/help.c
index ae2a2af..14d34af 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/treeview.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
diff --git a/riscos/history.c b/riscos/history.c
index 8a3b562..65ae847 100644
--- a/riscos/history.c
+++ b/riscos/history.c
@@ -31,7 +31,7 @@
#include "desktop/plotters.h"
#include "riscos/dialog.h"
#include "desktop/browser_private.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
diff --git a/riscos/hotlist.c b/riscos/hotlist.c
index 53212c1..b8449cd 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/save.h"
#include "riscos/toolbar.h"
#include "riscos/treeview.h"
diff --git a/riscos/iconbar.c b/riscos/iconbar.c
index 6c7996a..f6c0942 100644
--- a/riscos/iconbar.c
+++ b/riscos/iconbar.c
@@ -38,7 +38,7 @@
#include "riscos/hotlist.h"
#include "riscos/iconbar.h"
#include "desktop/browser.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/wimp_event.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/riscos/image.c b/riscos/image.c
index 3d4f28b..ae2534f 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/tinct.h"
#include "utils/log.h"
#include "utils/utils.h"
diff --git a/riscos/menus.c b/riscos/menus.c
index 5c80fd9..aaec8cf 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -50,7 +50,7 @@
#include "riscos/help.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/save.h"
#include "riscos/tinct.h"
#include "riscos/toolbar.h"
diff --git a/riscos/print.c b/riscos/print.c
index 05eb8fd..0df77ef 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -33,7 +33,7 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "desktop/browser_private.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
diff --git a/riscos/save.c b/riscos/save.c
index 7ccbfb1..390165d 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -49,7 +49,7 @@
#include "riscos/gui.h"
#include "riscos/menus.h"
#include "riscos/message.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/query.h"
#include "riscos/save.h"
#include "riscos/save_draw.h"
diff --git a/riscos/system_colour.c b/riscos/system_colour.c
index 104aa3b..39a86ac 100644
--- a/riscos/system_colour.c
+++ b/riscos/system_colour.c
@@ -26,7 +26,7 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/system_colour.h"
struct gui_system_colour_ctx {
diff --git a/riscos/theme.c b/riscos/theme.c
index b44493d..f1b7ae2 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/theme.h"
#include "riscos/treeview.h"
#include "riscos/wimp.h"
diff --git a/riscos/theme_install.c b/riscos/theme_install.c
index e5d5aaf..0d436dc 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/theme.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
diff --git a/riscos/thumbnail.c b/riscos/thumbnail.c
index 2a140ce..6686455 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 "desktop/options.h"
+#include "utils/nsoption.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 7e95ce6..d56c6fa 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 "desktop/options.h"
+#include "utils/nsoption.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 990ce42..e26cb65 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/toolbar.h"
#include "riscos/url_complete.h"
#include "riscos/wimp.h"
diff --git a/riscos/window.c b/riscos/window.c
index 295315d..e7b3699 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 "desktop/options.h"
+#include "utils/nsoption.h"
#include "riscos/oslib_pre7.h"
#include "riscos/save.h"
#include "riscos/content-handlers/sprite.h"
diff --git a/test/urldbtest.c b/test/urldbtest.c
index ab441ff..bc9d899 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -33,7 +33,7 @@
#include "content/content.h"
#include "content/urldb.h"
#include "desktop/cookies.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#ifdef riscos
/** \todo lose this */
#include "riscos/bitmap.h"
diff --git a/windows/font.c b/windows/font.c
index 564a7de..c99cec7 100644
--- a/windows/font.c
+++ b/windows/font.c
@@ -28,7 +28,7 @@
#include "css/css.h"
#include "render/font.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/utf8.h"
#include "windows/font.h"
diff --git a/windows/gui.c b/windows/gui.c
index e318f3a..159e8f0 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -36,7 +36,7 @@
#include "desktop/history_core.h"
#include "desktop/mouse.h"
#include "desktop/netsurf.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/textinput.h"
#include "render/html.h"
diff --git a/windows/main.c b/windows/main.c
index 3ead210..3843868 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -24,7 +24,7 @@
#include <windows.h>
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "desktop/browser.h"
#include "utils/utils.h"
#include "utils/log.h"
@@ -80,7 +80,7 @@ static bool nslog_ensure(FILE *fptr)
return true;
}
-/* Documented in desktop/options.h */
+/* Documented in utils/nsoption.h */
void gui_options_init_defaults(void)
{
/* Set defaults for absent option strings */
diff --git a/windows/prefs.c b/windows/prefs.c
index 577c2a5..360a540 100644
--- a/windows/prefs.c
+++ b/windows/prefs.c
@@ -21,7 +21,7 @@
#include <windows.h>
#include <commctrl.h>
-#include "desktop/options.h"
+#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
diff --git a/windows/system_colour.c b/windows/system_colour.c
index 6c1fd81..c136e50 100644
--- a/windows/system_colour.c
+++ b/windows/system_colour.c
@@ -24,7 +24,7 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/options.h"
+#include "utils/nsoption.h"
struct gui_system_colour_ctx {
const char *name;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d272e1393d68efb7d96...
commit d272e1393d68efb7d96f835d7032c06b0ab9527f
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
change all core and frontend options headers to new format
diff --git a/amiga/options.h b/amiga/options.h
index 822a7a3..afd4fbb 100644
--- a/amiga/options.h
+++ b/amiga/options.h
@@ -16,207 +16,77 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
-#error "Frontend options header cannot be included directly"
-#endif
-
#ifndef AMIGA_OPTIONS_H
#define AMIGA_OPTIONS_H
-#define NSOPTION_EXTRA_DEFINE \
- char *url_file; \
- char *hotlist_file; \
- char *use_pubscreen; \
- char *modeid; \
- int screen_compositing; \
- int amiga_ydpi; \
- int cache_bitmaps; \
- char *theme; \
- bool utf8_clipboard; \
- bool context_menu; \
- bool truecolour_mouse_pointers; \
- bool use_os_pointers; \
- bool use_openurl_lib; \
- bool new_tab_active; \
- bool new_tab_last; \
- bool tab_close_warn; \
- bool tab_always_show; \
- bool kiosk_mode; \
- char *search_engines_file; \
- char *arexx_dir; \
- char *arexx_startup; \
- char *arexx_shutdown; \
- char *download_dir; \
- bool download_notify; \
- bool faster_scroll; \
- bool scale_quality; \
- int dither_quality; \
- int mask_alpha; \
- bool ask_overwrite; \
- int printer_unit; \
- int print_scale; \
- bool startup_no_window; \
- bool close_no_quit; \
- bool hide_docky_icon; \
- char *font_unicode; \
- char *font_unicode_file; \
- bool font_unicode_only; \
- bool font_antialiasing; \
- bool drag_save_icons; \
- int hotlist_window_xpos; \
- int hotlist_window_ypos; \
- int hotlist_window_xsize; \
- int hotlist_window_ysize; \
- int history_window_xpos; \
- int history_window_ypos; \
- int history_window_xsize; \
- int history_window_ysize; \
- int cookies_window_xpos; \
- int cookies_window_ypos; \
- int cookies_window_xsize; \
- int cookies_window_ysize; \
- int web_search_width; \
- int cairo_renderer; \
- bool direct_render; \
- bool window_simple_refresh; \
- bool resize_with_contents; \
- int reformat_delay; \
- int redraw_tile_size_x; \
- int redraw_tile_size_y; \
- int monitor_aspect_x; \
- int monitor_aspect_y; \
- bool accept_lang_locale; \
- int menu_refresh
+/* currently nothing here */
+
+#endif
-#define NSOPTION_EXTRA_DEFAULTS \
- .url_file = NULL, \
- .hotlist_file = NULL, \
- .use_pubscreen = NULL, \
- .modeid = NULL, \
- .screen_compositing = -1, \
- .amiga_ydpi = 85, \
- .cache_bitmaps = 0, \
- .theme = NULL, \
- .utf8_clipboard = false, \
- .context_menu = true, \
- .truecolour_mouse_pointers = false, \
- .use_os_pointers = true, \
- .use_openurl_lib = false, \
- .new_tab_active = false, \
- .new_tab_last = false, \
- .tab_close_warn = true, \
- .tab_always_show = false, \
- .kiosk_mode = false, \
- .search_engines_file = NULL, \
- .arexx_dir = NULL, \
- .arexx_startup = NULL, \
- .arexx_shutdown = NULL, \
- .download_dir = NULL, \
- .download_notify = false, \
- .faster_scroll = true, \
- .scale_quality = false, \
- .dither_quality = 1, \
- .mask_alpha = 50, \
- .ask_overwrite = true, \
- .printer_unit = 0, \
- .print_scale = 100, \
- .startup_no_window = false, \
- .close_no_quit = false, \
- .hide_docky_icon = false, \
- .font_unicode = NULL, \
- .font_unicode_file = NULL, \
- .font_unicode_only = false, \
- .font_antialiasing = true, \
- .drag_save_icons = true, \
- .hotlist_window_xpos = 0, \
- .hotlist_window_ypos = 0, \
- .hotlist_window_xsize = 0, \
- .hotlist_window_ysize = 0, \
- .history_window_xpos = 0, \
- .history_window_ypos = 0, \
- .history_window_xsize = 0, \
- .history_window_ysize = 0, \
- .cookies_window_xpos = 0, \
- .cookies_window_ypos = 0, \
- .cookies_window_xsize = 0, \
- .cookies_window_ysize = 0, \
- .web_search_width = 0, \
- .cairo_renderer = 0, \
- .direct_render = false, \
- .window_simple_refresh = false, \
- .resize_with_contents = false, \
- .reformat_delay = 0, \
- .redraw_tile_size_x = 0, \
- .redraw_tile_size_y = 0, \
- .monitor_aspect_x = 0, \
- .monitor_aspect_y = 0, \
- .accept_lang_locale = true, \
- .menu_refresh = 0
-#define NSOPTION_EXTRA_TABLE \
-{ "url_file", OPTION_STRING, &nsoptions.url_file }, \
-{ "hotlist_file", OPTION_STRING, &nsoptions.hotlist_file }, \
-{ "use_pubscreen", OPTION_STRING, &nsoptions.use_pubscreen}, \
-{ "screen_modeid", OPTION_STRING, &nsoptions.modeid}, \
-{ "screen_compositing", OPTION_INTEGER, &nsoptions.screen_compositing}, \
-{ "screen_ydpi", OPTION_INTEGER, &nsoptions.amiga_ydpi}, \
-{ "cache_bitmaps", OPTION_INTEGER, &nsoptions.cache_bitmaps}, \
-{ "theme", OPTION_STRING, &nsoptions.theme}, \
-{ "clipboard_write_utf8", OPTION_BOOL, &nsoptions.utf8_clipboard}, \
-{ "context_menu", OPTION_BOOL, &nsoptions.context_menu}, \
-{ "truecolour_mouse_pointers", OPTION_BOOL, &nsoptions.truecolour_mouse_pointers}, \
-{ "os_mouse_pointers", OPTION_BOOL, &nsoptions.use_os_pointers}, \
-{ "use_openurl_lib", OPTION_BOOL, &nsoptions.use_openurl_lib}, \
-{ "new_tab_is_active", OPTION_BOOL, &nsoptions.new_tab_active}, \
-{ "new_tab_last", OPTION_BOOL, &nsoptions.new_tab_last}, \
-{ "tab_close_warn", OPTION_BOOL, &nsoptions.tab_close_warn}, \
-{ "tab_always_show", OPTION_BOOL, &nsoptions.tab_always_show}, \
-{ "kiosk_mode", OPTION_BOOL, &nsoptions.kiosk_mode}, \
-{ "search_engines_file",OPTION_STRING, &nsoptions.search_engines_file }, \
-{ "arexx_dir", OPTION_STRING, &nsoptions.arexx_dir }, \
-{ "arexx_startup", OPTION_STRING, &nsoptions.arexx_startup }, \
-{ "arexx_shutdown", OPTION_STRING, &nsoptions.arexx_shutdown }, \
-{ "download_dir", OPTION_STRING, &nsoptions.download_dir }, \
-{ "download_notify", OPTION_BOOL, &nsoptions.download_notify}, \
-{ "faster_scroll", OPTION_BOOL, &nsoptions.faster_scroll}, \
-{ "scale_quality", OPTION_BOOL, &nsoptions.scale_quality}, \
-{ "dither_quality", OPTION_INTEGER, &nsoptions.dither_quality}, \
-{ "mask_alpha", OPTION_INTEGER, &nsoptions.mask_alpha}, \
-{ "ask_overwrite", OPTION_BOOL, &nsoptions.ask_overwrite}, \
-{ "printer_unit", OPTION_INTEGER, &nsoptions.printer_unit}, \
-{ "print_scale", OPTION_INTEGER, &nsoptions.print_scale}, \
-{ "startup_no_window", OPTION_BOOL, &nsoptions.startup_no_window}, \
-{ "close_no_quit", OPTION_BOOL, &nsoptions.close_no_quit}, \
-{ "hide_docky_icon", OPTION_BOOL, &nsoptions.hide_docky_icon}, \
-{ "font_unicode", OPTION_STRING, &nsoptions.font_unicode }, \
-{ "font_unicode_file", OPTION_STRING, &nsoptions.font_unicode_file }, \
-{ "font_unicode_only", OPTION_BOOL, &nsoptions.font_unicode_only }, \
-{ "font_antialiasing", OPTION_BOOL, &nsoptions.font_antialiasing }, \
-{ "drag_save_icons", OPTION_BOOL, &nsoptions.drag_save_icons}, \
-{ "hotlist_window_xpos", OPTION_INTEGER, &nsoptions.hotlist_window_xpos}, \
-{ "hotlist_window_ypos", OPTION_INTEGER, &nsoptions.hotlist_window_ypos}, \
-{ "hotlist_window_xsize", OPTION_INTEGER, &nsoptions.hotlist_window_xsize}, \
-{ "hotlist_window_ysize", OPTION_INTEGER, &nsoptions.hotlist_window_ysize}, \
-{ "history_window_xpos", OPTION_INTEGER, &nsoptions.history_window_xpos}, \
-{ "history_window_ypos", OPTION_INTEGER, &nsoptions.history_window_ypos}, \
-{ "history_window_xsize", OPTION_INTEGER, &nsoptions.history_window_xsize}, \
-{ "history_window_ysize", OPTION_INTEGER, &nsoptions.history_window_ysize}, \
-{ "cookies_window_xpos", OPTION_INTEGER, &nsoptions.cookies_window_xpos}, \
-{ "cookies_window_ypos", OPTION_INTEGER, &nsoptions.cookies_window_ypos}, \
-{ "cookies_window_xsize", OPTION_INTEGER, &nsoptions.cookies_window_xsize}, \
-{ "cookies_window_ysize", OPTION_INTEGER, &nsoptions.cookies_window_ysize}, \
-{ "web_search_width", OPTION_INTEGER, &nsoptions.web_search_width}, \
-{ "cairo_renderer", OPTION_INTEGER, &nsoptions.cairo_renderer}, \
-{ "direct_render", OPTION_BOOL, &nsoptions.direct_render}, \
-{ "window_simple_refresh", OPTION_BOOL, &nsoptions.window_simple_refresh}, \
-{ "resize_with_contents", OPTION_BOOL, &nsoptions.resize_with_contents}, \
-{ "reformat_delay", OPTION_INTEGER, &nsoptions.reformat_delay}, \
-{ "redraw_tile_size_x", OPTION_INTEGER, &nsoptions.redraw_tile_size_x}, \
-{ "redraw_tile_size_y", OPTION_INTEGER, &nsoptions.redraw_tile_size_y}, \
-{ "monitor_aspect_x", OPTION_INTEGER, &nsoptions.monitor_aspect_x}, \
-{ "monitor_aspect_y", OPTION_INTEGER, &nsoptions.monitor_aspect_y}, \
-{ "accept_lang_locale", OPTION_BOOL, &nsoptions.accept_lang_locale}, \
-{ "menu_refresh", OPTION_INTEGER, &nsoptions.menu_refresh}
+NSOPTION_STRING(url_file, NULL)
+NSOPTION_STRING(hotlist_file, NULL)
+NSOPTION_STRING(use_pubscreen, NULL)
+NSOPTION_STRING(screen_modeid, NULL)
+NSOPTION_INTEGER(screen_compositing, -1)
+NSOPTION_INTEGER(screen_ydpi, 85)
+NSOPTION_INTEGER(cache_bitmaps, 0)
+NSOPTION_STRING(theme, "PROGDIR:Resources/Themes/Default")
+NSOPTION_BOOL(clipboard_write_utf8, false)
+NSOPTION_BOOL(context_menu, true)
+NSOPTION_BOOL(truecolour_mouse_pointers, false)
+NSOPTION_BOOL(os_mouse_pointers, true)
+NSOPTION_BOOL(use_openurl_lib, false)
+NSOPTION_BOOL(new_tab_is_active, false)
+NSOPTION_BOOL(new_tab_last, false)
+NSOPTION_BOOL(tab_close_warn, true)
+NSOPTION_BOOL(tab_always_show, false)
+NSOPTION_BOOL(kiosk_mode, false)
+NSOPTION_STRING(search_engines_file, "PROGDIR:Resources/SearchEngines")
+NSOPTION_STRING(arexx_dir, "Rexx")
+NSOPTION_STRING(arexx_startup, "Startup.nsrx")
+NSOPTION_STRING(arexx_shutdown, "Shutdown.nsrx")
+NSOPTION_STRING(download_dir, NULL)
+NSOPTION_BOOL(download_notify, false)
+NSOPTION_BOOL(faster_scroll, true)
+NSOPTION_BOOL(scale_quality, false)
+NSOPTION_INTEGER(dither_quality, 1)
+NSOPTION_INTEGER(mask_alpha, 50)
+NSOPTION_BOOL(ask_overwrite, true)
+NSOPTION_INTEGER(printer_unit, 0)
+NSOPTION_INTEGER(print_scale, 100)
+NSOPTION_BOOL(startup_no_window, false)
+NSOPTION_BOOL(close_no_quit, false)
+NSOPTION_BOOL(hide_docky_icon, false)
+NSOPTION_STRING(font_unicode, NULL)
+NSOPTION_STRING(font_unicode_file, NULL)
+NSOPTION_BOOL(font_unicode_only, false)
+NSOPTION_BOOL(font_antialiasing, true)
+NSOPTION_BOOL(drag_save_icons, true)
+NSOPTION_INTEGER(hotlist_window_xpos, 0)
+NSOPTION_INTEGER(hotlist_window_ypos, 0)
+NSOPTION_INTEGER(hotlist_window_xsize, 0)
+NSOPTION_INTEGER(hotlist_window_ysize, 0)
+NSOPTION_INTEGER(history_window_xpos, 0)
+NSOPTION_INTEGER(history_window_ypos, 0)
+NSOPTION_INTEGER(history_window_xsize, 0)
+NSOPTION_INTEGER(history_window_ysize, 0)
+NSOPTION_INTEGER(cookies_window_xpos, 0)
+NSOPTION_INTEGER(cookies_window_ypos, 0)
+NSOPTION_INTEGER(cookies_window_xsize, 0)
+NSOPTION_INTEGER(cookies_window_ysize, 0)
+NSOPTION_INTEGER(web_search_width, 0)
+NSOPTION_INTEGER(cairo_renderer, 0)
+NSOPTION_BOOL(direct_render, false)
+NSOPTION_BOOL(window_simple_refresh, false)
+NSOPTION_BOOL(resize_with_contents, false)
+NSOPTION_INTEGER(reformat_delay, 0)
+NSOPTION_INTEGER(redraw_tile_size_x, 0)
+NSOPTION_INTEGER(redraw_tile_size_y, 0)
+NSOPTION_INTEGER(monitor_aspect_x, 0)
+NSOPTION_INTEGER(monitor_aspect_y, 0)
+NSOPTION_BOOL(accept_lang_locale, true)
+NSOPTION_INTEGER(menu_refresh, 0)
+
-#endif
diff --git a/atari/options.h b/atari/options.h
index f9bb3b4..7a4da6a 100755
--- a/atari/options.h
+++ b/atari/options.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,76 +16,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
-#error "Frontend options header cannot be included directly"
-#endif
-
#ifndef NS_ATARI_OPTIONS_H_
#define NS_ATARI_OPTIONS_H_
+/* setup longer default reflow time */
+#define DEFAULT_REFLOW_PERIOD 350 /* time in cs */
-#define NSOPTION_EXTRA_DEFINE \
- char *atari_font_driver; \
- int atari_font_monochrom; \
- int atari_dither; \
- int atari_transparency; \
- char *atari_face_sans_serif; /* default sans face */ \
- char *atari_face_sans_serif_bold; /* bold sans face */ \
- char *atari_face_sans_serif_italic; /* bold sans face */ \
- char *atari_face_sans_serif_italic_bold; /* bold sans face */ \
- char *atari_face_monospace; /* monospace face */ \
- char *atari_face_monospace_bold; /* monospace face */ \
- char *atari_face_serif; /* serif face */ \
- char *atari_face_serif_bold; /* bold serif face */ \
- char *atari_face_cursive; \
- char *atari_face_fantasy; \
- char *atari_editor; \
- char *downloads_path; \
- char *url_file; \
- char *hotlist_file; \
- char *tree_icons_path
-
-#define NSOPTION_EXTRA_DEFAULTS \
- .atari_font_driver = (char*)"freetype", \
- .atari_font_monochrom = 0, \
- .atari_dither = 1, \
- .atari_transparency = 1, \
- .atari_face_sans_serif = NULL, \
- .atari_face_sans_serif_bold = NULL, \
- .atari_face_sans_serif_italic = NULL, \
- .atari_face_sans_serif_italic_bold = NULL, \
- .atari_face_monospace = NULL, \
- .atari_face_monospace_bold = NULL, \
- .atari_face_serif = NULL, \
- .atari_face_serif_bold = NULL, \
- .atari_face_cursive = NULL, \
- .atari_face_fantasy = NULL, \
- .atari_editor = (char*)"", \
- .downloads_path = (char*)"downloads", \
- .url_file = (char*)"url.db", \
- .hotlist_file = (char*)"hotlist", \
- .tree_icons_path = (char*)"./res/icons"
+#endif
-#define NSOPTION_EXTRA_TABLE \
- { "atari_font_driver", OPTION_STRING, &nsoptions.atari_font_driver },\
- { "atari_font_monochrom", OPTION_INTEGER, &nsoptions.atari_font_monochrom },\
- { "atari_transparency", OPTION_INTEGER, &nsoptions.atari_transparency },\
- { "atari_dither", OPTION_INTEGER, &nsoptions.atari_dither },\
- { "atari_editor", OPTION_STRING, &nsoptions.atari_editor },\
- { "font_face_sans_serif", OPTION_STRING, &nsoptions.atari_face_sans_serif },\
- { "font_face_sans_serif_bold", OPTION_STRING, &nsoptions.atari_face_sans_serif_bold },\
- { "font_face_sans_serif_italic", OPTION_STRING, &nsoptions.atari_face_sans_serif_italic },\
- { "font_face_sans_serif_italic_bold", OPTION_STRING, &nsoptions.atari_face_sans_serif_italic_bold },\
- { "font_face_monospace", OPTION_STRING, &nsoptions.atari_face_monospace },\
- { "font_face_monospace_bold", OPTION_STRING, &nsoptions.atari_face_monospace_bold },\
- { "font_face_serif", OPTION_STRING, &nsoptions.atari_face_serif },\
- { "font_face_serif_bold", OPTION_STRING, &nsoptions.atari_face_serif_bold },\
- { "font_face_cursive", OPTION_STRING, &nsoptions.atari_face_cursive },\
- { "font_face_fantasy", OPTION_STRING, &nsoptions.atari_face_fantasy },\
- { "downloads_path", OPTION_STRING, &nsoptions.downloads_path },\
- { "url_file", OPTION_STRING, &nsoptions.url_file },\
- { "hotlist_file", OPTION_STRING, &nsoptions.hotlist_file },\
- { "tree_icons_path", OPTION_STRING, &nsoptions.tree_icons_path }
+NSOPTION_STRING(atari_font_driver, "freetype")
+NSOPTION_INTEGER(atari_font_monochrom, 0)
+NSOPTION_INTEGER(atari_transparency, 1)
+NSOPTION_INTEGER(atari_dither, 1)
+NSOPTION_STRING(atari_editor, NULL)
+NSOPTION_STRING(font_face_sans_serif, NULL)
+NSOPTION_STRING(font_face_sans_serif_bold, NULL)
+NSOPTION_STRING(font_face_sans_serif_italic, NULL)
+NSOPTION_STRING(font_face_sans_serif_italic_bold, NULL)
+NSOPTION_STRING(font_face_monospace, NULL)
+NSOPTION_STRING(font_face_monospace_bold, NULL)
+NSOPTION_STRING(font_face_serif, NULL)
+NSOPTION_STRING(font_face_serif_bold, NULL)
+NSOPTION_STRING(font_face_cursive, NULL)
+NSOPTION_STRING(font_face_fantasy, NULL)
+NSOPTION_STRING(downloads_path, "downloads")
+NSOPTION_STRING(url_file, "url.db")
+NSOPTION_STRING(hotlist_file, "hotlist")
+NSOPTION_STRING(tree_icons_path, "./res/icons")
-#endif
diff --git a/beos/options.h b/beos/options.h
index 9b8a3d1..40d23a3 100644
--- a/beos/options.h
+++ b/beos/options.h
@@ -17,23 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
-#error "Frontend options header cannot be included directly"
-#endif
#ifndef _NETSURF_BEOS_OPTIONS_H_
#define _NETSURF_BEOS_OPTIONS_H_
-#define NSOPTION_EXTRA_DEFINE \
- bool render_resample; \
- char *url_file
+/* currently nothing here */
-#define NSOPTION_EXTRA_DEFAULTS \
- .render_resample = false, \
- .url_file = 0
+#endif
-#define NSOPTION_EXTRA_TABLE \
- { "render_resample", OPTION_BOOL, &nsoptions.render_resample }, \
- { "url_file", OPTION_STRING, &nsoptions.url_file }
+NSOPTION_BOOL(render_resample, false)
+NSOPTION_STRING(url_file, NULL)
-#endif
diff --git a/desktop/options.h b/desktop/options.h
index 17ba64f..ee441c6 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -1,6 +1,5 @@
/*
- * Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
- * Copyright 2004 James Bursa <bursa(a)users.sourceforge.net>
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -18,171 +17,259 @@
*/
/** \file
- * Option reading and saving (interface).
+ * Option available on all platforms
*
- * Non-platform specific options can be added by editing this file and
- * netsurf/desktop/options.c
+ * Non-platform specific options can be added by editing this file
*
* Platform specific options should be added in the platform options.h.
*
- * The following types of options are supported:
- * - bool (OPTION_BOOL)
- * - int (OPTION_INTEGER)
- * - char* (OPTION_STRING) (must be allocated on heap, may be 0, free before
- * assigning a new value)
+ * This header is specificaly intented to be included multiple times
+ * with different macro definitions so there is no guard
*/
#ifndef _NETSURF_DESKTOP_OPTIONS_H_
#define _NETSURF_DESKTOP_OPTIONS_H_
-#define _NETSURF_DESKTOP_OPTIONS_INCLUDING_
+#include "desktop/plot_style.h"
-#include <stdbool.h>
-#include <stdio.h>
+/* defines for system colour table */
+#define NSOPTION_SYS_COLOUR_START NSOPTION_sys_colour_ActiveBorder
+#define NSOPTION_SYS_COLOUR_END NSOPTION_sys_colour_WindowText
-#include "desktop/plot_style.h"
-#include "desktop/options_main.h"
-
-#if defined(riscos)
-#include "riscos/options.h"
-#elif defined(nsgtk)
-#include "gtk/options.h"
-#elif defined(nsbeos)
-#include "beos/options.h"
-#elif defined(nsamiga)
-#include "amiga/options.h"
-#elif defined(nsframebuffer)
-#include "framebuffer/options.h"
-#elif defined(nsatari)
-#include "atari/options.h"
-#elif defined(nsmonkey)
-#include "monkey/options.h"
-#else
-#define NSOPTION_EXTRA_DEFINE
-#define NSOPTION_EXTRA_DEFAULTS
-#define NSOPTION_EXTRA_TABLE
#endif
-/* allow the colour defaults to be overidden by the frontends */
-#ifndef NSOPTION_SYS_COLOUR_DEFAULTS
-#define NSOPTION_SYS_COLOUR_DEFAULTS NSOPTION_MAIN_SYS_COLOUR_DEFAULTS
-#endif
+/** An HTTP proxy should be used. */
+NSOPTION_BOOL(http_proxy, false)
-#undef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
+/** Hostname of proxy. */
+NSOPTION_STRING(http_proxy_host, NULL)
+/** Proxy port. */
+NSOPTION_INTEGER(http_proxy_port, 8080)
-enum { OPTION_HTTP_PROXY_AUTH_NONE = 0,
- OPTION_HTTP_PROXY_AUTH_BASIC = 1,
- OPTION_HTTP_PROXY_AUTH_NTLM = 2 };
+/** Proxy authentication method. */
+NSOPTION_INTEGER(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE)
-#define DEFAULT_MARGIN_TOP_MM 10
-#define DEFAULT_MARGIN_BOTTOM_MM 10
-#define DEFAULT_MARGIN_LEFT_MM 10
-#define DEFAULT_MARGIN_RIGHT_MM 10
-#define DEFAULT_EXPORT_SCALE 0.7
-#ifdef riscos
-#define DEFAULT_REFLOW_PERIOD 100 /* time in cs */
-#else
-#define DEFAULT_REFLOW_PERIOD 25 /* time in cs */
-#endif
+/** Proxy authentication user name */
+NSOPTION_STRING(http_proxy_auth_user, NULL)
-struct ns_options {
- NSOPTION_MAIN_DEFINE;
- NSOPTION_EXTRA_DEFINE;
-};
-
-/* global option struct */
-extern struct ns_options nsoptions;
-
-/* acessors */
-#define nsoption_bool(OPTION) (nsoptions.OPTION)
-#define nsoption_int(OPTION) (nsoptions.OPTION)
-#define nsoption_charp(OPTION) (nsoptions.OPTION)
-#define nsoption_colour(OPTION) (nsoptions.OPTION)
-
-#define nsoption_set_bool(OPTION, VALUE) nsoptions.OPTION = VALUE
-#define nsoption_set_int(OPTION, VALUE) nsoptions.OPTION = VALUE
-#define nsoption_set_colour(OPTION, VALUE) nsoptions.OPTION = VALUE
-#define nsoption_set_charp(OPTION, VALUE) do { \
- if (nsoptions.OPTION != NULL) { \
- free(nsoptions.OPTION); \
- } \
- nsoptions.OPTION = VALUE; \
- if ((nsoptions.OPTION != NULL) && \
- (*nsoptions.OPTION == 0)) { \
- free(nsoptions.OPTION); \
- nsoptions.OPTION = NULL; \
- } \
- } while (0)
-
-#define nsoption_setnull_charp(OPTION, VALUE) \
- do { \
- if (nsoptions.OPTION == NULL) { \
- nsoptions.OPTION = VALUE; \
- if (*nsoptions.OPTION == 0) { \
- free(nsoptions.OPTION); \
- nsoptions.OPTION = NULL; \
- } \
- } else { \
- free(VALUE); \
- } \
- } while (0)
-
-
-/**
- * Read options from a file.
- *
- * \param path name of file to read options from
- *
- * Option variables corresponding to lines in the file are updated. Missing
- * options are unchanged. If the file fails to open, options are unchanged.
- */
-void nsoption_read(const char *path);
+/** Proxy authentication password */
+NSOPTION_STRING(http_proxy_auth_pass, NULL)
-/**
- * Save options to a file.
- *
- * \param path name of file to write options to
- *
- * Errors are ignored.
- */
-void nsoption_write(const char *path);
+/** Default font size / 0.1pt. */
+NSOPTION_INTEGER(font_size, 128)
-/**
- * Dump user options to stream
- *
- * \param outf output stream to dump options to.
- */
-void nsoption_dump(FILE *outf);
+/** Minimum font size. */
+NSOPTION_INTEGER(font_min_size, 85)
-/**
- * Fill a buffer with an option using a format.
- *
- * The format string is copied into the output buffer with the
- * following replaced:
- * %k - The options key
- * %t - The options type
- * %V - value - HTML type formatting
- * %v - value - plain formatting
- *
- * \param string The buffer in which to place the results.
- * \param size The size of the string buffer.
- * \param option The opaque option number.
- * \param fmt The format string.
- * \return The number of bytes written to \a string or -1 on error
- */
-int nsoption_snoptionf(char *string, size_t size, unsigned int option,
- const char *fmt);
+/** Default sans serif font */
+NSOPTION_STRING(font_sans, NULL)
+/** Default serif font */
+NSOPTION_STRING(font_serif, NULL)
+
+/** Default monospace font */
+NSOPTION_STRING(font_mono, NULL)
+
+/** Default cursive font */
+NSOPTION_STRING(font_cursive, NULL)
+
+/** Default fantasy font */
+NSOPTION_STRING(font_fantasy, NULL)
+
+/** Accept-Language header. */
+NSOPTION_STRING(accept_language, NULL)
+
+/** Accept-Charset header. */
+NSOPTION_STRING(accept_charset, NULL)
+
+/** Preferred maximum size of memory cache / bytes. */
+NSOPTION_INTEGER(memory_cache_size, 12 * 1024 * 1024)
+
+/** Preferred expiry size of disc cache / bytes. */
+NSOPTION_INTEGER(disc_cache_size, 1024 * 1024 * 1024)
+
+/** Preferred expiry age of disc cache / days. */
+NSOPTION_INTEGER(disc_cache_age, 28)
+
+/** Whether to block advertisements */
+NSOPTION_BOOL(block_advertisements, false)
+
+/** Disable website tracking, see
+ * http://www.w3.org/Submission/2011/SUBM-web-tracking-protection-20110224/#... */
+NSOPTION_BOOL(do_not_track, false)
+
+/** Minimum GIF animation delay */
+NSOPTION_INTEGER(minimum_gif_delay, 10)
+
+/** Whether to send the referer HTTP header */
+NSOPTION_BOOL(send_referer, true)
+
+/** Whether to fetch foreground images */
+NSOPTION_BOOL(foreground_images, true)
+
+/** Whether to fetch background images */
+NSOPTION_BOOL(background_images, true)
+
+/** Whether to animate images */
+NSOPTION_BOOL(animate_images, true)
+
+/** Whether to execute javascript */
+NSOPTION_BOOL(enable_javascript, false)
+
+/** Maximum time (in seconds) to wait for a script to run */
+NSOPTION_INTEGER(script_timeout, 10)
+
+/** How many days to retain URL data for */
+NSOPTION_INTEGER(expire_url, 28)
+
+/** Default font family */
+NSOPTION_INTEGER(font_default, PLOT_FONT_FAMILY_SANS_SERIF)
+
+/** ca-bundle location */
+NSOPTION_STRING(ca_bundle, NULL)
-/**
- * Process commandline and set options approriately.
+/** ca-path location */
+NSOPTION_STRING(ca_path, NULL)
+
+/** Cookie file location */
+NSOPTION_STRING(cookie_file, NULL)
+
+/** Cookie jar location */
+NSOPTION_STRING(cookie_jar, NULL)
+
+/** Home page location */
+NSOPTION_STRING(homepage_url, NULL)
+
+/** search web from url bar */
+NSOPTION_BOOL(search_url_bar, false)
+
+/** default web search provider */
+NSOPTION_INTEGER(search_provider, 0)
+
+/** URL completion in url bar */
+NSOPTION_BOOL(url_suggestion, true)
+
+/** default x position of new windows */
+NSOPTION_INTEGER(window_x, 0)
+
+/** default y position of new windows */
+NSOPTION_INTEGER(window_y, 0)
+
+/** default width of new windows */
+NSOPTION_INTEGER(window_width, 0)
+
+/** default height of new windows */
+NSOPTION_INTEGER(window_height, 0)
+
+/** width of screen when above options were saved */
+NSOPTION_INTEGER(window_screen_width, 0)
+
+/** height of screen when above options were saved */
+NSOPTION_INTEGER(window_screen_height, 0)
+
+/** default size of status bar vs. h scroll bar */
+NSOPTION_INTEGER(toolbar_status_size, 6667)
+
+/** default window scale */
+NSOPTION_INTEGER(scale, 100)
+
+/* Whether to reflow web pages while objects are fetching */
+NSOPTION_BOOL(incremental_reflow, true)
+
+/* Minimum time (in cs) between HTML reflows while objects are fetching */
+NSOPTION_INTEGER(min_reflow_period, DEFAULT_REFLOW_PERIOD)
+
+/* use core selection menu */
+NSOPTION_BOOL(core_select_menu, false)
+
+/******** Fetcher options ********/
+
+/** Maximum simultaneous active fetchers */
+NSOPTION_INTEGER(max_fetchers, 24)
+
+/** Maximum simultaneous active fetchers per host.
+ * (<=option_max_fetchers else it makes no sense) Note that rfc2616
+ * section 8.1.4 says that there should be no more than two keepalive
+ * connections per host. None of the main browsers follow this as it
+ * slows page fetches down considerably. See
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=423377#c4
*/
-void nsoption_commandline(int *pargc, char **argv);
+NSOPTION_INTEGER(max_fetchers_per_host, 5)
-/**
- * Set default values for unset front-end specific options
+/** Maximum number of inactive fetchers cached. The total number of
+ * handles netsurf will therefore have open is this plus
+ * option_max_fetchers.
*/
-void gui_options_init_defaults(void);
+NSOPTION_INTEGER(max_cached_fetch_handles, 6)
-#endif
+/** Suppress debug output from cURL. */
+NSOPTION_BOOL(suppress_curl_debug, true)
+
+/** Whether to allow target="_blank" */
+NSOPTION_BOOL(target_blank, true)
+
+/** Whether second mouse button opens in new tab */
+NSOPTION_BOOL(button_2_tab, true)
+
+/******** PDF / Print options ********/
+
+/** top margin of exported page */
+NSOPTION_INTEGER(margin_top, DEFAULT_MARGIN_TOP_MM)
+
+/** bottom margin of exported page */
+NSOPTION_INTEGER(margin_bottom, DEFAULT_MARGIN_BOTTOM_MM)
+
+/** left margin of exported page */
+NSOPTION_INTEGER(margin_left, DEFAULT_MARGIN_LEFT_MM)
+
+/** right margin of exported page */
+NSOPTION_INTEGER(margin_right, DEFAULT_MARGIN_RIGHT_MM)
+
+/** scale of exported content */
+NSOPTION_INTEGER(export_scale, DEFAULT_EXPORT_SCALE * 100)
+
+/** suppressing images in printed content */
+NSOPTION_BOOL(suppress_images, false)
+
+/** turning off all backgrounds for printed content */
+NSOPTION_BOOL(remove_backgrounds, false)
+
+/** turning on content loosening for printed content */
+NSOPTION_BOOL(enable_loosening, true)
+
+/** compression of PDF documents */
+NSOPTION_BOOL(enable_PDF_compression, true)
+
+/** setting a password and encoding PDF documents */
+NSOPTION_BOOL(enable_PDF_password, false)
+
+/******** System colours ********/
+NSOPTION_COLOUR(sys_colour_ActiveBorder, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ActiveCaption, 0x00000000)
+NSOPTION_COLOUR(sys_colour_AppWorkspace, 0x00000000)
+NSOPTION_COLOUR(sys_colour_Background, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ButtonFace, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ButtonHighlight, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ButtonShadow, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ButtonText, 0x00000000)
+NSOPTION_COLOUR(sys_colour_CaptionText, 0x00000000)
+NSOPTION_COLOUR(sys_colour_GrayText, 0x00000000)
+NSOPTION_COLOUR(sys_colour_Highlight, 0x00000000)
+NSOPTION_COLOUR(sys_colour_HighlightText, 0x00000000)
+NSOPTION_COLOUR(sys_colour_InactiveBorder, 0x00000000)
+NSOPTION_COLOUR(sys_colour_InactiveCaption, 0x00000000)
+NSOPTION_COLOUR(sys_colour_InactiveCaptionText, 0x00000000)
+NSOPTION_COLOUR(sys_colour_InfoBackground, 0x00000000)
+NSOPTION_COLOUR(sys_colour_InfoText, 0x00000000)
+NSOPTION_COLOUR(sys_colour_Menu, 0x00000000)
+NSOPTION_COLOUR(sys_colour_MenuText, 0x00000000)
+NSOPTION_COLOUR(sys_colour_Scrollbar, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ThreeDDarkShadow, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ThreeDFace, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ThreeDHighlight, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ThreeDLightShadow, 0x00000000)
+NSOPTION_COLOUR(sys_colour_ThreeDShadow, 0x00000000)
+NSOPTION_COLOUR(sys_colour_Window, 0x00000000)
+NSOPTION_COLOUR(sys_colour_WindowFrame, 0x00000000)
+NSOPTION_COLOUR(sys_colour_WindowText, 0x00000000)
diff --git a/framebuffer/options.h b/framebuffer/options.h
index 760cc3b..5cb5bfb 100644
--- a/framebuffer/options.h
+++ b/framebuffer/options.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2010 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,92 +16,52 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
-#error "Frontend options header cannot be included directly"
-#endif
-
#ifndef _NETSURF_FRAMEBUFFER_OPTIONS_H_
#define _NETSURF_FRAMEBUFFER_OPTIONS_H_
-#define NSOPTION_EXTRA_DEFINE \
- /* surface options */ \
- int fb_depth; \
- int fb_refresh; \
- char *fb_device; \
- char *fb_input_devpath; \
- char *fb_input_glob; \
- \
- /* toolkit options */ \
- int fb_furniture_size; /**< toolkit furniture size */ \
- int fb_toolbar_size; /**< toolbar furniture size */ \
- char *fb_toolbar_layout; /**< toolbar layout */ \
- bool fb_osk; /**< enable on screen keyboard */ \
- \
- /* font options */ \
- bool fb_font_monochrome; /**< render font monochrome */ \
- int fb_font_cachesize; /**< size of font glyph cache in kilobytes. */ \
- \
- char *fb_face_sans_serif; /**< default sans face */ \
- char *fb_face_sans_serif_bold; /**< bold sans face */ \
- char *fb_face_sans_serif_italic; /**< bold sans face */ \
- char *fb_face_sans_serif_italic_bold; /**< bold sans face */ \
- \
- char *fb_face_serif; /**< serif face */ \
- char *fb_face_serif_bold; /**< bold serif face */ \
- \
- char *fb_face_monospace; /**< monospace face */ \
- char *fb_face_monospace_bold; /**< bold monospace face */ \
- \
- char *fb_face_cursive; /**< cursive face */ \
- char *fb_face_fantasy /**< fantasy face */
+/* currently nothing here */
-#define NSOPTION_EXTRA_DEFAULTS \
- .fb_depth = 32, \
- .fb_refresh = 70, \
- .fb_device = NULL, \
- .fb_input_devpath = NULL, \
- .fb_input_glob = NULL, \
- .fb_furniture_size = 18, \
- .fb_toolbar_size = 30, \
- .fb_toolbar_layout = NULL, \
- .fb_osk = false, \
- .fb_font_monochrome = false, \
- .fb_font_cachesize = 2048, \
- .fb_face_sans_serif = NULL, \
- .fb_face_sans_serif_bold = NULL, \
- .fb_face_sans_serif_italic = NULL, \
- .fb_face_sans_serif_italic_bold = NULL, \
- .fb_face_serif = NULL, \
- .fb_face_serif_bold = NULL, \
- .fb_face_monospace = NULL, \
- .fb_face_monospace_bold = NULL, \
- .fb_face_cursive = NULL, \
- .fb_face_fantasy = NULL
+#endif
-#define NSOPTION_EXTRA_TABLE \
- { "fb_depth", OPTION_INTEGER, &nsoptions.fb_depth }, \
- { "fb_refresh", OPTION_INTEGER, &nsoptions.fb_refresh }, \
- { "fb_device", OPTION_STRING, &nsoptions.fb_device }, \
- { "fb_input_devpath", OPTION_STRING, &nsoptions.fb_input_devpath }, \
- { "fb_input_glob", OPTION_STRING, &nsoptions.fb_input_glob }, \
- { "fb_furniture_size", OPTION_INTEGER, &nsoptions.fb_furniture_size }, \
- { "fb_toolbar_size", OPTION_INTEGER, &nsoptions.fb_toolbar_size }, \
- { "fb_toolbar_layout", OPTION_STRING, &nsoptions.fb_toolbar_layout }, \
- { "fb_osk", OPTION_BOOL, &nsoptions.fb_osk }, \
- { "fb_font_monochrome", OPTION_BOOL, &nsoptions.fb_font_monochrome }, \
- { "fb_font_cachesize", OPTION_INTEGER, &nsoptions.fb_font_cachesize }, \
- { "fb_face_sans_serif", OPTION_STRING, &nsoptions.fb_face_sans_serif }, \
- { "fb_face_sans_serif_bold", OPTION_STRING, &nsoptions.fb_face_sans_serif_bold }, \
- { "fb_face_sans_serif_italic", OPTION_STRING, &nsoptions.fb_face_sans_serif_italic }, \
- { "fb_face_sans_serif_italic_bold", OPTION_STRING, &nsoptions.fb_face_sans_serif_italic_bold }, \
- { "fb_face_serif", OPTION_STRING, &nsoptions.fb_face_serif }, \
- { "fb_serif_bold", OPTION_STRING, &nsoptions.fb_face_serif_bold }, \
- { "fb_face_monospace", OPTION_STRING, &nsoptions.fb_face_monospace }, \
- { "fb_face_monospace_bold", OPTION_STRING, &nsoptions.fb_face_monospace_bold }, \
- { "fb_face_cursive", OPTION_STRING, &nsoptions.fb_face_cursive }, \
- { "fb_face_fantasy", OPTION_STRING, &nsoptions.fb_face_fantasy }
+/***** surface options *****/
-#endif
+NSOPTION_INTEGER(fb_depth, 32)
+NSOPTION_INTEGER(fb_refresh, 70)
+NSOPTION_STRING(fb_device, NULL)
+NSOPTION_STRING(fb_input_devpath, NULL)
+NSOPTION_STRING(fb_input_glob, NULL)
+
+/***** toolkit options *****/
+
+/** toolkit furniture size */
+NSOPTION_INTEGER(fb_furniture_size, 18)
+/** toolbar furniture size */
+NSOPTION_INTEGER(fb_toolbar_size, 30)
+/** toolbar layout */
+NSOPTION_STRING(fb_toolbar_layout, NULL)
+/** enable on screen keyboard */
+NSOPTION_BOOL(fb_osk, false)
+
+/***** font options *****/
+
+/** render all fonts monochrome */
+NSOPTION_BOOL(fb_font_monochrome, false)
+/** size of font glyph cache in kilobytes. */
+NSOPTION_INTEGER(fb_font_cachesize, 2048)
+
+/* Font face paths. These are treated as absolute paths if they start
+ * with a / otherwise the compile time resource path is searched.
+ */
+NSOPTION_STRING(fb_face_sans_serif, NULL)
+NSOPTION_STRING(fb_face_sans_serif_bold, NULL)
+NSOPTION_STRING(fb_face_sans_serif_italic, NULL)
+NSOPTION_STRING(fb_face_sans_serif_italic_bold, NULL)
+NSOPTION_STRING(fb_face_serif, NULL)
+NSOPTION_STRING(fb_serif_bold, NULL)
+NSOPTION_STRING(fb_face_monospace, NULL)
+NSOPTION_STRING(fb_face_monospace_bold, NULL)
+NSOPTION_STRING(fb_face_cursive, NULL)
+NSOPTION_STRING(fb_face_fantasy, NULL)
/*
* Local Variables:
diff --git a/gtk/options.h b/gtk/options.h
index 795eca9..612809e 100644
--- a/gtk/options.h
+++ b/gtk/options.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,68 +16,60 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
-#error "Frontend options header cannot be included directly"
-#endif
-
#ifndef _NETSURF_GTK_OPTIONS_H_
#define _NETSURF_GTK_OPTIONS_H_
-#define NSOPTION_EXTRA_DEFINE \
- bool render_resample; \
- bool downloads_clear; \
- bool request_overwrite; \
- char *downloads_directory; \
- char *url_file; \
- bool show_single_tab; \
- int button_type; \
- bool disable_popups; \
- bool disable_plugins; \
- int history_age; \
- bool hover_urls; \
- bool focus_new; \
- bool new_blank; \
- char *hotlist_path; \
- bool source_tab; \
- int current_theme; \
- int position_tab
-
-#define NSOPTION_EXTRA_DEFAULTS \
- .render_resample = true, \
- .downloads_clear = false, \
- .request_overwrite = true, \
- .downloads_directory = NULL, \
- .url_file = NULL, \
- .show_single_tab = false, \
- .button_type = 0, \
- .disable_popups = false, \
- .disable_plugins = false, \
- .history_age = 0, \
- .hover_urls = false, \
- .focus_new = false, \
- .new_blank = false, \
- .hotlist_path = NULL, \
- .source_tab = false, \
- .current_theme = 0, \
- .position_tab = 0
-
-#define NSOPTION_EXTRA_TABLE \
-{ "render_resample", OPTION_BOOL, &nsoptions.render_resample }, \
-{ "downloads_clear", OPTION_BOOL, &nsoptions.downloads_clear }, \
-{ "request_overwrite", OPTION_BOOL, &nsoptions.request_overwrite }, \
-{ "downloads_directory",OPTION_STRING, &nsoptions.downloads_directory }, \
-{ "url_file", OPTION_STRING, &nsoptions.url_file }, \
-{ "show_single_tab", OPTION_BOOL, &nsoptions.show_single_tab }, \
-{ "button_type", OPTION_INTEGER, &nsoptions.button_type}, \
-{ "disable_popups", OPTION_BOOL, &nsoptions.disable_popups}, \
-{ "disable_plugins", OPTION_BOOL, &nsoptions.disable_plugins}, \
-{ "history_age", OPTION_INTEGER, &nsoptions.history_age}, \
-{ "hover_urls", OPTION_BOOL, &nsoptions.hover_urls}, \
-{ "focus_new", OPTION_BOOL, &nsoptions.focus_new}, \
-{ "new_blank", OPTION_BOOL, &nsoptions.new_blank}, \
-{ "hotlist_path", OPTION_STRING, &nsoptions.hotlist_path}, \
-{ "source_tab", OPTION_BOOL, &nsoptions.source_tab},\
-{ "current_theme", OPTION_INTEGER, &nsoptions.current_theme}, \
-{ "position_tab", OPTION_INTEGER, &nsoptions.position_tab}
+/* currently nothing here */
#endif
+
+/* High quality image scaling */
+NSOPTION_BOOL(render_resample, true)
+
+/* clear downloads */
+NSOPTION_BOOL(downloads_clear, false)
+
+/* prompt before overwriting downloads */
+NSOPTION_BOOL(request_overwrite, true)
+
+/* location to download files to */
+NSOPTION_STRING(downloads_directory, NULL)
+
+/* where to store URL database */
+NSOPTION_STRING(url_file, NULL)
+
+/* Always show tabs even if there is only one */
+NSOPTION_BOOL(show_single_tab, false)
+
+/* size of buttons */
+NSOPTION_INTEGER(button_type, 0)
+
+/* disallow popup windows */
+NSOPTION_BOOL(disable_popups, false)
+
+/* disable content plugins */
+NSOPTION_BOOL(disable_plugins, false)
+
+/* number of days to keep history data */
+NSOPTION_INTEGER(history_age, 0)
+
+/* show urls in local history browser */
+NSOPTION_BOOL(hover_urls, false)
+
+/* bring new tabs to front */
+NSOPTION_BOOL(focus_new, false)
+
+/* new tabs are blank instead of homepage */
+NSOPTION_BOOL(new_blank, false)
+
+/* path to save hotlist file */
+NSOPTION_STRING(hotlist_path, NULL)
+
+/* open source views in a tab */
+NSOPTION_BOOL(source_tab, false)
+
+/* currently selected theme */
+NSOPTION_INTEGER(current_theme, 0)
+
+/* where tabs are positioned */
+NSOPTION_INTEGER(position_tab, 0)
diff --git a/monkey/options.h b/monkey/options.h
index 88fb7e1..3680187 100644
--- a/monkey/options.h
+++ b/monkey/options.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -23,59 +23,25 @@
#ifndef _NETSURF_MONKEY_OPTIONS_H_
#define _NETSURF_MONKEY_OPTIONS_H_
-#define NSOPTION_EXTRA_DEFINE \
- bool render_resample; \
- bool downloads_clear; \
- bool request_overwrite; \
- char *downloads_directory; \
- char *url_file; \
- bool show_single_tab; \
- int button_type; \
- bool disable_popups; \
- bool disable_plugins; \
- int history_age; \
- bool hover_urls; \
- bool focus_new; \
- bool new_blank; \
- char *hotlist_path; \
- bool source_tab; \
- int current_theme
+/* currently nothing here */
-#define NSOPTION_EXTRA_DEFAULTS \
- .render_resample = true, \
- .downloads_clear = false, \
- .request_overwrite = true, \
- .downloads_directory = NULL, \
- .url_file = NULL, \
- .show_single_tab = false, \
- .button_type = 0, \
- .disable_popups = false, \
- .disable_plugins = false, \
- .history_age = 0, \
- .hover_urls = false, \
- .focus_new = false, \
- .new_blank = false, \
- .hotlist_path = NULL, \
- .source_tab = false, \
- .current_theme = 0
+#endif
-#define NSOPTION_EXTRA_TABLE \
-{ "render_resample", OPTION_BOOL, &nsoptions.render_resample }, \
-{ "downloads_clear", OPTION_BOOL, &nsoptions.downloads_clear }, \
-{ "request_overwrite", OPTION_BOOL, &nsoptions.request_overwrite }, \
-{ "downloads_directory",OPTION_STRING, &nsoptions.downloads_directory }, \
-{ "url_file", OPTION_STRING, &nsoptions.url_file }, \
-{ "show_single_tab", OPTION_BOOL, &nsoptions.show_single_tab }, \
-{ "button_type", OPTION_INTEGER, &nsoptions.button_type}, \
-{ "disable_popups", OPTION_BOOL, &nsoptions.disable_popups}, \
-{ "disable_plugins", OPTION_BOOL, &nsoptions.disable_plugins}, \
-{ "history_age", OPTION_INTEGER, &nsoptions.history_age}, \
-{ "hover_urls", OPTION_BOOL, &nsoptions.hover_urls}, \
-{ "focus_new", OPTION_BOOL, &nsoptions.focus_new}, \
-{ "new_blank", OPTION_BOOL, &nsoptions.new_blank}, \
-{ "hotlist_path", OPTION_STRING, &nsoptions.hotlist_path}, \
-{ "source_tab", OPTION_BOOL, &nsoptions.source_tab},\
-{ "current_theme", OPTION_INTEGER, &nsoptions.current_theme}
+NSOPTION_BOOL(render_resample, true)
+NSOPTION_BOOL(downloads_clear, false)
+NSOPTION_BOOL(request_overwrite, true)
+NSOPTION_STRING(downloads_directory, NULL)
+NSOPTION_STRING(url_file, NULL)
+NSOPTION_BOOL(show_single_tab, false)
+NSOPTION_INTEGER(button_type, 0)
+NSOPTION_BOOL(disable_popups, false)
+NSOPTION_BOOL(disable_plugins, false)
+NSOPTION_INTEGER(history_age, 0)
+NSOPTION_BOOL(hover_urls, false)
+NSOPTION_BOOL(focus_new, false)
+NSOPTION_BOOL(new_blank, false)
+NSOPTION_STRING(hotlist_path, NULL)
+NSOPTION_BOOL(source_tab, false)
+NSOPTION_INTEGER(current_theme, 0)
-#endif
diff --git a/riscos/options.h b/riscos/options.h
index 62bfcf2..3aac155 100644
--- a/riscos/options.h
+++ b/riscos/options.h
@@ -1,7 +1,5 @@
/*
- * Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
- * Copyright 2004 James Bursa <bursa(a)users.sourceforge.net>
- * Copyright 2004 Richard Wilson <not_ginger_matt(a)users.sourceforge.net>
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -22,131 +20,52 @@
* 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_
-#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
-
+#include "riscos/tinct.h"
-#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
+/* setup longer default reflow time */
+#define DEFAULT_REFLOW_PERIOD 100 /* time in cs */
-#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 }
+#define CHOICES_PREFIX "<Choices$Write>.WWW.NetSurf."
#endif
+
+NSOPTION_BOOL(use_mouse_gestures, false)
+NSOPTION_BOOL(allow_text_selection, false)
+NSOPTION_STRING(theme, "Aletheia")
+NSOPTION_STRING(language, NULL)
+NSOPTION_INTEGER(plot_fg_quality, tinct_ERROR_DIFFUSE)
+NSOPTION_INTEGER(plot_bg_quality, tinct_DITHER)
+NSOPTION_BOOL(history_tooltip, true)
+NSOPTION_BOOL(toolbar_show_buttons, true)
+NSOPTION_BOOL(toolbar_show_address, true)
+NSOPTION_BOOL(toolbar_show_throbber, true)
+NSOPTION_STRING(toolbar_browser, "0123|58|9")
+NSOPTION_STRING(toolbar_hotlist, "40|12|3")
+NSOPTION_STRING(toolbar_history, "0|12|3")
+NSOPTION_STRING(toolbar_cookies, "0|12")
+NSOPTION_BOOL(window_stagger, true)
+NSOPTION_BOOL(window_size_clone, true)
+NSOPTION_BOOL(buffer_animations, true)
+NSOPTION_BOOL(buffer_everything, true)
+NSOPTION_BOOL(open_browser_at_startup, false)
+NSOPTION_BOOL(no_plugins, false)
+NSOPTION_BOOL(block_popups, false)
+NSOPTION_INTEGER(image_memory_direct, -1)
+NSOPTION_INTEGER(image_memory_compressed, -1)
+NSOPTION_BOOL(strip_extensions, true)
+NSOPTION_BOOL(confirm_overwrite, true)
+NSOPTION_STRING(url_path, "NetSurf:URL")
+NSOPTION_STRING(url_save, CHOICES_PREFIX "URL")
+NSOPTION_STRING(hotlist_path, "NetSurf:Hotlist")
+NSOPTION_STRING(hotlist_save, CHOICES_PREFIX "Hotlist")
+NSOPTION_STRING(recent_path, "NetSurf:Recent")
+NSOPTION_STRING(recent_save, CHOICES_PREFIX "Recent")
+NSOPTION_STRING(theme_path, "NetSurf:Themes")
+NSOPTION_STRING(theme_save, CHOICES_PREFIX "Themes")
+NSOPTION_BOOL(thumbnail_iconise, true)
+NSOPTION_BOOL(interactive_help, true)
+NSOPTION_BOOL(external_hotlists, false)
+NSOPTION_STRING(external_hotlist_app, NULL)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=3b4b29cd1c8ed15f063...
commit 3b4b29cd1c8ed15f0635ee02ff565920bf75dcdd
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
add tests for new options API
diff --git a/.gitignore b/.gitignore
index 84eca23..82d6b6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@ windows/res/preferences
\!NetSurf/Resources/nl/Templates,fec
\!NetSurf/Resources/nl/Messages
\!NetSurf/Resources/it/Messages
+test/nsoption
test/nsurl
test/urldbtest
test/llcache
diff --git a/test/Makefile b/test/Makefile
index e61e21f..ecd2b50 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -26,9 +26,12 @@ nsurl_SRCS := utils/log.c utils/nsurl.c test/nsurl.c
nsurl_CFLAGS := $(shell pkg-config --cflags libwapcaplet)
nsurl_LDFLAGS := $(shell pkg-config --libs libwapcaplet)
+nsoption_SRCS := utils/log.c utils/nsoption.c test/nsoption.c
+nsoption_CFLAGS := -Dnsgtk
+
.PHONY: all
-all: llcache urldbtest nsurl
+all: llcache urldbtest nsurl nsoption
llcache: $(addprefix ../,$(llcache_SRCS))
$(CC) $(CFLAGS) $(llcache_CFLAGS) $^ -o $@ $(LDFLAGS) $(llcache_LDFLAGS)
@@ -39,7 +42,10 @@ urldbtest: $(addprefix ../,$(urldbtest_SRCS))
nsurl: $(addprefix ../,$(nsurl_SRCS))
$(CC) $(CFLAGS) $(nsurl_CFLAGS) $^ -o $@ $(LDFLAGS) $(nsurl_LDFLAGS)
+nsoption: $(addprefix ../,$(nsoption_SRCS))
+ $(CC) $(CFLAGS) $(nsoption_CFLAGS) $^ -o $@ $(LDFLAGS) $(nsoption_LDFLAGS)
+
.PHONY: clean
clean:
- $(RM) llcache urldbtest nsurl
+ $(RM) llcache urldbtest nsurl nsoption
diff --git a/test/data/Choices b/test/data/Choices
new file mode 100644
index 0000000..f4a62af
--- /dev/null
+++ b/test/data/Choices
@@ -0,0 +1,104 @@
+http_proxy:0
+http_proxy_port:8080
+http_proxy_auth:0
+font_size:128
+font_min_size:85
+font_sans:Sans
+font_serif:Serif
+font_mono:Monospace
+font_cursive:Serif
+font_fantasy:Serif
+accept_language:en
+memory_cache_size:12582912
+disc_cache_size:1073741824
+disc_cache_age:28
+block_advertisements:0
+do_not_track:0
+minimum_gif_delay:10
+send_referer:1
+foreground_images:1
+background_images:1
+animate_images:1
+enable_javascript:1
+script_timeout:10
+expire_url:28
+font_default:0
+ca_path:/etc/ssl/certs
+cookie_file:/home/vince/.netsurf/Cookies
+cookie_jar:/home/vince/.netsurf/Cookies
+homepage_url:about:welcome
+search_url_bar:0
+search_provider:0
+url_suggestion:1
+window_x:0
+window_y:0
+window_width:0
+window_height:0
+window_screen_width:0
+window_screen_height:0
+toolbar_status_size:6667
+scale:100
+incremental_reflow:1
+min_reflow_period:25
+core_select_menu:1
+max_fetchers:24
+max_fetchers_per_host:5
+max_cached_fetch_handles:6
+suppress_curl_debug:1
+target_blank:1
+button_2_tab:1
+margin_top:10
+margin_bottom:10
+margin_left:10
+margin_right:10
+export_scale:70
+suppress_images:0
+remove_backgrounds:0
+enable_loosening:1
+enable_PDF_compression:1
+enable_PDF_password:0
+sys_colour_ActiveBorder:000000
+sys_colour_ActiveCaption:000000
+sys_colour_AppWorkspace:000000
+sys_colour_Background:000000
+sys_colour_ButtonFace:000000
+sys_colour_ButtonHighlight:000000
+sys_colour_ButtonShadow:000000
+sys_colour_ButtonText:000000
+sys_colour_CaptionText:000000
+sys_colour_GrayText:000000
+sys_colour_Highlight:000000
+sys_colour_HighlightText:000000
+sys_colour_InactiveBorder:000000
+sys_colour_InactiveCaption:000000
+sys_colour_InactiveCaptionText:000000
+sys_colour_InfoBackground:000000
+sys_colour_InfoText:000000
+sys_colour_Menu:000000
+sys_colour_MenuText:000000
+sys_colour_Scrollbar:000000
+sys_colour_ThreeDDarkShadow:000000
+sys_colour_ThreeDFace:000000
+sys_colour_ThreeDHighlight:000000
+sys_colour_ThreeDLightShadow:000000
+sys_colour_ThreeDShadow:000000
+sys_colour_Window:000000
+sys_colour_WindowFrame:000000
+sys_colour_WindowText:000000
+render_resample:1
+downloads_clear:0
+request_overwrite:1
+downloads_directory:/home/vince
+url_file:/home/vince/.netsurf/URLs
+show_single_tab:1
+button_type:1
+disable_popups:0
+disable_plugins:0
+history_age:0
+hover_urls:0
+focus_new:0
+new_blank:0
+hotlist_path:/home/vince/.netsurf/Hotlist
+source_tab:0
+current_theme:0
+position_tab:0
diff --git a/test/nsoption.c b/test/nsoption.c
new file mode 100644
index 0000000..1c9116a
--- /dev/null
+++ b/test/nsoption.c
@@ -0,0 +1,86 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "utils/errors.h"
+#include "utils/log.h"
+#include "utils/nsoption.h"
+
+bool verbose_log = true;
+
+nserror gui_options_init_defaults(struct nsoption_s *defaults)
+{
+#if defined(riscos)
+ /* Set defaults for absent option strings */
+ 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"));
+
+ if (nsoption_charp(ca_bundle) == NULL ||
+ nsoption_charp(cookie_file) == NULL ||
+ nsoption_charp(cookie_jar) == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+#elif defined(nsgtk)
+ char *hdir = getenv("HOME");
+ char buf[PATH_MAX];
+
+ /* Set defaults for absent option strings */
+ snprintf(buf, PATH_MAX, "%s/.netsurf/Cookies", hdir);
+ nsoption_setnull_charp(cookie_file, strdup(buf));
+ nsoption_setnull_charp(cookie_jar, strdup(buf));
+ if (nsoption_charp(cookie_file) == NULL ||
+ nsoption_charp(cookie_jar) == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (nsoption_charp(downloads_directory) == NULL) {
+ snprintf(buf, PATH_MAX, "%s/", hdir);
+ nsoption_set_charp(downloads_directory, strdup(buf));
+ }
+
+ if (nsoption_charp(url_file) == NULL) {
+ snprintf(buf, PATH_MAX, "%s/.netsurf/URLs", hdir);
+ nsoption_set_charp(url_file, strdup(buf));
+ }
+
+ if (nsoption_charp(hotlist_path) == NULL) {
+ snprintf(buf, PATH_MAX, "%s/.netsurf/Hotlist", hdir);
+ nsoption_set_charp(hotlist_path, strdup(buf));
+ }
+
+ nsoption_setnull_charp(ca_path, strdup("/etc/ssl/certs"));
+
+ if (nsoption_charp(url_file) == NULL ||
+ nsoption_charp(ca_path) == NULL ||
+ nsoption_charp(downloads_directory) == NULL ||
+ nsoption_charp(hotlist_path) == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+#endif
+ return NSERROR_OK;
+}
+
+
+int main(int argc, char**argv)
+{
+ FILE *fp;
+
+ nsoption_init(gui_options_init_defaults, NULL, NULL);
+
+ nsoption_read("data/Choices", NULL);
+
+ nsoption_write("Choices-short", NULL, NULL);
+
+ fp = fopen("Choices-all", "w");
+
+ nsoption_dump(fp, NULL);
+
+ fclose(fp);
+
+ return 0;
+}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1d8a7178bc1ad829b4d...
commit 1d8a7178bc1ad829b4d16a94bdca4cc703201ef5
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
add new option API and implementation
diff --git a/utils/nsoption.c b/utils/nsoption.c
new file mode 100644
index 0000000..3d01a55
--- /dev/null
+++ b/utils/nsoption.c
@@ -0,0 +1,660 @@
+/*
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * 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
+ * Option reading and saving (implementation).
+ *
+ * Options are stored in the format key:value, one per line.
+ *
+ * For bool options, value is "0" or "1".
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "utils/errors.h"
+#include "utils/log.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
+
+struct nsoption_s *nsoptions = NULL;
+struct nsoption_s *nsoptions_default = NULL;
+
+#define NSOPTION_BOOL(NAME, DEFAULT) \
+ { #NAME, sizeof(#NAME) - 1, OPTION_BOOL, { .b = DEFAULT } },
+
+#define NSOPTION_STRING(NAME, DEFAULT) \
+ { #NAME, sizeof(#NAME) - 1, OPTION_STRING, { .cs = DEFAULT } },
+
+#define NSOPTION_INTEGER(NAME, DEFAULT) \
+ { #NAME, sizeof(#NAME) - 1, OPTION_INTEGER, { .i = DEFAULT } },
+
+#define NSOPTION_COLOUR(NAME, DEFAULT) \
+ { #NAME, sizeof(#NAME) - 1, OPTION_COLOUR, { .c = DEFAULT } },
+
+struct nsoption_s defaults[] = {
+#include "desktop/options.h"
+
+#if defined(riscos)
+#include "riscos/options.h"
+#elif defined(nsgtk)
+#include "gtk/options.h"
+#elif defined(nsbeos)
+#include "beos/options.h"
+#elif defined(nsamiga)
+#include "amiga/options.h"
+#elif defined(nsframebuffer)
+#include "framebuffer/options.h"
+#elif defined(nsatari)
+#include "atari/options.h"
+#elif defined(nsmonkey)
+#include "monkey/options.h"
+#endif
+ { NULL, 0, OPTION_INTEGER, { 0 } }
+};
+
+#undef NSOPTION_BOOL
+#undef NSOPTION_STRING
+#undef NSOPTION_INTEGER
+#undef NSOPTION_COLOUR
+
+/**
+ * Set an option value based on a string
+ */
+static bool
+strtooption(const char *value, struct nsoption_s *option)
+{
+ bool ret = true;
+ colour rgbcolour; /* RRGGBB */
+
+ switch (option->type) {
+ case OPTION_BOOL:
+ option->value.b = (value[0] == '1');
+ break;
+
+ case OPTION_INTEGER:
+ option->value.i = atoi(value);
+ break;
+
+ case OPTION_COLOUR:
+ sscanf(value, "%x", &rgbcolour);
+ option->value.c = (((0x000000FF & rgbcolour) << 16) |
+ ((0x0000FF00 & rgbcolour) << 0) |
+ ((0x00FF0000 & rgbcolour) >> 16));
+ break;
+
+ case OPTION_STRING:
+ if (option->value.s != NULL) {
+ free(option->value.s);
+ }
+
+ if (*value == 0) {
+ /* do not allow empty strings in text options */
+ option->value.s = NULL;
+ } else {
+ option->value.s = strdup(value);
+ }
+ break;
+
+ default:
+ ret = false;
+ break;
+ }
+
+ return ret;
+}
+
+/* validate options to sane values */
+static void nsoption_validate(struct nsoption_s *opts)
+{
+ if (opts[NSOPTION_font_size].value.i < 50) {
+ opts[NSOPTION_font_size].value.i = 50;
+ }
+
+ if (opts[NSOPTION_font_size].value.i > 1000) {
+ opts[NSOPTION_font_size].value.i = 1000;
+ }
+
+ if (opts[NSOPTION_font_min_size].value.i < 10) {
+ opts[NSOPTION_font_min_size].value.i = 10;
+ }
+
+ if (opts[NSOPTION_font_min_size].value.i > 500) {
+ opts[NSOPTION_font_min_size].value.i = 500;
+ }
+
+ if (opts[NSOPTION_memory_cache_size].value.i < 0) {
+ opts[NSOPTION_memory_cache_size].value.i = 0;
+ }
+}
+
+/** Output choices to file stream
+ *
+ * @param fp the file stream to write to
+ * @param opts The options table to write
+ * @param defs the default value table to compare with.
+ * @param all Output all entries not just ones changed from defaults
+ */
+static nserror
+nsoption_output(FILE *fp,
+ struct nsoption_s *opts,
+ struct nsoption_s *defs,
+ bool all)
+{
+ unsigned int entry;
+ for (entry = 0; entry < NSOPTION_LISTEND; entry++) {
+ switch (opts[entry].type) {
+ case OPTION_BOOL:
+ if (all ||
+ (opts[entry].value.b != defs[entry].value.b)) {
+ fprintf(fp, "%s:%c\n",
+ opts[entry].key,
+ opts[entry].value.b ? '1' : '0');
+ }
+ break;
+
+ case OPTION_INTEGER:
+ if (all ||
+ (opts[entry].value.i != defs[entry].value.i)) {
+ fprintf(fp, "%s:%i\n",
+ opts[entry].key,
+ opts[entry].value.i);
+ }
+ break;
+
+ case OPTION_COLOUR:
+ if (all ||
+ (opts[entry].value.c != defs[entry].value.c)) {
+ colour rgbcolour; /* RRGGBB */
+ rgbcolour = (((0x000000FF & opts[entry].value.c) << 16) |
+ ((0x0000FF00 & opts[entry].value.c) << 0) |
+ ((0x00FF0000 & opts[entry].value.c) >> 16));
+ fprintf(fp, "%s:%06x\n",
+ opts[entry].key,
+ rgbcolour);
+ }
+ break;
+
+ case OPTION_STRING:
+ /* output the key if:
+ * - defs is null.
+ * - default is null but value is not.
+ * - default and value pointers are different
+ * (acts as a null check because of previous check)
+ * and the strings content differ.
+ */
+ if (all ||
+ ((defs[entry].value.s == NULL) &&
+ (opts[entry].value.s != NULL)) ||
+ ((defs[entry].value.s != opts[entry].value.s) &&
+ (strcmp(opts[entry].value.s, defs[entry].value.s) != 0))) {
+ fprintf(fp, "%s:%s\n",
+ opts[entry].key,
+ ((opts[entry].value.s == NULL) ||
+ (*opts[entry].value.s == 0)) ? "" : opts[entry].value.s);
+ }
+ break;
+ }
+ }
+
+ return NSERROR_OK;
+}
+
+/**
+ * Output an option value into a string, in HTML format.
+ *
+ * \param option The option to output the value of.
+ * \param size The size of the string buffer.
+ * \param pos The current position in string
+ * \param string The string in which to output the value.
+ * \return The number of bytes written to string or -1 on error
+ */
+static size_t
+nsoption_output_value_html(struct nsoption_s *option,
+ size_t size,
+ size_t pos,
+ char *string)
+{
+ size_t slen = 0; /* length added to string */
+ colour rgbcolour; /* RRGGBB */
+
+ switch (option->type) {
+ case OPTION_BOOL:
+ slen = snprintf(string + pos,
+ size - pos,
+ "%s",
+ option->value.b ? "true" : "false");
+ break;
+
+ case OPTION_INTEGER:
+ slen = snprintf(string + pos,
+ size - pos,
+ "%i",
+ option->value.i);
+ break;
+
+ case OPTION_COLOUR:
+ rgbcolour = (((0x000000FF & option->value.c) << 16) |
+ ((0x0000FF00 & option->value.c) << 0) |
+ ((0x00FF0000 & option->value.c) >> 16));
+ slen = snprintf(string + pos,
+ size - pos,
+ "<span style=\"background-color: #%06x; "
+ "color: #%06x;\">#%06x</span>",
+ rgbcolour,
+ (~rgbcolour) & 0xffffff,
+ rgbcolour);
+ break;
+
+ case OPTION_STRING:
+ if (option->value.s != NULL) {
+ slen = snprintf(string + pos, size - pos, "%s",
+ option->value.s);
+ } else {
+ slen = snprintf(string + pos, size - pos,
+ "<span class=\"null-content\">NULL"
+ "</span>");
+ }
+ break;
+ }
+
+ return slen;
+}
+
+
+/**
+ * Output an option value into a string, in plain text format.
+ *
+ * \param option The option to output the value of.
+ * \param size The size of the string buffer.
+ * \param pos The current position in string
+ * \param string The string in which to output the value.
+ * \return The number of bytes written to string or -1 on error
+ */
+static size_t
+nsoption_output_value_text(struct nsoption_s *option,
+ size_t size,
+ size_t pos,
+ char *string)
+{
+ size_t slen = 0; /* length added to string */
+ colour rgbcolour; /* RRGGBB */
+
+ switch (option->type) {
+ case OPTION_BOOL:
+ slen = snprintf(string + pos,
+ size - pos,
+ "%c",
+ option->value.b ? '1' : '0');
+ break;
+
+ case OPTION_INTEGER:
+ slen = snprintf(string + pos,
+ size - pos,
+ "%i",
+ option->value.i);
+ break;
+
+ case OPTION_COLOUR:
+ rgbcolour = (((0x000000FF & option->value.c) << 16) |
+ ((0x0000FF00 & option->value.c) << 0) |
+ ((0x00FF0000 & option->value.c) >> 16));
+ slen = snprintf(string + pos, size - pos, "%06x", rgbcolour);
+ break;
+
+ case OPTION_STRING:
+ if (option->value.s != NULL) {
+ slen = snprintf(string + pos,
+ size - pos,
+ "%s",
+ option->value.s);
+ }
+ break;
+ }
+
+ return slen;
+}
+
+/* exported interface documented in utils/nsoption.h */
+nserror
+nsoption_init(nsoption_set_default_t *set_defaults,
+ struct nsoption_s **popts,
+ struct nsoption_s **pdefs)
+{
+ nserror ret;
+ struct nsoption_s *src;
+ struct nsoption_s *dst;
+ struct nsoption_s *opts;
+
+ /* update the default table */
+ if (set_defaults != NULL) {
+ nsoptions = &defaults[0];
+ ret = set_defaults(&defaults[0]);
+
+ if (ret != NSERROR_OK) {
+ nsoptions = NULL;
+ return ret;
+ }
+ }
+
+ opts = malloc(sizeof(defaults));
+ if (opts == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ /* copy the default values into the working set */
+ src = &defaults[0];
+ dst = opts;
+
+ while (src->key != NULL) {
+ dst->key = src->key;
+ dst->key_len = src->key_len;
+ dst->type = src->type;
+ if ((src->type == OPTION_STRING) && (src->value.s != NULL)) {
+ dst->value.s = strdup(src->value.s);
+ } else {
+ dst->value = src->value;
+ }
+ src++;
+ dst++;
+ }
+ dst->key = src->key;
+
+ /* return values if wanted */
+ if (popts != NULL) {
+ *popts = opts;
+ } else {
+ nsoptions = opts;
+ }
+
+ if (pdefs != NULL) {
+ *pdefs = &defaults[0];
+ }
+
+ return NSERROR_OK;
+}
+
+
+
+/* exported interface documented in utils/nsoption.h */
+nserror
+nsoption_read(const char *path, struct nsoption_s *opts)
+{
+ char s[100];
+ FILE *fp;
+
+ if (path == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* check to see if global table selected */
+ if (opts == NULL) {
+ opts = nsoptions;
+ }
+
+ fp = fopen(path, "r");
+ if (!fp) {
+ LOG(("Failed to open file '%s'", path));
+ return NSERROR_NOT_FOUND;
+ }
+
+ LOG(("Sucessfully opened '%s' for Options file", path));
+
+ while (fgets(s, 100, fp)) {
+ char *colon, *value;
+ unsigned int idx;
+
+ if ((s[0] == 0) || (s[0] == '#')) {
+ continue;
+ }
+
+ colon = strchr(s, ':');
+ if (colon == 0) {
+ continue;
+ }
+
+ s[strlen(s) - 1] = 0; /* remove \n at end */
+ *colon = 0; /* terminate key */
+ value = colon + 1;
+
+ for (idx = 0; opts[idx].key != NULL; idx++) {
+ if (strcasecmp(s, opts[idx].key) != 0) {
+ continue;
+ }
+
+ strtooption(value, &opts[idx]);
+ break;
+ }
+ }
+
+ fclose(fp);
+
+ nsoption_validate(opts);
+
+ return NSERROR_OK;
+}
+
+
+/* exported interface documented in utils/nsoption.h */
+nserror
+nsoption_write(const char *path,
+ struct nsoption_s *opts,
+ struct nsoption_s *defs)
+{
+ FILE *fp;
+ nserror ret;
+
+ if (path == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* check to see if global table selected */
+ if (opts == NULL) {
+ opts = nsoptions;
+ }
+
+ /* check to see if global table selected */
+ if (defs == NULL) {
+ defs = &defaults[0];
+ }
+
+ fp = fopen(path, "w");
+ if (!fp) {
+ LOG(("failed to open file '%s' for writing", path));
+ return NSERROR_NOT_FOUND;
+ }
+
+ ret = nsoption_output(fp, opts, defs, false);
+
+ fclose(fp);
+
+ return ret;
+}
+
+/* exported interface documented in utils/nsoption.h */
+nserror
+nsoption_dump(FILE *outf, struct nsoption_s *opts)
+{
+ if (outf == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* check to see if global table selected */
+ if (opts == NULL) {
+ opts = nsoptions;
+ }
+
+ return nsoption_output(outf, opts, NULL, true);
+}
+
+
+/* exported interface documented in utils/nsoption.h */
+nserror
+nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts)
+{
+ char *arg;
+ char *val;
+ int arglen;
+ int idx = 1;
+ int mv_loop;
+ unsigned int entry_loop;
+
+ /* check to see if global table selected */
+ if (opts == NULL) {
+ opts = nsoptions;
+ }
+
+ while (idx < *pargc) {
+ arg = argv[idx];
+ arglen = strlen(arg);
+
+ /* check we have an option */
+ /* option must start -- and be as long as the shortest option*/
+ if ((arglen < (2+5) ) || (arg[0] != '-') || (arg[1] != '-'))
+ break;
+
+ arg += 2; /* skip -- */
+
+ val = strchr(arg, '=');
+ if (val == NULL) {
+ /* no equals sign - next parameter is val */
+ idx++;
+ if (idx >= *pargc)
+ break;
+ val = argv[idx];
+ } else {
+ /* equals sign */
+ arglen = val - arg ;
+ val++;
+ }
+
+ /* arg+arglen is the option to set, val is the value */
+
+ LOG(("%.*s = %s", arglen, arg, val));
+
+ for (entry_loop = 0;
+ entry_loop < NSOPTION_LISTEND;
+ entry_loop++) {
+ if (strncmp(arg, opts[entry_loop].key, arglen) == 0) {
+ strtooption(val, opts + entry_loop);
+ break;
+ }
+ }
+
+ idx++;
+ }
+
+ /* remove processed options from argv */
+ for (mv_loop=0; mv_loop < (*pargc - idx); mv_loop++) {
+ argv[mv_loop + 1] = argv[mv_loop + idx];
+ }
+ *pargc -= (idx - 1);
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in options.h */
+int
+nsoption_snoptionf(char *string,
+ size_t size,
+ enum nsoption_e option_idx,
+ const char *fmt)
+{
+ size_t slen = 0; /* current output string length */
+ int fmtc = 0; /* current index into format string */
+ struct nsoption_s *option;
+
+ if (option_idx >= NSOPTION_LISTEND) {
+ return -1;
+ }
+
+ option = &nsoptions[option_idx]; /* assume the global table */
+ if (option == NULL || option->key == NULL)
+ return -1;
+
+
+ while ((slen < size) && (fmt[fmtc] != 0)) {
+ if (fmt[fmtc] == '%') {
+ fmtc++;
+ switch (fmt[fmtc]) {
+ case 'k':
+ slen += snprintf(string + slen,
+ size - slen,
+ "%s",
+ option->key);
+ break;
+
+ case 't':
+ switch (option->type) {
+ case OPTION_BOOL:
+ slen += snprintf(string + slen,
+ size - slen,
+ "boolean");
+ break;
+
+ case OPTION_INTEGER:
+ slen += snprintf(string + slen,
+ size - slen,
+ "integer");
+ break;
+
+ case OPTION_COLOUR:
+ slen += snprintf(string + slen,
+ size - slen,
+ "colour");
+ break;
+
+ case OPTION_STRING:
+ slen += snprintf(string + slen,
+ size - slen,
+ "string");
+ break;
+
+ }
+ break;
+
+
+ case 'V':
+ slen += nsoption_output_value_html(option,
+ size,
+ slen,
+ string);
+ break;
+ case 'v':
+ slen += nsoption_output_value_text(option,
+ size,
+ slen,
+ string);
+ break;
+ }
+ fmtc++;
+ } else {
+ string[slen] = fmt[fmtc];
+ slen++;
+ fmtc++;
+ }
+ }
+
+ /* Ensure that we NUL-terminate the output */
+ string[min(slen, size - 1)] = '\0';
+
+ return slen;
+}
diff --git a/utils/nsoption.h b/utils/nsoption.h
new file mode 100644
index 0000000..c7b4b11
--- /dev/null
+++ b/utils/nsoption.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * 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
+ * Option reading and saving (interface).
+ *
+ * Global options are defined in desktop/options.h
+ * Distinct target options are defined in <TARGET>/options.h
+ *
+ * The implementation API is slightly compromised because it still has
+ * "global" tables for both the default and current option tables.
+ *
+ * The initialisation and read/write interfaces take pointers to an
+ * option table which would let us to make the option structure
+ * opaque.
+ *
+ * All the actual acessors assume direct access to a global option
+ * table (nsoptions). To avoid this the acessors would have to take a
+ * pointer to the active options table and be implemented as functions
+ * within nsoptions.c
+ *
+ * Indirect acees would have an impact on performance of NetSurf as
+ * the expected option lookup cost is currently that of a simple
+ * dereference (which this current implementation keeps).
+ */
+
+#ifndef _NETSURF_UTILS_NSOPTION_H_
+#define _NETSURF_UTILS_NSOPTION_H_
+
+typedef uint32_t colour;
+#include <stdio.h>
+
+/* allow targets to include any necessary headers of their own */
+#define NSOPTION_BOOL(NAME, DEFAULT)
+#define NSOPTION_STRING(NAME, DEFAULT)
+#define NSOPTION_INTEGER(NAME, DEFAULT)
+#define NSOPTION_COLOUR(NAME, DEFAULT)
+
+#include "desktop/options.h"
+#if defined(riscos)
+#include "riscos/options.h"
+#elif defined(nsgtk)
+#include "gtk/options.h"
+#elif defined(nsbeos)
+#include "beos/options.h"
+#elif defined(nsamiga)
+#include "amiga/options.h"
+#elif defined(nsframebuffer)
+#include "framebuffer/options.h"
+#elif defined(nsatari)
+#include "atari/options.h"
+#elif defined(nsmonkey)
+#include "monkey/options.h"
+#endif
+
+#undef NSOPTION_BOOL
+#undef NSOPTION_STRING
+#undef NSOPTION_INTEGER
+#undef NSOPTION_COLOUR
+
+
+
+enum { OPTION_HTTP_PROXY_AUTH_NONE = 0,
+ OPTION_HTTP_PROXY_AUTH_BASIC = 1,
+ OPTION_HTTP_PROXY_AUTH_NTLM = 2 };
+
+#define DEFAULT_MARGIN_TOP_MM 10
+#define DEFAULT_MARGIN_BOTTOM_MM 10
+#define DEFAULT_MARGIN_LEFT_MM 10
+#define DEFAULT_MARGIN_RIGHT_MM 10
+#define DEFAULT_EXPORT_SCALE 0.7
+
+#ifndef DEFAULT_REFLOW_PERIOD
+#define DEFAULT_REFLOW_PERIOD 25 /* time in cs */
+#endif
+
+enum nsoption_type_e {
+ OPTION_BOOL,
+ OPTION_INTEGER,
+ OPTION_STRING,
+ OPTION_COLOUR
+};
+
+struct nsoption_s {
+ const char *key;
+ int key_len;
+ enum nsoption_type_e type;
+ union {
+ bool b;
+ int i;
+ char *s;
+ const char *cs;
+ colour c;
+ } value;
+};
+
+/* construct the option enumeration */
+#define NSOPTION_BOOL(NAME, DEFAULT) NSOPTION_##NAME,
+#define NSOPTION_STRING(NAME, DEFAULT) NSOPTION_##NAME,
+#define NSOPTION_INTEGER(NAME, DEFAULT) NSOPTION_##NAME,
+#define NSOPTION_COLOUR(NAME, DEFAULT) NSOPTION_##NAME,
+
+enum nsoption_e {
+#include "desktop/options.h"
+#if defined(riscos)
+#include "riscos/options.h"
+#elif defined(nsgtk)
+#include "gtk/options.h"
+#elif defined(nsbeos)
+#include "beos/options.h"
+#elif defined(nsamiga)
+#include "amiga/options.h"
+#elif defined(nsframebuffer)
+#include "framebuffer/options.h"
+#elif defined(nsatari)
+#include "atari/options.h"
+#elif defined(nsmonkey)
+#include "monkey/options.h"
+#endif
+ NSOPTION_LISTEND /* end of list */
+};
+
+#undef NSOPTION_BOOL
+#undef NSOPTION_STRING
+#undef NSOPTION_INTEGER
+#undef NSOPTION_COLOUR
+
+/* global option table */
+extern struct nsoption_s *nsoptions;
+
+/* global default option table */
+extern struct nsoption_s *nsoptions_default;
+
+/* default setting callback */
+typedef nserror(nsoption_set_default_t)(struct nsoption_s *defaults);
+
+
+/** Initialise option system.
+ *
+ * @param set_default callback to allow the customisation of the default
+ * options.
+ * @param ppots pointer to update to get options table or NULL.
+ * @param pdefs pointer to update to get default options table or NULL.
+ * @return The error status
+ */
+nserror nsoption_init(nsoption_set_default_t *set_default, struct nsoption_s **popts, struct nsoption_s **pdefs);
+
+
+/** Read choices file and set them in the passed table
+ *
+ * @param path The path to read the file from
+ * @param opts The options table to enerate values from or NULL to use global
+ * @return The error status
+ */
+nserror nsoption_read(const char *path, struct nsoption_s *opts);
+
+
+/** Write options that have changed from the defaults to a file.
+ *
+ * The \a nsoption_dump can be used to output all entries not just
+ * changed ones.
+ *
+ * @param path The path to read the file from
+ * @param opts The options table to enerate values from or NULL to use global
+ * @param defs The default table to use or NULL to use global
+ * @return The error status
+ */
+nserror nsoption_write(const char *path, struct nsoption_s *opts, struct nsoption_s *defs);
+
+
+/**
+ * Write all options to a stream.
+ *
+ * @param outf The stream to write to
+ * @param opts The options table to enerate values from or NULL to use global
+ * @return The error status
+ */
+nserror nsoption_dump(FILE *outf, struct nsoption_s *opts);
+
+/**
+ * Process commandline and set options approriately.
+ *
+ * @param pargc Pointer to the size of the argument vector.
+ * @param argv The argument vector.
+ * @param opts The options table to enerate values from or NULL to use global
+ * @return The error status
+ */
+nserror nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts);
+
+/**
+ * Fill a buffer with an option using a format.
+ *
+ * The format string is copied into the output buffer with the
+ * following replaced:
+ * %k - The options key
+ * %t - The options type
+ * %V - value (HTML formatting)
+ * %v - value (plain formatting)
+ *
+ * @param string The buffer in which to place the results.
+ * @param size The size of the string buffer.
+ * @param option The option .
+ * @param fmt The format string.
+ * @return The number of bytes written to \a string or -1 on error
+ */
+int nsoption_snoptionf(char *string, size_t size, enum nsoption_e option, const char *fmt);
+
+
+
+
+/* value acessors - caution should be taken with type as this is not verified */
+#define nsoption_bool(OPTION) (nsoptions[NSOPTION_##OPTION].value.b)
+#define nsoption_int(OPTION) (nsoptions[NSOPTION_##OPTION].value.i)
+#define nsoption_charp(OPTION) (nsoptions[NSOPTION_##OPTION].value.s)
+#define nsoption_colour(OPTION) (nsoptions[NSOPTION_##OPTION].value.c)
+
+#define nsoption_set_bool(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.b = VALUE
+#define nsoption_set_int(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.i = VALUE
+#define nsoption_set_colour(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.c = VALUE
+#define nsoption_set_charp(OPTION, VALUE) \
+ do { \
+ if (nsoptions[NSOPTION_##OPTION].value.s != NULL) { \
+ free(nsoptions[NSOPTION_##OPTION].value.s); \
+ } \
+ nsoptions[NSOPTION_##OPTION].value.s = VALUE; \
+ if ((nsoptions[NSOPTION_##OPTION].value.s != NULL) && \
+ (*nsoptions[NSOPTION_##OPTION].value.s == 0)) { \
+ free(nsoptions[NSOPTION_##OPTION].value.s); \
+ nsoptions[NSOPTION_##OPTION].value.s = NULL; \
+ } \
+ } while (0)
+
+/* if a string option is unset set it otherwise leave it set */
+#define nsoption_setnull_charp(OPTION, VALUE) \
+ do { \
+ if (nsoptions[NSOPTION_##OPTION].value.s == NULL) { \
+ nsoptions[NSOPTION_##OPTION].value.s = VALUE; \
+ if (*nsoptions[NSOPTION_##OPTION].value.s == 0) { \
+ free(nsoptions[NSOPTION_##OPTION].value.s); \
+ nsoptions[NSOPTION_##OPTION].value.s = NULL; \
+ } \
+ } else { \
+ free(VALUE); \
+ } \
+ } while (0)
+
+
+#endif
-----------------------------------------------------------------------
--
NetSurf Browser
10 years
netsurf: branch master updated. release/3.0-114-gba9769b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/ba9769bc8c22c49fe1be6...
...commit http://git.netsurf-browser.org/netsurf.git/commit/ba9769bc8c22c49fe1be653...
...tree http://git.netsurf-browser.org/netsurf.git/tree/ba9769bc8c22c49fe1be6536d...
The branch, master has been updated
via ba9769bc8c22c49fe1be6536d4684661ea2e079b (commit)
from 8dc7ec2cb48d74a6fd808f6989ec08771f4bb98f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ba9769bc8c22c49fe1b...
commit ba9769bc8c22c49fe1be6536d4684661ea2e079b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Pass fetch redirect info up to content layer as content_msg. Mark redirect origin URLs as visited in browser window content callback. Note this doesn't mean we track redirects, it just lets us get the :visited link style on links that redirect.
diff --git a/content/content.c b/content/content.c
index 9bf4312..1825bdf 100644
--- a/content/content.c
+++ b/content/content.c
@@ -188,6 +188,11 @@ nserror content_llcache_callback(llcache_handle *llcache,
msg_data.explicit_status_text = NULL;
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
break;
+ case LLCACHE_EVENT_REDIRECT:
+ msg_data.redirect.from = event->data.redirect.from;
+ msg_data.redirect.to = event->data.redirect.to;
+ content_broadcast(c, CONTENT_MSG_REDIRECT, msg_data);
+ break;
}
return error;
diff --git a/content/content.h b/content/content.h
index 3e55888..467fa60 100644
--- a/content/content.h
+++ b/content/content.h
@@ -69,6 +69,7 @@ typedef enum {
CONTENT_MSG_DONE, /**< finished */
CONTENT_MSG_ERROR, /**< error occurred */
CONTENT_MSG_ERRORCODE, /**< error occurred return nserror */
+ CONTENT_MSG_REDIRECT, /**< fetch url redirect occured */
CONTENT_MSG_STATUS, /**< new status string */
CONTENT_MSG_REFORMAT, /**< content_reformat done */
CONTENT_MSG_REDRAW, /**< needs redraw (eg. new animation frame) */
@@ -103,6 +104,11 @@ union content_msg_data {
const char *error;
/** CONTENT_MSG_ERRORCODE - Error code */
nserror errorcode;
+ /** CONTENT_MSG_REDIRECT - Redirect info */
+ struct {
+ nsurl *from; /**< Redirect origin */
+ nsurl *to; /**< Redirect target */
+ } redirect; /**< Fetch URL redirect occured */
/** CONTENT_MSG_REDRAW - Area of content which needs redrawing */
struct {
int x, y, width, height;
diff --git a/content/hlcache.c b/content/hlcache.c
index e99f238..6c84d16 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -593,6 +593,17 @@ nserror hlcache_llcache_callback(llcache_handle *handle,
break;
case LLCACHE_EVENT_PROGRESS:
break;
+ case LLCACHE_EVENT_REDIRECT:
+ if (ctx->handle->cb != NULL) {
+ hlcache_event hlevent;
+
+ hlevent.type = CONTENT_MSG_REDIRECT;
+ hlevent.data.redirect.from = event->data.redirect.from;
+ hlevent.data.redirect.to = event->data.redirect.to;
+
+ ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
+ }
+ break;
}
return NSERROR_OK;
diff --git a/content/llcache.c b/content/llcache.c
index 938f1e8..f2e519f 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1224,6 +1224,7 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target
bool match;
/* Extract HTTP response code from the fetch object */
long http_code = fetch_http_code(object->fetch.fetch);
+ llcache_event event;
/* Abort fetch for this object */
fetch_abort(object->fetch.fetch);
@@ -1238,8 +1239,6 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target
/* Forcibly stop redirecting if we've followed too many redirects */
#define REDIRECT_LIMIT 10
if (object->fetch.redirect_count > REDIRECT_LIMIT) {
- llcache_event event;
-
LOG(("Too many nested redirects"));
event.type = LLCACHE_EVENT_ERROR;
@@ -1254,6 +1253,18 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target
if (error != NSERROR_OK)
return error;
+ /* Inform users of redirect */
+ event.type = LLCACHE_EVENT_REDIRECT;
+ event.data.redirect.from = object->url;
+ event.data.redirect.to = url;
+
+ error = llcache_send_event_to_users(object, &event);
+
+ if (error != NSERROR_OK) {
+ nsurl_unref(url);
+ return error;
+ }
+
/* Reject attempts to redirect from unvalidated to validated schemes
* A "validated" scheme is one over which we have some guarantee that
* the source is trustworthy. */
diff --git a/content/llcache.h b/content/llcache.h
index b596310..3d8232c 100644
--- a/content/llcache.h
+++ b/content/llcache.h
@@ -56,6 +56,8 @@ typedef enum {
LLCACHE_EVENT_ERROR, /**< An error occurred during fetch */
LLCACHE_EVENT_PROGRESS, /**< Fetch progress update */
+
+ LLCACHE_EVENT_REDIRECT /**< Fetch URL redirect occured */
} llcache_event_type;
/** Low-level cache events */
@@ -67,6 +69,10 @@ typedef struct {
size_t len; /**< Length of buffer, in bytes */
} data; /**< Received data */
const char *msg; /**< Error or progress message */
+ struct {
+ nsurl *from; /**< Redirect origin */
+ nsurl *to; /**< Redirect target */
+ } redirect; /**< Fetch URL redirect occured */
} data; /**< Event data */
} llcache_event;
diff --git a/desktop/browser.c b/desktop/browser.c
index ac8c699..2693a18 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1355,6 +1355,11 @@ nserror browser_window_callback(hlcache_handle *c,
browser_window_stop_throbber(bw);
break;
+ case CONTENT_MSG_REDIRECT:
+ if (urldb_add_url(event->data.redirect.from))
+ urldb_update_url_visit_data(event->data.redirect.from);
+ break;
+
case CONTENT_MSG_STATUS:
if (event->data.explicit_status_text == NULL) {
/* Object content's status text updated */
diff --git a/desktop/download.c b/desktop/download.c
index f4bedc8..b775eb1 100644
--- a/desktop/download.c
+++ b/desktop/download.c
@@ -238,6 +238,9 @@ static nserror download_callback(llcache_handle *handle,
case LLCACHE_EVENT_PROGRESS:
break;
+
+ case LLCACHE_EVENT_REDIRECT:
+ break;
}
return error;
diff --git a/render/html_css.c b/render/html_css.c
index 7c09620..a5c6355 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -103,6 +103,9 @@ html_convert_css_callback(hlcache_handle *css,
case CONTENT_MSG_READY:
break;
+ case CONTENT_MSG_REDIRECT:
+ break;
+
case CONTENT_MSG_DONE:
LOG(("done stylesheet slot %d '%s'", i,
nsurl_access(hlcache_handle_get_url(css))));
diff --git a/render/html_object.c b/render/html_object.c
index d4d0ff9..b8f95db 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -203,6 +203,7 @@ html_object_callback(hlcache_handle *object,
break;
case CONTENT_MSG_REFORMAT:
+ case CONTENT_MSG_REDIRECT:
break;
case CONTENT_MSG_REDRAW:
-----------------------------------------------------------------------
Summary of changes:
content/content.c | 5 +++++
content/content.h | 6 ++++++
content/hlcache.c | 11 +++++++++++
content/llcache.c | 15 +++++++++++++--
content/llcache.h | 6 ++++++
desktop/browser.c | 5 +++++
desktop/download.c | 3 +++
render/html_css.c | 3 +++
render/html_object.c | 1 +
9 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/content/content.c b/content/content.c
index 9bf4312..1825bdf 100644
--- a/content/content.c
+++ b/content/content.c
@@ -188,6 +188,11 @@ nserror content_llcache_callback(llcache_handle *llcache,
msg_data.explicit_status_text = NULL;
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
break;
+ case LLCACHE_EVENT_REDIRECT:
+ msg_data.redirect.from = event->data.redirect.from;
+ msg_data.redirect.to = event->data.redirect.to;
+ content_broadcast(c, CONTENT_MSG_REDIRECT, msg_data);
+ break;
}
return error;
diff --git a/content/content.h b/content/content.h
index 3e55888..467fa60 100644
--- a/content/content.h
+++ b/content/content.h
@@ -69,6 +69,7 @@ typedef enum {
CONTENT_MSG_DONE, /**< finished */
CONTENT_MSG_ERROR, /**< error occurred */
CONTENT_MSG_ERRORCODE, /**< error occurred return nserror */
+ CONTENT_MSG_REDIRECT, /**< fetch url redirect occured */
CONTENT_MSG_STATUS, /**< new status string */
CONTENT_MSG_REFORMAT, /**< content_reformat done */
CONTENT_MSG_REDRAW, /**< needs redraw (eg. new animation frame) */
@@ -103,6 +104,11 @@ union content_msg_data {
const char *error;
/** CONTENT_MSG_ERRORCODE - Error code */
nserror errorcode;
+ /** CONTENT_MSG_REDIRECT - Redirect info */
+ struct {
+ nsurl *from; /**< Redirect origin */
+ nsurl *to; /**< Redirect target */
+ } redirect; /**< Fetch URL redirect occured */
/** CONTENT_MSG_REDRAW - Area of content which needs redrawing */
struct {
int x, y, width, height;
diff --git a/content/hlcache.c b/content/hlcache.c
index e99f238..6c84d16 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -593,6 +593,17 @@ nserror hlcache_llcache_callback(llcache_handle *handle,
break;
case LLCACHE_EVENT_PROGRESS:
break;
+ case LLCACHE_EVENT_REDIRECT:
+ if (ctx->handle->cb != NULL) {
+ hlcache_event hlevent;
+
+ hlevent.type = CONTENT_MSG_REDIRECT;
+ hlevent.data.redirect.from = event->data.redirect.from;
+ hlevent.data.redirect.to = event->data.redirect.to;
+
+ ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
+ }
+ break;
}
return NSERROR_OK;
diff --git a/content/llcache.c b/content/llcache.c
index 938f1e8..f2e519f 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1224,6 +1224,7 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target
bool match;
/* Extract HTTP response code from the fetch object */
long http_code = fetch_http_code(object->fetch.fetch);
+ llcache_event event;
/* Abort fetch for this object */
fetch_abort(object->fetch.fetch);
@@ -1238,8 +1239,6 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target
/* Forcibly stop redirecting if we've followed too many redirects */
#define REDIRECT_LIMIT 10
if (object->fetch.redirect_count > REDIRECT_LIMIT) {
- llcache_event event;
-
LOG(("Too many nested redirects"));
event.type = LLCACHE_EVENT_ERROR;
@@ -1254,6 +1253,18 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target
if (error != NSERROR_OK)
return error;
+ /* Inform users of redirect */
+ event.type = LLCACHE_EVENT_REDIRECT;
+ event.data.redirect.from = object->url;
+ event.data.redirect.to = url;
+
+ error = llcache_send_event_to_users(object, &event);
+
+ if (error != NSERROR_OK) {
+ nsurl_unref(url);
+ return error;
+ }
+
/* Reject attempts to redirect from unvalidated to validated schemes
* A "validated" scheme is one over which we have some guarantee that
* the source is trustworthy. */
diff --git a/content/llcache.h b/content/llcache.h
index b596310..3d8232c 100644
--- a/content/llcache.h
+++ b/content/llcache.h
@@ -56,6 +56,8 @@ typedef enum {
LLCACHE_EVENT_ERROR, /**< An error occurred during fetch */
LLCACHE_EVENT_PROGRESS, /**< Fetch progress update */
+
+ LLCACHE_EVENT_REDIRECT /**< Fetch URL redirect occured */
} llcache_event_type;
/** Low-level cache events */
@@ -67,6 +69,10 @@ typedef struct {
size_t len; /**< Length of buffer, in bytes */
} data; /**< Received data */
const char *msg; /**< Error or progress message */
+ struct {
+ nsurl *from; /**< Redirect origin */
+ nsurl *to; /**< Redirect target */
+ } redirect; /**< Fetch URL redirect occured */
} data; /**< Event data */
} llcache_event;
diff --git a/desktop/browser.c b/desktop/browser.c
index ac8c699..2693a18 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1355,6 +1355,11 @@ nserror browser_window_callback(hlcache_handle *c,
browser_window_stop_throbber(bw);
break;
+ case CONTENT_MSG_REDIRECT:
+ if (urldb_add_url(event->data.redirect.from))
+ urldb_update_url_visit_data(event->data.redirect.from);
+ break;
+
case CONTENT_MSG_STATUS:
if (event->data.explicit_status_text == NULL) {
/* Object content's status text updated */
diff --git a/desktop/download.c b/desktop/download.c
index f4bedc8..b775eb1 100644
--- a/desktop/download.c
+++ b/desktop/download.c
@@ -238,6 +238,9 @@ static nserror download_callback(llcache_handle *handle,
case LLCACHE_EVENT_PROGRESS:
break;
+
+ case LLCACHE_EVENT_REDIRECT:
+ break;
}
return error;
diff --git a/render/html_css.c b/render/html_css.c
index 7c09620..a5c6355 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -103,6 +103,9 @@ html_convert_css_callback(hlcache_handle *css,
case CONTENT_MSG_READY:
break;
+ case CONTENT_MSG_REDIRECT:
+ break;
+
case CONTENT_MSG_DONE:
LOG(("done stylesheet slot %d '%s'", i,
nsurl_access(hlcache_handle_get_url(css))));
diff --git a/render/html_object.c b/render/html_object.c
index d4d0ff9..b8f95db 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -203,6 +203,7 @@ html_object_callback(hlcache_handle *object,
break;
case CONTENT_MSG_REFORMAT:
+ case CONTENT_MSG_REDIRECT:
break;
case CONTENT_MSG_REDRAW:
--
NetSurf Browser
10 years
netsurf: branch master updated. release/3.0-113-g8dc7ec2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/8dc7ec2cb48d74a6fd808...
...commit http://git.netsurf-browser.org/netsurf.git/commit/8dc7ec2cb48d74a6fd808f6...
...tree http://git.netsurf-browser.org/netsurf.git/tree/8dc7ec2cb48d74a6fd808f698...
The branch, master has been updated
via 8dc7ec2cb48d74a6fd808f6989ec08771f4bb98f (commit)
from 4a618b7040022b9f1b18d030139f09ddabc4e3e3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=8dc7ec2cb48d74a6fd8...
commit 8dc7ec2cb48d74a6fd808f6989ec08771f4bb98f
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
More split fixery
diff --git a/amiga/font.c b/amiga/font.c
index 68ec8da..69afdba 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -308,7 +308,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
*char_offset = 0;
*actual_x = 0;
- while (utf8_pos <= length) {
+ do {
if ((*utf16 < 0xD800) || (0xDBFF < *utf16))
utf16charlen = 1;
else
@@ -351,7 +351,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
tx += tempx;
utf16 = utf16next;
utf8_pos = utf8_next(string, length, utf8_pos);
- }
+ } while (utf8_pos < length);
free(outf16);
-----------------------------------------------------------------------
Summary of changes:
amiga/font.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/amiga/font.c b/amiga/font.c
index 68ec8da..69afdba 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -308,7 +308,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
*char_offset = 0;
*actual_x = 0;
- while (utf8_pos <= length) {
+ do {
if ((*utf16 < 0xD800) || (0xDBFF < *utf16))
utf16charlen = 1;
else
@@ -351,7 +351,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
tx += tempx;
utf16 = utf16next;
utf8_pos = utf8_next(string, length, utf8_pos);
- }
+ } while (utf8_pos < length);
free(outf16);
--
NetSurf Browser
10 years
netsurf: branch master updated. release/3.0-112-g4a618b7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/4a618b7040022b9f1b18d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/4a618b7040022b9f1b18d03...
...tree http://git.netsurf-browser.org/netsurf.git/tree/4a618b7040022b9f1b18d0301...
The branch, master has been updated
via 4a618b7040022b9f1b18d030139f09ddabc4e3e3 (commit)
from b66775dc53f4117868e66d829d7fc37572865235 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4a618b7040022b9f1b1...
commit 4a618b7040022b9f1b18d030139f09ddabc4e3e3
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Another attempt to fix the moving split position when a string fits exactly.
diff --git a/amiga/font.c b/amiga/font.c
index 441f4d4..68ec8da 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -308,7 +308,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
*char_offset = 0;
*actual_x = 0;
- while (utf8_pos < length) {
+ while (utf8_pos <= length) {
if ((*utf16 < 0xD800) || (0xDBFF < *utf16))
utf16charlen = 1;
else
@@ -341,15 +341,14 @@ bool nsfont_split(const plot_font_style_t *fstyle,
}
}
- tx+= tempx;
-
if ((x < tx) && (*char_offset != 0)) {
/* Reached available width, and a space was found;
* split there. */
free(outf16);
return true;
}
-
+
+ tx += tempx;
utf16 = utf16next;
utf8_pos = utf8_next(string, length, utf8_pos);
}
-----------------------------------------------------------------------
Summary of changes:
amiga/font.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/amiga/font.c b/amiga/font.c
index 441f4d4..68ec8da 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -308,7 +308,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
*char_offset = 0;
*actual_x = 0;
- while (utf8_pos < length) {
+ while (utf8_pos <= length) {
if ((*utf16 < 0xD800) || (0xDBFF < *utf16))
utf16charlen = 1;
else
@@ -341,15 +341,14 @@ bool nsfont_split(const plot_font_style_t *fstyle,
}
}
- tx+= tempx;
-
if ((x < tx) && (*char_offset != 0)) {
/* Reached available width, and a space was found;
* split there. */
free(outf16);
return true;
}
-
+
+ tx += tempx;
utf16 = utf16next;
utf8_pos = utf8_next(string, length, utf8_pos);
}
--
NetSurf Browser
10 years
netsurf: branch master updated. release/3.0-111-gb66775d
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/b66775dc53f4117868e66...
...commit http://git.netsurf-browser.org/netsurf.git/commit/b66775dc53f4117868e66d8...
...tree http://git.netsurf-browser.org/netsurf.git/tree/b66775dc53f4117868e66d829...
The branch, master has been updated
via b66775dc53f4117868e66d829d7fc37572865235 (commit)
from 9751a107057cfe19e16e778e945d76b456d3b434 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b66775dc53f4117868e...
commit b66775dc53f4117868e66d829d7fc37572865235
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Prevent ASL from causing delayed menus
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index c6c9be8..db751da 100644
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -728,6 +728,8 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
{
case CMID_SELECTFILE:
if(AslRequestTags(filereq,
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_DoSaveMode,FALSE,
diff --git a/amiga/download.c b/amiga/download.c
index e461c5f..f0a7d09 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -105,6 +105,8 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
else
{
if(AslRequestTags(savereq,
+ ASLFR_Window, gui->shared->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile, download_context_get_filename(ctx),
@@ -351,6 +353,8 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
linkname = ASPrintf("Link_to_%s",FilePart(url));
if(AslRequestTags(savereq,
+ ASLFR_Window, g->shared->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,linkname,
diff --git a/amiga/file.c b/amiga/file.c
index 49c0afe..74c7225 100644
--- a/amiga/file.c
+++ b/amiga/file.c
@@ -83,6 +83,8 @@ void ami_file_open(struct gui_window_2 *gwin)
if(AslRequestTags(filereq,
ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_Screen, scrn,
ASLFR_DoSaveMode, FALSE,
ASLFR_RejectIcons, TRUE,
@@ -213,7 +215,7 @@ void ami_file_save(int type, char *fname, struct Window *win,
FWrite(fh, source_data, 1, strlen(source_data));
FClose(fh);
}
- free(source_data);
+ free((void *)source_data);
}
break;
}
@@ -229,6 +231,8 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
char *fname = AllocVec(1024, MEMF_CLEAR | MEMF_PRIVATE);
if(AslRequestTags(savereq,
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText, messages_get("NetSurf"),
ASLFR_Screen, scrn,
ASLFR_InitialFile, object ? FilePart(nsurl_access(hlcache_handle_get_url(object))) : "",
diff --git a/amiga/menu.c b/amiga/menu.c
index 105b701..2c8f541 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -963,6 +963,8 @@ static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct I
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
if(AslRequestTags(filereq,
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText, messages_get("NetSurf"),
ASLFR_Screen, scrn,
ASLFR_DoSaveMode, FALSE,
diff --git a/amiga/tree.c b/amiga/tree.c
index 9c7b9d6..bbacfdc 100644
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -1000,6 +1000,8 @@ BOOL ami_tree_event(struct treeview_window *twin)
{
case 0: // export
if(AslRequestTags(savereq,
+ ASLFR_Window, twin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,"tree_export.html",
-----------------------------------------------------------------------
Summary of changes:
amiga/context_menu.c | 2 ++
amiga/download.c | 4 ++++
amiga/file.c | 6 +++++-
amiga/menu.c | 2 ++
amiga/tree.c | 2 ++
5 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index c6c9be8..db751da 100644
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -728,6 +728,8 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
{
case CMID_SELECTFILE:
if(AslRequestTags(filereq,
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_DoSaveMode,FALSE,
diff --git a/amiga/download.c b/amiga/download.c
index e461c5f..f0a7d09 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -105,6 +105,8 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
else
{
if(AslRequestTags(savereq,
+ ASLFR_Window, gui->shared->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile, download_context_get_filename(ctx),
@@ -351,6 +353,8 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
linkname = ASPrintf("Link_to_%s",FilePart(url));
if(AslRequestTags(savereq,
+ ASLFR_Window, g->shared->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,linkname,
diff --git a/amiga/file.c b/amiga/file.c
index 49c0afe..74c7225 100644
--- a/amiga/file.c
+++ b/amiga/file.c
@@ -83,6 +83,8 @@ void ami_file_open(struct gui_window_2 *gwin)
if(AslRequestTags(filereq,
ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_Screen, scrn,
ASLFR_DoSaveMode, FALSE,
ASLFR_RejectIcons, TRUE,
@@ -213,7 +215,7 @@ void ami_file_save(int type, char *fname, struct Window *win,
FWrite(fh, source_data, 1, strlen(source_data));
FClose(fh);
}
- free(source_data);
+ free((void *)source_data);
}
break;
}
@@ -229,6 +231,8 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
char *fname = AllocVec(1024, MEMF_CLEAR | MEMF_PRIVATE);
if(AslRequestTags(savereq,
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText, messages_get("NetSurf"),
ASLFR_Screen, scrn,
ASLFR_InitialFile, object ? FilePart(nsurl_access(hlcache_handle_get_url(object))) : "",
diff --git a/amiga/menu.c b/amiga/menu.c
index 105b701..2c8f541 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -963,6 +963,8 @@ static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct I
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
if(AslRequestTags(filereq,
+ ASLFR_Window, gwin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText, messages_get("NetSurf"),
ASLFR_Screen, scrn,
ASLFR_DoSaveMode, FALSE,
diff --git a/amiga/tree.c b/amiga/tree.c
index 9c7b9d6..bbacfdc 100644
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -1000,6 +1000,8 @@ BOOL ami_tree_event(struct treeview_window *twin)
{
case 0: // export
if(AslRequestTags(savereq,
+ ASLFR_Window, twin->win,
+ ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialFile,"tree_export.html",
--
NetSurf Browser
10 years
libdom: branch master updated. release/0.0.1-3-gdb1fd54
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libdom.git/shortlog/db1fd54ff3a1441a28360b...
...commit http://git.netsurf-browser.org/libdom.git/commit/db1fd54ff3a1441a28360b48...
...tree http://git.netsurf-browser.org/libdom.git/tree/db1fd54ff3a1441a28360b48a0...
The branch, master has been updated
via db1fd54ff3a1441a28360b48a020b42f6af7793b (commit)
from 33d59e121f9f919f3fcb81dcc3225caca164f99b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=db1fd54ff3a1441a2836...
commit db1fd54ff3a1441a28360b48a020b42f6af7793b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Compare the name and prefix directly. Since this avoids string concatination, and (un)ref.
diff --git a/src/core/node.c b/src/core/node.c
index a09bf97..a59cc01 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -1595,7 +1595,6 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
dom_node_internal *other, bool *result)
{
dom_exception err = DOM_NO_ERR;
- dom_string *s1 = NULL, *s2 = NULL;
dom_namednodemap *m1 = NULL, *m2 = NULL;
dom_nodelist *l1 = NULL, *l2 = NULL;
*result = false;
@@ -1610,20 +1609,14 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
assert(node->owner != NULL);
assert(other->owner != NULL);
- /* Compare the node names (and prefix) */
- err = dom_node_get_node_name(node, &s1);
- if (err != DOM_NO_ERR) {
- /* error */
- goto cleanup;
- }
-
- err = dom_node_get_node_name(other, &s2);
- if (err != DOM_NO_ERR) {
- /* error */
+ /* Compare node name */
+ if (dom_string_isequal(node->name, other->name) == false) {
+ /* different */
goto cleanup;
}
- if (dom_string_isequal(s1, s2) == false) {
+ /* Compare prefix */
+ if (dom_string_isequal(node->prefix, other->prefix) == false) {
/* different */
goto cleanup;
}
@@ -1679,11 +1672,6 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
*result = true;
cleanup:
- if (s1 != NULL)
- dom_string_unref(s1);
- if (s2 != NULL)
- dom_string_unref(s2);
-
if (m1 != NULL)
dom_namednodemap_unref(m1);
if (m2 != NULL)
-----------------------------------------------------------------------
Summary of changes:
src/core/node.c | 22 +++++-----------------
1 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/src/core/node.c b/src/core/node.c
index a09bf97..a59cc01 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -1595,7 +1595,6 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
dom_node_internal *other, bool *result)
{
dom_exception err = DOM_NO_ERR;
- dom_string *s1 = NULL, *s2 = NULL;
dom_namednodemap *m1 = NULL, *m2 = NULL;
dom_nodelist *l1 = NULL, *l2 = NULL;
*result = false;
@@ -1610,20 +1609,14 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
assert(node->owner != NULL);
assert(other->owner != NULL);
- /* Compare the node names (and prefix) */
- err = dom_node_get_node_name(node, &s1);
- if (err != DOM_NO_ERR) {
- /* error */
- goto cleanup;
- }
-
- err = dom_node_get_node_name(other, &s2);
- if (err != DOM_NO_ERR) {
- /* error */
+ /* Compare node name */
+ if (dom_string_isequal(node->name, other->name) == false) {
+ /* different */
goto cleanup;
}
- if (dom_string_isequal(s1, s2) == false) {
+ /* Compare prefix */
+ if (dom_string_isequal(node->prefix, other->prefix) == false) {
/* different */
goto cleanup;
}
@@ -1679,11 +1672,6 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
*result = true;
cleanup:
- if (s1 != NULL)
- dom_string_unref(s1);
- if (s2 != NULL)
- dom_string_unref(s2);
-
if (m1 != NULL)
dom_namednodemap_unref(m1);
if (m2 != NULL)
--
Document Object Model library
10 years
libdom: branch master updated. release/0.0.1-2-g33d59e1
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libdom.git/shortlog/33d59e121f9f919f3fcb81...
...commit http://git.netsurf-browser.org/libdom.git/commit/33d59e121f9f919f3fcb81dc...
...tree http://git.netsurf-browser.org/libdom.git/tree/33d59e121f9f919f3fcb81dcc3...
The branch, master has been updated
via 33d59e121f9f919f3fcb81dcc3225caca164f99b (commit)
from f687048c44408d07f0e6c4f3dcb9d7cd8d67e767 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=33d59e121f9f919f3fcb...
commit 33d59e121f9f919f3fcb81dcc3225caca164f99b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Name and prefix were already compared. Add sane namespace comparison. Remove broken comparison stuff. Remove TODO from previous commit.
diff --git a/src/core/node.c b/src/core/node.c
index a920797..a09bf97 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -1589,6 +1589,7 @@ dom_exception _dom_node_lookup_namespace(dom_node_internal *node,
* + The node entities are equal
* + The node notations are equal
* TODO: in document_type, we should override this virtual function
+ * TODO: actually handle DocumentType nodes differently
*/
dom_exception _dom_node_is_equal(dom_node_internal *node,
dom_node_internal *other, bool *result)
@@ -1609,7 +1610,7 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
assert(node->owner != NULL);
assert(other->owner != NULL);
- /* Compare the node names */
+ /* Compare the node names (and prefix) */
err = dom_node_get_node_name(node, &s1);
if (err != DOM_NO_ERR) {
/* error */
@@ -1627,14 +1628,13 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
goto cleanup;
}
- /* TODO: surely this bit is broken */
- if (node->name != other->name ||
- node->namespace != other->namespace ||
- node->prefix != other->prefix) {
+ /* Compare namespace URI */
+ if (dom_string_isequal(node->namespace, other->namespace) == false) {
/* different */
goto cleanup;
}
+ /* Compare node value */
if (dom_string_isequal(node->value, other->value) == false) {
/* different */
goto cleanup;
@@ -1653,7 +1653,7 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
goto cleanup;
}
- if (dom_namednodemap_equal(m1, m2) != true) {
+ if (dom_namednodemap_equal(m1, m2) == false) {
/* different */
goto cleanup;
}
@@ -1671,7 +1671,7 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
goto cleanup;
}
- if (dom_nodelist_equal(l1, l2) != true) {
+ if (dom_nodelist_equal(l1, l2) == false) {
/* different */
goto cleanup;
}
-----------------------------------------------------------------------
Summary of changes:
src/core/node.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/core/node.c b/src/core/node.c
index a920797..a09bf97 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -1589,6 +1589,7 @@ dom_exception _dom_node_lookup_namespace(dom_node_internal *node,
* + The node entities are equal
* + The node notations are equal
* TODO: in document_type, we should override this virtual function
+ * TODO: actually handle DocumentType nodes differently
*/
dom_exception _dom_node_is_equal(dom_node_internal *node,
dom_node_internal *other, bool *result)
@@ -1609,7 +1610,7 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
assert(node->owner != NULL);
assert(other->owner != NULL);
- /* Compare the node names */
+ /* Compare the node names (and prefix) */
err = dom_node_get_node_name(node, &s1);
if (err != DOM_NO_ERR) {
/* error */
@@ -1627,14 +1628,13 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
goto cleanup;
}
- /* TODO: surely this bit is broken */
- if (node->name != other->name ||
- node->namespace != other->namespace ||
- node->prefix != other->prefix) {
+ /* Compare namespace URI */
+ if (dom_string_isequal(node->namespace, other->namespace) == false) {
/* different */
goto cleanup;
}
+ /* Compare node value */
if (dom_string_isequal(node->value, other->value) == false) {
/* different */
goto cleanup;
@@ -1653,7 +1653,7 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
goto cleanup;
}
- if (dom_namednodemap_equal(m1, m2) != true) {
+ if (dom_namednodemap_equal(m1, m2) == false) {
/* different */
goto cleanup;
}
@@ -1671,7 +1671,7 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
goto cleanup;
}
- if (dom_nodelist_equal(l1, l2) != true) {
+ if (dom_nodelist_equal(l1, l2) == false) {
/* different */
goto cleanup;
}
--
Document Object Model library
10 years
libdom: branch master updated. release/0.0.1-1-gf687048
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libdom.git/shortlog/f687048c44408d07f0e6c4...
...commit http://git.netsurf-browser.org/libdom.git/commit/f687048c44408d07f0e6c4f3...
...tree http://git.netsurf-browser.org/libdom.git/tree/f687048c44408d07f0e6c4f3dc...
The branch, master has been updated
via f687048c44408d07f0e6c4f3dcb9d7cd8d67e767 (commit)
from 490a8c63bc0b5c0204c48b368ad81ac4d2a9a8bf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=f687048c44408d07f0e6...
commit f687048c44408d07f0e6c4f3dcb9d7cd8d67e767
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix _dom_node_is_equal leaking all its refs. Replace C++ comments. Flag broken bit with TODO.
diff --git a/src/core/node.c b/src/core/node.c
index 1b06642..a920797 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -1593,75 +1593,108 @@ dom_exception _dom_node_lookup_namespace(dom_node_internal *node,
dom_exception _dom_node_is_equal(dom_node_internal *node,
dom_node_internal *other, bool *result)
{
- dom_exception err;
- dom_string *s1, *s2;
- dom_namednodemap *m1, *m2;
- dom_nodelist *l1, *l2;
+ dom_exception err = DOM_NO_ERR;
+ dom_string *s1 = NULL, *s2 = NULL;
+ dom_namednodemap *m1 = NULL, *m2 = NULL;
+ dom_nodelist *l1 = NULL, *l2 = NULL;
+ *result = false;
+ /* Compare the node types */
if (node->type != other->type){
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ err = DOM_NO_ERR;
+ goto cleanup;
}
assert(node->owner != NULL);
assert(other->owner != NULL);
+ /* Compare the node names */
err = dom_node_get_node_name(node, &s1);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
err = dom_node_get_node_name(other, &s2);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
if (dom_string_isequal(s1, s2) == false) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
-
+
+ /* TODO: surely this bit is broken */
if (node->name != other->name ||
node->namespace != other->namespace ||
node->prefix != other->prefix) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
if (dom_string_isequal(node->value, other->value) == false) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
- // Following comes the attributes
+ /* Compare the attributes */
err = dom_node_get_attributes(node, &m1);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
err = dom_node_get_attributes(other, &m2);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
if (dom_namednodemap_equal(m1, m2) != true) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
- // Finally the childNodes
+ /* Compare the children */
err = dom_node_get_child_nodes(node, &l1);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
err = dom_node_get_child_nodes(other, &l2);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
if (dom_nodelist_equal(l1, l2) != true) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
*result = true;
- return DOM_NO_ERR;
+cleanup:
+ if (s1 != NULL)
+ dom_string_unref(s1);
+ if (s2 != NULL)
+ dom_string_unref(s2);
+
+ if (m1 != NULL)
+ dom_namednodemap_unref(m1);
+ if (m2 != NULL)
+ dom_namednodemap_unref(m2);
+
+ if (l1 != NULL)
+ dom_nodelist_unref(l1);
+ if (l2 != NULL)
+ dom_nodelist_unref(l2);
+
+ return err;
}
/**
-----------------------------------------------------------------------
Summary of changes:
src/core/node.c | 97 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 65 insertions(+), 32 deletions(-)
diff --git a/src/core/node.c b/src/core/node.c
index 1b06642..a920797 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -1593,75 +1593,108 @@ dom_exception _dom_node_lookup_namespace(dom_node_internal *node,
dom_exception _dom_node_is_equal(dom_node_internal *node,
dom_node_internal *other, bool *result)
{
- dom_exception err;
- dom_string *s1, *s2;
- dom_namednodemap *m1, *m2;
- dom_nodelist *l1, *l2;
+ dom_exception err = DOM_NO_ERR;
+ dom_string *s1 = NULL, *s2 = NULL;
+ dom_namednodemap *m1 = NULL, *m2 = NULL;
+ dom_nodelist *l1 = NULL, *l2 = NULL;
+ *result = false;
+ /* Compare the node types */
if (node->type != other->type){
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ err = DOM_NO_ERR;
+ goto cleanup;
}
assert(node->owner != NULL);
assert(other->owner != NULL);
+ /* Compare the node names */
err = dom_node_get_node_name(node, &s1);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
err = dom_node_get_node_name(other, &s2);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
if (dom_string_isequal(s1, s2) == false) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
-
+
+ /* TODO: surely this bit is broken */
if (node->name != other->name ||
node->namespace != other->namespace ||
node->prefix != other->prefix) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
if (dom_string_isequal(node->value, other->value) == false) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
- // Following comes the attributes
+ /* Compare the attributes */
err = dom_node_get_attributes(node, &m1);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
err = dom_node_get_attributes(other, &m2);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
if (dom_namednodemap_equal(m1, m2) != true) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
- // Finally the childNodes
+ /* Compare the children */
err = dom_node_get_child_nodes(node, &l1);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
err = dom_node_get_child_nodes(other, &l2);
- if (err != DOM_NO_ERR)
- return err;
+ if (err != DOM_NO_ERR) {
+ /* error */
+ goto cleanup;
+ }
if (dom_nodelist_equal(l1, l2) != true) {
- *result = false;
- return DOM_NO_ERR;
+ /* different */
+ goto cleanup;
}
*result = true;
- return DOM_NO_ERR;
+cleanup:
+ if (s1 != NULL)
+ dom_string_unref(s1);
+ if (s2 != NULL)
+ dom_string_unref(s2);
+
+ if (m1 != NULL)
+ dom_namednodemap_unref(m1);
+ if (m2 != NULL)
+ dom_namednodemap_unref(m2);
+
+ if (l1 != NULL)
+ dom_nodelist_unref(l1);
+ if (l2 != NULL)
+ dom_nodelist_unref(l2);
+
+ return err;
}
/**
--
Document Object Model library
10 years
netsurf: branch master updated. release/3.0-110-g9751a10
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/9751a107057cfe19e16e7...
...commit http://git.netsurf-browser.org/netsurf.git/commit/9751a107057cfe19e16e778...
...tree http://git.netsurf-browser.org/netsurf.git/tree/9751a107057cfe19e16e778e9...
The branch, master has been updated
via 9751a107057cfe19e16e778e945d76b456d3b434 (commit)
via e8df19f3d2f4ac68da498b6c114cc08f7a452bfd (commit)
from 87b80b667f77d38bfd24bf4ae49cad10e0f1c9d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9751a107057cfe19e16...
commit 9751a107057cfe19e16e778e945d76b456d3b434
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Handle title on dom event. Remove head walker from begin_conversion.
diff --git a/render/html.c b/render/html.c
index 82c34b3..c3430a4 100644
--- a/render/html.c
+++ b/render/html.c
@@ -243,9 +243,6 @@ static bool html_process_title(html_content *c, dom_node *node)
char *title_str;
bool success;
- if (c->base.title != NULL)
- return true;
-
exc = dom_node_get_text_content(node, &title);
if ((exc != DOM_NO_ERR) || (title == NULL)) {
return false;
@@ -588,7 +585,7 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
/* an element node has been inserted */
exc = dom_node_get_node_name(node, &name);
if ((exc == DOM_NO_ERR) && (name != NULL)) {
- /* LOG(("element htmlc:%p node %p name:%s", htmlc, node, dom_string_data(name))); */
+
if (dom_string_caseless_isequal(name,
corestring_dom_link)) {
/* Handle stylesheet loading */
@@ -607,6 +604,10 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
name, corestring_lwc_base)) {
html_process_base(htmlc,
(dom_node *)node);
+ } else if (dom_string_caseless_lwc_isequal(
+ name, corestring_lwc_title) &&
+ htmlc->title == NULL) {
+ htmlc->title = dom_node_ref(node);
}
dom_string_unref(name);
@@ -628,15 +629,24 @@ dom_default_action_DOMSubtreeModified_cb(struct dom_event *evt, void *pw)
exc = dom_event_get_target(evt, &node);
if ((exc == DOM_NO_ERR) && (node != NULL)) {
+ if (htmlc->title == (dom_node *)node) {
+ /* Node is our title node */
+ html_process_title(htmlc, (dom_node *)node);
+ dom_node_unref(node);
+ return;
+ }
+
exc = dom_node_get_node_type(node, &type);
if ((exc == DOM_NO_ERR) && (type == DOM_ELEMENT_NODE)) {
- /* an element node has been inserted */
+ /* an element node has been modified */
exc = dom_node_get_node_name(node, &name);
if ((exc == DOM_NO_ERR) && (name != NULL)) {
- /* LOG(("element htmlc:%p node:%p name:%s", htmlc, node, dom_string_data(name))); */
- if (dom_string_caseless_isequal(name, corestring_dom_style)) {
- html_css_update_style(htmlc, (dom_node *)node);
- }
+
+ if (dom_string_caseless_isequal(name,
+ corestring_dom_style)) {
+ html_css_update_style(htmlc,
+ (dom_node *)node);
+ }
dom_string_unref(name);
}
@@ -691,6 +701,7 @@ html_create_html_data(html_content *c, const http_parameter *params)
c->base_target = NULL;
c->aborted = false;
c->refresh = false;
+ c->title = NULL;
c->bctx = NULL;
c->layout = NULL;
c->background_colour = NS_TRANSPARENT;
@@ -944,61 +955,6 @@ html_process_data(struct content *c, const char *data, unsigned int size)
return true;
}
-/**
- * Process elements in <head>.
- *
- * \param c content structure
- * \param head xml node of head element
- * \return true on success, false on memory exhaustion
- *
- * The title and base href are extracted if present.
- */
-
-static nserror html_head(html_content *c, dom_node *head)
-{
- dom_node *node;
- dom_exception exc; /* returned by libdom functions */
- dom_string *node_name;
- dom_node_type node_type;
- dom_node *next_node;
-
- exc = dom_node_get_first_child(head, &node);
- if (exc != DOM_NO_ERR) {
- return NSERROR_DOM;
- }
-
- while (node != NULL) {
- exc = dom_node_get_node_type(node, &node_type);
-
- if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
- exc = dom_node_get_node_name(node, &node_name);
-
- if ((exc == DOM_NO_ERR) && (node_name != NULL)) {
- if (dom_string_caseless_lwc_isequal(
- node_name,
- corestring_lwc_title)) {
- html_process_title(c, node);
- }
- }
- if (node_name != NULL) {
- dom_string_unref(node_name);
- }
- }
-
- /* move to next node */
- exc = dom_node_get_next_sibling(node, &next_node);
- dom_node_unref(node);
- if (exc == DOM_NO_ERR) {
- node = next_node;
- } else {
- node = NULL;
- }
- }
-
- return NSERROR_OK;
-}
-
-
/**
* Convert a CONTENT_HTML for display.
@@ -1069,7 +1025,7 @@ bool html_can_begin_conversion(html_content *htmlc)
bool
html_begin_conversion(html_content *htmlc)
{
- dom_node *html, *head;
+ dom_node *html;
nserror ns_error;
struct form *f;
dom_exception exc; /* returned by libdom functions */
@@ -1141,18 +1097,6 @@ html_begin_conversion(html_content *htmlc)
}
dom_string_unref(node_name);
- head = libdom_find_first_element(html, corestring_lwc_head);
- if (head != NULL) {
- ns_error = html_head(htmlc, head);
- if (ns_error != NSERROR_OK) {
- content_broadcast_errorcode(&htmlc->base, ns_error);
-
- dom_node_unref(html);
- dom_node_unref(head);
- return false;
- }
- }
-
/* Retrieve forms from parser */
htmlc->forms = html_forms_get_forms(htmlc->encoding,
(dom_html_document *) htmlc->document);
@@ -1176,7 +1120,6 @@ html_begin_conversion(html_content *htmlc)
content_broadcast_errorcode(&htmlc->base, ns_error);
dom_node_unref(html);
- dom_node_unref(head);
return false;
}
@@ -1188,7 +1131,6 @@ html_begin_conversion(html_content *htmlc)
NSERROR_NOMEM);
dom_node_unref(html);
- dom_node_unref(head);
return false;
}
@@ -1199,13 +1141,11 @@ html_begin_conversion(html_content *htmlc)
content_broadcast_errorcode(&htmlc->base,
NSERROR_NOMEM);
dom_node_unref(html);
- dom_node_unref(head);
return false;
}
}
}
- dom_node_unref(head);
dom_node_unref(html);
if (htmlc->base.active == 0) {
@@ -1419,6 +1359,12 @@ static void html_destroy(struct content *c)
if (html->document != NULL) {
dom_node_unref(html->document);
+ html->document = NULL;
+ }
+
+ if (html->title != NULL) {
+ dom_node_unref(html->title);
+ html->title = NULL;
}
/* Free base target */
diff --git a/render/html_internal.h b/render/html_internal.h
index 7c30fdd..43fce9b 100644
--- a/render/html_internal.h
+++ b/render/html_internal.h
@@ -93,6 +93,9 @@ typedef struct html_content {
/** Whether a meta refresh has been handled */
bool refresh;
+ /* Title element node */
+ dom_node *title;
+
/** A talloc context purely for the render box tree */
int *bctx;
/** Box tree, or NULL. */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=e8df19f3d2f4ac68da4...
commit e8df19f3d2f4ac68da498b6c114cc08f7a452bfd
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Move base and link element handling to event callback.
diff --git a/render/html.c b/render/html.c
index 75cbf68..82c34b3 100644
--- a/render/html.c
+++ b/render/html.c
@@ -144,6 +144,180 @@ static void html_box_convert_done(html_content *c, bool success)
dom_node_unref(html);
}
+
+/** process link node */
+static bool html_process_link(html_content *c, dom_node *node)
+{
+ struct content_rfc5988_link link; /* the link added to the content */
+ dom_exception exc; /* returned by libdom functions */
+ dom_string *atr_string;
+ nserror error;
+
+ memset(&link, 0, sizeof(struct content_rfc5988_link));
+
+ /* check that the relation exists - w3c spec says must be present */
+ exc = dom_element_get_attribute(node, corestring_dom_rel, &atr_string);
+ if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
+ return false;
+ }
+ /* get a lwc string containing the link relation */
+ exc = dom_string_intern(atr_string, &link.rel);
+ dom_string_unref(atr_string);
+ if (exc != DOM_NO_ERR) {
+ return false;
+ }
+
+ /* check that the href exists - w3c spec says must be present */
+ exc = dom_element_get_attribute(node, corestring_dom_href, &atr_string);
+ if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
+ lwc_string_unref(link.rel);
+ return false;
+ }
+
+ /* get nsurl */
+ error = nsurl_join(c->base_url, dom_string_data(atr_string),
+ &link.href);
+ dom_string_unref(atr_string);
+ if (error != NSERROR_OK) {
+ lwc_string_unref(link.rel);
+ return false;
+ }
+
+ /* look for optional properties -- we don't care if internment fails */
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_hreflang, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the href lang */
+ exc = dom_string_intern(atr_string, &link.hreflang);
+ dom_string_unref(atr_string);
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_type, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the type */
+ exc = dom_string_intern(atr_string, &link.type);
+ dom_string_unref(atr_string);
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_media, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the media */
+ exc = dom_string_intern(atr_string, &link.media);
+ dom_string_unref(atr_string);
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_sizes, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the sizes */
+ exc = dom_string_intern(atr_string, &link.sizes);
+ dom_string_unref(atr_string);
+ }
+
+ /* add to content */
+ content__add_rfc5988_link(&c->base, &link);
+
+ if (link.sizes != NULL)
+ lwc_string_unref(link.sizes);
+ if (link.media != NULL)
+ lwc_string_unref(link.media);
+ if (link.type != NULL)
+ lwc_string_unref(link.type);
+ if (link.hreflang != NULL)
+ lwc_string_unref(link.hreflang);
+
+ nsurl_unref(link.href);
+ lwc_string_unref(link.rel);
+
+ return true;
+}
+
+/** process title node */
+static bool html_process_title(html_content *c, dom_node *node)
+{
+ dom_exception exc; /* returned by libdom functions */
+ dom_string *title;
+ char *title_str;
+ bool success;
+
+ if (c->base.title != NULL)
+ return true;
+
+ exc = dom_node_get_text_content(node, &title);
+ if ((exc != DOM_NO_ERR) || (title == NULL)) {
+ return false;
+ }
+
+ title_str = squash_whitespace(dom_string_data(title));
+ dom_string_unref(title);
+
+ if (title_str == NULL) {
+ return false;
+ }
+
+ success = content__set_title(&c->base, title_str);
+
+ free(title_str);
+
+ return success;
+}
+
+static bool html_process_base(html_content *c, dom_node *node)
+{
+ dom_exception exc; /* returned by libdom functions */
+ dom_string *atr_string;
+
+ /* get href attribute if present */
+ exc = dom_element_get_attribute(node,
+ corestring_dom_href, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ nsurl *url;
+ nserror error;
+
+ /* get url from string */
+ error = nsurl_create(dom_string_data(atr_string), &url);
+ dom_string_unref(atr_string);
+ if (error == NSERROR_OK) {
+ if (c->base_url != NULL)
+ nsurl_unref(c->base_url);
+ c->base_url = url;
+ }
+ }
+
+
+ /* get target attribute if present and not already set */
+ if (c->base_target != NULL) {
+ return true;
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_target, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* Validation rules from the HTML5 spec for the base element:
+ * The target must be one of _blank, _self, _parent, or
+ * _top or any identifier which does not begin with an
+ * underscore
+ */
+ if (*dom_string_data(atr_string) != '_' ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__blank) ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__self) ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__parent) ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__top)) {
+ c->base_target = strdup(dom_string_data(atr_string));
+ }
+ dom_string_unref(atr_string);
+ }
+
+ return true;
+}
+
static nserror html_meta_refresh_process_element(html_content *c, dom_node *n)
{
union content_msg_data msg_data;
@@ -417,14 +591,22 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
/* LOG(("element htmlc:%p node %p name:%s", htmlc, node, dom_string_data(name))); */
if (dom_string_caseless_isequal(name,
corestring_dom_link)) {
+ /* Handle stylesheet loading */
html_css_process_link(htmlc,
(dom_node *)node);
+ /* Generic link handling */
+ html_process_link(htmlc,
+ (dom_node *)node);
} else if (dom_string_caseless_lwc_isequal(name,
corestring_lwc_meta) &&
htmlc->refresh == false) {
html_meta_refresh_process_element(htmlc,
(dom_node *)node);
+ } else if (dom_string_caseless_lwc_isequal(
+ name, corestring_lwc_base)) {
+ html_process_base(htmlc,
+ (dom_node *)node);
}
dom_string_unref(name);
@@ -762,180 +944,6 @@ html_process_data(struct content *c, const char *data, unsigned int size)
return true;
}
-
-/** process link node */
-static bool html_process_link(html_content *c, dom_node *node)
-{
- struct content_rfc5988_link link; /* the link added to the content */
- dom_exception exc; /* returned by libdom functions */
- dom_string *atr_string;
- nserror error;
-
- memset(&link, 0, sizeof(struct content_rfc5988_link));
-
- /* check that the relation exists - w3c spec says must be present */
- exc = dom_element_get_attribute(node, corestring_dom_rel, &atr_string);
- if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
- return false;
- }
- /* get a lwc string containing the link relation */
- exc = dom_string_intern(atr_string, &link.rel);
- dom_string_unref(atr_string);
- if (exc != DOM_NO_ERR) {
- return false;
- }
-
- /* check that the href exists - w3c spec says must be present */
- exc = dom_element_get_attribute(node, corestring_dom_href, &atr_string);
- if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
- lwc_string_unref(link.rel);
- return false;
- }
-
- /* get nsurl */
- error = nsurl_join(c->base_url, dom_string_data(atr_string),
- &link.href);
- dom_string_unref(atr_string);
- if (error != NSERROR_OK) {
- lwc_string_unref(link.rel);
- return false;
- }
-
- /* look for optional properties -- we don't care if internment fails */
-
- exc = dom_element_get_attribute(node,
- corestring_dom_hreflang, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the href lang */
- exc = dom_string_intern(atr_string, &link.hreflang);
- dom_string_unref(atr_string);
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_type, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the type */
- exc = dom_string_intern(atr_string, &link.type);
- dom_string_unref(atr_string);
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_media, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the media */
- exc = dom_string_intern(atr_string, &link.media);
- dom_string_unref(atr_string);
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_sizes, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the sizes */
- exc = dom_string_intern(atr_string, &link.sizes);
- dom_string_unref(atr_string);
- }
-
- /* add to content */
- content__add_rfc5988_link(&c->base, &link);
-
- if (link.sizes != NULL)
- lwc_string_unref(link.sizes);
- if (link.media != NULL)
- lwc_string_unref(link.media);
- if (link.type != NULL)
- lwc_string_unref(link.type);
- if (link.hreflang != NULL)
- lwc_string_unref(link.hreflang);
-
- nsurl_unref(link.href);
- lwc_string_unref(link.rel);
-
- return true;
-}
-
-/** process title node */
-static bool html_process_title(html_content *c, dom_node *node)
-{
- dom_exception exc; /* returned by libdom functions */
- dom_string *title;
- char *title_str;
- bool success;
-
- if (c->base.title != NULL)
- return true;
-
- exc = dom_node_get_text_content(node, &title);
- if ((exc != DOM_NO_ERR) || (title == NULL)) {
- return false;
- }
-
- title_str = squash_whitespace(dom_string_data(title));
- dom_string_unref(title);
-
- if (title_str == NULL) {
- return false;
- }
-
- success = content__set_title(&c->base, title_str);
-
- free(title_str);
-
- return success;
-}
-
-static bool html_process_base(html_content *c, dom_node *node)
-{
- dom_exception exc; /* returned by libdom functions */
- dom_string *atr_string;
-
- /* get href attribute if present */
- exc = dom_element_get_attribute(node,
- corestring_dom_href, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- nsurl *url;
- nserror error;
-
- /* get url from string */
- error = nsurl_create(dom_string_data(atr_string), &url);
- dom_string_unref(atr_string);
- if (error == NSERROR_OK) {
- if (c->base_url != NULL)
- nsurl_unref(c->base_url);
- c->base_url = url;
- }
- }
-
-
- /* get target attribute if present and not already set */
- if (c->base_target != NULL) {
- return true;
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_target, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* Validation rules from the HTML5 spec for the base element:
- * The target must be one of _blank, _self, _parent, or
- * _top or any identifier which does not begin with an
- * underscore
- */
- if (*dom_string_data(atr_string) != '_' ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__blank) ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__self) ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__parent) ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__top)) {
- c->base_target = strdup(dom_string_data(atr_string));
- }
- dom_string_unref(atr_string);
- }
-
- return true;
-}
-
/**
* Process elements in <head>.
*
@@ -970,14 +978,6 @@ static nserror html_head(html_content *c, dom_node *head)
node_name,
corestring_lwc_title)) {
html_process_title(c, node);
- } else if (dom_string_caseless_lwc_isequal(
- node_name,
- corestring_lwc_base)) {
- html_process_base(c, node);
- } else if (dom_string_caseless_lwc_isequal(
- node_name,
- corestring_lwc_link)) {
- html_process_link(c, node);
}
}
if (node_name != NULL) {
-----------------------------------------------------------------------
Summary of changes:
render/html.c | 466 +++++++++++++++++++++---------------------------
render/html_internal.h | 3 +
2 files changed, 209 insertions(+), 260 deletions(-)
diff --git a/render/html.c b/render/html.c
index 75cbf68..c3430a4 100644
--- a/render/html.c
+++ b/render/html.c
@@ -144,6 +144,177 @@ static void html_box_convert_done(html_content *c, bool success)
dom_node_unref(html);
}
+
+/** process link node */
+static bool html_process_link(html_content *c, dom_node *node)
+{
+ struct content_rfc5988_link link; /* the link added to the content */
+ dom_exception exc; /* returned by libdom functions */
+ dom_string *atr_string;
+ nserror error;
+
+ memset(&link, 0, sizeof(struct content_rfc5988_link));
+
+ /* check that the relation exists - w3c spec says must be present */
+ exc = dom_element_get_attribute(node, corestring_dom_rel, &atr_string);
+ if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
+ return false;
+ }
+ /* get a lwc string containing the link relation */
+ exc = dom_string_intern(atr_string, &link.rel);
+ dom_string_unref(atr_string);
+ if (exc != DOM_NO_ERR) {
+ return false;
+ }
+
+ /* check that the href exists - w3c spec says must be present */
+ exc = dom_element_get_attribute(node, corestring_dom_href, &atr_string);
+ if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
+ lwc_string_unref(link.rel);
+ return false;
+ }
+
+ /* get nsurl */
+ error = nsurl_join(c->base_url, dom_string_data(atr_string),
+ &link.href);
+ dom_string_unref(atr_string);
+ if (error != NSERROR_OK) {
+ lwc_string_unref(link.rel);
+ return false;
+ }
+
+ /* look for optional properties -- we don't care if internment fails */
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_hreflang, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the href lang */
+ exc = dom_string_intern(atr_string, &link.hreflang);
+ dom_string_unref(atr_string);
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_type, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the type */
+ exc = dom_string_intern(atr_string, &link.type);
+ dom_string_unref(atr_string);
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_media, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the media */
+ exc = dom_string_intern(atr_string, &link.media);
+ dom_string_unref(atr_string);
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_sizes, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* get a lwc string containing the sizes */
+ exc = dom_string_intern(atr_string, &link.sizes);
+ dom_string_unref(atr_string);
+ }
+
+ /* add to content */
+ content__add_rfc5988_link(&c->base, &link);
+
+ if (link.sizes != NULL)
+ lwc_string_unref(link.sizes);
+ if (link.media != NULL)
+ lwc_string_unref(link.media);
+ if (link.type != NULL)
+ lwc_string_unref(link.type);
+ if (link.hreflang != NULL)
+ lwc_string_unref(link.hreflang);
+
+ nsurl_unref(link.href);
+ lwc_string_unref(link.rel);
+
+ return true;
+}
+
+/** process title node */
+static bool html_process_title(html_content *c, dom_node *node)
+{
+ dom_exception exc; /* returned by libdom functions */
+ dom_string *title;
+ char *title_str;
+ bool success;
+
+ exc = dom_node_get_text_content(node, &title);
+ if ((exc != DOM_NO_ERR) || (title == NULL)) {
+ return false;
+ }
+
+ title_str = squash_whitespace(dom_string_data(title));
+ dom_string_unref(title);
+
+ if (title_str == NULL) {
+ return false;
+ }
+
+ success = content__set_title(&c->base, title_str);
+
+ free(title_str);
+
+ return success;
+}
+
+static bool html_process_base(html_content *c, dom_node *node)
+{
+ dom_exception exc; /* returned by libdom functions */
+ dom_string *atr_string;
+
+ /* get href attribute if present */
+ exc = dom_element_get_attribute(node,
+ corestring_dom_href, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ nsurl *url;
+ nserror error;
+
+ /* get url from string */
+ error = nsurl_create(dom_string_data(atr_string), &url);
+ dom_string_unref(atr_string);
+ if (error == NSERROR_OK) {
+ if (c->base_url != NULL)
+ nsurl_unref(c->base_url);
+ c->base_url = url;
+ }
+ }
+
+
+ /* get target attribute if present and not already set */
+ if (c->base_target != NULL) {
+ return true;
+ }
+
+ exc = dom_element_get_attribute(node,
+ corestring_dom_target, &atr_string);
+ if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
+ /* Validation rules from the HTML5 spec for the base element:
+ * The target must be one of _blank, _self, _parent, or
+ * _top or any identifier which does not begin with an
+ * underscore
+ */
+ if (*dom_string_data(atr_string) != '_' ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__blank) ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__self) ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__parent) ||
+ dom_string_caseless_lwc_isequal(atr_string,
+ corestring_lwc__top)) {
+ c->base_target = strdup(dom_string_data(atr_string));
+ }
+ dom_string_unref(atr_string);
+ }
+
+ return true;
+}
+
static nserror html_meta_refresh_process_element(html_content *c, dom_node *n)
{
union content_msg_data msg_data;
@@ -414,17 +585,29 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
/* an element node has been inserted */
exc = dom_node_get_node_name(node, &name);
if ((exc == DOM_NO_ERR) && (name != NULL)) {
- /* LOG(("element htmlc:%p node %p name:%s", htmlc, node, dom_string_data(name))); */
+
if (dom_string_caseless_isequal(name,
corestring_dom_link)) {
+ /* Handle stylesheet loading */
html_css_process_link(htmlc,
(dom_node *)node);
+ /* Generic link handling */
+ html_process_link(htmlc,
+ (dom_node *)node);
} else if (dom_string_caseless_lwc_isequal(name,
corestring_lwc_meta) &&
htmlc->refresh == false) {
html_meta_refresh_process_element(htmlc,
(dom_node *)node);
+ } else if (dom_string_caseless_lwc_isequal(
+ name, corestring_lwc_base)) {
+ html_process_base(htmlc,
+ (dom_node *)node);
+ } else if (dom_string_caseless_lwc_isequal(
+ name, corestring_lwc_title) &&
+ htmlc->title == NULL) {
+ htmlc->title = dom_node_ref(node);
}
dom_string_unref(name);
@@ -446,15 +629,24 @@ dom_default_action_DOMSubtreeModified_cb(struct dom_event *evt, void *pw)
exc = dom_event_get_target(evt, &node);
if ((exc == DOM_NO_ERR) && (node != NULL)) {
+ if (htmlc->title == (dom_node *)node) {
+ /* Node is our title node */
+ html_process_title(htmlc, (dom_node *)node);
+ dom_node_unref(node);
+ return;
+ }
+
exc = dom_node_get_node_type(node, &type);
if ((exc == DOM_NO_ERR) && (type == DOM_ELEMENT_NODE)) {
- /* an element node has been inserted */
+ /* an element node has been modified */
exc = dom_node_get_node_name(node, &name);
if ((exc == DOM_NO_ERR) && (name != NULL)) {
- /* LOG(("element htmlc:%p node:%p name:%s", htmlc, node, dom_string_data(name))); */
- if (dom_string_caseless_isequal(name, corestring_dom_style)) {
- html_css_update_style(htmlc, (dom_node *)node);
- }
+
+ if (dom_string_caseless_isequal(name,
+ corestring_dom_style)) {
+ html_css_update_style(htmlc,
+ (dom_node *)node);
+ }
dom_string_unref(name);
}
@@ -509,6 +701,7 @@ html_create_html_data(html_content *c, const http_parameter *params)
c->base_target = NULL;
c->aborted = false;
c->refresh = false;
+ c->title = NULL;
c->bctx = NULL;
c->layout = NULL;
c->background_colour = NS_TRANSPARENT;
@@ -763,243 +956,6 @@ html_process_data(struct content *c, const char *data, unsigned int size)
}
-/** process link node */
-static bool html_process_link(html_content *c, dom_node *node)
-{
- struct content_rfc5988_link link; /* the link added to the content */
- dom_exception exc; /* returned by libdom functions */
- dom_string *atr_string;
- nserror error;
-
- memset(&link, 0, sizeof(struct content_rfc5988_link));
-
- /* check that the relation exists - w3c spec says must be present */
- exc = dom_element_get_attribute(node, corestring_dom_rel, &atr_string);
- if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
- return false;
- }
- /* get a lwc string containing the link relation */
- exc = dom_string_intern(atr_string, &link.rel);
- dom_string_unref(atr_string);
- if (exc != DOM_NO_ERR) {
- return false;
- }
-
- /* check that the href exists - w3c spec says must be present */
- exc = dom_element_get_attribute(node, corestring_dom_href, &atr_string);
- if ((exc != DOM_NO_ERR) || (atr_string == NULL)) {
- lwc_string_unref(link.rel);
- return false;
- }
-
- /* get nsurl */
- error = nsurl_join(c->base_url, dom_string_data(atr_string),
- &link.href);
- dom_string_unref(atr_string);
- if (error != NSERROR_OK) {
- lwc_string_unref(link.rel);
- return false;
- }
-
- /* look for optional properties -- we don't care if internment fails */
-
- exc = dom_element_get_attribute(node,
- corestring_dom_hreflang, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the href lang */
- exc = dom_string_intern(atr_string, &link.hreflang);
- dom_string_unref(atr_string);
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_type, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the type */
- exc = dom_string_intern(atr_string, &link.type);
- dom_string_unref(atr_string);
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_media, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the media */
- exc = dom_string_intern(atr_string, &link.media);
- dom_string_unref(atr_string);
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_sizes, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* get a lwc string containing the sizes */
- exc = dom_string_intern(atr_string, &link.sizes);
- dom_string_unref(atr_string);
- }
-
- /* add to content */
- content__add_rfc5988_link(&c->base, &link);
-
- if (link.sizes != NULL)
- lwc_string_unref(link.sizes);
- if (link.media != NULL)
- lwc_string_unref(link.media);
- if (link.type != NULL)
- lwc_string_unref(link.type);
- if (link.hreflang != NULL)
- lwc_string_unref(link.hreflang);
-
- nsurl_unref(link.href);
- lwc_string_unref(link.rel);
-
- return true;
-}
-
-/** process title node */
-static bool html_process_title(html_content *c, dom_node *node)
-{
- dom_exception exc; /* returned by libdom functions */
- dom_string *title;
- char *title_str;
- bool success;
-
- if (c->base.title != NULL)
- return true;
-
- exc = dom_node_get_text_content(node, &title);
- if ((exc != DOM_NO_ERR) || (title == NULL)) {
- return false;
- }
-
- title_str = squash_whitespace(dom_string_data(title));
- dom_string_unref(title);
-
- if (title_str == NULL) {
- return false;
- }
-
- success = content__set_title(&c->base, title_str);
-
- free(title_str);
-
- return success;
-}
-
-static bool html_process_base(html_content *c, dom_node *node)
-{
- dom_exception exc; /* returned by libdom functions */
- dom_string *atr_string;
-
- /* get href attribute if present */
- exc = dom_element_get_attribute(node,
- corestring_dom_href, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- nsurl *url;
- nserror error;
-
- /* get url from string */
- error = nsurl_create(dom_string_data(atr_string), &url);
- dom_string_unref(atr_string);
- if (error == NSERROR_OK) {
- if (c->base_url != NULL)
- nsurl_unref(c->base_url);
- c->base_url = url;
- }
- }
-
-
- /* get target attribute if present and not already set */
- if (c->base_target != NULL) {
- return true;
- }
-
- exc = dom_element_get_attribute(node,
- corestring_dom_target, &atr_string);
- if ((exc == DOM_NO_ERR) && (atr_string != NULL)) {
- /* Validation rules from the HTML5 spec for the base element:
- * The target must be one of _blank, _self, _parent, or
- * _top or any identifier which does not begin with an
- * underscore
- */
- if (*dom_string_data(atr_string) != '_' ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__blank) ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__self) ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__parent) ||
- dom_string_caseless_lwc_isequal(atr_string,
- corestring_lwc__top)) {
- c->base_target = strdup(dom_string_data(atr_string));
- }
- dom_string_unref(atr_string);
- }
-
- return true;
-}
-
-/**
- * Process elements in <head>.
- *
- * \param c content structure
- * \param head xml node of head element
- * \return true on success, false on memory exhaustion
- *
- * The title and base href are extracted if present.
- */
-
-static nserror html_head(html_content *c, dom_node *head)
-{
- dom_node *node;
- dom_exception exc; /* returned by libdom functions */
- dom_string *node_name;
- dom_node_type node_type;
- dom_node *next_node;
-
- exc = dom_node_get_first_child(head, &node);
- if (exc != DOM_NO_ERR) {
- return NSERROR_DOM;
- }
-
- while (node != NULL) {
- exc = dom_node_get_node_type(node, &node_type);
-
- if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
- exc = dom_node_get_node_name(node, &node_name);
-
- if ((exc == DOM_NO_ERR) && (node_name != NULL)) {
- if (dom_string_caseless_lwc_isequal(
- node_name,
- corestring_lwc_title)) {
- html_process_title(c, node);
- } else if (dom_string_caseless_lwc_isequal(
- node_name,
- corestring_lwc_base)) {
- html_process_base(c, node);
- } else if (dom_string_caseless_lwc_isequal(
- node_name,
- corestring_lwc_link)) {
- html_process_link(c, node);
- }
- }
- if (node_name != NULL) {
- dom_string_unref(node_name);
- }
- }
-
- /* move to next node */
- exc = dom_node_get_next_sibling(node, &next_node);
- dom_node_unref(node);
- if (exc == DOM_NO_ERR) {
- node = next_node;
- } else {
- node = NULL;
- }
- }
-
- return NSERROR_OK;
-}
-
-
-
/**
* Convert a CONTENT_HTML for display.
*
@@ -1069,7 +1025,7 @@ bool html_can_begin_conversion(html_content *htmlc)
bool
html_begin_conversion(html_content *htmlc)
{
- dom_node *html, *head;
+ dom_node *html;
nserror ns_error;
struct form *f;
dom_exception exc; /* returned by libdom functions */
@@ -1141,18 +1097,6 @@ html_begin_conversion(html_content *htmlc)
}
dom_string_unref(node_name);
- head = libdom_find_first_element(html, corestring_lwc_head);
- if (head != NULL) {
- ns_error = html_head(htmlc, head);
- if (ns_error != NSERROR_OK) {
- content_broadcast_errorcode(&htmlc->base, ns_error);
-
- dom_node_unref(html);
- dom_node_unref(head);
- return false;
- }
- }
-
/* Retrieve forms from parser */
htmlc->forms = html_forms_get_forms(htmlc->encoding,
(dom_html_document *) htmlc->document);
@@ -1176,7 +1120,6 @@ html_begin_conversion(html_content *htmlc)
content_broadcast_errorcode(&htmlc->base, ns_error);
dom_node_unref(html);
- dom_node_unref(head);
return false;
}
@@ -1188,7 +1131,6 @@ html_begin_conversion(html_content *htmlc)
NSERROR_NOMEM);
dom_node_unref(html);
- dom_node_unref(head);
return false;
}
@@ -1199,13 +1141,11 @@ html_begin_conversion(html_content *htmlc)
content_broadcast_errorcode(&htmlc->base,
NSERROR_NOMEM);
dom_node_unref(html);
- dom_node_unref(head);
return false;
}
}
}
- dom_node_unref(head);
dom_node_unref(html);
if (htmlc->base.active == 0) {
@@ -1419,6 +1359,12 @@ static void html_destroy(struct content *c)
if (html->document != NULL) {
dom_node_unref(html->document);
+ html->document = NULL;
+ }
+
+ if (html->title != NULL) {
+ dom_node_unref(html->title);
+ html->title = NULL;
}
/* Free base target */
diff --git a/render/html_internal.h b/render/html_internal.h
index 7c30fdd..43fce9b 100644
--- a/render/html_internal.h
+++ b/render/html_internal.h
@@ -93,6 +93,9 @@ typedef struct html_content {
/** Whether a meta refresh has been handled */
bool refresh;
+ /* Title element node */
+ dom_node *title;
+
/** A talloc context purely for the render box tree */
int *bctx;
/** Box tree, or NULL. */
--
NetSurf Browser
10 years