Index: src/hg/hgTracks/hgTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/hgTracks.c,v
retrieving revision 1.1621
retrieving revision 1.1622
diff -b -B -U 4 -r1.1621 -r1.1622
--- src/hg/hgTracks/hgTracks.c	3 Feb 2010 18:43:38 -0000	1.1621
+++ src/hg/hgTracks/hgTracks.c	9 Feb 2010 00:11:34 -0000	1.1622
@@ -64,9 +64,11 @@
 boolean hasCustomTracks = FALSE;  /* whether any custom tracks are for this db*/
 struct slName *browserLines = NULL; /* Custom track "browser" lines. */
 
 boolean withNextItemArrows = FALSE; /* Display next feature (gene) navigation buttons near center labels? */
+#ifndef IMAGEv2_DRAG_REORDER
 boolean withPriorityOverride = FALSE;   /* Display priority for each track to allow reordering */
+#endif//ndef IMAGEv2_DRAG_REORDER
 
 int gfxBorder = hgDefaultGfxBorder; /* Width of graphics border. */
 int guidelineSpacing = 12;  /* Pixels between guidelines. */
 
@@ -215,25 +217,29 @@
                 if (tdbIsSuperTrackChild(tdb) || tdbIsCompositeChild(tdb))
                     {
                     assert(tdb->parent != NULL && tdb->parent->tableName);
                     cartRemove(cart, tdb->parent->tableName);
+                    #ifndef IMAGEv2_DRAG_REORDER
                     if (withPriorityOverride)
                         {
                         safef(pname, sizeof(pname), "%s.priority",tdb->parent->tableName);
                         cartRemove(cart, pname);
                         }
+                    #endif//ndef IMAGEv2_DRAG_REORDER
                     }
 
                 track->visibility = tdb->visibility;
                 cartRemove(cart, track->mapName);
 
                 /* set the track priority back to the default value */
+                #ifndef IMAGEv2_DRAG_REORDER
                 if (withPriorityOverride)
                     {
                     safef(pname, sizeof(pname), "%s.priority",track->mapName);
                     cartRemove(cart, pname);
                     track->priority = track->defaultPriority;
                     }
