Merge branch 'master' into mono/removing-windom-dependency

This commit is contained in:
Ole Loots 2012-12-18 01:28:22 +01:00
commit 3019368c93
64 changed files with 2451 additions and 837 deletions

View File

@ -70,8 +70,6 @@ else
ifeq ($(TARGET),)
TARGET := beos
endif
# BeOS still uses gcc2
GCCVER := 2
else
ifeq ($(HOST),AmigaOS)
HOST := amiga
@ -153,6 +151,7 @@ ifeq ($(TARGET),riscos)
SQUEEZE := squeeze
RUNEXT :=
CC := gcc
CXX := g++
EXEEXT :=
PKG_CONFIG :=
else
@ -188,6 +187,7 @@ ifeq ($(TARGET),riscos)
SUBTARGET := -aof
EXEEXT := ,ff8
endif
CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
endif
else
@ -258,8 +258,21 @@ else
endif
endif
else
# Building for GTK, Framebuffer
PKG_CONFIG := pkg-config
ifeq ($(TARGET),monkey)
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 other targets (GTK, Framebuffer)
PKG_CONFIG := pkg-config
endif
endif
endif
endif
@ -267,6 +280,13 @@ else
endif
endif
# compiler versioning to adjust warning flags
CC_VERSION := $(shell $(CC) -dumpversion)
CC_MAJOR := $(word 1,$(subst ., ,$(CC_VERSION)))
CC_MINOR := $(word 2,$(subst ., ,$(CC_VERSION)))
define cc_ver_ge
$(shell expr $(CC_MAJOR) \>= $(1) \& $(CC_MINOR) \>= $(2))
endef
# CCACHE
ifeq ($(origin CCACHE),undefined)
@ -301,10 +321,37 @@ define feature_enabled
endif
endef
# Extend flags with appropriate values from pkg-config for enabled features
#
# 1: pkg-config required modules for feature
# 2: Human-readable name for the feature
define pkg_config_find_and_add
ifeq ($$(PKG_CONFIG),)
$$(error pkg-config is required to auto-detect feature availability)
endif
PKG_CONFIG_$(1)_EXISTS := $$(shell $$(PKG_CONFIG) --exists $(1) && echo yes)
ifeq ($$(PKG_CONFIG_$(1)_EXISTS),yes)
CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(1))
ifneq ($(MAKECMDGOALS),clean)
$$(info PKG.CNFG: $(2) ($(1)) enabled)
endif
else
ifneq ($(MAKECMDGOALS),clean)
$$(info PKG.CNFG: $(2) ($(1)) failed)
$$(error Unable to find library for: $(2) ($(1)))
endif
endif
endef
# Extend flags with appropriate values from pkg-config for enabled features
#
# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
# 2: pkg-config required modules for feature
# 3: Human-readable name for the feature
define pkg_config_find_and_add
define pkg_config_find_and_add_enabled
ifeq ($$(PKG_CONFIG),)
$$(error pkg-config is required to auto-detect feature availability)
endif
@ -358,10 +405,14 @@ endef
WARNFLAGS = -W -Wall -Wundef -Wpointer-arith \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
-Wnested-externs
ifneq ($(GCCVER),2)
-Wnested-externs -Wuninitialized
ifneq ($(CC_MAJOR),2)
WARNFLAGS += -Wno-unused-parameter
endif
# deal with lots of unwanted warnings from javascript
ifeq ($(call cc_ver_ge,4,6),1)
WARNFLAGS += -Wno-unused-but-set-variable
endif
# Pull in the configuration
include Makefile.defaults
@ -432,7 +483,7 @@ $(EXETARGET): $(OBJECTS) $(RESOURCES)
ifneq ($(TARGET)$(SUBTARGET),riscos-elf)
$(Q)$(CC) -o $(EXETARGET) $(OBJECTS) $(LDFLAGS)
else
$(Q)$(CC) -o $(EXETARGET:,ff8=,e1f) $(OBJECTS) $(LDFLAGS)
$(Q)$(CXX) -o $(EXETARGET:,ff8=,e1f) $(OBJECTS) $(LDFLAGS)
$(Q)$(ELF2AIF) $(EXETARGET:,ff8=,e1f) $(EXETARGET)
$(Q)$(RM) $(EXETARGET:,ff8=,e1f)
endif
@ -552,7 +603,7 @@ endef
# 1 = Source file
# 2 = obj filename, no prefix
# 3 = dep filename, no prefix
ifeq ($(GCCVER),2)
ifeq ($(CC_MAJOR),2)
# simpler deps tracking for gcc2...
define compile_target_c
$$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created

View File

@ -98,344 +98,8 @@ CFLAGS :=
# Default installation/execution prefix
PREFIX ?= /usr/local
# ----------------------------------------------------------------------------
# RISC OS-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),riscos)
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO
NETSURF_USE_NSSVG := YES
# Enable NetSurf's support for displaying RISC OS Draw files
# Valid options: YES, NO
NETSURF_USE_DRAW := YES
# Enable NetSurf's support for displaying RISC OS Sprites
# Valid options: YES, NO
NETSURF_USE_SPRITE := YES
# Enable NetSurf's use of AWRender for displaying ArtWorks files
# Valid options: YES, NO
NETSURF_USE_ARTWORKS := YES
# Enable NetSurf's support for the Acorn plugin protocol
# Valid options: YES, NO
NETSURF_USE_PLUGINS := NO
# Enable NetSurf's use of pencil for Drawfile export
# Valid options: YES, NO
NETSURF_USE_DRAW_EXPORT := YES
# Optimisation levels
CFLAGS += -O2 -Wuninitialized
endif
# ----------------------------------------------------------------------------
# GTK-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),gtk)
# Where to search for NetSurf's resources after looking in ~/.netsurf and
# $NETSURFRES. It must have a trailing /
NETSURF_GTK_RESOURCES := $(PREFIX)/share/netsurf/
# Where to install the netsurf binary
NETSURF_GTK_BIN := $(PREFIX)/bin/
# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG := AUTO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := AUTO
# Configuration overrides for Mac OS X
ifeq ($(HOST),macosx)
NETSURF_USE_LIBICONV_PLUG := NO
NETSURF_USE_HARU_PDF := NO
endif
# Set default GTK version to build for (2 or 3)
NETSURF_GTK_MAJOR := 2
# Optimisation levels
CFLAGS += -O2 -Wuninitialized
endif
# ----------------------------------------------------------------------------
# Monkey-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),monkey)
# How did I get mixed up with this fucking monkey anyhow?
NETSURF_MONKEY_RESOURCES := $(PREFIX)/share/netsurf/
NETSURF_MONKEY_BIN := $(PREFIX)/bin/
NETSURF_USE_RSVG := NO
NETSURF_USE_NSSVG := NO
NETSURF_USE_ROSPRITE := NO
NETSURF_USE_HARU_PDF := NO
NETSURF_USE_LIBICONV_PLUG := NO
CFLAGS += -O2 -Wuninitialized
endif
# ----------------------------------------------------------------------------
# BeOS-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),beos)
# Where to install the netsurf binary
NETSURF_BEOS_BIN := /boot/apps/netsurf/
# TODO:HAIKU -- not sure if ~/.netsurf applies in beos
# Where to search for NetSurf's resources after looking in ~/.netsurf and
# $NETSURFRES. It must have a trailing /
NETSURF_BEOS_RESOURCES := /boot/apps/netsurf/res/
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := YES
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := AUTO
# Enable NetSurf's use of libharu for PDF export.
# Valid options: YES, NO
NETSURF_USE_HARU_PDF := NO
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# Optimisation levels
CFLAGS += -O2 -Wuninitialized
endif
# ----------------------------------------------------------------------------
# Amiga-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),amiga)
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := YES
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libmng for displaying MNGs, JNGs and PNGs
# Valid options: YES, NO (at least one of PNG/MNG/DT highly recommended)
NETSURF_USE_MNG := NO
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
# Enable NetSurf to display Amiga icons
# Valid options: YES, NO (recommended)
NETSURF_USE_AMIGA_ICON := YES
# Enable NetSurf's use of DataTypes for unknown filetypes
# Valid options: YES, NO
NETSURF_USE_AMIGA_DATATYPES := YES
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO
NETSURF_USE_NSSVG := YES
# Enable NetSurf's use of libcairo for some plotter functions
# This will also link NetSurf with shared objects, and
# requires AmigaOS 4.1 or higher to run the resulting executable
# Valid options: YES, NO, AUTO
NETSURF_USE_AMIGA_CAIRO := AUTO
# Optimisation levels
CFLAGS += -O2 -Wuninitialized -gstabs
endif
# ----------------------------------------------------------------------------
# Framebuffer-target-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),framebuffer)
# Optimisation levels
CFLAGS += -O2 -Wuninitialized
# Framebuffer default surface provider.
# Valid values are: x, sdl, linux, vnc, able,
NETSURF_FB_FRONTEND := sdl
# Use libharu to enable PDF export and GTK printing support.
# Valid options: YES, NO
NETSURF_USE_HARU_PDF := NO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := AUTO
# Library to use for font plotting
# Valid options: internal, freetype
NETSURF_FB_FONTLIB := internal
# Default freetype font files
NETSURF_FB_FONT_SANS_SERIF := DejaVuSans.ttf
NETSURF_FB_FONT_SANS_SERIF_BOLD := DejaVuSans-Bold.ttf
NETSURF_FB_FONT_SANS_SERIF_ITALIC := DejaVuSans-Oblique.ttf
NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD := DejaVuSans-BoldOblique.ttf
NETSURF_FB_FONT_SERIF := DejaVuSerif.ttf
NETSURF_FB_FONT_SERIF_BOLD := DejaVuSerif-Bold.ttf
NETSURF_FB_FONT_MONOSPACE := DejaVuSansMono.ttf
NETSURF_FB_FONT_MONOSPACE_BOLD := DejaVuSansMono-Bold.ttf
NETSURF_FB_FONT_CURSIVE := Comic_Sans_MS.ttf
NETSURF_FB_FONT_FANTASY := Impact.ttf
# Default binary install path
NETSURF_FRAMEBUFFER_BIN := $(PREFIX)/bin/
# Default resource install path
NETSURF_FRAMEBUFFER_RESOURCES := $(PREFIX)/share/netsurf/
# Default framebuffer search path
NETSURF_FB_RESPATH := $${HOME}/.netsurf/:$${NETSURFRES}:$(NETSURF_FRAMEBUFFER_RESOURCES):./framebuffer/res
# freetype compiled in font serch path
NETSURF_FB_FONTPATH := /usr/share/fonts/truetype/ttf-dejavu:/usr/share/fonts/truetype/msttcorefonts
endif
# ----------------------------------------------------------------------------
# windows-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),windows)
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO
NETSURF_USE_NSSVG := NO
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# mng support does not currently build on windows
NETSURF_USE_MNG := NO
# no pdf support
NETSURF_USE_HARU_PDF := NO
# Optimisation levels
CFLAGS += -O2 -Wuninitialized
endif
# ----------------------------------------------------------------------------
# Atari-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),atari)
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG := AUTO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
NETSURF_USE_MNG := NO
# enable true type fonts via freetype2
# Valid options: YES, NO
NETSURF_USE_ATARI_FREETYPE_FONT := YES
# Enable use of netsurf embedded font
# Valid options: YES, NO
NETSURF_USE_ATARI_NETSURF_FONT := YES
# Configure support for screen drivers with no true colour mode
# Valid options: YES, NO
NETSURF_USE_ATARI_8BPP_SUPPORT := NO
# Configure the CPU target
# Valid options: 68000, 68020-60, 5475 (coldfire)
ATARI_ARCH = 68020-60
# enable optimizations
# -O2 is currently broken with m68000 / m68020-60 builds
CFLAGS += -O1 -Wuninitialized
WARNFLAGS = -W -Wundef -Wpointer-arith \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
-Wnested-externs -Wl,-t
endif
# ----------------------------------------------------------------------------
# Cocoa-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),cocoa)
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG := AUTO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
NETSURF_USE_MNG := NO
NETSURF_USE_BMP := NO
NETSURF_USE_GIF := NO
NETSURF_USE_PNG := NO
NETSURF_USE_JPEG := NO
NETSURF_USE_IMAGEIO := YES
DEVELOPER_PATH := /Developer
MACOSX_VERSION := 10.5
SDK_VERSION := $(MACOSX_VERSION)
# Optimisation levels
CFLAGS += -O2 -Wuninitialized
endif
# Incude defaults specific to a TARGET
-include $(TARGET)/Makefile.defaults
# Include any local configuration
ifneq ($(MAKEFILE_DEFAULTS_FINISHED),)

View File

@ -54,7 +54,6 @@ S_JAVASCRIPT += content.c jsapi.c $(addprefix jsapi/,$(S_JSAPI))
$(eval $(foreach V,$(filter JSAPI_BINDING_%,$(.VARIABLES)),$(call convert_jsapi_binding,$($(V)),$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).c,$(patsubst JSAPI_BINDING_%,%,$(V))_jsapi)))
else
S_JAVASCRIPT += none.c
endif

40
amiga/Makefile.defaults Normal file
View File

@ -0,0 +1,40 @@
# ----------------------------------------------------------------------------
# Amiga-specific options
# ----------------------------------------------------------------------------
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := YES
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libmng for displaying MNGs, JNGs and PNGs
# Valid options: YES, NO (at least one of PNG/MNG/DT highly recommended)
NETSURF_USE_MNG := NO
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
# Enable NetSurf to display Amiga icons
# Valid options: YES, NO (recommended)
NETSURF_USE_AMIGA_ICON := YES
# Enable NetSurf's use of DataTypes for unknown filetypes
# Valid options: YES, NO
NETSURF_USE_AMIGA_DATATYPES := YES
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO
NETSURF_USE_NSSVG := YES
# Enable NetSurf's use of libcairo for some plotter functions
# This will also link NetSurf with shared objects, and
# requires AmigaOS 4.1 or higher to run the resulting executable
# Valid options: YES, NO, AUTO
NETSURF_USE_AMIGA_CAIRO := AUTO
# Optimisation levels
CFLAGS += -O2 -gstabs

View File

@ -41,12 +41,12 @@ ifeq ($(HOST),amiga)
LDFLAGS += -use-dynld -ldl -lcairo -lpixman-1 -lfreetype -lfontconfig -lpng -lexpat
endif
else
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,NSSVG))
$(eval $(call pkg_config_find_and_add,AMIGA_CAIRO,cairo,Cairo))
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,NSSVG))
$(eval $(call pkg_config_find_and_add_enabled,AMIGA_CAIRO,cairo,Cairo))
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))

4
amiga/dist/Install vendored
View File

@ -474,6 +474,10 @@
(rename (tackon @default-dest "Resources/SearchEngines") (tackon @default-dest "Resources/SearchEngines.backup"))
)
(run "c:filenote Rexx/CloseTabs.nsrx \"Close other tabs\"")
(run "c:filenote Rexx/ViewSource.nsrx \"View source\"")
(run "c:filenote Rexx/GetVideo.nsrx \"Get video\"")
(copyfiles
(prompt "Copying files")
(source "")

View File

@ -48,6 +48,7 @@ There are a couple of Amiga-specific options which can only be changed directly
@{b}redraw_tile_size_x@{ub}/@{b}redraw_tile_size_y@{ub} Specify the size of the off-screen bitmap. Higher will speed up redraws at the expense of memory. 0 disables tiling (will use a bitmap at least the size of the screen NetSurf is running on)
@{b}font_antialiasing@{ub} Switch text anti-aliasing on or off. Defaults to on in true-colour modes, but text rendering performance can be improved by setting to 0.
@{b}window_simple_refresh@{ub} If set to 1, NetSurf will use SimpleRefresh rather than SmartRefresh windows. These have slower redraw but use less memory. Note that this setting has no noticeable effect if compositing is enabled. Defaults to 0 (SmartRefresh)
@{b}web_search_width@{ub} Defaults to 0. Larger values will increase the size of the web search gadget next to the URL bar.
@{b}dithering_quality@{ub} Specify the dithering quality from all values supported by picture.datatype. Currently these are 0=None, 1=Normal, 2=High quality. Other values are undefined. This is only used when NetSurf is running in palette-mapped mode.
@{b}mask_alpha@{ub} Threshold to use when determining which alpha values to convert to full transparency (0 - 255, where 255 will convert even opaque pixels to transparent). Defaults to 50 (0x32). This is only used in palette-mapped modes where alpha blending is not currently supported.
@ -182,9 +183,8 @@ links clicked within NetSurf.
Items from the hotlist can be added to the Hotlist menu as follows:
Select Hotlist => Show hotlist...
Add a folder called Menu. This must not be placed within any other folder.
Items in this folder node up to a maximum (currently) of 40 items will be added to the Hotlist menu, within the limits of the Intuition menu system.
Items in the "Hotlist menu" folder node, up to a maximum (currently) of 40 items, will be added to the Hotlist menu, within the limits of the Intuition menu system.
Items in folders within the Menu folder node will be converted to subitems in the menu.

View File

@ -37,9 +37,10 @@
#include "desktop/options.h"
#include "amiga/bitmap.h"
#include "amiga/iff_dr2d.h"
#include "amiga/file.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
#include "amiga/file.h"
#include "desktop/download.h"
#include "desktop/selection.h"
@ -389,7 +390,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size)
{
/* Return TRUE if file can be (over-)written */
int res = 0;
int32 res = 0;
BPTR lock = 0;
BPTR fh = 0;
int64 oldsize = 0;
@ -415,27 +416,11 @@ BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG si
overwritetext = ASPrintf(messages_get("OverwriteFile"));
}
char *utf8text = ami_utf8_easy(overwritetext);
res = ami_warn_user_multi(overwritetext, "Replace", "DontReplace", win);
FreeVec(overwritetext);
char *utf8gadget1 = ami_utf8_easy(messages_get("DontReplace"));
char *utf8gadget2 = ami_utf8_easy(messages_get("Replace"));
char *utf8gadgets = ASPrintf("%s|%s", utf8gadget1, utf8gadget2);
free(utf8gadget1);
free(utf8gadget2);
res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_WARNING,
TDR_TitleString, messages_get("NetSurf"),
TDR_FormatString, utf8text,
TDR_GadgetString, utf8gadgets,
TDR_Window, win,
TAG_DONE);
if(utf8text) free(utf8text);
if(utf8gadgets) FreeVec(utf8gadgets);
}
else return TRUE;
if(res == 0) return TRUE;
if(res == 1) return TRUE;
else return FALSE;
}

View File

