src/hg/hgTracks/makeItemsTrack.c 1.1

1.1 2010/04/08 20:36:35 kent
Starting to work on makeItems type tracks.
Index: src/hg/hgTracks/makeItemsTrack.c
===================================================================
RCS file: src/hg/hgTracks/makeItemsTrack.c
diff -N src/hg/hgTracks/makeItemsTrack.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/hg/hgTracks/makeItemsTrack.c	8 Apr 2010 20:36:35 -0000	1.1
@@ -0,0 +1,32 @@
+/* makeItemsTrack.c - supports tracks of type makeItems.  Users can drag to create an item
+ * and click to edit one. */
+
+#include "common.h"
+#include "hash.h"
+#include "linefile.h"
+#include "jksql.h"
+#include "hdb.h"
+#include "hgTracks.h"
+#include "bed.h"
+
+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 *firstItem;
+AllocVar(firstItem);
+firstItem->chrom = cloneString(chromName);
+firstItem->chromStart = winStart;
+firstItem->chromEnd = winEnd;
+firstItem->name = cloneString("Drag here to create a new item");
+tg->items = firstItem;
+}
+
+void makeItemsMethods(struct track *track)
+/* Set up special methods for makeItems type tracks. */
+{
+bedMethods(track);
+track->loadItems = makeItemsLoadItems;
+track->mapsSelf = TRUE;
+track->canPack = TRUE;
+}