Commit 0ba84ede authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

update a bit. :pos : removed. :margin_a : removed. :margin_b : removed.

2006-06-25  Jody Goldberg <jody@gnome.org>

	* gnumeric.xsd : update a bit.
	* ColRowInfo::pos : removed.
	* ColRowInfo::margin_a	: removed.
	* ColRowInfo::margin_b	: removed.
	* GnmCell::col_info	: removed.
	* GnmValueErr::src	: removed.

	* src/colrow.c (colrow_foreach) : Pass a new type 'GnmColRowIter' to
	  the handler to provide a position and an info ptr.  All callers
	  changed.

	* src/sheet.c
	(sheet_col_size_fit_pixels) : use the constant margins
	(sheet_row_size_fit_pixels) : ditto and and add +1 for
	  the grid line (why was this different from col_size_fit_pixels).
	* src/dialogs/dialog-row-height.c (dialog_row_height) : row margin is
	  constant now.
	* src/dialogs/dialog-col-width.c (dialog_col_width) : ditto.

	* src/cell-draw.c (cell_calc_layout) : no need for ri, the margins are
	  constant.
	(cell_draw) : row margin is now constant too.
	(cell_finish_layout) : document height better and make the row
	  margins constant.

	* src/cellspan.c (row_calc_spans) : Take the position as an argument
	  now that ColRowInfo::pos is gone.  All callers changed.
