Create menu on OS3 and 3 the same way (old GadTools method)
This makes it easier to switch to menuclass. It also fixes a crash-on-exit bug on OS3.
This commit is contained in:
commit
d1ccd3e53d
16
amiga/gui.c
16
amiga/gui.c
|
@ -3781,10 +3781,9 @@ gui_window_create(struct browser_window *bw,
|
|||
(locked_screen == TRUE) &&
|
||||
(strcmp(nsoption_charp(pubscreen_name), "Workbench") == 0))
|
||||
iconifygadget = TRUE;
|
||||
ami_create_menu(g->shared);
|
||||
#ifndef __amigaos4__
|
||||
struct Menu *menu = ami_menu_create_os3(g->shared, g->shared->menu);
|
||||
#endif
|
||||
|
||||
struct Menu *menu = ami_menu_create(g->shared);
|
||||
|
||||
NewList(&g->shared->tab_list);
|
||||
g->tab_node = AllocClickTabNode(TNA_Text,messages_get("NetSurf"),
|
||||
TNA_Number, 0,
|
||||
|
@ -3933,11 +3932,7 @@ gui_window_create(struct browser_window *bw,
|
|||
IDCMP_REFRESHWINDOW |
|
||||
IDCMP_ACTIVEWINDOW | IDCMP_EXTENDEDMOUSE,
|
||||
WINDOW_IconifyGadget, iconifygadget,
|
||||
#ifdef __amigaos4__
|
||||
WINDOW_NewMenu, g->shared->menu,
|
||||
#else
|
||||
WINDOW_MenuStrip, menu,
|
||||
#endif
|
||||
WINDOW_MenuUserData, WGUD_HOOK,
|
||||
WINDOW_NewPrefsHook, &newprefs_hook,
|
||||
WINDOW_IDCMPHook, &g->shared->scrollerhook,
|
||||
|
@ -4389,9 +4384,8 @@ static void gui_window_destroy(struct gui_window *g)
|
|||
DisposeObject((Object *)g->shared->history_ctxmenu[AMI_CTXMENU_HISTORY_FORWARD]);
|
||||
ami_ctxmenu_release_hook(g->shared->ctxmenu_hook);
|
||||
ami_free_menulabs(g->shared);
|
||||
#ifndef __amigaos4__
|
||||
ami_menu_free_os3(g->shared);
|
||||
#endif
|
||||
ami_menu_free(g->shared);
|
||||
|
||||
free(g->shared->wintitle);
|
||||
ami_utf8_free(g->shared->status);
|
||||
FreeVec(g->shared->svbuffer);
|
||||
|
|
|
@ -140,10 +140,8 @@ struct gui_window_2 {
|
|||
struct AppWindow *appwin;
|
||||
struct MinList shared_pens;
|
||||
gui_pointer_shape mouse_pointer;
|
||||
#ifndef __amigaos4__
|
||||
struct NewMenu *menu_os3;
|
||||
struct VisualInfo *vi;
|
||||
#endif
|
||||
struct Menu *imenu; /* Intuition menu */
|
||||
struct VisualInfo *vi; /* For GadTools menu */
|
||||
};
|
||||
|
||||
struct gui_window
|
||||
|
|
49
amiga/menu.c
49
amiga/menu.c
|
@ -704,29 +704,19 @@ static void ami_init_menulabs(struct gui_window_2 *gwin)
|
|||
/* Menu refresh for hotlist */
|
||||
void ami_menu_refresh(struct gui_window_2 *gwin)
|
||||
{
|
||||
struct Menu *menu;
|
||||
|
||||
SetAttrs(gwin->objects[OID_MAIN],
|
||||
#ifdef __amigaos4__
|
||||
WINDOW_NewMenu, NULL,
|
||||
#else
|
||||
WINDOW_MenuStrip, NULL,
|
||||
#endif
|
||||
TAG_DONE);
|
||||
|
||||
#ifndef __amigaos4__
|
||||
ami_menu_free_os3(gwin->menu_os3);
|
||||
#endif
|
||||
ami_menu_free(gwin);
|
||||
ami_free_menulabs(gwin);
|
||||
ami_create_menu(gwin);
|
||||
#ifndef __amigaos4__
|
||||
gwin->menu_os3 = ami_menu_create_os3(gwin, gwin->menu);
|
||||
#endif
|
||||
|
||||
menu = ami_menu_create(gwin);
|
||||
|
||||
SetAttrs(gwin->objects[OID_MAIN],
|
||||
#ifdef __amigaos4__
|
||||
WINDOW_NewMenu, gwin->menu,
|
||||
#else
|
||||
WINDOW_MenuStrip, gwin->menu_os3,
|
||||
#endif
|
||||
WINDOW_MenuStrip, menu,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
||||
|
@ -905,25 +895,13 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
|
|||
return gwin;
|
||||
}
|
||||
|
||||
#ifndef __amigaos4__
|
||||
void ami_menu_free_os3(struct gui_window_2 *gwin)
|
||||
void ami_menu_free(struct gui_window_2 *gwin)
|
||||
{
|
||||
FreeMenus(gwin->menu_os3);
|
||||
FreeMenus(gwin->imenu);
|
||||
FreeVisualInfo(gwin->vi);
|
||||
}
|
||||
|
||||
struct Menu *ami_menu_create_os3(struct gui_window_2 *gwin, struct NewMenu *newmenu)
|
||||
{
|
||||
gwin->vi = GetVisualInfo(scrn, TAG_DONE);
|
||||
gwin->menu_os3 = CreateMenus(newmenu, TAG_DONE);
|
||||
LayoutMenus(gwin->menu_os3, gwin->vi,
|
||||
GTMN_NewLookMenus, TRUE, TAG_DONE);
|
||||
|
||||
return gwin->menu_os3;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
|
||||
struct Menu *ami_menu_create(struct gui_window_2 *gwin)
|
||||
{
|
||||
gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
|
||||
ami_init_menulabs(gwin);
|
||||
|
@ -944,7 +922,14 @@ struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
|
|||
if(nsoption_bool(background_images) == true)
|
||||
gwin->menu[M_IMGBACK].nm_Flags |= CHECKED;
|
||||
|
||||
return(gwin->menu);
|
||||
gwin->vi = GetVisualInfo(scrn, TAG_DONE);
|
||||
gwin->imenu = CreateMenus(gwin->menu, TAG_DONE);
|
||||
LayoutMenus(gwin->imenu, gwin->vi,
|
||||
GTMN_NewLookMenus, TRUE, TAG_DONE);
|
||||
|
||||
/**\todo do we even need to store/keep gwin->menu? **/
|
||||
|
||||
return gwin->imenu;
|
||||
}
|
||||
|
||||
void ami_menu_arexx_scan(struct gui_window_2 *gwin)
|
||||
|
|
|
@ -137,15 +137,12 @@ 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);
|
||||
struct Menu *ami_menu_create(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);
|
||||
void ami_menu_free_glyphs(void);
|
||||
|
||||
#ifndef __amigaos4__
|
||||
void ami_menu_free_os3(struct gui_window_2 *gwin);
|
||||
struct Menu *ami_menu_create_os3(struct gui_window_2 *gwin, struct NewMenu *newmenu);
|
||||
#endif
|
||||
void ami_menu_free(struct gui_window_2 *gwin);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue