Commit b8823fde authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Improve itembar redraw.

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

	* src/sheet-view.c (sheet_view_redraw_headers) : New function that
	  will redraw a subset of an itembar.
	(sheet_view_redraw_columns) : Delete.
	(sheet_view_redraw_rows) : Delete.

	* src/sheet.c (sheet_redraw_headers) : Call sheet_view_redraw_headers.
	(sheet_redraw_columns) : Delete.
	(sheet_redraw_rows) : Delete.

	* src/gnumeric-sheet.h (GnumericSheet) : Remove unused member item_bar_col.

	* src/colrow.c (col_row_set_visiblity) : Use sheet_redraw_headers
	  in place of sheet_redraw_{cols,row}.
	* src/selection.c (sheet_selection_append_range) : Ditto.
	(sheet_select_all) : Ditto.
	(sheet_selection_reset_only) : Ditto.  Clear the selection internally.

	* src/sheet.c (sheet_{col,row}_get_distance) : Handle from > to.

	* src/item-cursor.c (item_cursor_get_pixel_coords) : Use the
	  precalculated offsets.
	* src/item-edit.c (item_edit_get_pixel_coords) : Ditto.

	* src/gnumeric-sheet.c (gnumeric_sheet_bar_set_top_row) : Update the
	  item_grid's notion of the top.  Calculate the new distance using the
	  previous top as the start point.
	(gnumeric_sheet_bar_set_left_col) : Rename from top_col.  Ditto.

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

	* src/item-bar.c (item_bar_draw) : Remove minor drawing glitch when
	  drawing at the edge of the sheet.
	(item_bar_class_init) : Remove the unsed 'First' argument.

	* src/item-grid.c (item_grid_draw) : Draw gridlines even at the
	  outer edges.
