40 static void gnc_cellblock_init (
CellBlock *cellblock,
int rows,
int cols);
48 g_return_val_if_fail (rows > 0, NULL);
49 g_return_val_if_fail (cols > 0, NULL);
50 g_return_val_if_fail (cursor_name != NULL, NULL);
54 gnc_cellblock_init (cellblock, rows, cols);
56 cellblock->cursor_name = g_strdup (cursor_name);
62 gnc_cellblock_init (
CellBlock *cellblock,
int rows,
int cols)
65 cellblock->num_rows = rows;
66 cellblock->num_cols = cols;
68 cellblock->start_col = cols;
69 cellblock->stop_col = -1;
72 cellblock->cells = g_ptr_array_new ();
74 g_ptr_array_set_size (cellblock->cells, rows * cols);
80 if (!cellblock)
return;
82 g_ptr_array_free (cellblock->cells, TRUE);
83 cellblock->cells = NULL;
85 g_free (cellblock->cursor_name);
86 cellblock->cursor_name = NULL;
96 if (cellblock == NULL)
99 if (row < 0 || row >= cellblock->num_rows)
102 if (col < 0 || col >= cellblock->num_cols)
105 cellblock->cells->pdata[(row * cellblock->num_cols) + col] = cell;
111 if (cellblock == NULL)
114 if (row < 0 || row >= cellblock->num_rows)
117 if (col < 0 || col >= cellblock->num_cols)
120 return cellblock->cells->pdata[(row * cellblock->num_cols) + col];
125 const char *cell_name,
128 int r, c, num_rows, num_cols;
130 if (cellblock == NULL)
133 if (cell_name == NULL)
136 num_rows = cellblock->num_rows;
137 num_cols = cellblock->num_cols;
138 for (r = 0; r < num_rows; r++)
139 for (c = 0; c < num_cols; c++)
141 BasicCell *cell = cellblock->cells->pdata[(r * num_cols) + c];
143 if (gnc_cell_name_equal(cell->cell_name, cell_name))
165 for (r = 0; r < cursor->num_rows; r++)
166 for (c = 0; c < cursor->num_cols; c++)
174 if (gnc_basic_cell_get_changed (cell))
180 if (include_conditional &&
181 gnc_basic_cell_get_conditionally_changed (cell))
196 for (r = 0; r < cursor->num_rows; r++)
197 for (c = 0; c < cursor->num_cols; c++)
205 gnc_basic_cell_set_changed (cell, FALSE);
206 gnc_basic_cell_set_conditionally_changed (cell, FALSE);
void gnc_cellblock_clear_changes(CellBlock *cursor)
Sets all cells in the cellblock to not changed.
void gnc_cellblock_destroy(CellBlock *cellblock)
Delete a CellBlock and its Cells.
Declarations for the CellBlock object.
CellBlock * gnc_cellblock_new(int rows, int cols, const char *cursor_name)
Create a new CellBlock on the heap.
void gnc_cellblock_set_cell(CellBlock *cellblock, int row, int col, BasicCell *cell)
Add a cell to the CellBlock at the specified coordinates.
int gnc_cellblock_changed(CellBlock *cursor, gboolean include_conditional)
Return number of changed cells.
BasicCell * gnc_cellblock_get_cell_by_name(CellBlock *cellblock, const char *cell_name, int *row, int *col)
Searches by name for a particular cell in a CellBlock.
BasicCell * gnc_cellblock_get_cell(CellBlock *cellblock, int row, int col)
Retrieve the Cell at the specified coordinates.