mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-29 07:19:44 +03:00
Basic theme support.
NetSurf will use the theme pointed to by the Options file "theme:". Default is Resources/Themes/Default This directory must contain a file called Theme which indicates which files should be used for which images. The number of frames in the Throbber must also be specified here. See Resources/Themes/Default/Theme for an example. svn path=/trunk/netsurf/; revision=5592
This commit is contained in:
parent
d9f9bda135
commit
cde05b7d9f
4
amiga/dist/NetSurf.guide
vendored
4
amiga/dist/NetSurf.guide
vendored
@ -27,10 +27,10 @@ The options file is stored in Resources/Options by default. The following optio
|
||||
@{b}hotlist_file@{ub} Path to Hotlist file
|
||||
@{b}use_workbench@{ub} Open NetSurf in a window on Workbench screen (default is to open a custom screen)
|
||||
@{b}screen_modeid@{ub} Mode ID for NetSurf's custom screen
|
||||
@{b}toolbar_images@{ub} Path to toolbar images (default is TBImages:, which is AISS - see http://www.masonicons.de)
|
||||
@{b}theme@{ub} Path to theme (default is Resources/Themes/Default - an alternative included theme is Resources/Themes/AISS)
|
||||
@{b}no_iframes@{ub} Disable IFrames
|
||||
@{b}clipboard_write_utf8@{ub} Write UTF-8 strings to the clipboard along with a charset identifier (when this option is 0, NetSurf will convert copied strings to local charset)
|
||||
@{b}throbber_frames@{ub} Number of frames in Resources/Throbber file (must be a flat image file with first image inactive)
|
||||
@{b}throbber_frames@{ub} Not used (now in theme description file)
|
||||
@{b}truecolour_mouse_pointers@{ub} Use 32-bit mouse pointers, when disabled NetSurf will use old-style 4 colour images (see Resources/Pointers)
|
||||
@{b}os_mouse_pointers@{ub} Don't override default and busy mouse pointers
|
||||
@{b}always_open_tabs@{ub} Force opening tabs instead of windows (actually swaps the functions so ctrl-click now opens windows and middle mouse button opens tabs)
|
||||
|
79
amiga/gui.c
79
amiga/gui.c
@ -106,7 +106,7 @@ struct Library *PopupMenuBase = NULL;
|
||||
struct PopupMenuIFace *IPopupMenu = NULL;
|
||||
|
||||
struct BitMap *throbber = NULL;
|
||||
ULONG throbber_width,throbber_height;
|
||||
ULONG throbber_width,throbber_height,throbber_frames;
|
||||
|
||||
static struct RastPort dummyrp;
|
||||
struct IFFHandle *iffh = NULL;
|
||||
@ -151,7 +151,7 @@ static void *myrealloc(void *ptr, size_t len, void *pw);
|
||||
void gui_init(int argc, char** argv)
|
||||
{
|
||||
struct Locale *locale;
|
||||
char lang[100];
|
||||
char lang[100],throbberfile[100];
|
||||
bool found=FALSE;
|
||||
int i;
|
||||
BPTR lock=0,amiupdatefh;
|
||||
@ -288,8 +288,8 @@ void gui_init(int argc, char** argv)
|
||||
if((!option_font_fantasy) || (option_font_fantasy[0] == '\0'))
|
||||
option_font_fantasy = (char *)strdup("DejaVu Serif");
|
||||
|
||||
if((!option_toolbar_images) || (option_toolbar_images[0] == '\0'))
|
||||
option_toolbar_images = (char *)strdup("TBImages:");
|
||||
if((!option_theme) || (option_theme[0] == '\0'))
|
||||
option_theme = (char *)strdup("Resources/Themes/Default");
|
||||
|
||||
if(!option_window_width) option_window_width = 800;
|
||||
if(!option_window_height) option_window_height = 600;
|
||||
@ -336,7 +336,14 @@ void gui_init(int argc, char** argv)
|
||||
ami_global_history_initialise();
|
||||
ami_cookies_initialise();
|
||||
|
||||
if(dto = NewDTObject("Resources/Throbber",
|
||||
strcpy(&throbberfile,option_theme);
|
||||
AddPart(&throbberfile,"Theme",100);
|
||||
messages_load(throbberfile);
|
||||
|
||||
ami_get_theme_filename(&throbberfile,"theme_throbber");
|
||||
throbber_frames=atoi(messages_get("theme_throbber_frames"));
|
||||
|
||||
if(dto = NewDTObject(throbberfile,
|
||||
DTA_GroupID,GID_PICTURE,
|
||||
PDTA_DestMode,PMODE_V43,
|
||||
TAG_DONE))
|
||||
@ -346,7 +353,7 @@ void gui_init(int argc, char** argv)
|
||||
|
||||
if(GetDTAttrs(dto,PDTA_BitMapHeader,&throbber_bmh,TAG_DONE))
|
||||
{
|
||||
throbber_width = throbber_bmh->bmh_Width / option_throbber_frames;
|
||||
throbber_width = throbber_bmh->bmh_Width / throbber_frames;
|
||||
throbber_height = throbber_bmh->bmh_Height;
|
||||
|
||||
InitRastPort(&throbber_rp);
|
||||
@ -1096,6 +1103,16 @@ void ami_update_buttons(struct gui_window_2 *gwin)
|
||||
}
|
||||
}
|
||||
|
||||
void ami_get_theme_filename(char *filename,char *themestring)
|
||||
{
|
||||
if(messages_get(themestring)[0] == '*') strncpy(filename,messages_get(themestring)+1,100);
|
||||
else
|
||||
{
|
||||
strcpy(filename,option_theme);
|
||||
AddPart(filename,messages_get(themestring),100);
|
||||
}
|
||||
}
|
||||
|
||||
struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
struct browser_window *clone, bool new_tab)
|
||||
{
|
||||
@ -1269,38 +1286,22 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
gwin->shared->tabs=1;
|
||||
gwin->shared->next_tab=1;
|
||||
|
||||
strcpy(nav_west,option_toolbar_images);
|
||||
strcpy(nav_west_s,option_toolbar_images);
|
||||
strcpy(nav_west_g,option_toolbar_images);
|
||||
strcpy(nav_east,option_toolbar_images);
|
||||
strcpy(nav_east_s,option_toolbar_images);
|
||||
strcpy(nav_east_g,option_toolbar_images);
|
||||
strcpy(stop,option_toolbar_images);
|
||||
strcpy(stop_s,option_toolbar_images);
|
||||
strcpy(stop_g,option_toolbar_images);
|
||||
strcpy(reload,option_toolbar_images);
|
||||
strcpy(reload_s,option_toolbar_images);
|
||||
strcpy(reload_g,option_toolbar_images);
|
||||
strcpy(home,option_toolbar_images);
|
||||
strcpy(home_s,option_toolbar_images);
|
||||
strcpy(home_g,option_toolbar_images);
|
||||
strcpy(closetab,option_toolbar_images);
|
||||
AddPart(nav_west,"nav_west",100);
|
||||
AddPart(nav_west_s,"nav_west_s",100);
|
||||
AddPart(nav_west_g,"nav_west_g",100);
|
||||
AddPart(nav_east,"nav_east",100);
|
||||
AddPart(nav_east_s,"nav_east_s",100);
|
||||
AddPart(nav_east_g,"nav_east_g",100);
|
||||
AddPart(stop,"stop",100);
|
||||
AddPart(stop_s,"stop_s",100);
|
||||
AddPart(stop_g,"stop_g",100);
|
||||
AddPart(reload,"reload",100);
|
||||
AddPart(reload_s,"reload_s",100);
|
||||
AddPart(reload_g,"reload_g",100);
|
||||
AddPart(home,"home",100);
|
||||
AddPart(home_s,"home_s",100);
|
||||
AddPart(home_g,"home_g",100);
|
||||
AddPart(closetab,"list_cancel",100);
|
||||
ami_get_theme_filename(nav_west,"theme_nav_west");
|
||||
ami_get_theme_filename(nav_west_s,"theme_nav_west_s");
|
||||
ami_get_theme_filename(nav_west_g,"theme_nav_west_g");
|
||||
ami_get_theme_filename(nav_east,"theme_nav_east");
|
||||
ami_get_theme_filename(nav_east_s,"theme_nav_east_s");
|
||||
ami_get_theme_filename(nav_east_g,"theme_nav_east_g");
|
||||
ami_get_theme_filename(stop,"theme_stop");
|
||||
ami_get_theme_filename(stop_s,"theme_stop_s");
|
||||
ami_get_theme_filename(stop_g,"theme_stop_g");
|
||||
ami_get_theme_filename(reload,"theme_reload");
|
||||
ami_get_theme_filename(reload_s,"theme_reload_s");
|
||||
ami_get_theme_filename(reload_g,"theme_reload_g");
|
||||
ami_get_theme_filename(home,"theme_home");
|
||||
ami_get_theme_filename(home_s,"theme_home_s");
|
||||
ami_get_theme_filename(home_g,"theme_home_g");
|
||||
ami_get_theme_filename(closetab,"theme_closetab");
|
||||
|
||||
gwin->shared->objects[OID_MAIN] = WindowObject,
|
||||
WA_ScreenTitle,nsscreentitle,
|
||||
@ -2180,7 +2181,7 @@ void ami_update_throbber(struct gui_window_2 *g)
|
||||
GetAttr(SPACE_AreaBox,g->gadgets[GID_THROBBER],(ULONG *)&bbox);
|
||||
|
||||
g->throbber_frame++;
|
||||
if(g->throbber_frame > (option_throbber_frames-1))
|
||||
if(g->throbber_frame > (throbber_frames-1))
|
||||
g->throbber_frame=1;
|
||||
|
||||
BltBitMapRastPort(throbber,throbber_width*g->throbber_frame,0,g->win->RPort,bbox->Left,bbox->Top,throbber_width,throbber_height,0x0C0);
|
||||
|
@ -25,10 +25,10 @@ extern char *option_url_file;
|
||||
extern char *option_hotlist_file;
|
||||
extern bool option_use_wb;
|
||||
extern int option_modeid;
|
||||
extern char *option_toolbar_images;
|
||||
extern char *option_theme;
|
||||
extern bool option_no_iframes;
|
||||
extern bool option_utf8_clipboard;
|
||||
extern int option_throbber_frames;
|
||||
extern int option_throbber_frames; // unused
|
||||
extern bool option_truecolour_mouse_pointers;
|
||||
extern bool option_use_os_pointers;
|
||||
extern bool option_force_tabs;
|
||||
@ -42,7 +42,7 @@ char *option_url_file = 0; \
|
||||
char *option_hotlist_file = 0; \
|
||||
bool option_use_wb = false; \
|
||||
int option_modeid = 0; \
|
||||
char *option_toolbar_images = 0; \
|
||||
char *option_theme = 0; \
|
||||
bool option_no_iframes = false; \
|
||||
bool option_utf8_clipboard = false; \
|
||||
int option_throbber_frames = 1; \
|
||||
@ -59,7 +59,7 @@ char *option_recent_file = 0; \
|
||||
{ "hotlist_file", OPTION_STRING, &option_hotlist_file }, \
|
||||
{ "use_workbench", OPTION_BOOL, &option_use_wb}, \
|
||||
{ "screen_modeid", OPTION_INTEGER, &option_modeid}, \
|
||||
{ "toolbar_images", OPTION_STRING, &option_toolbar_images }, \
|
||||
{ "theme", OPTION_STRING, &option_theme}, \
|
||||
{ "no_iframes", OPTION_BOOL, &option_no_iframes}, \
|
||||
{ "clipboard_write_utf8", OPTION_BOOL, &option_utf8_clipboard}, \
|
||||
{ "throbber_frames", OPTION_INTEGER, &option_throbber_frames}, \
|
||||
|
21
amiga/resources/Themes/AISS/Theme
Executable file
21
amiga/resources/Themes/AISS/Theme
Executable file
@ -0,0 +1,21 @@
|
||||
# AISS theme. Requires AISS to be installed (see http://www.masonicons.de)
|
||||
# Throbber animation by Martin Merz
|
||||
#
|
||||
theme_nav_west:*TBImages:nav_west
|
||||
theme_nav_west_s:*TBImages:nav_west_s
|
||||
theme_nav_west_g:*TBImages:nav_west_g
|
||||
theme_nav_east:*TBImages:nav_east
|
||||
theme_nav_east_s:*TBImages:nav_east_s
|
||||
theme_nav_east_g:*TBImages:nav_east_g
|
||||
theme_stop:*TBImages:stop
|
||||
theme_stop_s:*TBImages:stop_s
|
||||
theme_stop_g:*TBImages:stop_g
|
||||
theme_reload:*TBImages:reload
|
||||
theme_reload_s:*TBImages:reload_s
|
||||
theme_reload_g:*TBImages:reload_g
|
||||
theme_home:*TBImages:home
|
||||
theme_home_s:*TBImages:home_s
|
||||
theme_home_g:*TBImages:home_g
|
||||
theme_closetab:*TBImages:list_cancel
|
||||
theme_throbber:Throbber
|
||||
theme_throbber_frames:13
|
BIN
amiga/resources/Themes/AISS/Throbber
Normal file
BIN
amiga/resources/Themes/AISS/Throbber
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
36
amiga/resources/Themes/Default/Theme
Executable file
36
amiga/resources/Themes/Default/Theme
Executable file
@ -0,0 +1,36 @@
|
||||
# Theme description file for AmigaOS NetSurf
|
||||
#
|
||||
# Format is theme_image:filename
|
||||
# Where filename is relative to the directory in which this file
|
||||
# is stored.
|
||||
#
|
||||
# If filename is prefixed by an asterisk, it will be treated as
|
||||
# a full path to a file.
|
||||
#
|
||||
# Where theme_image is suffixed by _s or _g, these are the selected
|
||||
# and ghosted version of the image.
|
||||
#
|
||||
# The images can be stored in any format which has a picture datatype
|
||||
# available.
|
||||
#
|
||||
# theme_throbber is a film strip of theme_throbber_frames frames
|
||||
# The first frame must be the inactive image.
|
||||
#
|
||||
theme_nav_west:*TBImages:nav_west
|
||||
theme_nav_west_s:*TBImages:nav_west_s
|
||||
theme_nav_west_g:*TBImages:nav_west_g
|
||||
theme_nav_east:*TBImages:nav_east
|
||||
theme_nav_east_s:*TBImages:nav_east_s
|
||||
theme_nav_east_g:*TBImages:nav_east_g
|
||||
theme_stop:*TBImages:stop
|
||||
theme_stop_s:*TBImages:stop_s
|
||||
theme_stop_g:*TBImages:stop_g
|
||||
theme_reload:*TBImages:reload
|
||||
theme_reload_s:*TBImages:reload_s
|
||||
theme_reload_g:*TBImages:reload_g
|
||||
theme_home:*TBImages:home
|
||||
theme_home_s:*TBImages:home_s
|
||||
theme_home_g:*TBImages:home_g
|
||||
theme_closetab:*TBImages:list_cancel
|
||||
theme_throbber:Throbber
|
||||
theme_throbber_frames:9
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Loading…
Reference in New Issue
Block a user