summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2009-03-08 12:52:44 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2009-03-08 12:52:44 +0000
commitcbae6a91dd2aa20f3faa3aa349942851e636eaed (patch)
tree7bc5d4aa63f5a0c8b77ec7a6cb76ffd22106921a
parentb0e61211f9d1bbcb024c855d1a864bb3fc763c6d (diff)
downloadnetsurf-cbae6a91dd2aa20f3faa3aa349942851e636eaed.tar.gz
netsurf-cbae6a91dd2aa20f3faa3aa349942851e636eaed.tar.bz2
Stop local history from crashing, display mostly works (no thumbnails and offset wrong
to window), no event handling other than closing the window. svn path=/trunk/netsurf/; revision=6730
-rw-r--r--amiga/bitmap.c2
-rwxr-xr-xamiga/gui.c22
-rwxr-xr-xamiga/history_local.c94
-rwxr-xr-xamiga/history_local.h38
-rwxr-xr-xamiga/menu.c1
-rwxr-xr-xamiga/plotters.c4
6 files changed, 139 insertions, 22 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index c82bc9b01..1e553c287 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -252,6 +252,8 @@ struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,s
struct BitMap *tbm = NULL;
struct RastPort trp;
+ if(!bitmap) return NULL;
+
if(bitmap->nativebm)
{
if((bitmap->nativebmwidth == width) && (bitmap->nativebmheight==height))
diff --git a/amiga/gui.c b/amiga/gui.c
index 8b212bacb..92e87f0b9 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -71,6 +71,7 @@
#include "amiga/fetch_mailto.h"
#include "amiga/search.h"
#include <devices/inputevent.h>
+#include "amiga/history_local.h"
#ifdef NS_AMIGA_CAIRO
#include <cairo/cairo-amigaos.h>
@@ -706,6 +707,23 @@ void ami_handle_msg(void)
continue;
}
}
+ else if(node->Type == AMINS_HISTORYWINDOW)
+ {
+ if(ami_history_event((struct history_window *)gwin))
+ {
+ if(IsMinListEmpty(window_list))
+ {
+ /* last window closed, so exit */
+ netsurf_quit = true;
+ }
+ break;
+ }
+ else
+ {
+ node = nnode;
+ continue;
+ }
+ }
while((result = RA_HandleInput(gwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
{
@@ -1637,6 +1655,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_AddChild, gwin->shared->gadgets[GID_BROWSER] = SpaceObject,
GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
/*
GA_RelVerify,TRUE,
GA_Immediate,TRUE,
@@ -1798,6 +1817,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
GA_ID,GID_THROBBER,
SPACE_MinWidth,throbber_width,
SPACE_MinHeight,throbber_height,
+ SPACE_Transparent,TRUE,
SpaceEnd,
CHILD_WeightedWidth,0,
CHILD_WeightedHeight,0,
@@ -1830,6 +1850,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
CHILD_WeightedHeight,0,
LAYOUT_AddChild, gwin->shared->gadgets[GID_BROWSER] = SpaceObject,
GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
SpaceEnd,
LAYOUT_AddChild, gwin->shared->gadgets[GID_STATUS] = StringObject,
GA_ID,GID_STATUS,
@@ -1879,6 +1900,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_AddChild, gwin->shared->gadgets[GID_BROWSER] = SpaceObject,
GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
SpaceEnd,
EndGroup,
EndWindow;
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;
+}
diff --git a/amiga/history_local.h b/amiga/history_local.h
new file mode 100755
index 000000000..c06702673
--- /dev/null
+++ b/amiga/history_local.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AMIGA_HISTORY_LOCAL_H
+#define AMIGA_HISTORY_LOCAL_H
+
+#include <exec/types.h>
+#include <intuition/classusr.h>
+#include "amiga/gui.h"
+
+struct history_window {
+ struct Window *win;
+ Object *objects[OID_LAST];
+ struct Gadget *gadgets[GID_LAST]; // not used
+ struct nsObject *node;
+ struct browser_window *bw;
+ ULONG pad[4];
+
+};
+
+void ami_history_open(struct browser_window *bw, struct history *history);
+void ami_history_close(struct history_window *hw);
+#endif
diff --git a/amiga/menu.c b/amiga/menu.c
index 067f3187f..bdd781844 100755
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -41,6 +41,7 @@
#include <dos/anchorpath.h>
#include "desktop/textinput.h"
#include "amiga/search.h"
+#include "amiga/history_local.h"
BOOL menualreadyinit;
const char * const netsurf_version;
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 7e954d9bf..10d7b75cd 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -391,6 +391,8 @@ bool ami_bitmap(int x, int y, int width, int height,
tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
+ if(!tbm) return true;
+
BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
BLITA_Source,tbm,
@@ -422,6 +424,8 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
+ if(!tbm) return true;
+
/* get left most tile position */
if (repeat_x)
for (; x > glob.rect.MinX; x -= width)