@ -177,6 +177,7 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys);
ULONG ami_set_border_gadget_balance(struct gui_window_2 *gwin);
ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2);
void ami_try_quit(void);
void ami_quit_netsurf_delayed(void);
Object *ami_gui_splash_open(void);
void ami_gui_splash_close(Object *win_obj);
static uint32 ami_set_search_ico_render_hook(struct Hook *hook, APTR space,
@ -1190,6 +1191,27 @@ void ami_gui_trap_mouse(struct gui_window_2 *gwin)
}
}
void ami_gui_menu_update_all(void)
{
struct nsObject *node;
struct nsObject *nnode;
struct gui_window_2 *gwin;
if(IsMinListEmpty(window_list)) return;
node = (struct nsObject *)GetHead((struct List *)window_list);
do {
nnode=(struct nsObject *)GetSucc((struct Node *)node);
gwin = node->objstruct;
if(node->Type == AMINS_WINDOW)
{
ami_menu_update_checked(gwin);
}
} while(node = nnode);
}
void ami_handle_msg(void)
{
struct IntuiMessage *message = NULL;
@ -1206,6 +1228,7 @@ void ami_handle_msg(void)
struct browser_window *closedbw;
struct timeval curtime;
static int drag_x_move = 0, drag_y_move = 0;
char *url;
if(IsMinListEmpty(window_list))
{
@ -1633,6 +1656,7 @@ void ami_handle_msg(void)
ami_gui_history(gwin, false);
break;
case GID_HOTLIST:
default:
// printf("GADGET: %ld\n",(result & WMHI_GADGETMASK));
break;
@ -1640,8 +1664,9 @@ void ami_handle_msg(void)
break;
case WMHI_RAWKEY:
ami_update_quals(gwin);
storage = result & WMHI_GADGETMASK;
if(storage >= IECODE_UP_PREFIX) break;
GetAttr(WINDOW_InputEvent,gwin->objects[OID_MAIN],(ULONG *)&ie);
@ -1940,6 +1965,11 @@ void ami_handle_msg(void)
ami_menu_window_close = NULL;
}
if(ami_menu_check_toggled) {
ami_gui_menu_update_all();
ami_menu_check_toggled = false;
}
}
void ami_gui_appicon_remove(struct gui_window_2 *gwin)
@ -2106,11 +2136,12 @@ void ami_get_msg(void)
ULONG winsignal = 1L << sport->mp_SigBit;
ULONG appsig = 1L << appport->mp_SigBit;
ULONG schedulesig = 1L << msgport->mp_SigBit;
ULONG ctrlcsig = SIGBREAKF_CTRL_C;
ULONG signal;
struct TimerRequest *timermsg = NULL;
struct MsgPort *printmsgport = ami_print_get_msgport();
ULONG printsig = 1L << printmsgport->mp_SigBit;
ULONG signalmask = winsignal | appsig | schedulesig | rxsig | printsig | applibsig;
ULONG signalmask = winsignal | appsig | schedulesig | rxsig | printsig | applibsig | ctrlcsig;
signal = Wait(signalmask);
/*
@ -2142,6 +2173,11 @@ printf("sig recvd %ld (%ld %ld %ld %ld %ld %ld)\n", signal, winsignal , appsig ,
schedule_run(FALSE);
}
}
if(signal & ctrlcsig)
{
ami_quit_netsurf_delayed();
}
}
void gui_poll(bool active)
@ -2300,6 +2336,32 @@ void ami_quit_netsurf(void)
}
}
void ami_quit_netsurf_delayed(void)
{
int res = -1;
#ifdef __amigaos4__
char *utf8text = ami_utf8_easy(messages_get("TCPIPShutdown"));
char *utf8gadgets = ami_utf8_easy(messages_get("AbortShutdown"));
DisplayBeep(NULL);
res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_INFO,
TDR_TitleString, messages_get("NetSurf"),
TDR_FormatString, utf8text,
TDR_GadgetString, utf8gadgets,
TDR_Timeout, 5,
TDR_Inactive, TRUE,
TAG_DONE);
free(utf8text);
free(utf8gadgets);
#endif
if(res == -1) { /* Requester timed out */
nsoption_set_bool(tab_close_warn, false);
ami_quit_netsurf();
}
}
void ami_gui_close_screen(struct Screen *scrn)
{
if(scrn == NULL) return;
@ -2428,7 +2490,7 @@ void ami_update_buttons(struct gui_window_2 *gwin)
}
}
void ami_gui_hotlist_scan_2(struct tree *tree, struct node *root, WORD *gen, uint16 *item,
void ami_gui_hotlist_scan_2(struct tree *tree, struct node *root, WORD *gen, int *item,
struct List *speed_button_list, struct gui_window_2 *gwin)
{
struct node *tempnode;
@ -2470,14 +2532,14 @@ int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, stru
struct node *root = tree_node_get_child(tree_get_root(tree));
struct node *node;
struct node_element *element;
static WORD gen = 0;
static uint16 item = 0;
WORD gen = 0;
int item = 0;
for (node = root; node; node = tree_node_get_next(node))
{
element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL);
if(!element) element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL);
if(element && (strcmp(tree_node_element_get_text(element), "Toolbar") == 0))
if(element && (strcmp(tree_node_element_get_text(element), messages_get("HotlistToolbar")) == 0))
{
ami_gui_hotlist_scan_2(tree, tree_node_get_child(node), &gen, &item, speed_button_list, gwin);
}
@ -2488,6 +2550,13 @@ int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, stru
void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
{
struct TagItem attrs[2];
attrs[0].ti_Tag = CHILD_MinWidth;
attrs[0].ti_Data = 0;
attrs[1].ti_Tag = TAG_DONE;
attrs[1].ti_Data = 0;
NewList(&gwin->hotlist_toolbar_list);
if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) {
@ -2495,17 +2564,118 @@ void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
SpeedBarObject,
GA_ID, GID_HOTLIST,
GA_RelVerify, TRUE,
ICA_TARGET, ICTARGET_IDCMP,
SPEEDBAR_BevelStyle, BVS_NONE,
SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list,
SpeedBarEnd;
gwin->objects[GID_HOTLISTSEPBAR] =
BevelObject,
BEVEL_Style, BVS_SBAR_VERT,
BevelEnd;
IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDCHILD,
gwin->win, gwin->objects[GID_HOTLIST], NULL);
gwin->win, gwin->objects[GID_HOTLIST], attrs);
IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDIMAGE,
gwin->win, gwin->objects[GID_HOTLISTSEPBAR], NULL);
FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
gwin->win, NULL, TRUE);
if(gwin->bw) {
gwin->redraw_required = true;
gwin->bw->reformat_pending = true;
}
}
}
void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List *speed_button_list)
{
int i;
struct Node *node;
struct Node *nnode;
if(IsListEmpty(speed_button_list)) return;
node = GetHead(speed_button_list);
do {
nnode = GetSucc(node);
Remove(node);
FreeSpeedButtonNode(node);
} while(node = nnode);
for(i = 0; i < AMI_GUI_TOOLBAR_MAX; i++) {
if(gwin->hotlist_toolbar_lab[i]) {
free(gwin->hotlist_toolbar_lab[i]);
gwin->hotlist_toolbar_lab[i] = NULL;
}
}
}
void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin)
{
IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD,
gwin->win, gwin->objects[GID_HOTLIST]);
IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD,
gwin->win, gwin->objects[GID_HOTLISTSEPBAR]);
FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
gwin->win, NULL, TRUE);
gwin->redraw_required = true;
gwin->bw->reformat_pending = true;
}
void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin)
{
if(IsListEmpty(&gwin->hotlist_toolbar_list)) {
ami_gui_hotlist_toolbar_add(gwin);
return;
}
/* Below should be SetAttr according to Autodocs */
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_HOTLIST],
gwin->win, NULL,
SPEEDBAR_Buttons, ~0,
TAG_DONE);
ami_gui_hotlist_toolbar_free(gwin, &gwin->hotlist_toolbar_list);
if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) {
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_HOTLIST],
gwin->win, NULL,
SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list,
TAG_DONE);
} else {
ami_gui_hotlist_toolbar_remove(gwin);
}
}
void ami_gui_hotlist_toolbar_update_all(void)
{
struct nsObject *node;
struct nsObject *nnode;
struct gui_window_2 *gwin;
if(IsMinListEmpty(window_list)) return;
node = (struct nsObject *)GetHead((struct List *)window_list);
do {
nnode=(struct nsObject *)GetSucc((struct Node *)node);
gwin = node->objstruct;
if(node->Type == AMINS_WINDOW)
{
ami_gui_hotlist_toolbar_update(gwin);
}
} while(node = nnode);
}
void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
@ -2561,8 +2731,37 @@ void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
gwin->win, NULL, TRUE);
gwin->redraw_required = true;
gwin->bw->reformat_pending = true;
if(gwin->bw) {
gwin->redraw_required = true;
gwin->bw->reformat_pending = true;
}
}
void ami_gui_tabs_toggle_all(void)
{
struct nsObject *node;
struct nsObject *nnode;
struct gui_window_2 *gwin;
if(IsMinListEmpty(window_list)) return;
node = (struct nsObject *)GetHead((struct List *)window_list);
do {
nnode=(struct nsObject *)GetSucc((struct Node *)node);
gwin = node->objstruct;
if(node->Type == AMINS_WINDOW)
{
if(gwin->tabs == 1) {
if(nsoption_bool(tab_always_show) == true) {
ami_toggletabbar(gwin, true);
} else {
ami_toggletabbar(gwin, false);
}
}
}
} while(node = nnode);
}
struct gui_window *gui_create_browser_window(struct browser_window *bw,
@ -2613,7 +2812,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
g->shared = clone->window->shared;
g->tab = g->shared->next_tab;
if(g->shared->tabs == 1)
if((g->shared->tabs == 1) && (nsoption_bool(tab_always_show) == false))
ami_toggletabbar(g->shared, true);
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
@ -2961,7 +3160,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
GA_HintInfo, g->shared->helphints[GID_SEARCHSTRING],
StringEnd,
LayoutEnd,
CHILD_WeightedWidth, 0,
CHILD_WeightedWidth, nsoption_int(web_search_width),
LAYOUT_AddChild, g->shared->objects[GID_THROBBER] = SpaceObject,
GA_ID,GID_THROBBER,
SPACE_MinWidth,throbber_width,
@ -2977,7 +3176,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
BEVEL_Style, BVS_SBAR_VERT,
BevelEnd,
CHILD_WeightedHeight, 0,
LAYOUT_AddChild, g->shared->objects[GID_HOTLISTLAYOUT] = HGroupObject,
LAYOUT_AddChild, g->shared->objects[GID_HOTLISTLAYOUT] = VGroupObject,
LAYOUT_SpaceInner, FALSE,
LayoutEnd,
CHILD_WeightedHeight,0,
@ -3128,6 +3327,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
g->shared->win, NULL);
ami_gui_hotlist_toolbar_add(g->shared); /* is this the right place for this? */
if(nsoption_bool(tab_always_show)) ami_toggletabbar(g->shared, true);
}
else
{
@ -3207,7 +3407,15 @@ void ami_close_all_tabs(struct gui_window_2 *gwin)
{
struct Node *tab;
struct Node *ntab;
if((gwin->tabs > 1) && (nsoption_bool(tab_close_warn) == true)) {
char *req_body = ami_utf8_easy(messages_get("MultiTabClose"));
int32 res = ami_warn_user_multi(req_body, "Yes", "No", gwin->win);
free(req_body);
if(res == 0) return;
}
if(gwin->tabs)
{
tab = GetHead(&gwin->tab_list);
@ -3281,7 +3489,7 @@ void gui_window_destroy(struct gui_window *g)
g->shared->tabs--;
ami_switch_tab(g->shared,true);
if(g->shared->tabs == 1)
if((g->shared->tabs == 1) && (nsoption_bool(tab_always_show) == false))
ami_toggletabbar(g->shared, false);
ami_utf8_free(g->tabtitle);
@ -3296,6 +3504,8 @@ void gui_window_destroy(struct gui_window *g)
ami_gui_appicon_remove(g->shared);
if(g->shared->appwin) RemoveAppWindow(g->shared->appwin);
ami_gui_hotlist_toolbar_free(g->shared, &g->shared->hotlist_toolbar_list);
/* These aren't freed by the above.
* TODO: nav_west etc need freeing too? */
DisposeObject(g->shared->objects[GID_ADDTAB_BM]);
@ -4173,6 +4383,8 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
struct gui_window_2 *gwin = hook->h_Data;
struct IntuiWheelData *wheel;
Object *reqrefresh = NULL;
struct Node *node = NULL;
char *url;
switch(msg->Class)
{
@ -4189,6 +4401,18 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
gwin->redraw_required = true;
break;
case GID_HOTLIST:
if(node = (struct Node *)GetTagData(SPEEDBAR_SelectedNode, 0, msg->IAddress)) {
GetSpeedButtonNodeAttrs(node, SBNA_UserData, (ULONG *)&url, TAG_DONE);
if(gwin->key_state & BROWSER_MOUSE_MOD_2) {
browser_window_create(url, gwin->bw, NULL, false, true);
} else {
browser_window_go(gwin->bw, url, NULL, true);
}
}
break;
}
break;

View File

@ -66,6 +66,7 @@ enum
GID_TOOLBARLAYOUT,
GID_HOTLIST,
GID_HOTLISTLAYOUT,
GID_HOTLISTSEPBAR,
GID_HSCROLL,
GID_LAST
};
@ -152,6 +153,8 @@ int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
BOOL ami_gadget_hit(Object *obj, int x, int y);
void ami_gui_history(struct gui_window_2 *gwin, bool back);
void ami_gui_hotlist_toolbar_update_all(void);
void ami_gui_tabs_toggle_all(void);
struct TextFont *origrpfont;
struct MinList *window_list;

View File

@ -85,6 +85,7 @@ enum
GID_OPTS_SCREEN,
GID_OPTS_SCREENMODE,
GID_OPTS_SCREENNAME,
GID_OPTS_WIN_SIMPLE,
GID_OPTS_THEME,
GID_OPTS_PTRTRUE,
GID_OPTS_PTROS,
@ -98,6 +99,7 @@ enum
GID_OPTS_FETCHCACHE,
GID_OPTS_NATIVEBM,
GID_OPTS_SCALEQ,
GID_OPTS_DITHERQ,
GID_OPTS_ANIMSPEED,
GID_OPTS_ANIMDISABLE,
GID_OPTS_DPI_Y,
@ -109,6 +111,7 @@ enum
GID_OPTS_FONT_DEFAULT,
GID_OPTS_FONT_SIZE,
GID_OPTS_FONT_MINSIZE,
GID_OPTS_FONT_ANTIALIASING,
GID_OPTS_CACHE_MEM,
GID_OPTS_CACHE_DISC,
GID_OPTS_OVERWRITE,
@ -117,6 +120,8 @@ enum
GID_OPTS_TAB_ACTIVE,
GID_OPTS_TAB_2,
GID_OPTS_TAB_LAST,
GID_OPTS_TAB_ALWAYS,
GID_OPTS_TAB_CLOSE,
GID_OPTS_SEARCH_PROV,
GID_OPTS_CLIPBOARD,
GID_OPTS_CONTEXTMENU,
@ -149,6 +154,7 @@ enum
GRP_OPTS_PRIVACY,
GRP_OPTS_MISC,
GRP_OPTS_SCREEN,
GRP_OPTS_WINDOW,
GRP_OPTS_THEME,
GRP_OPTS_MOUSE,
GRP_OPTS_PROXY,
@ -186,10 +192,11 @@ enum
};
#define OPTS_LAST LAB_OPTS_LAST
#define OPTS_MAX_TABS 9
#define OPTS_MAX_TABS 10
#define OPTS_MAX_SCREEN 4
#define OPTS_MAX_PROXY 5
#define OPTS_MAX_NATIVEBM 3
#define OPTS_MAX_DITHER 4
struct ami_gui_opts_window {
struct nsObject *node;
@ -203,6 +210,7 @@ CONST_STRPTR tabs[OPTS_MAX_TABS];
static STRPTR screenopts[OPTS_MAX_SCREEN];
CONST_STRPTR proxyopts[OPTS_MAX_PROXY];
CONST_STRPTR nativebmopts[OPTS_MAX_NATIVEBM];
CONST_STRPTR ditheropts[OPTS_MAX_DITHER];
CONST_STRPTR fontopts[6];
CONST_STRPTR gadlab[OPTS_LAST];
STRPTR *websearch_list;
@ -218,12 +226,13 @@ void ami_gui_opts_setup(void)
tabs[3] = (char *)ami_utf8_easy((char *)messages_get("con_rendering"));
tabs[4] = (char *)ami_utf8_easy((char *)messages_get("con_fonts"));
tabs[5] = (char *)ami_utf8_easy((char *)messages_get("con_cache"));
tabs[6] = (char *)ami_utf8_easy((char *)messages_get("con_advanced"));
tabs[6] = (char *)ami_utf8_easy((char *)messages_get("Tabs"));
tabs[7] = (char *)ami_utf8_easy((char *)messages_get("con_advanced"));
#ifdef WITH_PDF_EXPORT
tabs[7] = (char *)ami_utf8_easy((char *)messages_get("Export"));
tabs[8] = NULL;
tabs[8] = (char *)ami_utf8_easy((char *)messages_get("Export"));
tabs[9] = NULL;
#else
tabs[7] = NULL;
tabs[8] = NULL;
#endif
screenopts[0] = (char *)ami_utf8_easy((char *)messages_get("ScreenOwn"));
@ -242,6 +251,11 @@ void ami_gui_opts_setup(void)
nativebmopts[2] = (char *)ami_utf8_easy((char *)messages_get("All"));
nativebmopts[3] = NULL;
ditheropts[0] = (char *)ami_utf8_easy((char *)messages_get("Low"));
ditheropts[1] = (char *)ami_utf8_easy((char *)messages_get("Medium"));
ditheropts[2] = (char *)ami_utf8_easy((char *)messages_get("High"));
ditheropts[3] = NULL;
websearch_list = ami_gui_opts_websearch();
gadlab[GID_OPTS_HOMEPAGE] = (char *)ami_utf8_easy((char *)messages_get("HomePageURL"));
@ -255,6 +269,7 @@ void ami_gui_opts_setup(void)
gadlab[GID_OPTS_REFERRAL] = (char *)ami_utf8_easy((char *)messages_get("SendReferer"));
gadlab[GID_OPTS_DONOTTRACK] = (char *)ami_utf8_easy((char *)messages_get("DoNotTrack"));
gadlab[GID_OPTS_FASTSCROLL] = (char *)ami_utf8_easy((char *)messages_get("FastScrolling"));
gadlab[GID_OPTS_WIN_SIMPLE] = (char *)ami_utf8_easy((char *)messages_get("SimpleRefresh"));
gadlab[GID_OPTS_PTRTRUE] = (char *)ami_utf8_easy((char *)messages_get("TrueColour"));
gadlab[GID_OPTS_PTROS] = (char *)ami_utf8_easy((char *)messages_get("OSPointers"));
gadlab[GID_OPTS_PROXY] = (char *)ami_utf8_easy((char *)messages_get("ProxyType"));
@ -266,6 +281,7 @@ void ami_gui_opts_setup(void)
gadlab[GID_OPTS_FETCHCACHE] = (char *)ami_utf8_easy((char *)messages_get("FetchesCached"));
gadlab[GID_OPTS_NATIVEBM] = (char *)ami_utf8_easy((char *)messages_get("CacheNative"));
gadlab[GID_OPTS_SCALEQ] = (char *)ami_utf8_easy((char *)messages_get("ScaleQuality"));
gadlab[GID_OPTS_DITHERQ] = (char *)ami_utf8_easy((char *)messages_get("DitherQuality"));
gadlab[GID_OPTS_ANIMSPEED] = (char *)ami_utf8_easy((char *)messages_get("AnimSpeedLimit"));
gadlab[GID_OPTS_DPI_Y] = (char *)ami_utf8_easy((char *)messages_get("ResolutionY"));
gadlab[GID_OPTS_ANIMDISABLE] = (char *)ami_utf8_easy((char *)messages_get("AnimDisable"));
@ -277,6 +293,7 @@ void ami_gui_opts_setup(void)
gadlab[GID_OPTS_FONT_DEFAULT] = (char *)ami_utf8_easy((char *)messages_get("Default"));
gadlab[GID_OPTS_FONT_SIZE] = (char *)ami_utf8_easy((char *)messages_get("Default"));
gadlab[GID_OPTS_FONT_MINSIZE] = (char *)ami_utf8_easy((char *)messages_get("Minimum"));
gadlab[GID_OPTS_FONT_ANTIALIASING] = (char *)ami_utf8_easy((char *)messages_get("FontAntialiasing"));
gadlab[GID_OPTS_CACHE_MEM] = (char *)ami_utf8_easy((char *)messages_get("Size"));
gadlab[GID_OPTS_CACHE_DISC] = (char *)ami_utf8_easy((char *)messages_get("Duration"));
gadlab[GID_OPTS_OVERWRITE] = (char *)ami_utf8_easy((char *)messages_get("ConfirmOverwrite"));
@ -285,6 +302,8 @@ void ami_gui_opts_setup(void)
gadlab[GID_OPTS_TAB_ACTIVE] = (char *)ami_utf8_easy((char *)messages_get("TabActive"));
gadlab[GID_OPTS_TAB_2] = (char *)ami_utf8_easy((char *)messages_get("TabMiddle"));
gadlab[GID_OPTS_TAB_LAST] = (char *)ami_utf8_easy((char *)messages_get("TabLast"));
gadlab[GID_OPTS_TAB_ALWAYS] = (char *)ami_utf8_easy((char *)messages_get("TabAlways"));
gadlab[GID_OPTS_TAB_CLOSE] = (char *)ami_utf8_easy((char *)messages_get("TabClose"));
gadlab[GID_OPTS_SEARCH_PROV] = (char *)ami_utf8_easy((char *)messages_get("SearchProvider"));
gadlab[GID_OPTS_CLIPBOARD] = (char *)ami_utf8_easy((char *)messages_get("ClipboardUTF8"));
gadlab[GID_OPTS_CONTEXTMENU] = (char *)ami_utf8_easy((char *)messages_get("ContextMenu"));
@ -321,6 +340,7 @@ void ami_gui_opts_setup(void)
gadlab[GRP_OPTS_SCRIPTING] = (char *)ami_utf8_easy((char *)messages_get("Scripting"));
gadlab[GRP_OPTS_MISC] = (char *)ami_utf8_easy((char *)messages_get("Miscellaneous"));
gadlab[GRP_OPTS_SCREEN] = (char *)ami_utf8_easy((char *)messages_get("Screen"));
gadlab[GRP_OPTS_WINDOW] = (char *)ami_utf8_easy((char *)messages_get("Window"));
gadlab[GRP_OPTS_THEME] = (char *)ami_utf8_easy((char *)messages_get("Theme"));
gadlab[GRP_OPTS_MOUSE] = (char *)ami_utf8_easy((char *)messages_get("MousePointers"));
gadlab[GRP_OPTS_PROXY] = (char *)ami_utf8_easy((char *)messages_get("Proxy"));
@ -679,6 +699,18 @@ void ami_gui_opts_open(void)
LayoutEnd,
LayoutEnd, // screen
CHILD_WeightedHeight,0,
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_WINDOW],
LAYOUT_AddChild, gow->objects[GID_OPTS_WIN_SIMPLE] = CheckBoxObject,
GA_ID, GID_OPTS_WIN_SIMPLE,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_WIN_SIMPLE],
GA_Selected, nsoption_bool(window_simple_refresh),
CheckBoxEnd,
LayoutEnd, // window
CHILD_WeightedHeight,0,
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
@ -848,6 +880,16 @@ void ami_gui_opts_open(void)
CHILD_Label, LabelObject,
LABEL_Text, gadlab[GID_OPTS_NATIVEBM],
LabelEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_DITHERQ] = ChooserObject,
GA_ID, GID_OPTS_DITHERQ,
GA_RelVerify, TRUE,
CHOOSER_PopUp, TRUE,
CHOOSER_LabelArray, ditheropts,
CHOOSER_Selected, nsoption_int(dither_quality),
ChooserEnd,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[GID_OPTS_DITHERQ],
LabelEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_SCALEQ] = CheckBoxObject,
GA_ID, GID_OPTS_SCALEQ,
GA_Disabled, scaledisabled,
@ -986,46 +1028,59 @@ void ami_gui_opts_open(void)
LabelEnd,
LayoutEnd, // font faces
CHILD_WeightedHeight, 0,
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_FONTSIZE],
LAYOUT_AddChild, HGroupObject,
LAYOUT_LabelColumn, PLACETEXT_RIGHT,
LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_SIZE] = IntegerObject,
GA_ID, GID_OPTS_FONT_SIZE,
GA_RelVerify, TRUE,
INTEGER_Number, nsoption_int(font_size) / 10,
INTEGER_Minimum, 1,
INTEGER_Maximum, 99,
INTEGER_Arrows, TRUE,
IntegerEnd,
CHILD_WeightedWidth, 0,
LAYOUT_AddChild, HGroupObject,
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_FONTSIZE],
LAYOUT_AddChild, HGroupObject,
LAYOUT_LabelColumn, PLACETEXT_RIGHT,
LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_SIZE] = IntegerObject,
GA_ID, GID_OPTS_FONT_SIZE,
GA_RelVerify, TRUE,
INTEGER_Number, nsoption_int(font_size) / 10,
INTEGER_Minimum, 1,
INTEGER_Maximum, 99,
INTEGER_Arrows, TRUE,
IntegerEnd,
CHILD_WeightedWidth, 0,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[LAB_OPTS_PT],
LabelEnd,
LayoutEnd,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[LAB_OPTS_PT],
LABEL_Text, gadlab[GID_OPTS_FONT_SIZE],
LabelEnd,
LAYOUT_AddChild, HGroupObject,
LAYOUT_LabelColumn, PLACETEXT_RIGHT,
LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_MINSIZE] = IntegerObject,
GA_ID, GID_OPTS_FONT_MINSIZE,
GA_RelVerify, TRUE,
INTEGER_Number, nsoption_int(font_min_size) / 10,
INTEGER_Minimum, 1,
INTEGER_Maximum, 99,
INTEGER_Arrows, TRUE,
IntegerEnd,
CHILD_WeightedWidth, 0,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[LAB_OPTS_PT],
LabelEnd,
LayoutEnd,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[GID_OPTS_FONT_MINSIZE],
LabelEnd,
LayoutEnd,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[GID_OPTS_FONT_SIZE],
LabelEnd,
LAYOUT_AddChild, HGroupObject,
LAYOUT_LabelColumn, PLACETEXT_RIGHT,
LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_MINSIZE] = IntegerObject,
GA_ID, GID_OPTS_FONT_MINSIZE,
GA_RelVerify, TRUE,
INTEGER_Number, nsoption_int(font_min_size) / 10,
INTEGER_Minimum, 1,
INTEGER_Maximum, 99,
INTEGER_Arrows, TRUE,
IntegerEnd,
CHILD_WeightedWidth, 0,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[LAB_OPTS_PT],
LabelEnd,
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_MISC],
LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_ANTIALIASING] = CheckBoxObject,
GA_ID, GID_OPTS_FONT_ANTIALIASING,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_FONT_ANTIALIASING],
GA_Selected, nsoption_bool(font_antialiasing),
CheckBoxEnd,
LayoutEnd,
CHILD_Label, LabelObject,
LABEL_Text, gadlab[GID_OPTS_FONT_MINSIZE],
LabelEnd,
LayoutEnd,
CHILD_WeightedHeight, 0,
LayoutEnd, // page vgroup
@ -1089,6 +1144,51 @@ void ami_gui_opts_open(void)
CHILD_WeightedHeight, 0,
PageEnd, // page object
/*
** Tabs
*/
PAGE_Add, LayoutObject,
LAYOUT_AddChild,VGroupObject,
LAYOUT_AddChild,HGroupObject,
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_TABS],
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_ACTIVE] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_ACTIVE,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_ACTIVE],
GA_Selected, !nsoption_bool(new_tab_active),
CheckBoxEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_LAST] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_LAST,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_LAST],
GA_Selected, nsoption_bool(new_tab_last),
CheckBoxEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_2] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_2,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_2],
GA_Selected, nsoption_bool(button_2_tab),
CheckBoxEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_ALWAYS] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_ALWAYS,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_ALWAYS],
GA_Selected, nsoption_bool(tab_always_show),
CheckBoxEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_CLOSE] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_CLOSE,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_CLOSE],
GA_Selected, nsoption_bool(tab_close_warn),
CheckBoxEnd,
LayoutEnd, // tabbed browsing
LayoutEnd,
LayoutEnd, // page vgroup
CHILD_WeightedHeight, 0,
PageEnd, // page object
/*
** Advanced
*/
PAGE_Add, LayoutObject,
@ -1127,29 +1227,6 @@ void ami_gui_opts_open(void)
LayoutEnd, // downloads
CHILD_WeightedHeight, 0,
LAYOUT_AddChild,HGroupObject,
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_TABS],
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_ACTIVE] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_ACTIVE,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_ACTIVE],
GA_Selected, !nsoption_bool(new_tab_active),
CheckBoxEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_LAST] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_LAST,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_LAST],
GA_Selected, nsoption_bool(new_tab_last),
CheckBoxEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_2] = CheckBoxObject,
GA_ID, GID_OPTS_TAB_2,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_TAB_2],
GA_Selected, nsoption_bool(button_2_tab),
CheckBoxEnd,
LayoutEnd, // tabbed browsing
LAYOUT_AddChild, VGroupObject,
LAYOUT_SpaceOuter, TRUE,
@ -1423,6 +1500,7 @@ void ami_gui_opts_use(bool save)
struct TextAttr *tattr;
char *dot;
bool rescan_fonts = false;
bool old_tab_always_show;
SetWindowPointer(gow->win,
WA_BusyPointer, TRUE,
@ -1506,6 +1584,13 @@ void ami_gui_opts_use(bool save)
nsoption_set_charp(modeid, modeid);
}
GetAttr(GA_Selected,gow->objects[GID_OPTS_WIN_SIMPLE],(ULONG *)&data);
if (data) {
nsoption_set_bool(window_simple_refresh, true);
} else {
nsoption_set_bool(window_simple_refresh, false);
}
GetAttr(GETFILE_Drawer,gow->objects[GID_OPTS_THEME],(ULONG *)&data);
nsoption_set_charp(theme, (char *)strdup((char *)data));
@ -1558,6 +1643,8 @@ void ami_gui_opts_use(bool save)
nsoption_set_bool(scale_quality, false);
}
GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_DITHERQ],(ULONG *)&nsoption_int(dither_quality));
GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_ANIMSPEED],(ULONG *)&data);
animspeed = strtof((char *)data, NULL);
nsoption_set_int(minimum_gif_delay, (int)(animspeed * 100));
@ -1611,6 +1698,13 @@ void ami_gui_opts_use(bool save)
GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FONT_MINSIZE],(ULONG *)&nsoption_int(font_min_size));
nsoption_set_int(font_min_size, nsoption_int(font_min_size) * 10);
GetAttr(GA_Selected, gow->objects[GID_OPTS_FONT_ANTIALIASING], (ULONG *)&data);
if(data) {
nsoption_set_bool(font_antialiasing, true);
} else {
nsoption_set_bool(font_antialiasing, false);
}
GetAttr(INTEGER_Number,gow->objects[GID_OPTS_CACHE_MEM],(ULONG *)&nsoption_int(memory_cache_size));
nsoption_set_int(memory_cache_size, nsoption_int(memory_cache_size) * 1048576);
@ -1654,6 +1748,25 @@ void ami_gui_opts_use(bool save)
nsoption_set_bool(button_2_tab, false);
}
GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_CLOSE],(ULONG *)&data);
if (data) {
nsoption_set_bool(tab_close_warn, true);
} else {
nsoption_set_bool(tab_close_warn, false);
}
GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_ALWAYS],(ULONG *)&data);
old_tab_always_show = nsoption_bool(tab_always_show);
if (data) {
nsoption_set_bool(tab_always_show, true);
} else {
nsoption_set_bool(tab_always_show, false);
}
if(old_tab_always_show != nsoption_bool(tab_always_show))
ami_gui_tabs_toggle_all();
GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_SEARCH_PROV],(ULONG *)&nsoption_int(search_provider));
search_web_provider_details(nsoption_int(search_provider));
search_web_retrieve_ico(false);
@ -1748,6 +1861,8 @@ void ami_gui_opts_use(bool save)
ami_font_savescanner(); /* just in case it has changed and been used only */
}
ami_menu_check_toggled = true;
SetWindowPointer(gow->win,
WA_Pointer, NULL,
TAG_DONE);

