src/hg/hgTracks/imageV2.c 1.13

1.13 2009/11/13 00:17:59 tdreszer
Changes to fix no leftLabel bug and changes to support separate button slice (needed for subtracks with separate imgTracks)
Index: src/hg/hgTracks/imageV2.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/imageV2.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -b -B -U 4 -r1.12 -r1.13
--- src/hg/hgTracks/imageV2.c	11 Nov 2009 20:41:29 -0000	1.12
+++ src/hg/hgTracks/imageV2.c	13 Nov 2009 00:17:59 -0000	1.13
@@ -316,8 +316,9 @@
     {
     case isData:   return "data";
     case isSide:   return "side";
     case isCenter: return "center";
+    case isButton: return "button";
     default:       return "unknown";
     }
 }
 
@@ -520,17 +521,17 @@
 return (a->order - b->order);
 }
 
 struct imgSlice *imgTrackSliceAdd(struct imgTrack *imgTrack,enum sliceType type, struct image *img,char *title,int width,int height,int offsetX,int offsetY)
-/* Adds slices to an image track.  Expected are types: isData, isSide and isCenter */
+/* Adds slices to an image track.  Expected are types: isData, isButton, isSide and isCenter */
 {
 struct imgSlice *slice = sliceCreate(type,img,title,width,height,offsetX,offsetY);
 slAddHead(&(imgTrack->slices),slice);
 return imgTrack->slices;
 }
 
 struct imgSlice *imgTrackSliceGetByType(struct imgTrack *imgTrack,enum sliceType type)
-/* Gets a specific slice already added to an image track.  Expected are types: isData, isSide and isCenter */
+/* Gets a specific slice already added to an image track.  Expected are types: isData, isButton, isSide and isCenter */
 {
 struct imgSlice *slice;
 for(slice = imgTrack->slices;slice != NULL;slice=slice->next)
     {
@@ -1142,8 +1142,10 @@
 if(slice->type==isSide)
     hPrintf(" class='sideLab'");
 else if(slice->type==isCenter)
     hPrintf(" class='centerLab'");
+else if(slice->type==isButton)
+    hPrintf(" class='button'");
 #ifdef IMAGEv2_DRAG_SCROLL
 else if(slice->type==isData && imgBox->showPortal)
     hPrintf(" class='panImg' ondrag='{return false;}'");
 #endif //def IMAGEv2_DRAG_SCROLL
@@ -1191,9 +1193,9 @@
             (int)((imgBox->portalStart - imgBox->chromStart) / imgBox->basesPerPixel),imgBox->basesPerPixel);
     }
 #endif//def IMAGEv2_DRAG_SCROLL
 
-hPrintf("<TABLE id='imgTbl' border=0 cellspacing=0 cellpadding=0");
+hPrintf("<TABLE id='imgTbl' border=0 cellspacing=0 cellpadding=0 BGCOLOR='%s'","#AA0000"); //"white");// RED to help find bugs
 hPrintf(" width=%d",imgBox->showPortal?(imgBox->portalWidth+imgBox->sideLabelWidth):imgBox->width);
 #ifdef IMAGEv2_DRAG_REORDER
 hPrintf(" class='tableWithDragAndDrop'");
 #endif//def IMAGEv2_DRAG_REORDER
@@ -1205,11 +1207,17 @@
     {
     char *trackName = (imgTrack->name != NULL ? imgTrack->name : imgTrack->tdb->tableName );
     hPrintf("<TR id='tr_%s'%s>\n",trackName,
         (imgTrack->reorderable?" class='trDraggable'":" class='nodrop nodrag'"));
-    // leftLabel
+
     if(imgBox->showSideLabel && imgBox->plusStrand)
         {
+        // button
+        safef(name, sizeof(name), "btn_%s", trackName);
+        hPrintf(" <TD id='td_%s'%s>\n",name,(imgTrack->reorderable?" class='dragHandle'":""));
+        sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isButton), name,FALSE);
+        hPrintf(" </TD>");
+        // leftLabel
         safef(name,sizeof(name),"side_%s",trackName);
         hPrintf(" <TD id='td_%s'%s>\n",name,
             (imgTrack->reorderable?" class='dragHandle' title='Drag to reorder'":""));
         sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isSide), name,FALSE);
@@ -1229,16 +1238,21 @@
     safef(name, sizeof(name), "data_%s", trackName);
     sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isData), name,(imgTrack->order>0));
     hPrintf(" </TD>");
 
-    // rightLabel
     if(imgBox->showSideLabel && !imgTrack->plusStrand)
         {
+        // rightLabel
         safef(name, sizeof(name), "side_%s", trackName);
         hPrintf(" <TD id='td_%s'%s>\n", name,
             (imgTrack->reorderable?" class='dragHandle' title='Drag to reorder'":""));
         sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isSide), name,FALSE);
         hPrintf(" </TD>\n");
+        // button
+        safef(name, sizeof(name), "btn_%s", trackName);
+        hPrintf(" <TD id='td_%s'%s>\n",name,(imgTrack->reorderable?" class='dragHandle'":""));
+        sliceAndMapDraw(imgBox,imgTrackSliceGetByType(imgTrack,isButton), name,FALSE);
+        hPrintf(" </TD>");
         }
     hPrintf("</TR>\n");
     }
 hPrintf("</TABLE>\n");