Commit be02e2b8 authored by Almer S. Tigelaar's avatar Almer S. Tigelaar Committed by Almer S. Tigelaar

Add flag for insert cells.

2001-02-18  Almer S. Tigelaar  <almer1@dds.nl>

	* src/sheet-private.h : Add flag for insert cells.

	* src/workbook-control-gui.c :
	(wbcg_insert_cells_enable) : New, enable/disable the Insert->Cells menu item.
	(workbook_control_gui_init) : Initialize the insert_cells menu item.
	(workbook_control_gui_ctor_class) : Initialize insert_cells function pointer.

	* src/workbook-control-gui.h : Add menu_item_insert_cells.

	* src/workbook-control.c, src/workbook-control.h, src/workbook-control-priv.h :
	Export wbcg_insert_cell_enable to workbook-control.

	* src/selection.c
	(sheet_selection_set_internal) : If the whole sheet is selected,
	disable Insert->Cells. Otherwise enable it.
	(sheet_selection_reset) : Enable Insert->Cells.

 	* src/workbook-view.c
 	(wb_view_menus_update) : Update Insert->Cells too.
parent 963f5b6e
2001-02-18 Almer S. Tigelaar <almer1@dds.nl>
* src/sheet-private.h : Add flag for insert cells.
* src/workbook-control-gui.c :
(wbcg_insert_cells_enable) : New, enable/disable the Insert->Cells menu item.
(workbook_control_gui_init) : Initialize the insert_cells menu item.
(workbook_control_gui_ctor_class) : Initialize insert_cells function pointer.
* src/workbook-control-gui.h : Add menu_item_insert_cells.
* src/workbook-control.c, src/workbook-control.h, src/workbook-control-priv.h :
Export wbcg_insert_cell_enable to workbook-control.
* src/selection.c
(sheet_selection_set_internal) : If the whole sheet is selected,
disable Insert->Cells. Otherwise enable it.
(sheet_selection_reset) : Enable Insert->Cells.
* src/workbook-view.c
(wb_view_menus_update) : Update Insert->Cells too.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
......
2001-02-18 Almer S. Tigelaar <almer1@dds.nl>
* src/sheet-private.h : Add flag for insert cells.
* src/workbook-control-gui.c :
(wbcg_insert_cells_enable) : New, enable/disable the Insert->Cells menu item.
(workbook_control_gui_init) : Initialize the insert_cells menu item.
(workbook_control_gui_ctor_class) : Initialize insert_cells function pointer.
* src/workbook-control-gui.h : Add menu_item_insert_cells.
* src/workbook-control.c, src/workbook-control.h, src/workbook-control-priv.h :
Export wbcg_insert_cell_enable to workbook-control.
* src/selection.c
(sheet_selection_set_internal) : If the whole sheet is selected,
disable Insert->Cells. Otherwise enable it.
(sheet_selection_reset) : Enable Insert->Cells.
* src/workbook-view.c
(wb_view_menus_update) : Update Insert->Cells too.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
......
2001-02-18 Almer S. Tigelaar <almer1@dds.nl>
* src/sheet-private.h : Add flag for insert cells.
* src/workbook-control-gui.c :
(wbcg_insert_cells_enable) : New, enable/disable the Insert->Cells menu item.
(workbook_control_gui_init) : Initialize the insert_cells menu item.
(workbook_control_gui_ctor_class) : Initialize insert_cells function pointer.
* src/workbook-control-gui.h : Add menu_item_insert_cells.
* src/workbook-control.c, src/workbook-control.h, src/workbook-control-priv.h :
Export wbcg_insert_cell_enable to workbook-control.
* src/selection.c
(sheet_selection_set_internal) : If the whole sheet is selected,
disable Insert->Cells. Otherwise enable it.
(sheet_selection_reset) : Enable Insert->Cells.
* src/workbook-view.c
(wb_view_menus_update) : Update Insert->Cells too.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
......
2001-02-18 Almer S. Tigelaar <almer1@dds.nl>
* src/sheet-private.h : Add flag for insert cells.
* src/workbook-control-gui.c :
(wbcg_insert_cells_enable) : New, enable/disable the Insert->Cells menu item.
(workbook_control_gui_init) : Initialize the insert_cells menu item.
(workbook_control_gui_ctor_class) : Initialize insert_cells function pointer.
* src/workbook-control-gui.h : Add menu_item_insert_cells.
* src/workbook-control.c, src/workbook-control.h, src/workbook-control-priv.h :
Export wbcg_insert_cell_enable to workbook-control.
* src/selection.c
(sheet_selection_set_internal) : If the whole sheet is selected,
disable Insert->Cells. Otherwise enable it.
(sheet_selection_reset) : Enable Insert->Cells.
* src/workbook-view.c
(wb_view_menus_update) : Update Insert->Cells too.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
......
2001-02-18 Almer S. Tigelaar <almer1@dds.nl>
* src/sheet-private.h : Add flag for insert cells.
* src/workbook-control-gui.c :
(wbcg_insert_cells_enable) : New, enable/disable the Insert->Cells menu item.
(workbook_control_gui_init) : Initialize the insert_cells menu item.
(workbook_control_gui_ctor_class) : Initialize insert_cells function pointer.
* src/workbook-control-gui.h : Add menu_item_insert_cells.
* src/workbook-control.c, src/workbook-control.h, src/workbook-control-priv.h :
Export wbcg_insert_cell_enable to workbook-control.
* src/selection.c
(sheet_selection_set_internal) : If the whole sheet is selected,
disable Insert->Cells. Otherwise enable it.
(sheet_selection_reset) : Enable Insert->Cells.
* src/workbook-view.c
(wb_view_menus_update) : Update Insert->Cells too.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
......
......@@ -502,6 +502,14 @@ set_menu_flags:
WORKBOOK_FOREACH_CONTROL (sheet->workbook, view, control,
wb_control_insert_cols_rows_enable (control, sheet););
}
if ((do_rows | do_cols) != sheet->priv->enable_insert_cells) {
sheet->priv->enable_insert_cells = do_rows | do_cols;
WORKBOOK_FOREACH_CONTROL (sheet->workbook, view, control,
wb_control_insert_cells_enable (control, sheet););
}
}
void
......@@ -601,12 +609,15 @@ sheet_selection_reset (Sheet *sheet)
g_list_free (list);
sheet->priv->enable_insert_cols = TRUE;
sheet->priv->enable_insert_rows = TRUE;
sheet->priv->enable_insert_cols = TRUE;
sheet->priv->enable_insert_rows = TRUE;
sheet->priv->enable_insert_cells = TRUE;
/* Make sure we re-enable the insert col/rows menu items */
/* Make sure we re-enable the insert col/rows and cells menu items */
WORKBOOK_FOREACH_CONTROL (sheet->workbook, view, control,
wb_control_insert_cols_rows_enable (control, sheet););
WORKBOOK_FOREACH_CONTROL (sheet->workbook, view, control,
wb_control_insert_cells_enable (control, sheet););
}
static void
......
......@@ -17,6 +17,7 @@ struct _SheetPrivate {
/* State of menu items */
gboolean enable_insert_rows;
gboolean enable_insert_cols;
gboolean enable_insert_cells;
gboolean enable_paste_special;
gboolean selection_content_changed;
......
......@@ -28,6 +28,7 @@ struct _WorkbookControlGUI {
GtkWidget *menu_item_paste_special;
GtkWidget *menu_item_insert_rows;
GtkWidget *menu_item_insert_cols;
GtkWidget *menu_item_insert_cells;
/* Toolbars */
GtkWidget *standard_toolbar;
......
......@@ -706,6 +706,20 @@ wbcg_insert_cols_rows_enable (WorkbookControl *wbc, Sheet *sheet)
#endif
}
static void
wbcg_insert_cells_enable (WorkbookControl *wbc, Sheet *sheet)
{
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)wbc;
g_return_if_fail (wbcg != NULL);
#ifndef ENABLE_BONOBO
change_menu_sensitivity (wbcg->menu_item_insert_cells, sheet->priv->enable_insert_cells);
#else
change_menu_sensitivity (wbcg, "/commands/InsertCells", "/menu/Insert/Cells", sheet->priv->enable_insert_cells);
#endif
}
static void
change_menu_label (
#ifndef ENABLE_BONOBO
......@@ -3128,6 +3142,7 @@ workbook_control_gui_init (WorkbookControlGUI *wbcg,
wbcg->menu_item_paste_special = workbook_menu_edit[6].widget;
wbcg->menu_item_insert_rows = workbook_menu_insert[1].widget;
wbcg->menu_item_insert_cols = workbook_menu_insert[2].widget;
wbcg->menu_item_insert_cells = workbook_menu_insert[3].widget;
#else
bonobo_window_set_contents (BONOBO_WINDOW (wbcg->toplevel), wbcg->table);
......@@ -3252,6 +3267,7 @@ workbook_control_gui_ctor_class (GtkObjectClass *object_class)
wbc_class->paste.from_selection = wbcg_paste_from_selection;
wbc_class->insert_cols_rows_enable = wbcg_insert_cols_rows_enable;
wbc_class->insert_cells_enable = wbcg_insert_cells_enable;
wbc_class->claim_selection = wbcg_claim_selection;
}
......
......@@ -47,6 +47,7 @@ typedef struct {
PasteTarget const *pt, guint32 time);
} paste;
void (*insert_cols_rows_enable) (WorkbookControl *wbc, Sheet *sheet);
void (*insert_cells_enable) (WorkbookControl *wbc, Sheet *sheet);
gboolean (*claim_selection) (WorkbookControl *wbc);
} WorkbookControlClass;
......
......@@ -97,6 +97,8 @@ WBC_VIRTUAL_FULL (undo_redo_labels, undo_redo.labels,
WBC_VIRTUAL_FULL (insert_cols_rows_enable, insert_cols_rows_enable,
(WorkbookControl *wbc, Sheet *sheet), (wbc, sheet))
WBC_VIRTUAL_FULL (insert_cells_enable, insert_cells_enable,
(WorkbookControl *wbc, Sheet *sheet), (wbc, sheet))
WBC_VIRTUAL_FULL (paste_special_enable, paste.special_enable,
(WorkbookControl *wbc, Sheet *sheet), (wbc, sheet))
......
......@@ -43,7 +43,8 @@ void wb_control_undo_redo_labels (WorkbookControl *wbc,
char const *undo, char const *redo);
void wb_control_insert_cols_rows_enable (WorkbookControl *wbc, Sheet *sheet);
void wb_control_paste_special_enable (WorkbookControl *wbc, Sheet *sheet);
void wb_control_insert_cells_enable (WorkbookControl *wbc, Sheet *sheet);
void wb_control_paste_special_enable (WorkbookControl *wbc, Sheet *sheet);
void wb_control_paste_from_selection (WorkbookControl *wbc,
PasteTarget const *pt, guint32 time);
......
......@@ -204,6 +204,7 @@ wb_view_menus_update (WorkbookView *wbv)
if (sheet != NULL) {
WORKBOOK_VIEW_FOREACH_CONTROL (wbv, control, {
wb_control_insert_cols_rows_enable (control, sheet);
wb_control_insert_cells_enable (control, sheet);
wb_control_paste_special_enable (control, sheet);
});
}
......
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