diff options
Diffstat (limited to 'amiga/history_local.c')
-rwxr-xr-x | amiga/history_local.c | 94 |
1 files changed, 72 insertions, 22 deletions
diff --git a/amiga/history_local.c b/amiga/history_local.c index a61b2c218..df33f11f8 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -33,12 +33,14 @@ #include "utils/url.h" #include "utils/utils.h" #include <proto/intuition.h> +#include "amiga/history_local.h" +#include <proto/exec.h> #include <proto/window.h> #include <proto/space.h> #include <proto/layout.h> #include <classes/window.h> -#include <gadget/layout.h> +#include <gadgets/space.h> #include <reaction/reaction.h> #include <reaction/reaction_macros.h> @@ -48,9 +50,7 @@ static struct history *history_current = 0; static int mouse_x = 0; /* Last position of mouse in window. */ static int mouse_y = 0; -struct Window *history_window; -Object *history_objects[1]; -struct nsObject *history_node; +static struct history_window *hwindow; //static void ami_history_redraw(wimp_draw *redraw); //static bool ami_history_click(wimp_pointer *pointer); @@ -72,37 +72,42 @@ void ami_history_open(struct browser_window *bw, struct history *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); - history_objects[0] = WindowObject, + 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_Title,messages_get("LocalHistory"), + WA_Activate, TRUE, + WA_DepthGadget, TRUE, + WA_DragBar, TRUE, + WA_CloseGadget, TRUE, + WA_SizeGadget, TRUE, WA_CustomScreen,scrn, - WA_Width,width, - WA_Height,height, WINDOW_SharedPort,sport, -// WINDOW_UserData,twin, + WINDOW_UserData,hwindow, WINDOW_IconifyGadget, FALSE, WINDOW_Position, WPOS_CENTERSCREEN, WA_ReportMouse,TRUE, - WA_IDCMP,IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, + WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE | IDCMP_MOUSEMOVE, WINDOW_ParentGroup, VGroupObject, - LAYOUT_AddChild, SpaceObject, + LAYOUT_AddChild, hwindow->gadgets[GID_BROWSER] = SpaceObject, + GA_ID,GID_BROWSER, + SPACE_MinWidth,width, + SPACE_MinHeight,height, SpaceEnd, EndGroup, EndWindow; - history_window = (struct Window *)RA_OpenWindow(history_objects[0]); - - history_node = AddObject(window_list,AMINS_HISTORYWINDOW); - history_node->objstruct = history_window; + 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; - ami_history_redraw(); + ami_history_redraw(hwindow); } @@ -110,9 +115,11 @@ void ami_history_open(struct browser_window *bw, struct history *history) * Redraw history window. */ -void ami_history_redraw(void) +void ami_history_redraw(struct history_window *hw) { + currp = hw->win->RPort; history_redraw(history_current); + currp = NULL; } /** @@ -130,3 +137,46 @@ bool ami_history_click(int xpos,int ypos) return true; } + +void ami_history_close(struct history_window *hw) +{ + DisposeObject(hw->objects[OID_MAIN]); + DelObject(hw->node); + hwindow = NULL; +} + +BOOL ami_history_event(struct history_window *hw) +{ + /* return TRUE if window destroyed */ + ULONG class,result,relevent = 0; + uint16 code; + struct MenuItem *item; + + while((result = RA_HandleInput(hw->objects[OID_MAIN],&code)) != WMHI_LASTMSG) + { + switch(result & WMHI_CLASSMASK) // class + { +/* no menus yet, copied in as will probably need it later + case WMHI_MENUPICK: + item = ItemAddress(gwin->win->MenuStrip,code); + while (code != MENUNULL) + { + ami_menupick(code,gwin); + if(win_destroyed) break; + code = item->NextSelect; + } + break; +*/ + + case WMHI_NEWSIZE: + ami_history_redraw(hw); + break; + + case WMHI_CLOSEWINDOW: + ami_history_close(hw); + return TRUE; + break; + } + } + return FALSE; +} |