From d7838495b7addc75d96dfa7f1a0de046e1b887cb Mon Sep 17 00:00:00 2001
From: mh17 <mh17>
Date: Wed, 20 Jan 2010 15:35:44 +0000
Subject: [PATCH] made unbump all columns work as exepcted

---
 src/zmapWindow/zmapWindowColBump.c | 43 ++++++++++++++++++++++++++++--
 src/zmapWindow/zmapWindowMenus.c   | 24 ++++++++++++++---
 src/zmapWindow/zmapWindow_P.h      |  3 ++-
 3 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/src/zmapWindow/zmapWindowColBump.c b/src/zmapWindow/zmapWindowColBump.c
index 330006487..2179d95f5 100755
--- a/src/zmapWindow/zmapWindowColBump.c
+++ b/src/zmapWindow/zmapWindowColBump.c
@@ -29,7 +29,7 @@
  * HISTORY:
  * Last edited: Jan 11 09:16 2010 (edgrif)
  * Created: Tue Sep  4 10:52:09 2007 (edgrif)
- * CVS info:   $Id: zmapWindowColBump.c,v 1.56 2010-01-15 11:05:35 mh17 Exp $
+ * CVS info:   $Id: zmapWindowColBump.c,v 1.57 2010-01-20 15:35:44 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -228,6 +228,8 @@ static ZMapStyleBumpMode hack_initial_mode(ZMapFeatureTypeStyle style);
 
 static void invoke_bump_to_initial(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				   ZMapContainerLevelType level, gpointer user_data);
+static void invoke_bump_to_unbump(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
+                           ZMapContainerLevelType level, gpointer user_data);
 
 /* Merely a cover function for the real bumping code function zmapWindowColumnBumpRange(). */
 void zmapWindowColumnBump(FooCanvasItem *column_item, ZMapStyleBumpMode bump_mode)
@@ -774,6 +776,23 @@ void zmapWindowColumnBumpAllInitial(FooCanvasItem *column_item)
   return ;
 }
 
