Bugzilla – Attachment 72854 Details for
Bug 139466
Gnumeric double free of memory - hang
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
update to what will become 1.4.4 with kludge to handle gsf-1.12.1
gnumeric-1.4.4.diff (text/plain), 349.42 KB, created by
Jody Goldberg
on 2006-03-14 20:46:42 UTC
(
hide
)
Description:
update to what will become 1.4.4 with kludge to handle gsf-1.12.1
Filename:
MIME Type:
Creator:
Jody Goldberg
Created:
2006-03-14 20:46:42 UTC
Size:
349.42 KB
patch
obsolete
>Index: README >=================================================================== >RCS file: /cvs/gnome/gnumeric/README,v >retrieving revision 1.111 >retrieving revision 1.111.2.1 >diff -u -w -p -r1.111 -r1.111.2.1 >--- README 11 Nov 2004 05:09:22 -0000 1.111 >+++ README 4 Jul 2005 20:01:44 -0000 1.111.2.1 >@@ -18,7 +18,7 @@ You need: Debian package name > gtk+ >= 2.4.0 libgtk2.0-dev > libgnomeprint >= 2.5.2 libgnomeprint2.2-dev > libgnomeprintui >= 2.5.2 libgnomeprintui2.2-dev >- libgsf >= 1.10.0 libgsf-1-dev >+ libgsf == 1.12.1 libgsf-1-dev > libglade >= 2.3.6 libglade2-dev > intltool >= 0.27.2 intltool > gnome-xml >= 2.4.12 libxml2-dev >Index: configure.in >=================================================================== >RCS file: /cvs/gnome/gnumeric/configure.in,v >retrieving revision 1.690.2.2 >diff -u -w -p -r1.690.2.2 configure.in >--- configure.in 25 Jan 2005 14:07:17 -0000 1.690.2.2 >+++ configure.in 14 Mar 2006 19:15:47 -0000 >@@ -98,7 +98,7 @@ gnumeric_reqs=" > glib-2.0 >= 2.4.0 > gobject-2.0 >= 2.4.0 > gmodule-2.0 >= 2.4.0 >- libgsf-1 >= 1.10.0 >+ libgsf-1 == 1.12.1 > libxml-2.0 >= 2.4.12 > pango >= 1.4.0 > pangoft2 >= 1.4.0 >@@ -117,7 +117,7 @@ gnumeric_gnome_reqs=" > libbonoboui-2.0 >= 2.2.0 > libgnome-2.0 >= 2.0.0 > libgnomeui-2.0 >= 2.0.0 >- libgsf-gnome-1 >= 1.10.0 >+ libgsf-gnome-1 == 1.12.1 > " > > ui_msg= >@@ -188,25 +188,26 @@ case $host_os in > ;; > esac > AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes") >+AM_CONDITIONAL(CROSS_COMPILING, test x"$cross_compiling" != "xno") > > GNUMERIC_PLUGIN_LDFLAGS="-avoid-version $GNUMERIC_PLUGIN_LDFLAGS" > AC_SUBST(GNUMERIC_PLUGIN_LDFLAGS) > > dnl disable for in stable release, re-enable for development series >-CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED" >-CFLAGS="$CFLAGS -DPANGO_DISABLE_DEPRECATED" >-if test "x$gnumeric_with_gtk" = "xtrue"; then >- CFLAGS="$CFLAGS -DGDK_PIXBUF_DISABLE_DEPRECATED" >- CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATED" >- CFLAGS="$CFLAGS -DGDK_MULTIHEAD_SAFE" >- CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED" >- CFLAGS="$CFLAGS -DLIBGLADE_DISABLE_DEPRECATED" >-fi >-if test "x$gnumeric_with_gnome" = "xtrue"; then >- CFLAGS="$CFLAGS -DGNOME_DISABLE_DEPRECATED" >- CFLAGS="$CFLAGS -DBONOBO_DISABLE_DEPRECATED" >- CFLAGS="$CFLAGS -DBONOBO_UI_DISABLE_DEPRECATED" >-fi >+dnl CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED" >+dnl CFLAGS="$CFLAGS -DPANGO_DISABLE_DEPRECATED" >+dnl if test "x$gnumeric_with_gtk" = "xtrue"; then >+dnl CFLAGS="$CFLAGS -DGDK_PIXBUF_DISABLE_DEPRECATED" >+dnl CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATED" >+dnl CFLAGS="$CFLAGS -DGDK_MULTIHEAD_SAFE" >+dnl CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED" >+dnl CFLAGS="$CFLAGS -DLIBGLADE_DISABLE_DEPRECATED" >+dnl fi >+dnl if test "x$gnumeric_with_gnome" = "xtrue"; then >+dnl CFLAGS="$CFLAGS -DGNOME_DISABLE_DEPRECATED" >+dnl CFLAGS="$CFLAGS -DBONOBO_DISABLE_DEPRECATED" >+dnl CFLAGS="$CFLAGS -DBONOBO_UI_DISABLE_DEPRECATED" >+dnl fi > > dnl ============================================== > dnl GNOME Specific extensions >@@ -258,7 +259,7 @@ ifdef([GNOME_COMPILE_WARNINGS], > ) > set_more_warnings=yes > if test "$GCC" = "yes" -a "x$set_more_warnings" != "xno"; then >- for option in -Wsign-compare -Wpointer-arith -Wnested-externs -Wchar-subscripts -Wwrite-strings; do >+ for option in -Wno-pointer-sign -Wsign-compare -Wpointer-arith -Wnested-externs -Wchar-subscripts -Wwrite-strings; do > SAVE_CFLAGS="$CFLAGS" > CFLAGS="$CFLAGS $option" > AC_MSG_CHECKING([whether gcc understands $option]) >@@ -1010,6 +1011,7 @@ templates/Makefile > templates/english/Makefile > templates/autoformat/Makefile > stamp.h >+tools/Makefile > ]) > > echo " >Index: gnumeric.spec.in >=================================================================== >RCS file: /cvs/gnome/gnumeric/gnumeric.spec.in,v >retrieving revision 1.88 >retrieving revision 1.88.2.1 >diff -u -w -p -r1.88 -r1.88.2.1 >--- gnumeric.spec.in 10 Oct 2004 15:38:17 -0000 1.88 >+++ gnumeric.spec.in 4 Jul 2005 20:02:40 -0000 1.88.2.1 >@@ -18,7 +18,7 @@ Source: ftp://ftp.gnome.org/pub/GNOME/so > Url: http://www.gnome.org/gnumeric > BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root > BuildRequires: glib2-devel >= 2.4.0 >-BuildRequires: libgsf-devel >= 1.10.0 >+BuildRequires: libgsf-devel >= 1.12.1 > BuildRequires: gtk2-devel >= 2.4.0 > BuildRequires: libxml2-devel >= 2.4.12 > BuildRequires: libglade2-devel >= 2.3.6 >Index: doc/make-func-list.pl >=================================================================== >RCS file: /cvs/gnome/gnumeric/doc/make-func-list.pl,v >retrieving revision 1.13 >diff -u -w -p -r1.13 make-func-list.pl >--- doc/make-func-list.pl 2 Dec 2004 14:46:15 -0000 1.13 >+++ doc/make-func-list.pl 14 Mar 2006 19:15:47 -0000 >@@ -7,6 +7,10 @@ my $func = ""; > while (<>) { > s/\s+$//; > if (/^\@CATEGORY=(.*)/) { >+ if ($state) { >+ print " </refsect1>\n"; >+ print " </refentry>\n\n"; >+ } > if ($cat ne $1) { > if ($cat ne "") { > print "</sect1>\n"; >@@ -128,6 +132,7 @@ sub markup_stuff { > $str = "e_stuff ($str); > > $str =~ s/\b$func\b/<function>$func<\/function>/g; >+ $str =~ s/\@\{(\w*)\}/<parameter>\1<\/parameter>/g; > $str =~ s/\@(\w*)\b/<parameter>\1<\/parameter>/g; > > return $str; >Index: doc/C/appendix-keybindings.xml >=================================================================== >RCS file: /cvs/gnome/gnumeric/doc/C/appendix-keybindings.xml,v >retrieving revision 1.3 >diff -u -w -p -r1.3 appendix-keybindings.xml >--- doc/C/appendix-keybindings.xml 2 Dec 2004 14:46:15 -0000 1.3 >+++ doc/C/appendix-keybindings.xml 14 Mar 2006 19:15:47 -0000 >@@ -92,7 +92,7 @@ > > <listitem> > <para> >- <keycap>Ctrl-~</keycap> Formats the current selection as a number. >+ <keycap>Ctrl-~</keycap> Formats the current selection as a 'General'. > </para> > </listitem> > <listitem> >@@ -117,7 +117,7 @@ > </listitem> > <listitem> > <para> >- <keycap>Ctrl-!</keycap> Formats the current selection with the default accounting format >+ <keycap>Ctrl-!</keycap> Formats the current selection as a number with 2 decimal places. > </para> > </listitem> > <listitem> >Index: doc/C/gnumeric.1 >=================================================================== >RCS file: /cvs/gnome/gnumeric/doc/C/gnumeric.1,v >retrieving revision 1.6 >diff -u -w -p -r1.6 gnumeric.1 >--- doc/C/gnumeric.1 13 Sep 2003 17:45:10 -0000 1.6 >+++ doc/C/gnumeric.1 14 Mar 2006 19:15:47 -0000 >@@ -51,7 +51,7 @@ Displays a brief usage message. > .SS "Gnumeric options" > .TP > .B \-v, \-\-version >-Displays the version number of the isntalled instance of >+Displays the version number of the installed instance of > \fBgnumeric\fR. > .TP > .B \-\-no-splash >Index: plugins/derivatives/options.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/derivatives/options.c,v >retrieving revision 1.51 >diff -u -w -p -r1.51 options.c >--- plugins/derivatives/options.c 28 Nov 2004 04:02:32 -0000 1.51 >+++ plugins/derivatives/options.c 14 Mar 2006 19:15:47 -0000 >@@ -2039,7 +2039,7 @@ opt_fixed_strk_lkbk(FunctionEvalInfo *ei > > if(OS_Call == call_put_flag) > m = s_max; >- else if(OS_Put == call_put_flag) >+ else /* if (OS_Put == call_put_flag) default to being a put */ > m = s_min; > > d1 = (loggnum(s / x) + (b + (v * v) / 2.0) * t) / (v * sqrtgnum(t)); >Index: plugins/excel/Makefile.am >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/Makefile.am,v >retrieving revision 1.56 >diff -u -w -p -r1.56 Makefile.am >--- plugins/excel/Makefile.am 4 Oct 2004 22:59:43 -0000 1.56 >+++ plugins/excel/Makefile.am 14 Mar 2006 19:15:47 -0000 >@@ -11,8 +11,6 @@ excel_la_LIBADD = $(Z_LIBS) > excel_la_SOURCES = \ > boot.c \ > boot.h \ >- excel-xml-read.c \ >- excel-xml-read.h \ > excel.h \ > formula-types.h \ > ms-excel-biff.h \ >Index: plugins/excel/boot.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/boot.c,v >retrieving revision 1.122 >diff -u -w -p -r1.122 boot.c >--- plugins/excel/boot.c 17 Jan 2005 04:37:25 -0000 1.122 >+++ plugins/excel/boot.c 14 Mar 2006 19:15:47 -0000 >*************** static void >*** 120,135 **** > excel_read_metadata (Workbook *wb, GsfInfile *ole, char const *name, > IOContext *context) > { >- GError *err = NULL; > GsfInput *stream = gsf_infile_child_by_name (ole, name); > > if (stream != NULL) { >- gsf_msole_metadata_read (stream, &err); >- if (err != NULL) { >- gnm_io_warning (context, err->message); >- g_error_free (err); >- } >- gsf_input_seek (stream, 0, G_SEEK_SET); > g_object_set_data_full (G_OBJECT (wb), name, > gsf_structured_blob_read (stream), g_object_unref); > g_object_unref (G_OBJECT (stream)); >--- 120,128 ---- >*************** excel_save (IOContext *context, Workbook >*** 251,273 **** > io_progress_range_pop (context); > > blob = g_object_get_data (G_OBJECT (wb), "\05DocumentSummaryInformation"); >! if (blob == NULL) { >! content = gsf_outfile_new_child (outfile, >! "\05DocumentSummaryInformation", FALSE); >! gsf_msole_metadata_write (content, TRUE, NULL); >! gsf_output_close (content); >! g_object_unref (G_OBJECT (content)); >! } else > gsf_structured_blob_write (blob, outfile); > > blob = g_object_get_data (G_OBJECT (wb), "\05SummaryInformation"); >! if (blob == NULL) { >! content = gsf_outfile_new_child (outfile, >! "\05SummaryInformation", FALSE); >! gsf_msole_metadata_write (content, FALSE, NULL); >! gsf_output_close (content); >! g_object_unref (G_OBJECT (content)); >! } else > gsf_structured_blob_write (blob, outfile); > > /* restore the macros we loaded */ >--- 244,254 ---- > io_progress_range_pop (context); > > blob = g_object_get_data (G_OBJECT (wb), "\05DocumentSummaryInformation"); >! if (blob != NULL) > gsf_structured_blob_write (blob, outfile); > > blob = g_object_get_data (G_OBJECT (wb), "\05SummaryInformation"); >! if (blob != NULL) > gsf_structured_blob_write (blob, outfile); > > /* restore the macros we loaded */ >@@ -308,7 +305,6 @@ void > plugin_init (void) > { > excel_read_init (); >- excel_xml_read_init (); > > #if 0 > { >@@ -359,5 +355,4 @@ plugin_cleanup (void) > { > destroy_xl_font_widths (); > excel_read_cleanup (); >- excel_xml_read_cleanup (); > } >Index: plugins/excel/ms-chart.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-chart.c,v >retrieving revision 1.166 >diff -u -w -p -r1.166 ms-chart.c >--- plugins/excel/ms-chart.c 13 Jan 2005 04:35:39 -0000 1.166 >+++ plugins/excel/ms-chart.c 14 Mar 2006 19:15:48 -0000 >@@ -1137,7 +1137,7 @@ BC_R(lineformat)(XLChartHandler const *h > guint16 const flags = GSF_LE_GET_GUINT16 (q->data+8); > > BC_R(get_style) (s); >- switch (GSF_LE_GET_GUINT16 (q->data+6)) { >+ switch (GSF_LE_GET_GINT16 (q->data+6)) { > default : > case -1 : s->style->line.width = 0; /* hairline */ > break; >Index: plugins/excel/ms-excel-read.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-excel-read.c,v >retrieving revision 1.634.2.2 >diff -u -w -p -r1.634.2.2 ms-excel-read.c >--- plugins/excel/ms-excel-read.c 13 Mar 2005 02:34:28 -0000 1.634.2.2 >+++ plugins/excel/ms-excel-read.c 14 Mar 2006 19:15:49 -0000 >@@ -393,7 +393,7 @@ ms_sheet_realize_obj (MSContainer *conta > > case 0x09: > g_object_set (G_OBJECT (so), "points", >- ms_obj_attr_get_array (obj->attrs, MS_OBJ_ATTR_POLYGON_COORDS, NULL), >+ ms_obj_attr_get_array (obj->attrs, MS_OBJ_ATTR_POLYGON_COORDS, NULL, TRUE), > NULL); > /* fallthrough */ > >@@ -2277,7 +2277,8 @@ excel_read_FORMULA (BiffQuery *q, ExcelR > guint16 const row = XL_GETROW (q); > guint16 const options = GSF_LE_GET_GUINT16 (q->data + 14); > guint16 expr_length; >- guint offset, val_offset; >+ guint offset; >+ guint8 const *val_dat = q->data + 6; > GnmExpr const *expr; > GnmCell *cell; > GnmValue *val = NULL; >@@ -2297,13 +2298,14 @@ excel_read_FORMULA (BiffQuery *q, ExcelR > */ > if (esheet->container.ver >= MS_BIFF_V5) { > expr_length = GSF_LE_GET_GUINT16 (q->data + 20); >- offset = 22; val_offset = 6; >+ offset = 22; > } else if (esheet->container.ver >= MS_BIFF_V3) { > expr_length = GSF_LE_GET_GUINT16 (q->data + 16); >- offset = 18; val_offset = 6; >+ offset = 18; > } else { > expr_length = GSF_LE_GET_GUINT8 (q->data + 16); >- offset = 17; val_offset = 7; >+ offset = 17; >+ val_dat++; /* compensate for the 3 byte style */ > } > > if (q->length < offset) { >@@ -2321,50 +2323,21 @@ excel_read_FORMULA (BiffQuery *q, ExcelR > return; > } > >- /* >- * Get the current value so that we can format, do this BEFORE handling >+ /* Get the current value so that we can format, do this BEFORE handling > * shared/array formulas or strings in case we need to go to the next >- * record >- */ >- if (GSF_LE_GET_GUINT16 (q->data + 12) != 0xffff) { >- double const num = gsf_le_get_double (q->data + val_offset); >- val = value_new_float (num); >+ * record */ >+ if (GSF_LE_GET_GUINT16 (val_dat + 6) != 0xffff) { >+ val = value_new_float (gsf_le_get_double (val_dat)); > } else { >- guint8 const val_type = GSF_LE_GET_GUINT8 (q->data + val_offset); >+ guint8 const val_type = GSF_LE_GET_GUINT8 (val_dat); > switch (val_type) { >- case 0: /* String */ >- is_string = TRUE; >- break; >- >- case 1: { /* Boolean */ >- guint8 v = GSF_LE_GET_GUINT8 (q->data + val_offset + 2); >- val = value_new_bool (v ? TRUE : FALSE); >+ case 0: is_string = TRUE; break; >+ case 1: val = value_new_bool (GSF_LE_GET_GUINT8 (val_dat + 2) != 0); > break; >- } >- >- case 2: { /* Error */ >- guint8 const v = GSF_LE_GET_GUINT8 (q->data + val_offset + 2); >- val = biff_get_error (NULL, v); >+ case 2: val = biff_get_error (NULL, GSF_LE_GET_GUINT8 (val_dat + 2)); > break; >- } >- >- case 3: /* Empty */ >- /* TODO TODO TODO >- * This is undocumented and a big guess, but it seems >- * accurate. >- */ >- d (0, { >- fprintf (stderr,"%s:%s: has type 3 contents. " >- "Is it an empty cell?\n", >- esheet->sheet->name_unquoted, >- cell_name (cell)); >- if (ms_excel_read_debug > 5) >- gsf_mem_dump (q->data + 6, 8); >- }); >- >- val = value_new_empty (); >+ case 3: val = value_new_empty (); /* Empty (Undocumented) */ > break; >- > default: > fprintf (stderr,"Unknown type (%x) for cell's (%s) current val\n", > val_type, cell_name (cell)); >Index: plugins/excel/ms-excel-write.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-excel-write.c,v >retrieving revision 1.294.2.2 >diff -u -w -p -r1.294.2.2 ms-excel-write.c >--- plugins/excel/ms-excel-write.c 13 Mar 2005 02:34:28 -0000 1.294.2.2 >+++ plugins/excel/ms-excel-write.c 14 Mar 2006 19:15:50 -0000 >@@ -3361,6 +3361,7 @@ blipinf_new (SheetObjectImage *soi) > { > BlipInf *blip; > GByteArray *bytes; >+ const char *blip_type; > > blip = g_new0 (BlipInf, 1); > blip->uncomp_len = -1; >@@ -3372,14 +3373,15 @@ blipinf_new (SheetObjectImage *soi) > "image-data", &bytes, > NULL); > blip->bytes = *bytes; /* Need to copy, we may change it. */ >+ blip_type = blip->type ? blip->type : "?"; > >- if (strcmp (blip->type, "jpeg") == 0 || /* Raster format */ >- strcmp (blip->type, "png") == 0 || /* understood by Excel */ >- strcmp (blip->type, "dib") == 0) { >+ if (strcmp (blip_type, "jpeg") == 0 || /* Raster format */ >+ strcmp (blip_type, "png") == 0 || /* understood by Excel */ >+ strcmp (blip_type, "dib") == 0) { > blip->header_len = BSE_HDR_LEN + RASTER_BLIP_HDR_LEN; >- } else if (strcmp (blip->type, "wmf") == 0 || /* Vector format */ >- strcmp (blip->type, "emf") == 0 || /* - compress */ >- strcmp (blip->type, "pict") == 0) { >+ } else if (strcmp (blip_type, "wmf") == 0 || /* Vector format */ >+ strcmp (blip_type, "emf") == 0 || /* - compress */ >+ strcmp (blip_type, "pict") == 0) { > > int res; > gulong dest_len = blip->bytes.len * 1.01 + 12; >@@ -3422,7 +3424,7 @@ blipinf_new (SheetObjectImage *soi) > } else { > g_warning > ("Unable to export %s image as png to Excel", >- blip->type); >+ blip_type); > g_free (blip); > blip = NULL; > } >Index: plugins/excel/ms-formula-read.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-formula-read.c,v >retrieving revision 1.215 >diff -u -w -p -r1.215 ms-formula-read.c >--- plugins/excel/ms-formula-read.c 17 Jan 2005 05:30:07 -0000 1.215 >+++ plugins/excel/ms-formula-read.c 14 Mar 2006 19:15:50 -0000 >@@ -469,7 +469,7 @@ ExcelFuncDesc const excel_func_desc [] = > int excel_func_desc_size = G_N_ELEMENTS (excel_func_desc); > > static GnmExpr const * >-expr_tree_error (ExcelReadSheet const *esheet, int col, int row, >+xl_expr_err (ExcelReadSheet const *esheet, int col, int row, > char const *msg, char const *str) > { > if (esheet != NULL && esheet->sheet != NULL) { >@@ -570,9 +570,9 @@ parse_list_push (GnmExprList **list, Gnm > d (5, fprintf (stderr, "Push 0x%p\n", pd);); > if (pd == NULL) { > g_warning ("FIXME: Pushing nothing onto excel function stack"); >- pd = expr_tree_error (NULL, -1, -1, >+ pd = xl_expr_err (NULL, -1, -1, > "Incorrect number of parsed formula arguments", >- "#WrongArgs"); >+ "#WrongArgs!"); > } > *list = gnm_expr_list_prepend (*list, pd); > } >@@ -595,9 +595,9 @@ parse_list_pop (GnmExprList **list) > return ans; > } > >- return expr_tree_error (NULL, -1, -1, >+ return xl_expr_err (NULL, -1, -1, > "Incorrect number of parsed formula arguments", >- "#WrongArgs"); >+ "#WrongArgs!"); > } > > /** >@@ -668,13 +668,7 @@ make_function (GnmExprList **stack, int > d (2, fprintf (stderr, "Function '%s', %d, expected args: %d flags = 0x%x\n", > fd->name, numargs, fd->num_known_args, fd->flags);); > >- if ((fd->flags & XL_VARARG) && numargs < 0) >- g_warning ("We think '%s' is vararg, and XL doesn't", fd->name); >- if ((fd->flags & XL_FIXED) && numargs >= 0) >- g_warning ("We think '%s' is fixed, and XL doesn't", fd->name); >- >- /* Right args for multi-arg funcs. */ >- if (fd->flags & XL_FIXED) { >+ if (numargs < 0) { /* fixed, use the built in */ > int const available_args = > (*stack != NULL) ? g_slist_length(*stack) : 0; > numargs = fd->num_known_args; >@@ -695,7 +689,7 @@ make_function (GnmExprList **stack, int > if (fd->name) { > name = gnm_func_lookup (fd->name, wb); > if (name == NULL) >- name = gnm_func_add_placeholder (wb, fd->name, "0NKNOWN", TRUE); >+ name = gnm_func_add_placeholder (wb, fd->name, "UNKNOWN", TRUE); > } > /* This should not happen */ > if (!name) { >@@ -904,7 +898,7 @@ excel_parse_formula (MSContainer const * > GnmCellPos top_left; > > top_left.row = GSF_LE_GET_GUINT16 (cur+0); >- top_left.col = GSF_LE_GET_GUINT16 (cur+2); >+ top_left.col = (ver >= MS_BIFF_V3) ? GSF_LE_GET_GUINT16 (cur+2) : GSF_LE_GET_GUINT8 (cur+2); > sf = excel_sheet_shared_formula (esheet, &top_left); > > if (sf == NULL) { >@@ -926,11 +920,7 @@ excel_parse_formula (MSContainer const * > return NULL; > } > >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 0) { >- fprintf (stderr, "Parse shared formula\n"); >- } >-#endif >+ d (0, fprintf (stderr, "Parse shared formula\n");); > expr = excel_parse_formula (container, esheet, fn_col, fn_row, > sf->data, sf->data_len, TRUE, array_element); > >@@ -1009,101 +999,47 @@ excel_parse_formula (MSContainer const * > ptg_length = 2; > } > if (grbit == 0x00) { >- static gboolean warned_a = FALSE; >- static gboolean warned_3 = FALSE; >- if (w == 0xa) { >- if (warned_a) >- break; >- warned_a = TRUE; >- } else if (w == 3) { >- if (warned_3) >- break; >- warned_3 = TRUE; >- } /* else always warn */ >- >+#if 0 > ms_excel_dump_cellname (container->ewb, esheet, fn_col, fn_row); > fprintf (stderr, "Hmm, ptgAttr of type 0 ??\n" > "I've seen a case where an instance of this with flag A and another with flag 3\n" > "bracket a 1x1 array formula. please send us this file.\n" > "Flags = 0x%X\n", w); >- } else if (grbit & 0x01) { >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 0) { >- fprintf (stderr, "A volatile function: so what\n"); >- } >-#endif >- } else if (grbit & 0x02) { /* AttrIf: 'optimised' IF function */ >- /* Who cares if the TRUE expr has a goto at the end */ >- GnmExpr const *tr; >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 2) { >- fprintf (stderr, "Optimised IF 0x%x 0x%x\n", grbit, w); >- gsf_mem_dump (mem, length); >- } > #endif >- tr = w ? excel_parse_formula (container, esheet, fn_col, fn_row, >- cur+ptg_length, w, shared, NULL) >- : gnm_expr_new_constant (value_new_string ("")); >- parse_list_push (&stack, tr); >- ptg_length += w; >- } else if (grbit & 0x04) { /* AttrChoose 'optimised' my foot. */ >- guint16 len, lp; >- guint32 offset=0; >- guint8 const *data=cur+3; >- GnmExpr const *tr; >+ } else if (grbit & 0x01) { >+ d (2, fprintf (stderr, "A volatile function\n");); > >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 1) { >- fprintf (stderr, "'Optimised' choose\n"); >- gsf_mem_dump (mem,length); >- } >-#endif >- for (lp=0;lp<w;lp++) { /* w = wCases */ >- offset= GSF_LE_GET_GUINT16(data); >- len = GSF_LE_GET_GUINT16(data+2) - offset; >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 1) { >- fprintf (stderr, "Get from %d len %d [ = 0x%x ]\n", >- ptg_length+offset, len, >- *(cur+ptg_length+offset)); >- } >-#endif >- tr = excel_parse_formula (container, esheet, fn_col, fn_row, >- cur+ptg_length+offset, len, shared, NULL); >- data += 2; >- parse_list_push (&stack, tr); >- } >- ptg_length+=GSF_LE_GET_GUINT16(data); >- } else if (grbit & 0x08) { /* AttrGoto */ >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 2) { >- fprintf (stderr, "Goto %d: cur = 0x%x\n", w, >- (int)(cur-mem)); >- gsf_mem_dump (mem, length); >- } >-#endif >- /* Not right prior to Excel 4.0 ? */ >- if (ver <= MS_BIFF_V3) break; >- ptg_length = w; >- } else if (grbit & 0x10) { /* AttrSum: 'optimised' SUM function */ >- if (!make_function (&stack, 0x04, 1, container->ewb->gnum_wb)) >- { >+ /* AttrIf: stores jump to FALSE condition */ >+ } else if (grbit & 0x02) { >+ /* Ignore cached result */ >+ d (2, fprintf (stderr, "ATTR IF\n");); >+ >+ /* AttrChoose : stores table of inputs */ >+ } else if (grbit & 0x04) { >+ /* Ignore the optimzation to specify which arg to use */ >+ d (2, fprintf (stderr, "ATTR CHOOSE\n");); >+ ptg_length = 2 * ((w + 1) /* args */ + 1 /* count */) + 1; >+ >+ /* AttrGoto : bytes/words to skip during _evaluation_. >+ * We still need to parse them */ >+ } else if (grbit & 0x08) { >+ d (2, fprintf (stderr, "ATTR GOTO\n");); >+ >+ /* AttrSum: 'optimised' SUM function */ >+ } else if (grbit & 0x10) { >+ if (!make_function (&stack, 0x04, 1, container->ewb->gnum_wb)) { > error = TRUE; >- puts ("Error in optimised SUM"); >+ fprintf (stderr, "Error in optimised SUM\n"); > } >- } else if (grbit & 0x40) { /* AttrSpace */ >+ >+ /* AttrSpace */ >+ } else if (grbit & 0x40) { > guint8 num_space = GSF_LE_GET_GUINT8(cur+2); > guint8 attrs = GSF_LE_GET_GUINT8(cur+1); >- if (attrs == 00) /* bitFSpace : ignore it */ >- /* Could perhaps pop top arg & append space ? */; >- else >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 1) { >- fprintf (stderr, "Redundant whitespace in formula 0x%x count %d\n", attrs, num_space); >- } >-#else >+ if (attrs == 0) /* bitFSpace : ignore it for now */ > ; >-#endif >+ else >+ d (2, fprintf (stderr, "Redundant whitespace in formula 0x%x count %d\n", attrs, num_space);); > } else { > ms_excel_dump_cellname (container->ewb, esheet, fn_col, fn_row); > fprintf (stderr, "Unknown PTG Attr gr = 0x%x, w = 0x%x ptg = 0x%x\n", grbit, w, ptg); >@@ -1113,44 +1049,38 @@ excel_parse_formula (MSContainer const * > break; > > case FORMULA_PTG_SHEET: { >+ g_warning ("PTG_SHEET! please send us a copy of this file."); > ptg_length = 10; > external = TRUE; >-#ifndef NO_DEBUG_EXCEL >- if (ms_excel_formula_debug > 1) { >- fprintf (stderr, "External ref ignored\n"); >- } >-#endif > break; > } > >- case FORMULA_PTG_SHEET_END: { >+ case FORMULA_PTG_SHEET_END: >+ g_warning ("PTG_SHEET_END! please send us a copy of this file."); > ptg_length = 4; > external = FALSE; > break; >- } > >- case FORMULA_PTG_ERR: { >+ case FORMULA_PTG_ERR: > parse_list_push_raw (&stack, biff_get_error (NULL, GSF_LE_GET_GUINT8 (cur))); > ptg_length = 1; > break; >- } >- case FORMULA_PTG_INT: { >- guint16 num = GSF_LE_GET_GUINT16(cur); >- parse_list_push_raw (&stack, value_new_int (num)); >+ >+ case FORMULA_PTG_INT: >+ parse_list_push_raw (&stack, value_new_int (GSF_LE_GET_GUINT16 (cur))); > ptg_length = 2; > break; >- } >+ > case FORMULA_PTG_BOOL: > parse_list_push_raw (&stack, value_new_bool (GSF_LE_GET_GUINT8(cur))); > ptg_length = 1; > break; > >- case FORMULA_PTG_NUM: { >- double tmp = gsf_le_get_double (cur); >- parse_list_push_raw (&stack, value_new_float (tmp)); >+ case FORMULA_PTG_NUM: >+ parse_list_push_raw (&stack, value_new_float (gsf_le_get_double (cur))); > ptg_length = 8; > break; >- } >+ > case FORMULA_PTG_STR: { > char *str; > int len = GSF_LE_GET_GUINT8 (cur); >@@ -1673,16 +1603,16 @@ excel_parse_formula (MSContainer const * > gsf_mem_dump (mem, length); > > parse_list_free (&stack); >- return expr_tree_error (esheet, fn_col, fn_row, >+ return xl_expr_err (esheet, fn_col, fn_row, > "Unknown Formula/Array", "#Unknown formula"); > } > > if (stack == NULL) >- return expr_tree_error (esheet, fn_col, fn_row, >+ return xl_expr_err (esheet, fn_col, fn_row, > "Stack too short - unusual", "#ShortStack"); > if (gnm_expr_list_length (stack) > 1) { > parse_list_free (&stack); >- return expr_tree_error (esheet, fn_col, fn_row, >+ return xl_expr_err (esheet, fn_col, fn_row, > "Too much data on stack - probable cause: fixed args function is var-arg, put '-1' in the table above", > "#LongStack"); > } >Index: plugins/excel/ms-obj.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-obj.c,v >retrieving revision 1.137 >diff -u -w -p -r1.137 ms-obj.c >--- plugins/excel/ms-obj.c 18 Oct 2004 20:30:04 -0000 1.137 >+++ plugins/excel/ms-obj.c 14 Mar 2006 19:15:51 -0000 >@@ -180,9 +180,11 @@ ms_obj_attr_get_ptr (MSObjAttrBag *attr > } > > GArray * >-ms_obj_attr_get_array (MSObjAttrBag *attrs, MSObjAttrID id, GArray *default_value) >+ms_obj_attr_get_array (MSObjAttrBag *attrs, MSObjAttrID id, >+ GArray *default_value, gboolean steal) > { > MSObjAttr *attr; >+ GArray *res; > > g_return_val_if_fail (attrs != NULL, default_value); > g_return_val_if_fail (id & MS_OBJ_ATTR_IS_GARRAY_MASK, default_value); >@@ -190,7 +192,10 @@ ms_obj_attr_get_array (MSObjAttrBag *att > attr = ms_obj_attr_bag_lookup (attrs, id); > if (attr == NULL) > return default_value; >- return attr->v.v_array; >+ res = attr->v.v_array; >+ if (steal) >+ attr->v.v_array = NULL; >+ return res; > } > > GnmExpr const * >Index: plugins/excel/ms-obj.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-obj.h,v >retrieving revision 1.58 >diff -u -w -p -r1.58 ms-obj.h >--- plugins/excel/ms-obj.h 11 Oct 2004 02:31:04 -0000 1.58 >+++ plugins/excel/ms-obj.h 14 Mar 2006 19:15:51 -0000 >@@ -103,7 +103,8 @@ MSObjAttr *ms_obj_attr_bag_lookup (M > guint32 ms_obj_attr_get_uint (MSObjAttrBag *attrs, MSObjAttrID id, guint32 default_value); > gint32 ms_obj_attr_get_int (MSObjAttrBag *attrs, MSObjAttrID id, gint32 default_value); > gpointer ms_obj_attr_get_ptr (MSObjAttrBag *attrs, MSObjAttrID id, gpointer default_value); >-GArray *ms_obj_attr_get_array (MSObjAttrBag *attrs, MSObjAttrID id, GArray *default_value); >+GArray *ms_obj_attr_get_array (MSObjAttrBag *ab, MSObjAttrID id, >+ GArray *default_value, gboolean steal); > GnmExpr const *ms_obj_attr_get_expr (MSObjAttrBag *attrs, MSObjAttrID id, GnmExpr const *default_value); > PangoAttrList *ms_obj_attr_get_markup (MSObjAttrBag *attrs, MSObjAttrID id, PangoAttrList *default_value); > >Index: plugins/fn-date/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-date/functions.c,v >retrieving revision 1.121 >diff -u -w -p -r1.121 functions.c >--- plugins/fn-date/functions.c 22 May 2004 02:41:40 -0000 1.121 >+++ plugins/fn-date/functions.c 14 Mar 2006 19:15:51 -0000 >@@ -56,6 +56,29 @@ make_date (GnmValue *res) > return res; > } > >+static int >+float_to_secs (gnm_float d) >+{ >+ int secs; >+ >+ /* Ok, we have a positive number. Add epsilon before we scale >+ and translate because otherwise it will not be enough. */ >+ d = gnumeric_add_epsilon (d); >+ >+ /* Get the number down between 0 and 1 before we scale. */ >+ d -= floorgnum (d); >+ >+ /* Scale and round. */ >+ secs = (int)(gnumeric_add_epsilon (d) * DAY_SECONDS + 0.5); >+ >+ /* We rounded, so we might have gone too far. */ >+ if (secs >= DAY_SECONDS) >+ secs -= DAY_SECONDS; >+ >+ return secs; >+} >+ >+ > /***************************************************************************/ > > static char const *help_date = { >@@ -82,37 +105,44 @@ static char const *help_date = { > static GnmValue * > gnumeric_date (FunctionEvalInfo *ei, GnmValue **argv) > { >- int year, month, day; >+ gnm_float year = value_get_as_float (argv [0]); >+ gnm_float month = value_get_as_float (argv [1]); >+ gnm_float day = value_get_as_float (argv [2]); > GDate date; > GnmDateConventions const *conv = DATE_CONV (ei->pos); > >- year = value_get_as_int (argv [0]); >- month = value_get_as_int (argv [1]); >- day = value_get_as_int (argv [2]); >- >- if (year < 0 || year > 9999) >+ if (year < 0 || year >= 10000) > goto error; >- > if (year < 1900) /* 1900, not 100. Ick! */ > year += 1900; > >+ /* This uses floor and not trunc on purpose. */ >+ month = floorgnum (month); >+ if (gnumabs (month) > 120000) /* Actual number not critical. */ >+ goto error; >+ >+ /* This uses floor and not trunc on purpose. */ >+ day = floorgnum (day); >+ if (day < -32768 || day >= 32768) >+ day = 32767; /* Absurd, but yes. */ >+ > g_date_clear (&date, 1); > >- g_date_set_dmy (&date, 1, 1, year); >+ g_date_set_dmy (&date, 1, 1, (int)year); > if (!g_date_valid (&date)) > goto error; > >- if (month > 0) >- g_date_add_months (&date, month - 1); >+ if ((int)month > 0) >+ g_date_add_months (&date, (int)month - 1); > else >- g_date_subtract_months (&date, 1 - month); >+ g_date_subtract_months (&date, 1 - (int)month); > if (!g_date_valid (&date)) > goto error; > >- if (day > 0) >- g_date_add_days (&date, day - 1); >+ if ((int)day > 0) >+ g_date_add_days (&date, (int)day - 1); > else >- g_date_subtract_days (&date, 1 - day); >+ g_date_subtract_days (&date, 1 - (int)day); > if (!g_date_valid (&date)) > goto error; > >@@ -547,10 +577,15 @@ static char const *help_hour = { > static GnmValue * > gnumeric_hour (FunctionEvalInfo *ei, GnmValue **argv) > { >- int secs; >- secs = datetime_value_to_seconds (argv[0]); >+ gnm_float d = value_get_as_float (argv[0]); >+ >+ if (d < 0) >+ return value_new_error_NUM (ei->pos); >+ else { >+ int secs = float_to_secs (d); > return value_new_int (secs / 3600); > } >+} > > /***************************************************************************/ > >@@ -576,10 +611,14 @@ static char const *help_minute = { > static GnmValue * > gnumeric_minute (FunctionEvalInfo *ei, GnmValue **argv) > { >- int secs; >+ gnm_float d = value_get_as_float (argv[0]); > >- secs = datetime_value_to_seconds (argv[0]); >- return value_new_int ((secs / 60) % 60); >+ if (d < 0) >+ return value_new_error_NUM (ei->pos); >+ else { >+ int secs = float_to_secs (d); >+ return value_new_int (secs / 60 % 60); >+ } > } > > /***************************************************************************/ >@@ -606,10 +645,14 @@ static char const *help_second = { > static GnmValue * > gnumeric_second (FunctionEvalInfo *ei, GnmValue **argv) > { >- int secs; >+ gnm_float d = value_get_as_float (argv[0]); > >- secs = datetime_value_to_seconds (argv[0]); >+ if (d < 0) >+ return value_new_error_NUM (ei->pos); >+ else { >+ int secs = float_to_secs (d); > return value_new_int (secs % 60); >+ } > } > > /***************************************************************************/ >Index: plugins/fn-eng/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-eng/functions.c,v >retrieving revision 1.112 >diff -u -w -p -r1.112 functions.c >--- plugins/fn-eng/functions.c 12 Jan 2005 16:15:41 -0000 1.112 >+++ plugins/fn-eng/functions.c 14 Mar 2006 19:15:51 -0000 >@@ -32,12 +32,16 @@ > #include <value.h> > #include <mathfunc.h> > #include <collect.h> >+#include <number-match.h> >+#include <workbook.h> >+#include <sheet.h> > > #include <math.h> > #include <limits.h> > #include <string.h> > #include <stdio.h> > #include <stdlib.h> >+#include <errno.h> > > #include "plugin.h" > #include "plugin-util.h" >@@ -45,60 +49,130 @@ > > GNUMERIC_MODULE_PLUGIN_INFO_DECL; > >+ >+typedef enum { >+ V2B_STRINGS_GENERAL = 1, /* Allow "1/1/2000" as number. */ >+ V2B_STRINGS_0XH = 2, /* Allow "4444h" and "0xABCD". */ >+ V2B_STRINGS_MAXLEN = 4, /* Impose 10 character input length. */ >+ V2B_STRINGS_BLANK_ZERO = 8, /* Treat "" as "0". */ >+ V2B_KILLME >+} Val2BaseFlags; >+ > /** > * FIXME: In the long term this needs optimising. > **/ > static GnmValue * > val_to_base (FunctionEvalInfo *ei, >- GnmValue **argv, int num_argv, >+ GnmValue const *value, >+ GnmValue const *aplaces, > int src_base, int dest_base, >- gboolean relaxed) >+ gnm_float min_value, gnm_float max_value, >+ Val2BaseFlags flags) > { >- GnmValue *value; >- int digit, max, places; >- char *err; >- char const *str; >+ int digit, min, max, places; > gnm_float v, b10; >- gboolean ok, had_hex_prefix = FALSE; > GString *buffer; >+ GnmValue *vstring = NULL; > > g_return_val_if_fail (src_base > 1 && src_base <= 36, > value_new_error_VALUE (ei->pos)); > g_return_val_if_fail (dest_base > 1 && dest_base <= 36, > value_new_error_VALUE (ei->pos)); > >- value = argv[0]; >- if (VALUE_IS_EMPTY (value)) >+ /* func.c ought to take care of this. */ >+ if (VALUE_TYPE (value) == VALUE_BOOLEAN) >+ return value_new_error_VALUE (ei->pos); >+ if (aplaces && VALUE_TYPE (aplaces) == VALUE_BOOLEAN) >+ return value_new_error_VALUE (ei->pos); >+ >+ switch (VALUE_TYPE (value)) { >+ default: > return value_new_error_NUM (ei->pos); >- else if (VALUE_IS_EMPTY_OR_ERROR (value)) >- return value_dup (value); > >- places = (num_argv >= 2 && argv[1]) ? value_get_as_int (argv[1]) : 0; >+ case VALUE_INTEGER: { >+ int val = value_get_as_int (value); >+ char buf[4 * sizeof (int)]; >+ char *err; > >- str = value_peek_string (value); >- if (relaxed) { >- while (*str == ' ' || *str == '\t') >- str++; >- if (src_base == 16 && >- str[0] == '0' && >- (str[1] == 'x' || str[1] == 'X')) { >- str += 2; >- had_hex_prefix = TRUE; >+ if (val < min_value || val > max_value) >+ value_new_error_NUM (ei->pos); >+ >+ sprintf (buf, "%d", val); >+ v = strtol (buf, &err, src_base); >+ if (*err != 0) >+ return value_new_error_NUM (ei->pos); >+ >+ break; > } >+ >+ case VALUE_STRING: >+ if (flags & V2B_STRINGS_GENERAL) { >+ vstring = format_match_number >+ (value_peek_string (value), NULL, >+ workbook_date_conv (ei->pos->sheet->workbook)); >+ if (!vstring || >+ VALUE_TYPE (vstring) == VALUE_BOOLEAN || >+ !VALUE_IS_NUMBER (vstring)) { >+ if (vstring) >+ value_release (vstring); >+ return value_new_error_VALUE (ei->pos); > } >+ } else { >+ const char *str = value_peek_string (value); >+ size_t len; >+ gboolean hsuffix = FALSE; >+ char *err; >+ >+ if ((flags & V2B_STRINGS_BLANK_ZERO) && *str == 0) >+ str = "0"; >+ >+ /* This prevents leading spaces, signs, etc, and "". */ >+ if (!g_ascii_isalnum (*str)) >+ return value_new_error_NUM (ei->pos); >+ >+ len = strlen (str); >+ /* We check length in bytes. Since we are going to >+ require nothing but digits, that is fine. */ >+ if ((flags & V2B_STRINGS_MAXLEN) && len > 10) >+ return value_new_error_NUM (ei->pos); >+ >+ if (flags & V2B_STRINGS_0XH) { >+ if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) >+ str += 2; >+ else if (str[len - 1] == 'h' || str[len - 1] == 'H') >+ hsuffix = TRUE; >+ } >+ > v = strtol (str, &err, src_base); > >- ok = (err != str && *err == 0); >- if (!ok && relaxed && err != str) { >- if (src_base == 16 && >- !had_hex_prefix && >- (err[0] == 'h' || err[0] == 'H') && >- err[1] == 0) >- ok = TRUE; >+ if (err == str || err[hsuffix] != 0) >+ return value_new_error_NUM (ei->pos); >+ >+ break; > } >+ /* Fall through. */ >+ >+ case VALUE_FLOAT: { >+ gnm_float val = gnumeric_fake_trunc (value_get_as_float (vstring ? vstring : value)); >+ char buf[GNUM_MANT_DIG + 10]; >+ char *err; >+ >+ if (vstring) >+ value_release (vstring); >+ >+ if (val < min_value || val > max_value) >+ return value_new_error_NUM (ei->pos); > >- if (!ok) >+ g_ascii_formatd (buf, sizeof (buf) - 1, >+ "%.0" GNUM_FORMAT_f, >+ val); >+ >+ v = strtol (buf, &err, src_base); >+ if (*err != 0) > return value_new_error_NUM (ei->pos); >+ break; >+ } >+ } > > b10 = powgnum (src_base, 10); > if (v >= b10 / 2) /* N's complement */ >@@ -108,18 +182,26 @@ val_to_base (FunctionEvalInfo *ei, > return value_new_int (v); > > if (v < 0) { >+ min = 1; > max = 10; > v += powgnum (dest_base, max); > } else { > if (v == 0) >- max = 1; >+ min = max = 1; > else >- max = (int)(loggnum (v + 0.5) / >+ min = max = (int)(loggnum (v + 0.5) / > loggnum (dest_base)) + 1; > } > >- if (places > max) >+ if (aplaces) { >+ places = value_get_as_int (aplaces); >+ if (places < min || places > 10) >+ return value_new_error_NUM (ei->pos); >+ if (v >= 0 && places > max) > max = places; >+ } else >+ places = 1; >+ > > buffer = g_string_sized_new (max); > g_string_set_size (buffer, max); >@@ -158,15 +240,14 @@ static char const *help_base = { > static GnmValue * > gnumeric_base (FunctionEvalInfo *ei, GnmValue **argv) > { >- GnmValue *argv2[2]; >+ static gnm_float const max = 1 / GNUM_EPSILON; > int base = value_get_as_int (argv[1]); > > if (base < 2 || base > 36) > return value_new_error_NUM (ei->pos); >- >- argv2[0] = argv[0]; >- argv2[1] = argv[2]; >- return val_to_base (ei, argv2, 2, 10, base, FALSE); >+ return val_to_base (ei, argv[0], argv[2], 10, base, >+ -max, +max, >+ V2B_STRINGS_GENERAL | V2B_STRINGS_0XH); > } > > /***************************************************************************/ >@@ -189,7 +270,10 @@ static char const *help_bin2dec = { > static GnmValue * > gnumeric_bin2dec (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 1, 2, 10, FALSE); >+ return val_to_base (ei, argv[0], NULL, >+ 2, 10, >+ 0, GNM_const(1111111111.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -215,7 +299,10 @@ static char const *help_bin2oct = { > static GnmValue * > gnumeric_bin2oct (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 2, 8, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 2, 8, >+ 0, GNM_const(1111111111.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -241,7 +328,10 @@ static char const *help_bin2hex = { > static GnmValue * > gnumeric_bin2hex (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 2, 16, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 2, 16, >+ 0, GNM_const(1111111111.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -267,7 +357,10 @@ static char const *help_dec2bin = { > static GnmValue * > gnumeric_dec2bin (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 10, 2, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 10, 2, >+ -512, 511, >+ V2B_STRINGS_GENERAL); > } > > /***************************************************************************/ >@@ -293,7 +386,10 @@ static char const *help_dec2oct = { > static GnmValue * > gnumeric_dec2oct (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 10, 8, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 10, 8, >+ -536870912, 536870911, >+ V2B_STRINGS_GENERAL); > } > > /***************************************************************************/ >@@ -319,7 +415,10 @@ static char const *help_dec2hex = { > static GnmValue * > gnumeric_dec2hex (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 10, 16, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 10, 16, >+ GNM_const(-549755813888.0), GNM_const(549755813887.0), >+ V2B_STRINGS_GENERAL); > } > > /***************************************************************************/ >@@ -371,7 +470,10 @@ static char const *help_oct2dec = { > static GnmValue * > gnumeric_oct2dec (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 1, 8, 10, FALSE); >+ return val_to_base (ei, argv[0], NULL, >+ 8, 10, >+ 0, GNM_const(7777777777.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -397,7 +499,10 @@ static char const *help_oct2bin = { > static GnmValue * > gnumeric_oct2bin (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 8, 2, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 8, 2, >+ 0, GNM_const(7777777777.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -423,7 +528,10 @@ static char const *help_oct2hex = { > static GnmValue * > gnumeric_oct2hex (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 8, 16, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 8, 16, >+ 0, GNM_const(7777777777.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -449,7 +557,10 @@ static char const *help_hex2bin = { > static GnmValue * > gnumeric_hex2bin (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 16, 2, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 16, 2, >+ 0, GNM_const(9999999999.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -475,7 +586,10 @@ static char const *help_hex2oct = { > static GnmValue * > gnumeric_hex2oct (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 2, 16, 8, FALSE); >+ return val_to_base (ei, argv[0], argv[1], >+ 16, 8, >+ 0, GNM_const(9999999999.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -498,7 +612,10 @@ static char const *help_hex2dec = { > static GnmValue * > gnumeric_hex2dec (FunctionEvalInfo *ei, GnmValue **argv) > { >- return val_to_base (ei, argv, 1, 16, 10, FALSE); >+ return val_to_base (ei, argv[0], NULL, >+ 16, 10, >+ 0, GNM_const(9999999999.0), >+ V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO); > } > > /***************************************************************************/ >@@ -800,7 +917,7 @@ get_constant_of_unit(const eng_convert_u > > /* See also http://physics.nist.gov/cuu/Units/prefixes.html */ > >-static GnmValue * >+static gboolean > convert (const eng_convert_unit_t units[], > const eng_convert_unit_t prefixes[], > char const *from_unit, char const *to_unit, >@@ -813,17 +930,16 @@ convert (const eng_convert_unit_t units[ > > if (!get_constant_of_unit (units, prefixes, > to_unit, &to_c, &to_prefix)) >- return value_new_error_NUM (ep); >- >- if (from_c == 0 || to_prefix == 0) >- return value_new_error_NUM (ep); >- >+ *v = value_new_error_NUM (ep); >+ else if (from_c == 0 || to_prefix == 0) >+ *v = value_new_error_NUM (ep); >+ else > *v = value_new_float (((n * from_prefix) / from_c) * > to_c / to_prefix); >- return *v; >+ return TRUE; > } > >- return NULL; >+ return FALSE; > } > > static GnmValue * >Index: plugins/fn-financial/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-financial/functions.c,v >retrieving revision 1.194 >diff -u -w -p -r1.194 functions.c >--- plugins/fn-financial/functions.c 18 Oct 2004 15:25:07 -0000 1.194 >+++ plugins/fn-financial/functions.c 14 Mar 2006 19:15:51 -0000 >@@ -50,8 +50,51 @@ > > GNUMERIC_MODULE_PLUGIN_INFO_DECL; > >-#define is_valid_basis(B) (B >= 0 && B <= 5) >-#define is_valid_freq(F) (F == 1 || F == 2 || F == 4) >+#define is_valid_basis(B) ((B) >= 0 && (B) <= 5) >+#define is_valid_freq(F) ((F) == 1 || (F) == 2 || (F) == 4) >+#define is_valid_paytype(t) ((t) == 0 || (t) == 1) >+ >+static int >+value_get_basis (const GnmValue *v, int defalt) >+{ >+ if (v) { >+ gnm_float b = value_get_as_float (v); >+ >+ if (b < 0 || b >= 6) >+ return -1; >+ return (int)b; >+ } else >+ return defalt; >+} >+ >+static int >+value_get_freq (const GnmValue *v) >+{ >+ gnm_float f; >+ >+ g_return_val_if_fail (v != NULL, -1); >+ >+ f = value_get_as_float (v); >+ if (f < 1 || f >= 5) >+ return -1; >+ else { >+ int i = (int)f; >+ return i == 3 ? -1 : i; >+ } >+} >+ >+static int >+value_get_paytype (const GnmValue *v) >+{ >+ if (v) { >+ gnm_float f = value_get_as_float (v); >+ if (f < 0 || f >= 2) >+ return -1; >+ else >+ return (int)f; >+ } else >+ return 0; >+} > > /*************************************************************************** > * >@@ -241,20 +284,23 @@ price (GDate *settlement, GDate *maturit > gnm_float redemption, GnmCouponConvention const *conv) > { > gnm_float a, d, e, sum, den, basem1, exponent, first_term, last_term; >- gint k, n; >+ int n; > > a = coupdaybs (settlement, maturity, conv); > d = coupdaysnc (settlement, maturity, conv); > e = coupdays (settlement, maturity, conv); > n = coupnum (settlement, maturity, conv); > >- sum = 0.0; > den = 100.0 * rate / conv->freq; > basem1 = yield / conv->freq; > exponent = d / e; >- /* FIXME: Eliminate loop. */ >- for (k = 0; k < n; k++) >- sum += den / pow1p (basem1, exponent + k); >+ >+ if (n == 1) >+ return (redemption + den) / (1 + exponent * basem1) - >+ a / e * den; >+ >+ sum = den * pow1p (basem1, 1 - n - exponent) * >+ pow1pm1 (basem1, n) / basem1; > > first_term = redemption / pow1p (basem1, (n - 1.0 + d / e)); > last_term = a / e * den; >@@ -276,15 +322,13 @@ func_coup (FunctionEvalInfo *ei, GnmValu > { > GDate settlement, maturity; > GnmCouponConvention conv; >- gboolean err = FALSE; > >- conv.freq = value_get_as_int (argv[2]); >- conv.basis = argv[3] ? value_get_as_int (argv[3]) : BASIS_MSRB_30_360; >- conv.eom = argv[4] ? value_get_as_bool (argv[4], &err) : TRUE; >+ conv.freq = value_get_freq (argv[2]); >+ conv.basis = value_get_basis (argv[3], BASIS_MSRB_30_360); >+ conv.eom = argv[4] ? value_get_as_checked_bool (argv[4]) : TRUE; > conv.date_conv = workbook_date_conv (ei->pos->sheet->workbook); > >- if (err || >- !datetime_value_to_g (&settlement, argv[0], conv.date_conv) || >+ if (!datetime_value_to_g (&settlement, argv[0], conv.date_conv) || > !datetime_value_to_g (&maturity, argv[1], conv.date_conv)) > return value_new_error_VALUE (ei->pos); > >@@ -359,8 +403,8 @@ gnumeric_accrint (FunctionEvalInfo *ei, > > rate = value_get_as_float (argv[3]); > par = value_get_as_float (argv[4]); >- freq = value_get_as_float (argv[5]); >- basis = argv[6] ? value_get_as_int (argv[6]) : 0; >+ freq = value_get_freq (argv[5]); >+ basis = value_get_basis (argv[6], BASIS_MSRB_30_360); > > if (rate <= 0. || > par <= 0. || >@@ -429,7 +473,7 @@ gnumeric_accrintm (FunctionEvalInfo *ei, > > rate = value_get_as_float (argv[2]); > par = argv[3] ? value_get_as_float (argv[3]) : 1000; >- basis = argv[4] ? value_get_as_int (argv[4]) : 0; >+ basis = value_get_basis (argv[4], BASIS_MSRB_30_360); > > a = days_monthly_basis (argv[0], argv[1], basis, date_conv); > d = annual_year_basis (argv[0], basis, date_conv); >@@ -491,7 +535,7 @@ gnumeric_intrate (FunctionEvalInfo *ei, > > investment = value_get_as_float (argv[2]); > redemption = value_get_as_float (argv[3]); >- basis = argv[4] ? value_get_as_int (argv[4]) : 0; >+ basis = value_get_basis (argv[4], BASIS_MSRB_30_360); > > a = days_monthly_basis (argv[0], argv[1], basis, date_conv); > d = annual_year_basis (argv[0], basis, date_conv); >@@ -547,7 +591,7 @@ gnumeric_received (FunctionEvalInfo *ei, > > investment = value_get_as_float (argv[2]); > discount = value_get_as_float (argv[3]); >- basis = argv[4] ? value_get_as_int (argv[4]) : 0; >+ basis = value_get_basis (argv[4], BASIS_MSRB_30_360); > > a = days_monthly_basis (argv[0], argv[1], basis, date_conv); > d = annual_year_basis (argv[0], basis, date_conv); >@@ -605,7 +649,7 @@ gnumeric_pricedisc (FunctionEvalInfo *ei > > discount = value_get_as_float (argv[2]); > redemption = value_get_as_float (argv[3]); >- basis = argv[4] ? value_get_as_int (argv[4]) : 0; >+ basis = value_get_basis (argv[4], BASIS_MSRB_30_360); > > a = days_monthly_basis (argv[0], argv[1], basis, date_conv); > d = annual_year_basis (argv[0], basis, date_conv); >@@ -658,7 +702,7 @@ gnumeric_pricemat (FunctionEvalInfo *ei, > > discount = value_get_as_float (argv[3]); > yield = value_get_as_float (argv[4]); >- basis = argv[5] ? value_get_as_int (argv[5]) : 0; >+ basis = value_get_basis (argv[5], BASIS_MSRB_30_360); > > dsm = days_monthly_basis (argv[0], argv[1], basis, date_conv); > dim = days_monthly_basis (argv[2], argv[1], basis, date_conv); >@@ -718,7 +762,7 @@ gnumeric_disc (FunctionEvalInfo *ei, Gnm > > par = value_get_as_float (argv[2]); > redemption = value_get_as_float (argv[3]); >- basis = argv[4] ? value_get_as_int (argv[4]) : 0; >+ basis = value_get_basis (argv[4], BASIS_MSRB_30_360); > > b = annual_year_basis (argv[0], basis, date_conv); > dsm = days_monthly_basis (argv[0], argv[1], basis, date_conv); >@@ -1417,13 +1461,13 @@ gnumeric_rate (FunctionEvalInfo *ei, Gnm > udata.pmt = value_get_as_float (argv[1]); > udata.pv = value_get_as_float (argv[2]); > udata.fv = argv[3] ? value_get_as_float (argv[3]) : 0.0; >- udata.type = argv[4] ? value_get_as_int (argv[4]) : 0; >+ udata.type = value_get_paytype (argv[4]); > rate0 = argv[5] ? value_get_as_float (argv[5]) : 0.1; > > if (udata.nper <= 0) > return value_new_error_NUM (ei->pos); > >- if (udata.type != 0 && udata.type != 1) >+ if (!is_valid_paytype (udata.type)) > return value_new_error_VALUE (ei->pos); > > #if 0 >@@ -1499,43 +1543,41 @@ typedef struct { > static GoalSeekStatus > irr_npv (gnm_float rate, gnm_float *y, void *user_data) > { >- gnumeric_irr_t *p = user_data; >- gnm_float *values, sum; >- int i, n; >- >- values = p->values; >- n = p->n; >- >- sum = 0; >- for (i = 0; i < n; i++) >- sum += values[i] * pow1p (rate, n - i); >+ const gnumeric_irr_t *p = user_data; >+ const gnm_float *values = p->values; >+ int n = p->n; >+ gnm_float sum = 0; >+ gnm_float f = 1; >+ gnm_float ff = 1 / (rate + 1); >+ int i; > >- /* >- * I changed the formula above by multiplying all terms by (1+r)^n. >- * Since we're looking for zeros, that should not matter. It does >- * make the derivative below simpler, though. -- MW. >- */ >+ for (i = 0; i < n; i++) { >+ sum += values[i] * f; >+ f *= ff; >+ } > > *y = sum; >- return GOAL_SEEK_OK; >+ return finitegnum (sum) ? GOAL_SEEK_OK : GOAL_SEEK_ERROR; > } > > static GoalSeekStatus > irr_npv_df (gnm_float rate, gnm_float *y, void *user_data) > { >- gnumeric_irr_t *p = user_data; >- gnm_float *values, sum; >- int i, n; >- >- values = p->values; >- n = p->n; >+ const gnumeric_irr_t *p = user_data; >+ const gnm_float *values = p->values; >+ int n = p->n; >+ gnm_float sum = 0; >+ gnm_float f = 1; >+ gnm_float ff = 1 / (rate + 1); >+ int i; > >- sum = 0; >- for (i = 0; i < n - 1; i++) >- sum += values[i] * (n - i) * pow1p (rate, n - i - 1); >+ for (i = 1; i < n; i++) { >+ sum += values[i] * (-i) * f; >+ f *= ff; >+ } > > *y = sum; >- return GOAL_SEEK_OK; >+ return finitegnum (sum) ? GOAL_SEEK_OK : GOAL_SEEK_ERROR; > } > > static GnmValue * >@@ -1560,21 +1602,31 @@ gnumeric_irr (FunctionEvalInfo *ei, GnmV > > goal_seek_initialize (&data); > >- data.xmin = MAX (data.xmin, >- -powgnum (DBL_MAX / 1e10, 1.0 / p.n) + 1); >+ data.xmin = -1; > data.xmax = MIN (data.xmax, > powgnum (DBL_MAX / 1e10, 1.0 / p.n) - 1); > > status = goal_seek_newton (&irr_npv, &irr_npv_df, &data, &p, rate0); > if (status != GOAL_SEEK_OK) { >- int factor; >+ int i; >+ gnm_float s; >+ > /* Lay a net of test points around the guess. */ >- for (factor = 2; !(data.havexneg && data.havexpos) && >- factor < 100; factor *= 2) { >- goal_seek_point (&irr_npv, &data, &p, rate0 * factor); >- goal_seek_point (&irr_npv, &data, &p, rate0 / factor); >+ for (i = 0, s = 2; !(data.havexneg && data.havexpos) && i < 10; i++, s *= 2) { >+ goal_seek_point (&irr_npv, &data, &p, rate0 * s); >+ goal_seek_point (&irr_npv, &data, &p, rate0 / s); > } > >+ /* >+ * If the root is negative and the guess is positive is >+ * is possible to get thrown out to the left of -100% >+ * by the Newton method. >+ */ >+ if (!(data.havexneg && data.havexpos)) >+ goal_seek_newton (&irr_npv, &irr_npv_df, &data, &p, -0.99); >+ if (!(data.havexneg && data.havexpos)) >+ goal_seek_point (&irr_npv, &data, &p, 1 - GNUM_EPSILON); >+ > /* Pray we got both sides of the root. */ > status = goal_seek_bisection (&irr_npv, &data, &p); > } >@@ -1615,11 +1667,15 @@ gnumeric_pv (FunctionEvalInfo *ei, GnmVa > gnm_float nper = value_get_as_float (argv[1]); > gnm_float pmt = value_get_as_float (argv[2]); > gnm_float fv = argv[3] ? value_get_as_float (argv[3]) : 0; >- int type = argv[4] ? !!value_get_as_int (argv[4]) : 0; >+ int type = value_get_paytype (argv[4]); >+ gnm_float pvif, fvifa; >+ >+ if (!is_valid_paytype (type)) >+ return value_new_error_VALUE (ei->pos); > > /* Calculate the PVIF and FVIFA */ >- gnm_float pvif = calculate_pvif (rate, nper); >- gnm_float fvifa = calculate_fvifa (rate, nper); >+ pvif = calculate_pvif (rate, nper); >+ fvifa = calculate_fvifa (rate, nper); > > if (pvif == 0) > return value_new_error_DIV0 (ei->pos); >@@ -1712,14 +1768,13 @@ gnumeric_xnpv (FunctionEvalInfo *ei, Gnm > sum = 0; > > payments = collect_floats_value (argv[1], ei->pos, >- COLLECT_IGNORE_STRINGS | >- COLLECT_IGNORE_BOOLS, >+ COLLECT_COERCE_STRINGS, > &p_n, &result); > if (result) > goto out; > > dates = collect_floats_value (argv[2], ei->pos, >- COLLECT_DATES, >+ COLLECT_COERCE_STRINGS, > &d_n, &result); > if (result) > goto out; >@@ -1820,7 +1875,7 @@ gnumeric_xirr (FunctionEvalInfo *ei, Gnm > rate0 = argv[2] ? value_get_as_float (argv[2]) : 0.1; > > p.values = collect_floats_value (argv[0], ei->pos, >- COLLECT_IGNORE_STRINGS, >+ COLLECT_COERCE_STRINGS, > &n, &result); > p.dates = NULL; > >@@ -1828,13 +1883,23 @@ gnumeric_xirr (FunctionEvalInfo *ei, Gnm > goto out; > > p.dates = collect_floats_value (argv[1], ei->pos, >- COLLECT_DATES, >+ COLLECT_COERCE_STRINGS, > &d_n, &result); > if (result != NULL) > goto out; > > p.n = n; > status = goal_seek_newton (&xirr_npv, NULL, &data, &p, rate0); >+ if (status != GOAL_SEEK_OK) { >+ int i; >+ for (i = 1; i <= 1024; i += i) { >+ (void)goal_seek_point (&xirr_npv, &data, &p, -1 + 10.0 / (i + 9)); >+ (void)goal_seek_point (&xirr_npv, &data, &p, i); >+ status = goal_seek_bisection (&xirr_npv, &data, &p); >+ if (status == GOAL_SEEK_OK) >+ break; >+ } >+ } > > if (status == GOAL_SEEK_OK) > result = value_new_float (data.root); >@@ -1876,10 +1941,14 @@ gnumeric_fv (FunctionEvalInfo *ei, GnmVa > gnm_float nper = value_get_as_float (argv[1]); > gnm_float pmt = value_get_as_float (argv[2]); > gnm_float pv = argv[3] ? value_get_as_float (argv[3]) : 0.; >- int type = argv[4] ? !!value_get_as_int (argv[4]) : 0; >+ int type = value_get_paytype (argv[4]); >+ gnm_float pvif, fvifa; > >- gnm_float pvif = calculate_pvif (rate, nper); >- gnm_float fvifa = calculate_fvifa (rate, nper); >+ if (!is_valid_paytype (type)) >+ return value_new_error_VALUE (ei->pos); >+ >+ pvif = calculate_pvif (rate, nper); >+ fvifa = calculate_fvifa (rate, nper); > > return value_new_float (-((pv * pvif) + pmt * > (1.0 + rate * type) * fvifa)); >@@ -1917,7 +1986,10 @@ gnumeric_pmt (FunctionEvalInfo *ei, GnmV > gnm_float nper = value_get_as_float (argv[1]); > gnm_float pv = value_get_as_float (argv[2]); > gnm_float fv = argv[3] ? value_get_as_float (argv[3]) : 0; >- int type = argv[4] ? !!value_get_as_int (argv[4]) : 0; >+ int type = value_get_paytype (argv[4]); >+ >+ if (!is_valid_paytype (type)) >+ return value_new_error_VALUE (ei->pos); > > return value_new_float (calculate_pmt (rate, nper, pv, fv, type)); > } >@@ -1956,7 +2028,7 @@ gnumeric_ipmt (FunctionEvalInfo *ei, Gnm > gnm_float nper = value_get_as_float (argv[2]); > gnm_float pv = value_get_as_float (argv[3]); > gnm_float fv = argv[4] ? value_get_as_float (argv[4]) : 0; >- int type = argv[5] ? !!value_get_as_int (argv[5]) : 0; >+ int type = value_get_paytype (argv[5]); > > /* > * It seems that with 20 periods, a period number of 20.99 is >@@ -1964,7 +2036,11 @@ gnumeric_ipmt (FunctionEvalInfo *ei, Gnm > */ > if (per < 1 || per >= nper + 1) > return value_new_error_NUM (ei->pos); >- else { >+ >+ if (!is_valid_paytype (type)) >+ return value_new_error_VALUE (ei->pos); >+ >+ { > gnm_float pmt = calculate_pmt (rate, nper, pv, fv, type); > gnm_float ipmt = calculate_interest_part (pv, pmt, rate, per - 1); > >@@ -2006,7 +2082,7 @@ gnumeric_ppmt (FunctionEvalInfo *ei, Gnm > gnm_float nper = value_get_as_float (argv[2]); > gnm_float pv = value_get_as_float (argv[3]); > gnm_float fv = argv[4] ? value_get_as_float (argv[4]) : 0; >- int type = argv[5] ? !!value_get_as_int (argv[5]) : 0; >+ int type = value_get_paytype (argv[5]); > > /* > * It seems that with 20 periods, a period number of 20.99 is >@@ -2014,7 +2090,11 @@ gnumeric_ppmt (FunctionEvalInfo *ei, Gnm > */ > if (per < 1 || per >= nper + 1) > return value_new_error_NUM (ei->pos); >- else { >+ >+ if (!is_valid_paytype (type)) >+ return value_new_error_VALUE (ei->pos); >+ >+ { > gnm_float pmt = calculate_pmt (rate, nper, pv, fv, type); > gnm_float ipmt = calculate_interest_part (pv, pmt, rate, per - 1); > return value_new_float (pmt - ipmt); >@@ -2059,7 +2139,7 @@ gnumeric_nper (FunctionEvalInfo *ei, Gnm > gnm_float pmt = value_get_as_float (argv[1]); > gnm_float pv = value_get_as_float (argv[2]); > gnm_float fv = argv[3] ? value_get_as_float (argv[3]) : 0; >- int type = argv[4] ? !!value_get_as_int (argv[4]) : 0; >+ int type = value_get_paytype (argv[4]); > > if (rate == 0 && pmt != 0) > return value_new_float (-(fv + pv) / pmt); >@@ -2067,6 +2147,9 @@ gnumeric_nper (FunctionEvalInfo *ei, Gnm > if (rate <= 0.0) > return value_new_error_DIV0 (ei->pos); > >+ if (!is_valid_paytype (type)) >+ return value_new_error_VALUE (ei->pos); >+ > tmp = (pmt * (1.0 + rate * type) - fv * rate) / > (pv * rate + pmt * (1.0 + rate * type)); > if (tmp <= 0.0) >@@ -2120,8 +2203,8 @@ gnumeric_duration (FunctionEvalInfo *ei, > > fCoup = value_get_as_float (argv[2]); > fYield = value_get_as_float (argv[3]); >- conv.freq = value_get_as_float (argv[4]); >- conv.basis = argv[5] ? value_get_as_int (argv[5]) : 0; >+ conv.freq = value_get_freq (argv[4]); >+ conv.basis = value_get_basis (argv[5], BASIS_MSRB_30_360); > > if (!datetime_value_to_g (&nSettle, argv[0], conv.date_conv) || > !datetime_value_to_g (&nMat, argv[1], conv.date_conv) || >@@ -2417,9 +2500,9 @@ gnumeric_price (FunctionEvalInfo *ei, Gn > rate = value_get_as_float (argv[2]); > yield = value_get_as_float (argv[3]); > redemption = value_get_as_float (argv[4]); >- conv.freq = value_get_as_int (argv[5]); >+ conv.freq = value_get_freq (argv[5]); > conv.eom = TRUE; >- conv.basis = argv[6] ? value_get_as_int (argv[6]) : 0; >+ conv.basis = value_get_basis (argv[6], BASIS_MSRB_30_360); > > if (!datetime_value_to_g (&settlement, argv[0], conv.date_conv) || > !datetime_value_to_g (&maturity, argv[1], conv.date_conv)) >@@ -2493,8 +2576,8 @@ gnumeric_yield (FunctionEvalInfo *ei, Gn > udata.rate = value_get_as_float (argv[2]); > udata.par = value_get_as_float (argv[3]); > udata.redemption = value_get_as_float (argv[4]); >- udata.conv.freq = value_get_as_int (argv[5]); >- udata.conv.basis = argv[6] ? value_get_as_int (argv[6]) : 0; >+ udata.conv.freq = value_get_freq (argv[5]); >+ udata.conv.basis = value_get_basis (argv[6], BASIS_MSRB_30_360); > udata.conv.eom = TRUE; > udata.conv.date_conv = workbook_date_conv (ei->pos->sheet->workbook); > >@@ -2593,16 +2676,16 @@ gnumeric_yielddisc (FunctionEvalInfo *ei > { > GDate settlement, maturity; > gnm_float fPrice, fRedemp; >- gint nBase; >+ gint basis; > gnm_float ret, yfrac; > GnmDateConventions const *date_conv = > workbook_date_conv (ei->pos->sheet->workbook); > > fPrice = value_get_as_float (argv[2]); > fRedemp = value_get_as_float (argv[3]); >- nBase = argv[4] ? value_get_as_int (argv[4]) : 0; >+ basis = value_get_basis (argv[4], BASIS_MSRB_30_360); > >- if (!is_valid_basis (nBase) || >+ if (!is_valid_basis (basis) || > !datetime_value_to_g (&settlement, argv[0], date_conv) || > !datetime_value_to_g (&maturity, argv[1], date_conv)) > return value_new_error_NUM (ei->pos); >@@ -2613,7 +2696,7 @@ gnumeric_yielddisc (FunctionEvalInfo *ei > return value_new_error_NUM (ei->pos); > > ret = (fRedemp / fPrice) - 1; >- yfrac = yearfrac (&settlement, &maturity, nBase); >+ yfrac = yearfrac (&settlement, &maturity, basis); > > return value_new_float (ret / yfrac); > } >@@ -2653,21 +2736,22 @@ gnumeric_yieldmat (FunctionEvalInfo *ei, > { > GDate nSettle, nMat, nIssue; > gnm_float fRate, fPrice; >- gint nBase; >+ gint basis; > GnmDateConventions const *date_conv = > workbook_date_conv (ei->pos->sheet->workbook); > > fRate = value_get_as_float (argv[3]); > fPrice = value_get_as_float (argv[4]); >- nBase = argv[5] ? value_get_as_int (argv[5]) : 0; >+ basis = value_get_basis (argv[5], BASIS_MSRB_30_360); > >- if (nBase < 0 || nBase > 4 || fRate < 0 || >+ if (!is_valid_basis (basis) || >+ fRate < 0 || > !datetime_value_to_g (&nSettle, argv[0], date_conv) || > !datetime_value_to_g (&nMat, argv[1], date_conv) || > !datetime_value_to_g (&nIssue, argv[2], date_conv)) > return value_new_error_NUM (ei->pos); > >- return get_yieldmat (&nSettle, &nMat, &nIssue, fRate, fPrice, nBase); >+ return get_yieldmat (&nSettle, &nMat, &nIssue, fRate, fPrice, basis); > } > > /***************************************************************************/ >@@ -2798,8 +2882,8 @@ gnumeric_oddfprice (FunctionEvalInfo *ei > redemption = value_get_as_float (argv[6]); > > conv.eom = TRUE; >- conv.freq = value_get_as_int (argv[7]); >- conv.basis = argv[8] ? value_get_as_int (argv[8]) : 0; >+ conv.freq = value_get_freq (argv[7]); >+ conv.basis = value_get_basis (argv[8], BASIS_MSRB_30_360); > conv.date_conv = workbook_date_conv (ei->pos->sheet->workbook); > > if (!datetime_value_to_g (&settlement, argv[0], conv.date_conv) || >@@ -2888,8 +2972,8 @@ gnumeric_oddfyield (FunctionEvalInfo *ei > udata.redemption = value_get_as_float (argv[6]); > > udata.conv.eom = TRUE; >- udata.conv.freq = value_get_as_int (argv[7]); >- udata.conv.basis = argv[8] ? value_get_as_int (argv[8]) : 0; >+ udata.conv.freq = value_get_freq (argv[7]); >+ udata.conv.basis = value_get_basis (argv[8], BASIS_MSRB_30_360); > udata.conv.date_conv = workbook_date_conv (ei->pos->sheet->workbook); > > if (!datetime_value_to_g (&udata.settlement, argv[0], udata.conv.date_conv) || >@@ -2999,8 +3083,8 @@ gnumeric_oddlprice (FunctionEvalInfo *ei > redemption = value_get_as_float (argv[5]); > > conv.eom = TRUE; >- conv.freq = value_get_as_int (argv[6]); >- conv.basis = argv[7] ? value_get_as_int (argv[7]) : 0; >+ conv.freq = value_get_freq (argv[6]); >+ conv.basis = value_get_basis (argv[7], BASIS_MSRB_30_360); > conv.date_conv = workbook_date_conv (ei->pos->sheet->workbook); > > if (!datetime_value_to_g (&settlement, argv[0], conv.date_conv) || >@@ -3090,8 +3174,8 @@ gnumeric_oddlyield (FunctionEvalInfo *ei > redemption = value_get_as_float (argv[5]); > > conv.eom = TRUE; >- conv.freq = value_get_as_int (argv[6]); >- conv.basis = argv[7] ? value_get_as_int (argv[7]) : 0; >+ conv.freq = value_get_freq (argv[6]); >+ conv.basis = value_get_basis (argv[7], BASIS_MSRB_30_360); > conv.date_conv = workbook_date_conv (ei->pos->sheet->workbook); > > if (!datetime_value_to_g (&settlement, argv[0], conv.date_conv) || >@@ -3156,7 +3240,7 @@ gnumeric_amordegrc (FunctionEvalInfo *ei > { > GDate nDate, nFirstPer; > gnm_float fRestVal, fRate, fCost; >- gint nBase, nPer; >+ gint basis, nPer; > GnmDateConventions const *date_conv = > workbook_date_conv (ei->pos->sheet->workbook); > >@@ -3164,15 +3248,16 @@ gnumeric_amordegrc (FunctionEvalInfo *ei > fRestVal = value_get_as_float (argv[3]); > nPer = value_get_as_int (argv[4]); > fRate = value_get_as_float (argv[5]); >- nBase = argv[6] ? value_get_as_int (argv[6]) : 0; >+ basis = value_get_basis (argv[6], BASIS_MSRB_30_360); > >- if (nBase < 0 || nBase > 4 || fRate < 0 || >+ if (!is_valid_basis (basis) || >+ fRate < 0 || > !datetime_value_to_g (&nDate, argv[1], date_conv) || > !datetime_value_to_g (&nFirstPer, argv[2], date_conv)) > return value_new_error_NUM (ei->pos); > > return get_amordegrc (fCost, &nDate, &nFirstPer, >- fRestVal, nPer, fRate, nBase); >+ fRestVal, nPer, fRate, basis); > } > > /***************************************************************************/ >@@ -3216,7 +3301,7 @@ gnumeric_amorlinc (FunctionEvalInfo *ei, > { > GDate nDate, nFirstPer; > gnm_float fCost, fRestVal, fRate; >- gint nPer, nBase; >+ gint nPer, basis; > GnmDateConventions const *date_conv = > workbook_date_conv (ei->pos->sheet->workbook); > >@@ -3224,15 +3309,16 @@ gnumeric_amorlinc (FunctionEvalInfo *ei, > fRestVal = value_get_as_float (argv[3]); > nPer = value_get_as_int (argv[4]); > fRate = value_get_as_float (argv[5]); >- nBase = argv[6] ? value_get_as_int (argv[6]) : 0; >+ basis = value_get_basis (argv[6], BASIS_MSRB_30_360); > >- if (nBase < 0 || nBase > 4 || fRate < 0 || >+ if (!is_valid_basis (basis) || >+ fRate < 0 || > !datetime_value_to_g (&nDate, argv[1], date_conv) || > !datetime_value_to_g (&nFirstPer, argv[2], date_conv)) > return value_new_error_NUM (ei->pos); > > return get_amorlinc (fCost, &nDate, &nFirstPer, >- fRestVal, nPer, fRate, nBase); >+ fRestVal, nPer, fRate, basis); > } > > /***************************************************************************/ >@@ -3539,11 +3625,11 @@ gnumeric_cumipmt (FunctionEvalInfo *ei, > fVal = value_get_as_float (argv[2]); > nStartPer = value_get_as_int (argv[3]); > nEndPer = value_get_as_int (argv[4]); >- nPayType = value_get_as_int (argv[5]); >+ nPayType = value_get_paytype (argv[5]); > > if ( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0 > || nEndPer > nNumPeriods || nNumPeriods <= 0 >- || fVal <= 0 || (nPayType != 0 && nPayType != 1) ) { >+ || fVal <= 0 || !is_valid_paytype (nPayType) ) { > result = value_new_error_NUM (ei->pos); > goto out; > } >@@ -3589,11 +3675,11 @@ gnumeric_cumprinc (FunctionEvalInfo *ei, > fVal = value_get_as_float (argv[2]); > nStartPer = value_get_as_int (argv[3]); > nEndPer = value_get_as_int (argv[4]); >- nPayType = value_get_as_int (argv[5]); >+ nPayType = value_get_paytype (argv[5]); > > if ( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0 > || nEndPer > nNumPeriods || nNumPeriods <= 0 >- || fVal <= 0 || (nPayType != 0 && nPayType != 1) ) { >+ || fVal <= 0 || !is_valid_paytype (nPayType)) { > result = value_new_error_NUM (ei->pos); > goto out; > } >@@ -3648,8 +3734,8 @@ gnumeric_mduration (FunctionEvalInfo *ei > > fCoup = value_get_as_float (argv[2]); > fYield = value_get_as_float (argv[3]); >- conv.freq = value_get_as_float (argv[4]); >- conv.basis = argv[5] ? value_get_as_int (argv[5]) : 0; >+ conv.freq = value_get_freq (argv[4]); >+ conv.basis = value_get_basis (argv[5], BASIS_MSRB_30_360); > conv.eom = FALSE; > > if (!is_valid_basis (conv.basis) || >@@ -3695,8 +3781,8 @@ gnumeric_vdb (FunctionEvalInfo *ei, GnmV > life = value_get_as_float (argv[2]); > start_period = value_get_as_float (argv[3]); > end_period = value_get_as_float (argv[4]); >- factor = value_get_as_float (argv[5]); /* Default could be 2.0 */ >- bflag = argv[6] ? value_get_as_int (argv[6]) : FALSE; >+ factor = argv[5] ? value_get_as_float (argv[5]) : 2; >+ bflag = argv[6] ? value_get_as_int (argv[6]) : 0; > > if ( start_period < 0 || end_period < start_period > || end_period > life || cost < 0 || salvage > cost >Index: plugins/fn-info/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-info/functions.c,v >retrieving revision 1.140.2.2 >diff -u -w -p -r1.140.2.2 functions.c >--- plugins/fn-info/functions.c 13 Mar 2005 04:29:25 -0000 1.140.2.2 >+++ plugins/fn-info/functions.c 14 Mar 2006 19:15:52 -0000 >@@ -1228,8 +1228,13 @@ cb_countblank (Sheet *sheet, int col, in > GnmCell *cell, void *user_data) > { > cell_eval (cell); >- if (!cell_is_empty (cell)) >+ if (!cell_is_empty (cell)) { >+ const GnmValue *v = cell->value; >+ if (VALUE_IS_STRING (v) && value_peek_string (v)[0] == 0) >+ ; /* Nothing -- the empty string is blank. */ >+ else > *((int *)user_data) -= 1; >+ } > return NULL; > } > >@@ -1759,21 +1764,19 @@ static char const *help_type = { > static GnmValue * > gnumeric_type (FunctionEvalInfo *ei, GnmValue **argv) > { >- switch (argv[0]->type) { >- /* case VALUE_EMPTY : not possible, S arguments convert this to int(0) >- * This is XL compatible, although I don't really agree with it >- */ >+ const GnmValue *v = argv[0]; >+ switch (v ? VALUE_TYPE (v) : VALUE_EMPTY) { > case VALUE_BOOLEAN: > return value_new_int (4); >+ case VALUE_EMPTY: > case VALUE_INTEGER: > case VALUE_FLOAT: > return value_new_int (1); >+ case VALUE_CELLRANGE: > case VALUE_ERROR: > return value_new_int (16); > case VALUE_STRING: > return value_new_int (2); >- /* case VALUE_CELLRANGE: S argument handles this */ >-#warning FIXME : S arguments will filter arrays > case VALUE_ARRAY: > return value_new_int (64); > default: >@@ -1844,7 +1847,7 @@ const GnmFuncDescriptor info_functions[] > { "isnontext", "E", N_("value"), &help_isnontext, > gnumeric_isnontext, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, >- { "isnumber", "B", N_("value"), &help_isnumber, >+ { "isnumber", "E", N_("value"), &help_isnumber, > gnumeric_isnumber, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, > { "isodd", "S", N_("value"), &help_isodd, >Index: plugins/fn-logical/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-logical/functions.c,v >retrieving revision 1.72 >diff -u -w -p -r1.72 functions.c >--- plugins/fn-logical/functions.c 5 Aug 2004 18:58:46 -0000 1.72 >+++ plugins/fn-logical/functions.c 14 Mar 2006 19:15:52 -0000 >@@ -72,11 +72,13 @@ static GnmValue * > callback_function_and (const GnmEvalPos *ep, GnmValue *value, void *closure) > { > int *result = closure; >- gboolean err; > >+ if (!VALUE_IS_STRING (value)) { >+ gboolean err; > *result = value_get_as_bool (value, &err) && *result; > if (err) > return value_new_error_VALUE (ep); >+ } > > return NULL; > } >@@ -159,11 +161,13 @@ static GnmValue * > callback_function_or (const GnmEvalPos *ep, GnmValue *value, void *closure) > { > int *result = closure; >- gboolean err; > >+ if (!VALUE_IS_STRING (value)) { >+ gboolean err; > *result = value_get_as_bool (value, &err) || *result == 1; > if (err) > return value_new_error_VALUE (ep); >+ } > > return NULL; > } >@@ -216,11 +220,13 @@ static GnmValue * > callback_function_xor (const GnmEvalPos *ep, GnmValue *value, void *closure) > { > int *result = closure; >- gboolean err; > >+ if (!VALUE_IS_STRING (value)) { >+ gboolean err; > *result = value_get_as_bool (value, &err) ^ (*result == 1); > if (err) > return value_new_error_VALUE (ep); >+ } > > return NULL; > } >Index: plugins/fn-lookup/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-lookup/functions.c,v >retrieving revision 1.133.2.2 >diff -u -w -p -r1.133.2.2 functions.c >--- plugins/fn-lookup/functions.c 13 Mar 2005 04:29:26 -0000 1.133.2.2 >+++ plugins/fn-lookup/functions.c 14 Mar 2006 19:15:52 -0000 >@@ -1231,7 +1231,7 @@ GnmFuncDescriptor const lookup_functions > { "columns", "A", N_("ref"), > &help_columns, gnumeric_columns, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, >- { "hlookup", "BAf|bb", N_("val,range,col_idx,approx,as_index"), >+ { "hlookup", "EAf|bb", N_("val,range,col_idx,approx,as_index"), > &help_hlookup, gnumeric_hlookup, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, > { "hyperlink", "s|s", N_("link_location, label"), >@@ -1243,10 +1243,10 @@ GnmFuncDescriptor const lookup_functions > { "index", "A|fff",N_("reference,row,col,area"), > &help_index, NULL, gnumeric_index, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, >- { "lookup", "BA|r", N_("val,range,range"), >+ { "lookup", "EA|r", N_("val,range,range"), > &help_lookup, gnumeric_lookup, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, >- { "match", "BA|f", N_("val,range,approx"), >+ { "match", "EA|f", N_("val,range,approx"), > &help_match, gnumeric_match, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, > { "offset", "rff|ff",N_("ref,row,col,height,width"), >@@ -1261,7 +1261,7 @@ GnmFuncDescriptor const lookup_functions > { "transpose", "A", N_("array"), > &help_transpose, gnumeric_transpose, NULL, NULL, NULL, NULL, > GNM_FUNC_RETURNS_NON_SCALAR, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, >- { "vlookup", "BAf|bb", N_("val,range,col_idx,approx,as_index"), >+ { "vlookup", "EAf|bb", N_("val,range,col_idx,approx,as_index"), > &help_vlookup, gnumeric_vlookup, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, > >Index: plugins/fn-math/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-math/functions.c,v >retrieving revision 1.235.2.2 >diff -u -w -p -r1.235.2.2 functions.c >--- plugins/fn-math/functions.c 13 Mar 2005 04:29:26 -0000 1.235.2.2 >+++ plugins/fn-math/functions.c 14 Mar 2006 19:15:52 -0000 >@@ -454,8 +454,13 @@ static char const *help_atan2 = { > static GnmValue * > gnumeric_atan2 (FunctionEvalInfo *ei, GnmValue **args) > { >- return value_new_float (atan2gnum (value_get_as_float (args [1]), >- value_get_as_float (args [0]))); >+ gnm_float x = value_get_as_float (args [0]); >+ gnm_float y = value_get_as_float (args [1]); >+ >+ if (x == 0 && y == 0) >+ return value_new_error_DIV0 (ei->pos); >+ >+ return value_new_float (atan2gnum (y, x)); > } > > /***************************************************************************/ >@@ -541,8 +546,8 @@ gnumeric_countif (FunctionEvalInfo *ei, > * 1) @range must be a range, arrays are not supported > * 2) @range can not be 3d */ > if (r->type != VALUE_CELLRANGE || >- (sheet = eval_sheet (r->cell.a.sheet, ei->pos->sheet)) != >- eval_sheet (r->cell.b.sheet, ei->pos->sheet) || >+ ((sheet = eval_sheet (r->cell.a.sheet, ei->pos->sheet)) != r->cell.b.sheet && >+ r->cell.b.sheet != NULL) || > (!VALUE_IS_NUMBER (argv[1]) && argv[1]->type != VALUE_STRING)) > return value_new_error_VALUE (ei->pos); > >@@ -638,8 +643,8 @@ gnumeric_sumif (FunctionEvalInfo *ei, Gn > * 1) @range must be a range, arrays are not supported > * 2) @range can not be 3d */ > if (r->type != VALUE_CELLRANGE || >- (sheet = eval_sheet (r->cell.a.sheet, ei->pos->sheet)) != >- eval_sheet (r->cell.b.sheet, ei->pos->sheet) || >+ ((sheet = eval_sheet (r->cell.a.sheet, ei->pos->sheet)) != r->cell.b.sheet && >+ r->cell.b.sheet != NULL) || > (!VALUE_IS_NUMBER (argv[1]) && argv[1]->type != VALUE_STRING)) > return value_new_error_VALUE (ei->pos); > >@@ -648,7 +653,7 @@ gnumeric_sumif (FunctionEvalInfo *ei, Gn > if (NULL != argv[2]) { > GnmValueRange const *target = &argv[2]->v_range; > res.target_sheet = eval_sheet (target->cell.a.sheet, ei->pos->sheet); >- if (res.target_sheet != eval_sheet (target->cell.b.sheet, ei->pos->sheet)) >+ if (target->cell.b.sheet && res.target_sheet != target->cell.b.sheet) > return value_new_error_VALUE (ei->pos); > res.offset.col = target->cell.a.col - r->cell.a.col; > res.offset.row = target->cell.a.row - r->cell.a.row; >@@ -707,16 +712,12 @@ gnumeric_ceiling (FunctionEvalInfo *ei, > > if (argv[1] == NULL) > s = (number >= 0) ? 1.0 : -1.0; >- else { >+ else > s = value_get_as_float (argv[1]); >- } > >- if (number == 0) >+ if (number == 0 || s == 0) > return value_new_int (0); > >- if (s == 0) >- return value_new_error_DIV0 (ei->pos); >- > if (number / s < 0) > return value_new_error_NUM (ei->pos); > >@@ -1585,17 +1586,24 @@ static char const *help_trunc = { > static GnmValue * > gnumeric_trunc (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float number, p10; >- int digits; >+ gnm_float number = value_get_as_float (argv[0]); >+ gnm_float digits = argv[1] ? value_get_as_float (argv[1]) : 0; > >- number = value_get_as_float (argv[0]); >- if (argv[1] == NULL) >- digits = 0; >- else >- digits = value_get_as_int (argv[1]); >+ if (digits >= 0) { >+ if (digits <= GNUM_MAX_EXP) { >+ gnm_float p10 = gpow10 ((int)digits); >+ number = gnumeric_fake_trunc (number * p10) / p10; >+ } >+ } else { >+ if (digits >= GNUM_MIN_EXP) { >+ /* Keep p10 integer. */ >+ gnm_float p10 = gpow10 ((int)-digits); >+ number = gnumeric_fake_trunc (number / p10) * p10; >+ } else >+ number = 0; >+ } > >- p10 = gpow10 (digits); >- return value_new_float (gnumeric_fake_trunc (number * p10) / p10); >+ return value_new_float (number); > } > > /***************************************************************************/ >@@ -1700,18 +1708,24 @@ static GnmValue * > gnumeric_factdouble (FunctionEvalInfo *ei, GnmValue **argv) > > { >- int number; >- int n; >- gnm_float product = 1; >+ gnm_float number = value_get_as_float (argv[0]); >+ int inumber, n; >+ gnm_float res; > >- number = value_get_as_int (argv[0]); > if (number < 0) > return value_new_error_NUM (ei->pos); > >- for (n = number; n > 0; n -= 2) >- product *= n; >+ inumber = (int)MIN (number, (gnm_float)INT_MAX); >+ n = (inumber + 1) / 2; >+ >+ if (inumber & 1) { >+ gnm_float lres = lgammagnum (n + 0.5) + n * M_LN2gnum; >+ /* Round as the result ought to be integer. */ >+ res = floorgnum (0.5 + expgnum (lres) / sqrtgnum (M_PIgnum)); >+ } else >+ res = fact (n) * gpow2 (n); > >- return value_new_float (product); >+ return value_new_float (res); > } > > /***************************************************************************/ >@@ -1783,10 +1797,8 @@ static char const *help_quotient = { > static GnmValue * > gnumeric_quotient (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float num, den; >- >- num = value_get_as_float (argv[0]); >- den = value_get_as_float (argv[1]); >+ gnm_float num = value_get_as_float (argv[0]); >+ gnm_float den = value_get_as_float (argv[1]); > > if (den == 0) > return value_new_error_DIV0 (ei->pos); >@@ -1888,17 +1900,7 @@ static char const *help_rounddown = { > static GnmValue * > gnumeric_rounddown (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float number, p10; >- int digits; >- >- number = value_get_as_float (argv[0]); >- if (argv[1] == NULL) >- digits = 0; >- else >- digits = value_get_as_int (argv[1]); >- >- p10 = gpow10 (digits); >- return value_new_float (gnumeric_fake_floor (number * p10) / p10); >+ return gnumeric_trunc (ei, argv); > } > > /***************************************************************************/ >@@ -1932,14 +1934,24 @@ static char const *help_round = { > static GnmValue * > gnumeric_round (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float number, p10; >- int digits; >+ gnm_float number = value_get_as_float (argv[0]); >+ gnm_float digits = argv[1] ? value_get_as_float (argv[1]) : 0; > >- number = value_get_as_float (argv[0]); >- digits = argv[1] ? value_get_as_int (argv[1]) : 0; >+ if (digits >= 0) { >+ if (digits <= GNUM_MAX_EXP) { >+ gnm_float p10 = gpow10 ((int)digits); >+ number = gnumeric_fake_round (number * p10) / p10; >+ } >+ } else { >+ if (digits >= GNUM_MIN_EXP) { >+ /* Keep p10 integer. */ >+ gnm_float p10 = gpow10 ((int)-digits); >+ number = gnumeric_fake_round (number / p10) * p10; >+ } else >+ number = 0; >+ } > >- p10 = gpow10 (digits); >- return value_new_float (gnumeric_fake_round (number * p10) / p10); >+ return value_new_float (number); > } > > /***************************************************************************/ >@@ -1970,20 +1982,33 @@ static char const *help_roundup = { > "@SEEALSO=ROUND,ROUNDDOWN") > }; > >+static gnm_float >+gnm_fake_roundup (gnm_float x) >+{ >+ return (x < 0) ? gnumeric_fake_floor (x) : gnumeric_fake_ceil (x); >+} >+ > static GnmValue * > gnumeric_roundup (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float number, p10; >- int digits; >+ gnm_float number = value_get_as_float (argv[0]); >+ gnm_float digits = argv[1] ? value_get_as_float (argv[1]) : 0; > >- number = value_get_as_float (argv[0]); >- if (argv[1] == NULL) >- digits = 0; >- else >- digits = value_get_as_int (argv[1]); >+ if (digits >= 0) { >+ if (digits <= GNUM_MAX_EXP) { >+ gnm_float p10 = gpow10 ((int)digits); >+ number = gnm_fake_roundup (number * p10) / p10; >+ } >+ } else { >+ if (digits >= GNUM_MIN_EXP) { >+ /* Keep p10 integer. */ >+ gnm_float p10 = gpow10 ((int)-digits); >+ number = gnm_fake_roundup (number / p10) * p10; >+ } else >+ number = 0; >+ } > >- p10 = gpow10 (digits); >- return value_new_float (gnumeric_fake_ceil (number * p10) / p10); >+ return value_new_float (number); > } > > /***************************************************************************/ >Index: plugins/fn-stat/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-stat/functions.c,v >retrieving revision 1.235 >diff -u -w -p -r1.235 functions.c >--- plugins/fn-stat/functions.c 13 Jan 2005 19:49:57 -0000 1.235 >+++ plugins/fn-stat/functions.c 14 Mar 2006 19:15:53 -0000 >@@ -383,8 +383,8 @@ static char const *help_trimmean = { > static int > range_trimmean (const gnm_float *xs, int n, gnm_float *res) > { >- gnm_float p, sum = 0; >- int tc, c, i; >+ gnm_float p; >+ int tc, c; > > if (n < 2) > return 1; >@@ -393,7 +393,7 @@ range_trimmean (const gnm_float *xs, int > if (p < 0 || p > 1) > return 1; > >- tc = (n * p) / 2; >+ tc = gnumeric_fake_floor ((n * p) / 2); > c = n - 2 * tc; > if (c == 0) > return 1; >@@ -401,11 +401,7 @@ range_trimmean (const gnm_float *xs, int > /* OK, so we ignore the constness here. Tough. */ > qsort ((gnm_float *) xs, n, sizeof (xs[0]), (void *) &float_compare); > >- for (i = tc; i < n - tc; i++) >- sum += xs[i]; >- >- *res = sum / c; >- return 0; >+ return range_average (xs + tc, c, res); > } > > static GnmValue * >@@ -508,12 +504,9 @@ static char const *help_negbinomdist = { > static GnmValue * > gnumeric_negbinomdist (FunctionEvalInfo *ei, GnmValue **argv) > { >- int x, r; >- gnm_float p; >- >- x = value_get_as_int (argv[0]); >- r = value_get_as_int (argv[1]); >- p = value_get_as_float (argv[2]); >+ int x = value_get_as_int (argv[0]); >+ int r = value_get_as_int (argv[1]); >+ gnm_float p = value_get_as_float (argv[2]); > > if ((x + r - 1) <= 0 || p < 0 || p > 1) > return value_new_error_NUM (ei->pos); >@@ -1081,20 +1074,13 @@ static char const *help_expondist = { > static GnmValue * > gnumeric_expondist (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float x, y; >- int cuml; >- gboolean err; >- >- x = value_get_as_float (argv[0]); >- y = value_get_as_float (argv[1]); >+ gnm_float x = value_get_as_float (argv[0]); >+ gnm_float y = value_get_as_float (argv[1]); >+ gboolean cuml = value_get_as_checked_bool (argv[2]); > > if (x < 0.0 || y <= 0.0) > return value_new_error_NUM (ei->pos); > >- cuml = value_get_as_bool (argv[2], &err); >- if (err) >- return value_new_error_VALUE (ei->pos); >- > if (cuml) > return value_new_float (pexp (x, 1 / y, TRUE, FALSE)); > else >@@ -1204,17 +1190,14 @@ static char const *help_gammadist = { > static GnmValue * > gnumeric_gammadist (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float x, alpha, beta; >- int cum; >- >- x = value_get_as_float (argv[0]); >- alpha = value_get_as_float (argv[1]); >- beta = value_get_as_float (argv[2]); >+ gnm_float x = value_get_as_float (argv[0]); >+ gnm_float alpha = value_get_as_float (argv[1]); >+ gnm_float beta = value_get_as_float (argv[2]); >+ gboolean cum = value_get_as_checked_bool (argv[3]); > > if (x < 0 || alpha <= 0 || beta <= 0) > return value_new_error_NUM (ei->pos); > >- cum = value_get_as_int (argv[3]); > if (cum) > return value_new_float (pgamma (x, alpha, beta, TRUE, FALSE)); > else >@@ -1280,11 +1263,8 @@ static char const *help_chidist = { > static GnmValue * > gnumeric_chidist (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float x; >- int dof; >- >- x = value_get_as_float (argv[0]); >- dof = value_get_as_int (argv[1]); >+ gnm_float x = value_get_as_float (argv[0]); >+ int dof = value_get_as_int (argv[1]); > > if (dof < 1) > return value_new_error_NUM (ei->pos); >@@ -1314,11 +1294,8 @@ static char const *help_chiinv = { > static GnmValue * > gnumeric_chiinv (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float p; >- int dof; >- >- p = value_get_as_float (argv[0]); >- dof = value_get_as_int (argv[1]); >+ gnm_float p = value_get_as_float (argv[0]); >+ int dof = value_get_as_int (argv[1]); > > if (p < 0 || p > 1 || dof < 1) > return value_new_error_NUM (ei->pos); >@@ -1573,12 +1550,9 @@ static char const *help_tdist = { > static GnmValue * > gnumeric_tdist (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float x; >- int dof, tails; >- >- x = value_get_as_float (argv[0]); >- dof = value_get_as_int (argv[1]); >- tails = value_get_as_int (argv[2]); >+ gnm_float x = value_get_as_float (argv[0]); >+ int dof = value_get_as_int (argv[1]); >+ int tails = value_get_as_int (argv[2]); > > if (dof < 1 || (tails != 1 && tails != 2)) > return value_new_error_NUM (ei->pos); >@@ -1609,11 +1583,8 @@ static char const *help_tinv = { > static GnmValue * > gnumeric_tinv (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float p; >- int dof; >- >- p = value_get_as_float (argv[0]); >- dof = value_get_as_int (argv[1]); >+ gnm_float p = value_get_as_float (argv[0]); >+ int dof = value_get_as_int (argv[1]); > > if (p < 0 || p > 1 || dof < 1) > return value_new_error_NUM (ei->pos); >@@ -1645,12 +1616,9 @@ static char const *help_fdist = { > static GnmValue * > gnumeric_fdist (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float x; >- int dof1, dof2; >- >- x = value_get_as_float (argv[0]); >- dof1 = value_get_as_int (argv[1]); >- dof2 = value_get_as_int (argv[2]); >+ gnm_float x = value_get_as_float (argv[0]); >+ int dof1 = value_get_as_int (argv[1]); >+ int dof2 = value_get_as_int (argv[2]); > > if (x < 0 || dof1 < 1 || dof2 < 1) > return value_new_error_NUM (ei->pos); >@@ -1823,12 +1791,9 @@ static char const *help_finv = { > static GnmValue * > gnumeric_finv (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float p; >- int dof1, dof2; >- >- p = value_get_as_float (argv[0]); >- dof1 = value_get_as_int (argv[1]); >- dof2 = value_get_as_int (argv[2]); >+ gnm_float p = value_get_as_float (argv[0]); >+ int dof1 = value_get_as_int (argv[1]); >+ int dof2 = value_get_as_int (argv[2]); > > if (p < 0 || p > 1 || dof1 < 1 || dof2 < 1) > return value_new_error_NUM (ei->pos); >@@ -1864,16 +1829,12 @@ static char const *help_binomdist = { > static GnmValue * > gnumeric_binomdist (FunctionEvalInfo *ei, GnmValue **argv) > { >- int n, trials, cuml; >- gboolean err; >- gnm_float p; >+ int n = value_get_as_int (argv[0]); >+ int trials = value_get_as_int (argv[1]); >+ gnm_float p = value_get_as_float (argv[2]); >+ gboolean cuml = value_get_as_checked_bool (argv[3]); > >- n = value_get_as_int (argv[0]); >- trials = value_get_as_int (argv[1]); >- p = value_get_as_float (argv[2]); >- cuml = value_get_as_bool (argv[3], &err); >- >- if (n < 0 || trials < 0 || p < 0 || p > 1 || n > trials || err) >+ if (n < 0 || trials < 0 || p < 0 || p > 1 || n > trials) > return value_new_error_NUM (ei->pos); > > if (cuml) >@@ -1906,16 +1867,11 @@ gnumeric_cauchy (FunctionEvalInfo *ei, G > { > gnm_float x = value_get_as_float (argv[0]); > gnm_float a = value_get_as_float (argv[1]); >- int cuml; >- gboolean err; >+ gboolean cuml = value_get_as_checked_bool (argv[2]); > > if (a < 0) > return value_new_error_NUM (ei->pos); > >- cuml = value_get_as_bool (argv[2], &err); >- if (err) >- return value_new_error_VALUE (ei->pos); >- > if (cuml) > return value_new_float (pcauchy (x, 0, a, FALSE, FALSE)); > else >@@ -1949,12 +1905,9 @@ static char const *help_critbinom = { > static GnmValue * > gnumeric_critbinom (FunctionEvalInfo *ei, GnmValue **argv) > { >- int trials; >- gnm_float p, alpha; >- >- trials = value_get_as_int (argv[0]); >- p = value_get_as_float (argv[1]); >- alpha = value_get_as_float (argv[2]); >+ int trials = value_get_as_int (argv[0]); >+ gnm_float p = value_get_as_float (argv[1]); >+ gnm_float alpha = value_get_as_float (argv[2]); > > if (trials < 0 || p < 0 || p > 1 || alpha < 0 || alpha > 1) > return value_new_error_NUM (ei->pos); >@@ -1986,10 +1939,8 @@ static char const *help_permut = { > static GnmValue * > gnumeric_permut (FunctionEvalInfo *ei, GnmValue **argv) > { >- int n, k; >- >- n = value_get_as_int (argv[0]); >- k = value_get_as_int (argv[1]); >+ int n = value_get_as_int (argv[0]); >+ int k = value_get_as_int (argv[1]); > > if (0 <= k && k <= n) > return value_new_float (permut (n, k)); >@@ -2030,7 +1981,7 @@ gnumeric_hypgeomdist (FunctionEvalInfo * > int n = value_get_as_int (argv[1]); > int M = value_get_as_int (argv[2]); > int N = value_get_as_int (argv[3]); >- gboolean cum = argv[4] ? value_get_as_int (argv[4]) : FALSE; >+ gboolean cum = argv[4] ? value_get_as_checked_bool (argv[4]) : FALSE; > > if (x < 0 || n < 0 || M < 0 || N < 0 || x > M || n > N) > return value_new_error_NUM (ei->pos); >@@ -2145,21 +2096,14 @@ static char const *help_weibull = { > static GnmValue * > gnumeric_weibull (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float x, alpha, beta; >- int cuml; >- gboolean err; >- >- x = value_get_as_float (argv[0]); >- alpha = value_get_as_float (argv[1]); >- beta = value_get_as_float (argv[2]); >+ gnm_float x = value_get_as_float (argv[0]); >+ gnm_float alpha = value_get_as_float (argv[1]); >+ gnm_float beta = value_get_as_float (argv[2]); >+ gboolean cuml = value_get_as_checked_bool (argv[3]); > > if (x < 0 || alpha <= 0 || beta <= 0) > return value_new_error_NUM (ei->pos); > >- cuml = value_get_as_bool (argv[3], &err); >- if (err) >- return value_new_error_VALUE (ei->pos); >- > if (cuml) > return value_new_float (pweibull (x, alpha, beta, TRUE, FALSE)); > else >@@ -2190,21 +2134,14 @@ static char const *help_normdist = { > static GnmValue * > gnumeric_normdist (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float x, mean, stddev; >- int cuml; >- gboolean err; >- >- x = value_get_as_float (argv[0]); >- mean = value_get_as_float (argv[1]); >- stddev = value_get_as_float (argv[2]); >+ gnm_float x = value_get_as_float (argv[0]); >+ gnm_float mean = value_get_as_float (argv[1]); >+ gnm_float stddev = value_get_as_float (argv[2]); >+ gboolean cuml = value_get_as_checked_bool (argv[3]); > > if (stddev <= 0) > return value_new_error_DIV0 (ei->pos); > >- cuml = value_get_as_bool (argv[3], &err); >- if (err) >- return value_new_error_VALUE (ei->pos); >- > if (cuml) > return value_new_float (pnorm (x, mean, stddev, TRUE, FALSE)); > else >@@ -2236,11 +2173,9 @@ static char const *help_norminv = { > static GnmValue * > gnumeric_norminv (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float p, mean, stddev; >- >- p = value_get_as_float (argv[0]); >- mean = value_get_as_float (argv[1]); >- stddev = value_get_as_float (argv[2]); >+ gnm_float p = value_get_as_float (argv[0]); >+ gnm_float mean = value_get_as_float (argv[1]); >+ gnm_float stddev = value_get_as_float (argv[2]); > > if (p < 0 || p > 1 || stddev <= 0) > return value_new_error_NUM (ei->pos); >@@ -2446,15 +2381,11 @@ static char const *help_poisson = { > static GnmValue * > gnumeric_poisson (FunctionEvalInfo *ei, GnmValue **argv) > { >- gnm_float mean; >- int x, cuml; >- gboolean err; >- >- x = value_get_as_int (argv[0]); >- mean = value_get_as_float (argv[1]); >- cuml = value_get_as_bool (argv[2], &err); >+ gnm_float x = value_get_as_int (argv[0]); >+ gnm_float mean = value_get_as_float (argv[1]); >+ gboolean cuml = value_get_as_checked_bool (argv[2]); > >- if (x < 0 || mean <= 0 || err) >+ if (x < 0 || mean <= 0) > return value_new_error_NUM (ei->pos); > > if (cuml) >@@ -5403,7 +5334,7 @@ gnumeric_geomdist (FunctionEvalInfo *ei, > { > int k = value_get_as_int (argv[0]); > gnm_float p = value_get_as_float (argv[1]); >- gboolean cum = value_get_as_int (argv[2]); >+ gboolean cum = value_get_as_checked_bool (argv[2]); > > if (p < 0 || p > 1 || k < 0 || (cum != TRUE && cum != FALSE)) > return value_new_error_NUM (ei->pos); >@@ -5660,7 +5591,7 @@ const GnmFuncDescriptor stat_functions[] > &help_binomdist, gnumeric_binomdist, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, > >- { "cauchy", "fff", N_("x,a,cum"), &help_cauchy, >+ { "cauchy", "ffb", N_("x,a,cum"), &help_cauchy, > gnumeric_cauchy, NULL, NULL, NULL, NULL, > GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC }, > >Index: plugins/fn-string/functions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/fn-string/functions.c,v >retrieving revision 1.148.4.1 >diff -u -w -p -r1.148.4.1 functions.c >--- plugins/fn-string/functions.c 2 Feb 2005 15:47:57 -0000 1.148.4.1 >+++ plugins/fn-string/functions.c 14 Mar 2006 19:15:53 -0000 >@@ -72,15 +72,15 @@ static char const *help_char = { > static GnmValue * > gnumeric_char (FunctionEvalInfo *ei, GnmValue **argv) > { >- int c = value_get_as_int (argv[0]); >+ gnm_float c = value_get_as_float (argv[0]); > >- if (c > 0 && c <= 127) { >+ if (c >= 1 && c < 128) { > char result[2]; >- result[0] = c; >+ result[0] = (char)c; > result[1] = 0; > return value_new_string (result); >- } else if (c >= 128 && c <= 255) { >- char c2 = c; >+ } else if (c >= 128 && c < 256) { >+ char c2 = (char)c; > char *str = g_convert_with_iconv (&c2, 1, CHAR_iconv, > NULL, NULL, NULL); > if (str) { >@@ -88,9 +88,10 @@ gnumeric_char (FunctionEvalInfo *ei, Gnm > if (len == 1) > return value_new_string_nocopy (str); > g_warning ("iconv for CHAR(%d) produced a string of length %d", >- c, len); >+ c2, len); >+ g_free (str); > } else >- g_warning ("iconv failed for CHAR(%d)", c); >+ g_warning ("iconv failed for CHAR(%d)", c2); > } > > return value_new_error_VALUE (ei->pos); >@@ -115,11 +116,11 @@ static char const *help_unichar = { > static GnmValue * > gnumeric_unichar (FunctionEvalInfo *ei, GnmValue **argv) > { >- int c = value_get_as_int (argv[0]); >+ gnm_float c = value_get_as_float (argv[0]); > >- if (g_unichar_validate (c)) { >+ if (c >= 0 && c <= INT_MAX && g_unichar_validate ((gunichar)c)) { > char utf8[8]; >- int len = g_unichar_to_utf8 (c, utf8); >+ int len = g_unichar_to_utf8 ((gunichar)c, utf8); > utf8[len] = 0; > return value_new_string (utf8); > } else >@@ -288,19 +289,17 @@ static char const *help_left = { > static GnmValue * > gnumeric_left (FunctionEvalInfo *ei, GnmValue **argv) > { >- char const *peek; >- int count, newlen; >- >- count = argv[1] ? value_get_as_int (argv[1]) : 1; >+ const guchar *peek = (const guchar *)value_peek_string (argv[0]); >+ gnm_float count = argv[1] ? value_get_as_float (argv[1]) : 1.0; >+ int icount, newlen; > > if (count < 0) > return value_new_error_VALUE (ei->pos); >+ icount = (int)MIN ((gnm_float)INT_MAX, count); > >- peek = value_peek_string (argv[0]); >- if (count >= g_utf8_strlen (peek, -1)) >- return value_new_string (peek); >+ for (newlen = 0; peek[newlen] != 0 && icount > 0; icount--) >+ newlen += g_utf8_skip[peek[newlen]]; > >- newlen = g_utf8_offset_to_pointer (peek, count) - peek; > return value_new_string_nocopy (g_strndup (peek, newlen)); > } > >@@ -346,27 +345,24 @@ static char const *help_mid = { > static GnmValue * > gnumeric_mid (FunctionEvalInfo *ei, GnmValue **argv) > { >- char *upos; >- char const *source; >- int pos, len, ulen, slen; >+ const char *source = value_peek_string (argv[0]); >+ gnm_float pos = value_get_as_float (argv[1]); >+ gnm_float len = value_get_as_float (argv[2]); >+ size_t slen = g_utf8_strlen (source, -1); >+ const char *upos; >+ size_t ilen, ipos, ulen; > >- pos = value_get_as_int (argv[1]); >- len = value_get_as_int (argv[2]); >- >- if (len < 0 || pos <= 0) >- return value_new_error_VALUE (ei->pos); >- >- source = value_peek_string (argv[0]); >- slen = g_utf8_strlen (source, -1); >- >- if (pos > slen) >+ if (len < 0 || pos < 1) > return value_new_error_VALUE (ei->pos); >+ if (pos >= slen + 1) >+ return value_new_string (""); > >- pos--; /* Make pos zero-based. */ >+ /* Make ipos zero-based. */ >+ ipos = (size_t)(pos - 1); >+ ilen = (size_t)MIN (len, (gnm_float)(slen - ipos)); > >- len = MIN (len, slen - pos); >- upos = g_utf8_offset_to_pointer (source, pos); >- ulen = g_utf8_offset_to_pointer (upos, len) - upos; >+ upos = g_utf8_offset_to_pointer (source, ipos); >+ ulen = g_utf8_offset_to_pointer (upos, ilen) - upos; > > return value_new_string_nocopy (g_strndup (upos, ulen)); > } >@@ -392,27 +388,22 @@ static char const *help_right = { > static GnmValue * > gnumeric_right (FunctionEvalInfo *ei, GnmValue **argv) > { >- int count, slen; >- char const *os; >- char *s; >- >- count = argv[1] ? value_get_as_int (argv[1]) : 1; >+ char const *os = value_peek_string (argv[0]); >+ gnm_float count = argv[1] ? value_get_as_float (argv[1]) : 1.0; >+ int icount, slen; > > if (count < 0) > return value_new_error_VALUE (ei->pos); >+ icount = (int)MIN ((gnm_float)INT_MAX, count); > >- os = value_peek_string (argv[0]); > slen = g_utf8_strlen (os, -1); > >- if (count < slen) >- s = g_strdup (g_utf8_offset_to_pointer (os, slen - count)); >- else { >+ if (icount < slen) >+ return value_new_string (g_utf8_offset_to_pointer (os, slen - icount)); >+ else > /* We could just duplicate the arg, but that would not ensure > that the result was a string. */ >- s = g_strdup (os); >- } >- >- return value_new_string_nocopy (s); >+ return value_new_string (os); > } > > /***************************************************************************/ >@@ -480,32 +471,33 @@ static char const *help_rept = { > static GnmValue * > gnumeric_rept (FunctionEvalInfo *ei, GnmValue **argv) > { >- GString *res; >- char const *source; >- int num; >- int len; >- int i; >+ char const *source = value_peek_string (argv[0]); >+ gnm_float num = value_get_as_float (argv[1]); >+ size_t len = strlen (source); >+ char *res; >+ size_t i, inum; > >- num = value_get_as_int (argv[1]); > if (num < 0) > return value_new_error_VALUE (ei->pos); > >- source = value_peek_string (argv[0]); >- len = strlen (source); >- > /* Fast special case. =REPT ("",2^30) should not take long. */ >- if (len == 0 || num == 0) >+ if (len == 0 || num < 1) > return value_new_string (""); > > /* Check if the length would overflow. */ > if (num >= INT_MAX / len) > return value_new_error_VALUE (ei->pos); > >- res = g_string_sized_new (len * num); >- for (i = 0; i < num; i++) >- g_string_append (res, source); >+ inum = (size_t)num; >+ res = g_try_malloc (len * inum + 1); >+ if (!res) >+ return value_new_error_VALUE (ei->pos); > >- return value_new_string_nocopy (g_string_free (res, FALSE)); >+ for (i = 0; inum-- > 0; i += len) >+ memcpy (res + i, source, len); >+ res[i] = 0; >+ >+ return value_new_string_nocopy (res); > } > > /***************************************************************************/ >@@ -561,43 +553,26 @@ static char const *help_find = { > static GnmValue * > gnumeric_find (FunctionEvalInfo *ei, GnmValue **argv) > { >- int count, haystacksize; >- char const *haystack, *needle; >- >- /* >- * FIXME: My gut feeling is that we should return arguments >- * invalid when g_utf8_strlen (needle, -1) is 0 (i.e. needle is "") >- * Currently we return "1" which seems nonsensical. >- */ >- needle = value_peek_string (argv[0]); >- haystack = value_peek_string (argv[1]); >- count = argv[2] ? value_get_as_int (argv[2]) : 1; >- >- haystacksize = g_utf8_strlen (haystack, -1); >+ const char *needle = value_peek_string (argv[0]); >+ const char *haystack = value_peek_string (argv[1]); >+ gnm_float count = argv[2] ? value_get_as_float (argv[2]) : 1.0; >+ size_t haystacksize = g_utf8_strlen (haystack, -1); >+ size_t icount; >+ const char *p; > >- /* >- * NOTE: It seems that the implementation of g_strstr will >- * even work for UTF-8 string, even though there is no special >- * UTF-8 version for it, this is why we use "strlen (haystart)" >- * and not g_utf8_strlen below >- */ >- if (count <= 0 || count > haystacksize) { >+ if (count < 1 || count >= haystacksize + 1) > return value_new_error_VALUE (ei->pos); >- } else { >- char const *haystart = g_utf8_offset_to_pointer (haystack, >- count - 1); >- char const *p = g_strstr_len (haystart, >- strlen (haystart), needle); >+ icount = (size_t)count; >+ >+ haystack = g_utf8_offset_to_pointer (haystack, icount - 1); > >+ p = g_strstr_len (haystack, strlen (haystack), needle); > if (p) >- /* One-based */ > return value_new_int >- (g_utf8_pointer_to_offset (haystack, p) + 1); >+ (g_utf8_pointer_to_offset (haystack, p) + icount); > else >- /* Really? */ > return value_new_error_VALUE (ei->pos); > } >-} > > /***************************************************************************/ > >@@ -619,31 +594,26 @@ static char const *help_fixed = { > static GnmValue * > gnumeric_fixed (FunctionEvalInfo *ei, GnmValue **argv) > { >- int decimals; >- gnm_float num; >- gboolean commas = TRUE; >+ gnm_float num = value_get_as_float (argv[0]); >+ gnm_float decimals = argv[1] ? value_get_as_float (argv[1]) : 2.0; >+ gboolean commas = argv[2] ? value_get_as_checked_bool (argv[2]) : TRUE; > format_info_t fmt; > GString *str; > >- num = value_get_as_float (argv[0]); >- decimals = argv[1] ? value_get_as_int (argv[1]) : 2; >- if (argv[2] != NULL) { >- gboolean err; >- commas = !value_get_as_bool (argv[2], &err); >- if (err) >- return value_new_error_VALUE (ei->pos); >- } >- >- if (decimals >= 127) /* else buffer overflow */ >+ decimals = gnumeric_fake_trunc (decimals); >+ if (decimals >= 128) > return value_new_error_VALUE (ei->pos); > >- if (decimals <= 0) { >+ if (decimals < 0) { > /* no decimal point : just round and pad 0's */ > gnm_float mult = gpow10 (decimals); >- num = (gnumeric_fake_round (num * mult) / mult); >+ if (mult == 0) >+ num = 0; /* Underflow */ >+ else >+ num = gnumeric_fake_round (num * mult) / mult; > fmt.right_req = fmt.right_allowed = 0; > } else /* decimal point format */ >- fmt.right_req = fmt.right_allowed = decimals; >+ fmt.right_req = fmt.right_allowed = (int)decimals; > > fmt.right_optional = 0; > fmt.right_spaces = 0; >@@ -735,33 +705,37 @@ static char const *help_replace = { > static GnmValue * > gnumeric_replace (FunctionEvalInfo *ei, GnmValue **argv) > { >- GString *res; >- gint start, num, oldlen; >- char const *old; >- char const *new; >- >- start = value_get_as_int (argv[1]); >- num = value_get_as_int (argv[2]); >- old = value_peek_string (argv[0]); >- oldlen = g_utf8_strlen (old, -1); >+ const char *old = value_peek_string (argv[0]); >+ gnm_float start = value_get_as_float (argv[1]); >+ gnm_float num = value_get_as_float (argv[2]); >+ const char *new = value_peek_string (argv[3]); >+ size_t istart, inum, oldlen, precutlen, postcutlen, newlen; >+ const char *p, *q; >+ char *res; > >- if (start <= 0 || num <= 0) >+ if (start < 1 || num < 0) > return value_new_error_VALUE (ei->pos); >- if (start > oldlen) >- return value_new_error (ei->pos, _ ("Arguments out of range")); > >- start--; /* Make this zero-based. */ >+ oldlen = g_utf8_strlen (old, -1); >+ /* Make istart zero-based. */ >+ istart = (int)MIN ((gnm_float)oldlen, start - 1); >+ inum = (int)MIN((gnm_float)(oldlen - istart), num); > >- if (start + num > oldlen) >- num = oldlen - start; >+ /* |<----precut----><cut><---postcut--->| */ >+ /* ^old ^p ^q */ > >- new = value_peek_string (argv[3]); >+ p = g_utf8_offset_to_pointer (old, istart); >+ q = g_utf8_offset_to_pointer (p, inum); > >- res = g_string_new (old); >- g_string_erase (res, start, num); >- g_string_insert (res, start, new); >+ precutlen = p - old; >+ postcutlen = strlen (q); >+ newlen = strlen (new); > >- return value_new_string_nocopy (g_string_free (res, FALSE)); >+ res = g_malloc (precutlen + newlen + postcutlen + 1); >+ memcpy (res, old, precutlen); >+ memcpy (res + precutlen, new, newlen); >+ memcpy (res + precutlen + newlen, q, postcutlen + 1); >+ return value_new_string_nocopy (res); > } > > /***************************************************************************/ >@@ -855,7 +829,7 @@ gnumeric_trim (FunctionEvalInfo *ei, Gnm > char const *s; > GString *res = g_string_new (NULL); > gboolean space = TRUE; >- int len; >+ size_t last_len = 0; > > s = value_peek_string (argv[0]); > while (*s) { >@@ -867,6 +841,7 @@ gnumeric_trim (FunctionEvalInfo *ei, Gnm > */ > if (g_unichar_isspace (uc)) { > if (!space) { >+ last_len = res->len; > g_string_append_unichar (res, uc); > space = TRUE; > } >@@ -878,10 +853,8 @@ gnumeric_trim (FunctionEvalInfo *ei, Gnm > s = g_utf8_next_char (s); > } > >- g_warning ("FIXME: this looks bogus."); >- len = g_utf8_strlen (res->str, -1); >- if (space && len > 0) >- g_string_truncate (res, len - 1); >+ if (space) >+ g_string_truncate (res, last_len); > > return value_new_string_nocopy (g_string_free (res, FALSE)); > } >@@ -949,24 +922,33 @@ static char const *help_substitute = { > static GnmValue * > gnumeric_substitute (FunctionEvalInfo *ei, GnmValue **argv) > { >+ /* >+ * Careful: value_peek_string handle only two live >+ * pointers at a time. >+ */ >+ char *textcopy = VALUE_IS_STRING (argv[0]) ? NULL : value_get_as_string (argv[0]); >+ char const *text = textcopy ? textcopy : value_peek_string (argv[0]); >+ char const *old = value_peek_string (argv[1]); >+ char const *new = value_peek_string (argv[2]); > char const *p; > int oldlen, newlen, len, inst; > GString *s; >- >- char const *text = value_peek_string (argv[0]); >- char const *old = value_peek_string (argv[1]); >- char const *new = value_peek_string (argv[2]); > int num = 0; > > if (argv[3]) { >- num = value_get_as_int (argv[3]); >- if (num <= 0) >+ gnm_float fnum = value_get_as_float (argv[3]); >+ if (fnum <= 0) { >+ g_free (textcopy); > return value_new_error_VALUE (ei->pos); > } >+ num = (int)MIN((gnm_float)INT_MAX, fnum); >+ } > > oldlen = strlen (old); > if (oldlen == 0) >- return value_dup (argv[0]); >+ return textcopy >+ ? value_new_string_nocopy (textcopy) >+ : value_dup (argv[0]); > > newlen = strlen (new); > len = strlen (text); >@@ -1019,11 +1001,12 @@ gnumeric_dollar (FunctionEvalInfo *ei, G > GnmValue *v; > char *s, *end; > gnm_float number = value_get_as_float (argv[0]); >- int decimals = argv[1] ? value_get_as_int (argv[1]) : 2; >+ gnm_float decimals = argv[1] ? value_get_as_float (argv[1]) : 2.0; > > /* This is what Excel appears to do. */ > if (decimals >= 128) > return value_new_error_VALUE (ei->pos); >+ decimals = gnumeric_fake_trunc (decimals); > > /* Since decimals can be negative, round the number. */ > p10 = gpow10 (decimals); >@@ -1033,7 +1016,7 @@ gnumeric_dollar (FunctionEvalInfo *ei, G > number = gnumeric_fake_round (number * p10) / p10; > > info = style_format_default_money ()->family_info; >- info.num_decimals = MAX (decimals, 0); >+ info.num_decimals = (int)MAX (decimals, 0); > info.negative_fmt = 2; > > sf = style_format_build (FMT_CURRENCY, &info); >@@ -1087,27 +1070,32 @@ gnumeric_search (FunctionEvalInfo *ei, G > { > char const *needle = value_peek_string (argv[0]); > char const *haystack = value_peek_string (argv[1]); >- int start = argv[2] ? value_get_as_int (argv[2]) : 1; >+ gnm_float start = argv[2] ? value_get_as_float (argv[2]) : 1.0; >+ size_t i, istart; > char const *hay2; > go_regex_t r; >- regmatch_t rm; > GnmValue *res = NULL; >- int i; > >- start--; >- if (start < 0) >+ if (start < 1 || start >= INT_MAX) > return value_new_error_VALUE (ei->pos); >- for (i = start, hay2 = haystack; i > 0; i--) { >+ // Make istart zero-based. */ >+ istart = (int)(start - 1); >+ >+ for (i = istart, hay2 = haystack; i > 0; i--) { > if (*hay2 == 0) > return value_new_error_VALUE (ei->pos); > hay2 = g_utf8_next_char (hay2); > } > > if (gnumeric_regcomp_XL (&r, needle, REG_ICASE) == REG_OK) { >+ regmatch_t rm; >+ > switch (go_regexec (&r, hay2, 1, &rm, 0)) { >- case REG_NOMATCH: break; >+ case REG_NOMATCH: >+ break; > case REG_OK: >- res = value_new_int (1 + start + rm.rm_so); >+ res = value_new_int (1 + istart + >+ g_utf8_pointer_to_offset (hay2, hay2 + rm.rm_so)); > break; > default: > g_warning ("Unexpected regexec result"); >Index: plugins/html/html_read.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/html/html_read.c,v >retrieving revision 1.92 >diff -u -w -p -r1.92 html_read.c >--- plugins/html/html_read.c 29 Dec 2003 03:13:53 -0000 1.92 >+++ plugins/html/html_read.c 14 Mar 2006 19:15:53 -0000 >@@ -80,10 +80,12 @@ html_append_text (GString *buf, const xm > const xmlChar *p; > > while (*text) { >- while (g_ascii_isspace (*text)) >- text++; >+ while (g_unichar_isspace (g_utf8_get_char (text))) >+ text = g_utf8_next_char (text); > if (*text) { >- for (p = text; *p && !g_ascii_isspace (*p); p++) >+ for (p = text; >+ *p && !g_unichar_isspace (g_utf8_get_char (p)); >+ p = g_utf8_next_char (p)) > ; > if (buf->len > 0) > g_string_append_c (buf, ' '); >Index: plugins/html/latex.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/html/latex.c,v >retrieving revision 1.77 >diff -u -w -p -r1.77 latex.c >--- plugins/html/latex.c 1 Nov 2004 22:18:30 -0000 1.77 >+++ plugins/html/latex.c 14 Mar 2006 19:15:53 -0000 >@@ -525,7 +525,7 @@ latex2e_write_table_header(GsfOutput *ou > > gsf_output_printf (output, "%%\t\\multicolumn{%d}{c}{The First Header} \\\\ \\hline \n", num_cols); > gsf_output_printf (output, "%%\t\\multicolumn{1}{c}{colTag}\t%%Column 1\n"); >- for (col = 1 ; col < num_cols; col++) >+ for (col = 2 ; col < num_cols; col++) > gsf_output_printf (output, "%%\t&\\multicolumn{1}{c}{colTag}\t%%Column %d\n",col); > gsf_output_printf (output, "%%\t&\\multicolumn{1}{c}{colTag}\t\\\\ \\hline %%Last column\n"); > gsf_output_printf (output, "%%\t\\endfirsthead\n\n"); >@@ -534,7 +534,7 @@ latex2e_write_table_header(GsfOutput *ou > gsf_output_printf (output, "%%\t\\hline\n"); > gsf_output_printf (output, "%%\t\\multicolumn{%d}{l}{\\ldots\\small\\slshape continued} \\\\ \\hline\n", num_cols); > gsf_output_printf (output, "%%\t\\multicolumn{1}{c}{colTag}\t%%Column 1\n"); >- for (col = 1 ; col < num_cols; col++) >+ for (col = 2 ; col < num_cols; col++) > gsf_output_printf (output, "%%\t&\\multicolumn{1}{c}{colTag}\t%%Column %d\n",col); > gsf_output_printf (output, "%%\t&\\multicolumn{1}{c}{colTag}\t\\\\ \\hline %%Last column\n"); > gsf_output_printf (output, "%%\t\\endhead\n\n"); >Index: plugins/python-loader/py-gnumeric.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/python-loader/py-gnumeric.c,v >retrieving revision 1.39 >diff -u -w -p -r1.39 py-gnumeric.c >--- plugins/python-loader/py-gnumeric.c 30 Aug 2004 20:21:12 -0000 1.39 >+++ plugins/python-loader/py-gnumeric.c 14 Mar 2006 19:15:54 -0000 >@@ -887,7 +887,7 @@ py_RangeRef_object_getattr (py_RangeRef_ > if (strcmp (name, "start") == 0) { > return py_new_CellRef_object (&self->range_ref.a); > } else if (strcmp (name, "end") == 0) { >- return py_new_CellRef_object (&self->range_ref.a); >+ return py_new_CellRef_object (&self->range_ref.b); > } else { > return Py_FindMethod (py_RangeRef_object_methods, > (PyObject *) self, name); >Index: plugins/qpro/plugin.xml.in >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/qpro/plugin.xml.in,v >retrieving revision 1.10 >retrieving revision 1.10.2.1 >diff -u -w -p -r1.10 -r1.10.2.1 >--- plugins/qpro/plugin.xml.in 15 Jan 2005 05:04:50 -0000 1.10 >+++ plugins/qpro/plugin.xml.in 14 Mar 2005 03:24:29 -0000 1.10.2.1 >@@ -10,7 +10,7 @@ > <services> > <service type="file_opener" id="qpro" priority="100" probe="TRUE"> > <information> >- <_description>Quatro Pro (*.wb1, *.wb2, *.wb3)</_description> >+ <_description>Quattro Pro (*.wb1, *.wb2, *.wb3)</_description> > </information> > <suffixes> > <suffix>wb1</suffix> >Index: plugins/xbase/boot.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/xbase/boot.c,v >retrieving revision 1.56.2.1 >diff -u -w -p -r1.56.2.1 boot.c >--- plugins/xbase/boot.c 10 Feb 2005 03:43:51 -0000 1.56.2.1 >+++ plugins/xbase/boot.c 14 Mar 2006 19:15:54 -0000 >@@ -82,12 +82,22 @@ xbase_field_as_value (gchar *content, XB > > switch (field->type) { > case 'C': { >- if (file->char_map != (GIConv)-1) >- val = value_new_string_nocopy ( >- g_convert_with_iconv (g_strchomp (s), -1, >- file->char_map, NULL, NULL, NULL)); >+ char *sutf8 = g_convert_with_iconv (g_strchomp (s), -1, >+ file->char_map, NULL, NULL, NULL); >+ if (!sutf8) { >+ char *t; >+ for (t = s; *t; t++) >+ if ((guchar)*t >= 0x7f) >+ *t = '?'; >+ sutf8 = s; >+ s = NULL; >+ g_warning ("Unrepresentable characters replaced by '?'"); >+ } >+ if (sutf8) >+ val = value_new_string_nocopy (sutf8); > else >- val = value_new_string_nocopy (g_strchomp (s)); >+ val = value_new_string ("???"); >+ g_free (s); > return val; > } > case 'N': >Index: plugins/xbase/xbase.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/plugins/xbase/xbase.c,v >retrieving revision 1.31 >diff -u -w -p -r1.31 xbase.c >--- plugins/xbase/xbase.c 30 Aug 2004 00:41:41 -0000 1.31 >+++ plugins/xbase/xbase.c 14 Mar 2006 19:15:54 -0000 >@@ -183,8 +183,15 @@ xbase_read_header (XBfile *x, ErrorInfo > codepages[i].name, codepages[i].codepage);); > break; > } >- if (codepages[i].id != 0) >- fprintf (stderr, "unknown 0x%hhx\n!\n", hdr[29]); >+ if (x->char_map == (GIConv)-1) { >+#if XBASE_DEBUG > 0 >+ fprintf (stderr, "unknown 0x%x\n!\n", hdr[29]); >+#endif >+ g_warning ("File has unknown or missing code page information (%x)", >+ hdr[29]); >+ /* Got any better idea? */ >+ x->char_map = g_iconv_open ("UTF-8", "ISO-8859-1"); >+ } > } > > static XBfield * >Index: schemas/Makefile.am >=================================================================== >RCS file: /cvs/gnome/gnumeric/schemas/Makefile.am,v >retrieving revision 1.12 >retrieving revision 1.12.4.3 >diff -u -w -p -r1.12 -r1.12.4.3 >--- schemas/Makefile.am 7 Apr 2004 14:47:04 -0000 1.12 >+++ schemas/Makefile.am 21 Apr 2005 17:48:30 -0000 1.12.4.3 >@@ -13,7 +13,7 @@ if GCONF_SCHEMAS_INSTALL > install-data-local: > if test -z "$(DESTDIR)" ; then \ > for p in $(schema_DATA) ; do \ >- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \ >+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \ > done \ > fi > else >@@ -22,3 +22,18 @@ endif > > EXTRA_DIST = $(schema_DATA) $(schema_in_files) > CLEANFILES = $(schema_DATA) >+ >+if WITH_WIN32 >+if !CROSS_COMPILING >+SUFFIXES = .reg .hkcu.reg >+regdir = $(prefix)/etc/win32/reg >+reg_DATA = $(schema_in_files:.schemas.in=.reg) $(schema_in_files:.schemas.in=.hkcu.reg) >+CLEANFILES += $(reg_DATA) >+ >+%.reg: %.schemas.in >+ $(top_builddir)/tools/gconf-schemas-to-win32-reg.exe $< >$@ >+%.hkcu.reg: %.schemas.in >+ $(top_builddir)/tools/gconf-schemas-to-win32-reg.exe -c $< >$@ >+endif >+endif >+ >Index: src/GNOME_Gnumeric-gtk.xml.in >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/GNOME_Gnumeric-gtk.xml.in,v >retrieving revision 1.1 >diff -u -w -p -r1.1 GNOME_Gnumeric-gtk.xml.in >--- src/GNOME_Gnumeric-gtk.xml.in 18 Oct 2004 21:28:21 -0000 1.1 >+++ src/GNOME_Gnumeric-gtk.xml.in 14 Mar 2006 19:15:54 -0000 >@@ -212,7 +212,7 @@ > <menu name="Help" action="MenuHelp"> > <menuitem action="HelpDocs"/> > <menuitem action="HelpWeb"/> >- <menuitem action="HelpIRC"/> >+ <!-- <menuitem action="HelpIRC"/> --> > <menuitem action="HelpBug"/> > <separator/> > <menuitem action="HelpAbout"/> >@@ -297,7 +297,7 @@ > <accelerator name="FontStrikeThrough" action="FontStrikeThrough"/> > <accelerator name="FormatAsNumber" action="FormatAsNumber"/> > <accelerator name="FormatAsCurrency" action="FormatAsCurrency"/> >- <accelerator name="FormatAsAccounting" action="FormatAsAccounting"/> >+ <accelerator name="FormatAsGeneral" action="FormatAsGeneral"/> > <accelerator name="FormatAsPercentage" action="FormatAsPercentage"/> > <accelerator name="FormatAsScientific" action="FormatAsScientific"/> > <accelerator name="FormatAsDate" action="FormatAsDate"/> >Index: src/application.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/application.c,v >retrieving revision 1.145 >diff -u -w -p -r1.145 application.c >--- src/application.c 9 Jan 2005 18:34:01 -0000 1.145 >+++ src/application.c 14 Mar 2006 19:15:54 -0000 >@@ -124,10 +124,10 @@ add_icon (GtkIconFactory *factory, > } > > /** >- * gnm_app_workbook_list_remove : >+ * gnm_app_workbook_list_add : > * @wb : > * >- * Remove @wb from the application's list of workbooks. >+ * Add @wb to the application's list of workbooks. > **/ > void > gnm_app_workbook_list_add (Workbook *wb) >@@ -532,7 +532,7 @@ gnm_app_history_add (char const *uri) > g_object_notify (G_OBJECT (app), "file-history-list"); > gnm_gconf_set_file_history_files ( > gnm_string_slist_copy (app->history_list)); >- go_conf_sync (); >+ go_conf_sync (NULL); > } > > gboolean gnm_app_use_auto_complete (void) { return gnm_app_prefs->auto_complete; } >@@ -780,7 +780,12 @@ gnumeric_application_finalize (GObject * > g_slist_foreach (application->history_list, (GFunc)g_free, NULL); > g_slist_free (application->history_list); > application->history_list = NULL; >+ >+ g_free (application->clipboard_cut_range); >+ application->clipboard_cut_range = NULL; >+ > g_hash_table_destroy (application->named_pixbufs); >+ > app = NULL; > G_OBJECT_CLASS (parent_klass)->finalize (obj); > } >Index: src/collect.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/collect.c,v >retrieving revision 1.44 >diff -u -w -p -r1.44 collect.c >--- src/collect.c 12 Nov 2003 18:27:09 -0000 1.44 >+++ src/collect.c 14 Mar 2006 19:15:54 -0000 >@@ -17,6 +17,7 @@ > #include "datetime.h" > #include "workbook.h" > #include "sheet.h" >+#include "number-match.h" > > /* ------------------------------------------------------------------------- */ > >@@ -74,9 +75,17 @@ callback_function_collect (GnmEvalPos co > break; > > case VALUE_STRING: >- if (cl->flags & COLLECT_DATES) { >- x = datetime_value_to_serial (value, cl->date_conv); >- if (x == 0) >+ if (cl->flags & COLLECT_COERCE_STRINGS) { >+ GnmValue *vc = format_match_number (value_peek_string (value), >+ NULL, >+ cl->date_conv); >+ gboolean bad = !vc || VALUE_TYPE(vc) == VALUE_BOOLEAN; >+ if (vc) { >+ x = value_get_as_float (vc); >+ value_release (vc); >+ } >+ >+ if (bad) > return value_new_error_VALUE (ep); > } else if (cl->flags & COLLECT_IGNORE_STRINGS) > goto callback_function_collect_store_info; >@@ -121,9 +130,9 @@ callback_function_collect (GnmEvalPos co > * exprlist: List of expressions to evaluate. > * cr: Current location (for resolving relative cells). > * flags: COLLECT_IGNORE_STRINGS: silently ignore strings. >+ * COLLECT_COERCE_STRINGS: coerce string into numbers > * COLLECT_ZERO_STRINGS: count strings as 0. > * (Alternative: return #VALUE!.) >- * COLLECT_DATES: count strings as dates. > * COLLECT_IGNORE_BOOLS: silently ignore bools. > * COLLECT_ZEROONE_BOOLS: count FALSE as 0, TRUE as 1. > * (Alternative: return #VALUE!.) >Index: src/collect.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/collect.h,v >retrieving revision 1.24 >diff -u -w -p -r1.24 collect.h >--- src/collect.h 12 Nov 2003 18:27:09 -0000 1.24 >+++ src/collect.h 14 Mar 2006 19:15:54 -0000 >@@ -7,6 +7,7 @@ > typedef enum { > COLLECT_IGNORE_STRINGS = 0x01, > COLLECT_ZERO_STRINGS = 0x02, >+ COLLECT_COERCE_STRINGS = 0x04, > > COLLECT_IGNORE_BOOLS = 0x10, > COLLECT_ZEROONE_BOOLS = 0x20, >@@ -16,7 +17,6 @@ typedef enum { > > COLLECT_IGNORE_BLANKS = 0x1000, > COLLECT_IGNORE_SUBTOTAL = 0x2000, >- COLLECT_DATES = 0x4000, > COLLECT_INFO = 0x8000, > > COLLECT_NO_INFO_MASK = 0x7777 >Index: src/colrow.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/colrow.c,v >retrieving revision 1.85 >retrieving revision 1.85.2.1 >diff -u -w -p -r1.85 -r1.85.2.1 >--- src/colrow.c 14 Jan 2005 05:17:06 -0000 1.85 >+++ src/colrow.c 4 Apr 2005 05:08:14 -0000 1.85.2.1 >@@ -153,6 +153,8 @@ colrow_foreach (ColRowCollection const * > { > int i; > >+ g_return_val_if_fail (first >= 0, FALSE); >+ > /* TODO : Do we need to support right -> left as an option */ > > /* clip */ >Index: src/commands.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/commands.c,v >retrieving revision 1.413 >diff -u -w -p -r1.413 commands.c >--- src/commands.c 10 Jan 2005 05:31:02 -0000 1.413 >+++ src/commands.c 14 Mar 2006 19:15:55 -0000 >@@ -247,15 +247,15 @@ cmd_cell_range_is_locked_effective (Shee > for (i = range->start.row; i <= range->end.row; i++) > for (j = range->start.col; j <= range->end.col; j++) > if (mstyle_get_content_locked (sheet_style_get (sheet, j, i))) { >- char *text; >- text = g_strdup_printf (wbv->is_protected ? >+ char *r = global_range_name (sheet, range); >+ char *text = g_strdup_printf (wbv->is_protected ? > _("%s is locked. Unprotect the workbook to enable editing.") : > _("%s is locked. Unprotect the sheet to enable editing."), >- undo_global_range_name ( >- sheet, range)); >- gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), cmd_name, >- text); >+ r); >+ gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), >+ cmd_name, text); > g_free (text); >+ g_free (r); > return TRUE; > } > return FALSE; >@@ -368,7 +368,7 @@ undo_redo_menu_labels (Workbook *wb) > } > > static void >-update_after_action (Sheet *sheet, Workbook *wb) >+update_after_action (Sheet *sheet, WorkbookControl *wbc) > { > if (sheet != NULL) { > g_return_if_fail (IS_SHEET (sheet)); >@@ -378,15 +378,11 @@ update_after_action (Sheet *sheet, Workb > workbook_recalc (sheet->workbook); > sheet_update (sheet); > >- WORKBOOK_FOREACH_CONTROL (sheet->workbook, view, control, >- wb_control_sheet_focus (control, sheet); >- ); >- } else if (wb != NULL) { >- WORKBOOK_FOREACH_CONTROL (wb, view, wbc, { >- wb_control_sheet_focus (wbc, sheet); >+ if (sheet->workbook == wb_control_workbook (wbc)) >+ WORKBOOK_VIEW_FOREACH_CONTROL (wb_control_view (wbc), control, >+ wb_control_sheet_focus (control, sheet);); >+ } else if (wbc != NULL) > sheet_update (wb_control_cur_sheet (wbc)); >- }); >- } > } > > /* >@@ -507,7 +503,7 @@ command_undo (WorkbookControl *wbc) > /* TRUE indicates a failure to undo. Leave the command where it is */ > if (klass->undo_cmd (cmd, wbc)) > return; >- update_after_action (cmd->sheet, wb); >+ update_after_action (cmd->sheet, wbc); > > wb->undo_commands = g_slist_remove (wb->undo_commands, > wb->undo_commands->data); >@@ -546,7 +542,7 @@ command_redo (WorkbookControl *wbc) > /* TRUE indicates a failure to redo. Leave the command where it is */ > if (klass->redo_cmd (cmd, wbc)) > return; >- update_after_action (cmd->sheet, wb); >+ update_after_action (cmd->sheet, wbc); > > /* Remove the command from the undo list */ > wb->redo_commands = g_slist_remove (wb->redo_commands, >@@ -608,7 +604,7 @@ command_setup_combos (WorkbookControl *w > undo_label = get_menu_label (ptr); > wb_control_undo_redo_push (wbc, TRUE, undo_label, ptr->data); > } >- g_slist_reverse (tmp); >+ (void) g_slist_reverse (tmp); > > wb_control_undo_redo_truncate (wbc, 0, FALSE); > tmp = g_slist_reverse (wb->redo_commands); >@@ -616,7 +612,7 @@ command_setup_combos (WorkbookControl *w > redo_label = get_menu_label (ptr); > wb_control_undo_redo_push (wbc, FALSE, redo_label, ptr->data); > } >- g_slist_reverse (tmp); >+ (void) g_slist_reverse (tmp); > > /* update the menus too */ > wb_control_undo_redo_labels (wbc, undo_label, redo_label); >@@ -792,7 +788,7 @@ command_push_undo (WorkbookControl *wbc, > > /* TRUE indicates a failure to do the command */ > trouble = klass->redo_cmd (cmd, wbc); >- update_after_action (cmd->sheet, wb); >+ update_after_action (cmd->sheet, wbc); > > if (!trouble) > command_register_undo (wbc, obj); >@@ -3845,7 +3841,8 @@ typedef struct { > > > static void >-cmd_search_replace_update_after_action (CmdSearchReplace *me) >+cmd_search_replace_update_after_action (CmdSearchReplace *me, >+ WorkbookControl *wbc) > { > GList *tmp; > Sheet *last_sheet = NULL; >@@ -3854,7 +3851,7 @@ cmd_search_replace_update_after_action ( > SearchReplaceItem *sri = tmp->data; > if (sri->pos.sheet != last_sheet) { > last_sheet = sri->pos.sheet; >- update_after_action (last_sheet, NULL); >+ update_after_action (last_sheet, wbc); > } > } > } >@@ -3862,7 +3859,7 @@ cmd_search_replace_update_after_action ( > > static gboolean > cmd_search_replace_undo (GnmCommand *cmd, >- G_GNUC_UNUSED WorkbookControl *wbc) >+ WorkbookControl *wbc) > { > CmdSearchReplace *me = CMD_SEARCH_REPLACE (cmd); > GList *tmp; >@@ -3893,14 +3890,14 @@ cmd_search_replace_undo (GnmCommand *cmd > break; > } > } >- cmd_search_replace_update_after_action (me); >+ cmd_search_replace_update_after_action (me, wbc); > > return FALSE; > } > > static gboolean > cmd_search_replace_redo (GnmCommand *cmd, >- G_GNUC_UNUSED WorkbookControl *wbc) >+ WorkbookControl *wbc) > { > CmdSearchReplace *me = CMD_SEARCH_REPLACE (cmd); > GList *tmp; >@@ -3931,7 +3928,7 @@ cmd_search_replace_redo (GnmCommand *cmd > break; > } > } >- cmd_search_replace_update_after_action (me); >+ cmd_search_replace_update_after_action (me, wbc); > > return FALSE; > } >@@ -4074,9 +4071,8 @@ cmd_search_replace_do_cell (CmdSearchRep > > > static gboolean >-cmd_search_replace_do (CmdSearchReplace *me, >- G_GNUC_UNUSED Workbook *wb, Sheet *sheet, >- gboolean test_run) >+cmd_search_replace_do (CmdSearchReplace *me, Sheet *sheet, >+ gboolean test_run, WorkbookControl *wbc) > { > GnmSearchReplace *sr = me->sr; > GPtrArray *cells; >@@ -4114,7 +4110,7 @@ cmd_search_replace_do (CmdSearchReplace > /* Cells were added in the wrong order. Correct. */ > me->cells = g_list_reverse (me->cells); > >- cmd_search_replace_update_after_action (me); >+ cmd_search_replace_update_after_action (me, wbc); > } > > return result; >@@ -4158,7 +4154,6 @@ cmd_search_replace (WorkbookControl *wbc > { > GObject *obj; > CmdSearchReplace *me; >- Workbook *wb = wb_control_workbook (wbc); > > g_return_val_if_fail (sr != NULL, TRUE); > >@@ -4172,13 +4167,13 @@ cmd_search_replace (WorkbookControl *wbc > me->cmd.size = 1; /* Corrected below. */ > me->cmd.cmd_descriptor = g_strdup (_("Search and Replace")); > >- if (cmd_search_replace_do (me, wb, sheet, TRUE)) { >+ if (cmd_search_replace_do (me, sheet, TRUE, wbc)) { > /* There was an error and nothing was done. */ > g_object_unref (obj); > return TRUE; > } > >- cmd_search_replace_do (me, wb, sheet, FALSE); >+ cmd_search_replace_do (me, sheet, FALSE, wbc); > me->cmd.size += g_list_length (me->cells); > > command_register_undo (wbc, obj); >@@ -6559,17 +6554,21 @@ cmd_text_to_columns (WorkbookControl *wb > { > GObject *obj; > CmdTextToColumns *me; >+ char *src_range_name, *target_range_name; > > g_return_val_if_fail (content != NULL, TRUE); > >+ src_range_name = undo_global_range_name (src_sheet, src); >+ target_range_name = undo_global_range_name (target_sheet, target); >+ > obj = g_object_new (CMD_TEXT_TO_COLUMNS_TYPE, NULL); > me = CMD_TEXT_TO_COLUMNS (obj); > > me->cmd.sheet = (src_sheet == target_sheet ? src_sheet : NULL); > me->cmd.size = 1; /* FIXME? */ > me->cmd.cmd_descriptor = g_strdup_printf (_("Text (%s) to Columns (%s)"), >- undo_global_range_name (src_sheet, src), >- undo_global_range_name (target_sheet, target)); >+ src_range_name, >+ target_range_name); > me->dst.range = *target; > me->dst.sheet = target_sheet; > me->dst.paste_flags = PASTE_CONTENT | PASTE_FORMATS; >@@ -6577,6 +6576,9 @@ cmd_text_to_columns (WorkbookControl *wb > me->src_sheet = src_sheet; > me->content = content; > me->saved_sizes = NULL; >+ >+ g_free (src_range_name); >+ g_free (target_range_name); > > /* Check array subdivision & merged regions */ > if (sheet_range_splits_region (target_sheet, &me->dst.range, >Index: src/datetime.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/Attic/datetime.c,v >retrieving revision 1.38 >diff -u -w -p -r1.38 datetime.c >--- src/datetime.c 8 Oct 2003 23:50:36 -0000 1.38 >+++ src/datetime.c 14 Mar 2006 19:15:55 -0000 >@@ -187,16 +187,6 @@ datetime_serial_raw_to_seconds (gnm_floa > /* ------------------------------------------------------------------------- */ > > int >-datetime_value_to_seconds (GnmValue const *v) >-{ >- /* we just want the seconds, actual date does not matter. So we can ignore >- * the date convention (1900 vs 1904) */ >- return datetime_serial_raw_to_seconds (datetime_value_to_serial_raw (v, NULL)); >-} >- >-/* ------------------------------------------------------------------------- */ >- >-int > datetime_timet_to_seconds (time_t t) > { > /* we just want the seconds, actual date does not matter. So we can ignore >Index: src/datetime.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/Attic/datetime.h,v >retrieving revision 1.21 >diff -u -w -p -r1.21 datetime.h >--- src/datetime.h 8 Oct 2003 23:50:36 -0000 1.21 >+++ src/datetime.h 14 Mar 2006 19:15:55 -0000 >@@ -40,9 +40,6 @@ void datetime_serial_to_g (GDate *r > time_t datetime_serial_to_timet (int serial, GnmDateConventions const *conv); > int datetime_serial_raw_to_serial (gnm_float raw); > >-/* These are time-only assuming a 24h day. It probably loses completely on */ >-/* days with summer time ("daylight savings") changes. */ >-int datetime_value_to_seconds (GnmValue const *v); > int datetime_timet_to_seconds (time_t t); > int datetime_serial_raw_to_seconds (gnm_float raw); > >Index: src/dependent.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dependent.c,v >retrieving revision 1.228 >retrieving revision 1.228.2.1 >diff -u -w -p -r1.228 -r1.228.2.1 >--- src/dependent.c 1 Nov 2004 16:42:48 -0000 1.228 >+++ src/dependent.c 5 May 2005 19:50:03 -0000 1.228.2.1 >@@ -1977,12 +1977,13 @@ do_deps_destroy (Sheet *sheet, GnmExprRe > } > } > g_slist_free (local_dyn_deps); >+ local_dyn_deps = NULL; > > /* Filter workbook local deps for GNM_EXPR_REWRITE_WORKBOOK */ > if (rwinfo->type == GNM_EXPR_REWRITE_WORKBOOK) { > Workbook const *target = rwinfo->u.workbook; > ptr = dyn_deps; >- dyn_deps = local_dyn_deps = NULL; >+ dyn_deps = NULL; > for (; ptr != NULL ; ptr = next) { > dep = ptr->data; > next = ptr->next; >Index: src/gnm-so-filled.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gnm-so-filled.c,v >retrieving revision 1.7 >diff -u -w -p -r1.7 gnm-so-filled.c >--- src/gnm-so-filled.c 17 Oct 2004 02:36:05 -0000 1.7 >+++ src/gnm-so-filled.c 14 Mar 2006 19:15:55 -0000 >*************** >*** 579,588 **** >--- 579,607 ---- > > typedef struct { > GnmSOFilled base; >+ GogStyle *style; > GArray *points; > } GnmSOPolygon; > typedef GnmSOFilledClass GnmSOPolygonClass; > static SheetObjectClass *gnm_so_polygon_parent_class; >+ enum { >+ SOP_PROP_0, >+ SOP_PROP_STYLE, >+ SOP_PROP_POINTS >+ }; >+ >+ static GogStyle * >+ sop_default_style (void) >+ { >+ GogStyle *res = gog_style_new (); >+ res->interesting_fields = GOG_STYLE_OUTLINE | GOG_STYLE_FILL; >+ res->outline.width = 0; /* hairline */ >+ res->outline.color = RGBA_BLACK; >+ res->outline.pattern = 1; /* anything but 0 */ >+ res->fill.type = GOG_FILL_STYLE_PATTERN; >+ go_pattern_set_solid (&res->fill.pattern, RGBA_WHITE); >+ return res; >+ } > > #ifdef WITH_GTK > #include <libfoocanvas/foo-canvas.h> >*************** >*** 597,623 **** > FooCanvasItem *view = FOO_CANVAS_ITEM (sov); > > if (visible) { >- FooCanvasPolygon *poly = FOO_CANVAS_POLYGON (view); > SheetObject *so = sheet_object_view_get_so (sov); > GnmSOPolygon const *sop = GNM_SO_POLYGON (so); > double *dst, x_scale, y_scale, x_translate, y_translate; > double const *src; >- unsigned i = poly->num_points; > >! g_return_if_fail (poly->num_points*2 == (int)sop->points->len); > > x_scale = fabs (coords[2] - coords[0]); > y_scale = fabs (coords[3] - coords[1]); > x_translate = MIN (coords[0], coords[2]), > y_translate = MIN (coords[1], coords[3]); > >! src = (double *)sop->points->data; >! dst = poly->coords; > for ( ; i-- > 0; dst += 2, src += 2) { > dst[0] = x_translate + x_scale * src[0]; > dst[1] = y_translate + y_scale * src[1]; > } > > foo_canvas_item_show (view); > } else > foo_canvas_item_hide (view); >--- 616,647 ---- > FooCanvasItem *view = FOO_CANVAS_ITEM (sov); > > if (visible) { > SheetObject *so = sheet_object_view_get_so (sov); > GnmSOPolygon const *sop = GNM_SO_POLYGON (so); >+ unsigned i; >+ FooCanvasPoints *pts; > double *dst, x_scale, y_scale, x_translate, y_translate; > double const *src; > >! if (sop->points == NULL) >! return; > >+ i = sop->points->len / 2; >+ pts = foo_canvas_points_new (i); > x_scale = fabs (coords[2] - coords[0]); > y_scale = fabs (coords[3] - coords[1]); > x_translate = MIN (coords[0], coords[2]), > y_translate = MIN (coords[1], coords[3]); > >! src = &g_array_index (sop->points, double, 0); >! dst = pts->coords; > for ( ; i-- > 0; dst += 2, src += 2) { > dst[0] = x_translate + x_scale * src[0]; > dst[1] = y_translate + y_scale * src[1]; > } > >+ foo_canvas_item_set (view, "points", pts, NULL); >+ foo_canvas_points_free (pts); > foo_canvas_item_show (view); > } else > foo_canvas_item_hide (view); >*************** >*** 640,645 **** >--- 664,702 ---- > /*****************************************************************************/ > > #ifdef WITH_GTK >+ #include <sheet-control-gui.h> >+ #include <dialogs/dialogs.h> >+ >+ static void >+ cb_gnm_so_polygon_style_changed (FooCanvasItem *view, GnmSOPolygon const *sop) >+ { >+ GogStyle const *style = sop->style; >+ GdkColor outline_buf, *outline_gdk = NULL; >+ GdkColor fill_buf, *fill_gdk = NULL; >+ >+ if (style->outline.color != 0 && >+ style->outline.width >= 0 && >+ style->outline.pattern != 0) >+ outline_gdk = go_color_to_gdk (style->outline.color, &outline_buf); >+ >+ if (style->fill.type != GOG_FILL_STYLE_NONE) >+ fill_gdk = go_color_to_gdk (style->fill.pattern.back, &fill_buf); >+ >+ if (style->outline.width > 0.) /* in pts */ >+ foo_canvas_item_set (view, >+ "width-units", style->outline.width, >+ "outline-color-gdk", outline_gdk, >+ "fill-color-gdk", fill_gdk, >+ NULL); >+ else /* hairline 1 pixel that ignores zoom */ >+ foo_canvas_item_set (view, >+ "width-pixels", 1, >+ "outline-color-gdk", outline_gdk, >+ "fill-color-gdk", fill_gdk, >+ NULL); >+ >+ } >+ > static SheetObjectView * > gnm_so_polygon_new_view (SheetObject *so, SheetObjectViewContainer *container) > { >*************** >*** 647,665 **** > GnmSOPolygon *sop = GNM_SO_POLYGON (so); > FooCanvasItem *item = foo_canvas_item_new (gcanvas->object_views, > so_polygon_foo_view_get_type (), >- "points", sop->points, > /* "join_style", GDK_JOIN_ROUND, */ > NULL); >! #if 0 >! cb_gnm_so_filled_style_changed (item, &sop->base); > g_signal_connect_object (sop, >! "notify", G_CALLBACK (cb_gnm_so_filled_style_changed), > item, 0); >- #endif > return gnm_pane_object_register (so, item, TRUE); > } > > static void > gnm_so_polygon_print (SheetObject const *so, GnomePrintContext *gp_context, > double base_x, double base_y) > { >--- 704,726 ---- > GnmSOPolygon *sop = GNM_SO_POLYGON (so); > FooCanvasItem *item = foo_canvas_item_new (gcanvas->object_views, > so_polygon_foo_view_get_type (), > /* "join_style", GDK_JOIN_ROUND, */ > NULL); >! cb_gnm_so_polygon_style_changed (item, sop); > g_signal_connect_object (sop, >! "notify::style", G_CALLBACK (cb_gnm_so_polygon_style_changed), > item, 0); > return gnm_pane_object_register (so, item, TRUE); > } > > static void >+ gnm_so_polygon_user_config (SheetObject *so, SheetControl *sc) >+ { >+ dialog_so_styled (scg_get_wbcg (SHEET_CONTROL_GUI (sc)), G_OBJECT (so), >+ GNM_SO_POLYGON (so)->style, sop_default_style (), >+ _("Polygon Properties")); >+ } >+ static void > gnm_so_polygon_print (SheetObject const *so, GnomePrintContext *gp_context, > double base_x, double base_y) > { >*************** >*** 690,703 **** > gnm_so_polygon_write_xml_dom (SheetObject const *so, > XmlParseContext const *ctxt, xmlNodePtr node) > { >! GnmSOPolygon *sop = GNM_SO_POLYGON (so); > return gnm_so_polygon_parent_class->write_xml_dom (so, ctxt, node); > } > > static void > gnm_so_polygon_write_xml_sax (SheetObject const *so, GsfXMLOut *output) > { >! GnmSOPolygon const *sop = GNM_SO_POLYGON (so); > return gnm_so_polygon_parent_class->write_xml_sax (so, output); > } > >--- 751,764 ---- > gnm_so_polygon_write_xml_dom (SheetObject const *so, > XmlParseContext const *ctxt, xmlNodePtr node) > { >! /* TODO */ > return gnm_so_polygon_parent_class->write_xml_dom (so, ctxt, node); > } > > static void > gnm_so_polygon_write_xml_sax (SheetObject const *so, GsfXMLOut *output) > { >! /* TODO */ > return gnm_so_polygon_parent_class->write_xml_sax (so, output); > } > >*************** >*** 716,725 **** >--- 777,837 ---- > } > > static void >+ gnm_so_polygon_set_property (GObject *obj, guint param_id, >+ GValue const *value, GParamSpec *pspec) >+ { >+ GnmSOPolygon *sop = GNM_SO_POLYGON (obj); >+ GArray *points; >+ GogStyle *style; >+ >+ switch (param_id) { >+ case SOP_PROP_STYLE: >+ style = sop->style; >+ sop->style = g_object_ref (g_value_get_object (value)); >+ sop->style->interesting_fields = GOG_STYLE_OUTLINE | GOG_STYLE_FILL; >+ g_object_unref (style); >+ break; >+ case SOP_PROP_POINTS: >+ points = g_value_get_pointer (value); >+ >+ g_return_if_fail (points != NULL); >+ >+ if (sop->points != points) { >+ g_array_free (sop->points, TRUE); >+ sop->points = points; >+ } >+ break; >+ >+ default: >+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec); >+ return; >+ } >+ } >+ >+ static void >+ gnm_so_polygon_get_property (GObject *obj, guint param_id, >+ GValue *value, GParamSpec *pspec) >+ { >+ GnmSOPolygon *sop = GNM_SO_POLYGON (obj); >+ switch (param_id) { >+ case SOP_PROP_STYLE: >+ g_value_set_object (value, sop->style); >+ break; >+ case SOP_PROP_POINTS: >+ g_value_set_pointer (value, sop->points); >+ break; >+ default : >+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec); >+ break; >+ } >+ } >+ static void > gnm_so_polygon_finalize (GObject *object) > { > GnmSOPolygon *sop = GNM_SO_POLYGON (object); > >+ g_object_unref (sop->style); >+ sop->style = NULL; > if (sop->points != NULL) { > g_array_free (sop->points, TRUE); > sop->points = NULL; >*************** >*** 735,740 **** >--- 847,854 ---- > gnm_so_polygon_parent_class = g_type_class_peek_parent (gobject_class); > > gobject_class->finalize = gnm_so_polygon_finalize; >+ gobject_class->set_property = gnm_so_polygon_set_property; >+ gobject_class->get_property = gnm_so_polygon_get_property; > so_class->read_xml_dom = gnm_so_polygon_read_xml_dom; > so_class->write_xml_dom = gnm_so_polygon_write_xml_dom; > so_class->write_xml_sax = gnm_so_polygon_write_xml_sax; >*************** >*** 744,751 **** >--- 858,873 ---- > > #ifdef WITH_GTK > so_class->new_view = gnm_so_polygon_new_view; >+ so_class->user_config = gnm_so_polygon_user_config; > so_class->print = gnm_so_polygon_print; > #endif /* WITH_GTK */ >+ >+ g_object_class_install_property (gobject_class, SOP_PROP_STYLE, >+ g_param_spec_object ("style", NULL, NULL, GOG_STYLE_TYPE, >+ GSF_PARAM_STATIC | G_PARAM_READWRITE)); >+ g_object_class_install_property (gobject_class, SOP_PROP_POINTS, >+ g_param_spec_pointer ("points", NULL, NULL, >+ GSF_PARAM_STATIC | G_PARAM_READWRITE)); > } > > static void >*************** >*** 758,763 **** >--- 880,886 ---- > GnmSOPolygon *sop = GNM_SO_POLYGON (obj); > sop->points = g_array_sized_new (FALSE, TRUE, sizeof (double), > G_N_ELEMENTS (initial_coords)); >+ sop->style = sop_default_style (); > g_array_append_vals (sop->points, > initial_coords, G_N_ELEMENTS (initial_coords)); > } >Index: src/gnumeric-canvas.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gnumeric-canvas.c,v >retrieving revision 1.329 >diff -u -w -p -r1.329 gnumeric-canvas.c >--- src/gnumeric-canvas.c 5 Nov 2004 14:57:04 -0000 1.329 >+++ src/gnumeric-canvas.c 14 Mar 2006 19:15:56 -0000 >@@ -424,17 +424,19 @@ gnm_canvas_key_press (GtkWidget *widget, > res = gnm_canvas_key_mode_object (gcanvas, event); > else { > gcanvas->mask_state = event->state; >- if (gtk_im_context_filter_keypress (gcanvas->im_context,event)) { >- gcanvas->need_im_reset = TRUE; >+ gcanvas->insert_decimal = event->keyval == GDK_KP_Decimal || >+ event->keyval == GDK_KP_Separator; >+ if (gtk_im_context_filter_keypress (gcanvas->im_context,event)) > return TRUE; >- } > switch (event->keyval) { > case GDK_Shift_L: case GDK_Shift_R: > case GDK_Alt_L: case GDK_Alt_R: > case GDK_Control_L: case GDK_Control_R: > break; > default: >+ gcanvas->reseting_im = TRUE; > gtk_im_context_reset (gcanvas->im_context); >+ gcanvas->reseting_im = FALSE; > break; > } > res = gnm_canvas_key_mode_sheet (gcanvas, event); >@@ -463,10 +465,7 @@ gnm_canvas_key_release (GtkWidget *widge > return TRUE; > > if (gtk_im_context_filter_keypress (gcanvas->im_context,event)) >- { >- gcanvas->need_im_reset = TRUE; > return TRUE; >- } > /* > * The status_region normally displays the current edit_pos > * When we extend the selection it changes to displaying the size of >@@ -486,7 +485,6 @@ gnm_canvas_key_release (GtkWidget *widge > static gint > gnm_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) > { >- GNM_CANVAS (widget)->need_im_reset = TRUE; > gtk_im_context_focus_in (GNM_CANVAS (widget)->im_context); > return (*GTK_WIDGET_CLASS (parent_klass)->focus_in_event) (widget, event); > } >@@ -495,7 +493,6 @@ gnm_canvas_focus_in (GtkWidget *widget, > static gint > gnm_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) > { >- GNM_CANVAS (widget)->need_im_reset = TRUE; > gtk_im_context_focus_out (GNM_CANVAS (widget)->im_context); > return (*GTK_WIDGET_CLASS (parent_klass)->focus_out_event) (widget, event); > } >@@ -586,12 +583,19 @@ gnm_canvas_commit_cb (GtkIMContext *cont > { > WorkbookControlGUI *wbcg = gcanvas->simple.scg->wbcg; > GtkEditable *editable = GTK_EDITABLE (gnm_expr_entry_get_entry (wbcg_get_entry_logical (wbcg))); >- gint tmp_pos; >+ gint tmp_pos, length; > > if (!wbcg_is_editing (wbcg) && > !wbcg_edit_start (wbcg, TRUE, TRUE)) > return; > >+ if (gcanvas->insert_decimal) { >+ GString const *s = format_get_decimal (); >+ str = s->str; >+ length = s->len; >+ } else >+ length = strlen (str); >+ > if (gtk_editable_get_selection_bounds (editable, NULL, NULL)) > gtk_editable_delete_selection (editable); > else { >@@ -601,7 +605,7 @@ gnm_canvas_commit_cb (GtkIMContext *cont > } > > tmp_pos = gtk_editable_get_position (editable); >- gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos); >+ gtk_editable_insert_text (editable, str, length, &tmp_pos); > gtk_editable_set_position (editable, tmp_pos); > } > >@@ -619,7 +623,11 @@ gnm_canvas_preedit_changed_cb (GtkIMCont > pango_attr_list_unref (gcanvas->preedit_attrs); > gtk_im_context_get_preedit_string (gcanvas->im_context, &preedit_string, &gcanvas->preedit_attrs, &cursor_pos); > >- if (!wbcg_is_editing (wbcg) && !wbcg_edit_start (wbcg, TRUE, TRUE)) { >+ /* in gtk-2.8 something changed. gtk_im_context_reset started >+ * triggering a pre-edit-changed. We'd end up start and finishing an >+ * empty edit every time the cursor moved */ >+ if (!gcanvas->reseting_im && >+ !wbcg_is_editing (wbcg) && !wbcg_edit_start (wbcg, TRUE, TRUE)) { > gtk_im_context_reset (gcanvas->im_context); > gcanvas->preedit_length = 0; > if (gcanvas->preedit_attrs) >@@ -691,6 +699,7 @@ gnm_canvas_init (GnmCanvas *gcanvas) > gcanvas->im_context = gtk_im_multicontext_new (); > gcanvas->preedit_length = 0; > gcanvas->preedit_attrs = NULL; >+ gcanvas->reseting_im = FALSE; > > g_signal_connect (G_OBJECT (gcanvas->im_context), "commit", > G_CALLBACK (gnm_canvas_commit_cb), gcanvas); >Index: src/gnumeric-canvas.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gnumeric-canvas.h,v >retrieving revision 1.84 >diff -u -w -p -r1.84 gnumeric-canvas.h >--- src/gnumeric-canvas.h 29 Sep 2004 04:39:56 -0000 1.84 >+++ src/gnumeric-canvas.h 14 Mar 2006 19:15:56 -0000 >@@ -36,11 +36,12 @@ struct _GnmCanvas { > gboolean sliding_adjacent_h, sliding_adjacent_v; > > /* IM */ >- guint need_im_reset :1; >+ guint reseting_im :1; /* quick hack to keep gtk_im_context_reset from starting an edit */ > guint mask_state; > guint preedit_length; > GtkIMContext *im_context; > PangoAttrList *preedit_attrs; >+ gboolean insert_decimal; > }; > > GType gnm_canvas_get_type (void); >Index: src/gnumeric-gconf-priv.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gnumeric-gconf-priv.h,v >retrieving revision 1.25 >retrieving revision 1.25.4.1 >diff -u -w -p -r1.25 -r1.25.4.1 >--- src/gnumeric-gconf-priv.h 7 Apr 2004 14:47:04 -0000 1.25 >+++ src/gnumeric-gconf-priv.h 9 Apr 2005 08:19:57 -0000 1.25.4.1 >@@ -8,112 +8,114 @@ > * dialogs/dialog-preferences.c > */ > >+#define GNM_CONF_DIR "gnumeric" > > /* > * schemas/gnumeric-dialogs.schemas > */ >-#define FUNCTION_SELECT_GCONF_RECENT "/apps/gnumeric/functionselector/recentfunctions" >-#define FUNCTION_SELECT_GCONF_NUM_OF_RECENT "/apps/gnumeric/functionselector/num-of-recent" >+#define FUNCTION_SELECT_GCONF_DIR "functionselector" >+#define FUNCTION_SELECT_GCONF_RECENT "recentfunctions" >+#define FUNCTION_SELECT_GCONF_NUM_OF_RECENT "num-of-recent" >+ >+#define CONF_DEFAULT_FONT_DIR "core/defaultfont" >+#define CONF_DEFAULT_FONT_NAME "name" >+#define CONF_DEFAULT_FONT_SIZE "size" >+#define CONF_DEFAULT_FONT_BOLD "bold" >+#define CONF_DEFAULT_FONT_ITALIC "italic" >+ >+#define PLUGIN_GCONF_DIR "plugins" >+#define PLUGIN_GCONF_ACTIVATE_NEW "activate-new" >+#define PLUGIN_GCONF_ACTIVE "active" >+#define PLUGIN_GCONF_FILE_STATES "file-states" >+#define PLUGIN_GCONF_EXTRA_DIRS "extra-dirs" >+ >+#define AUTOFORMAT_GCONF_DIR "autoformat" >+#define AUTOFORMAT_GCONF_EXTRA_DIRS "extra-dirs" >+#define AUTOFORMAT_GCONF_SYS_DIR "sys-dir" >+#define AUTOFORMAT_GCONF_USR_DIR "usr-dir" >+ >+#define PRINTSETUP_GCONF_DIR "printsetup" >+#define PRINTSETUP_GCONF_ALL_SHEETS "all-sheets" >+#define PRINTSETUP_GCONF_PRINTER_CONFIG "printer-config" >+#define PRINTSETUP_GCONF_HEADER "header" >+#define PRINTSETUP_GCONF_FOOTER "footer" >+#define PRINTSETUP_GCONF_HF_FONT_NAME "hf-font-name" >+#define PRINTSETUP_GCONF_HF_FONT_SIZE "hf-font-size" >+#define PRINTSETUP_GCONF_HF_FONT_BOLD "hf-font-bold" >+#define PRINTSETUP_GCONF_HF_FONT_ITALIC "hf-font-italic" >+#define PRINTSETUP_GCONF_CENTER_HORIZONTALLY "center-horizontally" >+#define PRINTSETUP_GCONF_CENTER_VERTICALLY "center-vertically" >+#define PRINTSETUP_GCONF_PRINT_GRID_LINES "print-grid-lines" >+#define PRINTSETUP_GCONF_EVEN_IF_ONLY_STYLES "print-even-if-only-styles" >+#define PRINTSETUP_GCONF_PRINT_BLACK_AND_WHITE "print-black-n-white" >+#define PRINTSETUP_GCONF_PRINT_TITLES "print-titles" >+#define PRINTSETUP_GCONF_RIGHT_THEN_DOWN "right-then-down" >+#define PRINTSETUP_GCONF_SCALE_PERCENTAGE "scale-percentage" >+#define PRINTSETUP_GCONF_SCALE_PERCENTAGE_VALUE "scale-percentage-value" >+#define PRINTSETUP_GCONF_SCALE_WIDTH "scale-width" >+#define PRINTSETUP_GCONF_SCALE_HEIGHT "scale-height" >+#define PRINTSETUP_GCONF_REPEAT_TOP "repeat-top" >+#define PRINTSETUP_GCONF_REPEAT_LEFT "repeat-left" >+#define PRINTSETUP_GCONF_MARGIN_TOP "margin-top" >+#define PRINTSETUP_GCONF_MARGIN_BOTTOM "margin-bottom" >+#define PRINTSETUP_GCONF_HEADER_FORMAT_LEFT "hf-left" >+#define PRINTSETUP_GCONF_HEADER_FORMAT_MIDDLE "hf-middle" >+#define PRINTSETUP_GCONF_HEADER_FORMAT_RIGHT "hf-right" > >-#define CONF_DEFAULT_FONT_DIR "/apps/gnumeric/core/defaultfont/" >-#define CONF_DEFAULT_FONT_NAME CONF_DEFAULT_FONT_DIR "name" >-#define CONF_DEFAULT_FONT_SIZE CONF_DEFAULT_FONT_DIR "size" >-#define CONF_DEFAULT_FONT_BOLD CONF_DEFAULT_FONT_DIR "bold" >-#define CONF_DEFAULT_FONT_ITALIC CONF_DEFAULT_FONT_DIR "italic" >- >-#define PLUGIN_GCONF_DIRECTORY "/apps/gnumeric/plugins" >-#define PLUGIN_GCONF_ACTIVATE_NEW PLUGIN_GCONF_DIRECTORY "/activate-new" >-#define PLUGIN_GCONF_ACTIVE PLUGIN_GCONF_DIRECTORY "/active" >-#define PLUGIN_GCONF_FILE_STATES PLUGIN_GCONF_DIRECTORY "/file-states" >-#define PLUGIN_GCONF_EXTRA_DIRS PLUGIN_GCONF_DIRECTORY "/extra-dirs" >- >-#define AUTOFORMAT_GCONF_DIRECTORY "/apps/gnumeric/autoformat" >-#define AUTOFORMAT_GCONF_EXTRA_DIRS AUTOFORMAT_GCONF_DIRECTORY "/extra-dirs" >-#define AUTOFORMAT_GCONF_SYS_DIR AUTOFORMAT_GCONF_DIRECTORY "/sys-dir" >-#define AUTOFORMAT_GCONF_USR_DIR AUTOFORMAT_GCONF_DIRECTORY "/usr-dir" >- >-#define PRINTSETUP_GCONF_DIRECTORY "/apps/gnumeric/printsetup" >-#define PRINTSETUP_GCONF_ALL_SHEETS PRINTSETUP_GCONF_DIRECTORY "/all-sheets" >-#define PRINTSETUP_GCONF_PRINTER_CONFIG PRINTSETUP_GCONF_DIRECTORY "/printer-config" >-#define PRINTSETUP_GCONF_HEADER PRINTSETUP_GCONF_DIRECTORY "/header" >-#define PRINTSETUP_GCONF_FOOTER PRINTSETUP_GCONF_DIRECTORY "/footer" >-#define PRINTSETUP_GCONF_HF_FONT_NAME PRINTSETUP_GCONF_DIRECTORY "/hf-font-name" >-#define PRINTSETUP_GCONF_HF_FONT_SIZE PRINTSETUP_GCONF_DIRECTORY "/hf-font-size" >-#define PRINTSETUP_GCONF_HF_FONT_BOLD PRINTSETUP_GCONF_DIRECTORY "/hf-font-bold" >-#define PRINTSETUP_GCONF_HF_FONT_ITALIC PRINTSETUP_GCONF_DIRECTORY "/hf-font-italic" >-#define PRINTSETUP_GCONF_CENTER_HORIZONTALLY PRINTSETUP_GCONF_DIRECTORY "/center-horizontally" >-#define PRINTSETUP_GCONF_CENTER_VERTICALLY PRINTSETUP_GCONF_DIRECTORY "/center-vertically" >-#define PRINTSETUP_GCONF_PRINT_GRID_LINES PRINTSETUP_GCONF_DIRECTORY "/print-grid-lines" >-#define PRINTSETUP_GCONF_EVEN_IF_ONLY_STYLES PRINTSETUP_GCONF_DIRECTORY "/print-even-if-only-styles" >-#define PRINTSETUP_GCONF_PRINT_BLACK_AND_WHITE PRINTSETUP_GCONF_DIRECTORY "/print-black-n-white" >-#define PRINTSETUP_GCONF_PRINT_TITLES PRINTSETUP_GCONF_DIRECTORY "/print-titles" >-#define PRINTSETUP_GCONF_RIGHT_THEN_DOWN PRINTSETUP_GCONF_DIRECTORY "/right-then-down" >-#define PRINTSETUP_GCONF_SCALE_PERCENTAGE PRINTSETUP_GCONF_DIRECTORY "/scale-percentage" >-#define PRINTSETUP_GCONF_SCALE_PERCENTAGE_VALUE PRINTSETUP_GCONF_DIRECTORY "/scale-percentage-value" >-#define PRINTSETUP_GCONF_SCALE_WIDTH PRINTSETUP_GCONF_DIRECTORY "/scale-width" >-#define PRINTSETUP_GCONF_SCALE_HEIGHT PRINTSETUP_GCONF_DIRECTORY "/scale-height" >-#define PRINTSETUP_GCONF_REPEAT_TOP PRINTSETUP_GCONF_DIRECTORY "/repeat-top" >-#define PRINTSETUP_GCONF_REPEAT_LEFT PRINTSETUP_GCONF_DIRECTORY "/repeat-left" >-#define PRINTSETUP_GCONF_MARGIN_TOP PRINTSETUP_GCONF_DIRECTORY "/margin-top" >-#define PRINTSETUP_GCONF_MARGIN_BOTTOM PRINTSETUP_GCONF_DIRECTORY "/margin-bottom" >-#define PRINTSETUP_GCONF_HEADER_FORMAT_LEFT PRINTSETUP_GCONF_DIRECTORY "/hf-left" >-#define PRINTSETUP_GCONF_HEADER_FORMAT_MIDDLE PRINTSETUP_GCONF_DIRECTORY "/hf-middle" >-#define PRINTSETUP_GCONF_HEADER_FORMAT_RIGHT PRINTSETUP_GCONF_DIRECTORY "/hf-right" >- >-#define DIALOGS_GCONF_DIRECTORY "/apps/gnumeric/dialogs" >-#define DIALOGS_GCONF_UNFOCUSED_RS DIALOGS_GCONF_DIRECTORY "/rs/unfocused" >+#define DIALOGS_GCONF_DIR "dialogs" >+#define DIALOGS_GCONF_UNFOCUSED_RS "rs/unfocused" > > /* > * schemas/gnumeric-general.schemas > */ > >-#define GNM_CONF_UNDO_DIRECTORY "/apps/gnumeric/undo" >-#define GNM_CONF_UNDO_SIZE GNM_CONF_UNDO_DIRECTORY "/size" >-#define GNM_CONF_UNDO_MAXNUM GNM_CONF_UNDO_DIRECTORY "/maxnum" >-#define GNM_CONF_UNDO_SHOW_SHEET_NAME GNM_CONF_UNDO_DIRECTORY "/show_sheet_name" >-#define GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH GNM_CONF_UNDO_DIRECTORY "/max_descriptor_width" >- >-#define GNM_CONF_FONT_DIRECTORY "/apps/gnumeric/core/defaultfont" >-#define GNM_CONF_FONT_NAME GNM_CONF_FONT_DIRECTORY "/name" >-#define GNM_CONF_FONT_SIZE GNM_CONF_FONT_DIRECTORY "/size" >-#define GNM_CONF_FONT_BOLD GNM_CONF_FONT_DIRECTORY "/bold" >-#define GNM_CONF_FONT_ITALIC GNM_CONF_FONT_DIRECTORY "/italic" >- >-#define GNM_CONF_FILE_DIRECTORY "/apps/gnumeric/core/file" >-#define GNM_CONF_FILE_HISTORY_N GNM_CONF_FILE_DIRECTORY "/history/n" >-#define GNM_CONF_FILE_HISTORY_FILES GNM_CONF_FILE_DIRECTORY "/history/files" >-#define GNM_CONF_FILE_OVERWRITE_DEFAULT GNM_CONF_FILE_DIRECTORY "/save/def-overwrite" >-#define GNM_CONF_FILE_SINGLE_SHEET_SAVE GNM_CONF_FILE_DIRECTORY "/save/single_sheet" >- >-#define GNM_CONF_WORKBOOK_NSHEETS "/apps/gnumeric/core/workbook/n-sheet" >- >-#define GNM_CONF_GUI_DIRECTORY "/apps/gnumeric/core/gui" >-#define GNM_CONF_GUI_RES_H GNM_CONF_GUI_DIRECTORY "/screen/horizontaldpi" >-#define GNM_CONF_GUI_RES_V GNM_CONF_GUI_DIRECTORY "/screen/verticaldpi" >-#define GNM_CONF_GUI_ED_AUTOCOMPLETE GNM_CONF_GUI_DIRECTORY "/editing/autocomplete" >-#define GNM_CONF_GUI_ED_TRANSITION_KEYS GNM_CONF_GUI_DIRECTORY "/editing/transitionkeys" >-#define GNM_CONF_GUI_ED_LIVESCROLLING GNM_CONF_GUI_DIRECTORY "/editing/livescrolling" >-#define GNM_CONF_GUI_ED_RECALC_LAG GNM_CONF_GUI_DIRECTORY "/editing/recalclag" >-#define GNM_CONF_GUI_WINDOW_X GNM_CONF_GUI_DIRECTORY "/window/x" >-#define GNM_CONF_GUI_WINDOW_Y GNM_CONF_GUI_DIRECTORY "/window/y" >-#define GNM_CONF_GUI_ZOOM GNM_CONF_GUI_DIRECTORY "/window/zoom" >- >-#define GNM_CONF_XML_COMPRESSION "/apps/gnumeric/core/xml/compression-level" >- >-#define GNM_CONF_SORT_DIRECTORY "/apps/gnumeric/core/sort" >-#define GNM_CONF_SORT_DEFAULT_BY_CASE GNM_CONF_SORT_DIRECTORY "/default/by-case" >-#define GNM_CONF_SORT_DEFAULT_RETAIN_FORM GNM_CONF_SORT_DIRECTORY "/default/retain-formats" >-#define GNM_CONF_SORT_DEFAULT_ASCENDING GNM_CONF_SORT_DIRECTORY "/default/ascending" >-#define GNM_CONF_SORT_DIALOG_MAX_INITIAL GNM_CONF_SORT_DIRECTORY "/dialog/max-initial-clauses" >+#define GNM_CONF_UNDO_DIR "undo" >+#define GNM_CONF_UNDO_SIZE "size" >+#define GNM_CONF_UNDO_MAXNUM "maxnum" >+#define GNM_CONF_UNDO_SHOW_SHEET_NAME "show_sheet_name" >+#define GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH "max_descriptor_width" >+ >+#define GNM_CONF_FONT_DIR "core/defaultfont" >+#define GNM_CONF_FONT_NAME "name" >+#define GNM_CONF_FONT_SIZE "size" >+#define GNM_CONF_FONT_BOLD "bold" >+#define GNM_CONF_FONT_ITALIC "italic" >+ >+#define GNM_CONF_FILE_DIR "core/file" >+#define GNM_CONF_FILE_HISTORY_N "history/n" >+#define GNM_CONF_FILE_HISTORY_FILES "history/files" >+#define GNM_CONF_FILE_OVERWRITE_DEFAULT "save/def-overwrite" >+#define GNM_CONF_FILE_SINGLE_SHEET_SAVE "save/single_sheet" >+ >+#define GNM_CONF_WORKBOOK_NSHEETS "core/workbook/n-sheet" >+ >+#define GNM_CONF_GUI_DIR "core/gui" >+#define GNM_CONF_GUI_RES_H "screen/horizontaldpi" >+#define GNM_CONF_GUI_RES_V "screen/verticaldpi" >+#define GNM_CONF_GUI_ED_AUTOCOMPLETE "editing/autocomplete" >+#define GNM_CONF_GUI_ED_TRANSITION_KEYS "editing/transitionkeys" >+#define GNM_CONF_GUI_ED_LIVESCROLLING "editing/livescrolling" >+#define GNM_CONF_GUI_ED_RECALC_LAG "editing/recalclag" >+#define GNM_CONF_GUI_WINDOW_X "window/x" >+#define GNM_CONF_GUI_WINDOW_Y "window/y" >+#define GNM_CONF_GUI_ZOOM "window/zoom" >+ >+#define GNM_CONF_XML_COMPRESSION "core/xml/compression-level" >+ >+#define GNM_CONF_SORT_DIR "core/sort" >+#define GNM_CONF_SORT_DEFAULT_BY_CASE "default/by-case" >+#define GNM_CONF_SORT_DEFAULT_RETAIN_FORM "default/retain-formats" >+#define GNM_CONF_SORT_DEFAULT_ASCENDING "default/ascending" >+#define GNM_CONF_SORT_DIALOG_MAX_INITIAL "dialog/max-initial-clauses" > >-#define GNM_CONF_CUTANDPASTE_DIRECTORY "/apps/gnumeric/cut-and-paste" >-#define GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD GNM_CONF_CUTANDPASTE_DIRECTORY "/prefer-clipboard" >+#define GNM_CONF_CUTANDPASTE_DIR "cut-and-paste" >+#define GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD "prefer-clipboard" > > /* > * schemas/gnumeric-plugins.schemas > */ > >-#define PLUGIN_GCONF_LATEX "/apps/gnumeric/plugin/latex" >-#define PLUGIN_GCONF_LATEX_USE_UTF8 PLUGIN_GCONF_LATEX "/use-utf8" >+#define PLUGIN_GCONF_LATEX "plugin/latex" >+#define PLUGIN_GCONF_LATEX_USE_UTF8 "use-utf8" > > #endif /* GNM_CONF_PRIV_H */ >Index: src/gnumeric-gconf.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gnumeric-gconf.c,v >retrieving revision 1.62 >diff -u -w -p -r1.62 gnumeric-gconf.c >--- src/gnumeric-gconf.c 20 Nov 2004 06:08:05 -0000 1.62 >+++ src/gnumeric-gconf.c 14 Mar 2006 19:15:56 -0000 >@@ -2,11 +2,13 @@ > /* > * gnumeric-gconf.c: > * >- * > * Author: > * Andreas J. Guelzow <aguelzow@taliesin.ca> > * >- * (C) Copyright 2002-2004 Andreas J. Guelzow <aguelzow@taliesin.ca> >+ * (C) Copyright 2002-2005 Andreas J. Guelzow <aguelzow@taliesin.ca> >+ * >+ * Introduced the concept of "node" and implemented the win32 backend >+ * by Ivan, Wong Yat Cheung <email@ivanwong.info>, 2005 > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as published by >@@ -33,6 +35,7 @@ > > static GnmAppPrefs prefs; > GnmAppPrefs const *gnm_app_prefs = &prefs; >+static GOConfNode *root = NULL; > > #ifdef WITH_GNOME > #include <format.h> >@@ -40,89 +43,161 @@ GnmAppPrefs const *gnm_app_prefs = &pref > #include <number-match.h> > #include <gconf/gconf-client.h> > >+struct _GOConfNode { >+ gchar *path; >+ gboolean root; >+}; >+ > static GConfClient *gconf_client = NULL; >-static GConfClient * >-gnm_app_get_gconf_client (void) >+ >+ >+static void >+go_conf_init () > { >- if (!gconf_client) { >+ if (!gconf_client) > gconf_client = gconf_client_get_default (); >- gconf_client_add_dir (gconf_client, "/apps/gnumeric", >+} >+ >+static void >+go_conf_shutdown () >+{ >+ if (gconf_client) { >+ g_object_unref (G_OBJECT (gconf_client)); >+ gconf_client = NULL; >+ } >+} >+ >+static gchar * >+go_conf_get_real_key (GOConfNode const *key, gchar const *subkey) >+{ >+ return key ? g_strconcat ((key)->path, "/", subkey, NULL) : >+ g_strdup (subkey); >+} >+ >+GOConfNode * >+go_conf_get_node (GOConfNode *parent, gchar const *key) >+{ >+ GOConfNode *node; >+ >+ node = g_new (GOConfNode, 1); >+ gconf_client = gconf_client; >+ node->root = !parent; >+ if (node->root) { >+ node->path = g_strconcat ("/apps/", key, NULL); >+ gconf_client_add_dir (gconf_client, node->path, > GCONF_CLIENT_PRELOAD_RECURSIVE, > NULL); > } >- return gconf_client; >+ else >+ node->path = go_conf_get_real_key (parent, key); >+ >+ return node; >+} >+ >+void >+go_conf_free_node (GOConfNode *node) >+{ >+ if (node) { >+ if (node->root) >+ gconf_client_remove_dir (gconf_client, node->path, NULL); >+ g_free (node->path); >+ g_free (node); >+ } > } >+ > void >-go_conf_sync (void) >+go_conf_sync (GOConfNode *node) > { >- gconf_client_suggest_sync (gnm_app_get_gconf_client (), NULL); >+ gconf_client_suggest_sync (gconf_client, NULL); > } > > void >-go_conf_set_bool (char const *key, gboolean val) >+go_conf_set_bool (GOConfNode *node, gchar const *key, gboolean val) > { >- gconf_client_set_bool (gnm_app_get_gconf_client (), key, val, NULL); >+ gchar *real_key = go_conf_get_real_key (node, key); >+ gconf_client_set_bool (gconf_client, real_key, val, NULL); >+ g_free (real_key); > } >+ > void >-go_conf_set_int (char const *key, gint val) >+go_conf_set_int (GOConfNode *node, gchar const *key, gint val) > { >- gconf_client_set_int (gnm_app_get_gconf_client (), key, val, NULL); >+ gchar *real_key = go_conf_get_real_key (node, key); >+ gconf_client_set_int (gconf_client, real_key, val, NULL); >+ g_free (real_key); > } >+ > void >-go_conf_set_double (char const *key, gnm_float val) >+go_conf_set_double (GOConfNode *node, gchar const *key, gnm_float val) > { >- gconf_client_set_float (gnm_app_get_gconf_client (), key, val, NULL); >+ gchar *real_key = go_conf_get_real_key (node, key); >+ gconf_client_set_float (gconf_client, real_key, val, NULL); >+ g_free (real_key); > } >+ > void >-go_conf_set_string (char const *key, char const *str) >+go_conf_set_string (GOConfNode *node, gchar const *key, gchar const *str) > { >- gconf_client_set_string (gnm_app_get_gconf_client (), key, str, NULL); >+ gchar *real_key = go_conf_get_real_key (node, key); >+ gconf_client_set_string (gconf_client, real_key, str, NULL); >+ g_free (real_key); > } >+ > void >-go_conf_set_str_list (char const *key, GSList *list) >+go_conf_set_str_list (GOConfNode *node, gchar const *key, GSList *list) > { >- gconf_client_set_list (gnm_app_get_gconf_client (), >- key, GCONF_VALUE_STRING, list, NULL); >+ gchar *real_key = go_conf_get_real_key (node, key); >+ gconf_client_set_list (gconf_client, real_key, >+ GCONF_VALUE_STRING, list, NULL); >+ g_free (real_key); > } > > static GConfValue * >-go_conf_get (char const *key, GConfValueType t) >+go_conf_get (GOConfNode *node, gchar const *key, GConfValueType t) > { > GError *err = NULL; >- GConfValue *val = gconf_client_get (gnm_app_get_gconf_client (), key, &err); >+ GConfValue *val; >+ gchar *real_key; >+ >+ real_key = go_conf_get_real_key (node, key); >+ val = gconf_client_get (gconf_client, real_key, &err); > > if (err != NULL) { > g_warning ("Unable to load key '%s' : because %s", >- key, err->message); >+ real_key, err->message); >+ g_free (real_key); > g_error_free (err); > return NULL; > } > if (val == NULL) { >- g_warning ("Unable to load key '%s'", key); >+ g_warning ("Unable to load key '%s'", real_key); >+ g_free (real_key); > return NULL; > } > > if (val->type != t) { > #if 1 /* gconf_value_type_to_string is internal */ > g_warning ("Expected `%d' got `%d' for key %s", >- t, val->type, key); >+ t, val->type, real_key); > #else > g_warning ("Expected `%s' got `%s' for key %s", > gconf_value_type_to_string (t), > gconf_value_type_to_string (val->type), >- key); >+ real_key); > #endif >+ g_free (real_key); > gconf_value_free (val); > return NULL; > } >+ g_free (real_key); > > return val; > } > gboolean >-go_conf_load_bool (char const *key, gboolean default_val) >+go_conf_load_bool (GOConfNode *node, gchar const *key, gboolean default_val) > { > gboolean res; >- GConfValue *val = go_conf_get (key, GCONF_VALUE_BOOL); >+ GConfValue *val = go_conf_get (node, key, GCONF_VALUE_BOOL); > > if (val != NULL) { > res = gconf_value_get_bool (val); >@@ -134,11 +209,11 @@ go_conf_load_bool (char const *key, gboo > return res; > } > >-int >-go_conf_load_int (char const *key, int minima, int maxima, int default_val) >+gint >+go_conf_load_int (GOConfNode *node, gchar const *key, gint minima, gint maxima, gint default_val) > { >- int res = -1; >- GConfValue *val = go_conf_get (key, GCONF_VALUE_INT); >+ gint res = -1; >+ GConfValue *val = go_conf_get (node, key, GCONF_VALUE_INT); > > if (val != NULL) { > res = gconf_value_get_int (val); >@@ -156,12 +231,12 @@ go_conf_load_int (char const *key, int m > return res; > } > >-double >-go_conf_load_double (char const *key, >- double minima, double maxima, double default_val) >+gdouble >+go_conf_load_double (GOConfNode *node, gchar const *key, >+ gdouble minima, gdouble maxima, gdouble default_val) > { >- double res = -1; >- GConfValue *val = go_conf_get (key, GCONF_VALUE_FLOAT); >+ gdouble res = -1; >+ GConfValue *val = go_conf_get (node, key, GCONF_VALUE_FLOAT); > > if (val != NULL) { > res = gconf_value_get_float (val); >@@ -178,46 +253,63 @@ go_conf_load_double (char const *key, > } > return res; > } >-char * >-go_conf_load_string (char const *key) >+ >+gchar * >+go_conf_load_string (GOConfNode *node, gchar const *key) > { >- return gconf_client_get_string (gnm_app_get_gconf_client (), key, NULL); >+ gchar *val; >+ >+ gchar *real_key = go_conf_get_real_key (node, key); >+ val = gconf_client_get_string (gconf_client, real_key, NULL); >+ g_free (real_key); >+ >+ return val; > } >+ > GSList * >-go_conf_load_str_list (char const *key) >+go_conf_load_str_list (GOConfNode *node, gchar const *key) > { >- return gconf_client_get_list (gnm_app_get_gconf_client (), >- key, GCONF_VALUE_STRING, NULL); >+ GSList *list; >+ >+ gchar *real_key = go_conf_get_real_key (node, key); >+ list = gconf_client_get_list (gconf_client, real_key, >+ GCONF_VALUE_STRING, NULL); >+ g_free (real_key); >+ >+ return list; > } > > static GConfSchema * >-get_schema (char const *key) >+get_schema (GOConfNode *node, gchar const *key) > { >- char *schema_key = g_strconcat ("/schemas", key, NULL); >+ gchar *schema_key = g_strconcat ( >+ "/schemas", node->path, "/", key, NULL); > GConfSchema *schema = gconf_client_get_schema ( >- gnm_app_get_gconf_client (), schema_key, NULL); >+ gconf_client, schema_key, NULL); > g_free (schema_key); > return schema; > } >-char * >-go_conf_get_short_desc (char const *key) >+ >+gchar * >+go_conf_get_short_desc (GOConfNode *node, gchar const *key) > { >- GConfSchema *schema = get_schema (key); >+ GConfSchema *schema = get_schema (node, key); > > if (schema != NULL) { >- char *desc = g_strdup (gconf_schema_get_short_desc (schema)); >+ gchar *desc = g_strdup (gconf_schema_get_short_desc (schema)); > gconf_schema_free (schema); > return desc; > } > return NULL; > } >-char * >-go_conf_get_long_desc (char const *key) >+ >+gchar * >+go_conf_get_long_desc (GOConfNode *node, gchar const *key) > { >- GConfSchema *schema = get_schema (key); >+ GConfSchema *schema = get_schema (node, key); > > if (schema != NULL) { >- char *desc = g_strdup (gconf_schema_get_long_desc (schema)); >+ gchar *desc = g_strdup (gconf_schema_get_long_desc (schema)); > gconf_schema_free (schema); > return desc; > } >@@ -225,9 +317,9 @@ go_conf_get_long_desc (char const *key) > } > > GType >-go_conf_get_type (char const *key) >+go_conf_get_type (GOConfNode *node, gchar const *key) > { >- GConfSchema *schema = get_schema (key); >+ GConfSchema *schema = get_schema (node, key); > GType t; > > switch (gconf_schema_get_type (schema)) { >@@ -244,27 +336,25 @@ go_conf_get_type (char const *key) > return t; > } > >-char * >-go_conf_get_value_as_str (char const *key) >+gchar * >+go_conf_get_value_as_str (GOConfNode *node, gchar const *key) > { >- char *value_string; >- GConfClient *gconf = gnm_app_get_gconf_client (); >+ gchar *value_string; >+ GConfClient *gconf = gconf_client; > >- switch (go_conf_get_type (key)) { >+ switch (go_conf_get_type (node, key)) { > case G_TYPE_STRING: > value_string = gconf_client_get_string (gconf, key, NULL); > > break; > case G_TYPE_INT: >- value_string = g_strdup_printf ("%i", gconf_client_get_int (gconf, key, >- NULL)); >+ value_string = g_strdup_printf ("%i", go_conf_get_int (node, key)); > break; > case G_TYPE_FLOAT: >- value_string = g_strdup_printf ("%f", gconf_client_get_float (gconf, key, >- NULL)); >+ value_string = g_strdup_printf ("%f", go_conf_get_double (node, key)); > break; > case G_TYPE_BOOLEAN: >- value_string = g_strdup (format_boolean (gconf_client_get_bool (gconf, key, NULL))); >+ value_string = g_strdup (format_boolean (go_conf_get_bool (node, key))); > break; > default: > value_string = g_strdup ("ERROR FIXME"); >@@ -273,43 +363,58 @@ go_conf_get_value_as_str (char const *ke > return value_string; > } > >-int >-go_conf_get_bool (char const *key) >+gboolean >+go_conf_get_bool (GOConfNode *node, gchar const *key) > { >- GConfClient *gconf = gnm_app_get_gconf_client (); >- return gconf_client_get_bool (gconf, key, NULL); >+ gboolean val; >+ gchar *real_key; >+ >+ real_key = go_conf_get_real_key (node, key); >+ val = gconf_client_get_bool (gconf_client, real_key, NULL); >+ g_free (real_key); >+ >+ return val; > } > >-int >-go_conf_get_int (char const *key) >+gint >+go_conf_get_int (GOConfNode *node, gchar const *key) > { >- GConfClient *gconf = gnm_app_get_gconf_client (); >- return gconf_client_get_int (gconf, key, NULL); >+ gint val; >+ gchar *real_key; >+ >+ real_key = go_conf_get_real_key (node, key); >+ val = gconf_client_get_int (gconf_client, real_key, NULL); >+ g_free (real_key); >+ >+ return val; > } > >-double >-go_conf_get_double (char const *key) >+gdouble >+go_conf_get_double (GOConfNode *node, gchar const *key) > { >- GConfClient *gconf = gnm_app_get_gconf_client (); >- return gconf_client_get_float (gconf, key, NULL); >-} >+ gdouble val; >+ gchar *real_key; > >+ real_key = go_conf_get_real_key (node, key); >+ val = gconf_client_get_float (gconf_client, real_key, NULL); >+ g_free (real_key); >+ >+ return val; >+} > > gboolean >-go_conf_set_value_from_str (char const *key, char const *val_str) >+go_conf_set_value_from_str (GOConfNode *node, gchar const *key, gchar const *val_str) > { >- GConfClient *client = gnm_app_get_gconf_client (); >- >- switch (go_conf_get_type (key)) { >+ switch (go_conf_get_type (node, key)) { > case G_TYPE_STRING: >- go_conf_set_string (key, val_str); >+ go_conf_set_string (node, key, val_str); > break; > case G_TYPE_FLOAT: { > GnmDateConventions const *conv = NULL; /* workbook_date_conv (state->wb); */ > GnmValue *value = format_match_number (val_str, NULL, conv); > if (value != NULL) { > gnm_float the_float = value_get_as_float (value); >- gconf_client_set_float (client, key, the_float, NULL); >+ go_conf_set_double (node, key, the_float); > } > if (value) > value_release (value); >@@ -319,8 +424,8 @@ go_conf_set_value_from_str (char const * > GnmDateConventions const *conv = NULL; /* workbook_date_conv (state->wb); */ > GnmValue *value = format_match_number (val_str, NULL, conv); > if (value != NULL) { >- int the_int = value_get_as_int (value); >- go_conf_set_int (key, the_int); >+ gint the_int = value_get_as_int (value); >+ go_conf_set_int (node, key, the_int); > } > if (value) > value_release (value); >@@ -333,7 +438,7 @@ go_conf_set_value_from_str (char const * > if (value != NULL) { > err = FALSE; > the_bool = value_get_as_bool (value, &err); >- gconf_client_set_bool (client, key, the_bool, NULL); >+ go_conf_set_bool (node, key, the_bool); > } > if (value) > value_release (value); >@@ -349,143 +454,799 @@ go_conf_set_value_from_str (char const * > void > go_conf_remove_monitor (guint monitor_id) > { >- gconf_client_notify_remove (gnm_app_get_gconf_client (), >+ gconf_client_notify_remove (gconf_client, > GPOINTER_TO_INT (monitor_id)); > } > > typedef struct { >- void (*monitor) (char const *key, gpointer data); >+ GOConfMonitorFunc monitor; > gpointer data; > } GOConfClosure; >+ > static void > cb_key_changed (GConfClient *client, guint cnxn_id, > GConfEntry *entry, GOConfClosure *close) > { >- close->monitor (gconf_entry_get_key (entry), close->data); >+ close->monitor (NULL, gconf_entry_get_key (entry), close->data); > } >+ > guint >-go_conf_add_monitor (char const *key, >+go_conf_add_monitor (GOConfNode *node, gchar const *key, > GOConfMonitorFunc monitor, gpointer data) > { >+ guint ret; > GOConfClosure *close = g_new0 (GOConfClosure, 1); >+ gchar *real_key; >+ > close->monitor = monitor; > close->data = data; >- return gconf_client_notify_add (gnm_app_get_gconf_client (), key, >+ real_key = go_conf_get_real_key (node, key); >+ ret = gconf_client_notify_add (gconf_client, real_key, > (GConfClientNotifyFunc) cb_key_changed, close, g_free, NULL); >+ g_free (real_key); >+ >+ return ret; >+} >+ >+#elif defined G_OS_WIN32 >+ >+#include <windows.h> >+#include <format.h> >+#include <value.h> >+#include <number-match.h> >+ >+#ifndef ERANGE >+/* mingw has not defined ERANGE (yet), MSVC has it though */ >+# define ERANGE 34 >+#endif >+ >+struct _GOConfNode { >+ HKEY hKey; >+ gchar *path; >+}; >+ >+static void >+go_conf_init () >+{ >+} >+ >+static void >+go_conf_shutdown () >+{ >+} >+ >+static gboolean >+go_conf_win32_get_node (GOConfNode *node, HKEY *phKey, gchar const *key, gboolean *is_new) >+{ >+ gchar *path, *c; >+ LONG ret; >+ DWORD disposition; >+ >+ path = g_strconcat (node ? "" : "Software\\", key, NULL); >+ for (c = path; *c; ++c) { >+ if (*c == '/') >+ *c = '\\'; >+ } >+ ret = RegCreateKeyEx (node ? node->hKey : HKEY_CURRENT_USER, path, >+ 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, >+ NULL, phKey, &disposition); >+ g_free (path); >+ >+ if (is_new) >+ *is_new = disposition == REG_CREATED_NEW_KEY; >+ >+ return ret == ERROR_SUCCESS; >+} >+ >+static gboolean >+go_conf_win32_set (GOConfNode *node, gchar const *key, >+ gint type, guchar *data, gint size) >+{ >+ gchar *last_sep, *path = NULL; >+ HKEY hKey; >+ gboolean ok; >+ >+ if ((last_sep = strrchr (key, '/')) != NULL) { >+ path = g_strndup (key, last_sep - key); >+ ok = go_conf_win32_get_node (node, &hKey, path, NULL); >+ g_free (path); >+ if (!ok) >+ return FALSE; >+ key = last_sep + 1; >+ } >+ else >+ hKey = node->hKey; >+ RegSetValueEx (hKey, key, 0, type, data, size); >+ if (path) >+ RegCloseKey (hKey); >+ >+ return TRUE; >+} >+ >+static gboolean >+go_conf_win32_get (GOConfNode *node, gchar const *key, >+ gulong *type, guchar **data, gulong *size, >+ gboolean realloc, gint *ret_code) >+{ >+ gchar *last_sep, *path = NULL; >+ HKEY hKey; >+ LONG ret; >+ gboolean ok; >+ >+ if ((last_sep = strrchr (key, '/')) != NULL) { >+ path = g_strndup (key, last_sep - key); >+ ok = go_conf_win32_get_node (node, &hKey, path, NULL); >+ g_free (path); >+ if (!ok) >+ return FALSE; >+ key = last_sep + 1; >+ } >+ else >+ hKey = node->hKey; >+ if (!*data && realloc) { >+ RegQueryValueEx (hKey, key, NULL, type, NULL, size); >+ *data = g_new (guchar, *size); >+ } >+ while ((ret = RegQueryValueEx (hKey, key, NULL, >+ type, *data, size)) == ERROR_MORE_DATA && >+ realloc) >+ *data = g_realloc (*data, *size); >+ if (path) >+ RegCloseKey (hKey); >+ if (ret_code) >+ *ret_code = ret; >+ >+ return ret == ERROR_SUCCESS; >+} >+ >+static void >+go_conf_win32_clone (HKEY hSrcKey, gchar *key, HKEY hDstKey, gchar *buf1, gchar *buf2, gchar *buf3) >+{ >+#define WIN32_MAX_REG_KEYNAME_LEN 256 >+#define WIN32_MAX_REG_VALUENAME_LEN 32767 >+#define WIN32_INIT_VALUE_DATA_LEN 2048 >+ gint i; >+ gchar *subkey, *value_name, *data; >+ DWORD name_size, type, data_size; >+ HKEY hSrcSK, hDstSK; >+ FILETIME ft; >+ LONG ret; >+ >+ if (RegOpenKeyEx (hSrcKey, key, 0, KEY_READ, &hSrcSK) != ERROR_SUCCESS) >+ return; >+ >+ if (!buf1) { >+ subkey = g_malloc (WIN32_MAX_REG_KEYNAME_LEN); >+ value_name = g_malloc (WIN32_MAX_REG_VALUENAME_LEN); >+ data = g_malloc (WIN32_INIT_VALUE_DATA_LEN); >+ } >+ else { >+ subkey = buf1; >+ value_name = buf2; >+ data = buf3; >+ } >+ >+ ret = ERROR_SUCCESS; >+ for (i = 0; ret == ERROR_SUCCESS; ++i) { >+ name_size = WIN32_MAX_REG_KEYNAME_LEN; >+ ret = RegEnumKeyEx (hSrcSK, i, subkey, &name_size, NULL, NULL, NULL, &ft); >+ if (ret != ERROR_SUCCESS) >+ continue; >+ >+ if (RegCreateKeyEx (hDstKey, subkey, 0, NULL, 0, KEY_WRITE, >+ NULL, &hDstSK, NULL) == ERROR_SUCCESS) { >+ go_conf_win32_clone (hSrcSK, subkey, hDstSK, subkey, value_name, data); >+ RegCloseKey (hDstSK); >+ } >+ } >+ >+ ret = ERROR_SUCCESS; >+ for (i = 0; ret == ERROR_SUCCESS; ++i) { >+ name_size = WIN32_MAX_REG_KEYNAME_LEN; >+ data_size = WIN32_MAX_REG_VALUENAME_LEN; >+ while ((ret = RegEnumValue (hSrcSK, i, value_name, &name_size, >+ NULL, &type, data, &data_size)) == >+ ERROR_MORE_DATA) >+ data = g_realloc (data, data_size); >+ if (ret != ERROR_SUCCESS) >+ continue; >+ >+ RegSetValueEx (hDstKey, value_name, 0, type, data, data_size); >+ } >+ >+ RegCloseKey (hSrcSK); >+ if (!buf1) { >+ g_free (subkey); >+ g_free (value_name); >+ g_free (data); >+ } >+} >+ >+GOConfNode * >+go_conf_get_node (GOConfNode *parent, const gchar *key) >+{ >+ HKEY hKey; >+ GOConfNode *node = NULL; >+ gboolean is_new; >+ >+ if (go_conf_win32_get_node (parent, &hKey, key, &is_new)) { >+ if (!parent && is_new) { >+ gchar *path; >+ >+ path = g_strconcat (".DEFAULT\\Software\\", key, NULL); >+ go_conf_win32_clone (HKEY_USERS, path, hKey, NULL, NULL, NULL); >+ g_free (path); >+ } >+ node = g_malloc (sizeof (GOConfNode)); >+ node->hKey = hKey; >+ node->path = g_strdup (key); >+ } >+ >+ return node; >+} >+ >+void >+go_conf_free_node (GOConfNode *node) >+{ >+ if (node) { >+ RegCloseKey (node->hKey); >+ g_free (node->path); >+ g_free (node); >+ } >+} >+ >+void >+go_conf_set_bool (GOConfNode *node, gchar const *key, gboolean val) >+{ >+ guchar bool = val ? 1 : 0; >+ >+ go_conf_win32_set (node, key, REG_BINARY, (guchar *) &bool, >+ sizeof (bool)); >+} >+ >+void >+go_conf_set_int (GOConfNode *node, gchar const *key, gint val) >+{ >+ go_conf_win32_set (node, key, REG_DWORD, (guchar *) &val, >+ sizeof (DWORD)); >+} >+ >+void >+go_conf_set_double (GOConfNode *node, gchar const *key, gnm_float val) >+{ >+ gchar str[G_ASCII_DTOSTR_BUF_SIZE]; >+ >+ g_ascii_dtostr (str, sizeof (str), val); >+ go_conf_win32_set (node, key, REG_SZ, (guchar *) str, >+ strlen (str) + 1); >+} >+ >+void >+go_conf_set_string (GOConfNode *node, gchar const *key, gchar const *str) >+{ >+ go_conf_win32_set (node, key, REG_SZ, (guchar *) str, >+ strlen (str) + 1); >+} >+ >+void >+go_conf_set_str_list (GOConfNode *node, gchar const *key, GSList *list) >+{ >+ GString *str_list; >+ >+ str_list = g_string_new (""); >+ while (list) { >+ g_string_append (str_list, g_strescape (list->data, NULL)); >+ g_string_append_c (str_list, '\n'); >+ list = list->next; >+ } >+ go_conf_win32_set (node, key, REG_SZ, (guchar *) str_list->str, >+ str_list->len + 1); >+ g_string_free (str_list, TRUE); >+} >+ >+gboolean >+go_conf_get_bool (GOConfNode *node, gchar const *key) >+{ >+ guchar val, *ptr = &val; >+ gulong type, size = sizeof (val); >+ >+ if (go_conf_win32_get (node, key, &type, &ptr, &size, FALSE, NULL) && >+ type == REG_BINARY) >+ return val; >+ >+ return FALSE; >+} >+ >+gint >+go_conf_get_int (GOConfNode *node, gchar const *key) >+{ >+ gint val; >+ gulong type, size = sizeof (DWORD); >+ guchar *ptr = (guchar *) &val; >+ >+ if (go_conf_win32_get (node, key, &type, &ptr, &size, FALSE, NULL) && >+ type == REG_DWORD) >+ return val; >+ >+ return 0; >+} >+ >+gdouble >+go_conf_get_double (GOConfNode *node, gchar const *key) >+{ >+ gchar *ptr = go_conf_get_string (node, key); >+ gdouble val; >+ >+ if (ptr) { >+ val = g_ascii_strtod (ptr, NULL); >+ g_free (ptr); >+ if (errno != ERANGE) >+ return val; >+ } >+ >+ return 0.0; >+} >+ >+gchar * >+go_conf_get_string (GOConfNode *node, gchar const *key) >+{ >+ DWORD type, size = 0; >+ guchar *ptr = NULL; >+ >+ if (go_conf_win32_get (node, key, &type, &ptr, &size, TRUE, NULL) && >+ type == REG_SZ) >+ return ptr; >+ >+ g_free (ptr); >+ >+ return NULL; >+} >+ >+GSList * >+go_conf_get_str_list (GOConfNode *node, gchar const *key) >+{ >+ GSList *list = NULL; >+ gchar *ptr; >+ gchar **str_list; >+ gint i; >+ >+ if ((ptr = go_conf_get_string (node, key)) != NULL) { >+ str_list = g_strsplit ((const gchar *) ptr, "\n", 0); >+ for (i = 0; str_list[i]; ++i) >+ list = g_slist_prepend (list, g_strcompress (str_list[i])); >+ g_slist_reverse (list); >+ g_strfreev (str_list); >+ g_free (ptr); >+ } >+ >+ return list; >+} >+ >+static guchar * >+go_conf_get (GOConfNode *node, gchar const *key, gulong expected) >+{ >+ gulong type, size = 0; >+ guchar *ptr = NULL; >+ gint ret_code; >+ >+ if (!go_conf_win32_get (node, key, &type, &ptr, &size, TRUE, &ret_code)) { >+ LPTSTR msg_buf; >+ >+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | >+ FORMAT_MESSAGE_FROM_SYSTEM | >+ FORMAT_MESSAGE_IGNORE_INSERTS, >+ NULL, >+ ret_code, >+ MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), >+ (LPTSTR) &msg_buf, >+ 0, >+ NULL); >+ g_warning ("Unable to load key '%s' : because %s", >+ key, msg_buf); >+ LocalFree (msg_buf); >+ g_free (ptr); >+ return NULL; > } >+ >+ if (type != expected) { >+ g_warning ("Expected `%lu' got `%lu' for key %s of node %s", >+ expected, type, key, node->path); >+ g_free (ptr); >+ return NULL; >+ } >+ >+ return ptr; >+} >+ >+gboolean >+go_conf_load_bool (GOConfNode *node, gchar const *key, >+ gboolean default_val) >+{ >+ guchar *val = go_conf_get (node, key, REG_BINARY); >+ gboolean res; >+ >+ if (val) { >+ res = (gboolean) *val; >+ g_free (val); >+ } else { >+ g_warning ("Using default value '%s'", default_val ? "true" : "false"); >+ return default_val; >+ } >+ >+ return res; >+} >+ >+gint >+go_conf_load_int (GOConfNode *node, gchar const *key, >+ gint minima, gint maxima, gint default_val) >+{ >+ guchar *val = go_conf_get (node, key, REG_DWORD); >+ gint res; >+ >+ if (val) { >+ res = *(gint *) val; >+ g_free (val); >+ if (res < minima || maxima < res) { >+ g_warning ("Invalid value '%d' for %s. If should be >= %d and <= %d", >+ res, key, minima, maxima); >+ val = NULL; >+ } >+ } >+ if (!val) { >+ g_warning ("Using default value '%d'", default_val); >+ return default_val; >+ } >+ >+ return res; >+} >+ >+gdouble >+go_conf_load_double (GOConfNode *node, gchar const *key, >+ gdouble minima, gdouble maxima, gdouble default_val) >+{ >+ gdouble res = -1; >+ gchar *val = (gchar *) go_conf_get (node, key, REG_SZ); >+ >+ if (val) { >+ res = g_ascii_strtod (val, NULL); >+ g_free (val); >+ if (errno == ERANGE || res < minima || maxima < res) { >+ g_warning ("Invalid value '%g' for %s. If should be >= %g and <= %g", >+ res, key, minima, maxima); >+ val = NULL; >+ } >+ } >+ if (!val) { >+ g_warning ("Using default value '%g'", default_val); >+ return default_val; >+ } >+ >+ return res; >+} >+ >+gchar * >+go_conf_load_string (GOConfNode *node, gchar const *key) >+{ >+ return go_conf_get (node, key, REG_SZ); >+} >+ >+GSList * >+go_conf_load_str_list (GOConfNode *node, gchar const *key) >+{ >+ return go_conf_get_str_list (node, key); >+} >+ >+gchar * >+go_conf_get_short_desc (GOConfNode *node, gchar const *key) >+{ >+ return NULL; >+} >+ >+gchar * >+go_conf_get_long_desc (GOConfNode *node, gchar const *key) >+{ >+ return NULL; >+} >+ >+GType >+go_conf_get_type (GOConfNode *node, gchar const *key) >+{ >+ gulong type, size; >+ guchar *ptr = NULL; >+ GType t = G_TYPE_NONE; >+ >+ if (go_conf_win32_get (node, key, &type, &ptr, &size, FALSE, NULL)) { >+ switch (type) { >+ case REG_BINARY: >+ t = G_TYPE_BOOLEAN; break; >+ case REG_DWORD: >+ t = G_TYPE_INT; break; >+ case REG_SZ: >+ t = G_TYPE_STRING; break; >+ } >+ } >+ >+ return t; >+} >+ >+gchar * >+go_conf_get_value_as_str (GOConfNode *node, gchar const *key) >+{ >+ gchar *value_string; >+ >+ switch (go_conf_get_type (node, key)) { >+ case G_TYPE_STRING: >+ value_string = go_conf_get_string (node, key); >+ break; >+ case G_TYPE_INT: >+ value_string = g_strdup_printf ("%i", go_conf_get_int (node, key)); >+ break; >+ case G_TYPE_FLOAT: >+ value_string = go_conf_get_string (node, key); >+ break; >+ case G_TYPE_BOOLEAN: >+ value_string = g_strdup (format_boolean (go_conf_get_bool (node, key))); >+ break; >+ default: >+ value_string = g_strdup ("ERROR FIXME"); >+ } >+ >+ return value_string; >+} >+ >+gboolean >+go_conf_set_value_from_str (GOConfNode *node, gchar const *key, >+ gchar const *val_str) >+{ >+ switch (go_conf_get_type (node, key)) { >+ case G_TYPE_STRING: >+ go_conf_set_string (node, key, val_str); >+ break; >+ case G_TYPE_INT: { >+ GnmDateConventions const *conv = NULL; /* workbook_date_conv (state->wb); */ >+ GnmValue *value = format_match_number (val_str, NULL, conv); >+ if (value != NULL) { >+ gint the_int = value_get_as_int (value); >+ go_conf_set_int (node, key, the_int); >+ } >+ if (value) >+ value_release (value); >+ break; >+ } >+ case G_TYPE_BOOLEAN: { >+ GnmDateConventions const *conv = NULL; /* workbook_date_conv (state->wb); */ >+ GnmValue *value = format_match_number (val_str, NULL, conv); >+ gboolean err, the_bool; >+ if (value != NULL) { >+ err = FALSE; >+ the_bool = value_get_as_bool (value, &err); >+ go_conf_set_bool (node, key, the_bool); >+ } >+ if (value) >+ value_release (value); >+ break; >+ } >+ default: >+ g_warning ("Unsupported gconf type in preference dialog"); >+ } >+ >+ return TRUE; >+} >+ >+void >+go_conf_sync (GOConfNode *node) >+{ >+ if (node) >+ RegFlushKey (node->hKey); >+} >+ >+void >+go_conf_remove_monitor (guint monitor_id) >+{ >+} >+ >+guint >+go_conf_add_monitor (GOConfNode *node, gchar const *key, >+ GOConfMonitorFunc monitor, gpointer data) >+{ >+ return 1; >+} >+ > #else >+ > void >-go_conf_set_bool (G_GNUC_UNUSED char const *key, G_GNUC_UNUSED gboolean val) >+go_conf_set_bool (GOConfNode *node, gchar const *key, gboolean val) > { > } >+ > void >-go_conf_set_int (G_GNUC_UNUSED char const *key, G_GNUC_UNUSED gint val) >+go_conf_set_int (GOConfNode *node, gchar const *key, gint val) > { > } >+ > void >-go_conf_set_double (G_GNUC_UNUSED char const *key, G_GNUC_UNUSED gnm_float val) >+go_conf_set_double (GOConfNode *node, gchar const *key, gnm_float val) > { > } >+ > void >-go_conf_set_string (G_GNUC_UNUSED char const *key, G_GNUC_UNUSED char const *str) >+go_conf_set_string (GOConfNode *node, gchar const *key, char const *str) > { > } >+ > void >-go_conf_set_str_list (G_GNUC_UNUSED char const *key, G_GNUC_UNUSED GSList *list) >+go_conf_set_str_list (GOConfNode *node, gchar const *key, GSList *list) > { > } >+ > gboolean >-go_conf_get_bool (char const *key) >+go_conf_get_bool (GOConfNode *node, gchar const *key) > { > return FALSE; > } > >-int >-go_conf_get_int (char const *key) >+gint >+go_conf_get_int (GOConfNode *node, gchar const *key) > { > return 0; > } > >-double >-go_conf_get_double (char const *key) >+gdouble >+go_conf_get_double (GOConfNode *node, gchar const *key) > { > return 0.; > } > >-char * >-go_conf_get_string (char const *key) >+gchar * >+go_conf_get_string (GOConfNode *node, gchar const *key) > { > return g_strdup (""); > } > > GSList * >-go_conf_get_str_list (char const *key) >+go_conf_get_str_list (GOConfNode *node, gchar const *key) > { > return NULL; > } > > gboolean >-go_conf_load_bool (G_GNUC_UNUSED char const *key, >+go_conf_load_bool (GOConfNode *node, gchar const *key, > gboolean default_val) > { > return default_val; > } > int >-go_conf_load_int (G_GNUC_UNUSED char const *key, >- G_GNUC_UNUSED int minima, G_GNUC_UNUSED int maxima, >- int default_val) >+go_conf_load_int (GOConfNode *node, gchar const *key, >+ gint minima, gint maxima, >+ gint default_val) > { > return default_val; > } > > double >-go_conf_load_double (G_GNUC_UNUSED char const *key, >- G_GNUC_UNUSED double minima, G_GNUC_UNUSED double maxima, >- double default_val) >-{ >- return default_val; >+go_conf_load_double (GOConfNode *node, gchar const *key, >+ gdouble minima, gdouble maxima, >+ gdouble default_val) >+{ >+ gchar *real_key; >+ gchar *ptr; >+ double val; >+ GError *err = NULL; >+ >+ real_key = go_conf_get_real_key (node, key); >+ ptr = g_key_file_get_value (key_file, DOUBLE_GROUP, real_key, &err); >+ >+ if (err) { >+ val = default_val; >+ g_error_free (err); >+ } else { >+ val = g_ascii_strtod (ptr, NULL); >+ if (val < minima || val > maxima) { >+ val = default_val; > } >+} >+ >+ g_free(ptr); >+ g_free (real_key); >+ return val; >+} >+ > char * >-go_conf_load_string (G_GNUC_UNUSED char const *key) >+go_conf_load_string (GOConfNode *node, gchar const *key) > { >- return NULL; >+ gchar *real_key; >+ char *val = NULL; >+ GError *err = NULL; >+ >+ real_key = go_conf_get_real_key (node, key); >+ val = g_key_file_get_string (key_file, STRING_GROUP, real_key, &err); >+ >+ if (err) { >+#if 0 >+ g_warning (err->message); >+#endif >+ g_error_free (err); > } >+ >+ g_free (real_key); >+ return val; >+} >+ > GSList * >-go_conf_load_str_list (G_GNUC_UNUSED char const *key) >+go_conf_load_str_list (GOConfNode *node, gchar const *key) > { >- return NULL; >+ return go_conf_get_str_list (node, key); > } >+ > char * >-go_conf_get_short_desc (char const *key) >+go_conf_get_short_desc (GOConfNode *node, gchar const *key) > { > return NULL; > } >-char * >-go_conf_get_long_desc (char const *key) >+ >+gchar * >+go_conf_get_long_desc (GOConfNode *node, gchar const *key) > { > return NULL; > } > > GType >-go_conf_get_type (char const *key) >+go_conf_get_type (GOConfNode *node, gchar const *key) > { >- return G_TYPE_NONE; >+ gchar **groups; >+ gchar *real_key; >+ GType type = G_TYPE_NONE; >+ int i, ng; >+ >+ real_key = go_conf_get_real_key (node, key); >+ groups = g_key_file_get_groups (key_file, &ng); >+ >+ if (groups != NULL) { >+ for (i = 0; i < ng; i++) { >+ if (g_key_file_has_key (key_file, groups[i], real_key, NULL)) { >+ if (!g_ascii_strcasecmp (groups[i], BOOL_GROUP)) { >+ type = G_TYPE_BOOLEAN; >+ } else if (!g_ascii_strcasecmp (groups[i], INT_GROUP)) { >+ type = G_TYPE_INT; >+ } else if (!g_ascii_strcasecmp (groups[i], DOUBLE_GROUP)) { >+ type = G_TYPE_DOUBLE; >+ } else if (!g_ascii_strcasecmp (groups[i], STRING_GROUP)) { >+ type = G_TYPE_STRING; >+ } else if (!g_ascii_strcasecmp (groups[i], STRLIST_GROUP)) { >+ type = G_TYPE_STRING; >+ } >+ break; >+ } >+ } >+ g_strfreev (groups); > } > >-char * >-go_conf_get_value_as_str (char const *key) >+ g_free (real_key); >+ >+ return type; >+} >+ >+gchar * >+go_conf_get_value_as_str (GOConfNode *node, gchar const *key) > { >- return g_strdup (""); >+ gchar *val = NULL; >+ gchar *real_key = go_conf_get_real_key (node, key); >+ val = g_key_file_get_string (key_file, STRING_GROUP, real_key, NULL); >+ g_free (real_key); >+ return val; > } > > gboolean >-go_conf_set_value_from_str (char const *key, char const *val_str) >+go_conf_set_value_from_str (GOConfNode *node, gchar const *key, gchar const *val_str) > { >+ gchar *real_key = go_conf_get_real_key (node, key); >+ g_key_file_set_value (key_file, STRING_GROUP, real_key, val_str); >+ g_free (real_key); > return TRUE; > } > > void >-go_conf_sync (void) >+go_conf_sync (GOConfNode *node) > { > } > >@@ -495,7 +1256,7 @@ go_conf_remove_monitor (guint monitor_id > } > > guint >-go_conf_add_monitor (char const *key, >+go_conf_add_monitor (GOConfNode *node, gchar const *key, > GOConfMonitorFunc monitor, gpointer data) > { > return 1; >@@ -506,91 +1267,110 @@ go_conf_add_monitor (char const *key, > static void > gnm_conf_init_printer_decoration_font (void) > { >+ GOConfNode *node; > gchar *name; > if (prefs.printer_decoration_font == NULL) > prefs.printer_decoration_font = mstyle_new (); > >- name = go_conf_load_string (PRINTSETUP_GCONF_HF_FONT_NAME); >+ node = go_conf_get_node (root, PRINTSETUP_GCONF_DIR); >+ name = go_conf_load_string (node, PRINTSETUP_GCONF_HF_FONT_NAME); > if (name) { > mstyle_set_font_name (prefs.printer_decoration_font, name); > g_free (name); > } else > mstyle_set_font_name (prefs.printer_decoration_font, DEFAULT_FONT); > mstyle_set_font_size (prefs.printer_decoration_font, >- go_conf_load_double (PRINTSETUP_GCONF_HF_FONT_SIZE, 1., 100., DEFAULT_SIZE)); >+ go_conf_load_double (node, PRINTSETUP_GCONF_HF_FONT_SIZE, 1., 100., DEFAULT_SIZE)); > mstyle_set_font_bold (prefs.printer_decoration_font, >- go_conf_load_bool (PRINTSETUP_GCONF_HF_FONT_BOLD, FALSE)); >+ go_conf_load_bool (node, PRINTSETUP_GCONF_HF_FONT_BOLD, FALSE)); > mstyle_set_font_italic (prefs.printer_decoration_font, >- go_conf_load_bool (PRINTSETUP_GCONF_HF_FONT_ITALIC, FALSE)); >+ go_conf_load_bool (node, PRINTSETUP_GCONF_HF_FONT_ITALIC, FALSE)); >+ go_conf_free_node (node); > } > > static void > gnm_conf_init_essential (void) > { >- prefs.default_font.name = go_conf_load_string (CONF_DEFAULT_FONT_NAME); >+ GOConfNode *node; >+ >+ node = go_conf_get_node (root, CONF_DEFAULT_FONT_DIR); >+ prefs.default_font.name = go_conf_load_string (node, CONF_DEFAULT_FONT_NAME); > if (prefs.default_font.name == NULL) > prefs.default_font.name = g_strdup (DEFAULT_FONT); > prefs.default_font.size = go_conf_load_double ( >- CONF_DEFAULT_FONT_SIZE, 1., 100., DEFAULT_SIZE); >+ node, CONF_DEFAULT_FONT_SIZE, 1., 100., DEFAULT_SIZE); > prefs.default_font.is_bold = go_conf_load_bool ( >- CONF_DEFAULT_FONT_BOLD, FALSE); >+ node, CONF_DEFAULT_FONT_BOLD, FALSE); > prefs.default_font.is_italic = go_conf_load_bool ( >- CONF_DEFAULT_FONT_ITALIC, FALSE); >+ node, CONF_DEFAULT_FONT_ITALIC, FALSE); >+ go_conf_free_node (node); > >+ node = go_conf_get_node (root, GNM_CONF_FILE_DIR); > prefs.file_history_max = go_conf_load_int ( >- GNM_CONF_FILE_HISTORY_N, 0, 20, 4); >- prefs.file_history_files = go_conf_load_str_list (GNM_CONF_FILE_HISTORY_FILES); >- prefs.plugin_file_states = go_conf_load_str_list (PLUGIN_GCONF_FILE_STATES); >- prefs.plugin_extra_dirs = go_conf_load_str_list (PLUGIN_GCONF_EXTRA_DIRS); >- prefs.active_plugins = go_conf_load_str_list (PLUGIN_GCONF_ACTIVE); >+ node, GNM_CONF_FILE_HISTORY_N, 0, 20, 4); >+ prefs.file_history_files = go_conf_load_str_list (node, GNM_CONF_FILE_HISTORY_FILES); >+ go_conf_free_node (node); >+ >+ node = go_conf_get_node (root, PLUGIN_GCONF_DIR); >+ prefs.plugin_file_states = go_conf_load_str_list (node, PLUGIN_GCONF_FILE_STATES); >+ prefs.plugin_extra_dirs = go_conf_load_str_list (node, PLUGIN_GCONF_EXTRA_DIRS); >+ prefs.active_plugins = go_conf_load_str_list (node, PLUGIN_GCONF_ACTIVE); > prefs.activate_new_plugins = go_conf_load_bool ( >- PLUGIN_GCONF_ACTIVATE_NEW, TRUE); >+ node, PLUGIN_GCONF_ACTIVATE_NEW, TRUE); >+ go_conf_free_node (node); > >+ node = go_conf_get_node (root, GNM_CONF_GUI_DIR); > prefs.horizontal_dpi = go_conf_load_double ( >- GNM_CONF_GUI_RES_H, 10., 1000., 96.); >+ node, GNM_CONF_GUI_RES_H, 10., 1000., 96.); > prefs.vertical_dpi = go_conf_load_double ( >- GNM_CONF_GUI_RES_V, 10., 1000., 96.); >+ node, GNM_CONF_GUI_RES_V, 10., 1000., 96.); > prefs.initial_sheet_number = go_conf_load_int ( >- GNM_CONF_WORKBOOK_NSHEETS, 1, 64, 3); >+ root, GNM_CONF_WORKBOOK_NSHEETS, 1, 64, 3); > prefs.horizontal_window_fraction = go_conf_load_double ( >- GNM_CONF_GUI_WINDOW_X, .1, 1., .6); >+ node, GNM_CONF_GUI_WINDOW_X, .1, 1., .6); > prefs.vertical_window_fraction = go_conf_load_double ( >- GNM_CONF_GUI_WINDOW_Y, .1, 1., .6); >+ node, GNM_CONF_GUI_WINDOW_Y, .1, 1., .6); > prefs.zoom = go_conf_load_double ( >- GNM_CONF_GUI_ZOOM, .1, 5., 1.); >+ node, GNM_CONF_GUI_ZOOM, .1, 5., 1.); >+ prefs.auto_complete = go_conf_load_bool ( >+ node, GNM_CONF_GUI_ED_AUTOCOMPLETE, TRUE); >+ prefs.live_scrolling = go_conf_load_bool ( >+ node, GNM_CONF_GUI_ED_LIVESCROLLING, TRUE); >+ go_conf_free_node (node); > > /* Unfortunately we need the printing stuff in essentials since the */ > /* first pi is created for the new sheet before the idle loop has a */ > /* chance to run */ >- prefs.printer_config = go_conf_load_string (PRINTSETUP_GCONF_PRINTER_CONFIG); >+ node = go_conf_get_node (root, PRINTSETUP_GCONF_DIR); >+ prefs.printer_config = go_conf_load_string (node, PRINTSETUP_GCONF_PRINTER_CONFIG); > prefs.print_center_horizontally = go_conf_load_bool >- (PRINTSETUP_GCONF_CENTER_HORIZONTALLY, FALSE); >+ (node, PRINTSETUP_GCONF_CENTER_HORIZONTALLY, FALSE); > prefs.print_center_vertically = go_conf_load_bool >- (PRINTSETUP_GCONF_CENTER_VERTICALLY, FALSE); >+ (node, PRINTSETUP_GCONF_CENTER_VERTICALLY, FALSE); > prefs.print_grid_lines = go_conf_load_bool >- (PRINTSETUP_GCONF_PRINT_GRID_LINES, FALSE); >+ (node, PRINTSETUP_GCONF_PRINT_GRID_LINES, FALSE); > prefs.print_even_if_only_styles = go_conf_load_bool >- (PRINTSETUP_GCONF_EVEN_IF_ONLY_STYLES, FALSE); >+ (node, PRINTSETUP_GCONF_EVEN_IF_ONLY_STYLES, FALSE); > prefs.print_black_and_white = go_conf_load_bool >- (PRINTSETUP_GCONF_PRINT_BLACK_AND_WHITE, FALSE); >+ (node, PRINTSETUP_GCONF_PRINT_BLACK_AND_WHITE, FALSE); > prefs.print_titles = go_conf_load_bool >- (PRINTSETUP_GCONF_PRINT_TITLES, FALSE); >+ (node, PRINTSETUP_GCONF_PRINT_TITLES, FALSE); > prefs.print_order_right_then_down = go_conf_load_bool >- (PRINTSETUP_GCONF_RIGHT_THEN_DOWN, FALSE); >+ (node, PRINTSETUP_GCONF_RIGHT_THEN_DOWN, FALSE); > prefs.print_scale_percentage = go_conf_load_bool >- (PRINTSETUP_GCONF_SCALE_PERCENTAGE, TRUE); >+ (node, PRINTSETUP_GCONF_SCALE_PERCENTAGE, TRUE); > prefs.print_scale_percentage_value = go_conf_load_double >- (PRINTSETUP_GCONF_SCALE_PERCENTAGE_VALUE, 1, 500, 100); >+ (node, PRINTSETUP_GCONF_SCALE_PERCENTAGE_VALUE, 1, 500, 100); > prefs.print_scale_width = go_conf_load_int >- (PRINTSETUP_GCONF_SCALE_WIDTH, 0, 100, 1); >+ (node, PRINTSETUP_GCONF_SCALE_WIDTH, 0, 100, 1); > prefs.print_scale_height = go_conf_load_int >- (PRINTSETUP_GCONF_SCALE_HEIGHT, 0, 100, 1); >- prefs.print_repeat_top = go_conf_load_string (PRINTSETUP_GCONF_REPEAT_TOP); >- prefs.print_repeat_left = go_conf_load_string (PRINTSETUP_GCONF_REPEAT_LEFT); >+ (node, PRINTSETUP_GCONF_SCALE_HEIGHT, 0, 100, 1); >+ prefs.print_repeat_top = go_conf_load_string (node, PRINTSETUP_GCONF_REPEAT_TOP); >+ prefs.print_repeat_left = go_conf_load_string (node, PRINTSETUP_GCONF_REPEAT_LEFT); > prefs.print_tb_margins.top.points = go_conf_load_double >- (PRINTSETUP_GCONF_MARGIN_TOP, 0.0, 10000.0, 120.0); >+ (node, PRINTSETUP_GCONF_MARGIN_TOP, 0.0, 10000.0, 120.0); > prefs.print_tb_margins.bottom.points = go_conf_load_double >- (PRINTSETUP_GCONF_MARGIN_BOTTOM, 0.0, 10000.0, 120.0); >+ (node, PRINTSETUP_GCONF_MARGIN_BOTTOM, 0.0, 10000.0, 120.0); > { > /* Note: the desired display unit is stored in the */ > /* printer config. So we are never using this field */ >@@ -602,71 +1382,86 @@ gnm_conf_init_essential (void) > = prefs.print_tb_margins.top.desired_display; > } > prefs.print_all_sheets = go_conf_load_bool ( >- PRINTSETUP_GCONF_ALL_SHEETS, TRUE); >- prefs.printer_header = go_conf_load_str_list (PRINTSETUP_GCONF_HEADER); >- prefs.printer_footer = go_conf_load_str_list (PRINTSETUP_GCONF_FOOTER); >- prefs.printer_header_formats_left = go_conf_load_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_LEFT); >- prefs.printer_header_formats_middle = go_conf_load_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_MIDDLE); >- prefs.printer_header_formats_right = go_conf_load_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_RIGHT); >- >- prefs.auto_complete = go_conf_load_bool (GNM_CONF_GUI_ED_AUTOCOMPLETE, TRUE); >- prefs.live_scrolling = go_conf_load_bool (GNM_CONF_GUI_ED_LIVESCROLLING, TRUE); >+ node, PRINTSETUP_GCONF_ALL_SHEETS, TRUE); >+ prefs.printer_header = go_conf_load_str_list (node, PRINTSETUP_GCONF_HEADER); >+ prefs.printer_footer = go_conf_load_str_list (node, PRINTSETUP_GCONF_FOOTER); >+ prefs.printer_header_formats_left = go_conf_load_str_list (node, PRINTSETUP_GCONF_HEADER_FORMAT_LEFT); >+ prefs.printer_header_formats_middle = go_conf_load_str_list (node, PRINTSETUP_GCONF_HEADER_FORMAT_MIDDLE); >+ prefs.printer_header_formats_right = go_conf_load_str_list (node, PRINTSETUP_GCONF_HEADER_FORMAT_RIGHT); >+ go_conf_free_node (node); > } > > static gboolean > gnm_conf_init_extras (void) > { > char *tmp; >+ GOConfNode *node; > >+ node = go_conf_get_node (root, FUNCTION_SELECT_GCONF_DIR); > prefs.num_of_recent_funcs = go_conf_load_int ( >- FUNCTION_SELECT_GCONF_NUM_OF_RECENT, 0, 40, 10); >- prefs.recent_funcs = go_conf_load_str_list (FUNCTION_SELECT_GCONF_RECENT); >+ node, FUNCTION_SELECT_GCONF_NUM_OF_RECENT, 0, 40, 10); >+ prefs.recent_funcs = go_conf_load_str_list (node, FUNCTION_SELECT_GCONF_RECENT); >+ go_conf_free_node (node); > >+ node = go_conf_get_node (root, GNM_CONF_GUI_DIR); > prefs.transition_keys = go_conf_load_bool ( >- GNM_CONF_GUI_ED_TRANSITION_KEYS, FALSE); >+ node, GNM_CONF_GUI_ED_TRANSITION_KEYS, FALSE); > prefs.recalc_lag = go_conf_load_int ( >- GNM_CONF_GUI_ED_RECALC_LAG, -5000, 5000, 200); >+ node, GNM_CONF_GUI_ED_RECALC_LAG, -5000, 5000, 200); >+ go_conf_free_node (node); >+ >+ node = go_conf_get_node (root, GNM_CONF_UNDO_DIR); > prefs.show_sheet_name = go_conf_load_bool ( >- GNM_CONF_UNDO_SHOW_SHEET_NAME, TRUE); >+ node, GNM_CONF_UNDO_SHOW_SHEET_NAME, TRUE); > prefs.max_descriptor_width = go_conf_load_int ( >- GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH, 5, 256, 15); >+ node, GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH, 5, 256, 15); > prefs.undo_size = go_conf_load_int ( >- GNM_CONF_UNDO_SIZE, 1, 1000000, 100000); >+ node, GNM_CONF_UNDO_SIZE, 1, 1000000, 100000); > prefs.undo_max_number = go_conf_load_int ( >- GNM_CONF_UNDO_MAXNUM, 0, 10000, 100); >+ node, GNM_CONF_UNDO_MAXNUM, 0, 10000, 100); >+ go_conf_free_node (node); > >- prefs.autoformat.extra_dirs = go_conf_load_str_list (AUTOFORMAT_GCONF_EXTRA_DIRS); >- tmp = go_conf_load_string (AUTOFORMAT_GCONF_SYS_DIR); >+ node = go_conf_get_node (root, AUTOFORMAT_GCONF_DIR); >+ prefs.autoformat.extra_dirs = go_conf_load_str_list (node, AUTOFORMAT_GCONF_EXTRA_DIRS); >+ tmp = go_conf_load_string (node, AUTOFORMAT_GCONF_SYS_DIR); > if (tmp == NULL) > tmp = g_strdup ("autoformat-templates"); > prefs.autoformat.sys_dir = gnm_sys_data_dir (tmp); > g_free (tmp); >- tmp = go_conf_load_string (AUTOFORMAT_GCONF_USR_DIR); >+ tmp = go_conf_load_string (node, AUTOFORMAT_GCONF_USR_DIR); > if (tmp == NULL) > tmp = g_strdup ("autoformat-templates"); > prefs.autoformat.usr_dir = gnm_usr_dir (tmp); > g_free (tmp); >+ go_conf_free_node (node); > > prefs.xml_compression_level = go_conf_load_int ( >- GNM_CONF_XML_COMPRESSION, 0, 9, 9); >+ root, GNM_CONF_XML_COMPRESSION, 0, 9, 9); >+ >+ node = go_conf_get_node (root, GNM_CONF_FILE_DIR); > prefs.file_overwrite_default_answer = go_conf_load_bool ( >- GNM_CONF_FILE_OVERWRITE_DEFAULT, FALSE); >+ node, GNM_CONF_FILE_OVERWRITE_DEFAULT, FALSE); > prefs.file_ask_single_sheet_save = go_conf_load_bool ( >- GNM_CONF_FILE_SINGLE_SHEET_SAVE, TRUE); >+ node, GNM_CONF_FILE_SINGLE_SHEET_SAVE, TRUE); >+ go_conf_free_node (node); >+ >+ node = go_conf_get_node (root, GNM_CONF_SORT_DIR); > prefs.sort_default_by_case = go_conf_load_bool ( >- GNM_CONF_SORT_DEFAULT_BY_CASE, FALSE); >+ node, GNM_CONF_SORT_DEFAULT_BY_CASE, FALSE); > prefs.sort_default_retain_formats = go_conf_load_bool ( >- GNM_CONF_SORT_DEFAULT_RETAIN_FORM, TRUE); >+ node, GNM_CONF_SORT_DEFAULT_RETAIN_FORM, TRUE); > prefs.sort_default_ascending = go_conf_load_bool ( >- GNM_CONF_SORT_DEFAULT_ASCENDING, TRUE); >+ node, GNM_CONF_SORT_DEFAULT_ASCENDING, TRUE); > prefs.sort_max_initial_clauses = go_conf_load_int ( >- GNM_CONF_SORT_DIALOG_MAX_INITIAL, 0, 256, 10); >+ node, GNM_CONF_SORT_DIALOG_MAX_INITIAL, 0, 256, 10); >+ go_conf_free_node (node); >+ > prefs.unfocused_range_selection = go_conf_load_bool ( >- DIALOGS_GCONF_UNFOCUSED_RS, TRUE); >+ root, DIALOGS_GCONF_DIR "/" DIALOGS_GCONF_UNFOCUSED_RS, TRUE); > prefs.prefer_clipboard_selection = go_conf_load_bool ( >- GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD, TRUE); >+ root, GNM_CONF_CUTANDPASTE_DIR "/" GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD, TRUE); > prefs.latex_use_utf8 = go_conf_load_bool ( >- PLUGIN_GCONF_LATEX_USE_UTF8, TRUE); >+ root, PLUGIN_GCONF_LATEX "/" PLUGIN_GCONF_LATEX_USE_UTF8, TRUE); > > gnm_conf_init_printer_decoration_font (); > >@@ -681,6 +1476,8 @@ gnm_conf_init_extras (void) > void > gnm_conf_init (gboolean fast) > { >+ go_conf_init (); >+ root = go_conf_get_node (NULL, GNM_CONF_DIR); > gnm_conf_init_essential (); > if (fast) > g_timeout_add (1000, (GSourceFunc) gnm_conf_init_extras, NULL); >@@ -691,15 +1488,18 @@ gnm_conf_init (gboolean fast) > void > gnm_conf_shutdown (void) > { >+ if (prefs.printer_decoration_font) { > mstyle_unref (prefs.printer_decoration_font); > prefs.printer_decoration_font = NULL; >-#ifdef WITH_GNOME >- if (gconf_client) { >- gconf_client_remove_dir (gconf_client, "/apps/gnumeric", NULL); >- g_object_unref (G_OBJECT (gconf_client)); >- gconf_client = NULL; > } >-#endif >+ go_conf_free_node (root); >+ go_conf_shutdown (); >+} >+ >+GOConfNode * >+gnm_conf_get_root (void) >+{ >+ return root; > } > > void >@@ -713,7 +1513,7 @@ gnm_gconf_set_plugin_file_states (GSList > g_slist_free ((GSList *)prefs.plugin_file_states); > prefs.plugin_file_states = list; > >- go_conf_set_str_list (PLUGIN_GCONF_FILE_STATES, list); >+ go_conf_set_str_list (root, PLUGIN_GCONF_DIR "/" PLUGIN_GCONF_FILE_STATES, list); > } > > void >@@ -727,25 +1527,25 @@ gnm_gconf_set_plugin_extra_dirs (GSList > g_slist_free ((GSList *)prefs.plugin_extra_dirs); > prefs.plugin_extra_dirs = list; > >- go_conf_set_str_list (PLUGIN_GCONF_EXTRA_DIRS, list); >+ go_conf_set_str_list (root, PLUGIN_GCONF_DIR "/" PLUGIN_GCONF_EXTRA_DIRS, list); > } > > void > gnm_gconf_set_active_plugins (GSList *list) > { >- go_conf_set_str_list (PLUGIN_GCONF_ACTIVE, list); >+ go_conf_set_str_list (root, PLUGIN_GCONF_DIR "/" PLUGIN_GCONF_ACTIVE, list); > } > > void > gnm_gconf_set_activate_new_plugins (gboolean val) > { >- go_conf_set_bool (PLUGIN_GCONF_ACTIVATE_NEW, val); >+ go_conf_set_bool (root, PLUGIN_GCONF_DIR "/" PLUGIN_GCONF_ACTIVATE_NEW, val); > } > > void > gnm_gconf_set_recent_funcs (GSList *list) > { >- go_conf_set_str_list (FUNCTION_SELECT_GCONF_RECENT, list); >+ go_conf_set_str_list (root, FUNCTION_SELECT_GCONF_DIR "/" FUNCTION_SELECT_GCONF_RECENT, list); > > /* the const_casts are ok, the const in the header is just to keep > * people for doing stupid things */ >@@ -761,7 +1561,7 @@ gnm_gconf_set_num_recent_functions (gint > if (val < 0) > val = 0; > prefs.num_of_recent_funcs = val; >- go_conf_set_int ( FUNCTION_SELECT_GCONF_NUM_OF_RECENT, val); >+ go_conf_set_int (root, FUNCTION_SELECT_GCONF_DIR "/" FUNCTION_SELECT_GCONF_NUM_OF_RECENT, val); > } > > void >@@ -774,7 +1574,7 @@ gnm_gconf_set_file_history_files (GSList > g_slist_foreach ((GSList *)prefs.file_history_files, (GFunc)g_free, NULL); > g_slist_free ((GSList *)prefs.file_history_files); > prefs.file_history_files = list; >- go_conf_set_str_list (GNM_CONF_FILE_HISTORY_FILES, list); >+ go_conf_set_str_list (root, GNM_CONF_FILE_DIR "/" GNM_CONF_FILE_HISTORY_FILES, list); > } > > void >@@ -783,7 +1583,7 @@ gnm_gconf_set_file_history_number (gint > if (val < 0) > val = 0; > prefs.file_history_max = val; >- go_conf_set_int (GNM_CONF_FILE_HISTORY_N, val); >+ go_conf_set_int (root, GNM_CONF_FILE_DIR "/" GNM_CONF_FILE_HISTORY_N, val); > } > > >@@ -793,7 +1593,7 @@ gnm_gconf_set_undo_size (gint val) > if (val < 1) > val = 1; > prefs.undo_size = val; >- go_conf_set_int (GNM_CONF_UNDO_SIZE, val); >+ go_conf_set_int (root, GNM_CONF_UNDO_DIR "/" GNM_CONF_UNDO_SIZE, val); > } > > >@@ -803,33 +1603,35 @@ gnm_gconf_set_undo_max_number (gint val) > if (val < 1) > val = 1; > prefs.undo_max_number = val; >- go_conf_set_int (GNM_CONF_UNDO_MAXNUM, val); >+ go_conf_set_int (root, GNM_CONF_UNDO_DIR "/" GNM_CONF_UNDO_MAXNUM, val); > } > > void > gnm_gconf_set_autoformat_sys_dirs (char const * string) > { >- go_conf_set_string (AUTOFORMAT_GCONF_SYS_DIR, string); >+ go_conf_set_string (root, AUTOFORMAT_GCONF_DIR "/" AUTOFORMAT_GCONF_SYS_DIR, string); > } > > void > gnm_gconf_set_autoformat_usr_dirs (char const * string) > { >- go_conf_set_string (AUTOFORMAT_GCONF_USR_DIR, string); >+ go_conf_set_string (root, AUTOFORMAT_GCONF_DIR "/" AUTOFORMAT_GCONF_USR_DIR, string); > } > > void > gnm_gconf_set_all_sheets (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_ALL_SHEETS, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_ALL_SHEETS, val); > } > > void >-gnm_gconf_set_printer_config (gchar *str) >+gnm_gconf_set_printer_config (gchar const *str) > { >- go_conf_set_string (PRINTSETUP_GCONF_PRINTER_CONFIG, str); >+ go_conf_set_string (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_PRINTER_CONFIG, str); >+ if (prefs.printer_config != str) { > g_free (prefs.printer_config); >- prefs.printer_config = str; >+ prefs.printer_config = g_strdup (str); >+ } > } > > void >@@ -840,7 +1642,7 @@ gnm_gconf_set_printer_header (gchar cons > list = g_slist_prepend (list, g_strdup (right)); > list = g_slist_prepend (list, g_strdup (middle)); > list = g_slist_prepend (list, g_strdup (left)); >- go_conf_set_str_list (PRINTSETUP_GCONF_HEADER, list); >+ go_conf_set_str_list (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HEADER, list); > gnm_slist_free_custom ((GSList *)prefs.printer_header, g_free); > prefs.printer_header = list; > } >@@ -853,7 +1655,7 @@ gnm_gconf_set_printer_footer (gchar cons > list = g_slist_prepend (list, g_strdup (right)); > list = g_slist_prepend (list, g_strdup (middle)); > list = g_slist_prepend (list, g_strdup (left)); >- go_conf_set_str_list (PRINTSETUP_GCONF_FOOTER, list); >+ go_conf_set_str_list (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_FOOTER, list); > gnm_slist_free_custom ((GSList *)prefs.printer_footer, g_free); > prefs.printer_footer = list; > } >@@ -861,55 +1663,57 @@ gnm_gconf_set_printer_footer (gchar cons > void > gnm_gconf_set_print_center_horizontally (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_CENTER_HORIZONTALLY, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_CENTER_HORIZONTALLY, val); > } > > void > gnm_gconf_set_print_center_vertically (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_CENTER_VERTICALLY, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_CENTER_VERTICALLY, val); > } > > void > gnm_gconf_set_print_grid_lines (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_PRINT_GRID_LINES, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_PRINT_GRID_LINES, val); > } > > void > gnm_gconf_set_print_even_if_only_styles (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_EVEN_IF_ONLY_STYLES, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_EVEN_IF_ONLY_STYLES, val); > } > > void > gnm_gconf_set_print_black_and_white (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_PRINT_BLACK_AND_WHITE, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_PRINT_BLACK_AND_WHITE, val); > } > > void > gnm_gconf_set_print_titles (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_PRINT_TITLES, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_PRINT_TITLES, val); > } > > void > gnm_gconf_set_print_order_right_then_down (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_RIGHT_THEN_DOWN, val); >+ go_conf_set_bool (root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_RIGHT_THEN_DOWN, val); > } > > void > gnm_gconf_set_print_scale_percentage (gboolean val) > { >- go_conf_set_bool (PRINTSETUP_GCONF_SCALE_PERCENTAGE, val); >+ go_conf_set_bool ( >+ root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_SCALE_PERCENTAGE, val); > } > > void > gnm_gconf_set_print_scale_percentage_value (gnm_float val) > { >- go_conf_set_double (PRINTSETUP_GCONF_SCALE_PERCENTAGE_VALUE, val); >+ go_conf_set_double ( >+ root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_SCALE_PERCENTAGE_VALUE, val); > } > > void >@@ -917,19 +1721,24 @@ gnm_gconf_set_print_tb_margins (PrintMar > { > /* We are not saving the GnomePrintUnits since they are */ > /* duplicated in the gnomeprintconfig */ >- go_conf_set_double (PRINTSETUP_GCONF_MARGIN_TOP, pm->top.points); >- go_conf_set_double (PRINTSETUP_GCONF_MARGIN_BOTTOM, pm->bottom.points); >+ go_conf_set_double ( >+ root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_MARGIN_TOP, pm->top.points); >+ go_conf_set_double ( >+ root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_MARGIN_BOTTOM, pm->bottom.points); > } > > void > gnm_gconf_set_print_header_formats (GSList *left, GSList *middle, > GSList *right) > { >- go_conf_set_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_LEFT, left); >+ go_conf_set_str_list ( >+ root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HEADER_FORMAT_LEFT, left); > gnm_slist_free_custom (left, g_free); >- go_conf_set_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_MIDDLE, middle); >+ go_conf_set_str_list ( >+ root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HEADER_FORMAT_MIDDLE, middle); > gnm_slist_free_custom (middle, g_free); >- go_conf_set_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_RIGHT, right); >+ go_conf_set_str_list ( >+ root, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HEADER_FORMAT_RIGHT, right); > gnm_slist_free_custom (right, g_free); > } > >@@ -937,60 +1746,65 @@ void > gnm_gconf_set_gui_window_x (gnm_float val) > { > prefs.horizontal_window_fraction = val; >- go_conf_set_double (GNM_CONF_GUI_WINDOW_X, val); >+ go_conf_set_double ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_WINDOW_X, val); > } > > void > gnm_gconf_set_gui_window_y (gnm_float val) > { > prefs.vertical_window_fraction = val; >- go_conf_set_double (GNM_CONF_GUI_WINDOW_Y, val); >+ go_conf_set_double ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_WINDOW_Y, val); > } > > void > gnm_gconf_set_gui_zoom (gnm_float val) > { > prefs.zoom = val; >- go_conf_set_double (GNM_CONF_GUI_WINDOW_Y, val); >+ go_conf_set_double ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_WINDOW_Y, val); > } > > void > gnm_gconf_set_default_font_size (gnm_float val) > { > prefs.default_font.size = val; >- go_conf_set_double (GNM_CONF_FONT_SIZE, val); >+ go_conf_set_double ( >+ root, GNM_CONF_FONT_DIR "/" GNM_CONF_FONT_SIZE, val); > } > > void > gnm_gconf_set_default_font_name (char const *str) > { >- g_return_if_fail (str != NULL); >- >- /* the const_casts are ok, the const in the header is just to keep >- * people for doing stupid things */ >- if (prefs.default_font.name != NULL) >+ go_conf_set_string (root, GNM_CONF_FONT_DIR "/" GNM_CONF_FONT_NAME, str); >+ if (prefs.default_font.name != str) { >+ /* the const in the header is just a safety net */ > g_free ((char *) prefs.default_font.name); > prefs.default_font.name = g_strdup (str); >- go_conf_set_string (GNM_CONF_FONT_NAME, str); >+ } > } > > void > gnm_gconf_set_default_font_bold (gboolean val) > { > prefs.default_font.is_bold = val; >- go_conf_set_bool (GNM_CONF_FONT_BOLD, val); >+ go_conf_set_bool ( >+ root, GNM_CONF_FONT_DIR "/" GNM_CONF_FONT_BOLD, val); > } > > void > gnm_gconf_set_default_font_italic (gboolean val) > { > prefs.default_font.is_italic = val; >- go_conf_set_bool (GNM_CONF_FONT_ITALIC, val); >+ go_conf_set_bool ( >+ root, GNM_CONF_FONT_DIR "/" GNM_CONF_FONT_ITALIC, val); > } > > void > gnm_gconf_set_hf_font (GnmStyle const *mstyle) > { >+ GOConfNode *node; > GnmStyle *old_style = (prefs.printer_decoration_font != NULL) ? > prefs.printer_decoration_font : > mstyle_new_default (); >@@ -998,18 +1812,20 @@ gnm_gconf_set_hf_font (GnmStyle const *m > prefs.printer_decoration_font = mstyle_copy_merge (old_style, mstyle); > mstyle_unref (old_style); > >+ node = go_conf_get_node (root, PRINTSETUP_GCONF_DIR); > if (mstyle_is_element_set (mstyle, MSTYLE_FONT_SIZE)) >- go_conf_set_double (PRINTSETUP_GCONF_HF_FONT_SIZE, >+ go_conf_set_double (node, PRINTSETUP_GCONF_HF_FONT_SIZE, > mstyle_get_font_size (mstyle)); > if (mstyle_is_element_set (mstyle, MSTYLE_FONT_NAME)) >- go_conf_set_string (PRINTSETUP_GCONF_HF_FONT_NAME, >+ go_conf_set_string (node, PRINTSETUP_GCONF_HF_FONT_NAME, > mstyle_get_font_name (mstyle)); > if (mstyle_is_element_set (mstyle, MSTYLE_FONT_BOLD)) >- go_conf_set_bool (PRINTSETUP_GCONF_HF_FONT_BOLD, >+ go_conf_set_bool (node, PRINTSETUP_GCONF_HF_FONT_BOLD, > mstyle_get_font_bold (mstyle)); > if (mstyle_is_element_set (mstyle, MSTYLE_FONT_ITALIC)) >- go_conf_set_bool (PRINTSETUP_GCONF_HF_FONT_ITALIC, >+ go_conf_set_bool (node, PRINTSETUP_GCONF_HF_FONT_ITALIC, > mstyle_get_font_italic (mstyle)); >+ go_conf_free_node (node); > } > > >@@ -1019,7 +1835,8 @@ gnm_gconf_set_max_descriptor_width (gint > if (val < 1) > val = 1; > prefs.max_descriptor_width = val; >- go_conf_set_int (GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH, val); >+ go_conf_set_int ( >+ root, GNM_CONF_UNDO_DIR "/" GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH, val); > } > > void >@@ -1028,7 +1845,8 @@ gnm_gconf_set_sort_dialog_max_initial (g > if (val < 1) > val = 1; > prefs.sort_max_initial_clauses = val; >- go_conf_set_int (GNM_CONF_SORT_DIALOG_MAX_INITIAL, val); >+ go_conf_set_int ( >+ root, GNM_CONF_SORT_DIR "/" GNM_CONF_SORT_DIALOG_MAX_INITIAL, val); > } > > void >@@ -1037,7 +1855,7 @@ gnm_gconf_set_workbook_nsheets (gint val > if (val < 1) > val = 1; > prefs.initial_sheet_number = val; >- go_conf_set_int (GNM_CONF_WORKBOOK_NSHEETS, val); >+ go_conf_set_int (root, GNM_CONF_WORKBOOK_NSHEETS, val); > } > > void >@@ -1046,79 +1864,79 @@ gnm_gconf_set_xml_compression (gint val) > if (val < 0) > val = 0; > prefs.xml_compression_level = val; >- go_conf_set_int (GNM_CONF_XML_COMPRESSION, val); >+ go_conf_set_int (root, GNM_CONF_XML_COMPRESSION, val); > } > > void > gnm_gconf_set_show_sheet_name (gboolean val) > { > prefs.show_sheet_name = val; >- go_conf_set_bool( GNM_CONF_UNDO_SHOW_SHEET_NAME, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_UNDO_DIR "/" GNM_CONF_UNDO_SHOW_SHEET_NAME,val != FALSE); > } > > void > gnm_gconf_set_latex_use_utf8 (gboolean val) > { > prefs.latex_use_utf8 = val; >- go_conf_set_bool( PLUGIN_GCONF_LATEX_USE_UTF8, >- val != FALSE); >+ go_conf_set_bool ( >+ root, PLUGIN_GCONF_LATEX "/" PLUGIN_GCONF_LATEX_USE_UTF8, val != FALSE); > } > > void > gnm_gconf_set_sort_retain_form (gboolean val) > { > prefs.sort_default_retain_formats = val; >- go_conf_set_bool( GNM_CONF_SORT_DEFAULT_RETAIN_FORM, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_SORT_DIR "/" GNM_CONF_SORT_DEFAULT_RETAIN_FORM, val != FALSE); > } > > void > gnm_gconf_set_sort_by_case (gboolean val) > { > prefs.sort_default_by_case = val; >- go_conf_set_bool( GNM_CONF_SORT_DEFAULT_BY_CASE, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_SORT_DIR "/" GNM_CONF_SORT_DEFAULT_BY_CASE, val != FALSE); > } > > void > gnm_gconf_set_sort_ascending (gboolean val) > { > prefs.sort_default_ascending = val; >- go_conf_set_bool( GNM_CONF_SORT_DEFAULT_ASCENDING, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_SORT_DIR "/" GNM_CONF_SORT_DEFAULT_ASCENDING, val != FALSE); > } > > void > gnm_gconf_set_gui_transition_keys (gboolean val) > { > prefs.transition_keys = val; >- go_conf_set_bool( GNM_CONF_GUI_ED_TRANSITION_KEYS, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_ED_TRANSITION_KEYS, val != FALSE); > } > > void > gnm_gconf_set_gui_livescrolling (gboolean val) > { > prefs.live_scrolling = val; >- go_conf_set_bool( GNM_CONF_GUI_ED_LIVESCROLLING, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_ED_LIVESCROLLING, val != FALSE); > } > > void > gnm_gconf_set_file_overwrite (gboolean val) > { > prefs.file_overwrite_default_answer = val; >- go_conf_set_bool( GNM_CONF_FILE_OVERWRITE_DEFAULT, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_FILE_DIR "/" GNM_CONF_FILE_OVERWRITE_DEFAULT, val != FALSE); > } > > void > gnm_gconf_set_file_single_sheet_save (gboolean val) > { > prefs.file_ask_single_sheet_save = val; >- go_conf_set_bool( GNM_CONF_FILE_SINGLE_SHEET_SAVE, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_FILE_DIR "/" GNM_CONF_FILE_SINGLE_SHEET_SAVE, val != FALSE); > } > > void >@@ -1129,7 +1947,8 @@ gnm_gconf_set_gui_resolution_h (gnm_floa > if (val > 250) > val = 250; > prefs.horizontal_dpi = val; >- go_conf_set_double (GNM_CONF_GUI_RES_H, val); >+ go_conf_set_double ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_RES_H, val); > } > > void >@@ -1140,30 +1959,30 @@ gnm_gconf_set_gui_resolution_v (gnm_floa > if (val > 250) > val = 250; > prefs.vertical_dpi = val; >- go_conf_set_double (GNM_CONF_GUI_RES_V, val); >+ go_conf_set_double ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_RES_V, val); > } > > void > gnm_gconf_set_unfocused_rs (gboolean val) > { > prefs.unfocused_range_selection = val; >- go_conf_set_bool( DIALOGS_GCONF_UNFOCUSED_RS, >- val != FALSE); >+ go_conf_set_bool ( >+ root, DIALOGS_GCONF_DIR "/" DIALOGS_GCONF_UNFOCUSED_RS, val != FALSE); > } > > void > gnm_gconf_set_autocomplete (gboolean val) > { > prefs.auto_complete = val; >- go_conf_set_bool( GNM_CONF_GUI_ED_AUTOCOMPLETE, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_ED_AUTOCOMPLETE, val != FALSE); > } > > void > gnm_gconf_set_prefer_clipboard (gboolean val) > { > prefs.prefer_clipboard_selection = val; >- go_conf_set_bool( GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD, >- val != FALSE); >+ go_conf_set_bool ( >+ root, GNM_CONF_CUTANDPASTE_DIR "/" GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD, val != FALSE); > } >- >Index: src/gnumeric-gconf.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gnumeric-gconf.h,v >retrieving revision 1.46 >retrieving revision 1.46.2.2 >diff -u -w -p -r1.46 -r1.46.2.2 >--- src/gnumeric-gconf.h 7 Nov 2004 01:02:10 -0000 1.46 >+++ src/gnumeric-gconf.h 9 Apr 2005 08:15:31 -0000 1.46.2.2 >@@ -82,9 +82,12 @@ typedef struct { > } GnmAppPrefs; > extern GnmAppPrefs const *gnm_app_prefs; > >+typedef struct _GOConfNode GOConfNode; >+ > void gnm_conf_init (gboolean fast); > void gnm_conf_shutdown (void); > void gnm_conf_sync (void); >+GOConfNode *gnm_conf_get_root (void); > > /* autocorrect */ > void gnm_gconf_set_autocorrect_init_caps (gboolean val); >@@ -123,7 +126,7 @@ void gnm_gconf_set_file_single_sheet > > /* print-setup & printing */ > void gnm_gconf_set_all_sheets (gboolean val); >-void gnm_gconf_set_printer_config (gchar *str); >+void gnm_gconf_set_printer_config (gchar const *str); > void gnm_gconf_set_printer_header (gchar const *left, gchar const *middle, > gchar const *right); > void gnm_gconf_set_printer_footer (gchar const *left, gchar const *middle, >@@ -180,35 +183,38 @@ void gnm_gconf_set_prefer_clipboard > > /**************************************************************/ > >-char *go_conf_get_short_desc (char const *key); >-char *go_conf_get_long_desc (char const *key); >-GType go_conf_get_type (char const *key); >-char *go_conf_get_value_as_str (char const *key); >-gboolean go_conf_set_value_from_str (char const *key, char const *val_str); >- >-gboolean go_conf_get_bool (char const *key); >-int go_conf_get_int (char const *key); >-double go_conf_get_double (char const *key); >-char *go_conf_get_string (char const *key); >-GSList *go_conf_get_str_list (char const *key); >- >-gboolean go_conf_load_bool (char const *key, gboolean default_val); >-int go_conf_load_int (char const *key, int minima, int maxima, int default_val); >-double go_conf_load_double (char const *key, double minima, double maxima, double default_val); >-char *go_conf_load_string (char const *key); >-GSList *go_conf_load_str_list (char const *key); >- >-void go_conf_set_bool (char const *key, gboolean val); >-void go_conf_set_int (char const *key, gint val); >-void go_conf_set_double (char const *key, gnm_float val); >-void go_conf_set_string (char const *key, char const *str); >-void go_conf_set_str_list (char const *key, GSList *list); >+GOConfNode * go_conf_get_node (GOConfNode *parent, const gchar *key); >+void go_conf_free_node (GOConfNode *node); >+ >+gchar *go_conf_get_short_desc (GOConfNode *node, gchar const *key); >+gchar *go_conf_get_long_desc (GOConfNode *node, gchar const *key); >+GType go_conf_get_type (GOConfNode *node, gchar const *key); >+gchar *go_conf_get_value_as_str (GOConfNode *node, gchar const *key); >+gboolean go_conf_set_value_from_str (GOConfNode *node, gchar const *key, gchar const *val_str); >+ >+gboolean go_conf_get_bool (GOConfNode *node, gchar const *key); >+gint go_conf_get_int (GOConfNode *node, gchar const *key); >+gdouble go_conf_get_double (GOConfNode *node, gchar const *key); >+gchar *go_conf_get_string (GOConfNode *node, gchar const *key); >+GSList *go_conf_get_str_list (GOConfNode *node, gchar const *key); >+ >+gboolean go_conf_load_bool (GOConfNode *node, gchar const *key, gboolean default_val); >+gint go_conf_load_int (GOConfNode *node, gchar const *key, gint minima, gint maxima, gint default_val); >+gdouble go_conf_load_double (GOConfNode *node, gchar const *key, gdouble minima, gdouble maxima, gdouble default_val); >+gchar *go_conf_load_string (GOConfNode *node, gchar const *key); >+GSList *go_conf_load_str_list (GOConfNode *node, gchar const *key); >+ >+void go_conf_set_bool (GOConfNode *node, gchar const *key, gboolean val); >+void go_conf_set_int (GOConfNode *node, gchar const *key, gint val); >+void go_conf_set_double (GOConfNode *node, gchar const *key, gnm_float val); >+void go_conf_set_string (GOConfNode *node, gchar const *key, gchar const *str); >+void go_conf_set_str_list (GOConfNode *node, gchar const *key, GSList *list); > >-void go_conf_sync (void); >+void go_conf_sync (GOConfNode *node); > >-typedef void (*GOConfMonitorFunc) (char const *key, gpointer data); >+typedef void (*GOConfMonitorFunc) (GOConfNode *node, gchar const *key, gpointer data); > void go_conf_remove_monitor (guint monitor_id); >-guint go_conf_add_monitor (char const *key, >+guint go_conf_add_monitor (GOConfNode *node, gchar const *key, > GOConfMonitorFunc monitor, gpointer data); > > #endif /* GNM_CONF_H */ >Index: src/gui-clipboard.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gui-clipboard.c,v >retrieving revision 1.88 >retrieving revision 1.88.2.2 >diff -u -w -p -r1.88 -r1.88.2.2 >--- src/gui-clipboard.c 1 Nov 2004 21:59:05 -0000 1.88 >+++ src/gui-clipboard.c 17 Mar 2005 21:45:48 -0000 1.88.2.2 >@@ -237,7 +237,8 @@ complex_content_received (GtkClipboard * > * if the conversion from the X selection -> a cellregion > * was canceled this may have content sized -1,-1 > */ >- if (content->cols > 0 && content->rows > 0) >+ if ((content->cols > 0 && content->rows > 0) || >+ content->objects != NULL) > cmd_paste_copy (wbc, pt, content); > > /* Release the resources we used */ >Index: src/gui-file.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/gui-file.c,v >retrieving revision 1.111 >retrieving revision 1.111.2.2 >diff -u -w -p -r1.111 -r1.111.2.2 >--- src/gui-file.c 12 Jan 2005 15:54:03 -0000 1.111 >+++ src/gui-file.c 26 Apr 2005 20:32:27 -0000 1.111.2.2 >@@ -660,6 +660,7 @@ gui_file_save_as (WorkbookControlGUI *wb > fsel = GTK_FILE_CHOOSER > (g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG, > "action", GTK_FILE_CHOOSER_ACTION_SAVE, >+ "local-only", FALSE, > "title", _("Select a file"), > NULL)); > gtk_dialog_add_buttons (GTK_DIALOG (fsel), >@@ -727,7 +728,7 @@ gui_file_save_as (WorkbookControlGUI *wb > wb_uri = workbook_get_uri (wb_view_workbook (wb_view)); > if (wb_uri != NULL) { > char *basename = go_basename_from_uri (wb_uri); >- char *dot = strrchr (basename, '.'); >+ char *dot = basename ? strrchr (basename, '.') : NULL; > > gtk_file_chooser_set_uri (fsel, wb_uri); > gtk_file_chooser_unselect_all (fsel); >Index: src/libgnumeric.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/libgnumeric.c,v >retrieving revision 1.225 >diff -u -w -p -r1.225 libgnumeric.c >--- src/libgnumeric.c 1 Dec 2004 04:18:05 -0000 1.225 >+++ src/libgnumeric.c 14 Mar 2006 19:15:56 -0000 >@@ -56,10 +56,10 @@ int immediate_exit_flag = 0; > int print_debugging = 0; > gboolean initial_workbook_open_complete = FALSE; > char *x_geometry; >-char const *gnumeric_lib_dir = GNUMERIC_LIBDIR; >-char const *gnumeric_data_dir = GNUMERIC_DATADIR; >-char const *gnumeric_icon_dir = GNUMERIC_ICONDIR; >-char const *gnumeric_locale_dir = GNUMERIC_LOCALEDIR; >+char *gnumeric_lib_dir = (char *)GNUMERIC_LIBDIR; >+char *gnumeric_data_dir = (char *)GNUMERIC_DATADIR; >+char *gnumeric_icon_dir = (char *)GNUMERIC_ICONDIR; >+char *gnumeric_locale_dir = (char *)GNUMERIC_LOCALEDIR; > > /** > * gnm_pre_parse_init : >@@ -77,7 +77,7 @@ gnm_pre_parse_init (char const* gnumeric > > #ifdef G_OS_WIN32 > { >- char *dir; >+ gchar *dir; > dir = g_win32_get_package_installation_directory (NULL, NULL); > gnumeric_data_dir = g_build_filename (dir, > "share", "gnumeric", GNUMERIC_VERSION, NULL); >@@ -87,6 +87,7 @@ gnm_pre_parse_init (char const* gnumeric > "share", "locale", NULL); > gnumeric_lib_dir = g_build_filename (dir, > "lib", "gnumeric", GNUMERIC_VERSION, NULL); >+ g_free (dir); > } > #endif > >@@ -197,4 +198,10 @@ gnm_shutdown (void) > libgoffice_shutdown (); > plugin_services_shutdown (); > g_object_unref (gnm_app_get_app ()); >+#ifdef G_OS_WIN32 >+ g_free (gnumeric_lib_dir); >+ g_free (gnumeric_data_dir); >+ g_free (gnumeric_icon_dir); >+ g_free (gnumeric_locale_dir); >+#endif > } >Index: src/libgnumeric.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/libgnumeric.h,v >retrieving revision 1.29 >retrieving revision 1.29.2.1 >diff -u -w -p -r1.29 -r1.29.2.1 >--- src/libgnumeric.h 5 Jan 2005 06:17:10 -0000 1.29 >+++ src/libgnumeric.h 9 Apr 2005 08:15:31 -0000 1.29.2.1 >@@ -13,10 +13,10 @@ extern int immediate_exit_flag; > extern int print_debugging; > extern gboolean initial_workbook_open_complete; > extern char *x_geometry; >-extern char const *gnumeric_lib_dir; >-extern char const *gnumeric_data_dir; >-extern char const *gnumeric_icon_dir; >-extern char const *gnumeric_locale_dir; >+extern char *gnumeric_lib_dir; >+extern char *gnumeric_data_dir; >+extern char *gnumeric_icon_dir; >+extern char *gnumeric_locale_dir; > > void gnm_pre_parse_init (char const* gnumeric_binary); > void gnm_common_init (gboolean fast); >Index: src/number-match.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/number-match.c,v >retrieving revision 1.113 >retrieving revision 1.113.4.2 >diff -u -w -p -r1.113 -r1.113.4.2 >--- src/number-match.c 23 Jun 2004 14:21:47 -0000 1.113 >+++ src/number-match.c 11 Aug 2005 19:54:03 -0000 1.113.4.2 >@@ -155,8 +155,8 @@ format_create_regexp (unsigned char cons > if (format[1] == '$') { > for (format += 2; *format && *format != ']' ; ++format) > g_string_append_c (regexp, *format); >- if (*format == ']') >- ++format; >+ if (*format != ']') >+ format--; > break; > } else if (format[1] == 'h' && format[2] == ']') { > g_string_append (regexp, "([-+]?[0-9]+)"); >@@ -843,7 +843,7 @@ compute_value (char const *s, const regm > number = 0.; > /* FIXME: this loop is bogus. */ > while (1) { >- int thisnumber; >+ unsigned long thisnumber; > if (number > DBL_MAX / 1000.0) { > g_free (str); > return NULL; >@@ -896,7 +896,7 @@ compute_value (char const *s, const regm > } > if (exppart) { > char *end; >- int exponent; >+ long exponent; > > errno = 0; /* strtol sets errno, but does not clear it. */ > exponent = strtol (exppart, &end, 10); >Index: src/parser.y >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/parser.y,v >retrieving revision 1.202 >diff -u -w -p -r1.202 parser.y >--- src/parser.y 11 Oct 2004 17:41:38 -0000 1.202 >+++ src/parser.y 14 Mar 2006 19:15:56 -0000 >@@ -378,6 +378,7 @@ build_set (GnmExprList *list) > return NULL; > } > >+ unregister_allocation (list); > return register_expr_allocation (gnm_expr_new_set (list)); > } > >@@ -562,8 +563,8 @@ exp: CONSTANT { $$ = $1; } > state->ptr-2, 2); > YYERROR; > } else { >- unregister_allocation ($2); > if ($2->next == NULL) { >+ unregister_allocation ($2); > $$ = register_expr_allocation ($2->data); > /* NOTE : free list not content */ > gnm_expr_list_free ($2); >@@ -716,11 +717,14 @@ cellref: RANGEREF { $$ = $1; } > $$ = build_range_ctor ($1, $3, $3); > if ($$ == NULL) { YYERROR; } > } >+ | RANGEREF RANGE_SEP RANGEREF { >+ $$ = build_binop ($1, GNM_EXPR_OP_RANGE_CTOR, $3); >+ } > ; > > arg_list: exp { > unregister_allocation ($1); >- $$ = g_slist_prepend (NULL, $1); >+ $$ = gnm_expr_list_prepend (NULL, $1); > register_expr_list_allocation ($$); > } > | exp SEPARATOR arg_list { >@@ -731,7 +735,7 @@ arg_list: exp { > if (tmp == NULL) > tmp = gnm_expr_list_prepend (NULL, gnm_expr_new_constant (value_new_empty ())); > >- $$ = g_slist_prepend (tmp, $1); >+ $$ = gnm_expr_list_prepend (tmp, $1); > register_expr_list_allocation ($$); > } > | SEPARATOR arg_list { >@@ -1192,7 +1196,8 @@ yylex (void) > while ((tmp = g_utf8_get_char (state->ptr)) != 0 && > !g_unichar_isspace (tmp)) { > state->ptr = g_utf8_next_char (state->ptr); >- if (tmp == '!' || tmp == '?') { >+ if (tmp == '!' || tmp == '?' || >+ ((state->ptr - start) == 4 && 0 == strncmp (start, "#N/A", 4))) { > GnmString *name = gnm_string_get_nocopy (g_strndup (start, state->ptr - start)); > yylval.expr = register_expr_allocation > (gnm_expr_new_constant ( >Index: src/plugin.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/Attic/plugin.c,v >retrieving revision 1.101 >retrieving revision 1.101.2.1 >diff -u -w -p -r1.101 -r1.101.2.1 >--- src/plugin.c 4 Dec 2004 04:11:28 -0000 1.101 >+++ src/plugin.c 9 Apr 2005 08:15:31 -0000 1.101.2.1 >@@ -1837,7 +1837,7 @@ plugins_shutdown (void) > g_hash_table_destroy (available_plugins_id_hash); > gnm_slist_free_custom (available_plugins, gnm_plugin_try_unref); > >- go_conf_sync (); >+ go_conf_sync (NULL); > } > > void >Index: src/print-info.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/print-info.c,v >retrieving revision 1.102.2.1 >retrieving revision 1.102.2.2 >diff -u -w -p -r1.102.2.1 -r1.102.2.2 >--- src/print-info.c 10 Feb 2005 03:43:51 -0000 1.102.2.1 >+++ src/print-info.c 9 Apr 2005 08:15:31 -0000 1.102.2.2 >@@ -323,10 +323,12 @@ destroy_formats (void) > void > print_info_save (PrintInformation const *pi) > { >+ GOConfNode *node = go_conf_get_node (gnm_conf_get_root (), PRINTSETUP_GCONF_DIR); >+ > gnm_gconf_set_print_scale_percentage (pi->scaling.type == PERCENTAGE); > gnm_gconf_set_print_scale_percentage_value (pi->scaling.percentage.x); >- go_conf_set_int (PRINTSETUP_GCONF_SCALE_WIDTH, pi->scaling.dim.cols); >- go_conf_set_int (PRINTSETUP_GCONF_SCALE_HEIGHT, pi->scaling.dim.rows); >+ go_conf_set_int (node, PRINTSETUP_GCONF_SCALE_WIDTH, pi->scaling.dim.cols); >+ go_conf_set_int (node, PRINTSETUP_GCONF_SCALE_HEIGHT, pi->scaling.dim.rows); > > gnm_gconf_set_print_tb_margins (&pi->margins); > >@@ -338,9 +340,9 @@ print_info_save (PrintInformation const > gnm_gconf_set_print_titles (pi->print_titles); > gnm_gconf_set_print_order_right_then_down (pi->print_order); > >- go_conf_set_string (PRINTSETUP_GCONF_REPEAT_TOP, >+ go_conf_set_string (node, PRINTSETUP_GCONF_REPEAT_TOP, > pi->repeat_top.use ? range_name (&pi->repeat_top.range) : ""); >- go_conf_set_string (PRINTSETUP_GCONF_REPEAT_LEFT, >+ go_conf_set_string (node, PRINTSETUP_GCONF_REPEAT_LEFT, > pi->repeat_left.use ? range_name (&pi->repeat_left.range) : ""); > > save_formats (); >@@ -354,6 +356,7 @@ print_info_save (PrintInformation const > pi->footer->middle_format, > pi->footer->right_format); > >+ go_conf_free_node (node); > } > > const GnomePrintUnit * >Index: src/sheet-autofill.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/sheet-autofill.c,v >retrieving revision 1.115 >diff -u -w -p -r1.115 sheet-autofill.c >--- src/sheet-autofill.c 4 Jan 2005 01:22:10 -0000 1.115 >+++ src/sheet-autofill.c 14 Mar 2006 19:15:56 -0000 >@@ -114,7 +114,6 @@ typedef struct _FillItem { > struct { > AutoFillList const *list; > int num; >- int was_i18n; > } list; > struct { > GnmString *str; >@@ -153,7 +152,7 @@ autofill_register_list (char const *cons > } > > static gboolean >-in_list (AutoFillList const *afl, char const *s, int *n, int *is_i18n) >+in_list (AutoFillList const *afl, char const *s, int *n) > { > int i; > >@@ -162,7 +161,6 @@ in_list (AutoFillList const *afl, char c > if (*translated_text == '*') > translated_text++; > if (g_ascii_strcasecmp (translated_text, s) == 0) { >- *is_i18n = TRUE; > *n = i; > return TRUE; > } >@@ -172,12 +170,12 @@ in_list (AutoFillList const *afl, char c > } > > static AutoFillList const * >-matches_list (char const *s, int *n, int *is_i18n) >+matches_list (char const *s, int *n) > { > GList *l; > for (l = autofill_lists; l != NULL; l = l->next) { > AutoFillList const *afl = l->data; >- if (in_list (afl, s, n, is_i18n)) >+ if (in_list (afl, s, n)) > return afl; > } > return NULL; >@@ -316,14 +314,13 @@ fill_item_new (Sheet *sheet, int col, in > > if (value_type == VALUE_STRING) { > AutoFillList const *list; >- int num, pos, endpos, i18; >+ int num, pos, endpos; > >- list = matches_list (value->v_str.val->str, &num, &i18); >+ list = matches_list (value->v_str.val->str, &num); > if (list) { > fi->type = FILL_STRING_LIST; > fi->v.list.list = list; > fi->v.list.num = num; >- fi->v.list.was_i18n = i18; > return fi; > } > >@@ -472,23 +469,34 @@ type_is_compatible (FillItem *last, Fill > return FALSE; > > if (last->type == FILL_STRING_LIST) { >- /* It is possible the item is in multiple lists. If things >- * disagree see if we are in the previous list, and convert >- * eg May >- */ >- if (last->v.list.list != current->v.list.list) { >- int num, is_i18n; >- if (in_list (last->v.list.list, >- current->v.list.list->items [current->v.list.num], >- &num, &is_i18n)) { >+ int num; >+ char const *str; >+ >+ if (last->v.list.list == current->v.list.list) >+ return TRUE; >+ >+ /* This item may be in multiple lists. Is it in the >+ * same list as the previous element ? */ >+ str = current->v.list.list->items [current->v.list.num]; >+ if (*str == '*') >+ str++; >+ if (in_list (last->v.list.list, str, &num)) { > current->v.list.list = last->v.list.list; > current->v.list.num = num; >- current->v.list.was_i18n = is_i18n; >- } else >- return FALSE; >+ return TRUE; >+ } >+ >+ /* The previous element may be in multple lists. Is it >+ * in the current list ? */ >+ str = last->v.list.list->items [last->v.list.num]; >+ if (*str == '*') >+ str++; >+ if (in_list (current->v.list.list, str, &num)) { >+ last->v.list.list = current->v.list.list; >+ last->v.list.num = num; >+ return TRUE; > } > >- if (last->v.list.was_i18n != current->v.list.was_i18n) > return FALSE; > } > >@@ -709,10 +717,7 @@ autofill_cell (FillItem *fi, GnmCell *ce > if (n < 0) > n += delta->v.list.list->count; > >- text = delta->v.list.list->items [n]; >- if (delta->v.list.was_i18n) >- text = _(text); >- >+ text = _(delta->v.list.list->items [n]); > if (*text == '*') > text++; > >Index: src/sheet-control-gui.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/sheet-control-gui.c,v >retrieving revision 1.364.2.1 >diff -u -w -p -r1.364.2.1 sheet-control-gui.c >--- src/sheet-control-gui.c 10 Mar 2005 07:08:15 -0000 1.364.2.1 >+++ src/sheet-control-gui.c 14 Mar 2006 19:15:57 -0000 >@@ -571,8 +571,8 @@ static void > cb_hscrollbar_adjust_bounds (GtkRange *range, gdouble new_value) > { > gdouble limit = range->adjustment->upper - range->adjustment->page_size; >- if (range->adjustment->upper < SHEET_MAX_COLS && new_value > limit) { >- range->adjustment->upper = new_value + range->adjustment->page_size; >+ if (range->adjustment->upper < SHEET_MAX_COLS && new_value >= limit) { >+ range->adjustment->upper = new_value + range->adjustment->page_size + 1; > if (range->adjustment->upper > SHEET_MAX_COLS) > range->adjustment->upper = SHEET_MAX_COLS; > gtk_adjustment_changed (range->adjustment); >@@ -582,8 +582,8 @@ static void > cb_vscrollbar_adjust_bounds (GtkRange *range, gdouble new_value) > { > gdouble limit = range->adjustment->upper - range->adjustment->page_size; >- if (range->adjustment->upper < SHEET_MAX_ROWS && new_value > limit) { >- range->adjustment->upper = new_value + range->adjustment->page_size; >+ if (range->adjustment->upper < SHEET_MAX_ROWS && new_value >= limit) { >+ range->adjustment->upper = new_value + range->adjustment->page_size + 1; > if (range->adjustment->upper > SHEET_MAX_ROWS) > range->adjustment->upper = SHEET_MAX_ROWS; > gtk_adjustment_changed (range->adjustment); >Index: src/sheet-filter.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/sheet-filter.c,v >retrieving revision 1.62 >diff -u -w -p -r1.62 sheet-filter.c >--- src/sheet-filter.c 17 Oct 2004 02:36:05 -0000 1.62 >+++ src/sheet-filter.c 14 Mar 2006 19:15:57 -0000 >@@ -46,6 +46,7 @@ > #include <gdk/gdkkeysyms.h> > #include <gsf/gsf-impl-utils.h> > #include <glib/gi18n.h> >+#include <string.h> > > typedef struct { > SheetObject parent; >@@ -673,8 +674,13 @@ filter_expr_eval (GnmFilterOp op, GnmVal > regmatch_t rm; > > switch (go_regexec (regexp, str, 1, &rm, 0)) { >- case REG_NOMATCH: return op == GNM_FILTER_OP_NOT_EQUAL; >- case REG_OK: return op == GNM_FILTER_OP_EQUAL; >+ case REG_OK: >+ if (rm.rm_so == 0 && strlen (str) == (size_t)rm.rm_eo) >+ return op == GNM_FILTER_OP_EQUAL; >+ /* fall through */ >+ >+ case REG_NOMATCH: >+ return op == GNM_FILTER_OP_NOT_EQUAL; > > default: > g_warning ("Unexpected regexec result"); >Index: src/sheet-view.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/sheet-view.c,v >retrieving revision 1.136 >diff -u -w -p -r1.136 sheet-view.c >--- src/sheet-view.c 22 Nov 2004 13:10:14 -0000 1.136 >+++ src/sheet-view.c 14 Mar 2006 19:15:57 -0000 >@@ -635,7 +635,8 @@ sv_is_region_empty_or_selected (SheetVie > * @unfrozen : top left corner of the unfrozen region > * > * By definition the unfrozen region must be below the frozen. >- */ >+ * If @frozen == @unfrozen or @frozen == NULL unfreeze >+ **/ > void > sv_freeze_panes (SheetView *sv, > GnmCellPos const *frozen, >@@ -650,7 +651,8 @@ sv_freeze_panes (SheetView *sv, > > /* Just in case */ > if (unfrozen->col != (SHEET_MAX_COLS-1) && >- unfrozen->row != (SHEET_MAX_ROWS-1)) { >+ unfrozen->row != (SHEET_MAX_ROWS-1) && >+ !cellpos_equal (frozen, unfrozen)) { > sv->frozen_top_left = *frozen; > sv->unfrozen_top_left = *unfrozen; > if (sv->frozen_top_left.col == sv->unfrozen_top_left.col) >Index: src/sheet.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/sheet.c,v >retrieving revision 1.728 >diff -u -w -p -r1.728 sheet.c >--- src/sheet.c 13 Jan 2005 04:35:41 -0000 1.728 >+++ src/sheet.c 14 Mar 2006 19:15:58 -0000 >@@ -4060,6 +4060,20 @@ sheet_dup (Sheet const *src) > TRUE, TRUE); > dst = sheet_new (wb, name); > g_free (name); >+ >+ dst->r1c1_addresses = src->r1c1_addresses; >+ dst->display_formulas = src->display_formulas; >+ dst->hide_zero = src->hide_zero; >+ dst->hide_grid = src->hide_grid; >+ dst->hide_col_header = src->hide_col_header; >+ dst->hide_row_header = src->hide_row_header; >+ dst->is_protected = src->is_protected; >+ dst->is_visible = src->is_visible; >+ dst->display_outlines = src->display_outlines; >+ dst->outline_symbols_below = src->outline_symbols_below; >+ dst->outline_symbols_right = src->outline_symbols_right; >+ dst->has_filtered_rows = src->has_filtered_rows; >+ > sheet_set_zoom_factor (dst, src->last_zoom_factor_used, FALSE, FALSE); > > /* Copy the print info */ >Index: src/solver.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/solver.h,v >retrieving revision 1.59 >diff -u -w -p -r1.59 solver.h >--- src/solver.h 5 Nov 2004 03:29:59 -0000 1.59 >+++ src/solver.h 14 Mar 2006 19:15:58 -0000 >@@ -258,8 +258,9 @@ GnmCell *solver_get_target_cell (Sheet > /* Returns a pointer to a input variable cell. */ > GnmCell *solver_get_input_var (SolverResults *res, int n); > >-/* Retruns a pointer to a constraint. */ >+/* Returns a pointer to a constraint. */ > SolverConstraint* solver_get_constraint (SolverResults *res, int n); >+void solver_constraint_destroy (SolverConstraint *c); > > void solver_insert_cols (Sheet *sheet, int col, int count); > void solver_insert_rows (Sheet *sheet, int row, int count); >@@ -270,11 +271,12 @@ void solver_delete_cols > > #define solver_param_new() NULL > #define solver_lp_copy(src_param, new_sheet) NULL >-#define solver_param_destroy(param) >-#define solver_insert_cols(sheet, col, count) >-#define solver_insert_rows(sheet, row, count) >-#define solver_delete_cols(sheet, col, count) >-#define solver_delete_rows(sheet, row, count) >+#define solver_param_destroy(param) do {} while(0) >+#define solver_insert_cols(sheet, col, count) do {} while(0) >+#define solver_insert_rows(sheet, row, count) do {} while(0) >+#define solver_delete_cols(sheet, col, count) do {} while(0) >+#define solver_delete_rows(sheet, row, count) do {} while(0) >+#define solver_constraint_destroy(c) do {} while(0) > > #endif > >Index: src/stf-parse.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/stf-parse.c,v >retrieving revision 1.101 >diff -u -w -p -r1.101 stf-parse.c >--- src/stf-parse.c 21 Oct 2004 14:31:18 -0000 1.101 >+++ src/stf-parse.c 14 Mar 2006 19:15:58 -0000 >@@ -55,8 +55,6 @@ gnm_setlocale(LC_ALL, parseoptions->loca > gnm_setlocale(LC_ALL, oldlocale);\ > g_free (oldlocale);} > >-#define WARN_TOO_MANY_ROWS _("Too many rows in data to parse: %d") >- > /* Source_t struct, used for interchanging parsing information between the low level parse functions */ > typedef struct { > GStringChunk *chunk; >@@ -774,8 +772,7 @@ stf_parse_general_free (GPtrArray *lines > GPtrArray * > stf_parse_general (StfParseOptions_t *parseoptions, > GStringChunk *lines_chunk, >- char const *data, char const *data_end, >- int maxlines) >+ char const *data, char const *data_end) > { > GPtrArray *lines; > Source_t src; >@@ -795,11 +792,6 @@ stf_parse_general (StfParseOptions_t *pa > while (*src.position != '\0' && src.position < data_end) { > GPtrArray *line; > >- if (++row >= SHEET_MAX_ROWS) { >- g_warning (WARN_TOO_MANY_ROWS, row); >- break; >- } >- > line = parseoptions->parsetype == PARSE_TYPE_CSV > ? stf_parse_csv_line (&src, parseoptions) > : stf_parse_fixed_line (&src, parseoptions); >@@ -807,7 +799,7 @@ stf_parse_general (StfParseOptions_t *pa > g_ptr_array_add (lines, line); > src.position += compare_terminator (src.position, parseoptions); > >- if (row >= maxlines) >+ if (++row == SHEET_MAX_ROWS) > break; > } > >@@ -1160,8 +1152,7 @@ stf_parse_sheet (StfParseOptions_t *pars > if (!data_end) > data_end = data + strlen (data); > lines_chunk = g_string_chunk_new (100 * 1024); >- lines = stf_parse_general (parseoptions, lines_chunk, data, data_end, >- SHEET_MAX_ROWS); >+ lines = stf_parse_general (parseoptions, lines_chunk, data, data_end); > for (row = start_row, lrow = 0; lrow < lines->len ; row++, lrow++) { > col = start_col; > line = g_ptr_array_index (lines, lrow); >@@ -1212,8 +1203,7 @@ stf_parse_region (StfParseOptions_t *par > if (!data_end) > data_end = data + strlen (data); > lines_chunk = g_string_chunk_new (100 * 1024); >- lines = stf_parse_general (parseoptions, lines_chunk, data, data_end, >- SHEET_MAX_ROWS); >+ lines = stf_parse_general (parseoptions, lines_chunk, data, data_end); > for (row = 0; row < lines->len; row++) { > GPtrArray *line = g_ptr_array_index (lines, row); > unsigned int col, targetcol = 0; >Index: src/stf-parse.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/stf-parse.h,v >retrieving revision 1.41 >diff -u -w -p -r1.41 stf-parse.h >--- src/stf-parse.h 21 Oct 2004 19:05:02 -0000 1.41 >+++ src/stf-parse.h 14 Mar 2006 19:15:58 -0000 >@@ -102,8 +102,7 @@ int stf_parse_options_fixed_splitpositio > GPtrArray *stf_parse_general (StfParseOptions_t *parseoptions, > GStringChunk *lines_chunk, > char const *data, >- char const *data_end, >- int maxlines); >+ char const *data_end); > void stf_parse_general_free (GPtrArray *lines); > GPtrArray *stf_parse_lines (StfParseOptions_t *parseoptions, > GStringChunk *lines_chunk, >Index: src/stf.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/stf.c,v >retrieving revision 1.120 >diff -u -w -p -r1.120 stf.c >--- src/stf.c 16 Nov 2004 04:23:34 -0000 1.120 >+++ src/stf.c 14 Mar 2006 19:15:58 -0000 >@@ -452,23 +452,57 @@ stf_write_csv (GnmFileSaver const *fs, I > static gboolean > csv_tsv_probe (GnmFileOpener const *fo, GsfInput *input, FileProbeLevel pl) > { >+ /* Rough and ready heuristic. If the first N bytes have no >+ * unprintable characters this may be text */ >+ gsf_off_t const N = 512; >+ > if (pl == FILE_PROBE_CONTENT) { >- /* Rough and ready heuristic. If the first 80 bytes have no >- * nuls this may be text */ > guint8 const *header; >- int i; >+ gsf_off_t i; >+ const char *enc = NULL; >+ char *header_utf8; >+ const char *p; >+ int try; >+ gboolean ok = TRUE; > > if (gsf_input_seek (input, 0, G_SEEK_SET)) > return FALSE; > i = gsf_input_remaining (input); >- if (i > 80) >- i = 80; >+ >+ /* If someone ships us an empty file, accept it only if >+ it has a proper name. */ >+ if (i == 0) >+ return csv_tsv_probe (fo, input, FILE_PROBE_FILE_NAME); >+ >+ if (i > N) i = N; > if (NULL == (header = gsf_input_read (input, i, NULL))) > return FALSE; >- while (i-- > 0) >- if (*header++ == 0) >+ >+ /* >+ * It is conceivable that encoding guessing could fail >+ * if our truncated buffer had partial characters. We >+ * really need go_guess_encoding_truncated, but for now >+ * let's just try cutting a byte away at a time. >+ */ >+ for (try = 0; !enc && try < MIN (i, 6); try++) >+ enc = gnm_guess_encoding (header, i - try, NULL, &header_utf8); >+ >+ if (!enc) > return FALSE; >- return TRUE; >+ >+ for (p = header_utf8; *p; p = g_utf8_next_char (p)) { >+ gunichar uc = g_utf8_get_char (p); >+ /* isprint might not be true for these: */ >+ if (uc == '\n' || uc == '\t' || uc == '\r') >+ continue; >+ if (!g_unichar_isprint (uc)) { >+ ok = FALSE; >+ break; >+ } >+ } >+ >+ g_free (header_utf8); >+ return ok; > } else { > char const *name = gsf_input_name (input); > if (name == NULL) >Index: src/style-border.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/style-border.h,v >retrieving revision 1.32 >diff -u -w -p -r1.32 style-border.h >--- src/style-border.h 12 Nov 2003 19:10:46 -0000 1.32 >+++ src/style-border.h 14 Mar 2006 19:15:58 -0000 >@@ -34,8 +34,9 @@ typedef enum { > } StyleBorderType; > > /* The order corresponds to the border_buttons name list >- * in dialog_cell_format_impl */ >-typedef enum _StyleBorderLocation { >+ * in dialog_cell_format_impl >+ * STYLE_BORDER_TOP must be 0 */ >+typedef enum { > STYLE_BORDER_TOP, STYLE_BORDER_BOTTOM, > STYLE_BORDER_LEFT, STYLE_BORDER_RIGHT, > STYLE_BORDER_REV_DIAG, STYLE_BORDER_DIAG, >Index: src/wbc-gtk.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/wbc-gtk.c,v >retrieving revision 1.60 >retrieving revision 1.60.2.2 >diff -u -w -p -r1.60 -r1.60.2.2 >--- src/wbc-gtk.c 30 Oct 2004 03:51:35 -0000 1.60 >+++ src/wbc-gtk.c 21 Apr 2005 17:48:29 -0000 1.60.2.2 >@@ -630,6 +630,7 @@ wbc_gtk_init_font_name (WBCgtk *gtk) > > gtk->font_name = g_object_new (go_action_combo_text_get_type (), > "name", "FontName", >+ "case-sensitive", FALSE, > NULL); > for (ptr = gnumeric_font_family_list; ptr != NULL; ptr = ptr->next) > if (ptr->data) >@@ -1016,16 +1017,18 @@ regenerate_window_menu (WBCgtk *gtk, Wor > > k = 1; > WORKBOOK_FOREACH_CONTROL (wb, wbv, wbc, { >+ char *basename; > if (i >= 10) > return i; >- if (IS_WORKBOOK_CONTROL_GUI (wbc)) { >+ if (IS_WORKBOOK_CONTROL_GUI (wbc) && >+ (basename = go_basename_from_uri (wb->uri)) != NULL) { > GString *label = g_string_new (NULL); > char *name; > const char *s; > GtkActionEntry entry; > > g_string_append_printf (label, "_%d ", i); >- s = wb->basename; >+ s = basename; > while (*s) { > if (*s == '_') > g_string_append_c (label, '_'); >@@ -1050,6 +1053,7 @@ regenerate_window_menu (WBCgtk *gtk, Wor > > g_string_free (label, TRUE); > g_free (name); >+ g_free (basename); > i++; > }}); > return i; >Index: src/wbcg-actions.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/wbcg-actions.c,v >retrieving revision 1.72.2.1 >diff -u -w -p -r1.72.2.1 wbcg-actions.c >--- src/wbcg-actions.c 12 Mar 2005 23:17:50 -0000 1.72.2.1 >+++ src/wbcg-actions.c 14 Mar 2006 19:15:58 -0000 >@@ -490,7 +490,7 @@ static GNM_ACTION_DEF (cb_repeat) { comm > > /****************************************************************************/ > >-static GNM_ACTION_DEF (cb_view_zoom_out) >+static GNM_ACTION_DEF (cb_view_zoom_in) > { > Sheet *sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg)); > int zoom = (int)(sheet->last_zoom_factor_used * 100. + .5) - 10; >@@ -501,7 +501,7 @@ static GNM_ACTION_DEF (cb_view_zoom_out) > cmd_zoom (WORKBOOK_CONTROL (wbcg), g_slist_append (NULL, sheet), > (double) (zoom + 10) / 100); > } >-static GNM_ACTION_DEF (cb_view_zoom_in) >+static GNM_ACTION_DEF (cb_view_zoom_out) > { > Sheet *sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg)); > int zoom = (int)(sheet->last_zoom_factor_used * 100. + .5) - 10; >@@ -855,7 +855,7 @@ static GNM_ACTION_DEF (cb_help_docs) > > static GNM_ACTION_DEF (cb_help_web) > { >- GError *err = go_url_show ("http://www.gnumeric.org/"); >+ GError *err = go_url_show ("http://www.gnome.org/projects/gnumeric/"); > if (err != NULL) { > gnm_cmd_context_error (GNM_CMD_CONTEXT (wbcg), err); > g_error_free (err); >@@ -1214,6 +1214,11 @@ apply_number_format (WorkbookControlGUI > cmd_selection_format (WORKBOOK_CONTROL (wbcg), mstyle, NULL, descriptor); > } > >+static GNM_ACTION_DEF (cb_format_as_general) >+{ >+ apply_number_format (wbcg, >+ cell_formats [FMT_GENERAL][0], _("Format as General")); >+} > static GNM_ACTION_DEF (cb_format_as_number) > { > apply_number_format (wbcg, >@@ -1945,14 +1950,17 @@ static /* const 142334 */ GtkActionEntry > NULL, N_("Split merged ranges of cells"), > G_CALLBACK (cb_unmerge_cells) }, > >+ { "FormatAsGeneral", NULL, N_("General"), >+ "<control>asciitilde", N_("Format the selection as General"), >+ G_CALLBACK (cb_format_as_general) }, > { "FormatAsNumber", NULL, N_("Number"), >- "<control>asciitilde", N_("Format the selection as numbers"), >+ "<control>exclam", N_("Format the selection as numbers"), > G_CALLBACK (cb_format_as_number) }, > { "FormatAsCurrency", NULL, N_("Currency"), > "<control>dollar", N_("Format the selection as currency"), > G_CALLBACK (cb_format_as_currency) }, > { "FormatAsAccounting", "Gnumeric_FormatAsAccounting", N_("Accounting"), >- "<control>exclam", N_("Format the selection as accounting"), >+ NULL, N_("Format the selection as accounting"), > G_CALLBACK (cb_format_as_accounting) }, > { "FormatAsPercentage", "Gnumeric_FormatAsPercentage", N_("Percentage"), > "<control>percent", N_("Format the selection as percentage"), >Index: src/workbook-control.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/workbook-control.c,v >retrieving revision 1.82 >retrieving revision 1.82.2.1 >diff -u -w -p -r1.82 -r1.82.2.1 >--- src/workbook-control.c 30 Oct 2004 21:09:02 -0000 1.82 >+++ src/workbook-control.c 17 Mar 2005 14:34:40 -0000 1.82.2.1 >@@ -35,7 +35,7 @@ > #include "ranges.h" > #include "expr-name.h" > #include "command-context.h" >- >+#include <goffice/utils/go-file.h> > #include <gsf/gsf-impl-utils.h> > > #define WBC_CLASS(o) WORKBOOK_CONTROL_CLASS (G_OBJECT_GET_CLASS (o)) >@@ -80,12 +80,14 @@ wb_control_update_title (WorkbookControl > > if (wbc_class != NULL && wbc_class->set_title != NULL) { > Workbook const *wb = wb_control_workbook (wbc); >- if (workbook_is_dirty (wb)) { >- char *tmp = g_strconcat ("*", wb->basename, NULL); >- wbc_class->set_title (wbc, tmp); >- g_free (tmp); >- } else >- wbc_class->set_title (wbc, wb->basename); >+ char *basename = go_basename_from_uri (wb->uri); >+ char *title = g_strconcat >+ (workbook_is_dirty (wb) ? "*" : "", >+ basename ? basename : wb->uri, >+ NULL); >+ wbc_class->set_title (wbc, title); >+ g_free (title); >+ g_free (basename); > } > } > >Index: src/workbook-view.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/workbook-view.c,v >retrieving revision 1.177 >diff -u -w -p -r1.177 workbook-view.c >--- src/workbook-view.c 30 Oct 2004 21:09:02 -0000 1.177 >+++ src/workbook-view.c 14 Mar 2006 19:15:59 -0000 >@@ -748,7 +748,7 @@ cb_cleanup_sendto (gpointer path) > gboolean > wb_view_sendto (WorkbookView *wbv, GnmCmdContext *context) > { >- gboolean problem; >+ gboolean problem = FALSE; > IOContext *io_context; > Workbook *wb; > GnmFileSaver *fs; >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/Makefile.am >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/Makefile.am,v >retrieving revision 1.23 >retrieving revision 1.23.2.1 >diff -u -w -p -r1.23 -r1.23.2.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/Makefile.am 27 Dec 2004 21:58:03 -0000 1.23 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/Makefile.am 13 May 2005 03:37:58 -0000 1.23.2.1 >@@ -1,4 +1,4 @@ >-INCLUDES = \ >+AM_CPPFLAGS = \ > -I$(top_srcdir) \ > -I$(top_builddir) \ > $(WARN_CFLAGS) \ >@@ -23,12 +23,8 @@ libfoocanvas_a_LIBADD = \ > libfoocanvasincludedir = $(includedir)/libfoocanvas-1.0/libfoocanvas > > >-BUILT_SOURCES = \ >- foo-canvas-marshal.c \ >- foo-canvas-marshal.h >- > libfoocanvas_a_SOURCES = \ >- $(BUILT_SOURCES) \ >+ foo-canvas-marshal.list \ > foo-canvas-i18n.h \ > foo-canvas-line.c \ > foo-canvas-pixbuf.c \ >@@ -40,28 +36,27 @@ libfoocanvas_a_SOURCES = \ > foo-canvas.c \ > libfoocanvastypes.c > >-foo-canvas-marshal.h: foo-canvas-marshal.list $(GLIB_GENMARSHAL) >- $(GLIB_GENMARSHAL) $< --header --prefix=foo_canvas_marshal > $@ >-foo-canvas-marshal.c: foo-canvas-marshal.list $(GLIB_GENMARSHAL) foo-canvas-marshal.h >- $(GLIB_GENMARSHAL) $< --body --prefix=foo_canvas_marshal > $@.tmp >- echo '/* This file has been automatically generated. Do not edit. */' >$@ >- echo '#include "'$*.h'"' >>$@ >- cat $@.tmp >>$@ >- rm -f $@.tmp >+GENMARSHAL_COMMAND = $(GLIB_GENMARSHAL) --prefix=foo_canvas_marshal >+SUFFIXES = .list > >-EXTRA_DIST = \ >- foo-canvas-marshal.list \ >- libfoocanvas.pc.in >+.list.h: >+ $(GENMARSHAL_COMMAND) --header $< >$@ >+ >+.list.c: >+ (echo '/* This file has been automatically generated. Do not edit. */' && \ >+ echo '#include "$*.h"' && \ >+ $(GENMARSHAL_COMMAND) --body $< ) >$@ >+ >+# A hint is needed to build the header first: >+BUILT_SOURCES = foo-canvas-marshal.h > >+# Another hint, see bugs #172211 and #172212: >+non-intermediate: foo-canvas-marshal.c > > CLEANFILES = foo-canvas-marshal.h foo-canvas-marshal.c > >-DONT_DIST_SOURCE = $(BUILT_SOURCES) >+EXTRA_DIST = libfoocanvas.pc.in > >-dist-hook: >- for file in $(DONT_DIST_SOURCE) ; do \ >- rm -f $(distdir)/$$file ; \ >- done > > noinst_HEADERS = \ > foo-canvas-marshal.h \ >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-line.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/foo-canvas-line.c,v >retrieving revision 1.9 >retrieving revision 1.9.4.1 >diff -u -w -p -r1.9 -r1.9.4.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-line.c 7 Jan 2004 04:55:00 -0000 1.9 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-line.c 13 May 2005 03:37:58 -0000 1.9.4.1 >@@ -160,106 +160,106 @@ foo_canvas_line_class_init (FooCanvasLin > PROP_POINTS, > g_param_spec_boxed ("points", NULL, NULL, > FOO_TYPE_CANVAS_POINTS, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR, >- g_param_spec_string ("fill_color", NULL, NULL, >+ g_param_spec_string ("fill-color", NULL, NULL, > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_GDK, >- g_param_spec_boxed ("fill_color_gdk", NULL, NULL, >+ g_param_spec_boxed ("fill-color-gdk", NULL, NULL, > GDK_TYPE_COLOR, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_RGBA, >- g_param_spec_uint ("fill_color_rgba", NULL, NULL, >+ g_param_spec_uint ("fill-color-rgba", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_STIPPLE, >- g_param_spec_object ("fill_stipple", NULL, NULL, >+ g_param_spec_object ("fill-stipple", NULL, NULL, > GDK_TYPE_DRAWABLE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_PIXELS, >- g_param_spec_uint ("width_pixels", NULL, NULL, >+ g_param_spec_uint ("width-pixels", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_UNITS, >- g_param_spec_double ("width_units", NULL, NULL, >+ g_param_spec_double ("width-units", NULL, NULL, > 0.0, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_CAP_STYLE, >- g_param_spec_enum ("cap_style", NULL, NULL, >+ g_param_spec_enum ("cap-style", NULL, NULL, > GDK_TYPE_CAP_STYLE, > GDK_CAP_BUTT, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_JOIN_STYLE, >- g_param_spec_enum ("join_style", NULL, NULL, >+ g_param_spec_enum ("join-style", NULL, NULL, > GDK_TYPE_JOIN_STYLE, > GDK_JOIN_MITER, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_LINE_STYLE, >- g_param_spec_enum ("line_style", NULL, NULL, >+ g_param_spec_enum ("line-style", NULL, NULL, > GDK_TYPE_LINE_STYLE, > GDK_LINE_SOLID, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FIRST_ARROWHEAD, >- g_param_spec_boolean ("first_arrowhead", NULL, NULL, >+ g_param_spec_boolean ("first-arrowhead", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_LAST_ARROWHEAD, >- g_param_spec_boolean ("last_arrowhead", NULL, NULL, >+ g_param_spec_boolean ("last-arrowhead", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_SMOOTH, > g_param_spec_boolean ("smooth", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_SPLINE_STEPS, >- g_param_spec_uint ("spline_steps", NULL, NULL, >+ g_param_spec_uint ("spline-steps", NULL, NULL, > 0, G_MAXUINT, DEFAULT_SPLINE_STEPS, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_ARROW_SHAPE_A, >- g_param_spec_double ("arrow_shape_a", NULL, NULL, >+ g_param_spec_double ("arrow-shape-a", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_ARROW_SHAPE_B, >- g_param_spec_double ("arrow_shape_b", NULL, NULL, >+ g_param_spec_double ("arrow-shape-b", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_ARROW_SHAPE_C, >- g_param_spec_double ("arrow_shape_c", NULL, NULL, >+ g_param_spec_double ("arrow-shape-c", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > object_class->destroy = foo_canvas_line_destroy; > >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-pixbuf.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/foo-canvas-pixbuf.c,v >retrieving revision 1.12 >retrieving revision 1.12.4.1 >diff -u -w -p -r1.12 -r1.12.4.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-pixbuf.c 23 Apr 2004 05:37:49 -0000 1.12 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-pixbuf.c 13 May 2005 03:37:58 -0000 1.12.4.1 >@@ -177,87 +177,87 @@ foo_canvas_pixbuf_class_init (FooCanvasP > PROP_PIXBUF, > g_param_spec_object ("pixbuf", NULL, NULL, > GDK_TYPE_PIXBUF, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH, > g_param_spec_double ("width", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_SET, >- g_param_spec_boolean ("width_set", NULL, NULL, >+ g_param_spec_boolean ("width-set", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_IN_PIXELS, >- g_param_spec_boolean ("width_in_pixels", NULL, NULL, >+ g_param_spec_boolean ("width-in-pixels", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_HEIGHT, > g_param_spec_double ("height", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_HEIGHT_SET, >- g_param_spec_boolean ("height_set", NULL, NULL, >+ g_param_spec_boolean ("height-set", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_HEIGHT_IN_PIXELS, >- g_param_spec_boolean ("height_in_pixels", NULL, NULL, >+ g_param_spec_boolean ("height-in-pixels", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_X, > g_param_spec_double ("x", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_X_IN_PIXELS, >- g_param_spec_boolean ("x_in_pixels", NULL, NULL, >+ g_param_spec_boolean ("x-in-pixels", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_Y, > g_param_spec_double ("y", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_Y_IN_PIXELS, >- g_param_spec_boolean ("y_in_pixels", NULL, NULL, >+ g_param_spec_boolean ("y-in-pixels", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_ANCHOR, > g_param_spec_enum ("anchor", NULL, NULL, > GTK_TYPE_ANCHOR_TYPE, > GTK_ANCHOR_NW, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_INTERP_TYPE, >- g_param_spec_enum ("interp_type", NULL, NULL, >+ g_param_spec_enum ("interp-type", NULL, NULL, > GDK_TYPE_INTERP_TYPE, > GDK_INTERP_BILINEAR, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_POINT_IGNORES_ALPHA, >- g_param_spec_boolean ("point_ignores_alpha", NULL, NULL, >+ g_param_spec_boolean ("point-ignores-alpha", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > object_class->destroy = foo_canvas_pixbuf_destroy; > >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-polygon.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/foo-canvas-polygon.c,v >retrieving revision 1.9 >retrieving revision 1.9.2.1 >diff -u -w -p -r1.9 -r1.9.2.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-polygon.c 4 Dec 2004 04:58:01 -0000 1.9 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-polygon.c 13 May 2005 03:37:58 -0000 1.9.2.1 >@@ -149,67 +149,67 @@ foo_canvas_polygon_class_init (FooCanvas > PROP_POINTS, > g_param_spec_boxed ("points", NULL, NULL, > FOO_TYPE_CANVAS_POINTS, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR, >- g_param_spec_string ("fill_color", NULL, NULL, >+ g_param_spec_string ("fill-color", NULL, NULL, > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_GDK, >- g_param_spec_boxed ("fill_color_gdk", NULL, NULL, >+ g_param_spec_boxed ("fill-color-gdk", NULL, NULL, > GDK_TYPE_COLOR, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_RGBA, >- g_param_spec_uint ("fill_color_rgba", NULL, NULL, >+ g_param_spec_uint ("fill-color-rgba", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_COLOR, >- g_param_spec_string ("outline_color", NULL, NULL, >+ g_param_spec_string ("outline-color", NULL, NULL, > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_COLOR_GDK, >- g_param_spec_boxed ("outline_color_gdk", NULL, NULL, >+ g_param_spec_boxed ("outline-color-gdk", NULL, NULL, > GDK_TYPE_COLOR, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_COLOR_RGBA, >- g_param_spec_uint ("outline_color_rgba", NULL, NULL, >+ g_param_spec_uint ("outline-color-rgba", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_STIPPLE, >- g_param_spec_object ("fill_stipple", NULL, NULL, >+ g_param_spec_object ("fill-stipple", NULL, NULL, > GDK_TYPE_DRAWABLE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_STIPPLE, >- g_param_spec_object ("outline_stipple", NULL, NULL, >+ g_param_spec_object ("outline-stipple", NULL, NULL, > GDK_TYPE_DRAWABLE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_PIXELS, >- g_param_spec_uint ("width_pixels", NULL, NULL, >+ g_param_spec_uint ("width-pixels", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_UNITS, >- g_param_spec_double ("width_units", NULL, NULL, >+ g_param_spec_double ("width-units", NULL, NULL, > 0.0, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > object_class->destroy = foo_canvas_polygon_destroy; > >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-rect-ellipse.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/foo-canvas-rect-ellipse.c,v >retrieving revision 1.9 >retrieving revision 1.9.4.1 >diff -u -w -p -r1.9 -r1.9.4.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-rect-ellipse.c 17 Jul 2004 03:11:38 -0000 1.9 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-rect-ellipse.c 13 May 2005 03:37:58 -0000 1.9.4.1 >@@ -152,85 +152,85 @@ foo_canvas_re_class_init (FooCanvasRECla > PROP_X1, > g_param_spec_double ("x1", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_Y1, > g_param_spec_double ("y1", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_X2, > g_param_spec_double ("x2", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_Y2, > g_param_spec_double ("y2", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR, >- g_param_spec_string ("fill_color", NULL, NULL, >+ g_param_spec_string ("fill-color", NULL, NULL, > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_GDK, >- g_param_spec_boxed ("fill_color_gdk", NULL, NULL, >+ g_param_spec_boxed ("fill-color-gdk", NULL, NULL, > GDK_TYPE_COLOR, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_RGBA, >- g_param_spec_uint ("fill_color_rgba", NULL, NULL, >+ g_param_spec_uint ("fill-color-rgba", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_STIPPLE, >- g_param_spec_object ("fill_stipple", NULL, NULL, >+ g_param_spec_object ("fill-stipple", NULL, NULL, > GDK_TYPE_DRAWABLE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_COLOR, >- g_param_spec_string ("outline_color", NULL, NULL, >+ g_param_spec_string ("outline-color", NULL, NULL, > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_COLOR_GDK, >- g_param_spec_boxed ("outline_color_gdk", NULL, NULL, >+ g_param_spec_boxed ("outline-color-gdk", NULL, NULL, > GDK_TYPE_COLOR, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_COLOR_RGBA, >- g_param_spec_uint ("outline_color_rgba", NULL, NULL, >+ g_param_spec_uint ("outline-color-rgba", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_OUTLINE_STIPPLE, >- g_param_spec_object ("outline_stipple", NULL, NULL, >+ g_param_spec_object ("outline-stipple", NULL, NULL, > GDK_TYPE_DRAWABLE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_PIXELS, >- g_param_spec_uint ("width_pixels", NULL, NULL, >+ g_param_spec_uint ("width-pixels", NULL, NULL, > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH_UNITS, >- g_param_spec_double ("width_units", NULL, NULL, >+ g_param_spec_double ("width-units", NULL, NULL, > 0.0, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > object_class->destroy = foo_canvas_re_destroy; > >@@ -842,17 +842,17 @@ foo_canvas_rect_realize (FooCanvasItem > #ifdef HAVE_RENDER > FooCanvasRectPrivate *priv; > int event_base, error_base; >+ Display *dpy; > > priv = FOO_CANVAS_RECT (item)->priv; > >- priv->use_render = XRenderQueryExtension (gdk_display, &event_base, &error_base); >+ dpy = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (item->canvas)->window); >+ priv->use_render = XRenderQueryExtension (dpy, &event_base, &error_base); > > if (priv->use_render) { >- Display *dpy; > GdkVisual *gdk_visual; > Visual *visual; > >- dpy = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (item->canvas)->window); > gdk_visual = gtk_widget_get_visual (GTK_WIDGET (item->canvas)); > visual = gdk_x11_visual_get_xvisual (gdk_visual); > >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-text.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/foo-canvas-text.c,v >retrieving revision 1.15 >retrieving revision 1.15.4.1 >diff -u -w -p -r1.15 -r1.15.4.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-text.c 23 Apr 2004 05:37:49 -0000 1.15 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-text.c 13 May 2005 03:37:58 -0000 1.15.4.1 >@@ -215,7 +215,7 @@ foo_canvas_text_class_init (FooCanvasTex > _("Text"), > _("Text to render"), > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > g_object_class_install_property > (gobject_class, >@@ -232,14 +232,14 @@ foo_canvas_text_class_init (FooCanvasTex > PROP_X, > g_param_spec_double ("x", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > g_object_class_install_property > (gobject_class, > PROP_Y, > g_param_spec_double ("y", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > > /* Font */ >@@ -250,16 +250,16 @@ foo_canvas_text_class_init (FooCanvasTex > _("Font"), > _("Font description as a string"), > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > g_object_class_install_property > (gobject_class, > PROP_FONT_DESC, >- g_param_spec_boxed ("font_desc", >+ g_param_spec_boxed ("font-desc", > _("Font description"), > _("Font description as a PangoFontDescription struct"), > PANGO_TYPE_FONT_DESCRIPTION, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > g_object_class_install_property > (gobject_class, >@@ -268,7 +268,7 @@ foo_canvas_text_class_init (FooCanvasTex > _("Font family"), > _("Name of the font family, e.g. Sans, Helvetica, Times, Monospace"), > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > /* Style */ > g_object_class_install_property >@@ -276,7 +276,7 @@ foo_canvas_text_class_init (FooCanvasTex > PROP_ATTRIBUTES, > g_param_spec_boxed ("attributes", NULL, NULL, > PANGO_TYPE_ATTR_LIST, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > g_object_class_install_property > (gobject_class, >@@ -334,7 +334,7 @@ foo_canvas_text_class_init (FooCanvasTex > g_object_class_install_property > (gobject_class, > PROP_SIZE_POINTS, >- g_param_spec_double ("size_points", >+ g_param_spec_double ("size-points", > _("Font points"), > _("Font size in points"), > 0.0, >@@ -389,137 +389,137 @@ foo_canvas_text_class_init (FooCanvasTex > g_param_spec_enum ("anchor", NULL, NULL, > GTK_TYPE_ANCHOR_TYPE, > GTK_ANCHOR_CENTER, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_JUSTIFICATION, > g_param_spec_enum ("justification", NULL, NULL, > GTK_TYPE_JUSTIFICATION, > GTK_JUSTIFY_LEFT, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_CLIP_WIDTH, >- g_param_spec_double ("clip_width", NULL, NULL, >+ g_param_spec_double ("clip-width", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_CLIP_HEIGHT, >- g_param_spec_double ("clip_height", NULL, NULL, >+ g_param_spec_double ("clip-height", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_CLIP, > g_param_spec_boolean ("clip", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WRAP_WIDTH, >- g_param_spec_double ("wrap_width", NULL, NULL, >+ g_param_spec_double ("wrap-width", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_X_OFFSET, >- g_param_spec_double ("x_offset", NULL, NULL, >+ g_param_spec_double ("x-offset", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_Y_OFFSET, >- g_param_spec_double ("y_offset", NULL, NULL, >+ g_param_spec_double ("y-offset", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR, >- g_param_spec_string ("fill_color", >+ g_param_spec_string ("fill-color", > _("Color"), > _("Text color, as string"), > NULL, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_GDK, >- g_param_spec_boxed ("fill_color_gdk", >+ g_param_spec_boxed ("fill-color-gdk", > _("Color"), > _("Text color, as a GdkColor"), > GDK_TYPE_COLOR, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_COLOR_RGBA, >- g_param_spec_uint ("fill_color_rgba", >+ g_param_spec_uint ("fill-color-rgba", > _("Color"), > _("Text color, as an R/G/B/A combined integer"), > 0, G_MAXUINT, 0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_FILL_STIPPLE, >- g_param_spec_object ("fill_stipple", NULL, NULL, >+ g_param_spec_object ("fill-stipple", NULL, NULL, > GDK_TYPE_DRAWABLE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_TEXT_WIDTH, >- g_param_spec_double ("text_width", >+ g_param_spec_double ("text-width", > _("Text width"), > _("Width of the rendered text"), > 0.0, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_TEXT_HEIGHT, >- g_param_spec_double ("text_height", >+ g_param_spec_double ("text-height", > _("Text height"), > _("Height of the rendered text"), > 0.0, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > /* Style props are set (explicitly applied) or not */ > #define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (gobject_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)) > >- ADD_SET_PROP ("family_set", PROP_FAMILY_SET, >+ ADD_SET_PROP ("family-set", PROP_FAMILY_SET, > _("Font family set"), > _("Whether this tag affects the font family")); > >- ADD_SET_PROP ("style_set", PROP_STYLE_SET, >+ ADD_SET_PROP ("style-set", PROP_STYLE_SET, > _("Font style set"), > _("Whether this tag affects the font style")); > >- ADD_SET_PROP ("variant_set", PROP_VARIANT_SET, >+ ADD_SET_PROP ("variant-set", PROP_VARIANT_SET, > _("Font variant set"), > _("Whether this tag affects the font variant")); > >- ADD_SET_PROP ("weight_set", PROP_WEIGHT_SET, >+ ADD_SET_PROP ("weight-set", PROP_WEIGHT_SET, > _("Font weight set"), > _("Whether this tag affects the font weight")); > >- ADD_SET_PROP ("stretch_set", PROP_STRETCH_SET, >+ ADD_SET_PROP ("stretch-set", PROP_STRETCH_SET, > _("Font stretch set"), > _("Whether this tag affects the font stretch")); > >- ADD_SET_PROP ("size_set", PROP_SIZE_SET, >+ ADD_SET_PROP ("size-set", PROP_SIZE_SET, > _("Font size set"), > _("Whether this tag affects the font size")); > >- ADD_SET_PROP ("rise_set", PROP_RISE_SET, >+ ADD_SET_PROP ("rise-set", PROP_RISE_SET, > _("Rise set"), > _("Whether this tag affects the rise")); > >- ADD_SET_PROP ("strikethrough_set", PROP_STRIKETHROUGH_SET, >+ ADD_SET_PROP ("strikethrough-set", PROP_STRIKETHROUGH_SET, > _("Strikethrough set"), > _("Whether this tag affects strikethrough")); > >- ADD_SET_PROP ("underline_set", PROP_UNDERLINE_SET, >+ ADD_SET_PROP ("underline-set", PROP_UNDERLINE_SET, > _("Underline set"), > _("Whether this tag affects underlining")); > >- ADD_SET_PROP ("scale_set", PROP_SCALE_SET, >+ ADD_SET_PROP ("scale-set", PROP_SCALE_SET, > _("Scale set"), > _("Whether this tag affects font scaling")); > #undef ADD_SET_PROP >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-widget.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/foo-canvas-widget.c,v >retrieving revision 1.5 >retrieving revision 1.5.4.1 >diff -u -w -p -r1.5 -r1.5.4.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-widget.c 29 Dec 2003 04:02:26 -0000 1.5 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-widget.c 13 May 2005 03:37:58 -0000 1.5.4.1 >@@ -75,6 +75,8 @@ static void foo_canvas_widget_bounds > static void foo_canvas_widget_draw (FooCanvasItem *item, > GdkDrawable *drawable, > GdkEventExpose *event); >+static void foo_canvas_widget_map (FooCanvasItem *item); >+static void foo_canvas_widget_unmap (FooCanvasItem *item); > > static FooCanvasItemClass *parent_class; > >@@ -124,44 +126,44 @@ foo_canvas_widget_class_init (FooCanvasW > PROP_WIDGET, > g_param_spec_object ("widget", NULL, NULL, > GTK_TYPE_WIDGET, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_X, > g_param_spec_double ("x", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_Y, > g_param_spec_double ("y", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_WIDTH, > g_param_spec_double ("width", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_HEIGHT, > g_param_spec_double ("height", NULL, NULL, > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_ANCHOR, > g_param_spec_enum ("anchor", NULL, NULL, > GTK_TYPE_ANCHOR_TYPE, > GTK_ANCHOR_NW, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, > PROP_SIZE_PIXELS, >- g_param_spec_boolean ("size_pixels", NULL, NULL, >+ g_param_spec_boolean ("size-pixels", NULL, NULL, > FALSE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > object_class->destroy = foo_canvas_widget_destroy; > >@@ -170,6 +172,8 @@ foo_canvas_widget_class_init (FooCanvasW > item_class->translate = foo_canvas_widget_translate; > item_class->bounds = foo_canvas_widget_bounds; > item_class->draw = foo_canvas_widget_draw; >+ item_class->map = foo_canvas_widget_map; >+ item_class->unmap = foo_canvas_widget_unmap; > } > > static void >@@ -484,6 +488,24 @@ foo_canvas_widget_draw (FooCanvasItem *i > if (witem->widget) > gtk_widget_queue_draw (witem->widget); > #endif >+} >+static void >+foo_canvas_widget_map (FooCanvasItem *item) >+{ >+ FooCanvasWidget *witem = FOO_CANVAS_WIDGET (item); >+ if (parent_class->map) >+ (* parent_class->map) (item); >+ if (witem->widget && GTK_WIDGET_VISIBLE (witem->widget)) >+ gtk_widget_map (witem->widget); >+} >+ >+static void >+foo_canvas_widget_unmap (FooCanvasItem *item) >+{ >+ FooCanvasWidget *witem = FOO_CANVAS_WIDGET (item); >+ if (parent_class->unmap) >+ (* parent_class->unmap) (item); >+ gtk_widget_unmap (witem->widget); > } > > static double >Index: src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/Attic/foo-canvas.c,v >retrieving revision 1.18 >retrieving revision 1.18.2.1 >diff -u -w -p -r1.18 -r1.18.2.1 >--- src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas.c 27 Dec 2004 21:58:03 -0000 1.18 >+++ src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas.c 13 May 2005 03:37:58 -0000 1.18.2.1 >@@ -1232,14 +1232,14 @@ foo_canvas_group_class_init (FooCanvasGr > _("X"), > _("X"), > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > g_object_class_install_property > (gobject_class, GROUP_PROP_Y, > g_param_spec_double ("y", > _("Y"), > _("Y"), > -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > object_class->destroy = foo_canvas_group_destroy; > >@@ -3965,13 +3965,13 @@ foo_canvas_item_class_init (FooCanvasIte > (gobject_class, ITEM_PROP_PARENT, > g_param_spec_object ("parent", NULL, NULL, > FOO_TYPE_CANVAS_ITEM, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > g_object_class_install_property > (gobject_class, ITEM_PROP_VISIBLE, > g_param_spec_boolean ("visible", NULL, NULL, > TRUE, >- (G_PARAM_READABLE | G_PARAM_WRITABLE))); >+ G_PARAM_READWRITE)); > > item_signals[ITEM_EVENT] = > g_signal_new ("event", >Index: src/cut-n-paste-code/goffice/graph/gog-object-xml.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/graph/Attic/gog-object-xml.c,v >retrieving revision 1.13 >retrieving revision 1.13.4.1 >diff -u -w -p -r1.13 -r1.13.4.1 >--- src/cut-n-paste-code/goffice/graph/gog-object-xml.c 5 Jun 2004 16:19:35 -0000 1.13 >+++ src/cut-n-paste-code/goffice/graph/gog-object-xml.c 15 Aug 2005 20:01:23 -0000 1.13.4.1 >@@ -497,6 +497,7 @@ gog_object_new_from_xml (GogObject *pare > res = g_object_new (type, NULL); > xmlFree (type_name); > explicitly_typed_role = TRUE; >+ g_return_val_if_fail (res != NULL, NULL); > } > role = xmlGetProp (node, (xmlChar const *) "role"); > if (role == NULL) { >Index: src/cut-n-paste-code/goffice/graph/plugins/plot_barcol/gog-1.5d.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/graph/plugins/plot_barcol/Attic/gog-1.5d.c,v >retrieving revision 1.27 >diff -u -w -p -r1.27 gog-1.5d.c >--- src/cut-n-paste-code/goffice/graph/plugins/plot_barcol/gog-1.5d.c 26 Oct 2004 13:23:50 -0000 1.27 >+++ src/cut-n-paste-code/goffice/graph/plugins/plot_barcol/gog-1.5d.c 14 Mar 2006 19:15:59 -0000 >@@ -91,6 +91,7 @@ gog_plot1_5d_set_property (GObject *obj, > if ((gog_1_5d->in_3d != 0) == (tmp != 0)) > return; > gog_1_5d->in_3d = tmp; >+ break; > } > > default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec); >@@ -324,7 +325,7 @@ gog_plot1_5d_class_init (GogPlotClass *p > "How to group multiple series, normal, stacked, as_percentage", > "normal", G_PARAM_READWRITE | GOG_PARAM_PERSISTENT)); > g_object_class_install_property (gobject_klass, GOG_1_5D_PROP_IN_3D, >- g_param_spec_boolean ("in_3d", "in_3d", >+ g_param_spec_boolean ("in-3d", "in-3d", > "Place holder to all us to round trip pseudo 3d state", > FALSE, G_PARAM_READWRITE | GOG_PARAM_PERSISTENT)); > >Index: src/cut-n-paste-code/goffice/gui-utils/go-action-combo-text.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/gui-utils/Attic/go-action-combo-text.c,v >retrieving revision 1.10 >retrieving revision 1.10.4.2 >diff -u -w -p -r1.10 -r1.10.4.2 >--- src/cut-n-paste-code/goffice/gui-utils/go-action-combo-text.c 26 May 2004 07:00:29 -0000 1.10 >+++ src/cut-n-paste-code/goffice/gui-utils/go-action-combo-text.c 30 Apr 2005 16:43:49 -0000 1.10.4.2 >@@ -78,11 +78,17 @@ struct _GOActionComboText { > GSList *elements; > char const *largest_elem; > char *entry_val; >+ gboolean case_sensitive; > }; > typedef struct { > GtkActionClass base; > } GOActionComboTextClass; > >+enum { >+ PROP_0, >+ PROP_CASE_SENSITIVE >+}; >+ > static GObjectClass *combo_text_parent; > > static void >@@ -107,6 +113,17 @@ go_action_combo_disconnect_proxy (GtkAct > } > #endif > >+static gint >+g_strcase_equal (gconstpointer s1, gconstpointer s2) >+{ >+ gchar *a2 = g_utf8_casefold ((const gchar*) s1, -1); >+ gchar *b2 = g_utf8_casefold ((const gchar*) s2, -1); >+ gint res = g_utf8_collate (a2, b2); >+ g_free (a2); >+ g_free (b2); >+ return !res; >+} >+ > static gboolean > cb_entry_changed (GoComboText *ct, char const *text, GOActionComboText *taction) > { >@@ -123,7 +140,7 @@ go_action_combo_create_tool_item (GtkAct > GSList *ptr; > int tmp, w = -1; > >- tool->combo = (GoComboText *)go_combo_text_new (NULL); >+ tool->combo = (GoComboText *)go_combo_text_new (taction->case_sensitive ? NULL : g_strcase_equal); > if (taction->largest_elem != NULL) > w = gnm_measure_string ( > gtk_widget_get_pango_context (GTK_WIDGET (tool->combo)), >@@ -163,6 +180,41 @@ go_action_combo_text_finalize (GObject * > { > combo_text_parent->finalize (obj); > } >+ >+static void >+go_action_combo_text_set_property (GObject *object, >+ guint prop_id, >+ GValue const *value, >+ GParamSpec *pspec) >+{ >+ GOActionComboText *taction = GO_ACTION_COMBO_TEXT (object); >+ >+ switch (prop_id) { >+ case PROP_CASE_SENSITIVE: >+ taction->case_sensitive = g_value_get_boolean (value); >+ break; >+ default: >+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); >+ } >+} >+ >+static void >+go_action_combo_text_get_property (GObject *object, >+ guint prop_id, >+ GValue *value, >+ GParamSpec *pspec) >+{ >+ GOActionComboText *taction = GO_ACTION_COMBO_TEXT (object); >+ >+ switch (prop_id) { >+ case PROP_CASE_SENSITIVE: >+ g_value_set_boolean (value, taction->case_sensitive); >+ break; >+ default: >+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); >+ } >+} >+ > static void > go_action_combo_text_class_init (GtkActionClass *gtk_act_klass) > { >@@ -177,6 +229,16 @@ go_action_combo_text_class_init (GtkActi > gtk_act_klass->connect_proxy = go_action_combo_stack_connect_proxy; > gtk_act_klass->disconnect_proxy = go_action_combo_stack_disconnect_proxy; > #endif >+ >+ gobject_klass->set_property = go_action_combo_text_set_property; >+ gobject_klass->get_property = go_action_combo_text_get_property; >+ >+ g_object_class_install_property (gobject_klass, >+ PROP_CASE_SENSITIVE, >+ g_param_spec_boolean ("case-sensitive", _("Case Sensitive"), >+ _("Should the text comparasion be case sensitive"), >+ TRUE, >+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); > } > > GSF_CLASS (GOActionComboText, go_action_combo_text, >Index: src/cut-n-paste-code/goffice/gui-utils/go-combo-text.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/gui-utils/Attic/go-combo-text.c,v >retrieving revision 1.4 >diff -u -w -p -r1.4 go-combo-text.c >--- src/cut-n-paste-code/goffice/gui-utils/go-combo-text.c 11 Jan 2005 19:58:22 -0000 1.4 >+++ src/cut-n-paste-code/goffice/gui-utils/go-combo-text.c 14 Mar 2006 19:15:59 -0000 >@@ -187,7 +187,6 @@ go_combo_text_init (GoComboText *ct) > ct->rows = 0; > ct->entry = gtk_entry_new (); > ct->list = gtk_tree_view_new (); >- g_object_set (G_OBJECT (ct->list), NULL); > gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (ct->list), FALSE); > store = gtk_list_store_new (1, G_TYPE_STRING); > gtk_tree_view_set_model (GTK_TREE_VIEW (ct->list), GTK_TREE_MODEL (store)); >Index: src/dialogs/dialog-autofilter.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-autofilter.c,v >retrieving revision 1.19 >retrieving revision 1.19.4.1 >diff -u -w -p -r1.19 -r1.19.4.1 >--- src/dialogs/dialog-autofilter.c 16 May 2004 09:11:47 -0000 1.19 >+++ src/dialogs/dialog-autofilter.c 13 May 2005 03:42:32 -0000 1.19.4.1 >@@ -92,12 +92,12 @@ map_op (AutoFilterState *state, GnmFilte > > case 7: > case 8: *op = (i == 8) ? GNM_FILTER_OP_NOT_EQUAL : GNM_FILTER_OP_EQUAL; >- v = value_new_string_nocopy (g_strconcat ("*", txt, NULL)); >+ v = value_new_string_nocopy (g_strconcat (txt, "*", NULL)); > break; > > case 9: > case 10: *op = (i == 10) ? GNM_FILTER_OP_NOT_EQUAL : GNM_FILTER_OP_EQUAL; >- v = value_new_string_nocopy (g_strconcat (txt, "*", NULL)); >+ v = value_new_string_nocopy (g_strconcat ("*", txt, NULL)); > break; > > case 11: >@@ -187,6 +187,8 @@ init_operator (AutoFilterState *state, G > char const *op_widget, char const *val_widget) > { > GtkWidget *w = glade_xml_get_widget (state->gui, op_widget); >+ char const *str = v ? value_peek_string (v) : NULL; >+ char *content = NULL; > int i; > > switch (op) { >@@ -201,23 +203,27 @@ init_operator (AutoFilterState *state, G > }; > > if (v != NULL && v->type == VALUE_STRING && (i == 1 || i == 2)) { >- char const *str = v->v_str.val->str; > unsigned const len = strlen (str); >+ > /* there needs to be at least 1 letter */ >- gboolean starts = (len > 1 && str[0] == '*'); >- gboolean ends = (len > 1 && str[len-1] == '*' && str[len-2] != '~'); >+ int ends = (len > 1 && str[0] == '*') ? 1 : 0; /* as a bool and offset */ > >- if (starts) >+ if (len > 1 && str[len-1] == '*' && str[len-2] != '~') { >+ content = g_strdup (str + ends); >+ content[len - ends - 1] = '\0'; > i += (ends ? 10 : 6); >- else if (ends) >+ } else if (ends) { >+ str += 1; > i += 8; > } >+ } > gtk_combo_box_set_active (GTK_COMBO_BOX (w), i); > > if (v != NULL) { > w = glade_xml_get_widget (state->gui, val_widget); >- gtk_entry_set_text (GTK_ENTRY (w), value_peek_string (v)); >+ gtk_entry_set_text (GTK_ENTRY (w), content ? content : str); > } >+ g_free (content); > } > > void >Index: src/dialogs/dialog-function-select.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-function-select.c,v >retrieving revision 1.80 >retrieving revision 1.80.2.1 >diff -u -w -p -r1.80 -r1.80.2.1 >--- src/dialogs/dialog-function-select.c 2 Nov 2004 23:46:38 -0000 1.80 >+++ src/dialogs/dialog-function-select.c 9 Apr 2005 08:15:31 -0000 1.80.2.1 >@@ -116,7 +116,7 @@ dialog_function_write_recent_func (Funct > (gconf_value_list, g_strdup (gnm_func_get_name (rec_funcs->data))); > } > gnm_gconf_set_recent_funcs (gconf_value_list); >- go_conf_sync (); >+ go_conf_sync (NULL); > } > > >Index: src/dialogs/dialog-paste-special.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-paste-special.c,v >retrieving revision 1.44 >diff -u -w -p -r1.44 dialog-paste-special.c >--- src/dialogs/dialog-paste-special.c 28 Sep 2004 02:59:48 -0000 1.44 >+++ src/dialogs/dialog-paste-special.c 14 Mar 2006 19:15:59 -0000 >@@ -193,7 +193,7 @@ dialog_paste_special (WorkbookControlGUI > state = g_new0 (PasteSpecialState, 1); > state->wbcg = wbcg; > state->dialog = GTK_DIALOG (tmp); >- gtk_dialog_set_default_response (state->dialog, GTK_RESPONSE_CANCEL); >+ gtk_dialog_set_default_response (state->dialog, GTK_RESPONSE_OK); > > f1 = gtk_frame_new (_("Paste type")); > f1v = gtk_vbox_new (TRUE, 0); >Index: src/dialogs/dialog-preferences.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-preferences.c,v >retrieving revision 1.65 >retrieving revision 1.65.2.3 >diff -u -w -p -r1.65 -r1.65.2.3 >--- src/dialogs/dialog-preferences.c 13 Nov 2004 20:34:48 -0000 1.65 >+++ src/dialogs/dialog-preferences.c 12 Aug 2005 17:10:12 -0000 1.65.2.3 >@@ -74,6 +74,7 @@ typedef struct { > GtkTreeStore *store; > GtkTreeView *view; > Workbook *wb; >+ GOConfNode *root; > } PrefState; > > typedef void (* double_conf_setter_t) (gnm_float value); >@@ -125,7 +126,7 @@ dialog_pref_load_description (PrefState > static void > dialog_pref_load_description_from_key (PrefState *state, char const *key) > { >- char *long_desc = go_conf_get_long_desc (key); >+ char *long_desc = go_conf_get_long_desc (state->root, key); > > if (long_desc == NULL) > dialog_pref_load_description (state, ""); >@@ -136,9 +137,9 @@ dialog_pref_load_description_from_key (P > } > > static void >-set_tip (char const *key, GtkWidget *item) >+set_tip (GOConfNode *node, char const *key, GtkWidget *item) > { >- char *desc = go_conf_get_long_desc (key); >+ char *desc = go_conf_get_long_desc (node, key); > if (desc != NULL) { > GtkTooltips *the_tip = gtk_tooltips_new (); > gtk_tooltips_set_tip (the_tip, item, desc, NULL); >@@ -153,10 +154,10 @@ cb_pref_notification_destroy (gpointer h > } > > static void >-connect_notification (char const *key, GOConfMonitorFunc func, >+connect_notification (GOConfNode *node, char const *key, GOConfMonitorFunc func, > gpointer data, GtkWidget *container) > { >- guint handle = go_conf_add_monitor (key, func, data); >+ guint handle = go_conf_add_monitor (node, key, func, data); > g_signal_connect_swapped (G_OBJECT (container), "destroy", > G_CALLBACK (cb_pref_notification_destroy), > GUINT_TO_POINTER (handle)); >@@ -172,26 +173,26 @@ bool_pref_widget_to_conf (GtkToggleButto > setter (gtk_toggle_button_get_active (button)); > } > static void >-bool_pref_conf_to_widget (char const *key, GtkToggleButton *button) >+bool_pref_conf_to_widget (GOConfNode *node, char const *key, GtkToggleButton *button) > { > gboolean val_in_button = gtk_toggle_button_get_active (button); >- gboolean val_in_conf = go_conf_get_bool (key); >+ gboolean val_in_conf = go_conf_get_bool (node, key); > if ((val_in_button != FALSE) != (val_in_conf != FALSE)) > gtk_toggle_button_set_active (button, val_in_conf); > } > static void >-bool_pref_create_widget (char const *key, GtkWidget *table, gint row, >- gboolean_conf_setter_t setter, >+bool_pref_create_widget (GOConfNode *node, char const *key, GtkWidget *table, >+ gint row, gboolean_conf_setter_t setter, > char const *default_text) > { >- char *desc = go_conf_get_short_desc (key); >+ char *desc = go_conf_get_short_desc (node, key); > GtkWidget *item = gtk_check_button_new_with_label ( > (desc != NULL) ? desc : default_text); > > if (desc != NULL) > g_free (desc); > >- bool_pref_conf_to_widget (key, GTK_TOGGLE_BUTTON (item)); >+ bool_pref_conf_to_widget (node, key, GTK_TOGGLE_BUTTON (item)); > g_signal_connect (G_OBJECT (item), > "toggled", > G_CALLBACK (bool_pref_widget_to_conf), (gpointer) setter); >@@ -199,9 +200,9 @@ bool_pref_create_widget (char const *key > 0, 2, row, row + 1, > GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK, 5, 5); > >- connect_notification (key, (GOConfMonitorFunc)bool_pref_conf_to_widget, >+ connect_notification (node, key, (GOConfMonitorFunc)bool_pref_conf_to_widget, > item, table); >- set_tip (key, item); >+ set_tip (node, key, item); > } > > /*************************************************************************/ >@@ -215,19 +216,19 @@ int_pref_widget_to_conf (GtkSpinButton * > } > > static void >-int_pref_conf_to_widget (char const *key, GtkSpinButton *button) >+int_pref_conf_to_widget (GOConfNode *node, char const *key, GtkSpinButton *button) > { > gint val_in_button = gtk_spin_button_get_value_as_int (button); >- gint val_in_conf = go_conf_get_int (key); >+ gint val_in_conf = go_conf_get_int (node, key); > if (val_in_conf != val_in_button) > gtk_spin_button_set_value (button, (gdouble) val_in_conf); > } > static void >-int_pref_create_widget (char const *key, GtkWidget *table, gint row, >- gint val, gint from, gint to, gint step, >+int_pref_create_widget (GOConfNode *node, char const *key, GtkWidget *table, >+ gint row, gint val, gint from, gint to, gint step, > gint_conf_setter_t setter, char const *default_text) > { >- char *desc = go_conf_get_short_desc (key); >+ char *desc = go_conf_get_short_desc (node, key); > GtkWidget *item = gtk_label_new > ((desc != NULL) ? desc : default_text); > >@@ -243,7 +244,7 @@ int_pref_create_widget (char const *key, > gtk_adjustment_new (val, from, to, step, > step, step)), > 1, 0); >- int_pref_conf_to_widget (key, GTK_SPIN_BUTTON (item)); >+ int_pref_conf_to_widget (node, key, GTK_SPIN_BUTTON (item)); > g_signal_connect (G_OBJECT (item), > "value-changed", > G_CALLBACK (int_pref_widget_to_conf), (gpointer) setter); >@@ -251,9 +252,9 @@ int_pref_create_widget (char const *key, > 1, 2, row, row + 1, > GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 5, 2); > >- connect_notification (key, (GOConfMonitorFunc)int_pref_conf_to_widget, >+ connect_notification (node, key, (GOConfMonitorFunc)int_pref_conf_to_widget, > item, table); >- set_tip (key, item); >+ set_tip (node, key, item); > } > > /*************************************************************************/ >@@ -267,22 +268,22 @@ double_pref_widget_to_conf (GtkSpinButto > } > > static void >-double_pref_conf_to_widget (char const *key, GtkSpinButton *button) >+double_pref_conf_to_widget (GOConfNode *node, char const *key, GtkSpinButton *button) > { > double val_in_button = gtk_spin_button_get_value (button); >- double val_in_conf = go_conf_get_double (key); >+ double val_in_conf = go_conf_get_double (node, key); > > if (fabs (val_in_conf - val_in_button) > 1e-10) /* dead simple */ > gtk_spin_button_set_value (button, val_in_conf); > } > static void >-double_pref_create_widget (char const *key, GtkWidget *table, gint row, >- gnm_float val, gnm_float from, gnm_float to, >+double_pref_create_widget (GOConfNode *node, char const *key, GtkWidget *table, >+ gint row, gnm_float val, gnm_float from,gnm_float to, > gnm_float step, > gint digits, double_conf_setter_t setter, > char const *default_text) > { >- char *desc = go_conf_get_short_desc (key); >+ char *desc = go_conf_get_short_desc (node, key); > GtkWidget *item = gtk_label_new (desc ? desc : default_text); > > if (desc != NULL) >@@ -296,7 +297,7 @@ double_pref_create_widget (char const *k > item = gtk_spin_button_new (GTK_ADJUSTMENT ( > gtk_adjustment_new (val, from, to, step, step, step)), > 1, digits); >- double_pref_conf_to_widget (key, GTK_SPIN_BUTTON (item)); >+ double_pref_conf_to_widget (node, key, GTK_SPIN_BUTTON (item)); > g_signal_connect (G_OBJECT (item), > "value-changed", > G_CALLBACK (double_pref_widget_to_conf), >@@ -305,9 +306,9 @@ double_pref_create_widget (char const *k > 1, 2, row, row + 1, > GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 5, 2); > >- connect_notification (key, (GOConfMonitorFunc)double_pref_conf_to_widget, >+ connect_notification (node, key, (GOConfMonitorFunc)double_pref_conf_to_widget, > item, table); >- set_tip (key, item); >+ set_tip (node, key, item); > } > > >@@ -324,17 +325,17 @@ pref_font_page_open (PrefState *state, G > } > > static void >-cb_pref_font_set_fonts (char const *key, GtkWidget *page) >+cb_pref_font_set_fonts (GOConfNode *node, char const *key, GtkWidget *page) > { >- if (key == NULL || 0 == strcmp (key, GNM_CONF_FONT_NAME)) >+ if (!key || g_str_has_suffix (key, GNM_CONF_FONT_NAME)) > font_selector_set_name (FONT_SELECTOR (page), > gnm_app_prefs->default_font.name); >- if (key == NULL || 0 == strcmp (key, GNM_CONF_FONT_SIZE)) >+ if (!key || g_str_has_suffix (key, GNM_CONF_FONT_SIZE)) > font_selector_set_points (FONT_SELECTOR (page), > gnm_app_prefs->default_font.size); >- if (key == NULL || >- 0 == strcmp (key, GNM_CONF_FONT_BOLD) || >- 0 == strcmp (key, GNM_CONF_FONT_ITALIC)) >+ if (!key || >+ g_str_has_suffix (key, GNM_CONF_FONT_BOLD) || >+ g_str_has_suffix (key, GNM_CONF_FONT_ITALIC)) > font_selector_set_style (FONT_SELECTOR (page), > gnm_app_prefs->default_font.is_bold, > gnm_app_prefs->default_font.is_italic); >@@ -367,9 +368,9 @@ pref_font_initializer (PrefState *state, > { > GtkWidget *page = font_selector_new (); > >- cb_pref_font_set_fonts (NULL, page); >+ cb_pref_font_set_fonts (NULL, NULL, page); > >- connect_notification (GNM_CONF_FONT_DIRECTORY, >+ connect_notification (state->root, GNM_CONF_FONT_DIR, > (GOConfMonitorFunc) cb_pref_font_set_fonts, > page, page); > g_signal_connect (G_OBJECT (page), >@@ -394,23 +395,29 @@ pref_font_hf_page_open (PrefState *state > } > > static void >-cb_pref_font_hf_set_fonts (char const *key, GtkWidget *page) >+cb_pref_font_hf_set_fonts (GOConfNode *node, char const *key, GtkWidget *page) > { >- if (key == NULL || 0 == strcmp (key, PRINTSETUP_GCONF_HF_FONT_NAME)) { >- char *name = go_conf_load_string (PRINTSETUP_GCONF_HF_FONT_NAME); >+ node = gnm_conf_get_root (); >+ if (!key || >+ g_str_has_suffix (key, PRINTSETUP_GCONF_HF_FONT_NAME)) { >+ gchar *name = go_conf_load_string ( >+ node, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HF_FONT_NAME); > font_selector_set_name (FONT_SELECTOR (page), name); > g_free (name); > } >- if (key == NULL || 0 == strcmp (key, PRINTSETUP_GCONF_HF_FONT_SIZE)) >+ if (!key || >+ g_str_has_suffix (key, PRINTSETUP_GCONF_HF_FONT_SIZE)) > font_selector_set_points (FONT_SELECTOR (page), >- go_conf_get_double (PRINTSETUP_GCONF_HF_FONT_SIZE)); >- >- if (key == NULL || >- 0 == strcmp (key, PRINTSETUP_GCONF_HF_FONT_BOLD) || >- 0 == strcmp (key, PRINTSETUP_GCONF_HF_FONT_ITALIC)) >+ go_conf_get_double ( >+ node, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HF_FONT_SIZE)); >+ if (!key || >+ g_str_has_suffix (key, PRINTSETUP_GCONF_HF_FONT_BOLD) || >+ g_str_has_suffix (key, PRINTSETUP_GCONF_HF_FONT_ITALIC)) > font_selector_set_style (FONT_SELECTOR (page), >- go_conf_get_bool (PRINTSETUP_GCONF_HF_FONT_BOLD), >- go_conf_get_bool (PRINTSETUP_GCONF_HF_FONT_ITALIC)); >+ go_conf_get_bool ( >+ node, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HF_FONT_BOLD), >+ go_conf_get_bool ( >+ node, PRINTSETUP_GCONF_DIR "/" PRINTSETUP_GCONF_HF_FONT_ITALIC)); > } > > static gboolean >@@ -429,8 +436,8 @@ pref_font_hf_initializer (PrefState *sta > { > GtkWidget *page = font_selector_new (); > >- cb_pref_font_hf_set_fonts (NULL, page); >- connect_notification (PRINTSETUP_GCONF_DIRECTORY, >+ cb_pref_font_hf_set_fonts (state->root, NULL, page); >+ connect_notification (state->root, PRINTSETUP_GCONF_DIR, > (GOConfMonitorFunc) cb_pref_font_hf_set_fonts, > page, page); > g_signal_connect (G_OBJECT (page), >@@ -463,23 +470,26 @@ pref_undo_page_initializer (PrefState *s > { > GtkWidget *page = gtk_table_new (4, 2, FALSE); > gint row = 0; >+ GOConfNode *node; > >- int_pref_create_widget (GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH, >+ node = go_conf_get_node (state->root, GNM_CONF_UNDO_DIR); >+ int_pref_create_widget (node, GNM_CONF_UNDO_MAX_DESCRIPTOR_WIDTH, > page, row++, 5, 5, 200, 1, > gnm_gconf_set_max_descriptor_width, > _("Length of Undo Descriptors")); >- int_pref_create_widget (GNM_CONF_UNDO_SIZE, >+ int_pref_create_widget (node, GNM_CONF_UNDO_SIZE, > page, row++, 1000, 0, 30000, 100, > gnm_gconf_set_undo_size, > _("Maximal Undo Size")); >- int_pref_create_widget (GNM_CONF_UNDO_MAXNUM, >+ int_pref_create_widget (node, GNM_CONF_UNDO_MAXNUM, > page, row++, 20, 1, 200, 1, > gnm_gconf_set_undo_max_number, > _("Number of Undo Items")); >- bool_pref_create_widget (GNM_CONF_UNDO_SHOW_SHEET_NAME, >+ bool_pref_create_widget (node, GNM_CONF_UNDO_SHOW_SHEET_NAME, > page, row++, > gnm_gconf_set_show_sheet_name, > _("Show Sheet Name in Undo List")); >+ go_conf_free_node (node); > > gtk_widget_show_all (page); > return page; >@@ -508,23 +518,26 @@ pref_sort_page_initializer (PrefState *s > { > GtkWidget *page = gtk_table_new (3, 2, FALSE); > gint row = 0; >+ GOConfNode *node; > >- int_pref_create_widget (GNM_CONF_SORT_DIALOG_MAX_INITIAL, >+ node = go_conf_get_node (state->root, GNM_CONF_SORT_DIR); >+ int_pref_create_widget (node, GNM_CONF_SORT_DIALOG_MAX_INITIAL, > page, row++, 10, 0, 50, 1, > gnm_gconf_set_sort_dialog_max_initial, > _("Number of Automatic Clauses")); >- bool_pref_create_widget (GNM_CONF_SORT_DEFAULT_RETAIN_FORM, >+ bool_pref_create_widget (node, GNM_CONF_SORT_DEFAULT_RETAIN_FORM, > page, row++, > gnm_gconf_set_sort_retain_form, > _("Sorting Preserves Formats")); >- bool_pref_create_widget (GNM_CONF_SORT_DEFAULT_BY_CASE, >+ bool_pref_create_widget (node, GNM_CONF_SORT_DEFAULT_BY_CASE, > page, row++, > gnm_gconf_set_sort_by_case, > _("Sorting is Case-Sensitive")); >- bool_pref_create_widget (GNM_CONF_SORT_DEFAULT_ASCENDING, >+ bool_pref_create_widget (node, GNM_CONF_SORT_DEFAULT_ASCENDING, > page, row++, > gnm_gconf_set_sort_ascending, > _("Sort Ascending")); >+ go_conf_free_node (node); > > gtk_widget_show_all (page); > return page; >@@ -553,31 +566,34 @@ pref_window_page_initializer (PrefState > { > GtkWidget *page = gtk_table_new (4, 2, FALSE); > gint row = 0; >+ GOConfNode *node; > >- double_pref_create_widget (GNM_CONF_GUI_WINDOW_Y, >+ node = go_conf_get_node (state->root, GNM_CONF_GUI_DIR); >+ double_pref_create_widget (node, GNM_CONF_GUI_WINDOW_Y, > page, row++, 0.75, 0.25, 1, 0.05, 2, > gnm_gconf_set_gui_window_y, > _("Default Vertical Window Size")); >- double_pref_create_widget (GNM_CONF_GUI_WINDOW_X, >+ double_pref_create_widget (node, GNM_CONF_GUI_WINDOW_X, > page, row++, 0.75, 0.25, 1, 0.05, 2, > gnm_gconf_set_gui_window_x, > _("Default Horizontal Window Size")); >- double_pref_create_widget (GNM_CONF_GUI_ZOOM, >+ double_pref_create_widget (node, GNM_CONF_GUI_ZOOM, > page, row++, 1.00, 0.10, 5.00, 0.05, 2, > gnm_gconf_set_gui_zoom, > _("Default Zoom Factor")); >- int_pref_create_widget (GNM_CONF_WORKBOOK_NSHEETS, >+ int_pref_create_widget (state->root, GNM_CONF_WORKBOOK_NSHEETS, > page, row++, 1, 1, 64, 1, > gnm_gconf_set_workbook_nsheets, > _("Default Number of Sheets")); >- bool_pref_create_widget (GNM_CONF_GUI_ED_TRANSITION_KEYS, >+ bool_pref_create_widget (node, GNM_CONF_GUI_ED_TRANSITION_KEYS, > page, row++, > gnm_gconf_set_gui_transition_keys, > _("Transition Keys")); >- bool_pref_create_widget (GNM_CONF_GUI_ED_LIVESCROLLING, >+ bool_pref_create_widget (node, GNM_CONF_GUI_ED_LIVESCROLLING, > page, row++, > gnm_gconf_set_gui_livescrolling, > _("Live Scrolling")); >+ go_conf_free_node (node); > > gtk_widget_show_all (page); > return page; >@@ -605,29 +621,33 @@ pref_file_page_initializer (PrefState *s > { > GtkWidget *page = gtk_table_new (2, 2, FALSE); > gint row = 0; >+ GOConfNode *node; > >- int_pref_create_widget (GNM_CONF_FILE_HISTORY_N, >+ node = go_conf_get_node (state->root, GNM_CONF_FILE_DIR); >+ int_pref_create_widget (node, GNM_CONF_FILE_HISTORY_N, > page, row++, 4, 0, 40, 1, > gnm_gconf_set_file_history_number, > _("Length of File History")); >- int_pref_create_widget (GNM_CONF_XML_COMPRESSION, >+ int_pref_create_widget (state->root, GNM_CONF_XML_COMPRESSION, > page, row++, 9, 0, 9, 1, > gnm_gconf_set_xml_compression, > _("Default Compression Level For " > "Gnumeric Files")); >- bool_pref_create_widget (GNM_CONF_FILE_OVERWRITE_DEFAULT, >+ bool_pref_create_widget (node, GNM_CONF_FILE_OVERWRITE_DEFAULT, > page, row++, > gnm_gconf_set_file_overwrite, > _("Default To Overwriting Files")); >- bool_pref_create_widget (GNM_CONF_FILE_SINGLE_SHEET_SAVE, >+ bool_pref_create_widget (node, GNM_CONF_FILE_SINGLE_SHEET_SAVE, > page, row++, > gnm_gconf_set_file_single_sheet_save, > _("Warn When Exporting Into Single " > "Sheet Format")); >- bool_pref_create_widget (PLUGIN_GCONF_LATEX_USE_UTF8, >+ bool_pref_create_widget (state->root, >+ PLUGIN_GCONF_LATEX "/" PLUGIN_GCONF_LATEX_USE_UTF8, > page, row++, > gnm_gconf_set_latex_use_utf8, > _("Use UTF-8 in LaTeX Export")); >+ go_conf_free_node (node); > > gtk_widget_show_all (page); > return page; >@@ -655,15 +675,18 @@ pref_screen_page_initializer (PrefState > { > GtkWidget *page = gtk_table_new (2, 2, FALSE); > gint row = 0; >+ GOConfNode *node; > >- double_pref_create_widget (GNM_CONF_GUI_RES_H, page, row++, >+ node = go_conf_get_node (state->root, GNM_CONF_GUI_DIR); >+ double_pref_create_widget (node, GNM_CONF_GUI_RES_H, page, row++, > 96, 50, 250, 1, 1, > gnm_gconf_set_gui_resolution_h, > _("Horizontal DPI")); >- double_pref_create_widget (GNM_CONF_GUI_RES_V, page, row++, >+ double_pref_create_widget (node, GNM_CONF_GUI_RES_V, page, row++, > 96, 50, 250, 1, 1, > gnm_gconf_set_gui_resolution_v, > _("Vertical DPI")); >+ go_conf_free_node (node); > > gtk_widget_show_all (page); > return page; >@@ -693,16 +716,19 @@ pref_tool_page_initializer (PrefState *s > GtkWidget *page = gtk_table_new (2, 2, FALSE); > gint row = 0; > >- int_pref_create_widget (FUNCTION_SELECT_GCONF_NUM_OF_RECENT, >+ int_pref_create_widget (state->root, >+ FUNCTION_SELECT_GCONF_DIR "/" FUNCTION_SELECT_GCONF_NUM_OF_RECENT, > page, row++, 10, 0, 40, 1, > gnm_gconf_set_num_recent_functions, > _("Maximum Length of Recently " > "Used Functions List")); >- bool_pref_create_widget (GNM_CONF_GUI_ED_AUTOCOMPLETE, >+ bool_pref_create_widget (state->root, >+ GNM_CONF_GUI_DIR "/" GNM_CONF_GUI_ED_AUTOCOMPLETE, > page, row++, > gnm_gconf_set_autocomplete, > _("Autocomplete")); >- bool_pref_create_widget (DIALOGS_GCONF_UNFOCUSED_RS, >+ bool_pref_create_widget (state->root, >+ DIALOGS_GCONF_DIR "/" DIALOGS_GCONF_UNFOCUSED_RS, > page, row++, > gnm_gconf_set_unfocused_rs, > _("Allow Unfocused Range Selections")); >@@ -735,7 +761,8 @@ pref_copypaste_page_initializer (PrefSta > GtkWidget *page = gtk_table_new (2, 2, FALSE); > gint row = 0; > >- bool_pref_create_widget (GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD, >+ bool_pref_create_widget (state->root, >+ GNM_CONF_CUTANDPASTE_DIR "/" GNM_CONF_CUTANDPASTE_PREFER_CLIPBOARD, > page, row++, > gnm_gconf_set_prefer_clipboard, > _("Prefer CLIPBOARD over PRIMARY selection")); >@@ -811,7 +838,7 @@ cb_dialog_pref_selection_changed (GtkTre > static gboolean > cb_preferences_destroy (PrefState *state) > { >- go_conf_sync (); >+ go_conf_sync (state->root); > > if (state->gui != NULL) { > g_object_unref (G_OBJECT (state->gui)); >@@ -870,6 +897,7 @@ dialog_preferences (WorkbookControlGUI * > return; > > state = g_new0 (PrefState, 1); >+ state->root = gnm_conf_get_root (); > state->gui = gui; > state->dialog = glade_xml_get_widget (gui, "preferences"); > state->notebook = glade_xml_get_widget (gui, "notebook"); >Index: src/dialogs/dialog-solver.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-solver.c,v >retrieving revision 1.148 >diff -u -w -p -r1.148 dialog-solver.c >--- src/dialogs/dialog-solver.c 5 Nov 2004 03:29:59 -0000 1.148 >+++ src/dialogs/dialog-solver.c 14 Mar 2006 19:15:59 -0000 >@@ -178,7 +178,7 @@ is_hom_row_or_col_ref (GnmExprEntry *ent > return res; > } > >-static void >+static gboolean > dialog_set_sec_button_sensitivity (G_GNUC_UNUSED GtkWidget *dummy, > SolverState *state) > { >@@ -198,6 +198,9 @@ dialog_set_sec_button_sensitivity (G_GNU > gtk_widget_set_sensitive (state->add_button, ready); > gtk_widget_set_sensitive (state->change_button, select_ready && ready); > gtk_widget_set_sensitive (state->delete_button, select_ready); >+ >+ /* Return TRUE iff the current constraint is valid. */ >+ return ready; > } > > static void >@@ -258,18 +261,19 @@ release_constraint (constraint_t * data) > static void > cb_dialog_delete_clicked (G_GNUC_UNUSED GtkWidget *button, SolverState *state) > { >+ if (state->constr != NULL) { > GtkTreeIter iter; > GtkTreeModel *store; >- if (state->constr != NULL) { >+ > release_constraint (state->constr); > state->constr = NULL; >- } else >- return; >- gtk_tree_selection_get_selected ( >+ >+ if (gtk_tree_selection_get_selected ( > gtk_tree_view_get_selection (state->constraint_list), >- &store, &iter); >+ &store, &iter)) > gtk_list_store_remove ((GtkListStore*)store, &iter); > } >+} > > static constraint_t* > constraint_fill_row (SolverState *state, GtkListStore *store, GtkTreeIter *iter) >@@ -319,27 +323,31 @@ constraint_fill_row (SolverState *state, > static void > cb_dialog_add_clicked (SolverState *state) > { >+ if (dialog_set_sec_button_sensitivity (NULL, state)) { > GtkTreeIter iter; > GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model (state->constraint_list)); >+ > gtk_list_store_append (store, &iter); > constraint_fill_row (state, store, &iter); > } >+} > > static void > cb_dialog_change_clicked (GtkWidget *button, SolverState *state) > { >+ if (state->constr != NULL) { > GtkTreeIter iter; > GtkTreeModel *store; >- if (state->constr != NULL) { >+ > release_constraint (state->constr); > state->constr = NULL; >- } else >- return; >- gtk_tree_selection_get_selected ( >+ >+ if (gtk_tree_selection_get_selected ( > gtk_tree_view_get_selection (state->constraint_list), >- &store, &iter); >+ &store, &iter)) > state->constr = constraint_fill_row (state, (GtkListStore *)store, &iter); > } >+} > > static void > dialog_set_main_button_sensitivity (G_GNUC_UNUSED GtkWidget *dummy, >@@ -528,20 +536,31 @@ check_int_constraints (GnmValue *input_r > { > GtkTreeModel *store; > GtkTreeIter iter; >- const constraint_t *a_constraint; >- const gchar *text; > > store = gtk_tree_view_get_model (state->constraint_list); > if (gtk_tree_model_get_iter_first (store, &iter)) > do { >+ const constraint_t *a_constraint; >+ gchar *text; >+ > gtk_tree_model_get (store, &iter, 0, &text, 1, &a_constraint, -1); >- if (a_constraint == NULL) >+ if (a_constraint == NULL) { >+ g_free (text); > break; >+ } >+ > if ((a_constraint->type != SolverINT) && >- (a_constraint->type != SolverBOOL)) >+ (a_constraint->type != SolverBOOL)) { >+ g_free (text); > continue; >- if (!global_range_contained (state->sheet, a_constraint->lhs_value, input_range)) >+ } >+ >+ if (!global_range_contained (state->sheet, >+ a_constraint->lhs_value, >+ input_range)) > return text; >+ >+ g_free (text); > } while (gtk_tree_model_iter_next (store, &iter)); > return NULL; > } >@@ -666,19 +685,6 @@ save_original_values (GSList *input_cell > return ov; > } > >-/** >- * cb_destroy: >- * @data: >- * @user_data: >- * >- * >- **/ >-static void >-cb_destroy (gpointer data, G_GNUC_UNUSED gpointer user_data) >-{ >- g_free (data); >-} >- > > /* Returns FALSE if the reports deleted the current sheet > * and forced the dialog to die */ >@@ -791,7 +797,7 @@ solver_reporting (SolverState *state, So > } > > static void >-solver_add_scenario (SolverState *state, SolverResults *res, gchar *name) >+solver_add_scenario (SolverState *state, SolverResults *res, const gchar *name) > { > SolverParameters *param = res->param; > GnmValue *input_range; >@@ -801,8 +807,8 @@ solver_add_scenario (SolverState *state, > input_range = gnm_expr_entry_parse_as_value (state->change_cell_entry, > state->sheet); > >- scenario_add_new (name, input_range, g_strdup (param->input_entry_str), >- g_strdup (comment), state->sheet, &scenario); >+ scenario_add_new (name, input_range, param->input_entry_str, >+ comment, state->sheet, &scenario); > scenario_add (state->sheet, scenario); > if (input_range != NULL) > value_release (input_range); >@@ -957,11 +963,10 @@ cb_dialog_solve_clicked (G_GNUC_UNUSED G > conv.sheet = state->sheet; > conv.c_listing = state->constraint_list; > convert_constraint_format (&conv); >- if (param->constraints != NULL) { >- g_slist_foreach (param->constraints, cb_destroy, NULL); >+ g_slist_foreach (param->constraints, >+ (GFunc)solver_constraint_destroy, >+ NULL); > g_slist_free (param->constraints); >- param->constraints = NULL; >- } > param->constraints = conv.c_list; > if (param->constraints == NULL) { > gnumeric_notice_nonmodal >Index: src/dialogs/dialog-stf-csv-page.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-stf-csv-page.c,v >retrieving revision 1.44 >diff -u -w -p -r1.44 dialog-stf-csv-page.c >--- src/dialogs/dialog-stf-csv-page.c 28 Sep 2004 02:56:10 -0000 1.44 >+++ src/dialogs/dialog-stf-csv-page.c 14 Mar 2006 19:15:59 -0000 >@@ -94,8 +94,7 @@ csv_page_global_change (G_GNUC_UNUSED Gt > trim = parseoptions->trim_spaces; > stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_NEVER); > lines = stf_parse_general (parseoptions, lines_chunk, >- pagedata->cur, pagedata->cur_end, >- LINE_DISPLAY_LIMIT); >+ pagedata->cur, pagedata->cur_end); > stf_parse_options_set_trim_spaces (parseoptions, trim); > > stf_preview_set_lines (renderdata, lines_chunk, lines); >Index: src/dialogs/dialog-stf-export.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-stf-export.c,v >retrieving revision 1.37 >retrieving revision 1.37.2.1 >diff -u -w -p -r1.37 -r1.37.2.1 >--- src/dialogs/dialog-stf-export.c 2 Nov 2004 23:59:41 -0000 1.37 >+++ src/dialogs/dialog-stf-export.c 4 Apr 2005 17:05:24 -0000 1.37.2.1 >@@ -162,6 +162,7 @@ cb_collect_exported_sheets (GtkTreeModel > -1); > if (exported) > stf_export_options_sheet_list_add (state->result, sheet); >+ g_object_unref (sheet); > return FALSE; > } > static void >@@ -569,6 +570,7 @@ stf_export_dialog (WorkbookControlGUI *w > stf_export_dialog_sheet_page_init (&state); > stf_export_dialog_format_page_init (&state); > if (state.sheets.non_empty == 0) { >+ gtk_widget_destroy (GTK_WIDGET (state.window)); > gnumeric_notice (wbcg_toplevel (wbcg), GTK_MESSAGE_ERROR, > _("This workbook does not contain any " > "exportable content.")); >@@ -589,6 +591,7 @@ stf_export_dialog (WorkbookControlGUI *w > GTK_DIALOG (state.window)); > } > g_object_unref (G_OBJECT (state.gui)); >+ g_object_unref (state.sheets.model); > > return state.result; > } >Index: src/dialogs/dialog-stf-fixed-page.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-stf-fixed-page.c,v >retrieving revision 1.49 >diff -u -w -p -r1.49 dialog-stf-fixed-page.c >--- src/dialogs/dialog-stf-fixed-page.c 26 Oct 2004 13:53:02 -0000 1.49 >+++ src/dialogs/dialog-stf-fixed-page.c 14 Mar 2006 19:15:59 -0000 >@@ -390,8 +390,7 @@ fixed_page_update_preview (StfDialogData > trim = parseoptions->trim_spaces; > stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_NEVER); > lines = stf_parse_general (parseoptions, lines_chunk, >- pagedata->cur, pagedata->cur_end, >- LINE_DISPLAY_LIMIT); >+ pagedata->cur, pagedata->cur_end); > stf_parse_options_set_trim_spaces (parseoptions, trim); > > stf_preview_set_lines (renderdata, lines_chunk, lines); >Index: src/dialogs/dialog-stf-format-page.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/dialog-stf-format-page.c,v >retrieving revision 1.72 >diff -u -w -p -r1.72 dialog-stf-format-page.c >--- src/dialogs/dialog-stf-format-page.c 24 Nov 2004 02:50:50 -0000 1.72 >+++ src/dialogs/dialog-stf-format-page.c 14 Mar 2006 19:15:59 -0000 >@@ -381,8 +381,7 @@ format_page_update_preview (StfDialogDat > stf_parse_general (pagedata->parseoptions, > lines_chunk, > pagedata->cur, >- pagedata->cur_end, >- LINE_DISPLAY_LIMIT)); >+ pagedata->cur_end)); > > col_import_array_len_old = pagedata->format.col_import_array_len; > pagedata->format.col_import_array_len = renderdata->colcount; >@@ -628,6 +627,11 @@ stf_dialog_format_page_init (GladeXML *g > pagedata->format.index = -1; > pagedata->format.manual_change = FALSE; > >+ /* Update widgets before connecting signals, see #333407. */ >+ gtk_combo_box_set_active (GTK_COMBO_BOX (pagedata->format.format_trim), >+ 0); >+ format_page_update_column_selection (pagedata); >+ > /* Connect signals */ > pagedata->format.format_changed_handler_id = > g_signal_connect (G_OBJECT (pagedata->format.format_selector), >@@ -641,7 +645,4 @@ stf_dialog_format_page_init (GladeXML *g > g_signal_connect (G_OBJECT (pagedata->format.format_trim), > "changed", > G_CALLBACK (format_page_trim_menu_changed), pagedata); >- gtk_combo_box_set_active (GTK_COMBO_BOX (pagedata->format.format_trim), 0); >- >- format_page_update_column_selection (pagedata); > } >Index: src/dialogs/sheet-order.glade >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/dialogs/sheet-order.glade,v >retrieving revision 1.19 >retrieving revision 1.19.4.1 >diff -u -w -p -r1.19 -r1.19.4.1 >--- src/dialogs/sheet-order.glade 25 May 2004 05:44:48 -0000 1.19 >+++ src/dialogs/sheet-order.glade 13 May 2005 03:42:32 -0000 1.19.4.1 >@@ -111,7 +111,7 @@ > </widget> > <packing> > <property name="padding">0</property> >- <property name="expand">True</property> >+ <property name="expand">False</property> > <property name="fill">True</property> > </packing> > </child> >@@ -126,7 +126,7 @@ > </widget> > <packing> > <property name="padding">0</property> >- <property name="expand">True</property> >+ <property name="expand">False</property> > <property name="fill">True</property> > </packing> > </child> >@@ -141,7 +141,7 @@ > </widget> > <packing> > <property name="padding">0</property> >- <property name="expand">True</property> >+ <property name="expand">False</property> > <property name="fill">True</property> > </packing> > </child> >@@ -157,7 +157,7 @@ > </widget> > <packing> > <property name="padding">0</property> >- <property name="expand">True</property> >+ <property name="expand">False</property> > <property name="fill">True</property> > </packing> > </child> >@@ -173,7 +173,7 @@ > </widget> > <packing> > <property name="padding">0</property> >- <property name="expand">True</property> >+ <property name="expand">False</property> > <property name="fill">True</property> > </packing> > </child> >Index: src/tools/Makefile.am >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/Makefile.am,v >retrieving revision 1.12 >retrieving revision 1.12.4.2 >diff -u -w -p -r1.12 -r1.12.4.2 >--- src/tools/Makefile.am 4 Sep 2004 05:36:25 -0000 1.12 >+++ src/tools/Makefile.am 17 Apr 2005 07:40:13 -0000 1.12.4.2 >@@ -41,4 +41,3 @@ libtools_a_SOURCES = \ > tabulate.c \ > tabulate.h \ > tools.h >- >Index: src/tools/analysis-tools.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/analysis-tools.c,v >retrieving revision 1.58 >diff -u -w -p -r1.58 analysis-tools.c >--- src/tools/analysis-tools.c 14 Oct 2004 13:11:37 -0000 1.58 >+++ src/tools/analysis-tools.c 14 Mar 2006 19:16:00 -0000 >@@ -51,6 +51,7 @@ > #include "command-context.h" > > #include <string.h> >+#include <stdlib.h> > #include <math.h> > > #undef DEBUG_ANALYSIS_TOOLS >Index: src/tools/auto-correct.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/auto-correct.c,v >retrieving revision 1.28 >retrieving revision 1.28.2.1 >diff -u -w -p -r1.28 -r1.28.2.1 >--- src/tools/auto-correct.c 10 Jan 2005 15:25:53 -0000 1.28 >+++ src/tools/auto-correct.c 9 Apr 2005 08:15:31 -0000 1.28.2.1 >@@ -50,13 +50,13 @@ static struct { > guint notification_id; > } autocorrect; > >-#define AUTOCORRECT_DIRECTORY "/apps/gnumeric/autocorrect" >-#define AUTOCORRECT_INIT_CAPS AUTOCORRECT_DIRECTORY "/init-caps" >-#define AUTOCORRECT_INIT_CAPS_LIST AUTOCORRECT_DIRECTORY "/init-caps-list" >-#define AUTOCORRECT_FIRST_LETTER AUTOCORRECT_DIRECTORY "/first-letter" >-#define AUTOCORRECT_FIRST_LETTER_LIST AUTOCORRECT_DIRECTORY "/first-letter-list" >-#define AUTOCORRECT_NAMES_OF_DAYS AUTOCORRECT_DIRECTORY "/names-of-days" >-#define AUTOCORRECT_REPLACE AUTOCORRECT_DIRECTORY "/replace" >+#define AUTOCORRECT_DIRECTORY "autocorrect" >+#define AUTOCORRECT_INIT_CAPS "init-caps" >+#define AUTOCORRECT_INIT_CAPS_LIST "init-caps-list" >+#define AUTOCORRECT_FIRST_LETTER "first-letter" >+#define AUTOCORRECT_FIRST_LETTER_LIST "first-letter-list" >+#define AUTOCORRECT_NAMES_OF_DAYS "names-of-days" >+#define AUTOCORRECT_REPLACE "replace" > > static void > autocorrect_clear (void) >@@ -68,18 +68,21 @@ autocorrect_clear (void) > static void > autocorrect_load (void) > { >- autocorrect.init_caps = go_conf_load_bool (AUTOCORRECT_INIT_CAPS, TRUE); >+ GOConfNode *node = go_conf_get_node (gnm_conf_get_root (), AUTOCORRECT_DIRECTORY); >+ >+ autocorrect.init_caps = go_conf_load_bool (node, AUTOCORRECT_INIT_CAPS, TRUE); > autocorrect_set_exceptions (AC_INIT_CAPS, >- go_conf_load_str_list (AUTOCORRECT_INIT_CAPS_LIST)); >- autocorrect.first_letter = go_conf_load_bool (AUTOCORRECT_FIRST_LETTER, TRUE); >+ go_conf_load_str_list (node, AUTOCORRECT_INIT_CAPS_LIST)); >+ autocorrect.first_letter = go_conf_load_bool (node, AUTOCORRECT_FIRST_LETTER, TRUE); > autocorrect_set_exceptions (AC_FIRST_LETTER, >- go_conf_load_str_list (AUTOCORRECT_FIRST_LETTER_LIST)); >- autocorrect.names_of_days = go_conf_load_bool (AUTOCORRECT_NAMES_OF_DAYS, TRUE); >- autocorrect.replace = go_conf_load_bool (AUTOCORRECT_REPLACE, TRUE); >+ go_conf_load_str_list (node, AUTOCORRECT_FIRST_LETTER_LIST)); >+ autocorrect.names_of_days = go_conf_load_bool (node, AUTOCORRECT_NAMES_OF_DAYS, TRUE); >+ autocorrect.replace = go_conf_load_bool (node, AUTOCORRECT_REPLACE, TRUE); >+ go_conf_free_node (node); > } > > static void >-cb_autocorrect_update (char const *key, gpointer data) >+cb_autocorrect_update (GOConfNode *node, gchar const *key, gpointer data) > { > autocorrect_clear (); > autocorrect_load (); >@@ -88,12 +91,16 @@ cb_autocorrect_update (char const *key, > static void > autocorrect_init (void) > { >+ GOConfNode *node; >+ > if (autocorrect.notification_id != 0) > return; > > autocorrect_load (); >+ node = go_conf_get_node (gnm_conf_get_root (), AUTOCORRECT_DIRECTORY); > autocorrect.notification_id = go_conf_add_monitor ( >- AUTOCORRECT_DIRECTORY, &cb_autocorrect_update, NULL); >+ node, AUTOCORRECT_DIRECTORY, &cb_autocorrect_update, NULL); >+ go_conf_free_node (node); > g_object_set_data_full (gnm_app_get_app (), > "ToolsAutoCorrect", GINT_TO_POINTER (1), > (GDestroyNotify) autocorrect_clear); >@@ -102,19 +109,22 @@ autocorrect_init (void) > void > autocorrect_store_config (void) > { >- go_conf_set_bool (AUTOCORRECT_INIT_CAPS, >+ GOConfNode *node = go_conf_get_node (gnm_conf_get_root (), AUTOCORRECT_DIRECTORY); >+ >+ go_conf_set_bool (node, AUTOCORRECT_INIT_CAPS, > autocorrect.init_caps); >- go_conf_set_str_list (AUTOCORRECT_INIT_CAPS_LIST, >+ go_conf_set_str_list (node, AUTOCORRECT_INIT_CAPS_LIST, > autocorrect.exceptions.init_caps); >- go_conf_set_bool (AUTOCORRECT_FIRST_LETTER, >+ go_conf_set_bool (node, AUTOCORRECT_FIRST_LETTER, > autocorrect.first_letter); >- go_conf_set_str_list (AUTOCORRECT_FIRST_LETTER_LIST, >+ go_conf_set_str_list (node, AUTOCORRECT_FIRST_LETTER_LIST, > autocorrect.exceptions.first_letter); >- go_conf_set_bool (AUTOCORRECT_NAMES_OF_DAYS, >+ go_conf_set_bool (node, AUTOCORRECT_NAMES_OF_DAYS, > autocorrect.names_of_days); >- go_conf_set_bool (AUTOCORRECT_REPLACE, >+ go_conf_set_bool (node, AUTOCORRECT_REPLACE, > autocorrect.replace); >- go_conf_sync (); >+ go_conf_sync (node); >+ go_conf_free_node (node); > } > > gboolean >Index: src/tools/goal-seek.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/goal-seek.c,v >retrieving revision 1.4 >retrieving revision 1.4.2.1 >diff -u -w -p -r1.4 -r1.4.2.1 >--- src/tools/goal-seek.c 18 Oct 2004 15:25:07 -0000 1.4 >+++ src/tools/goal-seek.c 19 Apr 2005 15:11:21 -0000 1.4.2.1 >@@ -47,7 +47,7 @@ update_data (gnm_float x, gnm_float y, G > } else { > data->xpos = x; > data->ypos = y; >- data->havexpos = 1; >+ data->havexpos = TRUE; > } > return FALSE; > } else if (y < 0) { >@@ -70,11 +70,12 @@ update_data (gnm_float x, gnm_float y, G > } else { > data->xneg = x; > data->yneg = y; >- data->havexneg = 1; >+ data->havexneg = TRUE; > } > return FALSE; > } else { > /* Lucky guess... */ >+ data->have_root = TRUE; > data->root = x; > return TRUE; > } >@@ -146,7 +147,9 @@ fake_df (GoalSeekFunction f, gnm_float x > void > goal_seek_initialize (GoalSeekData *data) > { >- data->havexpos = data->havexneg = FALSE; >+ data->havexpos = data->havexneg = data->have_root = FALSE; >+ data->xpos = data->xneg = data->root = gnm_nan; >+ data->ypos = data->yneg = gnm_nan; > data->xmin = -1e10; > data->xmax = +1e10; > data->precision = 1e-10; >@@ -163,6 +166,9 @@ goal_seek_point (GoalSeekFunction f, Goa > GoalSeekStatus status; > gnm_float y0; > >+ if (data->have_root) >+ return GOAL_SEEK_OK; >+ > if (x0 < data->xmin || x0 > data->xmax) > return GOAL_SEEK_ERROR; > >@@ -196,6 +202,9 @@ goal_seek_newton (GoalSeekFunction f, Go > int iterations; > gnm_float precision = data->precision / 2; > >+ if (data->have_root) >+ return GOAL_SEEK_OK; >+ > #ifdef DEBUG_GOAL_SEEK > printf ("goal_seek_newton\n"); > #endif >@@ -247,11 +256,6 @@ goal_seek_newton (GoalSeekFunction f, Go > * just one side of the root. > */ > x1 = x0 - 1.000001 * y0 / df0; >- if (x1 == x0) { >- data->root = x0; >- return GOAL_SEEK_OK; >- } >- > stepsize = gnumabs (x1 - x0) / (gnumabs (x0) + gnumabs (x1)); > > #ifdef DEBUG_GOAL_SEEK >@@ -263,6 +267,7 @@ goal_seek_newton (GoalSeekFunction f, Go > > if (stepsize < precision) { > data->root = x0; >+ data->have_root = TRUE; > return GOAL_SEEK_OK; > } > } >@@ -293,6 +298,9 @@ goal_seek_bisection (GoalSeekFunction f, > gnm_float stepsize; > int newton_submethod = 0; > >+ if (data->have_root) >+ return GOAL_SEEK_OK; >+ > #ifdef DEBUG_GOAL_SEEK > printf ("goal_seek_bisection\n"); > #endif >@@ -431,6 +439,7 @@ goal_seek_bisection (GoalSeekFunction f, > if (data->ypos < ymid) > ymid = data->ypos, xmid = data->xpos; > >+ data->have_root = TRUE; > data->root = xmid; > return GOAL_SEEK_OK; > } >@@ -449,6 +458,9 @@ goal_seek_trawl_uniformly (GoalSeekFunct > { > int i; > >+ if (data->have_root) >+ return GOAL_SEEK_OK; >+ > if (xmin > xmax || xmin < data->xmin || xmax > data->xmax) > return GOAL_SEEK_ERROR; > >@@ -486,6 +498,9 @@ goal_seek_trawl_normally (GoalSeekFuncti > int points) > { > int i; >+ >+ if (data->have_root) >+ return GOAL_SEEK_OK; > > if (sigma <= 0 || mu < data->xmin || mu > data->xmax) > return GOAL_SEEK_ERROR; >Index: src/tools/goal-seek.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/goal-seek.h,v >retrieving revision 1.3 >retrieving revision 1.3.2.1 >diff -u -w -p -r1.3 -r1.3.2.1 >--- src/tools/goal-seek.h 18 Oct 2004 15:25:07 -0000 1.3 >+++ src/tools/goal-seek.h 19 Apr 2005 15:11:21 -0000 1.3.2.1 >@@ -17,6 +17,7 @@ typedef struct { > gnm_float xneg; /* Value for which f(xneg) < 0. */ > gnm_float yneg; /* f(xneg). */ > >+ gboolean have_root; /* Do we have a valid root? */ > gnm_float root; /* Value for which f(root) == 0. */ > } GoalSeekData; > >Index: src/tools/scenarios.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/scenarios.c,v >retrieving revision 1.25 >diff -u -w -p -r1.25 scenarios.c >--- src/tools/scenarios.c 20 Sep 2004 14:42:44 -0000 1.25 >+++ src/tools/scenarios.c 14 Mar 2006 19:16:00 -0000 >@@ -166,7 +166,7 @@ collect_values (Sheet *sheet, scenario_t > > rows = s->range.end.row - s->range.start.row + 1; > cols = s->range.end.col - s->range.start.col + 1; >- s->changing_cells = g_new (GnmValue *, rows * cols); >+ s->changing_cells = g_new0 (GnmValue *, rows * cols); > > cb.expr_flag = FALSE; > cb.sheet = sheet; >@@ -177,10 +177,10 @@ collect_values (Sheet *sheet, scenario_t > > /* Doesn't actually add the new scenario into the sheet's scenario list. */ > gboolean >-scenario_add_new (gchar *name, >+scenario_add_new (const gchar *name, > GnmValue *changing_cells, >- gchar *cell_sel_str, >- gchar *comment, >+ const gchar *cell_sel_str, >+ const gchar *comment, > Sheet *sheet, > scenario_t **new_scenario) > { >Index: src/tools/scenarios.h >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/scenarios.h,v >retrieving revision 1.16 >diff -u -w -p -r1.16 scenarios.h >--- src/tools/scenarios.h 8 Oct 2003 23:51:28 -0000 1.16 >+++ src/tools/scenarios.h 14 Mar 2006 19:16:00 -0000 >@@ -41,10 +41,10 @@ scenario_t *scenario_show (Workb > scenario_t *scenario, > scenario_t *old_values, > data_analysis_output_t *dao); >-gboolean scenario_add_new (gchar *name, >+gboolean scenario_add_new (const gchar *name, > GnmValue *changing_cells, >- gchar *cell_sel_str, >- gchar *comment, >+ const gchar *cell_sel_str, >+ const gchar *comment, > Sheet *sheet, scenario_t **new_scenario); > void scenario_add (Sheet *sheet, scenario_t *scenario); > gboolean scenario_mark_deleted (GList *scenarios, gchar *name); >Index: src/tools/solver/solver.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/tools/solver/solver.c,v >retrieving revision 1.69 >diff -u -w -p -r1.69 solver.c >--- src/tools/solver/solver.c 5 Nov 2004 03:29:59 -0000 1.69 >+++ src/tools/solver/solver.c 14 Mar 2006 19:16:00 -0000 >@@ -75,6 +75,11 @@ solver_param_new (void) > void > solver_param_destroy (SolverParameters *sp) > { >+ g_slist_foreach (sp->constraints, >+ (GFunc)solver_constraint_destroy, >+ NULL); >+ g_slist_free (sp->constraints); >+ g_slist_free (sp->input_cells); > g_free (sp->input_entry_str); > g_free (sp->options.scenario_name); > g_free (sp); >@@ -170,6 +175,13 @@ solver_get_constraint (SolverResults *re > return res->constraints_array[n]; > } > >+void >+solver_constraint_destroy (SolverConstraint *c) >+{ >+ g_free (c->str); >+ g_free (c); >+} >+ > /* ------------------------------------------------------------------------- */ > > static SolverConstraint* >@@ -551,7 +563,7 @@ check_program_definition_failures (Sheet > param->n_bool_constraints = 0; > i = 0; > for (c = param->constraints; c ; c = c->next) { >- SolverConstraint *sc = (SolverConstraint *) c->data; >+ SolverConstraint *sc = c->data; > > if (sc->type == SolverINT) > param->n_int_constraints += >@@ -568,7 +580,7 @@ check_program_definition_failures (Sheet > param->n_total_constraints); > i = 0; > for (c = param->constraints; c ; c = c->next) { >- SolverConstraint *sc = (SolverConstraint *) c->data; >+ SolverConstraint *sc = c->data; > > if (sc->rows == 1 && sc->cols == 1) > constraints_array[i++] = sc; >@@ -935,5 +947,3 @@ solver_delete_cols (Sheet *sheet, int co > c->type, c->cols, c->rows); > } > } >- >- >Index: src/widgets/gnumeric-expr-entry.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/widgets/gnumeric-expr-entry.c,v >retrieving revision 1.125 >diff -u -w -p -r1.125 gnumeric-expr-entry.c >--- src/widgets/gnumeric-expr-entry.c 7 Sep 2004 19:28:41 -0000 1.125 >+++ src/widgets/gnumeric-expr-entry.c 14 Mar 2006 19:16:00 -0000 >@@ -338,6 +338,21 @@ cb_gee_key_press_event (GtkEntry *entr > } > return TRUE; > } >+ >+ case GDK_KP_Separator: >+ case GDK_KP_Decimal: { >+ GtkEditable *editable = GTK_EDITABLE (entry); >+ gint start, end, l; >+ GString const* s = format_get_decimal (); >+ gchar const* decimal = s->str; >+ l = s->len; >+ gtk_editable_get_selection_bounds (editable, &start, &end); >+ gtk_editable_delete_text (editable, start, end); >+ gtk_editable_insert_text (editable, decimal, l, &start); >+ gtk_editable_set_position (editable, start); >+ return TRUE; >+ } >+ > default: > break; > } >Index: src/widgets/widget-font-selector.c >=================================================================== >RCS file: /cvs/gnome/gnumeric/src/widgets/widget-font-selector.c,v >retrieving revision 1.58 >diff -u -w -p -r1.58 widget-font-selector.c >--- src/widgets/widget-font-selector.c 1 Jun 2004 17:27:35 -0000 1.58 >+++ src/widgets/widget-font-selector.c 14 Mar 2006 19:16:00 -0000 >@@ -162,20 +162,21 @@ static void > font_selected (GtkTreeSelection *selection, > FontSelector *fs) > { >- gchar *text; >- GnmStyle *change; > GtkTreeModel *model; > GtkTreeIter iter; > >- gtk_tree_selection_get_selected (selection, &model, &iter); >+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) { >+ GnmStyle *change = mstyle_new (); >+ gchar *text; >+ > gtk_tree_model_get (model, &iter, 0, &text, -1); > gtk_entry_set_text (GTK_ENTRY (fs->font_name_entry), text); > >- change = mstyle_new (); > mstyle_set_font_name (change, text); > g_free (text); > fs_modify_style (fs, change); > } >+} > > static void > fs_fill_font_name_list (FontSelector *fs) >@@ -208,15 +209,13 @@ static void > style_selected (GtkTreeSelection *selection, > FontSelector *fs) > { >- GnmStyle *change = mstyle_new (); > GtkTreeModel *model; > GtkTreeIter iter; >- GtkTreePath *path; >- int row; > >- gtk_tree_selection_get_selected (selection, &model, &iter); >- path = gtk_tree_model_get_path (model, &iter); >- row = *gtk_tree_path_get_indices (path); >+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) { >+ GnmStyle *change = mstyle_new (); >+ GtkTreePath *path = gtk_tree_model_get_path (model, &iter); >+ int row = *gtk_tree_path_get_indices (path); > gtk_tree_path_free (path); > > switch (row) { >@@ -228,7 +227,6 @@ style_selected (GtkTreeSelection *select > mstyle_set_font_bold (change, TRUE); > mstyle_set_font_italic (change, FALSE); > break; >- > case 2: > mstyle_set_font_bold (change, TRUE); > mstyle_set_font_italic (change, TRUE); >@@ -242,6 +240,7 @@ style_selected (GtkTreeSelection *select > gtk_entry_set_text (GTK_ENTRY (fs->font_style_entry), _(styles[row])); > fs_modify_style (fs, change); > } >+} > > static void > fs_fill_font_style_list (FontSelector *fs) >@@ -282,17 +281,19 @@ static void > size_selected (GtkTreeSelection *selection, > FontSelector *fs) > { >- GnmStyle *change = mstyle_new (); >- gchar *text; > GtkTreeModel *model; > GtkTreeIter iter; > >- gtk_tree_selection_get_selected (selection, &model, &iter); >+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) { >+ GnmStyle *change = mstyle_new (); >+ gchar *text; >+ > gtk_tree_model_get (model, &iter, 0, &text, -1); > gtk_entry_set_text (GTK_ENTRY (fs->font_size_entry), text); > mstyle_set_font_size (change, atof (text)); > g_free (text); > fs_modify_style (fs, change); >+ } > } > > static void
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 139466
:
61714
| 72854 |
75173