[Libreoffice-commits] core.git: sc/source sc/uiconfig

Caolán McNamara caolanm at redhat.com
Mon Jul 15 02:00:12 PDT 2013


 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |   46 +--
 sc/uiconfig/scalc/ui/randomnumbergenerator.ui                  |  125 +++++-----
 2 files changed, 94 insertions(+), 77 deletions(-)

New commits:
commit a86af5919e19d989ee9344071b1bb13140cb83ef
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 15 09:50:21 2013 +0100

    attempt at HIG compliance (./bin/lint-ui.py path/to/.ui)
    
    and tweak some strings
    
    Change-Id: Ib5886e8bbb6de653682df36b59aa60d9c39aef30

diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index 356a54d..cc06041 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -213,63 +213,63 @@ void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
         {
             boost::random::uniform_real_distribution<> distribution(parameter1, parameter2);
             boost::variate_generator<boost::mt19937&, boost::random::uniform_real_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_UNIFORM_REAL)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_UNIFORM_REAL));
             break;
         }
         case DIST_UNIFORM_INTEGER:
         {
             boost::random::uniform_int_distribution<> distribution(parameterInteger1, parameterInteger2);
             boost::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_UNIFORM_INTEGER)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_UNIFORM_INTEGER));
             break;
         }
         case DIST_NORMAL:
         {
             boost::random::normal_distribution<> distribution(parameter1, parameter2);
             boost::variate_generator<boost::mt19937&, boost::random::normal_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_NORMAL)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_NORMAL));
             break;
         }
         case DIST_CAUCHY:
         {
             boost::random::cauchy_distribution<> distribution(parameter1);
             boost::variate_generator<boost::mt19937&, boost::random::cauchy_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_CAUCHY)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_CAUCHY));
             break;
         }
         case DIST_BERNOULLI:
         {
             boost::random::bernoulli_distribution<> distribution(parameter1);
             boost::variate_generator<boost::mt19937&, boost::random::bernoulli_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_BERNOULLI)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_BERNOULLI));
             break;
         }
         case DIST_BINOMIAL:
         {
             boost::random::binomial_distribution<> distribution(parameterInteger2, parameter1);
             boost::variate_generator<boost::mt19937&, boost::random::binomial_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_BINOMIAL)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_BINOMIAL));
             break;
         }
         case DIST_NEGATIVE_BINOMIAL:
         {
             boost::random::negative_binomial_distribution<> distribution(parameterInteger2, parameter1);
             boost::variate_generator<boost::mt19937&, boost::random::negative_binomial_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_NEGATIVE_BINOMIAL)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_NEGATIVE_BINOMIAL));
             break;
         }
         case DIST_CHI_SQUARED:
         {
             boost::random::chi_squared_distribution<> distribution(parameter1);
             boost::variate_generator<boost::mt19937&, boost::random::chi_squared_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_CHI_SQUARED)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_CHI_SQUARED));
             break;
         }
         case DIST_GEOMETRIC:
         {
             boost::random::geometric_distribution<> distribution(parameter1);
             boost::variate_generator<boost::mt19937&, boost::random::geometric_distribution<> > rng(seed, distribution);
-            GenerateNumbers(rng, OUString(ScResId(STR_DISTRIBUTION_GEOMETRIC)));
+            GenerateNumbers(rng, SC_RESSTR(STR_DISTRIBUTION_GEOMETRIC));
             break;
         }
     }
@@ -278,8 +278,8 @@ void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
 template<class RNG>
 void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG randomGenerator, OUString aDistributionName)
 {
-    OUString aUndo = ScResId(STR_UNDO_DISTRIBUTION_TEMPLATE);
-    aUndo = aUndo.replaceAll( OUString("$(DISTRIBUTION)"),  aDistributionName );
+    OUString aUndo = SC_RESSTR(STR_UNDO_DISTRIBUTION_TEMPLATE);
+    aUndo = aUndo.replaceAll("$(DISTRIBUTION)",  aDistributionName);
 
     ScDocShell* pDocShell = mViewData->GetDocShell();
     svl::IUndoManager* pUndoManager = pDocShell->GetUndoManager();
@@ -407,19 +407,19 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, DistributionChanged)
     {
         case DIST_UNIFORM:
         {
-            mpParameter1Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_MINIMUM)));
-            mpParameter2Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_MAXIMUM)));
+            mpParameter1Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_MINIMUM));
+            mpParameter2Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_MAXIMUM));
             mpParameter2Text->Show();
             mpParameter2Value->Show();
             break;
         }
         case DIST_UNIFORM_INTEGER:
         {
-            mpParameter1Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_MINIMUM)));
+            mpParameter1Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_MINIMUM));
             mpParameter1Value->SetDecimalDigits(0);
             mpParameter1Value->SetSpinSize(1);
 
-            mpParameter2Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_MAXIMUM)));
+            mpParameter2Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_MAXIMUM));
             mpParameter2Value->SetDecimalDigits(0);
             mpParameter2Value->SetSpinSize(1);
 
@@ -429,16 +429,16 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, DistributionChanged)
         }
         case DIST_NORMAL:
         {
-            mpParameter1Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_MEAN)));
-            mpParameter2Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_STANDARD_DEVIATION)));
+            mpParameter1Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_MEAN));
+            mpParameter2Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_STANDARD_DEVIATION));
             mpParameter2Text->Show();
             mpParameter2Value->Show();
             break;
         }
         case DIST_CAUCHY:
         {
-            mpParameter1Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_STANDARD_MEDIAN)));
-            mpParameter2Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_STANDARD_SIGMA)));
+            mpParameter1Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_STANDARD_MEDIAN));
+            mpParameter2Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_STANDARD_SIGMA));
             mpParameter2Text->Show();
             mpParameter2Value->Show();
             break;
@@ -446,7 +446,7 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, DistributionChanged)
         case DIST_BERNOULLI:
         case DIST_GEOMETRIC:
         {
-            mpParameter1Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_STANDARD_PROBABILITY)));
+            mpParameter1Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_STANDARD_PROBABILITY));
             mpParameter1Value->SetMin(         0 );
             mpParameter1Value->SetMax( PERCISION );
             mpParameter1Value->SetSpinSize(1000);
@@ -458,12 +458,12 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, DistributionChanged)
         case DIST_BINOMIAL:
         case DIST_NEGATIVE_BINOMIAL:
         {
-            mpParameter1Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_STANDARD_PROBABILITY)));
+            mpParameter1Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_STANDARD_PROBABILITY));
             mpParameter1Value->SetMin(         0 );
             mpParameter1Value->SetMax( PERCISION );
             mpParameter1Value->SetSpinSize(1000);
 
-            mpParameter2Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_STANDARD_NUMBER_OF_TRIALS)));
+            mpParameter2Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_STANDARD_NUMBER_OF_TRIALS));
             mpParameter2Value->SetDecimalDigits(0);
             mpParameter2Value->SetSpinSize(1);
             mpParameter2Value->SetMin(0);
@@ -474,7 +474,7 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, DistributionChanged)
         }
         case DIST_CHI_SQUARED:
         {
-            mpParameter1Text->SetText(OUString(ScResId(STR_RNG_PARAMETER_STANDARD_NU_VALUE)));
+            mpParameter1Text->SetText(SC_RESSTR(STR_RNG_PARAMETER_STANDARD_NU_VALUE));
 
             mpParameter2Text->Hide();
             mpParameter2Value->Hide();
diff --git a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
index fa05540..25ec143 100644
--- a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
+++ b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
@@ -8,66 +8,15 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkListStore" id="distribution-liststore">
-    <columns>
-      <!-- column-name value -->
-      <column type="gchararray"/>
-      <!-- column-name id -->
-      <column type="gint"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Uniform</col>
-        <col id="1">0</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Uniform Integer</col>
-        <col id="1">8</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Normal</col>
-        <col id="1">1</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Cauchy</col>
-        <col id="1">2</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Bernoulli</col>
-        <col id="1">3</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Binomial</col>
-        <col id="1">4</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Chi Squared</col>
-        <col id="1">5</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Geometric</col>
-        <col id="1">6</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Negative Binomial</col>
-        <col id="1">7</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkAdjustment" id="parameter2-adjustment">
-    <property name="upper">100</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
   <object class="GtkDialog" id="RandomNumberGeneratorDialog">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">6</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
@@ -136,6 +85,7 @@
               <object class="GtkAlignment" id="alignment1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="top_padding">6</property>
                 <property name="left_padding">12</property>
                 <child>
                   <object class="GtkGrid" id="grid1">
@@ -149,6 +99,8 @@
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">Cell Range</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">cell-range-edit</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -192,6 +144,8 @@
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">Distribution</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">distribution-combo</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -234,6 +188,8 @@
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">Seed</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">seed-spin</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -247,7 +203,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="label_xalign">0</property>
-                        <property name="shadow_type">in</property>
+                        <property name="shadow_type">none</property>
                         <child>
                           <object class="GtkAlignment" id="alignment2">
                             <property name="visible">True</property>
@@ -269,6 +225,8 @@
                                     <property name="hexpand">True</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">...</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">parameter1-spin</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
@@ -284,6 +242,8 @@
                                     <property name="hexpand">True</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">...</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">parameter2-spin</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
@@ -333,6 +293,9 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="label" translatable="yes">Parameters</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                         </child>
                       </object>
@@ -368,6 +331,9 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Random Number Generator</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
               </object>
             </child>
           </object>
@@ -385,4 +351,55 @@
       <action-widget response="0">cancel</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkListStore" id="distribution-liststore">
+    <columns>
+      <!-- column-name value -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Uniform</col>
+        <col id="1">0</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Uniform Integer</col>
+        <col id="1">8</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Normal</col>
+        <col id="1">1</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Cauchy</col>
+        <col id="1">2</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Bernoulli</col>
+        <col id="1">3</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Binomial</col>
+        <col id="1">4</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Chi Squared</col>
+        <col id="1">5</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Geometric</col>
+        <col id="1">6</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Negative Binomial</col>
+        <col id="1">7</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkAdjustment" id="parameter2-adjustment">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
 </interface>


More information about the Libreoffice-commits mailing list