summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2009-03-07 20:52:08 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2009-03-07 20:52:08 +0000
commit33c48cfcd90f838df5ec2a896b40d70c48e2d48f (patch)
tree74b83b2f3b004cd6ad0270b6bb1f1e78b537c28c
parent2aee9f4c09491a994f1000e04fe9daf9b9806998 (diff)
downloadnetsurf-33c48cfcd90f838df5ec2a896b40d70c48e2d48f.tar.gz
netsurf-33c48cfcd90f838df5ec2a896b40d70c48e2d48f.tar.bz2
Start of local history window in Amiga build; doesn't work yet
svn path=/trunk/netsurf/; revision=6727
-rw-r--r--Makefile.sources2
-rwxr-xr-xamiga/history_local.c132
-rwxr-xr-xamiga/menu.c21
-rwxr-xr-xamiga/object.h3
4 files changed, 148 insertions, 10 deletions
diff --git a/Makefile.sources b/Makefile.sources
index 7fabf0178..bf72367d7 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -86,7 +86,7 @@ S_AMIGA := compat.c gui.c tree.c history.c hotlist.c schedule.c \
thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c context_menu.c clipboard.c save_complete.c \
- fetch_file.c fetch_mailto.c search.c
+ fetch_file.c fetch_mailto.c search.c history_local.c
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
# S_FRAMEBUFFER are sources purely for the framebuffer build
diff --git a/amiga/history_local.c b/amiga/history_local.c
new file mode 100755
index 000000000..a61b2c218
--- /dev/null
+++ b/amiga/history_local.c
@@ -0,0 +1,132 @@
+/*
+ * 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/>.
+ */
+
+/** \file
+ * Browser history window (RISC OS implementation).
+ *
+ * There is only one history window, not one per browser window.
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include "desktop/history_core.h"
+#include "desktop/plotters.h"
+#include "amiga/object.h"
+#include "amiga/gui.h"
+#include "utils/log.h"
+#include "utils/url.h"
+#include "utils/utils.h"
+#include <proto/intuition.h>
+
+#include <proto/window.h>
+#include <proto/space.h>
+#include <proto/layout.h>
+#include <classes/window.h>
+#include <gadget/layout.h>
+#include <reaction/reaction.h>
+#include <reaction/reaction_macros.h>
+
+static struct browser_window *history_bw;
+static struct history *history_current = 0;
+/* Last position of mouse in window. */
+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 void ami_history_redraw(wimp_draw *redraw);
+//static bool ami_history_click(wimp_pointer *pointer);
+
+/**
+ * Open history window.
+ *
+ * \param bw browser window to open history for
+ * \param history history to open
+ * \param at_pointer open the window at the pointer
+ */
+
+void ami_history_open(struct browser_window *bw, struct history *history)
+{
+ int width, height;
+
+ assert(history);
+
+ history_current = history;
+ history_bw = bw;
+
+ history_size(history, &width, &height);
+
+ history_objects[0] = 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,
+ WA_Width,width,
+ WA_Height,height,
+ WINDOW_SharedPort,sport,
+// WINDOW_UserData,twin,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WA_ReportMouse,TRUE,
+ WA_IDCMP,IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE,
+ WINDOW_ParentGroup, VGroupObject,
+ LAYOUT_AddChild, SpaceObject,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ history_window = (struct Window *)RA_OpenWindow(history_objects[0]);
+
+ history_node = AddObject(window_list,AMINS_HISTORYWINDOW);
+ history_node->objstruct = history_window;
+
+ ami_history_redraw();
+}
+
+
+/**
+ * Redraw history window.
+ */
+
+void ami_history_redraw(void)
+{
+ history_redraw(history_current);
+}
+
+/**
+ * Handle mouse clicks in the history window.
+ *
+ * \return true if the event was handled, false to pass it on
+ */
+
+bool ami_history_click(int xpos,int ypos)
+{
+ int x, y;
+
+ history_click(history_bw, history_current, xpos, ypos,0);
+// pointer->buttons == wimp_CLICK_ADJUST);
+
+ return true;
+}
diff --git a/amiga/menu.c b/amiga/menu.c
index 93f5380b5..067f3187f 100755
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -89,11 +89,11 @@ void ami_init_menulabs(void)
menulab[20] = ami_utf8_easy((char *)messages_get("ClearNS"));
menulab[21] = ami_utf8_easy((char *)messages_get("Browser"));
menulab[22] = ami_utf8_easy((char *)messages_get("FindTextNS"));
- menulab[23] = ami_utf8_easy((char *)messages_get("size"));
+ menulab[23] = NM_BARLABEL;
menulab[24] = ami_utf8_easy((char *)messages_get("normal"));
- menulab[25] = ami_utf8_easy((char *)messages_get("double"));
- menulab[26] = NM_BARLABEL;
- menulab[27] = ami_utf8_easy((char *)messages_get("HistGlobalNS"));
+ menulab[25] = ami_utf8_easy((char *)messages_get("HistLocal"));
+ menulab[26] = ami_utf8_easy((char *)messages_get("HistGlobalNS"));
+ menulab[27] = NM_BARLABEL;
menulab[28] = ami_utf8_easy((char *)messages_get("ShowCookies"));
menulab[29] = ami_utf8_easy((char *)messages_get("Hotlist"));
menulab[30] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
@@ -136,11 +136,11 @@ 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_ITEM,0,0,0,0,0,}, // size
- { NM_SUB,0,0,0,0,0,}, // normal
- { NM_SUB,0,0,0,0,0,}, // double
+ {NM_IGNORE,0,0,0,0,0,}, // size
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
+ { 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,},
{ NM_ITEM,0,0,0,0,0,}, // cookies
{NM_TITLE,0,0,0,0,0,}, // hotlist
{ NM_ITEM,0,0,0,0,0,}, // add to hotlist
@@ -591,11 +591,16 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
}
break;
+ case 2: // local history
+ if(gwin->bw && gwin->bw->history)
+ ami_history_open(gwin->bw, gwin->bw->history);
+ break;
+
case 3: // global history
ami_open_tree(global_history_tree,AMI_TREE_HISTORY);
break;
- case 4: // cookies tree
+ case 5: // cookies tree
ami_open_tree(cookies_tree,AMI_TREE_COOKIES);
break;
}
diff --git a/amiga/object.h b/amiga/object.h
index 242a21a08..452dbf6e0 100755
--- a/amiga/object.h
+++ b/amiga/object.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008,2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -31,6 +31,7 @@ enum
AMINS_LOGINWINDOW,
AMINS_TVWINDOW,
AMINS_FINDWINDOW,
+ AMINS_HISTORYWINDOW,
AMINS_FETCHER,
};