View File

@ -18,8 +18,41 @@
#include <proto/exec.h>
#include "amiga/hotlist.h"
#include "desktop/hotlist.h"
#include "amiga/tree.h"
#include "desktop/hotlist.h"
#include "utils/messages.h"
bool ami_hotlist_find_dir(struct tree *tree, const char *dir_name)
{
struct node *root = tree_node_get_child(tree_get_root(tree));
struct node *node;
struct node_element *element;
for (node = root; node; node = tree_node_get_next(node))
{
element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL);
if(!element) element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL);
if(element && (strcmp(tree_node_element_get_text(element), dir_name) == 0))
{
return true;
}
}
return false;
}
void ami_hotlist_add_default_dirs(struct tree *tree)
{
if(ami_hotlist_find_dir(tree, messages_get("HotlistMenu")) == false) {
tree_create_folder_node(tree, tree_get_root(tree),
messages_get("HotlistMenu"), true, true, false);
}
if(ami_hotlist_find_dir(tree, messages_get("HotlistToolbar")) == false) {
tree_create_folder_node(tree, tree_get_root(tree),
messages_get("HotlistToolbar"), true, true, false);
}
}
void ami_hotlist_initialise(const char *hotlist_file)
{
@ -30,6 +63,8 @@ void ami_hotlist_initialise(const char *hotlist_file)
hotlist_initialise(ami_tree_get_tree(hotlist_window),
hotlist_file,
tree_directory_icon_name);
ami_hotlist_add_default_dirs(ami_tree_get_tree(hotlist_window));
}
void ami_hotlist_free(const char *hotlist_file)

View File

@ -103,6 +103,9 @@ static void ami_menu_item_browser_find(struct Hook *hook, APTR window, struct In
static void ami_menu_item_browser_localhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_globalhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_cookies(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_foreimg(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window, struct IntuiMessage *msg);
@ -325,25 +328,44 @@ void ami_init_menulabs(struct gui_window_2 *gwin)
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("Redraw"));
gwin->menu_hook[38].h_Entry = (HOOKFUNC)ami_menu_item_browser_redraw;
gwin->menutype[39] = NM_TITLE;
gwin->menulab[39] = ami_utf8_easy((char *)messages_get("Hotlist"));
gwin->menutype[40] = NM_ITEM;
gwin->menulab[40] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
gwin->menukey[40] = 'B';
gwin->menu_hook[40].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_add;
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("HotlistShowNS"));
gwin->menukey[41] = 'H';
gwin->menu_hook[41].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_show;
gwin->menulab[41] = ami_utf8_easy((char *)messages_get("EnableJS"));
gwin->menu_hook[41].h_Entry = (HOOKFUNC)ami_menu_item_browser_enablejs;
gwin->menukey[41] = 'J';
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"));
@ -415,9 +437,23 @@ struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
#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(nsoption_bool(enable_javascript) == true)
gwin->menu[41].nm_Flags |= CHECKED;
#endif
gwin->menu[15].nm_Flags = NM_ITEMDISABLED;
gwin->menu[39].nm_Flags = CHECKIT | MENUTOGGLE;
if(nsoption_bool(foreground_images) == true)
gwin->menu[39].nm_Flags |= CHECKED;
gwin->menu[40].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);
@ -497,8 +533,8 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin)
struct node *root = tree_node_get_child(tree_get_root(tree));
struct node *node;
struct node_element *element;
static WORD gen = 0;
static ULONG item;
WORD gen = 0;
ULONG item;
item = AMI_MENU_HOTLIST;
@ -506,17 +542,17 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin)
{
element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL);
if(!element) element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL);
if(element && (strcmp(tree_node_element_get_text(element),"Menu")==0))
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, count, gwin);
}
}
return(item - AMI_MENU_HOTLIST);
}
void ami_menu_scan_2(struct tree *tree,struct node *root,WORD *gen,
void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen,
ULONG *item, bool count, struct gui_window_2 *gwin)
{
struct node *tempnode;
@ -565,6 +601,40 @@ void ami_menu_scan_2(struct tree *tree,struct node *root,WORD *gen,
*gen = *gen - 1;
}
void ami_menu_update_checked(struct gui_window_2 *gwin)
{
struct Menu *menustrip;
GetAttr(WINDOW_MenuStrip, gwin->objects[OID_MAIN], (ULONG *)&menustrip);
if(!menustrip) return;
if(nsoption_bool(enable_javascript) == true) {
if((ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) == 0)
ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED;
} else {
if(ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED)
ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED;
}
if(nsoption_bool(foreground_images) == true) {
if((ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED) == 0)
ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^= CHECKED;
} else {
if(ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED)
ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^= CHECKED;
}
if(nsoption_bool(background_images) == true) {
if((ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED) == 0)
ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^= CHECKED;
} else {
if(ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED)
ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^= CHECKED;
}
ResetMenuStrip(gwin->win, menustrip);
}
void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c)
{
struct Window *win = g->shared->win;
@ -824,6 +894,42 @@ static void ami_menu_item_browser_cookies(struct Hook *hook, APTR window, struct
ami_tree_open(cookies_window,AMI_TREE_COOKIES);
}
static void ami_menu_item_browser_foreimg(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
struct Menu *menustrip;
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
nsoption_set_bool(foreground_images, checked);
ami_menu_check_toggled = true;
}
static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
struct Menu *menustrip;
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
nsoption_set_bool(background_images, checked);
ami_menu_check_toggled = true;
}
static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
struct Menu *menustrip;
bool checked = false;
GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
nsoption_set_bool(enable_javascript, checked);
ami_menu_check_toggled = true;
}
static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
struct gui_window_2 *gwin;

View File

