From b9df8157e756a0a043e284126a41b001cb5a3135 Mon Sep 17 00:00:00 2001 From: mh17 <mh17> Date: Thu, 4 Mar 2010 13:07:59 +0000 Subject: [PATCH] de-branched the tree --- src/include/ZMap/zmapGUITreeView.h | 33 +- src/zmapUtils/zmapGUITreeView.c | 1311 ++++++++++++------------ src/zmapUtils/zmapGUITreeView_I.h | 17 +- src/zmapWindow/zmapWindowDNAList.c | 269 +++-- src/zmapWindow/zmapWindowDNAList_I.h | 4 +- src/zmapWindow/zmapWindowFeatureList.c | 844 ++++++++------- 6 files changed, 1219 insertions(+), 1259 deletions(-) diff --git a/src/include/ZMap/zmapGUITreeView.h b/src/include/ZMap/zmapGUITreeView.h index 49145c5f3..23bb76dc1 100755 --- a/src/include/ZMap/zmapGUITreeView.h +++ b/src/include/ZMap/zmapGUITreeView.h @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Oct 9 21:40 2008 (rds) * Created: Thu May 22 10:45:05 2008 (rds) - * CVS info: $Id: zmapGUITreeView.h,v 1.3 2010-02-25 14:14:20 mh17 Exp $ + * CVS info: $Id: zmapGUITreeView.h,v 1.4 2010-03-04 13:07:59 mh17 Exp $ *------------------------------------------------------------------- */ @@ -47,12 +47,12 @@ /* * Type checking and casting macros */ -#define ZMAP_TYPE_GUITREEVIEW (zMapGUITreeViewGetType()) -#define ZMAP_GUITREEVIEW(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), zMapGUITreeViewGetType(), zmapGUITreeView) -#define ZMAP_GUITREEVIEW_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), zMapGUITreeViewGetType(), zmapGUITreeView const) -#define ZMAP_GUITREEVIEW_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), zMapGUITreeViewGetType(), zmapGUITreeViewClass) -#define ZMAP_IS_GUITREEVIEW(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), zMapGUITreeViewGetType()) -#define ZMAP_GUITREEVIEW_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), zMapGUITreeViewGetType(), zmapGUITreeViewClass) +#define ZMAP_TYPE_GUITREEVIEW (zMapGUITreeViewGetType()) +#define ZMAP_GUITREEVIEW(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), zMapGUITreeViewGetType(), zmapGUITreeView) +#define ZMAP_GUITREEVIEW_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), zMapGUITreeViewGetType(), zmapGUITreeView const) +#define ZMAP_GUITREEVIEW_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), zMapGUITreeViewGetType(), zmapGUITreeViewClass) +#define ZMAP_IS_GUITREEVIEW(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), zMapGUITreeViewGetType()) +#define ZMAP_GUITREEVIEW_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), zMapGUITreeViewGetType(), zmapGUITreeViewClass) typedef enum { @@ -125,7 +125,7 @@ void zMapGUITreeViewAddTuple(ZMapGUITreeView zmap_tv, gpointer user_data); * \brief add a row to the model. */ void zMapGUITreeViewAddTupleFromColumnData(ZMapGUITreeView zmap_tv, - GList *values_list); + GList *values_list); /*! * \brief add rows to the model */ @@ -145,21 +145,4 @@ void zMapGUITreeViewUpdateTuple(ZMapGUITreeView zmap_tv, GtkTreeIter *iter, gpoi */ ZMapGUITreeView zMapGUITreeViewDestroy(ZMapGUITreeView zmap_tv); -/*! - * \brief override this class function - */ -void zMapGUITreeViewSetAddTupleSimple(ZMapGUITreeViewClass zmap_tv, void (*func)(ZMapGUITreeView, gpointer)); - -/*! - * \brief override this class function - */ - -void zMapGUITreeViewSetAddTupleValueList(ZMapGUITreeViewClass zmap_tv, void (*func)(ZMapGUITreeView, GList *)); - -/*! - * \brief override this class function - */ -void zMapGUITreeViewSetAddTuples(ZMapGUITreeViewClass zmap_tv, void (*func)(ZMapGUITreeView, GList *)); - - #endif /* __ZMAP_GUITREEVIEW_H__ */ diff --git a/src/zmapUtils/zmapGUITreeView.c b/src/zmapUtils/zmapGUITreeView.c index 73ea2cfeb..20b16978b 100755 --- a/src/zmapUtils/zmapGUITreeView.c +++ b/src/zmapUtils/zmapGUITreeView.c @@ -29,11 +29,12 @@ * HISTORY: * Last edited: May 22 10:41 2009 (rds) * Created: Thu May 22 10:00:37 2008 (rds) - * CVS info: $Id: zmapGUITreeView.c,v 1.7 2010-02-26 13:31:50 mh17 Exp $ + * CVS info: $Id: zmapGUITreeView.c,v 1.8 2010-03-04 13:07:59 mh17 Exp $ *------------------------------------------------------------------- */ + #include <string.h> /* memcpy() */ #include <ZMap/zmapUtils.h> #include <ZMap/zmapUtilsGUI.h> @@ -41,7 +42,7 @@ enum { - ZMAP_GUITV_NOPROP, /* zero is invalid property id */ + ZMAP_GUITV_NOPROP, /* zero is invalid property id */ ZMAP_GUITV_ROW_COUNTER_COLUMN, /* must be first in variadic args... if present ...*/ ZMAP_GUITV_DATA_PTR_COLUMN, /* must be first in variadic args... if present ...*/ @@ -86,22 +87,22 @@ enum static void zmap_guitreeview_class_init(ZMapGUITreeViewClass zmap_tv_class); static void zmap_guitreeview_init(ZMapGUITreeView zmap_tv); static void zmap_guitreeview_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec); + guint param_id, + const GValue *value, + GParamSpec *pspec); static void zmap_guitreeview_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec); + guint param_id, + GValue *value, + GParamSpec *pspec); static void zmap_guitreeview_dispose(GObject *object); static void zmap_guitreeview_finalize(GObject *object); static void zmap_guitreeview_simple_add(ZMapGUITreeView zmap_tv, - gpointer user_data); + gpointer user_data); static void zmap_guitreeview_simple_add_values(ZMapGUITreeView zmap_tv, - GList *values_list); + GList *values_list); static void zmap_guitreeview_add_list_of_tuples(ZMapGUITreeView zmap_tv, - GList *tuples_list); + GList *tuples_list); static void each_tuple_swap_invoke_add(gpointer list_data, gpointer user_data); @@ -122,28 +123,28 @@ static int column_index_from_name(ZMapGUITreeView zmap_tv, char *name); static void progressive_set_selection(ZMapGUITreeView zmap_tv); static void update_tuple_data(ZMapGUITreeView zmap_tv, - GtkListStore *store, - GtkTreeIter *iter, - gboolean update_counter, - gpointer user_data); + GtkListStore *store, + GtkTreeIter *iter, + gboolean update_counter, + gpointer user_data); static void update_tuple_data_list(ZMapGUITreeView zmap_tv, - GtkListStore *store, - GtkTreeIter *iter, - gboolean update_counter, - GList *values_list); + GtkListStore *store, + GtkTreeIter *iter, + gboolean update_counter, + GList *values_list); /* Sizing functions for the GtkWidget *GtkTreeView. * Hopefully They make it do the right thing. */ static void tree_view_size_request(GtkWidget *widget, - GtkRequisition *requisition, - gpointer user_data); + GtkRequisition *requisition, + gpointer user_data); static gboolean tree_view_map(GtkWidget *widget, - gpointer user_data); + gpointer user_data); static gboolean tree_view_unmap(GtkWidget *widget, - gpointer user_data); + gpointer user_data); static void tree_view_size_allocation(GtkWidget *widget, - GtkAllocation *allocation, - gpointer user_data); + GtkAllocation *allocation, + gpointer user_data); GType zMapGUITreeViewGetType (void) @@ -221,36 +222,36 @@ gboolean zMapGUITreeViewPrepare(ZMapGUITreeView zmap_tv) set_model = gtk_tree_view_get_model(tree_view); if(set_model == tree_model) - prepared = TRUE; + prepared = TRUE; if(prepared) - { - GtkTreeSortable *sort_model = GTK_TREE_SORTABLE(set_model); - GtkSortType sort_order; - int index; + { + GtkTreeSortable *sort_model = GTK_TREE_SORTABLE(set_model); + GtkSortType sort_order; + int index; - /* Detach model from view */ - g_object_ref(G_OBJECT(tree_model)); + /* Detach model from view */ + g_object_ref(G_OBJECT(tree_model)); - gtk_tree_view_set_model(tree_view, NULL); + gtk_tree_view_set_model(tree_view, NULL); - gtk_tree_sortable_get_sort_column_id(sort_model, &index, &sort_order); + gtk_tree_sortable_get_sort_column_id(sort_model, &index, &sort_order); - if(index != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID && - index != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID && - index != zmap_tv->sort_index) - zmap_tv->sort_index = index; + if(index != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID && + index != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID && + index != zmap_tv->sort_index) + zmap_tv->sort_index = index; - if(sort_order != zmap_tv->sort_order) - zmap_tv->sort_order = sort_order; + if(sort_order != zmap_tv->sort_order) + zmap_tv->sort_order = sort_order; - gtk_tree_sortable_set_sort_column_id(sort_model, - GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, - GTK_SORT_ASCENDING); - { - zMapAssert(gtk_tree_view_get_model(tree_view) == NULL); - } - } + gtk_tree_sortable_set_sort_column_id(sort_model, + GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, + GTK_SORT_ASCENDING); + { + zMapAssert(gtk_tree_view_get_model(tree_view) == NULL); + } + } /* If we have a model, but it has never been attached prepared * == FALSE still. This is logically wrong for the name of the @@ -258,7 +259,7 @@ gboolean zMapGUITreeViewPrepare(ZMapGUITreeView zmap_tv) * is done after the previous bit so as not to unref. */ if(set_model == NULL) - prepared = TRUE; + prepared = TRUE; } return prepared; @@ -286,44 +287,44 @@ gboolean zMapGUITreeViewAttach(ZMapGUITreeView zmap_tv) set_model = gtk_tree_view_get_model(tree_view); if((zmap_tv->sort_index != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID) && - (zmap_tv->sort_index != index)) - { - if(zmap_tv->sort_func) - gtk_tree_sortable_set_sort_func(sort_model, - zmap_tv->sort_index, - zmap_tv->sort_func, - zmap_tv->sort_func_data, - zmap_tv->sort_destroy); - else if(gtk_tree_sortable_has_default_sort_func(sort_model)) - gtk_tree_sortable_set_sort_column_id(sort_model, - zmap_tv->sort_index, - zmap_tv->sort_order); - else if(!GTK_IS_TREE_MODEL_SORT(set_model)) - { - GtkTreeViewColumn *sort_column; - GtkSortType sort_order; - - gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(tree_model), - zmap_tv->sort_index, - zmap_tv->sort_order); - sort_column = gtk_tree_view_get_column(zmap_tv->tree_view, - zmap_tv->sort_index); - sort_order = (zmap_tv->sort_order == GTK_SORT_ASCENDING ? - GTK_SORT_DESCENDING : GTK_SORT_ASCENDING); - g_object_set(G_OBJECT(sort_column), - "sort-indicator", TRUE, - "sort-order", sort_order, - NULL); - } - } + (zmap_tv->sort_index != index)) + { + if(zmap_tv->sort_func) + gtk_tree_sortable_set_sort_func(sort_model, + zmap_tv->sort_index, + zmap_tv->sort_func, + zmap_tv->sort_func_data, + zmap_tv->sort_destroy); + else if(gtk_tree_sortable_has_default_sort_func(sort_model)) + gtk_tree_sortable_set_sort_column_id(sort_model, + zmap_tv->sort_index, + zmap_tv->sort_order); + else if(!GTK_IS_TREE_MODEL_SORT(set_model)) + { + GtkTreeViewColumn *sort_column; + GtkSortType sort_order; + + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(tree_model), + zmap_tv->sort_index, + zmap_tv->sort_order); + sort_column = gtk_tree_view_get_column(zmap_tv->tree_view, + zmap_tv->sort_index); + sort_order = (zmap_tv->sort_order == GTK_SORT_ASCENDING ? + GTK_SORT_DESCENDING : GTK_SORT_ASCENDING); + g_object_set(G_OBJECT(sort_column), + "sort-indicator", TRUE, + "sort-order", sort_order, + NULL); + } + } if(set_model != tree_model) - gtk_tree_view_set_model(tree_view, tree_model); + gtk_tree_view_set_model(tree_view, tree_model); if(set_model == NULL || set_model != tree_model) - { - g_object_unref(G_OBJECT(tree_model)); - } + { + g_object_unref(G_OBJECT(tree_model)); + } attached = TRUE; } @@ -331,22 +332,6 @@ gboolean zMapGUITreeViewAttach(ZMapGUITreeView zmap_tv) return attached; } - -void zMapGUITreeViewSetAddTupleSimple(ZMapGUITreeViewClass zmap_tv, void (*func)(ZMapGUITreeView, gpointer)) -{ - zmap_tv->add_tuple_simple = func; -} - -void zMapGUITreeViewSetAddTupleValueList(ZMapGUITreeViewClass zmap_tv, void (*func)(ZMapGUITreeView, GList *)) -{ - zmap_tv->add_tuple_value_list = func; -} - -void zMapGUITreeViewSetAddTuples(ZMapGUITreeViewClass zmap_tv, void (*func)(ZMapGUITreeView, GList *)) -{ - zmap_tv->add_tuples = func; -} - void zMapGUITreeViewAddTuple(ZMapGUITreeView zmap_tv, gpointer user_data) { if(ZMAP_GUITREEVIEW_GET_CLASS(zmap_tv)->add_tuple_simple) @@ -356,7 +341,7 @@ void zMapGUITreeViewAddTuple(ZMapGUITreeView zmap_tv, gpointer user_data) } void zMapGUITreeViewAddTupleFromColumnData(ZMapGUITreeView zmap_tv, - GList *values_list) + GList *values_list) { if(ZMAP_GUITREEVIEW_GET_CLASS(zmap_tv)->add_tuple_value_list) (* ZMAP_GUITREEVIEW_GET_CLASS(zmap_tv)->add_tuple_value_list)(zmap_tv, values_list); @@ -383,15 +368,15 @@ int zMapGUITreeViewGetColumnIndexByName(ZMapGUITreeView zmap_tv, char *column_na int i; for(i = 0; quarks && i < zmap_tv->column_count; i++, quarks++) - { - GQuark curr_name = *quarks; - - if(curr_name == query) - { - index = i; - break; - } - } + { + GQuark curr_name = *quarks; + + if(curr_name == query) + { + index = i; + break; + } + } } return index; @@ -429,178 +414,178 @@ static void zmap_guitreeview_class_init(ZMapGUITreeViewClass zmap_tv_class) /* Specifying the model/layout */ g_object_class_install_property(gobject_class, - ZMAP_GUITV_ROW_COUNTER_COLUMN, - g_param_spec_boolean("row-counter-column", "row-counter-column", - "First Column is a row counter column", - FALSE, ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_ROW_COUNTER_COLUMN, + g_param_spec_boolean("row-counter-column", "row-counter-column", + "First Column is a row counter column", + FALSE, ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_DATA_PTR_COLUMN, - g_param_spec_boolean("data-ptr-column", "data-ptr-column", - "Specify there should be a column holding the pointer.", - FALSE, ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_DATA_PTR_COLUMN, + g_param_spec_boolean("data-ptr-column", "data-ptr-column", + "Specify there should be a column holding the pointer.", + FALSE, ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_COUNT, - g_param_spec_uint("column-count", "columns", - "Number of columns in view", - 1, 128, 1, ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_COUNT, + g_param_spec_uint("column-count", "columns", + "Number of columns in view", + 1, 128, 1, ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_NAME, - g_param_spec_string("column-name", "column-name", - "The name of the column", - "default-column", ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_NAME, + g_param_spec_string("column-name", "column-name", + "The name of the column", + "default-column", ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_TYPE, - g_param_spec_gtype("column-type", "column-type", - "The GType for the column", - G_TYPE_NONE, ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_TYPE, + g_param_spec_gtype("column-type", "column-type", + "The GType for the column", + G_TYPE_NONE, ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_DATA_FUNC, - g_param_spec_pointer("column-func", "column-func", - "A getter column function", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_DATA_FUNC, + g_param_spec_pointer("column-func", "column-func", + "A getter column function", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_FLAGS, - g_param_spec_uint("column-flags", "column-flags", - "Setting for current column flags", - ZMAP_GUITREEVIEW_COLUMN_NOTHING, - ZMAP_GUITREEVIEW_COLUMN_INVALID - 1, - ZMAP_GUITREEVIEW_COLUMN_NOTHING, - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_FLAGS, + g_param_spec_uint("column-flags", "column-flags", + "Setting for current column flags", + ZMAP_GUITREEVIEW_COLUMN_NOTHING, + ZMAP_GUITREEVIEW_COLUMN_INVALID - 1, + ZMAP_GUITREEVIEW_COLUMN_NOTHING, + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_NAMES, - g_param_spec_pointer("column-names", "column-names", - "A GList * of the column names", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_NAMES, + g_param_spec_pointer("column-names", "column-names", + "A GList * of the column names", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_NAME_QUARKS, - g_param_spec_pointer("column-names-q", "column-names-q", - "A GList * of GQuarks of the column names", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_NAME_QUARKS, + g_param_spec_pointer("column-names-q", "column-names-q", + "A GList * of GQuarks of the column names", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_TYPES, - g_param_spec_pointer("column-types", "column-types", - "A GList * of the column types", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_TYPES, + g_param_spec_pointer("column-types", "column-types", + "A GList * of the column types", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_DATA_FUNCS, - g_param_spec_pointer("column-funcs", "column-funcs", - "A GList * of the column functions", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_DATA_FUNCS, + g_param_spec_pointer("column-funcs", "column-funcs", + "A GList * of the column functions", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COLUMN_FLAGS_LIST, - g_param_spec_pointer("column-flags-list", "column-flags-list", - "A GList * of the column flags", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_COLUMN_FLAGS_LIST, + g_param_spec_pointer("column-flags-list", "column-flags-list", + "A GList * of the column flags", + ZMAP_PARAM_STATIC_RW)); /* Selection functionality... */ g_object_class_install_property(gobject_class, - ZMAP_GUITV_SELECT_MODE, - g_param_spec_enum("selection-mode", "selection-mode", - "A GtkSelectionMode for selection", - GTK_TYPE_SELECTION_MODE, - GTK_SELECTION_NONE, - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SELECT_MODE, + g_param_spec_enum("selection-mode", "selection-mode", + "A GtkSelectionMode for selection", + GTK_TYPE_SELECTION_MODE, + GTK_SELECTION_NONE, + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SELECT_FUNC, - g_param_spec_pointer("selection-func", "selection-func", - "A GtkTreeSelectionFunc to handle selection", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SELECT_FUNC, + g_param_spec_pointer("selection-func", "selection-func", + "A GtkTreeSelectionFunc to handle selection", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SELECT_FUNC_DATA, - g_param_spec_pointer("selection-data", "selection-data", - "A pointer to pass to the GtkTreeSelectionFunc", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SELECT_FUNC_DATA, + g_param_spec_pointer("selection-data", "selection-data", + "A pointer to pass to the GtkTreeSelectionFunc", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SELECT_FUNC_DESTROY, - g_param_spec_pointer("selection-destroy", "selection-destroy", - "A GDestroyNotify called on removal of selection-func", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SELECT_FUNC_DESTROY, + g_param_spec_pointer("selection-destroy", "selection-destroy", + "A GDestroyNotify called on removal of selection-func", + ZMAP_PARAM_STATIC_RW)); /* Sort functionality... */ g_object_class_install_property(gobject_class, - ZMAP_GUITV_SORTABLE, - g_param_spec_boolean("sortable", "sortable", - "Whether the tree view/model is sortable", - FALSE, ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SORTABLE, + g_param_spec_boolean("sortable", "sortable", + "Whether the tree view/model is sortable", + FALSE, ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SORT_COLUMN_NAME, - g_param_spec_string("sort-column-name", "sort-column-name", - "Name of column to sort", - "#", ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SORT_COLUMN_NAME, + g_param_spec_string("sort-column-name", "sort-column-name", + "Name of column to sort", + "#", ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SORT_COLUMN_INDEX, - g_param_spec_uint("sort-column-index", "sort-column-index", - "Zero based index of column to sort", - 0, 128, 0, ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SORT_COLUMN_INDEX, + g_param_spec_uint("sort-column-index", "sort-column-index", + "Zero based index of column to sort", + 0, 128, 0, ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SORT_ORDER, - g_param_spec_enum("sort-order", "sort-order", - "Order to sort with", - GTK_TYPE_SORT_TYPE, - GTK_SORT_ASCENDING, - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SORT_ORDER, + g_param_spec_enum("sort-order", "sort-order", + "Order to sort with", + GTK_TYPE_SORT_TYPE, + GTK_SORT_ASCENDING, + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SORT_FUNC, - g_param_spec_pointer("sort-func", "sort-func", - "A GtkTreeIterCompareFunc to handle sorting", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SORT_FUNC, + g_param_spec_pointer("sort-func", "sort-func", + "A GtkTreeIterCompareFunc to handle sorting", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SORT_FUNC_DATA, - g_param_spec_pointer("sort-data", "sort-data", - "A pointer to pass to the GtkTreeIterCompareFunc", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SORT_FUNC_DATA, + g_param_spec_pointer("sort-data", "sort-data", + "A pointer to pass to the GtkTreeIterCompareFunc", + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_SORT_FUNC_DESTROY, - g_param_spec_pointer("sort-destroy", "sort-destroy", - "A GDestroyNotify called on removal of sort-func", - ZMAP_PARAM_STATIC_RW)); + ZMAP_GUITV_SORT_FUNC_DESTROY, + g_param_spec_pointer("sort-destroy", "sort-destroy", + "A GDestroyNotify called on removal of sort-func", + ZMAP_PARAM_STATIC_RW)); /* Access to the widget/model */ g_object_class_install_property(gobject_class, - ZMAP_GUITV_WIDGET, - g_param_spec_object("tree-view", "tree-view", - "GtkWidget *tree_view", - GTK_TYPE_WIDGET, - ZMAP_PARAM_STATIC_RO)); + ZMAP_GUITV_WIDGET, + g_param_spec_object("tree-view", "tree-view", + "GtkWidget *tree_view", + GTK_TYPE_WIDGET, + ZMAP_PARAM_STATIC_RO)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_MODEL, - g_param_spec_object("tree-model", "tree-model", - "GtkTreeModel *tree_model", - GTK_TYPE_TREE_MODEL, - ZMAP_PARAM_STATIC_RO)); + ZMAP_GUITV_MODEL, + g_param_spec_object("tree-model", "tree-model", + "GtkTreeModel *tree_model", + GTK_TYPE_TREE_MODEL, + ZMAP_PARAM_STATIC_RO)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_COUNTER_COLUMN_INDEX, - g_param_spec_int("counter-index", "counter-index", - "The index for the counter column", - -1, 1, -1, - ZMAP_PARAM_STATIC_RO)); + ZMAP_GUITV_COUNTER_COLUMN_INDEX, + g_param_spec_int("counter-index", "counter-index", + "The index for the counter column", + -1, 1, -1, + ZMAP_PARAM_STATIC_RO)); g_object_class_install_property(gobject_class, - ZMAP_GUITV_DATA_PTR_COLUMN_INDEX, - g_param_spec_int("data-ptr-index", "data-ptr-index", - "The index for the data ptr column.", - -1, 1, -1, - ZMAP_PARAM_STATIC_RO)); + ZMAP_GUITV_DATA_PTR_COLUMN_INDEX, + g_param_spec_int("data-ptr-index", "data-ptr-index", + "The index for the data ptr column.", + -1, 1, -1, + ZMAP_PARAM_STATIC_RO)); zmap_tv_class->init_layout = NULL; @@ -628,9 +613,9 @@ static void zmap_guitreeview_init(ZMapGUITreeView zmap_tv) } static void zmap_guitreeview_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec) + guint param_id, + const GValue *value, + GParamSpec *pspec) { ZMapGUITreeView zmap_tv; @@ -653,144 +638,144 @@ static void zmap_guitreeview_set_property(GObject *gobject, case ZMAP_GUITV_DATA_PTR_COLUMN: zmap_tv->add_data_ptr = g_value_get_boolean(value); break; - case ZMAP_GUITV_COLUMN_COUNT: /* must be first in variadic args... */ + case ZMAP_GUITV_COLUMN_COUNT: /* must be first in variadic args... */ { - int requested_count = g_value_get_uint(value); - zmap_tv->curr_column = 0; - - if(zmap_tv->column_count == 0) - { - zmap_tv->column_count = requested_count; - - if(zmap_tv->tuple_counter) - zmap_tv->column_count+=1; - - if(zmap_tv->add_data_ptr) - zmap_tv->column_count+=1; - - /* alloc arrays */ - - zmap_tv->column_names = g_new0(GQuark, zmap_tv->column_count); - - zmap_tv->column_types = g_new0(GType, zmap_tv->column_count); - - zmap_tv->column_funcs = g_new0(ZMapGUITreeViewCellFunc, zmap_tv->column_count); - - zmap_tv->column_values = g_new0(GValue, zmap_tv->column_count); - - zmap_tv->column_numbers = g_new0(int, zmap_tv->column_count); - - zmap_tv->column_flags = g_new0(ColumnFlagsStruct, zmap_tv->column_count); - - { - int i; - for(i = 0; i < zmap_tv->column_count; i++) - { - zmap_tv->column_numbers[i] = i; - /* Default columns to visible */ - zmap_tv->column_flags[i].bitflags = DEFAULT_COLUMN_FLAGS; - } - } - - if(zmap_tv->tuple_counter) - { - zmap_tv->curr_column = 0; - set_column_names(ZMAP_GUITREEVIEW_COUNTER_COLUMN_NAME, zmap_tv); - zmap_tv->curr_column = 0; - set_column_types(GINT_TO_POINTER(G_TYPE_INT), zmap_tv); - zmap_tv->curr_column = 0; - set_column_funcs(tuple_no_to_model, zmap_tv); - zmap_tv->curr_column = 0; - set_column_flags(GINT_TO_POINTER(DEFAULT_COLUMN_FLAGS), zmap_tv); - } - - if(zmap_tv->add_data_ptr) - { - zmap_tv->curr_column = 1; - set_column_names(ZMAP_GUITREEVIEW_DATA_PTR_COLUMN_NAME, zmap_tv); - zmap_tv->curr_column = 1; - set_column_types(GINT_TO_POINTER(G_TYPE_POINTER), zmap_tv); - zmap_tv->curr_column = 1; - set_column_funcs(tuple_pointer_to_model, zmap_tv); - zmap_tv->curr_column = 1; - set_column_flags(GINT_TO_POINTER(ZMAP_GUITREEVIEW_COLUMN_NOTHING), zmap_tv); - } - } - else - { - /* re allocate, how are we going to specify additional columns... */ - /* NOT IMPLEMENTED... */ - } + int requested_count = g_value_get_uint(value); + zmap_tv->curr_column = 0; + + if(zmap_tv->column_count == 0) + { + zmap_tv->column_count = requested_count; + + if(zmap_tv->tuple_counter) + zmap_tv->column_count+=1; + + if(zmap_tv->add_data_ptr) + zmap_tv->column_count+=1; + + /* alloc arrays */ + + zmap_tv->column_names = g_new0(GQuark, zmap_tv->column_count); + + zmap_tv->column_types = g_new0(GType, zmap_tv->column_count); + + zmap_tv->column_funcs = g_new0(ZMapGUITreeViewCellFunc, zmap_tv->column_count); + + zmap_tv->column_values = g_new0(GValue, zmap_tv->column_count); + + zmap_tv->column_numbers = g_new0(int, zmap_tv->column_count); + + zmap_tv->column_flags = g_new0(ColumnFlagsStruct, zmap_tv->column_count); + + { + int i; + for(i = 0; i < zmap_tv->column_count; i++) + { + zmap_tv->column_numbers[i] = i; + /* Default columns to visible */ + zmap_tv->column_flags[i].bitflags = DEFAULT_COLUMN_FLAGS; + } + } + + if(zmap_tv->tuple_counter) + { + zmap_tv->curr_column = 0; + set_column_names(ZMAP_GUITREEVIEW_COUNTER_COLUMN_NAME, zmap_tv); + zmap_tv->curr_column = 0; + set_column_types(GINT_TO_POINTER(G_TYPE_INT), zmap_tv); + zmap_tv->curr_column = 0; + set_column_funcs(tuple_no_to_model, zmap_tv); + zmap_tv->curr_column = 0; + set_column_flags(GINT_TO_POINTER(DEFAULT_COLUMN_FLAGS), zmap_tv); + } + + if(zmap_tv->add_data_ptr) + { + zmap_tv->curr_column = 1; + set_column_names(ZMAP_GUITREEVIEW_DATA_PTR_COLUMN_NAME, zmap_tv); + zmap_tv->curr_column = 1; + set_column_types(GINT_TO_POINTER(G_TYPE_POINTER), zmap_tv); + zmap_tv->curr_column = 1; + set_column_funcs(tuple_pointer_to_model, zmap_tv); + zmap_tv->curr_column = 1; + set_column_flags(GINT_TO_POINTER(ZMAP_GUITREEVIEW_COLUMN_NOTHING), zmap_tv); + } + } + else + { + /* re allocate, how are we going to specify additional columns... */ + /* NOT IMPLEMENTED... */ + } } break; /* specified as blocks */ case ZMAP_GUITV_COLUMN_NAME: { - GQuark column_id; - column_id = g_quark_from_string(g_value_get_string(value)); + GQuark column_id; + column_id = g_quark_from_string(g_value_get_string(value)); - if(column_id != 0) - { + if(column_id != 0) + { #ifdef G_OBJECT_SET_MEMO - /* The idea is for callers to this style of g_object_set */ - g_object_set(gobject, - "column-name", "first_column", - "column_type", G_TYPE_INT, - "column_func", first_col_get, - "column-name", "second_column", - "column_func", second_col_get, - "column_type", G_TYPE_INT, - "column-name", "third_column", - "column_func", third_col_get, - "column_type", G_TYPE_STRING, - NULL); + /* The idea is for callers to this style of g_object_set */ + g_object_set(gobject, + "column-name", "first_column", + "column_type", G_TYPE_INT, + "column_func", first_col_get, + "column-name", "second_column", + "column_func", second_col_get, + "column_type", G_TYPE_INT, + "column-name", "third_column", + "column_func", third_col_get, + "column_type", G_TYPE_STRING, + NULL); #endif /* G_OBJECT_SET_MEMO */ - if(zmap_tv->curr_column < zmap_tv->column_count) - { - zmap_tv->column_names[zmap_tv->curr_column] = column_id; - - /* Only here do we increment the current column */ - zmap_tv->curr_column++; - } - } + if(zmap_tv->curr_column < zmap_tv->column_count) + { + zmap_tv->column_names[zmap_tv->curr_column] = column_id; + + /* Only here do we increment the current column */ + zmap_tv->curr_column++; + } + } } break; case ZMAP_GUITV_COLUMN_TYPE: { - GType column_type; - column_type = g_value_get_gtype(value); - if(column_type != 0) - { - if(zmap_tv->curr_column < zmap_tv->column_count && - zmap_tv->curr_column > 0) - zmap_tv->column_types[zmap_tv->curr_column - 1] = column_type; - } + GType column_type; + column_type = g_value_get_gtype(value); + if(column_type != 0) + { + if(zmap_tv->curr_column < zmap_tv->column_count && + zmap_tv->curr_column > 0) + zmap_tv->column_types[zmap_tv->curr_column - 1] = column_type; + } } break; case ZMAP_GUITV_COLUMN_DATA_FUNC: { - gpointer column_func; - column_func = g_value_get_pointer(value); - if(column_func) - { - if(zmap_tv->curr_column < zmap_tv->column_count && - zmap_tv->curr_column > 0) - zmap_tv->column_funcs[zmap_tv->curr_column - 1] = column_func; - } + gpointer column_func; + column_func = g_value_get_pointer(value); + if(column_func) + { + if(zmap_tv->curr_column < zmap_tv->column_count && + zmap_tv->curr_column > 0) + zmap_tv->column_funcs[zmap_tv->curr_column - 1] = column_func; + } } break; case ZMAP_GUITV_COLUMN_FLAGS: { - unsigned int column_flags; - column_flags = g_value_get_uint(value); - if(column_flags) - { - int save_curr_column = zmap_tv->curr_column; - if(zmap_tv->curr_column < zmap_tv->column_count && - zmap_tv->curr_column > 0) - set_column_flags(GINT_TO_POINTER(column_flags), zmap_tv); - zmap_tv->curr_column = save_curr_column; - } + unsigned int column_flags; + column_flags = g_value_get_uint(value); + if(column_flags) + { + int save_curr_column = zmap_tv->curr_column; + if(zmap_tv->curr_column < zmap_tv->column_count && + zmap_tv->curr_column > 0) + set_column_flags(GINT_TO_POINTER(column_flags), zmap_tv); + zmap_tv->curr_column = save_curr_column; + } } break; @@ -799,111 +784,111 @@ static void zmap_guitreeview_set_property(GObject *gobject, zmap_tv->curr_column = 0; if(zmap_tv->tuple_counter) - zmap_tv->curr_column++; + zmap_tv->curr_column++; if(zmap_tv->add_data_ptr) - zmap_tv->curr_column++; + zmap_tv->curr_column++; g_list_foreach(g_value_get_pointer(value), set_column_names, zmap_tv); if((zmap_tv->curr_column == 0) || - (zmap_tv->curr_column != zmap_tv->column_count) || - (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) - { - g_warning("Expected %d column names, but got %d", - zmap_tv->column_count, - zmap_tv->curr_column); - } + (zmap_tv->curr_column != zmap_tv->column_count) || + (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) + { + g_warning("Expected %d column names, but got %d", + zmap_tv->column_count, + zmap_tv->curr_column); + } break; case ZMAP_GUITV_COLUMN_NAME_QUARKS: zmap_tv->curr_column = 0; if(zmap_tv->tuple_counter) - zmap_tv->curr_column++; + zmap_tv->curr_column++; g_list_foreach(g_value_get_pointer(value), set_column_quarks, zmap_tv); if((zmap_tv->curr_column == 0) || - (zmap_tv->curr_column != zmap_tv->column_count) || - (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) - { - g_warning("Expected %d column names, but got %d", - zmap_tv->column_count, - zmap_tv->curr_column); - } + (zmap_tv->curr_column != zmap_tv->column_count) || + (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) + { + g_warning("Expected %d column names, but got %d", + zmap_tv->column_count, + zmap_tv->curr_column); + } break; case ZMAP_GUITV_COLUMN_TYPES: zmap_tv->curr_column = 0; if(zmap_tv->tuple_counter) - zmap_tv->curr_column++; + zmap_tv->curr_column++; if(zmap_tv->add_data_ptr) - zmap_tv->curr_column++; + zmap_tv->curr_column++; g_list_foreach(g_value_get_pointer(value), set_column_types, zmap_tv); if((zmap_tv->curr_column == 0) || - (zmap_tv->curr_column != zmap_tv->column_count) || - (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) - { - g_warning("Expected %d column types, but got %d", - zmap_tv->column_count, - zmap_tv->curr_column); - } + (zmap_tv->curr_column != zmap_tv->column_count) || + (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) + { + g_warning("Expected %d column types, but got %d", + zmap_tv->column_count, + zmap_tv->curr_column); + } break; case ZMAP_GUITV_COLUMN_DATA_FUNCS: zmap_tv->curr_column = 0; if(zmap_tv->tuple_counter) - zmap_tv->curr_column++; + zmap_tv->curr_column++; if(zmap_tv->add_data_ptr) - zmap_tv->curr_column++; + zmap_tv->curr_column++; g_list_foreach(g_value_get_pointer(value), set_column_funcs, zmap_tv); if((zmap_tv->curr_column == 0) || - (zmap_tv->curr_column != zmap_tv->column_count) || - (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) - { - g_warning("Expected %d column funcs, but got %d", - zmap_tv->column_count, - zmap_tv->curr_column); - } + (zmap_tv->curr_column != zmap_tv->column_count) || + (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) + { + g_warning("Expected %d column funcs, but got %d", + zmap_tv->column_count, + zmap_tv->curr_column); + } break; case ZMAP_GUITV_COLUMN_FLAGS_LIST: zmap_tv->curr_column = 0; if(zmap_tv->tuple_counter) - zmap_tv->curr_column++; + zmap_tv->curr_column++; if(zmap_tv->add_data_ptr) - zmap_tv->curr_column++; + zmap_tv->curr_column++; g_list_foreach(g_value_get_pointer(value), set_column_flags, zmap_tv); if((zmap_tv->curr_column == 0) || - (zmap_tv->curr_column != zmap_tv->column_count) || - (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) - { - g_warning("Expected %d column flag settings, but got %d", - zmap_tv->column_count, - zmap_tv->curr_column); - } + (zmap_tv->curr_column != zmap_tv->column_count) || + (zmap_tv->curr_column == 1 && zmap_tv->tuple_counter)) + { + g_warning("Expected %d column flag settings, but got %d", + zmap_tv->column_count, + zmap_tv->curr_column); + } break; /* selecting columns */ case ZMAP_GUITV_SELECT_MODE: { - GtkTreeSelection *selection; - - zmap_tv->select_mode = g_value_get_enum(value); - if(zmap_tv->tree_view && - (selection = gtk_tree_view_get_selection(zmap_tv->tree_view))) - { - gtk_tree_selection_set_mode(selection, zmap_tv->select_mode); - } + GtkTreeSelection *selection; + + zmap_tv->select_mode = g_value_get_enum(value); + if(zmap_tv->tree_view && + (selection = gtk_tree_view_get_selection(zmap_tv->tree_view))) + { + gtk_tree_selection_set_mode(selection, zmap_tv->select_mode); + } } break; case ZMAP_GUITV_SELECT_FUNC: @@ -927,21 +912,21 @@ static void zmap_guitreeview_set_property(GObject *gobject, break; case ZMAP_GUITV_SORT_COLUMN_NAME: { - char *sort_column; - int index; - /* Should we be copying this string? */ - sort_column = (char *)g_value_get_string(value); + char *sort_column; + int index; + /* Should we be copying this string? */ + sort_column = (char *)g_value_get_string(value); - index = column_index_from_name(zmap_tv, sort_column); - zmap_tv->sort_index = index; + index = column_index_from_name(zmap_tv, sort_column); + zmap_tv->sort_index = index; } break; case ZMAP_GUITV_SORT_COLUMN_INDEX: { - int index; - index = g_value_get_uint(value); - if(index < zmap_tv->column_count) - zmap_tv->sort_index = index; + int index; + index = g_value_get_uint(value); + if(index < zmap_tv->column_count) + zmap_tv->sort_index = index; } break; case ZMAP_GUITV_SORT_ORDER: @@ -965,9 +950,9 @@ static void zmap_guitreeview_set_property(GObject *gobject, } static void zmap_guitreeview_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec) + guint param_id, + GValue *value, + GParamSpec *pspec) { ZMapGUITreeView zmap_tv; @@ -982,31 +967,31 @@ static void zmap_guitreeview_get_property(GObject *gobject, break; case ZMAP_GUITV_WIDGET: { - GtkWidget *widget = NULL; - GtkTreeView *view = NULL; + GtkWidget *widget = NULL; + GtkTreeView *view = NULL; - if((view = zMapGUITreeViewGetView(zmap_tv))) - widget = GTK_WIDGET(view); + if((view = zMapGUITreeViewGetView(zmap_tv))) + widget = GTK_WIDGET(view); - if(widget != NULL) - g_value_set_object(value, widget); + if(widget != NULL) + g_value_set_object(value, widget); } break; case ZMAP_GUITV_MODEL: { - GtkTreeModel *tree_model = NULL; + GtkTreeModel *tree_model = NULL; - tree_model = zMapGUITreeViewGetModel(zmap_tv); + tree_model = zMapGUITreeViewGetModel(zmap_tv); - if(tree_model != NULL) - g_value_set_object(value, tree_model); + if(tree_model != NULL) + g_value_set_object(value, tree_model); } break; case ZMAP_GUITV_DATA_PTR_COLUMN_INDEX: { - int index; - index = zMapGUITreeViewGetColumnIndexByName(zmap_tv, ZMAP_GUITREEVIEW_DATA_PTR_COLUMN_NAME); - g_value_set_int(value, index); + int index; + index = zMapGUITreeViewGetColumnIndexByName(zmap_tv, ZMAP_GUITREEVIEW_DATA_PTR_COLUMN_NAME); + g_value_set_int(value, index); } break; default: @@ -1052,7 +1037,7 @@ static void zmap_guitreeview_finalize(GObject *object) } static void zmap_guitreeview_simple_add(ZMapGUITreeView zmap_tv, - gpointer user_data) + gpointer user_data) { GtkListStore *store; GtkTreeIter iter; @@ -1067,7 +1052,7 @@ static void zmap_guitreeview_simple_add(ZMapGUITreeView zmap_tv, } static void zmap_guitreeview_simple_add_values(ZMapGUITreeView zmap_tv, - GList *values_list) + GList *values_list) { GList *tmp; @@ -1088,7 +1073,7 @@ static void zmap_guitreeview_simple_add_values(ZMapGUITreeView zmap_tv, } static void zmap_guitreeview_add_list_of_tuples(ZMapGUITreeView zmap_tv, - GList *tuples_list) + GList *tuples_list) { zMapGUITreeViewPrepare(zmap_tv); @@ -1225,7 +1210,7 @@ static void tuple_pointer_to_model(GValue *value, gpointer user_data) } static void column_clicked_cb(GtkTreeViewColumn *column_clicked, - gpointer user_data) + gpointer user_data) { ZMapGUITreeView zmap_tv = ZMAP_GUITREEVIEW(user_data); GtkSortType sort_order; @@ -1233,16 +1218,16 @@ static void column_clicked_cb(GtkTreeViewColumn *column_clicked, gboolean sort_indicator; g_object_get(G_OBJECT(column_clicked), - "title", &title, - "sort-order", &sort_order, - "sort-indicator", &sort_indicator, - NULL); + "title", &title, + "sort-order", &sort_order, + "sort-indicator", &sort_indicator, + NULL); #ifdef DEBUGGING printf("Column '%s' clicked\n", title); printf("Column has '%s' indicator and a sort order of %s\n", - (sort_indicator ? "an" : "no"), - (sort_order == GTK_SORT_ASCENDING ? "ascending" : "descending")); + (sort_indicator ? "an" : "no"), + (sort_order == GTK_SORT_ASCENDING ? "ascending" : "descending")); #endif if(zmap_tv->sortable) @@ -1250,59 +1235,59 @@ static void column_clicked_cb(GtkTreeViewColumn *column_clicked, GList *all_columns; if((all_columns = gtk_tree_view_get_columns(zmap_tv->tree_view))) - { - int index = -1, itr = 0; - do - { - GtkTreeViewColumn *column; - - column = GTK_TREE_VIEW_COLUMN(all_columns->data); - - if(column == column_clicked) - index = itr; - else - { - g_object_set(G_OBJECT(column), - "sort-indicator", FALSE, - NULL); - } - itr++; - } - while((all_columns = g_list_next(all_columns))); - - if(index != -1) - { - GtkTreeModel *tree_model; - - tree_model = gtk_tree_view_get_model(zmap_tv->tree_view); - - if(tree_model != zmap_tv->tree_model) - g_warning("%s", "Tree Models don't match"); - - zmap_tv->sort_index = index; - zmap_tv->sort_order = sort_order; - - gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(tree_model), - zmap_tv->sort_index, - zmap_tv->sort_order); - - /* There appears to be a small problem with the column indicator... - * When ascending is set it shows a V arrow and descending a ^ arrow. - * This might be me misunderstanding something about state of the - * column and the view/model, but... - * Anyway this ordering of calls seems to work and produce expected - * behaviour. - */ - zmap_tv->sort_order = (sort_order == GTK_SORT_ASCENDING ? - GTK_SORT_DESCENDING : - GTK_SORT_ASCENDING); - - g_object_set(G_OBJECT(column_clicked), - "sort-order", zmap_tv->sort_order, - "sort-indicator", TRUE, - NULL); - } - } + { + int index = -1, itr = 0; + do + { + GtkTreeViewColumn *column; + + column = GTK_TREE_VIEW_COLUMN(all_columns->data); + + if(column == column_clicked) + index = itr; + else + { + g_object_set(G_OBJECT(column), + "sort-indicator", FALSE, + NULL); + } + itr++; + } + while((all_columns = g_list_next(all_columns))); + + if(index != -1) + { + GtkTreeModel *tree_model; + + tree_model = gtk_tree_view_get_model(zmap_tv->tree_view); + + if(tree_model != zmap_tv->tree_model) + g_warning("%s", "Tree Models don't match"); + + zmap_tv->sort_index = index; + zmap_tv->sort_order = sort_order; + + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(tree_model), + zmap_tv->sort_index, + zmap_tv->sort_order); + + /* There appears to be a small problem with the column indicator... + * When ascending is set it shows a V arrow and descending a ^ arrow. + * This might be me misunderstanding something about state of the + * column and the view/model, but... + * Anyway this ordering of calls seems to work and produce expected + * behaviour. + */ + zmap_tv->sort_order = (sort_order == GTK_SORT_ASCENDING ? + GTK_SORT_DESCENDING : + GTK_SORT_ASCENDING); + + g_object_set(G_OBJECT(column_clicked), + "sort-order", zmap_tv->sort_order, + "sort-indicator", TRUE, + NULL); + } + } } @@ -1310,10 +1295,10 @@ static void column_clicked_cb(GtkTreeViewColumn *column_clicked, } static void view_add_column(GtkTreeView *tree_view, - GQuark *column_name_ptr, - GType *column_type_ptr, - ColumnFlagsStruct *column_flags_ptr, - gpointer clicked_cb_data) + GQuark *column_name_ptr, + GType *column_type_ptr, + ColumnFlagsStruct *column_flags_ptr, + gpointer clicked_cb_data) { GtkTreeViewColumn *new_column; GtkCellRenderer *renderer; @@ -1327,35 +1312,35 @@ static void view_add_column(GtkTreeView *tree_view, aligned = 0.0; g_object_set(G_OBJECT(renderer), - "editable", column_flags_ptr->named.editable, - "xalign", aligned, - NULL); + "editable", column_flags_ptr->named.editable, + "xalign", aligned, + NULL); column_title = (char *)(g_quark_to_string(*column_name_ptr)); column_index = gtk_tree_view_insert_column_with_attributes(tree_view, - column_index, - column_title, - renderer, - NULL); + column_index, + column_title, + renderer, + NULL); new_column = gtk_tree_view_get_column(tree_view, column_index - 1); g_object_set(G_OBJECT(new_column), - "clickable", column_flags_ptr->named.clickable, - "visible", column_flags_ptr->named.visible, - NULL); + "clickable", column_flags_ptr->named.clickable, + "visible", column_flags_ptr->named.visible, + NULL); if(column_flags_ptr->named.visible) gtk_tree_view_column_set_attributes(new_column, - renderer, - /* Get the text from the model */ - "text", column_index - 1, - NULL); + renderer, + /* Get the text from the model */ + "text", column_index - 1, + NULL); if(column_flags_ptr->named.clickable) g_signal_connect(G_OBJECT(new_column), "clicked", - G_CALLBACK(column_clicked_cb), clicked_cb_data); + G_CALLBACK(column_clicked_cb), clicked_cb_data); return ; } @@ -1381,33 +1366,33 @@ static GtkTreeView *createView(ZMapGUITreeView zmap_tv) /* Create the behaviour you would expect from a tree view widget. * See more info around functions... */ g_signal_connect(G_OBJECT(tree_view), "size-request", - G_CALLBACK(tree_view_size_request), zmap_tv); + G_CALLBACK(tree_view_size_request), zmap_tv); g_signal_connect(G_OBJECT(tree_view), "map", - G_CALLBACK(tree_view_map), zmap_tv); + G_CALLBACK(tree_view_map), zmap_tv); g_signal_connect(G_OBJECT(tree_view), "size-allocate", - G_CALLBACK(tree_view_size_allocation), zmap_tv); + G_CALLBACK(tree_view_size_allocation), zmap_tv); g_signal_connect(G_OBJECT(tree_view), "unmap", - G_CALLBACK(tree_view_unmap), zmap_tv); + G_CALLBACK(tree_view_unmap), zmap_tv); /* This should be a property */ gtk_tree_view_set_headers_clickable(tree_view, TRUE); for(index = 0; index < zmap_tv->column_count; index++, column_name_ptr++, column_type_ptr++, column_flags_ptr++) - { - view_add_column(tree_view, - column_name_ptr, - column_type_ptr, - column_flags_ptr, - zmap_tv); - } + { + view_add_column(tree_view, + column_name_ptr, + column_type_ptr, + column_flags_ptr, + zmap_tv); + } selection = gtk_tree_view_get_selection(tree_view); gtk_tree_selection_set_mode(selection, zmap_tv->select_mode); } else if(ZMAP_GUITREEVIEW_GET_CLASS(zmap_tv)->init_layout && - !zmap_tv->init_layout_called) + !zmap_tv->init_layout_called) { (* ZMAP_GUITREEVIEW_GET_CLASS(zmap_tv)->init_layout)(zmap_tv); zmap_tv->init_layout_called = TRUE; @@ -1418,8 +1403,8 @@ static GtkTreeView *createView(ZMapGUITreeView zmap_tv) } static void row_deletion_cb(GtkTreeModel *tree_model, - GtkTreePath *path, - gpointer user_data) + GtkTreePath *path, + gpointer user_data) { #ifdef COMPILER_COMPLAINS ZMapGUITreeView zmap_tv = ZMAP_GUITREEVIEW(user_data); @@ -1445,7 +1430,7 @@ static GtkTreeModel *createModel(ZMapGUITreeView zmap_tv) model = GTK_TREE_MODEL(store); } else if(ZMAP_GUITREEVIEW_GET_CLASS(zmap_tv)->init_layout && - !zmap_tv->init_layout_called) + !zmap_tv->init_layout_called) { (* ZMAP_GUITREEVIEW_GET_CLASS(zmap_tv)->init_layout)(zmap_tv); zmap_tv->init_layout_called = TRUE; @@ -1455,7 +1440,7 @@ static GtkTreeModel *createModel(ZMapGUITreeView zmap_tv) if(model) { g_signal_connect(G_OBJECT(model), "row-deleted", - G_CALLBACK(row_deletion_cb), zmap_tv); + G_CALLBACK(row_deletion_cb), zmap_tv); } return model ; @@ -1472,7 +1457,7 @@ static int column_index_from_name(ZMapGUITreeView zmap_tv, char *name) for(i = 0; i < zmap_tv->column_count; i++, names_ptr++) { if(*names_ptr == name_id) - index = i; + index = i; } return index; @@ -1496,20 +1481,20 @@ static void progressive_set_selection(ZMapGUITreeView zmap_tv) * Currently there is no checking in this area... */ if(select_func) - gtk_tree_selection_set_select_function(selection, - select_func, - select_data, - select_destroy); + gtk_tree_selection_set_select_function(selection, + select_func, + select_data, + select_destroy); } return ; } static void update_tuple_data(ZMapGUITreeView zmap_tv, - GtkListStore *store, - GtkTreeIter *iter, - gboolean update_counter, - gpointer user_data) + GtkListStore *store, + GtkTreeIter *iter, + gboolean update_counter, + gpointer user_data) { int index = 0; @@ -1520,11 +1505,11 @@ static void update_tuple_data(ZMapGUITreeView zmap_tv, column_value = &(zmap_tv->column_values[index]); if(update_counter) - { - tuple_no_to_model(column_value, zmap_tv); + { + tuple_no_to_model(column_value, zmap_tv); - gtk_list_store_set_value(store, iter, index, column_value); - } + gtk_list_store_set_value(store, iter, index, column_value); + } index++; } @@ -1553,25 +1538,25 @@ static void update_tuple_data(ZMapGUITreeView zmap_tv, func = zmap_tv->column_funcs[index]; if(!func) - g_warning("Failed to set value for column index %d.", index); + g_warning("Failed to set value for column index %d.", index); else - { - g_value_reset(value); + { + g_value_reset(value); - (func)(value, user_data); + (func)(value, user_data); - gtk_list_store_set_value(store, iter, index, value); - } + gtk_list_store_set_value(store, iter, index, value); + } } return ; } static void update_tuple_data_list(ZMapGUITreeView zmap_tv, - GtkListStore *store, - GtkTreeIter *iter, - gboolean update_counter, - GList *values_list) + GtkListStore *store, + GtkTreeIter *iter, + gboolean update_counter, + GList *values_list) { GList *tmp; @@ -1581,81 +1566,81 @@ static void update_tuple_data_list(ZMapGUITreeView zmap_tv, int index = 0; if(zmap_tv->tuple_counter) - { - GValue *column_value; + { + GValue *column_value; - column_value = &(zmap_tv->column_values[index]); + column_value = &(zmap_tv->column_values[index]); - if(update_counter) - { - tuple_no_to_model(column_value, zmap_tv); + if(update_counter) + { + tuple_no_to_model(column_value, zmap_tv); - gtk_list_store_set_value(store, iter, index, column_value); - } + gtk_list_store_set_value(store, iter, index, column_value); + } - index++; - } + index++; + } if(zmap_tv->add_data_ptr) - { - GValue *column_value; + { + GValue *column_value; - column_value = &(zmap_tv->column_values[index]); + column_value = &(zmap_tv->column_values[index]); - tuple_pointer_to_model(column_value, NULL); + tuple_pointer_to_model(column_value, NULL); - gtk_list_store_set_value(store, iter, index, column_value); + gtk_list_store_set_value(store, iter, index, column_value); - index++; - } + index++; + } do - { - GType column_type; - GValue *column_value; - - column_type = zmap_tv->column_types[index]; - column_value = &(zmap_tv->column_values[index]); - - g_value_reset(column_value); - - if(column_type == G_VALUE_TYPE(column_value)) - { - if(column_type == G_TYPE_INT) - g_value_set_int(column_value, GPOINTER_TO_INT(tmp->data)); - else if(column_type == G_TYPE_STRING) - g_value_set_string(column_value, (char *)(tmp->data)); - else if(column_type == G_TYPE_BOOLEAN) - g_value_set_boolean(column_value, GPOINTER_TO_INT(tmp->data)); - else if(column_type == G_TYPE_FLOAT) - { - int fint = GPOINTER_TO_INT(tmp->data); - float ffloat; - - memcpy(&ffloat, &fint, 4); /* Let's hope float is 4 bytes */ - - g_value_set_float(column_value, ffloat); - } - else if(column_type == G_TYPE_POINTER) - { - GtkTreeViewColumn *hide_column = NULL; - hide_column = gtk_tree_view_get_column(zmap_tv->tree_view, index); - g_object_set(G_OBJECT(hide_column), - "visible", FALSE, - NULL); - g_value_set_pointer(column_value, tmp->data); - } - else - zMapAssertNotReached(); /* v. unexpected! */ - } - else - g_warning("%s", "Bad column type"); - - /* Send the values off to the store... */ - gtk_list_store_set_value(store, iter, index, column_value); - /* Keep the index in step. */ - index++; - } + { + GType column_type; + GValue *column_value; + + column_type = zmap_tv->column_types[index]; + column_value = &(zmap_tv->column_values[index]); + + g_value_reset(column_value); + + if(column_type == G_VALUE_TYPE(column_value)) + { + if(column_type == G_TYPE_INT) + g_value_set_int(column_value, GPOINTER_TO_INT(tmp->data)); + else if(column_type == G_TYPE_STRING) + g_value_set_string(column_value, (char *)(tmp->data)); + else if(column_type == G_TYPE_BOOLEAN) + g_value_set_boolean(column_value, GPOINTER_TO_INT(tmp->data)); + else if(column_type == G_TYPE_FLOAT) + { + int fint = GPOINTER_TO_INT(tmp->data); + float ffloat; + + memcpy(&ffloat, &fint, 4); /* Let's hope float is 4 bytes */ + + g_value_set_float(column_value, ffloat); + } + else if(column_type == G_TYPE_POINTER) + { + GtkTreeViewColumn *hide_column = NULL; + hide_column = gtk_tree_view_get_column(zmap_tv->tree_view, index); + g_object_set(G_OBJECT(hide_column), + "visible", FALSE, + NULL); + g_value_set_pointer(column_value, tmp->data); + } + else + zMapAssertNotReached(); /* v. unexpected! */ + } + else + g_warning("%s", "Bad column type"); + + /* Send the values off to the store... */ + gtk_list_store_set_value(store, iter, index, column_value); + /* Keep the index in step. */ + index++; + } while((tmp = g_list_next(tmp)) && index < zmap_tv->column_count); } @@ -1671,8 +1656,8 @@ static void update_tuple_data_list(ZMapGUITreeView zmap_tv, * _every_ window that is opened. */ static void tree_view_size_request(GtkWidget *widget, - GtkRequisition *requisition, - gpointer user_data) + GtkRequisition *requisition, + gpointer user_data) { GdkScreen *screen; ZMapGUITreeView zmap_tv = ZMAP_GUITREEVIEW(user_data); @@ -1696,39 +1681,39 @@ static void tree_view_size_request(GtkWidget *widget, screen_height *= screen_percentage; if((toplevel = zMapGUIFindTopLevel(widget))) - { - GtkAllocation toplevel_alloc; - GtkRequisition expansion_requistion; + { + GtkAllocation toplevel_alloc; + GtkRequisition expansion_requistion; - /* Have to respect our toplevel size too... */ - toplevel_alloc = toplevel->allocation; + /* Have to respect our toplevel size too... */ + toplevel_alloc = toplevel->allocation; - /* We can't just expand to the full size of the requistion - * as it will likely force some of the widget off the - * screen. */ + /* We can't just expand to the full size of the requistion + * as it will likely force some of the widget off the + * screen. */ - expansion_requistion.width = screen_width - toplevel_alloc.width; - expansion_requistion.height = screen_height - toplevel_alloc.height; + expansion_requistion.width = screen_width - toplevel_alloc.width; + expansion_requistion.height = screen_height - toplevel_alloc.height; - /* This code is not tested for when there are 2 or more of - * these widgets in a single toplevel where they are all - * mapped at the same time. i.e. have the same direct parent - * (e.g.a vbox) */ - screen_width = zmap_tv->requisition.width + expansion_requistion.width; - screen_height = zmap_tv->requisition.height + expansion_requistion.height; - } + /* This code is not tested for when there are 2 or more of + * these widgets in a single toplevel where they are all + * mapped at the same time. i.e. have the same direct parent + * (e.g.a vbox) */ + screen_width = zmap_tv->requisition.width + expansion_requistion.width; + screen_height = zmap_tv->requisition.height + expansion_requistion.height; + } if(screen_width < -1) - screen_width = -1; + screen_width = -1; if(screen_height < -1) - screen_height = -1; + screen_height = -1; gtk_widget_get_size_request(widget, &size_req_width, &size_req_height); if(size_req_width == -1) - new_requisition.width = MIN(screen_width, requisition->width); + new_requisition.width = MIN(screen_width, requisition->width); if(size_req_height == -1) - new_requisition.height = MIN(screen_height, requisition->height); + new_requisition.height = MIN(screen_height, requisition->height); /* Get our parent and check if we have scrollbars eating our @@ -1736,44 +1721,44 @@ static void tree_view_size_request(GtkWidget *widget, parent = gtk_widget_get_parent(widget); if(GTK_IS_SCROLLED_WINDOW(parent)) - { - GtkWidget *scrollbar; + { + GtkWidget *scrollbar; - if((scrollbar = gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(parent)))) - { - GtkRequisition v_requisition; - int scrollbar_spacing = 0; + if((scrollbar = gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(parent)))) + { + GtkRequisition v_requisition; + int scrollbar_spacing = 0; - gtk_widget_size_request(scrollbar, &v_requisition); + gtk_widget_size_request(scrollbar, &v_requisition); - gtk_widget_style_get(parent, - "scrollbar-spacing", &scrollbar_spacing, - NULL); + gtk_widget_style_get(parent, + "scrollbar-spacing", &scrollbar_spacing, + NULL); - v_requisition.width += scrollbar_spacing; - new_requisition.width = MIN((new_requisition.width + v_requisition.width), screen_width); - } + v_requisition.width += scrollbar_spacing; + new_requisition.width = MIN((new_requisition.width + v_requisition.width), screen_width); + } - if((scrollbar = gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(parent)))) - { - GtkRequisition h_requisition; - int scrollbar_spacing = 0; + if((scrollbar = gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(parent)))) + { + GtkRequisition h_requisition; + int scrollbar_spacing = 0; - gtk_widget_size_request(scrollbar, &h_requisition); + gtk_widget_size_request(scrollbar, &h_requisition); - gtk_widget_style_get(parent, - "scrollbar-spacing", &scrollbar_spacing, - NULL); + gtk_widget_style_get(parent, + "scrollbar-spacing", &scrollbar_spacing, + NULL); - h_requisition.height += scrollbar_spacing; - new_requisition.height = MIN((new_requisition.height + h_requisition.height), screen_height); - } - } + h_requisition.height += scrollbar_spacing; + new_requisition.height = MIN((new_requisition.height + h_requisition.height), screen_height); + } + } /* Actually set the size */ gtk_widget_set_size_request(widget, - new_requisition.width, - new_requisition.height); + new_requisition.width, + new_requisition.height); /* Note we've been resized */ zmap_tv->resized = 1; } @@ -1782,7 +1767,7 @@ static void tree_view_size_request(GtkWidget *widget, } static gboolean tree_view_map(GtkWidget *widget, - gpointer user_data) + gpointer user_data) { ZMapGUITreeView zmap_tv = ZMAP_GUITREEVIEW(user_data); @@ -1797,7 +1782,7 @@ static gboolean tree_view_map(GtkWidget *widget, } static gboolean tree_view_unmap(GtkWidget *widget, - gpointer user_data) + gpointer user_data) { ZMapGUITreeView zmap_tv = ZMAP_GUITREEVIEW(user_data); @@ -1815,8 +1800,8 @@ static gboolean tree_view_unmap(GtkWidget *widget, } static void tree_view_size_allocation(GtkWidget *widget, - GtkAllocation *allocation, - gpointer user_data) + GtkAllocation *allocation, + gpointer user_data) { ZMapGUITreeView zmap_tv = ZMAP_GUITREEVIEW(user_data); diff --git a/src/zmapUtils/zmapGUITreeView_I.h b/src/zmapUtils/zmapGUITreeView_I.h index 2d528f574..09baa7168 100755 --- a/src/zmapUtils/zmapGUITreeView_I.h +++ b/src/zmapUtils/zmapGUITreeView_I.h @@ -29,16 +29,19 @@ * HISTORY: * Last edited: Jun 3 11:45 2008 (rds) * Created: Thu May 22 10:49:23 2008 (rds) - * CVS info: $Id: zmapGUITreeView_I.h,v 1.2 2010-02-25 14:14:20 mh17 Exp $ + * CVS info: $Id: zmapGUITreeView_I.h,v 1.3 2010-03-04 13:07:59 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef __ZMAP_GUITREEVIEW_I_H__ #define __ZMAP_GUITREEVIEW_I_H__ -#include <ZMap/zmapBase.h> #include <ZMap/zmapGUITreeView.h> +/* If we had a ZMap base class these could go in its _I.h */ +#define ZMAP_PARAM_STATIC (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) +#define ZMAP_PARAM_STATIC_RW (ZMAP_PARAM_STATIC | G_PARAM_READWRITE) +#define ZMAP_PARAM_STATIC_RO (ZMAP_PARAM_STATIC | G_PARAM_READABLE) #define DEFAULT_COLUMN_FLAGS (ZMAP_GUITREEVIEW_COLUMN_VISIBLE | ZMAP_GUITREEVIEW_COLUMN_CLICKABLE) @@ -68,17 +71,17 @@ typedef struct _zmapGUITreeViewStruct GObject __parent__; unsigned int tuple_counter : 1; /* First column is a counter column - * giving each row an id in the - * model */ + * giving each row an id in the + * model */ unsigned int sortable : 1; unsigned int init_layout_called : 1; unsigned int add_data_ptr : 1; - unsigned int resized : 1; /* Flag to record/control resizing the tree_view */ - unsigned int mapped : 1; /* Flag to control resizing */ + unsigned int resized : 1; /* Flag to record/control resizing the tree_view */ + unsigned int mapped : 1; /* Flag to control resizing */ unsigned int sort_index; unsigned int column_count; unsigned int curr_column; - unsigned int curr_tuple; /* For filling the first column... */ + unsigned int curr_tuple; /* For filling the first column... */ GQuark *column_names; GType *column_types; diff --git a/src/zmapWindow/zmapWindowDNAList.c b/src/zmapWindow/zmapWindowDNAList.c index 5b63e369d..42c21467a 100755 --- a/src/zmapWindow/zmapWindowDNAList.c +++ b/src/zmapWindow/zmapWindowDNAList.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Jun 16 15:19 2008 (rds) * Created: Mon Oct 9 15:21:36 2006 (edgrif) - * CVS info: $Id: zmapWindowDNAList.c,v 1.11 2010-02-25 14:14:20 mh17 Exp $ + * CVS info: $Id: zmapWindowDNAList.c,v 1.12 2010-03-04 13:07:59 mh17 Exp $ *------------------------------------------------------------------- */ @@ -94,9 +94,9 @@ static GtkItemFactoryEntry menu_items_G[] = { * */ void zmapWindowDNAListCreate(ZMapWindow zmap_window, - GList *dna_list, - char *title, - ZMapFeatureBlock block) + GList *dna_list, + char *title, + ZMapFeatureBlock block) { DNAWindowListData window_list ; @@ -109,14 +109,14 @@ void zmapWindowDNAListCreate(ZMapWindow zmap_window, window_list->block = block; g_object_get(G_OBJECT(window_list->dna_list), - "tree-view", &(window_list->tree_widget), - NULL); + "tree-view", &(window_list->tree_widget), + NULL); g_object_set(G_OBJECT(window_list->dna_list), - "selection-mode", GTK_SELECTION_SINGLE, - "selection-func", selectionFuncCB, - "selection-data", window_list, - NULL); + "selection-mode", GTK_SELECTION_SINGLE, + "selection-func", selectionFuncCB, + "selection-data", window_list, + NULL); zMapWindowDNAListAddMatches(window_list->dna_list, dna_list); @@ -148,7 +148,7 @@ static GtkWidget *zmapWindowDNAListNewToplevel(char *title) } static void drawListWindow(DNAWindowListData window_list, - GtkWidget *tree_view) + GtkWidget *tree_view) { GtkWidget *window, *vbox, *sub_frame, *scrolled_window; char *frame_label = NULL; @@ -184,7 +184,7 @@ static void drawListWindow(DNAWindowListData window_list, scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(sub_frame), GTK_WIDGET(scrolled_window)); @@ -195,7 +195,7 @@ static void drawListWindow(DNAWindowListData window_list, sub_frame = gtk_frame_new(NULL); gtk_box_pack_start(GTK_BOX(vbox), sub_frame, FALSE, FALSE, 0); -#endif /* NO_BUTTONS_YET */ +#endif /* NO_BUTTONS_YET */ /* Now show everything. */ gtk_widget_show_all(window) ; @@ -261,72 +261,72 @@ static gboolean selectionFuncCB(GtkTreeSelection *selection, /* Get the column data */ gtk_tree_model_get(model, &iter, - start_index, &start, - end_index, &end, - seq_type_index, &seq_type, - strand_index, &strand, - frame_index, &frame, + start_index, &start, + end_index, &end, + seq_type_index, &seq_type, + strand_index, &strand, + frame_index, &frame, -1) ; if (!path_currently_selected) { - GtkTreeView *tree_view = NULL; - double grp_start, grp_end ; + GtkTreeView *tree_view = NULL; + double grp_start, grp_end ; ZMapWindow window = window_list->window; - FooCanvasItem *item ; - ZMapFeatureBlock block = NULL ; - GQuark set_id ; - ZMapFrame tmp_frame ; - ZMapStrand tmp_strand ; - int tmp_start = start, tmp_end = end ; + FooCanvasItem *item ; + ZMapFeatureBlock block = NULL ; + GQuark set_id ; + ZMapFrame tmp_frame ; + ZMapStrand tmp_strand ; + int tmp_start = start, tmp_end = end ; - block = window_list->block; - zMapAssert(block) ; + block = window_list->block; + zMapAssert(block) ; - tree_view = gtk_tree_selection_get_tree_view(selection); + tree_view = gtk_tree_selection_get_tree_view(selection); gtk_tree_view_scroll_to_cell(tree_view, path, NULL, FALSE, 0.0, 0.0); - /* conv to dna sequence coords for centering correctly. */ - if (seq_type == ZMAPSEQUENCE_PEPTIDE) - zMapSequencePep2DNA(&tmp_start, &tmp_end, frame) ; - - grp_start = (double)tmp_start ; - grp_end = (double)tmp_end ; - - zmapWindowSeq2CanOffset(&grp_start, &grp_end, block->block_to_sequence.q1) ; - - if (seq_type == ZMAPSEQUENCE_DNA) - { - set_id = zMapStyleCreateID(ZMAP_FIXED_STYLE_DNA_NAME) ; - tmp_strand = ZMAPSTRAND_NONE ; - tmp_frame = ZMAPFRAME_NONE ; - } - else - { - set_id = zMapStyleCreateID(ZMAP_FIXED_STYLE_3FT_NAME) ; - tmp_strand = ZMAPSTRAND_NONE ; - tmp_frame = frame ; - } - - if ((item = zmapWindowFToIFindItemFull(window->context_to_item, - block->parent->unique_id, block->unique_id, - set_id, tmp_strand, tmp_frame, 0))) - { - zmapWindowItemCentreOnItemSubPart(window, item, - FALSE, - 0.0, - grp_start, grp_end) ; - - if (seq_type == ZMAPSEQUENCE_PEPTIDE) - { - zmapWindowItemHighlightRegionTranslations(window, item, start, end) ; - - zMapSequencePep2DNA(&start, &end, frame) ; - } - - zmapWindowItemHighlightDNARegion(window, item, start, end) ; - } + /* conv to dna sequence coords for centering correctly. */ + if (seq_type == ZMAPSEQUENCE_PEPTIDE) + zMapSequencePep2DNA(&tmp_start, &tmp_end, frame) ; + + grp_start = (double)tmp_start ; + grp_end = (double)tmp_end ; + + zmapWindowSeq2CanOffset(&grp_start, &grp_end, block->block_to_sequence.q1) ; + + if (seq_type == ZMAPSEQUENCE_DNA) + { + set_id = zMapStyleCreateID(ZMAP_FIXED_STYLE_DNA_NAME) ; + tmp_strand = ZMAPSTRAND_NONE ; + tmp_frame = ZMAPFRAME_NONE ; + } + else + { + set_id = zMapStyleCreateID(ZMAP_FIXED_STYLE_3FT_NAME) ; + tmp_strand = ZMAPSTRAND_NONE ; + tmp_frame = frame ; + } + + if ((item = zmapWindowFToIFindItemFull(window->context_to_item, + block->parent->unique_id, block->unique_id, + set_id, tmp_strand, tmp_frame, 0))) + { + zmapWindowItemCentreOnItemSubPart(window, item, + FALSE, + 0.0, + grp_start, grp_end) ; + + if (seq_type == ZMAPSEQUENCE_PEPTIDE) + { + zmapWindowItemHighlightRegionTranslations(window, item, start, end) ; + + zMapSequencePep2DNA(&start, &end, frame) ; + } + + zmapWindowItemHighlightDNARegion(window, item, start, end) ; + } } } @@ -424,21 +424,21 @@ enum static void zmap_windowdnalist_class_init(ZMapWindowDNAListClass zmap_tv_class); static void zmap_windowdnalist_init (ZMapWindowDNAList zmap_tv); static void zmap_windowdnalist_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec); + guint param_id, + const GValue *value, + GParamSpec *pspec); static void zmap_windowdnalist_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec); + guint param_id, + GValue *value, + GParamSpec *pspec); static void zmap_windowdnalist_dispose (GObject *object); static void zmap_windowdnalist_finalize(GObject *object); static void setup_dna_tree(ZMapGUITreeView zmap_tree_view); static void dna_get_titles_types_funcs(GList **titles_out, - GList **types_out, - GList **funcs_out, - GList **flags_out); + GList **types_out, + GList **funcs_out, + GList **flags_out); static void dna_match_match_to_value (GValue *value, gpointer user_data); static void dna_match_start_to_value (GValue *value, gpointer user_data); @@ -461,18 +461,18 @@ GType zMapWindowDNAListGetType (void) if (type == 0) { static const GTypeInfo info = - { - sizeof (zmapWindowDNAListClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) zmap_windowdnalist_class_init, - (GClassFinalizeFunc) NULL, - NULL /* class_data */, - sizeof (zmapWindowDNAList), - 0 /* n_preallocs */, - (GInstanceInitFunc) zmap_windowdnalist_init, - NULL - }; + { + sizeof (zmapWindowDNAListClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) zmap_windowdnalist_class_init, + (GClassFinalizeFunc) NULL, + NULL /* class_data */, + sizeof (zmapWindowDNAList), + 0 /* n_preallocs */, + (GInstanceInitFunc) zmap_windowdnalist_init, + NULL + }; type = g_type_register_static (zMapGUITreeViewGetType(), "ZMapWindowDNAList", &info, (GTypeFlags)0); } @@ -490,14 +490,14 @@ ZMapWindowDNAList zMapWindowDNAListCreate(void) } void zMapWindowDNAListAddMatch(ZMapWindowDNAList dna_list, - ZMapDNAMatch match) + ZMapDNAMatch match) { zMapGUITreeViewAddTuple(ZMAP_GUITREEVIEW(dna_list), match); return ; } void zMapWindowDNAListAddMatches(ZMapWindowDNAList dna_list, - GList *list_of_matches) + GList *list_of_matches) { zMapGUITreeViewAddTuples(ZMAP_GUITREEVIEW(dna_list), list_of_matches); return ; @@ -518,27 +518,26 @@ static void zmap_windowdnalist_class_init(ZMapWindowDNAListClass zmap_tv_class) gobject_class->get_property = zmap_windowdnalist_get_property; g_object_class_install_property(gobject_class, - SCREEN_START_COLUMN_INDEX, - g_param_spec_uint("screen-start-index", "screen-start-index", - "Index for the screen start column.", - 0, 128, 0, - ZMAP_PARAM_STATIC_RO)); + SCREEN_START_COLUMN_INDEX, + g_param_spec_uint("screen-start-index", "screen-start-index", + "Index for the screen start column.", + 0, 128, 0, + ZMAP_PARAM_STATIC_RO)); g_object_class_install_property(gobject_class, - SCREEN_END_COLUMN_INDEX, - g_param_spec_uint("screen-end-index", "screen-end-index", - "Index for the screen end column.", - 0, 128, 0, - ZMAP_PARAM_STATIC_RO)); + SCREEN_END_COLUMN_INDEX, + g_param_spec_uint("screen-end-index", "screen-end-index", + "Index for the screen end column.", + 0, 128, 0, + ZMAP_PARAM_STATIC_RO)); /* No need to override this... */ /* parent_class->add_tuple_simple = dna_match_add_simple; */ /* Or parent_class->add_tuples. Parent versions are ok. */ - /* add_tuple_value_list _not_ implemented! Doesn't make sense. MH17:It nas been sine writing this comment */ - zMapGUITreeViewSetAddTupleValueList(parent_class,NULL); -// parent_class->add_tuple_value_list = NULL; + /* add_tuple_value_list _not_ implemented! Doesn't make sense. */ + parent_class->add_tuple_value_list = NULL; gobject_class->dispose = zmap_windowdnalist_dispose; gobject_class->finalize = zmap_windowdnalist_finalize; @@ -554,9 +553,9 @@ static void zmap_windowdnalist_init (ZMapWindowDNAList dna_list) } static void zmap_windowdnalist_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec) + guint param_id, + const GValue *value, + GParamSpec *pspec) { switch(param_id) { @@ -568,9 +567,9 @@ static void zmap_windowdnalist_set_property(GObject *gobject, } static void zmap_windowdnalist_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec) + guint param_id, + GValue *value, + GParamSpec *pspec) { ZMapGUITreeView zmap_tree_view; @@ -578,18 +577,18 @@ static void zmap_windowdnalist_get_property(GObject *gobject, { case SCREEN_START_COLUMN_INDEX: { - unsigned int index; - zmap_tree_view = ZMAP_GUITREEVIEW(gobject); - index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, ZMAP_WDL_SSTART_COLUMN_NAME); - g_value_set_uint(value, index); + unsigned int index; + zmap_tree_view = ZMAP_GUITREEVIEW(gobject); + index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, ZMAP_WDL_SSTART_COLUMN_NAME); + g_value_set_uint(value, index); } break; case SCREEN_END_COLUMN_INDEX: { - unsigned int index; - zmap_tree_view = ZMAP_GUITREEVIEW(gobject); - index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, ZMAP_WDL_SEND_COLUMN_NAME); - g_value_set_uint(value, index); + unsigned int index; + zmap_tree_view = ZMAP_GUITREEVIEW(gobject); + index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, ZMAP_WDL_SEND_COLUMN_NAME); + g_value_set_uint(value, index); } break; default: @@ -628,20 +627,20 @@ static void setup_dna_tree(ZMapGUITreeView zmap_tree_view) GList *column_flags = NULL; dna_get_titles_types_funcs(&column_titles, - &column_types, - &column_funcs, - &column_flags); + &column_types, + &column_funcs, + &column_flags); g_object_set(G_OBJECT(zmap_tree_view), - "row-counter-column", TRUE, - "data-ptr-column", TRUE, - "column_count", g_list_length(column_titles), - "column_names", column_titles, - "column_types", column_types, - "column_funcs", column_funcs, - "column_flags_list", column_flags, - "sortable", TRUE, - NULL); + "row-counter-column", TRUE, + "data-ptr-column", TRUE, + "column_count", g_list_length(column_titles), + "column_names", column_titles, + "column_types", column_types, + "column_funcs", column_funcs, + "column_flags_list", column_flags, + "sortable", TRUE, + NULL); zMapGUITreeViewPrepare(zmap_tree_view); @@ -658,13 +657,13 @@ static void setup_dna_tree(ZMapGUITreeView zmap_tree_view) } static void dna_get_titles_types_funcs(GList **titles_out, - GList **types_out, - GList **funcs_out, - GList **flags_out) + GList **types_out, + GList **funcs_out, + GList **flags_out) { GList *titles, *types, *funcs, *flags; unsigned int flags_set = (ZMAP_GUITREEVIEW_COLUMN_VISIBLE | - ZMAP_GUITREEVIEW_COLUMN_CLICKABLE); + ZMAP_GUITREEVIEW_COLUMN_CLICKABLE); titles = types = funcs = flags = NULL; /* N.B. Order here dictates order of columns */ diff --git a/src/zmapWindow/zmapWindowDNAList_I.h b/src/zmapWindow/zmapWindowDNAList_I.h index 8d77135b3..d8b0e3118 100755 --- a/src/zmapWindow/zmapWindowDNAList_I.h +++ b/src/zmapWindow/zmapWindowDNAList_I.h @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Jun 4 14:19 2008 (rds) * Created: Thu May 22 10:49:23 2008 (rds) - * CVS info: $Id: zmapWindowDNAList_I.h,v 1.2 2010-02-25 14:14:20 mh17 Exp $ + * CVS info: $Id: zmapWindowDNAList_I.h,v 1.3 2010-03-04 13:07:59 mh17 Exp $ *------------------------------------------------------------------- */ @@ -37,7 +37,7 @@ #define __ZMAP_WINDOWDNALIST_I_H__ #include <zmapWindowDNAList.h> -#include <zmapGUITreeView_I.h> /* Finding this might be difficult? */ +#include <zmapGUITreeView_I.h> /* Finding this might be difficult? */ /* * Type checking and casting macros diff --git a/src/zmapWindow/zmapWindowFeatureList.c b/src/zmapWindow/zmapWindowFeatureList.c index 91df5d0f4..4025a8165 100755 --- a/src/zmapWindow/zmapWindowFeatureList.c +++ b/src/zmapWindow/zmapWindowFeatureList.c @@ -30,12 +30,10 @@ * HISTORY: * Last edited: Jun 17 11:37 2009 (rds) * Created: Tue Sep 27 13:06:09 2005 (rds) - * CVS info: $Id: zmapWindowFeatureList.c,v 1.31 2010-02-25 14:14:20 mh17 Exp $ + * CVS info: $Id: zmapWindowFeatureList.c,v 1.32 2010-03-04 13:07:59 mh17 Exp $ *------------------------------------------------------------------- */ - -#include <ZMap/zmapGUITreeView.h> #include <ZMap/zmapFeature.h> #include <zmapWindowFeatureList_I.h> #include <zmapWindow_P.h> @@ -47,7 +45,7 @@ enum { - ZMAP_WFL_NOPROP, /* zero is invalid property id */ + ZMAP_WFL_NOPROP, /* zero is invalid property id */ ZMAP_WFL_FEATURE_TYPE, @@ -72,19 +70,19 @@ typedef struct static void zmap_windowfeaturelist_class_init(ZMapWindowFeatureListClass zmap_tv_class); static void zmap_windowfeaturelist_init(ZMapWindowFeatureList zmap_tv); static void zmap_windowfeaturelist_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec); + guint param_id, + const GValue *value, + GParamSpec *pspec); static void zmap_windowfeaturelist_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec); + guint param_id, + GValue *value, + GParamSpec *pspec); static void zmap_windowfeaturelist_dispose(GObject *object); static void zmap_windowfeaturelist_finalize(GObject *object); static void feature_add_simple(ZMapGUITreeView zmap_tv, - gpointer user_data); + gpointer user_data); /* Which calls some/all of these ZMapGUITreeViewCellFunc's */ static void feature_name_to_value (GValue *value, gpointer feature_data); @@ -106,10 +104,10 @@ static void feature_pointer_to_value (GValue *value, gpointer feature_data); static void setup_tree(ZMapWindowFeatureList zmap_tv, ZMapStyleMode feature_type); /* from the hard coded lists in */ static void feature_type_get_titles_types_funcs(ZMapStyleMode feature_type, - GList **titles_out, - GList **types_out, - GList **funcs_out, - GList **vis_out); + GList **titles_out, + GList **types_out, + GList **funcs_out, + GList **vis_out); /* faster than g_type_class_peek_parent all the time */ static ZMapGUITreeViewClass parent_class_G = NULL; @@ -123,18 +121,18 @@ GType zMapWindowFeatureListGetType (void) if (type == 0) { static const GTypeInfo info = - { - sizeof (zmapWindowFeatureListClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) zmap_windowfeaturelist_class_init, - (GClassFinalizeFunc) NULL, - NULL /* class_data */, - sizeof (zmapWindowFeatureList), - 0 /* n_preallocs */, - (GInstanceInitFunc) zmap_windowfeaturelist_init, - NULL - }; + { + sizeof (zmapWindowFeatureListClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) zmap_windowfeaturelist_class_init, + (GClassFinalizeFunc) NULL, + NULL /* class_data */, + sizeof (zmapWindowFeatureList), + 0 /* n_preallocs */, + (GInstanceInitFunc) zmap_windowfeaturelist_init, + NULL + }; type = g_type_register_static (zMapGUITreeViewGetType(), "ZMapWindowFeatureList", &info, (GTypeFlags)0); } @@ -152,21 +150,21 @@ ZMapWindowFeatureList zMapWindowFeatureCreate(ZMapStyleMode feature_type) g_value_set_uint(&(parameter.value), feature_type); zmap_tv = ((ZMapWindowFeatureList)g_object_newv(zMapWindowFeatureListGetType(), - 1, ¶meter)); + 1, ¶meter)); return zmap_tv; } /* Some convenience functions, with more useful names... */ void zMapWindowFeatureListAddFeature(ZMapWindowFeatureList zmap_tv, - ZMapFeatureAny feature) + ZMapFeatureAny feature) { zMapGUITreeViewAddTuple(ZMAP_GUITREEVIEW(zmap_tv), feature); return ; } void zMapWindowFeatureListListAddFeatures(ZMapWindowFeatureList zmap_tv, - GList *list_of_features) + GList *list_of_features) { zMapGUITreeViewAddTuples(ZMAP_GUITREEVIEW(zmap_tv), list_of_features); return ; @@ -188,12 +186,12 @@ static void zmap_windowfeaturelist_class_init(ZMapWindowFeatureListClass zmap_tv gobject_class->get_property = zmap_windowfeaturelist_get_property; g_object_class_install_property(gobject_class, - ZMAP_WFL_FEATURE_TYPE, - g_param_spec_uint("feature-type", "feature-type", - "Feature Type that the view will be displaying.", - ZMAPSTYLE_MODE_INVALID, 128, - ZMAPSTYLE_MODE_INVALID, - ZMAP_PARAM_STATIC_RW)); + ZMAP_WFL_FEATURE_TYPE, + g_param_spec_uint("feature-type", "feature-type", + "Feature Type that the view will be displaying.", + ZMAPSTYLE_MODE_INVALID, 128, + ZMAPSTYLE_MODE_INVALID, + ZMAP_PARAM_STATIC_RW)); /* override add_tuple_simple. */ parent_class->add_tuple_simple = feature_add_simple; @@ -217,9 +215,9 @@ static void zmap_windowfeaturelist_init(ZMapWindowFeatureList zmap_tv) } static void zmap_windowfeaturelist_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec) + guint param_id, + const GValue *value, + GParamSpec *pspec) { ZMapWindowFeatureList zmap_tv; @@ -231,16 +229,16 @@ static void zmap_windowfeaturelist_set_property(GObject *gobject, { case ZMAP_WFL_FEATURE_TYPE: { - ZMapStyleMode feature_type; - /* Should be g_value_get_enum(value) */ - feature_type = g_value_get_uint(value); - - if(zmap_tv->feature_type == ZMAPSTYLE_MODE_INVALID && - feature_type != ZMAPSTYLE_MODE_INVALID) - { - zmap_tv->feature_type = feature_type; - setup_tree(zmap_tv, feature_type); - } + ZMapStyleMode feature_type; + /* Should be g_value_get_enum(value) */ + feature_type = g_value_get_uint(value); + + if(zmap_tv->feature_type == ZMAPSTYLE_MODE_INVALID && + feature_type != ZMAPSTYLE_MODE_INVALID) + { + zmap_tv->feature_type = feature_type; + setup_tree(zmap_tv, feature_type); + } } break; default: @@ -252,9 +250,9 @@ static void zmap_windowfeaturelist_set_property(GObject *gobject, } static void zmap_windowfeaturelist_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec) + guint param_id, + GValue *value, + GParamSpec *pspec) { switch(param_id) { @@ -286,7 +284,7 @@ static void zmap_windowfeaturelist_finalize(GObject *object) } static void feature_add_simple(ZMapGUITreeView zmap_tv, - gpointer user_data) + gpointer user_data) { ZMapWindowFeatureList zmap_tv_feature; ZMapFeature feature = (ZMapFeature)user_data; @@ -310,10 +308,9 @@ static void feature_add_simple(ZMapGUITreeView zmap_tv, add_simple.window = zmap_tv_feature->window; if(zmap_tv_feature->feature_type != ZMAPSTYLE_MODE_INVALID && - zmap_tv_feature->feature_type == feature->type) - { - zMapGUITreeViewAddTuple(zmap_tv, (gpointer)&add_simple); - } + zmap_tv_feature->feature_type == feature->type && + parent_class_G->add_tuple_simple) + (* parent_class_G->add_tuple_simple)(zmap_tv, &add_simple); return ; } @@ -322,7 +319,7 @@ static void feature_add_simple(ZMapGUITreeView zmap_tv, /* Internals */ static void setup_tree(ZMapWindowFeatureList zmap_tv, - ZMapStyleMode feature_type) + ZMapStyleMode feature_type) { GList *column_titles = NULL; GList *column_types = NULL; @@ -330,21 +327,21 @@ static void setup_tree(ZMapWindowFeatureList zmap_tv, GList *column_flags = NULL; feature_type_get_titles_types_funcs(feature_type, - &column_titles, - &column_types, - &column_funcs, - &column_flags); + &column_titles, + &column_types, + &column_funcs, + &column_flags); g_object_set(G_OBJECT(zmap_tv), - "row-counter-column", TRUE, - "data-ptr-column", FALSE, - "column_count", g_list_length(column_titles), - "column_names", column_titles, - "column_types", column_types, - "column_funcs", column_funcs, - "column_flags_list", column_flags, - "sortable", TRUE, - NULL); + "row-counter-column", TRUE, + "data-ptr-column", FALSE, + "column_count", g_list_length(column_titles), + "column_names", column_titles, + "column_types", column_types, + "column_funcs", column_funcs, + "column_flags_list", column_flags, + "sortable", TRUE, + NULL); zMapGUITreeViewPrepare(ZMAP_GUITREEVIEW(zmap_tv)); @@ -383,17 +380,17 @@ static void feature_start_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_INT) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - if(window) - g_value_set_int(value, zmapWindowCoordToDisplay(window, feature_any->x1)); - else - g_value_set_int(value, feature_any->x1); - break; - default: - g_value_set_int(value, 0); - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + if(window) + g_value_set_int(value, zmapWindowCoordToDisplay(window, feature_any->x1)); + else + g_value_set_int(value, feature_any->x1); + break; + default: + g_value_set_int(value, 0); + break; + } } else zMapAssertNotReached(); @@ -410,17 +407,17 @@ static void feature_end_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_INT) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - if(window) - g_value_set_int(value, zmapWindowCoordToDisplay(window, feature_any->x2)); - else - g_value_set_int(value, feature_any->x2); - break; - default: - g_value_set_int(value, 0); - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + if(window) + g_value_set_int(value, zmapWindowCoordToDisplay(window, feature_any->x2)); + else + g_value_set_int(value, feature_any->x2); + break; + default: + g_value_set_int(value, 0); + break; + } } else zMapAssertNotReached(); @@ -436,14 +433,14 @@ static void feature_strand_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - g_value_set_string(value, zMapFeatureStrand2Str(feature_any->strand)); - break; - default: - g_value_set_string(value, "."); - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + g_value_set_string(value, zMapFeatureStrand2Str(feature_any->strand)); + break; + default: + g_value_set_string(value, "."); + break; + } } else zMapAssertNotReached(); @@ -459,14 +456,14 @@ static void feature_frame_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - g_value_set_string(value, zMapFeatureFrame2Str(feature_any->strand)); - break; - default: - g_value_set_string(value, "."); - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + g_value_set_string(value, zMapFeatureFrame2Str(feature_any->strand)); + break; + default: + g_value_set_string(value, "."); + break; + } } else zMapAssertNotReached(); @@ -482,14 +479,14 @@ static void feature_phase_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - g_value_set_string(value, zMapFeaturePhase2Str(feature_any->strand)); - break; - default: - g_value_set_string(value, "."); - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + g_value_set_string(value, zMapFeaturePhase2Str(feature_any->strand)); + break; + default: + g_value_set_string(value, "."); + break; + } } else zMapAssertNotReached(); @@ -505,24 +502,24 @@ static void feature_qstart_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_INT) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - { - switch(feature_any->type) - { - case ZMAPSTYLE_MODE_ALIGNMENT: - g_value_set_int(value, feature_any->feature.homol.y1); - break; - default: - g_value_set_int(value, 0); - break; - } /* switch(feature->type) */ - } - break; - default: - g_value_set_int(value, 0); - break; - } /* switch(feature->struct_type) */ + { + case ZMAPFEATURE_STRUCT_FEATURE: + { + switch(feature_any->type) + { + case ZMAPSTYLE_MODE_ALIGNMENT: + g_value_set_int(value, feature_any->feature.homol.y1); + break; + default: + g_value_set_int(value, 0); + break; + } /* switch(feature->type) */ + } + break; + default: + g_value_set_int(value, 0); + break; + } /* switch(feature->struct_type) */ } else zMapAssertNotReached(); @@ -539,24 +536,24 @@ static void feature_qend_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_INT) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - { - switch(feature_any->type) - { - case ZMAPSTYLE_MODE_ALIGNMENT: - g_value_set_int(value, feature_any->feature.homol.y2); - break; - default: - g_value_set_int(value, 0); - break; - } /* switch(feature->type) */ - } - break; - default: - g_value_set_int(value, 0); - break; - } /* switch(feature->struct_type) */ + { + case ZMAPFEATURE_STRUCT_FEATURE: + { + switch(feature_any->type) + { + case ZMAPSTYLE_MODE_ALIGNMENT: + g_value_set_int(value, feature_any->feature.homol.y2); + break; + default: + g_value_set_int(value, 0); + break; + } /* switch(feature->type) */ + } + break; + default: + g_value_set_int(value, 0); + break; + } /* switch(feature->struct_type) */ } else zMapAssertNotReached(); @@ -572,24 +569,24 @@ static void feature_qstrand_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - { - switch(feature_any->type) - { - case ZMAPSTYLE_MODE_ALIGNMENT: - g_value_set_string(value, zMapFeatureStrand2Str(feature_any->feature.homol.strand)); - break; - default: - g_value_set_string(value, "."); - break; - } /* switch(feature->type) */ - } - break; - default: - g_value_set_string(value, "."); - break; - } /* switch(feature->struct_type) */ + { + case ZMAPFEATURE_STRUCT_FEATURE: + { + switch(feature_any->type) + { + case ZMAPSTYLE_MODE_ALIGNMENT: + g_value_set_string(value, zMapFeatureStrand2Str(feature_any->feature.homol.strand)); + break; + default: + g_value_set_string(value, "."); + break; + } /* switch(feature->type) */ + } + break; + default: + g_value_set_string(value, "."); + break; + } /* switch(feature->struct_type) */ } else zMapAssertNotReached(); @@ -605,14 +602,14 @@ static void feature_score_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_FLOAT) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - g_value_set_float(value, feature_any->score); - break; - default: - g_value_set_float(value, 0.0); - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + g_value_set_float(value, feature_any->score); + break; + default: + g_value_set_float(value, 0.0); + break; + } } else zMapAssertNotReached(); @@ -628,19 +625,19 @@ static void feature_featureset_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - add_data->feature = feature_any->parent; - feature_name_to_value(value, add_data); - /* Need to reset this! */ - add_data->feature = (ZMapFeatureAny)feature_any; - break; - case ZMAPFEATURE_STRUCT_FEATURESET: - feature_name_to_value(value, add_data); - break; - default: - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + add_data->feature = feature_any->parent; + feature_name_to_value(value, add_data); + /* Need to reset this! */ + add_data->feature = (ZMapFeatureAny)feature_any; + break; + case ZMAPFEATURE_STRUCT_FEATURESET: + feature_name_to_value(value, add_data); + break; + default: + break; + } } else zMapAssertNotReached(); @@ -656,13 +653,13 @@ static void feature_type_to_value(GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - g_value_set_string(value, zMapStyleMode2ExactStr(feature_any->type)); - break; - default: - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + g_value_set_string(value, zMapStyleMode2ExactStr(feature_any->type)); + break; + default: + break; + } } else zMapAssertNotReached(); @@ -678,13 +675,13 @@ static void feature_source_to_value (GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - g_value_set_string(value, g_quark_to_string(feature_any->source_id)); - break; - default: - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + g_value_set_string(value, g_quark_to_string(feature_any->source_id)); + break; + default: + break; + } } else zMapAssertNotReached(); @@ -700,13 +697,13 @@ static void feature_style_to_value (GValue *value, gpointer feature_data) if(G_VALUE_TYPE(value) == G_TYPE_STRING) { switch(feature_any->struct_type) - { - case ZMAPFEATURE_STRUCT_FEATURE: - g_value_set_string(value, g_quark_to_string(feature_any->style_id)); - break; - default: - break; - } + { + case ZMAPFEATURE_STRUCT_FEATURE: + g_value_set_string(value, g_quark_to_string(feature_any->style_id)); + break; + default: + break; + } } else zMapAssertNotReached(); @@ -726,15 +723,15 @@ static void feature_pointer_to_value(GValue *value, gpointer feature_item_data) /* GLists _must_ be freed, but all contents are static (DO NOT FREE) */ static void feature_type_get_titles_types_funcs(ZMapStyleMode feature_type, - GList **titles_out, - GList **types_out, - GList **funcs_out, - GList **flags_out) + GList **titles_out, + GList **types_out, + GList **funcs_out, + GList **flags_out) { GList *titles, *types, *funcs, *flags; gboolean frame_and_phase = FALSE; unsigned int flags_set = (ZMAP_GUITREEVIEW_COLUMN_VISIBLE | - ZMAP_GUITREEVIEW_COLUMN_CLICKABLE); + ZMAP_GUITREEVIEW_COLUMN_CLICKABLE); titles = types = funcs = flags = NULL; @@ -884,19 +881,19 @@ typedef struct static void zmap_windowfeatureitemlist_class_init(ZMapWindowFeatureItemListClass zmap_tv_class); static void zmap_windowfeatureitemlist_init(ZMapWindowFeatureItemList zmap_tv); static void zmap_windowfeatureitemlist_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec); + guint param_id, + const GValue *value, + GParamSpec *pspec); static void zmap_windowfeatureitemlist_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec); + guint param_id, + GValue *value, + GParamSpec *pspec); static void zmap_windowfeatureitemlist_dispose(GObject *object); static void zmap_windowfeatureitemlist_finalize(GObject *object); static void feature_item_add_simple(ZMapGUITreeView zmap_tv, - gpointer user_data); + gpointer user_data); /* Which calls some/all of these ZMapGUITreeViewCellFunc's */ static void feature_item_data_strand_to_value(GValue *value, gpointer feature_item_data); @@ -906,22 +903,22 @@ static void feature_pointer_serialised_to_value (GValue *value, gpointer feature static void setup_item_tree(ZMapWindowFeatureItemList zmap_tv, ZMapStyleMode feature_type); /* from the hard coded lists in */ static void feature_item_type_get_titles_types_funcs(ZMapStyleMode feature_type, - GList **titles_out, - GList **types_out, - GList **funcs_out, - GList **vis_out); + GList **titles_out, + GList **types_out, + GList **funcs_out, + GList **vis_out); static gboolean update_foreach_cb(GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data); + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data); static void free_serialised_data_cb(gpointer user_data); static void invoke_tuple_remove(gpointer list_data, gpointer user_data); static gboolean fetch_lookup_data(ZMapWindowFeatureItemList zmap_tv, - GtkTreeModel *model, - GtkTreeIter *iter, - SerialisedFeatureSearch *lookup_data_out, - ZMapStrand *strand_out, - ZMapFrame *frame_out); + GtkTreeModel *model, + GtkTreeIter *iter, + SerialisedFeatureSearch *lookup_data_out, + ZMapStrand *strand_out, + ZMapFrame *frame_out); static ZMapGUITreeViewClass feature_item_parent_class_G = NULL; @@ -934,18 +931,18 @@ GType zMapWindowFeatureItemListGetType (void) if (type == 0) { static const GTypeInfo info = - { - sizeof (zmapWindowFeatureItemListClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) zmap_windowfeatureitemlist_class_init, - (GClassFinalizeFunc) NULL, - NULL /* class_data */, - sizeof (zmapWindowFeatureItemList), - 0 /* n_preallocs */, - (GInstanceInitFunc) zmap_windowfeatureitemlist_init, - NULL - }; + { + sizeof (zmapWindowFeatureItemListClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) zmap_windowfeatureitemlist_class_init, + (GClassFinalizeFunc) NULL, + NULL /* class_data */, + sizeof (zmapWindowFeatureItemList), + 0 /* n_preallocs */, + (GInstanceInitFunc) zmap_windowfeatureitemlist_init, + NULL + }; type = g_type_register_static (zMapGUITreeViewGetType(), "ZMapWindowFeatureItemList", &info, (GTypeFlags)0); } @@ -963,15 +960,15 @@ ZMapWindowFeatureItemList zMapWindowFeatureItemListCreate(ZMapStyleMode feature_ g_value_set_uint(&(parameter.value), feature_type); zmap_tv = ((ZMapWindowFeatureItemList)g_object_newv(zMapWindowFeatureItemListGetType(), - 1, ¶meter)); + 1, ¶meter)); return zmap_tv; } /* Some convenience functions, with more useful names... */ void zMapWindowFeatureItemListAddItem(ZMapWindowFeatureItemList zmap_tv, - ZMapWindow window, - FooCanvasItem *feature_item) + ZMapWindow window, + FooCanvasItem *feature_item) { zmap_tv->window = NULL; zMapGUITreeViewAddTuple(ZMAP_GUITREEVIEW(zmap_tv), feature_item); @@ -980,8 +977,8 @@ void zMapWindowFeatureItemListAddItem(ZMapWindowFeatureItemList zmap_tv, } void zMapWindowFeatureItemListAddItems(ZMapWindowFeatureItemList zmap_tv, - ZMapWindow window, - GList *list_of_feature_items) + ZMapWindow window, + GList *list_of_feature_items) { zmap_tv->window = window; zMapGUITreeViewAddTuples(ZMAP_GUITREEVIEW(zmap_tv), list_of_feature_items); @@ -990,14 +987,14 @@ void zMapWindowFeatureItemListAddItems(ZMapWindowFeatureItemList zmap_tv, } void zMapWindowFeatureItemListUpdateItem(ZMapWindowFeatureItemList zmap_tv, - ZMapWindow window, - GtkTreeIter *iterator, - FooCanvasItem *feature_item) + ZMapWindow window, + GtkTreeIter *iterator, + FooCanvasItem *feature_item) { SerialisedFeatureSearch feature_data; if(fetch_lookup_data(zmap_tv, ZMAP_GUITREEVIEW(zmap_tv)->tree_model, - iterator, &feature_data, NULL, NULL)) + iterator, &feature_data, NULL, NULL)) free_serialised_data_cb(feature_data); zmap_tv->window = window; @@ -1008,8 +1005,8 @@ void zMapWindowFeatureItemListUpdateItem(ZMapWindowFeatureItemList zmap_tv, } gboolean zMapWindowFeatureItemListUpdateAll(ZMapWindowFeatureItemList zmap_tv, - ZMapWindow window, - GHashTable *context_to_item) + ZMapWindow window, + GHashTable *context_to_item) { ModelForeachStruct full_data = {NULL}; gboolean success = FALSE; @@ -1020,8 +1017,8 @@ gboolean zMapWindowFeatureItemListUpdateAll(ZMapWindowFeatureItemList zmap_tv, full_data.list_incomplete = success; g_object_get(G_OBJECT(zmap_tv), - "tree-model", &full_data.model, - NULL); + "tree-model", &full_data.model, + NULL); zMapGUITreeViewPrepare(ZMAP_GUITREEVIEW(zmap_tv)); @@ -1046,8 +1043,8 @@ gboolean zMapWindowFeatureItemListUpdateAll(ZMapWindowFeatureItemList zmap_tv, } FooCanvasItem *zMapWindowFeatureItemListGetItem(ZMapWindowFeatureItemList zmap_tv, - GHashTable *context_to_item, - GtkTreeIter *iterator) + GHashTable *context_to_item, + GtkTreeIter *iterator) { FooCanvasItem *item = NULL; GtkTreeModel *model = NULL; @@ -1058,34 +1055,34 @@ FooCanvasItem *zMapWindowFeatureItemListGetItem(ZMapWindowFeatureItemList zmap_t g_object_get(G_OBJECT(zmap_tv), - "data-ptr-index", &data_index, - "set-strand-index", &strand_index, - "set-frame-index", &frame_index, - "tree-model", &model, - NULL); + "data-ptr-index", &data_index, + "set-strand-index", &strand_index, + "set-frame-index", &frame_index, + "tree-model", &model, + NULL); gtk_tree_model_get(model, iterator, - data_index, &feature_data, - strand_index, &set_strand, - frame_index, &set_frame, - -1) ; + data_index, &feature_data, + strand_index, &set_strand, + frame_index, &set_frame, + -1) ; if(feature_data) { item = zmapWindowFToIFindItemFull(context_to_item, - feature_data->align_id, - feature_data->block_id, - feature_data->set_id, - set_strand, set_frame, - feature_data->feature_id); + feature_data->align_id, + feature_data->block_id, + feature_data->set_id, + set_strand, set_frame, + feature_data->feature_id); } return item; } ZMapFeature zMapWindowFeatureItemListGetFeature(ZMapWindowFeatureItemList zmap_tv, - GHashTable *context_to_item, - GtkTreeIter *iterator) + GHashTable *context_to_item, + GtkTreeIter *iterator) { ZMapFeature feature = NULL; FooCanvasItem *feature_item = NULL; @@ -1113,42 +1110,40 @@ static void zmap_windowfeatureitemlist_class_init(ZMapWindowFeatureItemListClass gobject_class = (GObjectClass *)zmap_tv_class; parent_class = ZMAP_GUITREEVIEW_CLASS(zmap_tv_class); -// feature_item_parent_class_G = g_type_class_peek_parent(zmap_tv_class); + feature_item_parent_class_G = g_type_class_peek_parent(zmap_tv_class); gobject_class->set_property = zmap_windowfeatureitemlist_set_property; gobject_class->get_property = zmap_windowfeatureitemlist_get_property; g_object_class_install_property(gobject_class, - ZMAP_WFL_FEATURE_TYPE, - g_param_spec_uint("feature-type", "feature-type", - "Feature Type that the view will be displaying.", - ZMAPSTYLE_MODE_INVALID, 128, - ZMAPSTYLE_MODE_INVALID, - ZMAP_PARAM_STATIC_RW)); + ZMAP_WFL_FEATURE_TYPE, + g_param_spec_uint("feature-type", "feature-type", + "Feature Type that the view will be displaying.", + ZMAPSTYLE_MODE_INVALID, 128, + ZMAPSTYLE_MODE_INVALID, + ZMAP_PARAM_STATIC_RW)); g_object_class_install_property(gobject_class, - ZMAP_WFL_SETDATA_STRAND_INDEX, - g_param_spec_uint("set-strand-index", "set-strand-index", - "The index for the set data strand.", - 0, 128, 0, - ZMAP_PARAM_STATIC_RO)); + ZMAP_WFL_SETDATA_STRAND_INDEX, + g_param_spec_uint("set-strand-index", "set-strand-index", + "The index for the set data strand.", + 0, 128, 0, + ZMAP_PARAM_STATIC_RO)); g_object_class_install_property(gobject_class, - ZMAP_WFL_SETDATA_FRAME_INDEX, - g_param_spec_uint("set-frame-index", "set-frame-index", - "The index for the set data frame.", - 0, 128, 0, - ZMAP_PARAM_STATIC_RO)); + ZMAP_WFL_SETDATA_FRAME_INDEX, + g_param_spec_uint("set-frame-index", "set-frame-index", + "The index for the set data frame.", + 0, 128, 0, + ZMAP_PARAM_STATIC_RO)); /* override add_tuple_simple. */ - zMapGUITreeViewSetAddTupleSimple(parent_class,feature_item_add_simple); - //parent_class->add_tuple_simple = feature_item_add_simple; + parent_class->add_tuple_simple = feature_item_add_simple; /* parent_class->add_tuples from parent is ok. */ /* add_tuple_value_list _not_ implemented! Doesn't make sense. */ - zMapGUITreeViewSetAddTupleValueList(parent_class,NULL); - //parent_class->add_tuple_value_list = NULL; + parent_class->add_tuple_value_list = NULL; gobject_class->dispose = zmap_windowfeatureitemlist_dispose; gobject_class->finalize = zmap_windowfeatureitemlist_finalize; @@ -1164,9 +1159,9 @@ static void zmap_windowfeatureitemlist_init(ZMapWindowFeatureItemList zmap_tv) } static void zmap_windowfeatureitemlist_set_property(GObject *gobject, - guint param_id, - const GValue *value, - GParamSpec *pspec) + guint param_id, + const GValue *value, + GParamSpec *pspec) { ZMapWindowFeatureItemList zmap_tv; @@ -1178,18 +1173,18 @@ static void zmap_windowfeatureitemlist_set_property(GObject *gobject, { case ZMAP_WFL_FEATURE_TYPE: { - ZMapStyleMode feature_type; - /* Should be g_value_get_enum(value) */ - feature_type = g_value_get_uint(value); - - if(zmap_tv->feature_type == ZMAPSTYLE_MODE_INVALID && - feature_type != ZMAPSTYLE_MODE_INVALID) - { - zmap_tv->feature_type = feature_type; + ZMapStyleMode feature_type; + /* Should be g_value_get_enum(value) */ + feature_type = g_value_get_uint(value); + + if(zmap_tv->feature_type == ZMAPSTYLE_MODE_INVALID && + feature_type != ZMAPSTYLE_MODE_INVALID) + { + zmap_tv->feature_type = feature_type; #ifdef NOT_SURE_ON_THIS - setup_item_tree(zmap_tv, feature_type); + setup_item_tree(zmap_tv, feature_type); #endif /* NOT_SURE_ON_THIS */ - } + } } break; default: @@ -1201,37 +1196,37 @@ static void zmap_windowfeatureitemlist_set_property(GObject *gobject, } static void zmap_windowfeatureitemlist_get_property(GObject *gobject, - guint param_id, - GValue *value, - GParamSpec *pspec) + guint param_id, + GValue *value, + GParamSpec *pspec) { switch(param_id) { case ZMAP_WFL_SETDATA_STRAND_INDEX: { - ZMapGUITreeView zmap_tree_view; - int index = -1; + ZMapGUITreeView zmap_tree_view; + int index = -1; - zmap_tree_view = ZMAP_GUITREEVIEW(gobject); + zmap_tree_view = ZMAP_GUITREEVIEW(gobject); - index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, - ZMAP_WFL_SETDATASTRAND_COLUMN_NAME); + index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, + ZMAP_WFL_SETDATASTRAND_COLUMN_NAME); - g_value_set_uint(value, index); + g_value_set_uint(value, index); } break; case ZMAP_WFL_SETDATA_FRAME_INDEX: { - ZMapGUITreeView zmap_tree_view; - int index = -1; + ZMapGUITreeView zmap_tree_view; + int index = -1; - zmap_tree_view = ZMAP_GUITREEVIEW(gobject); + zmap_tree_view = ZMAP_GUITREEVIEW(gobject); - index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, - ZMAP_WFL_SETDATAFRAME_COLUMN_NAME); + index = zMapGUITreeViewGetColumnIndexByName(zmap_tree_view, + ZMAP_WFL_SETDATAFRAME_COLUMN_NAME); - g_value_set_uint(value, index); + g_value_set_uint(value, index); } break; default: @@ -1262,7 +1257,7 @@ static void zmap_windowfeatureitemlist_finalize(GObject *object) } static void feature_item_add_simple(ZMapGUITreeView zmap_tv, - gpointer user_data) + gpointer user_data) { ZMapWindowFeatureItemList zmap_tv_feature; FooCanvasItem *item = FOO_CANVAS_ITEM(user_data); @@ -1274,30 +1269,25 @@ static void feature_item_add_simple(ZMapGUITreeView zmap_tv, if((feature = zmapWindowItemGetFeature(item))) { if(zmap_tv_feature->feature_type == ZMAPSTYLE_MODE_INVALID && - feature->type != ZMAPSTYLE_MODE_INVALID) - { - zmap_tv_feature->feature_type = feature->type; - setup_item_tree(zmap_tv_feature, feature->type); - } + feature->type != ZMAPSTYLE_MODE_INVALID) + { + zmap_tv_feature->feature_type = feature->type; + setup_item_tree(zmap_tv_feature, feature->type); + } /* Always add the feature & the item... */ add_simple.feature = (ZMapFeatureAny)feature; add_simple.item = item; if(zmap_tv_feature->window && - zmap_tv_feature->window->display_forward_coords) - add_simple.window = zmap_tv_feature->window; + zmap_tv_feature->window->display_forward_coords) + add_simple.window = zmap_tv_feature->window; if(zmap_tv_feature->feature_type != ZMAPSTYLE_MODE_INVALID && - zmap_tv_feature->feature_type == feature->type) - { - zMapGUITreeViewAddTuple(ZMAP_GUITREEVIEW(zmap_tv_feature),(gpointer) &add_simple); - } -/* && - feature_item_parent_class_G->add_tuple_simple) - (* feature_item_parent_class_G->add_tuple_simple)(zmap_tv, &add_simple); -*/ + zmap_tv_feature->feature_type == feature->type && + feature_item_parent_class_G->add_tuple_simple) + (* feature_item_parent_class_G->add_tuple_simple)(zmap_tv, &add_simple); } return ; @@ -1305,7 +1295,7 @@ static void feature_item_add_simple(ZMapGUITreeView zmap_tv, static void setup_item_tree(ZMapWindowFeatureItemList zmap_tv, - ZMapStyleMode feature_type) + ZMapStyleMode feature_type) { GList *column_titles = NULL; GList *column_types = NULL; @@ -1313,21 +1303,21 @@ static void setup_item_tree(ZMapWindowFeatureItemList zmap_tv, GList *column_flags = NULL; feature_item_type_get_titles_types_funcs(feature_type, - &column_titles, - &column_types, - &column_funcs, - &column_flags); + &column_titles, + &column_types, + &column_funcs, + &column_flags); g_object_set(G_OBJECT(zmap_tv), - "row-counter-column", TRUE, - "data-ptr-column", FALSE, - "column_count", g_list_length(column_titles), - "column_names", column_titles, - "column_types", column_types, - "column_funcs", column_funcs, - "column_flags_list", column_flags, - "sortable", TRUE, - NULL); + "row-counter-column", TRUE, + "data-ptr-column", FALSE, + "column_count", g_list_length(column_titles), + "column_names", column_titles, + "column_types", column_types, + "column_funcs", column_funcs, + "column_flags_list", column_flags, + "sortable", TRUE, + NULL); zMapGUITreeViewPrepare(ZMAP_GUITREEVIEW(zmap_tv)); @@ -1348,19 +1338,19 @@ static void setup_item_tree(ZMapWindowFeatureItemList zmap_tv, static void feature_item_to_bump_hidden_value(GValue *value, gpointer feature_item_data); static void feature_item_to_user_hidden_value(GValue *value, gpointer feature_item_data); static void feature_item_to_is_visible_value (GValue *value, gpointer feature_item_data); -#endif /* DEBUG_MISSING_OBJECTS */ +#endif /* DEBUG_MISSING_OBJECTS */ /* GLists _must_ be freed, but all contents are static (DO NOT FREE) */ static void feature_item_type_get_titles_types_funcs(ZMapStyleMode feature_type, - GList **titles_out, - GList **types_out, - GList **funcs_out, - GList **flags_out) + GList **titles_out, + GList **types_out, + GList **funcs_out, + GList **flags_out) { GList *titles, *types, *funcs, *flags; gboolean frame_and_phase = FALSE; unsigned int flags_set = (ZMAP_GUITREEVIEW_COLUMN_VISIBLE | - ZMAP_GUITREEVIEW_COLUMN_CLICKABLE); + ZMAP_GUITREEVIEW_COLUMN_CLICKABLE); titles = types = funcs = flags = NULL; @@ -1495,7 +1485,7 @@ static void feature_item_type_get_titles_types_funcs(ZMapStyleMode feature_type, funcs = g_list_append(funcs, feature_item_to_is_visible_value); flags = g_list_append(flags, GINT_TO_POINTER(flags_set)); } -#endif /* DEBUG_MISSING_OBJECTS */ +#endif /* DEBUG_MISSING_OBJECTS */ /* FeatureSet Data Frame*/ titles = g_list_append(titles, ZMAP_WINDOWFEATURELIST_STYLE_COLUMN_NAME); @@ -1570,21 +1560,21 @@ static void feature_pointer_serialised_to_value (GValue *value, gpointer feature feature_data->feature_id = feature->unique_id; if(feature->parent) - { - feature_data->set_id = feature->parent->unique_id; - if(feature->parent->parent) - { - feature_data->block_id = feature->parent->parent->unique_id; - if(feature->parent->parent->parent) - { - feature_data->align_id = feature->parent->parent->parent->unique_id; - } - } - } + { + feature_data->set_id = feature->parent->unique_id; + if(feature->parent->parent) + { + feature_data->block_id = feature->parent->parent->unique_id; + if(feature->parent->parent->parent) + { + feature_data->align_id = feature->parent->parent->parent->unique_id; + } + } + } #ifdef DEBUG_FREE_DATA zMapShowMsg(ZMAP_MSG_INFORMATION, - "creating a data struct for feature %s", - g_quark_to_string(feature_data->feature_id)); + "creating a data struct for feature %s", + g_quark_to_string(feature_data->feature_id)); #endif /* DEBUG_FREE_DATA */ /* Someone needs to free this! done in free_serialised_data_cb */ g_value_set_pointer(value, feature_data); @@ -1675,7 +1665,7 @@ static void feature_item_to_is_visible_value(GValue *value, gpointer feature_ite container = (ZMapWindowContainerFeatureSet)feature_set_container; if(feature_item->object.flags & FOO_CANVAS_ITEM_VISIBLE) - is_visible = TRUE; + is_visible = TRUE; g_value_set_string(value, (is_visible ? yes : no)); } @@ -1684,12 +1674,12 @@ static void feature_item_to_is_visible_value(GValue *value, gpointer feature_ite return ; } -#endif /* DEBUG_MISSING_OBJECTS */ +#endif /* DEBUG_MISSING_OBJECTS */ static gboolean update_foreach_cb(GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { ModelForeach full_data = (ModelForeach)user_data; FooCanvasItem *item; @@ -1698,11 +1688,11 @@ static gboolean update_foreach_cb(GtkTreeModel *model, SerialisedFeatureSearchStruct fail_data = {0}; ZMapFrame frame; ZMapStrand strand; - gboolean result = FALSE; /* We keep going to visit all the rows */ + gboolean result = FALSE; /* We keep going to visit all the rows */ /* Attempt to get the item */ if(!fetch_lookup_data(full_data->feature_list, model, iter, - &feature_data, &strand, &frame)) + &feature_data, &strand, &frame)) { /* If above fails then use this data to ensure no item * found and the row gets removed. */ @@ -1716,19 +1706,19 @@ static gboolean update_foreach_cb(GtkTreeModel *model, * Otherwise, coordinate etc, changes should be handled... */ if(!(item = zmapWindowFToIFindItemFull(full_data->context_to_item, - feature_data->align_id, - feature_data->block_id, - feature_data->set_id, - strand, frame, - feature_data->feature_id))) + feature_data->align_id, + feature_data->block_id, + feature_data->set_id, + strand, frame, + feature_data->feature_id))) { item = zmapWindowFToIFindItemFull(full_data->context_to_item, - feature_data->align_id, - feature_data->block_id, - feature_data->set_id, - (strand == ZMAPSTRAND_FORWARD ? ZMAPSTRAND_REVERSE : ZMAPSTRAND_FORWARD), - frame, - feature_data->feature_id); + feature_data->align_id, + feature_data->block_id, + feature_data->set_id, + (strand == ZMAPSTRAND_FORWARD ? ZMAPSTRAND_REVERSE : ZMAPSTRAND_FORWARD), + frame, + feature_data->feature_id); } /* IF, we find the item we can update the tuple from the current @@ -1744,8 +1734,8 @@ static gboolean update_foreach_cb(GtkTreeModel *model, add_simple.item = item; if(full_data->feature_list->window && - full_data->feature_list->window->display_forward_coords == TRUE) - add_simple.window = full_data->feature_list->window; + full_data->feature_list->window->display_forward_coords == TRUE) + add_simple.window = full_data->feature_list->window; /* We need to free this data here as it got allocated earlier * and will be allocated again (from the feature) as a result @@ -1760,8 +1750,8 @@ static gboolean update_foreach_cb(GtkTreeModel *model, GtkTreeRowReference *row_ref; zMapShowMsg(ZMAP_MSG_INFORMATION, - "The row containing feature '%s' will be removed.", - g_quark_to_string(feature_data->feature_id)); + "The row containing feature '%s' will be removed.", + g_quark_to_string(feature_data->feature_id)); /* We need to create a row reference here in order to remove * rows, otherwise the foreach iterator gets it's knickers in a @@ -1782,8 +1772,8 @@ static void free_serialised_data_cb(gpointer user_data) #ifdef DEBUG_FREE_DATA zMapShowMsg(ZMAP_MSG_INFORMATION, - "Freeing data for feature %s", - g_quark_to_string(feature_data->feature_id)); + "Freeing data for feature %s", + g_quark_to_string(feature_data->feature_id)); #endif /* DEBUG_FREE_DATA */ g_free(feature_data); @@ -1805,16 +1795,16 @@ static void invoke_tuple_remove(gpointer list_data, gpointer user_data) model = full_data->model; if(gtk_tree_model_get_iter(model, &iter, path)) - { - SerialisedFeatureSearch feature_data; + { + SerialisedFeatureSearch feature_data; - /* We need to free this data here, as ait got allocated earlier */ - if(fetch_lookup_data(full_data->feature_list, model, &iter, - &feature_data, NULL, NULL)) - free_serialised_data_cb(feature_data); + /* We need to free this data here, as ait got allocated earlier */ + if(fetch_lookup_data(full_data->feature_list, model, &iter, + &feature_data, NULL, NULL)) + free_serialised_data_cb(feature_data); - gtk_list_store_remove(GTK_LIST_STORE(model), &iter); - } + gtk_list_store_remove(GTK_LIST_STORE(model), &iter); + } /* free path??? */ } @@ -1823,11 +1813,11 @@ static void invoke_tuple_remove(gpointer list_data, gpointer user_data) } static gboolean fetch_lookup_data(ZMapWindowFeatureItemList zmap_tv, - GtkTreeModel *model, - GtkTreeIter *iter, - SerialisedFeatureSearch *lookup_data_out, - ZMapStrand *strand_out, - ZMapFrame *frame_out) + GtkTreeModel *model, + GtkTreeIter *iter, + SerialisedFeatureSearch *lookup_data_out, + ZMapStrand *strand_out, + ZMapFrame *frame_out) { SerialisedFeatureSearch feature_data = NULL; ZMapFrame frame; @@ -1836,25 +1826,25 @@ static gboolean fetch_lookup_data(ZMapWindowFeatureItemList zmap_tv, gboolean data_fetched = FALSE; g_object_get(G_OBJECT(zmap_tv), - "data-ptr-index", &data_index, - "set-strand-index", &strand_index, - "set-frame-index", &frame_index, - NULL); + "data-ptr-index", &data_index, + "set-strand-index", &strand_index, + "set-frame-index", &frame_index, + NULL); gtk_tree_model_get(model, iter, - data_index, &feature_data, - strand_index, &strand, - frame_index, &frame, - -1); + data_index, &feature_data, + strand_index, &strand, + frame_index, &frame, + -1); if(feature_data != NULL) { if(lookup_data_out) - *lookup_data_out = feature_data; + *lookup_data_out = feature_data; if(strand_out) - *strand_out = strand; + *strand_out = strand; if(frame_out) - *frame_out = frame; + *frame_out = frame; data_fetched = TRUE; } -- GitLab