r6730 chris_y - in /trunk/netsurf/amiga: bitmap.c gui.c
history_local.c history_local.h menu.c plotters.c
netsurf at semichrome.net
netsurf at semichrome.net
Sun Mar 8 12:52:44 GMT 2009
Author: chris_y
Date: Sun Mar 8 07:52:44 2009
New Revision: 6730
URL: http://source.netsurf-browser.org?rev=6730&view=rev
Log:
Stop local history from crashing, display mostly works (no thumbnails and offset wrong
to window), no event handling other than closing the window.
Added:
trunk/netsurf/amiga/history_local.h (with props)
Modified:
trunk/netsurf/amiga/bitmap.c
trunk/netsurf/amiga/gui.c
trunk/netsurf/amiga/history_local.c
trunk/netsurf/amiga/menu.c
trunk/netsurf/amiga/plotters.c
Modified: trunk/netsurf/amiga/bitmap.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/bitmap.c?rev=6730&r1=6729&r2=6730&view=diff
==============================================================================
--- trunk/netsurf/amiga/bitmap.c (original)
+++ trunk/netsurf/amiga/bitmap.c Sun Mar 8 07:52:44 2009
@@ -251,6 +251,8 @@
struct RenderInfo ri;
struct BitMap *tbm = NULL;
struct RastPort trp;
+
+ if(!bitmap) return NULL;
if(bitmap->nativebm)
{
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=6730&r1=6729&r2=6730&view=diff
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Sun Mar 8 07:52:44 2009
@@ -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>
@@ -692,6 +693,23 @@
else if(node->Type == AMINS_FINDWINDOW)
{
if(ami_search_event())
+ {
+ if(IsMinListEmpty(window_list))
+ {
+ /* last window closed, so exit */
+ netsurf_quit = true;
+ }
+ break;
+ }
+ else
+ {
+ node = nnode;
+ continue;
+ }
+ }
+ else if(node->Type == AMINS_HISTORYWINDOW)
+ {
+ if(ami_history_event((struct history_window *)gwin))
{
if(IsMinListEmpty(window_list))
{
@@ -1637,6 +1655,7 @@
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 @@
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 @@
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 @@
LAYOUT_SpaceOuter, TRUE,
LAYOUT_AddChild, gwin->shared->gadgets[GID_BROWSER] = SpaceObject,
GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
SpaceEnd,
EndGroup,
EndWindow;
Modified: trunk/netsurf/amiga/history_local.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/history_local.c?rev=6730&r1=6729&r2=6730&view=diff
==============================================================================
--- trunk/netsurf/amiga/history_local.c (original)
+++ trunk/netsurf/amiga/history_local.c Sun Mar 8 07:52:44 2009
@@ -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 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 @@
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]);
+ 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;
- history_node = AddObject(window_list,AMINS_HISTORYWINDOW);
- history_node->objstruct = history_window;
-
- ami_history_redraw();
+ ami_history_redraw(hwindow);
}
@@ -110,9 +115,11 @@
* 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 @@
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;
+}
Added: trunk/netsurf/amiga/history_local.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/history_local.h?rev=6730&view=auto
==============================================================================
--- trunk/netsurf/amiga/history_local.h (added)
+++ trunk/netsurf/amiga/history_local.h Sun Mar 8 07:52:44 2009
@@ -1,0 +1,38 @@
+/*
+ * Copyright 2009 Chris Young <chris at 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
Propchange: trunk/netsurf/amiga/history_local.h
------------------------------------------------------------------------------
amiga:protection = ----rwed ---- ----
Propchange: trunk/netsurf/amiga/history_local.h
------------------------------------------------------------------------------
svn:executable = *
Modified: trunk/netsurf/amiga/menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/menu.c?rev=6730&r1=6729&r2=6730&view=diff
==============================================================================
--- trunk/netsurf/amiga/menu.c (original)
+++ trunk/netsurf/amiga/menu.c Sun Mar 8 07:52:44 2009
@@ -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;
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=6730&r1=6729&r2=6730&view=diff
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Sun Mar 8 07:52:44 2009
@@ -391,6 +391,8 @@
tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
+ if(!tbm) return true;
+
BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
BLITA_Source,tbm,
@@ -421,6 +423,8 @@
return ami_bitmap(x, y, width, height, bitmap, bg, content);
tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
+
+ if(!tbm) return true;
/* get left most tile position */
if (repeat_x)
More information about the netsurf-commits
mailing list