a4ed1e0d2c39286d95a53d98db4b0bdc51836260
Merge parents 7ab9bea 3c4e793
larrym
  Wed Jul 25 15:20:22 2012 -0700
resolve merge conflict with master
diff --cc src/hg/hgTracks/imageV2.c
index 68fa26f,a2f91b8..79cdc7d
--- src/hg/hgTracks/imageV2.c
+++ src/hg/hgTracks/imageV2.c
@@@ -1679,246 -1724,262 +1724,259 @@@
          hPrintf(" ondrag='{return false;}'");
      hPrintf(">");
      }
  else
      {
      int height = slice->height;
      // Adjustment for centerLabel Conditional
      if (imgTrack->centerLabelSeen == clNotSeen
      &&  (slice->type == stSide || slice->type == stButton))
          {
          struct imgSlice *centerSlice = imgTrackSliceGetByType(imgTrack,stCenter);
          if (centerSlice != NULL)
              height -= centerSlice->height;
          }
      hPrintf("  <p id='p_%s' style='height:%dpx;",name,height);
-     if(slice->type==stButton)
+     if (slice->type==stButton)
          {
          char *trackName = imgTrack->name;
-         if(trackName == NULL)
+         if (trackName == NULL)
              {
              struct trackDb * tdb = imgTrack->tdb;
-             if(tdbIsCompositeChild(tdb))
+             if (tdbIsCompositeChild(tdb))
                  tdb = tdbGetComposite(tdb);
              trackName = tdb->track;
              }
-         hPrintf(" width:9px; display:none;' class='%s %sbtn btnN'></p>",trackName,(slice->link == NULL?"inset ":""));
+         hPrintf(" width:9px; display:none;' class='%s %sbtn btnN'></p>",
+                 trackName,(slice->link == NULL ? "inset " : ""));
          }
      else
          hPrintf("width:%dpx;'></p>",slice->width);
      }
  }
  
  // FF does not support newline code and '...' looks bad without newlines
  #define NEWLINE_ENCODED " &#x0A;"
  #define NEWLINE_NOT_SUPPORTED " - "
  #define NEWLINE_TO_USE(browser) ((browser) == btFF ? NEWLINE_NOT_SUPPORTED : NEWLINE_ENCODED)
  #define ELLIPSIS_TO_USE(browser) ((browser) == btFF ? "" : "...")
  
