summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-11-16 15:51:57 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-11-16 15:51:57 +0000
commit79690c6c90f3ef1def18dacaa75312a9e2ebd468 (patch)
tree60c5a637d314a6f54c31a4634d62b94985bb4c0b
parent456734a5c251a9b381ce59711406a872c4966d65 (diff)
downloadnetsurf-79690c6c90f3ef1def18dacaa75312a9e2ebd468.tar.gz
netsurf-79690c6c90f3ef1def18dacaa75312a9e2ebd468.tar.bz2
Remove the global which meant we could only open one local history window.
Now we can open multiple local history windows, which avoids the confusion when requesting a local history window when one is already open.
-rw-r--r--amiga/context_menu.c2
-rwxr-xr-xamiga/history_local.c44
-rw-r--r--amiga/menu.c2
3 files changed, 21 insertions, 27 deletions
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index 81ea701ec..795e900bf 100644
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -895,7 +895,7 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
case CMID_HISTORY:
if(userdata == NULL)
{
- ami_history_open(gwin->gw->bw, gwin->gw->bw->history);
+ ami_history_open(gwin->gw, gwin->gw->bw->history);
}
else
{
diff --git a/amiga/history_local.c b/amiga/history_local.c
index ddcf40b3c..8c95122d1 100755
--- a/amiga/history_local.c
+++ b/amiga/history_local.c
@@ -53,8 +53,6 @@
#include "amiga/gui.h"
#include "amiga/history_local.h"
-static struct history_window *hwindow;
-
void ami_history_update_extent(struct history_window *hw);
static void ami_history_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg);
@@ -106,19 +104,19 @@ void ami_history_open(struct gui_window *gw, struct history *history)
assert(history);
- if(!hwindow)
+ if(!gw->hw)
{
- hwindow = AllocVecTags(sizeof(struct history_window), AVT_ClearWithValue, 0, TAG_DONE);
+ gw->hw = AllocVecTags(sizeof(struct history_window), AVT_ClearWithValue, 0, TAG_DONE);
- ami_init_layers(&hwindow->gg, scrn->Width, scrn->Height);
+ ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height);
- hwindow->gw = gw;
+ gw->hw->gw = gw;
browser_window_history_size(gw->bw, &width, &height);
- hwindow->scrollerhook.h_Entry = (void *)ami_history_scroller_hook;
- hwindow->scrollerhook.h_Data = hwindow;
+ gw->hw->scrollerhook.h_Entry = (void *)ami_history_scroller_hook;
+ gw->hw->scrollerhook.h_Data = gw->hw;
- hwindow->objects[OID_MAIN] = WindowObject,
+ gw->hw->objects[OID_MAIN] = WindowObject,
WA_ScreenTitle,nsscreentitle,
WA_Title,messages_get("History"),
WA_Activate, TRUE,
@@ -130,18 +128,18 @@ void ami_history_open(struct gui_window *gw, struct history *history)
WA_InnerWidth,width,
WA_InnerHeight,height + 10,
WINDOW_SharedPort,sport,
- WINDOW_UserData,hwindow,
+ WINDOW_UserData,gw->hw,
WINDOW_IconifyGadget, FALSE,
WINDOW_GadgetHelp, TRUE,
WINDOW_Position, WPOS_CENTERSCREEN,
WINDOW_HorizProp,1,
WINDOW_VertProp,1,
- WINDOW_IDCMPHook,&hwindow->scrollerhook,
+ WINDOW_IDCMPHook,&gw->hw->scrollerhook,
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,
// WA_ReportMouse,TRUE,
WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, // | IDCMP_MOUSEMOVE,
- WINDOW_ParentGroup, hwindow->objects[GID_MAIN] = VGroupObject,
- LAYOUT_AddChild, hwindow->objects[GID_BROWSER] = SpaceObject,
+ WINDOW_ParentGroup, gw->hw->objects[GID_MAIN] = VGroupObject,
+ LAYOUT_AddChild, gw->hw->objects[GID_BROWSER] = SpaceObject,
GA_ID,GID_BROWSER,
// SPACE_MinWidth,width,
// SPACE_MinHeight,height,
@@ -149,30 +147,27 @@ void ami_history_open(struct gui_window *gw, struct history *history)
EndGroup,
EndWindow;
- hwindow->win = (struct Window *)RA_OpenWindow(hwindow->objects[OID_MAIN]);
-// hwindow->bw->window = hwindow;
- hwindow->node = AddObject(window_list,AMINS_HISTORYWINDOW);
- hwindow->node->objstruct = hwindow;
+ gw->hw->win = (struct Window *)RA_OpenWindow(gw->hw->objects[OID_MAIN]);
+ gw->hw->node = AddObject(window_list,AMINS_HISTORYWINDOW);
+ gw->hw->node->objstruct = gw->hw;
- GetAttr(WINDOW_HorizObject,hwindow->objects[OID_MAIN],(ULONG *)&hwindow->objects[OID_HSCROLL]);
- GetAttr(WINDOW_VertObject,hwindow->objects[OID_MAIN],(ULONG *)&hwindow->objects[OID_VSCROLL]);
+ GetAttr(WINDOW_HorizObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_HSCROLL]);
+ GetAttr(WINDOW_VertObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_VSCROLL]);
- RefreshSetGadgetAttrs((APTR)hwindow->objects[OID_VSCROLL],hwindow->win,NULL,
+ RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_VSCROLL],gw->hw->win,NULL,
GA_ID,OID_VSCROLL,
SCROLLER_Top,0,
ICA_TARGET,ICTARGET_IDCMP,
TAG_DONE);
- RefreshSetGadgetAttrs((APTR)hwindow->objects[OID_HSCROLL],hwindow->win,NULL,
+ RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_HSCROLL],gw->hw->win,NULL,
GA_ID,OID_HSCROLL,
SCROLLER_Top,0,
ICA_TARGET,ICTARGET_IDCMP,
TAG_DONE);
}
- hwindow->gw = gw;
- gw->hw = hwindow;
- ami_history_redraw(hwindow);
+ ami_history_redraw(gw->hw);
}
@@ -226,7 +221,6 @@ void ami_history_close(struct history_window *hw)
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
DelObject(hw->node);
- hwindow = NULL;
}
BOOL ami_history_event(struct history_window *hw)
diff --git a/amiga/menu.c b/amiga/menu.c
index 535b26d01..cb3d6d61f 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -964,7 +964,7 @@ static void ami_menu_item_browser_localhistory(struct Hook *hook, APTR window, s
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
if(gwin->gw->bw && gwin->gw->bw->history)
- ami_history_open(gwin->gw->bw, gwin->gw->bw->history);
+ ami_history_open(gwin->gw, gwin->gw->bw->history);
}
static void ami_menu_item_browser_globalhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg)