summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinDialog.c43
-rw-r--r--win/tkWinFont.c28
2 files changed, 35 insertions, 36 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index eaaf3b5..9d1b576 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -138,7 +138,7 @@ static const struct {int type; int btnIds[3];} allowedTypes[] = {
SetWindowLongPtr((to), GWLP_USERDATA, (LPARAM)(what))
/*
- * The value of TK_MULTI_MAX_PATH dictactes how many files can be retrieved
+ * The value of TK_MULTI_MAX_PATH dictates how many files can be retrieved
* with tk_get*File -multiple 1. It must be allocated on the stack, so make it
* large enough but not too large. - hobbs
*
@@ -168,7 +168,7 @@ typedef struct ChooseDir {
* the default dialog proc stores a '\0' in
* it, since, of course, no _file_ was
* selected. */
- OPENFILENAMEA *ofnPtr; /* pointer to the OFN structure */
+ OPENFILENAME *ofnPtr; /* pointer to the OFN structure */
} ChooseDir;
/*
@@ -182,8 +182,7 @@ typedef struct OFNData {
int dynFileBufferSize; /* Dynamic filename buffer size, stored to
* avoid shrinking and expanding the buffer
* when selection changes */
- char *dynFileBuffer; /* Dynamic filename buffer, cast to WCHAR* in
- * UNICODE procedures */
+ TCHAR *dynFileBuffer; /* Dynamic filename buffer */
} OFNData;
/*
@@ -707,15 +706,15 @@ GetFileName(
Tk_MakeWindowExist(tkwin);
hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
- ZeroMemory(&ofn, sizeof(OPENFILENAMEW));
+ ZeroMemory(&ofn, sizeof(OPENFILENAME));
if (LOBYTE(LOWORD(GetVersion())) < 5) {
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
} else {
- ofn.lStructSize = sizeof(OPENFILENAMEW);
+ ofn.lStructSize = sizeof(OPENFILENAME);
}
ofn.hwndOwner = hWnd;
ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner);
- ofn.lpstrFile = (WCHAR *) file;
+ ofn.lpstrFile = file;
ofn.nMaxFile = TK_MULTI_MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR
| OFN_EXPLORER | OFN_ENABLEHOOK| OFN_ENABLESIZING;
@@ -738,19 +737,19 @@ GetFileName(
* procedure when necessary
*/
- ofnData.dynFileBufferSize = 1024;
- ofnData.dynFileBuffer = ckalloc(1024);
+ ofnData.dynFileBufferSize = 512;
+ ofnData.dynFileBuffer = ckalloc(512 * sizeof(TCHAR));
}
if (extension != NULL) {
Tcl_UtfToExternalDString(unicodeEncoding, extension, -1, &extString);
- ofn.lpstrDefExt = (WCHAR *) Tcl_DStringValue(&extString);
+ ofn.lpstrDefExt = (TCHAR *) Tcl_DStringValue(&extString);
}
Tcl_UtfToExternalDString(unicodeEncoding,
Tcl_DStringValue(&utfFilterString),
Tcl_DStringLength(&utfFilterString), &filterString);
- ofn.lpstrFilter = (WCHAR *) Tcl_DStringValue(&filterString);
+ ofn.lpstrFilter = (TCHAR *) Tcl_DStringValue(&filterString);
ofn.nFilterIndex = filterIndex;
if (Tcl_DStringValue(&utfDirString)[0] != '\0') {
@@ -776,11 +775,11 @@ GetFileName(
}
Tcl_DStringFree(&cwd);
}
- ofn.lpstrInitialDir = (WCHAR *) Tcl_DStringValue(&dirString);
+ ofn.lpstrInitialDir = (TCHAR *) Tcl_DStringValue(&dirString);
if (title != NULL) {
Tcl_UtfToExternalDString(unicodeEncoding, title, -1, &titleString);
- ofn.lpstrTitle = (WCHAR *) Tcl_DStringValue(&titleString);
+ ofn.lpstrTitle = (TCHAR *) Tcl_DStringValue(&titleString);
}
/*
@@ -840,7 +839,7 @@ GetFileName(
* first element is the directory path.
*/
- WCHAR *files = (WCHAR *) ofnData.dynFileBuffer;
+ TCHAR *files = ofnData.dynFileBuffer;
Tcl_Obj *returnList = Tcl_NewObj();
int count = 0;
@@ -989,7 +988,7 @@ OFNHookProc(
if (notifyPtr->hdr.code == CDN_FILEOK ||
notifyPtr->hdr.code == CDN_SELCHANGE) {
int dirsize, selsize;
- WCHAR *buffer;
+ TCHAR *buffer;
int buffersize;
/*
@@ -999,21 +998,21 @@ OFNHookProc(
ofnPtr = notifyPtr->lpOFN;
ofnData = (OFNData *) ofnPtr->lCustData;
- buffer = (WCHAR *) ofnData->dynFileBuffer;
+ buffer = ofnData->dynFileBuffer;
hdlg = GetParent(hdlg);
selsize = SendMessage(hdlg, CDM_GETSPEC, 0, 0);
dirsize = SendMessage(hdlg, CDM_GETFOLDERPATH, 0, 0);
- buffersize = (selsize + dirsize + 1) * 2;
+ buffersize = (selsize + dirsize + 1);
/*
* Just empty the buffer if dirsize indicates an error [Bug 3071836]
*/
if ((selsize > 1) && (dirsize > 0)) {
if (ofnData->dynFileBufferSize < buffersize) {
- buffer = ckrealloc(buffer, buffersize);
+ buffer = ckrealloc(buffer, buffersize * sizeof(TCHAR));
ofnData->dynFileBufferSize = buffersize;
- ofnData->dynFileBuffer = (char *) buffer;
+ ofnData->dynFileBuffer = buffer;
}
SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, PTR2INT(buffer));
@@ -1028,7 +1027,7 @@ OFNHookProc(
if (buffer[0] == '"') {
BOOL findquote = TRUE;
- WCHAR *tmp = buffer;
+ TCHAR *tmp = buffer;
while(*buffer != '\0') {
if (findquote) {
@@ -1668,7 +1667,7 @@ ChooseDirectoryValidateProc(
ULONG ulCount, ulAttr;
if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName(
- psfFolder, hwnd, NULL, (WCHAR *)
+ psfFolder, hwnd, NULL, (TCHAR *)
Tcl_DStringValue(&initDirDStr), &ulCount,&pidlMain,&ulAttr))
&& (pidlMain != NULL)) {
SendMessageA(hwnd, BFFM_SETSELECTION, FALSE,
@@ -1860,7 +1859,7 @@ Tk_MessageBoxObjCmd(
tsdPtr->hSmallIcon = TkWinGetIcon(parent, ICON_SMALL);
tsdPtr->hBigIcon = TkWinGetIcon(parent, ICON_BIG);
- tsdPtr->hMsgBoxHook = SetWindowsHookExA(WH_CBT, MsgBoxCBTProc, NULL,
+ tsdPtr->hMsgBoxHook = SetWindowsHookEx(WH_CBT, MsgBoxCBTProc, NULL,
GetCurrentThreadId());
winCode = MessageBox(hWnd, Tcl_GetUnicode(tmpObj),
titleObj ? Tcl_GetUnicode(titleObj) : L"", flags);
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 1ce6d87..17de016 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -660,7 +660,7 @@ TkpGetFontFamilies(
* because it only exists under NT.
*/
- EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontFamilyEnumProc,
+ EnumFontFamilies(hdc, NULL, (FONTENUMPROC) WinFontFamilyEnumProc,
(LPARAM) resultObj);
ReleaseDC(hwnd, hdc);
Tcl_SetObjResult(interp, resultObj);
@@ -1562,7 +1562,7 @@ InitFont(
Tcl_Encoding encoding;
Tcl_DString faceString;
TkFontAttributes *faPtr;
- char buf[LF_FACESIZE * sizeof(WCHAR)];
+ TCHAR buf[LF_FACESIZE];
window = Tk_WindowId(tkwin);
hwnd = (window == None) ? NULL : TkWinGetHWND(window);
@@ -1586,8 +1586,8 @@ InitFont(
* GetTextFace because it only exists under NT.
*/
- GetTextFaceW(hdc, LF_FACESIZE, (WCHAR *) buf);
- Tcl_ExternalToUtfDString(systemEncoding, buf, -1, &faceString);
+ GetTextFace(hdc, LF_FACESIZE, buf);
+ Tcl_ExternalToUtfDString(systemEncoding, (char *) buf, -1, &faceString);
fontPtr->font.fid = (Font) fontPtr;
fontPtr->hwnd = hwnd;
@@ -1616,7 +1616,7 @@ InitFont(
encoding = fontPtr->subFontArray[0].familyPtr->encoding;
if (encoding == TkWinGetUnicodeEncoding()) {
- GetCharWidthW(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
+ GetCharWidth(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
} else {
GetCharWidthA(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
}
@@ -1758,13 +1758,13 @@ AllocFontFamily(
FontFamily *familyPtr;
Tcl_DString faceString;
Tcl_Encoding encoding;
- char buf[LF_FACESIZE * sizeof(WCHAR)];
+ TCHAR buf[LF_FACESIZE];
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
hFont = SelectObject(hdc, hFont);
- GetTextFaceW(hdc, LF_FACESIZE, (WCHAR *) buf);
- Tcl_ExternalToUtfDString(systemEncoding, buf, -1, &faceString);
+ GetTextFace(hdc, LF_FACESIZE, buf);
+ Tcl_ExternalToUtfDString(systemEncoding, (char *) buf, -1, &faceString);
faceName = Tk_GetUid(Tcl_DStringValue(&faceString));
Tcl_DStringFree(&faceString);
hFont = SelectObject(hdc, hFont);
@@ -2026,7 +2026,7 @@ FindSubFontForChar(
canUse.ch = ch;
canUse.subFontPtr = NULL;
canUse.subFontPtrPtr = subFontPtrPtr;
- EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontCanUseProc,
+ EnumFontFamilies(hdc, NULL, (FONTENUMPROC) WinFontCanUseProc,
(LPARAM) &canUse);
subFontPtr = canUse.subFontPtr;
@@ -2474,7 +2474,7 @@ GetScreenFont(
{
Tcl_DString ds;
HFONT hFont;
- LOGFONTW lf;
+ LOGFONT lf;
memset(&lf, 0, sizeof(lf));
lf.lfHeight = -pixelSize;
@@ -2500,7 +2500,7 @@ GetScreenFont(
* We can only store up to LF_FACESIZE wide characters
*/
- if (Tcl_DStringLength(&ds) >= (int)(LF_FACESIZE * sizeof(WCHAR))) {
+ if (Tcl_DStringLength(&ds) >= (int)(LF_FACESIZE * sizeof(TCHAR))) {
Tcl_DStringSetLength(&ds, LF_FACESIZE);
}
src = (Tcl_UniChar *) Tcl_DStringValue(&ds);
@@ -2509,7 +2509,7 @@ GetScreenFont(
*dst++ = *src++;
}
*dst = '\0';
- hFont = CreateFontIndirectW(&lf);
+ hFont = CreateFontIndirect(&lf);
} else {
/*
* We can only store up to LF_FACESIZE characters
@@ -2577,8 +2577,8 @@ FamilyExists(
* non-zero value.
*/
- result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
- (FONTENUMPROCW) WinFontExistProc, 0);
+ result = EnumFontFamilies(hdc, (TCHAR*) Tcl_DStringValue(&faceString),
+ (FONTENUMPROC) WinFontExistProc, 0);
Tcl_DStringFree(&faceString);
return (result == 0);
}