+                #endif//ndef IMAGEv2_DRAG_REORDER
                 }
             else
                 {
                 /* change to specified visibility */
@@ -295,8 +301,9 @@
     char title[256];
 
     safef(title,sizeof(title),"%s controls", shortLabel);
     struct imgSlice *curSlice = imgTrackSliceGetByType(curImgTrack,stButton);
+    if(curSlice)
     sliceAddLink(curSlice,link,title);
     }
 else
     {
@@ -2212,11 +2219,8 @@
             continue;
          if(theImgBox)
             {
             // side label slice for tracks
-            // FIXME: Notice I am treating all subtracks as indivisible from their composite
-            // This will need to change to allow drag and drop.  Until then the subtrack center labels will drag scroll while the composte will not.
-            // But as soon as subtracks are individual image tracks: problems with buttons, left labels, center labels, drag and drop, etc.
             sliceHeight      = trackPlusLabelHeight(track, fontHeight);
             sliceOffsetY     = y;
             curImgTrack = imgBoxTrackFind(theImgBox,track->tdb,NULL);
             curSlice    = imgTrackSliceUpdateOrAdd(curImgTrack,stSide,theOneImg,NULL,sliceWidth[stSide],sliceHeight,sliceOffsetX[stSide],sliceOffsetY);
@@ -2315,11 +2319,8 @@
         if(theImgBox)
             {
             //if (isWithCenterLabels(track))  // NOTE: Since track may not have centerlabel but subtrack may (How?), then must always make this slice!
             // center label slice of tracks
-            // FIXME: Notice I am treating all subtracks as indivisible from their composite
-            // This will need to change to allow drag and drop.  Until then the subtrack center labels will drag scroll while the composte will not.
-            // But as soon as subtracks are individual image tracks: problems with buttons, left labels, center labels, drag and drop, etc.
             sliceHeight      = fontHeight;
             sliceOffsetY     = y;
             curImgTrack = imgBoxTrackFind(theImgBox,track->tdb,NULL);
             curSlice    = imgTrackSliceUpdateOrAdd(curImgTrack,stCenter,theOneImg,NULL,sliceWidth[stData],sliceHeight,sliceOffsetX[stData],sliceOffsetY);
@@ -2332,10 +2333,8 @@
                 y = doCenterLabels(track, track, hvg, font, y) - track->height; /* subtrack heights tallied below: */
             if(theImgBox)
                 {
                 // Special case: data slice of tracks
-                // FIXME: This special case allows the subtrack center label map items to be put into the data slice
-                // When subtracks are carved up into individual imgTracks, then this will not be necessary
                 sliceHeight      = trackPlusLabelHeight(track, fontHeight) - fontHeight;
                 sliceOffsetY     = y;
                 curSlice    = imgTrackSliceUpdateOrAdd(curImgTrack,stData,theOneImg,NULL,sliceWidth[stData],sliceHeight,sliceOffsetX[stData],sliceOffsetY);
                 curMap      = sliceMapFindOrStart(curSlice,track->tdb->tableName,NULL); // No common linkRoot
@@ -2381,11 +2380,8 @@
         int yEnd   = y + trackPlusLabelHeight(track, fontHeight);
         if(theImgBox)
             {
             // data slice of tracks
-            // FIXME: Notice I am treating all subtracks as indivisible from their composite
-            // This will need to change to allow drag and drop.  Until then the subtrack center labels will drag scroll while the composte will not.
-            // But as soon as subtracks are individual image tracks: problems with buttons, left labels, center labels, drag and drop, etc.
             sliceOffsetY     = yStart;
             sliceHeight      = yEnd - yStart - 1;
             curImgTrack = imgBoxTrackFind(theImgBox,track->tdb,NULL);
             if(sliceHeight > 0)
@@ -2438,11 +2434,8 @@
                 continue;
         if(theImgBox)
             {
             // side label slice of tracks
-            // FIXME: Notice I am treating all subtracks as indivisible from their composite
-            // This will need to change to allow drag and drop.  Until then the subtrack center labels will drag scroll while the composte will not.
-            // But as soon as subtracks are individual image tracks: problems with buttons, left labels, center labels, drag and drop, etc.
             sliceHeight      = trackPlusLabelHeight(track, fontHeight);
             sliceOffsetY     = y;
             curImgTrack = imgBoxTrackFind(theImgBox,track->tdb,NULL);
             curSlice    = imgTrackSliceUpdateOrAdd(curImgTrack,stSide,theOneImg,NULL,sliceWidth[stSide],sliceHeight,sliceOffsetX[stSide],sliceOffsetY);
@@ -3663,23 +3656,25 @@
 struct track *track;
 struct trackRef *tr;
 struct grp* grps = hLoadGrps(database);
 struct grp *grp;
-char cartVar[512];
 
 /* build group objects from database. */
 for (grp = grps; grp != NULL; grp = grp->next)
     {
     /* deal with group reordering */
     float priority = grp->priority;
+    #ifndef IMAGEv2_DRAG_REORDER
     if (withPriorityOverride)
         {
+        char cartVar[512];
         safef(cartVar, sizeof(cartVar), "%s.priority",grp->name);
         if (vis != -1)
             priority = (float)cartUsualDouble(cart, cartVar, grp->priority);
         if (priority == grp->priority)
             cartRemove(cart, cartVar);
         }
+    #endif//ndef IMAGEv2_DRAG_REORDER
     /* create group object; add to list and hash */
     AllocVar(group);
     group->name = cloneString(grp->name);
     group->label = cloneString(grp->label);
@@ -3694,8 +3689,9 @@
 /* Loop through tracks and fill in their groups.
  * If necessary make up an unknown group. */
 for (track = *pTrackList; track != NULL; track = track->next)
     {
+#ifndef IMAGEv2_DRAG_REORDER
     /* handle track reordering feature -- change group assigned to track */
     if (withPriorityOverride)
         {
         char *groupName = NULL;
@@ -3744,8 +3740,9 @@
             cartRemove(cart, cartVar);
 */
         track->priority = priority;
         }
+#endif//ndef IMAGEv2_DRAG_REORDER
 
     /* assign group object to track */
     if (track->groupName == NULL)
         group = NULL;
@@ -4336,8 +4333,9 @@
 
     /* This is a clear submit button that browsers will use by default when enter is pressed in position box. */
     hPrintf("<INPUT TYPE=IMAGE BORDER=0 NAME=\"hgt.dummyEnterButton\" src=\"../images/DOT.gif\">");
     /* Put up scroll and zoom controls. */
+#ifndef USE_NAVIGATION_LINKS
     hWrites("move ");
     hButtonWithMsg("hgt.left3", "<<<", "move 95% to the left");
     hButtonWithMsg("hgt.left2", " <<", "move 47.5% to the left");
     hButtonWithMsg("hgt.left1", " < ", "move 10% to the left");
@@ -4354,8 +4352,9 @@
     topButton("hgt.out1", ZOOM_1PT5X);
     topButton("hgt.out2", ZOOM_3X);
     topButton("hgt.out3", ZOOM_10X);
     hWrites("<BR>\n");
+#endif//ndef USE_NAVIGATION_LINKS
 
     if (showTrackControls)
 	{
 	/* Break into a second form so that zooming and scrolling
@@ -4418,8 +4417,44 @@
 
 /* Make chromsome ideogram gif and map. */
 makeChromIdeoImage(&trackList, psOutput, ideoTn);
 
+#ifdef USE_NAVIGATION_LINKS
+    hPrintf("<table style='font-size:small;width:%dpx'><tr align='center'>",min(tl.picWidth, 800));
+    #ifndef IMAGEv2_DRAG_SCROLL
+    //if(!advancedJavascriptFeaturesEnabled(cart))
+        {
+        hPrintf("<td width='60'><a href='?hgt.left3=1' title='move 95&#37; to the left'>&lt;&lt;&lt;</a>\n");
+        hPrintf("<td width='50'><a href='?hgt.left2=1' title='move 47.5&#37; to the left'>&lt;&lt;</a>\n");
+        hPrintf("<td width='40'><a href='?hgt.left1=1' title='move 10&#37; to the left'>&lt;</a>\n");
+        hPrintf("<td width='50'>&nbsp;</td>\n");
+        }
+    #endif//ndef IMAGEv2_DRAG_SCROLL
+    if(!advancedJavascriptFeaturesEnabled(cart))
+        {
+        hPrintf("<td width='60' ><a href='?hgt.in1=1' title='zoom out 1.5x'>&gt;&nbsp;&lt;</a>\n");
+        hPrintf("<td width='80' ><a href='?hgt.in2=1' title='zoom out 3x'>&gt;&gt;&nbsp;&lt;&lt;</a>\n");
+        hPrintf("<td width='100'><a href='?hgt.in3=1' title='zoom out 10x'>&gt;&gt;&gt;&nbsp;&lt;&lt;&lt;</a>\n");
+        hPrintf("<td width='50'>&nbsp;\n");
+        hPrintf("<td width='50'><a href='?hgt.inBase=1' title='zoom in to base range'>ACGT</a>\n");
+        hPrintf("<td width='50'>&nbsp;\n");
+        }
+    hPrintf("<td width='60' ><a href='?hgt.out1=1' title='zoom out 1.5x'>&lt;&nbsp;&gt;</a>\n");
+    hPrintf("<td width='80' ><a href='?hgt.out2=1' title='zoom out 3x'>&lt;&lt;&nbsp;&gt;&gt;</a>\n");
+    hPrintf("<td width='100'><a href='?hgt.out3=1' title='zoom out 10x'>&lt;&lt;&lt;&nbsp;&gt;&gt;&gt;</a>\n");
+    hPrintf("<td width='50'>&nbsp;\n");
+    #ifndef IMAGEv2_DRAG_SCROLL
+    //if(!advancedJavascriptFeaturesEnabled(cart))
+        {
+        hPrintf("<td width='40'><a href='?hgt.right1=1' title='move 10&#37; to the right'>&gt;</a>\n");
+        hPrintf("<td width='50'><a href='?hgt.right2=1' title='move 47.5&#37; to the right'>&gt;&gt;</a>\n");
+        hPrintf("<td width='60'><a href='?hgt.right3=1' title='move 95&#37; to the right'>&gt;&gt;&gt;</a>\n");
+        }
+    #endif//ndef IMAGEv2_DRAG_SCROLL
+    /* use button maker that determines padding, so we can share constants */
+    hPrintf("</tr></table>\n");
+#endif//def USE_NAVIGATION_LINKS
+
 /* Make clickable image and map. */
 makeActiveImage(trackList, psOutput);
 fflush(stdout);
 
@@ -4434,16 +4469,16 @@
     /* note a trick of WIDTH=27 going on here.  The 6,15,6 widths following
      * go along with this trick */
     hPrintf("<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1 WIDTH=%d COLS=%d><TR>\n",
         tl.picWidth, 27);
-#ifndef IMAGEv2_DRAG_SCROLL
+#if !defined(IMAGEv2_DRAG_SCROLL) && !defined(USE_NAVIGATION_LINKS)
     hPrintf("<TD COLSPAN=6 ALIGN=CENTER NOWRAP>");
     hPrintf("move start<BR>");
     hButton("hgt.dinkLL", " < ");
     hTextVar("dinkL", cartUsualString(cart, "dinkL", "2.0"), 3);
     hButton("hgt.dinkLR", " > ");
     hPrintf("</TD>");
-#endif//ndef IMAGEv2_DRAG_SCROLL
+#endif//ndef !defined(IMAGEv2_DRAG_SCROLL) && !defined(USE_NAVIGATION_LINKS)
     hPrintf("<TD COLSPAN=15 style=\"white-space:normal\">"); // allow this text to wrap
     hWrites("Click on a feature for details. ");
     hWrites(dragZooming ? "Click or drag in the base position track to zoom in. " : "Click on base position to zoom in around cursor. ");
 #ifdef IMAGEv2_DRAG_REORDER
@@ -4453,15 +4488,16 @@
     hWrites("Click gray/blue bars on left for track options and descriptions. ");
 #endif//ndef IMAGEv2_DRAG_REORDER
 #ifdef IMAGEv2_DRAG_SCROLL
     hWrites("Drag tracks left or right to new position. ");
-#else//ifndef IMAGEv2_DRAG_SCROLL
+#endif//def IMAGEv2_DRAG_SCROLL
+#if !defined(IMAGEv2_DRAG_SCROLL) && !defined(USE_NAVIGATION_LINKS)
     hPrintf("</TD><TD COLSPAN=6 ALIGN=CENTER NOWRAP>");
     hPrintf("move end<BR>");
     hButton("hgt.dinkRL", " < ");
     hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3);
     hButton("hgt.dinkRR", " > ");
-#endif//ndef IMAGEv2_DRAG_SCROLL
+#endif//ndef !defined(IMAGEv2_DRAG_SCROLL) && !defined(USE_NAVIGATION_LINKS)
     hPrintf("</TD></TR></TABLE>\n");
     // smallBreak();
 
     /* Display bottom control panel. */
@@ -4976,9 +5012,11 @@
 if (!hIsGsidServer())
     {
     revCmplDisp = cartUsualBooleanDb(cart, database, REV_CMPL_DISP, FALSE);
     }
+#ifndef IMAGEv2_DRAG_REORDER
 withPriorityOverride = cartUsualBoolean(cart, configPriorityOverride, FALSE);
+#endif//ndef IMAGEv2_DRAG_REORDER
 insideX = trackOffsetX();
 insideWidth = tl.picWidth-gfxBorder-insideX;
 
 

