From 4521ca0343675e94eaf9aa4c933c664ff2a1d253 Mon Sep 17 00:00:00 2001 From: edgrif <edgrif> Date: Thu, 16 Apr 2009 09:18:41 +0000 Subject: [PATCH] add code to support new hash of featuresets to styles for columns. --- src/include/ZMap/zmapWindow.h | 7 ++++--- src/zmapWindow/zmapWindow.c | 32 ++++++++++++++++++++++++-------- src/zmapWindow/zmapWindow_P.h | 7 +++++-- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/include/ZMap/zmapWindow.h b/src/include/ZMap/zmapWindow.h index f20f08748..34a4a46fb 100755 --- a/src/include/ZMap/zmapWindow.h +++ b/src/include/ZMap/zmapWindow.h @@ -26,9 +26,9 @@ * window displaying genome data. * * HISTORY: - * Last edited: Mar 17 14:05 2009 (edgrif) + * Last edited: Apr 16 07:25 2009 (edgrif) * Created: Thu Jul 24 15:21:56 2003 (edgrif) - * CVS info: $Id: zmapWindow.h,v 1.102 2009-03-17 15:52:20 edgrif Exp $ + * CVS info: $Id: zmapWindow.h,v 1.103 2009-04-16 09:18:41 edgrif Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_H @@ -234,7 +234,8 @@ void zMapWindowBusyHidden(char *file, char *func, ZMapWindow window, gboolean bu void zMapWindowDisplayData(ZMapWindow window, ZMapWindowState state, ZMapFeatureContext current_features, ZMapFeatureContext new_features, - GData *all_styles, GData *new_styles) ; + GData *all_styles, GData *new_styles, + GHashTable *new_featuresets_2_stylelist) ; void zMapWindowUnDisplayData(ZMapWindow window, ZMapFeatureContext current_features, ZMapFeatureContext new_features); diff --git a/src/zmapWindow/zmapWindow.c b/src/zmapWindow/zmapWindow.c index 38d5802d8..113b10171 100755 --- a/src/zmapWindow/zmapWindow.c +++ b/src/zmapWindow/zmapWindow.c @@ -26,9 +26,9 @@ * * Exported functions: See ZMap/zmapWindow.h * HISTORY: - * Last edited: Apr 6 14:50 2009 (edgrif) + * Last edited: Apr 16 09:16 2009 (edgrif) * Created: Thu Jul 24 14:36:27 2003 (edgrif) - * CVS info: $Id: zmapWindow.c,v 1.273 2009-04-06 13:51:18 edgrif Exp $ + * CVS info: $Id: zmapWindow.c,v 1.274 2009-04-16 09:18:41 edgrif Exp $ *------------------------------------------------------------------- */ @@ -65,6 +65,7 @@ typedef struct ZMapFeatureContext new_features ; GData *all_styles ; GData *new_styles ; + GHashTable *featuresets_2_stylelist ; ZMapWindowState state ; /* Can be NULL! */ } FeatureSetsStateStruct, *FeatureSetsState ; @@ -340,6 +341,7 @@ ZMapWindow zMapWindowCreate(GtkWidget *parent_widget, } +/* I DON'T THINK WE NEED THE TWO STYLES PARAMS HERE ACTUALLY.... */ /* Makes a new window that is a copy of the existing one, zoom factor and all. * * NOTE that not all fields are copied here as some need to be done when we draw @@ -354,6 +356,7 @@ ZMapWindow zMapWindowCopy(GtkWidget *parent_widget, char *sequence, GtkAdjustment *hadjustment = NULL, *vadjustment = NULL ; double scroll_x1, scroll_y1, scroll_x2, scroll_y2 ; int x, y ; + GHashTable *featureset_2_styles ; zMapWindowBusy(original_window, TRUE) ; @@ -426,22 +429,28 @@ ZMapWindow zMapWindowCopy(GtkWidget *parent_widget, char *sequence, foo_canvas_scroll_to(original_window->canvas, x, y) ; foo_canvas_scroll_to(new_window->canvas, x, y) ; + + /* Copy styles etc. */ + featureset_2_styles = zMap_g_hashlist_copy(original_window->featureset_2_styles) ; + + /* You cannot just draw the features here as the canvas needs to be realised so we send * an event to get the data drawn which means that the canvas is guaranteed to be * realised by the time we draw into it. */ { ZMapWindowState state; + state = zmapWindowStateCreate(); zmapWindowStateSaveMark(state, original_window); zmapWindowStateSaveFocusItems(state, original_window); - if(window_split_save_bumped_G) + if (window_split_save_bumped_G) zmapWindowStateSaveBumpedColumns(state, original_window); /* should we be passing in a copy of the full set of original styles ? */ zMapWindowDisplayData(new_window, state, feature_context, feature_context, - read_only_styles, display_styles) ; + read_only_styles, display_styles, featureset_2_styles) ; } zMapWindowBusy(original_window, FALSE) ; @@ -481,7 +490,8 @@ void zMapWindowBusyHidden(char *file, char *func, ZMapWindow window, gboolean bu * */ void zMapWindowDisplayData(ZMapWindow window, ZMapWindowState state, ZMapFeatureContext current_features, ZMapFeatureContext new_features, - GData *all_styles, GData *new_styles) + GData *all_styles, GData *new_styles, + GHashTable *new_featuresets_2_stylelist) { FeatureSetsState feature_sets ; @@ -493,7 +503,7 @@ void zMapWindowDisplayData(ZMapWindow window, ZMapWindowState state, feature_sets->new_features = new_features ; zMapStyleCopyAllStyles(&all_styles, &(feature_sets->all_styles)) ; zMapStyleCopyAllStyles(&new_styles, &(feature_sets->new_styles)) ; - + feature_sets->featuresets_2_stylelist = new_featuresets_2_stylelist ; feature_sets->state = state ; /* We either turn the busy cursor on here if there is already a window or we do it in the expose @@ -718,7 +728,9 @@ void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_conte zMapWindowUpdateInfoPanel(window, NULL, NULL, NULL, TRUE, FALSE) ; if (state_saves_position) - zmapWindowStateSavePosition(state, window); + { + zmapWindowStateSavePosition(state, window); + } else { adjust = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->scrolled_window)) ; @@ -772,7 +784,8 @@ void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_conte /* You cannot just draw the features here as the canvas needs to be realised so we send * an event to get the data drawn which means that the canvas is guaranteed to be * realised by the time we draw into it. */ - zMapWindowDisplayData(window, state, feature_context, feature_context, all_styles, new_styles) ; + zMapWindowDisplayData(window, state, feature_context, feature_context, + all_styles, new_styles, NULL) ; /* stop the expose avoidance */ zmapWindowUninterruptExpose(window); @@ -2362,6 +2375,9 @@ static gboolean dataEventCB(GtkWidget *widget, GdkEventClient *event, gpointer c zMapLogWarning("%s", "Errors in copying read only and display styles.") ; + /* Redo the hash ??? or should this be once only ????? */ + window->featureset_2_styles = feature_sets->featuresets_2_stylelist ; + /* Draw the features on the canvas */ zmapWindowDrawFeatures(window, feature_sets->current_features, diff_context) ; diff --git a/src/zmapWindow/zmapWindow_P.h b/src/zmapWindow/zmapWindow_P.h index f1c4309a9..58d8f3fb1 100755 --- a/src/zmapWindow/zmapWindow_P.h +++ b/src/zmapWindow/zmapWindow_P.h @@ -25,9 +25,9 @@ * Description: Defines internal interfaces/data structures of zMapWindow. * * HISTORY: - * Last edited: Apr 6 14:49 2009 (edgrif) + * Last edited: Apr 16 09:08 2009 (edgrif) * Created: Fri Aug 1 16:45:58 2003 (edgrif) - * CVS info: $Id: zmapWindow_P.h,v 1.236 2009-04-06 13:51:19 edgrif Exp $ + * CVS info: $Id: zmapWindow_P.h,v 1.237 2009-04-16 09:18:41 edgrif Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_P_H @@ -643,6 +643,9 @@ typedef struct _ZMapWindowStruct ZMapFeatureContext strand_separator_context ; /* context to display non-feature context "features" with. */ GList *feature_set_names ; /* Gives names/order of columns to be displayed. */ + GHashTable *featureset_2_styles ; /* Links column names to the styles + for that column. */ + GHashTable *context_to_item ; /* Links parts of a feature context to the canvas groups/items that -- GitLab