Add some options to the browser menu

This commit is contained in:
Chris Young 2012-12-15 14:21:15 +00:00
parent 51067561c9
commit 8c74aeb6e1
2 changed files with 67 additions and 16 deletions

View File

@ -103,6 +103,9 @@ static void ami_menu_item_browser_find(struct Hook *hook, APTR window, struct In
static void ami_menu_item_browser_localhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_globalhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_cookies(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_foreimg(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, struct IntuiMessage *msg);
static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window, struct IntuiMessage *msg);
@ -325,25 +328,44 @@ void ami_init_menulabs(struct gui_window_2 *gwin)
gwin->menu_hook[37].h_Entry = (HOOKFUNC)ami_menu_item_browser_scale_increase;
gwin->menutype[38] = NM_ITEM;
gwin->menulab[38] = ami_utf8_easy((char *)messages_get("Redraw"));
gwin->menu_hook[38].h_Entry = (HOOKFUNC)ami_menu_item_browser_redraw;
gwin->menutype[39] = NM_TITLE;
gwin->menulab[39] = ami_utf8_easy((char *)messages_get("Hotlist"));
gwin->menutype[40] = NM_ITEM;
gwin->menulab[40] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
gwin->menukey[40] = 'B';
gwin->menu_hook[40].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_add;
gwin->menulab[38] = ami_utf8_easy((char *)messages_get("Images"));
gwin->menutype[39] = NM_SUB;
gwin->menulab[39] = ami_utf8_easy((char *)messages_get("ForeImg"));
gwin->menu_hook[39].h_Entry = (HOOKFUNC)ami_menu_item_browser_foreimg;
gwin->menutype[40] = NM_SUB;
gwin->menulab[40] = ami_utf8_easy((char *)messages_get("BackImg"));
gwin->menu_hook[40].h_Entry = (HOOKFUNC)ami_menu_item_browser_backimg;
gwin->menutype[41] = NM_ITEM;
gwin->menulab[41] = ami_utf8_easy((char *)messages_get("HotlistShowNS"));
gwin->menukey[41] = 'H';
gwin->menu_hook[41].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_show;
gwin->menulab[41] = ami_utf8_easy((char *)messages_get("EnableJS"));
gwin->menu_hook[41].h_Entry = (HOOKFUNC)ami_menu_item_browser_enablejs;
gwin->menukey[41] = 'J';
gwin->menutype[42] = NM_ITEM;
gwin->menulab[42] = NM_BARLABEL;
gwin->menutype[43] = NM_ITEM;
gwin->menulab[43] = ami_utf8_easy((char *)messages_get("Redraw"));
gwin->menu_hook[43].h_Entry = (HOOKFUNC)ami_menu_item_browser_redraw;
gwin->menutype[44] = NM_TITLE;
gwin->menulab[44] = ami_utf8_easy((char *)messages_get("Hotlist"));
gwin->menutype[45] = NM_ITEM;
gwin->menulab[45] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
gwin->menukey[45] = 'B';
gwin->menu_hook[45].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_add;
gwin->menutype[46] = NM_ITEM;
gwin->menulab[46] = ami_utf8_easy((char *)messages_get("HotlistShowNS"));
gwin->menukey[46] = 'H';
gwin->menu_hook[46].h_Entry = (HOOKFUNC)ami_menu_item_hotlist_show;
gwin->menutype[47] = NM_ITEM;
gwin->menulab[47] = NM_BARLABEL;
gwin->menutype[AMI_MENU_HOTLIST_MAX + 1] = NM_TITLE;
gwin->menulab[AMI_MENU_HOTLIST_MAX + 1] = ami_utf8_easy((char *)messages_get("Settings"));
@ -415,9 +437,23 @@ struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
#ifndef WITH_PDF_EXPORT
gwin->menu[9].nm_Flags = NM_ITEMDISABLED;
#endif
#if !defined(WITH_JS) && !defined(WITH_MOZJS)
gwin->menu[41].nm_Flags = NM_ITEMDISABLED | CHECKIT | MENUTOGGLE;
#else
gwin->menu[41].nm_Flags = CHECKIT | MENUTOGGLE;
if(nsoption_bool(enable_javascript) == true)
gwin->menu[41].nm_Flags |= CHECKED;
#endif
gwin->menu[15].nm_Flags = NM_ITEMDISABLED;
gwin->menu[39].nm_Flags = CHECKIT | MENUTOGGLE;
if(nsoption_bool(foreground_images) == true)
gwin->menu[39].nm_Flags |= CHECKED;
gwin->menu[40].nm_Flags = CHECKIT | MENUTOGGLE;
if(nsoption_bool(background_images) == true)
gwin->menu[40].nm_Flags |= CHECKED;
ami_menu_scan(ami_tree_get_tree(hotlist_window), false, gwin);
ami_menu_arexx_scan(gwin);
@ -824,6 +860,21 @@ static void ami_menu_item_browser_cookies(struct Hook *hook, APTR window, struct
ami_tree_open(cookies_window,AMI_TREE_COOKIES);
}
static void ami_menu_item_browser_foreimg(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
nsoption_set_bool(foreground_images, !nsoption_bool(foreground_images));
}
static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
nsoption_set_bool(background_images, !nsoption_bool(background_images));
}
static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
nsoption_set_bool(enable_javascript, !nsoption_bool(enable_javascript));
}
static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
struct gui_window_2 *gwin;

View File

@ -30,10 +30,10 @@
/* Maximum number of menu items - first value is number of static items
* (ie. everything not intially defined as NM_IGNORE) */
#define AMI_MENU_MAX 52 + AMI_HOTLIST_ITEMS
#define AMI_MENU_MAX 57 + AMI_HOTLIST_ITEMS
/* Where the hotlist entries start */
#define AMI_MENU_HOTLIST 43
#define AMI_MENU_HOTLIST 48
/* Where the hotlist entries end */
#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS
@ -64,7 +64,7 @@
#define AMI_MENU_FIND FULLMENUNUM(2,0,0)
/* A special value for ami_menu_window_close */
#define AMI_MENU_WINDOW_CLOSE_ALL 1
#define AMI_MENU_WINDOW_CLOSE_ALL (void *)1
struct gui_window;
struct gui_window_2;