59c4b5446987113a20a88c2860c469ae14dcc0b9 larrym Thu Jul 28 21:39:44 2011 -0700 switch to using in-memory json; refactor trackDbJson so it is part of hgTracks global in the client (redmine #4550) diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c index 09ecbf2..b515bde 100644 --- src/hg/hgTracks/imageV2.c +++ src/hg/hgTracks/imageV2.c @@ -234,95 +234,101 @@ { enum kindOfChild kindOfChild = kocOrphan; if (tdbIsFolderContent(tdb)) kindOfChild = kocFolderContent; else if (tdbIsCompositeChild(tdb)) kindOfChild = kocCompositeChild; else if (tdbIsMultiTrackChild(tdb)) kindOfChild = kocMultiTrackChild; return kindOfChild; } ///////////////////////// // JSON support. Eventually the whole imgTbl could be written out as JSON -static void jsonTdbSettingsInit(struct dyString **jsonTdbSettingsString) +static void jsonTdbSettingsInit(struct jsonHashElement *settings) // Inititializes trackDbJson { -*jsonTdbSettingsString = newDyString(1024); -dyStringPrintf(*jsonTdbSettingsString, "\n"); -return dyStringCannibalize(jsonTdbSettingsString); +// add the settings to the hgTracks output object +jsonHashAdd(jsonForClient, "trackDb", (struct jsonElement *) settings); } ///////////////////////// // IMAGEv2 // The new way to do images: PLEASE REFER TO imageV2.h FOR A DETAILED DESCRIPTION ///////////////////////// /////////////////////// Maps struct mapSet *mapSetStart(char *name,struct image *img,char *linkRoot) /* Starts a map (aka mapSet) which is the seet of links and image locations used in HTML. Complete a map by adding items with mapItemAdd() */ { @@ -1870,41 +1876,41 @@ hPrintf("var imgBoxChromStart=%d;var imgBoxChromEnd=%d;var imgBoxWidth=%d;", imgBox->chromStart, imgBox->chromEnd,(imgBox->width - imgBox->sideLabelWidth)); hPrintf("var imgBoxPortalStart=%d;var imgBoxPortalEnd=%d;var imgBoxPortalWidth=%d;", imgBox->portalStart, imgBox->portalEnd, imgBox->portalWidth); hPrintf("var imgBoxLeftLabel=%d;var imgBoxPortalOffsetX=%d;var imgBoxBasesPerPixel=%lf;\n", (imgBox->plusStrand?imgBox->sideLabelWidth:0), (int)((imgBox->portalStart - imgBox->chromStart) / imgBox->basesPerPixel),imgBox->basesPerPixel); } #endif//def IMAGEv2_DRAG_SCROLL hPrintf("
\n",name,(imgTrack->reorderable?" class='dragHandle'":"")); sliceAndMapDraw(imgBox,imgTrack,stButton,name,FALSE); hPrintf(" | \n"); // leftLabel safef(name,sizeof(name),"side_%s",trackName); if (imgTrack->reorderable) @@ -1937,19 +1943,17 @@ hPrintf("\n",name,htmlEncode(imgTrack->tdb->longLabel),newLine); else hPrintf(" | \n",name); sliceAndMapDraw(imgBox,imgTrack,stSide,name,FALSE); hPrintf(" | \n"); // button safef(name, sizeof(name), "btn_%s", trackName); hPrintf("\n",name,(imgTrack->reorderable?" class='dragHandle'":"")); sliceAndMapDraw(imgBox,imgTrack,stButton, name,FALSE); hPrintf(" | \n"); } hPrintf("