Full quit function and associated ARexx command (QUIT)

svn path=/trunk/netsurf/; revision=5498
This commit is contained in:
Chris Young 2008-10-06 17:47:31 +00:00
parent be787cabb1
commit 2808d77089
5 changed files with 67 additions and 12 deletions

View File

@ -21,17 +21,21 @@
#include <string.h>
#include <proto/intuition.h>
#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();
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -21,7 +21,7 @@
#include <exec/types.h>
#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);