Commit 4292bec2 authored by Jody Goldberg's avatar Jody Goldberg
Browse files

Fix a few zoom and fence post problems

parent cf77cb82
1999-11-15 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (colrow_set_units) : Fix as per Bug 3472.
(sheet_col_size_fit, sheet_row_size_fit) : Include the margins for
non-default sized cells.
* src/cell-draw.c (draw_overflow) : Center display.
* src/cell.c (cell_calc_dimensions) : Behave better when zoomed.
1999-11-15 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_set_zoom_factor) : We are already
manually scaling everything. Don't do it again by scrolling the
canvas.
......
1999-11-15 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (colrow_set_units) : Fix as per Bug 3472.
(sheet_col_size_fit, sheet_row_size_fit) : Include the margins for
non-default sized cells.
* src/cell-draw.c (draw_overflow) : Center display.
* src/cell.c (cell_calc_dimensions) : Behave better when zoomed.
1999-11-15 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.c (sheet_view_set_zoom_factor) : We are already
manually scaling everything. Don't do it again by scrolling the
canvas.
......
......@@ -18,21 +18,19 @@
static void
draw_overflow (GdkDrawable *drawable, GdkGC *gc, GdkFont *font, int x1, int y1, int text_base, int width, int height)
{
int const len = gdk_string_width (font, "#");
int count = (len != 0) ? (width / len) : 0;
GdkRectangle rect;
int len = gdk_string_width (font, "#");
int total, offset;
rect.x = x1;
rect.y = y1;
rect.width = width;
rect.height = height;
gdk_gc_set_clip_rectangle (gc, &rect);
offset = x1 + width - len;
for (total = len; offset > len; total += len){
gdk_draw_text (drawable, font, gc, x1 + offset, text_base, "#", 1);
offset -= len;
}
/* Center */
for (x1 += (width - count*len) / 2; --count >= 0 ; x1 += len )
gdk_draw_text (drawable, font, gc, x1, text_base, "#", 1);
}
/*
......@@ -171,8 +169,8 @@ cell_draw (Cell *cell, SheetView *sheet_view, GdkGC *gc,
if (cell && cell->text && cell->text->str)
text = cell->text->str;
else {
printf ("Serious cell error at '%s'\n", cell_name (cell->col->pos,
cell->row->pos));
g_warning ("Serious cell error at '%s'\n",
cell_name (cell->col->pos, cell->row->pos));
text = "FATAL ERROR";
}
......
......@@ -1219,10 +1219,9 @@ cell_calc_dimensions (Cell *cell)
cell->width = cell->col->margin_a + cell->col->margin_b + w;
cell->height = cell->row->margin_a + cell->row->margin_b + h;
if (cell->height > cell->row->pixels && !cell->row->hard_size) {
if (!cell->row->hard_size &&
(cell->height * cell->sheet->last_zoom_factor_used) > cell->row->pixels)
sheet_row_set_internal_height (cell->sheet, cell->row, h);
printf ("Cell height %d, pixels %d\n", cell->height, cell->row->pixels);
}
mstyle_unref (mstyle);
} else
......
......@@ -470,10 +470,10 @@ sheet_compute_visible_ranges (Sheet const *sheet)
static void
colrow_set_units (Sheet *sheet, ColRowInfo *info)
{
double pix = sheet->last_zoom_factor_used;
double const pix = sheet->last_zoom_factor_used;
info->units = (info->pixels -
(info->margin_a + info->margin_b + 1)) / pix;
info->units = (info->pixels -
(info->margin_a + info->margin_b - 1)) / pix;
}
static void
......@@ -709,7 +709,11 @@ sheet_col_size_fit (Sheet *sheet, int col)
/* Reset to the default width if the column was empty */
if (max < 0)
max = sheet->cols.default_style.pixels;
return max + ci->margin_a + ci->margin_b;
else
/* No need to scale width by zoom factor, that was already done */
max += ci->margin_a + ci->margin_b;
return max;
}
/*
......@@ -762,8 +766,11 @@ sheet_row_size_fit (Sheet *sheet, int row)
/* Reset to the default width if the column was empty */
if (max < 0)
max = sheet->rows.default_style.pixels;
else
/* No need to scale height by zoom factor, that was already done */
max += ri->margin_a + ri->margin_b;
return max + ri->margin_a + ri->margin_b;
return max;
}
typedef struct {
......
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