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(" ",trackName,(slice->link == NULL?"inset ":"")); + hPrintf(" width:9px; display:none;' class='%s %sbtn btnN'>

", + trackName,(slice->link == NULL ? "inset " : "")); } else hPrintf("width:%dpx;'>

",slice->width); } } // FF does not support newline code and '...' looks bad without newlines #define NEWLINE_ENCODED " " #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("
\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("link) != NULL) + else if (skipToSpaces(slice->link) != NULL) hPrintf(" link); else hPrintf(" 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: %s'", attributeEncode(slice->title) ); } hPrintf(">\n" ); } imageDraw(imgBox,imgTrack,slice,name,offsetX,offsetY,useMap); - if(slice->link != NULL) + if (slice->link != NULL) hPrintf(""); - if(slice->parentImg) + if (slice->parentImg) hPrintf("
"); } 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("\n"); // DANGER FF interprets '--' as end of comment, not '-->' + hPrintf("\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("\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("showPortal ? (imgBox->portalWidth+imgBox->sideLabelWidth) - : imgBox->width); -hPrintf(" class='tableWithDragAndDrop'"); -hPrintf(" style='border:1px solid blue;border-collapse:separate;'>\n"); +hPrintf("
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("\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(" \n"); // leftLabel safef(name,sizeof(name),"side_%s",trackName); if (imgTrack->reorderable) - hPrintf(" \n"); } // Main/Data image region - hPrintf(" \n"); - if(imgBox->showSideLabel && !imgTrack->plusStrand) + if (imgBox->showSideLabel && !imgTrack->plusStrand) { // rightLabel safef(name, sizeof(name), "side_%s", trackName); if (imgTrack->reorderable) - hPrintf(" \n"); // button safef(name, sizeof(name), "btn_%s", trackName); - hPrintf(" \n"); } hPrintf("\n"); } hPrintf("
\n",name,(imgTrack->reorderable?" class='dragHandle'":"")); + hPrintf(" \n",name,(imgTrack->reorderable ? " class='dragHandle'" : "")); sliceAndMapDraw(imgBox,imgTrack,stButton,name,FALSE); hPrintf("\n",name,attributeEncode(imgTrack->tdb->longLabel),newLine); + hPrintf(" \n", + name,attributeEncode(imgTrack->tdb->longLabel),newLine); else hPrintf(" \n",name); sliceAndMapDraw(imgBox,imgTrack,stSide,name,FALSE); hPrintf("\n", trackName, imgBox->width); + hPrintf(" \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("\n",name,attributeEncode(imgTrack->tdb->longLabel),newLine); + hPrintf(" \n", + name,attributeEncode(imgTrack->tdb->longLabel),newLine); else hPrintf(" \n",name); sliceAndMapDraw(imgBox,imgTrack,stSide,name,FALSE); hPrintf("\n",name,(imgTrack->reorderable?" class='dragHandle'":"")); + hPrintf(" \n",name,(imgTrack->reorderable ? " class='dragHandle'" : "")); sliceAndMapDraw(imgBox,imgTrack,stButton, name,FALSE); hPrintf("
\n"); - hPrintf("\n"); // DANGER FF interprets '--' as end of comment, not '-->' + hPrintf("\n"); jsonTdbSettingsUse(jsonTdbVars); }