Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Contributed implementation patch for TIP 382. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tip-382 |
Files: | files | file ages | folders |
SHA1: |
c8b22e329721c8bb30054b9901a9e3fd |
User & Date: | dgp 2011-10-04 17:53:34 |
Context
2011-10-05
| ||
19:18 | Revise the proposed "-nocomplain" option to "-confirmoverwrite" check-in: d7028f6d user: dgp tags: tip-382 | |
2011-10-04
| ||
17:53 | Contributed implementation patch for TIP 382. check-in: c8b22e32 user: dgp tags: tip-382 | |
2011-09-26
| ||
12:07 | merge-mark check-in: 012b3cb0 user: jan.nijtmans tags: core-8-5-branch | |
Changes
Changes to library/tkfbox.tcl.
︙ | ︙ | |||
978 979 980 981 982 983 984 985 986 987 988 989 990 991 | } # The "-multiple" option is only available for the "open" file dialog. # if {$type eq "open"} { lappend specs {-multiple "" "" "0"} } # 2: default values depending on the type of the dialog # if {![info exists data(selectPath)]} { # first time the dialog has been popped up set data(selectPath) [pwd] set data(selectFile) "" | > > > > > > | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | } # The "-multiple" option is only available for the "open" file dialog. # if {$type eq "open"} { lappend specs {-multiple "" "" "0"} } # The "-nocomplain" option is only available for the "save" file dialog. # if {$type eq "save"} { lappend specs {-nocomplain "" "" "0"} } # 2: default values depending on the type of the dialog # if {![info exists data(selectPath)]} { # first time the dialog has been popped up set data(selectPath) [pwd] set data(selectFile) "" |
︙ | ︙ | |||
1855 1856 1857 1858 1859 1860 1861 | } else { set selectFilePath [JoinFile $data(selectPath) $data(selectFile)] } set Priv(selectFile) $data(selectFile) set Priv(selectPath) $data(selectPath) | | | 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 | } else { set selectFilePath [JoinFile $data(selectPath) $data(selectFile)] } set Priv(selectFile) $data(selectFile) set Priv(selectPath) $data(selectPath) if {($data(type) eq "save") && !$data(-nocomplain) && [file exists $selectFilePath]} { set reply [tk_messageBox -icon warning -type yesno -parent $w \ -message [mc "File \"%1\$s\" already exists.\nDo you want\ to overwrite it?" $selectFilePath]] if {$reply eq "no"} { return } } |
︙ | ︙ |
Changes to win/tkWinDialog.c.
︙ | ︙ | |||
587 588 589 590 591 592 593 | int open) /* 1 to call GetOpenFileName(), 0 to call * GetSaveFileName(). */ { OPENFILENAMEW ofn; WCHAR file[TK_MULTI_MAX_PATH]; OFNData ofnData; int cdlgerr; | | | | > | 587 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 | int open) /* 1 to call GetOpenFileName(), 0 to call * GetSaveFileName(). */ { OPENFILENAMEW ofn; WCHAR file[TK_MULTI_MAX_PATH]; OFNData ofnData; int cdlgerr; int filterIndex = 0, result = TCL_ERROR, winCode, oldMode, i, multi = 0, noComplain = 0; 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", "-nocomplain", NULL }; static CONST char *openOptionStrings[] = { "-defaultextension", "-filetypes", "-initialdir", "-initialfile", "-multiple", "-parent", "-title", "-typevariable", NULL }; CONST char **optionStrings; enum options { FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE, FILE_MULTIPLE, FILE_PARENT, FILE_TITLE, FILE_TYPEVARIABLE, FILE_NOCOMPLAIN }; file[0] = '\0'; ZeroMemory(&ofnData, sizeof(OFNData)); Tcl_DStringInit(&utfFilterString); Tcl_DStringInit(&utfDirString); |
︙ | ︙ | |||
708 709 710 711 712 713 714 715 716 717 718 719 720 721 | title = string; break; case FILE_TYPEVARIABLE: typeVariableObj = valuePtr; initialTypeObj = Tcl_ObjGetVar2(interp, typeVariableObj, NULL, TCL_GLOBAL_ONLY); break; } } if (MakeFilter(interp, filterObj, &utfFilterString, initialTypeObj, &filterIndex) != TCL_OK) { goto end; } | > > > > > | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | title = string; break; case FILE_TYPEVARIABLE: typeVariableObj = valuePtr; initialTypeObj = Tcl_ObjGetVar2(interp, typeVariableObj, NULL, TCL_GLOBAL_ONLY); break; case FILE_NOCOMPLAIN: if (Tcl_GetBooleanFromObj(interp, valuePtr, &noComplain) != TCL_OK) { return TCL_ERROR; } break; } } if (MakeFilter(interp, filterObj, &utfFilterString, initialTypeObj, &filterIndex) != TCL_OK) { goto end; } |
︙ | ︙ | |||
736 737 738 739 740 741 742 | ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_ENABLEHOOK| OFN_ENABLESIZING; ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcW; ofn.lCustData = (LPARAM) &ofnData; if (open != 0) { ofn.Flags |= OFN_FILEMUSTEXIST; | | | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_ENABLEHOOK| OFN_ENABLESIZING; ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcW; ofn.lCustData = (LPARAM) &ofnData; if (open != 0) { ofn.Flags |= OFN_FILEMUSTEXIST; } else if (noComplain == 0) { ofn.Flags |= OFN_OVERWRITEPROMPT; } if (tsdPtr->debugFlag != 0) { ofnData.interp = interp; } if (multi != 0) { ofn.Flags |= OFN_ALLOWMULTISELECT; |
︙ | ︙ |