parent aa423f94
2000-01-18 Miguel de Icaza <miguel@gnu.org>
2000-01-22 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (x_selection_to_cell_region): Do not hardcode
',' as a number separator. Use the locale information to select
the proper separator.
* src/sheet-view.c (sheet_view_redraw_headers) : New function that
will redraw a subset of an itembar.
(sheet_view_redraw_columns) : Delete.
(sheet_view_redraw_rows) : Delete.
* src/sheet.c (sheet_redraw_headers) : Call sheet_view_redraw_headers.
(sheet_redraw_columns) : Delete.
(sheet_redraw_rows) : Delete.
* src/gnumeric-sheet.h (GnumericSheet) : Remove unused member item_bar_col.
* src/colrow.c (col_row_set_visiblity) : Use sheet_redraw_headers
in place of sheet_redraw_{cols,row}.
* src/selection.c (sheet_selection_append_range) : Ditto.
(sheet_select_all) : Ditto.
(sheet_selection_reset_only) : Ditto. Clear the selection internally.
* src/sheet.c (sheet_{col,row}_get_distance) : Handle from > to.
* src/item-cursor.c (item_cursor_get_pixel_coords) : Use the
precalculated offsets.
* src/item-edit.c (item_edit_get_pixel_coords) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_bar_set_top_row) : Update the
item_grid's notion of the top. Calculate the new distance using the
previous top as the start point.
(gnumeric_sheet_bar_set_left_col) : Rename from top_col. Ditto.
2000-01-21 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c (item_bar_draw) : Remove minor drawing glitch when
drawing at the edge of the sheet.
(item_bar_class_init) : Remove the unsed 'First' argument.
* src/item-grid.c (item_grid_draw) : Draw gridlines even at the
outer edges.
2000-01-16 Miguel de Icaza <miguel@gnu.org>
* src/sheet.c (sheet_set_current_value): Change the logic to
always shutdown gracefully.
* plugins/Makefile.am : Remove python plugin.
* plugins/python/Makefile.am : Remove python plugin.
2000-01-21 Jody Goldberg <jgoldberg@home.com>
......
2000-01-18 Miguel de Icaza <miguel@gnu.org>
2000-01-22 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (x_selection_to_cell_region): Do not hardcode
',' as a number separator. Use the locale information to select
the proper separator.
* src/sheet-view.c (sheet_view_redraw_headers) : New function that
will redraw a subset of an itembar.
(sheet_view_redraw_columns) : Delete.
(sheet_view_redraw_rows) : Delete.
* src/sheet.c (sheet_redraw_headers) : Call sheet_view_redraw_headers.
(sheet_redraw_columns) : Delete.
(sheet_redraw_rows) : Delete.
* src/gnumeric-sheet.h (GnumericSheet) : Remove unused member item_bar_col.
* src/colrow.c (col_row_set_visiblity) : Use sheet_redraw_headers
in place of sheet_redraw_{cols,row}.
* src/selection.c (sheet_selection_append_range) : Ditto.
(sheet_select_all) : Ditto.
(sheet_selection_reset_only) : Ditto. Clear the selection internally.
* src/sheet.c (sheet_{col,row}_get_distance) : Handle from > to.
* src/item-cursor.c (item_cursor_get_pixel_coords) : Use the
precalculated offsets.
* src/item-edit.c (item_edit_get_pixel_coords) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_bar_set_top_row) : Update the
item_grid's notion of the top. Calculate the new distance using the
previous top as the start point.
(gnumeric_sheet_bar_set_left_col) : Rename from top_col. Ditto.
2000-01-21 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c (item_bar_draw) : Remove minor drawing glitch when
drawing at the edge of the sheet.
(item_bar_class_init) : Remove the unsed 'First' argument.
* src/item-grid.c (item_grid_draw) : Draw gridlines even at the
outer edges.
2000-01-16 Miguel de Icaza <miguel@gnu.org>
* src/sheet.c (sheet_set_current_value): Change the logic to
always shutdown gracefully.
* plugins/Makefile.am : Remove python plugin.
* plugins/python/Makefile.am : Remove python plugin.
2000-01-21 Jody Goldberg <jgoldberg@home.com>
......
......@@ -122,6 +122,5 @@ col_row_set_visiblity (Sheet *sheet, gboolean const is_col,
}
sheet_redraw_all (sheet);
sheet_redraw_cols (sheet);
sheet_redraw_rows (sheet);
sheet_redraw_headers (sheet, TRUE, TRUE, NULL);
}
......@@ -115,7 +115,6 @@ gnumeric_sheet_cursor_set (GnumericSheet *gsheet, int col, int row)
gtk_adjustment_value_changed (ha);
gtk_adjustment_value_changed (va);
}
}
/*
......@@ -1154,12 +1153,15 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_top_row)
int x;
g_return_val_if_fail (gsheet != 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);
rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->top_row = new_top_row;
row_distance = sheet_row_get_distance (sheet, 0, gsheet->top_row);
row_distance = gsheet->item_grid->top_offset +=
sheet_row_get_distance (sheet, gsheet->top_row, new_top_row);
gsheet->top_row = gsheet->item_grid->top_row =
new_top_row;
gnome_canvas_get_scroll_offsets (rowc, &x, NULL);
gnome_canvas_scroll_to (rowc, x, row_distance);
......@@ -1184,7 +1186,7 @@ gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
}
static int
gnumeric_sheet_bar_set_top_col (GnumericSheet *gsheet, int new_left_col)
gnumeric_sheet_bar_set_left_col (GnumericSheet *gsheet, int new_left_col)
{
GnomeCanvas *colc;
Sheet *sheet;
......@@ -1192,13 +1194,16 @@ gnumeric_sheet_bar_set_top_col (GnumericSheet *gsheet, int new_left_col)
int y;
g_return_val_if_fail (gsheet != NULL, 0);
g_return_val_if_fail (gsheet->item_grid != NULL, 0);
g_return_val_if_fail (0 <= new_left_col && new_left_col < SHEET_MAX_COLS, 0);
colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->left_col = new_left_col;
col_distance = sheet_col_get_distance (sheet, 0, gsheet->left_col);
col_distance = gsheet->item_grid->left_offset +=
sheet_col_get_distance (sheet, gsheet->left_col, new_left_col);
gsheet->left_col = gsheet->item_grid->left_col =
new_left_col;
gnome_canvas_get_scroll_offsets (colc, NULL, &y);
gnome_canvas_scroll_to (colc, col_distance, y);
......@@ -1215,7 +1220,7 @@ gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_left_col)
g_return_if_fail (0 <= new_left_col && new_left_col < SHEET_MAX_COLS);
if (gsheet->left_col != new_left_col) {
distance = gnumeric_sheet_bar_set_top_col (gsheet, new_left_col);
distance = gnumeric_sheet_bar_set_left_col (gsheet, new_left_col);
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), NULL, &y);
gnumeric_sheet_compute_visible_ranges (gsheet);
gnome_canvas_scroll_to (GNOME_CANVAS (gsheet), distance, y);
......@@ -1288,7 +1293,7 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row)
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), &col_distance, &row_distance);
if (gsheet->left_col != new_left_col){
col_distance = gnumeric_sheet_bar_set_top_col (gsheet, new_left_col);
col_distance = gnumeric_sheet_bar_set_left_col (gsheet, new_left_col);
did_change = 1;
}
......
......@@ -23,8 +23,6 @@ typedef struct {
ItemGrid *item_grid;
ItemCursor *item_cursor;
ItemBar *item_bar_col;
ItemEdit *item_editor;
SheetModeType mode;
......
......@@ -115,7 +115,6 @@ gnumeric_sheet_cursor_set (GnumericSheet *gsheet, int col, int row)
gtk_adjustment_value_changed (ha);
gtk_adjustment_value_changed (va);
}
}
/*
......@@ -1154,12 +1153,15 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_top_row)
int x;
g_return_val_if_fail (gsheet != 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);
rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->top_row = new_top_row;
row_distance = sheet_row_get_distance (sheet, 0, gsheet->top_row);
row_distance = gsheet->item_grid->top_offset +=
sheet_row_get_distance (sheet, gsheet->top_row, new_top_row);
gsheet->top_row = gsheet->item_grid->top_row =
new_top_row;
gnome_canvas_get_scroll_offsets (rowc, &x, NULL);
gnome_canvas_scroll_to (rowc, x, row_distance);
......@@ -1184,7 +1186,7 @@ gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
}
static int
gnumeric_sheet_bar_set_top_col (GnumericSheet *gsheet, int new_left_col)
gnumeric_sheet_bar_set_left_col (GnumericSheet *gsheet, int new_left_col)
{
GnomeCanvas *colc;
Sheet *sheet;
......@@ -1192,13 +1194,16 @@ gnumeric_sheet_bar_set_top_col (GnumericSheet *gsheet, int new_left_col)
int y;
g_return_val_if_fail (gsheet != NULL, 0);
g_return_val_if_fail (gsheet->item_grid != NULL, 0);
g_return_val_if_fail (0 <= new_left_col && new_left_col < SHEET_MAX_COLS, 0);
colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->left_col = new_left_col;
col_distance = sheet_col_get_distance (sheet, 0, gsheet->left_col);
col_distance = gsheet->item_grid->left_offset +=
sheet_col_get_distance (sheet, gsheet->left_col, new_left_col);
gsheet->left_col = gsheet->item_grid->left_col =
new_left_col;
gnome_canvas_get_scroll_offsets (colc, NULL, &y);
gnome_canvas_scroll_to (colc, col_distance, y);
......@@ -1215,7 +1220,7 @@ gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_left_col)
g_return_if_fail (0 <= new_left_col && new_left_col < SHEET_MAX_COLS);
if (gsheet->left_col != new_left_col) {
distance = gnumeric_sheet_bar_set_top_col (gsheet, new_left_col);
distance = gnumeric_sheet_bar_set_left_col (gsheet, new_left_col);
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), NULL, &y);
gnumeric_sheet_compute_visible_ranges (gsheet);
gnome_canvas_scroll_to (GNOME_CANVAS (gsheet), distance, y);
......@@ -1288,7 +1293,7 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row)
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (gsheet), &col_distance, &row_distance);
if (gsheet->left_col != new_left_col){
col_distance = gnumeric_sheet_bar_set_top_col (gsheet, new_left_col);
col_distance = gnumeric_sheet_bar_set_left_col (gsheet, new_left_col);
did_change = 1;
}
......
......@@ -23,8 +23,6 @@ typedef struct {
ItemGrid *item_grid;
ItemCursor *item_cursor;
ItemBar *item_bar_col;
ItemEdit *item_editor;
SheetModeType mode;
......
......@@ -215,22 +215,18 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
{
ItemBar const * const item_bar = ITEM_BAR (item);
Sheet const * const sheet = item_bar->sheet_view->sheet;
int element = item_bar->first_element;
GnumericSheet const * const gsheet = GNUMERIC_SHEET (item_bar->sheet_view->sheet_view);
int pixels;
if (item_bar->orientation == GTK_ORIENTATION_VERTICAL) {
int total = -y;
int const real_width = GTK_WIDGET (item->canvas)->allocation.width;
int element = gsheet->top_row;
int total = gsheet->item_grid->top_offset - y;
do {
if (element >= SHEET_MAX_ROWS) {
GtkWidget *canvas = GTK_WIDGET (item->canvas);
gtk_draw_shadow (canvas->style, drawable,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-x, y, real_width, height);
if (element >= SHEET_MAX_ROWS)
return;
}
if (item_bar->resize_pos != element) {
ColRowInfo const *cri = sheet_row_get_info (sheet, element);
pixels = cri->pixels;
......@@ -251,18 +247,14 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
++element;
} while (total < height);
} else {
int total = -x;
int const real_height = GTK_WIDGET (item->canvas)->allocation.height;
int element = gsheet->left_col;
int total = gsheet->item_grid->left_offset - x;
do {
if (element >= SHEET_MAX_COLS) {
GtkWidget *canvas = GTK_WIDGET (item->canvas);
gtk_draw_shadow (canvas->style, drawable,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
x, -y, width, real_height);
if (element >= SHEET_MAX_COLS)
return;
}
if (item_bar->resize_pos != element) {
ColRowInfo const *cri = cri = sheet_col_get_info (sheet, element);
pixels = cri->pixels;
......@@ -740,8 +732,6 @@ item_bar_class_init (ItemBarClass *item_bar_class)
GTK_ARG_WRITABLE, ARG_SHEET_VIEW);
gtk_object_add_arg_type ("ItemBar::Orientation", GTK_TYPE_INT,
GTK_ARG_WRITABLE, ARG_ORIENTATION);
gtk_object_add_arg_type ("ItemBar::First", GTK_TYPE_INT,
GTK_ARG_WRITABLE, ARG_FIRST_ELEMENT);
item_bar_signals [SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
......
......@@ -141,8 +141,10 @@ item_cursor_get_pixel_coords (ItemCursor *item_cursor, int *x, int *y, int *w, i
ItemGrid *item_grid = item_cursor->item_grid;
Sheet *sheet = item_cursor->sheet;
*x = sheet_col_get_distance (sheet, item_grid->left_col, item_cursor->pos.start.col);
*y = sheet_row_get_distance (sheet, item_grid->top_row, item_cursor->pos.start.row);
*x = item_grid->left_offset +
sheet_col_get_distance (sheet, item_grid->left_col, item_cursor->pos.start.col);
*y = item_grid->top_offset +
sheet_row_get_distance (sheet, item_grid->top_row, item_cursor->pos.start.row);
*w = sheet_col_get_distance (sheet, item_cursor->pos.start.col, item_cursor->pos.end.col+1);
*h = sheet_row_get_distance (sheet, item_cursor->pos.start.row, item_cursor->pos.end.row+1);
......
......@@ -36,11 +36,15 @@ item_edit_get_pixel_coords (ItemEdit *item_edit, int *x, int *y, int *w, int *h)
ItemGrid *item_grid = item_edit->item_grid;
Sheet *sheet = item_edit->sheet;
*x = sheet_col_get_distance (sheet, item_grid->left_col, item_edit->col);
*y = sheet_row_get_distance (sheet, item_grid->top_row, item_edit->row);
*w = sheet_col_get_distance (sheet, item_edit->col, item_edit->col + item_edit->col_span);
*h = sheet_row_get_distance (sheet, item_edit->row, item_edit->row + item_edit->row_span);
*x = item_grid->left_offset +
sheet_col_get_distance (sheet, item_grid->left_col, item_edit->col);
*y = item_grid->top_offset +
sheet_row_get_distance (sheet, item_grid->top_row, item_edit->row);
*w = sheet_col_get_distance (sheet, item_edit->col,
item_edit->col + item_edit->col_span);
*h = sheet_row_get_distance (sheet, item_edit->row,
item_edit->row + item_edit->row_span);
}
static void
......
......@@ -378,24 +378,28 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int
/* 2. the grids */
if (sheet->show_grid) {
col = paint_col;
for (x_paint = -diff_x; x_paint < end_x && col < SHEET_MAX_COLS; ++col){
ColRowInfo const * const ci = sheet_col_get_info (sheet, col);
x_paint = -diff_x;
gdk_draw_line (drawable, grid_gc, x_paint, 0, x_paint, height);
while (x_paint < end_x && col < SHEET_MAX_COLS) {
ColRowInfo const * const ci = sheet_col_get_info (sheet, col++);
int const tmp = ci->pixels;
if (tmp > 0) {
gdk_draw_line (drawable, grid_gc, x_paint, 0, x_paint, height);
x_paint += ci->pixels;
gdk_draw_line (drawable, grid_gc, x_paint, 0, x_paint, height);
}
}
row = paint_row;
for (y_paint = -diff_y; y_paint < end_y && row < SHEET_MAX_ROWS; ++row){
ColRowInfo const * const ri = sheet_row_get_info (sheet, row);
y_paint = -diff_y;
gdk_draw_line (drawable, grid_gc, 0, y_paint, width, y_paint);
while (y_paint < end_y && row < SHEET_MAX_ROWS) {
ColRowInfo const * const ri = sheet_row_get_info (sheet, row++);
int const tmp = ri->pixels;
if (tmp > 0) {
gdk_draw_line (drawable, grid_gc, 0, y_paint, width, y_paint);
y_paint += ri->pixels;
gdk_draw_line (drawable, grid_gc, 0, y_paint, width, y_paint);
}
}
}
......
......@@ -16,10 +16,6 @@
#include "application.h"
#include "gnumeric-util.h"
static void sheet_selection_change (Sheet *sheet,
SheetSelection *old,
SheetSelection *new);
/*
* Quick utility routine to test intersect of line segments.
* Returns : 5 sA == sb eA == eb a == b
......@@ -99,9 +95,7 @@ sheet_selection_append_range (Sheet *sheet,
sheet_set_selection (sheet, ss);
sheet_redraw_selection (sheet, ss);
sheet_redraw_cols (sheet);
sheet_redraw_rows (sheet);
sheet_redraw_headers (sheet, TRUE, TRUE, &ss->user);
sheet_selection_changed_hook (sheet);
}
......@@ -194,19 +188,69 @@ sheet_selection_change (Sheet *sheet, SheetSelection *old, SheetSelection *new)
sheet_redraw_selection (sheet, new);
}
if (new->user.start.col != old->user.start.col ||
new->user.end.col != old->user.end.col ||
((new->user.start.row == 0 && new->user.end.row == SHEET_MAX_ROWS-1) ^
(old->user.start.row == 0 &&
old->user.end.row == SHEET_MAX_ROWS-1)))
sheet_redraw_cols (sheet);
if (new->user.start.row != old->user.start.row ||
new->user.end.row != old->user.end.row ||
((new->user.start.col == 0 && new->user.end.col == SHEET_MAX_COLS-1) ^
(old->user.start.col == 0 &&
old->user.end.col == SHEET_MAX_COLS-1)))
sheet_redraw_rows (sheet);
/* Has the entire row been selected/unselected */
if ((new->user.start.row == 0 && new->user.end.row == SHEET_MAX_ROWS-1) ^
(old->user.start.row == 0 && old->user.end.row == SHEET_MAX_ROWS-1)) {
sheet_redraw_headers (sheet, TRUE, FALSE, &new->user);
} else
{
Range tmp = new->user;
int diff;
diff = new->user.start.col - old->user.start.col;
if (diff != 0) {
if (diff > 0) {
tmp.start.col = old->user.start.col;
tmp.end.col = new->user.start.col;
} else {
tmp.end.col = old->user.start.col;
tmp.start.col = new->user.start.col;
}
sheet_redraw_headers (sheet, TRUE, FALSE, &tmp);
}
diff = new->user.end.col - old->user.end.col;
if (diff != 0) {
if (diff > 0) {
tmp.start.col = old->user.end.col;
tmp.end.col = new->user.end.col;
} else {
tmp.end.col = old->user.end.col;
tmp.start.col = new->user.end.col;
}
sheet_redraw_headers (sheet, TRUE, FALSE, &tmp);
}
}
/* Has the entire col been selected/unselected */
if ((new->user.start.col == 0 && new->user.end.col == SHEET_MAX_COLS-1) ^
(old->user.start.col == 0 && old->user.end.col == SHEET_MAX_COLS-1)) {
sheet_redraw_headers (sheet, FALSE, TRUE, &new->user);
} else
{
Range tmp = new->user;
int diff;
diff = new->user.start.row - old->user.start.row;
if (diff != 0) {
if (diff > 0) {
tmp.start.row = old->user.start.row;
tmp.end.row = new->user.start.row;
} else {
tmp.end.row = old->user.start.row;
tmp.start.row = new->user.start.row;
}
sheet_redraw_headers (sheet, FALSE, TRUE, &tmp);
}
diff = new->user.end.row - old->user.end.row;
if (diff != 0) {
if (diff > 0) {
tmp.start.row = old->user.end.row;
tmp.end.row = new->user.end.row;
} else {
tmp.end.row = old->user.end.row;
tmp.start.row = new->user.end.row;
}
sheet_redraw_headers (sheet, FALSE, TRUE, &tmp);
}
}
}
/**
......@@ -269,8 +313,7 @@ sheet_select_all (Sheet *sheet)
SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1);
/* Queue redraws for columns and rows */
sheet_redraw_rows (sheet);
sheet_redraw_cols (sheet);
sheet_redraw_headers (sheet, TRUE, TRUE, NULL);
}
int
......@@ -428,31 +471,32 @@ sheet_selection_free (Sheet *sheet)
* sheet: The sheet
*
* Clears all of the selection ranges.
* Warning: This does not set a new selection, this should
* WARNING: This does not set a new selection this should
* be taken care on the calling routine.
*/
void
sheet_selection_reset_only (Sheet *sheet)
{
GList *list;
GList *list, *tmp;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
for (list = sheet->selections; list; list = list->next){
SheetSelection *ss = list->data;
/* Empty the sheets selection */
list = sheet->selections;
sheet->selections = NULL;
/* Redraw the grid, & headers for each region */
for (tmp = list; tmp; tmp = tmp->next){
SheetSelection *ss = tmp->data;
sheet_redraw_selection (sheet, ss);
sheet_redraw_headers (sheet, TRUE, TRUE, &ss->user);
g_free (ss);
}
sheet_selection_free (sheet);
g_list_free (tmp);
sheet->cursor_selection = NULL;
/* Redraw column bar */
sheet_redraw_cols (sheet);
/* Redraw the row bar */
sheet_redraw_rows (sheet);
}
/**
......
......@@ -435,7 +435,16 @@ autofill_cell (Cell *cell, int idx, FillItem *fi)
MStyle *mstyle = sheet_style_compute (fi->reference->sheet,
fi->reference->col->pos,
fi->reference->row->pos);
sheet_style_attach_single (cell->sheet, cell->col->pos,
printf ("!!!! %s%d -> ",
col_name(fi->reference->col->pos),
fi->reference->row->pos+1);
printf ("%s%d\n",
col_name(cell->col->pos),
cell->row->pos+1);
sheet_style_attach_single (cell->sheet,
cell->col->pos,
cell->row->pos, mstyle);
switch (fi->type) {
......
......@@ -111,25 +111,59 @@ sheet_view_redraw_cell_region (SheetView *sheet_view, int start_col, int start_r
}
void
sheet_view_redraw_columns (SheetView *sheet_view)
sheet_view_redraw_headers (SheetView *sheet_view,
gboolean const col, gboolean const row,
Range const * r /* optional == NULL */)
{
GnumericSheet *gsheet;
g_return_if_fail (sheet_view != NULL);
g_return_if_fail (IS_SHEET_VIEW (sheet_view));
gnome_canvas_request_redraw (
GNOME_CANVAS (sheet_view->col_canvas),
0, 0, INT_MAX, INT_MAX);
}
gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
void
sheet_view_redraw_rows (SheetView *sheet_view)
{
g_return_if_fail (sheet_view != NULL);
g_return_if_fail (IS_SHEET_VIEW (sheet_view));
if (col) {
int left = 0, right = INT_MAX;
if (r != NULL) {
int const size = r->end.col - r->start.col;
/* A rough heuristic guess of the number of when the
* trade off point of redrawing all vs calculating the
* redraw size is crossed */
#define COL_HEURISTIC 20
if (-COL_HEURISTIC < size && size < COL_HEURISTIC) {
left = gsheet->item_grid->left_offset +
sheet_col_get_distance (sheet_view->sheet,
gsheet->left_col, r->start.col);
right = left +
sheet_col_get_distance (sheet_view->sheet,
r->start.col, r->end.col+1);
}
}
gnome_canvas_request_redraw (
GNOME_CANVAS (sheet_view->col_canvas),
left, 0, right, INT_MAX);
}
gnome_canvas_request_redraw (
GNOME_CANVAS (sheet_view->row_canvas),
0, 0, INT_MAX, INT_MAX);
if (row) {
int top = 0, bottom = INT_MAX;
if (r != NULL) {
int const size = r->end.row - r->start.row;
/* A rough heuristic guess of the number of when the
* trade off point of redrawing all vs calculating the