summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-10-05 19:14:46 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-10-05 19:14:46 +0000
commit6173bb0e6c3bf51cd463f7bc4f725429d9087b2b (patch)
treede3e013699742960b97ee4a5eda240908d0ea8e6 /beos
parent195c1ea3193f169c6825eca1fc6207e138126e98 (diff)
downloadnetsurf-6173bb0e6c3bf51cd463f7bc4f725429d9087b2b.tar.gz
netsurf-6173bb0e6c3bf51cd463f7bc4f725429d9087b2b.tar.bz2
Merge treeview-redux to trunk
svn path=/trunk/netsurf/; revision=10865
Diffstat (limited to 'beos')
-rw-r--r--beos/beos_bitmap.cpp10
-rw-r--r--beos/beos_gui.cpp7
-rw-r--r--beos/beos_history.cpp183
-rw-r--r--beos/beos_history.h36
-rw-r--r--beos/beos_scaffolding.cpp1
-rw-r--r--beos/beos_treeview.cpp140
6 files changed, 56 insertions, 321 deletions
diff --git a/beos/beos_bitmap.cpp b/beos/beos_bitmap.cpp
index 881ffe727..5df1fce38 100644
--- a/beos/beos_bitmap.cpp
+++ b/beos/beos_bitmap.cpp
@@ -312,6 +312,16 @@ void bitmap_set_suspendable(void *vbitmap, void *private_word,
struct bitmap *bitmap = (struct bitmap *)vbitmap;
}
+int bitmap_get_width(void *vbitmap){
+ struct bitmap *bitmap = (struct bitmap *)vbitmap;
+ return bitmap->primary->Bounds().Width() + 1;
+}
+
+int bitmap_get_height(void *vbitmap){
+ struct bitmap *bitmap = (struct bitmap *)vbitmap;
+ return bitmap->primary->Bounds().Height() + 1;
+}
+
static BBitmap *
nsbeos_bitmap_generate_pretile(BBitmap *primary, int repeat_x, int repeat_y)
{
diff --git a/beos/beos_gui.cpp b/beos/beos_gui.cpp
index d8cb4bbb2..c06b0c7fc 100644
--- a/beos/beos_gui.cpp
+++ b/beos/beos_gui.cpp
@@ -74,7 +74,6 @@ extern "C" {
#include "beos/beos_window.h"
#include "beos/options.h"
#include "beos/beos_throbber.h"
-#include "beos/beos_history.h"
#include "beos/beos_filetype.h"
//#include "beos/beos_download.h"
#include "beos/beos_schedule.h"
@@ -641,7 +640,6 @@ void gui_init(int argc, char** argv)
urldb_load(option_url_file);
urldb_load_cookies(option_cookie_file);
- nsbeos_history_init();
//nsbeos_download_initialise();
if (!replicated)
@@ -1059,11 +1057,6 @@ void die(const char * const error)
exit(EXIT_FAILURE);
}
-
-void hotlist_visited(hlcache_handle *content)
-{
-}
-
void gui_cert_verify(const char *url, const struct ssl_cert_info *certs,
unsigned long num, nserror (*cb)(bool proceed, void *pw),
void *cbpw)
diff --git a/beos/beos_history.cpp b/beos/beos_history.cpp
deleted file mode 100644
index b35d6d075..000000000
--- a/beos/beos_history.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2008 Fran├žois Revol <mmu_man@users.sourceforge.net>
- * Copyright 2006 Rob Kendrick <rjek@rjek.com>
- *
- * 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/>.
- */
-
-#define __STDBOOL_H__ 1
-extern "C" {
-#include "utils/log.h"
-#include "content/urldb.h"
-}
-
-#include "beos/beos_history.h"
-#include "beos/beos_gui.h"
-#include "beos/beos_window.h"
-
-#include <View.h>
-#include <Window.h>
-
-
-enum
-{
- COL_TITLE = 0,
- COL_ADDRESS,
- COL_LASTVISIT,
- COL_TOTALVISITS,
- COL_THUMBNAIL,
- COL_NCOLS
-};
-
-BWindow *wndHistory;
-#warning XXX
-#if 0 /* GTK */
-static GtkTreeView *treeview;
-static GtkTreeStore *history_tree;
-static GtkTreeSelection *selection;
-
-static bool nsgtk_history_add_internal(const char *, const struct url_data *);
-static void nsgtk_history_selection_changed(GtkTreeSelection *, gpointer);
-#endif
-
-void nsbeos_history_init(void)
-{
-#warning XXX
-#if 0 /* GTK */
- GtkCellRenderer *renderer;
-
- wndHistory = GTK_WINDOW(glade_xml_get_widget(gladeWindows,
- "wndHistory"));
- treeview = GTK_TREE_VIEW(glade_xml_get_widget(gladeWindows,
- "treeHistory"));
- history_tree = gtk_tree_store_new(COL_NCOLS,
- G_TYPE_STRING, /* title */
- G_TYPE_STRING, /* address */
- G_TYPE_STRING, /* last visit */
- G_TYPE_INT, /* nr. visits */
- GDK_TYPE_PIXBUF); /* thumbnail */
-
- selection = gtk_tree_view_get_selection(treeview);
- gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
- g_signal_connect(G_OBJECT(selection), "changed",
- G_CALLBACK(nsgtk_history_selection_changed), NULL);
-
- renderer = gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes(treeview, -1, "Title",
- renderer,
- "text",
- COL_TITLE,
- NULL);
-
- gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(history_tree));
-
-#endif
- nsbeos_history_update();
-}
-
-void nsbeos_history_update(void)
-{
-#warning XXX
-#if 0 /* GTK */
- gtk_tree_store_clear(history_tree);
- urldb_iterate_entries(nsgtk_history_add_internal);
-#endif
-}
-
-bool nsbeos_history_add_internal(const char *url, const struct url_data *data)
-{
-#warning XXX
-#if 0 /* GTK */
- GtkTreeIter iter;
-
- if (data->visits > 0)
- {
- gtk_tree_store_append(history_tree, &iter, NULL);
- gtk_tree_store_set(history_tree, &iter,
- COL_TITLE, data->title,
- COL_ADDRESS, url,
- COL_LASTVISIT, "Unknown",
- COL_TOTALVISITS, data->visits,
- -1);
- }
-
-#endif
- return true;
-}
-
-#warning XXX
-#if 0 /* GTK */
-void nsgtk_history_selection_changed(GtkTreeSelection *treesel, gpointer g)
-{
- GtkTreeIter iter;
- GtkTreeModel *model = GTK_TREE_MODEL(history_tree);
- if (gtk_tree_selection_get_selected(treesel, &model, &iter))
- {
- gchar *b;
- gint i;
- char buf[20];
-
- gtk_tree_model_get(model, &iter, COL_ADDRESS, &b, -1);
- gtk_label_set_text(GTK_LABEL(glade_xml_get_widget(gladeWindows,
- "labelHistoryAddress")), b);
-
- gtk_tree_model_get(model, &iter, COL_LASTVISIT, &b, -1);
- gtk_label_set_text(GTK_LABEL(glade_xml_get_widget(gladeWindows,
- "labelHistoryLastVisit")), b);
-
- gtk_tree_model_get(model, &iter, COL_TOTALVISITS,
- &i, -1);
- snprintf(buf, 20, "%d", i);
- gtk_label_set_text(GTK_LABEL(glade_xml_get_widget(gladeWindows,
- "labelHistoryVisits")), buf);
-
-
-
- }
- else
- {
-
- }
-}
-
-void nsgtk_history_row_activated(GtkTreeView *tv, GtkTreePath *path,
- GtkTreeViewColumn *column, gpointer g)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- model = gtk_tree_view_get_model(tv);
- if (gtk_tree_model_get_iter(model, &iter, path))
- {
- gchar *b;
-
- gtk_tree_model_get(model, &iter, COL_ADDRESS, &b, -1);
-
- browser_window_create((const char *)b, NULL, NULL, true);
- }
-}
-#endif
-
-void global_history_add(const char *url)
-{
- const struct url_data *data;
-
- data = urldb_get_url_data(url);
- if (!data)
- return;
-
- nsbeos_history_add_internal(url, data);
-
-}
diff --git a/beos/beos_history.h b/beos/beos_history.h
deleted file mode 100644
index 71536f1ca..000000000
--- a/beos/beos_history.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2008 Fran├žois Revol <mmu_man@users.sourceforge.net>
- * Copyright 2006 Rob Kendrick <rjek@rjek.com>
- *
- * 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 __NSBEOS_HISTORY_H__
-#define __NSBEOS_HISTORY_H__
-
-#include <View.h>
-#include <Window.h>
-
-extern BWindow *wndHistory;
-
-void nsbeos_history_init(void);
-void nsbeos_history_update(void);
-#warning XXX
-#if 0 /* GTK */
-void nsbeos_history_row_activated(GtkTreeView *, GtkTreePath *,
- GtkTreeViewColumn *, gpointer);
-#endif
-
-#endif /* __NSGTK_HISTORY_H__ */
diff --git a/beos/beos_scaffolding.cpp b/beos/beos_scaffolding.cpp
index a5cc832a7..3fb147f1f 100644
--- a/beos/beos_scaffolding.cpp
+++ b/beos/beos_scaffolding.cpp
@@ -63,7 +63,6 @@ extern "C" {
#include "beos/beos_options.h"
//#include "beos/beos_completion.h"
#include "beos/beos_throbber.h"
-//#include "beos/beos_history.h"
#include "beos/beos_window.h"
//#include "beos/beos_schedule.h"
//#include "beos/beos_download.h"
diff --git a/beos/beos_treeview.cpp b/beos/beos_treeview.cpp
index 1688a95fa..6763c25b8 100644
--- a/beos/beos_treeview.cpp
+++ b/beos/beos_treeview.cpp
@@ -26,107 +26,59 @@
extern "C" {
#include "utils/config.h"
#include "desktop/tree.h"
+#include "desktop/tree_url_node.h"
}
+const char tree_directory_icon_name[] = "directory.png";
+const char tree_content_icon_name[] = "content.png";
-/**
- * Sets the origin variables to the correct values for a specified tree
- *
- * \param tree the tree to set the origin for
- */
-void tree_initialise_redraw(struct tree *tree) {
-}
-
-
-/**
- * Informs the current window manager that an area requires updating.
- *
- * \param tree the tree that is requesting a redraw
- * \param x the x co-ordinate of the redraw area
- * \param y the y co-ordinate of the redraw area
- * \param width the width of the redraw area
- * \param height the height of the redraw area
- */
-void tree_redraw_area(struct tree *tree, int x, int y, int width, int height) {
-}
-
-
-/**
- * Draws a line.
- *
- * \param x the x co-ordinate
- * \param x the y co-ordinate
- * \param x the width of the line
- * \param x the height of the line
- */
-void tree_draw_line(int x, int y, int width, int height) {
-}
-
-
-/**
- * Draws an element, including any expansion icons
- *
- * \param tree the tree to draw an element for
- * \param element the element to draw
- */
-void tree_draw_node_element(struct tree *tree, struct node_element *element) {
-}
-
-
-/**
- * Draws an elements expansion icon
- *
- * \param tree the tree to draw the expansion for
- * \param element the element to draw the expansion for
- */
-void tree_draw_node_expansion(struct tree *tree, struct node *node) {
-}
-
-
-/**
- * Recalculates the dimensions of a node element.
- *
- * \param element the element to recalculate
- */
-void tree_recalculate_node_element(struct node_element *element) {
-}
-
-/**
- * Sets a node element as having a specific sprite.
- *
- * \param node the node to update
- * \param sprite the sprite to use
- * \param selected the expanded sprite name to use
- */
-void tree_set_node_sprite(struct node *node, const char *sprite,
- const char *expanded) {
-}
-
-/**
- * Sets a node element as having a folder sprite
- *
- * \param node the node to update
- */
-void tree_set_node_sprite_folder(struct node *node) {
-
-}
-
-/**
- * Updates the node details for a URL node.
- * The internal node dimensions are not updated.
- *
- * \param node the node to update
- */
-void tree_update_URL_node(struct node *node, const char *url,
- const struct url_data *data) {
-}
/**
- * Updates the tree owner following a tree resize
+ * Translates a content_type to the name of a respective icon
*
- * \param tree the tree to update the owner of
+ * \param content_type content type
+ * \param buffer buffer for the icon name
*/
-void tree_resized(struct tree *tree) {
+void tree_icon_name_from_content_type(char *buffer, content_type type)
+{
+ // TODO: design/acquire icons
+ switch (type) {
+ case CONTENT_HTML:
+ case CONTENT_TEXTPLAIN:
+ case CONTENT_CSS:
+#if defined(WITH_MNG) || defined(WITH_PNG)
+ case CONTENT_PNG:
+#endif
+#ifdef WITH_MNG
+ case CONTENT_JNG:
+ case CONTENT_MNG:
+#endif
+#ifdef WITH_JPEG
+ case CONTENT_JPEG:
+#endif
+#ifdef WITH_GIF
+ case CONTENT_GIF:
+#endif
+#ifdef WITH_BMP
+ case CONTENT_BMP:
+ case CONTENT_ICO:
+#endif
+#ifdef WITH_SPRITE
+ case CONTENT_SPRITE:
+#endif
+#ifdef WITH_DRAW
+ case CONTENT_DRAW:
+#endif
+#ifdef WITH_ARTWORKS
+ case CONTENT_ARTWORKS:
+#endif
+#ifdef WITH_NS_SVG
+ case CONTENT_SVG:
+#endif
+ default:
+ sprintf(buffer, tree_content_icon_name);
+ break;
+ }
}