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

Outline mode events and undo/redo are working.

2001-04-12  Jody Goldberg <jgoldberg@home.com>

	* src/colrow.c (colrow_set_visibility) : don't collapse things unless
	  they are at the end of the region.  Always uncollapse things.

2001-04-11  Jody Goldberg <jgoldberg@home.com>

	* src/item-bar.c (item_bar_draw) : tweak the redraw a bit to match
	  event handling

	* src/mstyle.c (mstyle_elements_equal) : remove pointless asserts and
	  correct the logic.
	(mstyle_element_equal) : Stop passing structs.
	(mstyle_elements_equal) : adjust here.
	(mstyle_elements_compare) : and here.

2001-04-12  Jody Goldberg <jgoldberg@home.com>

	* src/colrow.c (colrow_set_visibility) : collapse state changes can
	  occur more than once within a range.

	* src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store
	  sizes in pts.  Outline level is enough.
	  s/sheet_col_row_gutter_pts/sheet_col_row_gutter/
parent 1a997824
2001-04-12 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (colrow_set_visibility) : don't collapse things unless
they are at the end of the region. Always uncollapse things.
2001-04-11 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c (item_bar_draw) : tweak the redraw a bit to match
event handling
* src/mstyle.c (mstyle_elements_equal) : remove pointless asserts and
correct the logic.
(mstyle_element_equal) : Stop passing structs.
(mstyle_elements_equal) : adjust here.
(mstyle_elements_compare) : and here.
2001-04-12 Morten Welinder <terra@diku.dk> 2001-04-12 Morten Welinder <terra@diku.dk>
* src/plugin-util.c: Portability fix. * src/plugin-util.c: Portability fix.
...@@ -8,9 +24,15 @@ ...@@ -8,9 +24,15 @@
restored region visible. restored region visible.
(cmd_autofill_undo) : Ditto. (cmd_autofill_undo) : Ditto.
(cmd_autofill_redo) : Ditto. (cmd_autofill_redo) : Ditto.
(cmd_colrow_outline_change) : Uncollapsing things should work better
now.
* src/colrow.c (colrow_set_visibility) : collapse state changes can
occur more than once within a range.
* src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store * src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store
sizes in pts. Outline level is enough. sizes in pts. Outline level is enough.
s/sheet_col_row_gutter_pts/sheet_col_row_gutter/
2001-04-10 Jody Goldberg <jgoldberg@home.com> 2001-04-10 Jody Goldberg <jgoldberg@home.com>
......
2001-04-12 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (colrow_set_visibility) : don't collapse things unless
they are at the end of the region. Always uncollapse things.
2001-04-11 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c (item_bar_draw) : tweak the redraw a bit to match
event handling
* src/mstyle.c (mstyle_elements_equal) : remove pointless asserts and
correct the logic.
(mstyle_element_equal) : Stop passing structs.
(mstyle_elements_equal) : adjust here.
(mstyle_elements_compare) : and here.
2001-04-12 Morten Welinder <terra@diku.dk> 2001-04-12 Morten Welinder <terra@diku.dk>
* src/plugin-util.c: Portability fix. * src/plugin-util.c: Portability fix.
...@@ -8,9 +24,15 @@ ...@@ -8,9 +24,15 @@
restored region visible. restored region visible.
(cmd_autofill_undo) : Ditto. (cmd_autofill_undo) : Ditto.
(cmd_autofill_redo) : Ditto. (cmd_autofill_redo) : Ditto.
(cmd_colrow_outline_change) : Uncollapsing things should work better
now.
* src/colrow.c (colrow_set_visibility) : collapse state changes can
occur more than once within a range.
* src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store * src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store
sizes in pts. Outline level is enough. sizes in pts. Outline level is enough.
s/sheet_col_row_gutter_pts/sheet_col_row_gutter/
2001-04-10 Jody Goldberg <jgoldberg@home.com> 2001-04-10 Jody Goldberg <jgoldberg@home.com>
......
2001-04-12 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (colrow_set_visibility) : don't collapse things unless
they are at the end of the region. Always uncollapse things.
2001-04-11 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c (item_bar_draw) : tweak the redraw a bit to match
event handling
* src/mstyle.c (mstyle_elements_equal) : remove pointless asserts and
correct the logic.
(mstyle_element_equal) : Stop passing structs.
(mstyle_elements_equal) : adjust here.
(mstyle_elements_compare) : and here.
2001-04-12 Morten Welinder <terra@diku.dk> 2001-04-12 Morten Welinder <terra@diku.dk>
* src/plugin-util.c: Portability fix. * src/plugin-util.c: Portability fix.
...@@ -8,9 +24,15 @@ ...@@ -8,9 +24,15 @@
restored region visible. restored region visible.
(cmd_autofill_undo) : Ditto. (cmd_autofill_undo) : Ditto.
(cmd_autofill_redo) : Ditto. (cmd_autofill_redo) : Ditto.
(cmd_colrow_outline_change) : Uncollapsing things should work better
now.
* src/colrow.c (colrow_set_visibility) : collapse state changes can
occur more than once within a range.
* src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store * src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store
sizes in pts. Outline level is enough. sizes in pts. Outline level is enough.
s/sheet_col_row_gutter_pts/sheet_col_row_gutter/
2001-04-10 Jody Goldberg <jgoldberg@home.com> 2001-04-10 Jody Goldberg <jgoldberg@home.com>
......
2001-04-12 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (colrow_set_visibility) : don't collapse things unless
they are at the end of the region. Always uncollapse things.
2001-04-11 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c (item_bar_draw) : tweak the redraw a bit to match
event handling
* src/mstyle.c (mstyle_elements_equal) : remove pointless asserts and
correct the logic.
(mstyle_element_equal) : Stop passing structs.
(mstyle_elements_equal) : adjust here.
(mstyle_elements_compare) : and here.
2001-04-12 Morten Welinder <terra@diku.dk> 2001-04-12 Morten Welinder <terra@diku.dk>
* src/plugin-util.c: Portability fix. * src/plugin-util.c: Portability fix.
...@@ -8,9 +24,15 @@ ...@@ -8,9 +24,15 @@
restored region visible. restored region visible.
(cmd_autofill_undo) : Ditto. (cmd_autofill_undo) : Ditto.
(cmd_autofill_redo) : Ditto. (cmd_autofill_redo) : Ditto.
(cmd_colrow_outline_change) : Uncollapsing things should work better
now.
* src/colrow.c (colrow_set_visibility) : collapse state changes can
occur more than once within a range.
* src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store * src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store
sizes in pts. Outline level is enough. sizes in pts. Outline level is enough.
s/sheet_col_row_gutter_pts/sheet_col_row_gutter/
2001-04-10 Jody Goldberg <jgoldberg@home.com> 2001-04-10 Jody Goldberg <jgoldberg@home.com>
......
2001-04-12 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (colrow_set_visibility) : don't collapse things unless
they are at the end of the region. Always uncollapse things.
2001-04-11 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c (item_bar_draw) : tweak the redraw a bit to match
event handling
* src/mstyle.c (mstyle_elements_equal) : remove pointless asserts and
correct the logic.
(mstyle_element_equal) : Stop passing structs.
(mstyle_elements_equal) : adjust here.
(mstyle_elements_compare) : and here.
2001-04-12 Morten Welinder <terra@diku.dk> 2001-04-12 Morten Welinder <terra@diku.dk>
* src/plugin-util.c: Portability fix. * src/plugin-util.c: Portability fix.
...@@ -8,9 +24,15 @@ ...@@ -8,9 +24,15 @@
restored region visible. restored region visible.
(cmd_autofill_undo) : Ditto. (cmd_autofill_undo) : Ditto.
(cmd_autofill_redo) : Ditto. (cmd_autofill_redo) : Ditto.
(cmd_colrow_outline_change) : Uncollapsing things should work better
now.
* src/colrow.c (colrow_set_visibility) : collapse state changes can
occur more than once within a range.
* src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store * src/sheet.c (sheet_col_row_gutter_pts) : simplify, no need to store
sizes in pts. Outline level is enough. sizes in pts. Outline level is enough.
s/sheet_col_row_gutter_pts/sheet_col_row_gutter/
2001-04-10 Jody Goldberg <jgoldberg@home.com> 2001-04-10 Jody Goldberg <jgoldberg@home.com>
......
...@@ -434,7 +434,7 @@ colrow_visibility (Sheet const *sheet, struct colrow_visiblity * const dat, ...@@ -434,7 +434,7 @@ colrow_visibility (Sheet const *sheet, struct colrow_visiblity * const dat,
? &sheet_col_get : &sheet_row_get; ? &sheet_col_get : &sheet_row_get;
/* Find the end of a segment that will be toggled */ /* Find the end of a segment that will be toggled */
for (i = last; i>=first; --i) { for (i = last; i >= first; --i) {
int j; int j;
ColRowIndex *res; ColRowIndex *res;
ColRowInfo const *cri = (*get) (sheet, i); ColRowInfo const *cri = (*get) (sheet, i);
...@@ -446,24 +446,31 @@ colrow_visibility (Sheet const *sheet, struct colrow_visiblity * const dat, ...@@ -446,24 +446,31 @@ colrow_visibility (Sheet const *sheet, struct colrow_visiblity * const dat,
continue; continue;
/* Find the begining */ /* Find the begining */
for (j = i-1; j >= first ; --j) { for (j = i; j >= first ; --j) {
ColRowInfo const * cri = (*get) (sheet, j); cri = (*get) (sheet, j);
if (cri == NULL) { if (cri == NULL) {
if (visible != 0) if (visible != 0)
break; break;
} else if ((visible != 0) == (cri->visible != 0)) } else if ((visible != 0) == (cri->visible != 0))
break; break;
else if (visible && cri->is_collapsed)
break;
} }
res = g_new (ColRowIndex, 1); res = g_new (ColRowIndex, 1);
res->first = j + 1; res->first = (j > first) ? j : first;
res->last = i; res->last = i;
#if 0 #if 0
printf ("%d %d\n", res->index, res->count); printf ("%d %d\n", res->index, res->count);
#endif #endif
dat->elements = g_slist_insert_sorted (dat->elements, res, dat->elements = g_slist_insert_sorted (dat->elements, res,
(GCompareFunc)colrow_index_cmp); (GCompareFunc)colrow_index_cmp);
i = j;
if (visible && cri->is_collapsed) {
i = colrow_find_outline_bound (
sheet, dat->is_cols, j,
cri->outline_level+1, FALSE);
} else
i = j;
} }
} }
...@@ -659,6 +666,9 @@ colrow_set_visibility (Sheet *sheet, gboolean const is_cols, ...@@ -659,6 +666,9 @@ colrow_set_visibility (Sheet *sheet, gboolean const is_cols,
? sheet_col_fetch (sheet, i) ? sheet_col_fetch (sheet, i)
: sheet_row_fetch (sheet, i); : sheet_row_fetch (sheet, i);
if (prev_changed && prev_outline > cri->outline_level && !visible)
cri->is_collapsed = FALSE;
prev_changed = (visible == 0) != (cri->visible == 0); prev_changed = (visible == 0) != (cri->visible == 0);
if (prev_changed) { if (prev_changed) {
cri->visible = visible; cri->visible = visible;
...@@ -666,7 +676,6 @@ colrow_set_visibility (Sheet *sheet, gboolean const is_cols, ...@@ -666,7 +676,6 @@ colrow_set_visibility (Sheet *sheet, gboolean const is_cols,
sheet->priv->recompute_visibility = TRUE; sheet->priv->recompute_visibility = TRUE;
} }
} }
if (prev_changed && if (prev_changed &&
((is_cols && i < SHEET_MAX_COLS) || ((is_cols && i < SHEET_MAX_COLS) ||
(!is_cols && i < SHEET_MAX_ROWS))) { (!is_cols && i < SHEET_MAX_ROWS))) {
......
...@@ -29,6 +29,7 @@ struct _ColRowCollection ...@@ -29,6 +29,7 @@ struct _ColRowCollection
int max_used; int max_used;
ColRowInfo default_style; ColRowInfo default_style;
GPtrArray * info; GPtrArray * info;
int max_outline_level;
float size_pts; float size_pts;
int size_pixels; int size_pixels;
......
...@@ -1952,8 +1952,8 @@ cmd_colrow_outline_change (WorkbookControl *wbc, Sheet *sheet, ...@@ -1952,8 +1952,8 @@ cmd_colrow_outline_change (WorkbookControl *wbc, Sheet *sheet,
if (prev != NULL && prev->outline_level > depth) { if (prev != NULL && prev->outline_level > depth) {
visible = (cri != NULL) ? cri->is_collapsed : FALSE; visible = (cri != NULL) ? cri->is_collapsed : FALSE;
last = index - 1; last = index - 1;
first = colrow_find_outline_bound (sheet, is_cols, index-1, first = colrow_find_outline_bound (sheet, is_cols,
depth, FALSE); index-1, prev->outline_level, FALSE);
} }
} }
if (first < 0 && cri != NULL && cri->outline_level > 0) { if (first < 0 && cri != NULL && cri->outline_level > 0) {
......
...@@ -70,13 +70,13 @@ item_bar_destroy (GtkObject *object) ...@@ -70,13 +70,13 @@ item_bar_destroy (GtkObject *object)
} }
static int static int
compute_pixels_from_pts (Sheet const *sheet, float pts, gboolean const horizontal) compute_pixels_from_indent (Sheet const *sheet, int indent, gboolean const horizontal)
{ {
double const scale = double const scale =
sheet->last_zoom_factor_used * sheet->last_zoom_factor_used *
application_display_dpi_get (horizontal) / 72.; application_display_dpi_get (horizontal) / 72.;
return (int)(pts * scale + 0.5); return (int)(5 + indent * 14 * scale + 0.5);
} }
/** /**
...@@ -117,8 +117,8 @@ item_bar_calc_size (ItemBar *ib) ...@@ -117,8 +117,8 @@ item_bar_calc_size (ItemBar *ib)
ib->cell_width = 5 + 5 + gdk_string_width ( ib->cell_width = 5 + 5 + gdk_string_width (
style_font_gdk_font (bold_font), "88888"); style_font_gdk_font (bold_font), "88888");
ib->indent = ib->is_col_header ib->indent = ib->is_col_header
? compute_pixels_from_pts (sheet, sheet->col_gutter.pts, TRUE) ? compute_pixels_from_indent (sheet, sheet->cols.max_outline_level, TRUE)
: compute_pixels_from_pts (sheet, sheet->row_gutter.pts, FALSE); : compute_pixels_from_indent (sheet, sheet->rows.max_outline_level, FALSE);
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ib)); gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ib));
...@@ -268,8 +268,8 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w ...@@ -268,8 +268,8 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
gboolean has_object = scg->new_object != NULL || scg->current_object != NULL; gboolean has_object = scg->new_object != NULL || scg->current_object != NULL;
if (item_bar->is_col_header) { if (item_bar->is_col_header) {
int const inc = (sheet->col_gutter.max_indent > 0) int const inc = (sheet->cols.max_outline_level > 0)
? (item_bar->indent - 2) / sheet->col_gutter.max_indent ? (item_bar->indent - 2) / sheet->cols.max_outline_level
: 0; : 0;
int const base_pos = .2 * inc - y; int const base_pos = .2 * inc - y;
int const len = (inc > 4) ? 4 : inc; int const len = (inc > 4) ? 4 : inc;
...@@ -303,7 +303,8 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w ...@@ -303,7 +303,8 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
return; return;
/* DO NOT enable resizing all until we get rid of /* DO NOT enable resizing all until we get rid of
* resize_start_pos. It will be wrong if things ahead of it move * resize_start_pos. It will be wrong if things ahead
* of it move
*/ */
cri = sheet_col_get_info (sheet, col); cri = sheet_col_get_info (sheet, col);
if (item_bar->resize_pos != -1 && if (item_bar->resize_pos != -1 &&
...@@ -346,7 +347,7 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w ...@@ -346,7 +347,7 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
if (size > 15) if (size > 15)
size = 15; size = 15;
if (size < 6) else if (size < 6)
safety = 6 - size; safety = 6 - size;
top += 2; /* inside cell's shadow */ top += 2; /* inside cell's shadow */
...@@ -378,8 +379,8 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w ...@@ -378,8 +379,8 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
++col; ++col;
} while (total < width); } while (total < width);
} else { } else {
int const inc = (sheet->row_gutter.max_indent > 0) int const inc = (sheet->rows.max_outline_level > 0)
? (item_bar->indent - 2) / sheet->row_gutter.max_indent ? (item_bar->indent - 2) / sheet->rows.max_outline_level
: 0; : 0;
int const base_pos = .2 * inc - x; int const base_pos = .2 * inc - x;
int const len = (inc > 4) ? 4 : inc; int const len = (inc > 4) ? 4 : inc;
...@@ -465,7 +466,7 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w ...@@ -465,7 +466,7 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
if (size > 15) if (size > 15)
size = 15; size = 15;
if (size < 6) else if (size < 6)
safety = 6 - size; safety = 6 - size;
top += 2; /* inside cell's shadow */ top += 2; /* inside cell's shadow */
...@@ -711,11 +712,11 @@ outline_button_press (ItemBar const *ib, int element, int pixel) ...@@ -711,11 +712,11 @@ outline_button_press (ItemBar const *ib, int element, int pixel)
int inc, step; int inc, step;
if (ib->is_col_header) { if (ib->is_col_header) {
if (sheet->col_gutter.max_indent <= 0) if (sheet->cols.max_outline_level <= 0)
return TRUE; return TRUE;
inc = (ib->indent - 2) / sheet->col_gutter.max_indent; inc = (ib->indent - 2) / sheet->cols.max_outline_level;
} else if (sheet->row_gutter.max_indent > 0) } else if (sheet->rows.max_outline_level > 0)
inc = (ib->indent - 2) / sheet->row_gutter.max_indent; inc = (ib->indent - 2) / sheet->rows.max_outline_level;
else else
return TRUE; return TRUE;
......
...@@ -274,77 +274,74 @@ mstyle_element_dump (const MStyleElement *e) ...@@ -274,77 +274,74 @@ mstyle_element_dump (const MStyleElement *e)
return txt_ans; return txt_ans;
} }
/*
* This should probably be unrolled into mstyle_elements_equal.
*/
static gboolean static gboolean
mstyle_element_equal (const MStyleElement a, mstyle_element_equal (MStyleElement const *a,
const MStyleElement b) MStyleElement const *b)
{ {
if ((a.type == MSTYLE_ELEMENT_UNSET || if ((a->type == MSTYLE_ELEMENT_UNSET ||
b.type == MSTYLE_ELEMENT_UNSET) && a.type != b.type) b->type == MSTYLE_ELEMENT_UNSET) && a->type != b->type)
return FALSE; return FALSE;
g_return_val_if_fail (a.type == b.type, FALSE); g_return_val_if_fail (a->type == b->type, FALSE);
switch (a.type) { switch (a->type) {
case MSTYLE_ANY_COLOR: case MSTYLE_ANY_COLOR:
if (a.u.color.fore == b.u.color.fore) if (a->u.color.fore == b->u.color.fore)
return TRUE; return TRUE;
break; break;
case MSTYLE_ANY_BORDER: case MSTYLE_ANY_BORDER:
if (a.u.border.any == b.u.border.any) if (a->u.border.any == b->u.border.any)
return TRUE; return TRUE;
break; break;
case MSTYLE_PATTERN: case MSTYLE_PATTERN:
if (a.u.pattern == b.u.pattern) if (a->u.pattern == b->u.pattern)
return TRUE; return TRUE;
break; break;
case MSTYLE_FONT_NAME: case MSTYLE_FONT_NAME:
if (a.u.font.name == b.u.font.name) if (a->u.font.name == b->u.font.name)
return TRUE; return TRUE;
break; break;
case MSTYLE_FONT_BOLD: case MSTYLE_FONT_BOLD:
if (a.u.font.bold == b.u.font.bold) if (a->u.font.bold == b->u.font.bold)
return TRUE; return TRUE;
break; break;
case MSTYLE_FONT_ITALIC: case MSTYLE_FONT_ITALIC:
if (a.u.font.italic == b.u.font.italic) if (a->u.font.italic == b->u.font.italic)
return TRUE; return TRUE;
break; break;
case MSTYLE_FONT_UNDERLINE: case MSTYLE_FONT_UNDERLINE:
if (a.u.font.underline == b.u.font.underline) if (a->u.font.underline == b->u.font.underline)
return TRUE; return TRUE;
break; break;
case MSTYLE_FONT_STRIKETHROUGH: case MSTYLE_FONT_STRIKETHROUGH:
if (a.u.font.strikethrough == b.u.font.strikethrough) if (a->u.font.strikethrough == b->u.font.strikethrough)
return TRUE; return TRUE;
case MSTYLE_FONT_SIZE: case MSTYLE_FONT_SIZE:
if (a.u.font.size == b.u.font.size) if (a->u.font.size == b->u.font.size)
return TRUE; return TRUE;
break; break;
case MSTYLE_FORMAT: case MSTYLE_FORMAT:
if (a.u.format == b.u.format) if (a->u.format == b->u.format)
return TRUE; return TRUE;
break; break;
case MSTYLE_ALIGN_V: case MSTYLE_ALIGN_V:
if (a.u.align.v == b.u.align.v) if (a->u.align.v == b->u.align.v)
return TRUE; return TRUE;
break; break;
case MSTYLE_ALIGN_H: case MSTYLE_ALIGN_H:
if (a.u.align.h == b.u.align.h) if (a->u.align.h == b->u.align.h)
return TRUE; return TRUE;
break; break;
case MSTYLE_INDENT: case MSTYLE_INDENT:
if (a.u.indent == b.u.indent) if (a->u.indent == b->u.indent)
return TRUE; return TRUE;
break; break;
case MSTYLE_ORIENTATION: case MSTYLE_ORIENTATION:
if (a.u.orientation == b.u.orientation) if (a->u.orientation == b->u.orientation)
return TRUE; return TRUE;
break; break;
case MSTYLE_WRAP_TEXT: case MSTYLE_WRAP_TEXT:
if (a.u.fit_in_cell == b.u.fit_in_cell) if (a->u.fit_in_cell == b->u.fit_in_cell)
return TRUE; return TRUE;
break; break;
default: default:
...@@ -374,17 +371,14 @@ mstyle_elements_equal (const MStyleElement *a, ...@@ -374,17 +371,14 @@ mstyle_elements_equal (const MStyleElement *a,
g_return_val_if_fail (b != NULL, FALSE); g_return_val_if_fail (b != NULL, FALSE);
for (i = 1; i < MSTYLE_ELEMENT_MAX; i++) { for (i = 1; i < MSTYLE_ELEMENT_MAX; i++) {
/* Elements in the same position should have the same types */
g_assert (i < MSTYLE_ELEMENT_MAX); if (a[i].type != b[i].type) {
g_warning ("%s mismatched types\n", mstyle_names[i]);
if (a[i].type != b[i].type)
return FALSE; return FALSE;
}
if (!mstyle_element_equal (a[i], b[i])) { if (!mstyle_element_equal (a+i, b+i))
g_assert (i < MSTYLE_ELEMENT_MAX);
g_warning ("%s mismatch\n", mstyle_names[i]);
return FALSE; return FALSE;
}
} }
return TRUE; return TRUE;
...@@ -457,7 +451,7 @@ mstyle_elements_compare (MStyleElement *a, ...@@ -457,7 +451,7 @@ mstyle_elements_compare (MStyleElement *a,
if (a[i].type == MSTYLE_ELEMENT_UNSET) { if (a[i].type == MSTYLE_ELEMENT_UNSET) {
mstyle_element_ref (&b[i]); mstyle_element_ref (&b[i]);
a[i] = b[i]; a[i] = b[i];
} else if (!mstyle_element_equal (a[i], b[i])) { } else if (!mstyle_element_equal (a+i, b+i)) {
mstyle_element_unref (a[i]); mstyle_element_unref (a[i]);
a[i].type = MSTYLE_ELEMENT_CONFLICT; a[i].type = MSTYLE_ELEMENT_CONFLICT;
} }
......
...@@ -879,20 +879,23 @@ sheet_col_row_set_outline_level (Sheet *sheet, int index, gboolean is_cols, ...@@ -879,20 +879,23 @@ sheet_col_row_set_outline_level (Sheet *sheet, int index, gboolean is_cols,
} }
/** /**
* sheet_col_row_gutter_pts : * sheet_col_row_gutter :
*
* @sheet :
* @col_max_outline :
* @row_max_outline :
*
* Set the maximum outline levels for the cols and rows.
*/ */
void void
sheet_col_row_gutter_pts (Sheet *sheet, sheet_col_row_gutter (Sheet *sheet,
float col_gutter, int col_max_indent, int col_max_outline,
float row_gutter, int row_max_indent) int row_max_outline)
{ {
g_return_if_fail (IS_SHEET (sheet)); g_return_if_fail (IS_SHEET (sheet));
sheet->col_gutter.pts = col_gutter; sheet->cols.max_outline_level = col_max_outline;
sheet->col_gutter.max_indent = col_max_indent; sheet->rows.max_outline_level = row_max_outline;
sheet->row_gutter.pts = row_gutter;
sheet->row_gutter.max_indent = row_max_indent;
SHEET_FOREACH_CONTROL (sheet, control, scg_set_gutters (control);); SHEET_FOREACH_CONTROL (sheet, control, scg_set_gutters (control););
} }
......
...@@ -69,11 +69,6 @@ struct _Sheet { ...@@ -69,11 +69,6 @@ struct _Sheet {
/* place holders for new features */ /* place holders for new features */
CellPos frozen_corner; CellPos frozen_corner;
struct {
float pts;
int max_indent;
} col_gutter, row_gutter;
}; };
#define SHEET_SIGNATURE 0x12349876 #define SHEET_SIGNATURE 0x12349876
...@@ -198,9 +193,9 @@ int sheet_row_size_fit_pixels (Sheet *sheet, int row); ...@@ -198,9 +193,9 @@ int sheet_row_size_fit_pixels (Sheet *sheet, int row);
void sheet_col_row_set_outline_level (Sheet *sheet, int index, void sheet_col_row_set_outline_level (Sheet *sheet, int index,
gboolean is_cols, int outline, gboolean is_cols, int outline,
gboolean is_collapsed); gboolean is_collapsed);
void sheet_col_row_gutter_pts (Sheet *sheet, void sheet_col_row_gutter (Sheet *sheet,
float col_gutter, int max_col_indent, int max_col_indent,
float row_gutter, int max_row_indent); int max_row_indent);
Range sheet_get_extent (Sheet const *sheet); Range sheet_get_extent (Sheet const *sheet);
gboolean sheet_range_splits_array (Sheet const *sheet, Range const *r, gboolean sheet_range_splits_array (Sheet const *sheet, Range const *r,
......
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