[gnumeric] Add argument tool tips to formula guru



commit 3824de9b1eb168458b30249d101c8eee7ba341a5
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Jun 15 13:44:57 2010 -0600

    Add argument tool tips to formula guru
    
    2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-formula-guru.c (dialog_formula_guru_adjust_children): load
    	  tooltip
    	(dialog_formula_guru_init): set up tooltips
    
    2010-06-15 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/func.h (tokenized_help_*): deleted
    	(gnm_func_get_arg_description): new
    	* src/func.c (tokenized_help_*): deleted
    	(gnm_func_get_arg_description): new
    	(gnm_func_sanity_check1): check for empty arg descriptions
    
    2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* functions.c: fix empty argument descriptions

 ChangeLog                         |    8 +++
 plugins/fn-lookup/ChangeLog       |    4 ++
 plugins/fn-lookup/functions.c     |    4 +-
 plugins/fn-stat/ChangeLog         |    4 ++
 plugins/fn-stat/functions.c       |   51 ++++++++++-----------
 src/dialogs/ChangeLog             |    6 +++
 src/dialogs/dialog-formula-guru.c |   25 ++++++++++-
 src/func.c                        |   90 +++++++++++++++----------------------
 src/func.h                        |   15 +-----
 9 files changed, 111 insertions(+), 96 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b02724d..0d6b95a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/func.h (tokenized_help_*): deleted
+	(gnm_func_get_arg_description): new
+	* src/func.c (tokenized_help_*): deleted
+	(gnm_func_get_arg_description): new
+	(gnm_func_sanity_check1): check for empty arg descriptions
+
 2010-06-15  Morten Welinder  <terra gnome org>
 
 	* src/gnm-datetime.c (datetime_value_to_seconds): Improve sanity
diff --git a/plugins/fn-lookup/ChangeLog b/plugins/fn-lookup/ChangeLog
index 3245448..aab5eec 100644
--- a/plugins/fn-lookup/ChangeLog
+++ b/plugins/fn-lookup/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* functions.c: fix empty argument descriptions
+
 2010-06-13  Morten Welinder  <terra gnome org>
 
 	* functions.c (help_sheet, help_sheets): Remove help entries that
