summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-02-19 11:39:47 +0000
committerVincent Sanders <vince@kyllikki.org>2017-02-19 11:39:47 +0000
commitae45b18b459fa4f490501a93459e49f1f1038073 (patch)
treef0d8a3356a74c0a448f6d8ad5f4e4b22fc3c384c
parent67b22a811128f5a0635430151a73442d1f100735 (diff)
parent0f69965805dda51cc7b6ea8404226d5f75a3b533 (diff)
downloadnetsurf-ae45b18b459fa4f490501a93459e49f1f1038073.tar.gz
netsurf-ae45b18b459fa4f490501a93459e49f1f1038073.tar.bz2
Merge branch 'vince/localhist-corewin'
-rw-r--r--content/fetch.c4
-rw-r--r--desktop/Makefile2
-rw-r--r--desktop/hotlist.h1
-rw-r--r--desktop/local_history.c135
-rw-r--r--desktop/local_history.h110
-rw-r--r--desktop/scrollbar.c11
-rwxr-xr-xfrontends/amiga/bitmap.h3
-rw-r--r--frontends/amiga/cookies.c4
-rw-r--r--frontends/amiga/corewindow.c12
-rw-r--r--frontends/amiga/corewindow.h2
-rw-r--r--frontends/amiga/history.c6
-rw-r--r--frontends/amiga/hotlist.c5
-rw-r--r--frontends/amiga/sslcert.c2
-rw-r--r--frontends/beos/plotters.cpp14
-rw-r--r--frontends/gtk/Makefile10
-rw-r--r--frontends/gtk/global_history.c8
-rw-r--r--frontends/gtk/local_history.c284
-rw-r--r--frontends/gtk/local_history.h49
-rw-r--r--frontends/gtk/res/globalhistory.gtk2.ui (renamed from frontends/gtk/res/history.gtk2.ui)0
-rw-r--r--frontends/gtk/res/globalhistory.gtk3.ui (renamed from frontends/gtk/res/history.gtk3.ui)0
-rw-r--r--frontends/gtk/res/localhistory.gtk2.ui45
-rw-r--r--frontends/gtk/res/localhistory.gtk3.ui45
-rw-r--r--frontends/gtk/res/netsurf.gresource.xml42
-rw-r--r--frontends/gtk/resources.c3
-rw-r--r--frontends/gtk/scaffolding.c178
-rw-r--r--frontends/gtk/window.c4
-rw-r--r--frontends/riscos/corewindow.c4
-rw-r--r--frontends/riscos/corewindow.h4
-rw-r--r--frontends/riscos/plotters.c10
-rw-r--r--frontends/windows/cookies.c17
-rw-r--r--frontends/windows/global_history.c2
-rw-r--r--frontends/windows/hotlist.c2
-rw-r--r--frontends/windows/localhistory.c14
-rw-r--r--frontends/windows/localhistory.h22
-rw-r--r--frontends/windows/ssl_cert.c10
-rw-r--r--frontends/windows/window.c7
-rw-r--r--utils/nsoption.h4
37 files changed, 813 insertions, 262 deletions
diff --git a/content/fetch.c b/content/fetch.c
index a1542eb01..a69d3e4cf 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -26,8 +26,8 @@
* around the fetcher specific methods.
*
* Active fetches are held in the circular linked list ::fetch_ring. There may
- * be at most ::option_max_fetchers_per_host active requests per Host: header.
- * There may be at most ::option_max_fetchers active requests overall. Inactive
+ * be at most nsoption max_fetchers_per_host active requests per Host: header.
+ * There may be at most nsoption max_fetchers active requests overall. Inactive
* fetches are stored in the ::queue_ring waiting for use.
*/
diff --git a/desktop/Makefile b/desktop/Makefile
index 2dcd61611..ffd932177 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -3,7 +3,7 @@
S_DESKTOP := cookie_manager.c knockout.c hotlist.c mouse.c \
plot_style.c print.c search.c searchweb.c scrollbar.c \
sslcert_viewer.c textarea.c version.c system_colour.c \
- global_history.c treeview.c
+ local_history.c global_history.c treeview.c
S_DESKTOP := $(addprefix desktop/,$(S_DESKTOP))
diff --git a/desktop/hotlist.h b/desktop/hotlist.h
index c77ac92d2..ef54f6b8b 100644
--- a/desktop/hotlist.h
+++ b/desktop/hotlist.h
@@ -67,7 +67,6 @@ nserror hotlist_manager_init(struct core_window_callback_table *cw_t,
* allowing destruction of a GUI hotlist window, without finalising the
* hotlist module.
*
- * \param path The path to save hotlist to
* \return NSERROR_OK on success, appropriate error otherwise
*/
nserror hotlist_manager_fini(void);
diff --git a/desktop/local_history.c b/desktop/local_history.c
new file mode 100644
index 000000000..05e4b5e18
--- /dev/null
+++ b/desktop/local_history.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * 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
+ * Local history viewer implementation
+ */
+
+#include <stdlib.h>
+
+#include "netsurf/types.h"
+#include "netsurf/core_window.h"
+
+#include "desktop/browser_history.h"
+#include "desktop/local_history.h"
+
+struct local_history_session {
+ struct browser_window *bw;
+ struct core_window_callback_table *cw_t;
+ void *core_window_handle;
+};
+
+/* exported interface documented in desktop/local_history.h */
+nserror local_history_init(struct core_window_callback_table *cw_t,
+ void *core_window_handle,
+ struct browser_window *bw,
+ struct local_history_session **session)
+{
+ struct local_history_session *nses;
+
+ nses = calloc(1, sizeof(struct local_history_session));
+ if (nses == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ nses->cw_t = cw_t;
+ nses->core_window_handle = core_window_handle;
+
+ local_history_set(nses, bw);
+
+ *session = nses;
+ return NSERROR_OK;
+}
+
+/* exported interface documented in desktop/local_history.h */
+nserror local_history_fini(struct local_history_session *session)
+{
+ free(session);
+
+ return NSERROR_OK;
+}
+
+
+/* exported interface documented in desktop/local_history.h */
+nserror
+local_history_redraw(struct local_history_session *session,
+ int x,
+ int y,
+ struct rect *clip,
+ const struct redraw_context *ctx)
+{
+ if (session->bw != NULL) {
+ browser_window_history_redraw_rectangle(session->bw,
+ clip->x0, clip->y0, clip->x1, clip->y1, x, y, ctx);
+ }
+ return NSERROR_OK;
+}
+
+/* exported interface documented in desktop/local_history.h */
+void
+local_history_mouse_action(struct local_history_session *session,
+ enum browser_mouse_state mouse,
+ int x,
+ int y)
+{
+ if (mouse & BROWSER_MOUSE_PRESS_1) {
+ browser_window_history_click(session->bw, x, y, false);
+ }
+}
+
+/* exported interface documented in desktop/local_history.h */
+bool
+local_history_keypress(struct local_history_session *session, uint32_t key)
+{
+ return false;
+}
+
+/* exported interface documented in desktop/local_history.h */
+nserror
+local_history_set(struct local_history_session *session,
+ struct browser_window *bw)
+{
+ int width;
+ int height;
+
+ session->bw = bw;
+ if (bw != NULL) {
+ browser_window_history_size(session->bw, &width, &height);
+
+ session->cw_t->update_size(session->core_window_handle,
+ width, height);
+ }
+
+ return NSERROR_OK;
+}
+
+
+/* exported interface documented in desktop/local_history.h */
+nserror
+local_history_get_size(struct local_history_session *session,
+ int *width,
+ int *height)
+{
+
+ browser_window_history_size(session->bw, width, height);
+ *width += 20;
+ *height += 20;
+
+ return NSERROR_OK;
+}
diff --git a/desktop/local_history.h b/desktop/local_history.h
new file mode 100644
index 000000000..a23cbd3ed
--- /dev/null
+++ b/desktop/local_history.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * 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 NETSURF_DESKTOP_LOCAL_HISTORY_H
+#define NETSURF_DESKTOP_LOCAL_HISTORY_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "utils/errors.h"
+#include "netsurf/mouse.h"
+
+struct core_window_callback_table;
+struct redraw_context;
+struct nsurl;
+struct rect;
+struct local_history_session;
+struct browser_window;
+
+/**
+ * Initialise the global history.
+ *
+ * This iterates through the URL database, generating the global history data,
+ * and creates a treeview.
+ *
+ * This must be called before any other local_history_* function.
+ *
+ * \param cw_t Callback table for core_window containing the treeview.
+ * \param core_window_handle The core_window in which the treeview is shown.
+ * \param[out] session The created local history session context.
+ * \return NSERROR_OK on success and session set, appropriate error code otherwise
+ */
+nserror local_history_init(struct core_window_callback_table *cw_t,
+ void *core_window_handle,
+ struct browser_window *bw,
+ struct local_history_session **session);
+
+/**
+ * Finalise the global history.
+ *
+ * This destroys the global history treeview and the global history module's
+ * internal data. After calling this if global history is required again,
+ * local_history_init must be called.
+ *
+ * \param session The local history session to finalise.
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror local_history_fini(struct local_history_session *session);
+
+
+/**
+ * Redraw the global history.
+ *
+ * \param session The local history session context.
+ * \param x X coordinate to render treeview at
+ * \param y Y coordinate to render treeview at
+ * \param clip Current clip rectangle (wrt tree origin)
+ * \param ctx Current redraw context
+ */
+nserror local_history_redraw(struct local_history_session *session, int x, int y, struct rect *clip, const struct redraw_context *ctx);
+
+/**
+ * Handles all kinds of mouse action
+ *
+ * \param session The local history session context.
+ * \param mouse The current mouse state
+ * \param x X coordinate
+ * \param y Y coordinate
+ */
+void local_history_mouse_action(struct local_history_session *session, enum browser_mouse_state mouse, int x, int y);
+
+/**
+ * Key press handling.
+ *
+ * \param key The ucs4 character codepoint
+ * \param session The local history session context.
+ * \return true if the keypress is dealt with, false otherwise.
+ */
+bool local_history_keypress(struct local_history_session *session, uint32_t key);
+
+/**
+ * Change the browser window to draw local history for.
+ *
+ * \param session The local history session context.
+ */
+nserror local_history_set(struct local_history_session *session, struct browser_window *bw);
+
+/**
+ * get size of local history content area
+ *
+ * \param session The local history session context.
+ */
+nserror local_history_get_size(struct local_history_session *session, int *width, int *height);
+
+#endif
diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c
index 3709af8b4..4f3043416 100644
--- a/desktop/scrollbar.c
+++ b/desktop/scrollbar.c
@@ -128,15 +128,12 @@ void scrollbar_destroy(struct scrollbar *s)
/**
* Draw an outline rectangle common to several scrollbar elements.
*
- * \param x0 left border of the outline
- * \param y0 top border of the outline
- * \param x1 right border of the outline
- * \param y1 bottom border of the outline
- * \param c base colour of the outline, the other colours are created by
+ * \param ctx current redraw context
+ * \param area the area of the scrollbar
+ * \param c base colour of the outline, the other colours are created by
* lightening or darkening this one
- * \param ctx current redraw context
* \param inset true for inset outline, false for an outset one
- * \return
+ * \return NSERROR_OK on success else error code
*/
static inline nserror
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 17939d79a..aaec26ac2 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -76,8 +76,7 @@ void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
/**
* Free an icondata pointer
*
- * \param bm a bitmap, as returned by bitmap_create()
- * \param icondata a pointer to memory
+ * \param bm a bitmap, as returned by bitmap_create()
*
* This function probably shouldn't be here!
*/
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 877805cda..fd71a9c2a 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -136,7 +136,7 @@ ami_cookies_mouse(struct ami_corewindow *ami_cw,
/**
* callback for keypress for cookies viewer on core window
*
- * \param example_cw The Amiga core window structure.
+ * \param ami_cw The Amiga core window structure.
* \param nskey The netsurf key code
* \return NSERROR_OK on success otherwise apropriate error code
*/
@@ -153,6 +153,8 @@ ami_cookies_key(struct ami_corewindow *ami_cw, uint32_t nskey)
* callback on draw event for cookies viewer on core window
*
* \param ami_cw The Amiga core window structure.
+ * \param x The x cordinate to plot at
+ * \param y The y cordinate to plot at
* \param r The rectangle of the window that needs updating.
* \param ctx The drawing context
* \return NSERROR_OK on success otherwise apropriate error code
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 84861e073..86c21b8a1 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -203,15 +203,16 @@ ami_cw_key(struct ami_corewindow *ami_cw, int nskey)
/**
* Redraw functions
*
- * This is slightly over-engineered as it was taken from the main browser/old tree redraws
- * and supports deferred drawing of rectangles and tiling
+ * This is slightly over-engineered as it was taken from the main
+ * browser/old tree redraws and supports deferred drawing of
+ * rectangles and tiling
*/
/**
* Redraw an area of a core window
*
- * \param g a struct ami_corewindow
- * \param r rect (in document co-ordinates)
+ * \param ami_cw An Amiga core window structure
+ * \param r rect (in document co-ordinates)
*/
static void
@@ -302,7 +303,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
/**
* Draw the deferred rectangles
*
- * @param draw set to false to just delete the queue
+ * \param ami_cw An Amiga core window structure to queue redraw
+ * \param draw set to false to just delete the queue
*/
static void ami_cw_redraw_queue(struct ami_corewindow *ami_cw, bool draw)
{
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index cc4fe4adb..ea01f67f1 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -171,7 +171,7 @@ struct ami_corewindow {
*
* As a pre-requisite the draw, key and mouse callbacks must be defined
*
- * \param example_cw An Amiga core window structure to initialise
+ * \param ami_cw An Amiga core window structure to initialise
* \return NSERROR_OK on successful initialisation otherwise error code.
*/
nserror ami_corewindow_init(struct ami_corewindow *ami_cw);
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 12c306a9b..7fc1ec333 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -162,12 +162,16 @@ ami_history_global_key(struct ami_corewindow *ami_cw, uint32_t nskey)
* callback on draw event for history viewer on core window
*
* \param ami_cw The Amiga core window structure.
+ * \param x The x coordinate of global history area to redraw
+ * \param y The y coordinate of global history area to redraw
* \param r The rectangle of the window that needs updating.
* \param ctx The drawing context
* \return NSERROR_OK on success otherwise apropriate error code
*/
static nserror
-ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+ami_history_global_draw(struct ami_corewindow *ami_cw,
+ int x, int y, struct rect *r,
+ struct redraw_context *ctx)
{
global_history_redraw(x, y, r, ctx);
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index 008e45a24..c0a6b6f58 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -213,12 +213,15 @@ ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
* callback on draw event for hotlist viewer on core window
*
* \param ami_cw The Amiga core window structure.
+ * \param x The x coordinate of hotlist area to redraw
+ * \param y The y coordinate of hotlist area to redraw
* \param r The rectangle of the window that needs updating.
* \param ctx The drawing context
* \return NSERROR_OK on success otherwise apropriate error code
*/
static nserror
-ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+ami_hotlist_draw(struct ami_corewindow *ami_cw,
+ int x, int y, struct rect *r, struct redraw_context *ctx)
{
hotlist_redraw(x, y, r, ctx);
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index 47126a011..eeb34108a 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -172,7 +172,7 @@ ami_crtvrfy_mouse(struct ami_corewindow *ami_cw,
/**
* callback for keypress for certificate verify on core window
*
- * \param example_cw The Amiga core window structure.
+ * \param ami_cw The Amiga core window structure.
* \param nskey The netsurf key code
* \return NSERROR_OK on success otherwise apropriate error code
*/
diff --git a/frontends/beos/plotters.cpp b/frontends/beos/plotters.cpp
index 83a470d97..c77e6353e 100644
--- a/frontends/beos/plotters.cpp
+++ b/frontends/beos/plotters.cpp
@@ -20,7 +20,7 @@
/**
* \file
- * Target independent plotting (BeOS/Haiku implementation).
+ * BeOS/Haiku implementation target independent plotting.
*/
#define __STDBOOL_H__ 1
@@ -254,7 +254,7 @@ nsbeos_plot_clip(const struct redraw_context *ctx, const struct rect *ns_clip)
* horizontal, in degrees.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the arc plot.
+ * \param style Style controlling the arc plot.
* \param x The x coordinate of the arc.
* \param y The y coordinate of the arc.
* \param radius The radius of the arc.
@@ -294,7 +294,7 @@ nsbeos_plot_arc(const struct redraw_context *ctx,
* Plot a circle centered on (x,y), which is optionally filled.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the circle plot.
+ * \param style Style controlling the circle plot.
* \param x x coordinate of circle centre.
* \param y y coordinate of circle centre.
* \param radius circle radius.
@@ -334,7 +334,7 @@ nsbeos_plot_disc(const struct redraw_context *ctx,
* centre of line width/thickness.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the line plot.
+ * \param style Style controlling the line plot.
* \param line A rectangle defining the line to be drawn
* \return NSERROR_OK on success else error code.
*/
@@ -393,8 +393,8 @@ nsbeos_plot_line(const struct redraw_context *ctx,
* width and height.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the rectangle plot.
- * \param rect A rectangle defining the line to be drawn
+ * \param style Style controlling the rectangle plot.
+ * \param nsrect A rectangle defining the line to be drawn
* \return NSERROR_OK on success else error code.
*/
static nserror
@@ -470,7 +470,7 @@ nsbeos_plot_rectangle(const struct redraw_context *ctx,
* rule.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the polygon plot.
+ * \param style Style controlling the polygon plot.
* \param p verticies of polygon
* \param n number of verticies.
* \return NSERROR_OK on success else error code.
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index afbfcd791..6c2f06f06 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -165,11 +165,11 @@ endif
# S_FRONTEND are sources purely for the GTK frontend
S_FRONTEND := gui.c schedule.c layout_pango.c bitmap.c plotters.c \
- scaffolding.c gdk.c completion.c login.c throbber.c \
- selection.c global_history.c window.c fetch.c download.c menu.c \
- print.c search.c tabs.c toolbar.c gettext.c \
- compat.c cookies.c hotlist.c viewdata.c viewsource.c \
- preferences.c about.c ssl_cert.c resources.c corewindow.c
+ scaffolding.c gdk.c completion.c login.c throbber.c \
+ selection.c window.c fetch.c download.c menu.c print.c \
+ search.c tabs.c toolbar.c gettext.c compat.c viewdata.c \
+ viewsource.c preferences.c about.c resources.c corewindow.c \
+ local_history.c global_history.c cookies.c hotlist.c ssl_cert.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
diff --git a/frontends/gtk/global_history.c b/frontends/gtk/global_history.c
index 7d647057b..66ba1a666 100644
--- a/frontends/gtk/global_history.c
+++ b/frontends/gtk/global_history.c
@@ -228,7 +228,7 @@ nsgtk_global_history_init_menu(struct nsgtk_global_history_window *ghwin)
/**
- * callback for mouse action on cookie window
+ * callback for mouse action on global history window
*
* \param nsgtk_cw The nsgtk core window structure.
* \param mouse_state netsurf mouse state on event
@@ -248,7 +248,7 @@ nsgtk_global_history_mouse(struct nsgtk_corewindow *nsgtk_cw,
/**
- * callback for keypress on cookie window
+ * callback for keypress on global history window
*
* \param nsgtk_cw The nsgtk core window structure.
* \param nskey The netsurf key code
@@ -265,7 +265,7 @@ nsgtk_global_history_key(struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey)
/**
- * callback on draw event for cookie window
+ * callback on draw event for global history window
*
* \param nsgtk_cw The nsgtk core window structure.
* \param r The rectangle of the window that needs updating.
@@ -304,7 +304,7 @@ static nserror nsgtk_global_history_init(void)
return NSERROR_NOMEM;
}
- res = nsgtk_builder_new_from_resname("history", &ncwin->builder);
+ res = nsgtk_builder_new_from_resname("globalhistory", &ncwin->builder);
if (res != NSERROR_OK) {
LOG("History UI builder init failed");
free(ncwin);
diff --git a/frontends/gtk/local_history.c b/frontends/gtk/local_history.c
new file mode 100644
index 000000000..db13aa4da
--- /dev/null
+++ b/frontends/gtk/local_history.c
@@ -0,0 +1,284 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * 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
+ * Implementation of GTK local history manager.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+
+#include "utils/log.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "desktop/local_history.h"
+
+#include "gtk/compat.h"
+#include "gtk/plotters.h"
+#include "gtk/resources.h"
+#include "gtk/corewindow.h"
+#include "gtk/local_history.h"
+
+struct nsgtk_local_history_window {
+ struct nsgtk_corewindow core;
+
+ GtkBuilder *builder;
+
+ GtkWindow *wnd;
+
+ struct local_history_session *session;
+};
+
+static struct nsgtk_local_history_window *local_history_window = NULL;
+
+
+
+/**
+ * callback for mouse action on local history window
+ *
+ * \param nsgtk_cw The nsgtk core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsgtk_local_history_mouse(struct nsgtk_corewindow *nsgtk_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct nsgtk_local_history_window *lhw;
+ /* technically degenerate container of */
+ lhw = (struct nsgtk_local_history_window *)nsgtk_cw;
+
+ local_history_mouse_action(lhw->session, mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * callback for keypress on local history window
+ *
+ * \param nsgtk_cw The nsgtk core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsgtk_local_history_key(struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey)
+{
+ struct nsgtk_local_history_window *lhw;
+ /* technically degenerate container of */
+ lhw = (struct nsgtk_local_history_window *)nsgtk_cw;
+
+ if (local_history_keypress(lhw->session, nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+
+/**
+ * callback on draw event for local history window
+ *
+ * \param nsgtk_cw The nsgtk core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsgtk_local_history_draw(struct nsgtk_corewindow *nsgtk_cw, struct rect *r)
+{
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &nsgtk_plotters
+ };
+ struct nsgtk_local_history_window *lhw;
+ GtkAdjustment *vscroll;
+ GtkAdjustment *hscroll;
+ struct rect c;
+ int vscroll_val;
+ int hscroll_val;
+
+ vscroll = gtk_scrolled_window_get_vadjustment(nsgtk_cw->scrolled);
+ hscroll = gtk_scrolled_window_get_hadjustment(nsgtk_cw->scrolled);
+ vscroll_val = gtk_adjustment_get_value(vscroll);
+ hscroll_val = gtk_adjustment_get_value(hscroll);
+
+
+ /* technically degenerate container of */
+ lhw = (struct nsgtk_local_history_window *)nsgtk_cw;
+ c.x0 = r->x0 + hscroll_val;
+ c.y0 = r->y0 + vscroll_val;
+ c.x1 = r->x1 + hscroll_val;
+ c.y1 = r->y1 + vscroll_val;
+
+ ctx.plot->clip(&ctx, r);
+ local_history_redraw(lhw->session, r->x0, r->y0, r, &ctx);
+
+ return NSERROR_OK;
+}
+
+/**
+ * Creates the window for the local history view.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+static nserror
+nsgtk_local_history_init(struct browser_window *bw,
+ struct nsgtk_local_history_window **win_out)
+{
+ struct nsgtk_local_history_window *ncwin;
+ nserror res;
+
+ /* memoise window so it can be represented when necessary
+ * instead of recreating every time.
+ */
+ if ((*win_out) != NULL) {
+ res = local_history_set((*win_out)->session, bw);
+ return res;
+ }
+
+ ncwin = malloc(sizeof(struct nsgtk_local_history_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ res = nsgtk_builder_new_from_resname("localhistory", &ncwin->builder);
+ if (res != NSERROR_OK) {
+ LOG("Local history UI builder init failed");
+ free(ncwin);
+ return res;
+ }
+
+ gtk_builder_connect_signals(ncwin->builder, NULL);
+
+ ncwin->wnd = GTK_WINDOW(gtk_builder_get_object(ncwin->builder,
+ "wndHistory"));
+
+ ncwin->core.scrolled = GTK_SCROLLED_WINDOW(
+ gtk_builder_get_object(ncwin->builder,
+ "HistoryScrolled"));
+
+ ncwin->core.drawing_area = GTK_DRAWING_AREA(
+ gtk_builder_get_object(ncwin->builder,
+ "HistoryDrawingArea"));
+
+ /* make the delete event hide the window */
+ g_signal_connect(G_OBJECT(ncwin->wnd),
+ "delete_event",
+ G_CALLBACK(gtk_widget_hide_on_delete),
+ NULL);
+
+ ncwin->core.draw = nsgtk_local_history_draw;
+ ncwin->core.key = nsgtk_local_history_key;
+ ncwin->core.mouse = nsgtk_local_history_mouse;
+
+ res = nsgtk_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ *win_out = ncwin;
+
+ return NSERROR_OK;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror nsgtk_local_history_present(GtkWindow *parent,
+ struct browser_window *bw)
+{
+ nserror res;
+ int prnt_width, prnt_height;
+ int width, height;
+ res = nsgtk_local_history_init(bw, &local_history_window);
+ if (res == NSERROR_OK) {
+ gtk_window_set_transient_for(local_history_window->wnd, parent);
+
+ gtk_window_get_size(parent, &prnt_width, &prnt_height);
+
+ /* resize history widget ensureing the drawing area is
+ * no larger than parent window
+ */
+ res = local_history_get_size(local_history_window->session,
+ &width,
+ &height);
+ if (width > prnt_width) {
+ width = prnt_width;
+ }
+ if (height > prnt_height) {
+ height = prnt_height;
+ }
+ gtk_window_resize(local_history_window->wnd, width, height);
+
+ gtk_window_present(local_history_window->wnd);
+ }
+
+ return res;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror nsgtk_local_history_hide(void)
+{
+ nserror res = NSERROR_OK;
+
+ if (local_history_window != NULL) {
+ gtk_widget_hide(GTK_WIDGET(local_history_window->wnd));
+
+ res = local_history_set(local_history_window->session, NULL);
+ }
+
+ return res;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror nsgtk_local_history_destroy(void)
+{
+ nserror res;
+
+ if (local_history_window == NULL) {
+ return NSERROR_OK;
+ }
+
+ res = local_history_fini(local_history_window->session);
+ if (res == NSERROR_OK) {
+ res = nsgtk_corewindow_fini(&local_history_window->core);
+ gtk_widget_destroy(GTK_WIDGET(local_history_window->wnd));
+ g_object_unref(G_OBJECT(local_history_window->builder));
+ free(local_history_window);
+ local_history_window = NULL;
+ }
+
+ return res;
+
+}
diff --git a/frontends/gtk/local_history.h b/frontends/gtk/local_history.h
new file mode 100644
index 000000000..605405ddf
--- /dev/null
+++ b/frontends/gtk/local_history.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@kyllikki.org>
+ *
+ * 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
+ * Interface to GTK local history manager
+ */
+
+#ifndef NSGTK_LOCAL_HISTORY_H
+#define NSGTK_LOCAL_HISTORY_H
+
+struct browser_window;
+
+/**
+ * make the local history window visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror nsgtk_local_history_present(GtkWindow *parent, struct browser_window *bw);
+
+/**
+ * hide the local history window from being visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror nsgtk_local_history_hide(void);
+
+/**
+ * Destroys the local history window and performs any other necessary cleanup
+ * actions.
+ */
+nserror nsgtk_local_history_destroy(void);
+
+#endif
diff --git a/frontends/gtk/res/history.gtk2.ui b/frontends/gtk/res/globalhistory.gtk2.ui
index 2b89ecb4b..2b89ecb4b 100644
--- a/frontends/gtk/res/history.gtk2.ui
+++ b/frontends/gtk/res/globalhistory.gtk2.ui
diff --git a/frontends/gtk/res/history.gtk3.ui b/frontends/gtk/res/globalhistory.gtk3.ui
index 7fa598f1e..7fa598f1e 100644
--- a/frontends/gtk/res/history.gtk3.ui
+++ b/frontends/gtk/res/globalhistory.gtk3.ui
diff --git a/frontends/gtk/res/localhistory.gtk2.ui b/frontends/gtk/res/localhistory.gtk2.ui
new file mode 100644
index 000000000..9512b6289
--- /dev/null
+++ b/frontends/gtk/res/localhistory.gtk2.ui
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="wndHistory">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">NetSurf Local History</property>
+ <property name="window_position">center</property>
+ <property name="default_width">20</property>
+ <property name="default_height">20</property>
+ <property name="type_hint">utility</property>
+ <property name="decorated">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkScrolledWindow" id="HistoryScrolled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkViewport" id="HistoryViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="resize_mode">queue</property>
+ <child>
+ <object class="GtkDrawingArea" id="HistoryDrawingArea">
+ <property name="visible">True</property>
+ <property name="app_paintable">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/frontends/gtk/res/localhistory.gtk3.ui b/frontends/gtk/res/localhistory.gtk3.ui
new file mode 100644
index 000000000..1a4b9004d
--- /dev/null
+++ b/frontends/gtk/res/localhistory.gtk3.ui
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="wndHistory">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">NetSurf Local History</property>
+ <property name="window_position">center</property>
+ <property name="default_width">20</property>
+ <property name="default_height">20</property>
+ <property name="type_hint">utility</property>
+ <property name="decorated">False</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="HistoryScrolled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport" id="HistoryViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="HistoryDrawingArea">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/frontends/gtk/res/netsurf.gresource.xml b/frontends/gtk/res/netsurf.gresource.xml
index c7626b053..5bae777f3 100644
--- a/frontends/gtk/res/netsurf.gresource.xml
+++ b/frontends/gtk/res/netsurf.gresource.xml
@@ -2,30 +2,32 @@
<gresources>
<gresource prefix="/org/netsurf">
<file>cookies.gtk2.ui</file>
- <file>history.gtk3.ui</file>
- <file>netsurf.gtk2.ui</file>
- <file>password.gtk3.ui</file>
- <file>toolbar.gtk2.ui</file>
+ <file>globalhistory.gtk3.ui</file>
+ <file>localhistory.gtk3.ui</file>
+ <file>netsurf.gtk2.ui</file>
+ <file>password.gtk3.ui</file>
+ <file>toolbar.gtk2.ui</file>
<file>warning.gtk3.ui</file>
- <file>cookies.gtk3.ui</file>
- <file>hotlist.gtk2.ui</file>
- <file>netsurf.gtk3.ui</file>
- <file>ssl.gtk2.ui</file>
+ <file>cookies.gtk3.ui</file>
+ <file>hotlist.gtk2.ui</file>
+ <file>netsurf.gtk3.ui</file>
+ <file>ssl.gtk2.ui</file>
<file>toolbar.gtk3.ui</file>
- <file>downloads.gtk2.ui</file>
- <file>hotlist.gtk3.ui</file>
- <file>options.gtk2.ui</file>
- <file>ssl.gtk3.ui</file>
+ <file>downloads.gtk2.ui</file>
+ <file>hotlist.gtk3.ui</file>
+ <file>options.gtk2.ui</file>
+ <file>ssl.gtk3.ui</file>
<file>viewdata.gtk2.ui</file>
- <file>downloads.gtk3.ui</file>
- <file>login.gtk2.ui</file>
- <file>options.gtk3.ui</file>
- <file>tabcontents.gtk2.ui</file>
+ <file>downloads.gtk3.ui</file>
+ <file>login.gtk2.ui</file>
+ <file>options.gtk3.ui</file>
+ <file>tabcontents.gtk2.ui</file>
<file>viewdata.gtk3.ui</file>
- <file>history.gtk2.ui</file>
- <file>login.gtk3.ui</file>
- <file>password.gtk2.ui</file>
- <file>tabcontents.gtk3.ui</file>
+ <file>localhistory.gtk2.ui</file>
+ <file>globalhistory.gtk2.ui</file>
+ <file>login.gtk3.ui</file>
+ <file>password.gtk2.ui</file>
+ <file>tabcontents.gtk3.ui</file>
<file>warning.gtk2.ui</file>
<file preprocess="to-pixdata">favicon.png</file>
<file preprocess="to-pixdata">netsurf.xpm</file>
diff --git a/frontends/gtk/resources.c b/frontends/gtk/resources.c
index dfe3d3dad..4f9afb034 100644
--- a/frontends/gtk/resources.c
+++ b/frontends/gtk/resources.c
@@ -81,7 +81,8 @@ static struct nsgtk_resource_s ui_resource[] = {
RES_ENTRY("ssl"),
RES_ENTRY("toolbar"),
RES_ENTRY("downloads"),
- RES_ENTRY("history"),
+ RES_ENTRY("globalhistory"),
+ RES_ENTRY("localhistory"),
RES_ENTRY("options"),
RES_ENTRY("hotlist"),
RES_ENTRY("cookies"),
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 7a40d6656..7593fc383 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -61,6 +61,7 @@
#include "gtk/bitmap.h"
#include "gtk/gui.h"
#include "gtk/global_history.h"
+#include "gtk/local_history.h"
#include "gtk/hotlist.h"
#include "gtk/download.h"
#include "gtk/menu.h"
@@ -109,9 +110,6 @@ struct nsgtk_scaffolding {
/** currently active gui browsing context */
struct gui_window *top_level;
- /** local history window */
- struct gtk_history_window *history_window;
-
/** Builder object scaffold was created from */
GtkBuilder *builder;
@@ -247,9 +245,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
LOG("scaffold:%p", gs);
- if ((gs->history_window) && (gs->history_window->window)) {
- gtk_widget_destroy(GTK_WIDGET(gs->history_window->window));
- }
+ nsgtk_local_history_hide();
if (gs->prev != NULL) {
gs->prev->next = gs->next;
@@ -287,7 +283,6 @@ static gboolean scaffolding_window_delete_event(GtkWidget *widget,
*/
static void scaffolding_update_context(struct nsgtk_scaffolding *g)
{
- int width, height;
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
g->buttons[BACK_BUTTON]->sensitivity =
@@ -300,13 +295,7 @@ static void scaffolding_update_context(struct nsgtk_scaffolding *g)
/* update the url bar, particularly necessary when tabbing */
browser_window_refresh_url_bar(bw);
- /* update the local history window, as well as queuing a redraw
- * for it.
- */
- browser_window_history_size(bw, &width, &height);
- gtk_widget_set_size_request(GTK_WIDGET(g->history_window->drawing_area),
- width, height);
- gtk_widget_queue_draw(GTK_WIDGET(g->history_window->drawing_area));
+ nsgtk_local_history_hide();
}
/**
@@ -1466,31 +1455,12 @@ MULTIHANDLER(home)
MULTIHANDLER(localhistory)
{
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
+ nserror res;
- int x,y, width, height, mainwidth, mainheight, margin = 20;
- /* if entries of the same url but different frag_ids have been added
- * the history needs redrawing (what throbber code normally does)
- */
-
- scaffolding_update_context(g);
- gtk_window_get_position(g->window, &x, &y);
- gtk_window_get_size(g->window, &mainwidth, &mainheight);
- browser_window_history_size(bw, &width, &height);
- width = (width + g->historybase + margin > mainwidth) ?
- mainwidth - g->historybase : width + margin;
- height = (height + g->toolbarbase + margin > mainheight) ?
- mainheight - g->toolbarbase : height + margin;
- gtk_window_set_default_size(g->history_window->window, width, height);
- gtk_widget_set_size_request(GTK_WIDGET(g->history_window->window),
- -1, -1);
- gtk_window_resize(g->history_window->window, width, height);
- gtk_window_set_transient_for(g->history_window->window, g->window);
- nsgtk_window_set_opacity(g->history_window->window, 0.9);
- gtk_widget_show(GTK_WIDGET(g->history_window->window));
- gtk_window_move(g->history_window->window, x + g->historybase, y +
- g->toolbarbase);
- gdk_window_raise(nsgtk_widget_get_window(GTK_WIDGET(g->history_window->window)));
-
+ res = nsgtk_local_history_present(g->window, bw);
+ if (res != NSERROR_OK) {
+ LOG("Unable to initialise local history window.");
+ }
return TRUE;
}
@@ -1643,91 +1613,6 @@ BUTTONHANDLER(history)
#undef CHECKHANDLER
#undef BUTTONHANDLER
-#if GTK_CHECK_VERSION(3,0,0)
-
-static gboolean
-nsgtk_history_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
-{
- struct rect clip;
- struct gtk_history_window *hw = (struct gtk_history_window *)data;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &nsgtk_plotters
- };
- double x1;
- double y1;
- double x2;
- double y2;
-
- current_cr = cr;
-
- cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
-
- clip.x0 = x1;
- clip.y0 = y1;
- clip.x1 = x2;
- clip.y1 = y2;
-
- ctx.plot->clip(&ctx, &clip);
-
- browser_window_history_redraw(bw, &ctx);
-
- return FALSE;
-}
-#else
-
-/* signal handler functions for the local history window */
-static gboolean
-nsgtk_history_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer g)
-{
- struct rect clip;
- struct gtk_history_window *hw = (struct gtk_history_window *)g;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &nsgtk_plotters
- };
-
- current_cr = gdk_cairo_create(nsgtk_widget_get_window(widget));
-
- clip.x0 = event->area.x;
- clip.y0 = event->area.y;
- clip.x1 = event->area.x + event->area.width;
- clip.y1 = event->area.y + event->area.height;
- ctx.plot->clip(&ctx, &clip);
-
- browser_window_history_redraw(bw, &ctx);
-
- cairo_destroy(current_cr);
-
- return FALSE;
-}
-
-#endif /* GTK_CHECK_VERSION(3,0,0) */
-
-static gboolean nsgtk_history_button_press_event(GtkWidget *widget,
- GdkEventButton *event, gpointer g)
-{
- struct gtk_history_window *hw = (struct gtk_history_window *)g;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- LOG("X=%g, Y=%g", event->x, event->y);
-
- browser_window_history_click(bw, event->x, event->y, false);
-
- return TRUE;
-}
-
-
-
static void nsgtk_attach_menu_handlers(struct nsgtk_scaffolding *g)
{
for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
@@ -2181,35 +2066,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
gtk_widget_set_size_request(GTK_WIDGET(
gs->buttons[HISTORY_BUTTON]->button), 20, -1);
- /* create the local history window to be associated with this scaffold */
- gs->history_window = malloc(sizeof(struct gtk_history_window));
- gs->history_window->g = gs;
- gs->history_window->window =
- GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
- gtk_window_set_transient_for(gs->history_window->window, gs->window);
- gtk_window_set_title(gs->history_window->window, "NetSurf History");
- gtk_window_set_type_hint(gs->history_window->window,
- GDK_WINDOW_TYPE_HINT_UTILITY);
- gs->history_window->scrolled =
- GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(0, 0));
- gtk_container_add(GTK_CONTAINER(gs->history_window->window),
- GTK_WIDGET(gs->history_window->scrolled));
-
- gtk_widget_show(GTK_WIDGET(gs->history_window->scrolled));
- gs->history_window->drawing_area =
- GTK_DRAWING_AREA(gtk_drawing_area_new());
-
- gtk_widget_set_events(GTK_WIDGET(gs->history_window->drawing_area),
- GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK);
- nsgtk_widget_override_background_color(GTK_WIDGET(gs->history_window->drawing_area),
- GTK_STATE_NORMAL,
- 0, 0xffff, 0xffff, 0xffff);
- nsgtk_scrolled_window_add_with_viewport(gs->history_window->scrolled,
- GTK_WIDGET(gs->history_window->drawing_area));
- gtk_widget_show(GTK_WIDGET(gs->history_window->drawing_area));
-
/* set up URL bar completion */
gs->url_bar_completion = nsgtk_url_entry_completion_new(gs);
@@ -2221,17 +2077,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
#define CONNECT(obj, sig, callback, ptr) \
g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
- /* connect history window signals to their handlers */
- nsgtk_connect_draw_event(GTK_WIDGET(gs->history_window->drawing_area),
- G_CALLBACK(nsgtk_history_draw_event),
- gs->history_window);
- /*CONNECT(gs->history_window->drawing_area, "motion_notify_event",
- nsgtk_history_motion_notify_event, gs->history_window);*/
- CONNECT(gs->history_window->drawing_area, "button_press_event",
- nsgtk_history_button_press_event, gs->history_window);
- CONNECT(gs->history_window->window, "delete_event",
- gtk_widget_hide_on_delete, NULL);
-
g_signal_connect_after(gs->notebook, "page-added",
G_CALLBACK(nsgtk_window_tabs_add), gs);
g_signal_connect_after(gs->notebook, "page-removed",
@@ -2592,13 +2437,6 @@ GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g)
}
/* exported interface documented in gtk/scaffolding.h */
-struct gtk_history_window *
-nsgtk_scaffolding_history_window(struct nsgtk_scaffolding *g)
-{
- return g->history_window;
-}
-
-/* exported interface documented in gtk/scaffolding.h */
struct nsgtk_scaffolding *nsgtk_scaffolding_iterate(struct nsgtk_scaffolding *g)
{
if (g == NULL) {
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index 7432e301e..40e5580b5 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -52,6 +52,7 @@
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
+#include "gtk/local_history.h"
#include "gtk/plotters.h"
#include "gtk/schedule.h"
#include "gtk/tabs.h"
@@ -339,8 +340,7 @@ static gboolean nsgtk_window_button_press_event(GtkWidget *widget,
gtk_im_context_reset(g->input_method);
gtk_widget_grab_focus(GTK_WIDGET(g->layout));
- gtk_widget_hide(GTK_WIDGET(nsgtk_scaffolding_history_window(
- g->scaffold)->window));
+ nsgtk_local_history_hide();
g->mouse.pressed_x = event->x / browser_window_get_scale(g->bw);
g->mouse.pressed_y = event->y / browser_window_get_scale(g->bw);
diff --git a/frontends/riscos/corewindow.c b/frontends/riscos/corewindow.c
index 3219be985..89132853d 100644
--- a/frontends/riscos/corewindow.c
+++ b/frontends/riscos/corewindow.c
@@ -378,7 +378,7 @@ ro_cw_drag_start(struct ro_corewindow *ro_cw,
* The wimp has issued an event to the window because the pointer has
* entered it.
*
- * \param open The open event to be processed
+ * \param entering The entering event to be processed
*/
static void ro_cw_pointer_entering(wimp_entering *entering)
{
@@ -664,6 +664,8 @@ static void cw_tb_update(void *ctx)
* Respond to user actions (click) in a corewindow.
*
* \param ctx Context as passed to toolbar creation.
+ * \param action_type type of action on toolbar
+ * \param action data for action.
*/
static void
cw_tb_click(void *ctx,
diff --git a/frontends/riscos/corewindow.h b/frontends/riscos/corewindow.h
index b340bde35..7d808c298 100644
--- a/frontends/riscos/corewindow.h
+++ b/frontends/riscos/corewindow.h
@@ -123,6 +123,10 @@ struct ro_corewindow {
* As a pre-requisite the draw, key and mouse callbacks must be defined
*
* \param ro_cw A riscos core window structure to initialise
+ * \param tb_buttons toolbar button bar context
+ * \param tb_order The order of toolbar buttons
+ * \param tb_style The style of toolbar buttons
+ * \param tb_help Thh toolbar help text
* \return NSERROR_OK on successful initialisation otherwise error code.
*/
nserror ro_corewindow_init(struct ro_corewindow *ro_cw, const struct button_bar_buttons *tb_buttons, char *tb_order, theme_style tb_style, const char *tb_help);
diff --git a/frontends/riscos/plotters.c b/frontends/riscos/plotters.c
index b12d6c403..b459ba1f9 100644
--- a/frontends/riscos/plotters.c
+++ b/frontends/riscos/plotters.c
@@ -148,7 +148,7 @@ ro_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
* horizontal, in degrees.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the arc plot.
+ * \param style Style controlling the arc plot.
* \param x The x coordinate of the arc.
* \param y The y coordinate of the arc.
* \param radius The radius of the arc.
@@ -214,7 +214,7 @@ ro_plot_arc(const struct redraw_context *ctx,
* Plot a circle centered on (x,y), which is optionally filled.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the circle plot.
+ * \param style Style controlling the circle plot.
* \param x The x coordinate of the circle.
* \param y The y coordinate of the circle.
* \param radius The radius of the circle.
@@ -283,7 +283,7 @@ ro_plot_disc(const struct redraw_context *ctx,
* centre of line width/thickness.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the line plot.
+ * \param style Style controlling the line plot.
* \param line A rectangle defining the line to be drawn
* \return NSERROR_OK on success else error code.
*/
@@ -328,7 +328,7 @@ ro_plot_line(const struct redraw_context *ctx,
* width and height.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the rectangle plot.
+ * \param style Style controlling the rectangle plot.
* \param rect A rectangle defining the line to be drawn
* \return NSERROR_OK on success else error code.
*/
@@ -414,7 +414,7 @@ ro_plot_rectangle(const struct redraw_context *ctx,
* rule.
*
* \param ctx The current redraw context.
- * \param pstyle Style controlling the polygon plot.
+ * \param style Style controlling the polygon plot.
* \param p verticies of polygon
* \param n number of verticies.
* \return NSERROR_OK on success else error code.
diff --git a/frontends/windows/cookies.c b/frontends/windows/cookies.c
index 27949fac1..c4880fa1c 100644
--- a/frontends/windows/cookies.c
+++ b/frontends/windows/cookies.c
@@ -58,6 +58,7 @@ nsw32_cookie_key(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
return NSERROR_NOT_IMPLEMENTED;
}
+
/**
* callback for mouse action on cookie window
*
@@ -69,18 +70,21 @@ nsw32_cookie_key(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
*/
static nserror
nsw32_cookie_mouse(struct nsw32_corewindow *nsw32_cw,
- browser_mouse_state mouse_state,
- int x, int y)
+ browser_mouse_state mouse_state,
+ int x, int y)
{
cookie_manager_mouse_action(mouse_state, x, y);
return NSERROR_OK;
}
+
/**
* callback on draw event for cookie window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
* \return NSERROR_OK on success otherwise apropriate error code
*/
@@ -102,6 +106,12 @@ nsw32_cookie_draw(struct nsw32_corewindow *nsw32_cw,
}
+/**
+ * callback on close event for cookie window
+ *
+ * \param nsw32_cw The nsw32 core window structure.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
static nserror
nsw32_cookie_close(struct nsw32_corewindow *nsw32_cw)
{
@@ -110,9 +120,11 @@ nsw32_cookie_close(struct nsw32_corewindow *nsw32_cw)
return NSERROR_OK;
}
+
/**
* Creates the window for the cookie tree.
*
+ * \param hInstance The application instance
* \return NSERROR_OK on success else appropriate error code on faliure.
*/
static nserror nsw32_cookie_init(HINSTANCE hInstance)
@@ -169,6 +181,7 @@ nserror nsw32_cookies_present(HINSTANCE hInstance)
return res;
}
+
/* exported interface documented in windows/cookie.h */
nserror nsw32_cookies_finalise(void)
{
diff --git a/frontends/windows/global_history.c b/frontends/windows/global_history.c
index 4e90a77ff..0ba013bf0 100644
--- a/frontends/windows/global_history.c
+++ b/frontends/windows/global_history.c
@@ -81,6 +81,8 @@ nsw32_global_history_mouse(struct nsw32_corewindow *nsw32_cw,
* callback on draw event for global_history window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
* \return NSERROR_OK on success otherwise apropriate error code
*/
diff --git a/frontends/windows/hotlist.c b/frontends/windows/hotlist.c
index c184619bf..07804fee2 100644
--- a/frontends/windows/hotlist.c
+++ b/frontends/windows/hotlist.c
@@ -85,6 +85,8 @@ nsw32_hotlist_mouse(struct nsw32_corewindow *nsw32_cw,
* callback on draw event for hotlist window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
* \return NSERROR_OK on success otherwise apropriate error code
*/
diff --git a/frontends/windows/localhistory.c b/frontends/windows/localhistory.c
index 8921b2b31..e145cf79b 100644
--- a/frontends/windows/localhistory.c
+++ b/frontends/windows/localhistory.c
@@ -129,16 +129,12 @@ nsws_localhistory_up(struct nsws_localhistory *l, struct gui_window *gw)
}
-/**
- * close local history window
- *
- * \param gw the gui window to close history for
- */
-void nsws_localhistory_close(struct gui_window *w)
+/* exported interface documented in windows/localhistory.h */
+void nsws_localhistory_close(struct gui_window *gw)
{
- struct nsws_localhistory *l = gui_window_localhistory(w);
- if (l != NULL) {
- CloseWindow(l->hwnd);
+ struct nsws_localhistory *lh = gui_window_localhistory(gw);
+ if (lh != NULL) {
+ CloseWindow(lh->hwnd);
}
}
diff --git a/frontends/windows/localhistory.h b/frontends/windows/localhistory.h
index b0ad07491..eed417f28 100644
--- a/frontends/windows/localhistory.h
+++ b/frontends/windows/localhistory.h
@@ -16,17 +16,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_WINDOWS_LOCALHISTORY_H_
-#define _NETSURF_WINDOWS_LOCALHISTORY_H_
+#ifndef NETSURF_WINDOWS_LOCALHISTORY_H
+#define NETSURF_WINDOWS_LOCALHISTORY_H
struct nsws_localhistory;
-void nsws_localhistory_open(struct gui_window *gw);
+/**
+ * Close win32 localhistory window.
+ *
+ * \param gw The win32 gui window to close local history for.
+ */
void nsws_localhistory_close(struct gui_window *gw);
-/* creates localhistory window */
+/**
+ * creates localhistory window
+ *
+ * \param gw The win32 gui window to create a local history for.
+ */
struct nsws_localhistory *nsws_window_create_localhistory(struct gui_window *gw);
+/**
+ * Create the win32 window class
+ *
+ * \param hinstance The application instance to create the window class under
+ * \return NSERROR_OK on success else error code.
+ */
nserror nsws_create_localhistory_class(HINSTANCE hinstance);
#endif
diff --git a/frontends/windows/ssl_cert.c b/frontends/windows/ssl_cert.c
index efbdf453b..b48d4f5ef 100644
--- a/frontends/windows/ssl_cert.c
+++ b/frontends/windows/ssl_cert.c
@@ -124,6 +124,8 @@ nsw32_sslcert_viewer_mouse(struct nsw32_corewindow *nsw32_cw,
* callback on draw event for ssl certificate window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
* \return NSERROR_OK on success otherwise appropriate error code
*/
@@ -357,11 +359,11 @@ static nserror nsw32_crtvrfy_destroy(struct nsw32_sslcert_window *crtwin)
/**
- * handle command message on certificate viewing window
+ * handle command message on ssl certificate viewing window.
*
- * \param hwnd The win32 window handle
- * \param gw win32 gui window
- * \param notification_code notification code
+ * \param hwnd The win32 window handle.
+ * \param crtwin certificate window context.
+ * \param notification_code notifiction code
* \param identifier notification identifier
* \param ctrl_window The win32 control window handle
* \return appropriate response for command
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 74b84e320..b4cafaab3 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -809,11 +809,12 @@ static void nsws_update_edit(struct gui_window *w)
*
* \param gw win32 frontends graphical window.
* \param hwnd The win32 window handle
- * \param int x The x coordinate of the event.
+ * \param x The x coordinate of the event.
* \param y the y coordinate of the event.
+ * \return true if menu displayed else false
*/
static bool
-nsws_ctx_menu(struct gui_window *w, HWND hwnd, int x, int y)
+nsws_ctx_menu(struct gui_window *gw, HWND hwnd, int x, int y)
{
RECT rc; /* client area of window */
POINT pt = { x, y }; /* location of mouse click */
@@ -828,7 +829,7 @@ nsws_ctx_menu(struct gui_window *w, HWND hwnd, int x, int y)
if (PtInRect(&rc, pt)) {
ClientToScreen(hwnd, &pt);
nsws_update_edit(w);
- TrackPopupMenu(GetSubMenu(w->rclick, 0),
+ TrackPopupMenu(GetSubMenu(gw->rclick, 0),
TPM_CENTERALIGN | TPM_TOPALIGN,
x,
y,
diff --git a/utils/nsoption.h b/utils/nsoption.h
index 62c89c464..e60ebd114 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -18,10 +18,10 @@
/**
* \file
- * Option reading and saving (interface).
+ * Option reading and saving interface.
*
* Global options are defined in desktop/options.h
- * Distinct target options are defined in <TARGET>/options.h
+ * Distinct target options are defined in ${TARGET}/options.h
*
* The implementation API is slightly compromised because it still has
* "global" tables for both the default and current option tables.