src/hg/hgTracks/makeItemsTrack.c 1.4
1.4 2010/04/10 04:11:27 kent
Replacing dummy first item with something better. Restoring click to details page, which is still sparse.
Index: src/hg/hgTracks/makeItemsTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/makeItemsTrack.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -B -U 4 -r1.3 -r1.4
--- src/hg/hgTracks/makeItemsTrack.c 10 Apr 2010 01:14:57 -0000 1.3
+++ src/hg/hgTracks/makeItemsTrack.c 10 Apr 2010 04:11:27 -0000 1.4
@@ -50,22 +50,21 @@
freez(&dupeCommand);
}
+static int makeItemsExtraHeight(struct track *tg)
+/* Return extra height of track. */
+{
+return tl.fontHeight+2;
+}
+
void makeItemsLoadItems(struct track *tg)
/* Load up items in track already. Also make up a pseudo-item that is
* where you drag to create an item. */
{
struct bed *bedList = NULL;
-struct bed *firstItem;
-AllocVar(firstItem);
-firstItem->chrom = cloneString(chromName);
-firstItem->chromStart = winStart;
-firstItem->chromEnd = winEnd;
-firstItem->name = cloneString("Drag here to create a new item");
struct customTrack *ct = tg->customPt;
char *tableName = ct->dbTableName;
-firstItem->name = cloneString(tableName);
struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
int rowOffset;
struct sqlResult *sr = hRangeQuery(conn, tableName, chromName, winStart, winEnd, NULL, &rowOffset);
char **row;
@@ -74,21 +73,40 @@
struct bed *bed = bedLoad6(row+rowOffset);
slAddHead(&bedList, bed);
}
sqlFreeResult(&sr);
-#ifdef SOON
-#endif /* SOON */
hFreeConn(&conn);
slReverse(&bedList);
-slAddHead(&bedList, firstItem);
tg->items = bedList;
}
+void makeItemsDrawItems(struct track *tg, int seqStart, int seqEnd,
+ struct hvGfx *hvg, int xOff, int yOff, int width,
+ MgFont *font, Color color, enum trackVisibility vis)
+/* Draw simple Bed items. */
+{
+int dragBarHeight = makeItemsExtraHeight(tg);
+hvGfxTextCentered(hvg, xOff, yOff, width, dragBarHeight, color, font,
+ "--- Drag here or inbetween items to create a new item. ---");
+bedDrawSimple(tg, seqStart, seqEnd, hvg, xOff, yOff + dragBarHeight, width,
+ font, color, vis);
+}
+
+int makeItemsTotalHeight(struct track *tg, enum trackVisibility vis)
+/* Most fixed height track groups will use this to figure out the height
+ * they use. */
+{
+return tgFixedTotalHeightOptionalOverflow(tg,vis, tl.fontHeight+1, tl.fontHeight, FALSE) +
+ makeItemsExtraHeight(tg);
+}
+
+
void makeItemsMethods(struct track *track)
/* Set up special methods for makeItems type tracks. */
{
bedMethods(track);
+track->totalHeight = makeItemsTotalHeight;
+track->drawItems = makeItemsDrawItems;
track->loadItems = makeItemsLoadItems;
-track->mapsSelf = TRUE;
track->canPack = TRUE;
}