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

update the edit_pos if necessary.


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

	* src/sheet-merge.c (sheet_merge_add) : update the edit_pos if
	  necessary.

	* src/sheet.c (sheet_update_only_grid) : fix typo.
parent 8cadb36c
2001-05-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet-merge.c (sheet_merge_add) : update the edit_pos if
necessary.
* src/sheet.c (sheet_update_only_grid) : fix typo.
2001-05-05 Almer S. Tigelaar <almer@gnome.org>
* src/item-bar.[ch]:
......
2001-05-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet-merge.c (sheet_merge_add) : update the edit_pos if
necessary.
* src/sheet.c (sheet_update_only_grid) : fix typo.
2001-05-05 Almer S. Tigelaar <almer@gnome.org>
* src/item-bar.[ch]:
......
2001-05-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet-merge.c (sheet_merge_add) : update the edit_pos if
necessary.
* src/sheet.c (sheet_update_only_grid) : fix typo.
2001-05-05 Almer S. Tigelaar <almer@gnome.org>
* src/item-bar.[ch]:
......
2001-05-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet-merge.c (sheet_merge_add) : update the edit_pos if
necessary.
* src/sheet.c (sheet_update_only_grid) : fix typo.
2001-05-05 Almer S. Tigelaar <almer@gnome.org>
* src/item-bar.[ch]:
......
2001-05-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet-merge.c (sheet_merge_add) : update the edit_pos if
necessary.
* src/sheet.c (sheet_update_only_grid) : fix typo.
2001-05-05 Almer S. Tigelaar <almer@gnome.org>
* src/item-bar.[ch]:
......
/* vim: set sw=8: */
/*
* The Cursor Canvas Item: Implements a rectangular cursor
*
* Author:
* Miguel de Icaza (miguel@kernel.org)
* Jody Goldberg (jgoldberg@home.com)
*/
#include <config.h>
......@@ -628,29 +630,25 @@ item_cursor_selection_event (GnomeCanvasItem *item, GdkEvent *event)
* selection was offset by one.
*/
{
int d_col =
gnumeric_sheet_find_col (gsheet, x, NULL) -
ic->pos.start.col;
int d_row =
gnumeric_sheet_find_row (gsheet, y, NULL) -
ic->pos.start.row;
if (d_col < 0)
d_col = 0;
else {
int d_col = gnumeric_sheet_find_col (gsheet, x, NULL) -
ic->pos.start.col;
int d_row = gnumeric_sheet_find_row (gsheet, y, NULL) -
ic->pos.start.row;
if (d_col >= 0) {
int tmp = ic->pos.end.col - ic->pos.start.col;
if (d_col > tmp)
d_col = tmp;
}
} else
d_col = 0;
ITEM_CURSOR (new_item)->col_delta = d_col;
if (d_row < 0)
d_row = 0;
else {
if (d_row >= 0) {
int tmp = ic->pos.end.row - ic->pos.start.row;
if (d_row > tmp)
d_row = tmp;
}
} else
d_row = 0;
ITEM_CURSOR (new_item)->row_delta = d_row;
}
......@@ -967,9 +965,9 @@ item_cursor_do_drop (ItemCursor *ic, GdkEventButton *event)
static void
item_cursor_set_bounds_visibly (ItemCursor *item_cursor,
int const visible_col, int const visible_row,
int const start_col, int const start_row,
int const end_col, int const end_row)
int visible_col,int visible_row,
int start_col, int start_row,
int end_col, int end_row)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_cursor);
GnumericSheet *gsheet = GNUMERIC_SHEET (item->canvas);
......
......@@ -416,14 +416,13 @@ set_menu_flags:
* insert row/cols and the flags accordingly.
*/
do_rows = do_cols = TRUE;
for (list = sheet->selections; list && (do_cols || do_rows); list = list->next){
Range *r = list->data;
for (list = sheet->selections; list && (do_cols || do_rows); list = list->next) {
Range const *r = list->data;
if (do_rows && r->start.row == 0 && r->end.row == SHEET_MAX_ROWS - 1)
do_rows = FALSE;
if (do_cols && r->start.col == 0 && r->end.col == SHEET_MAX_COLS - 1)
if (do_cols && range_is_full (r, TRUE))
do_cols = FALSE;
if (do_rows && range_is_full (r, FALSE))
do_rows = FALSE;
}
sheet_menu_state_enable_insert (sheet, do_cols, do_rows);
}
......
......@@ -121,6 +121,10 @@ sheet_merge_add (WorkbookControl *wbc,
cell_unregister_span (cell);
}
/* Ensure that edit pos is not in the center of a region. */
if (range_contains (r, sheet->edit_pos.col, sheet->edit_pos.row))
sheet_set_edit_pos (sheet, r->start.col, r->start.row);
sheet->priv->reposition_selection = TRUE;
return FALSE;
}
......
......@@ -734,12 +734,12 @@ sheet_update_only_grid (Sheet const *sheet)
{
SheetPrivate *p;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
p = sheet->priv;
if (p->reposition_selection) {
p->reposition_selection = TRUE;
p->reposition_selection = FALSE;
/* when moving we cleared the selection before
* arriving in here.
*/
......
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