Commit 17fb06d4 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Move the span handling here. from here.


2000-12-14  Jody Goldberg <jgoldberg@home.com>

	* src/item-grid.c (item_grid_draw) : Move the span handling here.
	* src/cell-draw.c (cell_draw) : from here.

	* src/print-cell.c (print_cell_range) : Move the span handling here.
	(print_cell) : rather than here.

	* src/sheet-control-gui.c (scg_get_distance) : merge
	  sheet_{row,col}_distance_get_pixels and make the result sheet
	  control specific.

2000-12-14  Jody Goldberg <jgoldberg@home.com>

	* src/cell.c (cell_convert_expr_to_value) : rename from cell_make_value.

	* src/format.c (format_number) : adjust signature to take the
	  colwidth in preparation for supporting
	(format_value) : pass in the width.

2000-12-14  Jody Goldberg <jgoldberg@home.com>

	* src/formats.c (currency_date_format_init) : correctly place currency
	  before or after the value, and optionally include a space.

	* src/format.c (format_get_currency) : include info on currency
	  placement.

2000-12-14  Jody Goldberg <jgoldberg@home.com>

	* src/workbook.c (workbook_sheet_rename) : Handle renames that only
	  change case more smoothly.
parent d97f05fd
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : Move the span handling here.
* src/cell-draw.c (cell_draw) : from here.
* src/print-cell.c (print_cell_range) : Move the span handling here.
(print_cell) : rather than here.
* src/sheet-control-gui.c (scg_get_distance) : merge
sheet_{row,col}_distance_get_pixels and make the result sheet
control specific.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_convert_expr_to_value) : rename from cell_make_value.
* src/format.c (format_number) : adjust signature to take the
colwidth in preparation for supporting
(format_value) : pass in the width.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (currency_date_format_init) : correctly place currency
before or after the value, and optionally include a space.
* src/format.c (format_get_currency) : include info on currency
placement.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_sheet_rename) : Handle renames that only
change case more smoothly.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* configure.in : Gussy up the reporting to improve readability
......
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : Move the span handling here.
* src/cell-draw.c (cell_draw) : from here.
* src/print-cell.c (print_cell_range) : Move the span handling here.
(print_cell) : rather than here.
* src/sheet-control-gui.c (scg_get_distance) : merge
sheet_{row,col}_distance_get_pixels and make the result sheet
control specific.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_convert_expr_to_value) : rename from cell_make_value.
* src/format.c (format_number) : adjust signature to take the
colwidth in preparation for supporting
(format_value) : pass in the width.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (currency_date_format_init) : correctly place currency
before or after the value, and optionally include a space.
* src/format.c (format_get_currency) : include info on currency
placement.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_sheet_rename) : Handle renames that only
change case more smoothly.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* configure.in : Gussy up the reporting to improve readability
......
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : Move the span handling here.
* src/cell-draw.c (cell_draw) : from here.
* src/print-cell.c (print_cell_range) : Move the span handling here.
(print_cell) : rather than here.
* src/sheet-control-gui.c (scg_get_distance) : merge
sheet_{row,col}_distance_get_pixels and make the result sheet
control specific.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_convert_expr_to_value) : rename from cell_make_value.
* src/format.c (format_number) : adjust signature to take the
colwidth in preparation for supporting
(format_value) : pass in the width.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (currency_date_format_init) : correctly place currency
before or after the value, and optionally include a space.
* src/format.c (format_get_currency) : include info on currency
placement.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_sheet_rename) : Handle renames that only
change case more smoothly.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* configure.in : Gussy up the reporting to improve readability
......
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : Move the span handling here.
* src/cell-draw.c (cell_draw) : from here.
* src/print-cell.c (print_cell_range) : Move the span handling here.
(print_cell) : rather than here.
* src/sheet-control-gui.c (scg_get_distance) : merge
sheet_{row,col}_distance_get_pixels and make the result sheet
control specific.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_convert_expr_to_value) : rename from cell_make_value.
* src/format.c (format_number) : adjust signature to take the
colwidth in preparation for supporting
(format_value) : pass in the width.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (currency_date_format_init) : correctly place currency
before or after the value, and optionally include a space.
* src/format.c (format_get_currency) : include info on currency
placement.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_sheet_rename) : Handle renames that only
change case more smoothly.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* configure.in : Gussy up the reporting to improve readability
......
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : Move the span handling here.
* src/cell-draw.c (cell_draw) : from here.
* src/print-cell.c (print_cell_range) : Move the span handling here.
(print_cell) : rather than here.
* src/sheet-control-gui.c (scg_get_distance) : merge
sheet_{row,col}_distance_get_pixels and make the result sheet
control specific.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_convert_expr_to_value) : rename from cell_make_value.
* src/format.c (format_number) : adjust signature to take the
colwidth in preparation for supporting
(format_value) : pass in the width.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (currency_date_format_init) : correctly place currency
before or after the value, and optionally include a space.
* src/format.c (format_get_currency) : include info on currency
placement.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_sheet_rename) : Handle renames that only
change case more smoothly.
2000-12-14 Jody Goldberg <jgoldberg@home.com>
* configure.in : Gussy up the reporting to improve readability
......
......@@ -139,7 +139,7 @@ cell_split_text (GdkFont *font, char const *text, int const width)
* of the gridlines (marked a).
*/
void
cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo,
cell_draw (Cell const *cell, MStyle *mstyle,
GdkGC *gc, GdkDrawable *drawable, int x1, int y1, int width, int height)
{
StyleFont *style_font;
......@@ -193,26 +193,6 @@ cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo
rect.width = width;
rect.height = height;
if (spaninfo != NULL && sheet != NULL) {
/* x1, y1 are relative to this cell origin, but the cell
* might be using columns to the left (if it is set to right
* justify or center justify) compute the pixel difference
*
* NOTE : If sheet is null than center across selection will not
* work currently this is only applicable to the preview-grid
* (preview-grid.c)
*/
if (spaninfo->left != cell->pos.col) {
int offset = sheet_col_get_distance_pixels (sheet,
spaninfo->left, cell->pos.col);
rect.x -= offset;
rect.width += offset;
}
if (spaninfo->right != cell->pos.col)
rect.width += sheet_col_get_distance_pixels (sheet,
cell->pos.col+1, spaninfo->right+1);
}
style_font = sheet_view_get_style_font (sheet, mstyle);
font = style_font_gdk_font (style_font);
font_height = style_font_get_height (style_font);
......
......@@ -3,9 +3,8 @@
#include <glib.h>
#include "gnumeric.h"
#include "cellspan.h"
void cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo,
void cell_draw (Cell const *cell, MStyle *mstyle,
GdkGC *gc, GdkDrawable *drawable, int x, int y, int height, int width);
#endif /* GNUMERIC_CELL_DRAW_H */
......@@ -752,7 +752,7 @@ cell_set_format (Cell *cell, char const *format)
}
/**
* cell_make_value : drops the expression keeps its value. Then uses the formatted
* cell_convert_expr_to_value : drops the expression keeps its value. Then uses the formatted
* result as if that had been entered.
*
* NOTE : the cell's expression cannot be linked into the expression * list.
......@@ -766,7 +766,7 @@ cell_set_format (Cell *cell, char const *format)
* NOTE : This DOES NOT check for array partitioning.
*/
void
cell_make_value (Cell *cell)
cell_convert_expr_to_value (Cell *cell)
{
g_return_if_fail (cell != NULL);
g_return_if_fail (cell_has_expr(cell));
......
......@@ -64,30 +64,32 @@ StyleHAlignFlags cell_default_halign (Cell const *v, MStyle const *mstyle);
/**
* Utilities to assign the contents of a cell
*/
void cell_set_text (Cell *c, char const *text);
void cell_assign_value (Cell *c, Value *v, StyleFormat *fmt);
void cell_set_value (Cell *c, Value *v, StyleFormat *fmt);
void cell_set_expr_and_value (Cell *c, ExprTree *expr, Value *v,
StyleFormat *opt_fmt);
void cell_set_expr (Cell *c, ExprTree *expr,
StyleFormat *opt_fmt);
void cell_set_expr_unsafe (Cell *cell, ExprTree *expr,
StyleFormat *opt_fmt);
void cell_set_array_formula (Sheet *sheet, int rowa, int cola,
int rowb, int colb,
ExprTree *expr,
gboolean queue_recalc);
void cell_set_text (Cell *c, char const *text);
void cell_assign_value (Cell *c, Value *v, StyleFormat *fmt);
void cell_set_value (Cell *c, Value *v, StyleFormat *fmt);
void cell_set_expr_and_value (Cell *c, ExprTree *expr, Value *v,
StyleFormat *opt_fmt);
void cell_set_expr (Cell *c, ExprTree *expr,
StyleFormat *opt_fmt);
void cell_set_expr_unsafe (Cell *cell, ExprTree *expr,
StyleFormat *opt_fmt);
void cell_set_array_formula (Sheet *sheet, int rowa, int cola,
int rowb, int colb, ExprTree *expr,
gboolean queue_recalc);
void cell_convert_expr_to_value (Cell *cell);
/**
* Manipulate Cell attributes
*/
MStyle *cell_get_mstyle (Cell const *cell);
void cell_set_mstyle (Cell const *cell, MStyle *mstyle);
MStyle *cell_get_mstyle (Cell const *cell);
void cell_set_mstyle (Cell const *cell, MStyle *mstyle);
char * cell_get_format (Cell const *cell);
void cell_set_format (Cell *cell, char const *format);
char * cell_get_format (Cell const *cell);
void cell_set_format (Cell *cell, char const *format);
void cell_make_value (Cell *cell);
void cell_render_value (Cell *cell, gboolean dynamic_width);
void cell_render_value (Cell *cell, gboolean dynamic_width);
int cell_rendered_width (Cell const * cell);
int cell_rendered_height (Cell const * cell);
char * cell_get_rendered_text (Cell const * cell);
char * cell_get_entered_text (Cell const * cell);
#endif /* GNUMERIC_CELL_H */
......@@ -225,7 +225,7 @@ paste_cell (Sheet *dest_sheet,
if (paste_flags & PASTE_CONTENT)
cell_relocate (new_cell, rwinfo);
else
cell_make_value (new_cell);
cell_convert_expr_to_value (new_cell);
}
sheet_cell_insert (dest_sheet, new_cell, target_col, target_row, TRUE);
......
......@@ -87,12 +87,24 @@ format_get_thousand (void)
return '.';
}
/**
* format_get_currency :
* @precedes : a pointer to a boolean which is set to TRUE if the currency
* should precede
* @space_sep: a pointer to a boolean which is set to TRUE if the currency
* should have a space separating it from the the value
*/
char const *
format_get_currency (void)
format_get_currency (gboolean *precedes, gboolean *space_sep)
{
if (lc == NULL)
lc = localeconv ();
if (precedes)
*precedes = (lc->p_cs_precedes != 0);
if (space_sep)
*space_sep = (lc->p_sep_by_space != 0);
if (lc->currency_symbol == NULL || *lc->currency_symbol == '\0')
return "$";
return lc->currency_symbol;
......@@ -1037,7 +1049,7 @@ format_add_decimal (StyleFormat const *fmt)
/*********************************************************************/
static gchar *
format_number (gdouble number, const StyleFormatEntry *style_format_entry)
format_number (gdouble number, int const col_width, const StyleFormatEntry *style_format_entry)
{
GString *result = g_string_new ("");
const char *format = style_format_entry->format;
......@@ -1309,6 +1321,7 @@ format_number (gdouble number, const StyleFormatEntry *style_format_entry)
quiet_warning = TRUE;
g_warning ("REPEAT FORMAT NOT YET SUPPORTED '%s' %g\n",
style_format_entry->format, number);
format++;
break;
}
......@@ -1618,13 +1631,13 @@ format_value (StyleFormat *format, const Value *value, StyleColor **color,
}
return fmt_general_float (val, col_width);
}
v = format_number (value->v_float.val, &entry);
v = format_number (value->v_float.val, (int)col_width, &entry);
break;
case VALUE_INTEGER:
if (is_general)
return fmt_general_int (value->v_int.val, col_width);
v = format_number (value->v_int.val, &entry);
v = format_number (value->v_int.val, (int)col_width, &entry);
break;
case VALUE_BOOLEAN:
......
......@@ -29,7 +29,7 @@ char *format_remove_decimal (StyleFormat const *fmt);
/* Locale support routines */
char const *gnumeric_setlocale (int category, char const *val);
char const *format_get_currency (void);
char const *format_get_currency (gboolean *precedes, gboolean *space_sep);
gboolean format_month_before_day (void);
char format_get_arg_sep (void);
char format_get_col_sep (void);
......
......@@ -156,25 +156,53 @@ cell_formats [] = {
void
currency_date_format_init (void)
{
char const *curr = format_get_currency ();
cell_format_currency [0] =
g_strdup_printf ("\"%s\"#,##0", curr);
cell_format_currency [1] =
g_strdup_printf ("\"%s\"#,##0_);(%s#,##0)", curr, curr);
cell_format_currency [2] =
g_strdup_printf ("\"%s\"#,##0_);[Red](%s#,##0)", curr, curr);
cell_format_currency [3] =
g_strdup_printf ("\"%s\"#,##0.00", curr);
cell_format_currency [4] =
g_strdup_printf ("\"%s\"#,##0.00_);(%s#,##0.00)", curr, curr);
cell_format_currency [5] =
g_strdup_printf ("\"%s\"#,##0.00_);[Red](%s#,##0.00)", curr, curr);
cell_format_account [0] =
g_strdup_printf ("_(\"%s\"* #,##0_);_(\"%s\"* (#,##0);_(\"%s\"* \"-\"_);_(@_)", curr, curr, curr);
cell_format_account [2] =
g_strdup_printf ("_(\"%s\"* #,##0.00_);_(\"%s\"* (#,##0.00);_(\"%s\"* \"-\"??_);_(@_)", curr, curr, curr);
gboolean precedes, space_sep;
char const *curr = format_get_currency (&precedes, &space_sep);
char *pre, *post, *pre_rep, *post_rep;
if (precedes) {
post_rep = post = "";
pre_rep = "* ";
pre = g_strconcat ("\"", curr,
(space_sep) ? "\" " : "\"", NULL);
} else {
pre_rep = pre = "";
post_rep = "* ";
post = g_strconcat ((space_sep) ? " \"" : "\"",
curr, "\"", NULL);
}
cell_format_currency [0] = g_strdup_printf (
"%s#,##0%s",
pre, post);
cell_format_currency [1] = g_strdup_printf (
"%s#,##0%s_);(%s#,##0%s)",
pre, post, pre, post);
cell_format_currency [2] = g_strdup_printf (
"%s#,##0%s_);[Red](%s#,##0%s)",
pre, post, pre, post);
cell_format_currency [3] = g_strdup_printf (
"%s#,##0.00%s",
pre, post);
cell_format_currency [4] = g_strdup_printf (
"%s#,##0.00%s_);(%s#,##0.00%s)",
pre, post, pre, post);
cell_format_currency [5] = g_strdup_printf (
"%s#,##0.00%s_);[Red](%s#,##0.00%s)",
pre, post, pre, post);
cell_format_account [0] = g_strdup_printf (
"_(%s%s#,##0%s%s_);_(%s%s(#,##0)%s%s;_(%s%s\"-\"%s%s_);_(@_)",
pre, pre_rep, post_rep, post,
pre, pre_rep, post_rep, post,
pre, pre_rep, post_rep, post);
cell_format_account [2] = g_strdup_printf (
"_(%s%s#,##0.00%s%s_);_(%s%s(#,##0.00)%s%s;_(%s%s\"-\"??%s%s_);_(@_)",
pre, pre_rep, post_rep, post,
pre, pre_rep, post_rep, post,
pre, pre_rep, post_rep, post);
g_free (*pre ? pre : post);
if (!format_month_before_day ()) {
cell_format_date [0] = "d/m/yy";
......
......@@ -1061,7 +1061,8 @@ void
gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet,
gboolean const full_recompute)
{
Sheet const * const sheet = gsheet->scg->sheet;
SheetControlGUI const * const scg = gsheet->scg;
Sheet const * const sheet = scg->sheet;
GnomeCanvas *canvas = GNOME_CANVAS (gsheet);
int pixels, col, row, width, height;
......@@ -1070,12 +1071,12 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet,
GnomeCanvas *canvas;
gsheet->col_offset.first =
sheet_col_get_distance_pixels (sheet, 0, gsheet->col.first);
scg_get_distance (scg, TRUE, 0, gsheet->col.first);
canvas = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
gnome_canvas_scroll_to (canvas, gsheet->col_offset.first, 0);
gsheet->row_offset.first =
sheet_row_get_distance_pixels (sheet, 0, gsheet->row.first);
scg_get_distance (scg, FALSE, 0, gsheet->row.first);
canvas = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
gnome_canvas_scroll_to (canvas, 0, gsheet->row_offset.first);
......@@ -1150,7 +1151,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet,
}
/* Update the scrollbar sizes */
scg_scrollbar_config (gsheet->scg);
scg_scrollbar_config (scg);
/* Force the cursor to update its bounds relative to the new visible region */
item_cursor_reposition (gsheet->item_cursor);
......@@ -1160,7 +1161,6 @@ static int
gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_first_row)
{
GnomeCanvas *rowc;
Sheet *sheet;
int row_distance;
int x;
......@@ -1169,9 +1169,8 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_first_row)
g_return_val_if_fail (0 <= new_first_row && new_first_row < SHEET_MAX_ROWS, 0);
rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
sheet = gsheet->scg->sheet;
row_distance = gsheet->row_offset.first +=
sheet_row_get_distance_pixels (sheet, gsheet->row.first, new_first_row);
scg_get_distance (gsheet->scg, FALSE, gsheet->row.first, new_first_row);
gsheet->row.first = new_first_row;
/* Scroll the row headers */
......@@ -1206,7 +1205,6 @@ static int
gnumeric_sheet_bar_set_left_col (GnumericSheet *gsheet, int new_first_col)
{
GnomeCanvas *colc;
Sheet *sheet;
int col_distance;
int y;
......@@ -1215,10 +1213,8 @@ gnumeric_sheet_bar_set_left_col (GnumericSheet *gsheet, int new_first_col)
g_return_val_if_fail (0 <= new_first_col && new_first_col < SHEET_MAX_COLS, 0);
colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
sheet = gsheet->scg->sheet;
col_distance = gsheet->col_offset.first +=
sheet_col_get_distance_pixels (sheet, gsheet->col.first, new_first_col);
scg_get_distance (gsheet->scg, TRUE, gsheet->col.first, new_first_col);
gsheet->col.first = new_first_col;
/* Scroll the column headers */
......
......@@ -1061,7 +1061,8 @@ void
gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet,
gboolean const full_recompute)
{
Sheet const * const sheet = gsheet->scg->sheet;
SheetControlGUI const * const scg = gsheet->scg;
Sheet const * const sheet = scg->sheet;
GnomeCanvas *canvas = GNOME_CANVAS (gsheet);
int pixels, col, row, width, height;
......@@ -1070,12 +1071,12 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet,
GnomeCanvas *canvas;
gsheet->col_offset.first =
sheet_col_get_distance_pixels (sheet, 0, gsheet->col.first);
scg_get_distance (scg, TRUE, 0, gsheet->col.first);
canvas = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
gnome_canvas_scroll_to (canvas, gsheet->col_offset.first, 0);
gsheet->row_offset.first =
sheet_row_get_distance_pixels (sheet, 0, gsheet->row.first);
scg_get_distance (scg, FALSE, 0, gsheet->row.first);
canvas = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
gnome_canvas_scroll_to (canvas, 0, gsheet->row_offset.first);
......@@ -1150,7 +1151,7 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet,
}
/* Update the scrollbar sizes */
scg_scrollbar_config (gsheet->scg);
scg_scrollbar_config (scg);
/* Force the cursor to update its bounds relative to the new visible region */
item_cursor_reposition (gsheet->item_cursor);
......@@ -1160,7 +1161,6 @@ static int
gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_first_row)
{
GnomeCanvas *rowc;
Sheet *sheet;
int row_distance;
int x;
......@@ -1169,9 +1169,8 @@ gnumeric_sheet_bar_set_top_row (GnumericSheet *gsheet, int new_first_row)
g_return_val_if_fail (0 <= new_first_row && new_first_row < SHEET_MAX_ROWS, 0);
rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
sheet = gsheet->scg->sheet;
row_distance = gsheet->row_offset.first +=
sheet_row_get_distance_pixels (sheet, gsheet->row.first, new_first_row);
scg_get_distance (gsheet->scg, FALSE, gsheet->row.first, new_first_row);
gsheet->row.first = new_first_row;
/* Scroll the row headers */
......@@ -1206,7 +1205,6 @@ static int
gnumeric_sheet_bar_set_left_col (GnumericSheet *gsheet, int new_first_col)
{
GnomeCanvas *colc;
Sheet *sheet;
int col_distance;
int y;
......@@ -1215,10 +1213,8 @@ gnumeric_sheet_bar_set_left_col (GnumericSheet *gsheet, int new_first_col)
g_return_val_if_fail (0 <= new_first_col && new_first_col < SHEET_MAX_COLS, 0);
colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
sheet = gsheet->scg->sheet;
col_distance = gsheet->col_offset.first +=
sheet_col_get_distance_pixels (sheet, gsheet->col.first, new_first_col);
scg_get_distance (gsheet->scg, TRUE, gsheet->col.first, new_first_col);
gsheet->col.first = new_first_col;
/* Scroll the column headers */
......
......@@ -408,7 +408,8 @@ set_cursor (ItemBar *item_bar, int pos)
static void
item_bar_start_resize (ItemBar *bar)
{
Sheet const * const sheet = bar->scg->sheet;
SheetControlGUI const * const scg = bar->scg;
Sheet const * const sheet = scg->sheet;
#if 0
/*
* handle the zoom from the item-grid canvas, the resolution scaling is
......@@ -418,7 +419,7 @@ item_bar_start_resize (ItemBar *bar)
GTK_ORIENTATION_VERTICAL);
#endif
double const zoom = sheet->last_zoom_factor_used; /* * res / 72.; */
GnumericSheet const * const gsheet = GNUMERIC_SHEET (bar->scg->canvas);
GnumericSheet const * const gsheet = GNUMERIC_SHEET (scg->canvas);
GnomeCanvas const * const canvas = GNOME_CANVAS (gsheet);
GnomeCanvasGroup * const group = GNOME_CANVAS_GROUP (canvas->root);
GnomeCanvasPoints * const points =
......@@ -435,23 +436,23 @@ item_bar_start_resize (ItemBar *bar)
* Set the guide line later based on the motion coordinates.
*/
if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
double const y =
sheet_row_get_distance_pixels (sheet, 0, bar->resize_pos) / zoom;
points->coords [0] =
sheet_col_get_distance_pixels (sheet, 0, gsheet->col.first) / zoom;
double const y = scg_get_distance (scg, FALSE,
0, bar->resize_pos) / zoom;
points->coords [0] = scg_get_distance (scg, TRUE,
0, gsheet->col.first) / zoom;
points->coords [1] = y;
points->coords [2] =
sheet_col_get_distance_pixels (sheet, 0, gsheet->col.last_visible+1) / zoom;
points->coords [2] = scg_get_distance (scg, TRUE,
0, gsheet->col.last_visible+1) / zoom;
points->coords [3] = y;
} else {
double const x =
sheet_col_get_distance_pixels (sheet, 0, bar->resize_pos) / zoom;
double const x = scg_get_distance (scg, TRUE,
0, bar->resize_pos) / zoom;
points->coords [0] = x;
points->coords [1] =
sheet_row_get_distance_pixels (sheet, 0, gsheet->row.first) / zoom;
points->coords [1] = scg_get_distance (scg, FALSE,
0, gsheet->row.first) / zoom;
points->coords [2] = x;
points->coords [3] =
sheet_row_get_distance_pixels (sheet, 0, gsheet->row.last_visible+1) / zoom;
points->coords [3] = scg_get_distance (scg, FALSE,
0, gsheet->row.last_visible+1) / zoom;
}
item = gnome_canvas_item_new ( group,
......
......@@ -168,7 +168,7 @@ item_cursor_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, in
{
ItemCursor *item_cursor = ITEM_CURSOR (item);
GnumericSheet *gsheet = GNUMERIC_SHEET (item->canvas);
Sheet *sheet = item_cursor->scg->sheet;
SheetControlGUI const * const scg = item_cursor->scg;
int x, y, w, h, extra;
......@@ -182,15 +182,13 @@ item_cursor_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, in
item_cursor_request_redraw (item_cursor);
item_cursor->cached_x = x =
gsheet->col_offset.first +
sheet_col_get_distance_pixels (sheet, gsheet->col.first, left);
gsheet->col_offset.first +
scg_get_distance (scg, TRUE, gsheet->col.first, left);
item_cursor->cached_y = y =
gsheet->row_offset.first +
sheet_row_get_distance_pixels (sheet, gsheet->row.first, top);
item_cursor->cached_w = w =
sheet_col_get_distance_pixels (sheet, left, right+1);
item_cursor->cached_h = h =
sheet_row_get_distance_pixels (sheet, top, bottom+1);
gsheet->row_offset.first +
scg_get_distance (scg, FALSE, gsheet->row.first, top);
item_cursor->cached_w = w = scg_get_distance (scg, TRUE, left, right+1);
item_cursor->cached_h = h = scg_get_distance (scg, FALSE,top, bottom+1);
item->x1 = x - 1;
item->y1 = y - 1;
......
......@@ -343,14 +343,14 @@ recalc_spans (GnomeCanvasItem *item)
g_slist_free (item_edit->text_offsets);
item_edit->text_offsets = g_slist_reverse (text_offsets);
cri = sheet_row_get_info (sheet, item_edit->row);
/* The lower right is based on the span size excluding the grid lines
* Recall that the bound excludes the far point
*/
item->x2 = 1 + item->x1 - 2 +
sheet_col_get_distance_pixels (sheet, item_edit->col,
item_edit->col + item_edit->col_span);
scg_get_distance (item_edit->scg, TRUE, item_edit->col,
item_edit->col + item_edit->col_span);
cri = sheet_row_get_info (sheet, item_edit->row);
item->y2 = 1 + item->y1 +
MAX (item_edit->lines * item_edit->font_height, cri->size_pixels - 2);
......@@ -528,9 +528,11 @@ item_edit_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
/* move inwards 1 pixel for the grid line */
item->x1 = 1 + gsheet->col_offset.first +
sheet_col_get_distance_pixels (sheet, gsheet->col.first, item_edit->col);
scg_get_distance (item_edit->scg, TRUE,
gsheet->col.first, item_edit->col);
item->y1 = 1 + gsheet->row_offset.first +
sheet_row_get_distance_pixels (sheet, gsheet->row.first, item_edit->row);
scg_get_distance (item_edit->scg, FALSE,
gsheet->row.first, item_edit->row);
item->x2 = item->x1 + 1;
item->y2 = item->y2 + 1;
......
......@@ -206,7 +206,7 @@ item_grid_draw_merged_range (GdkDrawable *drawable, ItemGrid *grid,
Range const *view, Range const *range)
{
i