Commit 35bb5752 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

typo. Use the child not the parent node. (xml_write_selection_info) : Save


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

	* src/xml-io.c (xml_read_selection_info) : typo.  Use the child not
	  the parent node.
	(xml_write_selection_info) : Save the real position.

	* src/sheet.c (sheet_new_scg) : set cursor bound, not the details.
	(sheet_cursor_set) : add some sanity checks.
	(sheet_clone_selection) : use the real edit_pos.
parent d50fba6d
...@@ -25,7 +25,7 @@ Long term breakage ...@@ -25,7 +25,7 @@ Long term breakage
- defining file patterns in plugin spec overrides 'has_probe' flag silently. - defining file patterns in plugin spec overrides 'has_probe' flag silently.
(Zbigniew is working on it) (Zbigniew is working on it)
- It is possible to navigate to hidden cols/rows at the start of the sheet. - It is possible to navigate to hidden cols/rows at the start/end of the sheet.
Names : Names :
: Fix XL named expr import for sheet local names : Fix XL named expr import for sheet local names
...@@ -35,7 +35,9 @@ Names : ...@@ -35,7 +35,9 @@ Names :
depends correctly. depends correctly.
: references in names do not get changed with cut/paste or ins/del row/col. : references in names do not get changed with cut/paste or ins/del row/col.
* range selection support for merged cells. - range selection support for merged cells, should name the corner not the
content.
- When using the new range-selector for dialogs with only one range, it - When using the new range-selector for dialogs with only one range, it
should not be necessary to select the range field before selecting the should not be necessary to select the range field before selecting the
range. As long as the selector is in a modal dialog. range. As long as the selector is in a modal dialog.
......
2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_read_selection_info) : typo. Use the child not
the parent node.
(xml_write_selection_info) : Save the real position.
* src/sheet.c (sheet_new_scg) : set cursor bound, not the details.
(sheet_cursor_set) : add some sanity checks.
(sheet_clone_selection) : use the real edit_pos.
2001-05-09 Jody Goldberg <jgoldberg@home.com> 2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (cb_move_cursor) : typo. * src/item-cursor.c (cb_move_cursor) : typo.
......
2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_read_selection_info) : typo. Use the child not
the parent node.
(xml_write_selection_info) : Save the real position.
* src/sheet.c (sheet_new_scg) : set cursor bound, not the details.
(sheet_cursor_set) : add some sanity checks.
(sheet_clone_selection) : use the real edit_pos.
2001-05-09 Jody Goldberg <jgoldberg@home.com> 2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (cb_move_cursor) : typo. * src/item-cursor.c (cb_move_cursor) : typo.
......
2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_read_selection_info) : typo. Use the child not
the parent node.
(xml_write_selection_info) : Save the real position.
* src/sheet.c (sheet_new_scg) : set cursor bound, not the details.
(sheet_cursor_set) : add some sanity checks.
(sheet_clone_selection) : use the real edit_pos.
2001-05-09 Jody Goldberg <jgoldberg@home.com> 2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (cb_move_cursor) : typo. * src/item-cursor.c (cb_move_cursor) : typo.
......
2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_read_selection_info) : typo. Use the child not
the parent node.
(xml_write_selection_info) : Save the real position.
* src/sheet.c (sheet_new_scg) : set cursor bound, not the details.
(sheet_cursor_set) : add some sanity checks.
(sheet_clone_selection) : use the real edit_pos.
2001-05-09 Jody Goldberg <jgoldberg@home.com> 2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (cb_move_cursor) : typo. * src/item-cursor.c (cb_move_cursor) : typo.
......
2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_read_selection_info) : typo. Use the child not
the parent node.
(xml_write_selection_info) : Save the real position.
* src/sheet.c (sheet_new_scg) : set cursor bound, not the details.
(sheet_cursor_set) : add some sanity checks.
(sheet_clone_selection) : use the real edit_pos.
2001-05-09 Jody Goldberg <jgoldberg@home.com> 2001-05-09 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (cb_move_cursor) : typo. * src/item-cursor.c (cb_move_cursor) : typo.
......
...@@ -754,7 +754,7 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event, ...@@ -754,7 +754,7 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event,
if (event->state & GDK_SHIFT_MASK) if (event->state & GDK_SHIFT_MASK)
scg_rangesel_extend_to (scg, col, row); scg_rangesel_extend_to (scg, col, row);
else else
scg_rangesel_cursor_bounds (scg, col, row, col, row); scg_rangesel_bound (scg, col, row, col, row);
gnome_canvas_item_grab (item, gnome_canvas_item_grab (item,
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK, GDK_BUTTON_RELEASE_MASK,
......
...@@ -408,7 +408,7 @@ scg_select_all (SheetControlGUI *scg) ...@@ -408,7 +408,7 @@ scg_select_all (SheetControlGUI *scg)
} else { } else {
if (!scg->rangesel.active) if (!scg->rangesel.active)
scg_rangesel_start (scg, 0, 0); scg_rangesel_start (scg, 0, 0);
scg_rangesel_cursor_bounds ( scg_rangesel_bound (
scg, 0, 0, SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1); scg, 0, 0, SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1);
sheet_update (sheet); sheet_update (sheet);
} }
...@@ -446,7 +446,7 @@ scg_colrow_select (SheetControlGUI *scg, gboolean is_cols, ...@@ -446,7 +446,7 @@ scg_colrow_select (SheetControlGUI *scg, gboolean is_cols,
if (is_cols) { if (is_cols) {
if (rangesel) if (rangesel)
scg_rangesel_cursor_bounds (scg, scg_rangesel_bound (scg,
index, 0, index, SHEET_MAX_ROWS-1); index, 0, index, SHEET_MAX_ROWS-1);
else else
sheet_selection_add_range (sheet, sheet_selection_add_range (sheet,
...@@ -455,7 +455,7 @@ scg_colrow_select (SheetControlGUI *scg, gboolean is_cols, ...@@ -455,7 +455,7 @@ scg_colrow_select (SheetControlGUI *scg, gboolean is_cols,
index, SHEET_MAX_ROWS-1); index, SHEET_MAX_ROWS-1);
} else { } else {
if (rangesel) if (rangesel)
scg_rangesel_cursor_bounds (scg, scg_rangesel_bound (scg,
0, index, SHEET_MAX_COLS-1, index); 0, index, SHEET_MAX_COLS-1, index);
else else
sheet_selection_add_range (sheet, sheet_selection_add_range (sheet,
...@@ -622,7 +622,8 @@ scg_construct (SheetControlGUI *scg) ...@@ -622,7 +622,8 @@ scg_construct (SheetControlGUI *scg)
scg_ant (scg); scg_ant (scg);
} }
GtkWidget * /* FIXME : Should be SheetControl */
GtkObject *
sheet_control_gui_new (Sheet *sheet) sheet_control_gui_new (Sheet *sheet)
{ {
SheetControlGUI *scg; SheetControlGUI *scg;
...@@ -635,7 +636,7 @@ sheet_control_gui_new (Sheet *sheet) ...@@ -635,7 +636,7 @@ sheet_control_gui_new (Sheet *sheet)
scg_construct (scg); scg_construct (scg);
return GTK_WIDGET (scg); return GTK_OBJECT (scg);
} }
static void static void
...@@ -1989,26 +1990,9 @@ scg_colrow_distance_get (SheetControlGUI const *scg, gboolean is_cols, ...@@ -1989,26 +1990,9 @@ scg_colrow_distance_get (SheetControlGUI const *scg, gboolean is_cols,
/*************************************************************************/ /*************************************************************************/
void void
scg_cursor_bound (SheetControlGUI *scg, scg_cursor_bound (SheetControlGUI *scg, Range const *r)
CellPos const *base, CellPos const *move)
{ {
Range r; gnumeric_sheet_cursor_bound (GNUMERIC_SHEET (scg->canvas), r);
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;
}
gnumeric_sheet_cursor_bound (GNUMERIC_SHEET (scg->canvas), &r);
} }
void void
...@@ -2216,9 +2200,9 @@ scg_rangesel_extend_to (SheetControlGUI *scg, int col, int row) ...@@ -2216,9 +2200,9 @@ scg_rangesel_extend_to (SheetControlGUI *scg, int col, int row)
} }
void void
scg_rangesel_cursor_bounds (SheetControlGUI *scg, scg_rangesel_bound (SheetControlGUI *scg,
int base_col, int base_row, int base_col, int base_row,
int move_col, int move_row) int move_col, int move_row)
{ {
g_return_if_fail (scg->rangesel.active); g_return_if_fail (scg->rangesel.active);
scg_rangesel_changed (scg, base_col, base_row, move_col, move_row); scg_rangesel_changed (scg, base_col, base_row, move_col, move_row);
......
...@@ -70,8 +70,8 @@ typedef struct { ...@@ -70,8 +70,8 @@ typedef struct {
GtkTableClass parent_class; GtkTableClass parent_class;
} SheetControlGUIClass; } SheetControlGUIClass;
GtkType sheet_control_gui_get_type (void); GtkType sheet_control_gui_get_type (void);
GtkWidget * sheet_control_gui_new (Sheet *sheet); GtkObject *sheet_control_gui_new (Sheet *sheet);
void scg_stop_sliding (SheetControlGUI *scg); void scg_stop_sliding (SheetControlGUI *scg);
gboolean scg_start_sliding (SheetControlGUI *scg, gboolean scg_start_sliding (SheetControlGUI *scg,
...@@ -130,7 +130,7 @@ gboolean scg_rangesel_possible (SheetControlGUI const *scg); ...@@ -130,7 +130,7 @@ gboolean scg_rangesel_possible (SheetControlGUI const *scg);
void scg_rangesel_start (SheetControlGUI *scg, int col, int row); void scg_rangesel_start (SheetControlGUI *scg, int col, int row);
void scg_rangesel_stop (SheetControlGUI *scg, gboolean clear_str); void scg_rangesel_stop (SheetControlGUI *scg, gboolean clear_str);
void scg_rangesel_extend_to (SheetControlGUI *scg, int col, int row); void scg_rangesel_extend_to (SheetControlGUI *scg, int col, int row);
void scg_rangesel_cursor_bounds (SheetControlGUI *scg, void scg_rangesel_bound (SheetControlGUI *scg,
int base_col, int base_row, int base_col, int base_row,
int move_col, int move_row); int move_col, int move_row);
void scg_rangesel_move (SheetControlGUI *scg, int dir, void scg_rangesel_move (SheetControlGUI *scg, int dir,
...@@ -138,8 +138,7 @@ void scg_rangesel_move (SheetControlGUI *scg, int dir, ...@@ -138,8 +138,7 @@ void scg_rangesel_move (SheetControlGUI *scg, int dir,
void scg_rangesel_extend (SheetControlGUI *scg, int n, void scg_rangesel_extend (SheetControlGUI *scg, int n,
gboolean jump_to_bound, gboolean horiz); gboolean jump_to_bound, gboolean horiz);
void scg_cursor_bound (SheetControlGUI *scg, void scg_cursor_bound (SheetControlGUI *scg, Range const *r);
CellPos const *base, CellPos const *move);
void scg_cursor_move_to (SheetControlGUI *Scg, int col, int row, void scg_cursor_move_to (SheetControlGUI *Scg, int col, int row,
gboolean clear_selection); gboolean clear_selection);
void scg_cursor_move (SheetControlGUI *scg, int dir, void scg_cursor_move (SheetControlGUI *scg, int dir,
......
...@@ -127,15 +127,15 @@ sheet_rename (Sheet *sheet, char const *new_name) ...@@ -127,15 +127,15 @@ sheet_rename (Sheet *sheet, char const *new_name)
SheetControlGUI * SheetControlGUI *
sheet_new_scg (Sheet *sheet) sheet_new_scg (Sheet *sheet)
{ {
GtkWidget *scg; GtkObject *scg;
Range const *r;
g_return_val_if_fail (IS_SHEET (sheet), NULL); r = selection_first_range (sheet, NULL, NULL);
g_return_val_if_fail (r != NULL, NULL);
scg = sheet_control_gui_new (sheet); scg = sheet_control_gui_new (sheet);
/* Set the visible bound, not the logical bound */
scg_cursor_bound (SHEET_CONTROL_GUI (scg), scg_cursor_bound (SHEET_CONTROL_GUI (scg), r);
&sheet->cursor.base_corner,
&sheet->cursor.move_corner);
sheet->s_controls = g_list_prepend (sheet->s_controls, scg); sheet->s_controls = g_list_prepend (sheet->s_controls, scg);
return SHEET_CONTROL_GUI (scg); return SHEET_CONTROL_GUI (scg);
...@@ -2908,13 +2908,26 @@ sheet_set_edit_pos (Sheet *sheet, int col, int row) ...@@ -2908,13 +2908,26 @@ sheet_set_edit_pos (Sheet *sheet, int col, int row)
} }
/**
* sheet_cursor_set :
* @sheet : The sheet
* @edit_col :
* @edit_row :
* @base_col :
* @base_row :
* @move_col :
* @move_row :
* @bound : An optionally NULL range that should contain all the supplied points
*/
void void
sheet_cursor_set (Sheet *sheet, sheet_cursor_set (Sheet *sheet,
int edit_col, int edit_row, int edit_col, int edit_row,
int base_col, int base_row, int base_col, int base_row,
int move_col, int move_row, int move_col, int move_row,
Range const *cursor_bound) Range const *bound)
{ {
Range r;
g_return_if_fail (IS_SHEET (sheet)); g_return_if_fail (IS_SHEET (sheet));
/* Change the edit position */ /* Change the edit position */
...@@ -2925,17 +2938,27 @@ sheet_cursor_set (Sheet *sheet, ...@@ -2925,17 +2938,27 @@ sheet_cursor_set (Sheet *sheet,
sheet->cursor.move_corner.col = move_col; sheet->cursor.move_corner.col = move_col;
sheet->cursor.move_corner.row = move_row; sheet->cursor.move_corner.row = move_row;
if (cursor_bound != NULL) { if (bound == NULL) {
SHEET_FOREACH_CONTROL(sheet, scg, if (base_col < move_col) {
scg_cursor_bound (scg, r.start.col = base_col;
&cursor_bound->start, r.end.col = move_col;
&cursor_bound->end);); } else {
} else { r.end.col = base_col;
SHEET_FOREACH_CONTROL(sheet, scg, r.start.col = move_col;
scg_cursor_bound (scg, }
&sheet->cursor.base_corner, if (base_row < move_row) {
&sheet->cursor.move_corner);); r.start.row = base_row;
r.end.row = move_row;
} else {
r.end.row = base_row;
r.start.row = move_row;
}
bound = &r;
} }
g_return_if_fail (range_is_sane (bound));
SHEET_FOREACH_CONTROL(sheet, scg, scg_cursor_bound (scg, bound););
} }
void void
...@@ -4042,8 +4065,8 @@ sheet_clone_selection (Sheet const *src, Sheet *dst) ...@@ -4042,8 +4065,8 @@ sheet_clone_selection (Sheet const *src, Sheet *dst)
} }
g_list_free (selections); g_list_free (selections);
sheet_selection_add_range (dst, sheet_selection_add_range (dst,
src->edit_pos.col, src->edit_pos_real.col,
src->edit_pos.row, src->edit_pos_real.row,
src->cursor.base_corner.col, src->cursor.base_corner.col,
src->cursor.base_corner.row, src->cursor.base_corner.row,
src->cursor.move_corner.col, src->cursor.move_corner.col,
......
...@@ -524,8 +524,8 @@ xml_read_selection_info (XmlParseContext *ctxt, Sheet *sheet, xmlNodePtr tree) ...@@ -524,8 +524,8 @@ xml_read_selection_info (XmlParseContext *ctxt, Sheet *sheet, xmlNodePtr tree)
r.start.col, r.start.row, r.start.col, r.start.row,
r.end.col, r.end.row); r.end.col, r.end.row);
if (xml_get_value_int (tree, "CursorCol", &col) && if (xml_get_value_int (selections, "CursorCol", &col) &&
xml_get_value_int (tree, "CursorRow", &row)) xml_get_value_int (selections, "CursorRow", &row))
sheet_set_edit_pos (sheet, col, row); sheet_set_edit_pos (sheet, col, row);
} }
...@@ -545,8 +545,8 @@ xml_write_selection_info (XmlParseContext *ctxt, Sheet const *sheet, xmlNodePtr ...@@ -545,8 +545,8 @@ xml_write_selection_info (XmlParseContext *ctxt, Sheet const *sheet, xmlNodePtr
} }
g_list_free (copy); g_list_free (copy);
xml_set_value_int (tree, "CursorCol", sheet->edit_pos.col); xml_set_value_int (tree, "CursorCol", sheet->edit_pos_real.col);
xml_set_value_int (tree, "CursorRow", sheet->edit_pos.row); xml_set_value_int (tree, "CursorRow", sheet->edit_pos_real.row);
} }
/* /*
......
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