Make gui_window private to gui.c

TODO: ratonalise these accessors
This commit is contained in:
Chris Young 2019-05-07 21:45:40 +01:00
parent b330fd9f0e
commit 5c7b5476f0
18 changed files with 315 additions and 193 deletions

View File

@ -226,7 +226,7 @@ static int ami_find_tab_bw(struct gui_window_2 *gwin, struct browser_window *bw)
GetClickTabNodeAttrs(ctab,
TNA_UserData, &tgw,
TAG_DONE);
if(tgw->bw == bw) return tabs;
if(ami_gui_get_browser_window(tgw) == bw) return tabs;
} while((ctab=ntab));
return 0;
@ -281,8 +281,8 @@ RXHOOKF(rx_open)
dln->filename = strdup((char *)cmd->ac_ArgList[3]);
dln->node.ln_Name = strdup((char *)cmd->ac_ArgList[0]);
dln->node.ln_Type = NT_USER;
AddTail(&gw->dllist, (struct Node *)dln);
browser_window_navigate(gw->bw,
AddTail(ami_gui_get_download_list(gw), (struct Node *)dln);
browser_window_navigate(ami_gui_get_browser_window(gw),
url,
NULL,
BW_NAVIGATE_DOWNLOAD,
@ -303,11 +303,11 @@ RXHOOKF(rx_open)
BW_CREATE_TAB,
url,
NULL,
gw->bw,
ami_gui_get_browser_window(gw),
NULL);
if(cmd->ac_ArgList[6]) {
ami_gui_switch_to_new_tab(gw->shared);
ami_gui_switch_to_new_tab(ami_gui_get_gui_window_2(gw));
}
}
}
@ -323,7 +323,7 @@ RXHOOKF(rx_open)
{
if(gw)
{
browser_window_navigate(gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gw),
url,
NULL,
BW_NAVIGATE_HISTORY,
@ -355,23 +355,23 @@ RXHOOKF(rx_save)
if(!gw) return;
ami_set_pointer(gw->shared, GUI_POINTER_WAIT, false);
ami_set_pointer(ami_gui_get_gui_window_2(gw), GUI_POINTER_WAIT, false);
if((fh = FOpen((char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0)))
{
const uint8_t *source_data;
size_t source_size;
struct hlcache_handle *h = browser_window_get_content(gw->bw);
struct hlcache_handle *h = browser_window_get_content(ami_gui_get_browser_window(gw));
source_data = content_get_source_data(h, &source_size);
if (source_data != NULL) {
FWrite(fh, source_data, 1, source_size);
}
FClose(fh);
SetComment((char *)cmd->ac_ArgList[0], nsurl_access(browser_window_access_url(gw->bw)));
SetComment((char *)cmd->ac_ArgList[0], nsurl_access(browser_window_access_url(ami_gui_get_browser_window(gw))));
}
ami_reset_pointer(gw->shared);
ami_reset_pointer(ami_gui_get_gui_window_2(gw));
}
RXHOOKF(rx_quit)
@ -395,9 +395,9 @@ RXHOOKF(rx_geturl)
if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
if(gw && gw->bw)
if(gw && ami_gui_get_browser_window(gw))
{
strcpy(result, nsurl_access(browser_window_access_url(gw->bw)));
strcpy(result, nsurl_access(browser_window_access_url(ami_gui_get_browser_window(gw))));
}
else
{
@ -418,10 +418,10 @@ RXHOOKF(rx_gettitle)
if(gw)
{
if(gw->shared->tabs > 1)
strcpy(result, gw->tabtitle);
if(ami_gui_get_gui_window_2(gw)->tabs > 1)
strcpy(result, ami_gui_get_tab_title(gw));
else
strcpy(result, gw->shared->wintitle);
strcpy(result, ami_gui_get_gui_window_2(gw)->wintitle);
}
else
{
@ -522,7 +522,7 @@ RXHOOKF(rx_back)
if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
if(gw) ami_gui_history(gw->shared, true);
if(gw) ami_gui_history(ami_gui_get_gui_window_2(gw), true);
}
RXHOOKF(rx_forward)
@ -534,7 +534,7 @@ RXHOOKF(rx_forward)
if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
if(gw) ami_gui_history(gw->shared, false);
if(gw) ami_gui_history(ami_gui_get_gui_window_2(gw), false);
}
@ -553,7 +553,7 @@ RXHOOKF(rx_home)
if (nsurl_create(nsoption_charp(homepage_url), &url) != NSERROR_OK) {
amiga_warn_user("NoMemory", 0);
} else {
browser_window_navigate(gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gw),
url,
NULL,
BW_NAVIGATE_HISTORY,
@ -577,11 +577,11 @@ RXHOOKF(rx_reload)
{
if(cmd->ac_ArgList[0]) /* FORCE */
{
browser_window_reload(gw->bw, true);
browser_window_reload(ami_gui_get_browser_window(gw), true);
}
else
{
browser_window_reload(gw->bw, false);
browser_window_reload(ami_gui_get_browser_window(gw), false);
}
}
}
@ -636,7 +636,7 @@ RXHOOKF(rx_active)
if(cmd->ac_ArgList[0])
{
tab = ami_find_tab_bw(gwin, gw->bw);
tab = ami_find_tab_bw(gwin, ami_gui_get_browser_window(gw));
}
if(cmd->ac_ArgList[0]) sprintf(result, "%d", tab);
@ -654,11 +654,11 @@ RXHOOKF(rx_close)
gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
else if(cmd->ac_ArgList[0])
{
ami_gui_close_window(gw->shared);
ami_gui_close_window(ami_gui_get_gui_window_2(gw));
return;
}
if(gw) browser_window_destroy(gw->bw);
if(gw) browser_window_destroy(ami_gui_get_browser_window(gw));
}
RXHOOKF(rx_hotlist)

View File

@ -86,14 +86,14 @@ void ami_clipboard_free(void)
void gui_start_selection(struct gui_window *g)
{
if(!g) return;
if(!g->shared->win) return;
if(!ami_gui_get_gui_window_2(g)->win) return;
if(nsoption_bool(kiosk_mode) == true) return;
ami_gui_menu_set_disabled(g->shared->win, g->shared->imenu, M_COPY, false);
ami_gui_menu_set_disabled(g->shared->win, g->shared->imenu, M_CLEAR, false);
ami_gui_menu_set_disabled(ami_gui_get_gui_window_2(g)->win, ami_gui_get_gui_window_2(g)->imenu, M_COPY, false);
ami_gui_menu_set_disabled(ami_gui_get_gui_window_2(g)->win, ami_gui_get_gui_window_2(g)->imenu, M_CLEAR, false);
if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_CUT)
ami_gui_menu_set_disabled(g->shared->win, g->shared->imenu, M_CUT, false);
if (browser_window_get_editor_flags(ami_gui_get_browser_window(g)) & BW_EDITOR_CAN_CUT)
ami_gui_menu_set_disabled(ami_gui_get_gui_window_2(g)->win, ami_gui_get_gui_window_2(g)->imenu, M_CUT, false);
}
static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size_t *text_length)
@ -287,9 +287,9 @@ void ami_drag_selection(struct gui_window *g)
{
iffh = ami_clipboard_init_internal(1);
browser_window_key_press(g->bw, NS_KEY_COPY_SELECTION);
browser_window_mouse_click(gwin->gw->bw, BROWSER_MOUSE_PRESS_1, x, y);
browser_window_key_press(gwin->gw->bw, NS_KEY_PASTE);
browser_window_key_press(ami_gui_get_browser_window(g), NS_KEY_COPY_SELECTION);
browser_window_mouse_click(ami_gui_get_browser_window(gwin->gw), BROWSER_MOUSE_PRESS_1, x, y);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_PASTE);
ami_clipboard_free_internal(iffh);
iffh = old_iffh;
@ -301,7 +301,7 @@ void ami_drag_selection(struct gui_window *g)
if(ami_gadget_hit(gwin->objects[GID_URL], x, y))
{
if((sel = browser_window_get_selection(g->bw)))
if((sel = browser_window_get_selection(ami_gui_get_browser_window(g))))
{
utf8text = ami_utf8_easy(sel);
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL],
@ -312,7 +312,7 @@ void ami_drag_selection(struct gui_window *g)
}
else if(ami_gadget_hit(gwin->objects[GID_SEARCHSTRING], x, y))
{
if((sel = browser_window_get_selection(g->bw)))
if((sel = browser_window_get_selection(ami_gui_get_browser_window(g))))
{
utf8text = ami_utf8_easy(sel);
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCHSTRING],

View File

@ -107,8 +107,8 @@ HOOKF(void, ami_ctxmenu_item_selcopy, APTR, window, struct IntuiMessage *)
{
struct gui_window_2 *gwin = (struct gui_window_2 *)hook->h_Data;
browser_window_key_press(gwin->gw->bw, NS_KEY_COPY_SELECTION);
browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_COPY_SELECTION);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_CLEAR_SELECTION);
}
HOOKF(void, ami_ctxmenu_item_websearch, APTR, window, struct IntuiMessage *)
@ -117,11 +117,11 @@ HOOKF(void, ami_ctxmenu_item_websearch, APTR, window, struct IntuiMessage *)
nsurl *url;
struct gui_window_2 *gwin = (struct gui_window_2 *)hook->h_Data;
char *sel = browser_window_get_selection(gwin->gw->bw);
char *sel = browser_window_get_selection(ami_gui_get_browser_window(gwin->gw));
ret = search_web_omni(sel, SEARCH_WEB_OMNI_SEARCHONLY, &url);
if (ret == NSERROR_OK) {
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
url,
NULL,
BW_NAVIGATE_HISTORY,
@ -146,8 +146,8 @@ HOOKF(void, ami_ctxmenu_item_urlopentab, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
nserror error = browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY | BW_CREATE_TAB,
url,
browser_window_access_url(gwin->gw->bw),
gwin->gw->bw,
browser_window_access_url(ami_gui_get_browser_window(gwin->gw)),
ami_gui_get_browser_window(gwin->gw),
&bw);
if (error != NSERROR_OK)
@ -163,8 +163,8 @@ HOOKF(void, ami_ctxmenu_item_urlopenwin, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
nserror error = browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY,
url,
browser_window_access_url(gwin->gw->bw),
gwin->gw->bw,
browser_window_access_url(ami_gui_get_browser_window(gwin->gw)),
ami_gui_get_browser_window(gwin->gw),
&bw);
if (error != NSERROR_OK)
@ -178,9 +178,9 @@ HOOKF(void, ami_ctxmenu_item_urldownload, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
url,
browser_window_access_url(gwin->gw->bw),
browser_window_access_url(ami_gui_get_browser_window(gwin->gw)),
BW_NAVIGATE_DOWNLOAD,
NULL,
NULL,
@ -198,9 +198,9 @@ HOOKF(void, ami_ctxmenu_item_objshow, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
hlcache_handle_get_url(hook->h_Data),
browser_window_access_url(gwin->gw->bw),
browser_window_access_url(ami_gui_get_browser_window(gwin->gw)),
BW_NAVIGATE_HISTORY,
NULL,
NULL,
@ -238,9 +238,9 @@ HOOKF(void, ami_ctxmenu_item_frameshow, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
hlcache_handle_get_url(hook->h_Data),
browser_window_access_url(gwin->gw->bw),
browser_window_access_url(ami_gui_get_browser_window(gwin->gw)),
BW_NAVIGATE_HISTORY,
NULL,
NULL,
@ -271,7 +271,8 @@ HOOKF(void, ami_ctxmenu_item_history, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_history_go(gwin->gw->bw, (struct history_entry *)hook->h_Data, false);
browser_window_history_go(ami_gui_get_browser_window(gwin->gw),
(struct history_entry *)hook->h_Data, false);
}
@ -300,7 +301,7 @@ static uint32 ami_ctxmenu_hook_func(struct Hook *hook, struct Window *window, st
Object *root_menu;
bool ctxmenu_has_content = false;
struct gui_window_2 *gwin = hook->h_Data;
struct hlcache_handle *cc = browser_window_get_content(gwin->gw->bw);
struct hlcache_handle *cc = browser_window_get_content(ami_gui_get_browser_window(gwin->gw));
struct browser_window_features ccdata;
int mx = window->MouseX;
int my = window->MouseY;
@ -328,11 +329,11 @@ static uint32 ami_ctxmenu_hook_func(struct Hook *hook, struct Window *window, st
return 0;
}
browser_window_get_features(gwin->gw->bw, x, y, &ccdata);
browser_window_get_features(ami_gui_get_browser_window(gwin->gw), x, y, &ccdata);
if((browser_window_can_select(gwin->gw->bw)) &&
((browser_window_get_editor_flags(gwin->gw->bw) & BW_EDITOR_CAN_COPY)) &&
(sel = browser_window_get_selection(gwin->gw->bw))) {
if((browser_window_can_select(ami_gui_get_browser_window(gwin->gw))) &&
((browser_window_get_editor_flags(ami_gui_get_browser_window(gwin->gw)) & BW_EDITOR_CAN_COPY)) &&
(sel = browser_window_get_selection(ami_gui_get_browser_window(gwin->gw)))) {
ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_SELCOPY, gwin);
ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_WEBSEARCH, gwin);
@ -567,9 +568,9 @@ struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin
gwin->temp = 0;
if(direction == AMI_CTXMENU_HISTORY_BACK) {
browser_window_history_enumerate_back(gwin->gw->bw, ami_ctxmenu_history_back, gwin);
browser_window_history_enumerate_back(ami_gui_get_browser_window(gwin->gw), ami_ctxmenu_history_back, gwin);
} else {
browser_window_history_enumerate_forward(gwin->gw->bw, ami_ctxmenu_history_forward, gwin);
browser_window_history_enumerate_forward(ami_gui_get_browser_window(gwin->gw), ami_ctxmenu_history_forward, gwin);
}
}

View File

@ -132,8 +132,8 @@ static struct gui_download_window *gui_download_window_create(download_context *
dw = calloc(1, sizeof(struct gui_download_window));
if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
{
if(gui && (!IsListEmpty(ami_gui_get_download_list(gui)) &&
(dw->dln = (struct dlnode *)FindName(ami_gui_get_download_list(gui), url)))) {
strcpy(dw->fname, dw->dln->filename);
free(dw->dln->node.ln_Name);
dw->dln->node.ln_Name = NULL;
@ -141,7 +141,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
else
{
if(AslRequestTags(savereq,
ASLFR_Window, gui->shared->win,
ASLFR_Window, ami_gui_get_gui_window_2(gui)->win,
ASLFR_SleepWindow, TRUE,
ASLFR_TitleText, messages_get("NetSurf"),
ASLFR_Screen, scrn,
@ -150,7 +150,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
{
strlcpy(dw->fname, savereq->fr_Drawer, 1024);
AddPart((STRPTR)&dw->fname,savereq->fr_File,1024);
if(!ami_download_check_overwrite(dw->fname, gui->shared->win, total_size))
if(!ami_download_check_overwrite(dw->fname, ami_gui_get_gui_window_2(gui)->win, total_size))
{
free(dw);
return NULL;
@ -166,7 +166,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
if(dl_filename) ami_utf8_free(dl_filename);
dw->size = total_size;
dw->downloaded = 0;
if(gui) dw->bw = gui->bw;
if(gui) dw->bw = ami_gui_get_browser_window(gui);
dw->url = url;
va[0] = (APTR)dw->downloaded;
@ -434,7 +434,7 @@ gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
linkname = ASPrintf("Link_to_%s",FilePart(nsurl_access(url)));
if(AslRequestTags(savereq,
ASLFR_Window, g->shared->win,
ASLFR_Window, ami_gui_get_gui_window_2(g)->win,
ASLFR_SleepWindow, TRUE,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
@ -444,9 +444,9 @@ gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
strlcpy(fname, savereq->fr_Drawer, 1024);
AddPart(fname,savereq->fr_File,1024);
ami_set_pointer(g->shared, GUI_POINTER_WAIT, false);
ami_set_pointer(ami_gui_get_gui_window_2(g), GUI_POINTER_WAIT, false);
if(ami_download_check_overwrite(fname, g->shared->win, 0))
if(ami_download_check_overwrite(fname, ami_gui_get_gui_window_2(g)->win, 0))
{
BPTR fh;
@ -473,7 +473,7 @@ gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
}
FreeVec(linkname);
}
ami_reset_pointer(g->shared);
ami_reset_pointer(ami_gui_get_gui_window_2(g));
}
return NSERROR_OK;
}

View File

@ -89,7 +89,7 @@ void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c,
break;
}
ami_drag_icon_show(g->shared->win, filetype);
ami_drag_icon_show(ami_gui_get_gui_window_2(g)->win, filetype);
drag_save_data = c;
drag_save_gui = g;
@ -98,7 +98,7 @@ void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c,
void gui_drag_save_selection(struct gui_window *g, const char *selection)
{
ami_drag_icon_show(g->shared->win, "ascii");
ami_drag_icon_show(ami_gui_get_gui_window_2(g)->win, "ascii");
ami_autoscroll = true;
drag_save_data = g;
@ -166,7 +166,7 @@ void ami_drag_save(struct Window *win)
case GUI_SAVE_TEXT_SELECTION: // selection
AddPart(path,"netsurf_text_selection",1024);
struct gui_window *g = (struct gui_window *) drag_save_data;
ami_file_save(AMINS_SAVE_SELECTION, path, win, NULL, NULL, g->bw);
ami_file_save(AMINS_SAVE_SELECTION, path, win, NULL, NULL, ami_gui_get_browser_window(g));
break;
case GUI_SAVE_COMPLETE:
@ -174,7 +174,7 @@ void ami_drag_save(struct Window *win)
struct hlcache_handle *c = drag_save_data;
AddPart(path, content_get_title(c), 1024);
ami_file_save(AMINS_SAVE_COMPLETE, path, win, c, drag_save_gui->favicon, NULL);
ami_file_save(AMINS_SAVE_COMPLETE, path, win, c, ami_gui_get_favicon(drag_save_gui), NULL);
}
break;

View File

@ -100,7 +100,7 @@ void ami_file_open(struct gui_window_2 *gwin)
if (netsurf_path_to_nsurl(temp, &url) != NSERROR_OK) {
amiga_warn_user("NoMemory", 0);
} else {
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
url,
NULL,
BW_NAVIGATE_HISTORY,
@ -267,7 +267,8 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
strlcpy(fname, savereq->fr_Drawer, 1024);
AddPart(fname, savereq->fr_File, 1024);
ami_file_save(type, fname, gwin->win, object, gwin->gw->favicon, gwin->gw->bw);
ami_file_save(type, fname, gwin->win, object,
ami_gui_get_favicon(gwin->gw), ami_gui_get_browser_window(gwin->gw));
}
if(fname) free(fname);

View File

@ -193,6 +193,29 @@
extern struct gui_utf8_table *amiga_utf8_table;
struct gui_window
{
struct gui_window_2 *shared;
int tab;
struct Node *tab_node;
int c_x; /* Caret X posn */
int c_y; /* Caret Y posn */
int c_w; /* Caret width */
int c_h; /* Caret height */
int c_h_temp;
int scrollx;
int scrolly;
struct ami_history_local_window *hw;
struct List dllist;
struct hlcache_handle *favicon;
bool throbbing;
char *tabtitle;
APTR deferred_rects_pool;
struct MinList *deferred_rects;
struct browser_window *bw;
float scale;
};
struct ami_gui_tb_userdata {
struct List *sblist;
struct gui_window_2 *gw;
@ -265,6 +288,66 @@ static void gui_window_place_caret(struct gui_window *g, int x, int y, int heigh
nsoptions[NSOPTION_##OPTION].value.i = VALUE; \
nsoptions_default[NSOPTION_##OPTION].value.i = VALUE
/* Function documented in gui.h */
struct browser_window *ami_gui_get_browser_window(struct gui_window *gw)
{
assert(gw != NULL);
return gw->bw;
}
struct List *ami_gui_get_download_list(struct gui_window *gw)
{
assert(gw != NULL);
return &gw->dllist;
}
struct gui_window_2 *ami_gui_get_gui_window_2(struct gui_window *gw)
{
assert(gw != NULL);
return gw->shared;
}
const char *ami_gui_get_tab_title(struct gui_window *gw)
{
assert(gw != NULL);
return (const char *)gw->tabtitle;
}
struct Node *ami_gui_get_tab_node(struct gui_window *gw)
{
assert(gw != NULL);
return gw->tab_node;
}
struct hlcache_handle *ami_gui_get_favicon(struct gui_window *gw)
{
assert(gw != NULL);
return gw->favicon;
}
struct ami_history_local_window *ami_gui_get_history_window(struct gui_window *gw)
{
assert(gw != NULL);
return gw->hw;
}
void ami_gui_set_history_window(struct gui_window *gw, struct ami_history_local_window *hw)
{
assert(gw != NULL);
gw->hw = hw;
}
bool ami_gui_get_throbbing(struct gui_window *gw)
{
assert(gw != NULL);
return gw->throbbing;
}
void ami_gui_set_throbbing(struct gui_window *gw, bool throbbing)
{
assert(gw != NULL);
gw->throbbing = throbbing;
}
STRPTR ami_locale_langs(int *codeset)
@ -2484,11 +2567,11 @@ static BOOL ami_gui_event(void *w)
break;
case RAWKEY_F9: // decrease scale
ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
ami_gui_adjust_scale(gwin->gw, -0.1);
break;
case RAWKEY_F10: // increase scale
ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
ami_gui_adjust_scale(gwin->gw, +0.1);
break;
case RAWKEY_HELP: // help
@ -3513,6 +3596,11 @@ void ami_gui_set_scale(struct gui_window *gw, float scale)
browser_window_set_scale(gw->bw, scale, true);
}
void ami_gui_adjust_scale(struct gui_window *gw, float adjustment)
{
ami_gui_set_scale(gw, gw->scale + adjustment);
}
void ami_gui_switch_to_new_tab(struct gui_window_2 *gwin)
{
if(nsoption_bool(new_tab_is_active) == true) return;

View File

@ -152,29 +152,6 @@ struct gui_window_2 {
bool closed; /* Window has been closed (via menu) */
};
struct gui_window
{
struct gui_window_2 *shared;
int tab;
struct Node *tab_node;
int c_x; /* Caret X posn */
int c_y; /* Caret Y posn */
int c_w; /* Caret width */
int c_h; /* Caret height */
int c_h_temp;
int scrollx;
int scrolly;
struct ami_history_local_window *hw;
struct List dllist;
struct hlcache_handle *favicon;
bool throbbing;
char *tabtitle;
APTR deferred_rects_pool;
struct MinList *deferred_rects;
struct browser_window *bw;
float scale;
};
extern struct MinList *window_list; /**\todo stop arexx.c poking about in here */
extern struct Screen *scrn;
extern struct MsgPort *sport;
@ -274,5 +251,60 @@ int ami_gui_get_quals(Object *win_obj);
bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects,
const struct rect *restrict new_rect, APTR mempool);
/**
* Adjust scale by specified amount
*/
void ami_gui_adjust_scale(struct gui_window *gw, float adjustment);
/**
* Get browser window from gui_window
*/
struct browser_window *ami_gui_get_browser_window(struct gui_window *gw);
/**
* Get gui_window_2 from gui_window
*/
struct gui_window_2 *ami_gui_get_gui_window_2(struct gui_window *gw);
/**
* Get download list from gui_window
*/
struct List *ami_gui_get_download_list(struct gui_window *gw);
/**
* Get tab title from gui_window
*/
const char *ami_gui_get_tab_title(struct gui_window *gw);
/**
* Get tab node from gui_window
*/
struct Node *ami_gui_get_tab_node(struct gui_window *gw);
/**
* Get favicon from gui_window
*/
struct hlcache_handle *ami_gui_get_favicon(struct gui_window *gw);
/**
* Get local history window from gui_window
*/
struct ami_history_local_window *ami_gui_get_history_window(struct gui_window *gw);
/**
* Set local history window in gui_window
*/
void ami_gui_set_history_window(struct gui_window *gw, struct ami_history_local_window *hw);
/**
* Get throbbing status from gui_window
*/
bool ami_gui_get_throbbing(struct gui_window *gw);
/**
* Set throbbing status in gui_window
*/
void ami_gui_set_throbbing(struct gui_window *gw, bool throbbing);
#endif

View File

@ -141,7 +141,7 @@ HOOKF(void, ami_menu_item_project_save, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
ami_file_save_req(type, gwin, browser_window_get_content(gwin->gw->bw));
ami_file_save_req(type, gwin, browser_window_get_content(ami_gui_get_browser_window(gwin->gw)));
}
HOOKF(void, ami_menu_item_project_closetab, APTR, window, struct IntuiMessage *)
@ -149,7 +149,7 @@ HOOKF(void, ami_menu_item_project_closetab, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_destroy(gwin->gw->bw);
browser_window_destroy(ami_gui_get_browser_window(gwin->gw));
}
HOOKF(void, ami_menu_item_project_closewin, APTR, window, struct IntuiMessage *)
@ -166,7 +166,7 @@ HOOKF(void, ami_menu_item_project_print, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
ami_print_ui(browser_window_get_content(gwin->gw->bw));
ami_print_ui(browser_window_get_content(ami_gui_get_browser_window(gwin->gw)));
ami_reset_pointer(gwin);
}
@ -243,7 +243,7 @@ HOOKF(void, ami_menu_item_edit_cut, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_key_press(gwin->gw->bw, NS_KEY_CUT_SELECTION);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_CUT_SELECTION);
}
HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
@ -252,22 +252,22 @@ HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
if(browser_window_can_select(gwin->gw->bw)) {
browser_window_key_press(gwin->gw->bw, NS_KEY_COPY_SELECTION);
browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
if(browser_window_can_select(ami_gui_get_browser_window(gwin->gw))) {
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_COPY_SELECTION);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_CLEAR_SELECTION);
}
else if((bm = content_get_bitmap(browser_window_get_content(gwin->gw->bw)))) {
else if((bm = content_get_bitmap(browser_window_get_content(ami_gui_get_browser_window(gwin->gw))))) {
/** @todo It should be checked that the lifetime of
* the objects containing the values returned (and the
* constness cast away) is safe.
*/
ami_bitmap_set_url(bm, browser_window_access_url(gwin->gw->bw));
ami_bitmap_set_title(bm, browser_window_get_title(gwin->gw->bw));
ami_bitmap_set_url(bm, browser_window_access_url(ami_gui_get_browser_window(gwin->gw)));
ami_bitmap_set_title(bm, browser_window_get_title(ami_gui_get_browser_window(gwin->gw)));
ami_easy_clipboard_bitmap(bm);
}
#ifdef WITH_NS_SVG
else if(ami_mime_compare(browser_window_get_content(gwin->gw->bw), "svg") == true) {
ami_easy_clipboard_svg(browser_window_get_content(gwin->gw->bw));
else if(ami_mime_compare(browser_window_get_content(ami_gui_get_browser_window(gwin->gw)), "svg") == true) {
ami_easy_clipboard_svg(browser_window_get_content(ami_gui_get_browser_window(gwin->gw)));
}
#endif
}
@ -277,7 +277,7 @@ HOOKF(void, ami_menu_item_edit_paste, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_key_press(gwin->gw->bw, NS_KEY_PASTE);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_PASTE);
}
HOOKF(void, ami_menu_item_edit_selectall, APTR, window, struct IntuiMessage *)
@ -285,7 +285,7 @@ HOOKF(void, ami_menu_item_edit_selectall, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_key_press(gwin->gw->bw, NS_KEY_SELECT_ALL);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_SELECT_ALL);
gui_start_selection(gwin->gw);
}
@ -294,7 +294,7 @@ HOOKF(void, ami_menu_item_edit_clearsel, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_CLEAR_SELECTION);
}
HOOKF(void, ami_menu_item_edit_undo, APTR, window, struct IntuiMessage *)
@ -302,7 +302,7 @@ HOOKF(void, ami_menu_item_edit_undo, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_key_press(gwin->gw->bw, NS_KEY_UNDO);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_UNDO);
}
HOOKF(void, ami_menu_item_edit_redo, APTR, window, struct IntuiMessage *)
@ -310,7 +310,7 @@ HOOKF(void, ami_menu_item_edit_redo, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
browser_window_key_press(gwin->gw->bw, NS_KEY_REDO);
browser_window_key_press(ami_gui_get_browser_window(gwin->gw), NS_KEY_REDO);
}
HOOKF(void, ami_menu_item_browser_find, APTR, window, struct IntuiMessage *)
@ -380,7 +380,7 @@ HOOKF(void, ami_menu_item_browser_scale_decrease, APTR, window, struct IntuiMess
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
ami_gui_adjust_scale(gwin->gw, -0.1);
}
HOOKF(void, ami_menu_item_browser_scale_normal, APTR, window, struct IntuiMessage *)
@ -396,7 +396,7 @@ HOOKF(void, ami_menu_item_browser_scale_increase, APTR, window, struct IntuiMess
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
ami_gui_adjust_scale(gwin->gw, +0.1);
}
HOOKF(void, ami_menu_item_browser_redraw, APTR, window, struct IntuiMessage *)
@ -414,7 +414,7 @@ HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *)
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
bw = gwin->gw->bw;
bw = ami_gui_get_browser_window(gwin->gw);
if (bw == NULL || browser_window_has_content(bw) == false)
return;
@ -436,7 +436,7 @@ HOOKF(void, ami_menu_item_hotlist_entries, APTR, window, struct IntuiMessage *)
if(url == NULL) return;
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
url,
NULL,
BW_NAVIGATE_HISTORY,
@ -711,19 +711,19 @@ void ami_gui_menu_update_checked(struct gui_window_2 *gwin)
void ami_gui_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c)
{
struct Window *win = g->shared->win;
struct Window *win = ami_gui_get_gui_window_2(g)->win;
if(nsoption_bool(kiosk_mode) == true) return;
if(content_get_type(c) <= CONTENT_CSS)
{
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVETXT, false);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVECOMP, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVETXT, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVECOMP, false);
#ifdef WITH_PDF_EXPORT
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVEPDF, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVEPDF, false);
#endif
#if 0
if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_COPY) {
if(browser_window_get_editor_flags(ami_gui_get_browser_window(g)) & BW_EDITOR_CAN_COPY) {
OnMenu(win,AMI_MENU_COPY);
OnMenu(win,AMI_MENU_CLEAR);
} else {
@ -731,39 +731,39 @@ void ami_gui_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c
OffMenu(win,AMI_MENU_CLEAR);
}
if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_CUT)
if(browser_window_get_editor_flags(ami_gui_get_browser_window(g)) & BW_EDITOR_CAN_CUT)
OnMenu(win,AMI_MENU_CUT);
else
OffMenu(win,AMI_MENU_CUT);
if(browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_PASTE)
if(browser_window_get_editor_flags(ami_gui_get_browser_window(g)) & BW_EDITOR_CAN_PASTE)
OnMenu(win,AMI_MENU_PASTE);
else
OffMenu(win,AMI_MENU_PASTE);
#else
ami_gui_menu_set_disabled(win, g->shared->imenu, M_CUT, false);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_COPY, false);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_PASTE, false);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_CLEAR, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_CUT, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_COPY, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_PASTE, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_CLEAR, false);
#endif
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SELALL, false);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_FIND, false);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SELALL, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_FIND, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVEIFF, true);
}
else
{
ami_gui_menu_set_disabled(win, g->shared->imenu, M_CUT, true);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_PASTE, true);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_CLEAR, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_CUT, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_PASTE, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_CLEAR, true);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVETXT, true);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVECOMP, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVETXT, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVECOMP, true);
#ifdef WITH_PDF_EXPORT
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVEPDF, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVEPDF, true);
#endif
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SELALL, true);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_FIND, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SELALL, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_FIND, true);
#ifdef WITH_NS_SVG
if(content_get_bitmap(c) || (ami_mime_compare(c, "svg") == true))
@ -771,13 +771,13 @@ void ami_gui_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c
if(content_get_bitmap(c))
#endif
{
ami_gui_menu_set_disabled(win, g->shared->imenu, M_COPY, false);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_COPY, false);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVEIFF, false);
}
else
{
ami_gui_menu_set_disabled(win, g->shared->imenu, M_COPY, true);
ami_gui_menu_set_disabled(win, g->shared->imenu, M_SAVEIFF, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_COPY, true);
ami_gui_menu_set_disabled(win, ami_gui_get_gui_window_2(g)->imenu, M_SAVEIFF, true);
}
}
}