- static void sliceAndMapDraw(struct imgBox *imgBox,struct imgTrack *imgTrack,enum sliceType sliceType,char *name,boolean scrollHandle)
- /* writes a slice of an image and any assocated image map as HTML */
+ static void sliceAndMapDraw(struct imgBox *imgBox,struct imgTrack *imgTrack,
+                             enum sliceType sliceType,char *name,boolean scrollHandle)
+ // writes a slice of an image and any assocated image map as HTML
  {
- if(imgBox==NULL || imgTrack==NULL)
+ if (imgBox==NULL || imgTrack==NULL)
      return;
  struct imgSlice *slice = imgTrackSliceGetByType(imgTrack,sliceType);
- if(slice==NULL || slice->height == 0)
+ if (slice==NULL || slice->height == 0)
      return;
  
  boolean useMap=FALSE;
  int offsetX=slice->offsetX;
  int offsetY=slice->offsetY;
  int height = slice->height;
  int width=slice->width;
- if(slice->parentImg)
+ if (slice->parentImg)
      {
      // Adjustment for centerLabel Conditional
      if (imgTrack->centerLabelSeen == clNotSeen
      &&  (sliceType == stSide || sliceType == stButton))
          {
          struct imgSlice *centerSlice = imgTrackSliceGetByType(imgTrack,stCenter);
          if (centerSlice != NULL)
              {
              height -= centerSlice->height;
              offsetY += centerSlice->height;
              }
          }
      // Adjustment for portal
-     if(imgBox->showPortal && imgBox->basesPerPixel > 0
+     if (imgBox->showPortal && imgBox->basesPerPixel > 0
      && (sliceType==stData || sliceType==stCenter))
          {
          offsetX += (imgBox->portalStart - imgBox->chromStart) / imgBox->basesPerPixel;
          width=imgBox->portalWidth;
          }
      hPrintf("  <div style='width:%dpx; height:%dpx;",width,height);
      if (sliceType == stCenter && imgTrack->centerLabelSeen == clNotSeen)
          hPrintf(" display:none;");
      hPrintf("' class='sliceDiv %s",sliceTypeToClass(slice->type));
  
-     if(imgBox->showPortal && (sliceType==stData || sliceType==stCenter))
-         hPrintf(" panDiv%s",(scrollHandle?" scroller":""));
+     if (imgBox->showPortal && (sliceType==stData || sliceType==stCenter))
+         hPrintf(" panDiv%s",(scrollHandle ? " scroller" : ""));
      hPrintf("'>\n");
      }
  struct mapSet *map = sliceGetMap(slice,FALSE); // Could be the image map or slice specific
- if(map)
+ if (map)
      useMap = imageMapDraw(map,name);
- else if(slice->link != NULL)
+ else if (slice->link != NULL)
      {
      if (sameString(TITLE_BUT_NO_LINK,slice->link))
          { // This fake link ensures a mouse-over title is seen but not heard
          hPrintf("<A class='%s'",TITLE_BUT_NO_LINK);
          }
-     else if(skipToSpaces(slice->link) != NULL)
+     else if (skipToSpaces(slice->link) != NULL)
          hPrintf("  <A HREF=%s",slice->link);
      else
          hPrintf("  <A HREF='%s'",slice->link);
      if (slice->title != NULL)
          {
          if (sliceType == stButton)
              {
              enum browserType browser = cgiClientBrowser(NULL,NULL,NULL);
              char *newLine = NEWLINE_TO_USE(browser);
              char *ellipsis = ELLIPSIS_TO_USE(browser);
-             if(imgTrack->reorderable)
-                 hPrintf(" TITLE='%s%sclick or right click to configure%s%sdrag to reorder%s'",attributeEncode(slice->title), newLine,
-                     ellipsis, newLine,(tdbIsCompositeChild(imgTrack->tdb)?" highlighted subtracks":"") );
+             if (imgTrack->reorderable)
+                 hPrintf(" TITLE='%s%sclick or right click to configure%s%sdrag to reorder%s'",
+                         attributeEncode(slice->title), newLine, ellipsis, newLine,
+                         (tdbIsCompositeChild(imgTrack->tdb) ? " highlighted subtracks" : "") );
              else
-                 hPrintf(" TITLE='%s%sclick or right click to configure%s'",attributeEncode(slice->title), newLine, ellipsis);
+                 hPrintf(" TITLE='%s%sclick or right click to configure%s'",
+                         attributeEncode(slice->title), newLine, ellipsis);
              }
          else
              hPrintf(" TITLE='Click for: &#x0A;%s'", attributeEncode(slice->title) );
          }
      hPrintf(">\n" );
      }
  
  imageDraw(imgBox,imgTrack,slice,name,offsetX,offsetY,useMap);
- if(slice->link != NULL)
+ if (slice->link != NULL)
      hPrintf("</A>");
  
- if(slice->parentImg)
+ if (slice->parentImg)
      hPrintf("</div>");
  }
  
  void imageBoxDraw(struct imgBox *imgBox)
- /* writes a entire imgBox including all tracksas HTML */
+ // writes a entire imgBox including all tracksas HTML
  {
- if(imgBox->imgTracks == NULL)  // Not an error to have an empty image
+ if (imgBox->imgTracks == NULL) // Not an error to have an empty image
      return;
  imgBoxDropEmpties(imgBox);
  boolean verbose = (hIsPrivateHost());   // Warnings for hgwdev only
- if(!imgBoxIsComplete(imgBox,verbose)) // dorps empties as okay
+ if (!imgBoxIsComplete(imgBox,verbose)) // dorps empties as okay
      return;
  char name[256];
  
  imgBoxTracksNormalizeOrder(imgBox);
- //if(verbose)
+ //if (verbose)
  //    imgBoxShow(NULL,imgBox,0);
  
- hPrintf("<!-- - - - - - - - vvv IMAGEv2 vvv - - - - - - - -->\n");  // DANGER FF interprets '--' as end of comment, not '-->'
+ hPrintf("<!-- - - - - - - - vvv IMAGEv2 vvv - - - - - - - -->\n");
+         // DANGER FF interprets '--' as end of comment, not '-->'
  jsIncludeFile("jquery.tablednd.js", NULL);
- if(imgBox->bgImg)
+ if (imgBox->bgImg)
      {
      int offset = 0;
-     if(imgBox->showSideLabel && imgBox->plusStrand)
+     if (imgBox->showSideLabel && imgBox->plusStrand)
          {
          struct imgSlice *slice = imgTrackSliceGetByType(imgBox->imgTracks,stData);
-         if(slice)
+         if (slice)
              offset = (slice->offsetX * -1);  // This works because the ruler has a slice
-          }
+         }
      hPrintf("<style type='text/css'>\n");
-     if(offset != 0)
-         hPrintf("td.tdData {background-image:url(\"%s\");background-repeat:repeat-y;background-position:%dpx;}\n",imgBox->bgImg->file,offset);
+     if (offset != 0)
+         hPrintf("td.tdData {background-image:url(\"%s\");background-repeat:repeat-y;"
+                            "background-position:%dpx;}\n",imgBox->bgImg->file,offset);
      else
-         hPrintf("td.tdData {background-image:url(\"%s\");background-repeat:repeat-y;}\n",imgBox->bgImg->file);
+         hPrintf("td.tdData {background-image:url(\"%s\");background-repeat:repeat-y;}\n",
+                 imgBox->bgImg->file);
      hPrintf("</style>\n");
      }
  
- if(imgBox->showPortal)
+ if (imgBox->showPortal)
      {
      // Let js code know what's up
      int chromSize = hChromSize(database, chromName);
      jsonObjectAdd(jsonForClient,"chromStart", newJsonNumber(  1));
      jsonObjectAdd(jsonForClient,"chromEnd", newJsonNumber(chromSize));
      jsonObjectAdd(jsonForClient,"imgBoxPortal", newJsonBoolean(TRUE));
-     jsonObjectAdd(jsonForClient,"imgBoxWidth", newJsonNumber(imgBox->width - imgBox->sideLabelWidth));
+     jsonObjectAdd(jsonForClient,"imgBoxWidth", newJsonNumber(imgBox->width-imgBox->sideLabelWidth));
      jsonObjectAdd(jsonForClient,"imgBoxPortalStart", newJsonNumber(imgBox->portalStart));
      jsonObjectAdd(jsonForClient,"imgBoxPortalEnd", newJsonNumber(imgBox->portalEnd));
      jsonObjectAdd(jsonForClient,"imgBoxPortalWidth", newJsonNumber(imgBox->portalWidth));
-     jsonObjectAdd(jsonForClient,"imgBoxLeftLabel", newJsonNumber(imgBox->plusStrand ? imgBox->sideLabelWidth : 0));
-     jsonObjectAdd(jsonForClient,"imgBoxPortalOffsetX", newJsonNumber((long) ((imgBox->portalStart - imgBox->chromStart) / imgBox->basesPerPixel)));
+     jsonObjectAdd(jsonForClient,"imgBoxLeftLabel", newJsonNumber(imgBox->plusStrand ?
+                                                                  imgBox->sideLabelWidth : 0));
+     jsonObjectAdd(jsonForClient,"imgBoxPortalOffsetX",
+                                   newJsonNumber((long)(  (imgBox->portalStart - imgBox->chromStart)
+                                                        / imgBox->basesPerPixel)));
      jsonObjectAdd(jsonForClient,"imgBoxBasesPerPixel", newJsonDouble(imgBox->basesPerPixel));
      }
  else
      jsonObjectAdd(jsonForClient,"imgBoxPortal", newJsonBoolean(FALSE));
  
 -hPrintf("<TABLE id='imgTbl' border=0 cellspacing=0 cellpadding=0 BGCOLOR='%s'",COLOR_WHITE);
 -                                                        //COLOR_RED); // Use RED to help find bugs
 -hPrintf(" width=%d",imgBox->showPortal ? (imgBox->portalWidth+imgBox->sideLabelWidth)
 -                                       : imgBox->width);
 -hPrintf(" class='tableWithDragAndDrop'");
 -hPrintf(" style='border:1px solid blue;border-collapse:separate;'>\n");
 +hPrintf("<TABLE id='imgTbl' cellspacing='0' cellpadding='0'");
 +hPrintf(" width='%d'",imgBox->showPortal?(imgBox->portalWidth+imgBox->sideLabelWidth):imgBox->width);
 +hPrintf(" class='tableWithDragAndDrop'>\n");
  
  struct jsonElement *jsonTdbVars = newJsonObject(newHash(8));
  jsonTdbSettingsInit(jsonTdbVars);
  
  char *newLine = NEWLINE_TO_USE(cgiClientBrowser(NULL,NULL,NULL));
  struct imgTrack *imgTrack = imgBox->imgTracks;
- for(;imgTrack!=NULL;imgTrack=imgTrack->next)
+ for (;imgTrack!=NULL;imgTrack=imgTrack->next)
      {
      char *trackName = (imgTrack->name != NULL ? imgTrack->name : imgTrack->tdb->track );
      struct track *track = hashFindVal(trackHash, trackName);
-     if(track)
+     if (track)
          jsonTdbSettingsBuild(jsonTdbVars, track, TRUE);
      hPrintf("<TR id='tr_%s' abbr='%d' class='imgOrd%s%s%s'>\n",trackName,imgTrack->order,
-         (imgTrack->reorderable?" trDraggable":" nodrop nodrag"),
-         (imgTrack->centerLabelSeen != clAlways?" clOpt":""),
-         (imgTrack->ajaxRetrieval ?" mustRetrieve":""));
+             (imgTrack->reorderable ? " trDraggable" : " nodrop nodrag"),
+             (imgTrack->centerLabelSeen != clAlways ? " clOpt" : ""),
+             (imgTrack->ajaxRetrieval ? " mustRetrieve" : ""));
  
-     if(imgBox->showSideLabel && imgBox->plusStrand)
+     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'":""));
+         hPrintf(" <TD id='td_%s'%s>\n",name,(imgTrack->reorderable ? " class='dragHandle'" : ""));
          sliceAndMapDraw(imgBox,imgTrack,stButton,name,FALSE);
          hPrintf("</TD>\n");
          // leftLabel
          safef(name,sizeof(name),"side_%s",trackName);
          if (imgTrack->reorderable)
-             hPrintf(" <TD id='td_%s' class='dragHandle tdLeft' title='%s%sdrag to reorder'>\n",name,attributeEncode(imgTrack->tdb->longLabel),newLine);
+             hPrintf(" <TD id='td_%s' class='dragHandle tdLeft' title='%s%sdrag to reorder'>\n",
+                     name,attributeEncode(imgTrack->tdb->longLabel),newLine);
          else
              hPrintf(" <TD id='td_%s' class='tdLeft'>\n",name);
          sliceAndMapDraw(imgBox,imgTrack,stSide,name,FALSE);
          hPrintf("</TD>\n");
          }
  
      // Main/Data image region
