gcalctool r2237 - in trunk: . gcalctool glade help help/C help/C/figures



Author: rancell
Date: Sun Sep 28 04:40:21 2008
New Revision: 2237
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2237&view=rev

Log:
Added a programming mode that contains the bit editor (Robin Sonefors, Bug #501508)


Added:
   trunk/help/C/figures/gcalctool_programming_window.png   (contents, props changed)
Modified:
   trunk/ChangeLog
   trunk/gcalctool/calctool.h
   trunk/gcalctool/get.c
   trunk/gcalctool/get.h
   trunk/gcalctool/gtk.c
   trunk/gcalctool/ui.h
   trunk/glade/gcalctool.glade
   trunk/help/C/gcalctool.xml
   trunk/help/Makefile.am

Modified: trunk/gcalctool/calctool.h
==============================================================================
--- trunk/gcalctool/calctool.h	(original)
+++ trunk/gcalctool/calctool.h	Sun Sep 28 04:40:21 2008
@@ -53,7 +53,12 @@
 enum base_type { BIN, OCT, DEC, HEX, MAXBASES };
 
 /* Calculator modes. */
-enum mode_type { BASIC, ADVANCED, FINANCIAL, SCIENTIFIC, MAXMODES };
+enum mode_type { BASIC, 
+                 ADVANCED,
+                 FINANCIAL,
+                 SCIENTIFIC,
+                 PROGRAMMING,
+                 MAXMODES };
 
 /* Number display mode. */
 enum num_type { ENG, FIX, SCI, MAXDISPMODES };
@@ -143,7 +148,6 @@
 #define MAX_CONSTANTS 10
 #define MAX_FUNCTIONS 10
 #define MAX_REGISTERS 10         /* Maximum number of memory registers. */
-#define MAXBITCALC     2          /* Choices for bitcalculating */
 
 #ifndef MIN
 #define MIN(x,y)       ((x) < (y) ? (x) : (y))

Modified: trunk/gcalctool/get.c
==============================================================================
--- trunk/gcalctool/get.c	(original)
+++ trunk/gcalctool/get.c	Sun Sep 28 04:40:21 2008
@@ -42,7 +42,7 @@
 char *Rbstr[MAXBASES]     = { "BIN", "OCT", "DEC", "HEX" };
 char *Rdstr[MAXDISPMODES] = { "ENG", "FIX", "SCI" };
 char *Rmstr[MAXMODES]     = { "BASIC", "ADVANCED", "FINANCIAL", 
-                              "SCIENTIFIC" };
+                              "SCIENTIFIC", "PROGRAMMING" };
 char *Rtstr[MAXTRIGMODES] = { "DEG", "GRAD", "RAD" };
 
 static GConfClient *client = NULL;

Modified: trunk/gcalctool/get.h
==============================================================================
--- trunk/gcalctool/get.h	(original)
+++ trunk/gcalctool/get.h	Sun Sep 28 04:40:21 2008
@@ -32,7 +32,6 @@
 #define R_TRIG     "trigtype"
 #define R_ZEROES   "showzeroes"
 #define R_TSEP     "showthousands"
-#define R_BITCALC  "bitcalculating"
 #define R_XPOS     "xposition"
 #define R_YPOS     "yposition"
 

Modified: trunk/gcalctool/gtk.c
==============================================================================
--- trunk/gcalctool/gtk.c	(original)
+++ trunk/gcalctool/gtk.c	Sun Sep 28 04:40:21 2008
@@ -53,18 +53,15 @@
 /* Window titles dependant on mode */
 static char *titles[] = {
     N_("Calculator"), N_("Calculator - Advanced"), N_("Calculator - Financial"),
-    N_("Calculator - Scientific")
+    N_("Calculator - Scientific"), N_("Calculator - Programming")
 };
 
 /* Window titles dependant on mode and hostname */
 static char *hostname_titles[] = {
     N_("Calculator [%s]"), N_("Calculator [%s] - Advanced"), N_("Calculator [%s] - Financial"),
-    N_("Calculator [%s] - Scientific")
+    N_("Calculator [%s] - Scientific"), N_("Calculator [%s] - Programming")
 };
 
-/* FIXME: Config value for boolean bitcalculating mode is a string... */
-static char *Rcstr[MAXBITCALC]   = { "NO_BITCALCULATING_MODE", "BITCALCULATING_MODE" };
-
 /*  This table shows the keyboard values that are currently being used:
  *
  *           |  a b c d e f g h i j k l m n o p q r s t u v w x y z
@@ -455,7 +452,6 @@
     char *shelf;                       /* PUT selection shelf contents. */   
 
     gboolean warn_change_mode;    /* Should we warn user when changing modes? */
