From 2808d77089a34eb3bdf98b6a7a71ebc7df9c5fac Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 6 Oct 2008 17:47:31 +0000 Subject: Full quit function and associated ARexx command (QUIT) svn path=/trunk/netsurf/; revision=5498 --- amiga/arexx.c | 9 +++++++++ amiga/gui.c | 37 +++++++++++++++++++++++++++++++++++++ amiga/gui.h | 1 + amiga/menu.c | 30 +++++++++++++++++++----------- amiga/menu.h | 2 +- 5 files changed, 67 insertions(+), 12 deletions(-) diff --git a/amiga/arexx.c b/amiga/arexx.c index 3c3c77c35..51fe0b835 100755 --- a/amiga/arexx.c +++ b/amiga/arexx.c @@ -21,17 +21,21 @@ #include #include #include "desktop/browser.h" +#include "amiga/gui.h" enum { RX_OPEN=0, + RX_QUIT, }; STATIC VOID rx_open(struct ARexxCmd *, struct RexxMsg *); +STATIC VOID rx_quit(struct ARexxCmd *, struct RexxMsg *); STATIC struct ARexxCmd Commands[] = { {"OPEN",RX_OPEN,rx_open,"URL/A", 0, NULL, 0, 0, NULL }, + {"QUIT",RX_QUIT,rx_quit,NULL, 0, NULL, 0, 0, NULL }, { NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL } }; @@ -63,3 +67,8 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu { browser_window_create((char *)cmd->ac_ArgList[0],NULL,NULL,true,false); } + +STATIC VOID rx_quit(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused))) +{ + ami_quit_netsurf(); +} diff --git a/amiga/gui.c b/amiga/gui.c index 032a66798..76d1c2d9e 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -937,6 +937,40 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw) } } +void ami_quit_netsurf(void) +{ + struct nsObject *node; + struct nsObject *nnode; + struct gui_window_2 *gwin; + + node = (struct nsObject *)GetHead((struct List *)window_list); + + do + { + nnode=(struct nsObject *)GetSucc((struct Node *)node); + gwin = node->objstruct; + + switch(node->Type) + { + case AMINS_TVWINDOW: + ami_tree_close((struct treeview_window *)gwin); + break; + + case AMINS_WINDOW: + ami_close_all_tabs(gwin); + break; + } + + node = nnode; + } while(node = nnode); + + if(IsMinListEmpty(window_list)) + { + /* last window closed, so exit */ + netsurf_quit = true; + } +} + void gui_quit(void) { int i; @@ -1795,6 +1829,9 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy) ULONG cur_tab = 0; if(!g) return; + if(sx<0) sx=0; + if(sy<0) sy=0; + /* if(g->tab_node) GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab); diff --git a/amiga/gui.h b/amiga/gui.h index 44d985081..01c59b7dc 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -116,6 +116,7 @@ struct gui_window void ami_get_msg(void); void ami_update_pointer(struct Window *win, gui_pointer_shape shape); void ami_close_all_tabs(struct gui_window_2 *gwin); +void ami_quit_netsurf(void); struct RastPort *currp; struct TextFont *origrpfont; diff --git a/amiga/menu.c b/amiga/menu.c index 6f6033e33..6af77e821 100755 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -56,17 +56,19 @@ void ami_init_menulabs(void) menulab[8] = NM_BARLABEL; menulab[9] = ami_utf8_easy((char *)messages_get("CloseTab")); menulab[10] = ami_utf8_easy((char *)messages_get("CloseWindow")); - menulab[11] = ami_utf8_easy((char *)messages_get("Edit")); - menulab[12] = ami_utf8_easy((char *)messages_get("CopyNS")); - menulab[13] = ami_utf8_easy((char *)messages_get("Paste")); - menulab[14] = ami_utf8_easy((char *)messages_get("SelectAllNS")); - menulab[15] = ami_utf8_easy((char *)messages_get("ClearNS")); - menulab[16] = ami_utf8_easy((char *)messages_get("Hotlist")); - menulab[17] = ami_utf8_easy((char *)messages_get("HotlistAdd")); - menulab[18] = ami_utf8_easy((char *)messages_get("HotlistShowNS")); - menulab[19] = ami_utf8_easy((char *)messages_get("Settings")); - menulab[20] = ami_utf8_easy((char *)messages_get("SnapshotWindow")); - menulab[21] = ami_utf8_easy((char *)messages_get("SettingsSave")); + menulab[11] = NM_BARLABEL; + menulab[12] = ami_utf8_easy((char *)messages_get("Quit")); + menulab[13] = ami_utf8_easy((char *)messages_get("Edit")); + menulab[14] = ami_utf8_easy((char *)messages_get("CopyNS")); + menulab[15] = ami_utf8_easy((char *)messages_get("Paste")); + menulab[16] = ami_utf8_easy((char *)messages_get("SelectAllNS")); + menulab[17] = ami_utf8_easy((char *)messages_get("ClearNS")); + menulab[18] = ami_utf8_easy((char *)messages_get("Hotlist")); + menulab[19] = ami_utf8_easy((char *)messages_get("HotlistAdd")); + menulab[20] = ami_utf8_easy((char *)messages_get("HotlistShowNS")); + menulab[21] = ami_utf8_easy((char *)messages_get("Settings")); + menulab[22] = ami_utf8_easy((char *)messages_get("SnapshotWindow")); + menulab[23] = ami_utf8_easy((char *)messages_get("SettingsSave")); } struct NewMenu *ami_create_menu(ULONG type) @@ -85,6 +87,8 @@ struct NewMenu *ami_create_menu(ULONG type) { NM_ITEM,NM_BARLABEL,0,0,0,0,}, { NM_ITEM,0,"K",0,0,0,}, // close tab { NM_ITEM,0,0,0,0,0,}, // close window + { NM_ITEM,NM_BARLABEL,0,0,0,0,}, + { NM_ITEM,0,"Q",0,0,0,}, // quit {NM_TITLE,0,0,0,0,0,}, // edit { NM_ITEM,0,"C",0,0,0,}, // copy { NM_ITEM,0,"V",0,0,0,}, // paste @@ -228,6 +232,10 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin) case 6: // close window ami_close_all_tabs(gwin); break; + + case 8: // quit + ami_quit_netsurf(); + break; } break; diff --git a/amiga/menu.h b/amiga/menu.h index af05e4a90..6b005fe79 100755 --- a/amiga/menu.h +++ b/amiga/menu.h @@ -21,7 +21,7 @@ #include #include "amiga/gui.h" -#define AMI_MENU_MAX 21 +#define AMI_MENU_MAX 23 char *menulab[AMI_MENU_MAX+1]; struct NewMenu *ami_create_menu(ULONG type); -- cgit v1.2.3