mirror of
https://github.com/reactos/reactos.git
synced 2025-05-17 16:27:00 +00:00
Added new port of WINE controls to get rid of some debug messages
and make the code a little cleaner. svn path=/trunk/; revision=7056
This commit is contained in:
parent
fafd8079ae
commit
11238b6c17
4 changed files with 659 additions and 462 deletions
|
@ -1,30 +1,45 @@
|
|||
/* $Id: button.c,v 1.13 2003/11/08 15:35:58 mf Exp $
|
||||
/* File: button.c -- Button type widgets
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User32
|
||||
* PURPOSE: Button control
|
||||
* FILE: lib/user32/controls/static.c
|
||||
* PROGRAMER: Richard Campbell lib/user32/controls/button.c
|
||||
* REVISION HISTORY: 2003/05/28 Created
|
||||
* NOTES: Adapted from Wine
|
||||
* Copyright (C) 1993 Johannes Ruscheinski
|
||||
* Copyright (C) 1993 David Metcalfe
|
||||
* Copyright (C) 1994 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "windows.h"
|
||||
#include "user32/regcontrol.h"
|
||||
#include "user32.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
HPEN STDCALL GetSysColorPen (int nIndex); // ReactOS Hack. Go Away
|
||||
|
||||
/* GetWindowLong offsets for window extra information */
|
||||
#define STATE_GWL_OFFSET 0
|
||||
#define HFONT_GWL_OFFSET (sizeof(LONG))
|
||||
#define HIMAGE_GWL_OFFSET (2*sizeof(LONG))
|
||||
#define NB_EXTRA_BYTES (3*sizeof(LONG))
|
||||
|
||||
/* Button state values */
|
||||
#define BUTTON_UNCHECKED 0x00
|
||||
#define BUTTON_CHECKED 0x01
|
||||
#define BUTTON_3STATE 0x02
|
||||
#define BUTTON_HIGHLIGHTED 0x04
|
||||
#define BUTTON_HASFOCUS 0x08
|
||||
#define BUTTON_NSTATES 0x0F
|
||||
|
||||
/* undocumented flags */
|
||||
#define BUTTON_BTNPRESSED 0x40
|
||||
#define BUTTON_UNKNOWN2 0x20
|
||||
#define BUTTON_UNKNOWN3 0x10
|
||||
|
@ -75,6 +90,7 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
|
|||
OB_Paint /* BS_OWNERDRAW */
|
||||
};
|
||||
|
||||
static HBITMAP hbitmapCheckBoxes = 0;
|
||||
static WORD checkBoxWidth = 0, checkBoxHeight = 0;
|
||||
|
||||
|
||||
|
@ -85,14 +101,13 @@ const struct builtin_class_descr BUTTON_builtin_class =
|
|||
{
|
||||
L"Button", /* name */
|
||||
CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
|
||||
(WNDPROC) ButtonWndProcA, /* procA */
|
||||
(WNDPROC) ButtonWndProcW, /* procW */
|
||||
(WNDPROC) ButtonWndProcA, /* procA */
|
||||
NB_EXTRA_BYTES, /* extra */
|
||||
(LPCWSTR) IDC_ARROW, /* cursor */
|
||||
(LPCWSTR) IDC_ARROW, /* cursor */
|
||||
0 /* brush */
|
||||
};
|
||||
|
||||
HPEN STDCALL GetSysColorPen (int nIndex);
|
||||
|
||||
inline static LONG get_button_state( HWND hwnd )
|
||||
{
|
||||
|
@ -133,17 +148,9 @@ inline static void paint_button( HWND hwnd, LONG style, UINT action )
|
|||
/* retrieve the button text; returned buffer must be freed by caller */
|
||||
inline static WCHAR *get_button_text( HWND hwnd )
|
||||
{
|
||||
INT len;
|
||||
WCHAR *buffer;
|
||||
DbgPrint("[button] In get_button_text()\n");
|
||||
len = GetWindowTextLengthW( hwnd );
|
||||
buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
|
||||
if (buffer)
|
||||
{
|
||||
GetWindowTextW( hwnd, buffer, len );
|
||||
buffer[len] = 0;
|
||||
}
|
||||
DbgPrint("[button] TextLen %d Text = %S\n", len, buffer);
|
||||
INT len = GetWindowTextLengthW( hwnd );
|
||||
WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
|
||||
if (buffer) GetWindowTextW( hwnd, buffer, len + 1 );
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -155,16 +162,11 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
{
|
||||
RECT rect;
|
||||
POINT pt;
|
||||
LONG style;
|
||||
UINT btn_type;
|
||||
LONG style = GetWindowLongA( hWnd, GWL_STYLE );
|
||||
UINT btn_type = get_button_type( style );
|
||||
LONG state;
|
||||
HANDLE oldHbitmap;
|
||||
|
||||
DbgPrint("[button] ButtonWndProc called : msg %d\n", uMsg);
|
||||
|
||||
style = GetWindowLongA( hWnd, GWL_STYLE );
|
||||
btn_type = get_button_type( style );
|
||||
|
||||
pt.x = LOWORD(lParam);
|
||||
pt.y = HIWORD(lParam);
|
||||
|
||||
|
@ -181,36 +183,43 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
}
|
||||
|
||||
case WM_ENABLE:
|
||||
DbgPrint("[button] WM_ENABLE\n");
|
||||
paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
|
||||
break;
|
||||
|
||||
case WM_CREATE:
|
||||
DbgPrint("[button] WM_CREATE\n");
|
||||
|
||||
checkBoxWidth = 13;
|
||||
checkBoxHeight = 13;
|
||||
|
||||
if (!hbitmapCheckBoxes)
|
||||
{
|
||||
BITMAP bmp;
|
||||
hbitmapCheckBoxes = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CHECKBOXES));
|
||||
GetObjectW( hbitmapCheckBoxes, sizeof(bmp), &bmp );
|
||||
checkBoxWidth = bmp.bmWidth / 4;
|
||||
checkBoxHeight = bmp.bmHeight / 3;
|
||||
}
|
||||
if (btn_type >= MAX_BTN_TYPE)
|
||||
return -1; /* abort */
|
||||
set_button_state( hWnd, BUTTON_UNCHECKED );
|
||||
DbgPrint("[button] Done creating\n");
|
||||
return 0;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
DbgPrint("[button] WM_ERASEBKGND\n");
|
||||
if (btn_type == BS_OWNERDRAW)
|
||||
{
|
||||
HDC hdc = (HDC)wParam;
|
||||
RECT rc;
|
||||
HBRUSH hBrush = (HBRUSH)SendMessageW(GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd);
|
||||
if (!hBrush) /* did the app forget to call defwindowproc ? */
|
||||
hBrush = (HBRUSH)DefWindowProcW(GetParent(hWnd), WM_CTLCOLORBTN,
|
||||
(WPARAM)hdc, (LPARAM)hWnd);
|
||||
GetClientRect(hWnd, &rc);
|
||||
FillRect(hdc, &rc, hBrush);
|
||||
}
|
||||
return 1;
|
||||
|
||||
case WM_PAINT:
|
||||
DbgPrint("[button] WM_PAINT\n");
|
||||
if (btnPaintFunc[btn_type])
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
int nOldMode;
|
||||
DbgPrint("[button] About to draw...\n");
|
||||
hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
|
||||
nOldMode = SetBkMode( hdc, OPAQUE );
|
||||
HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
|
||||
int nOldMode = SetBkMode( hdc, OPAQUE );
|
||||
(btnPaintFunc[btn_type])( hWnd, hdc, ODA_DRAWENTIRE );
|
||||
SetBkMode(hdc, nOldMode); /* reset painting mode */
|
||||
if( !wParam ) EndPaint( hWnd, &ps );
|
||||
|
@ -218,12 +227,12 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_SPACE)
|
||||
{
|
||||
SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 );
|
||||
if (wParam == VK_SPACE)
|
||||
{
|
||||
SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 );
|
||||
set_button_state( hWnd, get_button_state( hWnd ) | BUTTON_BTNPRESSED );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
if(style & BS_NOTIFY ||
|
||||
|
@ -245,9 +254,9 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
if (wParam != VK_SPACE)
|
||||
break;
|
||||
/* fall through */
|
||||
if (wParam != VK_SPACE)
|
||||
break;
|
||||
/* fall through */
|
||||
case WM_LBUTTONUP:
|
||||
state = get_button_state( hWnd );
|
||||
if (!(state & BUTTON_BTNPRESSED)) break;
|
||||
|
@ -261,7 +270,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
SendMessageW( hWnd, BM_SETSTATE, FALSE, 0 );
|
||||
ReleaseCapture();
|
||||
GetClientRect( hWnd, &rect );
|
||||
if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
|
||||
if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
|
||||
{
|
||||
state = get_button_state( hWnd );
|
||||
switch(btn_type)
|
||||
|
@ -302,12 +311,10 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
|
||||
case WM_SETTEXT:
|
||||
{
|
||||
HDC hdc;
|
||||
/* Clear an old text here as Windows does */
|
||||
HDC hdc = GetDC(hWnd);
|
||||
HBRUSH hbrush;
|
||||
RECT client, rc;
|
||||
DbgPrint("[button] WM_SETTEXT");
|
||||
/* Clear an old text here as Windows does */
|
||||
hdc = GetDC(hWnd);
|
||||
|
||||
hbrush = (HBRUSH)SendMessageW(GetParent(hWnd), WM_CTLCOLORSTATIC,
|
||||
(WPARAM)hdc, (LPARAM)hWnd);
|
||||
|
@ -334,17 +341,14 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
}
|
||||
|
||||
case WM_SETFONT:
|
||||
DbgPrint("[button] WM_SETFONT");
|
||||
set_button_font( hWnd, (HFONT)wParam );
|
||||
if (lParam) paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
|
||||
break;
|
||||
|
||||
case WM_GETFONT:
|
||||
DbgPrint("[button] WM_GETFONT");
|
||||
return (LRESULT)get_button_font( hWnd );
|
||||
|
||||
case WM_SETFOCUS:
|
||||
DbgPrint("[button] WM_SETFOCUS");
|
||||
if ((btn_type == BS_RADIOBUTTON || btn_type == BS_AUTORADIOBUTTON) && (GetCapture() != hWnd) &&
|
||||
!(SendMessageW(hWnd, BM_GETCHECK, 0, 0) & BST_CHECKED))
|
||||
{
|
||||
|
@ -360,19 +364,18 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
DbgPrint("[button] WM_KILLFOCUS");
|
||||
set_button_state( hWnd, get_button_state(hWnd) & ~BUTTON_HASFOCUS );
|
||||
paint_button( hWnd, btn_type, ODA_FOCUS );
|
||||
InvalidateRect( hWnd, NULL, TRUE );
|
||||
break;
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
DbgPrint("[button] WM_SYSCOLORCHANGE");
|
||||
InvalidateRect( hWnd, NULL, FALSE );
|
||||
break;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
case BM_SETSTYLE16:
|
||||
#endif /* __REACTOS__ */
|
||||
case BM_SETSTYLE:
|
||||
DbgPrint("[button] BM_SETSTYLE");
|
||||
if ((wParam & 0x0f) >= MAX_BTN_TYPE) break;
|
||||
btn_type = wParam & 0x0f;
|
||||
style = (style & ~0x0f) | btn_type;
|
||||
|
@ -408,10 +411,14 @@ 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__ */
|
||||
case BM_GETCHECK:
|
||||
return get_button_state( hWnd ) & 3;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
case BM_SETCHECK16:
|
||||
#endif /* __REACTOS__ */
|
||||
case BM_SETCHECK:
|
||||
if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type];
|
||||
state = get_button_state( hWnd );
|
||||
|
@ -421,7 +428,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
else style &= ~WS_TABSTOP;
|
||||
SetWindowLongA( hWnd, GWL_STYLE, style );
|
||||
}
|
||||
if (((WPARAM) state & 3) != wParam)
|
||||
if ((state & 3) != wParam)
|
||||
{
|
||||
set_button_state( hWnd, (state & ~3) | wParam );
|
||||
paint_button( hWnd, btn_type, ODA_SELECT );
|
||||
|
@ -429,10 +436,14 @@ 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
|
||||
case BM_SETSTATE:
|
||||
state = get_button_state( hWnd );
|
||||
if (wParam)
|
||||
|
@ -460,7 +471,9 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
|
||||
/***********************************************************************
|
||||
* ButtonWndProcW
|
||||
* The button window procedure.
|
||||
* The button window procedure. This is just a wrapper which locks
|
||||
* the passed HWND and calls the real window procedure (with a WND*
|
||||
* pointer pointing to the locked windowstructure).
|
||||
*/
|
||||
static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
@ -539,24 +552,18 @@ static UINT BUTTON_BStoDT(DWORD style)
|
|||
*/
|
||||
static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
|
||||
{
|
||||
LONG style;
|
||||
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
WCHAR *text;
|
||||
ICONINFO iconInfo;
|
||||
BITMAP bm;
|
||||
UINT dtStyle;
|
||||
UINT dtStyle = BUTTON_BStoDT(style);
|
||||
RECT r = *rc;
|
||||
INT n;
|
||||
|
||||
DbgPrint("[button] In BUTTON_CalcLabelRect()\n");
|
||||
style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||
|
||||
dtStyle = BUTTON_BStoDT(style);
|
||||
|
||||
/* Calculate label rectangle according to label type */
|
||||
switch (style & (BS_ICON|BS_BITMAP))
|
||||
{
|
||||
case BS_TEXT:
|
||||
DbgPrint("[button] BS_TEXT\n");
|
||||
if (!(text = get_button_text( hwnd ))) goto empty_rect;
|
||||
if (!text[0])
|
||||
{
|
||||
|
@ -568,7 +575,6 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
|
|||
break;
|
||||
|
||||
case BS_ICON:
|
||||
DbgPrint("[button] BS_ICON\n");
|
||||
if (!GetIconInfo((HICON)GetWindowLongA( hwnd, HIMAGE_GWL_OFFSET ), &iconInfo))
|
||||
goto empty_rect;
|
||||
|
||||
|
@ -582,7 +588,6 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
|
|||
break;
|
||||
|
||||
case BS_BITMAP:
|
||||
DbgPrint("[button] BS_BITMAP\n");
|
||||
if (!GetObjectW( (HANDLE)GetWindowLongA( hwnd, HIMAGE_GWL_OFFSET ), sizeof(BITMAP), &bm))
|
||||
goto empty_rect;
|
||||
|
||||
|
@ -590,10 +595,8 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
|
|||
r.bottom = r.top + bm.bmHeight;
|
||||
break;
|
||||
|
||||
default:
|
||||
empty_rect:
|
||||
DbgPrint("[button] EMPTY RECT!\n");
|
||||
|
||||
default: /* BS_OWNERDRAW, ... */
|
||||
r.right = r.left;
|
||||
r.bottom = r.top;
|
||||
return (UINT)(LONG)-1;
|
||||
|
@ -628,8 +631,6 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
|
|||
break;
|
||||
}
|
||||
|
||||
DbgPrint("[button] Resulting rectangle = %dx%d to %dx%d\n", r.left, r.top, r.bottom, r.right);
|
||||
|
||||
*rc = r;
|
||||
return dtStyle;
|
||||
}
|
||||
|
@ -664,16 +665,11 @@ static void BUTTON_DrawLabel(HWND hwnd, HDC hdc, UINT dtFlags, RECT *rc)
|
|||
LPARAM lp;
|
||||
WPARAM wp = 0;
|
||||
HBRUSH hbr = 0;
|
||||
UINT flags;
|
||||
LONG state;
|
||||
LONG style;
|
||||
UINT flags = IsWindowEnabled(hwnd) ? DSS_NORMAL : DSS_DISABLED;
|
||||
LONG state = get_button_state( hwnd );
|
||||
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
WCHAR *text = NULL;
|
||||
|
||||
DbgPrint("[button] In BUTTON_DrawLabel()\n");
|
||||
flags = IsWindowEnabled(hwnd) ? DSS_NORMAL : DSS_DISABLED;
|
||||
state = get_button_state( hwnd );
|
||||
style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
|
||||
/* FIXME: To draw disabled label in Win31 look-and-feel, we probably
|
||||
* must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION).
|
||||
* I don't have Win31 on hand to verify that, so I leave it as is.
|
||||
|
@ -709,7 +705,6 @@ static void BUTTON_DrawLabel(HWND hwnd, HDC hdc, UINT dtFlags, RECT *rc)
|
|||
return;
|
||||
}
|
||||
|
||||
DbgPrint("[button] DrawState\n");
|
||||
DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
|
||||
rc->right - rc->left, rc->bottom - rc->top, flags);
|
||||
if (text) HeapFree( GetProcessHeap(), 0, text );
|
||||
|
@ -728,71 +723,95 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||
INT oldBkMode;
|
||||
COLORREF oldTxtColor;
|
||||
HFONT hFont;
|
||||
LONG state;
|
||||
LONG style;
|
||||
BOOL pushedState;
|
||||
UINT uState;
|
||||
|
||||
DbgPrint("[button] In PB_Paint()\n");
|
||||
state = get_button_state( hwnd );
|
||||
style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
pushedState = (state & BUTTON_HIGHLIGHTED);
|
||||
LONG state = get_button_state( hwnd );
|
||||
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
BOOL pushedState = (state & BUTTON_HIGHLIGHTED);
|
||||
|
||||
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 );
|
||||
hOldPen = (HPEN)SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME));
|
||||
hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
|
||||
oldBkMode = SetBkMode(hDC, TRANSPARENT);
|
||||
#ifndef __REACTOS__
|
||||
if ( TWEAK_WineLook == WIN31_LOOK)
|
||||
{
|
||||
COLORREF clr_wnd = GetSysColor(COLOR_WINDOW);
|
||||
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
|
||||
|
||||
SetPixel( hDC, rc.left, rc.top, clr_wnd);
|
||||
SetPixel( hDC, rc.left, rc.bottom-1, clr_wnd);
|
||||
SetPixel( hDC, rc.right-1, rc.top, clr_wnd);
|
||||
SetPixel( hDC, rc.right-1, rc.bottom-1, clr_wnd);
|
||||
InflateRect( &rc, -1, -1 );
|
||||
}
|
||||
#endif /* __REACTOS__ */
|
||||
if (get_button_type(style) == BS_DEFPUSHBUTTON)
|
||||
{
|
||||
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
|
||||
InflateRect( &rc, -1, -1 );
|
||||
InflateRect( &rc, -1, -1 );
|
||||
}
|
||||
|
||||
uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT;
|
||||
|
||||
if (style & BS_FLAT)
|
||||
uState |= DFCS_MONO;
|
||||
else if (pushedState)
|
||||
#ifndef __REACTOS__
|
||||
if (TWEAK_WineLook == WIN31_LOOK)
|
||||
{
|
||||
if (get_button_type(style) == BS_DEFPUSHBUTTON )
|
||||
uState |= DFCS_FLAT;
|
||||
else
|
||||
uState |= DFCS_PUSHED;
|
||||
if (pushedState)
|
||||
{
|
||||
/* draw button shadow: */
|
||||
SelectObject(hDC, GetSysColorBrush(COLOR_BTNSHADOW));
|
||||
PatBlt(hDC, rc.left, rc.top, 1, rc.bottom-rc.top, PATCOPY );
|
||||
PatBlt(hDC, rc.left, rc.top, rc.right-rc.left, 1, PATCOPY );
|
||||
} else {
|
||||
rc.right++, rc.bottom++;
|
||||
DrawEdge( hDC, &rc, EDGE_RAISED, BF_RECT );
|
||||
rc.right--, rc.bottom--;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* __REACTOS__ */
|
||||
{
|
||||
UINT uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT;
|
||||
|
||||
if (state & (BUTTON_CHECKED | BUTTON_3STATE))
|
||||
uState |= DFCS_CHECKED;
|
||||
if (style & BS_FLAT)
|
||||
uState |= DFCS_MONO;
|
||||
else if (pushedState)
|
||||
{
|
||||
if (get_button_type(style) == BS_DEFPUSHBUTTON )
|
||||
uState |= DFCS_FLAT;
|
||||
else
|
||||
uState |= DFCS_PUSHED;
|
||||
}
|
||||
|
||||
DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
|
||||
if (state & (BUTTON_CHECKED | BUTTON_3STATE))
|
||||
uState |= DFCS_CHECKED;
|
||||
|
||||
focus_rect = rc;
|
||||
DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
|
||||
|
||||
focus_rect = rc;
|
||||
}
|
||||
|
||||
/* draw button label */
|
||||
DbgPrint("[button] About to calculate label rectangle\n");
|
||||
r = rc;
|
||||
dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &r);
|
||||
|
||||
if (dtFlags == (UINT)-1L)
|
||||
{
|
||||
DbgPrint("[button] JUMPING TO CLEANUP!\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (pushedState)
|
||||
OffsetRect(&r, 1, 1);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if(TWEAK_WineLook == WIN31_LOOK)
|
||||
{
|
||||
focus_rect = r;
|
||||
InflateRect(&focus_rect, 2, 0);
|
||||
}
|
||||
#endif
|
||||
hRgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
|
||||
SelectClipRgn(hDC, hRgn);
|
||||
|
||||
DbgPrint("[button] Setting text color\n");
|
||||
oldTxtColor = SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) );
|
||||
|
||||
DbgPrint("[button] Calling BUTTON_DrawLabel\n");
|
||||
BUTTON_DrawLabel(hwnd, hDC, dtFlags, &r);
|
||||
|
||||
SetTextColor( hDC, oldTxtColor );
|
||||
|
@ -810,8 +829,6 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||
SelectObject( hDC, hOldPen );
|
||||
SelectObject( hDC, hOldBrush );
|
||||
SetBkMode(hDC, oldBkMode);
|
||||
|
||||
DbgPrint("[button] Quitting\n");
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -832,14 +849,13 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||
if (style & BS_PUSHLIKE)
|
||||
{
|
||||
PB_Paint( hwnd, hDC, action );
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
GetClientRect(hwnd, &client);
|
||||
rbox = rtext = client;
|
||||
|
||||
if ((hFont = get_button_font( hwnd )))
|
||||
SelectObject( hDC, hFont );
|
||||
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
|
||||
|
||||
hBrush = (HBRUSH)SendMessageW(GetParent(hwnd), WM_CTLCOLORSTATIC,
|
||||
(WPARAM)hDC, (LPARAM)hwnd);
|
||||
|
@ -849,7 +865,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||
|
||||
if (style & BS_LEFTTEXT)
|
||||
{
|
||||
/* magic +4 is what CTL3D expects */
|
||||
/* magic +4 is what CTL3D expects */
|
||||
|
||||
rtext.right -= checkBoxWidth + 4;
|
||||
rbox.left = rbox.right - checkBoxWidth;
|
||||
|
@ -859,96 +875,106 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||
rtext.left += checkBoxWidth + 4;
|
||||
rbox.right = checkBoxWidth;
|
||||
}
|
||||
|
||||
|
||||
/* Since WM_ERASEBKGND does nothing, first prepare background */
|
||||
if (action == ODA_SELECT)
|
||||
FillRect( hDC, &rbox, hBrush );
|
||||
if (action == ODA_DRAWENTIRE)
|
||||
FillRect( hDC, &client, hBrush );
|
||||
if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
|
||||
if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush );
|
||||
|
||||
/* Draw label */
|
||||
client = rtext;
|
||||
dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rtext);
|
||||
|
||||
|
||||
rbox.top = rtext.top;
|
||||
rbox.bottom = rtext.bottom;
|
||||
/* Draw the check-box bitmap */
|
||||
if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
|
||||
{
|
||||
UINT flags;
|
||||
|
||||
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
||||
(get_button_type(style) == BS_AUTORADIOBUTTON))
|
||||
flags = DFCS_BUTTONRADIO;
|
||||
else if (state & BUTTON_3STATE)
|
||||
flags = DFCS_BUTTON3STATE;
|
||||
else
|
||||
flags = DFCS_BUTTONCHECK;
|
||||
|
||||
if (state & (BUTTON_CHECKED | BUTTON_3STATE))
|
||||
flags |= DFCS_CHECKED;
|
||||
if (state & BUTTON_HIGHLIGHTED)
|
||||
flags |= DFCS_PUSHED;
|
||||
|
||||
if (style & WS_DISABLED)
|
||||
flags |= DFCS_INACTIVE;
|
||||
|
||||
/* rbox must have the correct height */
|
||||
delta = rbox.bottom - rbox.top - checkBoxHeight;
|
||||
|
||||
if (style & BS_TOP)
|
||||
#ifndef __REACTOS__
|
||||
if( TWEAK_WineLook == WIN31_LOOK )
|
||||
{
|
||||
if (delta > 0)
|
||||
{
|
||||
rbox.bottom = rbox.top + checkBoxHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
rbox.top -= -delta/2 + 1;
|
||||
rbox.bottom += rbox.top + checkBoxHeight;
|
||||
}
|
||||
}
|
||||
else if (style & BS_BOTTOM)
|
||||
{
|
||||
if (delta > 0)
|
||||
{
|
||||
rbox.top = rbox.bottom - checkBoxHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
rbox.bottom += -delta/2 + 1;
|
||||
rbox.top = rbox.bottom -= checkBoxHeight;
|
||||
}
|
||||
HDC hMemDC = CreateCompatibleDC( hDC );
|
||||
int x = 0, y = 0;
|
||||
delta = (rbox.bottom - rbox.top - checkBoxHeight) / 2;
|
||||
|
||||
/* Check in case the client area is smaller than the checkbox bitmap */
|
||||
if (delta < 0) delta = 0;
|
||||
|
||||
if (state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
|
||||
if (state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
|
||||
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
||||
(get_button_type(style) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
|
||||
else if (state & BUTTON_3STATE) y += 2 * checkBoxHeight;
|
||||
|
||||
/* The bitmap for the radio button is not aligned with the
|
||||
* left of the window, it is 1 pixel off. */
|
||||
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
||||
(get_button_type(style) == BS_AUTORADIOBUTTON))
|
||||
rbox.left += 1;
|
||||
|
||||
SelectObject( hMemDC, hbitmapCheckBoxes );
|
||||
BitBlt( hDC, rbox.left, rbox.top + delta, checkBoxWidth,
|
||||
checkBoxHeight, hMemDC, x, y, SRCCOPY );
|
||||
DeleteDC( hMemDC );
|
||||
}
|
||||
else
|
||||
#endif /* __REACTOS__ */
|
||||
{
|
||||
/* Default */
|
||||
if (delta > 0)
|
||||
{
|
||||
int ofs = (delta / 2);
|
||||
rbox.bottom -= ofs + 1;
|
||||
rbox.top = rbox.bottom - checkBoxHeight;
|
||||
}
|
||||
else if (delta < 0)
|
||||
{
|
||||
int ofs = (-delta / 2);
|
||||
rbox.top -= ofs + 1;
|
||||
rbox.bottom = rbox.top + checkBoxHeight;
|
||||
}
|
||||
}
|
||||
UINT flags;
|
||||
|
||||
DrawFrameControl( hDC, &rbox, DFC_BUTTON, flags );
|
||||
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
||||
(get_button_type(style) == BS_AUTORADIOBUTTON)) flags = DFCS_BUTTONRADIO;
|
||||
else if (state & BUTTON_3STATE) flags = DFCS_BUTTON3STATE;
|
||||
else flags = DFCS_BUTTONCHECK;
|
||||
|
||||
if (state & (BUTTON_CHECKED | BUTTON_3STATE)) flags |= DFCS_CHECKED;
|
||||
if (state & BUTTON_HIGHLIGHTED) flags |= DFCS_PUSHED;
|
||||
|
||||
if (style & WS_DISABLED) flags |= DFCS_INACTIVE;
|
||||
|
||||
/* rbox must have the correct height */
|
||||
delta = rbox.bottom - rbox.top - checkBoxHeight;
|
||||
|
||||
if (style & BS_TOP) {
|
||||
if (delta > 0) {
|
||||
rbox.bottom = rbox.top + checkBoxHeight;
|
||||
} else {
|
||||
rbox.top -= -delta/2 + 1;
|
||||
rbox.bottom += rbox.top + checkBoxHeight;
|
||||
}
|
||||
} else if (style & BS_BOTTOM) {
|
||||
if (delta > 0) {
|
||||
rbox.top = rbox.bottom - checkBoxHeight;
|
||||
} else {
|
||||
rbox.bottom += -delta/2 + 1;
|
||||
rbox.top = rbox.bottom -= checkBoxHeight;
|
||||
}
|
||||
} else { /* Default */
|
||||
if (delta > 0)
|
||||
{
|
||||
int ofs = (delta / 2);
|
||||
rbox.bottom -= ofs + 1;
|
||||
rbox.top = rbox.bottom - checkBoxHeight;
|
||||
}
|
||||
else if (delta < 0)
|
||||
{
|
||||
int ofs = (-delta / 2);
|
||||
rbox.top -= ofs + 1;
|
||||
rbox.bottom = rbox.top + checkBoxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
DrawFrameControl( hDC, &rbox, DFC_BUTTON, flags );
|
||||
}
|
||||
}
|
||||
|
||||
if (dtFlags == (UINT)-1L) /* Noting to draw */
|
||||
return;
|
||||
|
||||
return;
|
||||
hRgn = CreateRectRgn(client.left, client.top, client.right, client.bottom);
|
||||
SelectClipRgn(hDC, hRgn);
|
||||
DeleteObject(hRgn);
|
||||
|
||||
if (action == ODA_DRAWENTIRE)
|
||||
BUTTON_DrawLabel(hwnd, hDC, dtFlags, &rtext);
|
||||
BUTTON_DrawLabel(hwnd, hDC, dtFlags, &rtext);
|
||||
|
||||
/* ... and focus */
|
||||
if ((action == ODA_FOCUS) ||
|
||||
|
@ -996,7 +1022,6 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||
HBRUSH hbr;
|
||||
HFONT hFont;
|
||||
UINT dtFlags;
|
||||
TEXTMETRICW tm;
|
||||
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
|
||||
if (action != ODA_DRAWENTIRE) return;
|
||||
|
@ -1009,12 +1034,27 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||
(WPARAM)hDC, (LPARAM)hwnd);
|
||||
|
||||
GetClientRect( hwnd, &rc);
|
||||
#ifndef __REACTOS__
|
||||
if (TWEAK_WineLook == WIN31_LOOK) {
|
||||
HPEN hPrevPen = SelectObject( hDC,
|
||||
SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
|
||||
HBRUSH hPrevBrush = SelectObject( hDC,
|
||||
GetStockObject(NULL_BRUSH) );
|
||||
|
||||
rcFrame = rc;
|
||||
Rectangle( hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1 );
|
||||
SelectObject( hDC, hPrevBrush );
|
||||
SelectObject( hDC, hPrevPen );
|
||||
}
|
||||
else
|
||||
#endif /* __REACTOS__ */
|
||||
{
|
||||
TEXTMETRICW tm;
|
||||
rcFrame = rc;
|
||||
|
||||
GetTextMetricsW (hDC, &tm);
|
||||
rcFrame.top += (tm.tmHeight / 2) - 1;
|
||||
DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
|
||||
GetTextMetricsW (hDC, &tm);
|
||||
rcFrame.top += (tm.tmHeight / 2) - 1;
|
||||
DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
|
||||
}
|
||||
|
||||
InflateRect(&rc, -7, 1);
|
||||
dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rc);
|
||||
|
|
|
@ -19,25 +19,21 @@
|
|||
*
|
||||
* FIXME: roll up in Netscape 3.01.
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User32
|
||||
* PURPOSE: combobox control
|
||||
* FILE: lib/user32/controls/combo.c
|
||||
* PROGRAMER: Steven Edwards
|
||||
* REVISION HISTORY: 2003/06/25 SAE Created
|
||||
* NOTES: Adapted from Wine
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "user32/regcontrol.h"
|
||||
#define NDEBUG
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "windows.h"
|
||||
#include "controls.h"
|
||||
#include "user32/regcontrol.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(combo);
|
||||
|
||||
/* bits in the dwKeyData */
|
||||
#define KEYDATA_ALT 0x2000
|
||||
|
@ -65,14 +61,21 @@ static HBITMAP hComboBmp = 0;
|
|||
static UINT CBitHeight, CBitWidth;
|
||||
|
||||
/*
|
||||
* Look and feel dependant "constants"
|
||||
* Look and feel dependent "constants"
|
||||
*/
|
||||
|
||||
#ifndef __REACTOS__
|
||||
#define COMBO_YBORDERGAP 5
|
||||
#define COMBO_XBORDERSIZE() ( (TWEAK_WineLook == WIN31_LOOK) ? 0 : 2 )
|
||||
#define COMBO_YBORDERSIZE() ( (TWEAK_WineLook == WIN31_LOOK) ? 0 : 2 )
|
||||
#define COMBO_EDITBUTTONSPACE() ( (TWEAK_WineLook == WIN31_LOOK) ? 8 : 0 )
|
||||
#define EDIT_CONTROL_PADDING() ( (TWEAK_WineLook == WIN31_LOOK) ? 0 : 1 )
|
||||
#else /* __REACTOS__ */
|
||||
#define COMBO_YBORDERGAP 5
|
||||
#define COMBO_XBORDERSIZE() ( 2 )
|
||||
#define COMBO_YBORDERSIZE() ( 2 )
|
||||
#define COMBO_EDITBUTTONSPACE() ( 0 )
|
||||
#define EDIT_CONTROL_PADDING() ( 1 )
|
||||
#endif /* __REACTOS__ */
|
||||
|
||||
static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
|
@ -84,10 +87,10 @@ const struct builtin_class_descr COMBO_builtin_class =
|
|||
{
|
||||
L"ComboBox", /* name */
|
||||
CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, /* style */
|
||||
(WNDPROC) ComboWndProcW, /* procW */
|
||||
(WNDPROC) ComboWndProcA, /* procA */
|
||||
(WNDPROC) ComboWndProcW, /* procW */
|
||||
sizeof(HEADCOMBO *), /* extra */
|
||||
(LPCWSTR) IDC_ARROW, /* cursor */
|
||||
(LPCWSTR) IDC_ARROW, /* cursor */
|
||||
0 /* brush */
|
||||
};
|
||||
|
||||
|
@ -115,7 +118,7 @@ static BOOL COMBO_Init()
|
|||
CBitHeight = bm.bmHeight;
|
||||
CBitWidth = bm.bmWidth;
|
||||
|
||||
DbgPrint("combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
|
||||
TRACE("combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
|
||||
|
||||
hPrevB = SelectObject( hDC, hComboBmp);
|
||||
SetRect( &r, 0, 0, CBitWidth, CBitHeight );
|
||||
|
@ -158,7 +161,7 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
|
|||
if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
|
||||
lphc->wState |= CBF_NOTIFY;
|
||||
|
||||
DbgPrint("[%p], style = %08x\n", lphc, lphc->dwStyle );
|
||||
TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -172,7 +175,7 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
|
|||
|
||||
if( lphc )
|
||||
{
|
||||
DbgPrint("[%p]: freeing storage\n", lphc->self);
|
||||
TRACE("[%p]: freeing storage\n", lphc->self);
|
||||
|
||||
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
|
||||
DestroyWindow( lphc->hWndLBox );
|
||||
|
@ -223,8 +226,7 @@ static INT CBGetTextAreaHeight(
|
|||
|
||||
ReleaseDC(hwnd, hDC);
|
||||
|
||||
#if 0
|
||||
iTextItemHeight = ((13 * baseUnitY) / 8);
|
||||
iTextItemHeight = ((13 * baseUnitY) / 8);
|
||||
|
||||
/*
|
||||
* This "formula" calculates the height of the complete control.
|
||||
|
@ -232,11 +234,6 @@ static INT CBGetTextAreaHeight(
|
|||
* borders.
|
||||
*/
|
||||
iTextItemHeight -= 2*COMBO_YBORDERSIZE();
|
||||
#endif
|
||||
|
||||
/* Joakim: This seems to work better, the old formula caused the combo box
|
||||
to be waaay to big with big font sizes */
|
||||
iTextItemHeight = baseUnitY+2*COMBO_YBORDERSIZE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -429,13 +426,13 @@ static void CBCalcPlacement(
|
|||
lprLB->right = lprLB->left + lphc->droppedWidth;
|
||||
}
|
||||
|
||||
DbgPrint("\ttext\t= (%ld,%ld-%ld,%ld)\n",
|
||||
TRACE("\ttext\t= (%ld,%ld-%ld,%ld)\n",
|
||||
lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
|
||||
|
||||
DbgPrint("\tbutton\t= (%ld,%ld-%ld,%ld)\n",
|
||||
TRACE("\tbutton\t= (%ld,%ld-%ld,%ld)\n",
|
||||
lprButton->left, lprButton->top, lprButton->right, lprButton->bottom);
|
||||
|
||||
DbgPrint("\tlbox\t= (%ld,%ld-%ld,%ld)\n",
|
||||
TRACE("\tlbox\t= (%ld,%ld-%ld,%ld)\n",
|
||||
lprLB->left, lprLB->top, lprLB->right, lprLB->bottom );
|
||||
}
|
||||
|
||||
|
@ -486,7 +483,7 @@ static LRESULT COMBO_WindowPosChanging(
|
|||
*/
|
||||
if (posChanging->cy != newComboHeight)
|
||||
{
|
||||
DbgPrint("posChanging->cy=%d, newComboHeight=%d, oldbot=%ld, oldtop=%ld\n",
|
||||
TRACE("posChanging->cy=%d, newComboHeight=%d, oldbot=%ld, oldtop=%ld\n",
|
||||
posChanging->cy, newComboHeight, lphc->droppedRect.bottom,
|
||||
lphc->droppedRect.top);
|
||||
lphc->droppedRect.bottom = lphc->droppedRect.top + posChanging->cy - newComboHeight;
|
||||
|
@ -577,11 +574,13 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
|
|||
* In win 95 look n feel, the listbox in the simple combobox has
|
||||
* the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
|
||||
*/
|
||||
//if (TWEAK_WineLook > WIN31_LOOK)
|
||||
//{
|
||||
#ifndef __REACTOS__
|
||||
if (TWEAK_WineLook > WIN31_LOOK)
|
||||
#endif /* __REACTOS__ */
|
||||
{
|
||||
lbeStyle &= ~WS_BORDER;
|
||||
lbeExStyle |= WS_EX_CLIENTEDGE;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if (unicode)
|
||||
|
@ -610,9 +609,10 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
|
|||
* In Win95 look, the border fo the edit control is
|
||||
* provided by the combobox
|
||||
*/
|
||||
//if (TWEAK_WineLook == WIN31_LOOK)
|
||||
// lbeStyle |= WS_BORDER;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (TWEAK_WineLook == WIN31_LOOK)
|
||||
lbeStyle |= WS_BORDER;
|
||||
#endif /* __REACTOS__ */
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
{
|
||||
if( lphc->dwStyle & CBS_OEMCONVERT )
|
||||
|
@ -660,12 +660,12 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
|
|||
CBForceDummyResize(lphc);
|
||||
}
|
||||
|
||||
OutputDebugStringA("init done\n");
|
||||
TRACE("init done\n");
|
||||
return 0;
|
||||
}
|
||||
OutputDebugStringA("edit control failure.\n");
|
||||
} else OutputDebugStringA("listbox failure.\n");
|
||||
} else OutputDebugStringA("no owner for visible combo.\n");
|
||||
ERR("edit control failure.\n");
|
||||
} else ERR("listbox failure.\n");
|
||||
} else ERR("no owner for visible combo.\n");
|
||||
|
||||
/* CreateWindow() will send WM_NCDESTROY to cleanup */
|
||||
|
||||
|
@ -682,12 +682,64 @@ static void CBPaintButton(
|
|||
HDC hdc,
|
||||
RECT rectButton)
|
||||
{
|
||||
UINT buttonState;
|
||||
|
||||
if( lphc->wState & CBF_NOREDRAW )
|
||||
return;
|
||||
#ifndef __REACTOS__
|
||||
if (TWEAK_WineLook == WIN31_LOOK)
|
||||
{
|
||||
UINT x, y;
|
||||
BOOL bBool;
|
||||
HDC hMemDC;
|
||||
HBRUSH hPrevBrush;
|
||||
COLORREF oldTextColor, oldBkColor;
|
||||
|
||||
buttonState = DFCS_SCROLLCOMBOBOX;
|
||||
|
||||
hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE));
|
||||
|
||||
/*
|
||||
* Draw the button background
|
||||
*/
|
||||
PatBlt( hdc,
|
||||
rectButton.left,
|
||||
rectButton.top,
|
||||
rectButton.right-rectButton.left,
|
||||
rectButton.bottom-rectButton.top,
|
||||
PATCOPY );
|
||||
|
||||
if( (bBool = lphc->wState & CBF_BUTTONDOWN) )
|
||||
{
|
||||
DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT );
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT );
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the edge of the button from the rectangle
|
||||
* and calculate the position of the bitmap.
|
||||
*/
|
||||
InflateRect( &rectButton, -2, -2);
|
||||
|
||||
x = (rectButton.left + rectButton.right - CBitWidth) >> 1;
|
||||
y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1;
|
||||
|
||||
|
||||
hMemDC = CreateCompatibleDC( hdc );
|
||||
SelectObject( hMemDC, hComboBmp );
|
||||
oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) );
|
||||
oldBkColor = SetBkColor( hdc, CB_DISABLED(lphc) ? RGB(128,128,128) :
|
||||
RGB(0,0,0) );
|
||||
BitBlt( hdc, x, y, CBitWidth, CBitHeight, hMemDC, 0, 0, SRCCOPY );
|
||||
SetBkColor( hdc, oldBkColor );
|
||||
SetTextColor( hdc, oldTextColor );
|
||||
DeleteDC( hMemDC );
|
||||
SelectObject( hdc, hPrevBrush );
|
||||
}
|
||||
else
|
||||
#endif /* __REACTOS__ */
|
||||
{
|
||||
UINT buttonState = DFCS_SCROLLCOMBOBOX;
|
||||
|
||||
if (lphc->wState & CBF_BUTTONDOWN)
|
||||
{
|
||||
|
@ -703,6 +755,7 @@ static void CBPaintButton(
|
|||
&rectButton,
|
||||
DFC_SCROLL,
|
||||
buttonState);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -720,7 +773,7 @@ static void CBPaintText(
|
|||
|
||||
if( lphc->wState & CBF_NOREDRAW ) return;
|
||||
|
||||
OutputDebugStringA("\n");
|
||||
TRACE("\n");
|
||||
|
||||
/* follow Windows combobox that sends a bunch of text
|
||||
* inquiries to its listbox while processing WM_PAINT. */
|
||||
|
@ -957,7 +1010,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
|
|||
hDC = (hParamDC) ? hParamDC
|
||||
: BeginPaint( lphc->self, &ps);
|
||||
|
||||
DbgPrint("hdc=%p\n", hDC);
|
||||
TRACE("hdc=%p\n", hDC);
|
||||
|
||||
if( hDC && !(lphc->wState & CBF_NOREDRAW) )
|
||||
{
|
||||
|
@ -974,10 +1027,12 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
|
|||
/*
|
||||
* In non 3.1 look, there is a sunken border on the combobox
|
||||
*/
|
||||
//if (TWEAK_WineLook != WIN31_LOOK)
|
||||
//{
|
||||
#ifndef __REACTOS__
|
||||
if (TWEAK_WineLook != WIN31_LOOK)
|
||||
#endif
|
||||
{
|
||||
CBPaintBorder(lphc->self, lphc, hDC);
|
||||
//}
|
||||
}
|
||||
|
||||
if( !IsRectEmpty(&lphc->buttonRect) )
|
||||
{
|
||||
|
@ -996,6 +1051,22 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
|
|||
|
||||
if( !(lphc->wState & CBF_EDIT) )
|
||||
{
|
||||
/*
|
||||
* The text area has a border only in Win 3.1 look.
|
||||
*/
|
||||
#ifndef __REACTOS__
|
||||
if (TWEAK_WineLook == WIN31_LOOK)
|
||||
{
|
||||
HPEN hPrevPen = SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
|
||||
|
||||
Rectangle( hDC,
|
||||
lphc->textRect.left, lphc->textRect.top,
|
||||
lphc->textRect.right - 1, lphc->textRect.bottom - 1);
|
||||
|
||||
SelectObject( hDC, hPrevPen );
|
||||
}
|
||||
#endif /* __REACTOS__ */
|
||||
|
||||
CBPaintText( lphc, hDC, lphc->textRect);
|
||||
}
|
||||
|
||||
|
@ -1025,7 +1096,7 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
|
|||
if( length > 0 )
|
||||
pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
|
||||
|
||||
DbgPrint("\t edit text length %i\n", length );
|
||||
TRACE("\t edit text length %i\n", length );
|
||||
|
||||
if( pText )
|
||||
{
|
||||
|
@ -1056,7 +1127,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
|
|||
LPWSTR pText = NULL;
|
||||
static const WCHAR empty_stringW[] = { 0 };
|
||||
|
||||
DbgPrint("\t %i\n", index );
|
||||
TRACE("\t %i\n", index );
|
||||
|
||||
if( index >= 0 ) /* got an entry */
|
||||
{
|
||||
|
@ -1093,7 +1164,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
|||
int nItems = 0;
|
||||
int nDroppedHeight;
|
||||
|
||||
DbgPrint("[%p]: drop down\n", lphc->self);
|
||||
TRACE("[%p]: drop down\n", lphc->self);
|
||||
|
||||
CB_NOTIFY( lphc, CBN_DROPDOWN );
|
||||
|
||||
|
@ -1187,7 +1258,7 @@ static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
|
|||
{
|
||||
HWND hWnd = lphc->self;
|
||||
|
||||
DbgPrint("[%p]: sel ok? [%i] dropped? [%i]\n",
|
||||
TRACE("[%p]: sel ok? [%i] dropped? [%i]\n",
|
||||
lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
|
||||
|
||||
CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
|
||||
|
@ -1320,14 +1391,14 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
|
|||
{
|
||||
case (EN_SETFOCUS >> 8):
|
||||
|
||||
DbgPrint("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
|
||||
TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
|
||||
|
||||
COMBO_SetFocus( lphc );
|
||||
break;
|
||||
|
||||
case (EN_KILLFOCUS >> 8):
|
||||
|
||||
DbgPrint("[%p]: edit [%p] lost focus\n", lphc->self, lphc->hWndEdit );
|
||||
TRACE("[%p]: edit [%p] lost focus\n", lphc->self, lphc->hWndEdit );
|
||||
|
||||
/* NOTE: it seems that Windows' edit control sends an
|
||||
* undocumented message WM_USER + 0x1B instead of this
|
||||
|
@ -1384,7 +1455,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
|
|||
case LBN_SELCHANGE:
|
||||
case LBN_SELCANCEL:
|
||||
|
||||
DbgPrint("[%p]: lbox selection change [%x]\n", lphc->self, lphc->wState );
|
||||
TRACE("[%p]: lbox selection change [%x]\n", lphc->self, lphc->wState );
|
||||
|
||||
if( HIWORD(wParam) == LBN_SELCHANGE)
|
||||
{
|
||||
|
@ -1432,7 +1503,7 @@ static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam )
|
|||
HWND hWnd = lphc->self;
|
||||
UINT id = GetWindowLongA( hWnd, GWL_ID );
|
||||
|
||||
DbgPrint("[%p]: ownerdraw op %04x\n", lphc->self, msg );
|
||||
TRACE("[%p]: ownerdraw op %04x\n", lphc->self, msg );
|
||||
|
||||
switch( msg )
|
||||
{
|
||||
|
@ -1851,8 +1922,8 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
{
|
||||
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongA( hwnd, 0 );
|
||||
|
||||
//TRACE("[%p]: msg %s wp %08x lp %08lx\n",
|
||||
// hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
|
||||
TRACE("[%p]: msg %s wp %08x lp %08lx\n",
|
||||
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
|
||||
|
||||
if( lphc || message == WM_NCCREATE )
|
||||
switch(message)
|
||||
|
@ -1935,16 +2006,22 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
return TRUE;
|
||||
case WM_KILLFOCUS:
|
||||
{
|
||||
//HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam );
|
||||
//if( !hwndFocus ||
|
||||
// (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
|
||||
// COMBO_KillFocus( lphc );
|
||||
#ifndef __REACTOS__
|
||||
HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam );
|
||||
#else /* __REACTOS__ */
|
||||
HWND hwndFocus = (HWND)wParam;
|
||||
#endif /* __REACTOS__ */
|
||||
if( !hwndFocus ||
|
||||
(hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
|
||||
COMBO_KillFocus( lphc );
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
//return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );
|
||||
return COMBO_Command( lphc, wParam, (HWND)lParam );
|
||||
|
||||
#ifndef __REACTOS__
|
||||
return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );
|
||||
#else /* __REACTOS__ */
|
||||
return COMBO_Command( lphc, wParam, (HWND)lParam );
|
||||
#endif /* __REACTOS__ */
|
||||
case WM_GETTEXT:
|
||||
return unicode ? COMBO_GetTextW( lphc, wParam, (LPWSTR)lParam )
|
||||
: COMBO_GetTextA( lphc, wParam, (LPSTR)lParam );
|
||||
|
@ -2044,35 +2121,108 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
if (wParam & (MK_SHIFT | MK_CONTROL))
|
||||
return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
|
||||
DefWindowProcA(hwnd, message, wParam, lParam);
|
||||
if (SHIWORD(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
|
||||
if (SHIWORD(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
|
||||
|
||||
if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
|
||||
if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
|
||||
return TRUE;
|
||||
|
||||
/* Combo messages */
|
||||
|
||||
#ifndef __REACTOS__
|
||||
case CB_ADDSTRING16:
|
||||
if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_ADDSTRING:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
|
||||
if( unicode )
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
strlwrW((LPWSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
struprW((LPWSTR)lParam);
|
||||
return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
_strlwr((LPSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
_strupr((LPSTR)lParam);
|
||||
return SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
|
||||
}
|
||||
#ifndef __REACTOS__
|
||||
case CB_INSERTSTRING16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_INSERTSTRING:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
||||
if( unicode )
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
strlwrW((LPWSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
struprW((LPWSTR)lParam);
|
||||
return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
_strlwr((LPSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
_strupr((LPSTR)lParam);
|
||||
return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
||||
}
|
||||
#ifndef __REACTOS__
|
||||
case CB_DELETESTRING16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_DELETESTRING:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) :
|
||||
SendMessageA(lphc->hWndLBox, LB_DELETESTRING, wParam, 0);
|
||||
#ifndef __REACTOS__
|
||||
case CB_SELECTSTRING16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_SELECTSTRING:
|
||||
return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode);
|
||||
#ifndef __REACTOS__
|
||||
case CB_FINDSTRING16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_FINDSTRING:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam);
|
||||
#ifndef __REACTOS__
|
||||
case CB_FINDSTRINGEXACT16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_FINDSTRINGEXACT:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam);
|
||||
#ifndef __REACTOS__
|
||||
case CB_SETITEMHEIGHT16:
|
||||
wParam = (INT)(INT16)wParam; /* signed integer */
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_SETITEMHEIGHT:
|
||||
return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETITEMHEIGHT16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETITEMHEIGHT:
|
||||
if( (INT)wParam >= 0 ) /* listbox item */
|
||||
return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
|
||||
return CBGetTextAreaHeight(hwnd, lphc);
|
||||
#ifndef __REACTOS__
|
||||
case CB_RESETCONTENT16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_RESETCONTENT:
|
||||
SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);
|
||||
if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) )
|
||||
|
@ -2103,16 +2253,35 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) &&
|
||||
(INT)wParam < 32768 ) lphc->droppedWidth = (INT)wParam;
|
||||
return CB_ERR;
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETDROPPEDCONTROLRECT16:
|
||||
lParam = (LPARAM)MapSL(lParam);
|
||||
if( lParam )
|
||||
{
|
||||
RECT r;
|
||||
CBGetDroppedControlRect( lphc, &r );
|
||||
CONV_RECT32TO16( &r, (LPRECT16)lParam );
|
||||
}
|
||||
return CB_OKAY;
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETDROPPEDCONTROLRECT:
|
||||
if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam );
|
||||
return CB_OKAY;
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETDROPPEDSTATE16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETDROPPEDSTATE:
|
||||
return (lphc->wState & CBF_DROPPED) ? TRUE : FALSE;
|
||||
#ifndef __REACTOS__
|
||||
case CB_DIR16:
|
||||
return SendMessageA(lphc->hWndLBox, LB_DIR16, wParam, lParam);
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_DIR:
|
||||
if(message == CB_DIR) message = LB_DIR;
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, message, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, message, wParam, lParam);
|
||||
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_DIR, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_DIR, wParam, lParam);
|
||||
#ifndef __REACTOS__
|
||||
case CB_SHOWDROPDOWN16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_SHOWDROPDOWN:
|
||||
if( CB_GETTYPE(lphc) != CBS_SIMPLE )
|
||||
{
|
||||
|
@ -2126,10 +2295,21 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
CBRollUp( lphc, FALSE, TRUE );
|
||||
}
|
||||
return TRUE;
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETCOUNT16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETCOUNT:
|
||||
return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETCURSEL16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETCURSEL:
|
||||
return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
|
||||
#ifndef __REACTOS__
|
||||
case CB_SETCURSEL16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_SETCURSEL:
|
||||
lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0);
|
||||
if( lParam >= 0 )
|
||||
|
@ -2142,26 +2322,58 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||
lphc->wState &= ~CBF_SELCHANGE;
|
||||
return lParam;
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETLBTEXT16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
lParam = (LPARAM)MapSL(lParam);
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETLBTEXT:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETLBTEXTLEN16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETLBTEXTLEN:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0) :
|
||||
SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETITEMDATA16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETITEMDATA:
|
||||
return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
|
||||
#ifndef __REACTOS__
|
||||
case CB_SETITEMDATA16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_SETITEMDATA:
|
||||
return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam);
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETEDITSEL16:
|
||||
wParam = lParam = 0; /* just in case */
|
||||
/* fall through */
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETEDITSEL:
|
||||
/* Edit checks passed parameters itself */
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
|
||||
return CB_ERR;
|
||||
#ifndef __REACTOS__
|
||||
case CB_SETEDITSEL16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_SETEDITSEL:
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
return SendMessageW(lphc->hWndEdit, EM_SETSEL,
|
||||
(INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );
|
||||
return CB_ERR;
|
||||
#ifndef __REACTOS__
|
||||
case CB_SETEXTENDEDUI16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_SETEXTENDEDUI:
|
||||
if( CB_GETTYPE(lphc) == CBS_SIMPLE )
|
||||
return CB_ERR;
|
||||
|
@ -2169,12 +2381,15 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
lphc->wState |= CBF_EUI;
|
||||
else lphc->wState &= ~CBF_EUI;
|
||||
return CB_OKAY;
|
||||
#ifndef __REACTOS__
|
||||
case CB_GETEXTENDEDUI16:
|
||||
#endif /* __REACTOS__ */
|
||||
case CB_GETEXTENDEDUI:
|
||||
return (lphc->wState & CBF_EUI) ? TRUE : FALSE;
|
||||
|
||||
default:
|
||||
if (message >= WM_USER)
|
||||
DbgPrint("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n",
|
||||
WARN("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n",
|
||||
message - WM_USER, wParam, lParam );
|
||||
break;
|
||||
}
|
||||
|
@ -2184,6 +2399,9 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
|
||||
/***********************************************************************
|
||||
* ComboWndProcA
|
||||
*
|
||||
* This is just a wrapper for the real ComboWndProc which locks/unlocks
|
||||
* window structs.
|
||||
*/
|
||||
static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
|
|
@ -38,45 +38,14 @@
|
|||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "windows.h"
|
||||
#include "controls.h"
|
||||
#include "user32/regcontrol.h"
|
||||
#include "user32.h"
|
||||
|
||||
/* Rip the fun and easy WINE unicode string manipulation routines.
|
||||
* Of course I didnt copy the ASM code because we want this to be portable
|
||||
* and it needs to go away.
|
||||
*
|
||||
* Move to the WINE unicode header soon or replace with Windows functions
|
||||
* move vote is to move to the WINE unicode header so we can keep
|
||||
* source the same.
|
||||
*/
|
||||
|
||||
static inline unsigned int strlenW( const WCHAR *str )
|
||||
{
|
||||
const WCHAR *s = str;
|
||||
while (*s) s++;
|
||||
return s - str;
|
||||
}
|
||||
|
||||
static inline WCHAR *strncpyW( WCHAR *str1, const WCHAR *str2, int n )
|
||||
{
|
||||
WCHAR *ret = str1;
|
||||
while (n-- > 0) if (!(*str1++ = *str2++)) break;
|
||||
while (n-- > 0) *str1++ = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
|
||||
{
|
||||
WCHAR *p = dst;
|
||||
while ((*p++ = *src++));
|
||||
return dst;
|
||||
}
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#define BUFLIMIT_MULTI 65534 /* maximum buffer size (not including '\0')
|
||||
FIXME: BTW, new specs say 65535 (do you dare ???) */
|
||||
|
@ -174,7 +143,7 @@ typedef struct
|
|||
#define EDIT_NOTIFY_PARENT(es, wNotifyCode, str) \
|
||||
do \
|
||||
{ /* Notify parent which has created this edit control */ \
|
||||
DbgPrint("[edit]notification " str " sent to hwnd=%p\n", es->hwndParent); \
|
||||
DPRINT1("[edit]notification " str " sent to hwnd=%p\n", es->hwndParent); \
|
||||
SendMessageW(es->hwndParent, WM_COMMAND, \
|
||||
MAKEWPARAM(GetWindowLongW((es->hwndSelf),GWL_ID), wNotifyCode), \
|
||||
(LPARAM)(es->hwndSelf)); \
|
||||
|
@ -331,7 +300,7 @@ static inline BOOL EDIT_EM_CanUndo(EDITSTATE *es)
|
|||
*/
|
||||
static inline void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
|
||||
{
|
||||
DbgPrint("[edit] EDIT_EM_EmptyUndoBuffer\n");
|
||||
DPRINT1("[edit] EDIT_EM_EmptyUndoBuffer\n");
|
||||
es->undo_insert_count = 0;
|
||||
if (es->undo_text)
|
||||
{
|
||||
|
@ -445,7 +414,7 @@ static LRESULT CALLBACK EditWndProc_common( HWND hwnd, UINT msg,
|
|||
EDITSTATE *es = (EDITSTATE *)GetWindowLongW( hwnd, 0 );
|
||||
LRESULT result = 0;
|
||||
|
||||
DbgPrint("[edit]EditWndProc_common hwnd=0x%p msg=0x%x wparam=0x%x lparam=0x%lx\n", hwnd, msg, wParam, lParam);
|
||||
DPRINT1("[edit]EditWndProc_common hwnd=0x%p msg=0x%x wparam=0x%x lparam=0x%lx\n", hwnd, msg, wParam, lParam);
|
||||
|
||||
if (!es && msg != WM_NCCREATE)
|
||||
return DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
|
||||
|
@ -537,7 +506,7 @@ static LRESULT CALLBACK EditWndProc_common( HWND hwnd, UINT msg,
|
|||
case 0x00c3:
|
||||
case WM_USER+26:
|
||||
case 0x00ca:
|
||||
DbgPrint("[edit]undocumented message 0x%x, please report\n", msg);
|
||||
DPRINT1("[edit]undocumented message 0x%x, please report\n", msg);
|
||||
result = DefWindowProcW(hwnd, msg, wParam, lParam);
|
||||
break;
|
||||
|
||||
|
@ -832,7 +801,7 @@ static LRESULT CALLBACK EditWndProc_common( HWND hwnd, UINT msg,
|
|||
* will _not_ be set by DefWindowProc() for edit controls in a
|
||||
* modeless dialog box ???
|
||||
*/
|
||||
DbgPrint("[edit] Got a WM_MOUSEACTIVATE message\n");
|
||||
DPRINT1("[edit] Got a WM_MOUSEACTIVATE message\n");
|
||||
SetFocus(hwnd);
|
||||
result = MA_ACTIVATE;
|
||||
break;
|
||||
|
@ -891,7 +860,7 @@ static LRESULT CALLBACK EditWndProc_common( HWND hwnd, UINT msg,
|
|||
break;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
DbgPrint("[edit]Double plus ungood - WM_MOUSEWHELL support broken in ReactOS\n");
|
||||
DPRINT1("[edit]Double plus ungood - WM_MOUSEWHELL support broken in ReactOS\n");
|
||||
//{
|
||||
// int gcWheelDelta = 0;
|
||||
// UINT pulScrollLines = 3;
|
||||
|
@ -916,7 +885,7 @@ static LRESULT CALLBACK EditWndProc_common( HWND hwnd, UINT msg,
|
|||
}
|
||||
|
||||
if (es) EDIT_UnlockBuffer(es, FALSE);
|
||||
DbgPrint("[edit]result from message %d is 0x%X\n", msg, result);
|
||||
DPRINT1("[edit]result from message %d is 0x%X\n", msg, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -985,7 +954,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
|
|||
|
||||
if (!current_line) /* Error occurred start is not inside previous buffer */
|
||||
{
|
||||
OutputDebugStringA(" modification occurred outside buffer\n");
|
||||
DPRINT1(" modification occurred outside buffer\n");
|
||||
ReleaseDC(es->hwndSelf, dc);
|
||||
return;
|
||||
}
|
||||
|
@ -1230,7 +1199,7 @@ static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count
|
|||
{
|
||||
INT ret; //, iWndsLocks;
|
||||
|
||||
OutputDebugStringA("WARNING - Possible deadlock in EDIT_CallWordBreakProc\n");
|
||||
DPRINT1("WARNING - Possible deadlock in EDIT_CallWordBreakProc\n");
|
||||
/* To avoid any deadlocks, all the locks on the window structures
|
||||
must be suspended before the control is passed to the application. */
|
||||
//iWndsLocks = WIN_SuspendWndsLock();
|
||||
|
@ -1252,7 +1221,7 @@ static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count
|
|||
countA = WideCharToMultiByte(CP_ACP, 0, es->text + start, count, NULL, 0, NULL, NULL);
|
||||
textA = HeapAlloc(GetProcessHeap(), 0, countA);
|
||||
WideCharToMultiByte(CP_ACP, 0, es->text + start, count, textA, countA, NULL, NULL);
|
||||
DbgPrint("[edit](ANSI wordbrk=%p,str=%s,idx=%d,cnt=%d,act=%d)\n",
|
||||
DPRINT1("[edit](ANSI wordbrk=%p,str=%s,idx=%d,cnt=%d,act=%d)\n",
|
||||
es->word_break_proc, textA, countA, index, countA, action);
|
||||
ret = wbpA(textA, index, countA, action);
|
||||
HeapFree(GetProcessHeap(), 0, textA);
|
||||
|
@ -1262,7 +1231,7 @@ static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count
|
|||
ret = EDIT_WordBreakProc(es->text + start, index, count, action);
|
||||
|
||||
//WIN_RestoreWndsLock(iWndsLocks);
|
||||
OutputDebugStringA("Whoo we didn't deadlock\n");
|
||||
DPRINT1("Whoo we didn't deadlock\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1455,13 +1424,13 @@ static void EDIT_LockBuffer(EDITSTATE *es)
|
|||
{
|
||||
if(es->hloc32A)
|
||||
{
|
||||
OutputDebugStringA("Synchronizing with 32-bit ANSI buffer\n");
|
||||
DPRINT1("Synchronizing with 32-bit ANSI buffer\n");
|
||||
textA = LocalLock(es->hloc32A);
|
||||
countA = strlen(textA) + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
OutputDebugStringA("no buffer ... please report\n");
|
||||
DPRINT1("no buffer ... please report\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1469,20 +1438,20 @@ static void EDIT_LockBuffer(EDITSTATE *es)
|
|||
{
|
||||
HLOCAL hloc32W_new;
|
||||
UINT countW_new = MultiByteToWideChar(CP_ACP, 0, textA, countA, NULL, 0);
|
||||
DbgPrint("[edit]%d bytes translated to %d WCHARs\n", countA, countW_new);
|
||||
DPRINT1("[edit]%d bytes translated to %d WCHARs\n", countA, countW_new);
|
||||
if(countW_new > es->buffer_size + 1)
|
||||
{
|
||||
UINT alloc_size = ROUND_TO_GROW(countW_new * sizeof(WCHAR));
|
||||
DbgPrint("[edit]Resizing 32-bit UNICODE buffer from %d+1 to %d WCHARs\n", es->buffer_size, countW_new);
|
||||
DPRINT1("[edit]Resizing 32-bit UNICODE buffer from %d+1 to %d WCHARs\n", es->buffer_size, countW_new);
|
||||
hloc32W_new = LocalReAlloc(es->hloc32W, alloc_size, LMEM_MOVEABLE | LMEM_ZEROINIT);
|
||||
if(hloc32W_new)
|
||||
{
|
||||
es->hloc32W = hloc32W_new;
|
||||
es->buffer_size = LocalSize(hloc32W_new)/sizeof(WCHAR) - 1;
|
||||
DbgPrint("[edit]Real new size %d+1 WCHARs\n", es->buffer_size);
|
||||
DPRINT1("[edit]Real new size %d+1 WCHARs\n", es->buffer_size);
|
||||
}
|
||||
else
|
||||
OutputDebugStringA("FAILED! Will synchronize partially\n");
|
||||
DPRINT1("FAILED! Will synchronize partially\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1631,7 +1600,7 @@ static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size, BOOL honor_limit)
|
|||
if (size <= es->buffer_size)
|
||||
return TRUE;
|
||||
|
||||
DbgPrint("[edit]trying to ReAlloc to %d+1 characters\n", size);
|
||||
DPRINT1("[edit]trying to ReAlloc to %d+1 characters\n", size);
|
||||
|
||||
/* Force edit to unlock it's buffer. es->text now NULL */
|
||||
EDIT_UnlockBuffer(es, TRUE);
|
||||
|
@ -1639,7 +1608,7 @@ static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size, BOOL honor_limit)
|
|||
if (es->hloc32W) {
|
||||
UINT alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
|
||||
if ((hNew32W = LocalReAlloc(es->hloc32W, alloc_size, LMEM_MOVEABLE | LMEM_ZEROINIT))) {
|
||||
DbgPrint("[edit]Old 32 bit handle %p, new handle %p\n", es->hloc32W, hNew32W);
|
||||
DPRINT1("[edit]Old 32 bit handle %p, new handle %p\n", es->hloc32W, hNew32W);
|
||||
es->hloc32W = hNew32W;
|
||||
es->buffer_size = LocalSize(hNew32W)/sizeof(WCHAR) - 1;
|
||||
}
|
||||
|
@ -1648,11 +1617,11 @@ static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size, BOOL honor_limit)
|
|||
EDIT_LockBuffer(es);
|
||||
|
||||
if (es->buffer_size < size) {
|
||||
DbgPrint("[edit]FAILED ! We now have %d+1\n", es->buffer_size);
|
||||
DPRINT1("[edit]FAILED ! We now have %d+1\n", es->buffer_size);
|
||||
EDIT_NOTIFY_PARENT(es, EN_ERRSPACE, "EN_ERRSPACE");
|
||||
return FALSE;
|
||||
} else {
|
||||
DbgPrint("[edit]We now have %d+1\n", es->buffer_size);
|
||||
DPRINT1("[edit]We now have %d+1\n", es->buffer_size);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1668,11 +1637,11 @@ static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size, BOOL honor_limit)
|
|||
static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size)
|
||||
{
|
||||
UINT alloc_size;
|
||||
DbgPrint("[edit] EDIT_MakeUndoFit\n");
|
||||
DPRINT1("[edit] EDIT_MakeUndoFit\n");
|
||||
if (size <= es->undo_buffer_size)
|
||||
return TRUE;
|
||||
|
||||
DbgPrint("[edit]trying to ReAlloc to %d+1\n", size);
|
||||
DPRINT1("[edit]trying to ReAlloc to %d+1\n", size);
|
||||
|
||||
alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
|
||||
if ((es->undo_text = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, es->undo_text, alloc_size))) {
|
||||
|
@ -1681,7 +1650,7 @@ static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size)
|
|||
}
|
||||
else
|
||||
{
|
||||
DbgPrint("[edit]FAILED ! We now have %d+1\n", es->undo_buffer_size);
|
||||
DPRINT1("[edit]FAILED ! We now have %d+1\n", es->undo_buffer_size);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -1968,7 +1937,7 @@ static void EDIT_PaintLine(EDITSTATE *es, HDC dc, INT line, BOOL rev)
|
|||
} else if (line)
|
||||
return;
|
||||
|
||||
DbgPrint("[edit]line=%d\n", line);
|
||||
DPRINT1("[edit]line=%d\n", line);
|
||||
|
||||
pos = EDIT_EM_PosFromChar(es, EDIT_EM_LineIndex(es, line), FALSE);
|
||||
x = SLOWORD(pos);
|
||||
|
@ -2110,28 +2079,28 @@ static void EDIT_SetRectNP(EDITSTATE *es, LPRECT rc)
|
|||
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
|
||||
{
|
||||
//HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE );
|
||||
/*DbgPrint("[edit] in EDIT_UnlockBuffer. Force: %s\n", (force) ? ("TRUE"): ("FALSE"));*/
|
||||
/*DPRINT1("[edit] in EDIT_UnlockBuffer. Force: %s\n", (force) ? ("TRUE"): ("FALSE"));*/
|
||||
/* Edit window might be already destroyed */
|
||||
if(!IsWindow(es->hwndSelf))
|
||||
{
|
||||
DbgPrint("[edit]edit hwnd %p already destroyed\n", es->hwndSelf);
|
||||
DPRINT1("[edit]edit hwnd %p already destroyed\n", es->hwndSelf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!es->lock_count) {
|
||||
DbgPrint("lock_count == 0 ... please report\n");
|
||||
OutputDebugStringA("lock_count == 0 ... please report\n");
|
||||
DPRINT1("lock_count == 0 ... please report\n");
|
||||
DPRINT1("lock_count == 0 ... please report\n");
|
||||
return;
|
||||
}
|
||||
if (!es->text) {
|
||||
DbgPrint("es->text == 0 ... please report\n");
|
||||
OutputDebugStringA("es->text == 0 ... please report\n");
|
||||
DPRINT1("es->text == 0 ... please report\n");
|
||||
DPRINT1("es->text == 0 ... please report\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (force || (es->lock_count == 1))
|
||||
{
|
||||
/*DbgPrint("[edit]force or lock_count == 1\n");*/
|
||||
/*DPRINT1("[edit]force or lock_count == 1\n");*/
|
||||
if (es->hloc32W) {
|
||||
CHAR *textA = NULL;
|
||||
UINT countA = 0;
|
||||
|
@ -2140,25 +2109,25 @@ static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
|
|||
if(es->hloc32A)
|
||||
{
|
||||
UINT countA_new = WideCharToMultiByte(CP_ACP, 0, es->text, countW, NULL, 0, NULL, NULL);
|
||||
OutputDebugStringA("Synchronizing with 32-bit ANSI buffer\n");
|
||||
DPRINT1("Synchronizing with 32-bit ANSI buffer\n");
|
||||
|
||||
DbgPrint("[edit]%d WCHARs translated to %d bytes\n", countW, countA_new);
|
||||
DPRINT1("[edit]%d WCHARs translated to %d bytes\n", countW, countA_new);
|
||||
|
||||
countA = LocalSize(es->hloc32A);
|
||||
if(countA_new > countA)
|
||||
{
|
||||
HLOCAL hloc32A_new;
|
||||
UINT alloc_size = ROUND_TO_GROW(countA_new);
|
||||
DbgPrint("[edit]Resizing 32-bit ANSI buffer from %d to %d bytes\n", countA, alloc_size);
|
||||
DPRINT1("[edit]Resizing 32-bit ANSI buffer from %d to %d bytes\n", countA, alloc_size);
|
||||
hloc32A_new = LocalReAlloc(es->hloc32A, alloc_size, LMEM_MOVEABLE | LMEM_ZEROINIT);
|
||||
if(hloc32A_new)
|
||||
{
|
||||
es->hloc32A = hloc32A_new;
|
||||
countA = LocalSize(hloc32A_new);
|
||||
DbgPrint("[edit]Real new size %d bytes\n", countA);
|
||||
DPRINT1("[edit]Real new size %d bytes\n", countA);
|
||||
}
|
||||
else
|
||||
OutputDebugStringA("FAILED! Will synchronize partially\n");
|
||||
DPRINT1("FAILED! Will synchronize partially\n");
|
||||
}
|
||||
textA = LocalLock(es->hloc32A);
|
||||
}
|
||||
|
@ -2172,7 +2141,7 @@ static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
|
|||
}
|
||||
else
|
||||
{
|
||||
OutputDebugStringA("no buffer ... please report\n");
|
||||
DPRINT1("no buffer ... please report\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2187,7 +2156,7 @@ static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
|
|||
*/
|
||||
static void EDIT_UpdateScrollInfo(EDITSTATE *es)
|
||||
{
|
||||
DbgPrint("[edit] EDIT_UpdateScrollInfo\n");
|
||||
DPRINT1("[edit] EDIT_UpdateScrollInfo\n");
|
||||
if ((es->style & WS_VSCROLL) && !(es->flags & EF_VSCROLL_TRACK))
|
||||
{
|
||||
SCROLLINFO si;
|
||||
|
@ -2197,7 +2166,7 @@ static void EDIT_UpdateScrollInfo(EDITSTATE *es)
|
|||
si.nMax = es->line_count - 1;
|
||||
si.nPage = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
|
||||
si.nPos = es->y_offset;
|
||||
DbgPrint("[edit]SB_VERT, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
|
||||
DPRINT1("[edit]SB_VERT, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
|
||||
si.nMin, si.nMax, si.nPage, si.nPos);
|
||||
SetScrollInfo(es->hwndSelf, SB_VERT, &si, TRUE);
|
||||
}
|
||||
|
@ -2211,7 +2180,7 @@ static void EDIT_UpdateScrollInfo(EDITSTATE *es)
|
|||
si.nMax = es->text_width - 1;
|
||||
si.nPage = es->format_rect.right - es->format_rect.left;
|
||||
si.nPos = es->x_offset;
|
||||
DbgPrint("[edit]SB_HORZ, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
|
||||
DPRINT1("[edit]SB_HORZ, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
|
||||
si.nMin, si.nMax, si.nPage, si.nPos);
|
||||
SetScrollInfo(es->hwndSelf, SB_HORZ, &si, TRUE);
|
||||
}
|
||||
|
@ -2232,7 +2201,7 @@ static INT CALLBACK EDIT_WordBreakProc(LPWSTR s, INT index, INT count, INT actio
|
|||
{
|
||||
INT ret = 0;
|
||||
|
||||
DbgPrint("[edit]s=%p, index=%d, count=%d, action=%d\n", s, index, count, action);
|
||||
DPRINT1("[edit]s=%p, index=%d, count=%d, action=%d\n", s, index, count, action);
|
||||
|
||||
if(!s) return 0;
|
||||
|
||||
|
@ -2277,7 +2246,7 @@ static INT CALLBACK EDIT_WordBreakProc(LPWSTR s, INT index, INT count, INT actio
|
|||
ret = (s[index] == ' ');
|
||||
break;
|
||||
default:
|
||||
OutputDebugStringA("unknown action code, please report !\n");
|
||||
DPRINT1("unknown action code, please report !\n");
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
@ -2325,11 +2294,11 @@ static LRESULT EDIT_EM_CharFromPos(EDITSTATE *es, INT x, INT y)
|
|||
*/
|
||||
static BOOL EDIT_EM_FmtLines(EDITSTATE *es, BOOL add_eol)
|
||||
{
|
||||
DbgPrint("[edit] In EDIT_EM_FmtLines\n");
|
||||
DPRINT1("[edit] In EDIT_EM_FmtLines\n");
|
||||
es->flags &= ~EF_USE_SOFTBRK;
|
||||
if (add_eol) {
|
||||
es->flags |= EF_USE_SOFTBRK;
|
||||
OutputDebugStringA("soft break enabled, not implemented\n");
|
||||
DPRINT1("soft break enabled, not implemented\n");
|
||||
}
|
||||
return add_eol;
|
||||
}
|
||||
|
@ -2361,12 +2330,12 @@ static HLOCAL EDIT_EM_GetHandle(EDITSTATE *es)
|
|||
{
|
||||
CHAR *textA;
|
||||
UINT countA, alloc_size;
|
||||
DbgPrint("[edit]Allocating 32-bit ANSI alias buffer\n");
|
||||
DPRINT1("[edit]Allocating 32-bit ANSI alias buffer\n");
|
||||
countA = WideCharToMultiByte(CP_ACP, 0, es->text, -1, NULL, 0, NULL, NULL);
|
||||
alloc_size = ROUND_TO_GROW(countA);
|
||||
if(!(es->hloc32A = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, alloc_size)))
|
||||
{
|
||||
DbgPrint("[edit]Could not allocate %d bytes for 32-bit ANSI alias buffer\n", alloc_size);
|
||||
DPRINT1("[edit]Could not allocate %d bytes for 32-bit ANSI alias buffer\n", alloc_size);
|
||||
return 0;
|
||||
}
|
||||
textA = LocalLock(es->hloc32A);
|
||||
|
@ -2376,7 +2345,7 @@ static HLOCAL EDIT_EM_GetHandle(EDITSTATE *es)
|
|||
hLocal = es->hloc32A;
|
||||
}
|
||||
|
||||
DbgPrint("[edit]Returning %p, LocalSize() = %ld\n", hLocal, LocalSize(hLocal));
|
||||
DPRINT1("[edit]Returning %p, LocalSize() = %ld\n", hLocal, LocalSize(hLocal));
|
||||
return hLocal;
|
||||
}
|
||||
|
||||
|
@ -2719,7 +2688,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
|
|||
LPWSTR p;
|
||||
HRGN hrgn = 0;
|
||||
|
||||
DbgPrint("[edit]EDIT_EM_ReplaceSel can_undo %d, send_update %d\n",
|
||||
DPRINT1("[edit]EDIT_EM_ReplaceSel can_undo %d, send_update %d\n",
|
||||
can_undo, send_update);
|
||||
|
||||
s = es->selection_start;
|
||||
|
@ -2735,7 +2704,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
|
|||
|
||||
if (e != s) {
|
||||
/* there is something to be deleted */
|
||||
OutputDebugStringA("deleting stuff.\n");
|
||||
DPRINT1("deleting stuff.\n");
|
||||
if (can_undo) {
|
||||
utl = strlenW(es->undo_text);
|
||||
if (!es->undo_insert_count && (*es->undo_text && (s == es->undo_position))) {
|
||||
|
@ -2892,7 +2861,7 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action)
|
|||
*/
|
||||
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
|
||||
{
|
||||
DbgPrint("[edit] EDIT_EM_ScrollCaret\n");
|
||||
DPRINT1("[edit] EDIT_EM_ScrollCaret\n");
|
||||
if (es->style & ES_MULTILINE) {
|
||||
INT l;
|
||||
INT li;
|
||||
|
@ -2976,7 +2945,7 @@ static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc)
|
|||
return;
|
||||
|
||||
if (!hloc) {
|
||||
OutputDebugStringA("called with NULL handle\n");
|
||||
DPRINT1("called with NULL handle\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3003,7 +2972,7 @@ static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc)
|
|||
countW = MultiByteToWideChar(CP_ACP, 0, textA, countA, NULL, 0);
|
||||
if(!(hloc32W_new = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, countW * sizeof(WCHAR))))
|
||||
{
|
||||
OutputDebugStringA("Could not allocate new unicode buffer\n");
|
||||
DPRINT1("Could not allocate new unicode buffer\n");
|
||||
return;
|
||||
}
|
||||
textW = LocalLock(hloc32W_new);
|
||||
|
@ -3110,7 +3079,7 @@ static void EDIT_EM_SetMargins(EDITSTATE *es, INT action,
|
|||
else
|
||||
es->right_margin = default_right_margin;
|
||||
}
|
||||
DbgPrint("[edit]left=%d, right=%d\n", es->left_margin, es->right_margin);
|
||||
DPRINT1("[edit]left=%d, right=%d\n", es->left_margin, es->right_margin);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3156,7 +3125,7 @@ static void EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
|
|||
UINT old_start = es->selection_start;
|
||||
UINT old_end = es->selection_end;
|
||||
UINT len = strlenW(es->text);
|
||||
DbgPrint("[edit] EDIT_EM_SetSel\n");
|
||||
DPRINT1("[edit] EDIT_EM_SetSel\n");
|
||||
|
||||
if (start == (UINT)-1) {
|
||||
start = es->selection_end;
|
||||
|
@ -3258,7 +3227,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es)
|
|||
|
||||
strcpyW(utext, es->undo_text);
|
||||
|
||||
DbgPrint("[edit]before UNDO:insertion length = %d, deletion buffer = %s\n",
|
||||
DPRINT1("[edit]before UNDO:insertion length = %d, deletion buffer = %s\n",
|
||||
es->undo_insert_count);
|
||||
|
||||
EDIT_EM_SetSel(es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
|
||||
|
@ -3270,7 +3239,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es)
|
|||
EDIT_EM_ScrollCaret(es);
|
||||
HeapFree(GetProcessHeap(), 0, utext);
|
||||
|
||||
DbgPrint("[edit]after UNDO:insertion length = %d, deletion buffer = %s\n",
|
||||
DPRINT1("[edit]after UNDO:insertion length = %d, deletion buffer = %s\n",
|
||||
es->undo_insert_count);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3379,7 +3348,7 @@ static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND control)
|
|||
EDIT_EM_ScrollCaret(es);
|
||||
break;
|
||||
default:
|
||||
OutputDebugStringA("unknown menu item, please report\n");
|
||||
DPRINT1("unknown menu item, please report\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3491,7 +3460,11 @@ static LRESULT EDIT_WM_Create(EDITSTATE *es, LPCWSTR name)
|
|||
}
|
||||
/* force scroll info update */
|
||||
EDIT_UpdateScrollInfo(es);
|
||||
return 0;
|
||||
/* The rule seems to return 1 here for success */
|
||||
/* Power Builder masked edit controls will crash */
|
||||
/* if not. */
|
||||
/* FIXME: is that in all cases so ? */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3507,7 +3480,7 @@ static LRESULT EDIT_WM_Destroy(EDITSTATE *es)
|
|||
if (es->hloc32W) {
|
||||
while (LocalUnlock(es->hloc32W))
|
||||
{
|
||||
DbgPrint("[edit] spinning on LocalUnlock(es->hloc32W)\n");
|
||||
DPRINT1("[edit] spinning on LocalUnlock(es->hloc32W)\n");
|
||||
}
|
||||
|
||||
LocalFree(es->hloc32W);
|
||||
|
@ -3515,7 +3488,7 @@ static LRESULT EDIT_WM_Destroy(EDITSTATE *es)
|
|||
if (es->hloc32A) {
|
||||
while (LocalUnlock(es->hloc32A))
|
||||
{
|
||||
DbgPrint("[edit] spinning on LocalUnlock(es->hloc32A)\n");
|
||||
DPRINT1("[edit] spinning on LocalUnlock(es->hloc32A)\n");
|
||||
}
|
||||
|
||||
LocalFree(es->hloc32A);
|
||||
|
@ -3610,37 +3583,37 @@ static LRESULT EDIT_WM_HScroll(EDITSTATE *es, INT action, INT pos)
|
|||
fw = es->format_rect.right - es->format_rect.left;
|
||||
switch (action) {
|
||||
case SB_LINELEFT:
|
||||
OutputDebugStringA("SB_LINELEFT\n");
|
||||
DPRINT1("SB_LINELEFT\n");
|
||||
if (es->x_offset)
|
||||
dx = -es->char_width;
|
||||
break;
|
||||
case SB_LINERIGHT:
|
||||
OutputDebugStringA("SB_LINERIGHT\n");
|
||||
DPRINT1("SB_LINERIGHT\n");
|
||||
if (es->x_offset < es->text_width)
|
||||
dx = es->char_width;
|
||||
break;
|
||||
case SB_PAGELEFT:
|
||||
OutputDebugStringA("SB_PAGELEFT\n");
|
||||
DPRINT1("SB_PAGELEFT\n");
|
||||
if (es->x_offset)
|
||||
dx = -fw / HSCROLL_FRACTION / es->char_width * es->char_width;
|
||||
break;
|
||||
case SB_PAGERIGHT:
|
||||
OutputDebugStringA("SB_PAGERIGHT\n");
|
||||
DPRINT1("SB_PAGERIGHT\n");
|
||||
if (es->x_offset < es->text_width)
|
||||
dx = fw / HSCROLL_FRACTION / es->char_width * es->char_width;
|
||||
break;
|
||||
case SB_LEFT:
|
||||
OutputDebugStringA("SB_LEFT\n");
|
||||
DPRINT1("SB_LEFT\n");
|
||||
if (es->x_offset)
|
||||
dx = -es->x_offset;
|
||||
break;
|
||||
case SB_RIGHT:
|
||||
OutputDebugStringA("SB_RIGHT\n");
|
||||
DPRINT1("SB_RIGHT\n");
|
||||
if (es->x_offset < es->text_width)
|
||||
dx = es->text_width - es->x_offset;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
DbgPrint("[edit]SB_THUMBTRACK %d\n", pos);
|
||||
DPRINT1("[edit]SB_THUMBTRACK %d\n", pos);
|
||||
es->flags |= EF_HSCROLL_TRACK;
|
||||
if(es->style & WS_HSCROLL)
|
||||
dx = pos - es->x_offset;
|
||||
|
@ -3656,7 +3629,7 @@ static LRESULT EDIT_WM_HScroll(EDITSTATE *es, INT action, INT pos)
|
|||
}
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
DbgPrint("[edit]SB_THUMBPOSITION %d\n", pos);
|
||||
DPRINT1("[edit]SB_THUMBPOSITION %d\n", pos);
|
||||
es->flags &= ~EF_HSCROLL_TRACK;
|
||||
if(GetWindowLongW( es->hwndSelf, GWL_STYLE ) & WS_HSCROLL)
|
||||
dx = pos - es->x_offset;
|
||||
|
@ -3677,7 +3650,7 @@ static LRESULT EDIT_WM_HScroll(EDITSTATE *es, INT action, INT pos)
|
|||
}
|
||||
break;
|
||||
case SB_ENDSCROLL:
|
||||
OutputDebugStringA("SB_ENDSCROLL\n");
|
||||
DPRINT1("SB_ENDSCROLL\n");
|
||||
break;
|
||||
/*
|
||||
* FIXME : the next two are undocumented !
|
||||
|
@ -3696,12 +3669,12 @@ static LRESULT EDIT_WM_HScroll(EDITSTATE *es, INT action, INT pos)
|
|||
INT fw = es->format_rect.right - es->format_rect.left;
|
||||
ret = es->text_width ? es->x_offset * 100 / (es->text_width - fw) : 0;
|
||||
}
|
||||
DbgPrint("[edit]EM_GETTHUMB: returning %ld\n", ret);
|
||||
DPRINT1("[edit]EM_GETTHUMB: returning %ld\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
default:
|
||||
DbgPrint("[edit]undocumented WM_HSCROLL action %d (0x%04x), please report\n",
|
||||
DPRINT1("[edit]undocumented WM_HSCROLL action %d (0x%04x), please report\n",
|
||||
action, action);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3737,7 +3710,7 @@ static BOOL EDIT_CheckCombo(EDITSTATE *es, UINT msg, INT key)
|
|||
bDropped = TRUE;
|
||||
nEUI = 0;
|
||||
|
||||
DbgPrint("[edit][%p]: handling msg %x (%x)\n", es->hwndSelf, msg, key);
|
||||
DPRINT1("[edit][%p]: handling msg %x (%x)\n", es->hwndSelf, msg, key);
|
||||
|
||||
if (key == VK_UP || key == VK_DOWN)
|
||||
{
|
||||
|
@ -3949,14 +3922,15 @@ static LRESULT EDIT_WM_LButtonDown(EDITSTATE *es, DWORD keys, INT x, INT y)
|
|||
{
|
||||
INT e;
|
||||
BOOL after_wrap;
|
||||
DbgPrint("[edit] In EDIT_WM_LButtonDown at (%d, %d)\n", x, y);
|
||||
DPRINT1("[edit] In EDIT_WM_LButtonDown at (%d, %d)\n", x, y);
|
||||
SetFocus(es->hwndSelf);
|
||||
if (!(es->flags & EF_FOCUSED))
|
||||
{
|
||||
DbgPrint("[edit] !es->flags and EF_FOCUSED\n");
|
||||
DPRINT1("[edit] !es->flags and EF_FOCUSED\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
DbgPrint("[edit] setting scroll carat\n");
|
||||
DPRINT1("[edit] setting scroll carat\n");
|
||||
es->bCaptureState = TRUE;
|
||||
SetCapture(es->hwndSelf);
|
||||
EDIT_ConfinePoint(es, &x, &y);
|
||||
|
@ -3976,7 +3950,7 @@ static LRESULT EDIT_WM_LButtonDown(EDITSTATE *es, DWORD keys, INT x, INT y)
|
|||
*/
|
||||
static LRESULT EDIT_WM_LButtonUp(EDITSTATE *es)
|
||||
{
|
||||
DbgPrint("[edit] In EDIT_WM_LButtonUp\n");
|
||||
DPRINT1("[edit] In EDIT_WM_LButtonUp\n");
|
||||
if (es->bCaptureState) {
|
||||
KillTimer(es->hwndSelf, 0);
|
||||
if (GetCapture() == es->hwndSelf) ReleaseCapture();
|
||||
|
@ -4038,15 +4012,15 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
|
|||
EDITSTATE *es;
|
||||
UINT alloc_size;
|
||||
DWORD buffersz = 0;
|
||||
DbgPrint("[edit]EDIT_WM_NCCreate: Creating %s edit control, style = %08lx\n",
|
||||
DPRINT1("[edit]EDIT_WM_NCCreate: Creating %s edit control, style = %08lx\n",
|
||||
unicode ? "Unicode" : "ANSI", lpcs->style);
|
||||
|
||||
if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es))))
|
||||
{
|
||||
DbgPrint("[edit]ERROR: Failed to allocate edit state structure.\n");
|
||||
DPRINT1("[edit]ERROR: Failed to allocate edit state structure.\n");
|
||||
return FALSE;
|
||||
}
|
||||
DbgPrint("[edit] Calling SetWindowLong\n");
|
||||
DPRINT1("[edit] Calling SetWindowLong\n");
|
||||
SetWindowLongW( hwnd, 0, (LONG)es );
|
||||
|
||||
/*
|
||||
|
@ -4123,11 +4097,11 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
|
|||
/* FIXME: for now, all single line controls are AUTOHSCROLL */
|
||||
es->style |= ES_AUTOHSCROLL;
|
||||
}
|
||||
DbgPrint("[edit] Beginning to allocate buffers\n");
|
||||
DPRINT1("[edit] Beginning to allocate buffers\n");
|
||||
alloc_size = ROUND_TO_GROW((es->buffer_size + 1) * sizeof(WCHAR));
|
||||
if(!(es->hloc32W = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, alloc_size)))
|
||||
{
|
||||
DbgPrint("[edit]ERROR: Failed to allocate memory for the local memory block.\n");
|
||||
DPRINT1("[edit]ERROR: Failed to allocate memory for the local memory block.\n");
|
||||
HeapFree(GetProcessHeap(), 0, es);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -4137,10 +4111,10 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
|
|||
|
||||
|
||||
|
||||
DbgPrint("[edit]Allocating undo buffer(text size (bytes): %d, text size(wchars): %d).\n", buffersz, es->buffer_size );
|
||||
DPRINT1("[edit]Allocating undo buffer(text size (bytes): %d, text size(wchars): %d).\n", buffersz, es->buffer_size );
|
||||
if (!(es->undo_text = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (es->buffer_size + 1) * sizeof(WCHAR))))
|
||||
{
|
||||
DbgPrint("[edit]ERROR: Failed to allocate edit undo buffer.\n");
|
||||
DPRINT1("[edit]ERROR: Failed to allocate edit undo buffer.\n");
|
||||
|
||||
LocalFree(es->hloc32W);
|
||||
HeapFree(GetProcessHeap(), 0, es);
|
||||
|
@ -4152,10 +4126,10 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
|
|||
|
||||
if (es->style & ES_MULTILINE)
|
||||
{
|
||||
DbgPrint("[edit]Allocating Line List.\n");
|
||||
DPRINT1("[edit]Allocating Line List.\n");
|
||||
if (!(es->first_line_def = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINEDEF))))
|
||||
{
|
||||
DbgPrint("[edit]ERROR: Failed to allocate the line break list.\n");
|
||||
DPRINT1("[edit]ERROR: Failed to allocate the line break list.\n");
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, es->undo_text);
|
||||
LocalFree(es->hloc32W);
|
||||
|
@ -4183,12 +4157,12 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
|
|||
//{
|
||||
if ((es->style & WS_BORDER) && !(es->style & WS_DLGFRAME))
|
||||
{
|
||||
DbgPrint("[edit]Setting border style.\n");
|
||||
DPRINT1("[edit]Setting border style.\n");
|
||||
SetWindowLongW( hwnd, GWL_STYLE,
|
||||
GetWindowLongW( hwnd, GWL_STYLE ) & ~WS_BORDER );
|
||||
}
|
||||
//}
|
||||
DbgPrint("[edit]Leaving EDIT_WM_NCCreate\n");
|
||||
DPRINT1("[edit]Leaving EDIT_WM_NCCreate\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -4236,7 +4210,7 @@ static void EDIT_WM_Paint(EDITSTATE *es, WPARAM wParam)
|
|||
if (!es->bEnableState)
|
||||
SetTextColor(dc, GetSysColor(COLOR_GRAYTEXT));
|
||||
GetClipBox(dc, &rcRgn);
|
||||
DbgPrint("[edit...WM_Paint] GetClipBox returns: Top: %d Left: %d Bottom: %d Right: %d\n", rcRgn.top, rcRgn.left, rcRgn.bottom, rcRgn.right);
|
||||
DPRINT1("[edit...WM_Paint] GetClipBox returns: Top: %d Left: %d Bottom: %d Right: %d\n", rcRgn.top, rcRgn.left, rcRgn.bottom, rcRgn.right);
|
||||
if (es->style & ES_MULTILINE) {
|
||||
INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
|
||||
for (i = es->y_offset ; i <= min(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) {
|
||||
|
@ -4288,7 +4262,7 @@ static void EDIT_WM_Paste(EDITSTATE *es)
|
|||
*/
|
||||
static void EDIT_WM_SetFocus(EDITSTATE *es)
|
||||
{
|
||||
DbgPrint("[edit] In EDIT_WM_SetFocus\n");
|
||||
DPRINT1("[edit] In EDIT_WM_SetFocus\n");
|
||||
es->flags |= EF_FOCUSED;
|
||||
CreateCaret(es->hwndSelf, 0, 2, es->line_height);
|
||||
EDIT_SetCaretPos(es, es->selection_end,
|
||||
|
@ -4366,7 +4340,7 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw)
|
|||
static void EDIT_WM_SetText(EDITSTATE *es, LPARAM lParam, BOOL unicode)
|
||||
{
|
||||
LPWSTR text = NULL;
|
||||
DbgPrint("[edit]In WM_SetText: lParam: %s, Unicode: %s\n", (LPCSTR)lParam, unicode ? "TRUE" : "FALSE");
|
||||
DPRINT1("[edit]In WM_SetText: lParam: %s, Unicode: %s\n", (LPCSTR)lParam, unicode ? "TRUE" : "FALSE");
|
||||
if(unicode)
|
||||
text = (LPWSTR)lParam;
|
||||
else if (lParam)
|
||||
|
@ -4384,7 +4358,7 @@ static void EDIT_WM_SetText(EDITSTATE *es, LPARAM lParam, BOOL unicode)
|
|||
HeapFree(GetProcessHeap(), 0, text);
|
||||
} else {
|
||||
static const WCHAR empty_stringW[] = {0};
|
||||
OutputDebugStringA("<NULL>\n");
|
||||
DPRINT1("<NULL>\n");
|
||||
EDIT_EM_ReplaceSel(es, FALSE, empty_stringW, FALSE, FALSE);
|
||||
}
|
||||
es->x_offset = 0;
|
||||
|
@ -4412,7 +4386,7 @@ static void EDIT_WM_Size(EDITSTATE *es, UINT action, INT width, INT height)
|
|||
{
|
||||
if ((action == SIZE_MAXIMIZED) || (action == SIZE_RESTORED)) {
|
||||
RECT rc;
|
||||
DbgPrint("[edit] WM_Size width = %d, height = %d\n", width, height);
|
||||
DPRINT1("[edit] WM_Size width = %d, height = %d\n", width, height);
|
||||
SetRect(&rc, 0, 0, width, height);
|
||||
EDIT_SetRectNP(es, &rc);
|
||||
EDIT_UpdateText(es, NULL, TRUE);
|
||||
|
@ -4471,7 +4445,7 @@ static LRESULT EDIT_WM_StyleChanged ( EDITSTATE *es, WPARAM which, const STYLES
|
|||
} else if ((WPARAM)GWL_EXSTYLE == which) {
|
||||
; /* FIXME - what is needed here */
|
||||
} else {
|
||||
DbgPrint ("[edit]Invalid style change %d\n",which);
|
||||
DPRINT1 ("[edit]Invalid style change %d\n",which);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -4535,19 +4509,19 @@ static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
|
|||
case SB_LINEDOWN:
|
||||
case SB_PAGEUP:
|
||||
case SB_PAGEDOWN:
|
||||
DbgPrint("[edit]action %d\n", action);
|
||||
DPRINT1("[edit]action %d\n", action);
|
||||
EDIT_EM_Scroll(es, action);
|
||||
return 0;
|
||||
case SB_TOP:
|
||||
OutputDebugStringA("SB_TOP\n");
|
||||
DPRINT1("SB_TOP\n");
|
||||
dy = -es->y_offset;
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
OutputDebugStringA("SB_BOTTOM\n");
|
||||
DPRINT1("SB_BOTTOM\n");
|
||||
dy = es->line_count - 1 - es->y_offset;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
DbgPrint("[edit]SB_THUMBTRACK %d\n", pos);
|
||||
DPRINT1("[edit]SB_THUMBTRACK %d\n", pos);
|
||||
es->flags |= EF_VSCROLL_TRACK;
|
||||
if(es->style & WS_VSCROLL)
|
||||
dy = pos - es->y_offset;
|
||||
|
@ -4560,12 +4534,12 @@ static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
|
|||
vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
|
||||
new_y = pos * (es->line_count - vlc) / 100;
|
||||
dy = es->line_count ? (new_y - es->y_offset) : 0;
|
||||
DbgPrint("[edit]line_count=%d, y_offset=%d, pos=%d, dy = %d\n",
|
||||
DPRINT1("[edit]line_count=%d, y_offset=%d, pos=%d, dy = %d\n",
|
||||
es->line_count, es->y_offset, pos, dy);
|
||||
}
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
DbgPrint("[edit]SB_THUMBPOSITION %d\n", pos);
|
||||
DPRINT1("[edit]SB_THUMBPOSITION %d\n", pos);
|
||||
es->flags &= ~EF_VSCROLL_TRACK;
|
||||
if(es->style & WS_VSCROLL)
|
||||
dy = pos - es->y_offset;
|
||||
|
@ -4578,7 +4552,7 @@ static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
|
|||
vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
|
||||
new_y = pos * (es->line_count - vlc) / 100;
|
||||
dy = es->line_count ? (new_y - es->y_offset) : 0;
|
||||
DbgPrint("[edit]line_count=%d, y_offset=%d, pos=%d, dy = %d\n",
|
||||
DPRINT1("[edit]line_count=%d, y_offset=%d, pos=%d, dy = %d\n",
|
||||
es->line_count, es->y_offset, pos, dy);
|
||||
}
|
||||
if (!dy)
|
||||
|
@ -4589,7 +4563,7 @@ static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
|
|||
}
|
||||
break;
|
||||
case SB_ENDSCROLL:
|
||||
OutputDebugStringA("SB_ENDSCROLL\n");
|
||||
DPRINT1("SB_ENDSCROLL\n");
|
||||
break;
|
||||
/*
|
||||
* FIXME : the next two are undocumented !
|
||||
|
@ -4608,12 +4582,12 @@ static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
|
|||
INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
|
||||
ret = es->line_count ? es->y_offset * 100 / (es->line_count - vlc) : 0;
|
||||
}
|
||||
DbgPrint("[edit]EM_GETTHUMB: returning %ld\n", ret);
|
||||
DPRINT1("[edit]EM_GETTHUMB: returning %ld\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
default:
|
||||
DbgPrint("[edit]Undocumented WM_VSCROLL action %d (0x%04x), please report\n",
|
||||
DPRINT1("[edit]Undocumented WM_VSCROLL action %d (0x%04x), please report\n",
|
||||
action, action);
|
||||
return 0;
|
||||
}
|
||||
|
@ -4629,7 +4603,7 @@ static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
|
|||
*/
|
||||
static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase)
|
||||
{
|
||||
DbgPrint("[edit] EDIT_UpdateTextRegion\n");
|
||||
DPRINT1("[edit] EDIT_UpdateTextRegion\n");
|
||||
if (es->flags & EF_UPDATE) EDIT_NOTIFY_PARENT(es, EN_UPDATE, "EN_UPDATE");
|
||||
InvalidateRgn(es->hwndSelf, hrgn, bErase);
|
||||
}
|
||||
|
@ -4642,7 +4616,7 @@ static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase)
|
|||
*/
|
||||
static void EDIT_UpdateText(EDITSTATE *es, LPRECT rc, BOOL bErase)
|
||||
{
|
||||
DbgPrint("[edit] EDIT_UpdateText\n");
|
||||
DPRINT1("[edit] EDIT_UpdateText\n");
|
||||
if (es->flags & EF_UPDATE) EDIT_NOTIFY_PARENT(es, EN_UPDATE, "EN_UPDATE");
|
||||
InvalidateRect(es->hwndSelf, rc, bErase);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: listbox.c,v 1.13 2003/11/08 15:35:58 mf Exp $
|
||||
/* $Id: listbox.c,v 1.14 2003/12/14 19:36:15 sedwards Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User32
|
||||
|
@ -10,14 +10,14 @@
|
|||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
//#include <stdio.h>
|
||||
#include "windows.h"
|
||||
#include "controls.h"
|
||||
#include "user32/regcontrol.h"
|
||||
#include "user32.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
/* Unimplemented yet:
|
||||
* - LBS_USETABSTOPS
|
||||
|
@ -29,42 +29,7 @@
|
|||
|
||||
/* Start of hack section -------------------------------- */
|
||||
|
||||
#define strcpyW wcscpy
|
||||
#define strlenW wcslen
|
||||
#define strncmpiW _wcsnicmp
|
||||
#define strcmpW wcscmp
|
||||
#define strcatW wcscat
|
||||
|
||||
#define TRACE_ON(x) TRUE
|
||||
#define TRACE_(x) TRACE
|
||||
|
||||
typedef short *LPINT16;
|
||||
// typedef short INT16, *LPINT16;
|
||||
// typedef unsigned short UINT16;
|
||||
|
||||
char* debugstr_w(LPWSTR input)
|
||||
{
|
||||
return "Need to convert";
|
||||
}
|
||||
|
||||
char* debugstr_a(LPSTR input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
void TRACE(const char* format, ...)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ERR(const char* format, ...)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//void FIXME(const char* format, ...)
|
||||
//{
|
||||
//}
|
||||
|
||||
BOOL is_old_app(HWND hwnd)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue