[gcalctool] Make numbers written with a keyboard respect sub/superscript toggles



commit 658ca3744759f549d1bf1c3cf236f0735c8ce01d
Author: Robin Sonefors <ozamosi flukkost nu>
Date:   Mon Sep 28 16:22:59 2009 +0200

    Make numbers written with a keyboard respect sub/superscript toggles

 src/gtk.c |   45 ++++++++++++++++++++++++++-------------------
 1 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/src/gtk.c b/src/gtk.c
index 41338c4..b91532b 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -965,6 +965,30 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event)
     if (state == GDK_CONTROL_MASK) {
         switch(event->keyval)
         {
+        case GDK_u:
+            do_text("µ");
+            return TRUE;
+        case GDK_e:
+            do_text("Ã?10^");
+            return TRUE;
+        case GDK_f:
+            do_button(FN_FACTORIZE, 0);
+            return TRUE;
+        case GDK_r:
+            do_text("â??");
+            return TRUE;
+        case GDK_i:
+            do_text("�¹");
+            return TRUE;
+        case GDK_p:
+            do_text("Ï?");
+            return TRUE;
+        }
+    }
+    if (state == GDK_CONTROL_MASK ||
+        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(X.superscript_toggle))) {
+        switch(event->keyval)
+        {
         case GDK_0:
             do_text("â?°");
             return TRUE;
@@ -995,27 +1019,10 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event)
         case GDK_9:
             do_text("â?¹");
             return TRUE;
-        case GDK_u:
-            do_text("µ");
-            return TRUE;
-        case GDK_e:
-            do_text("Ã?10^");
-            return TRUE;
-        case GDK_f:
-            do_button(FN_FACTORIZE, 0);
-            return TRUE;
-        case GDK_r:
-            do_text("â??");
-            return TRUE;
-        case GDK_i:
-            do_text("�¹");
-            return TRUE;
-        case GDK_p:
-            do_text("Ï?");
-            return TRUE;
         }
     }
-    else if (state == GDK_MOD1_MASK) {
+    else if (state == GDK_MOD1_MASK ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(X.subscript_toggle))) {
         switch(event->keyval)
         {
         case GDK_0:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]