Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix up the implementation to account for shared options enumeration. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tip-382 |
Files: | files | file ages | folders |
SHA1: |
de044a4cfadbab67ee97b2d144859866 |
User & Date: | dgp 2011-10-17 19:54:09 |
Context
2011-10-17
| ||
20:10 | Implementation for Carbon. check-in: 5a1e3c46 user: dgp tags: tip-382 | |
19:54 | Fix up the implementation to account for shared options enumeration. check-in: de044a4c user: dgp tags: tip-382 | |
2011-10-05
| ||
19:18 | Revise the proposed "-nocomplain" option to "-confirmoverwrite" check-in: d7028f6d user: dgp tags: tip-382 | |
Changes
Changes to library/tkfbox.tcl.
︙ | ︙ | |||
979 980 981 982 983 984 985 | # The "-multiple" option is only available for the "open" file dialog. # if {$type eq "open"} { lappend specs {-multiple "" "" "0"} } | | | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | # The "-multiple" option is only available for the "open" file dialog. # if {$type eq "open"} { lappend specs {-multiple "" "" "0"} } # The "-confirmoverwrite" option is only for the "save" file dialog. # if {$type eq "save"} { lappend specs {-confirmoverwrite "" "" "1"} } # 2: default values depending on the type of the dialog # |
︙ | ︙ |
Changes to win/tkWinDialog.c.
︙ | ︙ | |||
588 589 590 591 592 593 594 | * GetSaveFileName(). */ { OPENFILENAMEW ofn; WCHAR file[TK_MULTI_MAX_PATH]; OFNData ofnData; int cdlgerr; int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0; | | | | > | | > > < < | | | < < < < < < < < < < | > < < < < < < < < < < < < < < < | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | * GetSaveFileName(). */ { OPENFILENAMEW ofn; WCHAR file[TK_MULTI_MAX_PATH]; OFNData ofnData; int cdlgerr; int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0; int inValue, confirmOverwrite = 1; char *extension = NULL, *title = NULL; Tk_Window tkwin = (Tk_Window) clientData; HWND hWnd; Tcl_Obj *filterObj = NULL, *initialTypeObj = NULL, *typeVariableObj = NULL; Tcl_DString utfFilterString, utfDirString, ds; Tcl_DString extString, filterString, dirString, titleString; Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding(); ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); static CONST char *saveOptionStrings[] = { "-defaultextension", "-filetypes", "-initialdir", "-initialfile", "-parent", "-title", "-typevariable", "-confirmoverwrite", NULL }; static CONST char *openOptionStrings[] = { "-defaultextension", "-filetypes", "-initialdir", "-initialfile", "-parent", "-title", "-typevariable", "-multiple", NULL }; enum options { FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE, FILE_PARENT, FILE_TITLE, FILE_TYPEVARIABLE, FILE_MULTIPLE_OR_CONFIRMOW }; file[0] = '\0'; ZeroMemory(&ofnData, sizeof(OFNData)); Tcl_DStringInit(&utfFilterString); Tcl_DStringInit(&utfDirString); for (i = 1; i < objc; i += 2) { int index; char *string; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; valuePtr = objv[i + 1]; if (Tcl_GetIndexFromObj(interp, optionPtr, open ? openOptionStrings : saveOptionStrings, "option", 0, &index) != TCL_OK) { goto end; } if (i + 1 == objc) { string = Tcl_GetString(optionPtr); Tcl_AppendResult(interp, "value for \"", string, "\" missing", NULL); goto end; } |
︙ | ︙ | |||
691 692 693 694 695 696 697 | if (Tcl_TranslateFileName(interp, string, &ds) == NULL) { goto end; } Tcl_UtfToExternal(NULL, unicodeEncoding, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), 0, NULL, (char *) file, sizeof(file), NULL, NULL, NULL); Tcl_DStringFree(&ds); | < < < < < | | > > > > > | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | if (Tcl_TranslateFileName(interp, string, &ds) == NULL) { goto end; } Tcl_UtfToExternal(NULL, unicodeEncoding, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), 0, NULL, (char *) file, sizeof(file), NULL, NULL, NULL); Tcl_DStringFree(&ds); break; case FILE_PARENT: tkwin = Tk_NameToWindow(interp, string, tkwin); if (tkwin == NULL) { goto end; } break; case FILE_TITLE: title = string; break; case FILE_TYPEVARIABLE: typeVariableObj = valuePtr; initialTypeObj = Tcl_ObjGetVar2(interp, typeVariableObj, NULL, TCL_GLOBAL_ONLY); break; case FILE_MULTIPLE_OR_CONFIRMOW: if (Tcl_GetBooleanFromObj(interp, valuePtr, &inValue) != TCL_OK) { return TCL_ERROR; } if (open) { multi = inValue; } else { confirmOverwrite = inValue; } break; } } if (MakeFilter(interp, filterObj, &utfFilterString, initialTypeObj, &filterIndex) != TCL_OK) { goto end; |
︙ | ︙ |