Commit 42bca65b authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

paste_special is only disabled for cut not for standard actions.


2000-01-03  Jody Goldberg <jgoldberg@home.com>

	* src/workbook.c (workbook_new) : paste_special is only disabled for
	  cut not for standard actions.

	* src/value-sheet.c (value_is_error) : New routine to look up errors.
	(gnumeric_error_init) : New routine.
	(constants_init) : Used here.

	* src/parser.y (yylex) : If a string begins with '#' it may be an
	  explicit error string.

	* src/xml-io.c (xml_write_style_border) : Write BORDER_NONE's too,
	  this makes it possible to save and restore the NONEs that erase borders.
parent 7f35fd7d
2000-01-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_new) : paste_special is only disabled for
cut not for standard actions.
* src/value-sheet.c (value_is_error) : New routine to look up errors.
(gnumeric_error_init) : New routine.
(constants_init) : Used here.
* src/parser.y (yylex) : If a string begins with '#' it may be an
explicit error string.
* src/xml-io.c (xml_write_style_border) : Write BORDER_NONE's too,
this makes it possible to save and restore the NONEs that erase borders.
2000-01-03 Michael Meeks <mmeeks@gnu.org>
* src/about.c (dialog_about): Add Ariel.
......
2000-01-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_new) : paste_special is only disabled for
cut not for standard actions.
* src/value-sheet.c (value_is_error) : New routine to look up errors.
(gnumeric_error_init) : New routine.
(constants_init) : Used here.
* src/parser.y (yylex) : If a string begins with '#' it may be an
explicit error string.
* src/xml-io.c (xml_write_style_border) : Write BORDER_NONE's too,
this makes it possible to save and restore the NONEs that erase borders.
2000-01-03 Michael Meeks <mmeeks@gnu.org>
* src/about.c (dialog_about): Add Ariel.
......
......@@ -621,7 +621,7 @@ clipboard_paste_region (CommandContext *context,
*/
workbook_holding_selection = find_local_workbook_with_selection ();
if (workbook_holding_selection && region){
if (workbook_holding_selection && region) {
CellRegion *content;
content = region;
......
......@@ -508,7 +508,8 @@ try_symbol (char *string, gboolean try_cellref_and_number)
return make_string_return (string, try_cellref_and_number);
}
int yylex (void)
int
yylex (void)
{
int c;
const char *p, *tmp;
......@@ -575,6 +576,20 @@ int yylex (void)
parser_expr = tmp;
return NUMBER;
}
case '#' :
{
int offset = 0;
/* we already took the leading '#' off */
Value *err = value_is_error (parser_expr-1, &offset);
if (err != NULL) {
yylval.tree = expr_tree_new_constant (err);
parser_expr += offset - 1;
return CONSTANT;
}
}
break;
case '\'':
case '"': {
char *string, *s;
......@@ -607,6 +622,7 @@ int yylex (void)
v = try_symbol (string, FALSE);
return v;
}
}
if (isalpha ((unsigned char)c) || c == '_' || c == '$'){
......@@ -845,7 +861,7 @@ gnumeric_expr_parser (const char *expr, const ParsePosition *pp,
if (parser_error == PARSE_OK)
alloc_list_free ();
else {
printf ("Parser error!\n");
fprintf (stderr, "Unable to parse '%s'\n", expr);
alloc_clean ();
*parser_result = NULL;
}
......
......@@ -339,9 +339,55 @@ char const *gnumeric_err_NAME = "#NAME?";
char const *gnumeric_err_NUM = "#NUM!";
char const *gnumeric_err_NA = "#N/A";
static struct gnumeric_error_info
{
char const *str;
int len;
} gnumeric_error_data[7];
static char const *
gnumeric_error_init (int const indx, char const * str)
{
g_return_val_if_fail (indx >= 0, str);
g_return_val_if_fail (indx < sizeof(gnumeric_error_data)/sizeof(struct gnumeric_error_info), str);
gnumeric_error_data[indx].str = str;
gnumeric_error_data[indx].len = strlen(str);
return str;
}
/*
* value_is_error : Check to see if a string begins with one of the magic
* error strings.
*
* @str : The string to test
* @offset : A place to store the size of the leading error string if it
* exists.
*
* returns : an error if there is one, or NULL.
*/
Value *
value_is_error (char const * const str, int *offset)
{
int i = sizeof(gnumeric_error_data)/sizeof(struct gnumeric_error_info);
g_return_value_if_error (str != NULL, NULL);
while (--i >= 0) {
int const len = gnumeric_error_data[i].len;
if (strncmp (str, gnumeric_error_data[i].str, len) == 0) {
*offset = len;
return value_new_error (NULL, gnumeric_error_data[i].str);
}
}
return NULL;
}
void
constants_init (void)
{
int i = 0;
symbol_install (global_symbol_table, "FALSE", SYMBOL_VALUE,
value_new_bool (FALSE));
symbol_install (global_symbol_table, "TRUE", SYMBOL_VALUE,
......@@ -349,11 +395,11 @@ constants_init (void)
symbol_install (global_symbol_table, "GNUMERIC_VERSION", SYMBOL_VALUE,
value_new_float (atof (GNUMERIC_VERSION)));
gnumeric_err_NULL = _("#NULL!");
gnumeric_err_DIV0 = _("#DIV/0!");
gnumeric_err_VALUE = _("#VALUE!");
gnumeric_err_REF = _("#REF!");
gnumeric_err_NAME = _("#NAME?");
gnumeric_err_NUM = _("#NUM!");
gnumeric_err_NA = _("#N/A");
gnumeric_err_NULL = gnumeric_error_init (i++, _("#NULL!"));
gnumeric_err_DIV0 = gnumeric_error_init (i++, _("#DIV/0!"));
gnumeric_err_VALUE = gnumeric_error_init (i++, _("#VALUE!"));
gnumeric_err_REF = gnumeric_error_init (i++, _("#REF!"));
gnumeric_err_NAME = gnumeric_error_init (i++, _("#NAME?"));
gnumeric_err_NUM = gnumeric_error_init (i++, _("#NUM!"));
gnumeric_err_NA = gnumeric_error_init (i++, _("#N/A"));
}
......@@ -107,6 +107,8 @@ void value_array_set (Value *array, guint col, guint row, Value *v);
void value_array_resize (Value *v, guint width, guint height);
void value_array_copy_to (Value *dest, const Value *src);
Value * value_is_error (char const * const str, int *offset);
/* Some utility constants to make sure we all spell correctly */
extern char const *gnumeric_err_NULL;
extern char const *gnumeric_err_DIV0;
......
......@@ -2190,10 +2190,11 @@ workbook_new (void)
workbook_view_set_undo_redo_state (wb, FALSE, FALSE);
/*
* Disable paste & paste special, they will be enabled when
* there is something to paste
* Enable paste special, this assumes that the default is to
* paste from the X clipboard. It will be disabled when
* something is cut.
*/
workbook_view_set_paste_special_state (wb, FALSE);
workbook_view_set_paste_special_state (wb, TRUE);
workbook_create_toolbars (wb);
......
......@@ -631,8 +631,7 @@ xml_write_style_border (parse_xml_context_t *ctxt,
for (i = MSTYLE_BORDER_TOP; i <= MSTYLE_BORDER_REV_DIAGONAL; i++) {
MStyleBorder const *border;
if (mstyle_is_element_set (style, i) &&
NULL != (border = mstyle_get_border (style, i)) &&
border->line_type != STYLE_BORDER_NONE) {
NULL != (border = mstyle_get_border (style, i))) {
break;
}
}
......@@ -644,8 +643,7 @@ xml_write_style_border (parse_xml_context_t *ctxt,
for (i = MSTYLE_BORDER_TOP; i <= MSTYLE_BORDER_REV_DIAGONAL; i++) {
MStyleBorder const *border;
if (mstyle_is_element_set (style, i) &&
NULL != (border = mstyle_get_border (style, i)) &&
border->line_type != STYLE_BORDER_NONE) {
NULL != (border = mstyle_get_border (style, i))) {
StyleBorderType t = border->line_type;
StyleColor *col = border->color;
side = xmlNewChild (cur, ctxt->ns,
......
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