-gboolean
-g_sheet_row_get_visibility (const GSheetRow *row_geo,
- glong row)
-{
- g_return_val_if_fail (G_IS_SHEET_ROW (row_geo), FALSE);
-
- g_assert (G_SHEET_ROW_GET_IFACE (row_geo)->get_visibility);
-
- return (G_SHEET_ROW_GET_IFACE (row_geo)->get_visibility) (row_geo,
- row);
-
-}
-
gboolean
g_sheet_row_get_sensitivity (const GSheetRow *row_geo,
glong row)
return (G_SHEET_ROW_GET_IFACE (row_geo)->get_sensitivity) (row_geo,
row);
-
}
* @sheet: pointer to the sheet
*
* Returns the top y pixel for ROW.
+ * ROW may point to the row BELOW the last row, in which case it should
+ * return the position where it would start if it existed.
* Instances may override this method in order to achieve time and/or memory
* optmisation.
*
g_return_val_if_fail (G_IS_SHEET_ROW (geo), -1);
g_return_val_if_fail (row >= 0, -1);
- g_return_val_if_fail (row < g_sheet_row_get_row_count (geo), -1);
+ g_return_val_if_fail (row <= g_sheet_row_get_row_count (geo), -1);
if ( G_SHEET_ROW_GET_IFACE (geo)->top_ypixel)
return (G_SHEET_ROW_GET_IFACE (geo)->top_ypixel)(geo, row);
- for ( i = 0 ; i < row ; ++i )
+ for (i = 0; i < row; ++i)
{
- if ( g_sheet_row_get_visibility (geo, i))
- start_pixel += g_sheet_row_get_height (geo, i);
+ start_pixel += g_sheet_row_get_height (geo, i);
}
return start_pixel;
for (i = 0; i < g_sheet_row_get_row_count (geo); ++i )
{
if (pixel >= cy &&
- pixel <= (cy + g_sheet_row_get_height (geo, i)) &&
- g_sheet_row_get_visibility (geo, i))
+ pixel <= (cy + g_sheet_row_get_height (geo, i)))
return i;
- if (g_sheet_row_get_visibility (geo, i))
- cy += g_sheet_row_get_height (geo, i);
+ cy += g_sheet_row_get_height (geo, i);
}
/* no match */
i < g_sheet_column_get_column_count (sheet->column_geometry); i++)
{
if (x >= cx &&
- x <= (cx + g_sheet_column_get_width (sheet->column_geometry, i)) &&
- g_sheet_column_get_visibility (sheet->column_geometry, i))
+ x <= (cx + g_sheet_column_get_width (sheet->column_geometry, i)))
return i;
- if ( g_sheet_column_get_visibility (sheet->column_geometry, i))
- cx += g_sheet_column_get_width (sheet->column_geometry, i);
+
+ cx += g_sheet_column_get_width (sheet->column_geometry, i);
}
/* no match */
ydrag = g_sheet_row_start_pixel (sheet->row_geometry, row) + CELL_SPACING;
if (y <= ydrag + DRAG_WIDTH / 2 && row != 0)
{
- while (!g_sheet_row_get_visibility (sheet->row_geometry, row - 1) && row > 0) row--;
*drag_row = row - 1;
return g_sheet_row_get_sensitivity (sheet->row_geometry, row - 1);
}
{
while (min_row >= 0 && min_row > min_visible_row (sheet))
{
- if (g_sheet_row_get_visibility (sheet->row_geometry, min_row))
- adjust += g_sheet_row_get_height (sheet->row_geometry, min_row);
+ adjust += g_sheet_row_get_height (sheet->row_geometry, min_row);
if (adjust >= height)
{
{
while (min_col >= 0 && min_col > min_visible_column (sheet))
{
- if (g_sheet_column_get_visibility (sheet->column_geometry, min_col))
- adjust += g_sheet_column_get_width (sheet->column_geometry, min_col);
+ adjust += g_sheet_column_get_width (sheet->column_geometry, min_col);
if (adjust >= width)
{
col >= g_sheet_column_get_column_count (sheet->column_geometry))
return;
- if (! g_sheet_column_get_visibility (sheet->column_geometry, col))
- return;
-
- if (! g_sheet_row_get_visibility (sheet->row_geometry, row))
- return;
-
gtk_sheet_get_attributes (sheet, row, col, &attributes);
/* select GC for background rectangle */
if (row < 0 || row >= g_sheet_row_get_row_count (sheet->row_geometry)) return;
if (col < 0 || col >= g_sheet_column_get_column_count (sheet->column_geometry)) return;
- if (! g_sheet_column_get_visibility (sheet->column_geometry, col)) return;
- if (!g_sheet_row_get_visibility (sheet->row_geometry, row)) return;
widget = GTK_WIDGET (sheet);
{
for (j = range.col0; j <= range.coli; j++)
{
-
- if (gtk_sheet_cell_get_state (sheet, i, j) == GTK_STATE_SELECTED &&
- g_sheet_column_get_visibility (sheet->column_geometry, j) && g_sheet_row_get_visibility (sheet->row_geometry, i))
+ if (gtk_sheet_cell_get_state (sheet, i, j) == GTK_STATE_SELECTED)
{
area.x = g_sheet_column_start_pixel (sheet->column_geometry, j);
if ( sheet->row_titles_visible)
j <= new_range.coli && j >= new_range.col0) ? TRUE : FALSE;
if (state == GTK_STATE_SELECTED && selected &&
- g_sheet_column_get_visibility (sheet->column_geometry, j) && g_sheet_row_get_visibility (sheet->row_geometry, i) &&
(i == sheet->range.row0 || i == sheet->range.rowi ||
j == sheet->range.col0 || j == sheet->range.coli ||
i == new_range.row0 || i == new_range.rowi ||
selected= (i <= new_range.rowi && i >= new_range.row0 &&
j <= new_range.coli && j >= new_range.col0) ? TRUE : FALSE;
- if (state == GTK_STATE_SELECTED && !selected &&
- g_sheet_column_get_visibility (sheet->column_geometry, j) && g_sheet_row_get_visibility (sheet->row_geometry, i))
+ if (state == GTK_STATE_SELECTED && !selected)
{
x = g_sheet_column_start_pixel (sheet->column_geometry, j);
j <= new_range.coli && j >= new_range.col0) ? TRUE : FALSE;
if (state != GTK_STATE_SELECTED && selected &&
- g_sheet_column_get_visibility (sheet->column_geometry, j) && g_sheet_row_get_visibility (sheet->row_geometry, i) &&
(i != sheet->active_cell.row || j != sheet->active_cell.col))
{
{
for (j = aux_range.col0; j <= aux_range.coli; j++)
{
+ state = gtk_sheet_cell_get_state (sheet, i, j);
- if (g_sheet_column_get_visibility (sheet->column_geometry, j) && g_sheet_row_get_visibility (sheet->row_geometry, i))
- {
-
- state = gtk_sheet_cell_get_state (sheet, i, j);
+ mask1 = i == sheet->range.row0 ? 1 : 0;
+ mask1 = i == sheet->range.rowi ? mask1 + 2 : mask1;
+ mask1 = j == sheet->range.col0 ? mask1 + 4 : mask1;
+ mask1 = j == sheet->range.coli ? mask1 + 8 : mask1;
- mask1 = i == sheet->range.row0 ? 1 : 0;
- mask1 = i == sheet->range.rowi ? mask1 + 2 : mask1;
- mask1 = j == sheet->range.col0 ? mask1 + 4 : mask1;
- mask1 = j == sheet->range.coli ? mask1 + 8 : mask1;
-
- mask2 = i == new_range.row0 ? 1 : 0;
- mask2 = i == new_range.rowi ? mask2 + 2 : mask2;
- mask2 = j == new_range.col0 ? mask2 + 4 : mask2;
- mask2 = j == new_range.coli ? mask2 + 8 : mask2;
- if (mask2 != mask1 || (mask2 == mask1 && state != GTK_STATE_SELECTED))
- {
- x = g_sheet_column_start_pixel (sheet->column_geometry, j);
- y = g_sheet_row_start_pixel (sheet->row_geometry, i);
- width = g_sheet_column_get_width (sheet->column_geometry, j);
- height = g_sheet_row_get_height (sheet->row_geometry, i);
- if (mask2 & 1)
- gdk_draw_rectangle (sheet->sheet_window,
- sheet->xor_gc,
- TRUE,
- x + 1, y - 1,
- width, 3);
-
-
- if (mask2 & 2)
- gdk_draw_rectangle (sheet->sheet_window,
- sheet->xor_gc,
- TRUE,
- x + 1, y + height - 1,
- width, 3);
-
- if (mask2 & 4)
- gdk_draw_rectangle (sheet->sheet_window,
- sheet->xor_gc,
- TRUE,
- x - 1, y + 1,
- 3, height);
-
-
- if (mask2 & 8)
- gdk_draw_rectangle (sheet->sheet_window,
- sheet->xor_gc,
- TRUE,
- x + width - 1, y + 1,
- 3, height);
- }
+ mask2 = i == new_range.row0 ? 1 : 0;
+ mask2 = i == new_range.rowi ? mask2 + 2 : mask2;
+ mask2 = j == new_range.col0 ? mask2 + 4 : mask2;
+ mask2 = j == new_range.coli ? mask2 + 8 : mask2;
+ if (mask2 != mask1 || (mask2 == mask1 && state != GTK_STATE_SELECTED))
+ {
+ x = g_sheet_column_start_pixel (sheet->column_geometry, j);
+ y = g_sheet_row_start_pixel (sheet->row_geometry, i);
+ width = g_sheet_column_get_width (sheet->column_geometry, j);
+ height = g_sheet_row_get_height (sheet->row_geometry, i);
+ if (mask2 & 1)
+ gdk_draw_rectangle (sheet->sheet_window,
+ sheet->xor_gc,
+ TRUE,
+ x + 1, y - 1,
+ width, 3);
+
+
+ if (mask2 & 2)
+ gdk_draw_rectangle (sheet->sheet_window,
+ sheet->xor_gc,
+ TRUE,
+ x + 1, y + height - 1,
+ width, 3);
+
+ if (mask2 & 4)
+ gdk_draw_rectangle (sheet->sheet_window,
+ sheet->xor_gc,
+ TRUE,
+ x - 1, y + 1,
+ 3, height);
+
+
+ if (mask2 & 8)
+ gdk_draw_rectangle (sheet->sheet_window,
+ sheet->xor_gc,
+ TRUE,
+ x + width - 1, y + 1,
+ 3, height);
}
}
}
return FALSE;
}
- if (column >= 0 && row >= 0)
- {
- if (! g_sheet_column_get_visibility (sheet->column_geometry, column)
- || !g_sheet_row_get_visibility (sheet->row_geometry, row))
- {
- return FALSE;
- }
- }
-
g_signal_emit (sheet, sheet_signals[TRAVERSE], 0,
sheet->active_cell.row, sheet->active_cell.col,
&row, &column, &forbid_move);
if (!GTK_WIDGET_REALIZED (GTK_WIDGET (sheet))) return;
if (!sheet->column_titles_visible) return;
- if (!g_sheet_column_get_visibility (sheet->column_geometry, column)) return;
if (column < min_visible_column (sheet)) return;
if (column > max_visible_column (sheet)) return;
if (!GTK_WIDGET_REALIZED (GTK_WIDGET (sheet))) return;
if (!sheet->row_titles_visible) return;
- if (!g_sheet_row_get_visibility (sheet->row_geometry, row)) return;
if (row < min_visible_row (sheet)) return;
if (row > max_visible_row (sheet)) return;