Commit 5c4ebb73 authored by Arturo Espinosa's avatar Arturo Espinosa
Browse files

Ok, fixed the problems with the bounds in the ItemCursor, but i still cant



Ok, fixed the problems with the bounds in the ItemCursor,
but i still cant get events after I do a gnome_canvas_grab
for the case of the dragging selection.
parent baa8310a
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
gnumeric_sheet_accept_pending_output before moving the cursor.
* src/item-cursor.c (item_cursor_event): Event handler for the * src/item-cursor.c (item_cursor_event): Event handler for the
item_cursors. item_cursors.
......
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
gnumeric_sheet_accept_pending_output before moving the cursor.
* src/item-cursor.c (item_cursor_event): Event handler for the * src/item-cursor.c (item_cursor_event): Event handler for the
item_cursors. item_cursors.
......
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
gnumeric_sheet_accept_pending_output before moving the cursor.
* src/item-cursor.c (item_cursor_event): Event handler for the * src/item-cursor.c (item_cursor_event): Event handler for the
item_cursors. item_cursors.
......
1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-08-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_event): Call
gnumeric_sheet_accept_pending_output before moving the cursor.
* src/item-cursor.c (item_cursor_event): Event handler for the * src/item-cursor.c (item_cursor_event): Event handler for the
item_cursors. item_cursors.
......
...@@ -627,7 +627,8 @@ gnumeric_sheet_new (Sheet *sheet, ItemBar *colbar, ItemBar *rowbar) ...@@ -627,7 +627,8 @@ gnumeric_sheet_new (Sheet *sheet, ItemBar *colbar, ItemBar *rowbar)
"ItemCursor::Grid", gsheet->item_grid, "ItemCursor::Grid", gsheet->item_grid,
NULL); NULL);
gsheet->item_cursor = ITEM_CURSOR (item); gsheet->item_cursor = ITEM_CURSOR (item);
item_cursor_set_bounds (gsheet->item_cursor, 0, 0, 1, 1);
widget = GTK_WIDGET (gsheet); widget = GTK_WIDGET (gsheet);
return widget; return widget;
......
...@@ -627,7 +627,8 @@ gnumeric_sheet_new (Sheet *sheet, ItemBar *colbar, ItemBar *rowbar) ...@@ -627,7 +627,8 @@ gnumeric_sheet_new (Sheet *sheet, ItemBar *colbar, ItemBar *rowbar)
"ItemCursor::Grid", gsheet->item_grid, "ItemCursor::Grid", gsheet->item_grid,
NULL); NULL);
gsheet->item_cursor = ITEM_CURSOR (item); gsheet->item_cursor = ITEM_CURSOR (item);
item_cursor_set_bounds (gsheet->item_cursor, 0, 0, 1, 1);
widget = GTK_WIDGET (gsheet); widget = GTK_WIDGET (gsheet);
return widget; return widget;
......
...@@ -118,12 +118,38 @@ item_cursor_get_pixel_coords (ItemCursor *item_cursor, int *x, int *y, int *w, i ...@@ -118,12 +118,38 @@ item_cursor_get_pixel_coords (ItemCursor *item_cursor, int *x, int *y, int *w, i
*h = sheet_row_get_distance (sheet, item_cursor->start_row, item_cursor->end_row+1); *h = sheet_row_get_distance (sheet, item_cursor->start_row, item_cursor->end_row+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->y1 = y - 1;
if (item_cursor->style == ITEM_CURSOR_SELECTION)
extra = 1;
else
extra = 0;
item->x2 = x + w + 1 + extra;
item->y2 = y + h + 1 + extra;
gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
}
static void 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, dx, dy; int xd, yd, dx, dy;
int cursor_width, cursor_height; int cursor_width, cursor_height, w, h;
GdkPoint points [40]; GdkPoint points [40];
int draw_external, draw_internal, draw_handle, draw_center, draw_thick; int draw_external, draw_internal, draw_handle, draw_center, draw_thick;
int premove; int premove;
...@@ -132,6 +158,17 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in ...@@ -132,6 +158,17 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in
item_cursor_get_pixel_coords (item_cursor, &xd, &yd, item_cursor_get_pixel_coords (item_cursor, &xd, &yd,
&cursor_width, &cursor_height); &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);
}
dx = xd - x; dx = xd - x;
dy = yd - y; dy = yd - y;
...@@ -253,8 +290,6 @@ void ...@@ -253,8 +290,6 @@ 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)
{ {
GnomeCanvasItem *item; GnomeCanvasItem *item;
int x, y, w, h;
int extra = 0;
g_return_if_fail (start_col <= end_col); g_return_if_fail (start_col <= end_col);
g_return_if_fail (start_row <= end_row); g_return_if_fail (start_row <= end_row);
...@@ -270,17 +305,8 @@ item_cursor_set_bounds (ItemCursor *item_cursor, int start_col, int start_row, i ...@@ -270,17 +305,8 @@ item_cursor_set_bounds (ItemCursor *item_cursor, int start_col, int start_row, i
item_cursor->end_row = end_row; item_cursor->end_row = end_row;
item_cursor_request_redraw (item_cursor); item_cursor_request_redraw (item_cursor);
item_cursor_get_pixel_coords (item_cursor, &x, &y, &w, &h);
item->x1 = x - 1;
item->y1 = y - 1;
if (item_cursor->style == ITEM_CURSOR_SELECTION)
extra = 1;
item->x2 = x + w + 1 + extra;
item->y2 = y + h + 1 + extra;
gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); item_cursor_configure_bounds (item_cursor);
} }
static double static double
......
...@@ -25,6 +25,9 @@ typedef struct { ...@@ -25,6 +25,9 @@ typedef struct {
GdkGC *gc; GdkGC *gc;
int state; int state;
int tag; int tag;
/* Cached values of the last bounding box information used */
int cached_x, cached_y, cached_w, cached_h;
} ItemCursor; } ItemCursor;
GtkType item_cursor_get_type (void); GtkType item_cursor_get_type (void);
......
...@@ -14,7 +14,7 @@ main (int argc, char *argv []) ...@@ -14,7 +14,7 @@ main (int argc, char *argv [])
constants_init (); constants_init ();
functions_init (); functions_init ();
current_workbook = workbook_new_with_sheets (2); current_workbook = workbook_new_with_sheets (1);
gtk_widget_show (current_workbook->toplevel); gtk_widget_show (current_workbook->toplevel);
gtk_main (); gtk_main ();
......
...@@ -14,7 +14,7 @@ main (int argc, char *argv []) ...@@ -14,7 +14,7 @@ main (int argc, char *argv [])
constants_init (); constants_init ();
functions_init (); functions_init ();
current_workbook = workbook_new_with_sheets (2); current_workbook = workbook_new_with_sheets (1);
gtk_widget_show (current_workbook->toplevel); gtk_widget_show (current_workbook->toplevel);
gtk_main (); gtk_main ();
......
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