+void zmapWindowColumnUnbumpAll(FooCanvasItem *column_item)
+{
+  ZMapWindowContainerGroup container_strand;
+
+  /* Get the strand level container */
+  if((container_strand = zmapWindowContainerUtilsItemGetParentLevel(column_item, ZMAPCONTAINER_LEVEL_STRAND)))
+    {
+      /* container execute */
+      zmapWindowContainerUtilsExecute(container_strand, 
+                              ZMAPCONTAINER_LEVEL_FEATURESET,
+                              invoke_bump_to_unbump, NULL);
+      /* happy days */
+
+    }
+
+  return ;
+}
 
 
 /* 
@@ -2467,7 +2486,7 @@ static ColinearityType featureHomolIsColinear(ZMapWindow window,  unsigned int m
 }
 
 
-
+// (menu item commented out)
 static void invoke_bump_to_initial(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				   ZMapContainerLevelType level, gpointer user_data)
 {
@@ -2494,3 +2513,23 @@ static void invoke_bump_to_initial(ZMapWindowContainerGroup container, FooCanvas
 
   return ;
 }
+
+
+
+static void invoke_bump_to_unbump(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
+                           ZMapContainerLevelType level, gpointer user_data)
+{
+
+  switch(level)
+    {
+    case ZMAPCONTAINER_LEVEL_FEATURESET:
+      {
+      zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(container), ZMAPBUMP_UNBUMP, ZMAPWINDOW_COMPRESS_ALL);
+      }
+      break;
+    default:
+      break;
+    }
+
+  return ;
+}
diff --git a/src/zmapWindow/zmapWindowMenus.c b/src/zmapWindow/zmapWindowMenus.c
index 80b405e0e..127ba60d8 100755
--- a/src/zmapWindow/zmapWindowMenus.c
+++ b/src/zmapWindow/zmapWindowMenus.c
@@ -29,7 +29,7 @@
  * HISTORY:
  * Last edited: Dec 16 10:32 2009 (edgrif)
  * Created: Thu Mar 10 07:56:27 2005 (edgrif)
- * CVS info:   $Id: zmapWindowMenus.c,v 1.64 2009-12-16 11:10:45 edgrif Exp $
+ * CVS info:   $Id: zmapWindowMenus.c,v 1.65 2010-01-20 15:35:44 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -110,6 +110,7 @@ typedef struct
 static void compressMenuCB(int menu_item_id, gpointer callback_data);
 static void configureMenuCB(int menu_item_id, gpointer callback_data) ;
 static void bumpToInitialCB(int menu_item_id, gpointer callback_data);
+static void unbumpAllCB(int menu_item_id, gpointer callback_data);
 static void bumpMenuCB(int menu_item_id, gpointer callback_data) ;
 static void bumpToggleMenuCB(int menu_item_id, gpointer callback_data) ;
 static void dnaMenuCB(int menu_item_id, gpointer callback_data) ;
@@ -185,7 +186,8 @@ ZMapGUIMenuItem zmapWindowMakeMenuBump(int *start_index_inout,
       {ZMAPGUI_MENU_RADIO,  NULL,                                     ZMAPBUMP_ALTERNATING,        bumpMenuCB, NULL},
       {ZMAPGUI_MENU_RADIO,  NULL,                                     ZMAPBUMP_ALL,                bumpMenuCB, NULL},
       {ZMAPGUI_MENU_RADIO,  NULL,                                     ZMAPBUMP_UNBUMP,                bumpMenuCB, NULL},
-      {ZMAPGUI_MENU_NORMAL, "Unbump All Columns",                     0,                              bumpToInitialCB, NULL},
+      {ZMAPGUI_MENU_NORMAL, "Unbump All Columns",                     0,                              unbumpAllCB, NULL},
+//      {ZMAPGUI_MENU_NORMAL, "Bump All Columns to Default",            0,                              bumpToInitialCB, NULL},
       {ZMAPGUI_MENU_NORMAL, "Compress Columns",                       ZMAPWINDOW_COMPRESS_MARK,    compressMenuCB,  NULL, "c"},
       {ZMAPGUI_MENU_NORMAL, "UnCompress Columns",                     ZMAPWINDOW_COMPRESS_VISIBLE, compressMenuCB,  NULL, "<shift>C"},
       {ZMAPGUI_MENU_NONE, NULL, 0, NULL, NULL}
@@ -744,7 +746,7 @@ static void configureMenuCB(int menu_item_id, gpointer callback_data)
   return ;
 }
 
-static void bumpToInitialCB(int menu_item_id, gpointer callback_data)
+static void bumpToInitialCB(int menu_item_id, gpointer callback_data) // menu item commented out
 {
   ItemMenuCBData menu_data = (ItemMenuCBData)callback_data ;
   FooCanvasGroup *column_group ;
@@ -760,6 +762,22 @@ static void bumpToInitialCB(int menu_item_id, gpointer callback_data)
   return ;
 }
 
+static void unbumpAllCB(int menu_item_id, gpointer callback_data)
+{
+  ItemMenuCBData menu_data = (ItemMenuCBData)callback_data ;
+  FooCanvasGroup *column_group ;
+
+  column_group = menuDataItemToColumn(menu_data->item);
+
+  zmapWindowColumnUnbumpAll(FOO_CANVAS_ITEM(column_group));
+
+  zmapWindowFullReposition(menu_data->window);
+
+  g_free(menu_data) ;
+
+  return ;
+}
+
 /* Bump a column and reposition the other columns.
  * 
  * NOTE that this function may be called for an individual feature OR a column and
diff --git a/src/zmapWindow/zmapWindow_P.h b/src/zmapWindow/zmapWindow_P.h
index 23bdf2e6e..b3683a0f1 100755
--- a/src/zmapWindow/zmapWindow_P.h
+++ b/src/zmapWindow/zmapWindow_P.h
@@ -27,7 +27,7 @@
  * HISTORY:
  * Last edited: Oct 14 11:57 2009 (edgrif)
  * Created: Fri Aug  1 16:45:58 2003 (edgrif)
- * CVS info:   $Id: zmapWindow_P.h,v 1.247 2009-10-14 16:54:57 edgrif Exp $
+ * CVS info:   $Id: zmapWindow_P.h,v 1.248 2010-01-20 15:35:45 mh17 Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_WINDOW_P_H
@@ -987,6 +987,7 @@ void zmapWindowColumnBump(FooCanvasItem *bump_item, ZMapStyleBumpMode bump_mode)
 void zmapWindowColumnBumpRange(FooCanvasItem *bump_item,
 			       ZMapStyleBumpMode bump_mode, ZMapWindowCompressMode compress_mode) ;
 void zmapWindowColumnBumpAllInitial(FooCanvasItem *column_item);
+void zmapWindowColumnUnbumpAll(FooCanvasItem *column_item);
 void zmapWindowColumnWriteDNA(ZMapWindow window, FooCanvasGroup *column_parent);
 void zmapWindowColumnHide(FooCanvasGroup *column_group) ;
 void zmapWindowColumnShow(FooCanvasGroup *column_group) ;
-- 
GitLab