@ -30,10 +30,10 @@
/* Maximum number of menu items - first value is number of static items
* (ie. everything not intially defined as NM_IGNORE) */
#define AMI_MENU_MAX 52 + AMI_HOTLIST_ITEMS
#define AMI_MENU_MAX 57 + AMI_HOTLIST_ITEMS
/* Where the hotlist entries start */
#define AMI_MENU_HOTLIST 43
#define AMI_MENU_HOTLIST 48
/* Where the hotlist entries end */
#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS
@ -62,17 +62,22 @@
#define AMI_MENU_SELECTALL FULLMENUNUM(1,4,0)
#define AMI_MENU_CLEAR FULLMENUNUM(1,5,0)
#define AMI_MENU_FIND FULLMENUNUM(2,0,0)
#define AMI_MENU_FOREIMG FULLMENUNUM(2,8,0)
#define AMI_MENU_BACKIMG FULLMENUNUM(2,8,1)
#define AMI_MENU_JS FULLMENUNUM(2,9,0)
/* A special value for ami_menu_window_close */
#define AMI_MENU_WINDOW_CLOSE_ALL 1
#define AMI_MENU_WINDOW_CLOSE_ALL (void *)1
struct gui_window;
struct gui_window_2;
struct gui_window_2 *ami_menu_window_close;
bool ami_menu_check_toggled;
void ami_free_menulabs(struct gui_window_2 *gwin);
struct NewMenu *ami_create_menu(struct gui_window_2 *gwin);
void ami_menu_refresh(struct gui_window_2 *gwin);
void ami_menu_update_checked(struct gui_window_2 *gwin);
void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c);
#endif

View File

@ -71,6 +71,29 @@ void warn_user(const char *warning, const char *detail)
if(utf8warning) free(utf8warning);
}
int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win)
{
int res = 0;
char *utf8text = ami_utf8_easy(body);
char *utf8gadget1 = ami_utf8_easy(messages_get(opt1));
char *utf8gadget2 = ami_utf8_easy(messages_get(opt2));
char *utf8gadgets = ASPrintf("%s|%s", utf8gadget1, utf8gadget2);
free(utf8gadget1);
free(utf8gadget2);
res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_WARNING,
TDR_TitleString, messages_get("NetSurf"),
TDR_FormatString, utf8text,
TDR_GadgetString, utf8gadgets,
TDR_Window, win,
TAG_DONE);
if(utf8text) free(utf8text);
if(utf8gadgets) FreeVec(utf8gadgets);
return res;
}
void die(const char *error)
{
TimedDosRequesterTags(TDR_ImageType,TDRIMAGE_ERROR,

View File

@ -19,4 +19,5 @@
#ifndef AMIGA_MISC_H
#define AMIGA_MISC_H
char *translate_escape_chars(const char *s);
int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win);
#endif

View File

@ -39,6 +39,8 @@
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; \
@ -74,6 +76,7 @@
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; \
@ -101,6 +104,8 @@
.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, \
@ -136,6 +141,7 @@
.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, \
@ -162,6 +168,8 @@
{ "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 }, \
@ -197,6 +205,7 @@
{ "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}, \

View File

@ -690,6 +690,8 @@ void ami_tree_close(struct treeview_window *twin)
ami_utf8_free(twin->sslreject);
ami_ssl_free(twin);
}
ami_gui_hotlist_toolbar_update_all();
}
void ami_tree_update_quals(struct treeview_window *twin)

52
atari/Makefile.defaults Normal file
View File

@ -0,0 +1,52 @@
# ----------------------------------------------------------------------------
# Atari-specific options
# ----------------------------------------------------------------------------
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG := AUTO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
NETSURF_USE_MNG := NO
# enable true type fonts via freetype2
# Valid options: YES, NO
NETSURF_USE_ATARI_FREETYPE_FONT := YES
# Enable use of netsurf embedded font
# Valid options: YES, NO
NETSURF_USE_ATARI_NETSURF_FONT := YES
# Configure support for screen drivers with no true colour mode
# Valid options: YES, NO
NETSURF_USE_ATARI_8BPP_SUPPORT := NO
# Configure the CPU target
# Valid options: 68000, 68020-60, 5475 (coldfire)
ATARI_ARCH = 68020-60
# enable optimizations
# -O2 is currently broken with m68000 / m68020-60 builds
CFLAGS += -O1
# override warning flags removing -Wall
WARNFLAGS = -W -Wundef -Wpointer-arith \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
-Wnested-externs -Wuninitialized -Wl,-t

View File

@ -55,8 +55,8 @@ 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))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
CFLAGS += -U__STRICT_ANSI__ -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \
-D_BSD_SOURCE \

32
beos/Makefile.defaults Normal file
View File

@ -0,0 +1,32 @@
# ----------------------------------------------------------------------------
# BeOS-specific options
# ----------------------------------------------------------------------------
# Where to install the netsurf binary
NETSURF_BEOS_BIN := /boot/apps/netsurf/
# TODO:HAIKU -- not sure if ~/.netsurf applies in beos
# Where to search for NetSurf's resources after looking in ~/.netsurf and
# $NETSURFRES. It must have a trailing /
NETSURF_BEOS_RESOURCES := /boot/apps/netsurf/res/
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := YES
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := AUTO
# Enable NetSurf's use of libharu for PDF export.
# Valid options: YES, NO
NETSURF_USE_HARU_PDF := NO
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# Optimisation levels
CFLAGS += -O2

View File

@ -62,7 +62,7 @@
NETLDFLAGS := -lnetwork
endif
LDFLAGS += -lbe -ltranslation -ltracker $(NETLDFLAGS)
ifeq ($(GCCVER),2)
ifeq ($(CC_MAJOR),2)
LDFLAGS += -lstdc++.r4
else
LDFLAGS += -lstdc++ -lsupc++
@ -78,9 +78,9 @@
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG ))
endif
# ----------------------------------------------------------------------------

37
cocoa/Makefile.defaults Normal file
View File

@ -0,0 +1,37 @@
# ----------------------------------------------------------------------------
# Cocoa-specific options
# ----------------------------------------------------------------------------
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG := AUTO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
NETSURF_USE_MNG := NO
NETSURF_USE_BMP := NO
NETSURF_USE_GIF := NO
NETSURF_USE_PNG := NO
NETSURF_USE_JPEG := NO
NETSURF_USE_IMAGEIO := YES
DEVELOPER_PATH := /Developer
MACOSX_VERSION := 10.5
SDK_VERSION := $(MACOSX_VERSION)
# Optimisation levels
CFLAGS += -O2

View File

@ -53,10 +53,10 @@ endif
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
$(eval $(call feature_enabled,IMAGEIO,-DWITH_APPLE_IMAGE,,Apple ImageIO ))
ifneq ($(UNIVERSAL),)

View File

@ -0,0 +1,47 @@
# ----------------------------------------------------------------------------
# Framebuffer-target-specific options
# ----------------------------------------------------------------------------
# Optimisation levels
CFLAGS += -O2
# Framebuffer default surface provider.
# Valid values are: x, sdl, linux, vnc, able,
NETSURF_FB_FRONTEND := sdl
# Use libharu to enable PDF export and GTK printing support.
# Valid options: YES, NO
NETSURF_USE_HARU_PDF := NO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := AUTO
# Library to use for font plotting
# Valid options: internal, freetype
NETSURF_FB_FONTLIB := internal
# Default freetype font files
NETSURF_FB_FONT_SANS_SERIF := DejaVuSans.ttf
NETSURF_FB_FONT_SANS_SERIF_BOLD := DejaVuSans-Bold.ttf
NETSURF_FB_FONT_SANS_SERIF_ITALIC := DejaVuSans-Oblique.ttf
NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD := DejaVuSans-BoldOblique.ttf
NETSURF_FB_FONT_SERIF := DejaVuSerif.ttf
NETSURF_FB_FONT_SERIF_BOLD := DejaVuSerif-Bold.ttf
NETSURF_FB_FONT_MONOSPACE := DejaVuSansMono.ttf
NETSURF_FB_FONT_MONOSPACE_BOLD := DejaVuSansMono-Bold.ttf
NETSURF_FB_FONT_CURSIVE := Comic_Sans_MS.ttf
NETSURF_FB_FONT_FANTASY := Impact.ttf
# Default binary install path
NETSURF_FRAMEBUFFER_BIN := $(PREFIX)/bin/
# Default resource install path
NETSURF_FRAMEBUFFER_RESOURCES := $(PREFIX)/share/netsurf/
# Default framebuffer search path
NETSURF_FB_RESPATH := $${HOME}/.netsurf/:$${NETSURFRES}:$(NETSURF_FRAMEBUFFER_RESOURCES):./framebuffer/res
# freetype compiled in font serch path
NETSURF_FB_FONTPATH := /usr/share/fonts/truetype/ttf-dejavu:/usr/share/fonts/truetype/msttcorefonts

View File

@ -38,11 +38,11 @@ CFLAGS += '-DNETSURF_FB_FONT_MONOSPACE_BOLD="$(NETSURF_FB_FONT_MONOSPACE_BOLD)"'
CFLAGS += '-DNETSURF_FB_FONT_CURSIVE="$(NETSURF_FB_FONT_CURSIVE)"'
CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_FB_FONT_FANTASY)"'
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))
CFLAGS += -std=c99 -g -I. -Dsmall $(WARNFLAGS) \
-D_BSD_SOURCE \

34
gtk/Makefile.defaults Normal file
View File

@ -0,0 +1,34 @@
# ----------------------------------------------------------------------------
# GTK-specific options
# ----------------------------------------------------------------------------
# Where to search for NetSurf's resources after looking in ~/.netsurf and
# $NETSURFRES. It must have a trailing /
NETSURF_GTK_RESOURCES := $(PREFIX)/share/netsurf/
# Where to install the netsurf binary
NETSURF_GTK_BIN := $(PREFIX)/bin/
# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG := AUTO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := AUTO
# Configuration overrides for Mac OS X
ifeq ($(HOST),macosx)
NETSURF_USE_LIBICONV_PLUG := NO
NETSURF_USE_HARU_PDF := NO
endif
# Set default GTK version to build for (2 or 3)
NETSURF_GTK_MAJOR := 2
# Optimisation levels
CFLAGS += -O2

View File

@ -7,9 +7,6 @@
# GTK flag setup (using pkg-config)
# ----------------------------------------------------------------------------
LDFLAGS += $(shell $(PKG_CONFIG) --libs libcurl libdom libcss)
LDFLAGS += $(shell $(PKG_CONFIG) --libs openssl)
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG
NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
@ -24,16 +21,16 @@ NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
# add a line similar to below for each optional lib here
# note: webp lacks pkg-config file
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG))
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,RSVG,librsvg-2.0,SVG))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,VIDEO,gstreamer-0.10,Video))
# GTK and GLIB flags to disable depricated usage
GTKDEPFLAGS := -DG_DISABLE_SINGLE_INCLUDES \
@ -54,16 +51,22 @@ GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
-D_POSIX_C_SOURCE=200112L \
-D_NETBSD_SOURCE \
-DGTK_RESPATH=\"$(NETSURF_GTK_RESOURCES)\" \
$(WARNFLAGS) -I. -g \
$(shell $(PKG_CONFIG) --cflags gtk+-$(NETSURF_GTK_MAJOR).0) \
$(shell $(PKG_CONFIG) --cflags libhubbub libcurl) \
$(shell $(PKG_CONFIG) --cflags openssl) \
$(shell xml2-config --cflags)
$(WARNFLAGS) -I. -g
# non optional pkg-configed libs
$(eval $(call pkg_config_find_and_add,libcss,CSS))
$(eval $(call pkg_config_find_and_add,libdom,DOM))
$(eval $(call pkg_config_find_and_add,libhubbub,Hubbub))
$(eval $(call pkg_config_find_and_add,openssl,OpenSSL))
$(eval $(call pkg_config_find_and_add,libcurl,Curl ))
$(eval $(call pkg_config_find_and_add,gtk+-$(NETSURF_GTK_MAJOR).0,GTK-$(NETSURF_GTK_MAJOR)))
$(eval $(call pkg_config_find_and_add,gthread-2.0,GThread2))
$(eval $(call pkg_config_find_and_add,gmodule-2.0,GModule2))
$(eval $(call pkg_config_find_and_add,lcms,lcms))
GTKLDFLAGS := $(shell $(PKG_CONFIG) --cflags --libs gtk+-$(NETSURF_GTK_MAJOR).0 gthread-2.0 gmodule-2.0 lcms)
CFLAGS += $(GTKCFLAGS)
LDFLAGS += -lm $(GTKLDFLAGS)
LDFLAGS += -lm
# ---------------------------------------------------------------------------
# Windows flag setup

View File

@ -26,6 +26,10 @@
typedef struct jscontext jscontext;
typedef struct jsobject jsobject;
struct dom_document;
struct dom_node;
struct dom_string;
/** Initialise javascript interpreter */
void js_initialise(void);
@ -51,7 +55,16 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv);
/* execute some javascript in a context */
bool js_exec(jscontext *ctx, const char *txt, size_t txtlen);
/* fire an event at a dom node */
bool js_fire_event(jscontext *ctx, const char *type, void *target);
bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, struct dom_node *target);
bool
js_dom_event_add_listener(jscontext *ctx,
struct dom_document *document,
struct dom_node *node,
struct dom_string *event_type_dom,
void *js_funcval);
#endif /* _NETSURF_JAVASCRIPT_JS_H_ */

View File

@ -32,14 +32,16 @@ void js_initialise(void)
/* Create a JS runtime. */
#if JS_VERSION >= 180
JS_SetCStringsAreUTF8(); /* we prefer our runtime to be utf-8 */
JS_SetCStringsAreUTF8(); /* we prefer our runtime to be utf-8 */
#endif
rt = JS_NewRuntime(8L * 1024L * 1024L);
JSLOG("New runtime handle %p", rt);
/* register script content handler */
javascript_init();
if (rt != NULL) {
/* register script content handler */
javascript_init();
}
}
void js_finalise(void)
@ -97,7 +99,7 @@ void js_destroycontext(jscontext *ctx)
*
* This performs the following actions
* 1. constructs a new global object by initialising a window class
* 2. Instantiate the global a window object
* 2. Instantiate the global a window object
*/
jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
{
@ -116,7 +118,7 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
}
window = jsapi_new_Window(cx, window_proto, NULL, win_priv, doc_priv);
return (jsobject *)window;
}
@ -139,9 +141,9 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
return false;
}
if (JS_EvaluateScript(cx,
JS_GetGlobalObject(cx),
txt, txtlen,
if (JS_EvaluateScript(cx,
JS_GetGlobalObject(cx),
txt, txtlen,
"<head>", 0, &rval) == JS_TRUE) {
return true;
@ -153,7 +155,7 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
dom_exception _dom_event_create(dom_document *doc, dom_event **evt);
#define dom_event_create(d, e) _dom_event_create((dom_document *)(d), (dom_event **) (e))
bool js_fire_event(jscontext *ctx, const char *type, void *target)
bool js_fire_event(jscontext *ctx, const char *type, dom_document *doc, dom_node *target)
{
JSContext *cx = (JSContext *)ctx;
dom_node *node = target;
@ -165,18 +167,23 @@ bool js_fire_event(jscontext *ctx, const char *type, void *target)
dom_event *event;
dom_string *type_dom;
if (node == NULL) {
/* deliver to window */
if (cx == NULL) {
return false;
}
if (cx == NULL) {
return false;
}
exc = dom_string_create((unsigned char*)type, strlen(type), &type_dom);
if (node == NULL) {
/* deliver manufactured event to window */
JSLOG("Dispatching event %s at window", type);
/* create and initialise and event object */
exc = dom_string_create((unsigned char*)type,
strlen(type),
&type_dom);
if (exc != DOM_NO_ERR) {
return false;
}
exc = dom_event_create(-1, &event);
exc = dom_event_create(doc, &event);
if (exc != DOM_NO_ERR) {
return false;
}
@ -192,18 +199,133 @@ bool js_fire_event(jscontext *ctx, const char *type, void *target)
return false;
}
/* dispatch event at the window object */
argv[0] = OBJECT_TO_JSVAL(jsevent);
ret = JS_CallFunctionName(cx,
JS_GetGlobalObject(cx),
"dispatchEvent",
1,
argv,
ret = JS_CallFunctionName(cx,
JS_GetGlobalObject(cx),
"dispatchEvent",
1,
argv,
&rval);
}
} else {
JSLOG("Dispatching event %s at %p", type, node);
/* create and initialise and event object */
exc = dom_string_create((unsigned char*)type,
strlen(type),
&type_dom);
if (exc != DOM_NO_ERR) {
return false;
}
exc = dom_event_create(doc, &event);
if (exc != DOM_NO_ERR) {
return false;
}
exc = dom_event_init(event, type_dom, true, true);
dom_string_unref(type_dom);
if (exc != DOM_NO_ERR) {
return false;
}
dom_event_target_dispatch_event(node, event, &ret);
}
if (ret == JS_TRUE) {
return true;
}
return false;
}
struct js_dom_event_private {
JSContext *cx; /* javascript context */
jsval funcval; /* javascript function to call */
struct dom_node *node; /* dom node event listening on */
dom_string *type; /* event type */
dom_event_listener *listener; /* the listener containing this */
};
static void
js_dom_event_listener(struct dom_event *event, void *pw)
{
struct js_dom_event_private *private = pw;
jsval event_argv[1];
jsval event_rval;
JSObject *jsevent;
JSLOG("WOOT dom event with %p", private);
if (!JSVAL_IS_VOID(private->funcval)) {
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);
}
}
}
/* add a listener to a dom node
*
* 1. Create a dom_event_listener From a handle_event function pointer
* and a private word In a document context
*
* 2. Register for your events on a target (dom nodes are targets)
* dom_event_target_add_event_listener(node, evt_name, listener,
* capture_or_not)
*
*/
bool
js_dom_event_add_listener(jscontext *ctx,
struct dom_document *document,
struct dom_node *node,
struct dom_string *event_type_dom,
void *js_funcval)
{
JSContext *cx = (JSContext *)ctx;
dom_exception exc;
struct js_dom_event_private *private;
private = malloc(sizeof(struct js_dom_event_private));
if (private == NULL) {
return false;
}
exc = dom_event_listener_create(document,
js_dom_event_listener,
private,
&private->listener);
if (exc != DOM_NO_ERR) {
return false;
}
private->cx = cx;
private->funcval = *(jsval *)js_funcval;
private->node = node;
private->type = event_type_dom;
JSLOG("adding %p to listener", private);
JSAPI_ADD_VALUE_ROOT(cx, &private->funcval);
exc = dom_event_target_add_event_listener(private->node,
private->type,
private->listener,
true);
if (exc != DOM_NO_ERR) {
JSLOG("failed to add listener");
JSAPI_REMOVE_VALUE_ROOT(cx, &private->funcval);
}
return true;
}

View File

@ -35,11 +35,13 @@
#include <string.h>
# ifndef JSVERSION_LATEST
# define JSVERSION_LATEST JS_VERSION
# endif
#ifndef JSVERSION_LATEST
#define JSVERSION_LATEST JS_VERSION
#endif
#ifndef JSOPTION_JIT
#define JSOPTION_JIT 0
#endif
/* *CAUTION* these native function macros introduce and use jsapi_this
* and jsapi_rval variables, native function code should not conflict
@ -79,7 +81,7 @@
jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp)
/* native property return value */
#define JSAPI_PROP_RVAL(cx, vp) (vp)
#define JSAPI_PROP_RVAL(cx, vp) (*(vp))
/* native property getter return value */
#define JSAPI_PROP_SET_RVAL(cx, vp, v) (*(vp) = (v))
@ -150,6 +152,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_ADD_OBJECT_ROOT(cx, obj) JS_AddRoot(cx, obj)
#define JSAPI_REMOVE_OBJECT_ROOT(cx, obj) JS_RemoveRoot(cx, obj)
#define JSAPI_ADD_VALUE_ROOT(cx, obj) JS_AddRoot(cx, obj)
#define JSAPI_REMOVE_VALUE_ROOT(cx, obj) JS_RemoveRoot(cx, obj)
#elif JS_VERSION == 180
/************************** Spidermonkey 1.8.0 **************************/
@ -263,6 +268,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_ADD_OBJECT_ROOT(cx, obj) JS_AddRoot(cx, obj)
#define JSAPI_REMOVE_OBJECT_ROOT(cx, obj) JS_RemoveRoot(cx, obj)
#define JSAPI_ADD_VALUE_ROOT(cx, obj) JS_AddRoot(cx, obj)
#define JSAPI_REMOVE_VALUE_ROOT(cx, obj) JS_RemoveRoot(cx, obj)
#else /* #if JS_VERSION == 180 */
@ -365,6 +373,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_ADD_OBJECT_ROOT(cx, obj) JS_AddObjectRoot(cx, obj)
#define JSAPI_REMOVE_OBJECT_ROOT(cx, obj) JS_RemoveObjectRoot(cx, obj)
#define JSAPI_ADD_VALUE_ROOT(cx, val) JS_AddValueRoot(cx, val)
#define JSAPI_REMOVE_VALUE_ROOT(cx, val) JS_RemoveValueRoot(cx, val)
#endif
#define JSLOG(args...) LOG((args))

View File

@ -45,8 +45,8 @@ JSObject *jsapi_InitClass_Location(JSContext *cx, JSObject *parent);
JSObject *jsapi_new_Location(JSContext *cx,
JSObject *window,
JSObject *parent,
struct browser_window *bw,
nsurl *url);
nsurl *url,
html_content *htmlc);
JSObject *jsapi_InitClass_Document(JSContext *cx, JSObject *parent);

