netsurf: branch chris/amiga-corewindow updated. release/3.6-168-g5687f6c

NetSurf Browser Project (Commit Mailer) no-reply at netsurf-browser.org
Thu Jan 5 18:54:37 GMT 2017


Gitweb links:

...log http://git.netsurf-browser.org/netsurf.git/shortlog/5687f6c27d40ec596b4d64c705d16a97bdb3c893
...commit http://git.netsurf-browser.org/netsurf.git/commit/5687f6c27d40ec596b4d64c705d16a97bdb3c893
...tree http://git.netsurf-browser.org/netsurf.git/tree/5687f6c27d40ec596b4d64c705d16a97bdb3c893

The branch, chris/amiga-corewindow has been updated
       via  5687f6c27d40ec596b4d64c705d16a97bdb3c893 (commit)
       via  e98a05bb087fb5c2c2ee8d94b3011ae8b3aa5c7a (commit)
      from  6e957396a9bdc78a7d9823aaf76764bbb30c184a (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=5687f6c27d40ec596b4d64c705d16a97bdb3c893
commit 5687f6c27d40ec596b4d64c705d16a97bdb3c893
Author: Chris Young <chris at unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris at unsatisfactorysoftware.co.uk>

    clear tree pointer on free

diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index 6134fa5..5429f68 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -843,6 +843,7 @@ nserror cookie_manager_fini(void)
 
 	/* Destroy the cookie manager treeview */
 	err = treeview_destroy(cm_ctx.tree);
+	cm_ctx.tree = NULL;
 
 	/* Free cookie manager treeview entry fields */
 	for (i = 0; i < COOKIE_M_N_FIELDS; i++)


commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=e98a05bb087fb5c2c2ee8d94b3011ae8b3aa5c7a
commit e98a05bb087fb5c2c2ee8d94b3011ae8b3aa5c7a
Author: Chris Young <chris at unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris at unsatisfactorysoftware.co.uk>

    Complete cookie manager corewindow interface

diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 1300236..18ca425 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -25,7 +25,6 @@
 #include <stdlib.h>
 #include <stdbool.h>
 
-#include <proto/gadtools.h>
 #include <proto/intuition.h>
 
 #include <classes/window.h>
@@ -49,8 +48,25 @@
 enum {
 	/* Project menu */
 	AMI_COOKIE_M_PROJECT = 0,
-	 AMI_COOKIE_M_TEST,
-	 AMI_COOKIE_M_LAST
+	 AMI_COOKIE_M_EXPAND,
+	  AMI_COOKIE_M_EXPAND_ALL,
+	  AMI_COOKIE_M_EXPAND_DOMAINS,
+	  AMI_COOKIE_M_EXPAND_COOKIES,
+	 AMI_COOKIE_M_COLLAPSE,
+	  AMI_COOKIE_M_COLLAPSE_ALL,
+	  AMI_COOKIE_M_COLLAPSE_DOMAINS,
+	  AMI_COOKIE_M_COLLAPSE_COOKIES,
+	 AMI_COOKIE_M_BAR_P1,
+	 AMI_COOKIE_M_SNAPSHOT,
+	 AMI_COOKIE_M_BAR_P2,
+	 AMI_COOKIE_M_CLOSE,
+	/* Edit menu */
+	AMI_COOKIE_M_EDIT,
+	 AMI_COOKIE_M_SELECTALL,
+	 AMI_COOKIE_M_CLEAR,
+	 AMI_COOKIE_M_BAR_E1,
+	 AMI_COOKIE_M_DELETE,
+	AMI_COOKIE_M_LAST
 };
 
 /**
@@ -74,8 +90,7 @@ ami_cookies_menu_free(struct ami_cookie_window *cookie_win)
 		WINDOW_MenuStrip, NULL,
 	TAG_DONE);
 	
-	ami_menu_free_labs(cookie_win->menu_data, AMI_COOKIE_M_LAST);
-	FreeMenus(cookie_win->imenu);
+	ami_menu_free_menu(cookie_win->menu_data, AMI_COOKIE_M_LAST, cookie_win->imenu);
 }
 
 /**
@@ -155,19 +170,106 @@ ami_cookies_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, st
 
  /* menu hook functions */
  
-HOOKF(void, ami_cookies_menu_item_project_test, APTR, window, struct IntuiMessage *)
+HOOKF(void, ami_cookies_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
 {
-	
+	cookie_manager_expand(false);
+}
+ 
+HOOKF(void, ami_cookies_menu_item_project_expand_domains, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_expand(true);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_expand_cookies, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_expand(false);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_contract(true);
 }
  
+HOOKF(void, ami_cookies_menu_item_project_collapse_domains, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_contract(true);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_collapse_cookies, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_contract(false);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+	struct ami_corewindow *ami_cw;
+	GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+	nsoption_set_int(cookies_window_ypos, ami_cw->win->TopEdge);
+	nsoption_set_int(cookies_window_xpos, ami_cw->win->LeftEdge);
+	nsoption_set_int(cookies_window_xsize, ami_cw->win->Width);
+	nsoption_set_int(cookies_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_cookies_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_cookies_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_cookies_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_keypress(NS_KEY_CLEAR_SELECTION);
+}
+
+HOOKF(void, ami_cookies_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
 /* menu setup */
 
 static void ami_cookies_menulabs(struct ami_menu_data **md)
 {
-	/* not real menu items */
-	ami_menu_alloc_item(md, AMI_COOKIE_M_PROJECT, NM_TITLE, "Project",       0, NULL, NULL, NULL, 0);
-	ami_menu_alloc_item(md, AMI_COOKIE_M_TEST,   NM_ITEM, "TEST", 'N', "TBImages:list_app",
-			ami_cookies_menu_item_project_test, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_PROJECT, NM_TITLE, "Tree",       0, NULL, NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND,   NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND_ALL,   NM_SUB, "All", '+', NULL,
+		ami_cookies_menu_item_project_expand_all, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND_DOMAINS,   NM_SUB, "Domains", 0, NULL,
+		ami_cookies_menu_item_project_expand_domains, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND_COOKIES,   NM_SUB, "Cookies", 0, NULL,
+		ami_cookies_menu_item_project_expand_cookies, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE,   NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE_ALL,   NM_SUB, "All", '-', NULL,
+		ami_cookies_menu_item_project_collapse_all, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE_DOMAINS,   NM_SUB, "Domains", 0, NULL,
+		ami_cookies_menu_item_project_collapse_domains, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE_COOKIES,   NM_SUB, "Cookies", 0, NULL,
+		ami_cookies_menu_item_project_collapse_cookies, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+	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_cookies_menu_item_project_close, NULL, 0);
+
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EDIT, NM_TITLE, "Edit",       0, NULL, NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_SELECTALL,   NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+		ami_cookies_menu_item_edit_select_all, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_CLEAR,   NM_ITEM, "ClearNS", 0, NSA_SPACE,
+		ami_cookies_menu_item_edit_clear, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_DELETE,   NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+		ami_cookies_menu_item_edit_delete, NULL, 0);
+
 	ami_menu_alloc_item(md, AMI_COOKIE_M_LAST,   NM_END, NULL,     0, NULL, NULL, NULL, 0);
 }
 
@@ -212,6 +314,7 @@ ami_cookies_create_window(struct ami_cookie_window *cookie_win)
 		WINDOW_VertProp, 1,
 		WINDOW_UserData, cookie_win,
 		WINDOW_MenuStrip, ami_cookies_menu_create(cookie_win),
+		WINDOW_MenuUserData, WGUD_HOOK,
 		WINDOW_IconifyGadget, FALSE,
 		WINDOW_Position, WPOS_CENTERSCREEN,
 		WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 0d0c9d6..1bfc537 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -472,6 +472,11 @@ ami_cw_event(void *w)
 	int x = 0, y = 0;
 
 	while((result = RA_HandleInput(ami_cw->objects[GID_CW_WIN], &code)) != WMHI_LASTMSG) {
+		if(ami_cw->close_window == true) {
+			ami_cw_close(ami_cw);
+			return TRUE;
+		}
+
 		switch(result & WMHI_CLASSMASK) {
 			case WMHI_MOUSEMOVE:
 				if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 2fa4a23..17af249 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -58,6 +58,8 @@ struct ami_corewindow {
 		int mouse_y_click;
 		int mouse_state;
 
+		bool close_window; // set to true to close the window during event loop
+
 		APTR deferred_rects_pool;
 		struct MinList *deferred_rects;
 
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 1b69b3e..d88139d 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -77,7 +77,6 @@
 #include "amiga/utf8.h"
 #include "amiga/schedule.h"
 
-#define NSA_SPACE "blankspace.png"
 #define NSA_MAX_HOTLIST_MENU_LEN 100
 
 enum {
@@ -545,7 +544,7 @@ HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
 
 
 /* menu creation code */
-void ami_menu_free_labs(struct ami_menu_data **md, int max)
+static void ami_menu_free_labs(struct ami_menu_data **md, int max)
 {
 	int i;
 
@@ -984,6 +983,12 @@ void ami_menu_free(struct gui_window_2 *gwin)
 	FreeMenus(gwin->imenu);
 }
 
+void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu)
+{
+	ami_menu_free_labs(md, max);
+	FreeMenus(imenu);
+}
+
 struct Menu *ami_menu_create(struct gui_window_2 *gwin)
 {
 	ami_init_menulabs(gwin->menu_data);
diff --git a/frontends/amiga/menu.h b/frontends/amiga/menu.h
index 1f6f245..ad0e96d 100644
--- a/frontends/amiga/menu.h
+++ b/frontends/amiga/menu.h
@@ -26,6 +26,9 @@
 struct hlcache_handle;
 struct ami_menu_data;
 
+/** empty space */
+#define NSA_SPACE "blankspace.png"
+
 /** Maximum number of hotlist items (somewhat arbitrary value) */
 #define AMI_HOTLIST_ITEMS 60
 
@@ -133,18 +136,23 @@ enum {
 struct gui_window;
 struct gui_window_2;
 
-void ami_free_menulabs(struct ami_menu_data **md); //specific to browser windows
-void ami_menu_free_labs(struct ami_menu_data **md, int max); // generic ver
-struct Menu *ami_menu_create(struct gui_window_2 *gwin);
-void ami_menu_refresh(struct gui_window_2 *gwin);
-void ami_menu_update_checked(struct gui_window_2 *gwin);
-void ami_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c);
+/* cleanup */
 void ami_menu_free_glyphs(void);
-void ami_menu_free(struct gui_window_2 *gwin);
+
+/* generic menu alloc/free/layout */
 void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type,
 			const char *restrict label, char key, const char *restrict icon,
 			void *restrict func, void *restrict hookdata, UWORD flags);
 struct Menu *ami_menu_layout(struct ami_menu_data **md, int max);
+void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu);
+
+/* specific to browser windows */
+void ami_free_menulabs(struct ami_menu_data **md);
+struct Menu *ami_menu_create(struct gui_window_2 *gwin);
+void ami_menu_refresh(struct gui_window_2 *gwin);
+void ami_menu_update_checked(struct gui_window_2 *gwin);
+void ami_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c);
+void ami_menu_free(struct gui_window_2 *gwin);
 
 /**
  * Sets that an item linked to a toggle menu item has been changed.


-----------------------------------------------------------------------

Summary of changes:
 desktop/cookie_manager.c     |    1 +
 frontends/amiga/cookies.c    |  125 ++++++++++++++++++++++++++++++++++++++----
 frontends/amiga/corewindow.c |    5 ++
 frontends/amiga/corewindow.h |    2 +
 frontends/amiga/menu.c       |    9 ++-
 frontends/amiga/menu.h       |   22 +++++---
 6 files changed, 144 insertions(+), 20 deletions(-)

diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index 6134fa5..5429f68 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -843,6 +843,7 @@ nserror cookie_manager_fini(void)
 
 	/* Destroy the cookie manager treeview */
 	err = treeview_destroy(cm_ctx.tree);
+	cm_ctx.tree = NULL;
 
 	/* Free cookie manager treeview entry fields */
 	for (i = 0; i < COOKIE_M_N_FIELDS; i++)
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 1300236..18ca425 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -25,7 +25,6 @@
 #include <stdlib.h>
 #include <stdbool.h>
 
-#include <proto/gadtools.h>
 #include <proto/intuition.h>
 
 #include <classes/window.h>
@@ -49,8 +48,25 @@
 enum {
 	/* Project menu */
 	AMI_COOKIE_M_PROJECT = 0,
-	 AMI_COOKIE_M_TEST,
-	 AMI_COOKIE_M_LAST
+	 AMI_COOKIE_M_EXPAND,
+	  AMI_COOKIE_M_EXPAND_ALL,
+	  AMI_COOKIE_M_EXPAND_DOMAINS,
+	  AMI_COOKIE_M_EXPAND_COOKIES,
+	 AMI_COOKIE_M_COLLAPSE,
+	  AMI_COOKIE_M_COLLAPSE_ALL,
+	  AMI_COOKIE_M_COLLAPSE_DOMAINS,
+	  AMI_COOKIE_M_COLLAPSE_COOKIES,
+	 AMI_COOKIE_M_BAR_P1,
+	 AMI_COOKIE_M_SNAPSHOT,
+	 AMI_COOKIE_M_BAR_P2,
+	 AMI_COOKIE_M_CLOSE,
+	/* Edit menu */
+	AMI_COOKIE_M_EDIT,
+	 AMI_COOKIE_M_SELECTALL,
+	 AMI_COOKIE_M_CLEAR,
+	 AMI_COOKIE_M_BAR_E1,
+	 AMI_COOKIE_M_DELETE,
+	AMI_COOKIE_M_LAST
 };
 
 /**
@@ -74,8 +90,7 @@ ami_cookies_menu_free(struct ami_cookie_window *cookie_win)
 		WINDOW_MenuStrip, NULL,
 	TAG_DONE);
 	
-	ami_menu_free_labs(cookie_win->menu_data, AMI_COOKIE_M_LAST);
-	FreeMenus(cookie_win->imenu);
+	ami_menu_free_menu(cookie_win->menu_data, AMI_COOKIE_M_LAST, cookie_win->imenu);
 }
 
 /**
@@ -155,19 +170,106 @@ ami_cookies_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, st
 
  /* menu hook functions */
  
-HOOKF(void, ami_cookies_menu_item_project_test, APTR, window, struct IntuiMessage *)
+HOOKF(void, ami_cookies_menu_item_project_expand_all, APTR, window, struct IntuiMessage *)
 {
-	
+	cookie_manager_expand(false);
+}
+ 
+HOOKF(void, ami_cookies_menu_item_project_expand_domains, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_expand(true);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_expand_cookies, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_expand(false);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_collapse_all, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_contract(true);
 }
  
+HOOKF(void, ami_cookies_menu_item_project_collapse_domains, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_contract(true);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_collapse_cookies, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_contract(false);
+}
+
+HOOKF(void, ami_cookies_menu_item_project_snapshot, APTR, window, struct IntuiMessage *)
+{
+	struct ami_corewindow *ami_cw;
+	GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&ami_cw);
+
+	nsoption_set_int(cookies_window_ypos, ami_cw->win->TopEdge);
+	nsoption_set_int(cookies_window_xpos, ami_cw->win->LeftEdge);
+	nsoption_set_int(cookies_window_xsize, ami_cw->win->Width);
+	nsoption_set_int(cookies_window_ysize, ami_cw->win->Height);
+}
+
+HOOKF(void, ami_cookies_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_cookies_menu_item_edit_select_all, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_keypress(NS_KEY_SELECT_ALL);
+}
+
+HOOKF(void, ami_cookies_menu_item_edit_clear, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_keypress(NS_KEY_CLEAR_SELECTION);
+}
+
+HOOKF(void, ami_cookies_menu_item_edit_delete, APTR, window, struct IntuiMessage *)
+{
+	cookie_manager_keypress(NS_KEY_DELETE_LEFT);
+}
+
+
 /* menu setup */
 
 static void ami_cookies_menulabs(struct ami_menu_data **md)
 {
-	/* not real menu items */
-	ami_menu_alloc_item(md, AMI_COOKIE_M_PROJECT, NM_TITLE, "Project",       0, NULL, NULL, NULL, 0);
-	ami_menu_alloc_item(md, AMI_COOKIE_M_TEST,   NM_ITEM, "TEST", 'N', "TBImages:list_app",
-			ami_cookies_menu_item_project_test, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_PROJECT, NM_TITLE, "Tree",       0, NULL, NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND,   NM_ITEM, "Expand", 0, "TBImages:list_folderunfold", NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND_ALL,   NM_SUB, "All", '+', NULL,
+		ami_cookies_menu_item_project_expand_all, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND_DOMAINS,   NM_SUB, "Domains", 0, NULL,
+		ami_cookies_menu_item_project_expand_domains, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EXPAND_COOKIES,   NM_SUB, "Cookies", 0, NULL,
+		ami_cookies_menu_item_project_expand_cookies, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE,   NM_ITEM, "Collapse", 0, "TBImages:list_folderfold", NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE_ALL,   NM_SUB, "All", '-', NULL,
+		ami_cookies_menu_item_project_collapse_all, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE_DOMAINS,   NM_SUB, "Domains", 0, NULL,
+		ami_cookies_menu_item_project_collapse_domains, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_COLLAPSE_COOKIES,   NM_SUB, "Cookies", 0, NULL,
+		ami_cookies_menu_item_project_collapse_cookies, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+	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_cookies_menu_item_project_close, NULL, 0);
+
+	ami_menu_alloc_item(md, AMI_COOKIE_M_EDIT, NM_TITLE, "Edit",       0, NULL, NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_SELECTALL,   NM_ITEM, "SelectAllNS", 'A', NSA_SPACE,
+		ami_cookies_menu_item_edit_select_all, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_CLEAR,   NM_ITEM, "ClearNS", 0, NSA_SPACE,
+		ami_cookies_menu_item_edit_clear, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL, 0);
+	ami_menu_alloc_item(md, AMI_COOKIE_M_DELETE,   NM_ITEM, "TreeDelete", 0, "TBImages:list_delete",
+		ami_cookies_menu_item_edit_delete, NULL, 0);
+
 	ami_menu_alloc_item(md, AMI_COOKIE_M_LAST,   NM_END, NULL,     0, NULL, NULL, NULL, 0);
 }
 
@@ -212,6 +314,7 @@ ami_cookies_create_window(struct ami_cookie_window *cookie_win)
 		WINDOW_VertProp, 1,
 		WINDOW_UserData, cookie_win,
 		WINDOW_MenuStrip, ami_cookies_menu_create(cookie_win),
+		WINDOW_MenuUserData, WGUD_HOOK,
 		WINDOW_IconifyGadget, FALSE,
 		WINDOW_Position, WPOS_CENTERSCREEN,
 		WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 0d0c9d6..1bfc537 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -472,6 +472,11 @@ ami_cw_event(void *w)
 	int x = 0, y = 0;
 
 	while((result = RA_HandleInput(ami_cw->objects[GID_CW_WIN], &code)) != WMHI_LASTMSG) {
+		if(ami_cw->close_window == true) {
+			ami_cw_close(ami_cw);
+			return TRUE;
+		}
+
 		switch(result & WMHI_CLASSMASK) {
 			case WMHI_MOUSEMOVE:
 				if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 2fa4a23..17af249 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -58,6 +58,8 @@ struct ami_corewindow {
 		int mouse_y_click;
 		int mouse_state;
 
+		bool close_window; // set to true to close the window during event loop
+
 		APTR deferred_rects_pool;
 		struct MinList *deferred_rects;
 
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 1b69b3e..d88139d 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -77,7 +77,6 @@
 #include "amiga/utf8.h"
 #include "amiga/schedule.h"
 
-#define NSA_SPACE "blankspace.png"
 #define NSA_MAX_HOTLIST_MENU_LEN 100
 
 enum {
@@ -545,7 +544,7 @@ HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
 
 
 /* menu creation code */
-void ami_menu_free_labs(struct ami_menu_data **md, int max)
+static void ami_menu_free_labs(struct ami_menu_data **md, int max)
 {
 	int i;
 
@@ -984,6 +983,12 @@ void ami_menu_free(struct gui_window_2 *gwin)
 	FreeMenus(gwin->imenu);
 }
 
+void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu)
+{
+	ami_menu_free_labs(md, max);
+	FreeMenus(imenu);
+}
+
 struct Menu *ami_menu_create(struct gui_window_2 *gwin)
 {
 	ami_init_menulabs(gwin->menu_data);
diff --git a/frontends/amiga/menu.h b/frontends/amiga/menu.h
index 1f6f245..ad0e96d 100644
--- a/frontends/amiga/menu.h
+++ b/frontends/amiga/menu.h
@@ -26,6 +26,9 @@
 struct hlcache_handle;
 struct ami_menu_data;
 
+/** empty space */
+#define NSA_SPACE "blankspace.png"
+
 /** Maximum number of hotlist items (somewhat arbitrary value) */
 #define AMI_HOTLIST_ITEMS 60
 
@@ -133,18 +136,23 @@ enum {
 struct gui_window;
 struct gui_window_2;
 
-void ami_free_menulabs(struct ami_menu_data **md); //specific to browser windows
-void ami_menu_free_labs(struct ami_menu_data **md, int max); // generic ver
-struct Menu *ami_menu_create(struct gui_window_2 *gwin);
-void ami_menu_refresh(struct gui_window_2 *gwin);
-void ami_menu_update_checked(struct gui_window_2 *gwin);
-void ami_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c);
+/* cleanup */
 void ami_menu_free_glyphs(void);
-void ami_menu_free(struct gui_window_2 *gwin);
+
+/* generic menu alloc/free/layout */
 void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type,
 			const char *restrict label, char key, const char *restrict icon,
 			void *restrict func, void *restrict hookdata, UWORD flags);
 struct Menu *ami_menu_layout(struct ami_menu_data **md, int max);
+void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu);
+
+/* specific to browser windows */
+void ami_free_menulabs(struct ami_menu_data **md);
+struct Menu *ami_menu_create(struct gui_window_2 *gwin);
+void ami_menu_refresh(struct gui_window_2 *gwin);
+void ami_menu_update_checked(struct gui_window_2 *gwin);
+void ami_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c);
+void ami_menu_free(struct gui_window_2 *gwin);
 
 /**
  * Sets that an item linked to a toggle menu item has been changed.


-- 
NetSurf Browser



More information about the netsurf-commits mailing list