parent 8b131bca
2006-06-25 Jody Goldberg <jody@gnome.org>
* gnumeric.xsd : update a bit.
* ColRowInfo::pos : removed.
* ColRowInfo::margin_a : removed.
* ColRowInfo::margin_b : removed.
* GnmCell::col_info : removed.
* GnmValueErr::src : removed.
* src/colrow.c (colrow_foreach) : Pass a new type 'GnmColRowIter' to
the handler to provide a position and an info ptr. All callers
changed.
* src/sheet.c
(sheet_col_size_fit_pixels) : use the constant margins
(sheet_row_size_fit_pixels) : ditto and and add +1 for
the grid line (why was this different from col_size_fit_pixels).
* src/dialogs/dialog-row-height.c (dialog_row_height) : row margin is
constant now.
* src/dialogs/dialog-col-width.c (dialog_col_width) : ditto.
* src/cell-draw.c (cell_calc_layout) : no need for ri, the margins are
constant.
(cell_draw) : row margin is now constant too.
(cell_finish_layout) : document height better and make the row
margins constant.
* src/cellspan.c (row_calc_spans) : Take the position as an argument
now that ColRowInfo::pos is gone. All callers changed.
2006-06-25 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/sheet.c (sheet_set_name): update the Sheet_Title name
......
......@@ -15,7 +15,9 @@ Jody:
* Only install util man pages if they are built. [#341916]
* Handle Tab/Return movement. [#88167]
* Re-enable R1C1 parsing.
* Remove GnmCell::col_info to shrink cell by 4 more bytes.
* Remove GnmCell::col_info to shrink cell by a ptr
* Remove ColRowInfo::pos to shrink col/row by an int
* Update schema a bit.
Morten:
* Moved font metrics to goffice.
......
......@@ -150,7 +150,6 @@ interface to Gnumeric using the data structure GnmValue, which is a
discriminated union. This table shows the mappings between the various
types of Gnumeric values and Python data types.
VALUE_INTEGER <=> Python integer
VALUE_FLOAT <=> Python float
VALUE_STRING <=> Python string
VALUE_CELLRANGE <=> Python CellRange class
......
......@@ -68,9 +68,12 @@ ColRowInfo
int pos
Style style
int units
int pixels
There were once (pre 1.7.1)
int margin_a
int margin_b
int pixels
But they are now depricated and ignored.
GnmCell
GnmCellPos pos
......
This diff is collapsed.
......@@ -293,6 +293,8 @@ excel_read_pivot_caches (GnmXLImporter *importer,
BiffQuery *q;
GsfInput *cache, *dir;
return;
if (NULL == ole)
return; /* pre-Excel 95 without ole */
dir = gsf_infile_child_by_name (ole, "_SX_DB_CUR"); /* Excel 97 */
......
......@@ -28,6 +28,8 @@
</service>
<service type="file_saver" id="excel_biff8" file_extension="xls"
format_level="auto" overwrite_files="TRUE">
<!-- Add default_saver_priority="100" to make
this the default -->
<information>
<_description>MS Excel (tm) 97/2000/XP</_description>
</information>
......
......@@ -387,11 +387,9 @@ static void
write_row (GsfOutput *output, Sheet *sheet, gint row, GnmRange *range, html_version_t version)
{
gint col;
ColRowInfo const * ri;
ri = sheet_row_get_info (sheet, row);
ColRowInfo const *ri = sheet_row_get_info (sheet, row);
if (ri->needs_respan)
row_calc_spans ((ColRowInfo *) ri, sheet);
row_calc_spans ((ColRowInfo *) ri, row, sheet);
for (col = range->start.col; col <= range->end.col; col++) {
CellSpanInfo const *the_span;
......
......@@ -1185,7 +1185,7 @@ latex_file_save (GOFileSaver const *fs, IOContext *io_context,
ColRowInfo const * ri;
ri = sheet_row_get_info (current_sheet, row);
if (ri->needs_respan)
row_calc_spans ((ColRowInfo *) ri, current_sheet);
row_calc_spans ((ColRowInfo *) ri, row, current_sheet);
/* We need to check for horizontal borders at the top of this row */
length = num_cols;
......
......@@ -109,7 +109,7 @@ roff_file_save (GOFileSaver const *fs, IOContext *io_context,
ColRowInfo const * ri;
ri = sheet_row_get_info (sheet, row);
if (ri->needs_respan)
row_calc_spans ((ColRowInfo *) ri, sheet);
row_calc_spans ((ColRowInfo *) ri, row, sheet);
if (row > r.start.row)
gsf_output_printf (output, ".T&\n");
......
......@@ -51,7 +51,6 @@ cell_calc_layout (GnmCell const *cell, RenderedValue *rv, int y_direction,
int width, int height, int h_center,
GOColor *res_color, gint *res_x, gint *res_y)
{
ColRowInfo const * const ri = cell->row_info; /* DEPRECATED */
int text_base;
PangoLayout *layout;
int indent;
......@@ -73,7 +72,7 @@ cell_calc_layout (GnmCell const *cell, RenderedValue *rv, int y_direction,
/* This rectangle has the whole area used by this cell
* excluding the surrounding grid lines and margins */
rect_x = PANGO_SCALE * (1 + GNM_COL_MARGIN);
rect_y = PANGO_SCALE * y_direction * (1 + ri->margin_a);
rect_y = PANGO_SCALE * y_direction * (1 + GNM_ROW_MARGIN);
/* if a number overflows, do special drawing */
if (rv->layout_natural_width > width - indent &&
......@@ -248,7 +247,7 @@ cell_finish_layout (GnmCell const *cell, RenderedValue *rv,
* @x1 :
* @y1 :
* @width : including margins and leading grid line
* @height :
* @height : including margins and leading grid line
* @h_center :
**/
void
......@@ -259,15 +258,11 @@ cell_draw (GnmCell const *cell, GdkGC *gc, GdkDrawable *drawable,
gint x;
gint y;
RenderedValue *rv = cell->rendered_value;
ColRowInfo const * const ri = cell->row_info;
/* Get the sizes exclusive of margins and grids */
/* FIXME : all callers will eventually pass in their cell size */
if (height < 0) /* DEPRECATED */
height = ri->size_pixels - (ri->margin_b + ri->margin_a + 1);
/* Note: +1 because size_pixels includes right gridline. */
width -= (GNM_COL_MARGIN + GNM_COL_MARGIN + 1);
/* Note: +1 because size_pixels includes leading gridline. */
height -= GNM_ROW_MARGIN + GNM_ROW_MARGIN + 1;
width -= GNM_COL_MARGIN + GNM_COL_MARGIN + 1;
if (cell_calc_layout (cell, rv, +1,
width * PANGO_SCALE,
......@@ -279,7 +274,7 @@ cell_draw (GnmCell const *cell, GdkGC *gc, GdkDrawable *drawable,
/* +1 to get past left grid-line. */
GdkRectangle rect;
rect.x = x1 + 1 + GNM_COL_MARGIN;
rect.y = y1 + 1 + ri->margin_a;
rect.y = y1 + 1 + GNM_ROW_MARGIN;
rect.width = width;
rect.height = height;
......
......@@ -128,8 +128,8 @@ cell_unregister_span (GnmCell const * const cell)
if (cell->row_info->spans == NULL)
return;
g_hash_table_foreach_remove (cell->row_info->spans, &span_remove,
(gpointer)cell);
g_hash_table_foreach_remove (cell->row_info->spans,
&span_remove, (gpointer)cell);
}
/*
......@@ -168,15 +168,17 @@ row_span_get (ColRowInfo const * const ri, int const col)
* returns TRUE if the cell is empty.
*/
static inline gboolean
cellspan_is_empty (int col, ColRowInfo const *ri, GnmCell const *ok_span_cell)
cellspan_is_empty (int col, GnmCell const *ok_span_cell)
{
CellSpanInfo const *span = row_span_get (ri, col);
CellSpanInfo const *span = row_span_get (ok_span_cell->row_info, col);
GnmCell const *tmp;
if (span != NULL && span->cell != ok_span_cell)
return FALSE;
tmp = sheet_cell_get (ok_span_cell->base.sheet, col, ri->pos);
tmp = sheet_cell_get (ok_span_cell->base.sheet,
col, ok_span_cell->pos.row);
/* FIXME : cannot use cell_is_empty until expressions can span.
* because cells with expressions start out with value Empty
* existing spans continue to flow through, but never get removed
......@@ -199,18 +201,16 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
{
Sheet *sheet;
int h_align, v_align, left, max_col, min_col;
int row, pos, margin;
int row, pos;
int cell_width_pixel, indented_w;
GnmStyle const *style;
ColRowInfo const *ri, *ci;
ColRowInfo const *ci;
GnmRange const *merge_left;
GnmRange const *merge_right;
g_return_if_fail (cell != NULL);
sheet = cell->base.sheet;
ri = cell->row_info;
style = cell_get_style (cell);
h_align = style_default_halign (style, cell);
......@@ -239,7 +239,7 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
h_align = (h_align == HALIGN_LEFT) ? HALIGN_RIGHT : HALIGN_LEFT;
}
ci = sheet_col_get_info (cell->base.sheet, cell->pos.col);
ci = sheet_col_get_info (sheet, cell->pos.col);
if (cell_is_empty (cell) ||
!ci->visible ||
(h_align != HALIGN_CENTER_ACROSS_SELECTION &&
......@@ -263,62 +263,54 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
case HALIGN_LEFT:
pos = cell->pos.col + 1;
left = indented_w - COL_INTERNAL_WIDTH (ci);
margin = GNM_COL_MARGIN;
for (; left > 0 && pos < max_col; pos++){
ColRowInfo const *ci = sheet_col_get_info (sheet, pos);
if (ci->visible) {
if (!cellspan_is_empty (pos, ri, cell))
if (!cellspan_is_empty (pos, cell))
return;
/* The space consumed is:
* - The margin_b from the last column
* - The width of the cell
*/
left -= COL_INTERNAL_WIDTH (ci) +
margin + ci->margin_a;
left -= ci->size_pixels - 1;
*col2 = pos;
}
margin = ci->margin_b;
}
return;
case HALIGN_RIGHT:
pos = cell->pos.col - 1;
left = indented_w - COL_INTERNAL_WIDTH (ci);
margin = GNM_COL_MARGIN;
for (; left > 0 && pos > min_col; pos--){
ColRowInfo const *ci = sheet_col_get_info (sheet, pos);
if (ci->visible) {
if (!cellspan_is_empty (pos, ri, cell))
if (!cellspan_is_empty (pos, cell))
return;
/* The space consumed is:
* - The margin_a from the last column
* - The width of this cell
*/
left -= COL_INTERNAL_WIDTH (ci) +
margin + ci->margin_b;
left -= ci->size_pixels - 1;
*col1 = pos;
}
margin = ci->margin_a;
}
return;
case HALIGN_CENTER: {
int remain_left, remain_right;
int margin_a, margin_b, pos_l, pos_r;
int pos_l, pos_r;
pos_l = pos_r = cell->pos.col;
left = cell_width_pixel - COL_INTERNAL_WIDTH (ci);
left = cell_width_pixel - COL_INTERNAL_WIDTH (ci);
remain_left = left / 2 + (left % 2);
remain_right = left / 2;
margin_a = GNM_COL_MARGIN;
margin_b = GNM_COL_MARGIN;
for (; remain_left > 0 || remain_right > 0;){
ColRowInfo const *ci;
......@@ -327,10 +319,8 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
ci = sheet_col_get_info (sheet, pos_l);
if (ci->visible) {
if (cellspan_is_empty (pos_l, ri, cell)) {
remain_left -= COL_INTERNAL_WIDTH (ci) +
margin_a + ci->margin_b;
margin_a = ci->margin_a;
if (cellspan_is_empty (pos_l, cell)) {
remain_left -= ci->size_pixels - 1;
*col1 = pos_l;
} else
remain_left = 0;
......@@ -342,10 +332,8 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
ci = sheet_col_get_info (sheet, pos_r);
if (ci->visible) {
if (cellspan_is_empty (pos_r, ri, cell)) {
remain_right -= COL_INTERNAL_WIDTH (ci) +
margin_b + ci->margin_a;
margin_b = ci->margin_b;
if (cellspan_is_empty (pos_r, cell)) {
remain_right -= ci->size_pixels - 1;
*col2 = pos_r;
} else
max_col = remain_right = 0;
......@@ -356,16 +344,15 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
break;
} /* case HALIGN_CENTER */
case HALIGN_CENTER_ACROSS_SELECTION:
{
int const row = ri->pos;
case HALIGN_CENTER_ACROSS_SELECTION: {
int const row = cell->pos.row;
int pos_l, pos_r;
pos_l = pos_r = cell->pos.col;
while (--pos_l > min_col) {
ColRowInfo const *ci = sheet_col_get_info (sheet, pos_l);
if (ci->visible) {
if (cellspan_is_empty (pos_l, ri, cell)) {
if (cellspan_is_empty (pos_l, cell)) {
GnmStyle const * const style =
sheet_style_get (cell->base.sheet, pos_l, row);
......@@ -379,7 +366,7 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
while (++pos_r < max_col) {
ColRowInfo const *ci = sheet_col_get_info (sheet, pos_r);
if (ci->visible) {
if (cellspan_is_empty (pos_r, ri, cell)) {
if (cellspan_is_empty (pos_r, cell)) {
GnmStyle const * const style =
sheet_style_get (cell->base.sheet, pos_r, row);
......@@ -399,14 +386,14 @@ cell_calc_span (GnmCell const *cell, int *col1, int *col2)
}
void
row_calc_spans (ColRowInfo *rinfo, Sheet const *sheet)
row_calc_spans (ColRowInfo *ri, int row, Sheet const *sheet)
{
int left, right, col, row = rinfo->pos;
int left, right, col;
GnmRange const *merged;
GnmCell *cell;
int const last = sheet->cols.max_used;
row_destroy_span (rinfo);
row_destroy_span (ri);
for (col = 0 ; col <= last ; ) {
cell = sheet_cell_get (sheet, col, row);
if (cell == NULL) {
......@@ -439,5 +426,5 @@ row_calc_spans (ColRowInfo *rinfo, Sheet const *sheet)
col++;
}
rinfo->needs_respan = FALSE;
ri->needs_respan = FALSE;
}
......@@ -16,7 +16,6 @@ void cell_unregister_span (GnmCell const *cell);
CellSpanInfo const *row_span_get (ColRowInfo const *ri, int col);
void row_destroy_span (ColRowInfo *ri);
void row_calc_spans (ColRowInfo *ri, Sheet const *sheet);
void row_calc_spans (ColRowInfo *ri, int row, Sheet const *sheet);
#endif /* GNUMERIC_CELLSPAN_H */
......@@ -39,7 +39,7 @@ void
colrow_compute_pixels_from_pts (ColRowInfo *cri,
Sheet const *sheet, gboolean horizontal)
{
int const margin = cri->margin_a + cri->margin_b;
int const margin = horizontal ? 2*GNM_COL_MARGIN : 2*GNM_ROW_MARGIN;
double const scale =
sheet->last_zoom_factor_used *
gnm_app_display_dpi_get (horizontal) / 72.;
......@@ -64,12 +64,11 @@ colrow_compute_pts_from_pixels (ColRowInfo *cri,
#endif
}
/* TODO : use the is_default flag */
gboolean
colrow_is_default (ColRowInfo const *cri)
{
g_return_val_if_fail (cri != NULL, FALSE);
return cri->pos < 0;
return cri->is_default;
}
/**
......@@ -105,8 +104,6 @@ colrow_equal (ColRowInfo const *a, ColRowInfo const *b)
return FALSE;
return a->size_pts == b->size_pts &&
a->margin_a == b->margin_a &&
a->margin_b == b->margin_b &&
a->outline_level == b->outline_level &&
a->is_collapsed == b->is_collapsed &&
a->hard_size == b->hard_size &&
......@@ -125,8 +122,6 @@ colrow_copy (ColRowInfo *dst, ColRowInfo const *src)
{
dst->size_pts = src->size_pts;
dst->size_pixels = src->size_pixels;
dst->margin_a = src->margin_a;
dst->margin_b = src->margin_b;
dst->outline_level = src->outline_level;
dst->is_collapsed = src->is_collapsed;
dst->hard_size = src->hard_size;
......@@ -151,7 +146,9 @@ gboolean
colrow_foreach (ColRowCollection const *infos, int first, int last,
ColRowHandler callback, void *user_data)
{
int i;
GnmColRowIter iter;
ColRowSegment const *segment;
int inner_last, i;
/* TODO : Do we need to support right -> left as an option */
......@@ -159,21 +156,18 @@ colrow_foreach (ColRowCollection const *infos, int first, int last,
if (last > infos->max_used)
last = infos->max_used;
i = first;
while (i <= last) {
ColRowSegment const *segment = COLROW_GET_SEGMENT (infos, i);
int sub = COLROW_SUB_INDEX(i);
int inner_last;
for (i = first; i <= last ; ) {
segment = COLROW_GET_SEGMENT (infos, i);
iter.pos = COLROW_SUB_INDEX(i);
inner_last = (COLROW_SEGMENT_INDEX (last) == COLROW_SEGMENT_INDEX (i))
? COLROW_SUB_INDEX (last)+1 : COLROW_SEGMENT_SIZE;
i += COLROW_SEGMENT_SIZE - sub;
i += COLROW_SEGMENT_SIZE - iter.pos;
if (segment == NULL)
continue;
for (; sub < inner_last; ++sub) {
ColRowInfo *info = segment->info[sub];
if (info != NULL && (*callback)(info, user_data))
for (; iter.pos < inner_last; ++iter.pos) {
iter.cri = segment->info[iter.pos];
if (iter.cri != NULL && (*callback)(&iter, user_data))
return TRUE;
}
}
......@@ -391,24 +385,23 @@ colrow_get_states (Sheet *sheet, gboolean is_cols, int first, int last)
return g_slist_reverse (list);
}
struct resize_closure
{
struct resize_closure {
Sheet *sheet;
int new_size;
int new_size;
gboolean is_cols;
};
static gboolean
cb_set_colrow_size (ColRowInfo *info, void *userdata)
cb_set_colrow_size (GnmColRowIter const *iter, void *userdata)
{
if (info->visible) {
if (iter->cri->visible) {
struct resize_closure const *c = userdata;
if (c->is_cols)
sheet_col_set_size_pixels (c->sheet, info->pos,
sheet_col_set_size_pixels (c->sheet, iter->pos,
c->new_size, TRUE);
else
sheet_row_set_size_pixels (c->sheet, info->pos,
sheet_row_set_size_pixels (c->sheet, iter->pos,
c->new_size, TRUE);
}
return FALSE;
......@@ -651,16 +644,15 @@ struct cb_autofit {
};
static gboolean
cb_autofit_col (ColRowInfo *info, void *data_)
cb_autofit_col (GnmColRowIter const *iter, void *data_)
{
struct cb_autofit *data = data_;
int size, min, max;
if (info->hard_size)
if (iter->cri->hard_size)
return FALSE;
size = sheet_col_size_fit_pixels
(data->sheet, info->pos,
size = sheet_col_size_fit_pixels (data->sheet, iter->pos,
data->range->start.row, data->range->end.row,
data->ignore_strings);
/* FIXME: better idea than this? */
......@@ -669,28 +661,26 @@ cb_autofit_col (ColRowInfo *info, void *data_)
min = 0;
if (data->min_current)
min = MAX (min, info->size_pixels);
min = MAX (min, iter->cri->size_pixels);
if (data->min_default)
min = MAX (min, sheet_col_get_default_size_pixels (data->sheet));
if (size > min)
sheet_col_set_size_pixels (data->sheet, info->pos,
size, FALSE);
sheet_col_set_size_pixels (data->sheet, iter->pos, size, FALSE);
return FALSE;
}
static gboolean
cb_autofit_row (ColRowInfo *info, void *data_)
cb_autofit_row (GnmColRowIter const *iter, void *data_)
{
struct cb_autofit *data = data_;
int size, min, max;
if (info->hard_size)
if (iter->cri->hard_size)
return FALSE;
size = sheet_row_size_fit_pixels
(data->sheet, info->pos,
size = sheet_row_size_fit_pixels (data->sheet, iter->pos,
data->range->start.col, data->range->end.col,
data->ignore_strings);
max = 20 * sheet_row_get_default_size_pixels (data->sheet);
......@@ -698,13 +688,12 @@ cb_autofit_row (ColRowInfo *info, void *data_)
min = 0;
if (data->min_current)
min = MAX (min, info->size_pixels);
min = MAX (min, iter->cri->size_pixels);
if (data->min_default)
min = MAX (min, sheet_row_get_default_size_pixels (data->sheet));
if (size > min)
sheet_row_set_size_pixels (data->sheet, info->pos,
size, FALSE);
sheet_row_set_size_pixels (data->sheet, iter->pos, size, FALSE);
return FALSE;
}
......
......@@ -4,16 +4,10 @@
#include "gnumeric.h"
struct _ColRowInfo {
int pos; /* the column or row number */
/* Size including margins, and right grid line */
float size_pts;
int size_pixels;
/* These are not scaled, and are the same in points and pixels */
unsigned margin_a : 3; /* top/left margin */
unsigned margin_b : 3; /* bottom/right margin */
unsigned is_default : 1;
unsigned outline_level : 4;
unsigned is_collapsed : 1; /* Does this terminate an outline ? */
......@@ -37,8 +31,10 @@ struct _ColRowCollection {
int size_pixels;
};
/* We never did get around to support 'thick' borders so these are constants */
#define GNM_COL_MARGIN 2 /* these do not scale, no unit needed */
/* We never did get around to support 'thick' borders so these are effectively
* unitless (margins do not scale) constants . */
#define GNM_COL_MARGIN 2
#define GNM_ROW_MARGIN 0
/* The size, mask, and shift must be kept in sync */
#define COLROW_SEGMENT_SIZE 0x80
......@@ -55,7 +51,8 @@ struct _ColRowSegment {
int size_pixels;
};
#define COL_INTERNAL_WIDTH(col) ((col)->size_pixels - ((col)->margin_b + (col)->margin_a + 1))
#define COL_INTERNAL_WIDTH(col) \
((col)->size_pixels - (GNM_COL_MARGIN + GNM_COL_MARGIN + 1))
void colrow_compute_pixels_from_pts (ColRowInfo *cri, Sheet const *sheet,
gboolean horizontal);
......@@ -67,7 +64,12 @@ gboolean colrow_is_empty (ColRowInfo const *cri);
gboolean colrow_equal (ColRowInfo const *a, ColRowInfo const *b);
void colrow_copy (ColRowInfo *dst, ColRowInfo const *src);
typedef gboolean (*ColRowHandler)(ColRowInfo *info, gpointer user_data);
typedef struct {
int pos;
ColRowInfo const *cri;
} GnmColRowIter;
typedef gboolean (*ColRowHandler)(GnmColRowIter const *iter, gpointer user_data);
gboolean colrow_foreach (ColRowCollection const *infos,
int first, int last,
ColRowHandler callback,
......
......@@ -271,8 +271,7 @@ dialog_col_width (WorkbookControlGUI *wbcg, gboolean use_default)
state->spin = GTK_SPIN_BUTTON (glade_xml_get_widget (state->gui, "spin"));
gtk_spin_button_get_adjustment (state->spin)->lower =
state->sheet->cols.default_style.margin_a +
state->sheet->cols.default_style.margin_b;
GNM_COL_MARGIN + GNM_COL_MARGIN;
g_signal_connect (G_OBJECT (state->spin),
"value-changed",
G_CALLBACK (cb_dialog_col_width_value_changed), state);
......
......@@ -269,8 +269,7 @@ dialog_row_height (WorkbookControlGUI *wbcg, gboolean use_default)
state->spin = GTK_SPIN_BUTTON (glade_xml_get_widget (state->gui, "spin"));
gtk_spin_button_get_adjustment (state->spin)->lower =
state->sheet->rows.default_style.margin_a +
state->sheet->rows.default_style.margin_b;
GNM_ROW_MARGIN + GNM_ROW_MARGIN;
g_signal_connect (G_OBJECT (state->spin),
"value-changed",
G_CALLBACK (cb_dialog_row_height_value_changed), state);
......
......@@ -316,8 +316,8 @@ set_selection_state (ScenariosState *state, gboolean f)
GtkTreeIter iter;
GtkTreeModel *model;
gchar *name;
gchar *comment;
gchar *cells;
gchar *comment = NULL;
gchar *cells = NULL;
selection = gtk_tree_view_get_selection
(GTK_TREE_VIEW
......
......@@ -892,19 +892,24 @@ item_bar_event (FooCanvasItem *item, GdkEvent *e)
new_size += cri->size_pixels;
/* Ensure we always have enough room for the margins */
if (new_size <= (cri->margin_a + cri->margin_b)) {
new_size = cri->margin_a + cri->margin_b + 1;
if (is_cols)
if (is_cols) {
if (new_size <= (GNM_COL_MARGIN + GNM_COL_MARGIN)) {
new_size = GNM_COL_MARGIN + GNM_COL_MARGIN + 1;
pos = gcanvas->first_offset.col +
scg_colrow_distance_get (scg, TRUE,
gcanvas->first.col,
ib->colrow_being_resized);
else
pos += new_size;
}
} else {
if (new_size <= (GNM_ROW_MARGIN + GNM_ROW_MARGIN)) {
new_size = GNM_ROW_MARGIN + GNM_ROW_MARGIN + 1;
pos = gcanvas->first_offset.row +
scg_colrow_distance_get (scg, FALSE,
gcanvas->first.row,
ib->colrow_being_resized);
pos += new_size;
pos += new_size;
}
}
ib->colrow_resize_size = new_size;
......
......@@ -130,10 +130,8 @@ static void
get_top_left (ItemEdit const *ie, int *top, int *left)
{
GnmVAlign const align = gnm_style_get_align_v (ie->style);
ColRowInfo const *ci = sheet_col_get_info (
sc_sheet (SHEET_CONTROL (ie->scg)), ie->pos.col);
*left = ((int)ie->item.x1) + ci->margin_a;
*left = ((int)ie->item.x1) + GNM_COL_MARGIN;
*top = (int)ie->item.y1;
if (align == VALIGN_CENTER || align == VALIGN_DISTRIBUTED ||
......@@ -243,7 +241,7 @@ ie_layout (FooCanvasItem *item)
ItemEdit *ie = ITEM_EDIT (item);
GtkWidget const *canvas = GTK_WIDGET (item->canvas);
GnmCanvas const *gcanvas = GNM_CANVAS (item->canvas);
ColRowInfo const *cri;
ColRowInfo const *ci;
Sheet const *sheet = sc_sheet (SHEET_CONTROL (ie->scg));
GnmFont const *gfont = ie->gfont;
GnmRange const *merged;
......@@ -254,9 +252,9 @@ ie_layout (FooCanvasItem *item)
int cursor_pos = gtk_editable_get_position (GTK_EDITABLE (ie->entry));
end_col = ie->pos.col;
cri = sheet_col_get_info (sheet, end_col);
ci = sheet_col_get_info (sheet, end_col);
g_return_if_fail (cri != NULL);
g_return_if_fail (ci != NULL);
entered_text = gtk_entry_get_text (ie->entry);
text = wbcg_edit_get_display_text (scg_get_wbcg (ie->scg));
......@@ -312,27 +310,27 @@ ie_layout (FooCanvasItem *item)
pango_layout_get_pixel_size (ie->layout, &width, &height);
/* Start after the grid line and the left margin */
col_size = cri->size_pixels - cri->margin_a - 1;
col_size = ci->size_pixels - GNM_COL_MARGIN - 1;
if (sheet->text_is_rtl)
while (col_size < width &&
end_col > gcanvas->first.col &&
end_col > 0) {
end_col--;