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

Add a sample for the data page. Make the lists of plots and series.

2001-09-26  Jody Goldberg <jgoldberg@home.com>

	* dialog-graph-guru.c : Add a sample for the data page.
	  Make the lists of plots and series.  rewrite the the glade file
	  in preparation for constructing the exprEntries.

2001-09-26  Jody Goldberg <jgoldberg@home.com>

	* dialog-cell-format.c (cb_protection_locked_toggle) : new.
	(cb_protection_hidden_toggle) : new.
	(fmt_dialog_init_protection_page) : new.
	(fmt_dialog_impl) : call fmt_dialog_init_protection_page.

2001-09-26  Jody Goldberg <jgoldberg@home.com>

	* xml-sax-read.c (xml_sax_styleregion_start) : Add hidden & locked.

2001-09-26  Jody Goldberg <jgoldberg@home.com>

	* ms-excel-xf.h (_BiffXFData) : locked and hidden are booleans.
	* ms-excel-read.c (biff_xf_data_new) : read them that way.
	(ms_excel_get_style_from_xf) : store the protection flags.
	* ms-excel-write.c (build_xf_data) : ditto.  Add indent.

	* ms-chart.c (BC_R(seriestext)) : handle manually entered series names.

2001-09-26  Jody Goldberg <jgoldberg@home.com>

	* gnumeric.xsd : The style flags are not required, it will eventually
	  be possible to define styles that only change some of the
	  attributes.  Add locked & hidden.

	* src/xml-io.c (xml_write_style) : write locked & hidden.
	(xml_read_style) : read them too.

	* src/mstyle.c (mstyle_element_equal) : support locked and hidden.
	(mstyle_{get,set}_content_{locked,hidden}) : We have not implemented
	  it yet, but storing the info is easy enough.
	(mstyle_new_default) : Add locked & hidden.
