Commit 83801a54 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Arturo Espinosa

Use gnome_canvas_scroll_to().

1998-07-30  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* src/sheet.c (sheet_set_zoom_factor): Use gnome_canvas_scroll_to().

	* src/gnumeric-sheet.c (gnumeric_sheet_set_top_row): Scroll using
	gnome_canvas_scroll_to().
	(gnumeric_sheet_set_top_col): Likewise.
	(gnumeric_sheet_make_cell_visible): Get the offsets using
	gnome_canvas_get_scroll_offsets().
	(gnumeric_sheet_make_cell_visible): Use gnome_canvas_scroll_to().
parent ed5aa7d4
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (sheet_set_zoom_factor): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_row): Scroll using
gnome_canvas_scroll_to().
(gnumeric_sheet_set_top_col): Likewise.
(gnumeric_sheet_make_cell_visible): Get the offsets using
gnome_canvas_get_scroll_offsets().
(gnumeric_sheet_make_cell_visible): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_color_alloc): Query the
colormap with gtkdget_get_colormap(), because the canvas structure
no longer has a colormap field in it.
......
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (sheet_set_zoom_factor): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_row): Scroll using
gnome_canvas_scroll_to().
(gnumeric_sheet_set_top_col): Likewise.
(gnumeric_sheet_make_cell_visible): Get the offsets using
gnome_canvas_get_scroll_offsets().
(gnumeric_sheet_make_cell_visible): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_color_alloc): Query the
colormap with gtkdget_get_colormap(), because the canvas structure
no longer has a colormap field in it.
......
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (sheet_set_zoom_factor): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_row): Scroll using
gnome_canvas_scroll_to().
(gnumeric_sheet_set_top_col): Likewise.
(gnumeric_sheet_make_cell_visible): Get the offsets using
gnome_canvas_get_scroll_offsets().
(gnumeric_sheet_make_cell_visible): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_color_alloc): Query the
colormap with gtkdget_get_colormap(), because the canvas structure
no longer has a colormap field in it.
......
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (sheet_set_zoom_factor): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_row): Scroll using
gnome_canvas_scroll_to().
(gnumeric_sheet_set_top_col): Likewise.
(gnumeric_sheet_make_cell_visible): Get the offsets using
gnome_canvas_get_scroll_offsets().
(gnumeric_sheet_make_cell_visible): Use gnome_canvas_scroll_to().
* src/gnumeric-sheet.c (gnumeric_sheet_color_alloc): Query the
colormap with gtkdget_get_colormap(), because the canvas structure
no longer has a colormap field in it.
......
......@@ -660,11 +660,13 @@ gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
GnomeCanvas *rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
Sheet *sheet = gsheet->sheet;
int row_distance;
int x;
gsheet->top_row = new_top_row;
row_distance = sheet_row_get_distance (sheet, 0, gsheet->top_row);
rowc->layout.vadjustment->value = row_distance;
gtk_signal_emit_by_name (GTK_OBJECT (rowc->layout.vadjustment), "value_changed");
gnome_canvas_get_scroll_offsets (rowc, &x, NULL);
gnome_canvas_scroll_to (rowc, x, row_distance);
return row_distance;
}
......@@ -675,11 +677,13 @@ gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_top_col)
GnomeCanvas *colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
Sheet *sheet = gsheet->sheet;
int col_distance;
int y;
gsheet->top_col = new_top_col;
col_distance = sheet_col_get_distance (sheet, 0, gsheet->top_col);
colc->layout.hadjustment->value = col_distance;
gtk_signal_emit_by_name (GTK_OBJECT (colc->layout.hadjustment), "value_changed");
gnome_canvas_get_scroll_offsets (colc, NULL, &y);
gnome_canvas_scroll_to (colc, col_distance, y);
return col_distance;
}
......@@ -748,8 +752,8 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row)
new_top_row = gsheet->top_row;
/* Determine if scrolling is required */
col_distance = GTK_LAYOUT (gsheet)->hadjustment->value;
row_distance = GTK_LAYOUT (gsheet)->vadjustment->value;
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), &col_distance, &row_distance);
if (gsheet->top_col != new_top_col){
col_distance = gnumeric_sheet_set_top_col (gsheet, new_top_col);
......@@ -766,8 +770,7 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row)
gnumeric_sheet_compute_visible_ranges (gsheet);
canvas->layout.hadjustment->value = sheet_col_get_distance (sheet, 0, gsheet->top_col);
gtk_signal_emit_by_name (GTK_OBJECT (canvas->layout.hadjustment), "value_changed");
gnome_canvas_scroll_to (GNOME_CANVAS (gsheet), col_distance, row_distance);
}
static void
......
......@@ -660,11 +660,13 @@ gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
GnomeCanvas *rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
Sheet *sheet = gsheet->sheet;
int row_distance;
int x;
gsheet->top_row = new_top_row;
row_distance = sheet_row_get_distance (sheet, 0, gsheet->top_row);
rowc->layout.vadjustment->value = row_distance;
gtk_signal_emit_by_name (GTK_OBJECT (rowc->layout.vadjustment), "value_changed");
gnome_canvas_get_scroll_offsets (rowc, &x, NULL);
gnome_canvas_scroll_to (rowc, x, row_distance);
return row_distance;
}
......@@ -675,11 +677,13 @@ gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_top_col)
GnomeCanvas *colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
Sheet *sheet = gsheet->sheet;
int col_distance;
int y;
gsheet->top_col = new_top_col;
col_distance = sheet_col_get_distance (sheet, 0, gsheet->top_col);
colc->layout.hadjustment->value = col_distance;
gtk_signal_emit_by_name (GTK_OBJECT (colc->layout.hadjustment), "value_changed");
gnome_canvas_get_scroll_offsets (colc, NULL, &y);
gnome_canvas_scroll_to (colc, col_distance, y);
return col_distance;
}
......@@ -748,8 +752,8 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row)
new_top_row = gsheet->top_row;
/* Determine if scrolling is required */
col_distance = GTK_LAYOUT (gsheet)->hadjustment->value;
row_distance = GTK_LAYOUT (gsheet)->vadjustment->value;
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), &col_distance, &row_distance);
if (gsheet->top_col != new_top_col){
col_distance = gnumeric_sheet_set_top_col (gsheet, new_top_col);
......@@ -766,8 +770,7 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row)
gnumeric_sheet_compute_visible_ranges (gsheet);
canvas->layout.hadjustment->value = sheet_col_get_distance (sheet, 0, gsheet->top_col);
gtk_signal_emit_by_name (GTK_OBJECT (canvas->layout.hadjustment), "value_changed");
gnome_canvas_scroll_to (GNOME_CANVAS (gsheet), col_distance, row_distance);
}
static void
......
......@@ -451,16 +451,6 @@ sheet_reconfigure_zoom (Sheet *sheet)
g_warning ("Need to recompute string lenghts of cells\n");
}
static void
scroll_to (GnomeCanvas *canvas, double x, double y)
{
canvas->layout.hadjustment->value = x;
gtk_signal_emit_by_name (GTK_OBJECT (canvas->layout.hadjustment), "value_changed");
canvas->layout.vadjustment->value = y;
gtk_signal_emit_by_name (GTK_OBJECT (canvas->layout.vadjustment), "value_changed");
}
void
sheet_set_zoom_factor (Sheet *sheet, double factor)
{
......@@ -468,9 +458,9 @@ sheet_set_zoom_factor (Sheet *sheet, double factor)
gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (sheet->col_canvas), factor);
gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (sheet->row_canvas), factor);
sheet_reconfigure_zoom (sheet);
scroll_to (GNOME_CANVAS (sheet->sheet_view), 0, 0);
scroll_to (GNOME_CANVAS (sheet->col_canvas), 0, 0);
scroll_to (GNOME_CANVAS (sheet->row_canvas), 0, 0);
gnome_canvas_scroll_to (GNOME_CANVAS (sheet->sheet_view), 0, 0);
gnome_canvas_scroll_to (GNOME_CANVAS (sheet->col_canvas), 0, 0);
gnome_canvas_scroll_to (GNOME_CANVAS (sheet->row_canvas), 0, 0);
}
ColRowInfo *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment