Commit 3d3ec8bf authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

- Switch the item-cursor over to a delayed update model in an attempt to

  fix a redraw bug.  Things are faster but not fixed.

- Fix the real problem.  More cleanup of the cursor/selection code is required.
  There is too much incest in there.  We are redoing 75% of the necessary operations
  at several level in an attempt to get all the requisite pieces.

2000-02-20  Jody Goldberg <jgoldberg@home.com>

	* src/item-cursor.c : Switch to a quartic approved delayed update
	  model.  Do not change the bounding box while drawing.

	* src/selection.c (sheet_selection_add_range) : Do NOT directly change
	  the edit/move/base characteristics of the sheet sheet_cursor_set handles
	  that.

	* src/gnumeric-sheet.c (gnumeric_sheet_compute_visible_ranges) : Use
	  item_cursor_reposition rather than pretending that the cursor moved.

	* src/item-grid.c (item_grid_button_1) : Don't call both
	  sheet_cursor_move and sheet_selection_add.  The former was moving
	  the edit cursor without redrawing it.
parent d3afbba4
2000-02-20 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c : Switch to a quartic approved delayed update
model. Do not change the bounding box while drawing.
* src/selection.c (sheet_selection_add_range) : Do NOT directly change
the edit/move/base characteristics of the sheet sheet_cursor_set handles
that.
* src/gnumeric-sheet.c (gnumeric_sheet_compute_visible_ranges) : Use
item_cursor_reposition rather than pretending that the cursor moved.
* src/item-grid.c (item_grid_button_1) : Don't call both
sheet_cursor_move and sheet_selection_add. The former was moving
the edit cursor without redrawing it.
2000-02-20 Michael Meeks <michael@helixcode.com> 2000-02-20 Michael Meeks <michael@helixcode.com>
* src/sheet-object-container.c (sheet_object_container_realize): pass * src/sheet-object-container.c (sheet_object_container_realize): pass
UI handler in straight. UI handler in straight.
2000-02-19 Mike Kestner <mkestner@ameritech.net>
*src/dialogs/dialog-simple-input.c (dialog_get_number): Fixed leaks.
(dialog_get_sheet_name): Fixed leaks.
2000-02-19 Jody Goldberg <jgoldberg@home.com> 2000-02-19 Jody Goldberg <jgoldberg@home.com>
* src/corba-workbook-factory.c (WorkbookFactory_read) : Create a tmp * src/corba-workbook-factory.c (WorkbookFactory_read) : Create a tmp
......
2000-02-20 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c : Switch to a quartic approved delayed update
model. Do not change the bounding box while drawing.
* src/selection.c (sheet_selection_add_range) : Do NOT directly change
the edit/move/base characteristics of the sheet sheet_cursor_set handles
that.
* src/gnumeric-sheet.c (gnumeric_sheet_compute_visible_ranges) : Use
item_cursor_reposition rather than pretending that the cursor moved.
* src/item-grid.c (item_grid_button_1) : Don't call both
sheet_cursor_move and sheet_selection_add. The former was moving
the edit cursor without redrawing it.
2000-02-20 Michael Meeks <michael@helixcode.com> 2000-02-20 Michael Meeks <michael@helixcode.com>
* src/sheet-object-container.c (sheet_object_container_realize): pass * src/sheet-object-container.c (sheet_object_container_realize): pass
UI handler in straight. UI handler in straight.
2000-02-19 Mike Kestner <mkestner@ameritech.net>
*src/dialogs/dialog-simple-input.c (dialog_get_number): Fixed leaks.
(dialog_get_sheet_name): Fixed leaks.
2000-02-19 Jody Goldberg <jgoldberg@home.com> 2000-02-19 Jody Goldberg <jgoldberg@home.com>
* src/corba-workbook-factory.c (WorkbookFactory_read) : Create a tmp * src/corba-workbook-factory.c (WorkbookFactory_read) : Create a tmp
......
...@@ -31,6 +31,7 @@ dialog_get_number (Workbook *wb, const char *glade_file, double *init_and_return ...@@ -31,6 +31,7 @@ dialog_get_number (Workbook *wb, const char *glade_file, double *init_and_return
dialog = GNOME_DIALOG (glade_xml_get_widget (gui, "dialog1")); dialog = GNOME_DIALOG (glade_xml_get_widget (gui, "dialog1"));
if (dialog == NULL){ if (dialog == NULL){
g_warning ("Can not find the `dialog1' widget in %s", glade_file); g_warning ("Can not find the `dialog1' widget in %s", glade_file);
gtk_object_destroy (GTK_OBJECT (gui));
return FALSE; return FALSE;
} }
...@@ -49,6 +50,7 @@ dialog_get_number (Workbook *wb, const char *glade_file, double *init_and_return ...@@ -49,6 +50,7 @@ dialog_get_number (Workbook *wb, const char *glade_file, double *init_and_return
res = FALSE; res = FALSE;
break; break;
case -1: /* window manager close */ case -1: /* window manager close */
gtk_object_destroy (GTK_OBJECT (gui));
return FALSE; return FALSE;
default: default:
...@@ -77,6 +79,7 @@ dialog_get_sheet_name (Workbook *wb, const char *current) ...@@ -77,6 +79,7 @@ dialog_get_sheet_name (Workbook *wb, const char *current)
dialog = GNOME_DIALOG (glade_xml_get_widget (gui, "dialog")); dialog = GNOME_DIALOG (glade_xml_get_widget (gui, "dialog"));
if (dialog == NULL){ if (dialog == NULL){
g_warning ("Can not find the `dialog' widget in sheet-rename.glade"); g_warning ("Can not find the `dialog' widget in sheet-rename.glade");
gtk_object_destroy (GTK_OBJECT (gui));
return NULL; return NULL;
} }
...@@ -90,6 +93,7 @@ dialog_get_sheet_name (Workbook *wb, const char *current) ...@@ -90,6 +93,7 @@ dialog_get_sheet_name (Workbook *wb, const char *current)
case 1: /* cancel */ case 1: /* cancel */
break; break;
case -1: /* window manager close */ case -1: /* window manager close */
gtk_object_destroy (GTK_OBJECT (gui));
return NULL; return NULL;
default: default:
......
...@@ -1074,9 +1074,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1074,9 +1074,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
sheet_view_scrollbar_config (gsheet->sheet_view); sheet_view_scrollbar_config (gsheet->sheet_view);
/* Force the cursor to update its bounds relative to the new visible region */ /* Force the cursor to update its bounds relative to the new visible region */
item_cursor_set_bounds (ic, item_cursor_reposition (gsheet->item_cursor);
ic->pos.start.col, ic->pos.start.row,
ic->pos.end.col, ic->pos.end.row);
} }
static int static int
......
...@@ -33,10 +33,10 @@ typedef struct { ...@@ -33,10 +33,10 @@ typedef struct {
* (ie, when the user uses the cursor keys * (ie, when the user uses the cursor keys
* to select a cell for an expression). * to select a cell for an expression).
*/ */
int selecting_cell; gboolean selecting_cell;
int sel_cursor_pos; int sel_cursor_pos;
int sel_text_len; int sel_text_len;
ItemCursor *selection; ItemCursor *selection;
/* /*
* The column and row bars * The column and row bars
......
...@@ -1074,9 +1074,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet) ...@@ -1074,9 +1074,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
sheet_view_scrollbar_config (gsheet->sheet_view); sheet_view_scrollbar_config (gsheet->sheet_view);
/* Force the cursor to update its bounds relative to the new visible region */ /* Force the cursor to update its bounds relative to the new visible region */
item_cursor_set_bounds (ic, item_cursor_reposition (gsheet->item_cursor);
ic->pos.start.col, ic->pos.start.row,
ic->pos.end.col, ic->pos.end.row);
} }
static int static int
......
...@@ -33,10 +33,10 @@ typedef struct { ...@@ -33,10 +33,10 @@ typedef struct {
* (ie, when the user uses the cursor keys * (ie, when the user uses the cursor keys
* to select a cell for an expression). * to select a cell for an expression).
*/ */
int selecting_cell; gboolean selecting_cell;
int sel_cursor_pos; int sel_cursor_pos;
int sel_text_len; int sel_text_len;
ItemCursor *selection; ItemCursor *selection;
/* /*
* The column and row bars * The column and row bars
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
static GnomeCanvasItem *item_cursor_parent_class; static GnomeCanvasItem *item_cursor_parent_class;
static void item_cursor_request_redraw (ItemCursor *item_cursor);
#define AUTO_HANDLE_SPACE 4 #define AUTO_HANDLE_SPACE 4
#define CLIP_SAFETY_MARGIN (AUTO_HANDLE_SPACE + 5) #define CLIP_SAFETY_MARGIN (AUTO_HANDLE_SPACE + 5)
#define IS_LITTLE_SQUARE(item,x,y) \ #define IS_LITTLE_SQUARE(item,x,y) \
...@@ -40,8 +38,10 @@ enum { ...@@ -40,8 +38,10 @@ enum {
static int static int
item_cursor_animation_callback (ItemCursor *item_cursor) item_cursor_animation_callback (ItemCursor *item_cursor)
{ {
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_cursor);
item_cursor->state = !item_cursor->state; item_cursor->state = !item_cursor->state;
item_cursor_request_redraw (item_cursor); gnome_canvas_item_request_update (item);
return TRUE; return TRUE;
} }
...@@ -124,21 +124,28 @@ item_cursor_unrealize (GnomeCanvasItem *item) ...@@ -124,21 +124,28 @@ item_cursor_unrealize (GnomeCanvasItem *item)
} }
static void static void
item_cursor_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) item_cursor_request_redraw (ItemCursor *item_cursor)
{ {
if (GNOME_CANVAS_ITEM_CLASS(item_cursor_parent_class)->update) GnomeCanvas *canvas = GNOME_CANVAS_ITEM (item_cursor)->canvas;
(*GNOME_CANVAS_ITEM_CLASS(item_cursor_parent_class)->update)(item, affine, clip_path, flags); int const x = item_cursor->cached_x;
int const y = item_cursor->cached_y;
int const w = item_cursor->cached_w;
int const h = item_cursor->cached_h;
gnome_canvas_request_redraw (canvas, x - 2, y - 2, x + 2, y + h + 2);
gnome_canvas_request_redraw (canvas, x - 2, y - 2, x + w + 2, y + 2);
gnome_canvas_request_redraw (canvas, x + w - 2, y - 2, x + w + 5, y + h + 5);
gnome_canvas_request_redraw (canvas, x - 2, y + h - 2, x + w + 5, y + h + 5);
} }
/*
* Returns the bounding box cordinates for box delimited by the cursor
*/
static void static void
item_cursor_get_pixel_coords (ItemCursor *item_cursor, int *x, int *y, int *w, int *h) item_cursor_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
{ {
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_cursor); ItemCursor *item_cursor = ITEM_CURSOR (item);
GnumericSheet *gsheet = GNUMERIC_SHEET (item->canvas); GnumericSheet *gsheet = GNUMERIC_SHEET (item->canvas);
Sheet *sheet = item_cursor->sheet; Sheet *sheet = item_cursor->sheet;
int x, y, w, h, extra;
/* Clip the bounds of the cursor to the visible region of cells */ /* Clip the bounds of the cursor to the visible region of cells */
int const left = MAX (gsheet->col.first-1, item_cursor->pos.start.col); int const left = MAX (gsheet->col.first-1, item_cursor->pos.start.col);
...@@ -146,27 +153,19 @@ item_cursor_get_pixel_coords (ItemCursor *item_cursor, int *x, int *y, int *w, i ...@@ -146,27 +153,19 @@ item_cursor_get_pixel_coords (ItemCursor *item_cursor, int *x, int *y, int *w, i
int const top = MAX (gsheet->row.first-1, item_cursor->pos.start.row); int const top = MAX (gsheet->row.first-1, item_cursor->pos.start.row);
int const bottom = MIN (gsheet->row.last_visible, item_cursor->pos.end.row); int const bottom = MIN (gsheet->row.last_visible, item_cursor->pos.end.row);
*x = gsheet->col_offset.first + /* Erase the old cursor */
item_cursor_request_redraw (item_cursor);
item_cursor->cached_x = x =
gsheet->col_offset.first +
sheet_col_get_distance_pixels (sheet, gsheet->col.first, left); sheet_col_get_distance_pixels (sheet, gsheet->col.first, left);
*y = gsheet->row_offset.first + item_cursor->cached_y = y =
gsheet->row_offset.first +
sheet_row_get_distance_pixels (sheet, gsheet->row.first, top); sheet_row_get_distance_pixels (sheet, gsheet->row.first, top);
item_cursor->cached_w = w =
*w = sheet_col_get_distance_pixels (sheet, left, right+1); sheet_col_get_distance_pixels (sheet, left, right+1);
*h = sheet_row_get_distance_pixels (sheet, top, bottom+1); item_cursor->cached_h = h =
} sheet_row_get_distance_pixels (sheet, top, bottom+1);
static void
item_cursor_configure_bounds (ItemCursor *item_cursor)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_cursor);
int x, y, w, h, extra;
item_cursor_get_pixel_coords (item_cursor, &x, &y, &w, &h);
item_cursor->cached_x = x;
item_cursor->cached_y = y;
item_cursor->cached_w = w;
item_cursor->cached_h = h;
item->x1 = x - 1; item->x1 = x - 1;
item->y1 = y - 1; item->y1 = y - 1;
...@@ -179,6 +178,15 @@ item_cursor_configure_bounds (ItemCursor *item_cursor) ...@@ -179,6 +178,15 @@ item_cursor_configure_bounds (ItemCursor *item_cursor)
item->y2 = y + h + 2 + extra; item->y2 = y + h + 2 + extra;
gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
/* Draw the new cursor */
item_cursor_request_redraw (item_cursor);
#if 0
fprintf (stderr, "update %d,%d %d,%d\n", x, y, w,h);
#endif
if (GNOME_CANVAS_ITEM_CLASS(item_cursor_parent_class)->update)
(*GNOME_CANVAS_ITEM_CLASS(item_cursor_parent_class)->update)(item, affine, clip_path, flags);
} }
/* /*
...@@ -194,8 +202,7 @@ static void ...@@ -194,8 +202,7 @@ static void
item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
{ {
ItemCursor *item_cursor = ITEM_CURSOR (item); ItemCursor *item_cursor = ITEM_CURSOR (item);
int xd, yd, dx0, dy0, dx1, dy1; int dx0, dy0, dx1, dy1;
int cursor_width, cursor_height, w, h;
GdkPoint points [40]; GdkPoint points [40];
int draw_external, draw_internal, draw_handle; int draw_external, draw_internal, draw_handle;
int draw_stippled, draw_center, draw_thick; int draw_stippled, draw_center, draw_thick;
...@@ -203,28 +210,22 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in ...@@ -203,28 +210,22 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in
GdkColor *fore = NULL, *back = NULL; GdkColor *fore = NULL, *back = NULL;
GdkRectangle clip_rect; GdkRectangle clip_rect;
int const xd = item_cursor->cached_x;
int const yd = item_cursor->cached_y;
int const w = item_cursor->cached_w;
int const h = item_cursor->cached_h;
#if 0
fprintf (stderr, "draw %d,%d %d,%d\n", xd, yd, w,h);
#endif
if (!item_cursor->visible) if (!item_cursor->visible)
return; return;
item_cursor_get_pixel_coords (item_cursor, &xd, &yd,
&cursor_width, &cursor_height);
w = cursor_width;
h = cursor_height;
/* determine if we need to recompute the bounding box */
if (xd != item_cursor->cached_x ||
yd != item_cursor->cached_y ||
w != item_cursor->cached_w ||
h != item_cursor->cached_h){
item_cursor_configure_bounds (item_cursor);
}
/* Top left and bottom right corner of cursor, in pixmap coordinates */ /* Top left and bottom right corner of cursor, in pixmap coordinates */
dx0 = xd - x; dx0 = xd - x;
dy0 = yd - y; dy0 = yd - y;
dx1 = dx0 + cursor_width; dx1 = dx0 + w;
dy1 = dy0 + cursor_height; dy1 = dy0 + h;
draw_external = 0; draw_external = 0;
draw_internal = 0; draw_internal = 0;
...@@ -411,19 +412,6 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in ...@@ -411,19 +412,6 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in
} }
} }
static void
item_cursor_request_redraw (ItemCursor *item_cursor)
{
GnomeCanvas *canvas = GNOME_CANVAS_ITEM (item_cursor)->canvas;
int x, y, w, h;
item_cursor_get_pixel_coords (item_cursor, &x, &y, &w, &h);
gnome_canvas_request_redraw (canvas, x - 2, y - 2, x + 2, y + h + 2);
gnome_canvas_request_redraw (canvas, x - 2, y - 2, x + w + 2, y + 2);
gnome_canvas_request_redraw (canvas, x + w - 2, y - 2, x + w + 5, y + h + 5);
gnome_canvas_request_redraw (canvas, x - 2, y + h - 2, x + w + 5, y + h + 5);
}
void void
item_cursor_set_bounds (ItemCursor *item_cursor, int start_col, int start_row, int end_col, int end_row) item_cursor_set_bounds (ItemCursor *item_cursor, int start_col, int start_row, int end_col, int end_row)
{ {
...@@ -437,17 +425,17 @@ item_cursor_set_bounds (ItemCursor *item_cursor, int start_col, int start_row, i ...@@ -437,17 +425,17 @@ item_cursor_set_bounds (ItemCursor *item_cursor, int start_col, int start_row, i
g_return_if_fail (end_row < SHEET_MAX_ROWS); g_return_if_fail (end_row < SHEET_MAX_ROWS);
g_return_if_fail (IS_ITEM_CURSOR (item_cursor)); g_return_if_fail (IS_ITEM_CURSOR (item_cursor));
/* Redraw the old area */
item = GNOME_CANVAS_ITEM (item_cursor); item = GNOME_CANVAS_ITEM (item_cursor);
item_cursor_request_redraw (item_cursor);
/* Move to the new area */
item_cursor->pos.start.col = start_col; item_cursor->pos.start.col = start_col;
item_cursor->pos.end.col = end_col; item_cursor->pos.end.col = end_col;
item_cursor->pos.start.row = start_row; item_cursor->pos.start.row = start_row;
item_cursor->pos.end.row = end_row; item_cursor->pos.end.row = end_row;
item_cursor_request_redraw (item_cursor); /* Request an update */
gnome_canvas_item_request_update (item);
item_cursor_configure_bounds (item_cursor);
} }
/** /**
...@@ -463,8 +451,8 @@ item_cursor_reposition (ItemCursor *item_cursor) ...@@ -463,8 +451,8 @@ item_cursor_reposition (ItemCursor *item_cursor)
g_return_if_fail (item != NULL); g_return_if_fail (item != NULL);
item_cursor_request_redraw (item_cursor); /* Request an update */
item_cursor_configure_bounds (item_cursor); gnome_canvas_item_request_update (item);
} }
static double static double
...@@ -763,7 +751,7 @@ item_cursor_set_bounds_visibly (ItemCursor *item_cursor, ...@@ -763,7 +751,7 @@ item_cursor_set_bounds_visibly (ItemCursor *item_cursor,
} }
void void
item_cursor_set_visibility (ItemCursor *item_cursor, int visible) item_cursor_set_visibility (ItemCursor *item_cursor, gboolean visible)
{ {
g_return_if_fail (IS_ITEM_CURSOR (item_cursor)); g_return_if_fail (IS_ITEM_CURSOR (item_cursor));
...@@ -771,7 +759,7 @@ item_cursor_set_visibility (ItemCursor *item_cursor, int visible) ...@@ -771,7 +759,7 @@ item_cursor_set_visibility (ItemCursor *item_cursor, int visible)
return; return;
item_cursor->visible = visible; item_cursor->visible = visible;
item_cursor_request_redraw (item_cursor); gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (item_cursor));
} }
void void
...@@ -1094,4 +1082,3 @@ item_cursor_get_type (void) ...@@ -1094,4 +1082,3 @@ item_cursor_get_type (void)
return item_cursor_type; return item_cursor_type;
} }
#ifndef GNUMERIC_ITEM_CURSOR_H #ifndef GNUMERIC_ITEM_CURSOR_H
#define GNUMERIC_ITEM_CURSOR_H #define GNUMERIC_ITEM_CURSOR_H
#include "sheet.h" #include "gnumeric.h"
#include "item-grid.h" #include "item-grid.h"
#define ITEM_CURSOR(obj) (GTK_CHECK_CAST((obj), item_cursor_get_type (), ItemCursor)) #define ITEM_CURSOR(obj) (GTK_CHECK_CAST((obj), item_cursor_get_type (), ItemCursor))
...@@ -65,14 +65,15 @@ typedef struct { ...@@ -65,14 +65,15 @@ typedef struct {
GnomeCanvasItemClass parent_class; GnomeCanvasItemClass parent_class;
} ItemCursorClass; } ItemCursorClass;
void item_cursor_set_bounds (ItemCursor *item_cursor, void item_cursor_set_bounds (ItemCursor *item_cursor,
int start_col, int start_row, int start_col, int start_row,
int end_col, int end_row); int end_col, int end_row);
void item_cursor_set_spin_base (ItemCursor *item_cursor, void item_cursor_set_spin_base (ItemCursor *item_cursor,
int col, int row); int col, int row);
void item_cursor_set_visibility (ItemCursor *item_cursor, void item_cursor_set_visibility (ItemCursor *item_cursor,
int visible); gboolean const visible);
void item_cursor_reposition (ItemCursor *item_cursor); void item_cursor_reposition (ItemCursor *item_cursor);
#endif /* GNUMERIC_ITEM_CURSOR_H */ #endif /* GNUMERIC_ITEM_CURSOR_H */
...@@ -370,6 +370,9 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int ...@@ -370,6 +370,9 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int
/* 2. the grids */ /* 2. the grids */
if (sheet->show_grid) { if (sheet->show_grid) {
#if 0
fprintf (stderr, "paint : %s%d:", col_name(paint_col), paint_row+1);
#endif
col = paint_col; col = paint_col;
x_paint = -diff_x; x_paint = -diff_x;
gdk_draw_line (drawable, grid_gc, x_paint, 0, x_paint, height); gdk_draw_line (drawable, grid_gc, x_paint, 0, x_paint, height);
...@@ -391,6 +394,9 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int ...@@ -391,6 +394,9 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int
gdk_draw_line (drawable, grid_gc, 0, y_paint, width, y_paint); gdk_draw_line (drawable, grid_gc, 0, y_paint, width, y_paint);
} }
} }
#if 0
fprintf (stderr, "%s%d\n", col_name(col-1), row);
#endif
} }
gdk_gc_set_function (item_grid->gc, GDK_COPY); gdk_gc_set_function (item_grid->gc, GDK_COPY);
...@@ -831,12 +837,6 @@ item_grid_button_1 (Sheet *sheet, GdkEvent *event, ItemGrid *item_grid, int col, ...@@ -831,12 +837,6 @@ item_grid_button_1 (Sheet *sheet, GdkEvent *event, ItemGrid *item_grid, int col,
*/ */
sheet_accept_pending_input (sheet); sheet_accept_pending_input (sheet);
if (!(event->button.state & GDK_SHIFT_MASK)) {
sheet_make_cell_visible (sheet, col, row);
/* Handle the selection localy */
sheet_cursor_move (sheet, col, row, FALSE, FALSE);
}
if (!(event->button.state & (GDK_CONTROL_MASK|GDK_SHIFT_MASK))) if (!(event->button.state & (GDK_CONTROL_MASK|GDK_SHIFT_MASK)))
sheet_selection_reset_only (sheet); sheet_selection_reset_only (sheet);
...@@ -844,8 +844,10 @@ item_grid_button_1 (Sheet *sheet, GdkEvent *event, ItemGrid *item_grid, int col, ...@@ -844,8 +844,10 @@ item_grid_button_1 (Sheet *sheet, GdkEvent *event, ItemGrid *item_grid, int col,
if ((event->button.state & GDK_SHIFT_MASK) && sheet->selections) if ((event->button.state & GDK_SHIFT_MASK) && sheet->selections)
sheet_selection_extend_to (sheet, col, row); sheet_selection_extend_to (sheet, col, row);
else else {
sheet_selection_add (sheet, col, row); sheet_selection_add (sheet, col, row);
sheet_make_cell_visible (sheet, col, row);
}
gnome_canvas_item_grab (item, gnome_canvas_item_grab (item,
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_MASK |
......
...@@ -77,7 +77,7 @@ sheet_selection_changed_hook (Sheet *sheet) ...@@ -77,7 +77,7 @@ sheet_selection_changed_hook (Sheet *sheet)
* @base_{col,row} : stationary corner of the newly selected range. * @base_{col,row} : stationary corner of the newly selected range.
* @move_{col,row} : moving corner of the newly selected range. * @move_{col,row} : moving corner of the newly selected range.
* *
* Prepends a new range to the selection list. * Prepends a range to the selection list and set the edit cursor.
*/ */
void void
sheet_selection_add_range (Sheet *sheet, sheet_selection_add_range (Sheet *sheet,
...@@ -90,32 +90,21 @@ sheet_selection_add_range (Sheet *sheet, ...@@ -90,32 +90,21 @@ sheet_selection_add_range (Sheet *sheet,
g_return_if_fail (sheet != NULL); g_return_if_fail (sheet != NULL);