diff --git a/plugins/fn-lookup/functions.c b/plugins/fn-lookup/functions.c
index b234e14..d0bdf83 100644
--- a/plugins/fn-lookup/functions.c
+++ b/plugins/fn-lookup/functions.c
@@ -1194,7 +1194,7 @@ gnumeric_match (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 
 static GnmFuncHelp const help_indirect[] = {
 	{ GNM_FUNC_HELP_NAME, F_("INDIRECT:contents of the cell pointed to by the @{ref_text} string")},
-        { GNM_FUNC_HELP_ARG, F_("ref_text:")},
+        { GNM_FUNC_HELP_ARG, F_("ref_text:textual reference")},
         { GNM_FUNC_HELP_ARG, F_("format:if true, @{ref_text} is given in A1-style, "
 				"otherwise it is given in R1C1 style; defaults to true")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{ref_text} is not a valid reference in the style determined "
@@ -1232,7 +1232,7 @@ gnumeric_indirect (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 
 static GnmFuncHelp const help_index[] = {
 	{ GNM_FUNC_HELP_NAME, F_("INDEX:reference to a cell in the given @{array}")},
-        { GNM_FUNC_HELP_ARG, F_("array:")},
+        { GNM_FUNC_HELP_ARG, F_("array:cell or inline array")},
         { GNM_FUNC_HELP_ARG, F_("row:desired row, defaults to 1")},
         { GNM_FUNC_HELP_ARG, F_("col:desired column, defaults to 1")},
         { GNM_FUNC_HELP_ARG, F_("area:from which area to select a cell, defaults to 1")},
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index 1271026..41ffc5c 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* functions.c: fix empty argument descriptions
+
 2010-06-14 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* functions.c: fix arg description of binom.dist.range
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index dc33865..2b94afb 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -410,7 +410,7 @@ gnumeric_negbinomdist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_normsdist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("NORMSDIST:cumulative density function of the standard normal distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
 	{ GNM_FUNC_HELP_ODF, F_("NORMSDIST is the OpenFormula function LEGACY.NORMSDIST.") },
 	{ GNM_FUNC_HELP_EXAMPLES, "=NORMSDIST(2)" },
@@ -462,7 +462,7 @@ gnumeric_normsinv (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_lognormdist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("LOGNORMDIST:cumulative distribution function of the lognormal distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("mean:mean")},
 	{ GNM_FUNC_HELP_ARG, F_("stddev:standard deviation")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{stddev} = 0 LOGNORMDIST returns a #DIV/0! error.")},
@@ -523,7 +523,7 @@ gnumeric_loginv (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_fisherinv[] = {
 	{ GNM_FUNC_HELP_NAME, F_("FISHERINV:inverse of the Fisher transformation")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{x} is a non-number this function returns a #VALUE! error.")},
 	{ GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
 	{ GNM_FUNC_HELP_EXAMPLES, "=FISHERINV(2)" },
@@ -843,7 +843,7 @@ gnumeric_skewp (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
 
 static GnmFuncHelp const help_expondist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("EXPONDIST:porbaility density or cumulative distribution function of the exponential distribution")},
-	   { GNM_FUNC_HELP_ARG, F_("x:")},
+	   { GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("y:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("cumulative:whether to evaluate the density function or the cumulative distribution function")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("If @{cumulative} is false it will return:\t"
@@ -876,7 +876,7 @@ gnumeric_expondist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_bernoulli[] = {
 	{ GNM_FUNC_HELP_NAME, F_("BERNOULLI:probability mass function of a Bernoulli distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("k:")},
+	{ GNM_FUNC_HELP_ARG, F_("k:integer")},
 	{ GNM_FUNC_HELP_ARG, F_("p:probability of success")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{k} != 0 and @{k} != 1 this function returns a #NUM! error.")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{p} < 0 or @{p} > 1 this function returns a #NUM! error.")},
@@ -912,7 +912,7 @@ gnumeric_bernoulli (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_gammadist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("GAMMADIST:probability density or cumulative distribution function of the gamma distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("alpha:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("beta:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("cumulative:whether to evaluate the density function or the cumulative distribution function")},
@@ -975,7 +975,7 @@ gnumeric_gammainv (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_chidist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("CHIDIST:survival function of the chi-squared distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("dof:number of degrees of freedom")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("The survival function is 1 minus the cumulative distribution function.") },
 	{ GNM_FUNC_HELP_NOTE, F_("If @{dof} is non-integer it is truncated.") },
@@ -1117,7 +1117,7 @@ gnumeric_chitest (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_betadist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("BETADIST:cumulative distribution function of the beta distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("alpha:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("beta:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("a:optional lower bound, defaults to 0")},
@@ -1189,7 +1189,7 @@ gnumeric_betainv (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_tdist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("TDIST:survival function of the Student t-distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("dof:number of degrees of freedom")},
 	{ GNM_FUNC_HELP_ARG, F_("tails:1 or 2")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("The survival function is 1 minus the cumulative distribution function.") },
@@ -1276,7 +1276,7 @@ gnumeric_tinv (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_fdist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("FDIST:survival function of the F distribution")},
-	   { GNM_FUNC_HELP_ARG, F_("x:")},
+	   { GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("dof_of_num:numerator degrees of freedom")},
 	{ GNM_FUNC_HELP_ARG, F_("dof_of_denom:denominator degrees of freedom")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("The survival function is 1 minus the cumulative distribution function.") },
@@ -1306,7 +1306,7 @@ gnumeric_fdist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_landau[] = {
 	{ GNM_FUNC_HELP_NAME, F_("LANDAU:approximate probability density function of the Landau distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_EXAMPLES, "=LANDAU(0.34)" },
 	{ GNM_FUNC_HELP_SEEALSO, "RANDLANDAU"},
 	{ GNM_FUNC_HELP_END }
@@ -1539,7 +1539,7 @@ gnumeric_binom_dist_range (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 static GnmFuncHelp const help_cauchy[] = {
 	{ GNM_FUNC_HELP_NAME, F_("CAUCHY:probability density or cumulative distribution function of the Cauchy, "
 				 "Lorentz or Breit-Wigner distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("a:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("cumulative:whether to evaluate the density function or the cumulative distribution function")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{a} < 0 this function returns a #NUM! error.") },
@@ -1718,7 +1718,7 @@ gnumeric_standardize (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_weibull[] = {
 	{ GNM_FUNC_HELP_NAME, F_("WEIBULL:probability density or cumulative distribution function of the Weibull distribution")},
-           { GNM_FUNC_HELP_ARG, F_("x:")},
+           { GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("alpha:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("beta:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("cumulative:whether to evaluate the density function or the cumulative distribution function")},
@@ -1754,7 +1754,7 @@ gnumeric_weibull (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_normdist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("NORMDIST:probability density or cumulative distribution function of a normal distribution")},
-           { GNM_FUNC_HELP_ARG, F_("x:")},
+           { GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("mean:mean of the distribution")},
 	{ GNM_FUNC_HELP_ARG, F_("stddev:standard deviation of the distribution")},
 	{ GNM_FUNC_HELP_ARG, F_("cumulative:whether to evaluate the density function or the cumulative distribution function")},
@@ -1921,7 +1921,7 @@ gnumeric_devsq (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
 
 static GnmFuncHelp const help_fisher[] = {
 	{ GNM_FUNC_HELP_NAME, F_("FISHER:Fisher transformation")},
-           { GNM_FUNC_HELP_ARG, F_("x:")},
+           { GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{x} is not a number, this function returns a #VALUE! error.") },
 	{ GNM_FUNC_HELP_NOTE, F_("If @{x} <= -1 or @{x} >= 1, this function returns a #NUM! error.")},
 	{ GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
@@ -3356,8 +3356,7 @@ static GnmFuncHelp const help_logreg[] = {
 	{ GNM_FUNC_HELP_NAME, F_("LOGREG:the logarithmic regression")},
 	{ GNM_FUNC_HELP_ARG, F_("known_ys:known y-values")},
 	{ GNM_FUNC_HELP_ARG, F_("known_xs:known x-values; defaults to the array {1, 2, 3, \xe2\x80\xa6}")},
-	{ GNM_FUNC_HELP_ARG, F_("const:if false, the curve will be forced to go through "
-				"[1; 0], i.e., b will be zero; defaults to TRUE")},
+	{ GNM_FUNC_HELP_ARG, F_("affine:if true, the model contains a constant term, defaults to true")},
 	{ GNM_FUNC_HELP_ARG, F_("stat:if true, extra statistical information will be returned; defaults to FALSE")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("LOGREG function transforms your x's to z=ln(x) and "
 					"applies the \xe2\x80\x9cleast squares\xe2\x80\x9d method to fit the linear equation "
@@ -3569,7 +3568,7 @@ static GnmFuncHelp const help_trend[] = {
 	{ GNM_FUNC_HELP_ARG, F_("known_ys:known y-values")},
 	{ GNM_FUNC_HELP_ARG, F_("known_xs:known x-values; defaults to the array {1, 2, 3, \xe2\x80\xa6}")},
 	{ GNM_FUNC_HELP_ARG, F_("new_xs:x-values for which to estimate the y-values; defaults to @{known_xs}")},
-	{ GNM_FUNC_HELP_ARG, F_("const:if this is false the line will be forced to go through the origin; defaults to TRUE")},
+	{ GNM_FUNC_HELP_ARG, F_("affine:if true, the model contains a constant term, defaults to true")},
 	{ GNM_FUNC_HELP_NOTE, F_("If @{known_ys} and @{known_xs} have unequal number of data points, "
 				 "this function returns a #NUM! error.") },
 	{ GNM_FUNC_HELP_EXAMPLES, F_("Let us assume that the cells A1, A2, \xe2\x80\xa6, A5 contain numbers "
@@ -3680,7 +3679,7 @@ static GnmFuncHelp const help_logest[] = {
 	{ GNM_FUNC_HELP_NAME, F_("LOGEST:exponential least square fit")},
 	{ GNM_FUNC_HELP_ARG, F_("known_ys:known y-values")},
 	{ GNM_FUNC_HELP_ARG, F_("known_xs:known x-values; default to an array {1, 2, 3, \xe2\x80\xa6}")},
-	{ GNM_FUNC_HELP_ARG, F_("const:if false the line will be forced to go through (0,1); defaults to TRUE")},
+	{ GNM_FUNC_HELP_ARG, F_("affine:if true, the model contains a constant term, defaults to true")},
 	{ GNM_FUNC_HELP_ARG, F_("stat:if true, extra statistical information will be returned; defaults to FALSE")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("LOGEST function applies the "
 					"\xe2\x80\x9cleast squares\xe2\x80\x9d method to fit "
@@ -3779,7 +3778,7 @@ static GnmFuncHelp const help_growth[] = {
 	{ GNM_FUNC_HELP_ARG, F_("known_ys:known y-values")},
 	{ GNM_FUNC_HELP_ARG, F_("known_xs:known x-values; defaults to the array {1, 2, 3, \xe2\x80\xa6}")},
 	{ GNM_FUNC_HELP_ARG, F_("new_xs:x-values for which to estimate the y-values; defaults to @{known_xs}")},
-	{ GNM_FUNC_HELP_ARG, F_("const:if this is false the line will be forced to go through the origin; defaults to TRUE")},
+	{ GNM_FUNC_HELP_ARG, F_("affine:if true, the model contains a constant term, defaults to true")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("GROWTH function applies the \xe2\x80\x9cleast "
 					"squares\xe2\x80\x9d method to fit an "
 					"exponential curve to your data and predicts "
@@ -4279,7 +4278,7 @@ gnumeric_geomdist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_logistic[] = {
 	{ GNM_FUNC_HELP_NAME, F_("LOGISTIC:probability density function of the logistic distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("a:scale parameter")},
 	{ GNM_FUNC_HELP_EXAMPLES, "=LOGISTIC(0.4,1)" },
 	{ GNM_FUNC_HELP_SEEALSO, "RANDLOGISTIC"},
@@ -4310,7 +4309,7 @@ gnumeric_logistic (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_pareto[] = {
 	{ GNM_FUNC_HELP_NAME, F_("PARETO:probability density function of the pareto distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("a:exponent")},
 	{ GNM_FUNC_HELP_ARG, F_("b:scale parameter")},
 	{ GNM_FUNC_HELP_EXAMPLES, "=PARETO(0.6,1,2)" },
@@ -4344,7 +4343,7 @@ gnumeric_pareto (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_rayleigh[] = {
 	{ GNM_FUNC_HELP_NAME, F_("RAYLEIGH:probability density function of the Rayleigh distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("sigma:scale parameter")},
 	{ GNM_FUNC_HELP_EXAMPLES, "=RAYLEIGH(0.4,1)" },
 	{ GNM_FUNC_HELP_SEEALSO, "RANDRAYLEIGH"},
@@ -4379,7 +4378,7 @@ gnumeric_rayleigh (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_rayleightail[] = {
 	{ GNM_FUNC_HELP_NAME, F_("RAYLEIGHTAIL:probability density function of the Rayleigh tail distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("a:lower limit")},
 	{ GNM_FUNC_HELP_ARG, F_("sigma:scale parameter")},
 	{ GNM_FUNC_HELP_EXAMPLES, "=RAYLEIGHTAIL(0.6,0.3,1)" },
@@ -4418,7 +4417,7 @@ gnumeric_rayleightail (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 static GnmFuncHelp const help_exppowdist[] = {
 	{ GNM_FUNC_HELP_NAME, F_("EXPPOWDIST:the probability density function of the "
 				 "Exponential Power distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("a:scale parameter")},
 	{ GNM_FUNC_HELP_ARG, F_("b:scale parameter")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_(
@@ -4451,7 +4450,7 @@ gnumeric_exppowdist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 static GnmFuncHelp const help_laplace[] = {
 	{ GNM_FUNC_HELP_NAME, F_("LAPLACE:probability density function of the Laplace distribution")},
-	{ GNM_FUNC_HELP_ARG, F_("x:")},
+	{ GNM_FUNC_HELP_ARG, F_("x:number")},
 	{ GNM_FUNC_HELP_ARG, F_("a:mean")},
 	{ GNM_FUNC_HELP_EXAMPLES, "=LAPLACE(0.4,1)" },
 	{ GNM_FUNC_HELP_SEEALSO, "RANDLAPLACE"},
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 94e270c..ca7ce17 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,11 @@
 2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* dialog-formula-guru.c (dialog_formula_guru_adjust_children): load 
+	  tooltip
+	(dialog_formula_guru_init): set up tooltips
+	
+2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* dialogs.h (dialog_formula_guru): change storage class of an arg
 	* dialog-function-select.c (cb_dialog_function_select_ok_clicked):
 	  change call of dialog_formula_guru
diff --git a/src/dialogs/dialog-formula-guru.c b/src/dialogs/dialog-formula-guru.c
index b395a28..22cc5a3 100644
--- a/src/dialogs/dialog-formula-guru.c
+++ b/src/dialogs/dialog-formula-guru.c
@@ -96,6 +96,7 @@ enum {
 	MIN_ARG,
 	MAX_ARG,
 	FUNCTION,
+        ARG_TOOLTIP,
 	NUM_COLMNS
 };
 
@@ -306,6 +307,8 @@ dialog_formula_guru_adjust_children (GtkTreeIter *parent, GnmFunc const *fd,
 					       &iter, parent, args))
 		gtk_tree_store_remove (state->model, &iter);
 	for (i = 0; i < args; i++) {
+		GString *desc;
+		gchar *at;
 		if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL(state->model),
 						    &iter, parent, i)) {
 			gtk_tree_store_append (state->model, &iter, parent);
@@ -323,10 +326,26 @@ dialog_formula_guru_adjust_children (GtkTreeIter *parent, GnmFunc const *fd,
 			g_free (arg_name);
 			arg_name = mod_name;
 		}
+		desc = g_string_new (g_markup_escape_text 
+				     (gnm_func_get_arg_description (fd, i), -1));
+		while ((at = strstr (desc->str, "@{"))) {
+#warning In gtk+ 2.14+ we should be using g_string_overwrite rather than g_string_erase
+			gint len = at - desc->str;
+			g_string_erase (desc, len, 2);
+			g_string_insert (desc, len, "<b><u>");
+			if ((at = strstr (desc->str + len, "}"))) {
+				len = at - desc->str;
+				g_string_erase (desc, len, 1);
+				g_string_insert (desc, len, "</u></b>");
+			} else
+				g_string_append (desc, "</u></b>");
+		}
 		gtk_tree_store_set (state->model, &iter,
 				    ARG_NAME, arg_name,
+				    ARG_TOOLTIP, desc->str,
 				    ARG_TYPE, function_def_get_arg_type_string (fd, i),
 				    -1);
+		g_string_free (desc, TRUE);
 		g_free (arg_name);
 	}
 
@@ -358,6 +377,7 @@ dialog_formula_guru_adjust_varargs (GtkTreeIter *iter, FormulaGuruState *state)
 					    IS_NON_FUN, TRUE,
 					    FUNCTION, NULL,
 					    ARG_NAME, arg_name,
+					    ARG_TOOLTIP, "",
 					    ARG_TYPE, arg_type,
 					    MIN_ARG, 0,
 					    MAX_ARG, 0,
@@ -833,7 +853,8 @@ dialog_formula_guru_init (FormulaGuruState *state)
 	scrolled = glade_xml_get_widget (state->gui, "scrolled");
 	state->model = gtk_tree_store_new (NUM_COLMNS, G_TYPE_STRING, G_TYPE_BOOLEAN,
 					   G_TYPE_STRING, G_TYPE_STRING,
-					   G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER);
+					   G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER, 
+					   G_TYPE_STRING);
 	state->treeview = GTK_TREE_VIEW (
 		gtk_tree_view_new_with_model (GTK_TREE_MODEL (state->model)));
 	g_signal_connect (state->treeview,
@@ -867,6 +888,8 @@ dialog_formula_guru_init (FormulaGuruState *state)
 							   NULL);
 	state->column = column;
 	gtk_tree_view_append_column (state->treeview, column);
+
+	gtk_tree_view_set_tooltip_column (state->treeview, ARG_TOOLTIP);
 	gtk_tree_view_set_headers_visible (state->treeview, TRUE);
 	gtk_tree_view_set_enable_tree_lines (state->treeview, TRUE);
 	gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (state->treeview));
diff --git a/src/func.c b/src/func.c
index f149451..a2532d7 100644
--- a/src/func.c
+++ b/src/func.c
@@ -574,7 +574,11 @@ gnm_func_sanity_check1 (GnmFunc const *fd)
 				g_printerr ("%s: Unwanted space in ARG record\n",
 					    fd->name);
 				res = 1;
-			} else if (h->text[strlen (h->text) - 1] == '.') {
+			} else if (aend[1] == '\0') {
+				g_printerr ("%s: Empty ARG record\n",
+					    fd->name);
+				res = 1;
+			} if (h->text[strlen (h->text) - 1] == '.') {
 				g_printerr ("%s: Unwanted period in ARG record\n",
 					    fd->name);
 				res = 1;
@@ -1241,6 +1245,37 @@ function_def_get_arg_name (GnmFunc const *fn_def, guint arg_idx)
 	return NULL;
 }
 
+/**
+ * gnm_func_get_arg_description:
+ * @fn_def: the fn defintion
+ * @arg_idx: zero based argument offset
+ *
+ * Return value: the namedescription of the argument
+ **/
+char const*
+gnm_func_get_arg_description (GnmFunc const *fn_def, guint arg_idx)
+{
+	guint arg = 0;
+	gint i;
+	g_return_val_if_fail (fn_def != NULL, NULL);
+
+	gnm_func_load_if_stub ((GnmFunc *)fn_def);
+
+	if (fn_def->help != NULL)
+		for (i = 0;
+		     fn_def->help[i].type != GNM_FUNC_HELP_END;
+		     i++) {
+			if (fn_def->help[i].type == GNM_FUNC_HELP_ARG
+			    && arg++ == arg_idx) {
+				gchar const *desc; 
+				desc = strchr (_(fn_def->help[i].text), ':');
+				return desc ? (desc + 1) : "";
+			}
+		}
+
+	return "";
+}
+
 
 /* ------------------------------------------------------------------------- */
 
@@ -1781,56 +1816,3 @@ function_iterate_argument_values (GnmEvalPos const	*ep,
 	}
 	return result;
 }
-
-/* ------------------------------------------------------------------------- */
-
-TokenizedHelp *
-tokenized_help_new (GnmFunc const *func)
-{
-	TokenizedHelp *tok;
-
-	g_return_val_if_fail (func != NULL, NULL);
-
-	gnm_func_load_if_stub ((GnmFunc *)func);
-
-	tok = g_new (TokenizedHelp, 1);
-	tok->fndef = func;
-	tok->help_copy = NULL;
-	tok->sections = NULL;
-
-	return tok;
-}
-
-/**
- * Use to find a token eg. "FUNCTION"'s value.
- **/
-char const *
-tokenized_help_find (TokenizedHelp *tok, char const *token)
-{
-	int lp;
-
-	if (!tok || !tok->sections)
-		return "Incorrect Function Description.";
-
-	for (lp = 0; lp + 1 < (int)tok->sections->len; lp++) {
-		char const *cmp = g_ptr_array_index (tok->sections, lp);
-
-		if (g_ascii_strcasecmp (cmp, token) == 0){
-			return g_ptr_array_index (tok->sections, lp + 1);
-		}
-	}
-	return "Cannot find token";
-}
-
-void
-tokenized_help_destroy (TokenizedHelp *tok)
-{
-	g_return_if_fail (tok != NULL);
-
-	g_free (tok->help_copy);
-
-	if (tok->sections)
-		g_ptr_array_free (tok->sections, TRUE);
-
-	g_free (tok);
-}
diff --git a/src/func.h b/src/func.h
index 68c77ba..a2a1c97 100644
--- a/src/func.h
+++ b/src/func.h
@@ -255,6 +255,8 @@ char const *function_def_get_arg_type_string  (GnmFunc const *fn_def,
                                         gint arg_idx);
 char       *function_def_get_arg_name  (GnmFunc const *fn_def,
                                         guint arg_idx);
+char const *gnm_func_get_arg_description (GnmFunc const *fn_def,
+                                        guint arg_idx);
 
 /*************************************************************************/
 
@@ -282,19 +284,6 @@ GnmValue *function_iterate_do_value	(GnmEvalPos const   *ep,
 					 gboolean            strict,
 					 CellIterFlags	     iter_flags);
 
-/******************************************************************************/
-
-/* Detailed function help */
-typedef struct {
-	GPtrArray *sections;
-	gboolean   help_is_localized;
-	char     *help_copy;
-	GnmFunc const *fndef;
-} TokenizedHelp;
-
-TokenizedHelp *tokenized_help_new     (GnmFunc const *fn_def);
-char const    *tokenized_help_find    (TokenizedHelp *tok, char const *token);
-void           tokenized_help_destroy (TokenizedHelp *tok);
 
 G_END_DECLS
 



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