more MSLU fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1386,21 +1386,35 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
buf = new wxChar[sz + 1];
|
buf = new wxChar[sz + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok;
|
bool ok = FALSE;
|
||||||
|
|
||||||
// for the compilers which have Unicode version of _getcwd(), call it
|
// for the compilers which have Unicode version of _getcwd(), call it
|
||||||
// directly, for the others call the ANSI version and do the translation
|
// directly, for the others call the ANSI version and do the translation
|
||||||
#if wxUSE_UNICODE
|
#if !wxUSE_UNICODE
|
||||||
#ifdef HAVE_WGETCWD
|
#define cbuf buf
|
||||||
ok = _wgetcwd(buf, sz) != NULL;
|
#else // wxUSE_UNICODE
|
||||||
#else // !HAVE_WGETCWD
|
bool needsANSI = TRUE;
|
||||||
wxCharBuffer cbuf(sz);
|
|
||||||
#endif
|
|
||||||
#endif //
|
|
||||||
|
|
||||||
#if !wxUSE_UNICODE || !defined(HAVE_WGETCWD)
|
#if !defined(HAVE_WGETCWD) || wxUSE_UNICODE_MSLU
|
||||||
|
wxCharBuffer c_buffer(sz);
|
||||||
|
char *cbuf = (char*)(const char*)c_buffer;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_WGETCWD
|
||||||
|
#if wxUSE_UNICODE_MSLU
|
||||||
|
if ( wxGetOsVersion() != wxWIN95 )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
ok = _wgetcwd(buf, sz) != NULL;
|
||||||
|
needsANSI = FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( needsANSI )
|
||||||
|
#endif // wxUSE_UNICODE
|
||||||
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
ok = _getcwd(buf, sz) != NULL;
|
ok = _getcwd(cbuf, sz) != NULL;
|
||||||
#elif defined(__WXMAC__) && !defined(__DARWIN__)
|
#elif defined(__WXMAC__) && !defined(__DARWIN__)
|
||||||
FSSpec cwdSpec ;
|
FSSpec cwdSpec ;
|
||||||
FCBPBRec pb;
|
FCBPBRec pb;
|
||||||
@@ -1418,8 +1432,8 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
cwdSpec.name[0] = 0 ;
|
cwdSpec.name[0] = 0 ;
|
||||||
wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ;
|
wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ;
|
||||||
|
|
||||||
strcpy( buf , res ) ;
|
strcpy( cbuf , res ) ;
|
||||||
buf[res.length()]=0 ;
|
cbuf[res.length()]=0 ;
|
||||||
|
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1430,14 +1444,14 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
#elif defined(__VISAGECPP__) || (defined (__OS2__) && defined (__WATCOMC__))
|
#elif defined(__VISAGECPP__) || (defined (__OS2__) && defined (__WATCOMC__))
|
||||||
APIRET rc;
|
APIRET rc;
|
||||||
rc = ::DosQueryCurrentDir( 0 // current drive
|
rc = ::DosQueryCurrentDir( 0 // current drive
|
||||||
,buf
|
,cbuf
|
||||||
,(PULONG)&sz
|
,(PULONG)&sz
|
||||||
);
|
);
|
||||||
ok = rc != 0;
|
ok = rc != 0;
|
||||||
#else // !Win32/VC++ !Mac !OS2
|
#else // !Win32/VC++ !Mac !OS2
|
||||||
ok = getcwd(buf, sz) != NULL;
|
ok = getcwd(cbuf, sz) != NULL;
|
||||||
#endif // platform
|
#endif // platform
|
||||||
#endif // !wxUSE_UNICODE || !HAVE_WGETCWD
|
}
|
||||||
|
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
{
|
{
|
||||||
@@ -1468,12 +1482,16 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
#endif // __CYGWIN__
|
#endif // __CYGWIN__
|
||||||
|
|
||||||
// finally convert the result to Unicode if needed
|
// finally convert the result to Unicode if needed
|
||||||
#if wxUSE_UNICODE && !defined(HAVE_WGETCWD)
|
#if wxUSE_UNICODE
|
||||||
wxConvFile.MB2WC(buf, cbuf, sz);
|
wxConvFile.MB2WC(buf, cbuf, sz);
|
||||||
#endif // wxUSE_UNICODE
|
#endif // wxUSE_UNICODE
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
|
#if !wxUSE_UNICODE
|
||||||
|
#undef cbuf
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxGetCwd()
|
wxString wxGetCwd()
|
||||||
|
@@ -190,10 +190,28 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
HFONT hPrevFont = (HFONT) ::SelectObject(hdc, hfont);
|
HFONT hPrevFont = (HFONT) ::SelectObject(hdc, hfont);
|
||||||
|
|
||||||
|
|
||||||
|
#if wxUSE_UNICODE_MSLU
|
||||||
|
if ( wxGetOsVersion() == wxWIN95 /* using unicows.dll */ )
|
||||||
|
{
|
||||||
|
// VS: There's yet another bug in MSLU: DrawStateW behaves
|
||||||
|
// like if it was expecting char*, not wchar_t* input.
|
||||||
|
// We have to use DrawStateA explicitly.
|
||||||
|
DrawStateA(hdc, NULL, NULL,
|
||||||
|
(LPARAM)(const char*)m_strName.mb_str(wxConvLocal),
|
||||||
|
m_strName.length(),
|
||||||
|
x, rc.y, rc.GetWidth(), rc.GetHeight(),
|
||||||
|
DST_PREFIXTEXT |
|
||||||
|
(st & wxODDisabled ? DSS_DISABLED : 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#else
|
||||||
DrawState(hdc, NULL, NULL,
|
DrawState(hdc, NULL, NULL,
|
||||||
(LPARAM)m_strName.c_str(), m_strName.length(),
|
(LPARAM)m_strName.c_str(), m_strName.length(),
|
||||||
x, rc.y, rc.GetWidth(), rc.GetHeight(),
|
x, rc.y, rc.GetWidth(), rc.GetHeight(),
|
||||||
DST_PREFIXTEXT | (st & wxODDisabled ? DSS_DISABLED : 0));
|
DST_PREFIXTEXT | (st & wxODDisabled ? DSS_DISABLED : 0));
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( !m_strAccel.empty() )
|
if ( !m_strAccel.empty() )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user