-    gboolean bitcalculating_mode;
 };
 
 typedef struct Xobject *XVars;
@@ -621,35 +617,6 @@
 
 
 void
-ui_set_show_bitcalculating(gboolean visible)
-{
-    GtkWidget *menu;
-
-    X->bitcalculating_mode = visible;
-    ui_set_mode(v->modetype);
-    set_resource(R_BITCALC, Rcstr[visible ? 1 : 0]);
-
-    menu = GET_WIDGET("show_bitcalculating_menu");
-    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), visible);
-
-    if (visible) {
-        /* Translators: When the bit editor is visible, there will be two
-         * rows of ones and zeroes shown. When the number being displayed in
-         * in the calculator is an integer value, these ones and zeroes will
-         * be sensitive, and they will correspond to the value of each of 
-         * the bits in the displayed integer number. By clicking on any of 
-         * the labels for these ones and zeroes, their value can be toggled
-         * (a one becomes a zero and a zero becomes a one), causing the 
-         * displayed integer value to be adjusted accordingly.
-         */
-        ui_set_statusbar(_("Bit editor activated. Click on bit values to toggle them."), "");
-    } else {
-        ui_set_statusbar("", "");
-    }
-}
-
-
-void
 ui_set_show_trailing_zeroes(gboolean visible)
 {
     GtkWidget *menu;
@@ -808,14 +775,13 @@
     g_object_set(G_OBJECT(X->bas_panel),  "visible", mode == BASIC, NULL);
     g_object_set(G_OBJECT(X->adv_panel),  "visible", mode != BASIC, NULL);
     g_object_set(G_OBJECT(X->fin_panel),  "visible", mode == FINANCIAL, NULL);
-    g_object_set(G_OBJECT(X->mode_panel), "visible", mode == SCIENTIFIC, NULL);
-    g_object_set(G_OBJECT(X->sci_panel),  "visible", mode == SCIENTIFIC, NULL);
-    g_object_set(G_OBJECT(X->bit_panel),  "visible",
-                 mode == SCIENTIFIC && X->bitcalculating_mode, NULL);
-    gtk_widget_set_sensitive(GET_WIDGET("show_bitcalculating_menu"),
-                             mode == SCIENTIFIC);
+    g_object_set(G_OBJECT(X->mode_panel), "visible", 
+                 mode == SCIENTIFIC || mode == PROGRAMMING, NULL);
+    g_object_set(G_OBJECT(X->sci_panel),  "visible", 
+                 mode == SCIENTIFIC || mode == PROGRAMMING, NULL);
+    g_object_set(G_OBJECT(X->bit_panel),  "visible", mode == PROGRAMMING, NULL);
     gtk_widget_set_sensitive(GET_WIDGET("show_trailing_zeroes_menu"),
-                             mode == SCIENTIFIC);
+                             mode == SCIENTIFIC || mode == PROGRAMMING);
     gtk_widget_set_sensitive(GET_WIDGET("show_registers_menu"),
                              mode != BASIC);
     
@@ -879,6 +845,10 @@
             menu = GET_WIDGET("view_scientific_menu");
             break;
         
+        case PROGRAMMING:
+            menu = GET_WIDGET("view_programming_menu");
+            break;
+
         default:
             assert(FALSE);
             return;
@@ -1007,10 +977,10 @@
     gtk_widget_set_sensitive(GET_WIDGET("view_financial_menu"),  !v->error); 
     gtk_widget_set_sensitive(GET_WIDGET("view_scientific_menu"), !v->error); 
     gtk_widget_set_sensitive(GET_WIDGET("show_trailing_zeroes_menu"),
-                             !v->error && (v->modetype == SCIENTIFIC)); 
+                             !v->error && (v->modetype == SCIENTIFIC || 
+                                           v->modetype == PROGRAMMING)); 
     gtk_widget_set_sensitive(GET_WIDGET("show_thousands_separator_menu"),
                              !v->error); 
-    gtk_widget_set_sensitive(GET_WIDGET("show_bitcalculating_menu"), !v->error);
     gtk_widget_set_sensitive(GET_WIDGET("show_registers_menu"), !v->error); 
 
     gtk_widget_set_sensitive(GET_WIDGET("about_menu"), !v->error);
@@ -1902,7 +1872,8 @@
     }
     
     /* Accuracy shortcuts */
