From 168d09c8780de36daa580a2b584059e37744b53b Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 28 Nov 2012 22:42:23 +0000 Subject: Improve the look of the hotlist toolbar --- amiga/gui.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 064c49cbd..2cbceac1e 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2495,11 +2495,20 @@ void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) SpeedBarObject, GA_ID, GID_HOTLIST, GA_RelVerify, TRUE, + SPEEDBAR_BevelStyle, BVS_NONE, SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list, SpeedBarEnd; + + gwin->objects[GID_HOTLISTSEPBAR] = + BevelObject, + BEVEL_Style, BVS_SBAR_VERT, + BevelEnd; IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDCHILD, gwin->win, gwin->objects[GID_HOTLIST], NULL); + + IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDIMAGE, + gwin->win, gwin->objects[GID_HOTLISTSEPBAR], NULL); } FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]); @@ -2977,7 +2986,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, BEVEL_Style, BVS_SBAR_VERT, BevelEnd, CHILD_WeightedHeight, 0, - LAYOUT_AddChild, g->shared->objects[GID_HOTLISTLAYOUT] = HGroupObject, + LAYOUT_AddChild, g->shared->objects[GID_HOTLISTLAYOUT] = VGroupObject, LAYOUT_SpaceInner, FALSE, LayoutEnd, CHILD_WeightedHeight,0, -- cgit v1.2.3 From 23dc635e1a2386d52779384d6117f020376142f7 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 29 Nov 2012 22:13:42 +0000 Subject: Make hotlist toolbar work and update (only updates on hotlist window close currently) --- amiga/gui.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- amiga/gui.h | 1 + amiga/menu.c | 6 ++-- amiga/tree.c | 2 ++ 4 files changed, 105 insertions(+), 4 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 2cbceac1e..93ee08282 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -1600,6 +1600,14 @@ void ami_handle_msg(void) browser_window_go(gwin->bw,(char *)storage, NULL, true); break; + case GID_HOTLIST: + GetAttrs(gwin->objects[GID_HOTLIST], + SPEEDBAR_SelectedNode, &tabnode, TAG_DONE); + GetSpeedButtonNodeAttrs(tabnode, SBNA_UserData, (ULONG *)&storage, TAG_DONE); + + browser_window_go(gwin->bw, (char *)storage, NULL, true); + break; + case GID_HOME: browser_window_go(gwin->bw,nsoption_charp(homepage_url),NULL,true); break; @@ -2477,7 +2485,7 @@ int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, stru { element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL); if(!element) element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL); - if(element && (strcmp(tree_node_element_get_text(element), "Toolbar") == 0)) + if(element && (strcmp(tree_node_element_get_text(element), messages_get("HotlistToolbar")) == 0)) { ami_gui_hotlist_scan_2(tree, tree_node_get_child(node), &gen, &item, speed_button_list, gwin); } @@ -2509,12 +2517,100 @@ void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDIMAGE, gwin->win, gwin->objects[GID_HOTLISTSEPBAR], NULL); + + FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]); + + RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN], + gwin->win, NULL, TRUE); + } +} + +void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List *speed_button_list) +{ + int i; + struct Node *node; + struct Node *nnode; + + if(IsListEmpty(speed_button_list)) return; + node = GetHead(speed_button_list); + + do { + nnode = GetSucc(node); + Remove(node); + FreeSpeedButtonNode(node); + } while(node = nnode); + + for(i = 0; i < AMI_GUI_TOOLBAR_MAX; i++) { + if(gwin->hotlist_toolbar_lab[i]) { + free(gwin->hotlist_toolbar_lab[i]); + gwin->hotlist_toolbar_lab[i] = NULL; + } } +} + +void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin) +{ + IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD, + gwin->win, gwin->objects[GID_HOTLIST]); + + IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD, + gwin->win, gwin->objects[GID_HOTLISTSEPBAR]); FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]); RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN], gwin->win, NULL, TRUE); + + gwin->redraw_required = true; + gwin->bw->reformat_pending = true; + + ami_gui_hotlist_toolbar_free(gwin, &gwin->hotlist_toolbar_list); +} + +void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin) +{ + if(IsListEmpty(&gwin->hotlist_toolbar_list)) { + ami_gui_hotlist_toolbar_add(gwin); + return; + } + + /* Below should be SetAttr according to Autodocs */ + SetGadgetAttrs((struct Gadget *)gwin->objects[GID_HOTLIST], + gwin->win, NULL, + SPEEDBAR_Buttons, ~0, + TAG_DONE); + + ami_gui_hotlist_toolbar_free(gwin, &gwin->hotlist_toolbar_list); + + if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) { + SetGadgetAttrs((struct Gadget *)gwin->objects[GID_HOTLIST], + gwin->win, NULL, + SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list, + TAG_DONE); + } else { + ami_gui_hotlist_toolbar_remove(gwin); + } +} + +void ami_gui_hotlist_toolbar_update_all(void) +{ + struct nsObject *node; + struct nsObject *nnode; + struct gui_window_2 *gwin; + + if(IsMinListEmpty(window_list)) return; + + node = (struct nsObject *)GetHead((struct List *)window_list); + + do { + nnode=(struct nsObject *)GetSucc((struct Node *)node); + gwin = node->objstruct; + + if(node->Type == AMINS_WINDOW) + { + ami_gui_hotlist_toolbar_update(gwin); + } + } while(node = nnode); } void ami_toggletabbar(struct gui_window_2 *gwin, bool show) @@ -3305,6 +3401,8 @@ void gui_window_destroy(struct gui_window *g) ami_gui_appicon_remove(g->shared); if(g->shared->appwin) RemoveAppWindow(g->shared->appwin); + ami_gui_hotlist_toolbar_free(g->shared, &g->shared->hotlist_toolbar_list); + /* These aren't freed by the above. * TODO: nav_west etc need freeing too? */ DisposeObject(g->shared->objects[GID_ADDTAB_BM]); diff --git a/amiga/gui.h b/amiga/gui.h index 14cec107d..6a5434f87 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -153,6 +153,7 @@ int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie); bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y); BOOL ami_gadget_hit(Object *obj, int x, int y); void ami_gui_history(struct gui_window_2 *gwin, bool back); +void ami_gui_hotlist_toolbar_update_all(void); struct TextFont *origrpfont; struct MinList *window_list; diff --git a/amiga/menu.c b/amiga/menu.c index b116e1b39..f42860612 100755 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -506,17 +506,17 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) { element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL); if(!element) element = tree_node_find_element(node, TREE_ELEMENT_TITLE, NULL); - if(element && (strcmp(tree_node_element_get_text(element),"Menu")==0)) + if(element && (strcmp(tree_node_element_get_text(element), messages_get("HotlistMenu")) == 0)) { // found menu - ami_menu_scan_2(tree,tree_node_get_child(node),&gen,&item,count,gwin); + ami_menu_scan_2(tree, tree_node_get_child(node), &gen, &item, count, gwin); } } return(item - AMI_MENU_HOTLIST); } -void ami_menu_scan_2(struct tree *tree,struct node *root,WORD *gen, +void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen, ULONG *item, bool count, struct gui_window_2 *gwin) { struct node *tempnode; diff --git a/amiga/tree.c b/amiga/tree.c index f2ef3cc83..95a68dc20 100755 --- a/amiga/tree.c +++ b/amiga/tree.c @@ -690,6 +690,8 @@ void ami_tree_close(struct treeview_window *twin) ami_utf8_free(twin->sslreject); ami_ssl_free(twin); } + + ami_gui_hotlist_toolbar_update_all(); } void ami_tree_update_quals(struct treeview_window *twin) -- cgit v1.2.3 From 61872ab3a493d60ede0e5ca2221b4c5c94708171 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 29 Nov 2012 22:44:30 +0000 Subject: Debug --- amiga/gui.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 93ee08282..7482b4b71 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -1206,6 +1206,7 @@ void ami_handle_msg(void) struct browser_window *closedbw; struct timeval curtime; static int drag_x_move = 0, drag_y_move = 0; + char *url; if(IsMinListEmpty(window_list)) { @@ -1601,11 +1602,13 @@ void ami_handle_msg(void) break; case GID_HOTLIST: - GetAttrs(gwin->objects[GID_HOTLIST], - SPEEDBAR_SelectedNode, &tabnode, TAG_DONE); - GetSpeedButtonNodeAttrs(tabnode, SBNA_UserData, (ULONG *)&storage, TAG_DONE); - - browser_window_go(gwin->bw, (char *)storage, NULL, true); + GetAttr(SPEEDBAR_SelectedNode, + (Object *)gwin->objects[GID_HOTLIST], + (ULONG *)&tabnode); + printf("%lx %d\n", tabnode, code); + GetSpeedButtonNodeAttrs(tabnode, SBNA_UserData, (ULONG *)&url, TAG_DONE); + printf("%s\n", url); + browser_window_go(gwin->bw, url, NULL, true); break; case GID_HOME: -- cgit v1.2.3 From ffcb07b8b2a4d5096d8bd794b1b34c5ffdfd5b17 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 1 Dec 2012 00:27:46 +0000 Subject: Make hotlist toolbar actually work --- amiga/gui.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 7482b4b71..92ad3542a 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -1601,16 +1601,6 @@ void ami_handle_msg(void) browser_window_go(gwin->bw,(char *)storage, NULL, true); break; - case GID_HOTLIST: - GetAttr(SPEEDBAR_SelectedNode, - (Object *)gwin->objects[GID_HOTLIST], - (ULONG *)&tabnode); - printf("%lx %d\n", tabnode, code); - GetSpeedButtonNodeAttrs(tabnode, SBNA_UserData, (ULONG *)&url, TAG_DONE); - printf("%s\n", url); - browser_window_go(gwin->bw, url, NULL, true); - break; - case GID_HOME: browser_window_go(gwin->bw,nsoption_charp(homepage_url),NULL,true); break; @@ -1644,6 +1634,7 @@ void ami_handle_msg(void) ami_gui_history(gwin, false); break; + case GID_HOTLIST: default: // printf("GADGET: %ld\n",(result & WMHI_GADGETMASK)); break; @@ -2506,6 +2497,7 @@ void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) SpeedBarObject, GA_ID, GID_HOTLIST, GA_RelVerify, TRUE, + ICA_TARGET, ICTARGET_IDCMP, SPEEDBAR_BevelStyle, BVS_NONE, SPEEDBAR_Buttons, &gwin->hotlist_toolbar_list, SpeedBarEnd; @@ -4283,6 +4275,8 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg struct gui_window_2 *gwin = hook->h_Data; struct IntuiWheelData *wheel; Object *reqrefresh = NULL; + struct Node *node = NULL; + char *url; switch(msg->Class) { @@ -4299,6 +4293,13 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg gwin->redraw_required = true; break; + + case GID_HOTLIST: + if(node = GetTagData(SPEEDBAR_SelectedNode, 0, msg->IAddress)) { + GetSpeedButtonNodeAttrs(node, SBNA_UserData, (ULONG *)&url, TAG_DONE); + browser_window_go(gwin->bw, url, NULL, true); + } + break; } break; -- cgit v1.2.3 From ee79de52446499e56ff6986af1c08d866fd670d5 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 1 Dec 2012 15:15:12 +0000 Subject: Attempt to do some re-layout if the toolbar is added after the window opens. --- amiga/gui.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 92ad3542a..6efa99ab4 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2517,6 +2517,11 @@ void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN], gwin->win, NULL, TRUE); + + if(gwin->win) { + gwin->redraw_required = true; + gwin->bw->reformat_pending = true; + } } } @@ -4295,7 +4300,7 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg break; case GID_HOTLIST: - if(node = GetTagData(SPEEDBAR_SelectedNode, 0, msg->IAddress)) { + if(node = (struct Node *)GetTagData(SPEEDBAR_SelectedNode, 0, msg->IAddress)) { GetSpeedButtonNodeAttrs(node, SBNA_UserData, (ULONG *)&url, TAG_DONE); browser_window_go(gwin->bw, url, NULL, true); } -- cgit v1.2.3 From c88c4fa214b3dd23b8f68fe35d9c8eb738d80976 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 1 Dec 2012 15:23:11 +0000 Subject: Don't need to attempt to free on remove, as the only entry point has already done this. --- amiga/gui.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 6efa99ab4..9fa83e1d1 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2563,8 +2563,6 @@ void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin) gwin->redraw_required = true; gwin->bw->reformat_pending = true; - - ami_gui_hotlist_toolbar_free(gwin, &gwin->hotlist_toolbar_list); } void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin) -- cgit v1.2.3 From 61723e01c1beed8591d877c92035b65c448f46df Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 5 Dec 2012 18:14:45 +0000 Subject: Avoid NULL pointer access --- amiga/gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 9fa83e1d1..c71afde71 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2518,7 +2518,7 @@ void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN], gwin->win, NULL, TRUE); - if(gwin->win) { + if(gwin->bw) { gwin->redraw_required = true; gwin->bw->reformat_pending = true; } -- cgit v1.2.3 From 40076ea422458fde1799fd383b475586ee112c3f Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 6 Dec 2012 23:40:13 +0000 Subject: Allow the size of the web search gadget to be user-set --- amiga/dist/NetSurf.guide | 1 + amiga/gui.c | 2 +- amiga/options.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide index f1536a233..8759b2b24 100755 --- a/amiga/dist/NetSurf.guide +++ b/amiga/dist/NetSurf.guide @@ -48,6 +48,7 @@ There are a couple of Amiga-specific options which can only be changed directly @{b}redraw_tile_size_x@{ub}/@{b}redraw_tile_size_y@{ub} Specify the size of the off-screen bitmap. Higher will speed up redraws at the expense of memory. 0 disables tiling (will use a bitmap at least the size of the screen NetSurf is running on) @{b}font_antialiasing@{ub} Switch text anti-aliasing on or off. Defaults to on in true-colour modes, but text rendering performance can be improved by setting to 0. @{b}window_simple_refresh@{ub} If set to 1, NetSurf will use SimpleRefresh rather than SmartRefresh windows. These have slower redraw but use less memory. Note that this setting has no noticeable effect if compositing is enabled. Defaults to 0 (SmartRefresh) +@{b}web_search_width@{ub} Defaults to 0. Larger values will increase the size of the web search gadget next to the URL bar. @{b}dithering_quality@{ub} Specify the dithering quality from all values supported by picture.datatype. Currently these are 0=None, 1=Normal, 2=High quality. Other values are undefined. This is only used when NetSurf is running in palette-mapped mode. @{b}mask_alpha@{ub} Threshold to use when determining which alpha values to convert to full transparency (0 - 255, where 255 will convert even opaque pixels to transparent). Defaults to 50 (0x32). This is only used in palette-mapped modes where alpha blending is not currently supported. diff --git a/amiga/gui.c b/amiga/gui.c index c71afde71..a1a9468f0 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3064,7 +3064,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, GA_HintInfo, g->shared->helphints[GID_SEARCHSTRING], StringEnd, LayoutEnd, - CHILD_WeightedWidth, 0, + CHILD_WeightedWidth, nsoption_int(web_search_width), LAYOUT_AddChild, g->shared->objects[GID_THROBBER] = SpaceObject, GA_ID,GID_THROBBER, SPACE_MinWidth,throbber_width, diff --git a/amiga/options.h b/amiga/options.h index 5e4777896..957f389ec 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -74,6 +74,7 @@ int cookies_window_ypos; \ int cookies_window_xsize; \ int cookies_window_ysize; \ + int web_search_width; \ int cairo_renderer; \ bool direct_render; \ bool window_simple_refresh; \ @@ -136,6 +137,7 @@ .cookies_window_ypos = 0, \ .cookies_window_xsize = 0, \ .cookies_window_ysize = 0, \ + .web_search_width = 0, \ .cairo_renderer = 0, \ .direct_render = false, \ .window_simple_refresh = false, \ @@ -197,6 +199,7 @@ { "cookies_window_ypos", OPTION_INTEGER, &nsoptions.cookies_window_ypos}, \ { "cookies_window_xsize", OPTION_INTEGER, &nsoptions.cookies_window_xsize}, \ { "cookies_window_ysize", OPTION_INTEGER, &nsoptions.cookies_window_ysize}, \ +{ "web_search_width", OPTION_INTEGER, &nsoptions.web_search_width}, \ { "cairo_renderer", OPTION_INTEGER, &nsoptions.cairo_renderer}, \ { "direct_render", OPTION_BOOL, &nsoptions.direct_render}, \ { "window_simple_refresh", OPTION_BOOL, &nsoptions.window_simple_refresh}, \ -- cgit v1.2.3 From 69647cc6a4f230fc0c1ce5481a30ac21c93db8d2 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 7 Dec 2012 23:35:57 +0000 Subject: Respond to Ctrl-C by immediately quitting. TCP/IP stack exit expects this. --- amiga/gui.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index a1a9468f0..47d75bcd0 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2108,11 +2108,12 @@ void ami_get_msg(void) ULONG winsignal = 1L << sport->mp_SigBit; ULONG appsig = 1L << appport->mp_SigBit; ULONG schedulesig = 1L << msgport->mp_SigBit; + ULONG ctrlcsig = SIGBREAKF_CTRL_C; ULONG signal; struct TimerRequest *timermsg = NULL; struct MsgPort *printmsgport = ami_print_get_msgport(); ULONG printsig = 1L << printmsgport->mp_SigBit; - ULONG signalmask = winsignal | appsig | schedulesig | rxsig | printsig | applibsig; + ULONG signalmask = winsignal | appsig | schedulesig | rxsig | printsig | applibsig | ctrlcsig; signal = Wait(signalmask); /* @@ -2144,6 +2145,11 @@ printf("sig recvd %ld (%ld %ld %ld %ld %ld %ld)\n", signal, winsignal , appsig , schedule_run(FALSE); } } + + if(signal & ctrlcsig) + { + ami_quit_netsurf(); + } } void gui_poll(bool active) -- cgit v1.2.3 From ff333828b70a5d31b9efe1c7b2df3216478722a3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 8 Dec 2012 17:47:57 +0000 Subject: Warn when closing multiple tabs --- amiga/download.c | 2 +- amiga/gui.c | 10 +++++++++- amiga/misc.c | 4 +++- amiga/misc.h | 2 +- amiga/options.h | 3 +++ resources/FatMessages | 5 +++++ 6 files changed, 22 insertions(+), 4 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/download.c b/amiga/download.c index 434d12ee8..224ac29db 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -390,7 +390,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title) BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size) { /* Return TRUE if file can be (over-)written */ - int res = 0; + int32 res = 0; BPTR lock = 0; BPTR fh = 0; int64 oldsize = 0; diff --git a/amiga/gui.c b/amiga/gui.c index 47d75bcd0..66aca159e 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3316,7 +3316,15 @@ void ami_close_all_tabs(struct gui_window_2 *gwin) { struct Node *tab; struct Node *ntab; - + + if((gwin->tabs > 1) && (nsoption_bool(tab_close_warn) == true)) { + char *req_body = ami_utf8_easy(messages_get("MultiTabClose")); + int32 res = ami_warn_user_multi(req_body, "No", "Yes", gwin->win); + free(req_body); + + if(res == 1) return; + } + if(gwin->tabs) { tab = GetHead(&gwin->tab_list); diff --git a/amiga/misc.c b/amiga/misc.c index b5da1787f..4359c79b5 100755 --- a/amiga/misc.c +++ b/amiga/misc.c @@ -71,7 +71,7 @@ void warn_user(const char *warning, const char *detail) if(utf8warning) free(utf8warning); } -int ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win) +int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win) { int res = 0; char *utf8text = ami_utf8_easy(body); @@ -90,6 +90,8 @@ int ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, st if(utf8text) free(utf8text); if(utf8gadgets) FreeVec(utf8gadgets); + + return res; } void die(const char *error) diff --git a/amiga/misc.h b/amiga/misc.h index e76d6a3b4..34a85fa90 100644 --- a/amiga/misc.h +++ b/amiga/misc.h @@ -19,5 +19,5 @@ #ifndef AMIGA_MISC_H #define AMIGA_MISC_H char *translate_escape_chars(const char *s); -int ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win); +int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win); #endif diff --git a/amiga/options.h b/amiga/options.h index 957f389ec..4b477b66c 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -39,6 +39,7 @@ bool use_openurl_lib; \ bool new_tab_active; \ bool new_tab_last; \ + bool tab_close_warn; \ bool kiosk_mode; \ char *search_engines_file; \ char *arexx_dir; \ @@ -102,6 +103,7 @@ .use_openurl_lib = false, \ .new_tab_active = false, \ .new_tab_last = false, \ + .tab_close_warn = true, \ .kiosk_mode = false, \ .search_engines_file = NULL, \ .arexx_dir = NULL, \ @@ -164,6 +166,7 @@ { "use_openurl_lib", OPTION_BOOL, &nsoptions.use_openurl_lib}, \ { "new_tab_is_active", OPTION_BOOL, &nsoptions.new_tab_active}, \ { "new_tab_last", OPTION_BOOL, &nsoptions.new_tab_last}, \ +{ "tab_close_warn", OPTION_BOOL, &nsoptions.tab_close_warn}, \ { "kiosk_mode", OPTION_BOOL, &nsoptions.kiosk_mode}, \ { "search_engines_file",OPTION_STRING, &nsoptions.search_engines_file }, \ { "arexx_dir", OPTION_STRING, &nsoptions.arexx_dir }, \ diff --git a/resources/FatMessages b/resources/FatMessages index e8f22aaf0..d7bda1a23 100644 --- a/resources/FatMessages +++ b/resources/FatMessages @@ -2675,6 +2675,11 @@ de.ami.CompError:Nicht zu öffnen fr.ami.CompError:Unable to open it.ami.CompError:Impossibile aprire nl.ami.CompError:Unable to open +en.ami.MultiTabClose:Are you sure you want to close multiple tabs? +de.ami.MultiTabClose:Are you sure you want to close multiple tabs? +fr.ami.MultiTabClose:Are you sure you want to close multiple tabs? +it.ami.MultiTabClose:Are you sure you want to close multiple tabs? +nl.ami.MultiTabClose:Are you sure you want to close multiple tabs? # Queries # ======= -- cgit v1.2.3 From dfa287767fee79f479b4cf0d8d69431febc5e934 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 8 Dec 2012 18:08:00 +0000 Subject: Warn the user and give them an option to stop NetSurf shutting down, if the TCP/IP stack has signalled that it is about to exit. --- amiga/gui.c | 27 ++++++++++++++++++++++++++- resources/FatMessages | 11 +++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 66aca159e..1d523e65b 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -177,6 +177,7 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys); ULONG ami_set_border_gadget_balance(struct gui_window_2 *gwin); ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2); void ami_try_quit(void); +void ami_quit_netsurf_delayed(void); Object *ami_gui_splash_open(void); void ami_gui_splash_close(Object *win_obj); static uint32 ami_set_search_ico_render_hook(struct Hook *hook, APTR space, @@ -2148,7 +2149,7 @@ printf("sig recvd %ld (%ld %ld %ld %ld %ld %ld)\n", signal, winsignal , appsig , if(signal & ctrlcsig) { - ami_quit_netsurf(); + ami_quit_netsurf_delayed(); } } @@ -2308,6 +2309,30 @@ void ami_quit_netsurf(void) } } +void ami_quit_netsurf_delayed(void) +{ + char *utf8text = ami_utf8_easy(messages_get("TCPIPShutdown")); + char *utf8gadgets = ami_utf8_easy(messages_get("AbortShutdown")); + + DisplayBeep(NULL); + + int32 res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_INFO, + TDR_TitleString, messages_get("NetSurf"), + TDR_FormatString, utf8text, + TDR_GadgetString, utf8gadgets, + TDR_Timeout, 5, + TDR_Inactive, TRUE, + TAG_DONE); + + free(utf8text); + free(utf8gadgets); + + if(res == -1) { /* Requester timed out */ + nsoption_set_bool(tab_close_warn, false); + ami_quit_netsurf(); + } +} + void ami_gui_close_screen(struct Screen *scrn) { if(scrn == NULL) return; diff --git a/resources/FatMessages b/resources/FatMessages index d7bda1a23..075a1e98f 100644 --- a/resources/FatMessages +++ b/resources/FatMessages @@ -2680,6 +2680,17 @@ de.ami.MultiTabClose:Are you sure you want to close multiple tabs? fr.ami.MultiTabClose:Are you sure you want to close multiple tabs? it.ami.MultiTabClose:Are you sure you want to close multiple tabs? nl.ami.MultiTabClose:Are you sure you want to close multiple tabs? +en.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit.\n\nNetSurf will quit in 5 seconds unless this shutdown is aborted. +de.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit.\n\nNetSurf will quit in 5 seconds unless this shutdown is aborted. +fr.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit.\n\nNetSurf will quit in 5 seconds unless this shutdown is aborted. +it.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit.\n\nNetSurf will quit in 5 seconds unless this shutdown is aborted. +nl.ami.TCPIPShutdown:The TCP/IP stack has signalled that it is about to shutdown and NetSurf must exit.\n\nNetSurf will quit in 5 seconds unless this shutdown is aborted. +en.ami.AbortShutdown:Abort shutdown +de.ami.AbortShutdown:Abort shutdown +fr.ami.AbortShutdown:Abort shutdown +it.ami.AbortShutdown:Abort shutdown +nl.ami.AbortShutdown:Abort shutdown + # Queries # ======= -- cgit v1.2.3 From 083cf492f59529192b1a683fa9064ee2c2300c48 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 18:52:07 +0000 Subject: Allow ctrl-click on hotlist toolbar to open in a new tab --- amiga/gui.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 1d523e65b..522f66aee 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -4339,7 +4339,13 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg case GID_HOTLIST: if(node = (struct Node *)GetTagData(SPEEDBAR_SelectedNode, 0, msg->IAddress)) { GetSpeedButtonNodeAttrs(node, SBNA_UserData, (ULONG *)&url, TAG_DONE); - browser_window_go(gwin->bw, url, NULL, true); + + ami_update_quals(gwin); + if(gwin->key_state & BROWSER_MOUSE_MOD_2) { + browser_window_create(url, gwin->bw, NULL, false, true); + } else { + browser_window_go(gwin->bw, url, NULL, true); + } } break; } -- cgit v1.2.3 From 6b7e67847643dc54ade072c83c5669d7093fb1a3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 19:39:48 +0000 Subject: Only bother with the delayed requester on OS4 --- amiga/gui.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 522f66aee..22a50fa6a 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2311,6 +2311,8 @@ void ami_quit_netsurf(void) void ami_quit_netsurf_delayed(void) { + int res = -1; +#ifdef __amigaos4__ char *utf8text = ami_utf8_easy(messages_get("TCPIPShutdown")); char *utf8gadgets = ami_utf8_easy(messages_get("AbortShutdown")); @@ -2326,7 +2328,7 @@ void ami_quit_netsurf_delayed(void) free(utf8text); free(utf8gadgets); - +#endif if(res == -1) { /* Requester timed out */ nsoption_set_bool(tab_close_warn, false); ami_quit_netsurf(); -- cgit v1.2.3 From 3ef843fcb420c94665981519dacdd8d8c03b8ed0 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 19:41:06 +0000 Subject: Switch Yes/No Replace/Don'tReplace so Esc operates the "don't do anything" operation as expected. --- amiga/download.c | 2 +- amiga/gui.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/download.c b/amiga/download.c index 224ac29db..4243e6ddc 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -416,7 +416,7 @@ BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG si overwritetext = ASPrintf(messages_get("OverwriteFile")); } - res = ami_warn_user_multi(overwritetext, "DontReplace", "Replace", win); + res = ami_warn_user_multi(overwritetext, "Replace", "DontReplace", win); FreeVec(overwritetext); } else return TRUE; diff --git a/amiga/gui.c b/amiga/gui.c index 22a50fa6a..c30489e27 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3346,7 +3346,7 @@ void ami_close_all_tabs(struct gui_window_2 *gwin) if((gwin->tabs > 1) && (nsoption_bool(tab_close_warn) == true)) { char *req_body = ami_utf8_easy(messages_get("MultiTabClose")); - int32 res = ami_warn_user_multi(req_body, "No", "Yes", gwin->win); + int32 res = ami_warn_user_multi(req_body, "Yes", "No", gwin->win); free(req_body); if(res == 1) return; -- cgit v1.2.3 From 388ddc6dbd11e28740538a4d39d04f086e16c0c0 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 20:00:11 +0000 Subject: non-working "always show tabbar" option --- amiga/gui.c | 11 +++++++---- amiga/options.h | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index c30489e27..e2728c270 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2318,7 +2318,7 @@ void ami_quit_netsurf_delayed(void) DisplayBeep(NULL); - int32 res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_INFO, + res = TimedDosRequesterTags(TDR_ImageType, TDRIMAGE_INFO, TDR_TitleString, messages_get("NetSurf"), TDR_FormatString, utf8text, TDR_GadgetString, utf8gadgets, @@ -2697,8 +2697,10 @@ void ami_toggletabbar(struct gui_window_2 *gwin, bool show) RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN], gwin->win, NULL, TRUE); - gwin->redraw_required = true; - gwin->bw->reformat_pending = true; + if(gwin->bw) { + gwin->redraw_required = true; + gwin->bw->reformat_pending = true; + } } struct gui_window *gui_create_browser_window(struct browser_window *bw, @@ -3264,6 +3266,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, g->shared->win, NULL); ami_gui_hotlist_toolbar_add(g->shared); /* is this the right place for this? */ + if(nsoption_bool(tab_always_show)) ami_toggletabbar(g->shared, true); } else { @@ -3425,7 +3428,7 @@ void gui_window_destroy(struct gui_window *g) g->shared->tabs--; ami_switch_tab(g->shared,true); - if(g->shared->tabs == 1) + if((g->shared->tabs == 1) && (nsoption_bool(tab_always_show))) ami_toggletabbar(g->shared, false); ami_utf8_free(g->tabtitle); diff --git a/amiga/options.h b/amiga/options.h index 4b477b66c..dc0274da2 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -40,6 +40,7 @@ bool new_tab_active; \ bool new_tab_last; \ bool tab_close_warn; \ + bool tab_always_show; \ bool kiosk_mode; \ char *search_engines_file; \ char *arexx_dir; \ @@ -104,6 +105,7 @@ .new_tab_active = false, \ .new_tab_last = false, \ .tab_close_warn = true, \ + .tab_always_show = false, \ .kiosk_mode = false, \ .search_engines_file = NULL, \ .arexx_dir = NULL, \ @@ -167,6 +169,7 @@ { "new_tab_is_active", OPTION_BOOL, &nsoptions.new_tab_active}, \ { "new_tab_last", OPTION_BOOL, &nsoptions.new_tab_last}, \ { "tab_close_warn", OPTION_BOOL, &nsoptions.tab_close_warn}, \ +{ "tab_always_show", OPTION_BOOL, &nsoptions.tab_always_show}, \ { "kiosk_mode", OPTION_BOOL, &nsoptions.kiosk_mode}, \ { "search_engines_file",OPTION_STRING, &nsoptions.search_engines_file }, \ { "arexx_dir", OPTION_STRING, &nsoptions.arexx_dir }, \ -- cgit v1.2.3 From 24e1aff974499e7e2cb0996a946a6a2d34fd851d Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 20:00:59 +0000 Subject: Reverse the logic as well as the req text --- amiga/download.c | 2 +- amiga/gui.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/download.c b/amiga/download.c index 4243e6ddc..c0c88bb0b 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -421,6 +421,6 @@ BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG si } else return TRUE; - if(res == 0) return TRUE; + if(res == 1) return TRUE; else return FALSE; } diff --git a/amiga/gui.c b/amiga/gui.c index e2728c270..bace20510 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3352,7 +3352,7 @@ void ami_close_all_tabs(struct gui_window_2 *gwin) int32 res = ami_warn_user_multi(req_body, "Yes", "No", gwin->win); free(req_body); - if(res == 1) return; + if(res == 0) return; } if(gwin->tabs) -- cgit v1.2.3 From 0c54f2a90260127f7a96b798afc08c691ddebadf Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 20:02:13 +0000 Subject: Prevent multiple tabbars --- amiga/gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index bace20510..06d8356c2 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2751,7 +2751,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, g->shared = clone->window->shared; g->tab = g->shared->next_tab; - if(g->shared->tabs == 1) + if((g->shared->tabs == 1) && (nsoption_bool(tab_always_show) == false)) ami_toggletabbar(g->shared, true); SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS], -- cgit v1.2.3 From 083b7c0233635959f1944c2150abbb923c5e0481 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 20:05:22 +0000 Subject: Enable persistent tab bar through tab_always_show option --- amiga/gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 06d8356c2..60d9d3127 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3428,7 +3428,7 @@ void gui_window_destroy(struct gui_window *g) g->shared->tabs--; ami_switch_tab(g->shared,true); - if((g->shared->tabs == 1) && (nsoption_bool(tab_always_show))) + if((g->shared->tabs == 1) && (nsoption_bool(tab_always_show) == false)) ami_toggletabbar(g->shared, false); ami_utf8_free(g->tabtitle); -- cgit v1.2.3 From 02a4bfd375110c268837931a8714fab0dc154d50 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 9 Dec 2012 20:39:10 +0000 Subject: Toggle the tab bar to the correct state if the option to always show it is changed and only one tab is currently open --- amiga/gui.c | 27 +++++++++++++++++++++++++++ amiga/gui.h | 1 + amiga/gui_options.c | 6 ++++++ 3 files changed, 34 insertions(+) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 60d9d3127..bd0715edb 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2703,6 +2703,33 @@ void ami_toggletabbar(struct gui_window_2 *gwin, bool show) } } +void ami_gui_tabs_toggle_all(void) +{ + struct nsObject *node; + struct nsObject *nnode; + struct gui_window_2 *gwin; + + if(IsMinListEmpty(window_list)) return; + + node = (struct nsObject *)GetHead((struct List *)window_list); + + do { + nnode=(struct nsObject *)GetSucc((struct Node *)node); + gwin = node->objstruct; + + if(node->Type == AMINS_WINDOW) + { + if(gwin->tabs == 1) { + if(nsoption_bool(tab_always_show) == true) { + ami_toggletabbar(gwin, true); + } else { + ami_toggletabbar(gwin, false); + } + } + } + } while(node = nnode); +} + struct gui_window *gui_create_browser_window(struct browser_window *bw, struct browser_window *clone, bool new_tab) { diff --git a/amiga/gui.h b/amiga/gui.h index 6a5434f87..1dff5d3c0 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -154,6 +154,7 @@ bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y); BOOL ami_gadget_hit(Object *obj, int x, int y); void ami_gui_history(struct gui_window_2 *gwin, bool back); void ami_gui_hotlist_toolbar_update_all(void); +void ami_gui_tabs_toggle_all(void); struct TextFont *origrpfont; struct MinList *window_list; diff --git a/amiga/gui_options.c b/amiga/gui_options.c index d4c119844..a84449eef 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -1450,6 +1450,7 @@ void ami_gui_opts_use(bool save) struct TextAttr *tattr; char *dot; bool rescan_fonts = false; + bool old_tab_always_show; SetWindowPointer(gow->win, WA_BusyPointer, TRUE, @@ -1689,12 +1690,17 @@ void ami_gui_opts_use(bool save) } GetAttr(GA_Selected,gow->objects[GID_OPTS_TAB_ALWAYS],(ULONG *)&data); + old_tab_always_show = nsoption_bool(tab_always_show); + if (data) { nsoption_set_bool(tab_always_show, true); } else { nsoption_set_bool(tab_always_show, false); } + if(old_tab_always_show != nsoption_bool(tab_always_show)) + ami_gui_tabs_toggle_all(); + GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_SEARCH_PROV],(ULONG *)&nsoption_int(search_provider)); search_web_provider_details(nsoption_int(search_provider)); search_web_retrieve_ico(false); -- cgit v1.2.3 From ec7389a18f8cbfd79ec98da5b30ea616573c9f34 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 10 Dec 2012 20:26:40 +0000 Subject: Update the current pressed qualifier keys at every RAWKEY event, as the update doesn't work during IDCMP_IDCMPUPDATE --- amiga/gui.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index bd0715edb..4a5056636 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -1643,8 +1643,9 @@ void ami_handle_msg(void) break; case WMHI_RAWKEY: + ami_update_quals(gwin); + storage = result & WMHI_GADGETMASK; - if(storage >= IECODE_UP_PREFIX) break; GetAttr(WINDOW_InputEvent,gwin->objects[OID_MAIN],(ULONG *)&ie); @@ -4372,7 +4373,6 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg if(node = (struct Node *)GetTagData(SPEEDBAR_SelectedNode, 0, msg->IAddress)) { GetSpeedButtonNodeAttrs(node, SBNA_UserData, (ULONG *)&url, TAG_DONE); - ami_update_quals(gwin); if(gwin->key_state & BROWSER_MOUSE_MOD_2) { browser_window_create(url, gwin->bw, NULL, false, true); } else { -- cgit v1.2.3 From 08cb5a09b2554e4eae7ffa692f540107fc07b5ec Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 15 Dec 2012 13:39:40 +0000 Subject: Work around a speedbar.gadget layout bug --- amiga/gui.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 4a5056636..d41d2510b 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2464,7 +2464,7 @@ void ami_update_buttons(struct gui_window_2 *gwin) } } -void ami_gui_hotlist_scan_2(struct tree *tree, struct node *root, WORD *gen, uint16 *item, +void ami_gui_hotlist_scan_2(struct tree *tree, struct node *root, WORD *gen, int *item, struct List *speed_button_list, struct gui_window_2 *gwin) { struct node *tempnode; @@ -2507,7 +2507,7 @@ int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, stru struct node *node; struct node_element *element; static WORD gen = 0; - static uint16 item = 0; + static int item = 0; for (node = root; node; node = tree_node_get_next(node)) { @@ -2524,6 +2524,13 @@ int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, stru void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) { + struct TagItem attrs[2]; + + attrs[0].ti_Tag = CHILD_MinWidth; + attrs[0].ti_Data = 0; + attrs[1].ti_Tag = TAG_DONE; + attrs[1].ti_Data = 0; + NewList(&gwin->hotlist_toolbar_list); if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) { @@ -2542,7 +2549,7 @@ void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) BevelEnd; IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDCHILD, - gwin->win, gwin->objects[GID_HOTLIST], NULL); + gwin->win, gwin->objects[GID_HOTLIST], attrs); IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_ADDIMAGE, gwin->win, gwin->objects[GID_HOTLISTSEPBAR], NULL); -- cgit v1.2.3 From ea5096fb8d8233f588145357220f8e3f72bf160e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 15 Dec 2012 13:43:05 +0000 Subject: These values shouldn't be declared static --- amiga/gui.c | 4 ++-- amiga/menu.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index d41d2510b..d92a5c25a 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2506,8 +2506,8 @@ int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_list, stru struct node *root = tree_node_get_child(tree_get_root(tree)); struct node *node; struct node_element *element; - static WORD gen = 0; - static int item = 0; + WORD gen = 0; + int item = 0; for (node = root; node; node = tree_node_get_next(node)) { diff --git a/amiga/menu.c b/amiga/menu.c index f42860612..a778fe7f0 100755 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -497,8 +497,8 @@ ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin) struct node *root = tree_node_get_child(tree_get_root(tree)); struct node *node; struct node_element *element; - static WORD gen = 0; - static ULONG item; + WORD gen = 0; + ULONG item; item = AMI_MENU_HOTLIST; -- cgit v1.2.3 From 8e416ec2265fda98de4b1ea027b1ff0998e20205 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 15 Dec 2012 15:39:09 +0000 Subject: Ensure the menu checked state remain in sync with reality --- amiga/gui.c | 26 ++++++++++++++++++++++++++ amiga/gui_options.c | 2 ++ amiga/menu.c | 5 +++-- amiga/menu.h | 2 ++ 4 files changed, 33 insertions(+), 2 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index d92a5c25a..e1fc19d7f 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -1191,6 +1191,27 @@ void ami_gui_trap_mouse(struct gui_window_2 *gwin) } } +void ami_gui_menu_update_all(void) +{ + struct nsObject *node; + struct nsObject *nnode; + struct gui_window_2 *gwin; + + if(IsMinListEmpty(window_list)) return; + + node = (struct nsObject *)GetHead((struct List *)window_list); + + do { + nnode=(struct nsObject *)GetSucc((struct Node *)node); + gwin = node->objstruct; + + if(node->Type == AMINS_WINDOW) + { + ami_menu_update_checked(gwin); + } + } while(node = nnode); +} + void ami_handle_msg(void) { struct IntuiMessage *message = NULL; @@ -1944,6 +1965,11 @@ void ami_handle_msg(void) ami_menu_window_close = NULL; } + + if(ami_menu_check_toggled) { + ami_gui_menu_update_all(); + ami_menu_check_toggled = false; + } } void ami_gui_appicon_remove(struct gui_window_2 *gwin) diff --git a/amiga/gui_options.c b/amiga/gui_options.c index 092bb4cb3..66e47d8ad 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -1861,6 +1861,8 @@ void ami_gui_opts_use(bool save) ami_font_savescanner(); /* just in case it has changed and been used only */ } + ami_menu_check_toggled = true; + SetWindowPointer(gow->win, WA_Pointer, NULL, TAG_DONE); diff --git a/amiga/menu.c b/amiga/menu.c index 76fa9e001..58a4d5115 100755 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -693,8 +693,6 @@ void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c) OffMenu(win,AMI_MENU_SAVEAS_IFF); } } - - ami_menu_update_checked(g->shared); } /* @@ -905,6 +903,7 @@ static void ami_menu_item_browser_foreimg(struct Hook *hook, APTR window, struct if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true; nsoption_set_bool(foreground_images, checked); + ami_menu_check_toggled = true; } static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct IntuiMessage *msg) @@ -916,6 +915,7 @@ static void ami_menu_item_browser_backimg(struct Hook *hook, APTR window, struct if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true; nsoption_set_bool(background_images, checked); + ami_menu_check_toggled = true; } static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struct IntuiMessage *msg) @@ -927,6 +927,7 @@ static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struc if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true; nsoption_set_bool(enable_javascript, checked); + ami_menu_check_toggled = true; } static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window, struct IntuiMessage *msg) diff --git a/amiga/menu.h b/amiga/menu.h index 58628ac48..8cff2d539 100755 --- a/amiga/menu.h +++ b/amiga/menu.h @@ -73,9 +73,11 @@ struct gui_window; struct gui_window_2; struct gui_window_2 *ami_menu_window_close; +bool ami_menu_check_toggled; void ami_free_menulabs(struct gui_window_2 *gwin); struct NewMenu *ami_create_menu(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, hlcache_handle *c); #endif -- cgit v1.2.3