View File

@ -1,4 +1,12 @@
/* DOM bindings entries */
/* Binding to generate interfaces for the DOM IDL
*
* Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* Released under the terms of the MIT License,
* http://www.opensource.org/licenses/mit-license
*/
webidlfile "dom.idl";

View File

@ -1,4 +1,4 @@
/* Binding to generate HTMLcolelction interface
/* Binding to generate HTMLcollection interface
*
* The js_libdom (javascript to libdom) binding type is currently the
* only one implemented and this principly describes that binding.

View File

@ -28,6 +28,7 @@ preamble %{
#include "content/urldb.h"
#include "javascript/js.h"
#include "javascript/jsapi.h"
#include "javascript/jsapi/binding.h"
@ -43,6 +44,12 @@ binding document {
*/
private "dom_document *" node;
private "struct html_content *" htmlc;
/** location instantiated on first use */
property unshared location;
/* events through a single interface */
property unshared type EventHandler;
}
api finalise %{
@ -53,6 +60,37 @@ api finalise %{
}
%}
getter location %{
if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx,vp))) {
/* already created - return it */
return JS_TRUE;
}
jsret = jsapi_new_Location(cx,
NULL,
NULL,
llcache_handle_get_url(private->htmlc->base.llcache),
private->htmlc);
%}
getter URL %{
jsval loc;
jsval jsstr = JSVAL_NULL;
if (JS_GetProperty(cx, obj, "location", &loc) == JS_TRUE) {
JS_GetProperty(cx, JSVAL_TO_OBJECT(loc), "href", &jsstr);
}
jsret = JSVAL_TO_STRING(jsstr);
%}
getter documentURI %{
jsval loc;
jsval jsstr = JSVAL_NULL;
if (JS_GetProperty(cx, obj, "location", &loc) == JS_TRUE) {
JS_GetProperty(cx, JSVAL_TO_OBJECT(loc), "href", &jsstr);
}
jsret = JSVAL_TO_STRING(jsstr);
%}
getter cookie %{
char *cookie_str;
cookie_str = urldb_get_cookie(llcache_handle_get_url(private->htmlc->base.llcache), false);
@ -238,3 +276,254 @@ operation createElement %{
JSLOG("returning jsobject %p",jsret);
%}
getter EventHandler %{
JSLOG("propname[%d].name=\"%s\"",
tinyid,
jsclass_properties[tinyid].name);
%}
setter EventHandler %{
dom_string *event_type_dom;
JSLOG("propname[%d].name=\"%s\"",
tinyid,
jsclass_properties[tinyid].name);
switch (tinyid) {
case JSAPI_PROP_TINYID_onabort:
event_type_dom = corestring_dom_abort;
break;
case JSAPI_PROP_TINYID_onblur:
event_type_dom = corestring_dom_blur;
break;
case JSAPI_PROP_TINYID_oncancel:
event_type_dom = corestring_dom_cancel;
break;
case JSAPI_PROP_TINYID_oncanplay:
event_type_dom = corestring_dom_canplay;
break;
case JSAPI_PROP_TINYID_oncanplaythrough:
event_type_dom = corestring_dom_canplaythrough;
break;
case JSAPI_PROP_TINYID_onchange:
event_type_dom = corestring_dom_change;
break;
case JSAPI_PROP_TINYID_onclick:
event_type_dom = corestring_dom_click;
break;
case JSAPI_PROP_TINYID_onclose:
event_type_dom = corestring_dom_close;
break;
case JSAPI_PROP_TINYID_oncontextmenu:
event_type_dom = corestring_dom_contextmenu;
break;
case JSAPI_PROP_TINYID_oncuechange:
event_type_dom = corestring_dom_cuechange;
break;
case JSAPI_PROP_TINYID_ondblclick:
event_type_dom = corestring_dom_dblclick;
break;
case JSAPI_PROP_TINYID_ondrag:
event_type_dom = corestring_dom_drag;
break;
case JSAPI_PROP_TINYID_ondragend:
event_type_dom = corestring_dom_dragend;
break;
case JSAPI_PROP_TINYID_ondragenter:
event_type_dom = corestring_dom_dragenter;
break;
case JSAPI_PROP_TINYID_ondragleave:
event_type_dom = corestring_dom_dragleave;
break;
case JSAPI_PROP_TINYID_ondragover:
event_type_dom = corestring_dom_dragover;
break;
case JSAPI_PROP_TINYID_ondragstart:
event_type_dom = corestring_dom_dragstart;
break;
case JSAPI_PROP_TINYID_ondrop:
event_type_dom = corestring_dom_drop;
break;
case JSAPI_PROP_TINYID_ondurationchange:
event_type_dom = corestring_dom_durationchange;
break;
case JSAPI_PROP_TINYID_onemptied:
event_type_dom = corestring_dom_emptied;
break;
case JSAPI_PROP_TINYID_onended:
event_type_dom = corestring_dom_ended;
break;
case JSAPI_PROP_TINYID_onerror:
event_type_dom = corestring_dom_error;
break;
case JSAPI_PROP_TINYID_onfocus:
event_type_dom = corestring_dom_focus;
break;
case JSAPI_PROP_TINYID_oninput:
event_type_dom = corestring_dom_input;
break;
case JSAPI_PROP_TINYID_oninvalid:
event_type_dom = corestring_dom_invalid;
break;
case JSAPI_PROP_TINYID_onkeydown:
event_type_dom = corestring_dom_keydown;
break;
case JSAPI_PROP_TINYID_onkeypress:
event_type_dom = corestring_dom_keypress;
break;
case JSAPI_PROP_TINYID_onkeyup:
event_type_dom = corestring_dom_keyup;
break;
case JSAPI_PROP_TINYID_onload:
event_type_dom = corestring_dom_load;
break;
case JSAPI_PROP_TINYID_onloadeddata:
event_type_dom = corestring_dom_loadeddata;
break;
case JSAPI_PROP_TINYID_onloadedmetadata:
event_type_dom = corestring_dom_loadedmetadata;
break;
case JSAPI_PROP_TINYID_onloadstart:
event_type_dom = corestring_dom_loadstart;
break;
case JSAPI_PROP_TINYID_onmousedown:
event_type_dom = corestring_dom_mousedown;
break;
case JSAPI_PROP_TINYID_onmousemove:
event_type_dom = corestring_dom_mousemove;
break;
case JSAPI_PROP_TINYID_onmouseout:
event_type_dom = corestring_dom_mouseout;
break;
case JSAPI_PROP_TINYID_onmouseover:
event_type_dom = corestring_dom_mouseover;
break;
case JSAPI_PROP_TINYID_onmouseup:
event_type_dom = corestring_dom_mouseup;
break;
case JSAPI_PROP_TINYID_onmousewheel:
event_type_dom = corestring_dom_mousewheel;
break;
case JSAPI_PROP_TINYID_onpause:
event_type_dom = corestring_dom_pause;
break;
case JSAPI_PROP_TINYID_onplay:
event_type_dom = corestring_dom_play;
break;
case JSAPI_PROP_TINYID_onplaying:
event_type_dom = corestring_dom_playing;
break;
case JSAPI_PROP_TINYID_onprogress:
event_type_dom = corestring_dom_progress;
break;
case JSAPI_PROP_TINYID_onratechange:
event_type_dom = corestring_dom_ratechange;
break;
case JSAPI_PROP_TINYID_onreset:
event_type_dom = corestring_dom_reset;
break;
case JSAPI_PROP_TINYID_onscroll:
event_type_dom = corestring_dom_scroll;
break;
case JSAPI_PROP_TINYID_onseeked:
event_type_dom = corestring_dom_seeked;
break;
case JSAPI_PROP_TINYID_onseeking:
event_type_dom = corestring_dom_seeking;
break;
case JSAPI_PROP_TINYID_onselect:
event_type_dom = corestring_dom_select;
break;
case JSAPI_PROP_TINYID_onshow:
event_type_dom = corestring_dom_show;
break;
case JSAPI_PROP_TINYID_onstalled:
event_type_dom = corestring_dom_stalled;
break;
case JSAPI_PROP_TINYID_onsubmit:
event_type_dom = corestring_dom_submit;
break;
case JSAPI_PROP_TINYID_onsuspend:
event_type_dom = corestring_dom_suspend;
break;
case JSAPI_PROP_TINYID_ontimeupdate:
event_type_dom = corestring_dom_timeupdate;
break;
case JSAPI_PROP_TINYID_onvolumechange:
event_type_dom = corestring_dom_volumechange;
break;
case JSAPI_PROP_TINYID_onwaiting:
event_type_dom = corestring_dom_waiting;
break;
case JSAPI_PROP_TINYID_onreadystatechange:
event_type_dom = corestring_dom_readystatechange;
break;
default:
JSLOG("called with unknown tinyid");
return JS_TRUE;
}
js_dom_event_add_listener((struct jscontext *)cx,
private->node,
(dom_node *)private->node,
event_type_dom,
vp);
%}

View File

@ -23,19 +23,96 @@ preamble %{
#include "utils/config.h"
#include "utils/log.h"
#include "utils/corestrings.h"
#include "javascript/js.h"
#include "javascript/jsapi.h"
#include "javascript/jsapi/binding.h"
%}
binding htmlelement {
type js_libdom; /* the binding type */
type js_libdom; /* the binding type */
interface HTMLElement; /* Web IDL interface to generate */
interface HTMLElement; /* Web IDL interface to generate */
/* superclasses
private "dom_element *" node;
private "struct html_content *" htmlc;
interface HTMLAnchorElement
interface HTMLAppletElement
interface HTMLAreaElement
interface HTMLBaseElement
interface HTMLBaseFontElement
interface HTMLBodyElement
interface HTMLBRElement
interface HTMLButtonElement
interface HTMLCanvasElement
interface HTMLCommandElement
interface HTMLDataElement
interface HTMLDataListElement
interface HTMLDetailsElement
interface HTMLDialogElement
interface HTMLDirectoryElement
interface HTMLDivElement
interface HTMLDListElement
interface HTMLEmbedElement
interface HTMLFieldSetElement
interface HTMLFontElement
interface HTMLFormElement
interface HTMLFrameElement
interface HTMLFrameSetElement
interface HTMLHeadElement
interface HTMLHeadingElement
interface HTMLHRElement
interface HTMLHtmlElement
interface HTMLIFrameElement
interface HTMLImageElement
interface HTMLInputElement
interface HTMLKeygenElement
interface HTMLLabelElement
interface HTMLLegendElement
interface HTMLLIElement
interface HTMLLinkElement
interface HTMLMapElement
interface HTMLMarqueeElement
interface HTMLMediaElement
interface HTMLMenuElement
interface HTMLMetaElement
interface HTMLMeterElement
interface HTMLModElement
interface HTMLObjectElement
interface HTMLOListElement
interface HTMLOptGroupElement
interface HTMLOptionElement
interface HTMLOutputElement
interface HTMLParagraphElement
interface HTMLParamElement
interface HTMLPreElement
interface HTMLProgressElement
interface HTMLQuoteElement
interface HTMLScriptElement
interface HTMLSelectElement
interface HTMLSourceElement
interface HTMLSpanElement
interface HTMLStyleElement
interface HTMLTableCaptionElement
interface HTMLTableCellElement
interface HTMLTableColElement
interface HTMLTableElement
interface HTMLTableRowElement
interface HTMLTableSectionElement
interface HTMLTextAreaElement
interface HTMLTimeElement
interface HTMLTitleElement
interface HTMLTrackElement
interface HTMLUListElement
interface HTMLUnknownElement
*/
private "dom_element *" node;
private "struct html_content *" htmlc;
/* events through a single interface */
property unshared type EventHandler;
}
api finalise %{
@ -214,3 +291,250 @@ getter childElementCount %{
}
}
%}
getter EventHandler %{
JSLOG("propname[%d].name=\"%s\"",
tinyid,
jsclass_properties[tinyid].name);
%}
setter EventHandler %{
dom_string *event_type_dom;
JSLOG("propname[%d].name=\"%s\"",
tinyid,
jsclass_properties[tinyid].name);
switch (tinyid) {
case JSAPI_PROP_TINYID_onabort:
event_type_dom = corestring_dom_abort;
break;
case JSAPI_PROP_TINYID_onblur:
event_type_dom = corestring_dom_blur;
break;
case JSAPI_PROP_TINYID_oncancel:
event_type_dom = corestring_dom_cancel;
break;
case JSAPI_PROP_TINYID_oncanplay:
event_type_dom = corestring_dom_canplay;
break;
case JSAPI_PROP_TINYID_oncanplaythrough:
event_type_dom = corestring_dom_canplaythrough;
break;
case JSAPI_PROP_TINYID_onchange:
event_type_dom = corestring_dom_change;
break;
case JSAPI_PROP_TINYID_onclick:
event_type_dom = corestring_dom_click;
break;
case JSAPI_PROP_TINYID_onclose:
event_type_dom = corestring_dom_close;
break;
case JSAPI_PROP_TINYID_oncontextmenu:
event_type_dom = corestring_dom_contextmenu;
break;
case JSAPI_PROP_TINYID_oncuechange:
event_type_dom = corestring_dom_cuechange;
break;
case JSAPI_PROP_TINYID_ondblclick:
event_type_dom = corestring_dom_dblclick;
break;
case JSAPI_PROP_TINYID_ondrag:
event_type_dom = corestring_dom_drag;
break;
case JSAPI_PROP_TINYID_ondragend:
event_type_dom = corestring_dom_dragend;
break;
case JSAPI_PROP_TINYID_ondragenter:
event_type_dom = corestring_dom_dragenter;
break;
case JSAPI_PROP_TINYID_ondragleave:
event_type_dom = corestring_dom_dragleave;
break;
case JSAPI_PROP_TINYID_ondragover:
event_type_dom = corestring_dom_dragover;
break;
case JSAPI_PROP_TINYID_ondragstart:
event_type_dom = corestring_dom_dragstart;
break;
case JSAPI_PROP_TINYID_ondrop:
event_type_dom = corestring_dom_drop;
break;
case JSAPI_PROP_TINYID_ondurationchange:
event_type_dom = corestring_dom_durationchange;
break;
case JSAPI_PROP_TINYID_onemptied:
event_type_dom = corestring_dom_emptied;
break;
case JSAPI_PROP_TINYID_onended:
event_type_dom = corestring_dom_ended;
break;
case JSAPI_PROP_TINYID_onerror:
event_type_dom = corestring_dom_error;
break;
case JSAPI_PROP_TINYID_onfocus:
event_type_dom = corestring_dom_focus;
break;
case JSAPI_PROP_TINYID_oninput:
event_type_dom = corestring_dom_input;
break;
case JSAPI_PROP_TINYID_oninvalid:
event_type_dom = corestring_dom_invalid;
break;
case JSAPI_PROP_TINYID_onkeydown:
event_type_dom = corestring_dom_keydown;
break;
case JSAPI_PROP_TINYID_onkeypress:
event_type_dom = corestring_dom_keypress;
break;
case JSAPI_PROP_TINYID_onkeyup:
event_type_dom = corestring_dom_keyup;
break;
case JSAPI_PROP_TINYID_onload:
event_type_dom = corestring_dom_load;
break;
case JSAPI_PROP_TINYID_onloadeddata:
event_type_dom = corestring_dom_loadeddata;
break;
case JSAPI_PROP_TINYID_onloadedmetadata:
event_type_dom = corestring_dom_loadedmetadata;
break;
case JSAPI_PROP_TINYID_onloadstart:
event_type_dom = corestring_dom_loadstart;
break;
case JSAPI_PROP_TINYID_onmousedown:
event_type_dom = corestring_dom_mousedown;
break;
case JSAPI_PROP_TINYID_onmousemove:
event_type_dom = corestring_dom_mousemove;
break;
case JSAPI_PROP_TINYID_onmouseout:
event_type_dom = corestring_dom_mouseout;
break;
case JSAPI_PROP_TINYID_onmouseover:
event_type_dom = corestring_dom_mouseover;
break;
case JSAPI_PROP_TINYID_onmouseup:
event_type_dom = corestring_dom_mouseup;
break;
case JSAPI_PROP_TINYID_onmousewheel:
event_type_dom = corestring_dom_mousewheel;
break;
case JSAPI_PROP_TINYID_onpause:
event_type_dom = corestring_dom_pause;
break;
case JSAPI_PROP_TINYID_onplay:
event_type_dom = corestring_dom_play;
break;
case JSAPI_PROP_TINYID_onplaying:
event_type_dom = corestring_dom_playing;
break;
case JSAPI_PROP_TINYID_onprogress:
event_type_dom = corestring_dom_progress;
break;
case JSAPI_PROP_TINYID_onratechange:
event_type_dom = corestring_dom_ratechange;
break;
case JSAPI_PROP_TINYID_onreset:
event_type_dom = corestring_dom_reset;
break;
case JSAPI_PROP_TINYID_onscroll:
event_type_dom = corestring_dom_scroll;
break;
case JSAPI_PROP_TINYID_onseeked:
event_type_dom = corestring_dom_seeked;
break;
case JSAPI_PROP_TINYID_onseeking:
event_type_dom = corestring_dom_seeking;
break;
case JSAPI_PROP_TINYID_onselect:
event_type_dom = corestring_dom_select;
break;
case JSAPI_PROP_TINYID_onshow:
event_type_dom = corestring_dom_show;
break;
case JSAPI_PROP_TINYID_onstalled:
event_type_dom = corestring_dom_stalled;
break;
case JSAPI_PROP_TINYID_onsubmit:
event_type_dom = corestring_dom_submit;
break;
case JSAPI_PROP_TINYID_onsuspend:
event_type_dom = corestring_dom_suspend;
break;
case JSAPI_PROP_TINYID_ontimeupdate:
event_type_dom = corestring_dom_timeupdate;
break;
case JSAPI_PROP_TINYID_onvolumechange:
event_type_dom = corestring_dom_volumechange;
break;
case JSAPI_PROP_TINYID_onwaiting:
event_type_dom = corestring_dom_waiting;
break;
default:
JSLOG("called with unknown tinyid");
return JS_TRUE;
}
js_dom_event_add_listener((struct jscontext *)cx,
private->htmlc->document,
(dom_node *)private->node,
event_type_dom,
vp);
%}

