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

Take units in pixels or points. (sheet_{col,row}_set_default_size_pixels)


2000-07-09  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
	  points.
	(sheet_{col,row}_set_default_size_pixels) : new functions.  This
	  interface sucks.  Clean it up.

	* src/parser.y : Optionally insert a place holder when an
	  unknown function is found.

	* src/func.c (function_add_placeholder) : New function, moved from the
	  XL import code.

	* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
	  change.
	* src/workbook.c (workbook_set_auto_expr) : Ditto.

	* src/application.c (application_dpi_to_pixels) : New function.
	* src/item-bar.c (item_bar_fonts_init) : Use it here.
	* src/sheet-view.c (sheet_view_get_style_font) : And here.
	* src/style.c (font_init) : and here.

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

	* src/parse-util.c (cellref_r1c1_get) : Make stricter.
	(r1c1_get_item) : Ditto.

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

	* plugins/Makefile.am (SUBDIRS) : Enable applix.

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

	* src/parse-util.c (col_from_name) : Add optional arg to indicate
	  where parsing stoped.  Similar to strtod.

2000-07-07  Jody Goldberg <jgoldberg@home.com>

	* src/xml-io.c (xml_write_style_border) : Trivial optimization.  No
	  need to save colour for STYLE_BORDER_NONE.
	(xml_read_style_border) : Ditto.
