56a7273c583fc9e4086919faa7cb2a5f29657bce tdreszer Mon Oct 25 13:56:00 2010 -0700 Made bg image of blue guidelines a reusable file so browsers can cache it. Made trackSearch dependent upon advanced javascript features. diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 74fd615..bee35ec 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -2335,40 +2335,48 @@ /* Draw guidelines. */ if (withGuidelines) { - //if(theImgBox) - // TODO: We should be making transparent data images and a separate background img for guidelines. - // This will allow the guidelines to dragscroll while the center labels are static. - // NOTE: The background image could easily be a reusable file, based upon zoom level and width. Height could propbaby easily be stretched. - // struct image *bgImg = imgBoxImageAdd(theImgBox,gifBg.forHtml, - // (char *)(dragZooming?"click or drag mouse in base position track to zoom in" : NULL), - // pixWidth, pixHeight,FALSE); struct hvGfx *bgImg = hvg; // Default to the one image + boolean exists = FALSE; if(theImgBox) { struct tempName gifBg; + char base[64]; + safef(base,sizeof(base),"blueLines%d-%d-%d",pixWidth,insideX,guidelineSpacing); // reusable file needs width, leftLabel start and guidelines + #ifdef USE_PNG + exists = trashDirReusableFile(&gifBg, "hgt", base, ".png"); + #else///ifndef + exists = trashDirReusableFile(&gifBg, "hgt", base, ".gif"); + #endif///ndef USE_PNG + if (exists && cgiVarExists("hgt.reset")) // exists means don't remake bg image. + exists = TRUE; // However, for the time being, rebuild when user presses "default tracks" + + if (!exists) + { #ifdef USE_PNG - trashDirFile(&gifBg, "hgt", "bg", ".png"); // TODO: We could have a few static files by (pixHeight*pixWidth) And I doubt pixHeight is needed! bgImg = hvGfxOpenPng(pixWidth, pixHeight, gifBg.forCgi, TRUE); - #else //ifndef - trashDirFile(&gifBg, "hgt", "bg", ".gif"); + #else///ifndef bgImg = hvGfxOpenGif(pixWidth, pixHeight, gifBg.forCgi, TRUE); - #endif //ndef USE_PNG + #endif///ndef USE_PNG bgImg->rc = revCmplDisp; + } imgBoxImageAdd(theImgBox,gifBg.forHtml,NULL,pixWidth, pixHeight,TRUE); // Adds BG image } - int height = pixHeight - 2*gfxBorder; + + if (!exists) + { int x; Color lightBlue = hvGfxFindRgb(bgImg, &guidelineColor); - hvGfxSetClip(bgImg, insideX, gfxBorder, insideWidth, height); + hvGfxSetClip(bgImg, insideX, 0, insideWidth, pixHeight); y = gfxBorder; for (x = insideX+guidelineSpacing-1; x<pixWidth; x += guidelineSpacing) - hvGfxBox(bgImg, x, y, 1, height, lightBlue); + hvGfxBox(bgImg, x, 0, 1, pixHeight, lightBlue); hvGfxUnclip(bgImg); if(bgImg != hvg) hvGfxClose(&bgImg); } + } /* Show ruler at top. */ if (rulerMode != tvHide) @@ -4687,7 +4695,7 @@ /* Display bottom control panel. */ #ifdef TRACK_SEARCH - if(isSearchTracksSupported(database)) + if(isSearchTracksSupported(database,cart)) { cgiMakeButtonWithMsg(TRACK_SEARCH, TRACK_SEARCH_BUTTON,TRACK_SEARCH_HINT); hPrintf(" ");