Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/5382ad2aa69b6ef8e479c5714052086eba8133b5
...commit
http://git.netsurf-browser.org/netsurf.git/commit/5382ad2aa69b6ef8e479c5714052086eba8133b5
...tree
http://git.netsurf-browser.org/netsurf.git/tree/5382ad2aa69b6ef8e479c5714052086eba8133b5
The branch, master has been updated
via 5382ad2aa69b6ef8e479c5714052086eba8133b5 (commit)
via 48f868a9555be385f156e9396079ad5d0ee388f6 (commit)
from 76673bbf655592a62d21acfec860d5bf181bc848 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=5382ad2aa69b6ef8e479c5714052086eba8133b5
commit 5382ad2aa69b6ef8e479c5714052086eba8133b5
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
patch up cocoa use of depricated tree api
diff --git a/frontends/cocoa/BookmarksController.m
b/frontends/cocoa/BookmarksController.m
index 07b2c50..d7918d9 100644
--- a/frontends/cocoa/BookmarksController.m
+++ b/frontends/cocoa/BookmarksController.m
@@ -22,8 +22,8 @@
#import "netsurf/browser_window.h"
#import "netsurf/keypress.h"
#import "desktop/hotlist.h"
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
#import "cocoa/BookmarksController.h"
#import "cocoa/Tree.h"
#import "cocoa/TreeView.h"
diff --git a/frontends/cocoa/Makefile b/frontends/cocoa/Makefile
index 3c19e76..8935d7b 100644
--- a/frontends/cocoa/Makefile
+++ b/frontends/cocoa/Makefile
@@ -74,6 +74,7 @@ S_FRONTEND := \
SearchWindowController.m \
URLFieldCell.m \
Tree.m \
+ desktop-tree.m \
TreeView.m \
HistoryView.m \
HistoryWindowController.m \
diff --git a/frontends/cocoa/NetsurfApp.m b/frontends/cocoa/NetsurfApp.m
index 54a1a82..7d49e0b 100644
--- a/frontends/cocoa/NetsurfApp.m
+++ b/frontends/cocoa/NetsurfApp.m
@@ -40,7 +40,7 @@
#import "netsurf/cookie_db.h"
#import "netsurf/url_db.h"
#import "desktop/save_complete.h"
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
#ifndef NETSURF_HOMEPAGE
#define NETSURF_HOMEPAGE "http://www.netsurf-browser.org/welcome/"
diff --git a/frontends/cocoa/Tree.h b/frontends/cocoa/Tree.h
index 4224781..25c93b7 100644
--- a/frontends/cocoa/Tree.h
+++ b/frontends/cocoa/Tree.h
@@ -18,7 +18,7 @@
#import <Cocoa/Cocoa.h>
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
@class Tree;
diff --git a/frontends/cocoa/Tree.m b/frontends/cocoa/Tree.m
index 359d543..b5d4a3f 100644
--- a/frontends/cocoa/Tree.m
+++ b/frontends/cocoa/Tree.m
@@ -22,7 +22,7 @@
#import "cocoa/plotter.h"
#import "netsurf/plotters.h"
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
@implementation Tree
diff --git a/frontends/cocoa/desktop-tree.h b/frontends/cocoa/desktop-tree.h
new file mode 100644
index 0000000..f8864e1
--- /dev/null
+++ b/frontends/cocoa/desktop-tree.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2004 Richard Wilson <[email protected]>
+ * Copyright 2009 Paul Blokus <[email protected]>
+ *
+ * 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
+ * deprecated compatibility layer for new treeview modules. Do not use.
+ */
+
+#ifndef _NETSURF_DESKTOP_TREE_H_
+#define _NETSURF_DESKTOP_TREE_H_
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "netsurf/mouse.h"
+
+struct sslcert_session_data;
+struct tree;
+struct redraw_context;
+
+/**
+ * Current ssl session data for treeview
+ *
+ * @todo FIXME global certificate treeview state must go away, this is
+ * just wrong.
+ */
+extern struct sslcert_session_data *ssl_current_session;
+extern const char *tree_hotlist_path;
+
+/* Tree flags */
+enum tree_flags {
+ TREE_HISTORY,
+ TREE_COOKIES,
+ TREE_SSLCERT,
+ TREE_HOTLIST
+};
+
+typedef enum {
+ TREE_NO_DRAG = 0,
+ TREE_SELECT_DRAG,
+ TREE_MOVE_DRAG,
+ TREE_TEXTAREA_DRAG, /** < A drag that is passed to a textarea */
+ TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
+} tree_drag_type;
+
+/** callbacks to perform necessary operations on treeview. */
+struct treeview_table {
+ void (*redraw_request)(int x, int y, int width, int height,
+ void *data); /**< request a redraw. */
+ void (*resized)(struct tree *tree, int width, int height,
+ void *data); /**< resize treeview area. */
+ void (*scroll_visible)(int y, int height, void *data); /**< scroll
visible treeview area. */
+ void (*get_window_dimensions)(int *width, int *height, void *data);
/**< get dimensions of window */
+};
+
+struct tree *tree_create(unsigned int flags,
+ const struct treeview_table *callbacks,
+ void *client_data);
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_delete(struct tree *tree);
+tree_drag_type tree_drag_status(struct tree *tree);
+void tree_draw(struct tree *tree, int x, int y,
+ int clip_x, int clip_y, int clip_width, int clip_height,
+ const struct redraw_context *ctx);
+bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
+ int x, int y);
+void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int
y0,
+ int x1, int y1);
+bool tree_keypress(struct tree *tree, uint32_t key);
+
+
+#endif
diff --git a/frontends/cocoa/desktop-tree.m b/frontends/cocoa/desktop-tree.m
new file mode 100644
index 0000000..c3c7296
--- /dev/null
+++ b/frontends/cocoa/desktop-tree.m
@@ -0,0 +1,353 @@
+/*
+ * Copyright 2004 Richard Wilson <[email protected]>
+ * Copyright 2009 Paul Blokus <[email protected]>
+ *
+ * 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
+ * deprecated compatibility layer for new treeview modules. Do not use.
+ */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/core_window.h"
+#include "content/content.h"
+#include "content/hlcache.h"
+
+#import "cocoa/desktop-tree.h"
+
+struct tree {
+ unsigned int flags; /* Tree flags */
+ tree_drag_type drag;
+ const struct treeview_table *callbacks;
+ void *client_data; /* User assigned data for the callbacks */
+};
+
+#include "netsurf/misc.h"
+#include "desktop/gui_internal.h"
+#include "desktop/treeview.h"
+#include "desktop/hotlist.h"
+#include "desktop/cookie_manager.h"
+#include "desktop/global_history.h"
+#include "desktop/sslcert_viewer.h"
+
+struct sslcert_session_data *ssl_current_session = NULL;
+const char *tree_hotlist_path = NULL;
+
+static void treeview_test_redraw_request(struct core_window *cw,
+ const struct rect *r)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ tree->callbacks->redraw_request(r->x0, r->y0,
+ r->x1 - r->x0, r->y1 - r->y0,
+ tree->client_data);
+}
+
+static void treeview_test_update_size(struct core_window *cw,
+ int width, int height)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ tree->callbacks->resized(tree, width, height, tree->client_data);
+}
+
+static void treeview_test_scroll_visible(struct core_window *cw,
+ const struct rect *r)
+{
+}
+
+static void treeview_test_get_window_dimensions(struct core_window *cw,
+ int *width, int *height)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ tree->callbacks->get_window_dimensions(width, height,
+ tree->client_data);
+}
+
+static void treeview_test_drag_status(struct core_window *cw,
+ core_window_drag_status ds)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ switch (ds) {
+ case CORE_WINDOW_DRAG_NONE:
+ tree->drag = TREE_NO_DRAG;
+ break;
+
+ case CORE_WINDOW_DRAG_SELECTION:
+ tree->drag = TREE_SELECT_DRAG;
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ tree->drag = TREE_MOVE_DRAG;
+ break;
+
+ case CORE_WINDOW_DRAG_TEXT_SELECTION:
+ tree->drag = TREE_TEXTAREA_DRAG;
+ break;
+
+ default:
+ break;
+ }
+}
+
+struct core_window_callback_table cw_t = {
+ .redraw_request = treeview_test_redraw_request,
+ .update_size = treeview_test_update_size,
+ .scroll_visible = treeview_test_scroll_visible,
+ .get_window_dimensions = treeview_test_get_window_dimensions,
+ .drag_status = treeview_test_drag_status
+};
+
+static bool treeview_test_init(struct tree *tree)
+{
+ nserror err;
+
+ switch (tree->flags) {
+ case TREE_COOKIES:
+ err = cookie_manager_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new cookie
manager.", 0);
+ break;
+ case TREE_HISTORY:
+ err = global_history_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new global
history.", 0);
+ break;
+ case TREE_HOTLIST:
+ err = hotlist_init(tree_hotlist_path);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new hotlist.", 0);
+ err = hotlist_manager_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init hotlist manager.",
0);
+ break;
+ case TREE_SSLCERT:
+ assert(ssl_current_session == NULL &&
+ "Call sslcert_viewer_init directly, "
+ "this compat. layer can't cope with simultanious "
+ "sslcert viewers");
+ err = sslcert_viewer_init(&cw_t, (struct core_window *)tree,
+ ssl_current_session);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new sslcert
viewer.", 0);
+ break;
+ }
+
+ return true;
+}
+
+static bool treeview_test_fini(struct tree *tree)
+{
+ nserror err;
+
+ switch (tree->flags) {
+ case TREE_COOKIES:
+ err = cookie_manager_fini();
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise cookie
manager.", 0);
+ break;
+ case TREE_HISTORY:
+ err = global_history_fini();
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise cookie
manager.", 0);
+ break;
+ case TREE_HOTLIST:
+ err = hotlist_fini(tree_hotlist_path);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise hotlist.", 0);
+ break;
+ case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
+ err = sslcert_viewer_fini(ssl_current_session);
+ ssl_current_session = NULL;
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise sslcert
viewer.", 0);
+ break;
+ }
+
+ return true;
+}
+
+static bool treeview_test_redraw(struct tree *tree, int x, int y,
+ int clip_x, int clip_y, int clip_width, int clip_height,
+ const struct redraw_context *ctx)
+{
+ struct rect clip;
+
+ clip.x0 = clip_x;
+ clip.y0 = clip_y;
+ clip.x1 = clip_x + clip_width;
+ clip.y1 = clip_y + clip_height;
+
+ switch (tree->flags) {
+ case TREE_SSLCERT:
+ if (ssl_current_session != NULL) {
+ sslcert_viewer_redraw(ssl_current_session, x, y, &clip,
ctx);
+ }
+ return true;
+ case TREE_COOKIES:
+ cookie_manager_redraw(x, y, &clip, ctx);
+ return true;
+ case TREE_HISTORY:
+ global_history_redraw(x, y, &clip, ctx);
+ return true;
+ case TREE_HOTLIST:
+ hotlist_redraw(x, y, &clip, ctx);
+ return true;
+ }
+
+ return false;
+}
+
+static bool treeview_test_mouse_action(struct tree *tree,
+ browser_mouse_state mouse, int x, int y)
+{
+ switch (tree->flags) {
+ case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
+ sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
+ return true;
+ case TREE_COOKIES:
+ cookie_manager_mouse_action(mouse, x, y);
+ return true;
+ case TREE_HISTORY:
+ global_history_mouse_action(mouse, x, y);
+ return true;
+ case TREE_HOTLIST:
+ hotlist_mouse_action(mouse, x, y);
+ return true;
+ }
+
+ return false;
+}
+
+static bool treeview_test_keypress(struct tree *tree, uint32_t key)
+{
+ switch (tree->flags) {
+ case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
+ sslcert_viewer_keypress(ssl_current_session, key);
+ return true;
+ case TREE_COOKIES:
+ cookie_manager_keypress(key);
+ return true;
+ case TREE_HISTORY:
+ global_history_keypress(key);
+ return true;
+ case TREE_HOTLIST:
+ hotlist_keypress(key);
+ return true;
+ }
+
+ return false;
+}
+
+/* --------------------------------------------------------------------------
*/
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+struct tree *tree_create(unsigned int flags,
+ const struct treeview_table *callbacks, void *client_data)
+{
+ struct tree *tree;
+
+ tree = calloc(sizeof(struct tree), 1);
+ if (tree == NULL) {
+ LOG("calloc failed");
+ guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0);
+ return NULL;
+ }
+
+ tree->flags = flags;
+ tree->drag = TREE_NO_DRAG;
+ tree->callbacks = callbacks;
+ tree->client_data = client_data;
+
+ treeview_test_init(tree);
+
+ return tree;
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_delete(struct tree *tree)
+{
+ treeview_test_fini(tree);
+ free(tree);
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_draw(struct tree *tree, int x, int y,
+ int clip_x, int clip_y, int clip_width, int clip_height,
+ const struct redraw_context *ctx)
+{
+ assert(tree != NULL);
+
+ treeview_test_redraw(tree, x, y, clip_x, clip_y,
+ clip_width, clip_height, ctx);
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
+ int y)
+{
+ assert(tree != NULL);
+
+ if (treeview_test_mouse_action(tree, mouse, x, y)) {
+ return true;
+ }
+
+ return false;
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int
y0,
+ int x1, int y1)
+{
+ assert(tree != NULL);
+
+ treeview_test_mouse_action(tree, BROWSER_MOUSE_HOVER, x1, y1);
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+bool tree_keypress(struct tree *tree, uint32_t key)
+{
+ if (treeview_test_keypress(tree, key)) {
+ return true;
+ }
+
+ return false;
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+tree_drag_type tree_drag_status(struct tree *tree)
+{
+ assert(tree != NULL);
+ return tree->drag;
+}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=48f868a9555be385f156e9396079ad5d0ee388f6
commit 48f868a9555be385f156e9396079ad5d0ee388f6
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
move tree compatability layer to amiga frontend
diff --git a/desktop/Makefile b/desktop/Makefile
index f7f660d..2dcd616 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -2,8 +2,8 @@
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 tree.c version.c \
- system_colour.c global_history.c treeview.c
+ sslcert_viewer.c textarea.c version.c system_colour.c \
+ global_history.c treeview.c
S_DESKTOP := $(addprefix desktop/,$(S_DESKTOP))
diff --git a/desktop/tree.c b/desktop/tree.c
deleted file mode 100644
index b5f444d..0000000
--- a/desktop/tree.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <[email protected]>
- * Copyright 2009 Paul Blokus <[email protected]>
- *
- * 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
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/core_window.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-
-#include "desktop/tree.h"
-
-struct tree {
- unsigned int flags; /* Tree flags */
- tree_drag_type drag;
- const struct treeview_table *callbacks;
- void *client_data; /* User assigned data for the callbacks */
-};
-
-#include "netsurf/misc.h"
-#include "desktop/gui_internal.h"
-#include "desktop/treeview.h"
-#include "desktop/hotlist.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/sslcert_viewer.h"
-
-struct sslcert_session_data *ssl_current_session = NULL;
-const char *tree_hotlist_path = NULL;
-
-static void treeview_test_redraw_request(struct core_window *cw,
- const struct rect *r)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->redraw_request(r->x0, r->y0,
- r->x1 - r->x0, r->y1 - r->y0,
- tree->client_data);
-}
-
-static void treeview_test_update_size(struct core_window *cw,
- int width, int height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->resized(tree, width, height, tree->client_data);
-}
-
-static void treeview_test_scroll_visible(struct core_window *cw,
- const struct rect *r)
-{
-}
-
-static void treeview_test_get_window_dimensions(struct core_window *cw,
- int *width, int *height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->get_window_dimensions(width, height,
- tree->client_data);
-}
-
-static void treeview_test_drag_status(struct core_window *cw,
- core_window_drag_status ds)
-{
- struct tree *tree = (struct tree *)cw;
-
- switch (ds) {
- case CORE_WINDOW_DRAG_NONE:
- tree->drag = TREE_NO_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_SELECTION:
- tree->drag = TREE_SELECT_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_MOVE:
- tree->drag = TREE_MOVE_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_TEXT_SELECTION:
- tree->drag = TREE_TEXTAREA_DRAG;
- break;
-
- default:
- break;
- }
-}
-
-struct core_window_callback_table cw_t = {
- .redraw_request = treeview_test_redraw_request,
- .update_size = treeview_test_update_size,
- .scroll_visible = treeview_test_scroll_visible,
- .get_window_dimensions = treeview_test_get_window_dimensions,
- .drag_status = treeview_test_drag_status
-};
-
-static bool treeview_test_init(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new cookie
manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new global
history.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_init(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new hotlist.", 0);
- err = hotlist_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init hotlist manager.",
0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session == NULL &&
- "Call sslcert_viewer_init directly, "
- "this compat. layer can't cope with simultanious "
- "sslcert viewers");
- err = sslcert_viewer_init(&cw_t, (struct core_window *)tree,
- ssl_current_session);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new sslcert
viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_fini(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie
manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie
manager.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_fini(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise hotlist.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- err = sslcert_viewer_fini(ssl_current_session);
- ssl_current_session = NULL;
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise sslcert
viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_redraw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- struct rect clip;
-
- clip.x0 = clip_x;
- clip.y0 = clip_y;
- clip.x1 = clip_x + clip_width;
- clip.y1 = clip_y + clip_height;
-
- switch (tree->flags) {
- case TREE_SSLCERT:
- if (ssl_current_session != NULL) {
- sslcert_viewer_redraw(ssl_current_session, x, y, &clip,
ctx);
- }
- return true;
- case TREE_COOKIES:
- cookie_manager_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HISTORY:
- global_history_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HOTLIST:
- hotlist_redraw(x, y, &clip, ctx);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_mouse_action(struct tree *tree,
- browser_mouse_state mouse, int x, int y)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
- return true;
- case TREE_COOKIES:
- cookie_manager_mouse_action(mouse, x, y);
- return true;
- case TREE_HISTORY:
- global_history_mouse_action(mouse, x, y);
- return true;
- case TREE_HOTLIST:
- hotlist_mouse_action(mouse, x, y);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_keypress(struct tree *tree, uint32_t key)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_keypress(ssl_current_session, key);
- return true;
- case TREE_COOKIES:
- cookie_manager_keypress(key);
- return true;
- case TREE_HISTORY:
- global_history_keypress(key);
- return true;
- case TREE_HOTLIST:
- hotlist_keypress(key);
- return true;
- }
-
- return false;
-}
-
-/* --------------------------------------------------------------------------
*/
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks, void *client_data)
-{
- struct tree *tree;
-
- tree = calloc(sizeof(struct tree), 1);
- if (tree == NULL) {
- LOG("calloc failed");
- guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0);
- return NULL;
- }
-
- tree->flags = flags;
- tree->drag = TREE_NO_DRAG;
- tree->callbacks = callbacks;
- tree->client_data = client_data;
-
- treeview_test_init(tree);
-
- return tree;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree)
-{
- treeview_test_fini(tree);
- free(tree);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- assert(tree != NULL);
-
- treeview_test_redraw(tree, x, y, clip_x, clip_y,
- clip_width, clip_height, ctx);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
- int y)
-{
- assert(tree != NULL);
-
- if (treeview_test_mouse_action(tree, mouse, x, y)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int
y0,
- int x1, int y1)
-{
- assert(tree != NULL);
-
- treeview_test_mouse_action(tree, BROWSER_MOUSE_HOVER, x1, y1);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_keypress(struct tree *tree, uint32_t key)
-{
- if (treeview_test_keypress(tree, key)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-tree_drag_type tree_drag_status(struct tree *tree)
-{
- assert(tree != NULL);
- return tree->drag;
-}
diff --git a/desktop/tree.h b/desktop/tree.h
deleted file mode 100644
index f8864e1..0000000
--- a/desktop/tree.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <[email protected]>
- * Copyright 2009 Paul Blokus <[email protected]>
- *
- * 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
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#ifndef _NETSURF_DESKTOP_TREE_H_
-#define _NETSURF_DESKTOP_TREE_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "netsurf/mouse.h"
-
-struct sslcert_session_data;
-struct tree;
-struct redraw_context;
-
-/**
- * Current ssl session data for treeview
- *
- * @todo FIXME global certificate treeview state must go away, this is
- * just wrong.
- */
-extern struct sslcert_session_data *ssl_current_session;
-extern const char *tree_hotlist_path;
-
-/* Tree flags */
-enum tree_flags {
- TREE_HISTORY,
- TREE_COOKIES,
- TREE_SSLCERT,
- TREE_HOTLIST
-};
-
-typedef enum {
- TREE_NO_DRAG = 0,
- TREE_SELECT_DRAG,
- TREE_MOVE_DRAG,
- TREE_TEXTAREA_DRAG, /** < A drag that is passed to a textarea */
- TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
-} tree_drag_type;
-
-/** callbacks to perform necessary operations on treeview. */
-struct treeview_table {
- void (*redraw_request)(int x, int y, int width, int height,
- void *data); /**< request a redraw. */
- void (*resized)(struct tree *tree, int width, int height,
- void *data); /**< resize treeview area. */
- void (*scroll_visible)(int y, int height, void *data); /**< scroll
visible treeview area. */
- void (*get_window_dimensions)(int *width, int *height, void *data);
/**< get dimensions of window */
-};
-
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks,
- void *client_data);
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree);
-tree_drag_type tree_drag_status(struct tree *tree);
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx);
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
- int x, int y);
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int
y0,
- int x1, int y1);
-bool tree_keypress(struct tree *tree, uint32_t key);
-
-
-#endif
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index ea6e8fe..f3c178e 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -37,7 +37,7 @@ MESSAGES_FILTER=ami
# sources purely for the Amiga build
S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \
- misc.c bitmap.c font.c filetype.c utf8.c login.c memory.c
\
+ misc.c bitmap.c font.c filetype.c utf8.c login.c memory.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c ctxmenu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
@@ -45,7 +45,8 @@ S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c
file.c \
datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
stringview/stringview.c stringview/urlhistory.c rtg.c \
agclass/amigaguide_class.c os3support.c font_diskfont.c \
- selectmenu.c hash/xxhash.c font_cache.c font_bullet.c nsoption.c
+ selectmenu.c hash/xxhash.c font_cache.c font_bullet.c \
+ nsoption.c desktop-tree.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
diff --git a/frontends/amiga/cookies.h b/frontends/amiga/cookies.h
index 85e553c..157091d 100755
--- a/frontends/amiga/cookies.h
+++ b/frontends/amiga/cookies.h
@@ -18,7 +18,7 @@
#ifndef AMIGA_COOKIES_H
#define AMIGA_COOKIES_H
-#include "desktop/tree.h"
+#include "amiga/desktop-tree.h"
#include "amiga/tree.h"
void ami_cookies_initialise(void);
diff --git a/frontends/amiga/desktop-tree.c b/frontends/amiga/desktop-tree.c
new file mode 100644
index 0000000..3fb41ed
--- /dev/null
+++ b/frontends/amiga/desktop-tree.c
@@ -0,0 +1,353 @@
+/*
+ * Copyright 2004 Richard Wilson <[email protected]>
+ * Copyright 2009 Paul Blokus <[email protected]>
+ *
+ * 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
+ * deprecated compatibility layer for new treeview modules. Do not use.
+ */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "utils/nsoption.h"
+#include "netsurf/misc.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/core_window.h"
+#include "content/content.h"
+#include "content/hlcache.h"
+#include "desktop/gui_internal.h"
+#include "desktop/treeview.h"
+#include "desktop/hotlist.h"
+#include "desktop/cookie_manager.h"
+#include "desktop/global_history.h"
+#include "desktop/sslcert_viewer.h"
+
+#include "amiga/desktop-tree.h"
+
+struct tree {
+ unsigned int flags; /* Tree flags */
+ tree_drag_type drag;
+ const struct treeview_table *callbacks;
+ void *client_data; /* User assigned data for the callbacks */
+};
+
+
+struct sslcert_session_data *ssl_current_session = NULL;
+const char *tree_hotlist_path = NULL;
+
+static void treeview_test_redraw_request(struct core_window *cw,
+ const struct rect *r)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ tree->callbacks->redraw_request(r->x0, r->y0,
+ r->x1 - r->x0, r->y1 - r->y0,
+ tree->client_data);
+}
+
+static void treeview_test_update_size(struct core_window *cw,
+ int width, int height)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ tree->callbacks->resized(tree, width, height, tree->client_data);
+}
+
+static void treeview_test_scroll_visible(struct core_window *cw,
+ const struct rect *r)
+{
+}
+
+static void treeview_test_get_window_dimensions(struct core_window *cw,
+ int *width, int *height)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ tree->callbacks->get_window_dimensions(width, height,
+ tree->client_data);
+}
+
+static void treeview_test_drag_status(struct core_window *cw,
+ core_window_drag_status ds)
+{
+ struct tree *tree = (struct tree *)cw;
+
+ switch (ds) {
+ case CORE_WINDOW_DRAG_NONE:
+ tree->drag = TREE_NO_DRAG;
+ break;
+
+ case CORE_WINDOW_DRAG_SELECTION:
+ tree->drag = TREE_SELECT_DRAG;
+ break;
+
+ case CORE_WINDOW_DRAG_MOVE:
+ tree->drag = TREE_MOVE_DRAG;
+ break;
+
+ case CORE_WINDOW_DRAG_TEXT_SELECTION:
+ tree->drag = TREE_TEXTAREA_DRAG;
+ break;
+
+ default:
+ break;
+ }
+}
+
+struct core_window_callback_table cw_t = {
+ .redraw_request = treeview_test_redraw_request,
+ .update_size = treeview_test_update_size,
+ .scroll_visible = treeview_test_scroll_visible,
+ .get_window_dimensions = treeview_test_get_window_dimensions,
+ .drag_status = treeview_test_drag_status
+};
+
+static bool treeview_test_init(struct tree *tree)
+{
+ nserror err;
+
+ switch (tree->flags) {
+ case TREE_COOKIES:
+ err = cookie_manager_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new cookie
manager.", 0);
+ break;
+ case TREE_HISTORY:
+ err = global_history_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new global
history.", 0);
+ break;
+ case TREE_HOTLIST:
+ err = hotlist_init(tree_hotlist_path);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new hotlist.", 0);
+ err = hotlist_manager_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init hotlist manager.",
0);
+ break;
+ case TREE_SSLCERT:
+ assert(ssl_current_session == NULL &&
+ "Call sslcert_viewer_init directly, "
+ "this compat. layer can't cope with simultanious "
+ "sslcert viewers");
+ err = sslcert_viewer_init(&cw_t, (struct core_window *)tree,
+ ssl_current_session);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't init new sslcert
viewer.", 0);
+ break;
+ }
+
+ return true;
+}
+
+static bool treeview_test_fini(struct tree *tree)
+{
+ nserror err;
+
+ switch (tree->flags) {
+ case TREE_COOKIES:
+ err = cookie_manager_fini();
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise cookie
manager.", 0);
+ break;
+ case TREE_HISTORY:
+ err = global_history_fini();
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise cookie
manager.", 0);
+ break;
+ case TREE_HOTLIST:
+ err = hotlist_fini(tree_hotlist_path);
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise hotlist.", 0);
+ break;
+ case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
+ err = sslcert_viewer_fini(ssl_current_session);
+ ssl_current_session = NULL;
+ if (err != NSERROR_OK)
+ guit->misc->warning("Couldn't finalise sslcert
viewer.", 0);
+ break;
+ }
+
+ return true;
+}
+
+static bool treeview_test_redraw(struct tree *tree, int x, int y,
+ int clip_x, int clip_y, int clip_width, int clip_height,
+ const struct redraw_context *ctx)
+{
+ struct rect clip;
+
+ clip.x0 = clip_x;
+ clip.y0 = clip_y;
+ clip.x1 = clip_x + clip_width;
+ clip.y1 = clip_y + clip_height;
+
+ switch (tree->flags) {
+ case TREE_SSLCERT:
+ if (ssl_current_session != NULL) {
+ sslcert_viewer_redraw(ssl_current_session, x, y, &clip,
ctx);
+ }
+ return true;
+ case TREE_COOKIES:
+ cookie_manager_redraw(x, y, &clip, ctx);
+ return true;
+ case TREE_HISTORY:
+ global_history_redraw(x, y, &clip, ctx);
+ return true;
+ case TREE_HOTLIST:
+ hotlist_redraw(x, y, &clip, ctx);
+ return true;
+ }
+
+ return false;
+}
+
+static bool treeview_test_mouse_action(struct tree *tree,
+ browser_mouse_state mouse, int x, int y)
+{
+ switch (tree->flags) {
+ case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
+ sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
+ return true;
+ case TREE_COOKIES:
+ cookie_manager_mouse_action(mouse, x, y);
+ return true;
+ case TREE_HISTORY:
+ global_history_mouse_action(mouse, x, y);
+ return true;
+ case TREE_HOTLIST:
+ hotlist_mouse_action(mouse, x, y);
+ return true;
+ }
+
+ return false;
+}
+
+static bool treeview_test_keypress(struct tree *tree, uint32_t key)
+{
+ switch (tree->flags) {
+ case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
+ sslcert_viewer_keypress(ssl_current_session, key);
+ return true;
+ case TREE_COOKIES:
+ cookie_manager_keypress(key);
+ return true;
+ case TREE_HISTORY:
+ global_history_keypress(key);
+ return true;
+ case TREE_HOTLIST:
+ hotlist_keypress(key);
+ return true;
+ }
+
+ return false;
+}
+
+/* --------------------------------------------------------------------------
*/
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+struct tree *tree_create(unsigned int flags,
+ const struct treeview_table *callbacks, void *client_data)
+{
+ struct tree *tree;
+
+ tree = calloc(sizeof(struct tree), 1);
+ if (tree == NULL) {
+ LOG("calloc failed");
+ guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0);
+ return NULL;
+ }
+
+ tree->flags = flags;
+ tree->drag = TREE_NO_DRAG;
+ tree->callbacks = callbacks;
+ tree->client_data = client_data;
+
+ treeview_test_init(tree);
+
+ return tree;
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_delete(struct tree *tree)
+{
+ treeview_test_fini(tree);
+ free(tree);
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_draw(struct tree *tree, int x, int y,
+ int clip_x, int clip_y, int clip_width, int clip_height,
+ const struct redraw_context *ctx)
+{
+ assert(tree != NULL);
+
+ treeview_test_redraw(tree, x, y, clip_x, clip_y,
+ clip_width, clip_height, ctx);
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
+ int y)
+{
+ assert(tree != NULL);
+
+ if (treeview_test_mouse_action(tree, mouse, x, y)) {
+ return true;
+ }
+
+ return false;
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int
y0,
+ int x1, int y1)
+{
+ assert(tree != NULL);
+
+ treeview_test_mouse_action(tree, BROWSER_MOUSE_HOVER, x1, y1);
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+bool tree_keypress(struct tree *tree, uint32_t key)
+{
+ if (treeview_test_keypress(tree, key)) {
+ return true;
+ }
+
+ return false;
+}
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+tree_drag_type tree_drag_status(struct tree *tree)
+{
+ assert(tree != NULL);
+ return tree->drag;
+}
diff --git a/frontends/amiga/desktop-tree.h b/frontends/amiga/desktop-tree.h
new file mode 100644
index 0000000..f8864e1
--- /dev/null
+++ b/frontends/amiga/desktop-tree.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2004 Richard Wilson <[email protected]>
+ * Copyright 2009 Paul Blokus <[email protected]>
+ *
+ * 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
+ * deprecated compatibility layer for new treeview modules. Do not use.
+ */
+
+#ifndef _NETSURF_DESKTOP_TREE_H_
+#define _NETSURF_DESKTOP_TREE_H_
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "netsurf/mouse.h"
+
+struct sslcert_session_data;
+struct tree;
+struct redraw_context;
+
+/**
+ * Current ssl session data for treeview
+ *
+ * @todo FIXME global certificate treeview state must go away, this is
+ * just wrong.
+ */
+extern struct sslcert_session_data *ssl_current_session;
+extern const char *tree_hotlist_path;
+
+/* Tree flags */
+enum tree_flags {
+ TREE_HISTORY,
+ TREE_COOKIES,
+ TREE_SSLCERT,
+ TREE_HOTLIST
+};
+
+typedef enum {
+ TREE_NO_DRAG = 0,
+ TREE_SELECT_DRAG,
+ TREE_MOVE_DRAG,
+ TREE_TEXTAREA_DRAG, /** < A drag that is passed to a textarea */
+ TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
+} tree_drag_type;
+
+/** callbacks to perform necessary operations on treeview. */
+struct treeview_table {
+ void (*redraw_request)(int x, int y, int width, int height,
+ void *data); /**< request a redraw. */
+ void (*resized)(struct tree *tree, int width, int height,
+ void *data); /**< resize treeview area. */
+ void (*scroll_visible)(int y, int height, void *data); /**< scroll
visible treeview area. */
+ void (*get_window_dimensions)(int *width, int *height, void *data);
/**< get dimensions of window */
+};
+
+struct tree *tree_create(unsigned int flags,
+ const struct treeview_table *callbacks,
+ void *client_data);
+
+/** deprecated compatibility layer for new treeview modules. Do not use. */
+void tree_delete(struct tree *tree);
+tree_drag_type tree_drag_status(struct tree *tree);
+void tree_draw(struct tree *tree, int x, int y,
+ int clip_x, int clip_y, int clip_width, int clip_height,
+ const struct redraw_context *ctx);
+bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
+ int x, int y);
+void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int
y0,
+ int x1, int y1);
+bool tree_keypress(struct tree *tree, uint32_t key);
+
+
+#endif
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index e835e2b..a51d8c2 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -116,9 +116,9 @@
#include "desktop/save_complete.h"
#include "desktop/scrollbar.h"
#include "desktop/searchweb.h"
-#include "desktop/tree.h"
/* NetSurf Amiga platform includes */
+#include "amiga/desktop-tree.h"
#include "amiga/gui.h"
#include "amiga/arexx.h"
#include "amiga/bitmap.h"
diff --git a/frontends/amiga/history.h b/frontends/amiga/history.h
index d20cfe0..47e00ed 100755
--- a/frontends/amiga/history.h
+++ b/frontends/amiga/history.h
@@ -18,7 +18,7 @@
#ifndef AMIGA_HISTORY_H
#define AMIGA_HISTORY_H
-#include "desktop/tree.h"
+#include "amiga/desktop-tree.h"
#define GLOBAL_HISTORY_RECENT_URLS 16
diff --git a/frontends/amiga/tree.h b/frontends/amiga/tree.h
index aa3c052..a8cada5 100755
--- a/frontends/amiga/tree.h
+++ b/frontends/amiga/tree.h
@@ -22,7 +22,7 @@
#include <exec/types.h>
#include <intuition/classusr.h>
#include "amiga/os3support.h"
-#include "desktop/tree.h"
+#include "amiga/desktop-tree.h"
struct treeview_window;
diff --git a/test/llcache.c b/test/llcache.c
index 8aae357..dbb6f29 100644
--- a/test/llcache.c
+++ b/test/llcache.c
@@ -109,7 +109,6 @@ char *url_to_path(const char *url)
******************************************************************************/
#include "desktop/cookie_manager.h"
-#include "desktop/tree.h"
/* desktop/cookie_manager.h -- used by urldb
*
-----------------------------------------------------------------------
Summary of changes:
desktop/Makefile | 4 ++--
frontends/amiga/Makefile | 5 +++--
frontends/amiga/cookies.h | 2 +-
desktop/tree.c => frontends/amiga/desktop-tree.c | 16 ++++++++--------
desktop/tree.h => frontends/amiga/desktop-tree.h | 0
frontends/amiga/gui.c | 2 +-
frontends/amiga/history.h | 2 +-
frontends/amiga/tree.h | 2 +-
frontends/cocoa/BookmarksController.m | 2 +-
frontends/cocoa/Makefile | 1 +
frontends/cocoa/NetsurfApp.m | 2 +-
frontends/cocoa/Tree.h | 2 +-
frontends/cocoa/Tree.m | 2 +-
desktop/tree.h => frontends/cocoa/desktop-tree.h | 0
desktop/tree.c => frontends/cocoa/desktop-tree.m | 2 +-
test/llcache.c | 1 -
16 files changed, 23 insertions(+), 22 deletions(-)
copy desktop/tree.c => frontends/amiga/desktop-tree.c (99%)
copy desktop/tree.h => frontends/amiga/desktop-tree.h (100%)
rename desktop/tree.h => frontends/cocoa/desktop-tree.h (100%)
rename desktop/tree.c => frontends/cocoa/desktop-tree.m (99%)
diff --git a/desktop/Makefile b/desktop/Makefile
index f7f660d..2dcd616 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -2,8 +2,8 @@
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 tree.c version.c \
- system_colour.c global_history.c treeview.c
+ sslcert_viewer.c textarea.c version.c system_colour.c \
+ global_history.c treeview.c
S_DESKTOP := $(addprefix desktop/,$(S_DESKTOP))
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index ea6e8fe..f3c178e 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -37,7 +37,7 @@ MESSAGES_FILTER=ami
# sources purely for the Amiga build
S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \
- misc.c bitmap.c font.c filetype.c utf8.c login.c memory.c
\
+ misc.c bitmap.c font.c filetype.c utf8.c login.c memory.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c ctxmenu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
@@ -45,7 +45,8 @@ S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c
file.c \
datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
stringview/stringview.c stringview/urlhistory.c rtg.c \
agclass/amigaguide_class.c os3support.c font_diskfont.c \
- selectmenu.c hash/xxhash.c font_cache.c font_bullet.c nsoption.c
+ selectmenu.c hash/xxhash.c font_cache.c font_bullet.c \
+ nsoption.c desktop-tree.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
diff --git a/frontends/amiga/cookies.h b/frontends/amiga/cookies.h
index 85e553c..157091d 100755
--- a/frontends/amiga/cookies.h
+++ b/frontends/amiga/cookies.h
@@ -18,7 +18,7 @@
#ifndef AMIGA_COOKIES_H
#define AMIGA_COOKIES_H
-#include "desktop/tree.h"
+#include "amiga/desktop-tree.h"
#include "amiga/tree.h"
void ami_cookies_initialise(void);
diff --git a/desktop/tree.c b/frontends/amiga/desktop-tree.c
similarity index 99%
copy from desktop/tree.c
copy to frontends/amiga/desktop-tree.c
index b5f444d..3fb41ed 100644
--- a/desktop/tree.c
+++ b/frontends/amiga/desktop-tree.c
@@ -31,12 +31,19 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
+#include "netsurf/misc.h"
#include "netsurf/browser_window.h"
#include "netsurf/core_window.h"
#include "content/content.h"
#include "content/hlcache.h"
+#include "desktop/gui_internal.h"
+#include "desktop/treeview.h"
+#include "desktop/hotlist.h"
+#include "desktop/cookie_manager.h"
+#include "desktop/global_history.h"
+#include "desktop/sslcert_viewer.h"
-#include "desktop/tree.h"
+#include "amiga/desktop-tree.h"
struct tree {
unsigned int flags; /* Tree flags */
@@ -45,13 +52,6 @@ struct tree {
void *client_data; /* User assigned data for the callbacks */
};
-#include "netsurf/misc.h"
-#include "desktop/gui_internal.h"
-#include "desktop/treeview.h"
-#include "desktop/hotlist.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/sslcert_viewer.h"
struct sslcert_session_data *ssl_current_session = NULL;
const char *tree_hotlist_path = NULL;
diff --git a/desktop/tree.h b/frontends/amiga/desktop-tree.h
similarity index 100%
copy from desktop/tree.h
copy to frontends/amiga/desktop-tree.h
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index e835e2b..a51d8c2 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -116,9 +116,9 @@
#include "desktop/save_complete.h"
#include "desktop/scrollbar.h"
#include "desktop/searchweb.h"
-#include "desktop/tree.h"
/* NetSurf Amiga platform includes */
+#include "amiga/desktop-tree.h"
#include "amiga/gui.h"
#include "amiga/arexx.h"
#include "amiga/bitmap.h"
diff --git a/frontends/amiga/history.h b/frontends/amiga/history.h
index d20cfe0..47e00ed 100755
--- a/frontends/amiga/history.h
+++ b/frontends/amiga/history.h
@@ -18,7 +18,7 @@
#ifndef AMIGA_HISTORY_H
#define AMIGA_HISTORY_H
-#include "desktop/tree.h"
+#include "amiga/desktop-tree.h"
#define GLOBAL_HISTORY_RECENT_URLS 16
diff --git a/frontends/amiga/tree.h b/frontends/amiga/tree.h
index aa3c052..a8cada5 100755
--- a/frontends/amiga/tree.h
+++ b/frontends/amiga/tree.h
@@ -22,7 +22,7 @@
#include <exec/types.h>
#include <intuition/classusr.h>
#include "amiga/os3support.h"
-#include "desktop/tree.h"
+#include "amiga/desktop-tree.h"
struct treeview_window;
diff --git a/frontends/cocoa/BookmarksController.m
b/frontends/cocoa/BookmarksController.m
index 07b2c50..d7918d9 100644
--- a/frontends/cocoa/BookmarksController.m
+++ b/frontends/cocoa/BookmarksController.m
@@ -22,8 +22,8 @@
#import "netsurf/browser_window.h"
#import "netsurf/keypress.h"
#import "desktop/hotlist.h"
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
#import "cocoa/BookmarksController.h"
#import "cocoa/Tree.h"
#import "cocoa/TreeView.h"
diff --git a/frontends/cocoa/Makefile b/frontends/cocoa/Makefile
index 3c19e76..8935d7b 100644
--- a/frontends/cocoa/Makefile
+++ b/frontends/cocoa/Makefile
@@ -74,6 +74,7 @@ S_FRONTEND := \
SearchWindowController.m \
URLFieldCell.m \
Tree.m \
+ desktop-tree.m \
TreeView.m \
HistoryView.m \
HistoryWindowController.m \
diff --git a/frontends/cocoa/NetsurfApp.m b/frontends/cocoa/NetsurfApp.m
index 54a1a82..7d49e0b 100644
--- a/frontends/cocoa/NetsurfApp.m
+++ b/frontends/cocoa/NetsurfApp.m
@@ -40,7 +40,7 @@
#import "netsurf/cookie_db.h"
#import "netsurf/url_db.h"
#import "desktop/save_complete.h"
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
#ifndef NETSURF_HOMEPAGE
#define NETSURF_HOMEPAGE "http://www.netsurf-browser.org/welcome/"
diff --git a/frontends/cocoa/Tree.h b/frontends/cocoa/Tree.h
index 4224781..25c93b7 100644
--- a/frontends/cocoa/Tree.h
+++ b/frontends/cocoa/Tree.h
@@ -18,7 +18,7 @@
#import <Cocoa/Cocoa.h>
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
@class Tree;
diff --git a/frontends/cocoa/Tree.m b/frontends/cocoa/Tree.m
index 359d543..b5d4a3f 100644
--- a/frontends/cocoa/Tree.m
+++ b/frontends/cocoa/Tree.m
@@ -22,7 +22,7 @@
#import "cocoa/plotter.h"
#import "netsurf/plotters.h"
-#import "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
@implementation Tree
diff --git a/desktop/tree.h b/frontends/cocoa/desktop-tree.h
similarity index 100%
rename from desktop/tree.h
rename to frontends/cocoa/desktop-tree.h
diff --git a/desktop/tree.c b/frontends/cocoa/desktop-tree.m
similarity index 99%
rename from desktop/tree.c
rename to frontends/cocoa/desktop-tree.m
index b5f444d..c3c7296 100644
--- a/desktop/tree.c
+++ b/frontends/cocoa/desktop-tree.m
@@ -36,7 +36,7 @@
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/tree.h"
+#import "cocoa/desktop-tree.h"
struct tree {
unsigned int flags; /* Tree flags */
diff --git a/test/llcache.c b/test/llcache.c
index 8aae357..dbb6f29 100644
--- a/test/llcache.c
+++ b/test/llcache.c
@@ -109,7 +109,6 @@ char *url_to_path(const char *url)
******************************************************************************/
#include "desktop/cookie_manager.h"
-#include "desktop/tree.h"
/* desktop/cookie_manager.h -- used by urldb
*
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org