View File

@ -2142,7 +2142,7 @@ static BOOL ami_gui_opts_event(void *w)
case GID_OPTS_HOMEPAGE_CURRENT:
if(cur_gw) RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
gow->win, NULL, STRINGA_TextVal,
nsurl_access(browser_window_access_url(cur_gw->bw)), TAG_DONE);
nsurl_access(browser_window_access_url(ami_gui_get_browser_window(cur_gw))), TAG_DONE);
break;
case GID_OPTS_HOMEPAGE_BLANK:

View File

@ -203,7 +203,7 @@ ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
DisplayBeep(scrn);
} else if(url) {
if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
url,
NULL,
BW_NAVIGATE_HISTORY,

View File

@ -81,7 +81,7 @@ ami_history_local_destroy(struct ami_history_local_window *history_local_win)
res = local_history_fini(history_local_win->session);
if (res == NSERROR_OK) {
history_local_win->gw->hw = NULL;
ami_gui_set_history_window(history_local_win->gw, NULL);
res = ami_corewindow_fini(&history_local_win->core); /* closes the window for us */
history_local_window = NULL;
}
@ -253,8 +253,8 @@ nserror ami_history_local_present(struct gui_window *gw)
if(history_local_window != NULL) {
//windowtofront()
if (gw->hw != NULL) {
res = local_history_set(gw->hw->session, gw->bw);
if (ami_gui_get_history_window(gw) != NULL) {
res = local_history_set(ami_gui_get_history_window(gw)->session, ami_gui_get_browser_window(gw));
return res;
}
@ -295,7 +295,7 @@ nserror ami_history_local_present(struct gui_window *gw)
res = local_history_init(ncwin->core.cb_table,
(struct core_window *)ncwin,
gw->bw,
ami_gui_get_browser_window(gw),
&ncwin->session);
if (res != NSERROR_OK) {
ami_utf8_free(ncwin->core.wintitle);
@ -317,7 +317,7 @@ nserror ami_history_local_present(struct gui_window *gw)
ncwin->gw = gw;
history_local_window = ncwin;
gw->hw = ncwin;
ami_gui_set_history_window(gw, ncwin);
return NSERROR_OK;
}

View File

@ -254,7 +254,7 @@ ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
DisplayBeep(scrn);
} else if(url) {
if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
browser_window_navigate(gwin->gw->bw,
browser_window_navigate(ami_gui_get_browser_window(gwin->gw),
url,
NULL,
BW_NAVIGATE_HISTORY,

View File

@ -53,7 +53,7 @@ static LONG ami_misc_req(const char *message, uint32 type)
TDR_FormatString, message,
TDR_GadgetString, messages_get("OK"),
TDR_ImageType, type,
TDR_Window, cur_gw ? cur_gw->shared->win : NULL,
TDR_Window, cur_gw ? ami_gui_get_gui_window_2(cur_gw)->win : NULL,
TAG_DONE);
#else
struct EasyStruct easyreq = {
@ -64,7 +64,7 @@ static LONG ami_misc_req(const char *message, uint32 type)
messages_get("OK"),
};
ret = EasyRequest(cur_gw ? cur_gw->shared->win : NULL, &easyreq, NULL);
ret = EasyRequest(cur_gw ? ami_gui_get_gui_window_2(cur_gw)->win : NULL, &easyreq, NULL);
#endif
return ret;
}

View File

@ -407,7 +407,7 @@ static BOOL ami_print_event(void *w)
void ami_print(struct hlcache_handle *c, int copies)
{
float height;
double height;
float scale = nsoption_int(print_scale) / 100.0;
if(ami_print_info.msgport == NULL)

View File

@ -143,10 +143,10 @@ void ami_search_open(struct gui_window *gwin)
if(fwin)
{
browser_window_search_clear(fwin->gwin->bw);
fwin->gwin->shared->searchwin = NULL;
browser_window_search_clear(ami_gui_get_browser_window(fwin->gwin));
ami_gui_get_gui_window_2(fwin->gwin)->searchwin = NULL;
fwin->gwin = gwin;
gwin->shared->searchwin = fwin;
ami_gui_get_gui_window_2(fwin->gwin)->searchwin = fwin;
WindowToFront(fwin->win);
ActivateWindow(fwin->win);
return;
@ -220,7 +220,7 @@ void ami_search_open(struct gui_window *gwin)
fwin->win = (struct Window *)RA_OpenWindow(fwin->objects[OID_S_MAIN]);
fwin->gwin = gwin;
ami_gui_win_list_add(fwin, AMINS_FINDWINDOW, &ami_search_table);
gwin->shared->searchwin = fwin;
ami_gui_get_gui_window_2(fwin->gwin)->searchwin = fwin;
ActivateLayoutGadget((struct Gadget *)fwin->objects[GID_S_MAIN], fwin->win,
NULL, (ULONG)fwin->objects[GID_S_SEARCHSTRING]);
@ -228,8 +228,8 @@ void ami_search_open(struct gui_window *gwin)
void ami_search_close(void)
{
browser_window_search_clear(fwin->gwin->bw);
fwin->gwin->shared->searchwin = NULL;
browser_window_search_clear(ami_gui_get_browser_window(fwin->gwin));
ami_gui_get_gui_window_2(fwin->gwin)->searchwin = NULL;
DisposeObject(fwin->objects[OID_S_MAIN]);
/* Free local charset version of messages */
@ -256,7 +256,7 @@ static BOOL ami_search_event(void *w)
switch(result & WMHI_GADGETMASK)
{
case GID_S_SEARCHSTRING:
browser_window_search_clear(fwin->gwin->bw);
browser_window_search_clear(ami_gui_get_browser_window(fwin->gwin));
RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_S_PREV],
fwin->win, NULL,
@ -275,10 +275,10 @@ static BOOL ami_search_event(void *w)
flags = SEARCH_FLAG_FORWARDS |
ami_search_flags();
browser_window_search(
fwin->gwin->bw,
ami_gui_get_browser_window(fwin->gwin),
NULL,
flags, ami_search_string());
ActivateWindow(fwin->gwin->shared->win);
ActivateWindow(ami_gui_get_gui_window_2(fwin->gwin)->win);
break;
case GID_S_PREV:
@ -286,10 +286,10 @@ static BOOL ami_search_event(void *w)
flags = ~SEARCH_FLAG_FORWARDS &
ami_search_flags();
browser_window_search(
fwin->gwin->bw,
ami_gui_get_browser_window(fwin->gwin),
NULL,
flags, ami_search_string());
ActivateWindow(fwin->gwin->shared->win);
ActivateWindow(ami_gui_get_gui_window_2(fwin->gwin)->win);
break;
}
break;

View File

@ -74,7 +74,7 @@ HOOKF(uint32, ami_popup_hook, Object *, item, APTR)
struct gui_window *gwin = hook->h_Data;
if(GetAttr(PMIA_ID, item, &itemid)) {
form_select_process_selection(gwin->shared->control, itemid);
form_select_process_selection(ami_gui_get_gui_window_2(gwin)->control, itemid);
}
return itemid;
@ -111,7 +111,7 @@ void gui_create_form_select_menu(struct gui_window *g,
selectmenuhook.h_SubEntry = NULL;
selectmenuhook.h_Data = g;
g->shared->control = control;
ami_gui_get_gui_window_2(g)->control = control;
selectmenuobj = PMMENU(form_control_get_name(control)),
PMA_MenuHandler, &selectmenuhook, End;
@ -166,9 +166,9 @@ void gui_create_form_select_menu(struct gui_window *g,
~0);
}
ami_set_pointer(g->shared, GUI_POINTER_DEFAULT, false); // Clear the menu-style pointer
ami_set_pointer(ami_gui_get_gui_window_2(g), GUI_POINTER_DEFAULT, false); // Clear the menu-style pointer
IDoMethod(selectmenuobj, PM_OPEN, g->shared->win);
IDoMethod(selectmenuobj, PM_OPEN, ami_gui_get_gui_window_2(g)->win);
/* PM_OPEN is blocking, so dispose menu immediately... */
if(selectmenuobj) DisposeObject(selectmenuobj);

View File

@ -215,7 +215,7 @@ void ami_get_theme_filename(char *filename, const char *themestring, bool protoc
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
ami_set_pointer(g->shared, shape, true);
ami_set_pointer(ami_gui_get_gui_window_2(g), shape, true);
}
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
@ -429,16 +429,16 @@ void gui_window_start_throbber(struct gui_window *g)
if(nsoption_bool(kiosk_mode)) return;
#ifdef __amigaos4__
if(g->tab_node && (g->shared->tabs > 1))
if(ami_gui_get_tab_node(g) && (ami_gui_get_gui_window_2(g)->tabs > 1))
{
SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, TRUE, TAG_DONE);
RefreshGadgets((APTR)g->shared->objects[GID_TABS],
g->shared->win, NULL);
SetClickTabNodeAttrs(ami_gui_get_tab_node(g), TNA_Flagged, TRUE, TAG_DONE);
RefreshGadgets((APTR)ami_gui_get_gui_window_2(g)->objects[GID_TABS],
ami_gui_get_gui_window_2(g)->win, NULL);
}
#endif
g->throbbing = true;
if(g->shared->throbber_frame == 0) g->shared->throbber_frame = 1;
ami_gui_set_throbbing(g, true);
if(ami_gui_get_gui_window_2(g)->throbber_frame == 0) ami_gui_get_gui_window_2(g)->throbber_frame = 1;
ami_throbber_redraw_schedule(throbber_update_interval, g);
}
@ -450,22 +450,22 @@ void gui_window_stop_throbber(struct gui_window *g)
if(nsoption_bool(kiosk_mode)) return;
#ifdef __amigaos4__
if(g->tab_node && (g->shared->tabs > 1))
if(ami_gui_get_tab_node(g) && (ami_gui_get_gui_window_2(g)->tabs > 1))
{
SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, FALSE, TAG_DONE);
RefreshGadgets((APTR)g->shared->objects[GID_TABS],
g->shared->win, NULL);
SetClickTabNodeAttrs(ami_gui_get_tab_node(g), TNA_Flagged, FALSE, TAG_DONE);
RefreshGadgets((APTR)ami_gui_get_gui_window_2(g)->objects[GID_TABS],
ami_gui_get_gui_window_2(g)->win, NULL);
}
#endif
if(g == g->shared->gw) {
if(ami_gui_get_space_box(g->shared->objects[GID_THROBBER], &bbox) != NSERROR_OK) {
if(g == ami_gui_get_gui_window_2(g)->gw) {
if(ami_gui_get_space_box(ami_gui_get_gui_window_2(g)->objects[GID_THROBBER], &bbox) != NSERROR_OK) {
amiga_warn_user("NoMemory", "");
return;
}
if(throbber != NULL) {
BltBitMapRastPort(throbber, 0, 0, g->shared->win->RPort,
BltBitMapRastPort(throbber, 0, 0, ami_gui_get_gui_window_2(g)->win->RPort,
bbox->Left, bbox->Top,
ami_theme_throbber_get_width(), ami_theme_throbber_get_height(),
0x0C0);
@ -473,7 +473,7 @@ void gui_window_stop_throbber(struct gui_window *g)
ami_gui_free_space_box(bbox);
}
g->throbbing = false;
ami_gui_set_throbbing(g, false);
ami_throbber_redraw_schedule(-1, g);
}
@ -484,17 +484,17 @@ static void ami_throbber_update(void *p)
int frame = 0;
if(!g) return;
if(!g->shared->objects[GID_THROBBER]) return;
if(!ami_gui_get_gui_window_2(g)->objects[GID_THROBBER]) return;
if(g->throbbing == true) {
frame = g->shared->throbber_frame;
g->shared->throbber_frame++;
if(g->shared->throbber_frame > (throbber_frames-1))
g->shared->throbber_frame=1;
if(ami_gui_get_throbbing(g) == true) {
frame = ami_gui_get_gui_window_2(g)->throbber_frame;
ami_gui_get_gui_window_2(g)->throbber_frame++;
if(ami_gui_get_gui_window_2(g)->throbber_frame > (throbber_frames-1))
ami_gui_get_gui_window_2(g)->throbber_frame=1;
}
if(g->shared->gw == g) {
if(ami_gui_get_space_box(g->shared->objects[GID_THROBBER], &bbox) != NSERROR_OK) {
if(ami_gui_get_gui_window_2(g)->gw == g) {
if(ami_gui_get_space_box(ami_gui_get_gui_window_2(g)->objects[GID_THROBBER], &bbox) != NSERROR_OK) {
amiga_warn_user("NoMemory", "");
return;
}
@ -508,14 +508,14 @@ static void ami_throbber_update(void *p)
BLITA_Width, ami_theme_throbber_get_width(),
BLITA_Height, ami_theme_throbber_get_height(),
BLITA_Source, throbber,
BLITA_Dest, g->shared->win->RPort,
BLITA_Dest, ami_gui_get_gui_window_2(g)->win->RPort,
BLITA_SrcType, BLITT_BITMAP,
BLITA_DestType, BLITT_RASTPORT,
// BLITA_UseSrcAlpha, TRUE,
TAG_DONE);
#else
BltBitMapRastPort(throbber, ami_theme_throbber_get_width() * frame,
0, g->shared->win->RPort,
0, ami_gui_get_gui_window_2(g)->win->RPort,
bbox->Left, bbox->Top,
ami_theme_throbber_get_width(), ami_theme_throbber_get_height(),
0xC0);