Commit 26a54532 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Be more enthusiastic about merging and ordering. (col_row_equal) : new


2000-08-31  Jody Goldberg <jgoldberg@home.com>

	* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
	  merging and ordering.
	(col_row_equal) : new function.
	(col_row_copy) : new function.
	(col_row_size_list_destroy) : Typo.
	(col_row_restore_sizes_group) : Handle restoring default size.
	(col_row_set_sizes) : In special case of resizing all be smart.
	  This needs improving.

2000-08-30  Jody Goldberg <jgoldberg@home.com>

	* src/number-match.c (compute_value) : AM/PM regexp matchs against the
	  'a' or 'p' not 'pm'

	* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
	  even if the size does not change.

	* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
	  and rationalize the variable names.
	(xml_read_rows_info) : Restore the default col size,
	(xml_sheet_write) : Save the default row/col size in pts.
	  Flush the run length encoding of the row/col sizes.
	(xml_write_colrow_info) : Use run length encoding to decrease the size
	  of the generated xml.
parent 0407bc54
......@@ -4,8 +4,6 @@ and longer term bugs.
Release Critical
----------------
- Changing the size of all rows/cols creates big xml files, and slows
calculations to a crawl
- Saving xml should not rely on changing the textdomain to disable translation
of TRUE/FALSE in expressions.
- The translate/untranslate routines for formats need to be written
......@@ -30,6 +28,8 @@ Post 0.57 Changes
Long term breakage
------------------
- formats with AM/PM need to be internationalized.
- We need to generate the date formats depending on locale.
- Changing an expression name that is in use does not recalc, or regen depends
correctly.
......
2000-08-31 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
merging and ordering.
(col_row_equal) : new function.
(col_row_copy) : new function.
(col_row_size_list_destroy) : Typo.
(col_row_restore_sizes_group) : Handle restoring default size.
(col_row_set_sizes) : In special case of resizing all be smart.
This needs improving.
2000-08-30 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (compute_value) : AM/PM regexp matchs against the
'a' or 'p' not 'pm'
* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
even if the size does not change.
* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
and rationalize the variable names.
(xml_read_rows_info) : Restore the default col size,
(xml_sheet_write) : Save the default row/col size in pts.
Flush the run length encoding of the row/col sizes.
(xml_write_colrow_info) : Use run length encoding to decrease the size
of the generated xml.
* src/colrow.c (col_row_equal) : new function.
2000-08-31 Morten Welinder <terra@diku.dk>
* src/goal-seek.c (goal_seek_trawl_normally): Respect xmin and
......
2000-08-31 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
merging and ordering.
(col_row_equal) : new function.
(col_row_copy) : new function.
(col_row_size_list_destroy) : Typo.
(col_row_restore_sizes_group) : Handle restoring default size.
(col_row_set_sizes) : In special case of resizing all be smart.
This needs improving.
2000-08-30 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (compute_value) : AM/PM regexp matchs against the
'a' or 'p' not 'pm'
* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
even if the size does not change.
* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
and rationalize the variable names.
(xml_read_rows_info) : Restore the default col size,
(xml_sheet_write) : Save the default row/col size in pts.
Flush the run length encoding of the row/col sizes.
(xml_write_colrow_info) : Use run length encoding to decrease the size
of the generated xml.
* src/colrow.c (col_row_equal) : new function.
2000-08-31 Morten Welinder <terra@diku.dk>
* src/goal-seek.c (goal_seek_trawl_normally): Respect xmin and
......
......@@ -12,9 +12,13 @@ Jody:
* Improve support for named expressions.
* Name and Graph gurus support range selection.
* Improve internation keyboard support.
* Fix XIRR and friends.
* Fix XIRR and friends so that they support blanks.
* A few more bugs in printing multiline text.
* Correct handling of number formating in intl locales.
* Lots of formating bugs.
* Handle strings used as arguments to numeric operators.
* Begin support for non-cell dependencies.
* Improve performance and decrease memory for large row/col resizes.
John Gill:
* Double click fill support.
......
2000-08-31 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
merging and ordering.
(col_row_equal) : new function.
(col_row_copy) : new function.
(col_row_size_list_destroy) : Typo.
(col_row_restore_sizes_group) : Handle restoring default size.
(col_row_set_sizes) : In special case of resizing all be smart.
This needs improving.
2000-08-30 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (compute_value) : AM/PM regexp matchs against the
'a' or 'p' not 'pm'
* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
even if the size does not change.
* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
and rationalize the variable names.
(xml_read_rows_info) : Restore the default col size,
(xml_sheet_write) : Save the default row/col size in pts.
Flush the run length encoding of the row/col sizes.
(xml_write_colrow_info) : Use run length encoding to decrease the size
of the generated xml.
* src/colrow.c (col_row_equal) : new function.
2000-08-31 Morten Welinder <terra@diku.dk>
* src/goal-seek.c (goal_seek_trawl_normally): Respect xmin and
......
2000-08-31 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
merging and ordering.
(col_row_equal) : new function.
(col_row_copy) : new function.
(col_row_size_list_destroy) : Typo.
(col_row_restore_sizes_group) : Handle restoring default size.
(col_row_set_sizes) : In special case of resizing all be smart.
This needs improving.
2000-08-30 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (compute_value) : AM/PM regexp matchs against the
'a' or 'p' not 'pm'
* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
even if the size does not change.
* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
and rationalize the variable names.
(xml_read_rows_info) : Restore the default col size,
(xml_sheet_write) : Save the default row/col size in pts.
Flush the run length encoding of the row/col sizes.
(xml_write_colrow_info) : Use run length encoding to decrease the size
of the generated xml.
* src/colrow.c (col_row_equal) : new function.
2000-08-31 Morten Welinder <terra@diku.dk>
* src/goal-seek.c (goal_seek_trawl_normally): Respect xmin and
......
2000-08-31 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
merging and ordering.
(col_row_equal) : new function.
(col_row_copy) : new function.
(col_row_size_list_destroy) : Typo.
(col_row_restore_sizes_group) : Handle restoring default size.
(col_row_set_sizes) : In special case of resizing all be smart.
This needs improving.
2000-08-30 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (compute_value) : AM/PM regexp matchs against the
'a' or 'p' not 'pm'
* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
even if the size does not change.
* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
and rationalize the variable names.
(xml_read_rows_info) : Restore the default col size,
(xml_sheet_write) : Save the default row/col size in pts.
Flush the run length encoding of the row/col sizes.
(xml_write_colrow_info) : Use run length encoding to decrease the size
of the generated xml.
* src/colrow.c (col_row_equal) : new function.
2000-08-31 Morten Welinder <terra@diku.dk>
* src/goal-seek.c (goal_seek_trawl_normally): Respect xmin and
......
2000-08-31 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
merging and ordering.
(col_row_equal) : new function.
(col_row_copy) : new function.
(col_row_size_list_destroy) : Typo.
(col_row_restore_sizes_group) : Handle restoring default size.
(col_row_set_sizes) : In special case of resizing all be smart.
This needs improving.
2000-08-30 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (compute_value) : AM/PM regexp matchs against the
'a' or 'p' not 'pm'
* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
even if the size does not change.
* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
and rationalize the variable names.
(xml_read_rows_info) : Restore the default col size,
(xml_sheet_write) : Save the default row/col size in pts.
Flush the run length encoding of the row/col sizes.
(xml_write_colrow_info) : Use run length encoding to decrease the size
of the generated xml.
* src/colrow.c (col_row_equal) : new function.
2000-08-31 Morten Welinder <terra@diku.dk>
* src/goal-seek.c (goal_seek_trawl_normally): Respect xmin and
......
2000-08-31 Jody Goldberg <jgoldberg@home.com>
* src/colrow.c (col_row_get_index_list) : Be more enthusiastic about
merging and ordering.
(col_row_equal) : new function.
(col_row_copy) : new function.
(col_row_size_list_destroy) : Typo.
(col_row_restore_sizes_group) : Handle restoring default size.
(col_row_set_sizes) : In special case of resizing all be smart.
This needs improving.
2000-08-30 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (compute_value) : AM/PM regexp matchs against the
'a' or 'p' not 'pm'
* src/sheet.c (sheet_{col,row}_set_size_{pts,pixels}) : Set hard size
even if the size does not change.
* src/xml-io.c (xml_read_cols_info) : Restore the default col size,
and rationalize the variable names.
(xml_read_rows_info) : Restore the default col size,
(xml_sheet_write) : Save the default row/col size in pts.
Flush the run length encoding of the row/col sizes.
(xml_write_colrow_info) : Use run length encoding to decrease the size
of the generated xml.
* src/colrow.c (col_row_equal) : new function.
2000-08-31 Morten Welinder <terra@diku.dk>
* src/goal-seek.c (goal_seek_trawl_normally): Respect xmin and
......
......@@ -776,8 +776,7 @@ applix_read_view (ApplixReadState *state, char *name)
/* height + one for the grid line */
sheet_row_set_default_size_pixels (sheet,
applix_height_to_pixels (height),
FALSE, FALSE);
applix_height_to_pixels (height));
} else if (!strncmp (buffer, "View Row Heights: ", 18)) {
char *ptr = buffer + 17;
do {
......
......@@ -3417,7 +3417,7 @@ ms_excel_read_default_row_height (BiffQuery *q, ExcelSheet *sheet)
}
#endif
height_units = get_row_height_units (height);
sheet_row_set_default_size_pts (sheet->gnum_sheet, height_units, FALSE, FALSE);
sheet_row_set_default_size_pts (sheet->gnum_sheet, height_units);
}
/**
......
......@@ -13,6 +13,38 @@
#include "sheet.h"
#include "sheet-private.h"
/**
* col_row_equal :
* @a : ColRowInfo #1
* @b : ColRowInfo #2
*
* Returns true if the infos are equivalent.
*/
gboolean
col_row_equal (ColRowInfo const *a, ColRowInfo const *b)
{
if (a == NULL || b == NULL)
return FALSE;
return
a->size_pts == b->size_pts &&
a->margin_a == b->margin_a &&
a->margin_b == b->margin_b &&
a->hard_size == b->hard_size &&
a->visible == b->visible;
}
void
col_row_copy (ColRowInfo *dst, ColRowInfo const *src)
{
dst->margin_a = src->margin_a;
dst->margin_b = src->margin_b;
dst->size_pts = src->size_pts;
dst->size_pixels = src->size_pixels;
dst->hard_size = src->hard_size;
dst->visible = src->visible;
}
/**
* col_row_foreach:
* @sheet the sheet
......@@ -63,9 +95,9 @@ typedef struct _ColRowIndex
} ColRowIndex;
ColRowSizeList *
col_row_size_list_destroy (ColRowIndexList *list)
col_row_size_list_destroy (ColRowSizeList *list)
{
ColRowIndexList *ptr;
ColRowSizeList *ptr;
for (ptr = list; ptr != NULL ; ptr = ptr->next)
g_free (ptr->data);
g_slist_free (list);
......@@ -77,28 +109,49 @@ col_row_index_list_destroy (ColRowIndexList *list)
ColRowIndexList *ptr;
for (ptr = list; ptr != NULL ; ptr = ptr->next)
g_free (ptr->data);
g_slist_free (list);
g_list_free (list);
return NULL;
}
static gint
colrow_index_compare (ColRowIndex const * a, ColRowIndex const * b)
{
return a->first - b->first;
}
/**
* col_row_get_index_list :
*
* Build an ordered list of pairs doing intelligent merging
* of overlapping regions.
*/
ColRowIndexList *
col_row_get_index_list (int first, int last, ColRowIndexList *list)
{
ColRowIndex *tmp;
if (list != NULL) {
tmp = list->data;
if (tmp->last == (first-1)) {
tmp->last = last;
return list;
}
}
ColRowIndex *tmp, *prev;
GList *ptr;
tmp = g_new (ColRowIndex, 1);
tmp->first = first;
tmp->last = last;
return g_slist_prepend (list, tmp);
list = g_list_insert_sorted (list, tmp,
(GCompareFunc)&colrow_index_compare);
prev = list->data;
for (ptr = list->next ; ptr != NULL ; ptr = ptr->next, prev = tmp) {
tmp = ptr->data;
/* at the end of existing segment or contained */
if (prev->last+1 >= tmp->first) {
GList *next = ptr->next;
if (tmp->last > prev->last)
tmp->last = last;
list = g_list_remove_link (list, ptr);
ptr = next;
}
}
return list;
}
double *
......@@ -129,6 +182,24 @@ col_row_save_sizes (Sheet *sheet, gboolean const is_cols, int first, int last)
return res;
}
struct resize_closure
{
Sheet *sheet;
int new_size;
gboolean is_cols;
};
static gboolean
cb_set_colrow_size (ColRowInfo *info, void *userdata)
{
struct resize_closure const *c = userdata;
if (c->is_cols)
sheet_col_set_size_pixels (c->sheet, info->pos, c->new_size, TRUE);
else
sheet_row_set_size_pixels (c->sheet, info->pos, c->new_size, TRUE);
return FALSE;
}
ColRowSizeList *
col_row_set_sizes (Sheet *sheet, gboolean const is_cols,
ColRowIndexList *src, int new_size)
......@@ -142,6 +213,37 @@ col_row_set_sizes (Sheet *sheet, gboolean const is_cols,
res = g_slist_prepend (res,
col_row_save_sizes (sheet, is_cols, index->first, index->last));
/* FIXME :
* If we are changing the size of more than half of the rows/col to
* something specific (not autosize) we should change the default
* row/col size instead. However, it is unclear how to handle
* hard sizing.
*
* we need better management of rows/cols. Currently if they are all
* defined calculation speed grinds to a halt.
*/
if (new_size >= 0 && index->first == 0 &&
index->last == ((is_cols ?SHEET_MAX_COLS:SHEET_MAX_ROWS)-1)) {
struct resize_closure closure;
double *def = g_new(double, 1);
res = g_slist_prepend (res, def);
if (is_cols) {
*def = sheet_col_get_default_size_pts (sheet);
sheet_col_set_default_size_pixels (sheet, new_size);
} else {
*def = sheet_row_get_default_size_pts (sheet);
sheet_row_set_default_size_pixels (sheet, new_size);
}
closure.sheet = sheet;
closure.new_size = new_size;
closure.is_cols = is_cols;
col_row_foreach (&sheet->cols, 0, SHEET_MAX_COLS,
&cb_set_colrow_size, &closure);
return res;
}
for (i = index->first ; i <= index->last ; ++i) {
int tmp = new_size;
if (tmp < 0)
......@@ -222,24 +324,38 @@ col_row_restore_sizes (Sheet *sheet, gboolean const is_cols,
void
col_row_restore_sizes_group (Sheet *sheet, gboolean const is_cols,
ColRowIndexList *selection,
ColRowSizeList *saved_sizes)
ColRowSizeList *saved_sizes,
int old_size)
{
ColRowSizeList *ptr = saved_sizes;
while (selection != NULL && ptr != NULL) {
ColRowIndex *index = selection->data;
if (old_size >= 0 && index->first == 0 &&
index->last == ((is_cols ?SHEET_MAX_COLS:SHEET_MAX_ROWS)-1)) {
double *old_def = ptr->data;
if (is_cols)
sheet_col_set_default_size_pts (sheet, *old_def);
else
sheet_row_set_default_size_pts (sheet, *old_def);
ptr = ptr->next;
g_free (old_def);
}
col_row_restore_sizes (sheet, is_cols,
index->first, index->last,
ptr->data);
selection = selection->next;
ptr = saved_sizes->next;
ptr = ptr->next;
}
g_slist_free (saved_sizes);
}
static gboolean
cb_set_row_height (ColRowInfo *info, void *sheet)
cb_autofit_height (ColRowInfo *info, void *sheet)
{
/* If the size was not set by the user then auto resize */
if (!info->hard_size) {
......@@ -265,7 +381,7 @@ rows_height_update (Sheet *sheet, Range const * range)
* just contents. Empty cells will cause resize also
*/
col_row_foreach (&sheet->rows, range->start.row, range->end.row,
&cb_set_row_height, sheet);
&cb_autofit_height, sheet);
}
/*****************************************************************************/
......
......@@ -32,6 +32,8 @@ struct _ColRowCollection
#define COL_INTERNAL_WIDTH(col) ((col)->size_pixels - ((col)->margin_b + (col)->margin_a + 1))
gboolean col_row_equal (ColRowInfo const *a, ColRowInfo const *b);
void col_row_copy (ColRowInfo *dst, ColRowInfo const *src);
gboolean col_row_foreach (ColRowCollection const *infos,
int first, int last,
col_row_callback callback,
......@@ -49,7 +51,8 @@ void col_row_restore_sizes (Sheet *sheet, gboolean const is_cols,
int first, int last, double *);
void col_row_restore_sizes_group (Sheet *sheet, gboolean const is_cols,
ColRowIndexList *selection,
ColRowSizeList *saved_sizes);
ColRowSizeList *saved_sizes,
int old_size);
void rows_height_update (Sheet *sheet, Range const *range);
......
......@@ -1418,7 +1418,8 @@ cmd_resize_row_col_undo (GnumericCommand *cmd, CommandContext *context)
g_return_val_if_fail (me->saved_sizes != NULL, TRUE);
col_row_restore_sizes_group (me->sheet, me->is_cols,
me->selection, me->saved_sizes);
me->selection, me->saved_sizes,
me->new_size);
me->saved_sizes = NULL;
sheet_set_dirty (me->sheet, TRUE);
......
......@@ -42,7 +42,7 @@ typedef struct _ColRowInfo ColRowInfo;
typedef struct _ColRowCollection ColRowCollection;
typedef GSList ColRowVisList;
typedef GSList ColRowSizeList;
typedef GSList ColRowIndexList;
typedef GList ColRowIndexList;
typedef struct _ColRowIndexSet ColRowIndexSet;
typedef gboolean (*col_row_callback)(ColRowInfo *info, void *user_data);
......
......@@ -71,21 +71,21 @@ create_option_list (const char *const *list)
}
typedef enum {
MATCH_DAY_FULL = 1,
MATCH_DAY_NUMBER,
MATCH_MONTH_FULL,
MATCH_MONTH_SHORT,
MATCH_MONTH_NUMBER,
MATCH_YEAR_FULL,
MATCH_YEAR_SHORT,
MATCH_HOUR,
MATCH_MINUTE,
MATCH_SECOND,
MATCH_AMPM,
MATCH_STRING_CONSTANT,
MATCH_NUMBER,
MATCH_NUMBER_DECIMALS,
MATCH_PERCENT,
MATCH_DAY_FULL = 1,
MATCH_DAY_NUMBER = 2,
MATCH_MONTH_FULL = 3,
MATCH_MONTH_SHORT = 4,
MATCH_MONTH_NUMBER = 5,
MATCH_YEAR_FULL = 6,
MATCH_YEAR_SHORT = 7,
MATCH_HOUR = 8,
MATCH_MINUTE = 9,
MATCH_SECOND = 10,
MATCH_AMPM = 11,
MATCH_NUMBER = 12,
MATCH_NUMBER_DECIMALS = 13,
MATCH_PERCENT = 14,
MATCH_STRING_CONSTANT = 15,
} MatchType;
#define append_type(t) do { guint8 x = t; match_types = g_byte_array_append (match_types, &x, 1); } while (0)
......@@ -792,7 +792,7 @@ compute_value (const char *s, const regmatch_t *mp,
break;
case MATCH_AMPM:
if (g_strcasecmp (str, "pm") == 0)
if (tolower ((unsigned char) *str) == 'p')
is_pm = TRUE;
idx++;
break;
......
......@@ -142,7 +142,7 @@ sheet_init_default_styles (Sheet *sheet)
{
/* measurements are in pts including the margins and far grid line. */
sheet_col_set_default_size_pts (sheet, 48);
sheet_row_set_default_size_pts (sheet, 12.75, FALSE, FALSE);
sheet_row_set_default_size_pts (sheet, 12.75);
}
/*
......@@ -3370,7 +3370,7 @@ sheet_col_get_distance_pts (Sheet const *sheet, int from, int to)
*/
void
sheet_col_set_size_pts (Sheet *sheet, int col, double width_pts,
gboolean set_by_user)
gboolean set_by_user)
{
ColRowInfo *ci;
......@@ -3379,10 +3379,10 @@ sheet_col_set_size_pts (Sheet *sheet, int col, double width_pts,
g_return_if_fail (width_pts > 0.0);
ci = sheet_col_fetch (sheet, col);
ci->hard_size |= set_by_user;
if (ci->size_pts == width_pts)
return;
ci->hard_size |= set_by_user;
ci->size_pts = width_pts;
colrow_compute_pixels_from_pts (sheet, ci, TRUE);
......@@ -3403,10 +3403,10 @@ sheet_col_set_size_pixels (Sheet *sheet, int col, int width_pixels,
g_return_if_fail (width_pixels > 0.0);
ci = sheet_col_fetch (sheet, col);
ci->hard_size |= set_by_user;
if (ci->size_pixels == width_pixels)
return;
ci->hard_size |= set_by_user;
ci->size_pixels = width_pixels;
colrow_compute_pts_from_pixels (sheet, ci, TRUE);
......@@ -3433,15 +3433,32 @@ sheet_col_get_default_size_pts (Sheet const *sheet)
return ci->size_pts;
}
int
sheet_col_get_default_size_pixels (Sheet const *sheet)
{
ColRowInfo const *ci;
g_assert (sheet != NULL);
ci = &sheet->cols.default_style;
return ci->size_pixels;
}
void
sheet_col_set_default_size_pts (Sheet *sheet, double width_pts)
{
sheet_col_row_default_init (sheet, width_pts, 2, 2, TRUE, TRUE);
sheet->priv->recompute_visibility = TRUE;
sheet->priv->recompute_spans = TRUE;
sheet->priv->reposition_col_comment = 0;
}
void
sheet_col_set_default_size_pixels (Sheet *sheet, int width_pixels)
{
sheet_col_row_default_init (sheet, width_pixels, 2, 2, TRUE, FALSE);
sheet->priv->recompute_visibility = TRUE;
sheet->priv->recompute_spans = TRUE;
sheet->priv->reposition_col_comment = 0;
}
/**************************************************************************/
......@@ -3573,10 +3590,10 @@ sheet_row_set_size_pts (Sheet *sheet, int row, double height_pts,
g_return_if_fail (height_pts > 0.0);
ri = sheet_row_fetch (sheet, row);
ri->hard_size |= set_by_user;
if (ri->size_pts == height_pts)
return;
ri->hard_size |= set_by_user;
ri->size_pts = height_pts;
colrow_compute_pixels_from_pts (sheet, ri, FALSE);
......@@ -3611,10 +3628,10 @@ sheet_row_set_size_pixels (Sheet *sheet, int row, int height_pixels,
g_return_if_fail (height_pixels > 0);
ri = sheet_row_fetch (sheet, row);
ri->hard_size |= set_by_user;
if (ri->size_pixels == height_pixels)
return;
ri->hard_size |= set_by_user;
ri->size_pixels = height_pixels;
colrow_compute_pts_from_pixels (sheet, ri, FALSE);
......@@ -3640,27 +3657,34 @@ sheet_row_get_default_size_pts (Sheet const *sheet)
return ci->size_pts;
}
int
sheet_row_get_default_size_pixels (Sheet const *sheet)
{
ColRowInfo const *ci;
g_assert (sheet != NULL);
ci = &sheet->rows.default_style;
return ci->size_pixels;
}
void
sheet_row_set_default_size_pts (Sheet *sheet, double height_pts,
gboolean thick_a, gboolean thick_b)
sheet_row_set_default_size_pts (Sheet *sheet, double height_pts)
{
/* There are an addition few pixels above due the the fonts ascent */
/* Why XL chooses to be asymetric I don't know */
int const a = thick_a ? 2 : 1;
int const b = thick_b ? 1 : 0;
sheet_col_row_default_init (sheet, height_pts, a, b, FALSE, TRUE);
sheet_col_row_default_init (sheet, height_pts, 1, 0, FALSE, TRUE);
sheet->priv->recompute_visibility = TRUE;
sheet->priv->reposition_row_comment = 0;
}
void
sheet_row_set_default_size_pixels (Sheet *sheet, int height_pixels,
gboolean thick_a, gboolean thick_b)
sheet_row_set_default_size_pixels (Sheet *sheet, int height_pixels)
{
/* There are an addition few pixels above due the the fonts ascent */
/* Why XL chooses to be asymetric I don't know */
int const a = thick_a ? 2 : 1;
int const b = thick_b ? 1 : 0;
sheet_col_row_default_init (sheet, height_pixels, a, b, FALSE, FALSE);
sheet_col_row_default_init (sheet, height_pixels, 1, 0, FALSE, FALSE);
sheet->priv->recompute_visibility = TRUE;
sheet->priv->reposition_row_comment = 0;
}
/****************************************************************************/
void
sheet_create_edit_cursor (Sheet *sheet)
{
......
......@@ -220,6 +220,7 @@ void sheet_col_set_size_pts (Sheet *sheet, int col, double width_pts,
void sheet_col_set_size_pixels (Sheet *sheet, int col, int width_pixels,
gboolean set_by_user);
double sheet_col_get_default_size_pts (Sheet const *sheet);
int sheet_col_get_default_size_pixels (Sheet const *sheet);
void sheet_col_set_default_size_pts (Sheet *sheet, double width_pts);
void sheet_col_set_default_size_pixels (Sheet *sheet, int width_pixels);
......@@ -232,10 +233,9 @@ void sheet_row_set_size_pts (Sheet *sheet, int row, double height_pts,
void sheet_row_set_size_pixels (Sheet *sheet, int row, int height_pixels,
gboolean set_by_user);
double sheet_row_get_default_size_pts (Sheet const *sheet);
void sheet_row_set_default_size_pts (Sheet *sheet, double height_pts,
gboolean thick_a, gboolean thick_b);
void sheet_row_set_default_size_pixels (Sheet *sheet, int height_pixels,
gboolean thick_a, gboolean thick_b);