src/hg/hgTracks/variation.c 1.143

1.143 2009/08/27 00:10:16 tdreszer
Fixed a couple bugs and ensured ps-pdf code still works with IMAGEv2
Index: src/hg/hgTracks/variation.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/variation.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -b -B -U 4 -r1.142 -r1.143
--- src/hg/hgTracks/variation.c	26 Jun 2009 20:16:56 -0000	1.142
+++ src/hg/hgTracks/variation.c	27 Aug 2009 00:10:16 -0000	1.143
@@ -1229,13 +1229,13 @@
 		  char *name, char *shortLabel, char *trackName)
 /* Print out image map rectangle that invokes hgTrackUi. */
 {
 #ifdef IMAGEv2_UI
-if(curMap != NULL)
+if(theImgBox && curMap)
     {
     char link[512];
-    safef(link,sizeof(link),"%s?%s=%u&c=%s&g=%s&i=%s", hgTrackUiName(),
-	   cartSessionVarName(), cartSessionId(cart), chromName, trackName, name);
+    safef(link,sizeof(link),"%s?%s=%u&g=%s&i=%s", hgTrackUiName(),
+    cartSessionVarName(), cartSessionId(cart), trackName, name);
     char title[128];
     safef(title,sizeof(title),"%s controls", shortLabel);
     // Add map item to currnent map (TODO: pass in map)
     // FIXME: What am I going to do about poly cords???
@@ -1248,46 +1248,50 @@
     // FIXME: What am I going to do about poly cords???
     // FIXME: What am I going to do about poly cords???
     warn("Track named %s has called for a POLY map titled '%s controls', but imageV2 doesn't yet support this. No map item made.",trackName,shortLabel);
     }
-#else//ifndef IMAGEv2_UI
-hPrintf("<AREA SHAPE=POLY COORDS=\"%d,%d,%d,%d,%d,%d,%d,%d\" ",
+else
+#endif//def IMAGEv2_UI
+    {
+    hPrintf("<AREA SHAPE=POLY COORDS=\"%d,%d,%d,%d,%d,%d,%d,%d\" ",
 	hvGfxAdjX(hvg, xl), yl,
         hvGfxAdjX(hvg, xt), yt,
         hvGfxAdjX(hvg, xr), yr,
         hvGfxAdjX(hvg, xb), yb);
-/* move this to hgTracks when finished */
-hPrintf("HREF=\"%s?%s=%u&c=%s&g=%s&i=%s\"", hgTrackUiName(),
+    /* move this to hgTracks when finished */
+    hPrintf("HREF=\"%s?%s=%u&c=%s&g=%s&i=%s\"", hgTrackUiName(),
 	cartSessionVarName(), cartSessionId(cart), chromName, trackName, name);
-mapStatusMessage("%s controls", shortLabel);
-hPrintf(">\n");
-#endif//ndef IMAGEv2_UI
+    mapStatusMessage("%s controls", shortLabel);
+    hPrintf(">\n");
+    }
 }
 
 void mapTrackBackground(struct track *tg, struct hvGfx *hvg, int xOff, int yOff)
 /* Print out image map rectangle that invokes hgTrackUi. */
 {
 xOff = hvGfxAdjXW(hvg, xOff, insideWidth);
 char *track = tg->tdb->parent ? tg->tdb->parent->tableName : tg->tdb->tableName;
 #ifdef IMAGEv2_UI
-if(curMap != NULL)
+if(theImgBox && curMap)
     {
     char link[512];
-    safef(link,sizeof(link),"%s?%s=%u&c=%s&g=%s&i=%s",hgTrackUiName(),
-	   cartSessionVarName(), cartSessionId(cart), chromName, track, track);
+    safef(link,sizeof(link),"%s?%s=%u&g=%s&i=%s",hgTrackUiName(),
+    cartSessionVarName(), cartSessionId(cart), track, track);
     char title[128];
     safef(title,sizeof(title),"%s controls", tg->mapName);
     // Add map item to currnent map (TODO: pass in map)
     mapSetItemAdd(curMap,link,title,xOff, yOff, xOff+insideWidth, yOff+tg->height);
     }
-#else//ifndef IMAGEv2_UI
-hPrintf("<AREA SHAPE=RECT COORDS=\"%d,%d,%d,%d\" ",
+else
+#endif//def IMAGEv2_UI
+    {
+    hPrintf("<AREA SHAPE=RECT COORDS=\"%d,%d,%d,%d\" ",
 	xOff, yOff, xOff+insideWidth, yOff+tg->height);
-hPrintf("HREF=\"%s?%s=%u&c=%s&g=%s&i=%s\"", hgTrackUiName(),
+    hPrintf("HREF=\"%s?%s=%u&c=%s&g=%s&i=%s\"", hgTrackUiName(),
 	cartSessionVarName(), cartSessionId(cart), chromName, track, track);
-mapStatusMessage("%s controls", tg->mapName);
-hPrintf(">\n");
-#endif//ndef IMAGEv2_UI
+    mapStatusMessage("%s controls", tg->mapName);
+    hPrintf(">\n");
+    }
 }
 
 int ldTotalHeight(struct track *tg, enum trackVisibility vis)
 /* Return total height. Called before and after drawItems.