From 00b67591985a3cb7792b6c655cc60505ec248bd9 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Mon, 27 Jul 1998 05:01:24 +0000 Subject: [PATCH] finish colorizing things, I think, for now git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@920 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/basiccell.h | 14 +- src/register/cellblock.c | 3 + src/register/cellblock.h | 17 ++- src/register/pricecell.c | 20 ++- src/register/pricecell.h | 7 +- src/register/splitreg.c | 11 ++ src/register/table-allgui.c | 153 ++++++++++------------ src/register/table-allgui.h | 12 +- src/register/table-motif.c | 248 +++++++++++++++++++++++------------- src/register/table-motif.h | 14 +- 10 files changed, 309 insertions(+), 190 deletions(-) diff --git a/src/register/basiccell.h b/src/register/basiccell.h index c99afe814d..db74b65338 100644 --- a/src/register/basiccell.h +++ b/src/register/basiccell.h @@ -132,15 +132,17 @@ #define __XACC_BASIC_CELL_H__ typedef struct _BasicCell BasicCell; +typedef unsigned int uint32; struct _BasicCell { - short width; /* column width, in chars, not pixels */ - short alignment; /* column text alignment */ - char input_output; /* zero if output-only */ - int bg_color; /* background color, ARGB format */ - int fg_color; /* forground (text) color ARGB format */ - /* hack alert -- add support for e.g. bold fonts !?!?! */ + short width; /* column width, in chars, not pixels */ + short alignment; /* column text alignment */ + char input_output; /* zero if output-only */ + uint32 bg_color; /* background color, ARGB format */ + uint32 fg_color; /* forground (text) color ARGB format */ + + /* hack alert -- add support for e.g. bold fonts !?!?! italic fonts ?? */ char * value; /* current value */ unsigned int changed; /* 2^32-1 if value modified */ diff --git a/src/register/cellblock.c b/src/register/cellblock.c index 261bc97b63..d96b08c8d3 100644 --- a/src/register/cellblock.c +++ b/src/register/cellblock.c @@ -39,6 +39,9 @@ CellBlock * xaccMallocCellBlock (int numrows, int numcols) arr->numRows = 0; arr->numCols = 0; + arr->active_bg_color = 0xffffff; /* white */ + arr->passive_bg_color = 0xffffff; /* white */ + arr->user_data = NULL; arr->cells = NULL; arr->right_traverse_r = NULL; diff --git a/src/register/cellblock.h b/src/register/cellblock.h index 50ee8cbecf..34592a3cfe 100644 --- a/src/register/cellblock.h +++ b/src/register/cellblock.h @@ -60,12 +60,23 @@ struct _CellBlock { short numRows; short numCols; - BasicCell ***cells; /* row-col array */ - /* the above array of pointers has dimensions of numRows*numCols. - * It is autonmatically created and managed by the routines below. + /* The array "cells" of pointers to cells has dimensions of numRows*numCols. + * It is automatically created and managed by the routines below. * It contains pointers to the cell handlers that are a part of * this "block". */ + BasicCell ***cells; /* row-col array */ + + /* The active_bg_color is the default color (in argb) for the cell + * backgrounds when this cell block needs to be "highlighted" in + * some way (typically, when this cellblock represents the + * the currently active cursor). + * + * The passive_bg_color is the default color for the cell background + * (in argb format) when the cell block is not highlighted. + */ + uint32 active_bg_color; + uint32 passive_bg_color; short **right_traverse_r; short **right_traverse_c; diff --git a/src/register/pricecell.c b/src/register/pricecell.c index 624e14f199..5f4b88c15a 100644 --- a/src/register/pricecell.c +++ b/src/register/pricecell.c @@ -39,7 +39,17 @@ static void PriceSetValue (BasicCell *, const char *); -/* hack alert -- use color for cells as per old xacc */ +/* set the color of the text to red, if teh value is negative */ +/* hack alert -- the actual color should probably be configurable */ +#define COLORIZE(cell,amt) { \ + if (0.0 > amt) { \ + /* red */ \ + cell->cell.fg_color = 0xff0000; \ + } else { \ + /* black */ \ + cell->cell.fg_color = 0x0; \ + } \ +} #define SET(cell,str) { \ if ((cell)->value) free ((cell)->value); \ @@ -128,6 +138,9 @@ void xaccSetPriceCellValue (PriceCell * cell, double amt) sprintf (buff, "%.3f", amt); } SET ( &(cell->cell), buff); + + /* set the cell color to red if the value is negative */ + COLORIZE (cell, amt); } /* ================================================ */ @@ -144,6 +157,9 @@ void xaccSetAmountCellValue (PriceCell * cell, double amt) sprintf (buff, "%.2f", amt); } SET ( &(cell->cell), buff); + + /* set the cell color to red if the value is negative */ + COLORIZE (cell, amt); } /* ================================================ */ @@ -163,10 +179,12 @@ void xaccSetDebCredCellValue (PriceCell * deb, sprintf (buff, "%.2f", amt); SET ( &(cred->cell), buff); SET ( &(deb->cell), ""); + cred->cell.fg_color = 0x0; } else { sprintf (buff, "%.2f", -amt); SET ( &(cred->cell), ""); SET ( &(deb->cell), buff); + deb->cell.fg_color = 0xff0000; } } diff --git a/src/register/pricecell.h b/src/register/pricecell.h index c98cc65896..9a6164de28 100644 --- a/src/register/pricecell.h +++ b/src/register/pricecell.h @@ -3,7 +3,7 @@ * pricecell.h * * FUNCTION: - * The PriceCell object Implements a cell handler that + * The PriceCell object implements a cell handler that * knows about storing and displaying a price or amount. * * By default, the PriceCell is an input/output cell. @@ -12,13 +12,16 @@ * and numeric punctuation. The punctuation accepted is *not* * currently internationalized. Read the source for details. * - * One output, it can display numeric values with two or three + * On output, it can display numeric values with two or three * decimal places. A planned enhancement would be to store * formating data with an instance of this cell. This is *not* * currently done. * * hack alert -- implement the above formating & internationalization. * + * On output, it will display negative values in red text. + * hack alert -- the actual color (red) should be user configurable. + * * The stored amount is stored as a double-precision floating point * variable. This should be sufficient precision to store trillions of * dollars with penny accuracy. diff --git a/src/register/splitreg.c b/src/register/splitreg.c index 770adead72..c071c91ade 100644 --- a/src/register/splitreg.c +++ b/src/register/splitreg.c @@ -363,6 +363,14 @@ void xaccInitSplitRegister (SplitRegister *reg, int type) FANCY (balance, Price, BALN); /* set the color of the cells in the transaction cursor */ + /* hack alert -- the actual color should depend on the + * type of register. */ + curs->active_bg_color = 0xffdddd; /* pale red */ + curs->passive_bg_color = 0xccccff; /* pale blue */ + + /* Need to declare the cell backgrounds as well, otherwise, + * the cell default will override ehte cursor + */ reg->descCell->cell.bg_color = 0xccccff; reg->balanceCell->cell.bg_color = 0xccccff; reg->dateCell->cell.bg_color = 0xccccff; @@ -385,6 +393,9 @@ void xaccInitSplitRegister (SplitRegister *reg, int type) FANCY (price, Price, PRIC); FANCY (value, Price, VALU); + /* set the color of the cells in the split cursor */ + curs->active_bg_color = 0xffffdd; /* pale yellow */ + curs->passive_bg_color = 0xffffff; /* white */ /* --------------------------- */ /* do some misc cell config */ diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index def98696e8..a65e8c5d5d 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -227,9 +227,9 @@ xaccTableResize (Table * table, new_phys_rows, new_phys_cols, (table->bg_colors), - int, - (0xffffff), /* white */ - NOOP); /* no-op */ + uint32, + ((uint32) 0xffffff), /* white */ + NOOP); /* no-op */ /* resize the foreground color array (black text) */ XACC_RESIZE_ARRAY ((table->num_phys_rows), @@ -237,9 +237,9 @@ xaccTableResize (Table * table, new_phys_rows, new_phys_cols, (table->fg_colors), - int, - (0x0), /* black */ - NOOP); /* no-op */ + uint32, + ((uint32) 0x0), /* black */ + NOOP); /* no-op */ /* resize the user-data hooks */ @@ -310,92 +310,46 @@ xaccSetCursor (Table *table, CellBlock *curs, /* ==================================================== */ -void xaccMoveCursor (Table *table, int new_phys_row, int new_phys_col) +static void +doMoveCursor (Table *table, int new_phys_row, int new_phys_col, int do_move_gui) { int i,j; int phys_row_origin, phys_col_origin; int new_virt_row, new_virt_col; CellBlock *curs; - /* call the callback, allowing the app to commit any changes */ + /* call the callback, allowing the app to commit any changes + * associated with the current location of the cursor. */ if (table->move_cursor) { (table->move_cursor) (table, table->client_data); } - /* check for out-of-bounds conditions (which may be deliberate) */ - if ((0 > new_phys_row) || (0 > new_phys_col)) { - new_virt_row = -1; - new_virt_col = -1; - } else { - new_virt_row = table->locators[new_phys_row][new_phys_col]->virt_row; - new_virt_col = table->locators[new_phys_row][new_phys_col]->virt_col; - } + /* Change the cell background colors to thier "passive" values. + * This denotes that the cursor has left this location (which means more or + * less the same thing as "the current location is no longer being edited.") + * (But only do this if the cursor has a valid current location) + */ + if ((0 <= table->current_cursor_phys_row) && + (0 <= table->current_cursor_phys_col)) + { + int r_origin = table->current_cursor_phys_row; + int c_origin = table->current_cursor_phys_col; + curs = table->current_cursor; - /* invalidate the cursor for now; we'll set it the the correct values below */ - table->current_cursor_phys_row = -1; - table->current_cursor_phys_col = -1; - table->current_cursor_virt_row = -1; - table->current_cursor_virt_col = -1; - curs = table->current_cursor; - if (curs) curs->user_data = NULL; - table->current_cursor = NULL; - - /* check for out-of-bounds conditions (which may be deliberate) */ - if ((0 > new_virt_row) || (0 > new_virt_col)) return; - if (new_virt_row >= table->num_virt_rows) return; - if (new_virt_col >= table->num_virt_cols) return; - - /* ok, we now have a valid position. Find the new cursor to use, - * and initialize it's cells */ - curs = table->handlers[new_virt_row][new_virt_col]; - table->current_cursor = curs; - - /* record the new virtual position ... */ - table->current_cursor_virt_row = new_virt_row; - table->current_cursor_virt_col = new_virt_col; - - /* compute some useful offsets ... */ - phys_row_origin = new_phys_row; - phys_row_origin -= table->locators[new_phys_row][new_phys_col]->phys_row_offset; - - phys_col_origin = new_phys_col; - phys_col_origin -= table->locators[new_phys_row][new_phys_col]->phys_col_offset; - - table->current_cursor_phys_row = phys_row_origin; - table->current_cursor_phys_col = phys_col_origin; - - /* update the cell values to reflect the new position */ - for (i=0; inumRows; i++) { - for (j=0; jnumCols; j++) { - BasicCell *cell; + for (i=0; inumRows; i++) { + for (j=0; jnumCols; j++) { + BasicCell *cell; - cell = curs->cells[i][j]; - if (cell) { - char * cell_val = table->entries[i+phys_row_origin][j+phys_col_origin]; - xaccSetBasicCellValue (cell, cell_val); - cell->changed = 0; + table->bg_colors[i+r_origin][j+c_origin] = curs->passive_bg_color; + cell = curs->cells[i][j]; + if (cell) { + table->bg_colors[i+r_origin][j+c_origin] = cell->bg_color; + table->fg_colors[i+r_origin][j+c_origin] = cell->fg_color; + } } } } - curs->user_data = table->user_data[new_virt_row][new_virt_col]; -} - -/* ==================================================== */ -/* same as above, but be sure to deal with GUI elements as well */ - -void xaccMoveCursorGUI (Table *table, int new_phys_row, int new_phys_col) -{ - int i,j; - int phys_row_origin, phys_col_origin; - int new_virt_row, new_virt_col; - CellBlock *curs; - - /* call the callback, allowing the app to commit any changes */ - if (table->move_cursor) { - (table->move_cursor) (table, table->client_data); - } - /* check for out-of-bounds conditions (which may be deliberate) */ if ((0 > new_phys_row) || (0 > new_phys_col)) { new_virt_row = -1; @@ -405,13 +359,12 @@ void xaccMoveCursorGUI (Table *table, int new_phys_row, int new_phys_col) new_virt_col = table->locators[new_phys_row][new_phys_col]->virt_col; } - curs = table->current_cursor; - /* invalidate the cursor for now; we'll set it the the correct values below */ table->current_cursor_phys_row = -1; table->current_cursor_phys_col = -1; table->current_cursor_virt_row = -1; table->current_cursor_virt_col = -1; + curs = table->current_cursor; if (curs) curs->user_data = NULL; table->current_cursor = NULL; @@ -419,7 +372,7 @@ void xaccMoveCursorGUI (Table *table, int new_phys_row, int new_phys_col) if ((0 > new_virt_row) || (0 > new_virt_col)) { /* if the location is invalid, then we should take this * as a command to unmap the cursor gui. So do it .. */ - if (curs) { + if (do_move_gui && curs) { for (i=0; inumRows; i++) { for (j=0; jnumCols; j++) { BasicCell *cell; @@ -463,21 +416,34 @@ void xaccMoveCursorGUI (Table *table, int new_phys_row, int new_phys_col) for (j=0; jnumCols; j++) { BasicCell *cell; + /* change the cursor row to the active color */ + table->bg_colors[i+phys_row_origin][j+phys_col_origin] = curs->active_bg_color; + cell = curs->cells[i][j]; if (cell) { char * cell_val = table->entries[i+phys_row_origin][j+phys_col_origin]; - /* if a cell has a GUI, move that first, before setting - * the cell value. Otherwise, we'll end up putting the - * new values in the old cell locations, and that would - * lead to confusion of all sorts. */ - if (cell->move) { - (cell->move) (cell, i+phys_row_origin, j+phys_col_origin); + + if (do_move_gui) { + /* if a cell has a GUI, move that first, before setting + * the cell value. Otherwise, we'll end up putting the + * new values in the old cell locations, and that would + * lead to confusion of all sorts. */ + if (cell->move) { + (cell->move) (cell, i+phys_row_origin, j+phys_col_origin); + } } - /* OK, now set the cell value, after the move */ + /* OK, now copy the string value from the table at large + * into the cell handler. */ xaccSetBasicCellValue (cell, cell_val); cell->changed = 0; + /* umm, a right now, we'll let the active cursor color override the + * individual cell defaults, but for now this is an experiment. + * + * table->bg_colors[i+phys_row_origin][j+phys_col_origin] = cell->bg_color; + * table->fg_colors[i+phys_row_origin][j+phys_col_origin] = cell->fg_color; + */ } } } @@ -487,6 +453,19 @@ void xaccMoveCursorGUI (Table *table, int new_phys_row, int new_phys_col) /* ==================================================== */ +void xaccMoveCursor (Table *table, int new_phys_row, int new_phys_col) +{ + doMoveCursor (table, new_phys_row, new_phys_col, 0); +} + +/* same as above, but be sure to deal with GUI elements as well */ +void xaccMoveCursorGUI (Table *table, int new_phys_row, int new_phys_col) +{ + doMoveCursor (table, new_phys_row, new_phys_col, 1); +} + +/* ==================================================== */ + void xaccCommitCursor (Table *table) { int i,j; @@ -499,7 +478,7 @@ void xaccCommitCursor (Table *table) virt_row = table->current_cursor_virt_row; virt_col = table->current_cursor_virt_col; - /* cant commit if cursor is bad */ + /* can't commit if cursor is bad */ if ((0 > virt_row) || (0 > virt_col)) return; if (virt_row >= table->num_virt_rows) return; if (virt_col >= table->num_virt_cols) return; diff --git a/src/register/table-allgui.h b/src/register/table-allgui.h index ebc1486d5f..56b46a932f 100644 --- a/src/register/table-allgui.h +++ b/src/register/table-allgui.h @@ -109,7 +109,13 @@ struct _Table { int num_virt_rows; int num_virt_cols; - /* the current cursor row/col is the virt row/col */ + /* The position of the current cursor in "virtual" space + * is given by the virt_row and virt_col fields below. + * The fields termed "phys_row" and "phys_col" would + * be better termed phys row and column "origins", as the + * cursor extends down and to the right from the location + * given by the phys values. + */ CellBlock *current_cursor; int current_cursor_phys_row; int current_cursor_phys_col; @@ -128,8 +134,8 @@ struct _Table { /* background colors for each cell, format ARGB, * and foreground (text) colors, format ARGB, * of dimension num_phys_rows * num_phys_cols */ - int **bg_colors; - int **fg_colors; + uint **bg_colors; + uint **fg_colors; /* handler locators for each cell, * of dimension num_phys_rows * num_phys_cols */ diff --git a/src/register/table-motif.c b/src/register/table-motif.c index 6949fdc41f..8727c9ae99 100644 --- a/src/register/table-motif.c +++ b/src/register/table-motif.c @@ -41,6 +41,7 @@ static void enterCB (Widget mw, XtPointer cd, XtPointer cb); static void leaveCB (Widget mw, XtPointer cd, XtPointer cb); static void modifyCB (Widget mw, XtPointer cd, XtPointer cb); static void traverseCB (Widget mw, XtPointer cd, XtPointer cb); +static void doRefreshCursorGUI (Table * table, CellBlock *curs, int row, int col); /* The XrmQuarks are used to figure out the direction of * traversal from cell to cell */ @@ -80,10 +81,20 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb) /* if we are entering this cell, make sure that we've * moved the cursor, and that any subsidiary GUI elements * properly positioned. Do this *before* we examine the - * value of the "cuirrent cursor". + * value of the "current cursor". */ - if (XbaeEnterCellReason == cbs->reason) { + if (XbaeEnterCellReason == cbs->reason) + { + CellBlock *save_curs = table->current_cursor; + int save_phys_row = table->current_cursor_phys_row; + int save_phys_col = table->current_cursor_phys_col; + + /* VerifyCursor will do all sorts of gui-indeopendent machinations */ xaccVerifyCursorPosition (table, row, col); + + /* make sure the old and the new cursor rows get redrawn */ + xaccRefreshCursorGUI (table); + doRefreshCursorGUI (table, save_curs, save_phys_row, save_phys_col); } /* can't edit outside of the physical space */ @@ -469,49 +480,6 @@ traverseCB (Widget mw, XtPointer cd, XtPointer cb) /* ==================================================== */ -static void -SetupColorTable (Table *table) -{ - - Display * dpy; - Window win; - XWindowAttributes wattr; - Colormap cmap; - XColor * colors; - int i, ncolors; - - /* if already initialized, do nothing */ - if (0 != table->ncolors) return; - - /* get the number of colors in our colormap */ - dpy = XtDisplay (table->table_widget); - win = XtWindow (table->table_widget); - XGetWindowAttributes (dpy, win, &wattr); - ncolors = wattr.visual->map_entries; - cmap = wattr.colormap; - table->ncolors = ncolors; - - /* If the class is TrueColor, then there is no colormap. - * Punt for now. - */ - if (TrueColor == wattr.visual->class) return; - - /* if ncolors is greater than 16K, then we probably - * have a true-color display, and don't have a colormap. - * Punt. Hack Alert - */ - if (16384 < ncolors) return; - - /* get the color values */ - /* hack alert -- remember to free this memory somewhere. */ - colors = (XColor *) malloc ( ncolors * sizeof (XColor)); - table->colors = colors; - for (i=0; inum_phys_rows), + (table->num_phys_cols), + new_phys_rows, + new_phys_cols, + (table->bg_hues), + Pixel, + 1, + NOOP); + + XACC_RESIZE_ARRAY ((table->num_phys_rows), + (table->num_phys_cols), + new_phys_rows, + new_phys_cols, + (table->fg_hues), + Pixel, + 0, + NOOP); +} + +/* ==================================================== */ + +static void +SetupColorTable (Table *table) +{ + + Display * dpy; + Window win; + XWindowAttributes wattr; + Colormap cmap; + XColor * colors; + int i, ncolors; + + /* if already initialized, do nothing */ + if (0 != table->ncolors) return; + + /* get the number of colors in our colormap */ + dpy = XtDisplay (table->table_widget); + win = XtWindow (table->table_widget); + XGetWindowAttributes (dpy, win, &wattr); + ncolors = wattr.visual->map_entries; + cmap = wattr.colormap; + table->ncolors = ncolors; + + /* If the class is TrueColor, then there is no colormap. + * Punt for now. + */ + if (TrueColor == wattr.visual->class) return; + + /* if ncolors is greater than 16K, then we probably + * have a true-color display, and don't have a colormap. + * Punt. Hack Alert + */ + if (16384 < ncolors) return; + + /* get the color values */ + /* hack alert -- remember to free this memory somewhere. */ + colors = (XColor *) malloc ( ncolors * sizeof (XColor)); + table->colors = colors; + for (i=0; icolors; int ncolors = table->ncolors; @@ -658,50 +698,14 @@ GetColormapIndex (Table *table, int argb) /* ==================================================== */ -#define NOOP(x) /* do nothing */ - -void -xaccMotifResizeTable (Table * table, - int new_phys_rows, int new_phys_cols, - int new_virt_rows, int new_virt_cols) - -{ - XACC_RESIZE_ARRAY ((table->num_phys_rows), - (table->num_phys_cols), - new_phys_rows, - new_phys_cols, - (table->bg_hues), - Pixel, - 1, - NOOP); - - XACC_RESIZE_ARRAY ((table->num_phys_rows), - (table->num_phys_cols), - new_phys_rows, - new_phys_cols, - (table->fg_hues), - Pixel, - 0, - NOOP); -} - -/* ==================================================== */ - -void -xaccRefreshTableGUI (Table * table) +static void +RefreshColors (Table * table, int from_row, int to_row, int from_col, int to_col) { int iphys, jphys; - int bg_cache, fg_cache; + uint32 bg_cache, fg_cache; Pixel bg_cache_val, fg_cache_val; Pixel white, black; -{int i; -printf (" refresh numphysrows=%d numphyscols=%d \n", table->num_phys_rows,table->num_phys_cols); -for (i=0; inum_phys_rows; i++) { -printf ("cell %d color: 0x%x act:%s descr: %s \n", i, table->bg_colors[i][3], table->entries[i][2], -table->entries[i][3]); -}} - /* make sure that the color table is initialized. * it would be slightly more efficient if we called * this from a realize method, but we don't have one @@ -709,6 +713,8 @@ table->entries[i][3]); */ SetupColorTable (table); + /* hack alert -- try to store these values with the table, + * for cpu efficiency */ black = GetColormapIndex (table, 0x0); fg_cache = 0x0; fg_cache_val = black; @@ -717,9 +723,9 @@ table->entries[i][3]); bg_cache = 0xffffff; bg_cache_val = white; - for (iphys=0; iphysnum_phys_rows; iphys++) + for (iphys=from_row; iphysnum_phys_cols; jphys++) + for (jphys=from_col; jphysentries[i][3]); } } } +} + +/* ==================================================== */ + +void +xaccRefreshTableGUI (Table * table) +{ + +{int i; +printf (" refresh numphysrows=%d numphyscols=%d \n", table->num_phys_rows,table->num_phys_cols); +for (i=0; inum_phys_rows; i++) { +printf ("cell %d color: 0x%x act:%s descr: %s \n", i, table->bg_colors[i][3], table->entries[i][2], +table->entries[i][3]); +}} + + RefreshColors (table, 0, table->num_phys_rows, 0, table->num_phys_cols); XtVaSetValues (table->table_widget, XmNrows, table->num_phys_rows, XmNcolumns, table->num_phys_cols, @@ -758,4 +780,56 @@ table->entries[i][3]); } +/* ==================================================== */ + +static void +doRefreshCursorGUI (Table * table, CellBlock *curs, int from_row, int from_col) +{ + int to_row, to_col; + int i,j; + + /* if the current cursor is undefined, there is nothing to do. */ + if (!curs) return; + if ((0 > from_row) || (0 > from_col)) return; + + /* compute the physical bounds of the current cursor */ + to_row = from_row + curs->numRows; + to_col = from_col + curs->numCols; + + /* make sure the cached color values are correct */ + RefreshColors (table, from_row, to_row, from_col, to_col); + + /* disable update, so as to avoid unpleasent screen flashing */ + /* Uhh, actually, this doesn't work, as expected ... is Xbae busted? + * XbaeMatrixDisableRedisplay (table->table_widget); + */ + + /* cycle through, cell by cell, copying our values to the widget */ + for (i=from_row; itable_widget, i,j, table->entries[i][j]); + XbaeMatrixSetCellBackground (table->table_widget, i,j, table->bg_hues[i][j]); + XbaeMatrixSetCellColor (table->table_widget, i,j, table->fg_hues[i][j]); + } + } + + /* OK, update the window */ + /* Uhh, actually, this doesn't work, as expected ... + * If False is used, then not everything gets updated properly, + * If True is used, then the whole window flashes. + * So in fact things work best in this enable/disable is left alone. + * XbaeMatrixEnableRedisplay (table->table_widget, True); + */ +} + +/* ==================================================== */ + +void +xaccRefreshCursorGUI (Table * table) +{ + doRefreshCursorGUI (table, table->current_cursor, + table->current_cursor_phys_row, + table->current_cursor_phys_col); +} + /* ================== end of file ======================= */ diff --git a/src/register/table-motif.h b/src/register/table-motif.h index 9be20d5590..d9717dec8b 100644 --- a/src/register/table-motif.h +++ b/src/register/table-motif.h @@ -84,8 +84,20 @@ void xaccMotifResizeTable (Table * table, int new_phys_rows, int new_phys_cols, int new_virt_rows, int new_virt_cols); -/* redraw the table GUI */ +/* The xaccRefreshTableGUI() routine causes the entire table + * GUI to be redrawn with the values currently stored in the table. + * Because this redraws the entire table, the entire window will + * flash colors. Consider using the RefreshCursorGUI routine below + * to minimize flashing. + */ void xaccRefreshTableGUI (Table *); +/* The xaccRefreshCursorGUI() routine is like the xaccRefreshTableGUI() + * call, except that only the rows that are part of the current cursor are + * redrawn. Thus, the use of this routine should result in significantly + * less screen color flashing than the use of the full-table refresh routine. + */ +void xaccRefreshCursorGUI (Table *); + #endif __XACC_TABLE_MOTIF_H__ /* ================== end of file ======================= */