зеркало из https://github.com/mozilla/pjs.git
Cleans up font enumeration. Implements TextOutA. Implements SetWindowTextA. Remaps lstr* functions. NPODB
This commit is contained in:
Родитель
7c090bdf71
Коммит
18698a7f4c
|
@ -281,6 +281,13 @@
|
|||
#define _makepath mozce_makepath
|
||||
|
||||
|
||||
|
||||
#define lstrlenA strlen
|
||||
#define lstrcpyA strcpy
|
||||
#define lstrcmpA strcmp
|
||||
#define lstrcmpiA strcmpi
|
||||
#define lstrcatA strcat
|
||||
|
||||
#ifdef strdup
|
||||
#undef strdup
|
||||
#endif
|
||||
|
@ -618,6 +625,11 @@
|
|||
#endif
|
||||
#define SetWindowsHookEx mozce_SetWindowsHookEx
|
||||
|
||||
#ifdef SetWindowTextA
|
||||
#undef SetWindowTextA
|
||||
#endif
|
||||
#define SetWindowTextA mozce_SetWindowTextA
|
||||
|
||||
#ifdef TlsAlloc
|
||||
#undef TlsAlloc
|
||||
#endif
|
||||
|
@ -749,6 +761,11 @@
|
|||
#endif
|
||||
#define EnumFontFamiliesA mozce_EnumFontFamiliesA
|
||||
|
||||
#ifdef TextOut
|
||||
#undef TextOut
|
||||
#endif
|
||||
#define TextOut mozce_TextOutA
|
||||
|
||||
#ifdef ExtTextOutA
|
||||
#undef ExtTextOutA
|
||||
#endif
|
||||
|
@ -1333,6 +1350,8 @@ extern "C" {
|
|||
MOZCE_SHUNT_API BOOL mozce_RemoveDirectoryA(LPCSTR lpPathName);
|
||||
MOZCE_SHUNT_API BOOL mozce_CreateProcessA(LPCSTR pszImageName, LPCSTR pszCmdLine, LPSECURITY_ATTRIBUTES psaProcess, LPSECURITY_ATTRIBUTES psaThread, BOOL fInheritHandles, DWORD fdwCreate, LPVOID pvEnvironment, LPSTR pszCurDir, LPSTARTUPINFO psiStartInfo, LPPROCESS_INFORMATION pProcInfo);
|
||||
MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOptions, LPCRECT inRect, LPCSTR inString, UINT inCount, const LPINT inDx);
|
||||
MOZCE_SHUNT_API BOOL mozce_TextOutA(HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString);
|
||||
|
||||
MOZCE_SHUNT_API BOOL mozce_GetClassInfoA(HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASS lpWndClass);
|
||||
MOZCE_SHUNT_API int mozce_GetClassNameA(HWND hWnd, LPTSTR lpClassName, int nMaxCount);
|
||||
MOZCE_SHUNT_API BOOL mozce_GetFileVersionInfoA(LPSTR inFilename, DWORD inHandle, DWORD inLen, LPVOID outData);
|
||||
|
@ -1417,6 +1436,8 @@ extern "C" {
|
|||
MOZCE_SHUNT_API int mozce_GetTextFaceA(HDC hdc, int nCount, LPTSTR lpFaceName);
|
||||
MOZCE_SHUNT_API BOOL mozce_GetTextMetricsA(HDC hdc, LPTEXTMETRIC lptm);
|
||||
|
||||
MOZCE_SHUNT_API BOOL mozce_SetWindowTextA(HWND hWnd, LPCSTR lpString);
|
||||
|
||||
|
||||
// From win32w.cpp
|
||||
MOZCE_SHUNT_API BOOL mozce_SetCurrentDirectoryW(LPCTSTR inPathName);
|
||||
|
|
|
@ -130,16 +130,16 @@ MOZCE_SHUNT_API char* mozce_getcwd(char* buff, size_t size)
|
|||
|
||||
#ifdef DEBUG
|
||||
mozce_printf("mozce_getcwd called.\n");
|
||||
#endif
|
||||
|
||||
unsigned short dir[MAX_PATH];
|
||||
GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
|
||||
for (int i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
|
||||
dir[i + 1] = TCHAR('\0');
|
||||
|
||||
w2a_buffer(dir, -1, buff, size);
|
||||
|
||||
return buff;
|
||||
#endif
|
||||
|
||||
unsigned short dir[MAX_PATH];
|
||||
GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
|
||||
for (int i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
|
||||
dir[i + 1] = TCHAR('\0');
|
||||
|
||||
w2a_buffer(dir, -1, buff, size);
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
||||
MOZCE_SHUNT_API int mozce_printf(const char * format, ...)
|
||||
|
|
|
@ -328,7 +328,7 @@ MOZCE_SHUNT_API UINT mozce_GetTextCharsetInfo(HDC inDC, LPFONTSIGNATURE outSig,
|
|||
mozce_printf("mozce_GetTextCharsetInfo called\n");
|
||||
#endif
|
||||
|
||||
// A broken implementation.
|
||||
// Zero out the FONTSIGNATURE as we do not know how to fill it out properly.
|
||||
if(NULL != outSig)
|
||||
{
|
||||
memset(outSig, 0, sizeof(FONTSIGNATURE));
|
||||
|
@ -342,22 +342,12 @@ MOZCE_SHUNT_API UINT mozce_GetOutlineTextMetrics(HDC inDC, UINT inData, void* ou
|
|||
{
|
||||
MOZCE_PRECHECK
|
||||
|
||||
static int x = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
mozce_printf("-- mozce_GetOutlineTextMetrics called (%d)\n", ++x);
|
||||
mozce_printf("-- mozce_GetOutlineTextMetrics called.\n");
|
||||
#endif
|
||||
|
||||
UINT retval = 0;
|
||||
|
||||
if(NULL != outOTM)
|
||||
{
|
||||
//memset(outOTM, 0, sizeof(OUTLINETEXTMETRIC));
|
||||
}
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
|
||||
return retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,33 +390,34 @@ MOZCE_SHUNT_API int mozce_EnumFontFamiliesEx(HDC inDC, LPLOGFONT inLogfont, FONT
|
|||
|
||||
// We support only one case.
|
||||
// Callback should be oldstyle EnumFonts.
|
||||
if(DEFAULT_CHARSET == inLogfont->lfCharSet)
|
||||
{
|
||||
CollectFaces collection;
|
||||
collection.mCount = 0;
|
||||
|
||||
EnumFonts(inDC, NULL, collectProc, (LPARAM)&collection);
|
||||
|
||||
UINT loop;
|
||||
for(loop = 0; loop < collection.mCount; loop++)
|
||||
{
|
||||
retval = EnumFonts(inDC, collection.mNames[loop], inFunc, inParam);
|
||||
}
|
||||
|
||||
for(loop = 0; loop < collection.mCount; loop++)
|
||||
{
|
||||
free(collection.mNames[loop]);
|
||||
}
|
||||
}
|
||||
else
|
||||
if(DEFAULT_CHARSET != inLogfont->lfCharSet)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mozce_printf("mozce_EnumFontFamiliesEx failed\n");
|
||||
#endif
|
||||
SetLastError(ERROR_NOT_SUPPORTED);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CollectFaces collection;
|
||||
collection.mCount = 0;
|
||||
|
||||
EnumFonts(inDC, NULL, collectProc, (LPARAM)&collection);
|
||||
|
||||
UINT loop;
|
||||
for(loop = 0; loop < collection.mCount; loop++)
|
||||
{
|
||||
retval = EnumFonts(inDC, collection.mNames[loop], inFunc, inParam);
|
||||
}
|
||||
|
||||
for(loop = 0; loop < collection.mCount; loop++)
|
||||
{
|
||||
free(collection.mNames[loop]);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
MOZCE_SHUNT_API int mozce_GetMapMode(HDC inDC)
|
||||
{
|
||||
MOZCE_PRECHECK
|
||||
|
@ -594,14 +585,9 @@ MOZCE_SHUNT_API BOOL mozce_OpenIcon(HWND inWnd)
|
|||
MOZCE_PRECHECK
|
||||
|
||||
#ifdef DEBUG
|
||||
mozce_printf("-- mozce_OpenIcon called\n");
|
||||
mozce_printf("mozce_OpenIcon called\n");
|
||||
#endif
|
||||
|
||||
BOOL retval = FALSE;
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
|
||||
return retval;
|
||||
return SetActiveWindow(inWnd) ? 1:0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -942,7 +928,7 @@ MOZCE_SHUNT_API DWORD mozce_GetCurrentThreadId(void)
|
|||
}
|
||||
|
||||
|
||||
MOZCE_SHUNT_API DWORD mozce_GetCurrentProcessId(void)
|
||||
MOZCE_SHUNT_API DWORD mozce_GetCurrentProcessId(void)
|
||||
{
|
||||
MOZCE_PRECHECK
|
||||
|
||||
|
|
|
@ -269,17 +269,16 @@ MOZCE_SHUNT_API int mozce_GetLocaleInfoA(LCID Locale, LCTYPE LCType, LPSTR lpLCD
|
|||
{
|
||||
if(0 == cchData)
|
||||
{
|
||||
retval = WideCharToMultiByte(
|
||||
CP_ACP,
|
||||
0,
|
||||
buffer,
|
||||
neededChars,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
retval = WideCharToMultiByte(CP_ACP,
|
||||
0,
|
||||
buffer,
|
||||
neededChars,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -650,7 +649,6 @@ MOZCE_SHUNT_API BOOL mozce_GetTextExtentExPointA(HDC inDC, char* inStr, int inLe
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOptions, const LPRECT inRect, LPCSTR inString, UINT inCount, const LPINT inDx)
|
||||
{
|
||||
MOZCE_PRECHECK
|
||||
|
@ -676,6 +674,13 @@ MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOption
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
MOZCE_SHUNT_API BOOL mozce_TextOutA(HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString)
|
||||
{
|
||||
return mozce_ExtTextOutA(hdc, nXStart, nYStart, 0, NULL, lpString, cbString, NULL);
|
||||
}
|
||||
|
||||
MOZCE_SHUNT_API DWORD mozce_GetGlyphOutlineA(HDC inDC, CHAR inChar, UINT inFormat, void* inGM, DWORD inBufferSize, LPVOID outBuffer, CONST mozce_MAT2* inMAT2)
|
||||
{
|
||||
MOZCE_PRECHECK
|
||||
|
@ -1823,14 +1828,53 @@ MOZCE_SHUNT_API HFONT mozce_CreateFontIndirectA(CONST LOGFONTA* lplf)
|
|||
}
|
||||
|
||||
|
||||
MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, LPCTSTR lpszFamily, FONTENUMPROC lpEnumFontFamProc, LPARAM lParam)
|
||||
|
||||
typedef struct _MyEnumFontFamArg
|
||||
{
|
||||
FONTENUMPROC fn;
|
||||
LPARAM lParam;
|
||||
} MYENUMFONTFAMARG;
|
||||
|
||||
|
||||
|
||||
// typedef int (CALLBACK* FONTENUMPROC)(CONST LOGFONT *, CONST TEXTMETRIC *, DWORD, LPARAM);
|
||||
|
||||
static int CALLBACK
|
||||
MyEnumFontFamProc(CONST LOGFONT *lf, CONST TEXTMETRIC *tm, DWORD fonttype, LPARAM lParam)
|
||||
{
|
||||
MYENUMFONTFAMARG *parg = (MYENUMFONTFAMARG *) lParam;
|
||||
FONTENUMPROC fn = parg->fn;
|
||||
|
||||
LOGFONTW lfw;
|
||||
memcpy(&lfw, lf, sizeof(LOGFONTA));
|
||||
a2w_buffer((const char*)lf->lfFaceName, -1, lfw.lfFaceName, LF_FACESIZE);
|
||||
|
||||
return (*fn) (&lfw, tm, fonttype, parg->lParam);
|
||||
}
|
||||
|
||||
MOZCE_SHUNT_API int mozce_EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROC lpEnumFontFamProc, LPARAM lParam)
|
||||
{
|
||||
MOZCE_PRECHECK
|
||||
|
||||
#ifdef DEBUG
|
||||
mozce_printf("-- mozce_EnumFontFamilies called\n");
|
||||
mozce_printf("mozce_EnumFontFamilies called\n");
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
MYENUMFONTFAMARG arg;
|
||||
wchar_t *lpszFamilyW = NULL;
|
||||
|
||||
if(lpszFamily != NULL)
|
||||
lpszFamilyW = a2w_malloc(lpszFamily, -1, NULL);
|
||||
|
||||
arg.fn = lpEnumFontFamProc;
|
||||
arg.lParam = lParam;
|
||||
|
||||
int result = EnumFontFamiliesW(hdc, lpszFamilyW, (FONTENUMPROC) MyEnumFontFamProc, (LPARAM) &arg);
|
||||
|
||||
free(lpszFamilyW);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1909,6 +1953,24 @@ MOZCE_SHUNT_API BOOL mozce_GetTextMetricsA(HDC hdc, LPTEXTMETRICA lptma)
|
|||
return res;
|
||||
}
|
||||
|
||||
MOZCE_SHUNT_API BOOL mozce_SetWindowTextA(HWND hWnd, LPCSTR lpString)
|
||||
{
|
||||
MOZCE_PRECHECK
|
||||
|
||||
#ifdef DEBUG
|
||||
mozce_printf("mozce_SetWindowTextA called\n");
|
||||
#endif
|
||||
|
||||
LPTSTR wstr = a2w_malloc(lpString, -1, NULL);
|
||||
BOOL result = SetWindowTextW(hWnd, wstr);
|
||||
|
||||
if (wstr)
|
||||
free(wstr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
{
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче