netsurf: branch master updated. release/3.6-184-g074afb4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/074afb43f424d671ce6d0...
...commit http://git.netsurf-browser.org/netsurf.git/commit/074afb43f424d671ce6d00b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/074afb43f424d671ce6d00b14...
The branch, master has been updated
via 074afb43f424d671ce6d00b140df851a26f3ddd7 (commit)
from 3436c097d2be579440a021fe418d22957db7dbe6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=074afb43f424d671ce6...
commit 074afb43f424d671ce6d00b140df851a26f3ddd7
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Process in-window scrollbars using IDCMPUPDATE too
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfd6c4..548ecac 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -689,22 +689,6 @@ ami_cw_event(void *w)
return TRUE;
break;
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK) {
- case GID_CW_HSCROLL:
- case GID_CW_VSCROLL:
- ami_cw_redraw(ami_cw, NULL);
- break;
-
- default:
- /* pass the event to the window owner */
- if(ami_cw->event != NULL)
- if(ami_cw->event(ami_cw, result) == TRUE) {
- return TRUE;
- }
- break;
- }
-
default:
/* pass the event to the window owner */
if(ami_cw->event != NULL)
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index 28f3a4d..2cb3d8e 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -33,6 +33,7 @@
#include <gadgets/space.h>
#include <images/label.h>
+#include <intuition/icclass.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
@@ -251,11 +252,13 @@ ami_crtvrfy_create_window(struct ami_crtvrfy_window *crtvrfy_win)
LAYOUT_AddChild, ami_cw->objects[GID_CW_VSCROLL] = ScrollerObj,
GA_ID, GID_CW_VSCROLL,
GA_RelVerify, TRUE,
+ ICA_TARGET, ICTARGET_IDCMP,
ScrollerEnd,
LayoutEnd,
LAYOUT_AddChild, ami_cw->objects[GID_CW_HSCROLL] = ScrollerObj,
GA_ID, GID_CW_HSCROLL,
GA_RelVerify, TRUE,
+ ICA_TARGET, ICTARGET_IDCMP,
SCROLLER_Orientation, SORIENT_HORIZ,
ScrollerEnd,
LayoutEnd,
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/corewindow.c | 16 ----------------
frontends/amiga/sslcert.c | 3 +++
2 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfd6c4..548ecac 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -689,22 +689,6 @@ ami_cw_event(void *w)
return TRUE;
break;
- case WMHI_GADGETUP:
- switch(result & WMHI_GADGETMASK) {
- case GID_CW_HSCROLL:
- case GID_CW_VSCROLL:
- ami_cw_redraw(ami_cw, NULL);
- break;
-
- default:
- /* pass the event to the window owner */
- if(ami_cw->event != NULL)
- if(ami_cw->event(ami_cw, result) == TRUE) {
- return TRUE;
- }
- break;
- }
-
default:
/* pass the event to the window owner */
if(ami_cw->event != NULL)
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index 28f3a4d..2cb3d8e 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -33,6 +33,7 @@
#include <gadgets/space.h>
#include <images/label.h>
+#include <intuition/icclass.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
@@ -251,11 +252,13 @@ ami_crtvrfy_create_window(struct ami_crtvrfy_window *crtvrfy_win)
LAYOUT_AddChild, ami_cw->objects[GID_CW_VSCROLL] = ScrollerObj,
GA_ID, GID_CW_VSCROLL,
GA_RelVerify, TRUE,
+ ICA_TARGET, ICTARGET_IDCMP,
ScrollerEnd,
LayoutEnd,
LAYOUT_AddChild, ami_cw->objects[GID_CW_HSCROLL] = ScrollerObj,
GA_ID, GID_CW_HSCROLL,
GA_RelVerify, TRUE,
+ ICA_TARGET, ICTARGET_IDCMP,
SCROLLER_Orientation, SORIENT_HORIZ,
ScrollerEnd,
LayoutEnd,
--
NetSurf Browser
6 years, 8 months
netsurf: branch master updated. release/3.6-183-g3436c09
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/3436c097d2be579440a02...
...commit http://git.netsurf-browser.org/netsurf.git/commit/3436c097d2be579440a021f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/3436c097d2be579440a021fe4...
The branch, master has been updated
via 3436c097d2be579440a021fe418d22957db7dbe6 (commit)
from bf3ba5c97bac5aa79c43153311ea0d3d5945bd4d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=3436c097d2be579440a...
commit 3436c097d2be579440a021fe418d22957db7dbe6
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Ensure we free the NM_END menu item
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index d815932..88a875e 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -547,7 +547,7 @@ static void ami_menu_free_labs(struct ami_menu_data **md, int max)
{
int i;
- for(i = 0; i < max; i++) {
+ for(i = 0; i <= max; i++) {
if(md[i] == NULL) continue;
if(md[i]->menulab && (md[i]->menulab != NM_BARLABEL)) {
if(md[i]->menutype & MENU_IMAGE) {
@@ -569,7 +569,7 @@ void ami_free_menulabs(struct ami_menu_data **md)
{
int i;
- for(i=0;i<AMI_MENU_AREXX_MAX;i++) {
+ for(i=0;i<=AMI_MENU_AREXX_MAX;i++) {
if(md[i] == NULL) continue;
if(md[i]->menulab && (md[i]->menulab != NM_BARLABEL)) {
if(md[i]->menutype & MENU_IMAGE) {
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/menu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index d815932..88a875e 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -547,7 +547,7 @@ static void ami_menu_free_labs(struct ami_menu_data **md, int max)
{
int i;
- for(i = 0; i < max; i++) {
+ for(i = 0; i <= max; i++) {
if(md[i] == NULL) continue;
if(md[i]->menulab && (md[i]->menulab != NM_BARLABEL)) {
if(md[i]->menutype & MENU_IMAGE) {
@@ -569,7 +569,7 @@ void ami_free_menulabs(struct ami_menu_data **md)
{
int i;
- for(i=0;i<AMI_MENU_AREXX_MAX;i++) {
+ for(i=0;i<=AMI_MENU_AREXX_MAX;i++) {
if(md[i] == NULL) continue;
if(md[i]->menulab && (md[i]->menulab != NM_BARLABEL)) {
if(md[i]->menutype & MENU_IMAGE) {
--
NetSurf Browser
6 years, 8 months
netsurf: branch chris/amiga-corewindow updated. release/3.6-183-g2e2596b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2e2596b959fff699b426d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2e2596b959fff699b426df9...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2e2596b959fff699b426df9ad...
The branch, chris/amiga-corewindow has been updated
via 2e2596b959fff699b426df9ad8e75208a3380bfb (commit)
via bf3ba5c97bac5aa79c43153311ea0d3d5945bd4d (commit)
via 01e116ee1f5603ef6adeb365f403563a684a47b4 (commit)
via ae8959fa8b46fd21100b72669dcd4da03d91fd97 (commit)
via d885c79743a3169669d6400011ee667aa70e88d9 (commit)
via 22e25971ed4bc23d742cff7823a9f8224f544db7 (commit)
via 0f58d92ab6b4fa13e971b0b07d7ee58e7493c4ee (commit)
via 83840dca49ef6f720e825606555db19b2b659cc6 (commit)
via d1693c27c0d9658b655c158a9652f87683719325 (commit)
via 9be0f4ccaf9696173fb910660352be6648811040 (commit)
via 2d9ed9cbc4bd611d027b07f40bcf2dad68632857 (commit)
from a4bedbbaebec62294bcf6e7210c4c2b0b64f936c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2e2596b959fff699b42...
commit 2e2596b959fff699b426df9ad8e75208a3380bfb
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
attempt visual drag select
needs rastport set as 'complement'
think this is getting overwritten by the corewindow redraw anyway
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfd6c4..aafe33c 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -66,6 +66,12 @@
#include "amiga/schedule.h"
#include "amiga/utf8.h"
+#define DRAWBOX(P, R) Move(P, R.x0, R.y0); \
+ Move(P, R.x1, R.y0); \
+ Move(P, R.x1, R.y1); \
+ Move(P, R.x0, R.y1); \
+ Move(P, R.x0, R.y0);
+
static void
ami_cw_scroller_top(struct ami_corewindow *ami_cw, ULONG *restrict x, ULONG *restrict y)
{
@@ -479,6 +485,8 @@ ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
+ ami_cw->drag_select.x0 = ami_cw->win->MouseX;
+ ami_cw->drag_select.y0 = ami_cw->win->MouseY;
break;
case CORE_WINDOW_DRAG_MOVE:
@@ -500,6 +508,10 @@ ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
+ DRAWBOX(ami_cw->win->RPort, ami_cw->drag_select);
+ ami_cw->drag_select.x1 = ami_cw->win->MouseX;
+ ami_cw->drag_select.y1 = ami_cw->win->MouseY;
+ DRAWBOX(ami_cw->win->RPort, ami_cw->drag_select);
break;
case CORE_WINDOW_DRAG_MOVE:
@@ -521,6 +533,10 @@ ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
+ ami_cw->drag_select.x0 = -1;
+ ami_cw->drag_select.y0 = -1;
+ ami_cw->drag_select.x1 = -1;
+ ami_cw->drag_select.y1 = -1;
break;
case CORE_WINDOW_DRAG_MOVE:
@@ -852,7 +868,12 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->scroll_x_visible = true;
ami_cw->scroll_y_visible = true;
ami_cw->in_border_scroll = false;
+
ami_cw->dragging = false;
+ ami_cw->drag_select.x0 = -1;
+ ami_cw->drag_select.y0 = -1;
+ ami_cw->drag_select.x1 = -1;
+ ami_cw->drag_select.y1 = -1;
/* allocate drawing area etc */
ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save memory
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index cfcd7fc..198d90e 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -20,6 +20,7 @@
#define AMIGA_COREWINDOW_H
#include "netsurf/core_window.h"
+#include "utils/utils.h" /* for struct rect */
#include "amiga/gui.h" /* need to know the size of ami_generic_window :( */
#include "amiga/plotters.h"
@@ -61,6 +62,7 @@ struct ami_corewindow {
bool dragging;
int drag_x_start;
int drag_y_start;
+ struct rect drag_select;
bool close_window; // set to true to close the window during event loop
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 6 +-
Makefile | 4 +-
content/handlers/javascript/duktape/Makefile | 4 +-
desktop/global_history.c | 1 +
frontends/amiga/Makefile | 8 +-
frontends/amiga/arexx.c | 1 -
frontends/amiga/bitmap.c | 1 -
frontends/amiga/corewindow.c | 194 ++--
frontends/amiga/corewindow.h | 2 +
frontends/amiga/desktop-tree.c | 353 ------
frontends/amiga/desktop-tree.h | 88 --
frontends/amiga/gui.c | 2 -
frontends/amiga/history.c | 3 -
frontends/amiga/hotlist.c | 3 -
frontends/amiga/tree.c | 1484 --------------------------
frontends/amiga/tree.h | 47 -
frontends/atari/Makefile | 14 +-
frontends/beos/Makefile | 18 +-
frontends/cocoa/Makefile | 10 +-
frontends/framebuffer/Makefile | 4 +-
frontends/gtk/Makefile | 6 +-
frontends/riscos/Makefile | 2 +-
frontends/windows/Makefile | 29 +-
frontends/windows/res/installer.nsi | 67 +-
test/Makefile | 11 +-
25 files changed, 240 insertions(+), 2122 deletions(-)
delete mode 100644 frontends/amiga/desktop-tree.c
delete mode 100644 frontends/amiga/desktop-tree.h
delete mode 100644 frontends/amiga/tree.c
delete mode 100755 frontends/amiga/tree.h
diff --git a/.gitignore b/.gitignore
index b16d6f9..35de191 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,10 +16,6 @@ frontends/gtk/res/fr/Messages
frontends/gtk/res/de/Messages
frontends/gtk/res/nl/Messages
frontends/gtk/res/it/Messages
-test/nsoption
-test/nsurl
-test/urldbtest
-test/llcache
codedocs
nsgtk
nsfb
@@ -34,4 +30,4 @@ NetSurf.dmg
NetSurf
core
nsfb-*
-build-*
+build
diff --git a/Makefile b/Makefile
index 2596e7a..5f2697f 100644
--- a/Makefile
+++ b/Makefile
@@ -344,7 +344,7 @@ endif
CC := $(CCACHE) $(CC)
# Target paths
-OBJROOT = build-$(HOST)-$(TARGET)$(SUBTARGET)
+OBJROOT = build/$(HOST)-$(TARGET)$(SUBTARGET)
DEPROOT := $(OBJROOT)/deps
TOOLROOT := $(OBJROOT)/tools
@@ -640,7 +640,7 @@ define split_messages
$$(MESSAGES_TARGET)/$(1)/Messages.tmp: resources/FatMessages
$$(VQ)echo "MSGSPLIT: Language: $(1) Filter: $$(MESSAGES_FILTER)"
- $$(Q)mkdir -p $$(MESSAGES_TARGET)/$(1)
+ $$(Q)$$(MKDIR) -p $$(MESSAGES_TARGET)/$(1)
$$(Q)$$(SPLIT_MESSAGES) -l $(1) -p $$(MESSAGES_FILTER) -f messages -o $$@ $$<
$$(MESSAGES_TARGET)/$(1)/Messages: $$(MESSAGES_TARGET)/$(1)/Messages.tmp
diff --git a/content/handlers/javascript/duktape/Makefile b/content/handlers/javascript/duktape/Makefile
index 37e33d5..fce79de 100644
--- a/content/handlers/javascript/duktape/Makefile
+++ b/content/handlers/javascript/duktape/Makefile
@@ -12,13 +12,13 @@ BINDINGS := $(wildcard content/handlers/javascript/duktape/*.bnd)
GBFLAGS+=-D
$(OBJROOT)/duktape/binding.h $(OBJROOT)/duktape/Makefile: content/handlers/javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
+ $(Q)$(MKDIR) -p $(OBJROOT)/duktape
$(VQ)echo " GENBIND: $<"
$(Q)nsgenbind $(GBFLAGS) -I content/handlers/javascript/WebIDL $< $(OBJROOT)/duktape
# create unimplemented report for doxygen
Docs/UnimplementedJavascript.txt: content/handlers/javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
+ $(Q)$(MKDIR) -p $(OBJROOT)/duktape
$(VQ)echo "/** \page unimplemented Unimplemented javascript bindings" > $@
$(VQ)echo "This is a list of all the binding methods, getters and setters without an implementation in a binding." >> $@
$(VQ)echo "" >> $@
diff --git a/desktop/global_history.c b/desktop/global_history.c
index b6f4882..a19349f 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -803,6 +803,7 @@ nserror global_history_fini(void)
/* Destroy the global history treeview */
err = treeview_destroy(gh_ctx.tree);
+ gh_ctx.tree = NULL;
/* Free global history treeview entry fields */
for (i = 0; i < N_FIELDS; i++)
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index 8115f2f..985a085 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -36,7 +36,7 @@ MESSAGES_FILTER=ami
# ----------------------------------------------------------------------------
# sources purely for the Amiga build
-S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \
+S_FRONTEND := gui.c history.c hotlist.c schedule.c file.c \
misc.c bitmap.c font.c filetype.c utf8.c login.c memory.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 \
@@ -46,7 +46,7 @@ S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.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 \
- nsoption.c desktop-tree.c corewindow.c
+ nsoption.c corewindow.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
@@ -76,9 +76,9 @@ 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)$(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)$(MKDIR) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -rp $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -rp $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cat resources/SearchEngines $(AMIGA_PKG_DIR)/SearchEngines >$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/SearchEngines
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 63e418a..7bb2f58 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -40,7 +40,6 @@
#include "amiga/gui.h"
#include "amiga/download.h"
#include "amiga/hotlist.h"
-#include "amiga/tree.h"
#include "amiga/libs.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 5b5d6bb..5fc772b 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -706,7 +706,6 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm)
{
if(bitmap == NULL) return NULL;
- LOG("Getting native BitMap for %p", bitmap);
if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height, friendbm);
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 03ad509..aafe33c 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -66,6 +66,12 @@
#include "amiga/schedule.h"
#include "amiga/utf8.h"
+#define DRAWBOX(P, R) Move(P, R.x0, R.y0); \
+ Move(P, R.x1, R.y0); \
+ Move(P, R.x1, R.y1); \
+ Move(P, R.x0, R.y1); \
+ Move(P, R.x0, R.y0);
+
static void
ami_cw_scroller_top(struct ami_corewindow *ami_cw, ULONG *restrict x, ULONG *restrict y)
{
@@ -107,13 +113,27 @@ ami_cw_coord_amiga_to_ns(struct ami_corewindow *ami_cw, int *restrict x, int *re
/**
* check if mouse has moved since position was stored
+ * @param ami_cw corewindow
+ * @param x current x position
+ * @param y current y position
+ * @param click true to check since last click, false since last drag (press)
* @return true if it has, false otherwise
*/
static bool
-ami_cw_mouse_moved(struct ami_corewindow *ami_cw, int x, int y)
+ami_cw_mouse_moved(struct ami_corewindow *ami_cw, int x, int y, bool click)
{
- if(abs(x - ami_cw->mouse_x_click) > 5) return true;
- if(abs(y - ami_cw->mouse_y_click) > 5) return true;
+ int mx, my;
+
+ if(click == true) {
+ mx = ami_cw->mouse_x_click;
+ my = ami_cw->mouse_y_click;
+ } else {
+ mx = ami_cw->drag_x_start;
+ my = ami_cw->drag_y_start;
+ }
+
+ if(abs(x - mx) > 5) return true;
+ if(abs(y - my) > 5) return true;
return false;
}
@@ -138,11 +158,10 @@ ami_cw_mouse_pos(struct ami_corewindow *ami_cw, int *restrict x, int *restrict y
xm -= bbox->Left;
ym -= bbox->Top;
- ami_gui_free_space_box(bbox);
-
if((xm < 0) || (ym < 0) || (xm > bbox->Width) || (ym > bbox->Height))
return false;
+ ami_gui_free_space_box(bbox);
ami_cw_scroller_top(ami_cw, &xs, &ys);
xm += xs;
@@ -458,12 +477,16 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
static void
ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
{
+ if(ami_cw->dragging == true) return;
+
ami_cw->dragging = true;
ami_cw->drag_x_start = x;
ami_cw->drag_y_start = y;
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
+ ami_cw->drag_select.x0 = ami_cw->win->MouseX;
+ ami_cw->drag_select.y0 = ami_cw->win->MouseY;
break;
case CORE_WINDOW_DRAG_MOVE:
@@ -481,8 +504,14 @@ ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
static void
ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
{
+ if(ami_cw->dragging == false) return;
+
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
+ DRAWBOX(ami_cw->win->RPort, ami_cw->drag_select);
+ ami_cw->drag_select.x1 = ami_cw->win->MouseX;
+ ami_cw->drag_select.y1 = ami_cw->win->MouseY;
+ DRAWBOX(ami_cw->win->RPort, ami_cw->drag_select);
break;
case CORE_WINDOW_DRAG_MOVE:
@@ -500,10 +529,14 @@ ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
static void
ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
{
- ami_cw->dragging = false;
-
+ if(ami_cw->dragging == false) return;
+
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
+ ami_cw->drag_select.x0 = -1;
+ ami_cw->drag_select.y0 = -1;
+ ami_cw->drag_select.x1 = -1;
+ ami_cw->drag_select.y1 = -1;
break;
case CORE_WINDOW_DRAG_MOVE:
@@ -516,6 +549,9 @@ ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
default:
break;
}
+
+ ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
+ ami_cw->dragging = false;
}
/**
@@ -545,8 +581,8 @@ ami_cw_event(void *w)
switch(result & WMHI_CLASSMASK) {
case WMHI_MOUSEMOVE:
- if(ami_cw->dragging == false) {
- if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+ if(ami_cw_mouse_pos(ami_cw, &x, &y) == true) {
+ if(ami_cw_mouse_moved(ami_cw, x, y, false)) {
if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
/* Start button 1 drag */
ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
@@ -560,76 +596,94 @@ ami_cw_event(void *w)
}
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
-
- if ((ami_cw->drag_status == CORE_WINDOW_DRAG_SELECTION) ||
- (ami_cw->drag_status == CORE_WINDOW_DRAG_MOVE)) {
+ if(ami_cw->mouse_state & BROWSER_MOUSE_DRAG_ON) {
ami_cw_drag_start(ami_cw, x, y);
}
+ } else {
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
}
- } else {
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw_drag_progress(ami_cw, x, y);
}
+ ami_cw_drag_progress(ami_cw, x, y);
break;
case WMHI_MOUSEBUTTONS:
- if(ami_cw_mouse_pos(ami_cw, &x, &y) == false)
- break;
-
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
-
- switch(code) {
- case SELECTDOWN:
- ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
- break;
-
- case MIDDLEDOWN:
- ami_cw->mouse_state = BROWSER_MOUSE_PRESS_2;
- break;
-
- case SELECTUP:
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
- CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
-
- ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
-
- if(ami_cw->lastclick.tv_sec) {
- if((ami_cw_mouse_moved(ami_cw, x, y) == false) &&
- (DoubleClick(ami_cw->lastclick.tv_sec,
- ami_cw->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec)))
- ami_cw->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
+ if(ami_cw_mouse_pos(ami_cw, &x, &y) == true) {
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ switch(code) {
+ case SELECTDOWN:
+ ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+ break;
+
+ case MIDDLEDOWN:
+ ami_cw->mouse_state = BROWSER_MOUSE_PRESS_2;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+ break;
+
+ case SELECTUP:
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
+
+ ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
+
+ if(ami_cw->lastclick.tv_sec) {
+ if((ami_cw_mouse_moved(ami_cw, x, y, true) == false) &&
+ (DoubleClick(ami_cw->lastclick.tv_sec,
+ ami_cw->lastclick.tv_usec,
+ curtime.tv_sec, curtime.tv_usec)))
+ ami_cw->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
+ }
+
+ ami_cw->mouse_x_click = x;
+ ami_cw->mouse_y_click = y;
+
+ if(ami_cw->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
+ ami_cw->lastclick.tv_sec = 0;
+ ami_cw->lastclick.tv_usec = 0;
+ } else {
+ ami_cw->lastclick.tv_sec = curtime.tv_sec;
+ ami_cw->lastclick.tv_usec = curtime.tv_usec;
+ }
}
- ami_cw->mouse_x_click = x;
- ami_cw->mouse_y_click = y;
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
- if(ami_cw->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
- ami_cw->lastclick.tv_sec = 0;
- ami_cw->lastclick.tv_usec = 0;
- } else {
- ami_cw->lastclick.tv_sec = curtime.tv_sec;
- ami_cw->lastclick.tv_usec = curtime.tv_usec;
- }
- }
+ case MIDDLEUP:
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2)
+ ami_cw->mouse_state = BROWSER_MOUSE_CLICK_2;
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
- break;
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
+ }
- case MIDDLEUP:
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2)
- ami_cw->mouse_state = BROWSER_MOUSE_CLICK_2;
+ if(ami_cw->mouse_state == BROWSER_MOUSE_HOVER) {
+ ami_cw_drag_end(ami_cw, x, y);
+ }
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
- break;
- }
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
-
- if((ami_cw->dragging == true) && (ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
- ami_cw_drag_end(ami_cw, x, y);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ } else {
+ /* event is happening away from our corewindow area */
+ switch(code) {
+ case SELECTUP:
+ case MIDDLEUP:
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
+
+ default:
+ break;
+ }
+
+ if(ami_cw->mouse_state == BROWSER_MOUSE_HOVER) {
+ ami_cw_drag_end(ami_cw, x, y);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state,
+ ami_cw->drag_x_start, ami_cw->drag_y_start); // placate core
+ }
}
break;
@@ -815,8 +869,14 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->scroll_y_visible = true;
ami_cw->in_border_scroll = false;
+ ami_cw->dragging = false;
+ ami_cw->drag_select.x0 = -1;
+ ami_cw->drag_select.y0 = -1;
+ ami_cw->drag_select.x1 = -1;
+ ami_cw->drag_select.y1 = -1;
+
/* allocate drawing area etc */
- ami_init_layers(&ami_cw->gg, 0, 0, false);
+ ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save memory
ami_cw->gg.shared_pens = ami_AllocMinList();
ami_cw->deferred_rects = NewObjList();
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index cfcd7fc..198d90e 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -20,6 +20,7 @@
#define AMIGA_COREWINDOW_H
#include "netsurf/core_window.h"
+#include "utils/utils.h" /* for struct rect */
#include "amiga/gui.h" /* need to know the size of ami_generic_window :( */
#include "amiga/plotters.h"
@@ -61,6 +62,7 @@ struct ami_corewindow {
bool dragging;
int drag_x_start;
int drag_y_start;
+ struct rect drag_select;
bool close_window; // set to true to close the window during event loop
diff --git a/frontends/amiga/desktop-tree.c b/frontends/amiga/desktop-tree.c
deleted file mode 100644
index 3fb41ed..0000000
--- a/frontends/amiga/desktop-tree.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt(a)users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "netsurf/misc.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/core_window.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "desktop/gui_internal.h"
-#include "desktop/treeview.h"
-#include "desktop/hotlist.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/sslcert_viewer.h"
-
-#include "amiga/desktop-tree.h"
-
-struct tree {
- unsigned int flags; /* Tree flags */
- tree_drag_type drag;
- const struct treeview_table *callbacks;
- void *client_data; /* User assigned data for the callbacks */
-};
-
-
-struct sslcert_session_data *ssl_current_session = NULL;
-const char *tree_hotlist_path = NULL;
-
-static void treeview_test_redraw_request(struct core_window *cw,
- const struct rect *r)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->redraw_request(r->x0, r->y0,
- r->x1 - r->x0, r->y1 - r->y0,
- tree->client_data);
-}
-
-static void treeview_test_update_size(struct core_window *cw,
- int width, int height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->resized(tree, width, height, tree->client_data);
-}
-
-static void treeview_test_scroll_visible(struct core_window *cw,
- const struct rect *r)
-{
-}
-
-static void treeview_test_get_window_dimensions(struct core_window *cw,
- int *width, int *height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->get_window_dimensions(width, height,
- tree->client_data);
-}
-
-static void treeview_test_drag_status(struct core_window *cw,
- core_window_drag_status ds)
-{
- struct tree *tree = (struct tree *)cw;
-
- switch (ds) {
- case CORE_WINDOW_DRAG_NONE:
- tree->drag = TREE_NO_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_SELECTION:
- tree->drag = TREE_SELECT_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_MOVE:
- tree->drag = TREE_MOVE_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_TEXT_SELECTION:
- tree->drag = TREE_TEXTAREA_DRAG;
- break;
-
- default:
- break;
- }
-}
-
-struct core_window_callback_table cw_t = {
- .redraw_request = treeview_test_redraw_request,
- .update_size = treeview_test_update_size,
- .scroll_visible = treeview_test_scroll_visible,
- .get_window_dimensions = treeview_test_get_window_dimensions,
- .drag_status = treeview_test_drag_status
-};
-
-static bool treeview_test_init(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new global history.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_init(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new hotlist.", 0);
- err = hotlist_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init hotlist manager.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session == NULL &&
- "Call sslcert_viewer_init directly, "
- "this compat. layer can't cope with simultanious "
- "sslcert viewers");
- err = sslcert_viewer_init(&cw_t, (struct core_window *)tree,
- ssl_current_session);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_fini(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_fini(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise hotlist.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- err = sslcert_viewer_fini(ssl_current_session);
- ssl_current_session = NULL;
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_redraw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- struct rect clip;
-
- clip.x0 = clip_x;
- clip.y0 = clip_y;
- clip.x1 = clip_x + clip_width;
- clip.y1 = clip_y + clip_height;
-
- switch (tree->flags) {
- case TREE_SSLCERT:
- if (ssl_current_session != NULL) {
- sslcert_viewer_redraw(ssl_current_session, x, y, &clip, ctx);
- }
- return true;
- case TREE_COOKIES:
- cookie_manager_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HISTORY:
- global_history_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HOTLIST:
- hotlist_redraw(x, y, &clip, ctx);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_mouse_action(struct tree *tree,
- browser_mouse_state mouse, int x, int y)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
- return true;
- case TREE_COOKIES:
- cookie_manager_mouse_action(mouse, x, y);
- return true;
- case TREE_HISTORY:
- global_history_mouse_action(mouse, x, y);
- return true;
- case TREE_HOTLIST:
- hotlist_mouse_action(mouse, x, y);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_keypress(struct tree *tree, uint32_t key)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_keypress(ssl_current_session, key);
- return true;
- case TREE_COOKIES:
- cookie_manager_keypress(key);
- return true;
- case TREE_HISTORY:
- global_history_keypress(key);
- return true;
- case TREE_HOTLIST:
- hotlist_keypress(key);
- return true;
- }
-
- return false;
-}
-
-/* -------------------------------------------------------------------------- */
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks, void *client_data)
-{
- struct tree *tree;
-
- tree = calloc(sizeof(struct tree), 1);
- if (tree == NULL) {
- LOG("calloc failed");
- guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0);
- return NULL;
- }
-
- tree->flags = flags;
- tree->drag = TREE_NO_DRAG;
- tree->callbacks = callbacks;
- tree->client_data = client_data;
-
- treeview_test_init(tree);
-
- return tree;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree)
-{
- treeview_test_fini(tree);
- free(tree);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- assert(tree != NULL);
-
- treeview_test_redraw(tree, x, y, clip_x, clip_y,
- clip_width, clip_height, ctx);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
- int y)
-{
- assert(tree != NULL);
-
- if (treeview_test_mouse_action(tree, mouse, x, y)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1)
-{
- assert(tree != NULL);
-
- treeview_test_mouse_action(tree, BROWSER_MOUSE_HOVER, x1, y1);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_keypress(struct tree *tree, uint32_t key)
-{
- if (treeview_test_keypress(tree, key)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-tree_drag_type tree_drag_status(struct tree *tree)
-{
- assert(tree != NULL);
- return tree->drag;
-}
diff --git a/frontends/amiga/desktop-tree.h b/frontends/amiga/desktop-tree.h
deleted file mode 100644
index f8864e1..0000000
--- a/frontends/amiga/desktop-tree.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt(a)users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#ifndef _NETSURF_DESKTOP_TREE_H_
-#define _NETSURF_DESKTOP_TREE_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "netsurf/mouse.h"
-
-struct sslcert_session_data;
-struct tree;
-struct redraw_context;
-
-/**
- * Current ssl session data for treeview
- *
- * @todo FIXME global certificate treeview state must go away, this is
- * just wrong.
- */
-extern struct sslcert_session_data *ssl_current_session;
-extern const char *tree_hotlist_path;
-
-/* Tree flags */
-enum tree_flags {
- TREE_HISTORY,
- TREE_COOKIES,
- TREE_SSLCERT,
- TREE_HOTLIST
-};
-
-typedef enum {
- TREE_NO_DRAG = 0,
- TREE_SELECT_DRAG,
- TREE_MOVE_DRAG,
- TREE_TEXTAREA_DRAG, /** < A drag that is passed to a textarea */
- TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
-} tree_drag_type;
-
-/** callbacks to perform necessary operations on treeview. */
-struct treeview_table {
- void (*redraw_request)(int x, int y, int width, int height,
- void *data); /**< request a redraw. */
- void (*resized)(struct tree *tree, int width, int height,
- void *data); /**< resize treeview area. */
- void (*scroll_visible)(int y, int height, void *data); /**< scroll visible treeview area. */
- void (*get_window_dimensions)(int *width, int *height, void *data); /**< get dimensions of window */
-};
-
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks,
- void *client_data);
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree);
-tree_drag_type tree_drag_status(struct tree *tree);
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx);
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
- int x, int y);
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1);
-bool tree_keypress(struct tree *tree, uint32_t key);
-
-
-#endif
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 4e88a0e..e27d105 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -118,7 +118,6 @@
#include "desktop/searchweb.h"
/* NetSurf Amiga platform includes */
-#include "amiga/desktop-tree.h"
#include "amiga/gui.h"
#include "amiga/arexx.h"
#include "amiga/bitmap.h"
@@ -151,7 +150,6 @@
#include "amiga/search.h"
#include "amiga/selectmenu.h"
#include "amiga/theme.h"
-#include "amiga/tree.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 2210301..f326f91 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -190,9 +190,6 @@ ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
struct gui_window_2 *gwin;
struct ami_corewindow *cw;
- if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
- return NSERROR_OK;
-
if(global_history_has_selection()) {
ok = global_history_get_selection(&url, &title);
}
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index 422586a..a0fd303 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -242,9 +242,6 @@ ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
struct gui_window_2 *gwin;
struct ami_corewindow *cw;
- if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
- return NSERROR_OK;
-
if(hotlist_has_selection()) {
ok = hotlist_get_selection(&url, &title);
}
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
deleted file mode 100644
index b9747c0..0000000
--- a/frontends/amiga/tree.c
+++ /dev/null
@@ -1,1484 +0,0 @@
-/*
- * Copyright 2008 - 2013 Chris Young <chris(a)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 "netsurf/browser_window.h"
-#include "netsurf/window.h"
-#include "netsurf/keypress.h"
-#include "content/llcache.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/hotlist.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"
-#include "amiga/plotters.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 ami_generic_window w;
- 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;
-};
-
-static BOOL ami_tree_event(void *w);
-
-static const struct ami_win_event_table ami_tree_table = {
- ami_tree_event,
- ami_tree_close,
-};
-
-#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);
- free(twin->shared_pens);
- free(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", "");
- free(atrr_data);
- 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);
-
- free(atrr_data);
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- glob->rp = temprp;
- ami_gui_set_default_gg();
-}
-
-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
- };
-
- free(atrr_data);
-
- 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
- }
- }
-
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- ami_gui_set_default_gg();
-}
-
-static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
-{
- struct ami_tree_redraw_req *atrr_data = malloc(sizeof(struct ami_tree_redraw_req));
-
- 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 = calloc(1, sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS))) {
- 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);
-
- ami_gui_win_list_add(twin, AMINS_TVWINDOW, &ami_tree_table);
-
- 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(void *w)
-{
- struct treeview_window *twin = (struct treeview_window *)w;
- int i;
-
- twin->win = NULL;
- DisposeObject(twin->objects[OID_MAIN]);
- ami_gui_win_list_remove(twin);
- 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;
- }
-
- free(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;
- }
-}
-
-static BOOL ami_tree_event(void *w)
-{
- /* return TRUE if window destroyed */
- struct treeview_window *twin = (struct treeview_window *)w;
- 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 = calloc(1, sizeof(struct treeview_window));
-
- 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/frontends/amiga/tree.h b/frontends/amiga/tree.h
deleted file mode 100755
index a8cada5..0000000
--- a/frontends/amiga/tree.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris(a)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 "amiga/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(void *w); /* for Arexx interface only */
-
-extern const struct treeview_table ami_tree_callbacks;
-
-#endif
diff --git a/frontends/atari/Makefile b/frontends/atari/Makefile
index 60b7f87..7bc441c 100644
--- a/frontends/atari/Makefile
+++ b/frontends/atari/Makefile
@@ -147,13 +147,13 @@ ifneq ($(strip $(STACK)),)
endif
$(Q)rm -rf $(ATARI_TARGET_DIR)
$(Q)rm -rf $(PKGNAME)
- $(Q)mkdir $(ATARI_TARGET_DIR)
- $(Q)mkdir $(ATARI_TARGET_DIR)doc
- $(Q)mkdir $(ATARI_TARGET_DIR)downloads
- $(Q)mkdir $(ATARI_TARGET_DIR)res
- $(Q)mkdir $(ATARI_TARGET_DIR)res/fonts
- $(Q)mkdir $(ATARI_TARGET_DIR)res/icons
- $(Q)mkdir $(ATARI_TARGET_DIR)res/cache
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)doc
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)downloads
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/fonts
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/icons
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/cache
$(Q)touch $(ATARI_TARGET_DIR)cookies
$(Q)touch $(ATARI_TARGET_DIR)url.db
diff --git a/frontends/beos/Makefile b/frontends/beos/Makefile
index f40cce4..7693ac3 100644
--- a/frontends/beos/Makefile
+++ b/frontends/beos/Makefile
@@ -90,15 +90,15 @@ $(RSRC_BEOS): $(RDEF_BEOS) $(RDEF_IMP_BEOS)
# ----------------------------------------------------------------------------
install-beos:
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_BIN)
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @copyattr -d $(EXETARGET) $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/SearchEngines $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_BEOS_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)copyattr -d $(EXETARGET) $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/SearchEngines $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
# ----------------------------------------------------------------------------
# Package target
diff --git a/frontends/cocoa/Makefile b/frontends/cocoa/Makefile
index 8935d7b..a0ebfbb 100644
--- a/frontends/cocoa/Makefile
+++ b/frontends/cocoa/Makefile
@@ -171,7 +171,7 @@ define make_lproj
R_RESOURCES += $$(OBJROOT)/$(1).lproj
$$(OBJROOT)/$(1).lproj: $(2)
$(VQ)echo Bundling language $(1)
- $(Q)mkdir -p $$@
+ $(Q)$(MKDIR) -p $$@
$(Q)cp -pLR $(2) $$@
$(Q)$(SPLIT_MESSAGES) -l $(1) -p cocoa -f messages resources/FatMessages > $$@/Messages
endef
@@ -182,7 +182,7 @@ $$(OBJROOT)/$(2).lproj: $$(OBJROOT)/$(2).lproj/$(1:.xib=.nib)
$$(OBJROOT)/$(2).lproj/$(1:.xib=.nib): $(FRONTEND_RESOURCES_DIR)/$(1) $$(OBJROOT)/created
$(VQ)echo Compiling XIB $(1) for language $(2)
- $(Q)mkdir -p $$(OBJROOT)/$(2).lproj
+ $(Q)$(MKDIR) -p $$(OBJROOT)/$(2).lproj
$(Q)$(FRONTEND_SOURCE_DIR)/compile-xib.sh $(FRONTEND_RESOURCES_DIR)/$(1) $(2) $$@
ifeq ($(wildcard $(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings),$(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings)
@@ -202,16 +202,16 @@ install-cocoa: NetSurf.app
NetSurf.app: NetSurf $(FRONTEND_SOURCE_DIR)/Makefile $(R_RESOURCES) NetSurf.app/Contents/Info.plist
$(VQ)echo Assembling NetSurf.app bundle
- $(Q)mkdir -p NetSurf.app/Contents/MacOS
+ $(Q)$(MKDIR) -p NetSurf.app/Contents/MacOS
$(Q)cp NetSurf NetSurf.app/Contents/MacOS
$(Q)rm -rf NetSurf.app/Contents/Resources
- $(Q)mkdir -p NetSurf.app/Contents/Resources
+ $(Q)$(MKDIR) -p NetSurf.app/Contents/Resources
$(Q)cp -pLR $(R_RESOURCES) NetSurf.app/Contents/Resources
$(Q)echo 'APPL????' > NetSurf.app/Contents/PkgInfo
NetSurf.app/Contents/Info.plist: $(FRONTEND_RESOURCES_DIR)/NetSurf-Info.plist $(FRONTEND_SOURCE_DIR)/Makefile
$(VQ)echo Generating Info.plist
- $(Q)mkdir -p NetSurf.app/Contents
+ $(Q)$(MKDIR) -p NetSurf.app/Contents
$(Q)sed -e 's/$${EXECUTABLE_NAME}/$(EXETARGET)/' \
-e 's/$${PRODUCT_NAME.*}/$(EXETARGET)/' \
-e 's/$${MACOSX_DEPLOYMENT_TARGET}/$(MACOSX_VERSION)/' \
diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile
index 3d47f8f..6d2acb0 100644
--- a/frontends/framebuffer/Makefile
+++ b/frontends/framebuffer/Makefile
@@ -171,8 +171,8 @@ NETSURF_FRAMEBUFFER_RESOURCE_LIST := adblock.css credits.html \
netsurf.png quirks.css welcome.html maps.html Messages
install-framebuffer:
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
$(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf-fb
$(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do cp -vL $(FRONTEND_RESOURCES_DIR)/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done
$(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index 76ef998..afbfcd7 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -198,11 +198,11 @@ GTK_TRANSLATIONS_HTML := de en fr it ja nl
NSGTK_RESOURCES_DESTDIR := $(DESTDIR)$(word 1,$(subst :, ,$(NETSURF_GTK_RES_PATH)))
install-gtk:
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_GTK_BIN)
$(Q)install $(EXETARGET) $(DESTDIR)$(NETSURF_GTK_BIN)netsurf-gtk$(SUBTARGET)
- $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/icons
+ $(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/icons
$(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/icons/*.png $(NSGTK_RESOURCES_DESTDIR)/icons
- $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/throbber
+ $(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/throbber
$(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/throbber/*.png $(NSGTK_RESOURCES_DESTDIR)/throbber
$(Q)tar -c -h -C $(NSGTK_RESOURCES_DIR) -f - $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(NSGTK_RESOURCES_DESTDIR) -f -
$(Q)install -m 0644 $(GTK_RESOURCES_LIST) $(NSGTK_RESOURCES_DESTDIR)
diff --git a/frontends/riscos/Makefile b/frontends/riscos/Makefile
index b457f02..87790ac 100644
--- a/frontends/riscos/Makefile
+++ b/frontends/riscos/Makefile
@@ -110,7 +110,7 @@ TPL_RISCOS := $(addprefix $(FRONTEND_SOURCE_DIR)/templates/,$(TPL_RISCOS))
define compile_template
!NetSurf/Resources/$(1)/Templates$$(TPLEXT): $(2)
$$(VQ)echo "TEMPLATE: $(2)"
- $$(Q)mkdir -p !NetSurf/Resources/$(1)
+ $$(Q)$$(MKDIR) -p !NetSurf/Resources/$(1)
$$(Q)$$(CC) -x c -E -P $$(CFLAGS) $(2) | $$(CCRES) - $$@
CLEAN_TEMPLATES += !NetSurf/Resources/$(1)/Templates$$(TPLEXT)
diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index 41c8b8c..1b93e4c 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -3,10 +3,14 @@
#
# This file is part of NetSurf
+
+VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+
+
LDFLAGS += -L${GCCSDK_INSTALL_ENV}/lib
CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
-
$(eval $(call pkg_config_find_and_add,libcares,Cares))
$(eval $(call pkg_config_find_and_add,zlib,ZLib))
@@ -68,10 +72,25 @@ install-windows:
package-windows: netsurf-installer.exe
WIN_RES_OBJ := installer.nsi NetSurf.ico netsurf.png welcome.html default.css
-WIN_RES_INS_OBJ := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(WIN_RES_OBJ)) $(OBJROOT)/messages
+WIN_RES_INS_OBJ := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(WIN_RES_OBJ)) $(OBJROOT)/messages-en
+
+# deal with making installer generation verbose
+ifeq ($(Q),)
+NSIS_VERBOSE := 4
+else
+NSIS_VERBOSE := 0
+endif
-$(OBJROOT)/messages: resources/FatMessages
- $(Q)$(SPLIT_MESSAGES) -l en -p win -f messages resources/FatMessages > $@
+# installer messages generation
+$(OBJROOT)/messages-en: resources/FatMessages
+ $(VQ)echo "MSGSPLIT: Language: en Filter: win"
+ $(Q)$(SPLIT_MESSAGES) -l en -p win -f messages -o $@ $<
netsurf-installer.exe: $(EXETARGET) $(WIN_RES_INS_OBJ)
- makensis -V4 -NOCD $(FRONTEND_RESOURCES_DIR)/installer.nsi
+ $(VQ)echo "MAKENSIS: $@"
+ $(Q)makensis -V$(NSIS_VERBOSE) -NOCD -DOBJROOT=$(OBJROOT) -DRESDIR=$(FRONTEND_RESOURCES_DIR) -DVERSIONMAJOR=$(VERSION_MAJ) -DVERSIONMINOR=$(VERSION_MIN) -DOUTFNAME=$@ $(FRONTEND_RESOURCES_DIR)/installer.nsi
+
+clean-installer:
+ $(VQ)echo " CLEAN: netsurf-installer.exe"
+ $(Q)$(RM) netsurf-installer.exe
+CLEANS += clean-installer
diff --git a/frontends/windows/res/installer.nsi b/frontends/windows/res/installer.nsi
index 0c733db..17afee2 100644
--- a/frontends/windows/res/installer.nsi
+++ b/frontends/windows/res/installer.nsi
@@ -3,21 +3,40 @@
# show up in a few places.
# All the other settings can be tweaked by editing the !defines at the top of this script
+
!define APPNAME "NetSurf"
!define COMPANYNAME "NetSurf"
!define DESCRIPTION "Web Browser"
-# These three must be integers
-!define VERSIONMAJOR 3
-!define VERSIONMINOR 6
-!define VERSIONBUILD 1
+
+# The version values must be simple integers
+!ifndef VERSIONMAJOR
+ !define VERSIONMAJOR 3
+!endif
+!ifndef VERSIONMINOR
+ !define VERSIONMINOR 7
+!endif
+!ifndef VERSIONBUILD
+ !define VERSIONBUILD 0
+!endif
+
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
-# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://www.netsurf-browser.org/" # "Support Information" link
!define UPDATEURL "http://www.netsurf-browser.org/" # "Product Updates" link
!define ABOUTURL "http://www.netsurf-browser.org/" # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
!define INSTALLSIZE 9000
-
+
+# output filename
+!ifndef OUTFNAME
+ !define OUTFNAME "netsurf-installer.exe"
+!endif
+
+# path to resources
+!ifndef RESDIR
+ !define RESDIR "frontends/windows/res"
+!endif
+
+
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
@@ -26,8 +45,8 @@ InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
LicenseData "COPYING"
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
-Icon "frontends\windows\res\NetSurf.ico"
-outFile "netsurf-installer.exe"
+Icon "${RESDIR}\NetSurf.ico"
+outFile "${OUTFNAME}"
BrandingText "${COMPANYNAME}"
!include LogicLib.nsh
@@ -53,21 +72,23 @@ function .onInit
functionEnd
section "install"
- # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
+ # Files for the install directory
+
+ # Default output path
setOutPath $INSTDIR
- # Files added here should be removed by the uninstaller (see section "uninstall")
- file "NetSurf.exe"
- file /oname=NetSurf.ico "frontends\windows\res\NetSurf.ico"
- file /oname=default.css "frontends\windows\res\default.css"
- file /oname=internal.css "frontends\windows\res\internal.css"
- file /oname=adblock.css "frontends\windows\res\adblock.css"
- file /oname=welcome.html "frontends\windows\res\welcome.html"
- file /oname=credits.html "frontends\windows\res\credits.html"
- file /oname=licence.html "frontends\windows\res\licence.html"
- file /oname=netsurf.png "frontends\windows\res\netsurf.png"
- file /oname=messages "build-Linux-windows\messages"
- file /oname=ca-bundle.crt "frontends\windows\res\ca-bundle.crt"
- # Add any other files for the install directory (license files, app data, etc) here
+
+ # Files added here should be removed by the uninstaller section
+ file "NetSurf.exe"
+ file /oname=NetSurf.ico "${RESDIR}\NetSurf.ico"
+ file /oname=default.css "${RESDIR}\default.css"
+ file /oname=internal.css "${RESDIR}\internal.css"
+ file /oname=adblock.css "${RESDIR}\adblock.css"
+ file /oname=welcome.html "${RESDIR}\welcome.html"
+ file /oname=credits.html "${RESDIR}\credits.html"
+ file /oname=licence.html "${RESDIR}\licence.html"
+ file /oname=netsurf.png "${RESDIR}\netsurf.png"
+ file /oname=messages "${OBJROOT}\messages-en"
+ file /oname=ca-bundle.crt "${RESDIR}\ca-bundle.crt"
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
@@ -95,7 +116,7 @@ section "install"
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
sectionEnd
-
+
# Uninstaller
function un.onInit
diff --git a/test/Makefile b/test/Makefile
index a3f84f3..fd54fb9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -58,15 +58,16 @@ utils_SRCS := utils/utils.c utils/messages.c utils/hashtable.c \
time_SRCS := utils/time.c test/log.c test/time.c
# Coverage builds need additional flags
+COV_ROOT := build/$(HOST)-coverage
ifeq ($(MAKECMDGOALS),coverage)
COV_CFLAGS ?= -fprofile-arcs -ftest-coverage -O0
COV_CXXFLAGS ?= -fprofile-arcs -ftest-coverage -O0
COV_LDFLAGS ?= -lgcov -fprofile-arcs
- TESTROOT := build-$(HOST)-coverage
+ TESTROOT := $(COV_ROOT)
else
COV_CFLAGS ?= -O0
COV_CXXFLAGS ?= -O0
- TESTROOT := build-$(HOST)-test
+ TESTROOT := build/$(HOST)-test
endif
@@ -165,13 +166,13 @@ coverage: test
$(TESTROOT)/created:
$(VQ)echo " MKDIR: $(TESTROOT)"
- $(Q)$(MKDIR) $(TESTROOT)
+ $(Q)$(MKDIR) -p $(TESTROOT)
$(Q)$(TOUCH) $@
.PHONY: test-clean
test-clean:
$(VQ)echo " CLEAN: $(TESTROOT)"
- $(VQ)echo " CLEAN: build-$(HOST)-coverage"
- $(Q)$(RM) -r $(TESTROOT) build-$(HOST)-coverage
+ $(VQ)echo " CLEAN: $(COV_ROOT)"
+ $(Q)$(RM) -r $(TESTROOT) $(COV_ROOT)
CLEANS += test-clean
--
NetSurf Browser
6 years, 8 months
netsurf: branch master updated. release/3.6-182-gbf3ba5c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/bf3ba5c97bac5aa79c431...
...commit http://git.netsurf-browser.org/netsurf.git/commit/bf3ba5c97bac5aa79c43153...
...tree http://git.netsurf-browser.org/netsurf.git/tree/bf3ba5c97bac5aa79c4315331...
The branch, master has been updated
via bf3ba5c97bac5aa79c43153311ea0d3d5945bd4d (commit)
via 01e116ee1f5603ef6adeb365f403563a684a47b4 (commit)
via ae8959fa8b46fd21100b72669dcd4da03d91fd97 (commit)
via d885c79743a3169669d6400011ee667aa70e88d9 (commit)
via 22e25971ed4bc23d742cff7823a9f8224f544db7 (commit)
via 0f58d92ab6b4fa13e971b0b07d7ee58e7493c4ee (commit)
via 83840dca49ef6f720e825606555db19b2b659cc6 (commit)
via a4bedbbaebec62294bcf6e7210c4c2b0b64f936c (commit)
via 917a602dce32286260a34d61b7c0db4bee502ec0 (commit)
via a86f2c8dd35c0cd8ba2f87097a68ad32373c28b5 (commit)
from d1693c27c0d9658b655c158a9652f87683719325 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=bf3ba5c97bac5aa79c4...
commit bf3ba5c97bac5aa79c43153311ea0d3d5945bd4d
Merge: d1693c2 01e116e
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Complete Amiga corewindow implementation and migration from old treeviews
Merge branch 'chris/amiga-corewindow'
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=01e116ee1f5603ef6ad...
commit 01e116ee1f5603ef6adeb365f403563a684a47b4
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Clear pointer after free
diff --git a/desktop/global_history.c b/desktop/global_history.c
index b6f4882..a19349f 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -803,6 +803,7 @@ nserror global_history_fini(void)
/* Destroy the global history treeview */
err = treeview_destroy(gh_ctx.tree);
+ gh_ctx.tree = NULL;
/* Free global history treeview entry fields */
for (i = 0; i < N_FIELDS; i++)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ae8959fa8b46fd21100...
commit ae8959fa8b46fd21100b72669dcd4da03d91fd97
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Remove old tree implementation
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index 8115f2f..b87cda1 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -36,7 +36,7 @@ MESSAGES_FILTER=ami
# ----------------------------------------------------------------------------
# sources purely for the Amiga build
-S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \
+S_FRONTEND := gui.c history.c hotlist.c schedule.c file.c \
misc.c bitmap.c font.c filetype.c utf8.c login.c memory.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 \
@@ -46,7 +46,7 @@ S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.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 \
- nsoption.c desktop-tree.c corewindow.c
+ nsoption.c corewindow.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 63e418a..7bb2f58 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -40,7 +40,6 @@
#include "amiga/gui.h"
#include "amiga/download.h"
#include "amiga/hotlist.h"
-#include "amiga/tree.h"
#include "amiga/libs.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/desktop-tree.c b/frontends/amiga/desktop-tree.c
deleted file mode 100644
index 3fb41ed..0000000
--- a/frontends/amiga/desktop-tree.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt(a)users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "netsurf/misc.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/core_window.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "desktop/gui_internal.h"
-#include "desktop/treeview.h"
-#include "desktop/hotlist.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/sslcert_viewer.h"
-
-#include "amiga/desktop-tree.h"
-
-struct tree {
- unsigned int flags; /* Tree flags */
- tree_drag_type drag;
- const struct treeview_table *callbacks;
- void *client_data; /* User assigned data for the callbacks */
-};
-
-
-struct sslcert_session_data *ssl_current_session = NULL;
-const char *tree_hotlist_path = NULL;
-
-static void treeview_test_redraw_request(struct core_window *cw,
- const struct rect *r)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->redraw_request(r->x0, r->y0,
- r->x1 - r->x0, r->y1 - r->y0,
- tree->client_data);
-}
-
-static void treeview_test_update_size(struct core_window *cw,
- int width, int height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->resized(tree, width, height, tree->client_data);
-}
-
-static void treeview_test_scroll_visible(struct core_window *cw,
- const struct rect *r)
-{
-}
-
-static void treeview_test_get_window_dimensions(struct core_window *cw,
- int *width, int *height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->get_window_dimensions(width, height,
- tree->client_data);
-}
-
-static void treeview_test_drag_status(struct core_window *cw,
- core_window_drag_status ds)
-{
- struct tree *tree = (struct tree *)cw;
-
- switch (ds) {
- case CORE_WINDOW_DRAG_NONE:
- tree->drag = TREE_NO_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_SELECTION:
- tree->drag = TREE_SELECT_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_MOVE:
- tree->drag = TREE_MOVE_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_TEXT_SELECTION:
- tree->drag = TREE_TEXTAREA_DRAG;
- break;
-
- default:
- break;
- }
-}
-
-struct core_window_callback_table cw_t = {
- .redraw_request = treeview_test_redraw_request,
- .update_size = treeview_test_update_size,
- .scroll_visible = treeview_test_scroll_visible,
- .get_window_dimensions = treeview_test_get_window_dimensions,
- .drag_status = treeview_test_drag_status
-};
-
-static bool treeview_test_init(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new global history.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_init(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new hotlist.", 0);
- err = hotlist_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init hotlist manager.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session == NULL &&
- "Call sslcert_viewer_init directly, "
- "this compat. layer can't cope with simultanious "
- "sslcert viewers");
- err = sslcert_viewer_init(&cw_t, (struct core_window *)tree,
- ssl_current_session);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_fini(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_fini(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise hotlist.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- err = sslcert_viewer_fini(ssl_current_session);
- ssl_current_session = NULL;
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_redraw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- struct rect clip;
-
- clip.x0 = clip_x;
- clip.y0 = clip_y;
- clip.x1 = clip_x + clip_width;
- clip.y1 = clip_y + clip_height;
-
- switch (tree->flags) {
- case TREE_SSLCERT:
- if (ssl_current_session != NULL) {
- sslcert_viewer_redraw(ssl_current_session, x, y, &clip, ctx);
- }
- return true;
- case TREE_COOKIES:
- cookie_manager_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HISTORY:
- global_history_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HOTLIST:
- hotlist_redraw(x, y, &clip, ctx);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_mouse_action(struct tree *tree,
- browser_mouse_state mouse, int x, int y)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
- return true;
- case TREE_COOKIES:
- cookie_manager_mouse_action(mouse, x, y);
- return true;
- case TREE_HISTORY:
- global_history_mouse_action(mouse, x, y);
- return true;
- case TREE_HOTLIST:
- hotlist_mouse_action(mouse, x, y);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_keypress(struct tree *tree, uint32_t key)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_keypress(ssl_current_session, key);
- return true;
- case TREE_COOKIES:
- cookie_manager_keypress(key);
- return true;
- case TREE_HISTORY:
- global_history_keypress(key);
- return true;
- case TREE_HOTLIST:
- hotlist_keypress(key);
- return true;
- }
-
- return false;
-}
-
-/* -------------------------------------------------------------------------- */
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks, void *client_data)
-{
- struct tree *tree;
-
- tree = calloc(sizeof(struct tree), 1);
- if (tree == NULL) {
- LOG("calloc failed");
- guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0);
- return NULL;
- }
-
- tree->flags = flags;
- tree->drag = TREE_NO_DRAG;
- tree->callbacks = callbacks;
- tree->client_data = client_data;
-
- treeview_test_init(tree);
-
- return tree;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree)
-{
- treeview_test_fini(tree);
- free(tree);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- assert(tree != NULL);
-
- treeview_test_redraw(tree, x, y, clip_x, clip_y,
- clip_width, clip_height, ctx);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
- int y)
-{
- assert(tree != NULL);
-
- if (treeview_test_mouse_action(tree, mouse, x, y)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1)
-{
- assert(tree != NULL);
-
- treeview_test_mouse_action(tree, BROWSER_MOUSE_HOVER, x1, y1);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_keypress(struct tree *tree, uint32_t key)
-{
- if (treeview_test_keypress(tree, key)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-tree_drag_type tree_drag_status(struct tree *tree)
-{
- assert(tree != NULL);
- return tree->drag;
-}
diff --git a/frontends/amiga/desktop-tree.h b/frontends/amiga/desktop-tree.h
deleted file mode 100644
index f8864e1..0000000
--- a/frontends/amiga/desktop-tree.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt(a)users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#ifndef _NETSURF_DESKTOP_TREE_H_
-#define _NETSURF_DESKTOP_TREE_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "netsurf/mouse.h"
-
-struct sslcert_session_data;
-struct tree;
-struct redraw_context;
-
-/**
- * Current ssl session data for treeview
- *
- * @todo FIXME global certificate treeview state must go away, this is
- * just wrong.
- */
-extern struct sslcert_session_data *ssl_current_session;
-extern const char *tree_hotlist_path;
-
-/* Tree flags */
-enum tree_flags {
- TREE_HISTORY,
- TREE_COOKIES,
- TREE_SSLCERT,
- TREE_HOTLIST
-};
-
-typedef enum {
- TREE_NO_DRAG = 0,
- TREE_SELECT_DRAG,
- TREE_MOVE_DRAG,
- TREE_TEXTAREA_DRAG, /** < A drag that is passed to a textarea */
- TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
-} tree_drag_type;
-
-/** callbacks to perform necessary operations on treeview. */
-struct treeview_table {
- void (*redraw_request)(int x, int y, int width, int height,
- void *data); /**< request a redraw. */
- void (*resized)(struct tree *tree, int width, int height,
- void *data); /**< resize treeview area. */
- void (*scroll_visible)(int y, int height, void *data); /**< scroll visible treeview area. */
- void (*get_window_dimensions)(int *width, int *height, void *data); /**< get dimensions of window */
-};
-
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks,
- void *client_data);
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree);
-tree_drag_type tree_drag_status(struct tree *tree);
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx);
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
- int x, int y);
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1);
-bool tree_keypress(struct tree *tree, uint32_t key);
-
-
-#endif
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 4e88a0e..e27d105 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -118,7 +118,6 @@
#include "desktop/searchweb.h"
/* NetSurf Amiga platform includes */
-#include "amiga/desktop-tree.h"
#include "amiga/gui.h"
#include "amiga/arexx.h"
#include "amiga/bitmap.h"
@@ -151,7 +150,6 @@
#include "amiga/search.h"
#include "amiga/selectmenu.h"
#include "amiga/theme.h"
-#include "amiga/tree.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
deleted file mode 100644
index b9747c0..0000000
--- a/frontends/amiga/tree.c
+++ /dev/null
@@ -1,1484 +0,0 @@
-/*
- * Copyright 2008 - 2013 Chris Young <chris(a)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 "netsurf/browser_window.h"
-#include "netsurf/window.h"
-#include "netsurf/keypress.h"
-#include "content/llcache.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/hotlist.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"
-#include "amiga/plotters.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 ami_generic_window w;
- 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;
-};
-
-static BOOL ami_tree_event(void *w);
-
-static const struct ami_win_event_table ami_tree_table = {
- ami_tree_event,
- ami_tree_close,
-};
-
-#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);
- free(twin->shared_pens);
- free(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", "");
- free(atrr_data);
- 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);
-
- free(atrr_data);
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- glob->rp = temprp;
- ami_gui_set_default_gg();
-}
-
-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
- };
-
- free(atrr_data);
-
- 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
- }
- }
-
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- ami_gui_set_default_gg();
-}
-
-static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
-{
- struct ami_tree_redraw_req *atrr_data = malloc(sizeof(struct ami_tree_redraw_req));
-
- 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 = calloc(1, sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS))) {
- 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);
-
- ami_gui_win_list_add(twin, AMINS_TVWINDOW, &ami_tree_table);
-
- 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(void *w)
-{
- struct treeview_window *twin = (struct treeview_window *)w;
- int i;
-
- twin->win = NULL;
- DisposeObject(twin->objects[OID_MAIN]);
- ami_gui_win_list_remove(twin);
- 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;
- }
-
- free(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;
- }
-}
-
-static BOOL ami_tree_event(void *w)
-{
- /* return TRUE if window destroyed */
- struct treeview_window *twin = (struct treeview_window *)w;
- 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 = calloc(1, sizeof(struct treeview_window));
-
- 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/frontends/amiga/tree.h b/frontends/amiga/tree.h
deleted file mode 100755
index a8cada5..0000000
--- a/frontends/amiga/tree.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris(a)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 "amiga/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(void *w); /* for Arexx interface only */
-
-extern const struct treeview_table ami_tree_callbacks;
-
-#endif
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d885c79743a3169669d...
commit d885c79743a3169669d6400011ee667aa70e88d9
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
remove excessive logging
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 5b5d6bb..5fc772b 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -706,7 +706,6 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm)
{
if(bitmap == NULL) return NULL;
- LOG("Getting native BitMap for %p", bitmap);
if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height, friendbm);
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index ea8cd52..1bfd6c4 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -477,8 +477,6 @@ ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
ami_cw->drag_x_start = x;
ami_cw->drag_y_start = y;
-printf("%ld\n", ami_cw->drag_status);
-
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
break;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=22e25971ed4bc23d742...
commit 22e25971ed4bc23d742cff7823a9f8224f544db7
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Working internal and tree-to-browser drags
tree-to-tree drags don't work unless the source supports internal drag moves (so global history to hotlist won't work as it did before)
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index eee4b74..ea8cd52 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -152,11 +152,10 @@ ami_cw_mouse_pos(struct ami_corewindow *ami_cw, int *restrict x, int *restrict y
xm -= bbox->Left;
ym -= bbox->Top;
- ami_gui_free_space_box(bbox);
-
if((xm < 0) || (ym < 0) || (xm > bbox->Width) || (ym > bbox->Height))
return false;
+ ami_gui_free_space_box(bbox);
ami_cw_scroller_top(ami_cw, &xs, &ys);
xm += xs;
@@ -472,10 +471,14 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
static void
ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
{
+ if(ami_cw->dragging == true) return;
+
ami_cw->dragging = true;
ami_cw->drag_x_start = x;
ami_cw->drag_y_start = y;
+printf("%ld\n", ami_cw->drag_status);
+
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
break;
@@ -495,6 +498,8 @@ ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
static void
ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
{
+ if(ami_cw->dragging == false) return;
+
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
break;
@@ -514,8 +519,8 @@ ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
static void
ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
{
- ami_cw->dragging = false;
-
+ if(ami_cw->dragging == false) return;
+
switch(ami_cw->drag_status) {
case CORE_WINDOW_DRAG_SELECTION:
break;
@@ -530,6 +535,9 @@ ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
default:
break;
}
+
+ ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
+ ami_cw->dragging = false;
}
/**
@@ -574,7 +582,7 @@ ami_cw_event(void *w)
}
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- if(ami_cw->dragging == false) {
+ if(ami_cw->mouse_state & BROWSER_MOUSE_DRAG_ON) {
ami_cw_drag_start(ami_cw, x, y);
}
} else {
@@ -582,15 +590,12 @@ ami_cw_event(void *w)
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
}
}
- if(ami_cw->dragging == true) {
- ami_cw_drag_progress(ami_cw, x, y);
- }
+ ami_cw_drag_progress(ami_cw, x, y);
break;
case WMHI_MOUSEBUTTONS:
if(ami_cw_mouse_pos(ami_cw, &x, &y) == true) {
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
-
switch(code) {
case SELECTDOWN:
ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
@@ -643,12 +648,28 @@ ami_cw_event(void *w)
break;
}
- if((ami_cw->dragging == true) && (ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
+ if(ami_cw->mouse_state == BROWSER_MOUSE_HOVER) {
ami_cw_drag_end(ami_cw, x, y);
- ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
}
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ } else {
+ /* event is happening away from our corewindow area */
+ switch(code) {
+ case SELECTUP:
+ case MIDDLEUP:
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
+
+ default:
+ break;
+ }
+
+ if(ami_cw->mouse_state == BROWSER_MOUSE_HOVER) {
+ ami_cw_drag_end(ami_cw, x, y);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state,
+ ami_cw->drag_x_start, ami_cw->drag_y_start); // placate core
+ }
}
break;
@@ -833,9 +854,10 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->scroll_x_visible = true;
ami_cw->scroll_y_visible = true;
ami_cw->in_border_scroll = false;
+ ami_cw->dragging = false;
/* allocate drawing area etc */
- ami_init_layers(&ami_cw->gg, 0, 0, false);
+ ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save memory
ami_cw->gg.shared_pens = ami_AllocMinList();
ami_cw->deferred_rects = NewObjList();
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0f58d92ab6b4fa13e97...
commit 0f58d92ab6b4fa13e971b0b07d7ee58e7493c4ee
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Dragging works internally
(except it doesn't, as the hotlist window is broken and doesn't respond to the mouse until selecting random menu items)
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1e880e9..eee4b74 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -559,101 +559,97 @@ ami_cw_event(void *w)
switch(result & WMHI_CLASSMASK) {
case WMHI_MOUSEMOVE:
- if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
- if(ami_cw->dragging == false) {
- if(ami_cw_mouse_moved(ami_cw, x, y, false)) {
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
- /* Start button 1 drag */
- ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
- /* Replace PRESS with HOLDING and declare drag in progress */
- ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
- } else if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2) {
- /* Start button 2 drag */
- ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_2, x, y);
- /* Replace PRESS with HOLDING and declare drag in progress */
- ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
- }
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ if(ami_cw_mouse_pos(ami_cw, &x, &y) == true) {
+ if(ami_cw_mouse_moved(ami_cw, x, y, false)) {
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ /* Start button 1 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
+ } else if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2) {
+ /* Start button 2 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_2, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+ }
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ if(ami_cw->dragging == false) {
ami_cw_drag_start(ami_cw, x, y);
- } else {
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
}
} else {
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw_drag_progress(ami_cw, x, y);
- }
- } else {
- if(ami_cw->dragging == true) {
- ami_cw_drag_progress(ami_cw, x, y);
}
}
+ if(ami_cw->dragging == true) {
+ ami_cw_drag_progress(ami_cw, x, y);
+ }
break;
case WMHI_MOUSEBUTTONS:
- ami_cw_mouse_pos(ami_cw, &x, &y);
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
-
- switch(code) {
- case SELECTDOWN:
- ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
- ami_cw->drag_x_start = x;
- ami_cw->drag_y_start = y;
- break;
-
- case MIDDLEDOWN:
- ami_cw->mouse_state = BROWSER_MOUSE_PRESS_2;
- ami_cw->drag_x_start = x;
- ami_cw->drag_y_start = y;
- break;
-
- case SELECTUP:
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
- CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
-
- ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
-
- if(ami_cw->lastclick.tv_sec) {
- if((ami_cw_mouse_moved(ami_cw, x, y, true) == false) &&
- (DoubleClick(ami_cw->lastclick.tv_sec,
- ami_cw->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec)))
- ami_cw->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
+ if(ami_cw_mouse_pos(ami_cw, &x, &y) == true) {
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+
+ switch(code) {
+ case SELECTDOWN:
+ ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+ break;
+
+ case MIDDLEDOWN:
+ ami_cw->mouse_state = BROWSER_MOUSE_PRESS_2;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+ break;
+
+ case SELECTUP:
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
+
+ ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
+
+ if(ami_cw->lastclick.tv_sec) {
+ if((ami_cw_mouse_moved(ami_cw, x, y, true) == false) &&
+ (DoubleClick(ami_cw->lastclick.tv_sec,
+ ami_cw->lastclick.tv_usec,
+ curtime.tv_sec, curtime.tv_usec)))
+ ami_cw->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
+ }
+
+ ami_cw->mouse_x_click = x;
+ ami_cw->mouse_y_click = y;
+
+ if(ami_cw->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
+ ami_cw->lastclick.tv_sec = 0;
+ ami_cw->lastclick.tv_usec = 0;
+ } else {
+ ami_cw->lastclick.tv_sec = curtime.tv_sec;
+ ami_cw->lastclick.tv_usec = curtime.tv_usec;
+ }
}
- ami_cw->mouse_x_click = x;
- ami_cw->mouse_y_click = y;
-
- if(ami_cw->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
- ami_cw->lastclick.tv_sec = 0;
- ami_cw->lastclick.tv_usec = 0;
- } else {
- ami_cw->lastclick.tv_sec = curtime.tv_sec;
- ami_cw->lastclick.tv_usec = curtime.tv_usec;
- }
- }
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
- break;
+ case MIDDLEUP:
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2)
+ ami_cw->mouse_state = BROWSER_MOUSE_CLICK_2;
- case MIDDLEUP:
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2)
- ami_cw->mouse_state = BROWSER_MOUSE_CLICK_2;
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
+ }
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
- break;
- }
+ if((ami_cw->dragging == true) && (ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
+ ami_cw_drag_end(ami_cw, x, y);
+ ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
+ }
- if((ami_cw->dragging == true) && (ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
- ami_cw_drag_end(ami_cw, x, y);
- ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
}
-
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
break;
case WMHI_RAWKEY:
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=83840dca49ef6f720e8...
commit 83840dca49ef6f720e825606555db19b2b659cc6
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Possibly slightly less but still definitely broken drag handling
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 03ad509..1e880e9 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -107,13 +107,27 @@ ami_cw_coord_amiga_to_ns(struct ami_corewindow *ami_cw, int *restrict x, int *re
/**
* check if mouse has moved since position was stored
+ * @param ami_cw corewindow
+ * @param x current x position
+ * @param y current y position
+ * @param click true to check since last click, false since last drag (press)
* @return true if it has, false otherwise
*/
static bool
-ami_cw_mouse_moved(struct ami_corewindow *ami_cw, int x, int y)
+ami_cw_mouse_moved(struct ami_corewindow *ami_cw, int x, int y, bool click)
{
- if(abs(x - ami_cw->mouse_x_click) > 5) return true;
- if(abs(y - ami_cw->mouse_y_click) > 5) return true;
+ int mx, my;
+
+ if(click == true) {
+ mx = ami_cw->mouse_x_click;
+ my = ami_cw->mouse_y_click;
+ } else {
+ mx = ami_cw->drag_x_start;
+ my = ami_cw->drag_y_start;
+ }
+
+ if(abs(x - mx) > 5) return true;
+ if(abs(y - my) > 5) return true;
return false;
}
@@ -545,47 +559,54 @@ ami_cw_event(void *w)
switch(result & WMHI_CLASSMASK) {
case WMHI_MOUSEMOVE:
- if(ami_cw->dragging == false) {
- if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
- /* Start button 1 drag */
- ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
- /* Replace PRESS with HOLDING and declare drag in progress */
- ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
- } else if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2) {
- /* Start button 2 drag */
- ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_2, x, y);
- /* Replace PRESS with HOLDING and declare drag in progress */
- ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+ if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+ if(ami_cw->dragging == false) {
+ if(ami_cw_mouse_moved(ami_cw, x, y, false)) {
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ /* Start button 1 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
+ } else if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2) {
+ /* Start button 2 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_2, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+ }
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw_drag_start(ami_cw, x, y);
+ } else {
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
}
+ } else {
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
-
- if ((ami_cw->drag_status == CORE_WINDOW_DRAG_SELECTION) ||
- (ami_cw->drag_status == CORE_WINDOW_DRAG_MOVE)) {
- ami_cw_drag_start(ami_cw, x, y);
- }
+ ami_cw_drag_progress(ami_cw, x, y);
}
} else {
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw_drag_progress(ami_cw, x, y);
+ if(ami_cw->dragging == true) {
+ ami_cw_drag_progress(ami_cw, x, y);
+ }
}
break;
case WMHI_MOUSEBUTTONS:
- if(ami_cw_mouse_pos(ami_cw, &x, &y) == false)
- break;
-
+ ami_cw_mouse_pos(ami_cw, &x, &y);
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
switch(code) {
case SELECTDOWN:
ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
break;
case MIDDLEDOWN:
ami_cw->mouse_state = BROWSER_MOUSE_PRESS_2;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
break;
case SELECTUP:
@@ -595,7 +616,7 @@ ami_cw_event(void *w)
ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
if(ami_cw->lastclick.tv_sec) {
- if((ami_cw_mouse_moved(ami_cw, x, y) == false) &&
+ if((ami_cw_mouse_moved(ami_cw, x, y, true) == false) &&
(DoubleClick(ami_cw->lastclick.tv_sec,
ami_cw->lastclick.tv_usec,
curtime.tv_sec, curtime.tv_usec)))
@@ -626,11 +647,13 @@ ami_cw_event(void *w)
ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
break;
}
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
-
+
if((ami_cw->dragging == true) && (ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
ami_cw_drag_end(ami_cw, x, y);
+ ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
}
+
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
break;
case WMHI_RAWKEY:
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 2210301..f326f91 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -190,9 +190,6 @@ ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
struct gui_window_2 *gwin;
struct ami_corewindow *cw;
- if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
- return NSERROR_OK;
-
if(global_history_has_selection()) {
ok = global_history_get_selection(&url, &title);
}
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index 422586a..a0fd303 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -242,9 +242,6 @@ ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
struct gui_window_2 *gwin;
struct ami_corewindow *cw;
- if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
- return NSERROR_OK;
-
if(hotlist_has_selection()) {
ok = hotlist_get_selection(&url, &title);
}
-----------------------------------------------------------------------
Summary of changes:
desktop/global_history.c | 1 +
frontends/amiga/Makefile | 4 +-
frontends/amiga/arexx.c | 5 +-
frontends/amiga/bitmap.c | 1 -
frontends/amiga/cookies.c | 2 +-
frontends/amiga/corewindow.c | 241 +++++--
frontends/amiga/corewindow.h | 29 +
frontends/amiga/desktop-tree.c | 353 ----------
frontends/amiga/desktop-tree.h | 88 ---
frontends/amiga/file.c | 3 +
frontends/amiga/file.h | 4 +-
frontends/amiga/gui.c | 25 +-
frontends/amiga/history.c | 449 +++++++++++-
frontends/amiga/history.h | 16 +-
frontends/amiga/hotlist.c | 520 +++++++++++++-
frontends/amiga/hotlist.h | 22 +-
frontends/amiga/menu.c | 11 +-
frontends/amiga/tree.c | 1484 ----------------------------------------
frontends/amiga/tree.h | 47 --
19 files changed, 1198 insertions(+), 2107 deletions(-)
delete mode 100644 frontends/amiga/desktop-tree.c
delete mode 100644 frontends/amiga/desktop-tree.h
mode change 100755 => 100644 frontends/amiga/history.c
mode change 100755 => 100644 frontends/amiga/history.h
mode change 100755 => 100644 frontends/amiga/hotlist.c
mode change 100755 => 100644 frontends/amiga/hotlist.h
delete mode 100644 frontends/amiga/tree.c
delete mode 100755 frontends/amiga/tree.h
diff --git a/desktop/global_history.c b/desktop/global_history.c
index b6f4882..a19349f 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -803,6 +803,7 @@ nserror global_history_fini(void)
/* Destroy the global history treeview */
err = treeview_destroy(gh_ctx.tree);
+ gh_ctx.tree = NULL;
/* Free global history treeview entry fields */
for (i = 0; i < N_FIELDS; i++)
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index aa60207..985a085 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -36,7 +36,7 @@ MESSAGES_FILTER=ami
# ----------------------------------------------------------------------------
# sources purely for the Amiga build
-S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \
+S_FRONTEND := gui.c history.c hotlist.c schedule.c file.c \
misc.c bitmap.c font.c filetype.c utf8.c login.c memory.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 \
@@ -46,7 +46,7 @@ S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.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 \
- nsoption.c desktop-tree.c corewindow.c
+ nsoption.c corewindow.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index b970228..7bb2f58 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -40,7 +40,6 @@
#include "amiga/gui.h"
#include "amiga/download.h"
#include "amiga/hotlist.h"
-#include "amiga/tree.h"
#include "amiga/libs.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
@@ -665,9 +664,9 @@ RXHOOKF(rx_hotlist)
cmd->ac_RC = 0;
if(strcasecmp((char *)cmd->ac_ArgList[0], "OPEN") == 0) {
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
+ ami_hotlist_present();
} else if(strcasecmp((char *)cmd->ac_ArgList[0], "CLOSE") == 0) {
- ami_tree_close(hotlist_window);
+ ami_hotlist_close();
}
}
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 5b5d6bb..5fc772b 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -706,7 +706,6 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm)
{
if(bitmap == NULL) return NULL;
- LOG("Getting native BitMap for %p", bitmap);
if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height, friendbm);
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 18ca425..f428881 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -258,7 +258,7 @@ static void ami_cookies_menulabs(struct ami_menu_data **md)
ami_menu_alloc_item(md, AMI_COOKIE_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
ami_cookies_menu_item_project_snapshot, NULL, 0);
ami_menu_alloc_item(md, AMI_COOKIE_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
- ami_menu_alloc_item(md, AMI_COOKIE_M_CLOSE, NM_ITEM, "CloseWindow", 0, "TBImages:list_cancel",
+ ami_menu_alloc_item(md, AMI_COOKIE_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
ami_cookies_menu_item_project_close, NULL, 0);
ami_menu_alloc_item(md, AMI_COOKIE_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfc537..1bfd6c4 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -59,6 +59,7 @@
#include <reaction/reaction_macros.h>
#include "amiga/corewindow.h"
+#include "amiga/drag.h"
#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
@@ -106,13 +107,27 @@ ami_cw_coord_amiga_to_ns(struct ami_corewindow *ami_cw, int *restrict x, int *re
/**
* check if mouse has moved since position was stored
+ * @param ami_cw corewindow
+ * @param x current x position
+ * @param y current y position
+ * @param click true to check since last click, false since last drag (press)
* @return true if it has, false otherwise
*/
static bool
-ami_cw_mouse_moved(struct ami_corewindow *ami_cw, int x, int y)
+ami_cw_mouse_moved(struct ami_corewindow *ami_cw, int x, int y, bool click)
{
- if(abs(x - ami_cw->mouse_x_click) > 5) return true;
- if(abs(y - ami_cw->mouse_y_click) > 5) return true;
+ int mx, my;
+
+ if(click == true) {
+ mx = ami_cw->mouse_x_click;
+ my = ami_cw->mouse_y_click;
+ } else {
+ mx = ami_cw->drag_x_start;
+ my = ami_cw->drag_y_start;
+ }
+
+ if(abs(x - mx) > 5) return true;
+ if(abs(y - my) > 5) return true;
return false;
}
@@ -137,11 +152,10 @@ ami_cw_mouse_pos(struct ami_corewindow *ami_cw, int *restrict x, int *restrict y
xm -= bbox->Left;
ym -= bbox->Top;
- ami_gui_free_space_box(bbox);
-
if((xm < 0) || (ym < 0) || (xm > bbox->Width) || (ym > bbox->Height))
return false;
+ ami_gui_free_space_box(bbox);
ami_cw_scroller_top(ami_cw, &xs, &ys);
xm += xs;
@@ -451,6 +465,78 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
}
}
+/**
+ * Drag start
+ */
+static void
+ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
+{
+ if(ami_cw->dragging == true) return;
+
+ ami_cw->dragging = true;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_show(ami_cw->win, "project");
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * Drag progress
+ */
+static void
+ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
+{
+ if(ami_cw->dragging == false) return;
+
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_move();
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * Drag end
+ */
+static void
+ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ if(ami_cw->dragging == false) return;
+
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_close(ami_cw->win);
+ if((ami_cw != ami_window_at_pointer(AMINS_COREWINDOW)) && (ami_cw->drag_end != NULL)) {
+ ami_cw->drag_end(ami_cw, scrn->MouseX, scrn->MouseY);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
+ ami_cw->dragging = false;
+}
/**
* Main event loop for our core window
@@ -479,66 +565,110 @@ ami_cw_event(void *w)
switch(result & WMHI_CLASSMASK) {
case WMHI_MOUSEMOVE:
- if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ if(ami_cw_mouse_pos(ami_cw, &x, &y) == true) {
+ if(ami_cw_mouse_moved(ami_cw, x, y, false)) {
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ /* Start button 1 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
+ } else if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2) {
+ /* Start button 2 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_2, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+ }
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ if(ami_cw->mouse_state & BROWSER_MOUSE_DRAG_ON) {
+ ami_cw_drag_start(ami_cw, x, y);
+ }
+ } else {
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ }
}
+ ami_cw_drag_progress(ami_cw, x, y);
break;
case WMHI_MOUSEBUTTONS:
- if(ami_cw_mouse_pos(ami_cw, &x, &y) == false)
- break;
-
- key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
-
- switch(code) {
- case SELECTDOWN:
- ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
- break;
-
- case MIDDLEDOWN:
- ami_cw->mouse_state = BROWSER_MOUSE_PRESS_2;
- break;
-
- case SELECTUP:
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
- CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
-
- ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
-
- if(ami_cw->lastclick.tv_sec) {
- if((ami_cw_mouse_moved(ami_cw, x, y) == false) &&
- (DoubleClick(ami_cw->lastclick.tv_sec,
- ami_cw->lastclick.tv_usec,
- curtime.tv_sec, curtime.tv_usec)))
- ami_cw->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
+ if(ami_cw_mouse_pos(ami_cw, &x, &y) == true) {
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ switch(code) {
+ case SELECTDOWN:
+ ami_cw->mouse_state = BROWSER_MOUSE_PRESS_1;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+ break;
+
+ case MIDDLEDOWN:
+ ami_cw->mouse_state = BROWSER_MOUSE_PRESS_2;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+ break;
+
+ case SELECTUP:
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ CurrentTime((ULONG *)&curtime.tv_sec, (ULONG *)&curtime.tv_usec);
+
+ ami_cw->mouse_state = BROWSER_MOUSE_CLICK_1;
+
+ if(ami_cw->lastclick.tv_sec) {
+ if((ami_cw_mouse_moved(ami_cw, x, y, true) == false) &&
+ (DoubleClick(ami_cw->lastclick.tv_sec,
+ ami_cw->lastclick.tv_usec,
+ curtime.tv_sec, curtime.tv_usec)))
+ ami_cw->mouse_state |= BROWSER_MOUSE_DOUBLE_CLICK;
+ }
+
+ ami_cw->mouse_x_click = x;
+ ami_cw->mouse_y_click = y;
+
+ if(ami_cw->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
+ ami_cw->lastclick.tv_sec = 0;
+ ami_cw->lastclick.tv_usec = 0;
+ } else {
+ ami_cw->lastclick.tv_sec = curtime.tv_sec;
+ ami_cw->lastclick.tv_usec = curtime.tv_usec;
+ }
}
- ami_cw->mouse_x_click = x;
- ami_cw->mouse_y_click = y;
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
- if(ami_cw->mouse_state & BROWSER_MOUSE_DOUBLE_CLICK) {
- ami_cw->lastclick.tv_sec = 0;
- ami_cw->lastclick.tv_usec = 0;
- } else {
- ami_cw->lastclick.tv_sec = curtime.tv_sec;
- ami_cw->lastclick.tv_usec = curtime.tv_usec;
- }
- }
+ case MIDDLEUP:
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2)
+ ami_cw->mouse_state = BROWSER_MOUSE_CLICK_2;
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
- break;
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
+ }
- case MIDDLEUP:
- if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2)
- ami_cw->mouse_state = BROWSER_MOUSE_CLICK_2;
+ if(ami_cw->mouse_state == BROWSER_MOUSE_HOVER) {
+ ami_cw_drag_end(ami_cw, x, y);
+ }
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
- ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
- break;
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ } else {
+ /* event is happening away from our corewindow area */
+ switch(code) {
+ case SELECTUP:
+ case MIDDLEUP:
+ ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
+ break;
+
+ default:
+ break;
+ }
+
+ if(ami_cw->mouse_state == BROWSER_MOUSE_HOVER) {
+ ami_cw_drag_end(ami_cw, x, y);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state,
+ ami_cw->drag_x_start, ami_cw->drag_y_start); // placate core
+ }
}
- ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
break;
case WMHI_RAWKEY:
@@ -722,9 +852,10 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->scroll_x_visible = true;
ami_cw->scroll_y_visible = true;
ami_cw->in_border_scroll = false;
+ ami_cw->dragging = false;
/* allocate drawing area etc */
- ami_init_layers(&ami_cw->gg, 0, 0, false);
+ ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save memory
ami_cw->gg.shared_pens = ami_AllocMinList();
ami_cw->deferred_rects = NewObjList();
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 17af249..cfcd7fc 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -58,6 +58,10 @@ struct ami_corewindow {
int mouse_y_click;
int mouse_state;
+ bool dragging;
+ int drag_x_start;
+ int drag_y_start;
+
bool close_window; // set to true to close the window during event loop
APTR deferred_rects_pool;
@@ -129,6 +133,31 @@ struct ami_corewindow {
BOOL (*event)(struct ami_corewindow *ami_cw, ULONG result);
/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window to a different window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x position **in screen co-ordinates**
+ * \param y mouse y position **in screen co-ordinates**
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+ nserror (*drag_end)(struct ami_corewindow *ami_cw, int x, int y);
+
+ /**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x position **in screen co-ordinates**
+ * \param y mouse y position **in screen co-ordinates**
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+ nserror (*icon_drop)(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y);
+
+ /**
* callback to close an Amiga core window
*
* \param ami_cw The Amiga core window structure.
diff --git a/frontends/amiga/desktop-tree.c b/frontends/amiga/desktop-tree.c
deleted file mode 100644
index 3fb41ed..0000000
--- a/frontends/amiga/desktop-tree.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt(a)users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "netsurf/misc.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/core_window.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "desktop/gui_internal.h"
-#include "desktop/treeview.h"
-#include "desktop/hotlist.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/sslcert_viewer.h"
-
-#include "amiga/desktop-tree.h"
-
-struct tree {
- unsigned int flags; /* Tree flags */
- tree_drag_type drag;
- const struct treeview_table *callbacks;
- void *client_data; /* User assigned data for the callbacks */
-};
-
-
-struct sslcert_session_data *ssl_current_session = NULL;
-const char *tree_hotlist_path = NULL;
-
-static void treeview_test_redraw_request(struct core_window *cw,
- const struct rect *r)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->redraw_request(r->x0, r->y0,
- r->x1 - r->x0, r->y1 - r->y0,
- tree->client_data);
-}
-
-static void treeview_test_update_size(struct core_window *cw,
- int width, int height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->resized(tree, width, height, tree->client_data);
-}
-
-static void treeview_test_scroll_visible(struct core_window *cw,
- const struct rect *r)
-{
-}
-
-static void treeview_test_get_window_dimensions(struct core_window *cw,
- int *width, int *height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->get_window_dimensions(width, height,
- tree->client_data);
-}
-
-static void treeview_test_drag_status(struct core_window *cw,
- core_window_drag_status ds)
-{
- struct tree *tree = (struct tree *)cw;
-
- switch (ds) {
- case CORE_WINDOW_DRAG_NONE:
- tree->drag = TREE_NO_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_SELECTION:
- tree->drag = TREE_SELECT_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_MOVE:
- tree->drag = TREE_MOVE_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_TEXT_SELECTION:
- tree->drag = TREE_TEXTAREA_DRAG;
- break;
-
- default:
- break;
- }
-}
-
-struct core_window_callback_table cw_t = {
- .redraw_request = treeview_test_redraw_request,
- .update_size = treeview_test_update_size,
- .scroll_visible = treeview_test_scroll_visible,
- .get_window_dimensions = treeview_test_get_window_dimensions,
- .drag_status = treeview_test_drag_status
-};
-
-static bool treeview_test_init(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new global history.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_init(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new hotlist.", 0);
- err = hotlist_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init hotlist manager.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session == NULL &&
- "Call sslcert_viewer_init directly, "
- "this compat. layer can't cope with simultanious "
- "sslcert viewers");
- err = sslcert_viewer_init(&cw_t, (struct core_window *)tree,
- ssl_current_session);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_fini(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_fini(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise hotlist.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- err = sslcert_viewer_fini(ssl_current_session);
- ssl_current_session = NULL;
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_redraw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- struct rect clip;
-
- clip.x0 = clip_x;
- clip.y0 = clip_y;
- clip.x1 = clip_x + clip_width;
- clip.y1 = clip_y + clip_height;
-
- switch (tree->flags) {
- case TREE_SSLCERT:
- if (ssl_current_session != NULL) {
- sslcert_viewer_redraw(ssl_current_session, x, y, &clip, ctx);
- }
- return true;
- case TREE_COOKIES:
- cookie_manager_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HISTORY:
- global_history_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HOTLIST:
- hotlist_redraw(x, y, &clip, ctx);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_mouse_action(struct tree *tree,
- browser_mouse_state mouse, int x, int y)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
- return true;
- case TREE_COOKIES:
- cookie_manager_mouse_action(mouse, x, y);
- return true;
- case TREE_HISTORY:
- global_history_mouse_action(mouse, x, y);
- return true;
- case TREE_HOTLIST:
- hotlist_mouse_action(mouse, x, y);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_keypress(struct tree *tree, uint32_t key)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_keypress(ssl_current_session, key);
- return true;
- case TREE_COOKIES:
- cookie_manager_keypress(key);
- return true;
- case TREE_HISTORY:
- global_history_keypress(key);
- return true;
- case TREE_HOTLIST:
- hotlist_keypress(key);
- return true;
- }
-
- return false;
-}
-
-/* -------------------------------------------------------------------------- */
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks, void *client_data)
-{
- struct tree *tree;
-
- tree = calloc(sizeof(struct tree), 1);
- if (tree == NULL) {
- LOG("calloc failed");
- guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0);
- return NULL;
- }
-
- tree->flags = flags;
- tree->drag = TREE_NO_DRAG;
- tree->callbacks = callbacks;
- tree->client_data = client_data;
-
- treeview_test_init(tree);
-
- return tree;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree)
-{
- treeview_test_fini(tree);
- free(tree);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- assert(tree != NULL);
-
- treeview_test_redraw(tree, x, y, clip_x, clip_y,
- clip_width, clip_height, ctx);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
- int y)
-{
- assert(tree != NULL);
-
- if (treeview_test_mouse_action(tree, mouse, x, y)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1)
-{
- assert(tree != NULL);
-
- treeview_test_mouse_action(tree, BROWSER_MOUSE_HOVER, x1, y1);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_keypress(struct tree *tree, uint32_t key)
-{
- if (treeview_test_keypress(tree, key)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-tree_drag_type tree_drag_status(struct tree *tree)
-{
- assert(tree != NULL);
- return tree->drag;
-}
diff --git a/frontends/amiga/desktop-tree.h b/frontends/amiga/desktop-tree.h
deleted file mode 100644
index f8864e1..0000000
--- a/frontends/amiga/desktop-tree.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt(a)users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#ifndef _NETSURF_DESKTOP_TREE_H_
-#define _NETSURF_DESKTOP_TREE_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "netsurf/mouse.h"
-
-struct sslcert_session_data;
-struct tree;
-struct redraw_context;
-
-/**
- * Current ssl session data for treeview
- *
- * @todo FIXME global certificate treeview state must go away, this is
- * just wrong.
- */
-extern struct sslcert_session_data *ssl_current_session;
-extern const char *tree_hotlist_path;
-
-/* Tree flags */
-enum tree_flags {
- TREE_HISTORY,
- TREE_COOKIES,
- TREE_SSLCERT,
- TREE_HOTLIST
-};
-
-typedef enum {
- TREE_NO_DRAG = 0,
- TREE_SELECT_DRAG,
- TREE_MOVE_DRAG,
- TREE_TEXTAREA_DRAG, /** < A drag that is passed to a textarea */
- TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
-} tree_drag_type;
-
-/** callbacks to perform necessary operations on treeview. */
-struct treeview_table {
- void (*redraw_request)(int x, int y, int width, int height,
- void *data); /**< request a redraw. */
- void (*resized)(struct tree *tree, int width, int height,
- void *data); /**< resize treeview area. */
- void (*scroll_visible)(int y, int height, void *data); /**< scroll visible treeview area. */
- void (*get_window_dimensions)(int *width, int *height, void *data); /**< get dimensions of window */
-};
-
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks,
- void *client_data);
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree);
-tree_drag_type tree_drag_status(struct tree *tree);
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx);
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
- int x, int y);
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1);
-bool tree_keypress(struct tree *tree, uint32_t key);
-
-
-#endif
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 04f8e8a..0fd4378 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -46,6 +46,9 @@
static struct Hook aslhookfunc;
+struct FileRequester *filereq;
+struct FileRequester *savereq;
+
HOOKF(ULONG, ami_file_asl_mime_hook, struct FileRequester *, fr, struct AnchorPathOld *)
{
char fname[1024];
diff --git a/frontends/amiga/file.h b/frontends/amiga/file.h
index 29a76c4..9120fff 100644
--- a/frontends/amiga/file.h
+++ b/frontends/amiga/file.h
@@ -21,8 +21,8 @@ struct hlcache_object;
struct selection;
struct gui_window_2;
-struct FileRequester *filereq;
-struct FileRequester *savereq;
+extern struct FileRequester *filereq;
+extern struct FileRequester *savereq;
enum {
AMINS_SAVE_SOURCE,
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 9fce681..e27d105 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -118,7 +118,6 @@
#include "desktop/searchweb.h"
/* NetSurf Amiga platform includes */
-#include "amiga/desktop-tree.h"
#include "amiga/gui.h"
#include "amiga/arexx.h"
#include "amiga/bitmap.h"
@@ -151,7 +150,6 @@
#include "amiga/search.h"
#include "amiga/selectmenu.h"
#include "amiga/theme.h"
-#include "amiga/tree.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
@@ -547,6 +545,17 @@ static void ami_set_screen_defaults(struct Screen *screen)
nsoption_default_set_int(cookies_window_xsize, width);
nsoption_default_set_int(cookies_window_ysize, height);
+ nsoption_default_set_int(history_window_ypos, top);
+ nsoption_default_set_int(history_window_xpos, left);
+ nsoption_default_set_int(history_window_xsize, width);
+ nsoption_default_set_int(history_window_ysize, height);
+
+ nsoption_default_set_int(hotlist_window_ypos, top);
+ nsoption_default_set_int(hotlist_window_xpos, left);
+ nsoption_default_set_int(hotlist_window_xsize, width);
+ nsoption_default_set_int(hotlist_window_ysize, height);
+
+
nsoption_default_set_int(window_x, 0);
nsoption_default_set_int(window_y, screen->BarHeight + 1);
nsoption_default_set_int(window_width, screen->Width);
@@ -1013,8 +1022,7 @@ static void gui_init2(int argc, char** argv)
}
/**/
- ami_hotlist_initialise(nsoption_charp(hotlist_file));
- ami_global_history_initialise();
+ hotlist_init(nsoption_charp(hotlist_file));
search_web_select_provider(nsoption_int(search_provider));
if (notalreadyrunning &&
@@ -3037,8 +3045,7 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
- ami_hotlist_free(nsoption_charp(hotlist_file));
- ami_global_history_free();
+ hotlist_fini(nsoption_charp(hotlist_file));
#ifdef __amigaos4__
if(IApplication && ami_appid)
UnregisterApplication(ami_appid, NULL);
@@ -3182,7 +3189,7 @@ static bool ami_gui_hotlist_add(void *userdata, int level, int item,
return true;
}
-static int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, struct gui_window_2 *gwin)
+static int ami_gui_hotlist_scan(struct List *speed_button_list, struct gui_window_2 *gwin)
{
struct ami_gui_tb_userdata userdata;
userdata.gw = gwin;
@@ -3204,7 +3211,7 @@ static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
NewList(&gwin->hotlist_toolbar_list);
- if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) {
+ if(ami_gui_hotlist_scan(&gwin->hotlist_toolbar_list, gwin) > 0) {
gwin->objects[GID_HOTLIST] =
SpeedBarObj,
GA_ID, GID_HOTLIST,
@@ -3303,7 +3310,7 @@ static void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin)
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) {
+ if(ami_gui_hotlist_scan(&gwin->hotlist_toolbar_list, gwin) > 0) {
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_HOTLIST],
gwin->win, NULL,
SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list,
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
old mode 100755
new mode 100644
index 2287c70..f326f91
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,28 +16,449 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Implementation of Amiga global history viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
#include <stdbool.h>
-#include <proto/exec.h>
+#include <string.h>
+
+#include <proto/asl.h>
+#include <proto/dos.h>
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
-#include "utils/errors.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include <reaction/reaction_macros.h>
+#include "desktop/global_history.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+
+#include "amiga/corewindow.h"
+#include "amiga/drag.h"
+#include "amiga/file.h"
#include "amiga/history.h"
-#include "amiga/tree.h"
-#include "amiga/tree.h"
+#include "amiga/libs.h"
+#include "amiga/theme.h"
+#include "amiga/utf8.h"
+
+enum {
+ /* Project menu */
+ AMI_HISTORY_M_PROJECT = 0,
+ AMI_HISTORY_M_EXPORT,
+ AMI_HISTORY_M_BAR_P1,
+ AMI_HISTORY_M_EXPAND,
+ AMI_HISTORY_M_EXPAND_ALL,
+ AMI_HISTORY_M_EXPAND_FOLDERS,
+ AMI_HISTORY_M_EXPAND_LINKS,
+ AMI_HISTORY_M_COLLAPSE,
+ AMI_HISTORY_M_COLLAPSE_ALL,
+ AMI_HISTORY_M_COLLAPSE_FOLDERS,
+ AMI_HISTORY_M_COLLAPSE_LINKS,
+ AMI_HISTORY_M_BAR_P2,
+ AMI_HISTORY_M_SNAPSHOT,
+ AMI_HISTORY_M_BAR_P3,
+ AMI_HISTORY_M_CLOSE,
+ /* Edit menu */
+ AMI_HISTORY_M_EDIT,
+ AMI_HISTORY_M_SELECTALL,
+ AMI_HISTORY_M_CLEAR,
+ AMI_HISTORY_M_BAR_E1,
+ AMI_HISTORY_M_DELETE,
+ AMI_HISTORY_M_LAST
+};
+
+/**
+ * Amiga history viewer window context
+ */
+struct ami_history_global_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+
+ struct ami_menu_data *menu_data[AMI_HISTORY_M_LAST + 1];
+ struct Menu *imenu; /* Intuition menu */
+};
+
+static struct ami_history_global_window *history_window = NULL;
+
+
+static void
+ami_history_global_menu_free(struct ami_history_global_window *history_win)
+{
+ SetAttrs(history_win->core.objects[GID_CW_WIN],
+ WINDOW_MenuStrip, NULL,
+ TAG_DONE);
+
+ ami_menu_free_menu(history_win->menu_data, AMI_HISTORY_M_LAST, history_win->imenu);
+}
+
+/**
+ * destroy a previously created history view
+ */
+static void
+ami_history_global_destroy(struct ami_corewindow *ami_cw)
+{
+ nserror res;
+
+ if(history_window == NULL)
+ return;
+
+ res = global_history_fini();
+ if (res == NSERROR_OK) {
+ ami_history_global_menu_free(history_window);
+ res = ami_corewindow_fini(&history_window->core); /* closes the window for us, frees history_win */
+ history_window = NULL;
+ }
+}
+
+
+/**
+ * callback for mouse action for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ global_history_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for keypress for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (global_history_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback on draw event for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ global_history_redraw(x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback on drag end for history viewer
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ struct nsurl *url = NULL;
+ const char *title = NULL;
+ bool ok = false;
+ struct gui_window_2 *gwin;
+ struct ami_corewindow *cw;
+
+ if(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((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+ (ami_cw->icon_drop != NULL)) {
+ cw->icon_drop(cw, url, title, x, y);
+ }
+ }
+ return NSERROR_OK;
+}
+
+/**
+ * menu stuff
+ */
+
+ /* menu hook functions */
+HOOKF(void, ami_history_global_menu_item_project_export, APTR, window, struct IntuiMessage *)
+{
+ char fname[1024];
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ if(AslRequestTags(savereq,
+ ASLFR_Window, ami_cw->win,
+ ASLFR_SleepWindow, TRUE,
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_InitialFile, "history.html",
+ TAG_DONE)) {
+ strlcpy(fname, savereq->fr_Drawer, 1024);
+ AddPart(fname, savereq->fr_File, 1024);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_WAIT);
+ global_history_export(fname, NULL);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_DEFAULT);
+ }
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(false);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(true);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(false);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+ global_history_contract(true);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
+{
+ global_history_contract(true);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
+{
+ global_history_contract(false);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ nsoption_set_int(history_window_ypos, ami_cw->win->TopEdge);
+ nsoption_set_int(history_window_xpos, ami_cw->win->LeftEdge);
+ nsoption_set_int(history_window_xsize, ami_cw->win->Width);
+ nsoption_set_int(history_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_close, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ ami_cw->close_window = true;
+}
+
+HOOKF(void, ami_history_global_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
+{
+ global_history_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_history_global_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+ global_history_keypress(NS_KEY_CLEAR_SELECTION);
+}
-struct treeview_window *global_history_window = NULL;
+HOOKF(void, ami_history_global_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+ global_history_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
+/* menu setup */
+
+static void ami_history_global_menulabs(struct ami_menu_data **md)
+{
+ ami_menu_alloc_item(md, AMI_HISTORY_M_PROJECT, NM_TITLE, "Tree", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPORT, NM_ITEM, "TreeExport", 'S', "TBImages:list_save",
+ ami_history_global_menu_item_project_export, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND, NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_ALL, NM_SUB, "All", '+', NULL,
+ ami_history_global_menu_item_project_expand_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_history_global_menu_item_project_expand_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_history_global_menu_item_project_expand_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE, NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_ALL, NM_SUB, "All", '-', NULL,
+ ami_history_global_menu_item_project_collapse_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_history_global_menu_item_project_collapse_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_history_global_menu_item_project_collapse_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
+ ami_history_global_menu_item_project_snapshot, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
+ ami_history_global_menu_item_project_close, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_SELECTALL, NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+ ami_history_global_menu_item_edit_select_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_CLEAR, NM_ITEM, "ClearNS", 0, NSA_SPACE,
+ ami_history_global_menu_item_edit_clear, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_DELETE, NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+ ami_history_global_menu_item_edit_delete, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HISTORY_M_LAST, NM_END, NULL, 0, NULL, NULL, NULL, 0);
+}
+
+static struct Menu *
+ami_history_global_menu_create(struct ami_history_global_window *history_win)
+{
+ ami_history_global_menulabs(history_win->menu_data);
+ history_win->imenu = ami_menu_layout(history_win->menu_data, AMI_HISTORY_M_LAST);
+ if(history_win->imenu == NULL) return NULL;
+
+ return history_win->imenu;
+}
-void ami_global_history_initialise(void)
+
+static nserror
+ami_history_global_create_window(struct ami_history_global_window *history_win)
{
- global_history_window = ami_tree_create(TREE_HISTORY, NULL);
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&history_win->core;
+
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(history_window_ypos),
+ WA_Left, nsoption_int(history_window_xpos),
+ WA_Width, nsoption_int(history_window_xsize),
+ WA_Height, nsoption_int(history_window_ysize),
+ 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_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, history_win,
+ WINDOW_MenuStrip, ami_history_global_menu_create(history_win),
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
- if(!global_history_window) return;
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
}
-void ami_global_history_free()
+/* exported interface documented in amiga/cookies.h */
+nserror ami_history_global_present(void)
{
- ami_tree_destroy(global_history_window);
- global_history_window = NULL;
+ struct ami_history_global_window *ncwin;
+ nserror res;
+
+ if(history_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_history_global_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("GlobalHistory"));
+
+ res = ami_history_global_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_history_global_draw;
+ ncwin->core.key = ami_history_global_key;
+ ncwin->core.mouse = ami_history_global_mouse;
+ ncwin->core.close = ami_history_global_destroy;
+ ncwin->core.event = NULL;
+ ncwin->core.drag_end = ami_history_global_drag_end;
+ ncwin->core.icon_drop = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = global_history_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ history_window = ncwin;
+
+ return NSERROR_OK;
}
+
diff --git a/frontends/amiga/history.h b/frontends/amiga/history.h
old mode 100755
new mode 100644
index 47e00ed..67ab670
--- a/frontends/amiga/history.h
+++ b/frontends/amiga/history.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_HISTORY_H
-#define AMIGA_HISTORY_H
-#include "amiga/desktop-tree.h"
+#ifndef AMIGA_HISTORY_GLOBAL_H
+#define AMIGA_HISTORY_GLOBAL_H
-#define GLOBAL_HISTORY_RECENT_URLS 16
-
-void ami_global_history_initialise(void);
-void ami_global_history_free(void);
-
-extern struct treeview_window *global_history_window;
+/** Open the global history viewer */
+nserror ami_history_global_present(void);
#endif
+
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
old mode 100755
new mode 100644
index fc2342d..a0fd303
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008, 2009, 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,16 +16,84 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Implementation of Amiga hotlist viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
-#include <proto/exec.h>
-#include "utils/nsurl.h"
+#include <proto/asl.h>
+#include <proto/dos.h>
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
+
+#include <reaction/reaction_macros.h>
+
#include "desktop/hotlist.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+#include "amiga/corewindow.h"
+#include "amiga/drag.h"
+#include "amiga/file.h"
#include "amiga/hotlist.h"
-#include "amiga/tree.h"
+#include "amiga/libs.h"
+#include "amiga/theme.h"
+#include "amiga/utf8.h"
+
+enum {
+ /* Project menu */
+ AMI_HOTLIST_M_PROJECT = 0,
+ AMI_HOTLIST_M_EXPORT,
+ AMI_HOTLIST_M_BAR_P1,
+ AMI_HOTLIST_M_EXPAND,
+ AMI_HOTLIST_M_EXPAND_ALL,
+ AMI_HOTLIST_M_EXPAND_FOLDERS,
+ AMI_HOTLIST_M_EXPAND_LINKS,
+ AMI_HOTLIST_M_COLLAPSE,
+ AMI_HOTLIST_M_COLLAPSE_ALL,
+ AMI_HOTLIST_M_COLLAPSE_FOLDERS,
+ AMI_HOTLIST_M_COLLAPSE_LINKS,
+ AMI_HOTLIST_M_BAR_P2,
+ AMI_HOTLIST_M_SNAPSHOT,
+ AMI_HOTLIST_M_BAR_P3,
+ AMI_HOTLIST_M_CLOSE,
+ /* Edit menu */
+ AMI_HOTLIST_M_EDIT,
+ AMI_HOTLIST_M_NEWFOLDER,
+ AMI_HOTLIST_M_NEWLINK,
+ AMI_HOTLIST_M_EDIT_EDIT,
+ AMI_HOTLIST_M_BAR_E1,
+ AMI_HOTLIST_M_SELECTALL,
+ AMI_HOTLIST_M_CLEAR,
+ AMI_HOTLIST_M_BAR_E2,
+ AMI_HOTLIST_M_DELETE,
+ AMI_HOTLIST_M_LAST
+};
+
+/**
+ * Amiga hotlist viewer window context
+ */
+struct ami_hotlist_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+
+ struct ami_menu_data *menu_data[AMI_HOTLIST_M_LAST + 1];
+ struct Menu *imenu; /* Intuition menu */
+};
+
+static struct ami_hotlist_window *hotlist_window = NULL;
struct ami_hotlist_ctx {
void *userdata;
@@ -37,22 +105,7 @@ struct ami_hotlist_ctx {
bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder);
};
-struct treeview_window *hotlist_window = NULL;
-
-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;
-}
-
-
+/** hotlist scanner */
static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
{
struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
@@ -118,3 +171,426 @@ nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
return error;
}
+
+
+/**
+ * callback for mouse action for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ hotlist_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for keypress for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (hotlist_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback on draw event for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ hotlist_redraw(x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window has ended
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ nsurl *url = NULL;
+ const char *title = NULL;
+ bool ok = false;
+ struct gui_window_2 *gwin;
+ struct ami_corewindow *cw;
+
+ if(hotlist_has_selection()) {
+ ok = hotlist_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((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+ (ami_cw->icon_drop != NULL)) {
+ cw->icon_drop(cw, url, title, x, y);
+ }
+ }
+ return NSERROR_OK;
+}
+
+/**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y)
+{
+ hotlist_add_entry(url, title, true, y);
+ return NSERROR_OK;
+}
+
+/**
+ * menu stuff
+ */
+
+static void
+ami_hotlist_menu_free(struct ami_hotlist_window *hotlist_win)
+{
+ SetAttrs(hotlist_win->core.objects[GID_CW_WIN],
+ WINDOW_MenuStrip, NULL,
+ TAG_DONE);
+
+ ami_menu_free_menu(hotlist_win->menu_data, AMI_HOTLIST_M_LAST, hotlist_win->imenu);
+}
+
+ /* menu hook functions */
+HOOKF(void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *)
+{
+ char fname[1024];
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ if(AslRequestTags(savereq,
+ ASLFR_Window, ami_cw->win,
+ ASLFR_SleepWindow, TRUE,
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_InitialFile, "hotlist.html",
+ TAG_DONE)) {
+ strlcpy(fname, savereq->fr_Drawer, 1024);
+ AddPart(fname, savereq->fr_File, 1024);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_WAIT);
+ hotlist_export(fname, NULL);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_DEFAULT);
+ }
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ nsoption_set_int(hotlist_window_ypos, ami_cw->win->TopEdge);
+ nsoption_set_int(hotlist_window_xpos, ami_cw->win->LeftEdge);
+ nsoption_set_int(hotlist_window_xsize, ami_cw->win->Width);
+ nsoption_set_int(hotlist_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_close, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ ami_cw->close_window = true;
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_newfolder, APTR, window, struct IntuiMessage *)
+{
+ hotlist_add_folder(NULL, false, 0);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_newlink, APTR, window, struct IntuiMessage *)
+{
+ hotlist_add_entry(NULL, NULL, false, 0);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_edit, APTR, window, struct IntuiMessage *)
+{
+ hotlist_edit_selection();
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_CLEAR_SELECTION);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
+/* menu setup */
+
+static void ami_hotlist_menulabs(struct ami_menu_data **md)
+{
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_PROJECT, NM_TITLE, "Tree", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPORT, NM_ITEM, "TreeExport", 'S', "TBImages:list_save",
+ ami_hotlist_menu_item_project_export, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND, NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_ALL, NM_SUB, "All", '+', NULL,
+ ami_hotlist_menu_item_project_expand_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_hotlist_menu_item_project_expand_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_hotlist_menu_item_project_expand_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE, NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_ALL, NM_SUB, "All", '-', NULL,
+ ami_hotlist_menu_item_project_collapse_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_hotlist_menu_item_project_collapse_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_hotlist_menu_item_project_collapse_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
+ ami_hotlist_menu_item_project_snapshot, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
+ ami_hotlist_menu_item_project_close, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWFOLDER, NM_ITEM, "TreeNewFolder", 'N', "TBImages:list_drawer",
+ ami_hotlist_menu_item_edit_newfolder, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWLINK, NM_ITEM, "TreeNewLink", 0, "TBImages:list_favouriteadd",
+ ami_hotlist_menu_item_edit_newlink, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT_EDIT, NM_ITEM, "TreeEdit", 'E', "TBImages:list_edit",
+ ami_hotlist_menu_item_edit_edit, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_SELECTALL, NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+ ami_hotlist_menu_item_edit_select_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_CLEAR, NM_ITEM, "ClearNS", 0, NSA_SPACE,
+ ami_hotlist_menu_item_edit_clear, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_DELETE, NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+ ami_hotlist_menu_item_edit_delete, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_LAST, NM_END, NULL, 0, NULL, NULL, NULL, 0);
+}
+
+static struct Menu *
+ami_hotlist_menu_create(struct ami_hotlist_window *hotlist_win)
+{
+ ami_hotlist_menulabs(hotlist_win->menu_data);
+ hotlist_win->imenu = ami_menu_layout(hotlist_win->menu_data, AMI_HOTLIST_M_LAST);
+ if(hotlist_win->imenu == NULL) return NULL;
+
+ return hotlist_win->imenu;
+}
+
+
+static nserror
+ami_hotlist_create_window(struct ami_hotlist_window *hotlist_win)
+{
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&hotlist_win->core;
+
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(hotlist_window_ypos),
+ WA_Left, nsoption_int(hotlist_window_xpos),
+ WA_Width, nsoption_int(hotlist_window_xsize),
+ WA_Height, nsoption_int(hotlist_window_ysize),
+ 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_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, hotlist_win,
+ WINDOW_MenuStrip, ami_hotlist_menu_create(hotlist_win),
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+/**
+ * destroy a previously created hotlist view
+ */
+static void
+ami_hotlist_destroy(struct ami_corewindow *ami_cw)
+{
+ nserror res;
+
+ if(hotlist_window == NULL)
+ return;
+
+ res = hotlist_manager_fini();
+ if (res == NSERROR_OK) {
+ ami_hotlist_menu_free(hotlist_window);
+ res = ami_corewindow_fini(&hotlist_window->core); /* closes the window for us, frees hotlist_win */
+ hotlist_window = NULL;
+ }
+
+ ami_gui_hotlist_update_all();
+}
+
+
+/* exported interface documented in amiga/hotlist.h */
+nserror ami_hotlist_present(void)
+{
+ struct ami_hotlist_window *ncwin;
+ nserror res;
+
+ if(hotlist_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_hotlist_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
+
+ res = ami_hotlist_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_hotlist_draw;
+ ncwin->core.key = ami_hotlist_key;
+ ncwin->core.mouse = ami_hotlist_mouse;
+ ncwin->core.close = ami_hotlist_destroy;
+ ncwin->core.event = NULL;
+ ncwin->core.drag_end = ami_hotlist_drag_end;
+ ncwin->core.icon_drop = ami_hotlist_icon_drop;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = hotlist_manager_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ hotlist_window = ncwin;
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in amiga/hotlist.h */
+void ami_hotlist_close(void)
+{
+ ami_hotlist_destroy((struct ami_corewindow *)hotlist_window);
+}
+
diff --git a/frontends/amiga/hotlist.h b/frontends/amiga/hotlist.h
old mode 100755
new mode 100644
index 113a2d1..588a72d
--- a/frontends/amiga/hotlist.h
+++ b/frontends/amiga/hotlist.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -19,16 +19,18 @@
#ifndef AMIGA_HOTLIST_H
#define AMIGA_HOTLIST_H
-struct nsurl;
-struct treeview_window;
+#include "utils/nsurl.h"
-extern struct treeview_window *hotlist_window;
-
-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));
+/** Open the hotlist viewer */
+nserror ami_hotlist_present(void);
+/** Close the hotlist viewer
+ * normally this shouldn't be used; only exists for ARexx use
+ */
+void ami_hotlist_close(void);
+/** Scan the hotlist */
+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));
#endif
+
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index d88139d..d815932 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -73,7 +73,6 @@
#include "amiga/print.h"
#include "amiga/search.h"
#include "amiga/theme.h"
-#include "amiga/tree.h"
#include "amiga/utf8.h"
#include "amiga/schedule.h"
@@ -106,7 +105,7 @@ static bool menu_glyphs_loaded = false;
const char * const netsurf_version;
const char * const verdate;
-static nserror ami_menu_scan(struct tree *tree, struct ami_menu_data **md);
+static nserror ami_menu_scan(struct ami_menu_data **md);
void ami_menu_arexx_scan(struct ami_menu_data **md);
void ami_menu_set_check_toggled(void)
@@ -362,7 +361,7 @@ HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessag
HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(global_history_window,AMI_TREE_HISTORY);
+ ami_history_global_present();
}
HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
@@ -456,7 +455,7 @@ HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *)
HOOKF(void, ami_menu_item_hotlist_show, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
+ ami_hotlist_present();
}
HOOKF(void, ami_menu_item_hotlist_entries, APTR, window, struct IntuiMessage *)
@@ -992,7 +991,7 @@ void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu)
struct Menu *ami_menu_create(struct gui_window_2 *gwin)
{
ami_init_menulabs(gwin->menu_data);
- ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin->menu_data); //\todo this needs to be MenuClass created
+ ami_menu_scan(gwin->menu_data); //\todo this needs to be MenuClass created
ami_menu_arexx_scan(gwin->menu_data);
gwin->imenu = ami_menu_layout(gwin->menu_data, AMI_MENU_AREXX_MAX);
@@ -1092,7 +1091,7 @@ static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char
return true;
}
-static nserror ami_menu_scan(struct tree *tree, struct ami_menu_data **md)
+static nserror ami_menu_scan(struct ami_menu_data **md)
{
return ami_hotlist_scan((void *)md, AMI_MENU_HOTLIST, messages_get("HotlistMenu"), ami_menu_hotlist_add);
}
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
deleted file mode 100644
index b9747c0..0000000
--- a/frontends/amiga/tree.c
+++ /dev/null
@@ -1,1484 +0,0 @@
-/*
- * Copyright 2008 - 2013 Chris Young <chris(a)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 "netsurf/browser_window.h"
-#include "netsurf/window.h"
-#include "netsurf/keypress.h"
-#include "content/llcache.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/hotlist.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"
-#include "amiga/plotters.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 ami_generic_window w;
- 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;
-};
-
-static BOOL ami_tree_event(void *w);
-
-static const struct ami_win_event_table ami_tree_table = {
- ami_tree_event,
- ami_tree_close,
-};
-
-#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);
- free(twin->shared_pens);
- free(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", "");
- free(atrr_data);
- 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);
-
- free(atrr_data);
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- glob->rp = temprp;
- ami_gui_set_default_gg();
-}
-
-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
- };
-
- free(atrr_data);
-
- 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
- }
- }
-
- ami_gui_free_space_box(bbox);
- ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
- ami_clearclipreg(glob);
- ami_gui_set_default_gg();
-}
-
-static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
-{
- struct ami_tree_redraw_req *atrr_data = malloc(sizeof(struct ami_tree_redraw_req));
-
- 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 = calloc(1, sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS))) {
- 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);
-
- ami_gui_win_list_add(twin, AMINS_TVWINDOW, &ami_tree_table);
-
- 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(void *w)
-{
- struct treeview_window *twin = (struct treeview_window *)w;
- int i;
-
- twin->win = NULL;
- DisposeObject(twin->objects[OID_MAIN]);
- ami_gui_win_list_remove(twin);
- 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;
- }
-
- free(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;
- }
-}
-
-static BOOL ami_tree_event(void *w)
-{
- /* return TRUE if window destroyed */
- struct treeview_window *twin = (struct treeview_window *)w;
- 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 = calloc(1, sizeof(struct treeview_window));
-
- 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/frontends/amiga/tree.h b/frontends/amiga/tree.h
deleted file mode 100755
index a8cada5..0000000
--- a/frontends/amiga/tree.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2008, 2009 Chris Young <chris(a)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 "amiga/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(void *w); /* for Arexx interface only */
-
-extern const struct treeview_table ami_tree_callbacks;
-
-#endif
--
NetSurf Browser
6 years, 8 months
netsurf: branch master updated. release/3.6-172-gd1693c2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/d1693c27c0d9658b655c1...
...commit http://git.netsurf-browser.org/netsurf.git/commit/d1693c27c0d9658b655c158...
...tree http://git.netsurf-browser.org/netsurf.git/tree/d1693c27c0d9658b655c158a9...
The branch, master has been updated
via d1693c27c0d9658b655c158a9652f87683719325 (commit)
via 9be0f4ccaf9696173fb910660352be6648811040 (commit)
from 2d9ed9cbc4bd611d027b07f40bcf2dad68632857 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d1693c27c0d9658b655...
commit d1693c27c0d9658b655c158a9652f87683719325
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix windows installer generation
the windows installer package generation was not correctly
parameterised which resulted in fetching resources from incorrect
locations. Additionally the clean target was not removing generated
installer output.
diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index 41c8b8c..1b93e4c 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -3,10 +3,14 @@
#
# This file is part of NetSurf
+
+VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+
+
LDFLAGS += -L${GCCSDK_INSTALL_ENV}/lib
CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
-
$(eval $(call pkg_config_find_and_add,libcares,Cares))
$(eval $(call pkg_config_find_and_add,zlib,ZLib))
@@ -68,10 +72,25 @@ install-windows:
package-windows: netsurf-installer.exe
WIN_RES_OBJ := installer.nsi NetSurf.ico netsurf.png welcome.html default.css
-WIN_RES_INS_OBJ := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(WIN_RES_OBJ)) $(OBJROOT)/messages
+WIN_RES_INS_OBJ := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(WIN_RES_OBJ)) $(OBJROOT)/messages-en
+
+# deal with making installer generation verbose
+ifeq ($(Q),)
+NSIS_VERBOSE := 4
+else
+NSIS_VERBOSE := 0
+endif
-$(OBJROOT)/messages: resources/FatMessages
- $(Q)$(SPLIT_MESSAGES) -l en -p win -f messages resources/FatMessages > $@
+# installer messages generation
+$(OBJROOT)/messages-en: resources/FatMessages
+ $(VQ)echo "MSGSPLIT: Language: en Filter: win"
+ $(Q)$(SPLIT_MESSAGES) -l en -p win -f messages -o $@ $<
netsurf-installer.exe: $(EXETARGET) $(WIN_RES_INS_OBJ)
- makensis -V4 -NOCD $(FRONTEND_RESOURCES_DIR)/installer.nsi
+ $(VQ)echo "MAKENSIS: $@"
+ $(Q)makensis -V$(NSIS_VERBOSE) -NOCD -DOBJROOT=$(OBJROOT) -DRESDIR=$(FRONTEND_RESOURCES_DIR) -DVERSIONMAJOR=$(VERSION_MAJ) -DVERSIONMINOR=$(VERSION_MIN) -DOUTFNAME=$@ $(FRONTEND_RESOURCES_DIR)/installer.nsi
+
+clean-installer:
+ $(VQ)echo " CLEAN: netsurf-installer.exe"
+ $(Q)$(RM) netsurf-installer.exe
+CLEANS += clean-installer
diff --git a/frontends/windows/res/installer.nsi b/frontends/windows/res/installer.nsi
index 0c733db..17afee2 100644
--- a/frontends/windows/res/installer.nsi
+++ b/frontends/windows/res/installer.nsi
@@ -3,21 +3,40 @@
# show up in a few places.
# All the other settings can be tweaked by editing the !defines at the top of this script
+
!define APPNAME "NetSurf"
!define COMPANYNAME "NetSurf"
!define DESCRIPTION "Web Browser"
-# These three must be integers
-!define VERSIONMAJOR 3
-!define VERSIONMINOR 6
-!define VERSIONBUILD 1
+
+# The version values must be simple integers
+!ifndef VERSIONMAJOR
+ !define VERSIONMAJOR 3
+!endif
+!ifndef VERSIONMINOR
+ !define VERSIONMINOR 7
+!endif
+!ifndef VERSIONBUILD
+ !define VERSIONBUILD 0
+!endif
+
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
-# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://www.netsurf-browser.org/" # "Support Information" link
!define UPDATEURL "http://www.netsurf-browser.org/" # "Product Updates" link
!define ABOUTURL "http://www.netsurf-browser.org/" # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
!define INSTALLSIZE 9000
-
+
+# output filename
+!ifndef OUTFNAME
+ !define OUTFNAME "netsurf-installer.exe"
+!endif
+
+# path to resources
+!ifndef RESDIR
+ !define RESDIR "frontends/windows/res"
+!endif
+
+
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
@@ -26,8 +45,8 @@ InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
LicenseData "COPYING"
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
-Icon "frontends\windows\res\NetSurf.ico"
-outFile "netsurf-installer.exe"
+Icon "${RESDIR}\NetSurf.ico"
+outFile "${OUTFNAME}"
BrandingText "${COMPANYNAME}"
!include LogicLib.nsh
@@ -53,21 +72,23 @@ function .onInit
functionEnd
section "install"
- # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
+ # Files for the install directory
+
+ # Default output path
setOutPath $INSTDIR
- # Files added here should be removed by the uninstaller (see section "uninstall")
- file "NetSurf.exe"
- file /oname=NetSurf.ico "frontends\windows\res\NetSurf.ico"
- file /oname=default.css "frontends\windows\res\default.css"
- file /oname=internal.css "frontends\windows\res\internal.css"
- file /oname=adblock.css "frontends\windows\res\adblock.css"
- file /oname=welcome.html "frontends\windows\res\welcome.html"
- file /oname=credits.html "frontends\windows\res\credits.html"
- file /oname=licence.html "frontends\windows\res\licence.html"
- file /oname=netsurf.png "frontends\windows\res\netsurf.png"
- file /oname=messages "build-Linux-windows\messages"
- file /oname=ca-bundle.crt "frontends\windows\res\ca-bundle.crt"
- # Add any other files for the install directory (license files, app data, etc) here
+
+ # Files added here should be removed by the uninstaller section
+ file "NetSurf.exe"
+ file /oname=NetSurf.ico "${RESDIR}\NetSurf.ico"
+ file /oname=default.css "${RESDIR}\default.css"
+ file /oname=internal.css "${RESDIR}\internal.css"
+ file /oname=adblock.css "${RESDIR}\adblock.css"
+ file /oname=welcome.html "${RESDIR}\welcome.html"
+ file /oname=credits.html "${RESDIR}\credits.html"
+ file /oname=licence.html "${RESDIR}\licence.html"
+ file /oname=netsurf.png "${RESDIR}\netsurf.png"
+ file /oname=messages "${OBJROOT}\messages-en"
+ file /oname=ca-bundle.crt "${RESDIR}\ca-bundle.crt"
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
@@ -95,7 +116,7 @@ section "install"
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
sectionEnd
-
+
# Uninstaller
function un.onInit
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9be0f4ccaf9696173fb...
commit 9be0f4ccaf9696173fb910660352be6648811040
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fixup usage of directory creation macro in Makefiles
diff --git a/Makefile b/Makefile
index 77ab062..5f2697f 100644
--- a/Makefile
+++ b/Makefile
@@ -640,7 +640,7 @@ define split_messages
$$(MESSAGES_TARGET)/$(1)/Messages.tmp: resources/FatMessages
$$(VQ)echo "MSGSPLIT: Language: $(1) Filter: $$(MESSAGES_FILTER)"
- $$(Q)mkdir -p $$(MESSAGES_TARGET)/$(1)
+ $$(Q)$$(MKDIR) -p $$(MESSAGES_TARGET)/$(1)
$$(Q)$$(SPLIT_MESSAGES) -l $(1) -p $$(MESSAGES_FILTER) -f messages -o $$@ $$<
$$(MESSAGES_TARGET)/$(1)/Messages: $$(MESSAGES_TARGET)/$(1)/Messages.tmp
diff --git a/content/handlers/javascript/duktape/Makefile b/content/handlers/javascript/duktape/Makefile
index 37e33d5..fce79de 100644
--- a/content/handlers/javascript/duktape/Makefile
+++ b/content/handlers/javascript/duktape/Makefile
@@ -12,13 +12,13 @@ BINDINGS := $(wildcard content/handlers/javascript/duktape/*.bnd)
GBFLAGS+=-D
$(OBJROOT)/duktape/binding.h $(OBJROOT)/duktape/Makefile: content/handlers/javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
+ $(Q)$(MKDIR) -p $(OBJROOT)/duktape
$(VQ)echo " GENBIND: $<"
$(Q)nsgenbind $(GBFLAGS) -I content/handlers/javascript/WebIDL $< $(OBJROOT)/duktape
# create unimplemented report for doxygen
Docs/UnimplementedJavascript.txt: content/handlers/javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
+ $(Q)$(MKDIR) -p $(OBJROOT)/duktape
$(VQ)echo "/** \page unimplemented Unimplemented javascript bindings" > $@
$(VQ)echo "This is a list of all the binding methods, getters and setters without an implementation in a binding." >> $@
$(VQ)echo "" >> $@
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index 8115f2f..aa60207 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -76,9 +76,9 @@ 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)$(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)$(MKDIR) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -rp $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -rp $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cat resources/SearchEngines $(AMIGA_PKG_DIR)/SearchEngines >$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/SearchEngines
diff --git a/frontends/atari/Makefile b/frontends/atari/Makefile
index 60b7f87..7bc441c 100644
--- a/frontends/atari/Makefile
+++ b/frontends/atari/Makefile
@@ -147,13 +147,13 @@ ifneq ($(strip $(STACK)),)
endif
$(Q)rm -rf $(ATARI_TARGET_DIR)
$(Q)rm -rf $(PKGNAME)
- $(Q)mkdir $(ATARI_TARGET_DIR)
- $(Q)mkdir $(ATARI_TARGET_DIR)doc
- $(Q)mkdir $(ATARI_TARGET_DIR)downloads
- $(Q)mkdir $(ATARI_TARGET_DIR)res
- $(Q)mkdir $(ATARI_TARGET_DIR)res/fonts
- $(Q)mkdir $(ATARI_TARGET_DIR)res/icons
- $(Q)mkdir $(ATARI_TARGET_DIR)res/cache
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)doc
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)downloads
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/fonts
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/icons
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/cache
$(Q)touch $(ATARI_TARGET_DIR)cookies
$(Q)touch $(ATARI_TARGET_DIR)url.db
diff --git a/frontends/beos/Makefile b/frontends/beos/Makefile
index f40cce4..7693ac3 100644
--- a/frontends/beos/Makefile
+++ b/frontends/beos/Makefile
@@ -90,15 +90,15 @@ $(RSRC_BEOS): $(RDEF_BEOS) $(RDEF_IMP_BEOS)
# ----------------------------------------------------------------------------
install-beos:
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_BIN)
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @copyattr -d $(EXETARGET) $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/SearchEngines $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_BEOS_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)copyattr -d $(EXETARGET) $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/SearchEngines $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
# ----------------------------------------------------------------------------
# Package target
diff --git a/frontends/cocoa/Makefile b/frontends/cocoa/Makefile
index 8935d7b..a0ebfbb 100644
--- a/frontends/cocoa/Makefile
+++ b/frontends/cocoa/Makefile
@@ -171,7 +171,7 @@ define make_lproj
R_RESOURCES += $$(OBJROOT)/$(1).lproj
$$(OBJROOT)/$(1).lproj: $(2)
$(VQ)echo Bundling language $(1)
- $(Q)mkdir -p $$@
+ $(Q)$(MKDIR) -p $$@
$(Q)cp -pLR $(2) $$@
$(Q)$(SPLIT_MESSAGES) -l $(1) -p cocoa -f messages resources/FatMessages > $$@/Messages
endef
@@ -182,7 +182,7 @@ $$(OBJROOT)/$(2).lproj: $$(OBJROOT)/$(2).lproj/$(1:.xib=.nib)
$$(OBJROOT)/$(2).lproj/$(1:.xib=.nib): $(FRONTEND_RESOURCES_DIR)/$(1) $$(OBJROOT)/created
$(VQ)echo Compiling XIB $(1) for language $(2)
- $(Q)mkdir -p $$(OBJROOT)/$(2).lproj
+ $(Q)$(MKDIR) -p $$(OBJROOT)/$(2).lproj
$(Q)$(FRONTEND_SOURCE_DIR)/compile-xib.sh $(FRONTEND_RESOURCES_DIR)/$(1) $(2) $$@
ifeq ($(wildcard $(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings),$(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings)
@@ -202,16 +202,16 @@ install-cocoa: NetSurf.app
NetSurf.app: NetSurf $(FRONTEND_SOURCE_DIR)/Makefile $(R_RESOURCES) NetSurf.app/Contents/Info.plist
$(VQ)echo Assembling NetSurf.app bundle
- $(Q)mkdir -p NetSurf.app/Contents/MacOS
+ $(Q)$(MKDIR) -p NetSurf.app/Contents/MacOS
$(Q)cp NetSurf NetSurf.app/Contents/MacOS
$(Q)rm -rf NetSurf.app/Contents/Resources
- $(Q)mkdir -p NetSurf.app/Contents/Resources
+ $(Q)$(MKDIR) -p NetSurf.app/Contents/Resources
$(Q)cp -pLR $(R_RESOURCES) NetSurf.app/Contents/Resources
$(Q)echo 'APPL????' > NetSurf.app/Contents/PkgInfo
NetSurf.app/Contents/Info.plist: $(FRONTEND_RESOURCES_DIR)/NetSurf-Info.plist $(FRONTEND_SOURCE_DIR)/Makefile
$(VQ)echo Generating Info.plist
- $(Q)mkdir -p NetSurf.app/Contents
+ $(Q)$(MKDIR) -p NetSurf.app/Contents
$(Q)sed -e 's/$${EXECUTABLE_NAME}/$(EXETARGET)/' \
-e 's/$${PRODUCT_NAME.*}/$(EXETARGET)/' \
-e 's/$${MACOSX_DEPLOYMENT_TARGET}/$(MACOSX_VERSION)/' \
diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile
index 3d47f8f..6d2acb0 100644
--- a/frontends/framebuffer/Makefile
+++ b/frontends/framebuffer/Makefile
@@ -171,8 +171,8 @@ NETSURF_FRAMEBUFFER_RESOURCE_LIST := adblock.css credits.html \
netsurf.png quirks.css welcome.html maps.html Messages
install-framebuffer:
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
$(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf-fb
$(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do cp -vL $(FRONTEND_RESOURCES_DIR)/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done
$(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index 76ef998..afbfcd7 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -198,11 +198,11 @@ GTK_TRANSLATIONS_HTML := de en fr it ja nl
NSGTK_RESOURCES_DESTDIR := $(DESTDIR)$(word 1,$(subst :, ,$(NETSURF_GTK_RES_PATH)))
install-gtk:
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_GTK_BIN)
$(Q)install $(EXETARGET) $(DESTDIR)$(NETSURF_GTK_BIN)netsurf-gtk$(SUBTARGET)
- $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/icons
+ $(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/icons
$(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/icons/*.png $(NSGTK_RESOURCES_DESTDIR)/icons
- $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/throbber
+ $(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/throbber
$(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/throbber/*.png $(NSGTK_RESOURCES_DESTDIR)/throbber
$(Q)tar -c -h -C $(NSGTK_RESOURCES_DIR) -f - $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(NSGTK_RESOURCES_DESTDIR) -f -
$(Q)install -m 0644 $(GTK_RESOURCES_LIST) $(NSGTK_RESOURCES_DESTDIR)
diff --git a/frontends/riscos/Makefile b/frontends/riscos/Makefile
index b457f02..87790ac 100644
--- a/frontends/riscos/Makefile
+++ b/frontends/riscos/Makefile
@@ -110,7 +110,7 @@ TPL_RISCOS := $(addprefix $(FRONTEND_SOURCE_DIR)/templates/,$(TPL_RISCOS))
define compile_template
!NetSurf/Resources/$(1)/Templates$$(TPLEXT): $(2)
$$(VQ)echo "TEMPLATE: $(2)"
- $$(Q)mkdir -p !NetSurf/Resources/$(1)
+ $$(Q)$$(MKDIR) -p !NetSurf/Resources/$(1)
$$(Q)$$(CC) -x c -E -P $$(CFLAGS) $(2) | $$(CCRES) - $$@
CLEAN_TEMPLATES += !NetSurf/Resources/$(1)/Templates$$(TPLEXT)
diff --git a/test/Makefile b/test/Makefile
index 7a763e9..fd54fb9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -166,7 +166,7 @@ coverage: test
$(TESTROOT)/created:
$(VQ)echo " MKDIR: $(TESTROOT)"
- $(Q)$(MKDIR) $(TESTROOT)
+ $(Q)$(MKDIR) -p $(TESTROOT)
$(Q)$(TOUCH) $@
.PHONY: test-clean
-----------------------------------------------------------------------
Summary of changes:
Makefile | 2 +-
content/handlers/javascript/duktape/Makefile | 4 +-
frontends/amiga/Makefile | 4 +-
frontends/atari/Makefile | 14 +++---
frontends/beos/Makefile | 18 +++----
frontends/cocoa/Makefile | 10 ++--
frontends/framebuffer/Makefile | 4 +-
frontends/gtk/Makefile | 6 +--
frontends/riscos/Makefile | 2 +-
frontends/windows/Makefile | 29 +++++++++--
frontends/windows/res/installer.nsi | 67 +++++++++++++++++---------
test/Makefile | 2 +-
12 files changed, 101 insertions(+), 61 deletions(-)
diff --git a/Makefile b/Makefile
index 77ab062..5f2697f 100644
--- a/Makefile
+++ b/Makefile
@@ -640,7 +640,7 @@ define split_messages
$$(MESSAGES_TARGET)/$(1)/Messages.tmp: resources/FatMessages
$$(VQ)echo "MSGSPLIT: Language: $(1) Filter: $$(MESSAGES_FILTER)"
- $$(Q)mkdir -p $$(MESSAGES_TARGET)/$(1)
+ $$(Q)$$(MKDIR) -p $$(MESSAGES_TARGET)/$(1)
$$(Q)$$(SPLIT_MESSAGES) -l $(1) -p $$(MESSAGES_FILTER) -f messages -o $$@ $$<
$$(MESSAGES_TARGET)/$(1)/Messages: $$(MESSAGES_TARGET)/$(1)/Messages.tmp
diff --git a/content/handlers/javascript/duktape/Makefile b/content/handlers/javascript/duktape/Makefile
index 37e33d5..fce79de 100644
--- a/content/handlers/javascript/duktape/Makefile
+++ b/content/handlers/javascript/duktape/Makefile
@@ -12,13 +12,13 @@ BINDINGS := $(wildcard content/handlers/javascript/duktape/*.bnd)
GBFLAGS+=-D
$(OBJROOT)/duktape/binding.h $(OBJROOT)/duktape/Makefile: content/handlers/javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
+ $(Q)$(MKDIR) -p $(OBJROOT)/duktape
$(VQ)echo " GENBIND: $<"
$(Q)nsgenbind $(GBFLAGS) -I content/handlers/javascript/WebIDL $< $(OBJROOT)/duktape
# create unimplemented report for doxygen
Docs/UnimplementedJavascript.txt: content/handlers/javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
+ $(Q)$(MKDIR) -p $(OBJROOT)/duktape
$(VQ)echo "/** \page unimplemented Unimplemented javascript bindings" > $@
$(VQ)echo "This is a list of all the binding methods, getters and setters without an implementation in a binding." >> $@
$(VQ)echo "" >> $@
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index 8115f2f..aa60207 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -76,9 +76,9 @@ 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)$(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)$(MKDIR) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -rp $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -rp $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cat resources/SearchEngines $(AMIGA_PKG_DIR)/SearchEngines >$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/SearchEngines
diff --git a/frontends/atari/Makefile b/frontends/atari/Makefile
index 60b7f87..7bc441c 100644
--- a/frontends/atari/Makefile
+++ b/frontends/atari/Makefile
@@ -147,13 +147,13 @@ ifneq ($(strip $(STACK)),)
endif
$(Q)rm -rf $(ATARI_TARGET_DIR)
$(Q)rm -rf $(PKGNAME)
- $(Q)mkdir $(ATARI_TARGET_DIR)
- $(Q)mkdir $(ATARI_TARGET_DIR)doc
- $(Q)mkdir $(ATARI_TARGET_DIR)downloads
- $(Q)mkdir $(ATARI_TARGET_DIR)res
- $(Q)mkdir $(ATARI_TARGET_DIR)res/fonts
- $(Q)mkdir $(ATARI_TARGET_DIR)res/icons
- $(Q)mkdir $(ATARI_TARGET_DIR)res/cache
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)doc
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)downloads
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/fonts
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/icons
+ $(Q)$(MKDIR) $(ATARI_TARGET_DIR)res/cache
$(Q)touch $(ATARI_TARGET_DIR)cookies
$(Q)touch $(ATARI_TARGET_DIR)url.db
diff --git a/frontends/beos/Makefile b/frontends/beos/Makefile
index f40cce4..7693ac3 100644
--- a/frontends/beos/Makefile
+++ b/frontends/beos/Makefile
@@ -90,15 +90,15 @@ $(RSRC_BEOS): $(RDEF_BEOS) $(RDEF_IMP_BEOS)
# ----------------------------------------------------------------------------
install-beos:
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_BIN)
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @copyattr -d $(EXETARGET) $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL $(FRONTEND_RESOURCES_DIR)/SearchEngines $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_BEOS_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)copyattr -d $(EXETARGET) $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ $(Q)cp -vRL $(FRONTEND_RESOURCES_DIR)/SearchEngines $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
# ----------------------------------------------------------------------------
# Package target
diff --git a/frontends/cocoa/Makefile b/frontends/cocoa/Makefile
index 8935d7b..a0ebfbb 100644
--- a/frontends/cocoa/Makefile
+++ b/frontends/cocoa/Makefile
@@ -171,7 +171,7 @@ define make_lproj
R_RESOURCES += $$(OBJROOT)/$(1).lproj
$$(OBJROOT)/$(1).lproj: $(2)
$(VQ)echo Bundling language $(1)
- $(Q)mkdir -p $$@
+ $(Q)$(MKDIR) -p $$@
$(Q)cp -pLR $(2) $$@
$(Q)$(SPLIT_MESSAGES) -l $(1) -p cocoa -f messages resources/FatMessages > $$@/Messages
endef
@@ -182,7 +182,7 @@ $$(OBJROOT)/$(2).lproj: $$(OBJROOT)/$(2).lproj/$(1:.xib=.nib)
$$(OBJROOT)/$(2).lproj/$(1:.xib=.nib): $(FRONTEND_RESOURCES_DIR)/$(1) $$(OBJROOT)/created
$(VQ)echo Compiling XIB $(1) for language $(2)
- $(Q)mkdir -p $$(OBJROOT)/$(2).lproj
+ $(Q)$(MKDIR) -p $$(OBJROOT)/$(2).lproj
$(Q)$(FRONTEND_SOURCE_DIR)/compile-xib.sh $(FRONTEND_RESOURCES_DIR)/$(1) $(2) $$@
ifeq ($(wildcard $(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings),$(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings)
@@ -202,16 +202,16 @@ install-cocoa: NetSurf.app
NetSurf.app: NetSurf $(FRONTEND_SOURCE_DIR)/Makefile $(R_RESOURCES) NetSurf.app/Contents/Info.plist
$(VQ)echo Assembling NetSurf.app bundle
- $(Q)mkdir -p NetSurf.app/Contents/MacOS
+ $(Q)$(MKDIR) -p NetSurf.app/Contents/MacOS
$(Q)cp NetSurf NetSurf.app/Contents/MacOS
$(Q)rm -rf NetSurf.app/Contents/Resources
- $(Q)mkdir -p NetSurf.app/Contents/Resources
+ $(Q)$(MKDIR) -p NetSurf.app/Contents/Resources
$(Q)cp -pLR $(R_RESOURCES) NetSurf.app/Contents/Resources
$(Q)echo 'APPL????' > NetSurf.app/Contents/PkgInfo
NetSurf.app/Contents/Info.plist: $(FRONTEND_RESOURCES_DIR)/NetSurf-Info.plist $(FRONTEND_SOURCE_DIR)/Makefile
$(VQ)echo Generating Info.plist
- $(Q)mkdir -p NetSurf.app/Contents
+ $(Q)$(MKDIR) -p NetSurf.app/Contents
$(Q)sed -e 's/$${EXECUTABLE_NAME}/$(EXETARGET)/' \
-e 's/$${PRODUCT_NAME.*}/$(EXETARGET)/' \
-e 's/$${MACOSX_DEPLOYMENT_TARGET}/$(MACOSX_VERSION)/' \
diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile
index 3d47f8f..6d2acb0 100644
--- a/frontends/framebuffer/Makefile
+++ b/frontends/framebuffer/Makefile
@@ -171,8 +171,8 @@ NETSURF_FRAMEBUFFER_RESOURCE_LIST := adblock.css credits.html \
netsurf.png quirks.css welcome.html maps.html Messages
install-framebuffer:
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
$(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf-fb
$(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do cp -vL $(FRONTEND_RESOURCES_DIR)/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done
$(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index 76ef998..afbfcd7 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -198,11 +198,11 @@ GTK_TRANSLATIONS_HTML := de en fr it ja nl
NSGTK_RESOURCES_DESTDIR := $(DESTDIR)$(word 1,$(subst :, ,$(NETSURF_GTK_RES_PATH)))
install-gtk:
- $(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_BIN)
+ $(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_GTK_BIN)
$(Q)install $(EXETARGET) $(DESTDIR)$(NETSURF_GTK_BIN)netsurf-gtk$(SUBTARGET)
- $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/icons
+ $(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/icons
$(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/icons/*.png $(NSGTK_RESOURCES_DESTDIR)/icons
- $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/throbber
+ $(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/throbber
$(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/throbber/*.png $(NSGTK_RESOURCES_DESTDIR)/throbber
$(Q)tar -c -h -C $(NSGTK_RESOURCES_DIR) -f - $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(NSGTK_RESOURCES_DESTDIR) -f -
$(Q)install -m 0644 $(GTK_RESOURCES_LIST) $(NSGTK_RESOURCES_DESTDIR)
diff --git a/frontends/riscos/Makefile b/frontends/riscos/Makefile
index b457f02..87790ac 100644
--- a/frontends/riscos/Makefile
+++ b/frontends/riscos/Makefile
@@ -110,7 +110,7 @@ TPL_RISCOS := $(addprefix $(FRONTEND_SOURCE_DIR)/templates/,$(TPL_RISCOS))
define compile_template
!NetSurf/Resources/$(1)/Templates$$(TPLEXT): $(2)
$$(VQ)echo "TEMPLATE: $(2)"
- $$(Q)mkdir -p !NetSurf/Resources/$(1)
+ $$(Q)$$(MKDIR) -p !NetSurf/Resources/$(1)
$$(Q)$$(CC) -x c -E -P $$(CFLAGS) $(2) | $$(CCRES) - $$@
CLEAN_TEMPLATES += !NetSurf/Resources/$(1)/Templates$$(TPLEXT)
diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index 41c8b8c..1b93e4c 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -3,10 +3,14 @@
#
# This file is part of NetSurf
+
+VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
+
+
LDFLAGS += -L${GCCSDK_INSTALL_ENV}/lib
CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
-
$(eval $(call pkg_config_find_and_add,libcares,Cares))
$(eval $(call pkg_config_find_and_add,zlib,ZLib))
@@ -68,10 +72,25 @@ install-windows:
package-windows: netsurf-installer.exe
WIN_RES_OBJ := installer.nsi NetSurf.ico netsurf.png welcome.html default.css
-WIN_RES_INS_OBJ := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(WIN_RES_OBJ)) $(OBJROOT)/messages
+WIN_RES_INS_OBJ := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(WIN_RES_OBJ)) $(OBJROOT)/messages-en
+
+# deal with making installer generation verbose
+ifeq ($(Q),)
+NSIS_VERBOSE := 4
+else
+NSIS_VERBOSE := 0
+endif
-$(OBJROOT)/messages: resources/FatMessages
- $(Q)$(SPLIT_MESSAGES) -l en -p win -f messages resources/FatMessages > $@
+# installer messages generation
+$(OBJROOT)/messages-en: resources/FatMessages
+ $(VQ)echo "MSGSPLIT: Language: en Filter: win"
+ $(Q)$(SPLIT_MESSAGES) -l en -p win -f messages -o $@ $<
netsurf-installer.exe: $(EXETARGET) $(WIN_RES_INS_OBJ)
- makensis -V4 -NOCD $(FRONTEND_RESOURCES_DIR)/installer.nsi
+ $(VQ)echo "MAKENSIS: $@"
+ $(Q)makensis -V$(NSIS_VERBOSE) -NOCD -DOBJROOT=$(OBJROOT) -DRESDIR=$(FRONTEND_RESOURCES_DIR) -DVERSIONMAJOR=$(VERSION_MAJ) -DVERSIONMINOR=$(VERSION_MIN) -DOUTFNAME=$@ $(FRONTEND_RESOURCES_DIR)/installer.nsi
+
+clean-installer:
+ $(VQ)echo " CLEAN: netsurf-installer.exe"
+ $(Q)$(RM) netsurf-installer.exe
+CLEANS += clean-installer
diff --git a/frontends/windows/res/installer.nsi b/frontends/windows/res/installer.nsi
index 0c733db..17afee2 100644
--- a/frontends/windows/res/installer.nsi
+++ b/frontends/windows/res/installer.nsi
@@ -3,21 +3,40 @@
# show up in a few places.
# All the other settings can be tweaked by editing the !defines at the top of this script
+
!define APPNAME "NetSurf"
!define COMPANYNAME "NetSurf"
!define DESCRIPTION "Web Browser"
-# These three must be integers
-!define VERSIONMAJOR 3
-!define VERSIONMINOR 6
-!define VERSIONBUILD 1
+
+# The version values must be simple integers
+!ifndef VERSIONMAJOR
+ !define VERSIONMAJOR 3
+!endif
+!ifndef VERSIONMINOR
+ !define VERSIONMINOR 7
+!endif
+!ifndef VERSIONBUILD
+ !define VERSIONBUILD 0
+!endif
+
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
-# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://www.netsurf-browser.org/" # "Support Information" link
!define UPDATEURL "http://www.netsurf-browser.org/" # "Product Updates" link
!define ABOUTURL "http://www.netsurf-browser.org/" # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
!define INSTALLSIZE 9000
-
+
+# output filename
+!ifndef OUTFNAME
+ !define OUTFNAME "netsurf-installer.exe"
+!endif
+
+# path to resources
+!ifndef RESDIR
+ !define RESDIR "frontends/windows/res"
+!endif
+
+
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
@@ -26,8 +45,8 @@ InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
LicenseData "COPYING"
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
-Icon "frontends\windows\res\NetSurf.ico"
-outFile "netsurf-installer.exe"
+Icon "${RESDIR}\NetSurf.ico"
+outFile "${OUTFNAME}"
BrandingText "${COMPANYNAME}"
!include LogicLib.nsh
@@ -53,21 +72,23 @@ function .onInit
functionEnd
section "install"
- # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
+ # Files for the install directory
+
+ # Default output path
setOutPath $INSTDIR
- # Files added here should be removed by the uninstaller (see section "uninstall")
- file "NetSurf.exe"
- file /oname=NetSurf.ico "frontends\windows\res\NetSurf.ico"
- file /oname=default.css "frontends\windows\res\default.css"
- file /oname=internal.css "frontends\windows\res\internal.css"
- file /oname=adblock.css "frontends\windows\res\adblock.css"
- file /oname=welcome.html "frontends\windows\res\welcome.html"
- file /oname=credits.html "frontends\windows\res\credits.html"
- file /oname=licence.html "frontends\windows\res\licence.html"
- file /oname=netsurf.png "frontends\windows\res\netsurf.png"
- file /oname=messages "build-Linux-windows\messages"
- file /oname=ca-bundle.crt "frontends\windows\res\ca-bundle.crt"
- # Add any other files for the install directory (license files, app data, etc) here
+
+ # Files added here should be removed by the uninstaller section
+ file "NetSurf.exe"
+ file /oname=NetSurf.ico "${RESDIR}\NetSurf.ico"
+ file /oname=default.css "${RESDIR}\default.css"
+ file /oname=internal.css "${RESDIR}\internal.css"
+ file /oname=adblock.css "${RESDIR}\adblock.css"
+ file /oname=welcome.html "${RESDIR}\welcome.html"
+ file /oname=credits.html "${RESDIR}\credits.html"
+ file /oname=licence.html "${RESDIR}\licence.html"
+ file /oname=netsurf.png "${RESDIR}\netsurf.png"
+ file /oname=messages "${OBJROOT}\messages-en"
+ file /oname=ca-bundle.crt "${RESDIR}\ca-bundle.crt"
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
@@ -95,7 +116,7 @@ section "install"
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
sectionEnd
-
+
# Uninstaller
function un.onInit
diff --git a/test/Makefile b/test/Makefile
index 7a763e9..fd54fb9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -166,7 +166,7 @@ coverage: test
$(TESTROOT)/created:
$(VQ)echo " MKDIR: $(TESTROOT)"
- $(Q)$(MKDIR) $(TESTROOT)
+ $(Q)$(MKDIR) -p $(TESTROOT)
$(Q)$(TOUCH) $@
.PHONY: test-clean
--
NetSurf Browser
6 years, 8 months
netsurf: branch master updated. release/3.6-170-g2d9ed9c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2d9ed9cbc4bd611d027b0...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2d9ed9cbc4bd611d027b07f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2d9ed9cbc4bd611d027b07f40...
The branch, master has been updated
via 2d9ed9cbc4bd611d027b07f40bcf2dad68632857 (commit)
from 047b37d5f8c3810f8942f5744bb92640fbd4879f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2d9ed9cbc4bd611d027...
commit 2d9ed9cbc4bd611d027b07f40bcf2dad68632857
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
rename default build output directory target
diff --git a/.gitignore b/.gitignore
index b16d6f9..35de191 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,10 +16,6 @@ frontends/gtk/res/fr/Messages
frontends/gtk/res/de/Messages
frontends/gtk/res/nl/Messages
frontends/gtk/res/it/Messages
-test/nsoption
-test/nsurl
-test/urldbtest
-test/llcache
codedocs
nsgtk
nsfb
@@ -34,4 +30,4 @@ NetSurf.dmg
NetSurf
core
nsfb-*
-build-*
+build
diff --git a/Makefile b/Makefile
index 2596e7a..77ab062 100644
--- a/Makefile
+++ b/Makefile
@@ -344,7 +344,7 @@ endif
CC := $(CCACHE) $(CC)
# Target paths
-OBJROOT = build-$(HOST)-$(TARGET)$(SUBTARGET)
+OBJROOT = build/$(HOST)-$(TARGET)$(SUBTARGET)
DEPROOT := $(OBJROOT)/deps
TOOLROOT := $(OBJROOT)/tools
diff --git a/test/Makefile b/test/Makefile
index a3f84f3..7a763e9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -58,15 +58,16 @@ utils_SRCS := utils/utils.c utils/messages.c utils/hashtable.c \
time_SRCS := utils/time.c test/log.c test/time.c
# Coverage builds need additional flags
+COV_ROOT := build/$(HOST)-coverage
ifeq ($(MAKECMDGOALS),coverage)
COV_CFLAGS ?= -fprofile-arcs -ftest-coverage -O0
COV_CXXFLAGS ?= -fprofile-arcs -ftest-coverage -O0
COV_LDFLAGS ?= -lgcov -fprofile-arcs
- TESTROOT := build-$(HOST)-coverage
+ TESTROOT := $(COV_ROOT)
else
COV_CFLAGS ?= -O0
COV_CXXFLAGS ?= -O0
- TESTROOT := build-$(HOST)-test
+ TESTROOT := build/$(HOST)-test
endif
@@ -172,6 +173,6 @@ $(TESTROOT)/created:
test-clean:
$(VQ)echo " CLEAN: $(TESTROOT)"
- $(VQ)echo " CLEAN: build-$(HOST)-coverage"
- $(Q)$(RM) -r $(TESTROOT) build-$(HOST)-coverage
+ $(VQ)echo " CLEAN: $(COV_ROOT)"
+ $(Q)$(RM) -r $(TESTROOT) $(COV_ROOT)
CLEANS += test-clean
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 6 +-----
Makefile | 2 +-
test/Makefile | 9 +++++----
3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/.gitignore b/.gitignore
index b16d6f9..35de191 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,10 +16,6 @@ frontends/gtk/res/fr/Messages
frontends/gtk/res/de/Messages
frontends/gtk/res/nl/Messages
frontends/gtk/res/it/Messages
-test/nsoption
-test/nsurl
-test/urldbtest
-test/llcache
codedocs
nsgtk
nsfb
@@ -34,4 +30,4 @@ NetSurf.dmg
NetSurf
core
nsfb-*
-build-*
+build
diff --git a/Makefile b/Makefile
index 2596e7a..77ab062 100644
--- a/Makefile
+++ b/Makefile
@@ -344,7 +344,7 @@ endif
CC := $(CCACHE) $(CC)
# Target paths
-OBJROOT = build-$(HOST)-$(TARGET)$(SUBTARGET)
+OBJROOT = build/$(HOST)-$(TARGET)$(SUBTARGET)
DEPROOT := $(OBJROOT)/deps
TOOLROOT := $(OBJROOT)/tools
diff --git a/test/Makefile b/test/Makefile
index a3f84f3..7a763e9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -58,15 +58,16 @@ utils_SRCS := utils/utils.c utils/messages.c utils/hashtable.c \
time_SRCS := utils/time.c test/log.c test/time.c
# Coverage builds need additional flags
+COV_ROOT := build/$(HOST)-coverage
ifeq ($(MAKECMDGOALS),coverage)
COV_CFLAGS ?= -fprofile-arcs -ftest-coverage -O0
COV_CXXFLAGS ?= -fprofile-arcs -ftest-coverage -O0
COV_LDFLAGS ?= -lgcov -fprofile-arcs
- TESTROOT := build-$(HOST)-coverage
+ TESTROOT := $(COV_ROOT)
else
COV_CFLAGS ?= -O0
COV_CXXFLAGS ?= -O0
- TESTROOT := build-$(HOST)-test
+ TESTROOT := build/$(HOST)-test
endif
@@ -172,6 +173,6 @@ $(TESTROOT)/created:
test-clean:
$(VQ)echo " CLEAN: $(TESTROOT)"
- $(VQ)echo " CLEAN: build-$(HOST)-coverage"
- $(Q)$(RM) -r $(TESTROOT) build-$(HOST)-coverage
+ $(VQ)echo " CLEAN: $(COV_ROOT)"
+ $(Q)$(RM) -r $(TESTROOT) $(COV_ROOT)
CLEANS += test-clean
--
NetSurf Browser
6 years, 8 months
netsurf: branch chris/amiga-corewindow updated. release/3.6-172-ga4bedbb
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a4bedbbaebec62294bcf6...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a4bedbbaebec62294bcf6e7...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a4bedbbaebec62294bcf6e721...
The branch, chris/amiga-corewindow has been updated
via a4bedbbaebec62294bcf6e7210c4c2b0b64f936c (commit)
from 917a602dce32286260a34d61b7c0db4bee502ec0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a4bedbbaebec62294bc...
commit a4bedbbaebec62294bcf6e7210c4c2b0b64f936c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Broken corewindow drag implementation
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfc537..03ad509 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -59,6 +59,7 @@
#include <reaction/reaction_macros.h>
#include "amiga/corewindow.h"
+#include "amiga/drag.h"
#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
@@ -451,6 +452,71 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
}
}
+/**
+ * Drag start
+ */
+static void
+ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
+{
+ ami_cw->dragging = true;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_show(ami_cw->win, "project");
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * Drag progress
+ */
+static void
+ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
+{
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_move();
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * Drag end
+ */
+static void
+ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ ami_cw->dragging = false;
+
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_close(ami_cw->win);
+ if((ami_cw != ami_window_at_pointer(AMINS_COREWINDOW)) && (ami_cw->drag_end != NULL)) {
+ ami_cw->drag_end(ami_cw, scrn->MouseX, scrn->MouseY);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
/**
* Main event loop for our core window
@@ -479,9 +545,31 @@ ami_cw_event(void *w)
switch(result & WMHI_CLASSMASK) {
case WMHI_MOUSEMOVE:
- if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+ if(ami_cw->dragging == false) {
+ if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ /* Start button 1 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
+ } else if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2) {
+ /* Start button 2 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_2, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+ }
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+
+ if ((ami_cw->drag_status == CORE_WINDOW_DRAG_SELECTION) ||
+ (ami_cw->drag_status == CORE_WINDOW_DRAG_MOVE)) {
+ ami_cw_drag_start(ami_cw, x, y);
+ }
+ }
+ } else {
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw_drag_progress(ami_cw, x, y);
}
break;
@@ -539,6 +627,10 @@ ami_cw_event(void *w)
break;
}
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+
+ if((ami_cw->dragging == true) && (ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
+ ami_cw_drag_end(ami_cw, x, y);
+ }
break;
case WMHI_RAWKEY:
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 17af249..cfcd7fc 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -58,6 +58,10 @@ struct ami_corewindow {
int mouse_y_click;
int mouse_state;
+ bool dragging;
+ int drag_x_start;
+ int drag_y_start;
+
bool close_window; // set to true to close the window during event loop
APTR deferred_rects_pool;
@@ -129,6 +133,31 @@ struct ami_corewindow {
BOOL (*event)(struct ami_corewindow *ami_cw, ULONG result);
/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window to a different window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x position **in screen co-ordinates**
+ * \param y mouse y position **in screen co-ordinates**
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+ nserror (*drag_end)(struct ami_corewindow *ami_cw, int x, int y);
+
+ /**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x position **in screen co-ordinates**
+ * \param y mouse y position **in screen co-ordinates**
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+ nserror (*icon_drop)(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y);
+
+ /**
* callback to close an Amiga core window
*
* \param ami_cw The Amiga core window structure.
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 0fea420..2210301 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -37,6 +37,7 @@
#include <reaction/reaction_macros.h>
#include "desktop/global_history.h"
+#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "utils/log.h"
@@ -44,6 +45,7 @@
#include "utils/nsoption.h"
#include "amiga/corewindow.h"
+#include "amiga/drag.h"
#include "amiga/file.h"
#include "amiga/history.h"
#include "amiga/libs.h"
@@ -172,6 +174,49 @@ ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect
}
/**
+ * callback on drag end for history viewer
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ struct nsurl *url = NULL;
+ const char *title = NULL;
+ bool ok = false;
+ struct gui_window_2 *gwin;
+ struct ami_corewindow *cw;
+
+ if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+ return NSERROR_OK;
+
+ if(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((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+ (ami_cw->icon_drop != NULL)) {
+ cw->icon_drop(cw, url, title, x, y);
+ }
+ }
+ return NSERROR_OK;
+}
+
+/**
* menu stuff
*/
@@ -396,6 +441,8 @@ nserror ami_history_global_present(void)
ncwin->core.mouse = ami_history_global_mouse;
ncwin->core.close = ami_history_global_destroy;
ncwin->core.event = NULL;
+ ncwin->core.drag_end = ami_history_global_drag_end;
+ ncwin->core.icon_drop = NULL;
res = ami_corewindow_init(&ncwin->core);
if (res != NSERROR_OK) {
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index de8b6ac..422586a 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -37,6 +37,7 @@
#include <reaction/reaction_macros.h>
#include "desktop/hotlist.h"
+#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "utils/log.h"
@@ -44,6 +45,7 @@
#include "utils/nsoption.h"
#include "amiga/corewindow.h"
+#include "amiga/drag.h"
#include "amiga/file.h"
#include "amiga/hotlist.h"
#include "amiga/libs.h"
@@ -222,6 +224,68 @@ ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, st
return NSERROR_OK;
}
+/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window has ended
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ nsurl *url = NULL;
+ const char *title = NULL;
+ bool ok = false;
+ struct gui_window_2 *gwin;
+ struct ami_corewindow *cw;
+
+ if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+ return NSERROR_OK;
+
+ if(hotlist_has_selection()) {
+ ok = hotlist_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((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+ (ami_cw->icon_drop != NULL)) {
+ cw->icon_drop(cw, url, title, x, y);
+ }
+ }
+ return NSERROR_OK;
+}
+
+/**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y)
+{
+ hotlist_add_entry(url, title, true, y);
+ return NSERROR_OK;
+}
/**
* menu stuff
@@ -487,7 +551,7 @@ nserror ami_hotlist_present(void)
return NSERROR_NOMEM;
}
- ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
res = ami_hotlist_create_window(ncwin);
if (res != NSERROR_OK) {
@@ -503,6 +567,8 @@ nserror ami_hotlist_present(void)
ncwin->core.mouse = ami_hotlist_mouse;
ncwin->core.close = ami_hotlist_destroy;
ncwin->core.event = NULL;
+ ncwin->core.drag_end = ami_hotlist_drag_end;
+ ncwin->core.icon_drop = ami_hotlist_icon_drop;
res = ami_corewindow_init(&ncwin->core);
if (res != NSERROR_OK) {
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/corewindow.c | 94 +++++++++++++++++++++++++++++++++++++++++-
frontends/amiga/corewindow.h | 29 +++++++++++++
frontends/amiga/history.c | 47 +++++++++++++++++++++
frontends/amiga/hotlist.c | 68 +++++++++++++++++++++++++++++-
4 files changed, 236 insertions(+), 2 deletions(-)
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfc537..03ad509 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -59,6 +59,7 @@
#include <reaction/reaction_macros.h>
#include "amiga/corewindow.h"
+#include "amiga/drag.h"
#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
@@ -451,6 +452,71 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
}
}
+/**
+ * Drag start
+ */
+static void
+ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
+{
+ ami_cw->dragging = true;
+ ami_cw->drag_x_start = x;
+ ami_cw->drag_y_start = y;
+
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_show(ami_cw->win, "project");
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * Drag progress
+ */
+static void
+ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
+{
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_move();
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * Drag end
+ */
+static void
+ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ ami_cw->dragging = false;
+
+ switch(ami_cw->drag_status) {
+ case CORE_WINDOW_DRAG_SELECTION:
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ ami_drag_icon_close(ami_cw->win);
+ if((ami_cw != ami_window_at_pointer(AMINS_COREWINDOW)) && (ami_cw->drag_end != NULL)) {
+ ami_cw->drag_end(ami_cw, scrn->MouseX, scrn->MouseY);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
/**
* Main event loop for our core window
@@ -479,9 +545,31 @@ ami_cw_event(void *w)
switch(result & WMHI_CLASSMASK) {
case WMHI_MOUSEMOVE:
- if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+ if(ami_cw->dragging == false) {
+ if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+ if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_1) {
+ /* Start button 1 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_1, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
+ } else if(ami_cw->mouse_state & BROWSER_MOUSE_PRESS_2) {
+ /* Start button 2 drag */
+ ami_cw->mouse(ami_cw, BROWSER_MOUSE_DRAG_2, x, y);
+ /* Replace PRESS with HOLDING and declare drag in progress */
+ ami_cw->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+ }
+ key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+ ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+
+ if ((ami_cw->drag_status == CORE_WINDOW_DRAG_SELECTION) ||
+ (ami_cw->drag_status == CORE_WINDOW_DRAG_MOVE)) {
+ ami_cw_drag_start(ami_cw, x, y);
+ }
+ }
+ } else {
key_state = ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+ ami_cw_drag_progress(ami_cw, x, y);
}
break;
@@ -539,6 +627,10 @@ ami_cw_event(void *w)
break;
}
ami_cw->mouse(ami_cw, ami_cw->mouse_state | key_state, x, y);
+
+ if((ami_cw->dragging == true) && (ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
+ ami_cw_drag_end(ami_cw, x, y);
+ }
break;
case WMHI_RAWKEY:
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 17af249..cfcd7fc 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -58,6 +58,10 @@ struct ami_corewindow {
int mouse_y_click;
int mouse_state;
+ bool dragging;
+ int drag_x_start;
+ int drag_y_start;
+
bool close_window; // set to true to close the window during event loop
APTR deferred_rects_pool;
@@ -129,6 +133,31 @@ struct ami_corewindow {
BOOL (*event)(struct ami_corewindow *ami_cw, ULONG result);
/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window to a different window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x position **in screen co-ordinates**
+ * \param y mouse y position **in screen co-ordinates**
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+ nserror (*drag_end)(struct ami_corewindow *ami_cw, int x, int y);
+
+ /**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x position **in screen co-ordinates**
+ * \param y mouse y position **in screen co-ordinates**
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+ nserror (*icon_drop)(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y);
+
+ /**
* callback to close an Amiga core window
*
* \param ami_cw The Amiga core window structure.
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 0fea420..2210301 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -37,6 +37,7 @@
#include <reaction/reaction_macros.h>
#include "desktop/global_history.h"
+#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "utils/log.h"
@@ -44,6 +45,7 @@
#include "utils/nsoption.h"
#include "amiga/corewindow.h"
+#include "amiga/drag.h"
#include "amiga/file.h"
#include "amiga/history.h"
#include "amiga/libs.h"
@@ -172,6 +174,49 @@ ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect
}
/**
+ * callback on drag end for history viewer
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ struct nsurl *url = NULL;
+ const char *title = NULL;
+ bool ok = false;
+ struct gui_window_2 *gwin;
+ struct ami_corewindow *cw;
+
+ if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+ return NSERROR_OK;
+
+ if(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((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+ (ami_cw->icon_drop != NULL)) {
+ cw->icon_drop(cw, url, title, x, y);
+ }
+ }
+ return NSERROR_OK;
+}
+
+/**
* menu stuff
*/
@@ -396,6 +441,8 @@ nserror ami_history_global_present(void)
ncwin->core.mouse = ami_history_global_mouse;
ncwin->core.close = ami_history_global_destroy;
ncwin->core.event = NULL;
+ ncwin->core.drag_end = ami_history_global_drag_end;
+ ncwin->core.icon_drop = NULL;
res = ami_corewindow_init(&ncwin->core);
if (res != NSERROR_OK) {
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index de8b6ac..422586a 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -37,6 +37,7 @@
#include <reaction/reaction_macros.h>
#include "desktop/hotlist.h"
+#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "utils/log.h"
@@ -44,6 +45,7 @@
#include "utils/nsoption.h"
#include "amiga/corewindow.h"
+#include "amiga/drag.h"
#include "amiga/file.h"
#include "amiga/hotlist.h"
#include "amiga/libs.h"
@@ -222,6 +224,68 @@ ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, st
return NSERROR_OK;
}
+/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window has ended
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+ nsurl *url = NULL;
+ const char *title = NULL;
+ bool ok = false;
+ struct gui_window_2 *gwin;
+ struct ami_corewindow *cw;
+
+ if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+ return NSERROR_OK;
+
+ if(hotlist_has_selection()) {
+ ok = hotlist_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((cw = (struct ami_corewindow *)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+ (ami_cw->icon_drop != NULL)) {
+ cw->icon_drop(cw, url, title, x, y);
+ }
+ }
+ return NSERROR_OK;
+}
+
+/**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const char *title, int x, int y)
+{
+ hotlist_add_entry(url, title, true, y);
+ return NSERROR_OK;
+}
/**
* menu stuff
@@ -487,7 +551,7 @@ nserror ami_hotlist_present(void)
return NSERROR_NOMEM;
}
- ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
res = ami_hotlist_create_window(ncwin);
if (res != NSERROR_OK) {
@@ -503,6 +567,8 @@ nserror ami_hotlist_present(void)
ncwin->core.mouse = ami_hotlist_mouse;
ncwin->core.close = ami_hotlist_destroy;
ncwin->core.event = NULL;
+ ncwin->core.drag_end = ami_hotlist_drag_end;
+ ncwin->core.icon_drop = ami_hotlist_icon_drop;
res = ami_corewindow_init(&ncwin->core);
if (res != NSERROR_OK) {
--
NetSurf Browser
6 years, 8 months
netsurf: branch chris/amiga-corewindow updated. release/3.6-171-g917a602
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/917a602dce32286260a34...
...commit http://git.netsurf-browser.org/netsurf.git/commit/917a602dce32286260a34d6...
...tree http://git.netsurf-browser.org/netsurf.git/tree/917a602dce32286260a34d61b...
The branch, chris/amiga-corewindow has been updated
via 917a602dce32286260a34d61b7c0db4bee502ec0 (commit)
from a86f2c8dd35c0cd8ba2f87097a68ad32373c28b5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=917a602dce32286260a...
commit 917a602dce32286260a34d61b7c0db4bee502ec0
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Conversion of Amiga hotlist manager to corewindow
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index b970228..63e418a 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -665,9 +665,9 @@ RXHOOKF(rx_hotlist)
cmd->ac_RC = 0;
if(strcasecmp((char *)cmd->ac_ArgList[0], "OPEN") == 0) {
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
+ ami_hotlist_present();
} else if(strcasecmp((char *)cmd->ac_ArgList[0], "CLOSE") == 0) {
- ami_tree_close(hotlist_window);
+ ami_hotlist_close();
}
}
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 7c92a40..4e88a0e 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -552,6 +552,12 @@ static void ami_set_screen_defaults(struct Screen *screen)
nsoption_default_set_int(history_window_xsize, width);
nsoption_default_set_int(history_window_ysize, height);
+ nsoption_default_set_int(hotlist_window_ypos, top);
+ nsoption_default_set_int(hotlist_window_xpos, left);
+ nsoption_default_set_int(hotlist_window_xsize, width);
+ nsoption_default_set_int(hotlist_window_ysize, height);
+
+
nsoption_default_set_int(window_x, 0);
nsoption_default_set_int(window_y, screen->BarHeight + 1);
nsoption_default_set_int(window_width, screen->Width);
@@ -1018,7 +1024,7 @@ static void gui_init2(int argc, char** argv)
}
/**/
- ami_hotlist_initialise(nsoption_charp(hotlist_file));
+ hotlist_init(nsoption_charp(hotlist_file));
search_web_select_provider(nsoption_int(search_provider));
if (notalreadyrunning &&
@@ -3041,7 +3047,7 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
- ami_hotlist_free(nsoption_charp(hotlist_file));
+ hotlist_fini(nsoption_charp(hotlist_file));
#ifdef __amigaos4__
if(IApplication && ami_appid)
UnregisterApplication(ami_appid, NULL);
@@ -3185,7 +3191,7 @@ static bool ami_gui_hotlist_add(void *userdata, int level, int item,
return true;
}
-static int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, struct gui_window_2 *gwin)
+static int ami_gui_hotlist_scan(struct List *speed_button_list, struct gui_window_2 *gwin)
{
struct ami_gui_tb_userdata userdata;
userdata.gw = gwin;
@@ -3207,7 +3213,7 @@ static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
NewList(&gwin->hotlist_toolbar_list);
- if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) {
+ if(ami_gui_hotlist_scan(&gwin->hotlist_toolbar_list, gwin) > 0) {
gwin->objects[GID_HOTLIST] =
SpeedBarObj,
GA_ID, GID_HOTLIST,
@@ -3306,7 +3312,7 @@ static void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin)
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) {
+ if(ami_gui_hotlist_scan(&gwin->hotlist_toolbar_list, gwin) > 0) {
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_HOTLIST],
gwin->win, NULL,
SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list,
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
old mode 100755
new mode 100644
index fc2342d..de8b6ac
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008, 2009, 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,16 +16,82 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Implementation of Amiga hotlist viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
-#include <proto/exec.h>
-#include "utils/nsurl.h"
+#include <proto/asl.h>
+#include <proto/dos.h>
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
+
+#include <reaction/reaction_macros.h>
+
#include "desktop/hotlist.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+#include "amiga/corewindow.h"
+#include "amiga/file.h"
#include "amiga/hotlist.h"
-#include "amiga/tree.h"
+#include "amiga/libs.h"
+#include "amiga/theme.h"
+#include "amiga/utf8.h"
+
+enum {
+ /* Project menu */
+ AMI_HOTLIST_M_PROJECT = 0,
+ AMI_HOTLIST_M_EXPORT,
+ AMI_HOTLIST_M_BAR_P1,
+ AMI_HOTLIST_M_EXPAND,
+ AMI_HOTLIST_M_EXPAND_ALL,
+ AMI_HOTLIST_M_EXPAND_FOLDERS,
+ AMI_HOTLIST_M_EXPAND_LINKS,
+ AMI_HOTLIST_M_COLLAPSE,
+ AMI_HOTLIST_M_COLLAPSE_ALL,
+ AMI_HOTLIST_M_COLLAPSE_FOLDERS,
+ AMI_HOTLIST_M_COLLAPSE_LINKS,
+ AMI_HOTLIST_M_BAR_P2,
+ AMI_HOTLIST_M_SNAPSHOT,
+ AMI_HOTLIST_M_BAR_P3,
+ AMI_HOTLIST_M_CLOSE,
+ /* Edit menu */
+ AMI_HOTLIST_M_EDIT,
+ AMI_HOTLIST_M_NEWFOLDER,
+ AMI_HOTLIST_M_NEWLINK,
+ AMI_HOTLIST_M_EDIT_EDIT,
+ AMI_HOTLIST_M_BAR_E1,
+ AMI_HOTLIST_M_SELECTALL,
+ AMI_HOTLIST_M_CLEAR,
+ AMI_HOTLIST_M_BAR_E2,
+ AMI_HOTLIST_M_DELETE,
+ AMI_HOTLIST_M_LAST
+};
+
+/**
+ * Amiga hotlist viewer window context
+ */
+struct ami_hotlist_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+
+ struct ami_menu_data *menu_data[AMI_HOTLIST_M_LAST + 1];
+ struct Menu *imenu; /* Intuition menu */
+};
+
+static struct ami_hotlist_window *hotlist_window = NULL;
struct ami_hotlist_ctx {
void *userdata;
@@ -37,22 +103,7 @@ struct ami_hotlist_ctx {
bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder);
};
-struct treeview_window *hotlist_window = NULL;
-
-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;
-}
-
-
+/** hotlist scanner */
static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
{
struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
@@ -118,3 +169,365 @@ nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
return error;
}
+
+
+/**
+ * callback for mouse action for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ hotlist_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for keypress for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (hotlist_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback on draw event for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ hotlist_redraw(x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * menu stuff
+ */
+
+static void
+ami_hotlist_menu_free(struct ami_hotlist_window *hotlist_win)
+{
+ SetAttrs(hotlist_win->core.objects[GID_CW_WIN],
+ WINDOW_MenuStrip, NULL,
+ TAG_DONE);
+
+ ami_menu_free_menu(hotlist_win->menu_data, AMI_HOTLIST_M_LAST, hotlist_win->imenu);
+}
+
+ /* menu hook functions */
+HOOKF(void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *)
+{
+ char fname[1024];
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ if(AslRequestTags(savereq,
+ ASLFR_Window, ami_cw->win,
+ ASLFR_SleepWindow, TRUE,
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_InitialFile, "hotlist.html",
+ TAG_DONE)) {
+ strlcpy(fname, savereq->fr_Drawer, 1024);
+ AddPart(fname, savereq->fr_File, 1024);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_WAIT);
+ hotlist_export(fname, NULL);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_DEFAULT);
+ }
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ nsoption_set_int(hotlist_window_ypos, ami_cw->win->TopEdge);
+ nsoption_set_int(hotlist_window_xpos, ami_cw->win->LeftEdge);
+ nsoption_set_int(hotlist_window_xsize, ami_cw->win->Width);
+ nsoption_set_int(hotlist_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_close, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ ami_cw->close_window = true;
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_newfolder, APTR, window, struct IntuiMessage *)
+{
+ hotlist_add_folder(NULL, false, 0);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_newlink, APTR, window, struct IntuiMessage *)
+{
+ hotlist_add_entry(NULL, NULL, false, 0);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_edit, APTR, window, struct IntuiMessage *)
+{
+ hotlist_edit_selection();
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_CLEAR_SELECTION);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
+/* menu setup */
+
+static void ami_hotlist_menulabs(struct ami_menu_data **md)
+{
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_PROJECT, NM_TITLE, "Tree", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPORT, NM_ITEM, "TreeExport", 'S', "TBImages:list_save",
+ ami_hotlist_menu_item_project_export, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND, NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_ALL, NM_SUB, "All", '+', NULL,
+ ami_hotlist_menu_item_project_expand_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_hotlist_menu_item_project_expand_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_hotlist_menu_item_project_expand_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE, NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_ALL, NM_SUB, "All", '-', NULL,
+ ami_hotlist_menu_item_project_collapse_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_hotlist_menu_item_project_collapse_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_hotlist_menu_item_project_collapse_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
+ ami_hotlist_menu_item_project_snapshot, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
+ ami_hotlist_menu_item_project_close, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWFOLDER, NM_ITEM, "TreeNewFolder", 'N', "TBImages:list_drawer",
+ ami_hotlist_menu_item_edit_newfolder, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWLINK, NM_ITEM, "TreeNewLink", 0, "TBImages:list_favouriteadd",
+ ami_hotlist_menu_item_edit_newlink, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT_EDIT, NM_ITEM, "TreeEdit", 'E', "TBImages:list_edit",
+ ami_hotlist_menu_item_edit_edit, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_SELECTALL, NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+ ami_hotlist_menu_item_edit_select_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_CLEAR, NM_ITEM, "ClearNS", 0, NSA_SPACE,
+ ami_hotlist_menu_item_edit_clear, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_DELETE, NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+ ami_hotlist_menu_item_edit_delete, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_LAST, NM_END, NULL, 0, NULL, NULL, NULL, 0);
+}
+
+static struct Menu *
+ami_hotlist_menu_create(struct ami_hotlist_window *hotlist_win)
+{
+ ami_hotlist_menulabs(hotlist_win->menu_data);
+ hotlist_win->imenu = ami_menu_layout(hotlist_win->menu_data, AMI_HOTLIST_M_LAST);
+ if(hotlist_win->imenu == NULL) return NULL;
+
+ return hotlist_win->imenu;
+}
+
+
+static nserror
+ami_hotlist_create_window(struct ami_hotlist_window *hotlist_win)
+{
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&hotlist_win->core;
+
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(hotlist_window_ypos),
+ WA_Left, nsoption_int(hotlist_window_xpos),
+ WA_Width, nsoption_int(hotlist_window_xsize),
+ WA_Height, nsoption_int(hotlist_window_ysize),
+ 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_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, hotlist_win,
+ WINDOW_MenuStrip, ami_hotlist_menu_create(hotlist_win),
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+/**
+ * destroy a previously created hotlist view
+ */
+static void
+ami_hotlist_destroy(struct ami_corewindow *ami_cw)
+{
+ nserror res;
+
+ if(hotlist_window == NULL)
+ return;
+
+ res = hotlist_manager_fini();
+ if (res == NSERROR_OK) {
+ ami_hotlist_menu_free(hotlist_window);
+ res = ami_corewindow_fini(&hotlist_window->core); /* closes the window for us, frees hotlist_win */
+ hotlist_window = NULL;
+ }
+
+ ami_gui_hotlist_update_all();
+}
+
+
+/* exported interface documented in amiga/hotlist.h */
+nserror ami_hotlist_present(void)
+{
+ struct ami_hotlist_window *ncwin;
+ nserror res;
+
+ if(hotlist_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_hotlist_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+
+ res = ami_hotlist_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_hotlist_draw;
+ ncwin->core.key = ami_hotlist_key;
+ ncwin->core.mouse = ami_hotlist_mouse;
+ ncwin->core.close = ami_hotlist_destroy;
+ ncwin->core.event = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = hotlist_manager_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ hotlist_window = ncwin;
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in amiga/hotlist.h */
+void ami_hotlist_close(void)
+{
+ ami_hotlist_destroy((struct ami_corewindow *)hotlist_window);
+}
+
diff --git a/frontends/amiga/hotlist.h b/frontends/amiga/hotlist.h
old mode 100755
new mode 100644
index 113a2d1..588a72d
--- a/frontends/amiga/hotlist.h
+++ b/frontends/amiga/hotlist.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -19,16 +19,18 @@
#ifndef AMIGA_HOTLIST_H
#define AMIGA_HOTLIST_H
-struct nsurl;
-struct treeview_window;
+#include "utils/nsurl.h"
-extern struct treeview_window *hotlist_window;
-
-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));
+/** Open the hotlist viewer */
+nserror ami_hotlist_present(void);
+/** Close the hotlist viewer
+ * normally this shouldn't be used; only exists for ARexx use
+ */
+void ami_hotlist_close(void);
+/** Scan the hotlist */
+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));
#endif
+
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 83cfaa7..d815932 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -73,7 +73,6 @@
#include "amiga/print.h"
#include "amiga/search.h"
#include "amiga/theme.h"
-#include "amiga/tree.h"
#include "amiga/utf8.h"
#include "amiga/schedule.h"
@@ -106,7 +105,7 @@ static bool menu_glyphs_loaded = false;
const char * const netsurf_version;
const char * const verdate;
-static nserror ami_menu_scan(struct tree *tree, struct ami_menu_data **md);
+static nserror ami_menu_scan(struct ami_menu_data **md);
void ami_menu_arexx_scan(struct ami_menu_data **md);
void ami_menu_set_check_toggled(void)
@@ -456,7 +455,7 @@ HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *)
HOOKF(void, ami_menu_item_hotlist_show, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
+ ami_hotlist_present();
}
HOOKF(void, ami_menu_item_hotlist_entries, APTR, window, struct IntuiMessage *)
@@ -992,7 +991,7 @@ void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu)
struct Menu *ami_menu_create(struct gui_window_2 *gwin)
{
ami_init_menulabs(gwin->menu_data);
- ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin->menu_data); //\todo this needs to be MenuClass created
+ ami_menu_scan(gwin->menu_data); //\todo this needs to be MenuClass created
ami_menu_arexx_scan(gwin->menu_data);
gwin->imenu = ami_menu_layout(gwin->menu_data, AMI_MENU_AREXX_MAX);
@@ -1092,7 +1091,7 @@ static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char
return true;
}
-static nserror ami_menu_scan(struct tree *tree, struct ami_menu_data **md)
+static nserror ami_menu_scan(struct ami_menu_data **md)
{
return ami_hotlist_scan((void *)md, AMI_MENU_HOTLIST, messages_get("HotlistMenu"), ami_menu_hotlist_add);
}
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/arexx.c | 4 +-
frontends/amiga/gui.c | 16 +-
frontends/amiga/hotlist.c | 457 ++++++++++++++++++++++++++++++++++++++++++---
frontends/amiga/hotlist.h | 22 ++-
frontends/amiga/menu.c | 9 +-
5 files changed, 464 insertions(+), 44 deletions(-)
mode change 100755 => 100644 frontends/amiga/hotlist.c
mode change 100755 => 100644 frontends/amiga/hotlist.h
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index b970228..63e418a 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -665,9 +665,9 @@ RXHOOKF(rx_hotlist)
cmd->ac_RC = 0;
if(strcasecmp((char *)cmd->ac_ArgList[0], "OPEN") == 0) {
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
+ ami_hotlist_present();
} else if(strcasecmp((char *)cmd->ac_ArgList[0], "CLOSE") == 0) {
- ami_tree_close(hotlist_window);
+ ami_hotlist_close();
}
}
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 7c92a40..4e88a0e 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -552,6 +552,12 @@ static void ami_set_screen_defaults(struct Screen *screen)
nsoption_default_set_int(history_window_xsize, width);
nsoption_default_set_int(history_window_ysize, height);
+ nsoption_default_set_int(hotlist_window_ypos, top);
+ nsoption_default_set_int(hotlist_window_xpos, left);
+ nsoption_default_set_int(hotlist_window_xsize, width);
+ nsoption_default_set_int(hotlist_window_ysize, height);
+
+
nsoption_default_set_int(window_x, 0);
nsoption_default_set_int(window_y, screen->BarHeight + 1);
nsoption_default_set_int(window_width, screen->Width);
@@ -1018,7 +1024,7 @@ static void gui_init2(int argc, char** argv)
}
/**/
- ami_hotlist_initialise(nsoption_charp(hotlist_file));
+ hotlist_init(nsoption_charp(hotlist_file));
search_web_select_provider(nsoption_int(search_provider));
if (notalreadyrunning &&
@@ -3041,7 +3047,7 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
- ami_hotlist_free(nsoption_charp(hotlist_file));
+ hotlist_fini(nsoption_charp(hotlist_file));
#ifdef __amigaos4__
if(IApplication && ami_appid)
UnregisterApplication(ami_appid, NULL);
@@ -3185,7 +3191,7 @@ static bool ami_gui_hotlist_add(void *userdata, int level, int item,
return true;
}
-static int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, struct gui_window_2 *gwin)
+static int ami_gui_hotlist_scan(struct List *speed_button_list, struct gui_window_2 *gwin)
{
struct ami_gui_tb_userdata userdata;
userdata.gw = gwin;
@@ -3207,7 +3213,7 @@ static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
NewList(&gwin->hotlist_toolbar_list);
- if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) {
+ if(ami_gui_hotlist_scan(&gwin->hotlist_toolbar_list, gwin) > 0) {
gwin->objects[GID_HOTLIST] =
SpeedBarObj,
GA_ID, GID_HOTLIST,
@@ -3306,7 +3312,7 @@ static void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin)
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) {
+ if(ami_gui_hotlist_scan(&gwin->hotlist_toolbar_list, gwin) > 0) {
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_HOTLIST],
gwin->win, NULL,
SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list,
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
old mode 100755
new mode 100644
index fc2342d..de8b6ac
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008, 2009, 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,16 +16,82 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Implementation of Amiga hotlist viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
-#include <proto/exec.h>
-#include "utils/nsurl.h"
+#include <proto/asl.h>
+#include <proto/dos.h>
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
+
+#include <reaction/reaction_macros.h>
+
#include "desktop/hotlist.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+#include "amiga/corewindow.h"
+#include "amiga/file.h"
#include "amiga/hotlist.h"
-#include "amiga/tree.h"
+#include "amiga/libs.h"
+#include "amiga/theme.h"
+#include "amiga/utf8.h"
+
+enum {
+ /* Project menu */
+ AMI_HOTLIST_M_PROJECT = 0,
+ AMI_HOTLIST_M_EXPORT,
+ AMI_HOTLIST_M_BAR_P1,
+ AMI_HOTLIST_M_EXPAND,
+ AMI_HOTLIST_M_EXPAND_ALL,
+ AMI_HOTLIST_M_EXPAND_FOLDERS,
+ AMI_HOTLIST_M_EXPAND_LINKS,
+ AMI_HOTLIST_M_COLLAPSE,
+ AMI_HOTLIST_M_COLLAPSE_ALL,
+ AMI_HOTLIST_M_COLLAPSE_FOLDERS,
+ AMI_HOTLIST_M_COLLAPSE_LINKS,
+ AMI_HOTLIST_M_BAR_P2,
+ AMI_HOTLIST_M_SNAPSHOT,
+ AMI_HOTLIST_M_BAR_P3,
+ AMI_HOTLIST_M_CLOSE,
+ /* Edit menu */
+ AMI_HOTLIST_M_EDIT,
+ AMI_HOTLIST_M_NEWFOLDER,
+ AMI_HOTLIST_M_NEWLINK,
+ AMI_HOTLIST_M_EDIT_EDIT,
+ AMI_HOTLIST_M_BAR_E1,
+ AMI_HOTLIST_M_SELECTALL,
+ AMI_HOTLIST_M_CLEAR,
+ AMI_HOTLIST_M_BAR_E2,
+ AMI_HOTLIST_M_DELETE,
+ AMI_HOTLIST_M_LAST
+};
+
+/**
+ * Amiga hotlist viewer window context
+ */
+struct ami_hotlist_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+
+ struct ami_menu_data *menu_data[AMI_HOTLIST_M_LAST + 1];
+ struct Menu *imenu; /* Intuition menu */
+};
+
+static struct ami_hotlist_window *hotlist_window = NULL;
struct ami_hotlist_ctx {
void *userdata;
@@ -37,22 +103,7 @@ struct ami_hotlist_ctx {
bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool folder);
};
-struct treeview_window *hotlist_window = NULL;
-
-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;
-}
-
-
+/** hotlist scanner */
static nserror ami_hotlist_folder_enter_cb(void *ctx, const char *title)
{
struct ami_hotlist_ctx *menu_ctx = (struct ami_hotlist_ctx *)ctx;
@@ -118,3 +169,365 @@ nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
return error;
}
+
+
+/**
+ * callback for mouse action for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ hotlist_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for keypress for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (hotlist_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback on draw event for hotlist viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ hotlist_redraw(x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * menu stuff
+ */
+
+static void
+ami_hotlist_menu_free(struct ami_hotlist_window *hotlist_win)
+{
+ SetAttrs(hotlist_win->core.objects[GID_CW_WIN],
+ WINDOW_MenuStrip, NULL,
+ TAG_DONE);
+
+ ami_menu_free_menu(hotlist_win->menu_data, AMI_HOTLIST_M_LAST, hotlist_win->imenu);
+}
+
+ /* menu hook functions */
+HOOKF(void, ami_hotlist_menu_item_project_export, APTR, window, struct IntuiMessage *)
+{
+ char fname[1024];
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ if(AslRequestTags(savereq,
+ ASLFR_Window, ami_cw->win,
+ ASLFR_SleepWindow, TRUE,
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_InitialFile, "hotlist.html",
+ TAG_DONE)) {
+ strlcpy(fname, savereq->fr_Drawer, 1024);
+ AddPart(fname, savereq->fr_File, 1024);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_WAIT);
+ hotlist_export(fname, NULL);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_DEFAULT);
+ }
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
+{
+ hotlist_expand(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(true);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
+{
+ hotlist_contract(false);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ nsoption_set_int(hotlist_window_ypos, ami_cw->win->TopEdge);
+ nsoption_set_int(hotlist_window_xpos, ami_cw->win->LeftEdge);
+ nsoption_set_int(hotlist_window_xsize, ami_cw->win->Width);
+ nsoption_set_int(hotlist_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_hotlist_menu_item_project_close, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ ami_cw->close_window = true;
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_newfolder, APTR, window, struct IntuiMessage *)
+{
+ hotlist_add_folder(NULL, false, 0);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_newlink, APTR, window, struct IntuiMessage *)
+{
+ hotlist_add_entry(NULL, NULL, false, 0);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_edit, APTR, window, struct IntuiMessage *)
+{
+ hotlist_edit_selection();
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_CLEAR_SELECTION);
+}
+
+HOOKF(void, ami_hotlist_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+ hotlist_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
+/* menu setup */
+
+static void ami_hotlist_menulabs(struct ami_menu_data **md)
+{
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_PROJECT, NM_TITLE, "Tree", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPORT, NM_ITEM, "TreeExport", 'S', "TBImages:list_save",
+ ami_hotlist_menu_item_project_export, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND, NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_ALL, NM_SUB, "All", '+', NULL,
+ ami_hotlist_menu_item_project_expand_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_hotlist_menu_item_project_expand_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EXPAND_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_hotlist_menu_item_project_expand_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE, NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_ALL, NM_SUB, "All", '-', NULL,
+ ami_hotlist_menu_item_project_collapse_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_hotlist_menu_item_project_collapse_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_COLLAPSE_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_hotlist_menu_item_project_collapse_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
+ ami_hotlist_menu_item_project_snapshot, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
+ ami_hotlist_menu_item_project_close, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWFOLDER, NM_ITEM, "TreeNewFolder", 'N', "TBImages:list_drawer",
+ ami_hotlist_menu_item_edit_newfolder, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_NEWLINK, NM_ITEM, "TreeNewLink", 0, "TBImages:list_favouriteadd",
+ ami_hotlist_menu_item_edit_newlink, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_EDIT_EDIT, NM_ITEM, "TreeEdit", 'E', "TBImages:list_edit",
+ ami_hotlist_menu_item_edit_edit, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_SELECTALL, NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+ ami_hotlist_menu_item_edit_select_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_CLEAR, NM_ITEM, "ClearNS", 0, NSA_SPACE,
+ ami_hotlist_menu_item_edit_clear, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_BAR_E2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_DELETE, NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+ ami_hotlist_menu_item_edit_delete, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HOTLIST_M_LAST, NM_END, NULL, 0, NULL, NULL, NULL, 0);
+}
+
+static struct Menu *
+ami_hotlist_menu_create(struct ami_hotlist_window *hotlist_win)
+{
+ ami_hotlist_menulabs(hotlist_win->menu_data);
+ hotlist_win->imenu = ami_menu_layout(hotlist_win->menu_data, AMI_HOTLIST_M_LAST);
+ if(hotlist_win->imenu == NULL) return NULL;
+
+ return hotlist_win->imenu;
+}
+
+
+static nserror
+ami_hotlist_create_window(struct ami_hotlist_window *hotlist_win)
+{
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&hotlist_win->core;
+
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(hotlist_window_ypos),
+ WA_Left, nsoption_int(hotlist_window_xpos),
+ WA_Width, nsoption_int(hotlist_window_xsize),
+ WA_Height, nsoption_int(hotlist_window_ysize),
+ 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_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, hotlist_win,
+ WINDOW_MenuStrip, ami_hotlist_menu_create(hotlist_win),
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+/**
+ * destroy a previously created hotlist view
+ */
+static void
+ami_hotlist_destroy(struct ami_corewindow *ami_cw)
+{
+ nserror res;
+
+ if(hotlist_window == NULL)
+ return;
+
+ res = hotlist_manager_fini();
+ if (res == NSERROR_OK) {
+ ami_hotlist_menu_free(hotlist_window);
+ res = ami_corewindow_fini(&hotlist_window->core); /* closes the window for us, frees hotlist_win */
+ hotlist_window = NULL;
+ }
+
+ ami_gui_hotlist_update_all();
+}
+
+
+/* exported interface documented in amiga/hotlist.h */
+nserror ami_hotlist_present(void)
+{
+ struct ami_hotlist_window *ncwin;
+ nserror res;
+
+ if(hotlist_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_hotlist_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+
+ res = ami_hotlist_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_hotlist_draw;
+ ncwin->core.key = ami_hotlist_key;
+ ncwin->core.mouse = ami_hotlist_mouse;
+ ncwin->core.close = ami_hotlist_destroy;
+ ncwin->core.event = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = hotlist_manager_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ hotlist_window = ncwin;
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in amiga/hotlist.h */
+void ami_hotlist_close(void)
+{
+ ami_hotlist_destroy((struct ami_corewindow *)hotlist_window);
+}
+
diff --git a/frontends/amiga/hotlist.h b/frontends/amiga/hotlist.h
old mode 100755
new mode 100644
index 113a2d1..588a72d
--- a/frontends/amiga/hotlist.h
+++ b/frontends/amiga/hotlist.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -19,16 +19,18 @@
#ifndef AMIGA_HOTLIST_H
#define AMIGA_HOTLIST_H
-struct nsurl;
-struct treeview_window;
+#include "utils/nsurl.h"
-extern struct treeview_window *hotlist_window;
-
-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));
+/** Open the hotlist viewer */
+nserror ami_hotlist_present(void);
+/** Close the hotlist viewer
+ * normally this shouldn't be used; only exists for ARexx use
+ */
+void ami_hotlist_close(void);
+/** Scan the hotlist */
+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));
#endif
+
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 83cfaa7..d815932 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -73,7 +73,6 @@
#include "amiga/print.h"
#include "amiga/search.h"
#include "amiga/theme.h"
-#include "amiga/tree.h"
#include "amiga/utf8.h"
#include "amiga/schedule.h"
@@ -106,7 +105,7 @@ static bool menu_glyphs_loaded = false;
const char * const netsurf_version;
const char * const verdate;
-static nserror ami_menu_scan(struct tree *tree, struct ami_menu_data **md);
+static nserror ami_menu_scan(struct ami_menu_data **md);
void ami_menu_arexx_scan(struct ami_menu_data **md);
void ami_menu_set_check_toggled(void)
@@ -456,7 +455,7 @@ HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *)
HOOKF(void, ami_menu_item_hotlist_show, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(hotlist_window, AMI_TREE_HOTLIST);
+ ami_hotlist_present();
}
HOOKF(void, ami_menu_item_hotlist_entries, APTR, window, struct IntuiMessage *)
@@ -992,7 +991,7 @@ void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu)
struct Menu *ami_menu_create(struct gui_window_2 *gwin)
{
ami_init_menulabs(gwin->menu_data);
- ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin->menu_data); //\todo this needs to be MenuClass created
+ ami_menu_scan(gwin->menu_data); //\todo this needs to be MenuClass created
ami_menu_arexx_scan(gwin->menu_data);
gwin->imenu = ami_menu_layout(gwin->menu_data, AMI_MENU_AREXX_MAX);
@@ -1092,7 +1091,7 @@ static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char
return true;
}
-static nserror ami_menu_scan(struct tree *tree, struct ami_menu_data **md)
+static nserror ami_menu_scan(struct ami_menu_data **md)
{
return ami_hotlist_scan((void *)md, AMI_MENU_HOTLIST, messages_get("HotlistMenu"), ami_menu_hotlist_add);
}
--
NetSurf Browser
6 years, 8 months
netsurf: branch chris/amiga-corewindow updated. release/3.6-170-ga86f2c8
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a86f2c8dd35c0cd8ba2f8...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a86f2c8dd35c0cd8ba2f870...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a86f2c8dd35c0cd8ba2f87097...
The branch, chris/amiga-corewindow has been updated
via a86f2c8dd35c0cd8ba2f87097a68ad32373c28b5 (commit)
via 047b37d5f8c3810f8942f5744bb92640fbd4879f (commit)
from 5687f6c27d40ec596b4d64c705d16a97bdb3c893 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a86f2c8dd35c0cd8ba2...
commit a86f2c8dd35c0cd8ba2f87097a68ad32373c28b5
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Migrate global history to corewindow
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 18ca425..f428881 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -258,7 +258,7 @@ static void ami_cookies_menulabs(struct ami_menu_data **md)
ami_menu_alloc_item(md, AMI_COOKIE_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
ami_cookies_menu_item_project_snapshot, NULL, 0);
ami_menu_alloc_item(md, AMI_COOKIE_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
- ami_menu_alloc_item(md, AMI_COOKIE_M_CLOSE, NM_ITEM, "CloseWindow", 0, "TBImages:list_cancel",
+ ami_menu_alloc_item(md, AMI_COOKIE_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
ami_cookies_menu_item_project_close, NULL, 0);
ami_menu_alloc_item(md, AMI_COOKIE_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 04f8e8a..0fd4378 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -46,6 +46,9 @@
static struct Hook aslhookfunc;
+struct FileRequester *filereq;
+struct FileRequester *savereq;
+
HOOKF(ULONG, ami_file_asl_mime_hook, struct FileRequester *, fr, struct AnchorPathOld *)
{
char fname[1024];
diff --git a/frontends/amiga/file.h b/frontends/amiga/file.h
index 29a76c4..9120fff 100644
--- a/frontends/amiga/file.h
+++ b/frontends/amiga/file.h
@@ -21,8 +21,8 @@ struct hlcache_object;
struct selection;
struct gui_window_2;
-struct FileRequester *filereq;
-struct FileRequester *savereq;
+extern struct FileRequester *filereq;
+extern struct FileRequester *savereq;
enum {
AMINS_SAVE_SOURCE,
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 9fce681..7c92a40 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -547,6 +547,11 @@ static void ami_set_screen_defaults(struct Screen *screen)
nsoption_default_set_int(cookies_window_xsize, width);
nsoption_default_set_int(cookies_window_ysize, height);
+ nsoption_default_set_int(history_window_ypos, top);
+ nsoption_default_set_int(history_window_xpos, left);
+ nsoption_default_set_int(history_window_xsize, width);
+ nsoption_default_set_int(history_window_ysize, height);
+
nsoption_default_set_int(window_x, 0);
nsoption_default_set_int(window_y, screen->BarHeight + 1);
nsoption_default_set_int(window_width, screen->Width);
@@ -1014,7 +1019,6 @@ static void gui_init2(int argc, char** argv)
/**/
ami_hotlist_initialise(nsoption_charp(hotlist_file));
- ami_global_history_initialise();
search_web_select_provider(nsoption_int(search_provider));
if (notalreadyrunning &&
@@ -3038,7 +3042,6 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
ami_hotlist_free(nsoption_charp(hotlist_file));
- ami_global_history_free();
#ifdef __amigaos4__
if(IApplication && ami_appid)
UnregisterApplication(ami_appid, NULL);
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
old mode 100755
new mode 100644
index 2287c70..0fea420
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,28 +16,405 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Implementation of Amiga global history viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
#include <stdbool.h>
-#include <proto/exec.h>
+#include <string.h>
+
+#include <proto/asl.h>
+#include <proto/dos.h>
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
-#include "utils/errors.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include <reaction/reaction_macros.h>
+#include "desktop/global_history.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+
+#include "amiga/corewindow.h"
+#include "amiga/file.h"
#include "amiga/history.h"
-#include "amiga/tree.h"
-#include "amiga/tree.h"
+#include "amiga/libs.h"
+#include "amiga/theme.h"
+#include "amiga/utf8.h"
+
+enum {
+ /* Project menu */
+ AMI_HISTORY_M_PROJECT = 0,
+ AMI_HISTORY_M_EXPORT,
+ AMI_HISTORY_M_BAR_P1,
+ AMI_HISTORY_M_EXPAND,
+ AMI_HISTORY_M_EXPAND_ALL,
+ AMI_HISTORY_M_EXPAND_FOLDERS,
+ AMI_HISTORY_M_EXPAND_LINKS,
+ AMI_HISTORY_M_COLLAPSE,
+ AMI_HISTORY_M_COLLAPSE_ALL,
+ AMI_HISTORY_M_COLLAPSE_FOLDERS,
+ AMI_HISTORY_M_COLLAPSE_LINKS,
+ AMI_HISTORY_M_BAR_P2,
+ AMI_HISTORY_M_SNAPSHOT,
+ AMI_HISTORY_M_BAR_P3,
+ AMI_HISTORY_M_CLOSE,
+ /* Edit menu */
+ AMI_HISTORY_M_EDIT,
+ AMI_HISTORY_M_SELECTALL,
+ AMI_HISTORY_M_CLEAR,
+ AMI_HISTORY_M_BAR_E1,
+ AMI_HISTORY_M_DELETE,
+ AMI_HISTORY_M_LAST
+};
+
+/**
+ * Amiga history viewer window context
+ */
+struct ami_history_global_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+
+ struct ami_menu_data *menu_data[AMI_HISTORY_M_LAST + 1];
+ struct Menu *imenu; /* Intuition menu */
+};
+
+static struct ami_history_global_window *history_window = NULL;
+
+
+static void
+ami_history_global_menu_free(struct ami_history_global_window *history_win)
+{
+ SetAttrs(history_win->core.objects[GID_CW_WIN],
+ WINDOW_MenuStrip, NULL,
+ TAG_DONE);
+
+ ami_menu_free_menu(history_win->menu_data, AMI_HISTORY_M_LAST, history_win->imenu);
+}
+
+/**
+ * destroy a previously created history view
+ */
+static void
+ami_history_global_destroy(struct ami_corewindow *ami_cw)
+{
+ nserror res;
+
+ if(history_window == NULL)
+ return;
+
+ res = global_history_fini();
+ if (res == NSERROR_OK) {
+ ami_history_global_menu_free(history_window);
+ res = ami_corewindow_fini(&history_window->core); /* closes the window for us, frees history_win */
+ history_window = NULL;
+ }
+}
+
+
+/**
+ * callback for mouse action for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ global_history_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for keypress for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (global_history_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback on draw event for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ global_history_redraw(x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+/**
+ * menu stuff
+ */
+
+ /* menu hook functions */
+HOOKF(void, ami_history_global_menu_item_project_export, APTR, window, struct IntuiMessage *)
+{
+ char fname[1024];
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ if(AslRequestTags(savereq,
+ ASLFR_Window, ami_cw->win,
+ ASLFR_SleepWindow, TRUE,
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_InitialFile, "history.html",
+ TAG_DONE)) {
+ strlcpy(fname, savereq->fr_Drawer, 1024);
+ AddPart(fname, savereq->fr_File, 1024);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_WAIT);
+ global_history_export(fname, NULL);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_DEFAULT);
+ }
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(false);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(true);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(false);
+}
-struct treeview_window *global_history_window = NULL;
+HOOKF(void, ami_history_global_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+ global_history_contract(true);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
+{
+ global_history_contract(true);
+}
-void ami_global_history_initialise(void)
+HOOKF(void, ami_history_global_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
{
- global_history_window = ami_tree_create(TREE_HISTORY, NULL);
+ global_history_contract(false);
+}
- if(!global_history_window) return;
+HOOKF(void, ami_history_global_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ nsoption_set_int(history_window_ypos, ami_cw->win->TopEdge);
+ nsoption_set_int(history_window_xpos, ami_cw->win->LeftEdge);
+ nsoption_set_int(history_window_xsize, ami_cw->win->Width);
+ nsoption_set_int(history_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_close, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ ami_cw->close_window = true;
}
-void ami_global_history_free()
+HOOKF(void, ami_history_global_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
{
- ami_tree_destroy(global_history_window);
- global_history_window = NULL;
+ global_history_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_history_global_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+ global_history_keypress(NS_KEY_CLEAR_SELECTION);
+}
+
+HOOKF(void, ami_history_global_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+ global_history_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
+/* menu setup */
+
+static void ami_history_global_menulabs(struct ami_menu_data **md)
+{
+ ami_menu_alloc_item(md, AMI_HISTORY_M_PROJECT, NM_TITLE, "Tree", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPORT, NM_ITEM, "TreeExport", 'S', "TBImages:list_save",
+ ami_history_global_menu_item_project_export, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND, NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_ALL, NM_SUB, "All", '+', NULL,
+ ami_history_global_menu_item_project_expand_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_history_global_menu_item_project_expand_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_history_global_menu_item_project_expand_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE, NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_ALL, NM_SUB, "All", '-', NULL,
+ ami_history_global_menu_item_project_collapse_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_history_global_menu_item_project_collapse_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_history_global_menu_item_project_collapse_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
+ ami_history_global_menu_item_project_snapshot, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
+ ami_history_global_menu_item_project_close, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_SELECTALL, NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+ ami_history_global_menu_item_edit_select_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_CLEAR, NM_ITEM, "ClearNS", 0, NSA_SPACE,
+ ami_history_global_menu_item_edit_clear, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_DELETE, NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+ ami_history_global_menu_item_edit_delete, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HISTORY_M_LAST, NM_END, NULL, 0, NULL, NULL, NULL, 0);
}
+
+static struct Menu *
+ami_history_global_menu_create(struct ami_history_global_window *history_win)
+{
+ ami_history_global_menulabs(history_win->menu_data);
+ history_win->imenu = ami_menu_layout(history_win->menu_data, AMI_HISTORY_M_LAST);
+ if(history_win->imenu == NULL) return NULL;
+
+ return history_win->imenu;
+}
+
+
+static nserror
+ami_history_global_create_window(struct ami_history_global_window *history_win)
+{
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&history_win->core;
+
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(history_window_ypos),
+ WA_Left, nsoption_int(history_window_xpos),
+ WA_Width, nsoption_int(history_window_xsize),
+ WA_Height, nsoption_int(history_window_ysize),
+ 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_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, history_win,
+ WINDOW_MenuStrip, ami_history_global_menu_create(history_win),
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in amiga/cookies.h */
+nserror ami_history_global_present(void)
+{
+ struct ami_history_global_window *ncwin;
+ nserror res;
+
+ if(history_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_history_global_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("GlobalHistory"));
+
+ res = ami_history_global_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_history_global_draw;
+ ncwin->core.key = ami_history_global_key;
+ ncwin->core.mouse = ami_history_global_mouse;
+ ncwin->core.close = ami_history_global_destroy;
+ ncwin->core.event = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = global_history_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ history_window = ncwin;
+
+ return NSERROR_OK;
+}
+
diff --git a/frontends/amiga/history.h b/frontends/amiga/history.h
old mode 100755
new mode 100644
index 47e00ed..67ab670
--- a/frontends/amiga/history.h
+++ b/frontends/amiga/history.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_HISTORY_H
-#define AMIGA_HISTORY_H
-#include "amiga/desktop-tree.h"
+#ifndef AMIGA_HISTORY_GLOBAL_H
+#define AMIGA_HISTORY_GLOBAL_H
-#define GLOBAL_HISTORY_RECENT_URLS 16
-
-void ami_global_history_initialise(void);
-void ami_global_history_free(void);
-
-extern struct treeview_window *global_history_window;
+/** Open the global history viewer */
+nserror ami_history_global_present(void);
#endif
+
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index d88139d..83cfaa7 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -362,7 +362,7 @@ HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessag
HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(global_history_window,AMI_TREE_HISTORY);
+ ami_history_global_present();
}
HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/cookies.c | 2 +-
frontends/amiga/file.c | 3 +
frontends/amiga/file.h | 4 +-
frontends/amiga/gui.c | 7 +-
frontends/amiga/history.c | 405 +++++++++++++++++++++++++++++++++++++++++++--
frontends/amiga/history.h | 16 +-
frontends/amiga/menu.c | 2 +-
7 files changed, 409 insertions(+), 30 deletions(-)
mode change 100755 => 100644 frontends/amiga/history.c
mode change 100755 => 100644 frontends/amiga/history.h
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 18ca425..f428881 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -258,7 +258,7 @@ static void ami_cookies_menulabs(struct ami_menu_data **md)
ami_menu_alloc_item(md, AMI_COOKIE_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
ami_cookies_menu_item_project_snapshot, NULL, 0);
ami_menu_alloc_item(md, AMI_COOKIE_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
- ami_menu_alloc_item(md, AMI_COOKIE_M_CLOSE, NM_ITEM, "CloseWindow", 0, "TBImages:list_cancel",
+ ami_menu_alloc_item(md, AMI_COOKIE_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
ami_cookies_menu_item_project_close, NULL, 0);
ami_menu_alloc_item(md, AMI_COOKIE_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 04f8e8a..0fd4378 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -46,6 +46,9 @@
static struct Hook aslhookfunc;
+struct FileRequester *filereq;
+struct FileRequester *savereq;
+
HOOKF(ULONG, ami_file_asl_mime_hook, struct FileRequester *, fr, struct AnchorPathOld *)
{
char fname[1024];
diff --git a/frontends/amiga/file.h b/frontends/amiga/file.h
index 29a76c4..9120fff 100644
--- a/frontends/amiga/file.h
+++ b/frontends/amiga/file.h
@@ -21,8 +21,8 @@ struct hlcache_object;
struct selection;
struct gui_window_2;
-struct FileRequester *filereq;
-struct FileRequester *savereq;
+extern struct FileRequester *filereq;
+extern struct FileRequester *savereq;
enum {
AMINS_SAVE_SOURCE,
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 9fce681..7c92a40 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -547,6 +547,11 @@ static void ami_set_screen_defaults(struct Screen *screen)
nsoption_default_set_int(cookies_window_xsize, width);
nsoption_default_set_int(cookies_window_ysize, height);
+ nsoption_default_set_int(history_window_ypos, top);
+ nsoption_default_set_int(history_window_xpos, left);
+ nsoption_default_set_int(history_window_xsize, width);
+ nsoption_default_set_int(history_window_ysize, height);
+
nsoption_default_set_int(window_x, 0);
nsoption_default_set_int(window_y, screen->BarHeight + 1);
nsoption_default_set_int(window_width, screen->Width);
@@ -1014,7 +1019,6 @@ static void gui_init2(int argc, char** argv)
/**/
ami_hotlist_initialise(nsoption_charp(hotlist_file));
- ami_global_history_initialise();
search_web_select_provider(nsoption_int(search_provider));
if (notalreadyrunning &&
@@ -3038,7 +3042,6 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
ami_hotlist_free(nsoption_charp(hotlist_file));
- ami_global_history_free();
#ifdef __amigaos4__
if(IApplication && ami_appid)
UnregisterApplication(ami_appid, NULL);
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
old mode 100755
new mode 100644
index 2287c70..0fea420
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,28 +16,405 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Implementation of Amiga global history viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
#include <stdbool.h>
-#include <proto/exec.h>
+#include <string.h>
+
+#include <proto/asl.h>
+#include <proto/dos.h>
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
-#include "utils/errors.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include <reaction/reaction_macros.h>
+#include "desktop/global_history.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+
+#include "amiga/corewindow.h"
+#include "amiga/file.h"
#include "amiga/history.h"
-#include "amiga/tree.h"
-#include "amiga/tree.h"
+#include "amiga/libs.h"
+#include "amiga/theme.h"
+#include "amiga/utf8.h"
+
+enum {
+ /* Project menu */
+ AMI_HISTORY_M_PROJECT = 0,
+ AMI_HISTORY_M_EXPORT,
+ AMI_HISTORY_M_BAR_P1,
+ AMI_HISTORY_M_EXPAND,
+ AMI_HISTORY_M_EXPAND_ALL,
+ AMI_HISTORY_M_EXPAND_FOLDERS,
+ AMI_HISTORY_M_EXPAND_LINKS,
+ AMI_HISTORY_M_COLLAPSE,
+ AMI_HISTORY_M_COLLAPSE_ALL,
+ AMI_HISTORY_M_COLLAPSE_FOLDERS,
+ AMI_HISTORY_M_COLLAPSE_LINKS,
+ AMI_HISTORY_M_BAR_P2,
+ AMI_HISTORY_M_SNAPSHOT,
+ AMI_HISTORY_M_BAR_P3,
+ AMI_HISTORY_M_CLOSE,
+ /* Edit menu */
+ AMI_HISTORY_M_EDIT,
+ AMI_HISTORY_M_SELECTALL,
+ AMI_HISTORY_M_CLEAR,
+ AMI_HISTORY_M_BAR_E1,
+ AMI_HISTORY_M_DELETE,
+ AMI_HISTORY_M_LAST
+};
+
+/**
+ * Amiga history viewer window context
+ */
+struct ami_history_global_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+
+ struct ami_menu_data *menu_data[AMI_HISTORY_M_LAST + 1];
+ struct Menu *imenu; /* Intuition menu */
+};
+
+static struct ami_history_global_window *history_window = NULL;
+
+
+static void
+ami_history_global_menu_free(struct ami_history_global_window *history_win)
+{
+ SetAttrs(history_win->core.objects[GID_CW_WIN],
+ WINDOW_MenuStrip, NULL,
+ TAG_DONE);
+
+ ami_menu_free_menu(history_win->menu_data, AMI_HISTORY_M_LAST, history_win->imenu);
+}
+
+/**
+ * destroy a previously created history view
+ */
+static void
+ami_history_global_destroy(struct ami_corewindow *ami_cw)
+{
+ nserror res;
+
+ if(history_window == NULL)
+ return;
+
+ res = global_history_fini();
+ if (res == NSERROR_OK) {
+ ami_history_global_menu_free(history_window);
+ res = ami_corewindow_fini(&history_window->core); /* closes the window for us, frees history_win */
+ history_window = NULL;
+ }
+}
+
+
+/**
+ * callback for mouse action for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ global_history_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for keypress for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (global_history_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback on draw event for history viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ global_history_redraw(x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+/**
+ * menu stuff
+ */
+
+ /* menu hook functions */
+HOOKF(void, ami_history_global_menu_item_project_export, APTR, window, struct IntuiMessage *)
+{
+ char fname[1024];
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ if(AslRequestTags(savereq,
+ ASLFR_Window, ami_cw->win,
+ ASLFR_SleepWindow, TRUE,
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_InitialFile, "history.html",
+ TAG_DONE)) {
+ strlcpy(fname, savereq->fr_Drawer, 1024);
+ AddPart(fname, savereq->fr_File, 1024);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_WAIT);
+ global_history_export(fname, NULL);
+ ami_update_pointer(ami_cw->win, GUI_POINTER_DEFAULT);
+ }
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(false);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_folders, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(true);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_expand_links, APTR, window, struct IntuiMessage *)
+{
+ global_history_expand(false);
+}
-struct treeview_window *global_history_window = NULL;
+HOOKF(void, ami_history_global_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+ global_history_contract(true);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_collapse_folders, APTR, window, struct IntuiMessage *)
+{
+ global_history_contract(true);
+}
-void ami_global_history_initialise(void)
+HOOKF(void, ami_history_global_menu_item_project_collapse_links, APTR, window, struct IntuiMessage *)
{
- global_history_window = ami_tree_create(TREE_HISTORY, NULL);
+ global_history_contract(false);
+}
- if(!global_history_window) return;
+HOOKF(void, ami_history_global_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ nsoption_set_int(history_window_ypos, ami_cw->win->TopEdge);
+ nsoption_set_int(history_window_xpos, ami_cw->win->LeftEdge);
+ nsoption_set_int(history_window_xsize, ami_cw->win->Width);
+ nsoption_set_int(history_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_history_global_menu_item_project_close, APTR, window, struct IntuiMessage *)
+{
+ struct ami_corewindow *ami_cw;
+ GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+ ami_cw->close_window = true;
}
-void ami_global_history_free()
+HOOKF(void, ami_history_global_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
{
- ami_tree_destroy(global_history_window);
- global_history_window = NULL;
+ global_history_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_history_global_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+ global_history_keypress(NS_KEY_CLEAR_SELECTION);
+}
+
+HOOKF(void, ami_history_global_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+ global_history_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
+/* menu setup */
+
+static void ami_history_global_menulabs(struct ami_menu_data **md)
+{
+ ami_menu_alloc_item(md, AMI_HISTORY_M_PROJECT, NM_TITLE, "Tree", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPORT, NM_ITEM, "TreeExport", 'S', "TBImages:list_save",
+ ami_history_global_menu_item_project_export, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND, NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_ALL, NM_SUB, "All", '+', NULL,
+ ami_history_global_menu_item_project_expand_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_history_global_menu_item_project_expand_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_history_global_menu_item_project_expand_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE, NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_ALL, NM_SUB, "All", '-', NULL,
+ ami_history_global_menu_item_project_collapse_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", 0, NULL,
+ ami_history_global_menu_item_project_collapse_folders, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_LINKS, NM_SUB, "Links", 0, NULL,
+ ami_history_global_menu_item_project_collapse_links, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", 0, "TBImages:list_hold",
+ ami_history_global_menu_item_project_snapshot, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_CLOSE, NM_ITEM, "CloseWindow", 'K', "TBImages:list_cancel",
+ ami_history_global_menu_item_project_close, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HISTORY_M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_SELECTALL, NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+ ami_history_global_menu_item_edit_select_all, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_CLEAR, NM_ITEM, "ClearNS", 0, NSA_SPACE,
+ ami_history_global_menu_item_edit_clear, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+ ami_menu_alloc_item(md, AMI_HISTORY_M_DELETE, NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+ ami_history_global_menu_item_edit_delete, NULL, 0);
+
+ ami_menu_alloc_item(md, AMI_HISTORY_M_LAST, NM_END, NULL, 0, NULL, NULL, NULL, 0);
}
+
+static struct Menu *
+ami_history_global_menu_create(struct ami_history_global_window *history_win)
+{
+ ami_history_global_menulabs(history_win->menu_data);
+ history_win->imenu = ami_menu_layout(history_win->menu_data, AMI_HISTORY_M_LAST);
+ if(history_win->imenu == NULL) return NULL;
+
+ return history_win->imenu;
+}
+
+
+static nserror
+ami_history_global_create_window(struct ami_history_global_window *history_win)
+{
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&history_win->core;
+
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(history_window_ypos),
+ WA_Left, nsoption_int(history_window_xpos),
+ WA_Width, nsoption_int(history_window_xsize),
+ WA_Height, nsoption_int(history_window_ysize),
+ 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_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, history_win,
+ WINDOW_MenuStrip, ami_history_global_menu_create(history_win),
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in amiga/cookies.h */
+nserror ami_history_global_present(void)
+{
+ struct ami_history_global_window *ncwin;
+ nserror res;
+
+ if(history_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_history_global_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("GlobalHistory"));
+
+ res = ami_history_global_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_history_global_draw;
+ ncwin->core.key = ami_history_global_key;
+ ncwin->core.mouse = ami_history_global_mouse;
+ ncwin->core.close = ami_history_global_destroy;
+ ncwin->core.event = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = global_history_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ history_window = ncwin;
+
+ return NSERROR_OK;
+}
+
diff --git a/frontends/amiga/history.h b/frontends/amiga/history.h
old mode 100755
new mode 100644
index 47e00ed..67ab670
--- a/frontends/amiga/history.h
+++ b/frontends/amiga/history.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_HISTORY_H
-#define AMIGA_HISTORY_H
-#include "amiga/desktop-tree.h"
+#ifndef AMIGA_HISTORY_GLOBAL_H
+#define AMIGA_HISTORY_GLOBAL_H
-#define GLOBAL_HISTORY_RECENT_URLS 16
-
-void ami_global_history_initialise(void);
-void ami_global_history_free(void);
-
-extern struct treeview_window *global_history_window;
+/** Open the global history viewer */
+nserror ami_history_global_present(void);
#endif
+
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index d88139d..83cfaa7 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -362,7 +362,7 @@ HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessag
HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(global_history_window,AMI_TREE_HISTORY);
+ ami_history_global_present();
}
HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
--
NetSurf Browser
6 years, 8 months