[gnumeric] Add menu item to select sheet objects. [#338615]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Add menu item to select sheet objects. [#338615]
- Date: Sun, 27 Dec 2009 22:49:34 +0000 (UTC)
commit 3c70f771ba56773c7bae8f90cef147caeb1e2a48
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Sun Dec 27 15:49:04 2009 -0700
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
ChangeLog | 16 ++++++++++++++++
NEWS | 1 +
component/Gnumeric-embed.xml.in | 1 +
src/GNOME_Gnumeric-gtk.xml.in | 1 +
src/HILDON_Gnumeric-gtk.xml.in | 1 +
src/gnm-pane.c | 32 ++++++++------------------------
src/sheet-control-gui.c | 39 +++++++++++++++++++++++++++++++++++++++
src/sheet-control-gui.h | 1 +
src/sheet-view.c | 5 +++++
src/wbc-gtk-actions.c | 9 +++++++++
src/wbc-gtk.c | 4 ++++
src/workbook-control.h | 6 ++++--
12 files changed, 90 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8258ead..fee4f18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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
diff --git a/NEWS b/NEWS
index 06937ec..f53149b 100644
--- a/NEWS
+++ b/NEWS
@@ -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]
diff --git a/component/Gnumeric-embed.xml.in b/component/Gnumeric-embed.xml.in
index f120233..1dbbd91 100644
--- a/component/Gnumeric-embed.xml.in
+++ b/component/Gnumeric-embed.xml.in
@@ -71,6 +71,7 @@
<menuitem action="EditSelectArray"/>
<menuitem action="EditSelectDepends"/>
<menuitem action="EditSelectInputs"/>
+ <menuitem action="EditSelectObject"/>
<separator name="edit-sep5"/>
<menuitem action="EditGoto"/>
</menu>
diff --git a/src/GNOME_Gnumeric-gtk.xml.in b/src/GNOME_Gnumeric-gtk.xml.in
index c4c10a9..22d1646 100644
--- a/src/GNOME_Gnumeric-gtk.xml.in
+++ b/src/GNOME_Gnumeric-gtk.xml.in
@@ -70,6 +70,7 @@
<menuitem action="EditSelectArray"/>
<menuitem action="EditSelectDepends"/>
<menuitem action="EditSelectInputs"/>
+ <menuitem action="EditSelectObject"/>
<separator name="edit-sep5"/>
<menuitem action="EditGoto"/>
</menu>
diff --git a/src/HILDON_Gnumeric-gtk.xml.in b/src/HILDON_Gnumeric-gtk.xml.in
index 3f816e1..e93184e 100644
--- a/src/HILDON_Gnumeric-gtk.xml.in
+++ b/src/HILDON_Gnumeric-gtk.xml.in
@@ -79,6 +79,7 @@
<menuitem action="EditSelectArray"/>
<menuitem action="EditSelectDepends"/>
<menuitem action="EditSelectInputs"/>
+ <menuitem action="EditSelectObject"/>
</menu>
<menuitem action="EditRecalc"/>
<placeholder name="ops"/>
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index 2a12540..cec7d3a 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -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)
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index f98e9ed..50ccf9a 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -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;
diff --git a/src/sheet-control-gui.h b/src/sheet-control-gui.h
index 7afff49..96abb69 100644
--- a/src/sheet-control-gui.h
+++ b/src/sheet-control-gui.h
@@ -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);
diff --git a/src/sheet-view.c b/src/sheet-view.c
index 2b398cf..7fc108a 100644
--- a/src/sheet-view.c
+++ b/src/sheet-view.c
@@ -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 *
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 258360d..b2001a7 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -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) },
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index d6cdf0a..1c74865 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -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
diff --git a/src/workbook-control.h b/src/workbook-control.h
index 0de7ad6..14d7164 100644
--- a/src/workbook-control.h
+++ b/src/workbook-control.h
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]