[gnumeric] Fix status of sub- and superscript buttons. [#662474]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix status of sub- and superscript buttons. [#662474]
- Date: Wed, 2 Nov 2011 15:51:04 +0000 (UTC)
commit 41b65e122243d209ad7db1673ca8e82a783f367c
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Nov 2 09:50:36 2011 -0600
Fix status of sub- and superscript buttons. [#662474]
2011-11-02 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/mstyle.c (gnm_style_set_from_pango_attribute): handle super- and
subscripts
* src/wbc-gtk.c (wbc_gtk_style_feedback_real): reset sub-/superscript action
ChangeLog | 6 ++++++
NEWS | 1 +
src/mstyle.c | 22 +++++++++++++++++++++-
src/wbc-gtk.c | 3 +++
4 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7b5903b..c95413e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2011-11-02 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/mstyle.c (gnm_style_set_from_pango_attribute): handle super- and
+ subscripts
+ * src/wbc-gtk.c (wbc_gtk_style_feedback_real): reset sub-/superscript action
+
+2011-11-02 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* component/Gnumeric-embed.xml.in: add Format->Text menu
* src/GNOME_Gnumeric-gtk.xml.in: add Format->Text menu
* src/wbc-gtk-actions.c (permanent_actions): add submenus
diff --git a/NEWS b/NEWS
index e0ee06c..8ecc58e 100644
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ Andreas:
* Improve shape import from ODF. [#663078]
* Improve text import/export from and to ODF. [#627509, #663135]
* Import hyperlinks from ODF. [#603533]
+ * Fix status of sub- and superscript buttons. [#662474]
Jean:
* Make things build against gtk+-3.0.
diff --git a/src/mstyle.c b/src/mstyle.c
index d4d3507..0e007f0 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -1798,9 +1798,29 @@ gnm_style_set_from_pango_attribute (GnmStyle *style, PangoAttribute const *attr)
gnm_style_set_font_strike (style,
((PangoAttrInt *)attr)->value != 0);
break;
- default :
+ default : {
+ gboolean script_seen = FALSE, script_set = FALSE;
+ if (attr->klass->type == go_pango_attr_superscript_get_type ()) {
+ script_seen = TRUE;
+ if (((GOPangoAttrSuperscript *)attr)->val == 1) {
+ script_set = TRUE;
+ gnm_style_set_font_script
+ (style, GO_FONT_SCRIPT_SUPER);
+ }
+ } else if (attr->klass->type == go_pango_attr_subscript_get_type ()) {
+ script_seen = TRUE;
+ if (((GOPangoAttrSubscript *)attr)->val == 1) {
+ script_set = TRUE;
+ gnm_style_set_font_script
+ (style, GO_FONT_SCRIPT_SUB);
+ }
+ }
+ if (script_seen && !script_set)
+ gnm_style_set_font_script
+ (style, GO_FONT_SCRIPT_STANDARD);
break; /* ignored */
}
+ }
}
/* ------------------------------------------------------------------------- */
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 6f95446..8eee657 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -3503,6 +3503,9 @@ wbc_gtk_style_feedback_real (WorkbookControl *wbc, GnmStyle const *changes)
gnm_style_get_font_script (changes) == GO_FONT_SCRIPT_SUPER);
gtk_toggle_action_set_active (wbcg->font.subscript,
gnm_style_get_font_script (changes) == GO_FONT_SCRIPT_SUB);
+ } else {
+ gtk_toggle_action_set_active (wbcg->font.superscript, FALSE);
+ gtk_toggle_action_set_active (wbcg->font.subscript, FALSE);
}
if (gnm_style_is_element_set (changes, MSTYLE_ALIGN_H)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]