From 1490b52a6b96b6a69a0c4fe9e0515dc717425128 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 22 Mar 2012 09:34:34 +0000 Subject: NetSurf options rework (a=vince r=daniels,jmb) svn path=/trunk/netsurf/; revision=13548 --- atari/ctxmenu.c | 13 +-- atari/download.c | 7 +- atari/font.c | 1 - atari/global_evnt.c | 15 ++-- atari/gui.c | 31 ++++---- atari/hotlist.c | 5 +- atari/options.h | 131 +++++++++++++++--------------- atari/plot.c | 7 +- atari/plot/font_freetype.c | 20 ++--- atari/plot/plotter.h | 2 +- atari/settings.c | 193 ++++++++++++++++++++++++--------------------- atari/system_colour.c | 56 ++++++------- 12 files changed, 249 insertions(+), 232 deletions(-) (limited to 'atari') diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c index 76001ff39..3e481e048 100644 --- a/atari/ctxmenu.c +++ b/atari/ctxmenu.c @@ -44,7 +44,7 @@ #include "atari/browser_win.h" #include "atari/misc.h" #include "atari/clipboard.h" -#include "atari/options.h" +#include "desktop/options.h" #include "atari/res/netsurf.rsh" #include "atari/ctxmenu.h" @@ -245,7 +245,7 @@ void context_popup( struct gui_window * gw, short x, short y ) break; case POP_CTX_VIEW_SOURCE: - if( option_atari_editor != NULL ) { + if( nsoption_charp(atari_editor) != NULL ) { data = content_get_source_data( gw->browser->bw->current_content, &size ); if( size > 0 && data != NULL ){ tempfile = tmpnam( NULL ); @@ -255,11 +255,12 @@ void context_popup( struct gui_window * gw, short x, short y ) fclose( fp_tmpfile ); // TODO: check if app is runnin, if not, use pexec or such. - /*sprintf((char*)&cmdline, "%s \"%s\"", option_atari_editor, tempfile ); - system( (char*)&cmdline ); + /* + sprintf((char*)&cmdline, "%s \"%s\"", nsoption_charp(atari_editor), tempfile ); + system( (char*)&cmdline ); */ - err = ShelWrite( option_atari_editor, tempfile , option_atari_editor, 1, 0); - LOG(("Launched: %s %s (%d)\n", option_atari_editor, tempfile, err )); + err = ShelWrite( nsoption_charp(atari_editor), tempfile , nsoption_charp(atari_editor), 1, 0); + LOG(("Launched: %s %s (%d)\n", nsoption_charp(atari_editor), tempfile, err )); } else { printf("Could not open temp file: %s!\n", tempfile ); } diff --git a/atari/download.c b/atari/download.c index 2af2d707e..e8f916515 100755 --- a/atari/download.c +++ b/atari/download.c @@ -45,7 +45,6 @@ #include "atari/misc.h" #include "atari/res/netsurf.rsh" #include "atari/download.h" -#include "atari/options.h" #include "atari/osspec.h" /*TODO: get filename from core. */ @@ -150,7 +149,7 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, { char *filename; - char *destination; + char *destination; char gdos_path[PATH_MAX]; const char * url; struct gui_download_window * gdw; @@ -168,13 +167,13 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, return( NULL ); } else if( dlgres == 2 ){ - gemdos_realpath(option_downloads_path, gdos_path); + gemdos_realpath(nsoption_charp(downloads_path), gdos_path); char * tmp = select_filepath( gdos_path, filename ); if( tmp == NULL ) return( NULL ); destination = tmp; } else { - gemdos_realpath(option_downloads_path, gdos_path); + gemdos_realpath(nsoption_charp(downloads_path), gdos_path); destination = malloc( strlen(gdos_path)+1 + strlen(filename)+1 ); sprintf( destination, "%s/%s", gdos_path, filename ); diff --git a/atari/font.c b/atari/font.c index 2098055eb..cb47c8ef3 100755 --- a/atari/font.c +++ b/atari/font.c @@ -32,7 +32,6 @@ #include "atari/gui.h" #include "atari/font.h" #include "atari/plot.h" -#include "atari/options.h" #include "atari/findfile.h" #include "atari/gui.h" #include "atari/plot.h" diff --git a/atari/global_evnt.c b/atari/global_evnt.c index 3170b8a9e..3a34a4ac9 100755 --- a/atari/global_evnt.c +++ b/atari/global_evnt.c @@ -46,7 +46,6 @@ #include "atari/browser_win.h" #include "atari/res/netsurf.rsh" #include "atari/search.h" -#include "atari/options.h" #include "atari/findfile.h" #include "atari/settings.h" #include "cflib.h" @@ -280,14 +279,14 @@ static void __CDECL menu_debug_render(WINDOW *win, int item, int title, void *da static void __CDECL menu_fg_images(WINDOW *win, int item, int title, void *data) { - option_foreground_images = !option_foreground_images; - MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (option_foreground_images) ? 1 : 0); + nsoption_set_bool(foreground_images, !nsoption_bool(foreground_images)); + MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (nsoption_bool(foreground_images)) ? 1 : 0); } static void __CDECL menu_bg_images(WINDOW *win, int item, int title, void *data) { - option_background_images = !option_background_images; - MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (option_background_images) ? 1 : 0); + nsoption_set_bool(background_images, !nsoption_bool(background_images)); + MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (nsoption_bool(background_images)) ? 1 : 0); } static void __CDECL menu_back(WINDOW *win, int item, int title, void *data) @@ -326,7 +325,7 @@ static void __CDECL menu_ghistory(WINDOW *win, int item, int title, void *data) LOG(("%s", __FUNCTION__)); char buf[PATH_MAX]; strcpy((char*)&buf, "file://"); - strncat((char*)&buf, option_url_file, PATH_MAX - (strlen("file://")+1) ); + strncat((char*)&buf, nsoption_charp(url_file), PATH_MAX - (strlen("file://")+1) ); browser_window_create((char*)&buf, 0, 0, true, false); } @@ -678,8 +677,8 @@ static void set_menu_title(int rid, const char * nsid) void main_menu_update( void ) { MenuIcheck( NULL, MAINMENU_M_DEBUG_RENDER, (html_redraw_debug) ? 1 : 0); - MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (option_foreground_images) ? 1 : 0); - MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (option_background_images) ? 1 : 0); + MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (nsoption_bool(foreground_images)) ? 1 : 0); + MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (nsoption_bool(background_images)) ? 1 : 0); } diff --git a/atari/gui.c b/atari/gui.c index f2b6d064f..37d09f37e 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -56,7 +56,6 @@ #include "utils/utils.h" #include "atari/gui.h" -#include "atari/options.h" #include "atari/misc.h" #include "atari/findfile.h" #include "atari/schedule.h" @@ -824,8 +823,8 @@ void gui_quit(void) hotlist_destroy(); - urldb_save_cookies(option_cookie_file); - urldb_save(option_url_file); + urldb_save_cookies(nsoption_charp(cookie_file)); + urldb_save(nsoption_charp(url_file)); RsrcXtype( 0, rsc_trindex, rsc_ntree); unbind_global_events(); @@ -852,9 +851,9 @@ process_cmdline(int argc, char** argv) LOG(("argc %d, argv %p", argc, argv)); - if ((option_window_width != 0) && (option_window_height != 0)) { - cfg_width = option_window_width; - cfg_height = option_window_height; + if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) { + cfg_width = nsoption_int(window_width); + cfg_height = nsoption_int(window_height); } else { if( sys_type() == SYS_TOS ){ /* on single tasking OS, start as fulled window: */ @@ -866,8 +865,8 @@ process_cmdline(int argc, char** argv) } } - if (option_homepage_url != NULL && option_homepage_url[0] != '\0') - cfg_homepage_url = option_homepage_url; + if (nsoption_charp(homepage_url) != NULL) + cfg_homepage_url = nsoption_charp(homepage_url); else cfg_homepage_url = NETSURF_HOMEPAGE; @@ -964,21 +963,21 @@ static void gui_init(int argc, char** argv) cursors, &gem_cursors.help); LOG(("Enabling core select menu")); - option_core_select_menu = true; + nsoption_set_bool(core_select_menu, true); - if( strlen(option_url_file) ){ - urldb_load(option_url_file); + if( strlen(nsoption_charp(url_file)) ){ + urldb_load(nsoption_charp(url_file)); } - if( strlen(option_cookie_file) ){ - urldb_load_cookies(option_cookie_file); - LOG(("Loading cookies from: %s", option_cookie_file )); + if( strlen(nsoption_charp(cookie_file)) ){ + urldb_load_cookies(nsoption_charp(cookie_file)); + LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) )); } if (process_cmdline(argc,argv) != true) die("unable to process command line.\n"); nkc_init(); - atari_plotter_init( option_atari_screen_driver, option_atari_font_driver ); + atari_plotter_init( nsoption_charp(atari_screen_driver), nsoption_charp(atari_font_driver) ); } static char *theapp = (char*)"NetSurf"; @@ -990,7 +989,7 @@ static void gui_init2(int argc, char** argv) if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) { menu_register( _AESapid, (char*)" NetSurf "); } - tree_set_icon_dir( option_tree_icons_path ); + tree_set_icon_dir( nsoption_charp(tree_icons_path) ); hotlist_init(); } diff --git a/atari/hotlist.c b/atari/hotlist.c index 067d9c123..89c06c7fc 100755 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -41,7 +41,6 @@ #include "atari/hotlist.h" #include "atari/findfile.h" #include "atari/res/netsurf.rsh" -#include "atari/options.h" struct atari_hotlist hl; @@ -86,10 +85,10 @@ static void __CDECL evnt_hl_mbutton( WINDOW *win, short buff[8] ) void hotlist_init(void) { - if( strcmp(option_hotlist_file, "") == 0 ){ + if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){ atari_find_resource( (char*)&hl.path, "hotlist", "hotlist" ); } else { - strncpy( (char*)&hl.path, option_hotlist_file, PATH_MAX-1 ); + strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 ); } LOG(("Hotlist: %s", (char*)&hl.path )); diff --git a/atari/options.h b/atari/options.h index e2bfc35f8..6da17cbd9 100755 --- a/atari/options.h +++ b/atari/options.h @@ -16,74 +16,79 @@ * along with this program. If not, see . */ +#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_ +#error "Frontend options header cannot be included directly" +#endif + #ifndef NS_ATARI_OPTIONS_H_ #define NS_ATARI_OPTIONS_H_ -#include "desktop/options.h" -extern char * option_atari_screen_driver; -extern char * option_atari_font_driver; -extern int option_atari_font_monochrom; -extern int option_atari_dither; -extern int option_atari_transparency; -extern char *option_atari_face_sans_serif; /* default sans face */ -extern char *option_atari_face_sans_serif_bold; /* bold sans face */ -extern char *option_atari_face_sans_serif_italic; /* bold sans face */ -extern char *option_atari_face_sans_serif_italic_bold; /* bold sans face */ -extern char *option_atari_face_monospace; /* monospace face */ -extern char *option_atari_face_monospace_bold; /* monospace face */ -extern char *option_atari_face_serif; /* serif face */ -extern char *option_atari_face_serif_bold; /* bold serif face */ -extern char *option_atari_face_cursive; -extern char *option_atari_face_fantasy; -extern char *option_atari_editor; -extern char *option_downloads_path; -extern char *option_url_file; -extern char *option_hotlist_file; -extern char *option_tree_icons_path; +#define NSOPTION_EXTRA_DEFINE \ + char *atari_screen_driver; \ + 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_screen_driver = (char*)"vdi", \ + .atari_font_driver = (char*)"vdi", \ + .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*)"", \ + .url_file = (char*)"url.db", \ + .hotlist_file = (char*)"hotlist", \ + .tree_icons_path = (char*)"./res/icons" -#define EXTRA_OPTION_DEFINE \ -char * option_atari_screen_driver = (char*)"vdi";\ -char * option_atari_font_driver = (char*)"vdi";\ -int option_atari_font_monochrom = 0;\ -int option_atari_dither = 1;\ -int option_atari_transparency = 1;\ -char *option_atari_face_sans_serif;\ -char *option_atari_face_sans_serif_bold;\ -char *option_atari_face_sans_serif_italic;\ -char *option_atari_face_sans_serif_italic_bold;\ -char *option_atari_face_monospace;\ -char *option_atari_face_monospace_bold;\ -char *option_atari_face_serif;\ -char *option_atari_face_serif_bold;\ -char *option_atari_face_cursive; \ -char *option_atari_face_fantasy; \ -char *option_atari_editor = (char*)"";\ -char *option_downloads_path = (char*)""; \ -char *option_url_file = (char*)"url.db";\ -char *option_hotlist_file = (char*)"hotlist";\ -char *option_tree_icons_path = (char*)"./res/icons"; +#define NSOPTION_EXTRA_TABLE \ + { "atari_screen_driver", OPTION_STRING, &nsoptions.atari_screen_driver },\ + { "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 } -#define EXTRA_OPTION_TABLE \ - { "atari_screen_driver", OPTION_STRING, &option_atari_screen_driver },\ - { "atari_font_driver", OPTION_STRING, &option_atari_font_driver },\ - { "atari_font_monochrom", OPTION_INTEGER, &option_atari_font_monochrom },\ - { "atari_transparency", OPTION_INTEGER, &option_atari_transparency },\ - { "atari_dither", OPTION_INTEGER, &option_atari_dither },\ - { "atari_editor", OPTION_STRING, &option_atari_editor },\ - { "font_face_sans_serif", OPTION_STRING, &option_atari_face_sans_serif },\ - { "font_face_sans_serif_bold", OPTION_STRING, &option_atari_face_sans_serif_bold },\ - { "font_face_sans_serif_italic", OPTION_STRING, &option_atari_face_sans_serif_italic },\ - { "font_face_sans_serif_italic_bold", OPTION_STRING, &option_atari_face_sans_serif_italic_bold },\ - { "font_face_monospace", OPTION_STRING, &option_atari_face_monospace },\ - { "font_face_monospace_bold", OPTION_STRING, &option_atari_face_monospace_bold },\ - { "font_face_serif", OPTION_STRING, &option_atari_face_serif },\ - { "font_face_serif_bold", OPTION_STRING, &option_atari_face_serif_bold },\ - { "font_face_cursive", OPTION_STRING, &option_atari_face_cursive },\ - { "font_face_fantasy", OPTION_STRING, &option_atari_face_fantasy },\ - { "downloads_path", OPTION_STRING, &option_downloads_path },\ - { "url_file", OPTION_STRING, &option_url_file },\ - { "hotlist_file", OPTION_STRING, &option_hotlist_file },\ - { "tree_icons_path", OPTION_STRING, &option_tree_icons_path } #endif diff --git a/atari/plot.c b/atari/plot.c index 25e433e13..1ce08a7e8 100755 --- a/atari/plot.c +++ b/atari/plot.c @@ -34,7 +34,6 @@ #include "atari/bitmap.h" #include "atari/gui.h" #include "atari/plot.h" -#include "atari/options.h" #include "desktop/options.h" #include "atari/plot.h" @@ -57,11 +56,11 @@ int atari_plotter_init( char* drvrname, char * fdrvrname ) int flags = 0; unsigned long font_flags = 0; - if( option_atari_dither == 1) + if( nsoption_int(atari_dither) == 1) flags |= PLOT_FLAG_DITHER; - if( option_atari_transparency == 1 ) + if( nsoption_int(atari_transparency) == 1 ) flags |= PLOT_FLAG_TRANS; - if( option_atari_font_monochrom == 1 ) + if( nsoption_int(atari_font_monochrom) == 1 ) font_flags |= FONTPLOT_FLAG_MONOGLYPH; vdih = app.graf.handle; diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c index e62263ec7..551302e79 100755 --- a/atari/plot/font_freetype.c +++ b/atari/plot/font_freetype.c @@ -223,7 +223,7 @@ static bool ft_font_init(void) font_faces[FONT_FACE_SANS_SERIF] = NULL; font_faces[FONT_FACE_SANS_SERIF] = ft_new_face( - option_atari_face_sans_serif, + nsoption_charp(atari_face_sans_serif), "fonts/ss.ttf", DEJAVU_PATH"DejaVuSans.ttf" ); @@ -235,47 +235,47 @@ static bool ft_font_init(void) } font_faces[FONT_FACE_SANS_SERIF_BOLD] = - ft_new_face(option_atari_face_sans_serif_bold, + ft_new_face(nsoption_charp(atari_face_sans_serif_bold), "fonts/ssb.ttf", DEJAVU_PATH"DejaVuSans-Bold.ttf"); font_faces[FONT_FACE_SANS_SERIF_ITALIC] = - ft_new_face(option_atari_face_sans_serif_italic, + ft_new_face(nsoption_charp(atari_face_sans_serif_italic), "fonts/ssi.ttf", DEJAVU_PATH"DejaVuSans-Oblique.ttf"); font_faces[FONT_FACE_SANS_SERIF_ITALIC_BOLD] = - ft_new_face(option_atari_face_sans_serif_italic_bold, + ft_new_face(nsoption_charp(atari_face_sans_serif_italic_bold), "fonts/ssib.ttf", DEJAVU_PATH"DejaVuSans-BoldOblique.ttf"); font_faces[FONT_FACE_MONOSPACE] = - ft_new_face(option_atari_face_monospace, + ft_new_face(nsoption_charp(atari_face_monospace), "fonts/mono.ttf", DEJAVU_PATH"DejaVuSansMono.ttf"); font_faces[FONT_FACE_MONOSPACE_BOLD] = - ft_new_face(option_atari_face_monospace_bold, + ft_new_face(nsoption_charp(atari_face_monospace_bold), "fonts/monob.ttf", DEJAVU_PATH"DejaVuSansMono-Bold.ttf"); font_faces[FONT_FACE_SERIF] = - ft_new_face(option_atari_face_serif, + ft_new_face(nsoption_charp(atari_face_serif), "fonts/s.ttf", DEJAVU_PATH"DejaVuSerif.ttf"); font_faces[FONT_FACE_SERIF_BOLD] = - ft_new_face(option_atari_face_serif_bold, + ft_new_face(nsoption_charp(atari_face_serif_bold), "fonts/sb.ttf", DEJAVU_PATH"DejaVuSerif-Bold.ttf"); font_faces[FONT_FACE_CURSIVE] = - ft_new_face(option_atari_face_cursive, + ft_new_face(nsoption_charp(atari_face_cursive), "fonts/cursive.ttf", DEJAVU_PATH"DejaVuSansMono-Oblique.ttf"); font_faces[FONT_FACE_FANTASY] = - ft_new_face(option_atari_face_fantasy, + ft_new_face(nsoption_charp(atari_face_fantasy), "fonts/fantasy.ttf", DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf"); diff --git a/atari/plot/plotter.h b/atari/plot/plotter.h index ebaaec826..9ec4d2d64 100755 --- a/atari/plot/plotter.h +++ b/atari/plot/plotter.h @@ -32,7 +32,7 @@ #include "atari/osspec.h" #include "atari/gui.h" #include "atari/font.h" -#include "atari/options.h" +#include "desktop/options.h" #include "atari/findfile.h" #include "utils/utf8.h" #include "utils/log.h" diff --git a/atari/settings.c b/atari/settings.c index fa7c2d219..661ac0902 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -13,7 +13,6 @@ #include "atari/settings.h" #include "atari/global_evnt.h" #include "atari/misc.h" -#include "atari/options.h" extern char options[PATH_MAX]; @@ -193,8 +192,8 @@ saveform( WINDOW *win, int index, int unused, void *unused2) { apply_settings(); // Save settings - options_write( (const char*)&options ); - options_read( (const char*)&options ); + nsoption_write( (const char*)&options ); + nsoption_read( (const char*)&options ); close_settings(); ObjcChange( OC_FORM, win, index, NORMAL, TRUE); form_alert(1, "[1][Some options require an netsurf restart!][OK]"); @@ -479,111 +478,111 @@ static void display_settings( void ) // read current settings and display them /* "Browser" tab: */ - set_text( CHOICES_EDIT_HOMEPAGE, option_homepage_url, + set_text( CHOICES_EDIT_HOMEPAGE, nsoption_charp(homepage_url), INPUT_HOMEPAGE_URL_MAX_LEN ); - if( option_block_ads ){ + if( nsoption_bool(block_ads) ){ OBJ_CHECK( CHOICES_CB_HIDE_ADVERTISEMENT ); } else { OBJ_UNCHECK( CHOICES_CB_HIDE_ADVERTISEMENT ); } - if( option_target_blank ){ + if( nsoption_bool(target_blank) ){ OBJ_UNCHECK( CHOICES_CB_DISABLE_POPUP_WINDOWS ); } else { OBJ_CHECK( CHOICES_CB_DISABLE_POPUP_WINDOWS ); } - if( option_send_referer ){ + if( nsoption_bool(send_referer) ){ OBJ_CHECK( CHOICES_CB_SEND_HTTP_REFERRER ); } else { OBJ_UNCHECK( CHOICES_CB_SEND_HTTP_REFERRER ); } set_text( CHOICES_BT_SEL_LOCALE, - option_accept_language ? option_accept_language : (char*)"en", + nsoption_charp(accept_language) ? nsoption_charp(accept_language) : (char*)"en", INPUT_LOCALE_MAX_LEN ); - tmp_option_expire_url = option_expire_url; - sprintf( spare, "%02d", option_expire_url ); + tmp_option_expire_url = nsoption_int(expire_url); + sprintf( spare, "%02d", nsoption_int(expire_url) ); set_text( CHOICES_EDIT_HISTORY_AGE, spare, 2 ); /* "Cache" tab: */ - tmp_option_memory_cache_size = option_memory_cache_size / 100000; + tmp_option_memory_cache_size = nsoption_int(memory_cache_size) / 100000; sprintf( spare, "%03.1f", tmp_option_memory_cache_size ); set_text( CHOICES_STR_MAX_MEM_CACHE, spare, 5 ); /* "Paths" tab: */ - set_text( CHOICES_EDIT_DOWNLOAD_PATH, option_downloads_path, + set_text( CHOICES_EDIT_DOWNLOAD_PATH, nsoption_charp(downloads_path), LABEL_PATH_MAX_LEN ); - set_text( CHOICES_EDIT_HOTLIST_FILE, option_hotlist_file, + set_text( CHOICES_EDIT_HOTLIST_FILE, nsoption_charp(hotlist_file), LABEL_PATH_MAX_LEN ); - set_text( CHOICES_EDIT_CA_BUNDLE, option_ca_bundle, + set_text( CHOICES_EDIT_CA_BUNDLE, nsoption_charp(ca_bundle), LABEL_PATH_MAX_LEN ); - set_text( CHOICES_EDIT_CA_CERTS_PATH, option_ca_path, + set_text( CHOICES_EDIT_CA_CERTS_PATH, nsoption_charp(ca_path), LABEL_PATH_MAX_LEN ); - set_text( CHOICES_EDIT_EDITOR, option_atari_editor, + set_text( CHOICES_EDIT_EDITOR, nsoption_charp(atari_editor), LABEL_PATH_MAX_LEN ); /* "Rendering" tab: */ - set_text( CHOICES_BT_SEL_FONT_RENDERER, option_atari_font_driver, + set_text( CHOICES_BT_SEL_FONT_RENDERER, nsoption_charp(atari_font_driver), LABEL_FONT_RENDERER_MAX_LEN ); SET_BIT(dlgtree[CHOICES_CB_TRANSPARENCY].ob_state, - SELECTED, option_atari_transparency ? 1 : 0 ); + SELECTED, nsoption_int(atari_transparency) ? 1 : 0 ); SET_BIT(dlgtree[CHOICES_CB_ENABLE_ANIMATION].ob_state, - SELECTED, option_animate_images ? 1 : 0 ); + SELECTED, nsoption_bool(animate_images) ? 1 : 0 ); SET_BIT(dlgtree[CHOICES_CB_INCREMENTAL_REFLOW].ob_state, - SELECTED, option_incremental_reflow ? 1 : 0 ); + SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 ); SET_BIT(dlgtree[CHOICES_CB_ANTI_ALIASING].ob_state, - SELECTED, option_atari_font_monochrom ? 0 : 1 ); + SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 ); - tmp_option_min_reflow_period = option_min_reflow_period; + tmp_option_min_reflow_period = nsoption_int(min_reflow_period); sprintf( spare, "%04d", tmp_option_min_reflow_period ); set_text( CHOICES_EDIT_MIN_REFLOW_PERIOD, spare, INPUT_MIN_REFLOW_PERIOD_MAX_LEN ); - tmp_option_minimum_gif_delay = (float)option_minimum_gif_delay / (float)100; + tmp_option_minimum_gif_delay = (float)nsoption_int(minimum_gif_delay) / (float)100; sprintf( spare, "%01.1f", tmp_option_minimum_gif_delay ); set_text( CHOICES_EDIT_MIN_GIF_DELAY, spare, 3 ); /* "Network" tab: */ - set_text( CHOICES_EDIT_PROXY_HOST, option_http_proxy_host, + set_text( CHOICES_EDIT_PROXY_HOST, nsoption_charp(http_proxy_host), INPUT_PROXY_HOST_MAX_LEN ); - sprintf( spare, "%5d", option_http_proxy_port ); + sprintf( spare, "%5d", nsoption_int(http_proxy_port) ); set_text( CHOICES_EDIT_PROXY_PORT, spare, INPUT_PROXY_PORT_MAX_LEN ); - set_text( CHOICES_EDIT_PROXY_USERNAME, option_http_proxy_auth_user, + set_text( CHOICES_EDIT_PROXY_USERNAME, nsoption_charp(http_proxy_auth_user), INPUT_PROXY_USERNAME_MAX_LEN ); - set_text( CHOICES_EDIT_PROXY_PASSWORD, option_http_proxy_auth_pass, + set_text( CHOICES_EDIT_PROXY_PASSWORD, nsoption_charp(http_proxy_auth_pass), INPUT_PROXY_PASSWORD_MAX_LEN ); SET_BIT(dlgtree[CHOICES_CB_USE_PROXY].ob_state, - SELECTED, option_http_proxy ? 1 : 0 ); + SELECTED, nsoption_bool(http_proxy) ? 1 : 0 ); SET_BIT(dlgtree[CHOICES_CB_PROXY_AUTH].ob_state, - SELECTED, option_http_proxy_auth ? 1 : 0 ); + SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 ); SET_BIT(dlgtree[CHOICES_CB_FG_IMAGES].ob_state, - SELECTED, option_foreground_images ? 1 : 0 ); + SELECTED, nsoption_bool(foreground_images) ? 1 : 0 ); SET_BIT(dlgtree[CHOICES_CB_BG_IMAGES].ob_state, - SELECTED, option_background_images ? 1 : 0 ); + SELECTED, nsoption_bool(background_images) ? 1 : 0 ); - tmp_option_max_cached_fetch_handles = option_max_cached_fetch_handles; - sprintf( spare, "%2d", option_max_cached_fetch_handles ); + tmp_option_max_cached_fetch_handles = nsoption_int(max_cached_fetch_handles); + sprintf( spare, "%2d", nsoption_int(max_cached_fetch_handles) ); set_text( CHOICES_EDIT_MAX_CACHED_CONNECTIONS, spare , 2 ); - tmp_option_max_fetchers = option_max_fetchers; - sprintf( spare, "%2d", option_max_fetchers ); + tmp_option_max_fetchers = nsoption_int(max_fetchers); + sprintf( spare, "%2d", nsoption_int(max_fetchers) ); set_text( CHOICES_EDIT_MAX_FETCHERS, spare , 2 ); - tmp_option_max_fetchers_per_host = option_max_fetchers_per_host; - sprintf( spare, "%2d", option_max_fetchers_per_host ); + tmp_option_max_fetchers_per_host = nsoption_int(max_fetchers_per_host); + sprintf( spare, "%2d", nsoption_int(max_fetchers_per_host) ); set_text( CHOICES_EDIT_MAX_FETCHERS_PER_HOST, spare , 2 ); /* "Style" tab: */ - tmp_option_font_min_size = option_font_min_size; - sprintf( spare, "%3d", option_font_min_size ); + tmp_option_font_min_size = nsoption_int(font_min_size); + sprintf( spare, "%3d", nsoption_int(font_min_size) ); set_text( CHOICES_EDIT_MIN_FONT_SIZE, spare , 3 ); - tmp_option_font_size = option_font_size; - sprintf( spare, "%3d", option_font_size ); + tmp_option_font_size = nsoption_int(font_size); + sprintf( spare, "%3d", nsoption_int(font_size) ); set_text( CHOICES_EDIT_DEF_FONT_SIZE, spare , 3 ); /* Only first tab is refreshed: */ @@ -595,64 +594,82 @@ static void display_settings( void ) static void apply_settings( void ) { - - /* "Network" tab: */ - option_http_proxy = OBJ_SELECTED(CHOICES_CB_USE_PROXY); - if( OBJ_SELECTED(CHOICES_CB_PROXY_AUTH) ) - option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_BASIC; - else - option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE; - option_http_proxy_auth_pass = - ObjcString( dlgtree, CHOICES_EDIT_PROXY_PASSWORD, NULL); - option_http_proxy_auth_user = - ObjcString( dlgtree, CHOICES_EDIT_PROXY_USERNAME, NULL); - option_http_proxy_host = - ObjcString( dlgtree, CHOICES_EDIT_PROXY_HOST, NULL); - option_http_proxy_port = - atoi( ObjcString( dlgtree, CHOICES_EDIT_PROXY_PORT, NULL) ); - option_max_fetchers_per_host = - atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_FETCHERS_PER_HOST, NULL)); - option_max_cached_fetch_handles = - atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_CACHED_CONNECTIONS, NULL)); - option_max_fetchers = - atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_FETCHERS, NULL) ); - option_foreground_images = OBJ_SELECTED( CHOICES_CB_FG_IMAGES ); - option_background_images = OBJ_SELECTED( CHOICES_CB_BG_IMAGES ); + nsoption_set_bool(http_proxy, OBJ_SELECTED(CHOICES_CB_USE_PROXY)); + if ( OBJ_SELECTED(CHOICES_CB_PROXY_AUTH) ) { + nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_BASIC); + } else { + nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE); + } + nsoption_set_charp(http_proxy_auth_pass, + ObjcString( dlgtree, CHOICES_EDIT_PROXY_PASSWORD, NULL)); + nsoption_set_charp(http_proxy_auth_user, + ObjcString( dlgtree, CHOICES_EDIT_PROXY_USERNAME, NULL)); + nsoption_set_charp(http_proxy_host, + ObjcString( dlgtree, CHOICES_EDIT_PROXY_HOST, NULL)); + nsoption_set_int(http_proxy_port, + atoi( ObjcString( dlgtree, CHOICES_EDIT_PROXY_PORT, NULL) )); + nsoption_set_int(max_fetchers_per_host, + atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_FETCHERS_PER_HOST, NULL))); + nsoption_set_int(max_cached_fetch_handles, + atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_CACHED_CONNECTIONS, NULL))); + nsoption_set_int(max_fetchers, + atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_FETCHERS, NULL) )); + nsoption_set_bool(foreground_images, + OBJ_SELECTED( CHOICES_CB_FG_IMAGES )); + nsoption_set_bool(background_images, + OBJ_SELECTED( CHOICES_CB_BG_IMAGES )); /* "Style" tab: */ - option_font_min_size = tmp_option_font_min_size; - option_font_size = tmp_option_font_size; + nsoption_set_int(font_min_size, tmp_option_font_min_size); + nsoption_set_int(font_size, tmp_option_font_size); /* "Rendering" tab: */ - option_atari_font_driver = ObjcString( dlgtree, - CHOICES_BT_SEL_FONT_RENDERER, NULL); - option_atari_transparency = OBJ_SELECTED(CHOICES_CB_TRANSPARENCY); - option_animate_images = OBJ_SELECTED(CHOICES_CB_ENABLE_ANIMATION); - option_minimum_gif_delay = (int)(tmp_option_minimum_gif_delay*100+0.5); - option_incremental_reflow = OBJ_SELECTED(CHOICES_CB_INCREMENTAL_REFLOW); - option_min_reflow_period = tmp_option_min_reflow_period; - option_atari_font_monochrom = !OBJ_SELECTED( CHOICES_CB_ANTI_ALIASING ); + nsoption_set_charp(atari_font_driver, + ObjcString( dlgtree, CHOICES_BT_SEL_FONT_RENDERER, NULL)); + nsoption_set_bool(atari_transparency, + OBJ_SELECTED(CHOICES_CB_TRANSPARENCY)); + nsoption_set_bool(animate_images, + OBJ_SELECTED(CHOICES_CB_ENABLE_ANIMATION)); + nsoption_set_int(minimum_gif_delay, + (int)(tmp_option_minimum_gif_delay*100+0.5)); + nsoption_set_bool(incremental_reflow, + OBJ_SELECTED(CHOICES_CB_INCREMENTAL_REFLOW)); + nsoption_set_int(min_reflow_period, tmp_option_min_reflow_period); + nsoption_set_int(atari_font_monochrom, + !OBJ_SELECTED( CHOICES_CB_ANTI_ALIASING )); /* "Paths" tabs: */ - option_ca_bundle = ObjcString( dlgtree, CHOICES_EDIT_CA_BUNDLE, NULL); - option_ca_path = ObjcString( dlgtree, CHOICES_EDIT_CA_CERTS_PATH, NULL); - option_homepage_url = ObjcString( dlgtree, CHOICES_EDIT_CA_CERTS_PATH, NULL); - option_hotlist_file = ObjcString( dlgtree, CHOICES_EDIT_HOTLIST_FILE, NULL); - option_atari_editor = ObjcString( dlgtree, CHOICES_EDIT_EDITOR, NULL); - option_downloads_path = ObjcString( dlgtree, CHOICES_EDIT_DOWNLOAD_PATH, NULL); + nsoption_set_charp(ca_bundle, + ObjcString( dlgtree, CHOICES_EDIT_CA_BUNDLE, NULL)); + nsoption_set_charp(ca_path, + ObjcString( dlgtree, CHOICES_EDIT_CA_CERTS_PATH, NULL)); + nsoption_set_charp(homepage_url, + ObjcString( dlgtree, CHOICES_EDIT_CA_CERTS_PATH, NULL)); + nsoption_set_charp(hotlist_file, + ObjcString( dlgtree, CHOICES_EDIT_HOTLIST_FILE, NULL)); + nsoption_set_charp(atari_editor, + ObjcString( dlgtree, CHOICES_EDIT_EDITOR, NULL)); + nsoption_set_charp(downloads_path, + ObjcString( dlgtree, CHOICES_EDIT_DOWNLOAD_PATH, NULL)); /* "Cache" tab: */ - option_memory_cache_size = tmp_option_memory_cache_size * 100000; + nsoption_set_int(memory_cache_size, + tmp_option_memory_cache_size * 100000); /* "Browser" tab: */ - option_target_blank = !OBJ_SELECTED(CHOICES_CB_DISABLE_POPUP_WINDOWS); - option_block_ads = OBJ_SELECTED(CHOICES_CB_HIDE_ADVERTISEMENT); - option_accept_language = ObjcString( dlgtree, CHOICES_BT_SEL_LOCALE, NULL); - option_expire_url = atoi(ObjcString( dlgtree, CHOICES_EDIT_HISTORY_AGE, - NULL)); - option_send_referer = OBJ_SELECTED(CHOICES_CB_SEND_HTTP_REFERRER); - option_homepage_url = ObjcString( dlgtree, CHOICES_EDIT_HOMEPAGE, NULL); + nsoption_set_bool(target_blank, + !OBJ_SELECTED(CHOICES_CB_DISABLE_POPUP_WINDOWS)); + nsoption_set_bool(block_ads, + OBJ_SELECTED(CHOICES_CB_HIDE_ADVERTISEMENT)); + nsoption_set_charp(accept_language, + ObjcString( dlgtree, CHOICES_BT_SEL_LOCALE, NULL)); + nsoption_set_int(expire_url, + atoi(ObjcString( dlgtree, CHOICES_EDIT_HISTORY_AGE, NULL))); + nsoption_set_bool(send_referer, + OBJ_SELECTED(CHOICES_CB_SEND_HTTP_REFERRER)); + nsoption_set_charp(homepage_url, + ObjcString( dlgtree, CHOICES_EDIT_HOMEPAGE, NULL)); } #undef OBJ_SELECTED diff --git a/atari/system_colour.c b/atari/system_colour.c index 69ce5a88c..c0c125b9b 100644 --- a/atari/system_colour.c +++ b/atari/system_colour.c @@ -44,170 +44,170 @@ static struct gui_system_colour_ctx colour_list[] = { "ActiveBorder", SLEN("ActiveBorder"), 0xff000000, - &option_sys_colour_ActiveBorder, + &nsoption_colour(sys_colour_ActiveBorder), NULL }, { "ActiveCaption", SLEN("ActiveCaption"), 0xffdddddd, - &option_sys_colour_ActiveCaption, + &nsoption_colour(sys_colour_ActiveCaption), NULL }, { "AppWorkspace", SLEN("AppWorkspace"), 0xffeeeeee, - &option_sys_colour_AppWorkspace, + &nsoption_colour(sys_colour_AppWorkspace), NULL }, { "Background", SLEN("Background"), 0xff0000aa, - &option_sys_colour_Background, + &nsoption_colour(sys_colour_Background), NULL }, { "ButtonFace", SLEN("ButtonFace"), 0xffaaaaaa, - &option_sys_colour_ButtonFace, + &nsoption_colour(sys_colour_ButtonFace), NULL }, { "ButtonHighlight", SLEN("ButtonHighlight"), 0xffdddddd, - &option_sys_colour_ButtonHighlight, + &nsoption_colour(sys_colour_ButtonHighlight), NULL }, { "ButtonShadow", SLEN("ButtonShadow"), 0xffbbbbbb, - &option_sys_colour_ButtonShadow, + &nsoption_colour(sys_colour_ButtonShadow), NULL }, { "ButtonText", SLEN("ButtonText"), 0xff000000, - &option_sys_colour_ButtonText, + &nsoption_colour(sys_colour_ButtonText), NULL }, { "CaptionText", SLEN("CaptionText"), 0xff000000, - &option_sys_colour_CaptionText, + &nsoption_colour(sys_colour_CaptionText), NULL }, { "GrayText", SLEN("GrayText"), 0xffcccccc, - &option_sys_colour_GrayText, + &nsoption_colour(sys_colour_GrayText), NULL }, { "Highlight", SLEN("Highlight"), 0xff0000ee, - &option_sys_colour_Highlight, + &nsoption_colour(sys_colour_Highlight), NULL }, { "HighlightText", SLEN("HighlightText"), 0xff000000, - &option_sys_colour_HighlightText, + &nsoption_colour(sys_colour_HighlightText), NULL }, { "InactiveBorder", SLEN("InactiveBorder"), 0xffffffff, - &option_sys_colour_InactiveBorder, + &nsoption_colour(sys_colour_InactiveBorder), NULL }, { "InactiveCaption", SLEN("InactiveCaption"), 0xffffffff, - &option_sys_colour_InactiveCaption, + &nsoption_colour(sys_colour_InactiveCaption), NULL }, { "InactiveCaptionText", SLEN("InactiveCaptionText"), 0xffcccccc, - &option_sys_colour_InactiveCaptionText, + &nsoption_colour(sys_colour_InactiveCaptionText), NULL }, { "InfoBackground", SLEN("InfoBackground"), 0xffaaaaaa, - &option_sys_colour_InfoBackground, + &nsoption_colour(sys_colour_InfoBackground), NULL }, { "InfoText", SLEN("InfoText"), 0xff000000, - &option_sys_colour_InfoText, + &nsoption_colour(sys_colour_InfoText), NULL }, { "Menu", SLEN("Menu"), 0xffaaaaaa, - &option_sys_colour_Menu, + &nsoption_colour(sys_colour_Menu), NULL }, { "MenuText", SLEN("MenuText"), 0xff000000, - &option_sys_colour_MenuText, + &nsoption_colour(sys_colour_MenuText), NULL }, { "Scrollbar", SLEN("Scrollbar"), 0xffaaaaaa, - &option_sys_colour_Scrollbar, + &nsoption_colour(sys_colour_Scrollbar), NULL }, { "ThreeDDarkShadow", SLEN("ThreeDDarkShadow"), 0xff555555, - &option_sys_colour_ThreeDDarkShadow, + &nsoption_colour(sys_colour_ThreeDDarkShadow), NULL }, { "ThreeDFace", SLEN("ThreeDFace"), 0xffdddddd, - &option_sys_colour_ThreeDFace, + &nsoption_colour(sys_colour_ThreeDFace), NULL }, { "ThreeDHighlight", SLEN("ThreeDHighlight"), 0xffaaaaaa, - &option_sys_colour_ThreeDHighlight, + &nsoption_colour(sys_colour_ThreeDHighlight), NULL }, { "ThreeDLightShadow", SLEN("ThreeDLightShadow"), 0xff999999, - &option_sys_colour_ThreeDLightShadow, + &nsoption_colour(sys_colour_ThreeDLightShadow), NULL }, { "ThreeDShadow", SLEN("ThreeDShadow"), 0xff777777, - &option_sys_colour_ThreeDShadow, + &nsoption_colour(sys_colour_ThreeDShadow), NULL }, { "Window", SLEN("Window"), 0xffaaaaaa, - &option_sys_colour_Window, + &nsoption_colour(sys_colour_Window), NULL }, { "WindowFrame", SLEN("WindowFrame"), 0xff000000, - &option_sys_colour_WindowFrame, + &nsoption_colour(sys_colour_WindowFrame), NULL }, { "WindowText", SLEN("WindowText"), 0xff000000, - &option_sys_colour_WindowText, + &nsoption_colour(sys_colour_WindowText), NULL }, -- cgit v1.2.3