Commit 672ded42 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Begin the Name menu.


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

	* src/workbook.c : Begin the Name menu.

	* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
	(workbook_finish_editing) : Use here.
	(workbook_start_editing_at_cursor) : And here.
	(workbook_edit_attach_guru) : And here.
	(workbook_edit_detach_guru) : And here.
	(workbook_edit_entry_redirect_p) : New function.

	* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
	  not selecting a region ignore clicks.
	(item_grid_event) : Ditto.

	* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
	  possible to have a guru up without selecting regions.

	* src/expr-name.c (expr_name_list) : Doh!

2000-07-02  Jody Goldberg <jgoldberg@home.com>

	* src/expr.c (expr_rewrite) : Names can contain relative references,
	  we need to check them too.

	* src/parser.y (exp) : Add production for sheet specific names.
	  eg Sheet2!name

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

	* src/functions/fn-string.c (parse_search_strin) : Use g_strdup.
parent 8243cd20
...@@ -73,11 +73,18 @@ Dialogs ...@@ -73,11 +73,18 @@ Dialogs
: Editing nested functions. How best to express this. : Editing nested functions. How best to express this.
: Switching between multiple function at the same level. : Switching between multiple function at the same level.
: Better communication and handling of parse errors. : Better communication and handling of parse errors.
- Name Guru
: Ick. This is very ugly.
Sorting
-------
- Hidden rows/cols should not be sorted.
Function Breakage Function Breakage
----------------- -----------------
- Index : does not support 0,0 or reference syntax. - Index : does not support 0,0 or reference syntax.
- ftest : Needs auditing. All calls to eval_pos_init_cellref are questionable. - ftest : Needs auditing. All calls to eval_pos_init_cellref are questionable.
- address : This code is a duplicate. Have the function use the standard routines.
Printing Printing
-------- --------
...@@ -87,4 +94,4 @@ Printing ...@@ -87,4 +94,4 @@ Printing
Widget polishing Widget polishing
---------------- ----------------
- Add row (rows ?) for custom colours in the color combo dialog. - Selection for the undo/redo combo is ugly
2000-07-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c : Begin the Name menu.
* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
(workbook_finish_editing) : Use here.
(workbook_start_editing_at_cursor) : And here.
(workbook_edit_attach_guru) : And here.
(workbook_edit_detach_guru) : And here.
(workbook_edit_entry_redirect_p) : New function.
* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
not selecting a region ignore clicks.
(item_grid_event) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
possible to have a guru up without selecting regions.
* src/expr-name.c (expr_name_list) : Doh!
2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c: Implemented `Histogram' tool (mostly). * src/analysis-tools.c: Implemented `Histogram' tool (mostly).
...@@ -27,6 +47,9 @@ ...@@ -27,6 +47,9 @@
2000-07-02 Jody Goldberg <jgoldberg@home.com> 2000-07-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (expr_rewrite) : Names can contain relative references,
we need to check them too.
* src/parser.y (exp) : Add production for sheet specific names. * src/parser.y (exp) : Add production for sheet specific names.
eg Sheet2!name eg Sheet2!name
......
2000-07-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c : Begin the Name menu.
* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
(workbook_finish_editing) : Use here.
(workbook_start_editing_at_cursor) : And here.
(workbook_edit_attach_guru) : And here.
(workbook_edit_detach_guru) : And here.
(workbook_edit_entry_redirect_p) : New function.
* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
not selecting a region ignore clicks.
(item_grid_event) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
possible to have a guru up without selecting regions.
* src/expr-name.c (expr_name_list) : Doh!
2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c: Implemented `Histogram' tool (mostly). * src/analysis-tools.c: Implemented `Histogram' tool (mostly).
...@@ -27,6 +47,9 @@ ...@@ -27,6 +47,9 @@
2000-07-02 Jody Goldberg <jgoldberg@home.com> 2000-07-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (expr_rewrite) : Names can contain relative references,
we need to check them too.
* src/parser.y (exp) : Add production for sheet specific names. * src/parser.y (exp) : Add production for sheet specific names.
eg Sheet2!name eg Sheet2!name
......
2000-07-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c : Begin the Name menu.
* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
(workbook_finish_editing) : Use here.
(workbook_start_editing_at_cursor) : And here.
(workbook_edit_attach_guru) : And here.
(workbook_edit_detach_guru) : And here.
(workbook_edit_entry_redirect_p) : New function.
* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
not selecting a region ignore clicks.
(item_grid_event) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
possible to have a guru up without selecting regions.
* src/expr-name.c (expr_name_list) : Doh!
2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c: Implemented `Histogram' tool (mostly). * src/analysis-tools.c: Implemented `Histogram' tool (mostly).
...@@ -27,6 +47,9 @@ ...@@ -27,6 +47,9 @@
2000-07-02 Jody Goldberg <jgoldberg@home.com> 2000-07-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (expr_rewrite) : Names can contain relative references,
we need to check them too.
* src/parser.y (exp) : Add production for sheet specific names. * src/parser.y (exp) : Add production for sheet specific names.
eg Sheet2!name eg Sheet2!name
......
2000-07-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c : Begin the Name menu.
* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
(workbook_finish_editing) : Use here.
(workbook_start_editing_at_cursor) : And here.
(workbook_edit_attach_guru) : And here.
(workbook_edit_detach_guru) : And here.
(workbook_edit_entry_redirect_p) : New function.
* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
not selecting a region ignore clicks.
(item_grid_event) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
possible to have a guru up without selecting regions.
* src/expr-name.c (expr_name_list) : Doh!
2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c: Implemented `Histogram' tool (mostly). * src/analysis-tools.c: Implemented `Histogram' tool (mostly).
...@@ -27,6 +47,9 @@ ...@@ -27,6 +47,9 @@
2000-07-02 Jody Goldberg <jgoldberg@home.com> 2000-07-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (expr_rewrite) : Names can contain relative references,
we need to check them too.
* src/parser.y (exp) : Add production for sheet specific names. * src/parser.y (exp) : Add production for sheet specific names.
eg Sheet2!name eg Sheet2!name
......
2000-07-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c : Begin the Name menu.
* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
(workbook_finish_editing) : Use here.
(workbook_start_editing_at_cursor) : And here.
(workbook_edit_attach_guru) : And here.
(workbook_edit_detach_guru) : And here.
(workbook_edit_entry_redirect_p) : New function.
* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
not selecting a region ignore clicks.
(item_grid_event) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
possible to have a guru up without selecting regions.
* src/expr-name.c (expr_name_list) : Doh!
2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c: Implemented `Histogram' tool (mostly). * src/analysis-tools.c: Implemented `Histogram' tool (mostly).
...@@ -27,6 +47,9 @@ ...@@ -27,6 +47,9 @@
2000-07-02 Jody Goldberg <jgoldberg@home.com> 2000-07-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (expr_rewrite) : Names can contain relative references,
we need to check them too.
* src/parser.y (exp) : Add production for sheet specific names. * src/parser.y (exp) : Add production for sheet specific names.
eg Sheet2!name eg Sheet2!name
......
2000-07-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c : Begin the Name menu.
* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
(workbook_finish_editing) : Use here.
(workbook_start_editing_at_cursor) : And here.
(workbook_edit_attach_guru) : And here.
(workbook_edit_detach_guru) : And here.
(workbook_edit_entry_redirect_p) : New function.
* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
not selecting a region ignore clicks.
(item_grid_event) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
possible to have a guru up without selecting regions.
* src/expr-name.c (expr_name_list) : Doh!
2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c: Implemented `Histogram' tool (mostly). * src/analysis-tools.c: Implemented `Histogram' tool (mostly).
...@@ -27,6 +47,9 @@ ...@@ -27,6 +47,9 @@
2000-07-02 Jody Goldberg <jgoldberg@home.com> 2000-07-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (expr_rewrite) : Names can contain relative references,
we need to check them too.
* src/parser.y (exp) : Add production for sheet specific names. * src/parser.y (exp) : Add production for sheet specific names.
eg Sheet2!name eg Sheet2!name
......
2000-07-03 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c : Begin the Name menu.
* src/workbook-edit.c (workbook_edit_set_sensitive) : New function.
(workbook_finish_editing) : Use here.
(workbook_start_editing_at_cursor) : And here.
(workbook_edit_attach_guru) : And here.
(workbook_edit_detach_guru) : And here.
(workbook_edit_entry_redirect_p) : New function.
* src/item-grid.c (item_grid_button_1) : If we have a guru up, but are
not selecting a region ignore clicks.
(item_grid_event) : Ditto.
* src/gnumeric-sheet.c (gnumeric_sheet_can_select_expr_range) : It is
possible to have a guru up without selecting regions.
* src/expr-name.c (expr_name_list) : Doh!
2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi> 2000-07-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c: Implemented `Histogram' tool (mostly). * src/analysis-tools.c: Implemented `Histogram' tool (mostly).
...@@ -27,6 +47,9 @@ ...@@ -27,6 +47,9 @@
2000-07-02 Jody Goldberg <jgoldberg@home.com> 2000-07-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (expr_rewrite) : Names can contain relative references,
we need to check them too.
* src/parser.y (exp) : Add production for sheet specific names. * src/parser.y (exp) : Add production for sheet specific names.
eg Sheet2!name eg Sheet2!name
......
...@@ -1184,8 +1184,7 @@ parse_search_string(gchar *find_str) ...@@ -1184,8 +1184,7 @@ parse_search_string(gchar *find_str)
} else if (*find_str == '?' || *find_str == '*') { } else if (*find_str == '?' || *find_str == '*') {
buf[i] = '\0'; buf[i] = '\0';
search_cond = g_new(string_search_t, 1); search_cond = g_new(string_search_t, 1);
search_cond->str = g_new(gchar, strlen(buf)+1); search_cond->str = g_strdup (buf);
strcpy(search_cond->str, buf);
search_cond->min_skip = qmarks; search_cond->min_skip = qmarks;
search_cond->wildcard_prefix = wildcard; search_cond->wildcard_prefix = wildcard;
conditions = g_slist_append(conditions, search_cond); conditions = g_slist_append(conditions, search_cond);
...@@ -1198,8 +1197,7 @@ parse_search_string(gchar *find_str) ...@@ -1198,8 +1197,7 @@ parse_search_string(gchar *find_str)
} }
buf[i] = '\0'; buf[i] = '\0';
search_cond = g_new(string_search_t, 1); search_cond = g_new(string_search_t, 1);
search_cond->str = g_new(gchar, strlen(buf)+1); search_cond->str = g_strdup (buf);
strcpy(search_cond->str, buf);
search_cond->min_skip = qmarks; search_cond->min_skip = qmarks;
search_cond->wildcard_prefix = wildcard; search_cond->wildcard_prefix = wildcard;
conditions = g_slist_append(conditions, search_cond); conditions = g_slist_append(conditions, search_cond);
......
/** /* vim: set sw=8: */
* dialog-summary.c: Implements the summary info stuff
/*
* dialog-define-name.c: Edit named regions.
* *
* Author: * Author:
* Michael Meeks <michael@imaginator.com> * Jody Goldberg <jgoldberg@home.com>
* * Michael Meeks <michael@imaginator.com>
**/ */
#include <config.h> #include <config.h>
#include <gnome.h> #include <gnome.h>
#include <glade/glade.h> #include <glade/glade.h>
...@@ -35,55 +37,33 @@ typedef struct { ...@@ -35,55 +37,33 @@ typedef struct {
} NameGuruState; } NameGuruState;
static void static void
update_edit (NameGuruState *state) cb_name_guru_select_name (GtkWidget *list, NameGuruState *state)
{ {
gint i = state->selected; NamedExpression *expr_name;
NamedExpression *expr_name; GList *sel = GTK_LIST(list)->selection;
Sheet *sheet; char *txt;
char *txt;
sheet = state->wb->current_sheet;
g_return_if_fail (sheet != NULL);
expr_name = g_list_nth (state->expr_names, i)->data;
if (expr_name->name && expr_name->name->str)
gtk_entry_set_text (state->name, expr_name->name->str);
else
gtk_entry_set_text (state->name, "");
txt = expr_name_value (expr_name);
gtk_entry_set_text (state->value, txt);
g_free (txt);
}
static void
cb_name_guru_select_name (GtkWidget *w, NameGuruState *state)
{
guint i = 0;
GList *sel = GTK_LIST(w)->selection;
GList *p = state->expr_names;
NamedExpression *name;
if (sel == NULL) if (sel == NULL)
return; return;
g_return_if_fail (sel->data != NULL); g_return_if_fail (sel->data != NULL);
name = gtk_object_get_data (GTK_OBJECT (sel->data), LIST_KEY); expr_name = gtk_object_get_data (GTK_OBJECT (sel->data), LIST_KEY);
while (p) { g_return_if_fail (expr_name->name != NULL);
if (p->data == name) { g_return_if_fail (expr_name->name->str != NULL);
state->selected = i;
update_edit (state); /* Display the name */
return; gtk_entry_set_text (state->name, expr_name->name->str);
}
i++; /* Display the value */
p = g_list_next (p); txt = expr_name_value (expr_name);
} gtk_entry_set_text (state->value, txt);
g_free (txt);
} }
static void static void
cb_name_guru_populate_list (NameGuruState *state) name_guru_populate_list (NameGuruState *state)
{ {
GList *names; GList *names;
GtkContainer *list; GtkContainer *list;
...@@ -178,17 +158,29 @@ cb_name_guru_add (NameGuruState *state) ...@@ -178,17 +158,29 @@ cb_name_guru_add (NameGuruState *state)
} }
gtk_list_clear_items (state->list, 0, -1); gtk_list_clear_items (state->list, 0, -1);
cb_name_guru_populate_list (state); name_guru_populate_list (state);
return TRUE; return TRUE;
} }
static void
cb_name_guru_value_focus (GtkWidget *w, GdkEventFocus *ev, NameGuruState *state)
{
if (w == state->value) {
workbook_set_entry (state->wb, state->value);
workbook_edit_select_absolute (state->wb);
} else
workbook_set_entry (state->wb, NULL);
}
static void static void
cb_name_guru_clicked (GtkWidget *button, NameGuruState *state) cb_name_guru_clicked (GtkWidget *button, NameGuruState *state)
{ {
if (state->dialog == NULL) if (state->dialog == NULL)
return; return;
workbook_set_entry (state->wb, NULL);
if (button == state->delete_button) { if (button == state->delete_button) {
cb_name_guru_remove (NULL, state); cb_name_guru_remove (NULL, state);
return; return;
...@@ -255,26 +247,23 @@ name_guru_init (NameGuruState *state) ...@@ -255,26 +247,23 @@ name_guru_init (NameGuruState *state)
state->add_button = name_guru_init_button (state, "add_button"); state->add_button = name_guru_init_button (state, "add_button");
state->delete_button = name_guru_init_button (state, "delete_button"); state->delete_button = name_guru_init_button (state, "delete_button");
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_EDITABLE(state->name));
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_EDITABLE (state->value));
cb_name_guru_populate_list (state);
gtk_signal_connect (GTK_OBJECT (state->list), "selection_changed", gtk_signal_connect (GTK_OBJECT (state->list), "selection_changed",
GTK_SIGNAL_FUNC (cb_name_guru_select_name), state); GTK_SIGNAL_FUNC (cb_name_guru_select_name), state);
gtk_signal_connect (GTK_OBJECT (state->name), "focus-in-event",
GTK_SIGNAL_FUNC (cb_name_guru_value_focus), state);
gtk_signal_connect (GTK_OBJECT (state->value), "focus-in-event",
GTK_SIGNAL_FUNC (cb_name_guru_value_focus), state);
gtk_signal_connect (GTK_OBJECT (state->dialog), "destroy", gtk_signal_connect (GTK_OBJECT (state->dialog), "destroy",
GTK_SIGNAL_FUNC (cb_name_guru_destroy), GTK_SIGNAL_FUNC (cb_name_guru_destroy), state);
state);
gtk_window_set_transient_for (GTK_WINDOW (state->dialog), gtk_window_set_transient_for (GTK_WINDOW (state->dialog),
GTK_WINDOW (state->wb->toplevel)); GTK_WINDOW (state->wb->toplevel));
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_EDITABLE(state->name));
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_EDITABLE (state->value));
workbook_set_entry (state->wb, state->value);
workbook_edit_attach_guru (state->wb, state->dialog); workbook_edit_attach_guru (state->wb, state->dialog);
workbook_edit_select_absolute (state->wb);
return FALSE; return FALSE;
} }
...@@ -293,5 +282,6 @@ dialog_define_names (Workbook *wb) ...@@ -293,5 +282,6 @@ dialog_define_names (Workbook *wb)
return; return;
} }
name_guru_populate_list (state);
gtk_widget_show (state->dialog); gtk_widget_show (state->dialog);
} }
...@@ -290,10 +290,10 @@ expr_name_list (Workbook *wb, Sheet *sheet, gboolean builtins_too) ...@@ -290,10 +290,10 @@ expr_name_list (Workbook *wb, Sheet *sheet, gboolean builtins_too)
l = g_list_copy (sheet->names); l = g_list_copy (sheet->names);
if (wb != NULL && wb->names) if (wb != NULL && wb->names)
l = g_list_append (l, g_list_copy (wb->names)); l = g_list_concat (l, g_list_copy (wb->names));
if (builtins_too && global_names != NULL) if (builtins_too && global_names != NULL)
l = g_list_append (l, g_list_copy (global_names)); l = g_list_concat (l, g_list_copy (global_names));
return l; return l;
} }
......
...@@ -1493,6 +1493,15 @@ expr_rewrite (ExprTree const *expr, ...@@ -1493,6 +1493,15 @@ expr_rewrite (ExprTree const *expr,
} }
case OPER_NAME: case OPER_NAME:
if (!expr->name.name->builtin) {
/* Do NOT rewrite the name. Just invalidate the use of the name */
ExprTree *tmp = expr_rewrite (expr->name.name->t.expr_tree, rwinfo);
if (tmp != NULL) {
expr_tree_unref (tmp);
return expr_tree_new_constant (
value_new_error (NULL, gnumeric_err_REF));
}
}
return NULL; return NULL;
case OPER_VAR: case OPER_VAR:
......
...@@ -1184,8 +1184,7 @@ parse_search_string(gchar *find_str) ...@@ -1184,8 +1184,7 @@ parse_search_string(gchar *find_str)
} else if (*find_str == '?' || *find_str == '*') { } else if (*find_str == '?' || *find_str == '*') {
buf[i] = '\0'; buf[i] = '\0';
search_cond = g_new(string_search_t, 1); search_cond = g_new(string_search_t, 1);
search_cond->str = g_new(gchar, strlen(buf)+1); search_cond->str = g_strdup (buf);
strcpy(search_cond->str, buf);
search_cond->min_skip = qmarks; search_cond->min_skip = qmarks;
search_cond->wildcard_prefix = wildcard; search_cond->wildcard_prefix = wildcard;
conditions = g_slist_append(conditions, search_cond); conditions = g_slist_append(conditions, search_cond);
...@@ -1198,8 +1197,7 @@ parse_search_string(gchar *find_str) ...@@ -1198,8 +1197,7 @@ parse_search_string(gchar *find_str)
} }
buf[i] = '\0'; buf[i] = '\0';
search_cond = g_new(string_search_t, 1); search_cond = g_new(string_search_t, 1);
search_cond->str = g_new(gchar, strlen(buf)+1); search_cond->str = g_strdup (buf);
strcpy(search_cond->str, buf);
search_cond->min_skip = qmarks; search_cond->min_skip = qmarks;
search_cond->wildcard_prefix = wildcard; search_cond->wildcard_prefix = wildcard;
conditions = g_slist_append(conditions, search_cond); conditions = g_slist_append(conditions, search_cond);
......
...@@ -196,7 +196,7 @@ gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet) ...@@ -196,7 +196,7 @@ gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet)
g_return_val_if_fail (GNUMERIC_IS_SHEET (gsheet), FALSE); g_return_val_if_fail (GNUMERIC_IS_SHEET (gsheet), FALSE);
wb = gsheet->sheet_view->sheet->workbook; wb = gsheet->sheet_view->sheet->workbook;
if (workbook_edit_has_guru (wb)) if (workbook_edit_entry_redirect_p (wb))
return TRUE; return TRUE;
if (!wb->editing) if (!wb->editing)
......
...@@ -196,7 +196,7 @@ gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet) ...@@ -196,7 +196,7 @@ gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet)
g_return_val_if_fail (GNUMERIC_IS_SHEET (gsheet), FALSE); g_return_val_if_fail (GNUMERIC_IS_SHEET (gsheet), FALSE);
wb = gsheet->sheet_view->sheet->workbook; wb = gsheet->sheet_view->sheet->workbook;
if (workbook_edit_has_guru (wb)) if (workbook_edit_entry_redirect_p (wb))
return TRUE; return TRUE;
if (!wb->editing) if (!wb->editing)
......
...@@ -674,6 +674,10 @@ item_grid_button_1 (Sheet *sheet, GdkEvent *event, ItemGrid *item_grid, int col, ...@@ -674,6 +674,10 @@ item_grid_button_1 (Sheet *sheet, GdkEvent *event, ItemGrid *item_grid, int col,
return 1; return 1;
} }
/* While a guru is up ignore clicks */
if (workbook_edit_has_guru (sheet->workbook))
return 1;
/* /*
* This was a regular click on a cell on the spreadsheet. Select it. * This was a regular click on a cell on the spreadsheet. Select it.
*/ */
...@@ -865,6 +869,10 @@ item_grid_event (GnomeCanvasItem *item, GdkEvent *event) ...@@ -865,6 +869,10 @@ item_grid_event (GnomeCanvasItem *item, GdkEvent *event)
col = gnumeric_sheet_find_col (gsheet, x, NULL); col = gnumeric_sheet_find_col (gsheet, x, NULL);
row = gnumeric_sheet_find_row (gsheet, y, NULL); row = gnumeric_sheet_find_row (gsheet, y, NULL);
/* While a guru is up ignore clicks */
if (workbook_edit_has_guru (sheet->workbook) && event->button.button != 1)
return TRUE;
switch (event->button.button){ switch (event->button.button){
case 1: case 1:
return item_grid_button_1 (sheet, event, item_grid, col, row, x, y); return item_grid_button_1 (sheet, event, item_grid, col, row, x, y);
...@@ -872,7 +880,7 @@ item_grid_event (GnomeCanvasItem *item, GdkEvent *event) ...@@ -872,7 +880,7 @@ item_grid_event (GnomeCanvasItem *item, GdkEvent *event)
case 2: case 2:
g_warning ("This is here just for demo purposes"); g_warning ("This is here just for demo purposes");
drag_start (GTK_WIDGET (item->canvas), event, sheet); drag_start (GTK_WIDGET (item->canvas), event, sheet);
return 1; return TRUE;
case 3: case 3:
item_grid_popup_menu (sheet, item_grid_popup_menu (sheet,
......
...@@ -51,6 +51,19 @@ workbook_auto_complete_destroy (Workbook *wb) ...@@ -51,6 +51,19 @@ workbook_auto_complete_destroy (Workbook *wb)
} }
static void
workbook_edit_set_sensitive (Workbook const *wb, gboolean flag1, gboolean flag2)
{
/* These are only sensitive while editing */
gtk_widget_set_sensitive (wb->priv->ok_button, flag1);
gtk_widget_set_sensitive (wb->priv->cancel_button, flag1);
/* Toolbars are insensitive while editing */
gtk_widget_set_sensitive (wb->priv->func_button, flag2);
gtk_widget_set_sensitive (wb->priv->standard_toolbar, flag2);
gtk_widget_set_sensitive (wb->priv->format_toolbar, flag2);
}
void void
workbook_finish_editing (Workbook *wb, gboolean const accept) workbook_finish_editing (Workbook *wb, gboolean const accept)
{ {
...@@ -73,14 +86,7 @@ workbook_finish_editing (Workbook *wb, gboolean const accept) ...@@ -73,14 +86,7 @@ workbook_finish_editing (Workbook *wb, gboolean const accept)
wb->editing_sheet = NULL; wb->editing_sheet = NULL;
wb->editing_cell = NULL; wb->editing_cell = NULL;
/* These are only sensitive while editing */ workbook_edit_set_sensitive (wb, FALSE, TRUE);
gtk_widget_set_sensitive (wb->priv->ok_button, FALSE);
gtk_widget_set_sensitive (wb->priv->cancel_button, FALSE);
/* Toolbars are insensitive while editing */
gtk_widget_set_sensitive (wb->priv->func_button, TRUE);
gtk_widget_set_sensitive (wb->priv->standard_toolbar, TRUE);
gtk_widget_set_sensitive (wb->priv->format_toolbar, TRUE);
/* Save the results before changing focus */ /* Save the results before changing focus */
if (accept) { if (accept) {
...@@ -202,6 +208,7 @@ workbook_start_editing_at_cursor (Workbook *wb, gboolean blankp, ...@@ -202,6 +208,7 @@ workbook_start_editing_at_cursor (Workbook *wb, gboolean blankp,
g_return_if_fail (sheet != NULL); g_return_if_fail (sheet != NULL);
application_clipboard_unant (); application_clipboard_unant ();
workbook_edit_set_sensitive (wb, TRUE, FALSE);
cell = sheet_cell_get (sheet, cell = sheet_cell_get (sheet,
sheet->cursor.edit_pos.col, sheet->cursor.edit_pos.col,
...@@ -252,15 +259,6 @@ workbook_start_editing_at_cursor (Workbook *wb, gboolean blankp, ...@@ -252,15 +259,6 @@ workbook_start_editing_at_cursor (Workbook *wb, gboolean blankp,
wb->editing_sheet = sheet;