make gui_window_2 private to gui.c

This commit is contained in:
Chris Young 2019-05-08 17:48:50 +01:00
parent df5c18315f
commit 76618d9588
4 changed files with 82 additions and 82 deletions

View File

@ -193,6 +193,55 @@
extern struct gui_utf8_table *amiga_utf8_table;
struct gui_window_2 {
struct ami_generic_window w;
struct Window *win;
Object *restrict objects[GID_LAST];
struct gui_window *gw; /* currently-displayed gui_window */
bool redraw_required;
int throbber_frame;
struct List tab_list;
ULONG tabs;
ULONG next_tab;
struct Node *last_new_tab;
struct Hook scrollerhook;
browser_mouse_state mouse_state;
browser_mouse_state key_state;
ULONG throbber_update_count;
struct find_window *searchwin;
ULONG oldh;
ULONG oldv;
int temp;
bool redraw_scroll;
bool new_content;
struct ami_menu_data *menu_data[AMI_MENU_AREXX_MAX + 1]; /* only for GadTools menus */
ULONG hotlist_items;
Object *restrict hotlist_toolbar_lab[AMI_GUI_TOOLBAR_MAX];
struct List hotlist_toolbar_list;
struct List *web_search_list;
Object *search_bm;
char *restrict svbuffer;
char *restrict status;
char *restrict wintitle;
char *restrict helphints[GID_LAST];
browser_mouse_state prev_mouse_state;
struct timeval lastclick;
struct AppIcon *appicon; /* iconify appicon */
struct DiskObject *dobj; /* iconify appicon */
struct Hook favicon_hook;
struct Hook throbber_hook;
struct Hook *ctxmenu_hook;
Object *restrict history_ctxmenu[2];
Object *clicktab_ctxmenu;
gui_drag_type drag_op;
struct IBox *ptr_lock;
struct AppWindow *appwin;
struct MinList *shared_pens;
gui_pointer_shape mouse_pointer;
struct Menu *imenu; /* Intuition menu */
bool closed; /* Window has been closed (via menu) */
};
struct gui_window
{
struct gui_window_2 *shared;
@ -412,6 +461,10 @@ Object *ami_gui2_get_object(struct gui_window_2 *gwin, int object_type)
assert(gwin != NULL);
switch(object_type) {
case AMI_WIN_MAIN:
obj = OID_MAIN;
break;
case AMI_GAD_THROBBER:
obj = GID_THROBBER;
break;
@ -461,10 +514,16 @@ void ami_gui2_set_menu(struct gui_window_2 *gwin, struct Menu *menu)
if(menu != NULL) {
gwin->imenu = menu;
} else {
ami_gui_menu_freemenus(gwin->imenu);
ami_gui_menu_freemenus(gwin->imenu, gwin->menu_data);
}
}
struct ami_menu_data **ami_gui2_get_menu_data(struct gui_window_2 *gwin)
{
assert(gwin != NULL);
return gwin->menu_data;
}
struct form_control *ami_gui_get_control(struct gui_window *gw)
{
assert(gw != NULL);
@ -501,18 +560,6 @@ void ami_gui2_set_ctxmenu_history(struct gui_window_2 *gwin, ULONG direction, Ob
gwin->history_ctxmenu[direction] = ctx_hist;
}
Object *ami_gui2_get_ctxmenu_clicktab(struct gui_window_2 *gwin)
{
assert(gwin != NULL);
return gwin->clicktab_ctxmenu;
}
void ami_gui2_set_ctxmenu_clicktab(struct gui_window_2 *gwin, Object *ctx_tab)
{
assert(gwin != NULL);
gwin->clicktab_ctxmenu = ctx_tab;
}
void ami_gui2_set_closed(struct gui_window_2 *gwin, bool closed)
{
assert(gwin != NULL);

View File

@ -43,7 +43,8 @@ enum {
AMI_GAD_THROBBER = 0,
AMI_GAD_TABS,
AMI_GAD_URL,
AMI_GAD_SEARCH
AMI_GAD_SEARCH,
AMI_WIN_MAIN
};
enum
@ -113,54 +114,6 @@ struct ami_generic_window {
const struct ami_win_event_table *tbl;
};
struct gui_window_2 {
struct ami_generic_window w;
struct Window *win;
Object *restrict objects[GID_LAST];
struct gui_window *gw; /* currently-displayed gui_window */
bool redraw_required;
int throbber_frame;
struct List tab_list;
ULONG tabs;
ULONG next_tab;
struct Node *last_new_tab;
struct Hook scrollerhook;
browser_mouse_state mouse_state;
browser_mouse_state key_state;
ULONG throbber_update_count;
struct find_window *searchwin;
ULONG oldh;
ULONG oldv;
int temp;
bool redraw_scroll;
bool new_content;
struct ami_menu_data *menu_data[AMI_MENU_AREXX_MAX + 1]; /* only for GadTools menus */
ULONG hotlist_items;
Object *restrict hotlist_toolbar_lab[AMI_GUI_TOOLBAR_MAX];
struct List hotlist_toolbar_list;
struct List *web_search_list;
Object *search_bm;
char *restrict svbuffer;
char *restrict status;
char *restrict wintitle;
char *restrict helphints[GID_LAST];
browser_mouse_state prev_mouse_state;
struct timeval lastclick;
struct AppIcon *appicon; /* iconify appicon */
struct DiskObject *dobj; /* iconify appicon */
struct Hook favicon_hook;
struct Hook throbber_hook;
struct Hook *ctxmenu_hook;
Object *restrict history_ctxmenu[2];
Object *clicktab_ctxmenu;
gui_drag_type drag_op;
struct IBox *ptr_lock;
struct AppWindow *appwin;
struct MinList *shared_pens;
gui_pointer_shape mouse_pointer;
struct Menu *imenu; /* Intuition menu */
bool closed; /* Window has been closed (via menu) */
};
extern struct MinList *window_list; /**\todo stop arexx.c poking about in here */
extern struct Screen *scrn;
@ -380,10 +333,15 @@ struct Window *ami_gui2_get_window(struct gui_window_2 *gwin);
struct Menu *ami_gui_get_menu(struct gui_window *gw);
/**
* Set imenu to gui_window_2. A value of NULL will free the menu.
* Set imenu to gui_window_2. A value of NULL will free the menu (and menu_data!)
*/
void ami_gui2_set_menu(struct gui_window_2 *gwin, struct Menu *menu);
/**
* Get menu_data from gui_window_2
*/
struct ami_menu_data **ami_gui2_get_menu_data(struct gui_window_2 *gwin);
/**
* Get control (for select menu) from gui_window
*/
@ -414,16 +372,6 @@ Object *ami_gui2_get_ctxmenu_history(struct gui_window_2 *gwin, ULONG direction)
*/
void ami_gui2_set_ctxmenu_history(struct gui_window_2 *gwin, ULONG direction, Object *ctx_hist);
/**
* Get ctxmenu clicktab from gui_window_2
*/
Object *ami_gui2_get_ctxmenu_clicktab(struct gui_window_2 *gwin);
/**
* Set ctxmenu clicktab in gui_window_2
*/
void ami_gui2_set_ctxmenu_clicktab(struct gui_window_2 *gwin, Object *ctx_tab);
/**
* Set closed in gui_window_2
*/

View File

@ -681,7 +681,7 @@ void ami_gui_menu_update_checked(struct gui_window_2 *gwin)
struct Menu *menustrip;
GetAttr(WINDOW_MenuStrip, gwin->objects[OID_MAIN], (ULONG *)&menustrip);
GetAttr(WINDOW_MenuStrip, ami_gui2_get_object(gwin, AMI_WIN_MAIN), (ULONG *)&menustrip);
if(!menustrip) return;
if(nsoption_bool(enable_javascript) == true) {
if((ItemAddress(menustrip, ami_gui_menu_number(M_JS))->Flags & CHECKED) == 0)
@ -1050,11 +1050,12 @@ struct Menu *ami_gui_menu_create(struct gui_window_2 *gwin)
#endif
} else {
struct Menu *temp_menu;
struct ami_menu_data **md = ami_gui2_get_menu_data(gwin);
ami_init_menulabs(gwin->menu_data);
ami_menu_scan(gwin->menu_data);
ami_menu_arexx_scan(gwin->menu_data);
temp_menu = ami_menu_layout(gwin->menu_data, AMI_MENU_AREXX_MAX);
ami_init_menulabs(md);
ami_menu_scan(md);
ami_menu_arexx_scan(md);
temp_menu = ami_menu_layout(md, AMI_MENU_AREXX_MAX);
ami_gui2_set_menu(gwin, temp_menu);
return temp_menu;
}
@ -1094,11 +1095,15 @@ static void ami_free_menulabs(struct ami_menu_data **md)
}
}
void ami_gui_menu_freemenus(struct Menu *menu)
void ami_gui_menu_freemenus(struct Menu *menu, struct ami_menu_data **md)
{
if(menu != NULL) {
FreeMenus(menu);
}
if(md != NULL) {
ami_free_menulabs(md);
}
}
void ami_gui_menu_free(struct gui_window_2 *gwin)
@ -1107,7 +1112,7 @@ void ami_gui_menu_free(struct gui_window_2 *gwin)
#ifdef __amigaos4__
gui_menu_count--;
SetAttrs(gwin->objects[OID_MAIN], WINDOW_MenuStrip, NULL, TAG_DONE);
SetAttrs(ami_gui2_get_object(gwin, AMI_WIN_MAIN), WINDOW_MenuStrip, NULL, TAG_DONE);
if(gui_menu_count == 0) {
ami_free_menulabs(gui_menu_data);
@ -1117,7 +1122,6 @@ void ami_gui_menu_free(struct gui_window_2 *gwin)
}
#endif
} else {
ami_free_menulabs(gwin->menu_data);
ami_gui2_set_menu(gwin, NULL);
}
}

View File

@ -109,6 +109,7 @@ struct gui_window;
struct gui_window_2;
struct hlcache_handle;
struct Window;
struct ami_menu_data;
ULONG ami_gui_menu_number(int item);
struct Menu *ami_gui_menu_create(struct gui_window_2 *gwin);
@ -158,6 +159,6 @@ bool ami_gui_menu_quit_selected(void);
/**
* Frees a menu. Only used on OS3 and old OS4.
*/
void ami_gui_menu_freemenus(struct Menu *menu);
void ami_gui_menu_freemenus(struct Menu *menu, struct ami_menu_data **md);
#endif