View File

@ -32,19 +32,27 @@ binding location {
interface Location; /* Web IDL interface to generate */
private "struct browser_window *" bw;
private "nsurl *" url;
private "struct html_content *" htmlc;
property unshared href;
}
operation reload %{
browser_window_reload(private->bw, false);
browser_window_reload(private->htmlc->bw, false);
%}
getter href %{
char *url_s = NULL;
size_t url_l;
if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx,vp))) {
/* already created - return it */
return JS_TRUE;
}
nsurl_get(private->url, NSURL_COMPLETE, &url_s, &url_l);
if (url_s != NULL) {
jsret = JS_NewStringCopyN(cx, url_s, url_l);

View File

@ -1,7 +1,4 @@
/* Binding to generate NodeList interface
*
* The js_libdom (javascript to libdom) binding type is currently the
* only one implemented and this principly describes that binding.
*
* Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>
*
@ -32,12 +29,12 @@ preamble %{
webidlfile "dom.idl";
binding nodelist {
type js_libdom; /* the binding type */
type js_libdom; /* the binding type */
interface NodeList; /* The WebIDL interface to generate a binding for */
interface NodeList; /* The WebIDL interface to generate a binding for */
private "dom_nodelist *" nodelist;
private "struct html_content *" htmlc;
private "dom_nodelist *" nodelist;
private "struct html_content *" htmlc;
}
getter length %{

View File

@ -42,7 +42,6 @@ binding window {
internal "JSObject *" document;
internal "JSObject *" navigator;
internal "JSObject *" console;
internal "JSObject *" location;
property unshared type EventHandler;
}
@ -58,9 +57,6 @@ api mark %{
if (private->console != NULL) {
JSAPI_GCMARK(private->console);
}
if (private->location != NULL) {
JSAPI_GCMARK(private->location);
}
}
%}
@ -180,13 +176,6 @@ api new %{
return NULL;
}
private->location = jsapi_new_Location(cx, NULL, newobject, bw,
llcache_handle_get_url(private->htmlc->base.llcache));
if (private->location == NULL) {
free(private);
return NULL;
}
private->console = jsapi_new_Console(cx, NULL, newobject);
if (private->console == NULL) {
free(private);
@ -210,6 +199,48 @@ operation prompt %{
warn_user(message, NULL);
%}
/* boolean dispatchEvent(Event event); */
operation dispatchEvent %{
/* this implementation is unique to the window object as it is
* not a "real" dom node.
*/
/* caution, this must match the struct generated from event.bnd */
struct {
dom_event *event;
} *event_private;
dom_string *type_dom = NULL;
dom_exception exc;
jsval eventval = JSVAL_VOID;
jsval event_argv[1];
jsval event_rval;
event_private = JS_GetInstancePrivate(cx, event, &JSClass_Event, NULL);
if (event_private->event == NULL) {
/** @todo type error? */
jsret = JS_FALSE;
} else {
exc = dom_event_get_type(event_private->event, &type_dom);
if (exc == DOM_NO_ERR) {
if (dom_string_isequal(type_dom, corestring_dom_load)) {
JS_GetProperty(cx, JSAPI_THIS_OBJECT(cx, vp), "onload", &eventval);
}
if (!JSVAL_IS_VOID(eventval)) {
event_argv[0] = eventval;
jsret = JS_CallFunctionValue(cx, NULL, eventval, 1, event_argv, &event_rval);
}
}
}
%}
getter location %{
jsval loc;
JS_GetProperty(cx, private->document, "location", &loc);
jsret = JSVAL_TO_OBJECT(loc);
%}
getter window %{
jsret = obj;
%}
@ -218,56 +249,20 @@ getter self %{
jsret = obj;
%}
/* boolean dispatchEvent(Event event); */
operation dispatchEvent %{
/* this implementation is unique to the window object as it is
* not a "real" dom node.
*/
/* caution, this must match the struct generated from event.bnd */
if (event == JSVAL_VOID) {
jsret = JS_FALSE;
} else {
struct {
dom_event *event;
} *event_private;
dom_string *type_dom = NULL;
dom_exception exc;
jsval eventval = JSVAL_VOID;
jsval event_argv[1];
jsval event_rval;
event_private = JS_GetInstancePrivate(cx, event, &JSClass_Event, NULL);
if (event_private->event == NULL) {
/** @todo type error? */
jsret = JS_FALSE;
} else {
exc = dom_event_get_type(event_private->event, &type_dom);
if (exc == DOM_NO_ERR) {
if (dom_string_isequal(type_dom, corestring_dom_load)) {
JS_GetProperty(cx, JSAPI_THIS_OBJECT(cx, vp), "onload", &eventval);
}
if (eventval != JSVAL_VOID) {
event_argv[0] = eventval;
jsret = JS_CallFunctionValue(cx, NULL, eventval, 1, event_argv, &event_rval);
}
}
}
}
%}
getter EventHandler %{
/* this implementation is unique to the window object as it is
* not a dom node.
*/
JSLOG("propname[%d] %s %s", tinyid , jsclass_properties[tinyid].name, JS_GetTypeName(cx, JS_TypeOfValue(cx, tinyid_jsval)));
JSLOG("propname[%d]=\"%s\"",
tinyid,
jsclass_properties[tinyid].name);
%}
setter EventHandler %{
/* this implementation is unique to the window object as it is
* not a dom node.
*/
JSLOG("propname[%d] %s %s", tinyid, jsclass_properties[tinyid].name, JS_GetTypeName(cx, JS_TypeOfValue(cx, tinyid_jsval)));
JSLOG("propname[%d]=\"%s\"",
tinyid,
jsclass_properties[tinyid].name);
%}

View File

@ -54,7 +54,7 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
return true;
}
bool js_fire_event(jscontext *ctx, const char *type, void *target)
bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, struct dom_node *target)
{
return true;
}

13
monkey/Makefile.defaults Normal file
View File

@ -0,0 +1,13 @@
# ----------------------------------------------------------------------------
# Monkey-specific options
# ----------------------------------------------------------------------------
# How did I get mixed up with this fucking monkey anyhow?
NETSURF_MONKEY_RESOURCES := $(PREFIX)/share/netsurf/
NETSURF_MONKEY_BIN := $(PREFIX)/bin/
NETSURF_USE_RSVG := NO
NETSURF_USE_NSSVG := NO
NETSURF_USE_ROSPRITE := NO
NETSURF_USE_HARU_PDF := NO
NETSURF_USE_LIBICONV_PLUG := NO
CFLAGS += -O2

View File

@ -22,18 +22,20 @@ NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
# add a line similar to below for each optional pkg-configed lib here
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG ))
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))
# no pkg-config for this library
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp)))
MONKEYCFLAGS := -std=c99 -Dmonkey -Dnsmonkey \
WARNFLAGS += -Werror
MONKEYCFLAGS := -std=c99 -Dmonkey -Dnsmonkey \
-D_BSD_SOURCE \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
@ -45,18 +47,19 @@ $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp)))
$(shell $(PKG_CONFIG) --cflags openssl) \
$(shell xml2-config --cflags)
MONKEYLDFLAGS := -lm $(shell $(PKG_CONFIG) --cflags --libs glib-2.0 lcms)
MONKEYLDFLAGS := -lm $(shell $(PKG_CONFIG) --cflags --libs glib-2.0 lcms)
CFLAGS += $(MONKEYCFLAGS) -Werror -Wno-unused-but-set-variable
LDFLAGS += $(MONKEYLDFLAGS)
# ---------------------------------------------------------------------------
# Windows flag setup
# ---------------------------------------------------------------------------
CFLAGS += $(MONKEYCFLAGS)
LDFLAGS += $(MONKEYLDFLAGS)
ifeq ($(HOST),Windows_NT)
CFLAGS += -U__STRICT_ANSI__
endif
# ---------------------------------------------------------------------------
# Windows flag setup
# ---------------------------------------------------------------------------
ifeq ($(HOST),Windows_NT)
CFLAGS += -U__STRICT_ANSI__
endif
# ----------------------------------------------------------------------------
# Source file setup

View File

@ -92,9 +92,14 @@ static int box_talloc_destructor(struct box *b)
if (b->href != NULL)
nsurl_unref(b->href);
if (b->id != NULL)
if (b->id != NULL) {
lwc_string_unref(b->id);
}
if (b->node != NULL) {
dom_node_unref(b->node);
}
return 0;
}
@ -172,6 +177,7 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
box->object = NULL;
box->object_params = NULL;
box->iframe = NULL;
box->node = NULL;
return box;
}

View File

@ -265,6 +265,8 @@ struct box {
/** Iframe's browser_window, or NULL if none */
struct browser_window *iframe;
struct dom_node *node; /**< DOM node that generated this box or NULL */
};
/** Table column data. */

View File

