[gnumeric] Improve the presentation of the examples in the function documentation. [#623455]



commit 18068bca3df2c95a3edee41d0887aea0c173d156
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jul 7 10:16:26 2010 -0600

    Improve the presentation of the examples in the function documentation. [#623455]
    
    2010-07-07  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-function-select.c (make_expr_example): use the suggested
    	  format
    
    2010-07-07  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* functions.c (help_weeknum): state the default for the method
    	(help_weekday): ditto

 NEWS                                 |    2 ++
 plugins/fn-date/ChangeLog            |    5 +++++
 plugins/fn-date/functions.c          |    6 +++---
 src/dialogs/ChangeLog                |    5 +++++
 src/dialogs/dialog-function-select.c |   10 +++++++---
 5 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 37580c2..f051b41 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ Andreas:
 	* Avoid creating interacting auto filters. [#607086]
 	* Improve items of the cell context menu. [#74359]
 	* Fix date function docs issue.  [#623669]
+	* Improve the presentation of the examples in the function
+	  documentation. [#623455]
 
 Jean:
 	* Fix strong/weak cursor display. [#623241]
diff --git a/plugins/fn-date/ChangeLog b/plugins/fn-date/ChangeLog
index 45d9871..f312073 100644
--- a/plugins/fn-date/ChangeLog
+++ b/plugins/fn-date/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-07  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* functions.c (help_weeknum): state the default for the method
+	(help_weekday): ditto
+
 2010-07-06  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* functions.c (help_unix2date): Correct description.  (#623669)
diff --git a/plugins/fn-date/functions.c b/plugins/fn-date/functions.c
index eb71956..c93e7d0 100644
--- a/plugins/fn-date/functions.c
+++ b/plugins/fn-date/functions.c
@@ -609,8 +609,8 @@ gnumeric_day (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 static GnmFuncHelp const help_weekday[] = {
         { GNM_FUNC_HELP_NAME, F_("WEEKDAY:day-of-week") },
         { GNM_FUNC_HELP_ARG, F_("date:date serial value")},
-        { GNM_FUNC_HELP_ARG, F_("method:numbering system")},
-	{ GNM_FUNC_HELP_DESCRIPTION, F_("The WEEKDAY function returns the day-of-week of @{date}.  The value of @{method} determines how days are numbered.") },
+        { GNM_FUNC_HELP_ARG, F_("method:numbering system, defaults to 1")},
+	{ GNM_FUNC_HELP_DESCRIPTION, F_("The WEEKDAY function returns the day-of-week of @{date}.  The value of @{method} determines how days are numbered; it defaults to 1. ") },
 	{ GNM_FUNC_HELP_NOTE, F_("If @{method} is 1, then Sunday is 1, Monday is 2, etc.") },
 	{ GNM_FUNC_HELP_NOTE, F_("If @{method} is 2, then Monday is 1, Tuesday is 2, etc.") },
 	{ GNM_FUNC_HELP_NOTE, F_("If @{method} is 3, then Monday is 0, Tuesday is 1, etc.") },
@@ -1169,7 +1169,7 @@ gnumeric_isoyear (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 static GnmFuncHelp const help_weeknum[] = {
         { GNM_FUNC_HELP_NAME, F_("WEEKNUM:week number")},
         { GNM_FUNC_HELP_ARG, F_("date:date serial value")},
-        { GNM_FUNC_HELP_ARG, F_("method:numbering system")},
+        { GNM_FUNC_HELP_ARG, F_("method:numbering system, defaults to 1")},
 	{ GNM_FUNC_HELP_DESCRIPTION, F_("WEEKNUM calculates the week number according to @{method} which defaults to 1.") },
 	{ GNM_FUNC_HELP_NOTE, F_("If @{method} is 1, then weeks start on Sundays and January 1 is in week 1.") },
 	{ GNM_FUNC_HELP_NOTE, F_("If @{method} is 2, then weeks start on Mondays and January 1 is in week 1.") },
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 53cff53..a9e41e3 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-07  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialog-function-select.c (make_expr_example): use the suggested 
+	  format
+
 2010-07-04  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-solver.c (dialog_init): If we have no existing target we
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index cdb2eba..d958e9c 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -40,6 +40,8 @@
 #include <sheet.h>
 #include <dead-kittens.h>
 #include <gnumeric-gconf.h>
+#include <gnm-format.h>
+#include <auto-format.h>
 
 #include <gsf/gsf-impl-utils.h>
 #include <glade/glade.h>
@@ -567,11 +569,13 @@ make_expr_example (Sheet *sheet, const char *text, gboolean localized)
 		char *etxt = gnm_expr_top_as_string (texpr, &pp, convs);
 		GnmValue *val = gnm_expr_top_eval
 			(texpr, &ep, GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
-		GnmExprTop const *texpr_res = gnm_expr_top_new_constant (val);
-		char *vtxt = gnm_expr_top_as_string (texpr_res, &pp, convs);
+		GOFormat *format = auto_style_format_suggest (texpr, &ep);
+		char *vtxt = format_value(format, val, NULL, -1, 
+					  workbook_date_conv (sheet->workbook));
 
+		go_format_unref (format);
 		gnm_expr_top_unref (texpr);
-		gnm_expr_top_unref (texpr_res);
+		value_release (val);
 
 		res = g_strdup_printf (_("%s evaluates to %s."), etxt, vtxt);
 



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