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

support formatting graphs.

simplify idl in preparation for demand based typing.

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

	* src/gui-util.c (gnumeric_create_popup_menu_list) : tweak this to
	  take a list.
	(gnumeric_create_popup_menu) : and make this a wrapper.

	* src/gnumeric-graph.c (gnm_graph_user_config) : connect to the graph
	  guru formatGuru.
parent 39b40f85
......@@ -23,7 +23,7 @@ module GNOME {
enum VectorType {
VECTOR_TYPE_SCALAR,
VECTOR_TYPE_DATE,
VECTOR_TYPE_DATE, /* unused */
VECTOR_TYPE_STRING
};
......@@ -38,13 +38,6 @@ module GNOME {
void value (out Seq values);
};
};
module Date {
typedef sequence<long> Seq;
interface Vector : VectorSelection {
oneway void changed (in short start, in Seq new_values);
void value (out Seq values);
};
};
module String {
typedef sequence<string> Seq;
interface Vector : VectorSelection {
......
2001-10-16 Jody Goldberg <jgoldberg@home.com>
* dialog-graph-guru.c (graph_guru_apply_changes) : add the format guru.
(graph_guru_init_format_page) : new.
(dialog_graph_guru) : support format guru..
(graph_guru_set_page) : ditto.
2001-10-16 Jody Goldberg <jgoldberg@home.com>
* dialog-graph-guru.c (cb_series_entry_changed) : allow renaming of
......
......@@ -84,7 +84,7 @@ struct _GraphGuruState
GtkWidget *selection_table;
GtkWidget *shared_separator;
CONFIG_GURU type_selector;
CONFIG_GURU type_selector, format_guru;
DATA_GURU data_guru;
GtkWidget *sample;
GPtrArray *shared, *unshared;
......@@ -678,7 +678,8 @@ graph_guru_apply_changes (GraphGuruState *state)
case 1: if (state->data_guru != CORBA_OBJECT_NIL)
CONFIG_GURU1 (applyChanges) (state->data_guru, &ev);
break;
case 2:
case 2: if (state->format_guru != CORBA_OBJECT_NIL)
CONFIG_GURU1 (applyChanges) (state->format_guru, &ev);
break;
default : /* it is ok to be invalid when intializing */
......@@ -693,7 +694,8 @@ graph_guru_init_data_page (GraphGuruState *s)
if (s->data_guru != CORBA_OBJECT_NIL)
return;
s->data_guru = gnm_graph_get_config_control (s->graph, "DataGuru"),
s->data_guru = gnm_graph_get_config_control (
s->graph, "DataGuru"),
g_return_if_fail (s->data_guru != CORBA_OBJECT_NIL);
......@@ -704,6 +706,28 @@ graph_guru_init_data_page (GraphGuruState *s)
graph_guru_get_spec (s);
}
static void
graph_guru_init_format_page (GraphGuruState *s)
{
GtkWidget *w;
if (s->format_guru != CORBA_OBJECT_NIL)
return;
s->format_guru = gnm_graph_get_config_control (
s->graph, "FormatGuru");
g_return_if_fail (s->format_guru != CORBA_OBJECT_NIL);
w = bonobo_widget_new_control_from_objref (
s->format_guru, CORBA_OBJECT_NIL);
gtk_widget_show_all (w);
if (s->initial_page == 0)
gtk_notebook_append_page (s->steps, w, NULL);
else
gtk_notebook_prepend_page (s->steps, w, NULL);
}
static void
graph_guru_set_page (GraphGuruState *state, int page)
{
......@@ -727,7 +751,12 @@ graph_guru_set_page (GraphGuruState *state, int page)
name = _("Graph Data");
graph_guru_init_data_page (state);
break;
case 2: name = _("Step 3 of 3: Customize graph");
case 2:
if (state->initial_page == 0)
name = _("Step 3 of 3: Customize graph");
else
name = _("Format Graph");
graph_guru_init_format_page (state);
next_ok = FALSE;
break;
......@@ -958,6 +987,7 @@ dialog_graph_guru (WorkbookControlGUI *wbcg, GnmGraph *graph, int page)
state->current_series = -1;
state->type_selector = CORBA_OBJECT_NIL;
state->data_guru = CORBA_OBJECT_NIL;
state->format_guru = CORBA_OBJECT_NIL;
if (graph != NULL) {
g_return_if_fail (IS_GNUMERIC_GRAPH (graph));
......@@ -994,11 +1024,13 @@ dialog_graph_guru (WorkbookControlGUI *wbcg, GnmGraph *graph, int page)
state->initial_page = page;
if (page == 0) {
GtkWidget *w;
state->type_selector = gnm_graph_get_config_control (
state->graph, "TypeSelector");
gtk_notebook_prepend_page (state->steps,
bonobo_widget_new_control_from_objref (
state->type_selector, CORBA_OBJECT_NIL), NULL);
w = bonobo_widget_new_control_from_objref (
state->type_selector, CORBA_OBJECT_NIL);
gtk_widget_show_all (w);
gtk_notebook_prepend_page (state->steps, w, NULL);
}
gtk_widget_show_all (state->dialog);
......
......@@ -85,7 +85,6 @@ struct _GnmGraphVector {
CORBA_Object corba_obj; /* local CORBA object */
union {
POA_GNOME_Gnumeric_Scalar_Vector scalar;
POA_GNOME_Gnumeric_Date_Vector date;
POA_GNOME_Gnumeric_String_Vector string;
PortableServer_POA any;
} servant;
......@@ -93,7 +92,6 @@ struct _GnmGraphVector {
/* The remote server monitoring this vector */
union {
GNOME_Gnumeric_Scalar_Vector scalar;
GNOME_Gnumeric_Date_Vector date;
GNOME_Gnumeric_String_Vector string;
CORBA_Object any;
} subscriber;
......@@ -154,33 +152,7 @@ gnm_graph_vector_seq_scalar (GnmGraphVector *vector)
return values;
}
static GNOME_Gnumeric_Date_Seq *
gnm_graph_vector_seq_date (GnmGraphVector *vector)
{
int i, len;
EvalPos pos;
GNOME_Gnumeric_Date_Seq *values;
Value *v = vector->value;
len = vector->is_column
? value_area_get_height (&pos, v)
: value_area_get_width (&pos, v);
values = GNOME_Gnumeric_Date_Seq__alloc ();
values->_length = values->_maximum = len;
values->_buffer = CORBA_sequence_CORBA_long_allocbuf (len);
values->_release = CORBA_TRUE;
/* FIXME : This is dog slow */
for (i = 0; i < len ; ++i) {
Value const *elem = vector->is_column
? value_area_get_x_y (&pos, v, 0, i)
: value_area_get_x_y (&pos, v, i, 0);
/* TODO : do we want to handle ignoring blanks at this level ? */
values->_buffer [i] = elem ? value_get_as_int (elem) : 0;
}
return values;
}
static GNOME_Gnumeric_String_Seq *
gnm_graph_vector_seq_string (GnmGraphVector *vector)
{
......@@ -247,15 +219,6 @@ gnm_graph_vector_eval (Dependent *dep)
break;
}
case GNM_VECTOR_DATE : {
GNOME_Gnumeric_Date_Seq *seq =
gnm_graph_vector_seq_date (vector);
GNOME_Gnumeric_Date_Vector_changed (
vector->subscriber.date, 0, seq, &ev);
CORBA_free (seq);
break;
}
case GNM_VECTOR_STRING : {
GNOME_Gnumeric_String_Seq *seq =
gnm_graph_vector_seq_string (vector);
......@@ -288,19 +251,6 @@ impl_scalar_vector_value (PortableServer_Servant servant,
*values = gnm_graph_vector_seq_scalar (vector);
}
static void
impl_date_vector_value (PortableServer_Servant servant,
GNOME_Gnumeric_Date_Seq **values,
CORBA_Environment *ev)
{
GnmGraphVector *vector = SERVANT_TO_GRAPH_VECTOR (servant);
g_return_if_fail (IS_GNUMERIC_GRAPH_VECTOR (vector));
g_return_if_fail (vector->type == GNM_VECTOR_DATE);
*values = gnm_graph_vector_seq_date (vector);
}
static void
impl_string_vector_value (PortableServer_Servant servant,
GNOME_Gnumeric_String_Seq **values,
......@@ -328,20 +278,6 @@ impl_scalar_vector_changed (PortableServer_Servant servant,
g_warning ("Gnumeric : scalar vector changed remotely (%p)", vector);
}
static void
impl_date_vector_changed (PortableServer_Servant servant,
const CORBA_short start,
const GNOME_Gnumeric_Date_Seq *vals,
CORBA_Environment *ev)
{
GnmGraphVector *vector = SERVANT_TO_GRAPH_VECTOR (servant);
g_return_if_fail (IS_GNUMERIC_GRAPH_VECTOR (vector));
g_return_if_fail (vector->type == GNM_VECTOR_DATE);
g_warning ("Gnumeric : date vector changed remotely (%p)", vector);
}
static void
impl_string_vector_changed (PortableServer_Servant servant,
const CORBA_short start,
......@@ -369,7 +305,6 @@ gnm_graph_vector_get_dependent (GnmGraphVector const *vec)
static GtkObjectClass *gnm_graph_vector_parent_class = NULL;
static POA_GNOME_Gnumeric_VectorSelection__vepv vector_selection_vepv;
static POA_GNOME_Gnumeric_Scalar_Vector__vepv scalar_vector_vepv;
static POA_GNOME_Gnumeric_Date_Vector__vepv date_vector_vepv;
static POA_GNOME_Gnumeric_String_Vector__vepv string_vector_vepv;
Bonobo_Control
......@@ -428,12 +363,6 @@ gnm_graph_vector_corba_init (GnmGraphVector *vector)
&vector->servant.scalar, &ev);
break;
case GNM_VECTOR_DATE :
vector->servant.date.vepv = &date_vector_vepv;
POA_GNOME_Gnumeric_Date_Vector__init (
&vector->servant.date, &ev);
break;
case GNM_VECTOR_STRING :
vector->servant.string.vepv = &string_vector_vepv;
POA_GNOME_Gnumeric_String_Vector__init (
......@@ -498,10 +427,6 @@ gnm_graph_vector_corba_destroy (GnmGraphVector *vector)
POA_GNOME_Gnumeric_Scalar_Vector__fini (
&vector->servant.scalar, &ev);
break;
case GNM_VECTOR_DATE :
POA_GNOME_Gnumeric_Date_Vector__fini (
&vector->servant.date, &ev);
break;
case GNM_VECTOR_STRING :
POA_GNOME_Gnumeric_String_Vector__fini (
&vector->servant.string, &ev);
......@@ -551,7 +476,6 @@ gnm_graph_vector_corba_class_init (void)
{
static POA_GNOME_Gnumeric_VectorSelection__epv selection_epv;
static POA_GNOME_Gnumeric_Scalar_Vector__epv scalar_epv;
static POA_GNOME_Gnumeric_Date_Vector__epv date_epv;
static POA_GNOME_Gnumeric_String_Vector__epv string_epv;
selection_epv.selected = &impl_vector_selection_selected;
......@@ -565,13 +489,6 @@ gnm_graph_vector_corba_class_init (void)
scalar_vector_vepv.GNOME_Gnumeric_VectorSelection_epv =
&selection_epv;
date_epv.changed = & impl_date_vector_changed;
date_epv.value = &impl_date_vector_value;
date_vector_vepv.GNOME_Gnumeric_Date_Vector_epv =
&date_epv;
date_vector_vepv.GNOME_Gnumeric_VectorSelection_epv =
&selection_epv;
string_epv.changed = & impl_string_vector_changed;
string_epv.value = &impl_string_vector_value;
string_vector_vepv.GNOME_Gnumeric_String_Vector_epv =
......@@ -738,10 +655,6 @@ gnm_graph_add_vector (GnmGraph *graph, ExprTree *expr,
case GNM_VECTOR_SCALAR :
case GNM_VECTOR_STRING :
break;
case GNM_VECTOR_DATE :
g_warning ("Date vectors aren't supported yet");
type = GNM_VECTOR_SCALAR;
break;
default :
g_warning ("Unknown vector type");
type = GNM_VECTOR_SCALAR;
......@@ -1119,9 +1032,9 @@ gnm_graph_populate_menu (SheetObject *so,
}
static void
gnm_graph_user_config (SheetObject *sheet_object,
SheetControlGUI *s_control)
gnm_graph_user_config (SheetObject *so, SheetControlGUI *scg)
{
dialog_graph_guru (scg_get_wbcg (scg), GNUMERIC_GRAPH (so), 2);
}
static gboolean
......
......@@ -8,7 +8,6 @@
typedef enum {
GNM_VECTOR_SCALAR = GNOME_Gnumeric_VECTOR_TYPE_SCALAR,
GNM_VECTOR_DATE = GNOME_Gnumeric_VECTOR_TYPE_DATE,
GNM_VECTOR_STRING = GNOME_Gnumeric_VECTOR_TYPE_STRING,
GNM_VECTOR_AUTO = 99
} GnmGraphVectorType;
......
......@@ -1013,25 +1013,26 @@ popup_item_activate (GtkWidget *item, gpointer *user_data)
}
void
gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
GnumericPopupMenuHandler handler,
gpointer user_data,
int display_filter, int sensitive_filter,
GdkEventButton *event)
gnumeric_create_popup_menu_list (GSList *elements,
GnumericPopupMenuHandler handler,
gpointer user_data,
int display_filter,
int sensitive_filter,
GdkEventButton *event)
{
GtkWidget *menu, *item;
int i;
menu = gtk_menu_new ();
for (i = 0; elements [i].name != NULL; i++) {
char const * const name = elements [i].name;
char const * const pix_name = elements [i].pixmap;
for (; elements != NULL ; elements = elements->next) {
GnumericPopupMenuElement const *element = elements->data;
char const * const name = element->name;
char const * const pix_name = element->pixmap;
item = NULL;
if (elements [i].display_filter != 0 &&
!(elements [i].display_filter & display_filter))
if (element->display_filter != 0 &&
!(element->display_filter & display_filter))
continue;
if (name != NULL && *name != '\0') {
......@@ -1058,8 +1059,8 @@ gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
GTK_ACCEL_LOCKED);
}
if (elements [i].sensitive_filter != 0 &&
(elements [i].sensitive_filter & sensitive_filter))
if (element->sensitive_filter != 0 &&
(element->sensitive_filter & sensitive_filter))
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
} else {
item = gtk_menu_item_new ();
......@@ -1076,13 +1077,13 @@ gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
GTK_PIXMAP_MENU_ITEM (item),
pixmap);
}
if (elements [i].index != 0) {
if (element->index != 0) {
gtk_signal_connect (
GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (&popup_item_activate),
user_data);
gtk_object_set_data (
GTK_OBJECT (item), "descriptor", (gpointer)(elements + i));
GTK_OBJECT (item), "descriptor", (gpointer)(element));
gtk_object_set_data (
GTK_OBJECT (item), "handler", (gpointer)handler);
}
......@@ -1094,6 +1095,25 @@ gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
gnumeric_popup_menu (GTK_MENU (menu), event);
}
void
gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
GnumericPopupMenuHandler handler,
gpointer user_data,
int display_filter, int sensitive_filter,
GdkEventButton *event)
{
int i;
GSList *tmp = NULL;
for (i = 0; elements [i].name != NULL; i++)
tmp = g_slist_prepend (tmp, (gpointer)(elements + i));
tmp = g_slist_reverse (tmp);
gnumeric_create_popup_menu_list (tmp, handler, user_data,
display_filter, sensitive_filter, event);
g_slist_free (tmp);
}
/**
* color_combo_get_style_color :
*
......
......@@ -90,6 +90,13 @@ typedef struct {
typedef gboolean (*GnumericPopupMenuHandler) (GnumericPopupMenuElement const *e,
gpointer user_data);
void gnumeric_create_popup_menu_list (GSList *elements,
GnumericPopupMenuHandler handler,
gpointer user_data,
int display_filter,
int sensitive_filter,
GdkEventButton *event);
void gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
GnumericPopupMenuHandler handler,
gpointer user_data,
......
......@@ -966,7 +966,8 @@ radio_button_eval (Dependent *dep)
pos.eval.row = pos.eval.col = 0;
v = eval_expr (&pos, dep->expression, EVAL_STRICT);
if (!err) {
SheetWidgetRadioButton *swrb = DEP_TO_RADIO_BUTTON (dep);
/* FIXME : finish this when I have a better idea of a group */
/* SheetWidgetRadioButton *swrb = DEP_TO_RADIO_BUTTON (dep); */
}
}
......
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