8a3891b32fa630eddb3808ab704836d5c9e1ffe8 larrym Sun Jul 10 20:58:40 2011 -0700 move javascript globals from hiddens to an object diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 9c1bb2f..115ea12 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -92,30 +92,31 @@ "hide", "dense", "full" }; char *protDbName; /* Name of proteome database for this genome. */ #define MAX_CONTROL_COLUMNS 6 #define LOW 1 #define MEDIUM 2 #define BRIGHT 3 #define MAXCHAINS 50000000 boolean hgDebug = FALSE; /* Activate debugging code. Set to true by hgDebug=on in command line*/ int imagePixelHeight = 0; boolean dragZooming = TRUE; struct hash *oldVars = NULL; +struct hash *jsVarsHash = NULL; boolean hideControls = FALSE; /* Hide all controls? */ boolean trackImgOnly = FALSE; /* caller wants just the track image and track table html */ boolean ideogramToo = FALSE; /* caller wants the ideoGram (when requesting just one track) */ /* Structure returned from findGenomePos. * We use this to to expand any tracks to full * that were found to contain the searched-upon * position string */ struct hgPositions *hgp = NULL; /* Other global variables. */ struct trackHub *hubList = NULL; /* List of all relevant hubs. */ struct group *groupList = NULL; /* List of all tracks. */ char *browserName; /* Test, preview, or public browser */ @@ -2455,38 +2456,39 @@ { if(theImgBox) { // Set imgTrack in case any map items will be set sliceHeight = trackPlusLabelHeight(track, fontHeight); sliceOffsetY = y; curImgTrack = imgBoxTrackFind(theImgBox,track->tdb,NULL); } y = doTrackMap(track, hvg, y, fontHeight, trackPastTabX, trackPastTabWidth); } } /* Finish map. */ hPrintf("\n"); -hPrintf("\n", dragZooming ? 1 : 0); +jsAddBoolean(jsVarsHash, "dragSelection", dragZooming); + if(rulerClickHeight) { - hPrintf("\n", rulerClickHeight); + jsAddNumber(jsVarsHash, "rulerClickHeight", rulerClickHeight); } if(newWinWidth) { - hPrintf("\n", newWinWidth); + jsAddNumber(jsVarsHash, "newWinWidth", newWinWidth); } /* Save out picture and tell html file about it. */ if(hvgSide != hvg) hvGfxClose(&hvgSide); hvGfxClose(&hvg); if(theImgBox) { imageBoxDraw(theImgBox); #ifdef IMAGEv2_DRAG_SCROLL // If a portal was established, then set the global dimensions back to the portal size if(imgBoxPortalDimensions(theImgBox,NULL,NULL,NULL,NULL,&winStart,&winEnd,&(tl.picWidth),NULL)) { pixWidth = tl.picWidth; winBaseCount = winEnd - winStart; @@ -4542,32 +4544,33 @@ zoomedToBaseLevel = (winBaseCount <= insideWidth / tl.mWidth); zoomedToCodonLevel = (ceil(winBaseCount/3) * tl.mWidth) <= insideWidth; zoomedToCdsColorLevel = (winBaseCount <= insideWidth*3); if (psOutput != NULL) { hPrintDisable(); hideControls = TRUE; withNextItemArrows = FALSE; withNextExonArrows = FALSE; hgFindMatches = NULL; } /* Tell browser where to go when they click on image. */ hPrintf("
\n\n", hgTracksName()); -hPrintf("\n", insideX); -hPrintf("\n", revCmplDisp); +jsAddNumber(jsVarsHash, "insideX", insideX); +jsAddBoolean(jsVarsHash, "revCmplDisp", revCmplDisp); + #ifdef NEW_JQUERY hPrintf("\n"); #else///ifndef NEW_JQUERY hPrintf("\n"); #endif///ndef NEW_JQUERY if (!psOutput) cartSaveSession(cart); clearButtonJavascript = "document.TrackHeaderForm.position.value=''; document.getElementById('suggest').value='';"; /* See if want to include sequence search results. */ userSeqString = cartOptionalString(cart, "ss"); if (userSeqString && !ssFilesExist(userSeqString)) { userSeqString = NULL; cartRemove(cart, "ss"); } @@ -4849,36 +4852,34 @@ sprintLongWithCommas(buf, winEnd - winStart); if(dragZooming && assemblySupportsGeneSuggest(database)) hPrintf(" gene " "\n" "\n", assemblyGeneSuggestTrack(database) ); hWrites(" "); hButtonWithOnClick("hgt.jump", "jump", NULL, "jumpButtonOnClick()"); hOnClickButton(clearButtonJavascript,"clear"); hPrintf(" size %s bp. ", buf); hWrites(" "); hButton("hgTracksConfigPage", "configure"); if (survey && differentWord(survey, "off")) hPrintf("  %s\n", survey, surveyLabel ? surveyLabel : "Take survey"); // info for drag selection javascript - hPrintf("\n", winStart); - hPrintf("\n", winEnd); - hPrintf("\n", chromName); - + jsAddNumber(jsVarsHash, "winStart", winStart); + jsAddNumber(jsVarsHash, "winEnd", winEnd); + jsAddString(jsVarsHash, "chromName", chromName); hPutc('\n'); - } } /* Make chromsome ideogram gif and map. */ makeChromIdeoImage(&trackList, psOutput, ideoTn); #ifdef USE_NAVIGATION_LINKS hPrintf("\n",tl.picWidth);//min(tl.picWidth, 800)); hPrintf("
<<<\n"); hPrintf("<<\n"); #ifdef IMAGEv2_DRAG_SCROLL if(!advancedJavascriptFeaturesEnabled(cart)) #endif//def IMAGEv2_DRAG_SCROLL hPrintf("<\n"); @@ -5806,30 +5807,31 @@ dragZooming = advancedJavascriptFeaturesEnabled(cart); /* Do main display. */ if (cartUsualBoolean(cart, "hgt.trackImgOnly", FALSE)) { trackImgOnly = TRUE; ideogramToo = cartUsualBoolean(cart, "hgt.ideogramToo", FALSE); hideControls = TRUE; withNextItemArrows = FALSE; withNextExonArrows = FALSE; hgFindMatches = NULL; // XXXX necessary ??? } hWrites(commonCssStyles()); +jsVarsHash = newHash(8); jsIncludeFile("jquery.js", NULL); jsIncludeFile("jquery-ui.js", NULL); jsIncludeFile("utils.js", NULL); jsIncludeFile("ajax.js", NULL); boolean searching = differentString(cartUsualString(cart, TRACK_SEARCH,"0"),"0"); if(dragZooming && !searching) { jsIncludeFile("jquery.imgareaselect.js", NULL); #ifndef NEW_JQUERY webIncludeResourceFile("autocomplete.css"); jsIncludeFile("jquery.autocomplete.js", NULL); #endif///ndef NEW_JQUERY } jsIncludeFile("autocomplete.js", NULL); jsIncludeFile("hgTracks.js", NULL); @@ -5924,16 +5926,22 @@ } else if (cartVarExists(cart, configShowEncodeGroups)) { /* currently not used */ cartRemove(cart, configShowEncodeGroups); struct grp *grp = NULL, *grps = hLoadGrps(database); for (grp = grps; grp != NULL; grp = grp->next) if (startsWith("encode", grp->name)) collapseGroup(grp->name, FALSE); configPageSetTrackVis(-2); } else { tracksDisplay(); } +if(hashNumEntries(jsVarsHash)) + { + hPrintf("\n"); + } }