Commit 2694af53 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

compute_value returns a Value now. (compute_value) : return a Value.

2001-10-05  Jody Goldberg <jgoldberg@home.com>

	* src/number-match.c (format_match) : compute_value returns a Value
	  now.
	(compute_value) : return a Value.

2001-10-05  Jody Goldberg <jgoldberg@home.com>

	* src/gnumeric-graph.c (gnm_graph_series_set_dimension) : new.
	(gnm_graph_series_delete) : new.

	* idl/GNOME_Gnumeric_Graph.idl : Add seriesSetDimension, and
	  seriesDelete.  Bump the idl version.
parent b7318627
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (format_match) : compute_value returns a Value
now.
(compute_value) : return a Value.
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/gnumeric-graph.c (gnm_graph_series_set_dimension) : new.
(gnm_graph_series_delete) : new.
* idl/GNOME_Gnumeric_Graph.idl : Add seriesSetDimension, and
seriesDelete. Bump the idl version.
2001-10-05 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do): Leg work for search.
......
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (format_match) : compute_value returns a Value
now.
(compute_value) : return a Value.
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/gnumeric-graph.c (gnm_graph_series_set_dimension) : new.
(gnm_graph_series_delete) : new.
* idl/GNOME_Gnumeric_Graph.idl : Add seriesSetDimension, and
seriesDelete. Bump the idl version.
2001-10-05 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do): Leg work for search.
......
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (format_match) : compute_value returns a Value
now.
(compute_value) : return a Value.
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/gnumeric-graph.c (gnm_graph_series_set_dimension) : new.
(gnm_graph_series_delete) : new.
* idl/GNOME_Gnumeric_Graph.idl : Add seriesSetDimension, and
seriesDelete. Bump the idl version.
2001-10-05 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do): Leg work for search.
......
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/number-match.c (format_match) : compute_value returns a Value
now.
(compute_value) : return a Value.
2001-10-05 Jody Goldberg <jgoldberg@home.com>
* src/gnumeric-graph.c (gnm_graph_series_set_dimension) : new.
(gnm_graph_series_delete) : new.
* idl/GNOME_Gnumeric_Graph.idl : Add seriesSetDimension, and
seriesDelete. Bump the idl version.
2001-10-05 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do): Leg work for search.
......
......@@ -12,9 +12,12 @@ module GNOME {
short start;
short end;
};
typedef long PlotID;
typedef long SeriesID;
typedef long VectorID;
typedef sequence<Pair> SeqPair;
typedef sequence<VectorID> VectorIDs;
exception Error { string mesg; };
enum VectorType {
VECTOR_TYPE_SCALAR,
......@@ -49,7 +52,7 @@ module GNOME {
};
module Graph {
interface Manager_v2 : Bonobo::Unknown {
interface Manager_v3 : Bonobo::Unknown {
typedef sequence<octet> Buffer;
Bonobo::Control configure (in string type);
......@@ -93,6 +96,26 @@ module GNOME {
*/
oneway void arrangeVectors (in VectorIDs data,
in VectorIDs optional_headers);
/**
* seriesSetDimension :
*
* Add/Remove/Edit the vector associated with a specific dimension
* of an series.
*
* a vectorID of -1 will remove the dimension.
*/
void seriesSetDimension (in SeriesID seriesID,
in string dim,
in VectorID vectorID)
raises (Error);
/**
* seriesDelete :
*
* Remove a series from a plot.
*/
void seriesDelete (in SeriesID series) raises (Error);
};
};
};
......
......@@ -622,11 +622,10 @@ cb_graph_guru_focus (GtkWindow *window, GtkWidget *focus, GraphGuruState *state)
state->current_vector = NULL;
vs->changed = FALSE;
printf ("parse (%s): %s\n", vs->element, str);
/* Are we adding a dimension that was not there previously ? */
if (*str) {
if (vs->vector != NULL) {
printf ("parse (%s): %s\n", vs->element, str);
puts ("changing an existing");
} else {
puts ("Adding a new dimension");
......
......@@ -1399,6 +1399,9 @@ format_number (gdouble number, int col_width, StyleFormatEntry const *entry)
break;
default:
/* TODO : After release check this.
* shouldn't we tack on the explicit characters here ?
*/
break;
}
format++;
......
......@@ -49,10 +49,10 @@
#define d(code)
#endif
#define MANAGER GNOME_Gnumeric_Graph_Manager_v2
#define MANAGER1(suffix) GNOME_Gnumeric_Graph_Manager_v2_ ## suffix
#define CMANAGER1(suffix) CORBA_sequence_GNOME_Gnumeric_Graph_Manager_v2_ ## suffix
#define MANAGER_OAF "IDL:GNOME/Gnumeric/Graph/Manager_v2:1.0"
#define MANAGER GNOME_Gnumeric_Graph_Manager_v3
#define MANAGER1(suffix) GNOME_Gnumeric_Graph_Manager_v3_ ## suffix
#define CMANAGER1(suffix) CORBA_sequence_GNOME_Gnumeric_Graph_Manager_v3_ ## suffix
#define MANAGER_OAF "IDL:GNOME/Gnumeric/Graph/Manager_v3:1.0"
struct _GnmGraph {
SheetObjectContainer parent;
......@@ -1290,3 +1290,15 @@ gnm_graph_series_add_dimension (xmlNode *series, char const *element)
xmlSetProp (res, "element", element);
return res;
}
void
gnm_graph_series_delete (GnmGraph *graph, xmlNode *series)
{
}
void
gnm_graph_series_set_dimension (GnmGraph *graph,
xmlNode *series, xmlChar const *element,
char const *expr)
{
}
......@@ -43,8 +43,12 @@ Dependent const *gnm_graph_vector_get_dependent (GnmGraphVector const *v);
void gnm_graph_vector_from_string (GnmGraphVector const *v,
char const *str);
/* Some xml utilities */
/* Series utilities */
xmlNode *gnm_graph_series_get_dimension (xmlNode *series, xmlChar const *element);
xmlNode *gnm_graph_series_add_dimension (xmlNode *series, char const *element);
void gnm_graph_series_delete (GnmGraph *graph, xmlNode *series);
void gnm_graph_series_set_dimension (GnmGraph *graph,
xmlNode *series, xmlChar const *element,
char const *expr);
#endif /* GNUMERIC_GRAPH_H */
......@@ -33,7 +33,7 @@
#include "format.h"
#include "value.h"
#undef DEBUG_NUMBER_MATCH
#define DEBUG_NUMBER_MATCH
/*
* Takes a list of strings (optionally include an * at the beginning
......@@ -385,7 +385,8 @@ format_create_regexp (unsigned char const *format, GByteArray **dest)
}
case '@':
g_string_append (regexp, ".*");
g_string_append (regexp, "(.*)");
append_type (MATCH_STRING_CONSTANT);
break;
case '_':
......@@ -720,9 +721,9 @@ extract_text (char const *str, const regmatch_t *mp)
* Currently the code cannot mix a MATCH_NUMBER with any
* of the date/time matching.
*/
static gboolean
static Value *
compute_value (char const *s, const regmatch_t *mp,
GByteArray *array, gnum_float *v)
GByteArray *array)
{
const int len = array->len;
gnum_float number = 0.0;
......@@ -853,6 +854,8 @@ compute_value (char const *s, const regmatch_t *mp,
break;
case MATCH_STRING_CONSTANT:
return value_new_string (str);
default :
g_warning ("compute_value: This should not happen\n");
break;
......@@ -864,8 +867,7 @@ compute_value (char const *s, const regmatch_t *mp,
if (is_number) {
if (percentify)
number *= 0.01;
*v = number;
return TRUE;
return value_new_float (number);
}
if (!(year == -1 && month == -1 && day == -1)) {
......@@ -945,10 +947,8 @@ compute_value (char const *s, const regmatch_t *mp,
g_date_free (date);
}
*v = number;
if (seconds == -1 && minutes == -1 && hours == -1)
return TRUE;
return value_new_float (number);
if (seconds == -1)
seconds = 0;
......@@ -976,9 +976,7 @@ compute_value (char const *s, const regmatch_t *mp,
number += (hours * 3600 + minutes * 60 + seconds) / (3600*24.0);
*v = number;
return TRUE;
return value_new_float (number);
}
/**
......@@ -1072,12 +1070,11 @@ format_match (char const *text, StyleFormat *cur_fmt,
return value_new_string (text + 1);
if (cur_fmt) {
gnum_float result;
if (style_format_is_text (cur_fmt))
return value_new_string (text);
if (cur_fmt->regexp_str != NULL &&
regexec (&cur_fmt->regexp, text, NM, mp, 0) != REG_NOMATCH &&
compute_value (text, mp, cur_fmt->match_tags, &result)) {
NULL != (v = compute_value (text, mp, cur_fmt->match_tags))) {
#ifdef DEBUG_NUMBER_MATCH
{
int i;
......@@ -1096,7 +1093,7 @@ format_match (char const *text, StyleFormat *cur_fmt,
if (matching_format)
*matching_format = cur_fmt;
return value_new_float (result);
return v;
}
}
......@@ -1107,8 +1104,6 @@ format_match (char const *text, StyleFormat *cur_fmt,
/* Fall back to checking the set of canned formats */
for (l = format_match_list; l; l = l->next) {
gnum_float result;
gboolean b;
StyleFormat *fmt = l->data;
#ifdef DEBUG_NUMBER_MATCH
printf ("test: %s \'%s\'\n", fmt->format, fmt->regexp_str);
......@@ -1132,18 +1127,19 @@ format_match (char const *text, StyleFormat *cur_fmt,
}
#endif
b = compute_value (text, mp, fmt->match_tags, &result);
v = compute_value (text, mp, fmt->match_tags);
#ifdef DEBUG_NUMBER_MATCH
if (b)
printf ("value = %f\n", result);
else
if (v) {
printf ("value = ");
value_dump (v);
} else
printf ("unable to compute value\n");
#endif
if (b) {
if (v != NULL) {
if (matching_format)
*matching_format = fmt;
return value_new_float (result);
return v;
}
}
......
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