-     hPrintf(" <TD id='td_data_%s' title='click & drag to scroll; shift+click & drag to zoom' width=%d class='tdData'>\n", trackName, imgBox->width);
+     hPrintf(" <TD id='td_data_%s' title='click & drag to scroll; shift+click & drag to zoom'"
+             " width=%d class='tdData'>\n", trackName, imgBox->width);
      // centerLabel
-     if(imgTrack->hasCenterLabel)
+     if (imgTrack->hasCenterLabel)
          {
          safef(name, sizeof(name), "center_%s", trackName);
          sliceAndMapDraw(imgBox,imgTrack,stCenter,name,TRUE);
          hPrintf("\n");
          }
      // data image
      safef(name, sizeof(name), "data_%s", trackName);
      sliceAndMapDraw(imgBox,imgTrack,stData,name,(imgTrack->order>0));
      hPrintf("</TD>\n");
  
-     if(imgBox->showSideLabel && !imgTrack->plusStrand)
+     if (imgBox->showSideLabel && !imgTrack->plusStrand)
          {
          // rightLabel
          safef(name, sizeof(name), "side_%s", trackName);
          if (imgTrack->reorderable)
-             hPrintf(" <TD id='td_%s' class='dragHandle tdRight' title='%s%sdrag to reorder'>\n",name,attributeEncode(imgTrack->tdb->longLabel),newLine);
+             hPrintf(" <TD id='td_%s' class='dragHandle tdRight' title='%s%sdrag to reorder'>\n",
+                     name,attributeEncode(imgTrack->tdb->longLabel),newLine);
          else
              hPrintf(" <TD id='td_%s' class='tdRight'>\n",name);
          sliceAndMapDraw(imgBox,imgTrack,stSide,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'":""));
+         hPrintf(" <TD id='td_%s'%s>\n",name,(imgTrack->reorderable ? " class='dragHandle'" : ""));
          sliceAndMapDraw(imgBox,imgTrack,stButton, name,FALSE);
          hPrintf("</TD>\n");
          }
      hPrintf("</TR>\n");
      }
  hPrintf("</TABLE>\n");
- hPrintf("<!-- - - - - - - - ^^^ IMAGEv2 ^^^ - - - - - - - -->\n");  // DANGER FF interprets '--' as end of comment, not '-->'
+ hPrintf("<!-- - - - - - - - ^^^ IMAGEv2 ^^^ - - - - - - - -->\n");
  jsonTdbSettingsUse(jsonTdbVars);
  }