Commit 03198e1d authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

- Fix a problem with zooming caused by the new item-bar enhancements. -


- Fix a problem with zooming caused by the new item-bar enhancements.
- Remove gnumeric-sheet.h from a number of places that it had no reason to be.
- Move all of the row/col pos/offset cache into GnumericSheet.  WARNING
  I do not populate all of it yet.

2000-01-26  Jody Goldberg <jgoldberg@home.com>

	* src/sheet-view.c (sheet_view_set_zoom_factor) : Keep the cursor in
	  the same place and recompute the alignments for everything.

	* src/item-cursor.c (item_cursor_set_bounds) : New function.

	* src/gnumeric-sheet.h : Add more orthogonal structure for caching
	  common row/col bounds and their canvas offsets.

	* src/gnumeric-sheet.c (gnumeric_sheet_create) : Init the new members.
	(gnumeric_sheet_filenames_dropped) : Keep the canvas private.
	(gnumeric_sheet_make_cell_visible) : Add 'force_scroll' argument.

	* src/clipboard.c (clipboard_release) : It is possible to have no
	  styles associated with a region.

	* src/item-grid.c : Remove overlapping cache of bounding rows/cols and
	  offsets.  Use the superset in GnumericSheet.
	 (item_grid_find_{row, col}) : Support sliding backwards.
