From fda51d4010ca0a679db810861522ce18203d7ccd Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Thu, 21 Jun 2012 22:57:31 +0000 Subject: Added toolbar image folder option. svn path=/trunk/netsurf/; revision=13982 --- atari/options.h | 47 +++++++++++++++++++++++++---------------------- atari/toolbar.c | 18 ++++++++++++------ 2 files changed, 37 insertions(+), 28 deletions(-) (limited to 'atari') diff --git a/atari/options.h b/atari/options.h index 2ca066384..9b6257d9c 100755 --- a/atari/options.h +++ b/atari/options.h @@ -32,6 +32,7 @@ int atari_transparency; \ int atari_image_toolbar; \ int atari_toolbar_bg; \ + char *atari_image_toolbar_folder; \ 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 */ \ @@ -48,28 +49,29 @@ 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_image_toolbar = 0, \ - .atari_toolbar_bg = 8, \ - .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", \ +#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_image_toolbar_folder = (char*)"default", \ + .atari_image_toolbar = 0, \ + .atari_toolbar_bg = 8, \ + .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 NSOPTION_EXTRA_TABLE \ @@ -81,6 +83,7 @@ { "atari_transparency", OPTION_INTEGER, &nsoptions.atari_transparency },\ { "atari_dither", OPTION_INTEGER, &nsoptions.atari_dither },\ { "atari_editor", OPTION_STRING, &nsoptions.atari_editor },\ + { "atari_image_toolbar_folder", OPTION_STRING, &nsoptions.atari_image_toolbar_folder },\ { "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 },\ diff --git a/atari/toolbar.c b/atari/toolbar.c index 307e50aed..a17ca8a67 100755 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -61,7 +61,7 @@ extern struct gui_window * input_window; static OBJECT * toolbar_buttons = NULL; static OBJECT * throbber_form = NULL; static bool img_toolbar = false; -static char * img_toolbar_folder = (char *)"default"; +static char * toolbar_image_folder = (char *)"default"; static short toolbar_bg_color = LWHITE; static hlcache_handle * toolbar_image; static hlcache_handle * throbber_image; @@ -153,20 +153,26 @@ void toolbar_init( void ) short vdicolor[3]; uint32_t rgbcolor; + toolbar_image_folder = nsoption_charp(atari_image_toolbar_folder); toolbar_bg_color = MIN(15,nsoption_int(atari_toolbar_bg)); img_toolbar = (nsoption_int( atari_image_toolbar ) > 0 ) ? true : false; if( img_toolbar ){ - char imgfile[PATH_MAX]; + char imgfile[PATH_MAX]; + const char * imgfiletmpl = "toolbar/%s/%s"; while( tb_buttons[i].rsc_id != 0){ tb_buttons[i].index = i; i++; } - toolbar_image = load_icon( "toolbar/default/main.png", + snprintf( imgfile, PATH_MAX-1, imgfiletmpl, toolbar_image_folder, + "main.png" ); + toolbar_image = load_icon( imgfile, + toolbar_icon_callback, NULL ); + snprintf( imgfile, PATH_MAX-1, imgfiletmpl, toolbar_image_folder, + "throbber.png" ); + throbber_image = load_icon( imgfile, toolbar_icon_callback, NULL ); - throbber_image = load_icon( "toolbar/default/throbber.png", - toolbar_icon_callback, NULL ); } else { RsrcGaddr( h_gem_rsrc, R_TREE, TOOLBAR, &toolbar_buttons ); @@ -181,7 +187,7 @@ void toolbar_init( void ) for( i=0; i