summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericm <ericm>2000-11-02 02:19:57 (GMT)
committerericm <ericm>2000-11-02 02:19:57 (GMT)
commit3bf4145cecc6c61c96ba78ffb51c882afb0bc9ba (patch)
tree0f8b7fa82256612da244bc655f6857b9d945c5b5
parentb0795fb7df818e89571c8bbc4407a0def9330aa9 (diff)
downloadtk-3bf4145cecc6c61c96ba78ffb51c882afb0bc9ba.zip
tk-3bf4145cecc6c61c96ba78ffb51c882afb0bc9ba.tar.gz
tk-3bf4145cecc6c61c96ba78ffb51c882afb0bc9ba.tar.bz2
* tests/winDialog.test: Corrected expected results for bad option
tests (5.2, 5.5) to include -multiple option. * win/tkWinDialog.c: Removed CommDlgExtendedError() checks for color and choosedir dialogs, and removed all except the explicit invalid filename checks for the file dialogs.
-rw-r--r--ChangeLog8
-rw-r--r--win/tkWinDialog.c146
2 files changed, 45 insertions, 109 deletions
diff --git a/ChangeLog b/ChangeLog
index 13800be..982ae26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,13 +10,19 @@
2000-11-01 Eric Melski <ericm@ajubasolutions.com>
+ * tests/winDialog.test: Corrected expected results for bad option
+ tests (5.2, 5.5) to include -multiple option.
+
* win/tkWinDialog.c: Added branch for 0 return from
CommDlgExtendedError() switches; this was formerly treated as an
error, but it actually is not, since it just means the user hit
cancel or closed the dialog. (GetFileNameW): Added better smarts
such that -multiple is not considered a valid option for
tk_getSaveFile.
-
+ Removed CommDlgExtendedError() checks for color and choosedir
+ dialogs, and removed all except the explicit invalid filename
+ checks for the file dialogs.
+
2000-10-30 David Gravereaux <davygrvy@ajubasolutions.com>
* win/configure.in:
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 92cfeb9..8bb1dea 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDialog.c,v 1.16 2000/11/02 01:18:20 hobbs Exp $
+ * RCS: @(#) $Id: tkWinDialog.c,v 1.17 2000/11/02 02:19:57 ericm Exp $
*
*/
@@ -308,29 +308,6 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv)
Tcl_AppendResult(interp, color, NULL);
oldColor = chooseColor.rgbResult;
result = TCL_OK;
- } else {
- /*
- * Use the CommDlgExtendedError() function to retrieve the error code.
- * This function can return one of about two dozen codes; most of
- * these indicate some sort of gross system failure (insufficient
- * memory, bad window handles, etc.). Most of the error codes will be
- * handled by the default case below; as we find we want more specific
- * error messages for particular errors, we can extend the switch as
- * needed.
- */
- switch (CommDlgExtendedError()) {
- case 0: {
- /* User hit cancel or closed the dialog. */
- result = TCL_OK;
- break;
- }
- default: {
- Tcl_SetResult(interp, "error while using color dialog",
- TCL_STATIC);
- result = TCL_ERROR;
- break;
- }
- }
}
return result;
@@ -826,41 +803,29 @@ GetFileNameW(clientData, interp, objc, objv, open)
* This function can return one of about two dozen codes; most of
* these indicate some sort of gross system failure (insufficient
* memory, bad window handles, etc.). Most of the error codes will be
- * handled by the default case below; as we find we want more specific
- * error messages for particular errors, we can extend the switch as
- * needed.
+ * ignored; as we find we want more specific error messages for
+ * particular errors, we can extend the code as needed.
*/
- switch (CommDlgExtendedError()) {
- case 0: {
- /* User hit cancel or closed the dialog. */
- result = TCL_OK;
- break;
- }
- case FNERR_INVALIDFILENAME: {
- char *p;
- Tcl_DString ds;
+ if (CommDlgExtendedError() == FNERR_INVALIDFILENAME) {
+ char *p;
+ Tcl_DString ds;
- Tcl_ExternalToUtfDString(unicodeEncoding,
- (char *) ofn.lpstrFile, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname,
- * where back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
+ Tcl_ExternalToUtfDString(unicodeEncoding,
+ (char *) ofn.lpstrFile, -1, &ds);
+ for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
+ /*
+ * Change the pathname to the Tcl "normalized" pathname,
+ * where back slashes are used instead of forward slashes
+ */
+ if (*p == '\\') {
+ *p = '/';
}
- Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), "\"", NULL);
- Tcl_DStringFree(&ds);
- break;
- }
- default: {
- Tcl_SetResult(interp, "error while using file dialog",
- TCL_STATIC);
- break;
}
+ Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
+ Tcl_AppendResult(interp, Tcl_DStringValue(&ds), "\"", NULL);
+ Tcl_DStringFree(&ds);
+ } else {
+ result = TCL_OK;
}
}
@@ -1193,40 +1158,28 @@ GetFileNameA(clientData, interp, objc, objv, open)
* This function can return one of about two dozen codes; most of
* these indicate some sort of gross system failure (insufficient
* memory, bad window handles, etc.). Most of the error codes will be
- * handled by the default case below; as we find we want more specific
- * error messages for particular errors, we can extend the switch as
- * needed.
+ * ignored;; as we find we want specific error messages for particular
+ * errors, we can extend the code as needed.
*/
- switch (CommDlgExtendedError()) {
- case 0: {
- /* User hit cancel or closed the dialog. */
- result = TCL_OK;
- break;
- }
- case FNERR_INVALIDFILENAME: {
- char *p;
- Tcl_DString ds;
+ if (CommDlgExtendedError() == FNERR_INVALIDFILENAME) {
+ char *p;
+ Tcl_DString ds;
- Tcl_ExternalToUtfDString(NULL,(char *) ofn.lpstrFile, -1, &ds);
- for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
- /*
- * Change the pathname to the Tcl "normalized" pathname,
- * where back slashes are used instead of forward slashes
- */
- if (*p == '\\') {
- *p = '/';
- }
+ Tcl_ExternalToUtfDString(NULL,(char *) ofn.lpstrFile, -1, &ds);
+ for (p = Tcl_DStringValue(&ds); *p != '\0'; p++) {
+ /*
+ * Change the pathname to the Tcl "normalized" pathname,
+ * where back slashes are used instead of forward slashes
+ */
+ if (*p == '\\') {
+ *p = '/';
}
- Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
- Tcl_AppendResult(interp, Tcl_DStringValue(&ds), "\"", NULL);
- Tcl_DStringFree(&ds);
- break;
- }
- default: {
- Tcl_SetResult(interp, "error while using file dialog",
- TCL_STATIC);
- break;
}
+ Tcl_SetResult(interp, "invalid filename \"", TCL_STATIC);
+ Tcl_AppendResult(interp, Tcl_DStringValue(&ds), "\"", NULL);
+ Tcl_DStringFree(&ds);
+ } else {
+ result = TCL_OK;
}
}
@@ -1633,29 +1586,6 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
}
Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
Tcl_DStringFree(&ds);
- } else {
- /*
- * Use the CommDlgExtendedError() function to retrieve the error code.
- * This function can return one of about two dozen codes; most of
- * these indicate some sort of gross system failure (insufficient
- * memory, bad window handles, etc.). Most of the error codes will be
- * handled by the default case below; as we find we want more specific
- * error messages for particular errors, we can extend the switch as
- * needed.
- */
- switch (CommDlgExtendedError()) {
- case 0: {
- /* User hit cancel or closed the dialog. */
- result = TCL_OK;
- break;
- }
- default: {
- Tcl_SetResult(interp, "error while using color dialog",
- TCL_STATIC);
- result = TCL_ERROR;
- break;
- }
- }
}
if (ofn.lpstrTitle != NULL) {