Index: src/hg/hgTracks/makeItemsTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/makeItemsTrack.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -B -U 4 -r1.4 -r1.5
--- src/hg/hgTracks/makeItemsTrack.c	10 Apr 2010 04:11:27 -0000	1.4
+++ src/hg/hgTracks/makeItemsTrack.c	10 Apr 2010 06:13:30 -0000	1.5
@@ -7,8 +7,9 @@
 #include "jksql.h"
 #include "hdb.h"
 #include "hgTracks.h"
 #include "bed.h"
+#include "binRange.h"
 #include "makeItemsItem.h"
 
 void makeItemsJsCommand(char *command, struct track *trackList, struct hash *trackHash)
 /* Execute some command sent to us from the javaScript.  All we know for sure is that
@@ -31,8 +32,9 @@
 
 /* Create a new item based on command. */
 struct makeItemsItem *item;
 AllocVar(item);
+item->bin = binFromRange(chromStart, chromEnd);
 item->chrom = cloneString(chrom);
 item->chromStart = item->thickStart = chromStart;
 item->chromEnd = item->thickEnd = chromEnd;
 item->name = cloneString("new");
@@ -69,23 +71,42 @@
 struct sqlResult *sr = hRangeQuery(conn, tableName, chromName, winStart, winEnd, NULL, &rowOffset);
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     {
-    struct bed *bed = bedLoad6(row+rowOffset);
+    struct bed *bed = bedLoadN(row+rowOffset, 9);
+    /* Add id to front of name */
+    char *id = row[rowOffset + 10];
+    char buf[64];
+    safef(buf, sizeof(buf), "%s %s", id, bed->name);
+    freeMem(bed->name);
+    bed->name = cloneString(buf);
     slAddHead(&bedList, bed);
     }
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 slReverse(&bedList);
 tg->items = bedList;
 }
 
+char *makeItemsItemName(struct track *tg, void *item)
+/* Return name of one of an item to display on left side. */
+{
+struct bed *bed = item;
+char *name = bed->name;
+name = skipToSpaces(name);
+name = skipLeadingSpaces(name);
+return name;
+}
+
 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);
+struct customTrack *ct = tg->customPt;
+char *tableName = ct->dbTableName;
+hvGfxText(hvg, xOff, yOff, color, font, tableName);
 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);
@@ -106,7 +127,8 @@
 bedMethods(track);
 track->totalHeight = makeItemsTotalHeight;
 track->drawItems = makeItemsDrawItems;
 track->loadItems = makeItemsLoadItems;
+track->itemName = makeItemsItemName;
 track->canPack = TRUE;
 }
 

