Commit 6166dda7 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Fix a few Chema bugs.

The cursor border was not being resized when rows/cols were hidden.
Cell contents were not being re-rendered/sized when the format was
    cleared.

2000-05-19  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.c (sheet_update) : Update cursor positions when visibility
	  changes.
	(sheet_clear_region) : When clearing formats we need to update the
	  spans and sizes of the contents.
	(sheet_update_cursor_pos) : New function.
	(sheet_row_col_visible) : changing the status of a row/col changes visibility.

	* src/sheet-view.c (sheet_view_update_cursor_pos) : New function split
	  out from sheet_view_set_zoom_factor.
	(sheet_view_set_zoom_factor) : Use sheet_view_update_cursor_pos.
parent 451b2fd3
......@@ -154,10 +154,28 @@ sheet_view_redraw_headers (SheetView *sheet_view,
}
void
sheet_view_set_zoom_factor (SheetView *sheet_view, double factor)
sheet_view_update_cursor_pos (SheetView *sheet_view)
{
GList *l;
GnumericSheet *gsheet;
g_return_if_fail (sheet_view != NULL);
g_return_if_fail (IS_SHEET_VIEW (sheet_view));
gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
/* Repsition the selection cursor */
item_cursor_reposition (gsheet->item_cursor);
/* Reposition the animated cursors */
for (l = sheet_view->anted_cursors; l; l = l->next)
item_cursor_reposition (ITEM_CURSOR (l->data));
}
void
sheet_view_set_zoom_factor (SheetView *sheet_view, double factor)
{
GnumericSheet *gsheet;
ItemBar *col_item, *row_item;
int h, w;
......@@ -207,12 +225,7 @@ sheet_view_set_zoom_factor (SheetView *sheet_view, double factor)
sheet_view->sheet->cursor.edit_pos.row,
TRUE);
/* Repsition the cursor */
item_cursor_reposition (gsheet->item_cursor);
/* Adjust the animated cursors */
for (l = sheet_view->anted_cursors; l; l = l->next)
item_cursor_reposition (ITEM_CURSOR (l->data));
sheet_view_update_cursor_pos (sheet_view);
}
static void
......
......@@ -83,6 +83,8 @@ void sheet_view_selection_unant (SheetView *sheet_view);
void sheet_view_adjust_preferences (SheetView *sheet_view);
void sheet_view_update_cursor_pos (SheetView *sheet_view);
StyleFont * sheet_view_get_style_font (Sheet const *sheet,
MStyle const * const mstyle);
......
......@@ -154,10 +154,28 @@ sheet_view_redraw_headers (SheetView *sheet_view,
}
void
sheet_view_set_zoom_factor (SheetView *sheet_view, double factor)
sheet_view_update_cursor_pos (SheetView *sheet_view)
{
GList *l;
GnumericSheet *gsheet;
g_return_if_fail (sheet_view != NULL);
g_return_if_fail (IS_SHEET_VIEW (sheet_view));
gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
/* Repsition the selection cursor */
item_cursor_reposition (gsheet->item_cursor);
/* Reposition the animated cursors */
for (l = sheet_view->anted_cursors; l; l = l->next)
item_cursor_reposition (ITEM_CURSOR (l->data));
}
void
sheet_view_set_zoom_factor (SheetView *sheet_view, double factor)
{
GnumericSheet *gsheet;
ItemBar *col_item, *row_item;
int h, w;
......@@ -207,12 +225,7 @@ sheet_view_set_zoom_factor (SheetView *sheet_view, double factor)
sheet_view->sheet->cursor.edit_pos.row,
TRUE);
/* Repsition the cursor */
item_cursor_reposition (gsheet->item_cursor);
/* Adjust the animated cursors */
for (l = sheet_view->anted_cursors; l; l = l->next)
item_cursor_reposition (ITEM_CURSOR (l->data));
sheet_view_update_cursor_pos (sheet_view);
}
static void
......
......@@ -83,6 +83,8 @@ void sheet_view_selection_unant (SheetView *sheet_view);
void sheet_view_adjust_preferences (SheetView *sheet_view);
void sheet_view_update_cursor_pos (SheetView *sheet_view);
StyleFont * sheet_view_get_style_font (Sheet const *sheet,
MStyle const * const mstyle);
......
......@@ -732,6 +732,7 @@ sheet_update (Sheet const *sheet)
*/
p->recompute_visibility = FALSE;
sheet_compute_visible_ranges (sheet);
sheet_update_cursor_pos (sheet);
sheet_redraw_all (sheet);
}
......@@ -2292,8 +2293,11 @@ sheet_clear_region (CommandContext *context, Sheet *sheet,
end_col, end_row);
/* Clear the style in the region (new_default will ref the style for us). */
if (clear_flags & CLEAR_FORMATS)
if (clear_flags & CLEAR_FORMATS) {
sheet_style_attach (sheet, r, mstyle_new_default ());
sheet_range_calc_spans (sheet, r, SPANCALC_RE_RENDER|SPANCALC_RESIZE);
rows_height_update (sheet, &r);
}
if (clear_flags & CLEAR_COMMENTS)
sheet_cell_foreach_range (sheet, TRUE,
......@@ -2467,6 +2471,20 @@ sheet_cursor_set (Sheet *sheet,
}
}
void
sheet_update_cursor_pos (Sheet *sheet)
{
GList *l;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
for (l = sheet->sheet_views; l; l = l->next) {
SheetView *sheet_view = l->data;
sheet_view_update_cursor_pos (sheet_view);
}
}
void
sheet_hide_cursor (Sheet *sheet)
{
......@@ -3297,8 +3315,10 @@ sheet_row_col_visible (Sheet *sheet, gboolean const is_col, gboolean const visib
? sheet_col_fetch (sheet, index++)
: sheet_row_fetch (sheet, index++);
if (visible ^ cri->visible)
if (visible ^ cri->visible) {
cri->visible = visible;
sheet->priv->recompute_visibility = TRUE;
}
}
}
......
......@@ -135,6 +135,7 @@ void sheet_cursor_set (Sheet *sheet,
int edit_col, int edit_row,
int base_col, int base_row,
int move_col, int move_row);
void sheet_update_cursor_pos (Sheet *sheet);
void sheet_set_edit_pos (Sheet *sheet, int col, int row);
void sheet_make_cell_visible (Sheet *sheet, int col, int 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