d1d559e9bee7fcaec3a50ae43688ca436656ad7b
kate
  Wed Nov 18 08:25:58 2015 -0800
Finish variable height item packing. Adds an optional rowSizes field to spaceSaver. refs #15645

diff --git src/inc/spaceSaver.h src/inc/spaceSaver.h
index 3ae0919..a41e62a 100644
--- src/inc/spaceSaver.h
+++ src/inc/spaceSaver.h
@@ -4,30 +4,32 @@
  *
  * This file is copyright 2000 Jim Kent, but license is hereby
  * granted for all use - public, private or commercial. */
 
 #ifndef SPACESAVER_H
 #define SPACESAVER_H
 
 struct spaceSaver
 /* Help layout 1-D objects onto multiple tracks so that
  * no two objects overlap on a single track. */
     {
     struct spaceSaver *next;	/* Next in list. */
     struct spaceNode *nodeList; /* List of things put in space saver. */
     struct spaceRowTracker *rowList; /* List of rows. */
     int rowCount;             /* Number of rows. */
+    int *rowSizes;            /* Height in pixels of each row. 
+                                Used by tracks with variable height items. */
     int winStart,winEnd;      /* Start and end of area we're modeling. */
     int cellsInRow;           /* Number of cells per row. */
     double scale;             /* What to scale by to get to cell coordinates. */
     int maxRows;	      /* Maximum number of rows.  */
     boolean isFull;	      /* Set to true if can't fit data into maxRows. */
     };
 
 struct spaceNode
 /* Which row is this one on? */
     {
     struct spaceNode *next;	/* Next in list. */
     int row;			/* Which row, starting at zero. */
     void *val;
     };
 
@@ -46,19 +48,26 @@
 
 void spaceSaverFree(struct spaceSaver **pSs);
 /* Free up a space saver. */
 
 struct spaceNode *spaceSaverAdd(struct spaceSaver *ss, int start, int end, void *val);
 /* Add a new node to space saver. */
 
 
 struct spaceNode *spaceSaverAddOverflow(struct spaceSaver *ss, int start, int end, 
 					void *val, boolean allowOverflow);
 /* Add a new node to space saver. Returns NULL if can't fit item in
  * and allowOverflow == FALSE. If allowOverflow == TRUE then put items
  * that won't fit in first row (ends up being last row after
  * spaceSaverFinish()). */
 
+int spaceSaverSetRowHeights(struct spaceSaver *ss, int (*itemHeight)(void *item));
+/* Determine maximum height of items in a row. Return total height.
+   Used by tracks with variable height items */
+
+int spaceSaverGetRowHeightsTotal(struct spaceSaver *ss);
+/* Return height of all rows. Used by tracks with variable height items */
+
 void spaceSaverFinish(struct spaceSaver *ss);
 /* Tell spaceSaver done adding nodes. */
 #endif /* SPACESAVER_H */