[gnumeric] Improve range markers when editing formulas. [#664754]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve range markers when editing formulas. [#664754]
- Date: Thu, 24 Nov 2011 21:08:38 +0000 (UTC)
commit 945dc002bf7eff92e4556bbc71a259da873e787d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Nov 24 14:08:07 2011 -0700
Improve range markers when editing formulas. [#664754]
2011-11-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* gnumeric-expr-entry.c (gee_scan_for_range): use the lexer items if the
expression is incomplete.
NEWS | 1 +
src/widgets/ChangeLog | 9 +++++-
src/widgets/gnumeric-expr-entry.c | 48 +++++++++++++++++++++++++++++++-----
3 files changed, 49 insertions(+), 9 deletions(-)
---
diff --git a/NEWS b/NEWS
index b0c93bb..a6e1649 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,7 @@ Andreas:
* Add cell view to auto expression. [#455712]
* Fix import/export of interpolation methods from/to ODF. [#664351]
* Fix leak. [#664447]
+ * Improve range markers when editing formulas. [#664754]
Jean:
* Make things build against gtk+-3.0.
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index 17cb392..251c0d4 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,7 +1,12 @@
+2011-11-24 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * gnumeric-expr-entry.c (gee_scan_for_range): use the lexer items if the
+ expression is incomplete.
+
2011-11-22 Andreas J. Guelzow <aguelzow pyrshep ca>
- * src/widgets/gnm-validation-combo-view.c: rename enums
- * src/widgets/widget-font-selector.c: rename enums
+ * gnm-validation-combo-view.c: rename enums
+ * widget-font-selector.c: rename enums
2011-10-26 Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index b2ccd12..1bbda66 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -301,7 +301,7 @@ cb_icon_clicked (GtkButton *icon,
container_props = g_value_array_new (n);
for (ui = 0; ui < n; ui++) {
- GValue value = { 0 };
+ GValue value;
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (container_props_pspec[ui]));
gtk_container_child_get_property (GTK_CONTAINER (old_entry_parent), GTK_WIDGET (entry),
@@ -625,6 +625,40 @@ gee_scan_for_range (GnmExprEntry *gee)
}
g_slist_free_full (list, (GDestroyNotify)value_release);
+ } else if (gee->lexer_items != NULL) {
+ GnmLexerItem *gli = gee->lexer_items;
+ do {
+ if (gli->token == RANGEREF) {
+ char const *text = gtk_entry_get_text (gee->entry);
+ char *rtext = g_strndup (text + gli->start,
+ gli->end - gli->start);
+ char const *tmp;
+ GnmRangeRef rr;
+ tmp = rangeref_parse (&rr, rtext,
+ &gee->pp, gee_convs (gee));
+ if (tmp != rtext) {
+ GnmRange r;
+ GnmRange const *merge; /* [#127415] */
+ Sheet *start_sheet, *end_sheet;
+ gnm_rangeref_normalize_pp (&rr, &gee->pp,
+ &start_sheet,
+ &end_sheet,
+ &r);
+ if (start_sheet != sheet ||
+ end_sheet != sheet)
+ continue;
+ if (range_is_singleton (&r) &&
+ NULL != (merge = gnm_sheet_merge_is_corner
+ (sheet, &r.start)))
+ r = *merge;
+ SCG_FOREACH_PANE
+ (gee->scg, pane,
+ gnm_pane_expr_cursor_bound_set
+ (pane, &r, FALSE););
+ }
+ g_free (rtext);
+ }
+ } while (gli++->token != 0);
}
gnm_expr_entry_find_range (gee);
if (gnm_expr_entry_get_rangesel (gee, &range, &parse_sheet) &&
@@ -1072,8 +1106,8 @@ gee_check_tooltip (GnmExprEntry *gee)
goto not_found;
if (gnm_debug_flag ("functooltip"))
- g_print ("last token consider is %d from %2"
- G_GSIZE_FORMAT " to %2" G_GSIZE_FORMAT "\n",
+ g_print ("Last token considered is %d from %2"
+ G_GSIZE_FORMAT " to %2" G_GSIZE_FORMAT ".\n",
gli->token, gli->start, gli->end);
@@ -1160,9 +1194,9 @@ gee_check_tooltip (GnmExprEntry *gee)
}
static gboolean
-cb_gee_focus_out_event (GtkWidget *widget,
- GdkEventFocus *event,
- gpointer user_data)
+cb_gee_focus_out_event (G_GNUC_UNUSED GtkWidget *widget,
+ G_GNUC_UNUSED GdkEventFocus *event,
+ gpointer user_data)
{
gee_delete_tooltip (user_data, FALSE);
return FALSE;
@@ -1429,7 +1463,7 @@ cb_gee_button_press_event (G_GNUC_UNUSED GtkEntry *entry,
}
static gboolean
-gee_mnemonic_activate (GtkWidget *w, gboolean group_cycling)
+gee_mnemonic_activate (GtkWidget *w, G_GNUC_UNUSED gboolean group_cycling)
{
GnmExprEntry *gee = GNM_EXPR_ENTRY (w);
gtk_widget_grab_focus (GTK_WIDGET (gee->entry));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]