Commit 203ab6fe authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

implement.

	* src/workbook-control-gui.c (wbcg_init_state) : implement.

2001-04-16  Jody Goldberg <jgoldberg@home.com>

	s/workbook_control_sheets_init/workbook_control_init_state/

	* src/commands.c (command_setup_combos) : new function to initialize
	  the undo/redo combos into a known state.
	* src/workbook-control.c (workbook_control_sheets_init) : called here.

	* src/workbook-control.c (wb_control_change_view) : new virtual.
	(workbook_control_set_view) : called here.
parent 8e8eadc5
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (wbcg_init_state) : implement.
2001-04-16 Jody Goldberg <jgoldberg@home.com>
s/workbook_control_sheets_init/workbook_control_init_state/
* src/commands.c (command_setup_combos) : new function to initialize
the undo/redo combos into a known state.
* src/workbook-control.c (workbook_control_sheets_init) : called here.
* src/workbook-control.c (wb_control_change_view) : new virtual.
(workbook_control_set_view) : called here.
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-edit.c (workbook_finish_editing) : fix. We need to
......
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (wbcg_init_state) : implement.
2001-04-16 Jody Goldberg <jgoldberg@home.com>
s/workbook_control_sheets_init/workbook_control_init_state/
* src/commands.c (command_setup_combos) : new function to initialize
the undo/redo combos into a known state.
* src/workbook-control.c (workbook_control_sheets_init) : called here.
* src/workbook-control.c (wb_control_change_view) : new virtual.
(workbook_control_set_view) : called here.
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-edit.c (workbook_finish_editing) : fix. We need to
......
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (wbcg_init_state) : implement.
2001-04-16 Jody Goldberg <jgoldberg@home.com>
s/workbook_control_sheets_init/workbook_control_init_state/
* src/commands.c (command_setup_combos) : new function to initialize
the undo/redo combos into a known state.
* src/workbook-control.c (workbook_control_sheets_init) : called here.
* src/workbook-control.c (wb_control_change_view) : new virtual.
(workbook_control_set_view) : called here.
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-edit.c (workbook_finish_editing) : fix. We need to
......
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (wbcg_init_state) : implement.
2001-04-16 Jody Goldberg <jgoldberg@home.com>
s/workbook_control_sheets_init/workbook_control_init_state/
* src/commands.c (command_setup_combos) : new function to initialize
the undo/redo combos into a known state.
* src/workbook-control.c (workbook_control_sheets_init) : called here.
* src/workbook-control.c (wb_control_change_view) : new virtual.
(workbook_control_set_view) : called here.
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-edit.c (workbook_finish_editing) : fix. We need to
......
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (wbcg_init_state) : implement.
2001-04-16 Jody Goldberg <jgoldberg@home.com>
s/workbook_control_sheets_init/workbook_control_init_state/
* src/commands.c (command_setup_combos) : new function to initialize
the undo/redo combos into a known state.
* src/workbook-control.c (workbook_control_sheets_init) : called here.
* src/workbook-control.c (wb_control_change_view) : new virtual.
(workbook_control_set_view) : called here.
2001-04-17 Jody Goldberg <jgoldberg@home.com>
* src/workbook-edit.c (workbook_finish_editing) : fix. We need to
......
......@@ -297,6 +297,41 @@ command_redo (WorkbookControl *wbc)
undo_redo_menu_labels (wb);
}
/**
* command_setup_combos :
* @wbc :
*
* Initialize the combos to correspond to the current undo/redo state.
*/
void
command_setup_combos (WorkbookControl *wbc)
{
char const *undo_label = NULL, *redo_label = NULL;
GSList *ptr, *tmp;
Workbook *wb = wb_control_workbook (wbc);
g_return_if_fail (wb);
wb_control_undo_redo_clear (wbc, TRUE);
tmp = g_slist_reverse (wb->undo_commands);
for (ptr = tmp ; ptr != NULL ; ptr = ptr->next) {
undo_label = get_menu_label (ptr);
wb_control_undo_redo_push (wbc, undo_label, TRUE);
}
g_slist_reverse (tmp);
wb_control_undo_redo_clear (wbc, FALSE);
tmp = g_slist_reverse (wb->redo_commands);
for (ptr = tmp ; ptr != NULL ; ptr = ptr->next) {
redo_label = get_menu_label (ptr);
wb_control_undo_redo_push (wbc, redo_label, FALSE);
}
g_slist_reverse (tmp);
/* update the menus too */
wb_control_undo_redo_labels (wbc, undo_label, redo_label);
}
/*
* command_list_release : utility routine to free the resources associated
* with a list of commands.
......
......@@ -7,6 +7,7 @@
void command_undo (WorkbookControl *wbc);
void command_redo (WorkbookControl *wbc);
void command_setup_combos (WorkbookControl *wbc);
void command_list_release (GSList *cmds);
gboolean cmd_set_text (WorkbookControl *wbc, Sheet *sheet,
......
......@@ -380,7 +380,7 @@ file_finish_load (WorkbookControl *wbc, WorkbookView *new_wbv)
gtk_object_ref (GTK_OBJECT (wbc));
workbook_unref (old_wb);
workbook_control_set_view (wbc, new_wbv, NULL);
workbook_control_sheets_init (wbc);
workbook_control_init_state (wbc);
new_wbc = wbc;
} else
new_wbc = wb_control_wrapper_new (wbc, new_wbv, NULL);
......
......@@ -50,6 +50,7 @@ struct _WorkbookControlGUI {
GtkWidget *font_name_selector;
GtkWidget *font_size_selector;
GtkWidget *zoom_entry;
GtkWidget *fore_color, *back_color;
/* ComboStacks */
GtkWidget *undo_combo, *redo_combo;
......
......@@ -50,6 +50,7 @@
#include "cell.h"
#include "gui-file.h"
#include "search.h"
#include <gal/widgets/widget-color-combo.h>
#ifdef ENABLE_BONOBO
#include "sheet-object-container.h"
......@@ -213,6 +214,22 @@ wbcg_control_new (WorkbookControl *wbc, WorkbookView *wbv, Workbook *wb)
return workbook_control_gui_new (wbv, wb);
}
static void
wbcg_init_state (WorkbookControl *wbc)
{
WorkbookView *wbv = wb_control_view (wbc);
WorkbookControlGUI *wbcg = WORKBOOK_CONTROL_GUI (wbc);
ColorCombo *combo;
/* Associate the combos with the view */
combo = COLOR_COMBO (wbcg->back_color);
color_palette_set_group (combo->palette,
color_group_fetch ("back_color_group", wbv));
combo = COLOR_COMBO (wbcg->fore_color);
color_palette_set_group (combo->palette,
color_group_fetch ("fore_color_group", wbv));
}
static void
wbcg_title_set (WorkbookControl *wbc, char const *title)
{
......@@ -3367,9 +3384,6 @@ workbook_control_gui_init (WorkbookControlGUI *wbcg,
wbcg_history_setup (wbcg); /* Dynamic history menu items. */
/* There is nothing to undo/redo yet */
wbcg_undo_redo_labels (WORKBOOK_CONTROL (wbcg), NULL, NULL);
/*
* Initialize the menu items, This will enable insert cols/rows
* and paste special to the currently valid values for the
......@@ -3445,6 +3459,7 @@ workbook_control_gui_ctor_class (GtkObjectClass *object_class)
wbc_class->context_class.error.splits_array = wbcg_error_splits_array;
wbc_class->control_new = wbcg_control_new;
wbc_class->init_state = wbcg_init_state;
wbc_class->title_set = wbcg_title_set;
wbc_class->prefs_update = wbcg_prefs_update;
wbc_class->format_feedback = wbcg_format_feedback;
......@@ -3491,7 +3506,7 @@ workbook_control_gui_new (WorkbookView *optional_view, Workbook *wb)
wbc = WORKBOOK_CONTROL (wbcg);
workbook_control_gui_init (wbcg, optional_view, wb);
workbook_control_sheets_init (wbc);
workbook_control_init_state (wbc);
return wbc;
}
......@@ -14,6 +14,7 @@ typedef struct {
/* Create a new control of the same form */
WorkbookControl *(*control_new) (WorkbookControl *wbc, WorkbookView *wbv, Workbook *wb);
void (*init_state) (WorkbookControl *wbc);
/* Actions on the workbook UI */
void (*title_set) (WorkbookControl *wbc, char const *title);
......
......@@ -27,6 +27,7 @@
#include "gnumeric-type-util.h"
#include "parse-util.h"
#include "sheet.h"
#include "commands.h"
#include <gnome.h> /* Ick. This is required to get _("") */
......@@ -228,13 +229,23 @@ workbook_control_set_view (WorkbookControl *wbc,
}
void
workbook_control_sheets_init (WorkbookControl *wbc)
workbook_control_init_state (WorkbookControl *wbc)
{
GList *sheets, *ptr;
WorkbookControlClass *wbc_class;
g_return_if_fail (IS_WORKBOOK_CONTROL (wbc));
/* Setup the undo/redo combos */
command_setup_combos (wbc);
/* Add views all all existing sheets */
sheets = workbook_sheets (wb_control_workbook (wbc));
for (ptr = sheets; ptr != NULL ; ptr = ptr->next)
wb_control_sheet_add (wbc, ptr->data);
g_list_free (sheets);
wbc_class = WBC_CLASS (wbc);
if (wbc_class != NULL && wbc_class->control_new != NULL)
wbc_class->init_state (wbc);
}
......@@ -12,7 +12,7 @@ GtkType workbook_control_get_type (void);
void workbook_control_set_view (WorkbookControl *wbc,
WorkbookView *optional_view,
Workbook *optional_wb);
void workbook_control_sheets_init (WorkbookControl *wbc);
void workbook_control_init_state (WorkbookControl *wbc);
/* Create a new control of the same form */
WorkbookControl *wb_control_wrapper_new (WorkbookControl *wbc,
......
......@@ -6,7 +6,7 @@
void workbook_start_editing_at_cursor (WorkbookControlGUI *wbcg,
gboolean blankp, gboolean cursorp);
gboolean workbook_finish_editing (WorkbookControlGUI *wbcg, gboolean const accept);
gboolean workbook_finish_editing (WorkbookControlGUI *wbcg, gboolean accept);
gboolean workbook_editing_expr (WorkbookControlGUI const *wbcg);
GtkEntry *workbook_get_entry (WorkbookControlGUI const *wbcg);
......@@ -20,7 +20,7 @@ void workbook_edit_select_absolute (WorkbookControlGUI *wbcg);
void workbook_auto_complete_destroy (WorkbookControlGUI *wbcg);
const char *workbook_edit_get_display_text (WorkbookControlGUI *wbcg);
char const *workbook_edit_get_display_text (WorkbookControlGUI *wbcg);
gboolean workbook_auto_completing (WorkbookControlGUI *wbcg);
void workbook_edit_init (WorkbookControlGUI *wbcg);
......
......@@ -800,9 +800,10 @@ workbook_create_format_toolbar (WorkbookControlGUI *wbcg)
/* Create the background colour combo box */
cg = color_group_fetch ("back_color_group", wbcg);
back_combo = color_combo_new (bucket_xpm, _("Clear Background"),
/* Draw an outline for the default */
NULL, cg);
wbcg->back_color = back_combo =
color_combo_new (bucket_xpm, _("Clear Background"),
/* Draw an outline for the default */
NULL, cg);
gtk_signal_connect (GTK_OBJECT (back_combo), "changed",
GTK_SIGNAL_FUNC (cb_back_color_changed), wbcg);
disable_focus (back_combo, NULL);
......@@ -811,9 +812,10 @@ workbook_create_format_toolbar (WorkbookControlGUI *wbcg)
/* Create the font colour combo box. */
cg = color_group_fetch ("fore_color_group", wbcg);
fore_combo = color_combo_new (font_xpm, _("Automatic"),
/* Draw black for the default */
&gs_black, cg);
wbcg->fore_color = fore_combo =
color_combo_new (font_xpm, _("Automatic"),
/* Draw black for the default */
&gs_black, cg);
gtk_signal_connect (GTK_OBJECT (fore_combo), "changed",
GTK_SIGNAL_FUNC (cb_fore_color_changed), wbcg);
disable_focus (fore_combo, NULL);
......
......@@ -437,8 +437,8 @@ wb_view_attach_control (WorkbookView *wbv, WorkbookControl *wbc)
wbc->wb_view->wb_controls = g_ptr_array_new ();
g_ptr_array_add (wbc->wb_view->wb_controls, wbc);
/* Set the title of the newly connected control */
if (wbv->wb != NULL) {
/* Set the title of the newly connected control */
char *base_name = g_basename (wbv->wb->filename);
wb_control_title_set (wbc, base_name);
}
......
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