From f6951c0d51f6d55d9fc16042bf77b626abb3c505 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 8 Mar 2009 16:24:52 +0000 Subject: Mostly-working local history window svn path=/trunk/netsurf/; revision=6733 --- amiga/gui.c | 1 - amiga/gui.h | 5 +- amiga/history_local.c | 128 ++++++++++++++++++++++++++++++++------------------ amiga/menu.c | 4 +- 4 files changed, 89 insertions(+), 49 deletions(-) (limited to 'amiga') diff --git a/amiga/gui.c b/amiga/gui.c index 92e87f0b9..6a31901cd 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -171,7 +171,6 @@ void ami_update_throbber(struct gui_window_2 *g,bool redraw); void ami_update_buttons(struct gui_window_2 *); void ami_scroller_hook(struct Hook *,Object *,struct IntuiMessage *); uint32 ami_popup_hook(struct Hook *hook,Object *item,APTR reserved); -void ami_do_redraw(struct gui_window_2 *g,bool scroll); void ami_init_mouse_pointers(void); void ami_switch_tab(struct gui_window_2 *gwin,bool redraw); #ifdef WITH_HUBBUB diff --git a/amiga/gui.h b/amiga/gui.h index 7ab824a5e..9523d87af 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -24,6 +24,7 @@ #include "desktop/browser.h" #include #include "desktop/gui.h" +#include "amiga/history_local.h" #ifdef NS_AMIGA_CAIRO #include #endif @@ -117,7 +118,7 @@ struct gui_window int scrollx; int scrolly; char *dlfilename; -// struct browser_window *bw; // not used + struct history_window *hw; // not used }; struct gui_globals @@ -139,6 +140,8 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape); void ami_close_all_tabs(struct gui_window_2 *gwin); void ami_quit_netsurf(void); void ami_get_theme_filename(char *filename,char *themestring); +void ami_clearclipreg(struct RastPort *rp); +void ami_do_redraw(struct gui_window_2 *g,bool scroll); struct RastPort *currp; struct TextFont *origrpfont; diff --git a/amiga/history_local.c b/amiga/history_local.c index df33f11f8..969c6e1fc 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -35,6 +35,7 @@ #include #include "amiga/history_local.h" #include +#include #include #include @@ -44,7 +45,6 @@ #include #include -static struct browser_window *history_bw; static struct history *history_current = 0; /* Last position of mouse in window. */ static int mouse_x = 0; @@ -52,9 +52,6 @@ static int mouse_x = 0; static int mouse_y = 0; static struct history_window *hwindow; -//static void ami_history_redraw(wimp_draw *redraw); -//static bool ami_history_click(wimp_pointer *pointer); - /** * Open history window. * @@ -70,43 +67,47 @@ void ami_history_open(struct browser_window *bw, struct history *history) assert(history); history_current = history; - history_bw = bw; - - if(hwindow) return; - - hwindow = AllocVec(sizeof(struct history_window),MEMF_CLEAR | MEMF_PRIVATE); - - history_size(history, &width, &height); - - hwindow->objects[OID_MAIN] = WindowObject, - WA_ScreenTitle,nsscreentitle, - WA_Title,messages_get("LocalHistory"), - WA_Activate, TRUE, - WA_DepthGadget, TRUE, - WA_DragBar, TRUE, - WA_CloseGadget, TRUE, - WA_SizeGadget, TRUE, - WA_CustomScreen,scrn, - WINDOW_SharedPort,sport, - WINDOW_UserData,hwindow, - WINDOW_IconifyGadget, FALSE, - WINDOW_Position, WPOS_CENTERSCREEN, - WA_ReportMouse,TRUE, - WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE | IDCMP_MOUSEMOVE, - WINDOW_ParentGroup, VGroupObject, - LAYOUT_AddChild, hwindow->gadgets[GID_BROWSER] = SpaceObject, - GA_ID,GID_BROWSER, - SPACE_MinWidth,width, - SPACE_MinHeight,height, - SpaceEnd, - 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; + if(!hwindow) + { + hwindow = AllocVec(sizeof(struct history_window),MEMF_CLEAR | MEMF_PRIVATE); + + hwindow->bw = bw; + history_size(history, &width, &height); + + hwindow->objects[OID_MAIN] = WindowObject, + WA_ScreenTitle,nsscreentitle, + WA_Title,messages_get("History"), + WA_Activate, TRUE, + WA_DepthGadget, TRUE, + WA_DragBar, TRUE, + WA_CloseGadget, TRUE, + WA_SizeGadget, TRUE, + WA_CustomScreen,scrn, + WA_InnerWidth,width, + WA_InnerHeight,height, + WINDOW_SharedPort,sport, + WINDOW_UserData,hwindow, + WINDOW_IconifyGadget, FALSE, + WINDOW_Position, WPOS_CENTERSCREEN, + WA_ReportMouse,TRUE, + WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, // | IDCMP_MOUSEMOVE, + WINDOW_ParentGroup, VGroupObject, + LAYOUT_AddChild, hwindow->gadgets[GID_BROWSER] = SpaceObject, + GA_ID,GID_BROWSER, +// SPACE_MinWidth,width, +// SPACE_MinHeight,height, + SpaceEnd, + 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; + } + + hwindow->bw = bw; ami_history_redraw(hwindow); } @@ -117,9 +118,15 @@ void ami_history_open(struct browser_window *bw, struct history *history) void ami_history_redraw(struct history_window *hw) { - currp = hw->win->RPort; + struct IBox *bbox; + + GetAttr(SPACE_AreaBox,hw->gadgets[GID_BROWSER],(ULONG *)&bbox); + ami_clg(0xffffff); + history_redraw(history_current); - currp = NULL; + + ami_clearclipreg(currp); + BltBitMapRastPort(glob.bm,0,0,hw->win->RPort,bbox->Left,bbox->Top,bbox->Width,bbox->Height,0x0C0); } /** @@ -128,12 +135,39 @@ void ami_history_redraw(struct history_window *hw) * \return true if the event was handled, false to pass it on */ -bool ami_history_click(int xpos,int ypos) +bool ami_history_click(struct history_window *hw,uint16 code) { int x, y; + struct IBox *bbox; + ULONG width,height; + + GetAttr(SPACE_AreaBox,hw->gadgets[GID_BROWSER],(ULONG *)&bbox); + +// GetAttr(SCROLLER_Top,gwin->objects[OID_HSCROLL],(ULONG *)&xs); + x = hw->win->MouseX - bbox->Left; // +xs; +// GetAttr(SCROLLER_Top,gwin->objects[OID_VSCROLL],(ULONG *)&ys); + y = hw->win->MouseY - bbox->Top; // + ys; - history_click(history_bw, history_current, xpos, ypos,0); -// pointer->buttons == wimp_CLICK_ADJUST); + width=bbox->Width; + height=bbox->Height; + + if((x>=0) && (y>=0) && (xbw,history_current,x,y,false); + ami_history_redraw(hw); + ami_do_redraw(hw->bw->window->shared,false); + break; + + case MIDDLEUP: + history_click(hw->bw,history_current,x,y,true); + ami_history_redraw(hw); + break; + + } + } return true; } @@ -172,6 +206,10 @@ BOOL ami_history_event(struct history_window *hw) ami_history_redraw(hw); break; + case WMHI_MOUSEBUTTONS: + ami_history_click(hw,code); + break; + case WMHI_CLOSEWINDOW: ami_history_close(hw); return TRUE; diff --git a/amiga/menu.c b/amiga/menu.c index bdd781844..2788ea5db 100755 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -92,7 +92,7 @@ void ami_init_menulabs(void) menulab[22] = ami_utf8_easy((char *)messages_get("FindTextNS")); menulab[23] = NM_BARLABEL; menulab[24] = ami_utf8_easy((char *)messages_get("normal")); - menulab[25] = ami_utf8_easy((char *)messages_get("HistLocal")); + menulab[25] = ami_utf8_easy((char *)messages_get("HistLocalNS")); menulab[26] = ami_utf8_easy((char *)messages_get("HistGlobalNS")); menulab[27] = NM_BARLABEL; menulab[28] = ami_utf8_easy((char *)messages_get("ShowCookies")); @@ -137,8 +137,8 @@ struct NewMenu *ami_create_menu(ULONG type) { NM_ITEM,0,"Z",0,0,0,}, // clear selection {NM_TITLE,0,0,0,0,0,}, // browser { NM_ITEM,0,"F",0,0,0,}, // find in page - {NM_IGNORE,0,0,0,0,0,}, // size { NM_ITEM,NM_BARLABEL,0,0,0,0,}, + {NM_IGNORE,0,0,0,0,0,}, // was test option for scaling { NM_ITEM,0,0,0,0,0,}, // local history { NM_ITEM,0,0,0,0,0,}, // global history { NM_ITEM,NM_BARLABEL,0,0,0,0,}, -- cgit v1.2.3