Appearance bug fixes.

svn path=/trunk/; revision=7196
This commit is contained in:
Filip Navara 2003-12-23 18:19:07 +00:00
parent 96b1759d3d
commit 02ce06682e
6 changed files with 477 additions and 694 deletions

View file

@ -19,12 +19,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __USE_W32API
#define __USE_W32API
#endif
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windows.h"
#include "controls.h"
#include "user32/regcontrol.h"
#include "wine/unicode.h"
#include "wine/debug.h"
HPEN STDCALL GetSysColorPen (int nIndex); // ReactOS Hack. Go Away
#ifdef __REACTOS__
HPEN STDCALL GetSysColorPen(int nIndex);
#endif
/* GetWindowLong offsets for window extra information */
#define STATE_GWL_OFFSET 0
@ -99,13 +110,23 @@ static WORD checkBoxWidth = 0, checkBoxHeight = 0;
*/
const struct builtin_class_descr BUTTON_builtin_class =
{
L"Button", /* name */
#ifdef __REACTOS__
L"Button", /* name */
CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
(WNDPROC) ButtonWndProcW, /* procW */
(WNDPROC) ButtonWndProcA, /* procA */
ButtonWndProcW, /* procW */
ButtonWndProcA, /* procA */
NB_EXTRA_BYTES, /* extra */
(LPCWSTR) IDC_ARROW, /* cursor */
(LPWSTR)IDC_ARROW, /* cursor */
0 /* brush */
#else
"Button", /* name */
CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
ButtonWndProcA, /* procA */
ButtonWndProcW, /* procW */
NB_EXTRA_BYTES, /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
#endif
};
@ -372,9 +393,10 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
case WM_SYSCOLORCHANGE:
InvalidateRect( hWnd, NULL, FALSE );
break;
#ifndef __REACTOS__
case BM_SETSTYLE16:
#endif /* __REACTOS__ */
#endif
case BM_SETSTYLE:
if ((wParam & 0x0f) >= MAX_BTN_TYPE) break;
btn_type = wParam & 0x0f;
@ -411,14 +433,16 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
case BM_GETIMAGE:
return GetWindowLongA( hWnd, HIMAGE_GWL_OFFSET );
#ifndef __REACTOS__
case BM_GETCHECK16:
#endif /* __REACTOS__ */
#endif
case BM_GETCHECK:
return get_button_state( hWnd ) & 3;
#ifndef __REACTOS__
case BM_SETCHECK16:
#endif /* __REACTOS__ */
#endif
case BM_SETCHECK:
if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type];
state = get_button_state( hWnd );
@ -436,11 +460,13 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
if ((btn_type == BS_AUTORADIOBUTTON) && (wParam == BUTTON_CHECKED) && (style & WS_CHILD))
BUTTON_CheckAutoRadioButton( hWnd );
break;
#ifndef __REACTOS__
case BM_GETSTATE16:
#endif
case BM_GETSTATE:
return get_button_state( hWnd );
#ifndef __REACTOS__
case BM_SETSTATE16:
#endif
@ -729,13 +755,18 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
GetClientRect( hwnd, &rc );
/* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
/* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
#ifndef __REACTOS__
hOldPen = (HPEN)SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
#else
hOldPen = (HPEN)SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME));
#endif
hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
oldBkMode = SetBkMode(hDC, TRANSPARENT);
#ifndef __REACTOS__
#ifndef __REACTOS__
if ( TWEAK_WineLook == WIN31_LOOK)
{
COLORREF clr_wnd = GetSysColor(COLOR_WINDOW);
@ -747,12 +778,14 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
SetPixel( hDC, rc.right-1, rc.bottom-1, clr_wnd);
InflateRect( &rc, -1, -1 );
}
#endif /* __REACTOS__ */
#endif
if (get_button_type(style) == BS_DEFPUSHBUTTON)
{
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
InflateRect( &rc, -1, -1 );
}
#ifndef __REACTOS__
if (TWEAK_WineLook == WIN31_LOOK)
{
@ -769,7 +802,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
}
}
else
#endif /* __REACTOS__ */
#endif
{
UINT uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT;
@ -800,6 +833,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
if (pushedState)
OffsetRect(&r, 1, 1);
#ifndef __REACTOS__
if(TWEAK_WineLook == WIN31_LOOK)
{
@ -807,6 +841,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
InflateRect(&focus_rect, 2, 0);
}
#endif
hRgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
SelectClipRgn(hDC, hRgn);
@ -889,7 +924,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
/* Draw the check-box bitmap */
if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
{
#ifndef __REACTOS__
#ifndef __REACTOS__
if( TWEAK_WineLook == WIN31_LOOK )
{
HDC hMemDC = CreateCompatibleDC( hDC );
@ -917,7 +952,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
DeleteDC( hMemDC );
}
else
#endif /* __REACTOS__ */
#endif
{
UINT flags;
@ -1034,7 +1069,7 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action )
(WPARAM)hDC, (LPARAM)hwnd);
GetClientRect( hwnd, &rc);
#ifndef __REACTOS__
#ifndef __REACTOS__
if (TWEAK_WineLook == WIN31_LOOK) {
HPEN hPrevPen = SelectObject( hDC,
SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
@ -1044,10 +1079,9 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action )
Rectangle( hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1 );
SelectObject( hDC, hPrevBrush );
SelectObject( hDC, hPrevPen );
}
else
#endif /* __REACTOS__ */
{
} else
#endif
{
TEXTMETRICW tm;
rcFrame = rc;

File diff suppressed because it is too large Load diff

View file

@ -241,54 +241,6 @@ UserDrawCaptionButtonWnd(HWND hWnd, HDC hDC, BOOL bDown, ULONG Type)
UserDrawCaptionButton(&WindowRect, Style, ExStyle, hDC, bDown, Type);
}
/*
* FIXME:
* - Move to controls/scroll.c ?
* - Handle drawing of reversed size grip
*/
VOID
SCROLL_DrawSizeGrip(HDC hDC, LPRECT lpRect)
{
HPEN hPenFace, hPenShadow, hPenHighlight, hOldPen;
POINT pt;
INT i;
pt.x = lpRect->right - 1;
pt.y = lpRect->bottom - 1;
hPenFace = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DFACE));
hOldPen = SelectObject(hDC, hPenFace);
MoveToEx(hDC, pt.x - 12, pt.y, NULL);
LineTo(hDC, pt.x, pt.y);
LineTo(hDC, pt.x, pt.y - 13);
pt.x--;
pt.y--;
hPenShadow = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
SelectObject(hDC, hPenShadow);
for (i = 1; i < 11; i += 4)
{
MoveToEx(hDC, pt.x - i, pt.y, NULL);
LineTo(hDC, pt.x + 1, pt.y - i - 1);
MoveToEx(hDC, pt.x - i - 1, pt.y, NULL);
LineTo(hDC, pt.x + 1, pt.y - i - 2);
}
hPenHighlight = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DHIGHLIGHT));
SelectObject(hDC, hPenHighlight );
for (i = 3; i < 13; i += 4)
{
MoveToEx(hDC, pt.x - i, pt.y, NULL);
LineTo(hDC, pt.x + 1, pt.y - i - 1);
}
SelectObject(hDC, hOldPen);
DeleteObject(hPenFace);
DeleteObject(hPenShadow);
DeleteObject(hPenHighlight);
}
/* FIXME: Verify implementation. */
BOOL
DefWndRedrawIconTitle(HWND hWnd)
@ -475,14 +427,21 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn)
(CurrentRect.bottom - CurrentRect.top) > GetSystemMetrics(SM_CYHSCROLL))
{
TempRect = CurrentRect;
if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
if (ExStyle & WS_EX_LEFTSCROLLBAR)
TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
else
TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
TempRect.top = TempRect.bottom - GetSystemMetrics(SM_CYHSCROLL);
FillRect(hDC, &TempRect, GetSysColorBrush(COLOR_SCROLLBAR));
/* FIXME: Correct drawing of size-box with WS_EX_LEFTSCROLLBAR */
SCROLL_DrawSizeGrip(hDC, &TempRect);
if (!(Style & WS_CHILD) || (ExStyle & WS_EX_MDICHILD))
{
TempRect.top--;
TempRect.bottom++;
TempRect.left--;
TempRect.right++;
DrawFrameControl(hDC, &TempRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
}
IntDrawScrollBar(hWnd, hDC, SB_VERT);
IntDrawScrollBar(hWnd, hDC, SB_HORZ);
}
@ -749,7 +708,8 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
TempRect.top = TempRect2.top;
TempRect.bottom = TempRect2.bottom;
if (PtInRect(&TempRect, Point))
if (PtInRect(&TempRect, Point) &&
(!(Style & WS_CHILD) || (ExStyle & WS_EX_MDICHILD)))
{
if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
return HTBOTTOMLEFT;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: painting.c,v 1.50 2003/12/22 11:37:32 navaraf Exp $
* $Id: painting.c,v 1.51 2003/12/23 18:19:07 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1064,7 +1064,7 @@ NtUserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
* NtUserScrollWindowEx
*
* Status
* @unimplemented
* @implemented
*/
DWORD STDCALL

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dc.c,v 1.113 2003/12/13 23:26:04 gvg Exp $
/* $Id: dc.c,v 1.114 2003/12/23 18:19:07 navaraf Exp $
*
* DC.C - Device context functions
*
@ -1932,6 +1932,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
NewDC->w.xformWorld2Vport = NewDC->w.xformWorld2Wnd;
NewDC->w.xformVport2World = NewDC->w.xformWorld2Wnd;
NewDC->w.vport2WorldValid = TRUE;
NewDC->w.MapMode = MM_TEXT;
NewDC->w.hFont = NtGdiGetStockObject(SYSTEM_FONT);
TextIntRealizeFont(NewDC->w.hFont);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: text.c,v 1.63 2003/12/21 20:37:42 navaraf Exp $ */
/* $Id: text.c,v 1.64 2003/12/23 18:19:07 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN
@ -890,7 +890,7 @@ TextIntGetTextExtentPoint(PTEXTOBJ TextObj,
FT_Face face;
FT_GlyphSlot glyph;
INT error, n, glyph_index, i, previous;
LONG TotalWidth = 0, MaxHeight = 0;
LONG TotalWidth = 0;
FT_CharMap charmap, found = NULL;
BOOL use_kerning;
@ -969,11 +969,6 @@ TextIntGetTextExtentPoint(PTEXTOBJ TextObj,
{
DPRINT1("WARNING: Failed to render glyph!\n");
}
if (0 != glyph->bitmap.rows && MaxHeight < (glyph->bitmap.rows - 1))
{
MaxHeight = glyph->bitmap.rows - 1;
}
}
if (TotalWidth <= MaxExtent && NULL != Fit)
@ -990,7 +985,7 @@ TextIntGetTextExtentPoint(PTEXTOBJ TextObj,
}
Size->cx = TotalWidth;
Size->cy = MaxHeight;
Size->cy = (TextObj->logfont.lfHeight < 0 ? - TextObj->logfont.lfHeight : TextObj->logfont.lfHeight);
return TRUE;
}