Commit 534405d6 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

s/scg_stop_range_selection/scg_rangesel_stop/


2001-05-08  Jody Goldberg <jgoldberg@home.com>

	s/scg_stop_range_selection/scg_rangesel_stop/

	s/scg_set_cursor_bounds/scg_cursor_bound/
	s/scg_cursor_vertical_extend/scg_cursor_extend_v/
	s/scg_cursor_horizontal_extend/scg_cursor_extend_h/
	s/scg_cursor_vertical_move/scg_cursor_move_v/
	s/scg_cursor_horizontal_move/scg_cursor_move_h/
	s/scg_cursor_vertical_extend/scg_rangesel_extend_v/
	s/scg_cursor_horizontal_extend/scg_rangesel_extend_h/
	s/scg_cursor_vertical_move/scg_rangesel_move_v/
	s/scg_cursor_horizontal_move/scg_rangesel_move_h/

	* src/sheet-control-gui.[ch] : Move the rangesel info from
	  gnumeric-sheet into here in preparation for panes.
	(scg_rangesel_extend_v) : merge content from
	  gnumeric-sheet equivalent.
	(scg_rangesel_extend_h) : ditto.
	(scg_rangesel_move_v) : ditto.
	(scg_rangesel_move_h) : ditto.
	(scg_rangesel_start) : ditto.
	(scg_rangesel_stop) : ditto.
	(start_range_selection) : moved from gnumeric-sheet.
	(scg_rangesel_possible) : renamed from
	    gnumeric_sheet_can_select_expr_range.
	(scg_rangesel_changed) : renamed from scg_range_selection_changed
	  and make this the point that rationalizes the cursor points.
	(scg_cursor_bound) : renamed from scg_set_cursor_bounds
	  and make this the point that raionalizes the cursor points.
	(scg_ant) : changes to item_cursor_set_bounds.
	(scg_colrow_select) : rangesel support is now in scg.
	(scg_select_all) : ditto.

	* src/workbook-edit.c : cleanup includes.

	* src/item-grid.c (item_grid_event) : rangesel support is now in scg.
	(item_grid_button_1) : ditto.

	* src/item-cursor.h : privatize the structure and class.

	* src/item-cursor.c (cb_autofill_scroll) : changes to
	  item_cursor_set_bounds_visibly signature.
	(cb_move_cursor) : ditto.
	(item_cursor_set_bounds_visibly) : changes to item_cursor_set_bounds
	  signature.
	(item_cursor_selection_event) : ditto.
	(item_cursor_set_bounds) : simplify.

	* src/item-bar.c (is_pointer_on_division) : rangesel support is now in scg.

	* src/gnumeric-sheet.[ch] : move the rangesel logic up into scg.

2001-05-08  Jody Goldberg <jgoldberg@home.com>

	From Juan Pablo Mendoza <pablo_juan@yahoo.com>
	* src/sheet.c: (sheet_clone_colrow_info): Clone col and row
	  default size.
