2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2004-02-13 19:09:12 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* 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/>.
|
2003-06-06 06:14:28 +04:00
|
|
|
*/
|
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
/** \file
|
|
|
|
* Option reading and saving (interface).
|
|
|
|
*
|
|
|
|
* Non-platform specific options can be added by editing this file and
|
|
|
|
* netsurf/desktop/options.c
|
|
|
|
*
|
|
|
|
* 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)
|
|
|
|
*/
|
2003-06-02 03:02:56 +04:00
|
|
|
|
|
|
|
#ifndef _NETSURF_DESKTOP_OPTIONS_H_
|
|
|
|
#define _NETSURF_DESKTOP_OPTIONS_H_
|
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
#define _NETSURF_DESKTOP_OPTIONS_INCLUDING_
|
|
|
|
|
2006-07-14 01:52:35 +04:00
|
|
|
#include <stdbool.h>
|
2011-02-21 00:04:53 +03:00
|
|
|
#include <stdio.h>
|
2012-03-22 13:34:34 +04:00
|
|
|
|
2010-12-21 20:00:44 +03:00
|
|
|
#include "desktop/plot_style.h"
|
2012-03-22 13:34:34 +04:00
|
|
|
#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
|
|
|
|
|
|
|
|
#undef _NETSURF_DESKTOP_OPTIONS_INCLUDING_
|
|
|
|
|
2006-07-14 01:52:35 +04:00
|
|
|
|
2011-02-21 00:04:53 +03:00
|
|
|
enum { OPTION_HTTP_PROXY_AUTH_NONE = 0,
|
|
|
|
OPTION_HTTP_PROXY_AUTH_BASIC = 1,
|
|
|
|
OPTION_HTTP_PROXY_AUTH_NTLM = 2 };
|
2004-07-27 19:49:28 +04:00
|
|
|
|
Second merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4195-4211,4216,4219-4220,4222-4234,4236-4250,4252-4262,4264-4266,4268-4326,4329-4335,4338-4342,4344-4411,4413-4420,4422-4436,4438-4491,4494-4506,4508-4514,4516,4518-4552,4554,4556-4564,4567-4568,4570-4574,4576-4686,4689-4692,4694,4698-4709,4715-4723,4725-4755,4757-4769,4771-4919,4921-4996,4998-5110,5112-5117 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4736 | adamblokus | 2008-07-26 13:46:54 +0200 (Sat, 26 Jul 2008) | 2 lines
Sorting out some problems with svn.
........
r4737 | adamblokus | 2008-07-26 13:54:36 +0200 (Sat, 26 Jul 2008) | 4 lines
Added export tab to the options dialog.
Added the possibility of changing some print options.
........
r4897 | adamblokus | 2008-08-04 17:59:05 +0200 (Mon, 04 Aug 2008) | 5 lines
Added checking of horizontal clipping.
Added better table loosening.
Changed some minor bugs.
Applied changes in the Export options tab according to the review from tlsa.
........
r4905 | adamblokus | 2008-08-05 01:53:34 +0200 (Tue, 05 Aug 2008) | 2 lines
Fixed bug which made it impossible to export pdf's.
........
r4919 | adamblokus | 2008-08-05 16:39:33 +0200 (Tue, 05 Aug 2008) | 2 lines
Fixed some memory leaks which caused Netsurf to break.
........
r4927 | adamblokus | 2008-08-06 02:26:30 +0200 (Wed, 06 Aug 2008) | 4 lines
Fixed bug with filenames which crashed Netsurf.
Turned anti aliasing off for printing.
Fixed some scaling issues.
........
r4928 | adamblokus | 2008-08-06 17:52:44 +0200 (Wed, 06 Aug 2008) | 5 lines
Added new export/print options:
- suppressing images
- turning off backgrounds
- toggled loosening
........
r4950 | adamblokus | 2008-08-07 21:15:21 +0200 (Thu, 07 Aug 2008) | 5 lines
Added new options to PDF export:
- document compression
- document encryption
Added PDF password dialog
........
r4954 | adamblokus | 2008-08-07 22:11:31 +0200 (Thu, 07 Aug 2008) | 2 lines
Added saving print settings.
........
r4956 | adamblokus | 2008-08-07 22:44:48 +0200 (Thu, 07 Aug 2008) | 2 lines
Fixes to PDF encryption
........
r4970 | adamblokus | 2008-08-09 15:26:24 +0200 (Sat, 09 Aug 2008) | 3 lines
Fixed bug in plotting tiled bitmaps.
Fixed bug with too long text decorations.
........
r4977 | adamblokus | 2008-08-09 19:18:56 +0200 (Sat, 09 Aug 2008) | 2 lines
Fixed JPG embedding bug.
........
r4988 | adamblokus | 2008-08-10 16:59:51 +0200 (Sun, 10 Aug 2008) | 3 lines
Added clip checking to pdf plotters. No more "blank" clips.
Made PDF compression a default setting.
........
r4995 | adamblokus | 2008-08-10 20:03:00 +0200 (Sun, 10 Aug 2008) | 2 lines
Fixed Haru crash on font-size==0.
........
r4996 | adamblokus | 2008-08-10 21:04:43 +0200 (Sun, 10 Aug 2008) | 2 lines
Added changing text mode only if necessary.
........
r5045 | adamblokus | 2008-08-11 21:26:26 +0200 (Mon, 11 Aug 2008) | 3 lines
Removing gtk stuff from core code.
Little fix in options.
........
r5048 | adamblokus | 2008-08-11 21:57:45 +0200 (Mon, 11 Aug 2008) | 2 lines
Better font size checking in PDF export.
........
r5050 | adamblokus | 2008-08-11 22:19:56 +0200 (Mon, 11 Aug 2008) | 2 lines
Fixed riscos text scale bug.
........
r5073 | adamblokus | 2008-08-12 17:40:57 +0200 (Tue, 12 Aug 2008) | 2 lines
Added missing tooltips
........
r5092 | adamblokus | 2008-08-13 17:09:25 +0200 (Wed, 13 Aug 2008) | 2 lines
Moved /pdf folder to desktop/save_pdf
........
r5110 | adamblokus | 2008-08-13 22:44:50 +0200 (Wed, 13 Aug 2008) | 2 lines
Added comments.
........
r5113 | adamblokus | 2008-08-13 23:07:35 +0200 (Wed, 13 Aug 2008) | 2 lines
Cosmetic changes
........
r5116 | adamblokus | 2008-08-14 16:10:18 +0200 (Thu, 14 Aug 2008) | 2 lines
Fixed bug with BOX_INLINE_END in tree duplication.
........
r5117 | joty | 2008-08-14 21:47:46 +0200 (Thu, 14 Aug 2008) | 1 line
Improvement for r5116: use local vars when possible; rename global last to box_duplicate_last; check on box_duplicate_main_tree failure.
........
svn path=/trunk/netsurf/; revision=5118
2008-08-15 00:32:10 +04:00
|
|
|
#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
|
2012-03-22 13:34:34 +04:00
|
|
|
#ifdef riscos
|
|
|
|
#define DEFAULT_REFLOW_PERIOD 100 /* time in cs */
|
|
|
|
#else
|
|
|
|
#define DEFAULT_REFLOW_PERIOD 25 /* time in cs */
|
|
|
|
#endif
|
Second merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4195-4211,4216,4219-4220,4222-4234,4236-4250,4252-4262,4264-4266,4268-4326,4329-4335,4338-4342,4344-4411,4413-4420,4422-4436,4438-4491,4494-4506,4508-4514,4516,4518-4552,4554,4556-4564,4567-4568,4570-4574,4576-4686,4689-4692,4694,4698-4709,4715-4723,4725-4755,4757-4769,4771-4919,4921-4996,4998-5110,5112-5117 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4736 | adamblokus | 2008-07-26 13:46:54 +0200 (Sat, 26 Jul 2008) | 2 lines
Sorting out some problems with svn.
........
r4737 | adamblokus | 2008-07-26 13:54:36 +0200 (Sat, 26 Jul 2008) | 4 lines
Added export tab to the options dialog.
Added the possibility of changing some print options.
........
r4897 | adamblokus | 2008-08-04 17:59:05 +0200 (Mon, 04 Aug 2008) | 5 lines
Added checking of horizontal clipping.
Added better table loosening.
Changed some minor bugs.
Applied changes in the Export options tab according to the review from tlsa.
........
r4905 | adamblokus | 2008-08-05 01:53:34 +0200 (Tue, 05 Aug 2008) | 2 lines
Fixed bug which made it impossible to export pdf's.
........
r4919 | adamblokus | 2008-08-05 16:39:33 +0200 (Tue, 05 Aug 2008) | 2 lines
Fixed some memory leaks which caused Netsurf to break.
........
r4927 | adamblokus | 2008-08-06 02:26:30 +0200 (Wed, 06 Aug 2008) | 4 lines
Fixed bug with filenames which crashed Netsurf.
Turned anti aliasing off for printing.
Fixed some scaling issues.
........
r4928 | adamblokus | 2008-08-06 17:52:44 +0200 (Wed, 06 Aug 2008) | 5 lines
Added new export/print options:
- suppressing images
- turning off backgrounds
- toggled loosening
........
r4950 | adamblokus | 2008-08-07 21:15:21 +0200 (Thu, 07 Aug 2008) | 5 lines
Added new options to PDF export:
- document compression
- document encryption
Added PDF password dialog
........
r4954 | adamblokus | 2008-08-07 22:11:31 +0200 (Thu, 07 Aug 2008) | 2 lines
Added saving print settings.
........
r4956 | adamblokus | 2008-08-07 22:44:48 +0200 (Thu, 07 Aug 2008) | 2 lines
Fixes to PDF encryption
........
r4970 | adamblokus | 2008-08-09 15:26:24 +0200 (Sat, 09 Aug 2008) | 3 lines
Fixed bug in plotting tiled bitmaps.
Fixed bug with too long text decorations.
........
r4977 | adamblokus | 2008-08-09 19:18:56 +0200 (Sat, 09 Aug 2008) | 2 lines
Fixed JPG embedding bug.
........
r4988 | adamblokus | 2008-08-10 16:59:51 +0200 (Sun, 10 Aug 2008) | 3 lines
Added clip checking to pdf plotters. No more "blank" clips.
Made PDF compression a default setting.
........
r4995 | adamblokus | 2008-08-10 20:03:00 +0200 (Sun, 10 Aug 2008) | 2 lines
Fixed Haru crash on font-size==0.
........
r4996 | adamblokus | 2008-08-10 21:04:43 +0200 (Sun, 10 Aug 2008) | 2 lines
Added changing text mode only if necessary.
........
r5045 | adamblokus | 2008-08-11 21:26:26 +0200 (Mon, 11 Aug 2008) | 3 lines
Removing gtk stuff from core code.
Little fix in options.
........
r5048 | adamblokus | 2008-08-11 21:57:45 +0200 (Mon, 11 Aug 2008) | 2 lines
Better font size checking in PDF export.
........
r5050 | adamblokus | 2008-08-11 22:19:56 +0200 (Mon, 11 Aug 2008) | 2 lines
Fixed riscos text scale bug.
........
r5073 | adamblokus | 2008-08-12 17:40:57 +0200 (Tue, 12 Aug 2008) | 2 lines
Added missing tooltips
........
r5092 | adamblokus | 2008-08-13 17:09:25 +0200 (Wed, 13 Aug 2008) | 2 lines
Moved /pdf folder to desktop/save_pdf
........
r5110 | adamblokus | 2008-08-13 22:44:50 +0200 (Wed, 13 Aug 2008) | 2 lines
Added comments.
........
r5113 | adamblokus | 2008-08-13 23:07:35 +0200 (Wed, 13 Aug 2008) | 2 lines
Cosmetic changes
........
r5116 | adamblokus | 2008-08-14 16:10:18 +0200 (Thu, 14 Aug 2008) | 2 lines
Fixed bug with BOX_INLINE_END in tree duplication.
........
r5117 | joty | 2008-08-14 21:47:46 +0200 (Thu, 14 Aug 2008) | 1 line
Improvement for r5116: use local vars when possible; rename global last to box_duplicate_last; check on box_duplicate_main_tree failure.
........
svn path=/trunk/netsurf/; revision=5118
2008-08-15 00:32:10 +04:00
|
|
|
|
2012-03-22 13:34:34 +04:00
|
|
|
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 == 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; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2011-01-30 16:40:47 +03:00
|
|
|
|
2006-03-14 17:21:01 +03:00
|
|
|
|
2011-02-21 00:04:53 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-03-22 13:34:34 +04:00
|
|
|
void nsoption_read(const char *path);
|
2011-02-21 00:04:53 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save options to a file.
|
|
|
|
*
|
|
|
|
* \param path name of file to write options to
|
|
|
|
*
|
|
|
|
* Errors are ignored.
|
|
|
|
*/
|
2012-03-22 13:34:34 +04:00
|
|
|
void nsoption_write(const char *path);
|
2011-02-21 00:04:53 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dump user options to stream
|
|
|
|
*
|
|
|
|
* \param outf output stream to dump options to.
|
|
|
|
*/
|
2012-03-22 13:34:34 +04:00
|
|
|
void nsoption_dump(FILE *outf);
|
2011-02-21 00:04:53 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
2011-02-21 02:22:31 +03:00
|
|
|
* \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.
|
2011-02-21 00:04:53 +03:00
|
|
|
* \return The number of bytes written to \a string or -1 on error
|
|
|
|
*/
|
2012-03-22 13:34:34 +04:00
|
|
|
int nsoption_snoptionf(char *string, size_t size, unsigned int option,
|
2011-02-21 01:38:43 +03:00
|
|
|
const char *fmt);
|
2003-06-02 03:02:56 +04:00
|
|
|
|
2011-03-19 00:58:29 +03:00
|
|
|
/**
|
|
|
|
* Process commandline and set options approriately.
|
|
|
|
*/
|
2012-03-22 13:34:34 +04:00
|
|
|
void nsoption_commandline(int *pargc, char **argv);
|
2011-03-19 00:58:29 +03:00
|
|
|
|
2003-06-02 03:02:56 +04:00
|
|
|
#endif
|
2011-02-21 01:38:43 +03:00
|
|
|
|