f63a718960b6a66276d579e7cd3fbb107f2cfd78
tdreszer
  Tue Nov 16 16:37:13 2010 -0800
Removed obsolete ifdef for SUBTRACKS_HAVE_VIS. Streamlined some composite vis code. Added support for remote tracks being rendered by AJAX callback.  Currently ifdefed out.
diff --git src/hg/hgTracks/imageV2.h src/hg/hgTracks/imageV2.h
index 91cfabb..06078fb 100644
--- src/hg/hgTracks/imageV2.h
+++ src/hg/hgTracks/imageV2.h
@@ -1,45 +1,38 @@
 /* imageV2 - API for creating the image V2 features. */
 
 #ifndef IMAGEV2_H
 #define IMAGEV2_H
 
 // UNCOMMENT
 //   CONTEXT_MENU to allow right-click funtionality
 //   IMAGEv2_DRAG_SCROLL and IMAGEv2_DRAG_SCROLL_SZ to allow dragScroll
-//   SUBTRACKS_HAVE_VIS (needed by CONTEXT_MENU or TRACK_SEARCH) to allow vis setting in cart for subtrack to override composite->view->subtrack vis rules.
 //   USE_NAVIGATION_LINKS to use navigation links by image, rather than buttons at top
 
 // UNCOMMENT CONTEXT_MENU to allow right-click funtionality
 #define CONTEXT_MENU
 
 //  UNCOMMENT IMAGEv2_DRAG_SCROLL and IMAGEv2_DRAG_SCROLL_SZ to allow dragScroll
 //  NOTE: dragScroll not working in SZ=1 (1x) yet, because haven't done ajax fetch when dragged beyond image dimansions.
 //        Still, set IMAGEv2_DRAG_SCROLL_SZ > 1 (3=3x) to get limited dragScroll functionality
 //#define IMAGEv2_DRAG_SCROLL
 //#define IMAGEv2_DRAG_SCROLL_SZ 3
 
 #if defined(IMAGEv2_DRAG_SCROLL_SZ) && (IMAGEv2_DRAG_SCROLL_SZ > 1)
     #define IMAGEv2_SHORT_MAPITEMS
 #endif// defined(IMAGEv2_DRAG_SCROLL_SZ) && (IMAGEv2_DRAG_SCROLL_SZ > 1)
 
-// UNCOMMENT SUBTRACKS_HAVE_VIS to allow vis setting in cart for subtrack to override composite->view->subtrack vis rules.
-#include "searchTracks.h"
-#if defined(CONTEXT_MENU) || defined(TRACK_SEARCH)
-    #define SUBTRACKS_HAVE_VIS
-#endif
-
 // UNCOMMENT  USE_NAVIGATION_LINKS for so far experimental UI changes to replace buttons at top with more streamlined links
 //#define USE_NAVIGATION_LINKS
 
 
 // CURRENT PROBLEMS:
 // o FIXED: some map items span both sideLabel and data!!
 // o subrtacks should be dragReorderable!!!  Make them individual imgTracks
 // o centerlabel next feature '>>' arrows are scrolled off screen: fix when centerlabels are small and don't scroll
 // o subtrack center labels currently scroll with portal: fixed with subtracks being individual imgTracks
 // o image should be clear and background image should contain stripes
 // o Dynamic height for data/label based on image map currently in portal: DONE for packed, but full map items span all of data slice!
 
 extern struct imgBox   *theImgBox;   // Make this global for now to avoid huge rewrite
 //extern struct image    *theOneImg;   // Make this global for now to avoid huge rewrite
 extern struct imgTrack *curImgTrack; // Make this global for now to avoid huge rewrite
@@ -268,47 +261,54 @@
     };
 
 struct imgTrack // IMAGEv2: imageBox conatins list of displayed imageTracks
     {
     struct imgTrack *next;    // slList
     struct trackDb *tdb;	  // trackDb entry (should this be struct track* entry?)
     char *name;	              // It is possible to have an imgTrack without a tdb, but then it must have a name
     char *db;                 // Image for db (species) (assert imgTrack matches imgBox)
     char *chrom;              // Image for chrom (assert imgTrack matches imgBox)
     int  chromStart;          // Image start (absolute, not portal position)
     int  chromEnd;            // Image end (absolute, not portal position)
     boolean plusStrand;       // Image covers plus strand, not minus strand
     boolean hasCenterLabel;   // A track may have a center label but not show it
     enum centerLabelSeen centerLabelSeen;  // Conditionally displayed center labels are always there but sometimes hidden
     boolean reorderable;      // Is this track reorderable (by drag and drop) ?
+    boolean ajaxRetrieval;    // This track needs to be retrieved via ajax
     int order;                // Image order: This keeps track of dragReorder
     enum trackVisibility vis; // Current visibility of track image
     struct imgSlice *slices;  // Currently there should be three slices for every track: data, centerLabel, sideLabel
     };
 
 #define IMG_ANYORDER  -2
 #define IMG_FIXEDPOS  -1
 #define IMG_ORDEREND  1000
 #define IMG_ORDER_VAR "imgOrd"
 
 struct imgTrack *imgTrackStart(struct trackDb *tdb,char *name,char *db,char *chrom,int chromStart,int chromEnd,boolean plusStrand,boolean hasCenterLabel,enum trackVisibility vis,int order);
 /* Starts an image track which will contain all image slices needed to render one track
    Must completed by adding slices with imgTrackAddSlice() */
 
 struct imgTrack *imgTrackUpdate(struct imgTrack *imgTrack,struct trackDb *tdb,char *name,char *db,char *chrom,int chromStart,int chromEnd,boolean plusStrand,boolean hasCenterLabel,enum trackVisibility vis,int order);
 /* Updates an already existing image track */
 
+void imgTrackMarkForAjaxRetrieval(struct imgTrack *imgTrack,boolean ajaxRetrieval);
+/* Updates the imgTrack to trigger an ajax callback from the html client to get this track */
+
+#define imgTrackMarkedForAjaxRetrieval(imgTrack) ((imgTrack)->ajaxRetrieval)
+/* Is this imgTrack marked for Ajax retrieval */
+
 #define imgTrackUpdateCenterLabelSeen(slice,seen) { (slice)->centerLabelSeen = (seen); }
 /* Center slices are occasionally unseen */
 
 int imgTrackOrderCmp(const void *va, const void *vb);
 /* Compare to sort on label. */
 
 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: stData, stButton, stSide and stCenter */
 
 struct imgSlice *imgTrackSliceGetByType(struct imgTrack *imgTrack,enum sliceType type);
 /* Gets a specific slice already added to an image track.  Expected are types: stData, stButton, stSide and stCenter */
 
 struct imgSlice *imgTrackSliceFindOrAdd(struct imgTrack *imgTrack,enum sliceType type, struct image *img,char *title,int width,int height,int offsetX,int offsetY);
 /* Find the slice or adds it */