parent ecf30b65
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
points.
(sheet_{col,row}_set_default_size_pixels) : new functions. This
interface sucks. Clean it up.
* src/parser.y : Optionally insert a place holder when an
unknown function is found.
* src/func.c (function_add_placeholder) : New function, moved from the
XL import code.
* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
change.
* src/workbook.c (workbook_set_auto_expr) : Ditto.
* src/application.c (application_dpi_to_pixels) : New function.
* src/item-bar.c (item_bar_fonts_init) : Use it here.
* src/sheet-view.c (sheet_view_get_style_font) : And here.
* src/style.c (font_init) : and here.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (cellref_r1c1_get) : Make stricter.
(r1c1_get_item) : Ditto.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* plugins/Makefile.am (SUBDIRS) : Enable applix.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (col_from_name) : Add optional arg to indicate
where parsing stoped. Similar to strtod.
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_style_border) : Trivial optimization. No
need to save colour for STYLE_BORDER_NONE.
(xml_read_style_border) : Ditto.
2000-07-08 Morten Welinder <terra@diku.dk> 2000-07-08 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_cell_foreach_range): Change traversal order * src/sheet.c (sheet_cell_foreach_range): Change traversal order
......
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
points.
(sheet_{col,row}_set_default_size_pixels) : new functions. This
interface sucks. Clean it up.
* src/parser.y : Optionally insert a place holder when an
unknown function is found.
* src/func.c (function_add_placeholder) : New function, moved from the
XL import code.
* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
change.
* src/workbook.c (workbook_set_auto_expr) : Ditto.
* src/application.c (application_dpi_to_pixels) : New function.
* src/item-bar.c (item_bar_fonts_init) : Use it here.
* src/sheet-view.c (sheet_view_get_style_font) : And here.
* src/style.c (font_init) : and here.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (cellref_r1c1_get) : Make stricter.
(r1c1_get_item) : Ditto.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* plugins/Makefile.am (SUBDIRS) : Enable applix.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (col_from_name) : Add optional arg to indicate
where parsing stoped. Similar to strtod.
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_style_border) : Trivial optimization. No
need to save colour for STYLE_BORDER_NONE.
(xml_read_style_border) : Ditto.
2000-07-08 Morten Welinder <terra@diku.dk> 2000-07-08 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_cell_foreach_range): Change traversal order * src/sheet.c (sheet_cell_foreach_range): Change traversal order
......
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
points.
(sheet_{col,row}_set_default_size_pixels) : new functions. This
interface sucks. Clean it up.
* src/parser.y : Optionally insert a place holder when an
unknown function is found.
* src/func.c (function_add_placeholder) : New function, moved from the
XL import code.
* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
change.
* src/workbook.c (workbook_set_auto_expr) : Ditto.
* src/application.c (application_dpi_to_pixels) : New function.
* src/item-bar.c (item_bar_fonts_init) : Use it here.
* src/sheet-view.c (sheet_view_get_style_font) : And here.
* src/style.c (font_init) : and here.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (cellref_r1c1_get) : Make stricter.
(r1c1_get_item) : Ditto.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* plugins/Makefile.am (SUBDIRS) : Enable applix.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (col_from_name) : Add optional arg to indicate
where parsing stoped. Similar to strtod.
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_style_border) : Trivial optimization. No
need to save colour for STYLE_BORDER_NONE.
(xml_read_style_border) : Ditto.
2000-07-08 Morten Welinder <terra@diku.dk> 2000-07-08 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_cell_foreach_range): Change traversal order * src/sheet.c (sheet_cell_foreach_range): Change traversal order
......
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
points.
(sheet_{col,row}_set_default_size_pixels) : new functions. This
interface sucks. Clean it up.
* src/parser.y : Optionally insert a place holder when an
unknown function is found.
* src/func.c (function_add_placeholder) : New function, moved from the
XL import code.
* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
change.
* src/workbook.c (workbook_set_auto_expr) : Ditto.
* src/application.c (application_dpi_to_pixels) : New function.
* src/item-bar.c (item_bar_fonts_init) : Use it here.
* src/sheet-view.c (sheet_view_get_style_font) : And here.
* src/style.c (font_init) : and here.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (cellref_r1c1_get) : Make stricter.
(r1c1_get_item) : Ditto.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* plugins/Makefile.am (SUBDIRS) : Enable applix.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (col_from_name) : Add optional arg to indicate
where parsing stoped. Similar to strtod.
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_style_border) : Trivial optimization. No
need to save colour for STYLE_BORDER_NONE.
(xml_read_style_border) : Ditto.
2000-07-08 Morten Welinder <terra@diku.dk> 2000-07-08 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_cell_foreach_range): Change traversal order * src/sheet.c (sheet_cell_foreach_range): Change traversal order
......
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
points.
(sheet_{col,row}_set_default_size_pixels) : new functions. This
interface sucks. Clean it up.
* src/parser.y : Optionally insert a place holder when an
unknown function is found.
* src/func.c (function_add_placeholder) : New function, moved from the
XL import code.
* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
change.
* src/workbook.c (workbook_set_auto_expr) : Ditto.
* src/application.c (application_dpi_to_pixels) : New function.
* src/item-bar.c (item_bar_fonts_init) : Use it here.
* src/sheet-view.c (sheet_view_get_style_font) : And here.
* src/style.c (font_init) : and here.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (cellref_r1c1_get) : Make stricter.
(r1c1_get_item) : Ditto.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* plugins/Makefile.am (SUBDIRS) : Enable applix.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (col_from_name) : Add optional arg to indicate
where parsing stoped. Similar to strtod.
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_style_border) : Trivial optimization. No
need to save colour for STYLE_BORDER_NONE.
(xml_read_style_border) : Ditto.
2000-07-08 Morten Welinder <terra@diku.dk> 2000-07-08 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_cell_foreach_range): Change traversal order * src/sheet.c (sheet_cell_foreach_range): Change traversal order
......
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
points.
(sheet_{col,row}_set_default_size_pixels) : new functions. This
interface sucks. Clean it up.
* src/parser.y : Optionally insert a place holder when an
unknown function is found.
* src/func.c (function_add_placeholder) : New function, moved from the
XL import code.
* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
change.
* src/workbook.c (workbook_set_auto_expr) : Ditto.
* src/application.c (application_dpi_to_pixels) : New function.
* src/item-bar.c (item_bar_fonts_init) : Use it here.
* src/sheet-view.c (sheet_view_get_style_font) : And here.
* src/style.c (font_init) : and here.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (cellref_r1c1_get) : Make stricter.
(r1c1_get_item) : Ditto.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* plugins/Makefile.am (SUBDIRS) : Enable applix.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (col_from_name) : Add optional arg to indicate
where parsing stoped. Similar to strtod.
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_style_border) : Trivial optimization. No
need to save colour for STYLE_BORDER_NONE.
(xml_read_style_border) : Ditto.
2000-07-08 Morten Welinder <terra@diku.dk> 2000-07-08 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_cell_foreach_range): Change traversal order * src/sheet.c (sheet_cell_foreach_range): Change traversal order
......
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_row_default_init) : Take units in pixels or
points.
(sheet_{col,row}_set_default_size_pixels) : new functions. This
interface sucks. Clean it up.
* src/parser.y : Optionally insert a place holder when an
unknown function is found.
* src/func.c (function_add_placeholder) : New function, moved from the
XL import code.
* src/expr.c (expr_parse_string) : gnumeric_expr_parser signature
change.
* src/workbook.c (workbook_set_auto_expr) : Ditto.
* src/application.c (application_dpi_to_pixels) : New function.
* src/item-bar.c (item_bar_fonts_init) : Use it here.
* src/sheet-view.c (sheet_view_get_style_font) : And here.
* src/style.c (font_init) : and here.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (cellref_r1c1_get) : Make stricter.
(r1c1_get_item) : Ditto.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* plugins/Makefile.am (SUBDIRS) : Enable applix.
2000-07-08 Jody Goldberg <jgoldberg@home.com>
* src/parse-util.c (col_from_name) : Add optional arg to indicate
where parsing stoped. Similar to strtod.
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_style_border) : Trivial optimization. No
need to save colour for STYLE_BORDER_NONE.
(xml_read_style_border) : Ditto.
2000-07-08 Morten Welinder <terra@diku.dk> 2000-07-08 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_cell_foreach_range): Change traversal order * src/sheet.c (sheet_cell_foreach_range): Change traversal order
......
...@@ -27,16 +27,16 @@ Requirements ...@@ -27,16 +27,16 @@ Requirements
You need: You need:
gnome-libs-1.0.57 gnome-libs >= 1.0.57 (gnome-libs 2.0 is not supported)
gnome-print-0.20 gnome-print == 0.20
gnome-xml-1.8.7 (gnome-xml 2.x not supported yet) gnome-xml == 1.8.7 (gnome-xml 2.x not supported yet)
libglade-0.13 libglade == 0.13
libole2-0.1.4 libole2 == 0.1.6
glib-1.2.7 glib >= 1.2.7 (glib-libs 1.3 is not supported)
gtk+-1.2.7 gtk+ >= 1.2.7 (gnome-libs 1.3 is not supported)
Optionally: Optionally:
bonobo-0.14 bonobo == 0.16 (Still in CVS)
Notes regarding plugins Notes regarding plugins
----------------------- -----------------------
......
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml2ParseStyleRegionBorders) : Make border color is optional
for style STYLE_BORDER_NONE.
/* vim: set sw=8: /* vim: set sw=8: */
* $Id$
*/
/* /*
* xml2.c : a test harness for the sax based xml parse routines. * xml2.c : a test harness for the sax based xml parse routines.
...@@ -718,6 +716,7 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs) ...@@ -718,6 +716,7 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs)
g_return_if_fail (state->style != NULL); g_return_if_fail (state->style != NULL);
/* Colour is optional */
for (; attrs[0] && attrs[1] ; attrs += 2) { for (; attrs[0] && attrs[1] ; attrs += 2) {
if (xml2ParseAttrColour (attrs, "Color", &colour)) ; if (xml2ParseAttrColour (attrs, "Color", &colour)) ;
else if (xml2ParseAttrInt (attrs, "Style", &pattern)) ; else if (xml2ParseAttrInt (attrs, "Style", &pattern)) ;
...@@ -725,14 +724,13 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs) ...@@ -725,14 +724,13 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs)
xml2UnknownAttr (state, attrs, "StyleBorder"); xml2UnknownAttr (state, attrs, "StyleBorder");
} }
if (colour != NULL && pattern >= 0) { if (pattern >= STYLE_BORDER_NONE) {
MStyleElementType const type = MSTYLE_BORDER_TOP + MStyleElementType const type = MSTYLE_BORDER_TOP +
state->state - STATE_BORDER_TOP; state->state - STATE_BORDER_TOP;
MStyleBorder *border = MStyleBorder *border =
style_border_fetch ((StyleBorderType)pattern, colour, style_border_fetch ((StyleBorderType)pattern, colour,
style_border_get_orientation (type)); style_border_get_orientation (type));
if (border) mstyle_set_border (state->style, type, border);
mstyle_set_border (state->style, type, border);
} }
} }
......
2000-07-07 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml2ParseStyleRegionBorders) : Make border color is optional
for style STYLE_BORDER_NONE.
/* vim: set sw=8: /* vim: set sw=8: */
* $Id$
*/
/* /*
* xml2.c : a test harness for the sax based xml parse routines. * xml2.c : a test harness for the sax based xml parse routines.
...@@ -718,6 +716,7 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs) ...@@ -718,6 +716,7 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs)
g_return_if_fail (state->style != NULL); g_return_if_fail (state->style != NULL);
/* Colour is optional */
for (; attrs[0] && attrs[1] ; attrs += 2) { for (; attrs[0] && attrs[1] ; attrs += 2) {
if (xml2ParseAttrColour (attrs, "Color", &colour)) ; if (xml2ParseAttrColour (attrs, "Color", &colour)) ;
else if (xml2ParseAttrInt (attrs, "Style", &pattern)) ; else if (xml2ParseAttrInt (attrs, "Style", &pattern)) ;
...@@ -725,14 +724,13 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs) ...@@ -725,14 +724,13 @@ xml2ParseStyleRegionBorders (XML2ParseState *state, CHAR const **attrs)
xml2UnknownAttr (state, attrs, "StyleBorder"); xml2UnknownAttr (state, attrs, "StyleBorder");
} }
if (colour != NULL && pattern >= 0) { if (pattern >= STYLE_BORDER_NONE) {
MStyleElementType const type = MSTYLE_BORDER_TOP + MStyleElementType const type = MSTYLE_BORDER_TOP +
state->state - STATE_BORDER_TOP; state->state - STATE_BORDER_TOP;
MStyleBorder *border = MStyleBorder *border =
style_border_fetch ((StyleBorderType)pattern, colour, style_border_fetch ((StyleBorderType)pattern, colour,
style_border_get_orientation (type)); style_border_get_orientation (type));
if (border) mstyle_set_border (state->style, type, border);
mstyle_set_border (state->style, type, border);
} }
} }
......
...@@ -253,19 +253,26 @@ application_workbook_get_by_index (int i) ...@@ -253,19 +253,26 @@ application_workbook_get_by_index (int i)
return close.wb; return close.wb;
} }
float inline float
application_display_dpi_get (gboolean const horizontal) application_display_dpi_get (gboolean const horizontal)
{ {
return horizontal ? app.horizontal_dpi : app.vertical_dpi; return horizontal ? app.horizontal_dpi : app.vertical_dpi;
} }
void void
application_display_dpi_set (gboolean const horizontal, float const val) application_display_dpi_set (gboolean const horizontal, float const val)
{ {
if (horizontal) if (horizontal)
app.horizontal_dpi = val; app.horizontal_dpi = val;
else else
app.vertical_dpi = val; app.vertical_dpi = val;
}
float
application_dpi_to_pixels ()
{
return MIN (application_display_dpi_get (FALSE),
application_display_dpi_get (TRUE)) / 72.;
} }
/** /**
......
...@@ -26,6 +26,7 @@ void application_history_write_config (void); ...@@ -26,6 +26,7 @@ void application_history_write_config (void);
float application_display_dpi_get (gboolean const horizontal); float application_display_dpi_get (gboolean const horizontal);
void application_display_dpi_set (gboolean const horizontal, float const); void application_display_dpi_set (gboolean const horizontal, float const);
float application_dpi_to_pixels ();
gboolean application_use_auto_complete_get (void); gboolean application_use_auto_complete_get (void);
void application_use_auto_complete_set (gboolean use_auto_complete); void application_use_auto_complete_set (gboolean use_auto_complete);
......
...@@ -333,7 +333,7 @@ dialog_cell_sort_ok (SortFlow *sf) ...@@ -333,7 +333,7 @@ dialog_cell_sort_ok (SortFlow *sf)
if (sf->header) { if (sf->header) {
division = divstart + string_pos_in_list(txt, sf->colnames_header); division = divstart + string_pos_in_list(txt, sf->colnames_header);
} else { } else {
division = col_from_name(txt); division = parse_col_name (txt, NULL);
} }
} else { } else {
if (sf->header) { if (sf->header) {
......
...@@ -189,7 +189,7 @@ expr_parse_string (char const *expr, ParsePos const *pp, ...@@ -189,7 +189,7 @@ expr_parse_string (char const *expr, ParsePos const *pp,
ExprTree *tree; ExprTree *tree;
g_return_val_if_fail (expr != NULL, NULL); g_return_val_if_fail (expr != NULL, NULL);
switch (gnumeric_expr_parser (expr, pp, TRUE, desired_format, &tree)) { switch (gnumeric_expr_parser (expr, pp, TRUE, FALSE, desired_format, &tree)) {
case PARSE_OK: case PARSE_OK:
*error_msg = NULL; *error_msg = NULL;
return tree; return tree;
......
...@@ -244,6 +244,47 @@ function_add_nodes (FunctionCategory *category, ...@@ -244,6 +244,47 @@ function_add_nodes (FunctionCategory *category,
return fndef; return fndef;
} }
/* Handle unknown functions on import without losing their names */
static Value *
unknownFunctionHandler (FunctionEvalInfo *ei, GList *expr_node_list)
{
return value_new_error (ei->pos, gnumeric_err_NAME);
}
/*
* When importing it is useful to keep track of unknown function names.
* We may be missing a plugin or something similar.
*
* TODO : Eventully we should be able to keep track of these
* and replace them with something else. Possibly even reordering the
* arguments.
*/
FunctionDefinition *
function_add_placeholder (char const *name, char const *type)
{
FunctionCategory *cat;
FunctionDefinition *func = func_lookup_by_name (name, NULL);
g_return_val_if_fail (func == NULL, func);
cat = function_get_category (_("Unknown Function"));
/*
* TODO TODO TODO : should add a
* function_add_{nodes,args}_fake
* This will allow a user to load a missing
* plugin to supply missing functions.
*/
func = function_add_nodes (cat, g_strdup (name),
"", "...", NULL,
&unknownFunctionHandler);
/* WISHLIST : it would be nice to have a log if these. */
g_warning ("Unknown %sfunction : %s", type, name);
return func;
}
gpointer gpointer
function_def_get_user_data (const FunctionDefinition *fndef) function_def_get_user_data (const FunctionDefinition *fndef)
{ {
......
...@@ -93,6 +93,7 @@ FunctionDefinition *function_add_nodes (FunctionCategory *parent, ...@@ -93,6 +93,7 @@ FunctionDefinition *function_add_nodes (FunctionCategory *parent,
char const *arg_names, char const *arg_names,
char **help, char **help,
FunctionNodes *fn); FunctionNodes *fn);
FunctionDefinition *function_add_placeholder (char const *name, char const *type);
gpointer function_def_get_user_data (const FunctionDefinition *fndef); gpointer function_def_get_user_data (const FunctionDefinition *fndef);
void function_def_set_user_data (FunctionDefinition *fndef, void function_def_set_user_data (FunctionDefinition *fndef,
......
...@@ -88,8 +88,7 @@ item_bar_fonts_init (ItemBar *item_bar) ...@@ -88,8 +88,7 @@ item_bar_fonts_init (ItemBar *item_bar)
{ {
double const zoom_factor = double const zoom_factor =
item_bar->sheet_view->sheet->last_zoom_factor_used; item_bar->sheet_view->sheet->last_zoom_factor_used;
double const res = MIN(application_display_dpi_get (FALSE), double const res = application_dpi_to_pixels ();
application_display_dpi_get (TRUE)) / 72.;
StyleFont * const normal_font = StyleFont * const normal_font =
style_font_new_simple (DEFAULT_FONT, DEFAULT_SIZE, style_font_new_simple (DEFAULT_FONT, DEFAULT_SIZE,
res*zoom_factor, FALSE, FALSE); res*zoom_factor, FALSE, FALSE);
......
...@@ -147,10 +147,13 @@ cellref_a1_get (CellRef *out, const char *in, CellPos const *pos) ...@@ -147,10 +147,13 @@ cellref_a1_get (CellRef *out, const char *in, CellPos const *pos)
} }
static gboolean static gboolean
r1c1_get_item (int *num, unsigned char *rel, const char * *const in) r1c1_get_item (int *num, unsigned char *rel, char const * *in)
{ {
gboolean neg = FALSE; gboolean neg = FALSE;
if (**in == '\0')
return FALSE;
if (**in == '[') { if (**in == '[') {
(*in)++; (*in)++;
*rel = TRUE; *rel = TRUE;
...@@ -192,21 +195,19 @@ cellref_r1c1_get (CellRef *out, const char *in, CellPos const *pos) ...@@ -192,21 +195,19 @@ cellref_r1c1_get (CellRef *out, const char *in, CellPos const *pos)
out->row = pos->row; out->row = pos->row;
out->sheet = NULL; out->sheet = NULL;
if (!*in) if (*in == 'R') {
in++;
if (!r1c1_get_item (&out->row, &out->row_relative, &in))
return FALSE;
} else
return FALSE; return FALSE;
while (*in) { if (*in == 'C') {
if (*in == 'R') { in++;
in++; if (!r1c1_get_item (&out->col, &out->col_relative, &in))
if (!r1c1_get_item (&out->row, &out->row_relative, &in))
return FALSE;
} else if (*in == 'C') {
in++;
if (!r1c1_get_item (&out->col, &out->col_relative, &in))
return FALSE;
} else
return FALSE; return FALSE;
} } else
return FALSE;
out->col--; out->col--;
out->row--; out->row--;
...@@ -305,22 +306,32 @@ col_name (int col) ...@@ -305,22 +306,32 @@ col_name (int col)
* Converts a column name into an integer * Converts a column name into an integer
**/ **/
int int
col_from_name (const char *cell_str) parse_col_name (const char *cell_str, const char **endptr)
{ {
char c; char c;
int col = 0; int col = 0;
if (endptr)
*endptr = cell_str;
c = toupper ((unsigned char)*cell_str++); c = toupper ((unsigned char)*cell_str++);
if (c < 'A' || c > 'Z') if (c < 'A' || c > 'Z')
return FALSE; return 0;
col = c - 'A'; col = c - 'A';
c = toupper ((unsigned char)*cell_str); c = toupper ((unsigned char)*cell_str);
if (c >= 'A' && c <= 'Z') if (c >= 'A' && c <= 'Z') {
col = ((col + 1) * ('Z' - 'A' + 1)) + (c - 'A'); col = ((col + 1) * ('Z' - 'A' + 1)) + (c - 'A');
cell_str++;
}
if (col >= SHEET_MAX_COLS) if (col >= SHEET_MAX_COLS)
return FALSE; return 0;
else
return col; if (endptr)
*endptr = cell_str;
return col;
} }
/* /*
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* Names * Names