diff options
-rw-r--r-- | src/bltGrMisc.h | 90 | ||||
-rw-r--r-- | src/bltGraph.h | 101 |
2 files changed, 90 insertions, 101 deletions
diff --git a/src/bltGrMisc.h b/src/bltGrMisc.h index 4f7b301..4b57256 100644 --- a/src/bltGrMisc.h +++ b/src/bltGrMisc.h @@ -40,17 +40,97 @@ #include <tkInt.h> #endif +/* + * Bit flags definitions: + * + * All kinds of state information kept here. All these things happen + * when the window is available to draw into (DisplayGraph). Need the + * window width and height before we can calculate graph layout (i.e. the + * screen coordinates of the axes, elements, titles, etc). But we want to + * do this only when we have to, not every time the graph is redrawn. + * + * Same goes for maintaining a pixmap to double buffer graph elements. + * Need to mark when the pixmap needs to updated. + * + * + * MAP_ITEM Indicates that the element/marker/axis + * configuration has changed such that + * its layout of the item (i.e. its + * position in the graph window) needs + * to be recalculated. + * + * MAP_ALL Indicates that the layout of the axes and + * all elements and markers and the graph need + * to be recalculated. Otherwise, the layout + * of only those markers and elements that + * have changed will be reset. + * + * GET_AXIS_GEOMETRY Indicates that the size of the axes needs + * to be recalculated. + * + * RESET_AXES Flag to call to Blt_ResetAxes routine. + * This routine recalculates the scale offset + * (used for mapping coordinates) of each axis. + * If an axis limit has changed, then it sets + * flags to re-layout and redraw the entire + * graph. This needs to happend before the axis + * can compute transformations between graph and + * screen coordinates. + * + * LAYOUT_NEEDED + * + * CACHE_DIRTY If set, redraw all elements into the pixmap + * used for buffering elements. + * + * REDRAW_PENDING Non-zero means a DoWhenIdle handler has + * already been queued to redraw this window. + * + * DRAW_LEGEND Non-zero means redraw the legend. If this is + * the only DRAW_* flag, the legend display + * routine is called instead of the graph + * display routine. + * + * DRAW_MARGINS Indicates that the margins bordering + * the plotting area need to be redrawn. + * The possible reasons are: + * + * 1) an axis configuration changed + * 2) an axis limit changed + * 3) titles have changed + * 4) window was resized. + * + * GRAPH_FOCUS + */ + +#define DELETE_PENDING (1<<1) /* 0x0002 */ +#define REDRAW_PENDING (1<<2) /* 0x0004 */ +#define ACTIVE_PENDING (1<<3) /* 0x0008 */ +#define MAP_ITEM (1<<4) /* 0x0010 */ +#define DIRTY (1<<5) /* 0x0020 */ +#define ACTIVE (1<<6) /* 0x0040 */ +#define FOCUS (1<<7) /* 0x0080 */ + +#define MAP_ALL (1<<8) /* 0x0100 */ +#define LAYOUT_NEEDED (1<<9) /* 0x0200 */ +#define RESET_AXES (1<<10)/* 0x0400 */ +#define GET_AXIS_GEOMETRY (1<<11)/* 0x0800 */ + +#define DRAW_LEGEND (1<<12)/* 0x1000 */ +#define DRAW_MARGINS (1<<13)/* 0x2000 */ +#define CACHE_DIRTY (1<<14)/* 0x4000 */ + +#define GRAPH_DELETED (1<<15)/* 0x4000 */ + +#define MAP_WORLD (MAP_ALL|RESET_AXES|GET_AXIS_GEOMETRY) +#define REDRAW_WORLD (DRAW_LEGEND) +#define RESET_WORLD (REDRAW_WORLD | MAP_WORLD) + #define MARGIN_NONE -1 #define MARGIN_BOTTOM 0 /* x */ #define MARGIN_LEFT 1 /* y */ #define MARGIN_TOP 2 /* x2 */ #define MARGIN_RIGHT 3 /* y2 */ -#define rightMargin margins[MARGIN_RIGHT] -#define leftMargin margins[MARGIN_LEFT] -#define topMargin margins[MARGIN_TOP] -#define bottomMargin margins[MARGIN_BOTTOM] - class Graph; typedef struct { diff --git a/src/bltGraph.h b/src/bltGraph.h index 57b9bfa..b0984b7 100644 --- a/src/bltGraph.h +++ b/src/bltGraph.h @@ -38,17 +38,6 @@ extern "C" { #include "bltChain.h" }; -#define MARGIN_NONE -1 -#define MARGIN_BOTTOM 0 /* x */ -#define MARGIN_LEFT 1 /* y */ -#define MARGIN_TOP 2 /* x2 */ -#define MARGIN_RIGHT 3 /* y2 */ - -#define rightMargin margins[MARGIN_RIGHT] -#define leftMargin margins[MARGIN_LEFT] -#define topMargin margins[MARGIN_TOP] -#define bottomMargin margins[MARGIN_BOTTOM] - class Graph; class Crosshairs; class Axis; @@ -110,6 +99,11 @@ typedef struct { Tcl_HashTable tagTable; } Component; +#define rightMargin margins[MARGIN_RIGHT] +#define leftMargin margins[MARGIN_LEFT] +#define topMargin margins[MARGIN_TOP] +#define bottomMargin margins[MARGIN_BOTTOM] + class Graph { public: Tcl_Interp* interp; @@ -193,91 +187,6 @@ class Graph { int maxBarSetSize; }; -/* - * Bit flags definitions: - * - * All kinds of state information kept here. All these things happen - * when the window is available to draw into (DisplayGraph). Need the - * window width and height before we can calculate graph layout (i.e. the - * screen coordinates of the axes, elements, titles, etc). But we want to - * do this only when we have to, not every time the graph is redrawn. - * - * Same goes for maintaining a pixmap to double buffer graph elements. - * Need to mark when the pixmap needs to updated. - * - * - * MAP_ITEM Indicates that the element/marker/axis - * configuration has changed such that - * its layout of the item (i.e. its - * position in the graph window) needs - * to be recalculated. - * - * MAP_ALL Indicates that the layout of the axes and - * all elements and markers and the graph need - * to be recalculated. Otherwise, the layout - * of only those markers and elements that - * have changed will be reset. - * - * GET_AXIS_GEOMETRY Indicates that the size of the axes needs - * to be recalculated. - * - * RESET_AXES Flag to call to Blt_ResetAxes routine. - * This routine recalculates the scale offset - * (used for mapping coordinates) of each axis. - * If an axis limit has changed, then it sets - * flags to re-layout and redraw the entire - * graph. This needs to happend before the axis - * can compute transformations between graph and - * screen coordinates. - * - * LAYOUT_NEEDED - * - * CACHE_DIRTY If set, redraw all elements into the pixmap - * used for buffering elements. - * - * REDRAW_PENDING Non-zero means a DoWhenIdle handler has - * already been queued to redraw this window. - * - * DRAW_LEGEND Non-zero means redraw the legend. If this is - * the only DRAW_* flag, the legend display - * routine is called instead of the graph - * display routine. - * - * DRAW_MARGINS Indicates that the margins bordering - * the plotting area need to be redrawn. - * The possible reasons are: - * - * 1) an axis configuration changed - * 2) an axis limit changed - * 3) titles have changed - * 4) window was resized. - * - * GRAPH_FOCUS - */ - -#define DELETE_PENDING (1<<1) /* 0x0002 */ -#define REDRAW_PENDING (1<<2) /* 0x0004 */ -#define ACTIVE_PENDING (1<<3) /* 0x0008 */ -#define MAP_ITEM (1<<4) /* 0x0010 */ -#define DIRTY (1<<5) /* 0x0020 */ -#define ACTIVE (1<<6) /* 0x0040 */ -#define FOCUS (1<<7) /* 0x0080 */ - -#define MAP_ALL (1<<8) /* 0x0100 */ -#define LAYOUT_NEEDED (1<<9) /* 0x0200 */ -#define RESET_AXES (1<<10)/* 0x0400 */ -#define GET_AXIS_GEOMETRY (1<<11)/* 0x0800 */ - -#define DRAW_LEGEND (1<<12)/* 0x1000 */ -#define DRAW_MARGINS (1<<13)/* 0x2000 */ -#define CACHE_DIRTY (1<<14)/* 0x4000 */ - -#define GRAPH_DELETED (1<<15)/* 0x4000 */ - -#define MAP_WORLD (MAP_ALL|RESET_AXES|GET_AXIS_GEOMETRY) -#define REDRAW_WORLD (DRAW_LEGEND) -#define RESET_WORLD (REDRAW_WORLD | MAP_WORLD) - extern void Blt_MapGraph(Graph* graphPtr); extern void Blt_ReconfigureGraph(Graph* graphPtr); extern void Blt_GraphExtents(Graph* graphPtr, Region2d *extsPtr); |