@ -994,12 +994,15 @@ bool box_construct_element(struct box_construct_ctx *ctx,
return true;
}
/* Attach box to DOM node */
/* Attach DOM node to box */
err = dom_node_set_user_data(ctx->n, kstr_box_key, box, NULL,
(void *) &old_box);
if (err != DOM_NO_ERR)
return false;
/* Attach box to DOM node */
box->node = dom_node_ref(ctx->n);
if (props.inline_container == NULL &&
(box->type == BOX_INLINE ||
box->type == BOX_BR ||

View File

@ -43,6 +43,7 @@
#include "render/imagemap.h"
#include "render/layout.h"
#include "render/search.h"
#include "javascript/js.h"
#include "utils/corestrings.h"
#include "utils/http.h"
#include "utils/libdom.h"
@ -111,60 +112,6 @@ static nserror css_error_to_nserror(css_error error)
return NSERROR_CSS;
}
static nserror
dom_hubbub_error_to_nserror(dom_hubbub_error error)
{
switch (error) {
/* HUBBUB_REPROCESS is not handled here because it can
* never occur outside the hubbub treebuilder
*/
case DOM_HUBBUB_OK:
/* parsed ok */
return NSERROR_OK;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED):
/* hubbub input paused */
return NSERROR_OK;
case DOM_HUBBUB_NOMEM:
/* out of memory error from DOM */
return NSERROR_NOMEM;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_ENCODINGCHANGE):
/* encoding changed */
return NSERROR_ENCODING_CHANGE;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NOMEM):
/* out of memory error from parser */
return NSERROR_NOMEM;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADPARM):
return NSERROR_BAD_PARAMETER;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_INVALID):
return NSERROR_INVALID;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_FILENOTFOUND):
return NSERROR_NOT_FOUND;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NEEDDATA):
return NSERROR_NEED_DATA;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADENCODING):
return NSERROR_BAD_ENCODING;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN):
/* currently only generated by the libdom hubbub binding */
return NSERROR_DOM;
default:
/* unknown error */
/** @todo better error handling and reporting */
return NSERROR_UNKNOWN;
}
return NSERROR_UNKNOWN;
}
static void html_destroy_objects(html_content *html)
{
@ -335,7 +282,7 @@ void html_finish_conversion(html_content *c)
* object, but with its target set to the Document object (and
* the currentTarget set to the Window object)
*/
js_fire_event(c->jscontext, "load", NULL);
js_fire_event(c->jscontext, "load", c->document, NULL);
/* convert dom tree to box tree */
LOG(("DOM to box (%p)", c));
@ -370,6 +317,8 @@ html_create_html_data(html_content *c, const http_parameter *params)
{
lwc_string *charset;
nserror nerror;
dom_hubbub_parser_params parse_params;
dom_hubbub_error error;
c->parser = NULL;
c->document = NULL;
@ -423,36 +372,38 @@ html_create_html_data(html_content *c, const http_parameter *params)
}
/* Create the parser binding */
c->parser = dom_hubbub_parser_create(c->encoding,
true,
nsoption_bool(enable_javascript),
NULL,
html_process_script,
c,
&c->document);
if ((c->parser == NULL) && (c->encoding != NULL)) {
parse_params.enc = c->encoding;
parse_params.fix_enc = true;
parse_params.enable_script = nsoption_bool(enable_javascript);
parse_params.msg = NULL;
parse_params.script = html_process_script;
parse_params.ctx = c;
parse_params.daf = NULL;
error = dom_hubbub_parser_create(&parse_params,
&c->parser,
&c->document);
if ((error != DOM_HUBBUB_OK) && (c->encoding != NULL)) {
/* Ok, we don't support the declared encoding. Bailing out
* isn't exactly user-friendly, so fall back to autodetect */
free(c->encoding);
c->encoding = NULL;
c->parser = dom_hubbub_parser_create(c->encoding,
true,
nsoption_bool(enable_javascript),
NULL,
html_process_script,
c,
&c->document);
parse_params.enc = c->encoding;
error = dom_hubbub_parser_create(&parse_params,
&c->parser,
&c->document);
}
if (c->parser == NULL) {
if (error != DOM_HUBBUB_OK) {
nsurl_unref(c->base_url);
c->base_url = NULL;
lwc_string_unref(c->universal);
c->universal = NULL;
return NSERROR_NOMEM;
return libdom_hubbub_error_to_nserror(error);
}
return NSERROR_OK;
@ -509,6 +460,7 @@ html_process_encoding_change(struct content *c,
unsigned int size)
{
html_content *html = (html_content *) c;
dom_hubbub_parser_params parse_params;
dom_hubbub_error error;
const char *encoding;
const char *source_data;
@ -538,15 +490,19 @@ html_process_encoding_change(struct content *c,
dom_node_unref(html->document);
}
parse_params.enc = html->encoding;
parse_params.fix_enc = true;
parse_params.enable_script = nsoption_bool(enable_javascript);
parse_params.msg = NULL;
parse_params.script = html_process_script;
parse_params.ctx = html;
parse_params.daf = NULL;
/* Create new binding, using the new encoding */
html->parser = dom_hubbub_parser_create(html->encoding,
true,
nsoption_bool(enable_javascript),
NULL,
html_process_script,
html,
&html->document);
if (html->parser == NULL) {
error = dom_hubbub_parser_create(&parse_params,
&html->parser,
&html->document);
if (error != DOM_HUBBUB_OK) {
/* Ok, we don't support the declared encoding. Bailing out
* isn't exactly user-friendly, so fall back to Windows-1252 */
free(html->encoding);
@ -554,21 +510,14 @@ html_process_encoding_change(struct content *c,
if (html->encoding == NULL) {
return NSERROR_NOMEM;
}
parse_params.enc = html->encoding;
html->parser = dom_hubbub_parser_create(html->encoding,
true,
nsoption_bool(enable_javascript),
NULL,
html_process_script,
html,
&html->document);
error = dom_hubbub_parser_create(&parse_params,
&html->parser,
&html->document);
if (html->parser == NULL) {
/** @todo add a message callback function and pass the
* parser errors back instead of everything being
* OOM
*/
return NSERROR_NOMEM;
if (error != DOM_HUBBUB_OK) {
return libdom_hubbub_error_to_nserror(error);
}
}
@ -583,7 +532,7 @@ html_process_encoding_change(struct content *c,
(const uint8_t *)source_data,
source_size);
return dom_hubbub_error_to_nserror(error);
return libdom_hubbub_error_to_nserror(error);
}
@ -602,7 +551,7 @@ html_process_data(struct content *c, const char *data, unsigned int size)
(const uint8_t *) data,
size);
err = dom_hubbub_error_to_nserror(dom_ret);
err = libdom_hubbub_error_to_nserror(dom_ret);
/* deal with encoding change */
if (err == NSERROR_ENCODING_CHANGE) {
@ -1992,7 +1941,7 @@ html_begin_conversion(html_content *htmlc)
LOG(("Parsing failed"));
content_broadcast_errorcode(&htmlc->base,
dom_hubbub_error_to_nserror(error));
libdom_hubbub_error_to_nserror(error));
return false;
}

View File

@ -42,6 +42,7 @@
#include "render/html_internal.h"
#include "render/imagemap.h"
#include "render/textinput.h"
#include "javascript/js.h"
#include "utils/messages.h"
#include "utils/utils.h"
@ -323,6 +324,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
int padding_left, padding_right, padding_top, padding_bottom;
browser_drag_type drag_type = browser_window_get_drag_type(bw);
union content_msg_data msg_data;
struct dom_node *node = NULL;
if (drag_type != DRAGGING_NONE && !mouse &&
html->visible_select_menu != NULL) {
@ -389,7 +391,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
/* search the box tree for a link, imagemap, form control, or
* box with scrollbars */
* box with scrollbars
*/
box = html->layout;
@ -397,13 +400,48 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
box_x = box->margin[LEFT];
box_y = box->margin[TOP];
while ((next_box = box_at_point(box, x, y, &box_x, &box_y)) !=
NULL) {
/* descend through visible boxes setting more specific values for:
* box - deepest box at point
* html_object_box - html object
* html_object_pos_x - html object
* html_object_pos_y - html object
* object - non html object
* iframe - iframe
* url - href or imagemap
* target - href or imagemap or gadget
* url_box - href or imagemap
* imagemap - imagemap
* gadget - gadget
* gadget_box - gadget
* gadget_box_x - gadget
* gadget_box_y - gadget
* title - title
* pointer
*
* drag_candidate - first box with scroll
* padding_left - box with scroll
* padding_right
* padding_top
* padding_bottom
* scrollbar - inside padding box stops decent
* scroll_mouse_x - inside padding box stops decent
* scroll_mouse_y - inside padding box stops decent
*
* text_box - text box
* text_box_x - text_box
*/
while ((next_box = box_at_point(box, x, y, &box_x, &box_y)) != NULL) {
box = next_box;
if (box->style && css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)
if ((box->style != NULL) &&
(css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)) {
continue;
}
if (box->node != NULL) {
node = box->node;
}
if (box->object) {
if (content_get_type(box->object) == CONTENT_HTML) {
@ -415,8 +453,9 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
}
if (box->iframe)
if (box->iframe) {
iframe = box->iframe;
}
if (box->href) {
url = box->href;
@ -442,16 +481,19 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
target = gadget->form->target;
}
if (box->title)
if (box->title) {
title = box->title;
}
pointer = get_pointer_shape(box, false);
if ((box->scroll_x != NULL || box->scroll_y != NULL) &&
drag_candidate == NULL)
drag_candidate = box;
if (box->scroll_y != NULL || box->scroll_x != NULL) {
if ((box->scroll_x != NULL) ||
(box->scroll_y != NULL)) {
if (drag_candidate == NULL) {
drag_candidate = box;
}
padding_left = box_x +
scrollbar_get_offset(box->scroll_x);
padding_right = padding_left + box->padding[LEFT] +
@ -461,12 +503,14 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
padding_bottom = padding_top + box->padding[TOP] +
box->height + box->padding[BOTTOM];
if (x > padding_left && x < padding_right &&
y > padding_top && y < padding_bottom) {
if ((x > padding_left) &&
(x < padding_right) &&
(y > padding_top) &&
(y < padding_bottom)) {
/* mouse inside padding box */
if (box->scroll_y != NULL && x > padding_right -
SCROLLBAR_WIDTH) {
if ((box->scroll_y != NULL) &&
(x > (padding_right - SCROLLBAR_WIDTH))) {
/* mouse above vertical box scroll */
scrollbar = box->scroll_y;
@ -475,9 +519,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
scroll_mouse_y = y - padding_top;
break;
} else if (box->scroll_x != NULL &&
y > padding_bottom -
SCROLLBAR_WIDTH) {
} else if ((box->scroll_x != NULL) &&
(y > (padding_bottom - SCROLLBAR_WIDTH))) {
/* mouse above horizontal box scroll */
scrollbar = box->scroll_x;
@ -842,6 +885,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
}
/* fire dom click event */
if ((mouse & BROWSER_MOUSE_CLICK_1) ||
(mouse & BROWSER_MOUSE_CLICK_2)) {
js_fire_event(html->jscontext, "click", html->document, node);
}
/* deferred actions that can cause this browser_window to be destroyed
* and must therefore be done after set_status/pointer
*/

View File

@ -1207,6 +1207,19 @@ fr.all.HotlistFeatureRequest:Demandes de nouvelles fonctions de Netsurf
it.all.HotlistFeatureRequest:Suggerimenti per NetSurf
nl.all.HotlistFeatureRequest:NetSurf feature requests
# Default (Amiga) hotlist folder names
#
en.ami.HotlistMenu:Hotlist menu
de.ami.HotlistMenu:Hotlist menu
fr.ami.HotlistMenu:Hotlist menu
it.ami.HotlistMenu:Menu segnalibri
nl.ami.HotlistMenu:Hotlist menu
en.ami.HotlistToolbar:Hotlist toolbar
de.ami.HotlistToolbar:Hotlist toolbar
fr.ami.HotlistToolbar:Hotlist toolbar
it.ami.HotlistToolbar:Barra segnalibri
nl.ami.HotlistToolbar:Hotlist toolbar
# Global history user interface tokens
# ====================================
@ -2326,62 +2339,62 @@ nl.all.SelectMenu:Select
en.all.DrawTitle:%s (Draw image %lux%lu pixels)
de.all.DrawTitle:%s (Draw Bild %lux%lu pixels)
fr.all.DrawTitle:%s (Image Draw %lux%lu pixels)
it.all.DrawTitle:%s (Immagine Draw %lux%lu pixels)
it.all.DrawTitle:%s (Immagine Draw %lux%lu pixel)
nl.all.DrawTitle:%s (Draw image %lux%lu pixels)
en.all.GIFTitle:%s (GIF image %lux%lu pixels)
de.all.GIFTitle:%s (GIF Bild %lux%lu pixels)
fr.all.GIFTitle:%s (Image GIF %lux%lu pixels)
it.all.GIFTitle:%s (Immagine GIF %lux%lu pixels)
it.all.GIFTitle:%s (Immagine GIF %lux%lu pixel)
nl.all.GIFTitle:%s (GIF image %lux%lu pixels)
en.all.BMPTitle:%s (BMP image %lux%lu pixels)
de.all.BMPTitle:%s (BMP Bild %lux%lu pixels)
fr.all.BMPTitle:%s (Image BMP %lux%lu pixels)
it.all.BMPTitle:%s (Immagine BMP %lux%lu pixels)
it.all.BMPTitle:%s (Immagine BMP %lux%lu pixel)
nl.all.BMPTitle:%s (BMP image %lux%lu pixels)
en.all.ICOTitle:%s (ICO image %lux%lu pixels)
de.all.ICOTitle:%s (ICO Bild %lux%lu pixels)
fr.all.ICOTitle:%s (Image BMP %lux%lu pixels)
it.all.ICOTitle:%s (Immagine ICO %lux%lu pixels)
it.all.ICOTitle:%s (Immagine ICO %lux%lu pixel)
nl.all.ICOTitle:%s (ICO image %lux%lu pixels)
en.all.JPEGTitle:%s (JPEG image %lux%lu pixels)
de.all.JPEGTitle:%s (JPEG Bild %lux%lu pixels)
fr.all.JPEGTitle:%s (Image JPEG %lux%lu pixels)
it.all.JPEGTitle:%s (Immagine JPEG %lux%lu pixels)
it.all.JPEGTitle:%s (Immagine JPEG %lux%lu pixel)
nl.all.JPEGTitle:%s (JPEG image %lux%lu pixels)
en.all.PNGTitle:%s (PNG image %lux%lu pixels)
de.all.PNGTitle:%s (PNG Bild %lux%lu pixels)
fr.all.PNGTitle:%s (Image PNG %lux%lu pixels)
it.all.PNGTitle:%s (Immagine PNG %lux%lu pixels)
it.all.PNGTitle:%s (Immagine PNG %lux%lu pixel)
nl.all.PNGTitle:%s (PNG image %lux%lu pixels)
en.all.JNGTitle:%s (JNG image %lux%lu pixels)
de.all.JNGTitle:%s (JNG Bild %lux%lu pixels)
fr.all.JNGTitle:%s (Image JNG %lux%lu pixels)
it.all.JNGTitle:%s (Immagine JNG %lux%lu pixels)
it.all.JNGTitle:%s (Immagine JNG %lux%lu pixel)
nl.all.JNGTitle:%s (JNG image %lux%lu pixels)
en.all.MNGTitle:%s (MNG image %lux%lu pixels)
de.all.MNGTitle:%s (MNG Bild %lux%lu pixels)
fr.all.MNGTitle:%s (Image MNG %lux%lu pixels)
it.all.MNGTitle:%s (Immagine MNG %lux%lu pixels)
it.all.MNGTitle:%s (Immagine MNG %lux%lu pixel)
nl.all.MNGTitle:%s (MNG image %lux%lu pixels)
en.all.WebPTitle:%s (WebP image %lux%lu pixels)
de.all.WebPTitle:%s (WebP Bild %lux%lu pixels)
fr.all.WebPTitle:%s (Image WebP %lux%lu pixels)
it.all.WebPTitle:%s (Immagine WebP %lux%lu pixels)
it.all.WebPTitle:%s (Immagine WebP %lux%lu pixel)
nl.all.WebPTitle:%s (WebP image %lux%lu pixels)
en.all.SpriteTitle:%s (Sprite image %lux%lu pixels)
de.all.SpriteTitle:%s (Sprite Bild %lux%lu pixels)
fr.all.SpriteTitle:%s (Image Sprite %lux%lu pixels)
it.all.SpriteTitle:%s (Immagine Sprite %lux%lu pixels)
it.all.SpriteTitle:%s (Immagine Sprite %lux%lu pixel)
nl.all.SpriteTitle:%s (Sprite image %lux%lu pixels)
en.all.ArtWorksTitle:%s (ArtWorks image %lux%lu pixels)
de.all.ArtWorksTitle:%s (ArtWorks Bild %lux%lu pixels)
fr.all.ArtWorksTitle:%s (Image ArtWorks %lux%lu pixels)
it.all.ArtWorksTitle:%s (Immagine ArtWorks %lux%lu pixels)
it.all.ArtWorksTitle:%s (Immagine ArtWorks %lux%lu pixel)
nl.all.ArtWorksTitle:%s (ArtWorks image %lux%lu pixels)
en.ami.DataTypesTitle:%s (%s image %lux%lu pixels)
de.ami.DataTypesTitle:%s (%s Bild %lux%lu pixels)
fr.ami.DataTypesTitle:%s (Image %s %lux%lu pixels)
it.ami.DataTypesTitle:%s (Immagine %s %lux%lu pixels)
it.ami.DataTypesTitle:%s (Immagine %s %lux%lu pixel)
nl.ami.DataTypesTitle:%s (%s image %lux%lu pixels)
# HTML page character set
@ -2662,6 +2675,22 @@ de.ami.CompError:Nicht zu öffnen
fr.ami.CompError:Unable to open
it.ami.CompError:Impossibile aprire
nl.ami.CompError:Unable to open
en.ami.MultiTabClose:Are you sure you want to close multiple tabs?
de.ami.MultiTabClose:Are you sure you want to close multiple tabs?
fr.ami.MultiTabClose:Are you sure you want to close multiple tabs?
it.ami.MultiTabClose:Sono rimaste aperte più schede, sei sicuro di voler uscire da NetSurf?
nl.ami.MultiTabClose:Are you sure you want to close multiple tabs?
en.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit. NetSurf will quit in 5 seconds unless this shutdown is aborted.
de.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit. NetSurf will quit in 5 seconds unless this shutdown is aborted.
fr.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit. NetSurf will quit in 5 seconds unless this shutdown is aborted.
it.ami.TCPIPShutdown:Lo stack TCP/IP ha dato segnale di essere in procinto di arresto, NetSurf verrà chiuso. NetSurf si chiuderà entro 5 secondi a meno che lo shutdown non venga interrotto.
nl.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit. NetSurf will quit in 5 seconds unless this shutdown is aborted.
en.ami.AbortShutdown:Abort shutdown
de.ami.AbortShutdown:Abort shutdown
fr.ami.AbortShutdown:Abort shutdown
it.ami.AbortShutdown:Interrompi lo shutdown
nl.ami.AbortShutdown:Abort shutdown
# Queries
# =======
@ -5213,11 +5242,11 @@ de.all.Scripting:Scripting
fr.all.Scripting:Scripting
it.all.Scripting:Scripting
nl.all.Scripting:Scripting
en.all.EnableJS:Enable Javascript
de.all.EnableJS:Enable Javascript
fr.all.EnableJS:Enable Javascript
it.all.EnableJS:Attiva Javascript
nl.all.EnableJS:Enable Javascript
en.all.EnableJS:Enable JavaScript
de.all.EnableJS:Enable JavaScript
fr.all.EnableJS:Enable JavaScript
it.all.EnableJS:Attiva JavaScript
nl.all.EnableJS:Enable JavaScript
en.all.Miscellaneous:Miscellaneous
de.all.Miscellaneous:Verschiedenes
fr.all.Miscellaneous:Miscellaneous
@ -5267,6 +5296,11 @@ de.ami.ScreenPublic:Public Screen
fr.ami.ScreenPublic:Public screen
it.ami.ScreenPublic:Schermo pubblico
nl.ami.ScreenPublic:Public screen
en.ami.SimpleRefresh:Simple refresh
de.ami.SimpleRefresh:Simple refresh
fr.ami.SimpleRefresh:Simple refresh
it.ami.SimpleRefresh:Refresh semplice
nl.ami.SimpleRefresh:Simple refresh
en.all.Theme:Theme
de.all.Theme:Thema
fr.all.Theme:Theme
@ -5335,6 +5369,26 @@ de.all.ScaleQuality:Skalieren hoher Qualität
fr.all.ScaleQuality:Higher quality scaling
it.all.ScaleQuality:Massima qualità di visualizzazione
nl.all.ScaleQuality:Higher quality scaling
en.ami.DitherQuality:Dither quality (<= 8-bit modes only)
de.ami.DitherQuality:Dither quality (<= 8-bit modes only)
fr.ami.DitherQuality:Dither quality (<= 8-bit modes only)
it.ami.DitherQuality:Qualità dither (<= solo modi a 8-bit)
nl.ami.DitherQuality:Dither quality (<= 8-bit modes only)
en.ami.Low:Low
de.ami.Low:Low
fr.ami.Low:Low
it.ami.Low:Bassa
nl.ami.Low:Low
en.ami.Medium:Medium
de.ami.Medium:Medium
fr.ami.Medium:Medium
it.ami.Medium:Media
nl.ami.Medium:Medium
en.ami.High:High
de.ami.High:High
fr.ami.High:High
it.ami.High:Alta
nl.ami.High:High
en.all.Animations:Animations
de.all.Animations:Animationen
fr.all.Animations:Animations
@ -5446,6 +5500,11 @@ de.all.Pt:pt
fr.all.Pt:pt
it.all.Pt:pt
nl.all.Pt:pt
en.ami.FontAntialiasing:Use anti-aliasing (when possible)
de.ami.FontAntialiasing:Use anti-aliasing (when possible)
fr.ami.FontAntialiasing:Use anti-aliasing (when possible)
it.ami.FontAntialiasing:Usa anti-aliasing (quando possibile)
nl.ami.FontAntialiasing:Use anti-aliasing (when possible)
# Font scanning
en.ami.FontScanning:Scanning fonts...
@ -5483,6 +5542,45 @@ fr.all.Duration:Duration
it.all.Duration:Durata
nl.all.Duration:Duration
# Tabs
#
en.ami.Tabs:Tabs
de.ami.Tabs:Tabs
fr.ami.Tabs:Tabs
it.ami.Tabs:Schede
nl.ami.Tabs:Tabs
en.all.TabbedBrowsing:Tabbed browsing
de.all.TabbedBrowsing:Registernavigation (Tabs)
fr.all.TabbedBrowsing:Tabbed browsing
it.all.TabbedBrowsing:Navigazione a schede
nl.all.TabbedBrowsing:Tabbed browsing
en.all.TabActive:Open new tabs in background
de.all.TabActive:Neuen Tab im Hintergrund öffnen
fr.all.TabActive:Open new tabs in background
it.all.TabActive:Apri le nuove schede in sottofondo
nl.all.TabActive:Open new tabs in background
en.all.TabMiddle:Middle mouse button opens tabs
de.all.TabMiddle:Mittlere Maustaste öffnet Tab
fr.all.TabMiddle:Middle mouse button opens tabs
it.all.TabMiddle:Usa tasto centrale del mouse per aprire le schede
nl.all.TabMiddle:Middle mouse button opens tabs
en.all.TabLast:Open new tabs after all existing tabs
de.all.TabLast:Open new tabs after all existing tabs
fr.all.TabLast:Open new tabs after all existing tabs
it.all.TabLast:Apri le nuove schede dopo quella corrente
nl.all.TabLast:Open new tabs after all existing tabs
en.ami.TabClose:Warn when closing multiple tabs
de.ami.TabClose:Warn when closing multiple tabs
fr.ami.TabClose:Warn when closing multiple tabs
it.ami.TabClose:Avvisa quando si chiudono più schede
nl.ami.TabClose:Warn when closing multiple tabs
en.ami.TabAlways:Always show tabs
de.ami.TabAlways:Always show tabs
fr.ami.TabAlways:Always show tabs
it.ami.TabAlways:Mostra sempre la barra delle schede
nl.ami.TabAlways:Always show tabs
# Advanced
#
@ -5501,26 +5599,6 @@ de.all.DownloadDir:Downloadverzeichnis
fr.all.DownloadDir:Initial download location
it.all.DownloadDir:Percorso predefinito
nl.all.DownloadDir:Initial download location
en.all.TabbedBrowsing:Tabbed browsing
de.all.TabbedBrowsing:Registernavigation (Tabs)
fr.all.TabbedBrowsing:Tabbed browsing
it.all.TabbedBrowsing:Navigazione a schede
nl.all.TabbedBrowsing:Tabbed browsing
en.all.TabActive:Open new tabs in background
de.all.TabActive:Neuen Tab im Hintergrund öffnen
fr.all.TabActive:Open new tabs in background
it.all.TabActive:Apri le nuove schede in sottofondo
nl.all.TabActive:Open new tabs in background
en.all.TabMiddle:Middle mouse button opens tabs
de.all.TabMiddle:Mittlere Maustaste öffnet Tab
fr.all.TabMiddle:Middle mouse button opens tabs
it.all.TabMiddle:Tasto centrale per l'apertura delle schede
nl.all.TabMiddle:Middle mouse button opens tabs
en.all.TabLast:Open new tabs after all existing tabs
de.all.TabLast:Open new tabs after all existing tabs
fr.all.TabLast:Open new tabs after all existing tabs
it.all.TabLast:Apri le nuove schede dopo quella corrente
nl.all.TabLast:Open new tabs after all existing tabs
en.all.DownloadNotify:Notify on completion
de.all.DownloadNotify:Downloadende melden
fr.all.DownloadNotify:Notify on completion

31
riscos/Makefile.defaults Normal file
View File

@ -0,0 +1,31 @@
# ----------------------------------------------------------------------------
# RISC OS-specific options
# ----------------------------------------------------------------------------
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO
NETSURF_USE_NSSVG := YES
# Enable NetSurf's support for displaying RISC OS Draw files
# Valid options: YES, NO
NETSURF_USE_DRAW := YES
# Enable NetSurf's support for displaying RISC OS Sprites
# Valid options: YES, NO
NETSURF_USE_SPRITE := YES
# Enable NetSurf's use of AWRender for displaying ArtWorks files
# Valid options: YES, NO
NETSURF_USE_ARTWORKS := YES
# Enable NetSurf's support for the Acorn plugin protocol
# Valid options: YES, NO
NETSURF_USE_PLUGINS := NO
# Enable NetSurf's use of pencil for Drawfile export
# Valid options: YES, NO
NETSURF_USE_DRAW_EXPORT := YES
# Optimisation levels
CFLAGS += -O2

View File

@ -28,9 +28,13 @@ else
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG ))
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))
endif
TPD_RISCOS = $(foreach TPL,$(notdir $(TPL_RISCOS)), \

View File

@ -35,6 +35,7 @@
#define CONTENT_DEFAULT_BUTTON 8
#define CONTENT_CANCEL_BUTTON 9
#define CONTENT_OK_BUTTON 10
#define CONTENT_NO_JAVASCRIPT 11
static void ro_gui_options_content_default(wimp_pointer *pointer);
static bool ro_gui_options_content_ok(wimp_w w);
@ -50,12 +51,15 @@ bool ro_gui_options_content_initialise(wimp_w w)
nsoption_bool(no_plugins));
ro_gui_set_icon_selected_state(w, CONTENT_TARGET_BLANK,
nsoption_bool(target_blank));
ro_gui_set_icon_selected_state(w, CONTENT_NO_JAVASCRIPT,
!nsoption_bool(enable_javascript));
/* initialise all functions for a newly created window */
ro_gui_wimp_event_register_checkbox(w, CONTENT_BLOCK_ADVERTISEMENTS);
ro_gui_wimp_event_register_checkbox(w, CONTENT_BLOCK_POPUPS);
ro_gui_wimp_event_register_checkbox(w, CONTENT_NO_PLUGINS);
ro_gui_wimp_event_register_checkbox(w, CONTENT_TARGET_BLANK);
ro_gui_wimp_event_register_checkbox(w, CONTENT_NO_JAVASCRIPT);
ro_gui_wimp_event_register_button(w, CONTENT_DEFAULT_BUTTON,
ro_gui_options_content_default);
ro_gui_wimp_event_register_cancel(w, CONTENT_CANCEL_BUTTON);
@ -78,6 +82,8 @@ void ro_gui_options_content_default(wimp_pointer *pointer)
false);
ro_gui_set_icon_selected_state(pointer->w, CONTENT_TARGET_BLANK,
true);
ro_gui_set_icon_selected_state(pointer->w, CONTENT_NO_JAVASCRIPT,
false);
}
bool ro_gui_options_content_ok(wimp_w w)
@ -93,6 +99,9 @@ bool ro_gui_options_content_ok(wimp_w w)
nsoption_set_bool(target_blank,
ro_gui_get_icon_selected_state(w, CONTENT_TARGET_BLANK));
nsoption_set_bool(enable_javascript,
!ro_gui_get_icon_selected_state(w, CONTENT_NO_JAVASCRIPT));
ro_gui_save_options();
return true;
}

View File

@ -3794,7 +3794,7 @@ wimp_window {
wimp_window {
template_name:"con_content"
visible:236,800,876,1252
visible:1404,424,2044,924
xscroll:0
yscroll:0
next:wimp_TOP
@ -3807,7 +3807,7 @@ wimp_window {
scroll_inner:wimp_COLOUR_VERY_LIGHT_GREY
highlight_bg:wimp_COLOUR_CREAM
extra_flags:
extent:0,-452,640,0
extent:0,-500,640,0
title_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | 0x27000000
work_flags:
sprite_area:&1
@ -3815,7 +3815,7 @@ wimp_window {
ymin:452
text_only:"Content"
wimp_icon {
extent:16,-220,624,-24
extent:16,-272,624,-24
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3855,7 +3855,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:32,-204,496,-160
extent:32,-256,496,-212
#ifdef WITH_PLUGIN
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
#else
@ -3869,7 +3869,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:16,-340,624,-248
extent:16,-384,624,-292
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3879,7 +3879,7 @@ wimp_window {
text.validation:"R4"
}
wimp_icon {
extent:32,-276,492,-232
extent:32,-320,492,-276
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3889,7 +3889,7 @@ wimp_window {
text_and_sprite.validation:""
}
wimp_icon {
extent:32,-324,612,-280
extent:32,-368,612,-324
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3899,7 +3899,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:24,-424,188,-372
extent:24,-468,188,-416
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3909,7 +3909,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:256,-424,420,-372
extent:256,-468,420,-416
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3919,7 +3919,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:436,-432,620,-364
extent:436,-476,620,-408
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3928,4 +3928,14 @@ wimp_window {
text.size:4
text.validation:"R6,3"
}
wimp_icon {
extent:32,-204,376,-160
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
icon_bg:wimp_COLOUR_VERY_LIGHT_GREY
text_and_sprite.text:"Disable JavaScript"
text_and_sprite.size:19
text_and_sprite.validation:"Soptoff,opton"
}
}

View File

@ -3386,7 +3386,7 @@ wimp_window {
wimp_window {
template_name:"con_content"
visible:1248,902,1912,1354
visible:1248,854,1912,1354
xscroll:0
yscroll:0
next:wimp_TOP
@ -3399,7 +3399,7 @@ wimp_window {
scroll_inner:wimp_COLOUR_VERY_LIGHT_GREY
highlight_bg:wimp_COLOUR_CREAM
extra_flags:
extent:0,-452,664,0
extent:0,-500,664,0
title_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | 0x27000000
work_flags:
sprite_area:&1
@ -3407,7 +3407,7 @@ wimp_window {
ymin:452
text_only:"Content"
wimp_icon {
extent:16,-220,644,-24
extent:16,-272,644,-24
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3447,7 +3447,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:32,-204,344,-160
extent:32,-256,344,-212
#ifdef WITH_PLUGIN
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
#else
@ -3461,7 +3461,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:16,-340,644,-248
extent:16,-384,644,-292
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3471,7 +3471,7 @@ wimp_window {
text.validation:"R4"
}
wimp_icon {
extent:32,-276,492,-232
extent:32,-320,492,-276
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3481,7 +3481,7 @@ wimp_window {
text_and_sprite.validation:""
}
wimp_icon {
extent:32,-324,632,-280
extent:32,-368,632,-324
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3491,7 +3491,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:24,-424,188,-372
extent:24,-468,188,-416
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3501,7 +3501,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:280,-424,444,-372
extent:280,-468,444,-416
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3511,7 +3511,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:460,-432,644,-364
extent:460,-476,644,-408
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3520,6 +3520,16 @@ wimp_window {
text.size:*
text.validation:"R6,3"
}
wimp_icon {
extent:32,-204,376,-160
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
icon_bg:wimp_COLOUR_VERY_LIGHT_GREY
text_and_sprite.text:"Disable JavaScript"
text_and_sprite.size:19
text_and_sprite.validation:"Soptoff,opton"
}
}
wimp_window {

View File

@ -3020,7 +3020,7 @@ wimp_window {
wimp_window {
template_name:"con_content"
visible:598,888,1338,1336
visible:598,836,1350,1336
xscroll:0
yscroll:0
next:
@ -3033,7 +3033,7 @@ wimp_window {
scroll_inner:wimp_COLOUR_VERY_LIGHT_GREY
highlight_bg:wimp_COLOUR_CREAM
extra_flags:
extent:0,-452,752,0
extent:0,-500,752,0
title_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | 0x27000000
work_flags:
sprite_area:&1
@ -3041,7 +3041,7 @@ wimp_window {
ymin:448
text_only:"Contenu"
wimp_icon {
extent:16,-220,724,-24
extent:16,-272,732,-24
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3081,7 +3081,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:32,-204,404,-160
extent:32,-256,404,-212
#ifdef WITH_PLUGIN
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
#else
@ -3095,7 +3095,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:16,-340,724,-248
extent:16,-384,732,-292
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3105,7 +3105,7 @@ wimp_window {
text.validation:"R4"
}
wimp_icon {
extent:32,-276,492,-232
extent:32,-320,492,-276
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3115,7 +3115,7 @@ wimp_window {
text_and_sprite.validation:""
}
wimp_icon {
extent:32,-328,716,-280
extent:32,-372,716,-324
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3125,7 +3125,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:24,-424,188,-372
extent:24,-468,188,-416
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3135,7 +3135,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:368,-424,532,-372
extent:372,-468,536,-416
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3145,7 +3145,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:540,-432,724,-364
extent:544,-476,728,-408
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3154,6 +3154,16 @@ wimp_window {
text.size:*
text.validation:"R6,3"
}
wimp_icon {
extent:32,-204,376,-160
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
icon_bg:wimp_COLOUR_VERY_LIGHT_GREY
text_and_sprite.text:"Disable JavaScript"
text_and_sprite.size:19
text_and_sprite.validation:"Soptoff,opton"
}
}
wimp_window {

View File

@ -3394,7 +3394,7 @@ wimp_window {
wimp_window {
template_name:"con_content"
visible:272,306,912,758
visible:1632,750,2272,1250
xscroll:0
yscroll:0
next:wimp_TOP
@ -3407,7 +3407,7 @@ wimp_window {
scroll_inner:wimp_COLOUR_VERY_LIGHT_GREY
highlight_bg:wimp_COLOUR_CREAM
extra_flags:
extent:0,-452,640,0
extent:0,-500,640,0
title_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | 0x27000000
work_flags:
sprite_area:&1
@ -3415,7 +3415,7 @@ wimp_window {
ymin:452
text_only:"Inhoud"
wimp_icon {
extent:16,-220,624,-24
extent:16,-272,624,-24
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3455,7 +3455,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:32,-204,344,-160
extent:32,-256,344,-212
#ifdef WITH_PLUGIN
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
#else
@ -3469,7 +3469,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:16,-340,624,-248
extent:16,-380,624,-288
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3479,7 +3479,7 @@ wimp_window {
text.validation:"R4"
}
wimp_icon {
extent:32,-276,492,-232
extent:32,-316,492,-272
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3489,7 +3489,7 @@ wimp_window {
text_and_sprite.validation:""
}
wimp_icon {
extent:32,-324,636,-280
extent:32,-364,636,-320
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3499,7 +3499,7 @@ wimp_window {
text_and_sprite.validation:"Soptoff,opton"
}
wimp_icon {
extent:24,-424,188,-372
extent:24,-464,188,-412
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3509,7 +3509,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:256,-424,420,-372
extent:256,-464,420,-412
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3519,7 +3519,7 @@ wimp_window {
text.validation:"R5,3"
}
wimp_icon {
extent:436,-432,620,-364
extent:436,-472,620,-404
icon_flags:wimp_ICON_TEXT | wimp_ICON_BORDER | wimp_ICON_HCENTRED | wimp_ICON_VCENTRED | wimp_ICON_FILLED | wimp_ICON_INDIRECTED | wimp_BUTTON_CLICK
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
@ -3528,6 +3528,16 @@ wimp_window {
text.size:*
text.validation:"R6,3"
}
wimp_icon {
extent:32,-204,376,-160
icon_flags:wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED | wimp_BUTTON_RADIO
icon_esg:0
icon_fg:wimp_COLOUR_BLACK
icon_bg:wimp_COLOUR_VERY_LIGHT_GREY
text_and_sprite.text:"Disable JavaScript"
text_and_sprite.size:19
text_and_sprite.validation:"Soptoff,opton"
}
}
wimp_window {

31
test/js/document-url.html Normal file
View File

@ -0,0 +1,31 @@
<html>
<head>
<title>document location and URL interface</title>
<link rel="stylesheet" type="text/css" href="tst.css">
</head>
<body>
<h1>document location and URL interface</h1>
<h2>Document location enumeration</h2>
<script>
function output(x,y) {
document.body.appendChild(document.createTextNode(x));
document.body.appendChild(document.createTextNode("("));
if (y != undefined) {
document.body.appendChild(document.createTextNode(y.length));
}
document.body.appendChild(document.createTextNode(") = "));
document.body.appendChild(document.createTextNode(y));
document.body.appendChild(document.createElement('br'));
}
for(var key in document.location) {
output(key, document.location[key]);
}
</script>
<h2>Document URL</h2>
<script>output("document.URL", document.URL);</script>
<h2>DocumentURI</h2>
<script>output("document.documentURI", document.documentURI);</script>
</body>
</html>

View File

@ -0,0 +1,30 @@
<html>
<head>
<title>alert onclick example</title>
<script type="text/javascript">
function causealert()
{
var txt = document.getElementById("p1").textContent;
alert(txt);
}
</script>
</head>
<body>
<div style="border: 1px solid red">
<p id="p1">First line of paragraph.<br /></p>
</div><br />
<button id="button1" >add another textNode.</button>
<script>
var button = document.getElementById("button1");
button.onclick = causealert;
</script>
</body>
</html>

View File

@ -6,9 +6,7 @@
function addTextNode()
{
var newtext = document.createTextNode(" Some text added dynamically. ");
var para = document.getElementById("p1");
para.appendChild(newtext);
para.appendChild(document.createTextNode(" Some text added dynamically. "));
}
</script>
@ -19,10 +17,14 @@ para.appendChild(newtext);
<p id="p1">First line of paragraph.<br /></p>
</div><br />
<button onclick="addTextNode();">add another textNode.</button>
<button id="button1" >add another textNode.</button>
<script>
var button = document.getElementById("button1");
var para = document.getElementById("p1");
window.onload = addTextNode;
button.onclick = addTextNode;
</script>
</body>

View File

@ -5,12 +5,15 @@
</head>
<body>
<h1>JavaScript Tests</h1>
<h2>Window</h2>
<ul>
<li><a href="window.lately.html">location</a></li>
<li><a href="window-enumerate.html">enumerate</a></li>
</ul>
<h2>Document write</h2>
<ul>
<li><a href="inline-doc-write-simple.html">Simple document write</a></li>
@ -22,7 +25,9 @@
<li><a href="inline-innerhtml.html">Inline script innerHtml test</a></li>
</ul>
<h2>DOM tests</h2>
<h3>Reference method tests</h3>
<ul>
<li><a href="dom-element-firstElementChild.html">firstElementChild</a></li>
@ -31,24 +36,34 @@
<li><a href="dom-element-childElementCount.html">childElementCount</a></li>
<li><a href="doc-dom2.html">getElementById</a></li>
<li><a href="dom-getElementsByTagName.html">getElementsByTagName</a></li>
</ul>
<h3>Enumeration tests</h3>
<ul>
<li><a href="dom-node-enumerate.html">Node element interface</a></li>
<li><a href="dom-body-enumerate.html">Body element interface</a></li>
<li><a href="dom-document-enumerate.html">Document interface</a></li>
</ul>
<h3>Document element specific</h3>
<ul>
<li><a href="dom-doc-cookie.html">Cookie dispaly (only from server)</a></li>
<li><a href="dom-doc-location.html">location</a></li>
</ul>
<h2>Dom events</h2>
<ul>
<li><a href="event-onload.html">window.onload</a></li>
<li><a href="event-onclick.html">button.onclick</a></li>
</ul>
<h2>Assorted</h2>
<ul>
<li><a href="assorted-log-doc-write.html">console.log and document.write</a></li>
<li><a href="wikipedia-lcm.html">Example from wikipedia</a></li>
</ul>
</body>
</html>

View File

@ -193,6 +193,7 @@ dom_string *corestring_dom_playing;
dom_string *corestring_dom_popstate;
dom_string *corestring_dom_progress;
dom_string *corestring_dom_ratechange;
dom_string *corestring_dom_readystatechange;
dom_string *corestring_dom_rect;
dom_string *corestring_dom_rel;
dom_string *corestring_dom_reset;
@ -414,6 +415,7 @@ void corestrings_fini(void)
CSS_DOM_STRING_UNREF(popstate);
CSS_DOM_STRING_UNREF(progress);
CSS_DOM_STRING_UNREF(ratechange);
CSS_DOM_STRING_UNREF(readystatechange);
CSS_DOM_STRING_UNREF(rect);
CSS_DOM_STRING_UNREF(rel);
CSS_DOM_STRING_UNREF(reset);
@ -666,6 +668,7 @@ nserror corestrings_init(void)
CSS_DOM_STRING_INTERN(popstate);
CSS_DOM_STRING_INTERN(progress);
CSS_DOM_STRING_INTERN(ratechange);
CSS_DOM_STRING_INTERN(readystatechange);
CSS_DOM_STRING_INTERN(rect);
CSS_DOM_STRING_INTERN(rel);
CSS_DOM_STRING_INTERN(reset);

View File

@ -199,6 +199,7 @@ extern struct dom_string *corestring_dom_playing;
extern struct dom_string *corestring_dom_popstate;
extern struct dom_string *corestring_dom_progress;
extern struct dom_string *corestring_dom_ratechange;
extern struct dom_string *corestring_dom_readystatechange;
extern struct dom_string *corestring_dom_rect;
extern struct dom_string *corestring_dom_rel;
extern struct dom_string *corestring_dom_reset;

View File

@ -22,7 +22,6 @@
#include <assert.h>
#include <dom/dom.h>
#include <dom/bindings/hubbub/parser.h>
#include "utils/config.h"
#include "utils/log.h"
@ -254,6 +253,70 @@ void libdom_iterate_child_elements(dom_node *parent,
dom_nodelist_unref(children);
}
/* exported interface documented in libdom.h */
nserror libdom_hubbub_error_to_nserror(dom_hubbub_error error)
{
switch (error) {
/* HUBBUB_REPROCESS is not handled here because it can
* never occur outside the hubbub treebuilder
*/
case DOM_HUBBUB_OK:
/* parsed ok */
return NSERROR_OK;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED):
/* hubbub input paused */
return NSERROR_OK;
case DOM_HUBBUB_NOMEM:
/* out of memory error from DOM */
return NSERROR_NOMEM;
case DOM_HUBBUB_BADPARM:
/* Bad parameter passed to creation */
return NSERROR_BAD_PARAMETER;
case DOM_HUBBUB_DOM:
/* DOM call returned error */
return NSERROR_DOM;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_ENCODINGCHANGE):
/* encoding changed */
return NSERROR_ENCODING_CHANGE;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NOMEM):
/* out of memory error from parser */
return NSERROR_NOMEM;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADPARM):
return NSERROR_BAD_PARAMETER;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_INVALID):
return NSERROR_INVALID;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_FILENOTFOUND):
return NSERROR_NOT_FOUND;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NEEDDATA):
return NSERROR_NEED_DATA;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADENCODING):
return NSERROR_BAD_ENCODING;
case (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN):
/* currently only generated by the libdom hubbub binding */
return NSERROR_DOM;
default:
/* unknown error */
/** @todo better error handling and reporting */
return NSERROR_UNKNOWN;
}
return NSERROR_UNKNOWN;
}
static void ignore_dom_msg(uint32_t severity, void *ctx, const char *msg, ...)
{
}
@ -261,6 +324,7 @@ static void ignore_dom_msg(uint32_t severity, void *ctx, const char *msg, ...)
/* exported interface documented in libdom.h */
nserror libdom_parse_file(const char *filename, const char *encoding, dom_document **doc)
{
dom_hubbub_parser_params parse_params;
dom_hubbub_error error;
dom_hubbub_parser *parser;
dom_document *document;
@ -273,11 +337,18 @@ nserror libdom_parse_file(const char *filename, const char *encoding, dom_docume
return NSERROR_NOT_FOUND;
}
parser = dom_hubbub_parser_create(encoding, false, false,
ignore_dom_msg, NULL, NULL, &document);
if (parser == NULL) {
parse_params.enc = encoding;
parse_params.fix_enc = false;
parse_params.enable_script = false;
parse_params.msg = ignore_dom_msg;
parse_params.script = NULL;
parse_params.ctx = NULL;
parse_params.daf = NULL;
error = dom_hubbub_parser_create(&parse_params, &parser, &document);
if (error != DOM_HUBBUB_OK) {
fclose(fp);
return NSERROR_DOM;
return libdom_hubbub_error_to_nserror(error);
}
while (feof(fp) == 0) {
@ -297,7 +368,7 @@ nserror libdom_parse_file(const char *filename, const char *encoding, dom_docume
dom_node_unref(document);
dom_hubbub_parser_destroy(parser);
fclose(fp);
return NSERROR_DOM;
return libdom_hubbub_error_to_nserror(error);
}
dom_hubbub_parser_destroy(parser);

View File

@ -28,7 +28,11 @@
#include <dom/dom.h>
/* depth-first walk the dom calling callback for each element
#include <dom/bindings/hubbub/parser.h>
#include <dom/bindings/hubbub/errors.h>
/**
* depth-first walk the dom calling callback for each element
*
* \param root the dom node to use as the root of the tree walk
* \return true if all nodes were examined, false if the callback terminated
@ -65,4 +69,12 @@ void libdom_iterate_child_elements(dom_node *parent,
nserror libdom_parse_file(const char *filename, const char *encoding,
dom_document **doc);
/**
* Convert libdom hubbub binding errors to nserrors.
*
* \param error The hubbub binding error to convert
* \return The appropriate nserror
*/
nserror libdom_hubbub_error_to_nserror(dom_hubbub_error error);
#endif

24
windows/Makefile.defaults Normal file
View File

@ -0,0 +1,24 @@
# ----------------------------------------------------------------------------
# windows-specific options
# ----------------------------------------------------------------------------
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# Valid options: YES, NO
NETSURF_USE_NSSVG := NO
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
# mng support does not currently build on windows
NETSURF_USE_MNG := NO
# no pdf support
NETSURF_USE_HARU_PDF := NO
# Optimisation levels
CFLAGS += -O2