385f6d8b1f19463d2103cee18970fa833411293f
max
Tue Sep 15 01:07:19 2015 -0700
adding menu entries under genomes and genome browser, refs #16022
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 4133901..43ed723 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -5338,30 +5338,40 @@
}
withPriorityOverride = cartUsualBoolean(cart, configPriorityOverride, FALSE);
insideX = trackOffsetX();
insideWidth = tl.picWidth-gfxBorder-insideX;
}
void tracksDisplay()
/* Put up main tracks display. This routine handles zooming and
* scrolling. */
{
char newPos[256];
char *defaultPosition = hDefaultPos(database);
char titleVar[256];
position = getPositionFromCustomTracks();
+
+// position=lastDbPos in URL? -> go back to the last browsed position for this db
+char dbPosKey[256];
+safef(dbPosKey, sizeof(dbPosKey), "position.%s", database);
+if (sameOk(cgiOptionalString("position"), "lastDbPos"))
+ {
+ char *position = cartUsualString(cart, dbPosKey, defaultPosition);
+ cartSetString(cart, "position", position);
+ }
+
if (NULL == position)
{
position = cloneString(cartUsualString(cart, "position", NULL));
}
/* default if not set at all, as would happen if it came from a URL with no
* position. Otherwise tell them to go back to the gateway. Also recognize
* "default" as specifying the default position. */
if (((position == NULL) || sameString(position, "default"))
&& (defaultPosition != NULL))
position = cloneString(defaultPosition);
if (sameString(position, ""))
{
hUserAbort("Please go back and enter a coordinate range or a search term in the \"search term\" field.
For example: chr22:20100000-20200000.\n");
}
@@ -5385,30 +5395,33 @@
be drawn with names highlighted for easy identification. */
createHgFindMatchHash();
/* This means that no single result was found
I.e., multiple results may have been found and are printed out prior to this code*/
if (NULL == chromName)
{
// In case user manually edits the browser location as described in #13009,
// revert the position. If they instead choose from the list as we expect,
// that will set the position to their choice.
char *lastPosition = cartUsualString(cart, "lastPosition", hDefaultPos(database));
cartSetString(cart, "position", lastPosition);
return;
}
+// save the current position to the cart var position.
+cartSetString(cart, dbPosKey, position);
+
seqBaseCount = hChromSize(database, chromName);
winBaseCount = winEnd - winStart;
/* Figure out basic dimensions of display. This
* needs to be done early for the sake of the
* zooming and dinking routines. */
setLayoutGlobals();
baseShowPos = cartUsualBoolean(cart, BASE_SHOWPOS, FALSE);
baseShowAsm = cartUsualBoolean(cart, BASE_SHOWASM, FALSE);
baseShowScaleBar = cartUsualBoolean(cart, BASE_SCALE_BAR, TRUE);
baseShowRuler = cartUsualBoolean(cart, BASE_SHOWRULER, TRUE);
safef(titleVar,sizeof(titleVar),"%s_%s", BASE_TITLE, database);
baseTitle = cartUsualString(cart, titleVar, "");
if (sameString(baseTitle, ""))