f71865cec0dd5cf0af5110bfe12f4171a31f7f7b
kate
Sat Mar 13 20:24:28 2021 -0800
Place multi-region button move under hg.conf control. Add 'pressed' styling to arbitrary buttons. refs #26385
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index ccef946..fe51c0c 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -7987,42 +7987,56 @@
char *thisSessVisTracks = cgiTrackVisString(thisSessVars);
//freeMem(curSessCart);
boolean isSessChanged = FALSE;
if (differentString(curSessVisTracks, thisSessVisTracks))
{
isSessChanged = TRUE;
#ifdef DEBUG
uglyf("
curSess vis tracks: %s", curSessVisTracks);
uglyf("
thsSess vis tracks: %s", thisSessVisTracks);
#endif
}
return isSessChanged;
}
+static void printMultiRegionButton()
+/* Print button that launches multi-region configuration pop-up */
+{
+boolean isPressed = FALSE;
+if (differentString(virtModeType, "default"))
+ isPressed = TRUE;
+char buf[256];
+safef(buf, sizeof buf, "configure %s multi-region display mode",
+ isPressed ? "or exit" : "");
+hButtonNoSubmitMaybePressed("hgTracksConfigMultiRegionPage", "multi-region", buf,
+ "popUpHgt.hgTracks('multi-region config'); return false;", isPressed);
+}
+
void doTrackForm(char *psOutput, struct tempName *ideoTn)
/* Make the tracks display form with the zoom/scroll buttons and the active
* image. If the ideoTn parameter is not NULL, it is filled in if the
* ideogram is created. */
{
struct group *group;
struct track *track;
char *freezeName = NULL;
boolean hideAll = cgiVarExists("hgt.hideAll");
boolean defaultTracks = cgiVarExists("hgt.reset");
boolean showedRuler = FALSE;
boolean showTrackControls = cartUsualBoolean(cart, "trackControlsOnMain", TRUE);
+boolean multiRegionButtonTop = (cfgOption("multiRegionButtonTop") != NULL);
long thisTime = 0, lastTime = 0;
basesPerPixel = ((float)virtWinBaseCount) / ((float)fullInsideWidth);
zoomedToBaseLevel = (virtWinBaseCount <= fullInsideWidth / tl.mWidth);
zoomedToCodonLevel = (ceil(virtWinBaseCount/3) * tl.mWidth) <= fullInsideWidth;
zoomedToCodonNumberLevel = (ceil(virtWinBaseCount/3) * tl.mWidth * 5) <= fullInsideWidth;
zoomedToCdsColorLevel = (virtWinBaseCount <= fullInsideWidth*3);
if (psOutput != NULL)
{
hPrintDisable();
hideControls = TRUE;
withNextItemArrows = FALSE;
withNextExonArrows = FALSE;
hgFindMatches = NULL;
@@ -8634,56 +8648,60 @@
}
/* Make line that says position. */
{
char buf[256];
char *survey = cfgOptionEnv("HGDB_SURVEY", "survey");
char *surveyLabel = cfgOptionEnv("HGDB_SURVEY_LABEL", "surveyLabel");
char *javascript = "document.location = '/cgi-bin/hgTracks?db=' + document.TrackForm.db.options[document.TrackForm.db.selectedIndex].value;";
if (containsStringNoCase(database, "zoo"))
{
hPuts("Organism ");
printAssemblyListHtmlExtra(database, "change", javascript);
}
- /* Multi-region button on position line */
- safef(buf, sizeof buf, "configure %s multi-region display mode",
- sameString(virtModeType, "default") ? "in" : "or exit");
- hButtonNoSubmitMaybePressed("hgTracksConfigMultiRegionPage", "multi-region", buf,
- "popUpHgt.hgTracks('multi-region config'); return false;", FALSE);
+ // multi-region button on position line, initially under hg.conf control
+ if (multiRegionButtonTop)
+ {
+ printMultiRegionButton();
hPrintf(" ");
+ }
if (virtualSingleChrom()) // DISGUISE VMODE
safef(buf, sizeof buf, "%s", windowsSpanPosition());
else
safef(buf, sizeof buf, "%s:%ld-%ld", virtChromName, virtWinStart+1, virtWinEnd);
position = cloneString(buf);
- char *pressedClass = "", *showVirtRegions = "";
+
+ // position box
+ char *pressedClass = "";
+ char *showVirtRegions = "";
if (differentString(virtModeType, "default"))
{
pressedClass = "pressed";
showVirtRegions = "show multi-region position ranges and ";
}
hPrintf("%s",
pressedClass, showVirtRegions, addCommasToPos(database, position));
hPrintf("\n", buf);
sprintLongWithCommas(buf, virtWinEnd - virtWinStart);
hPrintf(" %s bp. ", buf);
- hPrintf("\n");
+ hPrintf("\n", multiRegionButtonTop ? 50 : 60);
hWrites(" ");
hButton("goButton", "go");
if (!trackHubDatabase(database))
{
jsonObjectAdd(jsonForClient, "assemblySupportsGeneSuggest", newJsonBoolean(assemblySupportsGeneSuggest(database)));
if (assemblySupportsGeneSuggest(database))
hPrintf("\n", assemblyGeneSuggestTrack(database));
}
if (survey && differentWord(survey, "off"))
hPrintf(" "
"%s\n",
survey, surveyLabel ? surveyLabel : "Take survey");
hPutc('\n');
}
@@ -8841,30 +8859,35 @@
hasCustomTracks ? "Manage your custom tracks" : "Add your own custom tracks");
jsOnEventById("click", "ct_add", "document.customTrackForm.submit();return false;");
hPrintf(" ");
if (hubConnectTableExists())
{
hPrintf("");
jsOnEventById("click", "th_form", "document.trackHubForm.submit();");
hPrintf(" ");
}
hButtonWithMsg("hgTracksConfigPage", "configure","Configure image and track selection");
hPrintf(" ");
+ if (!multiRegionButtonTop)
+ {
+ printMultiRegionButton();
+ hPrintf(" ");
+ }
hButtonMaybePressed("hgt.toggleRevCmplDisp", "reverse",
revCmplDisp ? "Show forward strand at this location"
: "Show reverse strand at this location",
NULL, revCmplDisp);
hPrintf(" ");
hButtonWithOnClick("hgt.setWidth", "resize", "Resize image width to browser window size", "hgTracksSetWidth()");
hPrintf(" ");
hButtonWithMsg("hgt.refresh", "refresh","Refresh image");
hPrintf("
\n");
if( chromosomeColorsMade )
{