Commit 783d67db authored by Almer S. Tigelaar's avatar Almer S. Tigelaar Committed by Almer S. Tigelaar

Let the sensitivity filter function exacly like the display filter.

2001-01-24  Almer S. Tigelaar  <almer1@dds.nl>

        * src/gnumeric-util.c (gnumeric_create_popup_menu):
        Let the sensitivity filter function exacly like the
        display filter.

        * src/sheet-control-gui.c (scg_context_menu):
        Disable insert rows/cols according to the selected
        rows/cols. We don't want people to insert anything if
        the whole sheet is selected or if there are multiple
        selections of whole rows and cols.

        * src/workbook-control-gui.c (wbcg_insert_cols_rows_enable):
        Fix typo, "Cols" should be "Columns".
parent 52105ea8
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/gnumeric-util.c (gnumeric_create_popup_menu):
Let the sensitivity filter function exacly like the
display filter.
* src/sheet-control-gui.c (scg_context_menu):
Disable insert rows/cols according to the selected
rows/cols. We don't want people to insert anything if
the whole sheet is selected or if there are multiple
selections of whole rows and cols.
* src/workbook-control-gui.c (wbcg_insert_cols_rows_enable):
Fix typo, "Cols" should be "Columns".
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
......
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/gnumeric-util.c (gnumeric_create_popup_menu):
Let the sensitivity filter function exacly like the
display filter.
* src/sheet-control-gui.c (scg_context_menu):
Disable insert rows/cols according to the selected
rows/cols. We don't want people to insert anything if
the whole sheet is selected or if there are multiple
selections of whole rows and cols.
* src/workbook-control-gui.c (wbcg_insert_cols_rows_enable):
Fix typo, "Cols" should be "Columns".
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
......
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/gnumeric-util.c (gnumeric_create_popup_menu):
Let the sensitivity filter function exacly like the
display filter.
* src/sheet-control-gui.c (scg_context_menu):
Disable insert rows/cols according to the selected
rows/cols. We don't want people to insert anything if
the whole sheet is selected or if there are multiple
selections of whole rows and cols.
* src/workbook-control-gui.c (wbcg_insert_cols_rows_enable):
Fix typo, "Cols" should be "Columns".
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
......
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/gnumeric-util.c (gnumeric_create_popup_menu):
Let the sensitivity filter function exacly like the
display filter.
* src/sheet-control-gui.c (scg_context_menu):
Disable insert rows/cols according to the selected
rows/cols. We don't want people to insert anything if
the whole sheet is selected or if there are multiple
selections of whole rows and cols.
* src/workbook-control-gui.c (wbcg_insert_cols_rows_enable):
Fix typo, "Cols" should be "Columns".
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
......
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/gnumeric-util.c (gnumeric_create_popup_menu):
Let the sensitivity filter function exacly like the
display filter.
* src/sheet-control-gui.c (scg_context_menu):
Disable insert rows/cols according to the selected
rows/cols. We don't want people to insert anything if
the whole sheet is selected or if there are multiple
selections of whole rows and cols.
* src/workbook-control-gui.c (wbcg_insert_cols_rows_enable):
Fix typo, "Cols" should be "Columns".
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
......
......@@ -750,7 +750,7 @@ gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
item = gtk_menu_item_new ();
if (elements [i].sensitive_filter != 0 &&
elements [i].sensitive_filter != sensitive_filter)
(elements [i].sensitive_filter & sensitive_filter))
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
if (pix_name != NULL) {
......
......@@ -750,7 +750,7 @@ gnumeric_create_popup_menu (GnumericPopupMenuElement const *elements,
item = gtk_menu_item_new ();
if (elements [i].sensitive_filter != 0 &&
elements [i].sensitive_filter != sensitive_filter)
(elements [i].sensitive_filter & sensitive_filter))
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
if (pix_name != NULL) {
......
......@@ -1065,7 +1065,9 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
CONTEXT_DISPLAY_FOR_COLS = 4
};
enum {
CONTEXT_ENABLE_PASTE_SPECIAL = 1,
CONTEXT_DISABLE_PASTE_SPECIAL = 1,
CONTEXT_DISABLE_FOR_ROWS = 2,
CONTEXT_DISABLE_FOR_COLS = 4
};
static GnumericPopupMenuElement const popup_elements[] = {
......@@ -1076,7 +1078,7 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
{ N_("_Paste"), GNOME_STOCK_MENU_PASTE,
0, 0, CONTEXT_PASTE },
{ N_("Paste _Special"), NULL,
0, CONTEXT_ENABLE_PASTE_SPECIAL, CONTEXT_PASTE_SPECIAL },
0, CONTEXT_DISABLE_PASTE_SPECIAL, CONTEXT_PASTE_SPECIAL },
{ "", NULL, 0, 0, 0 },
......@@ -1092,13 +1094,13 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
{ N_("_Delete..."), NULL,
CONTEXT_DISPLAY_FOR_CELLS, 0, CONTEXT_DELETE },
{ N_("_Insert Column(s)"), "Menu_Gnumeric_ColumnAdd",
CONTEXT_DISPLAY_FOR_COLS, 0, CONTEXT_INSERT },
CONTEXT_DISPLAY_FOR_COLS, CONTEXT_DISABLE_FOR_COLS, CONTEXT_INSERT },
{ N_("_Delete Column(s)"), "Menu_Gnumeric_ColumnDelete",
CONTEXT_DISPLAY_FOR_COLS, 0, CONTEXT_DELETE },
CONTEXT_DISPLAY_FOR_COLS, CONTEXT_DISABLE_FOR_COLS, CONTEXT_DELETE },
{ N_("_Insert Row(s)"), "Menu_Gnumeric_RowAdd",
CONTEXT_DISPLAY_FOR_ROWS, 0, CONTEXT_INSERT },
CONTEXT_DISPLAY_FOR_ROWS, CONTEXT_DISABLE_FOR_ROWS, CONTEXT_INSERT },
{ N_("_Delete Row(s)"), "Menu_Gnumeric_RowDelete",
CONTEXT_DISPLAY_FOR_ROWS, 0, CONTEXT_DELETE },
CONTEXT_DISPLAY_FOR_ROWS, CONTEXT_DISABLE_FOR_ROWS, CONTEXT_DELETE },
{ N_("Clear Co_ntents"),NULL,
0, 0, CONTEXT_CLEAR_CONTENT },
......@@ -1139,13 +1141,30 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
* when there is nothing in the local clipboard, or when
* the clipboard has the results of a copy.
*/
int const sensitivity_filter =
int sensitivity_filter =
(application_clipboard_is_empty () ||
(application_clipboard_contents_get () != NULL))
? CONTEXT_ENABLE_PASTE_SPECIAL : 0;
? 0 : CONTEXT_DISABLE_PASTE_SPECIAL;
GList *l;
workbook_finish_editing (scg->wbcg, FALSE);
/*
* Now see if there is some selection which selects a
* whole row or a whole column and disable the insert/delete col/row menu items
* accordingly
*/
for (l = scg->sheet->selections; l != NULL; l = l->next) {
Range const *r = l->data;
if (r->start.row == 0 && r->end.row == SHEET_MAX_ROWS - 1)
sensitivity_filter |= CONTEXT_DISABLE_FOR_ROWS;
if (r->start.col == 0 && r->end.col == SHEET_MAX_COLS - 1)
sensitivity_filter |= CONTEXT_DISABLE_FOR_COLS;
}
gnumeric_create_popup_menu (popup_elements, &context_menu_hander,
scg, display_filter,
sensitivity_filter, event);
......
......@@ -734,7 +734,7 @@ wbcg_insert_cols_rows_enable (WorkbookControl *wbc, gboolean col, gboolean enabl
change_menu_sensitivity (wbcg->menu_item_insert_rows, enable);
#else
if (col)
change_menu_sensitivity (wbcg, "/commands/InsertCols", "/menu/Insert/Cols", enable);
change_menu_sensitivity (wbcg, "/commands/InsertColumns", "/menu/Insert/Columns", enable);
else
change_menu_sensitivity (wbcg, "/commands/InsertRows", "/menu/Insert/Rows", enable);
#endif
......
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