Commit 3c70f771 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Add menu item to select sheet objects. [#338615]

2009-12-27  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* component/Gnumeric-embed.xml.in: add EditSelectObject menu item
	* src/GNOME_Gnumeric-gtk.xml.in: ditto
	* src/HILDON_Gnumeric-gtk.xml.in: ditto
	* src/gnm-pane.c (gnm_pane_object_key_press): move some code from
	  here to scg_object_select_next
	(gnm_pane_key_mode_sheet): use ctrl-tab to select the first object
	* src/sheet-control-gui.c (scg_object_select_next): new
	* src/sheet-control-gui.h (scg_object_select_next): new
	* src/sheet-view.c (sv_update): update MS_SELECT_OBJECT menu
	* src/wbc-gtk-actions.c (cb_edit_select_object): new
	(EditSelectObject): new action
	* src/wbc-gtk.c (wbcg_menu_state_update): handle MS_SELECT_OBJECT
	* src/workbook-control.h (MS_SELECT_OBJECT): new
parent c088dbcd
2009-12-27 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* component/Gnumeric-embed.xml.in: add EditSelectObject menu item
* src/GNOME_Gnumeric-gtk.xml.in: ditto
* src/HILDON_Gnumeric-gtk.xml.in: ditto
* src/gnm-pane.c (gnm_pane_object_key_press): move some code from
here to scg_object_select_next
(gnm_pane_key_mode_sheet): use ctrl-tab to select the first object
* src/sheet-control-gui.c (scg_object_select_next): new
* src/sheet-control-gui.h (scg_object_select_next): new
* src/sheet-view.c (sv_update): update MS_SELECT_OBJECT menu
* src/wbc-gtk-actions.c (cb_edit_select_object): new
(EditSelectObject): new action
* src/wbc-gtk.c (wbcg_menu_state_update): handle MS_SELECT_OBJECT
* src/workbook-control.h (MS_SELECT_OBJECT): new
2009-12-27 Jean Brefort <jean.brefort@normalesup.org>
* src/gnm-pane.c (control_point_set_cursor): use the right cursor in RTL
......
......@@ -11,6 +11,7 @@ Andreas:
* Print sheet widget objects. [#144787]
* Allow sheet object sizes to be specified via a dialog.
* Allow the sheet object name to be specified. [#596545]
* Add menu item to select sheet objects. [#338615]
Jean
* Fix import export of line type in scatter plots. [#605043]
......
......@@ -71,6 +71,7 @@
<menuitem action="EditSelectArray"/>
<menuitem action="EditSelectDepends"/>
<menuitem action="EditSelectInputs"/>
<menuitem action="EditSelectObject"/>
<separator name="edit-sep5"/>
<menuitem action="EditGoto"/>
</menu>
......
......@@ -70,6 +70,7 @@
<menuitem action="EditSelectArray"/>
<menuitem action="EditSelectDepends"/>
<menuitem action="EditSelectInputs"/>
<menuitem action="EditSelectObject"/>
<separator name="edit-sep5"/>
<menuitem action="EditGoto"/>
</menu>
......
......@@ -79,6 +79,7 @@
<menuitem action="EditSelectArray"/>
<menuitem action="EditSelectDepends"/>
<menuitem action="EditSelectInputs"/>
<menuitem action="EditSelectObject"/>
</menu>
<menuitem action="EditRecalc"/>
<placeholder name="ops"/>
......
......@@ -114,30 +114,9 @@ gnm_pane_object_key_press (GnmPane *pane, GdkEventKey *ev)
case GDK_Tab:
case GDK_ISO_Left_Tab:
case GDK_KP_Tab:
if (scg->selected_objects != NULL) {
Sheet *sheet = sc_sheet (sc);
GSList *prev = NULL, *ptr = sheet->sheet_objects;
for (; ptr != NULL ; prev = ptr, ptr = ptr->next)
if (NULL != g_hash_table_lookup (scg->selected_objects, ptr->data)) {
SheetObject *target;
if ((ev->state & GDK_SHIFT_MASK)) {
if (ptr->next == NULL)
target = sheet->sheet_objects->data;
else
target = ptr->next->data;
} else {
if (NULL == prev) {
GSList *last = g_slist_last (ptr);
target = last->data;
} else
target = prev->data;
}
if (ptr->data != target) {
scg_object_unselect (scg, NULL);
scg_object_select (scg, target);
return TRUE;
}
}
if ((scg_sheet (scg))->sheet_objects != NULL) {
scg_object_select_next (scg, (ev->state & GDK_SHIFT_MASK) != 0);
return TRUE;
}
break;
......@@ -422,6 +401,11 @@ gnm_pane_key_mode_sheet (GnmPane *pane, GdkEventKey *event,
if (is_enter) {
horizontal = go_direction_is_horizontal (dir);
forward = go_direction_is_forward (dir);
} else if ((event->state & GDK_CONTROL_MASK) &&
((sc_sheet (sc))->sheet_objects != NULL)) {
scg_object_select_next
(scg, (event->state & GDK_SHIFT_MASK) != 0);
break;
}
if (event->state & GDK_SHIFT_MASK)
......
......@@ -2137,6 +2137,45 @@ scg_object_unselect (SheetControlGUI *scg, SheetObject *so)
wb_control_update_action_sensitivity (scg_wbc (scg));
}
void
scg_object_select_next (SheetControlGUI *scg, gboolean reverse)
{
Sheet *sheet = scg_sheet (scg);
GSList *ptr = sheet->sheet_objects;
g_return_if_fail (ptr != NULL);
if ((scg->selected_objects == NULL) ||
(g_hash_table_size (scg->selected_objects) == 0)) {
scg_object_select (scg, ptr->data);
return;
} else {
GSList *prev = NULL;
for (; ptr != NULL ; prev = ptr, ptr = ptr->next)
if (NULL != g_hash_table_lookup
(scg->selected_objects, ptr->data)) {
SheetObject *target;
if (reverse) {
if (ptr->next == NULL)
target = sheet->sheet_objects->data;
else
target = ptr->next->data;
} else {
if (NULL == prev) {
GSList *last = g_slist_last (ptr);
target = last->data;
} else
target = prev->data;
}
if (ptr->data != target) {
scg_object_unselect (scg, NULL);
scg_object_select (scg, target);
return;
}
}
}
}
typedef struct {
SheetControlGUI *scg;
GnmPane *pane;
......
......@@ -40,6 +40,7 @@ void scg_objects_nudge (SheetControlGUI *scg, GnmPane *gcanvas,
void scg_object_select (SheetControlGUI *scg, SheetObject *so);
void scg_object_unselect (SheetControlGUI *scg, SheetObject *so);
void scg_object_select_next (SheetControlGUI *scg, gboolean reverse);
void scg_comment_select (SheetControlGUI *scg, GnmComment *cc);
void scg_comment_display (SheetControlGUI *scg, GnmComment *cc);
......
......@@ -654,6 +654,11 @@ sv_update (SheetView *sv)
SHEET_VIEW_FOREACH_CONTROL (sv, sc,
wb_control_menu_state_update (sc_wbc (sc), MS_ADD_VS_REMOVE_FILTER););
}
SHEET_VIEW_FOREACH_CONTROL (sv, sc,
wb_control_menu_state_update
(sc_wbc (sc), MS_SELECT_OBJECT););
}
static GnmValue *
......
......@@ -379,6 +379,10 @@ static GNM_ACTION_DEF (cb_edit_select_inputs)
{
sv_select_cur_inputs (wb_control_cur_sheet_view (WORKBOOK_CONTROL (wbcg)));
}
static GNM_ACTION_DEF (cb_edit_select_object)
{
scg_object_select_next (wbcg_cur_scg (wbcg), FALSE);
}
static GNM_ACTION_DEF (cb_edit_cut)
{
......@@ -1860,6 +1864,11 @@ static GtkActionEntry const actions[] = {
{ "EditSelectInputs", NULL, N_("_Inputs"),
"<control>bracketleft", N_("Select all the cells are used by the current edit cell"),
G_CALLBACK (cb_edit_select_inputs) },
{ "EditSelectObject", NULL, N_("Next _Object"),
"<control>Tab", N_("Select the next sheet object"),
G_CALLBACK (cb_edit_select_object) },
{ "EditGoto", GTK_STOCK_JUMP_TO, N_("_Goto cell..."),
"<control>G", N_("Jump to a specified cell"),
G_CALLBACK (cb_edit_goto) },
......
......@@ -1497,6 +1497,10 @@ wbcg_menu_state_update (WorkbookControl *wbc, int flags)
wbc_gtk_set_action_sensitivity (wbcg, "FilePrintAreaClear", has_print_area);
wbc_gtk_set_action_sensitivity (wbcg, "FilePrintAreaShow", has_print_area);
}
if (MS_SELECT_OBJECT & flags) {
wbc_gtk_set_action_sensitivity (wbcg, "EditSelectObject",
sheet->sheet_objects != NULL);
}
if (MS_FREEZE_VS_THAW & flags) {
/* Cheat and use the same accelerator for both states because
......
......@@ -54,14 +54,16 @@ enum {
MS_CONSOLIDATE = 1 << 8,
MS_FREEZE_VS_THAW = 1 << 9,
MS_ADD_VS_REMOVE_FILTER = 1 << 10,
MS_SHOW_PRINTAREA = 1 << 11
MS_SHOW_PRINTAREA = 1 << 11,
MS_SELECT_OBJECT = 1 << 12
};
#define MS_ALL \
(MS_INSERT_COLS | MS_INSERT_ROWS | MS_INSERT_CELLS | \
MS_SHOWHIDE_DETAIL | MS_PASTE_SPECIAL | \
MS_PRINT_SETUP | MS_SEARCH_REPLACE | MS_DEFINE_NAME | MS_CONSOLIDATE | \
MS_FREEZE_VS_THAW | MS_ADD_VS_REMOVE_FILTER | MS_SHOW_PRINTAREA)
MS_FREEZE_VS_THAW | MS_ADD_VS_REMOVE_FILTER | MS_SHOW_PRINTAREA | \
MS_SELECT_OBJECT)
#define MS_GURU_MENU_ITEMS \
(MS_PRINT_SETUP | MS_SEARCH_REPLACE | MS_DEFINE_NAME | MS_CONSOLIDATE)
......
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