parent c4f2b99a
......@@ -8,6 +8,8 @@ release, and longer term bugs.
Release Critical
----------------
- col/row resize when zoomed
- Performance regression: navigating and (say) selecting an area in,
for example, statfuns.xls takes an embarrassingly long time.
......
......@@ -24,11 +24,16 @@ Jody:
* Support fractions.
* Fix printing of borders.
* Improve checking for array/merged region division.
* Prep for frozen panes.
Jon Kåre:
* New architecture for selecting cell ranges into dialogs.
* Fix dialog placement.
Juan Pablo Mendoza:
* Improve col and row sizing when cloning a cell.
* Catch many bugs with merged regions.
Morten:
* Changed a large number of dirty diapers.
* Plugged gnumeric leaks too.
......
2001-05-08 Jody Goldberg <jgoldberg@home.com>
* python.c (string_from_exception) : suppress warning.
2001-03-17 Jody Goldberg <jgoldberg@home.com>
* Release 0.64
......
......@@ -76,7 +76,7 @@ string_from_exception ()
if (!svalue)
goto cleanup;
if (pos + 3 < sizeof buf)
if (pos + 3 < (int)sizeof(buf))
snprintf (buf + pos , sizeof buf - pos , ": %s",
PyString_AsString (svalue));
}
......
2001-05-08 Jody Goldberg <jgoldberg@home.com>
* dialog-advanced-filter.c : cleanup includes.
2001-05-06 Morten Welinder <terra@diku.dk>
* dialog-cell-sort.c (order_box_get_text, string_pos_in_list):
......
......@@ -10,15 +10,11 @@
#include <gnome.h>
#include <glade/glade.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "func-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h"
#include "workbook.h"
#include "workbook-control.h"
#include "func.h"
#include "sheet.h"
#include "cell.h"
#include "ranges.h"
#include "func-util.h"
#include "gnumeric-util.h"
#include "analysis-tools.h"
#define OK 0
......
This diff is collapsed.
......@@ -11,6 +11,7 @@
#define GNUMERIC_SHEET_FACTOR_X 1000000
#define GNUMERIC_SHEET_FACTOR_Y 2000000
/* FIXME : standardize names (gnm_canvas_ ?) */
struct _GnumericSheet {
GnomeCanvas canvas;
......@@ -21,67 +22,34 @@ struct _GnumericSheet {
} row, col, row_offset, col_offset;
ItemGrid *item_grid;
ItemCursor *item_cursor;
ItemEdit *item_editor;
/*
* This flag keeps track of a cell selector
* (ie, when the user uses the cursor keys
* to select a cell for an expression).
*/
gboolean selecting_cell;
int sel_cursor_pos;
int sel_text_len;
ItemCursor *sel_cursor;
ItemCursor *item_cursor;
ItemCursor *sel_cursor;
/* Input context for dead key support */
GdkIC *ic;
GdkICAttr *ic_attr;
};
GtkType gnumeric_sheet_get_type (void);
GtkWidget *gnumeric_sheet_new (SheetControlGUI *sheet);
void gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_first_row);
void gnumeric_sheet_set_left_col (GnumericSheet *gsheet, int new_first_col);
gboolean gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet);
void gnumeric_sheet_set_cursor_bounds (GnumericSheet *gsheet,
int start_col, int start_row,
int end_col, int end_row);
void gsheet_compute_visible_region (GnumericSheet *gsheet,
gboolean const full_recompute);
void gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet,
int col, int row,
gboolean const force_scroll);
void gnumeric_sheet_create_editor (GnumericSheet *gsheet);
void gnumeric_sheet_stop_editing (GnumericSheet *gsheet);
/* Managing the selection of cell ranges when editing a formula */
void gnumeric_sheet_start_range_selection (GnumericSheet *gsheet,
int col, int row);
void gnumeric_sheet_stop_range_selection (GnumericSheet *gsheet);
void gnumeric_sheet_rangesel_cursor_bounds (GnumericSheet *gsheet,
int base_col, int base_row,
int move_col, int move_row);
void gnumeric_sheet_rangesel_cursor_extend (GnumericSheet *gsheet,
int col, int row);
void gnumeric_sheet_rangesel_horizontal_move (
GnumericSheet *gsheet, int dir, gboolean jump_to_boundaries);
void gnumeric_sheet_rangesel_vertical_move (
GnumericSheet *gsheet, int dir, gboolean jump_to_boundaries);
void gnumeric_sheet_rangesel_horizontal_extend (
GnumericSheet *gsheet, int n, gboolean jump_to_boundaries);
void gnumeric_sheet_rangesel_vertical_extend (
GnumericSheet *gsheet, int n, gboolean jump_to_boundaries);
int gnumeric_sheet_find_col (GnumericSheet *item_grid,
int x, int *col_origin);
int gnumeric_sheet_find_row (GnumericSheet *item_grid,
int y, int *row_origin);
typedef struct {
GnomeCanvasClass parent_class;
} GnumericSheetClass;
GtkType gnumeric_sheet_get_type (void);
GtkWidget *gnumeric_sheet_new (SheetControlGUI *sheet);
void gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_first_row);
void gnumeric_sheet_set_left_col (GnumericSheet *gsheet, int new_first_col);
int gnumeric_sheet_find_col (GnumericSheet *gsheet, int x, int *col_origin);
int gnumeric_sheet_find_row (GnumericSheet *gsheet, int y, int *row_origin);
void gnumeric_sheet_create_editor (GnumericSheet *gsheet);
void gnumeric_sheet_stop_editing (GnumericSheet *gsheet);
void gnumeric_sheet_cursor_bound (GnumericSheet *gsheet, Range const *r);
void gnumeric_sheet_rangesel_bound (GnumericSheet *gsheet, Range const *r);
void gnumeric_sheet_rangesel_start (GnumericSheet *gsheet, int col, int row);
void gnumeric_sheet_rangesel_stop (GnumericSheet *gsheet);
void gsheet_compute_visible_region (GnumericSheet *gsheet,
gboolean const full_recompute);
void gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet,
int col, int row,
gboolean const force_scroll);
#endif /* GNUMERIC_GNUMERIC_SHEET_H */
This diff is collapsed.
......@@ -11,6 +11,7 @@
#define GNUMERIC_SHEET_FACTOR_X 1000000
#define GNUMERIC_SHEET_FACTOR_Y 2000000
/* FIXME : standardize names (gnm_canvas_ ?) */
struct _GnumericSheet {
GnomeCanvas canvas;
......@@ -21,67 +22,34 @@ struct _GnumericSheet {
} row, col, row_offset, col_offset;
ItemGrid *item_grid;
ItemCursor *item_cursor;
ItemEdit *item_editor;
/*
* This flag keeps track of a cell selector
* (ie, when the user uses the cursor keys
* to select a cell for an expression).
*/
gboolean selecting_cell;
int sel_cursor_pos;
int sel_text_len;
ItemCursor *sel_cursor;
ItemCursor *item_cursor;
ItemCursor *sel_cursor;
/* Input context for dead key support */
GdkIC *ic;
GdkICAttr *ic_attr;
};
GtkType gnumeric_sheet_get_type (void);
GtkWidget *gnumeric_sheet_new (SheetControlGUI *sheet);
void gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_first_row);
void gnumeric_sheet_set_left_col (GnumericSheet *gsheet, int new_first_col);
gboolean gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet);
void gnumeric_sheet_set_cursor_bounds (GnumericSheet *gsheet,
int start_col, int start_row,
int end_col, int end_row);
void gsheet_compute_visible_region (GnumericSheet *gsheet,
gboolean const full_recompute);
void gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet,
int col, int row,
gboolean const force_scroll);
void gnumeric_sheet_create_editor (GnumericSheet *gsheet);
void gnumeric_sheet_stop_editing (GnumericSheet *gsheet);
/* Managing the selection of cell ranges when editing a formula */
void gnumeric_sheet_start_range_selection (GnumericSheet *gsheet,
int col, int row);
void gnumeric_sheet_stop_range_selection (GnumericSheet *gsheet);
void gnumeric_sheet_rangesel_cursor_bounds (GnumericSheet *gsheet,
int base_col, int base_row,
int move_col, int move_row);
void gnumeric_sheet_rangesel_cursor_extend (GnumericSheet *gsheet,
int col, int row);
void gnumeric_sheet_rangesel_horizontal_move (
GnumericSheet *gsheet, int dir, gboolean jump_to_boundaries);
void gnumeric_sheet_rangesel_vertical_move (
GnumericSheet *gsheet, int dir, gboolean jump_to_boundaries);
void gnumeric_sheet_rangesel_horizontal_extend (
GnumericSheet *gsheet, int n, gboolean jump_to_boundaries);
void gnumeric_sheet_rangesel_vertical_extend (
GnumericSheet *gsheet, int n, gboolean jump_to_boundaries);
int gnumeric_sheet_find_col (GnumericSheet *item_grid,
int x, int *col_origin);
int gnumeric_sheet_find_row (GnumericSheet *item_grid,
int y, int *row_origin);
typedef struct {
GnomeCanvasClass parent_class;
} GnumericSheetClass;
GtkType gnumeric_sheet_get_type (void);
GtkWidget *gnumeric_sheet_new (SheetControlGUI *sheet);
void gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_first_row);
void gnumeric_sheet_set_left_col (GnumericSheet *gsheet, int new_first_col);
int gnumeric_sheet_find_col (GnumericSheet *gsheet, int x, int *col_origin);
int gnumeric_sheet_find_row (GnumericSheet *gsheet, int y, int *row_origin);
void gnumeric_sheet_create_editor (GnumericSheet *gsheet);
void gnumeric_sheet_stop_editing (GnumericSheet *gsheet);
void gnumeric_sheet_cursor_bound (GnumericSheet *gsheet, Range const *r);
void gnumeric_sheet_rangesel_bound (GnumericSheet *gsheet, Range const *r);
void gnumeric_sheet_rangesel_start (GnumericSheet *gsheet, int col, int row);
void gnumeric_sheet_rangesel_stop (GnumericSheet *gsheet);
void gsheet_compute_visible_region (GnumericSheet *gsheet,
gboolean const full_recompute);
void gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet,
int col, int row,
gboolean const force_scroll);
#endif /* GNUMERIC_GNUMERIC_SHEET_H */
......@@ -529,7 +529,6 @@ item_bar_translate (GnomeCanvasItem *item, double dx, double dy)
static ColRowInfo *
is_pointer_on_division (ItemBar const *item_bar, int pos, int *the_total, int *the_element)
{
GnumericSheet * const gsheet = GNUMERIC_SHEET (item_bar->scg->canvas);
Sheet *sheet = item_bar->scg->sheet;
ColRowInfo *cri;
int i, total = 0;
......@@ -555,11 +554,11 @@ is_pointer_on_division (ItemBar const *item_bar, int pos, int *the_total, int *t
total += cri->size_pixels;
/* TODO : This is more expensive than it needs to be.
* We should really set a flag (in gsheet ?) and adjust
* We should really set a flag (in scg ?) and adjust
* it as the cursor in the entry is moved. The current
* approach recalculates the state every time.
*/
if (!gnumeric_sheet_can_select_expr_range (gsheet) &&
if (!scg_rangesel_possible (item_bar->scg) &&
(total - 4 < pos) && (pos < total + 4)) {
if (the_total)
*the_total = total;
......
......@@ -25,7 +25,7 @@
#include "ranges.h"
#include <gal/widgets/e-cursors.h>
static GnomeCanvasItem *item_cursor_parent_class;
#define ITEM_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_cursor_get_type (), ItemCursorClass))
#define AUTO_HANDLE_SPACE 4
#define CLIP_SAFETY_MARGIN (AUTO_HANDLE_SPACE + 5)
......@@ -34,7 +34,48 @@ static GnomeCanvasItem *item_cursor_parent_class;
((item->auto_fill_handle_at_top && ((y) < (item)->canvas_item.y1 + 6)) || \
((y) > (item)->canvas_item.y2 - 6)))
/* The argument we take */
struct _ItemCursor {
GnomeCanvasItem canvas_item;
SheetControlGUI *scg;
Range pos;
/* Offset of dragging cell from top left of pos */
int col_delta, row_delta;
/* Tip for movement */
GtkWidget *tip;
ItemCursorStyle style;
GdkGC *gc;
int state;
int animation_timer;
/*
* For the autofill mode:
* Where the action started (base_x, base_y) and the
* width and heigth of the selection when the autofill
* started.
*/
CellPos base;
int base_x, base_y;
int base_cols, base_rows;
/* Cached values of the last bounding box information used */
int cached_x, cached_y, cached_w, cached_h;
int visible:1;
int use_color:1;
/* Location of auto fill handle */
int auto_fill_handle_at_top:1;
int drag_button;
GdkPixmap *stipple;
GdkColor color;
};
static GnomeCanvasItem *item_cursor_parent_class;
enum {
ARG_0,
ARG_SHEET_CONTROL_GUI, /* The SheetControlGUI * argument */
......@@ -437,46 +478,15 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in
}
gboolean
item_cursor_set_bounds (ItemCursor *ic,
int base_col, int base_row,
int move_col, int move_row)
item_cursor_set_bounds (ItemCursor *ic, Range const *new_bound)
{
Range r;
g_return_val_if_fail (IS_ITEM_CURSOR (ic), FALSE);
g_return_val_if_fail (range_is_sane (new_bound), FALSE);
/* Nothing changed */
if (ic->base_corner.col == base_col &&
ic->base_corner.row == base_row &&
ic->move_corner.col == move_col &&
ic->move_corner.row == move_row)
if (range_equal (&ic->pos, new_bound))
return FALSE;
if (base_col <= move_col) {
r.start.col = base_col;
r.end.col = move_col;
} else {
r.end.col = base_col;
r.start.col = move_col;
}
if (base_row <= move_row) {
r.start.row = base_row;
r.end.row = move_row;
} else {
r.end.row = base_row;
r.start.row = move_row;
}
g_return_val_if_fail (r.start.col >= 0, FALSE);
g_return_val_if_fail (r.start.row >= 0, FALSE);
g_return_val_if_fail (r.end.col < SHEET_MAX_COLS, FALSE);
g_return_val_if_fail (r.end.row < SHEET_MAX_ROWS, FALSE);
ic->pos = r;
ic->base_corner.col = base_col;
ic->base_corner.row = base_row;
ic->move_corner.col = move_col;
ic->move_corner.row = move_row;
ic->pos = *new_bound;
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ic));
......@@ -652,9 +662,7 @@ item_cursor_selection_event (GnomeCanvasItem *item, GdkEvent *event)
ITEM_CURSOR (new_item)->row_delta = d_row;
}
if (item_cursor_set_bounds (ITEM_CURSOR (new_item),
ic->base_corner.col, ic->base_corner.row,
ic->move_corner.col, ic->move_corner.row))
if (item_cursor_set_bounds (ITEM_CURSOR (new_item), &ic->pos))
gnome_canvas_update_now (canvas);
gnome_canvas_item_grab (
......@@ -966,11 +974,12 @@ item_cursor_do_drop (ItemCursor *ic, GdkEventButton *event)
static void
item_cursor_set_bounds_visibly (ItemCursor *item_cursor,
int visible_col,int visible_row,
int start_col, int start_row,
int end_col, int end_row)
CellPos const *corner,
int end_col, int end_row)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_cursor);
GnumericSheet *gsheet = GNUMERIC_SHEET (item->canvas);
Range r;
/*
* FIXME FIXME FIXME
......@@ -980,7 +989,8 @@ item_cursor_set_bounds_visibly (ItemCursor *item_cursor,
* We are forced to make the region visible before we move the cursor.
*/
gnumeric_sheet_make_cell_visible (gsheet, visible_col, visible_row, FALSE);
if (item_cursor_set_bounds (item_cursor, start_col, start_row, end_col, end_row))
range_init (&r, corner->col, corner->row, end_col, end_row);
if (item_cursor_set_bounds (item_cursor, &r))
gnome_canvas_update_now (GNOME_CANVAS (gsheet));
}
......@@ -1038,18 +1048,19 @@ cb_move_cursor (SheetControlGUI *scg, int col, int row, gpointer user_data)
ItemCursor *item_cursor = user_data;
int const w = (item_cursor->pos.end.col - item_cursor->pos.start.col);
int const h = (item_cursor->pos.end.row - item_cursor->pos.start.row);
int corner_left = col - item_cursor->col_delta;
int corner_top = row - item_cursor->row_delta;
if (corner_left < 0)
corner_left = 0;
else if (corner_left >= (SHEET_MAX_COLS - w))
corner_left = SHEET_MAX_COLS - w - 1;
if (corner_top < 0)
corner_top = 0;
else if (corner_top >= (SHEET_MAX_ROWS - h))
corner_top = SHEET_MAX_ROWS - h - 1;
CellPos corner;
corner.col = col - item_cursor->col_delta;
if (corner.col < 0)
corner.col = 0;
else if (corner.col >= (SHEET_MAX_COLS - w))
corner.col = SHEET_MAX_COLS - w - 1;
corner.row = row - item_cursor->row_delta;
if (corner.row < 0)
corner.row = 0;
else if (corner.row >= (SHEET_MAX_ROWS - h))
corner.row = SHEET_MAX_ROWS - h - 1;
#if 0
/*
......@@ -1060,9 +1071,8 @@ cb_move_cursor (SheetControlGUI *scg, int col, int row, gpointer user_data)
#endif
/* Make target cell visible, and adjust the cursor size */
item_cursor_set_bounds_visibly (item_cursor, col, row,
corner_left, corner_top,
corner_left + w, corner_top + h);
item_cursor_set_bounds_visibly (item_cursor, col, row, &corner,
corner.row + w, corner.row + h);
return FALSE;
}
......@@ -1166,9 +1176,7 @@ cb_autofill_scroll (SheetControlGUI *scg, int col, int row, gpointer user_data)
col = item_cursor->base.col;
item_cursor_set_bounds_visibly (item_cursor, col, row,
item_cursor->base.col,
item_cursor->base.row,
right, bottom);
&item_cursor->base, right, bottom);
return FALSE;
}
......@@ -1315,6 +1323,10 @@ item_cursor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
}
}
typedef struct {
GnomeCanvasItemClass parent_class;
} ItemCursorClass;
/*
* ItemCursor class initialization
*/
......
......@@ -4,7 +4,6 @@
#include "gui-gnumeric.h"
#define ITEM_CURSOR(obj) (GTK_CHECK_CAST((obj), item_cursor_get_type (), ItemCursor))
#define ITEM_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_cursor_get_type (), ItemCursorClass))
#define IS_ITEM_CURSOR(o) (GTK_CHECK_TYPE((o), item_cursor_get_type ()))
typedef enum {
......@@ -16,61 +15,10 @@ typedef enum {
ITEM_CURSOR_BLOCK
} ItemCursorStyle;
struct _ItemCursor {
GnomeCanvasItem canvas_item;
SheetControlGUI *scg;
Range pos;
CellPos base_corner; /* Corner remains static when rubber banding */
CellPos move_corner; /* Corner to move when extending */
/* Offset of dragging cell from top left of pos */
int col_delta, row_delta;
/* Tip for movement */
GtkWidget *tip;
ItemCursorStyle style;
GdkGC *gc;
int state;
int animation_timer;
/*
* For the autofill mode:
* Where the action started (base_x, base_y) and the
* width and heigth of the selection when the autofill
* started.
*/
CellPos base;
int base_x, base_y;
int base_cols, base_rows;
/* Cached values of the last bounding box information used */
int cached_x, cached_y, cached_w, cached_h;
int visible:1;
int use_color:1;
/* Location of auto fill handle */
int auto_fill_handle_at_top:1;
int drag_button;
GdkPixmap *stipple;
GdkColor color;
};
GtkType item_cursor_get_type (void);
typedef struct {
GnomeCanvasItemClass parent_class;
} ItemCursorClass;
gboolean item_cursor_set_bounds (ItemCursor *item_cursor,
int base_col, int base_row,
int move_col, int move_row);
void item_cursor_set_visibility (ItemCursor *item_cursor,
gboolean const visible);
void item_cursor_reposition (ItemCursor *item_cursor);
gboolean item_cursor_set_bounds (ItemCursor *ic, Range const *new_bound);
void item_cursor_set_visibility (ItemCursor *ic, gboolean visible);
void item_cursor_reposition (ItemCursor *ic);
#endif /* GNUMERIC_ITEM_CURSOR_H */
......@@ -117,11 +117,11 @@ point_is_inside_range (ItemEdit *item_edit, const char *text, Range *range)
}
static void
entry_create_feedback_range (ItemEdit *item_edit, Range *range)
entry_create_feedback_range (ItemEdit *item_edit, Range *r)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_edit);
if (!item_edit->feedback_cursor){
if (!item_edit->feedback_cursor)
item_edit->feedback_cursor = gnome_canvas_item_new (
GNOME_CANVAS_GROUP (item->canvas->root),
item_cursor_get_type (),
......@@ -129,12 +129,8 @@ entry_create_feedback_range (ItemEdit *item_edit, Range *range)
"Style", ITEM_CURSOR_BLOCK,
"Color", "red",
NULL);
}
item_cursor_set_bounds (
ITEM_CURSOR (item_edit->feedback_cursor),
range->start.col, range->start.row,
range->end.col, range->end.row);
item_cursor_set_bounds (ITEM_CURSOR (item_edit->feedback_cursor), r);
}
static void
......
......@@ -744,13 +744,12 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event,
if (!workbook_edit_has_guru (scg->wbcg))
scg_mode_edit (scg);
} else
wb_control_gui_focus_cur_sheet (gsheet->scg->wbcg);
wb_control_gui_focus_cur_sheet (scg->wbcg);
/*
* If we were already selecting a range of cells for a formula,
/* If we were already selecting a range of cells for a formula,
* reset the location to a new place, or extend the selection.
*/
if (gsheet->selecting_cell) {
if (scg->rangesel.active) {
ig->selecting = ITEM_GRID_SELECTING_FORMULA_RANGE;
if (event->state & GDK_SHIFT_MASK)
scg_rangesel_cursor_extend (scg, col, row);
......@@ -764,13 +763,11 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event,
return 1;
}
/*
* If the user is editing a formula
* (gnumeric_sheet_can_select_expr_range) then we enable the dynamic
* cell selection mode.
/* If the user is editing a formula (scg_rangesel_possible) then we
* enable the dynamic cell selection mode.
*/
if (gnumeric_sheet_can_select_expr_range (gsheet)){
scg_start_range_selection (scg, col, row);
if (scg_rangesel_possible (scg)) {
scg_rangesel_start (scg, col, row);
ig->selecting = ITEM_GRID_SELECTING_FORMULA_RANGE;
gnome_canvas_item_grab (item,
GDK_POINTER_MOTION_MASK |
......@@ -781,13 +778,13 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event,
}
/* While a guru is up ignore clicks */
if (workbook_edit_has_guru (gsheet->scg->wbcg))
if (workbook_edit_has_guru (scg->wbcg))
return 1;
/* This was a regular click on a cell on the spreadsheet. Select it.
* but only if the entered expression is valid
*/
if (workbook_finish_editing (gsheet->scg->wbcg, TRUE) == FALSE)
if (workbook_finish_editing (scg->wbcg, TRUE) == FALSE)
return 1;
if (!(event->state & (GDK_CONTROL_MASK|GDK_SHIFT_MASK)))
......@@ -965,7 +962,7 @@ item_grid_event (GnomeCanvasItem *item, GdkEvent *event)
if (event->button.button == 1)
return item_grid_button_1 (scg, &event->button,
ig, col, row, x, y);
if (workbook_edit_has_guru (gsheet->scg->wbcg))
if (workbook_edit_has_guru (scg->wbcg))
return TRUE;
switch (event->button.button) {
......
/* vim: set sw=8: */
/*
* sheet-control-gui.c: Implements a graphic control for a sheet.
*
......@@ -396,8 +397,7 @@ static void
scg_select_all (SheetControlGUI *scg)
{
Sheet *sheet = scg->sheet;
GnumericSheet *gsheet = GNUMERIC_SHEET (scg->canvas);
gboolean const rangesel = gnumeric_sheet_can_select_expr_range (gsheet);
gboolean const rangesel = scg_rangesel_possible (scg);
if (!rangesel) {
if (!workbook_edit_has_guru (scg->wbcg)) {
......@@ -405,8 +405,8 @@ scg_select_all (SheetControlGUI *scg)
cmd_select_all (scg->sheet);
}
} else {
if (!gsheet->selecting_cell)
gnumeric_sheet_start_range_selection (gsheet, 0, 0);
if (!scg->rangesel.active)
scg_rangesel_start (scg, 0, 0);
scg_rangesel_cursor_bounds (
scg, 0, 0, SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1);
sheet_update (sheet);
......@@ -419,13 +419,13 @@ scg_colrow_select (SheetControlGUI *scg, gboolean is_cols,
{
Sheet *sheet = scg->sheet;
GnumericSheet *gsheet = GNUMERIC_SHEET (scg->canvas);
gboolean const rangesel = gnumeric_sheet_can_select_expr_range (gsheet);
gboolean const rangesel = scg_rangesel_possible (scg);
if (!rangesel)
workbook_finish_editing (scg->wbcg, FALSE);
if (rangesel && !gsheet->selecting_cell)
gnumeric_sheet_start_range_selection (gsheet, index, index);
if (rangesel && !scg->rangesel.active)
scg_rangesel_start (scg, index, index);
if (modifiers & GDK_SHIFT_MASK) {
if (is_cols) {
......@@ -655,7 +655,7 @@ scg_destroy (GtkObject *object)
if (scg->wbcg) {
GtkWindow *toplevel = wb_control_gui_toplevel (scg->wbcg);
if (toplevel && (toplevel->focus_widget == scg->canvas))
gtk_window_set_focus (toplevel, NULL);
}
......@@ -717,10 +717,7 @@ scg_ant (SheetControlGUI *scg)
"SheetControlGUI", scg,
"Style", ITEM_CURSOR_ANTED,
NULL));
item_cursor_set_bounds (
item_cursor,
ss->start.col, ss->start.row,
ss->end.col, ss->end.row);
item_cursor_set_bounds (item_cursor, ss);
scg->anted_cursors = g_list_prepend (scg->anted_cursors, item_cursor);
}
......@@ -1104,7 +1101,7 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
if (r->start.col == 0 && r->end.col == SHEET_MAX_COLS - 1)
sensitivity_filter |= CONTEXT_DISABLE_FOR_COLS;
}
gnumeric_create_popup_menu (popup_elements, &context_menu_hander,
scg, display_filter,
sensitivity_filter, event);
......@@ -1560,7 +1557,7 @@ scg_object_update_bbox (SheetControlGUI *scg, SheetObject *so,
{
double l, t, r ,b;
GtkObject *so_view_obj;
g_return_if_fail (IS_SHEET_CONTROL_GUI (scg));