src/hg/hgTracks/imageV2.h 1.2
1.2 2009/06/27 20:13:01 tdreszer
Drag reorder should now be persistent
Index: src/hg/hgTracks/imageV2.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/imageV2.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/hg/hgTracks/imageV2.h 26 Jun 2009 17:49:09 -0000 1.1
+++ src/hg/hgTracks/imageV2.h 27 Jun 2009 20:13:01 -0000 1.2
@@ -229,17 +229,22 @@
int chromEnd; // Image end (absolute, not portal position)
boolean plusStrand; // Image covers plus strand, not minus strand
boolean showCenterLabel; // Initially display center label? TODO: Isn't this redundent with vis?
boolean reorderable; // Is this track reorderable (by drag and drop) ?
+ int order; // Image order: This keeps track of dragReorder
enum trackVisibility vis; // Current visibility of track image
struct imgSlice *slices; // Currently there should be three slices for every track: data, centerLabel, sideLabel
};
-
-struct imgTrack *imgTrackStart(struct trackDb *tdb,char *name,char *db,char *chrom,int chromStart,int chromEnd,boolean plusStrand,boolean showCenterLabel,enum trackVisibility vis,boolean reorderable);
+#define IMG_ANYORDER -2
+#define IMG_FIXEDPOS -1
+#define IMG_ORDER_VAR "imgOrd"
+struct imgTrack *imgTrackStart(struct trackDb *tdb,char *name,char *db,char *chrom,int chromStart,int chromEnd,boolean plusStrand,boolean showCenterLabel,enum trackVisibility vis,int order);
/* Starts an image track which will contain all image slices needed to render one track
Must completed by adding slices with imgTrackAddSlice() */
-struct imgTrack *imgTrackUpdate(struct imgTrack *imgTrack,struct trackDb *tdb,char *name,char *db,char *chrom,int chromStart,int chromEnd,boolean plusStrand,boolean showCenterLabel,enum trackVisibility vis,boolean reorderable);
+struct imgTrack *imgTrackUpdate(struct imgTrack *imgTrack,struct trackDb *tdb,char *name,char *db,char *chrom,int chromStart,int chromEnd,boolean plusStrand,boolean showCenterLabel,enum trackVisibility vis,int order);
/* Updates an already existing image track */
+int imgTrackOrderCmp(const void *va, const void *vb);
+/* Compare to sort on label. */
struct imgSlice *imgTrackSliceAdd(struct imgTrack *imgTrack,enum sliceType type, struct image *img,char *title,int width,int height,int offsetX,int offsetY);
/* Adds slices to an image track. Expected are types: isData, isSide and isCenter */
struct imgSlice *imgTrackSliceGetByType(struct imgTrack *imgTrack,enum sliceType type);
/* Gets a specific slice already added to an image track. Expected are types: isData, isSide and isCenter */
@@ -279,16 +284,18 @@
struct image *imgBoxImageAdd(struct imgBox *imgBox,char *gif,char *title,int width,int height,boolean backGround);
/* Adds an image to an imgBox. The image may be extended with imgMapStart(),mapSetItemAdd() */
struct image *imgBoxImageFind(struct imgBox *imgBox,char *gif);
/* Finds a specific image already added to this imgBox */
-struct imgTrack *imgBoxTrackAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name,enum trackVisibility vis,boolean showCenterLabel,boolean reorderable);
+struct imgTrack *imgBoxTrackAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name,enum trackVisibility vis,boolean showCenterLabel,int order);
/* Adds an imgTrack to an imgBox. The imgTrack needs to be extended with imgTrackAddSlice() */
struct imgTrack *imgBoxTrackFind(struct imgBox *imgBox,struct trackDb *tdb,char *name);
/* Finds a specific imgTrack already added to this imgBox */
-struct imgTrack *imgBoxTrackFindOrAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name,enum trackVisibility vis,boolean showCenterLabel,boolean reorderable);
+struct imgTrack *imgBoxTrackFindOrAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name,enum trackVisibility vis,boolean showCenterLabel,int order);
/* Find the imgTrack, or adds it if not found */
-struct imgTrack *imgBoxTrackUpdateOrAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name,enum trackVisibility vis,boolean showCenterLabel,boolean reorderable);
+struct imgTrack *imgBoxTrackUpdateOrAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name,enum trackVisibility vis,boolean showCenterLabel,int order);
/* Updates the imgTrack, or adds it if not found */
+void imgBoxTracksNormalizeOrder(struct imgBox *imgBox);
+/* This routine sorts the imgTracks then forces tight ordering, so new tracks wil go to the end */
boolean imgBoxIsComplete(struct imgBox *imgBox,boolean verbose);
/* Tests the completeness and consistency of an imgBox. */
void imgBoxFree(struct imgBox **pImgBox);
/* frees all memory assocated with an imgBox (including images and imgTracks) */