diff --git a/src/zmapFeature/zmapFeatureTypes.c b/src/zmapFeature/zmapFeatureTypes.c index f7ab6713e6f1a6c2d898d3d2c6a1fa1485716cb1..7f836c8dd970b5d3ac97153efaef8cb317cd6d3b 100755 --- a/src/zmapFeature/zmapFeatureTypes.c +++ b/src/zmapFeature/zmapFeatureTypes.c @@ -27,9 +27,9 @@ * * Exported functions: See ZMap/zmapFeature.h * HISTORY: - * Last edited: Apr 1 14:02 2008 (edgrif) + * Last edited: Apr 10 15:05 2008 (rds) * Created: Tue Dec 14 13:15:11 2004 (edgrif) - * CVS info: $Id: zmapFeatureTypes.c,v 1.61 2008-04-01 13:04:58 edgrif Exp $ + * CVS info: $Id: zmapFeatureTypes.c,v 1.62 2008-04-10 14:19:49 rds Exp $ *------------------------------------------------------------------- */ @@ -972,6 +972,16 @@ ZMapStyleOverlapMode zMapStyleGetOverlapMode(ZMapFeatureTypeStyle style) return mode; } +ZMapStyleOverlapMode zMapStyleGetDefaultOverlapMode(ZMapFeatureTypeStyle style) +{ + ZMapStyleOverlapMode mode = ZMAPOVERLAP_COMPLETE; + + zMapAssert(style) ; + + mode = style->default_overlap_mode ; + + return mode; +} diff --git a/src/zmapWindow/zmapWindow.c b/src/zmapWindow/zmapWindow.c index 100fe19d60834ea389ba48d7eb63763e17d7bc41..cfae335a281f20c5e949feb957d9ca14a1b8b728 100755 --- a/src/zmapWindow/zmapWindow.c +++ b/src/zmapWindow/zmapWindow.c @@ -26,9 +26,9 @@ * * Exported functions: See ZMap/zmapWindow.h * HISTORY: - * Last edited: Mar 31 14:55 2008 (edgrif) + * Last edited: Apr 10 15:05 2008 (rds) * Created: Thu Jul 24 14:36:27 2003 (edgrif) - * CVS info: $Id: zmapWindow.c,v 1.237 2008-03-31 16:37:28 edgrif Exp $ + * CVS info: $Id: zmapWindow.c,v 1.238 2008-04-10 14:19:34 rds Exp $ *------------------------------------------------------------------- */ @@ -3409,7 +3409,7 @@ static gboolean keyboardEvent(ZMapWindow window, GdkEventKey *key_event) if (curr_overlap_mode != ZMAPOVERLAP_COMPLETE) overlap_mode = ZMAPOVERLAP_COMPLETE ; else - overlap_mode = zMapStyleResetOverlapMode(set_data->style) ; + overlap_mode = zMapStyleGetDefaultOverlapMode(set_data->style) ; if (key_event->keyval == GDK_B) { @@ -4076,6 +4076,9 @@ static void hideItemsCB(gpointer data, gpointer user_data) GList **list_ptr = (GList **)user_data ; GList *user_hidden_items = *list_ptr ; + zMapAssert(FOO_IS_CANVAS_ITEM(item)); + + foo_canvas_item_hide(item) ; user_hidden_items = g_list_append(user_hidden_items, item) ; diff --git a/src/zmapWindow/zmapWindowColBump.c b/src/zmapWindow/zmapWindowColBump.c index 396f7d2c816db5d7874005f59e0a16d37328b9ad..5685767d8bf7deaeeb9bf75f4c0dde326a5a0220 100755 --- a/src/zmapWindow/zmapWindowColBump.c +++ b/src/zmapWindow/zmapWindowColBump.c @@ -27,9 +27,9 @@ * * Exported functions: See zmapWindow_P.h * HISTORY: - * Last edited: Apr 10 09:50 2008 (rds) + * Last edited: Apr 10 14:54 2008 (rds) * Created: Tue Sep 4 10:52:09 2007 (edgrif) - * CVS info: $Id: zmapWindowColBump.c,v 1.20 2008-04-10 08:54:41 rds Exp $ + * CVS info: $Id: zmapWindowColBump.c,v 1.21 2008-04-10 14:19:26 rds Exp $ *------------------------------------------------------------------- */ @@ -305,9 +305,10 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleOverlapMode ZMapContainerLevelType container_type ; FooCanvasGroup *column_group = NULL ; ZMapWindowItemFeatureSetData set_data ; + ZMapStyleOverlapMode historic_bump_mode; gboolean column = FALSE ; gboolean bumped = TRUE ; - gboolean mark_set ; + gboolean mark_set; int start, end ; @@ -358,6 +359,8 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleOverlapMode else style = set_data->style ; + /* We need this to know whether to remove and add Gaps */ + historic_bump_mode = zMapStyleGetOverlapMode(style) ; /* We may have created extra items for some bump modes to show all matches from the same query * etc. so now we need to get rid of them before redoing the bump. */ @@ -372,7 +375,7 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleOverlapMode /* Some items may have had their gaps added for some bump modes, they need to have * them removed. */ - if (set_data->gaps_added_items) + if (set_data->gaps_added_items && historic_bump_mode != bump_mode) { g_list_foreach(set_data->gaps_added_items, removeGapsCB, set_data->window) ; @@ -585,7 +588,7 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleOverlapMode /* TRY JUST ADDING GAPS IF A MARK IS SET */ - if (mark_set) + if (mark_set && historic_bump_mode != bump_mode) { /* What we need to do here is as in the pseudo code.... */ g_list_foreach(names_list, addGapsCB, &gaps_data) ; @@ -1501,10 +1504,18 @@ static void removeGapsCB(gpointer data, gpointer user_data) /* Note the logic here....if we are in this routine its because the feature _is_ * and alignment AND its style is set to no gaps, so unlike when we draw we don't * have to set any flags.... */ +#ifdef RT_63281 + if(FOO_CANVAS_ITEM(item)->object.flags & FOO_CANVAS_ITEM_VISIBLE) + { +#endif /* RT_63281 */ + + item = zMapWindowFeatureReplace(window, item, feature, FALSE) ; + /* replace feature with itself. */ + zMapAssert(item) ; - item = zMapWindowFeatureReplace(window, item, feature, FALSE) ; - /* replace feature with itself. */ - zMapAssert(item) ; +#ifdef RT_63281 + } +#endif /* RT_63281 */ return ; } diff --git a/src/zmapWindow/zmapWindowFeature.c b/src/zmapWindow/zmapWindowFeature.c index eed6d6209b7a05b4314174e470adcfe7e5d0d76d..9693f93818c765a9731f2bb1f8275c9ce7d7e2e1 100755 --- a/src/zmapWindow/zmapWindowFeature.c +++ b/src/zmapWindow/zmapWindowFeature.c @@ -28,9 +28,9 @@ * * Exported functions: See zmapWindow_P.h * HISTORY: - * Last edited: Mar 20 19:15 2008 (roy) + * Last edited: Apr 10 15:12 2008 (rds) * Created: Mon Jan 9 10:25:40 2006 (edgrif) - * CVS info: $Id: zmapWindowFeature.c,v 1.127 2008-03-20 19:23:27 rds Exp $ + * CVS info: $Id: zmapWindowFeature.c,v 1.128 2008-04-10 14:19:13 rds Exp $ *------------------------------------------------------------------- */ @@ -402,6 +402,12 @@ gboolean zMapWindowFeatureRemove(ZMapWindow zmap_window, FooCanvasItem *feature_ zmapWindowMarkSetWorldRange(zmap_window->mark, x1, y1, x2, y2); } +#ifdef RT_63281 + /* I thought this call would be needed, but it turns out that the bump code + * needed to not removeGapsCB and addGapsCB when not changing bump mode. */ + zmapWindowItemFeatureSetFeatureRemove(set_data, feature); +#endif RT_63281 + /* destroy the canvas item...this will invoke canvasItemDestroyCB() */ gtk_object_destroy(GTK_OBJECT(feature_item)) ; diff --git a/src/zmapWindow/zmapWindowItemFeatureSet.c b/src/zmapWindow/zmapWindowItemFeatureSet.c index 1385b43c4e142326f3ea034cea1d0f1c724affd1..4a9e77dfdd2ecfc914c0551da187ae03152b48bc 100755 --- a/src/zmapWindow/zmapWindowItemFeatureSet.c +++ b/src/zmapWindow/zmapWindowItemFeatureSet.c @@ -27,15 +27,31 @@ * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Jul 30 16:50 2007 (rds) + * Last edited: Apr 10 15:16 2008 (rds) * Created: Mon Jul 30 13:09:33 2007 (rds) - * CVS info: $Id: zmapWindowItemFeatureSet.c,v 1.1 2007-07-31 16:21:15 rds Exp $ + * CVS info: $Id: zmapWindowItemFeatureSet.c,v 1.2 2008-04-10 14:19:01 rds Exp $ *------------------------------------------------------------------- */ +#include <ZMap/zmapUtils.h> #include <zmapWindow_P.h> +typedef struct +{ + GList *list; + ZMapFeature feature; +}ListFeatureStruct, *ListFeature; + +typedef struct +{ + GQueue *queue; + ZMapFeature feature; +}QueueFeatureStruct, *QueueFeature; + +static void queueRemoveFromList(gpointer queue_data, gpointer user_data); +static void listRemoveFromList(gpointer list_data, gpointer user_data); static void removeList(gpointer data, gpointer user_data_unused) ; +static void zmap_g_queue_replace(GQueue *queue, gpointer old, gpointer new); ZMapWindowItemFeatureSetData zmapWindowItemFeatureSetCreate(ZMapWindow window, @@ -68,7 +84,7 @@ void zmapWindowItemFeatureSetDestroy(ZMapWindowItemFeatureSetData item_feature_s if(item_feature_set->style_table) zmapWindowStyleTableDestroy(item_feature_set->style_table); - /* Get rid of stack or user hidden items. */ + /* Get rid of stack of user hidden items. */ if(!g_queue_is_empty(item_feature_set->user_hidden_stack)) g_queue_foreach(item_feature_set->user_hidden_stack, removeList, NULL) ; @@ -80,6 +96,24 @@ void zmapWindowItemFeatureSetDestroy(ZMapWindowItemFeatureSetData item_feature_s return ; } +/* As we keep a list of the item we need to delete them at times. This is actually _not_ + * used ATM (Apr 2008) as the reason it was written turned out to have a better solution + * RT# 63281. Anyway the code is here if needed. + */ +void zmapWindowItemFeatureSetFeatureRemove(ZMapWindowItemFeatureSetData item_feature_set, + ZMapFeature feature) +{ + QueueFeatureStruct queue_feature; + + queue_feature.queue = item_feature_set->user_hidden_stack; + queue_feature.feature = feature; + /* user_hidden_stack is a copy of the list in focus. We need to + * remove items when they get destroyed */ + g_queue_foreach(queue_feature.queue, queueRemoveFromList, &queue_feature); + + return ; +} + /* INTERNAL */ @@ -92,4 +126,58 @@ static void removeList(gpointer data, gpointer user_data_unused) return ; } +static void queueRemoveFromList(gpointer queue_data, gpointer user_data) +{ + GList *item_list = (GList *)queue_data; + QueueFeature queue_feature = (QueueFeature)user_data; + ListFeatureStruct list_feature; + + list_feature.list = item_list; + list_feature.feature = (ZMapFeature)queue_feature->feature; + + g_list_foreach(item_list, listRemoveFromList, &list_feature); + + if(list_feature.list != item_list) + zmap_g_queue_replace(queue_feature->queue, item_list, list_feature.list); + + return; +} + + +static void listRemoveFromList(gpointer list_data, gpointer user_data) +{ + ListFeature list_feature = (ListFeature)user_data; + ZMapFeature item_feature; + FooCanvasItem *item; + + zMapAssert(FOO_IS_CANVAS_ITEM(list_data)); + + item = FOO_CANVAS_ITEM(list_data); + item_feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA); + zMapAssert(item_feature); + + if(item_feature == list_feature->feature) + list_feature->list = g_list_remove(list_feature->list, item); + + return ; +} + +static void zmap_g_queue_replace(GQueue *queue, gpointer old, gpointer new) +{ + int length, index; + + if((length = g_queue_get_length(queue))) + { + if((index = g_queue_index(queue, old)) != -1) + { + gpointer popped = g_queue_pop_nth(queue, index); + zMapAssert(popped == old); + g_queue_push_nth(queue, new, index); + } + } + else + g_queue_push_head(queue, new); + + return ; +}