-    if (state == GDK_CONTROL_MASK && v->modetype == SCIENTIFIC) {
+    if (state == GDK_CONTROL_MASK && (v->modetype == SCIENTIFIC || 
+                                      v->modetype == PROGRAMMING)) {
         switch (event->keyval) {
             case GDK_0:
                 do_button(KEY_SET_ACCURACY, 0);
@@ -2176,16 +2147,6 @@
 
 
 /*ARGSUSED*/
-static void 
-show_bitcalculating_cb(GtkWidget *widget)
-{
-    gboolean visible;  
-    visible = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
-    ui_set_show_bitcalculating(visible);
-}
-
-
-/*ARGSUSED*/
 static void
 show_registers_cb(GtkWidget *widget)
 {
@@ -2221,7 +2182,7 @@
  * (unless we are in Scientific mode with Decimal numeric base and Fixed).
  */
     if (display_is_result(&v->display) &&
-        ((v->modetype != SCIENTIFIC) ||
+        ((v->modetype != SCIENTIFIC && v->modetype != PROGRAMMING) ||
          (v->dtype == FIX && v->base == DEC))) {
         v->modetype = mode;
         ui_set_mode(v->modetype);
@@ -2424,7 +2385,6 @@
     CONNECT_SIGNAL(about_cb);
     CONNECT_SIGNAL(show_trailing_zeroes_cb);
     CONNECT_SIGNAL(show_thousands_separator_cb);
-    CONNECT_SIGNAL(show_bitcalculating_cb);
     CONNECT_SIGNAL(show_registers_cb);
     CONNECT_SIGNAL(accuracy_radio_cb);
     CONNECT_SIGNAL(accuracy_other_cb);
@@ -2584,7 +2544,6 @@
     set_menubar_tooltip("view_scientific_menu");
     set_menubar_tooltip("show_trailing_zeroes_menu");
     set_menubar_tooltip("show_thousands_separator_menu");
-    set_menubar_tooltip("show_bitcalculating_menu");
     set_menubar_tooltip("show_registers_menu");
     set_menubar_tooltip("help_menu");
     set_menubar_tooltip("about_menu");
@@ -2685,6 +2644,8 @@
                       "calcmode", GINT_TO_POINTER(FINANCIAL));
     g_object_set_data(G_OBJECT(GET_WIDGET("view_scientific_menu")),
                       "calcmode", GINT_TO_POINTER(SCIENTIFIC));
+    g_object_set_data(G_OBJECT(GET_WIDGET("view_programming_menu")),
+                      "calcmode", GINT_TO_POINTER(PROGRAMMING));
 
     /* Make shortcuts for accuracy menus */
     accel_group = gtk_accel_group_new();
@@ -2738,8 +2699,7 @@
 ui_load(void)
 {
     int boolval;
-    char *resource, text[MAXLINE];
-    gboolean show_bit;
+    char text[MAXLINE];
     GtkWidget *widget;
 
     read_cfdefs();
@@ -2748,17 +2708,8 @@
     create_kframe();
     
     /* Load configuration */
-    resource = get_resource(R_BITCALC);
-    if(resource) {
-        show_bit = strcmp(resource, Rcstr[0]) != 0;
-        g_free(resource);
-    } else {
-        show_bit = FALSE;
-    }
-
     ui_set_show_thousands_separator(v->show_tsep);
     ui_set_show_trailing_zeroes(v->show_zeroes);
-    ui_set_show_bitcalculating(show_bit);
     
     ui_set_mode(v->modetype);
     ui_set_numeric_mode(FIX);

Modified: trunk/gcalctool/ui.h
==============================================================================
--- trunk/gcalctool/ui.h	(original)
+++ trunk/gcalctool/ui.h	Sun Sep 28 04:40:21 2008
@@ -44,7 +44,6 @@
 void ui_set_trigonometric_mode(enum trig_type);
 void ui_set_numeric_mode(enum base_type);
 void ui_set_show_thousands_separator(gboolean);
-void ui_set_show_bitcalculating(gboolean);
 void ui_set_show_trailing_zeroes(gboolean);
 
 void ui_set_error_state(gboolean);

Modified: trunk/glade/gcalctool.glade
==============================================================================
--- trunk/glade/gcalctool.glade	(original)
+++ trunk/glade/gcalctool.glade	Sun Sep 28 04:40:21 2008
@@ -234,6 +234,21 @@
 		  </child>
 
 		  <child>
+		    <widget class="GtkRadioMenuItem" id="view_programming_menu">
+		      <property name="visible">True</property>
+		      <property name="tooltip" translatable="yes">Programming</property>
+		      <property name="label" translatable="yes">_Programming</property>
+		      <property name="use_underline">True</property>
+		      <property name="active">False</property>
+		      <property name="group">view_basic_menu</property>
+		      <signal name="select" handler="menu_item_select_cb"/>
+		      <signal name="deselect" handler="menu_item_deselect_cb"/>
+		      <signal name="activate" handler="mode_radio_cb" last_modification_time="Sun, 27 Sep 2008 22:50:04 GMT"/>
+		      <accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+		    </widget>
+		  </child>
+
+		  <child>
 		    <widget class="GtkSeparatorMenuItem" id="separator1">
 		      <property name="visible">True</property>
 		    </widget>
@@ -268,30 +283,6 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkCheckMenuItem" id="show_bitcalculating_menu">
-		      <property name="visible">True</property>
-		      <property name="tooltip" translatable="yes" comments="When the bit editor is visible, there will be two rows of ones
-and zeroes shown. When the number being displayed in
-in the calculator is an integer value, these ones and zeroes will be sensitive, and they will correspond to the value of each of the bits in the displayed integer number. By clicking on any of the labels for these ones and zeroes, their value can be toggled (a one becomes a zero and a zero becomes a one), causing the displayed integer value to be adjusted accordingly.">Show bit editor</property>
-		      <property name="label" translatable="yes" comments="When the bit editor is visible, there will be two rows of ones
-and zeroes shown. When the number being displayed in
-in the calculator is an integer value, these ones and zeroes will be sensitive, and they will correspond to the value of each of the bits in the displayed integer number. By clicking on any of the labels for these ones and zeroes, their value can be toggled (a one becomes a zero and a zero becomes a one), causing the displayed integer value to be adjusted accordingly.">Show Bit _Editor</property>
-		      <property name="use_underline">True</property>
-		      <property name="active">False</property>
-		      <accessibility>
-			<atkproperty name="AtkObject::accessible_name" translatable="yes" comments="When the bit editor is visible, there will be two rows of ones
-and zeroes shown. When the number being displayed in
-in the calculator is an integer value, these ones and zeroes will be sensitive, and they will correspond to the value of each of the bits in the displayed integer number. By clicking on any of the labels for these ones and zeroes, their value can be toggled (a one becomes a zero and a zero becomes a one), causing the displayed integer value to be adjusted accordingly.">Show Bit Editor</atkproperty>
-			<atkproperty name="AtkObject::accessible_description" translatable="yes">Show bit editor</atkproperty>
-		      </accessibility>
-		      <signal name="select" handler="menu_item_select_cb"/>
-		      <signal name="deselect" handler="menu_item_deselect_cb"/>
-		      <signal name="activate" handler="show_bitcalculating_cb" last_modification_time="Sat, 13 Oct 2007 00:50:25 GMT"/>
-		      <accelerator key="E" modifiers="GDK_CONTROL_MASK" signal="activate"/>
-		    </widget>
-		  </child>
-
-		  <child>
 		    <widget class="GtkSeparatorMenuItem" id="separator2">
 		      <property name="visible">True</property>
 		    </widget>

Added: trunk/help/C/figures/gcalctool_programming_window.png
==============================================================================
Binary file. No diff available.

Modified: trunk/help/C/gcalctool.xml
==============================================================================
--- trunk/help/C/gcalctool.xml	(original)
+++ trunk/help/C/gcalctool.xml	Sun Sep 28 04:40:21 2008
@@ -205,6 +205,10 @@
         <term><link linkend="gcalctool-scientific-mode">Scientific </link></term>
         <listitem><para>Provides many additional mathematical functions, including trigonometric and bitwise functions. You can also store your own functions and constants, when you use Scientific mode.</para></listitem>
         </varlistentry>
+		<varlistentry>
+		<term><link linkend="gcalctool-programming-mode">Programming </link></term>
+		<listitem><para>Provides functions useful to a programmer. Currently the same thing as the scientific mode, but with a bit editor.</para></listitem>
+		</varlistentry>
      </variablelist>
 
     <para>You can use &app; in the following numbering systems:</para>
@@ -1657,11 +1661,6 @@
 		  </tgroup>
 		</table>
     </sect3>
-    <sect3 id="gcalctool-calc-bit-manipulation-ext">
-      <title>To Perform Bit Manipulations on Integers</title>
-      <para>To change the values of individuals bits in integer values, choose <menuchoice><guimenu>View</guimenu><guimenuitem>Show Bit Editor</guimenuitem></menuchoice>. This option is only available in Scientific mode.</para>
-      <para>If the calculator display shows an integer value, then each of the bits in that integer value is displayed as a collection of 0's and 1's. By clicking on any of these individual bits, their value can be toggled, causing the displayed integer value to be adjusted accordingly.</para>
-    </sect3>
     <sect3 id="gcalctool-enter-exp"> 
       <title>To Enter Exponential Numbers</title> 
       <para>To enter exponential numbers, use the <guibutton>Exp</guibutton> button.</para>
@@ -2106,6 +2105,36 @@
 		</table>
     </sect3>
     </sect2> 
+    <sect2 id="gcalctool-programming-mode">
+      <title>To Perform Programming Calculations</title>
+      <para>To change to Programming mode, choose 
+	<menuchoice> 
+	  <guimenu>View</guimenu> 
+	  <guimenuitem>Programming</guimenuitem> 
+	</menuchoice>. 
+      </para>
+    <para>When you change to Programming mode, the following widget is displayed above the Scientific mode buttons:</para>
+
+    <!-- ==== Figure ==== -->
+      <figure id="gcalctool-FIG-programming"> 
+	<title>&app; Programming Mode Buttons</title> 
+	<screenshot> 
+	  <mediaobject> 
+	    <imageobject><imagedata
+		fileref="figures/gcalctool_programming_window.png" format="PNG"/> 
+	    </imageobject>
+	    <textobject> 
+	      <phrase>Shows &app; Programming mode buttons.  </phrase> 
+	    </textobject> 
+	  </mediaobject> 
+	</screenshot> 
+      </figure>
+    <!-- ==== End of Figure ==== -->
+    <sect3 id="gcalctool-calc-bit-manipulation-ext">
+      <title>To Perform Bit Manipulations on Integers</title>
+      <para>If the calculator display shows an integer value, then each of the bits in that integer value is displayed as a collection of 0's and 1's in the Bit Editor. By clicking on any of these individual bits, their value can be toggled, causing the displayed integer value to be adjusted accordingly.</para>
+    </sect3>
+    </sect2>
 <!-- ============= Undo and Redo ======================== -->
   <sect2 id="gcalctool-undo-redo">
     <title>To Undo and Redo</title>
@@ -2731,12 +2760,6 @@
                              <entry><para><xref linkend="gcalctool-calc-functions"/></para> </entry>
                            </row>
                            <row valign="top">
-                             <entry><para><keycombo><keycap>Ctrl</keycap><keycap>e</keycap></keycombo></para></entry>
-                             <entry><para> <menuchoice> <guimenu>View</guimenu> <guimenuitem>Show Bitcalculating Extension</guimenuitem> </menuchoice> </para></entry>
-                             <entry><para>Display the bitcalculation extension</para> </entry>
-                             <entry><para><xref linkend="gcalctool-calc-bit-manipulation-ext"/></para> </entry>
-                           </row>
-                           <row valign="top">
                              <entry><para><keycombo><keycap>Ctrl</keycap><keycap>f</keycap></keycombo></para></entry>
                              <entry><para> <menuchoice> <guimenu>View</guimenu> <guimenuitem>Financial </guimenuitem> </menuchoice> </para></entry>
                              <entry><para>Change to Financial mode</para> </entry>
@@ -2774,6 +2797,12 @@
                              <entry><para><xref linkend="gcalctool-mem-reg"/></para> </entry>
                            </row>
                            <row valign="top">
+                             <entry><para><keycombo><keycap>Ctrl</keycap><keycap>p</keycap></keycombo></para></entry>
+							 <entry><para> <menuchoice> <guimenu>View</guimenu> <guimenuitem>Programming</guimenuitem> </menuchoice> </para></entry>
+                             <entry><para>Change to Programming mode</para> </entry>
+                             <entry><para><xref linkend="gcalctool-programming-mode"/></para> </entry>
+                           </row>
+                           <row valign="top">
                              <entry><para><keycombo><keycap>Ctrl</keycap><keycap>q</keycap></keycombo></para></entry>
                              <entry><para> <menuchoice> <guimenu>Calculator</guimenu> <guimenuitem>Quit</guimenuitem> </menuchoice> </para></entry>
                              <entry><para>Quit the &app; application</para> </entry>

Modified: trunk/help/Makefile.am
==============================================================================
--- trunk/help/Makefile.am	(original)
+++ trunk/help/Makefile.am	Sun Sep 28 04:40:21 2008
@@ -8,6 +8,7 @@
               figures/gcalctool_basic_window.png	\
               figures/gcalctool_financial_window.png	\
               figures/gcalctool_menu_symbol.png		\
-              figures/gcalctool_scientific_window.png
+              figures/gcalctool_scientific_window.png 	\
+              figures/gcalctool_programming_window.png
 
 DOC_LINGUAS = bg ca de es fr it ja ko oc pt_BR ru sv zh_CN zh_HK zh_TW



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