bdb00f30d32292da822ca7fd6f65479e0917e295 tdreszer Wed Oct 19 16:26:08 2011 -0700 The objectification of hgTracks.js. Added a bit of structure to this one js file. Large changes but alnmost no functional change. diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 05f94f4..41be459 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -4083,31 +4083,31 @@ /* or maybe errabort ? */ label[3] = 0; len = 4; } if (len % 2 != 0) paddedLabel[3] = 0; if (len == strlen(paddedLabel)) strcpy(paddedLabel, label); else { int i; for (i=0; itdb)) { assert(track->tdb->parent != NULL); if (sameString("hide", cartUsualString(cart, track->tdb->parent->track, track->tdb->parent->isShow ? "show" : "hide"))) track->visibility = tvHide; } @@ -4367,31 +4367,31 @@ tg->limitedVis = tvDense; tg->limitedVisSet = TRUE; } } void printTrackInitJavascript(struct track *trackList) { hPrintf("\n", hgtJsCommand, hgtJsCommand); hPrintf("\n"); } void jsCommandDispatch(char *command, struct track *trackList) /* Dispatch a command sent to us from some javaScript event. * This gets executed after the track list is built, but before * the track->loadItems methods are called. */ { if (startsWithWord("makeItems", command)) makeItemsJsCommand(command, trackList, trackHash); else warn("Unrecognized jsCommand %s", command); @@ -4903,36 +4903,36 @@ hPrintf("%s %s on %s %s Assembly", organization, browserName, organism, freezeName); else hPrintf("%s %s on %s %s Assembly (%s)", organization, browserName, organism, freezeName, database); } } hPrintf("
\n"); /* This is a clear submit button that browsers will use by default when enter is pressed in position box. */ hPrintf(""); /* Put up scroll and zoom controls. */ #ifndef USE_NAVIGATION_LINKS hWrites("move "); #if IN_PLACE_UPDATE - hButtonWithOnClick("hgt.left3", "<<<", "move 95% to the left", "return navigateButtonClick(this);"); - hButtonWithOnClick("hgt.left2", " <<", "move 47.5% to the left", "return navigateButtonClick(this);"); - hButtonWithOnClick("hgt.left1", " < ", "move 10% to the left", "return navigateButtonClick(this);"); - hButtonWithOnClick("hgt.right1", " > ", "move 10% to the right", "return navigateButtonClick(this);"); - hButtonWithOnClick("hgt.right2", ">> ", "move 47.5% to the right", "return navigateButtonClick(this);"); - hButtonWithOnClick("hgt.right3", ">>>", "move 95% to the right", "return navigateButtonClick(this);"); + hButtonWithOnClick("hgt.left3", "<<<", "move 95% to the left", "return imageV2.navigateButtonClick(this);"); + hButtonWithOnClick("hgt.left2", " <<", "move 47.5% to the left", "return imageV2.navigateButtonClick(this);"); + hButtonWithOnClick("hgt.left1", " < ", "move 10% to the left", "return imageV2.navigateButtonClick(this);"); + hButtonWithOnClick("hgt.right1", " > ", "move 10% to the right", "return imageV2.navigateButtonClick(this);"); + hButtonWithOnClick("hgt.right2", ">> ", "move 47.5% to the right", "return imageV2.navigateButtonClick(this);"); + hButtonWithOnClick("hgt.right3", ">>>", "move 95% to the right", "return imageV2.navigateButtonClick(this);"); #else hButtonWithMsg("hgt.left3", "<<<", "move 95% to the left"); hButtonWithMsg("hgt.left2", " <<", "move 47.5% to the left"); hButtonWithMsg("hgt.left1", " < ", "move 10% to the left"); hButtonWithMsg("hgt.right1", " > ", "move 10% to the right"); hButtonWithMsg("hgt.right2", ">> ", "move 47.5% to the right"); hButtonWithMsg("hgt.right3", ">>>", "move 95% to the right"); #endif hWrites(" zoom in "); /* use button maker that determines padding, so we can share constants */ topButton("hgt.in1", ZOOM_1PT5X); topButton("hgt.in2", ZOOM_3X); topButton("hgt.in3", ZOOM_10X); topButton("hgt.inBase", ZOOM_BASE); hWrites(" zoom out "); @@ -4987,31 +4987,31 @@ hPuts("Organism "); printAssemblyListHtmlExtra(database, javascript); } sprintf(buf, "%s:%d-%d", chromName, winStart+1, winEnd); position = cloneString(buf); hWrites("position/search "); hTextVar("position", addCommasToPos(database, position), 30); sprintLongWithCommas(buf, winEnd - winStart); if(assemblySupportsGeneSuggest(database)) hPrintf(" gene " "\n" "\n", assemblyGeneSuggestTrack(database) ); hWrites(" "); - hButtonWithOnClick("hgt.jump", "jump", NULL, "jumpButtonOnClick()"); + hButtonWithOnClick("hgt.jump", "jump", NULL, "imageV2.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"); hPutc('\n'); } } /* Make chromsome ideogram gif and map. */ makeChromIdeoImage(&trackList, psOutput, ideoTn); #ifdef USE_NAVIGATION_LINKS hPrintf("\n",tl.picWidth);//min(tl.picWidth, 800)); @@ -5051,59 +5051,59 @@ return; } if (!hideControls) { struct controlGrid *cg = NULL; /* note a trick of WIDTH=27 going on here. The 6,15,6 widths following * go along with this trick */ hPrintf("
\n", tl.picWidth, 27); #ifndef USE_NAVIGATION_LINKS hPrintf(""); hPrintf("\n"); #endif//ndef USE_NAVIGATION_LINKS hPrintf(""); #ifndef USE_NAVIGATION_LINKS hPrintf("\n"); hPrintf(""); #endif//ndef USE_NAVIGATION_LINKS hPrintf("
"); hPrintf("move start
"); #if IN_PLACE_UPDATE - hButtonWithOnClick("hgt.dinkLL", " < ", "move start position to the left", "return navigateButtonClick(this);"); + hButtonWithOnClick("hgt.dinkLL", " < ", "move start position to the left", "return imageV2.navigateButtonClick(this);"); hTextVar("dinkL", cartUsualString(cart, "dinkL", "2.0"), 3); - hButtonWithOnClick("hgt.dinkLR", " > ", "move start position to the right", "return navigateButtonClick(this);"); + hButtonWithOnClick("hgt.dinkLR", " > ", "move start position to the right", "return imageV2.navigateButtonClick(this);"); #else hButton("hgt.dinkLL", " < "); hTextVar("dinkL", cartUsualString(cart, "dinkL", "2.0"), 3); hButton("hgt.dinkLR", " > "); #endif hPrintf("
 "); // allow this text to wrap hWrites("Click on a feature for details. "); hWrites("Click or drag in the base position track to zoom in. "); hWrites("Click side bars for track options. "); hWrites("Drag side bars or labels up or down to reorder tracks. "); #ifdef IMAGEv2_DRAG_SCROLL hWrites("Drag tracks left or right to new position. "); #endif//def IMAGEv2_DRAG_SCROLL //#if !defined(IMAGEv2_DRAG_SCROLL) && !defined(USE_NAVIGATION_LINKS) hPrintf(" "); hPrintf("move end
"); #if IN_PLACE_UPDATE - hButtonWithOnClick("hgt.dinkRL", " < ", "move end position to the left", "return navigateButtonClick(this);"); + hButtonWithOnClick("hgt.dinkRL", " < ", "move end position to the left", "return imageV2.navigateButtonClick(this);"); hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3); - hButtonWithOnClick("hgt.dinkRR", " > ", "move end position to the right", "return navigateButtonClick(this);"); + hButtonWithOnClick("hgt.dinkRR", " > ", "move end position to the right", "return imageV2.navigateButtonClick(this);"); #else hButton("hgt.dinkRL", " < "); hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3); hButton("hgt.dinkRR", " > "); #endif hPrintf("
\n"); /* Display bottom control panel. */ if(isSearchTracksSupported(database,cart)) { cgiMakeButtonWithMsg(TRACK_SEARCH, TRACK_SEARCH_BUTTON,TRACK_SEARCH_HINT); hPrintf(" "); @@ -5145,41 +5145,41 @@ if( chromosomeColorsMade ) { hPrintf("Chromosome Color Key:
"); hPrintf("
\n"); } if (showTrackControls) { /* Display viewing options for each track. */ /* Chuck: This is going to be wrapped in a table so that * the controls don't wrap around randomly */ hPrintf("\n", CONTROL_TABLE_WIDTH); hPrintf(""); hPrintf("\n", MAX_CONTROL_COLUMNS - 2); hPrintf(""); if (!hIsGsidServer()) { cg = startControlGrid(MAX_CONTROL_COLUMNS, "left"); } else { /* 4 cols fit GSID's display better */ cg = startControlGrid(4, "left"); } for (group = groupList; group != NULL; group = group->next) { if (group->trackList == NULL) continue; @@ -5190,31 +5190,31 @@ char *otherState; char *indicator; char *indicatorImg; boolean isOpen = !isCollapsedGroup(group); collapseGroupGoodies(isOpen, TRUE, &indicatorImg, &indicator, &otherState); hPrintf(""); cg->rowOpen = TRUE; if (!hIsGsidServer()) hPrintf("\n"); controlGridEndRow(cg); /* First track group that is not the custom track group (#1) * or a track hub, gets the Base Position track * unless it's collapsed. */ if (!showedRuler && !isHubTrack(group->name) && differentString(group->name, "user") ) { char *url = trackUrl(RULER_TRACK_NAME, chromName); showedRuler = TRUE;
\n"); - hButtonWithOnClick("hgt.collapseGroups", "collapse all", "collapse all track groups", "return setAllTrackGroupVisibility(false)"); + hButtonWithOnClick("hgt.collapseGroups", "collapse all", "collapse all track groups", "return vis.expandAllGroups(false)"); hPrintf("" "Use drop-down controls below and press refresh to alter tracks " "displayed.
" "Tracks with lots of items will automatically be displayed in " "more compact modes.
"); - hButtonWithOnClick("hgt.expandGroups", "expand all", "expand all track groups", "return setAllTrackGroupVisibility(true)"); + hButtonWithOnClick("hgt.expandGroups", "expand all", "expand all track groups", "return vis.expandAllGroups(true)"); hPrintf("
",MAX_CONTROL_COLUMNS); else hPrintf("",MAX_CONTROL_COLUMNS-1); hPrintf("
"); hPrintf("\n",group->name); - hPrintf("\"%s\"  ", + hPrintf("\"%s\"  ", group->name, group->name, indicatorImg, indicator,isOpen?"Collapse":"Expand"); hPrintf("\n%s", group->label); hPrintf("\n"); hPrintf("\n"); hPrintf("