parent e692b098
2000-01-26 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_set_zoom_factor) : Keep the cursor in
the same place and recompute the alignments for everything.
* src/item-cursor.c (item_cursor_set_bounds) : New function.
* src/gnumeric-sheet.h : Add more orthogonal structure for caching
common row/col bounds and their canvas offsets.
* src/gnumeric-sheet.c (gnumeric_sheet_create) : Init the new members.
(gnumeric_sheet_filenames_dropped) : Keep the canvas private.
(gnumeric_sheet_make_cell_visible) : Add 'force_scroll' argument.
* src/clipboard.c (clipboard_release) : It is possible to have no
styles associated with a region.
* src/item-grid.c : Remove overlapping cache of bounding rows/cols and
offsets. Use the superset in GnumericSheet.
(item_grid_find_{row, col}) : Support sliding backwards.
2000-01-26 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-01-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/solver-lp.c: Implemented the `>=' and `=' constraints. * src/solver-lp.c: Implemented the `>=' and `=' constraints.
......
...@@ -7,6 +7,9 @@ Jukka: ...@@ -7,6 +7,9 @@ Jukka:
* Minor improvements for the AutoSave tool. * Minor improvements for the AutoSave tool.
* GUI improvements for the Data Analysis tool. * GUI improvements for the Data Analysis tool.
Jody:
* Row/Col header redraw improvements.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Gnumeric 0.48 Gnumeric 0.48
...@@ -20,7 +23,6 @@ Jody: ...@@ -20,7 +23,6 @@ Jody:
* Row/Col hiding. * Row/Col hiding.
* Keep cursor visible, Add Alt-Pg{Up,down} * Keep cursor visible, Add Alt-Pg{Up,down}
* Clipboard, Selection, & border fixes. * Clipboard, Selection, & border fixes.
* Row/Col header redraw improvements.
Morten: Morten:
* Revamp the memory handling of the parser. * Revamp the memory handling of the parser.
......
2000-01-26 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_set_zoom_factor) : Keep the cursor in
the same place and recompute the alignments for everything.
* src/item-cursor.c (item_cursor_set_bounds) : New function.
* src/gnumeric-sheet.h : Add more orthogonal structure for caching
common row/col bounds and their canvas offsets.
* src/gnumeric-sheet.c (gnumeric_sheet_create) : Init the new members.
(gnumeric_sheet_filenames_dropped) : Keep the canvas private.
(gnumeric_sheet_make_cell_visible) : Add 'force_scroll' argument.
* src/clipboard.c (clipboard_release) : It is possible to have no
styles associated with a region.
* src/item-grid.c : Remove overlapping cache of bounding rows/cols and
offsets. Use the superset in GnumericSheet.
(item_grid_find_{row, col}) : Support sliding backwards.
2000-01-26 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-01-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/solver-lp.c: Implemented the `>=' and `=' constraints. * src/solver-lp.c: Implemented the `>=' and `=' constraints.
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "format.h" #include "format.h"
#include "color.h" #include "color.h"
#include "sheet-object.h" #include "sheet-object.h"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <gnome.h> #include <gnome.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "format.h" #include "format.h"
#include "color.h" #include "color.h"
#include "sheet-object.h" #include "sheet-object.h"
......
...@@ -24,7 +24,7 @@ dialog_about (Workbook *wb) ...@@ -24,7 +24,7 @@ dialog_about (Workbook *wb)
N_("Miguel de Icaza, main programmer."), N_("Miguel de Icaza, main programmer."),
N_("Sean Atkinson, Functions and X-Base importing."), N_("Sean Atkinson, Functions and X-Base importing."),
N_("Tom Dyas, Plugin support."), N_("Tom Dyas, Plugin support."),
N_("Jody Goldberg, Excel hacker."), N_("Jody Goldberg, Gnumeric hacker."),
N_("Ross Ihaka, special functions."), N_("Ross Ihaka, special functions."),
N_("Jukka-Pekka Iivonen, numerous functions and tools."), N_("Jukka-Pekka Iivonen, numerous functions and tools."),
N_("Jakub Jelinek, Gnumeric hacker."), N_("Jakub Jelinek, Gnumeric hacker."),
...@@ -56,7 +56,7 @@ dialog_about (Workbook *wb) ...@@ -56,7 +56,7 @@ dialog_about (Workbook *wb)
#endif #endif
about = gnome_about_new (_("Gnumeric"), VERSION, about = gnome_about_new (_("Gnumeric"), VERSION,
_("(C) 1998-1999 Miguel de Icaza"), _("(C) 1998-2000 Miguel de Icaza"),
authors, authors,
NULL, NULL,
NULL); NULL);
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include <locale.h> #include <locale.h>
#include <ctype.h> #include <ctype.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "eval.h" #include "eval.h"
#include "format.h" #include "format.h"
#include "color.h" #include "color.h"
...@@ -876,6 +876,7 @@ cell_comment_reposition (Cell *cell) ...@@ -876,6 +876,7 @@ cell_comment_reposition (Cell *cell)
g_return_if_fail (cell != NULL); g_return_if_fail (cell != NULL);
g_return_if_fail (cell->comment != NULL); g_return_if_fail (cell->comment != NULL);
/* FIXME : This should use the sheet_view list */
for (l = cell->comment->realized_list; l; l = l->next){ for (l = cell->comment->realized_list; l; l = l->next){
GnomeCanvasItem *o = l->data; GnomeCanvasItem *o = l->data;
SheetView *sheet_view = GNUMERIC_SHEET (o->canvas)->sheet_view; SheetView *sheet_view = GNUMERIC_SHEET (o->canvas)->sheet_view;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <config.h> #include <config.h>
#include <gnome.h> #include <gnome.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "eval.h" #include "eval.h"
#include "format.h" #include "format.h"
......
...@@ -624,8 +624,10 @@ clipboard_release (CellRegion *region) ...@@ -624,8 +624,10 @@ clipboard_release (CellRegion *region)
g_free (this_cell->u.text); g_free (this_cell->u.text);
g_free (this_cell); g_free (this_cell);
} }
sheet_style_list_destroy (region->styles); if (region->styles != NULL) {
region->styles = NULL; sheet_style_list_destroy (region->styles);
region->styles = NULL;
}
g_list_free (region->list); g_list_free (region->list);
region->list = NULL; region->list = NULL;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <config.h> #include <config.h>
#include <gnome.h> #include <gnome.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "utils.h" #include "utils.h"
#include "ranges.h" #include "ranges.h"
#include "eval.h" #include "eval.h"
......
...@@ -24,7 +24,7 @@ dialog_about (Workbook *wb) ...@@ -24,7 +24,7 @@ dialog_about (Workbook *wb)
N_("Miguel de Icaza, main programmer."), N_("Miguel de Icaza, main programmer."),
N_("Sean Atkinson, Functions and X-Base importing."), N_("Sean Atkinson, Functions and X-Base importing."),
N_("Tom Dyas, Plugin support."), N_("Tom Dyas, Plugin support."),
N_("Jody Goldberg, Excel hacker."), N_("Jody Goldberg, Gnumeric hacker."),
N_("Ross Ihaka, special functions."), N_("Ross Ihaka, special functions."),
N_("Jukka-Pekka Iivonen, numerous functions and tools."), N_("Jukka-Pekka Iivonen, numerous functions and tools."),
N_("Jakub Jelinek, Gnumeric hacker."), N_("Jakub Jelinek, Gnumeric hacker."),
...@@ -56,7 +56,7 @@ dialog_about (Workbook *wb) ...@@ -56,7 +56,7 @@ dialog_about (Workbook *wb)
#endif #endif
about = gnome_about_new (_("Gnumeric"), VERSION, about = gnome_about_new (_("Gnumeric"), VERSION,
_("(C) 1998-1999 Miguel de Icaza"), _("(C) 1998-2000 Miguel de Icaza"),
authors, authors,
NULL, NULL,
NULL); NULL);
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <ctype.h> #include <ctype.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#include "commands.h" #include "commands.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <glade/glade.h> #include <glade/glade.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "utils-dialog.h" #include "utils-dialog.h"
#include "widgets/widget-font-selector.h" #include "widgets/widget-font-selector.h"
#include "widgets/gnumeric-dashed-canvas-line.h" #include "widgets/gnumeric-dashed-canvas-line.h"
#include "gnumeric-sheet.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "selection.h" #include "selection.h"
#include "ranges.h" #include "ranges.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "gnumeric.h" #include "gnumeric.h"
#include "workbook-view.h" #include "workbook-view.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#include "cell.h" #include "cell.h"
#include "expr.h" #include "expr.h"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <glade/glade.h> #include <glade/glade.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#define LIST_KEY "name_list_data" #define LIST_KEY "name_list_data"
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <gnome.h> #include <gnome.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#include "cell.h" #include "cell.h"
#include "expr.h" #include "expr.h"
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <gnome.h> #include <gnome.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#include "cell.h" #include "cell.h"
#include "expr.h" #include "expr.h"
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <gnome.h> #include <gnome.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#include "cell.h" #include "cell.h"
#include "expr.h" #include "expr.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <math.h> #include <math.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#include "cell.h" #include "cell.h"
#include "expr.h" #include "expr.h"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <glade/glade.h> #include <glade/glade.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#include "print-info.h" #include "print-info.h"
#include "print.h" #include "print.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <glade/glade.h> #include <glade/glade.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
gboolean gboolean
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <glade/glade.h> #include <glade/glade.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
#define SUMMARY_DEBUG 0 #define SUMMARY_DEBUG 0
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <glade/glade.h> #include <glade/glade.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-util.h" #include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h" #include "dialogs.h"
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <config.h> #include <config.h>
#include <gnome.h> #include <gnome.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "utils.h" #include "utils.h"
#include "ranges.h" #include "ranges.h"
#include "eval.h" #include "eval.h"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <gnome.h> #include <gnome.h>
#include <math.h> #include <math.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "utils.h" #include "utils.h"
#include "func.h" #include "func.h"
#include "eval.h" #include "eval.h"
......
...@@ -53,8 +53,10 @@ gnumeric_sheet_create (SheetView *sheet_view, GtkWidget *entry) ...@@ -53,8 +53,10 @@ gnumeric_sheet_create (SheetView *sheet_view, GtkWidget *entry)
canvas = GNOME_CANVAS (gsheet); canvas = GNOME_CANVAS (gsheet);
gsheet->sheet_view = sheet_view; gsheet->sheet_view = sheet_view;
gsheet->left_col = 0; gsheet->row.first = gsheet->row.last_full = gsheet->row.last_visible = 0;
gsheet->top_row = 0; gsheet->col.first = gsheet->col.last_full = gsheet->col.last_visible = 0;
gsheet->row_offset.first = gsheet->row_offset.last_full = gsheet->row_offset.last_visible = 0;
gsheet->col_offset.first = gsheet->col_offset.last_full = gsheet->col_offset.last_visible = 0;
gsheet->entry = entry; gsheet->entry = entry;
return gsheet; return gsheet;
...@@ -70,8 +72,8 @@ gnumeric_sheet_get_cell_bounds (GnumericSheet *gsheet, int col, int row, int *x, ...@@ -70,8 +72,8 @@ gnumeric_sheet_get_cell_bounds (GnumericSheet *gsheet, int col, int row, int *x,
sheet = gsheet->sheet_view->sheet; sheet = gsheet->sheet_view->sheet;
*x = sheet_col_get_distance (sheet, gsheet->left_col, col); *x = sheet_col_get_distance (sheet, gsheet->col.first, col);
*y = sheet_row_get_distance (sheet, gsheet->top_row, row); *y = sheet_row_get_distance (sheet, gsheet->row.first, row);
*w = sheet_col_get_distance (sheet, col, col + 1); *w = sheet_col_get_distance (sheet, col, col + 1);
*h = sheet_row_get_distance (sheet, row, row + 1); *h = sheet_row_get_distance (sheet, row, row + 1);
...@@ -99,13 +101,13 @@ gnumeric_sheet_cursor_set (GnumericSheet *gsheet, int col, int row) ...@@ -99,13 +101,13 @@ gnumeric_sheet_cursor_set (GnumericSheet *gsheet, int col, int row)
if (sheet_view->ha){ if (sheet_view->ha){
ha = GTK_ADJUSTMENT (sheet_view->ha); ha = GTK_ADJUSTMENT (sheet_view->ha);
va = GTK_ADJUSTMENT (sheet_view->va); va = GTK_ADJUSTMENT (sheet_view->va);
ha->value = gsheet->left_col; ha->value = gsheet->col.first;
va->value = gsheet->top_row; va->value = gsheet->row.first;
#ifdef DEBUG_POSITIONS #ifdef DEBUG_POSITIONS
{ {
char *top_str = g_strdup (cell_name (gsheet->left_col, gsheet->top_row)); char *top_str = g_strdup (cell_name (gsheet->col.first, gsheet->row.first));
char *lv_str = g_strdup (cell_name (gsheet->last_visible_col, gsheet->last_visible_row)); char *lv_str = g_strdup (cell_name (gsheet->col.last_visible, gsheet->row.last_visible));
printf ("top=%s lv=%s\n", top_str, lv_str); printf ("top=%s lv=%s\n", top_str, lv_str);
g_free (top_str); g_free (top_str);
g_free (lv_str); g_free (lv_str);
...@@ -763,9 +765,9 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event) ...@@ -763,9 +765,9 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
if ((event->state & GDK_CONTROL_MASK) != 0) if ((event->state & GDK_CONTROL_MASK) != 0)
gtk_notebook_prev_page (GTK_NOTEBOOK (wb->notebook)); gtk_notebook_prev_page (GTK_NOTEBOOK (wb->notebook));
else if ((event->state & GDK_MOD1_MASK) == 0) else if ((event->state & GDK_MOD1_MASK) == 0)
(*movefn_vertical)(gsheet, -(gsheet->last_visible_row-gsheet->top_row), FALSE); (*movefn_vertical)(gsheet, -(gsheet->row.last_visible-gsheet->row.first), FALSE);
else else
(*movefn_horizontal)(gsheet, -(gsheet->last_visible_col-gsheet->left_col), FALSE); (*movefn_horizontal)(gsheet, -(gsheet->col.last_visible-gsheet->col.first), FALSE);
break; break;
case GDK_KP_Page_Down: case GDK_KP_Page_Down:
...@@ -773,9 +775,9 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event) ...@@ -773,9 +775,9 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
if ((event->state & GDK_CONTROL_MASK) != 0) if ((event->state & GDK_CONTROL_MASK) != 0)
gtk_notebook_next_page (GTK_NOTEBOOK (wb->notebook)); gtk_notebook_next_page (GTK_NOTEBOOK (wb->notebook));
else if ((event->state & GDK_MOD1_MASK) == 0) else if ((event->state & GDK_MOD1_MASK) == 0)
(*movefn_vertical)(gsheet, gsheet->last_visible_row-gsheet->top_row, FALSE); (*movefn_vertical)(gsheet, gsheet->row.last_visible-gsheet->row.first, FALSE);
else else
(*movefn_horizontal)(gsheet, gsheet->last_visible_col-gsheet->left_col, FALSE); (*movefn_horizontal)(gsheet, gsheet->col.last_visible-gsheet->col.first, FALSE);
break; break;
case GDK_KP_Home: case GDK_KP_Home:
...@@ -972,10 +974,14 @@ gnumeric_sheet_filenames_dropped (GtkWidget *widget, ...@@ -972,10 +974,14 @@ gnumeric_sheet_filenames_dropped (GtkWidget *widget,
while (tmp_list) { while (tmp_list) {
Workbook *new_wb; Workbook *new_wb;
if ((new_wb = workbook_try_read (tmp_list->data, NULL))) if ((new_wb = workbook_try_read (tmp_list->data, NULL)) == NULL) {
gdouble world_x, world_y;
gnome_canvas_window_to_world (GNOME_CANVAS (gsheet), x, y,
&world_x, &world_y);
sheet_object_drop_file (gsheet->sheet_view->sheet, world_x, world_y,
tmp_list->data);
} else
gtk_widget_show (new_wb->toplevel); gtk_widget_show (new_wb->toplevel);
else
sheet_object_drop_file (gsheet, x, y, tmp_list->data);
tmp_list = tmp_list->next; tmp_list = tmp_list->next;
} }
...@@ -1079,7 +1085,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1079,7 +1085,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
/* Find out the last visible col and the last full visible column */ /* Find out the last visible col and the last full visible column */
pixels = 0; pixels = 0;
col = gsheet->left_col; col = gsheet->col.first;
width = GTK_WIDGET (canvas)->allocation.width; width = GTK_WIDGET (canvas)->allocation.width;
do { do {
...@@ -1089,15 +1095,15 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1089,15 +1095,15 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
int const cb = pixels + ci->pixels; int const cb = pixels + ci->pixels;
if (cb == width){ if (cb == width){
gsheet->last_visible_col = col; gsheet->col.last_visible = col;
gsheet->last_full_col = col; gsheet->col.last_full = col;
break; break;
} if (cb > width){ } if (cb > width){
gsheet->last_visible_col = col; gsheet->col.last_visible = col;
if (col == gsheet->left_col) if (col == gsheet->col.first)
gsheet->last_full_col = gsheet->left_col; gsheet->col.last_full = gsheet->col.first;
else else
gsheet->last_full_col = col - 1; gsheet->col.last_full = col - 1;
break; break;
} }
pixels = cb; pixels = cb;
...@@ -1106,13 +1112,13 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1106,13 +1112,13 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
} while (pixels < width && col < SHEET_MAX_COLS); } while (pixels < width && col < SHEET_MAX_COLS);
if (col >= SHEET_MAX_COLS) { if (col >= SHEET_MAX_COLS) {
gsheet->last_visible_col = SHEET_MAX_COLS-1; gsheet->col.last_visible = SHEET_MAX_COLS-1;
gsheet->last_full_col = SHEET_MAX_COLS-1; gsheet->col.last_full = SHEET_MAX_COLS-1;
} }
/* Find out the last visible row and the last fully visible row */ /* Find out the last visible row and the last fully visible row */
pixels = 0; pixels = 0;
row = gsheet->top_row; row = gsheet->row.first;
height = GTK_WIDGET (canvas)->allocation.height; height = GTK_WIDGET (canvas)->allocation.height;
do { do {
ColRowInfo const * const ri = sheet_row_get_info (gsheet->sheet_view->sheet, row); ColRowInfo const * const ri = sheet_row_get_info (gsheet->sheet_view->sheet, row);
...@@ -1121,15 +1127,15 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1121,15 +1127,15 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
int const cb = pixels + ri->pixels; int const cb = pixels + ri->pixels;
if (cb == height){ if (cb == height){
gsheet->last_visible_row = row; gsheet->row.last_visible = row;
gsheet->last_full_row = row; gsheet->row.last_full = row;
break; break;
} if (cb > height){ } if (cb > height){
gsheet->last_visible_row = row; gsheet->row.last_visible = row;
if (row == gsheet->top_row) if (row == gsheet->row.first)
gsheet->last_full_row = gsheet->top_row; gsheet->row.last_full = gsheet->row.first;
else else
gsheet->last_full_row = row - 1; gsheet->row.last_full = row - 1;
break; break;
} }
pixels = cb; pixels = cb;
...@@ -1138,8 +1144,8 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1138,8 +1144,8 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
} while (pixels < height && row < SHEET_MAX_ROWS); } while (pixels < height && row < SHEET_MAX_ROWS);
if (row >= SHEET_MAX_ROWS) { if (row >= SHEET_MAX_ROWS) {
gsheet->last_visible_row = SHEET_MAX_ROWS-1; gsheet->row.last_visible = SHEET_MAX_ROWS-1;
gsheet->last_full_row = SHEET_MAX_ROWS-1; gsheet->row.last_full = SHEET_MAX_ROWS-1;
} }
/* Update the scrollbar sizes */ /* Update the scrollbar sizes */
...@@ -1147,7 +1153,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1147,7 +1153,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
} }
static int static int
gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_top_row) gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_first_row)
{ {
GnomeCanvas *rowc; GnomeCanvas *rowc;
Sheet *sheet; Sheet *sheet;
...@@ -1156,14 +1162,13 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_top_row) ...@@ -1156,14 +1162,13 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_top_row)
g_return_val_if_fail (gsheet != NULL, 0); g_return_val_if_fail (gsheet != NULL, 0);
g_return_val_if_fail (gsheet->item_grid != NULL, 0); g_return_val_if_fail (gsheet->item_grid != NULL, 0);
g_return_val_if_fail (0 <= new_top_row && new_top_row < SHEET_MAX_ROWS, 0); g_return_val_if_fail (0 <= new_first_row && new_first_row < SHEET_MAX_ROWS, 0);
rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas; rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
sheet = gsheet->sheet_view->sheet; sheet = gsheet->sheet_view->sheet;
row_distance = gsheet->item_grid->top_offset += row_distance = gsheet->row_offset.first +=
sheet_row_get_distance (sheet, gsheet->top_row, new_top_row); sheet_row_get_distance (sheet, gsheet->row.first, new_first_row);
gsheet->top_row = gsheet->item_grid->top_row = gsheet->row.first = new_first_row;
new_top_row;
gnome_canvas_get_scroll_offsets (rowc, &x, NULL); gnome_canvas_get_scroll_offsets (rowc, &x, NULL);
gnome_canvas_scroll_to (rowc, x, row_distance); gnome_canvas_scroll_to (rowc, x, row_distance);
...@@ -1172,15 +1177,15 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_top_row) ...@@ -1172,15 +1177,15 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_top_row)
} }
void void
gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row) gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_first_row)
{ {
int distance, x; int distance, x;
g_return_if_fail (gsheet != NULL); g_return_if_fail (gsheet != NULL);
g_return_if_fail (0 <= new_top_row && new_top_row < SHEET_MAX_ROWS); g_return_if_fail (0 <= new_first_row && new_first_row < SHEET_MAX_ROWS);
if (gsheet->top_row != new_top_row) { if (gsheet->row.first != new_first_row) {
distance = gnumeric_sheet_bar_set_top_row (gsheet, new_top_row); distance = gnumeric_sheet_bar_set_top_row (gsheet, new_first_row);
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), &x, NULL); gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), &x, NULL);
gnumeric_sheet_compute_visible_ranges (gsheet); gnumeric_sheet_compute_visible_ranges (gsheet);
gnome_canvas_scroll_to (GNOME_CANVAS (gsheet), x, distance);