Commit cb50aa19 authored by Jody Goldberg's avatar Jody Goldberg

Some renaming to remind myself that the workbook_edit routines operate on

wbcg not the workbook.  I think rangesel is a control level event.
parent 6f6a117b
......@@ -499,7 +499,7 @@ cb_name_guru_clicked (GtkWidget *button, NameGuruState *state)
if (state->dialog == NULL)
return;
workbook_set_entry (state->wbcg, NULL);
wbcg_set_entry (state->wbcg, NULL);
if (button == state->delete_button) {
cb_name_guru_remove (NULL, state);
......@@ -541,14 +541,14 @@ cb_name_guru_destroy (GtkObject *w, NameGuruState *state)
g_return_val_if_fail (w != NULL, FALSE);
g_return_val_if_fail (state != NULL, FALSE);
workbook_edit_detach_guru (state->wbcg);
wbcg_edit_detach_guru (state->wbcg);
if (state->gui != NULL) {
gtk_object_unref (GTK_OBJECT (state->gui));
state->gui = NULL;
}
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_finish (state->wbcg, FALSE);
state->dialog = NULL;
......@@ -565,11 +565,11 @@ cb_name_guru_set_focus (GtkWidget *window, GtkWidget *focus_widget,
NameGuruState *state)
{
if (GNUMERIC_IS_EXPR_ENTRY (focus_widget)) {
workbook_set_entry (state->wbcg,
wbcg_set_entry (state->wbcg,
GNUMERIC_EXPR_ENTRY (focus_widget));
gnumeric_expr_entry_set_absolute (state->expr_text);
} else
workbook_set_entry (state->wbcg, NULL);
wbcg_set_entry (state->wbcg, NULL);
}
static gboolean
......@@ -637,7 +637,7 @@ name_guru_init (NameGuruState *state, WorkbookControlGUI *wbcg)
gnumeric_expr_entry_set_scg (state->expr_text,
wb_control_gui_cur_sheet (wbcg));
workbook_edit_attach_guru (state->wbcg, state->dialog);
wbcg_edit_attach_guru (state->wbcg, state->dialog);
return FALSE;
}
......@@ -656,7 +656,7 @@ dialog_define_names (WorkbookControlGUI *wbcg)
g_return_if_fail (wbcg != NULL);
/* Only one guru per workbook. */
if (workbook_edit_has_guru (wbcg))
if (wbcg_edit_has_guru (wbcg))
return;
/* Only pop up one copy per workbook */
......
......@@ -127,7 +127,7 @@ formula_guru_set_expr (FormulaGuruState *state, int index, gboolean set_text)
}
g_string_append_c (str, ')'); /* FIXME use suffix string */
entry = workbook_get_entry (state->wbcg);
entry = wbcg_get_entry (state->wbcg);
if (set_text)
gtk_entry_set_text (GTK_ENTRY (entry), str->str);
......@@ -228,7 +228,7 @@ formula_guru_set_rolled_state (FormulaGuruState *state, gboolean is_rolled)
gtk_widget_show (state->rollup_button);
}
gtk_widget_grab_focus (GTK_WIDGET (new_entry));
workbook_set_entry (state->wbcg, new_entry);
wbcg_set_entry (state->wbcg, new_entry);
}
static gboolean
......@@ -301,7 +301,7 @@ cb_formula_guru_entry_focus_in (GtkWidget *ignored0, GdkEventFocus *ignored1, Ar
gtk_adjustment_value_changed (va);
state->cur_arg = as;
workbook_set_entry (state->wbcg, as->entry);
wbcg_set_entry (state->wbcg, as->entry);
formula_guru_set_expr (state, as->index, TRUE);
return FALSE;
......@@ -313,7 +313,7 @@ cb_formula_guru_destroy (GtkObject *w, FormulaGuruState *state)
g_return_val_if_fail (w != NULL, FALSE);
g_return_val_if_fail (state != NULL, FALSE);
workbook_edit_detach_guru (state->wbcg);
wbcg_edit_detach_guru (state->wbcg);
if (state->args != NULL) {
int i;
......@@ -337,7 +337,7 @@ cb_formula_guru_destroy (GtkObject *w, FormulaGuruState *state)
/* Handle window manger closing the dialog.
* This will be ignored if we are being destroyed differently.
*/
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_finish (state->wbcg, FALSE);
state->dialog = NULL;
......@@ -350,7 +350,7 @@ cb_formula_guru_key_press (GtkWidget *widget, GdkEventKey *event,
FormulaGuruState *state)
{
if (event->keyval == GDK_Escape) {
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_finish (state->wbcg, FALSE);
return TRUE;
} else
return FALSE;
......@@ -375,8 +375,8 @@ cb_formula_guru_clicked (GtkWidget *button, FormulaGuruState *state)
}
/* Detach BEFORE we finish editing */
workbook_edit_detach_guru (state->wbcg);
workbook_finish_editing (state->wbcg, button == state->ok_button);
wbcg_edit_detach_guru (state->wbcg);
wbcg_edit_finish (state->wbcg, button == state->ok_button);
gtk_widget_destroy (state->dialog);
}
......@@ -640,7 +640,7 @@ formula_guru_init (FormulaGuruState *state, ExprTree const *expr, Cell const *ce
}
/* Lifecyle management */
workbook_edit_attach_guru (state->wbcg, state->dialog);
wbcg_edit_attach_guru (state->wbcg, state->dialog);
gnumeric_expr_entry_set_scg (GNUMERIC_EXPR_ENTRY (state->rolled_entry),
wb_control_gui_cur_sheet (state->wbcg));
gtk_signal_connect (GTK_OBJECT (state->dialog), "destroy",
......@@ -695,17 +695,17 @@ dialog_formula_guru (WorkbookControlGUI *wbcg)
* expression
*/
if (expr == NULL) {
workbook_start_editing_at_cursor (wbcg, TRUE, TRUE);
wbcg_edit_start (wbcg, TRUE, TRUE);
gtk_entry_set_text (
GTK_ENTRY (workbook_get_entry (wbcg)), "=");
GTK_ENTRY (wbcg_get_entry (wbcg)), "=");
fd = dialog_function_select (wbcg);
if (fd == NULL) {
workbook_finish_editing (wbcg, FALSE);
wbcg_edit_finish (wbcg, FALSE);
return;
}
} else {
workbook_start_editing_at_cursor (wbcg, FALSE, TRUE);
wbcg_edit_start (wbcg, FALSE, TRUE);
fd = expr_tree_get_func_def (expr);
}
......
......@@ -127,7 +127,7 @@ formula_guru_set_expr (FormulaGuruState *state, int index, gboolean set_text)
}
g_string_append_c (str, ')'); /* FIXME use suffix string */
entry = workbook_get_entry (state->wbcg);
entry = wbcg_get_entry (state->wbcg);
if (set_text)
gtk_entry_set_text (GTK_ENTRY (entry), str->str);
......@@ -228,7 +228,7 @@ formula_guru_set_rolled_state (FormulaGuruState *state, gboolean is_rolled)
gtk_widget_show (state->rollup_button);
}
gtk_widget_grab_focus (GTK_WIDGET (new_entry));
workbook_set_entry (state->wbcg, new_entry);
wbcg_set_entry (state->wbcg, new_entry);
}
static gboolean
......@@ -301,7 +301,7 @@ cb_formula_guru_entry_focus_in (GtkWidget *ignored0, GdkEventFocus *ignored1, Ar
gtk_adjustment_value_changed (va);
state->cur_arg = as;
workbook_set_entry (state->wbcg, as->entry);
wbcg_set_entry (state->wbcg, as->entry);
formula_guru_set_expr (state, as->index, TRUE);
return FALSE;
......@@ -313,7 +313,7 @@ cb_formula_guru_destroy (GtkObject *w, FormulaGuruState *state)
g_return_val_if_fail (w != NULL, FALSE);
g_return_val_if_fail (state != NULL, FALSE);
workbook_edit_detach_guru (state->wbcg);
wbcg_edit_detach_guru (state->wbcg);
if (state->args != NULL) {
int i;
......@@ -337,7 +337,7 @@ cb_formula_guru_destroy (GtkObject *w, FormulaGuruState *state)
/* Handle window manger closing the dialog.
* This will be ignored if we are being destroyed differently.
*/
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_finish (state->wbcg, FALSE);
state->dialog = NULL;
......@@ -350,7 +350,7 @@ cb_formula_guru_key_press (GtkWidget *widget, GdkEventKey *event,
FormulaGuruState *state)
{
if (event->keyval == GDK_Escape) {
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_finish (state->wbcg, FALSE);
return TRUE;
} else
return FALSE;
......@@ -375,8 +375,8 @@ cb_formula_guru_clicked (GtkWidget *button, FormulaGuruState *state)
}
/* Detach BEFORE we finish editing */
workbook_edit_detach_guru (state->wbcg);
workbook_finish_editing (state->wbcg, button == state->ok_button);
wbcg_edit_detach_guru (state->wbcg);
wbcg_edit_finish (state->wbcg, button == state->ok_button);
gtk_widget_destroy (state->dialog);
}
......@@ -640,7 +640,7 @@ formula_guru_init (FormulaGuruState *state, ExprTree const *expr, Cell const *ce
}
/* Lifecyle management */
workbook_edit_attach_guru (state->wbcg, state->dialog);
wbcg_edit_attach_guru (state->wbcg, state->dialog);
gnumeric_expr_entry_set_scg (GNUMERIC_EXPR_ENTRY (state->rolled_entry),
wb_control_gui_cur_sheet (state->wbcg));
gtk_signal_connect (GTK_OBJECT (state->dialog), "destroy",
......@@ -695,17 +695,17 @@ dialog_formula_guru (WorkbookControlGUI *wbcg)
* expression
*/
if (expr == NULL) {
workbook_start_editing_at_cursor (wbcg, TRUE, TRUE);
wbcg_edit_start (wbcg, TRUE, TRUE);
gtk_entry_set_text (
GTK_ENTRY (workbook_get_entry (wbcg)), "=");
GTK_ENTRY (wbcg_get_entry (wbcg)), "=");
fd = dialog_function_select (wbcg);
if (fd == NULL) {
workbook_finish_editing (wbcg, FALSE);
wbcg_edit_finish (wbcg, FALSE);
return;
}
} else {
workbook_start_editing_at_cursor (wbcg, FALSE, TRUE);
wbcg_edit_start (wbcg, FALSE, TRUE);
fd = expr_tree_get_func_def (expr);
}
......
......@@ -109,7 +109,7 @@ graph_guru_state_destroy (GraphGuruState *state)
{
g_return_if_fail (state != NULL);
workbook_edit_detach_guru (state->wbcg);
wbcg_edit_detach_guru (state->wbcg);
if (state->gui != NULL) {
gtk_object_unref (GTK_OBJECT (state->gui));
......@@ -147,7 +147,7 @@ graph_guru_state_destroy (GraphGuruState *state)
/* Handle window manger closing the dialog.
* This will be ignored if we are being destroyed differently.
*/
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_finish (state->wbcg, FALSE);
state->dialog = NULL;
......@@ -166,7 +166,7 @@ cb_graph_guru_key_press (GtkWidget *widget, GdkEventKey *event,
GraphGuruState *state)
{
if (event->keyval == GDK_Escape) {
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_finish (state->wbcg, FALSE);
return TRUE;
} else
return FALSE;
......@@ -219,7 +219,7 @@ cb_graph_guru_clicked (GtkWidget *button, GraphGuruState *state)
if (state->dialog == NULL)
return;
workbook_set_entry (state->wbcg, NULL);
wbcg_set_entry (state->wbcg, NULL);
if (button == state->button_prev) {
graph_guru_set_page (state, state->current_page - 1);
......@@ -308,7 +308,7 @@ graph_guru_init (GraphGuruState *state)
state->button_finish = graph_guru_init_button (state, "button_finish");
/* Lifecyle management */
workbook_edit_attach_guru (state->wbcg, state->dialog);
wbcg_edit_attach_guru (state->wbcg, state->dialog);
gtk_signal_connect (GTK_OBJECT (state->dialog), "destroy",
GTK_SIGNAL_FUNC (cb_graph_guru_destroy),
state);
......
......@@ -1283,8 +1283,8 @@ static void
do_print_ok_cb (GtkWidget *w, PrinterSetupState *state)
{
/* Detach BEFORE we finish editing */
workbook_edit_detach_guru (state->wbcg);
workbook_finish_editing (state->wbcg, TRUE);
wbcg_edit_detach_guru (state->wbcg);
wbcg_edit_finish (state->wbcg, TRUE);
fetch_settings (state);
print_info_save (state->pi);
gnome_dialog_close (GNOME_DIALOG (state->dialog));
......@@ -1294,19 +1294,18 @@ static void
do_print_set_focus_cb (GtkWidget *window, GtkWidget *focus_widget,
PrinterSetupState *state)
{
if (GNUMERIC_IS_EXPR_ENTRY (focus_widget)) {
workbook_set_entry (state->wbcg,
if (GNUMERIC_IS_EXPR_ENTRY (focus_widget))
wbcg_set_entry (state->wbcg,
GNUMERIC_EXPR_ENTRY (focus_widget));
} else
workbook_set_entry (state->wbcg, NULL);
else
wbcg_set_entry (state->wbcg, NULL);
}
static void
do_print_destroy_cb (GtkWidget *button, PrinterSetupState *state)
{
workbook_edit_detach_guru (state->wbcg);
workbook_finish_editing (state->wbcg, FALSE);
wbcg_edit_detach_guru (state->wbcg);
wbcg_edit_finish (state->wbcg, FALSE);
printer_setup_state_free (state);
}
......@@ -1338,7 +1337,7 @@ do_setup_main_dialog (PrinterSetupState *state)
w = glade_xml_get_widget (state->gui, "options");
gtk_widget_hide (w);
workbook_edit_attach_guru (state->wbcg, state->dialog);
wbcg_edit_attach_guru (state->wbcg, state->dialog);
gtk_signal_connect (
GTK_OBJECT (state->dialog), "set-focus",
GTK_SIGNAL_FUNC (do_print_set_focus_cb), state);
......@@ -1528,7 +1527,7 @@ dialog_printer_setup (WorkbookControlGUI *wbcg, Sheet *sheet)
PrinterSetupState *state;
/* Only one guru per workbook. */
if (workbook_edit_has_guru (wbcg))
if (wbcg_edit_has_guru (wbcg))
return;
/* Only pop up one copy per workbook */
......
......@@ -135,7 +135,7 @@ dialog_destroy (GtkWidget *widget, DialogState *dd)
{
GladeXML *gui = dd->gui;
gtk_object_unref (GTK_OBJECT (gui));
workbook_edit_detach_guru (dd->wbcg);
wbcg_edit_detach_guru (dd->wbcg);
memset (dd, 0, sizeof (*dd));
g_free (dd);
}
......@@ -145,10 +145,10 @@ static void
set_focus (GtkWidget *widget, GtkWidget *focus_widget, DialogState *dd)
{
if (GNUMERIC_IS_EXPR_ENTRY (focus_widget))
workbook_set_entry (dd->wbcg,
wbcg_set_entry (dd->wbcg,
GNUMERIC_EXPR_ENTRY (focus_widget));
else
workbook_set_entry (dd->wbcg, NULL);
wbcg_set_entry (dd->wbcg, NULL);
}
......@@ -181,7 +181,7 @@ dialog_search_replace (WorkbookControlGUI *wbcg,
g_return_if_fail (wbcg != NULL);
/* Only one guru per workbook. */
if (workbook_edit_has_guru (wbcg))
if (wbcg_edit_has_guru (wbcg))
return;
if (gnumeric_dialog_raise_if_exists (wbcg, SEARCH_REPLACE_KEY))
......@@ -230,7 +230,7 @@ dialog_search_replace (WorkbookControlGUI *wbcg,
gtk_widget_show_all (dialog->vbox);
gnumeric_expr_entry_set_scg (dd->rangetext,
wb_control_gui_cur_sheet (wbcg));
workbook_edit_attach_guru (wbcg, GTK_WIDGET (dialog));
wbcg_edit_attach_guru (wbcg, GTK_WIDGET (dialog));
non_model_dialog (wbcg, dialog);
}
......@@ -156,7 +156,7 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
event->state == GDK_MOD1_MASK))
/* Forward the keystroke to the input line */
return gtk_widget_event (
GTK_WIDGET (workbook_get_entry_logical (wbcg)),
GTK_WIDGET (wbcg_get_entry_logical (wbcg)),
(GdkEvent *) event);
/* fall down */
......@@ -168,7 +168,7 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
if (wbcg->editing)
sheet = wbcg->editing_sheet;
if (workbook_finish_editing (wbcg, TRUE)) {
if (wbcg_edit_finish (wbcg, TRUE)) {
/* Figure out the direction */
gboolean const direction = (event->state & GDK_SHIFT_MASK) ? FALSE : TRUE;
gboolean const horizontal = (event->keyval == GDK_KP_Enter ||
......@@ -180,17 +180,17 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
}
case GDK_Escape:
workbook_finish_editing (wbcg, FALSE);
wbcg_edit_finish (wbcg, FALSE);
application_clipboard_unant ();
break;
case GDK_F4:
if (wbcg->editing && gsheet->sel_cursor)
workbook_edit_toggle_absolute (wbcg);
wbcg_edit_toggle_absolute (wbcg);
break;
case GDK_F2:
workbook_start_editing_at_cursor (wbcg, FALSE, FALSE);
wbcg_edit_start (wbcg, FALSE, FALSE);
/* fall down */
default:
......@@ -202,12 +202,12 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
if (event->length == 0)
return FALSE;
workbook_start_editing_at_cursor (wbcg, TRUE, TRUE);
wbcg_edit_start (wbcg, TRUE, TRUE);
}
scg_rangesel_stop (gsheet->scg, FALSE);
/* Forward the keystroke to the input line */
return gtk_widget_event (GTK_WIDGET (workbook_get_entry_logical (wbcg)),
return gtk_widget_event (GTK_WIDGET (wbcg_get_entry_logical (wbcg)),
(GdkEvent *) event);
}
......
......@@ -156,7 +156,7 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
event->state == GDK_MOD1_MASK))
/* Forward the keystroke to the input line */
return gtk_widget_event (
GTK_WIDGET (workbook_get_entry_logical (wbcg)),
GTK_WIDGET (wbcg_get_entry_logical (wbcg)),
(GdkEvent *) event);
/* fall down */
......@@ -168,7 +168,7 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
if (wbcg->editing)
sheet = wbcg->editing_sheet;
if (workbook_finish_editing (wbcg, TRUE)) {
if (wbcg_edit_finish (wbcg, TRUE)) {
/* Figure out the direction */
gboolean const direction = (event->state & GDK_SHIFT_MASK) ? FALSE : TRUE;
gboolean const horizontal = (event->keyval == GDK_KP_Enter ||
......@@ -180,17 +180,17 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
}
case GDK_Escape:
workbook_finish_editing (wbcg, FALSE);
wbcg_edit_finish (wbcg, FALSE);
application_clipboard_unant ();
break;
case GDK_F4:
if (wbcg->editing && gsheet->sel_cursor)
workbook_edit_toggle_absolute (wbcg);
wbcg_edit_toggle_absolute (wbcg);
break;
case GDK_F2:
workbook_start_editing_at_cursor (wbcg, FALSE, FALSE);
wbcg_edit_start (wbcg, FALSE, FALSE);
/* fall down */
default:
......@@ -202,12 +202,12 @@ gnumeric_sheet_key_mode_sheet (GnumericSheet *gsheet, GdkEventKey *event)
if (event->length == 0)
return FALSE;
workbook_start_editing_at_cursor (wbcg, TRUE, TRUE);
wbcg_edit_start (wbcg, TRUE, TRUE);
}
scg_rangesel_stop (gsheet->scg, FALSE);
/* Forward the keystroke to the input line */
return gtk_widget_event (GTK_WIDGET (workbook_get_entry_logical (wbcg)),
return gtk_widget_event (GTK_WIDGET (wbcg_get_entry_logical (wbcg)),
(GdkEvent *) event);
}
......
......@@ -591,7 +591,7 @@ set_cursor (ItemBar *ib, int x, int y)
if (!canvas->window)
return;
if (!workbook_edit_has_guru (ib->scg->wbcg)) {
if (!wbcg_edit_has_guru (ib->scg->wbcg)) {
if (ib->is_col_header) {
major = x;
minor = y;
......@@ -806,8 +806,8 @@ item_bar_event (GnomeCanvasItem *item, GdkEvent *e)
row = gnumeric_sheet_find_row (gsheet, y, NULL);
if (workbook_edit_has_guru (wbcg) &&
!workbook_edit_entry_redirect_p (wbcg))
if (wbcg_edit_has_guru (wbcg) &&
!wbcg_edit_entry_redirect_p (wbcg))
break;
scg_colrow_select (item_bar->scg, is_cols,
......@@ -842,7 +842,7 @@ item_bar_event (GnomeCanvasItem *item, GdkEvent *e)
if (e->button.button > 3)
return FALSE;
if (!workbook_edit_has_guru (wbcg))
if (!wbcg_edit_has_guru (wbcg))
scg_mode_edit (item_bar->scg);
gnome_canvas_w2c (canvas, e->button.x, e->button.y, &x, &y);
......@@ -856,13 +856,13 @@ item_bar_event (GnomeCanvasItem *item, GdkEvent *e)
cri = is_pointer_on_division (item_bar, pos, &start, &element);
if (element < 0)
return FALSE;
if (workbook_edit_has_guru (wbcg))
if (wbcg_edit_has_guru (wbcg))
cri = NULL;
else if (other_pos < item_bar->indent)
return outline_button_press (item_bar, element, other_pos);
if (e->button.button == 3) {
if (workbook_edit_has_guru (wbcg))
if (wbcg_edit_has_guru (wbcg))
return TRUE;
/* If the selection does not contain the current row/col
* then clear the selection and add it.
......@@ -892,8 +892,8 @@ item_bar_event (GnomeCanvasItem *item, GdkEvent *e)
gtk_widget_show_all (gtk_widget_get_toplevel (item_bar->tip));
}
} else {
if (workbook_edit_has_guru (wbcg) &&
!workbook_edit_entry_redirect_p (wbcg))
if (wbcg_edit_has_guru (wbcg) &&
!wbcg_edit_entry_redirect_p (wbcg))
break;
item_bar->start_selection = element;
......
......@@ -700,7 +700,7 @@ item_cursor_selection_event (GnomeCanvasItem *item, GdkEvent *event)
gnome_canvas_item_ungrab (item, event->button.time);
gdk_flush ();
workbook_finish_editing (ic->scg->wbcg, TRUE);
wbcg_edit_finish (ic->scg->wbcg, TRUE);
if (sheet_is_region_empty (sheet, &ic->pos))
return TRUE;
......@@ -1198,7 +1198,7 @@ item_cursor_autofill_event (GnomeCanvasItem *item, GdkEvent *event)
gnome_canvas_item_ungrab (item, event->button.time);
gdk_flush ();
workbook_finish_editing (item_cursor->scg->wbcg, TRUE);
wbcg_edit_finish (item_cursor->scg->wbcg, TRUE);
cmd_autofill (WORKBOOK_CONTROL (item_cursor->scg->wbcg), sheet,
item_cursor->base.col, item_cursor->base.row,
item_cursor->base_cols+1, item_cursor->base_rows+1,
......
......@@ -194,7 +194,7 @@ item_edit_draw_text (ItemEdit *item_edit, GdkDrawable *drawable, GtkStyle *style
if (text_length > 0) {
if (text_length > cursor_pos &&
workbook_auto_completing (item_edit->scg->wbcg)) {
wbcg_auto_completing (item_edit->scg->wbcg)) {
if (w < 0)
w = gdk_text_width (font, text, text_length);
gdk_draw_rectangle (drawable, style->black_gc, TRUE,
......@@ -239,7 +239,7 @@ item_edit_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
(int)(item->y2-item->y1));
/* Make a number of tests for auto-completion */
text = workbook_edit_get_display_text (item_edit->scg->wbcg);
text = wbcg_edit_get_display_text (item_edit->scg->wbcg);
for (ptr = item_edit->text_offsets; ptr != NULL; ptr = ptr->next){
int const text_end = GPOINTER_TO_INT (ptr->data);
......@@ -292,8 +292,8 @@ recalc_spans (GnomeCanvasItem *item)
ItemEdit *item_edit = ITEM_EDIT (item);
Sheet *sheet = item_edit->scg->sheet;
GdkFont *font = item_edit->font;
const char *start = workbook_edit_get_display_text (item_edit->scg->wbcg);
const char *text = start;
char const *start = wbcg_edit_get_display_text (item_edit->scg->wbcg);
char const *text = start;
int col_span, row_span, tmp;
GSList *text_offsets = NULL;
Range const *merged;
......@@ -513,7 +513,7 @@ item_edit_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
item_edit->scg = GTK_VALUE_POINTER (*arg);
sheet = item_edit->scg->sheet;
item_edit->entry = GTK_ENTRY (workbook_get_entry (item_edit->scg->wbcg));
item_edit->entry = GTK_ENTRY (wbcg_get_entry (item_edit->scg->wbcg));
item_edit->pos = sheet->edit_pos;
entry = item_edit->entry;
......
......@@ -751,7 +751,7 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event,
* ends the edit.
*/
if (scg->current_object != NULL) {
if (!workbook_edit_has_guru (scg->wbcg))
if (!wbcg_edit_has_guru (scg->wbcg))
scg_mode_edit (scg);
} else
wb_control_gui_focus_cur_sheet (scg->wbcg);
......@@ -788,13 +788,13 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event,
}
/* While a guru is up ignore clicks */
if (workbook_edit_has_guru (scg->wbcg))
if (wbcg_edit_has_guru (scg->wbcg))
return 1;
/* This was a regular click on a cell on the spreadsheet. Select it.
* but only if the entered expression is valid
*/
if (workbook_finish_editing (scg->wbcg, TRUE) == FALSE)
if (wbcg_edit_finish (scg->wbcg, TRUE) == FALSE)
return 1;
if (!(event->state & (GDK_CONTROL_MASK|GDK_SHIFT_MASK)))
......@@ -972,7 +972,7 @@ item_grid_event (GnomeCanvasItem *item, GdkEvent *event)
if (event->button.button == 1)
return item_grid_button_1 (scg, &event->button,
ig, col, row, x, y);
if (workbook_edit_has_guru (scg->wbcg))
if (wbcg_edit_has_guru (scg->wbcg))
return TRUE;
switch (event->button.button) {
......
......@@ -403,8 +403,8 @@ scg_select_all (SheetControlGUI *scg)
gboolean const rangesel = scg_rangesel_possible (scg);
if (!rangesel) {
if (!workbook_edit_has_guru (scg->wbcg)) {
workbook_finish_editing (scg->wbcg, FALSE);
if (!wbcg_edit_has_guru (scg->wbcg)) {
wbcg_edit_finish (scg->wbcg, FALSE);
cmd_select_all (scg->sheet);
}
} else {
......@@ -425,7 +425,7 @@ scg_colrow_select (SheetControlGUI *scg, gboolean is_cols,
gboolean const rangesel = scg_rangesel_possible (scg);
if (!rangesel)
workbook_finish_editing (scg->wbcg, FALSE);
wbcg_edit_finish (scg->wbcg, FALSE);
if (rangesel && !scg->rangesel.active)
scg_rangesel_start (scg, index, index);
......@@ -1089,7 +1089,7 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
GList *l;
workbook_finish_editing (scg->wbcg, FALSE);
wbcg_edit_finish (scg->wbcg, FALSE);
/*
* Now see if there is some selection which selects a
......@@ -1205,8 +1205,8 @@ scg_mode_edit (SheetControlGUI *scg)
scg_mode_clear (scg);
scg_cursor_visible (scg, TRUE);
if (workbook_edit_has_guru (scg->wbcg))
workbook_finish_editing (scg->wbcg, FALSE);
if (wbcg_edit_has_guru (scg->wbcg))
wbcg_edit_finish (scg->wbcg, FALSE);
}
/*
......@@ -2042,7 +2042,7 @@ scg_rangesel_possible (SheetControlGUI const *scg)
g_return_val_if_fail (IS_SHEET_CONTROL_GUI (scg), FALSE);
wbcg = scg->wbcg;
if (workbook_edit_entry_redirect_p (wbcg))
if (wbcg_edit_entry_redirect_p (wbcg))
return TRUE;
if (!wbcg->editing)
......@@ -2051,7 +2051,7 @@ scg_rangesel_possible (SheetControlGUI const *scg)
if (scg->rangesel.active)
return TRUE;
return workbook_editing_expr (wbcg);
return wbcg_editing_expr (wbcg);
}
/**
......@@ -2097,7 +2097,7 @@ scg_rangesel_changed (SheetControlGUI *scg,
* We'll also need to name selections containing merged cells
* properly.
*/
expr_entry = workbook_get_entry_logical (scg->wbcg);
expr_entry = wbcg_get_entry_logical (scg->wbcg);
gnumeric_expr_entry_freeze (expr_entry);
ic_changed = gnumeric_expr_entry_set_rangesel_from_range (
expr_entry, r, scg->sheet, scg->rangesel.cursor_pos);
......@@ -2124,7 +2124,7 @@ scg_rangesel_start (SheetControlGUI *scg, int col, int row)
return;
scg->rangesel.active = TRUE;
scg->rangesel.cursor_pos = GTK_EDITABLE (workbook_get_entry_logical (scg->wbcg))->current_pos;
scg->rangesel.cursor_pos = GTK_EDITABLE (wbcg_get_entry_logical (scg->wbcg))->current_pos;
gnumeric_sheet_rangesel_start (GNUMERIC_SHEET (scg->canvas), col, row);
scg_rangesel_changed (scg, col, row, col, row);
......@@ -2142,7 +2142,7 @@ scg_rangesel_stop (SheetControlGUI *scg, gboolean clear_string)
gnumeric_sheet_rangesel_stop (GNUMERIC_SHEET (scg->canvas));
scg_stop_sliding (scg);
gnumeric_expr_entry_rangesel_stopped (
GNUMERIC_EXPR_ENTRY (workbook_get_entry_logical (scg->wbcg)),
GNUMERIC_EXPR_ENTRY (wbcg_get_entry_logical (scg->wbcg)),
clear_string);
}
......@@ -2176,7 +2176,7 @@ scg_cursor_move_to (SheetControlGUI *scg, int col, int row,
*/
/* Set the cursor BEFORE making it visible to decrease flicker */
if (workbook_finish_editing (scg->wbcg, TRUE) == FALSE)
if (wbcg_edit_finish (scg->wbcg, TRUE) == FALSE)
return;
if (clear_selection)
......@@ -2219,22 +2219,16 @@ scg_rangesel_bound (SheetControlGUI *scg,
scg_rangesel_changed (scg, base_col, base_row, move_col, move_row);
}
static void
start_range_selection (SheetControlGUI *scg)
{
Sheet const *sheet = scg->sheet;
scg_rangesel_start (scg,
sheet->edit_pos_real.col, sheet->edit_pos_real.row);
}
void
scg_rangesel_move (SheetControlGUI *scg, int n, gboolean jump_to_bound,
gboolean horiz)
{