summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-05-05 22:28:51 +0100
committerVincent Sanders <vince@kyllikki.org>2016-05-15 13:44:34 +0100
commitd21447d096a320a08b3efb2b8768fad0dcdcfd64 (patch)
tree1a83814b7c9e94b2f13c473261f23dd3a17dee64 /amiga
parent2cbb337756d9af5bda4d594964d446439f602551 (diff)
downloadnetsurf-d21447d096a320a08b3efb2b8768fad0dcdcfd64.tar.gz
netsurf-d21447d096a320a08b3efb2b8768fad0dcdcfd64.tar.bz2
move frontends into sub directory
Diffstat (limited to 'amiga')
-rw-r--r--amiga/Makefile.defaults42
-rw-r--r--amiga/Makefile.target130
-rw-r--r--amiga/agclass/amigaguide_class.c394
-rwxr-xr-xamiga/agclass/amigaguide_class.h43
-rw-r--r--amiga/arexx.c636
-rwxr-xr-xamiga/arexx.h32
-rw-r--r--amiga/bitmap.c706
-rwxr-xr-xamiga/bitmap.h192
-rw-r--r--amiga/clipboard.c374
-rwxr-xr-xamiga/clipboard.h42
-rwxr-xr-xamiga/cookies.c39
-rwxr-xr-xamiga/cookies.h28
-rw-r--r--amiga/ctxmenu.c607
-rw-r--r--amiga/ctxmenu.h92
-rw-r--r--amiga/datatypes.c40
-rw-r--r--amiga/datatypes.h41
-rwxr-xr-xamiga/dist/Install397
-rw-r--r--amiga/dist/Install.infobin8892 -> 0 bytes
-rwxr-xr-xamiga/dist/NetSurf.guide411
-rw-r--r--amiga/dist/NetSurf.guide.infobin6741 -> 0 bytes
-rw-r--r--amiga/dist/Rexx.infobin6206 -> 0 bytes
-rw-r--r--amiga/dist/Rexx/CloseTabs.nsrx47
-rw-r--r--amiga/dist/Rexx/SMTube.nsrx29
-rw-r--r--amiga/dist/Rexx/ShowTitles.nsrx18
-rwxr-xr-xamiga/dist/Rexx/viewsource.nsrx24
-rw-r--r--amiga/download.c451
-rwxr-xr-xamiga/download.h44
-rw-r--r--amiga/drag.c352
-rw-r--r--amiga/drag.h45
-rw-r--r--amiga/dt_anim.c365
-rw-r--r--amiga/dt_picture.c294
-rw-r--r--amiga/dt_sound.c278
-rw-r--r--amiga/file.c293
-rw-r--r--amiga/file.h45
-rw-r--r--amiga/filetype.c647
-rw-r--r--amiga/filetype.h51
-rw-r--r--amiga/font.c152
-rwxr-xr-xamiga/font.h63
-rw-r--r--amiga/font_bullet.c895
-rw-r--r--amiga/font_bullet.h32
-rw-r--r--amiga/font_cache.c206
-rw-r--r--amiga/font_cache.h54
-rw-r--r--amiga/font_diskfont.c292
-rw-r--r--amiga/font_diskfont.h23
-rw-r--r--amiga/font_scan.c522
-rwxr-xr-xamiga/font_scan.h39
-rw-r--r--amiga/gui.c5740
-rw-r--r--amiga/gui.h246
-rwxr-xr-xamiga/gui_options.c2316
-rwxr-xr-xamiga/gui_options.h32
-rw-r--r--amiga/hash/xxhash.c962
-rw-r--r--amiga/hash/xxhash.h192
-rwxr-xr-xamiga/help.c85
-rwxr-xr-xamiga/help.h38
-rwxr-xr-xamiga/history.c41
-rwxr-xr-xamiga/history.h29
-rwxr-xr-xamiga/history_local.c341
-rwxr-xr-xamiga/history_local.h45
-rwxr-xr-xamiga/hotlist.c119
-rwxr-xr-xamiga/hotlist.h34
-rw-r--r--amiga/icon.c545
-rw-r--r--amiga/icon.h47
-rwxr-xr-xamiga/iff_cset.h33
-rw-r--r--amiga/iff_dr2d.c422
-rw-r--r--amiga/iff_dr2d.h107
-rwxr-xr-xamiga/launch.c179
-rwxr-xr-xamiga/launch.h33
-rw-r--r--amiga/libs.c326
-rw-r--r--amiga/libs.h82
-rwxr-xr-xamiga/login.c238
-rwxr-xr-xamiga/login.h31
-rw-r--r--amiga/menu.c1146
-rwxr-xr-xamiga/menu.h150
-rwxr-xr-xamiga/misc.c506
-rw-r--r--amiga/misc.h52
-rwxr-xr-xamiga/object.c136
-rwxr-xr-xamiga/object.h65
-rw-r--r--amiga/options.h95
-rw-r--r--amiga/os3support.c431
-rw-r--r--amiga/os3support.h254
-rwxr-xr-xamiga/pkg/AutoInstall3
-rw-r--r--amiga/pkg/drawer.infobin17208 -> 0 bytes
-rwxr-xr-xamiga/pkg/makepackage34
-rwxr-xr-xamiga/pkg/makereslinks28
-rwxr-xr-xamiga/pkg/netsurf.readme25
-rw-r--r--amiga/pkg/netsurf.readme.infobin6238 -> 0 bytes
-rw-r--r--amiga/pkg/netsurf_os3.readme28
-rw-r--r--amiga/pkg/netsurf_os3.readme.infobin6238 -> 0 bytes
-rw-r--r--amiga/plotters.c920
-rw-r--r--amiga/plotters.h55
-rw-r--r--amiga/plugin_hack.c274
-rw-r--r--amiga/plugin_hack.h28
-rw-r--r--amiga/print.c589
-rwxr-xr-xamiga/print.h40
l---------amiga/resources/AdBlock.css1
-rw-r--r--amiga/resources/LangNames74
-rwxr-xr-xamiga/resources/Pointers/Blank33
-rw-r--r--amiga/resources/Pointers/Blank.infobin1719 -> 0 bytes
-rwxr-xr-xamiga/resources/Pointers/Caret33
-rw-r--r--amiga/resources/Pointers/Caret.infobin1605 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Cross.infobin2046 -> 0 bytes
-rwxr-xr-xamiga/resources/Pointers/Default33
-rw-r--r--amiga/resources/Pointers/Default.infobin2045 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Down.infobin1719 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Drag.infobin2302 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Help.infobin2775 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Left.infobin1587 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/LeftDown.infobin1765 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/LeftUp.infobin1695 -> 0 bytes
-rwxr-xr-xamiga/resources/Pointers/Menu33
-rw-r--r--amiga/resources/Pointers/Menu.infobin2577 -> 0 bytes
-rwxr-xr-xamiga/resources/Pointers/Move33
-rw-r--r--amiga/resources/Pointers/Move.infobin2840 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/NoDrop.infobin2801 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/NotAllowed.infobin2533 -> 0 bytes
-rwxr-xr-xamiga/resources/Pointers/Point33
-rw-r--r--amiga/resources/Pointers/Point.infobin2755 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Progress.infobin2851 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Right.infobin1609 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/RightDown.infobin1669 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/RightUp.infobin1687 -> 0 bytes
-rw-r--r--amiga/resources/Pointers/Up.infobin1617 -> 0 bytes
-rwxr-xr-xamiga/resources/Pointers/Wait33
-rw-r--r--amiga/resources/Pointers/Wait.infobin2449 -> 0 bytes
-rw-r--r--amiga/resources/Resource.map4
-rw-r--r--amiga/resources/SearchEngines22
-rw-r--r--amiga/resources/Themes/AISS/NetSurf.infobin23778 -> 0 bytes
-rw-r--r--amiga/resources/Themes/AISS/Resource.map8
-rwxr-xr-xamiga/resources/Themes/AISS/Theme75
-rw-r--r--amiga/resources/Themes/AISS/Throbberbin5443 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/NetSurf.infobin14818 -> 0 bytes
-rwxr-xr-xamiga/resources/Themes/Default/Theme88
-rw-r--r--amiga/resources/Themes/Default/Throbberbin6479 -> 0 bytes
-rwxr-xr-xamiga/resources/Themes/Default/back.pngbin653 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/back_g.pngbin306 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/back_h.pngbin607 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/closetab.pngbin266 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/closetab_g.pngbin169 -> 0 bytes
-rwxr-xr-xamiga/resources/Themes/Default/forward.pngbin697 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/forward_g.pngbin538 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/forward_h.pngbin635 -> 0 bytes
-rwxr-xr-xamiga/resources/Themes/Default/home.pngbin745 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/home_g.pngbin576 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/home_h.pngbin751 -> 0 bytes
-rwxr-xr-xamiga/resources/Themes/Default/reload.pngbin1062 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/reload_g.pngbin814 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/reload_h.pngbin1046 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/search.pngbin662 -> 0 bytes
-rwxr-xr-xamiga/resources/Themes/Default/stop.pngbin1135 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/stop_g.pngbin850 -> 0 bytes
-rw-r--r--amiga/resources/Themes/Default/stop_h.pngbin1119 -> 0 bytes
-rw-r--r--amiga/resources/blankspace.pngbin85 -> 0 bytes
l---------amiga/resources/ca-bundle1
l---------amiga/resources/de1
-rw-r--r--amiga/resources/default.css7
-rw-r--r--amiga/resources/default.css.infobin5082 -> 0 bytes
l---------amiga/resources/en1
-rw-r--r--amiga/resources/favicon.pngbin685 -> 0 bytes
l---------amiga/resources/fr1
l---------amiga/resources/it1
-rw-r--r--amiga/resources/mimetypes112
l---------amiga/resources/nl1
l---------amiga/resources/nsdefault.css1
l---------amiga/resources/quirks.css1
-rw-r--r--amiga/resources/splash.pngbin29458 -> 0 bytes
-rw-r--r--amiga/rtg.c72
-rw-r--r--amiga/rtg.h37
-rw-r--r--amiga/save_pdf.c59
-rw-r--r--amiga/save_pdf.h31
-rwxr-xr-xamiga/schedule.c353
-rwxr-xr-xamiga/schedule.h57
-rwxr-xr-xamiga/search.c339
-rwxr-xr-xamiga/search.h37
-rw-r--r--amiga/selectmenu.c200
-rwxr-xr-xamiga/selectmenu.h39
-rw-r--r--amiga/sslcert.c50
-rw-r--r--amiga/sslcert.h28
-rwxr-xr-xamiga/stringview/stringview.c870
-rwxr-xr-xamiga/stringview/stringview.h60
-rw-r--r--amiga/stringview/urlhistory.c124
-rw-r--r--amiga/stringview/urlhistory.h33
-rw-r--r--amiga/theme.c513
-rw-r--r--amiga/theme.h50
-rw-r--r--amiga/tree.c1473
-rwxr-xr-xamiga/tree.h48
-rwxr-xr-xamiga/utf8.c104
-rwxr-xr-xamiga/utf8.h31
-rw-r--r--amiga/version.c39
188 files changed, 0 insertions, 31906 deletions
diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults
deleted file mode 100644
index 0674a9de2..000000000
--- a/amiga/Makefile.defaults
+++ /dev/null
@@ -1,42 +0,0 @@
-# ----------------------------------------------------------------------------
-# Amiga-specific options
-# ----------------------------------------------------------------------------
-
-# Force using glibc internal iconv implementation instead of external libiconv
-# Valid options: YES, NO
-ifneq ($(SUBTARGET),os3)
- NETSURF_USE_LIBICONV_PLUG := YES
-else
- NETSURF_USE_LIBICONV_PLUG := NO
-endif
-
-# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
-# Valid options: YES, NO, AUTO
-NETSURF_USE_ROSPRITE := 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 Spidermonkey 1.80+
-# Only here to stop the build complaining;
-# enable NETSURF_USE_MOZJS instead for JavaScript support
-# Valid options: NO
-NETSURF_USE_JS := NO
-
-# Enable building the source object cache filesystem based backing store.
-# implementation.
-# Valid options: YES, NO
-NETSURF_FS_BACKING_STORE := YES
-
-# Optimisation levels
-CFLAGS += -fomit-frame-pointer -gstabs
-
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
deleted file mode 100644
index 54957f778..000000000
--- a/amiga/Makefile.target
+++ /dev/null
@@ -1,130 +0,0 @@
-# ----------------------------------------------------------------------------
-# Amiga target setup
-# ----------------------------------------------------------------------------
-
-CFLAGS += -std=c99 -Dnsamiga
-
-ifneq ($(SUBTARGET),os3)
- CFLAGS += -O2 -finline-functions -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__
-else
- CFLAGS += -msoft-float -m68020-60 -O2 -DPATH_MAX=1024 -D__m68k__
-endif
-
-NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
-NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
-NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
-NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
-NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
-NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
-
-ifeq ($(HOST),amiga)
- $(eval $(call feature_enabled,ROSPRITE,-DWITH_NSSPRITE,-lrosprite,Sprite (librosprite)))
- $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
- $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
- $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
- $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
- $(eval $(call feature_enabled,VIDEO,-DWITH_VIDEO -I /SDK/local/newlib/include/glib-2.0,-lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lintl -lffi,Video (libgstreamer)))
- $(eval $(call feature_enabled,JS,-DXP_UNIX -DWITH_JS -DJS_VERSION=185,-lstdc++ -lmozjs185,JavaScript))
- $(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs -lfdlibm,JavaScript))
- $(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
- $(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
-
- CFLAGS += -I /SDK/local/common/include/libpng12
- LDFLAGS += -lcurl -lrtmp -lpthread -ltre -lintl -lpbl
- LDFLAGS += -lssl -lcrypto -ldom -lhubbub -lcss -lparserutils -lwapcaplet
-else
- $(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 feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs,JavaScript))
- $(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
- $(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
-
- CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include
- CFLAGS += $(shell $(PKG_CONFIG) --cflags libcurl openssl)
- CFLAGS += $(shell $(PKG_CONFIG) --cflags tre)
-
- LDFLAGS += $(shell $(PKG_CONFIG) --static --libs libcurl openssl)
- LDFLAGS += $(shell $(PKG_CONFIG) --libs tre)
- LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
-
- LDFLAGS += -lpbl -liconv
-
- ifeq ($(SUBTARGET),os3)
- LDFLAGS += -lamiga -lm
- endif
-endif
-
-EXETARGET := NetSurf
-
-# The filter and target for split messages
-MESSAGES_FILTER=ami
-
-# ----------------------------------------------------------------------------
-# Source file setup
-# ----------------------------------------------------------------------------
-
-# S_AMIGA are sources purely for the Amiga build
-S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \
- misc.c bitmap.c font.c filetype.c utf8.c login.c \
- plotters.c object.c menu.c save_pdf.c arexx.c version.c \
- cookies.c ctxmenu.c clipboard.c help.c font_scan.c \
- launch.c search.c history_local.c download.c iff_dr2d.c \
- sslcert.c gui_options.c print.c theme.c drag.c icon.c libs.c \
- datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
- stringview/stringview.c stringview/urlhistory.c rtg.c \
- agclass/amigaguide_class.c os3support.c font_diskfont.c \
- selectmenu.c hash/xxhash.c font_cache.c font_bullet.c
-S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
-
-# This is the final source build list
-# Note this is deliberately *not* expanded here as common and image
-# are not yet available
-SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_AMIGA)
-
-# ----------------------------------------------------------------------------
-# Install target
-# ----------------------------------------------------------------------------
-
-install-amiga:
-
-# ----------------------------------------------------------------------------
-# Package target
-# ----------------------------------------------------------------------------
-
-package-amiga: netsurf.lha
-
-AMIGA_LANGUAGES := de en it ja nl
-AMIGA_PLATFORM_RESOURCES := Pointers Themes default.css default.css.info favicon.png LangNames mimetypes Resource.map SearchEngines splash.png
-AMIGA_GENERIC_RESOURCES := $(AMIGA_LANGUAGES) ca-bundle Icons
-AMIGA_RESOURCES := $(addprefix amiga/resources/,$(AMIGA_PLATFORM_RESOURCES)) $(addprefix \!NetSurf/Resources/,$(AMIGA_GENERIC_RESOURCES))
-AMIGA_DISTRIBUTION_FILES := amiga/dist/*
-AMIGA_INSTALL_TARGET_DIR := NetSurf_Amiga
-
-netsurf.lha: $(EXETARGET)
- $(VQ)echo Creating netsurf.lha
- $(Q)rm -rf $(AMIGA_INSTALL_TARGET_DIR)
- $(Q)mkdir -p $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
- $(Q)cp -p $(EXETARGET) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
- $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
- $(Q)cp -r $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
- $(Q)cp -r $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
- $(Q)cp \!NetSurf/Resources/AdBlock,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/adblock.css
- $(Q)cp \!NetSurf/Resources/CSS,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/nsdefault.css
- $(Q)cp \!NetSurf/Resources/internal.css,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/internal.css
- $(Q)cp \!NetSurf/Resources/Quirks,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/quirks.css
- $(Q)cp \!NetSurf/Resources/netsurf.png,b60 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/netsurf.png
- $(Q)cp amiga/pkg/drawer.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf.info
- $(Q)cp amiga/pkg/AutoInstall $(AMIGA_INSTALL_TARGET_DIR)
- ifeq ($(SUBTARGET),os3)
- $(Q)cp amiga/pkg/netsurf_os3.readme $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
- $(Q)cp amiga/pkg/netsurf_os3.readme.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
- else
- $(Q)cp amiga/pkg/netsurf.readme $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
- $(Q)cp amiga/pkg/netsurf.readme.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
- endif
- $(Q)cd $(AMIGA_INSTALL_TARGET_DIR); \
- lha a netsurf.lha NetSurf NetSurf.info AutoInstall
-
diff --git a/amiga/agclass/amigaguide_class.c b/amiga/agclass/amigaguide_class.c
deleted file mode 100644
index 2b80223ca..000000000
--- a/amiga/agclass/amigaguide_class.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * AmigaGuide Class
- * A BOOPSI class for displaying AmigaGuide files.
- * by Daniel "Trixie" Jedlicka
- */
-
-#include "amiga/os3support.h"
-#include "amigaguide_class.h"
-
-#ifdef __amigaos4__
-#define DISPATCHHOOK(func) static uint32 func(Class *cl, Object *o, Msg msg)
-#else
-#define DISPATCHHOOK(func) static ASM uint32 func(REG(a0, Class *cl),REG(a2, Object *o), REG(a1, Msg msg))
-#endif
-
-struct localObjectData
-{
- struct NewAmigaGuide nag;
- struct AmigaGuideMsg *agm;
- AMIGAGUIDECONTEXT agHandle;
- uint32 agContextID;
- uint32 agSignal;
-};
-
-struct Library *AmigaGuideBase = NULL;
-struct AmigaGuideIFace *IAmigaGuide = NULL;
-
-
-/* ********************************** function prototypes ************************************ */
-
-DISPATCHHOOK(dispatchAGClass);
-
-
-// class methods
-uint32 om_new(Class *, Object *, struct opSet *);
-uint32 om_dispose(Class *, Object *, Msg);
-uint32 om_set(Class *, Object *, struct opSet *);
-uint32 om_get(Class *, Object *, struct opGet *);
-uint32 agm_open(Class *, Object *, Msg);
-uint32 agm_close(Class *, Object *, Msg);
-uint32 agm_process(Class *, Object *, Msg);
-
-
-/* *************************** class initialization and disposal ***************************** */
-
-
-Class *initAGClass(void)
-{
- Class *cl = NULL;
-
-
- // Open amigaguide.library and its interface.
- if ( (AmigaGuideBase = OpenLibrary("amigaguide.library", 40)) )
- {
-#ifdef __amigaos4__
- if ( (IAmigaGuide = (struct AmigaGuideIFace *)GetInterface(AmigaGuideBase, "main", 1L, NULL)) )
- {
-#endif
- if ( (cl = MakeClass(NULL, "rootclass", NULL, sizeof(struct localObjectData), 0)) )
- {
- cl->cl_Dispatcher.h_Entry = (HOOKFUNC)dispatchAGClass;
- AddClass(cl);
- }
- else freeAGClass(NULL);
-#ifdef __amigaos4__
- }
- else freeAGClass(NULL);
-#endif
- }
-
- return cl;
-
-}
-
-
-
-BOOL freeAGClass(Class *cl)
-{
- BOOL retVal = FALSE;
-
-
- // Close amigaguide.library and free the class.
-#ifdef __amigaos4__
- if (IAmigaGuide) DropInterface((struct Interface *)IAmigaGuide);
-#endif
- if (AmigaGuideBase) CloseLibrary(AmigaGuideBase);
- if (cl) retVal = FreeClass(cl);
-
- return retVal;
-}
-
-
-
-/* ************************************** class dispatcher ************************************ */
-
-
-DISPATCHHOOK(dispatchAGClass)
-{
-
- switch (msg->MethodID)
- {
- case OM_NEW:
- return om_new(cl, o, (struct opSet *)msg);
-
- case OM_DISPOSE:
- return om_dispose(cl, o, msg);
-
- case OM_UPDATE:
- case OM_SET:
- return om_set(cl, o, (struct opSet *)msg);
-
- case OM_GET:
- return om_get(cl, o, (struct opGet *)msg);
-
- case AGM_OPEN:
- return agm_open(cl, o, msg);
-
- case AGM_CLOSE:
- return agm_close(cl, o, msg);
-
- case AGM_PROCESS:
- return agm_process(cl, o, msg);
-
- default:
- return IDoSuperMethodA(cl, o, msg);
- }
-
-}
-
-
-/* *************************************** class methods ************************************** */
-
-uint32 om_new(Class *cl, Object *o, struct opSet *msg)
-{
- struct localObjectData *lod = NULL;
- uint32 retVal = 0L;
-
-
- if ( (retVal = IDoSuperMethodA(cl, o, (Msg)msg)) )
- {
- // Obtain pointer to our object's local instance data.
- if ( (lod = (struct localObjectData *)INST_DATA(cl, retVal)) )
- {
- // Initialize values.
- lod->agHandle = NULL;
- lod->agContextID = 0;
- lod->nag.nag_Name = NULL;
- lod->nag.nag_Screen = NULL;
- lod->nag.nag_PubScreen = NULL;
- lod->nag.nag_BaseName = NULL;
- lod->nag.nag_Context = NULL;
- lod->nag.nag_Client = NULL; // private, must be NULL!
-
- // Set initial object attributes based on the tags from NewObject().
- om_set(cl, (Object *)retVal, msg);
- }
- }
-
- return retVal;
-
-}
-
-
-
-
-
-uint32 om_dispose(Class *cl, Object *o, Msg msg)
-{
-
- // Close the document, should it still be opened.
- agm_close(cl, o, msg);
-
- // Let superclass dispose of the object.
- return IDoSuperMethodA(cl, o, msg);
-
-}
-
-
-
-
-
-uint32 om_set(Class *cl, Object *o, struct opSet *msg)
-{
- struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
- struct TagItem *ti = NULL, *tags = msg->ops_AttrList;
- uint32 retVal = 0L;
-
-
- while ((ti = NextTagItem (&tags)))
- {
- switch (ti->ti_Tag)
- {
- case AMIGAGUIDE_Name:
- lod->nag.nag_Name = (STRPTR)ti->ti_Data;
- retVal++;
- break;
-
- case AMIGAGUIDE_Screen:
- lod->nag.nag_Screen = (struct Screen *)ti->ti_Data;
- retVal++;
- break;
-
- case AMIGAGUIDE_PubScreen:
- lod->nag.nag_PubScreen = (STRPTR)ti->ti_Data;
- retVal++;
- break;
-
- case AMIGAGUIDE_BaseName:
- lod->nag.nag_BaseName = (STRPTR)ti->ti_Data;
- retVal++;
- break;
-
- case AMIGAGUIDE_ContextArray:
- lod->nag.nag_Context = (STRPTR *)ti->ti_Data;
- retVal++;
- break;
-
- case AMIGAGUIDE_ContextID:
- lod->agContextID = (uint32)ti->ti_Data;
- retVal++;
- break;
-
- default:
- break;
- }
- }
-
- return retVal;
-
-}
-
-
-
-
-
-uint32 om_get(Class *cl, Object *o, struct opGet *msg)
-{
- struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
- uint32 retVal = 0L;
-
-
- switch (msg->opg_AttrID)
- {
- case AMIGAGUIDE_Name:
- *(msg->opg_Storage) = (uint32)lod->nag.nag_Name;
- retVal = 1L;
- break;
-
- case AMIGAGUIDE_Screen:
- *(msg->opg_Storage) = (uint32)lod->nag.nag_Screen;
- retVal = 1L;
- break;
-
- case AMIGAGUIDE_PubScreen:
- *(msg->opg_Storage) = (uint32)lod->nag.nag_PubScreen;
- retVal = 1L;
- break;
-
- case AMIGAGUIDE_BaseName:
- *(msg->opg_Storage) = (uint32)lod->nag.nag_BaseName;
- retVal = 1L;
- break;
-
- case AMIGAGUIDE_ContextArray:
- *(msg->opg_Storage) = (uint32)lod->nag.nag_Context;
- retVal = 1L;
- break;
-
- case AMIGAGUIDE_ContextID:
- *(msg->opg_Storage) = (uint32)lod->agContextID;
- retVal = 1L;
- break;
-
- case AMIGAGUIDE_Signal:
- *(msg->opg_Storage) = (uint32)lod->agSignal;
- retVal = 1L;
- break;
-
- default:
- retVal = IDoSuperMethodA(cl, o, (Msg)msg);
- }
-
- return retVal;
-
-}
-
-
-
-
-
-uint32 agm_open(Class *cl, Object *o, Msg msg)
-{
- struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
- BOOL agActive = FALSE;
- uint32 retVal = 0L;
-
-
- // Close a previous instance.
- if ( lod->agHandle ) agm_close(cl, o, msg);
-
- // (Re)establish the AmigaGuide context and open the database asynchronously.
- if ( (lod->agHandle = OpenAmigaGuideAsync(&(lod->nag), NULL)) )
- {
- if ( (lod->agSignal = AmigaGuideSignal(lod->agHandle)) )
- {
- // Wait until the database is displayed and ready.
- Wait(lod->agSignal);
- while ( agActive == FALSE )
- {
- while ( (lod->agm = GetAmigaGuideMsg(lod->agHandle)) )
- {
- // The AmigaGuide process started OK.
- if ( lod->agm->agm_Type == ActiveToolID ) agActive = TRUE;
-
- // Opening the guide file failed for some reason, continue as usual.
- if ( lod->agm->agm_Type == ToolStatusID && lod->agm->agm_Pri_Ret ) agActive = TRUE;
-
- ReplyAmigaGuideMsg(lod->agm);
- }
- }
- if ( lod->nag.nag_Context )
- {
- // A context node array is provided = open the current context node.
- SetAmigaGuideContext(lod->agHandle, lod->agContextID, NULL);
- retVal = SendAmigaGuideContext(lod->agHandle, NULL);
- }
- else
- {
- // No context array is provided = open the main node.
- retVal = SendAmigaGuideCmd(lod->agHandle, "LINK MAIN", TAG_DONE);
- }
- }
- }
-
-
- return retVal;
-}
-
-
-
-
-
-uint32 agm_close(Class *cl, Object *o, Msg msg)
-{
- struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
- uint32 retVal = 0L;
-
-
- if ( lod->agHandle )
- {
- CloseAmigaGuide(lod->agHandle);
- lod->agHandle = NULL;
- lod->agSignal = 0;
- retVal = 1L;
- }
-
- return retVal;
-
-}
-
-
-
-
-
-
-uint32 agm_process(Class *cl, Object *o, Msg msg)
-{
- struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
- uint32 retVal = 0L;
-
-
- if (lod->agHandle)
- {
- while ( (lod->agm = GetAmigaGuideMsg(lod->agHandle)) )
- {
- switch (lod->agm->agm_Type)
- {
- case ShutdownMsgID:
- agm_close(cl, o, msg);
- retVal = 1L;
- break;
-
- default:
- //printf("%d\n", lod->agm->agm_Type);
- break;
- }
- ReplyAmigaGuideMsg(lod->agm);
- }
- }
-
- return retVal;
-
-}
-
diff --git a/amiga/agclass/amigaguide_class.h b/amiga/agclass/amigaguide_class.h
deleted file mode 100755
index ee7e55e60..000000000
--- a/amiga/agclass/amigaguide_class.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * AmigaGuide Class
- *
- */
-
-#ifndef AMIGAGUIDE_CLASS_H
-#define AMIGAGUIDE_CLASS_H
-
-#include <exec/types.h>
-#include <intuition/classes.h>
-
-#include <classes/window.h>
-
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/amigaguide.h>
-#include <proto/utility.h>
-
-
-
-// tag definitions
-#define AMIGAGUIDE_Dummy (TAG_USER+0x05000000)
-
-#define AMIGAGUIDE_Name (AMIGAGUIDE_Dummy + 1) // Name of the AmigaGuide database.
-#define AMIGAGUIDE_Screen (AMIGAGUIDE_Dummy + 2) // Pointer of the screen to open on.
-#define AMIGAGUIDE_PubScreen (AMIGAGUIDE_Dummy + 3) // Name of the public screen to open on.
-#define AMIGAGUIDE_BaseName (AMIGAGUIDE_Dummy + 4) // Basename of the application that opens the help file.
-#define AMIGAGUIDE_ContextArray (AMIGAGUIDE_Dummy + 5) // Context node array (must be NULL-terminated).
-#define AMIGAGUIDE_ContextID (AMIGAGUIDE_Dummy + 6) // Index value of the node to display.
-#define AMIGAGUIDE_Signal (AMIGAGUIDE_Dummy + 7) // Signal mask to wait on
-
-// method definition
-#define AGM_Dummy AMIGAGUIDE_Dummy + 100
-#define AGM_OPEN AGM_Dummy + 1
-#define AGM_CLOSE AGM_Dummy + 2
-#define AGM_PROCESS AGM_Dummy + 3
-
-// function prototypes
-Class *initAGClass(void);
-BOOL freeAGClass(Class *);
-
-#endif // AMIGAGUIDE_CLASS_H
-
diff --git a/amiga/arexx.c b/amiga/arexx.c
deleted file mode 100644
index c5b5ab42d..000000000
--- a/amiga/arexx.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
- * Copyright 2008-2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <proto/intuition.h>
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/clicktab.h>
-#include <gadgets/clicktab.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/utils.h"
-#include "utils/log.h"
-#include "utils/nsoption.h"
-#include "utils/nsurl.h"
-#include "content/hlcache.h"
-#include "desktop/browser.h"
-#include "desktop/gui_window.h"
-#include "desktop/version.h"
-
-#include "amiga/arexx.h"
-#include "amiga/download.h"
-#include "amiga/gui.h"
-#include "amiga/hotlist.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/theme.h"
-
-extern const char * const verarexx;
-extern const char * const wt_revid;
-
-enum
-{
- RX_OPEN=0,
- RX_QUIT,
- RX_TOFRONT,
- RX_GETURL,
- RX_GETTITLE,
- RX_VERSION,
- RX_SAVE,
- RX_PUBSCREEN,
- RX_BACK,
- RX_FORWARD,
- RX_HOME,
- RX_RELOAD,
- RX_WINDOWS,
- RX_ACTIVE,
- RX_CLOSE,
- RX_HOTLIST
-};
-
-STATIC char result[100];
-
-STATIC VOID rx_open(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_quit(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_tofront(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_geturl(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_gettitle(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_version(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_save(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_pubscreen(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_back(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_forward(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_home(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_reload(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_windows(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_active(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_close(struct ARexxCmd *, struct RexxMsg *);
-STATIC VOID rx_hotlist(struct ARexxCmd *, struct RexxMsg *);
-
-STATIC struct ARexxCmd Commands[] =
-{
- {"OPEN",RX_OPEN,rx_open,"URL/A,NEW=NEWWINDOW/S,NEWTAB/S,SAVEAS/K,W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"QUIT",RX_QUIT,rx_quit,NULL, 0, NULL, 0, 0, NULL },
- {"TOFRONT",RX_TOFRONT,rx_tofront,NULL, 0, NULL, 0, 0, NULL },
- {"GETURL",RX_GETURL,rx_geturl, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"GETTITLE",RX_GETTITLE,rx_gettitle, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"VERSION",RX_VERSION,rx_version,"VERSION/N,SVN=REVISION/N,RELEASE/S", 0, NULL, 0, 0, NULL },
- {"SAVE",RX_SAVE,rx_save,"FILENAME/A,W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"GETSCREENNAME",RX_PUBSCREEN,rx_pubscreen,NULL, 0, NULL, 0, 0, NULL },
- {"BACK", RX_BACK, rx_back, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"FORWARD", RX_FORWARD, rx_forward, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"HOME", RX_HOME, rx_home, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"RELOAD", RX_RELOAD, rx_reload, "FORCE/S,W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"WINDOWS", RX_WINDOWS, rx_windows, "W=WINDOW/K/N", 0, NULL, 0, 0, NULL },
- {"ACTIVE", RX_ACTIVE, rx_active, "T=TAB/S", 0, NULL, 0, 0, NULL },
- {"CLOSE", RX_CLOSE, rx_close, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
- {"HOTLIST", RX_HOTLIST, rx_hotlist, "A=ACTION/A", 0, NULL, 0, 0, NULL },
- { NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL }
-};
-
-BOOL ami_arexx_init(void)
-{
- if((arexx_obj = ARexxObj,
- AREXX_HostName,"NETSURF",
- AREXX_Commands,Commands,
- AREXX_NoSlot,TRUE,
- AREXX_ReplyHook,NULL,
- AREXX_DefExtension,"nsrx",
- End))
- {
- GetAttr(AREXX_SigMask, arexx_obj, &rxsig);
- return true;
- }
- else
- {
-/* Create a temporary ARexx port so we can send commands to the NetSurf which
- * is already running */
- arexx_obj = ARexxObj,
- AREXX_HostName,"NETSURF",
- AREXX_Commands,Commands,
- AREXX_NoSlot,FALSE,
- AREXX_ReplyHook,NULL,
- AREXX_DefExtension,"nsrx",
- End;
- return false;
- }
-}
-
-void ami_arexx_handle(void)
-{
- RA_HandleRexx(arexx_obj);
-}
-
-void ami_arexx_execute(char *script)
-{
- char full_script_path[1025];
- BPTR lock;
-
- if((lock = Lock(script, ACCESS_READ))) {
- DevNameFromLock(lock, full_script_path, 1024, DN_FULLPATH);
- LOG("Executing script: %s", full_script_path);
- IDoMethod(arexx_obj, AM_EXECUTE, full_script_path, NULL, NULL, NULL, NULL, NULL);
- UnLock(lock);
- }
-}
-
-void ami_arexx_cleanup(void)
-{
- if(arexx_obj) DisposeObject(arexx_obj);
-}
-
-static struct gui_window *ami_find_tab_gwin(struct gui_window_2 *gwin, int tab)
-{
- int tabs = 0;
- struct Node *ctab;
- struct Node *ntab;
- struct gui_window *gw;
-
- if((tab == 0) || (gwin->tabs == 0)) return gwin->gw;
-
- ctab = GetHead(&gwin->tab_list);
-
- do
- {
- tabs++;
- ntab=GetSucc(ctab);
- GetClickTabNodeAttrs(ctab,
- TNA_UserData, &gw,
- TAG_DONE);
- if(tabs == tab) return gw;
- } while((ctab=ntab));
-
- return NULL;
-}
-
-static int ami_find_tab_bw(struct gui_window_2 *gwin, struct browser_window *bw)
-{
- int tabs = 0;
- struct Node *ctab;
- struct Node *ntab;
- struct gui_window *tgw = NULL;
-
- if((bw == NULL) || (gwin->tabs == 0)) return 1;
-
- ctab = GetHead(&gwin->tab_list);
-
- do
- {
- tabs++;
- ntab=GetSucc(ctab);
- GetClickTabNodeAttrs(ctab,
- TNA_UserData, &tgw,
- TAG_DONE);
- if(tgw->bw == bw) return tabs;
- } while((ctab=ntab));
-
- return 0;
-}
-
-static struct gui_window *ami_find_tab(int window, int tab)
-{
- struct nsObject *node, *nnode;
-
- if(!IsMinListEmpty(window_list))
- {
- int windows = 0;
-
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- if(node->Type == AMINS_WINDOW)
- {
- windows++;
- if(windows == window)
- return ami_find_tab_gwin(node->objstruct, tab);
- }
- } while((node = nnode));
- }
- return NULL;
-}
-
-STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct dlnode *dln;
- struct gui_window *gw = cur_gw;
- nsurl *url;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[4]) && (cmd->ac_ArgList[5]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[4], *(ULONG *)cmd->ac_ArgList[5]);
-
- if (nsurl_create((char *)cmd->ac_ArgList[0], &url) != NSERROR_OK) {
- amiga_warn_user("NoMemory", 0);
- return;
- }
-
- if(cmd->ac_ArgList[3])
- {
- if(!gw) return;
-
- dln = ami_misc_allocvec_clear(sizeof(struct dlnode), 0);
- dln->filename = strdup((char *)cmd->ac_ArgList[3]);
- dln->node.ln_Name = strdup((char *)cmd->ac_ArgList[0]);
- dln->node.ln_Type = NT_USER;
- AddTail(&gw->dllist, (struct Node *)dln);
- browser_window_navigate(gw->bw,
- url,
- NULL,
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
- }
- else if(cmd->ac_ArgList[2])
- {
- browser_window_create(BW_CREATE_HISTORY |
- BW_CREATE_TAB,
- url,
- NULL,
- gw->bw,
- NULL);
- }
- else if(cmd->ac_ArgList[1])
- {
- browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- }
- else
- {
- if(gw)
- {
- browser_window_navigate(gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- }
- else
- {
- browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- }
- }
- nsurl_unref(url);
-}
-
-STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- BPTR fh = 0;
- ULONG source_size;
- const char *source_data;
- struct gui_window *gw = cur_gw;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[1]) && (cmd->ac_ArgList[2]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[1], *(ULONG *)cmd->ac_ArgList[2]);
-
- if(!gw) return;
-
- ami_set_pointer(gw->shared, GUI_POINTER_WAIT, false);
-
- if((fh = FOpen((char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0)))
- {
- hlcache_handle *h = browser_window_get_content(gw->bw);
- if((source_data = content_get_source_data(h, &source_size)))
- FWrite(fh, source_data, 1, source_size);
-
- FClose(fh);
- SetComment((char *)cmd->ac_ArgList[0], nsurl_access(browser_window_get_url(gw->bw)));
- }
-
- ami_reset_pointer(gw->shared);
-}
-
-STATIC VOID rx_quit(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- cmd->ac_RC = 0;
- ami_quit_netsurf();
-}
-
-STATIC VOID rx_tofront(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- cmd->ac_RC = 0;
- ScreenToFront(scrn);
-}
-
-STATIC VOID rx_geturl(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct gui_window *gw = cur_gw;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
-
- if(gw && gw->bw)
- {
- strcpy(result, nsurl_access(browser_window_get_url(gw->bw)));
- }
- else
- {
- strcpy(result,"");
- }
-
- cmd->ac_Result = result;
-}
-
-STATIC VOID rx_gettitle(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct gui_window *gw = cur_gw;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
-
- if(gw)
- {
- if(gw->shared->tabs > 1)
- strcpy(result, gw->tabtitle);
- else
- strcpy(result, gw->shared->wintitle);
- }
- else
- {
- strcpy(result,"");
- }
-
- cmd->ac_Result = result;
-}
-
-STATIC VOID rx_version(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- cmd->ac_RC = 0;
-
- if(cmd->ac_ArgList[2])
- {
- if(cmd->ac_ArgList[1])
- {
- if((netsurf_version_major > *(int *)cmd->ac_ArgList[0]) || ((netsurf_version_minor >= *(int *)cmd->ac_ArgList[1]) && (netsurf_version_major == *(int *)cmd->ac_ArgList[0])))
- {
- strcpy(result,"1");
- }
- else
- {
- strcpy(result,"0");
- }
- }
- else if(cmd->ac_ArgList[0])
- {
- if((netsurf_version_major >= *(int *)cmd->ac_ArgList[0]))
- {
- strcpy(result,"1");
- }
- else
- {
- strcpy(result,"0");
- }
- }
- else
- {
- strcpy(result,netsurf_version);
- }
- }
- else
- {
- if(cmd->ac_ArgList[1])
- {
- if((netsurf_version_major > *(int *)cmd->ac_ArgList[0]) || ((atoi(wt_revid) >= *(int *)cmd->ac_ArgList[1]) && (netsurf_version_major == *(int *)cmd->ac_ArgList[0])))
- {
- strcpy(result,"1");
- }
- else
- {
- strcpy(result,"0");
- }
- }
- else if(cmd->ac_ArgList[0])
- {
- if((netsurf_version_major >= *(int *)cmd->ac_ArgList[0]))
- {
- strcpy(result,"1");
- }
- else
- {
- strcpy(result,"0");
- }
- }
- else
- {
- strcpy(result,verarexx);
- }
- }
-
- cmd->ac_Result = result;
-}
-
-STATIC VOID rx_pubscreen(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- cmd->ac_RC = 0;
-
- if(nsoption_charp(pubscreen_name) == NULL)
- {
- strcpy(result,"NetSurf");
- }
- else
- {
- strcpy(result, nsoption_charp(pubscreen_name));
- }
-
- cmd->ac_Result = result;
-}
-
-STATIC VOID rx_back(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct gui_window *gw = cur_gw;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
-
- if(gw) ami_gui_history(gw->shared, true);
-}
-
-STATIC VOID rx_forward(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct gui_window *gw = cur_gw;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
-
- if(gw) ami_gui_history(gw->shared, false);
-
-}
-
-STATIC VOID rx_home(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct gui_window *gw = cur_gw;
- nsurl *url;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
-
- if(gw == NULL) return;
-
- if (nsurl_create(nsoption_charp(homepage_url), &url) != NSERROR_OK) {
- amiga_warn_user("NoMemory", 0);
- } else {
- browser_window_navigate(gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
-}
-
-STATIC VOID rx_reload(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct gui_window *gw = cur_gw;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[1]) && (cmd->ac_ArgList[2]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[1], *(ULONG *)cmd->ac_ArgList[2]);
-
- if(gw)
- {
- if(cmd->ac_ArgList[0]) /* FORCE */
- {
- browser_window_reload(gw->bw, true);
- }
- else
- {
- browser_window_reload(gw->bw, false);
- }
- }
-}
-
-STATIC VOID rx_windows(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- int windows = 0, tabs = 0;
- int window = 0;
-
- if(cmd->ac_ArgList[0]) window = *(ULONG *)cmd->ac_ArgList[0];
- cmd->ac_RC = 0;
-
- windows = ami_gui_count_windows(window, &tabs);
-
- if(cmd->ac_ArgList[0]) sprintf(result, "%d", tabs);
- else sprintf(result, "%d", windows);
- cmd->ac_Result = result;
-}
-
-STATIC VOID rx_active(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- int window = 0, tab = 0;
- struct gui_window *gw = cur_gw;
- struct nsObject *node, *nnode;
- struct gui_window_2 *gwin = NULL;
-
- cmd->ac_RC = 0;
-
- if(!IsMinListEmpty(window_list))
- {
- int windows = 0;
-
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- gwin = node->objstruct;
-
- if(node->Type == AMINS_WINDOW)
- {
- windows++;
- if(gwin->gw == gw)
- {
- window = windows;
- break;
- }
- }
- } while((node = nnode));
- }
-
- if(cmd->ac_ArgList[0])
- {
- tab = ami_find_tab_bw(gwin, gw->bw);
- }
-
- if(cmd->ac_ArgList[0]) sprintf(result, "%d", tab);
- else sprintf(result, "%d", window);
- cmd->ac_Result = result;
-}
-
-STATIC VOID rx_close(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- struct gui_window *gw = cur_gw;
-
- cmd->ac_RC = 0;
-
- if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
- gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
- else if(cmd->ac_ArgList[0])
- {
- ami_gui_close_window(gw->shared);
- return;
- }
-
- if(gw) browser_window_destroy(gw->bw);
-}
-
-STATIC VOID rx_hotlist(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
-{
- cmd->ac_RC = 0;
-
- if(strcasecmp((char *)cmd->ac_ArgList[0], "OPEN") == 0) {
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
- } else if(strcasecmp((char *)cmd->ac_ArgList[0], "CLOSE") == 0) {
- ami_tree_close(hotlist_window);
- }
-}
-
diff --git a/amiga/arexx.h b/amiga/arexx.h
deleted file mode 100755
index 358d174f3..000000000
--- a/amiga/arexx.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_AREXX_H
-#define AMIGA_AREXX_H
-
-#include <proto/arexx.h>
-#include <classes/arexx.h>
-
-BOOL ami_arexx_init(void);
-void ami_arexx_handle(void);
-void ami_arexx_execute(char *);
-void ami_arexx_cleanup(void);
-
-Object *arexx_obj;
-ULONG rxsig;
-#endif
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
deleted file mode 100644
index d04857262..000000000
--- a/amiga/bitmap.c
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * Copyright 2008, 2009, 2012, 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-#include <proto/exec.h>
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#include <graphics/composite.h>
-#endif
-#include <graphics/gfxbase.h>
-#include <proto/datatypes.h>
-#include <datatypes/pictureclass.h>
-#include <proto/dos.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-
-#include <proto/guigfx.h>
-#include <guigfx/guigfx.h>
-#include <render/render.h>
-#ifndef __amigaos4__
-#include <inline/guigfx.h>
-#endif
-
-#ifdef __amigaos4__
-#include <sys/param.h>
-#endif
-#include "assert.h"
-
-#include "utils/log.h"
-#include "utils/nsoption.h"
-#include "utils/nsurl.h"
-#include "utils/messages.h"
-#include "content/hlcache.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-#include "image/bitmap.h"
-
-#include "amiga/gui.h"
-#include "amiga/bitmap.h"
-#include "amiga/download.h"
-#include "amiga/misc.h"
-#include "amiga/rtg.h"
-
-struct bitmap {
- int width;
- int height;
- UBYTE *pixdata;
- bool opaque;
- int native;
- struct BitMap *nativebm;
- int nativebmwidth;
- int nativebmheight;
- PLANEPTR native_mask;
- Object *dto;
- APTR drawhandle;
- struct nsurl *url; /* temporary storage space */
- char *title; /* temporary storage space */
- ULONG *icondata; /* for appicons */
-};
-
-enum {
- AMI_NSBM_NONE = 0,
- AMI_NSBM_TRUECOLOUR,
- AMI_NSBM_PALETTEMAPPED
-};
-
-APTR pool_bitmap = NULL;
-
-/* exported function documented in amiga/bitmap.h */
-void *amiga_bitmap_create(int width, int height, unsigned int state)
-{
- struct bitmap *bitmap;
-
- if(pool_bitmap == NULL) pool_bitmap = ami_misc_itempool_create(sizeof(struct bitmap));
-
- bitmap = ami_misc_itempool_alloc(pool_bitmap, sizeof(struct bitmap));
- if(bitmap == NULL) return NULL;
-
- bitmap->pixdata = ami_misc_allocvec_clear(width*height*4, 0xff);
- bitmap->width = width;
- bitmap->height = height;
-
- if(state & BITMAP_OPAQUE) bitmap->opaque = true;
- else bitmap->opaque = false;
-
- bitmap->nativebm = NULL;
- bitmap->nativebmwidth = 0;
- bitmap->nativebmheight = 0;
- bitmap->native_mask = NULL;
- bitmap->drawhandle = NULL;
- bitmap->url = NULL;
- bitmap->title = NULL;
- bitmap->icondata = NULL;
- bitmap->native = AMI_NSBM_NONE;
-
- return bitmap;
-}
-
-
-/* exported function documented in amiga/bitmap.h */
-unsigned char *amiga_bitmap_get_buffer(void *bitmap)
-{
- struct bitmap *bm = bitmap;
- return bm->pixdata;
-}
-
-/* exported function documented in amiga/bitmap.h */
-size_t amiga_bitmap_get_rowstride(void *bitmap)
-{
- struct bitmap *bm = bitmap;
-
- if(bm)
- {
- return ((bm->width)*4);
- }
- else
- {
- return 0;
- }
-}
-
-
-/* exported function documented in amiga/bitmap.h */
-void amiga_bitmap_destroy(void *bitmap)
-{
- struct bitmap *bm = bitmap;
-
- if(bm)
- {
- if((bm->nativebm)) { // && (bm->native == AMI_NSBM_TRUECOLOUR)) {
- ami_rtg_freebitmap(bm->nativebm);
- }
-
- if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
- if(bm->drawhandle) ReleaseDrawHandle(bm->drawhandle);
- FreeVec(bm->pixdata);
-
- if(bm->url) nsurl_unref(bm->url);
- if(bm->title) free(bm->title);
-
- bm->pixdata = NULL;
- bm->nativebm = NULL;
- bm->native_mask = NULL;
- bm->drawhandle = NULL;
- bm->url = NULL;
- bm->title = NULL;
-
- ami_misc_itempool_free(pool_bitmap, bm, sizeof(struct bitmap));
- bm = NULL;
- }
-}
-
-
-/* exported function documented in amiga/bitmap.h */
-bool amiga_bitmap_save(void *bitmap, const char *path, unsigned flags)
-{
- int err = 0;
- Object *dto = NULL;
-
- if((dto = ami_datatype_object_from_bitmap(bitmap)))
- {
- if (flags & AMI_BITMAP_SCALE_ICON) {
- IDoMethod(dto, PDTM_SCALE, 16, 16, 0);
-
- if((DoDTMethod(dto, 0, 0, DTM_PROCLAYOUT, 0, 1)) == 0) {
- return false;
- }
- }
-
- err = SaveDTObjectA(dto, NULL, NULL, path, DTWM_IFF, FALSE, NULL);
- DisposeDTObject(dto);
- }
-
- if(err == 0) return false;
- else return true;
-}
-
-
-/* exported function documented in amiga/bitmap.h */
-void amiga_bitmap_modified(void *bitmap)
-{
- struct bitmap *bm = bitmap;
-
- if((bm->nativebm)) // && (bm->native == AMI_NSBM_TRUECOLOUR))
- ami_rtg_freebitmap(bm->nativebm);
-
- if(bm->drawhandle) ReleaseDrawHandle(bm->drawhandle);
- if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
- bm->nativebm = NULL;
- bm->drawhandle = NULL;
- bm->native_mask = NULL;
- bm->native = AMI_NSBM_NONE;
-}
-
-
-/* exported function documented in amiga/bitmap.h */
-void amiga_bitmap_set_opaque(void *bitmap, bool opaque)
-{
- struct bitmap *bm = bitmap;
- assert(bitmap);
- bm->opaque = opaque;
-}
-
-
-/* exported function documented in amiga/bitmap.h */
-bool amiga_bitmap_test_opaque(void *bitmap)
-{
- struct bitmap *bm = bitmap;
- uint32 p = bm->width * bm->height;
- uint32 a = 0;
- uint32 *bmi = (uint32 *)amiga_bitmap_get_buffer(bm);
-
- assert(bitmap);
-
- for(a=0;a<p;a+=4)
- {
- if ((*bmi & 0x000000ffU) != 0x000000ffU) return false;
- bmi++;
- }
- return true;
-}
-
-
-/* exported function documented in amiga/bitmap.h */
-bool amiga_bitmap_get_opaque(void *bitmap)
-{
- struct bitmap *bm = bitmap;
- assert(bitmap);
- return bm->opaque;
-}
-
-/**
- * get width of a bitmap.
- */
-int bitmap_get_width(void *bitmap)
-{
- struct bitmap *bm = bitmap;
-
- if(bm)
- {
- return(bm->width);
- }
- else
- {
- return 0;
- }
-}
-
-/**
- * get height of a bitmap.
- */
-int bitmap_get_height(void *bitmap)
-{
- struct bitmap *bm = bitmap;
-
- if(bm)
- {
- return(bm->height);
- }
- else
- {
- return 0;
- }
-}
-
-
-/**
- * Find the bytes per pixel of a bitmap
- *
- * \param vbitmap a bitmap, as returned by bitmap_create()
- * \return bytes per pixel
- */
-static size_t bitmap_get_bpp(void *vbitmap)
-{
- struct bitmap *bitmap = (struct bitmap *)vbitmap;
- assert(bitmap);
- return 4;
-}
-
-static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[i] << 8) | (data[i] >> 24);
- }
-}
-
-static void ami_bitmap_rgba_to_argb(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[i] >> 8) | (data[i] << 24);
- }
-}
-
-#ifdef BITMAP_DUMP
-void bitmap_dump(struct bitmap *bitmap)
-{
- int x,y;
- ULONG *bm = (ULONG *)amiga_bitmap_get_buffer(bitmap);
-
- printf("Width=%ld, Height=%ld, Opaque=%s\nnativebm=%lx, width=%ld, height=%ld\n",
- bitmap->width, bitmap->height, bitmap->opaque ? "true" : "false",
- bitmap->nativebm, bitmap->nativebmwidth, bitmap->nativebmheight);
-
- for(y = 0; y < bitmap->height; y++) {
- for(x = 0; x < bitmap->width; x++) {
- printf("%lx ", bm[(y*bitmap->width) + x]);
- }
- printf("\n");
- }
-}
-#endif
-
-Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
-{
- Object *dto;
- struct BitMapHeader *bmhd;
-
- if((dto = NewDTObject(NULL,
- DTA_SourceType,DTST_RAM,
- DTA_GroupID,GID_PICTURE,
- //DTA_BaseName,"ilbm",
- PDTA_DestMode,PMODE_V43,
- TAG_DONE)))
- {
- if(GetDTAttrs(dto,PDTA_BitMapHeader,&bmhd,TAG_DONE))
- {
- bmhd->bmh_Width = (UWORD)bitmap_get_width(bitmap);
- bmhd->bmh_Height = (UWORD)bitmap_get_height(bitmap);
- bmhd->bmh_Depth = (UBYTE)bitmap_get_bpp(bitmap) * 8;
- if(!amiga_bitmap_get_opaque(bitmap)) bmhd->bmh_Masking = mskHasAlpha;
- }
-
- SetDTAttrs(dto,NULL,NULL,
- DTA_ObjName, bitmap->url ? nsurl_access(bitmap->url) : "",
- DTA_ObjAnnotation,bitmap->title,
- DTA_ObjAuthor,messages_get("NetSurf"),
- DTA_NominalHoriz,bitmap_get_width(bitmap),
- DTA_NominalVert,bitmap_get_height(bitmap),
- PDTA_SourceMode,PMODE_V43,
- TAG_DONE);
-
- IDoMethod(dto, PDTM_WRITEPIXELARRAY, amiga_bitmap_get_buffer(bitmap),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bitmap), 0, 0,
- bitmap_get_width(bitmap), bitmap_get_height(bitmap));
- }
-
- return dto;
-}
-
-/* Quick way to get an object on disk into a struct bitmap */
-struct bitmap *ami_bitmap_from_datatype(char *filename)
-{
- Object *dto;
- struct bitmap *bm = NULL;
-
- if((dto = NewDTObject(filename,
- DTA_GroupID, GID_PICTURE,
- PDTA_DestMode, PMODE_V43,
- PDTA_PromoteMask, TRUE,
- TAG_DONE))) {
- struct BitMapHeader *bmh;
-
- if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE))
- {
- bm = amiga_bitmap_create(bmh->bmh_Width, bmh->bmh_Height, 0);
-
- IDoMethod(dto, PDTM_READPIXELARRAY, amiga_bitmap_get_buffer(bm),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bm), 0, 0,
- bmh->bmh_Width, bmh->bmh_Height);
-
- amiga_bitmap_set_opaque(bm, amiga_bitmap_test_opaque(bm));
- }
- DisposeDTObject(dto);
- }
-
- return bm;
-}
-
-static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int width, int height, struct BitMap *friendbm, int type)
-{
- struct BitMap *tbm = NULL;
-
- if(bitmap->nativebm)
- {
- if((bitmap->nativebmwidth == width) && (bitmap->nativebmheight == height)) {
- tbm = bitmap->nativebm;
- return tbm;
- } else if((bitmap->nativebmwidth == bitmap->width) &&
- (bitmap->nativebmheight == bitmap->height)) { // >= width/height ?
- tbm = bitmap->nativebm;
- } else {
- if(bitmap->nativebm) amiga_bitmap_modified(bitmap);
- }
- }
-
- if(tbm == NULL) {
- if(type == AMI_NSBM_TRUECOLOUR) {
- if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0,
- friendbm, AMI_BITMAP_FORMAT))) {
- ami_rtg_writepixelarray(amiga_bitmap_get_buffer(bitmap),
- tbm, bitmap->width, bitmap->height,
- bitmap->width * 4, AMI_BITMAP_FORMAT);
- }
- } else {
- if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height,
- 8, 0, friendbm, AMI_BITMAP_FORMAT))) {
-
- struct RastPort rp;
- InitRastPort(&rp);
- rp.BitMap = tbm;
- ULONG dithermode = DITHERMODE_NONE;
-
- if(nsoption_int(dither_quality) == 1) {
- dithermode = DITHERMODE_EDD;
- } else if(nsoption_int(dither_quality) == 2) {
- dithermode = DITHERMODE_FS;
- }
-
- ami_bitmap_rgba_to_argb(bitmap);
- bitmap->drawhandle = ObtainDrawHandle(NULL,
- &rp, scrn->ViewPort.ColorMap,
- GGFX_DitherMode, dithermode,
- TAG_DONE);
-
- APTR ddh = CreateDirectDrawHandle(bitmap->drawhandle,
- bitmap->width, bitmap->height,
- bitmap->width, bitmap->height, NULL);
-
- DirectDrawTrueColor(ddh, (ULONG *)amiga_bitmap_get_buffer(bitmap), 0, 0, TAG_DONE);
- DeleteDirectDrawHandle(ddh);
- ami_bitmap_argb_to_rgba(bitmap);
- }
- }
-
- if(nsoption_int(cache_bitmaps) == 2)
- {
- bitmap->nativebm = tbm;
- bitmap->nativebmwidth = bitmap->width;
- bitmap->nativebmheight = bitmap->height;
- bitmap->native = type;
- }
- }
-
- if((bitmap->width != width) || (bitmap->height != height))
- {
- struct BitMap *scaledbm;
- struct BitScaleArgs bsa;
- int depth = 32;
- if(type == AMI_NSBM_PALETTEMAPPED) depth = 8;
-
- scaledbm = ami_rtg_allocbitmap(width, height, depth, 0,
- friendbm, AMI_BITMAP_FORMAT);
-#ifdef __amigaos4__
- if(__builtin_expect(((GfxBase->LibNode.lib_Version >= 53) &&
- (type == AMI_NSBM_TRUECOLOUR)), 1)) {
- /* AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
- * Additionally, when we use friend BitMaps in non 32-bit modes it freezes the OS */
- uint32 flags = 0;
- if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter;
-
- CompositeTags(COMPOSITE_Src, tbm, scaledbm,
- COMPTAG_ScaleX, COMP_FLOAT_TO_FIX((float)width/bitmap->width),
- COMPTAG_ScaleY, COMP_FLOAT_TO_FIX((float)height/bitmap->height),
- COMPTAG_Flags, flags,
- COMPTAG_DestX, 0,
- COMPTAG_DestY, 0,
- COMPTAG_DestWidth, width,
- COMPTAG_DestHeight, height,
- COMPTAG_OffsetX, 0,
- COMPTAG_OffsetY, 0,
- COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
- TAG_DONE);
- } else /* Do it the old-fashioned way. This is pretty slow, even on OS4.1 */
-#endif
- {
- bsa.bsa_SrcX = 0;
- bsa.bsa_SrcY = 0;
- bsa.bsa_SrcWidth = bitmap->width;
- bsa.bsa_SrcHeight = bitmap->height;
- bsa.bsa_DestX = 0;
- bsa.bsa_DestY = 0;
- bsa.bsa_XSrcFactor = bitmap->width;
- bsa.bsa_XDestFactor = width;
- bsa.bsa_YSrcFactor = bitmap->height;
- bsa.bsa_YDestFactor = height;
- bsa.bsa_SrcBitMap = tbm;
- bsa.bsa_DestBitMap = scaledbm;
- bsa.bsa_Flags = 0;
-
- BitMapScale(&bsa);
- }
-
- if(bitmap->nativebm != tbm) ami_rtg_freebitmap(bitmap->nativebm);
- ami_rtg_freebitmap(tbm);
- tbm = scaledbm;
- bitmap->nativebm = NULL;
- bitmap->native = AMI_NSBM_NONE;
-
- if(nsoption_int(cache_bitmaps) >= 1)
- {
- bitmap->nativebm = tbm;
- bitmap->nativebmwidth = width;
- bitmap->nativebmheight = height;
- bitmap->native = type;
- }
- }
-
- return tbm;
-}
-
-
-static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm)
-{
- if((bitmap->native != AMI_NSBM_NONE) && (bitmap->native != AMI_NSBM_TRUECOLOUR)) {
- amiga_bitmap_modified(bitmap);
- }
-
- return ami_bitmap_get_generic(bitmap, width, height, friendbm, AMI_NSBM_TRUECOLOUR);
-}
-
-PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
- int height, struct BitMap *n_bm)
-{
- uint32 *bmi = (uint32 *) amiga_bitmap_get_buffer(bitmap);
- UBYTE maskbit = 0;
- ULONG bm_width;
- int y, x, bpr;
-
- if((height != bitmap->height) || (width != bitmap->width)) return NULL;
- if(amiga_bitmap_get_opaque(bitmap) == true) return NULL;
- if(bitmap->native_mask) return bitmap->native_mask;
-
- bm_width = GetBitMapAttr(n_bm, BMA_WIDTH);
- bpr = RASSIZE(bm_width, 1);
- bitmap->native_mask = AllocRaster(bm_width, height);
- SetMem(bitmap->native_mask, 0, bpr * height);
-
- for(y=0; y<height; y++) {
- for(x=0; x<width; x++) {
- if ((*bmi & 0x000000ffU) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
- else maskbit = 1;
- bmi++;
- bitmap->native_mask[(y*bpr) + (x/8)] |=
- maskbit << (7 - (x % 8));
- }
- }
-
- return bitmap->native_mask;
-}
-
-static inline struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm)
-{
- if((bitmap->native != AMI_NSBM_NONE) && (bitmap->native != AMI_NSBM_PALETTEMAPPED)) {
- amiga_bitmap_modified(bitmap);
- }
-
- return ami_bitmap_get_generic(bitmap, width, height, friendbm, AMI_NSBM_PALETTEMAPPED);
-}
-
-struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm)
-{
- if(bitmap == NULL) return NULL;
-
- if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
- return ami_bitmap_get_palettemapped(bitmap, width, height, friendbm);
- } else {
- return ami_bitmap_get_truecolour(bitmap, width, height, friendbm);
- }
-}
-
-void ami_bitmap_fini(void)
-{
- if(pool_bitmap) ami_misc_itempool_delete(pool_bitmap);
- pool_bitmap = NULL;
-}
-
-static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
-{
-#ifdef __amigaos4__
- struct redraw_context ctx = {
- .interactive = false,
- .background_images = true,
- .plot = &amiplot
- };
-
- int plot_width;
- int plot_height;
- struct gui_globals bm_globals;
- struct gui_globals *temp_gg = glob;
-
- plot_width = MIN(content_get_width(content), bitmap->width);
- plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
- bitmap->width;
-
- ami_init_layers(&bm_globals, bitmap->width, bitmap->height, true);
- bm_globals.shared_pens = NULL;
-
- glob = &bm_globals;
- ami_clearclipreg(&bm_globals);
-
- content_scaled_redraw(content, plot_width, plot_height, &ctx);
-
- BltBitMapTags( BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_Width, bitmap->width,
- BLITA_Height, bitmap->height,
- BLITA_Source, bm_globals.bm,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_Dest, amiga_bitmap_get_buffer(bitmap),
- BLITA_DestType, BLITT_ARGB32,
- BLITA_DestBytesPerRow, 4 * bitmap->width,
- BLITA_DestX, 0,
- BLITA_DestY, 0,
- TAG_DONE);
-
- ami_bitmap_argb_to_rgba(bitmap);
-
- /**\todo In theory we should be able to move the bitmap to our native area
- to try to avoid re-conversion (at the expense of memory) */
-
- ami_free_layers(&bm_globals);
- amiga_bitmap_set_opaque(bitmap, true);
-
- /* Restore previous render area. This is set when plotting starts,
- * but if bitmap_render is called *during* a browser render then
- * having an invalid pointer here causes NetSurf to crash.
- */
- glob = temp_gg;
-#else
-#warning FIXME for OS3 (in current state none of bitmap_render can work!)
-#endif
-
- return NSERROR_OK;
-}
-
-void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url)
-{
- if(bm->url != NULL) return;
- bm->url = nsurl_ref(url);
-}
-
-void ami_bitmap_set_title(struct bitmap *bm, const char *title)
-{
- if(bm->title != NULL) return;
- bm->title = strdup(title);
-}
-
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
-{
- return bm->icondata;
-}
-
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
-{
- bm->icondata = icondata;
-}
-
-bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
-{
- if(bm->nativebm == nbm) return true;
- else return false;
-}
-
-
-static struct gui_bitmap_table bitmap_table = {
- .create = amiga_bitmap_create,
- .destroy = amiga_bitmap_destroy,
- .set_opaque = amiga_bitmap_set_opaque,
- .get_opaque = amiga_bitmap_get_opaque,
- .test_opaque = amiga_bitmap_test_opaque,
- .get_buffer = amiga_bitmap_get_buffer,
- .get_rowstride = amiga_bitmap_get_rowstride,
- .get_width = bitmap_get_width,
- .get_height = bitmap_get_height,
- .get_bpp = bitmap_get_bpp,
- .save = amiga_bitmap_save,
- .modified = amiga_bitmap_modified,
- .render = bitmap_render,
-};
-
-struct gui_bitmap_table *amiga_bitmap_table = &bitmap_table;
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
deleted file mode 100755
index d7dd70bce..000000000
--- a/amiga/bitmap.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2008,2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_BITMAP_H
-#define AMIGA_BITMAP_H
-
-#include <stdbool.h>
-#include <exec/types.h>
-#include <proto/graphics.h>
-#include <intuition/classusr.h>
-#include <libraries/Picasso96.h>
-
-#define AMI_BITMAP_FORMAT RGBFB_R8G8B8A8
-#define AMI_BITMAP_SCALE_ICON 0xFF
-
-struct gui_bitmap_table *amiga_bitmap_table;
-struct bitmap;
-struct nsurl;
-
-struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm);
-PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
- int height, struct BitMap *n_bm);
-
-Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
-struct bitmap *ami_bitmap_from_datatype(char *filename);
-
-/**
- * Set bitmap URL
- *
- * \param bm a bitmap, as returned by bitmap_create()
- * \param title a pointer to a title string
- *
- * A reference will be kept by the bitmap object.
- * The URL can only ever be set once for a bitmap.
- */
-void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
-
-/**
- * Set bitmap title
- *
- * \param bm a bitmap, as returned by bitmap_create()
- * \param title a pointer to a title string
- *
- * This is copied by the bitmap object.
- * The title can only ever be set once for a bitmap.
- */
-void ami_bitmap_set_title(struct bitmap *bm, const char *title);
-
-/**
- * Get an icondata pointer
- *
- * \param bm a bitmap, as returned by bitmap_create()
- * \return pointer to the icondata area
- *
- * This function probably shouldn't be here!
- */
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm);
-
-/**
- * Set an icondata pointer
- *
- * \param bm a bitmap, as returned by bitmap_create()
- * \param icondata a pointer to memory
- *
- * This function probably shouldn't be here!
- */
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
-
-/**
- * Test if a BitMap is owned by a bitmap.
- *
- * \param bm a bitmap, as returned by bitmap_create()
- * \param nbm a BitMap, as created by AllocBitMap()
- * \return true if the BitMap is owned by the bitmap
- */
-bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm);
-
-/**
- * Cleanup bitmap allocations
- */
-void ami_bitmap_fini(void);
-
-/**
- * Create a bitmap.
- *
- * \param width width of image in pixels
- * \param height width of image in pixels
- * \param state a flag word indicating the initial state
- * \return an opaque struct bitmap, or NULL on memory exhaustion
- */
-void *amiga_bitmap_create(int width, int height, unsigned int state);
-
-/**
- * Return a pointer to the pixel data in a bitmap.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \return pointer to the pixel buffer
- *
- * The pixel data is packed as BITMAP_FORMAT, possibly with padding at the end
- * of rows. The width of a row in bytes is given by bitmap_get_rowstride().
- */
-unsigned char *amiga_bitmap_get_buffer(void *bitmap);
-
-/**
- * Find the width of a pixel row in bytes.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \return width of a pixel row in the bitmap
- */
-size_t amiga_bitmap_get_rowstride(void *bitmap);
-
-/**
- * Return the width of a bitmap.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \return width in pixels
- */
-int bitmap_get_width(void *bitmap);
-
-/**
- * Return the height of a bitmap.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \return height in pixels
- */
-int bitmap_get_height(void *bitmap);
-
-/**
- * Free a bitmap.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- */
-void amiga_bitmap_destroy(void *bitmap);
-
-/**
- * Save a bitmap in the platform's native format.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \param path pathname for file
- * \param flags flags controlling how the bitmap is saved.
- * \return true on success, false on error and error reported
- */
-bool amiga_bitmap_save(void *bitmap, const char *path, unsigned flags);
-
-/**
- * The bitmap image has changed, so flush any persistant cache.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- */
-void amiga_bitmap_modified(void *bitmap);
-
-/**
- * Sets whether a bitmap should be plotted opaque
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \param opaque whether the bitmap should be plotted opaque
- */
-void amiga_bitmap_set_opaque(void *bitmap, bool opaque);
-
-/**
- * Tests whether a bitmap has an opaque alpha channel
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \return whether the bitmap is opaque
- */
-bool amiga_bitmap_test_opaque(void *bitmap);
-
-/**
- * Gets whether a bitmap should be plotted opaque
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- */
-bool amiga_bitmap_get_opaque(void *bitmap);
-
-
-#endif
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
deleted file mode 100644
index 12ceb0f09..000000000
--- a/amiga/clipboard.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright 2008-2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <proto/iffparse.h>
-#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/datatypes.h>
-#include <proto/diskfont.h>
-
-#include <diskfont/diskfonttag.h>
-#include <datatypes/textclass.h>
-#include <datatypes/pictureclass.h>
-
-#include "utils/nsoption.h"
-#include "utils/utf8.h"
-#include "utils/nsurl.h"
-#include "content/hlcache.h"
-#include "desktop/browser.h"
-#include "desktop/plotters.h"
-#include "desktop/textinput.h"
-#include "desktop/gui_window.h"
-#include "desktop/gui_clipboard.h"
-
-#include "amiga/bitmap.h"
-#include "amiga/clipboard.h"
-#include "amiga/drag.h"
-#include "amiga/filetype.h"
-#include "amiga/gui.h"
-#include "amiga/iff_cset.h"
-#include "amiga/iff_dr2d.h"
-#include "amiga/menu.h"
-#include "amiga/misc.h"
-#include "amiga/utf8.h"
-
-#define ID_UTF8 MAKE_ID('U','T','F','8')
-
-struct IFFHandle *iffh = NULL;
-
-static struct IFFHandle *ami_clipboard_init_internal(int unit)
-{
- struct IFFHandle *iffhandle = NULL;
-
- if((iffhandle = AllocIFF()))
- {
- if((iffhandle->iff_Stream = (ULONG)OpenClipboard(unit)))
- {
- InitIFFasClip(iffhandle);
- }
- }
-
- return iffhandle;
-}
-
-void ami_clipboard_init(void)
-{
- iffh = ami_clipboard_init_internal(0);
-}
-
-static void ami_clipboard_free_internal(struct IFFHandle *iffhandle)
-{
- if(iffhandle == NULL) return;
- if(iffhandle->iff_Stream) CloseClipboard((struct ClipboardHandle *)iffhandle->iff_Stream);
- FreeIFF(iffhandle);
-}
-
-void ami_clipboard_free(void)
-{
- ami_clipboard_free_internal(iffh);
-}
-
-void gui_start_selection(struct gui_window *g)
-{
- if(!g) return;
- if(!g->shared->win) return;
- if(nsoption_bool(kiosk_mode) == true) return;
-
- OnMenu(g->shared->win, AMI_MENU_CLEAR);
- OnMenu(g->shared->win, AMI_MENU_COPY);
-
- if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_CUT)
- OnMenu(g->shared->win, AMI_MENU_CUT);
-}
-
-static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size_t *text_length)
-{
- struct CollectionItem *ci_new = NULL, *ci_next = NULL, *ci_curr = ci;
- size_t len = 0;
- char *text = NULL, *p;
-
- /* Scan the collected chunks to find out the total size.
- * If they are not in UTF-8, convert the chunks first and create a new CollectionItem list.
- */
- do {
- switch(codeset) {
- case 106:
- len += ci_curr->ci_Size;
- break;
-
- case 0:
- if(ci_new) {
- ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
- ci_next = ci_next->ci_Next;
- } else {
- ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
- ci_next = ci_new;
- }
-
- utf8_from_local_encoding(ci_curr->ci_Data, ci_curr->ci_Size, (char **)&ci_next->ci_Data);
- ci_next->ci_Size = strlen(ci_next->ci_Data);
- len += ci_next->ci_Size;
- break;
-
- default:
- if(ci_new) {
- ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
- ci_next = ci_next->ci_Next;
- } else {
- ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
- ci_next = ci_new;
- }
-
- utf8_from_enc(ci_curr->ci_Data,
- (const char *)ObtainCharsetInfo(DFCS_NUMBER,
- codeset, DFCS_MIMENAME),
- ci_curr->ci_Size, (char **)&ci_next->ci_Data, NULL);
- ci_next->ci_Size = strlen(ci_next->ci_Data);
- len += ci_next->ci_Size;
- break;
- }
- } while ((ci_curr = ci_curr->ci_Next));
-
- text = malloc(len);
-
- if(text == NULL) return NULL;
-
- /* p points to the end of the buffer. This is because the chunks are
- * in the list in reverse order. */
- p = text + len;
-
- if(ci_new) {
- ci_curr = ci_new;
- } else {
- ci_curr = ci;
- }
-
- do {
- p -= ci_curr->ci_Size;
- memcpy(p, ci_curr->ci_Data, ci_curr->ci_Size);
- ci_next = ci_curr->ci_Next;
-
- if(ci_new) {
- free(ci_curr->ci_Data);
- FreeVec(ci_curr);
- }
- } while ((ci_curr = ci_next));
-
- *text_length = len;
- return text;
-}
-
-static void gui_get_clipboard(char **buffer, size_t *length)
-{
- struct CollectionItem *ci = NULL;
- struct StoredProperty *sp = NULL;
- struct CSet *cset;
-
- if(OpenIFF(iffh,IFFF_READ)) return;
-
- if(CollectionChunk(iffh,ID_FTXT,ID_CHRS)) return;
- if(PropChunk(iffh,ID_FTXT,ID_CSET)) return;
- if(CollectionChunk(iffh,ID_FTXT,ID_UTF8)) return;
- if(StopOnExit(iffh, ID_FTXT, ID_FORM)) return;
-
- ParseIFF(iffh,IFFPARSE_SCAN);
-
- if((ci = FindCollection(iffh, ID_FTXT, ID_UTF8))) {
- *buffer = ami_clipboard_cat_collection(ci, 106, length);
- } else if((ci = FindCollection(iffh, ID_FTXT, ID_CHRS))) {
- LONG codeset = 0;
- if((sp = FindProp(iffh, ID_FTXT, ID_CSET))) {
- cset = (struct CSet *)sp->sp_Data;
- codeset = cset->CodeSet;
- }
- *buffer = ami_clipboard_cat_collection(ci, codeset, length);
- }
-
- CloseIFF(iffh);
-}
-
-static void gui_set_clipboard(const char *buffer, size_t length,
- nsclipboard_styles styles[], int n_styles)
-{
- char *text;
- struct CSet cset = {0, {0}};
-
- if(buffer == NULL) return;
-
- if(!(OpenIFF(iffh, IFFF_WRITE)))
- {
- if(!(PushChunk(iffh, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN)))
- {
- if(nsoption_bool(clipboard_write_utf8))
- {
- if(!(PushChunk(iffh, 0, ID_CSET, 32)))
- {
- cset.CodeSet = 106; // UTF-8
- WriteChunkBytes(iffh, &cset, 32);
- PopChunk(iffh);
- }
- }
- }
- else
- {
- PopChunk(iffh);
- }
-
- if(!(PushChunk(iffh, 0, ID_CHRS, IFFSIZE_UNKNOWN))) {
- if(nsoption_bool(clipboard_write_utf8)) {
- WriteChunkBytes(iffh, buffer, length);
- } else {
- if(utf8_to_local_encoding(buffer, length, &text) == NSERROR_OK) {
- char *p;
-
- p = text;
-
- while(*p != '\0') {
- if(*p == 0xa0) *p = 0x20;
- p++;
- }
- WriteChunkBytes(iffh, text, strlen(text));
- ami_utf8_free(text);
- }
- }
-
- PopChunk(iffh);
- } else {
- PopChunk(iffh);
- }
-
- if(!(PushChunk(iffh, 0, ID_UTF8, IFFSIZE_UNKNOWN))) {
- WriteChunkBytes(iffh, buffer, length);
- PopChunk(iffh);
- } else {
- PopChunk(iffh);
- }
- CloseIFF(iffh);
- }
-}
-
-void ami_drag_selection(struct gui_window *g)
-{
- int x;
- int y;
- char *utf8text;
- char *sel;
- struct IFFHandle *old_iffh = iffh;
- struct gui_window_2 *gwin = ami_window_at_pointer(AMINS_WINDOW);
-
- /* NB: 'gwin' is at the drop point, 'g' is where the selection was dragged from.
- * These may be different if the selection has been dragged between windows. */
-
- if(!gwin)
- {
- DisplayBeep(scrn);
- return;
- }
-
- x = gwin->win->MouseX;
- y = gwin->win->MouseY;
-
- if(ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
- {
- iffh = ami_clipboard_init_internal(1);
-
- browser_window_key_press(g->bw, NS_KEY_COPY_SELECTION);
- browser_window_mouse_click(gwin->gw->bw, BROWSER_MOUSE_PRESS_1, x, y);
- browser_window_key_press(gwin->gw->bw, NS_KEY_PASTE);
-
- ami_clipboard_free_internal(iffh);
- iffh = old_iffh;
- }
- else
- {
- x = gwin->win->MouseX;
- y = gwin->win->MouseY;
-
- if(ami_gadget_hit(gwin->objects[GID_URL], x, y))
- {
- if((sel = browser_window_get_selection(g->bw)))
- {
- utf8text = ami_utf8_easy(sel);
- RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL],
- gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE);
- free(sel);
- ami_utf8_free(utf8text);
- }
- }
- else if(ami_gadget_hit(gwin->objects[GID_SEARCHSTRING], x, y))
- {
- if((sel = browser_window_get_selection(g->bw)))
- {
- utf8text = ami_utf8_easy(sel);
- RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCHSTRING],
- gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE);
- free(sel);
- ami_utf8_free(utf8text);
- }
- }
- else
- {
- DisplayBeep(scrn);
- }
- }
-}
-
-bool ami_easy_clipboard(const char *text)
-{
- gui_set_clipboard(text, strlen(text), NULL, 0);
- return true;
-}
-
-bool ami_easy_clipboard_bitmap(struct bitmap *bitmap)
-{
- Object *dto = NULL;
-
- if((dto = ami_datatype_object_from_bitmap(bitmap)))
- {
- DoDTMethod(dto,NULL,NULL,DTM_COPY,NULL);
- DisposeDTObject(dto);
- }
- return true;
-}
-
-#ifdef WITH_NS_SVG
-bool ami_easy_clipboard_svg(struct hlcache_handle *c)
-{
- const char *source_data;
- ULONG source_size;
-
- if(ami_mime_compare(c, "svg") == false) return false;
- if((source_data = content_get_source_data(c, &source_size)) == NULL) return false;
-
- if(!(OpenIFF(iffh,IFFF_WRITE)))
- {
- ami_svg_to_dr2d(iffh, source_data, source_size, nsurl_access(hlcache_handle_get_url(c)));
- CloseIFF(iffh);
- }
-
- return true;
-}
-#endif
-
-static struct gui_clipboard_table clipboard_table = {
- .get = gui_get_clipboard,
- .set = gui_set_clipboard,
-};
-
-struct gui_clipboard_table *amiga_clipboard_table = &clipboard_table;
diff --git a/amiga/clipboard.h b/amiga/clipboard.h
deleted file mode 100755
index bc5b779ef..000000000
--- a/amiga/clipboard.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008-2009, 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_CLIPBOARD_H
-#define AMIGA_CLIPBOARD_H
-#include <stdbool.h>
-
-struct bitmap;
-struct hlcache_handle;
-struct selection;
-struct gui_window;
-struct gui_window_2;
-struct gui_clipboard_table;
-
-extern struct gui_clipboard_table *amiga_clipboard_table;
-
-void gui_start_selection(struct gui_window *g);
-
-void ami_clipboard_init(void);
-void ami_clipboard_free(void);
-void ami_drag_selection(struct gui_window *g);
-bool ami_easy_clipboard(const char *text);
-bool ami_easy_clipboard_bitmap(struct bitmap *bitmap);
-#ifdef WITH_NS_SVG
-bool ami_easy_clipboard_svg(struct hlcache_handle *c);
-#endif
-#endif
diff --git a/amiga/cookies.c b/amiga/cookies.c
deleted file mode 100755
index 0ca17413e..000000000
--- a/amiga/cookies.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <proto/exec.h>
-
-#include "desktop/cookie_manager.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/cookies.h"
-#include "amiga/tree.h"
-
-void ami_cookies_initialise(void)
-{
- cookies_window = ami_tree_create(TREE_COOKIES, NULL);
-
- if(!cookies_window) return;
-}
-
-void ami_cookies_free()
-{
- ami_tree_destroy(cookies_window);
- cookies_window = NULL;
-}
diff --git a/amiga/cookies.h b/amiga/cookies.h
deleted file mode 100755
index d6922750c..000000000
--- a/amiga/cookies.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_COOKIES_H
-#define AMIGA_COOKIES_H
-#include "desktop/tree.h"
-#include "amiga/tree.h"
-
-void ami_cookies_initialise(void);
-void ami_cookies_free(void);
-
-struct treeview_window *cookies_window;
-#endif
diff --git a/amiga/ctxmenu.c b/amiga/ctxmenu.c
deleted file mode 100644
index cc612da24..000000000
--- a/amiga/ctxmenu.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- * Copyright 2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Intuition-based context menu operations
- */
-
-#ifdef __amigaos4__
-#include <string.h>
-
-#include <stdlib.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-
-#include <proto/bitmap.h>
-#include <images/bitmap.h>
-#include <proto/window.h>
-#include <classes/window.h>
-
-#include <intuition/menuclass.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/utils.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/nsoption.h"
-#include "utils/nsurl.h"
-#include "content/hlcache.h"
-#include "desktop/browser.h"
-#include "desktop/browser_history.h"
-#include "desktop/mouse.h"
-#include "desktop/searchweb.h"
-#include "desktop/textinput.h"
-
-#include "amiga/bitmap.h"
-#include "amiga/clipboard.h"
-#include "amiga/ctxmenu.h"
-#include "amiga/filetype.h"
-#include "amiga/gui.h"
-#include "amiga/libs.h"
-#include "amiga/plugin_hack.h"
-#include "amiga/theme.h"
-#include "amiga/utf8.h"
-
-
-enum {
- AMI_CTX_ID_NONE = 0,
-
- /* Text selection */
- AMI_CTX_ID_SELCOPY,
- AMI_CTX_ID_WEBSEARCH,
-
- /* Links */
- AMI_CTX_ID_URLOPENTAB,
- AMI_CTX_ID_URLOPENWIN,
- AMI_CTX_ID_URLDOWNLOAD,
- AMI_CTX_ID_URLCOPY,
-
- /* Objects */
- AMI_CTX_ID_OBJSHOW,
- AMI_CTX_ID_OBJCOPY,
- AMI_CTX_ID_OBJCMD,
-
- /* Frames */
- AMI_CTX_ID_FRAMESHOW,
-
- /* History */
- AMI_CTX_ID_HISTORY,
- AMI_CTX_ID_HISTORY0,
- AMI_CTX_ID_HISTORY9F = AMI_CTX_ID_HISTORY0 + 19,
-
- /* Tabs */
- AMI_CTX_ID_TABNEW,
- AMI_CTX_ID_TABCLOSE_OTHER,
-
- AMI_CTX_ID_MAX
-};
-
-static Object *ctxmenu_obj = NULL;
-
-static struct Hook ctxmenu_item_hook[AMI_CTX_ID_MAX];
-static char *ctxmenu_item_label[AMI_CTX_ID_MAX];
-static char *ctxmenu_item_shortcut[AMI_CTX_ID_MAX];
-static Object *ctxmenu_item_image[AMI_CTX_ID_MAX];
-
-/****************************
- * Menu item hook functions *
- ****************************/
-
-/** Menu functions - called automatically by RA_HandleInput **/
-HOOKF(void, ami_ctxmenu_item_selcopy, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin = (struct gui_window_2 *)hook->h_Data;
-
- browser_window_key_press(gwin->gw->bw, NS_KEY_COPY_SELECTION);
- browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
-}
-
-HOOKF(void, ami_ctxmenu_item_websearch, APTR, window, struct IntuiMessage *)
-{
- nserror ret = NSERROR_OK;
- nsurl *url;
-
- struct gui_window_2 *gwin = (struct gui_window_2 *)hook->h_Data;
- char *sel = browser_window_get_selection(gwin->gw->bw);
-
- ret = search_web_omni(sel, SEARCH_WEB_OMNI_SEARCHONLY, &url);
- if (ret == NSERROR_OK) {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (ret != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(ret), 0);
- }
-
- free(sel);
-}
-
-HOOKF(void, ami_ctxmenu_item_urlopentab, APTR, window, struct IntuiMessage *)
-{
- struct browser_window *bw;
- nsurl *url = (nsurl *)hook->h_Data;
- struct gui_window_2 *gwin;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- nserror error = browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY | BW_CREATE_TAB,
- url,
- browser_window_get_url(gwin->gw->bw),
- gwin->gw->bw,
- &bw);
-
- if (error != NSERROR_OK)
- amiga_warn_user(messages_get_errorcode(error), 0);
-}
-
-HOOKF(void, ami_ctxmenu_item_urlopenwin, APTR, window, struct IntuiMessage *)
-{
- struct browser_window *bw;
- nsurl *url = (nsurl *)hook->h_Data;
- struct gui_window_2 *gwin;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- nserror error = browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY,
- url,
- browser_window_get_url(gwin->gw->bw),
- gwin->gw->bw,
- &bw);
-
- if (error != NSERROR_OK)
- amiga_warn_user(messages_get_errorcode(error), 0);
-}
-
-HOOKF(void, ami_ctxmenu_item_urldownload, APTR, window, struct IntuiMessage *)
-{
- nsurl *url = (nsurl *)hook->h_Data;
- struct gui_window_2 *gwin;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_navigate(gwin->gw->bw,
- url,
- browser_window_get_url(gwin->gw->bw),
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
-}
-
-HOOKF(void, ami_ctxmenu_item_urlcopy, APTR, window, struct IntuiMessage *)
-{
- nsurl *url = (nsurl *)hook->h_Data;
- ami_easy_clipboard(nsurl_access(url));
-}
-
-HOOKF(void, ami_ctxmenu_item_objshow, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_navigate(gwin->gw->bw,
- hlcache_handle_get_url(hook->h_Data),
- browser_window_get_url(gwin->gw->bw),
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
-}
-
-HOOKF(void, ami_ctxmenu_item_objcopy, APTR, window, struct IntuiMessage *)
-{
- struct bitmap *bm;
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- struct hlcache_handle *object = (struct hlcache_handle *)hook->h_Data;
- if((bm = content_get_bitmap(object)))
- {
- ami_bitmap_set_url(bm, hlcache_handle_get_url(object));
- ami_bitmap_set_title(bm, content_get_title(object));
- ami_easy_clipboard_bitmap(bm);
- }
-#ifdef WITH_NS_SVG
- else if(ami_mime_compare(object, "svg") == true)
- {
- ami_easy_clipboard_svg(object);
- }
-#endif
-}
-
-HOOKF(void, ami_ctxmenu_item_objcmd, APTR, window, struct IntuiMessage *)
-{
- amiga_plugin_hack_execute((struct hlcache_handle *)hook->h_Data);
-}
-
-HOOKF(void, ami_ctxmenu_item_frameshow, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_navigate(gwin->gw->bw,
- hlcache_handle_get_url(hook->h_Data),
- browser_window_get_url(gwin->gw->bw),
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
-}
-
-/** Hooks for clicktab context menu entries **/
-HOOKF(void, ami_ctxmenu_item_tabnew, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- ami_gui_new_blank_tab(gwin);
-}
-
-HOOKF(void, ami_ctxmenu_item_tabclose_other, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- ami_gui_close_inactive_tabs(gwin);
-}
-
-/** Hook for history context menu entries **/
-HOOKF(void, ami_ctxmenu_item_history, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_history_go(gwin->gw->bw, (struct history_entry *)hook->h_Data, false);
-}
-
-
-/*************************
- * Browser context menus *
- *************************/
-
-/** Add an initialised item to a context menu **/
-static void ami_ctxmenu_add_item(Object *root_menu, int id, APTR data)
-{
- ctxmenu_item_hook[id].h_Data = data;
-
- IDoMethod(root_menu, OM_ADDMEMBER, MStrip,
- MA_Type, T_ITEM,
- MA_ID, id,
- MA_Label, ctxmenu_item_label[id],
- MA_Key, ctxmenu_item_shortcut[id],
- MA_Image, ctxmenu_item_image[id],
- MA_UserData, &ctxmenu_item_hook[id],
- MEnd);
-}
-
-/** Hook function called by Intuition, creates context menu structure **/
-static uint32 ami_ctxmenu_hook_func(struct Hook *hook, struct Window *window, struct ContextMenuMsg *msg)
-{
- Object *root_menu;
- bool ctxmenu_has_content = false;
- struct gui_window_2 *gwin = hook->h_Data;
- struct hlcache_handle *cc = browser_window_get_content(gwin->gw->bw);
- struct browser_window_features ccdata;
- int mx = window->MouseX;
- int my = window->MouseY;
- int x, y;
- char *sel;
-
- if(msg->State != CM_QUERY) return 0;
- if(nsoption_bool(kiosk_mode) == true) return 0;
-// check window is active
-
- if(ctxmenu_obj != NULL) DisposeObject(ctxmenu_obj);
-
- ctxmenu_obj = MStrip,
- MA_Type, T_ROOT,
- MA_AddChild, root_menu = MStrip,
- MA_Type, T_MENU,
- MA_Label, NULL, //"NetSurf",
- MA_EmbeddedKey, FALSE,
- MA_FreeImage, FALSE,
- MEnd,
- MEnd;
-
- if(ami_mouse_to_ns_coords(gwin, &x, &y, mx, my) == false) {
- /* Outside browser render area */
- return 0;
- }
-
- browser_window_get_features(gwin->gw->bw, x, y, &ccdata);
-
- if((browser_window_can_select(gwin->gw->bw)) &&
- ((browser_window_get_editor_flags(gwin->gw->bw) & BW_EDITOR_CAN_COPY)) &&
- (sel = browser_window_get_selection(gwin->gw->bw))) {
-
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_SELCOPY, gwin);
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_WEBSEARCH, gwin);
-
- ctxmenu_has_content = true;
- free(sel);
- }
-
- if(ccdata.link) {
- if(ctxmenu_has_content == true)
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_NONE, NULL);
-
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_URLOPENTAB, ccdata.link);
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_URLOPENWIN, ccdata.link);
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_URLDOWNLOAD, ccdata.link);
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_URLCOPY, ccdata.link);
- ctxmenu_has_content = true;
- }
-
- if(ccdata.object) {
- if(ctxmenu_has_content == true)
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_NONE, NULL);
-
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_OBJSHOW, ccdata.object);
-
- if(content_get_type(ccdata.object) == CONTENT_IMAGE)
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_OBJCOPY, ccdata.object);
-
- if(ami_mime_content_to_cmd(ccdata.object))
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_OBJCMD, ccdata.object);
-
- ctxmenu_has_content = true;
- }
-
- if(ccdata.main && (ccdata.main != cc)) {
- if(ctxmenu_has_content == true)
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_NONE, NULL);
-
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_FRAMESHOW, ccdata.main);
-
- ctxmenu_has_content = true;
- }
-
- if(ctxmenu_has_content == true) {
- msg->Menu = ctxmenu_obj;
- ami_set_pointer(gwin, GUI_POINTER_DEFAULT, false);
- }
-
- return 0;
-}
-
-/** Initial menu item creation **/
-static void ami_ctxmenu_alloc_item(int id, const char *label, const char *key, const char *image, void *func)
-{
- if(label == ML_SEPARATOR) {
- ctxmenu_item_label[id] = ML_SEPARATOR;
- } else {
- ctxmenu_item_label[id] = ami_utf8_easy(messages_get(label));
- }
-
- if(key != NULL) {
- ctxmenu_item_shortcut[id] = strdup(key);
- } else {
- ctxmenu_item_shortcut[id] = NULL;
- }
-
- if(image != NULL) {
- ctxmenu_item_image[id] = BitMapObj,
- BITMAP_Screen, scrn,
- BITMAP_SourceFile, image,
- BITMAP_Masking, TRUE,
- BitMapEnd;
-
- SetAttrs(ctxmenu_item_image[id],
- BITMAP_Width, 16,
- BITMAP_Height, 16,
- TAG_DONE);
- }
-
- ctxmenu_item_hook[id].h_Entry = func;
- ctxmenu_item_hook[id].h_Data = 0;
-}
-
-/** Exported interface documented in ctxmenu.h **/
-struct Hook *ami_ctxmenu_get_hook(APTR data)
-{
- return AllocSysObjectTags(ASOT_HOOK,
- ASOHOOK_Entry, (HOOKFUNC)ami_ctxmenu_hook_func,
- ASOHOOK_Data, data,
- TAG_DONE);
-}
-
-/** Exported interface documented in ctxmenu.h **/
-void ami_ctxmenu_release_hook(struct Hook *hook)
-{
- FreeSysObject(ASOT_HOOK, hook);
-}
-
-/** Exported interface documented in ctxmenu.h **/
-void ami_ctxmenu_free(void)
-{
- for(int i = 1; i < AMI_CTX_ID_MAX; i++) {
- if((ctxmenu_item_label[i] != NULL) && (ctxmenu_item_label[i] != ML_SEPARATOR)) {
- ami_utf8_free(ctxmenu_item_label[i]);
- }
- ctxmenu_item_label[i] = NULL;
-
- if(ctxmenu_item_shortcut[i] != NULL) {
- free(ctxmenu_item_shortcut[i]);
- ctxmenu_item_shortcut[i] = NULL;
- }
-
- if(ctxmenu_item_image[i] != NULL) {
- DisposeObject(ctxmenu_item_image[i]);
- ctxmenu_item_image[i] = NULL;
- }
- }
-
- if(ctxmenu_obj != NULL) DisposeObject(ctxmenu_obj);
- ctxmenu_obj = NULL;
-}
-
-/** Exported interface documented in ctxmenu.h **/
-void ami_ctxmenu_init(void)
-{
- ami_ctxmenu_alloc_item(AMI_CTX_ID_NONE, ML_SEPARATOR, NULL, NULL, NULL);
-
- ami_ctxmenu_alloc_item(AMI_CTX_ID_SELCOPY, "CopyNS", "C", "TBImages:list_copy",
- ami_ctxmenu_item_selcopy);
- ami_ctxmenu_alloc_item(AMI_CTX_ID_WEBSEARCH, "SearchWeb", NULL, "TBImages:list_search",
- ami_ctxmenu_item_websearch);
-
- ami_ctxmenu_alloc_item(AMI_CTX_ID_URLOPENTAB, "LinkNewTab", NULL, "TBImages:list_tab",
- ami_ctxmenu_item_urlopentab);
- ami_ctxmenu_alloc_item(AMI_CTX_ID_URLOPENWIN, "LinkNewWin", NULL, "TBImages:list_app",
- ami_ctxmenu_item_urlopenwin);
- ami_ctxmenu_alloc_item(AMI_CTX_ID_URLDOWNLOAD, "LinkDload", NULL, "TBImages:list_save",
- ami_ctxmenu_item_urldownload);
- ami_ctxmenu_alloc_item(AMI_CTX_ID_URLCOPY, "CopyURL", NULL, "TBImages:list_copy",
- ami_ctxmenu_item_urlcopy);
-
- ami_ctxmenu_alloc_item(AMI_CTX_ID_OBJSHOW, "ObjShow", NULL, "TBImages:list_preview",
- ami_ctxmenu_item_objshow);
- ami_ctxmenu_alloc_item(AMI_CTX_ID_OBJCOPY, "CopyClip", NULL, "TBImages:list_copy",
- ami_ctxmenu_item_objcopy);
- ami_ctxmenu_alloc_item(AMI_CTX_ID_OBJCMD, "ExternalApp", NULL, "TBImages:list_tool",
- ami_ctxmenu_item_objcmd);
-
- ami_ctxmenu_alloc_item(AMI_CTX_ID_FRAMESHOW, "FrameOnly", NULL, "TBImages:list_preview",
- ami_ctxmenu_item_frameshow);
-
- ami_ctxmenu_alloc_item(AMI_CTX_ID_TABNEW, "NewTab", "T", "TBImages:list_tab",
- ami_ctxmenu_item_tabnew);
- ami_ctxmenu_alloc_item(AMI_CTX_ID_TABCLOSE_OTHER, "CloseInactive", "K", "TBImages:list_cancel",
- ami_ctxmenu_item_tabclose_other);
-}
-
-/********************************
- * History button context menus *
- ********************************/
-
-/** Create menu entries from browser history **/
-static bool ami_ctxmenu_history(int direction, struct gui_window_2 *gwin, const struct history_entry *entry)
-{
- Object *history_root;
- int id = AMI_CTX_ID_HISTORY0 + gwin->temp;
- if(direction == AMI_CTXMENU_HISTORY_FORWARD) id += 10;
-
- if(gwin->temp >= 10) return false;
-
- ctxmenu_item_hook[id].h_Entry = (HOOKFUNC)ami_ctxmenu_item_history;
- ctxmenu_item_hook[id].h_Data = (APTR)entry;
-
- history_root = (Object *)IDoMethod(gwin->history_ctxmenu[direction], MM_FINDID, 0, AMI_CTX_ID_HISTORY);
-
- IDoMethod(history_root, OM_ADDMEMBER, MStrip,
- MA_Type, T_ITEM,
- MA_Label, browser_window_history_entry_get_title(entry),
- MA_ID, id,
- MA_Image, NULL,
- MA_UserData, &ctxmenu_item_hook[id],
- MEnd);
-
- gwin->temp++;
-
- return true;
-}
-
-/** Callback for browser_window_history_enumerate **/
-static bool ami_ctxmenu_history_back(const struct browser_window *bw,
- int x0, int y0, int x1, int y1,
- const struct history_entry *entry, void *user_data)
-{
- return ami_ctxmenu_history(AMI_CTXMENU_HISTORY_BACK, (struct gui_window_2 *)user_data, entry);
-}
-
-/** Callback for browser_window_history_enumerate **/
-static bool ami_ctxmenu_history_forward(const struct browser_window *bw,
- int x0, int y0, int x1, int y1,
- const struct history_entry *entry, void *user_data)
-{
- return ami_ctxmenu_history(AMI_CTXMENU_HISTORY_FORWARD, (struct gui_window_2 *)user_data, entry);
-}
-
-/** Exported interface documented in ctxmenu.h **/
-struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin)
-{
- Object *obj;
-
- if(gwin->history_ctxmenu[direction] == NULL) {
- if(ctxmenu_item_label[AMI_CTX_ID_HISTORY] == NULL)
- ctxmenu_item_label[AMI_CTX_ID_HISTORY] = ami_utf8_easy(messages_get("History"));
-
- gwin->history_ctxmenu[direction] = MStrip,
- MA_Type, T_ROOT,
- MA_AddChild, MStrip,
- MA_Type, T_MENU,
- MA_ID, AMI_CTX_ID_HISTORY,
- MA_Label, ctxmenu_item_label[AMI_CTX_ID_HISTORY],
- MA_EmbeddedKey, FALSE,
- //MA_FreeImage, FALSE,
- MEnd,
- MEnd;
- } else {
- for (int i = 0; i < 20; i++) {
- obj = (Object *)IDoMethod(gwin->history_ctxmenu[direction],
- MM_FINDID, 0, AMI_CTX_ID_HISTORY0 + i);
- if(obj != NULL) IDoMethod(gwin->history_ctxmenu[direction], OM_REMMEMBER, obj);
- }
-
- gwin->temp = 0;
-
- if(direction == AMI_CTXMENU_HISTORY_BACK) {
- browser_window_history_enumerate_back(gwin->gw->bw, ami_ctxmenu_history_back, gwin);
- } else {
- browser_window_history_enumerate_forward(gwin->gw->bw, ami_ctxmenu_history_forward, gwin);
- }
- }
-
- return (struct Menu *)gwin->history_ctxmenu[direction];
-}
-
-
-/**************************
- * ClickTab context menus *
- **************************/
-
-/** Exported interface documented in ctxmenu.h **/
-struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin)
-{
- Object *root_menu;
-
- if(gwin->clicktab_ctxmenu != NULL) return (struct Menu *)gwin->clicktab_ctxmenu;
-
- gwin->clicktab_ctxmenu = MStrip,
- MA_Type, T_ROOT,
- MA_AddChild, root_menu = MStrip,
- MA_Type, T_MENU,
- MA_Label, NULL,
- MA_EmbeddedKey, FALSE,
- MEnd,
- MEnd;
-
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_TABNEW, gwin);
- ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_TABCLOSE_OTHER, gwin);
-
- return (struct Menu *)gwin->clicktab_ctxmenu;
-}
-
-
-#endif
-
diff --git a/amiga/ctxmenu.h b/amiga/ctxmenu.h
deleted file mode 100644
index 08a5fe582..000000000
--- a/amiga/ctxmenu.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Interface to Intuition-based context menu operations
- */
-
-#ifndef AMIGA_CTXMENU_H
-#define AMIGA_CTXMENU_H 1
-struct Hook;
-struct Menu;
-struct gui_window_2;
-
-enum {
- AMI_CTXMENU_HISTORY_BACK = 0,
- AMI_CTXMENU_HISTORY_FORWARD = 1
-};
-
-#ifdef __amigaos4__
-/**
- * Initialise context menus code (allocate label text, etc)
- * Must be called *after* NetSurf's screen pointer is obtained.
- */
-void ami_ctxmenu_init(void);
-
-/**
- * Cleanup context menus code
- */
-void ami_ctxmenu_free(void);
-
-/**
- * Get a Hook for WA_ContextMenuHook
- *
- * \param data ptr for the hook to use (struct gui_window_2 *)
- * \returns pointer to a struct Hook
- */
-struct Hook *ami_ctxmenu_get_hook(APTR data);
-
-/**
- * Release a Hook for WA_ContextMenuHook
- *
- * \param hook ptr to hook
- */
-void ami_ctxmenu_release_hook(struct Hook *hook);
-
-/**
- * Create history context menu
- * The first time this is run it will create an empty menu,
- * Subsequent runs will (re-)populate with the history.
- * This is to allow the pointer to be obtained before the browser_window is opened.
- *
- * \param direction AMI_CTXMENU_HISTORY_(BACK|FORWARD)
- * \param gwin struct gui_window_2 *
- * \returns pointer to menu (for convenience, is also stored in gwin structure)
- * The returned pointer MUST be disposed of with DisposeObject before program exit.
- */
-struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin);
-
-/**
- * Create ClickTab context menu
- *
- * \param gwin struct gui_window_2 *
- * \returns pointer to menu (for convenience, is also stored in gwin structure)
- * The returned pointer MUST be disposed of with DisposeObject before program exit.
- */
-struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin);
-
-#else //__amigaos4__
-inline void ami_ctxmenu_init(void) {}
-inline void ami_ctxmenu_free(void) {}
-inline struct Hook *ami_ctxmenu_get_hook(APTR data) {return NULL;}
-inline void ami_ctxmenu_release_hook(struct Hook *hook) {}
-inline struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin) {return NULL;}
-inline struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin) {return NULL;}
-#endif //__amigaos4__
-#endif //AMIGA_CTXMENU_H
-
diff --git a/amiga/datatypes.c b/amiga/datatypes.c
deleted file mode 100644
index 6018b107f..000000000
--- a/amiga/datatypes.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef WITH_AMIGA_DATATYPES
-#include "amiga/datatypes.h"
-
-nserror amiga_datatypes_init(void)
-{
- nserror err = NSERROR_OK;
-
- err = amiga_dt_picture_init();
- if(err != NSERROR_OK) return err;
-
-#ifdef WITH_DTANIM
- err = amiga_dt_anim_init();
- if(err != NSERROR_OK) return err;
-#endif
-
- err = amiga_dt_sound_init();
- if(err != NSERROR_OK) return err;
-
- return NSERROR_OK;
-}
-
-#endif
diff --git a/amiga/datatypes.h b/amiga/datatypes.h
deleted file mode 100644
index 00a9b4e5a..000000000
--- a/amiga/datatypes.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NETSURF_AMIGA_DATATYPES_H_
-#define NETSURF_AMIGA_DATATYPES_H_
-
-#include "utils/config.h"
-#include "utils/errors.h"
-
-#ifdef WITH_AMIGA_DATATYPES
-
-nserror amiga_datatypes_init(void);
-
-nserror amiga_dt_picture_init(void);
-
-nserror amiga_dt_anim_init(void);
-
-nserror amiga_dt_sound_init(void);
-
-#else
-
-#define amiga_datatypes_init() NSERROR_OK
-
-#endif /* WITH_AMIGA_DATATYPES */
-
-#endif
diff --git a/amiga/dist/Install b/amiga/dist/Install
deleted file mode 100755
index e8d9d0ed7..000000000
--- a/amiga/dist/Install
+++ /dev/null
@@ -1,397 +0,0 @@
-; Installation script for NetSurf
-
-(procedure p_append #filename #text
- (set #file-path (tackon "ENVARC:launch-handler/URL" #protocol))
- (set #def-file-path (tackon "ENVARC:launch-handler/URL/defaults" #protocol))
-
- (if (exists #file-path)
- (
- (set #inc #file-path)
- )
- ;else
- (
- (set #inc #def-file-path)
- )
- )
-
- (textfile
- (dest #file-path)
- (include #inc)
- (append #text)
- )
-)
-
-(procedure p_chk_launch-handler #protocol
- (if (exists (tackon "ENVARC:launch-handler/URL" #protocol))
- (
- (run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL" #protocol) " NetSurf" (safe))
- )
- ;else
- (
- (run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL/defaults" #protocol) " NetSurf" (safe))
- )
- )
-
- (set #has_entry (getsize "T:NS_Install.tmp"))
-)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Script execution starts here ;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(set osver (getversion "libs:version.library"))
-(set osver (/ osver 65536))
-
-(if (= @app-name "NetSurfAutoInstall") (set #AutoInstall 1))
-(set @app-name "NetSurf")
-
-(set #netsurf-readme "NetSurf.readme")
-(if (= (exists #netsurf-readme) 0)
- (
- (set #netsurf-readme "NetSurf_os3.readme")
- (if (OR (>= osver 50) (< osver 44))
- (abort "This archive is for AmigaOS 3.5 or 3.9 ONLY.")
- )
- )
- ;else
- (
- (if (< osver 50)
- (abort "This archive is for AmigaOS 4.0 and higher ONLY.")
- )
- )
-)
-
-(if (<> #AutoInstall 1) (welcome))
-
-; (hopefully temporary) workaround for a bug in Installer:
-(if (= @language "dutch") (set @askdir-help ""))
-
-(complete 0)
-
-(set @default-dest (getenv "AppPaths/NetSurf"))
-
-; If env-var did not exist, this is a first time install.
-; For novice users we must take care to put the files somewhere sensible.
-(if (= @default-dest "")
- (
- ; Workaround for Installer bug picking TEXTCLIP: as a sensible location
- (if (= @default-dest "TextClip:") (set @default-dest "SYS:Internet"))
-
- (if (= @user-level 0)
- (
- (makedir (tackon @default-dest "NetSurf") (infos))
- (set @default-dest (tackon @default-dest "NetSurf"))
- )
- )
- )
-)
-
-(set @default-dest
- (askdir
- (prompt "Where would you like to install NetSurf?\n"
- "(a drawer WILL NOT be created)")
- (help @askdir-help)
- (default @default-dest)
- )
-)
-
-(complete 5)
-
-(working "Checking existing installation...")
-(set #icon-exists (exists (tackon @default-dest "NetSurf.info")))
-
-(complete 10)
-
-(set #user (getenv "user"))
-(if (= #user "") (set #user "Default"))
-
-(set #user-dir (tackon (tackon @default-dest "Users") #user))
-(set #user-options (tackon #user-dir "Choices"))
-(set #options-exist (exists #user-options))
-(set #searchengines-exist (exists (tackon @default-dest "Resources/SearchEngines")))
-(set #user-hotlist (tackon #user-dir "Hotlist"))
-(set #hotlist-exist (exists #user-hotlist))
-(set #old-hotlist (tackon @default-dest "Resources/Hotlist"))
-(set #old-hotlist-exist (exists #old-hotlist))
-(set #aiss-theme "")
-
-(if (= #options-exist 0)
- (
- (if (exists "TBimages:" (noreq))
- (set #aiss-theme "AISS")
- )
-
- (set #themename
- (askchoice
- (prompt "Please select theme")
- (help "AISS theme requires AISS (and def_pointers for 32-bit "
- "pointers), and will only be shown as an option if "
- "AISS is installed.\n\n"
- @askchoice-help)
- (choices "Default" #aiss-theme)
- (default 0)
- )
- )
-
- (select #themename
- (set #themeshort "Default")
- (set #themeshort "AISS")
- )
-
- (set #theme (tackon "PROGDIR:Resources/Themes/" #themeshort))
- )
-)
-
-(complete 15)
-
-(if (>= osver 53)
- (
- (if (= #AutoInstall 1)
- (
- (set #addlaunchhandler 0)
- )
- ;else
- (
- (set #addlaunchhandler
- (askbool
- (prompt "Add NetSurf to launch-handler? (recommended)")
- (help "launch-handler is part of OS4.1 which opens URLs "
- " by launching a web browser.\n\n"
- "The installation will update the configuration of "
- "OS4.1 to allow URLs to be opened by NetSurf.")
- (default 1)
- )
- )
- )
- )
- )
- ;else
- (
- (set #addlaunchhandler 0)
- )
-)
-
-(complete 20)
-
-(set #runfixfonts
- (askbool
- (prompt "Installer will run FixFonts after NetSurf is installed. "
- "Unless you have a *very* good reason you should not skip this step.")
- (help "FixFonts corrects inconsistencies in the Amiga FONTS: structure. "
- "Running it will prevent NetSurf hitting problems when the fonts are scanned.")
- (default 1)
- (choices "Run FixFonts" "Skip")
- )
-)
-
-(complete 25)
-
-(working "Installing NetSurf")
-
-(if (= #AutoInstall 0)
- (
- (copyfiles
- (prompt "Copying NetSurf...")
- (help @copyfiles-help)
- (source "NetSurf")
- (dest @default-dest)
- (newname "NetSurf")
- (optional "askuser" "force" "oknodelete")
- (confirm "expert")
- )
- )
-;else
- (
- (run "CopyStore NetSurf" @default-dest)
- )
-)
-
-(complete 40)
-
-(if #searchengines-exist
- (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\"")
-
-(complete 50)
-
-(copyfiles
- (prompt "Copying files")
- (source "")
- (choices "Resources" "Rexx" "NetSurf.guide" #netsurf-readme)
- (help @copyfiles-help)
- (dest @default-dest)
- (infos)
- (optional "nofail")
-; (all)
-)
-
-(complete 65)
-
-(copyfiles
- (prompt "Copying additional documentation")
- (source "")
- (pattern "(COPYING|ChangeLog)")
- (help @copyfiles-help)
- (dest @default-dest)
- (infos)
- (optional "nofail")
-)
-
-(complete 70)
-
-(if #themeshort
- (
- (set #theme-icon
- (tackon "Resources/Themes"
- (tackon #themeshort "NetSurf.info")
- )
- )
-
- (if (exists #theme-icon)
- (
- (copyfiles
- (prompt "Copying theme icon")
- (help @copyfiles-help)
- (source #theme-icon)
- (dest @default-dest)
- )
- )
- )
-
- (makedir #user-dir)
-
- (textfile
- (prompt "Setting default options")
- (help @textfile-help)
- (dest #user-options)
- (append "theme:" #theme "\n")
- (append "pubscreen_name:Workbench\n")
- )
-
- (if (= #hotlist-exist 0)
- (if (= #old-hotlist-exist 1)
- (
- (copyfiles
- (prompt "Migrating NetSurf 2.x Hotlist")
- (help @copyfiles-help)
- (source #old-hotlist)
- (dest #user-dir)
- (optional "askuser" "force" "oknodelete")
- )
- )
- )
- )
- )
-)
-
-(complete 75)
-
-(if (= (exists "ENVARC:Sys/def_css.info") 0)
- (copyfiles
- (prompt "Copying default CSS icon")
- (source "Resources/default.css.info")
- (newname "def_css.info")
- (help @copyfiles-help)
- (dest "ENVARC:Sys")
- (optional "nofail")
- )
-)
-
-(complete 80)
-
-(if (>= osver 53)
- (if (= (exists "Rexx:NetSurf") 0)
- (
- (textfile
- (prompt "Creating NetSurf launch helper")
- (help @textfile-help)
- (dest "Rexx:NetSurf")
- (append "/*\n"
-" * Copyright 2013 Chris Young <chris@unsatisfactorysoftware.co.uk>\n"
-" *\n"
-" * This file is part of NetSurf, http://www.netsurf-browser.org/\n"
-" *\n"
-" * NetSurf is free software; you can redistribute it and/or modify\n"
-" * it under the terms of the GNU General Public License as published by\n"
-" * the Free Software Foundation; version 2 of the License.\n"
-" *\n"
-" * NetSurf is distributed in the hope that it will be useful,\n"
-" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
-" * GNU General Public License for more details.\n"
-" *\n"
-" * You should have received a copy of the GNU General Public License\n"
-" * along with this program. If not, see <http://www.gnu.org/licenses/>.\n"
-" */\n"
-"\n"
-"/* This is a convenience script for launching NetSurf from the Shell.\n"
-" * If NetSurf is already running it will open the supplied URL in a new tab.\n"
-" * This can be used in URL Prefs in place of directly calling APPDIR:NetSurf.\n"
-" */\n"
-"\n"
-"options results\n"
-"parse arg url\n"
-"\n"
-"if show('P', 'NETSURF') then do\n"
-" address NETSURF 'OPEN' url 'NEWTAB'\n"
-" address NETSURF 'TOFRONT'\n"
-"end\n"
-"else do\n"
-" address command 'APPDIR:NetSurf URL' url\n"
-"end\n")
- )
- (protect "Rexx:NetSurf" "+se")
- )
- )
-)
-
-(complete 85)
-
-(if (= #addlaunchhandler 1)
- (
- (working "Adding NetSurf to launch-handler config")
- (if (= (p_chk_launch-handler "FILE.LH") 0)
- (p_append "FILE.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"file:///%s*\"\"")
- )
-
- (if (= (p_chk_launch-handler "HTTP.LH") 0)
- (p_append "HTTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://%s*\"\"")
- )
-
- (if (= (p_chk_launch-handler "HTTPS.LH") 0)
- (p_append "HTTPS.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"https://%s*\"\"")
- )
-
- (if (= (p_chk_launch-handler "WWW.LH") 0)
- (p_append "WWW.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://www.%s*\"\"")
- )
-
-; (if (= (p_chk_launch-handler "FTP.LH") 0)
-; (p_append "FTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"ftp://%s*\"\"")
-; )
- )
-)
-
-(complete 90)
-
-(working "Running FixFonts")
-
-(if #runfixfonts
- (
- (run "SYS:System/FixFonts")
- )
-)
-
-(complete 100)
-
-(if (= #AutoInstall 1)
- (
- (exit (quiet))
- )
- (
- (exit)
- )
-)
diff --git a/amiga/dist/Install.info b/amiga/dist/Install.info
deleted file mode 100644
index 944fcc69d..000000000
--- a/amiga/dist/Install.info
+++ /dev/null
Binary files differ
diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide
deleted file mode 100755
index a1c3941df..000000000
--- a/amiga/dist/NetSurf.guide
+++ /dev/null
@@ -1,411 +0,0 @@
-@database NetSurf.guide
-@author Chris Young
-@wordwrap
-
-@node Main "NetSurf"
-@{b}NetSurf@{ub} Amiga-specific documentation
-http://www.netsurf-browser.org
-
-@{" GUI " link GUI}
-@{" Preferences GUI " link Prefs}
-
-@{" Command line options " link CLI}
-@{" Options file " link Options}
-@{" Fonts " link Fonts}
-@{" ARexx port " link ARexx}
-@{" OpenURL/URL Prefs " link OpenURL}
-@{" Hotlist menu " link Hotlist}
-@{" Hotlist toolbar " link HotlistToolbar}
-@{" Local MIME types " link MIMETypes}
-@{" Keyboard controls " link Keyboard}
-
-@{" Optimising for speed " link Speed}
-
-@{" Credits " link Contact}
-@endnode
-
-@node GUI "Main window"
-NetSurf's main GUI consists of a toolbar across the top, an (optional) tab bar, an (optional) hotlist toolbar and the main browser area. It also encompasses a pull-down @{"menu" link Menu}.
-
-The toolbar buttons are, from left to right:
-@{b}Back@{ub} Go back one page in history. Right-clicking gives a menu showing the last ten pages visited.
-@{b}Forward@{ub} Go forward one page in history. Right-clicking gives a menu showing up to ten pages available.
-@{b}Stop@{ub} Stop loading the page.
-@{b}Reload@{ub} Reload the current page. Shift-clicking will reload all elements on the page.
-@{b}Home@{ub} Load the home page.
-
-The gadget to the right of the buttons is the URL bar to type web addresses into. On the far right is the search bar. Typing into here will search for the text using your default search provider (see preferences @{"Advanced tab" link Prefs-Advanced}.
-
-Below these is the (optional) @{"hotlist toolbar" link HotlistToolbar}.
-Below this is the (optional) tab bar. This usually only displays when more than one tab is open, but can be set in @{"preferences" link Prefs-Tabs} to be always present. At the far right is a button to open a new tab. On OS4.0 the current tab can be closed using the button on the far left. On OS4.1 the close gadget for the tab is embedded in the tab itself.
-
-The rest of the window is taken up with the @{"browser rendering area" link Browser}. This is where the pages visited will be displayed.
-@endnode
-
-@node Browser
-@toc GUI
-This is the main browser rendering area.
-
-Drag and drop is supported throughout, so files can be dropped onto text fields, text on pages can be highlighted and dragged to Workbench or text fields. Other elements can be saved by dragging them to Workbench with Ctrl or Shift held down.
-
-Note that dragging to Workbench only works when NetSurf is running on the Workbench screen.
-@endnode
-
-@node Menu "Menu"
-@toc GUI
-Project Browser Edit @{"Hotlist" link Hotlist} @{"ARexx" link arexx}
-
-@endnode
-
-@node Prefs "Preferences GUI"
-@{"General" link Prefs-General} @{"Display" link Prefs-Display} @{"Connection" link Prefs-Connection} @{"Rendering" link Prefs-Rendering} @{"Fonts" link Prefs-Fonts} @{"Cache" link Prefs-Cache} @{"Tabs" link Prefs-Tabs} @{"Advanced" link Prefs-Advanced} @{"Export" link Prefs-Export}
-@endnode
-
-@node Prefs-General "Prefs - General"
-@toc Prefs
-@remark todo
-@endnode
-
-@node Prefs-Display "Prefs - Display"
-@toc Prefs
-@remark todo
-@{"Themes" link Themes}
-@endnode
-
-@node Prefs-Connection "Prefs - Connection"
-@toc Prefs
-@remark todo
-@endnode
-
-@node Prefs-Rendering "Prefs - Rendering"
-@toc Prefs
-@remark todo
-@endnode
-
-@node Prefs-Fonts "Prefs - Fonts"
-@toc Prefs
-@remark todo
-See @{"Fonts" link Fonts}
-@endnode
-
-@node Prefs-Cache "Prefs - Cache"
-@toc Prefs
-@remark todo
-@endnode
-
-@node Prefs-Tabs "Prefs - Tabs"
-@toc Prefs
-@remark todo
-@endnode
-
-@node Prefs-Advanced "Prefs - Advanced"
-@toc Prefs
-@remark todo
-@endnode
-
-@node Prefs-Export "Prefs - Export"
-@toc Prefs
-This section contains options for exporting to PDF. It is not enabled in current builds of NetSurf.
-@endnode
-
-@node cli "Command line options"
-NetSurf NSOPTS/M,URL/K,USERSDIR/K,FORCE/S
-
-Where:
-URL = Address of page to open on startup
-USERSDIR = Locations of user directories (see @{"tooltypes" link tooltypes})
-FORCE = Force new instance of NetSurf to open (has some limitations, use for debugging only)
-NSOPTS = Catches everything else and passes it to the NetSurf core command line parser
-@endnode
-
-@node tooltypes "ToolTypes"
-Supported tooltypes are:
-
-@{b}USERSDIR@{ub}
-Location of the Users directory. This should contain the "Users" part of the path, NetSurf will append the username. Defaults to PROGDIR:Users.
-The user directories contain user-specific preferences and cache data. Always locate them on fast, non-volatile, writeable media.
-
-@{b}USER@{ub}
-Current user. Defaults to the value of the USER env-var, or Default.
-@endnode
-
-@node options "Options file"
-The options file is stored in @{"Users/Default/Choices" link Users/Default/Choices/Main} by default. Most of the settings can be changed from within NetSurf by selecting Edit preferences from the Settings menu.
-
-There are a couple of Amiga-specific options which can only be changed directly in the file. These are:
-
-@{b}kiosk_mode@{ub} No gadgets
-@{b}printer_unit@{ub} Specifies which printer.device unit to print to
-@{b}drag_save_icons@{ub} Enables displaying Workbench-style transparent icons under the pointer when performing drag saves (ctrl-drag of objects available if NetSurf is running on the Workbench screen) and text selection drags. If set to 0 the pointer style will change instead. OS 4.0 users may want to set this to 0 as icons will appear opaque and obscure the drop position.
-@{b}monitor_aspect_x@{ub}/@{b}monitor_aspect_y@{ub} Correct aspect ratio for displays (default of 0 means "assume square pixels").
-@{b}screen_compositing@{ub} Use compositing on NetSurf's own screen. 0=disable, 1=enable, 2=default (NB: This is indirectly modified by changing the "simple refresh" option in the GUI)
-@{b}resize_with_contents@{ub} Set to 1 to respect GUI prefs' "resize with contents" option. Default is to use old-style "resize on release"
-@{b}reformat_delay@{ub} Sets a delay on performing content reformats (eg. if the window has been resized). Set to a higher value to make "resize with contents" more responsive. Defaults to 0 (immediate).
-@{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}web_search_width@{ub} Defaults to 0. Larger values will increase the size of the web search gadget next to the URL bar.
-
-@{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.
-
-@{b}url_file@{ub} Path to URL database file
-@{b}hotlist_file@{ub} Path to Hotlist file
-@{b}arexx_dir@{ub} Path to ARexx scripts dir
-@{b}arexx_startup@{ub} ARexx script to run at startup (in above dir)
-@{b}arexx_shutdown@{ub} ARexx script to run on quit (in above dir)
-@endnode
-
-@node Fonts
-The font to use for each font type can be defined in NetSurf's options. OS4 NetSurf supports soft styles for bold and italic, however designed fonts look better and it is highly recommended to set them as follows:
-
-Within @{"TypeManager" system "SYS:System/TypeManager"} select a font being used by NetSurf and click on Modify.
-On the Files tab, Font family section, choose the @{b}bold@{ub}, @{i}italic@{ui} and @{b}@{i}bold-italic@{ui}@{ub} version of the font.
-Click Save.
-
-@{b}Unicode fallback font@{ub}
-
-If the font NetSurf is trying to use does not contain a specific character used on a web page, it will try the Unicode/fallback font. It is recommended to use a font which either:
-(a) Contains as complete a Unicode character set as possible or
-(b) Is complete for the pages you are likely to visit (eg. if you visit a lot of Japanese pages, set the Unicode fallback font to one with a complete Japanese character set)
-
-For most users, installing and selecting @{"Code2000" rxs "address netsurf 'open http://code2000.sf.net'"} or @{"Bitstream Cyberbit" rxs "address netsurf 'open http://ftp.netscape.com/pub/communicator/extras/fonts/windows/'"} is the best option.
-
-Additional fall-back fonts can be provided since NetSurf 3.0. These need to go into Users/user/Choices as a comma-separated list, for the font_unicode option.
-
-NB: Since NetSurf 3.0, NetSurf will scan the provided Unicode fonts, and the rest of the system fonts, on first startup. Setting font_unicode_only:1 will prevent fonts not in the preferred Unicode fonts list from being scanned or used as fallback fonts. If the system fonts or NetSurf's fallback fonts list changes, this cache will need to be re-generated. This can be forced by deleting the font glyph cache (which defaults to Users/user/FontGlyphCache).
-
-Since NetSurf 3.4, Unicode glyphs above 0xFFFF are supported. These are mainly used for Emoji. The option to specify a fallback font for this range is font_surrogate - there is no scanning of system fonts. If @{"Symbola" rxs "address netsurf 'open http://users.teilar.gr/~g1951d/'"} font is installed it will be selected automatically.
-
-@{b}Font sizes@{ub}
-
-The default and minimum font sizes can also be set.
-NB: The resolution setting on the "Rendering" tab in NetSurf's preferences affects how big text appears on screen (the conversion between point and pixel sizes) amongst other things. To find the correct value, divide the number of pixels on the screen vertically by the physical height of the screen in inches (horizontal resolution is calculated automatically if NetSurf is running on a custom screen, square pixels are assumed on all other screens).
-If the monitor is widescreen, monitor_aspect_x and monitor_aspect_y values in Users/Default/Choices may also need modifying.
-@endnode
-
-@node Themes
-AmigaOS NetSurf supports basic theming of gadget imagery. Themes live in the Resources/Themes directory, and two are included by default:
-
-Default - default theme with no external dependencies.
-AISS - theme using Mason's AISS images for buttons, and the def_pointers package for 32-bit pointer images.
-
-The file "Theme" in the theme directory contains the files used for that theme. See @{"Default Theme file" link Resources/Themes/Default/Theme/Main} for more details.
-
-Theme directories should be copied and renamed if themes are modified, as update installation of NetSurf will overwrite any changes.
-AmigaOS NetSurf themes are not compatible with NetSurf for other platforms.
-@endnode
-
-@node arexx "ARexx port"
-NetSurf's ARexx port is called NETSURF.
-
-Commands are:
-
-@{b}OPEN URL/A,NEW=NEWWINDOW/S,NEWTAB/S,SAVEAS/K,W=WINDOW/K/N,T=TAB/K/N@{ub}
-Opens URL in current window or a new window/tab if NEWWINDOW/NEWTAB is specified. Saves the location without displaying if SAVEAS and a filename is specified (SAVEAS available in 2.6325)
-Note that if the URL is non-ASCII it is expected to be encoded in UTF-8 (file: references should always be in local charset due to filesystem limitations). Usually this is not relevant, as all normalised URLs will be in their ASCII form.
-
-@{b}SAVE FILENAME/A,W=WINDOW/K/N,T=TAB/K/N@{ub} (2.6027)
-Saves current page source to FILENAME
-
-@{b}QUIT@{ub}
-Quits NetSurf
-
-@{b}TOFRONT@{ub}
-Brings NetSurf's screen to the front
-
-@{b}GETURL W=WINDOW/K/N,T=TAB/K/N@{ub}
-Puts the URL displayed in the current window/tab into RESULT
-
-@{b}GETTITLE W=WINDOW/K/N,T=TAB/K/N@{ub}
-Puts the title of the page displayed in the current window/tab into RESULT
-
-@{b}GETSCREENNAME@{ub} (2.8303)
-Puts the name of the screen NetSurf is running on into RESULT.
-
-@{b}BACK W=WINDOW/K/N,T=TAB/K/N@{ub} (2.10626)
-Move back one page in history.
-
-@{b}FORWARD W=WINDOW/K/N,T=TAB/K/N@{ub} (2.10626)
-Move forward one page in history.
-
-@{b}HOME W=WINDOW/K/N,T=TAB/K/N@{ub} (2.10626)
-Move back to the home page.
-
-@{b}RELOAD FORCE/S,W=WINDOW/K/N,T=TAB/K/N@{ub} (2.10626)
-Reload the current page, FORCE will do a full reload.
-
-@{b}CLOSE W=WINDOW/K/N,T=TAB/K/N@{ub} (2.10718)
-Close the current page. A window or window and tab can be specified. Note that when a tab is closed, the tab number of tabs to the right of it will change, and the currently active tab may also change. If the last tab or window is closed, NetSurf will usually exit. Make sure you account for these situations in your code.
-
-@{b}VERSION VERSION/N REVISION/N RELEASE/S@{ub}
-Returns the current version of NetSurf in RESULT. You can also do version checking by supplying a VERSION and optional REVISION to check against. If the version of NetSurf is the same or higher 1 will be returned, if it is older 0. If RELEASE is specified, the command operates on the release version rather than the internal version number.
-
-@{b}ACTIVE T=TAB/S@{ub} (2.10718)
-Returns the active window (or tab if TAB is specified). Commands automatically operate on the active window/tab so you do not normally need to use this.
-
-@{b}WINDOWS W=WINDOW/K/N@{ub} (2.10656)
-Puts the number of windows into RESULT. If the WINDOW keyword is specified, will put the number of tabs in that window into RESULT.
-
-@{b}HOTLIST A=ACTION/A@{ub} (3.1 - CI build #471)
-Possible actions for the hotlist window are OPEN and CLOSE.
-
-The W=WINDOW/K/N,T=TAB/K/N parameters were added in 2.10656 and allow targetting a window other than the current one. Both WINDOW and TAB must be specified (TAB=1 for tabless window) except in the special case of the CLOSE command.
-
-The ARexx menu will be populated with scripts named #?.nsrx in @{"arexx_dir" link options 12}, up to a maximum of 20 entries. The titles of these entries will be the comments field of the file (or the filename if comments field is empty).
-
-Special scripts @{"arexx_startup" link options 13} and @{"arexx_shutdown" link options 14} will be run at startup and shutdown of NetSurf. These will execute after NetSurf has fully initialised with the initial window and before NetSurf frees resources (ie. at the last stage of startup, and the first stage of shutdown)
-@endnode
-
-@node OpenURL
-@{b}OpenURL configuration@{ub}
-
-Click Add on the Browsers page and fill in the details as follows:
-Name: NetSurf
-Path: NetSurf URL="%u"
-ARexx port: NETSURF
-Show:
-To front: TOFRONT
-Open URL: OPEN "%u"
-New window: OPEN "%u" NEW
-
-On the Misc tab, please ensure "Send mailto: URLs to email application" is set.
-
-@{b}URL Prefs (OS4.1)@{ub}
-Under OS4.1 Update 1, launch-handler is used in preference to OpenURL. The
-Installer script can add the relevant configuration to launch URLs in NetSurf.
-Please ensure your email application is configured in URL Prefs for mailto:
-links clicked within NetSurf.
-
-Note that a helper script is installed in S:ARexx which can be used instead of
-the main executable, to stop the NetSurf executable from being loaded again if
-it is already running.
-@endnode
-
-@node hotlist "Hotlist menu"
-Items from the hotlist can be added to the Hotlist menu as follows:
-
-Select Hotlist => Show hotlist...
-
-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.
-
-Folders more than one level down in the heirarchy will become menu items with no action. Items deeper will not be included in the menu at all (until we switch to using menuclass).
-
-Folders with no items in them will show up disabled in the menu. If they are named "--" they will be displayed as separator bars.
-
-eg.
-
-- Hotlist Menu
- |
- +- Netsurf
- | |
- | +- NetSurf Homepage
- | |
- | +- More NetSurf links
- | |
- | +- NetSurf bugtracker
- |
- +- --
- |
- +- Google
-
-Will look something like the following within the menu:
-
-|NetSurf »| - |NetSurf Homepage |
-|---------| |More NetSurf links|
-|Google |
-
-@endnode
-
-@node HotlistToolbar "Hotlist toolbar"
-A toolbar for frequently-accessed sites can be added to the main window. To do show, follow these steps:
-
-* Select Show Hotlist from the Hotlist menu
-The Hotlist window will be displayed.
-
-* Locate the "Hotlist toolbar" folder in the tree (NetSurf creates this when it starts up)
-
-* Move or create entries in this folder. Any entries directly inside the Hotlist toolbar folder will appear on the toolbar when the hotlist window is closed. If it is empty the toolbar will disappear to save space.
-
-Note that sub-folders are not currently supported on the toolbar.
-
-@endnode
-
-@node mimetypes "Local MIME Types"
-NetSurf determines the MIME types of local files primarily by checking the icon of the file. If the icon is not found it will check the default icon for the file type.
-
-It looks for a tooltype MIMETYPE and, if found, will use the contents as the filetype of the file. If not found it will use datatypes.library and do a reverse lookup based on the contents of Resources/mimetypes[.user]
-
-The Installer script will set the MIMETYPE tooltype on basic relevant default filetype icons. If you get problems:
-* If the file has a real icon, add MIMETYPE=<MIME type of file> to the tooltypes.
-* If the file does not have an icon, check:
-1. The file type is showing in DefIcons Prefs editor
-2. The icon ENVARC:Sys/def_<filetype> contains the MIMETYPE tooltype.
-@endnode
-
-@node Keyboard "Keyboard Controls"
-This is a list of the keyboard shortcuts used in NetSurf
-
-- RAmiga + R or F5 (reload the current page)
-- PageUp/Down/Space (scroll up/down to one page)
-- Home/End (go to top/bottom of the page)
-- Left/Right/Up/Down (scroll the page)
-- RAmiga + U (activate the URL bar)
-- Alt + Left/Right (keyboard navigation of tabs)
-- Backspace (go back to one page in history)
-
-Keyboard shortcuts used in NetSurf menu
-
-- RAmiga + N (open a new window)
-- RAmiga + T (open a new tab)
-- RAmiga + O (open a local file)
-- RAmiga + S (save source page)
-- RAmiga + K (close current tab)
-- RAmiga + P (print a page)
-- RAmiga + ? (about NetSurf)
-- RAmiga + Q (quit NetSurf)
-- RAmiga + X (cut)
-- RAmiga + C (copy)
-- RAmiga + V (paste)
-- RAmiga + A (select all)
-- RAmiga + Z (undo)
-- RAmiga + Y (redo)
-- RAmiga + F (find a string/text)
-- RAmiga + - or F9 (decrease scale)
-- RAmiga + = or F8 (normal scale)
-- RAmiga + + or F10 (increase scale)
-- RAmiga + B (add link to bookmark)
-- RAmiga + H (show bookmarks)
-- RAmiga + E (execute script)
-
-@endnode
-
-@node Speed "Optimising for speed"
-There are a number of options which can be changed that will affect the speed of NetSurf's rendering. Here are a list of the fastest settings which may help decrease rendering time on slower platforms:
-
-@{lindent 2}* Ensure NetSurf is running on a @{b}32-bit screen@{ub} if possible. NetSurf down-converts from 32-bit ARGB for display, which can impact performance.@{lindent 0}
-
-@{lindent 2}* In preferences, General tab, enable @{b}Fast scrolling@{ub}.@{lindent 0}
-
-@{lindent 2}* In preferences, Rendering tab set:
-@{b}Cache native versions@{ub} to @{b}Scaled@{ub} (or preferably @{b}All@{ub}, but this will use more graphics mem, and scaling images is a bigger performance hit)
-Deselect @{b}Higher quality scaling@{ub}, this will be very slow if not done in hardware.@{lindent 0}
-
-@{lindent 2}* In @{"Options" link Options}, increase redraw_tile_size_x/y (increasing this value uses more graphics mem)@{lindent 0}
-
-@{lindent 2}* In @{"Options" link Options}, set font_antialiasing:0@{lindent 0}
-@endnode
-
-@node contact "Credits"
-NetSurf was ported to AmigaOS 4 by Chris Young
-chris\@unsatisfactorysoftware.co.uk
-
-The pointer images, AISS theme icon and Throbber were drawn by Martin 'Mason' Merz.
-http://www.masonicons.de
-
-The default theme icon was adapted from the NetSurf logo by Marko K. Seppänen.
-
-All other code and files are the same for all platforms and credited in the files and/or on the NetSurf website.
-http://www.netsurf-browser.org
-
-The source code can be obtained from http://source.netsurf-browser.org or (in the event the service is unavailable) chris\@unsatisfactorysoftware.co.uk or any other of the NetSurf developers.
-@endnode
diff --git a/amiga/dist/NetSurf.guide.info b/amiga/dist/NetSurf.guide.info
deleted file mode 100644
index d6d529d31..000000000
--- a/amiga/dist/NetSurf.guide.info
+++ /dev/null
Binary files differ
diff --git a/amiga/dist/Rexx.info b/amiga/dist/Rexx.info
deleted file mode 100644
index 908b01843..000000000
--- a/amiga/dist/Rexx.info
+++ /dev/null
Binary files differ
diff --git a/amiga/dist/Rexx/CloseTabs.nsrx b/amiga/dist/Rexx/CloseTabs.nsrx
deleted file mode 100644
index 276ae11a3..000000000
--- a/amiga/dist/Rexx/CloseTabs.nsrx
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* This script closes all tabs other than the current one */
-
-options results
-address netsurf
-
-/* Find the currently active window and tab */
-active
-awin = result
-active tab
-atab = result
-
-/* Find out how many tabs are in the active window */
-windows window awin
-tabs = result
-
-if tabs=1 then exit
-
-/* Close all tabs above the current one */
-do t=tabs to atab+1 by -1
- close window awin tab t
-end
-
-/* Close all tabs below the current one
- * NB: The active tab number will change when lower-numbered tabs are closed!
- */
-
-do t=1 to atab-1
- close window awin tab 1
-end
diff --git a/amiga/dist/Rexx/SMTube.nsrx b/amiga/dist/Rexx/SMTube.nsrx
deleted file mode 100644
index 5f1ab209a..000000000
--- a/amiga/dist/Rexx/SMTube.nsrx
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* This script launches SMTube (OS4Depot:video/play/smtube) */
-
-options results
-geturl
-
-if open('smtube','APPDIR:SMTube','R') then do
- close('smtube')
- address COMMAND 'APPDIR:SMTube' result
-end
-else
- address command 'requestchoice >NIL: "NetSurf" "SMTube must be installed for this script to function.*n*nIt can be downloaded from OS4Depot:video/play/smtube" "OK"'
diff --git a/amiga/dist/Rexx/ShowTitles.nsrx b/amiga/dist/Rexx/ShowTitles.nsrx
deleted file mode 100644
index 27de74122..000000000
--- a/amiga/dist/Rexx/ShowTitles.nsrx
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Show all NetSurf windows and tabs open */
-
-options results
-address netsurf
-
-windows
-wins = result
-
-do w=1 to wins
- windows window w
- tabs = result
- say "Window" w "(" || tabs "tabs)"
-
- do t=1 to tabs
- gettitle window w tab t
- say " Tab" t || ":" result
- end
-end
diff --git a/amiga/dist/Rexx/viewsource.nsrx b/amiga/dist/Rexx/viewsource.nsrx
deleted file mode 100755
index 755e7a3b6..000000000
--- a/amiga/dist/Rexx/viewsource.nsrx
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* This scripts shows the source of the current page in Notepad */
-options results
-
-'save t:nstmp'
-getscreenname
-address command 'sys:utilities/notepad t:nstmp pubscreen' result
diff --git a/amiga/download.c b/amiga/download.c
deleted file mode 100644
index a0bc5c47b..000000000
--- a/amiga/download.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Copyright 2008-2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <string.h>
-
-#include <proto/wb.h>
-#include <proto/asl.h>
-#include <proto/exec.h>
-#include <proto/dos.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-#include <proto/icon.h>
-#ifdef __amigaos4__
-#include <proto/application.h>
-#endif
-
-#include <workbench/icon.h>
-
-#include <proto/window.h>
-#include <proto/layout.h>
-
-#include <proto/fuelgauge.h>
-#include <classes/window.h>
-#include <gadgets/fuelgauge.h>
-#include <gadgets/layout.h>
-
-#include <reaction/reaction_macros.h>
-
-#include "utils/errors.h"
-#include "utils/nsurl.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "utils/string.h"
-#include "desktop/download.h"
-#include "desktop/save_complete.h"
-#include "desktop/browser.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-#include "desktop/gui_download.h"
-#include "image/ico.h"
-
-#include "amiga/gui.h"
-#include "amiga/download.h"
-#include "amiga/object.h"
-#include "amiga/bitmap.h"
-#include "amiga/icon.h"
-#include "amiga/file.h"
-#include "amiga/drag.h"
-#include "amiga/iff_dr2d.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/theme.h"
-#include "amiga/utf8.h"
-
-struct gui_download_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_LAST];
- BPTR fh;
- uint32 size;
- uint32 downloaded;
- struct dlnode *dln;
- struct browser_window *bw;
- struct download_context *ctx;
- const char *url;
- char fname[1024];
- int result;
-};
-
-enum {
- AMINS_DLOAD_OK = 0,
- AMINS_DLOAD_ERROR,
- AMINS_DLOAD_ABORT,
-};
-
-int downloads_in_progress = 0;
-
-static struct gui_download_window *gui_download_window_create(download_context *ctx,
- struct gui_window *gui)
-{
- const char *url = nsurl_access(download_context_get_url(ctx));
- unsigned long total_size = download_context_get_total_length(ctx);
- struct gui_download_window *dw;
- char *dl_filename = ami_utf8_easy(download_context_get_filename(ctx));
- APTR va[3];
-
- dw = ami_misc_allocvec_clear(sizeof(struct gui_download_window), 0);
-
- if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
- {
- strcpy(dw->fname, dw->dln->filename);
- free(dw->dln->node.ln_Name);
- dw->dln->node.ln_Name = NULL;
- }
- else
- {
- if(AslRequestTags(savereq,
- ASLFR_Window, gui->shared->win,
- ASLFR_SleepWindow, TRUE,
- ASLFR_TitleText, messages_get("NetSurf"),
- ASLFR_Screen, scrn,
- ASLFR_InitialFile, dl_filename,
- TAG_DONE))
- {
- strlcpy(dw->fname, savereq->fr_Drawer, 1024);
- AddPart((STRPTR)&dw->fname,savereq->fr_File,1024);
- if(!ami_download_check_overwrite(dw->fname, gui->shared->win, total_size))
- {
- FreeVec(dw);
- return NULL;
- }
- }
- else
- {
- FreeVec(dw);
- return NULL;
- }
- }
-
- if(dl_filename) ami_utf8_free(dl_filename);
- dw->size = total_size;
- dw->downloaded = 0;
- if(gui) dw->bw = gui->bw;
- dw->url = url;
-
- va[0] = (APTR)dw->downloaded;
- va[1] = (APTR)dw->size;
- va[2] = 0;
-
- if(!(dw->fh = FOpen((STRPTR)&dw->fname,MODE_NEWFILE,0)))
- {
- FreeVec(dw);
- return NULL;
- }
-
- dw->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, dw->url,
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, FALSE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,dw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_LockHeight,TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, dw->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, dw->objects[GID_STATUS] = FuelGaugeObj,
- GA_ID,GID_STATUS,
- GA_Text,messages_get("amiDownload"),
- FUELGAUGE_Min,0,
- FUELGAUGE_Max,total_size,
- FUELGAUGE_Level,0,
- FUELGAUGE_Ticks,11,
- FUELGAUGE_ShortTicks,TRUE,
- FUELGAUGE_VarArgs,va,
- FUELGAUGE_Percent,FALSE,
- FUELGAUGE_Justification,FGJ_CENTER,
- FuelGaugeEnd,
- CHILD_NominalSize,TRUE,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, dw->objects[GID_CANCEL] = ButtonObj,
- GA_ID,GID_CANCEL,
- GA_RelVerify,TRUE,
- GA_Text,messages_get("Abort"),
- GA_TabCycle,TRUE,
- ButtonEnd,
- EndGroup,
- EndWindow;
-
- dw->win = (struct Window *)RA_OpenWindow(dw->objects[OID_MAIN]);
- dw->ctx = ctx;
-
- dw->node = AddObject(window_list,AMINS_DLWINDOW);
- dw->node->objstruct = dw;
-
- downloads_in_progress++;
-
- return dw;
-}
-
-static nserror gui_download_window_data(struct gui_download_window *dw,
- const char *data, unsigned int size)
-{
- APTR va[3];
- if(!dw) return NSERROR_SAVE_FAILED;
-
- FWrite(dw->fh,data,1,size);
-
- dw->downloaded = dw->downloaded + size;
-
- va[0] = (APTR)dw->downloaded;
- va[1] = (APTR)dw->size;
- va[2] = 0;
-
- if(dw->size)
- {
- RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
- FUELGAUGE_Level, dw->downloaded,
- GA_Text, messages_get("amiDownload"),
- FUELGAUGE_VarArgs, va,
- TAG_DONE);
- }
- else
- {
- RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
- FUELGAUGE_Level, dw->downloaded,
- GA_Text, messages_get("amiDownloadU"),
- FUELGAUGE_VarArgs, va,
- TAG_DONE);
- }
-
- return NSERROR_OK;
-}
-
-static void gui_download_window_done(struct gui_download_window *dw)
-{
- struct dlnode *dln,*dln2 = NULL;
- struct browser_window *bw;
- bool queuedl = false;
-
- if(!dw) return;
- bw = dw->bw;
-
- if((nsoption_bool(download_notify)) && (dw->result == AMINS_DLOAD_OK))
- {
- Notify(ami_gui_get_app_id(), APPNOTIFY_Title, messages_get("amiDownloadComplete"),
- APPNOTIFY_PubScreenName, "FRONT",
- APPNOTIFY_BackMsg, dw->fname,
- APPNOTIFY_CloseOnDC, TRUE,
- APPNOTIFY_Text, dw->fname,
- TAG_DONE);
- }
-
- download_context_destroy(dw->ctx);
-
- if((dln = dw->dln))
- {
- dln2 = (struct dlnode *)GetSucc((struct Node *)dln);
- if((dln!=dln2) && (dln2)) queuedl = true;
-
- free(dln->filename);
- Remove((struct Node *)dln);
- FreeVec(dln);
- }
-
- FClose(dw->fh);
- SetComment(dw->fname, dw->url);
-
- downloads_in_progress--;
-
- DisposeObject(dw->objects[OID_MAIN]);
- DelObject(dw->node);
- if(queuedl) {
- nsurl *url;
- if (nsurl_create(dln2->node.ln_Name, &url) != NSERROR_OK) {
- amiga_warn_user("NoMemory", 0);
- } else {
- browser_window_navigate(bw,
- url,
- NULL,
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- }
- ami_try_quit(); /* In case the only window open was this download */
-}
-
-static void gui_download_window_error(struct gui_download_window *dw,
- const char *error_msg)
-{
- amiga_warn_user("Unwritten","");
- dw->result = AMINS_DLOAD_ERROR;
- gui_download_window_done(dw);
-}
-
-void ami_download_window_abort(struct gui_download_window *dw)
-{
- download_context_abort(dw->ctx);
- dw->result = AMINS_DLOAD_ABORT;
- gui_download_window_done(dw);
-}
-
-BOOL ami_download_window_event(struct gui_download_window *dw)
-{
- /* return TRUE if window destroyed */
- ULONG result;
- uint16 code;
-
- while((result = RA_HandleInput(dw->objects[OID_MAIN], &code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK)
- {
- case GID_CANCEL:
- ami_download_window_abort(dw);
- return TRUE;
- break;
- }
- break;
- }
- }
- return FALSE;
-}
-
-void ami_free_download_list(struct List *dllist)
-{
- struct dlnode *node;
- struct dlnode *nnode;
-
- if(!dllist) return;
- if(IsListEmpty(dllist)) return;
-
- node = (struct dlnode *)GetHead((struct List *)dllist);
-
- do
- {
- nnode=(struct dlnode *)GetSucc((struct Node *)node);
- free(node->node.ln_Name);
- free(node->filename);
- Remove((struct Node *)node);
- FreeVec((struct Node *)node);
- }while((node=nnode));
-}
-
-nserror
-gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
-{
- char fname[1024];
- STRPTR openurlstring,linkname;
- struct DiskObject *dobj = NULL;
-
- linkname = ASPrintf("Link_to_%s",FilePart(nsurl_access(url)));
-
- if(AslRequestTags(savereq,
- ASLFR_Window, g->shared->win,
- ASLFR_SleepWindow, TRUE,
- ASLFR_TitleText,messages_get("NetSurf"),
- ASLFR_Screen,scrn,
- ASLFR_InitialFile,linkname,
- TAG_DONE))
- {
- strlcpy(fname, savereq->fr_Drawer, 1024);
- AddPart(fname,savereq->fr_File,1024);
-
- ami_set_pointer(g->shared, GUI_POINTER_WAIT, false);
-
- if(ami_download_check_overwrite(fname, g->shared->win, 0))
- {
- BPTR fh;
-
- if((fh = FOpen(fname,MODE_NEWFILE,0)))
- {
- /* \todo Should be URLOpen on OS4.1 */
- openurlstring = ASPrintf("openurl \"%s\"\n",nsurl_access(url));
- FWrite(fh,openurlstring,1,strlen(openurlstring));
- FClose(fh);
- FreeVec(openurlstring);
- SetComment(fname, nsurl_access(url));
-
- dobj = GetIconTags(NULL,ICONGETA_GetDefaultName,"url",
- ICONGETA_GetDefaultType,WBPROJECT,
- TAG_DONE);
-
- dobj->do_DefaultTool = "IconX";
-
- PutIconTags(fname,dobj,
- ICONPUTA_NotifyWorkbench,TRUE,
- TAG_DONE);
-
- FreeDiskObject(dobj);
- }
- FreeVec(linkname);
- }
- ami_reset_pointer(g->shared);
- }
- return NSERROR_OK;
-}
-
-BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size)
-{
- /* Return TRUE if file can be (over-)written */
- int32 res = 0;
- BPTR lock = 0;
- char *overwritetext;
-
- if(nsoption_bool(ask_overwrite) == false) return TRUE;
-
- lock = Lock(file, ACCESS_READ);
-
- if(lock)
- {
- if(size) {
- BPTR fh;
- int64 oldsize = 0;
-
- if((fh = OpenFromLock(lock))) {
- oldsize = GetFileSize(fh);
- Close(fh);
- }
- overwritetext = ASPrintf("%s\n\n%s %s\n%s %s",
- messages_get("OverwriteFile"),
- messages_get("amiSizeExisting"), human_friendly_bytesize((ULONG)oldsize),
- messages_get("amiSizeNew"), human_friendly_bytesize(size));
- } else {
- UnLock(lock);
- overwritetext = ASPrintf(messages_get("OverwriteFile"));
- }
-
- res = amiga_warn_user_multi(overwritetext, "Replace", "DontReplace", win);
- FreeVec(overwritetext);
- }
- else return TRUE;
-
- if(res == 1) return TRUE;
- else return FALSE;
-}
-
-static struct gui_download_table download_table = {
- .create = gui_download_window_create,
- .data = gui_download_window_data,
- .error = gui_download_window_error,
- .done = gui_download_window_done,
-};
-
-struct gui_download_table *amiga_download_table = &download_table;
diff --git a/amiga/download.h b/amiga/download.h
deleted file mode 100755
index 51981ede8..000000000
--- a/amiga/download.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2008-9 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_DOWNLOAD_H
-#define AMIGA_DOWNLOAD_H
-
-#include "amiga/os3support.h"
-
-extern struct gui_download_table *amiga_download_table;
-
-struct download_context;
-struct gui_download_window;
-struct gui_window;
-struct nsurl;
-
-struct dlnode
-{
- struct Node node;
- char *filename;
-};
-
-void ami_download_window_abort(struct gui_download_window *dw);
-BOOL ami_download_window_event(struct gui_download_window *dw);
-void ami_free_download_list(struct List *dllist);
-BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size);
-
-nserror gui_window_save_link(struct gui_window *g, struct nsurl *url, const char *title);
-
-#endif
diff --git a/amiga/drag.c b/amiga/drag.c
deleted file mode 100644
index 67d17223e..000000000
--- a/amiga/drag.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifdef __amigaos4__
-#include <string.h>
-
-#include <proto/wb.h>
-#include <proto/exec.h>
-#include <proto/dos.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-#include <proto/icon.h>
-#include <proto/layers.h>
-
-#include <graphics/blitattr.h>
-#include <workbench/icon.h>
-
-#include "utils/errors.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "content/hlcache.h"
-#include "desktop/mouse.h"
-
-#include "amiga/bitmap.h"
-#include "amiga/clipboard.h"
-#include "amiga/download.h"
-#include "amiga/drag.h"
-#include "amiga/file.h"
-#include "amiga/filetype.h"
-#include "amiga/gui.h"
-#include "amiga/theme.h"
-
-
-struct Window *drag_icon = NULL;
-ULONG drag_icon_width;
-ULONG drag_icon_height;
-BOOL drag_in_progress = FALSE;
-
-void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c,
- gui_save_type type)
-{
- const char *filetype = NULL;
-
- /* Check we are running on Workbench */
- if(nsoption_charp(pubscreen_name) == NULL) return;
- if(strcmp(nsoption_charp(pubscreen_name), "Workbench")) return;
-
- switch(type) {
- case GUI_SAVE_OBJECT_ORIG: // object
- case GUI_SAVE_SOURCE:
- filetype = ami_mime_content_to_filetype(c);
- break;
- case GUI_SAVE_COMPLETE:
- filetype = "drawer";
- break;
- case GUI_SAVE_OBJECT_NATIVE:
-#ifdef WITH_NS_SVG
- if(ami_mime_compare(c, "svg") == true)
- {
- filetype = "dr2d";
- }
- else
-#endif
- {
- filetype = "ilbm";
- }
- break;
-
- default:
- break;
- }
-
- ami_drag_icon_show(g->shared->win, filetype);
-
- drag_save_data = c;
- drag_save_gui = g;
- drag_save = type;
-}
-
-void gui_drag_save_selection(struct gui_window *g, const char *selection)
-{
- ami_drag_icon_show(g->shared->win, "ascii");
-
- ami_autoscroll = TRUE;
- drag_save_data = g;
- drag_save = GUI_SAVE_TEXT_SELECTION;
-}
-
-void ami_drag_save(struct Window *win)
-{
- ULONG which = WBO_NONE, type;
- char path[1025], dpath[1025];
-
- ami_drag_icon_close(NULL);
- ami_autoscroll = FALSE;
-
- if(nsoption_charp(pubscreen_name) && (strcmp(nsoption_charp(pubscreen_name),"Workbench") == 0))
- {
- which = WhichWorkbenchObject(NULL,scrn->MouseX,scrn->MouseY,
- WBOBJA_Type,&type,
- WBOBJA_FullPath,&path,
- WBOBJA_FullPathSize,1024,
- WBOBJA_DrawerPath,&dpath,
- WBOBJA_DrawerPathSize,1024,
- TAG_DONE);
- }
-
- if((which == WBO_DRAWER) || ((which == WBO_ICON) && (type > WBDRAWER)))
- {
- strcpy(path,dpath);
- }
- else if(which == WBO_NONE)
- {
- if(drag_save == GUI_SAVE_TEXT_SELECTION)
- ami_drag_selection((struct gui_window *)drag_save_data);
- else DisplayBeep(scrn);
-
- drag_save = 0;
- drag_save_data = NULL;
- return;
- }
-
- if(path[0] == '\0')
- {
- DisplayBeep(scrn);
- drag_save = 0;
- drag_save_data = NULL;
- return;
- }
-
- ami_update_pointer(win, GUI_POINTER_WAIT);
-
- switch(drag_save)
- {
- case GUI_SAVE_OBJECT_ORIG: // object
- case GUI_SAVE_SOURCE:
- {
- struct hlcache_handle *c = drag_save_data;
-
- AddPart(path, content_get_title(c), 1024);
- ami_file_save(AMINS_SAVE_SOURCE, path, win, c, NULL, NULL);
- }
- break;
-
- case GUI_SAVE_TEXT_SELECTION: // selection
- AddPart(path,"netsurf_text_selection",1024);
- struct gui_window *g = (struct gui_window *) drag_save_data;
- ami_file_save(AMINS_SAVE_SELECTION, path, win, NULL, NULL, g->bw);
- break;
-
- case GUI_SAVE_COMPLETE:
- {
- struct hlcache_handle *c = drag_save_data;
-
- AddPart(path, content_get_title(c), 1024);
- ami_file_save(AMINS_SAVE_COMPLETE, path, win, c, drag_save_gui->favicon, NULL);
- }
- break;
-
- case GUI_SAVE_OBJECT_NATIVE:
- {
- hlcache_handle *c = drag_save_data;
- AddPart(path, content_get_title(c), 1024);
-
- ami_file_save(AMINS_SAVE_IFF, path, win, c, NULL, NULL);
- }
- break;
-
- default:
- LOG("Unsupported drag save operation %d", drag_save);
- break;
- }
-
- drag_save = 0;
- drag_save_data = NULL;
-
- ami_update_pointer(win, GUI_POINTER_DEFAULT);
-}
-
-void ami_drag_icon_show(struct Window *win, const char *type)
-{
- struct DiskObject *dobj = NULL;
- ULONG width, height;
- int deftype = WBPROJECT;
-
- drag_in_progress = TRUE;
-
- if(nsoption_bool(drag_save_icons) == false)
- {
- ami_update_pointer(win, AMI_GUI_POINTER_DRAG);
- return;
- }
- else
- {
- ami_update_pointer(win, GUI_POINTER_DEFAULT);
- }
-
- if(!strcmp(type, "drawer")) deftype = WBDRAWER;
-
- dobj = GetIconTags(NULL, ICONGETA_GetDefaultName, type,
- ICONGETA_GetDefaultType, deftype,
- TAG_DONE);
-
- IconControl(dobj,
- ICONCTRLA_GetWidth,&width,
- ICONCTRLA_GetHeight,&height,
- TAG_DONE);
-
- drag_icon_width = width;
- drag_icon_height = height;
-
- drag_icon = OpenWindowTags(NULL,
- WA_Left, scrn->MouseX - (width/2),
- WA_Top, scrn->MouseY - (height/2),
- WA_Width, width,
- WA_Height, height,
- WA_PubScreen, scrn,
- WA_Borderless, TRUE,
- WA_ToolBox, TRUE,
- WA_StayTop, TRUE,
- WA_Opaqueness, 128,
- WA_OverrideOpaqueness, TRUE,
- TAG_DONE);
-
-/* probably need layouticon and drawinfo stuff too */
-
- DrawIconState(drag_icon->RPort, dobj, NULL, 0, 0, IDS_NORMAL,
- ICONDRAWA_Frameless, TRUE,
- ICONDRAWA_Borderless, TRUE,
- TAG_DONE);
-}
-
-void ami_drag_icon_move(void)
-{
- if(drag_icon == NULL) return;
-
- ChangeWindowBox(drag_icon, scrn->MouseX - (drag_icon_width / 2),
- scrn->MouseY - (drag_icon_height / 2),
- drag_icon_width, drag_icon_height);
-}
-
-/**
- * Close the drag icon (invisible) window if it is open
- *
- * \param win pointer to window to clear drag pointer
- */
-
-void ami_drag_icon_close(struct Window *win)
-{
- if(drag_icon) CloseWindow(drag_icon);
- if(win) ami_update_pointer(win, GUI_POINTER_DEFAULT);
- drag_icon = NULL;
- drag_in_progress = FALSE;
-}
-
-BOOL ami_drag_in_progress(void)
-{
- return drag_in_progress;
-}
-
-static void *ami_find_gwin_by_id(struct Window *win, uint32 type)
-{
- struct nsObject *node, *nnode;
- struct gui_window_2 *gwin;
-
- if(!IsMinListEmpty(window_list))
- {
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- if(node->Type == type)
- {
- gwin = node->objstruct;
- if(win == gwin->win) return gwin;
- }
- } while((node = nnode));
- }
- return NULL;
-}
-
-void *ami_window_at_pointer(int type)
-{
- struct Layer *layer;
-
- LockLayerInfo(&scrn->LayerInfo);
-
- layer = WhichLayer(&scrn->LayerInfo, scrn->MouseX, scrn->MouseY);
-
- UnlockLayerInfo(&scrn->LayerInfo);
-
- if(layer) return ami_find_gwin_by_id(layer->Window, type);
- else return NULL;
-}
-
-#else
-#include "amiga/drag.h"
-
-void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c,
- gui_save_type type)
-{
-}
-
-void gui_drag_save_selection(struct gui_window *g, const char *selection)
-{
-}
-
-void ami_drag_save(struct Window *win)
-{
-}
-
-void ami_drag_icon_show(struct Window *win, const char *type)
-{
-}
-
-void ami_drag_icon_close(struct Window *win)
-{
-}
-
-void ami_drag_icon_move(void)
-{
-}
-
-BOOL ami_drag_in_progress(void)
-{
- return FALSE;
-}
-
-void *ami_window_at_pointer(int type)
-{
- return NULL;
-}
-#endif
-
diff --git a/amiga/drag.h b/amiga/drag.h
deleted file mode 100644
index 59a1a8467..000000000
--- a/amiga/drag.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_DRAG_H
-#define AMIGA_DRAG_H
-#include <exec/types.h>
-#include "desktop/browser.h"
-#include "desktop/gui_window.h"
-
-#define AMI_DRAG_THRESHOLD 10
-
-struct hlcache_handle;
-struct Window;
-
-int drag_save;
-void *drag_save_data;
-struct gui_window *drag_save_gui;
-
-void gui_drag_save_selection(struct gui_window *g, const char *selection);
-void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c, gui_save_type type);
-
-void ami_drag_save(struct Window *win);
-void ami_drag_icon_show(struct Window *win, const char *type);
-void ami_drag_icon_close(struct Window *win);
-void ami_drag_icon_move(void);
-BOOL ami_drag_in_progress(void);
-
-void *ami_window_at_pointer(int type);
-#endif
-
diff --git a/amiga/dt_anim.c b/amiga/dt_anim.c
deleted file mode 100644
index a3bfb1d66..000000000
--- a/amiga/dt_anim.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * DataTypes animation handler (implementation)
-*/
-
-#ifdef WITH_AMIGA_DATATYPES
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-#include <proto/datatypes.h>
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <datatypes/animationclass.h>
-#include <datatypes/pictureclass.h>
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#endif
-#include <intuition/classusr.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "content/content_protected.h"
-#include "desktop/plotters.h"
-#include "image/bitmap.h"
-
-#include "amiga/bitmap.h"
-#include "amiga/filetype.h"
-#include "amiga/datatypes.h"
-#include "amiga/misc.h"
-#include "amiga/plotters.h"
-
-typedef struct amiga_dt_anim_content {
- struct content base;
-
- struct bitmap *bitmap; /**< Created NetSurf bitmap */
-
- Object *dto;
- int x;
- int y;
- int w;
- int h;
-} amiga_dt_anim_content;
-
-APTR ami_colormap_to_clut(struct ColorMap *cmap);
-
-static nserror amiga_dt_anim_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c);
-static bool amiga_dt_anim_convert(struct content *c);
-static void amiga_dt_anim_reformat(struct content *c, int width, int height);
-static void amiga_dt_anim_destroy(struct content *c);
-static bool amiga_dt_anim_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx);
-static void amiga_dt_anim_open(struct content *c, struct browser_window *bw,
- struct content *page, struct object_params *params);
-static void amiga_dt_anim_close(struct content *c);
-static nserror amiga_dt_anim_clone(const struct content *old, struct content **newc);
-static content_type amiga_dt_anim_content_type(void);
-
-static void *amiga_dt_anim_get_internal(const struct content *c, void *context)
-{
- amiga_dt_anim_content *adta_c = (amiga_dt_anim_content *)c;
-
- return adta_c->bitmap;
-}
-
-static const content_handler amiga_dt_anim_content_handler = {
- .create = amiga_dt_anim_create,
- .data_complete = amiga_dt_anim_convert,
- .reformat = amiga_dt_anim_reformat,
- .destroy = amiga_dt_anim_destroy,
- .redraw = amiga_dt_anim_redraw,
- .open = amiga_dt_anim_open,
- .close = amiga_dt_anim_close,
- .clone = amiga_dt_anim_clone,
- .get_internal = amiga_dt_anim_get_internal,
- .type = amiga_dt_anim_content_type,
- .no_share = false,
-};
-
-nserror amiga_dt_anim_init(void)
-{
- struct DataType *dt, *prevdt = NULL;
- lwc_string *type;
- nserror error;
- struct Node *node = NULL;
-
- while((dt = ObtainDataType(DTST_RAM, NULL,
- DTA_DataType, prevdt,
- DTA_GroupID, GID_ANIMATION,
- TAG_DONE)) != NULL)
- {
- ReleaseDataType(prevdt);
- prevdt = dt;
-
- do {
- node = ami_mime_from_datatype(dt, &type, node);
-
- if(node)
- {
- error = content_factory_register_handler(
- lwc_string_data(type),
- &amiga_dt_anim_content_handler);
-
- if (error != NSERROR_OK)
- return error;
- }
-
- }while (node != NULL);
-
- }
-
- ReleaseDataType(prevdt);
-
- return NSERROR_OK;
-}
-
-nserror amiga_dt_anim_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- amiga_dt_anim_content *plugin;
- nserror error;
-
- plugin = calloc(1, sizeof(amiga_dt_anim_content));
- if (plugin == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&plugin->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(plugin);
- return error;
- }
-
- *c = (struct content *) plugin;
-
- return NSERROR_OK;
-}
-
-bool amiga_dt_anim_convert(struct content *c)
-{
- LOG("amiga_dt_anim_convert");
-
- amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c;
- union content_msg_data msg_data;
- int width, height;
- const uint8 *data;
- UBYTE *bm_buffer;
- ULONG size;
- struct BitMapHeader *bmh;
- unsigned int bm_flags = BITMAP_NEW | BITMAP_OPAQUE;
- struct adtFrame adt_frame;
- APTR clut;
-
- data = (uint8 *)content__get_source_data(c, &size);
-
- if((plugin->dto = NewDTObject(NULL,
- DTA_SourceType, DTST_MEMORY,
- DTA_SourceAddress, data,
- DTA_SourceSize, size,
- DTA_GroupID, GID_ANIMATION,
- TAG_DONE))) {
- if(GetDTAttrs(plugin->dto, PDTA_BitMapHeader, &bmh, TAG_DONE)) {
- width = (int)bmh->bmh_Width;
- height = (int)bmh->bmh_Height;
-
- plugin->bitmap = amiga_bitmap_create(width, height, bm_flags);
- if (!plugin->bitmap) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
- return false;
- }
-
- bm_buffer = amiga_bitmap_get_buffer(plugin->bitmap);
-
- adt_frame.MethodID = ADTM_LOADFRAME;
- adt_frame.alf_TimeStamp = 0;
- IDoMethodA(plugin->dto, (Msg)&adt_frame);
-
- clut = ami_colormap_to_clut(adt_frame.alf_CMap);
-#ifdef __amigaos4__
- BltBitMapTags(
- BLITA_Width, width,
- BLITA_Height, height,
- BLITA_Source, adt_frame.alf_BitMap,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_Dest, bm_buffer,
- BLITA_DestType, BLITT_RGB24,
- BLITA_DestBytesPerRow, width,
- BLITA_CLUT, clut,
- TAG_DONE);
-#else
-#warning FIXME: Need to use a different blitter function for OS3!
-#endif
- FreeVec(clut);
-
- adt_frame.MethodID = ADTM_UNLOADFRAME;
- IDoMethodA(plugin->dto, (Msg)&adt_frame);
- }
- else return false;
- }
- else return false;
-
- c->width = width;
- c->height = height;
-
-/*
- snprintf(title, sizeof(title), "image (%lux%lu, %lu bytes)",
- width, height, size);
- content__set_title(c, title);
-*/
-
- amiga_bitmap_modified(plugin->bitmap);
-
- content_set_ready(c);
- content_set_done(c);
-
- content_set_status(c, "");
- return true;
-}
-
-void amiga_dt_anim_destroy(struct content *c)
-{
- amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c;
-
- LOG("amiga_dt_anim_destroy");
-
- if (plugin->bitmap != NULL)
- amiga_bitmap_destroy(plugin->bitmap);
-
- DisposeDTObject(plugin->dto);
-
- return;
-}
-
-bool amiga_dt_anim_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx)
-{
- amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c;
- bitmap_flags_t flags = BITMAPF_NONE;
-
- LOG("amiga_dt_anim_redraw");
-
- if (data->repeat_x)
- flags |= BITMAPF_REPEAT_X;
- if (data->repeat_y)
- flags |= BITMAPF_REPEAT_Y;
-
- return ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- plugin->bitmap, data->background_colour, flags);
-}
-
-/**
- * Handle a window containing a CONTENT_PLUGIN being opened.
- *
- * \param c content that has been opened
- * \param bw browser window containing the content
- * \param page content of type CONTENT_HTML containing c, or 0 if not an
- * object within a page
- * \param box box containing c, or 0 if not an object
- * \param params object parameters, or 0 if not an object
- */
-void amiga_dt_anim_open(struct content *c, struct browser_window *bw,
- struct content *page, struct object_params *params)
-{
- LOG("amiga_dt_anim_open");
-
- return;
-}
-
-void amiga_dt_anim_close(struct content *c)
-{
- LOG("amiga_dt_anim_close");
- return;
-}
-
-void amiga_dt_anim_reformat(struct content *c, int width, int height)
-{
- LOG("amiga_dt_anim_reformat");
- return;
-}
-
-nserror amiga_dt_anim_clone(const struct content *old, struct content **newc)
-{
- amiga_dt_anim_content *plugin;
- nserror error;
-
- LOG("amiga_dt_anim_clone");
-
- plugin = calloc(1, sizeof(amiga_dt_anim_content));
- if (plugin == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &plugin->base);
- if (error != NSERROR_OK) {
- content_destroy(&plugin->base);
- return error;
- }
-
- /* We "clone" the old content by replaying conversion */
- if (old->status == CONTENT_STATUS_READY ||
- old->status == CONTENT_STATUS_DONE) {
- if (amiga_dt_anim_convert(&plugin->base) == false) {
- content_destroy(&plugin->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- *newc = (struct content *) plugin;
-
- return NSERROR_OK;
-}
-
-content_type amiga_dt_anim_content_type(void)
-{
- return CONTENT_IMAGE;
-}
-
-APTR ami_colormap_to_clut(struct ColorMap *cmap)
-{
- int i;
- UBYTE *clut = ami_misc_allocvec_clear(256 * 4, 0); /* NB: Was not MEMF_PRIVATE */
- ULONG colr[256 * 4];
-
- if(!clut) return NULL;
-
- /* Get the palette from the ColorMap */
- GetRGB32(cmap, 0, 256, (ULONG *)&colr);
-
- /* convert it to a table of ARGB values */
- for(i = 0; i < 1024; i += 4)
- {
- clut[i] = (0xff << 24) |
- ((colr[i] & 0xff000000) >> 8) |
- ((colr[i + 1] & 0xff000000) >> 16) |
- ((colr[i + 2] & 0xff000000) >> 24);
- }
-
- return clut;
-}
-
-#endif
diff --git a/amiga/dt_picture.c b/amiga/dt_picture.c
deleted file mode 100644
index aa2418dca..000000000
--- a/amiga/dt_picture.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright 2011 - 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * DataTypes picture handler (implementation)
-*/
-
-#ifdef WITH_AMIGA_DATATYPES
-#include "amiga/os3support.h"
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <proto/datatypes.h>
-#include <proto/dos.h>
-#include <proto/intuition.h>
-#include <datatypes/pictureclass.h>
-#include <intuition/classusr.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "content/content_protected.h"
-#include "desktop/plotters.h"
-#include "image/bitmap.h"
-#include "image/image_cache.h"
-
-#include "amiga/bitmap.h"
-#include "amiga/filetype.h"
-#include "amiga/datatypes.h"
-
-
-static nserror amiga_dt_picture_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c);
-static bool amiga_dt_picture_convert(struct content *c);
-static nserror amiga_dt_picture_clone(const struct content *old, struct content **newc);
-static void amiga_dt_picture_destroy(struct content *c);
-
-static const content_handler amiga_dt_picture_content_handler = {
- .create = amiga_dt_picture_create,
- .data_complete = amiga_dt_picture_convert,
- .destroy = amiga_dt_picture_destroy,
- .redraw = image_cache_redraw,
- .clone = amiga_dt_picture_clone,
- .get_internal = image_cache_get_internal,
- .type = image_cache_content_type,
- .no_share = false,
-};
-
-struct amiga_dt_picture_content {
- struct content c;
- Object *dto;
-};
-
-nserror amiga_dt_picture_init(void)
-{
- struct DataType *dt, *prevdt = NULL;
- lwc_string *type;
- nserror error;
- struct Node *node = NULL;
-
- while((dt = ObtainDataType(DTST_RAM, NULL,
- DTA_DataType, prevdt,
- DTA_GroupID, GID_PICTURE, // we only support images for now
- TAG_DONE)) != NULL)
- {
- if(prevdt) ReleaseDataType(prevdt);
- prevdt = dt;
-
- do {
- node = ami_mime_from_datatype(dt, &type, node);
-
- if(node)
- {
- error = content_factory_register_handler(
- lwc_string_data(type),
- &amiga_dt_picture_content_handler);
-
- if (error != NSERROR_OK)
- return error;
- }
-
- }while (node != NULL);
-
- }
-
- ReleaseDataType(prevdt);
-
- return NSERROR_OK;
-}
-
-nserror amiga_dt_picture_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- struct amiga_dt_picture_content *adt;
- nserror error;
-
- adt = calloc(1, sizeof(struct amiga_dt_picture_content));
- if (adt == NULL)
- return NSERROR_NOMEM;
-
- error = content__init((struct content *)adt, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(adt);
- return error;
- }
-
- *c = (struct content *)adt;
-
- return NSERROR_OK;
-}
-
-static Object *amiga_dt_picture_newdtobject(struct amiga_dt_picture_content *adt)
-{
- const uint8 *data;
- ULONG size;
-
- if(adt->dto == NULL) {
- data = (uint8 *)content__get_source_data((struct content *)adt, &size);
-
- adt->dto = NewDTObject(NULL,
- DTA_SourceType, DTST_MEMORY,
- DTA_SourceAddress, data,
- DTA_SourceSize, size,
- DTA_GroupID, GID_PICTURE,
- PDTA_DestMode, PMODE_V43,
- PDTA_PromoteMask, TRUE,
- TAG_DONE);
- }
-
- return adt->dto;
-}
-
-static char *amiga_dt_picture_datatype(struct content *c)
-{
- const uint8 *data;
- ULONG size;
- struct DataType *dt;
- char *filetype = NULL;
-
- data = (uint8 *)content__get_source_data(c, &size);
-
- if((dt = ObtainDataType(DTST_MEMORY, NULL,
- DTA_SourceAddress, data,
- DTA_SourceSize, size,
- DTA_GroupID, GID_PICTURE,
- TAG_DONE))) {
- filetype = strdup(dt->dtn_Header->dth_Name);
- ReleaseDataType(dt);
- }
-
- if(filetype == NULL) filetype = strdup("DataTypes");
- return filetype;
-}
-
-static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
-{
- LOG("amiga_dt_picture_cache_convert");
-
- union content_msg_data msg_data;
- UBYTE *bm_buffer;
- Object *dto;
- struct bitmap *bitmap;
- struct amiga_dt_picture_content *adt = (struct amiga_dt_picture_content *)c;
-
- if((dto = amiga_dt_picture_newdtobject(adt)))
- {
- bitmap = amiga_bitmap_create(c->width, c->height, BITMAP_NEW);
- if (!bitmap) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
- return NULL;
- }
-
- bm_buffer = amiga_bitmap_get_buffer(bitmap);
-
- IDoMethod(dto, PDTM_READPIXELARRAY,
- bm_buffer, PBPAFMT_RGBA,
- amiga_bitmap_get_rowstride(bitmap),
- 0, 0, c->width, c->height);
-
- amiga_bitmap_set_opaque(bitmap, amiga_bitmap_test_opaque(bitmap));
-
- DisposeDTObject(dto);
- adt->dto = NULL;
- }
- else return NULL;
-
- return bitmap;
-}
-
-bool amiga_dt_picture_convert(struct content *c)
-{
- LOG("amiga_dt_picture_convert");
-
- int width, height;
- char *title;
- Object *dto;
- struct BitMapHeader *bmh;
- char *filetype;
-
- if((dto = amiga_dt_picture_newdtobject((struct amiga_dt_picture_content *)c))) {
- if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE)) {
- width = (int)bmh->bmh_Width;
- height = (int)bmh->bmh_Height;
- }
- else return false;
- }
- else return false;
-
- c->width = width;
- c->height = height;
- c->size = width * height * 4;
-
- /* set title text */
- if((filetype = amiga_dt_picture_datatype(c))) {
- title = messages_get_buff("DataTypesTitle",
- nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
- filetype, c->width, c->height);
- if (title != NULL) {
- content__set_title(c, title);
- free(title);
- }
- free(filetype);
- }
-
- image_cache_add(c, NULL, amiga_dt_picture_cache_convert);
-
- content_set_ready(c);
- content_set_done(c);
- content_set_status(c, "");
- return true;
-}
-
-nserror amiga_dt_picture_clone(const struct content *old, struct content **newc)
-{
- struct content *adt;
- nserror error;
-
- LOG("amiga_dt_picture_clone");
-
- adt = calloc(1, sizeof(struct content));
- if (adt == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, adt);
- if (error != NSERROR_OK) {
- content_destroy(adt);
- return error;
- }
-
- /* We "clone" the old content by replaying conversion */
- if ((old->status == CONTENT_STATUS_READY) ||
- (old->status == CONTENT_STATUS_DONE)) {
- if (amiga_dt_picture_convert(adt) == false) {
- content_destroy(adt);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- *newc = adt;
-
- return NSERROR_OK;
-}
-
-static void amiga_dt_picture_destroy(struct content *c)
-{
- struct amiga_dt_picture_content *adt = (struct amiga_dt_picture_content *)c;
-
- DisposeDTObject(adt->dto);
- adt->dto = NULL;
-
- image_cache_destroy(c);
-}
-
-#endif
diff --git a/amiga/dt_sound.c b/amiga/dt_sound.c
deleted file mode 100644
index fe1b1fc43..000000000
--- a/amiga/dt_sound.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * DataTypes sound handler (implementation)
-*/
-
-#ifdef WITH_AMIGA_DATATYPES
-#include "amiga/os3support.h"
-
-#include "amiga/filetype.h"
-#include "amiga/datatypes.h"
-#include "content/content_protected.h"
-#include "desktop/plotters.h"
-#include "render/box.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-
-#include <proto/datatypes.h>
-#include <proto/dos.h>
-#include <proto/intuition.h>
-#include <datatypes/soundclass.h>
-#include <intuition/classusr.h>
-
-typedef struct amiga_dt_sound_content {
- struct content base;
-
- Object *dto;
- bool immediate;
-} amiga_dt_sound_content;
-
-static nserror amiga_dt_sound_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c);
-static bool amiga_dt_sound_convert(struct content *c);
-static void amiga_dt_sound_destroy(struct content *c);
-static bool amiga_dt_sound_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx);
-static void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
- struct content *page, struct object_params *params);
-static nserror amiga_dt_sound_clone(const struct content *old, struct content **newc);
-static content_type amiga_dt_sound_content_type(void);
-
-static const content_handler amiga_dt_sound_content_handler = {
- .create = amiga_dt_sound_create,
- .data_complete = amiga_dt_sound_convert,
- .destroy = amiga_dt_sound_destroy,
- .redraw = amiga_dt_sound_redraw,
- .open = amiga_dt_sound_open,
- .clone = amiga_dt_sound_clone,
- .type = amiga_dt_sound_content_type,
- .no_share = false,
-};
-
-
-static void amiga_dt_sound_play(Object *dto)
-{
- LOG("Playing...");
- IDoMethod(dto, DTM_TRIGGER, NULL, STM_PLAY, NULL);
-}
-
-
-nserror amiga_dt_sound_init(void)
-{
- struct DataType *dt, *prevdt = NULL;
- lwc_string *type;
- nserror error;
- struct Node *node = NULL;
-
- while((dt = ObtainDataType(DTST_RAM, NULL,
- DTA_DataType, prevdt,
- DTA_GroupID, GID_SOUND,
- TAG_DONE)) != NULL)
- {
- ReleaseDataType(prevdt);
- prevdt = dt;
-
- do {
- node = ami_mime_from_datatype(dt, &type, node);
-
- if(node)
- {
- error = content_factory_register_handler(
- lwc_string_data(type),
- &amiga_dt_sound_content_handler);
-
- if (error != NSERROR_OK)
- return error;
- }
-
- }while (node != NULL);
-
- }
-
- ReleaseDataType(prevdt);
-
- return NSERROR_OK;
-}
-
-nserror amiga_dt_sound_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- amiga_dt_sound_content *plugin;
- nserror error;
-
- LOG("amiga_dt_sound_create");
-
- plugin = calloc(1, sizeof(amiga_dt_sound_content));
- if (plugin == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&plugin->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(plugin);
- return error;
- }
-
- *c = (struct content *) plugin;
-
- return NSERROR_OK;
-}
-
-bool amiga_dt_sound_convert(struct content *c)
-{
- LOG("amiga_dt_sound_convert");
-
- amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
- int width = 50, height = 50;
- const uint8 *data;
- ULONG size;
-
- data = (uint8 *)content__get_source_data(c, &size);
-
- plugin->dto = NewDTObject(NULL,
- DTA_SourceType, DTST_MEMORY,
- DTA_SourceAddress, data,
- DTA_SourceSize, size,
- DTA_GroupID, GID_SOUND,
- TAG_DONE);
-
- if(plugin->dto == NULL) return false;
-
- c->width = width;
- c->height = height;
-
- if(plugin->immediate == true) amiga_dt_sound_play(plugin->dto);
-
- content_set_ready(c);
- content_set_done(c);
-
- content_set_status(c, "");
- return true;
-}
-
-void amiga_dt_sound_destroy(struct content *c)
-{
- amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
-
- LOG("amiga_dt_sound_destroy");
-
- DisposeDTObject(plugin->dto);
-
- return;
-}
-
-bool amiga_dt_sound_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx)
-{
- plot_style_t pstyle = {
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = 0xffffff,
- .stroke_colour = 0x000000,
- .stroke_width = 1,
- };
-
- LOG("amiga_dt_sound_redraw");
-
- /* this should be some sort of play/stop control */
-
- ctx->plot->rectangle(data->x, data->y, data->x + data->width,
- data->y + data->height, &pstyle);
-
- return ctx->plot->text(data->x, data->y+20,
- lwc_string_data(content__get_mime_type(c)),
- lwc_string_length(content__get_mime_type(c)),
- plot_style_font);
-
-}
-
-
-void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
- struct content *page, struct object_params *params)
-{
- amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
- struct object_param *param;
-
- LOG("amiga_dt_sound_open");
-
- plugin->immediate = false;
-
- if(params && (param = params->params))
- {
- do
- {
- LOG("%s = %s", param->name, param->value);
- if((strcmp(param->name, "autoplay") == 0) &&
- (strcmp(param->value, "true") == 0)) plugin->immediate = true;
- if((strcmp(param->name, "autoStart") == 0) &&
- (strcmp(param->value, "1") == 0)) plugin->immediate = true;
- param = param->next;
- } while(param != NULL);
- }
-
- if(plugin->dto && (plugin->immediate == true))
- amiga_dt_sound_play(plugin->dto);
-
- return;
-}
-
-
-nserror amiga_dt_sound_clone(const struct content *old, struct content **newc)
-{
- amiga_dt_sound_content *plugin;
- nserror error;
-
- LOG("amiga_dt_sound_clone");
-
- plugin = calloc(1, sizeof(amiga_dt_sound_content));
- if (plugin == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &plugin->base);
- if (error != NSERROR_OK) {
- content_destroy(&plugin->base);
- return error;
- }
-
- /* We "clone" the old content by replaying conversion */
- if (old->status == CONTENT_STATUS_READY ||
- old->status == CONTENT_STATUS_DONE) {
- if (amiga_dt_sound_convert(&plugin->base) == false) {
- content_destroy(&plugin->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- *newc = (struct content *) plugin;
-
- return NSERROR_OK;
-}
-
-content_type amiga_dt_sound_content_type(void)
-{
- return CONTENT_PLUGIN;
-}
-
-#endif
diff --git a/amiga/file.c b/amiga/file.c
deleted file mode 100644
index 8957ecfe6..000000000
--- a/amiga/file.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <proto/asl.h>
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/icon.h>
-#include <workbench/icon.h>
-
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "utils/file.h"
-#include "utils/messages.h"
-#include "content/hlcache.h"
-#include "content/content.h"
-#include "content/fetch.h"
-#include "desktop/browser.h"
-#include "desktop/save_complete.h"
-#include "desktop/save_pdf.h"
-#include "desktop/save_text.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/gui.h"
-#include "amiga/bitmap.h"
-#include "amiga/download.h"
-#include "amiga/file.h"
-#include "amiga/filetype.h"
-#include "amiga/icon.h"
-#include "amiga/iff_dr2d.h"
-#include "amiga/misc.h"
-#include "amiga/save_pdf.h"
-#include "amiga/theme.h"
-
-static struct Hook aslhookfunc;
-
-HOOKF(ULONG, ami_file_asl_mime_hook, struct FileRequester *, fr, struct AnchorPathOld *)
-{
- char fname[1024];
- BOOL ret = FALSE;
- char *mt = NULL;
- lwc_string *lwc_mt = NULL;
- lwc_error lerror;
- content_type ct;
-
- if(msg->ap_Info.fib_DirEntryType > 0) return(TRUE);
-
- strcpy(fname,fr->fr_Drawer);
- AddPart(fname, msg->ap_Info.fib_FileName,1024);
-
- mt = strdup(fetch_filetype(fname));
- lerror = lwc_intern_string(mt, strlen(mt), &lwc_mt);
- if (lerror != lwc_error_ok)
- return FALSE;
-
- ct = content_factory_type_from_mime_type(lwc_mt);
- lwc_string_unref(lwc_mt);
-
- if(ct != CONTENT_NONE) ret = TRUE;
-
- free(mt);
- return ret;
-}
-
-void ami_file_open(struct gui_window_2 *gwin)
-{
- char *temp;
- nsurl *url;
-
- if(AslRequestTags(filereq,
- ASLFR_TitleText, messages_get("NetSurf"),
- ASLFR_Window, gwin->win,
- ASLFR_SleepWindow, TRUE,
- ASLFR_Screen, scrn,
- ASLFR_DoSaveMode, FALSE,
- ASLFR_RejectIcons, TRUE,
- ASLFR_FilterFunc, &aslhookfunc,
- TAG_DONE))
- {
- if((temp = AllocVecTagList(1024, NULL)))
- {
- strlcpy(temp, filereq->fr_Drawer, 1024);
- AddPart(temp, filereq->fr_File, 1024);
-
- if (netsurf_path_to_nsurl(temp, &url) != NSERROR_OK) {
- amiga_warn_user("NoMemory", 0);
- } else {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
-
- FreeVec(temp);
- }
- }
-}
-
-static void ami_file_set_type(const char *path, lwc_string *mime_type)
-{
- content_type type = content_factory_type_from_mime_type(mime_type);
- const char *default_type;
-
- switch(type) {
- case CONTENT_HTML:
- default_type = "html";
- break;
- default:
- default_type = NULL;
- break;
- }
-
- if (default_type != NULL) {
- struct DiskObject *dobj = NULL;
-
- dobj = GetIconTags(NULL,ICONGETA_GetDefaultName,default_type,
- ICONGETA_GetDefaultType,WBPROJECT,
- TAG_DONE);
-
- PutIconTags(path, dobj,
- ICONPUTA_NotifyWorkbench, TRUE, TAG_DONE);
- }
-}
-
-void ami_file_save(int type, char *fname, struct Window *win,
- struct hlcache_handle *object, struct hlcache_handle *favicon,
- struct browser_window *bw)
-{
- BPTR lock, fh;
- const char *source_data;
- ULONG source_size;
- struct bitmap *bm;
-
- ami_update_pointer(win, GUI_POINTER_WAIT);
-
- if(ami_download_check_overwrite(fname, win, 0)) {
- switch(type) {
- case AMINS_SAVE_SOURCE:
- if((source_data = content_get_source_data(object, &source_size))) {
- BPTR fh;
- if((fh = FOpen(fname, MODE_NEWFILE,0))) {
- FWrite(fh, source_data, 1, source_size);
- FClose(fh);
- }
- }
- break;
-
- case AMINS_SAVE_TEXT:
- save_as_text(object, fname);
- break;
-
- case AMINS_SAVE_COMPLETE:
- if((lock = CreateDir(fname))) {
- UnLock(lock);
- save_complete(object, fname, ami_file_set_type);
- amiga_icon_superimpose_favicon(fname, favicon, NULL);
- }
- break;
-
- case AMINS_SAVE_PDF:
-#ifdef WITH_PDF_EXPORT
- if(save_as_pdf(object, fname))
- amiga_icon_superimpose_favicon(fname, favicon, "pdf");
-#endif
- break;
-
- case AMINS_SAVE_IFF:
- if((bm = content_get_bitmap(object))) {
- ami_bitmap_set_url(bm, hlcache_handle_get_url(object));
- ami_bitmap_set_title(bm, content_get_title(object));
- amiga_bitmap_save(bm, fname, 0);
- }
-#ifdef WITH_NS_SVG
- else if(ami_mime_compare(object, "svg") == true) {
- ami_save_svg(object, fname);
- }
-#endif
- break;
-
- case AMINS_SAVE_SELECTION:
- if((source_data = browser_window_get_selection(bw))) {
- if((fh = FOpen(fname, MODE_NEWFILE,0))) {
- FWrite(fh, source_data, 1, strlen(source_data));
- FClose(fh);
- }
- free((void *)source_data);
- }
- break;
- }
- if(object) SetComment(fname, nsurl_access(hlcache_handle_get_url(object)));
- }
-
- ami_update_pointer(win, GUI_POINTER_DEFAULT);
-}
-
-void ami_file_save_req(int type, struct gui_window_2 *gwin,
- struct hlcache_handle *object)
-{
- char *fname = AllocVecTagList(1024, NULL);
- char *initial_fname = NULL;
- char *fname_with_ext = NULL;
- bool strip_ext = true;
-
- if(object) {
- if(type == AMINS_SAVE_SOURCE) strip_ext = false;
- nsurl_nice(hlcache_handle_get_url(object), &initial_fname, strip_ext);
- }
-
- if(initial_fname != NULL) {
- fname_with_ext = AllocVecTagList(strlen(initial_fname) + 5, NULL); /* 5 = .ext\0 */
-
- strcpy(fname_with_ext, initial_fname);
-
- switch(type)
- {
- case AMINS_SAVE_TEXT:
- case AMINS_SAVE_SELECTION:
- strcat(fname_with_ext, ".txt");
- break;
- case AMINS_SAVE_IFF:
- strcat(fname_with_ext, ".iff");
- break;
- case AMINS_SAVE_PDF:
- strcat(fname_with_ext, ".pdf");
- break;
- default:
- break;
- }
-
- if(initial_fname) free(initial_fname);
- }
-
- if(AslRequestTags(savereq,
- ASLFR_Window, gwin->win,
- ASLFR_SleepWindow, TRUE,
- ASLFR_TitleText, messages_get("NetSurf"),
- ASLFR_Screen, scrn,
- ASLFR_InitialFile, fname_with_ext ? fname_with_ext : "",
- TAG_DONE))
- {
- strlcpy(fname, savereq->fr_Drawer, 1024);
- AddPart(fname, savereq->fr_File, 1024);
-
- ami_file_save(type, fname, gwin->win, object, gwin->gw->favicon, gwin->gw->bw);
- }
-
- if(fname) FreeVec(fname);
- if(fname_with_ext) FreeVec(fname_with_ext);
-}
-
-void ami_file_req_init(void)
-{
- const char *initial_dir = nsoption_charp(download_dir);
- Tag initial_dir_tag = ASLFR_InitialDrawer;
-
- if(initial_dir == NULL) initial_dir_tag = TAG_IGNORE;
-
- filereq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest, NULL);
- savereq = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
- ASLFR_DoSaveMode, TRUE,
- ASLFR_RejectIcons, TRUE,
- initial_dir_tag, initial_dir,
- TAG_DONE);
-
- aslhookfunc.h_Entry = (void *)&ami_file_asl_mime_hook;
- aslhookfunc.h_SubEntry = NULL;
- aslhookfunc.h_Data = NULL;
-}
-
-void ami_file_req_free(void)
-{
- FreeAslRequest(filereq);
- FreeAslRequest(savereq);
-}
-
diff --git a/amiga/file.h b/amiga/file.h
deleted file mode 100644
index 29a76c477..000000000
--- a/amiga/file.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-struct hlcache_object;
-struct selection;
-struct gui_window_2;
-
-struct FileRequester *filereq;
-struct FileRequester *savereq;
-
-enum {
- AMINS_SAVE_SOURCE,
- AMINS_SAVE_TEXT,
- AMINS_SAVE_COMPLETE,
- AMINS_SAVE_PDF,
- AMINS_SAVE_IFF,
- AMINS_SAVE_SELECTION,
-};
-
-
-void ami_file_req_init(void);
-void ami_file_req_free(void);
-
-void ami_file_open(struct gui_window_2 *gwin);
-void ami_file_save_req(int type, struct gui_window_2 *gwin,
- struct hlcache_handle *object);
-void ami_file_save(int type, char *fname, struct Window *win,
- struct hlcache_handle *object, struct hlcache_handle *favicon,
- struct browser_window *bw);
diff --git a/amiga/filetype.c b/amiga/filetype.c
deleted file mode 100644
index 39058b41c..000000000
--- a/amiga/filetype.c
+++ /dev/null
@@ -1,647 +0,0 @@
-/*
- * Copyright 2008, 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include "amiga/filetype.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "content/fetch.h"
-#include "content/content.h"
-#include "utils/log.h"
-#include "utils/utils.h"
-#include <proto/icon.h>
-#include <proto/dos.h>
-#include <proto/datatypes.h>
-#include <proto/exec.h>
-#include <workbench/icon.h>
-
-/**
- * filetype -- determine the MIME type of a local file
- */
-
-struct MinList *ami_mime_list = NULL;
-
-struct ami_mime_entry
-{
- lwc_string *mimetype;
- lwc_string *datatype;
- lwc_string *filetype;
- lwc_string *plugincmd;
-};
-
-enum
-{
- AMI_MIME_MIMETYPE,
- AMI_MIME_DATATYPE,
- AMI_MIME_FILETYPE,
- AMI_MIME_PLUGINCMD
-};
-
-const char *fetch_filetype(const char *unix_path)
-{
- static char mimetype[50];
- struct DiskObject *dobj = NULL;
- struct DataType *dtn;
- BOOL found = FALSE;
- lwc_string *lwc_mimetype;
-
- /* First, check if we appear to have an icon.
- We'll just do a filename check here for quickness, although the
- first word ought to be checked against WB_DISKMAGIC really. */
-
- if(strncmp(unix_path + strlen(unix_path) - 5, ".info", 5) == 0) {
- strcpy(mimetype,"image/x-amiga-icon");
- found = TRUE;
- }
-
-
- /* Secondly try getting a tooltype "MIMETYPE" and use that as the MIME type.
- Will fail over to default icons if the file doesn't have a real icon. */
-
- if(!found) {
- if((dobj = GetIconTags(unix_path,ICONGETA_FailIfUnavailable,FALSE,
- TAG_DONE))) {
- STRPTR ttype = NULL;
- ttype = FindToolType(dobj->do_ToolTypes, "MIMETYPE");
- if(ttype) {
- strcpy(mimetype,ttype);
- found = TRUE;
- }
- FreeDiskObject(dobj);
- }
- }
-
- /* If that didn't work, use the MIME file and DataTypes */
-
- if(!found) {
- BPTR lock;
- if ((lock = Lock(unix_path, ACCESS_READ))) {
- if ((dtn = ObtainDataTypeA (DTST_FILE, (APTR)lock, NULL))) {
- if(ami_mime_from_datatype(dtn, &lwc_mimetype, NULL)) {
- strcpy(mimetype, lwc_string_data(lwc_mimetype));
- found = TRUE;
- ReleaseDataType(dtn);
- }
- }
- UnLock(lock);
- }
- }
-
- /* Have a quick check for file extensions (inc RISC OS filetype).
- * Makes detection a little more robust, and some of the redirects
- * caused by links in the SVN tree prevent NetSurf from reading the
- * MIME type from the icon (step two, above).
- */
-
- if((!found) || (strcmp("text/plain", mimetype) == 0))
- {
- if((strncmp(unix_path + strlen(unix_path) - 4, ".css", 4) == 0) ||
- (strncmp(unix_path + strlen(unix_path) - 4, ",f79", 4) == 0))
- {
- strcpy(mimetype,"text/css");
- found = TRUE;
- }
-
- if((strncmp(unix_path + strlen(unix_path) - 4, ".htm", 4) == 0) ||
- (strncmp(unix_path + strlen(unix_path) - 5, ".html", 5) == 0) ||
- (strncmp(unix_path + strlen(unix_path) - 4, ",faf", 4) == 0))
- {
- strcpy(mimetype,"text/html");
- found = TRUE;
- }
- if(strncmp(unix_path + strlen(unix_path) - 3, ".js", 3) == 0) {
- strcpy(mimetype,"application/javascript");
- found = TRUE;
- }
- }
-
- if(!found) strcpy(mimetype,"text/plain"); /* If all else fails */
-
- return mimetype;
-}
-
-const char *ami_content_type_to_file_type(content_type type)
-{
- switch(type)
- {
- case CONTENT_HTML:
- return "html";
- break;
-
- case CONTENT_TEXTPLAIN:
- return "ascii";
- break;
-
- case CONTENT_CSS:
- return "css";
- break;
-
- case CONTENT_IMAGE:
- return "picture";
- break;
-
- default:
- return "project";
- break;
- }
-}
-
-static void ami_mime_entry_free(void *nso)
-{
- struct ami_mime_entry *mimeentry = (struct ami_mime_entry *)nso;
-
- if(mimeentry->mimetype) lwc_string_unref(mimeentry->mimetype);
- if(mimeentry->datatype) lwc_string_unref(mimeentry->datatype);
- if(mimeentry->filetype) lwc_string_unref(mimeentry->filetype);
- if(mimeentry->plugincmd) lwc_string_unref(mimeentry->plugincmd);
-}
-
-nserror ami_mime_init(const char *mimefile)
-{
- lwc_error lerror;
- char buffer[256];
- BPTR fh = 0;
- struct RDArgs *rargs = NULL;
- CONST_STRPTR template = "MIMETYPE/A,DT=DATATYPE/K,TYPE=DEFICON/K,CMD=PLUGINCMD/K";
- long rarray[] = {0,0,0,0};
- struct nsObject *node;
- struct ami_mime_entry *mimeentry;
-
- LOG("mimetypes file: %s", mimefile);
-
- if(ami_mime_list == NULL)
- ami_mime_list = NewObjList();
-
- rargs = AllocDosObjectTags(DOS_RDARGS,TAG_DONE);
- if(rargs == NULL) return NSERROR_NOMEM;
-
- if((fh = FOpen(mimefile, MODE_OLDFILE, 0)))
- {
- while((FGets(fh, (STRPTR)&buffer, 256) != 0))
- {
- rargs->RDA_Source.CS_Buffer = (char *)&buffer;
- rargs->RDA_Source.CS_Length = 256;
- rargs->RDA_Source.CS_CurChr = 0;
-
- rargs->RDA_DAList = NULL;
- rargs->RDA_Buffer = NULL;
- rargs->RDA_BufSiz = 0;
- rargs->RDA_ExtHelp = NULL;
- rargs->RDA_Flags = 0;
-
- rarray[AMI_MIME_MIMETYPE] = 0;
- rarray[AMI_MIME_DATATYPE] = 0;
- rarray[AMI_MIME_FILETYPE] = 0;
- rarray[AMI_MIME_PLUGINCMD] = 0;
-
- if(ReadArgs(template, rarray, rargs))
- {
- if ((node = AddObject(ami_mime_list, AMINS_MIME))) {
- ObjectCallback(node, ami_mime_entry_free);
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
- node->objstruct = mimeentry;
-
- if(rarray[AMI_MIME_MIMETYPE])
- {
- lerror = lwc_intern_string((char *)rarray[AMI_MIME_MIMETYPE],
- strlen((char *)rarray[AMI_MIME_MIMETYPE]), &mimeentry->mimetype);
- if (lerror != lwc_error_ok)
- return NSERROR_NOMEM;
- }
-
- if(rarray[AMI_MIME_DATATYPE])
- {
- lerror = lwc_intern_string((char *)rarray[AMI_MIME_DATATYPE],
- strlen((char *)rarray[AMI_MIME_DATATYPE]), &mimeentry->datatype);
- if (lerror != lwc_error_ok)
- return NSERROR_NOMEM;
- }
-
- if(rarray[AMI_MIME_FILETYPE])
- {
- lerror = lwc_intern_string((char *)rarray[AMI_MIME_FILETYPE],
- strlen((char *)rarray[AMI_MIME_FILETYPE]), &mimeentry->filetype);
- if (lerror != lwc_error_ok)
- return NSERROR_NOMEM;
- }
-
- if(rarray[AMI_MIME_PLUGINCMD])
- {
- lerror = lwc_intern_string((char *)rarray[AMI_MIME_PLUGINCMD],
- strlen((char *)rarray[AMI_MIME_PLUGINCMD]), &mimeentry->plugincmd);
- if (lerror != lwc_error_ok)
- return NSERROR_NOMEM;
- }
- }
- FreeArgs(rargs);
- }
- }
- FClose(fh);
- }
- FreeDosObject(DOS_RDARGS, rargs);
-
- return NSERROR_OK;
-}
-
-void ami_mime_free(void)
-{
- ami_mime_dump();
- FreeObjList(ami_mime_list);
-}
-
-/**
- * Return next matching MIME entry
- *
- * \param search lwc_string to search for (or NULL for all)
- * \param type of value being searched for (AMI_MIME_#?)
- * \param start_node node to continue search (updated on exit)
- * \return entry or NULL if no match
- */
-
-static struct ami_mime_entry *ami_mime_entry_locate(lwc_string *search,
- int type, struct Node **start_node)
-{
- struct nsObject *node;
- struct nsObject *nnode;
- struct ami_mime_entry *mimeentry;
- lwc_error lerror;
- bool ret = false;
-
- if(IsMinListEmpty(ami_mime_list)) return NULL;
-
- if(*start_node)
- {
- node = (struct nsObject *)GetSucc(*start_node);
- if(node == NULL) return NULL;
- }
- else
- {
- node = (struct nsObject *)GetHead((struct List *)ami_mime_list);
- }
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
- mimeentry = node->objstruct;
-
- lerror = lwc_error_ok;
-
- switch(type)
- {
- case AMI_MIME_MIMETYPE:
- if(search != NULL)
- lerror = lwc_string_isequal(mimeentry->mimetype, search, &ret);
- else if(mimeentry->mimetype != NULL)
- ret = true;
- break;
-
- case AMI_MIME_DATATYPE:
- if(search != NULL)
- lerror = lwc_string_isequal(mimeentry->datatype, search, &ret);
- else if(mimeentry->datatype != NULL)
- ret = true;
- break;
-
- case AMI_MIME_FILETYPE:
- if(search != NULL)
- lerror = lwc_string_isequal(mimeentry->filetype, search, &ret);
- else if(mimeentry->filetype != NULL)
- ret = true;
- break;
-
- case AMI_MIME_PLUGINCMD:
- if(search != NULL)
- lerror = lwc_string_isequal(mimeentry->plugincmd, search, &ret);
- else if(mimeentry->plugincmd != NULL)
- ret = true;
- break;
- }
-
- if((lerror == lwc_error_ok) && (ret == true))
- break;
-
- } while((node=nnode));
-
- *start_node = (struct Node *)node;
-
- if(ret == true) return mimeentry;
- else return NULL;
-}
-
-
-static APTR ami_mime_guess_add_datatype(struct DataType *dt, lwc_string **lwc_mimetype)
-{
- struct nsObject *node;
- char mimetype[100];
- char *dt_name_lwr;
- struct ami_mime_entry *mimeentry;
- lwc_error lerror;
- struct DataTypeHeader *dth = dt->dtn_Header;
- char *p;
-
- node = AddObject(ami_mime_list, AMINS_MIME);
- if(node == NULL) return NULL;
-
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
- if(mimeentry == NULL) return NULL;
-
- node->objstruct = mimeentry;
- ObjectCallback(node, ami_mime_entry_free);
-
- lerror = lwc_intern_string(dth->dth_Name, strlen(dth->dth_Name), &mimeentry->datatype);
- if (lerror != lwc_error_ok)
- return NULL;
-
- dt_name_lwr = strdup(dth->dth_Name);
- if(dt_name_lwr == NULL) return NULL;
-
- strlwr(dt_name_lwr);
- p = dt_name_lwr;
-
- while(*p != '\0')
- {
- if(*p == ' ') *p = '-';
- if(*p == '/') *p = '-';
- p++;
- }
-
- switch(dth->dth_GroupID)
- {
- case GID_TEXT:
- case GID_DOCUMENT:
- if(strcmp("ascii", dt_name_lwr)==0)
- {
- strcpy(mimetype,"text/plain");
- }
- else
- {
- sprintf(mimetype,"text/%s", dt_name_lwr);
- }
- break;
- case GID_SOUND:
- case GID_INSTRUMENT:
- case GID_MUSIC:
- sprintf(mimetype,"audio/%s", dt_name_lwr);
- break;
- case GID_PICTURE:
- if(strcmp("sprite", dt_name_lwr)==0)
- {
- strcpy(mimetype,"image/x-riscos-sprite");
- }
- else
- {
- sprintf(mimetype,"image/%s", dt_name_lwr);
- }
- break;
- case GID_ANIMATION:
- case GID_MOVIE:
- sprintf(mimetype,"video/%s", dt_name_lwr);
- break;
- case GID_SYSTEM:
- default:
- if(strcmp("directory", dt_name_lwr)==0)
- {
- strcpy(mimetype,"application/x-netsurf-directory");
- }
- else if(strcmp("binary", dt_name_lwr)==0)
- {
- strcpy(mimetype,"application/octet-stream");
- }
- else sprintf(mimetype,"application/%s", dt_name_lwr);
- break;
- }
-
- lerror = lwc_intern_string(mimetype, strlen(mimetype), &mimeentry->mimetype);
- if (lerror != lwc_error_ok)
- return NULL;
-
- *lwc_mimetype = mimeentry->mimetype;
-
- lerror = lwc_intern_string(dt_name_lwr, strlen(dt_name_lwr), &mimeentry->filetype);
- if (lerror != lwc_error_ok)
- return NULL;
-
- free(dt_name_lwr);
- return node;
-}
-
-/**
- * Return a MIME Type matching a DataType
- *
- * \param dt a DataType structure
- * \param mimetype lwc_string to hold the MIME type
- * \param start_node node to feed back in to continue search
- * \return node or NULL if no match
- */
-
-struct Node *ami_mime_from_datatype(struct DataType *dt,
- lwc_string **mimetype, struct Node *start_node)
-{
- struct DataTypeHeader *dth;
- struct Node *node;
- struct ami_mime_entry *mimeentry;
- lwc_string *dt_name;
- lwc_error lerror;
-
- if(dt == NULL) return NULL;
-
- dth = dt->dtn_Header;
- lerror = lwc_intern_string(dth->dth_Name, strlen(dth->dth_Name), &dt_name);
- if (lerror != lwc_error_ok)
- return NULL;
-
- node = start_node;
- mimeentry = ami_mime_entry_locate(dt_name, AMI_MIME_DATATYPE, &node);
- lwc_string_unref(dt_name);
-
- if(mimeentry != NULL)
- {
- *mimetype = mimeentry->mimetype;
- return (struct Node *)node;
- }
- else
- {
- if(start_node == NULL)
- {
- /* If there are no matching entries in the file, guess */
- return ami_mime_guess_add_datatype(dt, mimetype);
- }
- else
- {
- return NULL;
- }
- }
-}
-
-/**
- * Return the DefIcons type matching a MIME type
- *
- * \param mimetype lwc_string MIME type
- * \param filetype ptr to lwc_string to hold DefIcons type
- * \param start_node node to feed back in to continue search
- * \return node or NULL if no match
- */
-
-struct Node *ami_mime_to_filetype(lwc_string *mimetype,
- lwc_string **filetype, struct Node *start_node)
-{
- struct Node *node;
- struct ami_mime_entry *mimeentry;
-
- node = start_node;
- mimeentry = ami_mime_entry_locate(mimetype, AMI_MIME_MIMETYPE, &node);
-
- if(mimeentry != NULL)
- {
- *filetype = mimeentry->filetype;
- return (struct Node *)node;
- }
- else
- {
- return NULL;
- }
-}
-
-const char *ami_mime_content_to_filetype(struct hlcache_handle *c)
-{
- struct Node *node;
- lwc_string *filetype;
- lwc_string *mimetype;
-
- mimetype = content_get_mime_type(c);
-
- node = ami_mime_to_filetype(mimetype, &filetype, NULL);
-
- if(node && (filetype != NULL))
- return lwc_string_data(filetype);
- else
- return ami_content_type_to_file_type(content_get_type(c));
-}
-
-/**
- * Return all MIME types containing a plugincmd
- *
- * \param mimetype ptr to lwc_string MIME type
- * \param start_node node to feed back in to continue search
- * \return node or NULL if no match
- */
-
-struct Node *ami_mime_has_cmd(lwc_string **mimetype, struct Node *start_node)
-{
- struct Node *node;
- struct ami_mime_entry *mimeentry;
-
- node = start_node;
- mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_PLUGINCMD, &node);
-
- if(mimeentry != NULL)
- {
- *mimetype = mimeentry->mimetype;
- return (struct Node *)node;
- }
- else
- {
- return NULL;
- }
-}
-
-/**
- * Return the plugincmd matching a MIME type
- *
- * \param mimetype lwc_string MIME type
- * \param plugincmd ptr to lwc_string to hold plugincmd
- * \param start_node node to feed back in to continue search
- * \return node or NULL if no match
- */
-
-static struct Node *ami_mime_to_plugincmd(lwc_string *mimetype,
- lwc_string **plugincmd, struct Node *start_node)
-{
- struct Node *node;
- struct ami_mime_entry *mimeentry;
-
- node = start_node;
- mimeentry = ami_mime_entry_locate(mimetype, AMI_MIME_MIMETYPE, &node);
-
- if(mimeentry != NULL)
- {
- *plugincmd = mimeentry->plugincmd;
- return (struct Node *)node;
- }
- else
- {
- return NULL;
- }
-}
-
-lwc_string *ami_mime_content_to_cmd(struct hlcache_handle *c)
-{
- struct Node *node;
- lwc_string *plugincmd;
- lwc_string *mimetype;
-
- mimetype = content_get_mime_type(c);
-
- node = ami_mime_to_plugincmd(mimetype,
- &plugincmd, NULL);
-
- if(node && (plugincmd != NULL)) return plugincmd;
- else return NULL;
-}
-
-/**
- * Compare the MIME type of an hlcache_handle to a DefIcons type
- */
-
-bool ami_mime_compare(struct hlcache_handle *c, const char *type)
-{
- bool ret = false;
- lwc_error lerror;
- lwc_string *filetype;
- lwc_string *mime_filetype;
- lwc_string *mime = content_get_mime_type(c);
-
- if(ami_mime_to_filetype(mime, &mime_filetype, NULL) == NULL)
- return false;
-
- lerror = lwc_intern_string(type, strlen(type), &filetype);
- if (lerror != lwc_error_ok)
- return false;
-
- lerror = lwc_string_isequal(filetype, mime_filetype, &ret);
- if (lerror != lwc_error_ok)
- return false;
-
- lwc_string_unref(filetype);
-
- return ret;
-}
-
-
-void ami_mime_dump(void)
-{
- struct Node *node = NULL;
- struct ami_mime_entry *mimeentry;
-
- while((mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_MIMETYPE, &node))) {
- LOG("%s DT=\"%s\" TYPE=\"%s\" CMD=\"%s\"", mimeentry->mimetype ? lwc_string_data(mimeentry->mimetype) : "", mimeentry->datatype ? lwc_string_data(mimeentry->datatype) : "", mimeentry->filetype ? lwc_string_data(mimeentry->filetype) : "", mimeentry->plugincmd ? lwc_string_data(mimeentry->plugincmd) : "");
- };
-}
diff --git a/amiga/filetype.h b/amiga/filetype.h
deleted file mode 100644
index fc27b1df2..000000000
--- a/amiga/filetype.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2010 - 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_FILETYPE_H
-#define AMIGA_FILETYPE_H
-#include <stdbool.h>
-#include <libwapcaplet/libwapcaplet.h>
-#include "content/content_type.h"
-#include "utils/errors.h"
-#include <datatypes/datatypes.h>
-
-struct hlcache_handle;
-struct ami_mime_entry;
-
-const char *fetch_filetype(const char *unix_path);
-
-nserror ami_mime_init(const char *mimefile);
-void ami_mime_free(void);
-void ami_mime_dump(void);
-
-struct Node *ami_mime_from_datatype(struct DataType *dt,
- lwc_string **mimetype, struct Node *start_node);
-struct Node *ami_mime_to_filetype(lwc_string *mimetype,
- lwc_string **filetype, struct Node *start_node);
-
-const char *ami_mime_content_to_filetype(struct hlcache_handle *c);
-lwc_string *ami_mime_content_to_cmd(struct hlcache_handle *c);
-
-struct Node *ami_mime_has_cmd(lwc_string **mimetype, struct Node *start_node);
-
-bool ami_mime_compare(struct hlcache_handle *c, const char *type);
-
-/* deprecated */
-const char *ami_content_type_to_file_type(content_type type);
-
-#endif
diff --git a/amiga/font.c b/amiga/font.c
deleted file mode 100644
index 1c9702af2..000000000
--- a/amiga/font.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright 2008 - 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <proto/diskfont.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-
-#include "utils/log.h"
-#include "utils/nsoption.h"
-#include "desktop/browser.h"
-#include "desktop/gui_layout.h"
-
-#include "amiga/font.h"
-#include "amiga/font_bullet.h"
-#include "amiga/font_diskfont.h"
-#include "amiga/font_scan.h"
-
-static ULONG ami_devicedpi = 72;
-static ULONG ami_xdpi = 72;
-
-ULONG ami_font_dpi_get_devicedpi(void)
-{
- return ami_devicedpi;
-}
-
-ULONG ami_font_dpi_get_xdpi(void)
-{
- return ami_xdpi;
-}
-
-void ami_font_setdevicedpi(int id)
-{
- DisplayInfoHandle dih;
- struct DisplayInfo dinfo;
-
- if(nsoption_bool(bitmap_fonts) == true) {
- LOG("WARNING: Using diskfont.library for text. Forcing DPI to 72.");
- nsoption_set_int(screen_ydpi, 72);
- }
-
- ULONG ydpi = nsoption_int(screen_ydpi);
- ULONG xdpi = nsoption_int(screen_ydpi);
- browser_set_dpi(nsoption_int(screen_ydpi));
-
- if(id && (nsoption_int(monitor_aspect_x) != 0) && (nsoption_int(monitor_aspect_y) != 0))
- {
- if((dih = FindDisplayInfo(id)))
- {
- if(GetDisplayInfoData(dih, &dinfo, sizeof(struct DisplayInfo),
- DTAG_DISP, 0))
- {
- int xres = dinfo.Resolution.x;
- int yres = dinfo.Resolution.y;
-
- if((nsoption_int(monitor_aspect_x) != 4) || (nsoption_int(monitor_aspect_y) != 3))
- {
- /* AmigaOS sees 4:3 modes as square in the DisplayInfo database,
- * so we correct other modes to "4:3 equiv" here. */
- xres = (xres * nsoption_int(monitor_aspect_x)) / 4;
- yres = (yres * nsoption_int(monitor_aspect_y)) / 3;
- }
-
- xdpi = (yres * ydpi) / xres;
-
- LOG("XDPI = %ld, YDPI = %ld (DisplayInfo resolution %d x %d, corrected %d x %d)", xdpi, ydpi, dinfo.Resolution.x, dinfo.Resolution.y, xres, yres);
- }
- }
- }
-
- ami_xdpi = xdpi;
- ami_devicedpi = (xdpi << 16) | ydpi;
-}
-
-/* The below are simple font routines which should not be used for page rendering */
-
-struct TextFont *ami_font_open_disk_font(struct TextAttr *tattr)
-{
- struct TextFont *tfont = OpenDiskFont(tattr);
- return tfont;
-}
-
-void ami_font_close_disk_font(struct TextFont *tfont)
-{
- CloseFont(tfont);
-}
-
-/* Font initialisation */
-void ami_font_init(void)
-{
- if(nsoption_bool(bitmap_fonts) == false) {
- ami_font_bullet_init();
- } else {
- ami_font_diskfont_init();
- }
-}
-
-void ami_font_fini(void)
-{
- if(nsoption_bool(bitmap_fonts) == false) {
- ami_font_bullet_fini();
- }
-}
-
-/* Stub entry points */
-static nserror ami_font_width(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int *width)
-{
- if(__builtin_expect(ami_nsfont == NULL, 0)) return false;
- return ami_nsfont->width(fstyle, string, length, width);
-}
-
-static nserror ami_font_position(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- if(__builtin_expect(ami_nsfont == NULL, 0)) return false;
- return ami_nsfont->posn(fstyle, string, length, x, char_offset, actual_x);
-}
-
-static nserror ami_font_split(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- if(__builtin_expect(ami_nsfont == NULL, 0)) return false;
- return ami_nsfont->split(fstyle, string, length, x, char_offset, actual_x);
-}
-
-static struct gui_layout_table layout_table = {
- .width = ami_font_width,
- .position = ami_font_position,
- .split = ami_font_split,
-};
-
-struct gui_layout_table *ami_layout_table = &layout_table;
diff --git a/amiga/font.h b/amiga/font.h
deleted file mode 100755
index cd526057f..000000000
--- a/amiga/font.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2008, 2009, 2012, 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_FONT_H
-#define AMIGA_FONT_H
-
-#include "desktop/plotters.h"
-#include "utils/errors.h"
-#include <graphics/rastport.h>
-#include <graphics/text.h>
-
-void ami_font_init(void);
-void ami_font_fini(void);
-
-/* DPI stuff */
-void ami_font_setdevicedpi(int id);
-ULONG ami_font_dpi_get_devicedpi(void);
-ULONG ami_font_dpi_get_xdpi(void);
-
-/* Simple diskfont functions for graphics.library use (not page rendering) */
-struct TextFont *ami_font_open_disk_font(struct TextAttr *tattr);
-void ami_font_close_disk_font(struct TextFont *tfont);
-
-/* Font engine tables */
-struct ami_font_functions {
- nserror (*width)(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int *width);
-
- nserror (*posn)(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x);
-
- nserror (*split)(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x);
-
- ULONG (*text)(struct RastPort *rp, const char *string,
- ULONG length, const plot_font_style_t *fstyle,
- ULONG x, ULONG y, bool aa);
-};
-
-const struct ami_font_functions *ami_nsfont;
-
-struct gui_layout_table *ami_layout_table;
-
-#endif
-
diff --git a/amiga/font_bullet.c b/amiga/font_bullet.c
deleted file mode 100644
index 3032b9735..000000000
--- a/amiga/font_bullet.c
+++ /dev/null
@@ -1,895 +0,0 @@
-/*
- * Copyright 2008 - 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-
-#ifndef __amigaos4__
-#include <proto/bullet.h>
-#endif
-#include <proto/diskfont.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <proto/utility.h>
-
-#include <diskfont/diskfonttag.h>
-#include <diskfont/oterrors.h>
-
-#include "amiga/font.h"
-#include "amiga/font_bullet.h"
-#include "amiga/font_cache.h"
-#include "amiga/font_scan.h"
-
-#include "utils/log.h"
-#include "utils/nsoption.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
-
-#define NSA_UNICODE_FONT PLOT_FONT_FAMILY_COUNT
-
-#define NSA_NORMAL 0
-#define NSA_ITALIC 1
-#define NSA_BOLD 2
-#define NSA_BOLDITALIC 3
-#define NSA_OBLIQUE 4
-#define NSA_BOLDOBLIQUE 6
-
-#define NSA_VALUE_BOLDX (1 << 12)
-#define NSA_VALUE_BOLDY 0
-#define NSA_VALUE_SHEARSIN (1 << 14)
-#define NSA_VALUE_SHEARCOS (1 << 16)
-
-#define NSA_FONT_EMWIDTH(s) (s / FONT_SIZE_SCALE) * (ami_font_dpi_get_xdpi() / 72.0)
-
-const uint16 sc_table[] = {
- 0x0061, 0x1D00, /* a */
- 0x0062, 0x0299, /* b */
- 0x0063, 0x1D04, /* c */
- 0x0064, 0x1D05, /* d */
- 0x0065, 0x1D07, /* e */
- 0x0066, 0xA730, /* f */
- 0x0067, 0x0262, /* g */
- 0x0068, 0x029C, /* h */
- 0x0069, 0x026A, /* i */
- 0x006A, 0x1D0A, /* j */
- 0x006B, 0x1D0B, /* k */
- 0x006C, 0x029F, /* l */
- 0x006D, 0x1D0D, /* m */
- 0x006E, 0x0274, /* n */
- 0x006F, 0x1D0F, /* o */
- 0x0070, 0x1D18, /* p */
- 0x0071, 0xA7EE, /* q (proposed) (Adobe codepoint 0xF771) */
- 0x0072, 0x0280, /* r */
- 0x0073, 0xA731, /* s */
- 0x0074, 0x1D1B, /* t */
- 0x0075, 0x1D1C, /* u */
- 0x0076, 0x1D20, /* v */
- 0x0077, 0x1D21, /* w */
- 0x0078, 0xA7EF, /* x (proposed) (Adobe codepoint 0xF778) */
- 0x0079, 0x028F, /* y */
- 0x007A, 0x1D22, /* z */
-
- 0x00C6, 0x1D01, /* ae */
- 0x0153, 0x0276, /* oe */
-
-#if 0
-/* TODO: fill in the non-small caps character ids for these */
- 0x0000, 0x1D03, /* barred b */
- 0x0000, 0x0281, /* inverted r */
- 0x0000, 0x1D19, /* reversed r */
- 0x0000, 0x1D1A, /* turned r */
- 0x0000, 0x029B, /* g with hook */
- 0x0000, 0x1D06, /* eth à */
- 0x0000, 0x1D0C, /* l with stroke */
- 0x0000, 0xA7FA, /* turned m */
- 0x0000, 0x1D0E, /* reversed n */
- 0x0000, 0x1D10, /* open o */
- 0x0000, 0x1D15, /* ou */
- 0x0000, 0x1D23, /* ezh */
- 0x0000, 0x1D26, /* gamma */
- 0x0000, 0x1D27, /* lamda */
- 0x0000, 0x1D28, /* pi */
- 0x0000, 0x1D29, /* rho */
- 0x0000, 0x1D2A, /* psi */
- 0x0000, 0x1D2B, /* el */
- 0x0000, 0xA776, /* rum */
-
- 0x0000, 0x1DDB, /* combining g */
- 0x0000, 0x1DDE, /* combining l */
- 0x0000, 0x1DDF, /* combining m */
- 0x0000, 0x1DE1, /* combining n */
- 0x0000, 0x1DE2, /* combining r */
-
- 0x0000, 0x1DA6, /* modifier i */
- 0x0000, 0x1DA7, /* modifier i with stroke */
- 0x0000, 0x1DAB, /* modifier l */
- 0x0000, 0x1DB0, /* modifier n */
- 0x0000, 0x1DB8, /* modifier u */
-#endif
- 0, 0};
-
-lwc_string *glypharray[0xffff + 1];
-
-static struct List ami_diskfontlib_list;
-
-static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
- uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa);
-static inline int32 ami_font_width_glyph(struct OutlineFont *ofont,
- const uint16 *char1, const uint16 *char2, uint32 emwidth);
-static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle,
- const uint16 *codepoint);
-static inline ULONG ami_font_unicode_width(const char *string, ULONG length,
- const plot_font_style_t *fstyle, ULONG x, ULONG y, bool aa);
-
-static inline int amiga_nsfont_utf16_char_length(const uint16 *char1)
-{
- if (__builtin_expect(((*char1 < 0xD800) || (0xDBFF < *char1)), 1)) {
- return 1;
- } else {
- return 2;
- }
-}
-
-static inline uint32 amiga_nsfont_decode_surrogate(const uint16 *char1)
-{
- if(__builtin_expect((amiga_nsfont_utf16_char_length(char1) == 2), 0)) {
- return ((uint32)char1[0] << 10) + char1[1] - 0x35FDC00;
- } else {
- return (uint32)*char1;
- }
-}
-
-static nserror amiga_nsfont_width(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int *width)
-{
- *width = ami_font_unicode_width(string, length, fstyle, 0, 0, false);
-
- if(*width <= 0) *width == length; // fudge
-
- return NSERROR_OK;
-}
-
-/**
- * Find the position in a string where an x coordinate falls.
- *
- * \param fstyle style for this text
- * \param string UTF-8 string to measure
- * \param length length of string
- * \param x x coordinate to search for
- * \param char_offset updated to offset in string of actual_x, [0..length]
- * \param actual_x updated to x coordinate of character closest to x
- * \return true on success, false on error and error reported
- */
-
-static nserror amiga_nsfont_position_in_string(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- uint16 *utf16 = NULL, *outf16 = NULL;
- uint16 *utf16next = NULL;
- struct OutlineFont *ofont, *ufont = NULL;
- int tx = 0;
- uint32 utf8_pos = 0;
- int utf16charlen;
- ULONG emwidth = (ULONG)NSA_FONT_EMWIDTH(fstyle->size);
- int32 tempx;
-
- if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return NSERROR_INVALID;
- outf16 = utf16;
- if(!(ofont = ami_open_outline_font(fstyle, 0))) return NSERROR_INVALID;
-
- *char_offset = 0;
- *actual_x = 0;
-
- while (utf8_pos < length) {
- utf16charlen = amiga_nsfont_utf16_char_length(utf16);
- utf16next = &utf16[utf16charlen];
-
- tempx = ami_font_width_glyph(ofont, utf16, utf16next, emwidth);
-
- if (tempx == 0) {
- if (ufont == NULL)
- ufont = ami_open_outline_font(fstyle, utf16);
-
- if (ufont)
- tempx = ami_font_width_glyph(ufont, utf16,
- utf16next, emwidth);
- }
-
- tx += tempx;
- utf16 = utf16next;
- utf8_pos = utf8_next(string, length, utf8_pos);
-
- if(tx < x) {
- *actual_x = tx;
- *char_offset = utf8_pos;
- } else {
- if((x - *actual_x) > (tx - x)) {
- *actual_x = tx;
- *char_offset = utf8_pos;
- }
- free(outf16);
- return NSERROR_OK;
- }
- }
-
- *actual_x = tx;
- *char_offset = length;
-
- free(outf16);
- return NSERROR_OK;
-}
-
-
-/**
- * Find where to split a string to make it fit a width.
- *
- * \param fstyle style for this text
- * \param string UTF-8 string to measure
- * \param length length of string
- * \param x width available
- * \param char_offset updated to offset in string of actual_x, [1..length]
- * \param actual_x updated to x coordinate of character closest to x
- * \return true on success, false on error and error reported
- *
- * On exit, char_offset indicates first character after split point.
- *
- * Note: char_offset of 0 should never be returned.
- *
- * Returns:
- * char_offset giving split point closest to x, where actual_x <= x
- * else
- * char_offset giving split point closest to x, where actual_x > x
- *
- * Returning char_offset == length means no split possible
- */
-
-static nserror amiga_nsfont_split(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- uint16 *utf16_str = NULL;
- const uint16 *utf16 = NULL;
- const uint16 *utf16next = NULL;
- struct OutlineFont *ofont, *ufont = NULL;
- int tx = 0;
- uint32 utf8_pos = 0;
- int32 tempx = 0;
- ULONG emwidth = (ULONG)NSA_FONT_EMWIDTH(fstyle->size);
-
- /* Get utf16 conversion of string for glyph measuring routines */
- if (utf8_to_enc(string, "UTF-16", length, (char **)&utf16_str) !=
- NSERROR_OK)
- return NSERROR_INVALID;
-
- utf16 = utf16_str;
- if (!(ofont = ami_open_outline_font(fstyle, 0)))
- return NSERROR_INVALID;
-
- *char_offset = 0;
- *actual_x = 0;
-
- if (*utf16 == 0xFEFF) utf16++;
-
- while (utf8_pos < length) {
- if ((*utf16 < 0xD800) || (0xDBFF < *utf16))
- utf16next = utf16 + 1;
- else
- utf16next = utf16 + 2;
-
- tempx = ami_font_width_glyph(ofont, utf16, utf16next, emwidth);
-
- if (tempx == 0) {
- if (ufont == NULL)
- ufont = ami_open_outline_font(fstyle, utf16);
-
- if (ufont)
- tempx = ami_font_width_glyph(ufont, utf16,
- utf16next, emwidth);
- }
-
- /* Check whether we have a space */
- if (*(string + utf8_pos) == ' ') {
- /* Got a space */
- *actual_x = tx;
- *char_offset = utf8_pos;
- }
-
- tx += tempx;
- if ((x < tx) && (*char_offset != 0)) {
- /* Reached available width, and a space was found;
- * split there. */
- free(utf16_str);
- return NSERROR_OK;
- }
-
- utf16 = utf16next;
- utf8_pos = utf8_next(string, length, utf8_pos);
- }
-
- free(utf16_str);
-
- /* No spaces to split at, or everything fits */
- assert(*char_offset == 0 || x >= tx);
-
- *char_offset = length;
- *actual_x = tx;
- return NSERROR_OK;
-}
-
-/**
- * Search for a font in the list and load from disk if not present
- */
-static struct ami_font_cache_node *ami_font_open(const char *font, bool critical)
-{
- struct ami_font_cache_node *nodedata = ami_font_cache_locate(font);
- if(nodedata) return nodedata;
-
- nodedata = ami_font_cache_alloc_entry(font);
-
- if(nodedata == NULL) {
- amiga_warn_user("NoMemory", "");
- return NULL;
- }
-
- nodedata->font = OpenOutlineFont(font, &ami_diskfontlib_list, OFF_OPEN);
-
- if(!nodedata->font)
- {
- LOG("Requested font not found: %s", font);
- if(critical == true) amiga_warn_user("CompError", font);
- FreeVec(nodedata);
- return NULL;
- }
-
- nodedata->bold = (char *)GetTagData(OT_BName, 0, nodedata->font->olf_OTagList);
- if(nodedata->bold)
- LOG("Bold font defined for %s is %s", font, nodedata->bold);
- else
- LOG("Warning: No designed bold font defined for %s", font);
-
- nodedata->italic = (char *)GetTagData(OT_IName, 0, nodedata->font->olf_OTagList);
- if(nodedata->italic)
- LOG("Italic font defined for %s is %s", font, nodedata->italic);
- else
- LOG("Warning: No designed italic font defined for %s", font);
-
- nodedata->bolditalic = (char *)GetTagData(OT_BIName, 0, nodedata->font->olf_OTagList);
- if(nodedata->bolditalic)
- LOG("Bold-italic font defined for %s is %s", font, nodedata->bolditalic);
- else
- LOG("Warning: No designed bold-italic font defined for %s", font);
-
- ami_font_cache_insert(nodedata, font);
- return nodedata;
-}
-
-/**
- * Open an outline font in the specified size and style
- *
- * \param fstyle font style structure
- * \param codepoint open a default font instead of the one specified by fstyle
- * \return outline font or NULL on error
- */
-static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle,
- const uint16 *codepoint)
-{
- struct ami_font_cache_node *node;
- struct ami_font_cache_node *designed_node = NULL;
- struct OutlineFont *ofont;
- char *fontname;
- ULONG ysize;
- int tstyle = 0;
- plot_font_generic_family_t fontfamily;
- ULONG emboldenx = 0;
- ULONG emboldeny = 0;
- ULONG shearsin = 0;
- ULONG shearcos = (1 << 16);
-
- if(codepoint) fontfamily = NSA_UNICODE_FONT;
- else fontfamily = fstyle->family;
-
- switch(fontfamily)
- {
- case PLOT_FONT_FAMILY_SANS_SERIF:
- fontname = nsoption_charp(font_sans);
- break;
- case PLOT_FONT_FAMILY_SERIF:
- fontname = nsoption_charp(font_serif);
- break;
- case PLOT_FONT_FAMILY_MONOSPACE:
- fontname = nsoption_charp(font_mono);
- break;
- case PLOT_FONT_FAMILY_CURSIVE:
- fontname = nsoption_charp(font_cursive);
- break;
- case PLOT_FONT_FAMILY_FANTASY:
- fontname = nsoption_charp(font_fantasy);
- break;
- case NSA_UNICODE_FONT:
- default:
- if(__builtin_expect((amiga_nsfont_utf16_char_length(codepoint) == 2), 0)) {
- /* Multi-byte character */
- fontname = nsoption_charp(font_surrogate);
- } else {
- fontname = (char *)ami_font_scan_lookup(codepoint, glypharray);
- }
- if(fontname == NULL) return NULL;
- break;
- }
-
- node = ami_font_open(fontname, true);
- if(!node) return NULL;
-
- if (fstyle->flags & FONTF_OBLIQUE)
- tstyle = NSA_OBLIQUE;
-
- if (fstyle->flags & FONTF_ITALIC)
- tstyle = NSA_ITALIC;
-
- if (fstyle->weight >= 700)
- tstyle += NSA_BOLD;
-
- switch(tstyle)
- {
- case NSA_ITALIC:
- if(node->italic) designed_node = ami_font_open(node->italic, false);
-
- if(designed_node == NULL) {
- shearsin = NSA_VALUE_SHEARSIN;
- shearcos = NSA_VALUE_SHEARCOS;
- }
- break;
-
- case NSA_OBLIQUE:
- shearsin = NSA_VALUE_SHEARSIN;
- shearcos = NSA_VALUE_SHEARCOS;
- break;
-
- case NSA_BOLD:
- if(node->bold) designed_node = ami_font_open(node->bold, false);
-
- if(designed_node == NULL) {
- emboldenx = NSA_VALUE_BOLDX;
- emboldeny = NSA_VALUE_BOLDY;
- }
- break;
-
- case NSA_BOLDOBLIQUE:
- shearsin = NSA_VALUE_SHEARSIN;
- shearcos = NSA_VALUE_SHEARCOS;
-
- if(node->bold) designed_node = ami_font_open(node->bold, false);
-
- if(designed_node == NULL) {
- emboldenx = NSA_VALUE_BOLDX;
- emboldeny = NSA_VALUE_BOLDY;
- }
- break;
-
- case NSA_BOLDITALIC:
- if(node->bolditalic) designed_node = ami_font_open(node->bolditalic, false);
-
- if(designed_node == NULL) {
- emboldenx = NSA_VALUE_BOLDX;
- emboldeny = NSA_VALUE_BOLDY;
- shearsin = NSA_VALUE_SHEARSIN;
- shearcos = NSA_VALUE_SHEARCOS;
- }
- break;
- }
-
- /* Scale to 16.16 fixed point */
- ysize = fstyle->size * ((1 << 16) / FONT_SIZE_SCALE);
-
- if(designed_node == NULL) {
- ofont = node->font;
- } else {
- ofont = designed_node->font;
- }
-
-#ifndef __amigaos4__
- struct BulletBase *BulletBase = ofont->BulletBase;
-#endif
-
- if(ESetInfo(AMI_OFONT_ENGINE,
- OT_DeviceDPI, ami_font_dpi_get_devicedpi(),
- OT_PointHeight, ysize,
- OT_EmboldenX, emboldenx,
- OT_EmboldenY, emboldeny,
- OT_ShearSin, shearsin,
- OT_ShearCos, shearcos,
- TAG_END) == OTERR_Success)
- return ofont;
-
- return NULL;
-}
-
-static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
- uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa)
-{
- struct GlyphMap *glyph;
- UBYTE *glyphbm;
- int32 char_advance = 0;
- FIXED kern = 0;
- ULONG glyphmaptag;
- ULONG template_type;
- uint32 long_char_1 = 0, long_char_2 = 0;
-#ifndef __amigaos4__
- struct BulletBase *BulletBase = ofont->BulletBase;
-#endif
-
-#ifndef __amigaos4__
- if (__builtin_expect(((*char1 >= 0xD800) && (*char1 <= 0xDBFF)), 0)) {
- /* We don't support UTF-16 surrogates yet, so just return. */
- return 0;
- }
-
- if (__builtin_expect(((*char2 >= 0xD800) && (*char2 <= 0xDBFF)), 0)) {
- /* Don't attempt to kern a UTF-16 surrogate */
- *char2 = 0;
- }
-#endif
-
-#ifdef __amigaos4__
- if(__builtin_expect(aa == true, 1)) {
- glyphmaptag = OT_GlyphMap8Bit;
- template_type = BLITT_ALPHATEMPLATE;
- } else {
-#endif
- glyphmaptag = OT_GlyphMap;
-#ifdef __amigaos4__
- template_type = BLITT_TEMPLATE;
- }
-#endif
-
- long_char_1 = amiga_nsfont_decode_surrogate(char1);
- long_char_2 = amiga_nsfont_decode_surrogate(char2);
- /**\todo use OT_GlyphCode_32 so we get an error for old font engines */
-
- if(ESetInfo(AMI_OFONT_ENGINE,
- OT_GlyphCode, long_char_1,
- OT_GlyphCode2, long_char_2,
- TAG_END) == OTERR_Success)
- {
- if(EObtainInfo(AMI_OFONT_ENGINE,
- glyphmaptag, &glyph,
- TAG_END) == 0)
- {
- glyphbm = glyph->glm_BitMap;
- if(!glyphbm) return 0;
-
- if(rp) {
-#ifdef __amigaos4__
- BltBitMapTags(BLITA_SrcX, glyph->glm_BlackLeft,
- BLITA_SrcY, glyph->glm_BlackTop,
- BLITA_DestX, x - glyph->glm_X0 + glyph->glm_BlackLeft,
- BLITA_DestY, y - glyph->glm_Y0 + glyph->glm_BlackTop,
- BLITA_Width, glyph->glm_BlackWidth,
- BLITA_Height, glyph->glm_BlackHeight,
- BLITA_Source, glyphbm,
- BLITA_SrcType, template_type,
- BLITA_Dest, rp,
- BLITA_DestType, BLITT_RASTPORT,
- BLITA_SrcBytesPerRow, glyph->glm_BMModulo,
- TAG_DONE);
-#else
- /* On OS3 the glyph needs to be in chip RAM */
- void *chip_glyph = AllocVec(glyph->glm_BMModulo * glyph->glm_BMRows, MEMF_CHIP);
- if(chip_glyph != NULL) {
- CopyMem(glyphbm, chip_glyph, glyph->glm_BMModulo * glyph->glm_BMRows);
-
- BltTemplate(chip_glyph + (glyph->glm_BMModulo * glyph->glm_BlackTop) +
- ((glyph->glm_BlackLeft >> 4) << 1),
- glyph->glm_BlackLeft & 0xF, glyph->glm_BMModulo, rp,
- x - glyph->glm_X0 + glyph->glm_BlackLeft,
- y - glyph->glm_Y0 + glyph->glm_BlackTop,
- glyph->glm_BlackWidth, glyph->glm_BlackHeight);
-
- FreeVec(chip_glyph);
- }
-#endif
- }
-
- kern = 0;
-
- if(*char2) EObtainInfo(AMI_OFONT_ENGINE,
- OT_TextKernPair, &kern,
- TAG_END);
-
- char_advance = (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
-
- EReleaseInfo(AMI_OFONT_ENGINE,
- glyphmaptag, glyph,
- TAG_END);
-
- if(*char2) EReleaseInfo(AMI_OFONT_ENGINE,
- OT_TextKernPair, kern,
- TAG_END);
- }
- }
-
- return char_advance;
-}
-
-static inline int32 ami_font_width_glyph(struct OutlineFont *ofont,
- const uint16 *char1, const uint16 *char2, uint32 emwidth)
-{
- int32 char_advance = 0;
- FIXED kern = 0;
- struct MinList *gwlist = NULL;
- FIXED char1w = 0;
- struct GlyphWidthEntry *gwnode;
- bool skip_c2 = false;
- uint32 long_char_1 = 0;
- uint32 long_char_2;
-#ifndef __amigaos4__
- struct BulletBase *BulletBase = ofont->BulletBase;
-#endif
-
-#ifndef __amigaos4__
- if (__builtin_expect(((*char1 >= 0xD800) && (*char1 <= 0xDBFF)), 0)) {
- /* We don't support UTF-16 surrogates yet, so just return. */
- return 0;
- }
-
- if (__builtin_expect(((*char2 >= 0xD800) && (*char2 <= 0xDBFF)), 0)) {
- /* Don't attempt to kern a UTF-16 surrogate */
- skip_c2 = true;
- }
-#endif
-
- if (*char2 < 0x0020) skip_c2 = true;
-
- long_char_1 = amiga_nsfont_decode_surrogate(char1);
- /**\todo use OT_GlyphCode_32 so we get an error for old font engines */
-
- if(ESetInfo(AMI_OFONT_ENGINE,
- OT_GlyphCode, long_char_1,
- OT_GlyphCode2, long_char_1,
- TAG_END) == OTERR_Success)
- {
- if(EObtainInfo(AMI_OFONT_ENGINE,
- OT_WidthList, &gwlist,
- TAG_END) == 0)
- {
- gwnode = (struct GlyphWidthEntry *)GetHead((struct List *)gwlist);
- if(gwnode) char1w = gwnode->gwe_Width;
-
- kern = 0;
-
- if(!skip_c2) {
- long_char_2 = amiga_nsfont_decode_surrogate(char2);
- if(ESetInfo(AMI_OFONT_ENGINE,
- OT_GlyphCode, long_char_1,
- OT_GlyphCode2, long_char_2,
- TAG_END) == OTERR_Success)
- {
- EObtainInfo(AMI_OFONT_ENGINE,
- OT_TextKernPair, &kern,
- TAG_END);
- }
- }
- char_advance = (ULONG)(((char1w - kern) * emwidth) / 65536);
-
- if(!skip_c2) EReleaseInfo(AMI_OFONT_ENGINE,
- OT_TextKernPair, kern,
- TAG_END);
-
- EReleaseInfo(AMI_OFONT_ENGINE,
- OT_WidthList, gwlist,
- TAG_END);
- }
- }
-
- return char_advance;
-}
-
-static const uint16 *ami_font_translate_smallcaps(uint16 *utf16char)
-{
- const uint16 *p;
- p = &sc_table[0];
-
- while (*p != 0)
- {
- if(*p == *utf16char) return &p[1];
- p++;
- }
-
- return utf16char;
-}
-
-static ULONG amiga_nsfont_text(struct RastPort *rp, const char *string, ULONG length,
- const plot_font_style_t *fstyle, ULONG dx, ULONG dy, bool aa)
-{
- uint16 *utf16 = NULL, *outf16 = NULL;
- uint16 *utf16charsc = 0, *utf16nextsc = 0;
- uint16 *utf16next = 0;
- int utf16charlen;
- struct OutlineFont *ofont, *ufont = NULL;
- uint32 x=0;
- int32 tempx = 0;
- ULONG emwidth = (ULONG)NSA_FONT_EMWIDTH(fstyle->size);
- uint16 utf16_a = 0x41;
-
- if(!string || string[0]=='\0') return 0;
- if(!length) return 0;
- if(rp == NULL) return 0;
-
- if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return 0;
- outf16 = utf16;
- if(!(ofont = ami_open_outline_font(fstyle, 0))) {
- if(!(ofont = ami_open_outline_font(fstyle, &utf16_a))) return 0;
- }
-
- while(*utf16 != 0)
- {
- utf16charlen = amiga_nsfont_utf16_char_length(utf16);
- utf16next = &utf16[utf16charlen];
-
- if(fstyle->flags & FONTF_SMALLCAPS)
- {
- utf16charsc = (uint16 *)ami_font_translate_smallcaps(utf16);
- utf16nextsc = (uint16 *)ami_font_translate_smallcaps(utf16next);
-
- tempx = ami_font_plot_glyph(ofont, rp, utf16charsc, utf16nextsc,
- dx + x, dy, emwidth, aa);
- }
- else tempx = 0;
-
- if(tempx == 0) {
- tempx = ami_font_plot_glyph(ofont, rp, utf16, utf16next,
- dx + x, dy, emwidth, aa);
- }
-
- if(tempx == 0)
- {
- if(ufont == NULL)
- {
- ufont = ami_open_outline_font(fstyle, utf16);
- }
-
- if(ufont) {
- tempx = ami_font_plot_glyph(ufont, rp, utf16, utf16next,
- dx + x, dy, emwidth, aa);
- }
- }
-
- x += tempx;
-
- utf16 += utf16charlen;
- }
-
- free(outf16);
- return x;
-}
-
-static inline ULONG ami_font_unicode_width(const char *string, ULONG length,
- const plot_font_style_t *fstyle, ULONG dx, ULONG dy, bool aa)
-{
- uint16 *utf16 = NULL, *outf16 = NULL;
- uint16 *utf16charsc = 0, *utf16nextsc = 0;
- uint16 *utf16next = 0;
- int utf16charlen;
- struct OutlineFont *ofont, *ufont = NULL;
- uint32 x=0;
- int32 tempx = 0;
- ULONG emwidth = (ULONG)NSA_FONT_EMWIDTH(fstyle->size);
- uint16 utf16_a = 0x41;
-
- if(!string || string[0]=='\0') return 0;
- if(!length) return 0;
-
- if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return 0;
- outf16 = utf16;
- if(!(ofont = ami_open_outline_font(fstyle, 0))) {
- if(!(ofont = ami_open_outline_font(fstyle, &utf16_a))) return 0;
- }
-
- while(*utf16 != 0)
- {
- utf16charlen = amiga_nsfont_utf16_char_length(utf16);
- utf16next = &utf16[utf16charlen];
-
- if(fstyle->flags & FONTF_SMALLCAPS)
- {
- utf16charsc = (uint16 *)ami_font_translate_smallcaps(utf16);
- utf16nextsc = (uint16 *)ami_font_translate_smallcaps(utf16next);
-
- tempx = ami_font_width_glyph(ofont, utf16charsc, utf16nextsc, emwidth);
- }
- else tempx = 0;
-
- if(tempx == 0) {
- tempx = ami_font_width_glyph(ofont, utf16, utf16next, emwidth);
- }
-
- if(tempx == 0)
- {
- if(ufont == NULL)
- {
- ufont = ami_open_outline_font(fstyle, utf16);
- }
-
- if(ufont)
- {
- tempx = ami_font_width_glyph(ufont, utf16, utf16next, emwidth);
- }
- }
-
- x += tempx;
-
- utf16 += utf16charlen;
- }
-
- free(outf16);
- return x;
-}
-
-void ami_font_bullet_close(void *nso)
-{
- struct ami_font_cache_node *node = (struct ami_font_cache_node *)nso;
- CloseOutlineFont(node->font, &ami_diskfontlib_list);
-}
-
-const struct ami_font_functions ami_font_bullet_table = {
- amiga_nsfont_width,
- amiga_nsfont_position_in_string,
- amiga_nsfont_split,
- amiga_nsfont_text
-};
-
-void ami_font_bullet_init(void)
-{
- /* Initialise Unicode font scanner */
- ami_font_initscanner(false, true);
-
- /* Initialise font caching etc lists */
- ami_font_cache_init();
-
- /* List for diskfont internal cache */
- NewList(&ami_diskfontlib_list);
-
- /* Set up table */
- ami_nsfont = &ami_font_bullet_table;
-}
-
-void ami_font_bullet_fini(void)
-{
- ami_font_cache_fini();
- ami_font_finiscanner();
-}
-
-/* Font scanner */
-void ami_font_initscanner(bool force, bool save)
-{
- ami_font_scan_init(nsoption_charp(font_unicode_file), force, save, glypharray);
-}
-
-void ami_font_finiscanner(void)
-{
- ami_font_scan_fini(glypharray);
-}
-
-void ami_font_savescanner(void)
-{
- ami_font_scan_save(nsoption_charp(font_unicode_file), glypharray);
-}
-
diff --git a/amiga/font_bullet.h b/amiga/font_bullet.h
deleted file mode 100644
index 1ab9582db..000000000
--- a/amiga/font_bullet.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_FONT_BULLET_H
-#define AMIGA_FONT_BULLET_H
-struct ami_font_cache_node;
-
-void ami_font_bullet_init(void);
-void ami_font_bullet_fini(void);
-void ami_font_bullet_close(void *nso);
-
-/* Alternate entry points into font_scan */
-void ami_font_initscanner(bool force, bool save);
-void ami_font_finiscanner(void);
-void ami_font_savescanner(void);
-#endif
-
diff --git a/amiga/font_cache.c b/amiga/font_cache.c
deleted file mode 100644
index ea285730a..000000000
--- a/amiga/font_cache.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright 2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-#include <string.h>
-
-#include <proto/timer.h>
-#include <proto/utility.h>
-
-#include "utils/log.h"
-
-#include "amiga/font.h"
-#include "amiga/font_bullet.h"
-#include "amiga/font_cache.h"
-#include "amiga/schedule.h"
-
-#ifdef __amigaos4__
-#include "amiga/hash/xxhash.h"
-#else
-#include "amiga/object.h"
-#endif
-
-#ifdef __amigaos4__
-static struct SkipList *ami_font_cache_list = NULL;
-static struct Hook ami_font_cache_hook;
-#else
-static struct MinList *ami_font_cache_list = NULL;
-#endif
-
-
-
-#ifdef __amigaos4__
-static LONG ami_font_cache_sort(struct Hook *hook, APTR key1, APTR key2)
-{
- if(key1 == key2) return 0;
- if(key1 < key2) return -1;
- return 1;
-}
-#endif
-
-#ifdef __amigaos4__
-static void ami_font_cache_cleanup(struct SkipList *skiplist)
-{
- struct ami_font_cache_node *node;
- struct ami_font_cache_node *nnode;
- struct TimeVal curtime;
-
- node = (struct ami_font_cache_node *)GetFirstSkipNode(skiplist);
- if(node == NULL) return;
-
- do {
- nnode = (struct ami_font_cache_node *)GetNextSkipNode(skiplist, (struct SkipNode *)node);
- GetSysTime(&curtime);
- SubTime(&curtime, &node->lastused);
- if(curtime.Seconds > 300)
- {
- LOG("Freeing font %p not used for %ld seconds", node->skip_node.sn_Key, curtime.Seconds);
- ami_font_bullet_close(node);
- RemoveSkipNode(skiplist, node->skip_node.sn_Key);
- }
- } while((node = nnode));
-
- /* reschedule to run in five minutes */
- ami_schedule(300000, (void *)ami_font_cache_cleanup, ami_font_cache_list);
-}
-#else
-static void ami_font_cache_cleanup(struct MinList *ami_font_cache_list)
-{
- struct nsObject *node;
- struct nsObject *nnode;
- struct ami_font_cache_node *fnode;
- struct TimeVal curtime;
-
- if(IsMinListEmpty(ami_font_cache_list)) return;
-
- node = (struct nsObject *)GetHead((struct List *)ami_font_cache_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
- fnode = node->objstruct;
- GetSysTime(&curtime);
- SubTime(&curtime, &fnode->lastused);
- if(curtime.Seconds > 300)
- {
- LOG("Freeing %s not used for %ld seconds", node->dtz_Node.ln_Name, curtime.Seconds);
- DelObject(node);
- }
- } while((node=nnode));
-
- /* reschedule to run in five minutes */
- ami_schedule(300000, (void *)ami_font_cache_cleanup, ami_font_cache_list);
-}
-#endif
-
-#ifdef __amigaos4__
-static void ami_font_cache_del_skiplist(struct SkipList *skiplist)
-{
- struct SkipNode *node;
- struct SkipNode *nnode;
-
- node = GetFirstSkipNode(skiplist);
- if(node == NULL) return;
-
- do {
- nnode = GetNextSkipNode(skiplist, node);
- ami_font_bullet_close((struct ami_font_cache_node *)node);
-
- } while((node = nnode));
-
- DeleteSkipList(skiplist);
-}
-#endif
-
-
-struct ami_font_cache_node *ami_font_cache_locate(const char *font)
-{
- struct ami_font_cache_node *nodedata;
- uint32 hash = 0;
-
-#ifdef __amigaos4__
- hash = XXH32(font, strlen(font), 0);
- nodedata = (struct ami_font_cache_node *)FindSkipNode(ami_font_cache_list, (APTR)hash);
-#else
- struct nsObject *node = (struct nsObject *)FindIName((struct List *)ami_font_cache_list, font);
- if(node) nodedata = node->objstruct;
-#endif
-
- if(nodedata) {
- GetSysTime(&nodedata->lastused);
- return nodedata;
- }
-
- LOG("Font cache miss: %s (%lx)", font, hash);
- return NULL;
-}
-
-struct ami_font_cache_node *ami_font_cache_alloc_entry(const char *font)
-{
- struct ami_font_cache_node *nodedata;
-
-#ifdef __amigaos4__
- uint32 hash = XXH32(font, strlen(font), 0);
- nodedata = (struct ami_font_cache_node *)InsertSkipNode(ami_font_cache_list, (APTR)hash, sizeof(struct ami_font_cache_node));
-#else
- nodedata = AllocVecTagList(sizeof(struct ami_font_cache_node), NULL);
-#endif
-
- GetSysTime(&nodedata->lastused);
-
- return nodedata;
-}
-
-void ami_font_cache_insert(struct ami_font_cache_node *nodedata, const char *font)
-{
-#ifndef __amigaos4__
- struct nsObject *node = AddObject(ami_font_cache_list, AMINS_FONT);
- if(node) {
- ObjectCallback(node, ami_font_bullet_close);
- node->objstruct = nodedata;
- node->dtz_Node.ln_Name = strdup(font);
- }
-#endif
-}
-
-void ami_font_cache_fini(void)
-{
- LOG("Cleaning up font cache");
- ami_schedule(-1, (void *)ami_font_cache_cleanup, ami_font_cache_list);
-#ifdef __amigaos4__
- ami_font_cache_del_skiplist(ami_font_cache_list);
-#else
- FreeObjList(ami_font_cache_list);
-#endif
- ami_font_cache_list = NULL;
-}
-
-void ami_font_cache_init(void)
-{
-#ifdef __amigaos4__
- ami_font_cache_hook.h_Entry = (HOOKFUNC)ami_font_cache_sort;
- ami_font_cache_hook.h_Data = 0;
- ami_font_cache_list = CreateSkipList(&ami_font_cache_hook, 8);
-#else
- ami_font_cache_list = NewObjList();
-#endif
-
- /* run first cleanup in ten minutes */
- ami_schedule(600000, (void *)ami_font_cache_cleanup, ami_font_cache_list);
-}
-
diff --git a/amiga/font_cache.h b/amiga/font_cache.h
deleted file mode 100644
index 7c95ba594..000000000
--- a/amiga/font_cache.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_FONT_CACHE_H
-#define AMIGA_FONT_CACHE_H
-
-#include <proto/timer.h>
-
-struct ami_font_cache_node
-{
-#ifdef __amigaos4__
- struct SkipNode skip_node;
-#endif
- struct OutlineFont *font;
- char *bold;
- char *italic;
- char *bolditalic;
- struct TimeVal lastused;
-};
-
-
-/* locate an entry in the font cache, NULL if not found */
-struct ami_font_cache_node *ami_font_cache_locate(const char *font);
-
-/* allocate a cache entry */
-struct ami_font_cache_node *ami_font_cache_alloc_entry(const char *font);
-
-/* insert a cache entry into the list (OS3) */
-void ami_font_cache_insert(struct ami_font_cache_node *nodedata, const char *font);
-
-/* initialise the cache */
-void ami_font_cache_init(void);
-
-/* cache clean-up */
-void ami_font_cache_fini(void);
-
-#endif
-
-
diff --git a/amiga/font_diskfont.c b/amiga/font_diskfont.c
deleted file mode 100644
index a64674ba2..000000000
--- a/amiga/font_diskfont.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright 2008 - 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <proto/diskfont.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <proto/utility.h>
-
-#include <graphics/rpattr.h>
-
-#include "utils/log.h"
-#include "utils/utf8.h"
-#include "utils/nsoption.h"
-
-#include "amiga/font.h"
-#include "amiga/font_diskfont.h"
-#include "amiga/gui.h"
-#include "amiga/utf8.h"
-
-#define MAX_FONT_NAME_SIZE 33
-
-static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_style_t *fstyle)
-{
- struct TextFont *bmfont = NULL;
- struct TextAttr tattr;
- char *fontname;
- char font[MAX_FONT_NAME_SIZE];
-
- if(rp == NULL) return NULL;
-
- tattr.ta_Flags = 0;
-
- switch(fstyle->family)
- {
- case PLOT_FONT_FAMILY_SANS_SERIF:
- fontname = nsoption_charp(font_sans);
- break;
- case PLOT_FONT_FAMILY_SERIF:
- fontname = nsoption_charp(font_serif);
- break;
- case PLOT_FONT_FAMILY_MONOSPACE:
- fontname = nsoption_charp(font_mono);
- break;
- case PLOT_FONT_FAMILY_CURSIVE:
- fontname = nsoption_charp(font_cursive);
- break;
- case PLOT_FONT_FAMILY_FANTASY:
- fontname = nsoption_charp(font_fantasy);
- break;
- default:
- return NULL;
- break;
- }
-
- tattr.ta_Style = FS_NORMAL;
-
- if (fstyle->flags & FONTF_OBLIQUE)
- tattr.ta_Style = FSF_ITALIC;
-
- if (fstyle->flags & FONTF_ITALIC)
- tattr.ta_Style = FSF_ITALIC;
-
- if (fstyle->weight >= 700)
- tattr.ta_Style |= FSF_BOLD;
-
- snprintf(font, MAX_FONT_NAME_SIZE, "%s.font", fontname);
- tattr.ta_Name = font;
- tattr.ta_YSize = fstyle->size / FONT_SIZE_SCALE;
- LOG("font: %s/%d", tattr.ta_Name, tattr.ta_YSize);
- if((bmfont = OpenDiskFont(&tattr))) {
- SetRPAttrs(rp, RPTAG_Font, bmfont, TAG_DONE);
- }
-
- return bmfont;
-}
-
-static void ami_font_bm_close(struct TextFont *bmfont)
-{
- CloseFont(bmfont);
-}
-
-static size_t ami_font_bm_convert_local_to_utf8_offset(const char *utf8string, size_t length, UWORD offset)
-{
- size_t chr = 0;
-
- for(UWORD i = 0; i < offset; i++) {
- chr = utf8_next(utf8string, length, chr);
- if(chr > length) return length;
- }
-
- return chr;
-}
-
-
-static nserror amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int *width)
-{
- char *localtext = NULL;
-
- if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
- *width = length;
-
- struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
- if(bmfont == NULL) return NSERROR_INVALID;
-
- if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
- ami_font_bm_close(bmfont);
- return NSERROR_INVALID;
- }
-
- *width = TextLength(glob->rp, localtext, (UWORD)strlen(localtext));
- free(localtext);
-
- ami_font_bm_close(bmfont);
-
- return NSERROR_OK;
-}
-
-/**
- * Find the position in a string where an x coordinate falls.
- *
- * \param fstyle style for this text
- * \param string UTF-8 string to measure
- * \param length length of string
- * \param x x coordinate to search for
- * \param char_offset updated to offset in string of actual_x, [0..length]
- * \param actual_x updated to x coordinate of character closest to x
- * \return true on success, false on error and error reported
- */
-
-static nserror amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- struct TextExtent extent;
- struct TextFont *bmfont;
- char *localtext = NULL;
- UWORD co = 0;
-
- if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
-
- bmfont = ami_font_bm_open(glob->rp, fstyle);
- if(bmfont == NULL) return NSERROR_INVALID;
-
- if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
- ami_font_bm_close(bmfont);
- return NSERROR_INVALID;
- }
-
- co = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
- &extent, NULL, 1, x, 32767);
- *char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
- *actual_x = extent.te_Extent.MaxX;
-
- free(localtext);
- ami_font_bm_close(bmfont);
-
- return NSERROR_OK;
-}
-
-
-/**
- * Find where to split a string to make it fit a width.
- *
- * \param fstyle style for this text
- * \param string UTF-8 string to measure
- * \param length length of string
- * \param x width available
- * \param char_offset updated to offset in string of actual_x, [1..length]
- * \param actual_x updated to x coordinate of character closest to x
- * \return true on success, false on error and error reported
- *
- * On exit, char_offset indicates first character after split point.
- *
- * Note: char_offset of 0 should never be returned.
- *
- * Returns:
- * char_offset giving split point closest to x, where actual_x <= x
- * else
- * char_offset giving split point closest to x, where actual_x > x
- *
- * Returning char_offset == length means no split possible
- */
-
-static nserror amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- struct TextExtent extent;
- UWORD co, offset;
- char *charp;
- char *localtext;
-
- if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
-
- struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
- if(bmfont == NULL) return NSERROR_INVALID;
-
- if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
- ami_font_bm_close(bmfont);
- return NSERROR_INVALID;
- }
-
- offset = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
- &extent, NULL, 1, (UWORD)x, 32767);
-
- co = offset;
- charp = localtext + co;
-
-
- while((*charp != ' ') && (co > 0)) {
- charp--;
- co--;
- }
-
- if(co == 0) {
- co = offset;
- charp = localtext + co;
- while((*charp != ' ') && (co < strlen(localtext))) {
- charp++;
- co++;
- }
- }
-
- if((co > 0) && (co < strlen(localtext))) {
- *actual_x = TextLength(glob->rp, localtext, co);
- *char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
- } else {
- *actual_x = x;
- *char_offset = length;
- }
-
- free(localtext);
- ami_font_bm_close(bmfont);
-
- return NSERROR_OK;
-}
-
-static ULONG amiga_bm_nsfont_text(struct RastPort *rp, const char *string, ULONG length,
- const plot_font_style_t *fstyle, ULONG dx, ULONG dy, bool aa)
-{
- if(!string || string[0]=='\0') return 0;
- if(!length) return 0;
- if(rp == NULL) return 0;
-
- struct TextFont *bmfont = ami_font_bm_open(rp, fstyle);
- char *localtext = NULL;
- if(bmfont == NULL) return 0;
- if(utf8_to_local_encoding(string, length, &localtext) == NSERROR_OK) {
- Move(rp, dx, dy);
- Text(rp, localtext, (UWORD)strlen(localtext));
- free(localtext);
- }
-
- ami_font_bm_close(bmfont);
-
- return 0;
-}
-
-const struct ami_font_functions ami_font_diskfont_table = {
- amiga_bm_nsfont_width,
- amiga_bm_nsfont_position_in_string,
- amiga_bm_nsfont_split,
- amiga_bm_nsfont_text
-};
-
-void ami_font_diskfont_init(void)
-{
- /* Set up table */
- ami_nsfont = &ami_font_diskfont_table;
-}
-
diff --git a/amiga/font_diskfont.h b/amiga/font_diskfont.h
deleted file mode 100644
index de19e940e..000000000
--- a/amiga/font_diskfont.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_FONT_DISKFONT_H
-#define AMIGA_FONT_DISKFONT_H
-void ami_font_diskfont_init(void);
-#endif
-
diff --git a/amiga/font_scan.c b/amiga/font_scan.c
deleted file mode 100644
index b65798d6e..000000000
--- a/amiga/font_scan.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- * Copyright 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Font glyph scanner for Unicode substitutions.
-*/
-
-#include "amiga/os3support.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef __amigaos4__
-#include <proto/bullet.h>
-#endif
-#include <proto/diskfont.h>
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <diskfont/diskfonttag.h>
-#include <diskfont/oterrors.h>
-
-#include <proto/window.h>
-#include <proto/layout.h>
-#include <proto/fuelgauge.h>
-#include <classes/window.h>
-#include <gadgets/fuelgauge.h>
-#include <gadgets/layout.h>
-
-#include <reaction/reaction_macros.h>
-
-#include "utils/nsoption.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/font_scan.h"
-#include "amiga/gui.h"
-#include "amiga/libs.h"
-#include "amiga/object.h"
-#include "amiga/utf8.h"
-
-enum {
- FS_OID_MAIN = 0,
- FS_GID_MAIN,
- FS_GID_FONTS,
- FS_GID_GLYPHS,
- FS_GID_LAST
-};
-
-struct ami_font_scan_window {
- struct Window *win;
- Object *objects[FS_GID_LAST];
- char *title;
- char *glyphtext;
-};
-
-/**
- * Lookup a font that contains a UTF-16 codepoint
- *
- * \param code UTF-16 codepoint to lookup
- * \param glypharray an array of 0xffff lwc_string pointers
- * \return font name or NULL
- */
-const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray)
-{
- if(*code >= 0xd800 && *code <= 0xdbff) {
- /* This is a multi-byte character, we don't support fallback for these yet. */
- return NULL;
- }
-
- if(glypharray[*code] == NULL) return NULL;
- else return lwc_string_data(glypharray[*code]);
-}
-
-/**
- * Open GUI to show font scanning progress
- *
- * \param fonts number of fonts that are being scanned
- * \return pointer to a struct ami_font_scan_window
- */
-static struct ami_font_scan_window *ami_font_scan_gui_open(int32 fonts)
-{
- struct ami_font_scan_window *fsw =
- AllocVecTagList(sizeof(struct ami_font_scan_window), NULL);
-
- if(fsw == NULL) return NULL;
-
- fsw->title = ami_utf8_easy(messages_get("FontScanning"));
- fsw->glyphtext = ami_utf8_easy(messages_get("FontGlyphs"));
-
- fsw->objects[FS_OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, fsw->title,
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, FALSE,
- WA_SizeGadget, TRUE,
- WA_PubScreen, scrn,
- WA_BusyPointer, TRUE,
- WA_Width, 400,
- WINDOW_UserData, fsw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_LockHeight, TRUE,
- WINDOW_ParentGroup, fsw->objects[FS_GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, fsw->objects[FS_GID_FONTS] = FuelGaugeObj,
- GA_ID, FS_GID_FONTS,
- GA_Text, fsw->title,
- FUELGAUGE_Min, 0,
- FUELGAUGE_Max, fonts,
- FUELGAUGE_Level, 0,
- FUELGAUGE_Ticks, 11,
- FUELGAUGE_ShortTicks, TRUE,
- FUELGAUGE_Percent, FALSE,
- FUELGAUGE_Justification, FGJ_CENTER,
- FuelGaugeEnd,
- CHILD_NominalSize, TRUE,
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, fsw->objects[FS_GID_GLYPHS] = FuelGaugeObj,
- GA_ID, FS_GID_GLYPHS,
- //GA_Text, "Glyphs",
- FUELGAUGE_Min, 0x0000,
- FUELGAUGE_Max, 0xffff,
- FUELGAUGE_Level, 0,
- FUELGAUGE_Ticks,11,
- FUELGAUGE_ShortTicks, TRUE,
- FUELGAUGE_Percent, FALSE,
- FUELGAUGE_Justification, FGJ_CENTER,
- FuelGaugeEnd,
- CHILD_NominalSize, TRUE,
- CHILD_WeightedHeight, 0,
- EndGroup,
- EndWindow;
-
- fsw->win = (struct Window *)RA_OpenWindow(fsw->objects[FS_OID_MAIN]);
-
- return fsw;
-}
-
-/**
- * Update GUI showing font scanning progress
- *
- * \param fsw pointer to a struct ami_font_scan_window
- * \param font current font being scanned
- * \param font_num font number being scanned
- * \param glyphs number of unique glyphs found
- */
-static void ami_font_scan_gui_update(struct ami_font_scan_window *fsw, const char *font,
- ULONG font_num, ULONG glyphs)
-{
- ULONG va[2];
-
- if(fsw) {
- RefreshSetGadgetAttrs((struct Gadget *)fsw->objects[FS_GID_FONTS],
- fsw->win, NULL,
- FUELGAUGE_Level, font_num,
- GA_Text, font,
- TAG_DONE);
-
- va[0] = glyphs;
- va[1] = 0;
-
- RefreshSetGadgetAttrs((struct Gadget *)fsw->objects[FS_GID_GLYPHS],
- fsw->win, NULL,
- GA_Text, fsw->glyphtext,
- FUELGAUGE_VarArgs, va,
- FUELGAUGE_Level, glyphs,
- TAG_DONE);
- } else {
- printf("Found %ld glyphs\n", glyphs);
- printf("Scanning font #%ld (%s)...\n", font_num, font);
- }
-}
-
-/**
- * Close GUI showing font scanning progress
- *
- * \param fsw pointer to a struct ami_font_scan_window
- */
-static void ami_font_scan_gui_close(struct ami_font_scan_window *fsw)
-{
- if(fsw) {
- DisposeObject(fsw->objects[FS_OID_MAIN]);
- ami_utf8_free(fsw->title);
- FreeVec(fsw);
- }
-}
-
-/**
- * Scan a font for glyphs not present in glypharray.
- *
- * \param fontname font to scan
- * \param glypharray an array of 0xffff lwc_string pointers
- * \return number of new glyphs found
- */
-static ULONG ami_font_scan_font(const char *fontname, lwc_string **glypharray)
-{
- struct OutlineFont *ofont;
- struct MinList *widthlist = NULL;
- struct GlyphWidthEntry *gwnode;
- ULONG foundglyphs = 0;
- lwc_error lerror;
- ULONG unicoderanges = 0;
-
- ofont = OpenOutlineFont(fontname, NULL, OFF_OPEN);
-
- if(!ofont) return 0;
-
-#ifndef __amigaos4__
- struct BulletBase *BulletBase = ofont->BulletBase;
-#endif
-
- if(ESetInfo(AMI_OFONT_ENGINE,
- OT_PointHeight, 10 * (1 << 16),
- OT_GlyphCode, 0x0000,
- OT_GlyphCode2, 0xffff,
- TAG_END) == OTERR_Success)
- {
- if(EObtainInfo(AMI_OFONT_ENGINE,
- OT_WidthList, &widthlist,
- TAG_END) == 0)
- {
- gwnode = (struct GlyphWidthEntry *)GetHead((struct List *)widthlist);
- do {
- if(gwnode && (glypharray[gwnode->gwe_Code] == NULL)) {
- lerror = lwc_intern_string(fontname, strlen(fontname), &glypharray[gwnode->gwe_Code]);
- if(lerror != lwc_error_ok) continue;
- foundglyphs++;
- }
- } while((gwnode = (struct GlyphWidthEntry *)GetSucc((struct Node *)gwnode)));
- EReleaseInfo(AMI_OFONT_ENGINE,
- OT_WidthList, widthlist,
- TAG_END);
- }
- }
-#ifdef __amigaos4__
- if(EObtainInfo(AMI_OFONT_ENGINE, OT_UnicodeRanges, &unicoderanges, TAG_END) == 0) {
- if(unicoderanges & UCR_SURROGATES) {
- LOG("%s supports UTF-16 surrogates", fontname);
- if (nsoption_charp(font_surrogate) == NULL) {
- nsoption_set_charp(font_surrogate, (char *)strdup(fontname));
- }
- }
- EReleaseInfo(AMI_OFONT_ENGINE,
- OT_UnicodeRanges, unicoderanges,
- TAG_END);
- }
-#endif
- CloseOutlineFont(ofont, NULL);
-
- return foundglyphs;
-}
-
-/**
- * Scan all fonts for glyphs.
- *
- * \param list min list
- * \param win scan window
- * \param glypharray an array of 0xffff lwc_string pointers
- * \return number of glyphs found
- */
-static ULONG ami_font_scan_fonts(struct MinList *list,
- struct ami_font_scan_window *win, lwc_string **glypharray)
-{
- ULONG found, total = 0, font_num = 0;
- struct nsObject *node;
- struct nsObject *nnode;
-
- if(IsMinListEmpty(list)) return 0;
-
- node = (struct nsObject *)GetHead((struct List *)list);
-
- do {
- nnode = (struct nsObject *)GetSucc((struct Node *)node);
- ami_font_scan_gui_update(win, node->dtz_Node.ln_Name, font_num, total);
- LOG("Scanning %s", node->dtz_Node.ln_Name);
- found = ami_font_scan_font(node->dtz_Node.ln_Name, glypharray);
- total += found;
- LOG("Found %ld new glyphs (total = %ld)", found, total);
- font_num++;
- } while((node = nnode));
-
- return total;
-}
-
-/**
- * Add OS fonts to a list.
- *
- * \param list list to add font names to
- * \return number of fonts found
- */
-static ULONG ami_font_scan_list(struct MinList *list)
-{
- int afShortage, afSize = 100;
- struct AvailFontsHeader *afh;
- struct AvailFonts *af;
- ULONG found = 0;
- struct nsObject *node;
-
- do {
- if((afh = (struct AvailFontsHeader *)AllocVecTagList(afSize, NULL))) {
- if(((afShortage = AvailFonts((STRPTR)afh, afSize,
- AFF_DISK | AFF_OTAG | AFF_SCALED)))) {
- FreeVec(afh);
- afSize += afShortage;
- }
- } else {
- /* out of memory, bail out */
- return 0;
- }
- } while (afShortage);
-
- if(afh) {
- af = (struct AvailFonts *)&(afh[1]);
-
- for(int i = 0; i < afh->afh_NumEntries; i++) {
- if(af[i].af_Attr.ta_Style == FS_NORMAL) {
- if(af[i].af_Attr.ta_Name != NULL) {
- char *p = 0;
- if((p = strrchr(af[i].af_Attr.ta_Name, '.'))) *p = '\0';
- node = (struct nsObject *)FindIName((struct List *)list,
- af[i].af_Attr.ta_Name);
- if(node == NULL) {
- node = AddObject(list, AMINS_UNKNOWN);
- if(node) {
- node->dtz_Node.ln_Name = strdup(af[i].af_Attr.ta_Name);
- found++;
- LOG("Added %s", af[i].af_Attr.ta_Name);
- }
- }
- }
- }
- }
- FreeVec(afh);
- } else {
- return 0;
- }
- return found;
-}
-
-/**
- * Load a font glyph cache
- *
- * \param filename name of cache file to load
- * \param glypharray an array of 0xffff lwc_string pointers
- * \return number of glyphs loaded
- */
-static ULONG ami_font_scan_load(const char *filename, lwc_string **glypharray)
-{
- ULONG found = 0;
- BPTR fh = 0;
- lwc_error lerror;
- char buffer[256];
- struct RDArgs *rargs = NULL;
- CONST_STRPTR template = "CODE/A,FONT/A";
- long rarray[] = {0,0};
-
- enum {
- A_CODE = 0,
- A_FONT
- };
-
- rargs = AllocDosObjectTags(DOS_RDARGS, TAG_DONE);
-
- if((fh = FOpen(filename, MODE_OLDFILE, 0))) {
- LOG("Loading font glyph cache from %s", filename);
-
- while(FGets(fh, (STRPTR)&buffer, 256) != 0)
- {
- rargs->RDA_Source.CS_Buffer = (char *)&buffer;
- rargs->RDA_Source.CS_Length = 256;
- rargs->RDA_Source.CS_CurChr = 0;
-
- rargs->RDA_DAList = NULL;
- rargs->RDA_Buffer = NULL;
- rargs->RDA_BufSiz = 0;
- rargs->RDA_ExtHelp = NULL;
- rargs->RDA_Flags = 0;
-
- if(ReadArgs(template, rarray, rargs))
- {
- lerror = lwc_intern_string((const char *)rarray[A_FONT],
- strlen((const char *)rarray[A_FONT]),
- &glypharray[strtoul((const char *)rarray[A_CODE], NULL, 0)]);
- if(lerror != lwc_error_ok) continue;
- found++;
- }
- }
- FClose(fh);
- }
-
- return found;
-}
-
-/**
- * Save a font glyph cache
- *
- * \param filename name of cache file to save
- * \param glypharray an array of 0xffff lwc_string pointers
- */
-void ami_font_scan_save(const char *filename, lwc_string **glypharray)
-{
- ULONG i;
- BPTR fh = 0;
-
- if((fh = FOpen(filename, MODE_NEWFILE, 0))) {
- LOG("Writing font glyph cache to %s", filename);
- FPrintf(fh, "; This file is auto-generated. To re-create the cache, delete this file.\n");
- FPrintf(fh, "; This file is parsed using ReadArgs() with the following template:\n");
- FPrintf(fh, "; CODE/A,FONT/A\n;\n");
-
- for(i=0x0000; i<=0xffff; i++)
- {
- if(glypharray[i]) {
- FPrintf(fh, "0x%04lx \"%s\"\n", i, lwc_string_data(glypharray[i]));
- }
- }
- FClose(fh);
- }
-}
-
-/**
- * Finalise the font glyph cache.
- *
- * \param glypharray an array of 0xffff lwc_string pointers to free
- */
-void ami_font_scan_fini(lwc_string **glypharray)
-{
- ULONG i;
-
- for(i=0x0000; i<=0xffff; i++)
- {
- if(glypharray[i]) {
- lwc_string_unref(glypharray[i]);
- glypharray[i] = NULL;
- }
- }
-}
-
-/**
- * Initialise the font glyph cache.
- * Reads an existing file or, if not present, generates a new cache.
- *
- * \param filename cache file to attempt to read
- * \param force_scan force re-creation of cache
- * \param save save the cache
- * \param glypharray an array of 0xffff lwc_string pointers
- */
-void ami_font_scan_init(const char *filename, bool force_scan, bool save,
- lwc_string **glypharray)
-{
- ULONG i, found = 0, entries = 0;
- struct MinList *list;
- struct nsObject *node;
- char *csv;
- struct ami_font_scan_window *win = NULL;
-
- /* Ensure array zeroed */
- for(i=0x0000; i<=0xffff; i++)
- glypharray[i] = NULL;
-
- if(force_scan == false)
- found = ami_font_scan_load(filename, glypharray);
-
- if(found == 0) {
- LOG("Creating new font glyph cache");
- if((list = NewObjList())) {
-
- /* add preferred fonts list */
- if(nsoption_charp(font_unicode) &&
- (csv = strdup(nsoption_charp(font_unicode))))
- {
- char *p;
-
- while((p = strsep(&csv, ","))) {
- if(p != NULL) {
- node = AddObject(list, AMINS_UNKNOWN);
- if(node) node->dtz_Node.ln_Name = strdup(p);
- entries++;
- }
- }
- free(csv);
- }
-
- if(nsoption_bool(font_unicode_only) == false)
- entries += ami_font_scan_list(list);
-
- LOG("Found %ld fonts", entries);
-
- win = ami_font_scan_gui_open(entries);
- found = ami_font_scan_fonts(list, win, glypharray);
- ami_font_scan_gui_close(win);
-
- FreeObjList(list);
-
- if(save == true)
- ami_font_scan_save(filename, glypharray);
- }
- }
-
- LOG("Initialised with %ld glyphs", found);
-}
-
diff --git a/amiga/font_scan.h b/amiga/font_scan.h
deleted file mode 100755
index 7d61e2daa..000000000
--- a/amiga/font_scan.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_FONT_SCAN_H
-#define AMIGA_FONT_SCAN_H
-#include "amiga/os3support.h"
-#include <libwapcaplet/libwapcaplet.h>
-
-/* Compatibliity define used by font.c and font_scan.c
- * It's here because this file is included by both. */
-#ifdef __amigaos4__
-#define AMI_OFONT_ENGINE &ofont->olf_EEngine
-#else
-#define AMI_OFONT_ENGINE ofont->GEngine
-#endif
-
-void ami_font_scan_init(const char *filename, bool force_scan, bool save,
- lwc_string **glypharray);
-void ami_font_scan_fini(lwc_string **glypharray);
-void ami_font_scan_save(const char *filename, lwc_string **glypharray);
-const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray);
-
-#endif
-
diff --git a/amiga/gui.c b/amiga/gui.c
deleted file mode 100644
index c6c963312..000000000
--- a/amiga/gui.c
+++ /dev/null
@@ -1,5740 +0,0 @@
-/*
- * Copyright 2008-2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-
-/* Custom StringView class */
-#include "amiga/stringview/stringview.h"
-#include "amiga/stringview/urlhistory.h"
-
-/* AmigaOS libraries */
-#ifdef __amigaos4__
-#include <proto/application.h>
-#endif
-#include <proto/asl.h>
-#include <proto/datatypes.h>
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <proto/icon.h>
-#include <proto/intuition.h>
-#include <proto/keymap.h>
-#include <proto/locale.h>
-#include <proto/utility.h>
-#include <proto/wb.h>
-
-/* Other OS includes */
-#include <datatypes/textclass.h>
-#include <devices/inputevent.h>
-#include <graphics/gfxbase.h>
-#include <graphics/rpattr.h>
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#include <intuition/gui.h>
-#include <libraries/application.h>
-#include <libraries/keymap.h>
-#endif
-#include <intuition/icclass.h>
-#include <intuition/screens.h>
-#include <libraries/gadtools.h>
-#include <workbench/workbench.h>
-
-/* ReAction libraries */
-#include <proto/bevel.h>
-#include <proto/bitmap.h>
-#include <proto/button.h>
-#include <proto/chooser.h>
-#include <proto/clicktab.h>
-#include <proto/label.h>
-#include <proto/layout.h>
-#include <proto/scroller.h>
-#include <proto/space.h>
-#include <proto/speedbar.h>
-#include <proto/string.h>
-#include <proto/window.h>
-
-#include <classes/window.h>
-#include <gadgets/button.h>
-#include <gadgets/chooser.h>
-#include <gadgets/clicktab.h>
-#include <gadgets/layout.h>
-#include <gadgets/scroller.h>
-#include <gadgets/space.h>
-#include <gadgets/speedbar.h>
-#include <gadgets/string.h>
-#include <images/bevel.h>
-#include <images/bitmap.h>
-#include <images/label.h>
-
-#include <reaction/reaction_macros.h>
-
-/* newlib includes */
-#include <math.h>
-#include <string.h>
-
-/* NetSurf core includes */
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/nsoption.h"
-#include "utils/utf8.h"
-#include "utils/utils.h"
-#include "utils/nsurl.h"
-#include "utils/file.h"
-#include "content/hlcache.h"
-#include "content/backing_store.h"
-#include "content/fetchers.h"
-#include "content/fetchers/resource.h"
-#include "content/urldb.h"
-#include "image/ico.h"
-#include "desktop/browser_history.h"
-#include "desktop/browser.h"
-#include "desktop/hotlist.h"
-#include "desktop/mouse.h"
-#include "desktop/netsurf.h"
-#include "desktop/version.h"
-#include "desktop/save_complete.h"
-#include "desktop/scrollbar.h"
-#include "desktop/searchweb.h"
-#include "desktop/textinput.h"
-#include "desktop/tree.h"
-#include "desktop/gui_window.h"
-#include "desktop/gui_fetch.h"
-#include "desktop/gui_misc.h"
-
-/* NetSurf Amiga platform includes */
-#include "amiga/gui.h"
-#include "amiga/arexx.h"
-#include "amiga/bitmap.h"
-#include "amiga/clipboard.h"
-#include "amiga/cookies.h"
-#include "amiga/ctxmenu.h"
-#include "amiga/datatypes.h"
-#include "amiga/download.h"
-#include "amiga/drag.h"
-#include "amiga/file.h"
-#include "amiga/filetype.h"
-#include "amiga/font.h"
-#include "amiga/gui_options.h"
-#include "amiga/help.h"
-#include "amiga/history.h"
-#include "amiga/history_local.h"
-#include "amiga/hotlist.h"
-#include "amiga/icon.h"
-#include "amiga/launch.h"
-#include "amiga/libs.h"
-#include "amiga/login.h"
-#include "amiga/menu.h"
-#include "amiga/misc.h"
-#include "amiga/plotters.h"
-#include "amiga/plugin_hack.h"
-#include "amiga/print.h"
-#include "amiga/schedule.h"
-#include "amiga/search.h"
-#include "amiga/selectmenu.h"
-#include "amiga/theme.h"
-#include "amiga/tree.h"
-#include "amiga/utf8.h"
-#include "amiga/sslcert.h"
-
-#define AMINS_SCROLLERPEN NUMDRIPENS
-#define NSA_KBD_SCROLL_PX 10
-#define NSA_MAX_HOTLIST_BUTTON_LEN 20
-
-/* Extra mouse button defines to match those in intuition/intuition.h */
-#define SIDEDOWN (IECODE_4TH_BUTTON)
-#define SIDEUP (IECODE_4TH_BUTTON | IECODE_UP_PREFIX)
-#define EXTRADOWN (IECODE_5TH_BUTTON)
-#define EXTRAUP (IECODE_5TH_BUTTON | IECODE_UP_PREFIX)
-
-#ifdef __amigaos4__
-#define NSA_STATUS_TEXT GA_Text
-#else
-#define NSA_STATUS_TEXT STRINGA_TextVal
-#endif
-
-#ifdef __amigaos4__
-#define BOOL_MISMATCH(a,b) ((a == FALSE) && (b != FALSE)) || ((a != FALSE) && (b == FALSE))
-#else
-#define BOOL_MISMATCH(a,b) (1)
-#endif
-
-static bool ami_quit = false;
-
-extern struct gui_utf8_table *amiga_utf8_table;
-
-struct ami_gui_tb_userdata {
- struct List *sblist;
- struct gui_window_2 *gw;
- int items;
-};
-
-static struct MsgPort *schedulermsgport = NULL;
-static struct MsgPort *appport;
-static Class *urlStringClass;
-
-static BOOL locked_screen = FALSE;
-static int screen_signal = -1;
-static bool win_destroyed;
-static STRPTR nsscreentitle;
-
-static struct MsgPort *applibport = NULL;
-static ULONG applibsig = 0;
-static uint32 ami_appid = 0;
-static struct Hook newprefs_hook;
-
-static STRPTR temp_homepage_url = NULL;
-static bool cli_force = false;
-
-#define USERS_DIR "PROGDIR:Users"
-static char *users_dir = NULL;
-static char *current_user = NULL;
-static char *current_user_dir;
-static char *current_user_faviconcache;
-
-static const __attribute__((used)) char *stack_cookie = "\0$STACK:196608\0";
-
-const char * const versvn;
-const char * const verdate;
-
-void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
-void ami_change_tab(struct gui_window_2 *gwin, int direction);
-void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs);
-void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys);
-void ami_quit_netsurf_delayed(void);
-Object *ami_gui_splash_open(void);
-void ami_gui_splash_close(Object *win_obj);
-HOOKF(uint32, ami_set_favicon_render_hook, APTR, space, struct gpRender *);
-HOOKF(uint32, ami_set_throbber_render_hook, APTR, space, struct gpRender *);
-bool ami_gui_map_filename(char **remapped, const char *path, const char *file,
- const char *map);
-static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw);
-static void ami_do_redraw(struct gui_window_2 *g);
-static void ami_schedule_redraw_remove(struct gui_window_2 *gwin);
-
-static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy);
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy);
-static void gui_window_remove_caret(struct gui_window *g);
-static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip);
-
-
-
-/* accessors for default options - user option is updated if it is set as per default */
-#define nsoption_default_set_int(OPTION, VALUE) \
- if (nsoptions_default[NSOPTION_##OPTION].value.i == nsoptions[NSOPTION_##OPTION].value.i) \
- nsoptions[NSOPTION_##OPTION].value.i = VALUE; \
- nsoptions_default[NSOPTION_##OPTION].value.i = VALUE
-
-
-
-STRPTR ami_locale_langs(void)
-{
- struct Locale *locale;
- STRPTR acceptlangs = NULL;
- char *remapped;
-
- if((locale = OpenLocale(NULL)))
- {
- for(int i = 0; i < 10; i++)
- {
- if(locale->loc_PrefLanguages[i])
- {
- if(ami_gui_map_filename(&remapped, "PROGDIR:Resources",
- locale->loc_PrefLanguages[i], "LangNames"))
- {
- if(acceptlangs)
- {
- STRPTR acceptlangs2 = acceptlangs;
- acceptlangs = ASPrintf("%s, %s",acceptlangs2, remapped);
- FreeVec(acceptlangs2);
- acceptlangs2 = NULL;
- }
- else
- {
- acceptlangs = ASPrintf("%s", remapped);
- }
- }
- }
- else
- {
- continue;
- }
- }
- CloseLocale(locale);
- }
- return acceptlangs;
-}
-
-bool ami_gui_map_filename(char **remapped, const char *path, const char *file, const char *map)
-{
- BPTR fh = 0;
- char *mapfile = NULL;
- size_t mapfile_size = 0;
- char buffer[1024];
- char *realfname;
- bool found = false;
-
- netsurf_mkpath(&mapfile, &mapfile_size, 2, path, map);
-
- if(mapfile == NULL) return false;
-
- fh = FOpen(mapfile, MODE_OLDFILE, 0);
- if(fh)
- {
- while(FGets(fh, buffer, 1024) != 0)
- {
- if((buffer[0] == '#') ||
- (buffer[0] == '\n') ||
- (buffer[0] == '\0')) continue;
-
- realfname = strchr(buffer, ':');
- if(realfname)
- {
- if(strncmp(buffer, file, strlen(file)) == 0)
- {
- if(realfname[strlen(realfname)-1] == '\n')
- realfname[strlen(realfname)-1] = '\0';
- *remapped = strdup(realfname + 1);
- found = true;
- break;
- }
- }
- }
- FClose(fh);
- }
-
- if(found == false) *remapped = strdup(file);
- else LOG("Remapped %s to %s in path %s using %s", file, *remapped, path, map);
-
- free(mapfile);
-
- return found;
-}
-
-static bool ami_gui_check_resource(char *fullpath, const char *file)
-{
- bool found = false;
- char *remapped;
- BPTR lock = 0;
- size_t fullpath_len = 1024;
-
- ami_gui_map_filename(&remapped, fullpath, file, "Resource.map");
- netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, remapped);
-
- lock = Lock(fullpath, ACCESS_READ);
- if(lock)
- {
- UnLock(lock);
- found = true;
- }
-
- if(found) LOG("Found %s", fullpath);
- free(remapped);
-
- return found;
-}
-
-bool ami_locate_resource(char *fullpath, const char *file)
-{
- struct Locale *locale;
- int i;
- bool found = false;
- char *remapped;
- size_t fullpath_len = 1024;
-
- /* Check NetSurf user data area first */
-
- if(current_user_dir != NULL) {
- strcpy(fullpath, current_user_dir);
- found = ami_gui_check_resource(fullpath, file);
- if(found) return true;
- }
-
- /* Check current theme directory */
- if(nsoption_charp(theme)) {
- strcpy(fullpath, nsoption_charp(theme));
- found = ami_gui_check_resource(fullpath, file);
- if(found) return true;
- }
-
- /* If not found, start on the user's preferred languages */
-
- locale = OpenLocale(NULL);
-
- for(i=0;i<10;i++) {
- strcpy(fullpath,"PROGDIR:Resources/");
-
- if(locale->loc_PrefLanguages[i]) {
- ami_gui_map_filename(&remapped, "PROGDIR:Resources",
- locale->loc_PrefLanguages[i], "LangNames");
- netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, remapped);
-
- found = ami_gui_check_resource(fullpath, file);
- } else {
- continue;
- }
-
- if(found) break;
- }
-
- if(!found) {
- /* If not found yet, check in PROGDIR:Resources/en,
- * might not be in user's preferred languages */
-
- strcpy(fullpath, "PROGDIR:Resources/en/");
- found = ami_gui_check_resource(fullpath, file);
- }
-
- CloseLocale(locale);
-
- if(!found) {
- /* Lastly check directly in PROGDIR:Resources */
-
- strcpy(fullpath, "PROGDIR:Resources/");
- found = ami_gui_check_resource(fullpath, file);
- }
-
- return found;
-}
-
-static bool ami_open_resources(void)
-{
- urlStringClass = MakeStringClass();
-
- if(!(appport = AllocSysObjectTags(ASOT_PORT,
- ASO_NoTrack, FALSE,
- TAG_DONE))) return false;
-
- if(!(sport = AllocSysObjectTags(ASOT_PORT,
- ASO_NoTrack, FALSE,
- TAG_DONE))) return false;
-
- if(!(schedulermsgport = AllocSysObjectTags(ASOT_PORT,
- ASO_NoTrack, FALSE,
- TAG_DONE))) return false;
-
- return true;
-}
-
-static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo)
-{
- LONG scrollerfillpen = FALSE;
-#ifdef __amigaos4__
- GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE);
-
- if(scrollerfillpen) return FILLPEN;
- else return FOREGROUNDPEN;
-#else
- return FILLPEN;
-#endif
-
-}
-
-/**
- * set option from pen
- */
-static nserror
-colour_option_from_pen(UWORD pen,
- enum nsoption_e option,
- struct Screen *screen,
- colour def_colour)
-{
- ULONG colr[3];
- struct DrawInfo *drinfo;
-
- if((option < NSOPTION_SYS_COLOUR_START) ||
- (option > NSOPTION_SYS_COLOUR_END) ||
- (nsoptions[option].type != OPTION_COLOUR)) {
- return NSERROR_BAD_PARAMETER;
- }
-
- if(screen != NULL) {
- drinfo = GetScreenDrawInfo(screen);
- if(drinfo != NULL) {
-
- if(pen == AMINS_SCROLLERPEN) pen = ami_system_colour_scrollbar_fgpen(drinfo);
-
- /* Get the colour of the pen being used for "pen" */
- GetRGB32(screen->ViewPort.ColorMap, drinfo->dri_Pens[pen], 1, (ULONG *)&colr);
-
- /* convert it to a color */
- def_colour = ((colr[0] & 0xff000000) >> 24) |
- ((colr[1] & 0xff000000) >> 16) |
- ((colr[2] & 0xff000000) >> 8);
-
- FreeScreenDrawInfo(screen, drinfo);
- }
- }
-
- if (nsoptions_default[option].value.c == nsoptions[option].value.c)
- nsoptions[option].value.c = def_colour;
- nsoptions_default[option].value.c = def_colour;
-
- return NSERROR_OK;
-}
-
-/* exported interface documented in amiga/gui.h */
-STRPTR ami_gui_get_screen_title(void)
-{
- if(nsscreentitle == NULL) {
- nsscreentitle = ASPrintf("NetSurf %s", netsurf_version);
- /* If this fails it will be NULL, which means we'll get the screen's
- * default titlebar text instead - so no need to check for error. */
- }
-
- return nsscreentitle;
-}
-
-static void ami_set_screen_defaults(struct Screen *screen)
-{
- nsoption_default_set_int(window_x, 0);
- nsoption_default_set_int(window_y, screen->BarHeight + 1);
- nsoption_default_set_int(window_width, screen->Width);
- nsoption_default_set_int(window_height, screen->Height - screen->BarHeight - 1);
-
-#ifdef __amigaos4__
- nsoption_default_set_int(redraw_tile_size_x, screen->Width);
- nsoption_default_set_int(redraw_tile_size_y, screen->Height);
-
- /* set system colours for amiga ui */
- colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveBorder, screen, 0x00000000);
- colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveCaption, screen, 0x00dddddd);
- colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_AppWorkspace, screen, 0x00eeeeee);
- colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Background, screen, 0x00aa0000);
- colour_option_from_pen(FOREGROUNDPEN, NSOPTION_sys_colour_ButtonFace, screen, 0x00aaaaaa);
- colour_option_from_pen(FORESHINEPEN, NSOPTION_sys_colour_ButtonHighlight, screen, 0x00cccccc);
- colour_option_from_pen(FORESHADOWPEN, NSOPTION_sys_colour_ButtonShadow, screen, 0x00bbbbbb);
- colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_ButtonText, screen, 0x00000000);
- colour_option_from_pen(FILLTEXTPEN, NSOPTION_sys_colour_CaptionText, screen, 0x00000000);
- colour_option_from_pen(DISABLEDTEXTPEN, NSOPTION_sys_colour_GrayText, screen, 0x00777777);
- colour_option_from_pen(SELECTPEN, NSOPTION_sys_colour_Highlight, screen, 0x00ee0000);
- colour_option_from_pen(SELECTTEXTPEN, NSOPTION_sys_colour_HighlightText, screen, 0x00000000);
- colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveBorder, screen, 0x00000000);
- colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_InactiveCaption, screen, 0x00ffffff);
- colour_option_from_pen(INACTIVEFILLTEXTPEN, NSOPTION_sys_colour_InactiveCaptionText, screen, 0x00cccccc);
- colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_InfoBackground, screen, 0x00aaaaaa);/* This is wrong, HelpHint backgrounds are pale yellow but doesn't seem to be a DrawInfo pen defined for it. */
- colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_InfoText, screen, 0x00000000);
- colour_option_from_pen(MENUBACKGROUNDPEN, NSOPTION_sys_colour_Menu, screen, 0x00aaaaaa);
- colour_option_from_pen(MENUTEXTPEN, NSOPTION_sys_colour_MenuText, screen, 0x00000000);
- colour_option_from_pen(AMINS_SCROLLERPEN, NSOPTION_sys_colour_Scrollbar, screen, 0x00aaaaaa);
- colour_option_from_pen(FORESHADOWPEN, NSOPTION_sys_colour_ThreeDDarkShadow, screen, 0x00555555);
- colour_option_from_pen(FOREGROUNDPEN, NSOPTION_sys_colour_ThreeDFace, screen, 0x00dddddd);
- colour_option_from_pen(FORESHINEPEN, NSOPTION_sys_colour_ThreeDHighlight, screen, 0x00aaaaaa);
- colour_option_from_pen(HALFSHINEPEN, NSOPTION_sys_colour_ThreeDLightShadow, screen, 0x00999999);
- colour_option_from_pen(HALFSHADOWPEN, NSOPTION_sys_colour_ThreeDShadow, screen, 0x00777777);
- colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Window, screen, 0x00aaaaaa);
- colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, screen, 0x00000000);
- colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_WindowText, screen, 0x00000000);
-#else
- nsoption_default_set_int(redraw_tile_size_x, 100);
- nsoption_default_set_int(redraw_tile_size_y, 100);
-#endif
-}
-
-
-/**
- * Set option defaults for amiga frontend
- *
- * @param defaults The option table to update.
- * @return error status.
- */
-static nserror ami_set_options(struct nsoption_s *defaults)
-{
- STRPTR tempacceptlangs;
- char temp[1024];
-
- /* The following line disables the popupmenu.class select menu.
- ** It's not recommended to use it!
- */
- nsoption_set_bool(core_select_menu, true);
-
- /* ClickTab < 53 doesn't work with the auto show/hide tab-bar (for reasons forgotten) */
- if(ClickTabBase->lib_Version < 53)
- nsoption_set_bool(tab_always_show, true);
-
- /* Some AmigaOS3 overrides */
-#ifndef __amigaos4__
- nsoption_set_bool(download_notify, false);
- nsoption_set_bool(font_antialiasing, false);
- nsoption_set_bool(truecolour_mouse_pointers, false);
- nsoption_set_bool(use_openurl_lib, true);
- nsoption_set_bool(bitmap_fonts, true);
-#endif
-
- if((!nsoption_charp(accept_language)) ||
- (nsoption_charp(accept_language)[0] == '\0') ||
- (nsoption_bool(accept_lang_locale) == true))
- {
- if((tempacceptlangs = ami_locale_langs()))
- {
- nsoption_set_charp(accept_language,
- (char *)strdup(tempacceptlangs));
- FreeVec(tempacceptlangs);
- }
- }
-
- sprintf(temp, "%s/Cookies", current_user_dir);
- nsoption_setnull_charp(cookie_file,
- (char *)strdup(temp));
-
- sprintf(temp, "%s/Hotlist", current_user_dir);
- nsoption_setnull_charp(hotlist_file,
- (char *)strdup(temp));
-
- sprintf(temp, "%s/URLdb", current_user_dir);
- nsoption_setnull_charp(url_file,
- (char *)strdup(temp));
-
- sprintf(temp, "%s/FontGlyphCache", current_user_dir);
- nsoption_setnull_charp(font_unicode_file,
- (char *)strdup(temp));
-
- nsoption_setnull_charp(ca_bundle,
- (char *)strdup("PROGDIR:Resources/ca-bundle"));
-
- /* font defaults */
-#ifdef __amigaos4__
- nsoption_setnull_charp(font_sans, (char *)strdup("DejaVu Sans"));
- nsoption_setnull_charp(font_serif, (char *)strdup("DejaVu Serif"));
- nsoption_setnull_charp(font_mono, (char *)strdup("DejaVu Sans Mono"));
- nsoption_setnull_charp(font_cursive, (char *)strdup("DejaVu Sans"));
- nsoption_setnull_charp(font_fantasy, (char *)strdup("DejaVu Serif"));
-#else
- nsoption_setnull_charp(font_sans, (char *)strdup("helvetica"));
- nsoption_setnull_charp(font_serif, (char *)strdup("times"));
- nsoption_setnull_charp(font_mono, (char *)strdup("topaz"));
- nsoption_setnull_charp(font_cursive, (char *)strdup("garnet"));
- nsoption_setnull_charp(font_fantasy, (char *)strdup("emerald"));
-/* Default CG fonts for OS3 - these work with use_diskfont both on and off,
- however they are slow in both cases. The bitmap fonts don't work when
- use_diskfont is off. The bitmap fonts performance on 68k is far superior,
- so default to those for now whilst testing.
- \todo maybe add some buttons to the prefs GUI to toggle?
- nsoption_setnull_charp(font_sans, (char *)strdup("CGTriumvirate"));
- nsoption_setnull_charp(font_serif, (char *)strdup("CGTimes"));
- nsoption_setnull_charp(font_mono, (char *)strdup("LetterGothic"));
- nsoption_setnull_charp(font_cursive, (char *)strdup("CGTriumvirate"));
- nsoption_setnull_charp(font_fantasy, (char *)strdup("CGTimes"));
-*/
-#endif
-
- if (nsoption_charp(font_unicode) == NULL)
- {
- BPTR lock = 0;
- /* Search for some likely candidates */
-
- if((lock = Lock("FONTS:Code2000.otag", ACCESS_READ)))
- {
- UnLock(lock);
- nsoption_set_charp(font_unicode,
- (char *)strdup("Code2000"));
- }
- else if((lock = Lock("FONTS:Bitstream Cyberbit.otag", ACCESS_READ)))
- {
- UnLock(lock);
- nsoption_set_charp(font_unicode,
- (char *)strdup("Bitstream Cyberbit"));
- }
- }
-
- if (nsoption_charp(font_surrogate) == NULL) {
- BPTR lock = 0;
- /* Search for some likely candidates -
- * Ideally we should pick a font during the scan process which announces it
- * contains UCR_SURROGATES, but nothing appears to have the tag.
- */
- if((lock = Lock("FONTS:Symbola.otag", ACCESS_READ))) {
- UnLock(lock);
- nsoption_set_charp(font_surrogate,
- (char *)strdup("Symbola"));
- }
- }
-
- return NSERROR_OK;
-}
-
-static void ami_amiupdate(void)
-{
- /* Create AppPath location for AmiUpdate use */
-
- BPTR lock = 0;
-
- if(((lock = Lock("ENVARC:AppPaths",SHARED_LOCK)) == 0))
- {
- lock = CreateDir("ENVARC:AppPaths");
- }
-
- UnLock(lock);
-
- if((lock = Lock("PROGDIR:", ACCESS_READ)))
- {
- char filename[1024];
- BPTR amiupdatefh;
-
- DevNameFromLock(lock, (STRPTR)&filename, 1024L, DN_FULLPATH);
-
- if((amiupdatefh = FOpen("ENVARC:AppPaths/NetSurf", MODE_NEWFILE, 0))) {
- FPuts(amiupdatefh, (CONST_STRPTR)&filename);
- FClose(amiupdatefh);
- }
-
- UnLock(lock);
- }
-}
-
-static nsurl *gui_get_resource_url(const char *path)
-{
- char buf[1024];
- char path2[1024];
- nsurl *url = NULL;
-
- if(ami_locate_resource(buf, path) == false)
- {
- if((strncmp(path + strlen(path) - SLEN(".htm"), ".htm", SLEN(".htm")) == 0) ||
- (strncmp(path + strlen(path) - SLEN(".html"), ".html", SLEN(".html")) == 0))
- {
- /* Try with RISC OS HTML filetype, might work */
- strcpy(path2, path);
- strcat(path2, ",faf");
-
- if(ami_locate_resource(buf, path2) == false)
- {
- return NULL;
- }
- }
- else return NULL;
- }
-
- netsurf_path_to_nsurl(buf, &url);
-
- return url;
-}
-
-HOOKF(void, ami_gui_newprefs_hook, APTR, window, APTR)
-{
- ami_set_screen_defaults(scrn);
-}
-
-static void ami_openscreen(void)
-{
- ULONG id = 0;
- ULONG compositing;
-
- if (nsoption_int(screen_compositing) == -1)
- compositing = ~0UL;
- else compositing = nsoption_int(screen_compositing);
-
- if (nsoption_charp(pubscreen_name) == NULL)
- {
- if((nsoption_charp(screen_modeid)) &&
- (strncmp(nsoption_charp(screen_modeid), "0x", 2) == 0))
- {
- id = strtoul(nsoption_charp(screen_modeid), NULL, 0);
- }
- else
- {
- struct ScreenModeRequester *screenmodereq = NULL;
-
- if((screenmodereq = AllocAslRequest(ASL_ScreenModeRequest,NULL))) {
- if(AslRequestTags(screenmodereq,
- ASLSM_MinDepth, 0,
- ASLSM_MaxDepth, 32,
- TAG_DONE))
- {
- char *modeid = malloc(20);
- id = screenmodereq->sm_DisplayID;
- sprintf(modeid, "0x%lx", id);
- nsoption_set_charp(screen_modeid, modeid);
- nsoption_write(current_user_options, NULL, NULL);
- }
- FreeAslRequest(screenmodereq);
- }
- }
-
- if(screen_signal == -1) screen_signal = AllocSignal(-1);
- LOG("Screen signal %d", screen_signal);
- scrn = OpenScreenTags(NULL,
- /**\todo specify screen depth */
- SA_DisplayID, id,
- SA_Title, ami_gui_get_screen_title(),
- SA_Type, PUBLICSCREEN,
- SA_PubName, "NetSurf",
- SA_PubSig, screen_signal,
- SA_PubTask, FindTask(0),
- SA_LikeWorkbench, TRUE,
- SA_Compositing, compositing,
- TAG_DONE);
-
- if(scrn)
- {
- PubScreenStatus(scrn,0);
- }
- else
- {
- FreeSignal(screen_signal);
- screen_signal = -1;
-
- if((scrn = LockPubScreen("NetSurf")))
- {
- locked_screen = TRUE;
- }
- else
- {
- nsoption_set_charp(pubscreen_name,
- strdup("Workbench"));
- }
- }
- }
-
- if (nsoption_charp(pubscreen_name) != NULL)
- {
- scrn = LockPubScreen(nsoption_charp(pubscreen_name));
-
- if(scrn == NULL)
- {
- scrn = LockPubScreen("Workbench");
- }
- locked_screen = TRUE;
- }
-
- ami_font_setdevicedpi(id);
- ami_set_screen_defaults(scrn);
- ami_help_new_screen(scrn);
-}
-
-static void ami_openscreenfirst(void)
-{
- ami_openscreen();
- if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0, false);
- ami_theme_throbber_setup();
-}
-
-static struct RDArgs *ami_gui_commandline(int *argc, char **argv, int *nargc, char **nargv)
-{
- int new_argc = 1;
- struct RDArgs *args;
- CONST_STRPTR template = "-v/S,NSOPTS/M,URL/K,USERSDIR/K,FORCE/S";
- long rarray[] = {0,0,0,0,0};
- enum
- {
- A_VERBOSE, /* ignored */
- A_NSOPTS, /* ignored */
- A_URL,
- A_USERSDIR,
- A_FORCE
- };
-
- if(*argc == 0) return NULL; // argc==0 is started from wb
-
- if((args = ReadArgs(template, rarray, NULL))) {
- if(rarray[A_URL]) {
- LOG("URL %s specified on command line", rarray[A_URL]);
- temp_homepage_url = ami_to_utf8_easy((char *)rarray[A_URL]);
- }
-
- if(rarray[A_USERSDIR]) {
- LOG("USERSDIR %s specified on command line", rarray[A_USERSDIR]);
- users_dir = ASPrintf("%s", rarray[A_USERSDIR]);
- }
-
- if(rarray[A_FORCE]) {
- LOG("FORCE specified on command line");
- cli_force = true;
- }
-
- if(rarray[A_NSOPTS]) {
- /* The NSOPTS/M parameter specified in the ReadArgs template is
- * special. The /M means it collects all arguments that can't
- * be assigned to any other parameter, and stores them in an
- * array. We collect these and pass them as a fake argc/argv
- * to nsoption_commandline().
- * This trickery is necessary because if ReadArgs() is called
- * first, nsoption_commandline() can no longer parse (fetch?)
- * the arguments. If nsoption_commandline() is called first,
- * then ReadArgs cannot fetch the arguments.
- */
- char **p = (char **)rarray[A_NSOPTS];
-
- do {
- LOG("Arg [%d] assigned to NSOPTS/M by ReadArgs: %s", new_argc, *p);
- new_argc++;
- p++;
- } while(*p != NULL);
-
- const char *new_argv = malloc(sizeof(char *) * new_argc);
- const char **new_argvp = &new_argv;
- p = (char **)rarray[A_NSOPTS];
-
- do {
- *new_argvp = *p;
- new_argvp++;
- p++;
- } while(*p != NULL);
-
- *nargc = new_argc;
- *nargv = new_argv;
- }
- } else {
- LOG("ReadArgs failed to parse command line");
- }
- return args;
-}
-
-static void ami_gui_read_tooltypes(struct WBArg *wbarg)
-{
- struct DiskObject *dobj;
- STRPTR *toolarray;
- char *s;
-
- if((*wbarg->wa_Name) && (dobj = GetDiskObject(wbarg->wa_Name))) {
- toolarray = (STRPTR *)dobj->do_ToolTypes;
-
- if((s = (char *)FindToolType(toolarray,"USERSDIR"))) users_dir = ASPrintf("%s", s);
- if((s = (char *)FindToolType(toolarray,"USER"))) current_user = ASPrintf("%s", s);
-
- FreeDiskObject(dobj);
- }
-}
-
-static void ami_gui_read_all_tooltypes(int argc, char **argv)
-{
- struct WBStartup *WBenchMsg;
- struct WBArg *wbarg;
- char i;
- LONG olddir = -1;
-
- if(argc == 0) { /* Started from WB */
- WBenchMsg = (struct WBStartup *)argv;
- for(i = 0, wbarg = WBenchMsg->sm_ArgList; i < WBenchMsg->sm_NumArgs; i++,wbarg++) {
- olddir =-1;
- if((wbarg->wa_Lock) && (*wbarg->wa_Name))
- olddir = SetCurrentDir(wbarg->wa_Lock);
-
- ami_gui_read_tooltypes(wbarg);
-
- if(olddir !=-1) SetCurrentDir(olddir);
- }
- }
-}
-
-static void gui_init2(int argc, char** argv)
-{
- struct Screen *screen;
- BOOL notalreadyrunning;
- nsurl *url;
- nserror error;
- struct browser_window *bw = NULL;
-
- notalreadyrunning = ami_arexx_init();
-
- /* Treeview init code ends up calling a font function which needs this */
- glob = &browserglob;
-
- /* ...and this ensures the treeview at least gets the WB colour palette to work with */
- if(scrn == NULL) {
- if((screen = LockPubScreen("Workbench"))) {
- ami_set_screen_defaults(screen);
- UnlockPubScreen(NULL, screen);
- }
- } else {
- ami_set_screen_defaults(scrn);
- }
- /**/
-
- ami_hotlist_initialise(nsoption_charp(hotlist_file));
- ami_cookies_initialise();
- ami_global_history_initialise();
- search_web_select_provider(nsoption_int(search_provider));
-
- if (notalreadyrunning &&
- (nsoption_bool(startup_no_window) == false))
- ami_openscreenfirst();
-
- if(temp_homepage_url && notalreadyrunning) {
- error = nsurl_create(temp_homepage_url, &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- }
- free(temp_homepage_url);
- }
-
- if(cli_force == true) {
- notalreadyrunning = TRUE;
- }
-
- if(argc == 0) { // WB
- struct WBStartup *WBenchMsg = (struct WBStartup *)argv;
- struct WBArg *wbarg;
- int first=0,i=0;
- char fullpath[1024];
-
- for(i=0,wbarg=WBenchMsg->sm_ArgList;i<WBenchMsg->sm_NumArgs;i++,wbarg++)
- {
- if(i==0) continue;
- if((wbarg->wa_Lock)&&(*wbarg->wa_Name))
- {
- DevNameFromLock(wbarg->wa_Lock,fullpath,1024,DN_FULLPATH);
- AddPart(fullpath,wbarg->wa_Name,1024);
-
- if(!temp_homepage_url) {
- nsurl *temp_url;
- if (netsurf_path_to_nsurl(fullpath, &temp_url) == NSERROR_OK) {
- temp_homepage_url = strdup(nsurl_access(temp_url));
- nsurl_unref(temp_url);
- }
- }
-
- if(notalreadyrunning)
- {
- error = nsurl_create(temp_homepage_url, &url);
-
- if (error == NSERROR_OK) {
- if(!first)
- {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
-
- first=1;
- }
- else
- {
- error = browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY,
- url,
- NULL,
- bw,
- &bw);
-
- }
- nsurl_unref(url);
-
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- }
- free(temp_homepage_url);
- temp_homepage_url = NULL;
- }
- }
- /* this should be where we read tooltypes, but it's too late for that now */
- }
- }
-
- nsoption_setnull_charp(homepage_url, (char *)strdup(NETSURF_HOMEPAGE));
-
- if(!notalreadyrunning)
- {
- STRPTR sendcmd = NULL;
-
- if(temp_homepage_url)
- {
- sendcmd = ASPrintf("OPEN \"%s\" NEW",temp_homepage_url);
- free(temp_homepage_url);
- }
- else
- {
- sendcmd = ASPrintf("OPEN \"%s\" NEW",nsoption_charp(homepage_url));
- }
- IDoMethod(arexx_obj,AM_EXECUTE,sendcmd,"NETSURF",NULL,NULL,NULL,NULL);
- FreeVec(sendcmd);
-
- ami_quit=true;
- return;
- }
-#ifdef __amigaos4__
- if(IApplication)
- {
- if(argc == 0)
- {
- ULONG noicon = TAG_IGNORE;
-
- if (nsoption_bool(hide_docky_icon))
- noicon = REGAPP_NoIcon;
-
- ami_appid = RegisterApplication(messages_get("NetSurf"),
- REGAPP_URLIdentifier, "netsurf-browser.org",
- REGAPP_WBStartup, (struct WBStartup *)argv,
- noicon, TRUE,
- REGAPP_HasPrefsWindow, TRUE,
- REGAPP_CanCreateNewDocs, TRUE,
- REGAPP_UniqueApplication, TRUE,
- REGAPP_Description, messages_get("NetSurfDesc"),
- TAG_DONE);
- }
- else
- {
-/* TODO: Specify icon when run from Shell */
- ami_appid = RegisterApplication(messages_get("NetSurf"),
- REGAPP_URLIdentifier, "netsurf-browser.org",
- REGAPP_FileName, argv[0],
- REGAPP_NoIcon, TRUE,
- REGAPP_HasPrefsWindow, TRUE,
- REGAPP_CanCreateNewDocs, TRUE,
- REGAPP_UniqueApplication, TRUE,
- REGAPP_Description, messages_get("NetSurfDesc"),
- TAG_DONE);
- }
-
- GetApplicationAttrs(ami_appid, APPATTR_Port, (ULONG)&applibport, TAG_DONE);
- if(applibport) applibsig = (1L << applibport->mp_SigBit);
- }
-#endif
- if(!bw && (nsoption_bool(startup_no_window) == false)) {
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- }
- }
-}
-
-static void ami_update_buttons(struct gui_window_2 *gwin)
-{
- long back=FALSE, forward=FALSE, tabclose=FALSE, stop=FALSE, reload=FALSE;
- long s_back, s_forward, s_tabclose, s_stop, s_reload;
-
- if(!browser_window_back_available(gwin->gw->bw))
- back=TRUE;
-
- if(!browser_window_forward_available(gwin->gw->bw))
- forward=TRUE;
-
- if(!browser_window_stop_available(gwin->gw->bw))
- stop=TRUE;
-
- if(!browser_window_reload_available(gwin->gw->bw))
- reload=TRUE;
-
- if(nsoption_bool(kiosk_mode) == false)
- {
- if(gwin->tabs <= 1)
- {
- tabclose=TRUE;
- OffMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- else
- {
- OnMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- }
-
-#ifdef __amigaos4__
- GetAttr(GA_Disabled, gwin->objects[GID_BACK], (uint32 *)&s_back);
- GetAttr(GA_Disabled, gwin->objects[GID_FORWARD], (uint32 *)&s_forward);
- GetAttr(GA_Disabled, gwin->objects[GID_RELOAD], (uint32 *)&s_reload);
- GetAttr(GA_Disabled, gwin->objects[GID_STOP], (uint32 *)&s_stop);
-#endif
-
- if(BOOL_MISMATCH(s_back, back))
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_BACK],
- gwin->win, NULL, GA_Disabled, back, TAG_DONE);
-
- if(BOOL_MISMATCH(s_forward, forward))
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_FORWARD],
- gwin->win, NULL, GA_Disabled, forward, TAG_DONE);
-
- if(BOOL_MISMATCH(s_reload, reload))
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_RELOAD],
- gwin->win, NULL, GA_Disabled, reload, TAG_DONE);
-
- if(BOOL_MISMATCH(s_stop, stop))
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_STOP],
- gwin->win, NULL, GA_Disabled, stop, TAG_DONE);
-
- if(ClickTabBase->lib_Version < 53) {
- if(gwin->tabs <= 1) tabclose = TRUE;
-#ifdef __amigaos4__
- GetAttr(GA_Disabled, gwin->objects[GID_CLOSETAB], (uint32 *)&s_tabclose);
-#endif
- if(BOOL_MISMATCH(s_tabclose, tabclose))
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_CLOSETAB],
- gwin->win, NULL, GA_Disabled, tabclose, TAG_DONE);
- }
-
- /* Update the back/forward buttons history context menu */
- ami_ctxmenu_history_create(AMI_CTXMENU_HISTORY_BACK, gwin);
- ami_ctxmenu_history_create(AMI_CTXMENU_HISTORY_FORWARD, gwin);
-}
-
-void ami_gui_history(struct gui_window_2 *gwin, bool back)
-{
- if(back == true)
- {
- if(browser_window_back_available(gwin->gw->bw))
- browser_window_history_back(gwin->gw->bw, false);
- }
- else
- {
- if(browser_window_forward_available(gwin->gw->bw))
- browser_window_history_forward(gwin->gw->bw, false);
- }
-
- ami_update_buttons(gwin);
-}
-
-int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie)
-{
- int nskey = 0, chars;
- char buffer[20];
- char *utf8 = NULL;
-
- if(keycode >= IECODE_UP_PREFIX) return 0;
-
- switch(keycode)
- {
- case RAWKEY_CRSRUP:
- if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
- {
- nskey = NS_KEY_PAGE_UP;
- }
- else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
- {
- nskey = NS_KEY_TEXT_START;
- }
- else nskey = NS_KEY_UP;
- break;
- case RAWKEY_CRSRDOWN:
- if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
- {
- nskey = NS_KEY_PAGE_DOWN;
- }
- else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
- {
- nskey = NS_KEY_TEXT_END;
- }
- else nskey = NS_KEY_DOWN;
- break;
- case RAWKEY_CRSRLEFT:
- if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
- {
- nskey = NS_KEY_LINE_START;
- }
- else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
- {
- nskey = NS_KEY_WORD_LEFT;
- }
- else nskey = NS_KEY_LEFT;
- break;
- case RAWKEY_CRSRRIGHT:
- if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
- {
- nskey = NS_KEY_LINE_END;
- }
- else if(ie->ie_Qualifier & IEQUALIFIER_RALT)
- {
- nskey = NS_KEY_WORD_RIGHT;
- }
- else nskey = NS_KEY_RIGHT;
- break;
- case RAWKEY_ESC:
- nskey = NS_KEY_ESCAPE;
- break;
- case RAWKEY_PAGEUP:
- nskey = NS_KEY_PAGE_UP;
- break;
- case RAWKEY_PAGEDOWN:
- nskey = NS_KEY_PAGE_DOWN;
- break;
- case RAWKEY_HOME:
- nskey = NS_KEY_TEXT_START;
- break;
- case RAWKEY_END:
- nskey = NS_KEY_TEXT_END;
- break;
- case RAWKEY_BACKSPACE:
- if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
- {
- nskey = NS_KEY_DELETE_LINE_START;
- }
- else nskey = NS_KEY_DELETE_LEFT;
- break;
- case RAWKEY_DEL:
- if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
- {
- nskey = NS_KEY_DELETE_LINE_END;
- }
- else nskey = NS_KEY_DELETE_RIGHT;
- break;
- case RAWKEY_TAB:
- if(ie->ie_Qualifier & IEQUALIFIER_RSHIFT)
- {
- nskey = NS_KEY_SHIFT_TAB;
- }
- else nskey = NS_KEY_TAB;
- break;
- case RAWKEY_F5:
- case RAWKEY_F8:
- case RAWKEY_F9:
- case RAWKEY_F10:
- case RAWKEY_HELP:
- // don't translate
- nskey = keycode;
- break;
- default:
- if((chars = MapRawKey(ie,buffer,20,NULL)) > 0) {
- utf8_from_local_encoding(buffer, chars, &utf8);
- nskey = utf8_to_ucs4(utf8, utf8_char_byte_length(utf8));
-
- if(ie->ie_Qualifier & IEQUALIFIER_RCOMMAND) {
- switch(nskey) {
- case 'a':
- nskey = NS_KEY_SELECT_ALL;
- break;
- case 'c':
- nskey = NS_KEY_COPY_SELECTION;
- break;
- case 'v':
- nskey = NS_KEY_PASTE;
- break;
- case 'x':
- nskey = NS_KEY_CUT_SELECTION;
- break;
- case 'y':
- nskey = NS_KEY_REDO;
- break;
- case 'z':
- nskey = NS_KEY_UNDO;
- break;
- }
- }
- }
- break;
- }
-
- return nskey;
-}
-
-static void ami_update_quals(struct gui_window_2 *gwin)
-{
- uint32 quals = 0;
-#ifdef __amigaos4__
- GetAttr(WINDOW_Qualifier,gwin->objects[OID_MAIN],(uint32 *)&quals);
-#else
-#warning qualifier needs fixing for OS3
-#endif
- gwin->key_state = 0;
-
- if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT))
- {
- gwin->key_state |= BROWSER_MOUSE_MOD_1;
- }
-
- if(quals & IEQUALIFIER_CONTROL)
- {
- gwin->key_state |= BROWSER_MOUSE_MOD_2;
- }
-
- if((quals & IEQUALIFIER_LALT) || (quals & IEQUALIFIER_RALT))
- {
- gwin->key_state |= BROWSER_MOUSE_MOD_3;
- }
-}
-
-/* exported interface documented in amiga/gui.h */
-nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox)
-{
-#ifdef __amigaos4__
- if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- *bbox = AllocVecTagList(sizeof(struct IBox), NULL);
- if(*bbox == NULL) return NSERROR_NOMEM;
- GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox);
- } else
-#endif
- {
- GetAttr(SPACE_AreaBox, obj, (ULONG *)bbox);
- }
-
- return NSERROR_OK;
-}
-
-/* exported interface documented in amiga/gui.h */
-void ami_gui_free_space_box(struct IBox *bbox)
-{
-#ifdef __amigaos4__
- if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- FreeVec(bbox);
- }
-#endif
-}
-
-static bool ami_spacebox_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y,
- int space_x, int space_y)
-{
- int ns_x = space_x;
- int ns_y = space_y;
-
- ns_x /= gwin->gw->scale;
- ns_y /= gwin->gw->scale;
-
- ns_x += gwin->gw->scrollx;
- ns_y += gwin->gw->scrolly;
-
- *x = ns_x;
- *y = ns_y;
-
- return true;
-}
-
-bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y,
- int mouse_x, int mouse_y)
-{
- int ns_x, ns_y;
- struct IBox *bbox;
-
- if(mouse_x == -1) mouse_x = gwin->win->MouseX;
- if(mouse_y == -1) mouse_y = gwin->win->MouseY;
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) == NSERROR_OK) {
- ns_x = (ULONG)(mouse_x - bbox->Left);
- ns_y = (ULONG)(mouse_y - bbox->Top);
-
- if((ns_x < 0) || (ns_x > bbox->Width) || (ns_y < 0) || (ns_y > bbox->Height))
- return false;
-
- ami_gui_free_space_box(bbox);
- } else {
- amiga_warn_user("NoMemory", "");
- return false;
- }
-
- return ami_spacebox_to_ns_coords(gwin, x, y, ns_x, ns_y);
-}
-
-static void ami_gui_scroll_internal(struct gui_window_2 *gwin, int xs, int ys)
-{
- struct IBox *bbox;
- int x, y;
-
- if(ami_mouse_to_ns_coords(gwin, &x, &y, -1, -1) == true)
- {
- if(browser_window_scroll_at_point(gwin->gw->bw, x, y,
- xs, ys) == false)
- {
- int width, height;
-
- gui_window_get_scroll(gwin->gw,
- &gwin->gw->scrollx,
- &gwin->gw->scrolly);
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- browser_window_get_extents(gwin->gw->bw, false, &width, &height);
-
- switch(xs)
- {
- case SCROLL_PAGE_UP:
- xs = gwin->gw->scrollx - bbox->Width;
- break;
-
- case SCROLL_PAGE_DOWN:
- xs = gwin->gw->scrollx + bbox->Width;
- break;
-
- case SCROLL_TOP:
- xs = 0;
- break;
-
- case SCROLL_BOTTOM:
- xs = width;
- break;
-
- default:
- xs += gwin->gw->scrollx;
- break;
- }
-
- switch(ys)
- {
- case SCROLL_PAGE_UP:
- ys = gwin->gw->scrolly - bbox->Height;
- break;
-
- case SCROLL_PAGE_DOWN:
- ys = gwin->gw->scrolly + bbox->Height;
- break;
-
- case SCROLL_TOP:
- ys = 0;
- break;
-
- case SCROLL_BOTTOM:
- ys = height;
- break;
-
- default:
- ys += gwin->gw->scrolly;
- break;
- }
-
- ami_gui_free_space_box(bbox);
-
- gui_window_set_scroll(gwin->gw, xs, ys);
- }
- }
-}
-
-static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct rect *rect)
-{
- struct IBox *bbox, *ibox;
-
- ibox = AllocVecTagList(sizeof(struct IBox), NULL);
- if(ibox == NULL) return NULL;
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return NULL;
- }
-
- ibox->Left = gwin->win->MouseX + (rect->x0 * gwin->gw->scale);
- ibox->Top = gwin->win->MouseY + (rect->y0 * gwin->gw->scale);
-
- ibox->Width = (rect->x1 - rect->x0) * gwin->gw->scale;
- ibox->Height = (rect->y1 - rect->y0) * gwin->gw->scale;
-
- if(ibox->Left < bbox->Left) ibox->Left = bbox->Left;
- if(ibox->Top < bbox->Top) ibox->Top = bbox->Top;
-
- if((ibox->Left > (bbox->Left + bbox->Width)) ||
- (ibox->Top > (bbox->Top + bbox->Height)) ||
- (ibox->Width < 0) || (ibox->Height < 0))
- {
- FreeVec(ibox);
- ami_gui_free_space_box(bbox);
- return NULL;
- }
-
- ami_gui_free_space_box(bbox);
- return ibox;
-}
-
-static void ami_gui_trap_mouse(struct gui_window_2 *gwin)
-{
-#ifdef __amigaos4__
- switch(gwin->drag_op)
- {
- case GDRAGGING_NONE:
- case GDRAGGING_SCROLLBAR:
- case GDRAGGING_OTHER:
- break;
-
- default:
- if(gwin->ptr_lock)
- {
- SetWindowAttrs(gwin->win, WA_GrabFocus, 10,
- WA_MouseLimits, gwin->ptr_lock, TAG_DONE);
- }
- break;
- }
-#endif
-}
-
-static 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));
-}
-
-static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
- bool scaled)
-{
- struct IBox *bbox;
- if(!g) return;
-
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- *width = bbox->Width;
- *height = bbox->Height;
-
- ami_gui_free_space_box(bbox);
-
- if(scaled)
- {
- *width /= g->scale;
- *height /= g->scale;
- }
-}
-
-/* Add a horizontal scroller, if not already present
- * Returns true if changed, false otherwise */
-static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
-{
- struct TagItem attrs[2];
-
- if(gwin->objects[GID_HSCROLL] != NULL) return false;
-
- attrs[0].ti_Tag = CHILD_MinWidth;
- attrs[0].ti_Data = 0;
- attrs[1].ti_Tag = TAG_DONE;
- attrs[1].ti_Data = 0;
-
- gwin->objects[GID_HSCROLL] = ScrollerObj,
- GA_ID, GID_HSCROLL,
- GA_RelVerify, TRUE,
- SCROLLER_Orientation, SORIENT_HORIZ,
- ICA_TARGET, ICTARGET_IDCMP,
- ScrollerEnd;
-#ifdef __amigaos4__
- IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_ADDCHILD,
- gwin->win, gwin->objects[GID_HSCROLL], attrs);
-#else
- SetAttrs(gwin->objects[GID_HSCROLLLAYOUT],
- LAYOUT_AddChild, gwin->objects[GID_HSCROLL], TAG_MORE, &attrs);
-#endif
- return true;
-}
-
-/* Remove the horizontal scroller, if present */
-static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin)
-{
- if(gwin->objects[GID_HSCROLL] == NULL) return false;
-
-#ifdef __amigaos4__
- IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD,
- gwin->win, gwin->objects[GID_HSCROLL]);
-#else
- SetAttrs(gwin->objects[GID_HSCROLLLAYOUT], LAYOUT_RemoveChild, gwin->objects[GID_HSCROLL]);
-#endif
-
- gwin->objects[GID_HSCROLL] = NULL;
-
- return true;
-}
-
-/* Add a vertical scroller, if not already present
- * Returns true if changed, false otherwise */
-static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
-{
- struct TagItem attrs[2];
-
- if(gwin->objects[GID_VSCROLL] != NULL) return false;
-
- attrs[0].ti_Tag = CHILD_MinWidth;
- attrs[0].ti_Data = 0;
- attrs[1].ti_Tag = TAG_DONE;
- attrs[1].ti_Data = 0;
-
- gwin->objects[GID_VSCROLL] = ScrollerObj,
- GA_ID, GID_VSCROLL,
- GA_RelVerify, TRUE,
- ICA_TARGET, ICTARGET_IDCMP,
- ScrollerEnd;
-#ifdef __amigaos4__
- IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_ADDCHILD,
- gwin->win, gwin->objects[GID_VSCROLL], attrs);
-#else
- SetAttrs(gwin->objects[GID_VSCROLLLAYOUT],
- LAYOUT_AddChild, gwin->objects[GID_VSCROLL], TAG_MORE, &attrs);
-#endif
- return true;
-}
-
-/* Remove the vertical scroller, if present */
-static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin)
-{
- if(gwin->objects[GID_VSCROLL] == NULL) return false;
-
-#ifdef __amigaos4__
- IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_REMOVECHILD,
- gwin->win, gwin->objects[GID_VSCROLL]);
-#else
- SetAttrs(gwin->objects[GID_VSCROLLLAYOUT], LAYOUT_RemoveChild, gwin->objects[GID_VSCROLL]);
-#endif
-
- gwin->objects[GID_VSCROLL] = NULL;
-
- return true;
-}
-
-/**
- * Check the scroll bar requirements for a browser window, and add/remove
- * the vertical scroller as appropriate. This should be the main entry
- * point used to perform this task.
- *
- * \param gwin "Shared" GUI window to check the state of
- */
-static void ami_gui_scroller_update(struct gui_window_2 *gwin)
-{
- int h = 1, w = 1, wh = 0, ww = 0;
- bool rethinkv = false;
- bool rethinkh = false;
- browser_scrolling hscroll = BW_SCROLLING_YES;
- browser_scrolling vscroll = BW_SCROLLING_YES;
-
- browser_window_get_scrollbar_type(gwin->gw->bw, &hscroll, &vscroll);
-
- if(browser_window_is_frameset(gwin->gw->bw) == true) {
- rethinkv = ami_gui_vscroll_remove(gwin);
- rethinkh = ami_gui_hscroll_remove(gwin);
- } else {
- if((browser_window_get_extents(gwin->gw->bw, false, &w, &h) == NSERROR_OK)) {
- gui_window_get_dimensions(gwin->gw, &ww, &wh, false);
- }
-
- if(vscroll == BW_SCROLLING_NO) {
- rethinkv = ami_gui_vscroll_remove(gwin);
- } else {
- if (h > wh) rethinkv = ami_gui_vscroll_add(gwin);
- else rethinkv = ami_gui_vscroll_remove(gwin);
- }
-
- if(hscroll == BW_SCROLLING_NO) {
- rethinkh = ami_gui_hscroll_remove(gwin);
- } else {
- if (w > ww) rethinkh = ami_gui_hscroll_add(gwin);
- else rethinkh = ami_gui_hscroll_remove(gwin);
- }
- }
-
- if(rethinkv || rethinkh) {
- FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
- RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
- gwin->win, NULL, TRUE);
- browser_window_schedule_reformat(gwin->gw->bw);
- }
-}
-
-/**
- * function to add retrieved favicon to gui
- */
-static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
-{
- struct BitMap *bm = NULL;
- struct IBox *bbox;
- struct bitmap *icon_bitmap = NULL;
-
- if(nsoption_bool(kiosk_mode) == true) return;
- if(!g) return;
-
- if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) != NULL))
- {
- bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
- g->shared->win->RPort->BitMap);
- }
-
- if(g == g->shared->gw) {
- RefreshGList((struct Gadget *)g->shared->objects[GID_ICON],
- g->shared->win, NULL, 1);
-
- if(bm)
- {
- ULONG tag, tag_data, minterm;
-
- if(ami_plot_screen_is_palettemapped() == false) {
- tag = BLITA_UseSrcAlpha;
- tag_data = !amiga_bitmap_get_opaque(icon_bitmap);
- minterm = 0xc0;
- } else {
- tag = BLITA_MaskPlane;
- tag_data = (ULONG)ami_bitmap_get_mask(icon_bitmap, 16, 16, bm);
- minterm = MINTERM_SRCMASK;
- }
-
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_ICON], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- EraseRect(g->shared->win->RPort, bbox->Left, bbox->Top,
- bbox->Left + 16, bbox->Top + 16);
-
-#ifdef __amigaos4__
- BltBitMapTags(BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_DestX, bbox->Left,
- BLITA_DestY, bbox->Top,
- BLITA_Width, 16,
- BLITA_Height, 16,
- BLITA_Source, bm,
- BLITA_Dest, g->shared->win->RPort,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_DestType, BLITT_RASTPORT,
- BLITA_Minterm, minterm,
- tag, tag_data,
- TAG_DONE);
-#else
- if(tag_data) {
- BltMaskBitMapRastPort(bm, 0, 0, g->shared->win->RPort,
- bbox->Left, bbox->Top, 16, 16, minterm, tag_data);
- } else {
- BltBitMapRastPort(bm, 0, 0, g->shared->win->RPort,
- bbox->Left, bbox->Top, 16, 16, 0xc0);
- }
-#endif
- ami_gui_free_space_box(bbox);
- }
- }
-
- g->favicon = icon;
-}
-
-static void ami_gui_refresh_favicon(void *p)
-{
- struct gui_window_2 *gwin = (struct gui_window_2 *)p;
- gui_window_set_icon(gwin->gw, gwin->gw->favicon);
-}
-
-/* Gets the size that border gadget 1 (status) needs to be.
- * Returns the width of the size gadget as a convenience.
- */
-#ifdef __amigaos4__
-static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height)
-{
- static ULONG sz_gad_width = 0;
- static ULONG sz_gad_height = 0;
- ULONG available_width;
-
- if((sz_gad_width == 0) || (sz_gad_height == 0)) {
- struct DrawInfo *dri = GetScreenDrawInfo(scrn);
- GetGUIAttrs(NULL, dri,
- GUIA_SizeGadgetWidth, &sz_gad_width,
- GUIA_SizeGadgetHeight, &sz_gad_height,
- TAG_DONE);
- FreeScreenDrawInfo(scrn, dri);
- }
- available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width;
-
- *width = available_width;
- *height = sz_gad_height;
-
- return sz_gad_width;
-}
-#endif
-
-static void ami_set_border_gadget_size(struct gui_window_2 *gwin)
-{
-#ifdef __amigaos4__
- /* Reset gadget widths according to new calculation */
- ULONG size1, size2;
-
- ami_get_border_gadget_size(gwin, &size1, &size2);
-
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_STATUS],
- gwin->win, NULL,
- GA_Width, size1,
- TAG_DONE);
-
- RefreshWindowFrame(gwin->win);
-#endif
-}
-
-static void ami_handle_msg(void)
-{
- ULONG result,storage = 0,x,y,xs,ys,width=800,height=600;
- uint16 code;
- struct IBox *bbox;
- struct nsObject *node;
- struct nsObject *nnode;
- struct gui_window_2 *gwin = NULL;
- struct InputEvent *ie;
- struct Node *tabnode;
- int nskey;
- struct timeval curtime;
- static int drag_x_move = 0, drag_y_move = 0;
- char *utf8 = NULL;
- nsurl *url;
-
- if(IsMinListEmpty(window_list))
- {
- /* no windows in list, so NetSurf should not be running */
- ami_try_quit();
- return;
- }
-
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- gwin = node->objstruct;
-
- if(node->Type == AMINS_TVWINDOW) {
- if(ami_tree_event((struct treeview_window *)gwin)) {
- ami_try_quit();
- break;
- } else {
- node = nnode;
- continue;
- }
- } else if(node->Type == AMINS_FINDWINDOW) {
- if(ami_search_event()) {
- ami_try_quit();
- break;
- } else {
- node = nnode;
- continue;
- }
- } else if(node->Type == AMINS_HISTORYWINDOW) {
- if(ami_history_event((struct history_window *)gwin)) {
- ami_try_quit();
- break;
- } else {
- node = nnode;
- continue;
- }
- } else if(node->Type == AMINS_PRINTWINDOW) {
- if(ami_print_event((struct ami_print_window *)gwin)) {
- ami_try_quit();
- break;
- } else {
- node = nnode;
- continue;
- }
- } else if(node->Type == AMINS_GUIOPTSWINDOW) {
- if(ami_gui_opts_event()) {
- /* last window possibly closed, so exit with conditions ;) */
- if(scrn) ami_try_quit();
- break;
- } else {
- node = nnode;
- continue;
- }
- } else if(node->Type == AMINS_DLWINDOW) {
- if(ami_download_window_event((struct gui_download_window *)gwin)) {
- ami_try_quit();
- break;
- } else {
- node = nnode;
- continue;
- }
- } else if(node->Type == AMINS_LOGINWINDOW) {
- if(ami_401login_event((struct gui_login_window *)gwin)) {
- ami_try_quit();
- break;
- } else {
- node = nnode;
- continue;
- }
- }
-
- if((gwin == NULL) || (gwin->objects[OID_MAIN] == NULL)) continue;
-
- while((result = RA_HandleInput(gwin->objects[OID_MAIN], &code)) != WMHI_LASTMSG) {
- switch(result & WMHI_CLASSMASK) // class
- {
- case WMHI_MOUSEMOVE:
- ami_gui_trap_mouse(gwin); /* re-assert mouse area */
-
- drag_x_move = 0;
- drag_y_move = 0;
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- break;
- }
-
- x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->scale);
- y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->scale);
-
- ami_get_hscroll_pos(gwin, (ULONG *)&xs);
- ami_get_vscroll_pos(gwin, (ULONG *)&ys);
-
- x += xs;
- y += ys;
-
- width=bbox->Width;
- height=bbox->Height;
-
- if(gwin->mouse_state & BROWSER_MOUSE_DRAG_ON)
- {
- ami_drag_icon_move();
-
- if(ami_autoscroll == TRUE) {
- if((gwin->win->MouseX < bbox->Left) &&
- ((gwin->win->MouseX - bbox->Left) > -AMI_DRAG_THRESHOLD))
- drag_x_move = gwin->win->MouseX - bbox->Left;
- if((gwin->win->MouseX > (bbox->Left + bbox->Width)) &&
- ((gwin->win->MouseX - (bbox->Left + bbox->Width)) < AMI_DRAG_THRESHOLD))
- drag_x_move = gwin->win->MouseX - (bbox->Left + bbox->Width);
- if((gwin->win->MouseY < bbox->Top) &&
- ((gwin->win->MouseY - bbox->Top) > -AMI_DRAG_THRESHOLD))
- drag_y_move = gwin->win->MouseY - bbox->Top;
- if((gwin->win->MouseY > (bbox->Top + bbox->Height)) &&
- ((gwin->win->MouseY - (bbox->Top + bbox->Height)) < AMI_DRAG_THRESHOLD))
- drag_y_move = gwin->win->MouseY - (bbox->Top + bbox->Height);
- }
- }
-
- ami_gui_free_space_box(bbox);
-
- if((x>=xs) && (y>=ys) && (x<width+xs) && (y<height+ys))
- {
- ami_update_quals(gwin);
-
- if(gwin->mouse_state & BROWSER_MOUSE_PRESS_1)
- {
- browser_window_mouse_track(gwin->gw->bw,BROWSER_MOUSE_DRAG_1 | gwin->key_state,x,y);
- gwin->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
- }
- else if(gwin->mouse_state & BROWSER_MOUSE_PRESS_2)
- {
- browser_window_mouse_track(gwin->gw->bw,BROWSER_MOUSE_DRAG_2 | gwin->key_state,x,y);
- gwin->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
- }
- else
- {
- browser_window_mouse_track(gwin->gw->bw,gwin->mouse_state | gwin->key_state,x,y);
- }
- } else {
- if(!gwin->mouse_state) ami_set_pointer(gwin, GUI_POINTER_DEFAULT, true);
- }
- break;
-
- case WMHI_MOUSEBUTTONS:
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->scale);
- y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->scale);
-
- ami_get_hscroll_pos(gwin, (ULONG *)&xs);
- ami_get_vscroll_pos(gwin, (ULONG *)&ys);
-
- x += xs;
- y += ys;
-
- width=bbox->Width;
- height=bbox->Height;
-
- ami_gui_free_space_box(bbox);
-
- ami_update_quals(gwin);
-
- if((x>=xs) && (y>=ys) && (x<width+xs) && (y<height+ys))
- {
- //code = code>>16;
- switch(code)
- {
- case SELECTDOWN:
- browser_window_mouse_click(gwin->gw->bw,BROWSER_MOUSE_PRESS_1 | gwin->key_state,x,y);
- gwin->mouse_state=BROWSER_MOUSE_PRESS_1;
- break;
- case MIDDLEDOWN:
- browser_window_mouse_click(gwin->gw->bw,BROWSER_MOUSE_PRESS_2 | gwin->key_state,x,y);
- gwin->mouse_state=BROWSER_MOUSE_PRESS_2;
- break;
- }
- }
-
- if(x<xs) x=xs;
- if(y<ys) y=ys;
- if(x>=width+xs) x=width+xs-1;
- if(y>=height+ys) y=height+ys-1;
-
- switch(code)
- {
- case SELECTUP:
- if(gwin->mouse_state & BROWSER_MOUSE_PRESS_1)
- {
- CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
-
- gwin->mouse_state = BROWSER_MOUSE_CLICK_1;
-
- if(gwin->lastclick.tv_sec)
- {
- if(DoubleClick(gwin->lastclick.tv_sec,
- gwin->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec)) {
- if(gwin->prev_mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
- gwin->mouse_state |= BROWSER_MOUSE_TRIPLE_CLICK;
- } else {
- gwin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
- }
- }
- }
-
- browser_window_mouse_click(gwin->gw->bw,
- gwin->mouse_state | gwin->key_state,x,y);
-
- if(gwin->mouse_state & BROWSER_MOUSE_TRIPLE_CLICK)
- {
- gwin->lastclick.tv_sec = 0;
- gwin->lastclick.tv_usec = 0;
- }
- else
- {
- gwin->lastclick.tv_sec = curtime.tv_sec;
- gwin->lastclick.tv_usec = curtime.tv_usec;
- }
- }
- else
- {
- browser_window_mouse_track(gwin->gw->bw, 0, x, y);
- }
- gwin->prev_mouse_state = gwin->mouse_state;
- gwin->mouse_state=0;
- break;
-
- case MIDDLEUP:
- if(gwin->mouse_state & BROWSER_MOUSE_PRESS_2)
- {
- CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
-
- gwin->mouse_state = BROWSER_MOUSE_CLICK_2;
-
- if(gwin->lastclick.tv_sec)
- {
- if(DoubleClick(gwin->lastclick.tv_sec,
- gwin->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec)) {
- if(gwin->prev_mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
- gwin->mouse_state |= BROWSER_MOUSE_TRIPLE_CLICK;
- } else {
- gwin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
- }
- }
- }
-
- browser_window_mouse_click(gwin->gw->bw,
- gwin->mouse_state | gwin->key_state,x,y);
-
- if(gwin->mouse_state & BROWSER_MOUSE_TRIPLE_CLICK)
- {
- gwin->lastclick.tv_sec = 0;
- gwin->lastclick.tv_usec = 0;
- }
- else
- {
- gwin->lastclick.tv_sec = curtime.tv_sec;
- gwin->lastclick.tv_usec = curtime.tv_usec;
- }
- }
- else
- {
- browser_window_mouse_track(gwin->gw->bw, 0, x, y);
- }
- gwin->prev_mouse_state = gwin->mouse_state;
- gwin->mouse_state=0;
- break;
-#ifdef __amigaos4__
- case SIDEUP:
- ami_gui_history(gwin, true);
- break;
-
- case EXTRAUP:
- ami_gui_history(gwin, false);
- break;
-#endif
- }
-
- if(drag_save_data && !gwin->mouse_state)
- ami_drag_save(gwin->win);
- break;
-
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK)
- {
- case GID_TABS:
- if(gwin->objects[GID_TABS] == NULL) break;
- if(ClickTabBase->lib_Version >= 53) {
- GetAttrs(gwin->objects[GID_TABS],
- CLICKTAB_NodeClosed, &tabnode, TAG_DONE);
- } else {
- tabnode = NULL;
- }
-
- if(tabnode) {
- struct gui_window *closedgw;
-
- GetClickTabNodeAttrs(tabnode,
- TNA_UserData, &closedgw,
- TAG_DONE);
-
- browser_window_destroy(closedgw->bw);
- } else {
- ami_switch_tab(gwin, true);
- }
- break;
-
- case GID_CLOSETAB:
- browser_window_destroy(gwin->gw->bw);
- break;
-
- case GID_ADDTAB:
- ami_gui_new_blank_tab(gwin);
- break;
-
- case GID_URL:
- {
- nserror ret;
- nsurl *url;
- GetAttr(STRINGA_TextVal,
- (Object *)gwin->objects[GID_URL],
- (ULONG *)&storage);
- utf8 = ami_to_utf8_easy((const char *)storage);
-
- ret = search_web_omni(utf8, SEARCH_WEB_OMNI_NONE, &url);
- ami_utf8_free(utf8);
- if (ret == NSERROR_OK) {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (ret != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(ret), 0);
- }
- }
- break;
-
- case GID_TOOLBARLAYOUT:
- /* Need fixing: never gets here */
- search_web_select_provider(-1);
- break;
-
- case GID_SEARCH_ICON:
- GetAttr(CHOOSER_Selected, gwin->objects[GID_SEARCH_ICON], (ULONG *)&storage);
- search_web_select_provider(storage);
- break;
-
- case GID_SEARCHSTRING:
- {
- nserror ret;
- nsurl *url;
-
- GetAttr(STRINGA_TextVal,
- (Object *)gwin->objects[GID_SEARCHSTRING],
- (ULONG *)&storage);
-
- utf8 = ami_to_utf8_easy((const char *)storage);
-
- ret = search_web_omni(utf8, SEARCH_WEB_OMNI_SEARCHONLY, &url);
- ami_utf8_free(utf8);
- if (ret == NSERROR_OK) {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (ret != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(ret), 0);
- }
-
- }
- break;
-
- case GID_HOME:
- {
- if (nsurl_create(nsoption_charp(homepage_url), &url) != NSERROR_OK) {
- amiga_warn_user("NoMemory", 0);
- } else {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- }
- break;
-
- case GID_STOP:
- if(browser_window_stop_available(gwin->gw->bw))
- browser_window_stop(gwin->gw->bw);
- break;
-
- case GID_RELOAD:
- ami_update_quals(gwin);
-
- if(browser_window_reload_available(gwin->gw->bw))
- {
- if(gwin->key_state & BROWSER_MOUSE_MOD_1)
- {
- browser_window_reload(gwin->gw->bw, true);
- }
- else
- {
- browser_window_reload(gwin->gw->bw, false);
- }
- }
- break;
-
- case GID_BACK:
- ami_gui_history(gwin, true);
- break;
-
- case GID_FORWARD:
- ami_gui_history(gwin, false);
- break;
-
- case GID_FAVE:
- GetAttr(STRINGA_TextVal,
- (Object *)gwin->objects[GID_URL],
- (ULONG *)&storage);
- if(nsurl_create((const char *)storage, &url) == NSERROR_OK) {
- if(hotlist_has_url(url)) {
- hotlist_remove_url(url);
- } else {
- hotlist_add_url(url);
- }
- nsurl_unref(url);
- }
- ami_gui_update_hotlist_button(gwin);
- break;
-
- case GID_HOTLIST:
- default:
-// printf("GADGET: %ld\n",(result & WMHI_GADGETMASK));
- break;
- }
- 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);
-
- nskey = ami_key_to_nskey(storage, ie);
-
- if((ie->ie_Qualifier & IEQUALIFIER_RCOMMAND) &&
- ((31 < nskey) && (nskey < 127))) {
- /* NB: Some keypresses are converted to generic keypresses above
- * rather than being "menu-emulated" here. */
- switch(nskey)
- {
- /* The following aren't available from the menu at the moment */
-
- case 'r': // reload
- if(browser_window_reload_available(gwin->gw->bw))
- browser_window_reload(gwin->gw->bw, false);
- break;
-
- case 'u': // open url
- if((nsoption_bool(kiosk_mode) == false))
- ActivateLayoutGadget((struct Gadget *)gwin->objects[GID_MAIN],
- gwin->win, NULL, (uint32)gwin->objects[GID_URL]);
- break;
- }
- }
- else
- {
- if(!browser_window_key_press(gwin->gw->bw, nskey))
- {
- switch(nskey)
- {
- case NS_KEY_UP:
- ami_gui_scroll_internal(gwin, 0, -NSA_KBD_SCROLL_PX);
- break;
-
- case NS_KEY_DOWN:
- ami_gui_scroll_internal(gwin, 0, +NSA_KBD_SCROLL_PX);
- break;
-
- case NS_KEY_LEFT:
- ami_gui_scroll_internal(gwin, -NSA_KBD_SCROLL_PX, 0);
- break;
-
- case NS_KEY_RIGHT:
- ami_gui_scroll_internal(gwin, +NSA_KBD_SCROLL_PX, 0);
- break;
-
- case NS_KEY_PAGE_UP:
- ami_gui_scroll_internal(gwin, 0, SCROLL_PAGE_UP);
- break;
-
- case NS_KEY_PAGE_DOWN:
- case ' ':
- ami_gui_scroll_internal(gwin, 0, SCROLL_PAGE_DOWN);
- break;
-
- case NS_KEY_LINE_START: // page left
- ami_gui_scroll_internal(gwin, SCROLL_PAGE_UP, 0);
- break;
-
- case NS_KEY_LINE_END: // page right
- ami_gui_scroll_internal(gwin, SCROLL_PAGE_DOWN, 0);
- break;
-
- case NS_KEY_TEXT_START: // home
- ami_gui_scroll_internal(gwin, SCROLL_TOP, SCROLL_TOP);
- break;
-
- case NS_KEY_TEXT_END: // end
- ami_gui_scroll_internal(gwin, SCROLL_BOTTOM, SCROLL_BOTTOM);
- break;
-
- case NS_KEY_WORD_RIGHT: // alt+right
- ami_change_tab(gwin, 1);
- break;
-
- case NS_KEY_WORD_LEFT: // alt+left
- ami_change_tab(gwin, -1);
- break;
-
- case NS_KEY_DELETE_LEFT: // backspace
- ami_gui_history(gwin, true);
- break;
-
- /* RawKeys. NB: These are passthrus in ami_key_to_nskey() */
- case RAWKEY_F5: // reload
- if(browser_window_reload_available(gwin->gw->bw))
- browser_window_reload(gwin->gw->bw,false);
- break;
-
- case RAWKEY_F8: // scale 100%
- ami_gui_set_scale(gwin->gw, 1.0);
- break;
-
- case RAWKEY_F9: // decrease scale
- ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
- break;
-
- case RAWKEY_F10: // increase scale
- ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
- break;
-
- case RAWKEY_HELP: // help
- ami_help_open(AMI_HELP_GUI, scrn);
- break;
- }
- } else if(nskey == NS_KEY_COPY_SELECTION) {
- /* if we've copied a selection we need to clear it - style guide rules */
- browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
- }
- }
- break;
-
- case WMHI_NEWSIZE:
- ami_set_border_gadget_size(gwin);
- ami_throbber_redraw_schedule(0, gwin->gw);
- ami_schedule(0, ami_gui_refresh_favicon, gwin);
- browser_window_schedule_reformat(gwin->gw->bw);
- break;
-
- case WMHI_CLOSEWINDOW:
- ami_gui_close_window(gwin);
- break;
-#ifdef __amigaos4__
- case WMHI_ICONIFY:
- {
- struct bitmap *bm;
-
- bm = urldb_get_thumbnail(browser_window_get_url(gwin->gw->bw));
- if(!bm) bm = content_get_bitmap(browser_window_get_content(gwin->gw->bw));
- gwin->dobj = amiga_icon_from_bitmap(bm);
- amiga_icon_superimpose_favicon_internal(gwin->gw->favicon,
- gwin->dobj);
- HideWindow(gwin->win);
- gwin->appicon = AddAppIcon((ULONG)gwin->objects[OID_MAIN],
- (ULONG)gwin, gwin->win->Title, appport,
- 0, gwin->dobj, NULL);
-
- cur_gw = NULL;
- }
- break;
-#endif
- case WMHI_INACTIVE:
- gwin->gw->c_h_temp = gwin->gw->c_h;
- gui_window_remove_caret(gwin->gw);
- break;
-
- case WMHI_ACTIVE:
- if(gwin->gw->bw) cur_gw = gwin->gw;
- if(gwin->gw->c_h_temp)
- gwin->gw->c_h = gwin->gw->c_h_temp;
- break;
-
- case WMHI_INTUITICK:
- break;
-
- default:
- //printf("class: %ld\n",(result & WMHI_CLASSMASK));
- break;
- }
-
- if(win_destroyed)
- {
- /* we can't be sure what state our window_list is in, so let's
- jump out of the function and start again */
-
- win_destroyed = false;
- return;
- }
-
- if(drag_x_move || drag_y_move)
- {
- gui_window_get_scroll(gwin->gw,
- &gwin->gw->scrollx, &gwin->gw->scrolly);
-
- gui_window_set_scroll(gwin->gw,
- gwin->gw->scrollx + drag_x_move,
- gwin->gw->scrolly + drag_y_move);
- }
-
-// ReplyMsg((struct Message *)message);
- }
-
- } while((node = nnode));
-
- if(ami_menu_window_close)
- {
- if(ami_menu_window_close == (void *)AMI_MENU_WINDOW_CLOSE_ALL)
- ami_quit_netsurf();
- else
- ami_gui_close_window(ami_menu_window_close);
-
- ami_menu_window_close = NULL;
- }
-
- if(ami_menu_check_toggled) {
- ami_gui_menu_update_all();
- ami_menu_check_toggled = false;
- }
-}
-
-static void ami_gui_appicon_remove(struct gui_window_2 *gwin)
-{
- if(gwin->appicon)
- {
- RemoveAppIcon(gwin->appicon);
- amiga_icon_free(gwin->dobj);
- gwin->appicon = NULL;
- }
-}
-
-static void ami_handle_appmsg(void)
-{
- struct AppMessage *appmsg;
- struct gui_window_2 *gwin;
- int x, y;
- struct WBArg *appwinargs;
- STRPTR filename;
- int i = 0;
-
- while((appmsg = (struct AppMessage *)GetMsg(appport)))
- {
- gwin = (struct gui_window_2 *)appmsg->am_UserData;
-
- if(appmsg->am_Type == AMTYPE_APPICON)
- {
- ami_gui_appicon_remove(gwin);
- ShowWindow(gwin->win, WINDOW_FRONTMOST);
- ActivateWindow(gwin->win);
- }
- else if(appmsg->am_Type == AMTYPE_APPWINDOW)
- {
- for(i = 0; i < appmsg->am_NumArgs; ++i)
- {
- if((appwinargs = &appmsg->am_ArgList[i]))
- {
- if((filename = AllocVecTagList(1024, NULL)))
- {
- if(appwinargs->wa_Lock)
- {
- NameFromLock(appwinargs->wa_Lock, filename, 1024);
- }
-
- AddPart(filename, appwinargs->wa_Name, 1024);
-
- if(ami_mouse_to_ns_coords(gwin, &x, &y,
- appmsg->am_MouseX, appmsg->am_MouseY) == false)
- {
- nsurl *url;
-
- if (netsurf_path_to_nsurl(filename, &url) != NSERROR_OK) {
- amiga_warn_user("NoMemory", 0);
- }
- else
- {
- if(i == 0)
- {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
-
- ActivateWindow(gwin->win);
- }
- else
- {
- browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY |
- BW_CREATE_TAB,
- url,
- NULL,
- gwin->gw->bw,
- NULL);
- }
- nsurl_unref(url);
- }
- }
- else
- {
- if(browser_window_drop_file_at_point(gwin->gw->bw, x, y, filename) == false)
- {
- nsurl *url;
-
- if (netsurf_path_to_nsurl(filename, &url) != NSERROR_OK) {
- amiga_warn_user("NoMemory", 0);
- }
- else
- {
-
- if(i == 0)
- {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
-
- ActivateWindow(gwin->win);
- }
- else
- {
- browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY |
- BW_CREATE_TAB,
- url,
- NULL,
- gwin->gw->bw,
- NULL);
-
- }
- nsurl_unref(url);
- }
- }
- }
- FreeVec(filename);
- }
- }
- }
- }
- ReplyMsg((struct Message *)appmsg);
- }
-}
-
-static void ami_handle_applib(void)
-{
-#ifdef __amigaos4__
- struct ApplicationMsg *applibmsg;
- struct browser_window *bw;
- nsurl *url;
- nserror error;
-
- if(!applibport) return;
-
- while((applibmsg=(struct ApplicationMsg *)GetMsg(applibport)))
- {
- switch (applibmsg->type)
- {
- case APPLIBMT_NewBlankDoc:
- {
-
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- }
- }
- break;
-
- case APPLIBMT_OpenDoc:
- {
- struct ApplicationOpenPrintDocMsg *applibopdmsg =
- (struct ApplicationOpenPrintDocMsg *)applibmsg;
-
- error = netsurf_path_to_nsurl(applibopdmsg->fileName, &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- }
- }
- break;
-
- case APPLIBMT_ToFront:
- if(cur_gw)
- {
- ScreenToFront(scrn);
- WindowToFront(cur_gw->shared->win);
- ActivateWindow(cur_gw->shared->win);
- }
- break;
-
- case APPLIBMT_OpenPrefs:
- ScreenToFront(scrn);
- ami_gui_opts_open();
- break;
-
- case APPLIBMT_Quit:
- case APPLIBMT_ForceQuit:
- ami_quit_netsurf();
- break;
-
- case APPLIBMT_CustomMsg:
- {
- struct ApplicationCustomMsg *applibcustmsg =
- (struct ApplicationCustomMsg *)applibmsg;
- LOG("Ringhio BackMsg received: %s", applibcustmsg->customMsg);
- OpenWorkbenchObjectA(applibcustmsg->customMsg, NULL);
- }
- break;
- }
- ReplyMsg((struct Message *)applibmsg);
- }
-#endif
-}
-
-void ami_get_msg(void)
-{
- ULONG winsignal = 1L << sport->mp_SigBit;
- ULONG appsig = 1L << appport->mp_SigBit;
- ULONG schedulesig = 1L << schedulermsgport->mp_SigBit;
- ULONG ctrlcsig = SIGBREAKF_CTRL_C;
- uint32 signal = 0;
- fd_set read_fd_set, write_fd_set, except_fd_set;
- int max_fd = -1;
- struct MsgPort *printmsgport = ami_print_get_msgport();
- ULONG printsig = 0;
- ULONG helpsignal = ami_help_signal();
- if(printmsgport) printsig = 1L << printmsgport->mp_SigBit;
- uint32 signalmask = winsignal | appsig | schedulesig | rxsig |
- printsig | applibsig | helpsignal;
-
- if ((fetcher_fdset(&read_fd_set, &write_fd_set, &except_fd_set, &max_fd) == NSERROR_OK) &&
- (max_fd != -1)) {
- /* max_fd is the highest fd in use, but waitselect() needs to know how many
- * are in use, so we add 1. */
-
- if (waitselect(max_fd + 1, &read_fd_set, &write_fd_set, &except_fd_set,
- NULL, (unsigned int *)&signalmask) != -1) {
- signal = signalmask;
- } else {
- LOG("waitselect() returned error");
- /* \todo Fix Ctrl-C handling.
- * WaitSelect() from bsdsocket.library returns -1 if the task was
- * signalled with a Ctrl-C. waitselect() from newlib.library does not.
- * Adding the Ctrl-C signal to our user signal mask causes a Ctrl-C to
- * occur sporadically. Otherwise we never get a -1 except on error.
- * NetSurf still terminates at the Wait() when network activity is over.
- */
- }
- } else {
- /* If fetcher_fdset fails or no network activity, do it the old fashioned way. */
- signalmask |= ctrlcsig;
- signal = Wait(signalmask);
- }
-
- if(signal & winsignal)
- ami_handle_msg();
-
- if(signal & appsig)
- ami_handle_appmsg();
-
- if(signal & rxsig)
- ami_arexx_handle();
-
- if(signal & applibsig)
- ami_handle_applib();
-
- if(signal & printsig) {
- while(GetMsg(printmsgport)); //ReplyMsg
- ami_print_cont();
- }
-
- if(signal & schedulesig) {
- ami_schedule_handle(schedulermsgport);
- }
-
- if(signal & helpsignal)
- ami_help_process();
-
- if(signal & ctrlcsig)
- ami_quit_netsurf_delayed();
-}
-
-void ami_change_tab(struct gui_window_2 *gwin, int direction)
-{
- struct Node *tab_node = gwin->gw->tab_node;
- struct Node *ptab = NULL;
-
- if(gwin->tabs <= 1) return;
-
- if(direction > 0) {
- ptab = GetSucc(tab_node);
- } else {
- ptab = GetPred(tab_node);
- }
-
- if(!ptab) return;
-
- RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_TABS], gwin->win, NULL,
- CLICKTAB_CurrentNode, ptab,
- TAG_DONE);
-
- ami_switch_tab(gwin, true);
-}
-
-void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
-{
- struct Node *tabnode;
- struct IBox *bbox;
-
- /* Clear the last new tab list */
- gwin->gw->last_new_tab = NULL;
-
- if(gwin->tabs == 0) return;
-
- gui_window_get_scroll(gwin->gw,
- &gwin->gw->scrollx, &gwin->gw->scrolly);
-
- GetAttr(CLICKTAB_CurrentNode, (Object *)gwin->objects[GID_TABS],
- (ULONG *)&tabnode);
- GetClickTabNodeAttrs(tabnode,
- TNA_UserData, &gwin->gw,
- TAG_DONE);
- cur_gw = gwin->gw;
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if((gwin->gw->bw == NULL) || (browser_window_has_content(gwin->gw->bw)) == false) {
- RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL],
- gwin->win, NULL, STRINGA_TextVal, "", TAG_DONE);
-
- ami_plot_clear_bbox(gwin->win->RPort, bbox);
- ami_gui_free_space_box(bbox);
- return;
- }
-
- ami_plot_release_pens(gwin->shared_pens);
- ami_update_buttons(gwin);
- ami_menu_update_disabled(gwin->gw, browser_window_get_content(gwin->gw->bw));
-
- if(redraw)
- {
- ami_plot_clear_bbox(gwin->win->RPort, bbox);
- browser_window_update(gwin->gw->bw, false);
-
- gui_window_set_scroll(gwin->gw,
- gwin->gw->scrollx, gwin->gw->scrolly);
- gwin->redraw_scroll = false;
-
- browser_window_refresh_url_bar(gwin->gw->bw);
- ami_gui_update_hotlist_button(gwin);
- ami_gui_scroller_update(gwin);
- ami_throbber_redraw_schedule(0, gwin->gw);
-
- gui_window_set_icon(gwin->gw, gwin->gw->favicon);
- }
-
- ami_gui_free_space_box(bbox);
-}
-
-void ami_quit_netsurf(void)
-{
- struct nsObject *node;
- struct nsObject *nnode;
- struct gui_window_2 *gwin;
-
- if(!IsMinListEmpty(window_list)) {
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
- gwin = node->objstruct;
-
- switch(node->Type) {
- case AMINS_TVWINDOW:
- ami_tree_close((struct treeview_window *)gwin);
- break;
-
- case AMINS_WINDOW:
- /* This also closes windows that are attached to the
- * gui_window, such as local history and find. */
- ShowWindow(gwin->win, WINDOW_BACKMOST);
- ami_gui_close_window(gwin);
- break;
-
- case AMINS_GUIOPTSWINDOW:
- ami_gui_opts_close();
- break;
-
- case AMINS_DLWINDOW:
- ami_download_window_abort((struct gui_download_window *)gwin);
- break;
- }
- } while((node = nnode));
-
- win_destroyed = true;
- }
-
- if(IsMinListEmpty(window_list)) {
- /* last window closed, so exit */
- ami_quit = true;
- }
-}
-
-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();
- }
-}
-
-static void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen, BOOL donotwait)
-{
- if(scrn == NULL) return;
-
- if(locked_screen) {
- UnlockPubScreen(NULL,scrn);
- locked_screen = FALSE;
- }
-
- if(CloseScreen(scrn) == TRUE) {
- if(screen_signal != -1) {
- FreeSignal(screen_signal);
- screen_signal = -1;
- scrn = NULL;
- }
- return;
- }
- if(donotwait == TRUE) return;
-
- /* If this is our own screen, wait for visitor windows to close */
- if(screen_signal == -1) return;
-
- ULONG scrnsig = 1 << screen_signal;
- LOG("Waiting for visitor windows to close... (signal)");
- Wait(scrnsig);
-
- while (CloseScreen(scrn) == FALSE) {
- LOG("Waiting for visitor windows to close... (polling)");
- Delay(50);
- }
-
- FreeSignal(screen_signal);
- screen_signal = -1;
- scrn = NULL;
-}
-
-void ami_try_quit(void)
-{
- if(!IsMinListEmpty(window_list)) return;
-
- if(nsoption_bool(close_no_quit) == false)
- {
- ami_quit = true;
- return;
- }
- else
- {
- ami_gui_close_screen(scrn, locked_screen, TRUE);
- }
-}
-
-static void gui_quit(void)
-{
- ami_theme_throbber_free();
-
- urldb_save(nsoption_charp(url_file));
- urldb_save_cookies(nsoption_charp(cookie_file));
- ami_hotlist_free(nsoption_charp(hotlist_file));
- ami_cookies_free();
- ami_global_history_free();
-#ifdef __amigaos4__
- if(IApplication && ami_appid)
- UnregisterApplication(ami_appid, NULL);
-#endif
- ami_arexx_cleanup();
-
- ami_free_layers(&browserglob);
-
- ami_font_fini();
- ami_help_free();
-
- LOG("Freeing menu items");
- ami_ctxmenu_free();
- ami_menu_free_glyphs();
-
- LOG("Freeing mouse pointers");
- ami_mouse_pointers_free();
-
- ami_file_req_free();
- ami_openurl_close();
- FreeStringClass(urlStringClass);
-
- FreeObjList(window_list);
-}
-
-char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail)
-{
- STRPTR filename = NULL;
- BPTR lock = 0;
-
- if ((filename = ASPrintf("%s/%x", current_user_faviconcache, nsurl_hash(url)))) {
- LOG("favicon cache location: %s", filename);
-
- if (only_if_avail == true) {
- if((lock = Lock(filename, ACCESS_READ))) {
- UnLock(lock);
- return filename;
- }
- } else {
- return filename;
- }
- }
- return NULL;
-}
-
-static void ami_gui_cache_favicon(nsurl *url, struct bitmap *favicon)
-{
- STRPTR filename = NULL;
-
- if ((filename = ami_gui_get_cache_favicon_name(url, false))) {
- if(favicon) amiga_bitmap_save(favicon, filename, AMI_BITMAP_SCALE_ICON);
- FreeVec(filename);
- }
-}
-
-void ami_gui_update_hotlist_button(struct gui_window_2 *gwin)
-{
- char *url;
- nsurl *nsurl;
-
- GetAttr(STRINGA_TextVal,
- (Object *)gwin->objects[GID_URL],
- (ULONG *)&url);
-
- if(nsurl_create(url, &nsurl) == NSERROR_OK) {
- if(hotlist_has_url(nsurl)) {
- RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_FAVE], gwin->win, NULL,
- BUTTON_RenderImage, gwin->objects[GID_FAVE_RMV], TAG_DONE);
-
- if (gwin->gw->favicon)
- ami_gui_cache_favicon(nsurl, content_get_bitmap(gwin->gw->favicon));
- } else {
- RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_FAVE], gwin->win, NULL,
- BUTTON_RenderImage, gwin->objects[GID_FAVE_ADD], TAG_DONE);
- }
-
- nsurl_unref(nsurl);
- }
-}
-
-static bool ami_gui_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder)
-{
- struct ami_gui_tb_userdata *tb_userdata = (struct ami_gui_tb_userdata *)userdata;
- struct Node *speed_button_node;
- char menu_icon[1024];
- char *utf8title = NULL;
-
- if(level != 1) return false;
- if(item > AMI_GUI_TOOLBAR_MAX) return false;
- if(is_folder == true) return false;
-
- if(utf8_from_local_encoding(title,
- (strlen(title) < NSA_MAX_HOTLIST_BUTTON_LEN) ? strlen(title) : NSA_MAX_HOTLIST_BUTTON_LEN,
- &utf8title) != NSERROR_OK)
- return false;
-
- char *iconname = ami_gui_get_cache_favicon_name(url, true);
- if (iconname == NULL) iconname = ASPrintf("icons/content.png");
- ami_locate_resource(menu_icon, iconname);
-
- tb_userdata->gw->hotlist_toolbar_lab[item] = BitMapObj,
- IA_Scalable, TRUE,
- BITMAP_Screen, scrn,
- BITMAP_SourceFile, menu_icon,
- BITMAP_Masking, TRUE,
- BitMapEnd;
-
- /* \todo make this scale the bitmap to these dimensions */
- SetAttrs(tb_userdata->gw->hotlist_toolbar_lab[item],
- BITMAP_Width, 16,
- BITMAP_Height, 16,
- TAG_DONE);
-
- Object *lab_item = LabelObj,
- // LABEL_DrawInfo, dri,
- LABEL_DisposeImage, TRUE,
- LABEL_Image, tb_userdata->gw->hotlist_toolbar_lab[item],
- LABEL_Text, " ",
- LABEL_Text, utf8title,
- LabelEnd;
-
- free(utf8title);
-
- speed_button_node = AllocSpeedButtonNode(item,
- SBNA_Image, lab_item,
- SBNA_HintInfo, nsurl_access(url),
- SBNA_UserData, (void *)url,
- TAG_DONE);
-
- AddTail(tb_userdata->sblist, speed_button_node);
-
- tb_userdata->items++;
- return true;
-}
-
-static int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, struct gui_window_2 *gwin)
-{
- struct ami_gui_tb_userdata userdata;
- userdata.gw = gwin;
- userdata.sblist = speed_button_list;
- userdata.items = 0;
-
- ami_hotlist_scan((void *)&userdata, 0, messages_get("HotlistToolbar"), ami_gui_hotlist_add);
- return userdata.items;
-}
-
-static 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) {
- gwin->objects[GID_HOTLIST] =
- SpeedBarObj,
- 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] =
- BevelObj,
- BEVEL_Style, BVS_SBAR_VERT,
- BevelEnd;
-#ifdef __amigaos4__
- IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDCHILD,
- gwin->win, gwin->objects[GID_HOTLIST], attrs);
-
- IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDIMAGE,
- gwin->win, gwin->objects[GID_HOTLISTSEPBAR], NULL);
-
-#else
- SetAttrs(gwin->objects[GID_HOTLISTLAYOUT],
- LAYOUT_AddChild, gwin->objects[GID_HOTLIST], TAG_MORE, &attrs);
- SetAttrs(gwin->objects[GID_HOTLISTLAYOUT],
- LAYOUT_AddChild, gwin->objects[GID_HOTLISTSEPBAR], TAG_DONE);
-#endif
-
- FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
-
- RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
- gwin->win, NULL, TRUE);
-
- ami_schedule_redraw(gwin, true);
- }
-}
-
-static 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(nsoption_bool(kiosk_mode) == true) return;
-
- 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]) {
- DisposeObject(gwin->hotlist_toolbar_lab[i]);
- gwin->hotlist_toolbar_lab[i] = NULL;
- }
- }
-}
-
-static void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin)
-{
-#ifdef __amigaos4__
- 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]);
-#else
- SetAttrs(gwin->objects[GID_HOTLISTLAYOUT], LAYOUT_RemoveChild, gwin->objects[GID_HOTLIST]);
- SetAttrs(gwin->objects[GID_HOTLISTLAYOUT], LAYOUT_RemoveChild, gwin->objects[GID_HOTLISTSEPBAR]);
-#endif
- FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
-
- RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
- gwin->win, NULL, TRUE);
-
- ami_schedule_redraw(gwin, true);
-}
-
-static 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);
- }
-}
-
-/**
- * Update hotlist toolbar and recreate the menu for all windows
- */
-void ami_gui_hotlist_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);
- ami_menu_refresh(gwin);
- }
- } while((node = nnode));
-}
-
-static void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
-{
- if(ClickTabBase->lib_Version < 53) return;
-
- if(show) {
- struct TagItem attrs[3];
-
- attrs[0].ti_Tag = CHILD_WeightedWidth;
- attrs[0].ti_Data = 0;
- attrs[1].ti_Tag = CHILD_WeightedHeight;
- attrs[1].ti_Data = 0;
- attrs[2].ti_Tag = TAG_DONE;
- attrs[2].ti_Data = 0;
-
- gwin->objects[GID_TABS] = ClickTabObj,
- GA_ID, GID_TABS,
- GA_RelVerify, TRUE,
- GA_Underscore, 13, // disable kb shortcuts
- GA_ContextMenu, ami_ctxmenu_clicktab_create(gwin),
- CLICKTAB_Labels, &gwin->tab_list,
- CLICKTAB_LabelTruncate, TRUE,
- CLICKTAB_CloseImage, gwin->objects[GID_CLOSETAB_BM],
- CLICKTAB_FlagImage, gwin->objects[GID_TABS_FLAG],
- ClickTabEnd;
-
- gwin->objects[GID_ADDTAB] = ButtonObj,
- GA_ID, GID_ADDTAB,
- GA_RelVerify, TRUE,
- GA_HintInfo, gwin->helphints[GID_ADDTAB],
- GA_Text, "+",
- BUTTON_RenderImage, gwin->objects[GID_ADDTAB_BM],
- ButtonEnd;
-#ifdef __amigaos4__
- IDoMethod(gwin->objects[GID_TABLAYOUT], LM_ADDCHILD,
- gwin->win, gwin->objects[GID_TABS], NULL);
-
- IDoMethod(gwin->objects[GID_TABLAYOUT], LM_ADDCHILD,
- gwin->win, gwin->objects[GID_ADDTAB], attrs);
-#else
- SetAttrs(gwin->objects[GID_TABLAYOUT],
- LAYOUT_AddChild, gwin->objects[GID_TABS], TAG_DONE);
- SetAttrs(gwin->objects[GID_TABLAYOUT],
- LAYOUT_AddChild, gwin->objects[GID_ADDTAB], TAG_MORE, &attrs);
-#endif
- } else {
-#ifdef __amigaos4__
- IDoMethod(gwin->objects[GID_TABLAYOUT], LM_REMOVECHILD,
- gwin->win, gwin->objects[GID_TABS]);
-
- IDoMethod(gwin->objects[GID_TABLAYOUT], LM_REMOVECHILD,
- gwin->win, gwin->objects[GID_ADDTAB]);
-#else
- SetAttrs(gwin->objects[GID_TABLAYOUT],
- LAYOUT_RemoveChild, gwin->objects[GID_TABS], TAG_DONE);
- SetAttrs(gwin->objects[GID_TABLAYOUT],
- LAYOUT_RemoveChild, gwin->objects[GID_ADDTAB], TAG_DONE);
-#endif
-
- gwin->objects[GID_TABS] = NULL;
- gwin->objects[GID_ADDTAB] = NULL;
- }
-
- FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
-
- RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
- gwin->win, NULL, TRUE);
-
- if(gwin->gw && gwin->gw->bw) browser_window_update(gwin->gw->bw, false);
-}
-
-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));
-}
-
-static void ami_gui_search_ico_refresh(void *p)
-{
- search_web_select_provider(-1);
-}
-
-/**
- * Count windows, and optionally tabs.
- *
- * \param window window to count tabs of
- * \param tabs if window > 0, will be updated to contain the number of tabs
- * in that window, unchanged otherwise
- * \return number of windows currently open
- */
-int ami_gui_count_windows(int window, int *tabs)
-{
- int windows = 0;
- struct nsObject *node, *nnode;
- struct gui_window_2 *gwin;
-
- if(!IsMinListEmpty(window_list)) {
- node = (struct nsObject *)GetHead((struct List *)window_list);
- do {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- gwin = node->objstruct;
-
- if(node->Type == AMINS_WINDOW) {
- windows++;
- if(window == windows) *tabs = gwin->tabs;
- }
- } while((node = nnode));
- }
- return windows;
-}
-
-/**
- * Set the scale of a gui window
- *
- * \param gw gui_window to set scale for
- * \param scale scale to set
- */
-void ami_gui_set_scale(struct gui_window *gw, float scale)
-{
- if(scale <= 0.0) return;
- gw->scale = scale;
- browser_window_set_scale(gw->bw, scale, true);
-}
-
-nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
-{
- nsurl *url;
- nserror error;
- struct browser_window *bw = NULL;
-
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY |
- BW_CREATE_TAB,
- url,
- NULL,
- gwin->gw->bw,
- &bw);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- return error;
- }
-
- return NSERROR_OK;
-}
-
-static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
- int left, int top, int width, int height,
- int sx, int sy, struct IBox *bbox, struct redraw_context *ctx)
-{
- int x, y;
- struct rect clip;
- int tile_size_x = glob->width;
- int tile_size_y = glob->height;
-
- int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
- int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
-
- browserglob.shared_pens = gwin->shared_pens; /* do we need this?? */
-
- if(top < 0) {
- height += top;
- top = 0;
- }
-
- if(left < 0) {
- width += left;
- left = 0;
- }
-
- if(top < sy) {
- height += (top - sy);
- top = sy;
- }
- if(left < sx) {
- width += (left - sx);
- left = sx;
- }
-
- if(((top - sy) + height) > bbox->Height)
- height = bbox->Height - (top - sy);
-
- if(((left - sx) + width) > bbox->Width)
- width = bbox->Width - (left - sx);
-
- if(width <= 0) return;
- if(height <= 0) return;
-
- if(busy) ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
-
- for(y = top; y < (top + height); y += tile_y_scale) {
- clip.y0 = 0;
- clip.y1 = tile_size_y;
- if(clip.y1 > height) clip.y1 = height;
- if((((y - sy) * gwin->gw->scale) + clip.y1) > bbox->Height)
- clip.y1 = bbox->Height - ((y - sy) * gwin->gw->scale);
-
- for(x = left; x < (left + width); x += tile_x_scale) {
- clip.x0 = 0;
- clip.x1 = tile_size_x;
- if(clip.x1 > width) clip.x1 = width;
- if((((x - sx) * gwin->gw->scale) + clip.x1) > bbox->Width)
- clip.x1 = bbox->Width - ((x - sx) * gwin->gw->scale);
-
- if(browser_window_redraw(gwin->gw->bw,
- clip.x0 - (int)x,
- clip.y0 - (int)y,
- &clip, ctx))
- {
- ami_clearclipreg(&browserglob);
-#ifdef __amigaos4__
- BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, browserglob.bm,
- BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_DestType, BLITT_RASTPORT,
- BLITA_Dest, gwin->win->RPort,
- BLITA_DestX, bbox->Left + (int)((x - sx) * gwin->gw->scale),
- BLITA_DestY, bbox->Top + (int)((y - sy) * gwin->gw->scale),
- BLITA_Width, (int)(clip.x1),
- BLITA_Height, (int)(clip.y1),
- TAG_DONE);
-#else
- BltBitMapRastPort(browserglob.bm, 0, 0, gwin->win->RPort,
- bbox->Left + (int)((x - sx) * gwin->gw->scale),
- bbox->Top + (int)((y - sy) * gwin->gw->scale),
- (int)(clip.x1), (int)(clip.y1), 0xC0);
-#endif
- }
- }
- }
-
- if(busy) ami_reset_pointer(gwin);
-}
-
-
-/**
- * Redraw an area of the browser window - Amiga-specific function
- *
- * \param g a struct gui_window
- * \param bw a struct browser_window
- * \param busy busy flag passed to tiled redraw.
- * \param x0 top-left co-ordinate (in document co-ordinates)
- * \param y0 top-left co-ordinate (in document co-ordinates)
- * \param x1 bottom-right co-ordinate (in document co-ordinates)
- * \param y1 bottom-right co-ordinate (in document co-ordinates)
- */
-
-static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw, bool busy,
- int x0, int y0, int x1, int y1)
-{
- struct IBox *bbox;
- ULONG sx, sy;
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot
- };
-
- if(!g) return;
- if(browser_window_redraw_ready(bw) == false) return;
-
- sx = g->scrollx;
- sy = g->scrolly;
-
- if(g != g->shared->gw) return;
-
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- ami_do_redraw_tiled(g->shared, busy, x0, y0,
- (x1 - x0) * g->scale, (y1 - y0) * g->scale, sx, sy, bbox, &ctx);
-
- ami_gui_free_space_box(bbox);
-
- return;
-}
-
-static void ami_refresh_window(struct gui_window_2 *gwin)
-{
- /* simplerefresh only */
-
- struct IBox *bbox;
- int x0, x1, y0, y1, sx, sy;
- struct RegionRectangle *regrect;
-
- sx = gwin->gw->scrollx;
- sy = gwin->gw->scrolly;
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- BeginRefresh(gwin->win);
-
- x0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinX - bbox->Left) /
- browser_window_get_scale(gwin->gw->bw)) + sx - 1;
- x1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxX - bbox->Left) /
- browser_window_get_scale(gwin->gw->bw)) + sx + 2;
- y0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinY - bbox->Top) /
- browser_window_get_scale(gwin->gw->bw)) + sy - 1;
- y1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxY - bbox->Top) /
- browser_window_get_scale(gwin->gw->bw)) + sy + 2;
-
- regrect = gwin->win->RPort->Layer->DamageList->RegionRectangle;
-
- ami_do_redraw_limits(gwin->gw, gwin->gw->bw, false, x0, y0, x1, y1);
-
- while(regrect)
- {
- x0 = ((regrect->bounds.MinX - bbox->Left) /
- browser_window_get_scale(gwin->gw->bw)) + sx - 1;
- x1 = ((regrect->bounds.MaxX - bbox->Left) /
- browser_window_get_scale(gwin->gw->bw)) + sx + 2;
- y0 = ((regrect->bounds.MinY - bbox->Top) /
- browser_window_get_scale(gwin->gw->bw)) + sy - 1;
- y1 = ((regrect->bounds.MaxY - bbox->Top) /
- browser_window_get_scale(gwin->gw->bw)) + sy + 2;
-
- regrect = regrect->Next;
-
- ami_do_redraw_limits(gwin->gw, gwin->gw->bw, false, x0, y0, x1, y1);
- }
-
- EndRefresh(gwin->win, TRUE);
-
- ami_gui_free_space_box(bbox);
- ami_reset_pointer(gwin);
-}
-
-HOOKF(void, ami_scroller_hook, Object *, object, struct IntuiMessage *)
-{
- ULONG gid;
- struct gui_window_2 *gwin = hook->h_Data;
- struct IntuiWheelData *wheel;
- struct Node *node = NULL;
- nsurl *url;
-
- switch(msg->Class)
- {
- case IDCMP_IDCMPUPDATE:
- gid = GetTagData( GA_ID, 0, msg->IAddress );
-
- switch( gid )
- {
- case GID_HSCROLL:
- case GID_VSCROLL:
- if(nsoption_bool(faster_scroll) == true) gwin->redraw_scroll = true;
- else gwin->redraw_scroll = false;
-
- ami_schedule_redraw(gwin, 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(BW_CREATE_TAB,
- url,
- NULL,
- gwin->gw->bw,
- NULL);
- } else {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
-
- }
- }
- break;
- }
- break;
-#ifdef __amigaos4__
- case IDCMP_EXTENDEDMOUSE:
- if(msg->Code == IMSGCODE_INTUIWHEELDATA)
- {
- wheel = (struct IntuiWheelData *)msg->IAddress;
-
- ami_gui_scroll_internal(gwin, wheel->WheelX * 50, wheel->WheelY * 50);
- }
- break;
-#endif
- case IDCMP_SIZEVERIFY:
- break;
-
- case IDCMP_REFRESHWINDOW:
- ami_refresh_window(gwin);
- break;
-
- default:
- LOG("IDCMP hook unhandled event: %ld\n", msg->Class);
- break;
- }
-// ReplyMsg((struct Message *)msg);
-}
-
-static struct gui_window *
-gui_window_create(struct browser_window *bw,
- struct gui_window *existing,
- gui_window_create_flags flags)
-{
- struct gui_window *g = NULL;
- ULONG offset = 0;
- ULONG curx = nsoption_int(window_x), cury = nsoption_int(window_y);
- ULONG curw = nsoption_int(window_width), curh = nsoption_int(window_height);
- char nav_west[100],nav_west_s[100],nav_west_g[100];
- char nav_east[100],nav_east_s[100],nav_east_g[100];
- char stop[100],stop_s[100],stop_g[100];
- char reload[100],reload_s[100],reload_g[100];
- char home[100],home_s[100],home_g[100];
- char closetab[100],closetab_s[100],closetab_g[100];
- char addtab[100],addtab_s[100],addtab_g[100];
- char fave[100], unfave[100];
- char tabthrobber[100];
- ULONG refresh_mode = WA_SmartRefresh;
- ULONG defer_layout = TRUE;
- ULONG idcmp_sizeverify = IDCMP_SIZEVERIFY;
-
- LOG("Creating window");
-
- if (!scrn) ami_openscreenfirst();
-
- if (nsoption_bool(kiosk_mode)) flags &= ~GW_CREATE_TAB;
- if (nsoption_bool(resize_with_contents)) idcmp_sizeverify = 0;
-
- /* Offset the new window by titlebar + 1 as per AmigaOS style guide.
- * If we don't have a clone window we offset by all windows open. */
- offset = scrn->WBorTop + scrn->Font->ta_YSize + 1;
-
- if(existing) {
- curx = existing->shared->win->LeftEdge;
- cury = existing->shared->win->TopEdge + offset;
- curw = existing->shared->win->Width;
- curh = existing->shared->win->Height;
- } else {
- if(nsoption_bool(kiosk_mode) == false) {
- cury += offset * ami_gui_count_windows(0, NULL);
- }
- }
-
- if(curh > (scrn->Height - cury)) curh = scrn->Height - cury;
-
- g = ami_misc_allocvec_clear(sizeof(struct gui_window), 0);
-
- if(!g)
- {
- amiga_warn_user("NoMemory","");
- return NULL;
- }
-
- NewList(&g->dllist);
- g->deferred_rects = NewObjList();
- g->deferred_rects_pool = ami_misc_itempool_create(sizeof(struct rect));
- g->bw = bw;
- g->scale = browser_window_get_scale(bw);
-
- if((flags & GW_CREATE_TAB) && existing)
- {
- g->shared = existing->shared;
- g->tab = g->shared->next_tab;
- g->shared->tabs++; /* do this early so functions know to update the tabs */
-
- if((g->shared->tabs == 2) && (nsoption_bool(tab_always_show) == false)) {
- ami_toggletabbar(g->shared, true);
- }
-
- SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
- g->shared->win, NULL,
- CLICKTAB_Labels, ~0,
- TAG_DONE);
-
- g->tab_node = AllocClickTabNode(TNA_Text, messages_get("NetSurf"),
- TNA_Number, g->tab,
- TNA_UserData, g,
- TNA_CloseGadget, TRUE,
- TAG_DONE);
-
- if(nsoption_bool(new_tab_last)) {
- AddTail(&g->shared->tab_list, g->tab_node);
- } else {
- struct Node *insert_after = existing->tab_node;
-
- if(existing->last_new_tab)
- insert_after = existing->last_new_tab;
- Insert(&g->shared->tab_list, g->tab_node, insert_after);
- existing->last_new_tab = g->tab_node;
- }
-
- RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
- g->shared->win, NULL,
- CLICKTAB_Labels, &g->shared->tab_list,
- TAG_DONE);
-
- if(nsoption_bool(new_tab_is_active)) {
- RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
- g->shared->win, NULL,
- CLICKTAB_Current, g->tab,
- TAG_DONE);
- }
-
- if(ClickTabBase->lib_Version < 53) {
- RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],
- g->shared->win, NULL, TRUE);
- }
-
- g->shared->next_tab++;
-
- if(nsoption_bool(new_tab_is_active)) ami_switch_tab(g->shared,false);
-
- ami_update_buttons(g->shared);
- ami_schedule(0, ami_gui_refresh_favicon, g->shared);
-
- return g;
- }
-
- g->shared = ami_misc_allocvec_clear(sizeof(struct gui_window_2), 0);
-
- if(!g->shared)
- {
- amiga_warn_user("NoMemory","");
- return NULL;
- }
-
- g->shared->shared_pens = ami_AllocMinList();
-
- g->shared->scrollerhook.h_Entry = (void *)ami_scroller_hook;
- g->shared->scrollerhook.h_Data = g->shared;
-
- g->shared->favicon_hook.h_Entry = (void *)ami_set_favicon_render_hook;
- g->shared->favicon_hook.h_Data = g->shared;
-
- g->shared->throbber_hook.h_Entry = (void *)ami_set_throbber_render_hook;
- g->shared->throbber_hook.h_Data = g->shared;
-
- newprefs_hook.h_Entry = (void *)ami_gui_newprefs_hook;
- newprefs_hook.h_Data = 0;
-
- g->shared->ctxmenu_hook = ami_ctxmenu_get_hook(g->shared);
- g->shared->history_ctxmenu[AMI_CTXMENU_HISTORY_BACK] = NULL;
- g->shared->history_ctxmenu[AMI_CTXMENU_HISTORY_FORWARD] = NULL;
- g->shared->clicktab_ctxmenu = NULL;
-
- if(nsoption_bool(window_simple_refresh) == true) {
- refresh_mode = WA_SimpleRefresh;
- defer_layout = FALSE; /* testing reveals this does work with SimpleRefresh,
- but the docs say it doesn't so err on the side of caution. */
- } else {
- refresh_mode = WA_SmartRefresh;
- defer_layout = TRUE;
- }
-
- if(!nsoption_bool(kiosk_mode))
- {
- ULONG addtabclosegadget = TAG_IGNORE;
- ULONG iconifygadget = FALSE;
-
- if (nsoption_charp(pubscreen_name) &&
- (locked_screen == TRUE) &&
- (strcmp(nsoption_charp(pubscreen_name), "Workbench") == 0))
- iconifygadget = TRUE;
-
- LOG("Creating menu");
- struct Menu *menu = ami_menu_create(g->shared);
-
- NewList(&g->shared->tab_list);
- g->tab_node = AllocClickTabNode(TNA_Text,messages_get("NetSurf"),
- TNA_Number, 0,
- TNA_UserData, g,
- TNA_CloseGadget, TRUE,
- TAG_DONE);
- AddTail(&g->shared->tab_list,g->tab_node);
-
- g->shared->web_search_list = ami_gui_opts_websearch();
- g->shared->search_bm = NULL;
-
- g->shared->tabs=1;
- g->shared->next_tab=1;
-
- g->shared->svbuffer = ami_misc_allocvec_clear(2000, 0);
-
- g->shared->helphints[GID_BACK] =
- translate_escape_chars(messages_get("HelpToolbarBack"));
- g->shared->helphints[GID_FORWARD] =
- translate_escape_chars(messages_get("HelpToolbarForward"));
- g->shared->helphints[GID_STOP] =
- translate_escape_chars(messages_get("HelpToolbarStop"));
- g->shared->helphints[GID_RELOAD] =
- translate_escape_chars(messages_get("HelpToolbarReload"));
- g->shared->helphints[GID_HOME] =
- translate_escape_chars(messages_get("HelpToolbarHome"));
- g->shared->helphints[GID_URL] =
- translate_escape_chars(messages_get("HelpToolbarURL"));
- g->shared->helphints[GID_SEARCHSTRING] =
- translate_escape_chars(messages_get("HelpToolbarWebSearch"));
- g->shared->helphints[GID_ADDTAB] =
- translate_escape_chars(messages_get("HelpToolbarAddTab"));
-
- ami_get_theme_filename(nav_west, "theme_nav_west", false);
- ami_get_theme_filename(nav_west_s, "theme_nav_west_s", false);
- ami_get_theme_filename(nav_west_g, "theme_nav_west_g", false);
- ami_get_theme_filename(nav_east, "theme_nav_east", false);
- ami_get_theme_filename(nav_east_s, "theme_nav_east_s", false);
- ami_get_theme_filename(nav_east_g, "theme_nav_east_g", false);
- ami_get_theme_filename(stop, "theme_stop", false);
- ami_get_theme_filename(stop_s, "theme_stop_s", false);
- ami_get_theme_filename(stop_g, "theme_stop_g", false);
- ami_get_theme_filename(reload, "theme_reload", false);
- ami_get_theme_filename(reload_s, "theme_reload_s", false);
- ami_get_theme_filename(reload_g, "theme_reload_g", false);
- ami_get_theme_filename(home, "theme_home", false);
- ami_get_theme_filename(home_s, "theme_home_s", false);
- ami_get_theme_filename(home_g, "theme_home_g", false);
- ami_get_theme_filename(closetab, "theme_closetab", false);
- ami_get_theme_filename(closetab_s, "theme_closetab_s", false);
- ami_get_theme_filename(closetab_g, "theme_closetab_g", false);
- ami_get_theme_filename(addtab, "theme_addtab", false);
- ami_get_theme_filename(addtab_s, "theme_addtab_s", false);
- ami_get_theme_filename(addtab_g, "theme_addtab_g", false);
- ami_get_theme_filename(tabthrobber, "theme_tab_loading", false);
- ami_get_theme_filename(fave, "theme_fave", false);
- ami_get_theme_filename(unfave, "theme_unfave", false);
-
- g->shared->objects[GID_FAVE_ADD] = BitMapObj,
- BITMAP_SourceFile, fave,
- BITMAP_Screen, scrn,
- BITMAP_Masking, TRUE,
- BitMapEnd;
-
- g->shared->objects[GID_FAVE_RMV] = BitMapObj,
- BITMAP_SourceFile, unfave,
- BITMAP_Screen, scrn,
- BITMAP_Masking, TRUE,
- BitMapEnd;
-
- g->shared->objects[GID_ADDTAB_BM] = BitMapObj,
- BITMAP_SourceFile, addtab,
- BITMAP_SelectSourceFile, addtab_s,
- BITMAP_DisabledSourceFile, addtab_g,
- BITMAP_Screen, scrn,
- BITMAP_Masking, TRUE,
- BitMapEnd;
-
- g->shared->objects[GID_CLOSETAB_BM] = BitMapObj,
- BITMAP_SourceFile, closetab,
- BITMAP_SelectSourceFile, closetab_s,
- BITMAP_DisabledSourceFile, closetab_g,
- BITMAP_Screen, scrn,
- BITMAP_Masking, TRUE,
- BitMapEnd;
-
- if(ClickTabBase->lib_Version < 53)
- {
- addtabclosegadget = LAYOUT_AddChild;
- g->shared->objects[GID_CLOSETAB] = ButtonObj,
- GA_ID, GID_CLOSETAB,
- GA_RelVerify, TRUE,
- BUTTON_RenderImage, g->shared->objects[GID_CLOSETAB_BM],
- ButtonEnd;
-
- g->shared->objects[GID_TABS] = ClickTabObj,
- GA_ID,GID_TABS,
- GA_RelVerify,TRUE,
- GA_Underscore,13, // disable kb shortcuts
- CLICKTAB_Labels,&g->shared->tab_list,
- CLICKTAB_LabelTruncate,TRUE,
- ClickTabEnd;
-
- g->shared->objects[GID_ADDTAB] = ButtonObj,
- GA_ID, GID_ADDTAB,
- GA_RelVerify, TRUE,
- GA_Text, "+",
- BUTTON_RenderImage, g->shared->objects[GID_ADDTAB_BM],
- ButtonEnd;
- }
- else
- {
- g->shared->objects[GID_TABS_FLAG] = BitMapObj,
- BITMAP_SourceFile, tabthrobber,
- BITMAP_Screen,scrn,
- BITMAP_Masking,TRUE,
- BitMapEnd;
- }
-
- LOG("Creating window object");
-
- g->shared->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_Top,cury,
- WA_Left,curx,
- WA_Width,curw,
- WA_Height,curh,
- WA_PubScreen,scrn,
- WA_ReportMouse,TRUE,
- refresh_mode, TRUE,
- WA_SizeBBottom, TRUE,
- WA_ContextMenuHook, g->shared->ctxmenu_hook,
- WA_IDCMP, IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
- IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
- IDCMP_RAWKEY | idcmp_sizeverify |
- IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_REFRESHWINDOW |
- IDCMP_ACTIVEWINDOW | IDCMP_EXTENDEDMOUSE,
- WINDOW_IconifyGadget, iconifygadget,
- WINDOW_MenuStrip, menu,
- WINDOW_MenuUserData, WGUD_HOOK,
- WINDOW_NewPrefsHook, &newprefs_hook,
- WINDOW_IDCMPHook, &g->shared->scrollerhook,
- WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_REFRESHWINDOW |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
- WINDOW_SharedPort, sport,
- WINDOW_BuiltInScroll, TRUE,
- WINDOW_GadgetHelp, TRUE,
- WINDOW_UserData, g->shared,
- WINDOW_ParentGroup, g->shared->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_DeferLayout, defer_layout,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_AddChild, g->shared->objects[GID_TOOLBARLAYOUT] = LayoutHObj,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_AddChild, g->shared->objects[GID_BACK] = ButtonObj,
- GA_ID, GID_BACK,
- GA_RelVerify, TRUE,
- GA_Disabled, TRUE,
- GA_ContextMenu, ami_ctxmenu_history_create(AMI_CTXMENU_HISTORY_BACK, g->shared),
- GA_HintInfo, g->shared->helphints[GID_BACK],
- BUTTON_RenderImage,BitMapObj,
- BITMAP_SourceFile,nav_west,
- BITMAP_SelectSourceFile,nav_west_s,
- BITMAP_DisabledSourceFile,nav_west_g,
- BITMAP_Screen,scrn,
- BITMAP_Masking,TRUE,
- BitMapEnd,
- ButtonEnd,
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, g->shared->objects[GID_FORWARD] = ButtonObj,
- GA_ID, GID_FORWARD,
- GA_RelVerify, TRUE,
- GA_Disabled, TRUE,
- GA_ContextMenu, ami_ctxmenu_history_create(AMI_CTXMENU_HISTORY_FORWARD, g->shared),
- GA_HintInfo, g->shared->helphints[GID_FORWARD],
- BUTTON_RenderImage,BitMapObj,
- BITMAP_SourceFile,nav_east,
- BITMAP_SelectSourceFile,nav_east_s,
- BITMAP_DisabledSourceFile,nav_east_g,
- BITMAP_Screen,scrn,
- BITMAP_Masking,TRUE,
- BitMapEnd,
- ButtonEnd,
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, g->shared->objects[GID_STOP] = ButtonObj,
- GA_ID,GID_STOP,
- GA_RelVerify,TRUE,
- GA_HintInfo, g->shared->helphints[GID_STOP],
- BUTTON_RenderImage,BitMapObj,
- BITMAP_SourceFile,stop,
- BITMAP_SelectSourceFile,stop_s,
- BITMAP_DisabledSourceFile,stop_g,
- BITMAP_Screen,scrn,
- BITMAP_Masking,TRUE,
- BitMapEnd,
- ButtonEnd,
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, g->shared->objects[GID_RELOAD] = ButtonObj,
- GA_ID,GID_RELOAD,
- GA_RelVerify,TRUE,
- GA_HintInfo, g->shared->helphints[GID_RELOAD],
- BUTTON_RenderImage,BitMapObj,
- BITMAP_SourceFile,reload,
- BITMAP_SelectSourceFile,reload_s,
- BITMAP_DisabledSourceFile,reload_g,
- BITMAP_Screen,scrn,
- BITMAP_Masking,TRUE,
- BitMapEnd,
- ButtonEnd,
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, g->shared->objects[GID_HOME] = ButtonObj,
- GA_ID,GID_HOME,
- GA_RelVerify,TRUE,
- GA_HintInfo, g->shared->helphints[GID_HOME],
- BUTTON_RenderImage,BitMapObj,
- BITMAP_SourceFile,home,
- BITMAP_SelectSourceFile,home_s,
- BITMAP_DisabledSourceFile,home_g,
- BITMAP_Screen,scrn,
- BITMAP_Masking,TRUE,
- BitMapEnd,
- ButtonEnd,
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, LayoutHObj, // FavIcon, URL bar and hotlist star
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_AddChild, g->shared->objects[GID_ICON] = SpaceObj,
- GA_ID, GID_ICON,
- SPACE_MinWidth, 16,
- SPACE_MinHeight, 16,
- SPACE_Transparent, TRUE,
- // SPACE_RenderHook, &g->shared->favicon_hook,
- SpaceEnd,
- CHILD_WeightedWidth, 0,
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, g->shared->objects[GID_URL] =
-#ifdef __amigaos4__
- NewObject(urlStringClass, NULL,
-#else
- StringObj,
-#endif
- STRINGA_MaxChars, 2000,
- GA_ID, GID_URL,
- GA_RelVerify, TRUE,
- GA_HintInfo, g->shared->helphints[GID_URL],
- GA_TabCycle, TRUE,
- STRINGA_Buffer, g->shared->svbuffer,
-#ifdef __amigaos4__
- STRINGVIEW_Header, URLHistory_GetList(),
-#endif
- TAG_DONE),
- LAYOUT_AddChild, g->shared->objects[GID_FAVE] = ButtonObj,
- GA_ID, GID_FAVE,
- GA_RelVerify, TRUE,
- // GA_HintInfo, g->shared->helphints[GID_FAVE],
- BUTTON_RenderImage, g->shared->objects[GID_FAVE_ADD],
- ButtonEnd,
- CHILD_WeightedWidth, 0,
- CHILD_WeightedHeight, 0,
- LayoutEnd,
- // GA_ID, GID_TOOLBARLAYOUT,
- // GA_RelVerify, TRUE,
- // LAYOUT_RelVerify, TRUE,
- LAYOUT_WeightBar, TRUE,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_AddChild, g->shared->objects[GID_SEARCH_ICON] = ChooserObj,
- GA_ID, GID_SEARCH_ICON,
- GA_RelVerify, TRUE,
- CHOOSER_DropDown, TRUE,
- CHOOSER_Labels, g->shared->web_search_list,
- CHOOSER_MaxLabels, 40, /* Same as options GUI */
- ChooserEnd,
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, g->shared->objects[GID_SEARCHSTRING] = StringObj,
- GA_ID,GID_SEARCHSTRING,
- STRINGA_TextVal, NULL,
- GA_RelVerify,TRUE,
- GA_HintInfo, g->shared->helphints[GID_SEARCHSTRING],
- StringEnd,
- LayoutEnd,
- CHILD_WeightedWidth, nsoption_int(web_search_width),
- LAYOUT_AddChild, g->shared->objects[GID_THROBBER] = SpaceObj,
- GA_ID,GID_THROBBER,
- SPACE_MinWidth,throbber_width,
- SPACE_MinHeight,throbber_height,
- SPACE_Transparent,TRUE,
- // SPACE_RenderHook, &g->shared->throbber_hook,
- SpaceEnd,
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LayoutEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddImage, BevelObj,
- BEVEL_Style, BVS_SBAR_VERT,
- BevelEnd,
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, g->shared->objects[GID_HOTLISTLAYOUT] = LayoutVObj,
- LAYOUT_SpaceInner, FALSE,
- LayoutEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, g->shared->objects[GID_TABLAYOUT] = LayoutHObj,
- LAYOUT_SpaceInner,FALSE,
- addtabclosegadget, g->shared->objects[GID_CLOSETAB],
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
-
- addtabclosegadget, g->shared->objects[GID_TABS],
- CHILD_CacheDomain,FALSE,
-
- addtabclosegadget, g->shared->objects[GID_ADDTAB],
- CHILD_WeightedWidth,0,
- CHILD_WeightedHeight,0,
- LayoutEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = LayoutHObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = LayoutVObj,
- LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObj,
- GA_ID,GID_BROWSER,
- SPACE_Transparent,TRUE,
- SpaceEnd,
- EndGroup,
- EndGroup,
- EndGroup,
-#ifndef __amigaos4__
- LAYOUT_AddChild, g->shared->objects[GID_STATUS] = StringObj,
- GA_ID, GID_STATUS,
- GA_ReadOnly, TRUE,
- STRINGA_TextVal, NULL,
- GA_RelVerify, TRUE,
- StringEnd,
-#endif
- EndGroup,
- EndGroup,
- EndWindow;
- }
- else
- {
- /* borderless kiosk mode window */
- g->tab = 0;
- g->shared->tabs = 0;
- g->tab_node = NULL;
-
- g->shared->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Activate, TRUE,
- WA_DepthGadget, FALSE,
- WA_DragBar, FALSE,
- WA_CloseGadget, FALSE,
- WA_Borderless,TRUE,
- WA_RMBTrap,TRUE,
- WA_Top,0,
- WA_Left,0,
- WA_Width, scrn->Width,
- WA_Height, scrn->Height,
- WA_SizeGadget, FALSE,
- WA_PubScreen, scrn,
- WA_ReportMouse, TRUE,
- refresh_mode, TRUE,
- WA_IDCMP, IDCMP_MENUPICK | IDCMP_MOUSEMOVE |
- IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
- IDCMP_RAWKEY | IDCMP_REFRESHWINDOW |
- IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE,
- WINDOW_IDCMPHook,&g->shared->scrollerhook,
- WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_REFRESHWINDOW,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,g->shared,
- WINDOW_BuiltInScroll,TRUE,
- WINDOW_ParentGroup, g->shared->objects[GID_MAIN] = LayoutHObj,
- LAYOUT_DeferLayout, defer_layout,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = LayoutHObj,
- LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = LayoutVObj,
- LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObj,
- GA_ID,GID_BROWSER,
- SPACE_Transparent,TRUE,
- SpaceEnd,
- EndGroup,
- EndGroup,
- EndGroup,
- EndWindow;
- }
-
- LOG("Opening window");
-
- g->shared->win = (struct Window *)RA_OpenWindow(g->shared->objects[OID_MAIN]);
-
- LOG("Window opened, adding border gadgets");
-
- if(!g->shared->win)
- {
- amiga_warn_user("NoMemory","");
- FreeVec(g->shared);
- FreeVec(g);
- return NULL;
- }
-
- if(nsoption_bool(kiosk_mode) == false)
- {
-#ifdef __amigaos4__
- ULONG width, height;
- struct DrawInfo *dri = GetScreenDrawInfo(scrn);
-
- ami_get_border_gadget_size(g->shared,
- (ULONG *)&width, (ULONG *)&height);
-
- g->shared->objects[GID_STATUS] = NewObject(
- NULL,
- "frbuttonclass",
- GA_ID, GID_STATUS,
- GA_Left, scrn->WBorLeft + 2,
- GA_RelBottom, scrn->WBorBottom - (height/2),
- GA_BottomBorder, TRUE,
- GA_Width, width,
- GA_Height, 1 + height - scrn->WBorBottom,
- GA_DrawInfo, dri,
- GA_ReadOnly, TRUE,
- GA_Disabled, TRUE,
- GA_Image, (struct Image *)NewObject(
- NULL,
- "gaugeiclass",
- GAUGEIA_Level, 0,
- IA_Top, (int)(- ceil((scrn->WBorBottom + height) / 2)),
- IA_Left, -4,
- IA_Height, 2 + height - scrn->WBorBottom,
- IA_Label, NULL,
- IA_InBorder, TRUE,
- IA_Screen, scrn,
- TAG_DONE),
- TAG_DONE);
-
- AddGList(g->shared->win, (struct Gadget *)g->shared->objects[GID_STATUS],
- (UWORD)~0, -1, NULL);
-
- /* Apparently you can't set GA_Width on creation time for frbuttonclass */
-
- SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_STATUS],
- g->shared->win, NULL,
- GA_Width, width,
- TAG_DONE);
-
- RefreshGadgets((APTR)g->shared->objects[GID_STATUS],
- g->shared->win, NULL);
-
- FreeScreenDrawInfo(scrn, dri);
-#endif //__amigaos4__
- 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);
- }
-
- g->shared->gw = g;
- cur_gw = g;
-
- g->shared->appwin = AddAppWindowA((ULONG)g->shared->objects[OID_MAIN],
- (ULONG)g->shared, g->shared->win, appport, NULL);
-
- g->shared->node = AddObject(window_list,AMINS_WINDOW);
- g->shared->node->objstruct = g->shared;
-
- glob = &browserglob;
-
- if(locked_screen) {
- UnlockPubScreen(NULL,scrn);
- locked_screen = FALSE;
- }
-
- ami_schedule(0, ami_gui_search_ico_refresh, NULL);
-
- ScreenToFront(scrn);
-
- return g;
-}
-
-static void ami_gui_close_tabs(struct gui_window_2 *gwin, bool other_tabs)
-{
- struct Node *tab;
- struct Node *ntab;
- struct gui_window *gw;
-
- if((gwin->tabs > 1) && (nsoption_bool(tab_close_warn) == true)) {
- char *req_body = ami_utf8_easy(messages_get("MultiTabClose"));
- int32 res = amiga_warn_user_multi(req_body, "Yes", "No", gwin->win);
- free(req_body);
-
- if(res == 0) return;
- }
-
- if(gwin->tabs) {
- tab = GetHead(&gwin->tab_list);
-
- do {
- ntab=GetSucc(tab);
- GetClickTabNodeAttrs(tab,
- TNA_UserData,&gw,
- TAG_DONE);
-
- if((other_tabs == false) || (gwin->gw != gw)) {
- browser_window_destroy(gw->bw);
- }
- } while((tab=ntab));
- } else {
- if(other_tabs == false) browser_window_destroy(gwin->gw->bw);
- }
-}
-
-void ami_gui_close_window(struct gui_window_2 *gwin)
-{
- ami_gui_close_tabs(gwin, false);
-}
-
-void ami_gui_close_inactive_tabs(struct gui_window_2 *gwin)
-{
- ami_gui_close_tabs(gwin, true);
-}
-
-static void gui_window_destroy(struct gui_window *g)
-{
- struct Node *ptab = NULL;
- int gid;
-
- if(!g) return;
-
- if(g->shared->searchwin && (g->shared->searchwin->gwin == g))
- {
- ami_search_close();
- win_destroyed = true;
- }
-
- if(g->hw)
- {
- ami_history_close(g->hw);
- win_destroyed = true;
- }
-
- ami_free_download_list(&g->dllist);
- FreeObjList(g->deferred_rects);
- ami_misc_itempool_delete(g->deferred_rects_pool);
- gui_window_stop_throbber(g);
-
- cur_gw = NULL;
-
- if(g->shared->tabs > 1) {
- SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],g->shared->win,NULL,
- CLICKTAB_Labels,~0,
- TAG_DONE);
-
- GetAttr(CLICKTAB_CurrentNode, g->shared->objects[GID_TABS], (ULONG *)&ptab);
-
- if(ptab == g->tab_node) {
- ptab = GetSucc(g->tab_node);
- if(!ptab) ptab = GetPred(g->tab_node);
- }
-
- Remove(g->tab_node);
- FreeClickTabNode(g->tab_node);
- RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS], g->shared->win, NULL,
- CLICKTAB_Labels, &g->shared->tab_list,
- CLICKTAB_CurrentNode, ptab,
- TAG_DONE);
-
- if(ClickTabBase->lib_Version < 53)
- RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],
- g->shared->win, NULL, TRUE);
-
- g->shared->tabs--;
- ami_switch_tab(g->shared,true);
- ami_schedule(0, ami_gui_refresh_favicon, g->shared);
-
- if((g->shared->tabs == 1) && (nsoption_bool(tab_always_show) == false))
- ami_toggletabbar(g->shared, false);
-
- ami_utf8_free(g->tabtitle);
-
- FreeVec(g);
- return;
- }
-
- ami_plot_release_pens(g->shared->shared_pens);
- FreeVec(g->shared->shared_pens);
- ami_schedule_redraw_remove(g->shared);
- ami_schedule(-1, ami_gui_refresh_favicon, g->shared);
-
- DisposeObject(g->shared->objects[OID_MAIN]);
- 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]);
- DisposeObject(g->shared->objects[GID_CLOSETAB_BM]);
- DisposeObject(g->shared->objects[GID_TABS_FLAG]);
- DisposeObject(g->shared->objects[GID_FAVE_ADD]);
- DisposeObject(g->shared->objects[GID_FAVE_RMV]);
-
- ami_gui_opts_websearch_free(g->shared->web_search_list);
- if(g->shared->search_bm) DisposeObject(g->shared->search_bm);
-
- /* This appears to be disposed along with the ClickTab object
- if(g->shared->clicktab_ctxmenu) DisposeObject((Object *)g->shared->clicktab_ctxmenu); */
- DisposeObject((Object *)g->shared->history_ctxmenu[AMI_CTXMENU_HISTORY_BACK]);
- DisposeObject((Object *)g->shared->history_ctxmenu[AMI_CTXMENU_HISTORY_FORWARD]);
- ami_ctxmenu_release_hook(g->shared->ctxmenu_hook);
- ami_free_menulabs(g->shared);
- ami_menu_free(g->shared);
-
- free(g->shared->wintitle);
- ami_utf8_free(g->shared->status);
- FreeVec(g->shared->svbuffer);
-
- for(gid = 0; gid < GID_LAST; gid++)
- free(g->shared->helphints[gid]);
-
- DelObject(g->shared->node);
- if(g->tab_node) {
- Remove(g->tab_node);
- FreeClickTabNode(g->tab_node);
- }
- FreeVec(g); // g->shared should be freed by DelObject()
-
- if(IsMinListEmpty(window_list))
- {
- /* last window closed, so exit */
- ami_try_quit();
- }
-
- win_destroyed = true;
-}
-
-static void gui_window_set_title(struct gui_window *g, const char *title)
-{
- struct Node *node;
- char *utf8title;
-
- if(!g) return;
- if(!title) return;
-
- utf8title = ami_utf8_easy((char *)title);
-
- if(g->tab_node) // && (g->shared->tabs > 1))
- {
- node = g->tab_node;
-
- if((g->tabtitle == NULL) || (strcmp(utf8title, g->tabtitle)))
- {
- SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
- g->shared->win, NULL,
- CLICKTAB_Labels, ~0,
- TAG_DONE);
-
- if(g->tabtitle) ami_utf8_free(g->tabtitle);
- g->tabtitle = strdup(utf8title);
-
- SetClickTabNodeAttrs(node, TNA_Text, g->tabtitle,
- TNA_HintInfo, g->tabtitle,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
- g->shared->win, NULL,
- CLICKTAB_Labels, &g->shared->tab_list,
- TAG_DONE);
-
- if(ClickTabBase->lib_Version < 53)
- RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],
- g->shared->win, NULL, TRUE);
- }
- }
-
- if(g == g->shared->gw) {
- if((g->shared->wintitle == NULL) || (strcmp(utf8title, g->shared->wintitle)))
- {
- if(g->shared->wintitle) free(g->shared->wintitle);
- g->shared->wintitle = strdup(utf8title);
- SetWindowTitles(g->shared->win, g->shared->wintitle, ami_gui_get_screen_title());
- }
- }
-
- ami_utf8_free(utf8title);
-}
-
-static void ami_redraw_callback(void *p)
-{
- struct gui_window_2 *gwin = (struct gui_window_2 *)p;
-
- if(gwin->redraw_required) {
- ami_do_redraw(gwin);
- }
-
- ami_gui_window_update_box_deferred(gwin->gw, true);
-
- if(gwin->gw->c_h)
- {
- gui_window_place_caret(gwin->gw, gwin->gw->c_x,
- gwin->gw->c_y, gwin->gw->c_h, NULL);
- }
-}
-
-/**
- * Schedule a redraw of the browser window - Amiga-specific function
- *
- * \param gwin a struct gui_window_2
- * \param full_redraw set to true to schedule a full redraw,
- should only be set to false when called from gui_window_update_box()
- */
-void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
-{
- int ms = 1;
-
- if(full_redraw) gwin->redraw_required = true;
- ami_schedule(ms, ami_redraw_callback, gwin);
-}
-
-static void ami_schedule_redraw_remove(struct gui_window_2 *gwin)
-{
- ami_schedule(-1, ami_redraw_callback, gwin);
-}
-
-static void gui_window_redraw_window(struct gui_window *g)
-{
- if(!g) return;
-
- if(g == g->shared->gw)
- ami_schedule_redraw(g->shared, true);
-}
-
-static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw)
-{
- struct nsObject *node;
- struct nsObject *nnode;
- struct rect *rect;
-
- if(!g) return;
- if(IsMinListEmpty(g->deferred_rects)) return;
-
- if(draw == true) {
- ami_set_pointer(g->shared, GUI_POINTER_WAIT, false);
- } else {
- LOG("Ignoring deferred box redraw queue");
- }
-
- node = (struct nsObject *)GetHead((struct List *)g->deferred_rects);
-
- do {
- if(draw == true) {
- rect = (struct rect *)node->objstruct;
- ami_do_redraw_limits(g, g->bw, false,
- rect->x0, rect->y0, rect->x1, rect->y1);
- }
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
- ami_misc_itempool_free(g->deferred_rects_pool, node->objstruct, sizeof(struct rect));
- DelObjectNoFree(node);
- } while((node = nnode));
-
- if(draw == true) ami_reset_pointer(g->shared);
-}
-
-static bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects,
- const struct rect *new_rect, APTR mempool)
-{
- struct nsObject *node;
- struct nsObject *nnode;
- struct rect *rect;
-
- if(IsMinListEmpty(deferred_rects)) return true;
-
- node = (struct nsObject *)GetHead((struct List *)deferred_rects);
-
- do {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
- rect = (struct rect *)node->objstruct;
-
- if((rect->x0 <= new_rect->x0) &&
- (rect->y0 <= new_rect->y0) &&
- (rect->x1 >= new_rect->x1) &&
- (rect->y1 >= new_rect->y1)) {
- return false;
- }
-
- if ((new_rect->x0 <= rect->x0) &&
- (new_rect->y0 <= rect->y0) &&
- (new_rect->x1 >= rect->x1) &&
- (new_rect->y1 >= rect->y1)) {
- LOG("Removing queued redraw that is a subset of new box redraw");
- ami_misc_itempool_free(mempool, node->objstruct, sizeof(struct rect));
- DelObjectNoFree(node);
- /* Don't return - we might find more */
- }
- } while((node = nnode));
-
- return true;
-}
-
-static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
-{
- struct nsObject *nsobj;
- struct rect *deferred_rect;
- if(!g) return;
-
- if(ami_gui_window_update_box_deferred_check(g->deferred_rects, rect,
- g->deferred_rects_pool)) {
- deferred_rect = ami_misc_itempool_alloc(g->deferred_rects_pool, sizeof(struct rect));
- CopyMem(rect, deferred_rect, sizeof(struct rect));
- nsobj = AddObject(g->deferred_rects, AMINS_RECT);
- nsobj->objstruct = deferred_rect;
- } else {
- LOG("Ignoring duplicate or subset of queued box redraw");
- }
- ami_schedule_redraw(g->shared, false);
-}
-
-/**
- * callback from core to reformat a window.
- */
-static void amiga_window_reformat(struct gui_window *gw)
-{
- struct IBox *bbox;
-
- LOG("reformat window %p", gw);
-
- if (gw != NULL) {
- if(ami_gui_get_space_box((Object *)gw->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
- browser_window_reformat(gw->bw, false, bbox->Width, bbox->Height);
- gw->shared->redraw_scroll = false;
- ami_gui_free_space_box(bbox);
- }
-}
-
-static void ami_do_redraw(struct gui_window_2 *gwin)
-{
- ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600;
- struct IBox *bbox;
- ULONG oldh = gwin->oldh, oldv=gwin->oldv;
- struct RastPort *temprp;
-
- if(browser_window_redraw_ready(gwin->gw->bw) == false) return;
-
- ami_get_hscroll_pos(gwin, (ULONG *)&hcurrent);
- ami_get_vscroll_pos(gwin, (ULONG *)&vcurrent);
-
- gwin->gw->scrollx = hcurrent;
- gwin->gw->scrolly = vcurrent;
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- width=bbox->Width;
- height=bbox->Height;
- xoffset=bbox->Left;
- yoffset=bbox->Top;
-
- if(gwin->redraw_scroll)
- {
- if((abs(vcurrent-oldv) > height) || (abs(hcurrent-oldh) > width))
- gwin->redraw_scroll = false;
-
- if(gwin->new_content) gwin->redraw_scroll = false;
-// if(gwin->gw->scale != 1.0) gwin->redraw_scroll = false;
- }
-
- if(gwin->redraw_scroll)
- {
- struct rect rect;
-
- gwin->gw->c_h_temp = gwin->gw->c_h;
- gui_window_remove_caret(gwin->gw);
-
- ScrollWindowRaster(gwin->win, hcurrent - oldh, vcurrent - oldv,
- xoffset, yoffset, xoffset + width - 1, yoffset + height - 1);
-
- gwin->gw->c_h = gwin->gw->c_h_temp;
-
- if(vcurrent>oldv) /* Going down */
- {
- ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, 0, height - (vcurrent - oldv) - 1);
- ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, width + 1, height + 1);
- gui_window_update_box(gwin->gw, &rect);
- }
- else if(vcurrent<oldv) /* Going up */
- {
- ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, 0, 0);
- ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, width + 1, oldv - vcurrent + 1);
- gui_window_update_box(gwin->gw, &rect);
- }
-
- if(hcurrent>oldh) /* Going right */
- {
- ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, width - (hcurrent - oldh), 0);
- ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, width + 1, height + 1);
- gui_window_update_box(gwin->gw, &rect);
- }
- else if(hcurrent<oldh) /* Going left */
- {
- ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, 0, 0);
- ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, oldh - hcurrent + 1, height + 1);
- gui_window_update_box(gwin->gw, &rect);
- }
- }
- else
- {
- struct rect clip;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot
- };
-
- glob = &browserglob;
-
- if(nsoption_bool(direct_render) == false)
- {
- ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox, &ctx);
- }
- else
- {
- browserglob.shared_pens = gwin->shared_pens;
- temprp = browserglob.rp;
- browserglob.rp = gwin->win->RPort;
- clip.x0 = bbox->Left;
- clip.y0 = bbox->Top;
- clip.x1 = bbox->Left + bbox->Width;
- clip.y1 = bbox->Top + bbox->Height;
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
-
- if(browser_window_redraw(gwin->gw->bw, clip.x0 - hcurrent, clip.y0 - vcurrent, &clip, &ctx))
- {
- ami_clearclipreg(&browserglob);
- browserglob.rp = temprp;
- }
-
- ami_reset_pointer(gwin);
- }
- /* Tell NetSurf not to bother with the next queued box redraw, as we've redrawn everything. */
- ami_gui_window_update_box_deferred(gwin->gw, false);
- }
-
- ami_update_buttons(gwin);
-
- gwin->oldh = hcurrent;
- gwin->oldv = vcurrent;
-
- gwin->redraw_scroll = false;
- gwin->redraw_required = false;
- gwin->new_content = false;
-
- ami_gui_free_space_box(bbox);
-}
-
-void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
-{
- if(gwin->objects[GID_HSCROLL])
- {
- GetAttr(SCROLLER_Top, (Object *)gwin->objects[GID_HSCROLL], xs);
- } else {
- *xs = 0;
- }
-
- *xs /= gwin->gw->scale;
-}
-
-void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
-{
- if(gwin->objects[GID_VSCROLL]) {
- GetAttr(SCROLLER_Top, gwin->objects[GID_VSCROLL], ys);
- } else {
- *ys = 0;
- }
-
- *ys /= gwin->gw->scale;
-}
-
-static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
-{
- ami_get_hscroll_pos(g->shared, (ULONG *)sx);
- ami_get_vscroll_pos(g->shared, (ULONG *)sy);
-
- return true;
-}
-
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
-{
- struct IBox *bbox;
- int width, height;
-
- if(!g) return;
- if(!g->bw || browser_window_has_content(g->bw) == false) return;
-
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if(sx < 0) sx=0;
- if(sy < 0) sy=0;
-
- browser_window_get_extents(g->bw, false, &width, &height);
-
- if(sx >= width - bbox->Width)
- sx = width - bbox->Width;
- if(sy >= height - bbox->Height)
- sy = height - bbox->Height;
-
- if(width <= bbox->Width) sx = 0;
- if(height <= bbox->Height) sy = 0;
-
- ami_gui_free_space_box(bbox);
-
- if(g == g->shared->gw) {
- if(g->shared->objects[GID_VSCROLL]) {
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],
- g->shared->win, NULL,
- SCROLLER_Top, (ULONG)(sy * g->scale),
- TAG_DONE);
- }
-
- if(g->shared->objects[GID_HSCROLL])
- {
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
- g->shared->win, NULL,
- SCROLLER_Top, (ULONG)(sx * g->scale),
- TAG_DONE);
- }
-
- ami_schedule_redraw(g->shared, true);
-
- if(nsoption_bool(faster_scroll) == true) g->shared->redraw_scroll = true;
- else g->shared->redraw_scroll = false;
-
- g->scrollx = sx;
- g->scrolly = sy;
- }
-}
-
-static void gui_window_update_extent(struct gui_window *g)
-{
- struct IBox *bbox;
-
- if(!g || !g->bw) return;
- if(browser_window_has_content(g->bw) == false) return;
-
- if(g == g->shared->gw) {
- int width, height;
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if(g->shared->objects[GID_VSCROLL]) {
- browser_window_get_extents(g->bw, true, &width, &height);
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Total, (ULONG)(height),
- SCROLLER_Visible, bbox->Height,
- TAG_DONE);
- }
-
- if(g->shared->objects[GID_HSCROLL])
- {
- browser_window_get_extents(g->bw, true, &width, &height);
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
- g->shared->win, NULL,
- SCROLLER_Total, (ULONG)(width),
- SCROLLER_Visible, bbox->Width,
- TAG_DONE);
- }
-
- ami_gui_free_space_box(bbox);
- }
-
- ami_gui_scroller_update(g->shared);
- g->shared->new_content = true;
-}
-
-static void gui_window_set_status(struct gui_window *g, const char *text)
-{
- char *utf8text;
- ULONG size;
- UWORD chars;
- struct TextExtent textex;
-
- if(!g) return;
- if(!text) return;
- if(!g->shared->objects[GID_STATUS]) return;
-
- if(g == g->shared->gw) {
- utf8text = ami_utf8_easy((char *)text);
- if(utf8text == NULL) return;
-
- GetAttr(GA_Width, g->shared->objects[GID_STATUS], (ULONG *)&size);
- chars = TextFit(&scrn->RastPort, utf8text, (UWORD)strlen(utf8text),
- &textex, NULL, 1, size - 4, scrn->RastPort.TxHeight);
-
- utf8text[chars] = 0;
-
- SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_STATUS],
- g->shared->win, NULL,
- NSA_STATUS_TEXT, utf8text,
- TAG_DONE);
-
- RefreshGList((struct Gadget *)g->shared->objects[GID_STATUS],
- g->shared->win, NULL, 1);
-
- if(g->shared->status) ami_utf8_free(g->shared->status);
- g->shared->status = utf8text;
- }
-}
-
-static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
-{
- size_t idn_url_l;
- char *idn_url_s = NULL;
- char *url_lc = NULL;
-
- if(!g) return NSERROR_OK;
-
- if(g == g->shared->gw) {
- if(nsoption_bool(display_decoded_idn) == true) {
- if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) == NSERROR_OK) {
- url_lc = ami_utf8_easy(idn_url_s);
- }
- }
-
- RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_URL],
- g->shared->win, NULL,
- STRINGA_TextVal, url_lc ? url_lc : nsurl_access(url),
- TAG_DONE);
-
- if(url_lc) {
- ami_utf8_free(url_lc);
- if(idn_url_s) free(idn_url_s);
- }
- }
-
- ami_update_buttons(g->shared);
-
- return NSERROR_OK;
-}
-
-HOOKF(uint32, ami_set_favicon_render_hook, APTR, space, struct gpRender *)
-{
- ami_schedule(0, ami_gui_refresh_favicon, hook->h_Data);
- return 0;
-}
-
-/**
- * Gui callback when search provider details are updated.
- *
- * \param provider_name The providers name.
- * \param ico_bitmap The icon bitmap representing the provider.
- * \return NSERROR_OK on success else error code.
- */
-static nserror gui_search_web_provider_update(const char *provider_name,
- struct bitmap *ico_bitmap)
-{
- struct BitMap *bm = NULL;
- struct nsObject *node;
- struct nsObject *nnode;
- struct gui_window_2 *gwin;
-
- if(IsMinListEmpty(window_list)) return NSERROR_BAD_PARAMETER;
- if(nsoption_bool(kiosk_mode) == true) return NSERROR_BAD_PARAMETER;
-
- if (ico_bitmap != NULL) {
- bm = ami_bitmap_get_native(ico_bitmap, 16, 16, NULL);
- }
-
- if(bm == NULL) return NSERROR_BAD_PARAMETER;
-
- 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->search_bm != NULL)
- DisposeObject(gwin->search_bm);
-
- ULONG bm_masking_tag = TAG_IGNORE;
-
- if(LIB_IS_AT_LEAST((struct Library *)ChooserBase, 53, 21)) {
- /* Broken in earlier versions */
- bm_masking_tag = BITMAP_Masking;
- }
-
- gwin->search_bm = BitMapObj,
- BITMAP_Screen, scrn,
- BITMAP_Width, 16,
- BITMAP_Height, 16,
- BITMAP_BitMap, bm,
- BITMAP_HasAlpha, TRUE,
- bm_masking_tag, TRUE,
- BitMapEnd;
-
- RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCH_ICON],
- gwin->win, NULL,
- GA_HintInfo, provider_name,
- GA_Image, gwin->search_bm,
- TAG_DONE);
- }
- } while((node = nnode));
-
- return NSERROR_OK;
-}
-
-HOOKF(uint32, ami_set_throbber_render_hook, APTR, space, struct gpRender *)
-{
- struct gui_window_2 *gwin = hook->h_Data;
- ami_throbber_redraw_schedule(0, gwin->gw);
- return 0;
-}
-
-static void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
- const struct rect *clip)
-{
- struct IBox *bbox;
- int xs,ys;
-
- if(!g) return;
-
- gui_window_remove_caret(g);
-
- xs = g->scrollx;
- ys = g->scrolly;
-
- SetAPen(g->shared->win->RPort,3);
-
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if((y-ys+height) > (bbox->Height)) height = bbox->Height-y+ys;
-
- if(((x-xs) <= 0) || ((x-xs+2) >= (bbox->Width)) || ((y-ys) <= 0) || ((y-ys) >= (bbox->Height))) {
- ami_gui_free_space_box(bbox);
- return;
- }
-
- g->c_w = 2;
-
- SetDrMd(g->shared->win->RPort,COMPLEMENT);
- RectFill(g->shared->win->RPort, x + bbox->Left - xs, y + bbox->Top - ys,
- x + bbox->Left + g->c_w - xs, y+bbox->Top + height - ys);
- SetDrMd(g->shared->win->RPort,JAM1);
-
- ami_gui_free_space_box(bbox);
-
- g->c_x = x;
- g->c_y = y;
- g->c_h = height;
-
- if((nsoption_bool(kiosk_mode) == false))
- OnMenu(g->shared->win, AMI_MENU_PASTE);
-}
-
-static void gui_window_remove_caret(struct gui_window *g)
-{
- if(!g) return;
- if(g->c_h == 0) return;
-
- if((nsoption_bool(kiosk_mode) == false))
- OffMenu(g->shared->win, AMI_MENU_PASTE);
-
- ami_do_redraw_limits(g, g->bw, false, g->c_x, g->c_y,
- g->c_x + g->c_w + 1, g->c_y + g->c_h + 1);
-
- g->c_h = 0;
-}
-
-static void gui_window_new_content(struct gui_window *g)
-{
- hlcache_handle *c;
-
- if(g && g->shared && g->bw && browser_window_has_content(g->bw))
- c = browser_window_get_content(g->bw);
- else return;
-
- ami_clearclipreg(&browserglob);
- g->shared->new_content = true;
- g->scrollx = 0;
- g->scrolly = 0;
- g->shared->oldh = 0;
- g->shared->oldv = 0;
- g->favicon = NULL;
- ami_plot_release_pens(g->shared->shared_pens);
- ami_menu_update_disabled(g, c);
- ami_gui_update_hotlist_button(g->shared);
- ami_gui_scroller_update(g->shared);
-}
-
-static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
- const struct rect *rect)
-{
-#ifdef __amigaos4__
- g->shared->drag_op = type;
- if(rect) g->shared->ptr_lock = ami_ns_rect_to_ibox(g->shared, rect);
-
- if(type == GDRAGGING_NONE)
- {
- SetWindowAttrs(g->shared->win, WA_GrabFocus, 0,
- WA_MouseLimits, NULL, TAG_DONE);
-
- if(g->shared->ptr_lock)
- {
- FreeVec(g->shared->ptr_lock);
- g->shared->ptr_lock = NULL;
- }
- }
-#endif
- return true;
-}
-
-/* return the text box at posn x,y in window coordinates
- x,y are updated to be document co-ordinates */
-
-bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
-{
- struct IBox *bbox;
- ULONG xs, ys;
- struct browser_window_features data;
-
- if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return false;
- }
-
- ami_get_hscroll_pos(gwin, (ULONG *)&xs);
- *x = *x - (bbox->Left) +xs;
-
- ami_get_vscroll_pos(gwin, (ULONG *)&ys);
- *y = *y - (bbox->Top) + ys;
-
- ami_gui_free_space_box(bbox);
-
- browser_window_get_features(gwin->gw->bw, *x, *y, &data);
-
- if (data.form_features == CTX_FORM_TEXT)
- return true;
-
- return false;
-}
-
-BOOL ami_gadget_hit(Object *obj, int x, int y)
-{
- int top, left, width, height;
-
- GetAttrs(obj,
- GA_Left, &left,
- GA_Top, &top,
- GA_Width, &width,
- GA_Height, &height,
- TAG_DONE);
-
- if((x >= left) && (x <= (left + width)) && (y >= top) && (y <= (top + height)))
- return TRUE;
- else return FALSE;
-}
-
-Object *ami_gui_splash_open(void)
-{
- Object *win_obj, *bm_obj;
- struct Window *win;
- struct Screen *wbscreen = LockPubScreen("Workbench");
- uint32 top = 0, left = 0;
- STRPTR ver_string;
- struct TextAttr tattr;
- struct TextFont *tfont;
-
- win_obj = WindowObj,
-#ifdef __amigaos4__
- WA_ToolBox, TRUE,
-#endif
- WA_Borderless, TRUE,
- WA_BusyPointer, TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_LockWidth, TRUE,
- WINDOW_LockHeight, TRUE,
- WINDOW_ParentGroup, LayoutVObj,
- LAYOUT_AddImage, bm_obj = BitMapObj,
- BITMAP_SourceFile, "PROGDIR:Resources/splash.png",
- BITMAP_Screen, wbscreen,
- BITMAP_Precision, PRECISION_IMAGE,
- BitMapEnd,
- LayoutEnd,
- EndWindow;
-
- LOG("Attempting to open splash window...");
- win = RA_OpenWindow(win_obj);
-
- GetAttrs(bm_obj, IA_Top, &top,
- IA_Left, &left,
- TAG_DONE);
-
- SetDrMd(win->RPort, JAM1);
-#ifdef __amigaos4__
- SetRPAttrs(win->RPort, RPTAG_APenColor, 0xFF3F6DFE, TAG_DONE);
- tattr.ta_Name = "DejaVu Serif Italic.font";
-#else
- SetAPen(win->RPort, 3); /* Pen 3 is usually blue */
- tattr.ta_Name = "ruby.font";
-#endif
- tattr.ta_YSize = 24;
- tattr.ta_Style = 0;
- tattr.ta_Flags = 0;
-
- if((tfont = ami_font_open_disk_font(&tattr)))
- {
- SetFont(win->RPort, tfont);
- }
- else
- {
- tattr.ta_Name = "DejaVu Serif Oblique.font";
- if((tfont = ami_font_open_disk_font(&tattr)))
- SetFont(win->RPort, tfont);
- }
-
- Move(win->RPort, left + 5, top + 25);
- Text(win->RPort, "Initialising...", strlen("Initialising..."));
-
- if(tfont) ami_font_close_disk_font(tfont);
-
-#ifdef __amigaos4__
- tattr.ta_Name = "DejaVu Sans.font";
-#else
- tattr.ta_Name = "helvetica.font";
-#endif
- tattr.ta_YSize = 16;
- tattr.ta_Style = 0;
- tattr.ta_Flags = 0;
-
- if((tfont = ami_font_open_disk_font(&tattr)))
- SetFont(win->RPort, tfont);
-
- ver_string = ASPrintf("%s", netsurf_version);
-
- Move(win->RPort, left + 185, top + 220);
- Text(win->RPort, ver_string, strlen(ver_string));
-
- if(ver_string) FreeVec(ver_string);
- if(tfont) ami_font_close_disk_font(tfont);
-
- UnlockPubScreen(NULL, wbscreen);
-
- return win_obj;
-}
-
-void ami_gui_splash_close(Object *win_obj)
-{
- if(win_obj == NULL) return;
-
- LOG("Closing splash window");
- DisposeObject(win_obj);
-}
-
-static void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
- struct form_control *gadget)
-{
- LOG("File open dialog request for %p/%p", g, gadget);
-
- if(AslRequestTags(filereq,
- ASLFR_Window, g->shared->win,
- ASLFR_SleepWindow, TRUE,
- ASLFR_TitleText, messages_get("NetSurf"),
- ASLFR_Screen, scrn,
- ASLFR_DoSaveMode, FALSE,
- TAG_DONE)) {
- char fname[1024];
- strlcpy(fname, filereq->fr_Drawer, 1024);
- AddPart(fname, filereq->fr_File, 1024);
- browser_window_set_gadget_filename(g->bw, gadget, fname);
- }
-}
-
-/* exported function documented in amiga/gui.h */
-uint32 ami_gui_get_app_id(void)
-{
- return ami_appid;
-}
-
-static struct gui_window_table amiga_window_table = {
- .create = gui_window_create,
- .destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
- .get_scroll = gui_window_get_scroll,
- .set_scroll = gui_window_set_scroll,
- .get_dimensions = gui_window_get_dimensions,
- .update_extent = gui_window_update_extent,
- .reformat = amiga_window_reformat,
-
- .set_icon = gui_window_set_icon,
- .set_title = gui_window_set_title,
- .set_url = gui_window_set_url,
- .set_status = gui_window_set_status,
- .place_caret = gui_window_place_caret,
- .remove_caret = gui_window_remove_caret,
- .drag_start = gui_window_drag_start,
- .new_content = gui_window_new_content,
- .create_form_select_menu = gui_create_form_select_menu,
- .file_gadget_open = gui_file_gadget_open,
- .drag_save_object = gui_drag_save_object,
- .drag_save_selection =gui_drag_save_selection,
- .start_selection = gui_start_selection,
-
- /* from theme */
- .set_pointer = gui_window_set_pointer,
- .start_throbber = gui_window_start_throbber,
- .stop_throbber = gui_window_stop_throbber,
-
- /* from download */
- .save_link = gui_window_save_link,
-};
-
-
-static struct gui_fetch_table amiga_fetch_table = {
- .filetype = fetch_filetype,
-
- .get_resource_url = gui_get_resource_url,
-};
-
-static struct gui_search_web_table amiga_search_web_table = {
- .provider_update = gui_search_web_provider_update,
-};
-
-static struct gui_misc_table amiga_misc_table = {
- .schedule = ami_schedule,
- .warning = amiga_warn_user,
-
- .quit = gui_quit,
- .launch_url = gui_launch_url,
- .cert_verify = gui_cert_verify,
- .login = gui_401login_open,
-};
-
-/** Normal entry point from OS */
-int main(int argc, char** argv)
-{
- setbuf(stderr, NULL);
- char messages[100];
- char script[1024];
- char temp[1024];
- STRPTR current_user_cache = NULL;
- BPTR lock = 0;
- int32 user = 0;
- nserror ret;
- int nargc = 0;
- char *nargv = NULL;
-
- struct netsurf_table amiga_table = {
- .misc = &amiga_misc_table,
- .window = &amiga_window_table,
- .clipboard = amiga_clipboard_table,
- .download = amiga_download_table,
- .fetch = &amiga_fetch_table,
- .file = amiga_file_table,
- .utf8 = amiga_utf8_table,
- .search = amiga_search_table,
- .search_web = &amiga_search_web_table,
- .llcache = filesystem_llcache_table,
- .bitmap = amiga_bitmap_table,
- .layout = ami_layout_table,
- };
-
-#ifdef __amigaos4__
- signal(SIGINT, SIG_IGN);
-#endif
- ret = netsurf_register(&amiga_table);
- if (ret != NSERROR_OK) {
- ami_misc_fatal_error("NetSurf operation table failed registration");
- return RETURN_FAIL;
- }
-
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(NULL, &argc, argv);
-
- /* Need to do this before opening any splash windows etc... */
- if ((ami_libs_open() == false)) {
- return RETURN_FAIL;
- }
-
- /* Open splash window */
- Object *splash_window = ami_gui_splash_open();
-
- ami_object_init();
-
- if (ami_open_resources() == false) { /* alloc message ports */
- ami_misc_fatal_error("Unable to allocate resources");
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
-
- if(ami_schedule_create(schedulermsgport) != NSERROR_OK) {
- ami_misc_fatal_error("Failed to initialise scheduler");
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
-
- ami_gui_read_all_tooltypes(argc, argv);
- struct RDArgs *args = ami_gui_commandline(&argc, argv, &nargc, &nargv);
-
- if(current_user == NULL) {
- user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
- current_user = ASPrintf("%s", (user == -1) ? "Default" : temp);
- }
- LOG("User: %s", current_user);
-
- if(users_dir == NULL) {
- users_dir = ASPrintf("%s", USERS_DIR);
- if(users_dir == NULL) {
- ami_misc_fatal_error("Failed to allocate memory");
- ami_schedule_free();
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
- }
-
- if(LIB_IS_AT_LEAST((struct Library *)DOSBase, 51, 96)) {
-#ifdef __amigaos4__
- struct InfoData *infodata = AllocDosObject(DOS_INFODATA, 0);
- if(infodata == NULL) {
- ami_misc_fatal_error("Failed to allocate memory");
- ami_schedule_free();
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
- GetDiskInfoTags(GDI_StringNameInput, users_dir,
- GDI_InfoData, infodata,
- TAG_DONE);
- if(infodata->id_DiskState == ID_DISKSTATE_WRITE_PROTECTED) {
- FreeDosObject(DOS_INFODATA, infodata);
- ami_misc_fatal_error("User directory MUST be on a writeable volume");
- ami_schedule_free();
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
- FreeDosObject(DOS_INFODATA, infodata);
-#else
-#warning FIXME for OS3 and older OS4
-#endif
- } else {
-//TODO: check volume write status using old API
- }
-
- int len = strlen(current_user);
- len += strlen(users_dir);
- len += 2; /* for poss path sep and NULL term */
-
- current_user_dir = AllocVecTagList(len, NULL);
- if(current_user_dir == NULL) {
- ami_misc_fatal_error("Failed to allocate memory");
- ami_schedule_free();
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
-
- strlcpy(current_user_dir, users_dir, len);
- AddPart(current_user_dir, current_user, len);
- FreeVec(users_dir);
- LOG("User dir: %s", current_user_dir);
-
- if((lock = CreateDirTree(current_user_dir)))
- UnLock(lock);
-
- current_user_options = ASPrintf("%s/Choices", current_user_dir);
- current_user_cache = ASPrintf("%s/Cache", current_user_dir);
- current_user_faviconcache = ASPrintf("%s/IconCache", current_user_dir);
-
- if((lock = CreateDirTree(current_user_cache))) UnLock(lock);
- if((lock = CreateDirTree(current_user_faviconcache))) UnLock(lock);
-
- ami_mime_init("PROGDIR:Resources/mimetypes");
- sprintf(temp, "%s/mimetypes.user", current_user_dir);
- ami_mime_init(temp);
-
-#ifdef __amigaos4__
- amiga_plugin_hack_init();
-
- /* DataTypes loader needs datatypes.library v45,
- * but for some reason that's not in OS3.9.
- * Skip it to ensure it isn't causing other problems. */
- ret = amiga_datatypes_init();
-#endif
-
- /* user options setup */
- ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- ami_misc_fatal_error("Options failed to initialise");
- ami_schedule_free();
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
- nsoption_read(current_user_options, NULL);
- if(args != NULL) {
- nsoption_commandline(&nargc, &nargv, NULL);
- FreeArgs(args);
- }
-
- if (ami_locate_resource(messages, "Messages") == false) {
- ami_misc_fatal_error("Cannot open Messages file");
- ami_schedule_free();
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
-
- ret = messages_add_from_file(messages);
-
- ret = netsurf_init(current_user_cache);
- if (ret != NSERROR_OK) {
- ami_misc_fatal_error("NetSurf failed to initialise");
- ami_schedule_free();
- ami_gui_splash_close(splash_window);
- ami_libs_close();
- return RETURN_FAIL;
- }
-
- if(current_user_cache != NULL) FreeVec(current_user_cache);
- ret = amiga_icon_init();
-
- search_web_init(nsoption_charp(search_engines_file));
- ami_clipboard_init();
- ami_openurl_open();
- ami_amiupdate(); /* set env-vars for AmiUpdate */
- ami_font_init();
- save_complete_init();
- ami_theme_init();
- ami_init_mouse_pointers();
- ami_file_req_init();
-
- win_destroyed = false;
- ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
-
- window_list = NewObjList();
-
- urldb_load(nsoption_charp(url_file));
- urldb_load_cookies(nsoption_charp(cookie_file));
-
- gui_init2(argc, argv);
-
- ami_ctxmenu_init(); /* Requires screen pointer */
-
- ami_gui_splash_close(splash_window);
-
- strlcpy(script, nsoption_charp(arexx_dir), 1024);
- AddPart(script, nsoption_charp(arexx_startup), 1024);
- ami_arexx_execute(script);
-
- LOG("Entering main loop");
-
- while (!ami_quit) {
- ami_get_msg();
- }
-
- strlcpy(script, nsoption_charp(arexx_dir), 1024);
- AddPart(script, nsoption_charp(arexx_shutdown), 1024);
- ami_arexx_execute(script);
-
- ami_mime_free();
-
- netsurf_exit();
-
- FreeVec(current_user_options);
- FreeVec(current_user_dir);
- FreeVec(current_user_faviconcache);
- FreeVec(current_user);
-
- ami_clipboard_free();
- ami_schedule_free();
-
- FreeSysObject(ASOT_PORT, appport);
- FreeSysObject(ASOT_PORT, sport);
- FreeSysObject(ASOT_PORT, schedulermsgport);
-
- ami_object_fini();
- ami_bitmap_fini();
-
- LOG("Closing screen");
- ami_gui_close_screen(scrn, locked_screen, FALSE);
- if(nsscreentitle) FreeVec(nsscreentitle);
-
- ami_libs_close();
-
- return RETURN_OK;
-}
-
diff --git a/amiga/gui.h b/amiga/gui.h
deleted file mode 100644
index d301ac574..000000000
--- a/amiga/gui.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 2008-2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_GUI_H
-#define AMIGA_GUI_H
-
-#include <stdbool.h>
-#include <graphics/rastport.h>
-#include <intuition/classusr.h>
-#include <dos/dos.h>
-#include <devices/inputevent.h>
-
-#include "desktop/gui_window.h"
-#include "desktop/mouse.h"
-
-#include "amiga/menu.h"
-#include "amiga/object.h"
-#include "amiga/os3support.h"
-#include "amiga/plotters.h"
-
-#ifdef __amigaos4__
-#define HOOKF(ret,func,type,ptr,msgtype) static ret func(struct Hook *hook, type ptr, msgtype msg)
-#else
-#define HOOKF(ret,func,type,ptr,msgtype) static ASM ret func(REG(a0, struct Hook *hook),REG(a2, type ptr), REG(a1, msgtype msg))
-#endif
-
-enum
-{
- OID_MAIN = 0,
- OID_VSCROLL,
- OID_HSCROLL,
- OID_LAST, /* for compatibility */
- GID_MAIN,
- GID_TABLAYOUT,
- GID_BROWSER,
- GID_STATUS,
- GID_URL,
- GID_ICON,
- GID_STOP,
- GID_RELOAD,
- GID_HOME,
- GID_BACK,
- GID_FORWARD,
- GID_THROBBER,
- GID_SEARCH_ICON,
- GID_FAVE,
- GID_FAVE_ADD,
- GID_FAVE_RMV,
- GID_CLOSETAB,
- GID_CLOSETAB_BM,
- GID_ADDTAB,
- GID_ADDTAB_BM,
- GID_TABS,
- GID_TABS_FLAG,
- GID_USER,
- GID_PASS,
- GID_LOGIN,
- GID_CANCEL,
- GID_NEXT,
- GID_PREV,
- GID_SEARCHSTRING,
- GID_SHOWALL,
- GID_CASE,
- GID_TOOLBARLAYOUT,
- GID_HOTLIST,
- GID_HOTLISTLAYOUT,
- GID_HOTLISTSEPBAR,
- GID_HSCROLL,
- GID_HSCROLLLAYOUT,
- GID_VSCROLL,
- GID_VSCROLLLAYOUT,
- GID_LAST
-};
-
-struct find_window;
-struct history_window;
-
-#define AMI_GUI_TOOLBAR_MAX 20
-
-struct gui_window_2 {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_LAST];
- struct gui_window *gw; /* currently-displayed gui_window */
- bool redraw_required;
- int throbber_frame;
- struct List tab_list;
- ULONG tabs;
- ULONG next_tab;
- struct Hook scrollerhook;
- struct form_control *control;
- browser_mouse_state mouse_state;
- browser_mouse_state key_state;
- ULONG throbber_update_count;
- struct find_window *searchwin;
- ULONG oldh;
- ULONG oldv;
- int temp;
- bool redraw_scroll;
- bool new_content;
- char *menulab[AMI_MENU_AREXX_MAX + 1];
- Object *menuobj[AMI_MENU_AREXX_MAX + 1];
- char menukey[AMI_MENU_AREXX_MAX + 1];
- char *menuicon[AMI_MENU_AREXX_MAX + 1];
- struct Hook menu_hook[AMI_MENU_AREXX_MAX + 1];
- UBYTE *menutype;
- struct NewMenu *menu;
- ULONG hotlist_items;
- Object *hotlist_toolbar_lab[AMI_GUI_TOOLBAR_MAX];
- struct List hotlist_toolbar_list;
- struct List *web_search_list;
- Object *search_bm;
- char *svbuffer;
- char *status;
- char *wintitle;
- char *helphints[GID_LAST];
- browser_mouse_state prev_mouse_state;
- struct timeval lastclick;
- struct AppIcon *appicon; /* iconify appicon */
- struct DiskObject *dobj; /* iconify appicon */
- struct Hook favicon_hook;
- struct Hook throbber_hook;
- struct Hook *ctxmenu_hook;
- Object *history_ctxmenu[2];
- Object *clicktab_ctxmenu;
- gui_drag_type drag_op;
- struct IBox *ptr_lock;
- struct AppWindow *appwin;
- struct MinList *shared_pens;
- gui_pointer_shape mouse_pointer;
- struct Menu *imenu; /* Intuition menu */
- struct VisualInfo *vi; /* For GadTools menu */
-};
-
-struct gui_window
-{
- struct gui_window_2 *shared;
- int tab;
- struct Node *tab_node;
- struct Node *last_new_tab;
- int c_x; /* Caret X posn */
- int c_y; /* Caret Y posn */
- int c_w; /* Caret width */
- int c_h; /* Caret height */
- int c_h_temp;
- int scrollx;
- int scrolly;
- struct history_window *hw;
- struct List dllist;
- struct hlcache_handle *favicon;
- bool throbbing;
- char *tabtitle;
- APTR deferred_rects_pool;
- struct MinList *deferred_rects;
- struct browser_window *bw;
- float scale;
-};
-
-void ami_get_msg(void);
-void ami_try_quit(void);
-void ami_quit_netsurf(void);
-void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw);
-STRPTR ami_locale_langs(void);
-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_mouse_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y,
- int mouse_x, int mouse_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_update_all(void);
-void ami_gui_tabs_toggle_all(void);
-bool ami_locate_resource(char *fullpath, const char *file);
-void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
-nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
-char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
-int ami_gui_count_windows(int window, int *tabs);
-void ami_gui_set_scale(struct gui_window *gw, float scale);
-
-
-/**
- * Close a window and all tabs attached to it.
- *
- * @param gwin gui_window_2 to act upon.
- */
-void ami_gui_close_window(struct gui_window_2 *gwin);
-
-/**
- * Close all tabs in a window except the active one.
- *
- * @param gwin gui_window_2 to act upon.
- */
-void ami_gui_close_inactive_tabs(struct gui_window_2 *gwin);
-
-/**
- * Compatibility function to get space.gadget render area.
- *
- * @param obj A space.gadget object.
- * @param bbox A pointer to a struct IBox *.
- * @return error status.
- */
-nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox);
-
-/**
- * Free any data obtained via ami_gui_get_space_box().
- *
- * @param bbox A pointer to a struct IBox.
- */
-void ami_gui_free_space_box(struct IBox *bbox);
-
-/**
- * Get the application.library ID NetSurf is registered as.
- *
- * @return App ID.
- */
-uint32 ami_gui_get_app_id(void);
-
-/**
- * Get the string for NetSurf's screen titlebar.
- *
- * @return String to use as the screen's titlebar text.
- */
-STRPTR ami_gui_get_screen_title(void);
-
-struct MinList *window_list;
-struct Screen *scrn;
-struct MsgPort *sport;
-struct gui_window *cur_gw;
-struct gui_globals browserglob;
-BOOL ami_autoscroll;
-#endif
-
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
deleted file mode 100755
index 221b0da95..000000000
--- a/amiga/gui_options.c
+++ /dev/null
@@ -1,2316 +0,0 @@
-/*
- * Copyright 2009 - 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdbool.h>
-#include <string.h>
-#include <stdlib.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-#ifdef __amigaos4__
-#include <proto/application.h>
-#endif
-#include <libraries/gadtools.h>
-#include <exec/types.h>
-#include <intuition/classusr.h>
-#include <graphics/gfxbase.h>
-
-#include <proto/window.h>
-#include <proto/layout.h>
-#include <proto/button.h>
-#include <proto/clicktab.h>
-#include <proto/label.h>
-#include <proto/string.h>
-#include <proto/checkbox.h>
-#include <proto/radiobutton.h>
-#include <proto/getscreenmode.h>
-#include <proto/getfile.h>
-#include <proto/chooser.h>
-#include <proto/integer.h>
-#include <proto/getfont.h>
-#include <classes/window.h>
-#include <images/label.h>
-#include <gadgets/button.h>
-#include <gadgets/clicktab.h>
-#include <gadgets/string.h>
-#include <gadgets/checkbox.h>
-#include <gadgets/radiobutton.h>
-#include <gadgets/getscreenmode.h>
-#include <gadgets/getfile.h>
-#include <gadgets/chooser.h>
-#include <gadgets/integer.h>
-#include <gadgets/getfont.h>
-#include <reaction/reaction.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/nsurl.h"
-#include "utils/messages.h"
-#include "utils/nsoption.h"
-#include "desktop/browser.h"
-#include "desktop/searchweb.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/file.h"
-#include "amiga/font.h"
-#include "amiga/font_bullet.h"
-#include "amiga/gui.h"
-#include "amiga/gui_options.h"
-#include "amiga/help.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "amiga/selectmenu.h"
-#include "amiga/theme.h"
-#include "amiga/utf8.h"
-
-enum
-{
- GID_OPTS_MAIN = GID_MAIN,
- GID_OPTS_HOMEPAGE,
- GID_OPTS_HOMEPAGE_DEFAULT,
- GID_OPTS_HOMEPAGE_CURRENT,
- GID_OPTS_HOMEPAGE_BLANK,
- GID_OPTS_HIDEADS,
- GID_OPTS_CONTENTLANG,
- GID_OPTS_FROMLOCALE,
- GID_OPTS_HISTORY,
- GID_OPTS_JAVASCRIPT,
- GID_OPTS_REFERRAL,
- GID_OPTS_DONOTTRACK,
- GID_OPTS_FASTSCROLL,
- GID_OPTS_SCREEN,
- GID_OPTS_SCREENMODE,
- GID_OPTS_SCREENNAME,
- GID_OPTS_WIN_SIMPLE,
- GID_OPTS_THEME,
- GID_OPTS_PTRTRUE,
- GID_OPTS_PTROS,
- GID_OPTS_PROXY,
- GID_OPTS_PROXY_HOST,
- GID_OPTS_PROXY_PORT,
- GID_OPTS_PROXY_USER,
- GID_OPTS_PROXY_PASS,
- GID_OPTS_PROXY_BYPASS,
- GID_OPTS_FETCHMAX,
- GID_OPTS_FETCHHOST,
- GID_OPTS_FETCHCACHE,
- GID_OPTS_NATIVEBM,
- GID_OPTS_SCALEQ,
- GID_OPTS_DITHERQ,
- GID_OPTS_ANIMSPEED,
- GID_OPTS_ANIMDISABLE,
- GID_OPTS_DPI_Y,
- GID_OPTS_FONT_SANS,
- GID_OPTS_FONT_SERIF,
- GID_OPTS_FONT_MONO,
- GID_OPTS_FONT_CURSIVE,
- GID_OPTS_FONT_FANTASY,
- GID_OPTS_FONT_DEFAULT,
- GID_OPTS_FONT_SIZE,
- GID_OPTS_FONT_MINSIZE,
- GID_OPTS_FONT_ANTIALIASING,
- GID_OPTS_FONT_BITMAP,
- GID_OPTS_CACHE_MEM,
- GID_OPTS_CACHE_DISC,
- GID_OPTS_OVERWRITE,
- GID_OPTS_NOTIFY,
- GID_OPTS_DLDIR,
- 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_SELECTMENU,
- GID_OPTS_STARTUP_NO_WIN,
- GID_OPTS_CLOSE_NO_QUIT,
- GID_OPTS_DOCKY,
- GID_OPTS_MARGIN_TOP,
- GID_OPTS_MARGIN_LEFT,
- GID_OPTS_MARGIN_BOTTOM,
- GID_OPTS_MARGIN_RIGHT,
- GID_OPTS_EXPORT_SCALE,
- GID_OPTS_EXPORT_NOIMAGES,
- GID_OPTS_EXPORT_NOBKG,
- GID_OPTS_EXPORT_LOOSEN,
- GID_OPTS_EXPORT_COMPRESS,
- GID_OPTS_EXPORT_PASSWORD,
- GID_OPTS_SAVE,
- GID_OPTS_USE,
- GID_OPTS_CANCEL,
- GID_OPTS_LAST
-};
-
-enum
-{
- GRP_OPTS_HOMEPAGE = GID_OPTS_LAST,
- GRP_OPTS_CONTENTBLOCKING,
- GRP_OPTS_CONTENTLANGUAGE,
- GRP_OPTS_HISTORY,
- GRP_OPTS_SCRIPTING,
- GRP_OPTS_PRIVACY,
- GRP_OPTS_MISC,
- GRP_OPTS_SCREEN,
- GRP_OPTS_WINDOW,
- GRP_OPTS_THEME,
- GRP_OPTS_MOUSE,
- GRP_OPTS_PROXY,
- GRP_OPTS_FETCHING,
- GRP_OPTS_IMAGES,
- GRP_OPTS_ANIMS,
- GRP_OPTS_DPI,
- GRP_OPTS_FONTFACES,
- GRP_OPTS_FONTSIZE,
- GRP_OPTS_MEMCACHE,
- GRP_OPTS_DISCCACHE,
- GRP_OPTS_DOWNLOADS,
- GRP_OPTS_TABS,
- GRP_OPTS_SEARCH,
- GRP_OPTS_CLIPBOARD,
- GRP_OPTS_BEHAVIOUR,
- GRP_OPTS_MARGINS,
- GRP_OPTS_SCALING,
- GRP_OPTS_APPEARANCE,
- GRP_OPTS_ADVANCED,
- GRP_OPTS_LAST
-};
-
-enum
-{
- LAB_OPTS_WINTITLE = GRP_OPTS_LAST,
- LAB_OPTS_RESTART,
- LAB_OPTS_DAYS,
- LAB_OPTS_SECS,
- LAB_OPTS_PT,
- LAB_OPTS_MB,
- LAB_OPTS_MM,
- LAB_OPTS_DPI,
- LAB_OPTS_LAST
-};
-
-#define OPTS_LAST LAB_OPTS_LAST
-#define OPTS_MAX_TABS 10
-#define OPTS_MAX_SCREEN 4
-#define OPTS_MAX_PROXY 5
-#define OPTS_MAX_NATIVEBM 4
-#define OPTS_MAX_DITHER 4
-
-enum {
- NSA_LIST_CLICKTAB = 0,
- NSA_LIST_CHOOSER,
- NSA_LIST_RADIO,
-};
-
-struct ami_gui_opts_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_OPTS_LAST];
-#ifndef __amigaos4__
- struct List clicktablist;
- struct List screenoptslist;
- struct List proxyoptslist;
- struct List nativebmoptslist;
- struct List ditheroptslist;
- struct List fontoptslist;
-#endif
-};
-
-static struct ami_gui_opts_window *gow = NULL;
-
-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];
-struct List *websearch_list;
-
-#ifndef __amigaos4__
-static void ami_gui_opts_array_to_list(struct List *list, const char *array[], int type)
-{
- int i = 0;
- struct Node *node;
-
- NewList(list);
-
- do {
- switch(type) {
- case NSA_LIST_CLICKTAB:
- node = AllocClickTabNode(TNA_Text, array[i], TNA_Number, i, TAG_DONE);
- break;
- case NSA_LIST_CHOOSER:
- node = AllocChooserNode(CNA_Text, array[i], TAG_DONE);
- break;
- case NSA_LIST_RADIO:
- /* Note: RBNA_Labels is RBNA_Label in OS4
- * Also note: These labels don't work (FIXME) */
- node = AllocRadioButtonNode(RBNA_Labels, array[i], TAG_DONE);
- break;
- default:
- break;
- }
- AddTail(list, node);
- i++;
- } while (array[i] != 0);
-}
-
-static void ami_gui_opts_free_list(struct List *list, int type)
-{
- struct Node *node;
- struct Node *nnode;
-
- if(IsListEmpty((struct List *)list)) return;
- node = GetHead((struct List *)list);
-
- do {
- nnode = GetSucc(node);
- Remove(node);
- if(node) {
- switch(type) {
- case NSA_LIST_CLICKTAB:
- FreeClickTabNode(node);
- break;
- case NSA_LIST_CHOOSER:
- FreeChooserNode(node);
- break;
- case NSA_LIST_RADIO:
- FreeRadioButtonNode(node);
- break;
- default:
- break;
- }
- }
- } while((node = nnode));
-}
-#endif
-
-static void ami_gui_opts_setup(struct ami_gui_opts_window *gow)
-{
- tabs[0] = (char *)ami_utf8_easy((char *)messages_get("con_general"));
- tabs[1] = (char *)ami_utf8_easy((char *)messages_get("Display"));
- tabs[2] = (char *)ami_utf8_easy((char *)messages_get("con_connect"));
- 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("Tabs"));
- tabs[7] = (char *)ami_utf8_easy((char *)messages_get("con_advanced"));
-#ifdef WITH_PDF_EXPORT
- tabs[8] = (char *)ami_utf8_easy((char *)messages_get("Export"));
- tabs[9] = NULL;
-#else
- tabs[8] = NULL;
-#endif
-
- screenopts[0] = (char *)ami_utf8_easy((char *)messages_get("ScreenOwn"));
- screenopts[1] = (char *)ami_utf8_easy((char *)messages_get("ScreenWB"));
- screenopts[2] = (char *)ami_utf8_easy((char *)messages_get("ScreenPublic"));
- screenopts[3] = NULL;
-
- proxyopts[0] = (char *)ami_utf8_easy((char *)messages_get("ProxyNone"));
- proxyopts[1] = (char *)ami_utf8_easy((char *)messages_get("ProxyNoAuth"));
- proxyopts[2] = (char *)ami_utf8_easy((char *)messages_get("ProxyBasic"));
- proxyopts[3] = (char *)ami_utf8_easy((char *)messages_get("ProxyNTLM"));
- proxyopts[4] = NULL;
-
- nativebmopts[0] = (char *)ami_utf8_easy((char *)messages_get("None"));
- nativebmopts[1] = (char *)ami_utf8_easy((char *)messages_get("Scaled"));
- 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"));
- gadlab[GID_OPTS_HOMEPAGE_DEFAULT] = (char *)ami_utf8_easy((char *)messages_get("HomePageDefault"));
- gadlab[GID_OPTS_HOMEPAGE_CURRENT] = (char *)ami_utf8_easy((char *)messages_get("HomePageCurrent"));
- gadlab[GID_OPTS_HOMEPAGE_BLANK] = (char *)ami_utf8_easy((char *)messages_get("HomePageBlank"));
- gadlab[GID_OPTS_HIDEADS] = (char *)ami_utf8_easy((char *)messages_get("BlockAds"));
- gadlab[GID_OPTS_FROMLOCALE] = (char *)ami_utf8_easy((char *)messages_get("LocaleLang"));
- gadlab[GID_OPTS_HISTORY] = (char *)ami_utf8_easy((char *)messages_get("HistoryAge"));
- gadlab[GID_OPTS_JAVASCRIPT] = (char *)ami_utf8_easy((char *)messages_get("EnableJS"));
- 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"));
- gadlab[GID_OPTS_PROXY_HOST] = (char *)ami_utf8_easy((char *)messages_get("Host"));
- gadlab[GID_OPTS_PROXY_USER] = (char *)ami_utf8_easy((char *)messages_get("Username"));
- gadlab[GID_OPTS_PROXY_PASS] = (char *)ami_utf8_easy((char *)messages_get("Password"));
- gadlab[GID_OPTS_PROXY_BYPASS] = (char *)ami_utf8_easy((char *)messages_get("ProxyBypass"));
- gadlab[GID_OPTS_FETCHMAX] = (char *)ami_utf8_easy((char *)messages_get("FetchesMax"));
- gadlab[GID_OPTS_FETCHHOST] = (char *)ami_utf8_easy((char *)messages_get("FetchesHost"));
- gadlab[GID_OPTS_FETCHCACHE] = (char *)ami_utf8_easy((char *)messages_get("FetchesCached"));
- 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"));
- gadlab[GID_OPTS_FONT_SANS] = (char *)ami_utf8_easy((char *)messages_get("FontSans"));
- gadlab[GID_OPTS_FONT_SERIF] = (char *)ami_utf8_easy((char *)messages_get("FontSerif"));
- gadlab[GID_OPTS_FONT_MONO] = (char *)ami_utf8_easy((char *)messages_get("FontMono"));
- gadlab[GID_OPTS_FONT_CURSIVE] = (char *)ami_utf8_easy((char *)messages_get("FontCursive"));
- gadlab[GID_OPTS_FONT_FANTASY] = (char *)ami_utf8_easy((char *)messages_get("FontFantasy"));
- 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_FONT_BITMAP] = (char *)ami_utf8_easy((char *)messages_get("FontBitmap"));
- 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("Size"));
- gadlab[GID_OPTS_OVERWRITE] = (char *)ami_utf8_easy((char *)messages_get("ConfirmOverwrite"));
- gadlab[GID_OPTS_NOTIFY] = (char *)ami_utf8_easy((char *)messages_get("DownloadNotify"));
- gadlab[GID_OPTS_DLDIR] = (char *)ami_utf8_easy((char *)messages_get("DownloadDir"));
- 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_SELECTMENU] = (char *)ami_utf8_easy((char *)messages_get("PopupMenu"));
- gadlab[GID_OPTS_STARTUP_NO_WIN] = (char *)ami_utf8_easy((char *)messages_get("OptionNoWindow"));
- gadlab[GID_OPTS_CLOSE_NO_QUIT] = (char *)ami_utf8_easy((char *)messages_get("OptionNoQuit"));
- gadlab[GID_OPTS_DOCKY] = (char *)ami_utf8_easy((char *)messages_get("OptionDocky"));
- gadlab[GID_OPTS_MARGIN_TOP] = (char *)ami_utf8_easy((char *)messages_get("Top"));
- gadlab[GID_OPTS_MARGIN_LEFT] = (char *)ami_utf8_easy((char *)messages_get("Left"));
- gadlab[GID_OPTS_MARGIN_RIGHT] = (char *)ami_utf8_easy((char *)messages_get("Right"));
- gadlab[GID_OPTS_MARGIN_BOTTOM] = (char *)ami_utf8_easy((char *)messages_get("Bottom"));
- gadlab[GID_OPTS_EXPORT_SCALE] = (char *)ami_utf8_easy((char *)messages_get("Scale"));
- gadlab[GID_OPTS_EXPORT_NOIMAGES] = (char *)ami_utf8_easy((char *)messages_get("SuppressImages"));
- gadlab[GID_OPTS_EXPORT_NOBKG] = (char *)ami_utf8_easy((char *)messages_get("RemoveBackground"));
- gadlab[GID_OPTS_EXPORT_LOOSEN] = (char *)ami_utf8_easy((char *)messages_get("FitPage"));
- gadlab[GID_OPTS_EXPORT_COMPRESS] = (char *)ami_utf8_easy((char *)messages_get("CompressPDF"));
- gadlab[GID_OPTS_EXPORT_PASSWORD] = (char *)ami_utf8_easy((char *)messages_get("SetPassword"));
- gadlab[GID_OPTS_SAVE] = (char *)ami_utf8_easy((char *)messages_get("SelSave"));
- gadlab[GID_OPTS_USE] = (char *)ami_utf8_easy((char *)messages_get("Use"));
- gadlab[GID_OPTS_CANCEL] = (char *)ami_utf8_easy((char *)messages_get("Cancel"));
-
- gadlab[LAB_OPTS_WINTITLE] = (char *)ami_utf8_easy((char *)messages_get("Preferences"));
- gadlab[LAB_OPTS_RESTART] = (char *)ami_utf8_easy((char *)messages_get("NeedRestart"));
- gadlab[LAB_OPTS_DAYS] = (char *)ami_utf8_easy((char *)messages_get("Days"));
- gadlab[LAB_OPTS_SECS] = (char *)ami_utf8_easy((char *)messages_get("AnimSpeedFrames"));
- gadlab[LAB_OPTS_PT] = (char *)ami_utf8_easy((char *)messages_get("Pt"));
- gadlab[LAB_OPTS_MM] = (char *)ami_utf8_easy((char *)messages_get("MM"));
- gadlab[LAB_OPTS_MB] = (char *)ami_utf8_easy((char *)messages_get("MBytes"));
- gadlab[LAB_OPTS_DPI] = (char *)ami_utf8_easy((char *)messages_get("DPI"));
-
- gadlab[GRP_OPTS_HOMEPAGE] = (char *)ami_utf8_easy((char *)messages_get("Home"));
- gadlab[GRP_OPTS_CONTENTBLOCKING] = (char *)ami_utf8_easy((char *)messages_get("ContentBlocking"));
- gadlab[GRP_OPTS_CONTENTLANGUAGE] = (char *)ami_utf8_easy((char *)messages_get("ContentLanguage"));
- gadlab[GRP_OPTS_HISTORY] = (char *)ami_utf8_easy((char *)messages_get("History"));
- 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"));
- gadlab[GRP_OPTS_FETCHING] = (char *)ami_utf8_easy((char *)messages_get("Fetching"));
- gadlab[GRP_OPTS_IMAGES] = (char *)ami_utf8_easy((char *)messages_get("Images"));
- gadlab[GRP_OPTS_ANIMS] = (char *)ami_utf8_easy((char *)messages_get("Animations"));
- gadlab[GRP_OPTS_DPI] = (char *)ami_utf8_easy((char *)messages_get("Resolution"));
- gadlab[GRP_OPTS_FONTFACES] = (char *)ami_utf8_easy((char *)messages_get("FontFamilies"));
- gadlab[GRP_OPTS_FONTSIZE] = (char *)ami_utf8_easy((char *)messages_get("FontSize"));
- gadlab[GRP_OPTS_MEMCACHE] = (char *)ami_utf8_easy((char *)messages_get("CacheMemory"));
- gadlab[GRP_OPTS_DISCCACHE] = (char *)ami_utf8_easy((char *)messages_get("CacheDisc"));
- gadlab[GRP_OPTS_DOWNLOADS] = (char *)ami_utf8_easy((char *)messages_get("Downloads"));
- gadlab[GRP_OPTS_TABS] = (char *)ami_utf8_easy((char *)messages_get("TabbedBrowsing"));
- gadlab[GRP_OPTS_SEARCH] = (char *)ami_utf8_easy((char *)messages_get("SearchWeb"));
- gadlab[GRP_OPTS_CLIPBOARD] = (char *)ami_utf8_easy((char *)messages_get("Clipboard"));
- gadlab[GRP_OPTS_PRIVACY] = (char *)ami_utf8_easy((char *)messages_get("Privacy"));
- gadlab[GRP_OPTS_BEHAVIOUR] = (char *)ami_utf8_easy((char *)messages_get("Behaviour"));
- gadlab[GRP_OPTS_MARGINS] = (char *)ami_utf8_easy((char *)messages_get("Margins"));
- gadlab[GRP_OPTS_SCALING] = (char *)ami_utf8_easy((char *)messages_get("Scaling"));
- gadlab[GRP_OPTS_APPEARANCE] = (char *)ami_utf8_easy((char *)messages_get("Appearance"));
- gadlab[GRP_OPTS_ADVANCED] = (char *)ami_utf8_easy((char *)messages_get("con_advanced"));
-
- fontopts[0] = gadlab[GID_OPTS_FONT_SANS];
- fontopts[1] = gadlab[GID_OPTS_FONT_SERIF];
- fontopts[2] = gadlab[GID_OPTS_FONT_MONO];
- fontopts[3] = gadlab[GID_OPTS_FONT_CURSIVE];
- fontopts[4] = gadlab[GID_OPTS_FONT_FANTASY];
- fontopts[5] = NULL;
-
-#ifndef __amigaos4__
- ami_gui_opts_array_to_list(&gow->clicktablist, tabs, NSA_LIST_CLICKTAB);
- ami_gui_opts_array_to_list(&gow->screenoptslist, screenopts, NSA_LIST_RADIO);
- ami_gui_opts_array_to_list(&gow->proxyoptslist, proxyopts, NSA_LIST_CHOOSER);
- ami_gui_opts_array_to_list(&gow->nativebmoptslist, nativebmopts, NSA_LIST_CHOOSER);
- ami_gui_opts_array_to_list(&gow->ditheroptslist, ditheropts, NSA_LIST_CHOOSER);
- ami_gui_opts_array_to_list(&gow->fontoptslist, fontopts, NSA_LIST_CHOOSER);
-#endif
-}
-
-static void ami_gui_opts_free(struct ami_gui_opts_window *gow)
-{
- int i;
-
- for(i = 0; i < OPTS_LAST; i++)
- if(gadlab[i]) free((APTR)gadlab[i]);
-
- for(i = 0; i < OPTS_MAX_TABS; i++)
- if(tabs[i]) free((APTR)tabs[i]);
-
- for(i = 0; i < OPTS_MAX_SCREEN; i++)
- if(screenopts[i]) free((APTR)screenopts[i]);
-
- for(i = 0; i < OPTS_MAX_PROXY; i++)
- if(proxyopts[i]) free((APTR)proxyopts[i]);
-
- for(i = 0; i < OPTS_MAX_NATIVEBM; i++)
- if(nativebmopts[i]) free((APTR)nativebmopts[i]);
-
- ami_gui_opts_websearch_free(websearch_list);
-
-#ifndef __amigaos4__
- ami_gui_opts_free_list(&gow->clicktablist, NSA_LIST_CLICKTAB);
- ami_gui_opts_free_list(&gow->screenoptslist, NSA_LIST_RADIO);
- ami_gui_opts_free_list(&gow->proxyoptslist, NSA_LIST_CHOOSER);
- ami_gui_opts_free_list(&gow->nativebmoptslist, NSA_LIST_CHOOSER);
- ami_gui_opts_free_list(&gow->ditheroptslist, NSA_LIST_CHOOSER);
- ami_gui_opts_free_list(&gow->fontoptslist, NSA_LIST_CHOOSER);
-#endif
-}
-
-void ami_gui_opts_open(void)
-{
- uint16 screenoptsselected;
- ULONG screenmodeid = 0;
- ULONG proxytype = 0;
- BOOL screenmodedisabled = FALSE, screennamedisabled = FALSE;
- BOOL proxyhostdisabled = TRUE, proxyauthdisabled = TRUE, proxybypassdisabled = FALSE;
- BOOL disableanims, animspeeddisabled = FALSE, acceptlangdisabled = FALSE;
- BOOL scaleselected = nsoption_bool(scale_quality), scaledisabled = FALSE;
- BOOL ditherdisable = TRUE;
- BOOL download_notify_disabled = FALSE, tab_always_show_disabled = FALSE;
- BOOL ptr_disable = FALSE;
- char animspeed[10];
- char *homepage_url_lc = ami_utf8_easy(nsoption_charp(homepage_url));
-
- struct TextAttr fontsans, fontserif, fontmono, fontcursive, fontfantasy;
-
- if(gow && gow->win)
- {
- WindowToFront(gow->win);
- ActivateWindow(gow->win);
- return;
- }
-
-#ifdef __amigaos4__
- if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 53, 42)) ptr_disable = TRUE;
-#else
- ptr_disable = TRUE;
-#endif
-
- if(nsoption_charp(pubscreen_name))
- {
- if(strcmp(nsoption_charp(pubscreen_name),"Workbench") == 0)
- {
- screenoptsselected = 1;
- screennamedisabled = TRUE;
- screenmodedisabled = TRUE;
- }
- else
- {
- screenoptsselected = 2;
- screenmodedisabled = TRUE;
- }
- }
- else
- {
- screenoptsselected = 0;
- screennamedisabled = TRUE;
- }
-
- if((nsoption_charp(screen_modeid)) &&
- (strncmp(nsoption_charp(screen_modeid),"0x",2) == 0))
- {
- screenmodeid = strtoul(nsoption_charp(screen_modeid),NULL,0);
- }
-
- if(ami_plot_screen_is_palettemapped() == true) {
- ditherdisable = FALSE;
- }
-
- if(nsoption_bool(http_proxy) == true)
- {
- proxytype = nsoption_int(http_proxy_auth) + 1;
- switch(nsoption_int(http_proxy_auth))
- {
- case OPTION_HTTP_PROXY_AUTH_BASIC:
- case OPTION_HTTP_PROXY_AUTH_NTLM:
- proxyauthdisabled = FALSE;
- case OPTION_HTTP_PROXY_AUTH_NONE:
- proxyhostdisabled = FALSE;
- break;
- }
- } else {
- proxybypassdisabled = TRUE;
- }
-
- sprintf(animspeed,"%.2f",(float)(nsoption_int(minimum_gif_delay)/100.0));
-
- if(nsoption_bool(animate_images))
- {
- disableanims = FALSE;
- animspeeddisabled = FALSE;
- }
- else
- {
- disableanims = TRUE;
- animspeeddisabled = TRUE;
- }
-
- if(nsoption_bool(accept_lang_locale))
- acceptlangdisabled = TRUE;
- else
- acceptlangdisabled = FALSE;
-
- if(GfxBase->LibNode.lib_Version < 53)
- {
- scaledisabled = TRUE;
- scaleselected = FALSE;
- }
-#ifdef __amigaos4__
- if(ApplicationBase->lib_Version < 53)
-#endif
- {
- download_notify_disabled = TRUE;
- nsoption_set_bool(download_notify, FALSE);
- }
-
- if(ClickTabBase->lib_Version < 53) {
- tab_always_show_disabled = TRUE;
- }
-
- fontsans.ta_Name = ASPrintf("%s.font", nsoption_charp(font_sans));
- fontserif.ta_Name = ASPrintf("%s.font", nsoption_charp(font_serif));
- fontmono.ta_Name = ASPrintf("%s.font", nsoption_charp(font_mono));
- fontcursive.ta_Name = ASPrintf("%s.font", nsoption_charp(font_cursive));
- fontfantasy.ta_Name = ASPrintf("%s.font", nsoption_charp(font_fantasy));
-
- fontsans.ta_Style = 0;
- fontserif.ta_Style = 0;
- fontmono.ta_Style = 0;
- fontcursive.ta_Style = 0;
- fontfantasy.ta_Style = 0;
-
- fontsans.ta_YSize = 0;
- fontserif.ta_YSize = 0;
- fontmono.ta_YSize = 0;
- fontcursive.ta_YSize = 0;
- fontfantasy.ta_YSize = 0;
-
- fontsans.ta_Flags = 0;
- fontserif.ta_Flags = 0;
- fontmono.ta_Flags = 0;
- fontcursive.ta_Flags = 0;
- fontfantasy.ta_Flags = 0;
-
- if(!gow)
- {
- gow = ami_misc_allocvec_clear(sizeof(struct ami_gui_opts_window), 0);
- if(gow == NULL) return;
-
- ami_gui_opts_setup(gow);
-
- gow->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, gadlab[LAB_OPTS_WINTITLE],
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, FALSE,
- WA_PubScreen,scrn,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,gow,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WA_IDCMP, IDCMP_GADGETUP | IDCMP_CLOSEWINDOW,
- WINDOW_ParentGroup, gow->objects[GID_OPTS_MAIN] = LayoutVObj,
- LAYOUT_AddChild, ClickTabObj,
- GA_RelVerify, TRUE,
-#ifdef __amigaos4__
- GA_Text, tabs,
-#else
- CLICKTAB_Labels, &gow->clicktablist,
-#endif
- CLICKTAB_PageGroup, PageObj,
- /*
- ** General
- */
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_HOMEPAGE],
- LAYOUT_AddChild, gow->objects[GID_OPTS_HOMEPAGE] = StringObj,
- GA_ID, GID_OPTS_HOMEPAGE,
- GA_RelVerify, TRUE,
- STRINGA_TextVal, homepage_url_lc,
- STRINGA_BufferPos,0,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_HOMEPAGE],
- LabelEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, gow->objects[GID_OPTS_HOMEPAGE_DEFAULT] = ButtonObj,
- GA_ID,GID_OPTS_HOMEPAGE_DEFAULT,
- GA_Text,gadlab[GID_OPTS_HOMEPAGE_DEFAULT],
- GA_RelVerify,TRUE,
- ButtonEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_HOMEPAGE_CURRENT] = ButtonObj,
- GA_ID,GID_OPTS_HOMEPAGE_CURRENT,
- GA_Text,gadlab[GID_OPTS_HOMEPAGE_CURRENT],
- GA_RelVerify,TRUE,
- ButtonEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_HOMEPAGE_BLANK] = ButtonObj,
- GA_ID,GID_OPTS_HOMEPAGE_BLANK,
- GA_Text,gadlab[GID_OPTS_HOMEPAGE_BLANK],
- GA_RelVerify,TRUE,
- ButtonEnd,
- LayoutEnd,
- LayoutEnd, //homepage
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_CONTENTBLOCKING],
- LAYOUT_AddChild, gow->objects[GID_OPTS_HIDEADS] = CheckBoxObj,
- GA_ID, GID_OPTS_HIDEADS,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_HIDEADS],
- GA_Selected, nsoption_bool(block_advertisements),
- CheckBoxEnd,
- LayoutEnd, // content blocking
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_CONTENTLANGUAGE],
- LAYOUT_AddChild, gow->objects[GID_OPTS_CONTENTLANG] = StringObj,
- GA_ID, GID_OPTS_CONTENTLANG,
- GA_RelVerify, TRUE,
- GA_Disabled, acceptlangdisabled,
- STRINGA_TextVal, nsoption_charp(accept_language),
- STRINGA_BufferPos,0,
- StringEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FROMLOCALE] = CheckBoxObj,
- GA_ID, GID_OPTS_FROMLOCALE,
- GA_Text, gadlab[GID_OPTS_FROMLOCALE],
- GA_RelVerify, TRUE,
- GA_Selected, nsoption_bool(accept_lang_locale),
- ButtonEnd,
- // CHILD_WeightedWidth, 0,
- LayoutEnd, // content language
- LayoutEnd, // content
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_HISTORY],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_HISTORY] = IntegerObj,
- GA_ID, GID_OPTS_HISTORY,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(expire_url),
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 366,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_DAYS],
- LabelEnd,
- LayoutEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_HISTORY],
- LabelEnd,
- LayoutEnd, // history
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_SCRIPTING],
- LAYOUT_AddChild, gow->objects[GID_OPTS_JAVASCRIPT] = CheckBoxObj,
- GA_ID, GID_OPTS_JAVASCRIPT,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_JAVASCRIPT],
- GA_Selected, nsoption_bool(enable_javascript),
- CheckBoxEnd,
- LayoutEnd, // scripting
- LayoutEnd,
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_PRIVACY],
- LAYOUT_AddChild, gow->objects[GID_OPTS_REFERRAL] = CheckBoxObj,
- GA_ID, GID_OPTS_REFERRAL,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_REFERRAL],
- GA_Selected, nsoption_bool(send_referer),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_DONOTTRACK] = CheckBoxObj,
- GA_ID, GID_OPTS_DONOTTRACK,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_DONOTTRACK],
- GA_Selected, nsoption_bool(do_not_track),
- CheckBoxEnd,
- LayoutEnd, // misc
- CHILD_WeightedHeight, 0,
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // pageadd
- /*
- ** Display
- */
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_SCREEN],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, gow->objects[GID_OPTS_SCREEN] = RadioButtonObj,
- GA_ID, GID_OPTS_SCREEN,
- GA_RelVerify, TRUE,
-#ifdef __amigaos4__
- GA_Text, screenopts,
-#else
- RADIOBUTTON_Labels, &gow->screenoptslist,
-#endif
- RADIOBUTTON_Selected, screenoptsselected,
- RadioButtonEnd,
- CHILD_WeightedWidth,0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, gow->objects[GID_OPTS_SCREENMODE] = GetScreenModeObj,
- GA_ID, GID_OPTS_SCREENMODE,
- GA_RelVerify, TRUE,
- GA_Disabled,screenmodedisabled,
- GETSCREENMODE_DisplayID,screenmodeid,
- GETSCREENMODE_MinDepth, 0,
- GETSCREENMODE_MaxDepth, 32,
- GetScreenModeEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_SCREENNAME] = StringObj,
- GA_ID, GID_OPTS_SCREENNAME,
- GA_RelVerify, TRUE,
- GA_Disabled,screennamedisabled,
- STRINGA_TextVal, nsoption_charp(pubscreen_name),
- STRINGA_BufferPos,0,
- StringEnd,
- LayoutEnd,
- CHILD_WeightedHeight,0,
- LayoutEnd,
- LayoutEnd, // screen
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_WINDOW],
- LAYOUT_AddChild, gow->objects[GID_OPTS_WIN_SIMPLE] = CheckBoxObj,
- 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, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_THEME],
- LAYOUT_AddChild, gow->objects[GID_OPTS_THEME] = GetFileObj,
- GA_ID, GID_OPTS_THEME,
- GA_RelVerify, TRUE,
- GETFILE_Drawer, nsoption_charp(theme),
- GETFILE_DrawersOnly, TRUE,
- GETFILE_ReadOnly, TRUE,
- GETFILE_FullFileExpand, FALSE,
- GetFileEnd,
- LayoutEnd, // theme
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_MOUSE],
- LAYOUT_AddChild, gow->objects[GID_OPTS_PTRTRUE] = CheckBoxObj,
- GA_ID, GID_OPTS_PTRTRUE,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_PTRTRUE],
- GA_Selected, nsoption_bool(truecolour_mouse_pointers),
- GA_Disabled, ptr_disable,
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_PTROS] = CheckBoxObj,
- GA_ID, GID_OPTS_PTROS,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_PTROS],
- GA_Selected, nsoption_bool(os_mouse_pointers),
- GA_Disabled, ptr_disable,
- CheckBoxEnd,
- LayoutEnd, // mouse
- CHILD_WeightedHeight,0,
- LAYOUT_AddImage, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_RESTART],
- LabelEnd,
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // pageadd
- /*
- ** Network
- */
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_PROXY],
- LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY] = ChooserObj,
- GA_ID, GID_OPTS_PROXY,
- GA_RelVerify, TRUE,
- CHOOSER_PopUp, TRUE,
-#ifdef __amigaos4__
- CHOOSER_LabelArray, proxyopts,
-#else
- CHOOSER_Labels, &gow->proxyoptslist,
-#endif
- CHOOSER_Selected, proxytype,
- ChooserEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_PROXY],
- LabelEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY_HOST] = StringObj,
- GA_ID, GID_OPTS_PROXY_HOST,
- GA_RelVerify, TRUE,
- GA_Disabled, proxyhostdisabled,
- STRINGA_TextVal, nsoption_charp(http_proxy_host),
- STRINGA_BufferPos,0,
- StringEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY_PORT] = IntegerObj,
- GA_ID, GID_OPTS_PROXY_PORT,
- GA_RelVerify, TRUE,
- GA_Disabled, proxyhostdisabled,
- INTEGER_Number, nsoption_charp(http_proxy_port),
- INTEGER_Minimum, 1,
- INTEGER_Maximum, 65535,
- INTEGER_Arrows, FALSE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, ":",
- LabelEnd,
- LayoutEnd, //host:port group
- CHILD_WeightedHeight, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_PROXY_HOST],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY_USER] = StringObj,
- GA_ID, GID_OPTS_PROXY_USER,
- GA_RelVerify, TRUE,
- GA_Disabled, proxyauthdisabled,
- STRINGA_TextVal, nsoption_charp(http_proxy_auth_user),
- STRINGA_BufferPos,0,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_PROXY_USER],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY_PASS] = StringObj,
- GA_ID, GID_OPTS_PROXY_PASS,
- GA_RelVerify, TRUE,
- GA_Disabled, proxyauthdisabled,
- STRINGA_TextVal, nsoption_charp(http_proxy_auth_pass),
- STRINGA_BufferPos,0,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_PROXY_PASS],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_PROXY_BYPASS] = StringObj,
- GA_ID, GID_OPTS_PROXY_BYPASS,
- GA_RelVerify, TRUE,
- GA_Disabled, proxybypassdisabled,
- STRINGA_TextVal, nsoption_charp(http_proxy_noproxy),
- STRINGA_BufferPos, 0,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_PROXY_BYPASS],
- LabelEnd,
- LayoutEnd, // proxy
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_FETCHING],
- LAYOUT_AddChild, gow->objects[GID_OPTS_FETCHMAX] = IntegerObj,
- GA_ID, GID_OPTS_FETCHMAX,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(max_fetchers),
- INTEGER_Minimum, 1,
- INTEGER_Maximum, 99,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FETCHMAX],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FETCHHOST] = IntegerObj,
- GA_ID, GID_OPTS_FETCHHOST,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(max_fetchers_per_host),
- INTEGER_Minimum, 1,
- INTEGER_Maximum, 99,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FETCHHOST],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FETCHCACHE] = IntegerObj,
- GA_ID, GID_OPTS_FETCHCACHE,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(max_cached_fetch_handles),
- INTEGER_Minimum, 1,
- INTEGER_Maximum, 99,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FETCHCACHE],
- LabelEnd,
- LayoutEnd,
- CHILD_WeightedHeight, 0,
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // page object
- /*
- ** Rendering
- */
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_IMAGES],
- LAYOUT_AddChild, gow->objects[GID_OPTS_NATIVEBM] = ChooserObj,
- GA_ID, GID_OPTS_NATIVEBM,
- GA_RelVerify, TRUE,
- CHOOSER_PopUp, TRUE,
-#ifdef __amigaos4__
- CHOOSER_LabelArray, nativebmopts,
-#else
- CHOOSER_Labels, &gow->nativebmoptslist,
-#endif
- CHOOSER_Selected, nsoption_int(cache_bitmaps),
- ChooserEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_NATIVEBM],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_DITHERQ] = ChooserObj,
- GA_ID, GID_OPTS_DITHERQ,
- GA_RelVerify, TRUE,
- GA_Disabled, ditherdisable,
- CHOOSER_PopUp, TRUE,
-#ifdef __amigaos4__
- CHOOSER_LabelArray, ditheropts,
-#else
- CHOOSER_Labels, &gow->ditheroptslist,
-#endif
- CHOOSER_Selected, nsoption_int(dither_quality),
- ChooserEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_DITHERQ],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_SCALEQ] = CheckBoxObj,
- GA_ID, GID_OPTS_SCALEQ,
- GA_Disabled, scaledisabled,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_SCALEQ],
- GA_Selected, scaleselected,
- CheckBoxEnd,
- LayoutEnd, // images
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_ANIMS],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_ANIMSPEED] = StringObj,
- GA_ID, GID_OPTS_ANIMSPEED,
- GA_RelVerify, TRUE,
- GA_Disabled, animspeeddisabled,
- STRINGA_HookType, SHK_FLOAT,
- STRINGA_TextVal, animspeed,
- STRINGA_BufferPos,0,
- StringEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_SECS],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_ANIMSPEED],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_ANIMDISABLE] = CheckBoxObj,
- GA_ID, GID_OPTS_ANIMDISABLE,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_ANIMDISABLE],
- GA_Selected, disableanims,
- CheckBoxEnd,
- LayoutEnd, //animations
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_DPI],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_DPI_Y] = IntegerObj,
- GA_ID, GID_OPTS_DPI_Y,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(screen_ydpi),
- INTEGER_Minimum, 60,
- INTEGER_Maximum, 150,
- INTEGER_Arrows, TRUE,
- GA_Disabled, nsoption_bool(bitmap_fonts),
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_DPI],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_DPI_Y],
- LabelEnd,
- LayoutEnd, //animations
- CHILD_WeightedHeight, 0,
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // page object
- /*
- ** Fonts
- */
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_FONTFACES],
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_SANS] = GetFontObj,
- GA_ID, GID_OPTS_FONT_SANS,
- GA_RelVerify, TRUE,
- GETFONT_TextAttr, &fontsans,
- GETFONT_OTagOnly, TRUE,
- GETFONT_ScalableOnly, TRUE,
- GetFontEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_SANS],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_SERIF] = GetFontObj,
- GA_ID, GID_OPTS_FONT_SERIF,
- GA_RelVerify, TRUE,
- GETFONT_TextAttr, &fontserif,
- GETFONT_OTagOnly, TRUE,
- GETFONT_ScalableOnly, TRUE,
- GetFontEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_SERIF],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_MONO] = GetFontObj,
- GA_ID, GID_OPTS_FONT_MONO,
- GA_RelVerify, TRUE,
- GETFONT_TextAttr, &fontmono,
- GETFONT_OTagOnly, TRUE,
- GETFONT_ScalableOnly, TRUE,
- GETFONT_FixedWidthOnly, TRUE,
- GetFontEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_MONO],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_CURSIVE] = GetFontObj,
- GA_ID, GID_OPTS_FONT_CURSIVE,
- GA_RelVerify, TRUE,
- GETFONT_TextAttr, &fontcursive,
- GETFONT_OTagOnly, TRUE,
- GETFONT_ScalableOnly, TRUE,
- GetFontEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_CURSIVE],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_FANTASY] = GetFontObj,
- GA_ID, GID_OPTS_FONT_FANTASY,
- GA_RelVerify, TRUE,
- GETFONT_TextAttr, &fontfantasy,
- GETFONT_OTagOnly, TRUE,
- GETFONT_ScalableOnly, TRUE,
- GetFontEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_FANTASY],
- LabelEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_DEFAULT] = ChooserObj,
- GA_ID, GID_OPTS_FONT_DEFAULT,
- GA_RelVerify, TRUE,
- CHOOSER_PopUp, TRUE,
-#ifdef __amigaos4__
- CHOOSER_LabelArray, fontopts,
-#else
- CHOOSER_Labels, &gow->fontoptslist,
-#endif
- CHOOSER_Selected, nsoption_int(font_default) - PLOT_FONT_FAMILY_SANS_SERIF,
- ChooserEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_DEFAULT],
- LabelEnd,
- LayoutEnd, // font faces
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_FONTSIZE],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_SIZE] = IntegerObj,
- 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, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_PT],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_SIZE],
- LabelEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_MINSIZE] = IntegerObj,
- 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, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_PT],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_FONT_MINSIZE],
- LabelEnd,
- LayoutEnd,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_MISC],
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_ANTIALIASING] = CheckBoxObj,
- GA_ID, GID_OPTS_FONT_ANTIALIASING,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_FONT_ANTIALIASING],
- GA_Selected, nsoption_bool(font_antialiasing),
-#ifndef __amigaos4__
- GA_Disabled, TRUE,
-#endif
- CheckBoxEnd,
-#ifndef __amigaos4__
- LAYOUT_AddChild, gow->objects[GID_OPTS_FONT_BITMAP] = CheckBoxObj,
- GA_ID, GID_OPTS_FONT_BITMAP,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_FONT_BITMAP],
- GA_Selected, nsoption_bool(bitmap_fonts),
- CheckBoxEnd,
-#endif
- LayoutEnd,
- LayoutEnd,
- CHILD_WeightedHeight, 0,
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // page object
- /*
- ** Cache
- */
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_MEMCACHE],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_CACHE_MEM] = IntegerObj,
- GA_ID, GID_OPTS_CACHE_MEM,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(memory_cache_size) / 1048576,
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 2048,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_MB],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_CACHE_MEM],
- LabelEnd,
- LayoutEnd, // memory cache
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_DISCCACHE],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_CACHE_DISC] = IntegerObj,
- GA_ID, GID_OPTS_CACHE_DISC,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_uint(disc_cache_size) / 1048576,
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 4096,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_MB],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_CACHE_DISC],
- LabelEnd,
- LayoutEnd, // disc cache
- CHILD_WeightedHeight, 0,
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // page object
- /*
- ** Tabs
- */
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_TABS],
- LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_ACTIVE] = CheckBoxObj,
- GA_ID, GID_OPTS_TAB_ACTIVE,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_TAB_ACTIVE],
- GA_Selected, !nsoption_bool(new_tab_is_active),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_LAST] = CheckBoxObj,
- 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] = CheckBoxObj,
- 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] = CheckBoxObj,
- GA_ID, GID_OPTS_TAB_ALWAYS,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_TAB_ALWAYS],
- GA_Selected, nsoption_bool(tab_always_show),
- GA_Disabled, tab_always_show_disabled,
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_TAB_CLOSE] = CheckBoxObj,
- 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, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_DOWNLOADS],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, gow->objects[GID_OPTS_OVERWRITE] = CheckBoxObj,
- GA_ID, GID_OPTS_OVERWRITE,
- GA_RelVerify, TRUE,
- GA_Disabled, FALSE,
- GA_Text, gadlab[GID_OPTS_OVERWRITE],
- GA_Selected, nsoption_bool(ask_overwrite),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_NOTIFY] = CheckBoxObj,
- GA_ID, GID_OPTS_NOTIFY,
- GA_RelVerify, TRUE,
- GA_Disabled, download_notify_disabled,
- GA_Text, gadlab[GID_OPTS_NOTIFY],
- GA_Selected, nsoption_bool(download_notify),
-#ifndef __amigaos4__
- GA_Disabled, TRUE,
-#endif
- CheckBoxEnd,
- LayoutEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_DLDIR] = GetFileObj,
- GA_ID, GID_OPTS_DLDIR,
- GA_RelVerify, TRUE,
- GETFILE_Drawer, nsoption_charp(download_dir),
- GETFILE_DrawersOnly, TRUE,
- GETFILE_ReadOnly, TRUE,
- GETFILE_FullFileExpand, FALSE,
- GetFileEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_DLDIR],
- LabelEnd,
- LayoutEnd, // downloads
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_BEHAVIOUR],
- LAYOUT_AddChild, gow->objects[GID_OPTS_STARTUP_NO_WIN] = CheckBoxObj,
- GA_ID, GID_OPTS_STARTUP_NO_WIN,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_STARTUP_NO_WIN],
- GA_Selected, nsoption_bool(startup_no_window),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_CLOSE_NO_QUIT] = CheckBoxObj,
- GA_ID, GID_OPTS_CLOSE_NO_QUIT,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_CLOSE_NO_QUIT],
- GA_Selected, nsoption_bool(close_no_quit),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_DOCKY] = CheckBoxObj,
- GA_ID, GID_OPTS_DOCKY,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_DOCKY],
- GA_Selected, !nsoption_bool(hide_docky_icon),
-#ifndef __amigaos4__
- GA_Disabled, TRUE,
-#endif
- CheckBoxEnd,
- LayoutEnd, // behaviour
- CHILD_WeightedHeight, 0,
- LayoutEnd, // hgroup
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_CLIPBOARD],
- LAYOUT_AddChild, gow->objects[GID_OPTS_CLIPBOARD] = CheckBoxObj,
- GA_ID, GID_OPTS_CLIPBOARD,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_CLIPBOARD],
- GA_Selected, nsoption_bool(clipboard_write_utf8),
- CheckBoxEnd,
- LayoutEnd, // clipboard
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_SEARCH],
- LAYOUT_AddChild, gow->objects[GID_OPTS_SEARCH_PROV] = ChooserObj,
- GA_ID, GID_OPTS_SEARCH_PROV,
- GA_RelVerify, TRUE,
- CHOOSER_PopUp, TRUE,
- CHOOSER_Labels, websearch_list,
- CHOOSER_Selected, nsoption_int(search_provider),
- CHOOSER_MaxLabels, 40,
- ChooserEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_SEARCH_PROV],
- LabelEnd,
- LayoutEnd, // search
- CHILD_WeightedHeight, 0,
- LayoutEnd, // hgroup
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_MISC],
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_AddChild, gow->objects[GID_OPTS_FASTSCROLL] = CheckBoxObj,
- GA_ID, GID_OPTS_FASTSCROLL,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_FASTSCROLL],
- GA_Selected, nsoption_bool(faster_scroll),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_SELECTMENU] = CheckBoxObj,
- GA_ID, GID_OPTS_SELECTMENU,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_SELECTMENU],
- GA_Selected, !nsoption_bool(core_select_menu),
- GA_Disabled, !ami_selectmenu_is_safe(),
- CheckBoxEnd,
- LayoutEnd, // misc
- CHILD_WeightedHeight, 0,
-
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // page object
- /*
- ** Export
- */
-#ifdef WITH_PDF_EXPORT
- PAGE_Add, LayoutVObj,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_MARGINS],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_MARGIN_TOP] = IntegerObj,
- GA_ID, GID_OPTS_MARGIN_TOP,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(margin_top),
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 99,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_MM],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_MARGIN_TOP],
- LabelEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_MARGIN_LEFT] = IntegerObj,
- GA_ID, GID_OPTS_MARGIN_LEFT,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(margin_left),
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 99,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_MM],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_MARGIN_LEFT],
- LabelEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_MARGIN_BOTTOM] = IntegerObj,
- GA_ID, GID_OPTS_MARGIN_BOTTOM,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(margin_bottom),
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 99,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_MM],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_MARGIN_BOTTOM],
- LabelEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_MARGIN_RIGHT] = IntegerObj,
- GA_ID, GID_OPTS_MARGIN_RIGHT,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(margin_right),
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 99,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_MM],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_MARGIN_RIGHT],
- LabelEnd,
- LayoutEnd, // margins
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_SCALING],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_EXPORT_SCALE] = IntegerObj,
- GA_ID, GID_OPTS_EXPORT_SCALE,
- GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(export_scale),
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 100,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, "%",
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_EXPORT_SCALE],
- LabelEnd,
- LayoutEnd, // scaling
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_APPEARANCE],
- LAYOUT_AddChild, gow->objects[GID_OPTS_EXPORT_NOIMAGES] = CheckBoxObj,
- GA_ID, GID_OPTS_EXPORT_NOIMAGES,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_EXPORT_NOIMAGES],
- GA_Selected, nsoption_bool(suppress_images),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_EXPORT_NOBKG] = CheckBoxObj,
- GA_ID, GID_OPTS_EXPORT_NOBKG,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_EXPORT_NOBKG],
- GA_Selected, nsoption_bool(remove_backgrounds),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_EXPORT_LOOSEN] = CheckBoxObj,
- GA_ID, GID_OPTS_EXPORT_LOOSEN,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_EXPORT_LOOSEN],
- GA_Selected, nsoption_bool(enable_loosening),
- CheckBoxEnd,
- LayoutEnd, // appearance
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, LayoutVObj,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_BevelStyle, BVS_GROUP,
- LAYOUT_Label, gadlab[GRP_OPTS_ADVANCED],
- LAYOUT_AddChild, gow->objects[GID_OPTS_EXPORT_COMPRESS] = CheckBoxObj,
- GA_ID, GID_OPTS_EXPORT_COMPRESS,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[GID_OPTS_EXPORT_COMPRESS],
- GA_Selected, nsoption_bool(enable_PDF_compression),
- CheckBoxEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_EXPORT_PASSWORD] = CheckBoxObj,
- GA_ID, GID_OPTS_EXPORT_PASSWORD,
- GA_RelVerify, TRUE,
- GA_Disabled, TRUE,
- GA_Text, gadlab[GID_OPTS_EXPORT_PASSWORD],
- GA_Selected, nsoption_bool(enable_PDF_password),
- CheckBoxEnd,
- LayoutEnd, // export
- CHILD_WeightedHeight, 0,
- LayoutEnd, // page vgroup
- CHILD_WeightedHeight, 0,
- PageEnd, // page object
-#endif
- End, // pagegroup
- ClickTabEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, gow->objects[GID_OPTS_SAVE] = ButtonObj,
- GA_ID,GID_OPTS_SAVE,
- GA_Text,gadlab[GID_OPTS_SAVE],
- GA_RelVerify,TRUE,
- ButtonEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_USE] = ButtonObj,
- GA_ID,GID_OPTS_USE,
- GA_Text,gadlab[GID_OPTS_USE],
- GA_RelVerify,TRUE,
- ButtonEnd,
- LAYOUT_AddChild, gow->objects[GID_OPTS_CANCEL] = ButtonObj,
- GA_ID,GID_OPTS_CANCEL,
- GA_Text,gadlab[GID_OPTS_CANCEL],
- GA_RelVerify,TRUE,
- ButtonEnd,
- EndGroup, // save/use/cancel
- EndGroup, // main
- EndWindow;
-
- gow->win = (struct Window *)RA_OpenWindow(gow->objects[OID_MAIN]);
- gow->node = AddObject(window_list,AMINS_GUIOPTSWINDOW);
- gow->node->objstruct = gow;
- }
- ami_utf8_free(homepage_url_lc);
-}
-
-static void ami_gui_opts_use(bool save)
-{
- ULONG data, id = 0;
- float animspeed;
- struct TextAttr *tattr;
- char *dot;
- bool rescan_fonts = false;
- bool old_tab_always_show;
-
- ami_update_pointer(gow->win, GUI_POINTER_WAIT);
-
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_HOMEPAGE],(ULONG *)&data);
- nsoption_set_charp(homepage_url, (char *)ami_to_utf8_easy((char *)data));
-
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_CONTENTLANG],(ULONG *)&data);
- nsoption_set_charp(accept_language, (char *)strdup((char *)data));
-
- GetAttr(GA_Selected, gow->objects[GID_OPTS_FROMLOCALE],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(accept_lang_locale, true);
- } else {
- nsoption_set_bool(accept_lang_locale, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_HIDEADS],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(block_advertisements, true);
- } else {
- nsoption_set_bool(block_advertisements, false);
- }
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_HISTORY],(ULONG *)&nsoption_int(expire_url));
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_REFERRAL],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(send_referer, true);
- } else {
- nsoption_set_bool(send_referer, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_JAVASCRIPT],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(enable_javascript, true);
- } else {
- nsoption_set_bool(enable_javascript, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_DONOTTRACK],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(do_not_track, true);
- } else {
- nsoption_set_bool(do_not_track, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_FASTSCROLL],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(faster_scroll, true);
- } else {
- nsoption_set_bool(faster_scroll, false);
- }
-
- GetAttr(RADIOBUTTON_Selected,gow->objects[GID_OPTS_SCREEN],(ULONG *)&data);
- switch(data)
- {
- case 0:
- nsoption_set_charp(pubscreen_name, strdup("\0"));
- break;
-
- case 1:
- nsoption_set_charp(pubscreen_name, (char *)strdup("Workbench"));
- break;
-
- case 2:
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_SCREENNAME],(ULONG *)&data);
- nsoption_set_charp(pubscreen_name, (char *)strdup((char *)data));
- break;
- }
-
- GetAttr(GETSCREENMODE_DisplayID, gow->objects[GID_OPTS_SCREENMODE], (ULONG *)&id);
- if(id)
- {
- char *modeid = malloc(20);
- sprintf(modeid,"0x%lx", id);
- nsoption_set_charp(screen_modeid, modeid);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_WIN_SIMPLE],(ULONG *)&data);
- if ((data == TRUE) && (nsoption_bool(window_simple_refresh) == false)) {
- nsoption_set_bool(window_simple_refresh, true);
- nsoption_set_int(screen_compositing, 0);
- } else if ((data == FALSE) && (nsoption_bool(window_simple_refresh) == true)) {
- nsoption_set_bool(window_simple_refresh, false);
- nsoption_set_int(screen_compositing, -1);
- }
-
- GetAttr(GETFILE_Drawer,gow->objects[GID_OPTS_THEME],(ULONG *)&data);
- nsoption_set_charp(theme, (char *)strdup((char *)data));
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_PTRTRUE],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(truecolour_mouse_pointers, true);
- } else {
- nsoption_set_bool(truecolour_mouse_pointers, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_PTROS],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(os_mouse_pointers, true);
- } else {
- nsoption_set_bool(os_mouse_pointers, false);
- }
-
- GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_PROXY],(ULONG *)&data);
- if(data)
- {
- nsoption_set_bool(http_proxy, true);
- nsoption_set_int(http_proxy_auth, data - 1);
- }
- else
- {
- nsoption_set_bool(http_proxy, false);
- }
-
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_HOST],(ULONG *)&data);
- nsoption_set_charp(http_proxy_host, (char *)strdup((char *)data));
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_PROXY_PORT],(ULONG *)&nsoption_int(http_proxy_port));
-
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_USER],(ULONG *)&data);
- nsoption_set_charp(http_proxy_auth_user, (char *)strdup((char *)data));
-
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_PASS],(ULONG *)&data);
- nsoption_set_charp(http_proxy_auth_pass, (char *)strdup((char *)data));
-
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_PROXY_BYPASS],(ULONG *)&data);
- nsoption_set_charp(http_proxy_noproxy, (char *)strdup((char *)data));
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHMAX],(ULONG *)&nsoption_int(max_fetchers));
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHHOST],(ULONG *)&nsoption_int(max_fetchers_per_host));
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FETCHCACHE],(ULONG *)&nsoption_int(max_cached_fetch_handles));
-
- GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_NATIVEBM],(ULONG *)&nsoption_int(cache_bitmaps));
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_SCALEQ],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(scale_quality, true);
- } else {
- 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));
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_ANIMDISABLE],(ULONG *)&data);
- if(data) {
- nsoption_set_bool(animate_images, false);
- } else {
- nsoption_set_bool(animate_images, true);
- }
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_DPI_Y],(ULONG *)&nsoption_int(screen_ydpi));
- ami_font_setdevicedpi(id); // id set above
-
- GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_SANS],(ULONG *)&data);
- tattr = (struct TextAttr *)data;
-
- if((dot = strrchr(tattr->ta_Name,'.'))) *dot = '\0';
- nsoption_set_charp(font_sans, (char *)strdup((char *)tattr->ta_Name));
-
- GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_SERIF],(ULONG *)&data);
- tattr = (struct TextAttr *)data;
-
- if((dot = strrchr(tattr->ta_Name,'.'))) *dot = '\0';
- nsoption_set_charp(font_serif, (char *)strdup((char *)tattr->ta_Name));
-
- GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_MONO],(ULONG *)&data);
- tattr = (struct TextAttr *)data;
-
- if((dot = strrchr(tattr->ta_Name,'.'))) *dot = '\0';
- nsoption_set_charp(font_mono, (char *)strdup((char *)tattr->ta_Name));
-
- GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_CURSIVE],(ULONG *)&data);
- tattr = (struct TextAttr *)data;
-
- if((dot = strrchr(tattr->ta_Name,'.'))) *dot = '\0';
- nsoption_set_charp(font_cursive, (char *)strdup((char *)tattr->ta_Name));
-
- GetAttr(GETFONT_TextAttr,gow->objects[GID_OPTS_FONT_FANTASY],(ULONG *)&data);
- tattr = (struct TextAttr *)data;
-
- if((dot = strrchr(tattr->ta_Name,'.'))) *dot = '\0';
- nsoption_set_charp(font_fantasy, (char *)strdup((char *)tattr->ta_Name));
-
- GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_FONT_DEFAULT],(ULONG *)&nsoption_int(font_default));
- nsoption_set_int(font_default, nsoption_int(font_default) + PLOT_FONT_FAMILY_SANS_SERIF);
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_FONT_SIZE],(ULONG *)&nsoption_int(font_size));
- nsoption_set_int(font_size, nsoption_int(font_size) * 10);
-
- 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);
- }
-
-#ifndef __amigaos4__
- GetAttr(GA_Selected, gow->objects[GID_OPTS_FONT_BITMAP], (ULONG *)&data);
- ami_font_fini();
- if(data) {
- nsoption_set_bool(bitmap_fonts, true);
- } else {
- nsoption_set_bool(bitmap_fonts, false);
- }
- ami_font_init();
-#endif
-
- 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);
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_CACHE_DISC],(ULONG *)&nsoption_uint(disc_cache_size));
- nsoption_set_uint(disc_cache_size, nsoption_uint(disc_cache_size) * 1048576);
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_OVERWRITE],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(ask_overwrite, true);
- } else {
- nsoption_set_bool(ask_overwrite, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_NOTIFY],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(download_notify, true);
- } else {
- nsoption_set_bool(download_notify, false);
- }
-
- GetAttr(GETFILE_Drawer,gow->objects[GID_OPTS_DLDIR],(ULONG *)&data);
- if((nsoption_charp(download_dir) == NULL) ||
- (strcmp((char *)data, nsoption_charp(download_dir)) != 0)) {
- nsoption_set_charp(download_dir, (char *)strdup((char *)data));
- ami_file_req_free();
- ami_file_req_init();
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_ACTIVE],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(new_tab_is_active, false);
- } else {
- nsoption_set_bool(new_tab_is_active, true);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_LAST],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(new_tab_last, true);
- } else {
- nsoption_set_bool(new_tab_last, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_2],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(button_2_tab, true);
- } else {
- 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_select_provider(nsoption_int(search_provider));
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_CLIPBOARD],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(clipboard_write_utf8, true);
- } else {
- nsoption_set_bool(clipboard_write_utf8, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_SELECTMENU],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(core_select_menu, false);
- } else {
- nsoption_set_bool(core_select_menu, true);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_STARTUP_NO_WIN],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(startup_no_window, true);
- } else {
- nsoption_set_bool(startup_no_window, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_CLOSE_NO_QUIT],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(close_no_quit, true);
- } else {
- nsoption_set_bool(close_no_quit, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_DOCKY],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(hide_docky_icon, false);
- } else {
- nsoption_set_bool(hide_docky_icon, true);
- }
-
-#ifdef WITH_PDF_EXPORT
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_TOP],(ULONG *)&nsoption_int(margin_top));
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_LEFT],(ULONG *)&nsoption_int(margin_left));
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_BOTTOM],(ULONG *)&nsoption_int(margin_bottom));
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_MARGIN_RIGHT],(ULONG *)&nsoption_int(margin_right));
-
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_EXPORT_SCALE],(ULONG *)&nsoption_int(export_scale));
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_EXPORT_NOIMAGES],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(suppress_images, true);
- } else {
- nsoption_set_bool(suppress_images, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_EXPORT_NOBKG],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(remove_backgrounds, true);
- } else {
- nsoption_set_bool(remove_backgrounds, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_EXPORT_LOOSEN],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(enable_loosening, true);
- } else {
- nsoption_set_bool(enable_loosening, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_EXPORT_COMPRESS],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(enable_PDF_compression, true);
- } else {
- nsoption_set_bool(enable_PDF_compression, false);
- }
-
- GetAttr(GA_Selected,gow->objects[GID_OPTS_EXPORT_PASSWORD],(ULONG *)&data);
- if (data) {
- nsoption_set_bool(enable_PDF_password, true);
- } else {
- nsoption_set_bool(enable_PDF_password, false);
- }
-#endif
-
- if(rescan_fonts == true) {
- ami_font_finiscanner();
- ami_font_initscanner(true, false);
- }
-
- if(save == true) {
- nsoption_write(current_user_options, NULL, NULL);
- ami_font_savescanner(); /* just in case it has changed and been used only */
- }
-
- ami_menu_check_toggled = true;
-
- ami_update_pointer(gow->win, GUI_POINTER_DEFAULT);
-}
-
-void ami_gui_opts_close(void)
-{
- DisposeObject(gow->objects[OID_MAIN]);
- ami_gui_opts_free(gow);
- DelObject(gow->node);
- gow = NULL;
-}
-
-BOOL ami_gui_opts_event(void)
-{
- /* return TRUE if window destroyed */
- ULONG result,data = 0;
- uint16 code;
- STRPTR text;
-
- while((result = RA_HandleInput(gow->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
- case WMHI_CLOSEWINDOW:
- ami_gui_opts_close();
- return TRUE;
- break;
-
- case WMHI_GADGETHELP:
- if((result & WMHI_GADGETMASK) == 0) {
- /* Pointer not over our window */
- ami_help_open(AMI_HELP_MAIN, scrn);
- } else {
- /* TODO: Make this sensitive to the tab the user is currently on */
- ami_help_open(AMI_HELP_PREFS, scrn);
- }
- break;
-
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK)
- {
- case GID_OPTS_SAVE:
- ami_gui_opts_use(true);
- ami_gui_opts_close();
- return TRUE;
- break;
-
- case GID_OPTS_USE:
- ami_gui_opts_use(false);
- // fall through
-
- case GID_OPTS_CANCEL:
- ami_gui_opts_close();
- return TRUE;
- break;
-
- case GID_OPTS_HOMEPAGE_DEFAULT:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
- gow->win,NULL,STRINGA_TextVal,NETSURF_HOMEPAGE,
- TAG_DONE);
- break;
-
- case GID_OPTS_HOMEPAGE_CURRENT:
- if(cur_gw) RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
- gow->win, NULL, STRINGA_TextVal,
- nsurl_access(browser_window_get_url(cur_gw->bw)), TAG_DONE);
- break;
-
- case GID_OPTS_HOMEPAGE_BLANK:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
- gow->win, NULL, STRINGA_TextVal,
- "about:blank", TAG_DONE);
- break;
-
- case GID_OPTS_FROMLOCALE:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_CONTENTLANG],
- gow->win, NULL, GA_Disabled, code, TAG_DONE);
-
- if(code && (text = ami_locale_langs()))
- {
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_CONTENTLANG],
- gow->win, NULL, STRINGA_TextVal, text, TAG_DONE);
- FreeVec(text);
- }
- break;
-
- case GID_OPTS_SCREEN:
- GetAttr(RADIOBUTTON_Selected,gow->objects[GID_OPTS_SCREEN],(ULONG *)&data);
- switch(data)
- {
- case 0:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_SCREENMODE],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_SCREENNAME],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- break;
-
- case 1:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_SCREENMODE],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_SCREENNAME],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- break;
-
- case 2:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_SCREENMODE],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_SCREENNAME],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- break;
- }
- break;
-
- case GID_OPTS_SCREENMODE:
- IDoMethod(gow->objects[GID_OPTS_SCREENMODE],
- GSM_REQUEST,gow->win);
- break;
-
- case GID_OPTS_THEME:
- IDoMethod(gow->objects[GID_OPTS_THEME],
- GFILE_REQUEST,gow->win);
- break;
-
- case GID_OPTS_PROXY:
- GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_PROXY],(ULONG *)&data);
- switch(data)
- {
- case 0:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_HOST],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PORT],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_USER],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- break;
- case 1:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_HOST],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PORT],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_USER],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS],
- gow->win,NULL, GA_Disabled, TRUE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- break;
-
- case 2:
- case 3:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_HOST],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PORT],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_USER],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_PASS],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_PROXY_BYPASS],
- gow->win,NULL, GA_Disabled, FALSE, TAG_DONE);
- break;
- }
- break;
-
- case GID_OPTS_ANIMDISABLE:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_ANIMSPEED],
- gow->win,NULL, GA_Disabled, code, TAG_DONE);
- break;
-
- case GID_OPTS_FONT_SANS:
- IDoMethod(gow->objects[GID_OPTS_FONT_SANS],
- GFONT_REQUEST,gow->win);
- break;
-
- case GID_OPTS_FONT_SERIF:
- IDoMethod(gow->objects[GID_OPTS_FONT_SERIF],
- GFONT_REQUEST,gow->win);
- break;
-
- case GID_OPTS_FONT_MONO:
- IDoMethod(gow->objects[GID_OPTS_FONT_MONO],
- GFONT_REQUEST,gow->win);
- break;
-
- case GID_OPTS_FONT_CURSIVE:
- IDoMethod(gow->objects[GID_OPTS_FONT_CURSIVE],
- GFONT_REQUEST,gow->win);
- break;
-
- case GID_OPTS_FONT_FANTASY:
- IDoMethod(gow->objects[GID_OPTS_FONT_FANTASY],
- GFONT_REQUEST,gow->win);
- break;
-#ifndef __amigaos4__
- case GID_OPTS_FONT_BITMAP:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_DPI_Y],
- gow->win, NULL, GA_Disabled, code, TAG_DONE);
- break;
-#endif
- case GID_OPTS_DLDIR:
- IDoMethod(gow->objects[GID_OPTS_DLDIR],
- GFILE_REQUEST,gow->win);
- break;
- }
- break;
- }
- }
- return FALSE;
-}
-
-struct List *ami_gui_opts_websearch(void)
-{
- struct List *list;
- struct Node *node;
- const char *name;
- int iter;
-
- list = AllocVecTagList(sizeof(struct List), NULL);
- NewList(list);
-
- if (nsoption_charp(search_engines_file) == NULL) return list;
-
- for (iter = search_web_iterate_providers(0, &name);
- iter != -1;
- iter = search_web_iterate_providers(iter, &name)) {
- node = AllocChooserNode(CNA_Text, name, TAG_DONE);
- AddTail(list, node);
- }
-
- return list;
-}
-
-void ami_gui_opts_websearch_free(struct List *websearchlist)
-{
- struct Node *node;
- struct Node *nnode;
-
- if(IsListEmpty(websearchlist)) return;
- node = GetHead(websearchlist);
-
- do {
- nnode = GetSucc(node);
- Remove(node);
- FreeChooserNode(node);
- } while((node = nnode));
-
- FreeVec(websearchlist);
-}
-
diff --git a/amiga/gui_options.h b/amiga/gui_options.h
deleted file mode 100755
index 04c1be51e..000000000
--- a/amiga/gui_options.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_GUI_OPTIONS_H
-#define AMIGA_GUI_OPTIONS_H
-/* Prefs GUI control */
-void ami_gui_opts_open(void);
-BOOL ami_gui_opts_event(void);
-void ami_gui_opts_close(void);
-
-/* Web search list */
-struct List *ami_gui_opts_websearch(void);
-void ami_gui_opts_websearch_free(struct List *websearchlist);
-
-char *current_user_options;
-#endif
-
diff --git a/amiga/hash/xxhash.c b/amiga/hash/xxhash.c
deleted file mode 100644
index d55a36154..000000000
--- a/amiga/hash/xxhash.c
+++ /dev/null
@@ -1,962 +0,0 @@
-/*
-xxHash - Fast Hash algorithm
-Copyright (C) 2012-2015, Yann Collet
-
-BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-You can contact the author at :
-- xxHash source repository : https://github.com/Cyan4973/xxHash
-*/
-
-
-/**************************************
-* Tuning parameters
-**************************************/
-/* XXH_FORCE_MEMORY_ACCESS
- * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable.
- * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal.
- * The below switch allow to select different access method for improved performance.
- * Method 0 (default) : use `memcpy()`. Safe and portable.
- * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable).
- * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`.
- * Method 2 : direct access. This method is portable but violate C standard.
- * It can generate buggy code on targets which generate assembly depending on alignment.
- * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6)
- * See http://stackoverflow.com/a/32095106/646947 for details.
- * Prefer these methods in priority order (0 > 1 > 2)
- */
-#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
-# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
-# define XXH_FORCE_MEMORY_ACCESS 2
-# elif defined(__INTEL_COMPILER) || \
- (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
-# define XXH_FORCE_MEMORY_ACCESS 1
-# endif
-#endif
-
-/* XXH_ACCEPT_NULL_INPUT_POINTER :
- * If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer.
- * When this option is enabled, xxHash output for null input pointers will be the same as a null-length input.
- * By default, this option is disabled. To enable it, uncomment below define :
- */
-/* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */
-
-/* XXH_FORCE_NATIVE_FORMAT :
- * By default, xxHash library provides endian-independant Hash values, based on little-endian convention.
- * Results are therefore identical for little-endian and big-endian CPU.
- * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format.
- * Should endian-independance be of no importance for your application, you may set the #define below to 1,
- * to improve speed for Big-endian CPU.
- * This option has no impact on Little_Endian CPU.
- */
-#define XXH_FORCE_NATIVE_FORMAT 1
-
-/* XXH_USELESS_ALIGN_BRANCH :
- * This is a minor performance trick, only useful with lots of very small keys.
- * It means : don't make a test between aligned/unaligned, because performance will be the same.
- * It saves one initial branch per hash.
- */
-#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
-# define XXH_USELESS_ALIGN_BRANCH 1
-#endif
-
-
-/**************************************
-* Compiler Specific Options
-***************************************/
-#ifdef _MSC_VER /* Visual Studio */
-# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
-# define FORCE_INLINE static __forceinline
-#else
-# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
-# ifdef __GNUC__
-# define FORCE_INLINE static inline __attribute__((always_inline))
-# else
-# define FORCE_INLINE static inline
-# endif
-# else
-# define FORCE_INLINE static
-# endif /* __STDC_VERSION__ */
-#endif
-
-
-/**************************************
-* Includes & Memory related functions
-***************************************/
-#include "xxhash.h"
-/* Modify the local functions below should you wish to use some other memory routines */
-/* for malloc(), free() */
-#include <stdlib.h>
-static void* XXH_malloc(size_t s) { return malloc(s); }
-static void XXH_free (void* p) { free(p); }
-/* for memcpy() */
-#include <string.h>
-static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
-
-
-/**************************************
-* Basic Types
-***************************************/
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
-# include <stdint.h>
- typedef uint8_t BYTE;
- typedef uint16_t U16;
- typedef uint32_t U32;
- typedef int32_t S32;
- typedef uint64_t U64;
-#else
- typedef unsigned char BYTE;
- typedef unsigned short U16;
- typedef unsigned int U32;
- typedef signed int S32;
- typedef unsigned long long U64;
-#endif
-
-
-#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2))
-
-/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */
-static U32 XXH_read32(const void* memPtr) { return *(const U32*) memPtr; }
-static U64 XXH_read64(const void* memPtr) { return *(const U64*) memPtr; }
-
-#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1))
-
-/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */
-/* currently only defined for gcc and icc */
-typedef union { U32 u32; U64 u64; } __attribute__((packed)) unalign;
-
-static U32 XXH_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
-static U64 XXH_read64(const void* ptr) { return ((const unalign*)ptr)->u64; }
-
-#else
-
-/* portable and safe solution. Generally efficient.
- * see : http://stackoverflow.com/a/32095106/646947
- */
-
-static U32 XXH_read32(const void* memPtr)
-{
- U32 val;
- memcpy(&val, memPtr, sizeof(val));
- return val;
-}
-
-static U64 XXH_read64(const void* memPtr)
-{
- U64 val;
- memcpy(&val, memPtr, sizeof(val));
- return val;
-}
-
-#endif // XXH_FORCE_DIRECT_MEMORY_ACCESS
-
-
-/******************************************
-* Compiler-specific Functions and Macros
-******************************************/
-#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-
-/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */
-#if defined(_MSC_VER)
-# define XXH_rotl32(x,r) _rotl(x,r)
-# define XXH_rotl64(x,r) _rotl64(x,r)
-#else
-# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
-# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r)))
-#endif
-
-#if defined(_MSC_VER) /* Visual Studio */
-# define XXH_swap32 _byteswap_ulong
-# define XXH_swap64 _byteswap_uint64
-#elif GCC_VERSION >= 403
-# define XXH_swap32 __builtin_bswap32
-# define XXH_swap64 __builtin_bswap64
-#else
-static U32 XXH_swap32 (U32 x)
-{
- return ((x << 24) & 0xff000000 ) |
- ((x << 8) & 0x00ff0000 ) |
- ((x >> 8) & 0x0000ff00 ) |
- ((x >> 24) & 0x000000ff );
-}
-static U64 XXH_swap64 (U64 x)
-{
- return ((x << 56) & 0xff00000000000000ULL) |
- ((x << 40) & 0x00ff000000000000ULL) |
- ((x << 24) & 0x0000ff0000000000ULL) |
- ((x << 8) & 0x000000ff00000000ULL) |
- ((x >> 8) & 0x00000000ff000000ULL) |
- ((x >> 24) & 0x0000000000ff0000ULL) |
- ((x >> 40) & 0x000000000000ff00ULL) |
- ((x >> 56) & 0x00000000000000ffULL);
-}
-#endif
-
-
-/***************************************
-* Architecture Macros
-***************************************/
-typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess;
-
-/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example one the compiler command line */
-#ifndef XXH_CPU_LITTLE_ENDIAN
- static const int one = 1;
-# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&one))
-#endif
-
-
-/*****************************
-* Memory reads
-*****************************/
-typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment;
-
-FORCE_INLINE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align)
-{
- if (align==XXH_unaligned)
- return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
- else
- return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
-}
-
-FORCE_INLINE U32 XXH_readLE32(const void* ptr, XXH_endianess endian)
-{
- return XXH_readLE32_align(ptr, endian, XXH_unaligned);
-}
-
-FORCE_INLINE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align)
-{
- if (align==XXH_unaligned)
- return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr));
- else
- return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr);
-}
-
-FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian)
-{
- return XXH_readLE64_align(ptr, endian, XXH_unaligned);
-}
-
-
-/***************************************
-* Macros
-***************************************/
-#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(!!(c)) }; } /* use only *after* variable declarations */
-
-
-/***************************************
-* Constants
-***************************************/
-#define PRIME32_1 2654435761U
-#define PRIME32_2 2246822519U
-#define PRIME32_3 3266489917U
-#define PRIME32_4 668265263U
-#define PRIME32_5 374761393U
-
-#define PRIME64_1 11400714785074694791ULL
-#define PRIME64_2 14029467366897019727ULL
-#define PRIME64_3 1609587929392839161ULL
-#define PRIME64_4 9650029242287828579ULL
-#define PRIME64_5 2870177450012600261ULL
-
-
-/*****************************
-* Simple Hash Functions
-*****************************/
-FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align)
-{
- const BYTE* p = (const BYTE*)input;
- const BYTE* bEnd = p + len;
- U32 h32;
-#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
-
-#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
- if (p==NULL)
- {
- len=0;
- bEnd=p=(const BYTE*)(size_t)16;
- }
-#endif
-
- if (len>=16)
- {
- const BYTE* const limit = bEnd - 16;
- U32 v1 = seed + PRIME32_1 + PRIME32_2;
- U32 v2 = seed + PRIME32_2;
- U32 v3 = seed + 0;
- U32 v4 = seed - PRIME32_1;
-
- do
- {
- v1 += XXH_get32bits(p) * PRIME32_2;
- v1 = XXH_rotl32(v1, 13);
- v1 *= PRIME32_1;
- p+=4;
- v2 += XXH_get32bits(p) * PRIME32_2;
- v2 = XXH_rotl32(v2, 13);
- v2 *= PRIME32_1;
- p+=4;
- v3 += XXH_get32bits(p) * PRIME32_2;
- v3 = XXH_rotl32(v3, 13);
- v3 *= PRIME32_1;
- p+=4;
- v4 += XXH_get32bits(p) * PRIME32_2;
- v4 = XXH_rotl32(v4, 13);
- v4 *= PRIME32_1;
- p+=4;
- }
- while (p<=limit);
-
- h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
- }
- else
- {
- h32 = seed + PRIME32_5;
- }
-
- h32 += (U32) len;
-
- while (p+4<=bEnd)
- {
- h32 += XXH_get32bits(p) * PRIME32_3;
- h32 = XXH_rotl32(h32, 17) * PRIME32_4 ;
- p+=4;
- }
-
- while (p<bEnd)
- {
- h32 += (*p) * PRIME32_5;
- h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
- p++;
- }
-
- h32 ^= h32 >> 15;
- h32 *= PRIME32_2;
- h32 ^= h32 >> 13;
- h32 *= PRIME32_3;
- h32 ^= h32 >> 16;
-
- return h32;
-}
-
-
-unsigned int XXH32 (const void* input, size_t len, unsigned int seed)
-{
-#if 0
- /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
- XXH32_state_t state;
- XXH32_reset(&state, seed);
- XXH32_update(&state, input, len);
- return XXH32_digest(&state);
-#else
- XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
-
-# if !defined(XXH_USELESS_ALIGN_BRANCH)
- if ((((size_t)input) & 3) == 0) /* Input is 4-bytes aligned, leverage the speed benefit */
- {
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned);
- else
- return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned);
- }
-# endif
-
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned);
- else
- return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned);
-#endif
-}
-
-FORCE_INLINE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align)
-{
- const BYTE* p = (const BYTE*)input;
- const BYTE* bEnd = p + len;
- U64 h64;
-#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align)
-
-#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
- if (p==NULL)
- {
- len=0;
- bEnd=p=(const BYTE*)(size_t)32;
- }
-#endif
-
- if (len>=32)
- {
- const BYTE* const limit = bEnd - 32;
- U64 v1 = seed + PRIME64_1 + PRIME64_2;
- U64 v2 = seed + PRIME64_2;
- U64 v3 = seed + 0;
- U64 v4 = seed - PRIME64_1;
-
- do
- {
- v1 += XXH_get64bits(p) * PRIME64_2;
- p+=8;
- v1 = XXH_rotl64(v1, 31);
- v1 *= PRIME64_1;
- v2 += XXH_get64bits(p) * PRIME64_2;
- p+=8;
- v2 = XXH_rotl64(v2, 31);
- v2 *= PRIME64_1;
- v3 += XXH_get64bits(p) * PRIME64_2;
- p+=8;
- v3 = XXH_rotl64(v3, 31);
- v3 *= PRIME64_1;
- v4 += XXH_get64bits(p) * PRIME64_2;
- p+=8;
- v4 = XXH_rotl64(v4, 31);
- v4 *= PRIME64_1;
- }
- while (p<=limit);
-
- h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18);
-
- v1 *= PRIME64_2;
- v1 = XXH_rotl64(v1, 31);
- v1 *= PRIME64_1;
- h64 ^= v1;
- h64 = h64 * PRIME64_1 + PRIME64_4;
-
- v2 *= PRIME64_2;
- v2 = XXH_rotl64(v2, 31);
- v2 *= PRIME64_1;
- h64 ^= v2;
- h64 = h64 * PRIME64_1 + PRIME64_4;
-
- v3 *= PRIME64_2;
- v3 = XXH_rotl64(v3, 31);
- v3 *= PRIME64_1;
- h64 ^= v3;
- h64 = h64 * PRIME64_1 + PRIME64_4;
-
- v4 *= PRIME64_2;
- v4 = XXH_rotl64(v4, 31);
- v4 *= PRIME64_1;
- h64 ^= v4;
- h64 = h64 * PRIME64_1 + PRIME64_4;
- }
- else
- {
- h64 = seed + PRIME64_5;
- }
-
- h64 += (U64) len;
-
- while (p+8<=bEnd)
- {
- U64 k1 = XXH_get64bits(p);
- k1 *= PRIME64_2;
- k1 = XXH_rotl64(k1,31);
- k1 *= PRIME64_1;
- h64 ^= k1;
- h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4;
- p+=8;
- }
-
- if (p+4<=bEnd)
- {
- h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1;
- h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3;
- p+=4;
- }
-
- while (p<bEnd)
- {
- h64 ^= (*p) * PRIME64_5;
- h64 = XXH_rotl64(h64, 11) * PRIME64_1;
- p++;
- }
-
- h64 ^= h64 >> 33;
- h64 *= PRIME64_2;
- h64 ^= h64 >> 29;
- h64 *= PRIME64_3;
- h64 ^= h64 >> 32;
-
- return h64;
-}
-
-
-unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed)
-{
-#if 0
- /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
- XXH64_state_t state;
- XXH64_reset(&state, seed);
- XXH64_update(&state, input, len);
- return XXH64_digest(&state);
-#else
- XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
-
-# if !defined(XXH_USELESS_ALIGN_BRANCH)
- if ((((size_t)input) & 7)==0) /* Input is aligned, let's leverage the speed advantage */
- {
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned);
- else
- return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned);
- }
-# endif
-
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned);
- else
- return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned);
-#endif
-}
-
-/****************************************************
-* Advanced Hash Functions
-****************************************************/
-
-/*** Allocation ***/
-typedef struct
-{
- U64 total_len;
- U32 seed;
- U32 v1;
- U32 v2;
- U32 v3;
- U32 v4;
- U32 mem32[4]; /* defined as U32 for alignment */
- U32 memsize;
-} XXH_istate32_t;
-
-typedef struct
-{
- U64 total_len;
- U64 seed;
- U64 v1;
- U64 v2;
- U64 v3;
- U64 v4;
- U64 mem64[4]; /* defined as U64 for alignment */
- U32 memsize;
-} XXH_istate64_t;
-
-
-XXH32_state_t* XXH32_createState(void)
-{
- XXH_STATIC_ASSERT(sizeof(XXH32_state_t) >= sizeof(XXH_istate32_t)); /* A compilation error here means XXH32_state_t is not large enough */
- return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t));
-}
-XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr)
-{
- XXH_free(statePtr);
- return XXH_OK;
-}
-
-XXH64_state_t* XXH64_createState(void)
-{
- XXH_STATIC_ASSERT(sizeof(XXH64_state_t) >= sizeof(XXH_istate64_t)); /* A compilation error here means XXH64_state_t is not large enough */
- return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t));
-}
-XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr)
-{
- XXH_free(statePtr);
- return XXH_OK;
-}
-
-
-/*** Hash feed ***/
-
-XXH_errorcode XXH32_reset(XXH32_state_t* state_in, unsigned int seed)
-{
- XXH_istate32_t* state = (XXH_istate32_t*) state_in;
- state->seed = seed;
- state->v1 = seed + PRIME32_1 + PRIME32_2;
- state->v2 = seed + PRIME32_2;
- state->v3 = seed + 0;
- state->v4 = seed - PRIME32_1;
- state->total_len = 0;
- state->memsize = 0;
- return XXH_OK;
-}
-
-XXH_errorcode XXH64_reset(XXH64_state_t* state_in, unsigned long long seed)
-{
- XXH_istate64_t* state = (XXH_istate64_t*) state_in;
- state->seed = seed;
- state->v1 = seed + PRIME64_1 + PRIME64_2;
- state->v2 = seed + PRIME64_2;
- state->v3 = seed + 0;
- state->v4 = seed - PRIME64_1;
- state->total_len = 0;
- state->memsize = 0;
- return XXH_OK;
-}
-
-
-FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state_in, const void* input, size_t len, XXH_endianess endian)
-{
- XXH_istate32_t* state = (XXH_istate32_t *) state_in;
- const BYTE* p = (const BYTE*)input;
- const BYTE* const bEnd = p + len;
-
-#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
- if (input==NULL) return XXH_ERROR;
-#endif
-
- state->total_len += len;
-
- if (state->memsize + len < 16) /* fill in tmp buffer */
- {
- XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
- state->memsize += (U32)len;
- return XXH_OK;
- }
-
- if (state->memsize) /* some data left from previous update */
- {
- XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
- {
- const U32* p32 = state->mem32;
- state->v1 += XXH_readLE32(p32, endian) * PRIME32_2;
- state->v1 = XXH_rotl32(state->v1, 13);
- state->v1 *= PRIME32_1;
- p32++;
- state->v2 += XXH_readLE32(p32, endian) * PRIME32_2;
- state->v2 = XXH_rotl32(state->v2, 13);
- state->v2 *= PRIME32_1;
- p32++;
- state->v3 += XXH_readLE32(p32, endian) * PRIME32_2;
- state->v3 = XXH_rotl32(state->v3, 13);
- state->v3 *= PRIME32_1;
- p32++;
- state->v4 += XXH_readLE32(p32, endian) * PRIME32_2;
- state->v4 = XXH_rotl32(state->v4, 13);
- state->v4 *= PRIME32_1;
- p32++;
- }
- p += 16-state->memsize;
- state->memsize = 0;
- }
-
- if (p <= bEnd-16)
- {
- const BYTE* const limit = bEnd - 16;
- U32 v1 = state->v1;
- U32 v2 = state->v2;
- U32 v3 = state->v3;
- U32 v4 = state->v4;
-
- do
- {
- v1 += XXH_readLE32(p, endian) * PRIME32_2;
- v1 = XXH_rotl32(v1, 13);
- v1 *= PRIME32_1;
- p+=4;
- v2 += XXH_readLE32(p, endian) * PRIME32_2;
- v2 = XXH_rotl32(v2, 13);
- v2 *= PRIME32_1;
- p+=4;
- v3 += XXH_readLE32(p, endian) * PRIME32_2;
- v3 = XXH_rotl32(v3, 13);
- v3 *= PRIME32_1;
- p+=4;
- v4 += XXH_readLE32(p, endian) * PRIME32_2;
- v4 = XXH_rotl32(v4, 13);
- v4 *= PRIME32_1;
- p+=4;
- }
- while (p<=limit);
-
- state->v1 = v1;
- state->v2 = v2;
- state->v3 = v3;
- state->v4 = v4;
- }
-
- if (p < bEnd)
- {
- XXH_memcpy(state->mem32, p, bEnd-p);
- state->memsize = (int)(bEnd-p);
- }
-
- return XXH_OK;
-}
-
-XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len)
-{
- XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
-
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH32_update_endian(state_in, input, len, XXH_littleEndian);
- else
- return XXH32_update_endian(state_in, input, len, XXH_bigEndian);
-}
-
-
-
-FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state_in, XXH_endianess endian)
-{
- const XXH_istate32_t* state = (const XXH_istate32_t*) state_in;
- const BYTE * p = (const BYTE*)state->mem32;
- const BYTE* bEnd = (const BYTE*)(state->mem32) + state->memsize;
- U32 h32;
-
- if (state->total_len >= 16)
- {
- h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18);
- }
- else
- {
- h32 = state->seed + PRIME32_5;
- }
-
- h32 += (U32) state->total_len;
-
- while (p+4<=bEnd)
- {
- h32 += XXH_readLE32(p, endian) * PRIME32_3;
- h32 = XXH_rotl32(h32, 17) * PRIME32_4;
- p+=4;
- }
-
- while (p<bEnd)
- {
- h32 += (*p) * PRIME32_5;
- h32 = XXH_rotl32(h32, 11) * PRIME32_1;
- p++;
- }
-
- h32 ^= h32 >> 15;
- h32 *= PRIME32_2;
- h32 ^= h32 >> 13;
- h32 *= PRIME32_3;
- h32 ^= h32 >> 16;
-
- return h32;
-}
-
-
-unsigned int XXH32_digest (const XXH32_state_t* state_in)
-{
- XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
-
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH32_digest_endian(state_in, XXH_littleEndian);
- else
- return XXH32_digest_endian(state_in, XXH_bigEndian);
-}
-
-
-FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state_in, const void* input, size_t len, XXH_endianess endian)
-{
- XXH_istate64_t * state = (XXH_istate64_t *) state_in;
- const BYTE* p = (const BYTE*)input;
- const BYTE* const bEnd = p + len;
-
-#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
- if (input==NULL) return XXH_ERROR;
-#endif
-
- state->total_len += len;
-
- if (state->memsize + len < 32) /* fill in tmp buffer */
- {
- XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len);
- state->memsize += (U32)len;
- return XXH_OK;
- }
-
- if (state->memsize) /* some data left from previous update */
- {
- XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize);
- {
- const U64* p64 = state->mem64;
- state->v1 += XXH_readLE64(p64, endian) * PRIME64_2;
- state->v1 = XXH_rotl64(state->v1, 31);
- state->v1 *= PRIME64_1;
- p64++;
- state->v2 += XXH_readLE64(p64, endian) * PRIME64_2;
- state->v2 = XXH_rotl64(state->v2, 31);
- state->v2 *= PRIME64_1;
- p64++;
- state->v3 += XXH_readLE64(p64, endian) * PRIME64_2;
- state->v3 = XXH_rotl64(state->v3, 31);
- state->v3 *= PRIME64_1;
- p64++;
- state->v4 += XXH_readLE64(p64, endian) * PRIME64_2;
- state->v4 = XXH_rotl64(state->v4, 31);
- state->v4 *= PRIME64_1;
- p64++;
- }
- p += 32-state->memsize;
- state->memsize = 0;
- }
-
- if (p+32 <= bEnd)
- {
- const BYTE* const limit = bEnd - 32;
- U64 v1 = state->v1;
- U64 v2 = state->v2;
- U64 v3 = state->v3;
- U64 v4 = state->v4;
-
- do
- {
- v1 += XXH_readLE64(p, endian) * PRIME64_2;
- v1 = XXH_rotl64(v1, 31);
- v1 *= PRIME64_1;
- p+=8;
- v2 += XXH_readLE64(p, endian) * PRIME64_2;
- v2 = XXH_rotl64(v2, 31);
- v2 *= PRIME64_1;
- p+=8;
- v3 += XXH_readLE64(p, endian) * PRIME64_2;
- v3 = XXH_rotl64(v3, 31);
- v3 *= PRIME64_1;
- p+=8;
- v4 += XXH_readLE64(p, endian) * PRIME64_2;
- v4 = XXH_rotl64(v4, 31);
- v4 *= PRIME64_1;
- p+=8;
- }
- while (p<=limit);
-
- state->v1 = v1;
- state->v2 = v2;
- state->v3 = v3;
- state->v4 = v4;
- }
-
- if (p < bEnd)
- {
- XXH_memcpy(state->mem64, p, bEnd-p);
- state->memsize = (int)(bEnd-p);
- }
-
- return XXH_OK;
-}
-
-XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len)
-{
- XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
-
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH64_update_endian(state_in, input, len, XXH_littleEndian);
- else
- return XXH64_update_endian(state_in, input, len, XXH_bigEndian);
-}
-
-
-
-FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state_in, XXH_endianess endian)
-{
- const XXH_istate64_t * state = (const XXH_istate64_t *) state_in;
- const BYTE * p = (const BYTE*)state->mem64;
- const BYTE* bEnd = (const BYTE*)state->mem64 + state->memsize;
- U64 h64;
-
- if (state->total_len >= 32)
- {
- U64 v1 = state->v1;
- U64 v2 = state->v2;
- U64 v3 = state->v3;
- U64 v4 = state->v4;
-
- h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18);
-
- v1 *= PRIME64_2;
- v1 = XXH_rotl64(v1, 31);
- v1 *= PRIME64_1;
- h64 ^= v1;
- h64 = h64*PRIME64_1 + PRIME64_4;
-
- v2 *= PRIME64_2;
- v2 = XXH_rotl64(v2, 31);
- v2 *= PRIME64_1;
- h64 ^= v2;
- h64 = h64*PRIME64_1 + PRIME64_4;
-
- v3 *= PRIME64_2;
- v3 = XXH_rotl64(v3, 31);
- v3 *= PRIME64_1;
- h64 ^= v3;
- h64 = h64*PRIME64_1 + PRIME64_4;
-
- v4 *= PRIME64_2;
- v4 = XXH_rotl64(v4, 31);
- v4 *= PRIME64_1;
- h64 ^= v4;
- h64 = h64*PRIME64_1 + PRIME64_4;
- }
- else
- {
- h64 = state->seed + PRIME64_5;
- }
-
- h64 += (U64) state->total_len;
-
- while (p+8<=bEnd)
- {
- U64 k1 = XXH_readLE64(p, endian);
- k1 *= PRIME64_2;
- k1 = XXH_rotl64(k1,31);
- k1 *= PRIME64_1;
- h64 ^= k1;
- h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4;
- p+=8;
- }
-
- if (p+4<=bEnd)
- {
- h64 ^= (U64)(XXH_readLE32(p, endian)) * PRIME64_1;
- h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3;
- p+=4;
- }
-
- while (p<bEnd)
- {
- h64 ^= (*p) * PRIME64_5;
- h64 = XXH_rotl64(h64, 11) * PRIME64_1;
- p++;
- }
-
- h64 ^= h64 >> 33;
- h64 *= PRIME64_2;
- h64 ^= h64 >> 29;
- h64 *= PRIME64_3;
- h64 ^= h64 >> 32;
-
- return h64;
-}
-
-
-unsigned long long XXH64_digest (const XXH64_state_t* state_in)
-{
- XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
-
- if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
- return XXH64_digest_endian(state_in, XXH_littleEndian);
- else
- return XXH64_digest_endian(state_in, XXH_bigEndian);
-}
-
-
diff --git a/amiga/hash/xxhash.h b/amiga/hash/xxhash.h
deleted file mode 100644
index c60aa6157..000000000
--- a/amiga/hash/xxhash.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- xxHash - Extremely Fast Hash algorithm
- Header File
- Copyright (C) 2012-2015, Yann Collet.
-
- BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following disclaimer
- in the documentation and/or other materials provided with the
- distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- You can contact the author at :
- - xxHash source repository : https://github.com/Cyan4973/xxHash
-*/
-
-/* Notice extracted from xxHash homepage :
-
-xxHash is an extremely fast Hash algorithm, running at RAM speed limits.
-It also successfully passes all tests from the SMHasher suite.
-
-Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz)
-
-Name Speed Q.Score Author
-xxHash 5.4 GB/s 10
-CrapWow 3.2 GB/s 2 Andrew
-MumurHash 3a 2.7 GB/s 10 Austin Appleby
-SpookyHash 2.0 GB/s 10 Bob Jenkins
-SBox 1.4 GB/s 9 Bret Mulvey
-Lookup3 1.2 GB/s 9 Bob Jenkins
-SuperFastHash 1.2 GB/s 1 Paul Hsieh
-CityHash64 1.05 GB/s 10 Pike & Alakuijala
-FNV 0.55 GB/s 5 Fowler, Noll, Vo
-CRC32 0.43 GB/s 9
-MD5-32 0.33 GB/s 10 Ronald L. Rivest
-SHA1-32 0.28 GB/s 10
-
-Q.Score is a measure of quality of the hash function.
-It depends on successfully passing SMHasher test set.
-10 is a perfect score.
-
-A 64-bits version, named XXH64, is available since r35.
-It offers much better speed, but for 64-bits applications only.
-Name Speed on 64 bits Speed on 32 bits
-XXH64 13.8 GB/s 1.9 GB/s
-XXH32 6.8 GB/s 6.0 GB/s
-*/
-
-#pragma once
-
-#if defined (__cplusplus)
-extern "C" {
-#endif
-
-
-/*****************************
-* Definitions
-*****************************/
-#include <stddef.h> /* size_t */
-typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
-
-
-/*****************************
-* Namespace Emulation
-*****************************/
-/* Motivations :
-
-If you need to include xxHash into your library,
-but wish to avoid xxHash symbols to be present on your library interface
-in an effort to avoid potential name collision if another library also includes xxHash,
-
-you can use XXH_NAMESPACE, which will automatically prefix any symbol from xxHash
-with the value of XXH_NAMESPACE (so avoid to keep it NULL, and avoid numeric values).
-
-Note that no change is required within the calling program :
-it can still call xxHash functions using their regular name.
-They will be automatically translated by this header.
-*/
-#ifdef XXH_NAMESPACE
-# define XXH_CAT(A,B) A##B
-# define XXH_NAME2(A,B) XXH_CAT(A,B)
-# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
-# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64)
-# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState)
-# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState)
-# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState)
-# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState)
-# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
-# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
-# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
-# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
-# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
-# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
-#endif
-
-
-/*****************************
-* Simple Hash Functions
-*****************************/
-
-unsigned int XXH32 (const void* input, size_t length, unsigned seed);
-unsigned long long XXH64 (const void* input, size_t length, unsigned long long seed);
-
-/*
-XXH32() :
- Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input".
- The memory between input & input+length must be valid (allocated and read-accessible).
- "seed" can be used to alter the result predictably.
- This function successfully passes all SMHasher tests.
- Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s
-XXH64() :
- Calculate the 64-bits hash of sequence of length "len" stored at memory address "input".
- Faster on 64-bits systems. Slower on 32-bits systems.
-*/
-
-
-
-/*****************************
-* Advanced Hash Functions
-*****************************/
-typedef struct { long long ll[ 6]; } XXH32_state_t;
-typedef struct { long long ll[11]; } XXH64_state_t;
-
-/*
-These structures allow static allocation of XXH states.
-States must then be initialized using XXHnn_reset() before first use.
-
-If you prefer dynamic allocation, please refer to functions below.
-*/
-
-XXH32_state_t* XXH32_createState(void);
-XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr);
-
-XXH64_state_t* XXH64_createState(void);
-XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr);
-
-/*
-These functions create and release memory for XXH state.
-States must then be initialized using XXHnn_reset() before first use.
-*/
-
-
-XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned seed);
-XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length);
-unsigned int XXH32_digest (const XXH32_state_t* statePtr);
-
-XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed);
-XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length);
-unsigned long long XXH64_digest (const XXH64_state_t* statePtr);
-
-/*
-These functions calculate the xxHash of an input provided in multiple smaller packets,
-as opposed to an input provided as a single block.
-
-XXH state space must first be allocated, using either static or dynamic method provided above.
-
-Start a new hash by initializing state with a seed, using XXHnn_reset().
-
-Then, feed the hash state by calling XXHnn_update() as many times as necessary.
-Obviously, input must be valid, meaning allocated and read accessible.
-The function returns an error code, with 0 meaning OK, and any other value meaning there is an error.
-
-Finally, you can produce a hash anytime, by using XXHnn_digest().
-This function returns the final nn-bits hash.
-You can nonetheless continue feeding the hash state with more input,
-and therefore get some new hashes, by calling again XXHnn_digest().
-
-When you are done, don't forget to free XXH state space, using typically XXHnn_freeState().
-*/
-
-
-#if defined (__cplusplus)
-}
-#endif
diff --git a/amiga/help.c b/amiga/help.c
deleted file mode 100755
index 64b338426..000000000
--- a/amiga/help.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2013-4 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include "amiga/help.h"
-
-/* AmigaGuide class */
-#include "amiga/agclass/amigaguide_class.h"
-
-Class *AmigaGuideClass = NULL;
-Object *AmigaGuideObject = NULL;
-
-/* This array needs to match the enum in help.h */
-CONST_STRPTR context_nodes[] = {
- "Main",
- "GUI",
- "Prefs",
- NULL
-};
-
-static void ami_help_init(struct Screen *screen)
-{
- AmigaGuideClass = initAGClass();
-
- AmigaGuideObject = NewObject(AmigaGuideClass, NULL,
- AMIGAGUIDE_Name, "PROGDIR:NetSurf.guide",
- AMIGAGUIDE_BaseName, "NetSurf",
- AMIGAGUIDE_Screen, screen,
- AMIGAGUIDE_ContextArray, context_nodes,
- AMIGAGUIDE_ContextID, AMI_HELP_MAIN,
- TAG_DONE);
-}
-
-void ami_help_open(ULONG node, struct Screen *screen)
-{
- if(AmigaGuideObject == NULL) ami_help_init(screen);
- SetAttrs(AmigaGuideObject, AMIGAGUIDE_ContextID, node, TAG_DONE);
- IDoMethod(AmigaGuideObject, AGM_OPEN, NULL);
-}
-
-void ami_help_free(void)
-{
- if (AmigaGuideObject) DisposeObject(AmigaGuideObject);
- if (AmigaGuideClass) freeAGClass(AmigaGuideClass);
-
- AmigaGuideObject = NULL;
- AmigaGuideClass = NULL;
-}
-
-void ami_help_new_screen(struct Screen *screen)
-{
- if(AmigaGuideObject == NULL) return;
- SetAttrs(AmigaGuideObject, AMIGAGUIDE_Screen, screen, TAG_DONE);
-}
-
-ULONG ami_help_signal(void)
-{
- ULONG ag_sig = 0;
- if(AmigaGuideObject)
- GetAttr(AMIGAGUIDE_Signal, AmigaGuideObject, &ag_sig);
- return ag_sig;
-}
-
-void ami_help_process(void)
-{
- ULONG ret = IDoMethod(AmigaGuideObject, AGM_PROCESS, NULL);
- if(ret) ami_help_free();
-}
-
diff --git a/amiga/help.h b/amiga/help.h
deleted file mode 100755
index e405edd0c..000000000
--- a/amiga/help.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2013 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_HELP_H
-#define AMIGA_HELP_H
-#include <exec/types.h>
-
-/* This enum needs to match context_array in help.c */
-enum {
- AMI_HELP_MAIN,
- AMI_HELP_GUI,
- AMI_HELP_PREFS,
-};
-
-struct Screen;
-
-void ami_help_open(ULONG node, struct Screen *screen);
-void ami_help_free(void);
-void ami_help_new_screen(struct Screen *screen);
-ULONG ami_help_signal(void);
-void ami_help_process(void);
-#endif
-
diff --git a/amiga/history.c b/amiga/history.c
deleted file mode 100755
index 72b69d435..000000000
--- a/amiga/history.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdbool.h>
-#include <proto/exec.h>
-
-#include "utils/errors.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/history.h"
-#include "amiga/tree.h"
-#include "amiga/tree.h"
-
-void ami_global_history_initialise(void)
-{
- global_history_window = ami_tree_create(TREE_HISTORY, NULL);
-
- if(!global_history_window) return;
-}
-
-void ami_global_history_free()
-{
- ami_tree_destroy(global_history_window);
- global_history_window = NULL;
-}
diff --git a/amiga/history.h b/amiga/history.h
deleted file mode 100755
index 1f064746a..000000000
--- a/amiga/history.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2008,2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_HISTORY_H
-#define AMIGA_HISTORY_H
-#include "desktop/tree.h"
-
-#define GLOBAL_HISTORY_RECENT_URLS 16
-
-void ami_global_history_initialise(void);
-void ami_global_history_free(void);
-
-struct treeview_window *global_history_window;
-#endif
diff --git a/amiga/history_local.c b/amiga/history_local.c
deleted file mode 100755
index 3016cbf16..000000000
--- a/amiga/history_local.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright 2009, 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Browser history window (AmigaOS implementation).
- *
- * There is only one history window, not one per browser window.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <intuition/icclass.h>
-#include <proto/utility.h>
-#include <proto/window.h>
-#include <proto/space.h>
-#include <proto/layout.h>
-#include <classes/window.h>
-#include <gadgets/space.h>
-#include <gadgets/scroller.h>
-#include <reaction/reaction.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/log.h"
-#include "utils/utils.h"
-#include "utils/messages.h"
-#include "desktop/browser_history.h"
-#include "desktop/browser.h"
-#include "desktop/plotters.h"
-#include "desktop/gui_window.h"
-#include "graphics/rpattr.h"
-
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "amiga/gui.h"
-#include "amiga/history_local.h"
-
-void ami_history_update_extent(struct history_window *hw);
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *);
-
-/**
- * Redraw history window.
- */
-
-static void ami_history_redraw(struct history_window *hw)
-{
- struct IBox *bbox;
- ULONG xs,ys;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot
- };
-
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- glob = &hw->gg;
-
- SetRPAttrs(glob->rp, RPTAG_APenColor, 0xffffffff, TAG_DONE);
- RectFill(glob->rp, 0, 0, bbox->Width - 1, bbox->Height - 1);
-
- browser_window_history_redraw_rectangle(hw->gw->bw, xs, ys,
- bbox->Width + xs, bbox->Height + ys, 0, 0, &ctx);
-
- glob = &browserglob;
-
- ami_clearclipreg(&hw->gg);
- ami_history_update_extent(hw);
-
- BltBitMapRastPort(hw->gg.bm, 0, 0, hw->win->RPort,
- bbox->Left, bbox->Top, bbox->Width, bbox->Height, 0x0C0);
-
- ami_gui_free_space_box(bbox);
-}
-
-
-/* exported interface documented in amiga/history_local.h */
-void ami_history_open(struct gui_window *gw)
-{
- struct history *history;
- int width, height;
-
- if (gw->bw == NULL)
- return;
-
- history = browser_window_get_history(gw->bw);
- if (history == NULL)
- return;
-
- if(!gw->hw)
- {
- gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0);
-
- ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height, false);
-
- gw->hw->gw = gw;
- browser_window_history_size(gw->bw, &width, &height);
-
- gw->hw->scrollerhook.h_Entry = (void *)ami_history_scroller_hook;
- gw->hw->scrollerhook.h_Data = gw->hw;
-
- gw->hw->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, messages_get("History"),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- WA_InnerWidth,width,
- WA_InnerHeight,height + 10,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,gw->hw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_GadgetHelp, TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_HorizProp,1,
- WINDOW_VertProp,1,
- WINDOW_IDCMPHook,&gw->hw->scrollerhook,
- WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,
-// WA_ReportMouse,TRUE,
- WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, // | IDCMP_MOUSEMOVE,
- WINDOW_ParentGroup, gw->hw->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, gw->hw->objects[GID_BROWSER] = SpaceObj,
- GA_ID,GID_BROWSER,
-// SPACE_MinWidth,width,
-// SPACE_MinHeight,height,
- SpaceEnd,
- EndGroup,
- EndWindow;
-
- gw->hw->win = (struct Window *)RA_OpenWindow(gw->hw->objects[OID_MAIN]);
- gw->hw->node = AddObject(window_list,AMINS_HISTORYWINDOW);
- gw->hw->node->objstruct = gw->hw;
-
- GetAttr(WINDOW_HorizObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_HSCROLL]);
- GetAttr(WINDOW_VertObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_VSCROLL]);
-
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_VSCROLL],gw->hw->win,NULL,
- GA_ID,OID_VSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_HSCROLL],gw->hw->win,NULL,
- GA_ID,OID_HSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
- }
-
- ami_history_redraw(gw->hw);
-}
-
-
-/**
- * Handle mouse clicks in the history window.
- *
- * \return true if the event was handled, false to pass it on
- */
-
-static bool ami_history_click(struct history_window *hw, uint16 code)
-{
- int x, y;
- struct IBox *bbox;
- ULONG xs, ys;
-
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return false;
- }
-
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- x = hw->win->MouseX - bbox->Left +xs;
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- y = hw->win->MouseY - bbox->Top + ys;
-
- ami_gui_free_space_box(bbox);
-
- switch(code)
- {
- case SELECTUP:
- browser_window_history_click(hw->gw->bw, x, y, false);
- ami_history_redraw(hw);
- ami_schedule_redraw(hw->gw->shared, true);
- break;
-
- case MIDDLEUP:
- browser_window_history_click(hw->gw->bw, x, y, true);
- ami_history_redraw(hw);
- break;
- }
-
- return true;
-}
-
-void ami_history_close(struct history_window *hw)
-{
- ami_free_layers(&hw->gg);
- hw->gw->hw = NULL;
- DisposeObject(hw->objects[OID_MAIN]);
- DelObject(hw->node);
-}
-
-BOOL ami_history_event(struct history_window *hw)
-{
- /* return TRUE if window destroyed */
- ULONG result = 0;
- uint16 code;
- const char *url;
- struct IBox *bbox;
- ULONG xs, ys;
-
- while((result = RA_HandleInput(hw->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
-/* no menus yet, copied in as will probably need it later
- case WMHI_MENUPICK:
- item = ItemAddress(gwin->win->MenuStrip,code);
- while (code != MENUNULL)
- {
- ami_menupick(code,gwin);
- if(win_destroyed) break;
- code = item->NextSelect;
- }
- break;
-*/
-
- case WMHI_MOUSEMOVE:
- GetAttr(SCROLLER_Top, hw->objects[OID_HSCROLL], (ULONG *)&xs);
- GetAttr(SCROLLER_Top, hw->objects[OID_VSCROLL], (ULONG *)&ys);
-
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- break;
- }
-
- url = browser_window_history_position_url(hw->gw->bw,
- hw->win->MouseX - bbox->Left + xs,
- hw->win->MouseY - bbox->Top + ys);
-
- ami_gui_free_space_box(bbox);
-
- RefreshSetGadgetAttrs((APTR)hw->objects[GID_BROWSER],
- hw->win, NULL,
- GA_HintInfo, url,
- TAG_DONE);
- break;
-
- case WMHI_NEWSIZE:
- ami_history_redraw(hw);
- break;
-
- case WMHI_MOUSEBUTTONS:
- ami_history_click(hw,code);
- break;
-
- case WMHI_CLOSEWINDOW:
- ami_history_close(hw);
- return TRUE;
- break;
- }
- }
- return FALSE;
-}
-
-void ami_history_update_extent(struct history_window *hw)
-{
- struct IBox *bbox;
- int width, height;
-
- browser_window_history_size(hw->gw->bw, &width, &height);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_VSCROLL], hw->win, NULL,
- GA_ID, OID_VSCROLL,
- SCROLLER_Total, height,
- SCROLLER_Visible, bbox->Height,
- ICA_TARGET, ICTARGET_IDCMP,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_HSCROLL], hw->win, NULL,
- GA_ID, OID_HSCROLL,
- SCROLLER_Total, width,
- SCROLLER_Visible, bbox->Width,
- ICA_TARGET, ICTARGET_IDCMP,
- TAG_DONE);
-
- ami_gui_free_space_box(bbox);
-}
-
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *)
-{
- ULONG gid;
- struct history_window *hw = hook->h_Data;
-
- if (msg->Class == IDCMP_IDCMPUPDATE)
- {
- gid = GetTagData( GA_ID, 0, msg->IAddress );
-
- switch( gid )
- {
- case OID_HSCROLL:
- case OID_VSCROLL:
- ami_history_redraw(hw);
- break;
- }
- }
-// ReplyMsg((struct Message *)msg);
-}
diff --git a/amiga/history_local.h b/amiga/history_local.h
deleted file mode 100755
index 452fe1512..000000000
--- a/amiga/history_local.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_HISTORY_LOCAL_H
-#define AMIGA_HISTORY_LOCAL_H
-
-#include <exec/types.h>
-#include <intuition/classusr.h>
-#include "amiga/gui.h"
-
-struct history_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_LAST];
- struct gui_window *gw;
- struct Hook scrollerhook;
- struct gui_globals gg;
-};
-
-/**
- * Open history window.
- *
- * \param gw gui_window to open history for
- */
-void ami_history_open(struct gui_window *gw);
-
-void ami_history_close(struct history_window *hw);
-BOOL ami_history_event(struct history_window *hw);
-#endif
-
diff --git a/amiga/hotlist.c b/amiga/hotlist.c
deleted file mode 100755
index 79e679f77..000000000
--- a/amiga/hotlist.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <string.h>
-#include <proto/exec.h>
-
-#include "utils/nsurl.h"
-#include "desktop/hotlist.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/hotlist.h"
-#include "amiga/tree.h"
-
-struct ami_hotlist_ctx {
- void *userdata;
- int level;
- int item;
- const char *folder; /* folder we're interested in */
- bool in_menu; /* set if we are in that folder */
- bool found; /* set if the folder is found */
- bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder);
-};
-
-
-void ami_hotlist_initialise(const char *hotlist_file)
-{
- tree_hotlist_path = hotlist_file;
- hotlist_window = ami_tree_create(TREE_HOTLIST, NULL);
- if(!hotlist_window) return;
-}
-
-void ami_hotlist_free(const char *hotlist_file)
-{
- ami_tree_destroy(hotlist_window);
- hotlist_window = NULL;
-}
-
-
-static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
-{
- struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
-
- if(menu_ctx->in_menu == true) {
- if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title, NULL, true) == true)
- menu_ctx->item++;
- } else {
- if((menu_ctx->level == 0) && (strcmp(title, menu_ctx->folder) == 0)) {
- menu_ctx->in_menu = true;
- menu_ctx->found = true;
- }
- }
- menu_ctx->level++;
- return NSERROR_OK;
-}
-
-static nserror ami_hotlist_address_cb(void *ctx, nsurl *url, const char *title)
-{
- struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
-
- if(menu_ctx->in_menu == true) {
- if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title, url, false) == true)
- menu_ctx->item++;
- }
-
- return NSERROR_OK;
-}
-
-static nserror ami_hotlist_folder_leave_cb(void *ctx)
-{
- struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
-
- menu_ctx->level--;
-
- if((menu_ctx->in_menu == true) && (menu_ctx->level == 0))
- menu_ctx->in_menu = false;
-
- return NSERROR_OK;
-}
-
-nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
- bool (*cb_add_item)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder))
-{
- nserror error;
- struct ami_hotlist_ctx ctx;
-
- ctx.level = 0;
- ctx.item = first_item;
- ctx.folder = folder;
- ctx.in_menu = false;
- ctx.userdata = userdata;
- ctx.cb = cb_add_item;
- ctx.found = false;
-
- error = hotlist_iterate(&ctx,
- ami_hotlist_folder_enter_cb,
- ami_hotlist_address_cb,
- ami_hotlist_folder_leave_cb);
-
- if((error == NSERROR_OK) && (ctx.found == false))
- hotlist_add_folder(folder, false, 0);
-
- return error;
-}
diff --git a/amiga/hotlist.h b/amiga/hotlist.h
deleted file mode 100755
index c50ceecfb..000000000
--- a/amiga/hotlist.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_HOTLIST_H
-#define AMIGA_HOTLIST_H
-
-#include "desktop/tree.h"
-#include "amiga/tree.h"
-
-struct nsurl;
-
-void ami_hotlist_initialise(const char *hotlist_file);
-void ami_hotlist_free(const char *hotlist_file);
-nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
- bool (*cb_add_item)(void *userdata, int level, int item, const char *title, struct nsurl *url, bool folder));
-
-struct treeview_window *hotlist_window;
-
-#endif
diff --git a/amiga/icon.c b/amiga/icon.c
deleted file mode 100644
index e75bf82b0..000000000
--- a/amiga/icon.c
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Content for image/x-amiga-icon (icon.library implementation).
- *
- */
-
-#include "utils/config.h"
-
-#include <assert.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdbool.h>
-
-#include <proto/exec.h>
-#include <proto/icon.h>
-
-#include <datatypes/pictureclass.h>
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#endif
-#include <workbench/icon.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/file.h"
-#include "desktop/plotters.h"
-#include "image/bitmap.h"
-#include "content/content_protected.h"
-
-#include "amiga/os3support.h"
-#include "amiga/bitmap.h"
-#include "amiga/icon.h"
-#include "amiga/misc.h"
-
-#define THUMBNAIL_WIDTH 100 /* Icon sizes for thumbnails, usually the same as */
-#define THUMBNAIL_HEIGHT 86 /* WIDTH/HEIGHT in desktop/thumbnail.c */
-
-ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG height,
- ULONG trans, ULONG pals1, struct ColorRegister *pal1, int alpha);
-
-#ifdef WITH_AMIGA_ICON
-
-typedef struct amiga_icon_content {
- struct content base;
-
- struct bitmap *bitmap; /**< Created NetSurf bitmap */
-} amiga_icon_content;
-
-static nserror amiga_icon_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c);
-static bool amiga_icon_convert(struct content *c);
-static void amiga_icon_destroy(struct content *c);
-static bool amiga_icon_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx);
-static nserror amiga_icon_clone(const struct content *old,
- struct content **newc);
-static content_type amiga_icon_content_type(void);
-
-static void *amiga_icon_get_internal(const struct content *c, void *context)
-{
- amiga_icon_content *icon_c = (amiga_icon_content *)c;
-
- return icon_c->bitmap;
-}
-
-static const content_handler amiga_icon_content_handler = {
- .create = amiga_icon_create,
- .data_complete = amiga_icon_convert,
- .destroy = amiga_icon_destroy,
- .redraw = amiga_icon_redraw,
- .clone = amiga_icon_clone,
- .get_internal = amiga_icon_get_internal,
- .type = amiga_icon_content_type,
- .no_share = false,
-};
-
-static const char *amiga_icon_types[] = {
- "image/x-amiga-icon"
-};
-
-CONTENT_FACTORY_REGISTER_TYPES(amiga_icon, amiga_icon_types,
- amiga_icon_content_handler)
-
-nserror amiga_icon_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- amiga_icon_content *ai_content;
- nserror error;
-
- ai_content = calloc(1, sizeof(amiga_icon_content));
- if (ai_content == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&ai_content->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(ai_content);
- return error;
- }
-
- *c = (struct content *)ai_content;
-
- return NSERROR_OK;
-}
-
-/**
- * Convert a CONTENT_AMIGA_ICON for display.
- *
- * No conversion is necessary. We merely read the icon dimensions.
- */
-
-bool amiga_icon_convert(struct content *c)
-{
- amiga_icon_content *icon_c = (amiga_icon_content *)c;
- union content_msg_data msg_data;
- struct DiskObject *dobj;
- ULONG *imagebuf;
- unsigned char *imagebufptr = NULL;
- ULONG size;
- int width = 0, height = 0;
- long format = 0;
- uint8 r, g, b, a;
- ULONG offset;
- char *filename = NULL;
- char *p;
- ULONG trans, pals1;
- struct ColorRegister *pal1;
-
- netsurf_nsurl_to_path(content_get_url(c), &filename);
- /* This loader will only work on local files, so fail if not a local path */
- if(filename == NULL)
- {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
- return false;
- }
-
- p = strstr(filename, ".info");
- *p = '\0';
-
- dobj = GetIconTagList(filename, NULL);
-
- if(dobj == NULL)
- {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
- return false;
- }
-
- IconControl(dobj,
- ICONCTRLA_GetImageDataFormat,&format,
- ICONCTRLA_GetWidth,&width,
- ICONCTRLA_GetHeight,&height,
- TAG_DONE);
-
- /* Check icon is direct mapped (truecolour) or palette-mapped colour.
- We need additional code to handle planar icons */
- if((format != IDFMT_DIRECTMAPPED) && (format==IDFMT_PALETTEMAPPED)) {
- if(dobj) FreeDiskObject(dobj);
- return false;
- }
-
- icon_c->bitmap = amiga_bitmap_create(width, height, BITMAP_NEW);
- if (!icon_c->bitmap) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
- if(dobj) FreeDiskObject(dobj);
- return false;
- }
- imagebuf = (ULONG *) amiga_bitmap_get_buffer(icon_c->bitmap);
- if (!imagebuf) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
- if(dobj) FreeDiskObject(dobj);
- return false;
- }
-
- IconControl(dobj,
- ICONCTRLA_GetImageData1, &imagebufptr,
- TAG_DONE);
-
- if(format==IDFMT_PALETTEMAPPED)
- {
- IconControl(dobj, ICONCTRLA_GetTransparentColor1, &trans,
- ICONCTRLA_GetPalette1, &pal1,
- ICONCTRLA_GetPaletteSize1, &pals1,
- TAG_DONE);
-
- imagebufptr = (unsigned char *) amiga_icon_convertcolouricon32((UBYTE *)imagebufptr,
- width, height, trans, pals1, pal1, 0xff);
- }
-
- /* Decoded data is ARGB, so ensure correct byte order */
-
- size = width * height * 4;
-
- for (offset = 0; offset < size; offset += 4) {
- b = imagebufptr[offset+3];
- g = imagebufptr[offset+2];
- r = imagebufptr[offset+1];
- a = imagebufptr[offset];
-
- *imagebuf = r << 24 | g << 16 | b << 8 | a;
- imagebuf++;
- }
-
- c->width = width;
- c->height = height;
-
- amiga_bitmap_modified(icon_c->bitmap);
- content_set_ready(c);
- content_set_done(c);
- content_set_status(c, "");
-
- if(dobj) FreeDiskObject(dobj);
-
- if(format==IDFMT_PALETTEMAPPED)
- FreeVec(imagebufptr);
-
- return true;
-}
-
-
-/**
- * Destroy a CONTENT_AMIGA_ICON and free all resources it owns.
- */
-
-void amiga_icon_destroy(struct content *c)
-{
- amiga_icon_content *icon_c = (amiga_icon_content *)c;
-
- if (icon_c->bitmap != NULL)
- amiga_bitmap_destroy(icon_c->bitmap);
-}
-
-
-/**
- * Redraw a CONTENT_AMIGA_ICON.
- */
-
-bool amiga_icon_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx)
-{
- amiga_icon_content *icon_c = (amiga_icon_content *)c;
- bitmap_flags_t flags = BITMAPF_NONE;
-
- if (data->repeat_x)
- flags |= BITMAPF_REPEAT_X;
- if (data->repeat_y)
- flags |= BITMAPF_REPEAT_Y;
-
- return ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- icon_c->bitmap, data->background_colour, flags);
-}
-
-
-nserror amiga_icon_clone(const struct content *old, struct content **newc)
-{
- amiga_icon_content *ai;
- nserror error;
-
- ai = calloc(1, sizeof(amiga_icon_content));
- if (ai == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &ai->base);
- if (error != NSERROR_OK) {
- content_destroy(&ai->base);
- return error;
- }
-
- /* Simply replay convert */
- if (old->status == CONTENT_STATUS_READY ||
- old->status == CONTENT_STATUS_DONE) {
- if (amiga_icon_convert(&ai->base) == false) {
- content_destroy(&ai->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- *newc = (struct content *) ai;
-
- return NSERROR_OK;
-}
-
-content_type amiga_icon_content_type(void)
-{
- return CONTENT_IMAGE;
-}
-
-#endif /* WITH_AMIGA_ICON */
-
-ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG height,
- ULONG trans, ULONG pals1, struct ColorRegister *pal1, int alpha)
-{
- ULONG *argbicon;
- struct ColorRegister *colour;
- struct ColorMap *cmap;
- ULONG i;
- ULONG a,r,g,b;
-
- if (alpha==0) alpha=0xff;
-
- argbicon = (ULONG *)AllocVecTagList(width*height*4, NULL);
- if (!argbicon) return(NULL);
-
- cmap=GetColorMap(pals1);
- if(!cmap) return(NULL);
-
- for(i=0;i<(width*height);i++)
- {
- colour = &pal1[icondata[i]];
-
- if(icondata[i] == trans)
- {
- a=0x00;
- }
- else
- {
- a=alpha;
- }
-
- r = colour->red;
- g = colour->green;
- b = colour->blue;
-
- argbicon[i] = (a << 24) +
- (r << 16) +
- (g << 8) +
- (b);
- }
-
- return(argbicon);
-
-}
-
-void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct DiskObject *dobj)
-{
- struct BitMap *bm = NULL;
- ULONG *icondata1, *icondata2;
- ULONG width, height;
- long format = 0;
-
- if(dobj == NULL) return;
-
- IconControl(dobj,
- ICONCTRLA_GetImageDataFormat,&format,
- ICONCTRLA_GetImageData1,&icondata1,
- ICONCTRLA_GetImageData2,&icondata2,
- ICONCTRLA_GetWidth,&width,
- ICONCTRLA_GetHeight,&height,
- TAG_DONE);
-
- if(format != IDFMT_DIRECTMAPPED) return;
-#ifdef __amigaos4__
- if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) {
- bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL);
- }
-
- if(bm) {
- BltBitMapTags(BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_DestX, width - 16,
- BLITA_DestY, height - 16,
- BLITA_Width, 16,
- BLITA_Height, 16,
- BLITA_Source, bm,
- BLITA_Dest, icondata1,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_DestType, BLITT_ARGB32,
- BLITA_DestBytesPerRow, width * 4,
- BLITA_UseSrcAlpha, TRUE,
- TAG_DONE);
-
- BltBitMapTags(BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_DestX, width - 16,
- BLITA_DestY, height - 16,
- BLITA_Width, 16,
- BLITA_Height, 16,
- BLITA_Source, bm,
- BLITA_Dest, icondata2,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_DestType, BLITT_ARGB32,
- BLITA_DestBytesPerRow, width * 4,
- BLITA_UseSrcAlpha, TRUE,
- TAG_DONE);
- }
-#endif
-}
-
-void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type)
-{
- struct DiskObject *dobj = NULL;
- ULONG *icondata1, *icondata2;
- ULONG width, height;
- long format = 0;
- ULONG trans1, pals1;
- ULONG trans2, pals2;
- struct ColorRegister *pal1;
- struct ColorRegister *pal2;
-
- if(icon == NULL) return;
-
- if(!type)
- {
- dobj = GetIconTags(NULL,
- ICONGETA_GetDefaultType, WBDRAWER,
- TAG_DONE);
- }
- else
- {
- dobj = GetIconTags(NULL, ICONGETA_GetDefaultName, type,
- ICONGETA_GetDefaultType, WBPROJECT,
- TAG_DONE);
- }
-
- if(dobj == NULL) return;
-
- IconControl(dobj,
- ICONCTRLA_GetImageDataFormat,&format,
- ICONCTRLA_GetImageData1,&icondata1,
- ICONCTRLA_GetImageData2,&icondata2,
- ICONCTRLA_GetWidth,&width,
- ICONCTRLA_GetHeight,&height,
- TAG_DONE);
-
- /* If we have a palette-mapped icon, convert it to a 32-bit one */
- if(format == IDFMT_PALETTEMAPPED)
- {
- IconControl(dobj, ICONCTRLA_GetTransparentColor1, &trans1,
- ICONCTRLA_GetPalette1, &pal1,
- ICONCTRLA_GetPaletteSize1, &pals1,
- ICONCTRLA_GetTransparentColor2, &trans2,
- ICONCTRLA_GetPalette2, &pal2,
- ICONCTRLA_GetPaletteSize2, &pals2,
- TAG_DONE);
-
- icondata1 = amiga_icon_convertcolouricon32((UBYTE *)icondata1,
- width, height, trans1, pals1, pal1, 0xff);
-
- icondata2 = amiga_icon_convertcolouricon32((UBYTE *)icondata2,
- width, height, trans2, pals2, pal2, 0xff);
-
- IconControl(dobj,
- ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
- ICONCTRLA_SetImageData1, icondata1,
- ICONCTRLA_SetImageData2, icondata2,
- TAG_DONE);
- }
-
- if((format == IDFMT_DIRECTMAPPED) || (format == IDFMT_PALETTEMAPPED))
- amiga_icon_superimpose_favicon_internal(icon, dobj);
-
- PutIconTags(path, dobj,
- ICONPUTA_NotifyWorkbench, TRUE, TAG_DONE);
-
- FreeDiskObject(dobj);
-
- if(format == IDFMT_PALETTEMAPPED)
- {
- /* Free the 32-bit data we created */
- FreeVec(icondata1);
- FreeVec(icondata2);
- }
-}
-
-struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
-{
- struct DiskObject *dobj;
- struct BitMap *bitmap;
- ULONG *icondata;
-
-#ifdef __amigaos4__
- if(bm)
- {
- bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
- THUMBNAIL_HEIGHT, NULL);
- icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
- ami_bitmap_set_icondata(bm, icondata);
-
- BltBitMapTags(BLITA_Width, THUMBNAIL_WIDTH,
- BLITA_Height, THUMBNAIL_HEIGHT,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, bitmap,
- BLITA_DestType, BLITT_ARGB32,
- BLITA_DestBytesPerRow, THUMBNAIL_WIDTH * 4,
- BLITA_Dest, icondata,
- TAG_DONE);
- }
-#endif
- dobj = GetIconTags(NULL, ICONGETA_GetDefaultType, WBPROJECT,
- ICONGETA_GetDefaultName, "iconify",
- TAG_DONE);
-#ifdef __amigaos4__
- if(bm)
- {
- IconControl(dobj,
- ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
- ICONCTRLA_SetWidth, THUMBNAIL_WIDTH,
- ICONCTRLA_SetHeight, THUMBNAIL_HEIGHT,
- ICONCTRLA_SetImageData1, icondata,
- ICONCTRLA_SetImageData2, NULL,
- TAG_DONE);
- }
-#endif
- dobj->do_Gadget.UserData = bm;
-
- LayoutIconA(dobj, (struct Screen *)~0UL, NULL);
-
- return dobj;
-}
-
-void amiga_icon_free(struct DiskObject *dobj)
-{
- struct bitmap *bm = dobj->do_Gadget.UserData;
-
- FreeDiskObject(dobj);
- if(bm) FreeVec(ami_bitmap_get_icondata(bm));
-}
-
diff --git a/amiga/icon.h b/amiga/icon.h
deleted file mode 100644
index e0ea5b734..000000000
--- a/amiga/icon.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Content for image/x-amiga-icon (icon.library interface).
- */
-
-#ifndef AMIGA_ICON_H
-#define AMIGA_ICON_H
-
-#include "utils/config.h"
-#include "utils/errors.h"
-
-#ifdef WITH_AMIGA_ICON
-
-nserror amiga_icon_init(void);
-void amiga_icon_fini(void);
-
-#else
-
-#define amiga_icon_init() NSERROR_OK
-#define amiga_icon_fini() ((void) 0)
-
-#endif /* WITH_AMIGA_ICON */
-
-struct hlcache_handle;
-
-void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type);
-void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct DiskObject *dobj);
-struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm);
-void amiga_icon_free(struct DiskObject *dobj);
-#endif
diff --git a/amiga/iff_cset.h b/amiga/iff_cset.h
deleted file mode 100755
index 2b8af8f6e..000000000
--- a/amiga/iff_cset.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_IFF_CSET_H
-#define AMIGA_IFF_CSET_H
-#include <exec/types.h>
-
-/* This structure is for the IFF CSET chunk, registered by Martin Taillefer */
-
-struct CSet {
- LONG CodeSet; /* 0=ECMA Latin 1 (std Amiga charset) */
- /* CBM will define additional values */
- LONG Reserved[7];
- };
-
-#define ID_CSET MAKE_ID('C','S','E','T')
-
-#endif
diff --git a/amiga/iff_dr2d.c b/amiga/iff_dr2d.c
deleted file mode 100644
index a4d17386b..000000000
--- a/amiga/iff_dr2d.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef WITH_NS_SVG
-
-#include <stdio.h>
-#include <inttypes.h>
-#include <svgtiny.h>
-#include <proto/exec.h>
-#include <string.h>
-#include <proto/dos.h>
-
-#ifndef AMIGA_DR2D_STANDALONE
-#include "amiga/os3support.h"
-#include "amiga/iff_dr2d.h"
-#include "amiga/misc.h"
-#include "content/hlcache.h"
-#else
-#include "os3support.h"
-#include "iff_dr2d.h"
-#include "misc.h"
-#endif
-
-struct ColorRegister cm[1000];
-ULONG numcols;
-
-static ULONG findcolour(ULONG newcol)
-{
- ULONG i;
- ULONG colr = 0xFFFFFFFF;
- UBYTE red,grn,blu;
-
- red = svgtiny_RED(newcol);
- grn = svgtiny_GREEN(newcol);
- blu = svgtiny_BLUE(newcol);
-
- for(i=0;i<numcols;i++)
- {
- if((cm[i].red == red) && (cm[i].green == grn) && (cm[i].blue == blu))
- colr = i;
- }
-
- return colr;
-}
-
-static void addcolour(ULONG newcol)
-{
- ULONG colr = findcolour(newcol);
-
- if(colr == 0xFFFFFFFF)
- {
- cm[numcols].red = svgtiny_RED(newcol);
- cm[numcols].green = svgtiny_GREEN(newcol);
- cm[numcols].blue = svgtiny_BLUE(newcol);
-
- numcols++;
- }
-}
-
-bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
- uint32_t size, const char *url)
-{
- struct svgtiny_diagram *diagram;
- svgtiny_code code;
- unsigned int i;
- unsigned int j;
- BOOL fons_written = FALSE;
- struct fons_struct *fons;
- struct stxt_struct *stxt;
- struct attr_struct *attr;
-
- /* create svgtiny object */
- diagram = svgtiny_create();
- if (!diagram) {
- fprintf(stderr, "svgtiny_create failed\n");
- return 1;
- }
-
- /* parse */
- code = svgtiny_parse(diagram, buffer, size, url, 1000, 1000);
- if (code != svgtiny_OK) {
- fprintf(stderr, "svgtiny_parse failed: ");
- switch (code) {
- case svgtiny_OUT_OF_MEMORY:
- fprintf(stderr, "svgtiny_OUT_OF_MEMORY");
- break;
- case svgtiny_LIBDOM_ERROR:
- fprintf(stderr, "svgtiny_LIBDOM_ERROR");
- break;
- case svgtiny_NOT_SVG:
- fprintf(stderr, "svgtiny_NOT_SVG");
- break;
- case svgtiny_SVG_ERROR:
- fprintf(stderr, "svgtiny_SVG_ERROR: line %i: %s",
- diagram->error_line,
- diagram->error_message);
- break;
- default:
- fprintf(stderr, "unknown svgtiny_code %i", code);
- break;
- }
- fprintf(stderr, "\n");
- }
-
- if(!(PushChunk(iffh,ID_DR2D,ID_FORM,IFFSIZE_UNKNOWN)))
- {
- if(!(PushChunk(iffh,0,ID_NAME,IFFSIZE_UNKNOWN)))
- {
- WriteChunkBytes(iffh,url,strlen(url));
- PopChunk(iffh);
- }
-
- if(!(PushChunk(iffh,0,ID_ANNO,19)))
- {
- WriteChunkBytes(iffh,"Created by NetSurf\0",19);
- PopChunk(iffh);
- }
-
- if(!(PushChunk(iffh,0,ID_DRHD,16)))
- {
- struct drhd_struct drhd;
- drhd.XLeft = (float) 0.0;
- drhd.YTop = (float) 0.0;
- drhd.XRight = (float) diagram->width;
- drhd.YBot = (float) diagram->height;
-
- WriteChunkBytes(iffh,&drhd,16);
- PopChunk(iffh);
- }
-
- if(!(PushChunk(iffh,0,ID_DASH,IFFSIZE_UNKNOWN)))
- {
- struct dash_struct dash;
- dash.DashID = 1;
- dash.NumDashes = 0;
-
- WriteChunkBytes(iffh,&dash,sizeof(struct dash_struct));
- PopChunk(iffh);
- }
-
- if(!(PushChunk(iffh,0,ID_CMAP,IFFSIZE_UNKNOWN)))
- {
- for (i = 0; i != diagram->shape_count; i++) {
- if(diagram->shape[i].fill != svgtiny_TRANSPARENT)
- {
- addcolour(diagram->shape[i].fill);
- }
-
- if(diagram->shape[i].stroke != svgtiny_TRANSPARENT)
- {
- addcolour(diagram->shape[i].stroke);
- }
- }
-
- WriteChunkBytes(iffh,cm,3*numcols);
- PopChunk(iffh);
- }
-
- for (i = 0; i != diagram->shape_count; i++) {
- attr = ami_misc_allocvec_clear(sizeof(struct attr_struct), 0);
- if (diagram->shape[i].fill == svgtiny_TRANSPARENT)
- attr->FillType = FT_NONE;
- else
- {
- attr->FillType = FT_COLOR;
- attr->FillValue = findcolour(diagram->shape[i].fill);
- }
- if (diagram->shape[i].stroke == svgtiny_TRANSPARENT)
- attr->DashPattern = 0;
- else
- {
- attr->DashPattern = 1;
- attr->EdgeValue = findcolour(diagram->shape[i].stroke);
- }
- attr->EdgeThick = (float) diagram->shape[i].stroke_width;
-
- if(!(PushChunk(iffh,0,ID_ATTR,IFFSIZE_UNKNOWN)))
- {
- WriteChunkBytes(iffh,attr,14);
- PopChunk(iffh);
- }
- FreeVec(attr);
-
- if (diagram->shape[i].path) {
- union {
- float PolyPoints;
- ULONG val;
- } poly[(diagram->shape[i].path_length)*2];
-
- USHORT NumPoints;
- long type;
- float curx,cury;
-
- curx = 0.0;
- cury = 0.0;
- NumPoints = 0;
- type = ID_OPLY;
-
- for (j = 0;
- j != diagram->shape[i].path_length; ) {
- switch ((int) diagram->shape[i].path[j]) {
- case svgtiny_PATH_MOVE:
- if(j != 0)
- {
- poly[NumPoints*2].val = INDICATOR;
- poly[(NumPoints*2)+1].val = IND_MOVETO;
- NumPoints++;
- }
- poly[(NumPoints*2)].PolyPoints = diagram->shape[i].path[j + 1];
- poly[(NumPoints*2)+1].PolyPoints = diagram->shape[i].path[j + 2];
- NumPoints++;
- curx = (float) diagram->shape[i].path[j + 1];
- cury = (float) diagram->shape[i].path[j + 2];
-
- j += 3;
- break;
- case svgtiny_PATH_CLOSE:
- type = ID_CPLY;
- j += 1;
- break;
- case svgtiny_PATH_LINE:
- poly[(NumPoints*2)].PolyPoints = (float) diagram->shape[i].path[j + 1];
- poly[(NumPoints*2)+1].PolyPoints = (float) diagram->shape[i].path[j + 2];
- NumPoints++;
- curx = (float) diagram->shape[i].path[j + 1];
- cury = (float) diagram->shape[i].path[j + 2];
- j += 3;
- break;
- case svgtiny_PATH_BEZIER:
- poly[NumPoints*2].val = INDICATOR;
- poly[(NumPoints*2)+1].val = IND_CURVE;
- NumPoints++;
- poly[(NumPoints*2)].PolyPoints = curx;
- poly[(NumPoints*2)+1].PolyPoints = cury;
- NumPoints++;
- poly[(NumPoints*2)].PolyPoints = (float) diagram->shape[i].path[j + 1];
- poly[(NumPoints*2)+1].PolyPoints = (float) diagram->shape[i].path[j + 2];
- NumPoints++;
- poly[(NumPoints*2)].PolyPoints = (float) diagram->shape[i].path[j + 3];
- poly[(NumPoints*2)+1].PolyPoints = (float) diagram->shape[i].path[j + 4];
- NumPoints++;
- poly[(NumPoints*2)].PolyPoints = (float) diagram->shape[i].path[j + 5];
- poly[(NumPoints*2)+1].PolyPoints = (float) diagram->shape[i].path[j + 6];
- curx = poly[(NumPoints*2)].PolyPoints;
- cury = poly[(NumPoints*2)+1].PolyPoints;
- NumPoints++;
- j += 7;
- break;
- default:
- printf("error\n");
- j += 1;
- }
- }
- if(!(PushChunk(iffh,0,type,IFFSIZE_UNKNOWN)))
- {
- WriteChunkBytes(iffh,&NumPoints,sizeof(USHORT));
- WriteChunkBytes(iffh,poly,NumPoints*2*4);
- PopChunk(iffh);
- }
- } else if (diagram->shape[i].text) {
- stxt = ami_misc_allocvec_clear(sizeof(struct stxt_struct), 0);
- stxt->BaseX = diagram->shape[i].text_x;
- stxt->BaseY = diagram->shape[i].text_y;
- stxt->NumChars = strlen(diagram->shape[i].text);
- if(!fons_written)
- {
- fons = ami_misc_allocvec_clear(sizeof(struct fons_struct), 0);
- if(!(PushChunk(iffh,0,ID_FONS,IFFSIZE_UNKNOWN)))
- {
- WriteChunkBytes(iffh, fons, sizeof(struct fons_struct));
- WriteChunkBytes(iffh, "Topaz\0", 6);
- PopChunk(iffh);
- }
- FreeVec(fons);
- fons_written = TRUE;
- }
-
- if(!(PushChunk(iffh,0,ID_STXT,IFFSIZE_UNKNOWN)))
- {
- WriteChunkBytes(iffh,stxt,26);
- WriteChunkBytes(iffh,diagram->shape[i].text,strlen(diagram->shape[i].text));
- PopChunk(iffh);
- }
- FreeVec(stxt);
- }
- }
-
- PopChunk(iffh);
- }
-
- svgtiny_free(diagram);
-
- return 0;
-}
-
-#ifndef AMIGA_DR2D_STANDALONE
-bool ami_save_svg(struct hlcache_handle *c,char *filename)
-{
- struct IFFHandle *iffh;
- const char *source_data;
- ULONG source_size;
-
- if(!ami_download_check_overwrite(filename, NULL, 0)) return false;
-
- if((iffh = AllocIFF())) {
- if((iffh->iff_Stream = Open(filename,MODE_NEWFILE))) {
- InitIFFasDOS(iffh);
- }
- else return false;
- }
-
- if((OpenIFF(iffh,IFFF_WRITE))) return false;
-
- if((source_data = content_get_source_data(c, &source_size)))
- ami_svg_to_dr2d(iffh, source_data, source_size, nsurl_access(hlcache_handle_get_url(c)));
-
- if(iffh) CloseIFF(iffh);
- if(iffh->iff_Stream) Close((BPTR)iffh->iff_Stream);
- if(iffh) FreeIFF(iffh);
-
- return true;
-}
-#else
-/*
- * This code can be compiled as a standalone program for testing etc.
- * Use something like the following line:
- * gcc -o svg2dr2d iff_dr2d.c -lauto -lsvgtiny -lpthread -lsvgtiny
- * -ldom -lwapcaplet -lexpat -lparserutils
- * -DWITH_NS_SVG -DAMIGA_DR2D_STANDALONE -D__USE_INLINE__ -D__NOLIBBASE__
- */
-
-const char __attribute__((used)) ver[] = "\0$VER: svg2dr2d 1.2 (05.01.2015)\0";
-
-int main(int argc, char **argv)
-{
- BPTR fh = 0;
- char *buffer;
- struct IFFHandle *iffh = NULL;
- int64_t size;
- LONG rarray[] = {0,0};
- struct RDArgs *args;
- STRPTR template = "SVG=INPUT/A,DR2D=OUTPUT/A";
- enum
- {
- A_SVG,
- A_DR2D
- };
-
-#ifndef __amigaos4__
- DOSBase = OpenLibrary("dos.library", 37);
- if(!DOSBase) return RETURN_FAIL;
-
- IFFParseBase = OpenLibrary("iffparse.library", 37);
- if(!IFFParseBase) return RETURN_FAIL;
-#endif
-
- args = ReadArgs(template,rarray,NULL);
-
- if(!args)
- {
- printf("Required argument missing\n");
- return 20;
- }
-
- if(fh = Open((char *)rarray[A_SVG],MODE_OLDFILE))
- {
- size = GetFileSize(fh);
-
- buffer = AllocVecTagList((uint32_t)size, NULL);
-
- Read(fh,buffer,(uint32_t)size);
- Close(fh);
- }
- else
- {
- printf("Unable to open file\n");
- return 20;
- }
-
- if(iffh = AllocIFF())
- {
- if(iffh->iff_Stream = Open((char *)rarray[A_DR2D],MODE_NEWFILE))
- {
- InitIFFasDOS(iffh);
- }
- else return 20;
- }
-
- if((OpenIFF(iffh,IFFF_WRITE))) return 20;
-
- ami_svg_to_dr2d(iffh,buffer,size,(char *)rarray[A_SVG]);
-
- FreeVec(buffer);
- if(iffh) CloseIFF(iffh);
- if(iffh->iff_Stream) Close((BPTR)iffh->iff_Stream);
- if(iffh) FreeIFF(iffh);
- FreeArgs(args);
-
-#ifndef __amigaos4__
- if(DOSBase) CloseLibrary(DOSBase);
- if(IFFParseBase) CloseLibrary(IFFParseBase);
-#endif
-}
-
-#endif // AMIGA_DR2D_STANDALONE
-#endif // WITH_NS_SVG
-
diff --git a/amiga/iff_dr2d.h b/amiga/iff_dr2d.h
deleted file mode 100644
index c9981d33a..000000000
--- a/amiga/iff_dr2d.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef WITH_NS_SVG
-#ifndef AMIGA_IFF_DR2D_H
-#define AMIGA_IFF_DR2D_H
-#include <proto/iffparse.h>
-#include <datatypes/pictureclass.h>
-#include <stdbool.h>
-#ifndef AMIGA_DR2D_STANDALONE
-#include "content/content.h"
-#include "amiga/download.h"
-#endif
-
-#define ID_DR2D MAKE_ID('D','R','2','D')
-#define ID_DRHD MAKE_ID('D','R','H','D')
-#define ID_ATTR MAKE_ID('A','T','T','R')
-#define ID_CPLY MAKE_ID('C','P','L','Y')
-#define ID_OPLY MAKE_ID('O','P','L','Y')
-#define ID_STXT MAKE_ID('S','T','X','T')
-#define ID_DASH MAKE_ID('D','A','S','H')
-//#define ID_CMAP MAKE_ID('C','M','A','P') in dt/pictureclass
-//#define ID_NAME MAKE_ID('N','A','M','E') in dt/datatypes
-#define ID_ANNO MAKE_ID('A','N','N','O')
-#define ID_FONS MAKE_ID('F','O','N','S')
-
-struct drhd_struct {
- float XLeft, YTop, XRight, YBot;
-};
-
-struct poly_struct {
- USHORT NumPoints;
-// float PolyPoints[]; // 2*numpoints
-};
-
-#define INDICATOR 0xFFFFFFFF
-#define IND_SPLINE 0x00000001
-#define IND_MOVETO 0x00000002
-#define IND_CURVE 0x00000001
-
-struct fons_struct {
- UBYTE FontID; /* ID the font is referenced by */
- UBYTE Pad1; /* Always 0 */
- UBYTE Proportional; /* Is it proportional? */
- UBYTE Serif; /* does it have serifs? */
-};
-
-struct stxt_struct {
- UBYTE Pad0; /* Always 0 (for future expansion) */
- UBYTE WhichFont; /* Which font to use */
- float CharW, CharH, /* W/H of an individual char */
- BaseX, BaseY, /* Start of baseline */
- Rotation; /* Angle of text (in degrees) */
- uint16_t NumChars;
- //char TextChars[NumChars];
-};
-
-/* Various fill types */
-#define FT_NONE 0 /* No fill */
-#define FT_COLOR 1 /* Fill with color from palette */
-#define FT_OBJECTS 2 /* Fill with tiled objects */
-
-struct attr_struct {
- UBYTE FillType; /* One of FT_*, above */
- UBYTE JoinType; /* One of JT_*, below */
- UBYTE DashPattern; /* ID of edge dash pattern */
- UBYTE ArrowHead; /* ID of arrowhead to use */
- USHORT FillValue; /* Color or object with which to fill */
- USHORT EdgeValue; /* Edge color index */
- USHORT WhichLayer; /* ID of layer it's in */
- float EdgeThick; /* Line width */
-};
-
-/* Join types */
-#define JT_NONE 0 /* Don't do line joins */
-#define JT_MITER 1 /* Mitered join */
-#define JT_BEVEL 2 /* Beveled join */
-#define JT_ROUND 3 /* Round join */
-
-struct dash_struct {
- USHORT DashID; /* ID of the dash pattern */
- USHORT NumDashes; /* Should always be even */
-// IEEE Dashes[NumDashes]; /* On-off pattern */
-};
-
-bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
- uint32_t size, const char *url);
-#ifndef AMIGA_DR2D_STANDALONE
-bool ami_save_svg(struct hlcache_handle *c, char *filename);
-#endif
-#endif // AMIGA_IFF_DR2D_H
-#endif // WITH_NS_SVG
diff --git a/amiga/launch.c b/amiga/launch.c
deleted file mode 100755
index 1f2b9e16c..000000000
--- a/amiga/launch.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright 2008-10 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Fetching of data from a file (implementation).
- */
-
-#include "amiga/os3support.h"
-
-#include <string.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <proto/exec.h>
-#include <proto/dos.h>
-#include <proto/utility.h>
-#include <proto/openurl.h>
-
-#include "amiga/launch.h"
-#include "amiga/object.h" /* for list abstraction */
-#include "utils/nsoption.h"
-#include "utils/nsurl.h"
-
-struct Library *OpenURLBase = NULL;
-struct OpenURLIFace *IOpenURL = NULL;
-
-struct MinList *ami_unsupportedprotocols;
-
-struct ami_protocol
-{
- struct MinNode node;
- lwc_string *protocol;
-};
-
-static struct ami_protocol *ami_openurl_add_protocol(const char *url)
-{
- nsurl *ns_url;
- struct ami_protocol *ami_p =
- (struct ami_protocol *)AllocVecTagList(sizeof(struct ami_protocol), NULL);
-
- if (nsurl_create(url, &ns_url) != NSERROR_OK) {
- FreeVec(ami_p);
- return NULL;
- }
-
- ami_p->protocol = nsurl_get_component(ns_url, NSURL_SCHEME);
- nsurl_unref(ns_url);
- if (ami_p->protocol == NULL)
- {
- FreeVec(ami_p);
- return NULL;
- }
-
- AddTail((struct List *)ami_unsupportedprotocols, (struct Node *)ami_p);
- return ami_p;
-}
-
-static void ami_openurl_free_list(struct MinList *list)
-{
- struct ami_protocol *node;
- struct ami_protocol *nnode;
-
- if(IsMinListEmpty(list)) return;
- node = (struct ami_protocol *)GetHead((struct List *)list);
-
- do
- {
- nnode=(struct ami_protocol *)GetSucc((struct Node *)node);
-
- Remove((struct Node *)node);
- if (node->protocol) lwc_string_unref(node->protocol);
- FreeVec(node);
- node = NULL;
- }while((node=nnode));
-
- FreeVec(list);
-}
-
-static BOOL ami_openurl_check_list(struct MinList *list, nsurl *url)
-{
- struct ami_protocol *node;
- struct ami_protocol *nnode;
- lwc_string *url_scheme;
- bool match;
-
- if(IsMinListEmpty(list)) return FALSE;
-
- url_scheme = nsurl_get_component(url, NSURL_SCHEME);
-
- node = (struct ami_protocol *)GetHead((struct List *)list);
-
- do
- {
- nnode=(struct ami_protocol *)GetSucc((struct Node *)node);
-
- if ((lwc_string_isequal(url_scheme, node->protocol,
- &match) == lwc_error_ok) && (match == true)) {
- lwc_string_unref(url_scheme);
- return TRUE;
- }
- }while((node=nnode));
-
- lwc_string_unref(url_scheme);
- return FALSE;
-}
-
-/**
- * Initialise the fetcher.
- *
- * Must be called once before any other function.
- */
-
-void ami_openurl_open(void)
-{
- if(nsoption_bool(use_openurl_lib)) {
- if((OpenURLBase = OpenLibrary("openurl.library",0))) {
-#ifdef __amigaos4__
- IOpenURL = (struct OpenURLIFace *)GetInterface(OpenURLBase,"main",1,NULL);
-#endif
- }
- }
-
- ami_unsupportedprotocols = ami_AllocMinList();
-}
-
-void ami_openurl_close(void)
-{
-#ifdef __amigaos4__
- if(IOpenURL) DropInterface((struct Interface *)IOpenURL);
-#endif
- if(OpenURLBase) CloseLibrary(OpenURLBase);
-
- ami_openurl_free_list(ami_unsupportedprotocols);
-}
-
-nserror gui_launch_url(struct nsurl *url)
-{
-#ifdef __amigaos4__
- APTR procwin = SetProcWindow((APTR)-1L);
-#endif
- char *launchurl = NULL;
-
- if(ami_openurl_check_list(ami_unsupportedprotocols, url) == FALSE)
- {
- if(IOpenURL)
- {
- URL_OpenA((STRPTR)url,NULL);
- } else {
- if((launchurl = ASPrintf("URL:%s", nsurl_access(url)))) {
- BPTR fptr = Open(launchurl,MODE_OLDFILE);
- if(fptr)
- {
- Close(fptr);
- } else {
- ami_openurl_add_protocol(nsurl_access(url));
- }
- FreeVec(launchurl);
- }
- }
- }
-#ifdef __amigaos4__
- SetProcWindow(procwin);
-#endif
- return NSERROR_OK;
-}
diff --git a/amiga/launch.h b/amiga/launch.h
deleted file mode 100755
index e2b355065..000000000
--- a/amiga/launch.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2008-9 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Fetching of data from a URL (Registration).
- */
-
-#ifndef AMIGA_LAUNCH_H
-#define AMIGA_LAUNCH_H
-#include "utils/errors.h"
-struct nsurl;
-
-void ami_openurl_open(void);
-void ami_openurl_close(void);
-
-nserror gui_launch_url(struct nsurl *url);
-
-#endif
diff --git a/amiga/libs.c b/amiga/libs.c
deleted file mode 100644
index 993cd3ad0..000000000
--- a/amiga/libs.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "utils/utils.h"
-#include "utils/log.h"
-
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-
-#include <graphics/gfxbase.h> /* Needed for v54 version check */
-
-#ifndef __amigaos4__
-/* OS3 needs these for the XXXX_GetClass() functions */
-#include <proto/arexx.h>
-#include <proto/bevel.h>
-#include <proto/bitmap.h>
-#include <proto/button.h>
-#include <proto/chooser.h>
-#include <proto/checkbox.h>
-#include <proto/clicktab.h>
-#include <proto/fuelgauge.h>
-#include <proto/getfile.h>
-#include <proto/getfont.h>
-#include <proto/getscreenmode.h>
-#include <proto/integer.h>
-#include <proto/label.h>
-#include <proto/layout.h>
-#include <proto/listbrowser.h>
-#include <proto/radiobutton.h>
-#include <proto/scroller.h>
-#include <proto/space.h>
-#include <proto/speedbar.h>
-#include <proto/string.h>
-#include <proto/window.h>
-#endif
-
-#ifdef __amigaos4__
-#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
- LOG("Opening %s v%d", LIB, LIBVER); \
- if((PREFIX##Base = (struct PREFIX##Base *)OpenLibrary(LIB, LIBVER))) { \
- I##PREFIX = (struct PREFIX##IFace *)GetInterface((struct Library *)PREFIX##Base, INTERFACE, INTVER, NULL); \
- if(I##PREFIX == NULL) { \
- LOG("Failed to get %s interface v%d of %s", INTERFACE, INTVER, LIB); \
- } \
- } else { \
- LOG("Failed to open %s v%d", LIB, LIBVER); \
- if(FAIL == true) { \
- STRPTR error = ASPrintf("Unable to open %s v%ld (fatal error)", LIB, LIBVER); \
- ami_misc_fatal_error(error); \
- FreeVec(error); \
- return false; \
- } \
- }
-
-#define AMINS_LIB_CLOSE(PREFIX) \
- if(I##PREFIX) DropInterface((struct Interface *)I##PREFIX); \
- if(PREFIX##Base) CloseLibrary((struct Library *)PREFIX##Base);
-
-#define AMINS_LIB_STRUCT(PREFIX) \
- struct PREFIX##Base *PREFIX##Base = NULL; \
- struct PREFIX##IFace *I##PREFIX = NULL;
-
-#define AMINS_CLASS_OPEN(CLASS, CLASSVER, PREFIX, CLASSGET, NEEDINTERFACE) \
- LOG("Opening %s v%d", CLASS, CLASSVER); \
- if((PREFIX##Base = OpenClass(CLASS, CLASSVER, &PREFIX##Class))) { \
- if(NEEDINTERFACE == true) { \
- LOG(" + interface"); \
- I##PREFIX = (struct PREFIX##IFace *)GetInterface((struct Library *)PREFIX##Base, "main", 1, NULL); \
- if(I##PREFIX == NULL) { \
- LOG("Failed to get main interface v1 of %s", CLASS); \
- } \
- } \
- } \
- if(PREFIX##Class == NULL) { \
- STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", CLASS, CLASSVER); \
- ami_misc_fatal_error(error); \
- FreeVec(error); \
- return false; \
- }
-
-#define AMINS_CLASS_CLOSE(PREFIX) \
- if(I##PREFIX) DropInterface((struct Interface *)I##PREFIX); \
- if(PREFIX##Base) CloseClass(PREFIX##Base);
-
-#define AMINS_CLASS_STRUCT(PREFIX) \
- struct ClassLibrary *PREFIX##Base = NULL; \
- struct PREFIX##IFace *I##PREFIX = NULL; \
- Class *PREFIX##Class = NULL;
-
-#else
-#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
- LOG("Opening %s v%d", LIB, LIBVER); \
- if((PREFIX##Base = (struct PREFIX##Base *)OpenLibrary(LIB, LIBVER))) { \
- } else { \
- LOG("Failed to open %s v%d", LIB, LIBVER); \
- if(FAIL == true) { \
- STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", LIB, LIBVER); \
- ami_misc_fatal_error(error); \
- FreeVec(error); \
- return false; \
- } \
- }
-
-#define AMINS_LIB_CLOSE(PREFIX) \
- if(PREFIX##Base) CloseLibrary((struct Library *)PREFIX##Base);
-
-#define AMINS_LIB_STRUCT(PREFIX) \
- struct PREFIX##Base *PREFIX##Base = NULL;
-
-#define AMINS_CLASS_OPEN(CLASS, CLASSVER, PREFIX, CLASSGET, NEEDINTERFACE) \
- LOG("Opening %s v%d", CLASS, CLASSVER); \
- if((PREFIX##Base = OpenLibrary(CLASS, CLASSVER))) { \
- PREFIX##Class = CLASSGET##_GetClass(); \
- } \
- if(PREFIX##Class == NULL) { \
- STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", CLASS, CLASSVER); \
- ami_misc_fatal_error(error); \
- FreeVec(error); \
- return false; \
- }
-
-#define AMINS_CLASS_CLOSE(PREFIX) \
- if(PREFIX##Base) CloseLibrary(PREFIX##Base);
-
-#define AMINS_CLASS_STRUCT(PREFIX) \
- struct Library *PREFIX##Base = NULL; \
- Class *PREFIX##Class = NULL;
-
-#endif
-
-#define GraphicsBase GfxBase /* graphics.library is a bit weird */
-
-#ifdef __amigaos4__
-AMINS_LIB_STRUCT(Application);
-#else
-AMINS_LIB_STRUCT(Utility)
-#endif
-AMINS_LIB_STRUCT(Asl);
-AMINS_LIB_STRUCT(DataTypes);
-AMINS_LIB_STRUCT(Diskfont);
-AMINS_LIB_STRUCT(Graphics);
-AMINS_LIB_STRUCT(GadTools);
-AMINS_LIB_STRUCT(Icon);
-AMINS_LIB_STRUCT(IFFParse);
-AMINS_LIB_STRUCT(Intuition);
-AMINS_LIB_STRUCT(Keymap);
-AMINS_LIB_STRUCT(Layers);
-AMINS_LIB_STRUCT(Locale);
-AMINS_LIB_STRUCT(P96);
-AMINS_LIB_STRUCT(Workbench);
-
-AMINS_LIB_STRUCT(GuiGFX);
-
-AMINS_CLASS_STRUCT(ARexx);
-AMINS_CLASS_STRUCT(Bevel);
-AMINS_CLASS_STRUCT(BitMap);
-AMINS_CLASS_STRUCT(Button);
-AMINS_CLASS_STRUCT(Chooser);
-AMINS_CLASS_STRUCT(CheckBox);
-AMINS_CLASS_STRUCT(ClickTab);
-AMINS_CLASS_STRUCT(FuelGauge);
-AMINS_CLASS_STRUCT(GetFile);
-AMINS_CLASS_STRUCT(GetFont);
-AMINS_CLASS_STRUCT(GetScreenMode);
-AMINS_CLASS_STRUCT(Integer);
-AMINS_CLASS_STRUCT(Label);
-AMINS_CLASS_STRUCT(Layout);
-AMINS_CLASS_STRUCT(ListBrowser);
-AMINS_CLASS_STRUCT(RadioButton);
-#ifndef __amigaos4__
-AMINS_CLASS_STRUCT(Page);
-#endif
-AMINS_CLASS_STRUCT(Scroller);
-AMINS_CLASS_STRUCT(Space);
-AMINS_CLASS_STRUCT(SpeedBar);
-AMINS_CLASS_STRUCT(String);
-AMINS_CLASS_STRUCT(Window);
-
-
-bool ami_libs_open(void)
-{
-#ifdef __amigaos4__
- /* Libraries only needed on OS4 */
- AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false)
-#else
- /* Libraries we get automatically on OS4 but not OS3 */
- AMINS_LIB_OPEN("utility.library", 37, Utility, "main", 1, true)
-#endif
- /* Standard libraries for both versions */
- AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true)
- AMINS_LIB_OPEN("datatypes.library", 39, DataTypes, "main", 1, true)
- AMINS_LIB_OPEN("diskfont.library", 40, Diskfont, "main", 1, true)
- AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1, true)
- AMINS_LIB_OPEN("graphics.library", 40, Graphics, "main", 1, true)
- AMINS_LIB_OPEN("icon.library", 44, Icon, "main", 1, true)
- AMINS_LIB_OPEN("iffparse.library", 37, IFFParse, "main", 1, true)
- AMINS_LIB_OPEN("intuition.library", 40, Intuition, "main", 1, true)
- AMINS_LIB_OPEN("keymap.library", 37, Keymap, "main", 1, true)
- AMINS_LIB_OPEN("layers.library", 37, Layers, "main", 1, true)
- AMINS_LIB_OPEN("locale.library", 38, Locale, "main", 1, true)
- AMINS_LIB_OPEN("workbench.library", 37, Workbench, "main", 1, true)
-
- /* This is down here as we need to check the graphics.library version
- * before opening. If it is sufficiently new enough we can avoid using P96.
- */
- if(GfxBase->LibNode.lib_Version < 54)
- AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, false)
-
- /* Non-OS provided libraries */
- AMINS_LIB_OPEN("guigfx.library", 9, GuiGFX, "main", 1, true)
-
- /* NB: timer.device is opened in schedule.c (ultimately by the scheduler process).
- * The library base and interface are obtained there, rather than here, due to
- * the additional complexities of opening devices, which aren't important here
- * (as we only need the library interface), but are important for the scheduler
- * (as it also uses the device interface). We trust that the scheduler has
- * initialised before any other code requires the timer's library interface,
- * to avoid opening it twice.
- */
-
- /* BOOPSI classes.
- * Opened using class functions rather than the old-fashioned method.
- * We get the class pointer once and used our stored copy.
- * On OS4 these must be opened *after* intuition.library.
- * NB: the last argument should be "true" only if the class also has
- * library functions we use.
- */
- AMINS_CLASS_OPEN("arexx.class", 44, ARexx, AREXX, false)
- AMINS_CLASS_OPEN("images/bevel.image", 44, Bevel, BEVEL, false)
- AMINS_CLASS_OPEN("images/bitmap.image", 44, BitMap, BITMAP, false)
- AMINS_CLASS_OPEN("gadgets/button.gadget", 44, Button, BUTTON, false)
- AMINS_CLASS_OPEN("gadgets/checkbox.gadget", 44, CheckBox, CHECKBOX, false)
- AMINS_CLASS_OPEN("gadgets/chooser.gadget", 44, Chooser, CHOOSER, true)
- AMINS_CLASS_OPEN("gadgets/clicktab.gadget", 44, ClickTab, CLICKTAB, true)
- AMINS_CLASS_OPEN("gadgets/fuelgauge.gadget", 44, FuelGauge, FUELGAUGE, false)
- AMINS_CLASS_OPEN("gadgets/getfile.gadget", 44, GetFile, GETFILE, false)
- AMINS_CLASS_OPEN("gadgets/getfont.gadget", 44, GetFont, GETFONT, false)
- AMINS_CLASS_OPEN("gadgets/getscreenmode.gadget", 44, GetScreenMode, GETSCREENMODE, false)
- AMINS_CLASS_OPEN("gadgets/integer.gadget", 44, Integer, INTEGER, false)
- AMINS_CLASS_OPEN("images/label.image", 44, Label, LABEL, false)
- AMINS_CLASS_OPEN("gadgets/layout.gadget", 44, Layout, LAYOUT, true)
- AMINS_CLASS_OPEN("gadgets/listbrowser.gadget", 44, ListBrowser, LISTBROWSER, true)
- AMINS_CLASS_OPEN("gadgets/radiobutton.gadget", 44, RadioButton, RADIOBUTTON, false)
- AMINS_CLASS_OPEN("gadgets/scroller.gadget", 44, Scroller, SCROLLER, false)
- AMINS_CLASS_OPEN("gadgets/space.gadget", 44, Space, SPACE, false)
- AMINS_CLASS_OPEN("gadgets/speedbar.gadget", 44, SpeedBar, SPEEDBAR, true)
- AMINS_CLASS_OPEN("gadgets/string.gadget", 44, String, STRING, false)
- AMINS_CLASS_OPEN("window.class", 44, Window, WINDOW, false)
-
-#ifndef __amigaos4__
- PageClass = PAGE_GetClass();
-#endif
-
- return true;
-}
-
-void ami_libs_close(void)
-{
- /* BOOPSI Classes.
- * On OS4 these must be closed *before* intuition.library
- */
- AMINS_CLASS_CLOSE(ARexx)
- AMINS_CLASS_CLOSE(Bevel)
- AMINS_CLASS_CLOSE(BitMap)
- AMINS_CLASS_CLOSE(Button)
- AMINS_CLASS_CLOSE(CheckBox)
- AMINS_CLASS_CLOSE(Chooser)
- AMINS_CLASS_CLOSE(ClickTab)
- AMINS_CLASS_CLOSE(FuelGauge)
- AMINS_CLASS_CLOSE(GetFile)
- AMINS_CLASS_CLOSE(GetFont)
- AMINS_CLASS_CLOSE(GetScreenMode)
- AMINS_CLASS_CLOSE(Integer)
- AMINS_CLASS_CLOSE(Label)
- AMINS_CLASS_CLOSE(Layout)
- AMINS_CLASS_CLOSE(ListBrowser)
- AMINS_CLASS_CLOSE(RadioButton)
- AMINS_CLASS_CLOSE(Scroller)
- AMINS_CLASS_CLOSE(Space)
- AMINS_CLASS_CLOSE(SpeedBar)
- AMINS_CLASS_CLOSE(String)
- AMINS_CLASS_CLOSE(Window)
-
- /* Libraries */
- AMINS_LIB_CLOSE(GuiGFX)
-
- AMINS_LIB_CLOSE(Asl)
- AMINS_LIB_CLOSE(DataTypes)
- AMINS_LIB_CLOSE(Diskfont)
- AMINS_LIB_CLOSE(GadTools)
- AMINS_LIB_CLOSE(Graphics)
- AMINS_LIB_CLOSE(Icon)
- AMINS_LIB_CLOSE(IFFParse)
- AMINS_LIB_CLOSE(Intuition)
- AMINS_LIB_CLOSE(Keymap)
- AMINS_LIB_CLOSE(Layers)
- AMINS_LIB_CLOSE(Locale)
- AMINS_LIB_CLOSE(P96)
- AMINS_LIB_CLOSE(Workbench)
-#ifdef __amigaos4__
- AMINS_LIB_CLOSE(Application)
-#else
- AMINS_LIB_CLOSE(Utility)
-#endif
-}
-
diff --git a/amiga/libs.h b/amiga/libs.h
deleted file mode 100644
index aa3622af2..000000000
--- a/amiga/libs.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_LIBS_H
-#include <stdbool.h>
-#include <intuition/classes.h>
-
-/* BOOPSI classes */
-extern Class *ARexxClass;
-extern Class *BevelClass;
-extern Class *BitMapClass;
-extern Class *ButtonClass;
-extern Class *CheckBoxClass;
-extern Class *ChooserClass;
-extern Class *ClickTabClass;
-extern Class *FuelGaugeClass;
-extern Class *GetFileClass;
-extern Class *GetFontClass;
-extern Class *GetScreenModeClass;
-extern Class *IntegerClass;
-extern Class *LabelClass;
-extern Class *LayoutClass;
-extern Class *ListBrowserClass;
-#ifndef __amigaos4__
-/* OS4 uses a public class name instead */
-extern Class *PageClass;
-#endif
-extern Class *RadioButtonClass;
-extern Class *ScrollerClass;
-extern Class *SpaceClass;
-extern Class *SpeedBarClass;
-extern Class *StringClass;
-extern Class *WindowClass;
-
-/* New improved ReAction macros! */
-#define ARexxObj NewObject(ARexxClass, NULL
-#define BevelObj NewObject(BevelClass, NULL
-#define BitMapObj NewObject(BitMapClass, NULL
-#define ButtonObj NewObject(ButtonClass, NULL
-#define CheckBoxObj NewObject(CheckBoxClass, NULL
-#define ChooserObj NewObject(ChooserClass, NULL
-#define ClickTabObj NewObject(ClickTabClass, NULL
-#define FuelGaugeObj NewObject(FuelGaugeClass, NULL
-#define GetFileObj NewObject(GetFileClass, NULL
-#define GetFontObj NewObject(GetFontClass, NULL
-#define GetScreenModeObj NewObject(GetScreenModeClass, NULL
-#define IntegerObj NewObject(IntegerClass, NULL
-#define LabelObj NewObject(LabelClass, NULL
-#define LayoutHObj NewObject(LayoutClass, NULL, LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ
-#define LayoutVObj NewObject(LayoutClass, NULL, LAYOUT_Orientation, LAYOUT_ORIENT_VERT
-#ifdef __amigaos4__
-#define PageObj NewObject(NULL, "page.gadget"
-#else
-#define PageObj NewObject(PageClass, NULL
-#endif
-#define RadioButtonObj NewObject(RadioButtonClass, NULL
-#define ScrollerObj NewObject(ScrollerClass, NULL
-#define SpaceObj NewObject(SpaceClass, NULL
-#define SpeedBarObj NewObject(SpeedBarClass, NULL
-#define StringObj NewObject(StringClass, NULL
-#define WindowObj NewObject(WindowClass, NULL
-
-/* Functions */
-bool ami_libs_open(void);
-void ami_libs_close(void);
-#endif
-
diff --git a/amiga/login.c b/amiga/login.c
deleted file mode 100755
index a4c0d62bb..000000000
--- a/amiga/login.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-
-#include <proto/window.h>
-#include <proto/layout.h>
-#include <proto/string.h>
-#include <proto/button.h>
-#include <proto/label.h>
-#include <classes/window.h>
-#include <gadgets/layout.h>
-#include <gadgets/string.h>
-#include <gadgets/button.h>
-#include <images/label.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/messages.h"
-#include "utils/errors.h"
-#include "content/urldb.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/gui.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "amiga/login.h"
-
-struct gui_login_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_LAST];
- nserror (*cb)(bool proceed, void *pw);
- void *cbpw;
- nsurl *url;
- char *realm;
- lwc_string *host;
- char uname[256];
- char pwd[256];
-};
-
-void gui_401login_open(nsurl *url, const char *realm,
- nserror (*cb)(bool proceed, void *pw), void *cbpw)
-{
- const char *auth;
- struct gui_login_window *lw = ami_misc_allocvec_clear(sizeof(struct gui_login_window), 0);
- lwc_string *host = nsurl_get_component(url, NSURL_HOST);
-
- assert(host != NULL);
-
- lw->host = host;
- lw->url = nsurl_ref(url);
- lw->realm = (char *)realm;
- lw->cb = cb;
- lw->cbpw = cbpw;
-
- auth = urldb_get_auth_details(lw->url, realm);
-
- if (auth == NULL) {
- lw->uname[0] = '\0';
- lw->pwd[0] = '\0';
- } else {
- const char *pwd;
- size_t pwd_len;
-
- pwd = strchr(auth, ':');
- assert(pwd && pwd < auth + sizeof(lw->uname));
- memcpy(lw->uname, auth, pwd - auth);
- lw->uname[pwd - auth] = '\0';
- ++pwd;
- pwd_len = strlen(pwd);
- assert(pwd_len < sizeof(lw->pwd));
- memcpy(lw->pwd, pwd, pwd_len);
- lw->pwd[pwd_len] = '\0';
- }
-
- lw->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, nsurl_access(lw->url),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, FALSE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,lw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_LockHeight,TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, lw->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, StringObj,
- STRINGA_TextVal,
- lwc_string_data(lw->host),
- GA_ReadOnly,TRUE,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text,messages_get("Host"),
- LabelEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, StringObj,
- STRINGA_TextVal,lw->realm,
- GA_ReadOnly,TRUE,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text,messages_get("Realm"),
- LabelEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, lw->objects[GID_USER] = StringObj,
- GA_ID,GID_USER,
- GA_TabCycle,TRUE,
- STRINGA_TextVal, lw->uname,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text,messages_get("Username"),
- LabelEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, lw->objects[GID_PASS] = StringObj,
- GA_ID,GID_PASS,
- STRINGA_HookType,SHK_PASSWORD,
- GA_TabCycle,TRUE,
- STRINGA_TextVal, lw->pwd,
- StringEnd,
- CHILD_Label, LabelObj,
- LABEL_Text,messages_get("Password"),
- LabelEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, lw->objects[GID_LOGIN] = ButtonObj,
- GA_ID,GID_LOGIN,
- GA_RelVerify,TRUE,
- GA_Text,messages_get("Login"),
- GA_TabCycle,TRUE,
- ButtonEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, lw->objects[GID_CANCEL] = ButtonObj,
- GA_ID,GID_CANCEL,
- GA_RelVerify,TRUE,
- GA_Text,messages_get("Cancel"),
- GA_TabCycle,TRUE,
- ButtonEnd,
- LayoutEnd,
- CHILD_WeightedHeight,0,
- EndGroup,
- EndWindow;
-
- lw->win = (struct Window *)RA_OpenWindow(lw->objects[OID_MAIN]);
-
- lw->node = AddObject(window_list,AMINS_LOGINWINDOW);
- lw->node->objstruct = lw;
-}
-
-static void ami_401login_close(struct gui_login_window *lw)
-{
- /* If continuation exists, then forbid refetch */
- if (lw->cb != NULL)
- lw->cb(false, lw->cbpw);
-
- DisposeObject(lw->objects[OID_MAIN]);
- lwc_string_unref(lw->host);
- nsurl_unref(lw->url);
- DelObject(lw->node);
-}
-
-static void ami_401login_login(struct gui_login_window *lw)
-{
- ULONG *user,*pass;
- STRPTR userpass;
-
- GetAttr(STRINGA_TextVal,lw->objects[GID_USER],(ULONG *)&user);
- GetAttr(STRINGA_TextVal,lw->objects[GID_PASS],(ULONG *)&pass);
-
- userpass = ASPrintf("%s:%s",user,pass);
- urldb_set_auth_details(lw->url,lw->realm,userpass);
- FreeVec(userpass);
-
- lw->cb(true, lw->cbpw);
-
- /* Invalidate continuation */
- lw->cb = NULL;
- lw->cbpw = NULL;
-
- ami_401login_close(lw);
-}
-
-BOOL ami_401login_event(struct gui_login_window *lw)
-{
- /* return TRUE if window destroyed */
- ULONG result;
- uint16 code;
-
- while((result = RA_HandleInput(lw->objects[OID_MAIN], &code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK)
- {
- case GID_LOGIN:
- ami_401login_login(lw);
- return TRUE;
- break;
-
- case GID_CANCEL:
- ami_401login_close(lw);
- return TRUE;
- break;
- }
- break;
- }
- }
- return FALSE;
-}
-
diff --git a/amiga/login.h b/amiga/login.h
deleted file mode 100755
index e3f77901f..000000000
--- a/amiga/login.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_LOGIN_H
-#define AMIGA_LOGIN_H
-
-#include <stdbool.h>
-
-struct gui_login_window;
-
-BOOL ami_401login_event(struct gui_login_window *lw);
-
-void gui_401login_open(nsurl *url, const char *realm,
- nserror (*cb)(bool proceed, void *pw), void *cbpw);
-
-#endif
diff --git a/amiga/menu.c b/amiga/menu.c
deleted file mode 100644
index 4a30c4878..000000000
--- a/amiga/menu.c
+++ /dev/null
@@ -1,1146 +0,0 @@
-/*
- * Copyright 2008-9,2013 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <proto/dos.h>
-#include <proto/asl.h>
-#include <proto/exec.h>
-#include <proto/gadtools.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-#ifdef __amigaos4__
-#include <dos/anchorpath.h>
-#include <dos/obsolete.h> /* Needed for ExAll() */
-#endif
-
-#include <libraries/gadtools.h>
-
-#include <classes/window.h>
-#include <proto/label.h>
-#include <images/label.h>
-#include <proto/bitmap.h>
-#include <images/bitmap.h>
-
-#include <reaction/reaction_macros.h>
-
-#include "utils/nsoption.h"
-#include "utils/messages.h"
-#include "utils/log.h"
-#include "utils/utils.h"
-#include "utils/nsurl.h"
-#include "content/hlcache.h"
-#include "desktop/hotlist.h"
-#include "desktop/browser.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-#include "desktop/textinput.h"
-#include "desktop/version.h"
-
-#include "amiga/arexx.h"
-#include "amiga/bitmap.h"
-#include "amiga/clipboard.h"
-#include "amiga/cookies.h"
-#include "amiga/file.h"
-#include "amiga/filetype.h"
-#include "amiga/gui.h"
-#include "amiga/gui_options.h"
-#include "amiga/history.h"
-#include "amiga/history_local.h"
-#include "amiga/hotlist.h"
-#include "amiga/libs.h"
-#include "amiga/menu.h"
-#include "amiga/misc.h"
-#include "amiga/print.h"
-#include "amiga/search.h"
-#include "amiga/theme.h"
-#include "amiga/tree.h"
-#include "amiga/utf8.h"
-#include "amiga/schedule.h"
-
-#define NSA_SPACE "blankspace.png"
-#define NSA_MAX_HOTLIST_MENU_LEN 100
-
-enum {
- NSA_GLYPH_SUBMENU,
- NSA_GLYPH_AMIGAKEY,
- NSA_GLYPH_CHECKMARK,
- NSA_GLYPH_MX,
- NSA_GLYPH_MAX
-};
-
-BOOL menualreadyinit;
-const char * const netsurf_version;
-const char * const verdate;
-Object *menu_glyph[NSA_GLYPH_MAX];
-int menu_glyph_width[NSA_GLYPH_MAX];
-bool menu_glyphs_loaded = false;
-
-static nserror ami_menu_scan(struct tree *tree, struct gui_window_2 *gwin);
-void ami_menu_arexx_scan(struct gui_window_2 *gwin);
-
-/*
- * The below functions are called automatically by window.class when menu items are selected.
- */
-
-HOOKF(void, ami_menu_item_project_newwin, APTR, window, struct IntuiMessage *)
-{
- nsurl *url;
- nserror error;
-
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- }
-}
-
-HOOKF(void, ami_menu_item_project_newtab, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- ami_gui_new_blank_tab(gwin);
-}
-
-HOOKF(void, ami_menu_item_project_open, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_file_open(gwin);
-}
-
-HOOKF(void, ami_menu_item_project_save, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- ULONG type = (ULONG)hook->h_Data;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_file_save_req(type, gwin, browser_window_get_content(gwin->gw->bw));
-}
-
-HOOKF(void, ami_menu_item_project_closetab, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_destroy(gwin->gw->bw);
-}
-
-HOOKF(void, ami_menu_item_project_closewin, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_menu_window_close = gwin;
-}
-
-HOOKF(void, ami_menu_item_project_print, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
- ami_print_ui(browser_window_get_content(gwin->gw->bw));
- ami_reset_pointer(gwin);
-}
-
-HOOKF(void, ami_menu_item_project_about, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- char *temp, *temp2;
- int sel;
- nsurl *url = NULL;
- nserror error = NSERROR_OK;
-
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
-
- temp = ASPrintf("%s|%s|%s", messages_get("OK"),
- messages_get("HelpCredits"),
- messages_get("HelpLicence"));
-
- temp2 = ami_utf8_easy(temp);
- FreeVec(temp);
-#ifdef __amigaos4__
- sel = TimedDosRequesterTags(TDR_ImageType,TDRIMAGE_INFO,
- TDR_TitleString, messages_get("NetSurf"),
- TDR_Window, gwin->win,
- TDR_GadgetString, temp2,
- TDR_FormatString,"NetSurf %s\nBuild date %s\n\nhttp://www.netsurf-browser.org",
- TDR_Arg1,netsurf_version,
- TDR_Arg2,verdate,
- TAG_DONE);
-#else
- struct EasyStruct about_req = {
- sizeof(struct EasyStruct),
- 0,
- "NetSurf",
- "NetSurf %s\nBuild date %s\n\nhttp://www.netsurf-browser.org",
- temp2,
- };
-
- sel = EasyRequest(gwin->win, &about_req, NULL, netsurf_version, verdate);
-#endif
- free(temp2);
-
- if(sel == 2) {
- error = nsurl_create("about:credits", &url);
- } else if(sel == 0) {
- error = nsurl_create("about:licence", &url);
- }
-
- if(url) {
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- amiga_warn_user(messages_get_errorcode(error), 0);
- }
- }
-
- ami_reset_pointer(gwin);
-}
-
-HOOKF(void, ami_menu_item_project_quit, APTR, window, struct IntuiMessage *)
-{
- ami_menu_window_close = AMI_MENU_WINDOW_CLOSE_ALL;
-}
-
-HOOKF(void, ami_menu_item_edit_cut, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_key_press(gwin->gw->bw, NS_KEY_CUT_SELECTION);
-}
-
-HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
-{
- struct bitmap *bm;
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- if(browser_window_can_select(gwin->gw->bw)) {
- browser_window_key_press(gwin->gw->bw, NS_KEY_COPY_SELECTION);
- browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
- }
- else if((bm = content_get_bitmap(browser_window_get_content(gwin->gw->bw)))) {
- /** @todo It should be checked that the lifetime of
- * the objects containing the values returned (and the
- * constness cast away) is safe.
- */
- ami_bitmap_set_url(bm, browser_window_get_url(gwin->gw->bw));
- ami_bitmap_set_title(bm, browser_window_get_title(gwin->gw->bw));
- ami_easy_clipboard_bitmap(bm);
- }
-#ifdef WITH_NS_SVG
- else if(ami_mime_compare(browser_window_get_content(gwin->gw->bw), "svg") == true) {
- ami_easy_clipboard_svg(browser_window_get_content(gwin->gw->bw));
- }
-#endif
-}
-
-HOOKF(void, ami_menu_item_edit_paste, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_key_press(gwin->gw->bw, NS_KEY_PASTE);
-}
-
-HOOKF(void, ami_menu_item_edit_selectall, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_key_press(gwin->gw->bw, NS_KEY_SELECT_ALL);
- gui_start_selection(gwin->gw);
-}
-
-HOOKF(void, ami_menu_item_edit_clearsel, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
-}
-
-HOOKF(void, ami_menu_item_edit_undo, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_key_press(gwin->gw->bw, NS_KEY_UNDO);
-}
-
-HOOKF(void, ami_menu_item_edit_redo, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- browser_window_key_press(gwin->gw->bw, NS_KEY_REDO);
-}
-
-HOOKF(void, ami_menu_item_browser_find, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_search_open(gwin->gw);
-}
-
-HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_history_open(gwin->gw);
-}
-
-HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
-{
- ami_tree_open(global_history_window,AMI_TREE_HISTORY);
-}
-
-HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
-{
- ami_tree_open(cookies_window,AMI_TREE_COOKIES);
-}
-
-HOOKF(void, ami_menu_item_browser_foreimg, APTR, window, struct IntuiMessage *)
-{
- 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;
-}
-
-HOOKF(void, ami_menu_item_browser_backimg, APTR, window, struct IntuiMessage *)
-{
- 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;
-}
-
-HOOKF(void, ami_menu_item_browser_enablejs, APTR, window, struct IntuiMessage *)
-{
- 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;
-}
-
-HOOKF(void, ami_menu_item_browser_scale_decrease, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
-}
-
-HOOKF(void, ami_menu_item_browser_scale_normal, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_gui_set_scale(gwin->gw, 1.0);
-}
-
-HOOKF(void, ami_menu_item_browser_scale_increase, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
-}
-
-HOOKF(void, ami_menu_item_browser_redraw, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- ami_schedule_redraw(gwin, true);
- gwin->new_content = true;
-}
-
-HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *)
-{
- struct browser_window *bw;
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- bw = gwin->gw->bw;
-
- if (bw == NULL || browser_window_has_content(bw) == false)
- return;
-
- hotlist_add_url(browser_window_get_url(bw));
- ami_gui_update_hotlist_button(gwin);
-}
-
-HOOKF(void, ami_menu_item_hotlist_show, APTR, window, struct IntuiMessage *)
-{
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
-}
-
-HOOKF(void, ami_menu_item_hotlist_entries, APTR, window, struct IntuiMessage *)
-{
- nsurl *url = hook->h_Data;
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- if(url == NULL) return;
-
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
-}
-
-HOOKF(void, ami_menu_item_settings_edit, APTR, window, struct IntuiMessage *)
-{
- ami_gui_opts_open();
-}
-
-HOOKF(void, ami_menu_item_settings_snapshot, APTR, window, struct IntuiMessage *)
-{
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- nsoption_set_int(window_x, gwin->win->LeftEdge);
- nsoption_set_int(window_y, gwin->win->TopEdge);
- nsoption_set_int(window_width, gwin->win->Width);
- nsoption_set_int(window_height, gwin->win->Height);
-}
-
-HOOKF(void, ami_menu_item_settings_save, APTR, window, struct IntuiMessage *)
-{
- nsoption_write(current_user_options, NULL, NULL);
-}
-
-HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *)
-{
- char *temp;
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- if(AslRequestTags(filereq,
- ASLFR_Window, gwin->win,
- ASLFR_SleepWindow, TRUE,
- ASLFR_TitleText, messages_get("NetSurf"),
- ASLFR_Screen, scrn,
- ASLFR_DoSaveMode, FALSE,
- ASLFR_InitialDrawer, nsoption_charp(arexx_dir),
- ASLFR_InitialPattern, "#?.nsrx",
- TAG_DONE)) {
- if((temp = AllocVecTagList(1024, NULL))) {
- strlcpy(temp, filereq->fr_Drawer, 1024);
- AddPart(temp, filereq->fr_File, 1024);
- ami_arexx_execute(temp);
- FreeVec(temp);
- }
- }
-}
-
-HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
-{
- char *script = hook->h_Data;
- char *temp;
- struct gui_window_2 *gwin;
- GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
- if(script) {
- if((temp = AllocVecTagList(1024, NULL))) {
- BPTR lock;
- if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
- DevNameFromLock(lock, temp, 1024, DN_FULLPATH);
- AddPart(temp, script, 1024);
- ami_arexx_execute(temp);
- FreeVec(temp);
- UnLock(lock);
- }
- }
- }
-}
-
-
-/* menu creation code */
-
-void ami_free_menulabs(struct gui_window_2 *gwin)
-{
- int i;
-
- for(i=0;i<AMI_MENU_AREXX_MAX;i++) {
- if(gwin->menulab[i] && (gwin->menulab[i] != NM_BARLABEL)) {
- if(gwin->menutype[i] & MENU_IMAGE) {
- if(gwin->menuobj[i]) DisposeObject(gwin->menuobj[i]);
- }
-
- ami_utf8_free(gwin->menulab[i]);
-
- if(i >= AMI_MENU_AREXX) {
- if(gwin->menu_hook[i].h_Data) free(gwin->menu_hook[i].h_Data);
- gwin->menu_hook[i].h_Data = NULL;
- }
- }
-
- gwin->menulab[i] = NULL;
- gwin->menuobj[i] = NULL;
- gwin->menukey[i] = 0;
- }
-
- FreeVec(gwin->menutype);
- gwin->menutype = NULL;
-}
-
-static void ami_menu_alloc_item(struct gui_window_2 *gwin, int num, UBYTE type,
- const char *label, char key, const char *icon, void *func, void *hookdata)
-{
- char menu_icon[1024];
-
- gwin->menutype[num] = type;
-
- if((label == NM_BARLABEL) || (strcmp(label, "--") == 0)) {
- gwin->menulab[num] = NM_BARLABEL;
- } else {
- if((num >= AMI_MENU_HOTLIST) && (num <= AMI_MENU_HOTLIST_MAX)) {
- utf8_from_local_encoding(label,
- (strlen(label) < NSA_MAX_HOTLIST_MENU_LEN) ? strlen(label) : NSA_MAX_HOTLIST_MENU_LEN,
- &gwin->menulab[num]);
- } else if((num >= AMI_MENU_AREXX) && (num < AMI_MENU_AREXX_MAX)) {
- gwin->menulab[num] = strdup(label);
- } else {
- gwin->menulab[num] = ami_utf8_easy(messages_get(label));
- }
- }
-
- gwin->menuicon[num] = NULL;
- if(key) gwin->menukey[num] = key;
- if(func) gwin->menu_hook[num].h_Entry = (HOOKFUNC)func;
- if(hookdata) gwin->menu_hook[num].h_Data = hookdata;
-
-#ifdef __amigaos4__
- if(LIB_IS_AT_LEAST((struct Library *)GadToolsBase, 53, 7)) {
- if(icon) {
- if(ami_locate_resource(menu_icon, icon) == true) {
- gwin->menuicon[num] = (char *)strdup(menu_icon);
- } else {
- /* If the requested icon can't be found, put blank space in instead */
- gwin->menuicon[num] = (char *)strdup(NSA_SPACE);
- }
- }
- }
-#endif
-}
-
-static void ami_init_menulabs(struct gui_window_2 *gwin)
-{
- int i;
-
- gwin->menutype = ami_misc_allocvec_clear(sizeof(UBYTE) * (AMI_MENU_AREXX_MAX + 1), 0);
-
- for(i=0;i <= AMI_MENU_AREXX_MAX;i++)
- {
- gwin->menutype[i] = NM_IGNORE;
- gwin->menulab[i] = NULL;
- gwin->menuobj[i] = NULL;
- gwin->menuicon[i] = NULL;
- }
-
- ami_menu_alloc_item(gwin, M_PROJECT, NM_TITLE, "Project", 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_NEWWIN, NM_ITEM, "NewWindowNS", 'N', "TBImages:list_app",
- ami_menu_item_project_newwin, NULL);
- ami_menu_alloc_item(gwin, M_NEWTAB, NM_ITEM, "NewTab", 'T', "TBImages:list_tab",
- ami_menu_item_project_newtab, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_OPEN, NM_ITEM, "OpenFile", 'O', "TBImages:list_folder_misc",
- ami_menu_item_project_open, NULL);
- ami_menu_alloc_item(gwin, M_SAVEAS, NM_ITEM, "SaveAsNS", 0, "TBImages:list_saveas", NULL, NULL);
- ami_menu_alloc_item(gwin, M_SAVESRC, NM_SUB, "Source", 'S', NULL,
- ami_menu_item_project_save, (void *)AMINS_SAVE_SOURCE);
- ami_menu_alloc_item(gwin, M_SAVETXT, NM_SUB, "TextNS", 0, NULL,
- ami_menu_item_project_save, (void *)AMINS_SAVE_TEXT);
- ami_menu_alloc_item(gwin, M_SAVECOMP, NM_SUB, "SaveCompNS", 0, NULL,
- ami_menu_item_project_save, (void *)AMINS_SAVE_COMPLETE);
-#ifdef WITH_PDF_EXPORT
- ami_menu_alloc_item(gwin, M_SAVEPDF, NM_SUB, "PDFNS", 0, NULL,
- ami_menu_item_project_save, (void *)AMINS_SAVE_PDF);
-#endif
- ami_menu_alloc_item(gwin, M_SAVEIFF, NM_SUB, "IFF", 0, NULL,
- ami_menu_item_project_save, (void *)AMINS_SAVE_IFF);
- ami_menu_alloc_item(gwin, M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', "TBImages:list_print",
- ami_menu_item_project_print, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_CLOSETAB, NM_ITEM, "CloseTab", 'K', "TBImages:list_remove",
- ami_menu_item_project_closetab, NULL);
- ami_menu_alloc_item(gwin, M_CLOSEWIN, NM_ITEM, "CloseWindow", 0, "TBImages:list_cancel",
- ami_menu_item_project_closewin, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_ABOUT, NM_ITEM, "About", '?', "TBImages:list_info",
- ami_menu_item_project_about, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P5, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_QUIT, NM_ITEM, "Quit", 'Q', "TBImages:list_warning",
- ami_menu_item_project_quit, NULL);
-
- ami_menu_alloc_item(gwin, M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_CUT, NM_ITEM, "CutNS", 'X', "TBImages:list_cut",
- ami_menu_item_edit_cut, NULL);
- ami_menu_alloc_item(gwin, M_COPY, NM_ITEM, "CopyNS", 'C', "TBImages:list_copy",
- ami_menu_item_edit_copy, NULL);
- ami_menu_alloc_item(gwin, M_PASTE, NM_ITEM, "PasteNS", 'V', "TBImages:list_paste",
- ami_menu_item_edit_paste, NULL);
- ami_menu_alloc_item(gwin, M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_SELALL, NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
- ami_menu_item_edit_selectall, NULL);
- ami_menu_alloc_item(gwin, M_CLEAR, NM_ITEM, "ClearNS", 0, NSA_SPACE,
- ami_menu_item_edit_clearsel, NULL);
- ami_menu_alloc_item(gwin, M_BAR_E2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_UNDO, NM_ITEM, "Undo", 'Z', "TBImages:list_undo",
- ami_menu_item_edit_undo, NULL);
- ami_menu_alloc_item(gwin, M_REDO, NM_ITEM, "Redo", 'Y', "TBImages:list_redo",
- ami_menu_item_edit_redo, NULL);
-
- ami_menu_alloc_item(gwin, M_BROWSER, NM_TITLE, "Browser", 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_FIND, NM_ITEM, "FindTextNS", 'F', "TBImages:list_search",
- ami_menu_item_browser_find, NULL);
- ami_menu_alloc_item(gwin, M_BAR_B1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_HISTLOCL, NM_ITEM, "HistLocalNS", 0, "TBImages:list_history",
- ami_menu_item_browser_localhistory, NULL);
- ami_menu_alloc_item(gwin, M_HISTGLBL, NM_ITEM, "HistGlobalNS", 0, "TBImages:list_history",
- ami_menu_item_browser_globalhistory, NULL);
- ami_menu_alloc_item(gwin, M_BAR_B2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookiesNS", 0, "TBImages:list_internet",
- ami_menu_item_browser_cookies, NULL);
- ami_menu_alloc_item(gwin, M_BAR_B3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_SCALE, NM_ITEM, "ScaleNS", 0, "TBImages:list_preview", NULL, NULL);
- ami_menu_alloc_item(gwin, M_SCALEDEC, NM_SUB, "ScaleDec", '-', "TBImages:list_zoom_out",
- ami_menu_item_browser_scale_decrease, NULL);
- ami_menu_alloc_item(gwin, M_SCALENRM, NM_SUB, "ScaleNorm", '=', "TBImages:list_zoom_100",
- ami_menu_item_browser_scale_normal, NULL);
- ami_menu_alloc_item(gwin, M_SCALEINC, NM_SUB, "ScaleInc", '+', "TBImages:list_zoom_in",
- ami_menu_item_browser_scale_increase, NULL);
- ami_menu_alloc_item(gwin, M_IMAGES, NM_ITEM, "Images", 0, "TBImages:list_image", NULL, NULL);
- ami_menu_alloc_item(gwin, M_IMGFORE, NM_SUB, "ForeImg", 0, NULL,
- ami_menu_item_browser_foreimg, NULL);
- ami_menu_alloc_item(gwin, M_IMGBACK, NM_SUB, "BackImg", 0, NULL,
- ami_menu_item_browser_backimg, NULL);
- ami_menu_alloc_item(gwin, M_JS, NM_ITEM, "EnableJS", 0, NULL,
- ami_menu_item_browser_enablejs, NULL);
- ami_menu_alloc_item(gwin, M_BAR_B4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_REDRAW, NM_ITEM, "Redraw", 0, "TBImages:list_wand",
- ami_menu_item_browser_redraw, NULL);
-
- ami_menu_alloc_item(gwin, M_HOTLIST, NM_TITLE, "Hotlist", 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_HLADD, NM_ITEM, "HotlistAdd", 'B', "TBImages:list_favouriteadd",
- ami_menu_item_hotlist_add, NULL);
- ami_menu_alloc_item(gwin, M_HLSHOW, NM_ITEM,"HotlistShowNS",'H', "TBImages:list_favourite",
- ami_menu_item_hotlist_show, NULL);
- ami_menu_alloc_item(gwin, M_BAR_H1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
-
- ami_menu_alloc_item(gwin, M_PREFS, NM_TITLE, "Settings", 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_PREDIT, NM_ITEM, "SettingsEdit", 0, "TBImages:list_prefs",
- ami_menu_item_settings_edit, NULL);
- ami_menu_alloc_item(gwin, M_BAR_S1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_SNAPSHOT, NM_ITEM, "SnapshotWindow",0, "TBImages:list_hold",
- ami_menu_item_settings_snapshot, NULL);
- ami_menu_alloc_item(gwin, M_PRSAVE, NM_ITEM, "SettingsSave", 0, "TBImages:list_use",
- ami_menu_item_settings_save, NULL);
-
- ami_menu_alloc_item(gwin, M_AREXX, NM_TITLE, "ARexx", 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_AREXXEX, NM_ITEM, "ARexxExecute",'E', "TBImages:list_arexx",
- ami_menu_item_arexx_execute, NULL);
- ami_menu_alloc_item(gwin, M_BAR_A1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- gwin->menutype[AMI_MENU_AREXX_MAX] = NM_END;
-}
-
-/* Menu refresh for hotlist */
-void ami_menu_refresh(struct gui_window_2 *gwin)
-{
- return; /**\todo fix this after migrating to menuclass */
-
- struct Menu *menu;
-
- LOG("Clearing MenuStrip");
- SetAttrs(gwin->objects[OID_MAIN],
- WINDOW_MenuStrip, NULL,
- TAG_DONE);
-
- LOG("Freeing menu");
- ami_menu_free(gwin);
-
- LOG("Freeing menu labels");
- ami_free_menulabs(gwin);
-
- LOG("Creating new menu");
- menu = ami_menu_create(gwin);
-
- LOG("Attaching MenuStrip %p to %p", menu, gwin->objects[OID_MAIN]);
- SetAttrs(gwin->objects[OID_MAIN],
- WINDOW_MenuStrip, menu,
- TAG_DONE);
-}
-
-static void ami_menu_load_glyphs(struct DrawInfo *dri)
-{
-#ifdef __amigaos4__
- if(LIB_IS_AT_LEAST((struct Library *)GadToolsBase, 53, 7)) {
- for(int i = 0; i < NSA_GLYPH_MAX; i++)
- menu_glyph[i] = NULL;
-
- menu_glyph[NSA_GLYPH_SUBMENU] = NewObject(NULL, "sysiclass",
- SYSIA_Which, MENUSUB,
- SYSIA_DrawInfo, dri,
- TAG_DONE);
- menu_glyph[NSA_GLYPH_AMIGAKEY] = NewObject(NULL, "sysiclass",
- SYSIA_Which, AMIGAKEY,
- SYSIA_DrawInfo, dri,
- TAG_DONE);
- GetAttr(IA_Width, menu_glyph[NSA_GLYPH_SUBMENU],
- (ULONG *)&menu_glyph_width[NSA_GLYPH_SUBMENU]);
- GetAttr(IA_Width, menu_glyph[NSA_GLYPH_AMIGAKEY],
- (ULONG *)&menu_glyph_width[NSA_GLYPH_AMIGAKEY]);
-
- menu_glyphs_loaded = true;
- }
-#endif
-}
-
-void ami_menu_free_glyphs(void)
-{
-#ifdef __amigaos4__
- if(LIB_IS_AT_LEAST((struct Library *)GadToolsBase, 53, 7)) {
- int i;
- if(menu_glyphs_loaded == false) return;
-
- for(i = 0; i < NSA_GLYPH_MAX; i++) {
- if(menu_glyph[i]) DisposeObject(menu_glyph[i]);
- menu_glyph[i] = NULL;
- };
-
- menu_glyphs_loaded = false;
- }
-#endif
-}
-
-static int ami_menu_calc_item_width(struct gui_window_2 *gwin, int j, struct RastPort *rp)
-{
- int space_width = TextLength(rp, " ", 1);
- int item_size;
-
- item_size = TextLength(rp, gwin->menulab[j], strlen(gwin->menulab[j]));
- item_size += space_width;
-
- if(gwin->menukey[j]) {
- item_size += TextLength(rp, &gwin->menukey[j], 1);
- item_size += menu_glyph_width[NSA_GLYPH_AMIGAKEY];
- /**TODO: take account of the size of other imagery too
- */
- } else {
- /* assume worst case - it doesn't really matter if we make menus wider */
- item_size += TextLength(rp, "M", 1);
- item_size += menu_glyph_width[NSA_GLYPH_AMIGAKEY];
- }
-
- if(gwin->menuicon[j]) {
- item_size += 16;
- }
-
- return item_size;
-}
-
-
-static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
-{
- int i, j;
- int txtlen = 0;
- int left_posn = 0;
- struct RastPort *rp = &scrn->RastPort;
- struct DrawInfo *dri = GetScreenDrawInfo(scrn);
- int space_width = TextLength(rp, " ", 1);
-
- if(menu_glyphs_loaded == false)
- ami_menu_load_glyphs(dri);
-
- for(i=0; i < AMI_MENU_AREXX_MAX; i++)
- {
- if(gwin->menutype[i] == NM_TITLE) {
- j = i + 1;
- txtlen = 0;
- do {
- if(gwin->menulab[j] != NM_BARLABEL) {
- if(gwin->menutype[j] == NM_ITEM) {
- int item_size = ami_menu_calc_item_width(gwin, j, rp);
- if(item_size > txtlen) {
- txtlen = item_size;
- }
- }
- }
- j++;
- } while((gwin->menutype[j] != NM_TITLE) && (gwin->menutype[j] != 0));
- }
-#ifdef __amigaos4__
- if(LIB_IS_AT_LEAST((struct Library *)GadToolsBase, 53, 7)) {
- /* GadTools 53.7+ only. For now we will only create the menu
- using label.image if there's a bitmap associated with the item. */
- if((gwin->menuicon[i] != NULL) && (gwin->menulab[i] != NM_BARLABEL)) {
- int icon_width = 0;
- Object *submenuarrow = NULL;
- Object *icon = BitMapObj,
- IA_Scalable, TRUE,
- BITMAP_Screen, scrn,
- BITMAP_SourceFile, gwin->menuicon[i],
- BITMAP_Masking, TRUE,
- BitMapEnd;
-
- /* \todo make this scale the bitmap to these dimensions */
- SetAttrs(icon,
- BITMAP_Width, 16,
- BITMAP_Height, 16,
- TAG_DONE);
-
- GetAttr(IA_Width, icon, (ULONG *)&icon_width);
-
- if(gwin->menutype[i] != NM_SUB) {
- left_posn = txtlen;
- }
-
- left_posn = left_posn -
- TextLength(rp, gwin->menulab[i], strlen(gwin->menulab[i])) -
- icon_width - space_width;
-
- if((gwin->menutype[i] == NM_ITEM) && (gwin->menutype[i+1] == NM_SUB)) {
- left_posn -= menu_glyph_width[NSA_GLYPH_SUBMENU];
-
- submenuarrow = NewObject(NULL, "sysiclass",
- SYSIA_Which, MENUSUB,
- SYSIA_DrawInfo, dri,
- IA_Left, left_posn,
- TAG_DONE);
- }
-
- gwin->menuobj[i] = LabelObj,
- LABEL_MenuMode, TRUE,
- LABEL_DrawInfo, dri,
- LABEL_DisposeImage, TRUE,
- LABEL_Image, icon,
- LABEL_Text, " ",
- LABEL_Text, gwin->menulab[i],
- LABEL_DisposeImage, TRUE,
- LABEL_Image, submenuarrow,
- LabelEnd;
-
- if(gwin->menuobj[i]) gwin->menutype[i] |= MENU_IMAGE;
- }
- }
-#endif
- gwin->menu[i].nm_Type = gwin->menutype[i];
-
- if(gwin->menuobj[i])
- gwin->menu[i].nm_Label = (void *)gwin->menuobj[i];
- else
- gwin->menu[i].nm_Label = gwin->menulab[i];
-
- if(gwin->menukey[i]) gwin->menu[i].nm_CommKey = &gwin->menukey[i];
- gwin->menu[i].nm_Flags = 0;
- if(gwin->menu_hook[i].h_Entry) gwin->menu[i].nm_UserData = &gwin->menu_hook[i];
-
- if(gwin->menuicon[i]) {
- free(gwin->menuicon[i]);
- gwin->menuicon[i] = NULL;
- }
- }
-
- FreeScreenDrawInfo(scrn, dri);
-
- return gwin;
-}
-
-void ami_menu_free(struct gui_window_2 *gwin)
-{
- FreeMenus(gwin->imenu);
- FreeVisualInfo(gwin->vi);
-}
-
-struct Menu *ami_menu_create(struct gui_window_2 *gwin)
-{
- gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
- ami_init_menulabs(gwin);
- ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin);
- ami_menu_arexx_scan(gwin);
- gwin = ami_menu_layout(gwin);
-
- gwin->menu[M_JS].nm_Flags = CHECKIT | MENUTOGGLE;
- if(nsoption_bool(enable_javascript) == true)
- gwin->menu[M_JS].nm_Flags |= CHECKED;
-
- gwin->menu[M_PRINT].nm_Flags = NM_ITEMDISABLED;
-
- gwin->menu[M_IMGFORE].nm_Flags = CHECKIT | MENUTOGGLE;
- if(nsoption_bool(foreground_images) == true)
- gwin->menu[M_IMGFORE].nm_Flags |= CHECKED;
- gwin->menu[M_IMGBACK].nm_Flags = CHECKIT | MENUTOGGLE;
- if(nsoption_bool(background_images) == true)
- gwin->menu[M_IMGBACK].nm_Flags |= CHECKED;
-
- gwin->vi = GetVisualInfo(scrn, TAG_DONE);
- gwin->imenu = CreateMenus(gwin->menu, TAG_DONE);
- LayoutMenus(gwin->imenu, gwin->vi,
- GTMN_NewLookMenus, TRUE, TAG_DONE);
- FreeVec(gwin->menu); /**\todo this should be local to this function */
- gwin->menu = NULL;
-
- return gwin->imenu;
-}
-
-void ami_menu_arexx_scan(struct gui_window_2 *gwin)
-{
- /**\todo Rewrite this to not use ExAll() **/
- int item = AMI_MENU_AREXX;
- BPTR lock = 0;
- UBYTE *buffer;
- struct ExAllControl *ctrl;
- char matchpatt[16];
- LONG cont;
- struct ExAllData *ead;
- char *menu_lab;
-
- if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
- if((buffer = AllocVecTagList(1024, NULL))) {
- if((ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))) {
- ctrl->eac_LastKey = 0;
-
- if(ParsePatternNoCase("#?.nsrx",(char *)&matchpatt,16) != -1) {
- ctrl->eac_MatchString = (char *)&matchpatt;
- }
-
- do {
- cont = ExAll(lock,(struct ExAllData *)buffer,1024,ED_COMMENT,ctrl);
- if((!cont) && (IoErr() != ERROR_NO_MORE_ENTRIES)) break;
- if(!ctrl->eac_Entries) continue;
-
- for(ead = (struct ExAllData *)buffer; ead; ead = ead->ed_Next) {
- if(item >= AMI_MENU_AREXX_MAX) continue;
- if(EAD_IS_FILE(ead)) {
- gwin->menu[item].nm_Type = NM_ITEM;
- if(ead->ed_Comment[0] != '\0')
- menu_lab = ead->ed_Comment;
- else
- menu_lab = ead->ed_Name;
-
- ami_menu_alloc_item(gwin, item, NM_ITEM, menu_lab, 0, NSA_SPACE,
- ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name));
-
- item++;
- }
- }
- } while(cont);
- FreeDosObject(DOS_EXALLCONTROL,ctrl);
- }
- FreeVec(buffer);
- }
- UnLock(lock);
- }
-
- gwin->menu[item].nm_Type = NM_END;
- gwin->menu[item].nm_Label = NULL;
-}
-
-static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder)
-{
- UBYTE type;
- STRPTR icon;
- struct gui_window_2 *gw = (struct gui_window_2 *)userdata;
-
- if(item >= AMI_MENU_HOTLIST_MAX) return false;
-
- switch(level) {
- case 1:
- type = NM_ITEM;
- break;
- case 2:
- type = NM_SUB;
- break;
- default:
- /* entries not at level 1 or 2 are not able to be added
- * \todo construct menus using menuclass instead! */
- return false;
- break;
- }
-
- if(is_folder == true) {
- icon = ASPrintf("icons/directory.png");
- } else {
- icon = ami_gui_get_cache_favicon_name(url, true);
- if (icon == NULL) icon = ASPrintf("icons/content.png");
- }
-
- ami_menu_alloc_item(gw, item, type, title,
- 0, icon, ami_menu_item_hotlist_entries, (void *)url);
- if((is_folder == true) && (type == NM_SUB))
- gw->menu[item].nm_Flags = NM_ITEMDISABLED;
-
- if(icon) FreeVec(icon);
-
- return true;
-}
-
-static nserror ami_menu_scan(struct tree *tree, struct gui_window_2 *gwin)
-{
- return ami_hotlist_scan((void *)gwin, AMI_MENU_HOTLIST, messages_get("HotlistMenu"), ami_menu_hotlist_add);
-}
-
-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;
-
- if(nsoption_bool(kiosk_mode) == true) return;
-
- if(content_get_type(c) <= CONTENT_CSS)
- {
- OnMenu(win,AMI_MENU_SAVEAS_TEXT);
- OnMenu(win,AMI_MENU_SAVEAS_COMPLETE);
-#ifdef WITH_PDF_EXPORT
- OnMenu(win,AMI_MENU_SAVEAS_PDF);
-#endif
-#if 0
- if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_COPY) {
- OnMenu(win,AMI_MENU_COPY);
- OnMenu(win,AMI_MENU_CLEAR);
- } else {
- OffMenu(win,AMI_MENU_COPY);
- OffMenu(win,AMI_MENU_CLEAR);
- }
-
- if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_CUT)
- OnMenu(win,AMI_MENU_CUT);
- else
- OffMenu(win,AMI_MENU_CUT);
-
- if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_PASTE)
- OnMenu(win,AMI_MENU_PASTE);
- else
- OffMenu(win,AMI_MENU_PASTE);
-#else
- OnMenu(win,AMI_MENU_CUT);
- OnMenu(win,AMI_MENU_COPY);
- OnMenu(win,AMI_MENU_PASTE);
- OnMenu(win,AMI_MENU_CLEAR);
-#endif
- OnMenu(win,AMI_MENU_SELECTALL);
- OnMenu(win,AMI_MENU_FIND);
- OffMenu(win,AMI_MENU_SAVEAS_IFF);
- }
- else
- {
- OffMenu(win,AMI_MENU_CUT);
- OffMenu(win,AMI_MENU_PASTE);
- OffMenu(win,AMI_MENU_CLEAR);
-
- OffMenu(win,AMI_MENU_SAVEAS_TEXT);
- OffMenu(win,AMI_MENU_SAVEAS_COMPLETE);
-#ifdef WITH_PDF_EXPORT
- OffMenu(win,AMI_MENU_SAVEAS_PDF);
-#endif
- OffMenu(win,AMI_MENU_SELECTALL);
- OffMenu(win,AMI_MENU_FIND);
-
-#ifdef WITH_NS_SVG
- if(content_get_bitmap(c) || (ami_mime_compare(c, "svg") == true))
-#else
- if(content_get_bitmap(c))
-#endif
- {
- OnMenu(win,AMI_MENU_COPY);
- OnMenu(win,AMI_MENU_SAVEAS_IFF);
- }
- else
- {
- OffMenu(win,AMI_MENU_COPY);
- OffMenu(win,AMI_MENU_SAVEAS_IFF);
- }
- }
-}
-
diff --git a/amiga/menu.h b/amiga/menu.h
deleted file mode 100755
index 3bec113d0..000000000
--- a/amiga/menu.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright 2008,2009,2013 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_MENU_H
-#define AMIGA_MENU_H
-
-#include <exec/types.h>
-#include <intuition/intuition.h>
-#include <libraries/gadtools.h>
-
-struct hlcache_handle;
-
-/** Maximum number of hotlist items (somewhat arbitrary value) */
-#define AMI_HOTLIST_ITEMS 60
-
-/** Maximum number of ARexx menu items (somewhat arbitrary value) */
-#define AMI_MENU_AREXX_ITEMS 20
-
-/** enum menu structure, has to be here as we need it below. */
-enum {
- /* Project menu */
- M_PROJECT = 0,
- M_NEWWIN,
- M_NEWTAB,
- M_BAR_P1,
- M_OPEN,
- M_SAVEAS,
- M_SAVESRC,
- M_SAVETXT,
- M_SAVECOMP,
- M_SAVEIFF,
-#ifdef WITH_PDF_EXPORT
- M_SAVEPDF,
-#endif
- M_BAR_P2,
- M_PRINT,
- M_BAR_P3,
- M_CLOSETAB,
- M_CLOSEWIN,
- M_BAR_P4,
- M_ABOUT,
- M_BAR_P5,
- M_QUIT,
- /* Edit menu */
- M_EDIT,
- M_CUT,
- M_COPY,
- M_PASTE,
- M_BAR_E1,
- M_SELALL,
- M_CLEAR,
- M_BAR_E2,
- M_UNDO,
- M_REDO,
- /* Browser menu */
- M_BROWSER,
- M_FIND,
- M_BAR_B1,
- M_HISTLOCL,
- M_HISTGLBL,
- M_BAR_B2,
- M_COOKIES,
- M_BAR_B3,
- M_SCALE,
- M_SCALEDEC,
- M_SCALENRM,
- M_SCALEINC,
- M_IMAGES,
- M_IMGFORE,
- M_IMGBACK,
- M_JS,
- M_BAR_B4,
- M_REDRAW,
- /* Hotlist menu */
- M_HOTLIST,
- M_HLADD,
- M_HLSHOW,
- M_BAR_H1, // 47
- AMI_MENU_HOTLIST, /* Where the hotlist entries start */
- AMI_MENU_HOTLIST_MAX = AMI_MENU_HOTLIST + AMI_HOTLIST_ITEMS,
- /* Settings menu */
- M_PREFS,
- M_PREDIT,
- M_BAR_S1,
- M_SNAPSHOT,
- M_PRSAVE,
- /* ARexx menu */
- M_AREXX,
- M_AREXXEX,
- M_BAR_A1,
- AMI_MENU_AREXX,
- AMI_MENU_AREXX_MAX = AMI_MENU_AREXX + AMI_MENU_AREXX_ITEMS
-};
-
-/* We can get away with AMI_MENU_MAX falling short as it is
- * only used for freeing the UTF-8 converted menu labels */
-#define AMI_MENU_MAX AMI_MENU_AREXX
-
-/* The Intuition menu numbers of some menus we might need to modify */
-#define AMI_MENU_SAVEAS_TEXT FULLMENUNUM(0,4,1)
-#define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2)
-#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3)
-#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4)
-#define AMI_MENU_CLOSETAB FULLMENUNUM(0,8,0)
-#define AMI_MENU_CUT FULLMENUNUM(1,0,0)
-#define AMI_MENU_COPY FULLMENUNUM(1,1,0)
-#define AMI_MENU_PASTE FULLMENUNUM(1,2,0)
-#define AMI_MENU_SELECTALL FULLMENUNUM(1,4,0)
-#define AMI_MENU_CLEAR FULLMENUNUM(1,5,0)
-#define AMI_MENU_UNDO FULLMENUNUM(1,8,0)
-#define AMI_MENU_REDO FULLMENUNUM(1,9,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 (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 Menu *ami_menu_create(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, struct hlcache_handle *c);
-void ami_menu_free_glyphs(void);
-void ami_menu_free(struct gui_window_2 *gwin);
-
-#endif
-
diff --git a/amiga/misc.c b/amiga/misc.c
deleted file mode 100755
index 2c233584d..000000000
--- a/amiga/misc.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Copyright 2008-2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/utility.h>
-
-#ifndef __amigaos4__
-#include <proto/intuition.h> // for EasyRequest
-#endif
-
-#include "utils/utils.h"
-#include "utils/corestrings.h"
-#include "utils/log.h"
-#include "utils/file.h"
-#include "utils/messages.h"
-#include "utils/nsurl.h"
-#include "utils/url.h"
-
-#include "desktop/gui_window.h"
-
-#include "amiga/gui.h"
-#include "amiga/misc.h"
-#include "amiga/utf8.h"
-
-void *ami_misc_allocvec_clear(int size, UBYTE value)
-{
-#ifdef __amigaos4__
- return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
-#else
- void *mem = AllocVec(size, MEMF_ANY);
- if (mem) memset(mem, value, size);
- return mem;
-#endif
-}
-
-APTR ami_misc_itempool_create(int size)
-{
-#ifdef __amigaos4__
- return AllocSysObjectTags(ASOT_ITEMPOOL,
- ASOITEM_MFlags, MEMF_PRIVATE,
- ASOITEM_ItemSize, size,
- ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
- ASOITEM_GCParameter, 100,
- TAG_DONE);
-#else
- return CreatePool(MEMF_ANY, 20 * size, size);
-#endif
-}
-
-void ami_misc_itempool_delete(APTR pool)
-{
-#ifdef __amigaos4__
- FreeSysObject(ASOT_ITEMPOOL, pool);
-#else
- DeletePool(pool);
-#endif
-}
-
-APTR ami_misc_itempool_alloc(APTR pool, int size)
-{
-#ifdef __amigaos4__
- return ItemPoolAlloc(pool);
-#else
- return AllocPooled(pool, size);
-#endif
-}
-
-void ami_misc_itempool_free(APTR pool, APTR item, int size)
-{
-#ifdef __amigaos4__
- ItemPoolFree(pool, item);
-#else
- FreePooled(pool, item, size);
-#endif
-}
-
-static LONG ami_misc_req(const char *message, uint32 type)
-{
- LONG ret = 0;
-
- LOG("%s", message);
-#ifdef __amigaos4__
- ret = TimedDosRequesterTags(
- TDR_TitleString, messages_get("NetSurf"),
- TDR_FormatString, message,
- TDR_GadgetString, messages_get("OK"),
- TDR_ImageType, type,
- TDR_Window, cur_gw ? cur_gw->shared->win : NULL,
- TAG_DONE);
-#else
- struct EasyStruct easyreq = {
- sizeof(struct EasyStruct),
- 0,
- messages_get("NetSurf"),
- message,
- messages_get("OK"),
- };
-
- ret = EasyRequest(cur_gw ? cur_gw->shared->win : NULL, &easyreq, NULL);
-#endif
- return ret;
-}
-
-void ami_misc_fatal_error(const char *message)
-{
- ami_misc_req(message, TDRIMAGE_ERROR);
-}
-
-/* exported interface documented in amiga/misc.h */
-nserror amiga_warn_user(const char *warning, const char *detail)
-{
- char *utf8warning = ami_utf8_easy(messages_get(warning));
- STRPTR bodytext = ASPrintf("\33b%s\33n\n%s",
- utf8warning != NULL ? utf8warning : warning, detail);
-
- ami_misc_req(bodytext, TDRIMAGE_WARNING);
-
- if(bodytext) FreeVec(bodytext);
- if(utf8warning) free(utf8warning);
-
- return NSERROR_OK;
-}
-
-int32 amiga_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);
-
-#ifdef __amigaos4__
- res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_WARNING,
- TDR_TitleString, messages_get("NetSurf"),
- TDR_FormatString, utf8text,
- TDR_GadgetString, utf8gadgets,
- TDR_Window, win,
- TAG_DONE);
-#else
- struct EasyStruct easyreq = {
- sizeof(struct EasyStruct),
- 0,
- messages_get("NetSurf"),
- utf8text,
- utf8gadgets,
- };
-
- res = EasyRequest(win, &easyreq, NULL);
-#endif
-
- if(utf8text) free(utf8text);
- if(utf8gadgets) FreeVec(utf8gadgets);
-
- return res;
-}
-
-/**
- * Create a path from a nsurl using amiga file handling.
- *
- * @param[in] url The url to encode.
- * @param[out] path_out A string containing the result path which should
- * be freed by the caller.
- * @return NSERROR_OK and the path is written to \a path or error code
- * on faliure.
- */
-static nserror amiga_nsurl_to_path(struct nsurl *url, char **path_out)
-{
- lwc_string *urlpath;
- char *path;
- bool match;
- lwc_string *scheme;
- nserror res;
- char *colon;
- char *slash;
-
- if ((url == NULL) || (path_out == NULL)) {
- return NSERROR_BAD_PARAMETER;
- }
-
- scheme = nsurl_get_component(url, NSURL_SCHEME);
-
- if (lwc_string_caseless_isequal(scheme, corestring_lwc_file,
- &match) != lwc_error_ok)
- {
- return NSERROR_BAD_PARAMETER;
- }
- lwc_string_unref(scheme);
- if (match == false) {
- return NSERROR_BAD_PARAMETER;
- }
-
- urlpath = nsurl_get_component(url, NSURL_PATH);
- if (urlpath == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
- res = url_unescape(lwc_string_data(urlpath) + 1, &path);
- lwc_string_unref(urlpath);
- if (res != NSERROR_OK) {
- return res;
- }
-
- colon = strchr(path, ':');
- if(colon == NULL)
- {
- slash = strchr(path, '/');
- if(slash)
- {
- *slash = ':';
- }
- else
- {
- int len = strlen(path);
- path[len] = ':';
- path[len + 1] = '\0';
- }
- }
-
- *path_out = path;
-
- return NSERROR_OK;
-}
-
-/**
- * Create a nsurl from a path using amiga file handling.
- *
- * Perform the necessary operations on a path to generate a nsurl.
- *
- * @param[in] path The path to convert.
- * @param[out] url_out pointer to recive the nsurl, The returned url
- * must be unreferenced by the caller.
- * @return NSERROR_OK and the url is placed in \a url or error code on
- * faliure.
- */
-static nserror amiga_path_to_nsurl(const char *path, struct nsurl **url_out)
-{
- char *colon = NULL;
- char *r = NULL;
- char newpath[1024 + strlen(path)];
- BPTR lock = 0;
- nserror ret;
-
- if((lock = Lock(path, SHARED_LOCK))) {
- DevNameFromLock(lock, newpath, sizeof newpath, DN_FULLPATH);
- UnLock(lock);
- }
- else strlcpy(newpath, path, sizeof newpath);
-
- r = malloc(strlen(newpath) + SLEN("file:///") + 1);
- if (r == NULL) {
- return NSERROR_NOMEM;
- }
-
- if((colon = strchr(newpath, ':'))) *colon = '/';
-
- strcpy(r, "file:///");
- strcat(r, newpath);
-
- ret = nsurl_create(r, url_out);
- free(r);
-
- return ret;
-}
-
-/**
- * returns a string with escape chars translated.
- * (based on remove_underscores from utils.c)
- */
-
-char *translate_escape_chars(const char *s)
-{
- size_t i, ii, len;
- char *ret;
- len = strlen(s);
- ret = malloc(len + 1);
- if (ret == NULL)
- return NULL;
- for (i = 0, ii = 0; i < len; i++) {
- if (s[i] != '\\') {
- ret[ii++] = s[i];
- }
- else if (s[i+1] == 'n') {
- ret[ii++] = '\n';
- i++;
- }
- }
- ret[ii] = '\0';
- return ret;
-}
-
-/**
- * Generate a posix path from one or more component elemnts.
- *
- * If a string is allocated it must be freed by the caller.
- *
- * @param[in,out] str pointer to string pointer if this is NULL enough
- * storage will be allocated for the complete path.
- * @param[in,out] size The size of the space available if \a str not
- * NULL on input and if not NULL set to the total
- * output length on output.
- * @param[in] nelm The number of elements.
- * @param[in] ap The elements of the path as string pointers.
- * @return NSERROR_OK and the complete path is written to str
- * or error code on faliure.
- */
-static nserror amiga_vmkpath(char **str, size_t *size, size_t nelm, va_list ap)
-{
- const char *elm[16];
- size_t elm_len[16];
- size_t elm_idx;
- char *fname;
- size_t fname_len = 0;
-
- /* check the parameters are all sensible */
- if ((nelm == 0) || (nelm > 16)) {
- return NSERROR_BAD_PARAMETER;
- }
- if ((*str != NULL) && (size == NULL)) {
- /* if the caller is providing the buffer they must say
- * how much space is available.
- */
- return NSERROR_BAD_PARAMETER;
- }
-
- /* calculate how much storage we need for the complete path
- * with all the elements.
- */
- for (elm_idx = 0; elm_idx < nelm; elm_idx++) {
- elm[elm_idx] = va_arg(ap, const char *);
- /* check the argument is not NULL */
- if (elm[elm_idx] == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
- elm_len[elm_idx] = strlen(elm[elm_idx]);
- fname_len += elm_len[elm_idx];
- }
- fname_len += nelm; /* allow for separators and terminator */
-
- /* ensure there is enough space */
- fname = *str;
- if (fname != NULL) {
- if (fname_len > *size) {
- return NSERROR_NOSPACE;
- }
- } else {
- fname = malloc(fname_len);
- if (fname == NULL) {
- return NSERROR_NOMEM;
- }
- }
-
- /* copy the first element complete */
- memmove(fname, elm[0], elm_len[0]);
- fname[elm_len[0]] = 0;
-
- /* add the remaining elements */
- for (elm_idx = 1; elm_idx < nelm; elm_idx++) {
- if (!AddPart(fname, elm[elm_idx], fname_len)) {
- break;
- }
- }
-
- *str = fname;
- if (size != NULL) {
- *size = fname_len;
- }
-
- return NSERROR_OK;
-}
-
-/**
- * Get the basename of a file using posix path handling.
- *
- * This gets the last element of a path and returns it.
- *
- * @param[in] path The path to extract the name from.
- * @param[in,out] str Pointer to string pointer if this is NULL enough
- * storage will be allocated for the path element.
- * @param[in,out] size The size of the space available if \a
- * str not NULL on input and set to the total
- * output length on output.
- * @return NSERROR_OK and the complete path is written to str
- * or error code on faliure.
- */
-static nserror amiga_basename(const char *path, char **str, size_t *size)
-{
- const char *leafname;
- char *fname;
-
- if (path == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
- leafname = FilePart(path);
- if (leafname == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
- fname = strdup(leafname);
- if (fname == NULL) {
- return NSERROR_NOMEM;
- }
-
- *str = fname;
- if (size != NULL) {
- *size = strlen(fname);
- }
- return NSERROR_OK;
-}
-
-/**
- * Ensure that all directory elements needed to store a filename exist.
- *
- * @param fname The filename to ensure the path to exists.
- * @return NSERROR_OK on success or error code on failure.
- */
-static nserror amiga_mkdir_all(const char *fname)
-{
- char *dname;
- char *sep;
- struct stat sb;
-
- dname = strdup(fname);
-
- sep = strrchr(dname, '/');
- if (sep == NULL) {
- /* no directory separator path is just filename so its ok */
- free(dname);
- return NSERROR_OK;
- }
-
- *sep = 0; /* null terminate directory path */
-
- if (stat(dname, &sb) == 0) {
- free(dname);
- if (S_ISDIR(sb.st_mode)) {
- /* path to file exists and is a directory */
- return NSERROR_OK;
- }
- return NSERROR_NOT_DIRECTORY;
- }
- *sep = '/'; /* restore separator */
-
- sep = dname;
- while (*sep == '/') {
- sep++;
- }
- while ((sep = strchr(sep, '/')) != NULL) {
- *sep = 0;
- if (stat(dname, &sb) != 0) {
- if (nsmkdir(dname, S_IRWXU) != 0) {
- /* could not create path element */
- free(dname);
- return NSERROR_NOT_FOUND;
- }
- } else {
- if (! S_ISDIR(sb.st_mode)) {
- /* path element not a directory */
- free(dname);
- return NSERROR_NOT_DIRECTORY;
- }
- }
- *sep = '/'; /* restore separator */
- /* skip directory separators */
- while (*sep == '/') {
- sep++;
- }
- }
-
- free(dname);
- return NSERROR_OK;
-}
-
-/* amiga file handling operations */
-static struct gui_file_table file_table = {
- .mkpath = amiga_vmkpath,
- .basename = amiga_basename,
- .nsurl_to_path = amiga_nsurl_to_path,
- .path_to_nsurl = amiga_path_to_nsurl,
- .mkdir_all = amiga_mkdir_all,
-};
-
-struct gui_file_table *amiga_file_table = &file_table;
diff --git a/amiga/misc.h b/amiga/misc.h
deleted file mode 100644
index c7ae5af78..000000000
--- a/amiga/misc.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_MISC_H
-#define AMIGA_MISC_H
-
-#include <exec/types.h>
-
-#include "utils/errors.h"
-
-extern struct gui_file_table *amiga_file_table;
-struct Window;
-
-/**
- * Warn the user of an event.
- *
- * \param[in] warning A warning looked up in the message translation table
- * \param[in] detail Additional text to be displayed or NULL.
- * \return NSERROR_OK on success or error code if there was a
- * faliure displaying the message to the user.
- */
-nserror amiga_warn_user(const char *warning, const char *detail);
-
-void *ami_misc_allocvec_clear(int size, UBYTE value);
-
-/* Itempool cross-compatibility */
-APTR ami_misc_itempool_create(int size);
-void ami_misc_itempool_delete(APTR pool);
-APTR ami_misc_itempool_alloc(APTR pool, int size);
-void ami_misc_itempool_free(APTR pool, APTR item, int size);
-
-char *translate_escape_chars(const char *s);
-void ami_misc_fatal_error(const char *message);
-int32 amiga_warn_user_multi(const char *body,
- const char *opt1, const char *opt2, struct Window *win);
-#endif
-
diff --git a/amiga/object.c b/amiga/object.c
deleted file mode 100755
index 8da16394e..000000000
--- a/amiga/object.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright 2005, 2008, 2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <proto/exec.h>
-#include <exec/lists.h>
-#include <exec/nodes.h>
-
-#include "amiga/misc.h"
-#include "amiga/object.h"
-
-#ifdef __amigaos4__
-#define nsList MinList
-#define NewnsList NewMinList
-#else
-#define nsList List
-#define NewnsList NewList
-#endif
-
-APTR pool_nsobj = NULL;
-
-bool ami_object_init(void)
-{
- pool_nsobj = ami_misc_itempool_create(sizeof(struct nsObject));
-
- if(pool_nsobj == NULL) return false;
- else return true;
-}
-
-void ami_object_fini(void)
-{
- ami_misc_itempool_delete(pool_nsobj);
-}
-
-/* Slightly abstract MinList initialisation */
-static void ami_NewMinList(struct MinList *list)
-{
- if(list == NULL) return;
- NewnsList((struct nsList *)list);
-}
-
-/* Allocate and initialise a new MinList */
-struct MinList *ami_AllocMinList(void)
-{
- struct MinList *objlist = (struct MinList *)AllocVecTagList(sizeof(struct nsList), NULL);
- if(objlist == NULL) return NULL;
- ami_NewMinList(objlist);
- return objlist;
-}
-
-struct MinList *NewObjList(void)
-{
- struct MinList *objlist = ami_AllocMinList();
- return(objlist);
-}
-
-struct nsObject *AddObject(struct MinList *objlist, ULONG otype)
-{
- struct nsObject *dtzo;
-
- dtzo = (struct nsObject *)ami_misc_itempool_alloc(pool_nsobj, sizeof(struct nsObject));
- if(dtzo == NULL) return NULL;
-
- memset(dtzo, 0, sizeof(struct nsObject));
- AddTail((struct List *)objlist,(struct Node *)dtzo);
-
- dtzo->Type = otype;
-
- return(dtzo);
-}
-
-void ObjectCallback(struct nsObject *dtzo, void (*callback)(void *nso))
-{
- dtzo->callback = callback;
-}
-
-static void DelObjectInternal(struct nsObject *dtzo, BOOL free_obj)
-{
- Remove((struct Node *)dtzo);
- if(dtzo->callback != NULL) dtzo->callback(dtzo->objstruct);
- if(dtzo->objstruct && free_obj) FreeVec(dtzo->objstruct);
- if(dtzo->dtz_Node.ln_Name) free(dtzo->dtz_Node.ln_Name);
- ami_misc_itempool_free(pool_nsobj, dtzo, sizeof(struct nsObject));
- dtzo = NULL;
-}
-
-void DelObject(struct nsObject *dtzo)
-{
- DelObjectInternal(dtzo, TRUE);
-}
-
-void DelObjectNoFree(struct nsObject *dtzo)
-{
- DelObjectInternal(dtzo, FALSE);
-}
-
-void FreeObjList(struct MinList *objlist)
-{
- struct nsObject *node;
- struct nsObject *nnode;
-
- if(IsMinListEmpty((struct MinList *)objlist)) return;
- node = (struct nsObject *)GetHead((struct List *)objlist);
-
- do {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
- if(node->Type == AMINS_RECT) {
- DelObjectNoFree(node);
- } else {
- DelObject(node);
- }
- } while((node=nnode));
-
- FreeVec(objlist);
-}
-
diff --git a/amiga/object.h b/amiga/object.h
deleted file mode 100755
index be9650413..000000000
--- a/amiga/object.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2008,2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_OBJECT_H
-#define AMIGA_OBJECT_H
-
-#include <exec/lists.h>
-
-enum
-{
- AMINS_UNKNOWN,
- AMINS_CALLBACK,
- AMINS_WINDOW,
- AMINS_DLWINDOW,
- AMINS_LOGINWINDOW,
- AMINS_TVWINDOW,
- AMINS_FINDWINDOW,
- AMINS_HISTORYWINDOW,
- AMINS_GUIOPTSWINDOW,
- AMINS_PRINTWINDOW,
- AMINS_FONT,
- AMINS_MIME,
- AMINS_RECT
-};
-
-struct nsObject
-{
- struct Node dtz_Node;
- ULONG Type;
- void *objstruct;
- ULONG objstruct_size;
- void (*callback)(void *nso);
-};
-
-
-struct MinList *NewObjList(void);
-struct nsObject *AddObject(struct MinList *objlist, ULONG otype);
-void ObjectCallback(struct nsObject *dtzo, void (*callback)(void *nso));
-void DelObject(struct nsObject *dtzo);
-void DelObjectNoFree(struct nsObject *dtzo);
-void FreeObjList(struct MinList *objlist);
-
-/** List abstraction as OS3 appears to have problems with NewMinList() **/
-struct MinList *ami_AllocMinList(void);
-
-/** Initialisation for itempool **/
-bool ami_object_init(void);
-void ami_object_fini(void);
-#endif
-
diff --git a/amiga/options.h b/amiga/options.h
deleted file mode 100644
index 0c4db5c45..000000000
--- a/amiga/options.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2008 - 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_OPTIONS_H
-#define AMIGA_OPTIONS_H
-
-/* currently nothing here */
-
-#endif
-
-
-
-NSOPTION_STRING(url_file, NULL)
-NSOPTION_STRING(hotlist_file, NULL)
-NSOPTION_STRING(pubscreen_name, NULL)
-NSOPTION_STRING(screen_modeid, NULL)
-NSOPTION_INTEGER(screen_compositing, -1)
-NSOPTION_INTEGER(screen_ydpi, 85)
-NSOPTION_INTEGER(cache_bitmaps, 0)
-NSOPTION_STRING(theme, "PROGDIR:Resources/Themes/Default")
-NSOPTION_BOOL(clipboard_write_utf8, false)
-NSOPTION_BOOL(truecolour_mouse_pointers, false)
-NSOPTION_BOOL(os_mouse_pointers, true)
-NSOPTION_BOOL(use_openurl_lib, false)
-NSOPTION_BOOL(new_tab_is_active, false)
-NSOPTION_BOOL(new_tab_last, false)
-NSOPTION_BOOL(tab_close_warn, true)
-NSOPTION_BOOL(tab_always_show, false)
-NSOPTION_BOOL(kiosk_mode, false)
-NSOPTION_STRING(search_engines_file, "PROGDIR:Resources/SearchEngines")
-NSOPTION_STRING(arexx_dir, "PROGDIR:Rexx")
-NSOPTION_STRING(arexx_startup, "Startup.nsrx")
-NSOPTION_STRING(arexx_shutdown, "Shutdown.nsrx")
-NSOPTION_STRING(download_dir, NULL)
-NSOPTION_BOOL(download_notify, true)
-NSOPTION_BOOL(faster_scroll, true)
-NSOPTION_BOOL(scale_quality, false)
-NSOPTION_INTEGER(dither_quality, 0)
-NSOPTION_INTEGER(mask_alpha, 50)
-NSOPTION_BOOL(ask_overwrite, true)
-NSOPTION_INTEGER(printer_unit, 0)
-NSOPTION_INTEGER(print_scale, 100)
-NSOPTION_BOOL(startup_no_window, false)
-NSOPTION_BOOL(close_no_quit, false)
-NSOPTION_BOOL(hide_docky_icon, false)
-NSOPTION_STRING(font_unicode, NULL)
-NSOPTION_STRING(font_surrogate, NULL)
-NSOPTION_STRING(font_unicode_file, NULL)
-NSOPTION_BOOL(font_unicode_only, false)
-NSOPTION_BOOL(font_antialiasing, true)
-NSOPTION_BOOL(bitmap_fonts, false)
-NSOPTION_BOOL(drag_save_icons, true)
-NSOPTION_INTEGER(hotlist_window_xpos, 0)
-NSOPTION_INTEGER(hotlist_window_ypos, 0)
-NSOPTION_INTEGER(hotlist_window_xsize, 0)
-NSOPTION_INTEGER(hotlist_window_ysize, 0)
-NSOPTION_INTEGER(history_window_xpos, 0)
-NSOPTION_INTEGER(history_window_ypos, 0)
-NSOPTION_INTEGER(history_window_xsize, 0)
-NSOPTION_INTEGER(history_window_ysize, 0)
-NSOPTION_INTEGER(cookies_window_xpos, 0)
-NSOPTION_INTEGER(cookies_window_ypos, 0)
-NSOPTION_INTEGER(cookies_window_xsize, 0)
-NSOPTION_INTEGER(cookies_window_ysize, 0)
-NSOPTION_INTEGER(web_search_width, 0)
-NSOPTION_BOOL(direct_render, false)
-NSOPTION_BOOL(window_simple_refresh, false)
-NSOPTION_BOOL(resize_with_contents, false)
-NSOPTION_INTEGER(reformat_delay, 0)
-NSOPTION_INTEGER(redraw_tile_size_x, 0)
-NSOPTION_INTEGER(redraw_tile_size_y, 0)
-NSOPTION_INTEGER(monitor_aspect_x, 0)
-NSOPTION_INTEGER(monitor_aspect_y, 0)
-NSOPTION_BOOL(accept_lang_locale, true)
-/* Options relevant for OS3 only */
-#ifndef __amigaos4__
-NSOPTION_BOOL(friend_bitmap, false)
-NSOPTION_STRING(local_charset, "ISO-8859-1")
-#endif
-
diff --git a/amiga/os3support.c b/amiga/os3support.c
deleted file mode 100644
index b251448a6..000000000
--- a/amiga/os3support.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Minimal compatibility header for AmigaOS 3
- */
-
-#ifndef __amigaos4__
-#include "os3support.h"
-
-#include <inttypes.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include <proto/bullet.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/dos.h>
-#include <proto/utility.h>
-
-#include <diskfont/diskfont.h>
-#include <diskfont/diskfonttag.h>
-#include <intuition/gadgetclass.h>
-
-#include "utils/log.h"
-
-#define SUCCESS (TRUE)
-#define FAILURE (FALSE)
-#define NO !
-
-/* Diskfont */
-struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags)
-{
- BPTR fh = 0;
- int64 size = 0;
- struct TagItem *ti;
- UBYTE *buffer;
- STRPTR fname, otagpath, fontpath;
- struct BulletBase *BulletBase;
- struct OutlineFont *of = NULL;
- struct GlyphEngine *gengine;
- char *p = 0;
- struct FontContentsHeader fch;
-
- if(p = strrchr(fileName, '.'))
- *p = '\0';
-
- fontpath = (STRPTR)ASPrintf("FONTS:%s.font", fileName);
- fh = Open(fontpath, MODE_OLDFILE);
-
- if(fh == 0) {
- LOG("Unable to open FONT %s", fontpath);
- FreeVec(fontpath);
- return NULL;
- }
-
- if(Read(fh, &fch, sizeof(struct FontContentsHeader)) != sizeof(struct FontContentsHeader)) {
- LOG("Unable to read FONT %s", fontpath);
- FreeVec(fontpath);
- Close(fh);
- return NULL;
- }
-
- Close(fh);
-
- if(fch.fch_FileID != OFCH_ID) {
- LOG("%s is not an outline font!", fontpath);
- FreeVec(fontpath);
- return NULL;
- }
-
- otagpath = (STRPTR)ASPrintf("FONTS:%s.otag", fileName);
- fh = Open(otagpath, MODE_OLDFILE);
-
- if(p) *p = '.';
-
- if(fh == 0) {
- LOG("Unable to open OTAG %s", otagpath);
- FreeVec(otagpath);
- return NULL;
- }
-
- size = GetFileSize(fh);
- buffer = (struct TagItem *)AllocVec(size, MEMF_ANY);
- if(buffer == NULL) {
- LOG("Unable to allocate memory");
- Close(fh);
- FreeVec(otagpath);
- return NULL;
- }
-
- Read(fh, buffer, size);
- Close(fh);
-
- /* The first tag is supposed to be OT_FileIdent and should equal 'size' */
- struct TagItem *tag = (struct TagItem *)buffer;
- if((tag->ti_Tag != OT_FileIdent) || (tag->ti_Data != (ULONG)size)) {
- LOG("Invalid OTAG file");
- FreeVec(buffer);
- FreeVec(otagpath);
- return NULL;
- }
-
- /* Relocate all the OT_Indirect tags */
- while (ti = NextTagItem(&tag)) {
- if(ti->ti_Tag & OT_Indirect) {
- ti->ti_Data += buffer;
- }
- }
-
- /* Find OT_Engine and open the font engine */
- if(ti = FindTagItem(OT_Engine, buffer)) {
- LOG("Using font engine %s", ti->ti_Data);
- fname = ASPrintf("%s.library", ti->ti_Data);
- } else {
- LOG("Cannot find OT_Engine tag");
- FreeVec(buffer);
- FreeVec(otagpath);
- return NULL;
- }
-
- BulletBase = OpenLibrary(fname, 0L);
-
- if(BulletBase == NULL) {
- LOG("Unable to open font engine %s", fname);
- FreeVec(buffer);
- FreeVec(fname);
- FreeVec(otagpath);
- }
-
- FreeVec(fname);
-
- gengine = OpenEngine();
-
- SetInfo(gengine,
- OT_OTagPath, otagpath,
- OT_OTagList, buffer,
- TAG_DONE);
-
- of = AllocVec(sizeof(struct OutlineFont), MEMF_CLEAR);
- if(of == NULL) return NULL;
-
- of->BulletBase = BulletBase;
- of->GEngine = gengine;
- of->OTagPath = otagpath;
- of->olf_OTagList = buffer;
-
- return of;
-}
-
-void CloseOutlineFont(struct OutlineFont *of, struct List *list)
-{
- struct BulletBase *BulletBase = of->BulletBase;
-
- CloseEngine(of->GEngine);
- CloseLibrary(BulletBase);
-
- FreeVec(of->OTagPath);
- FreeVec(of->olf_OTagList);
- FreeVec(of);
-}
-
-
-/* DOS */
-int64 GetFileSize(BPTR fh)
-{
- int32 size = 0;
- struct FileInfoBlock *fib = AllocVec(sizeof(struct FileInfoBlock), MEMF_ANY);
- if(fib == NULL) return 0;
-
- ExamineFH(fh, fib);
- size = fib->fib_Size;
-
- FreeVec(fib);
- return (int64)size;
-}
-
-void FreeSysObject(ULONG type, APTR obj)
-{
- switch(type) {
- case ASOT_PORT:
- DeleteMsgPort(obj);
- break;
- case ASOT_IOREQUEST:
- DeleteIORequest(obj);
- break;
- }
-}
-
-
-/* Exec */
-struct Node *GetHead(struct List *list)
-{
- struct Node *res = NULL;
-
- if ((NULL != list) && (NULL != list->lh_Head->ln_Succ))
- {
- res = list->lh_Head;
- }
- return res;
-}
-
-struct Node *GetPred(struct Node *node)
-{
- if (node->ln_Pred->ln_Pred == NULL) return NULL;
- return node->ln_Pred;
-}
-
-struct Node *GetSucc(struct Node *node)
-{
- if (node->ln_Succ->ln_Succ == NULL) return NULL;
- return node->ln_Succ;
-}
-
-
-/* Intuition */
-uint32 GetAttrs(Object *obj, Tag tag1, ...)
-{
- va_list ap;
- Tag tag = tag1;
- ULONG data = 0;
- int i = 0;
-
- va_start(ap, tag1);
-
- while(tag != TAG_DONE) {
- data = va_arg(ap, ULONG);
- i += GetAttr(tag, obj, (void *)data);
- tag = va_arg(ap, Tag);
- }
- va_end(ap);
-
- return i;
-}
-
-ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requester *r, struct TagItem *tags)
-{
- ULONG retval;
- BOOL changedisabled = FALSE;
- BOOL disabled;
-
- if (w) {
- if (FindTagItem(GA_Disabled,tags)) {
- changedisabled = TRUE;
- disabled = g->Flags & GFLG_DISABLED;
- }
- }
- retval = SetGadgetAttrsA(g,w,r,tags);
- if (w && (retval || (changedisabled && disabled != (g->Flags & GFLG_DISABLED)))) {
- RefreshGList(g,w,r,1);
- retval = 1;
- }
- return retval;
-}
-
-ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1, ...)
-{
- return RefreshSetGadgetAttrsA(g,w,r,(struct TagItem *) &tag1);
-}
-
-APTR NewObject(struct IClass * classPtr, CONST_STRPTR classID, ULONG tagList, ...)
-{
- return NewObjectA(classPtr, classID, (const struct TagItem *) &tagList);
-}
-
-/* Utility */
-struct FormatContext
-{
- STRPTR Index;
- LONG Size;
- BOOL Overflow;
-};
-
-STATIC VOID ASM
-StuffChar(
- REG(a3, struct FormatContext * Context),
- REG(d0, UBYTE Char))
-{
- /* Is there still room? */
- if(Context->Size > 0)
- {
- (*Context->Index) = Char;
-
- Context->Index++;
- Context->Size--;
-
- /* Is there only a single character left? */
- if(Context->Size == 1)
- {
- /* Provide null-termination. */
- (*Context->Index) = '\0';
-
- /* Don't store any further characters. */
- Context->Size = 0;
- }
- }
- else
- {
- Context->Overflow = TRUE;
- }
-}
-
-BOOL
-VSPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- const va_list VarArgs)
-{
- BOOL result = FAILURE;
-
- /* format a text, but place only up to MaxLen
- * characters in the output buffer (including
- * the terminating NUL)
- */
-
- if (Buffer == NULL || FormatString == NULL) return(result);
-
- if(MaxLen > 1)
- {
- struct FormatContext Context;
-
- Context.Index = Buffer;
- Context.Size = MaxLen;
- Context.Overflow = FALSE;
-
- RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
-
- if(NO Context.Overflow)
- result = SUCCESS;
- }
-
- return(result);
-}
-
-BOOL
-SPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- ...)
-{
- va_list VarArgs;
- BOOL result = FAILURE;
-
- /* format a text, varargs version */
-
- if (Buffer == NULL && FormatString == NULL) return result;
-
- va_start(VarArgs,FormatString);
- result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
- va_end(VarArgs);
-
- return(result);
-}
-
-char *ASPrintf(const char *fmt, ...)
-{
- int r;
- va_list ap;
- static char buffer[2048];
- char *rbuf;
-
- va_start(ap, fmt);
- r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
- va_end(ap);
-
- r = strlen(buffer);
- rbuf = AllocVec(r+1, MEMF_CLEAR);
- if (rbuf != NULL)
- {
- strncpy(rbuf, buffer, r);
- }
- return rbuf;
-}
-
-/* C */
-char *strlwr(char *str)
-{
- size_t i;
- size_t len = strlen(str);
-
- for(i=0; i<len; i++)
- str[i] = tolower((unsigned char)str[i]);
-
- return str;
-}
-
-char *strsep(char **s1, const char *s2)
-{
- char *const p1 = *s1;
-
- if (p1 != NULL) {
- *s1 = strpbrk(p1, s2);
- if (*s1 != NULL) {
- *(*s1)++ = '\0';
- }
- }
- return p1;
-}
-
-int scandir(const char *dir, struct dirent ***namelist,
- int (*filter)(const struct dirent *),
- int (*compar)(const struct dirent **, const struct dirent **))
-{
- /*\todo stub function, needs writing, preferably into clib2 */
- return 0;
-}
-
-long long int strtoll(const char *nptr, char **endptr, int base)
-{
- return (long long int)strtol(nptr, endptr, base);
-}
-
-#endif
-
diff --git a/amiga/os3support.h b/amiga/os3support.h
deleted file mode 100644
index 94d1d5818..000000000
--- a/amiga/os3support.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright 2010 John-Mark Bell <jmb@netsurf-browser.org>
- * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Minimal compatibility header for AmigaOS 3
- */
-
-#ifndef AMIGA_OS3SUPPORT_H_
-#define AMIGA_OS3SUPPORT_H_
-
-#ifndef __amigaos4__
-
-#include <stdint.h>
-
-#include <proto/exec.h>
-#include <proto/dos.h>
-
-/* Include prototypes for amigalib */
-#include <clib/alib_protos.h>
-
-#ifndef EXEC_MEMORY_H
-#include <exec/memory.h>
-#endif
-
-/* C macros */
-#ifndef ASM
-#define ASM
-#endif
-
-#ifndef REG
-#define REG(reg,arg) arg __asm(#reg)
-#endif
-
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
-/* Macros */
-#define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0
-#define LIB_IS_AT_LEAST(B,V,R) ((B)->lib_Version>(V)) || \
- ((B)->lib_Version==(V) && (B)->lib_Revision>=(R))
-#define EAD_IS_FILE(E) ((E)->ed_Type<0)
-
-/* Define extra memory type flags */
-#define MEMF_PRIVATE MEMF_ANY
-#define MEMF_SHARED MEMF_ANY
-
-/* Ignore unsupported tags */
-#define ASO_NoTrack TAG_IGNORE
-#define BITMAP_DisabledSourceFile TAG_IGNORE
-#define BITMAP_HasAlpha TAG_IGNORE
-#define BLITA_UseSrcAlpha TAG_IGNORE
-#define BLITA_MaskPlane TAG_IGNORE
-#define CLICKTAB_CloseImage TAG_IGNORE
-#define CLICKTAB_FlagImage TAG_IGNORE
-#define CLICKTAB_LabelTruncate TAG_IGNORE
-#define CLICKTAB_NodeClosed TAG_IGNORE
-#define GETFONT_OTagOnly TAG_IGNORE
-#define GETFONT_ScalableOnly TAG_IGNORE
-#define PDTA_PromoteMask TAG_IGNORE
-#define RPTAG_APenColor TAG_IGNORE
-#define GA_ContextMenu TAG_IGNORE
-#define GA_HintInfo TAG_IGNORE
-#define GAUGEIA_Level TAG_IGNORE
-#define IA_InBorder TAG_IGNORE
-#define IA_Label TAG_IGNORE
-#define SA_Compositing TAG_IGNORE
-#define SBNA_Text TAG_IGNORE
-#define SBNA_HintInfo TAG_IGNORE
-#define TNA_CloseGadget TAG_IGNORE
-#define TNA_HintInfo TAG_IGNORE
-#define WA_ContextMenuHook TAG_IGNORE
-#define WA_ToolBox TAG_IGNORE
-#define WINDOW_BuiltInScroll TAG_IGNORE
-#define WINDOW_NewMenu TAG_IGNORE
-#define WINDOW_NewPrefsHook TAG_IGNORE
-
-/* raw keycodes */
-#define RAWKEY_BACKSPACE 0x41
-#define RAWKEY_TAB 0x42
-#define RAWKEY_ESC 0x45
-#define RAWKEY_DEL 0x46
-#define RAWKEY_PAGEUP 0x48
-#define RAWKEY_PAGEDOWN 0x49
-#define RAWKEY_CRSRUP 0x4C
-#define RAWKEY_CRSRDOWN 0x4D
-#define RAWKEY_CRSRRIGHT 0x4E
-#define RAWKEY_CRSRLEFT 0x4F
-#define RAWKEY_F5 0x54
-#define RAWKEY_F8 0x57
-#define RAWKEY_F9 0x58
-#define RAWKEY_F10 0x59
-#define RAWKEY_HELP 0x5F
-#define RAWKEY_HOME 0x70
-#define RAWKEY_END 0x71
-
-/* Other constants */
-#define BVS_DISPLAY BVS_NONE
-#define IDCMP_EXTENDEDMOUSE 0
-#define WINDOW_BACKMOST 0
-#define DN_FULLPATH 0
-#define BGBACKFILL JAM1
-#define OFF_OPEN 0
-#define AFF_OTAG 0
-
-/* Renamed structures */
-#define AnchorPathOld AnchorPath
-
-/* ReAction (ClassAct) macros */
-#define GetFileEnd End
-#define GetFontEnd End
-#define GetScreenModeEnd End
-
-/* MinTerm stuff */
-#define MINTERM_SRCMASK (ABC|ABNC|ANBC)
-
-/* Easy compat macros */
-/* application */
-#define Notify(...) (void)0
-
-/* DataTypes */
-#define SaveDTObjectA(O,W,R,F,M,I,A) DoDTMethod(O,W,R,DTM_WRITE,F,M,NULL)
-
-/* diskfont */
-#define EReleaseInfo ReleaseInfo
-#define EObtainInfo ObtainInfo
-#define ESetInfo SetInfo
-
-/* Only used in one place we haven't ifdeffed, where it returns the charset name */
-#define ObtainCharsetInfo(A,B,C) (const char *)nsoption_charp(local_charset)
-
-/* DOS */
-#define AllocSysObjectTags(A,B,C,D) CreateMsgPort() /* Assume ASOT_PORT for now */
-#define FOpen(A,B,C) Open(A,B)
-#define FClose(A) Close(A)
-#define CreateDirTree(D) CreateDir(D) /*\todo This isn't quite right */
-#define SetCurrentDir(L) CurrentDir(L)
-#define DevNameFromLock(A,B,C,D) NameFromLock(A,B,C)
-
-/* Exec */
-#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */
-#define FindIName FindName
-
-/* Intuition */
-#define ICoerceMethod CoerceMethod
-#define IDoMethod DoMethod
-#define IDoMethodA DoMethodA
-#define IDoSuperMethodA DoSuperMethodA
-#define ShowWindow(...) (void)0
-
-/* Utility */
-#define SetMem memset
-#define SNPrintf snprintf
-
-/* Integral type definitions */
-typedef int8_t int8;
-typedef uint8_t uint8;
-typedef int16_t int16;
-typedef uint16_t uint16;
-typedef int32_t int32;
-typedef uint32_t uint32;
-typedef int64_t int64;
-typedef uint64_t uint64;
-
-/* TimeVal */
-struct TimeVal {
- uint32 Seconds;
- uint32 Microseconds;
-};
-
-/* TimeRequest */
-struct TimeRequest {
- struct IORequest Request;
- struct TimeVal Time;
-};
-
-/* OutlineFont */
-struct OutlineFont {
- struct BulletBase *BulletBase;
- struct GlyphEngine *GEngine;
- STRPTR OTagPath;
- struct TagItem *olf_OTagList;
-};
-
-/* BackFillMessage */
-struct BackFillMessage {
- struct Layer *Layer;
- struct Rectangle Bounds;
- LONG OffsetX;
- LONG OffsetY;
-};
-
-/* icon.library v51 (ie. AfA_OS version) */
-#define ICONCTRLA_SetImageDataFormat (ICONA_Dummy + 0x67) /*103*/
-#define ICONCTRLA_GetImageDataFormat (ICONA_Dummy + 0x68) /*104*/
-
-#define IDFMT_BITMAPPED (0) /* Bitmapped icon (planar, legacy) */
-#define IDFMT_PALETTEMAPPED (1) /* Palette mapped icon (chunky, V44+) */
-#define IDFMT_DIRECTMAPPED (2) /* Direct mapped icon (truecolor 0xAARRGGBB, V51+) */
-
-/* Object types */
-enum {
- ASOT_PORT = 1,
- ASOT_IOREQUEST
-};
-
-/* Requester types */
-enum {
- TDRIMAGE_ERROR = 1,
- TDRIMAGE_WARNING
-};
-
-/* Functions */
-/* Diskfont */
-void CloseOutlineFont(struct OutlineFont *of, struct List *list);
-struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags);
-
-/* DOS */
-int64 GetFileSize(BPTR fh);
-void FreeSysObject(ULONG type, APTR obj);
-
-/* Exec */
-struct Node *GetHead(struct List *list);
-struct Node *GetPred(struct Node *node);
-struct Node *GetSucc(struct Node *node);
-
-/* Intuition */
-uint32 GetAttrs(Object *obj, Tag tag1, ...);
-ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1, ...);
-ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requester *r, struct TagItem *tags);
-APTR NewObject(struct IClass * classPtr, CONST_STRPTR classID, ULONG tagList, ...);
-
-/* Utility */
-char *ASPrintf(const char *fmt, ...);
-
-/* C */
-char *strlwr(char *str);
-#endif
-#endif
-
diff --git a/amiga/pkg/AutoInstall b/amiga/pkg/AutoInstall
deleted file mode 100755
index 6785a5dff..000000000
--- a/amiga/pkg/AutoInstall
+++ /dev/null
@@ -1,3 +0,0 @@
-; AmiUpdate AutoInstall for NetSurf
-cd NetSurf
-Installer Install APPNAME NetSurfAutoInstall DEFUSER NOVICE LOGFILE T:NetSurfAutoInstall.log
diff --git a/amiga/pkg/drawer.info b/amiga/pkg/drawer.info
deleted file mode 100644
index 0a9548a0d..000000000
--- a/amiga/pkg/drawer.info
+++ /dev/null
Binary files differ
diff --git a/amiga/pkg/makepackage b/amiga/pkg/makepackage
deleted file mode 100755
index 4f5eb84d8..000000000
--- a/amiga/pkg/makepackage
+++ /dev/null
@@ -1,34 +0,0 @@
-makedir ram:NetSurf/Resources ALL
-list resources LFORMAT="copy %f%n ram:netsurf/resources followlinks" files >t:nslinks
-list resources LFORMAT="makedir ram:netsurf/resources/%n" dirs >>t:nslinks
-list resources/~(Pointers|Themes) LFORMAT="copy %f%n/(Messages|#?,faf) ram:netsurf/resources/%n/ followlinks" dirs >>t:nslinks
-list resources/Themes/~(.svn) LFORMAT="makedir ram:netsurf/resources/Themes/%n" dirs >>t:nslinks
-list resources/Themes/~(.svn) LFORMAT="copy %f%n/~(.svn) ram:netsurf/resources/Themes/%n/" dirs >>t:nslinks
-execute t:nslinks
-delete t:nslinks
-delete ram:netsurf/resources/#?hotlist#?
-delete ram:netsurf/resources/cookies
-delete ram:netsurf/resources/urls
-delete ram:netsurf/resources/options
-delete ram:netsurf/resources/#?.user
-copy resources/Pointers/~(.svn) ram:NetSurf/Resources/Pointers
-copy (COPYING|ChangeLog) ram:NetSurf/
-copy NetSurf ram:NetSurf/NetSurf
-copy amiga/dist/AutoInstall ram:
-copy amiga/dist/~(.svn|AutoInstall) ram:NetSurf/
-copy amiga/pkg/drawer.info ram:NetSurf.info
-copy amiga/pkg/fitr ram:NetSurf/
-makedir ram:NetSurf/Rexx
-copy amiga/dist/Rexx/~(.svn) ram:NetSurf/Rexx/ COM
-makedir ram:NetSurf/Libs
-copy libs:parserutils.library libs:nsgif.library libs:nsbmp.library libs:iconv.library libs:hubbub.library ram:NetSurf/Libs
-; libs:css.library libs:wapcaplet.library
-makedir ram:NetSurf/SObjs
-copy sobjs:libjpeg.so.8 sobjs:libcurl.so.7 sobjs:librtmp.so.0 sobjs:libsvgtiny.so.0 sobjs:libssl.so.1.0.0 sobjs:libcrypto.so.1.0.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libpng12.so sobjs:libdom.so.0 sobjs:libhubbub.so.0 ram:NetSurf/SObjs clone
-;sobjs:libhpdf-2.2.0.so.0.0
-echo "Splitting Messages file"
-perl utils/split-messages.pl -l de -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/de/Messages
-perl utils/split-messages.pl -l en -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/en/Messages
-perl utils/split-messages.pl -l fr -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/fr/Messages
-perl utils/split-messages.pl -l it -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/it/Messages
-perl utils/split-messages.pl -l nl -p ami -f messages resources/FatMessages >RAM:NetSurf/Resources/nl/Messages
diff --git a/amiga/pkg/makereslinks b/amiga/pkg/makereslinks
deleted file mode 100755
index 4302dbd23..000000000
--- a/amiga/pkg/makereslinks
+++ /dev/null
@@ -1,28 +0,0 @@
-; Create Resources dir to allow NetSurf to run from build tree
-
-failat 50
-makedir Resources
-cd Resources
-makelink AdBlock.css /!NetSurf/Resources/AdBlock,f79 soft
-makelink default.css /amiga/resources/default.css soft
-makelink ca-bundle /!NetSurf/Resources/ca-bundle soft
-makelink de /!NetSurf/Resources/de soft
-makelink nsdefault.css /!NetSurf/Resources/CSS,f79 soft
-makelink favicon.png /amiga/resources/favicon.png soft
-makelink Resource.map /amiga/resources/Resource.map soft
-makelink en /!NetSurf/Resources/en soft
-makelink fr /!NetSurf/Resources/fr soft
-makelink internal.css /!NetSurf/Resources/internal.css,f79 soft
-makelink it /!NetSurf/Resources/it soft
-makelink LangNames /amiga/resources/LangNames soft
-makelink netsurf.png /!NetSurf/Resources/netsurf.png,b60 soft
-makelink nl /!NetSurf/Resources/nl soft
-makelink Pointers /amiga/resources/Pointers soft
-makelink quirks.css /!NetSurf/Resources/Quirks,f79 soft
-makelink SearchEngines /amiga/resources/SearchEngines soft
-makelink splash.png /amiga/resources/splash.png soft
-makelink Themes /amiga/resources/Themes soft
-makelink mimetypes /amiga/resources/mimetypes soft
-
-/
-makelink amiga/resources/nsdefault.css //!NetSurf/Resources/CSS,f79 soft
diff --git a/amiga/pkg/netsurf.readme b/amiga/pkg/netsurf.readme
deleted file mode 100755
index 3e929b040..000000000
--- a/amiga/pkg/netsurf.readme
+++ /dev/null
@@ -1,25 +0,0 @@
-Short: Fast CSS capable web browser
-Uploader: chris@unsatisfactorysoftware.co.uk (Chris Young)
-Author: NetSurf contributors (OS4 port by Chris Young)
-Type: comm/www
-Version: 3.6
-Requires: dev/misc/guigfxlib.lha
-Architecture: ppc-amigaos >= 4.0.0
-
-This is NetSurf 3.6 for AmigaOS 4 (native frontend).
-For the latest version, visit http://www.netsurf-browser.org
-
- *******************************************
- * Please report bugs on the bugtracker at *
- * http://bugs.netsurf-browser.org *
- *******************************************
-
-See http://www.netsurf-browser.org for more information about
-NetSurf.
-
-This software is licensed under the GPL, and the sources are
-available from http://www.netsurf-browser.org. A copy can
-also be obtained directly from the maintainer of this port,
-chris@unsatisfactorysoftware.co.uk, in the event that the
-website is unavailable.
-
diff --git a/amiga/pkg/netsurf.readme.info b/amiga/pkg/netsurf.readme.info
deleted file mode 100644
index c0ee5ff44..000000000
--- a/amiga/pkg/netsurf.readme.info
+++ /dev/null
Binary files differ
diff --git a/amiga/pkg/netsurf_os3.readme b/amiga/pkg/netsurf_os3.readme
deleted file mode 100644
index d9c0eb58a..000000000
--- a/amiga/pkg/netsurf_os3.readme
+++ /dev/null
@@ -1,28 +0,0 @@
-Short: Fast CSS capable web browser
-Uploader: chris@unsatisfactorysoftware.co.uk (Chris Young)
-Author: NetSurf contributors (OS4 port by Chris Young)
-Type: comm/www
-Version: 3.6 BETA
-Requires: dev/misc/guigfxlib.lha
-Architecture: m68k-amigaos >= 3.5.0
-
-This is NetSurf 3.6 BETA for AmigaOS 3.
-It is built off of the OS4 (Reaction) frontend.
-
-Requirements are AmigaOS 3.5 or 3.9, 32MB RAM.
-
-THIS IS EARLY BETA QUALITY SOFTWARE FOR TESTING ONLY.
-ALL USE IS AT YOUR OWN RISK. IT *WILL* CRASH!
-
-Please report bugs to chris@unsatisfactorysoftware.co.uk,
-or on the amigans.net/amiga.org forums.
-
-See http://www.netsurf-browser.org for more information about
-NetSurf.
-
-This software is licensed under the GPL, and the sources are
-available from http://www.netsurf-browser.org. A copy can
-also be obtained directly from the maintainer of this port,
-chris@unsatisfactorysoftware.co.uk, in the event that the
-website is unavailable.
-
diff --git a/amiga/pkg/netsurf_os3.readme.info b/amiga/pkg/netsurf_os3.readme.info
deleted file mode 100644
index c0ee5ff44..000000000
--- a/amiga/pkg/netsurf_os3.readme.info
+++ /dev/null
Binary files differ
diff --git a/amiga/plotters.c b/amiga/plotters.c
deleted file mode 100644
index 23a73f84a..000000000
--- a/amiga/plotters.c
+++ /dev/null
@@ -1,920 +0,0 @@
-/*
- * Copyright 2008-09, 2012-13 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <proto/exec.h>
-#include <proto/intuition.h>
-
-#include <intuition/intuition.h>
-#include <graphics/rpattr.h>
-#include <graphics/gfxmacros.h>
-#include <graphics/gfxbase.h>
-
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#include <graphics/composite.h>
-#endif
-
-#include <math.h>
-#include <assert.h>
-
-#include "utils/nsoption.h"
-#include "utils/utils.h"
-#include "utils/log.h"
-#include "css/utils.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/plotters.h"
-#include "amiga/bitmap.h"
-#include "amiga/font.h"
-#include "amiga/gui.h"
-#include "amiga/misc.h"
-#include "amiga/rtg.h"
-#include "amiga/utf8.h"
-
-//#define AMI_PLOTTER_DEBUG 1
-
-HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *);
-
-struct bfbitmap {
- struct BitMap *bm;
- ULONG width;
- ULONG height;
- int offsetx;
- int offsety;
- APTR mask;
-};
-
-struct ami_plot_pen {
- struct MinNode node;
- ULONG pen;
-};
-
-struct bez_point {
- float x;
- float y;
-};
-
-static int init_layers_count = 0;
-static APTR pool_pens = NULL;
-
-#ifndef M_PI /* For some reason we don't always get this from math.h */
-#define M_PI 3.14159265358979323846
-#endif
-
-#define PATT_DOT 0xAAAA
-#define PATT_DASH 0xCCCC
-#define PATT_LINE 0xFFFF
-
-/* This defines the size of the list for Area* functions.
- 25000 = 5000 vectors
- */
-#define AREA_SIZE 25000
-
-/* Define the below to get additional debug */
-#undef AMI_PLOTTER_DEBUG
-
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit)
-{
- /* init shared bitmaps *
- * Height is set to screen width to give enough space for thumbnails *
- * Also applies to the further gfx/layers functions and memory below */
-
- int depth = 32;
- struct BitMap *friend = NULL;
-
- if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH);
- LOG("Screen depth = %d", depth);
-
- if(depth < 16) {
- gg->palette_mapped = true;
- } else {
- gg->palette_mapped = false;
- }
-
-#ifndef __amigaos4__
-#warning OS3 locked to palette-mapped modes
- gg->palette_mapped = true;
- if(depth > 8) depth = 8;
-#endif
-
- /* Probably need to fix this next line */
- if(gg->palette_mapped == true) nsoption_set_bool(font_antialiasing, false);
-
- if(!width) width = nsoption_int(redraw_tile_size_x);
- if(!height) height = nsoption_int(redraw_tile_size_y);
- gg->width = width;
- gg->height = height;
-
- gg->layerinfo = NewLayerInfo();
- gg->areabuf = AllocVecTagList(AREA_SIZE, NULL);
-
-#ifdef __amigaos4__
- gg->tmprasbuf = AllocVecTagList(width * height, NULL);
-#else
- /* OS3/AGA requires this to be in chip mem. RTG would probably rather it wasn't. */
- gg->tmprasbuf = AllocVec(width * height, MEMF_CHIP);
-#endif
-
- /* Friend BitMaps are weird.
- * For OS4, we shouldn't use a friend BitMap here (see below).
- * For OS3 AGA, we get no display blitted if we use a friend BitMap,
- * however on RTG it seems to be a benefit.
- */
-#ifndef __amigaos4__
- if(nsoption_bool(friend_bitmap) == true) {
- friend = scrn->RastPort.BitMap;
- } else {
- /* Force friend BitMaps on for obvious RTG screens under OS3.
- * If we get a bit smarter about this we can lose the user option. */
- if((depth >= 16) && (force32bit == false)) friend = scrn->RastPort.BitMap;
- }
-#endif
-
- if(gg->palette_mapped == true) {
- gg->bm = AllocBitMap(width, height, depth, 0, friend);
- } else {
-#ifdef __amigaos4__
- /* Screen depth is reported as 24 even when it's actually 32-bit.
- * We get freezes and other problems on OS4 if we befriend at any
- * other depths, hence this check.
- * \todo use friend BitMaps but avoid CompositeTags() at non-32-bit
- * as that seems to be the cause of the problems.
- */
- if((depth >= 24) && (force32bit == false)) friend = scrn->RastPort.BitMap;
-#endif
- gg->bm = ami_rtg_allocbitmap(width, height, 32, 0, friend, RGBFB_A8R8G8B8);
- }
-
- if(!gg->bm) amiga_warn_user("NoMemory","");
-
- gg->rp = AllocVecTagList(sizeof(struct RastPort), NULL);
- if(!gg->rp) amiga_warn_user("NoMemory","");
-
- InitRastPort(gg->rp);
- gg->rp->BitMap = gg->bm;
-
- SetDrMd(gg->rp,BGBACKFILL);
-
- gg->rp->Layer = CreateUpfrontLayer(gg->layerinfo,gg->rp->BitMap,0,0,
- width-1, height-1, LAYERSIMPLE, NULL);
-
- InstallLayerHook(gg->rp->Layer,LAYERS_NOBACKFILL);
-
- gg->rp->AreaInfo = AllocVecTagList(sizeof(struct AreaInfo), NULL);
- if((!gg->areabuf) || (!gg->rp->AreaInfo)) amiga_warn_user("NoMemory","");
-
- InitArea(gg->rp->AreaInfo,gg->areabuf, AREA_SIZE/5);
-
- gg->rp->TmpRas = AllocVecTagList(sizeof(struct TmpRas), NULL);
- if((!gg->tmprasbuf) || (!gg->rp->TmpRas)) amiga_warn_user("NoMemory","");
-
- InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
-
- if((gg->palette_mapped == true) && (pool_pens == NULL)) {
- pool_pens = ami_misc_itempool_create(sizeof(struct ami_plot_pen));
- }
-
- gg->apen = 0x00000000;
- gg->open = 0x00000000;
- gg->apen_num = -1;
- gg->open_num = -1;
-
- init_layers_count++;
- LOG("Layer initialised (total: %d)", init_layers_count);
-}
-
-void ami_free_layers(struct gui_globals *gg)
-{
- init_layers_count--;
-
- if((init_layers_count == 0) && (pool_pens != NULL)) {
- ami_misc_itempool_delete(pool_pens);
- pool_pens = NULL;
- }
-
- if(gg->rp) {
- DeleteLayer(0,gg->rp->Layer);
- FreeVec(gg->rp->TmpRas);
- FreeVec(gg->rp->AreaInfo);
- FreeVec(gg->rp);
- }
-
- FreeVec(gg->tmprasbuf);
- FreeVec(gg->areabuf);
- DisposeLayerInfo(gg->layerinfo);
- if(gg->palette_mapped == false) {
- if(gg->bm) ami_rtg_freebitmap(gg->bm);
- } else {
- if(gg->bm) FreeBitMap(gg->bm);
- }
-}
-
-void ami_clearclipreg(struct gui_globals *gg)
-{
- struct Region *reg = NULL;
-
- reg = InstallClipRegion(gg->rp->Layer,NULL);
- if(reg) DisposeRegion(reg);
-
- gg->rect.MinX = 0;
- gg->rect.MinY = 0;
- gg->rect.MaxX = scrn->Width-1;
- gg->rect.MaxY = scrn->Height-1;
-}
-
-static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
-{
- struct ami_plot_pen *node;
- LONG pen = ObtainBestPenA(scrn->ViewPort.ColorMap,
- (colr & 0x000000ff) << 24,
- (colr & 0x0000ff00) << 16,
- (colr & 0x00ff0000) << 8,
- NULL);
-
- if(pen == -1) LOG("WARNING: Cannot allocate pen for ABGR:%lx", colr);
-
- if((shared_pens != NULL) && (pool_pens != NULL)) {
- if((node = (struct ami_plot_pen *)ami_misc_itempool_alloc(pool_pens, sizeof(struct ami_plot_pen)))) {
- node->pen = pen;
- AddTail((struct List *)shared_pens, (struct Node *)node);
- }
- } else {
- /* Immediately release the pen if we can't keep track of it. */
- ReleasePen(scrn->ViewPort.ColorMap, pen);
- }
- return pen;
-}
-
-void ami_plot_release_pens(struct MinList *shared_pens)
-{
- struct ami_plot_pen *node;
- struct ami_plot_pen *nnode;
-
- if(shared_pens == NULL) return;
- if(IsMinListEmpty(shared_pens)) return;
- node = (struct ami_plot_pen *)GetHead((struct List *)shared_pens);
-
- do {
- nnode = (struct ami_plot_pen *)GetSucc((struct Node *)node);
- ReleasePen(scrn->ViewPort.ColorMap, node->pen);
- Remove((struct Node *)node);
- ami_misc_itempool_free(pool_pens, node, sizeof(struct ami_plot_pen));
- } while((node = nnode));
-
- glob->apen = 0x00000000;
- glob->open = 0x00000000;
- glob->apen_num = -1;
- glob->open_num = -1;
-}
-
-static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
-{
- if(glob->apen == colr) return;
-
-#ifdef __amigaos4__
- if(glob->palette_mapped == false) {
- SetRPAttrs(rp, RPTAG_APenColor,
- ns_color_to_nscss(colr),
- TAG_DONE);
- } else
-#endif
- {
- LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
- if((pen != -1) && (pen != glob->apen_num)) SetAPen(rp, pen);
- }
-
- glob->apen = colr;
-}
-
-static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
-{
- if(glob->open == colr) return;
-
-#ifdef __amigaos4__
- if(glob->palette_mapped == false) {
- SetRPAttrs(rp, RPTAG_OPenColor,
- ns_color_to_nscss(colr),
- TAG_DONE);
- } else
-#endif
- {
- LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
- if((pen != -1) && (pen != glob->open_num)) SetOPen(rp, pen);
- }
-
- glob->open = colr;
-}
-
-void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
-{
- if((bbox == NULL) || (rp == NULL)) return;
-
- EraseRect(rp, bbox->Left, bbox->Top,
- bbox->Width + bbox->Left, bbox->Height + bbox->Top);
-}
-
-
-static bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_rectangle()");
- #endif
-
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- ami_plot_setapen(glob->rp, style->fill_colour);
- RectFill(glob->rp, x0, y0, x1-1, y1-1);
- }
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- glob->rp->PenWidth = style->stroke_width;
- glob->rp->PenHeight = style->stroke_width;
-
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- glob->rp->LinePtrn = PATT_LINE;
- break;
-
- case PLOT_OP_TYPE_DOT: /**< Dotted plot */
- glob->rp->LinePtrn = PATT_DOT;
- break;
-
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- glob->rp->LinePtrn = PATT_DASH;
- break;
- }
-
- ami_plot_setapen(glob->rp, style->stroke_colour);
- Move(glob->rp, x0,y0);
- Draw(glob->rp, x1, y0);
- Draw(glob->rp, x1, y1);
- Draw(glob->rp, x0, y1);
- Draw(glob->rp, x0, y0);
-
- glob->rp->PenWidth = 1;
- glob->rp->PenHeight = 1;
- glob->rp->LinePtrn = PATT_LINE;
- }
-
- return true;
-}
-
-static bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_line()");
- #endif
-
- glob->rp->PenWidth = style->stroke_width;
- glob->rp->PenHeight = style->stroke_width;
-
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- glob->rp->LinePtrn = PATT_LINE;
- break;
-
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
- glob->rp->LinePtrn = PATT_DOT;
- break;
-
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- glob->rp->LinePtrn = PATT_DASH;
- break;
- }
-
- ami_plot_setapen(glob->rp, style->stroke_colour);
- Move(glob->rp,x0,y0);
- Draw(glob->rp,x1,y1);
-
- glob->rp->PenWidth = 1;
- glob->rp->PenHeight = 1;
- glob->rp->LinePtrn = PATT_LINE;
-
- return true;
-}
-
-static bool ami_polygon(const int *p, unsigned int n, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_polygon()");
- #endif
-
- ami_plot_setapen(glob->rp, style->fill_colour);
-
- if(AreaMove(glob->rp,p[0],p[1]) == -1)
- LOG("AreaMove: vector list full");
-
- for(uint32 k = 1; k < n; k++) {
- if(AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1)
- LOG("AreaDraw: vector list full");
- }
-
- if(AreaEnd(glob->rp) == -1)
- LOG("AreaEnd: error");
-
- return true;
-}
-
-
-static bool ami_clip(const struct rect *clip)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_clip()");
- #endif
-
- struct Region *reg = NULL;
-
- if(glob->rp->Layer)
- {
- reg = NewRegion();
-
- glob->rect.MinX = clip->x0;
- glob->rect.MinY = clip->y0;
- glob->rect.MaxX = clip->x1-1;
- glob->rect.MaxY = clip->y1-1;
-
- OrRectRegion(reg,&glob->rect);
-
- reg = InstallClipRegion(glob->rp->Layer,reg);
-
- if(reg) DisposeRegion(reg);
- }
-
- return true;
-}
-
-static bool ami_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_text()");
- #endif
-
- if(__builtin_expect(ami_nsfont == NULL, 0)) return false;
-
- ami_plot_setapen(glob->rp, fstyle->foreground);
- ami_nsfont->text(glob->rp, text, length, fstyle, x, y, nsoption_bool(font_antialiasing));
-
- return true;
-}
-
-static bool ami_disc(int x, int y, int radius, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_disc()");
- #endif
-
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- ami_plot_setapen(glob->rp, style->fill_colour);
- AreaCircle(glob->rp,x,y,radius);
- AreaEnd(glob->rp);
- }
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- ami_plot_setapen(glob->rp, style->stroke_colour);
- DrawEllipse(glob->rp,x,y,radius,radius);
- }
-
- return true;
-}
-
-static void ami_arc_gfxlib(int x, int y, int radius, int angle1, int angle2)
-{
- double angle1_r = (double)(angle1) * (M_PI / 180.0);
- double angle2_r = (double)(angle2) * (M_PI / 180.0);
- double angle, b, c;
- double step = 0.1; //(angle2_r - angle1_r) / ((angle2_r - angle1_r) * (double)radius);
- int x0, y0, x1, y1;
-
- x0 = x;
- y0 = y;
-
- b = angle1_r;
- c = angle2_r;
-
- x1 = (int)(cos(b) * (double)radius);
- y1 = (int)(sin(b) * (double)radius);
- Move(glob->rp, x0 + x1, y0 - y1);
-
- for(angle = (b + step); angle <= c; angle += step) {
- x1 = (int)(cos(angle) * (double)radius);
- y1 = (int)(sin(angle) * (double)radius);
- Draw(glob->rp, x0 + x1, y0 - y1);
- }
-}
-
-static bool ami_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_arc()");
- #endif
-
- if (angle2 < angle1) angle2 += 360;
-
- ami_plot_setapen(glob->rp, style->fill_colour);
- ami_arc_gfxlib(x, y, radius, angle1, angle2);
-
- return true;
-}
-
-static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitmap)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_bitmap()");
- #endif
-
- struct BitMap *tbm;
-
- if(!width || !height) return true;
-
- if(((x + width) < glob->rect.MinX) ||
- ((y + height) < glob->rect.MinY) ||
- (x > glob->rect.MaxX) ||
- (y > glob->rect.MaxY))
- return true;
-
- tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
- if(!tbm) return true;
-
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] ami_bitmap() got native bitmap");
- #endif
-
-#ifdef __amigaos4__
- if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && (glob->palette_mapped == false) &&
- (nsoption_bool(direct_render) == false), 1)) {
- uint32 comptype = COMPOSITE_Src_Over_Dest;
- uint32 compflags = COMPFLAG_IgnoreDestAlpha;
- if(amiga_bitmap_get_opaque(bitmap)) {
- compflags |= COMPFLAG_SrcAlphaOverride;
- comptype = COMPOSITE_Src;
- }
-
- CompositeTags(comptype,tbm,glob->rp->BitMap,
- COMPTAG_Flags, compflags,
- COMPTAG_DestX,glob->rect.MinX,
- COMPTAG_DestY,glob->rect.MinY,
- COMPTAG_DestWidth,glob->rect.MaxX - glob->rect.MinX + 1,
- COMPTAG_DestHeight,glob->rect.MaxY - glob->rect.MinY + 1,
- COMPTAG_SrcWidth,width,
- COMPTAG_SrcHeight,height,
- COMPTAG_OffsetX,x,
- COMPTAG_OffsetY,y,
- COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
- TAG_DONE);
- }
- else
-#endif
- {
- ULONG tag, tag_data, minterm = 0xc0;
-
- if(glob->palette_mapped == false) {
- tag = BLITA_UseSrcAlpha;
- tag_data = !amiga_bitmap_get_opaque(bitmap);
- minterm = 0xc0;
- } else {
- tag = BLITA_MaskPlane;
- if((tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm)))
- minterm = MINTERM_SRCMASK;
- }
-#ifdef __amigaos4__
- BltBitMapTags(BLITA_Width,width,
- BLITA_Height,height,
- BLITA_Source,tbm,
- BLITA_Dest,glob->rp,
- BLITA_DestX,x,
- BLITA_DestY,y,
- BLITA_SrcType,BLITT_BITMAP,
- BLITA_DestType,BLITT_RASTPORT,
- BLITA_Minterm, minterm,
- tag, tag_data,
- TAG_DONE);
-#else
- if(tag_data) {
- BltMaskBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, minterm, tag_data);
- } else {
- BltBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, 0xc0);
- }
-#endif
- }
-
- if((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
- ami_rtg_freebitmap(tbm);
- }
-
- return true;
-}
-
-static bool ami_bitmap_tile(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_bitmap_tile()");
- #endif
-
- int xf,yf,xm,ym,oy,ox;
- struct BitMap *tbm = NULL;
- struct Hook *bfh = NULL;
- struct bfbitmap bfbm;
- bool repeat_x = (flags & BITMAPF_REPEAT_X);
- bool repeat_y = (flags & BITMAPF_REPEAT_Y);
-
- if((width == 0) || (height == 0)) return true;
-
- if(!(repeat_x || repeat_y))
- return ami_bitmap(x, y, width, height, bitmap);
-
- /* If it is a one pixel transparent image, we are wasting our time */
- if((amiga_bitmap_get_opaque(bitmap) == false) &&
- (bitmap_get_width(bitmap) == 1) && (bitmap_get_height(bitmap) == 1))
- return true;
-
- tbm = ami_bitmap_get_native(bitmap,width,height,glob->rp->BitMap);
- if(!tbm) return true;
-
- ox = x;
- oy = y;
-
- /* get left most tile position */
- for (; ox > 0; ox -= width)
- ;
-
- /* get top most tile position */
- for (; oy > 0; oy -= height)
- ;
-
- if(ox<0) ox = -ox;
- if(oy<0) oy = -oy;
-
- if(repeat_x)
- {
- xf = glob->rect.MaxX;
- xm = glob->rect.MinX;
- }
- else
- {
- xf = x + width;
- xm = x;
- }
-
- if(repeat_y)
- {
- yf = glob->rect.MaxY;
- ym = glob->rect.MinY;
- }
- else
- {
- yf = y + height;
- ym = y;
- }
-#ifdef __amigaos4__
- if(amiga_bitmap_get_opaque(bitmap))
- {
- bfh = CreateBackFillHook(BFHA_BitMap,tbm,
- BFHA_Width,width,
- BFHA_Height,height,
- BFHA_OffsetX,ox,
- BFHA_OffsetY,oy,
- TAG_DONE);
- }
- else
-#endif
- {
- bfbm.bm = tbm;
- bfbm.width = width;
- bfbm.height = height;
- bfbm.offsetx = ox;
- bfbm.offsety = oy;
- bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
- bfh = ami_misc_allocvec_clear(sizeof(struct Hook), 0); /* NB: Was not MEMF_PRIVATE */
- bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
- bfh->h_SubEntry = 0;
- bfh->h_Data = &bfbm;
- }
-
- InstallLayerHook(glob->rp->Layer,bfh);
- EraseRect(glob->rp,xm,ym,xf,yf);
- InstallLayerHook(glob->rp->Layer,LAYERS_NOBACKFILL);
-
-#ifdef __amigaos4__
- if(amiga_bitmap_get_opaque(bitmap)) DeleteBackFillHook(bfh);
- else
-#endif
- FreeVec(bfh);
-
- if((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
- /**\todo is this logic logical? */
- ami_rtg_freebitmap(tbm);
- }
-
- return true;
-}
-
-HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *)
-{
- int xf,yf;
- struct bfbitmap *bfbm = (struct bfbitmap *)hook->h_Data;
-
- /* tile down and across to extents (msg->Bounds.MinX)*/
- for (xf = -bfbm->offsetx; xf < msg->Bounds.MaxX; xf += bfbm->width) {
- for (yf = -bfbm->offsety; yf < msg->Bounds.MaxY; yf += bfbm->height) {
-#ifdef __amigaos4__
- if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
- (glob->palette_mapped == false), 1)) {
- CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap,
- COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha,
- COMPTAG_DestX, msg->Bounds.MinX,
- COMPTAG_DestY, msg->Bounds.MinY,
- COMPTAG_DestWidth, msg->Bounds.MaxX - msg->Bounds.MinX + 1,
- COMPTAG_DestHeight, msg->Bounds.MaxY - msg->Bounds.MinY + 1,
- COMPTAG_SrcWidth, bfbm->width,
- COMPTAG_SrcHeight, bfbm->height,
- COMPTAG_OffsetX, xf,
- COMPTAG_OffsetY, yf,
- COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
- TAG_DONE);
- }
- else
-#endif
- {
- ULONG tag, tag_data, minterm = 0xc0;
-
- if(glob->palette_mapped == false) {
- tag = BLITA_UseSrcAlpha;
- tag_data = TRUE;
- minterm = 0xc0;
- } else {
- tag = BLITA_MaskPlane;
- if((tag_data = (ULONG)bfbm->mask))
- minterm = MINTERM_SRCMASK;
- }
-#ifdef __amigaos4__
- BltBitMapTags(BLITA_Width, bfbm->width,
- BLITA_Height, bfbm->height,
- BLITA_Source, bfbm->bm,
- BLITA_Dest, rp,
- BLITA_DestX, xf,
- BLITA_DestY, yf,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_DestType, BLITT_RASTPORT,
- BLITA_Minterm, minterm,
- tag, tag_data,
- TAG_DONE);
-#else
- if(tag_data) {
- BltMaskBitMapRastPort(bfbm->bm, 0, 0, rp, xf, yf,
- bfbm->width, bfbm->height, minterm, tag_data);
- } else {
- BltBitMapRastPort(bfbm->bm, 0, 0, rp, xf, yf,
- bfbm->width, bfbm->height, minterm);
- }
-#endif
- }
- }
- }
-}
-
-static void ami_bezier(struct bez_point *a, struct bez_point *b, struct bez_point *c,
- struct bez_point *d, double t, struct bez_point *p) {
- p->x = pow((1 - t), 3) * a->x + 3 * t * pow((1 -t), 2) * b->x + 3 * (1-t) * pow(t, 2)* c->x + pow (t, 3)* d->x;
- p->y = pow((1 - t), 3) * a->y + 3 * t * pow((1 -t), 2) * b->y + 3 * (1-t) * pow(t, 2)* c->y + pow (t, 3)* d->y;
-}
-
-static bool ami_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
-{
- unsigned int i;
- struct bez_point start_p = {0, 0}, cur_p = {0, 0}, p_a, p_b, p_c, p_r;
-
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_path()");
- #endif
-
- if (n == 0)
- return true;
-
- if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("Path does not start with move");
- return false;
- }
-
- if (fill != NS_TRANSPARENT) {
- ami_plot_setapen(glob->rp, fill);
- if (c != NS_TRANSPARENT)
- ami_plot_setopen(glob->rp, c);
- } else {
- if (c != NS_TRANSPARENT) {
- ami_plot_setapen(glob->rp, c);
- } else {
- return true; /* wholly transparent */
- }
- }
-
- /* Construct path */
- for (i = 0; i < n; ) {
- if (p[i] == PLOTTER_PATH_MOVE) {
- if (fill != NS_TRANSPARENT) {
- if(AreaMove(glob->rp, p[i+1], p[i+2]) == -1)
- LOG("AreaMove: vector list full");
- } else {
- Move(glob->rp, p[i+1], p[i+2]);
- }
- /* Keep track for future Bezier curves/closes etc */
- start_p.x = p[i+1];
- start_p.y = p[i+2];
- cur_p.x = start_p.x;
- cur_p.y = start_p.y;
- i += 3;
- } else if (p[i] == PLOTTER_PATH_CLOSE) {
- if (fill != NS_TRANSPARENT) {
- if(AreaEnd(glob->rp) == -1)
- LOG("AreaEnd: error");
- } else {
- Draw(glob->rp, start_p.x, start_p.y);
- }
- i++;
- } else if (p[i] == PLOTTER_PATH_LINE) {
- if (fill != NS_TRANSPARENT) {
- if(AreaDraw(glob->rp, p[i+1], p[i+2]) == -1)
- LOG("AreaDraw: vector list full");
- } else {
- Draw(glob->rp, p[i+1], p[i+2]);
- }
- cur_p.x = p[i+1];
- cur_p.y = p[i+2];
- i += 3;
- } else if (p[i] == PLOTTER_PATH_BEZIER) {
- p_a.x = p[i+1];
- p_a.y = p[i+2];
- p_b.x = p[i+3];
- p_b.y = p[i+4];
- p_c.x = p[i+5];
- p_c.y = p[i+6];
-
- for(double t = 0.0; t <= 1.0; t += 0.1) {
- ami_bezier(&cur_p, &p_a, &p_b, &p_c, t, &p_r);
- if (fill != NS_TRANSPARENT) {
- if(AreaDraw(glob->rp, p_r.x, p_r.y) == -1)
- LOG("AreaDraw: vector list full");
- } else {
- Draw(glob->rp, p_r.x, p_r.y);
- }
- }
- cur_p.x = p_c.x;
- cur_p.y = p_c.y;
- i += 7;
- } else {
- LOG("bad path command %f", p[i]);
- /* End path for safety if using Area commands */
- if (fill != NS_TRANSPARENT) {
- AreaEnd(glob->rp);
- BNDRYOFF(glob->rp);
- }
- return false;
- }
- }
- if (fill != NS_TRANSPARENT)
- BNDRYOFF(glob->rp);
-
- return true;
-}
-
-bool ami_plot_screen_is_palettemapped(void)
-{
- return glob->palette_mapped;
-}
-
-struct plotter_table plot;
-const struct plotter_table amiplot = {
- .rectangle = ami_rectangle,
- .line = ami_line,
- .polygon = ami_polygon,
- .clip = ami_clip,
- .text = ami_text,
- .disc = ami_disc,
- .arc = ami_arc,
- .bitmap = ami_bitmap_tile,
- .path = ami_path,
- .option_knockout = true,
-};
-
diff --git a/amiga/plotters.h b/amiga/plotters.h
deleted file mode 100644
index 7baa21fb5..000000000
--- a/amiga/plotters.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_PLOTTERS_H
-#define AMIGA_PLOTTERS_H
-#include "desktop/plotters.h"
-#include <proto/layers.h>
-#include <proto/graphics.h>
-
-struct IBox;
-
-struct gui_globals
-{
- struct BitMap *bm;
- struct RastPort *rp;
- struct Layer_Info *layerinfo;
- APTR areabuf;
- APTR tmprasbuf;
- struct Rectangle rect;
- struct MinList *shared_pens;
- bool palette_mapped;
- ULONG apen;
- ULONG open;
- LONG apen_num;
- LONG open_num;
- int width; /* size of bm and */
- int height; /* associated memory */
-};
-
-extern const struct plotter_table amiplot;
-
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit);
-void ami_free_layers(struct gui_globals *gg);
-void ami_clearclipreg(struct gui_globals *gg);
-void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox);
-void ami_plot_release_pens(struct MinList *shared_pens);
-bool ami_plot_screen_is_palettemapped(void);
-
-struct gui_globals *glob;
-#endif
diff --git a/amiga/plugin_hack.c b/amiga/plugin_hack.c
deleted file mode 100644
index 21f4da142..000000000
--- a/amiga/plugin_hack.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Plugin=>external program handler (implementation)
-*/
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-
-#include "amiga/filetype.h"
-#include "amiga/plugin_hack.h"
-#include "content/content_protected.h"
-#include "content/hlcache.h"
-#include "desktop/plotters.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
-
-typedef struct amiga_plugin_hack_content {
- struct content base;
-} amiga_plugin_hack_content;
-
-static nserror amiga_plugin_hack_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c);
-static bool amiga_plugin_hack_convert(struct content *c);
-static void amiga_plugin_hack_reformat(struct content *c, int width, int height);
-static void amiga_plugin_hack_destroy(struct content *c);
-static bool amiga_plugin_hack_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx);
-static void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
- struct content *page, struct object_params *params);
-static void amiga_plugin_hack_close(struct content *c);
-static nserror amiga_plugin_hack_clone(const struct content *old, struct content **newc);
-static content_type amiga_plugin_hack_content_type(void);
-
-static const content_handler amiga_plugin_hack_content_handler = {
- .create = amiga_plugin_hack_create,
- .data_complete = amiga_plugin_hack_convert,
- .reformat = amiga_plugin_hack_reformat,
- .destroy = amiga_plugin_hack_destroy,
- .redraw = amiga_plugin_hack_redraw,
- .open = amiga_plugin_hack_open,
- .close = amiga_plugin_hack_close,
- .clone = amiga_plugin_hack_clone,
- .type = amiga_plugin_hack_content_type,
- .no_share = false,
-};
-
-nserror amiga_plugin_hack_init(void)
-{
- struct Node *node = NULL;
- lwc_string *type;
- nserror error;
-
- do {
- node = ami_mime_has_cmd(&type, node);
-
- if(node)
- {
- LOG("plugin_hack registered %s", lwc_string_data(type));
-
- error = content_factory_register_handler(
- lwc_string_data(type),
- &amiga_plugin_hack_content_handler);
-
- if (error != NSERROR_OK)
- return error;
- }
-
- }while (node != NULL);
-
- return NSERROR_OK;
-}
-
-nserror amiga_plugin_hack_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- amiga_plugin_hack_content *plugin;
- nserror error;
-
- plugin = calloc(1, sizeof(amiga_plugin_hack_content));
- if (plugin == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&plugin->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(plugin);
- return error;
- }
-
- *c = (struct content *) plugin;
-
- return NSERROR_OK;
-}
-
-bool amiga_plugin_hack_convert(struct content *c)
-{
- LOG("amiga_plugin_hack_convert");
-
- content_set_ready(c);
- content_set_done(c);
-
- content_set_status(c, "");
-
- return true;
-}
-
-void amiga_plugin_hack_destroy(struct content *c)
-{
- amiga_plugin_hack_content *plugin = (amiga_plugin_hack_content *) c;
-
- LOG("amiga_plugin_hack_destroy %p", plugin);
-
- return;
-}
-
-bool amiga_plugin_hack_redraw(struct content *c,
- struct content_redraw_data *data, const struct rect *clip,
- const struct redraw_context *ctx)
-{
- plot_style_t pstyle = {
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = 0xffffff,
- .stroke_colour = 0x000000,
- .stroke_width = 1,
- };
-
- LOG("amiga_plugin_hack_redraw");
-
- ctx->plot->rectangle(data->x, data->y, data->x + data->width,
- data->y + data->height, &pstyle);
-
- return ctx->plot->text(data->x, data->y+20,
- lwc_string_data(content__get_mime_type(c)),
- lwc_string_length(content__get_mime_type(c)),
- plot_style_font);
-}
-
-/**
- * Handle a window containing a CONTENT_PLUGIN being opened.
- *
- * \param c content that has been opened
- * \param bw browser window containing the content
- * \param page content of type CONTENT_HTML containing c, or 0 if not an
- * object within a page
- * \param params object parameters, or 0 if not an object
- */
-void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
- struct content *page, struct object_params *params)
-{
- LOG("amiga_plugin_hack_open %s", nsurl_access(content_get_url(c)));
-
- if(c)
- {
- /* TODO: Do we need valid dimensions at this point? */
- c->width = 0;
- c->height = 0;
- }
-
- return;
-}
-
-void amiga_plugin_hack_close(struct content *c)
-{
- LOG("amiga_plugin_hack_close");
- return;
-}
-
-void amiga_plugin_hack_reformat(struct content *c, int width, int height)
-{
- LOG("amiga_plugin_hack_reformat");
-
- c->width = width;
- c->height = height;
-
- return;
-}
-
-nserror amiga_plugin_hack_clone(const struct content *old, struct content **newc)
-{
- amiga_plugin_hack_content *plugin;
- nserror error;
-
- LOG("amiga_plugin_hack_clone");
-
- plugin = calloc(1, sizeof(amiga_plugin_hack_content));
- if (plugin == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &plugin->base);
- if (error != NSERROR_OK) {
- content_destroy(&plugin->base);
- return error;
- }
-
- /* We "clone" the old content by replaying conversion */
- if (old->status == CONTENT_STATUS_READY ||
- old->status == CONTENT_STATUS_DONE) {
- if (amiga_plugin_hack_convert(&plugin->base) == false) {
- content_destroy(&plugin->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- *newc = (struct content *) plugin;
-
- return NSERROR_OK;
-}
-
-content_type amiga_plugin_hack_content_type(void)
-{
- return CONTENT_PLUGIN;
-}
-
-void amiga_plugin_hack_execute(struct hlcache_handle *c)
-{
- lwc_string *plugincmd;
- char *full_cmd;
- BPTR in, out;
-
- if(c == NULL) return;
-
- plugincmd = ami_mime_content_to_cmd(c);
- if(plugincmd == NULL) return;
-
- full_cmd = ASPrintf("%s %s", lwc_string_data(plugincmd), nsurl_access(hlcache_handle_get_url(c)));
-
- if(full_cmd)
- {
-#ifdef __amigaos4__
- LOG("Attempting to execute %s", full_cmd);
-
- in = Open("NIL:", MODE_OLDFILE);
- out = Open("NIL:", MODE_NEWFILE);
-
- SystemTags(full_cmd,
- SYS_Input, in,
- SYS_Output, out,
- SYS_Error, out,
- SYS_Asynch, TRUE,
- NP_Name, "NetSurf External Process",
- TAG_DONE);
-
- FreeVec(full_cmd);
-#endif
- }
-}
diff --git a/amiga/plugin_hack.h b/amiga/plugin_hack.h
deleted file mode 100644
index 3d644ae8b..000000000
--- a/amiga/plugin_hack.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NETSURF_AMIGA_PLUGIN_HACK_H_
-#define NETSURF_AMIGA_PLUGIN_HACK_H_
-
-#include "utils/config.h"
-#include "utils/errors.h"
-
-nserror amiga_plugin_hack_init(void);
-
-void amiga_plugin_hack_execute(struct hlcache_handle *c);
-#endif
diff --git a/amiga/print.c b/amiga/print.c
deleted file mode 100644
index fcccc91e2..000000000
--- a/amiga/print.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <string.h>
-#include <proto/utility.h>
-#include <proto/iffparse.h>
-#include <proto/dos.h>
-#include <proto/intuition.h>
-#include <proto/Picasso96API.h>
-#include <devices/printer.h>
-#include <devices/prtbase.h>
-
-#include <prefs/prefhdr.h>
-#include <prefs/printertxt.h>
-#include <libraries/gadtools.h>
-
-#include <proto/window.h>
-#include <proto/layout.h>
-#include <proto/integer.h>
-#include <proto/label.h>
-#include <proto/chooser.h>
-#include <proto/fuelgauge.h>
-#include <classes/window.h>
-#include <gadgets/fuelgauge.h>
-#include <gadgets/layout.h>
-#include <gadgets/integer.h>
-#include <gadgets/chooser.h>
-#include <images/label.h>
-
-#include <reaction/reaction_macros.h>
-
-#include "utils/nsoption.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "desktop/plotters.h"
-#include "desktop/printer.h"
-#include "desktop/print.h"
-#include "desktop/gui_layout.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-#include "content/hlcache.h"
-
-#include "amiga/plotters.h"
-#include "amiga/font.h"
-#include "amiga/gui.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/print.h"
-#include "amiga/utf8.h"
-
-bool ami_print_begin(struct print_settings *ps);
-bool ami_print_next_page(void);
-void ami_print_end(void);
-bool ami_print_dump(void);
-void ami_print_progress(void);
-void ami_print_close_device(void);
-
-const struct printer amiprinter = {
- &amiplot,
- ami_print_begin,
- ami_print_next_page,
- ami_print_end,
-};
-
-struct ami_printer_info
-{
- struct gui_globals *gg;
- struct IODRPTagsReq *PReq;
- struct PrinterData *PD;
- struct PrinterExtendedData *PED;
- struct MsgPort *msgport;
- struct hlcache_handle *c;
- struct print_settings *ps;
- int page;
- int pages;
- Object *gadgets[GID_LAST];
- Object *objects[OID_LAST];
- struct Window *win;
-};
-
-enum
-{
- PGID_MAIN=0,
- PGID_PRINTER,
- PGID_SCALE,
- PGID_COPIES,
- PGID_PRINT,
- PGID_CANCEL,
- PGID_LAST
-};
-
-#define IFFPrefChunkCnt 2
-static LONG IFFPrefChunks[] =
-{
- ID_PREF, ID_PRHD,
- ID_PREF, ID_PDEV,
-};
-
-static struct ami_printer_info ami_print_info;
-
-static CONST_STRPTR gadlab[PGID_LAST];
-static STRPTR printers[11];
-
-static void ami_print_ui_setup(void)
-{
- gadlab[PGID_PRINTER] = (char *)ami_utf8_easy((char *)messages_get("Printer"));
- gadlab[PGID_SCALE] = (char *)ami_utf8_easy((char *)messages_get("Scale"));
- gadlab[PGID_COPIES] = (char *)ami_utf8_easy((char *)messages_get("Copies"));
- gadlab[PGID_PRINT] = (char *)ami_utf8_easy((char *)messages_get("ObjPrint"));
- gadlab[PGID_CANCEL] = (char *)ami_utf8_easy((char *)messages_get("Cancel"));
-}
-
-static void ami_print_ui_free(void)
-{
- int i;
-
- for(i = 0; i < PGID_LAST; i++) {
- if(gadlab[i]) FreeVec((APTR)gadlab[i]);
- }
-
- for(i = 0; i < 10; i++) {
- if(printers[i]) FreeVec(printers[i]);
- }
-}
-
-static BOOL ami_print_readunit(CONST_STRPTR filename, char name[],
- uint32 namesize, int unitnum)
-{
- /* This is a modified version of a function from the OS4 SDK.
- * The README says "You can use it in your application",
- * no licence is specified. (c) 1999 Amiga Inc */
-
- BPTR fp;
- BOOL ok;
- struct IFFHandle *iff;
- struct ContextNode *cn;
- struct PrefHeader phead;
- struct PrinterDeviceUnitPrefs pdev;
-
- SNPrintf(name,namesize,"Unit %ld",unitnum);
- fp = Open(filename, MODE_OLDFILE);
- if (fp)
- {
- iff = AllocIFF();
- if (iff)
- {
- iff->iff_Stream = fp;
- InitIFFasDOS(iff);
-
- if (!OpenIFF(iff, IFFF_READ))
- {
- if (!ParseIFF(iff, IFFPARSE_STEP))
- {
- cn = CurrentChunk(iff);
- if (cn->cn_ID == ID_FORM && cn->cn_Type == ID_PREF)
- {
- if (!StopChunks(iff, IFFPrefChunks, IFFPrefChunkCnt))
- {
- ok = TRUE;
- while (ok)
- {
- if (ParseIFF(iff, IFFPARSE_SCAN))
- break;
- cn = CurrentChunk(iff);
- if (cn->cn_Type == ID_PREF)
- {
- switch (cn->cn_ID)
- {
- case ID_PRHD:
- if (ReadChunkBytes(iff, &phead, sizeof(struct PrefHeader)) != sizeof(struct PrefHeader))
- {
- ok = FALSE;
- break;
- }
- if (phead.ph_Version != 0)
- {
- ok = FALSE;
- break;
- }
- break;
- case ID_PDEV:
- if (ReadChunkBytes(iff, &pdev, sizeof(pdev)) == sizeof(pdev))
- {
- if (pdev.pd_UnitName[0])
- strcpy(name,pdev.pd_UnitName);
- }
- break;
- default:
- break;
- }
- }
- }
- }
- }
- }
- CloseIFF(iff);
- }
- FreeIFF(iff);
- }
- Close(fp);
- }
- else return FALSE;
-
- return TRUE;
-}
-
-void ami_print_ui(struct hlcache_handle *c)
-{
- char filename[30];
- int i;
-
- struct ami_print_window *pw = ami_misc_allocvec_clear(sizeof(struct ami_print_window), 0);
-
- pw->c = c;
-
- printers[0] = ami_misc_allocvec_clear(50, 0);
- ami_print_readunit("ENV:Sys/printer.prefs", printers[0], 50, 0);
-
- strcpy(filename,"ENV:Sys/printerN.prefs");
- for (i = 1; i < 10; i++)
- {
- filename[15] = '0' + i;
- printers[i] = AllocVecTagList(50, NULL);
- if(!ami_print_readunit(filename, printers[i], 50, i))
- {
- FreeVec(printers[i]);
- printers[i] = NULL;
- break;
- }
-
- }
-
- ami_print_ui_setup();
-
- pw->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, gadlab[PGID_PRINT],
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, FALSE,
- WA_PubScreen, scrn,
- WINDOW_SharedPort, sport,
- WINDOW_UserData, pw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, pw->gadgets[PGID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, ChooserObject,
- GA_ID, PGID_PRINTER,
- GA_RelVerify, TRUE,
- GA_TabCycle, TRUE,
- CHOOSER_LabelArray, printers,
- CHOOSER_Selected, nsoption_int(printer_unit),
- ChooserEnd,
- CHILD_Label, LabelObject,
- LABEL_Text, gadlab[PGID_PRINTER],
- LabelEnd,
- LAYOUT_AddChild, IntegerObject,
- GA_ID, PGID_COPIES,
- GA_RelVerify, TRUE,
- GA_TabCycle, TRUE,
- INTEGER_Number, 1,
- INTEGER_Minimum, 1,
- INTEGER_Maximum, 100,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_Label, LabelObject,
- LABEL_Text, gadlab[PGID_COPIES],
- LabelEnd,
- LAYOUT_AddChild, HGroupObject,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, pw->gadgets[PGID_SCALE] = IntegerObj,
- GA_ID, PGID_SCALE,
- GA_RelVerify, TRUE,
- GA_TabCycle, TRUE,
- INTEGER_Number, nsoption_int(print_scale),
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 100,
- INTEGER_Arrows, TRUE,
- IntegerEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObject,
- LABEL_Text, "%",
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObject,
- LABEL_Text, gadlab[PGID_SCALE],
- LabelEnd,
- LAYOUT_AddChild, HGroupObject,
- LAYOUT_AddChild, pw->gadgets[PGID_PRINT] = ButtonObj,
- GA_ID, PGID_PRINT,
- GA_RelVerify,TRUE,
- GA_Text, gadlab[PGID_PRINT],
- GA_TabCycle,TRUE,
- ButtonEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, pw->gadgets[GID_CANCEL] = ButtonObj,
- GA_ID, PGID_CANCEL,
- GA_RelVerify, TRUE,
- GA_Text, gadlab[PGID_CANCEL],
- GA_TabCycle,TRUE,
- ButtonEnd,
- LayoutEnd,
- CHILD_WeightedHeight,0,
- EndGroup,
- EndWindow;
-
- pw->win = (struct Window *)RA_OpenWindow(pw->objects[OID_MAIN]);
-
- pw->node = AddObject(window_list, AMINS_PRINTWINDOW);
- pw->node->objstruct = pw;
-}
-
-static void ami_print_close(struct ami_print_window *pw)
-{
- DisposeObject(pw->objects[OID_MAIN]);
- DelObject(pw->node);
-
- ami_print_ui_free();
-}
-
-BOOL ami_print_event(struct ami_print_window *pw)
-{
- /* return TRUE if window destroyed */
- ULONG result;
- uint16 code;
- struct hlcache_handle *c;
- int copies;
- int print_scale;
- int printer_unit;
-
- while((result = RA_HandleInput(pw->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK)
- {
- case PGID_PRINT:
- GetAttr(INTEGER_Number, pw->gadgets[PGID_SCALE],
- (ULONG *)&print_scale);
- GetAttr(INTEGER_Number, pw->gadgets[PGID_COPIES],
- (ULONG *)&copies);
- GetAttr(CHOOSER_Selected, pw->gadgets[PGID_PRINTER],
- (ULONG *)&printer_unit);
-
- nsoption_set_int(print_scale, print_scale);
- nsoption_set_int(printer_unit, printer_unit);
-
- c = pw->c;
- ami_print_close(pw);
- ami_print(c, copies);
- return TRUE;
- break;
-
- case PGID_CANCEL:
- ami_print_close(pw);
- return TRUE;
- break;
- }
- break;
-
- case WMHI_CLOSEWINDOW:
- ami_print_close(pw);
- return TRUE;
- break;
- }
- }
- return FALSE;
-}
-
-void ami_print(struct hlcache_handle *c, int copies)
-{
- double height;
- float scale = nsoption_int(print_scale) / 100.0;
-
- if(ami_print_info.msgport == NULL)
- ami_print_init();
-#ifdef __amigaos4__
- if(!(ami_print_info.PReq =
- (struct IODRPTagsReq *)AllocSysObjectTags(ASOT_IOREQUEST,
- ASOIOR_Size, sizeof(struct IODRPTagsReq),
- ASOIOR_ReplyPort, ami_print_info.msgport,
- ASO_NoTrack, FALSE,
- TAG_DONE))) return;
-#else
- if(!(ami_print_info.PReq =
- (struct IODRPTagsReq *)CreateIORequest(ami_print_info.msgport,
- sizeof(struct IODRPTagsReq)))) return;
-#endif
-
- if(OpenDevice("printer.device", nsoption_int(printer_unit),
- (struct IORequest *)ami_print_info.PReq, 0))
- {
- amiga_warn_user("CompError","printer.device");
- return;
- }
-
- ami_print_info.PD = (struct PrinterData *)ami_print_info.PReq->io_Device;
- ami_print_info.PED = &ami_print_info.PD->pd_SegmentData->ps_PED;
-
- ami_print_info.ps = print_make_settings(PRINT_DEFAULT, nsurl_access(hlcache_handle_get_url(c)), ami_layout_table);
- ami_print_info.ps->page_width = ami_print_info.PED->ped_MaxXDots;
- ami_print_info.ps->page_height = ami_print_info.PED->ped_MaxYDots;
- ami_print_info.ps->scale = scale;
-
- if(!print_set_up(c, &amiprinter, ami_print_info.ps, &height))
- {
- amiga_warn_user("PrintError","print_set_up() returned false");
- ami_print_close_device();
- return;
- }
-
- height *= ami_print_info.ps->scale;
- ami_print_info.pages = height / ami_print_info.ps->page_height;
- ami_print_info.c = c;
-
- ami_print_progress();
-
- while(ami_print_cont()); /* remove while() for async printing */
-}
-
-bool ami_print_cont(void)
-{
- bool ret = false;
-
- if(ami_print_info.page <= ami_print_info.pages)
- {
- glob = ami_print_info.gg;
- print_draw_next_page(&amiprinter, ami_print_info.ps);
- ami_print_dump();
- glob = &browserglob;
- ret = true;
- }
- else
- {
- print_cleanup(ami_print_info.c, &amiprinter, ami_print_info.ps);
- ret = false;
- }
-
- return ret;
-}
-
-struct MsgPort *ami_print_init(void)
-{
- ami_print_info.msgport = AllocSysObjectTags(ASOT_PORT,
- ASO_NoTrack,FALSE,
- TAG_DONE);
-
- return ami_print_info.msgport;
-}
-
-void ami_print_free(void)
-{
- FreeSysObject(ASOT_PORT, ami_print_info.msgport);
- ami_print_info.msgport = NULL;
-}
-
-struct MsgPort *ami_print_get_msgport(void)
-{
- return ami_print_info.msgport;
-}
-
-bool ami_print_begin(struct print_settings *ps)
-{
- ami_print_info.gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
- if(!ami_print_info.gg) return false;
-
- ami_init_layers(ami_print_info.gg,
- ami_print_info.PED->ped_MaxXDots,
- ami_print_info.PED->ped_MaxYDots,
- true);
-
- ami_print_info.page = 0;
-
- return true;
-}
-
-bool ami_print_next_page(void)
-{
- ami_print_info.page++;
-
- RefreshSetGadgetAttrs((struct Gadget *)ami_print_info.gadgets[GID_STATUS],
- ami_print_info.win, NULL,
- FUELGAUGE_Level, ami_print_info.page,
- TAG_DONE);
- return true;
-}
-
-void ami_print_end(void)
-{
- ami_free_layers(ami_print_info.gg);
- FreeVec(ami_print_info.gg);
- DisposeObject(ami_print_info.objects[OID_MAIN]);
- glob = &browserglob;
-
- ami_print_close_device();
- ami_print_free();
-}
-
-void ami_print_close_device(void)
-{
- CloseDevice((struct IORequest *)ami_print_info.PReq);
- FreeSysObject(ASOT_IOREQUEST,ami_print_info.PReq);
-}
-
-bool ami_print_dump(void)
-{
- ami_print_info.PReq->io_Command = PRD_DUMPRPORT;
- ami_print_info.PReq->io_Flags = 0;
- ami_print_info.PReq->io_Error = 0;
- ami_print_info.PReq->io_RastPort = ami_print_info.gg->rp;
- ami_print_info.PReq->io_ColorMap = NULL;
- ami_print_info.PReq->io_Modes = 0;
- ami_print_info.PReq->io_SrcX = 0;
- ami_print_info.PReq->io_SrcY = 0;
- ami_print_info.PReq->io_SrcWidth = ami_print_info.PED->ped_MaxXDots;
- ami_print_info.PReq->io_SrcHeight = ami_print_info.PED->ped_MaxYDots;
- ami_print_info.PReq->io_DestCols = ami_print_info.PED->ped_MaxXDots;
- ami_print_info.PReq->io_DestRows = ami_print_info.PED->ped_MaxYDots;
- ami_print_info.PReq->io_Special = 0;
-
- DoIO((struct IORequest *)ami_print_info.PReq); /* SendIO for async printing */
-
- return true;
-}
-
-void ami_print_progress(void)
-{
- ami_print_info.objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, messages_get("Printing"),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, FALSE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- //WINDOW_SharedPort,sport,
- WINDOW_UserData, &ami_print_info,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_LockHeight,TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, ami_print_info.gadgets[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, ami_print_info.gadgets[GID_STATUS] = FuelGaugeObj,
- GA_ID,GID_STATUS,
- FUELGAUGE_Min,0,
- FUELGAUGE_Max,ami_print_info.pages,
- FUELGAUGE_Level,0,
- FUELGAUGE_Ticks,11,
- FUELGAUGE_ShortTicks,TRUE,
- FUELGAUGE_Percent,TRUE,
- FUELGAUGE_Justification,FGJ_CENTER,
- FuelGaugeEnd,
- CHILD_NominalSize,TRUE,
- CHILD_WeightedHeight,0,
-/*
- LAYOUT_AddChild, ami_print_info.gadgets[GID_CANCEL] = ButtonObj,
- GA_ID,GID_CANCEL,
- GA_Disabled,TRUE,
- GA_RelVerify,TRUE,
- GA_Text,messages_get("Abort"),
- GA_TabCycle,TRUE,
- ButtonEnd,
-*/
- EndGroup,
- EndWindow;
-
- ami_print_info.win = (struct Window *)RA_OpenWindow(ami_print_info.objects[OID_MAIN]);
-}
-
diff --git a/amiga/print.h b/amiga/print.h
deleted file mode 100755
index bdd409b50..000000000
--- a/amiga/print.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_PRINT_H
-#define AMIGA_PRINT_H
-#include <proto/exec.h>
-
-struct content;
-
-struct ami_print_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[OID_LAST];
- Object *gadgets[GID_LAST];
- struct hlcache_handle *c;
-};
-
-void ami_print(struct hlcache_handle *c, int copies);
-void ami_print_ui(struct hlcache_handle *c);
-BOOL ami_print_event(struct ami_print_window *pw);
-bool ami_print_cont(void);
-struct MsgPort *ami_print_init(void);
-void ami_print_free(void);
-struct MsgPort *ami_print_get_msgport(void);
-#endif
diff --git a/amiga/resources/AdBlock.css b/amiga/resources/AdBlock.css
deleted file mode 120000
index e3811f62b..000000000
--- a/amiga/resources/AdBlock.css
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/AdBlock,f79 \ No newline at end of file
diff --git a/amiga/resources/LangNames b/amiga/resources/LangNames
deleted file mode 100644
index 6dc145bfc..000000000
--- a/amiga/resources/LangNames
+++ /dev/null
@@ -1,74 +0,0 @@
-# LangNames file for NetSurf AmigaOS
-#
-# Maps AmigaOS locale.library language names to the two character
-# ISO-639 codes, enabling localised text strings files shareable
-# with the RISC OS version of NetSurf, without the hassle of
-# renaming directories, and to specify accept-language encoding
-# with no additional configuration.
-#
-# Format is <Locale language name>:<language tag>
-#
-# NetSurf will use the full AmigaOS language name if it is not
-# present in this file.
-#
-albanian:sq
-belarusian:be
-bosnian:bs
-bulgarian:bg
-catalan:ca
-chinese:zh
-croatian:hr
-czech:cs
-danish:da
-dutch:nl
-english:en
-english-british:en-GB
-esperanto:eo
-estonian:et
-faroese:fo
-finnish:fi
-french:fr
-galician:gl
-german:de
-greek:el
-hebrew:he
-hungarian:hu
-icelandic:is
-irish:ga
-italian:it
-japanese:ja
-korean:ko
-latvian:lv
-lithuanian:lt
-macedonian:mk
-malay-indonesian:id
-malay-malaysian:ms
-maltese:mt
-norwegian:nb
-norwegian-nynorsk:nn
-polish:pl
-portuguese:pt
-portuguese-brazil:pr-BR
-romanian:ro
-russian:ru
-serbian:sr
-slovak:sk
-slovenian:sl
-spanish:es
-swedish:sv
-thai:th
-turkish:tr
-ukrainian:uk
-welsh:cy
-
-# Native language names for AmigaOS 3 compatibility
-dansk:da
-deutsch:de
-español:es
-français:fr
-italiano:it
-nederlands:nl
-norsk:nb
-português:pt
-svenska:sv
-
diff --git a/amiga/resources/Pointers/Blank b/amiga/resources/Pointers/Blank
deleted file mode 100755
index 419fb503a..000000000
--- a/amiga/resources/Pointers/Blank
+++ /dev/null
@@ -1,33 +0,0 @@
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00 00 \ No newline at end of file
diff --git a/amiga/resources/Pointers/Blank.info b/amiga/resources/Pointers/Blank.info
deleted file mode 100644
index 5ce812b26..000000000
--- a/amiga/resources/Pointers/Blank.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Caret b/amiga/resources/Pointers/Caret
deleted file mode 100755
index 3b1604e85..000000000
--- a/amiga/resources/Pointers/Caret
+++ /dev/null
@@ -1,33 +0,0 @@
-22022000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-00200000000000000000000000000000
-22022000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-02 08 \ No newline at end of file
diff --git a/amiga/resources/Pointers/Caret.info b/amiga/resources/Pointers/Caret.info
deleted file mode 100644
index 11d9c5fc9..000000000
--- a/amiga/resources/Pointers/Caret.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Cross.info b/amiga/resources/Pointers/Cross.info
deleted file mode 100644
index 7aa433139..000000000
--- a/amiga/resources/Pointers/Cross.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Default b/amiga/resources/Pointers/Default
deleted file mode 100755
index 8f88f3d33..000000000
--- a/amiga/resources/Pointers/Default
+++ /dev/null
@@ -1,33 +0,0 @@
-13000000000000000000000000000000
-21330000000000000000000000000000
-02113300000000000000000000000000
-02111133000000000000000000000000
-00211111330000000000000000000000
-00211111110000000000000000000000
-00021113000000000000000000000000
-00021121300000000000000000000000
-00002102130000000000000000000000
-00002100213000000000000000000000
-00000000021000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00 00 \ No newline at end of file
diff --git a/amiga/resources/Pointers/Default.info b/amiga/resources/Pointers/Default.info
deleted file mode 100644
index dc8c2b0ed..000000000
--- a/amiga/resources/Pointers/Default.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Down.info b/amiga/resources/Pointers/Down.info
deleted file mode 100644
index e4667bca1..000000000
--- a/amiga/resources/Pointers/Down.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Drag.info b/amiga/resources/Pointers/Drag.info
deleted file mode 100644
index 820d75373..000000000
--- a/amiga/resources/Pointers/Drag.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Help.info b/amiga/resources/Pointers/Help.info
deleted file mode 100644
index ca5947105..000000000
--- a/amiga/resources/Pointers/Help.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Left.info b/amiga/resources/Pointers/Left.info
deleted file mode 100644
index 1a3b4e835..000000000
--- a/amiga/resources/Pointers/Left.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/LeftDown.info b/amiga/resources/Pointers/LeftDown.info
deleted file mode 100644
index e8f39cb24..000000000
--- a/amiga/resources/Pointers/LeftDown.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/LeftUp.info b/amiga/resources/Pointers/LeftUp.info
deleted file mode 100644
index be80018f3..000000000
--- a/amiga/resources/Pointers/LeftUp.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Menu b/amiga/resources/Pointers/Menu
deleted file mode 100755
index 29442146c..000000000
--- a/amiga/resources/Pointers/Menu
+++ /dev/null
@@ -1,33 +0,0 @@
-13000000000000000000000000000000
-21330000000000000000000000000000
-02113300000000000000000000000000
-02111133000000000000000000000000
-00211111330000000000000000000000
-00211111110000000000000000000000
-00021113000000000000000000000000
-00021121300033333333331000000000
-00002102130031111111112000000000
-00002100213031111111112000000000
-00000000021031111111112000000000
-00000000000033333333332000000000
-00000000000033333333332000000000
-00000000000033333333332000000000
-00000000000033333333332000000000
-00000000000033333333332000000000
-00000000000033333333332000000000
-00000000000012222222222000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00 00 \ No newline at end of file
diff --git a/amiga/resources/Pointers/Menu.info b/amiga/resources/Pointers/Menu.info
deleted file mode 100644
index 2a1143f11..000000000
--- a/amiga/resources/Pointers/Menu.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Move b/amiga/resources/Pointers/Move
deleted file mode 100755
index 16d88e869..000000000
--- a/amiga/resources/Pointers/Move
+++ /dev/null
@@ -1,33 +0,0 @@
-00000000002200000000000000000000
-00000000023320000000000000000000
-00000002223322200000000000000000
-00000023323323320000000000000000
-00000023323323320000000000000000
-00000023323323322200000000000000
-00000023323323323320000000000000
-00000023323323323320000000000000
-02200023323323323320000000000000
-23320023323323323320000000000000
-23332023323323323320000000000000
-02333233323323323320000000000000
-02333333323323323320000000000000
-00233333333333323320000000000000
-00233333333333333320000000000000
-00023333333333333320000000000000
-00023333333333333320000000000000
-00002333333333333320000000000000
-00002333333333333320000000000000
-00000233333333333200000000000000
-00000022333333332000000000000000
-00000000222222220000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-11 15 \ No newline at end of file
diff --git a/amiga/resources/Pointers/Move.info b/amiga/resources/Pointers/Move.info
deleted file mode 100644
index 606f5d283..000000000
--- a/amiga/resources/Pointers/Move.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/NoDrop.info b/amiga/resources/Pointers/NoDrop.info
deleted file mode 100644
index 22e77a4be..000000000
--- a/amiga/resources/Pointers/NoDrop.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/NotAllowed.info b/amiga/resources/Pointers/NotAllowed.info
deleted file mode 100644
index 01545bbba..000000000
--- a/amiga/resources/Pointers/NotAllowed.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Point b/amiga/resources/Pointers/Point
deleted file mode 100755
index 25e92be77..000000000
--- a/amiga/resources/Pointers/Point
+++ /dev/null
@@ -1,33 +0,0 @@
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000002200000000000000000000000
-00000023320000000000000000000000
-00000023320000000000000000000000
-00000023320000000000000000000000
-00000023320000000000000000000000
-00000023322200000000000000000000
-02200023323322200000000000000000
-23320023323323320000000000000000
-23332023323323322200000000000000
-02333233323323323320000000000000
-02333333323323323320000000000000
-00233333333333323320000000000000
-00233333333333333320000000000000
-00023333333333333320000000000000
-00023333333333333320000000000000
-00002333333333333320000000000000
-00002333333333333320000000000000
-00000233333333333200000000000000
-00000022333333332000000000000000
-00000000222222220000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-07 02 \ No newline at end of file
diff --git a/amiga/resources/Pointers/Point.info b/amiga/resources/Pointers/Point.info
deleted file mode 100644
index 685e4f5e0..000000000
--- a/amiga/resources/Pointers/Point.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Progress.info b/amiga/resources/Pointers/Progress.info
deleted file mode 100644
index c47d52e99..000000000
--- a/amiga/resources/Pointers/Progress.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Right.info b/amiga/resources/Pointers/Right.info
deleted file mode 100644
index 7080c4e77..000000000
--- a/amiga/resources/Pointers/Right.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/RightDown.info b/amiga/resources/Pointers/RightDown.info
deleted file mode 100644
index 0f5c181cf..000000000
--- a/amiga/resources/Pointers/RightDown.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/RightUp.info b/amiga/resources/Pointers/RightUp.info
deleted file mode 100644
index 140ef15c5..000000000
--- a/amiga/resources/Pointers/RightUp.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Up.info b/amiga/resources/Pointers/Up.info
deleted file mode 100644
index f4b44421f..000000000
--- a/amiga/resources/Pointers/Up.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Pointers/Wait b/amiga/resources/Pointers/Wait
deleted file mode 100755
index 6d9421279..000000000
--- a/amiga/resources/Pointers/Wait
+++ /dev/null
@@ -1,33 +0,0 @@
-00002222222200000000000000000000
-00223333332220000000000000000000
-02111133333322000000000000000000
-23331333333322000000000000000000
-23313333333332200000000000000000
-02111131111332200000000000000000
-23333333313322000000000000000000
-02333333133220000000000000000000
-02333331111220000000000000000000
-00233223332200000000000000000000
-00022322222000000000000000000000
-00023332200000000000000000000000
-00222332200000000000000000000000
-02332222000000000000000000000000
-02332200000000000000000000000000
-00222000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-00000000000000000000000000000000
-06 07 \ No newline at end of file
diff --git a/amiga/resources/Pointers/Wait.info b/amiga/resources/Pointers/Wait.info
deleted file mode 100644
index 88aa27a03..000000000
--- a/amiga/resources/Pointers/Wait.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Resource.map b/amiga/resources/Resource.map
deleted file mode 100644
index dbe02a4bc..000000000
--- a/amiga/resources/Resource.map
+++ /dev/null
@@ -1,4 +0,0 @@
-# Resource.map
-favicon.ico:favicon.png
-default.ico:icons/search.png
-
diff --git a/amiga/resources/SearchEngines b/amiga/resources/SearchEngines
deleted file mode 100644
index f1b705a0a..000000000
--- a/amiga/resources/SearchEngines
+++ /dev/null
@@ -1,22 +0,0 @@
-Google|www.google.com|http://www.google.com/search?q=%s|http://www.google.com/favicon.ico|
-Yahoo|search.yahoo.com|http://search.yahoo.com/search?p=%s|http://www.yahoo.com/favicon.ico|
-Bing|www.bing.com|http://www.bing.com/search?q=%s|http://www.bing.com/favicon.ico|
-Business.com|www.business.com|http://www.business.com/search/rslt_default.asp?query=%s|http://www.business.com/favicon.ico|
-Omgili|www.omgili.com|http://www.omgili.com/AAAAA/%s.html|http://www.omgili.com/favicon.ico|
-BBC News|search.bbc.co.uk|http://search.bbc.co.uk/search?q=%s&tab=ns|http://news.bbc.co.uk/favicon.ico|
-Creative Commons|creativecommons.org|http://creativecommons.org/?s=%s|http://creativecommons.org/favicon.ico|
-Ask.com|www.ask.com|http://www.ask.com/web?q=%s|http://www.ask.com/favicon.ico|
-Answers.com|www.answers.com|http://www.answers.com/%s|http://www.answers.com/favicon.ico|
-Dictionary.com|dictionary.reference.com|http://dictionary.reference.com/browse/%s?jss=0|http://dictionary.reference.com/favicon.ico|
-Youtube|www.youtube.com|http://www.youtube.com/results?search_query=%s|http://www.youtube.com/favicon.ico|
-AeroMp3|www.aeromp3.com|http://www.aeromp3.com/search?q=%s|http://www.aeromp3.com/favicon.ico|
-AOL|search.aol.com|http://search.aol.com/aol/search?query=%s|http://www.aol.com/favicon.ico|
-Baidu|www.baidu.com|http://www.baidu.com/s?wd=%s|http://www.baidu.com/favicon.ico|
-Amazon|www.amazon.com|http://www.amazon.com/s/ref=nb_ss_gw?field-keywords=%s|http://www.amazon.com/favicon.ico|
-Ebay|shop.ebay.com|http://shop.ebay.com/items/%s|http://www.ebay.com/favicon.ico|
-IMDB|www.imdb.com|http://www.imdb.com/find?q=%s|http://www.imdb.com/favicon.ico|
-ESPN|search.espn.go.com|http://search.espn.go.com/%s/|http://www.espn.go.com/favicon.ico|
-Wikipedia|en.wikipedia.org|http://en.wikipedia.org/w/index.php?title=Special%%3ASearch&search=%s|http://en.wikipedia.org/favicon.ico|
-Aminet|www.aminet.net|http://aminet.net/search?query=%s|http://aminet.net/favicon.ico|
-OS4Depot|www.os4depot.net|http://www.os4depot.net/index.php?function=search&tool=simple&f_fields=%s|http://www.os4depot.net/favicon.ico|
-DuckDuckGo|www.duckduckgo.com|http://www.duckduckgo.com/?q=%s|http://www.duckduckgo.com/favicon.ico|
diff --git a/amiga/resources/Themes/AISS/NetSurf.info b/amiga/resources/Themes/AISS/NetSurf.info
deleted file mode 100644
index 70275756e..000000000
--- a/amiga/resources/Themes/AISS/NetSurf.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/AISS/Resource.map b/amiga/resources/Themes/AISS/Resource.map
deleted file mode 100644
index 4fe374aa2..000000000
--- a/amiga/resources/Themes/AISS/Resource.map
+++ /dev/null
@@ -1,8 +0,0 @@
-# Resource.map
-favicon.ico:TBimages:list_file
-default.ico:TBimages:list_search
-icons/arrow-l.png:TBimages:list_mailreplied
-icons/search.png:TBimages:list_search
-icons/directory.png:TBimages:list_drawer
-icons/directory2.png:TBimages:list_drawer_s
-icons/content.png:TBimages:list_file
diff --git a/amiga/resources/Themes/AISS/Theme b/amiga/resources/Themes/AISS/Theme
deleted file mode 100755
index 8c5af103c..000000000
--- a/amiga/resources/Themes/AISS/Theme
+++ /dev/null
@@ -1,75 +0,0 @@
-# AISS theme. Requires:
-# AISS to be installed (see http://www.masonicons.de)
-# defpointers package from OS4Depot (http://www.os4depot.net)
-# Throbber animation by Martin Merz
-#
-theme_nav_west:*TBImages:nav_west
-theme_nav_west_s:*TBImages:nav_west_s
-theme_nav_west_g:*TBImages:nav_west_g
-theme_nav_east:*TBImages:nav_east
-theme_nav_east_s:*TBImages:nav_east_s
-theme_nav_east_g:*TBImages:nav_east_g
-theme_stop:*TBImages:stop
-theme_stop_s:*TBImages:stop_s
-theme_stop_g:*TBImages:stop_g
-theme_reload:*TBImages:reload
-theme_reload_s:*TBImages:reload_s
-theme_reload_g:*TBImages:reload_g
-theme_home:*TBImages:home
-theme_home_s:*TBImages:home_s
-theme_home_g:*TBImages:home_g
-theme_closetab:*TBImages:list_cancel
-theme_closetab_s:*TBImages:list_cancel
-theme_closetab_g:*TBImages:list_cancel
-theme_addtab:*TBImages:list_add
-theme_addtab_s:*TBImages:list_add
-theme_addtab_g:*TBImages:list_add
-theme_throbber:Throbber
-theme_throbber_frames:13
-theme_throbber_delay:100
-theme_tab_loading:*TBImages:list_download
-theme_search:*TBImages:list_search
-theme_fave:*TBImages:list_favouriteadd
-theme_unfave:*TBImages:list_favourite
-ptr_default:*PROGDIR:Resources/Pointers/Default
-ptr_point:*PROGDIR:Resources/Pointers/Point
-ptr_caret:*PROGDIR:Resources/Pointers/Caret
-ptr_menu:*PROGDIR:Resources/Pointers/Menu
-ptr_up:*PROGDIR:Resources/Pointers/Up
-ptr_down:*PROGDIR:Resources/Pointers/Down
-ptr_left:*PROGDIR:Resources/Pointers/Left
-ptr_right:*PROGDIR:Resources/Pointers/Right
-ptr_rightup:*PROGDIR:Resources/Pointers/RightUp
-ptr_leftdown:*PROGDIR:Resources/Pointers/LeftDown
-ptr_leftup:*PROGDIR:Resources/Pointers/LeftUp
-ptr_rightdown:*PROGDIR:Resources/Pointers/RightDown
-ptr_cross:*PROGDIR:Resources/Pointers/Cross
-ptr_move:*PROGDIR:Resources/Pointers/Move
-ptr_wait:*PROGDIR:Resources/Pointers/Wait
-ptr_help:*PROGDIR:Resources/Pointers/Help
-ptr_nodrop:*PROGDIR:Resources/Pointers/NoDrop
-ptr_notallowed:*PROGDIR:Resources/Pointers/NotAllowed
-ptr_progress:*PROGDIR:Resources/Pointers/Progress
-ptr_blank:*PROGDIR:Resources/Pointers/Blank
-ptr_drag:*PROGDIR:Resources/Pointers/Drag
-ptr32_default:*ENV:Sys/def_pointer
-ptr32_point:*ENV:Sys/def_linkpointer
-ptr32_caret:*ENV:Sys/def_textpointer
-ptr32_menu:*ENV:Sys/def_contextmenupointer
-ptr32_up:*ENV:Sys/def_northresizepointer
-ptr32_down:*ENV:Sys/def_southresizepointer
-ptr32_left:*ENV:Sys/def_westresizepointer
-ptr32_right:*ENV:Sys/def_eastresizepointer
-ptr32_rightup:*ENV:Sys/def_northeastresizepointer
-ptr32_leftdown:*ENV:Sys/def_southwestresizepointer
-ptr32_leftup:*ENV:Sys/def_northwestresizepointer
-ptr32_rightdown:*ENV:Sys/def_southeastresizepointer
-ptr32_cross:*ENV:Sys/def_crosspointer
-ptr32_move:*ENV:Sys/def_handpointer
-ptr32_wait:*ENV:Sys/def_busypointer
-ptr32_help:*ENV:Sys/def_helppointer
-ptr32_nodrop:*ENV:Sys/def_nodroppointer
-ptr32_notallowed:*ENV:Sys/def_notallowedpointer
-ptr32_progress:*ENV:Sys/def_progresspointer
-ptr32_blank:*ENV:Sys/def_nonepointer
-ptr32_drag:*ENV:Sys/def_draganddroppointer
diff --git a/amiga/resources/Themes/AISS/Throbber b/amiga/resources/Themes/AISS/Throbber
deleted file mode 100644
index a8c38d153..000000000
--- a/amiga/resources/Themes/AISS/Throbber
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/NetSurf.info b/amiga/resources/Themes/Default/NetSurf.info
deleted file mode 100644
index 0e6017253..000000000
--- a/amiga/resources/Themes/Default/NetSurf.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/Theme b/amiga/resources/Themes/Default/Theme
deleted file mode 100755
index 141e84f54..000000000
--- a/amiga/resources/Themes/Default/Theme
+++ /dev/null
@@ -1,88 +0,0 @@
-# Theme description file for AmigaOS NetSurf
-#
-# Format is theme_image:filename
-# Where filename is relative to the directory in which this file
-# is stored.
-#
-# If filename is prefixed by an asterisk, it will be treated as
-# a full path to a file (relative to PROGDIR:)
-#
-# Where theme_image is suffixed by _s or _g, these are the selected
-# and ghosted version of the image.
-#
-# The images can be stored in any format which has a picture datatype
-# available.
-#
-# theme_throbber is a film strip of theme_throbber_frames frames
-# The first frame must be the inactive image.
-#
-theme_nav_west:back.png
-theme_nav_west_s:back_h.png
-theme_nav_west_g:back_g.png
-theme_nav_east:forward.png
-theme_nav_east_s:forward_h.png
-theme_nav_east_g:forward_g.png
-theme_stop:stop.png
-theme_stop_s:stop_h.png
-theme_stop_g:stop_g.png
-theme_reload:reload.png
-theme_reload_s:reload_h.png
-theme_reload_g:reload_g.png
-theme_home:home.png
-theme_home_s:home_h.png
-theme_home_g:home_g.png
-theme_closetab:closetab.png
-theme_closetab_s:closetab.png
-theme_closetab_g:closetab_g.png
-theme_addtab:
-theme_addtab_s:
-theme_addtab_g:
-theme_throbber:Throbber
-theme_throbber_frames:9
-theme_throbber_delay:100
-theme_tab_loading:
-theme_search:search.png
-theme_fave:*PROGDIR:Resources/icons/hotlist-add.png
-theme_unfave:*PROGDIR:Resources/icons/hotlist-rmv.png
-ptr_default:*PROGDIR:Resources/Pointers/Default
-ptr_point:*PROGDIR:Resources/Pointers/Point
-ptr_caret:*PROGDIR:Resources/Pointers/Caret
-ptr_menu:*PROGDIR:Resources/Pointers/Menu
-ptr_up:*PROGDIR:Resources/Pointers/Up
-ptr_down:*PROGDIR:Resources/Pointers/Down
-ptr_left:*PROGDIR:Resources/Pointers/Left
-ptr_right:*PROGDIR:Resources/Pointers/Right
-ptr_rightup:*PROGDIR:Resources/Pointers/RightUp
-ptr_leftdown:*PROGDIR:Resources/Pointers/LeftDown
-ptr_leftup:*PROGDIR:Resources/Pointers/LeftUp
-ptr_rightdown:*PROGDIR:Resources/Pointers/RightDown
-ptr_cross:*PROGDIR:Resources/Pointers/Cross
-ptr_move:*PROGDIR:Resources/Pointers/Move
-ptr_wait:*PROGDIR:Resources/Pointers/Wait
-ptr_help:*PROGDIR:Resources/Pointers/Help
-ptr_nodrop:*PROGDIR:Resources/Pointers/NoDrop
-ptr_notallowed:*PROGDIR:Resources/Pointers/NotAllowed
-ptr_progress:*PROGDIR:Resources/Pointers/Progress
-ptr_blank:*PROGDIR:Resources/Pointers/Blank
-ptr_drag:*PROGDIR:Resources/Pointers/Drag
-ptr32_default:*PROGDIR:Resources/Pointers/Default
-ptr32_point:*PROGDIR:Resources/Pointers/Point
-ptr32_caret:*PROGDIR:Resources/Pointers/Caret
-ptr32_menu:*PROGDIR:Resources/Pointers/Menu
-ptr32_up:*PROGDIR:Resources/Pointers/Up
-ptr32_down:*PROGDIR:Resources/Pointers/Down
-ptr32_left:*PROGDIR:Resources/Pointers/Left
-ptr32_right:*PROGDIR:Resources/Pointers/Right
-ptr32_rightup:*PROGDIR:Resources/Pointers/RightUp
-ptr32_leftdown:*PROGDIR:Resources/Pointers/LeftDown
-ptr32_leftup:*PROGDIR:Resources/Pointers/LeftUp
-ptr32_rightdown:*PROGDIR:Resources/Pointers/RightDown
-ptr32_cross:*PROGDIR:Resources/Pointers/Cross
-ptr32_move:*PROGDIR:Resources/Pointers/Move
-ptr32_wait:*PROGDIR:Resources/Pointers/Wait
-ptr32_help:*PROGDIR:Resources/Pointers/Help
-ptr32_nodrop:*PROGDIR:Resources/Pointers/NoDrop
-ptr32_notallowed:*PROGDIR:Resources/Pointers/NotAllowed
-ptr32_progress:*PROGDIR:Resources/Pointers/Progress
-ptr32_blank:*PROGDIR:Resources/Pointers/Blank
-ptr32_drag:*PROGDIR:Resources/Pointers/Drag
diff --git a/amiga/resources/Themes/Default/Throbber b/amiga/resources/Themes/Default/Throbber
deleted file mode 100644
index 7dd714248..000000000
--- a/amiga/resources/Themes/Default/Throbber
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/back.png b/amiga/resources/Themes/Default/back.png
deleted file mode 100755
index f219fd807..000000000
--- a/amiga/resources/Themes/Default/back.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/back_g.png b/amiga/resources/Themes/Default/back_g.png
deleted file mode 100644
index 0796bbbbf..000000000
--- a/amiga/resources/Themes/Default/back_g.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/back_h.png b/amiga/resources/Themes/Default/back_h.png
deleted file mode 100644
index 35e31386a..000000000
--- a/amiga/resources/Themes/Default/back_h.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/closetab.png b/amiga/resources/Themes/Default/closetab.png
deleted file mode 100644
index 21d97f11d..000000000
--- a/amiga/resources/Themes/Default/closetab.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/closetab_g.png b/amiga/resources/Themes/Default/closetab_g.png
deleted file mode 100644
index a50fa0f45..000000000
--- a/amiga/resources/Themes/Default/closetab_g.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/forward.png b/amiga/resources/Themes/Default/forward.png
deleted file mode 100755
index f20c0cdf5..000000000
--- a/amiga/resources/Themes/Default/forward.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/forward_g.png b/amiga/resources/Themes/Default/forward_g.png
deleted file mode 100644
index d847543f3..000000000
--- a/amiga/resources/Themes/Default/forward_g.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/forward_h.png b/amiga/resources/Themes/Default/forward_h.png
deleted file mode 100644
index 90c0fe2c7..000000000
--- a/amiga/resources/Themes/Default/forward_h.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/home.png b/amiga/resources/Themes/Default/home.png
deleted file mode 100755
index 604796025..000000000
--- a/amiga/resources/Themes/Default/home.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/home_g.png b/amiga/resources/Themes/Default/home_g.png
deleted file mode 100644
index a644b0b03..000000000
--- a/amiga/resources/Themes/Default/home_g.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/home_h.png b/amiga/resources/Themes/Default/home_h.png
deleted file mode 100644
index 2d6be5f34..000000000
--- a/amiga/resources/Themes/Default/home_h.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/reload.png b/amiga/resources/Themes/Default/reload.png
deleted file mode 100755
index a81f650b0..000000000
--- a/amiga/resources/Themes/Default/reload.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/reload_g.png b/amiga/resources/Themes/Default/reload_g.png
deleted file mode 100644
index 5251f206c..000000000
--- a/amiga/resources/Themes/Default/reload_g.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/reload_h.png b/amiga/resources/Themes/Default/reload_h.png
deleted file mode 100644
index 76e554e49..000000000
--- a/amiga/resources/Themes/Default/reload_h.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/search.png b/amiga/resources/Themes/Default/search.png
deleted file mode 100644
index a59c12b8f..000000000
--- a/amiga/resources/Themes/Default/search.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/stop.png b/amiga/resources/Themes/Default/stop.png
deleted file mode 100755
index df64c5747..000000000
--- a/amiga/resources/Themes/Default/stop.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/stop_g.png b/amiga/resources/Themes/Default/stop_g.png
deleted file mode 100644
index a2efa9e3d..000000000
--- a/amiga/resources/Themes/Default/stop_g.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/Themes/Default/stop_h.png b/amiga/resources/Themes/Default/stop_h.png
deleted file mode 100644
index 3c3377cdf..000000000
--- a/amiga/resources/Themes/Default/stop_h.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/blankspace.png b/amiga/resources/blankspace.png
deleted file mode 100644
index 1f1e672d0..000000000
--- a/amiga/resources/blankspace.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/ca-bundle b/amiga/resources/ca-bundle
deleted file mode 120000
index ad2dd6b55..000000000
--- a/amiga/resources/ca-bundle
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/ca-bundle \ No newline at end of file
diff --git a/amiga/resources/de b/amiga/resources/de
deleted file mode 120000
index 38128816c..000000000
--- a/amiga/resources/de
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/de \ No newline at end of file
diff --git a/amiga/resources/default.css b/amiga/resources/default.css
deleted file mode 100644
index 7101e191f..000000000
--- a/amiga/resources/default.css
+++ /dev/null
@@ -1,7 +0,0 @@
-@import "nsdefault.css";
-
-/* Make NetSurf look a little more like the default OS4 theme */
-
-input { border: medium inset #ddd; }
-textarea { border: medium inset #ddd; }
-select { background-color: #ddd; border: medium groove #ddd; }
diff --git a/amiga/resources/default.css.info b/amiga/resources/default.css.info
deleted file mode 100644
index 0f7ab4b66..000000000
--- a/amiga/resources/default.css.info
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/en b/amiga/resources/en
deleted file mode 120000
index d1dfaa9d2..000000000
--- a/amiga/resources/en
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/en \ No newline at end of file
diff --git a/amiga/resources/favicon.png b/amiga/resources/favicon.png
deleted file mode 100644
index 53234c38c..000000000
--- a/amiga/resources/favicon.png
+++ /dev/null
Binary files differ
diff --git a/amiga/resources/fr b/amiga/resources/fr
deleted file mode 120000
index df1cbe3a1..000000000
--- a/amiga/resources/fr
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/fr \ No newline at end of file
diff --git a/amiga/resources/it b/amiga/resources/it
deleted file mode 120000
index 6177e9176..000000000
--- a/amiga/resources/it
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/it \ No newline at end of file
diff --git a/amiga/resources/mimetypes b/amiga/resources/mimetypes
deleted file mode 100644
index 822e12b82..000000000
--- a/amiga/resources/mimetypes
+++ /dev/null
@@ -1,112 +0,0 @@
-; This file contains a list of MIME types that can be handled by NetSurf,
-; mapping them to DataType and DefIcons format names.
-;
-; It is parsed by ReadArgs with the following template:
-; MIMETYPE/A,DT=DATATYPE/K,TYPE=DEFICON/K,CMD=PLUGINCMD/K
-;
-; Note: DataType name is case sensitive and is the name MultiView
-; displays in the "About" window, *not* the filename of the DataType
-; descriptor.
-;
-; The first entry for a type is the one which will be used for reverse
-; lookups (ie. translating from DataTypes to MIME)
-;
-; Any DataTypes installed that are not present in this list will be
-; assigned a MIME type constructed from the DataTypes superclass
-; and a lowercase version of the full format name (eg. ILBM becomes
-; image/ilbm)
-;
-; Please DO NOT edit this file, any changes will be overwritten on
-; reinstall/upgrade. Instead create a file called mimetypes.user
-; with any additions, and place it in your user data directory.
-
-;
-; Image types
-;
-
-; BMP
-image/bmp DT=BMP TYPE=bmp
-image/ms-bmp DT=BMP TYPE=bmp
-image/x-bitmap DT=BMP TYPE=bmp
-image/x-bmp DT=BMP TYPE=bmp
-image/x-ms-bmp DT=BMP TYPE=bmp
-image/x-win-bitmap DT=BMP TYPE=bmp
-image/x-windows-bmp DT=BMP TYPE=bmp
-image/x-xbitmap DT=BMP TYPE=bmp
-application/bmp DT=BMP TYPE=bmp
-application/preview DT=BMP TYPE=bmp
-application/x-bmp DT=BMP TYPE=bmp
-application/x-win-bitmap DT=BMP TYPE=bmp
-
-; GIF
-; Expect problems with GIF anims if GIFANIM datatype installed
-image/gif DT=GIF TYPE=gif
-;image/gif DT=GIFANIM TYPE=gif
-
-; ICO
-image/ico DT="Windows ICO" TYPE=ico
-image/vnd.microsoft.icon DT="Windows ICO" TYPE=ico
-image/x-icon DT="Windows ICO" TYPE=ico
-application/ico DT="Windows ICO" TYPE=ico
-application/x-ico DT="Windows ICO" TYPE=ico
-
-; .info
-image/x-amiga-icon DT="AmigaOS Icon"
-
-; JNG
-image/jng DT=JNG TYPE=jng
-image/x-jng DT=JNG TYPE=jng
-
-; JPEG
-image/jpeg DT=JPEG TYPE=jpeg
-image/jpg DT=JPEG TYPE=jpeg
-image/pjpeg DT=JPEG TYPE=jpeg
-
-; JPEG2000
-image/jp2 DT=JP2 TYPE=jp2
-image/jpeg2000 DT=JP2 TYPE=jp2
-
-; MNG
-image/mng DT=MNG TYPE=mng
-image/x-mng DT=MNG TYPE=mng
-video/mng DT=MNG TYPE=mng
-video/x-mng DT=MNG TYPE=mng
-
-; PNG
-image/png DT=PNG TYPE=png
-
-; RISC OS Sprite
-image/x-riscos-sprite DT=Sprite TYPE=rosprite
-
-; SVG
-image/svg DT=SVG TYPE=svg
-image/svg+xml DT=SVG TYPE=svg
-
-; WebP
-image/webp DT=WebP TYPE=webp
-
-
-;
-; Audio types
-;
-
-; RIFF WAVE
-audio/wave DT=WAVE TYPE=wav
-audio/x-wav DT=WAVE TYPE=wav
-
-; MP3
-audio/mpeg DT="MPEG Audio" TYPE=mp3 CMD=APPDIR:MPlayer
-
-
-;
-; Experimental
-;
-
-; SWF
-; application/x-shockwave-flash CMD=gnash:aos4-gnash
-
-; Video
-; video/mpeg CMD=APPDIR:MPlayer
-; video/quicktime CMD=APPDIR:MPlayer
-; video/x-msvideo CMD=APPDIR:MPlayer
-; video/x-ms-wmv CMD=APPDIR:MPlayer
diff --git a/amiga/resources/nl b/amiga/resources/nl
deleted file mode 120000
index a07bd0469..000000000
--- a/amiga/resources/nl
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/nl \ No newline at end of file
diff --git a/amiga/resources/nsdefault.css b/amiga/resources/nsdefault.css
deleted file mode 120000
index 6d2d4da5b..000000000
--- a/amiga/resources/nsdefault.css
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/CSS,f79 \ No newline at end of file
diff --git a/amiga/resources/quirks.css b/amiga/resources/quirks.css
deleted file mode 120000
index d9fb80334..000000000
--- a/amiga/resources/quirks.css
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file
diff --git a/amiga/resources/splash.png b/amiga/resources/splash.png
deleted file mode 100644
index 569cb08fa..000000000
--- a/amiga/resources/splash.png
+++ /dev/null
Binary files differ
diff --git a/amiga/rtg.c b/amiga/rtg.c
deleted file mode 100644
index 5e1cac290..000000000
--- a/amiga/rtg.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Abstract RTG functions for newer/older/non-P96 systems
- */
-
-#include "amiga/rtg.h"
-
-struct BitMap *ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth,
- ULONG flags, struct BitMap *friend, RGBFTYPE format)
-{
- if(P96Base == NULL) {
-#ifndef __amigaos4__
- if(depth > 8) depth = 8;
-#endif
- return AllocBitMap(width, height, depth, flags, friend);
- } else {
- return p96AllocBitMap(width, height, depth, flags, friend, format);
- }
-}
-
-void ami_rtg_freebitmap(struct BitMap *bm)
-{
- if(P96Base == NULL) {
- return FreeBitMap(bm);
- } else {
- return p96FreeBitMap(bm);
- }
-}
-
-void ami_rtg_writepixelarray(UBYTE *pixdata, struct BitMap *bm,
- ULONG width, ULONG height, ULONG bpr, ULONG format)
-{
- struct RastPort trp;
-
- InitRastPort(&trp);
- trp.BitMap = bm;
-
- /* This requires P96 or gfx.lib v54 currently */
- if(P96Base == NULL) {
-#ifdef __amigaos4__
- if(GfxBase->LibNode.lib_Version >= 54) {
- WritePixelArray(pixdata, 0, 0, bpr, PIXF_R8G8B8A8, &trp, 0, 0, width, height);
- }
-#endif
- } else {
- struct RenderInfo ri;
-
- ri.Memory = pixdata;
- ri.BytesPerRow = bpr;
- ri.RGBFormat = format;
-
- p96WritePixelArray((struct RenderInfo *)&ri, 0, 0, &trp, 0, 0, width, height);
- }
-}
-
diff --git a/amiga/rtg.h b/amiga/rtg.h
deleted file mode 100644
index 72f5bf38b..000000000
--- a/amiga/rtg.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Abstract RTG functions for newer/older/non-P96 systems
- */
-
-#ifndef AMIGA_RTG_H
-#define AMIGA_RTG_H 1
-#include <proto/graphics.h>
-#include <proto/Picasso96API.h>
-
-/* Wrappers for Alloc/FreeBitMap */
-struct BitMap *ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth,
- ULONG flags, struct BitMap *friend, RGBFTYPE format);
-void ami_rtg_freebitmap(struct BitMap *bm);
-
-/* WritePixelArray wrapper. This isn't entirely (at all) equivalent to p96WPA */
-void ami_rtg_writepixelarray(UBYTE *pixdata, struct BitMap *bm,
- ULONG width, ULONG height, ULONG bpr, ULONG format);
-#endif
-
diff --git a/amiga/save_pdf.c b/amiga/save_pdf.c
deleted file mode 100644
index b70fc5716..000000000
--- a/amiga/save_pdf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2008 John Tytgat <joty@netsurf-browser.org>
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Export a content as a PDF file (implementation).
- */
-
-#include "utils/config.h"
-#ifdef WITH_PDF_EXPORT
-
-#include <stdbool.h>
-#include "content/content.h"
-#include "desktop/print.h"
-#include "desktop/save_pdf/font_haru.h"
-#include "desktop/save_pdf/pdf_plotters.h"
-#include "amiga/save_pdf.h"
-#include "utils/log.h"
-#include "utils/config.h"
-
-/**
- * Export a content as a PDF file.
- *
- * \param c content to export
- * \param path path to save PDF as
- * \return true on success, false on error and error reported
- */
-bool save_as_pdf(struct hlcache_handle *c, const char *path)
-{
- struct print_settings *psettings;
-
- if(!ami_download_check_overwrite(path, NULL)) return false;
-
- psettings = print_make_settings(PRINT_OPTIONS, path, &haru_nsfont);
- if (psettings == NULL)
- return false;
-
- if (!print_basic_run(c, &pdf_printer, psettings))
- return false;
-
- return true;
-}
-
-#endif
diff --git a/amiga/save_pdf.h b/amiga/save_pdf.h
deleted file mode 100644
index 4a5a7edde..000000000
--- a/amiga/save_pdf.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2008 John Tytgat <joty@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _NETSURF_AMIGA_SAVE_PDF_H_
-#define _NETSURF_AMIGA_SAVE_PDF_H_
-
-#include "utils/config.h"
-#ifdef WITH_PDF_EXPORT
-
-struct content;
-
-bool save_as_pdf(struct hlcache_handle *c, const char *path);
-
-#endif /* WITH_PDF_EXPORT */
-
-#endif
diff --git a/amiga/schedule.c b/amiga/schedule.c
deleted file mode 100755
index e34c00017..000000000
--- a/amiga/schedule.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2008 - 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/timer.h>
-
-#include <stdio.h>
-#include <stdbool.h>
-#include <pbl.h>
-
-#include "utils/errors.h"
-#include "utils/log.h"
-
-#include "amiga/misc.h"
-#include "amiga/schedule.h"
-
-static struct TimeRequest *tioreq;
-struct Device *TimerBase;
-#ifdef __amigaos4__
-struct TimerIFace *ITimer;
-#endif
-
-static APTR pool_nscb = NULL;
-static APTR pool_timereq = NULL;
-
-struct nscallback
-{
- struct TimeVal tv;
- void *callback;
- void *p;
- struct TimeRequest *treq;
-};
-
-static PblHeap *schedule_list;
-
-/**
- * Remove timer event
- *
- * \param nscb callback
- *
- * The timer event for the callback is aborted
- */
-
-static void ami_schedule_remove_timer_event(struct nscallback *nscb)
-{
- if(!nscb) return;
-
- if(nscb->treq)
- {
- if(CheckIO((struct IORequest *)nscb->treq)==NULL)
- AbortIO((struct IORequest *)nscb->treq);
-
- WaitIO((struct IORequest *)nscb->treq);
- ami_misc_itempool_free(pool_timereq, nscb->treq, sizeof(struct TimeRequest));
- }
-}
-
-/**
- * Add timer event
- *
- * \param nscb callback
- * \param t time in ms
- *
- * NetSurf will be signalled in t ms for this event.
- */
-
-static nserror ami_schedule_add_timer_event(struct nscallback *nscb, int t)
-{
- struct TimeVal tv;
- ULONG time_us = t * 1000; /* t converted to µs */
-
- nscb->tv.Seconds = time_us / 1000000;
- nscb->tv.Microseconds = time_us % 1000000;
-
- GetSysTime(&tv);
- AddTime(&nscb->tv,&tv); // now contains time when event occurs
-
- if((nscb->treq = ami_misc_itempool_alloc(pool_timereq, sizeof(struct TimeRequest)))) {
- *nscb->treq = *tioreq;
- nscb->treq->Request.io_Command=TR_ADDREQUEST;
- nscb->treq->Time.Seconds=nscb->tv.Seconds; // secs
- nscb->treq->Time.Microseconds=nscb->tv.Microseconds; // micro
- SendIO((struct IORequest *)nscb->treq);
- } else {
- return NSERROR_NOMEM;
- }
-
- return NSERROR_OK;
-}
-
-/**
- * Locate a scheduled callback
- *
- * \param callback callback function
- * \param p user parameter, passed to callback function
- * \param remove remove callback from the heap
- *
- * A scheduled callback matching both callback and p is returned, or NULL if none present.
- */
-
-static struct nscallback *ami_schedule_locate(void (*callback)(void *p), void *p, bool remove)
-{
- PblIterator *iterator;
- struct nscallback *nscb;
- bool found_cb = false;
-
- /* check there is something on the list */
- if (schedule_list == NULL) return NULL;
- if(pblHeapIsEmpty(schedule_list)) return NULL;
-
- iterator = pblHeapIterator(schedule_list);
-
- while ((nscb = pblIteratorNext(iterator)) != -1) {
- if ((nscb->callback == callback) && (nscb->p == p)) {
- if (remove == true) pblIteratorRemove(iterator);
- found_cb = true;
- break;
- }
- };
-
- pblIteratorFree(iterator);
-
- if (found_cb == true) return nscb;
- else return NULL;
-}
-
-/**
- * Reschedule a callback.
- *
- * \param nscb callback
- * \param t time in ms
- *
- * The nscallback will be rescheduled for t ms.
- */
-
-static nserror ami_schedule_reschedule(struct nscallback *nscb, int t)
-{
- ami_schedule_remove_timer_event(nscb);
- if (ami_schedule_add_timer_event(nscb, t) != NSERROR_OK)
- return NSERROR_NOMEM;
-
- pblHeapConstruct(schedule_list);
- return NSERROR_OK;
-}
-
-/**
- * Unschedule a callback.
- *
- * \param callback callback function
- * \param p user parameter, passed to callback function
- *
- * All scheduled callbacks matching both callback and p are removed.
- */
-
-static nserror schedule_remove(void (*callback)(void *p), void *p)
-{
- struct nscallback *nscb;
-
- nscb = ami_schedule_locate(callback, p, true);
-
- if(nscb != NULL) {
- ami_schedule_remove_timer_event(nscb);
- ami_misc_itempool_free(pool_nscb, nscb, sizeof(struct nscallback));
- pblHeapConstruct(schedule_list);
- }
-
- return NSERROR_OK;
-}
-
-static void schedule_remove_all(void)
-{
- PblIterator *iterator;
- struct nscallback *nscb;
-
- if(pblHeapIsEmpty(schedule_list)) return;
-
- iterator = pblHeapIterator(schedule_list);
-
- while ((nscb = pblIteratorNext(iterator)) != -1)
- {
- ami_schedule_remove_timer_event(nscb);
- pblIteratorRemove(iterator);
- ami_misc_itempool_free(pool_nscb, nscb, sizeof(struct nscallback));
- };
-
- pblIteratorFree(iterator);
-}
-
-static int ami_schedule_compare(const void *prev, const void *next)
-{
- struct nscallback *nscb1 = *(struct nscallback **)prev;
- struct nscallback *nscb2 = *(struct nscallback **)next;
-
- return CmpTime(&nscb1->tv, &nscb2->tv);
-}
-
-
-/**
- * Process events up to current time.
- *
- * This implementation only takes the top entry off the heap, it does not
- * venture to later scheduled events until the next time it is called -
- * immediately afterwards, if we're in a timer signalled loop.
- */
-static void ami_scheduler_run(void)
-{
- struct nscallback *nscb;
- struct TimeVal tv;
- void (*callback)(void *p);
- void *p;
-
- nscb = pblHeapGetFirst(schedule_list);
- if(nscb == -1) return;
-
- /* Ensure the scheduled event time has passed (CmpTime<=0)
- * in case something been deleted between the timer
- * signalling us and us responding to it.
- */
- GetSysTime(&tv);
- if(CmpTime(&tv, &nscb->tv) > 0) return;
-
- callback = nscb->callback;
- p = nscb->p;
-
- ami_schedule_remove_timer_event(nscb);
- pblHeapRemoveFirst(schedule_list);
- ami_misc_itempool_free(pool_nscb, nscb, sizeof(struct nscallback));
-
- LOG("Running scheduled callback %p with arg %p", callback, p);
- callback(p);
-
- return;
-}
-
-static void ami_schedule_open_timer(struct MsgPort *msgport)
-{
-#ifdef __amigaos4__
- tioreq = (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST,
- ASOIOR_Size,sizeof(struct TimeRequest),
- ASOIOR_ReplyPort,msgport,
- ASO_NoTrack,FALSE,
- TAG_DONE);
-#else
- tioreq = (struct TimeRequest *)CreateIORequest(msgport, sizeof(struct TimeRequest));
-#endif
-
- OpenDevice("timer.device", UNIT_WAITUNTIL, (struct IORequest *)tioreq, 0);
-
- TimerBase = (struct Device *)tioreq->Request.io_Device;
-#ifdef __amigaos4__
- ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL);
-#endif
-}
-
-static void ami_schedule_close_timer(void)
-{
-#ifdef __amigaos4__
- if(ITimer) DropInterface((struct Interface *)ITimer);
-#endif
- CloseDevice((struct IORequest *) tioreq);
- FreeSysObject(ASOT_IOREQUEST, tioreq);
-}
-
-/* exported interface documented in amiga/schedule.h */
-nserror ami_schedule_create(struct MsgPort *msgport)
-{
- pool_nscb = ami_misc_itempool_create(sizeof(struct nscallback));
- pool_timereq = ami_misc_itempool_create(sizeof(struct TimeRequest));
-
- ami_schedule_open_timer(msgport);
- schedule_list = pblHeapNew();
- if(schedule_list == PBL_ERROR_OUT_OF_MEMORY) return NSERROR_NOMEM;
-
- pblHeapSetCompareFunction(schedule_list, ami_schedule_compare);
-
- return NSERROR_OK;
-}
-
-/* exported interface documented in amiga/schedule.h */
-void ami_schedule_free(void)
-{
- schedule_remove_all();
- pblHeapFree(schedule_list); // this should be empty at this point
- schedule_list = NULL;
-
- ami_schedule_close_timer();
-
- ami_misc_itempool_delete(pool_timereq);
- ami_misc_itempool_delete(pool_nscb);
-}
-
-/* exported function documented in amiga/schedule.h */
-nserror ami_schedule(int t, void (*callback)(void *p), void *p)
-{
- struct nscallback *nscb;
-
- if(schedule_list == NULL) return NSERROR_INIT_FAILED;
- if(t < 0) return schedule_remove(callback, p);
-
- if ((nscb = ami_schedule_locate(callback, p, false))) {
- return ami_schedule_reschedule(nscb, t);
- }
-
- nscb = ami_misc_itempool_alloc(pool_nscb, sizeof(struct nscallback));
- if(!nscb) return NSERROR_NOMEM;
-
- if (ami_schedule_add_timer_event(nscb, t) != NSERROR_OK)
- return NSERROR_NOMEM;
-
- nscb->callback = callback;
- nscb->p = p;
-
- pblHeapInsert(schedule_list, nscb);
-
- return NSERROR_OK;
-
-}
-
-/* exported interface documented in amiga/schedule.h */
-void ami_schedule_handle(struct MsgPort *nsmsgport)
-{
- /* nsmsgport is the NetSurf message port that the scheduler task
- * (or timer.device in no-async mode) is sending messages to. */
-
- struct TimerRequest *timermsg;
-
- while((timermsg = (struct TimerRequest *)GetMsg(nsmsgport))) {
- /* reply first, as we don't need the message contents and
- * it crashes if we reply after schedule_run has executed.
- */
- ReplyMsg((struct Message *)timermsg);
- ami_scheduler_run();
- }
-}
-
diff --git a/amiga/schedule.h b/amiga/schedule.h
deleted file mode 100755
index fb648eaa4..000000000
--- a/amiga/schedule.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2008-2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_SCHEDULE_H
-#define AMIGA_SCHEDULE_H
-#include "amiga/os3support.h"
-
-/**
- * Schedule a callback.
- *
- * \param t interval before the callback should be made / ms
- * \param callback callback function
- * \param p user parameter, passed to callback function
- * \return NSERROR_OK on sucess or appropriate error on faliure
- *
- * The callback function will be called as soon as possible after t ms have
- * passed.
- */
-nserror ami_schedule(int t, void (*callback)(void *p), void *p);
-
-/**
- * Handle a message received from the scheduler process.
- *
- * \param nsmsgport Message port to process.
- */
-void ami_schedule_handle(struct MsgPort *nsmsgport);
-
-/**
- * Initialise amiga scheduler
- *
- * \param msgport opened message port
- *
- * \return error.
- */
-nserror ami_schedule_create(struct MsgPort *msgport);
-
-/**
- * Finalise amiga scheduler
- */
-void ami_schedule_free(void);
-#endif
-
diff --git a/amiga/search.c b/amiga/search.c
deleted file mode 100755
index 5ca979220..000000000
--- a/amiga/search.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
- * Copyright 2005 Adrian Lees <adrianl@users.sourceforge.net>
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Free text search (implementation)
- */
-
-#include "amiga/os3support.h"
-
-#include "utils/config.h"
-#include <ctype.h>
-#include <string.h>
-
-#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/window.h>
-#include <proto/layout.h>
-#include <proto/string.h>
-#include <proto/button.h>
-#include <proto/label.h>
-#include <proto/checkbox.h>
-#include <classes/window.h>
-#include <gadgets/layout.h>
-#include <gadgets/string.h>
-#include <gadgets/button.h>
-#include <gadgets/checkbox.h>
-#include <images/label.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "content/content.h"
-#include "desktop/browser.h"
-#include "desktop/search.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-#include "desktop/gui_search.h"
-
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/search.h"
-#include "amiga/object.h"
-#include "amiga/theme.h"
-
-#ifndef NOF_ELEMENTS
-#define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array)))
-#endif
-
-static bool search_insert;
-
-static struct find_window *fwin = NULL;
-
-search_flags_t ami_search_flags(void);
-char *ami_search_string(void);
-static void ami_search_set_status(bool found, void *p);
-static void ami_search_set_hourglass(bool active, void *p);
-static void ami_search_add_recent(const char *string, void *p);
-static void ami_search_set_forward_state(bool active, void *p);
-static void ami_search_set_back_state(bool active, void *p);
-
-static struct gui_search_table search_table = {
- ami_search_set_status,
- ami_search_set_hourglass,
- ami_search_add_recent,
- ami_search_set_forward_state,
- ami_search_set_back_state,
-};
-
-struct gui_search_table *amiga_search_table = &search_table;
-
-/**
- * Change the displayed search status.
- *
- * \param gwin gui window to open search for.
- */
-void ami_search_open(struct gui_window *gwin)
-{
- search_insert = true;
-
- if(fwin)
- {
- browser_window_search_clear(fwin->gwin->bw);
- fwin->gwin->shared->searchwin = NULL;
- fwin->gwin = gwin;
- gwin->shared->searchwin = fwin;
- WindowToFront(fwin->win);
- ActivateWindow(fwin->win);
- return;
- }
-
- fwin = ami_misc_allocvec_clear(sizeof(struct find_window), 0);
-
- fwin->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title,messages_get("FindTextNS"),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,fwin,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_LockHeight,TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, fwin->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, fwin->objects[GID_SEARCHSTRING] = StringObj,
- GA_ID,GID_SEARCHSTRING,
- GA_TabCycle,TRUE,
- GA_RelVerify,TRUE,
- StringEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, fwin->objects[GID_CASE] = CheckBoxObj,
- GA_ID,GID_CASE,
- GA_Text,messages_get("CaseSens"),
- GA_Selected,FALSE,
- GA_TabCycle,TRUE,
- GA_RelVerify,TRUE,
- CheckBoxEnd,
- LAYOUT_AddChild, fwin->objects[GID_SHOWALL] = CheckBoxObj,
- GA_ID,GID_SHOWALL,
- GA_Text,messages_get("ShowAll"),
- GA_Selected,FALSE,
- GA_TabCycle,TRUE,
- GA_RelVerify,TRUE,
- CheckBoxEnd,
-
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, fwin->objects[GID_PREV] = ButtonObj,
- GA_ID,GID_PREV,
- GA_RelVerify,TRUE,
- GA_Text,messages_get("Prev"),
- GA_TabCycle,TRUE,
- GA_Disabled,TRUE,
- ButtonEnd,
- CHILD_WeightedHeight,0,
- LAYOUT_AddChild, fwin->objects[GID_NEXT] = ButtonObj,
- GA_ID,GID_NEXT,
- GA_RelVerify,TRUE,
- GA_Text,messages_get("Next"),
- GA_TabCycle,TRUE,
- GA_Disabled,TRUE,
- ButtonEnd,
- LayoutEnd,
- CHILD_WeightedHeight,0,
- EndGroup,
- EndWindow;
-
- fwin->win = (struct Window *)RA_OpenWindow(fwin->objects[OID_MAIN]);
- fwin->gwin = gwin;
- fwin->node = AddObject(window_list,AMINS_FINDWINDOW);
- fwin->node->objstruct = fwin;
- gwin->shared->searchwin = fwin;
-
- ActivateLayoutGadget((struct Gadget *)fwin->objects[GID_MAIN], fwin->win,
- NULL, (ULONG)fwin->objects[GID_SEARCHSTRING]);
-}
-
-void ami_search_close(void)
-{
- browser_window_search_clear(fwin->gwin->bw);
- fwin->gwin->shared->searchwin = NULL;
- DisposeObject(fwin->objects[OID_MAIN]);
- DelObject(fwin->node);
- fwin=NULL;
-}
-
-BOOL ami_search_event(void)
-{
- /* return TRUE if window destroyed */
- ULONG result;
- uint16 code;
- search_flags_t flags;
-
- while((result = RA_HandleInput(fwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK)
- {
- case GID_SEARCHSTRING:
- browser_window_search_clear(fwin->gwin->bw);
-
- RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV],
- fwin->win, NULL,
- GA_Disabled, FALSE,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT],
- fwin->win, NULL,
- GA_Disabled, FALSE,
- TAG_DONE);
-
- /* fall through */
-
- case GID_NEXT:
- search_insert = true;
- flags = SEARCH_FLAG_FORWARDS |
- ami_search_flags();
- browser_window_search(
- fwin->gwin->bw,
- NULL,
- flags, ami_search_string());
- ActivateWindow(fwin->gwin->shared->win);
- break;
-
- case GID_PREV:
- search_insert = true;
- flags = ~SEARCH_FLAG_FORWARDS &
- ami_search_flags();
- browser_window_search(
- fwin->gwin->bw,
- NULL,
- flags, ami_search_string());
- ActivateWindow(fwin->gwin->shared->win);
- break;
- }
- break;
-
- case WMHI_CLOSEWINDOW:
- ami_search_close();
- return TRUE;
- break;
- }
- }
- return FALSE;
-}
-
-/**
-* Change the displayed search status.
-* \param found search pattern matched in text
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void ami_search_set_status(bool found, void *p)
-{
-}
-
-/**
-* display hourglass while searching
-* \param active start/stop indicator
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void ami_search_set_hourglass(bool active, void *p)
-{
- if(active)
- ami_update_pointer(fwin->win, GUI_POINTER_WAIT);
- else
- ami_update_pointer(fwin->win, GUI_POINTER_DEFAULT);
-}
-
-/**
-* retrieve string being searched for from gui
-*/
-
-char *ami_search_string(void)
-{
- char *text;
- GetAttr(STRINGA_TextVal,fwin->objects[GID_SEARCHSTRING],(ULONG *)&text);
- return text;
-
-}
-
-/**
-* add search string to recent searches list
-* front is at liberty how to implement the bare notification
-* should normally store a strdup() of the string;
-* core gives no guarantee of the integrity of the const char *
-* \param string search pattern
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void ami_search_add_recent(const char *string, void *p)
-{
-}
-
-/**
-* activate search forwards button in gui
-* \param active activate/inactivate
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void ami_search_set_forward_state(bool active, void *p)
-{
- RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT],
- fwin->win, NULL,
- GA_Disabled, active ? FALSE : TRUE, TAG_DONE);
-
-}
-
-/**
-* activate search forwards button in gui
-* \param active activate/inactivate
-* \param p the pointer sent to search_verify_new() / search_create_context()
-*/
-
-void ami_search_set_back_state(bool active, void *p)
-{
- RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV],
- fwin->win, NULL,
- GA_Disabled, active ? FALSE : TRUE, TAG_DONE);
-}
-
-/**
-* retrieve state of 'case sensitive', 'show all' checks in gui
-*/
-
-search_flags_t ami_search_flags(void)
-{
- ULONG case_sensitive, showall;
- search_flags_t flags;
- GetAttr(GA_Selected,fwin->objects[GID_CASE],(ULONG *)&case_sensitive);
- GetAttr(GA_Selected,fwin->objects[GID_SHOWALL],(ULONG *)&showall);
- flags = 0 | (case_sensitive ? SEARCH_FLAG_CASE_SENSITIVE : 0) |
- (showall ? SEARCH_FLAG_SHOWALL : 0);
- return flags;
-}
-
diff --git a/amiga/search.h b/amiga/search.h
deleted file mode 100755
index c4f30eb01..000000000
--- a/amiga/search.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_SEARCH_H
-#define AMIGA_SEARCH_H
-
-#include "amiga/gui.h"
-
-struct find_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_LAST];
- struct gui_window *gwin;
-};
-
-struct gui_search_table *amiga_search_table;
-
-void ami_search_open(struct gui_window *gwin);
-BOOL ami_search_event(void);
-void ami_search_close(void);
-
-#endif
diff --git a/amiga/selectmenu.c b/amiga/selectmenu.c
deleted file mode 100644
index 25931783f..000000000
--- a/amiga/selectmenu.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright 2008 - 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef __amigaos4__
-
-#include <stdbool.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/popupmenu.h>
-#include <proto/utility.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/errors.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "render/form.h"
-#include "desktop/mouse.h"
-
-#include "amiga/gui.h"
-#include "amiga/selectmenu.h"
-#include "amiga/theme.h"
-#include "amiga/utf8.h"
-
-/* Maximum number of items for a popupmenu.class select menu.
- * 50 is about the limit for my screen, and popupmenu doesn't scroll.
- * We may need to calculate a value for this based on screen/font size.
- *
- * Additional entries will be added to a "More" menu...
- */
-#define AMI_SELECTMENU_PAGE_MAX 40
-
-/* ...limited to the number of menus defined here... */
-#define AMI_SELECTMENU_MENU_MAX 10
-
-/* ...and resulting in this total number of entries. */
-#define AMI_SELECTMENU_MAX (AMI_SELECTMENU_PAGE_MAX * AMI_SELECTMENU_MENU_MAX)
-
-
-/** Exported interface documented in selectmenu.h **/
-BOOL ami_selectmenu_is_safe(void)
-{
- struct Library *PopupMenuBase;
- BOOL popupmenu_lib_ok = FALSE;
-
- if((PopupMenuBase = OpenLibrary("popupmenu.library", 53))) {
- LOG("popupmenu.library v%d.%d", PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision);
- if(LIB_IS_AT_LEAST((struct Library *)PopupMenuBase, 53, 11))
- popupmenu_lib_ok = TRUE;
- CloseLibrary(PopupMenuBase);
- }
-
- return popupmenu_lib_ok;
-}
-
-HOOKF(uint32, ami_popup_hook, Object *, item, APTR)
-{
- uint32 itemid = 0;
- struct gui_window *gwin = hook->h_Data;
-
- if(GetAttr(PMIA_ID, item, &itemid)) {
- form_select_process_selection(gwin->shared->control, itemid);
- }
-
- return itemid;
-}
-
-void gui_create_form_select_menu(struct gui_window *g,
- struct form_control *control)
-{
- struct Library *PopupMenuBase = NULL;
- struct PopupMenuIFace *IPopupMenu = NULL;
- struct Hook selectmenuhook;
- Object *selectmenuobj;
- Object *smenu = NULL;
- Object *currentmenu;
- Object *submenu = NULL;
- char *selectmenu_item[AMI_SELECTMENU_MAX];
- char *more_label;
- struct form_option *opt = form_select_get_option(control, 0);
- int i = 0;
- int n = 0;
-
- if(ami_selectmenu_is_safe() == FALSE) return;
-
- if((PopupMenuBase = OpenLibrary("popupmenu.class", 0))) {
- IPopupMenu = (struct PopupMenuIFace *)GetInterface(PopupMenuBase, "main", 1, NULL);
- }
-
- if(IPopupMenu == NULL) return;
-
- ClearMem(selectmenu_item, AMI_SELECTMENU_MAX * 4);
- more_label = ami_utf8_easy(messages_get("More"));
-
- selectmenuhook.h_Entry = ami_popup_hook;
- selectmenuhook.h_SubEntry = NULL;
- selectmenuhook.h_Data = g;
-
- g->shared->control = control;
-
- selectmenuobj = PMMENU(form_control_get_name(control)),
- PMA_MenuHandler, &selectmenuhook, End;
-
- currentmenu = selectmenuobj;
-
- while(opt) {
- selectmenu_item[i] = ami_utf8_easy(opt->text);
-
- IDoMethod(currentmenu, PM_INSERT,
- NewObject(POPUPMENU_GetItemClass(), NULL,
- PMIA_Title, (ULONG)selectmenu_item[i],
- PMIA_ID, i,
- PMIA_CheckIt, TRUE,
- PMIA_Checked, opt->selected,
- TAG_DONE),
- ~0);
-
- opt = opt->next;
- i++;
- n++;
-
- if(n == AMI_SELECTMENU_PAGE_MAX) {
- if(submenu != NULL) {
- /* attach the previous submenu */
- IDoMethod(smenu, PM_INSERT,
- NewObject(NULL, "popupmenuitem.class",
- PMIA_Title, more_label,
- PMIA_CheckIt, TRUE,
- PMIA_SubMenu, submenu,
- TAG_DONE),
- ~0);
- }
-
- submenu = NewObject(NULL, "popupmenu.class", TAG_DONE);
- smenu = currentmenu;
- currentmenu = submenu;
- n = 0;
- }
-
- if(i >= AMI_SELECTMENU_MAX) break;
- }
-
- if((submenu != NULL) && (n != 0)) {
- /* attach the previous submenu */
- IDoMethod(smenu, PM_INSERT,
- NewObject(NULL, "popupmenuitem.class",
- PMIA_Title, more_label,
- PMIA_CheckIt, TRUE,
- PMIA_SubMenu, submenu,
- TAG_DONE),
- ~0);
- }
-
- ami_set_pointer(g->shared, GUI_POINTER_DEFAULT, false); // Clear the menu-style pointer
-
- IDoMethod(selectmenuobj, PM_OPEN, g->shared->win);
-
- /* PM_OPEN is blocking, so dispose menu immediately... */
- if(selectmenuobj) DisposeObject(selectmenuobj);
-
- /* ...and get rid of popupmenu.class ASAP */
- if(IPopupMenu) DropInterface((struct Interface *)IPopupMenu);
- if(PopupMenuBase) CloseLibrary(PopupMenuBase);
-
- /* Free the menu labels */
- if(more_label) ami_utf8_free(more_label);
- for(i = 0; i < AMI_SELECTMENU_MAX; i++) {
- if(selectmenu_item[i] != NULL) {
- ami_utf8_free(selectmenu_item[i]);
- selectmenu_item[i] = NULL;
- }
- }
-}
-
-#else
-#include "amiga/selectmenu.h"
-void gui_create_form_select_menu(struct gui_window *g, struct form_control *control)
-{
-}
-
-BOOL ami_selectmenu_is_safe()
-{
- return FALSE;
-}
-#endif
-
diff --git a/amiga/selectmenu.h b/amiga/selectmenu.h
deleted file mode 100755
index f55b6ca98..000000000
--- a/amiga/selectmenu.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2008-9, 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_SELECTMENU_H
-#define AMIGA_SELECTMENU_H
-
-#include <exec/types.h>
-
-struct gui_window;
-struct form_control;
-
-BOOL popupmenu_lib_ok;
-
-void gui_create_form_select_menu(struct gui_window *g, struct form_control *control);
-
-/**
- * Opens popupmenu.library to check the version.
- * Versions older than 53.11 are dangerous!
- *
- * \returns TRUE if popupmenu is safe, FALSE otherwise.
- */
-BOOL ami_selectmenu_is_safe(void);
-#endif
-
diff --git a/amiga/sslcert.c b/amiga/sslcert.c
deleted file mode 100644
index 699ce71b8..000000000
--- a/amiga/sslcert.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <proto/exec.h>
-
-#include "utils/nsurl.h"
-#include "content/llcache.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-#include "desktop/sslcert_viewer.h"
-
-#include "amiga/tree.h"
-#include "amiga/sslcert.h"
-
-void gui_cert_verify(nsurl *url,
- const struct ssl_cert_info *certs, unsigned long num,
- nserror (*cb)(bool proceed, void *pw), void *cbpw)
-{
- struct sslcert_session_data *data;
- struct treeview_window *ssl_window;
-
- sslcert_viewer_create_session_data(num, url, cb, cbpw,
- certs, &data);
- ssl_current_session = data;
-
- ssl_window = ami_tree_create(TREE_SSLCERT, data);
- if(!ssl_window) return;
-
- ami_tree_open(ssl_window, AMI_TREE_SSLCERT);
-}
-
-void ami_ssl_free(struct treeview_window *twin)
-{
- ami_tree_destroy(twin);
-}
diff --git a/amiga/sslcert.h b/amiga/sslcert.h
deleted file mode 100644
index 953142e98..000000000
--- a/amiga/sslcert.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_SSLCERT_H
-#define AMIGA_SSLCERT_H
-
-void gui_cert_verify(nsurl *url,
- const struct ssl_cert_info *certs, unsigned long num,
- nserror (*cb)(bool proceed, void *pw), void *cbpw);
-
-void ami_ssl_free(struct treeview_window *twin);
-
-#endif
diff --git a/amiga/stringview/stringview.c b/amiga/stringview/stringview.c
deleted file mode 100755
index e875f3b5a..000000000
--- a/amiga/stringview/stringview.c
+++ /dev/null
@@ -1,870 +0,0 @@
-/*
- * Copyright 2009 Rene W. Olsen <ac@rebels.com>
- * Copyright 2009 Stephen Fellner <sf.amiga@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/// Include
-
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/layout.h>
-#include <proto/listbrowser.h>
-#include <proto/utility.h>
-#include <proto/string.h>
-#include <proto/window.h>
-
-#include <classes/window.h>
-#include <gadgets/layout.h>
-#include <gadgets/listbrowser.h>
-
-#include "amiga/os3support.h"
-#include "amiga/libs.h"
-
-#include "stringview.h"
-#include "urlhistory.h"
-
-#include <string.h>
-#include <stdio.h>
-
-#define End TAG_END)
-
-///
-
-/// Proto
-
-static void myStringOpenListview( Class *cl, Object *obj, struct gpInput *msg );
-static void myStringCloseListview( Class *cl, Object *obj );
-static uint32 myStringSearch( Class *cl, Object *obj );
-static void myStringArrowUp( Class *cl, Object *obj );
-static void myStringArrowDown( Class *cl, Object *obj );
-static void myStringHandleListview( Class *cl, Object *obj );
-
-///
-
-/* -- Internal -- */
-
-/// myStringOpenListview
-
-static void myStringOpenListview( Class *cl, Object *obj, struct gpInput *msg )
-{
-struct myStringClassData *data;
-struct Gadget *gad;
-
- data = INST_DATA( cl, obj );
-
- gad = (struct Gadget *)obj;
-
- SetAttrs( data->WindowObject,
- WA_CustomScreen, msg->gpi_GInfo->gi_Window->WScreen,
- WA_Left, data->WinXPos,
- WA_Top, data->WinYPos,
- WA_Width, data->WinWidth,
- WA_Height, data->WinHeight,
- TAG_END
- );
-
-// IDoMethod( data->WindowObject, WM_RETHINK );
-
- data->Window = (struct Window *)IDoMethod( data->WindowObject, WM_OPEN );
-
- if ( data->Window == NULL )
- {
- goto bailout;
- }
-
-// GetAttr( WINDOW_SigMask, MainWindowObject, &MainWindowBits );
-
-bailout:
-
- return;
-}
-
-///
-/// myStringCloseListview
-
-static void myStringCloseListview( Class *cl, Object *obj )
-{
-struct myStringClassData *data;
-struct Node *node;
-
- data = INST_DATA( cl, obj );
-
- if ( data->Window )
- {
- IDoMethod( data->WindowObject, WM_CLOSE );
- data->Window = NULL;
- }
-
- while(( node = RemHead( &data->ListviewHeader )))
- {
- FreeListBrowserNode( node );
- }
-}
-
-///
-/// myStringSearch
-
-static uint32 myStringSearch( Class *cl, Object *obj )
-{
- struct myStringClassData *data;
- struct Window *win;
- struct Node *node;
- struct Node *n;
- uint32 found;
- uint32 bufpos;
- STRPTR searchString;
- STRPTR compString;
-
- found = 0;
-
- data = INST_DATA( cl, obj );
-
- win = data->Window;
-
- // Remove List and Free Nodes
-
- SetGadgetAttrs( (struct Gadget *)data->ListviewObject, win, NULL,
- LISTBROWSER_Labels, ~0,
- TAG_END
- );
-
- while(( node = RemHead( &data->ListviewHeader )))
- {
- FreeListBrowserNode( node );
- }
-
- GetAttr( STRINGA_BufferPos, obj, &bufpos );
-
- if ( bufpos == 0 )
- {
- goto bailout;
- }
-
-//-------------
-
- searchString = strstr(data->SearchBuffer, "://");
- if(searchString)
- {
- searchString += 3;
- if (bufpos >= searchString - data->SearchBuffer)
- bufpos -= searchString - data->SearchBuffer;
- }
- else
- searchString = data->SearchBuffer;
-
- node = GetHead( data->SearchHeader );
-
- while( node )
- {
- uint32 srcpos;
- BOOL possible;
-
- possible = FALSE;
- srcpos = 0;
-
- compString = strstr(node->ln_Name, "://");
- if(compString)
- compString += 3;
- else
- compString = node->ln_Name;
-
- if( 0 == strncasecmp( compString, searchString, bufpos ) )
- {
- // found match after protocol
- possible = TRUE;
- }
- else
- {
- // no match after protocol, see if there's a match after www
- if( 0 == strncasecmp( compString, "www.", 4) ) {
- // got www, compare it!
- if( 0 == strncasecmp( &compString[4], searchString, bufpos ) )
- possible = TRUE;
- }
- }
-
- if ( possible == TRUE )
- {
- n = AllocListBrowserNode( 1,
- LBNA_Column, 0,
- LBNCA_CopyText, TRUE,
- LBNCA_Text, node->ln_Name,
- TAG_END
- );
-
- if ( n )
- {
- AddTail( &data->ListviewHeader, n );
- found++;
- }
- }
-
- node = GetSucc( node );
- }
-
-//-------------
-
-bailout:
-
- data->ListviewCount = found;
- data->ListviewSelected = -1;
-
- // Add List Again
-
- RefreshSetGadgetAttrs( (struct Gadget *)data->ListviewObject, win, NULL,
- LISTBROWSER_Labels, &data->ListviewHeader,
- LISTBROWSER_Selected, data->ListviewSelected,
- LISTBROWSER_MakeVisible, 0,
- TAG_END
- );
-
- return( found );
-}
-
-///
-/// myStringArrowUp
-
-static void myStringArrowUp( Class *cl, Object *obj )
-{
-struct myStringClassData *data;
-struct Window *win;
-//struct Node *node;
-//uint32 cnt;
-
- data = INST_DATA( cl, obj );
-
- win = data->Window;
-
- if ( data->ListviewCount == 0 )
- {
- data->ListviewSelected = -1;
- goto bailout;
- }
- else if (( data->ListviewSelected != -1 ) && ( data->ListviewSelected != 0 ))
- {
- data->ListviewSelected--;
- }
-
- RefreshSetGadgetAttrs( (struct Gadget *)data->ListviewObject, win, NULL,
- LISTBROWSER_Selected, data->ListviewSelected,
- LISTBROWSER_MakeVisible, data->ListviewSelected,
- TAG_END
- );
-
-// cnt = data->ListviewSelected;
-// node = GetHead( data->SearchHeader );
-//
-// while( cnt-- > 0 )
-// {
-// node = GetSucc( node );
-// }
-//
-// if ( node )
-// {
-// ISetSuperAttrs( obj,
-//
-// TAG_END
-// );
-// }
-
-bailout:
-
- return;
-}
-
-///
-/// myStringArrowDown
-
-static void myStringArrowDown( Class *cl, Object *obj )
-{
-struct myStringClassData *data;
-struct Window *win;
-
- data = INST_DATA( cl, obj );
-
- win = data->Window;
-
- if ( data->ListviewCount == 0 )
- {
- data->ListviewSelected = -1;
- }
- else if ( data->ListviewSelected == -1 )
- {
- data->ListviewSelected = 0;
- }
- else if ( data->ListviewSelected != data->ListviewCount - 1 )
- {
- data->ListviewSelected++;
- }
-
- RefreshSetGadgetAttrs( (struct Gadget *)data->ListviewObject, win, NULL,
- LISTBROWSER_Selected, data->ListviewSelected,
- LISTBROWSER_MakeVisible, data->ListviewSelected,
- TAG_END
- );
-}
-
-///
-/// myStringHandleListview
-
-static void myStringHandleListview( Class *cl, Object *obj )
-{
-struct myStringClassData *data;
-uint32 result;
-uint16 code;
-
- data = INST_DATA( cl, obj );
-
- while(( result = IDoMethod( data->WindowObject, WM_HANDLEINPUT, &code )) != WMHI_LASTMSG )
- {
-// switch( result & WMHI_CLASSMASK )
-// {
-// case WMHI_CLOSEWINDOW:
-// {
-// running = FALSE;
-// break;
-// }
-//
-// default:
-// {
-// break;
-// }
-// }
- }
-}
-
-///
-
-/* BOOPSI methods */
-
-/// myStringClass_OM_New
-
-static uint32 myStringClass_OM_New( Class *cl, Object *obj, struct opSet *msg )
-{
- struct myStringClassData *data;
- struct List *header;
- struct TagItem *tag, *tags;
- STRPTR buffer;
-
- buffer = NULL;
- header = NULL;
-
- tags = msg->ops_AttrList;
-
- while(( tag = NextTagItem( &tags )))
- {
- switch ( tag->ti_Tag )
- {
- case STRINGVIEW_Header:
- {
- header = (struct List *)tag->ti_Data;
- break;
- }
-
- case STRINGA_Buffer:
- {
- buffer = (STRPTR)tag->ti_Data;
- break;
- }
-
- default:
- {
- break;
- }
- }
- }
-
- if (( header == NULL ) || ( buffer == NULL ))
- {
- return( 0 );
- }
-
- obj = (Object *)IDoSuperMethodA( cl, obj, (APTR)msg );
-
- if ( obj == NULL )
- {
- goto bailout;
- }
-
- if ( obj )
- {
- data = INST_DATA( cl, obj );
-
- data->SearchHeader = header;
- data->SearchBuffer = buffer;
-
- NewList( &data->ListviewHeader );
-
- InitSemaphore( &data->Semaphore );
-
- data->WindowObject = NewObject( WindowClass, NULL,
- WA_Activate, FALSE,
- WA_Borderless, TRUE,
- WINDOW_ParentGroup, NewObject( LayoutClass, NULL,
- LAYOUT_SpaceInner, FALSE,
- LAYOUT_SpaceOuter, FALSE,
- LAYOUT_AddChild, data->ListviewObject = NewObject( ListBrowserClass, NULL,
- LISTBROWSER_Labels, &data->ListviewHeader,
- LISTBROWSER_MakeVisible, TRUE,
- LISTBROWSER_ShowSelected, TRUE,
- End,
- End,
- End;
-
- if ( data->WindowObject == NULL )
- {
- goto bailout;
- }
- }
-
- return( (uint32)obj );
-
-bailout:
-
- if ( obj )
- {
- ICoerceMethod( cl, obj, OM_DISPOSE );
- }
-
- return( FALSE );
-}
-
-///
-/// myStringClass_OM_Dispose
-
-static uint32 myStringClass_OM_Dispose( Class *cl, Object *obj, struct opSet *msg )
-{
-struct myStringClassData *data;
-
- data = INST_DATA( cl, obj );
-
- if ( data->Window )
- {
- IDoMethod( data->WindowObject, WM_CLOSE );
- data->Window = NULL;
- }
-
- if ( data->WindowObject )
- {
- DisposeObject( data->WindowObject );
- data->WindowObject = NULL;
- }
-
- return( IDoSuperMethodA( cl, obj, (APTR)msg ));
-}
-
-///
-/// myStringClass_OM_Set
-
-//--uint32 myStringClass_OM_Set( Class *cl, Object *obj, struct opSet *msg )
-//--{
-//--struct TorrentClassData *data;
-//--struct TagItem *tag, *tags;
-//--tr_stat_t *tor_s;
-//--
-//-- data = INST_DATA( cl, obj );
-//--
-//-- tags = msg->ops_AttrList;
-//--
-//-- while(( tag = NextTagItem( &tags )))
-//-- {
-//-- switch ( tag->ti_Tag )
-//-- {
-//-- case RAA_Torrent_Stats:
-//-- {
-//-- tor_s = (tr_stat_t *)tag->ti_Data;
-//--
-//-- switch( data->Type )
-//-- {
-//-- case TorType_BitTorrent5:
-//-- {
-//-- BitTorrent5_Stat( data, tor_s );
-//-- break;
-//-- }
-//--
-//-- case TorType_Transmission:
-//-- {
-//-- Transmission_Stat( data, tor_s );
-//-- break;
-//-- }
-//--
-//-- default:
-//-- {
-//-- break;
-//-- }
-//-- }
-//-- break;
-//-- }
-//--
-//-- case RAA_Torrent_Activate:
-//-- {
-//-- switch( data->Type )
-//-- {
-//-- case TorType_BitTorrent5:
-//-- {
-//-- if ( tag->ti_Data == TRUE )
-//-- {
-//-- BitTorrent5_Enable( data );
-//-- }
-//-- else
-//-- {
-//-- BitTorrent5_Disable( data );
-//-- }
-//-- break;
-//-- }
-//--
-//-- case TorType_Transmission:
-//-- {
-//-- if ( tag->ti_Data == TRUE )
-//-- {
-//-- Transmission_Enable( data );
-//-- }
-//-- else
-//-- {
-//-- Transmission_Disable( data );
-//-- }
-//-- break;
-//-- }
-//--
-//-- default:
-//-- {
-//-- break;
-//-- }
-//-- }
-//-- break;
-//-- }
-//--
-//-- default:
-//-- {
-//-- break;
-//-- }
-//-- }
-//-- }
-//--
-//-- return( IDoSuperMethodA( cl, obj, (Msg)msg ));
-//--}
-
-///
-
-/// myStringClass_GM_HandleInput
-
-static uint32 myStringClass_GM_HandleInput( Class *cl, Object *obj, struct gpInput *msg )
-{
- struct myStringClassData *data;
- struct Gadget *gad;
- uint32 retval;
-
- data = INST_DATA( cl, obj );
-
- gad = (struct Gadget *)obj;
-
- //IDoMethod( data->ListviewObject, (APTR)msg );
-
- if (( gad->Flags & GFLG_SELECTED ) == 0 )
- {
- return( GMR_NOREUSE );
- }
-
- switch( msg->gpi_IEvent->ie_Class )
- {
- case IECLASS_RAWKEY:
- {
- switch( msg->gpi_IEvent->ie_Code )
- {
- case 0x48: // Page Up (DownKey)
- case 0x4c: // Up Arrow (DownKey)
- {
- myStringArrowUp( cl, obj );
-
- retval = GMR_MEACTIVE;
-
- break;
- }
-
- case 0x49: // Page Down (DownKey)
- case 0x4d: // Down Arrow (DownKey)
- {
- myStringArrowDown( cl, obj );
-
- retval = GMR_MEACTIVE;
-
- break;
- }
-
-// case 70: // Del
-// case 65: // Backspace
-// {
-// myStringCloseListview( cl, obj );
-//
-// retval = IDoSuperMethodA( cl, obj, (APTR)msg );
-// break;
-// }
-
- case 68: // Return
- {
- // If listview open, and an item is selected, copy selected node's text to the string gadget
- if( data->Window != NULL && data->ListviewCount > 0 )
- {
- struct Node *selected = NULL;
- STRPTR pText;
- GetAttr( LISTBROWSER_SelectedNode, data->ListviewObject, (uint32 *) ( &selected ) );
- if( selected != NULL )
- {
- GetListBrowserNodeAttrs( selected, LBNA_Column, 0, LBNCA_Text, &pText, TAG_END );
- SetGadgetAttrs( (struct Gadget *)obj, data->Window, NULL, STRINGA_TextVal, pText, TAG_DONE );
- }
- }
-
- retval = IDoSuperMethodA( cl, obj, (APTR)msg );
- break;
- }
-
- default:
- {
- uint32 oldpos;
- uint32 newpos;
-
- GetAttr( STRINGA_BufferPos, obj, &oldpos );
-
- retval = IDoSuperMethodA( cl, obj, (APTR)msg );
-
- GetAttr( STRINGA_BufferPos, obj, &newpos );
-
- if ( oldpos != newpos )
- {
- if ( myStringSearch( cl, obj ))
- {
- // Atleast one entry found, open window if not open
- if ( data->Window == NULL )
- {
- myStringOpenListview( cl, obj, msg );
- }
- }
- else
- {
- // No matches, migth aswell close the window
- myStringCloseListview( cl, obj );
- }
- }
- break;
- }
- }
-
- myStringHandleListview( cl, obj );
- break;
- }
-#ifdef __amigaos4__
- case IECLASS_MOUSEWHEEL:
- {
- struct InputEvent *ie = msg->gpi_IEvent;
-
- if ( ie->ie_Y < 0 )
- {
- myStringArrowUp( cl, obj );
- }
- else if ( ie->ie_Y > 0 )
- {
- myStringArrowDown( cl, obj );
- }
-
- myStringHandleListview( cl, obj );
-
- retval = GMR_MEACTIVE;
- break;
- }
-#endif
- default:
- {
- retval = IDoSuperMethodA( cl, obj, (APTR)msg );
- break;
- }
- }
-
- return( retval );
-}
-
-///
-/// myStringClass_GM_GoActive
-
-static uint32 myStringClass_GM_GoActive( Class *cl, Object *obj, struct gpInput *msg )
-{
-struct myStringClassData *data;
-struct Window *win;
-struct Gadget *gad;
-uint32 retval;
-
- data = INST_DATA( cl, obj );
-
- gad = (struct Gadget *)obj;
-
- if ( gad->Flags & GFLG_DISABLED )
- {
- myStringCloseListview( cl, obj );
-
- retval = GMR_NOREUSE;
- }
- else
- {
- // If were not Disabled then set Selected flag
- gad->Flags |= GFLG_SELECTED;
-
- win = msg->gpi_GInfo->gi_Window;
-
- if ( win )
- {
- data->WinXPos = win->LeftEdge + gad->LeftEdge;
- data->WinYPos = win->TopEdge + gad->TopEdge + gad->Height - 1;
- data->WinWidth = gad->Width;
- data->WinHeight = 150;
- }
-
- if ( myStringSearch( cl, obj ))
- {
- // Atleast one entry found, open window if not open
- if ( data->Window == NULL )
- {
- myStringOpenListview( cl, obj, msg );
- }
- }
- else
- {
- // No matches, migth aswell close the window
- myStringCloseListview( cl, obj );
- }
-
- retval = IDoSuperMethodA( cl, obj, (APTR)msg );
- }
-
- return( retval );
-}
-
-///
-/// myStringClass_GM_GoInactive
-
-static uint32 myStringClass_GM_GoInactive( Class *cl, Object *obj, struct gpGoInactive *msg )
-{
-struct myStringClassData *data;
-
- data = INST_DATA( cl, obj );
-
- myStringCloseListview( cl, obj );
-
- return( IDoSuperMethodA( cl, obj, (APTR)msg ));
-}
-
-///
-
-/* Dispatcher */
-
-/// myStringClassDispatcher
-
-static uint32 myStringClassDispatcher( Class *cl, Object *obj, Msg msg )
-{
-struct myStringClassData *data;
-uint32 ret;
-
- if ( msg->MethodID == OM_NEW )
- {
- return( myStringClass_OM_New( cl, obj, (APTR)msg ));
- }
- else if ( msg->MethodID == OM_DISPOSE )
- {
- return( myStringClass_OM_Dispose( cl, obj, (APTR)msg ));
- }
- else
- {
- data = INST_DATA( cl, obj );
-
- ObtainSemaphore( &data->Semaphore );
-
- switch( msg->MethodID )
- {
- /* BOOPSI methods */
- case OM_SET:
- {
- struct TagItem *tag, *tags;
- struct opSet *opSet = (struct opSet *)msg;
- tags = opSet->ops_AttrList;
- while ((tag = NextTagItem(&tags)))
- {
- if (STRINGA_TextVal == tag->ti_Tag)
- {
- URLHistory_AddPage((const char *)tag->ti_Data);
- }
- }
-
- ret = IDoSuperMethodA(cl, obj, (APTR)msg);
- }
- break;
-
-// case OM_SET: ret = TorrentClass_OM_Set( cl, obj, (APTR)msg ); break;
-
- /* Only used for Gadgets */
-// case GM_DOMAIN: ret = myStringClass_GM_Domain( cl, obj, (APTR)msg ); break;
-// case GM_LAYOUT: ret = myStringClass_GM_Layout( cl, obj, (APTR)msg ); break;
-// case GM_CLIPRECT: ret = myStringClass_GM_ClipRect( cl, obj, (APTR)msg ); break;
-// case GM_EXTENT: ret = myStringClass_GM_Extent( cl, obj, (APTR)msg ); break;
-// case GM_RENDER: ret = myStringClass_GM_Render( cl, obj, (APTR)msg ); break;
-// case GM_HITTEST: ret = myStringClass_GM_HitTest( cl, obj, (APTR)msg ); break;
- case GM_HANDLEINPUT: ret = myStringClass_GM_HandleInput( cl, obj, (APTR)msg ); break;
- case GM_GOACTIVE: ret = myStringClass_GM_GoActive( cl, obj, (APTR)msg ); break;
- case GM_GOINACTIVE: ret = myStringClass_GM_GoInactive( cl, obj, (APTR)msg ); break;
-
- /* Unknown method -> delegate to SuperClass */
- default: ret = IDoSuperMethodA( cl, obj, (APTR)msg ); break;
- }
-
- ReleaseSemaphore( &data->Semaphore );
-
- return( ret );
- }
-}
-
-///
-
-/* Create Class */
-
-/// Make String Class
-
-Class *MakeStringClass( void )
-{
- Class *cl;
- cl = MakeClass( NULL, NULL, StringClass, sizeof(struct myStringClassData), 0 );
-
- if ( cl )
- {
- cl->cl_Dispatcher.h_Entry = (uint32(*)())myStringClassDispatcher;
- }
-
- URLHistory_Init();
-
- return( cl );
-}
-
-/// Free String Class
-
-void FreeStringClass(Class *cl)
-{
- URLHistory_Free();
- FreeClass(cl);
-}
-
-///
-
-/* The End */
-
diff --git a/amiga/stringview/stringview.h b/amiga/stringview/stringview.h
deleted file mode 100755
index f989b2a0f..000000000
--- a/amiga/stringview/stringview.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2009 Rene W. Olsen <ac@rebels.com>
- * Copyright 2009 Stephen Fellner <sf.amiga@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <exec/semaphores.h>
-#include <intuition/classes.h>
-#include <intuition/classusr.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* --- */
-
-struct myStringClassData
-{
- struct SignalSemaphore Semaphore;
- uint32 WinXPos;
- uint32 WinYPos;
- uint32 WinWidth;
- uint32 WinHeight;
- struct Window * Window;
- Object * WindowObject;
- Object * ListviewObject;
- struct List ListviewHeader;
- uint32 ListviewCount;
- uint32 ListviewSelected;
- struct List * SearchHeader;
- STRPTR SearchBuffer;
-};
-
-#define STRINGVIEW_Header 0x50000001
-
-/* protos */
-
-Class * MakeStringClass( void );
-void FreeStringClass(Class *);
-
-/* The End */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/amiga/stringview/urlhistory.c b/amiga/stringview/urlhistory.c
deleted file mode 100644
index c58a3770b..000000000
--- a/amiga/stringview/urlhistory.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2009 Rene W. Olsen <ac@rebels.com>
- * Copyright 2009 Stephen Fellner <sf.amiga@gmail.com>
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-
-#include <proto/exec.h>
-
-#include "amiga/os3support.h"
-
-#include "urlhistory.h"
-
-#include "content/urldb.h"
-#include "utils/nsoption.h"
-
-static struct List PageList;
-
-#ifdef __amigaos4__
-#define ALLOCVEC_SHARED(N) AllocVecTags((N), AVT_Type, MEMF_SHARED, TAG_DONE);
-#else
-#define ALLOCVEC_SHARED(N) AllocVec((N), MEMF_SHARED);
-#endif
-
-void URLHistory_Init( void )
-{
- // Initialise page list
- NewList( &PageList );
-}
-
-
-void URLHistory_Free( void )
-{
- struct Node *node;
-
- while(( node = RemHead( &PageList )))
- {
- if( node->ln_Name) FreeVec( node->ln_Name );
- FreeVec( node );
- }
-}
-
-
-void URLHistory_ClearList( void )
-{
- struct Node *node;
-
- while(( node = RemHead( &PageList )))
- {
- if( node->ln_Name) FreeVec( node->ln_Name );
- FreeVec( node );
- }
-}
-
-
-struct List * URLHistory_GetList( void )
-{
- return &PageList;
-}
-
-static bool URLHistoryFound(nsurl *url, const struct url_data *data)
-{
- struct Node *node;
-
- /* skip non-visited pages - disabled for testing
- if(data->visits <= 0) return true;
- */
-
- /* skip this URL if it is already in the list */
- if(URLHistory_FindPage(nsurl_access(url))) return true;
-
- node = ALLOCVEC_SHARED(sizeof(struct Node));
-
- if ( node )
- {
- STRPTR urladd = (STRPTR) ALLOCVEC_SHARED( strlen ( nsurl_access(url) ) + 1);
-
- if ( urladd )
- {
- strcpy(urladd, nsurl_access(url));
- node->ln_Name = urladd;
- AddTail( &PageList, node );
- }
- else
- {
- FreeVec(node);
- }
- }
- return true;
-}
-
-struct Node * URLHistory_FindPage( const char *urlString )
-{
- return FindName(&PageList,urlString);
-}
-
-
-void URLHistory_AddPage( const char * urlString )
-{
- if(!nsoption_bool(url_suggestion)) return;
-
- // Only search if length > 0
- if( strlen( urlString ) > 0 )
- {
- urldb_iterate_partial(urlString, URLHistoryFound);
- }
-}
diff --git a/amiga/stringview/urlhistory.h b/amiga/stringview/urlhistory.h
deleted file mode 100644
index b72792db4..000000000
--- a/amiga/stringview/urlhistory.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2009 Rene W. Olsen <ac@rebels.com>
- * Copyright 2009 Stephen Fellner <sf.amiga@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void URLHistory_Init( void );
-void URLHistory_Free( void );
-struct List * URLHistory_GetList( void );
-void URLHistory_ClearList( void );
-struct Node * URLHistory_FindPage( const char *urlString );
-void URLHistory_AddPage( const char * urlString );
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/amiga/theme.c b/amiga/theme.c
deleted file mode 100644
index ab32b23dd..000000000
--- a/amiga/theme.c
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <proto/clicktab.h>
-#include <proto/datatypes.h>
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <proto/icon.h>
-#include <proto/intuition.h>
-
-#include <gadgets/clicktab.h>
-#include <gadgets/space.h>
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#endif
-#include <intuition/pointerclass.h>
-#include <workbench/icon.h>
-
-#include "utils/messages.h"
-#include "utils/nsoption.h"
-#include "utils/utils.h"
-#include "desktop/searchweb.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/gui.h"
-#include "amiga/drag.h"
-#include "amiga/bitmap.h"
-#include "amiga/schedule.h"
-#include "amiga/theme.h"
-#include "amiga/misc.h"
-
-struct BitMap *throbber = NULL;
-struct bitmap *throbber_nsbm = NULL;
-int throbber_frames, throbber_update_interval;
-static Object *mouseptrobj[AMI_LASTPOINTER+1];
-static struct BitMap *mouseptrbm[AMI_LASTPOINTER+1];
-
-const char *ptrs[AMI_LASTPOINTER+1] = {
- "ptr_default",
- "ptr_point",
- "ptr_caret",
- "ptr_menu",
- "ptr_up",
- "ptr_down",
- "ptr_left",
- "ptr_right",
- "ptr_rightup",
- "ptr_leftdown",
- "ptr_leftup",
- "ptr_rightdown",
- "ptr_cross",
- "ptr_move",
- "ptr_wait",
- "ptr_help",
- "ptr_nodrop",
- "ptr_notallowed",
- "ptr_progress",
- "ptr_blank",
- "ptr_drag"};
-
-const char *ptrs32[AMI_LASTPOINTER+1] = {
- "ptr32_default",
- "ptr32_point",
- "ptr32_caret",
- "ptr32_menu",
- "ptr32_up",
- "ptr32_down",
- "ptr32_left",
- "ptr32_right",
- "ptr32_rightup",
- "ptr32_leftdown",
- "ptr32_leftup",
- "ptr32_rightdown",
- "ptr32_cross",
- "ptr32_move",
- "ptr32_wait",
- "ptr32_help",
- "ptr32_nodrop",
- "ptr32_notallowed",
- "ptr32_progress",
- "ptr32_blank",
- "ptr32_drag"};
-
-#ifdef __amigaos4__
-/* Mapping from NetSurf to AmigaOS mouse pointers */
-int osmouseptr[AMI_LASTPOINTER+1] = {
- POINTERTYPE_NORMAL,
- POINTERTYPE_LINK,
- POINTERTYPE_TEXT,
- POINTERTYPE_CONTEXTMENU,
- POINTERTYPE_NORTHRESIZE,
- POINTERTYPE_SOUTHRESIZE,
- POINTERTYPE_WESTRESIZE,
- POINTERTYPE_EASTRESIZE,
- POINTERTYPE_NORTHEASTRESIZE,
- POINTERTYPE_SOUTHWESTRESIZE,
- POINTERTYPE_NORTHWESTRESIZE,
- POINTERTYPE_SOUTHEASTRESIZE,
- POINTERTYPE_CROSS,
- POINTERTYPE_HAND,
- POINTERTYPE_BUSY,
- POINTERTYPE_HELP,
- POINTERTYPE_NODROP,
- POINTERTYPE_NOTALLOWED,
- POINTERTYPE_PROGRESS,
- POINTERTYPE_NONE,
- POINTERTYPE_DRAGANDDROP};
-#endif
-
-void ami_theme_init(void)
-{
- char themefile[1024];
- BPTR lock = 0;
-
- strcpy(themefile,nsoption_charp(theme));
- AddPart(themefile,"Theme",100);
-
- lock = Lock(themefile,ACCESS_READ);
-
- if(!lock)
- {
- amiga_warn_user("ThemeApplyErr",nsoption_charp(theme));
- strcpy(themefile,"PROGDIR:Resources/Themes/Default/Theme");
- nsoption_set_charp(theme, (char *)strdup("PROGDIR:Resources/Themes/Default"));
- }
- else
- {
- UnLock(lock);
- }
-
- lock = Lock(themefile,ACCESS_READ);
- if(lock)
- {
- UnLock(lock);
- messages_add_from_file(themefile);
- }
-}
-
-void ami_theme_throbber_setup(void)
-{
- char throbberfile[1024];
- struct bitmap *bm;
-
- ami_get_theme_filename(throbberfile,"theme_throbber",false);
- throbber_frames=atoi(messages_get("theme_throbber_frames"));
- throbber_update_interval = atoi(messages_get("theme_throbber_delay"));
- if(throbber_update_interval == 0) throbber_update_interval = 250;
-
- bm = ami_bitmap_from_datatype(throbberfile);
- throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm), NULL);
-
- throbber_width = bitmap_get_width(bm) / throbber_frames;
- throbber_height = bitmap_get_height(bm);
- throbber_nsbm = bm;
-}
-
-void ami_theme_throbber_free(void)
-{
- amiga_bitmap_destroy(throbber_nsbm);
- throbber_nsbm = NULL;
- throbber = NULL;
-}
-
-void ami_get_theme_filename(char *filename, const char *themestring, bool protocol)
-{
- if(protocol)
- strcpy(filename,"file:///");
- else
- strcpy(filename,"");
-
- if(messages_get(themestring)[0] == '*')
- {
- strncat(filename,messages_get(themestring)+1,100);
- }
- else
- {
- strcat(filename, nsoption_charp(theme));
- AddPart(filename, messages_get(themestring), 100);
- }
-}
-
-void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
-{
- ami_set_pointer(g->shared, shape, true);
-}
-
-void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
-{
- if(gwin->mouse_pointer == shape) return;
- ami_update_pointer(gwin->win, shape);
- if(update == true) gwin->mouse_pointer = shape;
-}
-
-/* reset the mouse pointer back to what NetSurf last set it as */
-void ami_reset_pointer(struct gui_window_2 *gwin)
-{
- ami_update_pointer(gwin->win, gwin->mouse_pointer);
-}
-
-void ami_update_pointer(struct Window *win, gui_pointer_shape shape)
-{
- if(drag_save_data) return;
-
- if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 53, 42)) {
-#ifdef __amigaos4__
- BOOL ptr_delay = FALSE;
- if(shape == GUI_POINTER_WAIT) ptr_delay = TRUE;
-
- SetWindowPointer(win,
- WA_PointerType, osmouseptr[shape],
- WA_PointerDelay, ptr_delay,
- TAG_DONE);
-#endif
- } else {
- if(nsoption_bool(os_mouse_pointers))
- {
- switch(shape)
- {
- case GUI_POINTER_DEFAULT:
- SetWindowPointer(win, TAG_DONE);
- break;
-
- case GUI_POINTER_WAIT:
- SetWindowPointer(win,
- WA_BusyPointer, TRUE,
- WA_PointerDelay, TRUE,
- TAG_DONE);
- break;
-
- default:
- if(mouseptrobj[shape]) {
- SetWindowPointer(win, WA_Pointer, mouseptrobj[shape], TAG_DONE);
- } else {
- SetWindowPointer(win, TAG_DONE);
- }
- break;
- }
- }
- else
- {
- if(mouseptrobj[shape])
- {
- SetWindowPointer(win, WA_Pointer, mouseptrobj[shape], TAG_DONE);
- }
- else
- {
- if(shape == GUI_POINTER_WAIT)
- {
- SetWindowPointer(win,
- WA_BusyPointer, TRUE,
- WA_PointerDelay, TRUE,
- TAG_DONE);
- }
- else
- {
- SetWindowPointer(win, TAG_DONE);
- }
- }
- }
- }
-}
-
-void ami_init_mouse_pointers(void)
-{
- if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 53, 42)) return;
-
- int i;
- struct RastPort mouseptr;
- struct DiskObject *dobj;
- uint32 format = IDFMT_BITMAPPED;
- int32 mousexpt=0,mouseypt=0;
-
- InitRastPort(&mouseptr);
-
- for(i=0; i<=AMI_LASTPOINTER; i++) {
- BPTR ptrfile;
- mouseptrbm[i] = NULL;
- mouseptrobj[i] = NULL;
- char ptrfname[1024];
-
-#ifdef __amigaos4__
- if(nsoption_bool(truecolour_mouse_pointers)) {
- ami_get_theme_filename((char *)&ptrfname,ptrs32[i], false);
- if((dobj = GetIconTags(ptrfname,ICONGETA_UseFriendBitMap,TRUE,TAG_DONE))) {
- if(IconControl(dobj, ICONCTRLA_GetImageDataFormat, &format, TAG_DONE)) {
- if(IDFMT_DIRECTMAPPED == format) {
- int32 width = 0, height = 0;
- uint8* data = 0;
- IconControl(dobj,
- ICONCTRLA_GetWidth, &width,
- ICONCTRLA_GetHeight, &height,
- ICONCTRLA_GetImageData1, &data,
- TAG_DONE);
-
- if ((width > 0) && (width <= 64) && (height > 0) && (height <= 64) && data) {
- STRPTR tooltype;
-
- if((tooltype = FindToolType(dobj->do_ToolTypes, "XOFFSET")))
- mousexpt = atoi(tooltype);
-
- if((tooltype = FindToolType(dobj->do_ToolTypes, "YOFFSET")))
- mouseypt = atoi(tooltype);
-
- if ((mousexpt < 0) || (mousexpt >= width))
- mousexpt = 0;
- if ((mouseypt < 0) || (mouseypt >= height))
- mouseypt = 0;
-
- static uint8 dummyPlane[64 * 64 / 8];
- static struct BitMap dummyBitMap = { 64 / 8, 64, 0, 2, 0, { dummyPlane, dummyPlane, 0, 0, 0, 0, 0, 0 }, };
-
- mouseptrobj[i] = NewObject(NULL, "pointerclass",
- POINTERA_BitMap, &dummyBitMap,
- POINTERA_XOffset, -mousexpt,
- POINTERA_YOffset, -mouseypt,
- POINTERA_WordWidth, (width + 15) / 16,
- POINTERA_XResolution, POINTERXRESN_SCREENRES,
- POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT,
- POINTERA_ImageData, data,
- POINTERA_Width, width,
- POINTERA_Height, height,
- TAG_DONE);
- }
- }
- }
- }
- }
-#endif
-
- if(!mouseptrobj[i])
- {
- ami_get_theme_filename(ptrfname,ptrs[i], false);
- if((ptrfile = Open(ptrfname,MODE_OLDFILE)))
- {
- int mx,my;
- UBYTE *pprefsbuf = AllocVecTagList(1061, NULL);
- Read(ptrfile,pprefsbuf,1061);
-
- mouseptrbm[i]=AllocVecTagList(sizeof(struct BitMap), NULL);
- InitBitMap(mouseptrbm[i],2,32,32);
- mouseptrbm[i]->Planes[0] = AllocRaster(32,32);
- mouseptrbm[i]->Planes[1] = AllocRaster(32,32);
- mouseptr.BitMap = mouseptrbm[i];
-
- for(my=0;my<32;my++)
- {
- for(mx=0;mx<32;mx++)
- {
- SetAPen(&mouseptr,pprefsbuf[(my*(33))+mx]-'0');
- WritePixel(&mouseptr,mx,my);
- }
- }
-
- mousexpt = ((pprefsbuf[1056]-'0')*10)+(pprefsbuf[1057]-'0');
- mouseypt = ((pprefsbuf[1059]-'0')*10)+(pprefsbuf[1060]-'0');
-
- mouseptrobj[i] = NewObject(NULL,"pointerclass",
- POINTERA_BitMap,mouseptrbm[i],
- POINTERA_WordWidth,2,
- POINTERA_XOffset,-mousexpt,
- POINTERA_YOffset,-mouseypt,
- POINTERA_XResolution,POINTERXRESN_SCREENRES,
- POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,
- TAG_DONE);
-
- FreeVec(pprefsbuf);
- Close(ptrfile);
- }
-
- }
-
- } // for
-}
-
-void ami_mouse_pointers_free(void)
-{
- if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 53, 42)) return;
-
- int i;
-
- for(i=0;i<=AMI_LASTPOINTER;i++)
- {
- if(mouseptrbm[i])
- {
- FreeRaster(mouseptrbm[i]->Planes[0],32,32);
- FreeRaster(mouseptrbm[i]->Planes[1],32,32);
- FreeVec(mouseptrbm[i]);
- }
- }
-}
-
-void gui_window_start_throbber(struct gui_window *g)
-{
- if(!g) return;
- if(nsoption_bool(kiosk_mode)) return;
-
-#ifdef __amigaos4__
- if(g->tab_node && (g->shared->tabs > 1))
- {
- SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, TRUE, TAG_DONE);
- RefreshGadgets((APTR)g->shared->objects[GID_TABS],
- g->shared->win, NULL);
- }
-#endif
-
- g->throbbing = true;
- if(g->shared->throbber_frame == 0) g->shared->throbber_frame = 1;
- ami_throbber_redraw_schedule(throbber_update_interval, g);
-}
-
-void gui_window_stop_throbber(struct gui_window *g)
-{
- struct IBox *bbox;
-
- if(!g) return;
- if(nsoption_bool(kiosk_mode)) return;
-
-#ifdef __amigaos4__
- if(g->tab_node && (g->shared->tabs > 1))
- {
- SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, FALSE, TAG_DONE);
- RefreshGadgets((APTR)g->shared->objects[GID_TABS],
- g->shared->win, NULL);
- }
-#endif
-
- if(g == g->shared->gw) {
- if(ami_gui_get_space_box(g->shared->objects[GID_THROBBER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- BltBitMapRastPort(throbber, 0, 0, g->shared->win->RPort, bbox->Left,
- bbox->Top, throbber_width, throbber_height, 0x0C0);
-
- ami_gui_free_space_box(bbox);
- }
-
- g->throbbing = false;
- ami_throbber_redraw_schedule(-1, g);
-}
-
-static void ami_throbber_update(void *p)
-{
- struct gui_window *g = (struct gui_window *)p;
- struct IBox *bbox;
- int frame = 0;
-
- if(!g) return;
- if(!g->shared->objects[GID_THROBBER]) return;
-
- if(g->throbbing == true) {
- frame = g->shared->throbber_frame;
- g->shared->throbber_frame++;
- if(g->shared->throbber_frame > (throbber_frames-1))
- g->shared->throbber_frame=1;
- }
-
- if(g->shared->gw == g) {
- if(ami_gui_get_space_box(g->shared->objects[GID_THROBBER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-#ifdef __amigaos4__
- BltBitMapTags(BLITA_SrcX, throbber_width * frame,
- BLITA_SrcY, 0,
- BLITA_DestX, bbox->Left,
- BLITA_DestY, bbox->Top,
- BLITA_Width, throbber_width,
- BLITA_Height, throbber_height,
- BLITA_Source, throbber,
- BLITA_Dest, g->shared->win->RPort,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_DestType, BLITT_RASTPORT,
- // BLITA_UseSrcAlpha, TRUE,
- TAG_DONE);
-#else
- BltBitMapRastPort(throbber, throbber_width * frame, 0, g->shared->win->RPort,
- bbox->Left, bbox->Top, throbber_width, throbber_height, 0xC0);
-#endif
- ami_gui_free_space_box(bbox);
- }
-
- if(frame > 0) ami_throbber_redraw_schedule(throbber_update_interval, g);
-}
-
-void ami_throbber_redraw_schedule(int t, struct gui_window *g)
-{
- ami_schedule(t, ami_throbber_update, g);
-}
-
diff --git a/amiga/theme.h b/amiga/theme.h
deleted file mode 100644
index f295efee1..000000000
--- a/amiga/theme.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_THEME_H
-#define AMIGA_THEME_H
-
-#define AMI_GUI_POINTER_BLANK GUI_POINTER_PROGRESS+1
-#define AMI_GUI_POINTER_DRAG GUI_POINTER_PROGRESS+2
-#define AMI_LASTPOINTER AMI_GUI_POINTER_DRAG
-
-ULONG throbber_width, throbber_height;
-
-void ami_theme_init(void);
-void ami_get_theme_filename(char *filename, const char *themestring, bool protocol);
-
-void ami_theme_throbber_setup(void);
-void ami_theme_throbber_free(void);
-void ami_update_throbber(struct gui_window_2 *g,bool redraw);
-
-void ami_init_mouse_pointers(void);
-void ami_mouse_pointers_free(void);
-void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update);
-void ami_reset_pointer(struct gui_window_2 *gwin);
-/* Use the following ONLY if nothing other than the Intuition window pointer is available,
- * and ALWAYS in preference to SetWindowPointer(), as it features more pointers and uses
- * the correct ones specified in user preferences. */
-void ami_update_pointer(struct Window *win, gui_pointer_shape shape);
-
-void gui_window_start_throbber(struct gui_window *g);
-void gui_window_stop_throbber(struct gui_window *g);
-void ami_throbber_redraw_schedule(int t, struct gui_window *g);
-
-void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
-#endif
-
diff --git a/amiga/tree.c b/amiga/tree.c
deleted file mode 100644
index f147b5e5c..000000000
--- a/amiga/tree.c
+++ /dev/null
@@ -1,1473 +0,0 @@
-/*
- * Copyright 2008 - 2013 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <stdlib.h>
-#include <proto/window.h>
-#include <proto/layout.h>
-#include <proto/space.h>
-#include <proto/label.h>
-#include <proto/scroller.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/button.h>
-#include <proto/bitmap.h>
-#include <proto/graphics.h>
-#include <proto/asl.h>
-#include <proto/utility.h>
-#include <proto/dos.h>
-
-#include <libraries/gadtools.h>
-#include <gadgets/button.h>
-#include <classes/window.h>
-#include <gadgets/space.h>
-#include <images/label.h>
-#include <images/bitmap.h>
-#include <gadgets/layout.h>
-#include <gadgets/scroller.h>
-#include <reaction/reaction_macros.h>
-#include <intuition/icclass.h>
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#endif
-
-#include <assert.h>
-#include <string.h>
-
-#include "utils/nsoption.h"
-#include "utils/utils.h"
-#include "utils/messages.h"
-#include "content/urldb.h"
-#include "content/llcache.h"
-#include "desktop/browser.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/hotlist.h"
-#include "desktop/gui_window.h"
-#include "desktop/sslcert_viewer.h"
-
-#include "amiga/gui.h"
-#include "amiga/tree.h"
-#include "amiga/file.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/utf8.h"
-#include "amiga/sslcert.h"
-#include "amiga/drag.h" /* drag icon stuff */
-#include "amiga/theme.h" /* pointers */
-#include "amiga/filetype.h"
-#include "amiga/schedule.h"
-
-#define AMI_TREE_MENU_ITEMS 26
-#define AMI_TREE_MENU_NEWDIR FULLMENUNUM(1,0,0)
-#define AMI_TREE_MENU_NEWURL FULLMENUNUM(1,1,0)
-#define AMI_TREE_MENU_EDIT FULLMENUNUM(1,3,0)
-#define AMI_TREE_MENU_DELETE FULLMENUNUM(1,5,0)
-#define AMI_TREE_MENU_CLEAR FULLMENUNUM(1,8,0)
-
-enum {
- GID_OPEN = GID_LAST,
- GID_TREE_LAST
-};
-
-
-struct treeview_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_TREE_LAST];
- int type;
- struct NewMenu *menu;
- char *menu_name[AMI_TREE_MENU_ITEMS];
- struct tree *tree;
- struct Hook scrollerhook;
- uint32 key_state;
- uint32 mouse_state;
- int drag_x;
- int drag_y;
- struct timeval lastclick;
- int max_width;
- int max_height;
- struct gui_globals globals;
- struct sslcert_session_data *ssl_data;
- char *wintitle;
- char *sslerr;
- char *sslaccept;
- char *sslreject;
- struct MinList *shared_pens;
-};
-
-struct ami_tree_redraw_req {
- int x;
- int y;
- int width;
- int height;
- struct treeview_window *twin;
-};
-
-#if 0
-void ami_tree_draw(struct treeview_window *twin);
-static void ami_tree_resized(struct tree *tree, int width,
- int height, void *data);
-static void ami_tree_scroll_visible(int y, int height, void *data);
-static void ami_tree_get_window_dimensions(int *width, int *height, void *data);
-#endif
-
-void ami_tree_destroy(struct treeview_window *twin)
-{
- tree_delete(twin->tree);
- FreeVec(twin->shared_pens);
- FreeVec(twin);
-}
-
-struct tree *ami_tree_get_tree(struct treeview_window *twin)
-{
- return twin->tree;
-}
-
-static void ami_tree_resized(struct tree *tree, int width, int height, void *data)
-{
- struct treeview_window *twin = data;
- struct IBox *bbox;
-
- twin->max_height = height;
- twin->max_width = width;
-
- if(twin->win)
- {
- if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if(height == -1) {
- SetAttrs((APTR)twin->objects[OID_MAIN],
- WINDOW_VertProp, -1,
- TAG_DONE);
- } else {
- RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
- SCROLLER_Total, height,
- SCROLLER_Visible, bbox->Height,
- TAG_DONE);
- }
-
- if(width == -1) {
- SetAttrs((APTR)twin->objects[OID_MAIN],
- WINDOW_HorizProp, -1,
- TAG_DONE);
- } else {
- RefreshSetGadgetAttrs((APTR)twin->objects[OID_HSCROLL], twin->win, NULL,
- SCROLLER_Total, width,
- SCROLLER_Visible, bbox->Width,
- TAG_DONE);
- }
- ami_gui_free_space_box(bbox);
- }
-}
-
-/**
- * Retrieves the dimensions of the window with the tree
- *
- * \param data user data assigned to the tree on tree creation
- * \param width will be updated to window width if not NULL
- * \param height will be updated to window height if not NULL
- */
-static void ami_tree_get_window_dimensions(int *width, int *height, void *data)
-{
- struct treeview_window *twin = data;
- struct IBox *bbox;
-
- if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if(width) *width = bbox->Width;
- if(height) *height = bbox->Height;
-
- ami_gui_free_space_box(bbox);
-}
-
-static void ami_tree_redraw_req_dr(void *p)
-{
- struct ami_tree_redraw_req *atrr_data = (struct ami_tree_redraw_req *)p;
- int x = atrr_data->x;
- int y = atrr_data->y;
- int width = atrr_data->width;
- int height = atrr_data->height;
- struct treeview_window *twin = atrr_data->twin;
- struct IBox *bbox;
- int pos_x, pos_y;
- struct RastPort *temprp;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot
- };
-
- if(!twin->win) return;
-
- ami_update_pointer(twin->win, GUI_POINTER_WAIT);
-
- glob = &twin->globals;
- temprp = glob->rp;
- glob->rp = twin->win->RPort;
-
- GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&pos_x);
- GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&pos_y);
-
- if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- x += bbox->Left;
- y += bbox->Top;
-
- if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x);
- if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y);
-
- if(x < pos_x) {
- width -= pos_x - x;
- x = pos_x;
- }
-
- if(y < pos_y) {
- height -= pos_y - y;
- y = pos_y;
- }
-
- tree_draw(twin->tree, bbox->Left - pos_x, bbox->Top - pos_y,
- atrr_data->x, atrr_data->y,
- atrr_data->width, atrr_data->height, &ctx);
-
- FreeVec(atrr_data);
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- glob->rp = temprp;
- glob = &browserglob;
-}
-
-static void ami_tree_redraw_req(void *p)
-{
- struct ami_tree_redraw_req *atrr_data = (struct ami_tree_redraw_req *)p;
- int x = atrr_data->x;
- int y = atrr_data->y;
- int width = atrr_data->width;
- int height = atrr_data->height;
- struct treeview_window *twin = atrr_data->twin;
- struct IBox *bbox;
- int pos_x, pos_y;
- int tile_x, tile_y, tile_w, tile_h;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot
- };
-
- if(!twin->win) return;
-
- ami_update_pointer(twin->win, GUI_POINTER_WAIT);
-
- glob = &twin->globals;
-
- GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&pos_x);
- GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&pos_y);
-
- if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x);
- if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y);
-
- if(x < pos_x) {
- width -= pos_x - x;
- x = pos_x;
- }
-
- if(y < pos_y) {
- height -= pos_y - y;
- y = pos_y;
- }
-
- for(tile_y = y; tile_y < (y + height); tile_y += nsoption_int(redraw_tile_size_y)) {
- tile_h = nsoption_int(redraw_tile_size_y);
- if(((y + height) - tile_y) < nsoption_int(redraw_tile_size_y))
- tile_h = (y + height) - tile_y;
-
- for(tile_x = x; tile_x < (x + width); tile_x += nsoption_int(redraw_tile_size_x)) {
- tile_w = nsoption_int(redraw_tile_size_x);
- if(((x + width) - tile_x) < nsoption_int(redraw_tile_size_x))
- tile_w = (x + width) - tile_x;
-
- tree_draw(twin->tree, - tile_x, - tile_y,
- tile_x, tile_y, tile_w, tile_h, &ctx);
-#ifdef __amigaos4__
- BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, twin->globals.bm,
- BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_DestType, BLITT_RASTPORT,
- BLITA_Dest, twin->win->RPort,
- BLITA_DestX, bbox->Left + tile_x - pos_x,
- BLITA_DestY, bbox->Top + tile_y - pos_y,
- BLITA_Width, tile_w,
- BLITA_Height, tile_h,
- TAG_DONE);
-#else
- BltBitMapRastPort(twin->globals.bm, 0, 0,
- twin->win->RPort, bbox->Left + tile_x - pos_x, bbox->Top + tile_y - pos_y,
- tile_w, tile_h, 0xC0);
-#endif
- }
- }
-
- FreeVec(atrr_data);
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- glob = &browserglob;
-}
-
-static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
-{
- struct ami_tree_redraw_req *atrr_data = AllocVecTagList(sizeof(struct ami_tree_redraw_req), NULL);
-
- atrr_data->x = x;
- atrr_data->y = y;
- atrr_data->width = width;
- atrr_data->height = height;
- atrr_data->twin = (struct treeview_window *)data;
-
- /** /todo Queue these requests properly like the main browser code does
- **/
-
- if(nsoption_bool(direct_render) == false)
- ami_schedule(0, ami_tree_redraw_req, atrr_data);
- else
- ami_schedule(0, ami_tree_redraw_req_dr, atrr_data);
-}
-
-static void ami_tree_draw(struct treeview_window *twin)
-{
- struct IBox *bbox;
- int x, y;
-
- if(!twin) return;
-
- GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&x);
- GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&y);
-
- if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- ami_tree_redraw_request(x, y, bbox->Width, bbox->Height, twin);
-
- ami_gui_free_space_box(bbox);
-}
-
-/**
- * Scrolls the tree to make an element visible
- *
- * \param y Y coordinate of the element
- * \param height height of the element
- * \param data user data assigned to the tree on tree creation
- */
-static void ami_tree_scroll_visible(int y, int height, void *data)
-{
- int sy, scrollset;
- struct IBox *bbox;
- struct treeview_window *twin = data;
-
- GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&sy);
- if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if((y > sy) && ((y + height) < (sy + bbox->Height))) {
- ami_gui_free_space_box(bbox);
- return;
- }
-
- if((y <= sy) || (height > bbox->Height)) scrollset = (ULONG)y;
- else scrollset = sy + (y + height) - (sy + bbox->Height);
-
- RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
- SCROLLER_Top, scrollset,
- TAG_DONE);
-
- ami_gui_free_space_box(bbox);
- ami_tree_draw(twin);
-}
-
-static void ami_tree_scroll(struct treeview_window *twin, int sx, int sy)
-{
- int x, y;
-
- if(!twin) return;
-
- GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&x);
- GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&y);
-
- x += sx;
- y += sy;
-
- if(y < 0) y = 0;
- if(x < 0) x = 0;
-
- RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
- SCROLLER_Top, y,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((APTR)twin->objects[OID_HSCROLL], twin->win, NULL,
- SCROLLER_Top, x,
- TAG_DONE);
-
- ami_tree_draw(twin);
-}
-
-static void ami_tree_drag_icon_show(struct treeview_window *twin)
-{
- const char *type = "project";
- nsurl *url = NULL;
- const char *title = NULL;
-
- if((twin->type == AMI_TREE_COOKIES) ||
- (twin->type == AMI_TREE_SSLCERT)) return; /* No permissable drag operations */
-
- if((tree_drag_status(twin->tree) == TREE_SELECT_DRAG) ||
- (tree_drag_status(twin->tree) == TREE_TEXTAREA_DRAG))
- return;
-
- if((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) {
- hotlist_get_selection(&url, &title);
- } else if((twin->type == AMI_TREE_HISTORY) && (global_history_has_selection())) {
- global_history_get_selection(&url, &title);
- }
-
- if(title && (url == NULL))
- {
- ami_drag_icon_show(twin->win, "drawer");
- }
- else
- {
- ami_drag_icon_show(twin->win, type);
- }
-}
-
-static void ami_tree_drag_end(struct treeview_window *twin, int x, int y)
-{
- struct gui_window_2 *gwin;
- struct treeview_window *tw;
- BOOL drag;
- nsurl *url = NULL;
- const char *title = NULL;
- bool ok = false;
-
- if((drag = ami_drag_in_progress())) ami_drag_icon_close(twin->win);
-
- if(drag && (twin != ami_window_at_pointer(AMINS_TVWINDOW)))
- {
- if((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) {
- ok = hotlist_get_selection(&url, &title);
- } else if((twin->type == AMI_TREE_HISTORY) && (global_history_has_selection())) {
- ok = global_history_get_selection(&url, &title);
- }
-
- if((ok == false) || (url == NULL)) {
- DisplayBeep(scrn);
- } else if(url) {
- if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
- browser_window_navigate(gwin->gw->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- } else if((tw = ami_window_at_pointer(AMINS_TVWINDOW)) &&
- (tw != twin) && (tw->type == AMI_TREE_HOTLIST)) {
- hotlist_add_entry(url, title, true, y);
- }
- }
- tree_mouse_action(twin->tree, twin->mouse_state | twin->key_state,
- twin->drag_x, twin->drag_y); /* Keep the tree happy */
- tree_drag_end(twin->tree, twin->mouse_state,
- twin->drag_x, twin->drag_y,
- twin->drag_x, twin->drag_y); /* Keep the tree happier */
- } else {
- if(tree_drag_status(twin->tree) == TREE_UNKNOWN_DRAG)
- DisplayBeep(scrn);
-
- tree_drag_end(twin->tree, twin->mouse_state,
- twin->drag_x, twin->drag_y, x, y);
- }
-}
-
-HOOKF(void, ami_tree_scroller_hook, Object *, object, struct IntuiMessage *)
-{
- ULONG gid;
- struct treeview_window *twin = hook->h_Data;
- struct IntuiWheelData *wheel;
-
- switch(msg->Class)
- {
- case IDCMP_IDCMPUPDATE:
- gid = GetTagData( GA_ID, 0, msg->IAddress );
-
- switch( gid )
- {
- case OID_HSCROLL:
- case OID_VSCROLL:
- ami_tree_draw(twin);
- break;
- }
- break;
-#ifdef __amigaos4__
- case IDCMP_EXTENDEDMOUSE:
- if(msg->Code == IMSGCODE_INTUIWHEELDATA)
- {
- wheel = (struct IntuiWheelData *)msg->IAddress;
-
- ami_tree_scroll(twin, (wheel->WheelX * 20), (wheel->WheelY * 20));
- }
- break;
-#endif
- }
-}
-
-static void ami_tree_menu(struct treeview_window *twin)
-{
- if(twin->menu) return;
-
- if((twin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, 0))) {
- twin->menu[0].nm_Type = NM_TITLE;
- twin->menu_name[0] = ami_utf8_easy((char *)messages_get("Tree"));
- twin->menu[0].nm_Label = twin->menu_name[0];
-
- twin->menu[1].nm_Type = NM_ITEM;
- twin->menu_name[1] = ami_utf8_easy((char *)messages_get("TreeExport"));
- twin->menu[1].nm_Label = twin->menu_name[1];
- if(twin->type == AMI_TREE_COOKIES)
- twin->menu[1].nm_Flags = NM_ITEMDISABLED;
- twin->menu[1].nm_CommKey = "S";
-
- twin->menu[2].nm_Type = NM_ITEM;
- twin->menu[2].nm_Label = NM_BARLABEL;
-
- twin->menu[3].nm_Type = NM_ITEM;
- twin->menu_name[3] = ami_utf8_easy((char *)messages_get("Expand"));
- twin->menu[3].nm_Label = twin->menu_name[3];
-
- twin->menu[4].nm_Type = NM_SUB;
- twin->menu_name[4] = ami_utf8_easy((char *)messages_get("All"));
- twin->menu[4].nm_Label = twin->menu_name[4];
- twin->menu[4].nm_CommKey = "+";
-
- if(twin->type == AMI_TREE_COOKIES)
- {
- twin->menu_name[5] = ami_utf8_easy((char *)messages_get("Domains"));
- twin->menu_name[6] = ami_utf8_easy((char *)messages_get("Cookies"));
- }
- else
- {
- twin->menu_name[5] = ami_utf8_easy((char *)messages_get("Folders"));
- twin->menu_name[6] = ami_utf8_easy((char *)messages_get("Links"));
- }
-
- twin->menu[5].nm_Type = NM_SUB;
- twin->menu[5].nm_Label = twin->menu_name[5]; // tree-specific title
-
- twin->menu[6].nm_Type = NM_SUB;
- twin->menu[6].nm_Label = twin->menu_name[6]; // tree-specific title
-
- twin->menu[7].nm_Type = NM_ITEM;
- twin->menu_name[7] = ami_utf8_easy((char *)messages_get("Collapse"));
- twin->menu[7].nm_Label = twin->menu_name[7];
-
- twin->menu[8].nm_Type = NM_SUB;
- twin->menu[8].nm_Label = twin->menu_name[4];
- twin->menu[8].nm_CommKey = "-";
-
- twin->menu[9].nm_Type = NM_SUB;
- twin->menu[9].nm_Label = twin->menu_name[5]; // tree-specific title
-
- twin->menu[10].nm_Type = NM_SUB;
- twin->menu[10].nm_Label = twin->menu_name[6]; // tree-specific title
-
- twin->menu[11].nm_Type = NM_ITEM;
- twin->menu[11].nm_Label = NM_BARLABEL;
-
- twin->menu[12].nm_Type = NM_ITEM;
- twin->menu_name[12] = ami_utf8_easy((char *)messages_get("SnapshotWindow"));
- twin->menu[12].nm_Label = twin->menu_name[12];
-
- twin->menu[13].nm_Type = NM_ITEM;
- twin->menu[13].nm_Label = NM_BARLABEL;
-
- twin->menu[14].nm_Type = NM_ITEM;
- twin->menu_name[14] = ami_utf8_easy((char *)messages_get("CloseWindow"));
- twin->menu[14].nm_Label = twin->menu_name[14];
- twin->menu[14].nm_CommKey = "K";
-
- twin->menu[15].nm_Type = NM_TITLE;
- twin->menu_name[15] = ami_utf8_easy((char *)messages_get("Edit"));
- twin->menu[15].nm_Label = twin->menu_name[15];
-
- twin->menu[16].nm_Type = NM_ITEM;
- twin->menu_name[16] = ami_utf8_easy((char *)messages_get("TreeNewFolder"));
- twin->menu[16].nm_Label = twin->menu_name[16];
- twin->menu[16].nm_CommKey = "N";
-
- twin->menu[17].nm_Type = NM_ITEM;
- twin->menu_name[17] = ami_utf8_easy((char *)messages_get("TreeNewLink"));
- twin->menu[17].nm_Label = twin->menu_name[17];
-
- twin->menu[18].nm_Type = NM_ITEM;
- twin->menu[18].nm_Label = NM_BARLABEL;
-
- twin->menu[19].nm_Type = NM_ITEM;
- twin->menu_name[19] = ami_utf8_easy((char *)messages_get("TreeEdit"));
- twin->menu[19].nm_Label = twin->menu_name[19];
- twin->menu[19].nm_CommKey = "E";
-
- twin->menu[20].nm_Type = NM_ITEM;
- twin->menu[20].nm_Label = NM_BARLABEL;
-
- twin->menu[21].nm_Type = NM_ITEM;
- twin->menu_name[21] = ami_utf8_easy((char *)messages_get("TreeDelete"));
- twin->menu[21].nm_Label = twin->menu_name[21];
- twin->menu[21].nm_CommKey = "D";
-
- twin->menu[22].nm_Type = NM_ITEM;
- twin->menu[22].nm_Label = NM_BARLABEL;
-
- twin->menu[23].nm_Type = NM_ITEM;
- twin->menu_name[23] = ami_utf8_easy((char *)messages_get("SelectAllNS"));
- twin->menu[23].nm_Label = twin->menu_name[23];
- twin->menu[23].nm_CommKey = "A";
-
- twin->menu[24].nm_Type = NM_ITEM;
- twin->menu_name[24] = ami_utf8_easy((char *)messages_get("ClearNS"));
- twin->menu[24].nm_Label = twin->menu_name[24];
-
- twin->menu[25].nm_Type = NM_END;
- twin->menu_name[25] = NULL;
- }
-}
-
-static void ami_tree_update_buttons(struct treeview_window *twin)
-{
- if(twin->type == AMI_TREE_SSLCERT) return;
- if(twin->menu == NULL) return;
-
- if(twin->type != AMI_TREE_HOTLIST) {
- OffMenu(twin->win, AMI_TREE_MENU_NEWDIR);
- OffMenu(twin->win, AMI_TREE_MENU_NEWURL);
- }
-
- if((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) {
- OnMenu(twin->win, AMI_TREE_MENU_EDIT);
- } else {
- OffMenu(twin->win, AMI_TREE_MENU_EDIT);
- }
-
- if(((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) ||
- ((twin->type == AMI_TREE_COOKIES) && (cookie_manager_has_selection())) ||
- ((twin->type == AMI_TREE_HISTORY) && (global_history_has_selection()))) {
- OnMenu(twin->win, AMI_TREE_MENU_DELETE);
- OnMenu(twin->win, AMI_TREE_MENU_CLEAR);
- } else {
- OffMenu(twin->win, AMI_TREE_MENU_DELETE);
- OffMenu(twin->win, AMI_TREE_MENU_CLEAR);
- }
-}
-
-void ami_tree_open(struct treeview_window *twin,int type)
-{
- if(twin->win)
- {
- WindowToFront(twin->win);
- ActivateWindow(twin->win);
- return;
- }
-
- twin->type = type;
-
- switch(twin->type)
- {
- case AMI_TREE_HOTLIST:
- twin->wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
- break;
- case AMI_TREE_COOKIES:
- twin->wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
- break;
- case AMI_TREE_HISTORY:
- twin->wintitle = ami_utf8_easy((char *)messages_get("GlobalHistory"));
- break;
- case AMI_TREE_SSLCERT:
- twin->wintitle = ami_utf8_easy((char *)messages_get("SSLCerts"));
- twin->sslerr = ami_utf8_easy((char *)messages_get("SSLError"));
- twin->sslaccept = ami_utf8_easy((char *)messages_get("SSL_Certificate_Accept"));
- twin->sslreject = ami_utf8_easy((char *)messages_get("SSL_Certificate_Reject"));
- break;
- }
-
- twin->scrollerhook.h_Entry = (void *)ami_tree_scroller_hook;
- twin->scrollerhook.h_Data = twin;
-
- ami_init_layers(&twin->globals, 0, 0, false);
- ami_tree_menu(twin);
-
- if(type == AMI_TREE_SSLCERT)
- {
- twin->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, twin->wintitle,
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_SizeBRight, TRUE,
- WA_Height, scrn->Height / 2,
- WA_PubScreen,scrn,
- WA_ReportMouse,TRUE,
- WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
- IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
- WINDOW_HorizProp,1,
- WINDOW_VertProp,1,
- WINDOW_IDCMPHook,&twin->scrollerhook,
- WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,twin,
- /* WINDOW_NewMenu, twin->menu, -> No menu for SSL Cert */
- WINDOW_IconifyGadget, FALSE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, twin->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddImage, LabelObj,
- LABEL_Text, twin->sslerr,
- LabelEnd,
- LAYOUT_AddChild, twin->objects[GID_BROWSER] = SpaceObj,
- GA_ID, GID_BROWSER,
- SPACE_Transparent,TRUE,
- SPACE_BevelStyle, BVS_DISPLAY,
- SpaceEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, twin->objects[GID_OPEN] = ButtonObj,
- GA_ID,GID_OPEN,
- GA_Text, twin->sslaccept,
- GA_RelVerify,TRUE,
- ButtonEnd,
- LAYOUT_AddChild, twin->objects[GID_CANCEL] = ButtonObj,
- GA_ID,GID_CANCEL,
- GA_Text, twin->sslreject,
- GA_RelVerify,TRUE,
- ButtonEnd,
- EndGroup,
- CHILD_WeightedHeight,0,
- EndGroup,
- EndWindow;
- }
- else
- {
- ULONG width = scrn->Width / 2;
- ULONG height = scrn->Height / 2;
- ULONG top = (scrn->Height / 2) - (height / 2);
- ULONG left = (scrn->Width / 2) - (width / 2);
-
- if((type == AMI_TREE_HOTLIST) && (nsoption_int(hotlist_window_xsize) > 0))
- {
- top = nsoption_int(hotlist_window_ypos);
- left = nsoption_int(hotlist_window_xpos);
- width = nsoption_int(hotlist_window_xsize);
- height = nsoption_int(hotlist_window_ysize);
- }
- else if((type == AMI_TREE_HISTORY) && (nsoption_int(history_window_xsize) > 0))
- {
- top = nsoption_int(history_window_ypos);
- left = nsoption_int(history_window_xpos);
- width = nsoption_int(history_window_xsize);
- height = nsoption_int(history_window_ysize);
- }
- else if((type == AMI_TREE_COOKIES) && (nsoption_int(cookies_window_xsize) > 0))
- {
- top = nsoption_int(cookies_window_ypos);
- left = nsoption_int(cookies_window_xpos);
- width = nsoption_int(cookies_window_xsize);
- height = nsoption_int(cookies_window_ysize);
- }
-
- twin->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, twin->wintitle,
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_SizeBRight, TRUE,
- WA_Top, top,
- WA_Left, left,
- WA_Width, width,
- WA_Height, height,
- WA_PubScreen,scrn,
- WA_ReportMouse,TRUE,
- WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
- IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_INTUITICKS,
- WINDOW_HorizProp,1,
- WINDOW_VertProp,1,
- WINDOW_IDCMPHook,&twin->scrollerhook,
- WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,twin,
- WINDOW_NewMenu, twin->menu,
- WINDOW_IconifyGadget, FALSE,
-// WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, twin->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, twin->objects[GID_BROWSER] = SpaceObj,
- GA_ID, GID_BROWSER,
- SPACE_Transparent,TRUE,
- SPACE_BevelStyle, BVS_DISPLAY,
- SpaceEnd,
- EndGroup,
- EndWindow;
- }
-
- twin->win = (struct Window *)RA_OpenWindow(twin->objects[OID_MAIN]);
-
- GetAttr(WINDOW_HorizObject, twin->objects[OID_MAIN],
- (ULONG *)&twin->objects[OID_HSCROLL]);
- GetAttr(WINDOW_VertObject, twin->objects[OID_MAIN],
- (ULONG *)&twin->objects[OID_VSCROLL]);
-
- RefreshSetGadgetAttrs((APTR)twin->objects[OID_VSCROLL], twin->win, NULL,
- GA_ID,OID_VSCROLL,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((APTR)twin->objects[OID_HSCROLL], twin->win, NULL,
- GA_ID,OID_HSCROLL,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
-
- twin->node = AddObject(window_list,AMINS_TVWINDOW);
- twin->node->objstruct = twin;
-
- ami_tree_update_buttons(twin);
- ami_tree_resized(twin->tree, twin->max_width, twin->max_height, twin);
- ami_tree_draw(twin);
-}
-
-void ami_tree_close(struct treeview_window *twin)
-{
- int i;
-
- twin->win = NULL;
- DisposeObject(twin->objects[OID_MAIN]);
- DelObjectNoFree(twin->node);
- ami_plot_release_pens(twin->shared_pens);
- ami_free_layers(&twin->globals);
-
- for(i=0;i<AMI_TREE_MENU_ITEMS;i++) {
- if(twin->menu_name[i] && (twin->menu_name[i] != NM_BARLABEL))
- ami_utf8_free(twin->menu_name[i]);
- twin->menu_name[i] = NULL;
- }
-
- FreeVec(twin->menu);
- twin->menu = NULL;
- ami_utf8_free(twin->wintitle);
- twin->wintitle = NULL;
- if(twin->type == AMI_TREE_SSLCERT) {
- ami_utf8_free(twin->sslerr);
- ami_utf8_free(twin->sslaccept);
- ami_utf8_free(twin->sslreject);
- ami_ssl_free(twin);
- }
-
- if(twin->type == AMI_TREE_HOTLIST)
- ami_gui_hotlist_update_all();
-}
-
-static void ami_tree_update_quals(struct treeview_window *twin)
-{
- uint32 quals = 0;
-#ifdef __amigaos4__
- GetAttr(WINDOW_Qualifier, twin->objects[OID_MAIN], (uint32 *)&quals);
-#else
-#warning FIXME not reading qualifiers on OS3
-#endif
- twin->key_state = 0;
-
- if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT))
- {
- twin->key_state |= BROWSER_MOUSE_MOD_1;
- }
-
- if(quals & IEQUALIFIER_CONTROL)
- {
- twin->key_state |= BROWSER_MOUSE_MOD_2;
- }
-
- if((quals & IEQUALIFIER_LALT) || (quals & IEQUALIFIER_RALT))
- {
- twin->key_state |= BROWSER_MOUSE_MOD_3;
- }
-}
-
-BOOL ami_tree_event(struct treeview_window *twin)
-{
- /* return TRUE if window destroyed */
- ULONG result,storage = 0;
- uint16 code;
- struct MenuItem *item;
- ULONG menunum=0,itemnum=0,subnum=0;
- int xs, ys, x, y;
- struct IBox *bbox;
- struct timeval curtime;
- struct InputEvent *ie;
- int nskey;
- char fname[1024];
- static int drag_x_move = 0, drag_y_move = 0;
-
- while((result = RA_HandleInput(twin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK)
- {
- case GID_OPEN:
- sslcert_viewer_accept(twin->ssl_data);
- ami_tree_close(twin);
- return TRUE;
- break;
-
- case GID_CANCEL:
- sslcert_viewer_reject(twin->ssl_data);
- ami_tree_close(twin);
- return TRUE;
- break;
- }
- break;
-
- case WMHI_MOUSEMOVE:
- drag_x_move = 0;
- drag_y_move = 0;
-
- if(ami_gui_get_space_box(twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- break;
- }
-
- GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&xs);
- x = twin->win->MouseX - bbox->Left + xs;
-
- GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&ys);
- y = twin->win->MouseY - bbox->Top + ys;
-
- if(twin->mouse_state & BROWSER_MOUSE_DRAG_ON)
- {
- ami_drag_icon_move();
-
- if((twin->win->MouseX < bbox->Left) &&
- ((twin->win->MouseX - bbox->Left) > -AMI_DRAG_THRESHOLD))
- drag_x_move = twin->win->MouseX - bbox->Left;
- if((twin->win->MouseX > (bbox->Left + bbox->Width)) &&
- ((twin->win->MouseX - (bbox->Left + bbox->Width)) < AMI_DRAG_THRESHOLD))
- drag_x_move = twin->win->MouseX - (bbox->Left + bbox->Width);
- if((twin->win->MouseY < bbox->Top) &&
- ((twin->win->MouseY - bbox->Top) > -AMI_DRAG_THRESHOLD))
- drag_y_move = twin->win->MouseY - bbox->Top;
- if((twin->win->MouseY > (bbox->Top + bbox->Height)) &&
- ((twin->win->MouseY - (bbox->Top + bbox->Height)) < AMI_DRAG_THRESHOLD))
- drag_y_move = twin->win->MouseY - (bbox->Top + bbox->Height);
-
- tree_mouse_action(twin->tree, twin->mouse_state | twin->key_state, x, y);
- }
-
- if((x >= xs) && (y >= ys) && (x < bbox->Width + xs) &&
- (y < bbox->Height + ys))
- {
- ami_tree_update_quals(twin);
-
- if(twin->mouse_state & BROWSER_MOUSE_PRESS_1)
- {
- if((abs(x - twin->drag_x) + abs(y - twin->drag_y)) > 2)
- {
- tree_mouse_action(twin->tree,
- BROWSER_MOUSE_DRAG_1 | twin->key_state, x, y);
- twin->mouse_state = BROWSER_MOUSE_HOLDING_1 |
- BROWSER_MOUSE_DRAG_ON;
- ami_tree_drag_icon_show(twin);
- }
- }
- else if(twin->mouse_state & BROWSER_MOUSE_PRESS_2)
- {
- if((abs(x - twin->drag_x) + abs(y - twin->drag_y)) > 2)
- {
- tree_mouse_action(twin->tree,
- BROWSER_MOUSE_DRAG_2 | twin->key_state, x, y);
- twin->mouse_state = BROWSER_MOUSE_HOLDING_2 |
- BROWSER_MOUSE_DRAG_ON;
- ami_tree_drag_icon_show(twin);
- }
- }
- }
- ami_gui_free_space_box(bbox);
-
- twin->lastclick.tv_sec = 0;
- twin->lastclick.tv_usec = 0;
- break;
-
- case WMHI_MOUSEBUTTONS:
- if(ami_gui_get_space_box((Object *)twin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- break;
- }
-
- GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&xs);
- x = twin->win->MouseX - bbox->Left + xs;
- GetAttr(SCROLLER_Top, twin->objects[OID_VSCROLL], (ULONG *)&ys);
- y = twin->win->MouseY - bbox->Top + ys;
-
- ami_tree_update_quals(twin);
-
- if((x >= xs) && (y >= ys) && (x < bbox->Width + xs) &&
- (y < bbox->Height + ys))
- {
- switch(code)
- {
- case SELECTDOWN:
- twin->mouse_state = BROWSER_MOUSE_PRESS_1;
- if(twin->drag_x == 0) twin->drag_x = x;
- if(twin->drag_y == 0) twin->drag_y = y;
- break;
- case MIDDLEDOWN:
- twin->mouse_state = BROWSER_MOUSE_PRESS_2;
- if(twin->drag_x == 0) twin->drag_x = x;
- if(twin->drag_y == 0) twin->drag_y = y;
- break;
- case MENUDOWN:
-#if 0
- if(tree_node_has_selection(tree_get_root(twin->tree)) == false)
- {
- tree_set_node_selected_at(twin->tree, x, y, true);
- }
- ami_context_menu_show_tree(twin->tree, twin->win, twin->type);
-#endif
- break;
- }
- }
-
- if(x < xs) x = xs;
- if(y < ys) y = ys;
- if(x >= bbox->Width + xs) x = bbox->Width + xs - 1;
- if(y >= bbox->Height + ys) y = bbox->Height + ys - 1;
-
- ami_gui_free_space_box(bbox);
-
- switch(code)
- {
- case SELECTUP:
- if(twin->mouse_state & BROWSER_MOUSE_PRESS_1)
- {
- CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
-
- twin->mouse_state = BROWSER_MOUSE_CLICK_1;
-
- if(twin->lastclick.tv_sec)
- {
- if(DoubleClick(twin->lastclick.tv_sec,
- twin->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec))
- twin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
- }
- tree_mouse_action(twin->tree,
- twin->mouse_state | twin->key_state, x, y);
-
- if(twin->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK)
- {
- twin->lastclick.tv_sec = 0;
- twin->lastclick.tv_usec = 0;
- }
- else
- {
- twin->lastclick.tv_sec = curtime.tv_sec;
- twin->lastclick.tv_usec = curtime.tv_usec;
- }
- }
- else ami_tree_drag_end(twin, x, y);
-
- twin->mouse_state=0;
- twin->drag_x = 0;
- twin->drag_y = 0;
- break;
-
- case MIDDLEUP:
- if(twin->mouse_state & BROWSER_MOUSE_PRESS_2)
- {
- CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
-
- twin->mouse_state = BROWSER_MOUSE_CLICK_2;
-
- if(twin->lastclick.tv_sec)
- {
- if(DoubleClick(twin->lastclick.tv_sec,
- twin->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec))
- twin->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
- }
- tree_mouse_action(twin->tree,
- twin->mouse_state | twin->key_state, x, y);
-
- if(twin->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK)
- {
- twin->lastclick.tv_sec = 0;
- twin->lastclick.tv_usec = 0;
- }
- else
- {
- twin->lastclick.tv_sec = curtime.tv_sec;
- twin->lastclick.tv_usec = curtime.tv_usec;
- }
- }
- else ami_tree_drag_end(twin, x, y);
-
- twin->mouse_state=0;
- twin->drag_x = 0;
- twin->drag_y = 0;
- break;
-
- case SELECTDOWN:
- case MIDDLEDOWN:
- tree_mouse_action(twin->tree,
- twin->mouse_state | twin->key_state, x, y);
- break;
- }
- ami_tree_update_buttons(twin);
- break;
-
- case WMHI_RAWKEY:
- storage = result & WMHI_GADGETMASK;
-
- GetAttr(WINDOW_InputEvent,twin->objects[OID_MAIN],(ULONG *)&ie);
- nskey = ami_key_to_nskey(storage, ie);
- tree_keypress(twin->tree, nskey);
- if(nskey == NS_KEY_COPY_SELECTION) {
- /* if we've copied a selection we need to clear it - style guide rules */
- tree_keypress(twin->tree, NS_KEY_CLEAR_SELECTION);
- }
- break;
-
- case WMHI_MENUPICK:
- item = ItemAddress(twin->win->MenuStrip,code);
- while (code != MENUNULL)
- {
- menunum = MENUNUM(code);
- itemnum = ITEMNUM(code);
- subnum = SUBNUM(code);
-
- switch(menunum)
- {
- case 0: // tree
- switch(itemnum)
- {
- case 0: // export
- if(AslRequestTags(savereq,
- ASLFR_Window, twin->win,
- ASLFR_SleepWindow, TRUE,
- ASLFR_TitleText,messages_get("NetSurf"),
- ASLFR_Screen,scrn,
- ASLFR_InitialFile,"tree_export.html",
- TAG_DONE))
- {
- strlcpy(fname,savereq->fr_Drawer,1024);
- AddPart(fname,savereq->fr_File,1024);
- ami_update_pointer(twin->win, GUI_POINTER_WAIT);
- if(twin->type == AMI_TREE_HISTORY)
- global_history_export(fname, NULL);
- else if(twin->type == AMI_TREE_HOTLIST)
- hotlist_export(fname, NULL);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- }
- break;
-
- case 2: // expand
- switch(subnum)
- {
- case 0: // all
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_expand(false);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_expand(false);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_expand(false);
- break;
- }
- break;
-
- case 1: // lev 1
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_expand(true);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_expand(true);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_expand(true);
- break;
- }
- break;
-
- case 2: // lev 2
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_expand(false);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_expand(false);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_expand(false);
- break;
- }
- break;
- }
- break;
-
- case 3: // collapse
- switch(subnum)
- {
- case 0: // all
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_contract(true);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_contract(true);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_contract(true);
- break;
- }
- break;
-
- case 1: // lev 1
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_contract(true);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_contract(true);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_contract(true);
- break;
- }
- break;
-
- case 2: // lev 2
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_contract(false);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_contract(false);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_contract(false);
- break;
- }
- break;
- }
- break;
-
- case 5: // snapshot
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- nsoption_set_int(history_window_ypos, twin->win->TopEdge);
- nsoption_set_int(history_window_xpos, twin->win->LeftEdge);
- nsoption_set_int(history_window_xsize, twin->win->Width);
- nsoption_set_int(history_window_ysize, twin->win->Height);
- break;
- case AMI_TREE_COOKIES:
- nsoption_set_int(cookies_window_ypos, twin->win->TopEdge);
- nsoption_set_int(cookies_window_xpos, twin->win->LeftEdge);
- nsoption_set_int(cookies_window_xsize, twin->win->Width);
- nsoption_set_int(cookies_window_ysize, twin->win->Height);
- break;
- case AMI_TREE_HOTLIST:
- nsoption_set_int(hotlist_window_ypos, twin->win->TopEdge);
- nsoption_set_int(hotlist_window_xpos, twin->win->LeftEdge);
- nsoption_set_int(hotlist_window_xsize, twin->win->Width);
- nsoption_set_int(hotlist_window_ysize, twin->win->Height);
- break;
- }
- break;
-
- case 7: // close
- ami_tree_close(twin);
- return TRUE;
- break;
- }
- break;
-
- case 1: // edit
- switch(itemnum)
- {
- case 0: // new folder
- hotlist_add_folder(NULL, false, 0);
- break;
-
- case 1: // new entry
- hotlist_add_entry(NULL, NULL, false, 0);
- break;
-
- case 3: // edit
- hotlist_edit_selection();
- break;
-
- case 5: // delete
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_keypress(NS_KEY_DELETE_LEFT);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_keypress(NS_KEY_DELETE_LEFT);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_keypress(NS_KEY_DELETE_LEFT);
- break;
- }
- ami_tree_update_buttons(twin);
- break;
-
- case 7: // select all
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_keypress(NS_KEY_SELECT_ALL);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_keypress(NS_KEY_SELECT_ALL);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_keypress(NS_KEY_SELECT_ALL);
- break;
- }
- ami_tree_update_buttons(twin);
- break;
-
- case 8: // clear
- switch(twin->type)
- {
- case AMI_TREE_HISTORY:
- global_history_keypress(NS_KEY_CLEAR_SELECTION);
- break;
- case AMI_TREE_COOKIES:
- cookie_manager_keypress(NS_KEY_CLEAR_SELECTION);
- break;
- case AMI_TREE_HOTLIST:
- hotlist_keypress(NS_KEY_CLEAR_SELECTION);
- break;
- }
- ami_tree_update_buttons(twin);
- break;
- }
- break;
- }
-
- code = item->NextSelect;
- }
- break;
-
- case WMHI_NEWSIZE:
- ami_tree_resized(twin->tree, twin->max_width, twin->max_height, twin);
- ami_tree_draw(twin);
- break;
-
- case WMHI_CLOSEWINDOW:
- if(twin->type == AMI_TREE_SSLCERT)
- sslcert_viewer_reject(twin->ssl_data);
- ami_tree_close(twin);
- return TRUE;
- break;
- }
- }
-
- if(drag_x_move || drag_y_move)
- ami_tree_scroll(twin, drag_x_move, drag_y_move);
-
- return FALSE;
-}
-
-
-
-
-
-const struct treeview_table ami_tree_callbacks = {
- .redraw_request = ami_tree_redraw_request,
- .resized = ami_tree_resized,
- .scroll_visible = ami_tree_scroll_visible,
- .get_window_dimensions = ami_tree_get_window_dimensions
-};
-
-struct treeview_window *ami_tree_create(int flags,
- struct sslcert_session_data *ssl_data)
-{
- struct treeview_window *twin;
-
- twin = ami_misc_allocvec_clear(sizeof(struct treeview_window), 0);
-
- if(!twin)
- {
- amiga_warn_user("NoMemory", 0);
- return NULL;
- }
-
- twin->shared_pens = ami_AllocMinList();
- twin->globals.shared_pens = twin->shared_pens;
-
- twin->ssl_data = ssl_data;
- twin->tree = tree_create(flags, &ami_tree_callbacks, twin);
-
- return twin;
-}
-
diff --git a/amiga/tree.h b/amiga/tree.h
deleted file mode 100755
index 39a71d70d..000000000
--- a/amiga/tree.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_TREE_H
-#define AMIGA_TREE_H
-
-#include <exec/types.h>
-#include <intuition/classusr.h>
-#include "amiga/os3support.h"
-#include "desktop/tree.h"
-
-struct treeview_window;
-
-enum
-{
- AMI_TREE_HOTLIST,
- AMI_TREE_HISTORY,
- AMI_TREE_COOKIES,
- AMI_TREE_SSLCERT
-};
-
-struct treeview_window *ami_tree_create(int flags,
- struct sslcert_session_data *ssl_data);
-void ami_tree_destroy(struct treeview_window *twin);
-struct tree *ami_tree_get_tree(struct treeview_window *twin);
-
-void ami_tree_open(struct treeview_window *twin,int type);
-void ami_tree_close(struct treeview_window *twin);
-BOOL ami_tree_event(struct treeview_window *twin);
-
-extern const struct treeview_table ami_tree_callbacks;
-
-#endif
diff --git a/amiga/utf8.c b/amiga/utf8.c
deleted file mode 100755
index 91d7c90c0..000000000
--- a/amiga/utf8.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <proto/exec.h>
-#include <proto/diskfont.h>
-#include <diskfont/diskfonttag.h>
-
-#include "utils/nsoption.h"
-#include "utils/utf8.h"
-#include "desktop/gui_utf8.h"
-
-#include "amiga/utf8.h"
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#else
- encname = nsoption_charp(local_charset);
-#endif
-
- return utf8_from_enc(string,encname,len,result,NULL);
-}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#else
- encname = nsoption_charp(local_charset);
-#endif
-
- return utf8_to_enc(string,encname,len,result);
-}
-
-void ami_utf8_free(char *ptr)
-{
- if(ptr) free(ptr);
-}
-
-char *ami_utf8_easy(const char *string)
-{
- char *localtext;
-
- if(utf8_to_local_encoding(string,strlen(string),&localtext) == NSERROR_OK)
- {
- return localtext;
- }
- else
- {
- return strdup(string);
- }
-}
-
-char *ami_to_utf8_easy(const char *string)
-{
- char *localtext;
-
- if(utf8_from_local_encoding(string,strlen(string),&localtext) == NSERROR_OK)
- {
- return localtext;
- }
- else
- {
- return strdup(string);
- }
-}
-
-
-static struct gui_utf8_table utf8_table = {
- .utf8_to_local = utf8_to_local_encoding,
- .local_to_utf8 = utf8_from_local_encoding,
-};
-
-struct gui_utf8_table *amiga_utf8_table = &utf8_table;
-
diff --git a/amiga/utf8.h b/amiga/utf8.h
deleted file mode 100755
index 065a149f2..000000000
--- a/amiga/utf8.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AMIGA_UTF8_H
-#define AMIGA_UTF8_H
-
-extern struct gui_utf8_table *ami_utf8_table;
-
-char *ami_utf8_easy(const char *string);
-void ami_utf8_free(char *ptr);
-char *ami_to_utf8_easy(const char *string);
-
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
-
-#endif
diff --git a/amiga/version.c b/amiga/version.c
deleted file mode 100644
index bc31d0c96..000000000
--- a/amiga/version.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "testament.h"
-
-/* NB: AmigaOS revision numbers start at 1 (not 0) and are monotonically
- * incremental (v1.20 is higher than v1.3 and not the same as v1.2).
- * Consequently, this version pair may not match the user-facing one in
- * desktop/version.c. Release revisions are prepended with 6000 to ensure
- * they are higher than CI builds, and make this (slightly) less confusing.
- */
-#define NETSURF_VERSION_MAJOR "3"
-#define NETSURF_VERSION_MINOR_EXTERNAL "6"
-#if defined(CI_BUILD)
-#define NETSURF_VERSION_MINOR CI_BUILD
-#else
-#define NETSURF_VERSION_MINOR "6000" NETSURF_VERSION_MINOR_EXTERNAL
-#endif
-
-static const __attribute__((used)) char *verstag = "\0$VER: NetSurf " NETSURF_VERSION_MAJOR "." NETSURF_VERSION_MINOR " (" WT_COMPILEDATE ")\0";
-const char * const verdate = WT_COMPILEDATE;
-const char * const verarexx = NETSURF_VERSION_MAJOR "." NETSURF_VERSION_MINOR_EXTERNAL;
-const char * const wt_revid = WT_REVID;
-