mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Fixed problems with caret moving in edit control.
svn path=/trunk/; revision=7160
This commit is contained in:
parent
4c2b31ef87
commit
d8fdb7eddc
4 changed files with 1086 additions and 624 deletions
|
@ -9,6 +9,8 @@
|
||||||
#ifndef WM_ISACTIVEICON
|
#ifndef WM_ISACTIVEICON
|
||||||
#define WM_ISACTIVEICON 0x0035
|
#define WM_ISACTIVEICON 0x0035
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __USE_W32API
|
||||||
#if defined(STRICT)
|
#if defined(STRICT)
|
||||||
typedef INT (CALLBACK *EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
|
typedef INT (CALLBACK *EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
|
||||||
typedef INT (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
|
typedef INT (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
|
||||||
|
@ -16,19 +18,41 @@ typedef INT (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
|
||||||
typedef FARPROC EDITWORDBREAKPROCA;
|
typedef FARPROC EDITWORDBREAKPROCA;
|
||||||
typedef FARPROC EDITWORDBREAKPROCW;
|
typedef FARPROC EDITWORDBREAKPROCW;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HBMMENU_CALLBACK
|
||||||
#define HBMMENU_CALLBACK ((HBITMAP) -1)
|
#define HBMMENU_CALLBACK ((HBITMAP) -1)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_SYSTEM
|
||||||
#define HBMMENU_SYSTEM ((HBITMAP) 1)
|
#define HBMMENU_SYSTEM ((HBITMAP) 1)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_MBAR_RESTORE
|
||||||
#define HBMMENU_MBAR_RESTORE ((HBITMAP) 2)
|
#define HBMMENU_MBAR_RESTORE ((HBITMAP) 2)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_MBAR_MINIMIZE
|
||||||
#define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3)
|
#define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_MBAR_CLOSE
|
||||||
#define HBMMENU_MBAR_CLOSE ((HBITMAP) 5)
|
#define HBMMENU_MBAR_CLOSE ((HBITMAP) 5)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_MBAR_CLOSE_D
|
||||||
#define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6)
|
#define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_MBAR_MINIMIZE_D
|
||||||
#define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7)
|
#define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_POPUP_CLOSE
|
||||||
#define HBMMENU_POPUP_CLOSE ((HBITMAP) 8)
|
#define HBMMENU_POPUP_CLOSE ((HBITMAP) 8)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_POPUP_RESTORE
|
||||||
#define HBMMENU_POPUP_RESTORE ((HBITMAP) 9)
|
#define HBMMENU_POPUP_RESTORE ((HBITMAP) 9)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_POPUP_MAXIMIZE
|
||||||
#define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10)
|
#define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10)
|
||||||
|
#endif
|
||||||
|
#ifndef HBMMENU_POPUP_MINIMIZE
|
||||||
#define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11)
|
#define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* winuser.h */
|
/* winuser.h */
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: draw.c,v 1.31 2003/12/11 19:36:20 navaraf Exp $
|
/* $Id: draw.c,v 1.32 2003/12/21 16:49:41 navaraf Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -1580,130 +1580,6 @@ InvertRect(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
LONG
|
|
||||||
STDCALL
|
|
||||||
TabbedTextOutA(
|
|
||||||
HDC hDC,
|
|
||||||
int X,
|
|
||||||
int Y,
|
|
||||||
LPCSTR lpString,
|
|
||||||
int nCount,
|
|
||||||
int nTabPositions,
|
|
||||||
CONST LPINT lpnTabStopPositions,
|
|
||||||
int nTabOrigin)
|
|
||||||
{
|
|
||||||
LONG ret;
|
|
||||||
DWORD len;
|
|
||||||
LPWSTR strW;
|
|
||||||
|
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, lpString, nCount, NULL, 0);
|
|
||||||
strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
|
||||||
if (!strW)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpString, nCount, strW, len);
|
|
||||||
ret = TabbedTextOutW(hDC, X, Y, strW, len, nTabPositions, lpnTabStopPositions, nTabOrigin);
|
|
||||||
HeapFree(GetProcessHeap(), 0, strW);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* TEXT_TabbedTextOut
|
|
||||||
*
|
|
||||||
* Helper function for TabbedTextOut() and GetTabbedTextExtent().
|
|
||||||
* Note: this doesn't work too well for text-alignment modes other
|
|
||||||
* than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
|
|
||||||
*/
|
|
||||||
static LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCWSTR lpstr,
|
|
||||||
INT count, INT cTabStops, const INT *lpTabPos, INT nTabOrg,
|
|
||||||
BOOL fDisplayText )
|
|
||||||
{
|
|
||||||
INT defWidth;
|
|
||||||
SIZE extent;
|
|
||||||
int i, tabPos = x;
|
|
||||||
int start = x;
|
|
||||||
|
|
||||||
extent.cx = 0;
|
|
||||||
extent.cy = 0;
|
|
||||||
|
|
||||||
if (!lpTabPos)
|
|
||||||
cTabStops=0;
|
|
||||||
|
|
||||||
if (cTabStops == 1 && *lpTabPos >= /* sic */ 0)
|
|
||||||
{
|
|
||||||
defWidth = *lpTabPos;
|
|
||||||
cTabStops = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TEXTMETRICA tm;
|
|
||||||
GetTextMetricsA( hdc, &tm );
|
|
||||||
defWidth = 8 * tm.tmAveCharWidth;
|
|
||||||
if (cTabStops == 1)
|
|
||||||
cTabStops = 0; /* on negative *lpTabPos */
|
|
||||||
}
|
|
||||||
|
|
||||||
while (count > 0)
|
|
||||||
{
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
if (lpstr[i] == '\t') break;
|
|
||||||
GetTextExtentPointW( hdc, lpstr, i, &extent );
|
|
||||||
while ((cTabStops > 0) &&
|
|
||||||
(nTabOrg + *lpTabPos <= x + extent.cx))
|
|
||||||
{
|
|
||||||
lpTabPos++;
|
|
||||||
cTabStops--;
|
|
||||||
}
|
|
||||||
if (i == count)
|
|
||||||
tabPos = x + extent.cx;
|
|
||||||
else if (cTabStops > 0)
|
|
||||||
tabPos = nTabOrg + *lpTabPos;
|
|
||||||
else if (defWidth <= 0)
|
|
||||||
tabPos = x + extent.cx;
|
|
||||||
else
|
|
||||||
tabPos = nTabOrg + ((x + extent.cx - nTabOrg) / defWidth + 1) * defWidth;
|
|
||||||
if (fDisplayText)
|
|
||||||
{
|
|
||||||
RECT r;
|
|
||||||
r.left = x;
|
|
||||||
r.top = y;
|
|
||||||
r.right = tabPos;
|
|
||||||
r.bottom = y + extent.cy;
|
|
||||||
ExtTextOutW( hdc, x, y, GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
|
|
||||||
&r, lpstr, i, NULL );
|
|
||||||
}
|
|
||||||
x = tabPos;
|
|
||||||
count -= i+1;
|
|
||||||
lpstr += i+1;
|
|
||||||
}
|
|
||||||
return MAKELONG(tabPos - start, extent.cy);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
LONG
|
|
||||||
STDCALL
|
|
||||||
TabbedTextOutW(
|
|
||||||
HDC hDC,
|
|
||||||
int X,
|
|
||||||
int Y,
|
|
||||||
LPCWSTR lpString,
|
|
||||||
int nCount,
|
|
||||||
int nTabPositions,
|
|
||||||
CONST LPINT lpnTabStopPositions,
|
|
||||||
int nTabOrigin)
|
|
||||||
{
|
|
||||||
return TEXT_TabbedTextOut(hDC, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: font.c,v 1.8 2003/12/12 20:30:02 gvg Exp $
|
/* $Id: font.c,v 1.9 2003/12/21 16:49:41 navaraf Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -35,6 +35,130 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
LONG
|
||||||
|
STDCALL
|
||||||
|
TabbedTextOutA(
|
||||||
|
HDC hDC,
|
||||||
|
int X,
|
||||||
|
int Y,
|
||||||
|
LPCSTR lpString,
|
||||||
|
int nCount,
|
||||||
|
int nTabPositions,
|
||||||
|
CONST LPINT lpnTabStopPositions,
|
||||||
|
int nTabOrigin)
|
||||||
|
{
|
||||||
|
LONG ret;
|
||||||
|
DWORD len;
|
||||||
|
LPWSTR strW;
|
||||||
|
|
||||||
|
len = MultiByteToWideChar(CP_ACP, 0, lpString, nCount, NULL, 0);
|
||||||
|
strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
|
if (!strW)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, lpString, nCount, strW, len);
|
||||||
|
ret = TabbedTextOutW(hDC, X, Y, strW, len, nTabPositions, lpnTabStopPositions, nTabOrigin);
|
||||||
|
HeapFree(GetProcessHeap(), 0, strW);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* TEXT_TabbedTextOut
|
||||||
|
*
|
||||||
|
* Helper function for TabbedTextOut() and GetTabbedTextExtent().
|
||||||
|
* Note: this doesn't work too well for text-alignment modes other
|
||||||
|
* than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
|
||||||
|
*/
|
||||||
|
static LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCWSTR lpstr,
|
||||||
|
INT count, INT cTabStops, const INT *lpTabPos, INT nTabOrg,
|
||||||
|
BOOL fDisplayText )
|
||||||
|
{
|
||||||
|
INT defWidth;
|
||||||
|
SIZE extent;
|
||||||
|
int i, tabPos = x;
|
||||||
|
int start = x;
|
||||||
|
|
||||||
|
extent.cx = 0;
|
||||||
|
extent.cy = 0;
|
||||||
|
|
||||||
|
if (!lpTabPos)
|
||||||
|
cTabStops=0;
|
||||||
|
|
||||||
|
if (cTabStops == 1 && *lpTabPos >= /* sic */ 0)
|
||||||
|
{
|
||||||
|
defWidth = *lpTabPos;
|
||||||
|
cTabStops = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TEXTMETRICA tm;
|
||||||
|
GetTextMetricsA( hdc, &tm );
|
||||||
|
defWidth = 8 * tm.tmAveCharWidth;
|
||||||
|
if (cTabStops == 1)
|
||||||
|
cTabStops = 0; /* on negative *lpTabPos */
|
||||||
|
}
|
||||||
|
|
||||||
|
while (count > 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (lpstr[i] == '\t') break;
|
||||||
|
GetTextExtentPointW( hdc, lpstr, i, &extent );
|
||||||
|
while ((cTabStops > 0) &&
|
||||||
|
(nTabOrg + *lpTabPos <= x + extent.cx))
|
||||||
|
{
|
||||||
|
lpTabPos++;
|
||||||
|
cTabStops--;
|
||||||
|
}
|
||||||
|
if (i == count)
|
||||||
|
tabPos = x + extent.cx;
|
||||||
|
else if (cTabStops > 0)
|
||||||
|
tabPos = nTabOrg + *lpTabPos;
|
||||||
|
else if (defWidth <= 0)
|
||||||
|
tabPos = x + extent.cx;
|
||||||
|
else
|
||||||
|
tabPos = nTabOrg + ((x + extent.cx - nTabOrg) / defWidth + 1) * defWidth;
|
||||||
|
if (fDisplayText)
|
||||||
|
{
|
||||||
|
RECT r;
|
||||||
|
r.left = x;
|
||||||
|
r.top = y;
|
||||||
|
r.right = tabPos;
|
||||||
|
r.bottom = y + extent.cy;
|
||||||
|
ExtTextOutW( hdc, x, y, GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
|
||||||
|
&r, lpstr, i, NULL );
|
||||||
|
}
|
||||||
|
x = tabPos;
|
||||||
|
count -= i+1;
|
||||||
|
lpstr += i+1;
|
||||||
|
}
|
||||||
|
return MAKELONG(tabPos - start, extent.cy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
LONG
|
||||||
|
STDCALL
|
||||||
|
TabbedTextOutW(
|
||||||
|
HDC hDC,
|
||||||
|
int X,
|
||||||
|
int Y,
|
||||||
|
LPCWSTR lpString,
|
||||||
|
int nCount,
|
||||||
|
int nTabPositions,
|
||||||
|
CONST LPINT lpnTabStopPositions,
|
||||||
|
int nTabOrigin)
|
||||||
|
{
|
||||||
|
return TEXT_TabbedTextOut(hDC, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
@ -53,7 +177,7 @@ GetTabbedTextExtentA(
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -64,8 +188,7 @@ GetTabbedTextExtentW(
|
||||||
int nTabPositions,
|
int nTabPositions,
|
||||||
CONST LPINT lpnTabStopPositions)
|
CONST LPINT lpnTabStopPositions)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
return TEXT_TabbedTextOut(hDC, 0, 0, lpString, nCount, nTabPositions, lpnTabStopPositions, 0, FALSE);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
Loading…
Reference in a new issue