diff options
272 files changed, 7484 insertions, 12835 deletions
diff --git a/!NetSurf/Resources/CSS,f79 b/!NetSurf/Resources/CSS,f79 index a7396acaf..0ac67385b 100644 --- a/!NetSurf/Resources/CSS,f79 +++ b/!NetSurf/Resources/CSS,f79 @@ -90,6 +90,7 @@ th { font-weight: bold; text-align: center; } td[nowrap], th[nowrap] { white-space: nowrap; } a:link { color: #00f; text-decoration: underline; } +a:visited { color: #609; } img { color: #888; } diff --git a/!NetSurf/Resources/internal.css,f79 b/!NetSurf/Resources/internal.css,f79 index 819c19fa2..96ea65fe1 100644 --- a/!NetSurf/Resources/internal.css,f79 +++ b/!NetSurf/Resources/internal.css,f79 @@ -164,15 +164,34 @@ body#dirlist span.size + span.size { * configuration listing style */ -body#configlist table.config th { - text-align: left; } +body#configlist table.config { + border-spacing: 0; } + +body#configlist table.config tr:nth-child(2n-1) { + background: #eee; } -body#configlist table.config td { +body#configlist table.config tr:first-child th { + text-align: left; + font-weight: bold; + font-family: sans-serif; + background: #ddd; } + +body#configlist table.config tr th { + text-align: left; + font-weight: normal; + font-family: monospace; } + +body#configlist table.config td, body#configlist table.config th { padding-left: 1em; } -body#configlist table.config td + td { +body#configlist table.config tr *:nth-child(3) { padding-left: 3em; } +body#configlist table.config tr *:nth-child(4) { + padding-left: 3em; + font-family: monospace; + padding-right: 1em; } + body#configlist .null-content { font-style: italic; } diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..de2f3167a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +.gitignore export-ignore +.gitattributes export-ignore diff --git a/.gitignore b/.gitignore index 84eca230b..82d6b6ce1 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/Docs/BUILDING-GTK b/Docs/BUILDING-GTK index 01f46320b..16b15a4af 100644 --- a/Docs/BUILDING-GTK +++ b/Docs/BUILDING-GTK @@ -66,9 +66,11 @@ Debian-like OS: - $ apt-get install libglade2-dev libcurl3-dev libmng-dev + $ apt-get install libgtk2.0-dev libcurl3-dev libmng-dev $ apt-get install librsvg2-dev liblcms1-dev libjpeg-dev + If you want to build with gtk 3 replace libgtk2.0-dev with libgtk-3-dev + Recent OS versions might need libcurl4-dev instead of libcurl3-dev but note that when it has not been built with OpenSSL, the SSL_CTX is not available and results that certification details won't be presented in case @@ -82,8 +84,8 @@ Fedora: - $ yum install libglade2-devel curl-devel libmng-devel - $ yum install librsvg2-devel lcms-devel + $ yum install curl-devel libmng-devel + $ yum install librsvg2-devel lcms-devel expat-devel Other: diff --git a/Docs/env.sh b/Docs/env.sh index 5d6096353..db2729c0c 100644 --- a/Docs/env.sh +++ b/Docs/env.sh @@ -43,8 +43,10 @@ NS_GIT="git://git.netsurf-browser.org" NS_INTERNAL_LIBS="buildsystem libwapcaplet libparserutils libhubbub libdom libcss libnsgif libnsbmp libsvgtiny librosprite" # internal libraries only required by some frontends NS_FRONTEND_LIBS="libnsfb" +# internal libraries required for the risc os target abi +NS_RISCOS_LIBS="librufl libpencil" # tools required to build the browser -NS_TOOLS="nsgenjsbind" +NS_TOOLS="nsgenbind" # The browser itself NS_BROWSER="netsurf" @@ -53,6 +55,11 @@ NS_DEV_DEB="build-essential pkg-config git gperf" NS_TOOL_DEB="flex bison" NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libmng-dev librsvg2-dev liblcms1-dev libjpeg-dev libmozjs-dev" +#add target specific libraries +if [ "x${TARGET_ABI}" = "xriscos" ]; then + NS_FRONTEND_LIBS="${NS_FRONTEND_LIBS} ${NS_RISCOS_LIBS}" +fi + # apt get commandline to install necessary dev packages ns-apt-get-install() { @@ -76,7 +83,7 @@ ns-pull() ns-clone() { mkdir -p ${TARGET_WORKSPACE} - for REPO in $(echo ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do + for REPO in $(echo ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_RISCOS_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do echo -n " GIT: Cloning ${REPO}: " if [ -f ${TARGET_WORKSPACE}/${REPO}/.git/config ]; then echo "Repository already present" @@ -137,6 +137,7 @@ PERL=perl MKDIR=mkdir TOUCH=touch STRIP=strip +SPLIT_MESSAGES=$(PERL) utils/split-messages.pl # Override this only if the host compiler is called something different HOST_CC := gcc @@ -270,8 +271,21 @@ else CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++) endif else - # All other targets (GTK, Framebuffer) - PKG_CONFIG := pkg-config + ifeq ($(findstring framebuffer,$(TARGET)),framebuffer) + ifeq ($(origin GCCSDK_INSTALL_ENV),undefined) + PKG_CONFIG := pkg-config + else + PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config + endif + + ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined) + CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc) + CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++) + endif + else + # All native targets (GTK) + PKG_CONFIG := pkg-config + endif endif endif endif @@ -593,6 +607,7 @@ endif clean-target: $(VQ)echo " CLEAN: $(EXETARGET)" $(Q)$(RM) $(EXETARGET) + $(call clean_install_messages, !NetSurf/Resources) clean-testament: $(VQ)echo " CLEAN: utils/testament.h" @@ -604,7 +619,7 @@ clean-builddir: CLEANS += clean-builddir all-program: $(EXETARGET) post-exe - $(call split_install_messages, '[^\.]+', !NetSurf/Resources) + $(call split_install_messages, any, !NetSurf/Resources) .PHONY: testament testament utils/testament.h: @@ -743,10 +758,33 @@ FAT_LANGUAGES=de en fr it nl define split_install_messages $(foreach LANG, $(FAT_LANGUAGES), @echo MSGSPLIT: $(1)/$(LANG) to $(2) $(Q)mkdir -p $(2)/$(LANG)$(3) - $(Q)$(PERL) utils/split-messages.pl $(LANG) $(1) < resources/FatMessages | gzip -9n > $(2)$(3)/$(LANG)/Messages + $(Q)$(SPLIT_MESSAGES) -l $(LANG) -p $(1) -f messages resources/FatMessages | gzip -9n > $(2)$(3)/$(LANG)/Messages ) endef +# Clean Message target +# 1 = Destination directory (where resources being installed, creates en/Messages etc) +# 2 = suffix after language name +define clean_install_messages + $(foreach LANG, $(FAT_LANGUAGES), @echo MSGCLEAN: $(LANG) in $(1) + $(Q)$(RM) -f $(1)$(2)/$(LANG)/Messages + ) +endef + +.PHONY: messages-split-tfx messages-fetch-tfx messages-import-tfx + +# split fat messages into properties files suitable for uploading to transifex +messages-split-tfx: + for splitlang in $(FAT_LANGUAGES);do perl ./utils/split-messages.pl -l $${splitlang} -f transifex -p any -o Messages.any.$${splitlang}.tfx resources/FatMessages;done + +# download property files from transifex +messages-fetch-tfx: + for splitlang in $(FAT_LANGUAGES);do $(RM) Messages.any.$${splitlang}.tfx ; perl ./utils/fetch-transifex.pl -w insecure -l $${splitlang} -o Messages.any.$${splitlang}.tfx ;done + +# merge property files into fat messages +messages-import-tfx: messages-fetch-tfx + for tfxlang in $(FAT_LANGUAGES);do perl ./utils/import-messages.pl -l $${tfxlang} -p any -f transifex -o resources/FatMessages -i resources/FatMessages -I Messages.any.$${tfxlang}.tfx ; $(RM) Messages.any.$${tfxlang}.tfx; done + # Target installs executable on the host system install: all-program install-$(TARGET) diff --git a/Makefile.defaults b/Makefile.defaults index d8f5b9b0c..515f4a042 100644 --- a/Makefile.defaults +++ b/Makefile.defaults @@ -63,9 +63,9 @@ NETSURF_USE_VIDEO := NO # Enable NetSurf's use of spidermonkey for javascript # Valid options: YES, NO, AUTO -NETSURF_USE_JS := NO +NETSURF_USE_JS := AUTO # Javascript support in older debian/ubuntu versions -NETSURF_USE_MOZJS := NO +NETSURF_USE_MOZJS := AUTO # Enable NetSurf's use of libharu for PDF export and GTK printing support. # There is no auto-detection available for this, as it does not have a diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults index 42bcb73ce..5ff1b69c3 100644 --- a/amiga/Makefile.defaults +++ b/amiga/Makefile.defaults @@ -36,5 +36,11 @@ # Valid options: YES, NO, AUTO NETSURF_USE_AMIGA_CAIRO := AUTO + # Enable NetSurf's use of Spidermonkey 1.80+ + # Only here to stop the build complaining; + # enable NETSURF_USE_MOZJS instead for JavaScript support + # Valid options: NO + NETSURF_USE_JS := NO + # Optimisation levels CFLAGS += -O2 -gstabs diff --git a/amiga/Makefile.target b/amiga/Makefile.target index dc79479c5..33ce41e62 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -2,7 +2,7 @@ # Amiga target setup # ---------------------------------------------------------------------------- -CFLAGS += -std=c99 -Dnsamiga +CFLAGS += -std=c99 -Dnsamiga -DFETCHER_CURLL_SCHEDULED ifneq ($(SUBTARGET),os3) CFLAGS += -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__ @@ -72,14 +72,14 @@ EXETARGET := NetSurf # ---------------------------------------------------------------------------- # S_AMIGA are sources purely for the Amiga build -S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \ +S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \ thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \ plotters.c object.c menu.c save_pdf.c arexx.c version.c \ - cookies.c context_menu.c clipboard.c help.c font_scan.c \ - launch.c search.c history_local.c download.c iff_dr2d.c \ - sslcert.c gui_options.c print.c theme.c drag.c icon.c system_colour.c \ + cookies.c context_menu.c clipboard.c help.c font_scan.c \ + launch.c search.c history_local.c download.c iff_dr2d.c \ + sslcert.c gui_options.c print.c theme.c drag.c icon.c \ datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \ - stringview/stringview.c stringview/urlhistory.c \ + stringview/stringview.c stringview/urlhistory.c \ agclass/amigaguide_class.c S_AMIGA := $(addprefix amiga/,$(S_AMIGA)) @@ -132,10 +132,10 @@ netsurf.lha: $(EXETARGET) $(Q)cp amiga/pkg/drawer.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf.info $(Q)cp amiga/pkg/AutoInstall $(AMIGA_INSTALL_TARGET_DIR) ifeq ($(HOST),amiga) - $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs - $(Q)cp $(AMIGA_LIBS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs - $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs - $(Q)cp --preserve=timestamps $(AMIGA_SOBJS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs +# $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs +# $(Q)cp $(AMIGA_LIBS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs +# $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs +# $(Q)cp --preserve=timestamps $(AMIGA_SOBJS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs endif $(Q)cd $(AMIGA_INSTALL_TARGET_DIR); \ lha a netsurf.lha NetSurf NetSurf.info AutoInstall diff --git a/amiga/arexx.c b/amiga/arexx.c index 491fc03bd..ed05f6c16 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" @@ -455,13 +455,13 @@ STATIC VOID rx_pubscreen(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__ { cmd->ac_RC = 0; - if(nsoption_charp(use_pubscreen) == NULL) + if(nsoption_charp(pubscreen_name) == NULL) { strcpy(result,"NetSurf"); } else { - strcpy(result, nsoption_charp(use_pubscreen)); + strcpy(result, nsoption_charp(pubscreen_name)); } cmd->ac_Result = result; diff --git a/amiga/bitmap.c b/amiga/bitmap.c index c70212a1b..9a71d1cd4 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 ae4d8a5d1..fd42f4d61 100644 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -18,9 +18,8 @@ #include "desktop/gui.h" #include "desktop/plotters.h" -#include "desktop/selection.h" #include "desktop/textinput.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "amiga/bitmap.h" #include "amiga/clipboard.h" @@ -239,7 +238,7 @@ void gui_set_clipboard(const char *buffer, size_t length, { if(!(PushChunk(iffh, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN))) { - if(nsoption_bool(utf8_clipboard)) + if(nsoption_bool(clipboard_write_utf8)) { if(!(PushChunk(iffh, 0, ID_CSET, 32))) { @@ -255,7 +254,7 @@ void gui_set_clipboard(const char *buffer, size_t length, } if(!(PushChunk(iffh, 0, ID_CHRS, IFFSIZE_UNKNOWN))) { - if(nsoption_bool(utf8_clipboard)) { + if(nsoption_bool(clipboard_write_utf8)) { WriteChunkBytes(iffh, buffer, length); } else { if(utf8_to_local_encoding(buffer, length, &text) == UTF8_CONVERT_OK) { diff --git a/amiga/context_menu.c b/amiga/context_menu.c index 0a71d3085..839b60334 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" @@ -42,7 +42,6 @@ #include "desktop/browser_private.h" #include "desktop/history_core.h" #include "desktop/hotlist.h" -#include "desktop/selection.h" #include "desktop/searchweb.h" #include "desktop/textinput.h" #include "desktop/tree_url_node.h" @@ -486,7 +485,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL, PMIA_Title, (ULONG)ctxmenulab[CMID_SELCUT], PMIA_ID,CMID_SELCUT, - PMIA_Disabled, disabled_noselection && disabled_readonly, + PMIA_Disabled, !(browser_window_get_editor_flags(bw) & BW_EDITOR_CAN_CUT), PMIA_CommKey, "X", TAG_DONE), PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL, @@ -729,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/dist/Install b/amiga/dist/Install index d550e8b73..3977629d8 100755 --- a/amiga/dist/Install +++ b/amiga/dist/Install @@ -415,20 +415,6 @@ ) ) -(if (= #hotlist-exist 0) - (if (= #old-hotlist-exist 1) - ( - (copyfiles - (prompt "Migrating NetSurf 2.x Hotlist") - (help @copyfiles-help) - (source #old-hotlist) - (dest #user-dir) - (optional "askuser" "force" "oknodelete") - ) - ) - ) -) - (complete 18) (if (>= osver 53) @@ -572,7 +558,21 @@ (help @textfile-help) (dest #user-options) (append "theme:" #theme "\n") - (append "use_pubscreen:Workbench\n") + (append "pubscreen_name:Workbench\n") + ) + + (if (= #hotlist-exist 0) + (if (= #old-hotlist-exist 1) + ( + (copyfiles + (prompt "Migrating NetSurf 2.x Hotlist") + (help @copyfiles-help) + (source #old-hotlist) + (dest #user-dir) + (optional "askuser" "force" "oknodelete") + ) + ) + ) ) ) ) diff --git a/amiga/download.c b/amiga/download.c index b9b27ab9f..6b0e3c8a0 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" @@ -43,7 +43,6 @@ #include "amiga/utf8.h" #include "desktop/download.h" -#include "desktop/selection.h" #include "desktop/save_complete.h" #include "image/ico.h" @@ -106,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), @@ -352,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/drag.c b/amiga/drag.c index 45b0843dd..1123ba265 100644 --- a/amiga/drag.c +++ b/amiga/drag.c @@ -37,11 +37,9 @@ #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 "desktop/selection.h" - #include "utils/errors.h" #include "utils/log.h" #include "utils/messages.h" @@ -57,7 +55,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, { const char *filetype = NULL; - if(strcmp(nsoption_charp(use_pubscreen), "Workbench")) return; + if(strcmp(nsoption_charp(pubscreen_name), "Workbench")) return; switch(type) { @@ -89,7 +87,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, drag_save = type; } -void gui_drag_save_selection(struct selection *s, struct gui_window *g) +void gui_drag_save_selection(struct gui_window *g, const char *selection) { ami_drag_icon_show(g->shared->win, "ascii"); @@ -108,7 +106,7 @@ void ami_drag_save(struct Window *win) ami_drag_icon_close(NULL); ami_autoscroll = FALSE; - if(nsoption_charp(use_pubscreen) && (strcmp(nsoption_charp(use_pubscreen),"Workbench") == 0)) + if(nsoption_charp(pubscreen_name) && (strcmp(nsoption_charp(pubscreen_name),"Workbench") == 0)) { which = WhichWorkbenchObject(NULL,scrn->MouseX,scrn->MouseY, WBOBJA_Type,&type, diff --git a/amiga/file.c b/amiga/file.c index 68e2637c2..694285738 100644 --- a/amiga/file.c +++ b/amiga/file.c @@ -29,11 +29,10 @@ #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" -#include "desktop/selection.h" #include "utils/messages.h" #include "utils/url.h" @@ -84,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, @@ -214,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; } @@ -230,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/font.c b/amiga/font.c index df41301d1..21f26358f 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" @@ -327,6 +327,8 @@ bool nsfont_split(const plot_font_style_t *fstyle, utf16next, emwidth); } + tx += tempx; + /* Check whether we have a space */ if (*(string + utf8_pos) == ' ') { /* Got a space */ @@ -341,8 +343,6 @@ 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. */ @@ -352,7 +352,7 @@ bool nsfont_split(const plot_font_style_t *fstyle, utf16 = utf16next; utf8_pos = utf8_next(string, length, utf8_pos); - } + }; free(outf16); @@ -584,7 +584,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, if ((*char2 >= 0xD800) && (*char2 <= 0xDBFF)) { /* Don't attempt to kern a UTF-16 surrogate */ - char2 = 0; + *char2 = 0; } if(aa == false) { @@ -622,7 +622,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, kern = 0; - if(char2) EObtainInfo(&ofont->olf_EEngine, + if(*char2) EObtainInfo(&ofont->olf_EEngine, OT_TextKernPair, &kern, TAG_END); @@ -632,7 +632,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, glyphmaptag, glyph, TAG_END); - if(char2) EReleaseInfo(&ofont->olf_EEngine, + if(*char2) EReleaseInfo(&ofont->olf_EEngine, OT_TextKernPair, kern, TAG_END); } @@ -657,7 +657,7 @@ int32 ami_font_width_glyph(struct OutlineFont *ofont, if ((*char2 >= 0xD800) && (*char2 <= 0xDBFF)) { /* Don't attempt to kern a UTF-16 surrogate */ - char2 = 0; + *char2 = 0; } if(ESetInfo(&ofont->olf_EEngine, @@ -674,7 +674,7 @@ int32 ami_font_width_glyph(struct OutlineFont *ofont, kern = 0; - if(char2) { + if(*char2) { if(ESetInfo(&ofont->olf_EEngine, OT_GlyphCode, *char1, OT_GlyphCode2, *char2, @@ -687,7 +687,7 @@ int32 ami_font_width_glyph(struct OutlineFont *ofont, } char_advance = (ULONG)(((char1w - kern) * emwidth) / 65536); - if(char2) EReleaseInfo(&ofont->olf_EEngine, + if(*char2) EReleaseInfo(&ofont->olf_EEngine, OT_TextKernPair, kern, TAG_END); @@ -882,10 +882,10 @@ void ami_font_setdevicedpi(int id) { DisplayInfoHandle dih; struct DisplayInfo dinfo; - ULONG ydpi = nsoption_int(amiga_ydpi); - ULONG xdpi = nsoption_int(amiga_ydpi); + ULONG ydpi = nsoption_int(screen_ydpi); + ULONG xdpi = nsoption_int(screen_ydpi); - nscss_screen_dpi = INTTOFIX(nsoption_int(amiga_ydpi)); + nscss_screen_dpi = INTTOFIX(nsoption_int(screen_ydpi)); if(id && (nsoption_int(monitor_aspect_x) != 0) && (nsoption_int(monitor_aspect_y) != 0)) { diff --git a/amiga/font_scan.c b/amiga/font_scan.c index 768fceef9..b1732da3e 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 e2616cf21..a5cac9dfc 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -23,11 +23,10 @@ #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" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "desktop/tree.h" #include "desktop/tree_url_node.h" @@ -103,6 +102,8 @@ #include <intuition/icclass.h> #include <graphics/rpattr.h> #include <workbench/workbench.h> +#include <intuition/gui.h> +#include <intuition/screens.h> /* ReAction libraries */ #include <proto/bevel.h> @@ -132,6 +133,8 @@ #include <math.h> #include <string.h> +#define AMINS_SCROLLERPEN NUMDRIPENS + #define NSA_KBD_SCROLL_PX 10 /* Extra mouse button defines to match those in intuition/intuition.h */ @@ -193,6 +196,12 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw); static void ami_do_redraw(struct gui_window_2 *g); static void ami_schedule_redraw_remove(struct gui_window_2 *gwin); +/* accessors for default options - user option is updated if it is set as per default */ +#define nsoption_default_set_int(OPTION, VALUE) \ + if (nsoptions_default[NSOPTION_##OPTION].value.i == nsoptions[NSOPTION_##OPTION].value.i) \ + nsoptions[NSOPTION_##OPTION].value.i = VALUE; \ + nsoptions_default[NSOPTION_##OPTION].value.i = VALUE + STRPTR ami_locale_langs(void) { struct Locale *locale; @@ -282,6 +291,8 @@ bool ami_gui_check_resource(char *fullpath, const char *file) ami_gui_map_filename(&remapped, fullpath, file, "Resource.map"); path_add_part(fullpath, 1024, remapped); + LOG(("Checking for %s", fullpath)); + if(lock = Lock(fullpath, ACCESS_READ)) { UnLock(lock); @@ -308,9 +319,6 @@ bool ami_locate_resource(char *fullpath, const char *file) found = ami_gui_check_resource(fullpath, file); if(found) return true; - /* Secondly check the user's selected theme. NB: ami_locate_resource() - * gets called for Messages before options are loaded */ - if(nsoption_charp(theme)) { strcpy(fullpath, nsoption_charp(theme)); @@ -392,7 +400,108 @@ void ami_open_resources(void) //ami_help_init(NULL); } -void ami_set_options(void) +static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo) +{ + LONG scrollerfillpen = FALSE; + + GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE); + + if(scrollerfillpen) return FILLPEN; + else return FOREGROUNDPEN; +} + +/** + * set option from pen + */ +static nserror +colour_option_from_pen(UWORD pen, + enum nsoption_e option, + struct Screen *screen, + colour def_colour) +{ + ULONG colour[3]; + struct DrawInfo *drinfo; + + if((option < NSOPTION_SYS_COLOUR_START) || + (option > NSOPTION_SYS_COLOUR_END) || + (nsoptions[option].type != OPTION_COLOUR)) { + return NSERROR_BAD_PARAMETER; + } + + if(screen != NULL) { + drinfo = GetScreenDrawInfo(screen); + if(drinfo != NULL) { + + if(pen == AMINS_SCROLLERPEN) pen = ami_system_colour_scrollbar_fgpen(drinfo); + + /* Get the colour of the pen being used for "pen" */ + GetRGB32(screen->ViewPort.ColorMap, drinfo->dri_Pens[pen], 1, (ULONG *)&colour); + + /* convert it to a color */ + def_colour = ((colour[0] & 0xff000000) >> 24) | + ((colour[1] & 0xff000000) >> 16) | + ((colour[2] & 0xff000000) >> 8); + + FreeScreenDrawInfo(screen, drinfo); + } + } + + if (nsoptions_default[option].value.c == nsoptions[option].value.c) + nsoptions[option].value.c = def_colour; + nsoptions_default[option].value.c = def_colour; + + return NSERROR_OK; +} + +static void ami_set_screen_defaults(struct Screen *screen) +{ + nsoption_default_set_int(window_x, 0); + nsoption_default_set_int(window_y, screen->BarHeight + 1); + nsoption_default_set_int(window_width, screen->Width); + nsoption_default_set_int(window_height, screen->Height - screen->BarHeight - 1); + + nsoption_default_set_int(redraw_tile_size_x, screen->Width); + nsoption_default_set_int(redraw_tile_size_y, screen->Height); + + /* set system colours for amiga ui */ + colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveBorder, screen, 0x00000000); + colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveCaption, screen, 0x00dddddd); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_AppWorkspace, screen, 0x00eeeeee); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Background, screen, 0x00aa0000); + colour_option_from_pen(FOREGROUNDPEN, NSOPTION_sys_colour_ButtonFace, screen, 0x00aaaaaa); + colour_option_from_pen(FORESHINEPEN, NSOPTION_sys_colour_ButtonHighlight, screen, 0x00cccccc); + colour_option_from_pen(FORESHADOWPEN, NSOPTION_sys_colour_ButtonShadow, screen, 0x00bbbbbb); + colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_ButtonText, screen, 0x00000000); + colour_option_from_pen(FILLTEXTPEN, NSOPTION_sys_colour_CaptionText, screen, 0x00000000); + colour_option_from_pen(DISABLEDTEXTPEN, NSOPTION_sys_colour_GrayText, screen, 0x00777777); + colour_option_from_pen(SELECTPEN, NSOPTION_sys_colour_Highlight, screen, 0x00ee0000); + colour_option_from_pen(SELECTTEXTPEN, NSOPTION_sys_colour_HighlightText, screen, 0x00000000); + colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveBorder, screen, 0x00000000); + colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveCaption, screen, 0x00ffffff); + colour_option_from_pen(INACTIVEFILLTEXTPEN, NSOPTION_sys_colour_InactiveCaptionText, screen, 0x00cccccc); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_InfoBackground, screen, 0x00aaaaaa);/* This is wrong, HelpHint backgrounds are pale yellow but doesn't seem to be a DrawInfo pen defined for it. */ + colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_InfoText, screen, 0x00000000); + colour_option_from_pen(MENUBACKGROUNDPEN, NSOPTION_sys_colour_Menu, screen, 0x00aaaaaa); + colour_option_from_pen(MENUTEXTPEN, NSOPTION_sys_colour_MenuText, screen, 0x00000000); + colour_option_from_pen(AMINS_SCROLLERPEN, NSOPTION_sys_colour_Scrollbar, screen, 0x00aaaaaa); + colour_option_from_pen(FORESHADOWPEN, NSOPTION_sys_colour_ThreeDDarkShadow, screen, 0x00555555); + colour_option_from_pen(FOREGROUNDPEN, NSOPTION_sys_colour_ThreeDFace, screen, 0x00dddddd); + colour_option_from_pen(FORESHINEPEN, NSOPTION_sys_colour_ThreeDHighlight, screen, 0x00aaaaaa); + colour_option_from_pen(HALFSHINEPEN, NSOPTION_sys_colour_ThreeDLightShadow, screen, 0x00999999); + colour_option_from_pen(HALFSHADOWPEN, NSOPTION_sys_colour_ThreeDShadow, screen, 0x00777777); + colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Window, screen, 0x00aaaaaa); + colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, screen, 0x00000000); + colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_WindowText, screen, 0x00000000); +} + + +/** + * 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; @@ -441,9 +550,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); @@ -475,24 +581,16 @@ 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); - #ifndef __amigaos4__ nsoption_set_bool(download_notify, false); nsoption_set_bool(context_menu, false); nsoption_set_bool(font_antialiasing, false); nsoption_set_bool(truecolour_mouse_pointers, false); #endif + + return NSERROR_OK; } void ami_amiupdate(void) @@ -554,13 +652,6 @@ nsurl *gui_get_resource_url(const char *path) return url; } -/* Documented in desktop/options.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; @@ -592,8 +683,7 @@ void gui_init(int argc, char** argv) static void ami_gui_newprefs_hook(struct Hook *hook, APTR window, APTR reserved) { - gui_system_colour_finalize(); - gui_system_colour_init(); + ami_set_screen_defaults(scrn); } void ami_openscreen(void) @@ -605,12 +695,12 @@ void ami_openscreen(void) compositing = ~0UL; else compositing = nsoption_int(screen_compositing); - if (nsoption_charp(use_pubscreen) == NULL) + if (nsoption_charp(pubscreen_name) == NULL) { - if((nsoption_charp(modeid)) && - (strncmp(nsoption_charp(modeid), "0x", 2) == 0)) + if((nsoption_charp(screen_modeid)) && + (strncmp(nsoption_charp(screen_modeid), "0x", 2) == 0)) { - id = strtoul(nsoption_charp(modeid), NULL, 0); + id = strtoul(nsoption_charp(screen_modeid), NULL, 0); } else { @@ -626,8 +716,8 @@ void ami_openscreen(void) char *modeid = malloc(20); id = screenmodereq->sm_DisplayID; sprintf(modeid, "0x%lx", id); - nsoption_set_charp(modeid, modeid); - nsoption_write(current_user_options); + nsoption_set_charp(screen_modeid, modeid); + nsoption_write(current_user_options, NULL, NULL); } FreeAslRequest(screenmodereq); } @@ -654,15 +744,15 @@ void ami_openscreen(void) } else { - nsoption_set_charp(use_pubscreen, + nsoption_set_charp(pubscreen_name, strdup("Workbench")); } } } - if (nsoption_charp(use_pubscreen) != NULL) + if (nsoption_charp(pubscreen_name) != NULL) { - scrn = LockPubScreen(nsoption_charp(use_pubscreen)); + scrn = LockPubScreen(nsoption_charp(pubscreen_name)); if(scrn == NULL) { @@ -673,8 +763,7 @@ void ami_openscreen(void) dri = GetScreenDrawInfo(scrn); ami_font_setdevicedpi(id); - gui_system_colour_finalize(); - gui_system_colour_init(); + ami_set_screen_defaults(scrn); //ami_help_new_screen(scrn); } @@ -688,6 +777,7 @@ void ami_openscreenfirst(void) static void gui_init2(int argc, char** argv) { + struct Screen *screen; nsurl *url; nserror error; struct browser_window *bw = NULL; @@ -707,6 +797,16 @@ static void gui_init2(int argc, char** argv) /* Treeview init code ends up calling a font function which needs this */ glob = &browserglob; + + /* ...and this ensures the treeview at least gets the WB colour palette to work with */ + if(scrn == NULL) { + if(screen = LockPubScreen("Workbench")) { + ami_set_screen_defaults(screen); + UnlockPubScreen(NULL, screen); + } + } else { + ami_set_screen_defaults(scrn); + } /**/ ami_hotlist_initialise(nsoption_charp(hotlist_file)); @@ -817,7 +917,7 @@ static void gui_init2(int argc, char** argv) } } - nsoption_setnull_charp(homepage_url, (char *)strdup(NETSURF_HOMEPAGE)); + nsoption_setnull_charp(homepage_url, (char *)strdup(NETSURF_HOMEPAGE)); if(!notalreadyrunning) { @@ -833,7 +933,6 @@ static void gui_init2(int argc, char** argv) sendcmd = ASPrintf("OPEN \"%s\" NEW",nsoption_charp(homepage_url)); } IDoMethod(arexx_obj,AM_EXECUTE,sendcmd,"NETSURF",NULL,NULL,NULL,NULL); - IDoMethod(arexx_obj,AM_EXECUTE,"TOFRONT","NETSURF",NULL,NULL,NULL,NULL); FreeVec(sendcmd); netsurf_quit=true; @@ -906,7 +1005,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); @@ -918,9 +1017,6 @@ int main(int argc, char** argv) current_user_options = ASPrintf("%s/Choices", current_user_dir); - if(ami_locate_resource(messages, "Messages") == false) - die("Cannot open Messages file"); - ami_mime_init("PROGDIR:Resources/mimetypes"); sprintf(temp, "%s/mimetypes.user", current_user_dir); ami_mime_init(temp); @@ -930,7 +1026,26 @@ int main(int argc, char** argv) amiga_plugin_hack_init(); amiga_datatypes_init(); - netsurf_init(&argc, &argv, current_user_options, messages); + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(NULL, &argc, argv); + + /* 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); + + if(ami_locate_resource(messages, "Messages") == false) + die("Cannot open Messages file"); + + ret = netsurf_init(messages); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } amiga_icon_init(); @@ -3119,7 +3234,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, CLICKTAB_Labels, &g->shared->tab_list, TAG_DONE); - if(nsoption_bool(new_tab_active)) + if(nsoption_bool(new_tab_is_active)) { RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],g->shared->win,NULL, CLICKTAB_Current,g->tab, @@ -3132,7 +3247,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, g->shared->tabs++; g->shared->next_tab++; - if(nsoption_bool(new_tab_active)) ami_switch_tab(g->shared,false); + if(nsoption_bool(new_tab_is_active)) ami_switch_tab(g->shared,false); ami_update_buttons(g->shared); @@ -3175,9 +3290,9 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, ULONG addtabclosegadget = TAG_IGNORE; ULONG iconifygadget = FALSE; - if (nsoption_charp(use_pubscreen) && + if (nsoption_charp(pubscreen_name) && (locked_screen == TRUE) && - (strcmp(nsoption_charp(use_pubscreen), "Workbench") == 0)) + (strcmp(nsoption_charp(pubscreen_name), "Workbench") == 0)) iconifygadget = TRUE; ami_create_menu(g->shared); @@ -3630,6 +3745,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, if(locked_screen) UnlockPubScreen(NULL,scrn); search_web_retrieve_ico(false); + ScreenToFront(scrn); + return g; } @@ -3669,7 +3786,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)); @@ -4425,12 +4542,17 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, void gui_window_update_extent(struct gui_window *g) { - struct IBox *bbox; + struct IBox *bbox, zbox; ULONG cur_tab = 0; if(!g) return; if(!g->shared->bw->current_content) return; - + /* + zbox.Top = ~0; + zbox.Left = ~0; + zbox.Width = (WORD)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale); + zbox.Height = (WORD)(content_get_height(g->shared->bw->current_content) * g->shared->bw->scale); + */ if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current, g->shared->objects[GID_TABS], (ULONG *)&cur_tab); @@ -4460,7 +4582,7 @@ void gui_window_update_extent(struct gui_window *g) SCROLLER_Visible, bbox->Width, TAG_DONE); } - + //SetWindowAttr(g->shared->win, WA_Zoom, &zbox, sizeof(ULONG)); } g->shared->new_content = true; } diff --git a/amiga/gui.h b/amiga/gui.h index 342c9f7f5..36b7d4d84 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -99,6 +99,7 @@ struct gui_window_2 { bool new_content; bool redraw_scheduled; char *menulab[AMI_MENU_AREXX_MAX + 1]; + Object *menuobj[AMI_MENU_AREXX_MAX + 1]; char menukey[AMI_MENU_AREXX_MAX + 1]; struct Hook menu_hook[AMI_MENU_AREXX_MAX + 1]; UBYTE *menutype; diff --git a/amiga/gui_options.c b/amiga/gui_options.c index 96ac2e416..a1bd2914b 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> @@ -96,6 +96,7 @@ enum GID_OPTS_PROXY_PORT, GID_OPTS_PROXY_USER, GID_OPTS_PROXY_PASS, + GID_OPTS_PROXY_BYPASS, GID_OPTS_FETCHMAX, GID_OPTS_FETCHHOST, GID_OPTS_FETCHCACHE, @@ -278,6 +279,7 @@ void ami_gui_opts_setup(void) gadlab[GID_OPTS_PROXY_HOST] = (char *)ami_utf8_easy((char *)messages_get("Host")); gadlab[GID_OPTS_PROXY_USER] = (char *)ami_utf8_easy((char *)messages_get("Username")); gadlab[GID_OPTS_PROXY_PASS] = (char *)ami_utf8_easy((char *)messages_get("Password")); + gadlab[GID_OPTS_PROXY_BYPASS] = (char *)ami_utf8_easy((char *)messages_get("ProxyBypass")); gadlab[GID_OPTS_FETCHMAX] = (char *)ami_utf8_easy((char *)messages_get("FetchesMax")); gadlab[GID_OPTS_FETCHHOST] = (char *)ami_utf8_easy((char *)messages_get("FetchesHost")); gadlab[GID_OPTS_FETCHCACHE] = (char *)ami_utf8_easy((char *)messages_get("FetchesCached")); @@ -401,7 +403,7 @@ void ami_gui_opts_open(void) ULONG screenmodeid = 0; ULONG proxytype = 0; BOOL screenmodedisabled = FALSE, screennamedisabled = FALSE; - BOOL proxyhostdisabled = TRUE, proxyauthdisabled = TRUE; + BOOL proxyhostdisabled = TRUE, proxyauthdisabled = TRUE, proxybypassdisabled = FALSE; BOOL disableanims, animspeeddisabled = FALSE, acceptlangdisabled = FALSE; BOOL scaleselected = nsoption_bool(scale_quality), scaledisabled = FALSE; BOOL download_notify_disabled = FALSE; @@ -415,9 +417,9 @@ void ami_gui_opts_open(void) return; } - if(nsoption_charp(use_pubscreen)) + if(nsoption_charp(pubscreen_name)) { - if(strcmp(nsoption_charp(use_pubscreen),"Workbench") == 0) + if(strcmp(nsoption_charp(pubscreen_name),"Workbench") == 0) { screenoptsselected = 1; screennamedisabled = TRUE; @@ -435,12 +437,13 @@ void ami_gui_opts_open(void) screennamedisabled = TRUE; } - if((nsoption_charp(modeid)) && (strncmp(nsoption_charp(modeid),"0x",2) == 0)) + if((nsoption_charp(screen_modeid)) && + (strncmp(nsoption_charp(screen_modeid),"0x",2) == 0)) { - screenmodeid = strtoul(nsoption_charp(modeid),NULL,0); + screenmodeid = strtoul(nsoption_charp(screen_modeid),NULL,0); } - if(nsoption_bool(http_proxy)) + if(nsoption_bool(http_proxy) == true) { proxytype = nsoption_int(http_proxy_auth) + 1; switch(nsoption_int(http_proxy_auth)) @@ -452,6 +455,8 @@ void ami_gui_opts_open(void) proxyhostdisabled = FALSE; break; } + } else { + proxybypassdisabled = TRUE; } sprintf(animspeed,"%.2f",(float)(nsoption_int(minimum_gif_delay)/100.0)); @@ -579,7 +584,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, @@ -693,7 +698,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_SCREENNAME, GA_RelVerify, TRUE, GA_Disabled,screennamedisabled, - STRINGA_TextVal, nsoption_bool(use_pubscreen), + STRINGA_TextVal, nsoption_charp(pubscreen_name), STRINGA_BufferPos,0, StringEnd, LayoutEnd, @@ -743,7 +748,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_PTROS, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_PTROS], - GA_Selected, nsoption_bool(use_os_pointers), + GA_Selected, nsoption_bool(os_mouse_pointers), CheckBoxEnd, LayoutEnd, // mouse CHILD_WeightedHeight,0, @@ -818,6 +823,16 @@ void ami_gui_opts_open(void) CHILD_Label, LabelObject, LABEL_Text, gadlab[GID_OPTS_PROXY_PASS], LabelEnd, + LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY_BYPASS] = StringObject, + GA_ID, GID_OPTS_PROXY_BYPASS, + GA_RelVerify, TRUE, + GA_Disabled, proxybypassdisabled, + STRINGA_TextVal, nsoption_charp(http_proxy_noproxy), + STRINGA_BufferPos, 0, + StringEnd, + CHILD_Label, LabelObject, + LABEL_Text, gadlab[GID_OPTS_PROXY_BYPASS], + LabelEnd, LayoutEnd, // proxy CHILD_WeightedHeight, 0, LAYOUT_AddChild,VGroupObject, @@ -942,7 +957,7 @@ void ami_gui_opts_open(void) LAYOUT_AddChild, gow->objects[GID_OPTS_DPI_Y] = IntegerObject, GA_ID, GID_OPTS_DPI_Y, GA_RelVerify, TRUE, - INTEGER_Number, nsoption_int(amiga_ydpi), + INTEGER_Number, nsoption_int(screen_ydpi), INTEGER_Minimum, 60, INTEGER_Maximum, 150, INTEGER_Arrows, TRUE, @@ -1163,7 +1178,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_TAB_ACTIVE, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_TAB_ACTIVE], - GA_Selected, !nsoption_bool(new_tab_active), + GA_Selected, !nsoption_bool(new_tab_is_active), CheckBoxEnd, LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_LAST] = CheckBoxObject, GA_ID, GID_OPTS_TAB_LAST, @@ -1274,7 +1289,7 @@ void ami_gui_opts_open(void) GA_ID, GID_OPTS_CLIPBOARD, GA_RelVerify, TRUE, GA_Text, gadlab[GID_OPTS_CLIPBOARD], - GA_Selected, nsoption_bool(utf8_clipboard), + GA_Selected, nsoption_bool(clipboard_write_utf8), CheckBoxEnd, LayoutEnd, // clipboard CHILD_WeightedHeight, 0, @@ -1531,9 +1546,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)); @@ -1572,16 +1587,16 @@ void ami_gui_opts_use(bool save) switch(data) { case 0: - nsoption_set_charp(use_pubscreen, strdup("\0")); + nsoption_set_charp(pubscreen_name, strdup("\0")); break; case 1: - nsoption_set_charp(use_pubscreen, (char *)strdup("Workbench")); + nsoption_set_charp(pubscreen_name, (char *)strdup("Workbench")); break; case 2: GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_SCREENNAME],(ULONG *)&data); - nsoption_set_charp(use_pubscreen, (char *)strdup((char *)data)); + nsoption_set_charp(pubscreen_name, (char *)strdup((char *)data)); break; } @@ -1590,7 +1605,7 @@ void ami_gui_opts_use(bool save) { char *modeid = malloc(20); sprintf(modeid,"0x%lx", id); - nsoption_set_charp(modeid, modeid); + nsoption_set_charp(screen_modeid, modeid); } GetAttr(GA_Selected,gow->objects[GID_OPTS_WIN_SIMPLE],(ULONG *)&data); @@ -1614,9 +1629,9 @@ void ami_gui_opts_use(bool save) GetAttr(GA_Selected,gow->objects[GID_OPTS_PTROS],(ULONG *)&data); if (data) { - nsoption_set_bool(use_os_pointers, true); + nsoption_set_bool(os_mouse_pointers, true); } else { - nsoption_set_bool(use_os_pointers, false); + nsoption_set_bool(os_mouse_pointers, false); } GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_PROXY],(ULONG *)&data); @@ -1641,6 +1656,9 @@ void ami_gui_opts_use(bool save) GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_PASS],(ULONG *)&data); nsoption_set_charp(http_proxy_auth_pass, (char *)strdup((char *)data)); + GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_BYPASS],(ULONG *)&data); + nsoption_set_charp(http_proxy_noproxy, (char *)strdup((char *)data)); + GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHMAX],(ULONG *)&nsoption_int(max_fetchers)); GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHHOST],(ULONG *)&nsoption_int(max_fetchers_per_host)); GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHCACHE],(ULONG *)&nsoption_int(max_cached_fetch_handles)); @@ -1667,7 +1685,7 @@ void ami_gui_opts_use(bool save) nsoption_set_bool(animate_images, true); } - GetAttr(INTEGER_Number,gow->objects[GID_OPTS_DPI_Y],(ULONG *)&nsoption_int(amiga_ydpi)); + GetAttr(INTEGER_Number,gow->objects[GID_OPTS_DPI_Y],(ULONG *)&nsoption_int(screen_ydpi)); ami_font_setdevicedpi(id); // id set above GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_SANS],(ULONG *)&data); @@ -1740,9 +1758,9 @@ void ami_gui_opts_use(bool save) GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_ACTIVE],(ULONG *)&data); if (data) { - nsoption_set_bool(new_tab_active, false); + nsoption_set_bool(new_tab_is_active, false); } else { - nsoption_set_bool(new_tab_active, true); + nsoption_set_bool(new_tab_is_active, true); } GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_LAST],(ULONG *)&data); @@ -1784,9 +1802,9 @@ void ami_gui_opts_use(bool save) GetAttr(GA_Selected,gow->objects[GID_OPTS_CLIPBOARD],(ULONG *)&data); if (data) { - nsoption_set_bool(utf8_clipboard, true); + nsoption_set_bool(clipboard_write_utf8, true); } else { - nsoption_set_bool(utf8_clipboard, false); + nsoption_set_bool(clipboard_write_utf8, false); } GetAttr(GA_Selected,gow->objects[GID_OPTS_CONTEXTMENU],(ULONG *)&data); @@ -1817,6 +1835,7 @@ void ami_gui_opts_use(bool save) nsoption_set_bool(hide_docky_icon, true); } +#ifdef WITH_PDF_EXPORT GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_TOP],(ULONG *)&nsoption_int(margin_top)); GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_LEFT],(ULONG *)&nsoption_int(margin_left)); @@ -1861,6 +1880,7 @@ void ami_gui_opts_use(bool save) } else { nsoption_set_bool(enable_PDF_password, false); } +#endif if(rescan_fonts == true) { ami_font_finiscanner(); @@ -1868,7 +1888,7 @@ void ami_gui_opts_use(bool save) } if(save == true) { - nsoption_write(current_user_options); + nsoption_write(current_user_options, NULL, NULL); ami_font_savescanner(); /* just in case it has changed and been used only */ } @@ -2010,6 +2030,8 @@ BOOL ami_gui_opts_event(void) gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS], gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); + RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS], + gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); break; case 1: RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_HOST], @@ -2021,6 +2043,8 @@ BOOL ami_gui_opts_event(void) gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS], gow->win,NULL, GA_Disabled, TRUE, TAG_DONE); + RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS], + gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); break; case 2: @@ -2034,6 +2058,8 @@ BOOL ami_gui_opts_event(void) gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS], gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); + RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS], + gow->win,NULL, GA_Disabled, FALSE, TAG_DONE); break; } break; diff --git a/amiga/launch.c b/amiga/launch.c index 20505f3bc..3236e797b 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 c710bffac..3e9ac9708 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-9 Chris Young <chris@unsatisfactorysoftware.co.uk> + * Copyright 2008-9,2013 Chris Young <chris@unsatisfactorysoftware.co.uk> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -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" @@ -60,28 +60,17 @@ #include "desktop/hotlist.h" #include "desktop/browser_private.h" #include "desktop/gui.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "utils/messages.h" #include "utils/schedule.h" -#define IMAGE_MENU_ITEM(n, i, t) \ - gwin->menulab[n] = LabelObject, \ - LABEL_DrawInfo, dri, \ - LABEL_Image, BitMapObject, \ - BITMAP_Screen, scrn, \ - BITMAP_SourceFile, i, \ - BitMapEnd, \ - LABEL_Text, t, \ - LabelEnd; - BOOL menualreadyinit; const char * const netsurf_version; const char * const verdate; -ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin); +ULONG ami_menu_scan(struct tree *tree, struct gui_window_2 *gwin); void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen, - ULONG *item, bool count, struct gui_window_2 *gwin); + int *item, struct gui_window_2 *gwin); void ami_menu_arexx_scan(struct gui_window_2 *gwin); /* Functions for menu selections */ @@ -130,13 +119,11 @@ void ami_free_menulabs(struct gui_window_2 *gwin) { if(gwin->menutype[i] & MENU_IMAGE) { - //TODO: Free image structure - } - else - { - ami_utf8_free(gwin->menulab[i]); + DisposeObject(gwin->menuobj[i]); } + ami_utf8_free(gwin->menulab[i]); + if(i >= AMI_MENU_AREXX) { if(gwin->menu_hook[i].h_Data) free(gwin->menu_hook[i].h_Data); @@ -144,6 +131,7 @@ void ami_free_menulabs(struct gui_window_2 *gwin) } gwin->menulab[i] = NULL; + gwin->menuobj[i] = NULL; gwin->menukey[i] = 0; } @@ -154,6 +142,28 @@ void ami_free_menulabs(struct gui_window_2 *gwin) gwin->menu = NULL; } +static void ami_menu_alloc_item(struct gui_window_2 *gwin, int num, UBYTE type, + const char *label, char key, struct bitmap *bm, void *func, void *hookdata) +{ + gwin->menutype[num] = type; + + if((label == NM_BARLABEL) || (strcmp(label, "--") == 0)) { + gwin->menulab[num] = NM_BARLABEL; + } else { + if((num >= AMI_MENU_HOTLIST) && (num <= AMI_MENU_HOTLIST_MAX)) { + gwin->menulab[num] = ami_utf8_easy(label); + } else if((num >= AMI_MENU_AREXX) && (num <= AMI_MENU_AREXX_MAX)) { + gwin->menulab[num] = strdup(label); + } else { + gwin->menulab[num] = ami_utf8_easy(messages_get(label)); + } + } + + if(key) gwin->menukey[num] = key; + if(func) gwin->menu_hook[num].h_Entry = (HOOKFUNC)func; + if(hookdata) gwin->menu_hook[num].h_Data = hookdata; +} + void ami_init_menulabs(struct gui_window_2 *gwin) { int i; @@ -164,236 +174,111 @@ void ami_init_menulabs(struct gui_window_2 *gwin) { gwin->menutype[i] = NM_IGNORE; gwin->menulab[i] = NULL; + gwin->menuobj[i] = NULL; } - gwin->menutype[0] = NM_TITLE; - gwin->menulab[0] = ami_utf8_easy((char *)messages_get("Project")); - - gwin->menutype[1] = NM_ITEM; - gwin->menulab[1] = ami_utf8_easy((char *)messages_get("NewWindowNS")); - gwin->menukey[1] = 'N'; - gwin->menu_hook[1].h_Entry = (HOOKFUNC)ami_menu_item_project_newwin; - - gwin->menutype[2] = NM_ITEM; - gwin->menulab[2] = ami_utf8_easy((char *)messages_get("NewTab")); - gwin->menukey[2] = 'T'; - gwin->menu_hook[2].h_Entry = (HOOKFUNC)ami_menu_item_project_newtab; - - gwin->menutype[3] = NM_ITEM; - gwin->menulab[3] = NM_BARLABEL; - - gwin->menutype[4] = NM_ITEM; - gwin->menulab[4] = ami_utf8_easy((char *)messages_get("OpenFile")); - gwin->menukey[4] = 'O'; - gwin->menu_hook[4].h_Entry = (HOOKFUNC)ami_menu_item_project_open; - - gwin->menutype[5] = NM_ITEM; - gwin->menulab[5] = ami_utf8_easy((char *)messages_get("SaveAsNS")); - - gwin->menutype[6] = NM_SUB; - gwin->menulab[6] = ami_utf8_easy((char *)messages_get("Source")); - gwin->menukey[6] = 'S'; - gwin->menu_hook[6].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[6].h_Data = AMINS_SAVE_SOURCE; - - gwin->menutype[7] = NM_SUB; - gwin->menulab[7] = ami_utf8_easy((char *)messages_get("TextNS")); - gwin->menu_hook[7].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[7].h_Data = (void *)AMINS_SAVE_TEXT; - - gwin->menutype[8] = NM_SUB; - gwin->menulab[8] = ami_utf8_easy((char *)messages_get("SaveCompNS")); - gwin->menu_hook[8].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[8].h_Data = (void *)AMINS_SAVE_COMPLETE; - - gwin->menutype[9] = NM_SUB; - gwin->menulab[9] = ami_utf8_easy((char *)messages_get("PDFNS")); - gwin->menu_hook[9].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[9].h_Data = (void *)AMINS_SAVE_PDF; - - gwin->menutype[10] = NM_SUB; - gwin->menulab[10] = ami_utf8_easy((char *)messages_get("IFF")); - gwin->menu_hook[10].h_Entry = (HOOKFUNC)ami_menu_item_project_save; - gwin->menu_hook[10].h_Data = (void *)AMINS_SAVE_IFF; - - gwin->menutype[11] = NM_ITEM; - gwin->menulab[11] = NM_BARLABEL; - - gwin->menutype[12] = NM_ITEM; - gwin->menulab[12] = ami_utf8_easy((char *)messages_get("CloseTab")); - gwin->menukey[12] = 'K'; - gwin->menu_hook[12].h_Entry = (HOOKFUNC)ami_menu_item_project_closetab; - - gwin->menutype[13] = NM_ITEM; - gwin->menulab[13] = ami_utf8_easy((char *)messages_get("CloseWindow")); - gwin->menu_hook[13].h_Entry = (HOOKFUNC)ami_menu_item_project_closewin; - - gwin->menutype[14] = NM_ITEM; - gwin->menulab[14] = NM_BARLABEL; - - gwin->menutype[15] = NM_ITEM; - gwin->menulab[15] = ami_utf8_easy((char *)messages_get("PrintNS")); - gwin->menukey[15] = 'P'; - gwin->menu_hook[15].h_Entry = (HOOKFUNC)ami_menu_item_project_print; - - gwin->menutype[16] = NM_ITEM; - gwin->menulab[16] = NM_BARLABEL; - - gwin->menutype[17] = NM_ITEM; - gwin->menulab[17] = ami_utf8_easy((char *)messages_get("About")); - gwin->menukey[17] = '?'; - gwin->menu_hook[17].h_Entry = (HOOKFUNC)ami_menu_item_project_about; - - gwin->menutype[18] = NM_ITEM; - gwin->menulab[18] = ami_utf8_easy((char *)messages_get("Quit")); - gwin->menukey[18] = 'Q'; - gwin->menu_hook[18].h_Entry = (HOOKFUNC)ami_menu_item_project_quit; - - gwin->menutype[19] = NM_TITLE; - gwin->menulab[19] = ami_utf8_easy((char *)messages_get("Edit")); - - gwin->menutype[20] = NM_ITEM; - gwin->menulab[20] = ami_utf8_easy((char *)messages_get("CutNS")); - gwin->menukey[20] = 'X'; - gwin->menu_hook[20].h_Entry = (HOOKFUNC)ami_menu_item_edit_cut; - - gwin->menutype[21] = NM_ITEM; - gwin->menulab[21] = ami_utf8_easy((char *)messages_get("CopyNS")); - gwin->menukey[21] = 'C'; - gwin->menu_hook[21].h_Entry = (HOOKFUNC)ami_menu_item_edit_copy; - - gwin->menutype[22] = NM_ITEM; - gwin->menulab[22] = ami_utf8_easy((char *)messages_get("PasteNS")); - gwin->menukey[22] = 'V'; - gwin->menu_hook[22].h_Entry = (HOOKFUNC)ami_menu_item_edit_paste; - - gwin->menutype[23] = NM_ITEM; - gwin->menulab[23] = NM_BARLABEL; - - gwin->menutype[24] = NM_ITEM; - gwin->menulab[24] = ami_utf8_easy((char *)messages_get("SelectAllNS")); - gwin->menukey[24] = 'A'; - gwin->menu_hook[24].h_Entry = (HOOKFUNC)ami_menu_item_edit_selectall; - - gwin->menutype[25] = NM_ITEM; - gwin->menulab[25] = ami_utf8_easy((char *)messages_get("ClearNS")); - gwin->menukey[25] = 'Z'; - gwin->menu_hook[25].h_Entry = (HOOKFUNC)ami_menu_item_edit_clearsel; - - gwin->menutype[26] = NM_TITLE; - gwin->menulab[26] = ami_utf8_easy((char *)messages_get("Browser")); - - gwin->menutype[27] = NM_ITEM; - gwin->menulab[27] = ami_utf8_easy((char *)messages_get("FindTextNS")); - gwin->menukey[27] = 'F'; - gwin->menu_hook[27].h_Entry = (HOOKFUNC)ami_menu_item_browser_find; - - gwin->menutype[28] = NM_ITEM; - gwin->menulab[28] = NM_BARLABEL; - - gwin->menutype[29] = NM_ITEM; - gwin->menulab[29] = ami_utf8_easy((char *)messages_get("HistLocalNS")); - gwin->menu_hook[29].h_Entry = (HOOKFUNC)ami_menu_item_browser_localhistory; - - gwin->menutype[30] = NM_ITEM; - gwin->menulab[30] = ami_utf8_easy((char *)messages_get("HistGlobalNS")); - gwin->menu_hook[30].h_Entry = (HOOKFUNC)ami_menu_item_browser_globalhistory; - - gwin->menutype[31] = NM_ITEM; - gwin->menulab[31] = NM_BARLABEL; - - gwin->menutype[32] = NM_ITEM; - gwin->menulab[32] = ami_utf8_easy((char *)messages_get("ShowCookies")); - gwin->menu_hook[32].h_Entry = (HOOKFUNC)ami_menu_item_browser_cookies; - - gwin->menutype[33] = NM_ITEM; - gwin->menulab[33] = NM_BARLABEL; - - gwin->menutype[34] = NM_ITEM; - gwin->menulab[34] = ami_utf8_easy((char *)messages_get("ScaleNS")); - - gwin->menutype[35] = NM_SUB; - gwin->menulab[35] = ami_utf8_easy((char *)messages_get("ScaleDec")); - gwin->menukey[35] = '-'; - gwin->menu_hook[35].h_Entry = (HOOKFUNC)ami_menu_item_browser_scale_decrease; - - gwin->menutype[36] = NM_SUB; - gwin->menulab[36] = ami_utf8_easy((char *)messages_get("ScaleNorm")); - gwin->menukey[36] = '='; - gwin->menu_hook[36].h_Entry = (HOOKFUNC)ami_menu_item_browser_scale_normal; - - gwin->menutype[37] = NM_SUB; - gwin->menulab[37] = ami_utf8_easy((char *)messages_get("ScaleInc")); - gwin->menukey[37] = '+'; - gwin->menu_hook[37].h_Entry = (HOOKFUNC)ami_menu_item_browser_scale_increase; - - gwin->menutype[38] = NM_ITEM; - gwin->menulab[38] = ami_utf8_easy((char *)messages_get("Images")); - - gwin->menutype[39] = NM_SUB; - gwin->menulab[39] = ami_utf8_easy((char *)messages_get("ForeImg")); - gwin->menu_hook[39].h_Entry = (HOOKFUNC)ami_menu_item_browser_foreimg; - - gwin->menutype[40] = NM_SUB; - gwin->menulab[40] = ami_utf8_easy((char *)messages_get("BackImg")); - gwin->menu_hook[40].h_Entry = (HOOKFUNC)ami_menu_item_browser_backimg; - - gwin->menutype[41] = NM_ITEM; - gwin->menulab[41] = ami_utf8_easy((char *)messages_get("EnableJS")); - gwin->menu_hook[41].h_Entry = (HOOKFUNC)ami_menu_item_browser_enablejs; - - gwin->menutype[42] = NM_ITEM; - gwin->menulab[42] = NM_BARLABEL; - - gwin->menutype[43] = NM_ITEM; - gwin->menulab[43] = ami_utf8_easy((char *)messages_get("Redraw")); - gwin->menu_hook[43].h_Entry = (HOOKFUNC)ami_menu_item_browser_redraw; - - gwin->menutype[44] = NM_TITLE; - gwin->menulab[44] = ami_utf8_easy((char *)messages_get("Hotlist")); - - gwin->menutype[45] = NM_ITEM; - gwin->menulab[45] = ami_utf8_easy((char *)messages_get("HotlistAdd")); - gwin->menukey[45] = 'B'; - gwin->menu_hook[45].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_add; - - gwin->menutype[46] = NM_ITEM; - gwin->menulab[46] = ami_utf8_easy((char *)messages_get("HotlistShowNS")); - gwin->menukey[46] = 'H'; - gwin->menu_hook[46].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_show; - - gwin->menutype[47] = NM_ITEM; - gwin->menulab[47] = NM_BARLABEL; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 1] = NM_TITLE; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 1] = ami_utf8_easy((char *)messages_get("Settings")); - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 2] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 2] = ami_utf8_easy((char *)messages_get("SettingsEdit")); - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 2].h_Entry = (HOOKFUNC)ami_menu_item_settings_edit; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 3] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 3] = NM_BARLABEL; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 4] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 4] = ami_utf8_easy((char *)messages_get("SnapshotWindow")); - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 4].h_Entry = (HOOKFUNC)ami_menu_item_settings_snapshot; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 5] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 5] = ami_utf8_easy((char *)messages_get("SettingsSave")); - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 5].h_Entry = (HOOKFUNC)ami_menu_item_settings_save; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 6] = NM_TITLE; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 6] = ami_utf8_easy((char *)messages_get("ARexx")); - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 7] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 7] = ami_utf8_easy((char *)messages_get("ARexxExecute")); - gwin->menukey[AMI_MENU_HOTLIST_MAX + 7] = 'E'; - gwin->menu_hook[AMI_MENU_HOTLIST_MAX + 7].h_Entry = (HOOKFUNC)ami_menu_item_arexx_execute; - - gwin->menutype[AMI_MENU_HOTLIST_MAX + 8] = NM_ITEM; - gwin->menulab[AMI_MENU_HOTLIST_MAX + 8] = NM_BARLABEL; - + ami_menu_alloc_item(gwin, M_PROJECT, NM_TITLE, "Project", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_NEWWIN, NM_ITEM, "NewWindowNS", 'N', NULL, + ami_menu_item_project_newwin, NULL); + ami_menu_alloc_item(gwin, M_NEWTAB, NM_ITEM, "NewTab", 'T', NULL, + ami_menu_item_project_newtab, NULL); + ami_menu_alloc_item(gwin, M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_OPEN, NM_ITEM, "OpenFile", 'O', NULL, + ami_menu_item_project_open, NULL); + ami_menu_alloc_item(gwin, M_SAVEAS, NM_ITEM, "SaveAsNS", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SAVESRC, NM_SUB, "Source", 'S', NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_SOURCE); + ami_menu_alloc_item(gwin, M_SAVETXT, NM_SUB, "TextNS", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_TEXT); + ami_menu_alloc_item(gwin, M_SAVECOMP, NM_SUB, "SaveCompNS", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_COMPLETE); +#ifdef WITH_PDF_EXPORT + ami_menu_alloc_item(gwin, M_SAVEPDF, NM_SUB, "PDFNS", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_PDF); +#endif + ami_menu_alloc_item(gwin, M_SAVEIFF, NM_SUB, "IFF", 0, NULL, + ami_menu_item_project_save, (void *)AMINS_SAVE_IFF); + ami_menu_alloc_item(gwin, M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_CLOSETAB, NM_ITEM, "CloseTab", 'K', NULL, + ami_menu_item_project_closetab, NULL); + ami_menu_alloc_item(gwin, M_CLOSEWIN, NM_ITEM, "CloseWindow", 0, NULL, + ami_menu_item_project_closewin, NULL); + ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', NULL, + ami_menu_item_project_print, NULL); + ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_ABOUT, NM_ITEM, "About", '?', NULL, + ami_menu_item_project_about, NULL); + ami_menu_alloc_item(gwin, M_QUIT, NM_ITEM, "Quit", 'Q', NULL, + ami_menu_item_project_quit, NULL); + + ami_menu_alloc_item(gwin, M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_CUT, NM_ITEM, "CutNS", 'X', NULL, + ami_menu_item_edit_cut, NULL); + ami_menu_alloc_item(gwin, M_COPY, NM_ITEM, "CopyNS", 'C', NULL, + ami_menu_item_edit_copy, NULL); + ami_menu_alloc_item(gwin, M_PASTE, NM_ITEM, "PasteNS", 'V', NULL, + ami_menu_item_edit_paste, NULL); + ami_menu_alloc_item(gwin, M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SELALL, NM_ITEM, "SelectAllNS", 'A', NULL, + ami_menu_item_edit_selectall, NULL); + ami_menu_alloc_item(gwin, M_CLEAR, NM_ITEM, "ClearNS", 'Z', NULL, + ami_menu_item_edit_clearsel, NULL); + + ami_menu_alloc_item(gwin, M_BROWSER, NM_TITLE, "Browser", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_FIND, NM_ITEM, "FindTextNS", 'F', NULL, + ami_menu_item_browser_find, NULL); + ami_menu_alloc_item(gwin, M_BAR_B1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_HISTLOCL, NM_ITEM, "HistLocalNS", 0, NULL, + ami_menu_item_browser_localhistory, NULL); + ami_menu_alloc_item(gwin, M_HISTGLBL, NM_ITEM, "HistGlobalNS", 0, NULL, + ami_menu_item_browser_globalhistory, NULL); + ami_menu_alloc_item(gwin, M_BAR_B2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookies", 0, NULL, + ami_menu_item_browser_cookies, NULL); + ami_menu_alloc_item(gwin, M_BAR_B3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SCALE, NM_ITEM, "ScaleNS", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SCALEDEC, NM_SUB, "ScaleDec", '-', NULL, + ami_menu_item_browser_scale_decrease, NULL); + ami_menu_alloc_item(gwin, M_SCALENRM, NM_SUB, "ScaleNorm", '=', NULL, + ami_menu_item_browser_scale_normal, NULL); + ami_menu_alloc_item(gwin, M_SCALEDEC, NM_SUB, "ScaleDec", '-', NULL, + ami_menu_item_browser_scale_decrease, NULL); + ami_menu_alloc_item(gwin, M_SCALEINC, NM_SUB, "ScaleInc", '+', NULL, + ami_menu_item_browser_scale_increase, NULL); + ami_menu_alloc_item(gwin, M_IMAGES, NM_ITEM, "Images", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_IMGFORE, NM_SUB, "ForeImg", 0, NULL, + ami_menu_item_browser_foreimg, NULL); + ami_menu_alloc_item(gwin, M_IMGBACK, NM_SUB, "BackImg", 0, NULL, + ami_menu_item_browser_backimg, NULL); +#if defined(WITH_JS) || defined(WITH_MOZJS) + ami_menu_alloc_item(gwin, M_JS, NM_ITEM, "EnableJS", 0, NULL, + ami_menu_item_browser_enablejs, NULL); +#endif + ami_menu_alloc_item(gwin, M_BAR_B4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_REDRAW, NM_ITEM, "Redraw", 0, NULL, + ami_menu_item_browser_redraw, NULL); + + ami_menu_alloc_item(gwin, M_HOTLIST, NM_TITLE, "Hotlist", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_HLADD, NM_ITEM, "HotlistAdd", 'B', NULL, + ami_menu_item_hotlist_add, NULL); + ami_menu_alloc_item(gwin, M_HLSHOW, NM_ITEM,"HotlistShowNS",'H', NULL, + ami_menu_item_hotlist_show, NULL); + ami_menu_alloc_item(gwin, M_BAR_H1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + + ami_menu_alloc_item(gwin, M_PREFS, NM_TITLE, "Settings", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_PREDIT, NM_ITEM, "SettingsEdit", 0, NULL, + ami_menu_item_settings_edit, NULL); + ami_menu_alloc_item(gwin, M_BAR_S1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_SNAPSHOT, NM_ITEM, "SnapshotWindow",0, NULL, + ami_menu_item_settings_snapshot, NULL); + ami_menu_alloc_item(gwin, M_PRSAVE, NM_ITEM, "SettingsSave", 0, NULL, + ami_menu_item_settings_save, NULL); + + ami_menu_alloc_item(gwin, M_AREXX, NM_TITLE, "ARexx", 0, NULL, NULL, NULL); + ami_menu_alloc_item(gwin, M_AREXXEX, NM_ITEM, "ARexxExecute",'E', NULL, + ami_menu_item_arexx_execute, NULL); + ami_menu_alloc_item(gwin, M_BAR_A1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); gwin->menutype[AMI_MENU_AREXX_MAX] = NM_END; } @@ -416,47 +301,40 @@ struct NewMenu *ami_create_menu(struct gui_window_2 *gwin) { int i; - ami_init_menulabs(gwin); gwin->menu = AllocVec(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), MEMF_CLEAR); + ami_init_menulabs(gwin); + ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin); + ami_menu_arexx_scan(gwin); for(i=0;i<=AMI_MENU_AREXX_MAX;i++) { gwin->menu[i].nm_Type = gwin->menutype[i]; - gwin->menu[i].nm_Label = gwin->menulab[i]; + if(gwin->menuobj[i]) + gwin->menu[i].nm_Label = (void *)gwin->menuobj[i]; + else + gwin->menu[i].nm_Label = gwin->menulab[i]; + if(gwin->menukey[i]) gwin->menu[i].nm_CommKey = &gwin->menukey[i]; gwin->menu[i].nm_Flags = 0; if(gwin->menu_hook[i].h_Entry) gwin->menu[i].nm_UserData = &gwin->menu_hook[i]; } - gwin->menu[1].nm_Flags = 0; - gwin->menu[2].nm_Flags = 0; - gwin->menu[12].nm_Flags = 0; - gwin->menu[13].nm_Flags = 0; - -#ifndef WITH_PDF_EXPORT - gwin->menu[9].nm_Flags = NM_ITEMDISABLED; -#endif -#if !defined(WITH_JS) && !defined(WITH_MOZJS) - gwin->menu[41].nm_Flags = NM_ITEMDISABLED | CHECKIT | MENUTOGGLE; -#else - gwin->menu[41].nm_Flags = CHECKIT | MENUTOGGLE; +#if defined(WITH_JS) || defined(WITH_MOZJS) + gwin->menu[M_JS].nm_Flags = CHECKIT | MENUTOGGLE; if(nsoption_bool(enable_javascript) == true) - gwin->menu[41].nm_Flags |= CHECKED; + gwin->menu[M_JS].nm_Flags |= CHECKED; #endif - gwin->menu[15].nm_Flags = NM_ITEMDISABLED; + gwin->menu[M_PRINT].nm_Flags = NM_ITEMDISABLED; - gwin->menu[39].nm_Flags = CHECKIT | MENUTOGGLE; + gwin->menu[M_IMGFORE].nm_Flags = CHECKIT | MENUTOGGLE; if(nsoption_bool(foreground_images) == true) - gwin->menu[39].nm_Flags |= CHECKED; - gwin->menu[40].nm_Flags = CHECKIT | MENUTOGGLE; + gwin->menu[M_IMGFORE].nm_Flags |= CHECKED; + gwin->menu[M_IMGBACK].nm_Flags = CHECKIT | MENUTOGGLE; if(nsoption_bool(background_images) == true) - gwin->menu[40].nm_Flags |= CHECKED; - - ami_menu_scan(ami_tree_get_tree(hotlist_window), false, gwin); - ami_menu_arexx_scan(gwin); + gwin->menu[M_IMGBACK].nm_Flags |= CHECKED; -/* Set up scheduler to refresh the hotlist menu */ + /* Set up scheduler to refresh the hotlist menu */ if(nsoption_int(menu_refresh) > 0) schedule(nsoption_int(menu_refresh), (void *)ami_menu_refresh, gwin); @@ -472,6 +350,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin) char matchpatt[16]; LONG cont; struct ExAllData *ead; + char *menu_lab; if(lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK)) { @@ -499,18 +378,12 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin) { gwin->menu[item].nm_Type = NM_ITEM; if(ead->ed_Comment[0] != '\0') - { - gwin->menulab[item] = (char *)strdup(ead->ed_Comment); - } + menu_lab = ead->ed_Comment; else - { - gwin->menulab[item] = (char *)strdup(ead->ed_Name); - } + menu_lab = ead->ed_Name; - gwin->menu[item].nm_Label = gwin->menulab[item]; - gwin->menu_hook[item].h_Entry = (HOOKFUNC)ami_menu_item_arexx_entries; - gwin->menu_hook[item].h_Data = (char *)strdup(ead->ed_Name); - gwin->menu[item].nm_UserData = (HOOKFUNC)&gwin->menu_hook[item]; + ami_menu_alloc_item(gwin, item, NM_ITEM, menu_lab, 0, NULL, + ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name)); item++; } @@ -527,13 +400,13 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin) gwin->menu[item].nm_Label = NULL; } -ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) +ULONG ami_menu_scan(struct tree *tree, struct gui_window_2 *gwin) { struct node *root = tree_node_get_child(tree_get_root(tree)); struct node *node; struct node_element *element; WORD gen = 0; - ULONG item; + int item; item = AMI_MENU_HOTLIST; @@ -544,7 +417,7 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) if(element && (strcmp(tree_node_element_get_text(element), messages_get("HotlistMenu")) == 0)) { // found menu - ami_menu_scan_2(tree, tree_node_get_child(node), &gen, &item, count, gwin); + ami_menu_scan_2(tree, tree_node_get_child(node), &gen, &item, gwin); } } @@ -552,11 +425,12 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) } void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen, - ULONG *item, bool count, struct gui_window_2 *gwin) + int *item, struct gui_window_2 *gwin) { struct node *tempnode; struct node_element *element=NULL; struct node *node; + UBYTE menu_type; *gen = *gen + 1; @@ -564,37 +438,22 @@ void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen, { if((*gen > 0) && (*gen < 3)) { -// if(*item >= AMI_MENU_HOTLIST_MAX) return; + if(*item >= AMI_MENU_HOTLIST_MAX) return; - if(!count) - { - if(*gen == 1) gwin->menu[*item].nm_Type = NM_ITEM; - if(*gen == 2) gwin->menu[*item].nm_Type = NM_SUB; - - if(strcmp(tree_url_node_get_title(node),"--")) - { - gwin->menulab[*item] = ami_utf8_easy((char *)tree_url_node_get_title(node)); - } - else - { - gwin->menulab[*item] = NM_BARLABEL; - } + if(*gen == 1) menu_type = NM_ITEM; + if(*gen == 2) menu_type = NM_SUB; - gwin->menu[*item].nm_Label = gwin->menulab[*item]; - gwin->menu_hook[*item].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_entries; - gwin->menu_hook[*item].h_Data = (void *)tree_url_node_get_url(node); - gwin->menu[*item].nm_UserData = (HOOKFUNC)&gwin->menu_hook[*item]; - if(tree_node_is_folder(node) && (!tree_node_get_child(node))) - gwin->menu[*item].nm_Flags = NM_ITEMDISABLED; - } + ami_menu_alloc_item(gwin, *item, menu_type, tree_url_node_get_title(node), + 0, tree_url_node_get_icon(node), + ami_menu_item_hotlist_entries, (void *)tree_url_node_get_url(node)); + if(tree_node_is_folder(node) && (!tree_node_get_child(node))) + gwin->menu[*item].nm_Flags = NM_ITEMDISABLED; *item = *item + 1; } if (tree_node_get_child(node)) - { - ami_menu_scan_2(tree,tree_node_get_child(node),gen,item,count,gwin); - } + ami_menu_scan_2(tree, tree_node_get_child(node), gen, item, gwin); } *gen = *gen - 1; @@ -606,7 +465,7 @@ void ami_menu_update_checked(struct gui_window_2 *gwin) GetAttr(WINDOW_MenuStrip, gwin->objects[OID_MAIN], (ULONG *)&menustrip); if(!menustrip) return; - +#if defined(WITH_JS) || defined(WITH_MOZJS) if(nsoption_bool(enable_javascript) == true) { if((ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) == 0) ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED; @@ -614,7 +473,7 @@ void ami_menu_update_checked(struct gui_window_2 *gwin) if(ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED; } - +#endif if(nsoption_bool(foreground_images) == true) { if((ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED) == 0) ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^= CHECKED; @@ -640,11 +499,6 @@ void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c) if(nsoption_bool(kiosk_mode) == true) return; - OffMenu(win,AMI_MENU_CUT); - OffMenu(win,AMI_MENU_COPY); - OffMenu(win,AMI_MENU_PASTE); - OffMenu(win,AMI_MENU_CLEAR); - if(content_get_type(c) <= CONTENT_CSS) { OnMenu(win,AMI_MENU_SAVEAS_TEXT); @@ -656,25 +510,37 @@ void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c) { OnMenu(win,AMI_MENU_COPY); OnMenu(win,AMI_MENU_CLEAR); - - if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_CUT) - OnMenu(win,AMI_MENU_CUT); + } else { + OffMenu(win,AMI_MENU_COPY); + OffMenu(win,AMI_MENU_CLEAR); } - if(g->c_h) OnMenu(win,AMI_MENU_PASTE); + + if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_CUT) + OnMenu(win,AMI_MENU_CUT); + else + OffMenu(win,AMI_MENU_CUT); + + if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_PASTE) + OnMenu(win,AMI_MENU_PASTE); + else + OffMenu(win,AMI_MENU_PASTE); + OnMenu(win,AMI_MENU_SELECTALL); OnMenu(win,AMI_MENU_FIND); OffMenu(win,AMI_MENU_SAVEAS_IFF); } else { + OffMenu(win,AMI_MENU_CUT); + OffMenu(win,AMI_MENU_PASTE); + OffMenu(win,AMI_MENU_CLEAR); + OffMenu(win,AMI_MENU_SAVEAS_TEXT); OffMenu(win,AMI_MENU_SAVEAS_COMPLETE); #ifdef WITH_PDF_EXPORT OffMenu(win,AMI_MENU_SAVEAS_PDF); #endif - OffMenu(win,AMI_MENU_PASTE); OffMenu(win,AMI_MENU_SELECTALL); - OffMenu(win,AMI_MENU_CLEAR); OffMenu(win,AMI_MENU_FIND); #ifdef WITH_NS_SVG @@ -1073,7 +939,7 @@ static void ami_menu_item_settings_snapshot(struct Hook *hook, APTR window, stru static void ami_menu_item_settings_save(struct Hook *hook, APTR window, struct IntuiMessage *msg) { - nsoption_write(current_user_options); + nsoption_write(current_user_options, NULL, NULL); } static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct IntuiMessage *msg) @@ -1083,6 +949,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/menu.h b/amiga/menu.h index 8cff2d539..e96fcf0ee 100755 --- a/amiga/menu.h +++ b/amiga/menu.h @@ -23,38 +23,95 @@ #include <libraries/gadtools.h> #include "content/hlcache.h" -/* Number of hotlist items, menu structure needs to be changed in ami_create_menu() - * if this value is changed. */ +/* Maximum number of hotlist items (somewhat arbitrary value) */ #define AMI_HOTLIST_ITEMS 60 -//gwin->hotlist_items -/* Maximum number of menu items - first value is number of static items - * (ie. everything not intially defined as NM_IGNORE) */ -#define AMI_MENU_MAX 57 + AMI_HOTLIST_ITEMS - -/* Where the hotlist entries start */ -#define AMI_MENU_HOTLIST 48 - -/* Where the hotlist entries end */ -#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS - -/* Number of ARexx menu items. menu structure in ami_create_menu() needs to be - * changed if this value is modified. */ +/* Maximum number of ARexx menu items (somewhat arbitrary value) */ #define AMI_MENU_AREXX_ITEMS 20 -/* Where the ARexx menu items start. ARexx menu items are right at the end... - * for now, at least. We can get away with AMI_MENU_MAX falling short as it is - * only used for freeing the UTF-8 converted menu labels */ -#define AMI_MENU_AREXX AMI_MENU_MAX +/* enum menu structure, has to be here as we need it below. */ +enum { + /* Project menu */ + M_PROJECT = 0, + M_NEWWIN, + M_NEWTAB, + M_BAR_P1, + M_OPEN, + M_SAVEAS, + M_SAVESRC, + M_SAVETXT, + M_SAVECOMP, + M_SAVEIFF, +#ifdef WITH_PDF_EXPORT + M_SAVEPDF, +#endif + M_BAR_P2, + M_CLOSETAB, + M_CLOSEWIN, + M_BAR_P3, + M_PRINT, + M_BAR_P4, + M_ABOUT, + M_QUIT, + /* Edit menu */ + M_EDIT, + M_CUT, + M_COPY, + M_PASTE, + M_BAR_E1, + M_SELALL, + M_CLEAR, + /* Browser menu */ + M_BROWSER, + M_FIND, + M_BAR_B1, + M_HISTLOCL, + M_HISTGLBL, + M_BAR_B2, + M_COOKIES, + M_BAR_B3, + M_SCALE, + M_SCALEDEC, + M_SCALENRM, + M_SCALEINC, + M_IMAGES, + M_IMGFORE, + M_IMGBACK, +#if defined(WITH_JS) || defined(WITH_MOZJS) + M_JS, +#endif + M_BAR_B4, + M_REDRAW, + /* Hotlist menu */ + M_HOTLIST, + M_HLADD, + M_HLSHOW, + M_BAR_H1, // 47 + AMI_MENU_HOTLIST, /* Where the hotlist entries start */ + AMI_MENU_HOTLIST_MAX = AMI_MENU_HOTLIST + AMI_HOTLIST_ITEMS, + /* Settings menu */ + M_PREFS, + M_PREDIT, + M_BAR_S1, + M_SNAPSHOT, + M_PRSAVE, + /* ARexx menu */ + M_AREXX, + M_AREXXEX, + M_BAR_A1, + AMI_MENU_AREXX, + AMI_MENU_AREXX_MAX = AMI_MENU_AREXX + AMI_MENU_AREXX_ITEMS +}; -/* Where the ARexx menu items end (incidentally this is the real AMI_MENU_MAX) */ -#define AMI_MENU_AREXX_MAX AMI_MENU_AREXX+AMI_MENU_AREXX_ITEMS +/* We can get away with AMI_MENU_MAX falling short as it is + * only used for freeing the UTF-8 converted menu labels */ +#define AMI_MENU_MAX AMI_MENU_AREXX /* The Intuition menu numbers of some menus we might need to modify */ #define AMI_MENU_SAVEAS_TEXT FULLMENUNUM(0,4,1) #define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2) -#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,3) -#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,4) +#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3) +#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4) #define AMI_MENU_CLOSETAB FULLMENUNUM(0,6,0) #define AMI_MENU_CUT FULLMENUNUM(1,0,0) #define AMI_MENU_COPY FULLMENUNUM(1,1,0) diff --git a/amiga/options.h b/amiga/options.h index 822a7a3aa..b95ddf12d 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(pubscreen_name, 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, true) +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/amiga/pkg/makepackage b/amiga/pkg/makepackage index dcc130a6a..4f5eb84d8 100755 --- a/amiga/pkg/makepackage +++ b/amiga/pkg/makepackage @@ -27,8 +27,8 @@ makedir ram:NetSurf/SObjs copy sobjs:libjpeg.so.8 sobjs:libcurl.so.7 sobjs:librtmp.so.0 sobjs:libsvgtiny.so.0 sobjs:libssl.so.1.0.0 sobjs:libcrypto.so.1.0.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libpng12.so sobjs:libdom.so.0 sobjs:libhubbub.so.0 ram:NetSurf/SObjs clone ;sobjs:libhpdf-2.2.0.so.0.0 echo "Splitting Messages file" -perl utils/split-messages.pl de ami < resources/FatMessages >RAM:NetSurf/Resources/de/Messages -perl utils/split-messages.pl en ami < resources/FatMessages >RAM:NetSurf/Resources/en/Messages -perl utils/split-messages.pl fr ami < resources/FatMessages >RAM:NetSurf/Resources/fr/Messages -perl utils/split-messages.pl it ami < resources/FatMessages >RAM:NetSurf/Resources/it/Messages -perl utils/split-messages.pl nl ami < resources/FatMessages >RAM:NetSurf/Resources/nl/Messages +perl utils/split-messages.pl -l de -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/de/Messages +perl utils/split-messages.pl -l en -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/en/Messages +perl utils/split-messages.pl -l fr -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/fr/Messages +perl utils/split-messages.pl -l it -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/it/Messages +perl utils/split-messages.pl -l nl -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/nl/Messages diff --git a/amiga/plotters.c b/amiga/plotters.c index ace3c3b53..bf1c2bf69 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -22,7 +22,8 @@ #include "amiga/gui.h" #include "amiga/utf8.h" -#include "desktop/options.h" +#include "css/utils.h" +#include "utils/nsoption.h" #include "utils/utils.h" #include "utils/log.h" @@ -101,17 +102,6 @@ const struct plotter_table amiplot = { .option_knockout = true, }; -colour ami_abgr_to_argb(colour c) { - colour argb = 0x00000000; - - /* NB: We force the alpha byte to be 0xff, as it is not set by the core. */ - argb = 0xff000000 | - ((c & 0x00ff0000) >> 16) | - (c & 0x0000ff00) | - ((c & 0x000000ff) << 16); - - return argb; -} #ifdef NS_AMIGA_CAIRO void ami_cairo_set_colour(cairo_t *cr,colour c) @@ -155,19 +145,15 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) * Also applies to the further gfx/layers functions and memory below */ ULONG depth = 32; - struct DrawInfo *dri; - struct BitMap *friend = NULL; /* Required to be NULL for Cairo and ARGB bitmaps */ + struct BitMap *friend = NULL; depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); if((depth < 16) || (nsoption_int(cairo_renderer) == -1)) { palette_mapped = true; - // friend = scrn->RastPort.BitMap; } else { palette_mapped = false; } - if(nsoption_int(redraw_tile_size_x) <= 0) nsoption_set_int(redraw_tile_size_x, scrn->Width); - if(nsoption_int(redraw_tile_size_y) <= 0) nsoption_set_int(redraw_tile_size_y, scrn->Height); if(!width) width = nsoption_int(redraw_tile_size_x); if(!height) height = nsoption_int(redraw_tile_size_y); @@ -297,7 +283,7 @@ static void ami_plot_setapen(ULONG colour) { if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_APenColor, - ami_abgr_to_argb(colour), + ns_color_to_nscss(colour), TAG_DONE); } else { ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour); @@ -309,7 +295,7 @@ static void ami_plot_setopen(ULONG colour) { if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_OPenColor, - ami_abgr_to_argb(colour), + ns_color_to_nscss(colour), TAG_DONE); } else { ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour); diff --git a/amiga/print.c b/amiga/print.c index ec04c6229..f0689f73a 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/search.c b/amiga/search.c index 12fe582cb..18ea27fce 100755 --- a/amiga/search.c +++ b/amiga/search.c @@ -29,7 +29,6 @@ #include "desktop/browser.h" #include "desktop/gui.h" #include "desktop/search.h" -#include "desktop/selection.h" #include "utils/log.h" #include "utils/messages.h" #include "utils/utils.h" @@ -86,15 +85,11 @@ static struct gui_search_callbacks ami_search_callbacks = { */ void ami_search_open(struct gui_window *gwin) { - if (browser_window_search_create_context(gwin->shared->bw, - &ami_search_callbacks, NULL) == false) - return; - search_insert = true; if(fwin) { - browser_window_search_destroy_context(fwin->gwin->shared->bw); + browser_window_search_clear(fwin->gwin->shared->bw); ami_search_set_forward_state(true, NULL); ami_search_set_back_state(true, NULL); fwin->gwin->shared->searchwin = NULL; @@ -181,7 +176,7 @@ void ami_search_open(struct gui_window *gwin) void ami_search_close(void) { - browser_window_search_destroy_context(fwin->gwin->shared->bw); + browser_window_search_clear(fwin->gwin->shared->bw); ami_search_set_forward_state(true, NULL); ami_search_set_back_state(true, NULL); fwin->gwin->shared->searchwin = NULL; @@ -206,7 +201,7 @@ BOOL ami_search_event(void) switch(result & WMHI_GADGETMASK) { case GID_SEARCHSTRING: - browser_window_search_destroy_context( + browser_window_search_clear( fwin->gwin->shared->bw); ami_search_set_forward_state( true, NULL); @@ -229,13 +224,10 @@ BOOL ami_search_event(void) search_insert = true; flags = SEARCH_FLAG_FORWARDS | ami_search_flags(); - if (browser_window_search_verify_new( + browser_window_search( fwin->gwin->shared->bw, - &ami_search_callbacks, NULL)) - browser_window_search_step( - fwin->gwin->shared->bw, - flags, - ami_search_string()); + &ami_search_callbacks, NULL, + flags, ami_search_string()); ActivateWindow(fwin->gwin->shared->win); break; @@ -243,13 +235,10 @@ BOOL ami_search_event(void) search_insert = true; flags = ~SEARCH_FLAG_FORWARDS & ami_search_flags(); - if (browser_window_search_verify_new( + browser_window_search( fwin->gwin->shared->bw, - &ami_search_callbacks, NULL)) - browser_window_search_step( - fwin->gwin->shared->bw, - flags, - ami_search_string()); + &ami_search_callbacks, NULL, + flags, ami_search_string()); ActivateWindow(fwin->gwin->shared->win); break; } diff --git a/amiga/stringview/urlhistory.c b/amiga/stringview/urlhistory.c index ec56987f9..fa5aec448 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 deleted file mode 100644 index c9be5ad4c..000000000 --- a/amiga/system_colour.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 "amiga/gui.h" -#include "utils/utils.h" -#include "utils/log.h" -#include "desktop/gui.h" -#include "desktop/options.h" -#include "desktop/tree.h" - -#include <proto/graphics.h> -#include <proto/intuition.h> -#include <proto/Picasso96API.h> -#include <intuition/gui.h> -#include <intuition/screens.h> - -#define AMINS_SCROLLERPEN NUMDRIPENS - -struct gui_system_colour_ctx { - const char *name; - int length; - css_color colour; - colour *option_colour; - UWORD amiga_pen; - lwc_string *lwcstr; -}; - -static struct gui_system_colour_ctx colour_list[] = { - { - "ActiveBorder", - SLEN("ActiveBorder"), - 0xff000000, - &nsoption_colour(sys_colour_ActiveBorder), - FILLPEN, - NULL - }, { - "ActiveCaption", - SLEN("ActiveCaption"), - 0xffdddddd, - &nsoption_colour(sys_colour_ActiveCaption), - FILLPEN, - NULL - }, { - "AppWorkspace", - SLEN("AppWorkspace"), - 0xffeeeeee, - &nsoption_colour(sys_colour_AppWorkspace), - BACKGROUNDPEN, - NULL - }, { - "Background", - SLEN("Background"), - 0xff0000aa, - &nsoption_colour(sys_colour_Background), - BACKGROUNDPEN, - NULL - }, { - "ButtonFace", - SLEN("ButtonFace"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ButtonFace), - FOREGROUNDPEN, - NULL - }, { - "ButtonHighlight", - SLEN("ButtonHighlight"), - 0xffdddddd, - &nsoption_colour(sys_colour_ButtonHighlight), - FORESHINEPEN, - NULL - }, { - "ButtonShadow", - SLEN("ButtonShadow"), - 0xffbbbbbb, - &nsoption_colour(sys_colour_ButtonShadow), - FORESHADOWPEN, - NULL - }, { - "ButtonText", - SLEN("ButtonText"), - 0xff000000, - &nsoption_colour(sys_colour_ButtonText), - TEXTPEN, - NULL - }, { - "CaptionText", - SLEN("CaptionText"), - 0xff000000, - &nsoption_colour(sys_colour_CaptionText), - FILLTEXTPEN, - NULL - }, { - "GrayText", - SLEN("GrayText"), - 0xffcccccc, - &nsoption_colour(sys_colour_GrayText), - DISABLEDTEXTPEN, - NULL - }, { - "Highlight", - SLEN("Highlight"), - 0xff0000ee, - &nsoption_colour(sys_colour_Highlight), - SELECTPEN, - NULL - }, { - "HighlightText", - SLEN("HighlightText"), - 0xff000000, - &nsoption_colour(sys_colour_HighlightText), - SELECTTEXTPEN, - NULL - }, { - "InactiveBorder", - SLEN("InactiveBorder"), - 0xffffffff, - &nsoption_colour(sys_colour_InactiveBorder), - INACTIVEFILLPEN, - NULL - }, { - "InactiveCaption", - SLEN("InactiveCaption"), - 0xffffffff, - &nsoption_colour(sys_colour_InactiveCaption), - INACTIVEFILLPEN, - NULL - }, { - "InactiveCaptionText", - SLEN("InactiveCaptionText"), - 0xffcccccc, - &nsoption_colour(sys_colour_InactiveCaptionText), - INACTIVEFILLTEXTPEN, - NULL - }, { - "InfoBackground", - SLEN("InfoBackground"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_InfoBackground), - BACKGROUNDPEN, /* This is wrong, HelpHint backgrounds are pale yellow but doesn't seem to be a DrawInfo pen defined for it. */ - NULL - }, { - "InfoText", - SLEN("InfoText"), - 0xff000000, - &nsoption_colour(sys_colour_InfoText), - TEXTPEN, - NULL - }, { - "Menu", - SLEN("Menu"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Menu), - MENUBACKGROUNDPEN, - NULL - }, { - "MenuText", - SLEN("MenuText"), - 0xff000000, - &nsoption_colour(sys_colour_MenuText), - MENUTEXTPEN, - NULL - }, { - "Scrollbar", - SLEN("Scrollbar"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Scrollbar), - AMINS_SCROLLERPEN, - NULL - }, { - "ThreeDDarkShadow", - SLEN("ThreeDDarkShadow"), - 0xff555555, - &nsoption_colour(sys_colour_ThreeDDarkShadow), - FORESHADOWPEN, - NULL - }, { - "ThreeDFace", - SLEN("ThreeDFace"), - 0xffdddddd, - &nsoption_colour(sys_colour_ThreeDFace), - FOREGROUNDPEN, - NULL - }, { - "ThreeDHighlight", - SLEN("ThreeDHighlight"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ThreeDHighlight), - FORESHINEPEN, - NULL - }, { - "ThreeDLightShadow", - SLEN("ThreeDLightShadow"), - 0xff999999, - &nsoption_colour(sys_colour_ThreeDLightShadow), - HALFSHINEPEN, - NULL - }, { - "ThreeDShadow", - SLEN("ThreeDShadow"), - 0xff777777, - &nsoption_colour(sys_colour_ThreeDShadow), - HALFSHADOWPEN, - NULL - }, { - "Window", - SLEN("Window"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Window), - BACKGROUNDPEN, - NULL - }, { - "WindowFrame", - SLEN("WindowFrame"), - 0xff000000, - &nsoption_colour(sys_colour_WindowFrame), - INACTIVEFILLPEN, - NULL - }, { - - "WindowText", - SLEN("WindowText"), - 0xff000000, - &nsoption_colour(sys_colour_WindowText), - TEXTPEN, - 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; - -css_color ami_css_colour_from_pen(struct Screen *screen, UWORD pen); - -UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo) -{ - LONG scrollerfillpen = FALSE; - - GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE); - - if(scrollerfillpen) return FILLPEN; - else return FOREGROUNDPEN; -} - -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); - } - else if(scrn) { - colour_list[ccount].colour = - ami_css_colour_from_pen(scrn, colour_list[ccount].amiga_pen); - } - } - - gui_system_colour_pw = colour_list; - tree_setup_colours(); - - 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); - } - - gui_system_colour_pw = NULL; -} - -colour ami_css_color_to_colour(css_color c) -{ - return (c & 0xFF00FF00) | ((c >> 16) & 0xFF) | ((c & 0xFF) << 16); -} - -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 = ami_css_color_to_colour(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; -} - -css_color ami_css_colour_from_pen(struct Screen *screen, UWORD pen) -{ - css_color css_colour = 0x00000000; - ULONG colour[3]; - struct DrawInfo *drinfo = GetScreenDrawInfo(screen); - - if(drinfo == NULL) return 0x00000000; - - if(pen == AMINS_SCROLLERPEN) pen = ami_system_colour_scrollbar_fgpen(drinfo); - - /* Get the colour of the pen being used for "pen" */ - GetRGB32(screen->ViewPort.ColorMap, drinfo->dri_Pens[pen], 1, (ULONG *)&colour); - - /* convert it to a css_color */ - css_colour = (0xff << 24) | - ((colour[0] & 0xff000000) >> 8) | - ((colour[1] & 0xff000000) >> 16) | - ((colour[2] & 0xff000000) >> 24); - - FreeScreenDrawInfo(screen, drinfo); - return css_colour; -} diff --git a/amiga/theme.c b/amiga/theme.c index fa058e043..a0755b23a 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" @@ -193,7 +193,7 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape) { if(drag_save_data) return; - if(nsoption_bool(use_os_pointers)) + if(nsoption_bool(os_mouse_pointers)) { switch(shape) { diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c index f1738d29d..61102feff 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 9c7b9d66b..ddaf81ebc 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" @@ -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", diff --git a/amiga/version.c b/amiga/version.c index 85546619b..c3244ac0a 100644 --- a/amiga/version.c +++ b/amiga/version.c @@ -24,7 +24,7 @@ * desktop/version.c. */ #define NETSURF_VERSION_MAJOR "3" -#define NETSURF_VERSION_MINOR "1" +#define NETSURF_VERSION_MINOR "2" static const __attribute__((used)) char *verstag = "\0$VER: NetSurf " NETSURF_VERSION_MAJOR "." NETSURF_VERSION_MINOR " (" WT_COMPILEDATE ")\0"; const char * const verdate = WT_COMPILEDATE; diff --git a/atari/Makefile.target b/atari/Makefile.target index d3392928d..bff4f07e1 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -96,7 +96,6 @@ S_ATARI := \ toolbar.c \ statusbar.c \ osspec.c \ - system_colour.c \ ctxmenu.c \ settings.c \ deskmenu.c \ @@ -191,9 +190,8 @@ endif $(Q)cp \!NetSurf/Resources/internal.css,f79 $(ATARI_TARGET_DIR)res/internal.css $(Q)cp \!NetSurf/Resources/SearchEngines $(ATARI_TARGET_DIR)res/search $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle -# $(Q)cp resources/FatMessages $(ATARI_TARGET_DIR)res/messages $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle - $(Q)$(PERL) utils/split-messages.pl en all < resources/FatMessages > $(ATARI_TARGET_DIR)res/messages + $(Q)$(SPLIT_MESSAGES) -l en -p atari -f messages resources/FatMessages > $(ATARI_TARGET_DIR)res/messages $(Q)cp \!NetSurf/Resources/en/welcome.html,faf $(ATARI_TARGET_DIR)res/welcome.html $(Q)cp \!NetSurf/Resources/en/licence.html,faf $(ATARI_TARGET_DIR)res/licence.html $(Q)cp \!NetSurf/Resources/en/credits.html,faf $(ATARI_TARGET_DIR)res/credits.html diff --git a/atari/Makefile.target.orig b/atari/Makefile.target.orig deleted file mode 100644 index 25951b961..000000000 --- a/atari/Makefile.target.orig +++ /dev/null @@ -1,120 +0,0 @@ -# ---------------------------------------------------------------------------- -# Atari target setup -# ---------------------------------------------------------------------------- - -ifeq ($(ATARI_ARCH),68000) -PRGSUFFIX := 000.app -PKGNAME := ns000.zip -endif - -ifeq ($(ATARI_ARCH),68020-60) -CFLAGS += -m68020-60 -LDFLAGS += -m68020-60 -PRGSUFFIX := 020.app -PKGNAME := ns020.zip -endif - -ifeq ($(ATARI_ARCH),5475) -CFLAGS += -mcpu=5475 -LDFLAGS += -mcpu=5475 -PRGSUFFIX := v4e.app -PKGNAME := nsv4e.zip -endif - -# non-pkgconfig components - -FREETYPE_FONT_CFLAGS := $(shell freetype-config --cflags) -DWITH_FREETYPE_FONT_DRIVER -SPIDERMONKEY_CFLAGS := -DWITH_MOZJS -DXP_UNIX -DJS_HAS_FILE_OBJECT=0 -DJSOPTION_JIT=0 -DPOSIX_SOURCE -D_BSD_SOURCE - -$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng))) -$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng))) -$(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript (Spidermonkey))) -$(eval $(call feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype))) -$(eval $(call feature_enabled,ATARI_NETSURF_FONT,-DWITH_INTERNAL_FONT_DRIVER,,(Internal Font))) -$(eval $(call feature_enabled,ATARI_8BPP_SUPPORT,-DWITH_8BPP_SUPPORT,,(Indexed screen format support))) - -# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here -NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG -NETSURF_FEATURE_HUBBUB_CFLAGS := -DWITH_HUBBUB -NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP -NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF -NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0 -NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0 - -ifeq ($(NETSURF_USE_MOZJS),YES) -NETSURF_USE_JS:=YES -NETSURF_USE_MOZJS:=YES -endif - -$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP)) -$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF)) - -CFLAGS += -U__STRICT_ANSI__ -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \ - -D_BSD_SOURCE \ - -D_XOPEN_SOURCE=600 \ - -D_POSIX_C_SOURCE=200112L \ - $(shell $(PKG_CONFIG) --cflags libhubbub libcss openssl ) \ - $(shell $(PKG_CONFIG) --cflags libxml-2.0 ) \ - $(shell $(PKG_CONFIG) --cflags libcurl ) - -LDFLAGS += -lcflib -lcurl -LDFLAGS += -lcss -lparserutils -ldom -lwapcaplet -lhubbub -LDFLAGS += -lssl -lcrypto -LDFLAGS += -lxml2 -lz -liconv -lcares -lHermes -lwindom -lgem -lm -LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib - - -# S_ATARI are sources purely for the Atari FreeMiNT build -S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \ - download.c thumbnail.c login.c verify_ssl.c treeview.c hotlist.c history.c\ - search.c font.c \ - plot/plot.c plot/fontplot.c plot/eddi.s \ - plot/font_freetype.c plot/font_internal.c \ - redrawslots.c encoding.c \ - browser_win.c toolbar.c statusbar.c browser.c \ - global_evnt.c osspec.c dragdrop.c system_colour.c \ - ctxmenu.c save.c settings.c -S_ATARI := $(addprefix atari/,$(S_ATARI)) - -# This is the final source build list -# Note this is deliberately *not* expanded here as common and image -# are not yet available -SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_ATARI) -EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX) - -# ---------------------------------------------------------------------------- -# Install target -# ---------------------------------------------------------------------------- - -<<<<<<< Updated upstream -install-atari: - -# ---------------------------------------------------------------------------- -# Package target -# ---------------------------------------------------------------------------- - -package-atari: -======= -ATARI_INSTALL_TARGET_DIR := nsatari.package -ATARI_RES_DIR := atari/res - -install-atari: $(PKGNAME) - $(VQ)echo Creating $(PKGNAME) - -$(PKGNAME): $(EXETARGET) - $(Q)rm -rf $(ATARI_INSTALL_TARGET_DIR) - $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/ - $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf - $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/doc - $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/download - $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res - $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/fonts - #$(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons - $(Q)touch $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/cookies - $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/netsurf.rsc - $(Q)cp $(ATARI_RES_DIR)/icons/ $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons/ -R - - - $(Q)cp $(EXETARGET) $(ATARI_INSTALL_TARGET_DIR)/netsurf - ->>>>>>> Stashed changes diff --git a/atari/bitmap.c b/atari/bitmap.c index 10b5c8cfa..6d986fb5b 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" @@ -421,6 +421,7 @@ size_t bitmap_get_bpp(void *bitmap) bool bitmap_resize(struct bitmap *img, HermesHandle hermes_h, HermesFormat *fmt, int nw, int nh) { + unsigned int state = 0; short bpp = bitmap_get_bpp( img ); int stride = bitmap_get_rowstride( img ); int err; @@ -436,7 +437,10 @@ bool bitmap_resize(struct bitmap *img, HermesHandle hermes_h, } /* allocate the mem for resized bitmap */ - img->resized = bitmap_create_ex( nw, nh, bpp, nw*bpp, 0, NULL ); + if (img->opaque == true) { + state |= BITMAP_OPAQUE; + } + img->resized = bitmap_create_ex( nw, nh, bpp, nw*bpp, state, NULL ); if( img->resized == NULL ) { printf("W: %d, H: %d, bpp: %d\n", nw, nh, bpp); assert(img->resized); diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c index 1806d5499..5b33fe45f 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 e2b0dea6b..4300498f9 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" @@ -389,7 +389,7 @@ static void __CDECL menu_savewin(short item, short title, void *data) nsoption_set_int(window_height, rect.g_h); nsoption_set_int(window_x, rect.g_x); nsoption_set_int(window_y, rect.g_y); - nsoption_write((const char*)&options); + nsoption_write((const char*)&options, NULL, NULL); } }
diff --git a/atari/download.c b/atari/download.c index 209650490..407be063d 100755 --- a/atari/download.c +++ b/atari/download.c @@ -30,9 +30,8 @@ #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/selection.h"
#include "desktop/textinput.h"
#include "desktop/download.h"
#include "render/html.h"
diff --git a/atari/font.c b/atari/font.c index dfa0efee5..7640f6106 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/gemtk/gemtk.h b/atari/gemtk/gemtk.h index 2471b34db..3e406b5e3 100644 --- a/atari/gemtk/gemtk.h +++ b/atari/gemtk/gemtk.h @@ -102,6 +102,7 @@ short gemtk_msg_box_show(short type, const char * msg); #define GEMTK_WM_FLAG_RECV_PREPROC_WM 0x02 // get notified even when pre-processed #define GEMTK_WM_FLAG_HAS_VTOOLBAR 0x04 // the attached toolbar is vertical #define GEMTK_WM_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling + // (Except considering it's size) #define GEMTK_WM_FLAG_CUSTOM_SCROLLING 0x20 // no internal scroller handling #define GEMTK_WM_FLAG_DEFAULTS \ diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c index 6275184be..30f70c271 100644 --- a/atari/gemtk/guiwin.c +++ b/atari/gemtk/guiwin.c @@ -26,8 +26,8 @@ #include "gemtk.h" -#define DEBUG_PRINT(x) printf x -//#define DEBUG_PRINT(x) +//#define DEBUG_PRINT(x) printf x +#define DEBUG_PRINT(x) struct gemtk_window_s { @@ -102,7 +102,9 @@ static void move_rect(GUIWIN * win, GRECT *rect, int dx, int dy) /* get intersection with screen area */ wind_get_grect(0, WF_CURRXYWH, &g); - rc_intersect(&g, rect); + if(!rc_intersect(&g, rect)){ + goto error; + } xy[0] = rect->g_x; xy[1] = rect->g_y; xy[2] = xy[0] + rect->g_w-1; @@ -113,6 +115,7 @@ static void move_rect(GUIWIN * win, GRECT *rect, int dx, int dy) xy[7] = xy[3] + dy; vro_cpyfm(vh, S_ONLY, xy, (MFDB *)&dum, (MFDB *)&dum); +error: graf_mouse(M_ON, 0L); wind_update(END_UPDATE); } @@ -754,6 +757,7 @@ GUIWIN *gemtk_wm_link(GUIWIN *win) win->prev = tmp; win->next = NULL; } + return(win); } /** diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c index 2a5eaae5b..5d47bd64c 100644 --- a/atari/gemtk/objc.c +++ b/atari/gemtk/objc.c @@ -89,6 +89,8 @@ char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt) snprintf(spare, maxlen, "%s", txt); set_string(tree, idx, spare); + + return(0); } OBJECT *gemtk_obj_get_tree(int idx) diff --git a/atari/gui.c b/atari/gui.c index db44c0ae3..6b542742e 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -40,9 +40,8 @@ #include "desktop/netsurf.h" #include "desktop/401login.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/save_complete.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "desktop/browser.h" #include "desktop/browser_private.h" @@ -661,7 +660,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, TODO(); } -void gui_drag_save_selection(struct selection *s, struct gui_window *w) +void gui_drag_save_selection(struct gui_window *g, const char *selection) { LOG(("")); TODO(); @@ -923,16 +922,21 @@ nsurl *gui_get_resource_url(const char *path) return url; } -/* Documented in desktop/options.h */ -void gui_options_init_defaults(void) +/** + * Set option defaults for atari 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("cookies")); if (nsoption_charp(cookie_file) == NULL) { - die("Failed initialising string options"); + LOG(("Failed initialising string options")); + return NSERROR_BAD_PARAMETER; } - - nsoption_set_int(min_reflow_period, 350); + return NSERROR_OK; } static void gui_init(int argc, char** argv) @@ -1032,12 +1036,13 @@ static void gui_init2(int argc, char** argv) int main(int argc, char** argv) { char messages[PATH_MAX]; - const char *addr; - char * file_url = NULL; - struct stat stat_buf; - nsurl *url; - nserror error; + const char *addr; + char * file_url = NULL; + struct stat stat_buf; + nsurl *url; + nserror ret; + /* @todo logging file descriptor update belongs in a nslog_init callback */ setbuf(stderr, NULL); setbuf(stdout, NULL); #ifdef WITH_DBG_LOGFILE @@ -1054,8 +1059,25 @@ int main(int argc, char** argv) atari_find_resource((char*)&messages, "messages", "res/messages"); atari_find_resource((char*)&options, "Choices", "Choices"); + /* initialise logging - not fatal if it fails but not much we can + * do about it + */ + nslog_init(NULL, &argc, argv); + + /* user options setup */ + ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + die("Options failed to initialise"); + } + nsoption_read(options, NULL); + nsoption_commandline(&argc, argv, NULL); + + /* common initialisation */ LOG(("Initialising core...")); - netsurf_init(&argc, &argv, options, messages); + ret = netsurf_init(messages); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } LOG(("Initializing GUI...")); gui_init(argc, argv); @@ -1074,23 +1096,23 @@ int main(int argc, char** argv) } } - /* create an initial browser window */ - error = nsurl_create(addr, &url); - if (error == NSERROR_OK) { - error = browser_window_create(BROWSER_WINDOW_VERIFIABLE | - BROWSER_WINDOW_HISTORY, - url, - NULL, - NULL, - NULL); - nsurl_unref(url); - } - if (error != NSERROR_OK) { - warn_user(messages_get_errorcode(error), 0); - } else { - LOG(("Entering NetSurf mainloop...")); - netsurf_main_loop(); - } + /* create an initial browser window */ + ret = nsurl_create(addr, &url); + if (ret == NSERROR_OK) { + ret = browser_window_create(BROWSER_WINDOW_VERIFIABLE | + BROWSER_WINDOW_HISTORY, + url, + NULL, + NULL, + NULL); + nsurl_unref(url); + } + if (ret != NSERROR_OK) { + warn_user(messages_get_errorcode(ret), 0); + } else { + LOG(("Entering NetSurf mainloop...")); + netsurf_main_loop(); + } netsurf_exit(); diff --git a/atari/gui.h b/atari/gui.h index fef686a57..2146a26a5 100755 --- a/atari/gui.h +++ b/atari/gui.h @@ -132,7 +132,6 @@ struct s_browser {
struct browser_window * bw;
bool attached; - bool reformat_pending;
}; /* diff --git a/atari/history.c b/atari/history.c index aa32cbf7e..49e24ced0 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 adfd596ca..f3b093d6f 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 e8e6a9bb0..96abcf57a 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/options.h b/atari/options.h index f9bb3b4c5..7a4da6a15 100755 --- a/atari/options.h +++ b/atari/options.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Ole Loots <ole@monochrom.net> + * Copyright 2012 Vincent Sanders <vince@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/atari/plot/font_freetype.c b/atari/plot/font_freetype.c index ed850bce2..49e46c857 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" @@ -318,7 +318,7 @@ static bool ft_font_init(void) /* Default font, Sans Serif */
font_faces[FONT_FACE_SANS_SERIF] = NULL;
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
- nsoption_charp(atari_face_sans_serif),
+ nsoption_charp(font_face_sans_serif),
FONT_RESOURCE_PATH "ss.ttf",
FONT_PKG_PATH FONT_FILE_SANS
);
@@ -331,55 +331,55 @@ static bool ft_font_init(void) /* Sans Serif Bold*/
font_faces[FONT_FACE_SANS_SERIF_BOLD] =
- ft_new_face(nsoption_charp(atari_face_sans_serif_bold),
+ ft_new_face(nsoption_charp(font_face_sans_serif_bold),
FONT_RESOURCE_PATH "ssb.ttf",
FONT_PKG_PATH FONT_FILE_SANS_BOLD); /* Sans Serif Italic */
font_faces[FONT_FACE_SANS_SERIF_ITALIC] =
- ft_new_face(nsoption_charp(atari_face_sans_serif_italic),
+ ft_new_face(nsoption_charp(font_face_sans_serif_italic),
FONT_RESOURCE_PATH "ssi.ttf",
FONT_PKG_PATH FONT_FILE_SANS_OBLIQUE);
/* Sans Serif Italic Bold */
font_faces[FONT_FACE_SANS_SERIF_ITALIC_BOLD] =
- ft_new_face(nsoption_charp(atari_face_sans_serif_italic_bold),
+ ft_new_face(nsoption_charp(font_face_sans_serif_italic_bold),
FONT_RESOURCE_PATH "ssib.ttf",
FONT_PKG_PATH FONT_FILE_SANS_BOLD_OBLIQUE);
/* Monospaced */
font_faces[FONT_FACE_MONOSPACE] =
- ft_new_face(nsoption_charp(atari_face_monospace),
+ ft_new_face(nsoption_charp(font_face_monospace),
FONT_RESOURCE_PATH "mono.ttf",
FONT_PKG_PATH FONT_FILE_MONO);
/* Mospaced Bold */
font_faces[FONT_FACE_MONOSPACE_BOLD] =
- ft_new_face(nsoption_charp(atari_face_monospace_bold),
+ ft_new_face(nsoption_charp(font_face_monospace_bold),
FONT_RESOURCE_PATH "monob.ttf",
FONT_PKG_PATH FONT_FILE_MONO_BOLD);
/* Serif */
font_faces[FONT_FACE_SERIF] =
- ft_new_face(nsoption_charp(atari_face_serif),
+ ft_new_face(nsoption_charp(font_face_serif),
FONT_RESOURCE_PATH "s.ttf",
FONT_PKG_PATH FONT_FILE_SERIF);
/* Serif Bold */
font_faces[FONT_FACE_SERIF_BOLD] =
- ft_new_face(nsoption_charp(atari_face_serif_bold),
+ ft_new_face(nsoption_charp(font_face_serif_bold),
FONT_RESOURCE_PATH "sb.ttf",
FONT_PKG_PATH FONT_FILE_SERIF_BOLD);
/* Cursive */
font_faces[FONT_FACE_CURSIVE] =
- ft_new_face(nsoption_charp(atari_face_cursive),
+ ft_new_face(nsoption_charp(font_face_cursive),
FONT_RESOURCE_PATH "cursive.ttf",
FONT_PKG_PATH FONT_FILE_OBLIQUE);
/* Fantasy */
font_faces[FONT_FACE_FANTASY] =
- ft_new_face(nsoption_charp(atari_face_fantasy),
+ ft_new_face(nsoption_charp(font_face_fantasy),
FONT_RESOURCE_PATH "fantasy.ttf",
FONT_PKG_PATH FONT_FILE_FANTASY);
diff --git a/atari/plot/plot.c b/atari/plot/plot.c index dfd9b0eff..33810b74e 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/res/netsurf.c b/atari/res/netsurf.c deleted file mode 100644 index d6ee900f1..000000000 --- a/atari/res/netsurf.c +++ /dev/null @@ -1,4379 +0,0 @@ -/* erzeugt mit RSM2CS V1.01 Beta von Armin Diedering aus "S:\Sources\netsurf.git\netsurf\atari\res\netsurf.rsc" */
-/* nach Sourcen von Holger Weets */
-
-#include <portab.h>
-
-static char rs_s0[] = "";
-static char rs_s1[] = "-------------------------";
-static char rs_s2[] = "------------------------------";
-static char rs_s3[] = "-----------------------";
-static char rs_s4[] = "Abort";
-static char rs_s5[] = "X";
-static char rs_s7[] = "__";
-static char rs_s6[] = "n";
-static char rs_s8[] = "___";
-static char rs_s9[] = "____________________________________________";
-
-static char rs_s10[] = "";
-static char rs_s11[] = "";
-static char rs_s12[] = "";
-static char rs_s13[] = "";
-static char rs_s14[] = "";
-static char rs_s15[] = "";
-static char rs_s16[] = "";
-static char rs_s17[] = "";
-static char rs_s18[] = "";
-static char rs_s19[] = "";
-static char rs_s20[] = "";
-static char rs_s21[] = "";
-static char rs_s22[] = "";
-static char rs_s23[] = "";
-static char rs_s24[] = "";
-static char rs_s25[] = "";
-static char rs_s26[] = "";
-static char rs_s27[] = "";
-static char rs_s28[] = "";
-static char rs_s29[] = "";
-static char rs_s30[] = "";
-static char rs_s31[] = "";
-static char rs_s32[] = "";
-static char rs_s33[] = "";
-static char rs_s34[] = "";
-static char rs_s35[] = "";
-static char rs_s36[] = "";
-static char rs_s37[] = "";
-static char rs_s38[] = "";
-static char rs_s39[] = "";
-static char rs_s40[] = "";
-static char rs_s41[] = "";
-static char rs_s42[] = "";
-static char rs_s43[] = "";
-static char rs_s44[] = "";
-static char rs_s45[] = "-------------------";
-static char rs_s46[] = "-------------------";
-static char rs_s51[] = "03";
-static char rs_s47[] = "_____";
-static char rs_s48[] = "_____";
-static char rs_s49[] = "_____________________________________";
-static char rs_s50[] = "_____________________________________";
-static char rs_s52[] = "03";
-static char rs_s53[] = "03";
-static char rs_s54[] = "03";
-static char rs_s55[] = "____________________________________________";
-static char rs_s56[] = "____________________________________________";
-static char rs_s57[] = "____________________________________________";
-static char rs_s58[] = "____________________________________________";
-static char rs_s59[] = "____________________________________________";
-
-#define FLAGS11 0x0800
-#define FLAGS12 0x1000
-#define FLAGS13 0x2000
-#define FLAGS14 0x4000
-#define FLAGS15 0x8000
-#define STATE8 0x0100
-#define STATE9 0x0200
-#define STATE10 0x0400
-#define STATE11 0x0800
-#define STATE12 0x1000
-#define STATE13 0x2000
-#define STATE14 0x4000
-#define STATE15 0x8000
-
-#define RS_NTED 43
-
-static TEDINFO rs_tedinfo[] = {
- "NetSurf",
- rs_s0,
- rs_s0,
- SMALL, 6, TE_LEFT, 4352, 0, 0, 8, 1,
-
- rs_s45,
- "User: ___________________",
- rs_s5,
- IBM, 6, TE_CNTR, 4480, 0, -2, 20, 30,
-
- rs_s46,
- "Password: ___________________",
- rs_s5,
- IBM, 6, TE_CNTR, 4480, 0, -2, 20, 30,
-
- "SSL Verify failed!",
- rs_s0,
- rs_s0,
- IBM, 1, TE_LEFT, 4480, 10, -1, 19, 1,
-
- "XY",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 3, 1,
-
- "Text\0@@@@@@@@@@@@@@@@@@@@",
- "Search : _________________________",
- rs_s5,
- IBM, 0, TE_LEFT, 4480, 0, -2, 26, 37,
-
- "File",
- rs_s0,
- rs_s0,
- SMALL, 6, TE_LEFT, 4352, 0, -1, 5, 1,
-
- "100000 MB / 100000 MB",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4352, 0, -1, 22, 1,
-
- "100%",
- rs_s0,
- rs_s0,
- IBM, 6, TE_RIGHT, 4352, 0, -1, 5, 1,
-
- "99999 KB/s ",
- rs_s0,
- rs_s0,
- IBM, 6, TE_RIGHT, 4352, 0, -1, 12, 1,
-
- " Cut",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 6, 1,
-
- " Copy",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 7, 1,
-
- " Paste",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 8, 1,
-
- " Select All",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 13, 1,
-
- "---------------------",
- rs_s0,
- rs_s0,
- IBM, 6, TE_CNTR, 4480, 0, -1, 22, 1,
-
- " Open in new Window",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 21, 1,
-
- " Copy Link",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 12, 1,
-
- " Copy URL",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 11, 1,
-
- " Save as...",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 13, 1,
-
- " View source...",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 17, 1,
-
- " Save link as...",
- rs_s0,
- rs_s0,
- IBM, 6, TE_LEFT, 4480, 0, -1, 18, 1,
-
- "\0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
- "Homepage: ____________________________________________",
- rs_s5,
- IBM, 0, TE_LEFT, 4480, 10, -2, 45, 55,
-
- rs_s51,
- rs_s7,
- rs_s6,
- IBM, 0, TE_CNTR, 4480, 0, -2, 3, 3,
-
- "Browser",
- "_______",
- rs_s5,
- SMALL, 1, TE_CNTR, 4480, 9, 1, 8, 8,
-
- "_______________________________",
- "Proxy Host: _______________________________",
- rs_s5,
- IBM, 0, TE_LEFT, 4480, 0, -2, 32, 44,
-
- rs_s47,
- rs_s48,
- rs_s6,
- IBM, 0, TE_LEFT, 4480, 0, -2, 6, 6,
-
- rs_s49,
- "Username: _____________________________________",
- rs_s5,
- IBM, 0, TE_LEFT, 4480, 0, -2, 38, 50,
-
- rs_s50,
- "Password: _____________________________________",
- rs_s5,
- IBM, 0, TE_LEFT, 4480, 0, -2, 38, 50,
-
- rs_s52,
- rs_s7,
- rs_s6,
- IBM, 0, TE_LEFT, 4352, 0, -2, 3, 3,
-
- rs_s53,
- rs_s7,
- rs_s6,
- IBM, 0, TE_LEFT, 4352, 0, -2, 3, 3,
-
- rs_s54,
- rs_s7,
- rs_s6,
- IBM, 0, TE_LEFT, 4352, 0, -2, 3, 3,
-
- "Network",
- rs_s0,
- rs_s0,
- SMALL, 1, TE_CNTR, 4480, 9, -1, 8, 1,
-
- "130",
- rs_s8,
- rs_s6,
- IBM, 0, TE_LEFT, 4352, 0, -2, 4, 4,
-
- "100",
- rs_s8,
- rs_s6,
- IBM, 0, TE_LEFT, 4352, 0, -2, 4, 4,
-
- "0.5",
- rs_s8,
- rs_s6,
- IBM, 0, TE_LEFT, 4352, 0, -2, 4, 4,
-
- "0350",
- "____",
- rs_s6,
- IBM, 0, TE_LEFT, 4352, 0, -2, 5, 5,
-
- "Rendering",
- rs_s0,
- rs_s0,
- SMALL, 1, TE_CNTR, 4480, 9, -1, 10, 1,
-
- rs_s55,
- rs_s9,
- rs_s5,
- IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
-
- rs_s56,
- rs_s9,
- rs_s5,
- IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
-
- rs_s57,
- rs_s9,
- rs_s5,
- IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
-
- rs_s58,
- rs_s9,
- rs_s5,
- IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
-
- rs_s59,
- rs_s9,
- rs_s5,
- IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
-
- "Directories",
- rs_s0,
- rs_s0,
- SMALL, 1, TE_CNTR, 4480, 9, -1, 12, 1
-};
-
-static int rs_b222img[] = {
- 0x07ff,0xffff,0xff80,0x0c00,0x0000,0x00c0,0x183f,0xf03f,
- 0xf060,0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,
- 0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,
- 0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,0xf860,
- 0x1860,0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,
- 0xf860,0x1860,0x183f,0xf03f,0xf060,0x0c00,0x0000,0x00c0,
- 0x07ff,0xffff,0xff80,0x0000,0x0000,0x0000,0x3f30,0xc787,
- 0x8fe0,0x0c39,0xcccc,0xcc00,0x0c36,0xcfcc,0x0f80,0x0c30,
- 0xcccd,0xcc00,0x3f30,0xccc7,0xcfe0,0x0000,0x0000,0x0000
-};
-
-static int rs_b221img[] = {
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b220img[] = {
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000,
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000,
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000,
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b219img[] = {
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b218img[] = {
- 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
- 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000,
- 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
- 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000,
- 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
- 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000,
- 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
- 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b217img[] = {
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b216img[] = {
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b215img[] = {
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b214img[] = {
- 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
- 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b213img[] = {
- 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
- 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b212img[] = {
- 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
- 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
-};
-
-static int rs_b211img[] = {
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b210img[] = {
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000,
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000,
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000,
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b209img[] = {
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b208img[] = {
- 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
- 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000,
- 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
- 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000,
- 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
- 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000,
- 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
- 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000
-};
-
-static int rs_b207img[] = {
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b206img[] = {
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b205img[] = {
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b204img[] = {
- 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
- 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000
-};
-
-static int rs_b203img[] = {
- 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
- 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000
-};
-
-static int rs_b202img[] = {
- 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
- 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b201img[] = {
- 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
- 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
-};
-
-static int rs_b200img[] = {
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
-};
-
-static int rs_b199img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b198img[] = {
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
-};
-
-static int rs_b197img[] = {
- 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
- 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
-};
-
-static int rs_b196img[] = {
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
-};
-
-static int rs_b195img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b194img[] = {
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
-};
-
-static int rs_b193img[] = {
- 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
- 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
-};
-
-static int rs_b192img[] = {
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
-};
-
-static int rs_b191img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b190img[] = {
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
-};
-
-static int rs_b189img[] = {
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
- 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
-};
-
-static int rs_b188img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b187img[] = {
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
-};
-
-static int rs_b186img[] = {
- 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
- 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
- 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
- 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
- 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
- 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000
-};
-
-static int rs_b185img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
-};
-
-static int rs_b184img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8
-};
-
-static int rs_b183img[] = {
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
-};
-
-static int rs_b182img[] = {
- 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
- 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
-};
-
-static int rs_b181img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
-};
-
-static int rs_b180img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
-};
-
-static int rs_b179img[] = {
- 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
- 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
-};
-
-static int rs_b178img[] = {
- 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
- 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000
-};
-
-static int rs_b177img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
-};
-
-static int rs_b176img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8
-};
-
-static int rs_b175img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
- 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8
-};
-
-static int rs_b174img[] = {
- 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
- 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
-};
-
-static int rs_b173img[] = {
- 0x0000,0x0000,0x1c00,0x3e00,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x0000
-};
-
-static int rs_b172img[] = {
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000
-};
-
-static int rs_b171img[] = {
- 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
- 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
-};
-
-static int rs_b170img[] = {
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
-};
-
-static int rs_b169img[] = {
- 0x0000,0x0000,0x1c00,0x3e00,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x0000
-};
-
-static int rs_b168img[] = {
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000
-};
-
-static int rs_b167img[] = {
- 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
- 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
-};
-
-static int rs_b166img[] = {
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
-};
-
-static int rs_b165img[] = {
- 0x0000,0x0000,0x1c00,0x3e00,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x0000
-};
-
-static int rs_b164img[] = {
- 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
- 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000
-};
-
-static int rs_b163img[] = {
- 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
- 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
-};
-
-static int rs_b162img[] = {
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
-};
-
-static int rs_b161img[] = {
- 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
- 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
-};
-
-static int rs_b160img[] = {
- 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
- 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
-};
-
-static int rs_b159img[] = {
- 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
- 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
-};
-
-static int rs_b158img[] = {
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
-};
-
-static int rs_b157img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b156img[] = {
- 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b155img[] = {
- 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
- 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
-};
-
-static int rs_b154img[] = {
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
-};
-
-static int rs_b153img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b152img[] = {
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
- 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe
-};
-
-static int rs_b151img[] = {
- 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
- 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
-};
-
-static int rs_b150img[] = {
- 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
- 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
-};
-
-static int rs_b149img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b148img[] = {
- 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe
-};
-
-static int rs_b147img[] = {
- 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
- 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe
-};
-
-static int rs_b146img[] = {
- 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
- 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
-};
-
-static int rs_b145img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b144img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b143img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b142img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b141img[] = {
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b140img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b139img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b138img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b137img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b136img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b135img[] = {
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b134img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b133img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b132img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b131img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b130img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b129img[] = {
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
- 0x481e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b128img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b127img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b126img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b125img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b124img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
- 0x481e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b123img[] = {
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
- 0x481e,0x781e,0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000
-};
-
-static int rs_b122img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b121img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b120img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b119img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b118img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
- 0x481e,0x781e,0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b117img[] = {
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
- 0x481e,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
-};
-
-static int rs_b116img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b115img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b114img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b113img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b112img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
- 0x481e,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b111img[] = {
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x4812,
- 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
-};
-
-static int rs_b110img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b109img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b108img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b107img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b106img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x4812,
- 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b105img[] = {
- 0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,0x781e,0x4812,
- 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
-};
-
-static int rs_b104img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b103img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b102img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b101img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b100img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x4812,
- 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b99img[] = {
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x4812,
- 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
-};
-
-static int rs_b98img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b97img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b96img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b95img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b94img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
- 0x7812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b93img[] = {
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
- 0x7812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
-};
-
-static int rs_b92img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b91img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b90img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b89img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b88img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
- 0x7812,0x781e,0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b87img[] = {
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
- 0x7812,0x781e,0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000
-};
-
-static int rs_b86img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b85img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b84img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b83img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b82img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
- 0x7812,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b81img[] = {
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
- 0x7812,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b80img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b79img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b78img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b77img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b76img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b75img[] = {
- 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b74img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b73img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b72img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
- 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
- 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b71img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b70img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b69img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b68img[] = {
- 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
- 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
-};
-
-static int rs_b67img[] = {
- 0xffff,0xfffe,0xffff,0xffff,0xc000,0x0003,0xc03f,0xe003,
- 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,
- 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,
- 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,
- 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc01f,0xf003,
- 0xc000,0x0003,0xc03f,0xe003,0xc03f,0xf003,0xc03f,0xf003,
- 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc01f,0xf003,
- 0xc000,0x0003,0xc000,0x0003,0xffff,0xffff,0x7fff,0xffff
-};
-
-static int rs_b66img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x0000,0x0000,0x0000,0x0000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xffff,0xfffe,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0xffff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b65img[] = {
- 0x0000,0x0000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x0000,0x0000,0x0000,0x0000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000
-};
-
-static int rs_b64img[] = {
- 0x0000,0x0000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x0000,0x0000,0x0000,0x0000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
- 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000
-};
-
-static int rs_b63img[] = {
- 0x0000,0x0000,0x0000,0x0038,0x007c,0x00fe,0x7ffe,0xfffe,
- 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000
-};
-
-static int rs_b62img[] = {
- 0x0000,0x0000,0x0000,0x0038,0x004c,0x00be,0x7f3e,0xfffe,
- 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0038,0x004c,0x00be,0x7f3e,0xfffe,
- 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0038,0x0044,0x0082,0x7f12,0x8012,
- 0x4012,0x5402,0x2b82,0x0044,0x0038,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0038,0x0044,0x0082,0x7f16,0x8016,
- 0x47d6,0x7fd6,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000
-};
-
-static int rs_b61img[] = {
- 0x0000,0x0000,0x0000,0x0038,0x0044,0x0082,0x7f12,0x8012,
- 0x4012,0x5412,0x2b82,0x0044,0x0038,0x0000,0x0000,0x0000
-};
-
-static int rs_b60img[] = {
- 0x0000,0x0000,0x0000,0x0038,0x007c,0x00fe,0x7ffe,0xfffe,
- 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000
-};
-
-static int rs_b59img[] = {
- 0x0000,0x0380,0x07c0,0x0fe0,0x0fe0,0x0fe0,0x07c0,0x0380,
- 0x07c0,0x0fe0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,0x0000
-};
-
-static int rs_b58img[] = {
- 0x0000,0x0380,0x04c0,0x09a0,0x0ba0,0x0b20,0x0640,0x0380,
- 0x0440,0x0820,0x1010,0x1010,0x1010,0x1ff0,0x0000,0x0000,
- 0x0000,0x0380,0x04c0,0x09a0,0x0ba0,0x0b20,0x0640,0x0380,
- 0x05c0,0x0be0,0x17f0,0x17f0,0x1ff0,0x1ff0,0x0000,0x0000,
- 0x0000,0x0380,0x04c0,0x09a0,0x0ba0,0x0b20,0x0640,0x0380,
- 0x05c0,0x0be0,0x17f0,0x17f0,0x1ff0,0x1ff0,0x0000,0x0000,
- 0x0000,0x0380,0x0440,0x0860,0x0860,0x08e0,0x05c0,0x0380,
- 0x0440,0x0860,0x1030,0x1070,0x17f0,0x1ff0,0x0000,0x0000
-};
-
-static int rs_b57img[] = {
- 0x0000,0x0380,0x0440,0x0820,0x0860,0x08a0,0x0540,0x0380,
- 0x0540,0x0aa0,0x1570,0x1ab0,0x15f0,0x1ff0,0x0000,0x0000
-};
-
-static int rs_b56img[] = {
- 0x0000,0x0380,0x07c0,0x0fe0,0x0fe0,0x0fe0,0x07c0,0x0380,
- 0x07c0,0x0fe0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,0x0000
-};
-
-static int rs_b55img[] = {
- 0x03e0,0x0ff8,0x1ffc,0x3ffe,0x3ffe,0x7fff,0x7fff,0x7fff,
- 0x7fff,0x7fff,0x3ffe,0x3ffe,0x1ffc,0x0ff8,0x03e0,0x0000
-};
-
-static int rs_b54img[] = {
- 0x03e0,0x0d18,0x1604,0x2d5a,0x3e4a,0x4c89,0x5679,0x4c01,
- 0x6403,0x4009,0x2062,0x2702,0x1004,0x0c18,0x03e0,0x0000,
- 0x03e0,0x0ff8,0x1ffc,0x3fde,0x3fce,0x7f8d,0x7ffd,0x7ffb,
- 0x7fff,0x7fe9,0x2ef2,0x27a2,0x1144,0x0c18,0x03e0,0x0000,
- 0x03e0,0x0ff8,0x1ffc,0x3fde,0x3fce,0x7f8d,0x7ffd,0x7ffb,
- 0x7fff,0x7fe9,0x2ef2,0x27a2,0x1144,0x0c18,0x03e0,0x0000,
- 0x03e0,0x0c18,0x1204,0x2002,0x2402,0x4403,0x4003,0x4405,
- 0x4403,0x401f,0x316e,0x3f5e,0x1ebc,0x0ff8,0x03e0,0x0000
-};
-
-static int rs_b53img[] = {
- 0x03e0,0x0ff8,0x1ffc,0x3ffe,0x3ffe,0x7fff,0x7fff,0x7fff,
- 0x7fff,0x7fff,0x3ffe,0x3ffe,0x1ffc,0x0ff8,0x03e0,0x0000
-};
-
-static int rs_b52img[] = {
- 0x0120,0x0838,0x100c,0x2006,0x2002,0x4001,0x0020,0x0001,
- 0x4001,0x4005,0x310a,0x3a06,0x0a0c,0x0d18,0x0020,0x0000,
- 0x03e0,0x0d18,0x1604,0x2d52,0x1e4a,0x4c8b,0x5673,0x4c05,
- 0x6403,0x401b,0x2066,0x275a,0x04bc,0x0ef8,0x02e0,0x0000,
- 0x0260,0x01c0,0x10d0,0x2908,0x1284,0x4080,0x5589,0x32e1,
- 0x7380,0x7f03,0x0e8a,0x0004,0x1018,0x0550,0x03c0,0x0000,
- 0x01a0,0x0730,0x1928,0x3b8c,0x1302,0x738a,0x3c2a,0x4114,
- 0x2800,0x4015,0x1104,0x1858,0x0ea8,0x02a0,0x0000,0x0000,
- 0x03c0,0x0fd8,0x09f4,0x1b8a,0x1386,0x338d,0x7dad,0x73fb,
- 0x7bfd,0x3fe0,0x2e92,0x20a2,0x114c,0x0c18,0x03e0,0x0000,
- 0x0180,0x0cd8,0x00d4,0x000a,0x0086,0x0009,0x01a8,0x72e0,
- 0x1381,0x3f02,0x2e88,0x2006,0x1014,0x0948,0x0120,0x0000,
- 0x0000,0x08e8,0x06dc,0x0456,0x2ccc,0x0c0f,0x03f6,0x3eee,
- 0x17ff,0x3ffc,0x3ff4,0x3ffa,0x1fe4,0x0aa8,0x0120,0x0000,
- 0x0000,0x0b08,0x0d24,0x1fda,0x1b48,0x3b89,0x3e78,0x0910,
- 0x2801,0x0000,0x2000,0x2002,0x1004,0x0808,0x0120,0x0000
-};
-
-static int rs_b51img[] = {
- 0x03e0,0x0c18,0x1224,0x2052,0x244a,0x4485,0x4059,0x4421,
- 0x4403,0x400d,0x3062,0x2702,0x1004,0x0d18,0x03e0,0x0000
-};
-
-static int rs_b50img[] = {
- 0x03e0,0x0ff8,0x1ffc,0x3ffe,0x3ffe,0x7fff,0x7fff,0x7fff,
- 0x7fff,0x7fff,0x3ffe,0x3ffe,0x1ffc,0x0ff8,0x03e0,0x0000
-};
-
-static int rs_b49img[] = {
- 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x03ff,0xff80,
- 0x07ff,0xffc0,0x0fff,0xffe0,0x1fff,0xfff0,0x3fff,0xfff8,
- 0x3fff,0xfff8,0x7fff,0xfffc,0x7fff,0xfffc,0x7fff,0xfffc,
- 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,
- 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0x7fff,0xfffc,
- 0x7fff,0xfffc,0x7fff,0xfffc,0x3fff,0xfff8,0x3fff,0xfff8,
- 0x1fff,0xfff0,0x0fff,0xffe0,0x07ff,0xffc0,0x03ff,0xff80,
- 0x01ff,0xff00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000
-};
-
-static int rs_b48img[] = {
- 0x000f,0xe000,0x0070,0x1c00,0x0180,0x0300,0x0200,0x0080,
- 0x0500,0x0040,0x0a00,0x0420,0x1000,0x2090,0x2000,0x0008,
- 0x2600,0x0008,0x4600,0x0004,0x4400,0x8004,0x4000,0x0004,
- 0x8000,0x0042,0x8000,0x0002,0x8600,0x0002,0x8200,0x0002,
- 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x4000,0x0004,
- 0x4300,0x0004,0x4300,0x00e4,0x2180,0x0108,0x3000,0x7808,
- 0x151a,0x6810,0x0ef8,0x0020,0x0460,0x0040,0x0210,0x0080,
- 0x0180,0x0300,0x007c,0x1c00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x0074,0x1c00,0x01a9,0x0300,0x0224,0x4180,
- 0x05d9,0x0840,0x0b54,0x04a0,0x1fe9,0x3090,0x2a94,0x40d8,
- 0x3f69,0x40c8,0x6ed4,0xc00c,0x5552,0x8014,0x5548,0x002c,
- 0x9551,0x014a,0xc888,0x6a36,0xa724,0x0496,0x8800,0x095a,
- 0xa450,0x0456,0x8000,0x12be,0x8000,0x42aa,0x4000,0x156c,
- 0x4200,0x92dc,0x4002,0x2b74,0x2148,0xa5d8,0x3405,0x3b78,
- 0x13cf,0x32f0,0x0944,0xafa0,0x043b,0x5ac0,0x0365,0xbf80,
- 0x01d5,0x7700,0x007b,0xbc00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x0076,0xfc00,0x01ac,0x7f00,0x03a5,0x3f80,
- 0x075b,0xb2c0,0x0f51,0x6260,0x1ca9,0x8030,0x2f96,0x8008,
- 0x33e8,0x4008,0x6ed1,0x0014,0x5552,0x0004,0x5543,0x8044,
- 0x955b,0xc042,0x98dd,0xc082,0xedaf,0xf102,0xa777,0xfe06,
- 0xf7ff,0xe90a,0xfedf,0xea06,0xdbff,0xa812,0x7fff,0x520c,
- 0x7efd,0xa80c,0x7df6,0x40ec,0x2a5a,0x91a8,0x3554,0xb858,
- 0x1b2c,0x1150,0x08c0,0x00a0,0x0420,0x0b40,0x0220,0x2580,
- 0x0180,0xab00,0x0074,0x5c00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x007d,0x1c00,0x01fb,0x8300,0x03fe,0xc180,
- 0x077d,0x4440,0x0dfe,0x9520,0x1cbf,0x2090,0x3ffd,0x0058,
- 0x31ff,0xc0a8,0x7dfe,0x402c,0x7fff,0x8054,0x7ffc,0x402c,
- 0xfff5,0x000a,0xefaa,0x7276,0xb574,0x0296,0xde88,0x095e,
- 0xaa50,0x045e,0x8120,0x12ba,0xa400,0x42ba,0x4000,0x156c,
- 0x4200,0x92d4,0x4302,0x2bfc,0x21c8,0xa438,0x3405,0x5328,
- 0x1553,0x7bb0,0x0ef2,0xaf20,0x047b,0x51c0,0x0355,0x9a80,
- 0x01d5,0xdf00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x037f,0xfe80,
- 0x077f,0xf7c0,0x0fff,0xf760,0x1cbf,0xa0f0,0x3fff,0x8028,
- 0x37ff,0xc0b8,0x7fff,0x4034,0x7fff,0x806c,0x7fff,0xc054,
- 0xffff,0xc036,0xffff,0xf3ca,0xffff,0xfb6a,0xf9ff,0xf6a2,
- 0xfdff,0xfba2,0xffff,0xed42,0xffff,0xbd46,0x7fff,0xea9c,
- 0x7cff,0x6d24,0x7dfd,0xd4e4,0x3f37,0x5b88,0x3bfa,0xac88,
- 0x1a2e,0xb410,0x0881,0x5060,0x0784,0xa440,0x02aa,0x4080,
- 0x01aa,0x0300,0x007c,0x1c00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x0072,0xfc00,0x0185,0x7f00,0x0381,0x7f80,
- 0x0702,0xb2c0,0x0c05,0x6660,0x1000,0xa0b0,0x2502,0x8008,
- 0x2481,0x0088,0x4405,0x4014,0x4400,0x8004,0x400b,0x8044,
- 0x800a,0xc002,0xd055,0xa282,0xce8b,0xf102,0xaf77,0xfe06,
- 0xd3af,0xe90a,0xfedf,0xea06,0xdbff,0xa812,0x7fff,0x5204,
- 0x7cfd,0xa80c,0x7cf6,0x404c,0x2b5a,0x9028,0x3554,0x8058,
- 0x1822,0x2150,0x0800,0x00a0,0x0400,0x0b40,0x0200,0x2580,
- 0x0180,0xab00,0x0078,0x5c00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x0072,0xfc00,0x0185,0x7f00,0x0281,0x7f80,
- 0x0582,0xbbc0,0x0805,0x66e0,0x1340,0xb0f0,0x2002,0xc0f8,
- 0x2c01,0x00d8,0x4405,0xc01c,0x4400,0x803c,0x400b,0x807c,
- 0x800a,0xc13e,0xd055,0xabbe,0xce8b,0xfdfe,0xaf77,0xfffa,
- 0xd3af,0xfff6,0xfedf,0xfffa,0xdbff,0xffea,0x7fff,0xfff4,
- 0x7dff,0xfff4,0x7eff,0xff54,0x3eff,0xfe58,0x3fff,0xc7a8,
- 0x1cf1,0xceb0,0x0f3f,0xff60,0x07df,0xf4c0,0x03df,0xda80,
- 0x01ff,0x5700,0x0073,0xbc00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x007d,0x1c00,0x01fa,0x8300,0x037e,0x8080,
- 0x07fd,0x4c40,0x0ffa,0x95a0,0x1fff,0x3090,0x3ffd,0x4088,
- 0x3ffe,0xc0e8,0x7ffa,0xc024,0x7fff,0x8044,0x7ff4,0x4004,
- 0xfff5,0x0102,0xafaa,0x7a42,0xb574,0x0602,0xd488,0x0002,
- 0xa850,0x0002,0x8120,0x0002,0xa400,0x0002,0x4000,0x0004,
- 0x4000,0x0004,0x4000,0x0044,0x2000,0x0008,0x3000,0x0008,
- 0x1000,0x0010,0x0800,0x0020,0x0400,0x0040,0x0200,0x0080,
- 0x0180,0x0300,0x0070,0x1c00,0x000f,0xe000,0x0000,0x0000
-};
-
-static int rs_b47img[] = {
- 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x03ff,0xff80,
- 0x07ff,0xffc0,0x0fff,0xffe0,0x1fff,0xfff0,0x3fff,0xfff8,
- 0x3fff,0xfff8,0x7fff,0xfffc,0x7fff,0xfffc,0x7fff,0xfffc,
- 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,
- 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0x7fff,0xfffc,
- 0x7fff,0xfffc,0x7fff,0xfffc,0x3fff,0xfff8,0x3fff,0xfff8,
- 0x1fff,0xfff0,0x0fff,0xffe0,0x07ff,0xffc0,0x03ff,0xff80,
- 0x01ff,0xff00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000
-};
-
-static int rs_b46img[] = {
- 0x000f,0xe000,0x0074,0x1c00,0x01a9,0x0300,0x0324,0x4080,
- 0x07d9,0x0840,0x0d54,0x04a0,0x1fe9,0x3090,0x2a94,0x4088,
- 0x3d69,0x40c8,0x6cd4,0xc004,0x5552,0x8004,0x5540,0x0004,
- 0x9551,0x0142,0xc888,0x6a02,0xa524,0x0402,0x8c00,0x0002,
- 0xa450,0x0002,0x8000,0x0002,0x8000,0x0006,0x4000,0x0004,
- 0x4200,0x0004,0x4100,0x0044,0x2100,0x0188,0x3000,0x3808,
- 0x130e,0x2010,0x0840,0x0020,0x0420,0x0040,0x0220,0x0080,
- 0x0180,0x0300,0x0070,0x1c00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x037f,0xff80,
- 0x07ff,0xffc0,0x0fff,0xf7e0,0x1fff,0xb0f0,0x3fff,0xc0a8,
- 0x3fff,0xc0f8,0x7fff,0xc034,0x7fff,0x806c,0x7fff,0xc054,
- 0xffff,0xc176,0xffff,0xfbca,0xffff,0xff6a,0xfdff,0xf6a6,
- 0xfdff,0xfbaa,0xffff,0xed42,0xffff,0xbd56,0x7fff,0xea94,
- 0x7eff,0x6d24,0x7dfd,0xd74c,0x3f37,0x5ba8,0x3bfa,0xbc88,
- 0x1b2e,0xa510,0x0841,0x5060,0x07a4,0xa540,0x02aa,0x4080,
- 0x01aa,0x8b00,0x0070,0x5c00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x037f,0xff80,
- 0x07ff,0xffc0,0x0fff,0xf7e0,0x1fff,0xb0f0,0x3fff,0xc0a8,
- 0x3fff,0xc0f8,0x7fff,0xc034,0x7fff,0x806c,0x7fff,0xc054,
- 0xffff,0xc176,0xffff,0xfbca,0xffff,0xff6a,0xfdff,0xf6a6,
- 0xfdff,0xfbaa,0xffff,0xed42,0xffff,0xbd56,0x7fff,0xea94,
- 0x7eff,0x6d24,0x7dfd,0xd74c,0x3f37,0x5ba8,0x3bfa,0xbc88,
- 0x1b2e,0xa510,0x0841,0x5060,0x07a4,0xa540,0x02aa,0x4080,
- 0x01aa,0x8b00,0x0070,0x5c00,0x000f,0xe000,0x0000,0x0000,
- 0x000f,0xe000,0x0070,0x1c00,0x0180,0x0300,0x0280,0x0080,
- 0x0500,0x0040,0x0800,0x0020,0x1000,0x0010,0x2000,0x0058,
- 0x2400,0x0008,0x4400,0x000c,0x4400,0x0014,0x4000,0x002c,
- 0x8000,0x000a,0x8000,0x0036,0x8400,0x0096,0x8600,0x095a,
- 0x8600,0x0456,0x8000,0x12be,0x8000,0x42ae,0x4000,0x156c,
- 0x4300,0x92dc,0x4302,0x28f4,0x21c8,0xa5d8,0x3405,0x7b78,
- 0x17df,0x7af0,0x0ffe,0xafa0,0x047b,0x5ac0,0x0375,0xbf80,
- 0x01d5,0x7700,0x007f,0xbc00,0x000f,0xe000,0x0000,0x0000
-};
-
-static int rs_b45img[] = {
- 0x000f,0xe000,0x0070,0x1c00,0x0180,0x0300,0x0280,0x0080,
- 0x0500,0x0840,0x0800,0x08a0,0x1000,0x7790,0x2000,0x2088,
- 0x2400,0x2048,0x4400,0xc064,0x4400,0x2084,0x4000,0x2084,
- 0x8000,0x3bc2,0x8000,0x6402,0x8400,0x0402,0x8400,0x0002,
- 0x8400,0x0002,0x8000,0x0002,0x8000,0x0006,0x4000,0x000c,
- 0x4200,0x0004,0x4100,0x0044,0x2100,0x0188,0x3000,0x1808,
- 0x130e,0x6010,0x0840,0x0020,0x0420,0x0040,0x0220,0x0080,
- 0x0180,0x0300,0x0070,0x1c00,0x000f,0xe000,0x0000,0x0000
-};
-
-static int rs_b44img[] = {
- 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x03ff,0xff80,
- 0x07ff,0xffc0,0x0fff,0xffe0,0x1fff,0xfff0,0x3fff,0xfff8,
- 0x3fff,0xfff8,0x7fff,0xfffc,0x7fff,0xfffc,0x7fff,0xfffc,
- 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,
- 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0x7fff,0xfffc,
- 0x7fff,0xfffc,0x7fff,0xfffc,0x3fff,0xfff8,0x3fff,0xfff8,
- 0x1fff,0xfff0,0x0fff,0xffe0,0x07ff,0xffc0,0x03ff,0xff80,
- 0x01ff,0xff00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000
-};
-
-static int rs_b43img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
- 0x4007,0xe003,0x4007,0xf203,0x4007,0xfe03,0x4000,0x7e03,
- 0x4000,0x3e03,0x407e,0x3e03,0x407c,0x7e03,0x407c,0x0003,
- 0x407e,0x0003,0x407f,0xc003,0x404f,0xc003,0x4007,0xc003,
- 0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b42img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4007,0xe002,
- 0x4007,0xf202,0x4007,0xfe02,0x4000,0x7e02,0x4000,0x3e02,
- 0x407e,0x3e02,0x407c,0x7e02,0x407c,0x0002,0x407e,0x0002,
- 0x407f,0xc002,0x404f,0xc002,0x4007,0xc002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b41img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
- 0x4007,0xe003,0x4007,0xf303,0x4007,0xff03,0x4007,0xff03,
- 0x4000,0x3f03,0x407f,0xbf03,0x407f,0x7f03,0x407e,0x7f03,
- 0x407e,0x0003,0x407f,0xe003,0x407f,0xe003,0x4067,0xe003,
- 0x4047,0xe003,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b40img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0007,0xe000,0x0007,0xf200,0x0007,0xfe00,0x0000,0x7e00,
- 0x0000,0x3e00,0x007e,0x3e00,0x007c,0x7e00,0x007c,0x0000,
- 0x007e,0x0000,0x007f,0xc000,0x004f,0xc000,0x0007,0xc000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4007,0xe002,
- 0x4007,0xf202,0x4007,0xfe02,0x4000,0x7e02,0x4000,0x3e02,
- 0x407e,0x3e02,0x407c,0x7e02,0x407c,0x0002,0x407e,0x0002,
- 0x407f,0xc002,0x404f,0xc002,0x4007,0xc002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b39img[] = {
- 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4007,0xe002,0x4007,0xf202,0x4007,0xfe02,0x4000,0x7e02,
- 0x4000,0x3e02,0x407e,0x3e02,0x407c,0x7e02,0x407c,0x0002,
- 0x407e,0x0002,0x407f,0xc002,0x404f,0xc002,0x4007,0xc002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,
- 0x0000,0x0000
-};
-
-static int rs_b38img[] = {
- 0x7fff,0xfffe,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b37img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
- 0x4030,0x1803,0x4078,0x3c03,0x407c,0x7c03,0x403e,0xf803,
- 0x401f,0xf003,0x400f,0xe003,0x4007,0xc003,0x400f,0xe003,
- 0x401f,0xf003,0x403e,0xf803,0x407c,0x7c03,0x4078,0x3c03,
- 0x4030,0x1803,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b36img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4030,0x1802,
- 0x4078,0x3c02,0x407c,0x7c02,0x403e,0xf802,0x401f,0xf002,
- 0x400f,0xe002,0x4007,0xc002,0x400f,0xe002,0x401f,0xf002,
- 0x403e,0xf802,0x407c,0x7c02,0x4078,0x3c02,0x4030,0x1802,
- 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b35img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
- 0x4030,0x1803,0x4078,0x3e03,0x407c,0x7e03,0x403e,0xfe03,
- 0x401f,0xfc03,0x400f,0xf803,0x4007,0xf003,0x400f,0xe003,
- 0x401f,0xf003,0x403f,0xf803,0x407f,0x7c03,0x407e,0x3e03,
- 0x403c,0x1e03,0x4038,0x1c03,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b34img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0030,0x1800,0x0078,0x3c00,0x007c,0x7c00,0x003e,0xf800,
- 0x001f,0xf000,0x000f,0xe000,0x0007,0xc000,0x000f,0xe000,
- 0x001f,0xf000,0x003e,0xf800,0x007c,0x7c00,0x0078,0x3c00,
- 0x0030,0x1800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b33img[] = {
- 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4030,0x1802,0x4078,0x3c02,0x407c,0x7c02,0x403e,0xf802,
- 0x401f,0xf002,0x400f,0xe002,0x4007,0xc002,0x400f,0xe002,
- 0x401f,0xf002,0x403e,0xf802,0x407c,0x7c02,0x4078,0x3c02,
- 0x4030,0x1802,0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,
- 0x0000,0x0000
-};
-
-static int rs_b32img[] = {
- 0x7fff,0xfffe,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b31img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
- 0x4001,0x8003,0x4001,0xc003,0x4001,0xe003,0x4001,0xf003,
- 0x407f,0xf803,0x407f,0xfc03,0x407f,0xfe03,0x407f,0xfc03,
- 0x407f,0xf803,0x4001,0xf003,0x4001,0xe003,0x4001,0xc003,
- 0x4001,0x8003,0x4001,0x0003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b30img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4001,0x0002,0x4001,0x8002,
- 0x4001,0xc002,0x4001,0xe002,0x4001,0xf002,0x407f,0xf802,
- 0x407f,0xfc02,0x407f,0xfe02,0x407f,0xfc02,0x407f,0xf802,
- 0x4001,0xf002,0x4001,0xe002,0x4001,0xc002,0x4001,0x8002,
- 0x4001,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b29img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
- 0x4001,0x8003,0x4001,0xc003,0x4001,0xe003,0x4001,0xf003,
- 0x407f,0xf803,0x407f,0xfc03,0x407f,0xfe03,0x407f,0xff03,
- 0x407f,0xfe03,0x407f,0xfc03,0x4001,0xf803,0x4001,0xf003,
- 0x4001,0xe003,0x4001,0xc003,0x4001,0x8003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b28img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0001,0x0000,0x0001,0x8000,0x0001,0xc000,
- 0x0001,0xe000,0x0001,0xf000,0x007f,0xf800,0x007f,0xfc00,
- 0x007f,0xfe00,0x007f,0xfc00,0x007f,0xf800,0x0001,0xf000,
- 0x0001,0xe000,0x0001,0xc000,0x0001,0x8000,0x0001,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b27img[] = {
- 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4001,0x0002,
- 0x4001,0x8002,0x4001,0x4002,0x4001,0x2002,0x407f,0x1002,
- 0x4040,0x0802,0x4040,0x0402,0x406a,0xaa02,0x4055,0x5402,
- 0x406a,0xa802,0x407f,0x5002,0x4001,0xa002,0x4001,0x4002,
- 0x4001,0x8002,0x4001,0x0002,0x4000,0x0002,0x7fff,0xfffe,
- 0x0000,0x0000
-};
-
-static int rs_b26img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
- 0x4001,0x8003,0x4001,0xc003,0x4001,0xe003,0x407f,0xf003,
- 0x407f,0xf803,0x407f,0xfc03,0x407f,0xfe03,0x407f,0xfc03,
- 0x407f,0xf803,0x407f,0xf003,0x4001,0xe003,0x4001,0xc003,
- 0x4001,0x8003,0x4001,0x0003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b25img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x1c03,
- 0x4003,0x9c03,0x4007,0xdc03,0x400f,0xfc03,0x401f,0xfc03,
- 0x403f,0xfc03,0x407f,0xfc03,0x40ff,0xfe03,0x41ff,0xff03,
- 0x41ff,0xff03,0x40ff,0xfe03,0x40ff,0xfe03,0x40ff,0xfe03,
- 0x40ff,0xfe03,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b24img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0001,0x0800,0x0003,0x8800,0x0006,0xc800,0x000d,0x6800,
- 0x001b,0xb000,0x0037,0xd800,0x006f,0xec00,0x00d8,0x3600,
- 0x003b,0xb800,0x007b,0xbc00,0x007b,0xbc00,0x007b,0xbc00,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0001,0x0800,0x0003,0x8800,0x0006,0xc800,
- 0x000d,0x6800,0x001b,0xb000,0x0037,0xd800,0x006f,0xec00,
- 0x00d8,0x3600,0x003b,0xb800,0x007b,0xbc00,0x007b,0xbc00,
- 0x007b,0xbc00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0001,0x0800,0x0003,0x8800,
- 0x0006,0xc800,0x000d,0x6800,0x001b,0xb000,0x0037,0xd800,
- 0x006f,0xec00,0x00d8,0x3600,0x003b,0xb800,0x007b,0xbc00,
- 0x007b,0xbc00,0x007b,0xbc00,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4001,0x1c02,0x4002,0x9402,
- 0x4004,0x5402,0x4009,0x3402,0x4012,0x9402,0x4024,0x4c02,
- 0x4048,0x2402,0x4090,0x1202,0x4127,0xc902,0x41c4,0x4702,
- 0x4084,0x4202,0x4084,0x4202,0x4084,0x4202,0x40ff,0xfe02,
- 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b23img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x1c03,
- 0x4003,0x9e03,0x4007,0xde03,0x400f,0xfe03,0x401f,0xfe03,
- 0x403f,0xfe03,0x407f,0xfe03,0x40ff,0xfe03,0x41ff,0xff03,
- 0x41ff,0xff83,0x40ff,0xff83,0x40ff,0xff03,0x40ff,0xff03,
- 0x40ff,0xff03,0x407f,0xff03,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b22img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x1c00,
- 0x0003,0x9c00,0x0007,0xdc00,0x000f,0xfc00,0x001e,0xfc00,
- 0x003c,0x7c00,0x0078,0x3c00,0x00f0,0x1e00,0x01e7,0xcf00,
- 0x01c7,0xc700,0x0087,0xc200,0x0087,0xc200,0x0087,0xc200,
- 0x00ff,0xfe00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0001,0x1c00,0x0003,0x9400,0x0007,0xd400,0x000f,0xf400,
- 0x001e,0xf400,0x003c,0x7c00,0x0078,0x3c00,0x00f0,0x1e00,
- 0x01e7,0xcf00,0x01c7,0xc700,0x0087,0xc200,0x0087,0xc200,
- 0x0087,0xc200,0x00ff,0xfe00,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0001,0x1c00,0x0002,0x9400,0x0004,0x5400,
- 0x0009,0x3400,0x0012,0x9400,0x0024,0x4c00,0x0048,0x2400,
- 0x0090,0x1200,0x0127,0xc900,0x01c4,0x4700,0x0084,0x4200,
- 0x0084,0x4200,0x0084,0x4200,0x00ff,0xfe00,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4001,0x1c02,0x4002,0x9602,
- 0x4004,0x5602,0x4009,0x3602,0x4013,0x9602,0x4026,0xce02,
- 0x404c,0x6602,0x4098,0x3202,0x4137,0xd902,0x41e7,0xcf82,
- 0x4087,0xc382,0x4087,0xc302,0x4087,0xc302,0x40ff,0xff02,
- 0x407f,0xff02,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b21img[] = {
- 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4001,0x1c02,
- 0x4002,0x9c02,0x4004,0x5c02,0x4009,0x3c02,0x4012,0x9c02,
- 0x4024,0x4c02,0x4048,0x2402,0x4090,0x1202,0x4120,0x0902,
- 0x41c7,0xc702,0x4087,0xc202,0x4087,0xc202,0x4087,0xc202,
- 0x4087,0xc202,0x40ff,0xfe02,0x4000,0x0002,0x7fff,0xfffe,
- 0x0000,0x0000
-};
-
-static int rs_b20img[] = {
- 0x7fff,0xfffe,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b19img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x8003,
- 0x4001,0x8003,0x4003,0x8003,0x4007,0x8003,0x400f,0x8003,
- 0x401f,0xfe03,0x403f,0xfe03,0x407f,0xfe03,0x403f,0xfe03,
- 0x401f,0xfe03,0x400f,0x8003,0x4007,0x8003,0x4003,0x8003,
- 0x4001,0x8003,0x4000,0x8003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b18img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x8002,0x4001,0x8002,
- 0x4003,0x8002,0x4007,0x8002,0x400f,0x8002,0x401f,0xfe02,
- 0x403f,0xfe02,0x407f,0xfe02,0x403f,0xfe02,0x401f,0xfe02,
- 0x400f,0x8002,0x4007,0x8002,0x4003,0x8002,0x4001,0x8002,
- 0x4000,0x8002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b17img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0xc003,
- 0x4001,0xc003,0x4003,0xc003,0x4007,0xc003,0x400f,0xc003,
- 0x401f,0xff03,0x403f,0xff03,0x407f,0xff03,0x403f,0xff03,
- 0x401f,0xff03,0x400f,0xff03,0x4007,0xc003,0x4003,0xc003,
- 0x4001,0xc003,0x4000,0xc003,0x4000,0x4003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b16img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x8000,0x0001,0x8000,0x0003,0x8000,
- 0x0007,0x8000,0x000f,0x8000,0x001f,0xfe00,0x003f,0xfe00,
- 0x007f,0xfe00,0x003f,0xfe00,0x001f,0xfe00,0x000f,0x8000,
- 0x0007,0x8000,0x0003,0x8000,0x0001,0x8000,0x0000,0x8000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
- 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
-};
-
-static int rs_b15img[] = {
- 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4001,0x0002,
- 0x4003,0x0002,0x4005,0x0002,0x4009,0x0002,0x4011,0xfc02,
- 0x4020,0x0402,0x4040,0x0402,0x40aa,0xac02,0x4055,0x5402,
- 0x402a,0xac02,0x4015,0xfc02,0x400b,0x0002,0x4005,0x0002,
- 0x4003,0x0002,0x4001,0x0002,0x4000,0x0002,0x7fff,0xfffe,
- 0x0000,0x0000
-};
-
-static int rs_b14img[] = {
- 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
- 0x4003,0x0003,0x4007,0x0003,0x400f,0x0003,0x401f,0xfc03,
- 0x403f,0xfc03,0x407f,0xfc03,0x40ff,0xfc03,0x407f,0xfc03,
- 0x403f,0xfc03,0x401f,0xfc03,0x400f,0x0003,0x4007,0x0003,
- 0x4003,0x0003,0x4001,0x0003,0x4000,0x0003,0x7fff,0xffff,
- 0x3fff,0xffff
-};
-
-static int rs_b13img[] = {
- 0x0000,0x3ffc,0x2004,0x2ff4,0x2004,0x3ffc,0x303c,0x3ffc,
- 0x2004,0x2ff4,0x2004,0x2fe4,0x2004,0x2ff4,0x2004,0x3ffc
-};
-
-static int rs_b12img[] = {
- 0x0000,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
- 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc
-};
-
-static int rs_b11img[] = {
- 0x0000,0x0000,0x0180,0x03c0,0x07e0,0x0ff0,0x0180,0x0180,
- 0x0180,0x0180,0x0180,0x0ff0,0x07e0,0x03c0,0x0180,0x0000
-};
-
-static int rs_b10img[] = {
- 0x0000,0x0180,0x03c0,0x07e0,0x0ff0,0x1ff8,0x0ff0,0x03c0,
- 0x03c0,0x03c0,0x0ff0,0x1ff8,0x0ff0,0x07e0,0x03c0,0x0180
-};
-
-static int rs_b9img[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0810,0x1818,0x381c,0x7ffe,
- 0x7ffe,0x381c,0x1818,0x0810,0x0000,0x0000,0x0000,0x0000
-};
-
-static int rs_b8img[] = {
- 0x0000,0x0000,0x0000,0x0810,0x1c38,0x3c3c,0x7ffe,0xffff,
- 0xffff,0x7ffe,0x3c3c,0x1c38,0x0810,0x0000,0x0000,0x0000
-};
-
-static int rs_b7img[] = {
- 0x0000,0x0000,0x1008,0x381c,0x1c38,0x0e70,0x07e0,0x03c0,
- 0x03c0,0x07e0,0x0e70,0x1c38,0x381c,0x1008,0x0000,0x0000
-};
-
-static int rs_b6img[] = {
- 0x0000,0x1008,0x381c,0x7c3e,0x3e7c,0x1ff8,0x0ff0,0x07e0,
- 0x07e0,0x0ff0,0x1ff8,0x3e3c,0x7c3e,0x381c,0x1008,0x0000
-};
-
-static int rs_b5img[] = {
- 0x0000,0x4000,0x60fe,0x7082,0x78c6,0x7c6c,0x7e38,0x7f38,
- 0x7fc4,0x7c82,0x6cfe,0x46fe,0x0600,0x0300,0x0300,0x0000
-};
-
-static int rs_b4img[] = {
- 0xc000,0xe0fe,0xf1ff,0xf9ff,0xfdff,0xfefe,0xff7c,0xfffc,
- 0xfffe,0xffff,0xffff,0xefff,0xcffe,0x8780,0x0780,0x0380
-};
-
-static int rs_b3img[] = {
- 0x0000,0x4000,0x60f0,0x71f8,0x7b1c,0x7e3e,0x7e76,0x7ee6,
- 0x7fc6,0x7f8c,0x6df8,0x46f0,0x0600,0x0300,0x0300,0x0000
-};
-
-static int rs_b2img[] = {
- 0xc000,0xe0f0,0xf1f8,0xfbfc,0xfffe,0xffff,0xffff,0xffff,
- 0xffff,0xfffe,0xfffc,0xeff8,0xcff0,0x8780,0x0780,0x0380
-};
-
-static int rs_b1img[] = {
- 0x0000,0x4000,0x603c,0x707e,0x786e,0x7c1c,0x7e38,0x7f76,
- 0x7ffe,0x7c3c,0x6c00,0x4618,0x0618,0x0300,0x0300,0x0000
-};
-
-static int rs_b0img[] = {
- 0xc000,0xe03c,0xf03e,0xf8ff,0xfcff,0xfe7e,0xff7e,0xffff,
- 0xffff,0xfffe,0xfe3c,0xff3c,0xcf3c,0x8798,0x0780,0x0380
-};
-
-#define RS_NBITBLK 1
-
-static BITBLK rs_bitblk[] = {
- rs_b222img, 6, 24, 0, 0, 1
-};
-
-#define RS_NICNBLK 7
-
-static ICONBLK rs_icnblk[] = {
- rs_b0img, rs_b1img, rs_s10, 4096, 0, 0,
- 0, 0, 16, 16, 8, 2, 0, 0,
-
- rs_b2img, rs_b3img, rs_s11, 4096, 0, 0,
- 0, 0, 16, 16, 8, 2, 0, 0,
-
- rs_b4img, rs_b5img, rs_s12, 4096, 0, 0,
- 0, 0, 16, 16, 8, 2, 0, 0,
-
- rs_b6img, rs_b7img, rs_s13, 4096, 6, 6,
- 0, 0, 16, 16, 7, 8, 0, 0,
-
- rs_b8img, rs_b9img, rs_s14, 4096, 8, 8,
- 0, 0, 16, 16, 5, 5, 0, 0,
-
- rs_b10img, rs_b11img, rs_s15, 4096, 8, 8,
- 0, 0, 16, 16, 5, 5, 0, 0,
-
- rs_b12img, rs_b13img, rs_s16, 4096, 7, 8,
- 0, 0, 16, 16, 5, 5, 0, 0
-};
-
-static CICON rs_cicon[] = {
-#define CI0 0
-/* CICON 0 */
- 4, rs_b16img, rs_b17img, rs_b18img, rs_b19img, 0L,
-
-#define CI1 1
-/* CICON 1 */
- 4, rs_b22img, rs_b23img, rs_b24img, rs_b25img, 0L,
-
-#define CI2 2
-/* CICON 2 */
- 4, rs_b28img, rs_b29img, rs_b30img, rs_b31img, 0L,
-
-#define CI3 3
-/* CICON 3 */
- 4, rs_b34img, rs_b35img, rs_b36img, rs_b37img, 0L,
-
-#define CI4 4
-/* CICON 4 */
- 4, rs_b40img, rs_b41img, rs_b42img, rs_b43img, 0L,
-
-#define CI5 5
-/* CICON 5 */
- 4, rs_b46img, rs_b47img, 0L, 0L, &rs_cicon[6],
- 8, rs_b48img, rs_b49img, 0L, 0L, 0L,
-
-#define CI6 7
-/* CICON 6 */
- 8, rs_b52img, rs_b53img, 0L, 0L, &rs_cicon[8],
- 4, rs_b54img, rs_b55img, 0L, 0L, 0L,
-
-#define CI7 9
-/* CICON 7 */
- 4, rs_b58img, rs_b59img, 0L, 0L, 0L,
-
-#define CI8 10
-/* CICON 8 */
- 4, rs_b62img, rs_b63img, 0L, 0L, 0L,
-
-#define CI9 11
-/* CICON 9 */
- 4, rs_b66img, rs_b67img, 0L, 0L, 0L,
-
-#define CI10 12
-/* CICON 10 */
- 4, rs_b70img, rs_b71img, 0L, 0L, &rs_cicon[13],
- 8, rs_b72img, rs_b73img, 0L, 0L, 0L,
-
-#define CI11 14
-/* CICON 11 */
- 4, rs_b76img, rs_b77img, 0L, 0L, &rs_cicon[15],
- 8, rs_b78img, rs_b79img, 0L, 0L, 0L,
-
-#define CI12 16
-/* CICON 12 */
- 4, rs_b82img, rs_b83img, 0L, 0L, &rs_cicon[17],
- 8, rs_b84img, rs_b85img, 0L, 0L, 0L,
-
-#define CI13 18
-/* CICON 13 */
- 4, rs_b88img, rs_b89img, 0L, 0L, &rs_cicon[19],
- 8, rs_b90img, rs_b91img, 0L, 0L, 0L,
-
-#define CI14 20
-/* CICON 14 */
- 4, rs_b94img, rs_b95img, 0L, 0L, &rs_cicon[21],
- 8, rs_b96img, rs_b97img, 0L, 0L, 0L,
-
-#define CI15 22
-/* CICON 15 */
- 4, rs_b100img, rs_b101img, 0L, 0L, &rs_cicon[23],
- 8, rs_b102img, rs_b103img, 0L, 0L, 0L,
-
-#define CI16 24
-/* CICON 16 */
- 4, rs_b106img, rs_b107img, 0L, 0L, &rs_cicon[25],
- 8, rs_b108img, rs_b109img, 0L, 0L, 0L,
-
-#define CI17 26
-/* CICON 17 */
- 4, rs_b112img, rs_b113img, 0L, 0L, &rs_cicon[27],
- 8, rs_b114img, rs_b115img, 0L, 0L, 0L,
-
-#define CI18 28
-/* CICON 18 */
- 4, rs_b118img, rs_b119img, 0L, 0L, &rs_cicon[29],
- 8, rs_b120img, rs_b121img, 0L, 0L, 0L,
-
-#define CI19 30
-/* CICON 19 */
- 4, rs_b124img, rs_b125img, 0L, 0L, &rs_cicon[31],
- 8, rs_b126img, rs_b127img, 0L, 0L, 0L,
-
-#define CI20 32
-/* CICON 20 */
- 4, rs_b130img, rs_b131img, 0L, 0L, &rs_cicon[33],
- 8, rs_b132img, rs_b133img, 0L, 0L, 0L,
-
-#define CI21 34
-/* CICON 21 */
- 4, rs_b136img, rs_b137img, 0L, 0L, &rs_cicon[35],
- 8, rs_b138img, rs_b139img, 0L, 0L, 0L,
-
-#define CI22 36
-/* CICON 22 */
- 4, rs_b142img, rs_b143img, 0L, 0L, &rs_cicon[37],
- 8, rs_b144img, rs_b145img, 0L, 0L, 0L,
-
-#define CI23 38
-/* CICON 23 */
- 1, rs_b148img, rs_b149img, rs_b150img, rs_b151img, &rs_cicon[39],
- 4, rs_b152img, rs_b153img, rs_b154img, rs_b155img, &rs_cicon[40],
- 8, rs_b156img, rs_b157img, rs_b158img, rs_b159img, 0L,
-
-#define CI24 41
-/* CICON 24 */
- 1, rs_b162img, rs_b163img, rs_b164img, rs_b165img, &rs_cicon[42],
- 4, rs_b166img, rs_b167img, rs_b168img, rs_b169img, &rs_cicon[43],
- 8, rs_b170img, rs_b171img, rs_b172img, rs_b173img, 0L,
-
-#define CI25 44
-/* CICON 25 */
- 1, rs_b176img, rs_b177img, rs_b178img, rs_b179img, &rs_cicon[45],
- 4, rs_b180img, rs_b181img, rs_b182img, rs_b183img, &rs_cicon[46],
- 8, rs_b184img, rs_b185img, rs_b186img, rs_b187img, 0L,
-
-#define CI26 47
-/* CICON 26 */
- 1, rs_b190img, rs_b191img, rs_b192img, rs_b193img, &rs_cicon[48],
- 4, rs_b194img, rs_b195img, rs_b196img, rs_b197img, &rs_cicon[49],
- 8, rs_b198img, rs_b199img, rs_b200img, rs_b201img, 0L,
-
-#define CI27 50
-/* CICON 27 */
- 1, rs_b204img, rs_b205img, rs_b206img, rs_b207img, &rs_cicon[51],
- 4, rs_b208img, rs_b209img, rs_b210img, rs_b211img, 0L,
-
-#define CI28 52
-/* CICON 28 */
- 1, rs_b214img, rs_b215img, rs_b216img, rs_b217img, &rs_cicon[53],
- 4, rs_b218img, rs_b219img, rs_b220img, rs_b221img, 0L
-};
-
-#define RS_NCICNBLK 29
-
-static CICONBLK rs_ciconblk[] = {
- rs_b14img, rs_b15img, rs_s17, 4096, 0, 0,
- 0, 0, 32, 21, 12, 7, 0, 0,
- &rs_cicon[CI0],
-
- rs_b20img, rs_b21img, rs_s18, 4096, 0, 0,
- 0, 0, 32, 21, 13, 7, 0, 0,
- &rs_cicon[CI1],
-
- rs_b26img, rs_b27img, rs_s19, 4096, 0, 0,
- 0, 0, 32, 21, 14, 7, 0, 0,
- &rs_cicon[CI2],
-
- rs_b32img, rs_b33img, rs_s20, 4096, 0, 0,
- 0, 0, 32, 21, 13, 7, 0, 0,
- &rs_cicon[CI3],
-
- rs_b38img, rs_b39img, rs_s21, 4096, 0, 0,
- 0, 0, 32, 21, 13, 7, 0, 0,
- &rs_cicon[CI4],
-
- rs_b44img, rs_b45img, rs_s22, 4096, 0, 0,
- 0, 0, 32, 32, 13, 13, 0, 0,
- &rs_cicon[CI5],
-
- rs_b50img, rs_b51img, "FAVICON", 4096, 0, 0,
- 28, 0, 16, 16, 0, 16, 72, 8,
- &rs_cicon[CI6],
-
- rs_b56img, rs_b57img, rs_s23, 4096, 5, 6,
- 0, 0, 16, 16, 5, 5, 6, 8,
- &rs_cicon[CI7],
-
- rs_b60img, rs_b61img, rs_s24, 4096, 5, 6,
- 0, 0, 16, 16, 5, 5, 6, 8,
- &rs_cicon[CI8],
-
- rs_b64img, rs_b65img, rs_s25, 4096, 14, 21,
- 0, 0, 32, 32, 12, 13, 6, 8,
- &rs_cicon[CI9],
-
- rs_b68img, rs_b69img, rs_s26, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI10],
-
- rs_b74img, rs_b75img, rs_s27, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI11],
-
- rs_b80img, rs_b81img, rs_s28, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI12],
-
- rs_b86img, rs_b87img, rs_s29, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI13],
-
- rs_b92img, rs_b93img, rs_s30, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI14],
-
- rs_b98img, rs_b99img, rs_s31, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI15],
-
- rs_b104img, rs_b105img, rs_s32, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI16],
-
- rs_b110img, rs_b111img, rs_s33, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI17],
-
- rs_b116img, rs_b117img, rs_s34, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI18],
-
- rs_b122img, rs_b123img, rs_s35, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI19],
-
- rs_b128img, rs_b129img, rs_s36, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI20],
-
- rs_b134img, rs_b135img, rs_s37, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI21],
-
- rs_b140img, rs_b141img, rs_s38, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI22],
-
- rs_b146img, rs_b147img, rs_s39, 4096, 7, 8,
- 0, 0, 16, 16, 15, 8, 0, 0,
- &rs_cicon[CI23],
-
- rs_b160img, rs_b161img, rs_s40, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI24],
-
- rs_b174img, rs_b175img, rs_s41, 4096, 0, 0,
- 0, 0, 16, 16, 5, 5, 0, 0,
- &rs_cicon[CI25],
-
- rs_b188img, rs_b189img, rs_s42, 4096, 7, 8,
- 0, 0, 16, 16, 15, 8, 0, 0,
- &rs_cicon[CI26],
-
- rs_b202img, rs_b203img, rs_s43, 4096, 16, 0,
- 0, 0, 16, 16, 0, 0, 0, 0,
- &rs_cicon[CI27],
-
- rs_b212img, rs_b213img, rs_s44, 4096, 16, 0,
- 0, 0, 16, 16, 0, 0, 0, 0,
- &rs_cicon[CI28]
-};
-
-#define RS_NOBS 280
-
-static OBJECT rs_obj[] = {
-#define TR0 0
-/* TREE 0 */
- -1, 1, 10, G_IBOX, /*** 0 ***/
- NONE,
- NORMAL,
- (long) 0L,
- 0, 0, 80, 25,
-
- 10, 2, 2, G_BOX, /*** 1 ***/
- NONE,
- NORMAL,
- (long) 4352L,
- 0, 0, 80, 513,
-
- 1, 3, 9, G_IBOX, /*** 2 ***/
- NONE,
- NORMAL,
- (long) 0L,
- 2, 0, 65, 769,
-
- 4, -1, -1, G_TITLE, /*** 3 ***/
- NONE,
- NORMAL,
- (long) " NetSurf ",
- 0, 0, 11, 769,
-
- 5, -1, -1, G_TITLE, /*** 4 ***/
- NONE,
- NORMAL,
- (long) " File ",
- 11, 0, 7, 769,
-
- 6, -1, -1, G_TITLE, /*** 5 ***/
- NONE,
- NORMAL,
- (long) " Edit ",
- 18, 0, 7, 769,
-
- 7, -1, -1, G_TITLE, /*** 6 ***/
- NONE,
- NORMAL,
- (long) " Display ",
- 25, 0, 10, 769,
-
- 8, -1, -1, G_TITLE, /*** 7 ***/
- NONE,
- NORMAL,
- (long) " Navigate ",
- 35, 0, 11, 769,
-
- 9, -1, -1, G_TITLE, /*** 8 ***/
- NONE,
- NORMAL,
- (long) " Utilities ",
- 46, 0, 12, 769,
-
- 2, -1, -1, G_TITLE, /*** 9 ***/
- NONE,
- NORMAL,
- (long) " Help ",
- 58, 0, 7, 769,
-
- 0, 11, 60, G_IBOX, /*** 10 ***/
- NONE,
- NORMAL,
- (long) 0L,
- 0, 769, 79, 11,
-
- 20, 12, 19, G_BOX, /*** 11 ***/
- NONE,
- NORMAL,
- (long) 16716032L,
- 2, 0, 22, 8,
-
- 13, -1, -1, G_STRING, /*** 12 ***/
- NONE,
- NORMAL,
- (long) " About... ",
- 0, 0, 22, 1,
-
- 14, -1, -1, G_STRING, /*** 13 ***/
- NONE,
- DISABLED,
- (long) "----------------------",
- 0, 1, 22, 1,
-
- 15, -1, -1, G_STRING, /*** 14 ***/
- NONE,
- NORMAL,
- (long) " Desk Accessory 1 ",
- 0, 2, 22, 1,
-
- 16, -1, -1, G_STRING, /*** 15 ***/
- NONE,
- NORMAL,
- (long) " Desk Accessory 2",
- 0, 3, 22, 1,
-
- 17, -1, -1, G_STRING, /*** 16 ***/
- NONE,
- NORMAL,
- (long) " Desk Accessory 3",
- 0, 4, 22, 1,
-
- 18, -1, -1, G_STRING, /*** 17 ***/
- NONE,
- NORMAL,
- (long) " Desk Accessory 4",
- 0, 5, 22, 1,
-
- 19, -1, -1, G_STRING, /*** 18 ***/
- NONE,
- NORMAL,
- (long) " Desk Accessory 5",
- 0, 6, 22, 1,
-
- 11, -1, -1, G_STRING, /*** 19 ***/
- NONE,
- NORMAL,
- (long) " Desk Accessory 6",
- 0, 7, 22, 1,
-
- 29, 21, 28, G_BOX, /*** 20 ***/
- NONE,
- NORMAL,
- (long) 16716032L,
- 13, 0, 25, 8,
-
- 22, -1, -1, G_STRING, /*** 21 ***/
- NONE,
- NORMAL,
- (long) " New window [^N",
- 0, 0, 25, 1,
-
- 23, -1, -1, G_STRING, /*** 22 ***/
- NONE,
- NORMAL,
- (long) " Open local file...[^O",
- 0, 1, 25, 1,
-
- 24, -1, -1, G_STRING, /*** 23 ***/
- NONE,
- NORMAL,
- (long) " Open location [^G",
- 0, 2, 25, 1,
-
- 25, -1, -1, G_STRING, /*** 24 ***/
- NONE,
- NORMAL,
- (long) " Close window",
- 0, 3, 25, 1,
-
- 26, -1, -1, G_STRING, /*** 25 ***/
- NONE,
- DISABLED,
- (long) rs_s1,
- 0, 4, 25, 1,
-
- 27, -1, -1, G_STRING, /*** 26 ***/
- NONE,
- NORMAL,
- (long) " Save page [^S",
- 0, 5, 25, 1,
-
- 28, -1, -1, G_STRING, /*** 27 ***/
- NONE,
- DISABLED,
- (long) rs_s1,
- 0, 6, 25, 1,
-
- 20, -1, -1, G_STRING, /*** 28 ***/
- NONE,
- NORMAL,
- (long) " Quit [^Q",
- 0, 7, 25, 1,
-
- 35, 30, 34, G_BOX, /*** 29 ***/
- NONE,
- NORMAL,
- (long) 16716032L,
- 20, 0, 28, 5,
-
- 31, -1, -1, G_STRING, /*** 30 ***/
- NONE,
- NORMAL,
- (long) " Cut to clipboard [^X",
- 0, 0, 28, 1,
-
- 32, -1, -1, G_STRING, /*** 31 ***/
- NONE,
- NORMAL,
- (long) " Copy to clipboard [^C",
- 0, 1, 28, 1,
-
- 33, -1, -1, G_STRING, /*** 32 ***/
- NONE,
- NORMAL,
- (long) " Paste from clipboard [^V",
- 0, 2, 28, 1,
-
- 34, -1, -1, G_STRING, /*** 33 ***/
- NONE,
- DISABLED,
- (long) "----------------------------",
- 0, 3, 28, 1,
-
- 29, -1, -1, G_STRING, /*** 34 ***/
- NONE,
- NORMAL,
- (long) " Find... [F4",
- 0, 4, 28, 1,
-
- 47, 36, 46, G_BOX, /*** 35 ***/
- NONE,
- NORMAL,
- (long) 16716032L,
- 27, 0, 30, 11,
-
- 37, -1, -1, G_STRING, /*** 36 ***/
- NONE,
- NORMAL,
- (long) " Stop loading this Page [^\033",
- 0, 0, 30, 1,
-
- 38, -1, -1, G_STRING, /*** 37 ***/
- NONE,
- NORMAL,
- (long) " Reload [F5",
- 0, 1, 30, 1,
-
- 39, -1, -1, G_STRING, /*** 38 ***/
- NONE,
- DISABLED,
- (long) rs_s2,
- 0, 2, 30, 1,
-
- 40, -1, -1, G_STRING, /*** 39 ***/
- NONE,
- NORMAL,
- (long) " Scale View...",
- 0, 3, 30, 1,
-
- 41, -1, -1, G_STRING, /*** 40 ***/
- NONE,
- DISABLED,
- (long) rs_s2,
- 0, 4, 30, 1,
-
- 42, -1, -1, G_STRING, /*** 41 ***/
- NONE,
- NORMAL,
- (long) " Toolbars [^F1",
- 0, 5, 30, 1,
-
- 43, -1, -1, G_STRING, /*** 42 ***/
- NONE,
- DISABLED,
- (long) rs_s2,
- 0, 6, 30, 1,
-
- 44, -1, -1, G_STRING, /*** 43 ***/
- NONE,
- NORMAL,
- (long) " Save window size",
- 0, 7, 30, 1,
-
- 45, -1, -1, G_STRING, /*** 44 ***/
- NONE,
- NORMAL,
- (long) " Debug rendering",
- 0, 8, 30, 1,
-
- 46, -1, -1, G_STRING, /*** 45 ***/
- NONE,
- NORMAL,
- (long) " Background images",
- 0, 9, 30, 1,
-
- 35, -1, -1, G_STRING, /*** 46 ***/
- NONE,
- NORMAL,
- (long) " Foreground images",
- 0, 10, 30, 1,
-
- 51, 48, 50, G_BOX, /*** 47 ***/
- NONE,
- NORMAL,
- (long) 16716032L,
- 37, 0, 24, 3,
-
- 49, -1, -1, G_STRING, /*** 48 ***/
- NONE,
- NORMAL,
- (long) " Back one page [@\004",
- 0, 0, 24, 1,
-
- 50, -1, -1, G_STRING, /*** 49 ***/
- NONE,
- NORMAL,
- (long) " Forward one page [@\003",
- 0, 1, 24, 1,
-
- 47, -1, -1, G_STRING, /*** 50 ***/
- NONE,
- NORMAL,
- (long) " Home",
- 0, 2, 24, 1,
-
- 60, 52, 59, G_BOX, /*** 51 ***/
- NONE,
- NORMAL,
- (long) 16716032L,
- 48, 0, 23, 8,
-
- 53, -1, -1, G_STRING, /*** 52 ***/
- NONE,
- NORMAL,
- (long) " Local History [F7",
- 0, 0, 23, 1,
-
- 54, -1, -1, G_STRING, /*** 53 ***/
- NONE,
- NORMAL,
- (long) " Global History",
- 0, 1, 23, 1,
-
- 55, -1, -1, G_STRING, /*** 54 ***/
- NONE,
- DISABLED,
- (long) rs_s3,
- 0, 2, 23, 1,
-
- 56, -1, -1, G_STRING, /*** 55 ***/
- NONE,
- NORMAL,
- (long) " Add to bookmarks[^D",
- 0, 3, 23, 1,
-
- 57, -1, -1, G_STRING, /*** 56 ***/
- NONE,
- NORMAL,
- (long) " Show bookmarks [F6",
- 0, 4, 23, 1,
-
- 58, -1, -1, G_STRING, /*** 57 ***/
- NONE,
- DISABLED,
- (long) rs_s3,
- 0, 5, 23, 1,
-
- 59, -1, -1, G_STRING, /*** 58 ***/
- NONE,
- NORMAL,
- (long) " Choices... ",
- 0, 6, 23, 1,
-
- 51, -1, -1, G_STRING, /*** 59 ***/
- NONE,
- NORMAL,
- (long) " Verbose Log",
- 0, 7, 23, 1,
-
- 10, 61, 61, G_BOX, /*** 60 ***/
- NONE,
- NORMAL,
- (long) 16716032L,
- 60, 0, 19, 1,
-
- 60, -1, -1, G_STRING, /*** 61 ***/
- LASTOB,
- NORMAL,
- (long) " Help Content[F1",
- 0, 0, 19, 1,
-
-#define TR1 62
-/* TREE 1 */
- -1, 1, 8, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 0, 48, 2049,
-
- 7, 2, 6, G_BOX, /*** 1 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 0, 21, 1793,
-
- 3, -1, -1, G_CICON, /*** 2 ***/
- TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[0],
- 512, 256, 4, 1281,
-
- 4, -1, -1, G_CICON, /*** 3 ***/
- TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[1],
- -1531, 256, 4, 1281,
-
- 5, -1, -1, G_CICON, /*** 4 ***/
- TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[2],
- 520, 256, 4, 1281,
-
- 6, -1, -1, G_CICON, /*** 5 ***/
- TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[3],
- 524, 256, 4, 1281,
-
- 1, -1, -1, G_CICON, /*** 6 ***/
- TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[4],
- 23045, 256, 4, 1281,
-
- 8, -1, -1, G_BOX, /*** 7 ***/
- FL3DBAK,
- NORMAL,
- (long) 16720240L,
- 21, 512, 22, 1025,
-
- 0, -1, -1, G_BOX, /*** 8 ***/
- LASTOB|FL3DBAK,
- NORMAL,
- (long) 4352L,
- 45, 256, 1026, 1537,
-
-#define TR2 71
-/* TREE 2 */
- -1, 1, 2, G_BOX, /*** 0 ***/
- NONE,
- NORMAL,
- (long) 4352L,
- 0, 0, 9, 4,
-
- 2, -1, -1, G_CICON, /*** 1 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[5],
- 2, 1536, 4, 2,
-
- 0, -1, -1, G_TEXT, /*** 2 ***/
- LASTOB,
- NORMAL,
- (long) &rs_tedinfo[0],
- -510, -2557, 517, 2048,
-
-#define TR3 74
-/* TREE 3 */
- -1, 1, 1, G_BOX, /*** 0 ***/
- NONE,
- OUTLINED,
- (long) 135424L,
- 0, 0, 11, 4,
-
- 0, -1, -1, G_CICON, /*** 1 ***/
- LASTOB,
- NORMAL,
- (long) &rs_ciconblk[6],
- 1, 1, 9, 2049,
-
-#define TR4 76
-/* TREE 4 */
- -1, 1, 7, G_BOX, /*** 0 ***/
- NONE,
- OUTLINED,
- (long) 135424L,
- 0, 0, 42, 3,
-
- 2, -1, -1, G_ICON, /*** 1 ***/
- NONE,
- NORMAL,
- (long) &rs_icnblk[0],
- 2, 1, 2, 1,
-
- 3, -1, -1, G_ICON, /*** 2 ***/
- NONE,
- NORMAL,
- (long) &rs_icnblk[1],
- 5, 1, 2, 1,
-
- 4, -1, -1, G_ICON, /*** 3 ***/
- NONE,
- NORMAL,
- (long) &rs_icnblk[2],
- 8, 1, 2, 1,
-
- 5, -1, -1, G_ICON, /*** 4 ***/
- NONE,
- NORMAL,
- (long) &rs_icnblk[3],
- 11, 1, 2, 1,
-
- 6, -1, -1, G_ICON, /*** 5 ***/
- NONE,
- NORMAL,
- (long) &rs_icnblk[4],
- 14, 1, 2, 1,
-
- 7, -1, -1, G_ICON, /*** 6 ***/
- NONE,
- NORMAL,
- (long) &rs_icnblk[5],
- 17, 1, 2, 1,
-
- 0, -1, -1, G_ICON, /*** 7 ***/
- LASTOB,
- NORMAL,
- (long) &rs_icnblk[6],
- 20, 1, 2, 1,
-
-#define TR5 84
-/* TREE 5 */
- -1, 1, 6, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 135424L,
- 0, 0, 1059, 7,
-
- 2, -1, -1, G_CICON, /*** 1 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[7],
- 1025, 1, 2, 1,
-
- 3, -1, -1, G_FTEXT, /*** 2 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[1],
- 1028, 1, 29, 1,
-
- 4, -1, -1, G_CICON, /*** 3 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[8],
- 1025, 3, 2, 1,
-
- 5, -1, -1, G_FTEXT, /*** 4 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[2],
- 1028, 3, 29, 1,
-
- 6, -1, -1, G_BUTTON, /*** 5 ***/
- SELECTABLE|DEFAULT|EXIT|FL3DIND|FL3DBAK,
- NORMAL,
- (long) "Login",
- 15, 5, 8, 1,
-
- 0, -1, -1, G_BUTTON, /*** 6 ***/
- SELECTABLE|EXIT|LASTOB|FL3DIND|FL3DBAK,
- NORMAL,
- (long) rs_s4,
- 25, 5, 8, 1,
-
-#define TR6 91
-/* TREE 6 */
- -1, 1, 16, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 16650496L,
- 0, 0, 38, 20,
-
- 2, -1, -1, G_CICON, /*** 1 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[9],
- 1, 1, 4, 2,
-
- 3, -1, -1, G_TEXT, /*** 2 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[3],
- 6, 1, 31, 1,
-
- 4, -1, -1, G_TEXT, /*** 3 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[4],
- 13, 2, 24, 1,
-
- 5, -1, -1, G_BUTTON, /*** 4 ***/
- SELECTABLE|DEFAULT|EXIT|FL3DIND|FL3DBAK,
- NORMAL,
- (long) "Accept",
- 1, 18, 7, 1,
-
- 6, -1, -1, G_BUTTON, /*** 5 ***/
- SELECTABLE|EXIT|FL3DIND|FL3DBAK,
- NORMAL,
- (long) "Reject",
- 30, 18, 7, 1,
-
- 7, -1, -1, G_STRING, /*** 6 ***/
- FL3DBAK,
- NORMAL,
- (long) "Server:",
- 2053, 2, 7, 1,
-
- 8, -1, -1, G_BUTTON, /*** 7 ***/
- SELECTABLE|TOUCHEXIT|FL3DIND,
- NORMAL,
- (long) "NEXT CERT INFO",
- 513, -1276, 33, 1,
-
- 9, -1, -1, G_BOX, /*** 8 ***/
- FL3DBAK,
- NORMAL,
- (long) 16716128L,
- 1, 5, 34, 11,
-
- 10, -1, -1, G_BOX, /*** 9 ***/
- TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16716049L,
- 3, 272, -226, 1,
-
- 11, -1, -1, G_BOXCHAR, /*** 10 ***/
- TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 67047680L,
- 33, 272, 2, 1,
-
- 12, -1, -1, G_BOXCHAR, /*** 11 ***/
- TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 83824896L,
- 2048, 272, 2, 1,
-
- 13, -1, -1, G_BOX, /*** 12 ***/
- TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16716032L,
- 3, 272, 26, 1,
-
- 14, -1, -1, G_BOXCHAR, /*** 13 ***/
- TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33493248L,
- 291, 5, 2, 1,
-
- 15, -1, -1, G_BOXCHAR, /*** 14 ***/
- TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 50270464L,
- 291, 15, 2, 1,
-
- 16, -1, -1, G_BOX, /*** 15 ***/
- TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16716049L,
- 291, 6, 2, -247,
-
- 0, -1, -1, G_BOX, /*** 16 ***/
- LASTOB|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16716032L,
- 291, 6, 2, 1030,
-
-#define TR7 108
-/* TREE 7 */
- -1, 1, 13, G_BOX, /*** 0 ***/
- FL3DBAK,
- OUTLINED,
- (long) 135424L,
- 0, 0, 44, 3,
-
- 2, -1, -1, G_CICON|(119<<8), /*** 1 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[10],
- 2, 1, 2, 1,
-
- 3, -1, -1, G_CICON|(119<<8), /*** 2 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[11],
- 5, 1, 2, 1,
-
- 4, -1, -1, G_CICON|(119<<8), /*** 3 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[12],
- 8, 1, 2, 1,
-
- 5, -1, -1, G_CICON|(119<<8), /*** 4 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[13],
- 11, 1, 2, 1,
-
- 6, -1, -1, G_CICON|(119<<8), /*** 5 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[14],
- 14, 1, 2, 1,
-
- 7, -1, -1, G_CICON|(119<<8), /*** 6 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[15],
- 17, 1, 2, 1,
-
- 8, -1, -1, G_CICON|(119<<8), /*** 7 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[16],
- 20, 1, 2, 1,
-
- 9, -1, -1, G_CICON|(119<<8), /*** 8 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[17],
- 23, 1, 2, 1,
-
- 10, -1, -1, G_CICON|(119<<8), /*** 9 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[18],
- 26, 1, 2, 1,
-
- 11, -1, -1, G_CICON|(119<<8), /*** 10 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[19],
- 29, 1, 2, 1,
-
- 12, -1, -1, G_CICON|(119<<8), /*** 11 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[20],
- 32, 1, 2, 1,
-
- 13, -1, -1, G_CICON|(119<<8), /*** 12 ***/
- NONE,
- NORMAL,
- (long) &rs_ciconblk[21],
- 35, 1, 2, 1,
-
- 0, -1, -1, G_CICON|(119<<8), /*** 13 ***/
- LASTOB,
- NORMAL,
- (long) &rs_ciconblk[22],
- 39, 1, 2, 1,
-
-#define TR8 122
-/* TREE 8 */
- -1, 1, 4, G_BOX, /*** 0 ***/
- TOUCHEXIT|FL3DBAK,
- WHITEBAK,
- (long) 4352L,
- 0, 0, 10, 1025,
-
- 2, -1, -1, G_CICON, /*** 1 ***/
- SELECTABLE|TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[23],
- 1024, 512, 2, 1,
-
- 3, -1, -1, G_CICON, /*** 2 ***/
- SELECTABLE|TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[24],
- 3, 512, 2, 1,
-
- 4, -1, -1, G_CICON, /*** 3 ***/
- SELECTABLE|TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[25],
- -504, 512, 2, 1,
-
- 0, -1, -1, G_CICON, /*** 4 ***/
- SELECTABLE|LASTOB|TOUCHEXIT,
- NORMAL,
- (long) &rs_ciconblk[26],
- 1029, 512, 2, 1,
-
-#define TR9 127
-/* TREE 9 */
- -1, 1, 8, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 1, 1, 49, 5,
-
- 2, -1, -1, G_FTEXT, /*** 1 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[5],
- 1, 1, 37, 1,
-
- 3, -1, -1, G_STRING, /*** 2 ***/
- NONE,
- DRAW3D,
- (long) "Show all",
- 25, 3, 9, 1,
-
- 4, -1, -1, G_STRING, /*** 3 ***/
- NONE,
- NORMAL,
- (long) "Case sensitive",
- 5, 3, 14, 1,
-
- 5, -1, -1, G_BUTTON, /*** 4 ***/
- SELECTABLE|DEFAULT|TOUCHEXIT|FL3DIND,
- WHITEBAK|DRAW3D,
- (long) "Search",
- 39, 1, 8, 1,
-
- 6, -1, -1, G_STRING, /*** 5 ***/
- NONE,
- DRAW3D,
- (long) "Forward",
- 39, 3, 9, 1,
-
- 7, -1, -1, G_BUTTON|(18<<8), /*** 6 ***/
- SELECTABLE|TOUCHEXIT|FL3DIND|FL3DBAK,
- DRAW3D,
- (long) rs_s0,
- 2, 3, 2, 1,
-
- 8, -1, -1, G_BUTTON|(18<<8), /*** 7 ***/
- SELECTABLE|TOUCHEXIT|FL3DIND|FL3DBAK,
- DRAW3D,
- (long) rs_s0,
- 22, 3, 2, 1,
-
- 0, -1, -1, G_BUTTON|(18<<8), /*** 8 ***/
- SELECTABLE|LASTOB|TOUCHEXIT|FL3DIND|FL3DBAK,
- SELECTED|DRAW3D,
- (long) rs_s0,
- 36, 3, 2, 1,
-
-#define TR10 136
-/* TREE 10 */
- -1, 1, 9, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 16650496L,
- 0, 0, 40, 6,
-
- 3, 2, 2, G_BOX, /*** 1 ***/
- FL3DBAK,
- NORMAL,
- (long) 69953L,
- 1, 1, 1061, 1,
-
- 1, -1, -1, G_BOX, /*** 2 ***/
- FL3DBAK,
- NORMAL,
- (long) 70003L,
- 0, 0, 513, 1,
-
- 4, -1, -1, G_TEXT, /*** 3 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[6],
- 1, 0, 38, 1,
-
- 5, -1, -1, G_BUTTON, /*** 4 ***/
- SELECTABLE|TOUCHEXIT|FL3DIND|FL3DBAK,
- NORMAL,
- (long) rs_s4,
- 31, 4, 8, 1,
-
- 6, -1, -1, G_STRING, /*** 5 ***/
- NONE,
- NORMAL,
- (long) "Close dialog when finished",
- 4, 4, 26, 1,
-
- 7, -1, -1, G_TEXT, /*** 6 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[7],
- 1, 2, 21, 1,
-
- 8, -1, -1, G_TEXT, /*** 7 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[8],
- 22, 2, 5, 1,
-
- 9, -1, -1, G_TEXT, /*** 8 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[9],
- 29, 2, 11, 1,
-
- 0, -1, -1, G_BOXCHAR|(18<<8), /*** 9 ***/
- SELECTABLE|LASTOB|TOUCHEXIT|FL3DIND|FL3DBAK,
- CROSSED|SHADOWED,
- (long) 4096L,
- 1025, 516, 1025, -1023,
-
-#define TR11 146
-/* TREE 11 */
- -1, 1, 1, G_BOX, /*** 0 ***/
- FL3DBAK,
- OUTLINED,
- (long) 135424L,
- 1, 1, 52, 9,
-
- 0, -1, -1, G_IMAGE, /*** 1 ***/
- LASTOB|FL3DBAK,
- NORMAL,
- (long) &rs_bitblk[0],
- 3, 1, 6, 2049,
-
-#define TR12 148
-/* TREE 12 */
- -1, 1, 11, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 16650496L,
- 0, 0, 22, 11,
-
- 2, -1, -1, G_TEXT, /*** 1 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[10],
- 0, 0, 22, 1,
-
- 3, -1, -1, G_TEXT, /*** 2 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[11],
- 0, 1, 22, 1,
-
- 4, -1, -1, G_TEXT, /*** 3 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[12],
- 0, 2, 22, 1,
-
- 5, -1, -1, G_TEXT, /*** 4 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[13],
- 0, 3, 22, 1,
-
- 6, -1, -1, G_TEXT, /*** 5 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[14],
- 0, 4, 22, 1,
-
- 7, -1, -1, G_TEXT, /*** 6 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[15],
- 0, 5, 22, 1,
-
- 8, -1, -1, G_TEXT, /*** 7 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[16],
- 0, 6, 22, 1,
-
- 9, -1, -1, G_TEXT, /*** 8 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[17],
- 0, 7, 22, 1,
-
- 10, -1, -1, G_TEXT, /*** 9 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[18],
- 0, 8, 22, 1,
-
- 11, -1, -1, G_TEXT, /*** 10 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[19],
- 0, 10, 22, 1,
-
- 0, -1, -1, G_TEXT, /*** 11 ***/
- SELECTABLE|LASTOB|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[20],
- 0, 9, 22, 1,
-
-#define TR13 160
-/* TREE 13 */
- -1, 1, 1, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 1, 1, 11, 9,
-
- 0, 2, 4, G_BOX, /*** 1 ***/
- FL3DBAK,
- NORMAL,
- (long) 69888L,
- 1, 1, -509, 7,
-
- 7, 3, 3, G_BUTTON, /*** 2 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED,
- (long) rs_s0,
- 768, 1537, 2, 3,
-
- 2, -1, -1, G_BUTTON, /*** 3 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) rs_s0,
- 0, 0, 2, 2,
-
- 1, -1, -1, G_CICON, /*** 4 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) &rs_ciconblk[28],
- 768, 512, 2, 1,
-
- 7, -1, -1, G_CICON, /*** 5 ***/
- SELECTABLE|FL3DBAK,
- NORMAL,
- (long) &rs_ciconblk[27],
- 512, 256, 2, 1,
-
- 4, -1, -1, G_IBOX, /*** 6 ***/
- FL3DBAK,
- NORMAL,
- (long) 16716032L,
- 256, 256, 1026, 513,
-
- 6, 5, 5, G_IBOX, /*** 7 ***/
- LASTOB|FL3DBAK,
- NORMAL,
- (long) 16716032L,
- 256, -2298, 1026, 513,
-
-#define TR14 168
-/* TREE 14 */
- -1, 1, 86, G_BOX, /*** 0 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 0, 63, 2112,
-
- 2, -1, -1, G_BUTTON, /*** 1 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- NORMAL,
- (long) "Save",
- 1077, 63, 8, 1,
-
- 3, -1, -1, G_BUTTON, /*** 2 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- NORMAL,
- (long) rs_s4,
- 1067, 63, 8, 1,
-
- 32, 4, 31, G_IBOX, /*** 3 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 0, 63, 2062,
-
- 31, 5, 30, G_BOX, /*** 4 ***/
- FL3DBAK,
- NORMAL,
- (long) 16748800L,
- 1, 1, 61, 13,
-
- 6, -1, -1, G_FTEXT, /*** 5 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[21],
- 1, 1, 54, 1,
-
- 7, -1, -1, G_STRING, /*** 6 ***/
- NONE,
- NORMAL,
- (long) "Hide advertisements",
- 1028, 2050, 27, 1,
-
- 8, -1, -1, G_STRING|(18<<8), /*** 7 ***/
- NONE,
- DRAW3D|STATE8,
- (long) "Disable pop-up windows",
- 1028, 4, 27, 1,
-
- 9, -1, -1, G_BOXCHAR|(101<<8), /*** 8 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1025, 2050, 2, 1,
-
- 10, -1, -1, G_BOXCHAR|(101<<8), /*** 9 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1025, 4, 2, 1,
-
- 11, -1, -1, G_STRING, /*** 10 ***/
- NONE,
- NORMAL,
- (long) "Send referrer",
- 1063, 2050, 1044, 1,
-
- 12, -1, -1, G_BOXCHAR|(101<<8), /*** 11 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1060, 2050, 2, 1,
-
- 13, -1, -1, G_STRING, /*** 12 ***/
- NONE,
- NORMAL,
- (long) "Send do not track",
- 1063, 4, 1044, 1,
-
- 14, -1, -1, G_BOXCHAR|(101<<8), /*** 13 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1060, 4, 2, 1,
-
- 15, -1, -1, G_STRING, /*** 14 ***/
- NONE,
- NORMAL,
- (long) "Keep history:",
- 1026, 9, 13, 1,
-
- 16, -1, -1, G_BUTTON, /*** 15 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- NORMAL,
- (long) "Clear history",
- 1060, 9, 13, 1,
-
- 17, -1, -1, G_STRING, /*** 16 ***/
- NONE,
- NORMAL,
- (long) "Request locale:",
- 1, 6, 15, 1,
-
- 18, -1, -1, G_BUTTON, /*** 17 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- DRAW3D|STATE8,
- (long) "______",
- 1042, 6, 8, 1,
-
- 19, -1, -1, G_STRING, /*** 18 ***/
- NONE,
- DISABLED,
- (long) "GUI language:",
- 1026, 2055, 13, 1,
-
- 20, -1, -1, G_BUTTON, /*** 19 ***/
- SELECTABLE|FL3DBAK,
- DISABLED|DRAW3D|STATE8,
- (long) "en",
- 1042, 2055, 8, 1,
-
- 21, -1, -1, G_STRING, /*** 20 ***/
- NONE,
- NORMAL,
- (long) "Memory Cache:",
- 1026, 2058, 13, 1,
-
- 26, 22, 25, G_IBOX, /*** 21 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 1042, 2058, 15, 1,
-
- 23, -1, -1, G_BOXCHAR, /*** 22 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 7, 0, 2, 1,
-
- 24, -1, -1, G_BOXCHAR, /*** 23 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 25, -1, -1, G_STRING, /*** 24 ***/
- NONE,
- DRAW3D,
- (long) "999.5",
- 2, 0, 5, 1,
-
- 21, -1, -1, G_STRING, /*** 25 ***/
- NONE,
- NORMAL,
- (long) "MB",
- 1034, 0, 3, 1,
-
- 30, 27, 29, G_IBOX, /*** 26 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 1042, 9, 15, 1,
-
- 28, -1, -1, G_BOXCHAR, /*** 27 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 29, -1, -1, G_FTEXT, /*** 28 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[22],
- 2, 0, 1028, 1,
-
- 26, -1, -1, G_BOXCHAR, /*** 29 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 7, 0, 2, 1,
-
- 4, -1, -1, G_STRING, /*** 30 ***/
- NONE,
- NORMAL,
- (long) "Days",
- 29, 9, 1028, 1,
-
- 3, -1, -1, G_FTEXT, /*** 31 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[23],
- 2, 2048, 8, 1,
-
- 59, 33, 58, G_IBOX, /*** 32 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 15, 63, 15,
-
- 58, 34, 54, G_BOX, /*** 33 ***/
- FL3DBAK,
- NORMAL,
- (long) 16748800L,
- 1, 1, 61, 2061,
-
- 35, -1, -1, G_BOXCHAR|(101<<8), /*** 34 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1025, 1, 2, 1,
-
- 36, -1, -1, G_STRING, /*** 35 ***/
- NONE,
- NORMAL,
- (long) "Enable Proxy",
- 1028, 1, 13, 1,
-
- 37, -1, -1, G_FTEXT, /*** 36 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[24],
- 1, 2050, 43, 1,
-
- 38, -1, -1, G_STRING, /*** 37 ***/
- NONE,
- NORMAL,
- (long) ":",
- 44, 2050, 1, 1,
-
- 39, -1, -1, G_FTEXT, /*** 38 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[25],
- 45, 2050, 5, 1,
-
- 40, -1, -1, G_BOXCHAR|(101<<8), /*** 39 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1025, 4, 2, 1,
-
- 41, -1, -1, G_STRING, /*** 40 ***/
- NONE,
- NORMAL,
- (long) "Proxy Authentication",
- 1028, 4, 20, 1,
-
- 42, -1, -1, G_FTEXT, /*** 41 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[26],
- 1, 2053, 49, 1,
-
- 43, -1, -1, G_FTEXT, /*** 42 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[27],
- 1, 7, 49, 1,
-
- 44, -1, -1, G_STRING, /*** 43 ***/
- EDITABLE|FL3DBAK,
- DRAW3D,
- (long) "Maximum fetchers:",
- 1, 9, 21, 1,
-
- 45, -1, -1, G_STRING, /*** 44 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) "Fetchers per Host:",
- 1, 2058, 21, 1,
-
- 46, -1, -1, G_STRING, /*** 45 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) "Cached connections:",
- 1, 12, 21, 1,
-
- 50, 47, 49, G_IBOX, /*** 46 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 36, 9, 8, 1,
-
- 48, -1, -1, G_FTEXT, /*** 47 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[28],
- 2, 0, 2, 1,
-
- 49, -1, -1, G_BOXCHAR, /*** 48 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 4, 0, 2, 1,
-
- 46, -1, -1, G_BOXCHAR, /*** 49 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 54, 51, 53, G_IBOX, /*** 50 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 36, 2058, 8, 1,
-
- 52, -1, -1, G_BOXCHAR, /*** 51 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 53, -1, -1, G_FTEXT, /*** 52 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[29],
- 2, 0, 2, 1,
-
- 50, -1, -1, G_BOXCHAR, /*** 53 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 4, 0, 2, 1,
-
- 33, 55, 57, G_IBOX, /*** 54 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 36, 12, 1032, 1,
-
- 56, -1, -1, G_BOXCHAR, /*** 55 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 57, -1, -1, G_FTEXT, /*** 56 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[30],
- 2, 0, 2, 1,
-
- 54, -1, -1, G_BOXCHAR, /*** 57 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 4, 0, 2, 1,
-
- 32, -1, -1, G_TEXT, /*** 58 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[31],
- 3, 2048, 8, 1,
-
- 86, 60, 85, G_IBOX, /*** 59 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 2078, 63, 15,
-
- 85, 61, 108, G_BOX, /*** 60 ***/
- FL3DBAK,
- NORMAL,
- (long) 16748800L,
- 1, 1, 61, 14,
-
- 62, -1, -1, G_STRING, /*** 61 ***/
- NONE,
- NORMAL,
- (long) "Font renderer:",
- 1025, 1, 14, 1,
-
- 63, -1, -1, G_BUTTON, /*** 62 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) "_freetype_",
- 1041, 1, 12, 1,
-
- 64, -1, -1, G_BOXCHAR|(101<<8), /*** 63 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1060, 1, 2, 1,
-
- 65, -1, -1, G_STRING, /*** 64 ***/
- NONE,
- NORMAL,
- (long) "Anti Aliasing",
- 1063, 1, 13, 1,
-
- 66, -1, -1, G_BOXCHAR|(101<<8), /*** 65 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1025, 8, 2, 1,
-
- 75, -1, -1, G_STRING, /*** 66 ***/
- NONE,
- NORMAL,
- (long) "Transparent Images",
- 1028, 8, 18, 1,
-
- 68, -1, -1, G_BOXCHAR|(101<<8), /*** 67 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1025, 0, 2, 1,
-
- 100, -1, -1, G_STRING, /*** 68 ***/
- NONE,
- NORMAL,
- (long) "Enable Animations",
- 1028, 0, 17, 1,
-
- 71, -1, -1, G_STRING, /*** 69 ***/
- NONE,
- NORMAL,
- (long) "Limit speed to",
- 1024, 0, 15, 1,
-
- 99, -1, -1, G_STRING, /*** 70 ***/
- NONE,
- NORMAL,
- (long) "seconds between frames.",
- 1048, 0, 24, 1,
-
- 70, 72, 74, G_IBOX, /*** 71 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 16, 0, 1032, 1,
-
- 73, -1, -1, G_FTEXT, /*** 72 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[34],
- 2, 0, 3, 1,
-
- 74, -1, -1, G_BOXCHAR, /*** 73 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 5, 0, 2, 1,
-
- 71, -1, -1, G_BOXCHAR, /*** 74 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 76, -1, -1, G_STRING, /*** 75 ***/
- NONE,
- NORMAL,
- (long) "Default Font Size:",
- 1025, 2050, 18, 1,
-
- 80, 77, 79, G_IBOX, /*** 76 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 36, 2050, 10, 1,
-
- 78, -1, -1, G_FTEXT, /*** 77 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[32],
- 2, 0, 3, 1,
-
- 79, -1, -1, G_BOXCHAR, /*** 78 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 76, -1, -1, G_BOXCHAR, /*** 79 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 5, 0, 2, 1,
-
- 84, 81, 83, G_IBOX, /*** 80 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 36, 4, 9, 1,
-
- 82, -1, -1, G_FTEXT, /*** 81 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[33],
- 2, 0, 3, 1,
-
- 83, -1, -1, G_BOXCHAR, /*** 82 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 80, -1, -1, G_BOXCHAR, /*** 83 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 5, 0, 2, 1,
-
- 99, -1, -1, G_STRING, /*** 84 ***/
- NONE,
- NORMAL,
- (long) "Minimum Font Size:",
- 1025, 4, 18, 1,
-
- 59, -1, -1, G_TEXT, /*** 85 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[36],
- 3, 2048, 9, 1,
-
- 0, 87, 88, G_IBOX, /*** 86 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 46, 63, 15,
-
- 88, 89, 98, G_BOX, /*** 87 ***/
- FL3DBAK,
- NORMAL,
- (long) 16748800L,
- 1, 1, 61, 2061,
-
- 86, -1, -1, G_TEXT, /*** 88 ***/
- FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[42],
- 1027, 2048, 11, 1,
-
- 90, -1, -1, G_STRING, /*** 89 ***/
- EDITABLE,
- WHITEBAK|DRAW3D,
- (long) "Downloads:",
- 1, 2048, 11, 1,
-
- 91, -1, -1, G_FTEXT, /*** 90 ***/
- EDITABLE|FL3DBAK,
- OUTLINED|DRAW3D,
- (long) &rs_tedinfo[37],
- 1039, 2048, 44, 1,
-
- 92, -1, -1, G_FTEXT, /*** 91 ***/
- EDITABLE|FL3DBAK,
- OUTLINED,
- (long) &rs_tedinfo[38],
- 1039, 2, 44, 1,
-
- 93, -1, -1, G_FTEXT, /*** 92 ***/
- EDITABLE|FL3DBAK,
- OUTLINED,
- (long) &rs_tedinfo[39],
- 1039, 2051, 44, 1,
-
- 94, -1, -1, G_FTEXT, /*** 93 ***/
- EDITABLE|FL3DBAK,
- OUTLINED,
- (long) &rs_tedinfo[40],
- 1039, 5, 44, 1,
-
- 95, -1, -1, G_FTEXT, /*** 94 ***/
- EDITABLE|FL3DBAK,
- OUTLINED,
- (long) &rs_tedinfo[41],
- 1039, 2054, 44, 1,
-
- 96, -1, -1, G_STRING, /*** 95 ***/
- EDITABLE,
- WHITEBAK|DRAW3D,
- (long) "Hotlist:",
- 3, 2, 8, 1,
-
- 97, -1, -1, G_STRING, /*** 96 ***/
- EDITABLE,
- WHITEBAK|DRAW3D,
- (long) "CA Bundle:",
- 1, 2051, 10, 1,
-
- 98, -1, -1, G_STRING, /*** 97 ***/
- EDITABLE,
- WHITEBAK|DRAW3D,
- (long) "CA Certs:",
- 2, 5, 9, 1,
-
- 87, -1, -1, G_STRING, /*** 98 ***/
- EDITABLE,
- WHITEBAK|DRAW3D,
- (long) "Editor:",
- 4, 2054, 7, 1,
-
- 100, 69, 70, G_IBOX, /*** 99 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 4, 11, 1074, 1,
-
- 101, 67, 68, G_IBOX, /*** 100 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 2057, 1053, 1,
-
- 104, 102, 103, G_IBOX, /*** 101 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 0, 2054, 1053, 1,
-
- 103, -1, -1, G_BOXCHAR|(101<<8), /*** 102 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 1025, 0, 2, 1,
-
- 101, -1, -1, G_STRING, /*** 103 ***/
- NONE,
- NORMAL,
- (long) "Background Images",
- 1028, 0, 17, 1,
-
- 107, 105, 106, G_IBOX, /*** 104 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 34, 2054, 1048, 1,
-
- 106, -1, -1, G_BOXCHAR|(101<<8), /*** 105 ***/
- SELECTABLE|FL3DIND|FL3DBAK,
- SELECTED|CROSSED,
- (long) 4352L,
- 2, 0, 2, 1,
-
- 104, -1, -1, G_STRING, /*** 106 ***/
- NONE,
- NORMAL,
- (long) "Foreground Images",
- 5, 0, 17, 1,
-
- 108, -1, -1, G_STRING, /*** 107 ***/
- NONE,
- NORMAL,
- (long) "Minimum reflow period (ms):",
- 1028, 2060, 27, 1,
-
- 60, 109, 111, G_IBOX, /*** 108 ***/
- FL3DBAK,
- NORMAL,
- (long) 4352L,
- 1059, 2060, 13, 1,
-
- 110, -1, -1, G_FTEXT, /*** 109 ***/
- EDITABLE|FL3DBAK,
- NORMAL,
- (long) &rs_tedinfo[35],
- 2, 0, 4, 1,
-
- 111, -1, -1, G_BOXCHAR, /*** 110 ***/
- SELECTABLE|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 33624320L,
- 0, 0, 2, 1,
-
- 108, -1, -1, G_BOXCHAR, /*** 111 ***/
- SELECTABLE|LASTOB|TOUCHEXIT|FL3DBAK,
- NORMAL,
- (long) 16847104L,
- 6, 0, 2, 1
-};
-
-OBJECT *MAINMENU = &rs_obj[TR0];
-OBJECT *TOOLBAR = &rs_obj[TR1];
-OBJECT *ICONIFY = &rs_obj[TR2];
-OBJECT *FAVICON = &rs_obj[TR3];
-OBJECT *CURSOR = &rs_obj[TR4];
-OBJECT *LOGIN = &rs_obj[TR5];
-OBJECT *VERIFY = &rs_obj[TR6];
-OBJECT *THROBBER = &rs_obj[TR7];
-OBJECT *TOOLBAR_HOTLIST = &rs_obj[TR8];
-OBJECT *SEARCH = &rs_obj[TR9];
-OBJECT *DOWNLOAD = &rs_obj[TR10];
-OBJECT *ABOUT = &rs_obj[TR11];
-OBJECT *POP_CTX = &rs_obj[TR12];
-OBJECT *VSCROLLER = &rs_obj[TR13];
-OBJECT *SETTINGS = &rs_obj[TR14];
-
-
-void rs_init(void);
-void rs_exit(void);
-
-LONG rs_ciconinit(CICONBLK *ciconblks, WORD ncib, OBJECT *objects, WORD nobj);
-void rs_ciconexit(LONG deskript);
-
-static LONG rs_cid;
-void rs_init(void)
-{
- register OBJECT *obj=rs_obj;
- register WORD i=0;
-
- do
- {
- rsrc_obfix(obj, i);
- } while (++i<RS_NOBS);
- rs_cid = rs_ciconinit(&rs_ciconblk[0], 29, &rs_obj[0], 280);
-}
-void rs_exit(void)
-{
- rs_ciconexit(rs_cid);
-}
diff --git a/atari/search.c b/atari/search.c index 17241d1ae..6d8f53bec 100644 --- a/atari/search.c +++ b/atari/search.c @@ -224,7 +224,7 @@ void nsatari_search_session_destroy(struct s_search_form_session *s) {
if (s != NULL) {
LOG(("")); - browser_window_search_destroy_context(s->bw);
+ browser_window_search_clear(s->bw);
free(s);
}
}
@@ -270,7 +270,7 @@ void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj, if(search_session_compare(s, obj)){ - browser_window_search_destroy_context(s->bw);
+ browser_window_search_clear(s->bw);
apply_form(obj, &s->state);
} else {
@@ -282,11 +282,9 @@ void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj, else
s->state.flags &= (~SEARCH_FLAG_FORWARDS); - if( browser_window_search_verify_new(s->bw, &nsatari_search_callbacks, s) ){ - LOG(("searching for: %s\n", gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH)));
- browser_window_search_step(s->bw, s->state.flags, - gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH));
- }
+ browser_window_search(s->bw, &nsatari_search_callbacks, s,
+ s->state.flags,
+ gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH));
}
@@ -305,7 +303,7 @@ struct s_search_form_session * nsatari_search_session_create(OBJECT * obj, apply_form(obj, &sfs->state); - browser_window_search_destroy_context(bw); + browser_window_search_clear(bw); return(sfs); } diff --git a/atari/search.c.old b/atari/search.c.old deleted file mode 100644 index efe6cebb2..000000000 --- a/atari/search.c.old +++ /dev/null @@ -1,375 +0,0 @@ -/*
- * Copyright 2013 Ole Loots <ole@monochrom.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/>.
- *
- * Module Description:
- *
- *
- *
- */
- - -#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdbool.h>
-#include <assert.h>
-
-#include "desktop/gui.h"
-#include "desktop/browser.h"
-#include "desktop/browser_private.h"
-#include "desktop/search.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "atari/gui.h" -#include "atari/rootwin.h"
-#include "atari/misc.h"
-#include "atari/search.h" -#include "atari/gemtk/gemtk.h"
-#include "atari/res/netsurf.rsh"
-
-extern struct gui_window * input_window;
-extern void * h_gem_rsrc; -extern GRECT desk_area;
-
-
-static SEARCH_FORM_SESSION current; -static OBJECT *dlgtree; -static GUIWIN *searchwin; -static short h_aes_win;
-
-static void nsatari_search_set_status(bool found, void *p);
-static void nsatari_search_set_hourglass(bool active, void *p);
-static void nsatari_search_add_recent(const char *string, void *p);
-void nsatari_search_set_forward_state(bool active, void *p);
-void nsatari_search_set_back_state(bool active, void *p);
-
-static struct gui_search_callbacks nsatari_search_callbacks = {
- nsatari_search_set_forward_state,
- nsatari_search_set_back_state,
- nsatari_search_set_status,
- nsatari_search_set_hourglass,
- nsatari_search_add_recent
-};
-
-
-/**
-* Change the displayed search status.
-* \param found search pattern matched in text
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void nsatari_search_set_status(bool found, void *p)
-{
- LOG(("%p set status: %d\n", p, found));
-}
-
-/**
-* display hourglass while searching
-* \param active start/stop indicator
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void nsatari_search_set_hourglass(bool active, void *p)
-{
- SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
- LOG((""));
- if (active && current != NULL)
- gui_window_set_pointer(s->bw->window, GUI_POINTER_PROGRESS);
- else
- gui_window_set_pointer(s->bw->window, GUI_POINTER_DEFAULT);
-}
-
-/**
-* add search string to recent searches list
-* front is at liberty how to implement the bare notification
-* should normally store a strdup() of the string;
-* core gives no guarantee of the integrity of the const char *
-* \param string search pattern
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void nsatari_search_add_recent(const char *string, void *p)
-{
- LOG(("%p add recent: %s\n", p, string));
-}
-
-/**
-* activate search forwards button in gui
-* \param active activate/inactivate
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void nsatari_search_set_forward_state(bool active, void *p)
-{
- SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
- /* deactivate back cb */
- LOG(("%p: set forward state: %d\n", p, active));
-}
-
-/**
-* activate search back button in gui
-* \param active activate/inactivate
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void nsatari_search_set_back_state(bool active, void *p)
-{
- SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
- /* deactivate back cb */
- LOG(("%p: set back state: %d\n", p, active));
-}
- -/*
-void search_redraw(void *session, GRECT *clip) -{ - GRECT area, clipped_area; - struct gui_window *gw = input_window; - short pxy[4]; - VdiHdl vh; - - if(gw == NULL) - return; - - window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area); - - clipped_area = area; - - if (!rc_intersect(clip, &clipped_area)) { - return; - } - - OBJECT * tree = get_tree(SEARCH); - tree->ob_x = area.g_x; - tree->ob_y = area.g_y; - tree->ob_width = area.g_w; - tree->ob_height = area.g_h; - - objc_draw_grect(tree, 0, 8, &clipped_area); -} -*/ -
-static SEARCH_FORM_SESSION get_search_session(GUIWIN * win)
-{
- return (current);
-}
- - - -static void set_text( short idx, char * text, int len )
-{
- char spare[255];
-
- if( len > 254 )
- len = 254;
- if( text != NULL ){
- strncpy(spare, text, 254);
- } else {
- strcpy(spare, "");
- } -
- set_string(dlgtree, idx, spare);
-} -
-static void destroy_search_session(SEARCH_FORM_SESSION s)
-{
- if(s != NULL ){
- LOG((""));
- free(s);
- }
-}
-
-static int apply_form(GUIWIN *win, struct s_search_form_state * s)
-{
- OBJECT * obj = dlgtree; - char * cstr; -
- if( obj == NULL ){
- goto error;
- } -
- s->flags = 0;
- if( (obj[SEARCH_CB_FWD].ob_state & OS_SELECTED) != 0 )
- s->flags = SEARCH_FLAG_FORWARDS;
- if( (obj[SEARCH_CB_CASESENSE].ob_state & OS_SELECTED) != 0 )
- s->flags |= SEARCH_FLAG_CASE_SENSITIVE;
- if( (obj[SEARCH_CB_SHOWALL].ob_state & OS_SELECTED) != 0 )
- s->flags |= SEARCH_FLAG_SHOWALL;
- - cstr = get_text(dlgtree, SEARCH_TB_SRCH); - snprintf(s->text, 31, "%s", cstr); - return ( 0 );
-
-error:
- s->flags = SEARCH_FLAG_FORWARDS;
- strncpy((char*)&s->text[0], "", 31 );
- return( 1 );
-}
-
-/* checks for search parameters changes */
-static bool form_changed(GUIWIN * w)
-{
- bool check;
- struct s_search_form_state cur;
- SEARCH_FORM_SESSION s = get_search_session(w);
- if( s == NULL )
- return false; - OBJECT * obj = dlgtree;
- assert(s != NULL && obj != NULL);
- uint32_t flags_old = s->state.flags;
- apply_form(w, &cur);
-
- /* adjust the forward flag, it should not init an new search */
- flags_old |= SEARCH_FLAG_FORWARDS;
- cur.flags |= SEARCH_FLAG_FORWARDS;
- if( cur.flags != flags_old ){
- return( true );
- }
-
- char * cstr; - cstr = get_text(obj, SEARCH_TB_SRCH);
- if (cstr != NULL){
- if (strcmp(cstr, (char*)&s->state.text) != 0) {
- return (true);
- }
- }
-
- return( false );
-}
-
-
-static void __CDECL evnt_bt_srch_click(GUIWIN * win, int index, int unused, void *unused2)
-{
-
- bool fwd;
- SEARCH_FORM_SESSION s = get_search_session(searchwin);
- OBJECT * obj = dlgtree;
- search_flags_t flags = 0;
-
-
- if( form_changed(searchwin) ){
- browser_window_search_destroy_context(s->bw);
- apply_form(searchwin, &s->state);
- } else {
- /* get search direction manually: */
- if( (obj[SEARCH_CB_FWD].ob_state & OS_SELECTED) != 0 )
- s->state.flags |= SEARCH_FLAG_FORWARDS;
- else
- s->state.flags &= (~SEARCH_FLAG_FORWARDS);
- }
- if( browser_window_search_verify_new(s->bw, &nsatari_search_callbacks, s) ){
- browser_window_search_step(s->bw, s->state.flags, get_text(obj, SEARCH_TB_SRCH));
- }
-
-}
-
-static void __CDECL evnt_cb_click(GUIWIN *win, int index, int unused, void *unused2)
-{
-
- short newstate;
-
-}
-
-static void __CDECL evnt_close(GUIWIN *win, short buff[8])
-{
-
-}
- -void search_destroy(struct gui_window *gw) -{ - /* Free Search Contexts */
- /* todo: destroy search context, if any? */ - LOG(("")); -
- if (current != NULL){
- destroy_search_session(current); - current = NULL;
- } - - guiwin_remove(searchwin); - searchwin = NULL; - - wind_close(h_aes_win); - wind_delete(h_aes_win); - h_aes_win = -1; - - LOG(("done")); -} -
-SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw)
-{
- char * title;
- SEARCH_FORM_SESSION sfs;
- GRECT pos, treesize; - uint32_t kind = CLOSER | NAME | MOVER; - - if (dlgtree == NULL) { - dlgtree = get_tree(SEARCH);
- if (dlgtree == NULL) {
- return( NULL );
- } - } - - if(searchwin){ - search_destroy(gw); - } -
-
- sfs = calloc(1, sizeof(struct s_search_form_session));
- if( sfs == NULL )
- return( NULL );
-
- title = (char*)messages_get("FindTextNS");
- if (title == NULL)
- title = (char*)"Find text ..."; - - /* setup dipslay position: right corner */
- treesize.g_x = 0;
- treesize.g_y = 0;
- treesize.g_w = dlgtree->ob_width;
- treesize.g_h = dlgtree->ob_height;
- wind_calc_grect(WC_BORDER, kind, &treesize, &pos);
- pos.g_x = desk_area.g_w - pos.g_w;
- pos.g_y = desk_area.g_h - pos.g_h;
- - /* create the dialog: */ - h_aes_win = wind_create_grect(kind, &pos); - wind_set_str(h_aes_win, WF_NAME, title); -
-
- current = sfs;
- sfs->bw = gw->browser->bw; -/*
- sfs->formwind = mt_FormCreate( &app, tree, WAT_FORM,
- NULL, title,
- &pos, true, false);
-*/ -/*
- ObjcAttachFormFunc(sfs->formwind, SEARCH_BT_SEARCH, evnt_bt_srch_click, - NULL);
- ObjcAttachFormFunc(sfs->formwind, SEARCH_CB_CASESENSE, evnt_cb_click, NULL);
- ObjcAttachFormFunc(sfs->formwind, SEARCH_CB_SHOWALL, evnt_cb_click, NULL);
- ObjcAttachFormFunc(sfs->formwind, SEARCH_CB_FWD, evnt_cb_click, NULL);
- EvntAdd(sfs->formwind, WM_CLOSED, evnt_close, EV_TOP);
-*/ - apply_form(searchwin, &sfs->state ); - set_text(SEARCH_TB_SRCH, (char*)"", 31);
-
- return(current);
-
-}
diff --git a/atari/search.h.old b/atari/search.h.old deleted file mode 100644 index 5cb8d07b6..000000000 --- a/atari/search.h.old +++ /dev/null @@ -1,52 +0,0 @@ -/*
- * Copyright 2013 Ole Loots <ole@monochrom.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/>.
- *
- * Module Description:
- *
- *
- *
- */
- - -#ifndef NS_ATARI_SEARCH_H
-#define NS_ATARI_SEARCH_H
-
-#define SEARCH_MAX_SLEN 24 - -struct gui_window; -struct browser_window;
-
-struct s_search_form_state
-{
- char text[32];
- uint32_t flags;
-};
-
-struct s_search_form_session {
- struct browser_window * bw;
- struct s_search_form_state state;
-};
-
-
-typedef struct s_search_form_session * SEARCH_FORM_SESSION;
-
-SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw);
-void search_destroy(struct gui_window * gw);
- -struct s_search_session -
-#endif diff --git a/atari/settings.c b/atari/settings.c index 5244a7f8b..10aceb985 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" @@ -113,8 +113,8 @@ static void save_settings(void) { apply_settings(); // Save settings - nsoption_write( (const char*)&options ); - nsoption_read( (const char*)&options ); + nsoption_write( (const char*)&options, NULL, NULL); + nsoption_read( (const char*)&options , NULL); close_settings(); form_alert(1, "[1][Some options require an netsurf restart!][OK]"); deskmenu_update(); @@ -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/atari/system_colour.c b/atari/system_colour.c deleted file mode 100644 index 5f8673371..000000000 --- a/atari/system_colour.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 - * - */ - -#define WITH_SYSTEM_COLOUR -#ifdef WITH_SYSTEM_COLOUR -#include <libwapcaplet/libwapcaplet.h> -#include <libcss/libcss.h> -#include "utils/utils.h" -#include "utils/log.h" -#include "desktop/gui.h" -#include "desktop/options.h" -#include "desktop/plot_style.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"), - 0xffdddddd, - &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"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ButtonFace), - NULL - }, { - "ButtonHighlight", - SLEN("ButtonHighlight"), - 0xffdddddd, - &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"), - 0xffcccccc, - &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"), - 0xffffffff, - &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; -} -#endif diff --git a/atari/toolbar.c b/atari/toolbar.c index 18d8a456a..79be31b73 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/Makefile.target b/beos/Makefile.target index 7b473dd2f..8df9ec38b 100644 --- a/beos/Makefile.target +++ b/beos/Makefile.target @@ -90,7 +90,7 @@ endif S_BEOS := about.cpp bitmap.cpp download.cpp fetch_rsrc.cpp filetype.cpp \ font.cpp gui.cpp login.cpp gui_options.cpp plotters.cpp \ scaffolding.cpp search.cpp schedule.cpp thumbnail.cpp treeview.cpp \ - throbber.cpp window.cpp system_colour.cpp + throbber.cpp window.cpp S_BEOS := $(addprefix beos/,$(S_BEOS)) RDEF_BEOS := res.rdef diff --git a/beos/fetch_rsrc.cpp b/beos/fetch_rsrc.cpp index 6f78aafa5..c52cafe8c 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 b73c9cc1a..5636743f5 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 b2f40431d..766782259 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" @@ -398,11 +398,121 @@ static void gui_init2(int argc, char** argv) } } + +#if !defined(__HAIKU__) && !defined(B_BEOS_VERSION_DANO) +/* more ui_colors, R5 only had a few defined... */ +#define B_PANEL_TEXT_COLOR ((color_which)10) +#define B_DOCUMENT_BACKGROUND_COLOR ((color_which)11) +#define B_DOCUMENT_TEXT_COLOR ((color_which)12) +#define B_CONTROL_BACKGROUND_COLOR ((color_which)13) +#define B_CONTROL_TEXT_COLOR ((color_which)14) +#define B_CONTROL_BORDER_COLOR ((color_which)15) +#define B_CONTROL_HIGHLIGHT_COLOR ((color_which)16) +#define B_NAVIGATION_BASE_COLOR ((color_which)4) +#define B_NAVIGATION_PULSE_COLOR ((color_which)17) +#define B_SHINE_COLOR ((color_which)18) +#define B_SHADOW_COLOR ((color_which)19) +#define B_MENU_SELECTED_BORDER_COLOR ((color_which)9) +#define B_TOOL_TIP_BACKGROUND_COLOR ((color_which)20) +#define B_TOOL_TIP_TEXT_COLOR ((color_which)21) +#define B_SUCCESS_COLOR ((color_which)100) +#define B_FAILURE_COLOR ((color_which)101) +#define B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR +#define B_RANDOM_COLOR ((color_which)0x80000000) +#define B_MICHELANGELO_FAVORITE_COLOR ((color_which)0x80000001) +#define B_DSANDLER_FAVORITE_SKY_COLOR ((color_which)0x80000002) +#define B_DSANDLER_FAVORITE_INK_COLOR ((color_which)0x80000003) +#define B_DSANDLER_FAVORITE_SHOES_COLOR ((color_which)0x80000004) +#define B_DAVE_BROWN_FAVORITE_COLOR ((color_which)0x80000005) +#endif +#if defined(B_BEOS_VERSION_DANO) +#define B_TOOL_TIP_BACKGROUND_COLOR B_TOOLTIP_BACKGROUND_COLOR +#define B_TOOL_TIP_TEXT_COLOR B_TOOLTIP_TEXT_COLOR +#define +#endif +#define NOCOL ((color_which)0) + +/** + * set option from pen + */ +static nserror +set_colour_from_ui(struct nsoption_s *opts, + color_which ui, + enum nsoption_e option, + colour def_colour) +{ + if (ui != NOCOL) { + rgb_color c; + if (ui == B_DESKTOP_COLOR) { + BScreen s; + c = s.DesktopColor(); + } else { + c = ui_color(ui); + } + + def_colour = ((((uint32_t)c.blue << 16) & 0xff0000) | + ((c.green << 8) & 0x00ff00) | + ((c.red) & 0x0000ff)); + } + return def_colour; +} + +/** + * 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 system colours for beos ui */ + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ActiveBorder, 0x00000000); + set_colour_from_ui(defaults, B_WINDOW_TAB_COLOR, NSOPTION_sys_colour_ActiveCaption, 0x00dddddd); + set_colour_from_ui(defaults, B_PANEL_BACKGROUND_COLOR, NSOPTION_sys_colour_AppWorkspace, 0x00eeeeee); + set_colour_from_ui(defaults, B_DESKTOP_COLOR, NSOPTION_sys_colour_Background, 0x00aa0000); + set_colour_from_ui(defaults, B_CONTROL_BACKGROUND_COLOR, NSOPTION_sys_colour_ButtonFace, 0x00aaaaaa); + set_colour_from_ui(defaults, B_CONTROL_HIGHLIGHT_COLOR, NSOPTION_sys_colour_ButtonHighlight, 0x00cccccc); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ButtonShadow, 0x00bbbbbb); + set_colour_from_ui(defaults, B_CONTROL_TEXT_COLOR, NSOPTION_sys_colour_ButtonText, 0x00000000); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_CaptionText, 0x00000000); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_GrayText, 0x00777777); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_Highlight, 0x00ee0000); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_HighlightText, 0x00000000); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_InactiveBorder, 0x00000000); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_InactiveCaption, 0x00ffffff); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_InactiveCaptionText, 0x00cccccc); + set_colour_from_ui(defaults, B_TOOL_TIP_BACKGROUND_COLOR, NSOPTION_sys_colour_InfoBackground, 0x00aaaaaa); + set_colour_from_ui(defaults, B_TOOL_TIP_TEXT_COLOR, NSOPTION_sys_colour_InfoText, 0x00000000); + set_colour_from_ui(defaults, B_MENU_BACKGROUND_COLOR, NSOPTION_sys_colour_Menu, 0x00aaaaaa); + set_colour_from_ui(defaults, B_MENU_ITEM_TEXT_COLOR, NSOPTION_sys_colour_MenuText, 0x00000000); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_Scrollbar, 0x00aaaaaa); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDDarkShadow, 0x00555555); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDFace, 0x00dddddd); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDHighlight, 0x00aaaaaa); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDLightShadow, 0x00999999); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDShadow, 0x00777777); + set_colour_from_ui(defaults, B_DOCUMENT_BACKGROUND_COLOR, NSOPTION_sys_colour_Window, 0x00aaaaaa); + set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_WindowFrame, 0x00000000); + set_colour_from_ui(defaults, B_DOCUMENT_TEXT_COLOR, NSOPTION_sys_colour_WindowText, 0x00000000); + + return NSERROR_OK; +} + +/** + * Ensures output logging stream is correctly configured + */ +static bool nslog_stream_configure(FILE *fptr) +{ + /* set log stream to be non-buffering */ + setbuf(fptr, NULL); + + return true; +} + /** Normal entry point from OS */ int main(int argc, char** argv) { - setbuf(stderr, NULL); - + nserror ret; BPath options; if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); @@ -416,11 +526,27 @@ int main(int argc, char** argv) const char* messages = "/boot/apps/netsurf/res/en/Messages"; - /* initialise netsurf */ - netsurf_init(&argc, &argv, options.Path(), messages); + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(nslog_stream_configure, &argc, argv); - gui_init(argc, argv); - gui_init2(argc, argv); + /* user options setup */ + ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + die("Options failed to initialise"); + } + nsoption_read(options.Path(), NULL); + nsoption_commandline(&argc, argv, NULL); + + /* common initialisation */ + ret = netsurf_init(messages); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } + + gui_init(argc, argv); + gui_init2(argc, argv); netsurf_main_loop(); @@ -432,8 +558,6 @@ int main(int argc, char** argv) /** called when replicated from NSBaseView::Instantiate() */ int gui_init_replicant(int argc, char** argv) { - setbuf(stderr, NULL); - BPath options; if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); @@ -441,6 +565,11 @@ int gui_init_replicant(int argc, char** argv) const char* messages = "/boot/apps/netsurf/res/en/Messages"; + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(nslog_stream_configure, &argc, argv); + /* initialise netsurf */ netsurf_init(&argc, &argv, options.Path(), messages); @@ -450,13 +579,6 @@ int gui_init_replicant(int argc, char** argv) return 0; } -/* Documented in desktop/options.h */ -void gui_options_init_defaults(void) -{ - /* Set defaults for absent option strings */ -} - - void gui_init(int argc, char** argv) { char buf[PATH_MAX]; @@ -515,7 +637,7 @@ void gui_init(int argc, char** argv) find_resource(buf, "Choices", "%/Choices"); LOG(("Using '%s' as Preferences file", buf)); options_file_location = strdup(buf); - nsoption_read(buf); + nsoption_read(buf, NULL); /* check what the font settings are, setting them to a default font diff --git a/beos/gui_options.cpp b/beos/gui_options.cpp index 62e6640c3..2c56cf710 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/options.h b/beos/options.h index 9b8a3d109..40d23a3bc 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/beos/plotters.cpp b/beos/plotters.cpp index aabf30200..c2a99fea0 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 9954dd678..fe40b0c70 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 deleted file mode 100644 index 9f3f4084b..000000000 --- a/beos/system_colour.cpp +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 - * - */ - -#define __STDBOOL_H__ 1 -#include <assert.h> -#include <ctype.h> -#include <stdbool.h> - -#include <InterfaceDefs.h> -#include <Screen.h> - -extern "C" { - -#include "utils/utils.h" -#include "utils/log.h" -#include "desktop/gui.h" -#include "desktop/options.h" -#include "desktop/plot_style.h" - -} - -#include "beos/gui.h" - - -#if !defined(__HAIKU__) && !defined(B_BEOS_VERSION_DANO) -/* more ui_colors, R5 only had a few defined... */ -#define B_PANEL_TEXT_COLOR ((color_which)10) -#define B_DOCUMENT_BACKGROUND_COLOR ((color_which)11) -#define B_DOCUMENT_TEXT_COLOR ((color_which)12) -#define B_CONTROL_BACKGROUND_COLOR ((color_which)13) -#define B_CONTROL_TEXT_COLOR ((color_which)14) -#define B_CONTROL_BORDER_COLOR ((color_which)15) -#define B_CONTROL_HIGHLIGHT_COLOR ((color_which)16) -#define B_NAVIGATION_BASE_COLOR ((color_which)4) -#define B_NAVIGATION_PULSE_COLOR ((color_which)17) -#define B_SHINE_COLOR ((color_which)18) -#define B_SHADOW_COLOR ((color_which)19) -#define B_MENU_SELECTED_BORDER_COLOR ((color_which)9) -#define B_TOOL_TIP_BACKGROUND_COLOR ((color_which)20) -#define B_TOOL_TIP_TEXT_COLOR ((color_which)21) -#define B_SUCCESS_COLOR ((color_which)100) -#define B_FAILURE_COLOR ((color_which)101) -#define B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR -#define B_RANDOM_COLOR ((color_which)0x80000000) -#define B_MICHELANGELO_FAVORITE_COLOR ((color_which)0x80000001) -#define B_DSANDLER_FAVORITE_SKY_COLOR ((color_which)0x80000002) -#define B_DSANDLER_FAVORITE_INK_COLOR ((color_which)0x80000003) -#define B_DSANDLER_FAVORITE_SHOES_COLOR ((color_which)0x80000004) -#define B_DAVE_BROWN_FAVORITE_COLOR ((color_which)0x80000005) -#endif -#if defined(B_BEOS_VERSION_DANO) -#define B_TOOL_TIP_BACKGROUND_COLOR B_TOOLTIP_BACKGROUND_COLOR -#define B_TOOL_TIP_TEXT_COLOR B_TOOLTIP_TEXT_COLOR -#define -#endif -#define NOCOL ((color_which)0) - - -struct gui_system_colour_ctx { - const char *name; - int length; - css_color css_colour; - colour *option_colour; - lwc_string *lwcstr; - color_which ui; -}; - -static struct gui_system_colour_ctx colour_list[] = { - { - "ActiveBorder", - SLEN("ActiveBorder"), - 0xff000000, - &nsoption_colour(sys_colour_ActiveBorder), - NULL, - NOCOL - }, { - "ActiveCaption", - SLEN("ActiveCaption"), - 0xffdddddd, - &nsoption_colour(sys_colour_ActiveCaption), - NULL, - B_WINDOW_TAB_COLOR - }, { - "AppWorkspace", - SLEN("AppWorkspace"), - 0xffeeeeee, - &nsoption_colour(sys_colour_AppWorkspace), - NULL, - B_PANEL_BACKGROUND_COLOR - }, { - "Background", - SLEN("Background"), - 0xff0000aa, - &nsoption_colour(sys_colour_Background), - NULL, - B_DESKTOP_COLOR - }, { - "ButtonFace", - SLEN("ButtonFace"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ButtonFace), - NULL, - B_CONTROL_BACKGROUND_COLOR - }, { - "ButtonHighlight", - SLEN("ButtonHighlight"), - 0xffdddddd, - &nsoption_colour(sys_colour_ButtonHighlight), - NULL, - B_CONTROL_HIGHLIGHT_COLOR - }, { - "ButtonShadow", - SLEN("ButtonShadow"), - 0xffbbbbbb, - &nsoption_colour(sys_colour_ButtonShadow), - NULL, - NOCOL - }, { - "ButtonText", - SLEN("ButtonText"), - 0xff000000, - &nsoption_colour(sys_colour_ButtonText), - NULL, - B_CONTROL_TEXT_COLOR - }, { - "CaptionText", - SLEN("CaptionText"), - 0xff000000, - &nsoption_colour(sys_colour_CaptionText), - NULL, - NOCOL - }, { - "GrayText", - SLEN("GrayText"), - 0xffcccccc, - &nsoption_colour(sys_colour_GrayText), - NULL, - NOCOL - }, { - "Highlight", - SLEN("Highlight"), - 0xff0000ee, - &nsoption_colour(sys_colour_Highlight), - NULL, - NOCOL - }, { - "HighlightText", - SLEN("HighlightText"), - 0xff000000, - &nsoption_colour(sys_colour_HighlightText), - NULL, - NOCOL - }, { - "InactiveBorder", - SLEN("InactiveBorder"), - 0xffffffff, - &nsoption_colour(sys_colour_InactiveBorder), - NULL, - NOCOL - }, { - "InactiveCaption", - SLEN("InactiveCaption"), - 0xffffffff, - &nsoption_colour(sys_colour_InactiveCaption), - NULL, - NOCOL - }, { - "InactiveCaptionText", - SLEN("InactiveCaptionText"), - 0xffcccccc, - &nsoption_colour(sys_colour_InactiveCaptionText), - NULL, - NOCOL - }, { - "InfoBackground", - SLEN("InfoBackground"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_InfoBackground), - NULL, - B_TOOL_TIP_BACKGROUND_COLOR - }, { - "InfoText", - SLEN("InfoText"), - 0xff000000, - &nsoption_colour(sys_colour_InfoText), - NULL, - B_TOOL_TIP_TEXT_COLOR - }, { - "Menu", - SLEN("Menu"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Menu), - NULL, - B_MENU_BACKGROUND_COLOR - }, { - "MenuText", - SLEN("MenuText"), - 0xff000000, - &nsoption_colour(sys_colour_MenuText), - NULL, - B_MENU_ITEM_TEXT_COLOR - }, { - "Scrollbar", - SLEN("Scrollbar"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Scrollbar), - NULL, - NOCOL - }, { - "ThreeDDarkShadow", - SLEN("ThreeDDarkShadow"), - 0xff555555, - &nsoption_colour(sys_colour_ThreeDDarkShadow), - NULL, - NOCOL - }, { - "ThreeDFace", - SLEN("ThreeDFace"), - 0xffdddddd, - &nsoption_colour(sys_colour_ThreeDFace), - NULL, - NOCOL - }, { - "ThreeDHighlight", - SLEN("ThreeDHighlight"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ThreeDHighlight), - NULL, - NOCOL - }, { - "ThreeDLightShadow", - SLEN("ThreeDLightShadow"), - 0xff999999, - &nsoption_colour(sys_colour_ThreeDLightShadow), - NULL, - NOCOL - }, { - "ThreeDShadow", - SLEN("ThreeDShadow"), - 0xff777777, - &nsoption_colour(sys_colour_ThreeDShadow), - NULL, - NOCOL - }, { - "Window", - SLEN("Window"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_Window), - NULL, - B_DOCUMENT_BACKGROUND_COLOR - }, { - "WindowFrame", - SLEN("WindowFrame"), - 0xff000000, - &nsoption_colour(sys_colour_WindowFrame), - NULL, - NOCOL - }, { - - "WindowText", - SLEN("WindowText"), - 0xff000000, - &nsoption_colour(sys_colour_WindowText), - NULL, - B_DOCUMENT_TEXT_COLOR - }, - -}; - -#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].css_colour = *(colour_list[ccount].option_colour); - } - } - - nsbeos_update_system_ui_colors(); - - 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].css_colour; - break; - } - } - return ret; -} - -css_error gui_system_colour(void *pw, lwc_string *name, css_color *css_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) { - *css_colour = colour_list[ccount].css_colour; - return CSS_OK; - } - } - - return CSS_INVALID; -} - -void nsbeos_update_system_ui_colors(void) -{ - unsigned int ccount; - - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (colour_list[ccount].ui == NOCOL) - continue; - rgb_color c = ui_color(colour_list[ccount].ui); - if (colour_list[ccount].ui == B_DESKTOP_COLOR) { - BScreen s; - c = s.DesktopColor(); - } - - //printf("uic[%d] = ui_color(%d) %02x %02x %02x %02x\n", ccount, - // colour_list[ccount].ui, c.red, c.green, c.blue, c.alpha); - - colour_list[ccount].css_colour = 0xff000000 - | ((((uint32_t)c.red << 16) & 0xff0000) - | ((c.green << 8) & 0x00ff00) - | ((c.blue) & 0x0000ff)); - } -} - diff --git a/beos/window.cpp b/beos/window.cpp index 1e564a173..64ef616bb 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -25,8 +25,7 @@ extern "C" { #include "css/utils.h" #include "desktop/browser_private.h" #include "desktop/mouse.h" -#include "desktop/options.h" -#include "desktop/selection.h" +#include "utils/nsoption.h" #include "desktop/textinput.h" #include "render/font.h" #include "utils/log.h" @@ -1297,7 +1296,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, } -void gui_drag_save_selection(struct selection *s, struct gui_window *g) +void gui_drag_save_selection(struct gui_window *g, const char *selection) { } diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m index 3b947ea9b..c472fd7d7 100644 --- a/cocoa/BrowserView.m +++ b/cocoa/BrowserView.m @@ -27,8 +27,7 @@ #import "desktop/history_core.h" #import "desktop/plotters.h" #import "desktop/textinput.h" -#import "desktop/options.h" -#import "desktop/selection.h" +#import "utils/nsoption.h" #import "utils/messages.h" @interface BrowserView () diff --git a/cocoa/BrowserViewController.m b/cocoa/BrowserViewController.m index f43917a01..4952f52e3 100644 --- a/cocoa/BrowserViewController.m +++ b/cocoa/BrowserViewController.m @@ -23,8 +23,7 @@ #import "desktop/browser_private.h" #import "desktop/history_core.h" #import "desktop/textinput.h" -#import "desktop/options.h" -#import "desktop/selection.h" +#import "utils/nsoption.h" #import "utils/corestrings.h" #import "utils/filename.h" diff --git a/cocoa/BrowserWindowController.m b/cocoa/BrowserWindowController.m index 7688c1a58..2edb9a1db 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/Makefile.target b/cocoa/Makefile.target index 2da4c5bb4..8bd13c29b 100644 --- a/cocoa/Makefile.target +++ b/cocoa/Makefile.target @@ -98,7 +98,6 @@ S_COCOA := \ url.m \ utf8.m \ utils.m \ - system_colour.m \ ArrowBox.m \ ArrowWindow.m \ BlackScroller.m \ @@ -168,7 +167,7 @@ $$(OBJROOT)/$(1).lproj: $(2) $(VQ)echo Bundling language $(1) $(Q)mkdir -p $$@ $(Q)cp -pLR $(2) $$@ - $(Q)$(PERL) utils/split-messages.pl $(1) cocoa < resources/FatMessages > $$@/Messages + $(Q)$(SPLIT_MESSAGES) -l $(1) -p cocoa -f messages resources/FatMessages > $$@/Messages endef # compile_xib (xib) (lang) diff --git a/cocoa/NetSurfAppDelegate.m b/cocoa/NetSurfAppDelegate.m index 0a352c633..4a66212e8 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 9d19824ae..333cbe272 100644 --- a/cocoa/NetsurfApp.m +++ b/cocoa/NetsurfApp.m @@ -29,10 +29,9 @@ #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/selection.h" #import "desktop/textinput.h" #import "desktop/tree.h" #import "render/html.h" @@ -164,13 +163,20 @@ void cocoa_autorelease( void ) pool = [[NSAutoreleasePool alloc] init]; } -/* Documented in desktop/options.h */ -void gui_options_init_defaults(void) +/** + * Set option defaults for cocoa 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 */ const char * const ca_bundle = [[[NSBundle mainBundle] pathForResource: @"ca-bundle" ofType: @""] UTF8String]; nsoption_setnull_charp(ca_bundle, strdup(ca_bundle)); + + return NSERROR_OK; } int main( int argc, char **argv ) @@ -183,7 +189,24 @@ int main( int argc, char **argv ) const char * const messages = [[[NSBundle mainBundle] pathForResource: @"Messages" ofType: @""] UTF8String]; const char * const options = cocoa_get_options_file(); - netsurf_init(&argc, &argv, options, messages); + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(NULL, &argc, argv); + + /* user options setup */ + error = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (error != NSERROR_OK) { + die("Options failed to initialise"); + } + nsoption_read(options, NULL); + nsoption_commandline(&argc, argv, NULL); + + /* common initialisation */ + error = netsurf_init(messages); + if (error != NSERROR_OK) { + die("NetSurf failed to initialise"); + } /* Initialise filename allocator */ filename_initialise(); diff --git a/cocoa/PreferencesWindowController.m b/cocoa/PreferencesWindowController.m index 8ee4580f5..a3abe2908 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/SearchWindowController.m b/cocoa/SearchWindowController.m index 858ed0e0d..06147fa1a 100644 --- a/cocoa/SearchWindowController.m +++ b/cocoa/SearchWindowController.m @@ -76,15 +76,13 @@ static struct gui_search_callbacks cocoa_search_callbacks = { if (selectAll) flags |= SEARCH_FLAG_SHOWALL; struct browser_window *bw = [browser browser]; - if (bw != NULL && browser_window_search_verify_new( bw, &cocoa_search_callbacks, self )) { - browser_window_search_step( bw, flags, [searchString UTF8String] ); - } + browser_window_search( bw, &cocoa_search_callbacks, self, flags, [searchString UTF8String] ); } - (IBAction) searchStringDidChange: (id) sender; { struct browser_window *bw = [browser browser]; - browser_window_search_destroy_context( bw ); + browser_window_search_clear( bw ); [self setCanGoBack: YES]; [self setCanGoForward: YES]; diff --git a/cocoa/font.m b/cocoa/font.m index 915e7c826..08fad0a36 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 cd7e6d239..b2ff01dc0 100644 --- a/cocoa/gui.m +++ b/cocoa/gui.m @@ -28,9 +28,8 @@ #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/selection.h" #import "desktop/401login.h" #import "utils/utils.h" #import "image/ico.h" @@ -291,7 +290,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, { } -void gui_drag_save_selection(struct selection *s, struct gui_window *g) +void gui_drag_save_selection(struct gui_window *g, const char *selection) { } diff --git a/cocoa/selection.m b/cocoa/selection.m index acfd55087..237c61ce2 100644 --- a/cocoa/selection.m +++ b/cocoa/selection.m @@ -21,7 +21,6 @@ #import "cocoa/BrowserViewController.h" #import "desktop/browser_private.h" -#import "desktop/selection.h" static NSMutableString *cocoa_clipboard_string; diff --git a/cocoa/system_colour.m b/cocoa/system_colour.m deleted file mode 100644 index bd3e87f46..000000000 --- a/cocoa/system_colour.m +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 - * - */ - -#import "utils/utils.h" -#import "utils/log.h" -#import "desktop/gui.h" -#import "desktop/options.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"), - 0xffdddddd, - &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"), - 0xffaaaaaa, - &nsoption_colour(sys_colour_ButtonFace), - NULL - }, { - "ButtonHighlight", - SLEN("ButtonHighlight"), - 0xffdddddd, - &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"), - 0xffcccccc, - &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"), - 0xffffffff, - &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/content/content.c b/content/content.c index 3533d943c..186c5bee8 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" @@ -92,6 +92,7 @@ nserror content__init(struct content *c, const content_handler *handler, if (fallback_charset != NULL) { c->fallback_charset = strdup(fallback_charset); if (c->fallback_charset == NULL) { + free(user_sentinel); return NSERROR_NOMEM; } } @@ -187,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; @@ -831,6 +837,28 @@ bool content_drop_file_at_point(struct hlcache_handle *h, } +void content_search(struct hlcache_handle *h, + struct gui_search_callbacks *gui_callbacks, void *gui_data, + search_flags_t flags, const char *string) +{ + struct content *c = hlcache_handle_get_content(h); + assert(c != 0); + + if (c->handler->search != NULL) + c->handler->search(c, gui_callbacks, gui_data, flags, string); +} + + +void content_search_clear(struct hlcache_handle *h) +{ + struct content *c = hlcache_handle_get_content(h); + assert(c != 0); + + if (c->handler->search_clear != NULL) + c->handler->search_clear(c); +} + + void content_debug_dump(struct hlcache_handle *h, FILE *f) { struct content *c = hlcache_handle_get_content(h); @@ -1327,39 +1355,33 @@ struct content *content_clone(struct content *c) */ nserror content__clone(const struct content *c, struct content *nc) { - struct content_user *user_sentinel; nserror error; - user_sentinel = calloc(1, sizeof(struct content_user)); - if (user_sentinel == NULL) { - return NSERROR_NOMEM; - } - error = llcache_handle_clone(c->llcache, &(nc->llcache)); if (error != NSERROR_OK) { return error; } - - llcache_handle_change_callback(nc->llcache, - content_llcache_callback, nc); + + llcache_handle_change_callback(nc->llcache, + content_llcache_callback, nc); nc->mime_type = lwc_string_ref(c->mime_type); nc->handler = c->handler; nc->status = c->status; - + nc->width = c->width; nc->height = c->height; nc->available_width = c->available_width; nc->quirks = c->quirks; - + if (c->fallback_charset != NULL) { nc->fallback_charset = strdup(c->fallback_charset); if (nc->fallback_charset == NULL) { return NSERROR_NOMEM; } } - + if (c->refresh != NULL) { nc->refresh = nsurl_ref(c->refresh); if (nc->refresh == NULL) { @@ -1370,21 +1392,24 @@ nserror content__clone(const struct content *c, struct content *nc) nc->time = c->time; nc->reformat_time = c->reformat_time; nc->size = c->size; - + if (c->title != NULL) { nc->title = strdup(c->title); if (nc->title == NULL) { return NSERROR_NOMEM; } } - + nc->active = c->active; - nc->user_list = user_sentinel; - + nc->user_list = calloc(1, sizeof(struct content_user)); + if (nc->user_list == NULL) { + return NSERROR_NOMEM; + } + memcpy(&(nc->status_message), &(c->status_message), 120); memcpy(&(nc->sub_status), &(c->sub_status), 80); - + nc->locked = c->locked; nc->total_size = c->total_size; nc->http_code = c->http_code; diff --git a/content/content.h b/content/content.h index 3f93d603b..467fa6055 100644 --- a/content/content.h +++ b/content/content.h @@ -38,6 +38,7 @@ #include "utils/types.h" #include "content/content_factory.h" #include "content/content_type.h" +#include "desktop/search.h" #include "desktop/mouse.h" #include "desktop/plot_style.h" @@ -68,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) */ @@ -102,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; @@ -254,6 +261,10 @@ bool content_scroll_at_point(struct hlcache_handle *h, int x, int y, int scrx, int scry); bool content_drop_file_at_point(struct hlcache_handle *h, int x, int y, char *file); +void content_search(struct hlcache_handle *h, + struct gui_search_callbacks *gui_callbacks, void *gui_data, + search_flags_t flags, const char *string); +void content_search_clear(struct hlcache_handle *h); void content_debug_dump(struct hlcache_handle *h, FILE *f); struct content_rfc5988_link *content_find_rfc5988_link(struct hlcache_handle *c, lwc_string *rel); diff --git a/content/content_protected.h b/content/content_protected.h index 8efe763aa..57ce35775 100644 --- a/content/content_protected.h +++ b/content/content_protected.h @@ -73,6 +73,11 @@ struct content_handler { int scrx, int scry); bool (*drop_file_at_point)(struct content *c, int x, int y, char *file); + void (*search)(struct content *c, + struct gui_search_callbacks *gui_callbacks, + void *gui_data, search_flags_t flags, + const char *string); + void (*search_clear)(struct content *c); void (*debug_dump)(struct content *c, FILE *f); nserror (*clone)(const struct content *old, struct content **newc); bool (*matches_quirks)(const struct content *c, bool quirks); diff --git a/content/fetch.c b/content/fetch.c index bfe4458cf..6f829bb71 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 387e32a98..cac8b2b01 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" @@ -331,12 +331,13 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) "</p>\n" "<h1>NetSurf Browser Config</h1>\n" "<table class=\"config\">\n" - "<tr><th></th><th></th><th></th></tr>\n"); + "<tr><th>Option</th><th>Type</th><th>Provenance</th><th>Setting</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>%p</td><td>%V</td></tr>\n"); if (res <= 0) break; /* last option */ diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c index 668e05a46..28c0f6095 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" @@ -613,11 +613,19 @@ fetch_curl_set_options(struct curl_fetch_info *f) SETOPT(CURLOPT_USERPWD, NULL); } + /* set up proxy options */ if (nsoption_bool(http_proxy) && (nsoption_charp(http_proxy_host) != NULL) && (strncmp(nsurl_access(f->url), "file:", 5) != 0)) { SETOPT(CURLOPT_PROXY, nsoption_charp(http_proxy_host)); SETOPT(CURLOPT_PROXYPORT, (long) nsoption_int(http_proxy_port)); + +#if LIBCURL_VERSION_NUM >= 0x071304 + /* Added in 7.19.4 */ + /* setup the omission list */ + SETOPT(CURLOPT_NOPROXY, nsoption_charp(http_proxy_noproxy)); +#endif + if (nsoption_int(http_proxy_auth) != OPTION_HTTP_PROXY_AUTH_NONE) { SETOPT(CURLOPT_PROXYAUTH, nsoption_int(http_proxy_auth) == diff --git a/content/fetchers/data.c b/content/fetchers/data.c index 77d3c9f9c..fbaa24780 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 b7b831d7b..21cee79d5 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 1fc33f882..4afd44310 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/hlcache.c b/content/hlcache.c index e99f238ad..6c84d1671 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 8996acadd..f2e519f49 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -539,8 +539,11 @@ static nserror llcache_fetch_parse_header(llcache_object *object, /* extract ETag header */ free(object->cache.etag); object->cache.etag = strdup(*value); - if (object->cache.etag == NULL) + if (object->cache.etag == NULL) { + free(*name); + free(*value); return NSERROR_NOMEM; + } } else if (14 < len && strcasecmp(*name, "Last-Modified") == 0) { /* extract Last-Modified header */ object->cache.last_modified = curl_getdate(*value, NULL); @@ -613,8 +616,9 @@ static nserror llcache_fetch_process_header(llcache_object *object, } error = llcache_fetch_parse_header(object, data, len, &name, &value); - if (error != NSERROR_OK) + if (error != NSERROR_OK) { return error; + } /* Append header data to the object's headers array */ temp = realloc(object->headers, (object->num_headers + 1) * @@ -1181,6 +1185,7 @@ static nserror llcache_object_add_user(llcache_object *object, { assert(user->next == NULL); assert(user->prev == NULL); + assert(user->handle != NULL); user->handle->object = object; @@ -1219,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); @@ -1233,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; @@ -1249,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 b596310e9..3d8232cae 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/content/urldb.c b/content/urldb.c index e3cc1d73d..c950dcd90 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -101,12 +101,13 @@ #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" #include "utils/url.h" #include "utils/utils.h" +#include "utils/bloom.h" struct cookie_internal_data { char *name; /**< Cookie name */ @@ -327,6 +328,17 @@ static int loaded_cookie_file_version; #define MIN_URL_FILE_VERSION 106 #define URL_FILE_VERSION 106 +/* Bloom filter used for short-circuting the false case of "is this + * URL in the database?". BLOOM_SIZE controls how large the filter is + * in bytes. Primitive experimentation shows that for a filter of X + * bytes filled with X items, searching for X items not in the filter + * has a 5% false-positive rate. We set it to 32kB, which should be + * enough for all but the largest databases, while not being shockingly + * wasteful on memory. + */ +static struct bloom_filter *url_bloom; +#define BLOOM_SIZE (1024 * 32) + /** * Import an URL database from file, replacing any existing database * @@ -346,7 +358,10 @@ void urldb_load(const char *filename) assert(filename); - LOG(("Loading URL file")); + LOG(("Loading URL file %s", filename)); + + if (url_bloom == NULL) + url_bloom = bloom_create(BLOOM_SIZE); fp = fopen(filename, "r"); if (!fp) { @@ -456,6 +471,11 @@ void urldb_load(const char *filename) die("Memory exhausted whilst loading " "URL file"); } + + if (url_bloom != NULL) { + uint32_t hash = nsurl_hash(nsurl); + bloom_insert_hash(url_bloom, hash); + } /* Copy and merge path/query strings */ if (nsurl_get(nsurl, NSURL_PATH | NSURL_QUERY, @@ -782,6 +802,14 @@ bool urldb_add_url(nsurl *url) unsigned int port_int; assert(url); + + if (url_bloom == NULL) + url_bloom = bloom_create(BLOOM_SIZE); + + if (url_bloom != NULL) { + uint32_t hash = nsurl_hash(url); + bloom_insert_hash(url_bloom, hash); + } /* Copy and merge path/query strings */ if (nsurl_get(url, NSURL_PATH | NSURL_QUERY, &path_query, &len) != @@ -1857,6 +1885,13 @@ struct path_data *urldb_find_url(nsurl *url) bool match; assert(url); + + if (url_bloom != NULL) { + if (bloom_search_hash(url_bloom, + nsurl_hash(url)) == false) { + return NULL; + } + } scheme = nsurl_get_component(url, NSURL_SCHEME); if (scheme == NULL) @@ -3951,6 +3986,10 @@ void urldb_destroy(void) b = a->next; urldb_destroy_host_tree(a); } + + /* And the bloom filter */ + if (url_bloom != NULL) + bloom_destroy(url_bloom); } /** @@ -643,13 +643,10 @@ nserror nscss_import(hlcache_handle *handle, assert(ctx->css->imports[ctx->index].c == handle); switch (event->type) { - case CONTENT_MSG_LOADING: - break; - case CONTENT_MSG_READY: - break; case CONTENT_MSG_DONE: error = nscss_import_complete(ctx); break; + case CONTENT_MSG_ERROR: hlcache_handle_release(handle); ctx->css->imports[ctx->index].c = NULL; @@ -657,9 +654,19 @@ nserror nscss_import(hlcache_handle *handle, error = nscss_import_complete(ctx); /* Already released handle */ break; + + case CONTENT_MSG_LOADING: + case CONTENT_MSG_READY: case CONTENT_MSG_STATUS: + case CONTENT_MSG_REDIRECT: + /* messages content handler will legitamately recive + * but does not need to handle + */ break; + default: + /* all other messages are unexpected and fatal */ + LOG(("Unhandled message type %d", event->type)); assert(0); } diff --git a/css/dump.c b/css/dump.c index 1fe887400..fa34284e0 100644 --- a/css/dump.c +++ b/css/dump.c @@ -576,7 +576,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) /* counter-increment */ val = css_computed_counter_increment(style, &counter); - if (counter == NULL) { + if ((val == CSS_COUNTER_INCREMENT_NONE) || (counter == NULL)) { fprintf(stream, "counter-increment: none "); } else { fprintf(stream, "counter-increment:"); @@ -596,7 +596,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) /* counter-reset */ val = css_computed_counter_reset(style, &counter); - if (counter == NULL) { + if ((val == CSS_COUNTER_RESET_NONE) || (counter == NULL)) { fprintf(stream, "counter-reset: none "); } else { fprintf(stream, "counter-reset:"); diff --git a/css/select.c b/css/select.c index a98ab06f5..0f1962b5d 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" @@ -1551,40 +1551,57 @@ css_error node_is_visited(void *pw, void *node, bool *match) { *match = false; - /** \todo Implement visted check in a more performant way */ - -#ifdef SUPPORT_VISITED nscss_select_ctx *ctx = pw; - xmlNode *n = node; + nsurl *url; + nserror error; + const struct url_data *data; - if (strcasecmp((const char *) n->name, "a") == 0) { - nsurl *url; - nserror error; - const struct url_data *data; - xmlChar *href = xmlGetProp(n, (const xmlChar *) "href"); + dom_exception exc; + dom_node *n = node; + dom_string *s = NULL; - if (href == NULL) - return CSS_OK; + exc = dom_node_get_node_name(n, &s); + if ((exc != DOM_NO_ERR) || (s == NULL)) { + return CSS_NOMEM; + } - /* Make href absolute */ - /* TODO: this duplicates what we do for box->href */ - error = nsurl_join(ctx->base_url, (const char *)href, &url); + if (!dom_string_caseless_lwc_isequal(s, corestring_lwc_a)) { + /* Can't be visited; not ancher element */ + dom_string_unref(s); + return CSS_OK; + } - xmlFree(href); - if (error != NSERROR_OK) { - return CSS_NOMEM; - } + /* Finished with node name string */ + dom_string_unref(s); + s = NULL; + + exc = dom_element_get_attribute(n, corestring_dom_href, &s); + if ((exc != DOM_NO_ERR) || (s == NULL)) { + /* Can't be visited; not got a URL */ + return CSS_OK; + } - data = urldb_get_url_data(nsurl_access(url)); + /* Make href absolute */ + /* TODO: this duplicates what we do for box->href + * should we put the absolute URL on the dom node? */ + error = nsurl_join(ctx->base_url, dom_string_data(s), &url); - /* Visited if in the db and has - * non-zero visit count */ - if (data != NULL && data->visits > 0) - *match = true; + /* Finished with href string */ + dom_string_unref(s); - nsurl_unref(url); + if (error != NSERROR_OK) { + /* Couldn't make nsurl object */ + return CSS_NOMEM; } -#endif + + data = urldb_get_url_data(url); + + /* Visited if in the db and has + * non-zero visit count */ + if (data != NULL && data->visits > 0) + *match = true; + + nsurl_unref(url); return CSS_OK; } diff --git a/css/utils.c b/css/utils.c index d5acf4932..9bf743cac 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/css/utils.h b/css/utils.h index 9d40aba7b..f3131f1bb 100644 --- a/css/utils.h +++ b/css/utils.h @@ -27,17 +27,32 @@ extern css_fixed nscss_screen_dpi; /** * Convert a CSS color to a NetSurf colour primitive - * + * * ARGB -> (1-A)BGR * * \param color The CSS color to convert * \return Corresponding NetSurf colour primitive */ -#define nscss_color_to_ns(color) \ - (0xff000000 - ((color) & 0xff000000)) | \ - (((color) & 0xff0000) >> 16) | \ - ((color) & 0xff00) | \ - (((color) & 0xff) << 16) +#define nscss_color_to_ns(c) \ + ( ((~c) & 0xff000000) | \ + ((( c) & 0xff0000 ) >> 16) | \ + (( c) & 0xff00 ) | \ + ((( c) & 0xff ) << 16)) + + +/** + * Convert a NetSurf color to a CSS colour primitive + * + * (1-A)BGR -> ARGB + * + * \param color The NetSurf color to convert + * \return Corresponding CSS colour primitive + */ +#define ns_color_to_nscss(c) \ + ( ((~c) & 0xff000000) | \ + ((( c) & 0xff0000 ) >> 16) | \ + (( c) & 0xff00 ) | \ + ((( c) & 0xff ) << 16)) /** * Determine if a CSS color primitive is transparent diff --git a/desktop/Makefile b/desktop/Makefile index b587e679e..f91754eb9 100644 --- a/desktop/Makefile +++ b/desktop/Makefile @@ -1,9 +1,9 @@ # 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 + tree_url_node.c version.c system_colour.c S_DESKTOP := $(addprefix desktop/,$(S_DESKTOP)) diff --git a/desktop/browser.c b/desktop/browser.c index 48c32b891..b7ec98947 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -49,16 +49,14 @@ #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/textinput.h" #include "desktop/plotters.h" #include "javascript/js.h" #include "render/form.h" -#include "render/textplain.h" #include "render/html.h" #include "render/box.h" #include "utils/log.h" @@ -685,6 +683,19 @@ void browser_window_debug_dump(struct browser_window *bw, FILE *f) content_debug_dump(bw->current_content, f); } +/** slow script handler +*/ +static bool slow_script(void *ctx) +{ + static int count = 0; + LOG(("Continuing execution %d", count)); + count++; + if (count > 1) { + count = 0; + return false; + } + return true; +} /* exported interface, documented in desktop/browser.h */ @@ -709,7 +720,9 @@ browser_window_create(enum browser_window_nav_flags flags, } /* new javascript context for window */ - bw->jsctx = js_newcontext(); + bw->jsctx = js_newcontext(nsoption_int(script_timeout), + slow_script, + NULL); /* Initialise common parts */ browser_window_initialise_common(bw, clone); @@ -766,7 +779,6 @@ void browser_window_initialise_common(struct browser_window *bw, bw->history = history_clone(clone->history); /* window characteristics */ - bw->cur_search = NULL; bw->refresh_interval = -1; bw->reformat_pending = false; @@ -1343,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 */ @@ -2130,10 +2147,6 @@ void browser_window_destroy_internal(struct browser_window *bw) } } - /* Destroying a search context causes it to redraw any deselected, - * content areas, so do this first */ - browser_window_search_destroy_context(bw); - /* Destruction order is important: we must ensure that the frontend * destroys any window(s) associated with this browser window before * we attempt any destructive cleanup. @@ -2896,6 +2909,8 @@ void browser_window_redraw_rect(struct browser_window *bw, int x, int y, void browser_window_page_drag_start(struct browser_window *bw, int x, int y) { + assert(bw != NULL); + browser_window_set_drag_type(bw, DRAGGING_PAGE_SCROLL, NULL); bw->drag_start_x = x; diff --git a/desktop/browser_private.h b/desktop/browser_private.h index 4c14b1700..4412f4bf4 100644 --- a/desktop/browser_private.h +++ b/desktop/browser_private.h @@ -153,9 +153,6 @@ struct browser_window { } selection; bool can_edit; - /** Current context for free text search, or NULL if none */ - struct search_context *cur_search; - /** current javascript context */ struct jscontext *jsctx; diff --git a/desktop/cookies.c b/desktop/cookies.c index 581e1cc5b..9f66aea1e 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" @@ -264,19 +264,12 @@ static struct node *cookies_create_cookie_node(struct node *parent, const struct cookie_data *data) { struct node *node; - char *name; - name = strdup(data->name); - if (name == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - return NULL; - } - - node = tree_create_leaf_node(cookies_tree, NULL, name, + node = tree_create_leaf_node(cookies_tree, + NULL, + data->name, false, false, false); if (node == NULL) { - free(name); return NULL; } @@ -329,44 +322,33 @@ static void cookies_schedule_callback(const void *scheduled_data) const struct cookie_data *data = scheduled_data; struct node *node = NULL; struct node *cookie_node = NULL; - char *domain_cp; assert(data != NULL); node = cookies_find(cookies_tree_root, data->domain); if (node == NULL) { - domain_cp = strdup(data->domain); - if (domain_cp == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - return; - } - /* ownership of domain_cp passed to tree, if node creation - * does not fail */ node = tree_create_folder_node(cookies_tree, - cookies_tree_root, domain_cp, + cookies_tree_root, + data->domain, false, false, false); if (node != NULL) { - tree_set_node_user_callback(node, cookies_node_callback, + tree_set_node_user_callback(node, + cookies_node_callback, NULL); tree_set_node_icon(cookies_tree, node, folder_icon); - - } else { - free(domain_cp); } } - if (node == NULL) - return; - - cookie_node = cookies_find(node, data->name); - if (cookie_node == NULL) - cookies_create_cookie_node(node, data); - else - cookies_update_cookie_node(cookie_node, data); + if (node != NULL) { + cookie_node = cookies_find(node, data->name); + if (cookie_node == NULL) { + cookies_create_cookie_node(node, data); + } else { + cookies_update_cookie_node(cookie_node, data); + } - return; + } } /** diff --git a/desktop/download.c b/desktop/download.c index f4bedc8e9..b775eb18e 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/desktop/gui.h b/desktop/gui.h index b38bb61d5..dc190952b 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -50,7 +50,6 @@ typedef enum { struct gui_window; struct gui_download_window; struct browser_window; -struct selection; struct form_control; #include <stdbool.h> @@ -65,10 +64,6 @@ struct form_control; #include "desktop/search.h" #include "utils/errors.h" -/** \todo remove these when each frontend calls nslog_init */ -#include <stdio.h> -bool nslog_ensure(FILE *fptr); - void gui_poll(bool active); void gui_quit(void); @@ -116,7 +111,7 @@ void gui_download_window_done(struct gui_download_window *dw); void gui_drag_save_object(gui_save_type type, hlcache_handle *c, struct gui_window *g); -void gui_drag_save_selection(struct selection *s, struct gui_window *g); +void gui_drag_save_selection(struct gui_window *g, const char *selection); void gui_start_selection(struct gui_window *g); void gui_clear_selection(struct gui_window *g); diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c index 3222dc7b8..2a941e05d 100644 --- a/desktop/history_global_core.c +++ b/desktop/history_global_core.c @@ -175,33 +175,24 @@ static bool history_global_initialise_node(const char *title, time_t base, int days_back) { struct tm *full_time; - char *buffer; struct node *node; base += days_back * 60 * 60 * 24; if (title == NULL) { full_time = localtime(&base); - buffer = strdup(messages_get(weekday_msg_name[full_time->tm_wday])); - } else { - buffer = strdup(title); + title = messages_get(weekday_msg_name[full_time->tm_wday]); } - if (buffer == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - return false; - } - - node = tree_create_folder_node(NULL, NULL, buffer, - false, true, true); + node = tree_create_folder_node(NULL, NULL, title, false, true, true); if (node == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - free(buffer); + warn_user(messages_get_errorcode(NSERROR_NOMEM), 0); return false; } - if (folder_icon != NULL) + + if (folder_icon != NULL) { tree_set_node_icon(global_history_tree, node, folder_icon); + } + tree_set_node_user_callback(node, history_global_node_callback, NULL); global_history_base_node[global_history_base_node_count] = node; diff --git a/desktop/hotlist.c b/desktop/hotlist.c index e2386fc8e..055de3af8 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -121,7 +121,6 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, { struct node *node; const struct url_data *url_data; - char *name; int hlst_loop; /* Either load or create a hotlist */ @@ -143,18 +142,15 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, return true; } - /* failed to load hotlist file, use default list */ - name = strdup("NetSurf"); - if (name == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - return false; - } - node = tree_create_folder_node(hotlist_tree, hotlist_tree_root, - name, true, false, false); + node = tree_create_folder_node(hotlist_tree, + hotlist_tree_root, + messages_get("NetSurf"), + true, + false, + false); if (node == NULL) { - free(name); + warn_user(messages_get_errorcode(NSERROR_NOMEM), 0); return false; } @@ -203,9 +199,13 @@ unsigned int hotlist_get_tree_flags(void) */ void hotlist_cleanup(const char *hotlist_path) { + LOG(("Exporting hotlist...")); hotlist_export(hotlist_path); + LOG(("Releasing handles...")); hlcache_handle_release(folder_icon); + LOG(("Clearing hotlist tree nodes...")); tree_url_node_cleanup(); + LOG(("Hotlist cleaned up.")); } @@ -373,14 +373,7 @@ void hotlist_collapse_addresses(void) void hotlist_add_folder(bool selected) { struct node *node, *parent = NULL; - struct node_element *element; - char *title = strdup("Untitled"); - if (title == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - return; - } creating_node = true; if (selected == true) { @@ -394,16 +387,21 @@ void hotlist_add_folder(bool selected) parent = tree_get_default_folder_node(hotlist_tree); } - node = tree_create_folder_node(hotlist_tree, parent, title, - true, false, false); + node = tree_create_folder_node(hotlist_tree, + parent, + messages_get("Untitled"), + true, + false, + false); if (node == NULL) { - free(title); + warn_user(messages_get_errorcode(NSERROR_NOMEM), 0); return; } + tree_set_node_user_callback(node, hotlist_node_callback, NULL); tree_set_node_icon(hotlist_tree, node, folder_icon); - element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL); - tree_start_edit(hotlist_tree, element); + tree_start_edit(hotlist_tree, + tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL)); } /** diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 0b1cffe0a..fa026dc6a 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" @@ -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; @@ -138,24 +135,12 @@ nserror netsurf_init(int *pargc, * way of determining the cause of the SIGPIPE (other than using * sigaction() and some mechanism for getting the file descriptor * out of libcurl). However, we expect nothing else to generate a - * SIGPIPE, anyway, so may as well just ignore them all. */ - + * SIGPIPE, anyway, so may as well just ignore them all. + */ signal(SIGPIPE, SIG_IGN); #endif -#ifndef HAVE_STDOUT - ret = nslog_init(nslog_ensure, pargc, *pargv); -#else - ret = nslog_init(NULL, pargc, *pargv); -#endif - - if (ret != NSERROR_OK) - return ret; - -#ifdef _MEMDEBUG_H_ - memdebug_memdebug("memdump"); -#endif - LOG(("version '%s'", netsurf_version)); + LOG(("NetSurf version '%s'", netsurf_version)); if (uname(&utsname) < 0) LOG(("Failed to extract machine information")); else @@ -164,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 */ @@ -187,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 */ @@ -232,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 10c1e00e3..bfdb647ff 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); diff --git a/desktop/options.c b/desktop/options.c deleted file mode 100644 index 2a080d564..000000000 --- a/desktop/options.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net> - * Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk> - * Copyright 2004 James Bursa <bursa@users.sourceforge.net> - * Copyright 2005 Richard Wilson <info@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 "desktop/options.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.h b/desktop/options.h index 17ba64f6c..391dfbc08 100644 --- a/desktop/options.h +++ b/desktop/options.h @@ -1,6 +1,5 @@ /* - * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net> - * Copyright 2004 James Bursa <bursa@users.sourceforge.net> + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -18,171 +17,261 @@ */ /** \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); +/** Proxy omission list */ +NSOPTION_STRING(http_proxy_noproxy, "localhost") -/** - * Dump user options to stream - * - * \param outf output stream to dump options to. - */ -void nsoption_dump(FILE *outf); +/** Default font size / 0.1pt. */ +NSOPTION_INTEGER(font_size, 128) -/** - * 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); +/** Minimum font size. */ +NSOPTION_INTEGER(font_min_size, 85) + +/** 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/#dnt-uas */ +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) -/** - * Process commandline and set options approriately. +/** ca-bundle location */ +NSOPTION_STRING(ca_bundle, NULL) + +/** 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_UINT(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, 0x00d3d3d3) +NSOPTION_COLOUR(sys_colour_ActiveCaption, 0x00f1f1f1) +NSOPTION_COLOUR(sys_colour_AppWorkspace, 0x00f1f1f1) +NSOPTION_COLOUR(sys_colour_Background, 0x006e6e6e) +NSOPTION_COLOUR(sys_colour_ButtonFace, 0x00f9f9f9) +NSOPTION_COLOUR(sys_colour_ButtonHighlight, 0x00ffffff) +NSOPTION_COLOUR(sys_colour_ButtonShadow, 0x00aeaeae) +NSOPTION_COLOUR(sys_colour_ButtonText, 0x004c4c4c) +NSOPTION_COLOUR(sys_colour_CaptionText, 0x004c4c4c) +NSOPTION_COLOUR(sys_colour_GrayText, 0x00505050) +NSOPTION_COLOUR(sys_colour_Highlight, 0x00c00800) +NSOPTION_COLOUR(sys_colour_HighlightText, 0x00ffffff) +NSOPTION_COLOUR(sys_colour_InactiveBorder, 0x00f1f1f1) +NSOPTION_COLOUR(sys_colour_InactiveCaption, 0x00e6e6e6) +NSOPTION_COLOUR(sys_colour_InactiveCaptionText, 0x00a6a6a6) +NSOPTION_COLOUR(sys_colour_InfoBackground, 0x008fdfef) +NSOPTION_COLOUR(sys_colour_InfoText, 0x00000000) +NSOPTION_COLOUR(sys_colour_Menu, 0x00f1f1f1) +NSOPTION_COLOUR(sys_colour_MenuText, 0x004e4e4e) +NSOPTION_COLOUR(sys_colour_Scrollbar, 0x00cccccc) +NSOPTION_COLOUR(sys_colour_ThreeDDarkShadow, 0x00aeaeae) +NSOPTION_COLOUR(sys_colour_ThreeDFace, 0x00f9f9f9) +NSOPTION_COLOUR(sys_colour_ThreeDHighlight, 0x00ffffff) +NSOPTION_COLOUR(sys_colour_ThreeDLightShadow, 0x00ffffff) +NSOPTION_COLOUR(sys_colour_ThreeDShadow, 0x00d5d5d5) +NSOPTION_COLOUR(sys_colour_Window, 0x00f1f1f1) +NSOPTION_COLOUR(sys_colour_WindowFrame, 0x004e4e4e) +NSOPTION_COLOUR(sys_colour_WindowText, 0x00000000) diff --git a/desktop/options_main.h b/desktop/options_main.h deleted file mode 100644 index 7b9e7314b..000000000 --- a/desktop/options_main.h +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright 2004 James Bursa <bursa@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/#dnt-uas */ \ - 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 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 - -#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}, \ - { "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/desktop/print.c b/desktop/print.c index e1cd48f93..8f83f2d19 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 c90753121..57d36fe95 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 847d6dafc..123408dd3 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 5517a6f0d..d24ea727a 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 29d28bdaa..3a7c768a5 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" @@ -44,93 +44,44 @@ #include "utils/utils.h" -/* callback informing us that a search context is nolonger valid */ -static void browser_window_search_invalidate(struct search_context *context, - void *p) -{ - struct browser_window *bw = p; - assert(bw != NULL); - - if (bw->cur_search != NULL && bw->cur_search == context) { - /* The browser's current search is the one being invalidated */ - bw->cur_search = NULL; - } -} -bool browser_window_search_create_context(struct browser_window *bw, - struct gui_search_callbacks *gui_callbacks, void *gui_p) +/** + * Starts or continues an existing search. + * + * \param bw the browser_window to search + * \param callbacks callbacks vtable to update frontend according to results + * \param gui_data a pointer returned to the callbacks + * \param flags search flags + * \param string string to search for + */ +void browser_window_search(struct browser_window *bw, + struct gui_search_callbacks *gui_callbacks, void *gui_data, + search_flags_t flags, const char *string) { - struct search_callbacks callbacks; - assert(bw != NULL); assert(gui_callbacks != NULL); - if (bw->cur_search != NULL) - search_destroy_context(bw->cur_search); - bw->cur_search = NULL; - - if (!bw->current_content) - return false; - - callbacks.gui = gui_callbacks; - callbacks.gui_p = gui_p; - callbacks.invalidate = browser_window_search_invalidate; - callbacks.p = bw; - bw->cur_search = search_create_context(bw->current_content, callbacks); - - if (bw->cur_search == NULL) - return false; - - return true; -} - - -void browser_window_search_destroy_context(struct browser_window *bw) -{ - assert(bw != NULL); + if (bw == NULL || bw->current_content == NULL) + return; - if (bw->cur_search != NULL) - search_destroy_context(bw->cur_search); - bw->cur_search = NULL; + content_search(bw->current_content, gui_callbacks, gui_data, + flags, string); } /** - * to simplify calls to search_step(); checks that the browser_window is - * non-NULL, creates a new search_context in case of a new search - * \param bw the browser_window the search refers to - * \param callbacks the callbacks to modify appearance according to results - * \param gui_p a pointer returned to the callbacks - * \return true for success + * Clear up a search. Frees any memory used by the search + * + * \param bw the browser_window to search + * \param callbacks callbacks vtable to update frontend according to results + * \param gui_data a pointer returned to the callbacks + * \param flags search flags + * \param string string to search for */ -bool browser_window_search_verify_new(struct browser_window *bw, - struct gui_search_callbacks *gui_callbacks, void *gui_p) -{ - if (bw == NULL) - return false; - if (bw->cur_search == NULL) - return browser_window_search_create_context(bw, - gui_callbacks, gui_p); - - return true; -} - - -void browser_window_search_step(struct browser_window *bw, - search_flags_t flags, const char *string) +void browser_window_search_clear(struct browser_window *bw) { - assert(bw != NULL); + if (bw == NULL || bw->current_content == NULL) + return; - if (bw->cur_search != NULL) - search_step(bw->cur_search, flags, string); + content_search_clear(bw->current_content); } - - -void browser_window_search_show_all(bool all, struct browser_window *bw) -{ - assert(bw != NULL); - - if (bw->cur_search != NULL) - search_show_all(all, bw->cur_search); -} - diff --git a/desktop/search.h b/desktop/search.h index e178138de..8440ce982 100644 --- a/desktop/search.h +++ b/desktop/search.h @@ -22,10 +22,14 @@ #include <ctype.h> #include <string.h> +struct browser_window; + typedef enum { - SEARCH_FLAG_CASE_SENSITIVE = (1 << 0), - SEARCH_FLAG_FORWARDS = (1 << 1), - SEARCH_FLAG_SHOWALL = (1 << 2) + SEARCH_FLAG_NONE = 0, + SEARCH_FLAG_CASE_SENSITIVE = (1 << 0), + SEARCH_FLAG_FORWARDS = (1 << 1), + SEARCH_FLAG_BACKWARDS = (1 << 2), + SEARCH_FLAG_SHOWALL = (1 << 3) } search_flags_t; /** @@ -74,13 +78,9 @@ struct gui_search_callbacks { }; -bool browser_window_search_create_context(struct browser_window *bw, - struct gui_search_callbacks *gui_callbacks, void *gui_p); -void browser_window_search_destroy_context(struct browser_window *bw); -bool browser_window_search_verify_new(struct browser_window *bw, - struct gui_search_callbacks *gui_callbacks, void *gui_p); -void browser_window_search_step(struct browser_window *bw, +void browser_window_search(struct browser_window *bw, + struct gui_search_callbacks *gui_callbacks, void *gui_data, search_flags_t flags, const char *string); -void browser_window_search_show_all(bool all, struct browser_window *bw); +void browser_window_search_clear(struct browser_window *bw); #endif diff --git a/desktop/searchweb.c b/desktop/searchweb.c index a90627ac6..87e3e21f1 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/selection.c b/desktop/selection.c index 216462c96..13a1293e3 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -83,8 +83,7 @@ static bool traverse_tree(struct box *box, unsigned start_idx, unsigned end_idx, seln_traverse_handler handler, void *handle, save_text_whitespace *before, bool *first, bool do_marker); -static struct box *get_box(struct box *b, unsigned offset, size_t *pidx); - +static unsigned selection_label_subtree(struct box *box, unsigned idx); /** * Get the browser window containing the content a selection object belongs to. @@ -160,7 +159,7 @@ void selection_destroy(struct selection *s) * resized causing the layout to change. * * \param s selection object - * \param root the box (page/textarea) to be used as the root node for this selection + * \param root the root box for html document or NULL for text/plain */ void selection_reinit(struct selection *s, struct box *root) @@ -171,16 +170,6 @@ void selection_reinit(struct selection *s, struct box *root) root_idx = 0; -// if (s->root == root) { -// /* keep the same number space as before, because we want -// to keep the selection too */ -// root_idx = (s->max_idx & 0xF0000000U); -// } -// else { -// static int next_idx = 0; -// root_idx = (next_idx++) << 28; -// } - s->root = root; if (root) { s->max_idx = selection_label_subtree(root, root_idx); @@ -204,7 +193,7 @@ void selection_reinit(struct selection *s, struct box *root) * ie. selections are confined to that subtree. * * \param s selection object - * \param root the box (page/textarea) to be used as the root node for this selection + * \param root the root box for html document or NULL for text/plain */ void selection_init(struct selection *s, struct box *root) @@ -222,19 +211,6 @@ void selection_init(struct selection *s, struct box *root) /** - * Indicate whether the selected text is read only, ie. cannot be modified. - * - * \param s selection object - * \return true iff the selection is read only - */ - -bool selection_read_only(struct selection *s) -{ - return true; -} - - -/** * Label each text box in the given box subtree with its position * in a textual representation of the content. * @@ -297,8 +273,9 @@ bool selection_click(struct selection *s, browser_mouse_state mouse, ((mouse & BROWSER_MOUSE_DRAG_1) || (modkeys && (mouse & BROWSER_MOUSE_DRAG_2)))) { /* drag-saving selection */ - - gui_drag_save_selection(s, top->window); + char *sel = selection_get_copy(s); + gui_drag_save_selection(top->window, sel); + free(sel); } else if (!modkeys) { if (pos && (mouse & BROWSER_MOUSE_PRESS_1)) { @@ -337,13 +314,6 @@ bool selection_click(struct selection *s, browser_mouse_state mouse, gui_start_selection(top->window); } - /* Selection should be cleared when button is released but in - * the RO interface click is the same as press */ -// else if (!pos && (mouse & BROWSER_MOUSE_CLICK_1)) { -// /* clear selection */ -// selection_clear(s, true); -// s->drag_state = DRAG_NONE; -// } else if (mouse & BROWSER_MOUSE_CLICK_2) { /* ignore Adjust clicks when there's no selection */ @@ -981,73 +951,6 @@ void selection_set_end(struct selection *s, unsigned offset) /** - * Get the box and index of the specified byte offset within the - * textual representation. - * - * \param b root node of search - * \param offset byte offset within textual representation - * \param pidx receives byte index of selection start point within box - * \return ptr to box, or NULL if no selection defined - */ - -struct box *get_box(struct box *b, unsigned offset, size_t *pidx) -{ - struct box *child = b->children; - - if (b->text) { - - if (offset >= b->byte_offset && - offset <= b->byte_offset + b->length + SPACE_LEN(b)) { - - /* it's in this box */ - *pidx = offset - b->byte_offset; - return b; - } - } - - /* find the first child that could contain this offset */ - if (child) { - struct box *next = child->next; - while (next && next->byte_offset < offset) { - child = next; - next = child->next; - } - return get_box(child, offset, pidx); - } - - return NULL; -} - - -/** - * Get the box and index of the selection start, if defined. - * - * \param s selection object - * \param pidx receives byte index of selection start point within box - * \return ptr to box, or NULL if no selection defined - */ - -struct box *selection_get_start(struct selection *s, size_t *pidx) -{ - return (s->defined ? get_box(s->root, s->start_idx, pidx) : NULL); -} - - -/** - * Get the box and index of the selection end, if defined. - * - * \param s selection object - * \param pidx receives byte index of selection end point within box - * \return ptr to box, or NULL if no selection defined. - */ - -struct box *selection_get_end(struct selection *s, size_t *pidx) -{ - return (s->defined ? get_box(s->root, s->end_idx, pidx) : NULL); -} - - -/** * Tests whether a text range lies partially within the selection, if there is * a selection defined, returning the start and end indexes of the bytes * that should be selected. @@ -1074,35 +977,4 @@ bool selection_highlighted(const struct selection *s, *end_idx = min(end, s->end_idx) - start; return true; - -// assert(box); -// assert(IS_TEXT(box)); - -// return selected_part(box, s->start_idx, s->end_idx, start_idx, end_idx); -} - - -/** - * Adjust the selection to reflect a change in the selected text, - * eg. editing in a text area/input field. - * - * \param s selection object - * \param byte_offset byte offset of insertion/removal point - * \param change byte size of change, +ve = insertion, -ve = removal - * \param redraw true iff the screen should be updated - */ - -void selection_update(struct selection *s, size_t byte_offset, - int change, bool redraw) -{ - if (selection_defined(s) && - byte_offset >= s->start_idx && - byte_offset < s->end_idx) - { - if (change > 0) - s->end_idx += change; - else - s->end_idx += - max(change, (int)(byte_offset - s->end_idx)); - } } diff --git a/desktop/selection.h b/desktop/selection.h index aebb1698f..7e620fc46 100644 --- a/desktop/selection.h +++ b/desktop/selection.h @@ -75,17 +75,12 @@ void selection_reinit(struct selection *s, struct box *root); /* bool selection_dragging_start(struct selection *s); */ #define selection_dragging_start(s) ((s)->drag_state == DRAG_START) -bool selection_read_only(struct selection *s); - void selection_clear(struct selection *s, bool redraw); void selection_select_all(struct selection *s); void selection_set_start(struct selection *s, unsigned idx); void selection_set_end(struct selection *s, unsigned idx); -struct box *selection_get_start(struct selection *s, size_t *pidx); -struct box *selection_get_end(struct selection *s, size_t *pidx); - bool selection_click(struct selection *s, browser_mouse_state mouse, unsigned idx); void selection_track(struct selection *s, browser_mouse_state mouse, @@ -102,11 +97,4 @@ bool selection_highlighted(const struct selection *s, unsigned start, unsigned end, unsigned *start_idx, unsigned *end_idx); -bool selection_save_text(struct selection *s, const char *path); - -void selection_update(struct selection *s, size_t byte_offset, int change, - bool redraw); - -unsigned selection_label_subtree(struct box *box, unsigned idx); - #endif diff --git a/desktop/sslcert.c b/desktop/sslcert.c index b7a424465..2b4d726e0 100644 --- a/desktop/sslcert.c +++ b/desktop/sslcert.c @@ -119,19 +119,22 @@ static node_callback_resp sslcert_node_callback(void *user_data, static struct node *sslcert_create_node(const struct ssl_cert_info *cert) { - struct node *node; + struct node *node = NULL; struct node_element *element; char *text; text = messages_get_buff("SSL_Certificate_Subject", cert->subject); - if (text == NULL) - return NULL; - - node = tree_create_leaf_node(NULL, NULL, text, false, false, false); - if (node == NULL) { + if (text != NULL) { + node = tree_create_leaf_node(NULL, + NULL, + text, + false, false, false); free(text); + } + if (node == NULL) { return NULL; } + tree_set_node_user_callback(node, sslcert_node_callback, NULL); /* add issuer node */ diff --git a/desktop/system_colour.c b/desktop/system_colour.c new file mode 100644 index 000000000..4ef170981 --- /dev/null +++ b/desktop/system_colour.c @@ -0,0 +1,101 @@ +/* + * Copyright 2011 Vincent Sanders <vince@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 "css/utils.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 = 0; + 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 = ns_color_to_nscss(nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c); + return CSS_OK; + } + } + + return CSS_INVALID; +} diff --git a/desktop/thumbnail.c b/desktop/thumbnail.c index 975e799fa..1011adc1f 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 af64be83b..2e35b5bf8 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" @@ -117,7 +117,7 @@ struct node_element { struct node *parent; /**< Parent node */ node_element_type type; /**< Element type */ struct node_element_box box; /**< Element bounding box */ - const char *text; /**< Text for the element */ + char *text; /**< Text for the element */ void *bitmap; /**< Bitmap for the element */ struct node_element *next; /**< Next node element */ unsigned int flag; /**< Client specified flag for data @@ -233,26 +233,19 @@ struct tree *tree_create(unsigned int flags, const struct treeview_table *callbacks, void *client_data) { struct tree *tree; - char *title; tree = calloc(sizeof(struct tree), 1); if (tree == NULL) { LOG(("calloc failed")); - warn_user("NoMemory", 0); + warn_user(messages_get_errorcode(NSERROR_NOMEM), 0); return NULL; } - title = strdup("Root"); - if (title == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - free(tree); - return NULL; - } - tree->root = tree_create_folder_node(NULL, NULL, title, + tree->root = tree_create_folder_node(NULL, + NULL, + messages_get("Root"), false, false, false); if (tree->root == NULL) { - free(title); free(tree); return NULL; } @@ -553,18 +546,7 @@ static void tree_recalculate_node_sizes(struct tree *tree, struct node *node, } -/** - * Creates a folder node with the specified title, and optionally links it into - * the tree. - * - * \param tree the owner tree of 'parent', may be NULL - * \param parent the parent node, or NULL not to link - * \param title the node title (not copied, used directly) - * \param editable if true, the node title will be editable - * \param retain_in_memory if true, the node will stay in memory after deletion - * \param deleted if true, the node is created with the deleted flag - * \return the newly created node. - */ +/* exported interface documented in desktop/tree.h */ struct node *tree_create_folder_node(struct tree *tree, struct node *parent, const char *title, bool editable, bool retain_in_memory, bool deleted) @@ -575,16 +557,20 @@ struct node *tree_create_folder_node(struct tree *tree, struct node *parent, node = calloc(sizeof(struct node), 1); if (node == NULL) { - LOG(("calloc failed")); - warn_user("NoMemory", 0); return NULL; } + + node->data.text = strdup(title); + if (node->data.text == NULL) { + free(node); + return NULL; + } + node->folder = true; node->retain_in_memory = retain_in_memory; node->deleted = deleted; node->data.parent = node; node->data.type = NODE_ELEMENT_TEXT; - node->data.text = title; node->data.flag = TREE_ELEMENT_TITLE; node->data.editable = editable; node->sort = NULL; @@ -592,25 +578,14 @@ struct node *tree_create_folder_node(struct tree *tree, struct node *parent, node->previous = NULL; tree_recalculate_node_sizes(tree, node, true); - if (parent != NULL) + if (parent != NULL) { tree_link_node(tree, parent, node, false); + } return node; } - -/** - * Creates a leaf node with the specified title, and optionally links it into - * the tree. - * - * \param tree the owner tree of 'parent', may be NULL - * \param parent the parent node, or NULL not to link - * \param title the node title (not copied, used directly) - * \param editable if true, the node title will be editable - * \param retain_in_memory if true, the node will stay in memory after deletion - * \param deleted if true, the node is created with the deleted flag - * \return the newly created node. - */ +/* exported interface documented in desktop/tree.h */ struct node *tree_create_leaf_node(struct tree *tree, struct node *parent, const char *title, bool editable, bool retain_in_memory, bool deleted) @@ -621,8 +596,12 @@ struct node *tree_create_leaf_node(struct tree *tree, struct node *parent, node = calloc(sizeof(struct node), 1); if (node == NULL) { - LOG(("calloc failed")); - warn_user("NoMemory", 0); + return NULL; + } + + node->data.text = strdup(title); + if (node->data.text == NULL) { + free(node); return NULL; } @@ -631,7 +610,6 @@ struct node *tree_create_leaf_node(struct tree *tree, struct node *parent, node->deleted = deleted; node->data.parent = node; node->data.type = NODE_ELEMENT_TEXT; - node->data.text = title; node->data.flag = TREE_ELEMENT_TITLE; node->data.editable = editable; node->sort = NULL; @@ -639,8 +617,9 @@ struct node *tree_create_leaf_node(struct tree *tree, struct node *parent, node->previous = NULL; tree_recalculate_node_sizes(tree, node, true); - if (parent != NULL) + if (parent != NULL) { tree_link_node(tree, parent, node, false); + } return node; } @@ -1502,18 +1481,20 @@ void tree_update_node_element(struct tree *tree, struct node_element *element, assert(element != NULL); - if (tree != NULL && element == tree->editing) + if ((tree != NULL) && (element == tree->editing)) { tree_stop_edit(tree, false); + } - if (text != NULL && (element->type == NODE_ELEMENT_TEXT || - element->type == NODE_ELEMENT_TEXT_PLUS_ICON)) { + if ((text != NULL) && + (element->type == NODE_ELEMENT_TEXT || + element->type == NODE_ELEMENT_TEXT_PLUS_ICON)) { if (element->text != NULL) { - if(strcmp(element->text, text) == 0) text_changed = true; - + if (strcmp(element->text, text) == 0) { + text_changed = true; + } response = NODE_CALLBACK_NOT_HANDLED; - if (!element->editable && - element->parent->user_callback != - NULL) { + if ((!element->editable) && + (element->parent->user_callback != NULL)) { msg_data.msg = NODE_DELETE_ELEMENT_TXT; msg_data.flag = element->flag; msg_data.node = element->parent; @@ -1522,14 +1503,16 @@ void tree_update_node_element(struct tree *tree, struct node_element *element, element->parent->callback_data, &msg_data); } - if (response != NODE_CALLBACK_HANDLED) - free((void *)element->text); + if (response != NODE_CALLBACK_HANDLED) { + free(element->text); + } } - element->text = text; + element->text = (char *)text; } - if (bitmap != NULL && (element->type == NODE_ELEMENT_BITMAP || - element->type == NODE_ELEMENT_TEXT_PLUS_ICON)) { + if ((bitmap != NULL) && + ((element->type == NODE_ELEMENT_BITMAP) || + (element->type == NODE_ELEMENT_TEXT_PLUS_ICON))) { if (element->bitmap != NULL) { response = NODE_CALLBACK_NOT_HANDLED; if (element->parent->user_callback != NULL) { @@ -1541,10 +1524,11 @@ void tree_update_node_element(struct tree *tree, struct node_element *element, element->parent->callback_data, &msg_data); } - if (response != NODE_CALLBACK_HANDLED) + + if (response != NODE_CALLBACK_HANDLED) { free(element->bitmap); - } - else { + } + } else { /* Increase the box width to accomodate the new icon */ element->box.width += NODE_INSTEP; } @@ -1568,6 +1552,17 @@ const char *tree_node_element_get_text(struct node_element *element) /** + * Returns the node element's icon + * + * \return the node element's icon + */ +struct bitmap *tree_node_element_get_icon(struct node_element *element) +{ + return element->bitmap; +} + + +/** * Get the root node of a tree * * \param tree the tree to get the root of diff --git a/desktop/tree.h b/desktop/tree.h index 8ac505783..20ade30c0 100644 --- a/desktop/tree.h +++ b/desktop/tree.h @@ -137,12 +137,39 @@ void tree_setup_colours(void); struct tree *tree_create(unsigned int flags, const struct treeview_table *callbacks, void *client_data); + +/** + * Creates a folder node with the specified title, and optionally links it into + * the tree. + * + * \param tree the owner tree of 'parent', may be NULL + * \param parent the parent node, or NULL not to link + * \param title the node title + * \param editable if true, the node title will be editable + * \param retain_in_memory if true, the node will stay in memory after deletion + * \param deleted if true, the node is created with the deleted flag + * \return the newly created node or NULL on error. + */ struct node *tree_create_folder_node(struct tree *tree, struct node *parent, const char *title, bool editable, bool retain_in_memory, bool deleted); + +/** + * Creates a leaf node with the specified title, and optionally links it into + * the tree. + * + * \param tree the owner tree of 'parent', may be NULL + * \param parent the parent node, or NULL not to link + * \param title the node title. + * \param editable if true, the node title will be editable + * \param retain_in_memory if true, the node will stay in memory after deletion + * \param deleted if true, the node is created with the deleted flag + * \return the newly created node or NULL on error. + */ struct node *tree_create_leaf_node(struct tree *tree, struct node *parent, const char *title, bool editable, bool retain_in_memory, bool deleted); + struct node_element *tree_create_node_element(struct node *parent, node_element_type type, unsigned int flag, bool editable); void tree_link_node(struct tree *tree, struct node *link, struct node *node, @@ -173,6 +200,7 @@ void tree_update_node_element(struct tree *tree, struct node_element *element, const char *text, void *bitmap); bool tree_update_element_text(struct tree *tree, struct node_element *element, char *text); const char *tree_node_element_get_text(struct node_element *element); +struct bitmap *tree_node_element_get_icon(struct node_element *element); struct node *tree_get_root(struct tree *tree); bool tree_is_edited(struct tree *tree); tree_drag_type tree_drag_status(struct tree *tree); diff --git a/desktop/tree_url_node.c b/desktop/tree_url_node.c index f411dac64..8472fff24 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" @@ -126,35 +126,41 @@ void tree_url_node_cleanup() * \param parent the node to link to * \param url the URL (copied) * \param data the URL data to use - * \param title the custom title to use + * \param title custom title to use or NULL to use url * \return the node created, or NULL for failure */ struct node *tree_create_URL_node(struct tree *tree, struct node *parent, nsurl *url, const char *title, tree_node_user_callback user_callback, void *callback_data) { - struct node *node; + struct node *node = NULL; struct node_element *element; - char *text_cp, *squashed; - squashed = squash_whitespace(title ? title : nsurl_access(url)); - text_cp = strdup(squashed); - if (text_cp == NULL) { - LOG(("malloc failed")); - warn_user("NoMemory", 0); - return NULL; + if (title == NULL) { + node = tree_create_leaf_node(tree, + parent, + nsurl_access(url), + true, false, false); + } else { + char *squashed; + + squashed = squash_whitespace(title); + if (squashed != NULL) { + node = tree_create_leaf_node(tree, + parent, + squashed, + true, false, false); + free(squashed); + } } - free(squashed); - node = tree_create_leaf_node(tree, parent, text_cp, true, false, - false); if (node == NULL) { - free(text_cp); return NULL; } - if (user_callback != NULL) + if (user_callback != NULL) { tree_set_node_user_callback(node, user_callback, callback_data); + } tree_create_node_element(node, NODE_ELEMENT_BITMAP, TREE_ELEMENT_THUMBNAIL, false); @@ -165,7 +171,7 @@ struct node *tree_create_URL_node(struct tree *tree, struct node *parent, element = tree_create_node_element(node, NODE_ELEMENT_TEXT, TREE_ELEMENT_URL, true); if (element != NULL) { - text_cp = strdup(nsurl_access(url)); + char *text_cp = strdup(nsurl_access(url)); if (text_cp == NULL) { tree_delete_node(tree, node, false); LOG(("malloc failed")); @@ -194,22 +200,18 @@ struct node *tree_create_URL_node_readonly(struct tree *tree, { struct node *node; struct node_element *element; - char *title; + const char *title; assert(url && data); if (data->title != NULL) { - title = strdup(data->title); + title = data->title; } else { - title = strdup(nsurl_access(url)); + title = nsurl_access(url); } - if (title == NULL) - return NULL; - node = tree_create_leaf_node(tree, parent, title, false, false, false); if (node == NULL) { - free(title); return NULL; } @@ -337,6 +339,17 @@ const char *tree_url_node_get_url(struct node *node) return tree_node_element_get_text(element); } + +struct bitmap *tree_url_node_get_icon(struct node *node) +{ + struct node_element *element; + element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL); + if (element == NULL) + return NULL; + return tree_node_element_get_icon(element); +} + + void tree_url_node_edit_title(struct tree *tree, struct node *node) { struct node_element *element; @@ -565,12 +578,12 @@ static void tree_url_load_entry(dom_node *li, tree_url_load_ctx *ctx) error = nsurl_create(url2, &url); - free(url2); - if (error != NSERROR_OK) { LOG(("Failed normalising '%s'", url2)); - warn_user("NoMemory", NULL); + free(url2); + + warn_user(messages_get_errorcode(error), NULL); free(title); dom_node_unref(a); @@ -578,6 +591,8 @@ static void tree_url_load_entry(dom_node *li, tree_url_load_ctx *ctx) return; } + free(url2); + data = urldb_get_url_data(url); if (data == NULL) { /* No entry in database, so add one */ @@ -681,6 +696,7 @@ static bool tree_url_load_directory_cb(dom_node *node, void *ctx) dir = tree_create_folder_node(tctx->tree, tctx->directory, title, true, false, false); + free(title); if (dir == NULL) { dom_string_unref(name); return false; diff --git a/desktop/tree_url_node.h b/desktop/tree_url_node.h index 1f0231df1..bcbc19296 100644 --- a/desktop/tree_url_node.h +++ b/desktop/tree_url_node.h @@ -43,6 +43,7 @@ void tree_update_URL_node(struct tree *tree, struct node *node, nsurl *url, const struct url_data *data); const char *tree_url_node_get_title(struct node *node); const char *tree_url_node_get_url(struct node *node); +struct bitmap *tree_url_node_get_icon(struct node *node); void tree_url_node_edit_title(struct tree *tree, struct node *node); void tree_url_node_edit_url(struct tree *tree, struct node *node); diff --git a/desktop/version.c b/desktop/version.c index 262b41fda..11544c01b 100644 --- a/desktop/version.c +++ b/desktop/version.c @@ -1,6 +1,6 @@ #include "utils/testament.h" -const char * const netsurf_version = "3.0 (Dev" +const char * const netsurf_version = "3.1 (Dev" #if defined(CI_BUILD) " CI #" CI_BUILD #endif diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target index 8ab8804b9..bad31ed9d 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 @@ -171,7 +171,7 @@ install-framebuffer: $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES) $(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf$(SUBTARGET) $(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do cp -vL framebuffer/res/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done - $(Q)$(PERL) utils/split-messages.pl en all < resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages + $(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages # ---------------------------------------------------------------------------- # Package target diff --git a/framebuffer/clipboard.c b/framebuffer/clipboard.c index bd9c89dca..46a1bb018 100644 --- a/framebuffer/clipboard.c +++ b/framebuffer/clipboard.c @@ -25,7 +25,6 @@ #include <string.h> #include "desktop/browser.h" #include "desktop/gui.h" -#include "desktop/selection.h" #include "framebuffer/gui.h" #include "utils/log.h" diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c index 987b101c7..87751a39d 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 ff2bfa1ef..60f1b8e5a 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 432c29855..d9e78d7a8 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,44 +476,67 @@ process_cmdline(int argc, char** argv) return true; } -/* Documented in desktop/options.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"); + /* set system colours for framebuffer ui */ + nsoption_set_colour(sys_colour_ActiveBorder, 0x00000000); + nsoption_set_colour(sys_colour_ActiveCaption, 0x00ddddcc); + nsoption_set_colour(sys_colour_AppWorkspace, 0x00eeeeee); + nsoption_set_colour(sys_colour_Background, 0x00aa0000); + nsoption_set_colour(sys_colour_ButtonFace, 0x00dddddd); + nsoption_set_colour(sys_colour_ButtonHighlight, 0x00cccccc); + nsoption_set_colour(sys_colour_ButtonShadow, 0x00bbbbbb); + nsoption_set_colour(sys_colour_ButtonText, 0x00000000); + nsoption_set_colour(sys_colour_CaptionText, 0x00000000); + nsoption_set_colour(sys_colour_GrayText, 0x00777777); + nsoption_set_colour(sys_colour_Highlight, 0x00ee0000); + nsoption_set_colour(sys_colour_HighlightText, 0x00000000); + nsoption_set_colour(sys_colour_InactiveBorder, 0x00000000); + nsoption_set_colour(sys_colour_InactiveCaption, 0x00ffffff); + nsoption_set_colour(sys_colour_InactiveCaptionText, 0x00cccccc); + nsoption_set_colour(sys_colour_InfoBackground, 0x00aaaaaa); + nsoption_set_colour(sys_colour_InfoText, 0x00000000); + nsoption_set_colour(sys_colour_Menu, 0x00aaaaaa); + nsoption_set_colour(sys_colour_MenuText, 0x00000000); + nsoption_set_colour(sys_colour_Scrollbar, 0x00aaaaaa); + nsoption_set_colour(sys_colour_ThreeDDarkShadow, 0x00555555); + nsoption_set_colour(sys_colour_ThreeDFace, 0x00dddddd); + nsoption_set_colour(sys_colour_ThreeDHighlight, 0x00aaaaaa); + nsoption_set_colour(sys_colour_ThreeDLightShadow, 0x00999999); + nsoption_set_colour(sys_colour_ThreeDShadow, 0x00777777); + nsoption_set_colour(sys_colour_Window, 0x00aaaaaa); + nsoption_set_colour(sys_colour_WindowFrame, 0x00000000); + nsoption_set_colour(sys_colour_WindowText, 0x00000000); - framebuffer_set_cursor(&pointer_image); - - if (fb_font_init() == false) - die("Unable to initialise the font system"); + return NSERROR_OK; +} - fbtk = fbtk_init(nsfb); - fbtk_enable_oskb(fbtk); +/** + * Ensures output logging stream is correctly configured + */ +static bool nslog_stream_configure(FILE *fptr) +{ + /* set log stream to be non-buffering */ + setbuf(fptr, NULL); - urldb_load_cookies(nsoption_charp(cookie_file)); + return true; } /** Entry point from OS. @@ -529,29 +552,62 @@ main(int argc, char** argv) char *options; char *messages; nsurl *url; - nserror error; - - setbuf(stderr, NULL); + 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, nsoptions); + free(options); + nsoption_commandline(&argc, argv, nsoptions); + /* common initialisation */ + messages = filepath_find(respaths, "Messages"); + ret = netsurf_init(messages); free(messages); - free(options); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } + + /* 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); - gui_init(argc, argv); + 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, @@ -559,8 +615,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(); @@ -569,6 +625,9 @@ main(int argc, char** argv) netsurf_exit(); + /* finalise options */ + nsoption_finalise(nsoptions, nsoptions_default); + return 0; } @@ -818,6 +877,10 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) case NSFB_EVENT_KEY_DOWN: switch (cbi->event->value.keycode) { + case NSFB_KEY_DELETE: + browser_window_key_press(gw->bw, KEY_DELETE_RIGHT); + break; + case NSFB_KEY_PAGEUP: if (browser_window_key_press(gw->bw, KEY_PAGE_UP) == false) @@ -1397,7 +1460,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 */ @@ -1844,7 +1907,7 @@ gui_drag_save_object(gui_save_type type, } void -gui_drag_save_selection(struct selection *s, struct gui_window *g) +gui_drag_save_selection(struct gui_window *g, const char *selection) { } diff --git a/framebuffer/localhistory.c b/framebuffer/localhistory.c index f6c24a1a4..e23dd1f99 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/options.h b/framebuffer/options.h index 760cc3b51..eee6f4bc6 100644 --- a/framebuffer/options.h +++ b/framebuffer/options.h @@ -1,5 +1,5 @@ /* - * Copyright 2008, 2010 Daniel Silverstone <dsilvers@netsurf-browser.org> + * Copyright 2012 Vincent Sanders <vince@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_face_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/framebuffer/system_colour.c b/framebuffer/system_colour.c deleted file mode 100644 index 18b25eee3..000000000 --- a/framebuffer/system_colour.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 "desktop/options.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 b84b13125..ae67fd7f4 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) @@ -136,7 +136,7 @@ GTK_RESOURCES_LIST := $(addprefix gtk/res/, $(GTK_RESOURCES_LIST)) \ $(wildcard gtk/res/*.gtk*.ui) # translations with more than just Messages files -GTK_TRANSLATIONS_HTML := de en it ja +GTK_TRANSLATIONS_HTML := de en fr it ja nl install-gtk: $(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)throbber @@ -147,7 +147,7 @@ install-gtk: $(Q)install -m 0644 gtk/res/icons/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)/icons $(Q)install -m 0644 gtk/res/throbber/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)/throbber $(Q)tar -c -h -C gtk/res -f - themes | tar -xv -C $(DESTDIR)$(NETSURF_GTK_RESOURCES) -f - - $(Q)tar -c -h -C gtk/res -f - $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(DESTDIR)$(NETSURF_GTK_RESOURCES) -f - + $(Q)tar -c -h -C gtk/res -f - C $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(DESTDIR)$(NETSURF_GTK_RESOURCES) -f - $(call split_install_messages, gtk, $(DESTDIR)$(NETSURF_GTK_RESOURCES)) # ---------------------------------------------------------------------------- diff --git a/gtk/bitmap.c b/gtk/bitmap.c index 0f89c6748..96e9edaee 100644 --- a/gtk/bitmap.c +++ b/gtk/bitmap.c @@ -185,11 +185,56 @@ bool bitmap_get_opaque(void *vbitmap) unsigned char *bitmap_get_buffer(void *vbitmap) { struct bitmap *gbitmap = (struct bitmap *)vbitmap; + int pixel_loop; + int pixel_count; + uint32_t *pixels; + uint32_t pixel; + cairo_format_t fmt; + assert(gbitmap); cairo_surface_flush(gbitmap->surface); + pixels = (uint32_t *)cairo_image_surface_get_data(gbitmap->surface); + + if (!gbitmap->converted) + return (unsigned char *) pixels; + + fmt = cairo_image_surface_get_format(gbitmap->surface); + pixel_count = cairo_image_surface_get_width(gbitmap->surface) * + cairo_image_surface_get_height(gbitmap->surface); + + if (fmt == CAIRO_FORMAT_RGB24) { + for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) { + pixel = pixels[pixel_loop]; + pixels[pixel_loop] = (pixel & 0xff00ff00) | + ((pixel & 0xff) << 16) | + ((pixel & 0xff0000) >> 16); + } + } else { + uint32_t t, r, g, b; + for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) { + pixel = pixels[pixel_loop]; + t = (pixel & 0xff000000) >> 24; + if (t == 0) { + pixels[pixel_loop] = 0; + } else { + r = ((pixel & 0xff0000) >> 8) / t; + g = ((pixel & 0xff00)) / t; + b = ((pixel & 0xff) << 8) / t; + + r = (r > 255) ? 255 : r; + g = (g > 255) ? 255 : g; + b = (b > 255) ? 255 : b; + + pixels[pixel_loop] = (t << 24) | + (r) | (g << 8) | (b << 16); + } + } + } + + gbitmap->converted = false; - return cairo_image_surface_get_data(gbitmap->surface); + return (unsigned char *) pixels; } @@ -286,6 +331,11 @@ void bitmap_modified(void *vbitmap) { cairo_image_surface_get_height(gbitmap->surface); pixels = (uint32_t *)cairo_image_surface_get_data(gbitmap->surface); + if (gbitmap->converted) { + cairo_surface_mark_dirty(gbitmap->surface); + return; + } + if (fmt == CAIRO_FORMAT_RGB24) { for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) { pixel = pixels[pixel_loop]; diff --git a/gtk/completion.c b/gtk/completion.c index d249db160..a0df08ad9 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 2d787e6dc..0669f8d9f 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" @@ -45,6 +45,7 @@ struct ppref { GtkEntry *entryProxyHost; GtkEntry *entryProxyUser; GtkEntry *entryProxyPassword; + GtkEntry *entryProxyNoproxy; GtkSpinButton *spinProxyPort; /* dynamic list stores */ @@ -200,6 +201,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv) gboolean port; gboolean user; gboolean pass; + gboolean noproxy; switch (proxyval) { case 0: /* no proxy */ @@ -207,6 +209,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv) port = FALSE; user = FALSE; pass = FALSE; + noproxy = FALSE; break; case 1: /* proxy with no auth */ @@ -214,6 +217,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv) port = TRUE; user = FALSE; pass = FALSE; + noproxy = TRUE; break; case 2: /* proxy with basic auth */ @@ -221,6 +225,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv) port = TRUE; user = TRUE; pass = TRUE; + noproxy = TRUE; break; case 3: /* proxy with ntlm auth */ @@ -228,6 +233,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv) port = TRUE; user = TRUE; pass = TRUE; + noproxy = TRUE; break; case 4: /* system proxy */ @@ -235,6 +241,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv) port = FALSE; user = FALSE; pass = FALSE; + noproxy = FALSE; break; default: @@ -245,6 +252,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv) gtk_widget_set_sensitive(GTK_WIDGET(priv->spinProxyPort), port); gtk_widget_set_sensitive(GTK_WIDGET(priv->entryProxyUser), user); gtk_widget_set_sensitive(GTK_WIDGET(priv->entryProxyPassword), pass); + gtk_widget_set_sensitive(GTK_WIDGET(priv->entryProxyNoproxy), noproxy); } @@ -322,6 +330,9 @@ ENTRY_SIGNALS(entryProxyUser, http_proxy_auth_user) /* password */ ENTRY_SIGNALS(entryProxyPassword, http_proxy_auth_pass) +/* no proxy */ +ENTRY_SIGNALS(entryProxyNoproxy, http_proxy_noproxy) + /* Fetching */ /* maximum fetchers */ @@ -374,7 +385,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) @@ -669,54 +680,66 @@ nsgtk_preferences_buttonAddTheme_clicked(GtkButton *button, struct ppref *priv) { char *filename, *directory; size_t len; - GtkWidget *fc = gtk_file_chooser_dialog_new( - messages_get("gtkAddThemeTitle"), - GTK_WINDOW(priv->dialog), - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); + GtkWidget *fc; + char *themesfolder; + gint res; + + fc = gtk_file_chooser_dialog_new(messages_get("gtkAddThemeTitle"), + GTK_WINDOW(priv->dialog), + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); len = SLEN("themes") + strlen(res_dir_location) + 1; - char themesfolder[len]; + + themesfolder = malloc(len); + snprintf(themesfolder, len, "%sthemes", res_dir_location); - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc), - themesfolder); - gint res = gtk_dialog_run(GTK_DIALOG(fc)); + + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc), themesfolder); + + res = gtk_dialog_run(GTK_DIALOG(fc)); if (res == GTK_RESPONSE_ACCEPT) { - filename = gtk_file_chooser_get_current_folder( - GTK_FILE_CHOOSER(fc)); - if (strcmp(filename, themesfolder) != 0) { - directory = strrchr(filename, '/'); - *directory = '\0'; + filename = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(fc)); + if (filename != NULL) { if (strcmp(filename, themesfolder) != 0) { - warn_user(messages_get( - "gtkThemeFolderInstructions"), - 0); - gtk_widget_destroy(GTK_WIDGET(fc)); - if (filename != NULL) - g_free(filename); - return; + directory = strrchr(filename, '/'); + *directory = '\0'; + if (strcmp(filename, themesfolder) != 0) { + warn_user(messages_get( + "gtkThemeFolderInstructions"), + 0); + + if (filename != NULL) + g_free(filename); + + } else { + directory++; + nsgtk_theme_add(directory); + } } else { - directory++; - } - } else { - if (filename != NULL) - g_free(filename); - filename = gtk_file_chooser_get_filename( - GTK_FILE_CHOOSER(fc)); - if (strcmp(filename, themesfolder) == 0) { - warn_user(messages_get("gtkThemeFolderSub"), - 0); - gtk_widget_destroy(GTK_WIDGET(fc)); g_free(filename); - return; + + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)); + + if (strcmp(filename, themesfolder) == 0) { + warn_user(messages_get("gtkThemeFolderSub"), + 0); + } else { + directory = strrchr(filename, '/') + 1; + nsgtk_theme_add(directory); + } } - directory = strrchr(filename, '/') + 1; - } - gtk_widget_destroy(GTK_WIDGET(fc)); - nsgtk_theme_add(directory); - if (filename != NULL) + g_free(filename); + } } + + free(themesfolder); + + gtk_widget_destroy(fc); } /* Tabs */ @@ -987,7 +1010,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)); } } @@ -996,7 +1019,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 @@ -1007,7 +1030,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); } @@ -1057,6 +1080,7 @@ GtkWidget* nsgtk_preferences(struct browser_window *bw, GtkWindow *parent) priv->spinProxyPort = GB(SPIN_BUTTON, spinProxyPort); priv->entryProxyUser = GB(ENTRY, entryProxyUser); priv->entryProxyPassword = GB(ENTRY, entryProxyPassword); + priv->entryProxyNoproxy = GB(ENTRY, entryProxyNoproxy); #undef GB /* connect all signals ready to use */ diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c index 9f9fa22db..ef4e36eb3 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" @@ -42,7 +42,6 @@ #include "render/font.h" #include "content/content.h" #include "content/content_type.h" -#include "render/textplain.h" #include "utils/log.h" diff --git a/gtk/download.c b/gtk/download.c index 71b1aa633..e882ec798 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 de115fa64..6c7f1592f 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, @@ -253,7 +253,7 @@ bool nsfont_paint(int x, int y, const char *string, size_t length, pango_layout_set_text(layout, string, length); line = pango_layout_get_line(layout, 0); - cairo_move_to(current_cr, x, y + 0.5); + cairo_move_to(current_cr, x, y); nsgtk_set_colour(fstyle->foreground); pango_cairo_show_layout_line(current_cr, line); @@ -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,8 +241,13 @@ nsgtk_init_glade(char **respath) widWarning = GTK_WIDGET(gtk_builder_get_object(gladeWarning, "labelWarning")); } -/* Documented in desktop/options.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,18 @@ 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")); + + return NSERROR_OK; } static void check_options(char **respath) @@ -292,8 +309,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 */ @@ -308,15 +325,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 +363,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) || @@ -515,12 +520,24 @@ static void nsgtk_check_homedir(void) } /** + * Ensures output logging stream is correctly configured + */ +static bool nslog_stream_configure(FILE *fptr) +{ + /* set log stream to be non-buffering */ + setbuf(fptr, NULL); + + return true; +} + +/** * Main entry point from OS. */ int main(int argc, char** argv) { char *messages; char *options; + nserror ret; /* check home directory is available */ nsgtk_check_homedir(); @@ -529,25 +546,48 @@ int main(int argc, char** argv) gtk_init(&argc, &argv); - /* set standard error to be non-buffering */ - setbuf(stderr, NULL); - + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(nslog_stream_configure, &argc, argv); + + /* user options setup */ + ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + fprintf(stderr, "Options failed to initialise (%s)\n", + messages_get_errorcode(ret)); + return 1; + } options = filepath_find(respaths, "Choices"); - messages = filepath_find(respaths, "Messages"); - - netsurf_init(&argc, &argv, options, messages); + nsoption_read(options, nsoptions); + free(options); + nsoption_commandline(&argc, argv, nsoptions); + 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) { + fprintf(stderr, "NetSurf core failed to initialise (%s)\n", + messages_get_errorcode(ret)); + return 1; + } + /* 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(); + /* finalise options */ + nsoption_finalise(nsoptions, nsoptions_default); + return 0; } diff --git a/gtk/hotlist.c b/gtk/hotlist.c index d7b5b9e8f..d249d3444 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/options.h b/gtk/options.h index 795eca91d..612809eac 100644 --- a/gtk/options.h +++ b/gtk/options.h @@ -1,5 +1,5 @@ /* - * Copyright 2006 Rob Kendrick <rjek@rjek.com> + * Copyright 2012 Vincent Sanders <vince@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/gtk/plotters.c b/gtk/plotters.c index 3af55b9d5..265061188 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 02d89bbdb..68a96dc2d 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/res/C/Messages b/gtk/res/C/Messages new file mode 120000 index 000000000..72c9eff90 --- /dev/null +++ b/gtk/res/C/Messages @@ -0,0 +1 @@ +../../../!NetSurf/Resources/en/Messages
\ No newline at end of file diff --git a/gtk/res/C/credits.html b/gtk/res/C/credits.html new file mode 120000 index 000000000..1ba17392b --- /dev/null +++ b/gtk/res/C/credits.html @@ -0,0 +1 @@ +../../../!NetSurf/Resources/en/credits.html,faf
\ No newline at end of file diff --git a/gtk/res/C/licence.html b/gtk/res/C/licence.html new file mode 120000 index 000000000..147dd6db2 --- /dev/null +++ b/gtk/res/C/licence.html @@ -0,0 +1 @@ +../../../!NetSurf/Resources/en/licence.html,faf
\ No newline at end of file diff --git a/gtk/res/C/welcome.html b/gtk/res/C/welcome.html new file mode 120000 index 000000000..28362130a --- /dev/null +++ b/gtk/res/C/welcome.html @@ -0,0 +1 @@ +../../../!NetSurf/Resources/en/welcome.html,faf
\ No newline at end of file diff --git a/gtk/res/cookies.gtk3.ui b/gtk/res/cookies.gtk3.ui index 3ccc04bce..44dcb80b8 100644 --- a/gtk/res/cookies.gtk3.ui +++ b/gtk/res/cookies.gtk3.ui @@ -188,6 +188,7 @@ <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> + <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property> </object> </child> </object> diff --git a/gtk/res/hotlist.gtk3.ui b/gtk/res/hotlist.gtk3.ui index 78a81672b..b0e075c4b 100644 --- a/gtk/res/hotlist.gtk3.ui +++ b/gtk/res/hotlist.gtk3.ui @@ -237,6 +237,7 @@ <object class="GtkDrawingArea" id="hotlistDrawingArea"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property> </object> </child> </object> diff --git a/gtk/res/options.gtk2.ui b/gtk/res/options.gtk2.ui index 85db837b8..5e24f8942 100644 --- a/gtk/res/options.gtk2.ui +++ b/gtk/res/options.gtk2.ui @@ -4,7 +4,7 @@ <!-- interface-naming-policy project-wide --> <object class="GtkDialog" id="dialogPreferences"> <property name="border_width">5</property> - <property name="title" translatable="yes">Netsurf Preferences</property> + <property name="title" translatable="yes">preferencesTitle</property> <property name="window_position">center-on-parent</property> <property name="destroy_with_parent">True</property> <property name="type_hint">dialog</property> @@ -49,7 +49,7 @@ <child> <object class="GtkLabel" id="label_startup_page"> <property name="visible">True</property> - <property name="label" translatable="yes">Page:</property> + <property name="label" translatable="yes">preferencesStartupPage</property> </object> <packing> <property name="expand">False</property> @@ -84,7 +84,7 @@ </child> <child> <object class="GtkButton" id="setCurrentPage"> - <property name="label" translatable="yes">Use Current Page</property> + <property name="label" translatable="yes">preferencesStartupPageCurrent</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -99,7 +99,7 @@ </child> <child> <object class="GtkButton" id="setDefaultPage"> - <property name="label" translatable="yes">Use Default Page</property> + <property name="label" translatable="yes">preferencesStartupPageDefault</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -125,7 +125,7 @@ <child type="label"> <object class="GtkLabel" id="label_main_startup"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Startup</b></property> + <property name="label" translatable="yes">preferencesStartup</property> <property name="use_markup">True</property> </object> </child> @@ -154,7 +154,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkUrlSearch"> - <property name="label" translatable="yes">Search from URL bar</property> + <property name="label" translatable="yes">preferencesSearchURLBar</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -173,7 +173,7 @@ <child> <object class="GtkLabel" id="label5"> <property name="visible">True</property> - <property name="label" translatable="yes">Provider:</property> + <property name="label" translatable="yes">preferencesSearchProvider</property> </object> <packing> <property name="expand">False</property> @@ -210,7 +210,7 @@ <child type="label"> <object class="GtkLabel" id="label4"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Search</b></property> + <property name="label" translatable="yes">preferencesSearch</property> <property name="use_markup">True</property> </object> </child> @@ -239,7 +239,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkClearDownloads"> - <property name="label" translatable="yes">Remove download from list when complete</property> + <property name="label" translatable="yes">preferencesDownloadsRemove</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -254,7 +254,7 @@ </child> <child> <object class="GtkCheckButton" id="checkRequestOverwrite"> - <property name="label" translatable="yes">Confirm before overwriting files</property> + <property name="label" translatable="yes">preferencesDownloadsConfirm</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -274,7 +274,7 @@ <child> <object class="GtkLabel" id="label8"> <property name="visible">True</property> - <property name="label" translatable="yes">Location:</property> + <property name="label" translatable="yes">preferencesDownloadsLocation</property> </object> <packing> <property name="expand">False</property> @@ -305,7 +305,7 @@ <child type="label"> <object class="GtkLabel" id="label7"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Downloads</b></property> + <property name="label" translatable="yes">preferencesDownloads</property> <property name="use_markup">True</property> </object> </child> @@ -321,7 +321,7 @@ <child type="tab"> <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="label" translatable="yes">Main</property> + <property name="label" translatable="yes">preferencesMainTabtitle</property> </object> <packing> <property name="tab_fill">False</property> @@ -366,7 +366,7 @@ </child> <child> <object class="GtkButton" id="buttonAddTheme"> - <property name="label" translatable="yes">Add Theme...</property> + <property name="label" translatable="yes">preferencesThemesAdd</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -385,7 +385,7 @@ <child type="label"> <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Themes</b></property> + <property name="label" translatable="yes">preferencesThemes</property> <property name="use_markup">True</property> </object> </child> @@ -414,7 +414,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkShowSingleTab"> - <property name="label" translatable="yes">Always show tab bar</property> + <property name="label" translatable="yes">preferencesTabsAlways</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -428,7 +428,7 @@ </child> <child> <object class="GtkCheckButton" id="checkFocusNew"> - <property name="label" translatable="yes">Switch to newly opened tabs immediately</property> + <property name="label" translatable="yes">preferencesTabsSwitch</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -442,7 +442,7 @@ </child> <child> <object class="GtkCheckButton" id="checkNewBlank"> - <property name="label" translatable="yes">Newly opened tabs are blank</property> + <property name="label" translatable="yes">preferencesTabsNewly</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -461,7 +461,7 @@ <child> <object class="GtkLabel" id="label9"> <property name="visible">True</property> - <property name="label" translatable="yes">Position:</property> + <property name="label" translatable="yes">preferencesTabsPosition</property> </object> <packing> <property name="expand">False</property> @@ -498,7 +498,7 @@ <child type="label"> <object class="GtkLabel" id="label6"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Tabs</b></property> + <property name="label" translatable="yes">preferencesTabs</property> <property name="use_markup">True</property> </object> </child> @@ -529,7 +529,7 @@ <object class="GtkLabel" id="label13"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Open source view in new:</property> + <property name="label" translatable="yes">preferencesSourceOpen</property> </object> <packing> <property name="position">0</property> @@ -540,7 +540,7 @@ <property name="visible">True</property> <child> <object class="GtkRadioButton" id="sourceButtonWindow"> - <property name="label" translatable="yes">window</property> + <property name="label" translatable="yes">preferencesSourceWindow</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -556,7 +556,7 @@ </child> <child> <object class="GtkRadioButton" id="sourceButtonTab"> - <property name="label" translatable="yes">tab</property> + <property name="label" translatable="yes">preferencesSourceTab</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -581,7 +581,7 @@ <child type="label"> <object class="GtkLabel" id="label12"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Source</b></property> + <property name="label" translatable="yes">preferencesSource</property> <property name="use_markup">True</property> </object> </child> @@ -610,7 +610,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkDisplayRecentURLs"> - <property name="label" translatable="yes">Display recently visited URLs as you type</property> + <property name="label" translatable="yes">preferencesURLbarDisplay</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -629,7 +629,7 @@ <child type="label"> <object class="GtkLabel" id="label14"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>URLbar</b></property> + <property name="label" translatable="yes">preferencesURLbar</property> <property name="use_markup">True</property> </object> </child> @@ -663,7 +663,7 @@ <child> <object class="GtkLabel" id="label16"> <property name="visible">True</property> - <property name="label" translatable="yes">Buttons:</property> + <property name="label" translatable="yes">preferencesToolbarButtons</property> </object> <packing> <property name="expand">False</property> @@ -699,7 +699,7 @@ <child type="label"> <object class="GtkLabel" id="label15"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Toolbar</b></property> + <property name="label" translatable="yes">preferencesToolbar</property> <property name="use_markup">True</property> </object> </child> @@ -718,7 +718,7 @@ <child type="tab"> <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="label" translatable="yes">Appearance</property> + <property name="label" translatable="yes">preferencesAppearanceTabtitle</property> </object> <packing> <property name="position">1</property> @@ -748,7 +748,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkDisablePopups"> - <property name="label" translatable="yes">Prevent pop-up windows</property> + <property name="label" translatable="yes">preferencesControlPrevent</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -764,7 +764,7 @@ </child> <child> <object class="GtkCheckButton" id="checkHideAdverts"> - <property name="label" translatable="yes">Hide Adverts</property> + <property name="label" translatable="yes">preferencesControlHide</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -780,7 +780,7 @@ </child> <child> <object class="GtkCheckButton" id="checkEnableJavascript"> - <property name="label" translatable="yes">Enable JavaScript</property> + <property name="label" translatable="yes">preferencesControlEnable</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -796,7 +796,7 @@ </child> <child> <object class="GtkCheckButton" id="checkDisablePlugins"> - <property name="label" translatable="yes">Disable plug-ins</property> + <property name="label" translatable="yes">preferencesControlDisable</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -812,7 +812,7 @@ </child> <child> <object class="GtkCheckButton" id="checkResampleImages"> - <property name="label" translatable="yes">High quality image scaling</property> + <property name="label" translatable="yes">preferencesControlHigh</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -831,7 +831,7 @@ <child> <object class="GtkLabel" id="label17"> <property name="visible">True</property> - <property name="label" translatable="yes">Load and display</property> + <property name="label" translatable="yes">preferencesControlLoad</property> </object> <packing> <property name="expand">False</property> @@ -867,7 +867,7 @@ <child type="label"> <object class="GtkLabel" id="label11"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Control</b></property> + <property name="label" translatable="yes">preferencesControl</property> <property name="use_markup">True</property> </object> </child> @@ -896,7 +896,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkEnableAnimations"> - <property name="label" translatable="yes">Enable</property> + <property name="label" translatable="yes">preferencesAnimationEnable</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -915,7 +915,7 @@ <child> <object class="GtkLabel" id="label19"> <property name="visible">True</property> - <property name="label" translatable="yes">Minimum time between frames:</property> + <property name="label" translatable="yes">preferencesAnimationMinimum</property> </object> <packing> <property name="expand">False</property> @@ -927,7 +927,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Do not update animations any more often than this.</property> + <property name="tooltip_text" translatable="yes">preferencesAnimationMinimumTooltip</property> <property name="invisible_char">●</property> <property name="adjustment">adjustment_animation_time</property> <property name="climb_rate">1</property> @@ -954,7 +954,7 @@ <child type="label"> <object class="GtkLabel" id="label18"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Animation</b></property> + <property name="label" translatable="yes">preferencesAnimation</property> <property name="use_markup">True</property> </object> </child> @@ -987,7 +987,7 @@ <child> <object class="GtkLabel" id="label26"> <property name="visible">True</property> - <property name="label" translatable="yes">Default</property> + <property name="label" translatable="yes">preferencesFontsDefault</property> </object> <packing> <property name="expand">False</property> @@ -1023,7 +1023,7 @@ <child> <object class="GtkLabel" id="label27"> <property name="visible">True</property> - <property name="label" translatable="yes">Size</property> + <property name="label" translatable="yes">preferencesFontsSize</property> </object> <packing> <property name="expand">False</property> @@ -1035,7 +1035,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">The base-line font size to use.</property> + <property name="tooltip_text" translatable="yes">preferencesFontsSizeTooltip</property> <property name="max_length">4</property> <property name="invisible_char">●</property> <property name="width_chars">4</property> @@ -1059,7 +1059,7 @@ </child> <child> <object class="GtkButton" id="fontPreview"> - <property name="label" translatable="yes">_Preview</property> + <property name="label" translatable="yes">preferencesFontsPreview</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -1079,7 +1079,7 @@ <child type="label"> <object class="GtkLabel" id="label20"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Fonts</b></property> + <property name="label" translatable="yes">preferencesFonts</property> <property name="use_markup">True</property> </object> </child> @@ -1112,7 +1112,7 @@ <child> <object class="GtkLabel" id="label21"> <property name="visible">True</property> - <property name="label" translatable="yes">Preferred language:</property> + <property name="label" translatable="yes">preferencesLanguagePreferred</property> </object> <packing> <property name="expand">False</property> @@ -1123,7 +1123,7 @@ <object class="GtkComboBox" id="comboboxLanguage"> <property name="visible">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">set preferred language for web pages</property> + <property name="tooltip_text" translatable="yes">preferencesLanguagePreferredTooltip</property> <property name="model">liststore_content_language</property> <signal name="changed" handler="nsgtk_preferences_comboboxLanguage_changed"/> <signal name="realize" handler="nsgtk_preferences_comboboxLanguage_realize"/> @@ -1160,7 +1160,7 @@ <child type="label"> <object class="GtkLabel" id="label25"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Language</b></property> + <property name="label" translatable="yes">preferencesLanguage</property> <property name="use_markup">True</property> </object> </child> @@ -1178,7 +1178,7 @@ <child type="tab"> <object class="GtkLabel" id="label10"> <property name="visible">True</property> - <property name="label" translatable="yes">Content</property> + <property name="label" translatable="yes">preferencesContentTabtitle</property> </object> <packing> <property name="position">2</property> @@ -1208,7 +1208,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkSendReferer"> - <property name="label" translatable="yes">Enable referral submission</property> + <property name="label" translatable="yes">preferencesGeneralReferral</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -1222,7 +1222,7 @@ </child> <child> <object class="GtkCheckButton" id="checkSendDNT"> - <property name="label" translatable="yes">Enable sending "Do Not Track" request</property> + <property name="label" translatable="yes">preferencesGeneralDNT</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -1241,7 +1241,7 @@ <child type="label"> <object class="GtkLabel" id="label61"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>General</b></property> + <property name="label" translatable="yes">preferencesGeneral</property> <property name="use_markup">True</property> </object> </child> @@ -1270,7 +1270,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkHoverURLs"> - <property name="label" translatable="yes">Local history shows URL in tooltip</property> + <property name="label" translatable="yes">preferencesHistoryShow</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -1289,7 +1289,7 @@ <child> <object class="GtkLabel" id="label28"> <property name="visible">True</property> - <property name="label" translatable="yes">Remember browsing history for up to</property> + <property name="label" translatable="yes">preferencesHistoryRemember</property> </object> <packing> <property name="expand">False</property> @@ -1318,7 +1318,7 @@ <child> <object class="GtkLabel" id="label29"> <property name="visible">True</property> - <property name="label" translatable="yes">days</property> + <property name="label" translatable="yes">preferencesHistoryDays</property> </object> <packing> <property name="expand">False</property> @@ -1337,7 +1337,7 @@ <child type="label"> <object class="GtkLabel" id="label23"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>History</b></property> + <property name="label" translatable="yes">preferencesHistory</property> <property name="use_markup">True</property> </object> </child> @@ -1375,7 +1375,7 @@ <object class="GtkLabel" id="label30"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Memory cache size</property> + <property name="label" translatable="yes">preferencesCacheMemory</property> </object> <packing> <property name="x_options">GTK_FILL</property> @@ -1385,7 +1385,7 @@ <object class="GtkLabel" id="label31"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Disc cache size</property> + <property name="label" translatable="yes">preferencesCacheDisc</property> </object> <packing> <property name="top_attach">1</property> @@ -1397,7 +1397,7 @@ <object class="GtkLabel" id="label34"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Expire cache entries after</property> + <property name="label" translatable="yes">preferencesCacheExpire</property> </object> <packing> <property name="top_attach">2</property> @@ -1467,7 +1467,7 @@ <object class="GtkLabel" id="label32"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">MB</property> + <property name="label" translatable="no">MB</property> </object> <packing> <property name="left_attach">2</property> @@ -1479,7 +1479,7 @@ <object class="GtkLabel" id="label33"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">MB</property> + <property name="label" translatable="no">MB</property> </object> <packing> <property name="left_attach">2</property> @@ -1493,7 +1493,7 @@ <object class="GtkLabel" id="label35"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">days</property> + <property name="label" translatable="yes">preferencesHistoryDays</property> </object> <packing> <property name="left_attach">2</property> @@ -1516,7 +1516,7 @@ </child> <child> <object class="GtkButton" id="buttonCacheMaintinance"> - <property name="label" translatable="yes">Maintinance</property> + <property name="label" translatable="yes">preferencesCacheMaintinance</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -1538,7 +1538,7 @@ <child type="label"> <object class="GtkLabel" id="label24"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Cache</b></property> + <property name="label" translatable="yes">preferencesCache</property> <property name="use_markup">True</property> </object> </child> @@ -1557,7 +1557,7 @@ <child type="tab"> <object class="GtkLabel" id="label22"> <property name="visible">True</property> - <property name="label" translatable="yes">Privacy</property> + <property name="label" translatable="yes">preferencesPrivacyTabtitle</property> </object> <packing> <property name="position">3</property> @@ -1591,7 +1591,7 @@ <object class="GtkLabel" id="label42"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Proxy type</property> + <property name="label" translatable="yes">preferencesProxyType</property> </object> <packing> <property name="x_options">GTK_FILL</property> @@ -1601,7 +1601,7 @@ <object class="GtkLabel" id="label43"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Host</property> + <property name="label" translatable="yes">preferencesProxyHost</property> </object> <packing> <property name="top_attach">1</property> @@ -1613,7 +1613,7 @@ <object class="GtkLabel" id="label44"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Username</property> + <property name="label" translatable="yes">preferencesProxyUsername</property> </object> <packing> <property name="top_attach">2</property> @@ -1625,7 +1625,7 @@ <object class="GtkLabel" id="label45"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Password</property> + <property name="label" translatable="yes">preferencesProxyPassword</property> </object> <packing> <property name="top_attach">3</property> @@ -1637,7 +1637,7 @@ <object class="GtkComboBox" id="comboProxyType"> <property name="visible">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">The type of HTTP proxy server.</property> + <property name="tooltip_text" translatable="yes">preferencesProxyTypeTooltip</property> <property name="model">liststore_proxy_type</property> <signal name="changed" handler="nsgtk_preferences_comboProxyType_changed"/> <signal name="realize" handler="nsgtk_preferences_comboProxyType_realize"/> @@ -1662,7 +1662,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Host name of your proxy server.</property> + <property name="tooltip_text" translatable="yes">preferencesProxyHostTooltip</property> <property name="invisible_char">●</property> <signal name="changed" handler="nsgtk_preferences_entryProxyHost_changed"/> <signal name="realize" handler="nsgtk_preferences_entryProxyHost_realize"/> @@ -1674,7 +1674,7 @@ <child> <object class="GtkLabel" id="label46"> <property name="visible">True</property> - <property name="label" translatable="yes">:</property> + <property name="label" translatable="no">:</property> </object> <packing> <property name="expand">False</property> @@ -1686,7 +1686,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Port number to connect to on proxy server.</property> + <property name="tooltip_text" translatable="yes">preferencesProxyPortTooltip</property> <property name="max_length">5</property> <property name="invisible_char">●</property> <property name="width_chars">5</property> @@ -1715,7 +1715,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Username to access the proxy</property> + <property name="tooltip_text" translatable="yes">preferencesProxyUsernameTooltip</property> <property name="invisible_char">●</property> <signal name="changed" handler="nsgtk_preferences_entryProxyUser_changed"/> <signal name="realize" handler="nsgtk_preferences_entryProxyUser_realize"/> @@ -1732,7 +1732,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Password to access the proxy</property> + <property name="tooltip_text" translatable="yes">preferencesProxyPasswordTooltip</property> <property name="visibility">False</property> <property name="invisible_char">●</property> <signal name="changed" handler="nsgtk_preferences_entryProxyPassword_changed"/> @@ -1752,7 +1752,7 @@ <child type="label"> <object class="GtkLabel" id="label37"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>HTTP Proxy</b></property> + <property name="label" translatable="yes">preferencesProxy</property> <property name="use_markup">True</property> </object> </child> @@ -1785,7 +1785,7 @@ <object class="GtkLabel" id="label39"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Maximum fetchers</property> + <property name="label" translatable="yes">preferencesFetchingMax</property> </object> <packing> <property name="x_options">GTK_FILL</property> @@ -1795,7 +1795,7 @@ <object class="GtkLabel" id="label40"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Fetches per host</property> + <property name="label" translatable="yes">preferencesFetchingPerhost</property> </object> <packing> <property name="top_attach">1</property> @@ -1807,7 +1807,7 @@ <object class="GtkLabel" id="label41"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Cached connections</property> + <property name="label" translatable="yes">preferencesFetchingCached</property> </object> <packing> <property name="top_attach">2</property> @@ -1820,7 +1820,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Maximum number of concurrent items to fetch at once.</property> + <property name="tooltip_text" translatable="yes">preferencesFetchingMaxTooltip</property> <property name="invisible_char">●</property> <property name="width_chars">3</property> <property name="adjustment">adjustment_fetching_max</property> @@ -1840,7 +1840,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Maximum number of item fetches per web server.</property> + <property name="tooltip_text" translatable="yes">preferencesFetchingPerhostTooltip</property> <property name="invisible_char">●</property> <property name="width_chars">3</property> <property name="adjustment">adjustment_fetching_perhost</property> @@ -1862,7 +1862,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Number of connections to keep in case they are needed again.</property> + <property name="tooltip_text" translatable="yes">preferencesFetchingCachedTooltip.</property> <property name="invisible_char">●</property> <property name="width_chars">3</property> <property name="adjustment">adjustment_fetching_cached</property> @@ -1886,7 +1886,7 @@ <child type="label"> <object class="GtkLabel" id="label38"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Fetching</b></property> + <property name="label" translatable="yes">preferencesFetching</property> <property name="use_markup">True</property> </object> </child> @@ -1905,7 +1905,7 @@ <child type="tab"> <object class="GtkLabel" id="label36"> <property name="visible">True</property> - <property name="label" translatable="yes">Network</property> + <property name="label" translatable="yes">preferencesNetworkTabtitle</property> </object> <packing> <property name="position">4</property> @@ -1935,7 +1935,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkSuppressImages"> - <property name="label" translatable="yes">No images in output</property> + <property name="label" translatable="yes">preferencesAppearanceImages</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -1949,7 +1949,7 @@ </child> <child> <object class="GtkCheckButton" id="checkRemoveBackgrounds"> - <property name="label" translatable="yes">No background images in output</property> + <property name="label" translatable="yes">preferencesAppearanceBackground</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -1963,7 +1963,7 @@ </child> <child> <object class="GtkCheckButton" id="checkFitPage"> - <property name="label" translatable="yes">Scale output to fit page</property> + <property name="label" translatable="yes">preferencesAppearanceScalefit</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -1982,7 +1982,7 @@ <child> <object class="GtkLabel" id="label59"> <property name="visible">True</property> - <property name="label" translatable="yes">Scale output</property> + <property name="label" translatable="yes">preferencesAppearanceScale</property> </object> <packing> <property name="expand">False</property> @@ -2011,7 +2011,7 @@ <child> <object class="GtkLabel" id="label60"> <property name="visible">True</property> - <property name="label" translatable="yes">%</property> + <property name="label" translatable="no">%</property> </object> <packing> <property name="expand">False</property> @@ -2030,7 +2030,7 @@ <child type="label"> <object class="GtkLabel" id="label48"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Appearance</b></property> + <property name="label" translatable="yes">preferencesAppearance</property> <property name="use_markup">True</property> </object> </child> @@ -2063,7 +2063,7 @@ <child> <object class="GtkLabel" id="label62"> <property name="visible">True</property> - <property name="label" translatable="yes">measurements in mm</property> + <property name="label" translatable="yes">preferencesMarginsMeasurements</property> </object> <packing> <property name="expand">False</property> @@ -2275,7 +2275,7 @@ <child type="label"> <object class="GtkLabel" id="label49"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Margins</b></property> + <property name="label" translatable="yes">preferencesMargins</property> <property name="use_markup">True</property> </object> </child> @@ -2304,7 +2304,7 @@ <property name="spacing">7</property> <child> <object class="GtkCheckButton" id="checkCompressPDF"> - <property name="label" translatable="yes">Output is compressed</property> + <property name="label" translatable="yes">preferencesGenerationCompressed</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -2318,7 +2318,7 @@ </child> <child> <object class="GtkCheckButton" id="checkPasswordPDF"> - <property name="label" translatable="yes">Output has a password</property> + <property name="label" translatable="yes">preferencesGenerationPassword</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -2337,7 +2337,7 @@ <child type="label"> <object class="GtkLabel" id="label50"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Generation</b></property> + <property name="label" translatable="yes">preferencesGeneration</property> <property name="use_markup">True</property> </object> </child> @@ -2356,7 +2356,7 @@ <child type="tab"> <object class="GtkLabel" id="label47"> <property name="visible">True</property> - <property name="label" translatable="yes">PDF</property> + <property name="label" translatable="yes">preferencesPDFTabtitle</property> </object> <packing> <property name="position">5</property> @@ -2421,67 +2421,67 @@ </columns> <data> <row> - <col id="0" translatable="yes">Google</col> + <col id="0" translatable="no">Google</col> </row> <row> - <col id="0" translatable="yes">Yahoo!</col> + <col id="0" translatable="no">Yahoo!</col> </row> <row> - <col id="0" translatable="yes">Microsoft Live</col> + <col id="0" translatable="no">Microsoft Live</col> </row> <row> - <col id="0" translatable="yes">Buisiness.com</col> + <col id="0" translatable="no">Buisiness.com</col> </row> <row> - <col id="0" translatable="yes">Omgili</col> + <col id="0" translatable="no">Omgili</col> </row> <row> - <col id="0" translatable="yes">BBC News</col> + <col id="0" translatable="no">BBC News</col> </row> <row> - <col id="0" translatable="yes">Ubuntu Packages</col> + <col id="0" translatable="no">Ubuntu Packages</col> </row> <row> - <col id="0" translatable="yes">Creative Commons</col> + <col id="0" translatable="no">Creative Commons</col> </row> <row> - <col id="0" translatable="yes">Ask</col> + <col id="0" translatable="no">Ask</col> </row> <row> - <col id="0" translatable="yes">Answers</col> + <col id="0" translatable="no">Answers</col> </row> <row> - <col id="0" translatable="yes">Dictionary.com</col> + <col id="0" translatable="no">Dictionary.com</col> </row> <row> - <col id="0" translatable="yes">YouTube</col> + <col id="0" translatable="no">YouTube</col> </row> <row> - <col id="0" translatable="yes">AeroMP3</col> + <col id="0" translatable="no">AeroMP3</col> </row> <row> - <col id="0" translatable="yes">AOL</col> + <col id="0" translatable="no">AOL</col> </row> <row> - <col id="0" translatable="yes">Baidu</col> + <col id="0" translatable="no">Baidu</col> </row> <row> - <col id="0" translatable="yes">Amazon</col> + <col id="0" translatable="no">Amazon</col> </row> <row> - <col id="0" translatable="yes">Ebay</col> + <col id="0" translatable="no">Ebay</col> </row> <row> - <col id="0" translatable="yes">IMBD</col> + <col id="0" translatable="no">IMBD</col> </row> <row> - <col id="0" translatable="yes">ESPN</col> + <col id="0" translatable="no">ESPN</col> </row> <row> - <col id="0" translatable="yes">Wikipedia</col> + <col id="0" translatable="no">Wikipedia</col> </row> <row> - <col id="0" translatable="yes">DuckDuckGo</col> + <col id="0" translatable="no">DuckDuckGo</col> </row> </data> </object> @@ -2492,16 +2492,16 @@ </columns> <data> <row> - <col id="0" translatable="yes">Top</col> + <col id="0" translatable="yes">preferencesTabLocTop</col> </row> <row> - <col id="0" translatable="yes">Left</col> + <col id="0" translatable="yes">preferencesTabLocLeft</col> </row> <row> - <col id="0" translatable="yes">Right</col> + <col id="0" translatable="yes">preferencesTabLocRight</col> </row> <row> - <col id="0" translatable="yes">Bottom</col> + <col id="0" translatable="yes">preferencesTabLocBottom</col> </row> </data> </object> @@ -2512,16 +2512,16 @@ </columns> <data> <row> - <col id="0" translatable="yes">Small Icons</col> + <col id="0" translatable="yes">preferencesButtonTypeSmall</col> </row> <row> - <col id="0" translatable="yes">Large Icons</col> + <col id="0" translatable="yes">preferencesButtonTypeLarge</col> </row> <row> - <col id="0" translatable="yes">Large Icons and Text</col> + <col id="0" translatable="yes">preferencesButtonTypeLargeText</col> </row> <row> - <col id="0" translatable="yes">Text only</col> + <col id="0" translatable="yes">preferencesButtonTypeText</col> </row> </data> </object> @@ -2532,16 +2532,16 @@ </columns> <data> <row> - <col id="0" translatable="yes">foreground and background images</col> + <col id="0" translatable="yes">preferencesImageLoadBoth</col> </row> <row> - <col id="0" translatable="yes">foreground images</col> + <col id="0" translatable="yes">preferencesImageLoadFore</col> </row> <row> - <col id="0" translatable="yes">background images</col> + <col id="0" translatable="yes">preferencesImageLoadBack</col> </row> <row> - <col id="0" translatable="yes">no images</col> + <col id="0" translatable="yes">preferencesImageLoadNone</col> </row> </data> </object> @@ -2552,19 +2552,19 @@ </columns> <data> <row> - <col id="0" translatable="yes">Sans-serif</col> + <col id="0" translatable="yes">preferencesFonttypeSans</col> </row> <row> - <col id="0" translatable="yes">Serif</col> + <col id="0" translatable="yes">preferencesFonttypeSerif</col> </row> <row> - <col id="0" translatable="yes">Monospace</col> + <col id="0" translatable="yes">preferencesFonttypeMonospace</col> </row> <row> - <col id="0" translatable="yes">Cursive</col> + <col id="0" translatable="yes">preferencesFonttypeCursive</col> </row> <row> - <col id="0" translatable="yes">Fantasy</col> + <col id="0" translatable="yes">preferencesFonttypeFantasy</col> </row> </data> </object> @@ -2580,19 +2580,19 @@ </columns> <data> <row> - <col id="0" translatable="yes">Direct connection</col> + <col id="0" translatable="yes">preferencesProxyTypeDirect</col> </row> <row> - <col id="0" translatable="yes">Manual with no authentication</col> + <col id="0" translatable="yes">preferencesProxyTypeManual</col> </row> <row> - <col id="0" translatable="yes">Manual with basic authentication</col> + <col id="0" translatable="yes">preferencesProxyTypeBasic</col> </row> <row> - <col id="0" translatable="yes">Manual with NTLM authentication</col> + <col id="0" translatable="yes">preferencesProxyTypeNLTM</col> </row> <row> - <col id="0" translatable="yes">System settings</col> + <col id="0" translatable="yes">preferencesProxyTypeSystem</col> </row> </data> </object> @@ -2694,7 +2694,7 @@ </columns> <data> <row> - <col id="0" translatable="yes">Default</col> + <col id="0" translatable="yes">preferencesThemeTypeDefault</col> </row> </data> </object> diff --git a/gtk/res/options.gtk3.ui b/gtk/res/options.gtk3.ui index 4bdc2dfca..a795c2bf5 100644 --- a/gtk/res/options.gtk3.ui +++ b/gtk/res/options.gtk3.ui @@ -81,7 +81,7 @@ <object class="GtkDialog" id="dialogPreferences"> <property name="can_focus">False</property> <property name="border_width">5</property> - <property name="title" translatable="yes">Netsurf Preferences</property> + <property name="title" translatable="yes">preferencesTitle</property> <property name="window_position">center-on-parent</property> <property name="destroy_with_parent">True</property> <property name="type_hint">dialog</property> @@ -175,7 +175,7 @@ <object class="GtkLabel" id="label_startup_page"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Page:</property> + <property name="label" translatable="yes">preferencesStartupPage</property> </object> <packing> <property name="expand">False</property> @@ -187,7 +187,7 @@ <object class="GtkEntry" id="entryHomePageURL"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The default startup page</property> + <property name="tooltip_text" translatable="yes">preferencesStartupPageTooltip</property> <property name="invisible_char">â—</property> <signal name="changed" handler="nsgtk_preferences_entryHomePageURL_changed" swapped="no"/> <signal name="realize" handler="nsgtk_preferences_entryHomePageURL_realize" swapped="no"/> @@ -216,7 +216,7 @@ </child> <child> <object class="GtkButton" id="setDefaultPage"> - <property name="label" translatable="yes">Use Default Page</property> + <property name="label" translatable="yes">preferencesStartupPageDefault</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -233,7 +233,7 @@ </child> <child> <object class="GtkButton" id="setCurrentPage"> - <property name="label" translatable="yes">Use Current Page</property> + <property name="label" translatable="yes">preferencesStartupPageCurrent</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -263,7 +263,7 @@ <object class="GtkLabel" id="label_main_startup"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Startup</b></property> + <property name="label" translatable="yes">preferencesStartup</property> <property name="use_markup">True</property> </object> </child> @@ -295,7 +295,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkUrlSearch"> - <property name="label" translatable="yes">Search from URL bar</property> + <property name="label" translatable="yes">preferencesSearchURLBar</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -322,7 +322,7 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Provider:</property> + <property name="label" translatable="yes">preferencesSearchProvider</property> </object> <packing> <property name="expand">False</property> @@ -334,7 +334,7 @@ <object class="GtkComboBox" id="comboSearch"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">The default web search provider</property> + <property name="tooltip_text" translatable="yes">preferencesSearchProviderTooltip</property> <property name="halign">start</property> <property name="model">liststore_search_provider</property> <signal name="changed" handler="nsgtk_preferences_comboSearch_changed" swapped="no"/> @@ -367,7 +367,7 @@ <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Search</b></property> + <property name="label" translatable="yes">preferencesSearch</property> <property name="use_markup">True</property> </object> </child> @@ -399,7 +399,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkClearDownloads"> - <property name="label" translatable="yes">Remove download from list when complete</property> + <property name="label" translatable="yes">preferencesDownloadsRemove</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -419,7 +419,7 @@ </child> <child> <object class="GtkCheckButton" id="checkRequestOverwrite"> - <property name="label" translatable="yes">Confirm before overwriting files</property> + <property name="label" translatable="yes">preferencesDownloadsConfirm</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -446,7 +446,7 @@ <object class="GtkLabel" id="label8"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Location:</property> + <property name="label" translatable="yes">preferencesDownloadsLocation</property> </object> <packing> <property name="expand">False</property> @@ -458,7 +458,7 @@ <object class="GtkFileChooserButton" id="fileChooserDownloads"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">The default location downloaded files are put</property> + <property name="tooltip_text" translatable="yes">preferencesDownloadsLocationTooltip</property> <property name="halign">start</property> <property name="action">select-folder</property> <signal name="selection-changed" handler="nsgtk_preferences_fileChooserDownloads_selectionchanged" swapped="no"/> @@ -485,7 +485,7 @@ <object class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Downloads</b></property> + <property name="label" translatable="yes">preferencesDownloads</property> <property name="use_markup">True</property> </object> </child> @@ -503,7 +503,7 @@ <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Main</property> + <property name="label" translatable="yes">preferencesMainTabtitle</property> </object> <packing> <property name="tab_fill">False</property> @@ -557,7 +557,7 @@ </child> <child> <object class="GtkButton" id="buttonAddTheme"> - <property name="label" translatable="yes">Add Theme...</property> + <property name="label" translatable="yes">preferencesThemesAdd</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -580,7 +580,7 @@ <object class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Themes</b></property> + <property name="label" translatable="yes">preferencesThemes</property> <property name="use_markup">True</property> </object> </child> @@ -612,7 +612,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkShowSingleTab"> - <property name="label" translatable="yes">Always show tab bar</property> + <property name="label" translatable="yes">preferencesTabsAlways</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -632,7 +632,7 @@ </child> <child> <object class="GtkCheckButton" id="checkFocusNew"> - <property name="label" translatable="yes">Switch to newly opened tabs immediately</property> + <property name="label" translatable="yes">preferencesTabsSwitch</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -652,7 +652,7 @@ </child> <child> <object class="GtkCheckButton" id="checkNewBlank"> - <property name="label" translatable="yes">Newly opened tabs are blank</property> + <property name="label" translatable="yes">preferencesTabsNewly</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -679,7 +679,7 @@ <object class="GtkLabel" id="label9"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Position:</property> + <property name="label" translatable="yes">preferencesTabsPosition</property> </object> <packing> <property name="expand">False</property> @@ -723,7 +723,7 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Tabs</b></property> + <property name="label" translatable="yes">preferencesTabs</property> <property name="use_markup">True</property> </object> </child> @@ -758,7 +758,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Open source view in new:</property> + <property name="label" translatable="yes">preferencesSourceOpen</property> </object> <packing> <property name="expand">True</property> @@ -772,7 +772,7 @@ <property name="can_focus">False</property> <child> <object class="GtkRadioButton" id="sourceButtonWindow"> - <property name="label" translatable="yes">window</property> + <property name="label" translatable="yes">preferencesSourceWindow</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -794,7 +794,7 @@ </child> <child> <object class="GtkRadioButton" id="sourceButtonTab"> - <property name="label" translatable="yes">tab</property> + <property name="label" translatable="yes">preferencesSourceTab</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -828,7 +828,7 @@ <object class="GtkLabel" id="label12"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Source</b></property> + <property name="label" translatable="yes">preferencesSource</property> <property name="use_markup">True</property> </object> </child> @@ -860,7 +860,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkDisplayRecentURLs"> - <property name="label" translatable="yes">Display recently visited URLs as you type</property> + <property name="label" translatable="yes">preferencesURLbarDisplay</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -886,7 +886,7 @@ <object class="GtkLabel" id="label14"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>URLbar</b></property> + <property name="label" translatable="yes">preferencesURLbar</property> <property name="use_markup">True</property> </object> </child> @@ -925,7 +925,7 @@ <object class="GtkLabel" id="label16"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Buttons:</property> + <property name="label" translatable="yes">preferencesToolbarButtons</property> </object> <packing> <property name="expand">False</property> @@ -969,7 +969,7 @@ <object class="GtkLabel" id="label15"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Toolbar</b></property> + <property name="label" translatable="yes">preferencesToolbar</property> <property name="use_markup">True</property> </object> </child> @@ -990,7 +990,7 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Appearance</property> + <property name="label" translatable="yes">preferencesAppearanceTabtitle</property> </object> <packing> <property name="position">1</property> @@ -1023,7 +1023,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkDisablePopups"> - <property name="label" translatable="yes">Prevent pop-up windows</property> + <property name="label" translatable="yes">preferencesControlPrevent</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1043,7 +1043,7 @@ </child> <child> <object class="GtkCheckButton" id="checkHideAdverts"> - <property name="label" translatable="yes">Hide Adverts</property> + <property name="label" translatable="yes">preferencesControlHide</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1063,7 +1063,7 @@ </child> <child> <object class="GtkCheckButton" id="checkEnableJavascript"> - <property name="label" translatable="yes">Enable JavaScript</property> + <property name="label" translatable="yes">preferencesControlEnable</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1083,7 +1083,7 @@ </child> <child> <object class="GtkCheckButton" id="checkDisablePlugins"> - <property name="label" translatable="yes">Disable plug-ins</property> + <property name="label" translatable="yes">preferencesControlDisable</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1103,7 +1103,7 @@ </child> <child> <object class="GtkCheckButton" id="checkResampleImages"> - <property name="label" translatable="yes">High quality image scaling</property> + <property name="label" translatable="yes">preferencesControlHigh</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1130,7 +1130,7 @@ <object class="GtkLabel" id="label17"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Load and display</property> + <property name="label" translatable="yes">preferencesControlLoad</property> </object> <packing> <property name="expand">False</property> @@ -1174,7 +1174,7 @@ <object class="GtkLabel" id="label11"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Control</b></property> + <property name="label" translatable="yes">preferencesControl</property> <property name="use_markup">True</property> </object> </child> @@ -1206,7 +1206,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkEnableAnimations"> - <property name="label" translatable="yes">Enable</property> + <property name="label" translatable="yes">preferencesAnimationEnable</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1233,7 +1233,7 @@ <object class="GtkLabel" id="label19"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Minimum time between frames:</property> + <property name="label" translatable="yes">preferencesAnimationMinimum</property> </object> <packing> <property name="expand">False</property> @@ -1246,7 +1246,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Do not update animations any more often than this.</property> + <property name="tooltip_text" translatable="yes">preferencesAnimationMinimumTooltip</property> <property name="invisible_char">â—</property> <property name="adjustment">adjustment_animation_time</property> <property name="climb_rate">1</property> @@ -1277,7 +1277,7 @@ <object class="GtkLabel" id="label18"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Animation</b></property> + <property name="label" translatable="yes">preferencesAnimation</property> <property name="use_markup">True</property> </object> </child> @@ -1316,7 +1316,7 @@ <object class="GtkLabel" id="label26"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Default</property> + <property name="label" translatable="yes">preferencesFontsDefault</property> </object> <packing> <property name="expand">False</property> @@ -1360,7 +1360,7 @@ <object class="GtkLabel" id="label27"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Size</property> + <property name="label" translatable="yes">preferencesFontsSize</property> </object> <packing> <property name="expand">False</property> @@ -1373,7 +1373,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">The base-line font size to use.</property> + <property name="tooltip_text" translatable="yes">preferencesFontsSizeTooltip</property> <property name="max_length">4</property> <property name="invisible_char">â—</property> <property name="width_chars">4</property> @@ -1399,7 +1399,7 @@ </child> <child> <object class="GtkButton" id="fontPreview"> - <property name="label" translatable="yes">_Preview</property> + <property name="label" translatable="yes">preferencesFontsPreview</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1423,7 +1423,7 @@ <object class="GtkLabel" id="label20"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Fonts</b></property> + <property name="label" translatable="yes">preferencesFonts</property> <property name="use_markup">True</property> </object> </child> @@ -1461,7 +1461,7 @@ <object class="GtkLabel" id="label21"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Preferred language:</property> + <property name="label" translatable="yes">preferencesLanguagePreferred</property> </object> <packing> <property name="expand">False</property> @@ -1474,7 +1474,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">The preferred language for web pages</property> + <property name="tooltip_text" translatable="yes">preferencesLanguagePreferredTooltip</property> <property name="halign">start</property> <property name="model">liststore_content_language</property> <signal name="changed" handler="nsgtk_preferences_comboboxLanguage_changed" swapped="no"/> @@ -1517,7 +1517,7 @@ <object class="GtkLabel" id="label25"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Language</b></property> + <property name="label" translatable="yes">preferencesLanguage</property> <property name="use_markup">True</property> </object> </child> @@ -1537,7 +1537,7 @@ <object class="GtkLabel" id="label10"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Content</property> + <property name="label" translatable="yes">preferencesContentTabtitle</property> </object> <packing> <property name="position">2</property> @@ -1570,7 +1570,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkSendReferer"> - <property name="label" translatable="yes">Enable referral submission</property> + <property name="label" translatable="yes">preferencesGeneralReferral</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1590,7 +1590,7 @@ </child> <child> <object class="GtkCheckButton" id="checkSendDNT"> - <property name="label" translatable="yes">Enable sending "Do Not Track" request</property> + <property name="label" translatable="yes">preferencesGeneralDNT</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1616,7 +1616,7 @@ <object class="GtkLabel" id="label61"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>General</b></property> + <property name="label" translatable="yes">preferencesGeneral</property> <property name="use_markup">True</property> </object> </child> @@ -1648,7 +1648,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkHoverURLs"> - <property name="label" translatable="yes">Local history shows URL in tooltip</property> + <property name="label" translatable="yes">preferencesHistoryShow</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1675,7 +1675,7 @@ <object class="GtkLabel" id="label28"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Remember browsing history for up to</property> + <property name="label" translatable="yes">preferencesHistoryRemember</property> </object> <packing> <property name="expand">False</property> @@ -1707,7 +1707,7 @@ <object class="GtkLabel" id="label29"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">days</property> + <property name="label" translatable="yes">preferencesHistoryDays</property> </object> <packing> <property name="expand">False</property> @@ -1730,7 +1730,7 @@ <object class="GtkLabel" id="label23"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>History</b></property> + <property name="label" translatable="yes">preferencesHistory</property> <property name="use_markup">True</property> </object> </child> @@ -1773,7 +1773,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Memory cache size</property> + <property name="label" translatable="yes">preferencesCacheMemory</property> </object> <packing> <property name="x_options">GTK_FILL</property> @@ -1784,7 +1784,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Disc cache size</property> + <property name="label" translatable="yes">preferencesCacheDisc</property> </object> <packing> <property name="top_attach">1</property> @@ -1797,7 +1797,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Expire cache entries after</property> + <property name="label" translatable="yes">preferencesCacheExpire</property> </object> <packing> <property name="top_attach">2</property> @@ -1881,7 +1881,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">MB</property> + <property name="label" translatable="no">MB</property> </object> <packing> <property name="left_attach">2</property> @@ -1896,7 +1896,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">days</property> + <property name="label" translatable="yes">preferencesCacheDays</property> </object> <packing> <property name="left_attach">2</property> @@ -1922,7 +1922,7 @@ </child> <child> <object class="GtkButton" id="buttonCacheMaintinance"> - <property name="label" translatable="yes">Maintinance</property> + <property name="label" translatable="yes">preferencesCacheMaintinance</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -1951,7 +1951,7 @@ <object class="GtkLabel" id="label24"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Cache</b></property> + <property name="label" translatable="yes">preferencesCache</property> <property name="use_markup">True</property> </object> </child> @@ -1972,7 +1972,7 @@ <object class="GtkLabel" id="label22"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Privacy</property> + <property name="label" translatable="yes">preferencesPrivacyTabtitle</property> </object> <packing> <property name="position">3</property> @@ -2002,7 +2002,7 @@ <object class="GtkTable" id="table2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="n_rows">4</property> + <property name="n_rows">5</property> <property name="n_columns">2</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> @@ -2011,7 +2011,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Proxy type</property> + <property name="label" translatable="yes">preferencesProxyType</property> </object> <packing> <property name="x_options">GTK_FILL</property> @@ -2022,7 +2022,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Host</property> + <property name="label" translatable="yes">preferencesProxyHost</property> </object> <packing> <property name="top_attach">1</property> @@ -2035,7 +2035,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Username</property> + <property name="label" translatable="yes">preferencesProxyUsername</property> </object> <packing> <property name="top_attach">2</property> @@ -2048,7 +2048,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Password</property> + <property name="label" translatable="yes">preferencesProxyPassword</property> </object> <packing> <property name="top_attach">3</property> @@ -2061,7 +2061,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">The type of HTTP proxy server.</property> + <property name="tooltip_text" translatable="yes">preferencesProxyTypeTooltip</property> <property name="model">liststore_proxy_type</property> <signal name="changed" handler="nsgtk_preferences_comboProxyType_changed" swapped="no"/> <signal name="realize" handler="nsgtk_preferences_comboProxyType_realize" swapped="no"/> @@ -2087,7 +2087,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Host name of your proxy server.</property> + <property name="tooltip_text" translatable="yes">preferencesProxyHostTooltip</property> <property name="invisible_char">â—</property> <signal name="changed" handler="nsgtk_preferences_entryProxyHost_changed" swapped="no"/> <signal name="realize" handler="nsgtk_preferences_entryProxyHost_realize" swapped="no"/> @@ -2102,7 +2102,7 @@ <object class="GtkLabel" id="label46"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">:</property> + <property name="label" translatable="no">:</property> </object> <packing> <property name="expand">False</property> @@ -2115,7 +2115,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Port number to connect to on proxy server.</property> + <property name="tooltip_text" translatable="yes">preferencesProxyPortTooltip</property> <property name="max_length">5</property> <property name="invisible_char">â—</property> <property name="width_chars">5</property> @@ -2145,7 +2145,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Username to access the proxy</property> + <property name="tooltip_text" translatable="yes">preferencesProxyUsernameTooltip</property> <property name="invisible_char">â—</property> <signal name="changed" handler="nsgtk_preferences_entryProxyUser_changed" swapped="no"/> <signal name="realize" handler="nsgtk_preferences_entryProxyUser_realize" swapped="no"/> @@ -2162,7 +2162,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Password to access the proxy</property> + <property name="tooltip_text" translatable="yes">preferencesProxyPasswordTooltip</property> <property name="visibility">False</property> <property name="invisible_char">â—</property> <signal name="changed" handler="nsgtk_preferences_entryProxyPassword_changed" swapped="no"/> @@ -2175,6 +2175,36 @@ <property name="bottom_attach">4</property> </packing> </child> + <child> + <object class="GtkLabel" id="label55"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">preferencesProxyNoproxy</property> + </object> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="entryProxyNoproxy"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_text" translatable="yes">preferencesProxyNoproxyTooltip</property> + <property name="caps_lock_warning">False</property> + <signal name="changed" handler="nsgtk_preferences_entryProxyNoproxy_changed" swapped="no"/> + <signal name="realize" handler="nsgtk_preferences_entryProxyNoproxy_realize" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> </object> </child> </object> @@ -2183,7 +2213,7 @@ <object class="GtkLabel" id="label37"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>HTTP Proxy</b></property> + <property name="label" translatable="yes">preferencesProxy</property> <property name="use_markup">True</property> </object> </child> @@ -2221,7 +2251,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Maximum fetchers</property> + <property name="label" translatable="yes">preferencesFetchingMax</property> </object> <packing> <property name="x_options">GTK_FILL</property> @@ -2232,7 +2262,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Fetches per host</property> + <property name="label" translatable="yes">preferencesFetchingPerhost</property> </object> <packing> <property name="top_attach">1</property> @@ -2245,7 +2275,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Cached connections</property> + <property name="label" translatable="yes">preferencesFetchingCached</property> </object> <packing> <property name="top_attach">2</property> @@ -2258,7 +2288,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Maximum number of concurrent items to fetch at once.</property> + <property name="tooltip_text" translatable="yes">preferencesFetchingMaxTooltip</property> <property name="invisible_char">â—</property> <property name="width_chars">3</property> <property name="adjustment">adjustment_fetching_max</property> @@ -2278,7 +2308,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Maximum number of item fetches per web server.</property> + <property name="tooltip_text" translatable="yes">preferencesFetchingPerhostTooltip</property> <property name="invisible_char">â—</property> <property name="width_chars">3</property> <property name="adjustment">adjustment_fetching_perhost</property> @@ -2300,7 +2330,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Number of connections to keep in case they are needed again.</property> + <property name="tooltip_text" translatable="yes">preferencesFetchingCachedTooltip</property> <property name="invisible_char">â—</property> <property name="width_chars">3</property> <property name="adjustment">adjustment_fetching_cached</property> @@ -2325,7 +2355,7 @@ <object class="GtkLabel" id="label38"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Fetching</b></property> + <property name="label" translatable="yes">preferencesFetching</property> <property name="use_markup">True</property> </object> </child> @@ -2346,7 +2376,7 @@ <object class="GtkLabel" id="label36"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Network</property> + <property name="label" translatable="yes">preferencesNetworkTabtitle</property> </object> <packing> <property name="position">4</property> @@ -2379,7 +2409,7 @@ <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="checkSuppressImages"> - <property name="label" translatable="yes">No images in output</property> + <property name="label" translatable="yes">preferencesAppearanceImages</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -2399,7 +2429,7 @@ </child> <child> <object class="GtkCheckButton" id="checkRemoveBackgrounds"> - <property name="label" translatable="yes">No background images in output</property> + <property name="label" translatable="yes">preferencesAppearanceBackground</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -2419,7 +2449,7 @@ </child> <child> <object class="GtkCheckButton" id="checkFitPage"> - <property name="label" translatable="yes">Scale output to fit page</property> + <property name="label" translatable="yes">preferencesAppearanceScalefit</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -2446,7 +2476,7 @@ <object class="GtkLabel" id="label59"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Scale output</property> + <property name="label" translatable="yes">preferencesAppearanceScale</property> </object> <packing> <property name="expand">False</property> @@ -2478,7 +2508,7 @@ <object class="GtkLabel" id="label60"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">%</property> + <property name="label" translatable="no">%</property> </object> <packing> <property name="expand">False</property> @@ -2501,7 +2531,7 @@ <object class="GtkLabel" id="label48"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Appearance</b></property> + <property name="label" translatable="yes">preferencesAppearance</property> <property name="use_markup">True</property> </object> </child> @@ -2539,7 +2569,7 @@ <object class="GtkLabel" id="label62"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">measurements in mm</property> + <property name="label" translatable="yes">preferencesMarginsMeasurements</property> </object> <packing> <property name="expand">False</property> @@ -2789,7 +2819,7 @@ <object class="GtkLabel" id="label49"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Margins</b></property> + <property name="label" translatable="yes">preferencesMargins</property> <property name="use_markup">True</property> </object> </child> @@ -2821,7 +2851,7 @@ <property name="spacing">7</property> <child> <object class="GtkCheckButton" id="checkCompressPDF"> - <property name="label" translatable="yes">Output is compressed</property> + <property name="label" translatable="yes">preferencesGenerationCompressed</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -2841,7 +2871,7 @@ </child> <child> <object class="GtkCheckButton" id="checkPasswordPDF"> - <property name="label" translatable="yes">Output has a password</property> + <property name="label" translatable="yes">preferencesGenerationPassword</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -2867,7 +2897,7 @@ <object class="GtkLabel" id="label50"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Generation</b></property> + <property name="label" translatable="yes">preferencesGeneration</property> <property name="use_markup">True</property> </object> </child> @@ -2888,7 +2918,7 @@ <object class="GtkLabel" id="label47"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">PDF</property> + <property name="label" translatable="yes">preferencesPDFTabtitle</property> </object> <packing> <property name="position">5</property> @@ -2936,19 +2966,19 @@ </columns> <data> <row> - <col id="0" translatable="yes">Sans-serif</col> + <col id="0" translatable="yes">preferencesFonttypeSans</col> </row> <row> - <col id="0" translatable="yes">Serif</col> + <col id="0" translatable="yes">preferencesFonttypeSerif</col> </row> <row> - <col id="0" translatable="yes">Monospace</col> + <col id="0" translatable="yes">preferencesFonttypeMonospace</col> </row> <row> - <col id="0" translatable="yes">Cursive</col> + <col id="0" translatable="yes">preferencesFonttypeCursive</col> </row> <row> - <col id="0" translatable="yes">Fantasy</col> + <col id="0" translatable="yes">preferencesFonttypeFantasy</col> </row> </data> </object> @@ -2959,16 +2989,16 @@ </columns> <data> <row> - <col id="0" translatable="yes">foreground and background images</col> + <col id="0" translatable="yes">preferencesImageLoadBoth</col> </row> <row> - <col id="0" translatable="yes">foreground images</col> + <col id="0" translatable="yes">preferencesImageLoadFore</col> </row> <row> - <col id="0" translatable="yes">background images</col> + <col id="0" translatable="yes">preferencesImageLoadBack</col> </row> <row> - <col id="0" translatable="yes">no images</col> + <col id="0" translatable="yes">preferencesImageLoadNone</col> </row> </data> </object> @@ -2979,19 +3009,19 @@ </columns> <data> <row> - <col id="0" translatable="yes">Direct connection</col> + <col id="0" translatable="yes">preferencesProxyTypeDirect</col> </row> <row> - <col id="0" translatable="yes">Manual with no authentication</col> + <col id="0" translatable="yes">preferencesProxyTypeManual</col> </row> <row> - <col id="0" translatable="yes">Manual with basic authentication</col> + <col id="0" translatable="yes">preferencesProxyTypeBasic</col> </row> <row> - <col id="0" translatable="yes">Manual with NTLM authentication</col> + <col id="0" translatable="yes">preferencesProxyTypeNLTM</col> </row> <row> - <col id="0" translatable="yes">System settings</col> + <col id="0" translatable="yes">preferencesProxyTypeSystem</col> </row> </data> </object> @@ -3002,67 +3032,67 @@ </columns> <data> <row> - <col id="0" translatable="yes">Google</col> + <col id="0" translatable="no">Google</col> </row> <row> - <col id="0" translatable="yes">Yahoo!</col> + <col id="0" translatable="no">Yahoo!</col> </row> <row> - <col id="0" translatable="yes">Microsoft Live</col> + <col id="0" translatable="no">Microsoft Live</col> </row> <row> - <col id="0" translatable="yes">Buisiness.com</col> + <col id="0" translatable="no">Buisiness.com</col> </row> <row> - <col id="0" translatable="yes">Omgili</col> + <col id="0" translatable="no">Omgili</col> </row> <row> - <col id="0" translatable="yes">BBC News</col> + <col id="0" translatable="no">BBC News</col> </row> <row> - <col id="0" translatable="yes">Ubuntu Packages</col> + <col id="0" translatable="no">Ubuntu Packages</col> </row> <row> - <col id="0" translatable="yes">Creative Commons</col> + <col id="0" translatable="no">Creative Commons</col> </row> <row> - <col id="0" translatable="yes">Ask</col> + <col id="0" translatable="no">Ask</col> </row> <row> - <col id="0" translatable="yes">Answers</col> + <col id="0" translatable="no">Answers</col> </row> <row> - <col id="0" translatable="yes">Dictionary.com</col> + <col id="0" translatable="no">Dictionary.com</col> </row> <row> - <col id="0" translatable="yes">YouTube</col> + <col id="0" translatable="no">YouTube</col> </row> <row> - <col id="0" translatable="yes">AeroMP3</col> + <col id="0" translatable="no">AeroMP3</col> </row> <row> - <col id="0" translatable="yes">AOL</col> + <col id="0" translatable="no">AOL</col> </row> <row> - <col id="0" translatable="yes">Baidu</col> + <col id="0" translatable="no">Baidu</col> </row> <row> - <col id="0" translatable="yes">Amazon</col> + <col id="0" translatable="no">Amazon</col> </row> <row> - <col id="0" translatable="yes">Ebay</col> + <col id="0" translatable="no">Ebay</col> </row> <row> - <col id="0" translatable="yes">IMBD</col> + <col id="0" translatable="no">IMBD</col> </row> <row> - <col id="0" translatable="yes">ESPN</col> + <col id="0" translatable="no">ESPN</col> </row> <row> - <col id="0" translatable="yes">Wikipedia</col> + <col id="0" translatable="no">Wikipedia</col> </row> <row> - <col id="0" translatable="yes">DuckDuckGo</col> + <col id="0" translatable="no">DuckDuckGo</col> </row> </data> </object> @@ -3073,16 +3103,16 @@ </columns> <data> <row> - <col id="0" translatable="yes">Top</col> + <col id="0" translatable="yes">preferencesTabLocTop</col> </row> <row> - <col id="0" translatable="yes">Left</col> + <col id="0" translatable="yes">preferencesTabLocLeft</col> </row> <row> - <col id="0" translatable="yes">Right</col> + <col id="0" translatable="yes">preferencesTabLocRight</col> </row> <row> - <col id="0" translatable="yes">Bottom</col> + <col id="0" translatable="yes">preferencesTabLocBottom</col> </row> </data> </object> @@ -3093,7 +3123,7 @@ </columns> <data> <row> - <col id="0" translatable="yes">Default</col> + <col id="0" translatable="yes">preferencesThemeTypeDefault</col> </row> </data> </object> @@ -3104,16 +3134,16 @@ </columns> <data> <row> - <col id="0" translatable="yes">Small Icons</col> + <col id="0" translatable="yes">preferencesButtonTypeSmall</col> </row> <row> - <col id="0" translatable="yes">Large Icons</col> + <col id="0" translatable="yes">preferencesButtonTypeLarge</col> </row> <row> - <col id="0" translatable="yes">Large Icons and Text</col> + <col id="0" translatable="yes">preferencesButtonTypeLargeText</col> </row> <row> - <col id="0" translatable="yes">Text only</col> + <col id="0" translatable="yes">preferencesButtonTypeText</col> </row> </data> </object> diff --git a/gtk/res/tabcontents.gtk2.ui b/gtk/res/tabcontents.gtk2.ui index 1c7d99bc3..63e290e8b 100644 --- a/gtk/res/tabcontents.gtk2.ui +++ b/gtk/res/tabcontents.gtk2.ui @@ -10,6 +10,9 @@ <object class="GtkLayout" id="layout"> <property name="visible">True</property> <property name="app_paintable">True</property> + <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property> + <property name="hadjustment">layouthadjustment</property> + <property name="vadjustment">layoutvadjustment</property> </object> </child> <child> @@ -47,6 +50,7 @@ <child> <object class="GtkHScrollbar" id="hscrollbar"> <property name="visible">True</property> + <property name="adjustment">layouthadjustment</property> </object> <packing> <property name="resize">True</property> @@ -64,6 +68,7 @@ <object class="GtkVScrollbar" id="vscrollbar"> <property name="visible">True</property> <property name="orientation">vertical</property> + <property name="adjustment">layoutvadjustment</property> </object> <packing> <property name="left_attach">1</property> @@ -72,4 +77,16 @@ </packing> </child> </object> + <object class="GtkAdjustment" id="layouthadjustment"> + <property name="upper">100</property> + <property name="step_increment">30</property> + <property name="page_increment">10</property> + <property name="page_size">10</property> + </object> + <object class="GtkAdjustment" id="layoutvadjustment"> + <property name="upper">100</property> + <property name="step_increment">30</property> + <property name="page_increment">10</property> + <property name="page_size">10</property> + </object> </interface> diff --git a/gtk/res/tabcontents.gtk3.ui b/gtk/res/tabcontents.gtk3.ui index 28d09e074..02de1bff1 100644 --- a/gtk/res/tabcontents.gtk3.ui +++ b/gtk/res/tabcontents.gtk3.ui @@ -1,6 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> + <object class="GtkAdjustment" id="layouthadjustment"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="layoutvadjustment"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkGrid" id="tabContents"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -11,6 +21,9 @@ <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> + <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property> + <property name="hadjustment">layouthadjustment</property> + <property name="vadjustment">layoutvadjustment</property> </object> <packing> <property name="left_attach">0</property> @@ -25,6 +38,7 @@ <property name="can_focus">False</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> + <property name="adjustment">layoutvadjustment</property> </object> <packing> <property name="left_attach">1</property> @@ -69,6 +83,7 @@ <object class="GtkScrollbar" id="hscrollbar"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="adjustment">layouthadjustment</property> </object> <packing> <property name="resize">True</property> diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index 4097837a9..566197dcd 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" @@ -48,7 +48,6 @@ #include "desktop/save_text.h" #include "desktop/search.h" #include "desktop/searchweb.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "desktop/tree.h" #include "gtk/cookies.h" @@ -1287,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); @@ -1298,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; } @@ -1423,7 +1422,7 @@ MULTIHANDLER(reload) return TRUE; /* clear potential search effects */ - browser_window_search_destroy_context(bw); + browser_window_search_clear(bw); nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); @@ -1442,7 +1441,7 @@ MULTIHANDLER(back) return TRUE; /* clear potential search effects */ - browser_window_search_destroy_context(bw); + browser_window_search_clear(bw); nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); @@ -1462,7 +1461,7 @@ MULTIHANDLER(forward) return TRUE; /* clear potential search effects */ - browser_window_search_destroy_context(bw); + browser_window_search_clear(bw); nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); @@ -2431,7 +2430,7 @@ void nsgtk_scaffolding_toggle_search_bar_visibility(nsgtk_scaffolding *g) g_object_get(G_OBJECT(g->search->bar), "visible", &vis, NULL); if (vis) { if (bw != NULL) - browser_window_search_destroy_context(bw); + browser_window_search_clear(bw); nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); gtk_widget_hide(GTK_WIDGET(g->search->bar)); @@ -2468,7 +2467,7 @@ void nsgtk_scaffolding_set_top_level(struct gui_window *gw) nsgtk_window_update_back_forward(sc); /* clear effects of potential searches */ - browser_window_search_destroy_context(bw); + browser_window_search_clear(bw); nsgtk_search_set_forward_state(true, bw); nsgtk_search_set_back_state(true, bw); diff --git a/gtk/search.c b/gtk/search.c index 37b7397c4..d4fbadcc8 100644 --- a/gtk/search.c +++ b/gtk/search.c @@ -36,7 +36,6 @@ #include "desktop/gui.h" #include "desktop/search.h" #include "desktop/searchweb.h" -#include "desktop/selection.h" #include "utils/log.h" #include "utils/messages.h" #include "utils/utils.h" @@ -70,10 +69,9 @@ gboolean nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( nsgtk_scaffolding_search(g)->checkAll)) ? SEARCH_FLAG_SHOWALL : 0); - if (browser_window_search_verify_new(bw, &nsgtk_search_callbacks, - (void *)bw)) - browser_window_search_step(bw, flags, gtk_entry_get_text( - nsgtk_scaffolding_search(g)->entry)); + + browser_window_search(bw, &nsgtk_search_callbacks, (void *)bw, flags, + gtk_entry_get_text(nsgtk_scaffolding_search(g)->entry)); return TRUE; } @@ -94,10 +92,9 @@ gboolean nsgtk_search_back_button_clicked(GtkWidget *widget, gpointer data) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( nsgtk_scaffolding_search(g)->checkAll)) ? SEARCH_FLAG_SHOWALL : 0); - if (browser_window_search_verify_new(bw, &nsgtk_search_callbacks, - (void *)bw)) - browser_window_search_step(bw, flags, gtk_entry_get_text( - nsgtk_scaffolding_search(g)->entry)); + + browser_window_search(bw, &nsgtk_search_callbacks, (void *)bw, flags, + gtk_entry_get_text(nsgtk_scaffolding_search(g)->entry)); return TRUE; } @@ -120,8 +117,6 @@ gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data) assert(bw != NULL); - browser_window_search_destroy_context(bw); - nsgtk_search_set_forward_state(true, (void *)bw); nsgtk_search_set_back_state(true, (void *)bw); @@ -133,10 +128,8 @@ gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data) nsgtk_scaffolding_search(g)->checkAll)) ? SEARCH_FLAG_SHOWALL : 0); - if (browser_window_search_verify_new(bw, &nsgtk_search_callbacks, - (void *)bw)) - browser_window_search_step(bw, flags, gtk_entry_get_text( - nsgtk_scaffolding_search(g)->entry)); + browser_window_search(bw, &nsgtk_search_callbacks, (void *)bw, flags, + gtk_entry_get_text(nsgtk_scaffolding_search(g)->entry)); return TRUE; } @@ -158,10 +151,8 @@ gboolean nsgtk_search_entry_activate(GtkWidget *widget, gpointer data) nsgtk_scaffolding_search(g)->checkAll)) ? SEARCH_FLAG_SHOWALL : 0); - if (browser_window_search_verify_new(bw, &nsgtk_search_callbacks, - (void *)bw)) - browser_window_search_step(bw, flags, gtk_entry_get_text( - nsgtk_scaffolding_search(g)->entry)); + browser_window_search(bw, &nsgtk_search_callbacks, (void *)bw, flags, + gtk_entry_get_text(nsgtk_scaffolding_search(g)->entry)); return FALSE; } diff --git a/gtk/selection.c b/gtk/selection.c index 7d516e944..b0978b385 100644 --- a/gtk/selection.c +++ b/gtk/selection.c @@ -22,7 +22,6 @@ #include "utils/log.h" #include "desktop/gui.h" -#include "desktop/selection.h" #include "desktop/browser.h" #include "gtk/selection.h" #include "gtk/window.h" diff --git a/gtk/system_colour.c b/gtk/system_colour.c deleted file mode 100644 index 6c1fd81b5..000000000 --- a/gtk/system_colour.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 "desktop/options.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; -} diff --git a/gtk/tabs.c b/gtk/tabs.c index e68a192ad..462f6668e 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 402433c32..9d50c5931 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 6bb96679a..5edace8f3 100644 --- a/gtk/window.c +++ b/gtk/window.c @@ -30,10 +30,9 @@ #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 "desktop/selection.h" #include "gtk/compat.h" #include "gtk/gui.h" #include "gtk/scaffolding.h" @@ -176,6 +175,9 @@ nsgtk_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data) current_widget = (GtkWidget *)gw->layout; current_cr = cr; + GtkAdjustment *vscroll = nsgtk_layout_get_vadjustment(gw->layout); + GtkAdjustment *hscroll = nsgtk_layout_get_hadjustment(gw->layout); + cairo_clip_extents(cr, &x1, &y1, &x2, &y2); clip.x0 = x1; @@ -183,7 +185,11 @@ nsgtk_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data) clip.x1 = x2; clip.y1 = y2; - browser_window_redraw(gw->bw, 0, 0, &clip, &ctx); + browser_window_redraw(gw->bw, + -gtk_adjustment_get_value(hscroll), + -gtk_adjustment_get_value(vscroll), + &clip, + &ctx); if (gw->careth != 0) { nsgtk_plot_caret(gw->caretx, gw->carety, gw->careth); @@ -377,105 +383,89 @@ static gboolean nsgtk_window_button_release_event(GtkWidget *widget, return TRUE; } -static gboolean nsgtk_window_scroll_event(GtkWidget *widget, - GdkEventScroll *event, gpointer data) +static gboolean +nsgtk_window_scroll_event(GtkWidget *widget, + GdkEventScroll *event, + gpointer data) { struct gui_window *g = data; double value; + double deltax = 0; + double deltay = 0; GtkAdjustment *vscroll = nsgtk_layout_get_vadjustment(g->layout); GtkAdjustment *hscroll = nsgtk_layout_get_hadjustment(g->layout); GtkAllocation alloc; - LOG(("%d", event->direction)); switch (event->direction) { case GDK_SCROLL_LEFT: - if (browser_window_scroll_at_point(g->bw, - event->x / g->bw->scale, - event->y / g->bw->scale, - -100, 0) != true) { - /* core did not handle event do horizontal scroll */ - - value = gtk_adjustment_get_value(hscroll) - - (nsgtk_adjustment_get_step_increment(hscroll) *2); - - if (value < nsgtk_adjustment_get_lower(hscroll)) { - value = nsgtk_adjustment_get_lower(hscroll); - } - - gtk_adjustment_set_value(hscroll, value); - } + deltax = -1.0; break; case GDK_SCROLL_UP: - if (browser_window_scroll_at_point(g->bw, - event->x / g->bw->scale, - event->y / g->bw->scale, - 0, -100) != true) { - /* core did not handle event change vertical - * adjustment. - */ + deltay = -1.0; + break; - value = gtk_adjustment_get_value(vscroll) - - (nsgtk_adjustment_get_step_increment(vscroll) * 2); + case GDK_SCROLL_RIGHT: + deltax = 1.0; + break; - if (value < nsgtk_adjustment_get_lower(vscroll)) { - value = nsgtk_adjustment_get_lower(vscroll); - } + case GDK_SCROLL_DOWN: + deltay = 1.0; + break; - gtk_adjustment_set_value(vscroll, value); - } +#if GTK_CHECK_VERSION(3,4,0) + case GDK_SCROLL_SMOOTH: + gdk_event_get_scroll_deltas((GdkEvent *)event, &deltax, &deltay); break; +#endif + default: + LOG(("Unhandled mouse scroll direction")); + return TRUE; + } - case GDK_SCROLL_RIGHT: - if (browser_window_scroll_at_point(g->bw, - event->x / g->bw->scale, - event->y / g->bw->scale, - 100, 0) != true) { + deltax *= nsgtk_adjustment_get_step_increment(hscroll); + deltay *= nsgtk_adjustment_get_step_increment(vscroll); - /* core did not handle event change horizontal - * adjustment. - */ + if (browser_window_scroll_at_point(g->bw, + event->x / g->bw->scale, + event->y / g->bw->scale, + deltax, deltay) != true) { - value = gtk_adjustment_get_value(hscroll) + - (nsgtk_adjustment_get_step_increment(hscroll) * 2); + /* core did not handle event so change adjustments */ + + /* Horizontal */ + if (deltax != 0) { + value = gtk_adjustment_get_value(hscroll) + deltax; /* @todo consider gtk_widget_get_allocated_width() */ nsgtk_widget_get_allocation(GTK_WIDGET(g->layout), &alloc); if (value > nsgtk_adjustment_get_upper(hscroll) - alloc.width) { - value = nsgtk_adjustment_get_upper(hscroll) - - alloc.width; + value = nsgtk_adjustment_get_upper(hscroll) - alloc.width; + } + if (value < nsgtk_adjustment_get_lower(hscroll)) { + value = nsgtk_adjustment_get_lower(hscroll); } gtk_adjustment_set_value(hscroll, value); } - break; - case GDK_SCROLL_DOWN: - if (browser_window_scroll_at_point(g->bw, - event->x / g->bw->scale, - event->y / g->bw->scale, - 0, 100) != true) { - /* core did not handle event change vertical - * adjustment. - */ - - value = gtk_adjustment_get_value(vscroll) + - (nsgtk_adjustment_get_step_increment(vscroll) * 2); + /* Vertical */ + if (deltay != 0) { + value = gtk_adjustment_get_value(vscroll) + deltay; + /* @todo consider gtk_widget_get_allocated_height */ nsgtk_widget_get_allocation(GTK_WIDGET(g->layout), &alloc); - if (value > nsgtk_adjustment_get_upper(vscroll) - alloc.height) { - value = nsgtk_adjustment_get_upper(vscroll) - - alloc.height; + if (value > (nsgtk_adjustment_get_upper(vscroll) - alloc.height)) { + value = nsgtk_adjustment_get_upper(vscroll) - alloc.height; + } + if (value < nsgtk_adjustment_get_lower(vscroll)) { + value = nsgtk_adjustment_get_lower(vscroll); } gtk_adjustment_set_value(vscroll, value); } - break; - - default: - break; } return TRUE; @@ -603,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); } @@ -673,14 +663,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, g->status_bar = GTK_LABEL(gtk_builder_get_object(xml, "status_bar")); g->paned = GTK_PANED(gtk_builder_get_object(xml, "hpaned1")); - /* connect the scrollbars to the layout widget */ - nsgtk_layout_set_hadjustment(g->layout, - gtk_range_get_adjustment(GTK_RANGE( - gtk_builder_get_object(xml, "hscrollbar")))); - nsgtk_layout_set_vadjustment(g->layout, - gtk_range_get_adjustment(GTK_RANGE( - gtk_builder_get_object(xml, "vscrollbar")))); - /* add the tab to the scaffold */ bool tempback = true; switch (temp_open_background) { @@ -744,7 +726,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, nsgtk_window_keypress_event, g); CONNECT(g->layout, "size_allocate", nsgtk_window_size_allocate_event, g); - CONNECT(g->layout, "scroll_event", + CONNECT(g->layout, "scroll-event", nsgtk_window_scroll_event, g); return g; } @@ -1095,7 +1077,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, } -void gui_drag_save_selection(struct selection *s, struct gui_window *g) +void gui_drag_save_selection(struct gui_window *g, const char *selection) { } diff --git a/image/gif.c b/image/gif.c index 704c9710b..4bd45c7fe 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 518dc8552..325d1d192 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/Makefile b/javascript/Makefile index ac73ee716..693ed6541 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -35,7 +35,7 @@ D_JSAPI_BINDING += $(patsubst %.c,%.d,$(2)) $(2): $(1) $(OBJROOT)/created $$(VQ)echo " GENBIND: $(1)" - $(Q)nsgenbind -I javascript/WebIDL -d $(patsubst %.c,%.d,$(2)) -h $(3) -o $(2) $(1) + $(Q)nsgenbind -g -I javascript/WebIDL -d $(patsubst %.c,%.d,$(2)) -h $(3) -o $(2) $(1) $(3): $(2) diff --git a/javascript/WebIDL/console.idl b/javascript/WebIDL/console.idl index 309b976da..5a3d9eb27 100644 --- a/javascript/WebIDL/console.idl +++ b/javascript/WebIDL/console.idl @@ -17,4 +17,8 @@ interface Console { void timeEnd(DOMString timerName); void trace(); void warn(DOMString msg, Substitition... subst); +}; + +partial interface Window { + readonly attribute Console console; };
\ No newline at end of file diff --git a/javascript/js.h b/javascript/js.h index 44de4fe3d..7102fcf0e 100644 --- a/javascript/js.h +++ b/javascript/js.h @@ -26,6 +26,8 @@ typedef struct jscontext jscontext; typedef struct jsobject jsobject; +typedef bool(jscallback)(void *ctx); + struct dom_document; struct dom_node; struct dom_string; @@ -38,9 +40,13 @@ void js_finalise(void); /** Create a new javascript context. * - * There aare usually one context per browser context + * There is usually one context per browser context + * + * \param timeout elapsed wallclock time (in seconds) before \a callback is called + * \param cb the callback when the runtime exceeds the timeout + * \param cbctx The context to pass to the callback */ -jscontext *js_newcontext(void); +jscontext *js_newcontext(int timeout, jscallback *cb, void *cbctx); /** Destroy a previously created context */ void js_destroycontext(jscontext *ctx); diff --git a/javascript/jsapi.c b/javascript/jsapi.c index 7b68fe975..f8e3889e9 100644 --- a/javascript/jsapi.c +++ b/javascript/jsapi.c @@ -16,6 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <unistd.h> +#include <signal.h> + #include "javascript/jsapi.h" #include "render/html_internal.h" #include "content/content.h" @@ -27,6 +30,8 @@ #include "window.h" #include "event.h" +#define ENABLE_JS_HEARTBEAT 1 + static JSRuntime *rt; /* global runtime */ void js_initialise(void) @@ -56,7 +61,8 @@ void js_finalise(void) } /* The error reporter callback. */ -static void js_reportError(JSContext *cx, const char *message, JSErrorReport *report) +static void +js_reportError(JSContext *cx, const char *message, JSErrorReport *report) { JSLOG("%s:%u:%s", report->filename ? report->filename : "<no filename>", @@ -64,7 +70,250 @@ static void js_reportError(JSContext *cx, const char *message, JSErrorReport *re message); } -jscontext *js_newcontext(void) +/* heartbeat routines */ +#ifndef ENABLE_JS_HEARTBEAT + +struct heartbeat; + +/* prepares a context with a heartbeat handler */ +static bool +setup_heartbeat(JSContext *cx, int timeout, jscallback *cb, void *cbctx) +{ + return true; +} + +/* enables the heartbeat on a context */ +static struct heartbeat *enable_heartbeat(JSContext *cx) +{ + return NULL; +} + +/* disables heartbeat on a context */ +static bool +disable_heartbeat(struct heartbeat *hb) +{ + return true; +} + +#else + +/* private context for heartbeats */ +struct jscontext_priv { + int timeout; + jscallback *cb; + void *cbctx; + + unsigned int branch_reset; /**< reset value for branch counter */ + unsigned int branch_count; /**< counter for branch callback */ + time_t last; /**< last time heartbeat happened */ + time_t end; /**< end time for the current script execution */ +}; + +/** execution heartbeat */ +static JSBool heartbeat_callback(JSContext *cx) +{ + struct jscontext_priv *priv = JS_GetContextPrivate(cx); + JSBool ret = JS_TRUE; + time_t now = time(NULL); + + /* dynamically update the branch times to ensure we do not get + * called back more than once a second + */ + if (now == priv->last) { + priv->branch_reset = priv->branch_reset * 2; + } + priv->last = now; + + JSLOG("Running heatbeat at %d end %d", now , priv->end); + + if ((priv->cb != NULL) && + (now > priv->end)) { + if (priv->cb(priv->cbctx) == false) { + ret = JS_FALSE; /* abort */ + } else { + priv->end = time(NULL) + priv->timeout; + } + } + + return ret; +} + +#if JS_VERSION >= 180 + +struct heartbeat { + JSContext *cx; + struct sigaction sact; /* signal handler action to restore */ + int alm; /* alarm value to restore */ +}; + +static struct heartbeat *cur_hb; + +static bool +setup_heartbeat(JSContext *cx, int timeout, jscallback *cb, void *cbctx) +{ + struct jscontext_priv *priv; + + if (timeout == 0) { + return true; + } + + priv = calloc(1, sizeof(*priv)); + if (priv == NULL) { + return false; + } + + priv->timeout = timeout; + priv->cb = cb; + priv->cbctx = cbctx; + + JS_SetContextPrivate(cx, priv); + + /* if heartbeat is enabled disable JIT or callbacks do not happen */ + JS_SetOptions(cx, JS_GetOptions(cx) & ~JSOPTION_JIT); + + JS_SetOperationCallback(cx, heartbeat_callback); + + return true; +} + +static void sig_alm_handler(int signum) +{ + JS_TriggerOperationCallback(cur_hb->cx); + alarm(1); + JSDBG("alarm signal handler for context %p", cur_hb->cx); +} + +static struct heartbeat *enable_heartbeat(JSContext *cx) +{ + struct jscontext_priv *priv = JS_GetContextPrivate(cx); + struct sigaction sact; + struct heartbeat *hb; + + if (priv == NULL) { + return NULL; + } + + priv->last = time(NULL); + priv->end = priv->last + priv->timeout; + + hb = malloc(sizeof(*hb)); + if (hb != NULL) { + sigemptyset(&sact.sa_mask); + sact.sa_flags = 0; + sact.sa_handler = sig_alm_handler; + if (sigaction(SIGALRM, &sact, &hb->sact) == 0) { + cur_hb = hb; + hb->cx = cx; + hb->alm = alarm(1); + } else { + free(hb); + hb = NULL; + LOG(("Unable to set heartbeat")); + } + } + return hb; +} + +/** disable heartbeat + * + * /param hb heartbeat to disable may be NULL + * /return true on success. + */ +static bool +disable_heartbeat(struct heartbeat *hb) +{ + if (hb != NULL) { + sigaction(SIGALRM, &hb->sact, NULL); /* restore old handler */ + alarm(hb->alm); /* restore alarm signal */ + } + return true; +} + +#else + +/* need to setup callback to prevent long running scripts infinite + * hanging. + * + * old method is to use: + * JSBranchCallback JS_SetBranchCallback(JSContext *cx, JSBranchCallback cb); + * which gets called a *lot* and should only do something every 5k calls + * The callback function + * JSBool (*JSBranchCallback)(JSContext *cx, JSScript *script); + * returns JS_TRUE to carry on and JS_FALSE to abort execution + * single thread of execution on the context + * documented in + * https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_SetBranchCallback + * + */ + +#define INITIAL_BRANCH_RESET 5000 + +struct heartbeat; + +static JSBool branch_callback(JSContext *cx, JSScript *script) +{ + struct jscontext_priv *priv = JS_GetContextPrivate(cx); + JSBool ret = JS_TRUE; + + priv->branch_count--; + if (priv->branch_count == 0) { + priv->branch_count = priv->branch_reset; /* reset branch count */ + + ret = heartbeat_callback(cx); + } + return ret; +} + +static bool +setup_heartbeat(JSContext *cx, int timeout, jscallback *cb, void *cbctx) +{ + struct jscontext_priv *priv; + + if (timeout == 0) { + return true; + } + + priv = calloc(1, sizeof(*priv)); + if (priv == NULL) { + return false; + } + + priv->timeout = timeout; + priv->cb = cb; + priv->cbctx = cbctx; + + priv->branch_reset = INITIAL_BRANCH_RESET; + priv->branch_count = priv->branch_reset; + + JS_SetContextPrivate(cx, priv); + + JS_SetBranchCallback(cx, branch_callback); + + return true; +} + +static struct heartbeat *enable_heartbeat(JSContext *cx) +{ + struct jscontext_priv *priv = JS_GetContextPrivate(cx); + + if (priv != NULL) { + priv->last = time(NULL); + priv->end = priv->last + priv->timeout; + } + return NULL; +} + +static bool +disable_heartbeat(struct heartbeat *hb) +{ + return true; +} + +#endif + +#endif + +jscontext *js_newcontext(int timeout, jscallback *cb, void *cbctx) { JSContext *cx; @@ -76,10 +325,16 @@ jscontext *js_newcontext(void) if (cx == NULL) { return NULL; } - JS_SetOptions(cx, JSOPTION_VAROBJFIX | JSOPTION_JIT ); + + /* set options on context */ + JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_VAROBJFIX | JSOPTION_JIT); + JS_SetVersion(cx, JSVERSION_LATEST); JS_SetErrorReporter(cx, js_reportError); + /* run a heartbeat */ + setup_heartbeat(cx, timeout, cb, cbctx); + /*JS_SetGCZeal(cx, 2); */ JSLOG("New Context %p", cx); @@ -90,9 +345,15 @@ jscontext *js_newcontext(void) void js_destroycontext(jscontext *ctx) { JSContext *cx = (JSContext *)ctx; + struct jscontext_priv *priv; + if (cx != NULL) { JSLOG("Destroying Context %p", cx); + priv = JS_GetContextPrivate(cx); + JS_DestroyContext(cx); + + free(priv); } } @@ -124,10 +385,14 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv) return (jsobject *)window; } + + bool js_exec(jscontext *ctx, const char *txt, size_t txtlen) { JSContext *cx = (JSContext *)ctx; jsval rval; + JSBool eval_res; + struct heartbeat *hb; /* JSLOG("%p \"%s\"",cx ,txt); */ @@ -143,10 +408,16 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen) return false; } - if (JS_EvaluateScript(cx, - JS_GetGlobalObject(cx), - txt, txtlen, - "<head>", 0, &rval) == JS_TRUE) { + hb = enable_heartbeat(cx); + + eval_res = JS_EvaluateScript(cx, + JS_GetGlobalObject(cx), + txt, txtlen, + "<head>", 0, &rval); + + disable_heartbeat(hb); + + if (eval_res == JS_TRUE) { return true; } @@ -168,6 +439,7 @@ bool js_fire_event(jscontext *ctx, const char *type, dom_document *doc, dom_node dom_exception exc; dom_event *event; dom_string *type_dom; + struct heartbeat *hb; if (cx == NULL) { return false; @@ -201,6 +473,8 @@ bool js_fire_event(jscontext *ctx, const char *type, dom_document *doc, dom_node return false; } + hb = enable_heartbeat(cx); + /* dispatch event at the window object */ argv[0] = OBJECT_TO_JSVAL(jsevent); @@ -210,6 +484,9 @@ bool js_fire_event(jscontext *ctx, const char *type, dom_document *doc, dom_node 1, argv, &rval); + + disable_heartbeat(hb); + } else { JSLOG("Dispatching event %s at %p", type, node); @@ -264,15 +541,15 @@ js_dom_event_listener(struct dom_event *event, void *pw) jsevent = jsapi_new_Event(private->cx, NULL, NULL, event); if (jsevent != NULL) { - /* dispatch event at the window object */ - event_argv[0] = OBJECT_TO_JSVAL(jsevent); - - JS_CallFunctionValue(private->cx, - NULL, - private->funcval, - 1, - event_argv, - &event_rval); + /* dispatch event at the window object */ + event_argv[0] = OBJECT_TO_JSVAL(jsevent); + + JS_CallFunctionValue(private->cx, + NULL, + private->funcval, + 1, + event_argv, + &event_rval); } } } diff --git a/javascript/jsapi.h b/javascript/jsapi.h index e38188ab4..5b544b8fd 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -23,12 +23,21 @@ #ifndef _NETSURF_JAVASCRIPT_JSAPI_H_ #define _NETSURF_JAVASCRIPT_JSAPI_H_ +/* include the correct header */ #ifdef WITH_MOZJS #include "js/jsapi.h" #else #include "mozjs/jsapi.h" #endif +/* logging macros */ +#define JSLOG(args...) LOG((args)) +#ifdef ENABLE_VERBOSE_JS_DEBUG +#define JSDBG(args...) LOG((args)) +#else +#define JSDBG(args...) +#endif + #if JS_VERSION < 180 /************************** Spidermonkey 1.7.0 **************************/ @@ -146,8 +155,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_GCMARK(thing) JS_MarkGCThing(cx, thing, "object", arg) -/* Macros for manipulating GC root */ +#define JSAPI_MARKOP_RETURN(value) return value + +/* Macros for manipulating GC root */ #define JSAPI_ADD_OBJECT_ROOT(cx, obj) JS_AddRoot(cx, obj) #define JSAPI_REMOVE_OBJECT_ROOT(cx, obj) JS_RemoveRoot(cx, obj) @@ -261,6 +272,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_GCMARK(thing) JS_CallTracer(trc, thing, JSTRACE_OBJECT); +#define JSAPI_MARKOP_RETURN(value) return value + /* Macros for manipulating GC root */ #define JSAPI_ADD_OBJECT_ROOT(cx, obj) JS_AddRoot(cx, obj) #define JSAPI_REMOVE_OBJECT_ROOT(cx, obj) JS_RemoveRoot(cx, obj) @@ -351,21 +364,24 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, /* GC marking */ #ifdef JSCLASS_MARK_IS_TRACE -/* mark requires casting */ +/* mark function pointer requires casting */ #define JSAPI_JSCLASS_MARK_IS_TRACE JSCLASS_MARK_IS_TRACE #define JSAPI_JSCLASS_MARKOP(x) ((JSMarkOp)x) #else -/* mark does not require casting */ +/* mark function pointer does not require casting */ #define JSAPI_JSCLASS_MARK_IS_TRACE 0 #define JSAPI_JSCLASS_MARKOP(x) (x) #endif -#define JSAPI_MARKOP(name) JSBool name(JSTracer *trc, JSObject *obj) +#define JSAPI_MARKOP(name) void name(JSTracer *trc, JSObject *obj) #define JSAPI_MARKCX trc->context #define JSAPI_GCMARK(thing) JS_CallTracer(trc, thing, JSTRACE_OBJECT); +#define JSAPI_MARKOP_RETURN(value) + + /* Macros for manipulating GC root */ #define JSAPI_ADD_OBJECT_ROOT(cx, obj) JS_AddObjectRoot(cx, obj) #define JSAPI_REMOVE_OBJECT_ROOT(cx, obj) JS_RemoveObjectRoot(cx, obj) @@ -375,11 +391,6 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #endif -#define JSLOG(args...) LOG((args)) -#ifdef ENABLE_VERBOSE_JS_DEBUG -#define JSDBG(args...) LOG((args)) -#else -#define JSDBG(args...) -#endif +/************************** **************************/ #endif diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd index 6e7f56528..bd65d7cb5 100644 --- a/javascript/jsapi/htmldocument.bnd +++ b/javascript/jsapi/htmldocument.bnd @@ -60,6 +60,7 @@ binding document { } api finalise %{ + LOG(("jscontext:%p jsobject:%p private:%p", cx, obj, private)); if (private != NULL) { JSLOG("dom_document %p in content %p", private->node, private->htmlc); diff --git a/javascript/jsapi/navigator.bnd b/javascript/jsapi/navigator.bnd index 2fb0c2d0a..5a0bb395b 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/jsapi/window.bnd b/javascript/jsapi/window.bnd index b334cc7cc..cecc8fe72 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -11,6 +11,7 @@ webidlfile "html.idl"; webidlfile "dom.idl"; +webidlfile "console.idl"; hdrcomment "Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>"; hdrcomment "This file is part of NetSurf, http://www.netsurf-browser.org/"; @@ -61,6 +62,72 @@ struct browser_window *jsapi_get_browser_window(JSContext *cx) return NULL; } +static bool +init_user_prototypes(JSContext *cx, + struct jsclass_private *private, + JSObject *parent) +{ + /* Initialises all the user javascript classes to make their + * prototypes available. + */ + /** @todo should we be managing these prototype objects ourselves */ + private->prototype_Document = jsapi_InitClass_Document(cx, parent); + if (private->prototype_Document == NULL) { + return false; + } + + private->prototype_Navigator = jsapi_InitClass_Navigator(cx, parent); + if (private->prototype_Navigator == NULL) { + return false; + } + + private->prototype_Location = jsapi_InitClass_Location(cx, parent); + if (private->prototype_Location == NULL) { + return false; + } + + private->prototype_Console = jsapi_InitClass_Console(cx, parent); + if (private->prototype_Console == NULL) { + return false; + } + + private->prototype_HTMLElement = jsapi_InitClass_HTMLElement(cx, parent); + if (private->prototype_HTMLElement == NULL) { + return false; + } + + private->prototype_HTMLCollection = jsapi_InitClass_HTMLCollection(cx, parent); + if (private->prototype_HTMLCollection == NULL) { + return false; + } + + private->prototype_NodeList = jsapi_InitClass_NodeList(cx, parent); + if (private->prototype_NodeList == NULL) { + return false; + } + + private->prototype_Text = jsapi_InitClass_Text(cx, parent); + if (private->prototype_Text == NULL) { + return false; + } + + private->prototype_Comment = jsapi_InitClass_Comment(cx, parent); + if (private->prototype_Comment == NULL) { + return false; + } + + private->prototype_Node = jsapi_InitClass_Node(cx, parent); + if (private->prototype_Node == NULL) { + return false; + } + + private->prototype_Event = jsapi_InitClass_Event(cx, parent); + if (private->prototype_Event == NULL) { + return false; + } + return true; +} + %} binding window { @@ -71,23 +138,82 @@ binding window { private "struct browser_window *" bw; private "struct html_content *" htmlc; - internal "JSObject *" document; - internal "JSObject *" navigator; - internal "JSObject *" console; + /* prototypes held in this object */ + internal "JSObject *" prototype_Document; + internal "JSObject *" prototype_Navigator; + internal "JSObject *" prototype_Location; + internal "JSObject *" prototype_Console; + internal "JSObject *" prototype_HTMLElement; + internal "JSObject *" prototype_HTMLCollection; + internal "JSObject *" prototype_NodeList; + internal "JSObject *" prototype_Text; + internal "JSObject *" prototype_Comment; + internal "JSObject *" prototype_Node; + internal "JSObject *" prototype_Event; + /** document instantiated on first use */ + property unshared document; + + /** navigator instantiated on first use */ + property unshared navigator; + + /** console instantiated on first use */ + property unshared console; + + /** location is unshared */ + property unshared location; + + /** @todo instantiate forms, history etc. attributes */ + + /* events through a single interface */ property unshared type EventHandler; } api mark %{ + if (private != NULL) { - if (private->document != NULL) { - JSAPI_GCMARK(private->document); + if (private->prototype_Document != NULL) { + JSAPI_GCMARK(private->prototype_Document); + } + + if (private->prototype_Navigator != NULL) { + JSAPI_GCMARK(private->prototype_Navigator); + } + + if (private->prototype_Location != NULL) { + JSAPI_GCMARK(private->prototype_Location); + } + + if (private->prototype_Console != NULL) { + JSAPI_GCMARK(private->prototype_Console); + } + + if (private->prototype_HTMLElement != NULL) { + JSAPI_GCMARK(private->prototype_HTMLElement); } - if (private->navigator != NULL) { - JSAPI_GCMARK(private->navigator); + + if (private->prototype_HTMLCollection != NULL) { + JSAPI_GCMARK(private->prototype_HTMLCollection); + } + + if (private->prototype_NodeList != NULL) { + JSAPI_GCMARK(private->prototype_NodeList); + } + + if (private->prototype_Text != NULL) { + JSAPI_GCMARK(private->prototype_Text); + } + + if (private->prototype_Comment != NULL) { + JSAPI_GCMARK(private->prototype_Comment); } - if (private->console != NULL) { - JSAPI_GCMARK(private->console); + + if (private->prototype_Node != NULL) { + JSAPI_GCMARK(private->prototype_Node); + } + + if (private->prototype_Event != NULL) { + JSAPI_GCMARK(private->prototype_Event); } } %} @@ -96,8 +222,6 @@ api global %{ %} api init %{ - JSObject *user_proto; - prototype = JS_NewCompartmentAndGlobalObject(cx, &JSClass_Window, NULL); if (prototype == NULL) { return NULL; @@ -128,65 +252,8 @@ api init %{ if (!JS_DefineProperties(cx, prototype, jsclass_properties)) return NULL; - /* Initialises all the user javascript classes to make their - * prototypes available. - */ - /** @todo should we be managing these prototype objects ourselves */ - user_proto = jsapi_InitClass_Document(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_Navigator(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_Location(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_Console(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_HTMLElement(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_HTMLCollection(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_NodeList(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_Text(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_Comment(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_Node(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - - user_proto = jsapi_InitClass_Event(cx, prototype); - if (user_proto == NULL) { - return NULL; - } - + /* as the global just got changed, force a GC run */ + JS_GC(cx); %} api new %{ @@ -196,32 +263,45 @@ api new %{ /* the window object is the global so its prototype *is* the instance */ newobject = prototype; - /* instantiate the subclasses off the window global */ - private->document = jsapi_new_Document(cx, - NULL, - newobject, - (dom_document *)dom_node_ref(htmlc->document), - htmlc); - if (private->document == NULL) { + if (init_user_prototypes(cx, private, prototype) == false) { + /* prototype initialisation failed */ free(private); return NULL; } - private->navigator = jsapi_new_Navigator(cx, NULL, newobject); - if (private->navigator == NULL) { - free(private); - return NULL; + LOG(("Created new window object %p", newobject)); +%} + +getter document %{ + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { + /* already created - return it */ + return JS_TRUE; } - private->console = jsapi_new_Console(cx, NULL, newobject); - if (private->console == NULL) { - free(private); - return NULL; + /* instantiate the subclasses off the window global */ + jsret = jsapi_new_Document(cx, + NULL, + NULL, + (dom_document *)dom_node_ref(private->htmlc->document), + private->htmlc); +%} + +getter navigator %{ + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { + /* already created - return it */ + return JS_TRUE; } - /** @todo forms, history */ + jsret = jsapi_new_Navigator(cx, NULL, NULL); +%} - LOG(("Created new window object %p", newobject)); +getter console %{ + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { + /* already created - return it */ + return JS_TRUE; + } + + jsret = jsapi_new_Console(cx, NULL, NULL); %} operation confirm %{ @@ -273,9 +353,21 @@ operation dispatchEvent %{ %} getter location %{ + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { + /* already created - return it */ + return JS_TRUE; + } + +/* should get the docuemnts location jsval loc; JS_GetProperty(cx, private->document, "location", &loc); jsret = JSVAL_TO_OBJECT(loc); +*/ + + jsret = jsapi_new_Location(cx, + NULL, + NULL, + llcache_handle_get_url(private->htmlc->base.llcache)); %} getter window %{ @@ -286,6 +378,11 @@ getter self %{ jsret = obj; %} +/* very iffy implementation */ +getter top %{ + jsret = obj; +%} + getter EventHandler %{ /* this implementation is unique to the window object as it is * not a dom node. diff --git a/javascript/none.c b/javascript/none.c index 3e7b39cb3..d4b8ce565 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" @@ -35,7 +35,7 @@ void js_finalise(void) { } -jscontext *js_newcontext(void) +jscontext *js_newcontext(int timeout, jscallback *cb, void *cbctx) { return NULL; } diff --git a/monkey/Makefile.target b/monkey/Makefile.target index 05a32d005..6c60ca1c5 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/browser.c b/monkey/browser.c index 9d87f4471..09ecf4b11 100644 --- a/monkey/browser.c +++ b/monkey/browser.c @@ -314,7 +314,7 @@ gui_window_scroll_visible(struct gui_window *g, int x0, int y0, } void -gui_drag_save_selection(struct selection *s, struct gui_window *g) +gui_drag_save_selection(struct gui_window *g, const char *selection) { } diff --git a/monkey/font.c b/monkey/font.c index 7f390a49b..a45b7fdca 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 03421ef03..e806b0eb3 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" @@ -31,6 +31,7 @@ #include "desktop/gui.h" #include "desktop/netsurf.h" #include "desktop/sslcert.h" +#include "utils/log.h" #include "utils/filepath.h" #include "utils/url.h" @@ -91,10 +92,27 @@ static void quit_handler(int argc, char **argv) netsurf_quit = true; } -/* Documented in desktop/options.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) +{ + /* currently no default overrides */ + return NSERROR_OK; +} + +/** + * Ensures output logging stream is correctly configured + */ +static bool nslog_stream_configure(FILE *fptr) { - /* Set defaults for absent option strings */ + /* set log stream to be non-buffering */ + setbuf(fptr, NULL); + + return true; } int @@ -103,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); @@ -111,14 +130,29 @@ main(int argc, char **argv) /* Prep the search paths */ respaths = nsmonkey_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"MONKEY_RESPATH":./monkey/res"); - + + /* initialise logging. Not fatal if it fails but not much we can do + * about it either. + */ + nslog_init(nslog_stream_configure, &argc, argv); + + /* 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"); - messages = filepath_find(respaths, "Messages"); + nsoption_read(options, nsoptions); + free(options); + nsoption_commandline(&argc, argv, nsoptions); - netsurf_init(&argc, &argv, options, messages); - + /* common initialisation */ + messages = filepath_find(respaths, "Messages"); + ret = netsurf_init(messages); free(messages); - free(options); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } filepath_sfinddef(respaths, buf, "mime.types", "/etc/"); gtk_fetch_filetype_init(buf); @@ -139,5 +173,9 @@ main(int argc, char **argv) netsurf_exit(); fprintf(stdout, "GENERIC FINISHED\n"); + + /* finalise options */ + nsoption_finalise(nsoptions, nsoptions_default); + return 0; } diff --git a/monkey/options.h b/monkey/options.h index 88fb7e11b..57cce7e1f 100644 --- a/monkey/options.h +++ b/monkey/options.h @@ -1,5 +1,5 @@ /* - * Copyright 2006 Rob Kendrick <rjek@rjek.com> + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -16,66 +16,28 @@ * 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_ -#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/monkey/system_colour.c b/monkey/system_colour.c deleted file mode 100644 index 6c1fd81b5..000000000 --- a/monkey/system_colour.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 "desktop/options.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; -} diff --git a/render/box.c b/render/box.c index 5dfada0c0..1f2c9fe0e 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 78d0f6742..03e87e81d 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 a98a89ada..03c5a36fb 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 1ff1c7cc7..8fb35f8ff 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" @@ -145,6 +145,369 @@ static void html_box_convert_done(html_content *c, bool success) } +/** 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; + const char *url, *end, *refresh = NULL; + char *new_url; + char quote = '\0'; + dom_string *equiv, *content; + dom_exception exc; + nsurl *nsurl; + nserror error = NSERROR_OK; + + exc = dom_element_get_attribute(n, corestring_dom_http_equiv, &equiv); + if (exc != DOM_NO_ERR) { + return NSERROR_DOM; + } + + if (equiv == NULL) { + return NSERROR_OK; + } + + if (!dom_string_caseless_lwc_isequal(equiv, corestring_lwc_refresh)) { + dom_string_unref(equiv); + return NSERROR_OK; + } + + dom_string_unref(equiv); + + exc = dom_element_get_attribute(n, corestring_dom_content, &content); + if (exc != DOM_NO_ERR) { + return NSERROR_DOM; + } + + if (content == NULL) { + return NSERROR_OK; + } + + end = dom_string_data(content) + dom_string_byte_length(content); + + /* content := *LWS intpart fracpart? *LWS [';' *LWS *1url *LWS] + * intpart := 1*DIGIT + * fracpart := 1*('.' | DIGIT) + * url := "url" *LWS '=' *LWS (url-nq | url-sq | url-dq) + * url-nq := *urlchar + * url-sq := "'" *(urlchar | '"') "'" + * url-dq := '"' *(urlchar | "'") '"' + * urlchar := [#x9#x21#x23-#x26#x28-#x7E] | nonascii + * nonascii := [#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF] + */ + + url = dom_string_data(content); + + /* *LWS */ + while (url < end && isspace(*url)) { + url++; + } + + /* intpart */ + if (url == end || (*url < '0' || '9' < *url)) { + /* Empty content, or invalid timeval */ + dom_string_unref(content); + return NSERROR_OK; + } + + msg_data.delay = (int) strtol(url, &new_url, 10); + /* a very small delay and self-referencing URL can cause a loop + * that grinds machines to a halt. To prevent this we set a + * minimum refresh delay of 1s. */ + if (msg_data.delay < 1) { + msg_data.delay = 1; + } + + url = new_url; + + /* fracpart? (ignored, as delay is integer only) */ + while (url < end && (('0' <= *url && *url <= '9') || + *url == '.')) { + url++; + } + + /* *LWS */ + while (url < end && isspace(*url)) { + url++; + } + + /* ';' */ + if (url < end && *url == ';') + url++; + + /* *LWS */ + while (url < end && isspace(*url)) { + url++; + } + + if (url == end) { + /* Just delay specified, so refresh current page */ + dom_string_unref(content); + + c->base.refresh = nsurl_ref( + content_get_url(&c->base)); + + content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data); + + return NSERROR_OK; + } + + /* "url" */ + if (url <= end - 3) { + if (strncasecmp(url, "url", 3) == 0) { + url += 3; + } else { + /* Unexpected input, ignore this header */ + dom_string_unref(content); + return NSERROR_OK; + } + } else { + /* Insufficient input, ignore this header */ + dom_string_unref(content); + return NSERROR_OK; + } + + /* *LWS */ + while (url < end && isspace(*url)) { + url++; + } + + /* '=' */ + if (url < end) { + if (*url == '=') { + url++; + } else { + /* Unexpected input, ignore this header */ + dom_string_unref(content); + return NSERROR_OK; + } + } else { + /* Insufficient input, ignore this header */ + dom_string_unref(content); + return NSERROR_OK; + } + + /* *LWS */ + while (url < end && isspace(*url)) { + url++; + } + + /* '"' or "'" */ + if (url < end && (*url == '"' || *url == '\'')) { + quote = *url; + url++; + } + + /* Start of URL */ + refresh = url; + + if (quote != 0) { + /* url-sq | url-dq */ + while (url < end && *url != quote) + url++; + } else { + /* url-nq */ + while (url < end && !isspace(*url)) + url++; + } + + /* '"' or "'" or *LWS (we don't care) */ + if (url > refresh) { + /* There's a URL */ + new_url = strndup(refresh, url - refresh); + if (new_url == NULL) { + dom_string_unref(content); + return NSERROR_NOMEM; + } + + error = nsurl_join(c->base_url, new_url, &nsurl); + if (error == NSERROR_OK) { + /* broadcast valid refresh url */ + + c->base.refresh = nsurl; + + content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data); + c->refresh = true; + } + + free(new_url); + + } + + dom_string_unref(content); + + return error; +} + + /** * Complete conversion of an HTML document * @@ -222,9 +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)) { - html_css_process_link(htmlc, (dom_node *)node); + + 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); @@ -246,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); } @@ -308,6 +700,8 @@ html_create_html_data(html_content *c, const http_parameter *params) c->base_url = nsurl_ref(content_get_url(&c->base)); c->base_target = NULL; c->aborted = false; + c->refresh = false; + c->title = NULL; c->bctx = NULL; c->layout = NULL; c->background_colour = NS_TRANSPARENT; @@ -330,6 +724,8 @@ html_create_html_data(html_content *c, const http_parameter *params) c->selection_owner.none = true; c->focus_type = HTML_FOCUS_SELF; c->focus_owner.self = true; + c->search = NULL; + c->search_string = NULL; c->scripts_count = 0; c->scripts = NULL; c->jscontext = NULL; @@ -560,524 +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; -} - -static nserror html_meta_refresh_process_element(html_content *c, dom_node *n) -{ - union content_msg_data msg_data; - const char *url, *end, *refresh = NULL; - char *new_url; - char quote = '\0'; - dom_string *equiv, *content; - dom_exception exc; - nsurl *nsurl; - nserror error = NSERROR_OK; - - exc = dom_element_get_attribute(n, corestring_dom_http_equiv, &equiv); - if (exc != DOM_NO_ERR) { - return NSERROR_DOM; - } - - if (equiv == NULL) { - return NSERROR_OK; - } - - if (!dom_string_caseless_lwc_isequal(equiv, corestring_lwc_refresh)) { - dom_string_unref(equiv); - return NSERROR_OK; - } - - dom_string_unref(equiv); - - exc = dom_element_get_attribute(n, corestring_dom_content, &content); - if (exc != DOM_NO_ERR) { - return NSERROR_DOM; - } - - if (content == NULL) { - return NSERROR_OK; - } - - end = dom_string_data(content) + dom_string_byte_length(content); - - /* content := *LWS intpart fracpart? *LWS [';' *LWS *1url *LWS] - * intpart := 1*DIGIT - * fracpart := 1*('.' | DIGIT) - * url := "url" *LWS '=' *LWS (url-nq | url-sq | url-dq) - * url-nq := *urlchar - * url-sq := "'" *(urlchar | '"') "'" - * url-dq := '"' *(urlchar | "'") '"' - * urlchar := [#x9#x21#x23-#x26#x28-#x7E] | nonascii - * nonascii := [#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF] - */ - - url = dom_string_data(content); - - /* *LWS */ - while (url < end && isspace(*url)) { - url++; - } - - /* intpart */ - if (url == end || (*url < '0' || '9' < *url)) { - /* Empty content, or invalid timeval */ - dom_string_unref(content); - return NSERROR_OK; - } - - msg_data.delay = (int) strtol(url, &new_url, 10); - /* a very small delay and self-referencing URL can cause a loop - * that grinds machines to a halt. To prevent this we set a - * minimum refresh delay of 1s. */ - if (msg_data.delay < 1) { - msg_data.delay = 1; - } - - url = new_url; - - /* fracpart? (ignored, as delay is integer only) */ - while (url < end && (('0' <= *url && *url <= '9') || - *url == '.')) { - url++; - } - - /* *LWS */ - while (url < end && isspace(*url)) { - url++; - } - - /* ';' */ - if (url < end && *url == ';') - url++; - - /* *LWS */ - while (url < end && isspace(*url)) { - url++; - } - - if (url == end) { - /* Just delay specified, so refresh current page */ - dom_string_unref(content); - - c->base.refresh = nsurl_ref( - content_get_url(&c->base)); - - content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data); - - return NSERROR_OK; - } - - /* "url" */ - if (url <= end - 3) { - if (strncasecmp(url, "url", 3) == 0) { - url += 3; - } else { - /* Unexpected input, ignore this header */ - dom_string_unref(content); - return NSERROR_OK; - } - } else { - /* Insufficient input, ignore this header */ - dom_string_unref(content); - return NSERROR_OK; - } - - /* *LWS */ - while (url < end && isspace(*url)) { - url++; - } - - /* '=' */ - if (url < end) { - if (*url == '=') { - url++; - } else { - /* Unexpected input, ignore this header */ - dom_string_unref(content); - return NSERROR_OK; - } - } else { - /* Insufficient input, ignore this header */ - dom_string_unref(content); - return NSERROR_OK; - } - - /* *LWS */ - while (url < end && isspace(*url)) { - url++; - } - - /* '"' or "'" */ - if (url < end && (*url == '"' || *url == '\'')) { - quote = *url; - url++; - } - - /* Start of URL */ - refresh = url; - - if (quote != 0) { - /* url-sq | url-dq */ - while (url < end && *url != quote) - url++; - } else { - /* url-nq */ - while (url < end && !isspace(*url)) - url++; - } - - /* '"' or "'" or *LWS (we don't care) */ - if (url > refresh) { - /* There's a URL */ - new_url = strndup(refresh, url - refresh); - if (new_url == NULL) { - dom_string_unref(content); - return NSERROR_NOMEM; - } - - error = nsurl_join(c->base_url, new_url, &nsurl); - if (error == NSERROR_OK) { - /* broadcast valid refresh url */ - - c->base.refresh = nsurl; - - content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data); - } - - free(new_url); - - } - - dom_string_unref(content); - - return error; -} - -/** - * Search for meta refresh - * - * http://wp.netscape.com/assist/net_sites/pushpull.html - * - * \param c content structure - * \param head xml node of head element - * \return true on success, false otherwise (error reported) - */ - -static nserror html_meta_refresh(html_content *c, dom_node *head) -{ - dom_node *n, *next; - dom_exception exc; - nserror ns_error = NSERROR_OK; - - if (head == NULL) { - return ns_error; - } - - exc = dom_node_get_first_child(head, &n); - if (exc != DOM_NO_ERR) { - return NSERROR_DOM; - } - - while (n != NULL) { - dom_node_type type; - - exc = dom_node_get_node_type(n, &type); - if (exc != DOM_NO_ERR) { - dom_node_unref(n); - return NSERROR_DOM; - } - - if (type == DOM_ELEMENT_NODE) { - dom_string *name; - - exc = dom_node_get_node_name(n, &name); - if (exc != DOM_NO_ERR) { - dom_node_unref(n); - return NSERROR_DOM; - } - - /* Recurse into noscript elements */ - if (dom_string_caseless_lwc_isequal(name, corestring_lwc_noscript)) { - ns_error = html_meta_refresh(c, n); - if (ns_error != NSERROR_OK) { - /* Some error occurred */ - dom_string_unref(name); - dom_node_unref(n); - return ns_error; - } else if (c->base.refresh != NULL) { - /* Meta refresh found - stop */ - dom_string_unref(name); - dom_node_unref(n); - return NSERROR_OK; - } - } else if (dom_string_caseless_lwc_isequal(name, corestring_lwc_meta)) { - ns_error = html_meta_refresh_process_element(c, n); - if (ns_error != NSERROR_OK) { - /* Some error occurred */ - dom_string_unref(name); - dom_node_unref(n); - return ns_error; - } else if (c->base.refresh != NULL) { - /* Meta refresh found - stop */ - dom_string_unref(name); - dom_node_unref(n); - return NSERROR_OK; - } - } - dom_string_unref(name); - } - - exc = dom_node_get_next_sibling(n, &next); - if (exc != DOM_NO_ERR) { - dom_node_unref(n); - return NSERROR_DOM; - } - - dom_node_unref(n); - n = next; - } - - return ns_error; -} - - - - - - /** * Convert a CONTENT_HTML for display. * @@ -1132,25 +1010,22 @@ static bool html_convert(struct content *c) bool html_can_begin_conversion(html_content *htmlc) { unsigned int i; - bool got_modified_stylesheet = false; + + if (htmlc->base.active != 0) + return false; for (i = 0; i != htmlc->stylesheet_count; i++) { - if (htmlc->stylesheets[i].modified) { - got_modified_stylesheet = true; - break; - } + if (htmlc->stylesheets[i].modified) + return false; } - if (htmlc->base.active != 0 || got_modified_stylesheet) - return false; - return true; } 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 */ @@ -1222,28 +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; - } - - /* handle meta refresh */ - ns_error = html_meta_refresh(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); @@ -1267,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; } @@ -1279,7 +1131,6 @@ html_begin_conversion(html_content *htmlc) NSERROR_NOMEM); dom_node_unref(html); - dom_node_unref(head); return false; } @@ -1290,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) { @@ -1378,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)); } @@ -1510,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 */ @@ -2006,36 +1861,6 @@ static void html_debug_dump(struct content *c, FILE *f) } -/** - * Set an HTML content's search context - * - * \param c content of type html - * \param s search context, or NULL if none - */ - -void html_set_search(struct content *c, struct search_context *s) -{ - html_content *html = (html_content *) c; - - html->search = s; -} - - -/** - * Return an HTML content's search context - * - * \param c content of type html - * \return content's search context, or NULL if none - */ - -struct search_context *html_get_search(struct content *c) -{ - html_content *html = (html_content *) c; - - return html->search; -} - - #if ALWAYS_DUMP_FRAMESET /** * Print a frameset tree to stderr. @@ -2276,6 +2101,8 @@ static const content_handler html_content_handler = { .get_contextual_content = html_get_contextual_content, .scroll_at_point = html_scroll_at_point, .drop_file_at_point = html_drop_file_at_point, + .search = html_search, + .search_clear = html_search_clear, .debug_dump = html_debug_dump, .clone = html_clone, .type = html_content_type, diff --git a/render/html_css.c b/render/html_css.c index 7c0962070..bf20dcf14 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" @@ -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)))); @@ -551,7 +554,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/render/html_interaction.c b/render/html_interaction.c index a5f263b68..6f4d9bd51 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" @@ -43,6 +43,7 @@ #include "render/form.h" #include "render/html_internal.h" #include "render/imagemap.h" +#include "render/search.h" #include "javascript/js.h" #include "utils/messages.h" #include "utils/utils.h" @@ -847,9 +848,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (selection_defined(&html->sel)) { sel_owner.none = false; html_set_selection(html, HTML_SELECTION_SELF, - sel_owner, - selection_read_only( - &html->sel)); + sel_owner, true); } else if (click && html->selection_type != HTML_SELECTION_NONE) { sel_owner.none = true; @@ -954,7 +953,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, /** * Handle keypresses. * - * \param c content of type CONTENT_TEXTPLAIN + * \param c content of type HTML * \param key The UCS4 character codepoint * \return true if key handled, false otherwise */ @@ -1007,6 +1006,79 @@ bool html_keypress(struct content *c, uint32_t key) /** + * Handle search. + * + * \param c content of type HTML + * \param gui_callbacks vtable for updating front end + * \param gui_data front end private data + * \param flags search flags + * \param string search string + */ +void html_search(struct content *c, + struct gui_search_callbacks *gui_callbacks, void *gui_data, + search_flags_t flags, const char *string) +{ + html_content *html = (html_content *)c; + + assert(c != NULL); + + if (string != NULL && html->search_string != NULL && + strcmp(string, html->search_string) == 0 && + html->search != NULL) { + /* Continue prev. search */ + search_step(html->search, flags, string); + + } else if (string != NULL) { + /* New search */ + free(html->search_string); + html->search_string = strdup(string); + if (html->search_string == NULL) + return; + + if (html->search != NULL) { + search_destroy_context(html->search); + html->search = NULL; + } + + html->search = search_create_context(c, CONTENT_HTML, + gui_callbacks, gui_data); + + if (html->search == NULL) + return; + + search_step(html->search, flags, string); + + } else { + /* Clear search */ + html_search_clear(c); + + free(html->search_string); + html->search_string = NULL; + } +} + + +/** + * Terminate a search. + * + * \param c content of type HTML + */ +void html_search_clear(struct content *c) +{ + html_content *html = (html_content *)c; + + assert(c != NULL); + + free(html->search_string); + html->search_string = NULL; + + if (html->search != NULL) + search_destroy_context(html->search); + html->search = NULL; +} + + +/** * Callback for in-page scrollbars. */ void html_overflow_scroll_callback(void *client_data, diff --git a/render/html_internal.h b/render/html_internal.h index a78dc8f8a..43fce9bfd 100644 --- a/render/html_internal.h +++ b/render/html_internal.h @@ -90,6 +90,12 @@ typedef struct html_content { /** Content has been aborted in the LOADING state */ bool aborted; + /** 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. */ @@ -161,6 +167,8 @@ typedef struct html_content { /** Context for free text search, or NULL if none */ struct search_context *search; + /** Search string or NULL */ + char *search_string; } html_content; @@ -210,8 +218,6 @@ void html_set_focus(html_content *html, html_focus_type focus_type, struct browser_window *html_get_browser_window(struct content *c); -struct search_context *html_get_search(struct content *c); -void html_set_search(struct content *c, struct search_context *s); /** * Complete conversion of an HTML document @@ -247,6 +253,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw, bool html_keypress(struct content *c, uint32_t key); void html_overflow_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data); +void html_search(struct content *c, + struct gui_search_callbacks *gui_callbacks, void *gui_data, + search_flags_t flags, const char *string); +void html_search_clear(struct content *c); /* in render/html_script.c */ diff --git a/render/html_object.c b/render/html_object.c index d4d0ff9d2..aad0daca6 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" @@ -203,6 +203,7 @@ html_object_callback(hlcache_handle *object, break; case CONTENT_MSG_REFORMAT: + case CONTENT_MSG_REDIRECT: break; case CONTENT_MSG_REDRAW: diff --git a/render/html_redraw.c b/render/html_redraw.c index 1abe14375..13cffe6ed 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" @@ -1482,9 +1482,9 @@ static bool html_redraw_background(int x, int y, struct box *box, float scale, bg_data.repeat_x = repeat_x; bg_data.repeat_y = repeat_y; - if (!content_redraw(background->background, - &bg_data, &r, ctx)) - return false; + /* We just continue if redraw fails */ + content_redraw(background->background, + &bg_data, &r, ctx); } } @@ -1634,8 +1634,8 @@ static bool html_redraw_inline_background(int x, int y, struct box *box, bg_data.repeat_x = repeat_x; bg_data.repeat_y = repeat_y; - if (!content_redraw(box->background, &bg_data, &r, ctx)) - return false; + /* We just continue if redraw fails */ + content_redraw(box->background, &bg_data, &r, ctx); } } @@ -2065,8 +2065,8 @@ bool html_redraw_box(const html_content *html, struct box *box, if (r.y0 < clip->y0) r.y0 = clip->y0; if (clip->x1 < r.x1) r.x1 = clip->x1; if (clip->y1 < r.y1) r.y1 = clip->y1; - /* no point trying to draw 0-width/height boxes */ - if (r.x0 == r.x1 || r.y0 == r.y1) + /* Nothing to do for invalid rectangles */ + if (r.x0 >= r.x1 || r.y0 >= r.y1) /* not an error */ return ((!plot->group_end) || (plot->group_end())); /* clip to it */ diff --git a/render/html_script.c b/render/html_script.c index 89d67413e..4aa8aff11 100644 --- a/render/html_script.c +++ b/render/html_script.c @@ -285,12 +285,6 @@ convert_script_sync_cb(hlcache_handle *script, assert(i != parent->scripts_count); switch (event->type) { - case CONTENT_MSG_LOADING: - break; - - case CONTENT_MSG_READY: - break; - case CONTENT_MSG_DONE: LOG(("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script)))); @@ -339,10 +333,18 @@ convert_script_sync_cb(hlcache_handle *script, break; + case CONTENT_MSG_LOADING: + case CONTENT_MSG_READY: case CONTENT_MSG_STATUS: + case CONTENT_MSG_REDIRECT: + /* messages content handler will legitamately recive + * but does not need to handle + */ break; default: + /* all other messages are unexpected and fatal */ + LOG(("Unhandled message type %d", event->type)); assert(0); } diff --git a/render/layout.c b/render/layout.c index d560a6d9c..fd518d993 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" @@ -2911,7 +2911,8 @@ bool layout_line(struct box *first, int *width, int *y, if ((d->type == BOX_INLINE && d->inline_end) || d->type == BOX_BR || d->type == BOX_TEXT || - d->type == BOX_INLINE_END) { + d->type == BOX_INLINE_END || + d->object != NULL) { css_fixed value = 0; css_unit unit = CSS_UNIT_PX; switch (css_computed_vertical_align(d->style, &value, @@ -4957,6 +4958,22 @@ static void layout_get_box_bbox(struct box *box, int *desc_x0, int *desc_y0, box->border[RIGHT].width; *desc_y1 = box->padding[TOP] + box->height + box->padding[BOTTOM] + box->border[BOTTOM].width; + + /* To stop the top of text getting clipped when css line-height is + * reduced, we increase the top of the descendant bbox. */ + if (box->type == BOX_BLOCK && box->style != NULL && + css_computed_overflow(box->style) == + CSS_OVERFLOW_VISIBLE && + box->object == NULL) { + css_fixed font_size = 0; + css_unit font_unit = CSS_UNIT_PT; + int text_height; + + css_computed_font_size(box->style, &font_size, &font_unit); + text_height = nscss_len2px(font_size, font_unit, box->style); + + *desc_y0 = (*desc_y0 < -text_height) ? *desc_y0 : -text_height; + } } diff --git a/render/search.c b/render/search.c index d30c43f11..895cff0a1 100644 --- a/render/search.c +++ b/render/search.c @@ -63,36 +63,27 @@ struct list_entry { }; struct search_context { - struct search_callbacks callbacks; - struct content *c; - struct list_entry *found; - struct list_entry *current; /* first for select all */ - char *string; - bool prev_case_sens; - bool newsearch; - bool is_html; + struct gui_search_callbacks *gui; + void *gui_p; + struct content *c; + struct list_entry *found; + struct list_entry *current; /* first for select all */ + char *string; + bool prev_case_sens; + bool newsearch; + bool is_html; }; -/** - * create a search_context - * \param h the hlcache_handle the search_context is connected to - * \param callbacks the callbacks to modify appearance according to results - * \param p the pointer to send to the callbacks - * \return true for success - */ -struct search_context * search_create_context(hlcache_handle *h, - struct search_callbacks callbacks) +/* Exported function documented in search.h */ +struct search_context * search_create_context(struct content *c, + content_type type, struct gui_search_callbacks *callbacks, + void *gui_data) { struct search_context *context; struct list_entry *search_head; - struct content *c = hlcache_handle_get_content(h); - - if (h == NULL) - return NULL; - if (content_get_type(h) != CONTENT_HTML && - content_get_type(h) != CONTENT_TEXTPLAIN) { + if (type != CONTENT_HTML && type != CONTENT_TEXTPLAIN) { return NULL; } @@ -123,14 +114,9 @@ struct search_context * search_create_context(hlcache_handle *h, context->prev_case_sens = false; context->newsearch = true; context->c = c; - context->is_html = (content_get_type(h) == CONTENT_HTML) ? true : false; - context->callbacks = callbacks; - - if (context->is_html) { - html_set_search(context->c, context); - } else { - textplain_set_search(context->c, context); - } + context->is_html = (type == CONTENT_HTML) ? true : false; + context->gui = callbacks; + context->gui_p = gui_data; return context; } @@ -149,8 +135,8 @@ static void free_matches(struct search_context *context) a = context->found->next; /* empty the list before clearing and deleting the - selections because the the clearing updates the - screen immediately, causing nested accesses to the list */ + * selections because the the clearing updates the + * screen immediately, causing nested accesses to the list */ context->found->prev = NULL; context->found->next = NULL; @@ -241,11 +227,11 @@ static const char *find_pattern(const char *string, int s_len, } matches = true; - } - else + } else { matches = false; - } - else if (s < es) { + } + + } else if (s < es) { char ch = *p; if (ch == '#') matches = true; @@ -259,16 +245,17 @@ static const char *find_pattern(const char *string, int s_len, ss = s; /* remember first non-'*' char */ first = false; } - } - else + } else { matches = false; + } if (matches) { p++; s++; - } - else { - /* doesn't match, resume with stacked context if we have one */ - if (--top < 0) return NULL; /* no match, give up */ + } else { + /* doesn't match, + * resume with stacked context if we have one */ + if (--top < 0) + return NULL; /* no match, give up */ ss = context[top].ss; s = context[top].s; @@ -309,10 +296,12 @@ static struct list_entry *add_entry(unsigned start_idx, unsigned end_idx, entry->next = 0; entry->prev = context->found->prev; + if (context->found->prev == NULL) context->found->next = entry; else context->found->prev->next = entry; + context->found->prev = entry; return entry; @@ -347,7 +336,8 @@ static bool find_occurrences_html(const char *pattern, int p_len, const char *pos = find_pattern(text, length, pattern, p_len, case_sens, &match_length); - if (!pos) break; + if (!pos) + break; /* found string in box => add to list */ match_offset = pos - cur->text; @@ -409,7 +399,8 @@ static bool find_occurrences_text(const char *pattern, int p_len, const char *pos = find_pattern(text, length, pattern, p_len, case_sens, &match_length); - if (!pos) break; + if (!pos) + break; /* found string in line => add to list */ start_idx = offset + (pos - text); @@ -461,9 +452,6 @@ static void search_text(const char *string, int string_len, return; } - /* LOG(("do_search '%s' - '%s' (%p, %p) %p (%d, %d) %d", - search_data.string, string, search_data.content, c, search_data.found->next, - search_data.prev_case_sens, case_sens, forwards)); */ /* check if we need to start a new search or continue an old one */ if (context->newsearch) { @@ -471,6 +459,7 @@ static void search_text(const char *string, int string_len, if (context->string != NULL) free(context->string); + context->current = NULL; free_matches(context); @@ -480,10 +469,8 @@ static void search_text(const char *string, int string_len, context->string[string_len] = '\0'; } - if ((context->callbacks.gui != NULL) && - (context->callbacks.gui->hourglass != NULL)) - context->callbacks.gui->hourglass(true, - context->callbacks.gui_p); + if ((context->gui != NULL) && (context->gui->hourglass != NULL)) + context->gui->hourglass(true, context->gui_p); if (context->is_html == true) { res = find_occurrences_html(string, string_len, @@ -495,53 +482,48 @@ static void search_text(const char *string, int string_len, if (!res) { free_matches(context); - if ((context->callbacks.gui != NULL) && - (context->callbacks.gui->hourglass != - NULL)) - context->callbacks.gui->hourglass(false, - context->callbacks.gui_p); + if ((context->gui != NULL) && + (context->gui->hourglass != NULL)) + context->gui->hourglass(false, context->gui_p); return; } - if ((context->callbacks.gui != NULL) && - (context->callbacks.gui->hourglass != NULL)) - context->callbacks.gui->hourglass(false, - context->callbacks.gui_p); + if ((context->gui != NULL) && + (context->gui->hourglass != NULL)) + context->gui->hourglass(false, context->gui_p); context->prev_case_sens = case_sensitive; -/* LOG(("%d %p %p (%p, %p)", new, search_data.found->next, search_data.current, - search_data.current->prev, search_data.current->next)); */ + /* new search, beginning at the top of the page */ context->current = context->found->next; context->newsearch = false; - } - else if (context->current != NULL) { + + } else if (context->current != NULL) { /* continued search in the direction specified */ if (forwards) { if (context->current->next) context->current = context->current->next; - } - else { + } else { if (context->current->prev) context->current = context->current->prev; } } - if (context->callbacks.gui == NULL) + if (context->gui == NULL) return; - if (context->callbacks.gui->status != NULL) - context->callbacks.gui->status((context->current != NULL), - context->callbacks.gui_p); + if (context->gui->status != NULL) + context->gui->status((context->current != NULL), + context->gui_p); + search_show_all(showall, context); - if (context->callbacks.gui->back_state != NULL) - context->callbacks.gui->back_state((context->current != NULL) && + if (context->gui->back_state != NULL) + context->gui->back_state((context->current != NULL) && (context->current->prev != NULL), - context->callbacks.gui_p); - if (context->callbacks.gui->forward_state != NULL) - context->callbacks.gui->forward_state( - (context->current != NULL) && - (context->current->next != NULL), - context->callbacks.gui_p); + context->gui_p); + if (context->gui->forward_state != NULL) + context->gui->forward_state((context->current != NULL) && + (context->current->next != NULL), + context->gui_p); if (context->current == NULL) return; @@ -569,45 +551,34 @@ static void search_text(const char *string, int string_len, } -/** - * Begins/continues the search process - * Note that this may be called many times for a single search. - * - * \param bw the browser_window to search in - * \param flags the flags forward/back etc - * \param string the string to match - */ - +/* Exported function documented in search.h */ void search_step(struct search_context *context, search_flags_t flags, const char *string) { int string_len; int i = 0; - if ((context == NULL) || (context->callbacks.gui == NULL)) { + if ((context == NULL) || (context->gui == NULL)) { warn_user("SearchError", 0); return; } - if (context->callbacks.gui->add_recent != NULL) - context->callbacks.gui->add_recent(string, - context->callbacks.gui_p); + if (context->gui->add_recent != NULL) + context->gui->add_recent(string, context->gui_p); string_len = strlen(string); - for(i = 0; i < string_len; i++) - if (string[i] != '#' && string[i] != '*') break; + for (i = 0; i < string_len; i++) + if (string[i] != '#' && string[i] != '*') + break; if (i >= string_len) { union content_msg_data msg_data; free_matches(context); - if (context->callbacks.gui->status != NULL) - context->callbacks.gui->status(true, - context->callbacks.gui_p); - if (context->callbacks.gui->back_state != NULL) - context->callbacks.gui->back_state(false, - context->callbacks.gui_p); - if (context->callbacks.gui->forward_state != NULL) - context->callbacks.gui->forward_state(false, - context->callbacks.gui_p); + if (context->gui->status != NULL) + context->gui->status(true, context->gui_p); + if (context->gui->back_state != NULL) + context->gui->back_state(false, context->gui_p); + if (context->gui->forward_state != NULL) + context->gui->forward_state(false, context->gui_p); msg_data.scroll.area = false; msg_data.scroll.x0 = 0; @@ -619,18 +590,7 @@ void search_step(struct search_context *context, search_flags_t flags, } -/** - * Determines whether any portion of the given text box should be - * selected because it matches the current search string. - * - * \param bw browser window - * \param start_offset byte offset within text of string to be checked - * \param end_offset byte offset within text - * \param start_idx byte offset within string of highlight start - * \param end_idx byte offset of highlight end - * \return true iff part of the box should be highlighted - */ - +/* Exported function documented in search.h */ bool search_term_highlighted(struct content *c, unsigned start_offset, unsigned end_offset, unsigned *start_idx, unsigned *end_idx, @@ -638,11 +598,11 @@ bool search_term_highlighted(struct content *c, { if (c == context->c) { struct list_entry *a; - for(a = context->found->next; a; a = a->next) + for (a = context->found->next; a; a = a->next) if (a->sel && selection_defined(a->sel) && - selection_highlighted(a->sel, - start_offset, end_offset, - start_idx, end_idx)) + selection_highlighted(a->sel, + start_offset, end_offset, + start_idx, end_idx)) return true; } @@ -650,11 +610,7 @@ bool search_term_highlighted(struct content *c, } -/** - * Specifies whether all matches or just the current match should - * be highlighted in the search text. - */ - +/* Exported function documented in search.h */ void search_show_all(bool all, struct search_context *context) { struct list_entry *a; @@ -693,29 +649,14 @@ void search_show_all(bool all, struct search_context *context) } -/** - * Ends the search process, invalidating all state - * freeing the list of found boxes - */ +/* Exported function documented in search.h */ void search_destroy_context(struct search_context *context) { assert(context != NULL); - if (context->callbacks.invalidate != NULL) { - context->callbacks.invalidate(context, context->callbacks.p); - } - - if (context->c != NULL) { - - if (context->is_html) - html_set_search(context->c, NULL); - else - textplain_set_search(context->c, NULL); - } - if ((context->string != NULL) && (context->callbacks.gui != NULL) && - (context->callbacks.gui->add_recent != NULL)) { - context->callbacks.gui->add_recent(context->string, - context->callbacks.gui_p); + if ((context->string != NULL) && (context->gui != NULL) && + (context->gui->add_recent != NULL)) { + context->gui->add_recent(context->string, context->gui_p); free(context->string); } free_matches(context); diff --git a/render/search.h b/render/search.h index e1f58f2ae..43c93b3ab 100644 --- a/render/search.h +++ b/render/search.h @@ -27,29 +27,52 @@ struct search_context; /** - * Called when a search context is destroyed - * \param context search context being invalidated - * \param p pointer for client data + * create a search_context + * + * \param c the content the search_context is connected to + * \param type the content type of c + * \param callbacks the callbacks to modify appearance according to results + * \param p the pointer to send to the callbacks + * \return true for success */ -typedef void (*search_invalidate_callback)(struct search_context *context, - void *p); - -struct search_callbacks { - struct gui_search_callbacks *gui; - void *gui_p; /* private gui owned data */ - search_invalidate_callback invalidate; - void *p; /* private client data */ -}; +struct search_context * search_create_context(struct content *c, + content_type type, struct gui_search_callbacks *callbacks, + void *gui_data); - -struct search_context * search_create_context(struct hlcache_handle *h, - struct search_callbacks callbacks); +/** + * Ends the search process, invalidating all state + * freeing the list of found boxes + */ void search_destroy_context(struct search_context *context); + +/** + * Begins/continues the search process + * Note that this may be called many times for a single search. + * + * \param bw the browser_window to search in + * \param flags the flags forward/back etc + * \param string the string to match + */ void search_step(struct search_context *context, search_flags_t flags, const char * string); -void search_show_all(bool all, struct search_context *context); +/** + * Specifies whether all matches or just the current match should + * be highlighted in the search text. + */ +void search_show_all(bool all, struct search_context *context); +/** + * Determines whether any portion of the given text box should be + * selected because it matches the current search string. + * + * \param bw browser window + * \param start_offset byte offset within text of string to be checked + * \param end_offset byte offset within text + * \param start_idx byte offset within string of highlight start + * \param end_idx byte offset of highlight end + * \return true iff part of the box should be highlighted + */ bool search_term_highlighted(struct content *c, unsigned start_offset, unsigned end_offset, unsigned *start_idx, unsigned *end_idx, diff --git a/render/table.c b/render/table.c index 4cc213dbc..5eba544b5 100644 --- a/render/table.c +++ b/render/table.c @@ -687,7 +687,6 @@ void table_used_bottom_border_for_cell(struct box *cell) if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; - a_src = b_src; } } diff --git a/render/textplain.c b/render/textplain.c index b9d0b81e5..10cf16a71 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" @@ -45,6 +45,7 @@ #include "render/search.h" #include "render/textplain.h" #include "render/html.h" +#include "render/search.h" #include "utils/http.h" #include "utils/log.h" #include "utils/messages.h" @@ -73,6 +74,8 @@ typedef struct textplain_content { /** Context for free text search, or NULL if none */ struct search_context *search; + /** Current search string, or NULL if none */ + char *search_string; } textplain_content; @@ -109,6 +112,10 @@ static void textplain_mouse_track(struct content *c, struct browser_window *bw, static void textplain_mouse_action(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y); static bool textplain_keypress(struct content *c, uint32_t key); +static void textplain_search(struct content *c, + struct gui_search_callbacks *gui_callbacks, void *gui_data, + search_flags_t flags, const char *string); +static void textplain_search_clear(struct content *c); static void textplain_reformat(struct content *c, int width, int height); static void textplain_destroy(struct content *c); static bool textplain_redraw(struct content *c, struct content_redraw_data *data, @@ -117,7 +124,6 @@ static void textplain_open(struct content *c, struct browser_window *bw, struct content *page, struct object_params *params); void textplain_close(struct content *c); char *textplain_get_selection(struct content *c); -struct search_context *textplain_get_search(struct content *c); static nserror textplain_clone(const struct content *old, struct content **newc); static content_type textplain_content_type(void); @@ -142,6 +148,8 @@ static const content_handler textplain_content_handler = { .mouse_track = textplain_mouse_track, .mouse_action = textplain_mouse_action, .keypress = textplain_keypress, + .search = textplain_search, + .search_clear = textplain_search_clear, .redraw = textplain_redraw, .open = textplain_open, .close = textplain_close, @@ -759,6 +767,79 @@ bool textplain_keypress(struct content *c, uint32_t key) /** + * Handle search. + * + * \param c content of type text + * \param gui_callbacks vtable for updating front end + * \param gui_data front end private data + * \param flags search flags + * \param string search string + */ +void textplain_search(struct content *c, + struct gui_search_callbacks *gui_callbacks, void *gui_data, + search_flags_t flags, const char *string) +{ + textplain_content *text = (textplain_content *) c; + + assert(c != NULL); + + if (string != NULL && text->search_string != NULL && + strcmp(string, text->search_string) == 0 && + text->search != NULL) { + /* Continue prev. search */ + search_step(text->search, flags, string); + + } else if (string != NULL) { + /* New search */ + free(text->search_string); + text->search_string = strdup(string); + if (text->search_string == NULL) + return; + + if (text->search != NULL) { + search_destroy_context(text->search); + text->search = NULL; + } + + text->search = search_create_context(c, CONTENT_TEXTPLAIN, + gui_callbacks, gui_data); + + if (text->search == NULL) + return; + + search_step(text->search, flags, string); + + } else { + /* Clear search */ + textplain_search_clear(c); + + free(text->search_string); + text->search_string = NULL; + } +} + + +/** + * Terminate a search. + * + * \param c content of type text + */ +void textplain_search_clear(struct content *c) +{ + textplain_content *text = (textplain_content *) c; + + assert(c != NULL); + + free(text->search_string); + text->search_string = NULL; + + if (text->search != NULL) + search_destroy_context(text->search); + text->search = NULL; +} + + +/** * Draw a CONTENT_TEXTPLAIN using the current set of plotters (plot). * * \param c content of type CONTENT_TEXTPLAIN @@ -943,36 +1024,6 @@ char *textplain_get_selection(struct content *c) return selection_get_copy(&text->sel); } - -/** - * Set an TEXTPLAIN content's search context - * - * \param c content of type text - * \param s search context, or NULL if none - */ - -void textplain_set_search(struct content *c, struct search_context *s) -{ - textplain_content *text = (textplain_content *) c; - - text->search = s; -} - - -/** - * Return an TEXTPLAIN content's search context - * - * \param c content of type text - * \return content's search context, or NULL if none - */ - -struct search_context *textplain_get_search(struct content *c) -{ - textplain_content *text = (textplain_content *) c; - - return text->search; -} - /** * Retrieve number of lines in content * diff --git a/render/textplain.h b/render/textplain.h index b7761a20d..c3f2a0f6a 100644 --- a/render/textplain.h +++ b/render/textplain.h @@ -47,6 +47,5 @@ int textplain_find_line(struct content *c, unsigned offset); char *textplain_get_raw_data(struct content *c, unsigned start, unsigned end, size_t *plen); struct browser_window *textplain_get_browser_window(struct content *c); -void textplain_set_search(struct content *c, struct search_context *s); #endif diff --git a/resources/FatMessages b/resources/FatMessages index 28cb9d439..52307835a 100644 --- a/resources/FatMessages +++ b/resources/FatMessages @@ -2077,6 +2077,146 @@ fr.gtk.gtkThemeAdd:Le thème a été ajouté avec succes it.gtk.gtkThemeAdd:Il tema è stato aggiunto con successo nl.gtk.gtkThemeAdd:Theme added successfully +# GTK preferences dialog + +en.gtk.preferencesTitle:Netsurf Preferences + +# Main tab +en.gtk.preferencesMainTabtitle:Main +en.gtk.preferencesStartup:<b>Startup</b> +en.gtk.preferencesStartupPage:Page: +en.gtk.preferencesStartupPageTooltip:The default startup page +en.gtk.preferencesStartupPageDefault:Use Default Page +en.gtk.preferencesStartupPageCurrent:Use Current Page +en.gtk.preferencesSearch:<b>Search</b> +en.gtk.preferencesSearchURLBar:Search from URL bar +en.gtk.preferencesSearchProvider:Provider: +en.gtk.preferencesSearchProviderTooltip:The default web search provider +en.gtk.preferencesDownloads:<b>Downloads</b> +en.gtk.preferencesDownloadsRemove:Remove download from list when complete +en.gtk.preferencesDownloadsConfirm:Confirm before overwriting files +en.gtk.preferencesDownloadsLocation:Location: +en.gtk.preferencesDownloadsLocationTooltip:The default location downloaded files are put + +# Appearance tab +en.gtk.preferencesAppearanceTabtitle:Appearance +en.gtk.preferencesThemes:<b>Themes</b> +en.gtk.preferencesThemesAdd:Add Theme... +en.gtk.preferencesTabs:<b>Tabs</b> +en.gtk.preferencesTabsAlways:Always show tab bar +en.gtk.preferencesTabsSwitch:Switch to newly opened tabs immediately +en.gtk.preferencesTabsNewly:Newly opened tabs are blank +en.gtk.preferencesTabsPosition:Position: +en.gtk.preferencesSource:<b>Source</b> +en.gtk.preferencesSourceOpen:Open source view in new: +en.gtk.preferencesSourceWindow:window +en.gtk.preferencesSourceTab:tab +en.gtk.preferencesURLbar:<b>URLbar</b> +en.gtk.preferencesURLbarDisplay:Display recently visited URLs as you type +en.gtk.preferencesToolbar:<b>Toolbar</b> +en.gtk.preferencesToolbarButtons:Buttons: +# Theme list +en.gtk.preferencesThemeTypeDefault:Default +# Tab position list +en.gtk.preferencesTabLocTop:Top +en.gtk.preferencesTabLocLeft:Left +en.gtk.preferencesTabLocBottom:Bottom +en.gtk.preferencesTabLocRight:Right +# button list +en.gtk.preferencesButtonTypeSmall:Small Icons +en.gtk.preferencesButtonTypeLarge:Large Icons +en.gtk.preferencesButtonTypeLargeText:Large Icons and Text +en.gtk.preferencesButtonTypeText:Text only + +# content tab +en.gtk.preferencesContentTabtitle:Content +en.gtk.preferencesControl:<b>Control</b> +en.gtk.preferencesControlPrevent:Prevent pop-up windows +en.gtk.preferencesControlHide:Hide Adverts +en.gtk.preferencesControlEnable:Enable JavaScript +en.gtk.preferencesControlDisable:Disable plug-ins +en.gtk.preferencesControlHigh:High quality image scaling +en.gtk.preferencesControlLoad:Load and display +en.gtk.preferencesAnimation:<b>Animation</b> +en.gtk.preferencesAnimationEnable:Enable +en.gtk.preferencesAnimationMinimum:Minimum time between frames: +en.gtk.preferencesAnimationMinimumTooltip:Do not update animations any more often than this. +en.gtk.preferencesFonts:<b>Fonts</b> +en.gtk.preferencesFontsDefault:Default +en.gtk.preferencesFontsSize:Size +en.gtk.preferencesFontsSizeTooltip:The base-line font size to use. +en.gtk.preferencesFontsPreview:_Preview +en.gtk.preferencesLanguage:<b>Language</b> +en.gtk.preferencesLanguagePreferred:Preferred language: +en.gtk.preferencesLanguagePreferredTooltip:The preferred language for web pages +# Image loading list +en.gtk.preferencesImageLoadBoth:foreground and background images +en.gtk.preferencesImageLoadFore:foreground images +en.gtk.preferencesImageLoadBack:background images +en.gtk.preferencesImageLoadNone:no images +# font type list +en.gtk.preferencesFonttypeSans:Sans-serif +en.gtk.preferencesFonttypeSerif:Serif +en.gtk.preferencesFonttypeMonospace:Monospace +en.gtk.preferencesFonttypeCursive:Cursive +en.gtk.preferencesFonttypeFantasy:Fantasy + +en.gtk.preferencesPrivacyTabtitle:Privacy +en.gtk.preferencesGeneral:<b>General</b> +en.gtk.preferencesGeneralReferral:Enable referral submission +en.gtk.preferencesGeneralDNT:Enable sending "Do Not Track" request +en.gtk.preferencesHistory:<b>History</b> +en.gtk.preferencesHistoryShow:Local history shows URL in tooltip +en.gtk.preferencesHistoryRemember:Remember browsing history for up to +en.gtk.preferencesHistoryDays:days +en.gtk.preferencesCache:<b>Cache</b> +en.gtk.preferencesCacheMemory:Memory cache size +en.gtk.preferencesCacheDisc:Disc cache size +en.gtk.preferencesCacheExpire:Expire cache entries after +en.gtk.preferencesCacheMaintinance:Maintinance +en.gtk.preferencesCacheDays:days + +en.gtk.preferencesNetworkTabtitle:Network +en.gtk.preferencesProxy:<b>HTTP Proxy</b> +en.gtk.preferencesProxyType:Proxy type +en.gtk.preferencesProxyHost:Host +en.gtk.preferencesProxyUsername:Username +en.gtk.preferencesProxyPassword:Password +en.gtk.preferencesProxyNoproxy:No Proxy For +en.gtk.preferencesProxyTypeTooltip:The type of HTTP proxy server. +en.gtk.preferencesProxyHostTooltip:Host name of your proxy server. +en.gtk.preferencesProxyPortTooltip:Port number to connect to on proxy server. +en.gtk.preferencesProxyUsernameTooltip:Username to access the proxy. +en.gtk.preferencesProxyPasswordTooltip:Password to access the proxy. +en.gtk.preferencesProxyNoproxyTooltip:Comma separated list of host names that should not be proxied. +en.gtk.preferencesFetching:<b>Fetching</b> +en.gtk.preferencesFetchingMax:Maximum fetchers +en.gtk.preferencesFetchingPerhost:Fetches per host +en.gtk.preferencesFetchingCached:Cached connections +en.gtk.preferencesFetchingMaxTooltip:Maximum number of concurrent items to fetch at once. +en.gtk.preferencesFetchingPerhostTooltip:Maximum number of item fetches per web server. +en.gtk.preferencesFetchingCachedTooltip:Number of connections to keep in case they are needed again. +# Proxy type list +en.gtk.preferencesProxyTypeDirect:Direct connection +en.gtk.preferencesProxyTypeManual:Manual with no authentication +en.gtk.preferencesProxyTypeBasic:Manual with basic authentication +en.gtk.preferencesProxyTypeNLTM:Manual with NTLM authentication +en.gtk.preferencesProxyTypeSystem:System settings + +en.gtk.preferencesPDFTabtitle:PDF +en.gtk.preferencesAppearance:<b>Appearance</b> +en.gtk.preferencesAppearanceImages:No images in output +en.gtk.preferencesAppearanceBackground:No background images in output +en.gtk.preferencesAppearanceScalefit:Scale output to fit page +en.gtk.preferencesAppearanceScale:Scale output +en.gtk.preferencesMargins:<b>Margins</b> +en.gtk.preferencesMarginsMeasurements:measurements in mm +en.gtk.preferencesGeneration:<b>Generation</b> +en.gtk.preferencesGenerationCompressed:Output is compressed +en.gtk.preferencesGenerationPassword:Output has a password + + + # Printing user interface tokens # ============================== # @@ -2196,7 +2336,7 @@ nl.all.SSLCerts:SSL certificates en.all.SSLError:NetSurf failed to verify the authenticity of an SSL certificate. Please verify the details presented below. de.all.SSLError:NetSurf konnte ein SSL Zertifikat nicht prüfen. Bitte die Details unten beachten. fr.all.SSLError:NetSurf failed to verify the authenticity of an SSL certificate. Please verify the details presented below. -it.all.SSLError:NetSurf non è stato in grado di verificare l'autenticità di questo certificato SSL, per favore verifica i dettagli presenti di seguito +it.all.SSLError:NetSurf non è stato in grado di verificare l'autenticità di questo certificato SSL, per favore verifica i dettagli presenti di seguito nl.all.SSLError:NetSurf failed to verify the authenticity of an SSL certificate. Please verify the details presented below. en.all.SSL_Certificate_Subject:Subject: %s de.all.SSL_Certificate_Subject:Subject: %s @@ -2606,7 +2746,7 @@ nl.all.HotlistSaveError:The hotlist was unable to be correctly saved. en.all.TreeLoadError:The tree was unable to be correctly loaded. de.all.TreeLoadError:The tree was unable to be correctly loaded. fr.all.TreeLoadError:The tree was unable to be correctly loaded. -it.all.TreeLoadError:L'albero non è stato caricato correttamente. +it.all.TreeLoadError:L'albero non è stato caricato correttamente. nl.all.TreeLoadError:The tree was unable to be correctly loaded. en.all.NoDirError:%s is not a directory de.all.NoDirError:%s ist kein Verzeichnis. @@ -4873,7 +5013,7 @@ nl.ro.HelpInterfaceConfig13:\Ssave these settings and close the \w.|M\Asave thes en.ro.HelpInterfaceConfig16:This indicates whether NetSurf will use an external hotlist client if available, in preference to the internal hotlist. de.ro.HelpInterfaceConfig16:This indicates whether NetSurf will use an external hotlist client if available, in preference to the internal hotlist. fr.ro.HelpInterfaceConfig16:This indicates whether NetSurf will use an external hotlist client if available, in preference to the internal hotlist. -it.ro.HelpInterfaceConfig16:This indicates whether NetSurf will use an external hotlist client if available, in preference to the internal hotlist. +it.ro.HelpInterfaceConfig16:This indicates whether NetSurf will use an external hotlist client if available, in preference to the internal hotlist. nl.ro.HelpInterfaceConfig16:This indicates whether NetSurf will use an external hotlist client if available, in preference to the internal hotlist. en.ro.HelpInterfaceConfig18:\Tthe path to a hotlist application which will be used to display the hotlist. de.ro.HelpInterfaceConfig18:\Tthe path to a hotlist application which will be used to display the hotlist. @@ -5335,6 +5475,11 @@ de.all.Proxy:HTTP Proxy fr.all.Proxy:HTTP Proxy it.all.Proxy:Proxy HTTP nl.all.Proxy:HTTP Proxy +en.ami.ProxyBypass:Bypass proxy for +de.ami.ProxyBypass:Bypass proxy for +fr.ami.ProxyBypass:Bypass proxy for +it.ami.ProxyBypass:Bypass proxy for +nl.ami.ProxyBypass:Bypass proxy for en.all.Fetching:Fetching de.all.Fetching:Fetching fr.all.Fetching:Fetching diff --git a/riscos/Makefile.target b/riscos/Makefile.target index faefa417f..e73a5a3a1 100644 --- a/riscos/Makefile.target +++ b/riscos/Makefile.target @@ -73,7 +73,7 @@ S_RISCOS := 401login.c assert.c bitmap.c buffer.c cookies.c configure.c \ global_history.c gui.c help.c history.c hotlist.c iconbar.c \ image.c menus.c message.c palettes.c plotters.c \ print.c query.c save.c save_draw.c save_pdf.c schedule.c \ - search.c searchweb.c sslcert.c system_colour.c textarea.c \ + search.c searchweb.c sslcert.c textarea.c \ textselection.c theme.c theme_install.c thumbnail.c toolbar.c \ treeview.c ucstables.c uri.c url_complete.c url_protocol.c \ url_suggest.c wimp.c wimp_event.c window.c \ diff --git a/riscos/bitmap.c b/riscos/bitmap.c index d7836822a..0af01c91e 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 6eec8bf7e..56c245882 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" @@ -274,7 +274,7 @@ void ro_gui_buffer_close(void) _swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7), (char *)(buffer + 1), clipping.x0, clipping.y0, - nsoption_int(fg_plot_style)); + nsoption_int(plot_fg_quality)); else xosspriteop_put_sprite_user_coords(osspriteop_PTR, buffer, (osspriteop_id)(buffer + 1), diff --git a/riscos/configure/con_cache.c b/riscos/configure/con_cache.c index cd211236e..6e402fe81 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 c47e90419..d9919d084 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 81537bcef..d4f3e46bb 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" @@ -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/configure/con_fonts.c b/riscos/configure/con_fonts.c index 0bd13ce2a..626115523 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 9e966b96e..6f7d01043 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 8617e6d2e..4982423a3 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" @@ -77,11 +77,11 @@ bool ro_gui_options_image_initialise(wimp_w w) /* set the current values */ for (i = 0; (i < 4); i++) { - if ((unsigned int)nsoption_int(fg_plot_style) == tinct_options[i]) + if ((unsigned int)nsoption_int(plot_fg_quality) == tinct_options[i]) ro_gui_set_icon_string(w, IMAGE_FOREGROUND_FIELD, image_quality_menu->entries[i]. data.indirected_text.text, true); - if ((unsigned int)nsoption_int(bg_plot_style) == tinct_options[i]) + if ((unsigned int)nsoption_int(plot_bg_quality) == tinct_options[i]) ro_gui_set_icon_string(w, IMAGE_BACKGROUND_FIELD, image_quality_menu->entries[i]. data.indirected_text.text, true); @@ -252,8 +252,8 @@ void ro_gui_options_update_shading(wimp_w w) bool ro_gui_options_image_ok(wimp_w w) { ro_gui_options_image_read(w, - (unsigned int *)&nsoption_int(bg_plot_style), - (unsigned int *)&nsoption_int(fg_plot_style)); + (unsigned int *)&nsoption_int(plot_bg_quality), + (unsigned int *)&nsoption_int(plot_fg_quality)); nsoption_set_int(minimum_gif_delay, ro_gui_get_icon_decimal(w, IMAGE_SPEED_FIELD, 2)); diff --git a/riscos/configure/con_inter.c b/riscos/configure/con_inter.c index be2114b05..2af5e3aa5 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 be40b1c39..7e483b5af 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 5bf890597..273684959 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 568a03ddd..75e2bc705 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 b41484be0..c4d605c88 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 347b43d0e..8fb45947f 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 5e4bbbf23..0726cb335 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" @@ -664,7 +664,7 @@ void ro_gui_dialog_close_persistent(wimp_w parent) { void ro_gui_save_options(void) { - nsoption_write("<NetSurf$ChoicesSave>"); + nsoption_write("<NetSurf$ChoicesSave>", NULL, NULL); } bool ro_gui_dialog_zoom_apply(wimp_w w) { diff --git a/riscos/download.c b/riscos/download.c index 233d19300..089714c11 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 b949a570d..68ee6b636 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 ca51b7253..8eeb924ac 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 53f281dd8..e409fbb3e 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" @@ -84,7 +84,6 @@ #include "riscos/save.h" #include "riscos/sslcert.h" #include "riscos/content-handlers/sprite.h" -#include "riscos/system_colour.h" #include "riscos/textselection.h" #include "riscos/theme.h" #include "riscos/toolbar.h" @@ -328,45 +327,89 @@ nsurl *gui_get_resource_url(const char *path) return url; } -/* Documented in desktop/options.h */ -void gui_options_init_defaults(void) +/** + * set option from wimp + */ +static nserror +set_colour_from_wimp(struct nsoption_s *opts, + wimp_colour wimp, + enum nsoption_e option, + colour def_colour) +{ + os_error *error; + os_PALETTE(20) palette; + + error = xwimp_read_true_palette((os_palette *) &palette); + if (error != NULL) { + LOG(("xwimp_read_palette: 0x%x: %s", + error->errnum, error->errmess)); + } else { + /* entries are in B0G0R0LL */ + def_colour = palette.entries[wimp] >> 8; + } + + opts[option].value.c = def_colour; + + return NSERROR_OK; +} + +/** + * Set option defaults for riscos frontend + * + * @param defaults The option table to update. + * @return error status. + * + * @TODO -- The wimp_COLOUR_... values here map the colour definitions + * to parts of the RISC OS desktop palette. In places this + * is fairly arbitrary, and could probably do with + * re-checking. + * + */ +static nserror set_defaults(struct nsoption_s *defaults) { /* Set defaults for absent option strings */ - nsoption_setnull_charp(theme, strdup("Aletheia")); - nsoption_setnull_charp(toolbar_browser, strdup("0123|58|9")); - nsoption_setnull_charp(toolbar_hotlist, strdup("40|12|3")); - nsoption_setnull_charp(toolbar_history, strdup("0|12|3")); - nsoption_setnull_charp(toolbar_cookies, strdup("0|12")); 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")); - nsoption_setnull_charp(url_path, strdup("NetSurf:URL")); - nsoption_setnull_charp(url_save, strdup(CHOICES_PREFIX "URL")); - nsoption_setnull_charp(hotlist_path, strdup("NetSurf:Hotlist")); - nsoption_setnull_charp(hotlist_save, strdup(CHOICES_PREFIX "Hotlist")); - nsoption_setnull_charp(recent_path, strdup("NetSurf:Recent")); - nsoption_setnull_charp(recent_save, strdup(CHOICES_PREFIX "Recent")); - nsoption_setnull_charp(theme_path, strdup("NetSurf:Themes")); - nsoption_setnull_charp(theme_save, strdup(CHOICES_PREFIX "Themes")); - - if (nsoption_charp(theme) == NULL || - nsoption_charp(toolbar_browser) == NULL || - nsoption_charp(toolbar_hotlist) == NULL || - nsoption_charp(toolbar_history) == NULL || - nsoption_charp(toolbar_cookies) == NULL || - nsoption_charp(ca_bundle) == NULL || - nsoption_charp(cookie_file) == NULL || - nsoption_charp(cookie_jar) == NULL || - nsoption_charp(url_path) == NULL || - nsoption_charp(url_save) == NULL || - nsoption_charp(hotlist_path) == NULL || - nsoption_charp(hotlist_save) == NULL || - nsoption_charp(recent_path) == NULL || - nsoption_charp(recent_save) == NULL || - nsoption_charp(theme_path) == NULL || - nsoption_charp(theme_save) == NULL) { - die("Failed initialising string options"); - } + + if (nsoption_charp(ca_bundle) == NULL || + nsoption_charp(cookie_file) == NULL || + nsoption_charp(cookie_jar) == NULL) { + LOG(("Failed initialising string options")); + return NSERROR_BAD_PARAMETER; + } + + /* set default system colours for riscos ui */ + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_ActiveBorder, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_CREAM, NSOPTION_sys_colour_ActiveCaption, 0x00dddddd); + set_colour_from_wimp(defaults, wimp_COLOUR_VERY_LIGHT_GREY, NSOPTION_sys_colour_AppWorkspace, 0x00eeeeee); + set_colour_from_wimp(defaults, wimp_COLOUR_VERY_LIGHT_GREY, NSOPTION_sys_colour_Background, 0x00aa0000);/* \TODO -- Check */ + set_colour_from_wimp(defaults, wimp_COLOUR_VERY_LIGHT_GREY, NSOPTION_sys_colour_ButtonFace, 0x00aaaaaa); + set_colour_from_wimp(defaults, wimp_COLOUR_DARK_GREY, NSOPTION_sys_colour_ButtonHighlight, 0x00cccccc);/* \TODO -- Check */ + set_colour_from_wimp(defaults, wimp_COLOUR_MID_DARK_GREY, NSOPTION_sys_colour_ButtonShadow, 0x00bbbbbb); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_ButtonText, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_CaptionText, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_MID_LIGHT_GREY, NSOPTION_sys_colour_GrayText, 0x00777777);/* \TODO -- Check */ + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_Highlight, 0x00ee0000); + set_colour_from_wimp(defaults, wimp_COLOUR_WHITE, NSOPTION_sys_colour_HighlightText, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_InactiveBorder, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_LIGHT_GREY, NSOPTION_sys_colour_InactiveCaption, 0x00ffffff); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_InactiveCaptionText, 0x00cccccc); + set_colour_from_wimp(defaults, wimp_COLOUR_CREAM, NSOPTION_sys_colour_InfoBackground, 0x00aaaaaa); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_InfoText, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_WHITE, NSOPTION_sys_colour_Menu, 0x00aaaaaa); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_MenuText, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_LIGHT_GREY, NSOPTION_sys_colour_Scrollbar, 0x00aaaaaa);/* \TODO -- Check */ + set_colour_from_wimp(defaults, wimp_COLOUR_MID_DARK_GREY, NSOPTION_sys_colour_ThreeDDarkShadow, 0x00555555); + set_colour_from_wimp(defaults, wimp_COLOUR_VERY_LIGHT_GREY, NSOPTION_sys_colour_ThreeDFace, 0x00dddddd); + set_colour_from_wimp(defaults, wimp_COLOUR_WHITE, NSOPTION_sys_colour_ThreeDHighlight, 0x00aaaaaa); + set_colour_from_wimp(defaults, wimp_COLOUR_WHITE, NSOPTION_sys_colour_ThreeDLightShadow, 0x00999999); + set_colour_from_wimp(defaults, wimp_COLOUR_MID_DARK_GREY, NSOPTION_sys_colour_ThreeDShadow, 0x00777777); + set_colour_from_wimp(defaults, wimp_COLOUR_VERY_LIGHT_GREY, NSOPTION_sys_colour_Window, 0x00aaaaaa); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_WindowFrame, 0x00000000); + set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_WindowText, 0x00000000); + + return NSERROR_OK; } /** @@ -799,6 +842,17 @@ static void gui_init2(int argc, char** argv) free(url); } +/** + * Ensures output logging stream is correctly configured + */ +static bool nslog_stream_configure(FILE *fptr) +{ + /* set log stream to be non-buffering */ + setbuf(fptr, NULL); + + return true; +} + /** Normal entry point from OS */ int main(int argc, char** argv) { @@ -808,8 +862,7 @@ int main(int argc, char** argv) os_var_type type; int used = -1; /* slightly better with older OSLib versions */ os_error *error; - - setbuf(stderr, NULL); + nserror ret; /* Consult NetSurf$Logging environment variable to decide if logging * is required. */ @@ -828,25 +881,42 @@ int main(int argc, char** argv) } } - /* Pass a NULL pointer for Messages path, because until the Choices - * are loaded in netsurf_init, we don't know the Messages path. */ - netsurf_init(&argc, &argv, "NetSurf:Choices", NULL); + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(nslog_stream_configure, &argc, argv); - artworks_init(); - draw_init(); - sprite_init(); + /* user options setup */ + ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + die("Options failed to initialise"); + } + nsoption_read("NetSurf:Choices", NULL); + nsoption_commandline(&argc, argv, NULL); /* Choose the interface language to use */ ro_gui_choose_language(); - /* Load in our language-specific Messages */ - if ((length = snprintf(path, sizeof(path), - "NetSurf:Resources.%s.Messages", - nsoption_charp(language))) < 0 || length >= (int)sizeof(path)) + /* select language-specific Messages */ + if (((length = snprintf(path, + sizeof(path), + "NetSurf:Resources.%s.Messages", + nsoption_charp(language))) < 0) || + (length >= (int)sizeof(path))) { die("Failed to locate Messages resource."); - /* We disabled core Messages load, so have to load them here */ - messages_load(path); - /* Also load some extra RISC OS specific Messages */ + } + + /* common initialisation */ + ret = netsurf_init(path); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } + + artworks_init(); + draw_init(); + sprite_init(); + + /* Load some extra RISC OS specific Messages */ messages_load("NetSurf:Resources.LangNames"); gui_init(argc, argv); @@ -898,7 +968,7 @@ void ro_gui_signal(int sig) xhourglass_on(); xhourglass_colours(0x0000ffff, 0x000000ff, &old_sand, &old_glass); - nsoption_dump(stderr); + nsoption_dump(stderr, NULL); /*rufl_dump_state();*/ #ifndef __ELF__ @@ -1392,11 +1462,9 @@ void ro_gui_user_message(wimp_event_no event, wimp_message *message) case message_MODE_CHANGE: ro_gui_get_screen_properties(); rufl_invalidate_cache(); - ro_gui_system_colour_update(); break; case message_PALETTE_CHANGE: - ro_gui_system_colour_update(); break; case message_FONT_CHANGED: diff --git a/riscos/help.c b/riscos/help.c index ae2a2af84..14d34af15 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 8a3b562cb..65ae84758 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 53212c12f..b8449cd21 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 6c7996aa3..f6c094291 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 3d4f28b1d..56feb2b96 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" @@ -69,8 +69,8 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width, req_height *= 2; width *= 2; height *= 2; - tinct_options = background ? nsoption_int(bg_plot_style) : - nsoption_int(fg_plot_style); + tinct_options = background ? nsoption_int(plot_bg_quality) : + nsoption_int(plot_fg_quality); switch (type) { case IMAGE_PLOT_TINCT_ALPHA: return image_redraw_tinct(header, x, y, diff --git a/riscos/menus.c b/riscos/menus.c index 550091061..aaec8cfb4 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -41,7 +41,6 @@ #include "desktop/history_core.h" #include "desktop/hotlist.h" #include "desktop/netsurf.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "riscos/dialog.h" #include "riscos/configure.h" @@ -51,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/options.h b/riscos/options.h index 62bfcf2bb..3d4567f88 100644 --- a/riscos/options.h +++ b/riscos/options.h @@ -1,7 +1,5 @@ /* - * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net> - * Copyright 2004 James Bursa <bursa@users.sourceforge.net> - * Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net> + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -22,131 +20,50 @@ * 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_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, false) +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) diff --git a/riscos/print.c b/riscos/print.c index 05eb8fdba..0df77ef6b 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 549a2ab3e..390165d3b 100644 --- a/riscos/save.c +++ b/riscos/save.c @@ -42,7 +42,6 @@ #include "desktop/netsurf.h" #include "desktop/save_complete.h" #include "desktop/save_text.h" -#include "desktop/selection.h" #include "desktop/thumbnail.h" #include "image/bitmap.h" #include "render/form.h" @@ -50,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" @@ -395,7 +394,7 @@ void gui_drag_save_object(gui_save_type save_type, hlcache_handle *c, * \param g gui window */ -void gui_drag_save_selection(struct selection *s, struct gui_window *g) +void gui_drag_save_selection(struct gui_window *g, const char *selection) { wimp_pointer pointer; char icon_buf[20]; @@ -421,7 +420,10 @@ void gui_drag_save_selection(struct selection *s, struct gui_window *g) if (gui_save_selection == NULL) free(gui_save_selection); - gui_save_selection = selection_get_copy(s); + if (selection == NULL) + gui_save_selection = strdup(""); + else + gui_save_selection = strdup(selection); ro_gui_save_set_state(NULL, GUI_SAVE_TEXT_SELECTION, NULL, save_leafname, LEAFNAME_MAX, diff --git a/riscos/search.c b/riscos/search.c index db87cad8d..3d3b7ba4a 100644 --- a/riscos/search.c +++ b/riscos/search.c @@ -34,7 +34,6 @@ #include "desktop/gui.h" #include "desktop/browser_private.h" #include "desktop/search.h" -#include "desktop/selection.h" #include "riscos/dialog.h" #include "riscos/menus.h" #include "riscos/wimp.h" @@ -123,12 +122,10 @@ bool ro_gui_search_next(wimp_w w) search_data.search_insert = true; search_flags_t flags = SEARCH_FLAG_FORWARDS | ro_gui_search_update_flags(); - if (browser_window_search_verify_new(search_data.search_window, - &ro_gui_search_callbacks, NULL)) - browser_window_search_step( - search_data.search_window, flags, - ro_gui_get_icon_string(dialog_search, - ICON_SEARCH_TEXT)); + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); return false; } @@ -166,35 +163,30 @@ bool ro_gui_search_click(wimp_pointer *pointer) search_data.search_insert = true; flags = ~SEARCH_FLAG_FORWARDS & ro_gui_search_update_flags(); - if (browser_window_search_verify_new( - search_data.search_window, - &ro_gui_search_callbacks, NULL)) - browser_window_search_step( - search_data.search_window, - flags, - ro_gui_get_icon_string( - dialog_search, - ICON_SEARCH_TEXT)); + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); return true; case ICON_SEARCH_CASE_SENSITIVE: flags = SEARCH_FLAG_FORWARDS | ro_gui_search_update_flags(); - if (browser_window_search_verify_new( - search_data.search_window, - &ro_gui_search_callbacks, NULL)) - browser_window_search_step( - search_data.search_window, - flags, - ro_gui_get_icon_string( - dialog_search, - ICON_SEARCH_TEXT)); + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); return true; case ICON_SEARCH_SHOW_ALL: - /* TODO: call browser_window_search_verify_new() ? */ - browser_window_search_show_all( - ro_gui_get_icon_selected_state( - pointer->w, pointer->i), - search_data.search_window); + flags = ro_gui_get_icon_selected_state( + pointer->w, pointer->i) ? + SEARCH_FLAG_SHOWALL : SEARCH_FLAG_NONE; + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); return true; } return false; @@ -292,9 +284,6 @@ void ro_gui_search_prepare(struct browser_window *bw) ro_gui_search_set_forward_state(true, bw); ro_gui_search_set_back_state(true, bw); - browser_window_search_create_context(bw, - &ro_gui_search_callbacks, NULL); - search_data.search_window = bw; ro_gui_set_icon_string(dialog_search, ICON_SEARCH_TEXT, "", true); @@ -321,14 +310,14 @@ bool ro_gui_search_keypress(wimp_key *key) search_flags_t flags; switch (key->c) { - case 1: { /* ctrl a */ - bool sel = !ro_gui_get_icon_selected_state(key->w, - ICON_SEARCH_SHOW_ALL); - ro_gui_set_icon_selected_state(key->w, - ICON_SEARCH_SHOW_ALL, sel); - /* TODO: call browser_window_search_verify_new() ? */ - browser_window_search_show_all(sel, - search_data.search_window); + case 1: { + flags = ro_gui_search_update_flags() + ^ SEARCH_FLAG_SHOWALL; + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); } break; case 9: /* ctrl i */ @@ -338,50 +327,38 @@ bool ro_gui_search_keypress(wimp_key *key) ICON_SEARCH_CASE_SENSITIVE, !state); flags = SEARCH_FLAG_FORWARDS | ro_gui_search_update_flags(); - if (browser_window_search_verify_new( - search_data.search_window, - &ro_gui_search_callbacks, NULL)) - browser_window_search_step( - search_data.search_window, - flags, - ro_gui_get_icon_string( - dialog_search, - ICON_SEARCH_TEXT)); + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); return true; case IS_WIMP_KEY | wimp_KEY_UP: search_data.search_insert = true; flags = ~SEARCH_FLAG_FORWARDS & ro_gui_search_update_flags(); - if (browser_window_search_verify_new( - search_data.search_window, - &ro_gui_search_callbacks, NULL)) - browser_window_search_step( - search_data.search_window, - flags, - ro_gui_get_icon_string( - dialog_search, - ICON_SEARCH_TEXT)); + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); return true; case IS_WIMP_KEY | wimp_KEY_DOWN: search_data.search_insert = true; flags = SEARCH_FLAG_FORWARDS | ro_gui_search_update_flags(); - if (browser_window_search_verify_new( - search_data.search_window, - &ro_gui_search_callbacks, NULL)) - browser_window_search_step( - search_data.search_window, - flags, - ro_gui_get_icon_string( - dialog_search, - ICON_SEARCH_TEXT)); + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string(dialog_search, + ICON_SEARCH_TEXT)); return true; default: if (key->c == 21) { /* ctrl+u means the user's starting * a new search */ - browser_window_search_destroy_context( + browser_window_search_clear( search_data.search_window); ro_gui_search_set_forward_state(true, search_data.search_window); @@ -394,21 +371,14 @@ bool ro_gui_search_keypress(wimp_key *key) (key->c >= 0x20 && key->c <= 0x7f)) { flags = SEARCH_FLAG_FORWARDS | ro_gui_search_update_flags(); - browser_window_search_destroy_context( - search_data.search_window); ro_gui_search_set_forward_state(true, search_data.search_window); ro_gui_search_set_back_state(true, search_data.search_window); - if (browser_window_search_verify_new( - search_data.search_window, - &ro_gui_search_callbacks, - NULL)) - browser_window_search_step( - search_data. - search_window, - flags, - ro_gui_get_icon_string( + browser_window_search(search_data.search_window, + &ro_gui_search_callbacks, NULL, + flags, + ro_gui_get_icon_string( dialog_search, ICON_SEARCH_TEXT)); return true; @@ -425,7 +395,7 @@ bool ro_gui_search_keypress(wimp_key *key) */ void ro_gui_search_end(wimp_w w) { - browser_window_search_destroy_context(search_data.search_window); + browser_window_search_clear(search_data.search_window); ro_gui_search_set_forward_state(true, search_data.search_window); ro_gui_search_set_back_state(true, search_data.search_window); } diff --git a/riscos/system_colour.c b/riscos/system_colour.c deleted file mode 100644 index 104aa3bad..000000000 --- a/riscos/system_colour.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 "oslib/os.h" -#include "oslib/wimp.h" -#include "utils/utils.h" -#include "utils/log.h" -#include "desktop/gui.h" -#include "desktop/options.h" -#include "riscos/system_colour.h" - -struct gui_system_colour_ctx { - const char *name; - int length; - css_color colour; - wimp_colour system_colour; - colour *option_colour; - lwc_string *lwcstr; -}; - -/* \TODO -- The wimp_COLOUR_... values in the table below map the colour - * definitions to parts of the RISC OS desktop palette. In places - * this is fairly arbitrary, and could probably do with re-checking. - */ - -static struct gui_system_colour_ctx colour_list[] = { - { - "ActiveBorder", - SLEN("ActiveBorder"), - 0xff000000, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_ActiveBorder), - NULL - }, { - "ActiveCaption", - SLEN("ActiveCaption"), - 0xffdddddd, - wimp_COLOUR_CREAM, - &nsoption_colour(sys_colour_ActiveCaption), - NULL - }, { - "AppWorkspace", - SLEN("AppWorkspace"), - 0xffeeeeee, - wimp_COLOUR_VERY_LIGHT_GREY, - &nsoption_colour(sys_colour_AppWorkspace), - NULL - }, { - "Background", - SLEN("Background"), - 0xff0000aa, - wimp_COLOUR_VERY_LIGHT_GREY, /* \TODO -- Check */ - &nsoption_colour(sys_colour_Background), - NULL - }, { - "ButtonFace", - SLEN("ButtonFace"), - 0xffaaaaaa, - wimp_COLOUR_VERY_LIGHT_GREY, - &nsoption_colour(sys_colour_ButtonFace), - NULL - }, { - "ButtonHighlight", - SLEN("ButtonHighlight"), - 0xffdddddd, - wimp_COLOUR_DARK_GREY, /* \TODO -- Check */ - &nsoption_colour(sys_colour_ButtonHighlight), - NULL - }, { - "ButtonShadow", - SLEN("ButtonShadow"), - 0xffbbbbbb, - wimp_COLOUR_MID_DARK_GREY, - &nsoption_colour(sys_colour_ButtonShadow), - NULL - }, { - "ButtonText", - SLEN("ButtonText"), - 0xff000000, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_ButtonText), - NULL - }, { - "CaptionText", - SLEN("CaptionText"), - 0xff000000, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_CaptionText), - NULL - }, { - "GrayText", - SLEN("GrayText"), - 0xffcccccc, - wimp_COLOUR_MID_LIGHT_GREY, /* \TODO -- Check */ - &nsoption_colour(sys_colour_GrayText), - NULL - }, { - "Highlight", - SLEN("Highlight"), - 0xff0000ee, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_Highlight), - NULL - }, { - "HighlightText", - SLEN("HighlightText"), - 0xff000000, - wimp_COLOUR_WHITE, - &nsoption_colour(sys_colour_HighlightText), - NULL - }, { - "InactiveBorder", - SLEN("InactiveBorder"), - 0xffffffff, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_InactiveBorder), - NULL - }, { - "InactiveCaption", - SLEN("InactiveCaption"), - 0xffffffff, - wimp_COLOUR_LIGHT_GREY, - &nsoption_colour(sys_colour_InactiveCaption), - NULL - }, { - "InactiveCaptionText", - SLEN("InactiveCaptionText"), - 0xffcccccc, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_InactiveCaptionText), - NULL - }, { - "InfoBackground", - SLEN("InfoBackground"), - 0xffaaaaaa, - wimp_COLOUR_CREAM, - &nsoption_colour(sys_colour_InfoBackground), - NULL - }, { - "InfoText", - SLEN("InfoText"), - 0xff000000, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_InfoText), - NULL - }, { - "Menu", - SLEN("Menu"), - 0xffaaaaaa, - wimp_COLOUR_WHITE, - &nsoption_colour(sys_colour_Menu), - NULL - }, { - "MenuText", - SLEN("MenuText"), - 0xff000000, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_MenuText), - NULL - }, { - "Scrollbar", - SLEN("Scrollbar"), - 0xffaaaaaa, - wimp_COLOUR_LIGHT_GREY, /* \TODO -- Check */ - &nsoption_colour(sys_colour_Scrollbar), - NULL - }, { - "ThreeDDarkShadow", - SLEN("ThreeDDarkShadow"), - 0xff555555, - wimp_COLOUR_MID_DARK_GREY, - &nsoption_colour(sys_colour_ThreeDDarkShadow), - NULL - }, { - "ThreeDFace", - SLEN("ThreeDFace"), - 0xffdddddd, - wimp_COLOUR_VERY_LIGHT_GREY, - &nsoption_colour(sys_colour_ThreeDFace), - NULL - }, { - "ThreeDHighlight", - SLEN("ThreeDHighlight"), - 0xffaaaaaa, - wimp_COLOUR_WHITE, - &nsoption_colour(sys_colour_ThreeDHighlight), - NULL - }, { - "ThreeDLightShadow", - SLEN("ThreeDLightShadow"), - 0xff999999, - wimp_COLOUR_WHITE, - &nsoption_colour(sys_colour_ThreeDLightShadow), - NULL - }, { - "ThreeDShadow", - SLEN("ThreeDShadow"), - 0xff777777, - wimp_COLOUR_MID_DARK_GREY, - &nsoption_colour(sys_colour_ThreeDShadow), - NULL - }, { - "Window", - SLEN("Window"), - 0xffaaaaaa, - wimp_COLOUR_VERY_LIGHT_GREY, - &nsoption_colour(sys_colour_Window), - NULL - }, { - "WindowFrame", - SLEN("WindowFrame"), - 0xff000000, - wimp_COLOUR_BLACK, - &nsoption_colour(sys_colour_WindowFrame), - NULL - }, { - "WindowText", - SLEN("WindowText"), - 0xff000000, - wimp_COLOUR_BLACK, - &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); - } - } - - ro_gui_system_colour_update(); - - 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; -} - - -#define ro_gui_system_colour_convert_os_to_css(os) (0xff000000 | \ - (((os) & 0x0000ff00) << 8) | \ - (((os) & 0x00ff0000) >> 8) | \ - (((os) & 0xff000000) >> 24)) - - -/* This is a exported interface for the RISC OS frontend, - * documented in riscos/system_colour.h - */ - -void ro_gui_system_colour_update(void) -{ - os_error *error; - os_PALETTE(20) palette; - unsigned int ccount; - - error = xwimp_read_palette((os_palette *) &palette); - if (error != NULL) { - LOG(("xwimp_read_palette: 0x%x: %s", - error->errnum, error->errmess)); - return; - } - - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (*(colour_list[ccount].option_colour) == 0) { - colour_list[ccount].colour = - ro_gui_system_colour_convert_os_to_css( - palette.entries[colour_list[ccount]. - system_colour]); - } - } -} diff --git a/riscos/system_colour.h b/riscos/system_colour.h deleted file mode 100644 index a6672e305..000000000 --- a/riscos/system_colour.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2011 Stephen Fryatt <stevef@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 (frontend internal interface) - */ - -#ifndef _NETSURF_RISCOS_SYSTEM_COLOUR_H_ -#define _NETSURF_RISCOS_SYSTEM_COLOUR_H_ - -/** - * Scan the CSS system colour definitions, and update any that haven't been - * overridden in NetSurf's options to reflect the current Desktop palette. - */ - -void ro_gui_system_colour_update(void); - -#endif - diff --git a/riscos/textselection.c b/riscos/textselection.c index a1a02887f..094924bea 100644 --- a/riscos/textselection.c +++ b/riscos/textselection.c @@ -27,7 +27,6 @@ #include "oslib/wimp.h" #include "content/hlcache.h" #include "desktop/gui.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "riscos/gui.h" #include "riscos/menus.h" diff --git a/riscos/theme.c b/riscos/theme.c index b44493dd9..f1b7ae249 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 e5d5aafa3..0d436dce8 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 2a140ce17..66864554b 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 7e95ce6b0..d56c6fad2 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 990ce4276..e26cb6556 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 164075d0b..772a0d1b1 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -53,7 +53,6 @@ #include "desktop/hotlist.h" #include "desktop/mouse.h" #include "desktop/plotters.h" -#include "desktop/selection.h" #include "desktop/textinput.h" #include "desktop/thumbnail.h" #include "desktop/tree.h" @@ -70,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" @@ -522,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, @@ -4713,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/test/Makefile b/test/Makefile index e61e21f69..ecd2b501a 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 000000000..f4a62afc4 --- /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/js/core.infinite.html b/test/js/core.infinite.html new file mode 100644 index 000000000..7e6b8de7a --- /dev/null +++ b/test/js/core.infinite.html @@ -0,0 +1,23 @@ +<html> +<head> +<title>Infinite loop</title> +<link rel="stylesheet" type="text/css" href="tst.css"> +</head> +<body> +<h1>Infinite loop</h1> +<p>Before</p> +<script> + +function bar(x) { return (x/2) + 1; } + +n=1; +while (n < 3) { + n = bar(n); + +} + +</script> +</script> +<p>Afterwards</p> +</body> +</html> diff --git a/test/js/core.recursion.html b/test/js/core.recursion.html new file mode 100644 index 000000000..6c2206b22 --- /dev/null +++ b/test/js/core.recursion.html @@ -0,0 +1,21 @@ +<html> +<head> +<title>Infinite recursion</title> +<link rel="stylesheet" type="text/css" href="tst.css"> +</head> +<body> +<h1>Infinite recursion</h1> +<p>Before</p> +<script> + +function it_keeps_going_and_going_and_going(i) { + + return it_keeps_going_and_going_and_going(i+1); +} + +it_keeps_going_and_going_and_going(1) +</script> +</script> +<p>Afterwards</p> +</body> +</html> diff --git a/test/js/index.html b/test/js/index.html index bb2918cac..56482ec98 100644 --- a/test/js/index.html +++ b/test/js/index.html @@ -6,6 +6,12 @@ <body> <h1>JavaScript Tests</h1> +<h2>Core</h2> +<ul> +<li><a href="core.recursion.html">Infinite Recursion</a></li> +<li><a href="core.infinite.html">Infinite loop</a></li> +</ul> + <h2>Window</h2> <ul> diff --git a/test/nsoption.c b/test/nsoption.c new file mode 100644 index 000000000..1c9116acb --- /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; +} diff --git a/test/urldbtest.c b/test/urldbtest.c index ab441ffa5..bc9d899a1 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/utils/Makefile b/utils/Makefile index ed34e9557..aef579948 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 + utf8.c utils.c useragent.c bloom.c nsoption.c -S_UTILS := $(addprefix utils/,$(S_UTILS))
\ No newline at end of file +S_UTILS := $(addprefix utils/,$(S_UTILS)) diff --git a/utils/bloom.c b/utils/bloom.c new file mode 100644 index 000000000..1b07d6f1b --- /dev/null +++ b/utils/bloom.c @@ -0,0 +1,163 @@ +/* + * Copyright 2013 Rob Kendrick <rjek@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 + * Trivial bloom filter */ + +#include <stdlib.h> +#include "utils/bloom.h" + +/** + * Hash a string, returning a 32bit value. The hash algorithm used is + * Fowler Noll Vo - a very fast and simple hash, ideal for short strings. + * See http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash for more details. + * + * \param datum The string to hash. + * \param len size_t of data length. + * \return The calculated hash value for the datum. + */ + +static inline uint32_t fnv(const char *datum, size_t len) +{ + uint32_t z = 0x811c9dc5; + + if (datum == NULL) + return 0; + + while (len--) { + z *= 0x01000193; + z ^= *datum++; + } + + return z; +} + +struct bloom_filter { + size_t size; + uint32_t items; + uint8_t filter[]; +}; + +struct bloom_filter *bloom_create(size_t size) +{ + struct bloom_filter *r = calloc(sizeof(*r) + size, 1); + + if (r == NULL) + return NULL; + + r->size = size; + + return r; +} + +void bloom_destroy(struct bloom_filter *b) +{ + free(b); +} + +void bloom_insert_str(struct bloom_filter *b, const char *s, size_t z) +{ + uint32_t hash = fnv(s, z); + bloom_insert_hash(b, hash); +} + +void bloom_insert_hash(struct bloom_filter *b, uint32_t hash) +{ + unsigned int index = hash % (b->size << 3); + unsigned int byte_index = index >> 3; + unsigned int bit_index = index & 7; + + b->filter[byte_index] |= (1 << bit_index); + b->items++; +} + +bool bloom_search_str(struct bloom_filter *b, const char *s, size_t z) +{ + uint32_t hash = fnv(s, z); + return bloom_search_hash(b, hash); +} + +bool bloom_search_hash(struct bloom_filter *b, uint32_t hash) +{ + unsigned int index = hash % (b->size << 3); + unsigned int byte_index = index >> 3; + unsigned int bit_index = index & 7; + + return (b->filter[byte_index] & (1 << bit_index)) != 0; +} + +uint32_t bloom_items(struct bloom_filter *b) +{ + return b->items; +} + +#ifdef TEST_RIG + +#include <stdio.h> +#include <string.h> +#include <assert.h> + +int main(int argc, char *arg[]) +{ + struct bloom_filter *b = bloom_create(8192); + FILE *dict = fopen("/usr/share/dict/words", "r"); + char buf[BUFSIZ]; + int false_positives = 0, total = 0; + + for (int i = 0; i < 8192; i++) { + fscanf(dict, "%s", buf); + printf("adding %s\n", buf); + bloom_insert_str(b, buf, strlen(buf)); + } + + printf("adding NetSurf\n"); + + bloom_insert_str(b, "NetSurf", 7); + printf("checking NetSurf (should be true)\n"); + assert(bloom_search_str(b, "NetSurf", 7)); + + fseek(dict, 0, SEEK_SET); + + for (int i = 0; i < 8192; i++) { + fscanf(dict, "%s", buf); + printf("checking %s (should be true)\n", buf); + assert(bloom_search_str(b, buf, strlen(buf))); + + total++; + } + + for (int i = 0; i < 8192; i++) { + fscanf(dict, "%s", buf); + printf("checking %s (should be false)\n", buf); + if (bloom_search_str(b, buf, strlen(buf)) == true) + false_positives++; + total++; + } + + printf("false positives: %d of %d, %f%%\n", + false_positives, total, + ((float)false_positives / total) * 100); + + fclose(dict); + bloom_destroy(b); + + return 0; +} + +#endif /* TEST_RIG */ + diff --git a/utils/bloom.h b/utils/bloom.h new file mode 100644 index 000000000..4a7bd3800 --- /dev/null +++ b/utils/bloom.h @@ -0,0 +1,99 @@ +/* + * Copyright 2013 Rob Kendrick <rjek@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 + * Trivial bloom filter */ + +#ifndef _NETSURF_UTILS_BLOOM_H_ +#define _NETSURF_UTILS_BLOOM_H_ + +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> + +struct bloom_filter; + +/** + * Create a new bloom filter. + * + * \param size Size of bloom filter in bytes + * \return Handle for newly-created bloom filter, or NULL + */ +struct bloom_filter *bloom_create(size_t size); + +/** + * Destroy a previously-created bloom filter + * + * \param b Bloom filter to destroy + */ +void bloom_destroy(struct bloom_filter *b); + +/** + * Insert a string of given length (may include NULs) into the filter, + * using an internal hash function. + * + * \param b Bloom filter to add to + * \param s Pointer to data + * \param z Length of data + */ +void bloom_insert_str(struct bloom_filter *b, const char *s, size_t z); + +/** + * Insert a given hash value into the filter, should you already have + * one to hand. + * + * \param b Bloom filter to add to + * \param hash Value to add + */ +void bloom_insert_hash(struct bloom_filter *b, uint32_t hash); + +/** + * Search the filter for the given string, assuming it was added by + * bloom_insert_str(). May return false-positives. + * + * \param b Bloom filter to search + * \param s Pointer to data to search for + * \param z Length of data + * + * \return False if never added, True if it might have been. + */ +bool bloom_search_str(struct bloom_filter *b, const char *s, size_t z); + +/** + * Search the filter for the given hash value, assuming it was added by + * bloom_insert_hash(). May return false-positives. + * + * \param b Bloom filter to search + * \param hash Hash value to search for + * + * \return False if never added, True if it might have been. + */ +bool bloom_search_hash(struct bloom_filter *b, uint32_t hash); + +/** + * Find out how many items have been added to this bloom filter. This + * is useful for deciding the size of a new bloom filter should you + * need to rehash it. + * + * \param b Bloom filter to examine + * + * \return Number of items that have been added + */ +uint32_t bloom_items(struct bloom_filter *b); + +#endif diff --git a/utils/fetch-transifex.pl b/utils/fetch-transifex.pl new file mode 100644 index 000000000..4d40062c9 --- /dev/null +++ b/utils/fetch-transifex.pl @@ -0,0 +1,127 @@ +#!/usr/bin/perl +# +# Copyright © 2013 Vincent Sanders <vince@netsurf-browser.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# * The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +=head1 + +retrive resource from transifex service + +=cut + +use strict; +use Getopt::Long (); +use LWP::UserAgent; +use JSON qw( decode_json ); +use Data::Dumper; +use Fcntl qw( O_CREAT O_EXCL O_WRONLY O_APPEND O_RDONLY O_WRONLY ); + +use constant GETOPT_OPTS => qw( auto_abbrev no_getopt_compat bundling ); +use constant GETOPT_SPEC => + qw( output|o=s + lang|l=s + resource|res|r=s + project|prj|p=s + user|u=s + password|w=s + help|h|? ); + +# ensure no locale translation is applied and leave it all in UTF-8 +use bytes; + +# default option values: +my %opt = qw( resource messagesany project netsurf user netsurf ); + +sub output_stream (); +sub usage (); + +sub main () +{ + my $output; + my $opt_ok; + + # option parsing: + Getopt::Long::Configure( GETOPT_OPTS ); + $opt_ok = Getopt::Long::GetOptions( \%opt, GETOPT_SPEC ); + + if( $opt_ok ) + { + $output = output_stream(); + } + + # double check the options are sane (and we weren't asked for the help) + if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ ) + { + usage(); + } + + my $transifexurl = "https://www.transifex.com/api/2/project/" . $opt{project} . "/resource/" . $opt{resource} . "/translation/" . $opt{lang} . "/"; + + my $ua = LWP::UserAgent->new; + $ua->credentials( + 'www.transifex.com:443', + 'Transifex API', + $opt{user} => $opt{password} + ); + + my $response = $ua->get( $transifexurl ); + if (!$response->is_success) { + die $response->status_line . " When fetching " . $transifexurl; + } + + # Decode the entire JSON + my $decoded_json = decode_json( $response->decoded_content ); + + print ( $output $decoded_json->{'content'} ); +} + +main(); + +sub usage () +{ + print(STDERR <<TXT ); +usage: + $0 -l lang-code \ + [-o output-file] [-r resource] [-p project] [-u user] [-w password] + + lang-code : en fr ko ... (no default) + project : transifex project (default 'netsurf') + resource : transifex resource (default 'messagesany') + user : transifex resource (default 'netsurf') + password : transifex resource (no default) + output-file: defaults to standard output +TXT + exit(1); +} + +sub output_stream () +{ + if( $opt{output} ) + { + my $ofh; + + sysopen( $ofh, $opt{output}, O_CREAT|O_EXCL|O_APPEND|O_WRONLY ) || + die( "$0: Failed to open output file $opt{output}: $!\n" ); + + return $ofh; + } + + return \*STDOUT; +} diff --git a/utils/filepath.c b/utils/filepath.c index 21a965949..f0aa19585 100644 --- a/utils/filepath.c +++ b/utils/filepath.c @@ -89,21 +89,13 @@ char *filepath_sfindfile(char *str, const char *format, ...) /* exported interface documented in filepath.h */ char *filepath_findfile(const char *format, ...) { - char *str; char *ret; va_list ap; - str = malloc(PATH_MAX); - if (str == NULL) - return NULL; /* unable to allocate memory */ - va_start(ap, format); - ret = filepath_vsfindfile(str, format, ap); + ret = filepath_vsfindfile(NULL, format, ap); va_end(ap); - if (ret == NULL) - free(str); - return ret; } diff --git a/utils/import-messages.pl b/utils/import-messages.pl new file mode 100644 index 000000000..4c13a859e --- /dev/null +++ b/utils/import-messages.pl @@ -0,0 +1,326 @@ +#!/usr/bin/perl +# +# Copyright © 2013 Vivek Dasmohapatra <vivek@collabora.co.uk> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# * The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +=head1 + +Take a single-language messages file and merge it back in to the +NetSurf master messaged (i10n) file. + +=cut + +use strict; + +use Getopt::Long (); +use Fcntl qw( O_CREAT O_EXCL O_WRONLY O_APPEND O_RDONLY O_WRONLY O_TRUNC ); + +use constant GETOPT_OPTS => qw( auto_abbrev no_getopt_compat bundling ); +use constant GETOPT_SPEC => + qw( output|o=s + input|i=s + lang|l=s + plat|platform|p=s + format|fmt|f=s + import|I=s + help|h|? ); + +# default option values: +my %opt = qw( plat any format messages ); + +sub input_stream ($;$); +sub output_stream (); +sub usage (); +sub parser (); + +sub main () +{ + my $input; + my $output; + my $import; + my $parser; + my $opt_ok; + my @input; + my %message; + my $last_key; + my $last_plat; + + # option parsing: + Getopt::Long::Configure( GETOPT_OPTS ); + $opt_ok = Getopt::Long::GetOptions( \%opt, GETOPT_SPEC ); + + # allow input, import & output to be specified as non-option arguments: + if( @ARGV ) { $opt{input } ||= shift( @ARGV ) } + if( @ARGV ) { $opt{import} ||= shift( @ARGV ) } + if( @ARGV ) { $opt{output} ||= shift( @ARGV ) } + + # open the appropriate streams and get the formatter and headers: + if( $opt_ok ) + { + $input = input_stream( $opt{input} ); + $import = input_stream( $opt{import}, 'import-file' ); + $parser = parser(); + $opt{plat} ||= 'any'; + } + + # double check the options are sane (and we weren't asked for the help) + if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ ) + { + usage(); + } + + @input = <$input>; + $output = output_stream(); + + $parser->( \%message, $import ); + + foreach ( @input ) + { + use bytes; + + my( $lang, $plat, $key ); + + if( /^([a-z]{2})\.([^.]+)\.([^:]+):/ ) + { + ( $lang, $plat, $key ) = ( $1, $2, $3 ); + } + + if( $key || $message{ $last_key } ) + { + #print( $output "## $last_key -> $key\n" ); + # the key changed but we have a message for it still pending: + if( $last_key && $message{ $last_key } && ($key ne $last_key) ) + { + my $plt = $last_plat; + my $str = $message{ $last_key }; + my $msg = qq|$opt{lang}.$last_plat.$last_key:$str\n|; + + print( $output $msg ); + delete( $message{ $last_key } ); + + # if the line following our new translation is not blank, + # generate a synthetic group-separator: + if( !/^\s*$/ ) { print( $output "\n") } + } + + $last_key = $key; + $last_plat = $plat; + + if( $lang eq $opt{lang} ) + { + my $val = $message{ $key }; + if( $val && + ( $opt{plat} eq 'any' || # all platforms ok + $opt{plat} eq $plat ) ) # specified platform matched + { + print( $output qq|$1.$2.$3:$val\n| ); + delete( $message{ $key } ); + next; + } + } + } + + print( $output $_ ); + } +} + +main(); + +sub usage () +{ + my @fmt = map { s/::$//; $_ } keys(%{$::{'msgfmt::'}}); + print( STDERR <<TXT ); +usage: + $0 -l lang-code \ + [-p platform] [-f format] \ + [-o output-file] [-i input-file] [-I import-file] + + $0 -l lang-code … [input-file [import-file [output-file]]] + + lang-code : en fr ko … (no default) + platform : any gtk ami (default 'any') + format : @fmt (default 'messages') + input-file : defaults to standard input + output-file: defaults to standard output + import-file: no default + + The input-file may be the same as the output-file, in which case + it will be altered in place. +TXT + exit(1); +} + +sub input_stream ($;$) +{ + my $file = shift(); + my $must_exist = shift(); + + if( $file ) + { + my $ifh; + + sysopen( $ifh, $file, O_RDONLY ) || + die( "$0: Failed to open input file $file: $!\n" ); + + return $ifh; + } + + if( $must_exist ) + { + print( STDERR "No file specified for $must_exist\n" ); + usage(); + } + + return \*STDIN; +} + +sub output_stream () +{ + if( $opt{output} ) + { + my $ofh; + + sysopen( $ofh, $opt{output}, O_CREAT|O_TRUNC|O_WRONLY ) || + die( "$0: Failed to open output file $opt{output}: $!\n" ); + + return $ofh; + } + + return \*STDOUT; +} + +sub parser () +{ + my $name = $opt{format}; + my $func = "msgfmt::$name"->UNIVERSAL::can("parse"); + + return $func || die( "No handler found for format '$name'\n" ); +} + +# format implementations: +{ + package msgfmt::java; + + sub unescape { $_[0] =~ s/\\([^abfnrtv])/$1/g; $_[0] } + sub parse + { + my $cache = shift(); + my $stream = shift(); + + while ( <$stream> ) + { + if( /([^#]\S+)\s*=\s?(.*)/ ) + { + my $key = $1; + my $val = $2; + $cache->{ $key } = unescape( $val ); + } + } + } +} + +{ + package msgfmt::messages; # native netsurf format + + sub parse + { + my $cache = shift(); + my $stream = shift(); + + while ( <$stream> ) + { + if( /^([a-z]{2})\.([^.]+)\.([^:]+):(.*)/ ) + { + my( $lang, $plat, $key, $val ) = ( $1, $2, $3, $4 ); + + if( $lang ne $opt{lang} ) { next } + if( $opt{plat} ne 'any' && + $opt{plat} ne $plat && + 'all' ne $plat ) { next } + + $cache->{ $key } = $val; + } + } + } +} + +{ + package msgfmt::transifex; + use base 'msgfmt::java'; + + # the differences between transifex and java properties only matter in + # the outward direction: During import they can be treated the same way +} + +{ + package msgfmt::android; + + ANDROID_XML: + { + package msgfmt::android::xml; + + my @stack; + my $data; + my $key; + our $cache; + + sub StartDocument ($) { @stack = (); $key = '' } + sub Text ($) { if( $key ) { $data .= $_ } } + sub PI ($$$) { } + sub EndDocument ($) { } + + sub EndTag ($$) + { + pop( @stack ); + + if( !$key ) { return; } + + $cache->{ $key } = $data; + $data = $key = ''; + } + + sub StartTag ($$) + { + push( @stack, $_[1] ); + + if( "@stack" eq "resources string" ) + { + $data = ''; + $key = $_{ name }; + } + } + } + + sub parse + { + require XML::Parser; + + if( !$XML::Parser::VERSION ) + { + die("XML::Parser required for android format support\n"); + } + + $msgfmt::android::xml::cache = shift(); + my $stream = shift(); + my $parser = XML::Parser->new( Style => 'Stream', + Pkg => 'msgfmt::android::xml' ); + $parser->parse( $stream ); + } +} diff --git a/utils/jenkins-build.sh b/utils/jenkins-build.sh new file mode 100755 index 000000000..ea8a52040 --- /dev/null +++ b/utils/jenkins-build.sh @@ -0,0 +1,351 @@ +#!/bin/bash +# +# Copyright © 2013 Vincent Sanders <vince@netsurf-browser.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# * The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# NetSurf continuous integration build script for jenkins +# +# This script is executed by jenkins to build netsurf itself +# +# Usage: jenkins-build.sh +# + +# TARGET is set to the frontend target to build +# label is set to the identifier of the toolchain doing the building + +################# Parameter and environment setup ##################### + +#identifier for this specific build +IDENTIFIER="$CC-${BUILD_JS}-${BUILD_NUMBER}" + +# default atari architecture - bletch +ATARIARCH=68020-60 + +# Ensure the combination of target and toolchain works and set build +# specific parameters too +case ${TARGET} in + "riscos") + case ${label} in + "arm-unknown-riscos") + ARTIFACT_TARGET=riscos + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=netsurf + PKG_SFX=.zip + ;; + + + "windows") + case ${label} in + "i686-w64-mingw32") + ARTIFACT_TARGET=windows + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=netsurf-installer + PKG_SFX=.exe + ;; + + + "cocoa") + case ${label} in + "i686-apple-darwin10") + ARTIFACT_TARGET=Darwin + IDENTIFIER="${label}-${IDENTIFIER}" + ;; + + "powerpc-apple-darwin9") + ARTIFACT_TARGET=powerpc-apple-darwin9 + IDENTIFIER="${ARTIFACT_TARGET}-${IDENTIFIER}" + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=NetSurf + PKG_SFX=.dmg + ;; + + + "amiga") + case ${label} in + "ppc-amigaos") + ARTIFACT_TARGET=amiga + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=NetSurf_Amiga/netsurf + PKG_SFX=.lha + ;; + + + "atari") + case ${label} in + "m68k-atari-mint") + ARTIFACT_TARGET=m68k-atari-mint + PKG_SRC=ns020 + PKG_SFX=.zip + ;; + + "m5475-atari-mint") + ARTIFACT_TARGET=m5475-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/m5475-atari-mint/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/m5475-atari-mint/cross/bin + ATARIARCH=v4e + PKG_SRC=nsv4e + PKG_SFX=.zip + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + IDENTIFIER="${ARTIFACT_TARGET}-${IDENTIFIER}" + ;; + + + "gtk") + case ${label} in + "x86_64-linux-gnu") + ARTIFACT_TARGET=Linux + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=nsgtk + PKG_SFX= + ;; + + + "framebuffer") + case ${label} in + "x86_64-linux-gnu") + ARTIFACT_TARGET=Linux + ;; + + "i686-apple-darwin10") + ARTIFACT_TARGET=Darwin + ;; + + "powerpc-apple-darwin9") + ARTIFACT_TARGET=powerpc-apple-darwin9 + ;; + + "arm-unknown-riscos") + ARTIFACT_TARGET=riscos + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "m68k-atari-mint") + ARTIFACT_TARGET=m68k-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "m5475-atari-mint") + ATARIARCH=v4e + ARTIFACT_TARGET=m5475-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "i686-w64-mingw32") + ARTIFACT_TARGET=windows + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "ppc-amigaos") + ARTIFACT_TARGET=amiga + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + PKG_SRC=nsfb + PKG_SFX= + ;; + + + "monkey") + # monkey target can be built on most of the supported architectures + case ${label} in + "x86_64-linux-gnu") + ARTIFACT_TARGET=Linux + ;; + + "i686-apple-darwin10") + ARTIFACT_TARGET=Darwin + ;; + + "powerpc-apple-darwin9") + ARTIFACT_TARGET=powerpc-apple-darwin9 + ;; + + "arm-unknown-riscos") + ARTIFACT_TARGET=riscos + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "m68k-atari-mint") + ARTIFACT_TARGET=m68k-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "m5475-atari-mint") + ATARIARCH=v4e + ARTIFACT_TARGET=m5475-atari-mint + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "i686-w64-mingw32") + ARTIFACT_TARGET=windows + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + "ppc-amigaos") + ARTIFACT_TARGET=amiga + export GCCSDK_INSTALL_ENV=/opt/netsurf/${label}/env + export GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/${label}/cross/bin + ;; + + *) + echo "Target \"${TARGET}\" cannot be built on \"${label})\"" + exit 1 + ;; + + esac + + IDENTIFIER="${label}-${IDENTIFIER}" + PKG_SRC=nsmonkey + PKG_SFX= + ;; + + *) + # TARGET must be in the environment and set correctly + echo "Unkown TARGET \"${TARGET}\"" + exit 1 + ;; + +esac + +# setup environment +export PREFIX=${JENKINS_HOME}/artifacts-${ARTIFACT_TARGET} +export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PREFIX}/lib +export PATH=${PATH}:${PREFIX}/bin + +# configure ccache for clang +if [ "${CC}" = "clang" ];then + export CCACHE_CPP2=yes + export CC="clang -Qunused-arguments" +fi + +# convert javascript parameters +if [ "${BUILD_JS}" = "json" ];then + BUILD_MOZJS=NO + BUILD_JS=YES +else + BUILD_JS=NO + BUILD_MOZJS=NO +fi + + + + +########### Build from source ################## + +# Clean first +make NETSURF_USE_JS=${BUILD_JS} NETSURF_USE_MOZJS=${BUILD_MOZJS} clean + +# Do the Build +make -k NETSURF_USE_JS=${BUILD_JS} NETSURF_USE_MOZJS=${BUILD_MOZJS} CI_BUILD=${BUILD_NUMBER} ATARIARCH=${ATARIARCH} Q= + + + + + +############ Package artifact construction ################ + +#destination for package artifacts +DESTDIR=/srv/ci.netsurf-browser.org/html/builds/${TARGET}/ + +# build the package file +make -k NETSURF_USE_JS=${BUILD_JS} NETSURF_USE_MOZJS=${BUILD_MOZJS} CI_BUILD=${BUILD_NUMBER} ATARIARCH=${ATARIARCH} package Q= + +if [ ! -f "${PKG_SRC}${PKG_SFX}" ]; then + # unable to find package file + exit 1 +fi + + + +############ Package artifact deployment ################ + +# copy the file into the output - always use scp as it works local or remote +scp "${PKG_SRC}${PKG_SFX}" netsurf@ci.netsurf-browser.org:${DESTDIR}/NetSurf-${IDENTIFIER}${PKG_SFX} + +# remove the package file +rm -f "${PKG_SRC}${PKG_SFX}" + +# setup latest link +ssh netsurf@ci.netsurf-browser.org "rm -f ${DESTDIR}/LATEST && echo "NetSurf-${IDENTIFIER}${PKG_SFX}" > ${DESTDIR}/LATEST" diff --git a/utils/log.c b/utils/log.c index 96a6d3c5b..2aa39ee41 100644 --- a/utils/log.c +++ b/utils/log.c @@ -31,9 +31,9 @@ nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv) { nserror ret = NSERROR_OK; - if (((*pargc) > 1) && - (argv[1][0] == '-') && - (argv[1][1] == 'v') && + if (((*pargc) > 1) && + (argv[1][0] == '-') && + (argv[1][1] == 'v') && (argv[1][2] == 0)) { int argcmv; for (argcmv = 2; argcmv < (*pargc); argcmv++) { @@ -43,15 +43,17 @@ nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv) /* ensure we actually show logging */ verbose_log = true; - - /* ensure stderr is available */ - if (ensure != NULL) { - if (ensure(stderr) == false) { - /* failed to ensure output */ - ret = NSERROR_INIT_FAILED; - } - } } + + /* ensure output file handle is correctly configured */ + if ((verbose_log == true) && + (ensure != NULL) && + (ensure(stderr) == false)) { + /* failed to ensure output configuration */ + ret = NSERROR_INIT_FAILED; + verbose_log = false; + } + return ret; } diff --git a/utils/memdebug.c b/utils/memdebug.c deleted file mode 100644 index 0f94f6f13..000000000 --- a/utils/memdebug.c +++ /dev/null @@ -1,381 +0,0 @@ -/** \file - * Heap debugging functions (implementation). - * - * Based on memdebug.c from curl (see below), with the following modifications: - * - * - renamed functions from curl_ to memdebug_ - * - added memdebug_strndup - * - added guard bytes before and after each block to help detect overflows - * - if a guard byte is corrupted during free, dumps the DA to file - */ - -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - * $Id: memdebug.c,v 1.1 2004/07/28 22:35:02 bursa Exp $ - ***************************************************************************/ - -#include <assert.h> -#include <stdbool.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/socket.h> -#ifdef riscos -#include <unixlib/local.h> - -#include "oslib/os.h" -#include "oslib/osfile.h" -#endif - -#include "memdebug.h" - -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - -#define MAGIC 0x34343434 -#define GUARD 0x34 - -#if defined(riscos) && !defined(__ELF__) -extern int __dynamic_num; -#endif - -struct memdebug { - size_t size; - unsigned int magic; - double mem[1]; - /* I'm hoping this is the thing with the strictest alignment - * requirements. That also means we waste some space :-( */ -}; - -/* - * Note that these debug functions are very simple and they are meant to - * remain so. For advanced analysis, record a log file and write perl scripts - * to analyze them! - * - * Don't use these with multithreaded test programs! - */ - -#define logfile memdebug_debuglogfile -FILE *memdebug_debuglogfile; -static bool memlimit; /* enable memory limit */ -static long memsize; /* set number of mallocs allowed */ - -/* this sets the log file name */ -void memdebug_memdebug(const char *logname) -{ - if(logname) - logfile = fopen(logname, "w"); - else - logfile = stderr; -} - -/* This function sets the number of malloc() calls that should return - successfully! */ -void memdebug_memlimit(long limit) -{ - memlimit = true; - memsize = limit; -} - -/* returns true if this isn't allowed! */ -static bool countcheck(const char *func, int line, const char *source) -{ - /* if source is NULL, then the call is made internally and this check - should not be made */ - if(memlimit && source) { - if(!memsize) { - if(logfile && source) - fprintf(logfile, "LIMIT %s:%d %s reached memlimit\n", - source, line, func); - if(source) - fprintf(stderr, "LIMIT %s:%d %s reached memlimit\n", - source, line, func); - return true; /* RETURN ERROR! */ - } - else - memsize--; /* countdown */ - - /* log the countdown */ - if(logfile && source) - fprintf(logfile, "LIMIT %s:%d %ld ALLOCS left\n", - source, line, memsize); - - } - - return false; /* allow this */ -} - -void *memdebug_malloc(size_t wantedsize, int line, const char *source) -{ - struct memdebug *mem; - size_t size; - - if(countcheck("malloc", line, source)) - return NULL; - - /* alloc at least 64 bytes */ - size = sizeof(struct memdebug)+wantedsize + 8; - - mem=(struct memdebug *)(malloc)(size); - if(mem) { - unsigned int i; - /* fill memory with junk */ - memset(mem->mem, 0xA5, wantedsize); - mem->size = wantedsize; - mem->magic = MAGIC; - for (i = 0; i != 8; i++) - ((char *) mem->mem)[wantedsize + i] = GUARD; - } - - if(logfile && source) - fprintf(logfile, "MEM %s:%d malloc(%zu) = %p\n", - source, line, wantedsize, mem ? mem->mem : 0); - return (mem ? mem->mem : NULL); -} - -void *memdebug_calloc(size_t wanted_elements, size_t wanted_size, - int line, const char *source) -{ - struct memdebug *mem; - size_t size, user_size; - - if(countcheck("calloc", line, source)) - return NULL; - - /* alloc at least 64 bytes */ - user_size = wanted_size * wanted_elements; - size = sizeof(struct memdebug) + user_size + 8; - - mem = (struct memdebug *)(malloc)(size); - if(mem) { - unsigned int i; - /* fill memory with zeroes */ - memset(mem->mem, 0, user_size); - mem->size = user_size; - mem->magic = MAGIC; - for (i = 0; i != 8; i++) - ((char *) mem->mem)[mem->size + i] = GUARD; - } - - if(logfile && source) - fprintf(logfile, "MEM %s:%d calloc(%zu,%zu) = %p\n", - source, line, wanted_elements, wanted_size, mem ? mem->mem : 0); - return (mem ? mem->mem : NULL); -} - -char *memdebug_strdup(const char *str, int line, const char *source) -{ - char *mem; - size_t len; - - assert(str != NULL); - - if(countcheck("strdup", line, source)) - return NULL; - - len=strlen(str)+1; - - mem=memdebug_malloc(len, 0, NULL); /* NULL prevents logging */ - if (mem) - memcpy(mem, str, len); - - if(logfile) - fprintf(logfile, "MEM %s:%d strdup(%p) (%zu) = %p\n", - source, line, str, len, mem); - - return mem; -} - -char *memdebug_strndup(const char *str, size_t size, int line, const char *source) -{ - char *mem; - size_t len; - - assert(str != NULL); - - if(countcheck("strndup", line, source)) - return NULL; - - len=strlen(str)+1; - if (size < len - 1) - len = size + 1; - - mem=memdebug_malloc(len, 0, NULL); /* NULL prevents logging */ - if (mem) { - memcpy(mem, str, len); - mem[len - 1] = 0; - } - - if(logfile) - fprintf(logfile, "MEM %s:%d strndup(%p, %zd) (%zu) = %p\n", - source, line, str, size, len, mem); - - return mem; -} - -/* We provide a realloc() that accepts a NULL as pointer, which then - performs a malloc(). In order to work with ares. */ -void *memdebug_realloc(void *ptr, size_t wantedsize, - int line, const char *source) -{ - unsigned int i; - struct memdebug *mem=NULL; - - size_t size = sizeof(struct memdebug)+wantedsize+8; - - if(countcheck("realloc", line, source)) - return NULL; - - if(ptr) { - mem = (struct memdebug *)(void *) - ((char *)ptr - offsetof(struct memdebug, mem)); - } - - if(logfile) { - if (mem && mem->magic != MAGIC) - fprintf(logfile, "MAGIC match failed!\n"); - for (i = 0; mem && i != 8; i++) - if (((char *) mem->mem)[mem->size + i] != GUARD) - fprintf(logfile, "GUARD %u match failed!\n", i); - fprintf(logfile, "MEM %s:%d realloc(%p, %zu) = ", - source, line, ptr, wantedsize); - fflush(logfile); - } - - mem=(struct memdebug *)(realloc)(mem, size); - if(logfile) - fprintf(logfile, "%p\n", mem?mem->mem:NULL); - - if(mem) { - mem->size = wantedsize; - mem->magic = MAGIC; - for (i = 0; i != 8; i++) - ((char *) mem->mem)[wantedsize + i] = GUARD; - return mem->mem; - } - - return NULL; -} - -void memdebug_free(void *ptr, int line, const char *source) -{ - unsigned int i; - struct memdebug *mem; - - if (!ptr) - return; - - assert(ptr != NULL); - - mem = (struct memdebug *)(void *) - ((char *)ptr - offsetof(struct memdebug, mem)); - if(logfile) { - fprintf(logfile, "MEM %s:%d free(%p)\n", source, line, ptr); - if (mem->magic != MAGIC) { - fprintf(logfile, "MAGIC match failed!\n"); -#ifdef riscos - #ifndef __ELF__ - if (__dynamic_num != -1) { - int size; - byte *base_address; - xosdynamicarea_read(__dynamic_num, &size, &base_address, - 0, 0, 0, 0, 0); - fprintf(logfile, "saving DA %i %p %x\n", __dynamic_num, base_address, - size); - xosfile_save("core", (bits) base_address, 0, base_address, - base_address + size); - } - #else - __unixlib_write_coredump(NULL); - #endif -#endif - } - fflush(logfile); - for (i = 0; i != 8; i++) - if (((char *) mem->mem)[mem->size + i] != GUARD) - fprintf(logfile, "GUARD %u match failed!\n", i); - fflush(logfile); - } - - /* destroy */ - memset(mem->mem, 0x13, mem->size); - mem->magic = 0x13131313; - for (i = 0; i != 8; i++) - ((char *) mem->mem)[mem->size + i] = 0x13; - - /* free for real */ - (free)(mem); -} - -int memdebug_socket(int domain, int type, int protocol, int line, - const char *source) -{ - int sockfd=(socket)(domain, type, protocol); - if(logfile && (sockfd!=-1)) - fprintf(logfile, "FD %s:%d socket() = %d\n", - source, line, sockfd); - return sockfd; -} - -int memdebug_accept(int s, void *saddr, void *saddrlen, - int line, const char *source) -{ - struct sockaddr *addr = (struct sockaddr *)saddr; - socklen_t *addrlen = (socklen_t *)saddrlen; - int sockfd=(accept)(s, addr, addrlen); - if(logfile) - fprintf(logfile, "FD %s:%d accept() = %d\n", - source, line, sockfd); - return sockfd; -} - -/* this is our own defined way to close sockets on *ALL* platforms */ -int memdebug_sclose(int sockfd, int line, const char *source) -{ - int res=sclose(sockfd); - if(logfile) - fprintf(logfile, "FD %s:%d sclose(%d)\n", - source, line, sockfd); - return res; -} - -FILE *memdebug_fopen(const char *file, const char *mode, - int line, const char *source) -{ - FILE *res=(fopen)(file, mode); - if(logfile) - fprintf(logfile, "FILE %s:%d fopen(\"%s\",\"%s\") = %p\n", - source, line, file, mode, res); - return res; -} - -int memdebug_fclose(FILE *file, int line, const char *source) -{ - int res; - - assert(file != NULL); - - res=(fclose)(file); - if(logfile) - fprintf(logfile, "FILE %s:%d fclose(%p)\n", - source, line, file); - return res; -} diff --git a/utils/memdebug.h b/utils/memdebug.h deleted file mode 100644 index bdf933cc3..000000000 --- a/utils/memdebug.h +++ /dev/null @@ -1,106 +0,0 @@ -/** \file - * Heap debugging functions (interface). - * - * Based on memdebug.h from curl (see below), with the following modifications: - * - * - renamed functions from curl_ to memdebug_ - * - added memdebug_strndup - * - added guard bytes before and after each block to help detect overflows - * - if a guard byte is corrupted during free, dumps the DA to file - */ - -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - * $Id: memdebug.h,v 1.1 2004/07/28 22:35:02 bursa Exp $ - ***************************************************************************/ - -#ifndef _MEMDEBUG_H_ -#define _MEMDEBUG_H_ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/types.h> - -#define logfile memdebug_debuglogfile - -extern FILE *logfile; - -/* memory functions */ -void *memdebug_malloc(size_t size, int line, const char *source); -void *memdebug_calloc(size_t elements, size_t size, int line, const char *source); -void *memdebug_realloc(void *ptr, size_t size, int line, const char *source); -void memdebug_free(void *ptr, int line, const char *source); -char *memdebug_strdup(const char *str, int line, const char *source); -char *memdebug_strndup(const char *str, size_t size, int line, const char *source); -void memdebug_memdebug(const char *logname); -void memdebug_memlimit(long limit); - -/* file descriptor manipulators */ -int memdebug_socket(int domain, int type, int protocol, int line , const char *); -int memdebug_sclose(int sockfd, int, const char *source); -int memdebug_accept(int s, void *addr, void *addrlen, - int line, const char *source); - -/* FILE functions */ -FILE *memdebug_fopen(const char *file, const char *mode, int line, - const char *source); -int memdebug_fclose(FILE *file, int line, const char *source); - -#ifndef MEMDEBUG_NODEFINES - -#undef strdup -#define strdup(ptr) memdebug_strdup(ptr, __LINE__, __FILE__) -#define strndup(ptr,size) memdebug_strndup(ptr, size, __LINE__, __FILE__) -#define malloc(size) memdebug_malloc(size, __LINE__, __FILE__) -#define calloc(nbelem,size) memdebug_calloc(nbelem, size, __LINE__, __FILE__) -#define realloc(ptr,size) memdebug_realloc(ptr, size, __LINE__, __FILE__) -#define free(ptr) memdebug_free(ptr, __LINE__, __FILE__) - -#define socket(domain,type,protocol)\ - memdebug_socket(domain,type,protocol,__LINE__,__FILE__) -#undef accept /* for those with accept as a macro */ -#define accept(sock,addr,len)\ - memdebug_accept(sock,addr,len,__LINE__,__FILE__) - -#define getaddrinfo(host,serv,hint,res) \ - memdebug_getaddrinfo(host,serv,hint,res,__LINE__,__FILE__) -#define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \ - memdebug_getnameinfo(sa,salen,host,hostlen,serv,servlen,flags, __LINE__, \ - __FILE__) -#define freeaddrinfo(data) \ - memdebug_freeaddrinfo(data,__LINE__,__FILE__) - -/* sclose is probably already defined, redefine it! */ -#undef sclose -#define sclose(sockfd) memdebug_sclose(sockfd,__LINE__,__FILE__) -/* ares-adjusted define: */ -#undef closesocket -#define closesocket(sockfd) memdebug_sclose(sockfd,__LINE__,__FILE__) - -#undef fopen -#define fopen(file,mode) memdebug_fopen(file,mode,__LINE__,__FILE__) -#define fclose(file) memdebug_fclose(file,__LINE__,__FILE__) - -#endif /* MEMDEBUG_NODEFINES */ - -#endif diff --git a/utils/nsoption.c b/utils/nsoption.c new file mode 100644 index 000000000..f6244cd48 --- /dev/null +++ b/utils/nsoption.c @@ -0,0 +1,896 @@ +/* + * Copyright 2012 Vincent Sanders <vince@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 "desktop/plot_style.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_UINT(NAME, DEFAULT) \ + { #NAME, sizeof(#NAME) - 1, OPTION_UINT, { .u = DEFAULT } }, + +#define NSOPTION_COLOUR(NAME, DEFAULT) \ + { #NAME, sizeof(#NAME) - 1, OPTION_COLOUR, { .c = DEFAULT } }, + +/** The table of compiled in default options */ +static 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_UINT +#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_UINT: + option->value.u = strtoul(value, NULL, 0); + break; + + case OPTION_COLOUR: + if (sscanf(value, "%x", &rgbcolour) == 1) { + 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, struct nsoption_s *defs) +{ + int cloop; + bool black = true; + + 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; + } + + /* to aid migration from old, broken, configuration files this + * checks to see if all the system colours are set to black + * and returns them to defaults instead + */ + + for (cloop = NSOPTION_SYS_COLOUR_START; + cloop <= NSOPTION_SYS_COLOUR_END; + cloop++) { + if (opts[cloop].value.c != 0) { + black = false; + break; + } + } + if (black == true) { + for (cloop = NSOPTION_SYS_COLOUR_START; + cloop <= NSOPTION_SYS_COLOUR_END; + cloop++) { + opts[cloop].value.c = defs[cloop].value.c; + } + } +} + +/** + * Determines if an option is different between two option tables. + * + * @param opts The first table to compare. + * @param defs The second table to compare. + * @param entry The option to compare. + * @return true if the option differs false if not. + */ +static bool +nsoption_is_set(const struct nsoption_s *opts, + const struct nsoption_s *defs, + const enum nsoption_e entry) +{ + bool ret = false; + + switch (opts[entry].type) { + case OPTION_BOOL: + if (opts[entry].value.b != defs[entry].value.b) { + ret = true; + } + break; + + case OPTION_INTEGER: + if (opts[entry].value.i != defs[entry].value.i) { + ret = true; + } + break; + + case OPTION_UINT: + if (opts[entry].value.u != defs[entry].value.u) { + ret = true; + } + break; + + case OPTION_COLOUR: + if (opts[entry].value.c != defs[entry].value.c) { + ret = true; + } + break; + + case OPTION_STRING: + /* set 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 (((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))) { + ret = true; + } + break; + + } + return ret; +} + +/** + * 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; /* index to option being output */ + colour rgbcolour; /* RRGGBB */ + + for (entry = 0; entry < NSOPTION_LISTEND; entry++) { + if ((all == false) && + (nsoption_is_set(opts, defs, entry) == false)) { + continue; + } + + switch (opts[entry].type) { + case OPTION_BOOL: + fprintf(fp, "%s:%c\n", + opts[entry].key, + opts[entry].value.b ? '1' : '0'); + break; + + case OPTION_INTEGER: + fprintf(fp, "%s:%i\n", + opts[entry].key, + opts[entry].value.i); + + break; + + case OPTION_UINT: + fprintf(fp, "%s:%u\n", + opts[entry].key, + opts[entry].value.u); + break; + + case OPTION_COLOUR: + 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: + 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_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) | + ((0x00FF0000 & option->value.c) >> 16)); + slen = snprintf(string + pos, + size - pos, + "<span style=\"background-color: #%06x; " + "color: #%06x; " + "font-family:Monospace; \">#%06X</span>", + rgbcolour, + colour_to_bw_furthest(rgbcolour), + 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_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) | + ((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; +} + +/** + * Duplicates an option table. + * + * Allocates a new option table and copies an existing one into it. + * + * @param src The source table to copy + */ +static nserror +nsoption_dup(struct nsoption_s *src, struct nsoption_s **pdst) +{ + struct nsoption_s *dst; + dst = malloc(sizeof(defaults)); + if (dst == NULL) { + return NSERROR_NOMEM; + } + *pdst = dst; + + /* copy the source table into the destination table */ + memcpy(dst, src, sizeof(defaults)); + + while (src->key != NULL) { + if ((src->type == OPTION_STRING) && + (src->value.s != NULL)) { + dst->value.s = strdup(src->value.s); + } + src++; + dst++; + } + + return NSERROR_OK; +} + +/** + * frees an option table. + * + * Iterates through an option table a freeing resources as required + * finally freeing the option table itself. + * + * @param opts The option table to free. + */ +static nserror +nsoption_free(struct nsoption_s *opts) +{ + struct nsoption_s *cur; /* option being freed */ + + if (opts == NULL) { + return NSERROR_BAD_PARAMETER; + } + + cur = opts; + + while (cur->key != NULL) { + if ((cur->type == OPTION_STRING) && (cur->value.s != NULL)) { + free(cur->value.s); + } + cur++; + } + free(opts); + + return NSERROR_OK; +} + + +/* 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 *defs; + struct nsoption_s *opts; + + ret = nsoption_dup(&defaults[0], &defs); + if (ret != NSERROR_OK) { + return ret; + } + + /* update the default table */ + if (set_defaults != NULL) { + /** @todo it would be better if the frontends actually + * set values in the passed in table instead of + * assuming the global one. + */ + opts = nsoptions; + nsoptions = defs; + + ret = set_defaults(defs); + + if (ret != NSERROR_OK) { + nsoptions = opts; + nsoption_free(defs); + return ret; + } + } + + /* copy the default values into the working set */ + ret = nsoption_dup(defs, &opts); + if (ret != NSERROR_OK) { + nsoption_free(defs); + return ret; + } + + /* return values if wanted */ + if (popts != NULL) { + *popts = opts; + } else { + nsoptions = opts; + } + + if (pdefs != NULL) { + *pdefs = defs; + } else { + nsoptions_default = defs; + } + + return NSERROR_OK; +} + +/* exported interface documented in utils/nsoption.h */ +nserror nsoption_finalise(struct nsoption_s *opts, struct nsoption_s *defs) +{ + /* check to see if global table selected */ + if (opts == NULL) { + opts = nsoptions; + } + + nsoption_free(opts); + + /* check to see if global table selected */ + if (defs == NULL) { + defs = nsoptions_default; + } + + nsoption_free(defs); + + 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; + struct nsoption_s *defs; + + if (path == NULL) { + return NSERROR_BAD_PARAMETER; + } + + /* check to see if global table selected */ + if (opts == NULL) { + opts = nsoptions; + } + + /** @todo is this and API bug not being a parameter */ + defs = nsoptions_default; + + 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, defs); + + 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 = nsoptions_default; + } + + 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 'p': + if (nsoption_is_set(nsoptions, + nsoptions_default, + option_idx)) { + slen += snprintf(string + slen, + size - slen, + "user"); + } else { + slen += snprintf(string + slen, + size - slen, + "default"); + } + 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_UINT: + slen += snprintf(string + slen, + size - slen, + "unsigned 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; +} + +/* exported interface documented in options.h */ +nserror +nsoption_set_tbl_charp(struct nsoption_s *opts, + enum nsoption_e option_idx, + char *s) +{ + struct nsoption_s *option; + + option = &opts[option_idx]; + + /* ensure it is a string option */ + if (option->type != OPTION_STRING) { + return NSERROR_BAD_PARAMETER; + } + + /* free any existing string */ + if (option->value.s != NULL) { + free(option->value.s); + } + + option->value.s = s; + + /* check for empty string */ + if ((option->value.s != NULL) && (*option->value.s == 0)) { + free(option->value.s); + option->value.s = NULL; + } + return NSERROR_OK; +} diff --git a/utils/nsoption.h b/utils/nsoption.h new file mode 100644 index 000000000..d111729aa --- /dev/null +++ b/utils/nsoption.h @@ -0,0 +1,343 @@ +/* + * Copyright 2012 Vincent Sanders <vince@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 access 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_ + +#include <stdio.h> +#include <stdint.h> +#include <stdbool.h> + +#include "utils/errors.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_UINT(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_UINT +#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 +/** Default reflow time in cs */ +#define DEFAULT_REFLOW_PERIOD 25 +#endif + +/** The options type. */ +enum nsoption_type_e { + OPTION_BOOL, /**< Option is a boolean. */ + OPTION_INTEGER, /**< Option is an integer. */ + OPTION_UINT, /**< Option is an unsigned integer */ + OPTION_STRING, /**< option is a heap allocated string. */ + OPTION_COLOUR /**< Option is a netsurf colour. */ +}; + +struct nsoption_s { + const char *key; + int key_len; + enum nsoption_type_e type; + union { + bool b; + int i; + unsigned int u; + 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_UINT(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_UINT +#undef NSOPTION_COLOUR + +/** + * global active 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); + + +/** + * Finalise option system + * + * Releases all resources allocated in the initialisation. + * + * @param opts the options table or NULL to use global table. + * @param defs the default options table to use or NULL to use global table + * return The error status + */ +nserror nsoption_finalise(struct nsoption_s *opts, struct nsoption_s *defs); + + +/** + * 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) + * %p - provenance either "user" or "default" + * + * @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); + + +/** + * Get the value of a boolean option. + * + * Gets the value of an option assuming it is a boolean type. + * @note option type is unchecked so care must be taken in caller. + */ +#define nsoption_bool(OPTION) (nsoptions[NSOPTION_##OPTION].value.b) + + +/** + * Get the value of an integer option. + * + * Gets the value of an option assuming it is a integer type. + * @note option type is unchecked so care must be taken in caller. + */ +#define nsoption_int(OPTION) (nsoptions[NSOPTION_##OPTION].value.i) + + +/** + * Get the value of an unsigned integer option. + * + * Gets the value of an option assuming it is a integer type. + * @note option type is unchecked so care must be taken in caller. + */ +#define nsoption_uint(OPTION) (nsoptions[NSOPTION_##OPTION].value.u) + + +/** + * Get the value of a string option. + * + * Gets the value of an option assuming it is a string type. + * @note option type is unchecked so care must be taken in caller. + */ +#define nsoption_charp(OPTION) (nsoptions[NSOPTION_##OPTION].value.s) + + +/** + * Get the value of a netsurf colour option. + * + * Gets the value of an option assuming it is a colour type. + * @note option type is unchecked so care must be taken in caller. + */ +#define nsoption_colour(OPTION) (nsoptions[NSOPTION_##OPTION].value.c) + + +/** set a boolean option in the default table */ +#define nsoption_set_bool(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.b = VALUE + + +/** set an integer option in the default table */ +#define nsoption_set_int(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.i = VALUE + + +/** set a colour option in the default table */ +#define nsoption_set_colour(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.c = VALUE + + +/** + * Set string option in specified table. + * + * Sets the string option to the value given freeing any resources + * currently allocated to the option. If the passed string is empty it + * is converted to the NULL value. + * + * @param opts The table to set option in + * @param option_idx The option + * @param s The string to set. This is used directly and not copied. + */ +nserror nsoption_set_tbl_charp(struct nsoption_s *opts, enum nsoption_e option_idx, char *s); + +/** set string option in default table */ +#define nsoption_set_charp(OPTION, VALUE) \ + nsoption_set_tbl_charp(nsoptions, NSOPTION_##OPTION, VALUE) + +/** set string option in default table if currently unset */ +#define nsoption_setnull_charp(OPTION, VALUE) \ + do { \ + if (nsoptions[NSOPTION_##OPTION].value.s == NULL) { \ + nsoption_set_tbl_charp(nsoptions, NSOPTION_##OPTION, VALUE); \ + } else { \ + free(VALUE); \ + } \ + } while (0) + +#endif diff --git a/utils/nsurl.c b/utils/nsurl.c index 23e177e05..61f849e5f 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -154,6 +154,7 @@ struct nsurl { struct nsurl_components components; int count; /* Number of references to NetSurf URL object */ + uint32_t hash; /* Hash value for nsurl identification */ size_t length; /* Length of string */ char string[FLEX_ARRAY_LEN_DECL]; /* Full URL as a string */ @@ -1185,6 +1186,43 @@ static void nsurl_get_string(const struct nsurl_components *url, char *url_s, } +/** + * Calculate hash value + * + * \param url NetSurf URL object to set hash value for + */ +static void nsurl_calc_hash(nsurl *url) +{ + uint32_t hash = 0; + + if (url->components.scheme) + hash ^= lwc_string_hash_value(url->components.scheme); + + if (url->components.username) + hash ^= lwc_string_hash_value(url->components.username); + + if (url->components.password) + hash ^= lwc_string_hash_value(url->components.password); + + if (url->components.host) + hash ^= lwc_string_hash_value(url->components.host); + + if (url->components.port) + hash ^= lwc_string_hash_value(url->components.port); + + if (url->components.path) + hash ^= lwc_string_hash_value(url->components.path); + + if (url->components.query) + hash ^= lwc_string_hash_value(url->components.query); + + if (url->components.fragment) + hash ^= lwc_string_hash_value(url->components.fragment); + + url->hash = hash; +} + + #ifdef NSURL_DEBUG /** * Dump a NetSurf URL's internal components @@ -1282,6 +1320,9 @@ nserror nsurl_create(const char * const url_s, nsurl **url) /* Fill out the url string */ nsurl_get_string(&c, (*url)->string, &str_len, str_flags); + /* Get the nsurl's hash */ + nsurl_calc_hash(*url); + /* Give the URL a reference */ (*url)->count = 1; @@ -1615,6 +1656,15 @@ size_t nsurl_length(const nsurl *url) /* exported interface, documented in nsurl.h */ +uint32_t nsurl_hash(const nsurl *url) +{ + assert(url != NULL); + + return url->hash; +} + + +/* exported interface, documented in nsurl.h */ nserror nsurl_join(const nsurl *base, const char *rel, nsurl **joined) { struct url_markers m; @@ -1819,6 +1869,9 @@ nserror nsurl_join(const nsurl *base, const char *rel, nsurl **joined) /* Fill out the url string */ nsurl_get_string(&c, (*joined)->string, &str_len, str_flags); + /* Get the nsurl's hash */ + nsurl_calc_hash(*joined); + /* Give the URL a reference */ (*joined)->count = 1; @@ -1871,6 +1924,9 @@ nserror nsurl_defragment(const nsurl *url, nsurl **no_frag) pos += length; *pos = '\0'; + /* Get the nsurl's hash */ + nsurl_calc_hash(*no_frag); + /* Give the URL a reference */ (*no_frag)->count = 1; @@ -1936,6 +1992,9 @@ nserror nsurl_refragment(const nsurl *url, lwc_string *frag, nsurl **new_url) (*new_url)->components.scheme_type = url->components.scheme_type; + /* Get the nsurl's hash */ + nsurl_calc_hash(*new_url); + /* Give the URL a reference */ (*new_url)->count = 1; @@ -2019,6 +2078,9 @@ nserror nsurl_replace_query(const nsurl *url, const char *query, (*new_url)->components.scheme_type = url->components.scheme_type; + /* Get the nsurl's hash */ + nsurl_calc_hash(*new_url); + /* Give the URL a reference */ (*new_url)->count = 1; @@ -2114,6 +2176,9 @@ nserror nsurl_parent(const nsurl *url, nsurl **new_url) (*new_url)->components.scheme_type = url->components.scheme_type; + /* Get the nsurl's hash */ + nsurl_calc_hash(*new_url); + /* Give the URL a reference */ (*new_url)->count = 1; diff --git a/utils/nsurl.h b/utils/nsurl.h index b075c42a1..435df73bd 100644 --- a/utils/nsurl.h +++ b/utils/nsurl.h @@ -208,6 +208,15 @@ size_t nsurl_length(const nsurl *url); /** + * Get a URL's hash value + * + * \param url NetSurf URL get hash value for. + * \return the hash value + */ +uint32_t nsurl_hash(const nsurl *url); + + +/** * Join a base url to a relative link part, creating a new NetSurf URL object * * \param base NetSurf URL containing the base to join rel to diff --git a/utils/split-messages.pl b/utils/split-messages.pl index 2bbe79a43..45e55391b 100755..100644 --- a/utils/split-messages.pl +++ b/utils/split-messages.pl @@ -1,23 +1,239 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl +# +# Copyright 2013 Vivek Dasmohapatra <vivek@collabora.co.uk> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# * The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +=head1 + +Filter the NetSurf combined messages (i10n) file according to language +and platform and generate output in a selection of formats for use +both internally within netsurf and externally for translation +services. + +=cut use strict; -die "usage: split-messages <langname> <platname> < FatMessages > ThinMessages" if ($#ARGV != 1); +use Getopt::Long (); +use Fcntl qw( O_CREAT O_EXCL O_WRONLY O_APPEND O_RDONLY O_WRONLY ); + +use constant GETOPT_OPTS => qw( auto_abbrev no_getopt_compat bundling ); +use constant GETOPT_SPEC => + qw( output|o=s + input|i=s + lang|l=s + plat|platform|p=s + format|fmt|f=s + help|h|? ); + +# default option values: +my %opt = qw( plat any format messages ); + +sub input_stream (); +sub output_stream (); +sub formatter (); +sub static_section($); +sub usage (); + +sub main () +{ + my $input; + my $output; + my $format; + my $header; + my $footer; + my $opt_ok; + + # option parsing: + Getopt::Long::Configure( GETOPT_OPTS ); + $opt_ok = Getopt::Long::GetOptions( \%opt, GETOPT_SPEC ); + + # allow input and output to be specified as non-option arguments: + if( @ARGV ) { $opt{input } ||= shift( @ARGV ) } + if( @ARGV ) { $opt{output} ||= shift( @ARGV ) } + + # open the appropriate streams and get the formatter and headers: + if( $opt_ok ) + { + $input = input_stream(); + $output = output_stream(); + $format = formatter(); + $header = static_section('header'); + $footer = static_section('footer'); + } + + # double check the options are sane (and we weren't asked for the help) + if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ ) + { + usage(); + } + + # we are good to go: + print( $output $header ); + + while (<$input>) + { + /^#/ && next; + /^\s*$/ && next; + # only parsing thinsg that look like message lines: + if( /^([a-z]{2}).([^.]+).([^:]+):(.*)/ ) + { + my( $lang, $plat, $key, $val ) = ( $1, $2, $3, $4 ); + + if( $lang ne $opt{lang} ) { next }; + if( $opt{plat} eq 'any' || + $opt{plat} eq $plat || + 'all' eq $plat ) + { + print( $output $format->( $key, $val ) ); + } + } + else + { + warn( "Malformed entry: $_" ); + } + } + + print( $output $footer ); +} + +main(); + +sub usage () +{ + my @fmt = map { s/::$//; $_ } keys(%{$::{'msgfmt::'}}); + print(STDERR <<TXT ); +usage: + $0 -l lang-code \ + [-o output-file] [-i input-file] [-p platform] [-f format] + + $0 -l lang-code ... [input-file [output-file]] + + lang-code : en fr ko ... (no default) + platform : any gtk ami (default 'any') + format : @fmt (default 'messages') + input-file : defaults to standard input + output-file: defaults to standard output +TXT + exit(1); +} + +sub input_stream () +{ + if( $opt{input} ) + { + my $ifh; + + sysopen( $ifh, $opt{input}, O_RDONLY ) || + die( "$0: Failed to open input file $opt{input}: $!\n" ); -my $langname = $ARGV[0]; -my $platname = $ARGV[1]; + return $ifh; + } + + return \*STDIN; +} + +sub output_stream () +{ + if( $opt{output} ) + { + my $ofh; + + sysopen( $ofh, $opt{output}, O_CREAT|O_EXCL|O_APPEND|O_WRONLY ) || + die( "$0: Failed to open output file $opt{output}: $!\n" ); + + return $ofh; + } + + return \*STDOUT; +} + +sub formatter () +{ + my $name = $opt{format}; + my $func = "msgfmt::$name"->UNIVERSAL::can("format"); + + return $func || die( "No handler found for format '$name'\n" ); +} + +sub static_section ($) +{ + my $name = $opt{format}; + my $sect = shift(); + my $func = "msgfmt::$name"->UNIVERSAL::can( $sect ); + + return $func ? $func->() : ""; +} + +# format implementations: +{ + package msgfmt::java; + + sub escape { $_[0] =~ s/([:'\\])/\\$1/g; $_[0] } + sub format { return join(' = ', $_[0], escape( $_[1] ) ) . "\n" } + sub header { "# autogenerated from " . ($opt{input} || '-stdin-') . "\n" } +} + +{ + package msgfmt::messages; # native netsurf format + + sub format { return join( ":", @_ ) . "\n" } + sub header + { + my $in = $opt{input} || '-stdin-'; + return <<TXT; +# This messages file is automatically generated from $in +# at build-time. Please go and edit that instead of this.\n +TXT + } +} + +{ + package msgfmt::transifex; + use base 'msgfmt::java'; + + # transifex has the following quirks: + # \ processing is buggy - they re-process every \\ as a \ + # so \\n, instead or producing literal '\n', is interpreted as \ ^J + # Additionally, although the java properties format specifies + # that ' should be \ escaped, transifex does not allow/support this: + sub escape { $_[0] =~ s/(:|\\(?![abfnrtv]))/\\$1/g; $_[0] } + sub format { return join(' = ', $_[0], escape( $_[1] ) ) . "\n" } +} -my $allprefix = $langname . ".all."; -my $platprefix = $langname . "." . $platname . "."; +########### YAML ########### +#{ +# package msgfmt::yaml; +# use YAML qw(Dump Bless); +# print Dump %data; +#} -print "# This messages file is automatically generated from FatMessages\n"; -print "# at build-time. Please go and edit that instead of this.\n\n"; +{ + package msgfmt::android; -foreach (<STDIN>) { - if (not /^#/ and not /^\s*$/) { - if (/^$allprefix/ or /^$platprefix/) { - s/^$langname\.(all|$platname)\.//; - print "$_"; - } + sub header { qq|<?xml version="1.0" encoding="utf-8"?>\n<resources>\n| } + sub footer { qq|</resources>| } + sub format + { + use HTML::Entities qw(encode_entities); + my $escaped = encode_entities( $_[1], '<>&"' ); + qq| <string name="$_[0]">$escaped</string>\n|; } } diff --git a/utils/utf8.c b/utils/utf8.c index 885ca94ee..127ffe642 100644 --- a/utils/utf8.c +++ b/utils/utf8.c @@ -198,6 +198,13 @@ static struct { iconv_t cd; /**< Iconv conversion descriptor */ } last_cd; +static inline void utf8_clear_cd_cache(void) +{ + last_cd.from[0] = '\0'; + last_cd.to[0] = '\0'; + last_cd.cd = 0; +} + /** * Finalise the UTF-8 library */ @@ -207,9 +214,7 @@ void utf8_finalise(void) iconv_close(last_cd.cd); /* paranoia follows */ - last_cd.from[0] = '\0'; - last_cd.to[0] = '\0'; - last_cd.cd = 0; + utf8_clear_cd_cache(); } /** @@ -331,9 +336,7 @@ utf8_convert_ret utf8_convert(const char *string, size_t len, /* clear the cached conversion descriptor as it's invalid */ if (last_cd.cd) iconv_close(last_cd.cd); - last_cd.from[0] = '\0'; - last_cd.to[0] = '\0'; - last_cd.cd = 0; + utf8_clear_cd_cache(); /** \todo handle the various cases properly * There are 3 possible error cases: * a) Insufficiently large output buffer @@ -411,21 +414,43 @@ utf8_convert_ret utf8_to_html(const char *string, const char *encname, if (len == 0) len = strlen(string); - cd = iconv_open(encname, "UTF-8"); - if (cd == (iconv_t) -1) { - if (errno == EINVAL) - return UTF8_CONVERT_BADENC; - /* default to no memory */ - return UTF8_CONVERT_NOMEM; + /* we cache the last used conversion descriptor, + * so check if we're trying to use it here */ + if (strncasecmp(last_cd.from, "UTF-8", sizeof(last_cd.from)) == 0 && + strncasecmp(last_cd.to, encname, + sizeof(last_cd.to)) == 0 && + last_cd.cd != 0) { + cd = last_cd.cd; + } + else { + /* no match, so create a new cd */ + cd = iconv_open(encname, "UTF-8"); + if (cd == (iconv_t) -1) { + if (errno == EINVAL) + return UTF8_CONVERT_BADENC; + /* default to no memory */ + return UTF8_CONVERT_NOMEM; + } + + /* close the last cd - we don't care if this fails */ + if (last_cd.cd) + iconv_close(last_cd.cd); + + /* and copy the to/from/cd data into last_cd */ + strncpy(last_cd.from, "UTF-8", sizeof(last_cd.from)); + strncpy(last_cd.to, encname, sizeof(last_cd.to)); + last_cd.cd = cd; } /* Worst case is ASCII -> UCS4, with all characters escaped: * "&#xYYYYYY;", thus each input character may become a string - * of 10 UCS4 characters, each 4 bytes in length */ - origoutlen = outlen = len * 10 * 4; + * of 10 UCS4 characters, each 4 bytes in length, plus four for + * terminating the string */ + origoutlen = outlen = len * 10 * 4 + 4; origout = out = malloc(outlen); if (out == NULL) { iconv_close(cd); + utf8_clear_cd_cache(); return UTF8_CONVERT_NOMEM; } @@ -444,6 +469,7 @@ utf8_convert_ret utf8_to_html(const char *string, const char *encname, if (ret != UTF8_CONVERT_OK) { free(origout); iconv_close(cd); + utf8_clear_cd_cache(); return ret; } } @@ -457,6 +483,7 @@ utf8_convert_ret utf8_to_html(const char *string, const char *encname, if (ret != UTF8_CONVERT_OK) { free(origout); iconv_close(cd); + utf8_clear_cd_cache(); return ret; } @@ -474,19 +501,21 @@ utf8_convert_ret utf8_to_html(const char *string, const char *encname, if (ret != UTF8_CONVERT_OK) { free(origout); iconv_close(cd); + utf8_clear_cd_cache(); return ret; } } - iconv_close(cd); + /* Terminate string */ + memset(out, 0, 4); + outlen -= 4; /* Shrink-wrap */ - *result = realloc(origout, origoutlen - outlen + 4); + *result = realloc(origout, origoutlen - outlen); if (*result == NULL) { free(origout); return UTF8_CONVERT_NOMEM; } - memset(*result + (origoutlen - outlen), 0, 4); return UTF8_CONVERT_OK; } diff --git a/utils/utils.c b/utils/utils.c index 3398a7df8..8155f4af1 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -98,26 +98,34 @@ char *remove_underscores(const char *s, bool replacespace) /** * Replace consecutive whitespace with a single space. * + * @todo determine if squash_whitespace utf-8 safe and that it needs to be + * * \param s source string - * \return heap allocated result, or 0 on memory exhaustion + * \return heap allocated result, or NULL on memory exhaustion */ -char * squash_whitespace(const char *s) +char *squash_whitespace(const char *s) { - char *c = malloc(strlen(s) + 1); + char *c; int i = 0, j = 0; - if (!c) - return 0; - do { - if (s[i] == ' ' || s[i] == '\n' || s[i] == '\r' || - s[i] == '\t') { - c[j++] = ' '; - while (s[i] == ' ' || s[i] == '\n' || s[i] == '\r' || - s[i] == '\t') - i++; - } - c[j++] = s[i++]; - } while (s[i - 1] != 0); + + c = malloc(strlen(s) + 1); + if (c != NULL) { + do { + if (s[i] == ' ' || + s[i] == '\n' || + s[i] == '\r' || + s[i] == '\t') { + c[j++] = ' '; + while (s[i] == ' ' || + s[i] == '\n' || + s[i] == '\r' || + s[i] == '\t') + i++; + } + c[j++] = s[i++]; + } while (s[i - 1] != 0); + } return c; } diff --git a/windows/Makefile.target b/windows/Makefile.target index 33a9492af..f49079588 100644 --- a/windows/Makefile.target +++ b/windows/Makefile.target @@ -67,7 +67,7 @@ S_RESOURCES := windows_resource.o S_WINDOWS := main.c window.c gui.c drawable.c misc.c plot.c findfile.c \ font.c bitmap.c about.c prefs.c download.c filetype.c \ localhistory.c login.c schedule.c thumbnail.c tree.c \ - windbg.c system_colour.c + windbg.c S_WINDOWS := $(addprefix windows/,$(S_WINDOWS)) # This is the final source build list @@ -92,7 +92,7 @@ WIN_RES_OBJ := installer.nsi NetSurf.ico netsurf.png welcome.html default.css WIN_RES_INS_OBJ := $(addprefix windows/res/,$(WIN_RES_OBJ)) $(OBJROOT)/messages $(OBJROOT)/messages: resources/FatMessages - $(PERL) utils/split-messages.pl en all < resources/FatMessages > $@ + $(Q)$(SPLIT_MESSAGES) -l en -p win -f messages resources/FatMessages > $@ netsurf-installer.exe: $(EXETARGET) $(WIN_RES_INS_OBJ) makensis -V4 -NOCD windows/res/installer.nsi diff --git a/windows/font.c b/windows/font.c index 564a7dec0..c99cec7cf 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 313da5423..f8d57fd33 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -36,9 +36,8 @@ #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/selection.h" #include "desktop/textinput.h" #include "render/html.h" #include "utils/log.h" @@ -932,7 +931,7 @@ nsws_window_command(HWND hwnd, nsoption_set_int(window_y, r.top); nsoption_set_int(window_width, r.right - r.left); nsoption_set_int(window_height, r.bottom - r.top); - nsoption_write(options_file_location); + nsoption_write(options_file_location, NULL, NULL); break; } @@ -1766,7 +1765,8 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c, { } -void gui_drag_save_selection(struct selection *s, struct gui_window *w) + +void gui_drag_save_selection(struct gui_window *g, const char *selection) { } diff --git a/windows/main.c b/windows/main.c index 19f71dd33..69a152d9b 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" @@ -66,9 +66,9 @@ void gui_quit(void) } /** - * Ensures output stdio stream is available + * Ensures output logging stream is available */ -bool nslog_ensure(FILE *fptr) +static bool nslog_ensure(FILE *fptr) { /* mwindows compile flag normally invalidates standard io unless * already redirected @@ -80,13 +80,20 @@ bool nslog_ensure(FILE *fptr) return true; } -/* Documented in desktop/options.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 */ /* ensure homepage option has a default */ nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE)); + + return NSERROR_OK; } /** @@ -132,14 +139,31 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH); - messages = filepath_find(respaths, "messages"); options_file_location = filepath_find(respaths, "preferences"); - /* initialise netsurf */ - netsurf_init(&argc, &argv, options_file_location, messages); + /* initialise logging - not fatal if it fails but not much we + * can do about it + */ + nslog_init(nslog_ensure, &argc, argv); + + /* user options setup */ + ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + die("Options failed to initialise"); + } + nsoption_read(options_file_location, NULL); + nsoption_commandline(&argc, argv, NULL); + /* common initialisation */ + messages = filepath_find(respaths, "messages"); + ret = netsurf_init(messages); free(messages); + if (ret != NSERROR_OK) { + free(options_file_location); + LOG(("NetSurf failed to initialise")); + return 1; + } ret = nsws_create_main_class(hInstance); ret = nsws_create_drawable_class(hInstance); diff --git a/windows/prefs.c b/windows/prefs.c index 577c2a509..e933cc10d 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" @@ -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, @@ -675,7 +675,6 @@ void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent) win_perror("PropertySheet"); } else if (ret > 0) { /* user saved changes */ - nsoption_write(options_file_location); + nsoption_write(options_file_location, NULL, NULL); } - } diff --git a/windows/system_colour.c b/windows/system_colour.c deleted file mode 100644 index 6c1fd81b5..000000000 --- a/windows/system_colour.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@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 "desktop/options.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; -} |