ARexx menu with items populated from arexx_dir.
svn path=/trunk/netsurf/; revision=5632
This commit is contained in:
parent
30b09368e7
commit
124899e5bc
|
@ -253,6 +253,11 @@ Settings:Settings
|
||||||
SnapshotWindow:Snapshot window
|
SnapshotWindow:Snapshot window
|
||||||
SettingsSave:Save settings
|
SettingsSave:Save settings
|
||||||
|
|
||||||
|
# ARexx menu
|
||||||
|
#
|
||||||
|
ARexx:ARexx
|
||||||
|
ARexxExecute:Execute script...
|
||||||
|
|
||||||
# Context menu
|
# Context menu
|
||||||
#
|
#
|
||||||
Link:Link
|
Link:Link
|
||||||
|
|
|
@ -253,6 +253,11 @@ Settings:Settings
|
||||||
SnapshotWindow:Snapshot window
|
SnapshotWindow:Snapshot window
|
||||||
SettingsSave:Save settings
|
SettingsSave:Save settings
|
||||||
|
|
||||||
|
# ARexx menu
|
||||||
|
#
|
||||||
|
ARexx:ARexx
|
||||||
|
ARexxExecute:Execute script...
|
||||||
|
|
||||||
# Context menu
|
# Context menu
|
||||||
#
|
#
|
||||||
Link:Link
|
Link:Link
|
||||||
|
|
|
@ -253,6 +253,11 @@ Settings:Settings
|
||||||
SnapshotWindow:Snapshot window
|
SnapshotWindow:Snapshot window
|
||||||
SettingsSave:Save settings
|
SettingsSave:Save settings
|
||||||
|
|
||||||
|
# ARexx menu
|
||||||
|
#
|
||||||
|
ARexx:ARexx
|
||||||
|
ARexxExecute:Execute script...
|
||||||
|
|
||||||
# Context menu
|
# Context menu
|
||||||
#
|
#
|
||||||
Link:Link
|
Link:Link
|
||||||
|
|
|
@ -254,6 +254,11 @@ Settings:Impostazioni
|
||||||
SnapshotWindow:Fissa finestra
|
SnapshotWindow:Fissa finestra
|
||||||
SettingsSave:Salva impostazioni
|
SettingsSave:Salva impostazioni
|
||||||
|
|
||||||
|
# ARexx menu
|
||||||
|
#
|
||||||
|
ARexx:ARexx
|
||||||
|
ARexxExecute:Execute script...
|
||||||
|
|
||||||
# Context menu
|
# Context menu
|
||||||
#
|
#
|
||||||
Link:Link
|
Link:Link
|
||||||
|
|
|
@ -253,6 +253,11 @@ Settings:Settings
|
||||||
SnapshotWindow:Snapshot window
|
SnapshotWindow:Snapshot window
|
||||||
SettingsSave:Save settings
|
SettingsSave:Save settings
|
||||||
|
|
||||||
|
# ARexx menu
|
||||||
|
#
|
||||||
|
ARexx:ARexx
|
||||||
|
ARexxExecute:Execute script...
|
||||||
|
|
||||||
# Context menu
|
# Context menu
|
||||||
#
|
#
|
||||||
Link:Link
|
Link:Link
|
||||||
|
|
|
@ -47,7 +47,7 @@ STATIC struct ARexxCmd Commands[] =
|
||||||
{ NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL }
|
{ NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
void ami_arexx_init()
|
void ami_arexx_init(void)
|
||||||
{
|
{
|
||||||
if(arexx_obj = ARexxObject,
|
if(arexx_obj = ARexxObject,
|
||||||
AREXX_HostName,"NETSURF",
|
AREXX_HostName,"NETSURF",
|
||||||
|
@ -61,12 +61,17 @@ void ami_arexx_init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ami_arexx_handle()
|
void ami_arexx_handle(void)
|
||||||
{
|
{
|
||||||
RA_HandleRexx(arexx_obj);
|
RA_HandleRexx(arexx_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ami_arexx_cleanup()
|
void ami_arexx_execute(char *script)
|
||||||
|
{
|
||||||
|
IDoMethod(arexx_obj, AM_EXECUTE, script, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ami_arexx_cleanup(void)
|
||||||
{
|
{
|
||||||
if(arexx_obj) DisposeObject(arexx_obj);
|
if(arexx_obj) DisposeObject(arexx_obj);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +100,15 @@ STATIC VOID rx_tofront(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((
|
||||||
|
|
||||||
STATIC VOID rx_geturl(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
|
STATIC VOID rx_geturl(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
if(curbw)
|
||||||
|
{
|
||||||
strcpy(result,curbw->current_content->url);
|
strcpy(result,curbw->current_content->url);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(result,"\0");
|
||||||
|
}
|
||||||
|
|
||||||
cmd->ac_Result = result;
|
cmd->ac_Result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ URL = address of page to open on startup.
|
||||||
@endnode
|
@endnode
|
||||||
|
|
||||||
@node options "Options file"
|
@node options "Options file"
|
||||||
The options file is stored in Resources/Options by default. The following options are specific to the Amiga version although there are other relevant options in the file:
|
The options file is stored in @{"Resources/Options" link Resources/Options/Main} by default. The following options are specific to the Amiga version although there are other relevant options in the file:
|
||||||
|
|
||||||
@{b}url_file@{ub} Path to URL database file
|
@{b}url_file@{ub} Path to URL database file
|
||||||
@{b}hotlist_file@{ub} Path to Hotlist file
|
@{b}hotlist_file@{ub} Path to Hotlist file
|
||||||
@{b}use_workbench@{ub} Open NetSurf in a window on Workbench screen (default is to open a custom screen)
|
@{b}use_workbench@{ub} Open NetSurf in a window on Workbench screen (default is to open a custom screen)
|
||||||
@{b}screen_modeid@{ub} Mode ID for NetSurf's custom screen
|
@{b}screen_modeid@{ub} Mode ID for NetSurf's custom screen. If not specified, NetSurf will use @{b}window_screen_width@{ub} and @{b}window_screen_height@{ub} to find the best mode.
|
||||||
@{b}theme@{ub} Path to theme (default is Resources/Themes/Default - an alternative included theme is Resources/Themes/AISS)
|
@{b}theme@{ub} Path to theme (default is Resources/Themes/Default - an alternative included theme is Resources/Themes/AISS)
|
||||||
@{b}no_iframes@{ub} Disable IFrames
|
@{b}no_iframes@{ub} Disable IFrames
|
||||||
@{b}clipboard_write_utf8@{ub} Write UTF-8 strings to the clipboard along with a charset identifier (when this option is 0, NetSurf will convert copied strings to local charset)
|
@{b}clipboard_write_utf8@{ub} Write UTF-8 strings to the clipboard along with a charset identifier (when this option is 0, NetSurf will convert copied strings to local charset)
|
||||||
|
@ -42,6 +42,8 @@ The options file is stored in Resources/Options by default. The following optio
|
||||||
@{b}new_tab_is_active@{ub} Make new tab the active one
|
@{b}new_tab_is_active@{ub} Make new tab the active one
|
||||||
@{b}kiosk_mode@{ub} No gadgets
|
@{b}kiosk_mode@{ub} No gadgets
|
||||||
@{b}recent_file@{ub} Path to file to store recent history list
|
@{b}recent_file@{ub} Path to file to store recent history list
|
||||||
|
@{b}arexx_dir@{ub} Path to ARexx scripts dir
|
||||||
|
@{b}download_dir@{ub} default download destination (not used yet)
|
||||||
@endnode
|
@endnode
|
||||||
|
|
||||||
@node arexx "ARexx port"
|
@node arexx "ARexx port"
|
||||||
|
@ -49,8 +51,25 @@ NetSurf's ARexx port is called NETSURF.
|
||||||
|
|
||||||
Commands are:
|
Commands are:
|
||||||
|
|
||||||
@{b}OPEN URL/A@{ub} Opens URL in a new window
|
@{b}OPEN URL/A,NEW=NEWWINDOW/S@{ub} Opens URL in current window or a new window if NEWWINDOW is specified.
|
||||||
@{b}QUIT@{ub} Quits NetSurf
|
@{b}QUIT@{ub} Quits NetSurf
|
||||||
|
@{b}TOFRONT@{ub} Brings NetSurf's screen to the front
|
||||||
|
@{b}GETURL@{ub} Puts the URL displayed in the current window/tab into RESULT
|
||||||
|
|
||||||
|
The ARexx menu will be populated with scripts named #?.nsrx in @{"arexx_dir" link options 18}, up to a maximum of 20 entries. The titles of these entries will be the comments field of the file (or the filename if comments field is empty).
|
||||||
|
|
||||||
|
|
||||||
|
@{u}OpenURL configuration@{uu}
|
||||||
|
|
||||||
|
Click Add on the Browsers page and fill in the details as follows:
|
||||||
|
Name: NetSurf
|
||||||
|
Path: NetSurf %u
|
||||||
|
ARexx port: NETSURF
|
||||||
|
Show:
|
||||||
|
To front: TOFRONT
|
||||||
|
Open URL: OPEN "%u"
|
||||||
|
New window: OPEN "%u" NEW
|
||||||
|
|
||||||
@endnode
|
@endnode
|
||||||
|
|
||||||
@node hotlist "Hotlist menu"
|
@node hotlist "Hotlist menu"
|
||||||
|
|
Binary file not shown.
29
amiga/gui.c
29
amiga/gui.c
|
@ -65,6 +65,7 @@
|
||||||
#include "amiga/context_menu.h"
|
#include "amiga/context_menu.h"
|
||||||
#include "amiga/cookies.h"
|
#include "amiga/cookies.h"
|
||||||
#include "amiga/clipboard.h"
|
#include "amiga/clipboard.h"
|
||||||
|
#include <proto/keymap.h>
|
||||||
|
|
||||||
#ifdef WITH_HUBBUB
|
#ifdef WITH_HUBBUB
|
||||||
#include <hubbub/hubbub.h>
|
#include <hubbub/hubbub.h>
|
||||||
|
@ -101,6 +102,8 @@ struct Device *TimerBase;
|
||||||
struct TimerIFace *ITimer;
|
struct TimerIFace *ITimer;
|
||||||
struct Library *PopupMenuBase = NULL;
|
struct Library *PopupMenuBase = NULL;
|
||||||
struct PopupMenuIFace *IPopupMenu = NULL;
|
struct PopupMenuIFace *IPopupMenu = NULL;
|
||||||
|
struct Library *KeymapBase = NULL;
|
||||||
|
struct KeymapIFace *IKeymap = NULL;
|
||||||
|
|
||||||
struct BitMap *throbber = NULL;
|
struct BitMap *throbber = NULL;
|
||||||
ULONG throbber_width,throbber_height,throbber_frames;
|
ULONG throbber_width,throbber_height,throbber_frames;
|
||||||
|
@ -183,9 +186,12 @@ void gui_init(int argc, char** argv)
|
||||||
IPopupMenu = (struct PopupMenuIFace *)GetInterface(PopupMenuBase,"main",1,NULL);
|
IPopupMenu = (struct PopupMenuIFace *)GetInterface(PopupMenuBase,"main",1,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
filereq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest,NULL);
|
if(KeymapBase = OpenLibrary("keymap.library",37))
|
||||||
|
{
|
||||||
|
IKeymap = (struct KeymapIFace *)GetInterface(KeymapBase,"main",1,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ami_arexx_init();
|
filereq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest,NULL);
|
||||||
|
|
||||||
ami_clipboard_init();
|
ami_clipboard_init();
|
||||||
|
|
||||||
|
@ -194,6 +200,7 @@ void gui_init(int argc, char** argv)
|
||||||
options_read("Resources/Options");
|
options_read("Resources/Options");
|
||||||
|
|
||||||
verbose_log = option_verbose_log;
|
verbose_log = option_verbose_log;
|
||||||
|
|
||||||
ami_init_mouse_pointers();
|
ami_init_mouse_pointers();
|
||||||
nsscreentitle = ASPrintf("NetSurf %s",netsurf_version);
|
nsscreentitle = ASPrintf("NetSurf %s",netsurf_version);
|
||||||
|
|
||||||
|
@ -283,6 +290,9 @@ void gui_init(int argc, char** argv)
|
||||||
if((!option_theme) || (option_theme[0] == '\0'))
|
if((!option_theme) || (option_theme[0] == '\0'))
|
||||||
option_theme = (char *)strdup("Resources/Themes/Default");
|
option_theme = (char *)strdup("Resources/Themes/Default");
|
||||||
|
|
||||||
|
if((!option_arexx_dir) || (option_arexx_dir[0] == '\0'))
|
||||||
|
option_arexx_dir = (char *)strdup("Rexx");
|
||||||
|
|
||||||
if(!option_window_width) option_window_width = 800;
|
if(!option_window_width) option_window_width = 800;
|
||||||
if(!option_window_height) option_window_height = 600;
|
if(!option_window_height) option_window_height = 600;
|
||||||
if(!option_window_screen_width) option_window_screen_width = 800;
|
if(!option_window_screen_width) option_window_screen_width = 800;
|
||||||
|
@ -310,6 +320,7 @@ void gui_init(int argc, char** argv)
|
||||||
}
|
}
|
||||||
/* end Amiupdate */
|
/* end Amiupdate */
|
||||||
|
|
||||||
|
ami_arexx_init();
|
||||||
ami_init_menulabs();
|
ami_init_menulabs();
|
||||||
if(option_context_menu) ami_context_menu_init();
|
if(option_context_menu) ami_context_menu_init();
|
||||||
|
|
||||||
|
@ -627,7 +638,14 @@ void ami_handle_msg(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GID_RELOAD:
|
case GID_RELOAD:
|
||||||
|
if(gwin->key_state & BROWSER_MOUSE_MOD_1)
|
||||||
|
{
|
||||||
|
browser_window_reload(gwin->bw,true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
browser_window_reload(gwin->bw,false);
|
browser_window_reload(gwin->bw,false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GID_BACK:
|
case GID_BACK:
|
||||||
|
@ -689,6 +707,7 @@ void ami_handle_msg(void)
|
||||||
storage = result & WMHI_GADGETMASK;
|
storage = result & WMHI_GADGETMASK;
|
||||||
|
|
||||||
GetAttr(WINDOW_InputEvent,gwin->objects[OID_MAIN],(ULONG *)&ie);
|
GetAttr(WINDOW_InputEvent,gwin->objects[OID_MAIN],(ULONG *)&ie);
|
||||||
|
|
||||||
switch(storage)
|
switch(storage)
|
||||||
{
|
{
|
||||||
case RAWKEY_CRSRUP:
|
case RAWKEY_CRSRUP:
|
||||||
|
@ -718,6 +737,9 @@ void ami_handle_msg(void)
|
||||||
case 0xe3: // lctrl up
|
case 0xe3: // lctrl up
|
||||||
gwin->key_state = 0;
|
gwin->key_state = 0;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
/*MapRawKey etc */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1076,6 +1098,9 @@ void gui_quit(void)
|
||||||
if(IPopupMenu) DropInterface((struct Interface *)IPopupMenu);
|
if(IPopupMenu) DropInterface((struct Interface *)IPopupMenu);
|
||||||
if(PopupMenuBase) CloseLibrary(PopupMenuBase);
|
if(PopupMenuBase) CloseLibrary(PopupMenuBase);
|
||||||
|
|
||||||
|
if(IKeymap) DropInterface((struct Interface *)IKeymap);
|
||||||
|
if(KeymapBase) CloseLibrary(KeymapBase);
|
||||||
|
|
||||||
if(ITimer)
|
if(ITimer)
|
||||||
{
|
{
|
||||||
DropInterface((struct Interface *)ITimer);
|
DropInterface((struct Interface *)ITimer);
|
||||||
|
|
137
amiga/menu.c
137
amiga/menu.c
|
@ -34,9 +34,14 @@
|
||||||
#include "amiga/tree.h"
|
#include "amiga/tree.h"
|
||||||
#include "amiga/history.h"
|
#include "amiga/history.h"
|
||||||
#include "amiga/cookies.h"
|
#include "amiga/cookies.h"
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include "amiga/arexx.h"
|
||||||
|
|
||||||
|
BOOL menualreadyinit;
|
||||||
|
|
||||||
void ami_menu_scan(struct tree *tree,struct NewMenu *menu);
|
void ami_menu_scan(struct tree *tree,struct NewMenu *menu);
|
||||||
void ami_menu_scan_2(struct tree *tree,struct node *root,WORD *gen,ULONG *item,struct NewMenu *menu);
|
void ami_menu_scan_2(struct tree *tree,struct node *root,WORD *gen,ULONG *item,struct NewMenu *menu);
|
||||||
|
void ami_menu_arexx_scan(struct NewMenu *menu);
|
||||||
|
|
||||||
void ami_free_menulabs(void)
|
void ami_free_menulabs(void)
|
||||||
{
|
{
|
||||||
|
@ -79,6 +84,9 @@ void ami_init_menulabs(void)
|
||||||
menulab[65] = ami_utf8_easy((char *)messages_get("Settings"));
|
menulab[65] = ami_utf8_easy((char *)messages_get("Settings"));
|
||||||
menulab[66] = ami_utf8_easy((char *)messages_get("SnapshotWindow"));
|
menulab[66] = ami_utf8_easy((char *)messages_get("SnapshotWindow"));
|
||||||
menulab[67] = ami_utf8_easy((char *)messages_get("SettingsSave"));
|
menulab[67] = ami_utf8_easy((char *)messages_get("SettingsSave"));
|
||||||
|
menulab[68] = ami_utf8_easy((char *)messages_get("ARexx"));
|
||||||
|
menulab[69] = ami_utf8_easy((char *)messages_get("ARexxExecute"));
|
||||||
|
menulab[70] = NM_BARLABEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NewMenu *ami_create_menu(ULONG type)
|
struct NewMenu *ami_create_menu(ULONG type)
|
||||||
|
@ -154,6 +162,29 @@ struct NewMenu *ami_create_menu(ULONG type)
|
||||||
{NM_TITLE,0,0,0,0,0,}, // settings
|
{NM_TITLE,0,0,0,0,0,}, // settings
|
||||||
{ NM_ITEM,0,0,0,0,0,}, // snapshot window
|
{ NM_ITEM,0,0,0,0,0,}, // snapshot window
|
||||||
{ NM_ITEM,0,0,0,0,0,}, // save settings
|
{ NM_ITEM,0,0,0,0,0,}, // save settings
|
||||||
|
{NM_TITLE,0,0,0,0,0,}, // arexx
|
||||||
|
{ NM_ITEM,0,0,0,0,0,}, // execute arexx
|
||||||
|
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
|
{ NM_IGNORE,0,0,0,0,0,}, // ** arexx entry **
|
||||||
{ NM_END,0,0,0,0,0,},
|
{ NM_END,0,0,0,0,0,},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,11 +207,75 @@ struct NewMenu *ami_create_menu(ULONG type)
|
||||||
menu[7].nm_Flags = NM_ITEMDISABLED;
|
menu[7].nm_Flags = NM_ITEMDISABLED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(!menualreadyinit)
|
||||||
|
{
|
||||||
ami_menu_scan(hotlist,menu);
|
ami_menu_scan(hotlist,menu);
|
||||||
|
ami_menu_arexx_scan(menu);
|
||||||
|
menualreadyinit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return(menu);
|
return(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ami_menu_arexx_scan(struct NewMenu *menu)
|
||||||
|
{
|
||||||
|
int item = AMI_MENU_AREXX;
|
||||||
|
BPTR lock = 0;
|
||||||
|
UBYTE *buffer;
|
||||||
|
struct ExAllControl *ctrl;
|
||||||
|
char matchpatt[16];
|
||||||
|
LONG cont;
|
||||||
|
struct ExAllData *ead;
|
||||||
|
|
||||||
|
if(lock = Lock(option_arexx_dir,SHARED_LOCK))
|
||||||
|
{
|
||||||
|
if(buffer = AllocVec(1024,MEMF_PRIVATE | MEMF_CLEAR))
|
||||||
|
{
|
||||||
|
if(ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))
|
||||||
|
{
|
||||||
|
ctrl->eac_LastKey = 0;
|
||||||
|
|
||||||
|
if(ParsePatternNoCase("#?.nsrx",(char *)&matchpatt,16) != -1)
|
||||||
|
{
|
||||||
|
ctrl->eac_MatchString = (char *)&matchpatt;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
cont = ExAll(lock,buffer,1024,ED_COMMENT,ctrl);
|
||||||
|
if((!cont) && (IoErr() != ERROR_NO_MORE_ENTRIES)) break;
|
||||||
|
if(!ctrl->eac_Entries) continue;
|
||||||
|
|
||||||
|
for(ead = (struct ExAllData *)buffer; ead; ead = ead->ed_Next)
|
||||||
|
{
|
||||||
|
if(item >= AMI_MENU_AREXX_MAX) continue;
|
||||||
|
if(EAD_IS_FILE(ead))
|
||||||
|
{
|
||||||
|
menu[item].nm_Type = NM_ITEM;
|
||||||
|
if(ead->ed_Comment[0] != '\0')
|
||||||
|
{
|
||||||
|
menulab[item] = (char *)strdup(ead->ed_Comment);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menulab[item] = (char *)strdup(ead->ed_Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu[item].nm_Label = menulab[item];
|
||||||
|
menu[item].nm_UserData = (char *)strdup(ead->ed_Name);
|
||||||
|
|
||||||
|
item++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}while(cont);
|
||||||
|
FreeDosObject(DOS_EXALLCONTROL,ctrl);
|
||||||
|
}
|
||||||
|
FreeVec(buffer);
|
||||||
|
}
|
||||||
|
UnLock(lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ami_menu_scan(struct tree *tree,struct NewMenu *menu)
|
void ami_menu_scan(struct tree *tree,struct NewMenu *menu)
|
||||||
{
|
{
|
||||||
struct node *root = tree->root->child;
|
struct node *root = tree->root->child;
|
||||||
|
@ -224,7 +319,7 @@ void ami_menu_scan_2(struct tree *tree,struct node *root,WORD *gen,ULONG *item,s
|
||||||
|
|
||||||
if(strcmp(element->text,"--"))
|
if(strcmp(element->text,"--"))
|
||||||
{
|
{
|
||||||
menulab[*item] = ami_utf8_easy(element->text);
|
menulab[*item] = ami_utf8_easy((char *)element->text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -234,7 +329,7 @@ void ami_menu_scan_2(struct tree *tree,struct node *root,WORD *gen,ULONG *item,s
|
||||||
menu[*item].nm_Label = menulab[*item];
|
menu[*item].nm_Label = menulab[*item];
|
||||||
|
|
||||||
element = tree_find_element(node, TREE_ELEMENT_URL);
|
element = tree_find_element(node, TREE_ELEMENT_URL);
|
||||||
if(element && element->text) menu[*item].nm_UserData = element->text;
|
if(element && element->text) menu[*item].nm_UserData = (void *)element->text;
|
||||||
|
|
||||||
if(node->folder && (!node->child)) menu[*item].nm_Flags = NM_ITEMDISABLED;
|
if(node->folder && (!node->child)) menu[*item].nm_Flags = NM_ITEMDISABLED;
|
||||||
|
|
||||||
|
@ -260,6 +355,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
|
||||||
subnum = SUBNUM(code);
|
subnum = SUBNUM(code);
|
||||||
bool openwin=false;
|
bool openwin=false;
|
||||||
bool opentab=true;
|
bool opentab=true;
|
||||||
|
char *temp;
|
||||||
|
|
||||||
if(option_force_tabs)
|
if(option_force_tabs)
|
||||||
{
|
{
|
||||||
|
@ -433,5 +529,42 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 5: // arexx
|
||||||
|
switch(itemnum)
|
||||||
|
{
|
||||||
|
case 0: // execute arexx
|
||||||
|
if(AslRequestTags(filereq,
|
||||||
|
ASLFR_TitleText,messages_get("NetSurf"),
|
||||||
|
ASLFR_Screen,scrn,
|
||||||
|
ASLFR_DoSaveMode,FALSE,
|
||||||
|
ASLFR_InitialDrawer,option_arexx_dir,
|
||||||
|
ASLFR_InitialPattern,"#?.nsrx",
|
||||||
|
TAG_DONE))
|
||||||
|
{
|
||||||
|
if(temp = AllocVec(1024,MEMF_PRIVATE | MEMF_CLEAR))
|
||||||
|
{
|
||||||
|
strlcpy(temp,filereq->fr_Drawer,1024);
|
||||||
|
AddPart(temp,filereq->fr_File,1024);
|
||||||
|
ami_arexx_execute(temp);
|
||||||
|
FreeVec(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // arexx menu items
|
||||||
|
if(GTMENUITEM_USERDATA(item))
|
||||||
|
{
|
||||||
|
if(temp = AllocVec(1024,MEMF_PRIVATE | MEMF_CLEAR))
|
||||||
|
{
|
||||||
|
strcpy(temp,option_arexx_dir);
|
||||||
|
AddPart(temp,GTMENUITEM_USERDATA(item),1024);
|
||||||
|
ami_arexx_execute(temp);
|
||||||
|
FreeVec(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
24
amiga/menu.h
24
amiga/menu.h
|
@ -22,10 +22,32 @@
|
||||||
#include "amiga/gui.h"
|
#include "amiga/gui.h"
|
||||||
#include <intuition/intuition.h>
|
#include <intuition/intuition.h>
|
||||||
|
|
||||||
|
/* Number of hotlist items, menu structure needs to be changed in ami_create_menu()
|
||||||
|
* if this value is changed. */
|
||||||
#define AMI_HOTLIST_ITEMS 40
|
#define AMI_HOTLIST_ITEMS 40
|
||||||
#define AMI_MENU_MAX 28 + AMI_HOTLIST_ITEMS
|
|
||||||
|
/* Maximum number of menu items - first value is number of static items
|
||||||
|
* (ie. everything not intially defined as NM_IGNORE) */
|
||||||
|
#define AMI_MENU_MAX 31 + AMI_HOTLIST_ITEMS
|
||||||
|
|
||||||
|
/* Where the hotlist entries start */
|
||||||
#define AMI_MENU_HOTLIST 25
|
#define AMI_MENU_HOTLIST 25
|
||||||
|
|
||||||
|
/* Where the hotlist entries end */
|
||||||
#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS
|
#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS
|
||||||
|
|
||||||
|
/* Number of ARexx menu items. menu structure in ami_create_menu() needs to be
|
||||||
|
* changed if this value is modified. */
|
||||||
|
#define AMI_MENU_AREXX_ITEMS 20
|
||||||
|
|
||||||
|
/* Where the ARexx menu items start. ARexx menu items are right at the end...
|
||||||
|
* for now, at least. We can get away with AMI_MENU_MAX falling short as it is
|
||||||
|
* only used for freeing the UTF-8 converted menu labels */
|
||||||
|
#define AMI_MENU_AREXX AMI_MENU_MAX
|
||||||
|
|
||||||
|
/* Where the ARexx menu items end (incidentally this is the real AMI_MENU_MAX) */
|
||||||
|
#define AMI_MENU_AREXX_MAX AMI_MENU_AREXX+AMI_MENU_AREXX_ITEMS
|
||||||
|
|
||||||
char *menulab[AMI_MENU_MAX+1];
|
char *menulab[AMI_MENU_MAX+1];
|
||||||
|
|
||||||
struct NewMenu *ami_create_menu(ULONG type);
|
struct NewMenu *ami_create_menu(ULONG type);
|
||||||
|
|
|
@ -36,6 +36,8 @@ extern bool option_force_tabs;
|
||||||
extern bool option_new_tab_active;
|
extern bool option_new_tab_active;
|
||||||
extern bool option_kiosk_mode;
|
extern bool option_kiosk_mode;
|
||||||
extern char *option_recent_file;
|
extern char *option_recent_file;
|
||||||
|
extern char *option_arexx_dir;
|
||||||
|
extern char *option_download_dir;
|
||||||
|
|
||||||
#define EXTRA_OPTION_DEFINE \
|
#define EXTRA_OPTION_DEFINE \
|
||||||
bool option_verbose_log = false; \
|
bool option_verbose_log = false; \
|
||||||
|
@ -54,6 +56,8 @@ bool option_force_tabs = false; \
|
||||||
bool option_new_tab_active = false; \
|
bool option_new_tab_active = false; \
|
||||||
bool option_kiosk_mode = false; \
|
bool option_kiosk_mode = false; \
|
||||||
char *option_recent_file = 0; \
|
char *option_recent_file = 0; \
|
||||||
|
char *option_arexx_dir = 0; \
|
||||||
|
char *option_download_dir = 0; \
|
||||||
|
|
||||||
#define EXTRA_OPTION_TABLE \
|
#define EXTRA_OPTION_TABLE \
|
||||||
{ "verbose_log", OPTION_BOOL, &option_verbose_log}, \
|
{ "verbose_log", OPTION_BOOL, &option_verbose_log}, \
|
||||||
|
@ -71,5 +75,7 @@ char *option_recent_file = 0; \
|
||||||
{ "always_open_tabs", OPTION_BOOL, &option_force_tabs}, \
|
{ "always_open_tabs", OPTION_BOOL, &option_force_tabs}, \
|
||||||
{ "new_tab_is_active", OPTION_BOOL, &option_new_tab_active}, \
|
{ "new_tab_is_active", OPTION_BOOL, &option_new_tab_active}, \
|
||||||
{ "kiosk_mode", OPTION_BOOL, &option_kiosk_mode}, \
|
{ "kiosk_mode", OPTION_BOOL, &option_kiosk_mode}, \
|
||||||
{ "recent_file", OPTION_STRING, &option_recent_file },
|
{ "recent_file", OPTION_STRING, &option_recent_file }, \
|
||||||
|
{ "arexx_dir", OPTION_STRING, &option_arexx_dir }, \
|
||||||
|
{ "download_dir", OPTION_STRING, &option_download_dir },
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue