b68693a185e6d68effc8d3371d509e0a0c7e7981
tdreszer
  Mon Sep 13 09:41:22 2010 -0700
Support conditional center labels for dense subtracks in both C and JS. Top dense subtrack in a set will show centerLabel of composite.
diff --git src/hg/hgTracks/hgTracks.h src/hg/hgTracks/hgTracks.h
index 8391d57..0779be6 100644
--- src/hg/hgTracks/hgTracks.h
+++ src/hg/hgTracks/hgTracks.h
@@ -12,6 +12,8 @@
 #include "hui.h"
 #endif
 
+#include "imageV2.h"
+
 #ifndef CART_H
 #include "cart.h"
 #endif
@@ -205,6 +207,7 @@
                                 is used for "composite" tracks, such
                                 as "mafWiggle */
     struct track *parent;	/* Parent track if any */
+    struct track *prevTrack;    /* if not NULL, points to track immediately above in the image.  Needed by ConditionalCenterLabel logic */
 
     void (*nextPrevExon)(struct track *tg, struct hvGfx *hvg, void *item, int x, int y, int w, int h, boolean next);
     /* Function will draw the button on a track item and assign a map */
@@ -1109,6 +1112,15 @@
  * the default and inhibit composite track center labels in all modes.
  * Otherwise use the global boolean withCenterLabels. */
 
+#define isCenterLabelConditional(track) ((limitVisibility(track) == tvDense) && tdbIsCompositeChild((track)->tdb))
+// dense subtracks have conditional centerLabels
+
+boolean isCenterLabelConditionallySeen(struct track *track);
+// returns FALSE if track and prevTrack have same parent, and are both dense subtracks
+
+#define isCenterLabelIncluded(track) (isWithCenterLabels(track) && (theImgBox || isCenterLabelConditionallySeen(track)))
+// Center labels may be conditionally included
+
 void affyTxnPhase2Methods(struct track *track);
 /* Methods for dealing with a composite transcriptome tracks. */