return cx;
}
-#define MIN_VISIBLE_ROW(sheet) sheet->view.row0
-#define MAX_VISIBLE_ROW(sheet) sheet->view.rowi
-#define MIN_VISIBLE_COLUMN(sheet) sheet->view.col0
-#define MAX_VISIBLE_COLUMN(sheet) sheet->view.coli
+#define MIN_VISIBLE_ROW(sheet) \
+ ROW_FROM_YPIXEL (sheet, sheet->column_title_area.height + 1)
+
+#define MAX_VISIBLE_ROW(sheet) \
+ ROW_FROM_YPIXEL (sheet, sheet->sheet_window_height - 1)
+
+#define MIN_VISIBLE_COLUMN(sheet) \
+ COLUMN_FROM_XPIXEL (sheet, sheet->row_title_area.width + 1)
+
+#define MAX_VISIBLE_COLUMN(sheet) \
+ COLUMN_FROM_XPIXEL (sheet, sheet->sheet_window_width)
+
static inline gboolean
yyy_row_height (sheet, sheet->range.rowi);
if (sheet->state == GTK_SHEET_COLUMN_SELECTED)
- ydrag = ROW_TOP_YPIXEL (sheet, sheet->view.row0);
+ ydrag = ROW_TOP_YPIXEL (sheet, MIN_VISIBLE_ROW (sheet));
if (sheet->state == GTK_SHEET_ROW_SELECTED)
- xdrag = COLUMN_LEFT_XPIXEL (sheet, sheet->view.col0);
+ xdrag = COLUMN_LEFT_XPIXEL (sheet, MIN_VISIBLE_COLUMN (sheet));
*drag_column = COLUMN_FROM_XPIXEL (sheet,x);
*drag_row = ROW_FROM_YPIXEL (sheet,y);
/* Scrollbars */
static void adjust_scrollbars (GtkSheet * sheet);
-static void vadjustment_changed (GtkAdjustment * adjustment,
- gpointer data);
-static void hadjustment_changed (GtkAdjustment * adjustment,
- gpointer data);
static void vadjustment_value_changed (GtkAdjustment * adjustment,
gpointer data);
static void hadjustment_value_changed (GtkAdjustment * adjustment,
GTK_WIDGET_UNSET_FLAGS (sheet, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (sheet, GTK_CAN_FOCUS);
- sheet->view.row0 = 0;
- sheet->view.col0 = 0;
- sheet->view.rowi = 0;
- sheet->view.coli = 0;
-
sheet->column_title_window = NULL;
sheet->column_title_area.x = 0;
sheet->column_title_area.y = 0;
range.coli = xxx_column_count (sheet) - 1;
range.rowi = yyy_row_count (sheet) - 1;
- sheet->view.col0 =
- COLUMN_FROM_XPIXEL (sheet, sheet->row_title_area.width + 1);
-
- sheet->view.coli =
- COLUMN_FROM_XPIXEL (sheet, sheet->sheet_window_width);
-
- if ( sheet->view.coli > range.coli)
- sheet->view.coli = range.coli;
-
adjust_scrollbars (sheet);
if (sheet->active_cell.col >= model_columns)
range.rowi = yyy_row_count (sheet) - 1;
range.coli = xxx_column_count (sheet) - 1;
- sheet->view.row0 =
- ROW_FROM_YPIXEL (sheet, sheet->column_title_area.height + 1);
- sheet->view.rowi =
- ROW_FROM_YPIXEL (sheet, sheet->sheet_window_height - 1);
-
- if ( sheet->view.rowi > range.rowi)
- sheet->view.rowi = range.rowi;
-
adjust_scrollbars (sheet);
if (sheet->active_cell.row >= model_rows)
if ( ( row0 < 0 && col0 < 0 ) || ( rowi < 0 && coli < 0 ) )
{
+ gint i;
gtk_sheet_range_draw (sheet, NULL);
+ adjust_scrollbars (sheet);
+
+ for (i = MIN_VISIBLE_ROW (sheet); i <= MAX_VISIBLE_ROW (sheet); i++)
+ gtk_sheet_row_title_button_draw (sheet, i);
+
+ for (i = MIN_VISIBLE_COLUMN (sheet);
+ i <= MAX_VISIBLE_COLUMN (sheet); i++)
+ gtk_sheet_column_title_button_draw (sheet, i);
+
return;
}
else if ( row0 < 0 || rowi < 0 )
if (width < COLUMN_MIN_WIDTH) return;
sheet->row_title_area.width = width;
- sheet->view.col0 = COLUMN_FROM_XPIXEL (sheet, sheet->row_title_area.width + 1);
- sheet->view.coli = COLUMN_FROM_XPIXEL (sheet, sheet->sheet_window_width);
-
adjust_scrollbars (sheet);
if (height < DEFAULT_ROW_HEIGHT (GTK_WIDGET (sheet))) return;
sheet->column_title_area.height = height;
- sheet->view.row0 = ROW_FROM_YPIXEL (sheet,
- sheet->column_title_area.height + 1);
- sheet->view.rowi = ROW_FROM_YPIXEL (sheet, sheet->sheet_window_height - 1);
adjust_scrollbars (sheet);
gtk_object_ref (GTK_OBJECT (sheet->vadjustment));
gtk_object_sink (GTK_OBJECT (sheet->vadjustment));
- gtk_signal_connect (GTK_OBJECT (sheet->vadjustment), "changed",
- (GtkSignalFunc) vadjustment_changed,
- (gpointer) sheet);
gtk_signal_connect (GTK_OBJECT (sheet->vadjustment), "value_changed",
(GtkSignalFunc) vadjustment_value_changed,
(gpointer) sheet);
gtk_object_ref (GTK_OBJECT (sheet->hadjustment));
gtk_object_sink (GTK_OBJECT (sheet->hadjustment));
- gtk_signal_connect (GTK_OBJECT (sheet->hadjustment), "changed",
- (GtkSignalFunc) hadjustment_changed,
- (gpointer) sheet);
gtk_signal_connect (GTK_OBJECT (sheet->hadjustment), "value_changed",
(GtkSignalFunc) hadjustment_value_changed,
(gpointer) sheet);
{
drawing_range.row0 = MIN_VISIBLE_ROW (sheet);
drawing_range.col0 = MIN_VISIBLE_COLUMN (sheet);
- drawing_range.rowi = MIN (MAX_VISIBLE_ROW (sheet), yyy_row_count (sheet) - 1);
+ drawing_range.rowi = MIN (MAX_VISIBLE_ROW (sheet),
+ yyy_row_count (sheet) - 1);
drawing_range.coli = MAX_VISIBLE_COLUMN (sheet);
drawing_range.coli = MIN (range->coli, MAX_VISIBLE_COLUMN (sheet));
}
-
if (drawing_range.coli == xxx_column_count (sheet) - 1)
{
area.x = COLUMN_LEFT_XPIXEL (sheet,
}
if (j == sheet->range.coli) area.width = area.width - 3;
- if (i!=sheet->active_cell.row || j!=sheet->active_cell.col)
+ if (i != sheet->active_cell.row || j != sheet->active_cell.col)
{
gdk_draw_rectangle (sheet->sheet_window,
sheet->xor_gc,
range.row0 = row;
range.rowi = row;
- range.col0 = sheet->view.col0;
- range.coli = sheet->view.coli;
+ range.col0 = MIN_VISIBLE_COLUMN (sheet);
+ range.coli = MAX_VISIBLE_COLUMN (sheet);
if (gtk_sheet_autoresize (sheet) &&
text_width > xxx_column_width (sheet, col) -
range.row0 = row;
range.rowi = row;
- range.col0 = sheet->view.col0;
- range.coli = sheet->view.coli;
+ range.col0 = MIN_VISIBLE_COLUMN (sheet);
+ range.coli = MAX_VISIBLE_COLUMN (sheet);
gtk_sheet_real_cell_clear (sheet, row, column, FALSE);
range.row0 = row;
range.rowi = row;
- range.col0 = sheet->view.col0;
- range.coli = sheet->view.coli;
+ range.col0 = MIN_VISIBLE_COLUMN (sheet);
+ range.coli = MAX_VISIBLE_COLUMN (sheet);
gtk_sheet_real_cell_clear (sheet, row, column, TRUE);
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 &&
+ if (state != GTK_STATE_SELECTED && selected &&
xxx_column_is_visible (sheet, j) && yyy_row_is_visible (sheet, i) &&
(i != sheet->active_cell.row || j != sheet->active_cell.col))
{
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))
+ if (mask2 != mask1 || (mask2 == mask1 && state != GTK_STATE_SELECTED))
{
x = COLUMN_LEFT_XPIXEL (sheet,j);
y = ROW_TOP_YPIXEL (sheet, i);
width = 1;
if (sheet->state == GTK_SHEET_COLUMN_SELECTED)
{
- y = ROW_TOP_YPIXEL (sheet, sheet->view.row0)+3;
+ y = ROW_TOP_YPIXEL (sheet, MIN_VISIBLE_ROW (sheet))+3;
width = 3;
}
gdk_draw_pixmap (sheet->sheet_window,
width = 1;
if (sheet->state == GTK_SHEET_ROW_SELECTED)
{
- x = COLUMN_LEFT_XPIXEL (sheet, sheet->view.col0)+3;
+ x = COLUMN_LEFT_XPIXEL (sheet, MIN_VISIBLE_COLUMN (sheet))+3;
width = 3;
}
gdk_draw_pixmap (sheet->sheet_window,
height = sheet->sheet_window_height;
width = sheet->sheet_window_width;
- if (row >= MAX_VISIBLE_ROW (sheet) && sheet->state!=GTK_SHEET_COLUMN_SELECTED)
+ if (row >= MAX_VISIBLE_ROW (sheet) && sheet->state != GTK_SHEET_COLUMN_SELECTED)
{
row_align = 1.;
new_row = MIN (yyy_row_count (sheet), row + 1);
row_align = -1.;
}
}
- if (row < MIN_VISIBLE_ROW (sheet) && sheet->state!=GTK_SHEET_COLUMN_SELECTED)
+ if (row < MIN_VISIBLE_ROW (sheet) && sheet->state != GTK_SHEET_COLUMN_SELECTED)
{
row_align= 0.;
row_move = TRUE;
}
- if (column >= MAX_VISIBLE_COLUMN (sheet) && sheet->state!=GTK_SHEET_ROW_SELECTED)
+ if (column >= MAX_VISIBLE_COLUMN (sheet) && sheet->state != GTK_SHEET_ROW_SELECTED)
{
col_align = 1.;
new_col = MIN (xxx_column_count (sheet) - 1, column + 1);
col_align = -1.;
}
}
- if (column < MIN_VISIBLE_COLUMN (sheet) && sheet->state!=GTK_SHEET_ROW_SELECTED)
+ if (column < MIN_VISIBLE_COLUMN (sheet) && sheet->state != GTK_SHEET_ROW_SELECTED)
{
col_align = 0.;
column_move = TRUE;
if (sheet->row_titles_visible)
requisition->width += sheet->row_title_area.width;
- sheet->view.row0 = ROW_FROM_YPIXEL (sheet, sheet->column_title_area.height + 1);
- sheet->view.rowi = ROW_FROM_YPIXEL (sheet, sheet->sheet_window_height - 1);
- sheet->view.col0 = COLUMN_FROM_XPIXEL (sheet, sheet->row_title_area.width + 1);
- sheet->view.coli = COLUMN_FROM_XPIXEL (sheet, sheet->sheet_window_width);
-
- if (!sheet->column_titles_visible)
- sheet->view.row0 = ROW_FROM_YPIXEL (sheet, 1);
-
- if (!sheet->row_titles_visible)
- sheet->view.col0 = COLUMN_FROM_XPIXEL (sheet, 1);
-
children = sheet->children;
while (children)
{
/* row button allocation */
size_allocate_row_title_buttons (sheet);
-
- sheet->view.row0 = ROW_FROM_YPIXEL (sheet, sheet->column_title_area.height + 1);
- sheet->view.rowi = ROW_FROM_YPIXEL (sheet, sheet->sheet_window_height - 1);
- sheet->view.col0 = COLUMN_FROM_XPIXEL (sheet, sheet->row_title_area.width + 1);
- sheet->view.coli = COLUMN_FROM_XPIXEL (sheet, sheet->sheet_window_width);
-
- if (!sheet->column_titles_visible)
- sheet->view.row0 = ROW_FROM_YPIXEL (sheet, 1);
-
- if (!sheet->row_titles_visible)
- sheet->view.col0 = COLUMN_FROM_XPIXEL (sheet, 1);
-
size_allocate_column_title_buttons (sheet);
- size_allocate_row_title_buttons (sheet);
/* re - scale backing pixmap */
gtk_sheet_make_backing_pixmap (sheet, 0, 0);
*
* functions:
* adjust_scrollbars
- * vadjustment_changed
- * hadjustment_changed
* vadjustment_value_changed
* hadjustment_value_changed */
static void
adjust_scrollbars (GtkSheet * sheet)
{
-
if (sheet->vadjustment)
{
sheet->vadjustment->page_size = sheet->sheet_window_height;
}
}
-
-static void
-vadjustment_changed (GtkAdjustment * adjustment,
- gpointer data)
-{
- GtkSheet *sheet;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
-
- sheet = GTK_SHEET (data);
-
-}
-
-static void
-hadjustment_changed (GtkAdjustment * adjustment,
- gpointer data)
-{
- GtkSheet *sheet;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
-
- sheet = GTK_SHEET (data);
-}
-
-
static void
vadjustment_value_changed (GtkAdjustment * adjustment,
gpointer data)
sheet->voffset = - value;
- sheet->view.row0 = ROW_FROM_YPIXEL (sheet, sheet->column_title_area.height + 1);
- sheet->view.rowi = ROW_FROM_YPIXEL (sheet, sheet->sheet_window_height - 1);
- if (!sheet->column_titles_visible)
- sheet->view.row0 = ROW_FROM_YPIXEL (sheet, 1);
-
if (GTK_WIDGET_REALIZED (sheet->sheet_entry) &&
sheet->state == GTK_SHEET_NORMAL &&
sheet->active_cell.row >= 0 && sheet->active_cell.col >= 0 &&
}
sheet->hoffset = - value;
-
- sheet->view.col0 = COLUMN_FROM_XPIXEL (sheet, sheet->row_title_area.width + 1);
- sheet->view.coli = COLUMN_FROM_XPIXEL (sheet, sheet->sheet_window_width);
- if (!sheet->row_titles_visible)
- sheet->view.col0 = COLUMN_FROM_XPIXEL (sheet, 1);
-
if (GTK_WIDGET_REALIZED (sheet->sheet_entry) &&
sheet->state == GTK_SHEET_NORMAL &&
sheet->active_cell.row >= 0 && sheet->active_cell.col >= 0 &&
width = min_width;
xxx_set_column_width (sheet, column, width);
- sheet->view.coli = COLUMN_FROM_XPIXEL (sheet, sheet->sheet_window_width);
size_allocate_column_title_buttons (sheet);
return width;
height = min_height;
yyy_set_row_height (sheet, row, height);
- sheet->view.rowi = ROW_FROM_YPIXEL (sheet, sheet->sheet_window_height - 1);
size_allocate_row_title_buttons (sheet);
return height;
return;
}
- gtk_sheet_attach (sheet, widget, row, col, GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
+ gtk_sheet_attach (sheet, widget, row, col,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
}
void