Commit a4a97170 authored by Jon K Hellan's avatar Jon K Hellan Committed by Jon Kåre Hellan

Define menu state enums for print setup, search/replace and define names

2001-05-15  Jon K Hellan  <hellan@acm.org>

 	* src/workbook-control.h: Define menu state enums for print setup,
 	search/replace and define names and a define for the lot.

 	* src/workbook-control-gui-priv.h (struct _WorkbookControlGUI):
 	Add menu_item_print_setup, menu_item_search_replace,
 	menu_item_define_name members.

 	* src/workbook-edit.c (workbook_edit_attach_guru,
 	workbook_edit_detach_guru): Update Update print setup,
 	search/replace and define names sensitivity according to whether
 	or not we have guru.

 	* src/workbook-control-gui.c (wbcg_menu_state_update): Ditto. This
 	is where it's actually implemented.

 	* src/dialogs/dialog-define-names.c (dialog_define_names):
 	Ensure only one guru per workbook.

 	* src/dialogs/dialog-search-replace.c (dialog_search_replace):
        Ditto.

 	* src/dialogs/dialog-printer-setup.c (dialog_printer_setup):
        Ditto.
parent f47b0c8c
2001-05-15 Jon K Hellan <hellan@acm.org>
* src/workbook-control.h: Define menu state enums for print setup,
search/replace and define names and a define for the lot.
* src/workbook-control-gui-priv.h (struct _WorkbookControlGUI):
Add menu_item_print_setup, menu_item_search_replace,
menu_item_define_name members.
* src/workbook-edit.c (workbook_edit_attach_guru,
workbook_edit_detach_guru): Update Update print setup,
search/replace and define names sensitivity according to whether
or not we have guru.
* src/workbook-control-gui.c (wbcg_menu_state_update): Ditto. This
is where it's actually implemented.
2001-05-15 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c (vertical_scroll_offset_changed): Sync
......
2001-05-15 Jon K Hellan <hellan@acm.org>
* src/workbook-control.h: Define menu state enums for print setup,
search/replace and define names and a define for the lot.
* src/workbook-control-gui-priv.h (struct _WorkbookControlGUI):
Add menu_item_print_setup, menu_item_search_replace,
menu_item_define_name members.
* src/workbook-edit.c (workbook_edit_attach_guru,
workbook_edit_detach_guru): Update Update print setup,
search/replace and define names sensitivity according to whether
or not we have guru.
* src/workbook-control-gui.c (wbcg_menu_state_update): Ditto. This
is where it's actually implemented.
2001-05-15 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c (vertical_scroll_offset_changed): Sync
......
2001-05-15 Jon K Hellan <hellan@acm.org>
* src/workbook-control.h: Define menu state enums for print setup,
search/replace and define names and a define for the lot.
* src/workbook-control-gui-priv.h (struct _WorkbookControlGUI):
Add menu_item_print_setup, menu_item_search_replace,
menu_item_define_name members.
* src/workbook-edit.c (workbook_edit_attach_guru,
workbook_edit_detach_guru): Update Update print setup,
search/replace and define names sensitivity according to whether
or not we have guru.
* src/workbook-control-gui.c (wbcg_menu_state_update): Ditto. This
is where it's actually implemented.
2001-05-15 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c (vertical_scroll_offset_changed): Sync
......
2001-05-15 Jon K Hellan <hellan@acm.org>
* src/workbook-control.h: Define menu state enums for print setup,
search/replace and define names and a define for the lot.
* src/workbook-control-gui-priv.h (struct _WorkbookControlGUI):
Add menu_item_print_setup, menu_item_search_replace,
menu_item_define_name members.
* src/workbook-edit.c (workbook_edit_attach_guru,
workbook_edit_detach_guru): Update Update print setup,
search/replace and define names sensitivity according to whether
or not we have guru.
* src/workbook-control-gui.c (wbcg_menu_state_update): Ditto. This
is where it's actually implemented.
2001-05-15 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c (vertical_scroll_offset_changed): Sync
......
2001-05-15 Jon K Hellan <hellan@acm.org>
* src/workbook-control.h: Define menu state enums for print setup,
search/replace and define names and a define for the lot.
* src/workbook-control-gui-priv.h (struct _WorkbookControlGUI):
Add menu_item_print_setup, menu_item_search_replace,
menu_item_define_name members.
* src/workbook-edit.c (workbook_edit_attach_guru,
workbook_edit_detach_guru): Update Update print setup,
search/replace and define names sensitivity according to whether
or not we have guru.
* src/workbook-control-gui.c (wbcg_menu_state_update): Ditto. This
is where it's actually implemented.
2001-05-15 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c (vertical_scroll_offset_changed): Sync
......
2001-05-15 Jon K Hellan <hellan@acm.org>
* dialog-define-names.c (dialog_define_names): Ensure only one
guru per workbook.
* dialog-search-replace.c (dialog_search_replace): Ditto.
* dialog-printer-setup.c (dialog_printer_setup): Ditto.
2001-05-14 Jody Goldberg <jgoldberg@home.com>
* dialog-cell-format.c (fmt_dialog_impl) : move the containment logic
......
......@@ -562,7 +562,7 @@ cb_name_guru_destroy (GtkObject *w, NameGuruState *state)
static void
cb_name_guru_set_focus (GtkWidget *window, GtkWidget *focus_widget,
NameGuruState *state)
NameGuruState *state)
{
if (GNUMERIC_IS_EXPR_ENTRY (focus_widget)) {
workbook_set_entry (state->wbcg,
......@@ -655,6 +655,10 @@ dialog_define_names (WorkbookControlGUI *wbcg)
g_return_if_fail (wbcg != NULL);
/* Only one guru per workbook. */
if (workbook_edit_has_guru (wbcg))
return;
/* Only pop up one copy per workbook */
if (gnumeric_dialog_raise_if_exists (wbcg, DEFINE_NAMES_KEY))
return;
......
......@@ -1292,7 +1292,7 @@ do_print_ok_cb (GtkWidget *w, PrinterSetupState *state)
static void
do_print_set_focus_cb (GtkWidget *window, GtkWidget *focus_widget,
PrinterSetupState *state)
PrinterSetupState *state)
{
if (GNUMERIC_IS_EXPR_ENTRY (focus_widget)) {
workbook_set_entry (state->wbcg,
......@@ -1527,6 +1527,10 @@ dialog_printer_setup (WorkbookControlGUI *wbcg, Sheet *sheet)
{
PrinterSetupState *state;
/* Only one guru per workbook. */
if (workbook_edit_has_guru (wbcg))
return;
/* Only pop up one copy per workbook */
if (gnumeric_dialog_raise_if_exists (wbcg, PRINTER_SETUP_KEY))
return;
......
......@@ -180,6 +180,10 @@ dialog_search_replace (WorkbookControlGUI *wbcg,
g_return_if_fail (wbcg != NULL);
/* Only one guru per workbook. */
if (workbook_edit_has_guru (wbcg))
return;
if (gnumeric_dialog_raise_if_exists (wbcg, SEARCH_REPLACE_KEY))
return;
......@@ -220,7 +224,7 @@ dialog_search_replace (WorkbookControlGUI *wbcg,
dd);
gtk_signal_connect (GTK_OBJECT (dialog), "set-focus",
GTK_SIGNAL_FUNC (set_focus), dd);
gtk_signal_connect (GTK_OBJECT (dd->rangetext), "focus_in_event",
gtk_signal_connect (GTK_OBJECT (dd->rangetext), "focus-in-event",
GTK_SIGNAL_FUNC (range_focused), dd);
gtk_widget_show_all (dialog->vbox);
......
......@@ -37,6 +37,10 @@ struct _WorkbookControlGUI {
GtkWidget *menu_item_sheets_edit_reorder;
GtkWidget *menu_item_sheets_format_reorder;
GtkWidget *menu_item_print_setup;
GtkWidget *menu_item_search_replace;
GtkWidget *menu_item_define_name;
/* Menu items that get toggled */
GtkWidget *menu_item_sheet_display_formulas;
GtkWidget *menu_item_sheet_hide_zero;
......
......@@ -781,6 +781,15 @@ wbcg_menu_state_update (WorkbookControl *wbc, Sheet const *sheet, int flags)
if (all || MS_PASTE_SPECIAL & flags)
change_menu_sensitivity (wbcg->menu_item_paste_special,
sheet->priv->enable_paste_special);
if (all || MS_PRINT_SETUP & flags)
change_menu_sensitivity (wbcg->menu_item_print_setup,
!workbook_edit_has_guru (wbcg));
if (all || MS_SEARCH_REPLACE & flags)
change_menu_sensitivity (wbcg->menu_item_search_replace,
!workbook_edit_has_guru (wbcg));
if (all || MS_DEFINE_NAME & flags)
change_menu_sensitivity (wbcg->menu_item_define_name,
!workbook_edit_has_guru (wbcg));
#else
if (all || MS_INSERT_COLS & flags)
change_menu_sensitivity (wbcg, "/commands/InsertColumns",
......@@ -800,6 +809,15 @@ wbcg_menu_state_update (WorkbookControl *wbc, Sheet const *sheet, int flags)
if (all || MS_PASTE_SPECIAL & flags)
change_menu_sensitivity (wbcg, "/commands/EditPasteSpecial",
sheet->priv->enable_paste_special);
if (all || MS_PRINT_SETUP & flags)
change_menu_sensitivity (wbcg, "/commands/FilePrintSetup",
!workbook_edit_has_guru (wbcg));
if (all || MS_SEARCH_REPLACE & flags)
change_menu_sensitivity (wbcg, "/commands/EditSearchReplace",
!workbook_edit_has_guru (wbcg));
if (all || MS_DEFINE_NAME & flags)
change_menu_sensitivity (wbcg, "/commands/EditNames",
!workbook_edit_has_guru (wbcg));
#endif
}
......@@ -3359,12 +3377,16 @@ workbook_control_gui_init (WorkbookControlGUI *wbcg,
/* Get the menu items that will be enabled disabled based on
* workbook state.
*/
wbcg->menu_item_print_setup =
workbook_menu_file [6].widget;
wbcg->menu_item_undo =
workbook_menu_edit [0].widget;
wbcg->menu_item_redo =
workbook_menu_edit [1].widget;
wbcg->menu_item_paste_special =
workbook_menu_edit [6].widget;
wbcg->menu_item_search_replace =
workbook_menu_edit [13].widget;
wbcg->menu_item_insert_rows =
workbook_menu_insert [1].widget;
......@@ -3372,6 +3394,8 @@ workbook_control_gui_init (WorkbookControlGUI *wbcg,
workbook_menu_insert [2].widget;
wbcg->menu_item_insert_cells =
workbook_menu_insert [3].widget;
wbcg->menu_item_define_name =
workbook_menu_names [0].widget;
wbcg->menu_item_sheet_display_formulas =
workbook_menu_format_sheet [2].widget;
......
......@@ -51,9 +51,15 @@ enum {
MS_INSERT_ROWS = 1 << 2,
MS_INSERT_CELLS = 1 << 3,
MS_SHOWHIDE_DETAIL = 1 << 4,
MS_PASTE_SPECIAL = 1 << 5
MS_PASTE_SPECIAL = 1 << 5,
MS_PRINT_SETUP = 1 << 6,
MS_SEARCH_REPLACE = 1 << 8,
MS_DEFINE_NAME = 1 << 7
};
#define MS_GURU_MENU_ITEMS \
(MS_PRINT_SETUP | MS_SEARCH_REPLACE | MS_DEFINE_NAME)
void wb_control_menu_state_update (WorkbookControl *wbc, Sheet const *s, int flags);
void wb_control_menu_state_sheet_prefs (WorkbookControl *wbc, Sheet const *s);
......
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