parent 6cfb7eca
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* gnumeric.xsd : The style flags are not required, it will eventually
be possible to define styles that only change some of the
attributes. Add locked & hidden.
* src/xml-io.c (xml_write_style) : write locked & hidden.
(xml_read_style) : read them too.
* src/mstyle.c (mstyle_element_equal) : support locked and hidden.
(mstyle_{get,set}_content_{locked,hidden}) : We have not implemented
it yet, but storing the info is easy enough.
(mstyle_new_default) : Add locked & hidden.
2001-09-25 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (eval_expr_real) : shrink the stack a bit.
......
......@@ -16,6 +16,7 @@ Eric Baudais:
Jody:
* Enable XL import for graphs.
* Import/Export/Edit Hidden/Locked attributes.
* Parse using the assigned fmt before checking the builtins.
* Add simple bucketing of range dependencies.
* Add minor formating extension.
......
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* gnumeric.xsd : The style flags are not required, it will eventually
be possible to define styles that only change some of the
attributes. Add locked & hidden.
* src/xml-io.c (xml_write_style) : write locked & hidden.
(xml_read_style) : read them too.
* src/mstyle.c (mstyle_element_equal) : support locked and hidden.
(mstyle_{get,set}_content_{locked,hidden}) : We have not implemented
it yet, but storing the info is easy enough.
(mstyle_new_default) : Add locked & hidden.
2001-09-25 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (eval_expr_real) : shrink the stack a bit.
......
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* gnumeric.xsd : The style flags are not required, it will eventually
be possible to define styles that only change some of the
attributes. Add locked & hidden.
* src/xml-io.c (xml_write_style) : write locked & hidden.
(xml_read_style) : read them too.
* src/mstyle.c (mstyle_element_equal) : support locked and hidden.
(mstyle_{get,set}_content_{locked,hidden}) : We have not implemented
it yet, but storing the info is easy enough.
(mstyle_new_default) : Add locked & hidden.
2001-09-25 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (eval_expr_real) : shrink the stack a bit.
......
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* gnumeric.xsd : The style flags are not required, it will eventually
be possible to define styles that only change some of the
attributes. Add locked & hidden.
* src/xml-io.c (xml_write_style) : write locked & hidden.
(xml_read_style) : read them too.
* src/mstyle.c (mstyle_element_equal) : support locked and hidden.
(mstyle_{get,set}_content_{locked,hidden}) : We have not implemented
it yet, but storing the info is easy enough.
(mstyle_new_default) : Add locked & hidden.
2001-09-25 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (eval_expr_real) : shrink the stack a bit.
......
......@@ -348,15 +348,17 @@
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="HAlign" type="gmr:horizontal_alignment" use="required"/>
<xsd:attribute name="VAlign" type="gmr:vertical_alignment" use="required"/>
<xsd:attribute name="WrapText" type="xsd:boolean" use="required"/>
<xsd:attribute name="Orient" type="gmr:style_orientation" use="required"/>
<xsd:attribute name="Shade" type="gmr:style_shading" use="required"/>
<xsd:attribute name="Indent" type="xsd:integer" use="required"/>
<xsd:attribute name="Fore" type="gmr:color" use="required"/>
<xsd:attribute name="Back" type="gmr:color" use="required"/>
<xsd:attribute name="PatternColor" type="gmr:color" use="required"/>
<xsd:attribute name="HAlign" type="gmr:horizontal_alignment"/>
<xsd:attribute name="VAlign" type="gmr:vertical_alignment" />
<xsd:attribute name="WrapText" type="xsd:boolean" />
<xsd:attribute name="Orient" type="gmr:style_orientation" />
<xsd:attribute name="Shade" type="gmr:style_shading" />
<xsd:attribute name="Indent" type="xsd:integer" />
<xsd:attribute name="Fore" type="gmr:color" />
<xsd:attribute name="Back" type="gmr:color" />
<xsd:attribute name="PatternColor" type="gmr:color" />
<xsd:attribute name="Locked" type="xsd:boolean" />
<xsd:attribute name="Hidden" type="xsd:boolean" />
<!-- the most common value of the Format attribute, by far, is
General. Here are some other values:
#,##0.00
......
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* ms-excel-xf.h (_BiffXFData) : locked and hidden are booleans.
* ms-excel-read.c (biff_xf_data_new) : read them that way.
(ms_excel_get_style_from_xf) : store the protection flags.
* ms-excel-write.c (build_xf_data) : ditto. Add indent.
* ms-chart.c (BC_R(seriestext)) : handle manually entered series names.
2001-09-25 Jon K Hellan <hellan@acm.org>
* .cvsignore: Add plugin.xml
......
......@@ -509,6 +509,7 @@ static gboolean
BC_R(attachedlabel)(ExcelChartHandler const *handle,
ExcelChartReadState *s, BiffQuery *q)
{
d (3,{
guint16 const flags = MS_OLE_GET_GUINT16 (q->data);
gboolean const show_value = (flags&0x01) ? TRUE : FALSE;
gboolean const show_percent = (flags&0x02) ? TRUE : FALSE;
......@@ -533,6 +534,7 @@ BC_R(attachedlabel)(ExcelChartHandler const *handle,
if (show_bubble_size)
puts ("Show bubble size");
}
});
return FALSE;
}
......@@ -1374,12 +1376,11 @@ BC_R(markerformat)(ExcelChartHandler const *handle,
BC_R(color) (q->data+4, "InteriorColour", marker, no_back);
}
if (s->container.ver >= MS_BIFF_V8)
{
if (s->container.ver >= MS_BIFF_V8) {
#if 0
/* Ignore the colour indicies. Use the colours themselves
* to avoid problems with guessing the strange index values
*/
/* Ignore the colour indicies. Use the colours themselves to
* avoid problems with guessing the strange index values
*/
StyleColor const * marker_border =
ms_excel_palette_get (s->wb->palette,
MS_OLE_GET_GUINT16 (q->data+12));
......@@ -1750,11 +1751,13 @@ BC_R(series)(ExcelChartHandler const *handle,
g_return_val_if_fail (s->xml.doc != NULL, TRUE);
g_return_val_if_fail (s->currentSeries == NULL, TRUE);
d (2, printf ("SERIES = %d\n", s->series->len););
series = excel_chart_series_new ();
series->xml = xmlNewDocNode (s->xml.doc, s->xml.ns, "Series", NULL);
e_xml_set_uint_prop_by_name (series->xml, "index", s->series->len);
/*
* WARNING : The offsets in the documentation are WRONG.
/* WARNING : The offsets in the documentation are WRONG.
* Use the sizes instead.
*/
BC_R(vector_details) (s, q, series, MS_VECTOR_PURPOSE_CATEGORIES,
......@@ -1768,8 +1771,6 @@ BC_R(series)(ExcelChartHandler const *handle,
g_ptr_array_add (s->series, series);
s->currentSeries = series;
d (2, printf ("SERIES = %d\n", s->series->len-1););
return FALSE;
}
......@@ -1809,6 +1810,13 @@ BC_R(seriestext)(ExcelChartHandler const *handle,
d (2, puts (text););
g_return_val_if_fail (id == 0, FALSE);
/* A quick heuristic */
if (s->currentSeries != NULL)
xmlSetProp (s->currentSeries->xml, "name", text);
/* TODO : handle axis and chart titles */
return FALSE;
}
......@@ -2434,7 +2442,7 @@ ms_excel_chart (BiffQuery *q, MSContainer *container, MsBiffVersion ver, GtkObje
/* Figure out how to assign these back to the series,
* are they just sequential ?
*/
d (5, printf ("%f\n", val););
d (10, printf ("%f\n", val););
break;
}
......@@ -2444,7 +2452,7 @@ ms_excel_chart (BiffQuery *q, MSContainer *container, MsBiffVersion ver, GtkObje
guint16 xf = MS_OLE_GET_GUINT16 (q->data + 4);
guint16 len = MS_OLE_GET_GUINT16 (q->data + 6);
char *label = biff_get_text (q->data + 8, len, NULL);
d (5, { puts (label);
d (10, {puts (label);
printf ("hmm, what are these values for a chart ???\n"
"row = %d, col = %d, xf = %d\n", row, col, xf);});
g_free (label);
......
......@@ -34,7 +34,6 @@ typedef enum { MS_BIFF_TYPE_Workbook=0, MS_BIFF_TYPE_VBModule=1, MS_BIFF_TYPE_Wo
/* Cell / XF types */
typedef enum { MS_BIFF_H_VISIBLE=0, MS_BIFF_H_HIDDEN=1,
MS_BIFF_H_VERY_HIDDEN=2 } MsBiffHidden ;
typedef enum { MS_BIFF_L_LOCKED=1, MS_BIFF_L_UNLOCKED=0 } MsBiffLocked ;
typedef enum { MS_BIFF_X_STYLE=0, MS_BIFF_X_CELL=1 } MsBiffXfType ;
typedef enum { MS_BIFF_F_MS=0, MS_BIFF_F_LOTUS=1 } MsBiffFormat ;
typedef enum { MS_BIFF_E_CONTEXT=0, MS_BIFF_E_LEFT_TO_RIGHT=1,
......
......@@ -1160,10 +1160,14 @@ ms_excel_get_style_from_xf (ExcelSheet *esheet, guint16 xfidx)
if (xf->style_format)
mstyle_set_format (mstyle, xf->style_format);
/* protection */
mstyle_set_content_locked (mstyle, xf->locked);
mstyle_set_content_hidden (mstyle, xf->hidden);
/* Alignment */
mstyle_set_align_v (mstyle, xf->valign);
mstyle_set_align_h (mstyle, xf->halign);
mstyle_set_wrap_text (mstyle, xf->wrap);
mstyle_set_wrap_text (mstyle, xf->wrap_text);
mstyle_set_indent (mstyle, xf->indent);
/* mstyle_set_orientation (mstyle, ); */
......@@ -1435,8 +1439,8 @@ biff_xf_data_new (BiffQuery *q, ExcelWorkbook *wb, MsBiffVersion ver)
? biff_format_data_lookup (wb, xf->format_idx) : NULL;
data = MS_OLE_GET_GUINT16 (q->data + 4);
xf->locked = (data & 0x0001) ? MS_BIFF_L_LOCKED : MS_BIFF_L_UNLOCKED;
xf->hidden = (data & 0x0002) ? MS_BIFF_H_HIDDEN : MS_BIFF_H_VISIBLE;
xf->locked = (data & 0x0001) != 0;
xf->hidden = (data & 0x0002) != 0;
xf->xftype = (data & 0x0004) ? MS_BIFF_X_STYLE : MS_BIFF_X_CELL;
xf->format = (data & 0x0008) ? MS_BIFF_F_LOTUS : MS_BIFF_F_MS;
xf->parentstyle = (data & 0xfff0) >> 4;
......@@ -1485,7 +1489,7 @@ biff_xf_data_new (BiffQuery *q, ExcelWorkbook *wb, MsBiffVersion ver)
printf ("Unknown halign %d\n", subdata);
break;
}
xf->wrap = (data & 0x0008) ? TRUE : FALSE;
xf->wrap_text = (data & 0x0008) != 0;
subdata = (data & 0x0070) >> 4;
switch (subdata) {
case 0:
......
......@@ -2001,7 +2001,7 @@ get_xf_differences (ExcelWorkbook *wb, BiffXFData *xfd, MStyle *parentst)
/* hmm. documentation doesn't say that alignment bit is
affected by vertical alignment, but it's a reasonable guess */
if (xfd->halign != HALIGN_GENERAL || xfd->valign != VALIGN_TOP
|| xfd->wrap)
|| xfd->wrap_text)
xfd->differences |= 1 << MS_BIFF_D_ALIGN_BIT;
for (i = 0; i < STYLE_ORIENT_MAX; i++) {
/* Should we also test colors? */
......@@ -2037,8 +2037,8 @@ log_xf_data (ExcelWorkbook *wb, BiffXFData *xfd, int idx)
xfd->format_idx, desc);
g_free (desc);
printf (" hor align 0x%x, ver align 0x%x, wrap %s\n",
xfd->halign, xfd->valign, xfd->wrap ? "on" : "off");
printf (" hor align 0x%x, ver align 0x%x, wrap_text %s\n",
xfd->halign, xfd->valign, xfd->wrap_text ? "on" : "off");
printf (" fill fg color idx 0x%x, fill bg color idx 0x%x"
", pattern (Excel) %d\n",
xfd->pat_foregnd_col, xfd->pat_backgnd_col,
......@@ -2096,14 +2096,14 @@ build_xf_data (ExcelWorkbook *wb, BiffXFData *xfd, MStyle *st)
xfd->style_format = mstyle_get_format (st);
xfd->format_idx = formats_get_index (wb, xfd->style_format);
/* Hidden and locked - we don't have those yet */
xfd->hidden = MS_BIFF_H_VISIBLE;
xfd->locked = MS_BIFF_L_UNLOCKED;
xfd->locked = mstyle_get_content_locked (st);
xfd->hidden = mstyle_get_content_hidden (st);
xfd->halign = mstyle_get_align_h (st);
xfd->valign = mstyle_get_align_v (st);
xfd->wrap = mstyle_get_wrap_text (st);
xfd->wrap_text = mstyle_get_wrap_text (st);
xfd->orientation = mstyle_get_orientation (st);
xfd->indent = mstyle_get_indent (st);
/* Borders */
for (i = STYLE_TOP; i < STYLE_ORIENT_MAX; i++) {
......@@ -2121,7 +2121,6 @@ build_xf_data (ExcelWorkbook *wb, BiffXFData *xfd, MStyle *st)
c = PALETTE_ALSO_BLACK;
xfd->border_color[i] = c;
}
}
}
......@@ -2249,20 +2248,17 @@ write_xf_record (BiffPut *bp, ExcelWorkbook *wb, BiffXFData *xfd)
MS_OLE_SET_GUINT16 (data+0, xfd->font_idx);
MS_OLE_SET_GUINT16 (data+2, xfd->format_idx);
/* According to doc, 1 means locked, but it's 1 also for
* unlocked cells. Presumably, locking becomes effective when
* the locking bit in differences is also set */
itmp = 0x0001;
if (xfd->hidden != MS_BIFF_H_VISIBLE)
if (xfd->hidden)
itmp |= 1 << 1;
if (xfd->locked != MS_BIFF_L_UNLOCKED)
if (xfd->locked)
itmp |= 1;
itmp |= (xfd->parentstyle << 4) & 0xFFF0; /* Parent style */
MS_OLE_SET_GUINT16(data+4, itmp);
/* Horizontal alignment */
itmp = halign_to_excel (xfd->halign) & 0x7;
if (xfd->wrap) /* Wrapping */
if (xfd->wrap_text) /* Wrapping */
itmp |= 1 << 3;
/* Vertical alignment */
itmp |= (valign_to_excel (xfd->valign) << 4) & 0x70;
......
......@@ -27,14 +27,14 @@ typedef struct _BiffXFData {
guint16 font_idx;
guint16 format_idx;
StyleFormat *style_format;
MsBiffHidden hidden;
MsBiffLocked locked;
gboolean hidden;
gboolean locked;
MsBiffXfType xftype; /* -- Very important field... */
MsBiffFormat format;
guint16 parentstyle;
StyleHAlignFlags halign;
StyleVAlignFlags valign;
gboolean wrap;
gboolean wrap_text;
guint8 rotation;
int indent;
StyleOrientation orientation;
......
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* xml-sax-read.c (xml_sax_styleregion_start) : Add hidden & locked.
2001-09-25 Jon K Hellan <hellan@acm.org>
* .cvsignore: Add plugin.xml
......
......@@ -1032,6 +1032,10 @@ xml_sax_styleregion_start (XMLSaxParseState *state, CHAR const **attrs)
mstyle_set_color (state->style, MSTYLE_COLOR_PATTERN, colour);
else if (!strcmp (attrs[0], "Format"))
mstyle_set_format_text (state->style, attrs[1]);
else if (xml_sax_attr_int (attrs, "Hidden", &val))
mstyle_set_content_hidden (state->style, val);
else if (xml_sax_attr_int (attrs, "Locked", &val))
mstyle_set_content_locked (state->style, val);
else
xml_sax_unknown_attr (state, attrs, "StyleRegion");
}
......
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* dialog-graph-guru.c : Add a sample for the data page.
Make the lists of plots and series. rewrite the the glade file
in preparation for constructing the exprEntries.
2001-09-26 Jody Goldberg <jgoldberg@home.com>
* dialog-cell-format.c (cb_protection_locked_toggle) : new.
(cb_protection_hidden_toggle) : new.
(fmt_dialog_init_protection_page) : new.
(fmt_dialog_impl) : call fmt_dialog_init_protection_page.
2001-09-21 Jody Goldberg <jgoldberg@home.com>
* dialog-formula-guru.c (cb_formula_guru_entry_changed) : fix the
......
......@@ -3189,8 +3189,7 @@ Double
<widget>
<class>GtkCheckButton</class>
<name>checkbutton5</name>
<sensitive>False</sensitive>
<name>protection_locked</name>
<can_focus>True</can_focus>
<label>_Locked</label>
<active>False</active>
......@@ -3204,8 +3203,7 @@ Double
<widget>
<class>GtkCheckButton</class>
<name>checkbutton6</name>
<sensitive>False</sensitive>
<name>protection_hidden</name>
<can_focus>True</can_focus>
<label>_Hidden</label>
<active>False</active>
......@@ -3227,7 +3225,6 @@ Double
<yalign>0</yalign>
<xpad>0</xpad>
<ypad>10</ypad>
<focus_target>protected_button</focus_target>
<child>
<padding>0</padding>
<expand>False</expand>
......@@ -3237,7 +3234,7 @@ Double
<widget>
<class>GtkCheckButton</class>
<name>protected_button</name>
<name>protection_sheet_protected</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<label>Worksheet _protected</label>
......
......@@ -146,6 +146,10 @@ typedef struct _FormatState
PatternPicker pattern;
} back;
struct {
GtkCheckButton *hidden, *locked;
} protection;
void (*dialog_changed) (gpointer user_data);
gpointer dialog_changed_user_data;
} FormatState;
......@@ -1870,6 +1874,53 @@ init_border_button (FormatState *state, StyleBorderLocation const i,
/*****************************************************************************/
static void
cb_protection_locked_toggle (GtkToggleButton *button, FormatState *state)
{
if (state->enable_edit) {
mstyle_set_content_locked (state->result,
gtk_toggle_button_get_active (button));
fmt_dialog_changed (state);
}
}
static void
cb_protection_hidden_toggle (GtkToggleButton *button, FormatState *state)
{
if (state->enable_edit) {
mstyle_set_content_hidden (state->result,
gtk_toggle_button_get_active (button));
fmt_dialog_changed (state);
}
}
static void
fmt_dialog_init_protection_page (FormatState *state)
{
GtkWidget *w;
gboolean flag = FALSE;
flag = mstyle_is_element_conflict (state->style, MSTYLE_CONTENT_LOCKED)
? FALSE : mstyle_get_content_locked (state->style);
w = glade_xml_get_widget (state->gui, "protection_locked");
state->protection.locked = GTK_CHECK_BUTTON (w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), flag);
gtk_signal_connect (GTK_OBJECT (w),
"toggled", GTK_SIGNAL_FUNC (cb_protection_locked_toggle),
state);
flag = mstyle_is_element_conflict (state->style, MSTYLE_CONTENT_HIDDEN)
? FALSE : mstyle_get_content_hidden (state->style);
w = glade_xml_get_widget (state->gui, "protection_hidden");
state->protection.hidden = GTK_CHECK_BUTTON (w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), flag);
gtk_signal_connect (GTK_OBJECT (w),
"toggled", GTK_SIGNAL_FUNC (cb_protection_hidden_toggle),
state);
}
/*****************************************************************************/
/* Handler for the apply button */
static void
cb_fmt_dialog_dialog_apply (GtkObject *w, int page, FormatState *state)
......@@ -1935,8 +1986,7 @@ set_initial_focus (FormatState *state)
focus_widget
= glade_xml_get_widget (state->gui, "back_color_auto");
} else if (strcmp (name, "protection_box") == 0) {
focus_widget = glade_xml_get_widget (state->gui,
"protected_button");
focus_widget = GTK_WIDGET (state->protection.locked);
} else {
focus_widget = NULL;
}
......@@ -2068,6 +2118,7 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
fmt_dialog_init_align_page (state);
fmt_dialog_init_font_page (state);
fmt_dialog_init_background_page (state);
fmt_dialog_init_protection_page (state);
/* Setup border line pattern buttons & select the 1st button */
for (i = MSTYLE_BORDER_TOP; i < MSTYLE_BORDER_DIAGONAL; i++) {
......
......@@ -26,14 +26,30 @@
#include "ranges.h"
#include "selection.h"
#include "expr.h"
#include "sheet.h"
#include "workbook-edit.h"
#include "sheet-control-gui.h"
#include "sheet-object.h"
#include "dialogs.h"
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <gal/widgets/gtk-combo-text.h>
#include <gal/util/e-xml-utils.h>
typedef struct _GraphGuruState GraphGuruState;
typedef struct
{
GraphGuruState *state;
GtkWidget *name_label;
GnumericExprEntry *entry;
gchar *name;
gboolean is_optional;
int index;
} VectorState;
struct _GraphGuruState
{
GnmGraph *graph;
Bonobo_Control control;
......@@ -47,35 +63,48 @@ typedef struct
GtkWidget *button_finish;
GtkNotebook *steps;
/* Data widgets */
GtkWidget *data_notebook;
/* simple selection */
GtkWidget *data_is_cols_radio;
GtkWidget *data_is_rows_radio;
GtkWidget *data_range;
/* complex selection */
GtkWidget *data_series_list;
GtkWidget *data_series_name;
GtkWidget *data_series_range;
GtkWidget *data_add_series;
GtkWidget *data_remove_series;
GtkWidget *sample_frame;
GtkWidget *plot_selector;
GtkWidget *plot_add;
GtkWidget *plot_remove;
GtkWidget *series_selector;
GtkWidget *series_add;
GtkWidget *series_remove;
GtkWidget *series_details;
GtkWidget *shared_series_details;
GtkWidget *sample;
GtkWidget *selection_table;
GtkWidget *shared_separator;
struct {
GPtrArray *exprs;
} shared, unshared;
/* internal state */
int current_page;
int current_page, initial_page;
gboolean valid;
gboolean updating;
gboolean is_columns;
GSList *ranges;
xmlDoc *xml_doc;
gboolean is_columns;
xmlDoc *xml_doc;
xmlNode *current_plot;
xmlNode *current_series;
/* external state */
WorkbookControlGUI *wbcg;
SheetControlGUI *scg;
Workbook *wb;
Sheet *sheet;
} GraphGuruState;
Workbook *wb;
Sheet *sheet;
};
static void
graph_guru_clear_sample (GraphGuruState *state)
{
if (state->sample != NULL) {
gtk_object_destroy (GTK_OBJECT (state->sample));
state->sample = NULL;
}
}
static void
graph_guru_state_destroy (GraphGuruState *state)
......@@ -94,15 +123,6 @@ graph_guru_state_destroy (GraphGuruState *state)
state->gui = NULL;
}
if (state->ranges != NULL) {
GSList *ptr = state->ranges;
for (; ptr != NULL; ptr = ptr->next)
g_free (ptr->data);
g_slist_free (state->ranges);
state->ranges = NULL;
}
/* Handle window manger closing the dialog.
* This will be ignored if we are being destroyed differently.
*/
......@@ -131,11 +151,132 @@ cb_graph_guru_key_press (GtkWidget *widget, GdkEventKey *event,
return FALSE;
}
static char *
graph_guru_series_name (GraphGuruState *s, xmlNode *series)
{
int i;
xmlChar *name = xmlGetProp (series, "name");
if (name != NULL) {
char *res = g_strdup (name);
xmlFree (name);
return res;
}
i = e_xml_get_integer_prop_by_name_with_default (series, "index", -1);
g_return_val_if_fail (i >= 0, g_strdup ("ERROR Missing Index"));
return g_strdup_printf ("Series%d", i+1);
}
static void
graph_guru_init_data_page (GraphGuruState *state)
graph_guru_select_series (GraphGuruState *s, xmlNode *xml)
{
char *name;
if (s->updating)
return;
name = graph_guru_series_name (s, xml);
s->updating = TRUE;
gtk_combo_text_set_text (GTK_COMBO_TEXT (s->series_selector), name);
s->updating = FALSE;
if (s->current_series == NULL) {
}
s->current_series = xml;
}
static char *
graph_guru_plot_name (GraphGuruState *s, xmlNode *plot)
{
g_return_if_fail (state->xml_doc != NULL);
xmlDocDump (stdout, state->xml_doc);
char const *t = "Plot";
int i = e_xml_get_integer_prop_by_name_with_default (plot, "index", -1);
xmlNode *type = e_xml_get_child_by_name (plot, "Type");
g_return_val_if_fail (i >= 0, g_strdup ("ERROR Missing Index"));
if (type != NULL && type->xmlChildrenNode)
t = type->xmlChildrenNode->name;
return g_strdup_printf ("%s%d", t, i+1);
}
static void
graph_guru_select_plot (GraphGuruState *s, xmlNode *xml)
{
xmlNode *series;
char *name;
if (s->updating)
return;