Changeset 9023 for trunk/src/user32/edit.cpp
- Timestamp:
- Aug 17, 2002, 12:33:54 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/edit.cpp
r8814 r9023 1 /* $Id: edit.cpp,v 1.4 5 2002-07-01 14:07:22sandervl Exp $ */1 /* $Id: edit.cpp,v 1.46 2002-08-17 10:33:54 sandervl Exp $ */ 2 2 /* 3 3 * Edit control … … 188 188 static void EDIT_MoveWordForward(HWND hwnd, EDITSTATE *es, BOOL extend); 189 189 static void EDIT_PaintLine(HWND hwnd, EDITSTATE *es, HDC hdc, INT line, BOOL rev); 190 static VOIDEDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev);190 static INT EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev); 191 191 static void EDIT_SetCaretPos(HWND hwnd, EDITSTATE *es, INT pos, BOOL after_wrap); 192 192 static void EDIT_SetRectNP(HWND hwnd, EDITSTATE *es, LPRECT lprc); … … 725 725 */ 726 726 //DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE"); 727 SetFocus(hwnd); 727 728 result = MA_ACTIVATE; 728 729 break; … … 1661 1662 e = MIN(li + ll, MAX(li, e)); 1662 1663 1664 if (rev && (s != e) && 1665 ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) { 1666 x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, s - li, FALSE); 1667 x += EDIT_PaintText(hwnd, es, dc, x, y, line, s - li, e - s, TRUE); 1668 x += EDIT_PaintText(hwnd, es, dc, x, y, line, e - li, li + ll - e, FALSE); 1669 } else 1670 x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE); 1671 #if 0 1663 1672 if (rev && (s != e) && ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) 1664 1673 { … … 1718 1727 } 1719 1728 } else EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE); 1729 #endif // 0 1720 1730 } 1721 1731 … … 1726 1736 * 1727 1737 */ 1728 static VOIDEDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)1738 static INT EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev) 1729 1739 { 1730 1740 COLORREF BkColor; 1731 1741 COLORREF TextColor; 1732 INT li; 1742 INT ret; 1743 INT li; 1744 INT BkMode; 1745 SIZE size; 1733 1746 1734 1747 if (!count) 1735 return; 1748 return 0; 1749 BkMode = GetBkMode(dc); 1736 1750 BkColor = GetBkColor(dc); 1737 1751 TextColor = GetTextColor(dc); … … 1740 1754 SetBkColor(dc, GetSysColor(COLOR_HIGHLIGHT)); 1741 1755 SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT)); 1756 SetBkMode( dc, OPAQUE); 1742 1757 } 1743 1758 li = EDIT_EM_LineIndex(hwnd, es, line); 1744 1759 if (es->style & ES_MULTILINE) 1745 1760 { 1746 TabbedTextOutA(dc, x, y, es->text + li + col, count, 1747 es->tabs_count, es->tabs, es->format_rect.left - es->x_offset); 1761 //TabbedTextOutA(dc, x, y, es->text + li + col, count, 1762 // es->tabs_count, es->tabs, es->format_rect.left - es->x_offset); 1763 ret = (INT)LOWORD(TabbedTextOutA(dc, x, y, (LPCSTR) (es->text + li + col), count, 1764 es->tabs_count, es->tabs, es->format_rect.left - es->x_offset)); 1748 1765 } else 1749 1766 { … … 1752 1769 1753 1770 TextOutA(dc,x,y,text+li+col,count); 1771 GetTextExtentPoint32A(dc, text + li + col, count, &size); 1772 ret = size.cx; 1754 1773 if (es->style & ES_PASSWORD) 1755 1774 HeapFree(es->heap, 0, text); … … 1759 1778 SetBkColor(dc, BkColor); 1760 1779 SetTextColor(dc, TextColor); 1761 } 1780 SetBkMode( dc, BkMode); 1781 } 1782 return ret; 1762 1783 } 1763 1784 … … 3252 3273 */ 3253 3274 FillRect(dc, &rc, brush); 3254 3255 ShowCaret(hwnd);3256 3257 3275 return -1; 3258 3276 } … … 3648 3666 3649 3667 if (!(es->flags & EF_FOCUSED)) 3650 SetFocus(hwnd);3668 return 0; 3651 3669 3652 3670 es->bCaptureState = TRUE; … … 3936 3954 static void EDIT_WM_Paint(HWND hwnd, EDITSTATE *es,WPARAM wParam) 3937 3955 { 3938 PAINTSTRUCT ps; 3939 HDC hdc; 3940 3941 if (!wParam) hdc = BeginPaint(hwnd, &ps); 3942 else hdc = (HDC) wParam; 3943 3944 EDIT_Draw(hwnd,es,hdc,FALSE); 3945 3946 if (!wParam) EndPaint(hwnd, &ps); 3956 PAINTSTRUCT ps; 3957 INT i; 3958 HDC dc; 3959 HFONT old_font = 0; 3960 RECT rc; 3961 RECT rcLine; 3962 RECT rcRgn; 3963 BOOL rev = es->bEnableState && 3964 ((es->flags & EF_FOCUSED) || 3965 (es->style & ES_NOHIDESEL)); 3966 if (!wParam) 3967 dc = BeginPaint(hwnd, &ps); 3968 else 3969 dc = (HDC) wParam; 3970 if(es->style & WS_BORDER) { 3971 GetClientRect(hwnd, &rc); 3972 if(es->style & ES_MULTILINE) { 3973 if(es->style & WS_HSCROLL) rc.bottom++; 3974 if(es->style & WS_VSCROLL) rc.right++; 3975 } 3976 Rectangle(dc, rc.left, rc.top, rc.right, rc.bottom); 3977 } 3978 IntersectClipRect(dc, es->format_rect.left, 3979 es->format_rect.top, 3980 es->format_rect.right, 3981 es->format_rect.bottom); 3982 if (es->style & ES_MULTILINE) { 3983 GetClientRect(hwnd, &rc); 3984 IntersectClipRect(dc, rc.left, rc.top, rc.right, rc.bottom); 3985 } 3986 if (es->font) 3987 old_font = SelectObject(dc, es->font); 3988 if (!es->bEnableState || (es->style & ES_READONLY)) 3989 EDIT_SEND_CTLCOLORSTATIC(hwnd, dc); 3990 else 3991 EDIT_SEND_CTLCOLOR(hwnd, dc); 3992 3993 if (!es->bEnableState) 3994 SetTextColor(dc, GetSysColor(COLOR_GRAYTEXT)); 3995 GetClipBox(dc, &rcRgn); 3996 if (es->style & ES_MULTILINE) { 3997 INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height; 3998 for (i = es->y_offset ; i <= min(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) { 3999 EDIT_GetLineRect(hwnd, dc, es, i, 0, -1, &rcLine); 4000 if (IntersectRect(&rc, &rcRgn, &rcLine)) 4001 EDIT_PaintLine(hwnd, es, dc, i, rev); 4002 } 4003 } else { 4004 EDIT_GetLineRect(hwnd, dc, es, 0, 0, -1, &rcLine); 4005 if (IntersectRect(&rc, &rcRgn, &rcLine)) 4006 EDIT_PaintLine(hwnd, es, dc, 0, rev); 4007 } 4008 if (es->font) 4009 SelectObject(dc, old_font); 4010 4011 if (!wParam) 4012 EndPaint(hwnd, &ps); 3947 4013 } 3948 4014 … … 3957 4023 HGLOBAL hsrc; 3958 4024 LPSTR src; 4025 4026 /* Protect read-only edit control from modification */ 4027 if(es->style & ES_READONLY) 4028 return; 3959 4029 3960 4030 OpenClipboard(hwnd);
Note:
See TracChangeset
for help on using the changeset viewer.