Here's the second shot at the cell validation patches, again improved from
before w/ help from jody. Patch is against latest CVS on both the HEAD
and gnome_1_4 branches, and is appropriate for 1.0.4 because it contains
only bug-fixes, not new features.
There is a little bit of gtk_dialog_run fixing in 1.1.x's
src/workbook-control-gui.c which is needed for fully correct validation
operation but which is *not* included in this patch, because it
ended up being sandwiched in with my cell locking patch because the
code in question was so close to wbcg_locked_msg(). If you
take this but not that you should scissor the changes to
delete_sheet_if_possible() and wbcg_validation_message() out and
put them in here --- wbcg_validation_message in particular always behaved
as if you pressed the button *opposite* the one you really pressed;
that was a bad bug.
Changelog follows.
* src/validation.c:
Return VALIDATION_STATUS_VALID on assertion failure, not "1".
Cleaned up the VALIDATION_TYPE_AS_NUMBER case with a switch statement.
Covered corner cases better, and clarified the error messages to
correspond with the wording in the validation properties dialog.
Fixed a logic bug in VALIDATION_OP_BETWEEN that caused us to ignore the
lower bound in this case.
Clarified the default error message.
(same changes here to both 1.0.4 and 1.1.x branch to keep code parallel)
* src/dialogs/cell-format.glade:
Fixed the dialog entry for the NOT_BETWEEN case: the test should
be 'val < min || max < val' not 'val <= min || max <= val'. Also
changed the '||' in the dialog to english 'or'.
* src/dialogs/dialog-cell-format.c (validation_entry_to_expr,
fmt_dialog_init_validation_expr_entry, cb_fmt_dialog_set_focus):
cb_fmt_dialog_set_focus is not the correct place to set the proper
flags on the GnumericExprEntry --- validation_entry_to_expr can
be called before the field is ever focused upon, and then
gnumeric_expr_entry_parse/gnm_expr_entry_parse will fail and
we'll 'forget' the proper value of the arguments. (You'll
see this bug if you open the validation window, change something
[the validation operation, for example] and hit okay without ever
focusing on the min/max fields. Open the validation window
again and the contents previously in min/max will be gone.)
Instead, move the flag-setting to
fmt_dialog_init_validation_expr_entry.
* src/dialogs/dialog-cell-format.c (validation_entry_from_expr):
*** 1.1.x BRANCH ONLY ***
You can't cast a GnumericExprEntry to a GtkEntry. You need
to call gnm_expr_entry_load_from_*. This was causing the
validation argument fields to always show up blank.
Enjoy!
--scott
Khaddafi genetic CIA SDI Ft. Meade COBRA JANE Noriega SEAL Team 6
Iraq Israel Qaddafi Nazi postcard Justice Albanian Hawk Delta Force
( http://lesser-magoo.lcs.mit.edu/~cananian )
Attachment:
patch-1.0.4-cvs.valid2
Description: Patch for 1.0.4 cvs
Attachment:
patch-HEAD-cvs.valid3
Description: Patch for 1.1.x cvs