Commit 5efadaf1 authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Arturo Espinosa

Enable the function wizard only if the --debug flag was passed.

1999-04-06  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/workbook.c: Enable the function wizard only if the --debug
	flag was passed.

	* src/dialog-function-wizard.c, src/dialog-function-select.c:
	Adapt to the rest of Gnumeric coding style.

	Use a different way of creating the GUI and controlling the
	interactions.

	* src/func.c, src/func.h (function_iterate_do_value): Use my
	indentation and coding style here.

	* src/dialog-cell-format.c (render_formated_version): Handle the
	case where the value might be NULL.
parent f103433a
1999-04-06 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/workbook.c: Enable the function wizard only if the --debug
flag was passed.
* src/dialog-function-wizard.c, src/dialog-function-select.c:
Adapt to the rest of Gnumeric coding style.
Use a different way of creating the GUI and controlling the
interactions.
* src/func.c, src/func.h (function_iterate_do_value): Use my
indentation and coding style here.
* src/dialog-cell-format.c (render_formated_version): Handle the
case where the value might be NULL.
* src/xml-io.c (createXmlSheet): New function. Used in an initial
pass over the XML file to load all of the Sheets defined there.
(readXmlWorkbook): Now this does two passes at loading the sheet:
the first pass creates the sheets, the second pass actually loads
the contents.
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_new): More sensible default
......
1999-04-06 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/workbook.c: Enable the function wizard only if the --debug
flag was passed.
* src/dialog-function-wizard.c, src/dialog-function-select.c:
Adapt to the rest of Gnumeric coding style.
Use a different way of creating the GUI and controlling the
interactions.
* src/func.c, src/func.h (function_iterate_do_value): Use my
indentation and coding style here.
* src/dialog-cell-format.c (render_formated_version): Handle the
case where the value might be NULL.
* src/xml-io.c (createXmlSheet): New function. Used in an initial
pass over the XML file to load all of the Sheets defined there.
(readXmlWorkbook): Now this does two passes at loading the sheet:
the first pass creates the sheets, the second pass actually loads
the contents.
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_new): More sensible default
......
1999-04-06 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/workbook.c: Enable the function wizard only if the --debug
flag was passed.
* src/dialog-function-wizard.c, src/dialog-function-select.c:
Adapt to the rest of Gnumeric coding style.
Use a different way of creating the GUI and controlling the
interactions.
* src/func.c, src/func.h (function_iterate_do_value): Use my
indentation and coding style here.
* src/dialog-cell-format.c (render_formated_version): Handle the
case where the value might be NULL.
* src/xml-io.c (createXmlSheet): New function. Used in an initial
pass over the XML file to load all of the Sheets defined there.
(readXmlWorkbook): Now this does two passes at loading the sheet:
the first pass creates the sheets, the second pass actually loads
the contents.
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_new): More sensible default
......
1999-04-06 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/workbook.c: Enable the function wizard only if the --debug
flag was passed.
* src/dialog-function-wizard.c, src/dialog-function-select.c:
Adapt to the rest of Gnumeric coding style.
Use a different way of creating the GUI and controlling the
interactions.
* src/func.c, src/func.h (function_iterate_do_value): Use my
indentation and coding style here.
* src/dialog-cell-format.c (render_formated_version): Handle the
case where the value might be NULL.
* src/xml-io.c (createXmlSheet): New function. Used in an initial
pass over the XML file to load all of the Sheets defined there.
(readXmlWorkbook): Now this does two passes at loading the sheet:
the first pass creates the sheets, the second pass actually loads
the contents.
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_new): More sensible default
......
AC_INIT(src/gnumeric.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gnumeric,0.22)
AM_INIT_AUTOMAKE(gnumeric,0.23)
AM_MAINTAINER_MODE
AM_ACLOCAL_INCLUDE(macros)
......
1999-04-06 Miguel de Icaza <miguel@nuclecu.unam.mx>
* csv-io.c (csv_cleanup_plugin): Return proper value.
1999-02-22 Tim Mooney <mooney@dogbert.cc.ndsu.nodak.edu>
* csv-io.c (insert_csv_cell): Do not test pointer for > 0, but for
......
......@@ -213,6 +213,8 @@ static int
csv_cleanup_plugin (PluginData *pd)
{
file_format_unregister_save (csv_read_workbook);
return TRUE;
}
static int
......
......@@ -27,8 +27,10 @@ cell_eval (Cell *cell)
cell->row->pos,
&error_msg);
if (cell->value)
if (cell->value){
value_release (cell->value);
cell->value = NULL;
}
if (v == NULL){
cell_set_rendered_text (cell, error_msg);
......
......@@ -147,6 +147,9 @@ render_formated_version (char *format)
Value *v = first_cell->value;
char *str;
if (v == NULL)
return;
style_format = style_format_new (format);
str = format_value (style_format, v, NULL);
......
......@@ -16,186 +16,221 @@
#include "func.h"
typedef struct {
GtkWidget *widget, *dlg ;
GtkBox *dialog_box ;
Workbook *wb ;
GPtrArray *cats ;
GtkCList *function_list ;
GtkCList *cl_funcs ;
GtkCList *cl_cats ;
int selected_func ; /* An Entry */
int selected_cat ; /* An Array */
} STATE ;
static void function_select_create (STATE *state) ;
GtkWidget *widget, *dlg;
GtkBox *dialog_box;
Workbook *wb;
GPtrArray *cats;
GtkCList *function_list;
GtkCList *cl_funcs;
GtkCList *cl_cats;
int selected_func; /* An Entry */
int selected_cat; /* An Array */
} SelectorState;
static void function_select_create (SelectorState *state);
static void
category_select_row (GtkCList *clist, gint row, gint col,
GdkEvent *event, STATE *state)
GdkEvent *event, SelectorState *state)
{
state->selected_cat = row ;
/* printf ("Row %d selected\n", row) ; */
state->selected_cat = row;
/* printf ("Row %d selected\n", row); */
gtk_container_remove (GTK_CONTAINER(state->dialog_box),
state->widget) ;
state->selected_func = 0 ;
function_select_create (state) ;
/* gtk_clist_select_row (state->cl_cats, row, 0) ; */
gtk_widget_show_all (GTK_WIDGET(state->dialog_box)) ;
}
static void
function_select_row (GtkCList *clist, gint row, gint col,
GdkEvent *event, STATE *state)
{
/* printf ("Function %d\n", row) ; */
if (state->selected_func == row) {
/* printf ("Double click\n") ; */
gtk_signal_emit_by_name (GTK_OBJECT(state->dlg),
"clicked", 0) ;
}
state->selected_func = row ;
gtk_container_remove (GTK_CONTAINER(state->dialog_box),
state->widget) ;
function_select_create (state) ;
/* gtk_clist_select_row (state->cl_funcs, row, 0) ; */
gtk_widget_show_all (GTK_WIDGET(state->dialog_box)) ;
state->widget);
state->selected_func = 0;
function_select_create (state);
/* gtk_clist_select_row (state->cl_cats, row, 0); */
gtk_widget_show_all (GTK_WIDGET(state->dialog_box));
}
static GtkWidget *
create_description (FunctionDefinition *fd)
{
GtkBox *vbox ;
TOKENISED_HELP *tok ;
#define TEXT_WIDTH 80
GtkBox *vbox;
TokenizedHelp *tok;
tok = tokenised_help_new (fd) ;
tok = tokenized_help_new (fd);
vbox = GTK_BOX (gtk_vbox_new (0, 0)) ;
{ /* Syntax label */
vbox = GTK_BOX (gtk_vbox_new (0, 0));
/* Syntax label */
{
GtkLabel *label =
GTK_LABEL(gtk_label_new (tokenised_help_find (tok, "SYNTAX"))) ;
GTK_LABEL(gtk_label_new (tokenized_help_find (tok, "SYNTAX")));
gtk_box_pack_start (vbox, GTK_WIDGET(label),
TRUE, TRUE, 0) ;
TRUE, TRUE, 0);
}
{ /* Description */
GtkText *text ;
char *txt = tokenised_help_find (tok, "DESCRIPTION") ;
text = GTK_TEXT (gtk_text_new (NULL, NULL)) ;
gtk_text_set_editable (text, FALSE) ;
/* Description */
{
GtkText *text;
char *txt = tokenized_help_find (tok, "DESCRIPTION");
text = GTK_TEXT (gtk_text_new (NULL, NULL));
gtk_text_set_word_wrap (text, TRUE);
gtk_text_set_editable (text, FALSE);
gtk_text_insert (text, NULL, NULL, NULL,
txt, strlen(txt)) ;
txt, strlen(txt));
gtk_box_pack_start (vbox, GTK_WIDGET(text),
TRUE, TRUE, 0) ;
TRUE, TRUE, 0);
}
tokenised_help_destroy (tok) ;
return GTK_WIDGET (vbox) ;
tokenized_help_destroy (tok);
return GTK_WIDGET (vbox);
}
static void
function_categories_fill (SelectorState *selector_state)
{
GtkCList *cl = selector_state->cl_cats;
int lp;
for (lp = 0; lp < selector_state->cats->len; lp++){
FunctionCategory *fc;
gchar *cols [1];
fc = g_ptr_array_index (selector_state->cats, lp);
cols[0] = fc->name;
gtk_clist_append (cl, cols);
if (lp == selector_state->selected_cat)
gtk_clist_select_row (cl, lp, 0);
}
}
static void
function_select_create (STATE *state)
function_definition_update (SelectorState *selector_state)
{
GtkWidget *box, *vbox ;
GtkWidget *scroll ;
GtkAdjustment *hadj ;
FunctionDefinition *fd = NULL ;
int lp, max ;
GtkCList *cl ;
FUNCTION_CATEGORY *cat = g_ptr_array_index (state->cats, state->selected_cat) ;
#define USIZE_WIDTH 100
#define USIZE_HEIGHT 150
vbox = gtk_vbox_new (0, 0) ;
box = gtk_hbox_new (0, 0) ;
{ /* The Category List */
state->cl_cats = cl = GTK_CLIST (gtk_clist_new(1)) ;
gtk_clist_column_titles_hide(cl) ;
FunctionCategory *cat;
FunctionDefinition *fn;
GtkCList *cl;
FunctionDefinition *fd = NULL;
int lp, max;
cl = selector_state->cl_funcs;
gtk_clist_freeze (cl);
gtk_clist_clear (cl);
cat = g_ptr_array_index (selector_state->cats, selector_state->selected_cat);
fn = cat->functions;
max = 0;
for (lp = 0; fn [lp].name; lp++){
gchar *cols [1];
cols [0] = fn [lp].name;
gtk_clist_append (cl, cols);
for (lp=0;lp<state->cats->len;lp++) {
gchar *cols[1] ;
FUNCTION_CATEGORY *fc = g_ptr_array_index (state->cats, lp) ;
cols[0] = fc->name ;
gtk_clist_append (cl, cols) ;
if (lp == state->selected_cat)
gtk_clist_select_row (cl, lp, 0) ;
if (lp == selector_state->selected_func){
fd = &fn [lp];
gtk_clist_select_row (cl, lp, 0);
}
gtk_clist_set_selection_mode (cl,GTK_SELECTION_SINGLE) ;
max++;
}
gtk_clist_thaw (cl);
}
static void
function_select_row (GtkCList *clist, gint row, gint col,
GdkEvent *event, SelectorState *selector_state)
{
if (event->type == GDK_2BUTTON_PRESS){
gtk_signal_emit_by_name (GTK_OBJECT (selector_state->dlg),
"clicked", 0);
}
selector_state->selected_func = row;
gtk_widget_show_all (GTK_WIDGET (selector_state->dialog_box));
function_definition_update (selector_state);;
}
#define USIZE_WIDTH 100
#define USIZE_HEIGHT 150
static void
function_select_create (SelectorState *selector_state)
{
GtkWidget *box, *vbox;
GtkWidget *scroll;
GtkAdjustment *hadj;
GtkCList *cl;
vbox = gtk_vbox_new (0, 0);
box = gtk_hbox_new (0, 0);
/* The Category List */
{
selector_state->cl_cats = cl = GTK_CLIST (gtk_clist_new (1));
gtk_clist_column_titles_hide (cl);
function_categories_fill (selector_state);
gtk_clist_set_selection_mode (cl,GTK_SELECTION_SINGLE);
gtk_signal_connect (GTK_OBJECT (cl), "select_row",
GTK_SIGNAL_FUNC (category_select_row),
state);
gtk_widget_set_usize (GTK_WIDGET(cl), USIZE_WIDTH, USIZE_HEIGHT) ;
selector_state);
gtk_widget_set_usize (GTK_WIDGET(cl), USIZE_WIDTH, USIZE_HEIGHT);
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET(cl));
gtk_box_pack_start (GTK_BOX(box), GTK_WIDGET(scroll),
TRUE, TRUE, 0) ;
TRUE, TRUE, 0);
}
{ /* The Function List */
FunctionDefinition *fn = cat->functions ;
state->cl_funcs = cl = GTK_CLIST (gtk_clist_new(1)) ;
gtk_clist_column_titles_hide(cl) ;
max = 0 ;
for (lp = 0; fn[lp].name; lp++) {
gchar *cols[1] ;
cols[0] = fn[lp].name ;
gtk_clist_append (cl, cols) ;
if (lp == state->selected_func) {
fd = &fn[lp] ;
gtk_clist_select_row (cl, lp, 0) ;
}
max++ ;
}
gtk_clist_set_selection_mode (cl,GTK_SELECTION_SINGLE) ;
/* The Function List */
{
selector_state->cl_funcs = cl = GTK_CLIST (gtk_clist_new(1));
gtk_clist_column_titles_hide (cl);
function_definition_update (selector_state);
gtk_clist_set_selection_mode (cl,GTK_SELECTION_SINGLE);
gtk_signal_connect (GTK_OBJECT (cl), "select_row",
GTK_SIGNAL_FUNC (function_select_row),
state);
gtk_widget_set_usize (GTK_WIDGET(cl), USIZE_WIDTH, USIZE_HEIGHT) ;
selector_state);
gtk_widget_set_usize (GTK_WIDGET (cl), USIZE_WIDTH, USIZE_HEIGHT);
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET(cl));
gtk_box_pack_start (GTK_BOX(box), GTK_WIDGET(scroll),
TRUE, TRUE, 0) ;
gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET (cl));
gtk_box_pack_start (GTK_BOX (box), scroll, TRUE, TRUE, 0);
}
gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(box),
TRUE, TRUE, 0) ;
gtk_box_pack_start (GTK_BOX(vbox), box, TRUE, TRUE, 0);
#if 0
{
GtkWidget *description ;
GtkWidget *description;
if (fd && fd->help) {
description = create_description (fd) ;
if (fd && fd->help){
description = create_description (fd);
gtk_box_pack_start (GTK_BOX(vbox), description,
TRUE, TRUE, 0) ;
TRUE, TRUE, 0);
}
}
#endif
selector_state->widget = vbox;
gtk_box_pack_start (selector_state->dialog_box, vbox,
FALSE, FALSE, 0);
state->widget = vbox ;
gtk_box_pack_start (state->dialog_box, vbox,
FALSE, FALSE, 0) ;
gtk_widget_show_all (GTK_WIDGET(state->dialog_box)) ;
gtk_widget_show_all (GTK_WIDGET(selector_state->dialog_box));
/* FIXME: Something to keep currently selected function in scope
needs to be done.
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scroll)) ;
gtk_adjustment_set_value (hadj, ((float)state->selected_func)) ;
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scroll));
gtk_adjustment_set_value (hadj, ((float)SelectorState->selected_func));
gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (scroll),
hadj) ;
max=state->cats->len ;
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scroll)) ;
gtk_adjustment_set_value (hadj, ((float)state->selected_cat)) ;
hadj);
max=SelectorState->cats->len;
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scroll));
gtk_adjustment_set_value (hadj, ((float)SelectorState->selected_cat));
gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (scroll),
hadj) ; */
hadj); */
}
......@@ -205,37 +240,37 @@ function_select_create (STATE *state)
FunctionDefinition *
dialog_function_select (Workbook *wb)
{
GtkWidget *dialog ;
STATE state ;
FunctionDefinition *ans = NULL ;
GtkWidget *dialog;
SelectorState selector_state;
FunctionDefinition *ans = NULL;
g_return_val_if_fail (wb, NULL) ;
g_return_val_if_fail (wb, NULL);
state.wb = wb ;
state.cats = get_function_categories () ;
state.selected_cat = 0 ;
state.selected_func = 0 ;
selector_state.wb = wb;
selector_state.cats = function_categories_get ();
selector_state.selected_cat = 0;
selector_state.selected_func = 0;
dialog = gnome_dialog_new (_("Formula Selection"),
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
gtk_window_set_policy (GTK_WINDOW (dialog), TRUE, TRUE, TRUE);
gnome_dialog_set_parent (GNOME_DIALOG (dialog),
GTK_WINDOW (wb->toplevel)) ;
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE) ;
GTK_WINDOW (wb->toplevel));
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
state.dlg = dialog ;
state.dialog_box = GTK_BOX(GNOME_DIALOG (dialog)->vbox) ;
selector_state.dlg = dialog;
selector_state.dialog_box = GTK_BOX(GNOME_DIALOG (dialog)->vbox);
function_select_create (&state) ;
function_select_create (&selector_state);
if (gnome_dialog_run (GNOME_DIALOG(dialog)) == 0) {
FUNCTION_CATEGORY *cat = g_ptr_array_index (state.cats,
state.selected_cat) ;
ans = &cat->functions[state.selected_func] ;
if (gnome_dialog_run (GNOME_DIALOG(dialog)) == 0){
FunctionCategory *cat = g_ptr_array_index (selector_state.cats,
selector_state.selected_cat);
ans = &cat->functions[selector_state.selected_func];
}
gtk_object_destroy (GTK_OBJECT (dialog));
return ans ;
return ans;
}
......@@ -18,213 +18,213 @@
#define INPUTS_FOR_MULTI_ARG 6
typedef struct {
GtkBox *dialog_box ;
GtkWidget *widget ;
Workbook *wb ;
FunctionDefinition *fd ;
GPtrArray *args ;
TOKENISED_HELP *tok ;
} STATE ;
GtkBox *dialog_box;
GtkWidget *widget;
Workbook *wb;
FunctionDefinition *fd;
GPtrArray *args;
TokenizedHelp *tok;
} State;
static GtkWidget *
create_description (FunctionDefinition *fd)
{
GtkBox *vbox ;
TOKENISED_HELP *tok ;
GtkBox *vbox;
TokenizedHelp *tok;
#define TEXT_WIDTH 80
tok = tokenised_help_new (fd) ;
tok = tokenized_help_new (fd);
vbox = GTK_BOX (gtk_vbox_new (0, 0)) ;
vbox = GTK_BOX (gtk_vbox_new (0, 0));
{ /* Syntax label */
GtkLabel *label =
GTK_LABEL(gtk_label_new (tokenised_help_find (tok, "SYNTAX"))) ;
GTK_LABEL(gtk_label_new (tokenized_help_find (tok, "SYNTAX")));
gtk_box_pack_start (vbox, GTK_WIDGET(label),
TRUE, TRUE, 0) ;
TRUE, TRUE, 0);
}
{ /* Description */
GtkText *text ;
char *txt = tokenised_help_find (tok, "DESCRIPTION") ;
text = GTK_TEXT (gtk_text_new (NULL, NULL)) ;
gtk_text_set_editable (text, FALSE) ;
GtkText *text;
char *txt = tokenized_help_find (tok, "DESCRIPTION");
text = GTK_TEXT (gtk_text_new (NULL, NULL));
gtk_text_set_editable (text, FALSE);
gtk_text_insert (text, NULL, NULL, NULL,
txt, strlen(txt)) ;
txt, strlen(txt));
gtk_box_pack_start (vbox, GTK_WIDGET(text),
TRUE, TRUE, 0) ;
TRUE, TRUE, 0);
}
tokenised_help_destroy (tok) ;
return GTK_WIDGET (vbox) ;
tokenized_help_destroy (tok);
return GTK_WIDGET (vbox);
}
typedef struct {
gchar *arg_name ;
gboolean optional ;
gchar type ;
GtkEntry *entry ;
Workbook *wb ;
} ARG_DATA ;