sp-xmlview-tree.cpp revision c830d132ea7f29e73b55f87badff602b065f8eac
#define __SP_XMLVIEW_TREE_C__
/*
* Specialization of GtkCTree for the XML tree view
*
* Authors:
* MenTaLguY <mental@rydia.net>
*
* Copyright (C) 2002 MenTaLguY
*
* Released under the GNU GPL; see COPYING for details
*/
#include <cstring>
#include <string>
#include "../xml/node-event-vector.h"
#include "sp-xmlview-tree.h"
struct NodeData {
GtkCTreeNode * node;
};
static NodeData * node_data_new (SPXMLViewTree * tree, GtkCTreeNode * node, Inkscape::XML::Node * repr);
static GtkCTreeNode * add_node (SPXMLViewTree * tree, GtkCTreeNode * parent, GtkCTreeNode * before, Inkscape::XML::Node * repr);
static void element_child_added (Inkscape::XML::Node * repr, Inkscape::XML::Node * child, Inkscape::XML::Node * ref, gpointer data);
static void element_attr_changed (Inkscape::XML::Node * repr, const gchar * key, const gchar * old_value, const gchar * new_value, bool is_interactive, gpointer data);
static void element_child_removed (Inkscape::XML::Node * repr, Inkscape::XML::Node * child, Inkscape::XML::Node * ref, gpointer data);
static void element_order_changed (Inkscape::XML::Node * repr, Inkscape::XML::Node * child, Inkscape::XML::Node * oldref, Inkscape::XML::Node * newref, gpointer data);
static void text_content_changed (Inkscape::XML::Node * repr, const gchar * old_content, const gchar * new_content, gpointer data);
static void comment_content_changed (Inkscape::XML::Node * repr, const gchar * old_content, const gchar * new_content, gpointer data);
static void pi_content_changed (Inkscape::XML::Node * repr, const gchar * old_content, const gchar * new_content, gpointer data);
static void tree_move (GtkCTree * tree, GtkCTreeNode * node, GtkCTreeNode * new_parent, GtkCTreeNode * new_sibling);
static gboolean check_drag (GtkCTree * tree, GtkCTreeNode * node, GtkCTreeNode * new_parent, GtkCTreeNode * new_sibling);
NULL, /* content_changed */
};
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* attr_changed */
NULL /* order_changed */
};
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* attr_changed */
NULL /* order_changed */
};
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* attr_changed */
NULL /* order_changed */
};
{
}
void
{
}
if (repr) {
GtkCTreeNode * node;
}
}
sp_xmlview_tree_get_type (void)
{
//TODO: switch to GObject
// GtkType and such calls were deprecated a while back with the
// introduction of GObject as a separate layer, with GType instead. --JonCruz
if (!type) {
static const GtkTypeInfo info = {
(gchar*) "SPXMLViewTree",
sizeof (SPXMLViewTree),
sizeof (SPXMLViewTreeClass),
};
}
return type;
}
void
{
}
void
{
}
void
{
}
add_node (SPXMLViewTree * tree, GtkCTreeNode * parent, GtkCTreeNode * before, Inkscape::XML::Node * repr)
{
GtkCTreeNode * node;
node = gtk_ctree_insert_node (GTK_CTREE (tree), parent, before, (gchar **)default_text, 2, NULL, NULL, NULL, NULL, ( repr->type() != Inkscape::XML::ELEMENT_NODE ), FALSE);
vec = &text_repr_events;
vec = &pi_repr_events;
} else {
}
if (vec) {
/* cheat a little to get the id upated properly */
}
}
return node;
}
NodeData *
{
return data;
}
void
}
void
element_child_added (Inkscape::XML::Node * /*repr*/, Inkscape::XML::Node * child, Inkscape::XML::Node * ref, gpointer ptr)
{
}
void
element_attr_changed (Inkscape::XML::Node * repr, const gchar * key, const gchar * /*old_value*/, const gchar * new_value, bool /*is_interactive*/, gpointer ptr)
{
if (new_value) {
} else {
}
}
void
element_child_removed (Inkscape::XML::Node * /*repr*/, Inkscape::XML::Node * child, Inkscape::XML::Node * /*ref*/, gpointer ptr)
{
}
void
element_order_changed (Inkscape::XML::Node * /*repr*/, Inkscape::XML::Node * child, Inkscape::XML::Node * /*oldref*/, Inkscape::XML::Node * newref, gpointer ptr)
{
}
void
text_content_changed (Inkscape::XML::Node * /*repr*/, const gchar * /*old_content*/, const gchar * new_content, gpointer ptr)
{
}
void
comment_content_changed (Inkscape::XML::Node */*repr*/, const gchar * /*old_content*/, const gchar *new_content, gpointer ptr)
{
}
void
pi_content_changed(Inkscape::XML::Node *repr, const gchar * /*old_content*/, const gchar *new_content, gpointer ptr)
{
}
void
tree_move (GtkCTree * tree, GtkCTreeNode * node, GtkCTreeNode * new_parent, GtkCTreeNode * new_sibling)
{
if ( !old_parent || !new_parent ) return;
if (new_parent == old_parent) {
} else {
}
}
{
if (ref) {
return before;
} else {
}
}
{
}
return child;
}
{
}
}
check_drag (GtkCTree * /*tree*/, GtkCTreeNode * node, GtkCTreeNode * new_parent, GtkCTreeNode * /*new_sibling*/)
{
/* fixme: we need add_child/remove_child/etc repr events without side-effects, so we can check here and give better visual feedback */
return TRUE;
}
{
}
{
}
{
}