From ea6e644361cf7a73d3686e3f74258495664dcb11 Mon Sep 17 00:00:00 2001 From: rds <rds> Date: Thu, 7 May 2009 21:35:14 +0000 Subject: [PATCH] function to get style properties from a list of styles. --- src/zmapWindow/zmapWindowItemFeatureSet.c | 47 ++++++++++++++++++++++- src/zmapWindow/zmapWindowItemFeatureSet.h | 7 +++- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/zmapWindow/zmapWindowItemFeatureSet.c b/src/zmapWindow/zmapWindowItemFeatureSet.c index 8b5cd94c6..e52e0bf2b 100755 --- a/src/zmapWindow/zmapWindowItemFeatureSet.c +++ b/src/zmapWindow/zmapWindowItemFeatureSet.c @@ -27,9 +27,9 @@ * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Apr 27 14:55 2009 (edgrif) + * Last edited: May 7 16:01 2009 (rds) * Created: Mon Jul 30 13:09:33 2007 (rds) - * CVS info: $Id: zmapWindowItemFeatureSet.c,v 1.16 2009-04-28 14:33:41 edgrif Exp $ + * CVS info: $Id: zmapWindowItemFeatureSet.c,v 1.17 2009-05-07 21:35:14 rds Exp $ *------------------------------------------------------------------- */ #include <string.h> /* memset */ @@ -607,6 +607,49 @@ ZMapWindowItemFeatureSetData zmapWindowItemFeatureSetDestroy(ZMapWindowItemFeatu return item_feature_set; } +/* This function is written the wrong way round. It should be + * re-written, along with extract_value_from_style_table so that + * this function is part of utils and extract_value_from_style_table + * calls it. It wouldn't need to be here then! */ +gboolean zmapWindowStyleListGetSetting(GList *list_of_styles, + char *setting_name, + GValue *value_in_out) +{ + GList *list; + gboolean result = FALSE; + + if(value_in_out && (list = g_list_first(list_of_styles))) + { + ItemFeatureValueDataStruct value_data = {}; + GObjectClass *object_class; + GParamSpec *param_spec; + + object_class = g_type_class_peek(ZMAP_TYPE_WINDOW_ITEM_FEATURE_SET); + + if((param_spec = g_object_class_find_property(object_class, setting_name))) + { + value_data.param_id = param_spec->param_id; + value_data.spec_name = setting_name; + value_data.gvalue = value_in_out; + + result = TRUE; + + do + { + ZMapFeatureTypeStyle style; + GQuark unique_id; + + style = ZMAP_FEATURE_STYLE(list->data); + unique_id = zMapStyleGetUniqueID(style); + extract_value_from_style_table(GINT_TO_POINTER(unique_id), style, &value_data); + } + while((list = g_list_next(list))); + } + } + + return result; +} + /* Object code */ static void zmap_window_item_feature_set_class_init(ZMapWindowItemFeatureSetDataClass set_data_class) diff --git a/src/zmapWindow/zmapWindowItemFeatureSet.h b/src/zmapWindow/zmapWindowItemFeatureSet.h index f76033aa0..878d2fb69 100755 --- a/src/zmapWindow/zmapWindowItemFeatureSet.h +++ b/src/zmapWindow/zmapWindowItemFeatureSet.h @@ -27,9 +27,9 @@ * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Apr 27 11:45 2009 (edgrif) + * Last edited: May 7 22:36 2009 (rds) * Created: Fri Feb 6 15:32:46 2009 (rds) - * CVS info: $Id: zmapWindowItemFeatureSet.h,v 1.9 2009-04-28 14:33:41 edgrif Exp $ + * CVS info: $Id: zmapWindowItemFeatureSet.h,v 1.10 2009-05-07 21:36:12 rds Exp $ *------------------------------------------------------------------- */ @@ -111,6 +111,9 @@ void zmapWindowItemFeatureSetFeatureRemove(ZMapWindowItemFeatureSetData item_fea ZMapWindowItemFeatureSetData zmapWindowItemFeatureSetDestroy(ZMapWindowItemFeatureSetData item_feature_set); +gboolean zmapWindowStyleListGetSetting(GList *list_of_styles, + char *setting_name, + GValue *value_in_out); #endif /* __ZMAP_WINDOW_ITEM_FEATURE_SET_H__ */ -- GitLab